@toclocoinc/lattice-grid 1.103.0 → 1.103.2

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 (408) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/angular/package.json +1 -1
  4. package/docs/API.html +12 -8
  5. package/docs/api/adapters.html +1 -1
  6. package/docs/api/ai.html +1 -1
  7. package/docs/api/alarms.html +1 -1
  8. package/docs/api/calendar.html +1 -1
  9. package/docs/api/charts.html +1 -1
  10. package/docs/api/dashboard.html +1 -1
  11. package/docs/api/data-router.html +1 -1
  12. package/docs/api/deckgl.html +1 -1
  13. package/docs/api/designer.html +1 -1
  14. package/docs/api/form.html +9 -5
  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/scheduler.html +1 -1
  28. package/docs/api/shell.html +1 -1
  29. package/docs/api/tabs.html +1 -1
  30. package/docs/api/types.html +1 -1
  31. package/docs/api-detail.html +4 -4
  32. package/docs/warnings.json +1 -1
  33. package/lattice-grid.d.ts +1 -1
  34. package/lattice-grid.esm.min.js +2 -2
  35. package/lattice-grid.min.cjs +2 -2
  36. package/lattice-grid.min.css +1 -1
  37. package/lattice-grid.min.js +2 -2
  38. package/locales/all.d.ts +1 -1
  39. package/locales/all.esm.min.js +1 -1
  40. package/locales/all.min.cjs +1 -1
  41. package/locales/all.min.js +1 -1
  42. package/locales/ar.d.ts +1 -1
  43. package/locales/ar.esm.min.js +1 -1
  44. package/locales/ar.min.cjs +1 -1
  45. package/locales/ar.min.js +1 -1
  46. package/locales/cs-CZ.d.ts +1 -1
  47. package/locales/cs-CZ.esm.min.js +1 -1
  48. package/locales/cs-CZ.min.cjs +1 -1
  49. package/locales/cs-CZ.min.js +1 -1
  50. package/locales/da-DK.d.ts +1 -1
  51. package/locales/da-DK.esm.min.js +1 -1
  52. package/locales/da-DK.min.cjs +1 -1
  53. package/locales/da-DK.min.js +1 -1
  54. package/locales/de-DE.d.ts +1 -1
  55. package/locales/de-DE.esm.min.js +1 -1
  56. package/locales/de-DE.min.cjs +1 -1
  57. package/locales/de-DE.min.js +1 -1
  58. package/locales/el-GR.d.ts +1 -1
  59. package/locales/el-GR.esm.min.js +1 -1
  60. package/locales/el-GR.min.cjs +1 -1
  61. package/locales/el-GR.min.js +1 -1
  62. package/locales/en-US.d.ts +1 -1
  63. package/locales/en-US.esm.min.js +1 -1
  64. package/locales/en-US.min.cjs +1 -1
  65. package/locales/en-US.min.js +1 -1
  66. package/locales/es-ES.d.ts +1 -1
  67. package/locales/es-ES.esm.min.js +1 -1
  68. package/locales/es-ES.min.cjs +1 -1
  69. package/locales/es-ES.min.js +1 -1
  70. package/locales/fi-FI.d.ts +1 -1
  71. package/locales/fi-FI.esm.min.js +1 -1
  72. package/locales/fi-FI.min.cjs +1 -1
  73. package/locales/fi-FI.min.js +1 -1
  74. package/locales/fr-CA.d.ts +1 -1
  75. package/locales/fr-CA.esm.min.js +1 -1
  76. package/locales/fr-CA.min.cjs +1 -1
  77. package/locales/fr-CA.min.js +1 -1
  78. package/locales/fr-FR.d.ts +1 -1
  79. package/locales/fr-FR.esm.min.js +1 -1
  80. package/locales/fr-FR.min.cjs +1 -1
  81. package/locales/fr-FR.min.js +1 -1
  82. package/locales/hu-HU.d.ts +1 -1
  83. package/locales/hu-HU.esm.min.js +1 -1
  84. package/locales/hu-HU.min.cjs +1 -1
  85. package/locales/hu-HU.min.js +1 -1
  86. package/locales/it-IT.d.ts +1 -1
  87. package/locales/it-IT.esm.min.js +1 -1
  88. package/locales/it-IT.min.cjs +1 -1
  89. package/locales/it-IT.min.js +1 -1
  90. package/locales/ja-JP.d.ts +1 -1
  91. package/locales/ja-JP.esm.min.js +1 -1
  92. package/locales/ja-JP.min.cjs +1 -1
  93. package/locales/ja-JP.min.js +1 -1
  94. package/locales/nb-NO.d.ts +1 -1
  95. package/locales/nb-NO.esm.min.js +1 -1
  96. package/locales/nb-NO.min.cjs +1 -1
  97. package/locales/nb-NO.min.js +1 -1
  98. package/locales/nl-NL.d.ts +1 -1
  99. package/locales/nl-NL.esm.min.js +1 -1
  100. package/locales/nl-NL.min.cjs +1 -1
  101. package/locales/nl-NL.min.js +1 -1
  102. package/locales/pl-PL.d.ts +1 -1
  103. package/locales/pl-PL.esm.min.js +1 -1
  104. package/locales/pl-PL.min.cjs +1 -1
  105. package/locales/pl-PL.min.js +1 -1
  106. package/locales/pt-BR.d.ts +1 -1
  107. package/locales/pt-BR.esm.min.js +1 -1
  108. package/locales/pt-BR.min.cjs +1 -1
  109. package/locales/pt-BR.min.js +1 -1
  110. package/locales/ro-RO.d.ts +1 -1
  111. package/locales/ro-RO.esm.min.js +1 -1
  112. package/locales/ro-RO.min.cjs +1 -1
  113. package/locales/ro-RO.min.js +1 -1
  114. package/locales/sv-SE.d.ts +1 -1
  115. package/locales/sv-SE.esm.min.js +1 -1
  116. package/locales/sv-SE.min.cjs +1 -1
  117. package/locales/sv-SE.min.js +1 -1
  118. package/locales/uk-UA.d.ts +1 -1
  119. package/locales/uk-UA.esm.min.js +1 -1
  120. package/locales/uk-UA.min.cjs +1 -1
  121. package/locales/uk-UA.min.js +1 -1
  122. package/modules/ai.d.ts +1 -1
  123. package/modules/ai.esm.min.js +1 -1
  124. package/modules/ai.min.cjs +1 -1
  125. package/modules/ai.min.js +1 -1
  126. package/modules/alarms.d.ts +1 -1
  127. package/modules/alarms.esm.min.js +1 -1
  128. package/modules/alarms.min.cjs +1 -1
  129. package/modules/alarms.min.js +1 -1
  130. package/modules/angular.d.ts +1 -1
  131. package/modules/angular.esm.min.js +1 -1
  132. package/modules/angular.min.cjs +1 -1
  133. package/modules/angular.min.js +1 -1
  134. package/modules/calendar.d.ts +1 -1
  135. package/modules/calendar.esm.min.js +1 -1
  136. package/modules/calendar.min.cjs +1 -1
  137. package/modules/calendar.min.js +1 -1
  138. package/modules/chart-alluvial.d.ts +1 -1
  139. package/modules/chart-alluvial.esm.min.js +1 -1
  140. package/modules/chart-alluvial.min.cjs +1 -1
  141. package/modules/chart-alluvial.min.js +1 -1
  142. package/modules/chart-arc.d.ts +1 -1
  143. package/modules/chart-arc.esm.min.js +1 -1
  144. package/modules/chart-arc.min.cjs +1 -1
  145. package/modules/chart-arc.min.js +1 -1
  146. package/modules/chart-barrace.d.ts +1 -1
  147. package/modules/chart-barrace.esm.min.js +1 -1
  148. package/modules/chart-barrace.min.cjs +1 -1
  149. package/modules/chart-barrace.min.js +1 -1
  150. package/modules/chart-bubblemap.d.ts +1 -1
  151. package/modules/chart-bubblemap.esm.min.js +1 -1
  152. package/modules/chart-bubblemap.min.cjs +1 -1
  153. package/modules/chart-bubblemap.min.js +1 -1
  154. package/modules/chart-bump.d.ts +1 -1
  155. package/modules/chart-bump.esm.min.js +1 -1
  156. package/modules/chart-bump.min.cjs +1 -1
  157. package/modules/chart-bump.min.js +1 -1
  158. package/modules/chart-calendar.d.ts +1 -1
  159. package/modules/chart-calendar.esm.min.js +1 -1
  160. package/modules/chart-calendar.min.cjs +1 -1
  161. package/modules/chart-calendar.min.js +1 -1
  162. package/modules/chart-choropleth.d.ts +1 -1
  163. package/modules/chart-choropleth.esm.min.js +1 -1
  164. package/modules/chart-choropleth.min.cjs +1 -1
  165. package/modules/chart-choropleth.min.js +1 -1
  166. package/modules/chart-decomposition.d.ts +1 -1
  167. package/modules/chart-decomposition.esm.min.js +1 -1
  168. package/modules/chart-decomposition.min.cjs +1 -1
  169. package/modules/chart-decomposition.min.js +1 -1
  170. package/modules/chart-diverging.d.ts +1 -1
  171. package/modules/chart-diverging.esm.min.js +1 -1
  172. package/modules/chart-diverging.min.cjs +1 -1
  173. package/modules/chart-diverging.min.js +1 -1
  174. package/modules/chart-dumbbell.d.ts +1 -1
  175. package/modules/chart-dumbbell.esm.min.js +1 -1
  176. package/modules/chart-dumbbell.min.cjs +1 -1
  177. package/modules/chart-dumbbell.min.js +1 -1
  178. package/modules/chart-fan.d.ts +1 -1
  179. package/modules/chart-fan.esm.min.js +1 -1
  180. package/modules/chart-fan.min.cjs +1 -1
  181. package/modules/chart-fan.min.js +1 -1
  182. package/modules/chart-forcetree.d.ts +1 -1
  183. package/modules/chart-forcetree.esm.min.js +1 -1
  184. package/modules/chart-forcetree.min.cjs +1 -1
  185. package/modules/chart-forcetree.min.js +1 -1
  186. package/modules/chart-hexbin.d.ts +1 -1
  187. package/modules/chart-hexbin.esm.min.js +1 -1
  188. package/modules/chart-hexbin.min.cjs +1 -1
  189. package/modules/chart-hexbin.min.js +1 -1
  190. package/modules/chart-hexmap.d.ts +1 -1
  191. package/modules/chart-hexmap.esm.min.js +1 -1
  192. package/modules/chart-hexmap.min.cjs +1 -1
  193. package/modules/chart-hexmap.min.js +1 -1
  194. package/modules/chart-icicle.d.ts +1 -1
  195. package/modules/chart-icicle.esm.min.js +1 -1
  196. package/modules/chart-icicle.min.cjs +1 -1
  197. package/modules/chart-icicle.min.js +1 -1
  198. package/modules/chart-markermap.d.ts +1 -1
  199. package/modules/chart-markermap.esm.min.js +1 -1
  200. package/modules/chart-markermap.min.cjs +1 -1
  201. package/modules/chart-markermap.min.js +1 -1
  202. package/modules/chart-motion.d.ts +1 -1
  203. package/modules/chart-motion.esm.min.js +1 -1
  204. package/modules/chart-motion.min.cjs +1 -1
  205. package/modules/chart-motion.min.js +1 -1
  206. package/modules/chart-pack.d.ts +1 -1
  207. package/modules/chart-pack.esm.min.js +1 -1
  208. package/modules/chart-pack.min.cjs +1 -1
  209. package/modules/chart-pack.min.js +1 -1
  210. package/modules/chart-parallel.d.ts +1 -1
  211. package/modules/chart-parallel.esm.min.js +1 -1
  212. package/modules/chart-parallel.min.cjs +1 -1
  213. package/modules/chart-parallel.min.js +1 -1
  214. package/modules/chart-pictorial.d.ts +1 -1
  215. package/modules/chart-pictorial.esm.min.js +1 -1
  216. package/modules/chart-pictorial.min.cjs +1 -1
  217. package/modules/chart-pictorial.min.js +1 -1
  218. package/modules/chart-polararea.d.ts +1 -1
  219. package/modules/chart-polararea.esm.min.js +1 -1
  220. package/modules/chart-polararea.min.cjs +1 -1
  221. package/modules/chart-polararea.min.js +1 -1
  222. package/modules/chart-polarscatter.d.ts +1 -1
  223. package/modules/chart-polarscatter.esm.min.js +1 -1
  224. package/modules/chart-polarscatter.min.cjs +1 -1
  225. package/modules/chart-polarscatter.min.js +1 -1
  226. package/modules/chart-pyramid.d.ts +1 -1
  227. package/modules/chart-pyramid.esm.min.js +1 -1
  228. package/modules/chart-pyramid.min.cjs +1 -1
  229. package/modules/chart-pyramid.min.js +1 -1
  230. package/modules/chart-radialbar.d.ts +1 -1
  231. package/modules/chart-radialbar.esm.min.js +1 -1
  232. package/modules/chart-radialbar.min.cjs +1 -1
  233. package/modules/chart-radialbar.min.js +1 -1
  234. package/modules/chart-ridgeline.d.ts +1 -1
  235. package/modules/chart-ridgeline.esm.min.js +1 -1
  236. package/modules/chart-ridgeline.min.cjs +1 -1
  237. package/modules/chart-ridgeline.min.js +1 -1
  238. package/modules/chart-roc.d.ts +1 -1
  239. package/modules/chart-roc.esm.min.js +1 -1
  240. package/modules/chart-roc.min.cjs +1 -1
  241. package/modules/chart-roc.min.js +1 -1
  242. package/modules/chart-scatter3d.d.ts +1 -1
  243. package/modules/chart-scatter3d.esm.min.js +1 -1
  244. package/modules/chart-scatter3d.min.cjs +1 -1
  245. package/modules/chart-scatter3d.min.js +1 -1
  246. package/modules/chart-serpentine.d.ts +1 -1
  247. package/modules/chart-serpentine.esm.min.js +1 -1
  248. package/modules/chart-serpentine.min.cjs +1 -1
  249. package/modules/chart-serpentine.min.js +1 -1
  250. package/modules/chart-slope.d.ts +1 -1
  251. package/modules/chart-slope.esm.min.js +1 -1
  252. package/modules/chart-slope.min.cjs +1 -1
  253. package/modules/chart-slope.min.js +1 -1
  254. package/modules/chart-spiral.d.ts +1 -1
  255. package/modules/chart-spiral.esm.min.js +1 -1
  256. package/modules/chart-spiral.min.cjs +1 -1
  257. package/modules/chart-spiral.min.js +1 -1
  258. package/modules/chart-splom.d.ts +1 -1
  259. package/modules/chart-splom.esm.min.js +1 -1
  260. package/modules/chart-splom.min.cjs +1 -1
  261. package/modules/chart-splom.min.js +1 -1
  262. package/modules/chart-tree.d.ts +1 -1
  263. package/modules/chart-tree.esm.min.js +1 -1
  264. package/modules/chart-tree.min.cjs +1 -1
  265. package/modules/chart-tree.min.js +1 -1
  266. package/modules/chart-venn.d.ts +1 -1
  267. package/modules/chart-venn.esm.min.js +1 -1
  268. package/modules/chart-venn.min.cjs +1 -1
  269. package/modules/chart-venn.min.js +1 -1
  270. package/modules/chart-voronoi.d.ts +1 -1
  271. package/modules/chart-voronoi.esm.min.js +1 -1
  272. package/modules/chart-voronoi.min.cjs +1 -1
  273. package/modules/chart-voronoi.min.js +1 -1
  274. package/modules/chart-waffle.d.ts +1 -1
  275. package/modules/chart-waffle.esm.min.js +1 -1
  276. package/modules/chart-waffle.min.cjs +1 -1
  277. package/modules/chart-waffle.min.js +1 -1
  278. package/modules/chart-wordcloud.d.ts +1 -1
  279. package/modules/chart-wordcloud.esm.min.js +1 -1
  280. package/modules/chart-wordcloud.min.cjs +1 -1
  281. package/modules/chart-wordcloud.min.js +1 -1
  282. package/modules/charts.d.ts +1 -1
  283. package/modules/charts.esm.min.js +1 -1
  284. package/modules/charts.min.cjs +1 -1
  285. package/modules/charts.min.js +1 -1
  286. package/modules/dashboard.d.ts +1 -1
  287. package/modules/dashboard.esm.min.js +1 -1
  288. package/modules/dashboard.min.cjs +1 -1
  289. package/modules/dashboard.min.js +1 -1
  290. package/modules/data-router.d.ts +1 -1
  291. package/modules/data-router.esm.min.js +1 -1
  292. package/modules/data-router.min.cjs +1 -1
  293. package/modules/data-router.min.js +1 -1
  294. package/modules/deckgl.d.ts +1 -1
  295. package/modules/deckgl.esm.min.js +1 -1
  296. package/modules/deckgl.min.cjs +1 -1
  297. package/modules/deckgl.min.js +1 -1
  298. package/modules/designer.d.ts +1 -1
  299. package/modules/designer.esm.min.js +1 -1
  300. package/modules/designer.min.cjs +1 -1
  301. package/modules/designer.min.js +1 -1
  302. package/modules/devtools.d.ts +1 -1
  303. package/modules/devtools.esm.min.js +1 -1
  304. package/modules/devtools.min.cjs +1 -1
  305. package/modules/devtools.min.js +1 -1
  306. package/modules/dhtmlx-compat.d.ts +1 -1
  307. package/modules/dhtmlx-compat.esm.min.js +1 -1
  308. package/modules/dhtmlx-compat.min.cjs +1 -1
  309. package/modules/dhtmlx-compat.min.js +1 -1
  310. package/modules/form.d.ts +2 -2
  311. package/modules/form.esm.min.js +252 -222
  312. package/modules/form.esm.min.js.map +2 -2
  313. package/modules/form.min.cjs +252 -222
  314. package/modules/form.min.js +252 -222
  315. package/modules/form.min.js.map +2 -2
  316. package/modules/gantt.d.ts +1 -1
  317. package/modules/gantt.esm.min.js +1 -1
  318. package/modules/gantt.min.cjs +1 -1
  319. package/modules/gantt.min.js +1 -1
  320. package/modules/geo-europe-nuts.d.ts +1 -1
  321. package/modules/geo-europe-nuts.esm.min.js +1 -1
  322. package/modules/geo-europe-nuts.min.cjs +1 -1
  323. package/modules/geo-europe-nuts.min.js +1 -1
  324. package/modules/geo-uk.d.ts +1 -1
  325. package/modules/geo-uk.esm.min.js +1 -1
  326. package/modules/geo-uk.min.cjs +1 -1
  327. package/modules/geo-uk.min.js +1 -1
  328. package/modules/geo-us-states.d.ts +1 -1
  329. package/modules/geo-us-states.esm.min.js +1 -1
  330. package/modules/geo-us-states.min.cjs +1 -1
  331. package/modules/geo-us-states.min.js +1 -1
  332. package/modules/geo-world-110m.d.ts +1 -1
  333. package/modules/geo-world-110m.esm.min.js +1 -1
  334. package/modules/geo-world-110m.min.cjs +1 -1
  335. package/modules/geo-world-110m.min.js +1 -1
  336. package/modules/geo-world-50m.d.ts +1 -1
  337. package/modules/geo-world-50m.esm.min.js +1 -1
  338. package/modules/geo-world-50m.min.cjs +1 -1
  339. package/modules/geo-world-50m.min.js +1 -1
  340. package/modules/geometry.d.ts +1 -1
  341. package/modules/geometry.esm.min.js +1 -1
  342. package/modules/geometry.min.cjs +1 -1
  343. package/modules/geometry.min.js +1 -1
  344. package/modules/htmx.d.ts +1 -1
  345. package/modules/htmx.esm.min.js +2 -2
  346. package/modules/htmx.min.cjs +2 -2
  347. package/modules/htmx.min.js +2 -2
  348. package/modules/kanban.d.ts +1 -1
  349. package/modules/kanban.esm.min.js +1 -1
  350. package/modules/kanban.min.cjs +1 -1
  351. package/modules/kanban.min.js +1 -1
  352. package/modules/kpi.d.ts +1 -1
  353. package/modules/kpi.esm.min.js +1 -1
  354. package/modules/kpi.min.cjs +1 -1
  355. package/modules/kpi.min.js +1 -1
  356. package/modules/layout.d.ts +1 -1
  357. package/modules/layout.esm.min.js +1 -1
  358. package/modules/layout.min.cjs +1 -1
  359. package/modules/layout.min.js +1 -1
  360. package/modules/leaflet.d.ts +1 -1
  361. package/modules/leaflet.esm.min.js +1 -1
  362. package/modules/leaflet.min.cjs +1 -1
  363. package/modules/leaflet.min.js +1 -1
  364. package/modules/list.d.ts +1 -1
  365. package/modules/list.esm.min.js +1 -1
  366. package/modules/list.min.cjs +1 -1
  367. package/modules/list.min.js +1 -1
  368. package/modules/mapview.d.ts +1 -1
  369. package/modules/mapview.esm.min.js +1 -1
  370. package/modules/mapview.min.cjs +1 -1
  371. package/modules/mapview.min.js +1 -1
  372. package/modules/mock-socket.d.ts +1 -1
  373. package/modules/mock-socket.esm.min.js +1 -1
  374. package/modules/mock-socket.min.cjs +1 -1
  375. package/modules/mock-socket.min.js +1 -1
  376. package/modules/presets.d.ts +1 -1
  377. package/modules/presets.esm.min.js +1 -1
  378. package/modules/presets.min.cjs +1 -1
  379. package/modules/presets.min.js +1 -1
  380. package/modules/react.d.ts +1 -1
  381. package/modules/react.esm.min.js +1 -1
  382. package/modules/react.min.cjs +1 -1
  383. package/modules/react.min.js +1 -1
  384. package/modules/scheduler.d.ts +1 -1
  385. package/modules/scheduler.esm.min.js +1 -1
  386. package/modules/scheduler.min.cjs +1 -1
  387. package/modules/scheduler.min.js +1 -1
  388. package/modules/shell.d.ts +1 -1
  389. package/modules/shell.esm.min.js +1 -1
  390. package/modules/shell.min.cjs +1 -1
  391. package/modules/shell.min.js +1 -1
  392. package/modules/svelte.d.ts +1 -1
  393. package/modules/svelte.esm.min.js +1 -1
  394. package/modules/svelte.min.cjs +1 -1
  395. package/modules/svelte.min.js +1 -1
  396. package/modules/tabs.d.ts +1 -1
  397. package/modules/tabs.esm.min.js +1 -1
  398. package/modules/tabs.min.cjs +1 -1
  399. package/modules/tabs.min.js +1 -1
  400. package/modules/vue.d.ts +1 -1
  401. package/modules/vue.esm.min.js +1 -1
  402. package/modules/vue.min.cjs +1 -1
  403. package/modules/vue.min.js +1 -1
  404. package/modules/webcomponent.d.ts +1 -1
  405. package/modules/webcomponent.esm.min.js +2 -2
  406. package/modules/webcomponent.min.cjs +2 -2
  407. package/modules/webcomponent.min.js +2 -2
  408. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * Lattice Grid 1.103.0, webcomponent module
2
+ * Lattice Grid 1.103.2, webcomponent module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
6
6
  var hr=Object.create(null),pr=Object.create(null);function De(e,U){hr[e]=U}function Kn(e){var U=pr[e];if(U)return U;var te=Object.create(null);pr[e]=te;var M=hr[e];if(!M)throw new Error("[lattice] missing module: "+e);return M(te,Kn),te}De("packages/core/src/internal/predicates.js",function(e,U){"use strict";Object.defineProperty(e,"isObject",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isFunction",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"isNil",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"isBlank",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"isCtor",{enumerable:!0,get:function(){return D}});function te(Z){return Z!==null&&typeof Z=="object"&&!Array.isArray(Z)}function M(Z){return typeof Z=="function"}function X(Z){return Z==null}function B(Z){return Z==null||Z===""}function D(Z){return typeof Z!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(Z))?!0:!!(Z.prototype&&Object.getOwnPropertyNames(Z.prototype).length>1)}}),De("packages/core/src/internal/warn.js",function(e,U){"use strict";Object.defineProperty(e,"reportedWarnings",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"warnOnce",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"infoOnce",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"resetWarnings",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"fail",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"invariant",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEV",{enumerable:!0,get:function(){return f}});const te=new Set,M=2e3;function X(o){if(te.add(o),te.size>M){const n=te.values().next().value;n!==void 0&&te.delete(n)}}const B=[],D=500;function Z(o,n,t){B.push({key:o,level:n,message:t.map(i=>typeof i=="string"?i:K(i)).join(" "),at:Date.now()}),B.length>D&&B.shift()}function K(o){if(o instanceof Error)return o.message;try{return JSON.stringify(o)}catch{return String(o)}}function I(){return B.map(o=>({...o}))}function G(o){if(o.length===0||typeof o[0]!="string")return o;const n=o[0].replace(/^\[lattice\]\s*/,"");return n===o[0]?o:[n,...o.slice(1)]}function H(o,...n){if(te.has(o))return;X(o);const t=G(n);Z(o,"warn",t),console.warn("[lattice]",...t)}function S(o,...n){if(te.has(o))return;X(o);const t=G(n);Z(o,"info",t),console.info("[lattice]",...t)}function O(){te.clear(),B.length=0}function b(o,n){const t=new Error(`[lattice] ${o}`);throw n!==void 0&&(t.cause=n),t}function c(o,n){o||b(n)}const f=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})()}),De("packages/core/src/formatting/rules.js",function(e,U){"use strict";Object.defineProperty(e,"RULE_OPS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"DISTRIBUTION_OPS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"DISTRIBUTION_LABELS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"testRule",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"mixColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"summariseColumn",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"quantileOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"needsDistribution",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"resolveDistribution",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ICON_SETS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"compileRules",{enumerable:!0,get:function(){return E}});const M=U("packages/core/src/internal/predicates.js").isFunction,B=U("packages/core/src/internal/warn.js").warnOnce,D=Object.freeze(["eq","ne","gt","gte","lt","lte","between","outside","contains","notContains","startsWith","endsWith","blank","notBlank","true","false"]),Z=Object.freeze(["topPercent","bottomPercent","topN","bottomN","aboveMean","belowMean","aboveMedian","belowMedian","zAbove","zBelow","outlier"]),K=Object.freeze({topPercent:"In the top %",bottomPercent:"In the bottom %",topN:"In the top N",bottomN:"In the bottom N",aboveMean:"Above average",belowMean:"Below average",aboveMedian:"Above the median",belowMedian:"Below the median",zAbove:"Standard deviations above the mean",zBelow:"Standard deviations below the mean",outlier:"An outlier"});function I(L,j){const R=Number(L),$=Number(j);if(L!==null&&L!==""&&j!==null&&j!==""&&Number.isFinite(R)&&Number.isFinite($))return R<$?-1:R>$?1:0;const A=String(L??"").toLowerCase(),C=String(j??"").toLowerCase();return A<C?-1:A>C?1:0}function G(L){return L==null||L===""}function H(L,j){if(!j||typeof j!="object")return!1;const{op:R}=j,$=j.value,T=j.value2;switch(R){case"blank":return G(L);case"notBlank":return!G(L);case"true":return L===!0;case"false":return L===!1;default:break}if(G(L))return!1;switch(R){case"eq":return I(L,$)===0;case"ne":return I(L,$)!==0;case"gt":return I(L,$)>0;case"gte":return I(L,$)>=0;case"lt":return I(L,$)<0;case"lte":return I(L,$)<=0;case"between":return I(L,$)>=0&&I(L,T)<=0;case"outside":return I(L,$)<0||I(L,T)>0;case"contains":return String(L).toLowerCase().includes(String($??"").toLowerCase());case"notContains":return!String(L).toLowerCase().includes(String($??"").toLowerCase());case"startsWith":return String(L).toLowerCase().startsWith(String($??"").toLowerCase());case"endsWith":return String(L).toLowerCase().endsWith(String($??"").toLowerCase());default:return!1}}function S(L,j,R){const $=ee=>{const ne=String(ee).replace("#",""),oe=ne.length===3?ne.split("").map(re=>re+re).join(""):ne;return[0,2,4].map(re=>parseInt(oe.slice(re,re+2),16)||0)},[T,A,C]=$(L),[z,Y,q]=$(j),V=Math.max(0,Math.min(1,R)),J=(ee,ne)=>Math.round(ee+(ne-ee)*V);return`#${[J(T,z),J(A,Y),J(C,q)].map(ee=>ee.toString(16).padStart(2,"0")).join("")}`}function O(L){const j=[];for(const z of L||[]){if(z==null||z==="")continue;const Y=z instanceof Date?z.getTime():Number(z);Number.isFinite(Y)&&j.push(Y)}if(!j.length)return null;j.sort((z,Y)=>z-Y);let R=0,$=0,T=0;for(const z of j){R++;const Y=z-$;$+=Y/R,T+=Y*(z-$)}const A=b(j,.25),C=b(j,.75);return{n:j.length,min:j[0],max:j[j.length-1],mean:$,stddev:j.length>1?Math.sqrt(T/(j.length-1)):0,median:b(j,.5),q1:A,q3:C,iqr:C-A,sorted:j}}function b(L,j){if(!L.length)return 0;const R=(L.length-1)*Math.max(0,Math.min(1,j)),$=Math.floor(R),T=Math.ceil(R);return $===T?L[$]:L[$]+(R-$)*(L[T]-L[$])}function c(L){for(const j of Array.isArray(L)?L:[])if(!(!j||typeof j!="object")&&(j.when&&Z.includes(j.when.op)||j.scale&&j.scale.from||j.dataBar&&!(Number.isFinite(Number(j.dataBar.min))&&Number.isFinite(Number(j.dataBar.max)))||j.iconSet&&!Array.isArray(j.iconSet.thresholds)))return!0;return!1}function f(L,j){const R=Number(L.value),$=T=>b(j.sorted,T);switch(L.op){case"topPercent":{const T=o(R,10);return{op:"gte",value:$(1-T)}}case"bottomPercent":{const T=o(R,10);return{op:"lte",value:$(T)}}case"topN":{const T=Math.max(1,Math.floor(R)||1),A=Math.max(0,j.sorted.length-T);return{op:"gte",value:j.sorted[A]}}case"bottomN":{const T=Math.max(1,Math.floor(R)||1),A=Math.min(j.sorted.length-1,T-1);return{op:"lte",value:j.sorted[A]}}case"aboveMean":return{op:"gt",value:j.mean};case"belowMean":return{op:"lt",value:j.mean};case"aboveMedian":return{op:"gt",value:j.median};case"belowMedian":return{op:"lt",value:j.median};case"zAbove":return j.stddev?{op:"gte",value:j.mean+(Number.isFinite(R)?R:2)*j.stddev}:null;case"zBelow":return j.stddev?{op:"lte",value:j.mean-(Number.isFinite(R)?R:2)*j.stddev}:null;case"outlier":{const T=(Number.isFinite(R)&&R>0?R:1.5)*j.iqr;return j.iqr?{op:"outside",value:j.q1-T,value2:j.q3+T}:null}default:return null}}function o(L,j){const R=Number.isFinite(L)?L:j,$=R>1?R/100:R;return Math.max(0,Math.min(1,$))}function n(L,j){if(L.from==="minmax")return{...L,min:j.min,max:j.max};if(L.from==="quantile")return{...L,min:b(j.sorted,o(Number(L.low),5)),max:b(j.sorted,o(Number(L.high),95))};if(L.from==="stddev"){const R=Number.isFinite(Number(L.deviations))?Number(L.deviations):2;return{...L,min:j.mean-R*j.stddev,max:j.mean+R*j.stddev}}return L}function t(L,j){const R=Array.isArray(L)?L:[];return!j||!j.n?R.map($=>$&&c([$])?{...$,enabled:!1}:$):R.map($=>{if(!$||typeof $!="object")return $;if($.scale&&$.scale.from)return{...$,scale:n($.scale,j)};if($.dataBar)return{...$,dataBar:i($.dataBar,j)};if($.iconSet)return{...$,iconSet:s($.iconSet,j)};if(!$.when||!Z.includes($.when.op))return $;const T=f($.when,j);return T?{...$,when:T}:{...$,enabled:!1}})}function i(L,j){const R=Number.isFinite(Number(L.min))?Number(L.min):void 0,$=Number.isFinite(Number(L.max))?Number(L.max):void 0;if(R!==void 0&&$!==void 0)return{...L,min:R,max:$};if(L.from==="quantile")return{...L,min:R??b(j.sorted,o(Number(L.low),5)),max:$??b(j.sorted,o(Number(L.high),95))};if(L.from==="stddev"){const T=Number.isFinite(Number(L.deviations))?Number(L.deviations):2;return{...L,min:R??j.mean-T*j.stddev,max:$??j.mean+T*j.stddev}}return{...L,min:R??j.min,max:$??j.max}}function s(L,j){if(Array.isArray(L.thresholds))return L;const R=r(L),$=[];for(let T=1;T<R;T++)$.push(b(j.sorted,T/R));return{...L,thresholds:$}}function r(L){if(Array.isArray(L.icons)&&L.icons.length>=2)return L.icons.length;if(Number.isFinite(Number(L.count))&&Number(L.count)>=2)return Math.floor(Number(L.count));const j=v[L.set];return j?j.length:3}function u(L){return`url("data:image/svg+xml,${encodeURIComponent(L)}")`}function a(L){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="${L}"/></svg>`}function l(L,j){return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><polygon points="${j==="up"?"8,2 14,13 2,13":j==="down"?"2,3 14,3 8,14":"4,2 14,8 4,14"}" fill="${L}"/></svg>`}function h(L,j){const R="M8 1l1.9 3.9 4.3.6-3.1 3 .7 4.3L8 13.8 4.2 15.8l.7-4.3-3.1-3 4.3-.6z";let $=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${j*16} 16">`;for(let T=0;T<j;T++){const A=T<L?"#f5a623":"#d0d0d0";$+=`<path transform="translate(${T*16},0)" d="${R}" fill="${A}"/>`}return`${$}</svg>`}const y=Object.freeze([l("#c0392b","down"),l("#e0a800","right"),l("#2e7d32","up")]),m=Object.freeze([a("#d13438"),a("#f5a623"),a("#2e9e44")]),v=Object.freeze({arrows:y,trafficLights:m,ratings:Object.freeze([1,2,3,4,5].map(L=>h(L,5)))}),d=Object.freeze({arrows:"Arrows",trafficLights:"Traffic lights",ratings:"Ratings"});function p(L){if(Array.isArray(L.icons)&&L.icons.length>=2)return L.icons.map($=>/^\s*(url\(|data:|<)/.test(String($))&&String($).trim().startsWith("<")?u(String($)):String($));const j=L.set||"arrows";if(j==="ratings"){const $=r(L),T=[];for(let A=1;A<=$;A++)T.push(u(h(A,$)));return T}const R=v[j];return R?R.map(u):(B(`iconSet:${j}`,`unknown icon set '${j}'; falling back to arrows.`),y.map(u))}function g(L){const j=Number(L.min),$=Number(L.max)-j,T=L.colour||L.color||"#5b9bd5",A=L.negativeColour||L.negativeColor||"#d13438",C=L.direction==="rtl"?"left":"right",z=q=>Math.max(0,Math.min(1,(q-j)/$))*100,Y=$?Math.max(0,Math.min(100,(0-j)/$*100)):0;return q=>{if(G(q))return null;const V=Number(q);if(!Number.isFinite(V)||!$)return null;const J=z(V),ee=Math.min(J,Y),ne=Math.max(J,Y),oe=V>=0?T:A;return{backgroundImage:`linear-gradient(to ${C}, transparent ${ee}%, ${oe} ${ee}%, ${oe} ${ne}%, transparent ${ne}%)`,backgroundRepeat:"no-repeat",backgroundPosition:"0 0"}}}function k(L){const j=p(L),R=L.reverse?[...j].reverse():j,$=(Array.isArray(L.thresholds)?L.thresholds:[]).map(Number).filter(Number.isFinite),T=Number.isFinite(Number(L.size))?Number(L.size):16,A=L.set==="ratings"?T*r(L):T;return C=>{if(G(C))return null;const z=Number(C);if(!Number.isFinite(z))return null;let Y=0;for(const V of $)z>=V&&Y++;const q=R[Math.min(Y,R.length-1)];return q?{backgroundImage:q,backgroundRepeat:"no-repeat",backgroundPosition:"left center",backgroundSize:`${A}px ${T}px`,paddingLeft:`${A+4}px`}:null}}function w(L){const j=Array.isArray(L.colours)&&L.colours.length>=2?L.colours:["#f8f9fa","#1a6bc7"],R=Number(L.min),$=Number(L.max),T=$-R,A=j.length-1,C=[];for(let Y=0;Y<=A;Y++)C.push(A?Y/A:0);const z=Number(L.mid);if(L.mid!==void 0&&L.mid!==null)if(j.length%2===0)B("formatting.scale.mid.even",`a scale's "mid" needs an odd number of colours (a middle stop to pin); ${j.length} were given, so "mid" was ignored.`);else if(Number.isFinite(z)&&T&&z>Math.min(R,$)&&z<Math.max(R,$)){const Y=A/2,q=Math.max(0,Math.min(1,(z-R)/T));for(let V=0;V<=A;V++)C[V]=V<=Y?Y?V/Y*q:q:q+(V-Y)/(A-Y)*(1-q)}else Number.isFinite(z)&&B("formatting.scale.mid.range",`a scale's "mid" (${z}) is outside its min..max range, so it was ignored.`);return Y=>{const q=Number(Y);if(!Number.isFinite(q)||!T)return null;const V=Math.max(0,Math.min(1,(q-R)/T));let J=0;for(;J<A-1&&V>C[J+1];)J++;const ee=C[J+1]-C[J],ne=ee>0?(V-C[J])/ee:0;return{background:S(j[J],j[J+1],Math.max(0,Math.min(1,ne)))}}}function E(L,j=null){const R=c(L)?t(L,j):L,$=(Array.isArray(R)?R:[]).filter(C=>C&&typeof C=="object");if(!$.length)return()=>null;const T=$.map(C=>C.scale?{scale:w(C.scale),enabled:C.enabled!==!1}:C.dataBar?{scale:g(C.dataBar),enabled:C.enabled!==!1}:C.iconSet?{scale:k(C.iconSet),enabled:C.enabled!==!1}:{when:C.when,style:C.style,stop:C.stopIfTrue!==!1,enabled:C.enabled!==!1}),A=N(T)?F():null;return(C,z)=>{const Y=C?C.value:void 0;let q=null;z&&(z.mode=0);for(const V of T){if(!V.enabled)continue;if(V.scale){const ne=V.scale(Y);ne&&(q={...q||{},...ne});continue}if(!H(Y,V.when))continue;let J;const ee=M(V.style);if(ee?z&&A?(J=V.style(A.enter(C)),A.mode>z.mode&&(z.mode=A.mode)):J=V.style(C):J=V.style,J&&(q=q?{...q,...J}:ee?J:{...J}),V.stop)break}return q}}function N(L){return L.some(j=>j.enabled&&!j.scale&&M(j.style))}const x=new Set(["value","colId","column"]),_=new Set(["row","data","index"]);function F(){let L={};const j={mode:0,enter(T){return L=T||{},j.mode=0,$}},R=T=>{if(x.has(T))return;const A=_.has(T)?1:2;A>j.mode&&(j.mode=A)},$=new Proxy({},{get(T,A){return R(A),L[A]},has(T,A){return R(A),A in L},set(T,A,C){return j.mode=2,L[A]=C,!0},ownKeys(){return j.mode=2,Reflect.ownKeys(L)},getOwnPropertyDescriptor(T,A){j.mode=2;const C=Object.getOwnPropertyDescriptor(L,A);return C?{value:L[A],enumerable:C.enumerable,configurable:!0,writable:!0}:void 0}});return j}}),De("packages/core/src/formula/parse.js",function(e,U){"use strict";Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return t}});const te="num",M="str",X="ref",B="name",D="op",Z="end",K=["<=",">=","<>","!="],I="+-*/^%(),<>=";class G extends Error{constructor(s,r){super(s),this.name="FormulaError",this.at=r}}function H(i){const s=[];let r=0;for(;r<i.length;){const u=i[r];if(u===" "||u===" "||u===`
7
- `||u==="\r"){r++;continue}if(u>="0"&&u<="9"){r=O(i,r,s);continue}if(u==="."&&i[r+1]>="0"&&i[r+1]<="9"){r=O(i,r,s);continue}if(u==='"'||u==="'"){r=b(i,r,s);continue}if(u==="["){const l=i.indexOf("]",r+1);if(l<0)throw new G("a [column reference] was opened and never closed",r);s.push({kind:X,value:i.slice(r+1,l).trim(),at:r}),r=l+1;continue}if(S(u)){r=c(i,r,s);continue}const a=i.slice(r,r+2);if(K.includes(a)){s.push({kind:D,value:a==="!="?"<>":a,at:r}),r+=2;continue}if(I.includes(u)){s.push({kind:D,value:u,at:r}),r++;continue}throw new G(`unexpected character ${JSON.stringify(u)}`,r)}return s.push({kind:Z,value:null,at:i.length}),s}function S(i){return/[A-Za-z_À-￿]/.test(i)}function O(i,s,r){let u=s,a=!1;for(;u<i.length;){const l=i[u];if(l>="0"&&l<="9"){u++;continue}if(l==="."&&!a){a=!0,u++;continue}if((l==="e"||l==="E")&&/[0-9+-]/.test(i[u+1]||"")){for(u+=2;u<i.length&&i[u]>="0"&&i[u]<="9";)u++;break}break}return r.push({kind:te,value:Number(i.slice(s,u)),at:s}),u}function b(i,s,r){const u=i[s];let a=s+1,l="";for(;a<i.length;){if(i[a]===u){if(i[a+1]===u){l+=u,a+=2;continue}return r.push({kind:M,value:l,at:s}),a+1}l+=i[a],a++}throw new G("a string was opened and never closed",s)}function c(i,s,r){let u=s;for(;u<i.length&&/[A-Za-z0-9_.À-￿]/.test(i[u]);)u++;const a=i.slice(s,u);let l=u;for(;l<i.length&&i[l]===" ";)l++;return r.push({kind:i[l]==="("?B:X,value:a,at:s}),u}const f={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function o(i){const s=String(i??"").replace(/^\s*=/,"");if(!s.trim())throw new G("the formula is empty");const r=H(s);let u=0;const a=()=>r[u],l=()=>r[u++],h=k=>{const w=a();if(w.kind!==D||w.value!==k)throw new G(`expected ${JSON.stringify(k)}`,w.at);u++},y=k=>{let w=m();for(;;){const E=a();if(E.kind!==D)break;const N=f[E.value];if(!N||N<k)break;u++;const x=y(E.value==="^"?N:N+1);w={kind:"bin",op:E.value,left:w,right:x}}return w},m=()=>{const k=a();return k.kind===D&&(k.value==="-"||k.value==="+")?(u++,{kind:"unary",op:k.value,arg:m()}):v()},v=()=>{let k=d();for(;a().kind===D&&a().value==="%";)u++,k={kind:"unary",op:"%",arg:k};return k},d=()=>{const k=l();if(k.kind===te)return{kind:"num",value:k.value};if(k.kind===M)return{kind:"str",value:k.value};if(k.kind===X)return{kind:"ref",name:k.value};if(k.kind===B){h("(");const w=[];if(!(a().kind===D&&a().value===")"))for(;;){if(w.push(y(1)),a().kind===D&&a().value===","){u++;continue}break}return h(")"),{kind:"call",name:String(k.value).toUpperCase(),args:w}}if(k.kind===D&&k.value==="("){const w=y(1);return h(")"),w}throw k.kind===Z?new G("the formula ends unexpectedly",k.at):new G(`unexpected ${JSON.stringify(k.value)}`,k.at)},p=y(1),g=a();if(g.kind!==Z)throw new G(`unexpected ${JSON.stringify(g.value)}: is an operator missing?`,g.at);return p}function n(i){const s=new Set,r=u=>{if(!(!u||typeof u!="object")){if(u.kind==="ref"){s.add(String(u.name));return}if(u.kind==="bin"){r(u.left),r(u.right);return}if(u.kind==="unary"){r(u.arg);return}if(u.kind==="call")for(const a of u.args)r(a)}};return r(i),[...s]}function t(i){return typeof i=="string"&&/^\s*=/.test(i)&&i.trim()!=="="}}),De("packages/core/src/formula/evaluate.js",function(e,U){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return O}});const M=U("packages/core/src/formula/parse.js").FormulaError;function X(b){if(b==null||b==="")return 0;if(typeof b=="boolean")return b?1:0;if(b instanceof Date)return b.getTime();const c=typeof b=="number"?b:Number(String(b).replace(/[,\s]/g,""));if(!Number.isFinite(c))throw new M(`${JSON.stringify(b)} is not a number`);return c}function B(b){return b==null?"":String(b)}function D(b){if(typeof b=="boolean")return b;if(b==null||b==="")return!1;if(typeof b=="number")return b!==0;const c=String(b).trim().toLowerCase();return c==="false"||c==="no"||c==="0"?!1:c!==""}function Z(b){const c=[];for(const f of b){if(Array.isArray(f)){for(const o of f)o!=null&&o!==""&&c.push(X(o));continue}f==null||f===""||c.push(X(f))}return c}function K(b,c){const f=10**c,o=b*f;return Math.sign(o)*Math.round(Math.abs(o)+Number.EPSILON*Math.abs(o))/f}function I(b,c){if(!b.length)return 0;const f=b.slice().sort((i,s)=>i-s),o=(f.length-1)*Math.min(1,Math.max(0,c)),n=Math.floor(o),t=Math.ceil(o);return n===t?f[n]:f[n]+(o-n)*(f[t]-f[n])}function G(b,c){let f=0,o=0,n=0;for(const i of b){f++;const s=i-o;o+=s/f,n+=s*(i-o)}const t=c?f-1:f;return t>0?Math.sqrt(n/t):0}const H={SUM:b=>Z(b).reduce((c,f)=>c+f,0),AVERAGE:b=>{const c=Z(b);return c.length?c.reduce((f,o)=>f+o,0)/c.length:0},MIN:b=>{const c=Z(b);return c.length?Math.min(...c):0},MAX:b=>{const c=Z(b);return c.length?Math.max(...c):0},COUNT:b=>Z(b).length,PRODUCT:b=>Z(b).reduce((c,f)=>c*f,1),ROUND:b=>K(X(b[0]),b.length>1?X(b[1]):0),ROUNDDOWN:b=>{const c=10**(b.length>1?X(b[1]):0),f=X(b[0])*c;return(f<0?Math.ceil(f):Math.floor(f))/c},ROUNDUP:b=>{const c=10**(b.length>1?X(b[1]):0),f=X(b[0])*c;return(f<0?Math.floor(f):Math.ceil(f))/c},ABS:b=>Math.abs(X(b[0])),FLOOR:b=>Math.floor(X(b[0])),CEILING:b=>Math.ceil(X(b[0])),SQRT:b=>Math.sqrt(X(b[0])),POWER:b=>X(b[0])**X(b[1]),MOD:b=>{const c=X(b[1]);if(c===0)throw new M("MOD by zero");return(X(b[0])%c+c)%c},IF:b=>D(b[0])?b[1]:b.length>2?b[2]:!1,AND:b=>b.every(D),OR:b=>b.some(D),NOT:b=>!D(b[0]),COALESCE:b=>b.find(c=>c!=null&&c!=="")??null,CONCAT:b=>b.map(B).join(""),LEN:b=>B(b[0]).length,UPPER:b=>B(b[0]).toUpperCase(),LOWER:b=>B(b[0]).toLowerCase(),TRIM:b=>B(b[0]).trim(),LEFT:b=>B(b[0]).slice(0,b.length>1?X(b[1]):1),RIGHT:b=>{const c=b.length>1?X(b[1]):1;return c<=0?"":B(b[0]).slice(-c)},MEDIAN:b=>I(Z(b),.5),PERCENTILE:b=>{const c=X(b[b.length-1]);return I(Z(b.slice(0,-1)),c>1?c/100:c)},QUARTILE1:b=>I(Z(b),.25),QUARTILE3:b=>I(Z(b),.75),STDEV:b=>G(Z(b),!0),STDEVP:b=>G(Z(b),!1),VAR:b=>{const c=G(Z(b),!0);return c*c},VARP:b=>{const c=G(Z(b),!1);return c*c},COUNTDISTINCT:b=>{const c=new Set;for(const f of b){const o=Array.isArray(f)?f:[f];for(const n of o)n!=null&&n!==""&&c.add(n)}return c.size},IQR:b=>{const c=Z(b);return I(c,.75)-I(c,.25)}};H.AVG=H.AVERAGE,H.CEIL=H.CEILING,H.POW=H.POWER,H.STDEVS=H.STDEV,H.PERCENTILEINC=H.PERCENTILE;function S(b,c){const f=Number(b),o=Number(c);if(b!==null&&b!==""&&c!==null&&c!==""&&Number.isFinite(f)&&Number.isFinite(o))return f<o?-1:f>o?1:0;const t=B(b).toLowerCase(),i=B(c).toLowerCase();return t<i?-1:t>i?1:0}function O(b,c={}){const f=typeof c.lookup=="function"?c.lookup:null,o=c.functions?{...H,...c.functions}:H,n=t=>{switch(t.kind){case"num":return t.value;case"str":return t.value;case"ref":{if(!f)throw new M(`there is no column called ${JSON.stringify(t.name)} here`);const i=f(String(t.name));if(i===void 0)throw new M(`there is no column called ${JSON.stringify(t.name)}`);return i}case"unary":{if(t.op==="%")return X(n(t.arg))/100;const i=X(n(t.arg));return t.op==="-"?-i:i}case"bin":{const i=t.op;if(i==="=")return S(n(t.left),n(t.right))===0;if(i==="<>")return S(n(t.left),n(t.right))!==0;if(i==="<")return S(n(t.left),n(t.right))<0;if(i==="<=")return S(n(t.left),n(t.right))<=0;if(i===">")return S(n(t.left),n(t.right))>0;if(i===">=")return S(n(t.left),n(t.right))>=0;const s=X(n(t.left)),r=X(n(t.right));if(i==="+")return s+r;if(i==="-")return s-r;if(i==="*")return s*r;if(i==="^")return s**r;if(i==="/"){if(r===0)throw new M("division by zero");return s/r}throw new M(`unknown operator ${JSON.stringify(i)}`)}case"call":{const i=c.lazy&&c.lazy[t.name];if(typeof i=="function")return i(t.args,n,c);const s=o[t.name];if(typeof s!="function")throw new M(`there is no function called ${t.name}`);return s(t.args.map(n),c)}default:throw new M("the formula could not be read")}};return n(b)}}),De("packages/core/src/formula/index.js",function(e,U){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return S}});const te=U("packages/core/src/formula/parse.js"),M=te.parseFormula,X=te.referencesOf,B=te.looksLikeFormula,D=te.FormulaError,Z=te.tokenise,K=U("packages/core/src/formula/evaluate.js"),I=K.evaluateAst,G=K.FUNCTIONS;function H(O){const{grid:b,row:c,data:f}=O||{},o=r=>String(r).toLowerCase().replace(/[\s_-]/g,""),n=b&&b.columns&&typeof b.columns.all=="function"?b.columns.all():[],t=b&&b.permissions,i=t&&typeof t.isReadable=="function"?r=>t.isReadable(r):()=>!0,s=new Set;for(const r of n)i(r)||(s.add(o(r.id)),r.field&&s.add(o(r.field)),r.title&&s.add(o(r.title)));return r=>{const u=o(r);if(s.has(u))throw new D(`"${r}" cannot be read`);for(const a of n)if(o(a.id)===u||a.field&&o(a.field)===u||a.title&&o(a.title)===u)return c&&b.rows&&typeof b.rows.value=="function"?b.rows.value(c.key,a.id):f?f[a.field||a.id]:void 0;if(f&&typeof f=="object"){for(const a of Object.keys(f))if(o(a)===u){if(!i(a))throw new D(`"${r}" cannot be read`);return f[a]}}}}function S(O,b={}){try{const c=M(O);return{ok:!0,value:I(c,{lookup:H(b),functions:b.formulaFunctions}),references:X(c)}}catch(c){return{ok:!1,error:c instanceof D?c.message:"the formula could not be read",at:c instanceof D?c.at:void 0}}}}),De("packages/core/src/internal/version.js",function(e,U){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return X}});const te="1.103.0";async function M(){return te}const X="1.103.0"}),De("packages/core/src/internal/merge.js",function(e,U){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return K}});const M=U("packages/core/src/internal/predicates.js").isObject;function X(I,G,H){if(I!==void 0)return I===!0?{enabled:!0,...H}:I===!1?{enabled:!1}:M(I)?I:{[G]:I,enabled:!0}}function B(I){return I==null?[]:Array.isArray(I)?I:[I]}const D=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Z(I,G){if(!M(I))return M(G)?{...G}:G;if(!M(G))return G===void 0?I:G;const H={...I};for(const S of Object.keys(G)){if(D.has(S))continue;const O=G[S];O!==void 0&&(H[S]=M(O)&&M(H[S])?Z(H[S],O):O)}return H}function K(I,G){if(!M(I)||!M(G)||I===G)return G;const H=Object.create(Object.getPrototypeOf(I));return Object.assign(H,I,G),H}}),De("packages/core/src/internal/schedule.js",function(e,U){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return K}});function te(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const M=typeof requestAnimationFrame=="function";function X(I){return M?requestAnimationFrame(I):setTimeout(()=>I(te()),16)}function B(I){I!=null&&(M?cancelAnimationFrame(I):clearTimeout(I))}function D(I){let G=null,H=null;const S=()=>{G=null;const b=H;H=null,I(...b||[])},O=(...b)=>{H=b,G===null&&(G=X(S))};return O.cancel=()=>{B(G),G=null,H=null},O.flush=()=>{G!==null&&(B(G),S())},O}function Z(I,G){let H=null,S=null;const O=()=>{if(H=null,S===null)return;const f=S;S=null,I(...f),b()},b=()=>{H=setTimeout(O,G),typeof H?.unref=="function"&&H.unref()},c=(...f)=>{H===null?(I(...f),b()):(S=f,clearTimeout(H),b())};return c.flush=()=>{if(H!==null&&clearTimeout(H),H=null,S===null)return;const f=S;S=null,I(...f)},c.cancel=()=>{H!==null&&clearTimeout(H),H=null,S=null},c.pending=()=>H!==null||S!==null,c}function K(I,G=50){return typeof requestIdleCallback=="function"?requestIdleCallback(I,{timeout:G}):setTimeout(()=>I({timeRemaining:()=>0,didTimeout:!0}),1)}}),De("packages/core/src/internal/paths.js",function(e,U){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Z}});const te=new Map;function M(K){let I=te.get(K);if(I)return I;if(!K.includes("."))I=G=>G?.[K];else{const G=K.split("."),H=G.length;I=S=>{let O=S;for(let b=0;b<H;b++){if(O==null)return;O=O[G[b]]}return O}}return te.set(K,I),I}const X=new Map;function B(K){let I=X.get(K);if(I)return I;if(!K.includes("."))I=(G,H)=>{G!=null&&(G[K]=H)};else{const G=K.split("."),H=G.length-1;I=(S,O)=>{let b=S;for(let c=0;c<H;c++){if(b==null)return;const f=G[c];b[f]==null&&(b[f]={}),b=b[f]}b!=null&&(b[G[H]]=O)}}return X.set(K,I),I}function D(K,I){return M(I)(K)}function Z(K,I,G){B(I)(K,G)}}),De("packages/core/src/internal/compare.js",function(e,U){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return X}});const te=new Map;function M(B,D){const Z=`${B||""}|${D?JSON.stringify(D):""}`;let K=te.get(Z);return K||(K=new Intl.Collator(B||void 0,{numeric:!0,sensitivity:"variant",...D}),te.set(Z,K)),K}function X(B,D){if(B===D)return 0;if(B==null)return 1;if(D==null)return-1;if(typeof B=="number"&&typeof D=="number")return Number.isNaN(B)?Number.isNaN(D)?0:1:Number.isNaN(D)||B<D?-1:B>D?1:0;const Z=String(B),K=String(D);return Z<K?-1:Z>K?1:0}}),De("packages/core/src/defaults.js",function(e,U){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return S}});const M=U("packages/core/src/internal/predicates.js").isObject,B=U("packages/core/src/internal/merge.js").merge,Z=U("packages/core/src/internal/warn.js").warnOnce;let K=null;class I extends Error{}function G(O,b=new Set){if(Array.isArray(O)){if(b.has(O))throw new I;b.add(O);const f=O.map(o=>G(o,b));return b.delete(O),f}if(!M(O)||Object.getPrototypeOf(O)!==Object.prototype&&Object.getPrototypeOf(O)!==null)return O;if(b.has(O))throw new I;b.add(O);const c={};for(const[f,o]of Object.entries(O))c[f]=G(o,b);return b.delete(O),c}function H(O){if(O===void 0)return G(K??{});if(O===null)return K=null,{};if(!M(O))return Z("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(O)?"an array":typeof O}. The call was ignored and the defaults are unchanged.`),G(K??{});try{K=G(O)}catch(b){if(!(b instanceof I))throw b;return Z("defaults:cyclic","defaults() expects a configuration object with no circular references, but the object passed refers back to itself. The call was ignored and the defaults are unchanged."),G(K??{})}return G(K)}function S(O){return K===null?O:B(G(K),O)}}),De("packages/core/src/internal/uid.js",function(e,U){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return M}});let te=0;function M(X="l"){return`${X}${(++te).toString(36)}`}}),De("packages/core/src/events/names.js",function(e,U){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return X}});const te=Object.freeze(["ready","destroy","render:first","render:done","config:changed","licence:changed","model:changed","rows:changed","rows:queued","rows:deferred","rows:paused","rows:resumed","row:received","row:sent","row:copied","row:moved","source:error","source:total","stream:chunk","stream:end","stream:evicted","rowDrag:started","rowDrag:moved","rowDrag:left","rowDrag:ended","cell:changed","cell:pending","cell:confirmed","cell:reverted","cell:conflict","cell:clicked","cell:dblclicked","cell:contextmenu","cell:mouseover","cell:mouseout","cell:mousedown","cell:mouseup","cell:edit:start","cell:edit:end","row:edit:start","row:edit:end","row:clicked","row:dblclicked","row:pending","row:confirmed","row:reverted","row:conflict","form:opened","form:closed","form:saved","form:error","sort:changed","filter:changed","group:toggled","facet:computed","facet:filtered","facet:expanded","facet:failed","column:moved","column:resized","column:visible","column:pinned","column:grouped","column:pivoted","column:filter:open","column:profile:open","column:menu:open","columns:changed","columns:tagged","columngroup:changed","header:contextmenu","pivot:drill","selection:changed","range:changed","clipboard:copy","page:changed","scroll","scroll:end","size:changed","detail:toggled","detail:cell:edit:start","detail:cell:edit:end","detail:row:edit:start","detail:row:edit:end","detail:cell:changed","toolpanel:focus","highlight:changed","find:changed","tree:loading","tree:loaded","tree:loadFailed","tree:loadAborted","state:changed","state:reset","history:changed","history:applied","views:changed","view:applied","view:saved","view:removed","view:renamed","view:default","validation:failed","validation:cleared","formatting:changed","redaction:changed","permissions:changed","presentation:changed","presentation:started","presentation:ended","presentation:view","presentation:scale","presentation:spotlight","presentation:captured","comment:added","comment:edited","comment:deleted","comment:failed","comment:resolved","comment:unresolved","comment:threadOpened","comment:threadClosed","comment:indexLoaded","presence:published","presence:joined","presence:updated","presence:left","presence:failed","presence:lockRefused","diff:changed","diff:swapped","timeline:attached","timeline:detached","timeline:seek","timeline:seeking","annotation:changed","export:progress","export:request","export:done","shortcuts:opened","shortcuts:closed","print:before","print:after","beforeEdit","beforeSort","beforeFilter","beforeColumnMove","beforeColumnResize","beforeColumnHide","beforeSelect","beforeRowAdd","beforeDelete","beforeRowMove","beforeGroup","beforeRowReceive","edit:cancelled","sort:cancelled","filter:cancelled","columnMove:cancelled","columnResize:cancelled","columnHide:cancelled","selection:cancelled","rowAdd:cancelled","delete:cancelled","rowMove:cancelled","group:cancelled","rowReceive:cancelled"]),M=new Set(te);function X(B){return B==="*"||M.has(B)}}),De("packages/core/src/events/bus.js",function(e,U){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return f}});const te=U("packages/core/src/internal/warn.js"),M=te.warnOnce,X=te.DEV,D=U("packages/core/src/internal/uid.js").uid,K=U("packages/core/src/events/names.js").isKnownEvent,I="*";function G(o,n){!X||K(n)||M(`bus.unknown:${n}`,`${o}('${n}') subscribes to an event the grid never raises, so the handler will never fire. Check the name against the EventName list — a common cause is a near miss such as 'row:click' for 'row:clicked'.`)}const H=new Set(["api","user","init","ai"]),S=new WeakMap;function O(o){let n=S.get(o);return n||(n=D("h"),S.set(o,n)),n}function b(){return typeof performance=="object"&&performance?performance.now():Date.now()}function c(o){if(!o||typeof o!="object")return{};const n={};for(const[t,i]of Object.entries(o))t!=="grid"&&(i==null?n[t]=String(i):Array.isArray(i)?n[t]=`[${i.length}]`:typeof i=="object"?n[t]=i.key?`row ${i.key}`:"{…}":typeof i=="function"?n[t]="[function]":n[t]=String(i).slice(0,60));return n}class f{#e=new Map;#t=!1;#n=[];#r=200;#s=new Map;#i=null;#o=!1;#l=0;constructor(n=null){this.#i=n}attach(n){this.#i=n}get grid(){return this.#i}get destroyed(){return this.#o}on(n,t){if(typeof t!="function")return M(`bus.handler:${n}`,`on('${n}') needs a function; ignored.`),()=>{};G("on",n);let i=this.#e.get(n);return i||(i=[],this.#e.set(n,i)),i.push(t),()=>this.off(n,t)}once(n,t){if(typeof t!="function")return M(`bus.handler:${n}`,`once('${n}') needs a function; ignored.`),()=>{};G("once",n);const i=s=>{this.off(n,t),t(s)};return this.#s.set(t,i),this.on(n,i)}off(n,t){if(t===void 0){this.#e.delete(n);return}const i=this.#e.get(n);if(!i)return;const s=this.#s.get(t),r=s&&i.includes(s)?s:t,u=i.indexOf(r);u>=0&&i.splice(u,1),s&&r===s&&this.#s.delete(t),i.length===0&&this.#e.delete(n)}count(n){const t=this.#e.get(n),i=n===I?null:this.#e.get(I);return(t?t.length:0)+(i?i.length:0)}#a(n,t,i,s,r){this.#n.push({type:n,origin:t,listeners:(s?s.length:0)+(r?r.length:0),payload:c(i),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(n,t){this.#t=!!n,Number.isFinite(t)&&t>0&&(this.#r=Math.floor(t)),n||(this.#n=[])}eventLog(){return this.#n.map(n=>({...n}))}clearEventLog(){this.#n=[]}counts(){const n={};for(const[t,i]of this.#e)n[t]=i.length;return n}emit(n,t,i){const s=i??(t&&t.origin),r=H.has(s)?s:"api",u={...t||null,type:n,origin:r,grid:this.#i};if(this.#o)return u;const a=this.#e.get(n),l=n===I?void 0:this.#e.get(I);if(this.#t&&this.#a(n,r,t,a,l),!a&&!l)return u;const h=this.#t?b():0;this.#l++;try{a&&this.#c(a.slice(),u,n),l&&this.#c(l.slice(),u,I)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=b()-h)}return u}emitBefore(n,t,i){const s=i??(t&&t.origin),r=H.has(s)?s:"user";let u=!1,a=null;const l=p=>{u=!0,p!=null&&a===null&&(a=String(p))},h={...t||null,type:n,origin:r,grid:this.#i,get defaultPrevented(){return u},get reason(){return a},preventDefault(p){l(p)}};if(this.#o)return!0;const y=this.#e.get(n);this.#t&&this.#a(n,r,t,y,void 0);const m=y?y.slice():[];if(m.length===0)return!0;const v=()=>(u&&a===null&&(a="prevented"),u&&t&&typeof t=="object"&&(t.reason=a),!u),d=[];for(const p of m)try{const g=p(h);g&&typeof g.then=="function"?d.push(g):g===!1&&l("prevented")}catch(g){l("error"),M(`bus.beforeThrow:${n}:${O(p)}`,`a '${n}' before-handler threw; the action was cancelled.`,g)}return d.length===0?v():Promise.allSettled(d).then(p=>{for(const g of p)g.status==="rejected"?(l("error"),M(`bus.beforeReject:${n}`,`a '${n}' before-handler rejected; the action was cancelled.`,g.reason)):g.value===!1&&l("prevented");return v()})}#c(n,t,i){for(let s=0;s<n.length;s++)try{n[s](t)}catch(r){M(`bus.throw:${i}:${O(n[s])}`,`a '${i}' handler threw; other handlers were unaffected.`,r)}}clear(){this.#e.clear(),this.#s.clear()}destroy(){this.clear(),this.#o=!0,this.#i=null}}}),De("packages/core/src/registry/free-tier-notice.js",function(e,U){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return te}});const te="Free for non-commercial use: latticegrid.dev/free"}),De("packages/core/src/registry/licence.js",function(e,U){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return F}});const M=U("packages/core/src/internal/warn.js").warnOnce,X=U("packages/core/src/registry/free-tier-notice.js"),B=X.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return X.FREE_TIER_NOTICE}});const D="lattice-grid",Z=1,K="LG1",I=64,G="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",S=(()=>{const L=new Int16Array(128).fill(-1);for(let j=0;j<H.length;j++)L[H.charCodeAt(j)]=j;return L[43]=62,L[47]=63,L})();function O(L){if(typeof L!="string")return null;let j="";for(let z=0;z<L.length;z++){const Y=L.charCodeAt(z);if(Y!==61){if(Y>127||S[Y]<0)return null;j+=L[z]}}const R=j.length;if(R%4===1)return null;const $=new Uint8Array(Math.floor(R*3/4));let T=0,A=0,C=0;for(let z=0;z<R;z++)T=T<<6|S[j.charCodeAt(z)],A+=6,A>=8&&(A-=8,$[C++]=T>>A&255);return C===$.length?$:$.subarray(0,C)}function b(L){let j="",R=0;for(;R+2<L.length;R+=3){const T=L[R]<<16|L[R+1]<<8|L[R+2];j+=H[T>>18&63]+H[T>>12&63]+H[T>>6&63]+H[T&63]}const $=L.length-R;if($===1){const T=L[R]<<16;j+=H[T>>18&63]+H[T>>12&63]}else if($===2){const T=L[R]<<16|L[R+1]<<8;j+=H[T>>18&63]+H[T>>12&63]+H[T>>6&63]}return j}function c(L){const j=new Uint8Array(L.length);for(let R=0;R<L.length;R++)j[R]=L.charCodeAt(R)&127;return j}function f(L){if(typeof TextDecoder=="function")return new TextDecoder().decode(L);let j="";for(let R=0;R<L.length;R++)j+=String.fromCharCode(L[R]);return j}function o(L){const j={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof L=="string"?L:""};if(typeof L!="string"||L.length===0)return{...j,reason:"missing"};const R=L.trim(),$=R.split(".");if($.length!==3)return j;const[T,A,C]=$;if(T!==K)return{...j,reason:"prefix"};const z=O(A),Y=O(C);if(!z||!Y)return j;let q;try{q=JSON.parse(f(z))}catch{return j}return q===null||typeof q!="object"?j:{ok:!0,reason:null,product:typeof q.p=="string"?q.p:null,issuedTo:typeof q.t=="string"?q.t:null,expires:typeof q.e=="string"?q.e:null,terms:typeof q.terms=="string"?q.terms:null,features:Array.isArray(q.f)?q.f.slice():[],deployments:Array.isArray(q.d)?q.d.slice():[],version:typeof q.v=="number"?q.v:0,message:c(A),signature:Y,raw:R}}function n(L,j){if(!L)return!1;const R=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(L)?`${L}T23:59:59.999Z`:L);return Number.isNaN(R)?!0:j>R}function t(L){return L==="non-commercial"?"non-commercial":"commercial"}let i=null,s=null,r=null;function u(){const L=globalThis.crypto;return L&&L.subtle?L.subtle:null}async function a(L){if(i&&s===L)return i;const j=u();if(!j)return null;const R=O(L);if(!R)return null;try{const $=await j.importKey("raw",R,{name:"Ed25519"},!1,["verify"]);return i=$,s=L,$}catch{return null}}async function l(){return r!==null||(r=await a(G)!==null),r}async function h(L,j={}){const R=j.warn!==!1,$=j.product||D,T=j.publicKey||G,A=j.now??Date.now(),C=j.host??m(),z=y(C)?"":` ${B}`,Y=o(L);if(!Y.ok){const ne=Y.reason==="missing"?"missing":"malformed";return R&&M(`licence.${ne}`,ne==="missing"?`no licence key supplied. The grid renders in full and carries a trial watermark on any host other than localhost. Get a key at latticegrid.dev.${z}`:`licence key could not be read. The grid will render with a watermark.${z}`),{valid:!1,reason:ne,terms:"commercial"}}const q={product:Y.product||void 0,issuedTo:Y.issuedTo||void 0,expires:Y.expires||void 0,terms:t(Y.terms)};if(Y.product!==$)return R&&M("licence.product",`licence key is for '${Y.product}', not '${$}'. The grid will render with a watermark.`),{valid:!1,...q,reason:"product"};if(n(Y.expires,A))return R&&M("licence.expired",`licence expired on ${Y.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...q,reason:"expired"};const V=Y.deployments||[];if(V.length&&C&&!y(C)&&!v(C,V))return R&&M("licence.domain",`licence key is not valid for ${C}; it covers ${V.join(", ")}. The grid will render with a watermark.`),{valid:!1,...q,reason:"domain"};const J=await a(T);if(!J){const ne=!!Y.signature&&Y.signature.length===I;return R&&M("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),ne?{valid:!0,...q,reason:"unverified"}:{valid:!1,...q,reason:"signature"}}let ee=!1;try{ee=await u().verify({name:"Ed25519"},J,Y.signature,Y.message)}catch{ee=!1}return ee?{valid:!0,...q}:(R&&M("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...q,reason:"signature"})}function y(L){const j=String(L??m()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!j||j==="localhost"||j.endsWith(".localhost")||j==="::1"||j==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(j)}function m(){const L=globalThis.location;return L&&typeof L.hostname=="string"?L.hostname:null}function v(L,j){const R=d(L);return!R||!Array.isArray(j)?!1:j.some($=>{const T=d($);if(!T)return!1;if(T==="*")return!0;if(T.startsWith("*.")){const A=T.slice(2);return R===A||R.endsWith(`.${A}`)}return R===T})}function d(L){return String(L??"").trim().toLowerCase().replace(/\.$/,"")}class p{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#s;#i=new Set;constructor(j={}){this.#s=j}set(j){this.#e=typeof j=="string"?j.trim():"";const R=o(this.#e);return this.#t=R.ok?{valid:!n(R.expires,Date.now())&&R.product===(this.#s.product||D),product:R.product||void 0,issuedTo:R.issuedTo||void 0,expires:R.expires||void 0,terms:t(R.terms),reason:"pending"}:{valid:!1,reason:R.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const j=this.#e;return this.#n=h(j,this.#s).then(R=>{if(this.#e===j){this.#t=R;for(const $ of this.#i)$(R)}return R}),this.#n}onSettled(j){return this.#i.add(j),()=>this.#i.delete(j)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!y(this.#r)}setHost(j){this.#r=j}state(){return this.#t.valid?"licensed":y(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#i.clear()}}const g=Symbol.for("lattice-grid/licence/holder");function k(){const L=globalThis,j=L&&L[g];if(j&&typeof j.set=="function"&&typeof j.watermark=="function")return j;const R=new p;if(L)try{L[g]=R}catch{}return R}const w=k();function E(L){return w.set(L)}function N(){return w.info()}function x(){return w.watermark()}function _(){return w.state()}function F(){return w}}),De("packages/core/src/registry/registry.js",function(e,U){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return i}});const te=U("packages/core/src/internal/warn.js"),M=te.warnOnce,X=te.DEV,D=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/registry/licence.js"),K=Z.LicenceHolder,I=Z.sharedLicence,G=["renderer","editor","filter","dataType","totalFn","pipe","component"],H=["all","header","body","totals","panels"];class S{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#s;#i=null;#o=null;#l=new Set;#a=new Map;constructor(r={}){for(const u of G)this.#t.set(u,new Map);this.#s=r.holder||I(),this.#o=r.grid??null,this.#i=this.#s.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),r.licence&&this.setLicence(r.licence)}registerModules(r,u={}){u.licence&&this.setLicence(u.licence),u.grid!==void 0&&(this.#o=u.grid);const a=Array.isArray(r)?r:[r],l=[];for(const h of a){if(!h||typeof h!="object"||typeof h.name!="string"||!h.name){M("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(h.name)){X&&this.#u(this.#e.get(h.name),h);continue}if(!D(h.install)){M(`registry.module.install:${h.name}`,`module '${h.name}' has no install() and was ignored.`);continue}const y={registry:this,grid:this.#o};try{h.install(y)}catch(m){M(`registry.module.throw:${h.name}`,`module '${h.name}' threw during install; it was not registered.`,m);continue}this.#e.set(h.name,h);for(const m of O(h))this.#n.add(m);l.push(h.name),this.#f({reason:"module",name:h.name,capabilities:this.capabilities(),regions:f(h)})}return l}unregisterModule(r){const u=this.#e.get(r);if(!u)return!1;if(D(u.uninstall))try{u.uninstall({registry:this,grid:this.#o})}catch(a){M(`registry.module.uninstall:${r}`,`module '${r}' threw during uninstall.`,a)}return this.#e.delete(r),this.#c(),this.#f({reason:"unmodule",name:r,capabilities:this.capabilities(),regions:f(u)}),!0}modules(){return[...this.#e.values()]}has(r){return this.#e.has(r)}#c(){this.#n.clear();for(const r of this.#e.values())for(const u of O(r))this.#n.add(u)}#u(r,u){!r||r===u||b(r,u)||M(`registry.module.reconfigure:${u.name}`,`module '${u.name}' was re-registered with different options; the first registration is kept and this call was ignored. Unregister it first if you mean to replace it.`)}capabilities(){return[...this.#n].sort()}can(r){return this.#n.has(r)}onChange(r){return D(r)?(this.#r.add(r),this.#a.set(r,this.#o),()=>{this.#r.delete(r),this.#a.delete(r)}):()=>{}}#f(r){for(const u of[...this.#r])try{u(r)}catch(a){M("registry.onChange.throw","a registry change handler threw.",a)}}register(r,u,a){const l=this.#t.get(r);if(!l){M(`registry.kind:${r}`,`unknown registry kind '${r}'; expected one of ${G.join(", ")}.`);return}if(!u||typeof u!="string"){M(`registry.name:${r}`,`register('${r}', ...) needs a name.`);return}l.has(u)&&l.get(u)!==a&&M(`registry.replace:${r}:${u}`,`'${u}' was already registered as a ${r} and has been replaced.`),l.set(u,a),this.#f({reason:"register",name:u,kind:r,capabilities:this.capabilities(),regions:o(r)})}registerAll(r,u){if(u)for(const a of Object.keys(u))this.register(r,a,u[a])}get(r,u){const a=this.#t.get(r);return a?a.get(u):void 0}names(r){const u=this.#t.get(r);return u?[...u.keys()]:[]}#d(r,u){const a=this.#t.get(r).get(u);return a!==void 0?a:this.#t.get("component").get(u)}renderer(r){return this.#d("renderer",r)}editor(r){return this.#d("editor",r)}filter(r){return this.#d("filter",r)}dataType(r){return this.get("dataType",r)}totalFn(r){return this.get("totalFn",r)}pipe(r){return this.get("pipe",r)}setLicence(r){return this.#s.set(r)}licence(){return this.#s.info()}licenceVerified(){return this.#s.verify()}watermark(){return this.#s.watermark()}attach(r){r!=null&&(this.#l.add(r),this.#o=r)}detach(r){if(r!=null){this.#l.delete(r);for(const[u,a]of[...this.#a])a===r&&(this.#r.delete(u),this.#a.delete(u));if(this.#o===r){const u=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=u}this.#l.size===0&&this.#i&&(this.#i(),this.#i=null)}}destroy(r){if(r!=null){this.detach(r);return}for(const u of[...this.#e.keys()])this.unregisterModule(u);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#i&&this.#i(),this.#i=null,this.#o=null}}function O(s){const r=s.capabilities,u=Array.isArray(r)?r.filter(a=>typeof a=="string"):[];return[s.name,...u]}function b(s,r){return s.install!==r.install||s.uninstall!==r.uninstall||(s.version||"")!==(r.version||"")?!1:c(O(s),O(r))&&c(f(s),f(r))}function c(s,r){const u=new Set(s),a=new Set(r);if(u.size!==a.size)return!1;for(const l of u)if(!a.has(l))return!1;return!0}function f(s){const r=s.regions;return!Array.isArray(r)||r.length===0?["all"]:r.filter(u=>H.includes(u))}function o(s){switch(s){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const n=new S;function t(){return n}function i(s,r={}){return n.registerModules(s,r)}}),De("packages/core/src/internal/text.js",function(e,U){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return B}});function te(D){return D?(D.includes(".")?D.slice(D.lastIndexOf(".")+1):D).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(/^./,K=>K.toUpperCase()):""}const M={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function X(D){const Z=D==null?"":String(D);return/[&<>"']/.test(Z)?Z.replace(/[&<>"']/g,K=>M[K]):Z}function B(D){return String(D).replace(/\w\S*/g,Z=>Z[0].toUpperCase()+Z.slice(1).toLowerCase())}}),De("packages/core/src/format/mask.js",function(e,U){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Z}});const te=new Set(["0","#","?",",","."]),M="\0";function X(I){const G=[];let H="",S=!1;for(let O=0;O<I.length;O++){const b=I[O];if(b==="\\"){H+=b+(I[O+1]??""),O+=1;continue}if(b==='"'){S=!S,H+=b;continue}if(b===";"&&!S){G.push(H),H="";continue}H+=b}return G.push(H),G}function B(I){let G="",H="",S="",O=1,b=!1,c=!1;const f=l=>{c?H+=l:G+=l};for(let l=0;l<I.length;l++){const h=I[l];if(h==="\\"){f(I[l+1]??""),l+=1;continue}if(h==='"'){const y=I.indexOf('"',l+1);f(y===-1?I.slice(l+1):I.slice(l+1,y)),l=y===-1?I.length:y;continue}if(h==="%"){O*=100,f("%");continue}if(h==="@"){b=!0,f("\0");continue}if(te.has(h)){S+=h,c=!0;continue}f(h)}let o=-1;for(let l=S.length-1;l>=0;l--){const h=S[l];if(h==="0"||h==="#"||h==="?"){o=l;break}}let n=!1,t="";for(let l=0;l<S.length;l++){const h=S[l];if(h===","){l>o?O/=1e3:n=!0;continue}t+=h}const i=t.indexOf("."),s=i===-1?t:t.slice(0,i),r=i===-1?"":t.slice(i+1);let u=0;for(const l of s)l==="0"&&(u+=1);let a=0;for(const l of r)l==="0"&&(a+=1);return{prefix:G,suffix:H,minInt:u,minDec:a,maxDec:r.length,grouping:n,scale:O,hasNumber:o!==-1,isText:b}}function D(I,G){const H=new Intl.NumberFormat(G,{minimumIntegerDigits:Math.max(I.minInt,1),minimumFractionDigits:I.minDec,maximumFractionDigits:Math.max(I.maxDec,I.minDec),useGrouping:I.grouping}),{prefix:S,suffix:O,scale:b,hasNumber:c}=I;return f=>{if(!c)return S+O;const o=b===1?f:f*b;return S+H.format(o)+O}}function Z(I,G){const S=X(String(I)).map(B),O=S.map(t=>D(t,G)),b=0,c=S.length>1?1:-1,f=S.length>2?2:-1,o=S.length>3?3:-1,n=t=>{if(t==null||t==="")return"";if(typeof t!="number"||Number.isNaN(t)){const i=Number(t);if(Number.isNaN(i))return o===-1?String(t):(S[o].prefix+S[o].suffix).split("\0").join(String(t));t=i}return t===0&&f!==-1?O[f](0):t<0&&c!==-1?O[c](-t):O[b](t)};return n.spec={mask:I},{format:n,ooxml:K(String(I))}}function K(I){return I.trim()}}),De("packages/core/src/format/pattern.js",function(e,U){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return D}});const M=U("packages/core/src/format/mask.js").splitSections;function X(Z){let K="",I="",G="",H="",S=!1,O=!1,b=!1,c=!1;const f=n=>{b?I+=n:K+=n};for(let n=0;n<Z.length;n++){const t=Z[n];if(t==="\\"){f(Z[n+1]??""),n+=1;continue}if(t==='"'){const i=Z.indexOf('"',n+1);f(i===-1?Z.slice(n+1):Z.slice(n+1,i)),n=i===-1?Z.length:i;continue}if(t==="%"){O=!0;continue}if(t==="0"||t==="#"){b=!0,c?H+=t:G+=t;continue}if(t===","){c||(S=!0);continue}if(t==="."&&!c){c=!0;continue}f(t)}if(!b)return{hasDigit:!1,prefix:K,suffix:I,minDec:0,maxDec:0,grouping:!1,percent:O};let o=0;for(const n of H)n==="0"&&(o+=1);return{hasDigit:!0,prefix:K,suffix:I,minDec:o,maxDec:H.length,grouping:S,percent:O}}function B(Z,K){const I=K.trim(),G=Z.trim();return I.startsWith("(")&&I.endsWith(")")&&I.slice(1,-1).trim()===G?"parentheses":I.endsWith("-")?"suffix":"minus"}function D(Z){if(typeof Z!="string")return null;const K=M(Z);if(K.length===0)return null;const I=X(K[0]);if(!I.hasDigit)return null;const G={style:I.percent?"percent":"decimal",prefix:I.prefix,suffix:I.suffix,minDecimals:I.minDec,maxDecimals:Math.max(I.maxDec,I.minDec),thousandsSeparator:I.grouping?void 0:!1};if(K.length>1&&(G.negative=B(K[0],K[1])),K.length>2){const H=X(K[2]);H.hasDigit||(G.zeroDisplay=H.prefix+H.suffix)}return G}}),De("packages/core/src/format/number.js",function(e,U){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return K}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/internal/warn.js").warnOnce,Z=U("packages/core/src/format/pattern.js").parseNumberPattern;function K(I,G){const H=typeof I=="string"?{pattern:I}:I||{};let S=H;if(typeof H.pattern=="string"){const k=Z(H.pattern);if(k){const{pattern:w,...E}=H;S={...k,...E}}else B(`format:pattern:${H.pattern}`,`invalid number format pattern "${H.pattern}"; the value will use the default number format`)}const O=S.locale||G||void 0,b=S.style||"decimal",c=typeof S.scale=="number"?S.scale:1,f=S.nullDisplay??"",o=S.zeroDisplay,n=S.prefix||"",t=S.suffix||"",i=S.negative||"minus",s=S.signed===!0,r={style:b,notation:S.notation||"standard"};b==="currency"&&(r.currency=S.currency||"USD",S.currencyDisplay&&(r.currencyDisplay=S.currencyDisplay)),typeof S.decimals=="number"?(r.minimumFractionDigits=S.decimals,r.maximumFractionDigits=S.decimals):(typeof S.minDecimals=="number"&&(r.minimumFractionDigits=S.minDecimals),typeof S.maxDecimals=="number"&&(r.maximumFractionDigits=S.maxDecimals),r.minimumFractionDigits>(r.maximumFractionDigits??20)&&(r.maximumFractionDigits=r.minimumFractionDigits)),S.thousandsSeparator===!1&&(r.useGrouping=!1),r.notation==="compact"&&(r.compactDisplay=S.compactDisplay||"short");const u=new Intl.NumberFormat(O,r),a=typeof S.thousandsSeparator=="string"?S.thousandsSeparator:null,l=typeof S.decimalSeparator=="string"?S.decimalSeparator:null;let h=",",y=".";if(a||l)for(const k of u.formatToParts(12345.6))k.type==="group"?h=k.value:k.type==="decimal"&&(y=k.value);const m=k=>{let w=k;return a&&(w=w.split(h).join("")),l&&(w=w.split(y).join("")),a&&(w=w.split("").join(a)),l&&(w=w.split("").join(l)),w},v=!!(a||l),d=n!==""&&b==="currency",p=k=>{let w;if(d){const E=u.formatToParts(k);let N=!1;w="";for(const x of E)w+=x.value,!N&&x.type==="currency"&&(w+=n,N=!0);N||(w=n+w)}else w=n+u.format(k);return v&&(w=m(w)),w+t},g=k=>{if(M(k)||k==="")return f;const w=typeof k=="number"?k:Number(k);if(Number.isNaN(w))return f;const E=c===1?w:w*c;return E===0&&o!==void 0?o:E<0?i==="parentheses"?`(${p(-E)})`:i==="suffix"?`${p(-E)}-`:p(E):s&&E>0?`+${p(E)}`:p(E)};return g.negativeClass=S.negativeClass||null,g.spec=S,g}}),De("packages/core/src/format/date.js",function(e,U){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return t}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/internal/warn.js").warnOnce,D=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Z(i){const s=[];let r=0,u="";const a=()=>{u&&(s.push({token:null,text:u}),u="")};for(;r<i.length;){const l=i[r];if(l==="'"){if(i[r+1]==="'"){u+="'",r+=2;continue}const y=i.indexOf("'",r+1);if(y===-1){u+=i.slice(r+1),r=i.length;continue}u+=i.slice(r+1,y),r=y+1;continue}const h=D.find(y=>i.startsWith(y,r));if(h){a(),s.push({token:h,text:h}),r+=h.length;continue}/[A-Za-z]/.test(l)&&B(`date.pattern.token:${l}`,`the date pattern "${i}" contains '${l}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${D.join(" ")}.`),u+=l,r+=1}return a(),s}const K=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function I(i){if(M(i)||i==="")return null;if(i instanceof Date)return Number.isNaN(i.getTime())?null:i;if(typeof i=="number")return Number.isNaN(i)?null:new Date(i);if(typeof i=="string"){const s=K.exec(i.trim());if(s){const[,u,a,l,h="0",y="0",m="0"]=s;return new Date(+u,+a-1,+l,+h,+y,+m)}const r=new Date(i);return Number.isNaN(r.getTime())?null:r}return null}function G(i,s){return String(i).padStart(s,"0")}function H(i){if(!i)return u=>({year:u.getFullYear(),month:u.getMonth()+1,day:u.getDate(),hour:u.getHours(),minute:u.getMinutes(),second:u.getSeconds(),ms:u.getMilliseconds(),weekday:u.getDay()});const s=new Intl.DateTimeFormat("en-US",{timeZone:i,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),r={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return u=>{const a={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:u.getMilliseconds(),weekday:0};for(const l of s.formatToParts(u))switch(l.type){case"year":a.year=Number(l.value);break;case"month":a.month=Number(l.value);break;case"day":a.day=Number(l.value);break;case"hour":a.hour=Number(l.value)%24;break;case"minute":a.minute=Number(l.value);break;case"second":a.second=Number(l.value);break;case"weekday":a.weekday=r[l.value]??0;break;default:break}return a}}function S(i,s,r){const u=Z(i),a=H(r),l=new Set(u.filter(d=>d.token).map(d=>d.token)),h=l.has("MMM")?new Intl.DateTimeFormat(s,{month:"short",timeZone:r}):null,y=l.has("MMMM")?new Intl.DateTimeFormat(s,{month:"long",timeZone:r}):null,m=l.has("EEE")?new Intl.DateTimeFormat(s,{weekday:"short",timeZone:r}):null,v=l.has("EEEE")?new Intl.DateTimeFormat(s,{weekday:"long",timeZone:r}):null;return d=>{const p=a(d);let g="";for(const k of u){if(!k.token){g+=k.text;continue}switch(k.token){case"yyyy":g+=G(p.year,4);break;case"yy":g+=G(p.year%100,2);break;case"MMMM":g+=y.format(d);break;case"MMM":g+=h.format(d);break;case"MM":g+=G(p.month,2);break;case"M":g+=String(p.month);break;case"dd":g+=G(p.day,2);break;case"d":g+=String(p.day);break;case"EEEE":g+=v.format(d);break;case"EEE":g+=m.format(d);break;case"HH":g+=G(p.hour,2);break;case"H":g+=String(p.hour);break;case"hh":g+=G(p.hour%12===0?12:p.hour%12,2);break;case"h":g+=String(p.hour%12===0?12:p.hour%12);break;case"mm":g+=G(p.minute,2);break;case"m":g+=String(p.minute);break;case"ss":g+=G(p.second,2);break;case"s":g+=String(p.second);break;case"SSS":g+=G(p.ms,3);break;case"a":g+=p.hour<12?"AM":"PM";break;default:g+=k.text;break}}return g}}const O=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function b(i,s){const r=i||{},u=r.locale||s||void 0,a=r.nullDisplay??"",l=r.timeZone;let h;if(r.pattern)h=S(r.pattern,u,l);else if(r.dateStyle||r.timeStyle){const p={timeZone:l};r.dateStyle&&(p.dateStyle=r.dateStyle),r.timeStyle&&(p.timeStyle=r.timeStyle);const g=new Intl.DateTimeFormat(u,p);h=k=>g.format(k)}else{const p=new Intl.DateTimeFormat(u,{dateStyle:"medium",timeZone:l});h=g=>p.format(g)}const y=r.relative?new Intl.RelativeTimeFormat(u,{numeric:"auto"}):null,v=(typeof r.relative=="object"&&r.relative?r.relative.threshold??7:7)*24*36e5,d=(p,g)=>{const k=I(p);if(!k)return a;if(y){const w=g&&typeof g.now=="number"?g.now:Date.now(),E=k.getTime()-w;if(Math.abs(E)<v){for(const[N,x]of O)if(Math.abs(E)>=x||N==="second")return y.format(Math.round(E/x),N)}}return h(k)};return d.spec=r,d}function c(i){if(M(i)||i==="")return null;if(typeof i=="string"){const u=/^(\d{4}-\d{2}-\d{2})/.exec(i.trim());if(u)return u[1];const a=I(i);return a?c(a):null}const s=I(i);if(!s)return null;const r=u=>String(u).padStart(2,"0");return`${s.getFullYear()}-${r(s.getMonth()+1)}-${r(s.getDate())}`}function f(i,s){if(M(i)||i==="")return null;if(typeof i=="string"){const u=i.trim();if(o.test(u)){const h=I(u);return h?n(h,s):null}const a=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(u);if(a){const[,h,y,m,v]=a;return`${h}T${y}:${m}${v&&v!=="00"?`:${v}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(u))return`${u}T00:00`;const l=I(u);return l?f(l):null}const r=I(i);return r?n(r,s):null}const o=/(?:Z|[+-]\d{2}:?\d{2})$/i;function n(i,s){const r=h=>String(h).padStart(2,"0");if(s)try{const h=new Intl.DateTimeFormat("en-CA",{timeZone:s,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(i).reduce((v,d)=>(d.type!=="literal"&&(v[d.type]=d.value),v),{}),y=h.hour==="24"?"00":h.hour,m=Number(h.second);return`${h.year}-${h.month}-${h.day}T${y}:${h.minute}`+(m?`:${h.second}`:"")}catch{}const u=`${i.getFullYear()}-${r(i.getMonth()+1)}-${r(i.getDate())}`,a=i.getSeconds(),l=`${r(i.getHours())}:${r(i.getMinutes())}${a?`:${r(a)}`:""}`;return`${u}T${l}`}function t(i,s){const r=M(i)||i===""?null:String(i),u=M(s)||s===""?null:String(s);return r===null?u===null?0:1:u===null||r<u?-1:r>u?1:0}}),De("packages/core/src/format/boolean.js",function(e,U){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Z}});const M=U("packages/core/src/internal/predicates.js").isNil,X={true:"☑",false:"☐",null:""},B={true:"◉",false:"◯",null:""};function D(K){if(M(K)||K==="")return null;if(typeof K=="boolean")return K;if(typeof K=="number")return K!==0;const I=String(K).trim().toLowerCase();return I==="true"||I==="yes"||I==="y"||I==="1"?!0:I==="false"||I==="no"||I==="n"||I==="0"?!1:null}function Z(K,I){const G=K||{},H=G.display||"text",S=G.trueLabel??"Yes",O=G.falseLabel??"No",b=G.nullLabel??"";let c=S,f=O;const o=b;H==="checkbox"?(c=X.true,f=X.false):H==="switch"?(c=B.true,f=B.false):H==="icon"&&(c=G.trueIcon??S,f=G.falseIcon??O);const n=t=>{const i=D(t);return i===null?o:i?c:f};return n.display=H,n.labels={true:S,false:O,null:b},n.locale=I,n.spec=G,n}}),De("packages/core/src/format/text.js",function(e,U){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return D}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/internal/text.js").titleCase;function D(Z,K){const I=Z||{},G=I.locale||K||void 0,H=I.nullDisplay??"",S=I.emptyDisplay??"",O=I.transform||"none",b=typeof I.truncate=="number"?{chars:I.truncate}:I.truncate||null,c=b?b.chars:0,f=b?b.ellipsis??"…":"",o=t=>{switch(O){case"upper":return G?t.toLocaleUpperCase(G):t.toUpperCase();case"lower":return G?t.toLocaleLowerCase(G):t.toLowerCase();case"title":return B(t);default:return t}},n=t=>{if(M(t))return H;let i=typeof t=="string"?t:String(t);return i===""?S:(O!=="none"&&(i=o(i)),c>0&&i.length>c&&(i=i.slice(0,c)+f),i)};return n.spec=I,n}}),De("packages/core/src/format/shorthand.js",function(e,U){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return K}});const te=["currency","number","percent","date","boolean","text","relative"],M=/[#0?@;"\\]/,X=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function B(I){return typeof I!="string"||I===""||Z(I)?!1:M.test(I)}function D(I){return typeof I!="string"||I===""||Z(I)?!1:X.test(I)}function Z(I){const G=I.indexOf(":"),H=G===-1?I:I.slice(0,G);return te.includes(H)?H:null}function K(I){const G=Z(I);if(!G)return null;const H=I.indexOf(":"),S=H===-1?"":I.slice(H+1),O=S===""?[]:S.split(":");switch(G){case"currency":{const b={type:"number",style:"currency",currency:O[0]||"USD"};return O[1]!==void 0&&O[1]!==""&&(b.decimals=Number(O[1])),b}case"number":{const b={type:"number",style:"decimal"};return O[0]!==void 0&&O[0]!==""&&(b.decimals=Number(O[0])),b}case"percent":{const b={type:"number",style:"percent"};return O[0]!==void 0&&O[0]!==""&&(b.decimals=Number(O[0])),b}case"date":return{type:"date",pattern:S||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const b=S.split("/"),c={type:"boolean",display:"text"};return b[0]!==void 0&&b[0]!==""&&(c.trueLabel=b[0]),b[1]!==void 0&&b[1]!==""&&(c.falseLabel=b[1]),b[2]!==void 0&&(c.nullLabel=b[2]),c}case"text":{const b={type:"text"};return O[0]&&(b.transform=O[0]),O[1]!==void 0&&O[1]!==""&&(b.truncate=Number(O[1])),b}default:return null}}}),De("packages/core/src/format/index.js",function(e,U){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return w}});const te=U("packages/core/src/internal/predicates.js"),M=te.isFunction,X=te.isObject,D=U("packages/core/src/internal/warn.js").warnOnce,Z=U("packages/core/src/format/number.js"),K=Z.compileNumber,I=U("packages/core/src/format/date.js"),G=I.compileDate,H=I.scanPattern,S=U("packages/core/src/format/boolean.js"),O=S.compileBoolean,b=U("packages/core/src/format/text.js"),c=b.compileText,f=U("packages/core/src/format/mask.js"),o=f.compileMask,n=U("packages/core/src/format/shorthand.js"),t=n.parseShorthand,i=n.looksLikeMask,s=n.looksLikeDatePattern,u=U("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return Z.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return I.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return I.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return I.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return I.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return S.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return S.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return b.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return f.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return f.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return f.parseSection}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return n.parseShorthand}}),Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return n.looksLikeMask}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return n.looksLikeDatePattern}});const a=new Set(["decimal","currency","percent","unit"]),l=new Set(["type","locale"]),h={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale","pattern"]),date:new Set(["pattern","dateStyle","timeStyle","timeZone","relative","nullDisplay"]),boolean:new Set(["display","trueLabel","falseLabel","nullLabel","trueIcon","falseIcon"]),text:new Set(["transform","truncate","nullDisplay","emptyDisplay"])},y=new Set(["number","date","boolean","text"]);function m(_,F){const L=_.type;if(L===void 0||y.has(L)||!a.has(String(L)))return;const j=F?`"${F}"`:"with no id";D(`format:unknown-style-key:${F||""}:${L}`,`column ${j} has format: { type: "${L}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${L}" instead?`)}function v(_,F,L){const j=h[F],R=L?`"${L}"`:"with no id";for(const $ of _){if(l.has($)||j.has($))continue;const T=Object.keys(h).find(A=>A!==F&&h[A].has($));T?D(`format:inapplicable:${L||""}:${$}`,`column ${R} has format key "${$}", which applies to a ${T} column, not the ${F} column it was applied to; it is ignored.`):D(`format:unknown:${L||""}:${$}`,`column ${R} has an unrecognised format key "${$}" for its ${F} format; it is ignored.`)}}function d(_){if(_.type==="number"||_.type==="date"||_.type==="boolean"||_.type==="text")return!0;const F=a.has(String(_.style));return!!(_.pattern||_.dateStyle||_.timeStyle||_.relative||_.timeZone||_.trueLabel||_.falseLabel||_.display||_.trueIcon||_.falseIcon||_.transform||_.truncate||_.emptyDisplay||F||_.currency||_.decimals!==void 0||_.minDecimals!==void 0||_.maxDecimals!==void 0||_.notation||_.negative||_.scale!==void 0||_.prefix||_.suffix||_.zeroDisplay!==void 0)}function p(_,F){if(_.type==="number"||_.type==="date"||_.type==="boolean"||_.type==="text")return _.type;if(_.pattern){if(i(_.pattern))return"number";if(s(_.pattern))return"date"}if(_.dateStyle||_.timeStyle||_.relative||_.timeZone)return"date";if(_.trueLabel||_.falseLabel||_.display||_.trueIcon||_.falseIcon)return"boolean";if(_.transform||_.truncate||_.emptyDisplay)return"text";if(_.style||_.currency||_.decimals!==void 0||_.minDecimals!==void 0||_.maxDecimals!==void 0||_.notation||_.negative||_.scale!==void 0||_.prefix||_.suffix||_.zeroDisplay!==void 0)return"number";const L=F&&F.base;return L==="number"?"number":L==="date"||L==="dateString"?"date":L==="boolean"?"boolean":"text"}function g(_,F=null,L=void 0,j=void 0,R=void 0){if(_==null||_==="")return null;const $=X(_)?Object.keys(_):null;if(typeof _=="function"){const C=(z,Y)=>String(_({...Y||{},value:z,locale:L})??"");return C.ooxml=F&&F.excel||"General",C}if(typeof _=="string"){if(i(_)){const{format:z,ooxml:Y}=o(_,L);return z.ooxml=Y,z}const C=t(_)||(s(_)?{type:"date",pattern:_}:null);return C?g(C,F,L,j,R):(D(`format:${_}`,`unrecognised format string "${_}"; the value will be stringified`),null)}if(!X(_))return D("format:shape","format must be a spec object or a string; ignoring",_),null;if(F&&M(F.format)&&!d(_)||F&&M(F.format)&&Array.isArray(F.formatPatterns)&&_.type===void 0)return null;const T=p(_,F);T==="date"&&j&&_.timeZone===void 0&&(_={..._,timeZone:j}),m(_,R),v($||Object.keys(_),T,R);let A;switch(T){case"number":A=K(_,L);break;case"date":A=G(_,L);break;case"boolean":A=O(_,L);break;default:A=c(_,L);break}return A.ooxml=w(_,T,L,F),A.kind=T,A}const k={yyyy:"yyyy",yy:"yy",MMMM:"mmmm",MMM:"mmm",MM:"mm",M:"m",dd:"dd",d:"d",EEEE:"dddd",EEE:"ddd",HH:"hh",H:"h",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"000",a:"AM/PM"};function w(_,F,L=void 0,j=null){if(F==="date"){if(_.pattern){let C="";for(const z of H(_.pattern))C+=z.token?k[z.token]??z.text:z.text;return C}return j&&j.excel||"yyyy-mm-dd"}if(F==="boolean")return"General";if(F==="text")return"@";if(typeof _.pattern=="string"&&u(_.pattern))return String(_.pattern).trim();if(_.notation==="compact"||_.notation==="scientific")return"General";const R=typeof _.decimals=="number"?_.decimals:typeof _.minDecimals=="number"?_.minDecimals:_.style==="currency"?2:0;let T=`${_.thousandsSeparator===!1?"":"#,#"}#0${R>0?`.${"0".repeat(R)}`:""}`,A="";return _.style==="currency"&&(A+=E(x(_.currency||"USD",L))),_.prefix&&(A+=E(_.prefix)),T=A+T,_.style==="percent"&&(T=`${T}%`),_.suffix&&(T+=E(_.suffix)),_.negative==="parentheses"?`${T};(${T})`:_.negative==="suffix"?`${T};${T}-`:T}function E(_){return`"${String(_).split('"').join("")}"`}const N=new Map;function x(_,F){const L=`${_}|${F||""}`;let j=N.get(L);if(j!==void 0)return j;j=_;try{const $=new Intl.NumberFormat(F,{style:"currency",currency:_}).formatToParts(0).find(T=>T.type==="currency");$&&(j=$.value)}catch{}return N.set(L,j),j}}),De("packages/core/src/columns/types/temporal.js",function(e,U){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Ye}});const te=U("packages/core/src/internal/predicates.js"),M=te.isNil,X=te.isFunction,B=U("packages/core/src/format/date.js"),D=B.toDate,Z=B.compilePattern,K=B.compileDate,I=B.toIsoDateTime,G=B.compareIso,H=864e5,S=Object.freeze({}),O=1e3,b=60*O,c=60*b,f=24*c,o=7*f,n=new WeakMap;function t(Ae,Ve){const Pe=Ae&&Ae.locale||"",Oe=Ae&&Ae.column;if(!Oe)return Pe?{locale:Pe}:S;const He=n.get(Oe);if(He&&He.locale===Pe)return He.bag;const Ke=Oe.typeOptions||Oe[Ve]||(i(Oe.format)?Oe.format:null),Xe={...Ke||S,locale:Ke&&Ke.locale||Pe||void 0};return n.set(Oe,{locale:Pe,bag:Xe}),Xe}function i(Ae){return Ae!==null&&typeof Ae=="object"&&!Array.isArray(Ae)&&!(Ae instanceof Date)}function s(Ae,Ve){const Pe=Ae===null||Number.isNaN(Ae)?null:Ae,Oe=Ve===null||Number.isNaN(Ve)?null:Ve;return Pe===null?Oe===null?0:1:Oe===null||Pe<Oe?-1:Pe>Oe?1:0}const r=/^(\d{1,2})(?:\s*[:.h]\s*(\d{1,2})(?:\s*[:.]\s*(\d{1,2})(?:[.,](\d{1,3}))?)?)?\s*(a\.?m\.?|p\.?m\.?|a|p)?$/i,u=/^(\d{3,6})$/;function a(Ae,Ve,Pe,Oe){return!(Ae>=0&&Ae<=23)||!(Ve>=0&&Ve<=59)||!(Pe>=0&&Pe<=59)||!(Oe>=0&&Oe<=999)?null:Ae*c+Ve*b+Pe*O+Oe}function l(Ae){if(M(Ae))return null;const Ve=String(Ae).trim();if(Ve==="")return null;const Pe=u.exec(Ve);if(Pe){const wt=Pe[1];if(wt.length===5)return null;const pt=wt.length===3?1:2;return a(Number(wt.slice(0,pt)),Number(wt.slice(pt,pt+2)),Number(wt.slice(pt+2,pt+4)||0),0)}const Oe=r.exec(Ve);if(!Oe)return null;let He=Number(Oe[1]);const Ke=Number(Oe[2]||0),Xe=Number(Oe[3]||0),nt=Oe[4]?Number(Oe[4].padEnd(3,"0")):0,st=Oe[5]?Oe[5][0].toLowerCase():null;if(st){if(He<1||He>12)return null;He=He%12,st==="p"&&(He+=12)}return a(He,Ke,Xe,nt)}function h(Ae){return M(Ae)||Ae===""?null:typeof Ae=="number"?Number.isFinite(Ae)?(Ae%f+f)%f:null:Ae instanceof Date?Number.isNaN(Ae.getTime())?null:Ae.getHours()*c+Ae.getMinutes()*b+Ae.getSeconds()*O+Ae.getMilliseconds():l(Ae)}const y=new Map;function m(Ae){const Ve=Ae.pattern||"",Pe=Ae.timeStyle||(Ae.seconds?"medium":"short"),Oe=`${Ae.locale||""}|${Ve}|${Pe}`;let He=y.get(Oe);if(He)return He;if(Ve)He=Z(Ve,Ae.locale||void 0,"UTC");else{const Ke=new Intl.DateTimeFormat(Ae.locale||void 0,{timeStyle:Pe,timeZone:"UTC"});He=Xe=>Ke.format(Xe)}return y.set(Oe,He),He}function v(Ae,Ve){const Pe=Ve||S;if(Ae==null||typeof Ae!="number"||!Number.isFinite(Ae))return Pe.nullDisplay??"";const Oe=(Ae%f+f)%f;return m(Pe)(new Date(Oe))}function d(Ae){return Ae instanceof Date?!Number.isNaN(Ae.getTime()):typeof Ae=="number"?Number.isFinite(Ae)&&Ae>=0&&Ae<f:typeof Ae!="string"||!Ae.includes(":")?!1:l(Ae)!==null}function p(Ae){const Ve=h(Ae);return Ve==null?"":v(Ve,{pattern:Ve%O===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const g=new Map;function k(Ae){const Ve=Ae||"";let Pe=g.get(Ve);return Pe||(Pe=new Intl.DateTimeFormat("en-GB",{timeZone:Ae||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),g.set(Ve,Pe)),Pe}function w(Ae,Ve){const Pe={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Oe of k(Ve).formatToParts(new Date(Ae)))Oe.type==="year"?Pe.year=Number(Oe.value):Oe.type==="month"?Pe.month=Number(Oe.value):Oe.type==="day"?Pe.day=Number(Oe.value):Oe.type==="hour"?Pe.hour=Number(Oe.value)%24:Oe.type==="minute"?Pe.minute=Number(Oe.value):Oe.type==="second"&&(Pe.second=Number(Oe.value));return Pe}function E(Ae,Ve){const Pe=w(Ae,Ve);return Date.UTC(Pe.year,Pe.month-1,Pe.day,Pe.hour,Pe.minute,Pe.second,0)-Math.floor(Ae/1e3)*1e3}function N(Ae,Ve){const Pe=Ae.hour||0,Oe=Ae.minute||0,He=Ae.second||0,Ke=Ae.ms||0;if(!Ve)return new Date(Ae.year,Ae.month-1,Ae.day,Pe,Oe,He,Ke).getTime();const Xe=Date.UTC(Ae.year,Ae.month-1,Ae.day,Pe,Oe,He,Ke);let nt=Xe-E(Xe,Ve);return nt=Xe-E(nt,Ve),nt}const x=/(?:Z|[+-]\d{2}:?\d{2})$/i,_=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function F(Ae,Ve){if(M(Ae))return null;const Pe=String(Ae).trim();if(Pe==="")return null;const Oe=Ve&&Ve.timeZone||void 0;if(!x.test(Pe)){const He=_.exec(Pe);if(He){const Ke=(He[4]||"").trim(),Xe=Ke===""?0:l(Ke);if(Xe===null)return null;const nt=N({year:Number(He[1]),month:Number(He[2]),day:Number(He[3]),hour:Math.floor(Xe/c),minute:Math.floor(Xe/b)%60,second:Math.floor(Xe/O)%60,ms:Xe%O},Oe);return Number.isNaN(nt)?null:new Date(nt)}}return D(Pe)}function L(Ae){if(typeof Ae=="number")return Number.isFinite(Ae)?Ae:null;const Ve=D(Ae);return Ve?Ve.getTime():null}const j=new Map;function R(Ae){const Ve=[Ae.locale||"",Ae.pattern||"",Ae.dateStyle||"",Ae.timeStyle||"",Ae.timeZone||"",Ae.seconds?"1":""].join("|");let Pe=j.get(Ve);if(Pe)return Pe;const Oe=Ae.pattern?{type:"date",pattern:Ae.pattern,timeZone:Ae.timeZone}:{type:"date",dateStyle:Ae.dateStyle||"medium",timeStyle:Ae.timeStyle||(Ae.seconds?"medium":"short"),timeZone:Ae.timeZone};return Pe=K(Oe,Ae.locale||void 0),j.set(Ve,Pe),Pe}function $(Ae,Ve){const Pe=Ve||S,Oe=L(Ae);return Oe==null?Pe.nullDisplay??"":R(Pe)(Oe)}function T(Ae){return Ae instanceof Date?!Number.isNaN(Ae.getTime()):typeof Ae!="string"||!_.test(Ae.trim())?!1:F(Ae)!==null}const A=Object.freeze([{key:"w",ms:o,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:f,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:c,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:b,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:O,intl:"second",long:["second","seconds"],names:["s","sec","secs","second","seconds"]},{key:"ms",ms:1,intl:"millisecond",long:["millisecond","milliseconds"],names:["ms","msec","msecs","milli","millis","millisecond","milliseconds"]}]),C=new Map;for(const Ae of A)for(const Ve of Ae.names)C.set(Ve,Ae);const z=Object.freeze(A.filter(Ae=>Ae.key!=="w")),Y=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,q=/^\d+(?:\.\d+)?$/,V=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function J(Ae){const Ve=Ae&&Ae.defaultUnit?C.get(String(Ae.defaultUnit).toLowerCase()):null;return Ve?Ve.ms:b}function ee(Ae){return(Ae&&Ae.defaultUnit?C.get(String(Ae.defaultUnit).toLowerCase()):null)||C.get("m")}function ne(Ae,Ve){if(M(Ae))return null;let Pe=String(Ae).trim().toLowerCase();if(Pe==="")return null;let Oe=1;if(Pe[0]==="-"?(Oe=-1,Pe=Pe.slice(1).trim()):Pe[0]==="+"&&(Pe=Pe.slice(1).trim()),Pe==="")return null;const He=V.exec(Pe);if(He){const st=He[3]!==void 0,wt=Number(He[1])*c+Number(He[2])*b+(st?Number(He[3])*O:0)+(He[4]?Number(He[4].padEnd(3,"0")):0);return Oe*wt}if(q.test(Pe))return Math.round(Oe*Number(Pe)*J(Ve||S));let Ke=Pe,Xe=0,nt=0;for(;Ke!=="";){const st=Y.exec(Ke);if(!st)return null;const wt=C.get(st[2]);if(!wt)return null;Xe+=Number(st[1])*wt.ms,Ke=Ke.slice(st[0].length),nt++}return nt===0?null:Math.round(Oe*Xe)}function oe(Ae){return M(Ae)||Ae===""?null:typeof Ae=="number"?Number.isFinite(Ae)?Ae:null:ne(Ae)}const re=new Map;function ae(Ae,Ve,Pe){const Oe=`${Pe||""}|${Ve.intl}`;let He=re.get(Oe);if(He===void 0){try{He=new Intl.NumberFormat(Pe||void 0,{style:"unit",unit:Ve.intl,unitDisplay:"long"})}catch{He=null}re.set(Oe,He)}return He?He.format(Ae):`${Ae} ${Ae===1?Ve.long[0]:Ve.long[1]}`}function fe(Ae,Ve){return String(Ae).padStart(Ve,"0")}function de(Ae,Ve){const Pe=Ve||S;if(Ae==null||typeof Ae!="number"||!Number.isFinite(Ae))return Pe.nullDisplay??"";const Oe=Pe.style||"short",He=Ae<0;let Ke=Math.round(Math.abs(Ae));const Xe=He?"-":"";if(Ke===0&&Pe.zeroDisplay!=null)return Pe.zeroDisplay;if(Oe==="clock"){const pt=Math.floor(Ke/c),St=Math.floor(Ke/b)%60,Ct=Math.floor(Ke/O)%60;return`${Xe}${fe(pt,2)}:${fe(St,2)}:${fe(Ct,2)}`}if(Ke===0){const pt=ee(Pe);return Oe==="long"?ae(0,pt,Pe.locale):`0${pt.key}`}const nt=Pe.weeks===!0?A:z,st=typeof Pe.maxUnits=="number"&&Pe.maxUnits>0?Pe.maxUnits:Pe.maxUnits===void 0?2:1/0,wt=[];for(const pt of nt){if(wt.length>=st)break;const St=Math.floor(Ke/pt.ms);St!==0&&(Ke-=St*pt.ms,wt.push(Oe==="long"?ae(St,pt,Pe.locale):`${St}${pt.key}`))}return Xe+wt.join(" ")}function ve(Ae){if(typeof Ae!="string")return!1;const Ve=Ae.trim();return Ve===""||V.test(Ve)||!/[a-z]/i.test(Ve)?!1:ne(Ve)!==null}const Ie=Date.UTC(1899,11,30),Le=new Map;function se(Ae,Ve){const Pe=Ae||"";let Oe=Le.get(Pe);Oe||(Oe=new Intl.DateTimeFormat("en-GB",{timeZone:Ae||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),Le.set(Pe,Oe));const He=typeof Ve=="number"?Ve:Date.now();for(const Ke of Oe.formatToParts(new Date(He)))if(Ke.type==="timeZoneName")return Ke.value;return""}function pe(Ae){if(Ae)return Ae;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function be(Ae,Ve){const Pe=pe(Ae),Oe=se(Ae,Ve);return Oe?`${Pe} (${Oe})`:Pe}function ke(Ae,Ve){if(Ae&&Ae.timeZone)return Ae.timeZone;const Pe=Ve&&Ve.grid;return(Pe&&X(Pe.get)?Pe.get("timeZone"):void 0)||void 0}function je(Ae,Ve){const Pe=Ve||S,Oe=L(Ae);if(Oe==null)return Pe.nullDisplay??"";const He=R(Pe)(Oe);if(!Pe.showOrigin)return He;const Ke=Pe.originZone;return Ke?Ke===(Pe.timeZone||pe(Pe.timeZone))?He:`${He} (${be(Ke,Oe)})`:`${He} (no origin recorded)`}function xe(Ae,Ve,Pe,Oe){if(Ve==="instant"||!Ve)return Ae;const He=w(Ae,Pe);if(Ve==="month")return N({year:He.year,month:He.month,day:1},Pe);if(Ve==="week"){const Ke=Oe>=1&&Oe<=7?Oe:1,nt=((new Date(Date.UTC(He.year,He.month-1,He.day)).getUTCDay()+6)%7+1-Ke+7)%7,st=new Date(Date.UTC(He.year,He.month-1,He.day-nt));return N({year:st.getUTCFullYear(),month:st.getUTCMonth()+1,day:st.getUTCDate()},Pe)}return N({year:He.year,month:He.month,day:He.day},Pe)}function ge(Ae,Ve){const Pe=Ae&&Ae.group,Oe=Pe&&Pe.granularity||"day";if(Oe==="instant")return null;const He=Pe&&Pe.weekStart;return Ke=>typeof Ke=="number"?xe(Ke,Oe,Ve,He):Ke}const we={time:{base:"number",storage:"float64",matches:d,format:Ae=>v(h(Ae.value),t(Ae,"time")),parse:Ae=>l(Ae.text),compare:(Ae,Ve)=>s(h(Ae),h(Ve)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:Ae=>{const Ve=h(Ae);return Ve===null?null:Ve/H},toStorage:Ae=>h(Ae),toClipboard:p,fromClipboard:l},datetime:{base:"dateString",storage:"dictionary",matches:T,format:Ae=>$(Ae.value,t(Ae,"datetime")),parse:Ae=>I(F(Ae.text,t(Ae,"datetime"))??Ae.text),compare:G,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(Ae,Ve)=>I(Ae,Ve&&Ve.timeZone),toClipboard:Ae=>M(Ae)?"":String(Ae),fromClipboard:Ae=>I(Ae)},duration:{base:"number",storage:"float64",matches:ve,format:Ae=>de(oe(Ae.value),t(Ae,"duration")),parse:Ae=>ne(Ae.text,t(Ae,"duration")),compare:(Ae,Ve)=>s(oe(Ae),oe(Ve)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:Ae=>{const Ve=oe(Ae);return Ve===null?null:Ve/H},toStorage:Ae=>oe(Ae),toClipboard:Ae=>de(oe(Ae),{style:"short",maxUnits:-1}),fromClipboard:Ae=>ne(Ae)},timestamp:{base:"number",storage:"float64",format:Ae=>{const Ve=t(Ae,"timestamp");return je(Ae.value,{...Ve,timeZone:ke(Ve,Ae)})},parse:Ae=>{const Ve=t(Ae,"timestamp"),Pe=F(Ae.text,{timeZone:ke(Ve,Ae)});return Pe?Pe.getTime():null},compare:(Ae,Ve)=>s(L(Ae),L(Ve)),groupProjector:(Ae,Ve)=>ge(Ae,Ve),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(Ae,Ve)=>{const Pe=L(Ae);if(Pe==null)return null;const Oe=w(Pe,Ve&&Ve.timeZone||void 0);return(Date.UTC(Oe.year,Oe.month-1,Oe.day,Oe.hour,Oe.minute,Oe.second)-Ie)/H},toStorage:Ae=>L(Ae),toClipboard:Ae=>{const Ve=L(Ae);return Ve==null?"":new Date(Ve).toISOString()},fromClipboard:Ae=>L(Ae)}},Me=["datetime","time","duration"],Ye=we}),De("packages/core/src/internal/lru.js",function(e,U){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return te}});class te{#e;#t=new Map;#n;constructor(X=256,B=null){this.#e=X,this.#n=B}get size(){return this.#t.size}get max(){return this.#e}set max(X){this.#e=X,this.#r()}has(X){return this.#t.has(X)}get(X){const B=this.#t;if(!B.has(X))return;const D=B.get(X);return B.delete(X),B.set(X,D),D}peek(X){return this.#t.get(X)}set(X,B){const D=this.#t;return D.has(X)&&D.delete(X),D.set(X,B),this.#r(),B}delete(X){const B=this.#t.get(X);return this.#t.delete(X)&&this.#n&&this.#n(B,X),B}clear(){if(this.#n)for(const[X,B]of this.#t)this.#n(B,X);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const X=this.#t;for(;X.size>this.#e;){const B=X.keys().next().value,D=X.get(B);X.delete(B),this.#n&&this.#n(D,B)}}}}),De("packages/core/src/columns/types/network.js",function(e,U){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return L}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/internal/lru.js").Lru,D=4294967295,Z=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function K(j){if(M(j))return null;if(typeof j=="string")return I(j);const R=Number(j);return Number.isFinite(R)?R<0?R<-2147483648?null:R>>>0:R>D?null:Math.trunc(R)>>>0:null}function I(j){if(M(j))return null;const R=String(j).trim();if(R==="")return null;const $=Z.exec(R);if(!$)return null;let T=0;for(let A=1;A<=4;A++){const C=$[A];if(C.length>1&&C.charCodeAt(0)===48)return null;const z=Number(C);if(z>255)return null;T=T*256+z}return T}function G(j){const R=K(j);return R===null?"":`${R>>>24&255}.${R>>>16&255}.${R>>>8&255}.${R&255}`}function H(j){return typeof j=="string"&&I(j)!==null}function S(j,R){const $=K(j),T=K(R);return $===null?T===null?0:1:T===null||$<T?-1:$>T?1:0}const O=64,b=D*O+32,c=/^(?:0|[1-9]\d?)$/;function f(j,R){return j*O+R}function o(j){if(M(j))return null;if(typeof j=="string"){const T=n(j);return T===null?null:o(T)}if(typeof j=="object"){const T=K(j.address),A=Number(j.prefix);return T===null||!Number.isInteger(A)||A<0||A>32?null:{address:T,prefix:A}}const R=Number(j);if(!Number.isInteger(R)||R<0||R>b)return null;const $=R%O;return $>32?null:{address:(R-$)/O,prefix:$}}function n(j){if(M(j))return null;const R=String(j).trim();if(R==="")return null;const $=R.indexOf("/");if($<0)return null;const T=I(R.slice(0,$));if(T===null)return null;const A=R.slice($+1).trim();if(!c.test(A))return null;const C=Number(A);return C>32?null:f(T,C)}function t(j){const R=o(j);return R?`${G(R.address)}/${R.prefix}`:""}function i(j){return typeof j=="string"&&n(j)!==null}function s(j,R){const $=o(j),T=o(R);return $?T?$.address!==T.address?$.address<T.address?-1:1:$.prefix-T.prefix:-1:T?1:0}function r(j){return j===0?0:4294967295<<32-j>>>0}function u(j){const R=o(j);return R?(R.address&r(R.prefix))>>>0:null}function a(j){const R=o(j);return R?(R.address&r(R.prefix)|~r(R.prefix)>>>0)>>>0:null}function l(j){const R=o(j);return R?2**(32-R.prefix):null}function h(j){const R=o(j);return R?R.prefix===32?1:R.prefix===31?2:2**(32-R.prefix)-2:null}function y(j,R){const $=o(j);if(!$)return!1;const T=K(R);if(T===null)return!1;const A=r($.prefix);return(T&A)>>>0===($.address&A)>>>0}function m(j,R){const $=u(j),T=u(R);return $===null||T===null?!1:$<=a(R)&&T<=a(j)}const v=/^[0-9a-fA-F]{1,4}$/,d=new B(512);function p(j){if(M(j))return null;let R=String(j).trim();if(R==="")return null;const $=R.indexOf("%");if($>=0&&(R=R.slice(0,$)),R==="")return null;if(R.indexOf(".")>=0){const q=R.lastIndexOf(":");if(q<0)return null;const V=I(R.slice(q+1));if(V===null)return null;R=`${R.slice(0,q+1)}${(V>>>16&65535).toString(16)}:${(V&65535).toString(16)}`}const T=R.split("::");if(T.length>2)return null;const A=g(T[0]);if(A===null)return null;if(T.length===1)return A.length===8?A:null;const C=g(T[1]);if(C===null)return null;const z=8-A.length-C.length;if(z<1)return null;const Y=A.slice();for(let q=0;q<z;q++)Y.push(0);for(const q of C)Y.push(q);return Y}function g(j){if(j==="")return[];const R=[];for(const $ of j.split(":")){if(!v.test($))return null;R.push(parseInt($,16))}return R}function k(j){if(typeof j!="string")return p(j);if(d.has(j))return d.get(j);const R=p(j);return d.set(j,R),R}function w(j){if(j[0]===0&&j[1]===0&&j[2]===0&&j[3]===0&&j[4]===0&&j[5]===65535)return`::ffff:${G((j[6]<<16|j[7])>>>0)}`;let R=-1,$=0,T=-1,A=0;for(let Y=0;Y<8;Y++)j[Y]===0?(T<0?(T=Y,A=1):A++,A>$&&($=A,R=T)):(T=-1,A=0);if($<2)return j.map(Y=>Y.toString(16)).join(":");const C=j.slice(0,R).map(Y=>Y.toString(16)).join(":"),z=j.slice(R+$).map(Y=>Y.toString(16)).join(":");return`${C}::${z}`}function E(j){const R=p(j);return R===null?null:w(R)}function N(j){return E(j)??""}function x(j){return typeof j=="string"&&j.indexOf(":")>=0&&p(j)!==null}function _(j,R){const $=k(j),T=k(R);if(!$)return T?1:0;if(!T)return-1;for(let A=0;A<8;A++)if($[A]!==T[A])return $[A]<T[A]?-1:1;return 0}const F=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:H,parse:j=>I(j.text),compare:S,format:j=>G(j.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:j=>K(j),toClipboard:j=>G(j),fromClipboard:j=>I(j)},cidr:{base:"number",storage:"float64",matches:i,parse:j=>n(j.text),compare:s,format:j=>t(j.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:j=>{const R=o(j);return R===null?null:f(R.address,R.prefix)},toClipboard:j=>t(j),fromClipboard:j=>n(j)},ipv6:{base:"text",storage:"dictionary",matches:x,parse:j=>E(j.text),compare:_,format:j=>N(j.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:j=>E(j),toClipboard:j=>N(j),fromClipboard:j=>E(j)}}),L=F}),De("packages/core/src/i18n/catalogue.js",function(e,U){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return B}});const M=U("packages/core/src/registry/free-tier-notice.js").FREE_TIER_NOTICE,X=Object.freeze({"count.rows":{one:"{count} row",other:"{count} rows"},"count.comments":{one:"{count} comment",other:"{count} comments"},"comments.someUnresolved":"{comments}, {unresolved} unresolved","comments.allResolved":"{comments}, all resolved","count.unresolvedComments":{one:"{count} unresolved comment",other:"{count} unresolved comments"},"count.items":{one:"{count} item",other:"{count} items"},"count.keys":{one:"{count} key",other:"{count} keys"},"count.values":{one:"value",other:"values"},"count.waiting":{one:"{count} waiting",other:"{count} waiting"},"count.rowsAdded":{one:"{count} row added",other:"{count} rows added"},"count.rowsRemoved":{one:"{count} row removed",other:"{count} rows removed"},"value.empty":"empty","a11y.sort.cleared":"Sort cleared","a11y.sort.by":"Sorted by {columns}","a11y.sort.column":"{column} {direction}","a11y.sort.ascending":"ascending","a11y.sort.descending":"descending","a11y.filter.cleared":"Filter cleared, {rows}","a11y.filter.applied":"Filtered to {shown} of {total}","a11y.find.count":{one:"{current} of {count} match",other:"{current} of {count} matches"},"a11y.find.countLoaded":{one:"{current} of {count} match in loaded rows",other:"{current} of {count} matches in loaded rows"},"a11y.find.none":"No matches","a11y.find.noneLoaded":"No matches in loaded rows","a11y.selection.cleared":"Selection cleared","a11y.selection.count":{one:"{count} row selected",other:"{count} rows selected"},"tabs.tablist":"Tabs","a11y.tabs.selected":"{label} tab selected","a11y.scrollbar.horizontal":"Horizontal scrollbar","a11y.scrollbar.vertical":"Vertical scrollbar","designer.canvas":"Dashboard canvas","designer.chrome":"Designer tools","designer.page":"Page {n}","a11y.designer.edit":"Edit mode","a11y.designer.view":"View mode","layout.region":"Dashboard layout","layout.move":"Move {title}","layout.resize":"Resize {title}","layout.close":"Close {title}","a11y.layout.grabbed":"{title} grabbed, column {x} of {columns}, row {y}","a11y.layout.position":"{title}, column {x} of {columns}, row {y}","a11y.layout.dropped":"{title} dropped, column {x} of {columns}, row {y}","a11y.layout.cancelled":"{title} move cancelled","a11y.layout.resizeCancelled":"{title} resize cancelled","a11y.layout.reverted":"{title} returned to column {x}, row {y}","a11y.layout.resizeGrabbed":"{title} resize grabbed, {w} by {h} cells","a11y.layout.resizeStep":"{title}, {w} by {h} cells","a11y.layout.resized":"{title} resized to {w} by {h} cells","a11y.layout.closed":"{title} closed","layout.maximise":"Maximise {title}","layout.minimise":"Minimise {title}","layout.restore":"Restore {title}","a11y.layout.maximised":"{title} maximised, filling the dashboard; press Escape to restore it","a11y.layout.minimised":"{title} minimised","a11y.layout.restored":"{title} restored to column {x}, row {y}","a11y.group.cleared":"Grouping cleared","a11y.group.by":"Grouped by {columns}","a11y.group.expanded":"{label} expanded, {rows} shown","a11y.group.collapsed":"{label} collapsed, {rows} shown","a11y.page.position":"Page {page} of {pages}","a11y.updates.paused":"Updates paused","a11y.updates.resumed":"Updates resumed","a11y.edit.refusedOne":"Edit to {column} was refused and put back to {value}{reason}","a11y.edit.refusedMany":{one:"{count} edit was refused and put back{reason}",other:"{count} edits were refused and put back{reason}"},"a11y.edit.reason":", {reason}","a11y.history.undo":"Undid {label}","a11y.history.redo":"Redid {label}","a11y.history.undoLast":"Undid the last change","a11y.history.redoLast":"Redid the last change","a11y.column.cannotResize":"{column} cannot be resized","a11y.column.resized":"{column} is {width} pixels wide","a11y.column.atMinimum":"{column} is at its narrowest, {width} pixels","a11y.column.atMaximum":"{column} is at its widest, {width} pixels","a11y.column.cannotMove":"{column} cannot be moved","a11y.column.alreadyFirst":"{column} is already first in its group","a11y.column.alreadyLast":"{column} is already last in its group","a11y.column.cannotMoveThere":"{column} cannot be moved there","a11y.column.moved":"{column} moved to position {at} of {of}","a11y.group.formed":"{column} grouped with {other} in a new band","a11y.group.dissolved":"band {group} dissolved","a11y.group.renamed":"band renamed to {group}","a11y.group.moved":"band {group} moved to position {at} of {of}","a11y.column.addedToGroup":"{column} added to band {group}","a11y.column.removedFromGroup":"{column} removed from its band","a11y.column.notInGroup":"{column} is not in a band","a11y.column.cannotGroup":"{column} cannot be grouped","a11y.group.cannotMove":"band {group} cannot be moved there","columngroup.newGroup":"New group","columngroup.rename":"Rename band","columngroup.dissolve":"Dissolve band","columngroup.group":"Group with adjacent column","columngroup.untitled":"Untitled band","panel.bandCollapse":"Collapse band {band}","panel.bandExpand":"Expand band {band}","panel.bandVisible":"Show or hide every column in band {band}","panel.bandRenameFor":"Rename band {band}","panel.bandDissolveFor":"Dissolve band {band}","header.filter":"Filter {column}","header.menu":"Column menu for {column}","header.toggleGroup":"Toggle {group}","header.dragHint":"Drag {column} to reorder, or onto another column to group","header.dragRole":"draggable column header","header.group":"group","header.selectAllRows":"Select all rows","header.clearSelection":"Clear selection","cell.selectRow":"Select row","cell.detail.show":"Show detail","cell.detail.hide":"Hide detail","cell.detail.showInPane":"Show in the detail pane","cell.detail.showingInPane":"Showing in the detail pane","cell.group.expand":"Expand","cell.group.collapse":"Collapse","cell.delta.up":"up","cell.delta.down":"down","cell.delta.unchanged":"unchanged","cell.delta.moved":"{direction} {magnitude}","cell.delta.describedUnchanged":"{label}, unchanged","cell.delta.described":"{label}, {direction} by {magnitude}","cell.qr.of":"QR code for {text}","cell.qr.empty":"No QR code","cell.barcode.of":"Barcode for {text}","cell.barcode.empty":"No barcode","cell.barcode.invalid":"Invalid value for this barcode","cell.rating.of":"{rating} of {max}","cell.rating.empty":"Not rated","cell.stage.of":"Stage {current} of {total}: {label}","cell.stage.empty":"No stage","a11y.panel.cannotMove":"{column} cannot be moved","a11y.panel.alreadyFirst":"{column} is already first","a11y.panel.alreadyLast":"{column} is already last","a11y.panel.moved":"{column} moved to position {at} of {of}","a11y.panel.removedFrom":"{column} removed from {list}","a11y.panel.addedTo":"{column} added to {list}","a11y.panel.cannotAddTo":"{column} cannot be added to {list}","a11y.annotate.erased":"Annotation removed","a11y.annotate.noMarks":"No annotations to erase","a11y.annotate.focusedMark":"Mark {at} of {of} selected","a11y.annotate.confirmClear":"Clear all annotations? Choose Clear or Keep.","a11y.annotate.cleared":"All annotations cleared","a11y.range.written":{one:"{count} cell updated",other:"{count} cells updated"},"a11y.range.cleared":{one:"{count} cell cleared",other:"{count} cells cleared"},"paste.preview.title":"Review paste","paste.preview.summary":{one:"{changes} cell will change, {rejected} rejected.",other:"{changes} cells will change, {rejected} rejected."},"paste.preview.changesHeading":{one:"{count} change",other:"{count} changes"},"paste.preview.rejectedHeading":{one:"{count} rejected",other:"{count} rejected"},"paste.preview.colOld":"Current","paste.preview.colNew":"New","paste.preview.colCell":"Cell","paste.preview.colReason":"Reason","paste.preview.empty":"This paste would change nothing.","paste.preview.confirm":"Apply","paste.preview.cancel":"Cancel","paste.preview.reason.permission":"Not permitted","paste.preview.reason.readOnly":"Read-only","paste.preview.reason.validation":"Invalid value","paste.preview.reason.locked":"Being edited","paste.preview.reason.missing":"No such cell","a11y.paste.previewOpened":{one:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel.",other:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel."},"a11y.paste.cancelled":"Paste cancelled; nothing changed","status.total":"{rows}","status.counting":"Counting rows…","status.shownOfTotal":"{shown} of {total}","status.selected":"{count} selected","status.selectedAcrossSource":"{count} selected across the source","status.selectedAcrossSourceCounting":"All matching rows selected, counting…","status.count":"Count {count}","status.loading":"Loading {count}…","status.loadingOf":"Loading {loaded} of {total} ({percent}%)","status.stat.sum":"Sum","status.stat.min":"Min","status.stat.max":"Max","status.stat.avg":"Avg","status.paused":"Paused","status.pausedWaiting":"Paused · {waiting}","status.coalesced":"{count} coalesced","status.hiddenComments":"{comments} on hidden rows","pagination.label":"Pagination","pagination.first":"First page","pagination.previous":"Previous page","pagination.next":"Next page","pagination.last":"Last page","pagination.page":"Page","pagination.ofPages":"of {pages}","pagination.summary":"{from}–{to} of {total}","pagination.pageSize":"Rows per page","pagination.range":"{from}–{to}","pagination.counting":"{from}–{to}, counting…","pagination.jump":"Page number, press Enter to jump","pagination.jumpBounded":"Page number, 1 to {pages}, press Enter to jump","panel.columns":"Columns","panel.filters":"Filters","panel.views":"Views","panel.quickFilter":"Quick filter","find.label":"Find in grid","find.placeholder":"Find in grid","find.next":"Next match","find.previous":"Previous match","find.close":"Close find","find.matchCase":"Match case","find.wholeCell":"Whole cell","find.columnScope":"Search in","find.allColumns":"All columns","find.count":"{current} of {total}","find.countPartial":"{current} of {total} so far","find.none":"No matches","find.searching":"Searching…","find.loadedRows":"in loaded rows","panel.formatting":"Formatting","panel.statistics":"Statistics","stat.noData":"No data","stat.tone.good":"good","stat.tone.bad":"bad","stat.tone.flat":"flat","panel.regression":"Regression","panel.compare":"Compare","panel.insights":"Insights","insights.subset":"Filtered subset vs whole","insights.dataset":"This grid vs another dataset","insights.groups":"Group comparison","insights.noFilter":"Filter the grid to compare the subset against the whole.","insights.by":"Group by","insights.test":"Test","insights.effect":"Effect size","insights.interval":"Confidence interval","insights.pValue":"p-value","insights.smallSample":"small sample — interpret with care","insights.needGroups":"Choose two columns with groups to compare.","insights.empty":"No columns to analyse.","insights.anomalies":"Anomalies","insights.anomalyCount":"{count} flagged of {n}","insights.anomalyMethod":"Method","insights.anomalyThreshold":"Threshold","anomaly.chip":"{count} anomalies flagged","anomaly.chipActive":"Showing {count} anomalies — clear","compare.first":"First column","compare.second":"Second column","compare.needTwo":"Two numeric columns are needed to compare","compare.noPairs":"No rows have a value in both","compare.pairs":"{count} pairs","compare.pearson":"Correlation (Pearson)","compare.spearman":"Rank correlation (Spearman)","compare.kendall":"Kendall’s tau","compare.covariance":"Covariance","compare.slope":"Slope","compare.intercept":"Intercept","compare.r2":"R²","compare.stdError":"Standard error","compare.weighted":"Weighted average","panel.zone.group":"row groups","panel.zone.values":"values","panel.zone.pivot":"pivot columns","groupZone.label":"Row groups","groupZone.title":"Group by","groupZone.hint":"Drag a column here to group rows by its values","groupZone.chip":"{column}, group {at} of {of}","groupZone.remove":"Stop grouping by {column}","groupZone.add":"Add a group","total.sum":"Sum","total.avg":"Average","total.min":"Min","total.max":"Max","total.count":"Count","total.countValues":"Count of values","total.first":"First","total.last":"Last","total.custom":"Total","total.median":"Median","total.p25":"25th percentile","total.p75":"75th percentile","total.p90":"90th percentile","total.p95":"95th percentile","total.p99":"99th percentile","total.iqr":"Interquartile range","total.mad":"Median absolute deviation","total.variance":"Variance","total.varianceP":"Variance (population)","total.stddev":"Standard deviation","total.stddevP":"Standard deviation (population)","total.range":"Range","total.distinct":"Distinct","total.mode":"Mode","total.skewness":"Skewness","total.kurtosis":"Kurtosis","total.geomean":"Geometric mean","total.harmean":"Harmonic mean","total.sumSquares":"Sum of squares","total.weightedAvg":"Weighted average","total.argmin":"Lowest by","total.argmax":"Highest by","total.hhi":"Concentration (HHI)","total.entropy":"Entropy","total.evenness":"Evenness","total.top3Share":"Top 3 share","total.top10Share":"Top 10 share","total.gini":"Gini coefficient","total.trimmedMean":"Trimmed mean","total.winsorizedMean":"Winsorized mean","total.robustOutliers":"Outliers (robust)","total.jarqueBera":"Jarque–Bera","total.passRate":"Pass rate","total.failureCount":"Failures","stats.column":"Column","stats.choose":"Choose a column to profile","stats.noColumns":"No numeric columns to profile","stats.noValues":"Nothing numeric in this column","stats.count":"Count","stats.present":"Present","stats.missing":"Missing","stats.distinct":"Distinct","stats.min":"Minimum","stats.max":"Maximum","stats.mean":"Mean","stats.median":"Median","stats.q1":"Lower quartile","stats.q3":"Upper quartile","stats.iqr":"Interquartile range","stats.stddev":"Standard deviation","stats.outliers":"Outliers","stats.distribution":"Distribution","stats.distribution.detail":"Distribution: rows per range","stats.bin":"{count} between {from} and {to}","stats.topValues":"Top values","stats.section.shape":"Shape","stats.section.robust":"Robust","stats.section.concentration":"Concentration","stats.section.capability":"Capability","stats.cp":"Cp","stats.cpk":"Cpk","stats.pp":"Pp","stats.ppk":"Ppk","stats.outOfSpec":"Out of specification","stats.filtered":"Over the {count} filtered rows","stats.unavailable":"Not computed by the source: {stats}.","stats.unavailable.notPlain":"`{column}` is not a plain column the engine can name","stats.unavailable.where":"a `where` predicate is in force ({list}), which only the browser can run","stats.unavailable.filter":"the grid's filter did not fully push to the engine","stats.unavailable.quick":"the quick search did not push to the engine","stats.unavailable.client":'the source did not compute "{fn}" in the engine ({reason}); set the pushdown source\'s `{setting}`',"stats.unavailable.outliers":"the count of values outside Tukey's fences is not an engine aggregate","stats.unavailable.histogram":"the shape of the column is not an engine aggregate","stats.unavailable.topValues":"the source did not answer a grouped count in the engine","regression.noModel":"No model configured. Set predictors and a response on the panel.","regression.cannotFit":"The model cannot be fitted over the current rows.","regression.observations":"Fitted over {count} rows","regression.r2":"R²","regression.adjR2":"Adjusted R²","regression.coefficients":"Coefficients","regression.term":"Term","regression.estimate":"Estimate ± SE","regression.stdError":"Std error","regression.t":"t","regression.p":"p","regression.vif":"Variance inflation (VIF)","regression.heteroscedasticity":"Heteroscedasticity (Breusch–Pagan)","regression.heteroscedastic":"Heteroscedastic: BP {statistic}, p {p}","regression.homoscedastic":"No heteroscedasticity detected: BP {statistic}, p {p}","menu.sortAscending":"Sort ascending","menu.sortDescending":"Sort descending","menu.clearSort":"Clear sort","menu.groupBy":"Group by this column","menu.ungroup":"Stop grouping by this column","menu.hideColumn":"Hide column","menu.pinStart":"Pin to start","menu.pinEnd":"Pin to end","menu.unpin":"Unpin","menu.autosize":"Fit to content","ai.valuesNotAmongOptions":'{values} {shown} not among the options for "{column}"',"menu.clearCells":{one:"Clear cell",other:"Clear {count} cells"},"menu.fillDown":"Fill down","menu.copy":"Copy","menu.copyWithHeaders":"Copy with headers","menu.paste":"Paste","menu.filterEllipsis":"Filter…","menu.columnStatistics":"Column statistics","menu.pinColumn":"Pin column","menu.sizeToFit":"Size to fit content","menu.sizeAllToFit":"Size all columns to fit","menu.width":"Width","menu.narrower":"Narrower","menu.wider":"Wider","menu.moveColumn":"Move column","menu.moveLeft":"Move left","menu.moveRight":"Move right","menu.moveToStart":"Move to start","menu.moveToEnd":"Move to end","menu.unpivot":"Remove from pivot","menu.pivotBy":"Pivot by this column","menu.stopTotalling":"Stop totalling","menu.totalColumn":"Total this column","menu.aggregate":"Aggregate","menu.aggregateNone":"None","menu.aggregateGroup":"Group subtotals","menu.aggregateGrand":"Grand total","menu.aggregateSame":"Same as total","menu.redactColumn":"Redact column","menu.stopRedacting":"Stop redacting","menu.stopRedactingAll":"Stop redacting everything","menu.sortGroupsAscending":"Sort groups ascending","menu.sortGroupsDescending":"Sort groups descending","menu.filterGroups":"Filter groups…","menu.expandAll":"Expand all","menu.collapseAll":"Collapse all","menu.clearGrouping":"Clear grouping","menu.colour":"Colour","menu.importCsv":"Import rows from CSV…","import.title":"Import rows","import.clipboard":"the clipboard","import.summary":{one:"{count} row from {name}",other:"{count} rows from {name}"},"import.opened":{one:"Import preview open, {count} row",other:"Import preview open, {count} rows"},"import.done":{one:"{count} row imported",other:"{count} rows imported"},"import.confirm":"Import","import.cancel":"Cancel","import.colSource":"Column","import.colField":"Maps to","import.colType":"Type","import.skip":"— skip —","import.mapLabel":'Map "{source}" to a field',"import.modeLabel":"On import","import.sheetLabel":"Sheet","import.append":"Add to existing rows","import.replace":"Replace all rows","menu.deleteRow":{one:"Delete row",other:"Delete {count} rows"},"toolbar.undo":"Undo","toolbar.redo":"Redo","toolbar.undoLabelled":"Undo {label}","toolbar.redoLabelled":"Redo {label}","toolbar.exportCsv":"Export to CSV","toolbar.exportExcel":"Export to Excel","toolbar.clipboard":"Copy visible rows to the clipboard","toolbar.print":"Print","toolbar.pause":"Hold incoming updates","toolbar.resume":"Resume updates","toolbar.applyHeld":{one:"Apply {count} held update",other:"Apply {count} held updates"},"toolbar.restoreView":"Restore the default view","toolbar.maximiseGrid":"Maximise the grid to fill the window","toolbar.restoreSize":"Restore the grid to the page (Esc)","toolbar.annotate.pen":"Draw freehand","toolbar.annotate.arrow":"Draw an arrow","toolbar.annotate.rect":"Draw a rectangle","toolbar.annotate.highlight":"Highlight","toolbar.annotate.erase":"Erase","toolbar.annotate.clearAll":"Clear all annotations","toolbar.annotate.clearAllConfirm":"Clear","toolbar.annotate.clearAllKeep":"Keep","overlay.noRows":"No rows to show","overlay.noResults":"No rows match the current filters","overlay.loading":"Loading…","overlay.error":"Something went wrong","overlay.loadingRows":"Loading rows {from} to {to}","overlay.rowError":"Failed to load","comments.panel":"Cell comments","comments.close":"Close comments","comments.write":"Write a comment","comments.post":"Comment","comments.delete":"Delete","comments.valueMoved":"Written when the value was {was}: it is now {now}.","comments.resolve":"Resolve","comments.reopen":"Reopen","comments.loading":"Loading…","comments.empty":"No comments yet.","comments.unknownAuthor":"Unknown","comments.edited":"{time} (edited)","comments.cellTitle":"{column}: {row}","presence.hidden":{one:"{count} not in view",other:"{count} not in view"},"presence.someoneElse":"someone else","a11y.presence.refused":"This cell is being edited by {name}","presence.peer":"{name}: jump to their cursor","presence.peerIdle":"{name}, idle: jump to their cursor","presence.peerHidden":"{name}, not in the current view","facets.filter":"{column} distribution filter","header.totalOf":"{total} of {column}","diff.before":"Was: {value}","diff.empty":"(empty)","kanban.columnCards":{one:"{title}, {count} card",other:"{title}, {count} cards"},"kanban.laneCards":{one:"{lane}, {title}, {count} card",other:"{lane}, {title}, {count} cards"},"kanban.blocked":"Blocked","kanban.ready":"Ready","kanban.blockedBy":{one:"blocked by {count} card",other:"blocked by {count} cards"},"kanban.card.assignedTo":"Assigned to {names}","kanban.card.overdue":"Overdue","kanban.card.dueSoon":"Due soon","kanban.card.progress":"{percent}% complete","kanban.card.checklist":"{done} of {total} done","gantt.lag":"+{days}d","gantt.lead":"{days}d","gantt.a11y.moved":"{name} moved to {date}","gantt.a11y.day":"day {day}","gantt.a11y.resized":"{name} resized to {days} days","gantt.a11y.linkFrom":"Linking from {name}. Focus the successor and press L.","gantt.a11y.linked":"Linked {from} to {to}, finish to start.","gantt.a11y.linkCancelled":"Link cancelled.","gantt.a11y.deleted":"{name} deleted.","gantt.a11y.readOnly":"Read-only.","gantt.row.moveHandle":"Drag to reorder or re-parent {name}","gantt.a11y.rowMoved":"{name} moved.","gantt.a11y.rowReparented":"{name} moved under {parent}.","gantt.a11y.rowPromoted":"{name} moved to the top level.","gantt.a11y.rowMoveCancelled":"Move cancelled.","gantt.a11y.copied":"{count} tasks copied.","gantt.a11y.cut":"{count} tasks cut.","gantt.a11y.pasted":"{count} tasks pasted.","gantt.task.newName":"New task","gantt.a11y.taskAdded":"{name} added.","gantt.menu.addAbove":"Add task above","gantt.menu.addBelow":"Add task below","gantt.menu.addChild":"Add subtask","gantt.menu.addSuccessor":"Add successor","gantt.menu.addPredecessor":"Add predecessor","gantt.menu.toMilestone":"Convert to milestone","gantt.menu.toTask":"Convert to task","gantt.menu.delete":"Delete task","gantt.a11y.linkCycle":"Linking {from} to {to} would create a cycle; link not created.","gantt.a11y.linkCreated":"{from} linked to {to}, {type}.","gantt.a11y.linkDeleted":"Link from {from} to {to} deleted.","gantt.a11y.linkLabel":"Link, {from} to {to}, {type}","gantt.linkEditor.title":"Edit link from {from} to {to}","gantt.linkEditor.type":"Link type","gantt.linkEditor.lag":"Lag, in days","gantt.linkEditor.apply":"Apply","gantt.linkEditor.delete":"Delete link","gantt.linkEditor.cancel":"Cancel","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.ungrouped":"No group","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.workload.expandGroup":"Show the {name} group","gantt.workload.collapseGroup":"Hide the {name} group","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.workload.otherProjectLabel":"{name} (other project)","gantt.workload.external":"External booking","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.unscheduled":"Unscheduled","gantt.col.unscheduled":"Unscheduled","gantt.inactive":"Inactive","gantt.col.inactive":"Inactive","gantt.col.slack":"Slack","gantt.col.deadline":"Deadline","gantt.col.constraint":"Constraint","gantt.col.constraintDate":"Constraint date","gantt.col.earlyStart":"Early start","gantt.col.lateStart":"Late start","gantt.col.lateFinish":"Late finish","gantt.col.baselineStart":"Baseline start","gantt.col.baselineEnd":"Baseline finish","gantt.col.variance":"Variance","gantt.col.note":"Note","gantt.col.sequence":"#","gantt.col.predecessors":"Predecessors","gantt.col.successors":"Successors","gantt.link.invalid":"Cannot read “{token}” as a link. Write a task number, a type and a lag, like 3FS+2; links not changed.","gantt.link.unknownRef":"No task is numbered “{token}”; links not changed.","gantt.link.self":"“{token}” links a task to itself; links not changed.","gantt.link.duplicate":"“{token}” repeats a link already listed; links not changed.","gantt.link.cycle":"“{token}” would create a cycle; links not changed.","gantt.constraint.ASAP":"As soon as possible","gantt.constraint.MSO":"Must start on","gantt.constraint.MFO":"Must finish on","gantt.constraint.ALAP":"As late as possible","gantt.constraint.SNET":"Start no earlier than","gantt.constraint.SNLT":"Start no later than","gantt.constraint.FNET":"Finish no earlier than","gantt.constraint.FNLT":"Finish no later than","gantt.row.ancestor":"Shown because a task inside it matches the filter","gantt.progress.handle":"Drag to set the progress of {name}","gantt.a11y.progress":"{name} {percent}% complete","gantt.col.name":"Task name","gantt.col.start":"Start","gantt.col.end":"Finish","gantt.col.duration":"Duration","gantt.col.assignee":"Assignee","gantt.col.progress":"%","gantt.col.wbs":"WBS","gantt.zoom.label":"Zoom","gantt.zoom.day":"Day","gantt.zoom.week":"Week","gantt.zoom.month":"Month","gantt.zoom.quarter":"Quarter","gantt.zoom.fit":"Fit to plan","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d","gantt.tip.effort":"{hours}h","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.tip.deadline":"Deadline","gantt.mode.fixedDuration":"Fixed duration","gantt.mode.fixedEffort":"Fixed effort","gantt.mode.fixedUnits":"Fixed units","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}","gantt.dataBand.title":"Data band","gantt.dataBand.name":"Task","gantt.dataBand.resource":"Resource","gantt.dataBand.total":"Total","gantt.dataBand.unassigned":"Unassigned","gantt.dataBand.collapse":"Collapse {name}","gantt.dataBand.expand":"Expand {name}","gantt.dataBand.cell":"{name}, {date}: {value}","gantt.issues.title":"Scheduling conflicts","gantt.issues.empty":"No scheduling conflicts","gantt.issues.count":"{count} scheduling conflicts","gantt.issues.toggle":"Toggle the conflicts panel","gantt.issues.cycle":"Circular dependency: {tasks}","gantt.issues.constraint":"{task} cannot meet its {constraint} constraint of {date}","gantt.issues.lock":"{task} is locked but a dependency would move it","gantt.issues.deadline":"{task} finishes after its deadline of {date}","gantt.issues.fixRemoveLink":"Remove link","gantt.issues.fixAsap":"Set as soon as possible","gantt.issues.fixUnlock":"Unlock task","gantt.issues.fixClearDeadline":"Clear deadline","gantt.resize.startHandle":"Drag to change the start of {name}","gantt.a11y.resizedStart":"{name} start moved to {date}, now {days} days","gantt.a11y.startEdge":"Start edge can be resized: drag the left edge, or press Ctrl+Shift+Left or Right.","gantt.a11y.chain":"Dependency chain highlighted: {preds} predecessors, {succs} successors.","timeline.scrub":"Scrub through recent changes","timeline.goLive":"Go live","timeline.returnToPresent":"Return to the present","a11y.fillHandle":"Drag to fill","panel.icons":"Icons","value.tooLong":"Too long","shortcuts.title":"Keyboard shortcuts","shortcuts.close":"Close keyboard shortcuts","shortcuts.hint":"Press Escape to close.","shortcuts.or":"or","a11y.reorder.moved":"Moved to position {position} of {total}","a11y.reorder.sorted":"Rows cannot be reordered while the grid is sorted","a11y.reorder.filtered":"Rows cannot be reordered while a filter is applied","a11y.reorder.grouped":"Rows cannot be reordered while the grid is grouped","a11y.reorder.grab":"Reorder row","a11y.reorder.sortedManual":"Rows cannot be reordered while the grid is sorted. Press Alt+Shift+M, or the Manual order button in the heading, to order them by hand","a11y.reorder.groupDerived":"The row cannot join that group: the group is worked out from the value, so there is no single value to give it","a11y.reorder.groupReadOnly":"The row cannot join that group: its grouping value cannot be edited","a11y.reorder.invalid":"The row cannot join that group: the new value was not valid","a11y.reorder.vetoed":"The move was declined; the row stays where it was","a11y.reorder.vetoedBecause":"The move was declined ({reason}); the row stays where it was","a11y.reorder.refused":"The row cannot be moved there","a11y.reorder.regrouped":"Moved into {group}","a11y.rowOrder.entered":"Manual order: the rows keep their places and can be moved by hand","a11y.rowOrder.exited":"Manual order ended; the rows follow the sort","rowOrder.button":"Manual order","rowOrder.enter":"Order the rows by hand instead of by the sort","rowOrder.exit":"Return to the sorted order","a11y.transfer.moved":"Row moved to the other grid","a11y.transfer.copied":"Row copied to the other grid","a11y.transfer.refused":"That grid does not accept this row","a11y.transfer.declined":"The drop was declined; the row stays where it was","a11y.transfer.stale":"The drop target changed while it was being confirmed; the row stays where it was","shortcuts.group.grid":"In the data","shortcuts.group.header":"On a column heading","shortcuts.group.panel":"In the column list","shortcut.moveCell":"Move the focused cell","shortcut.rowEnds":"First / last cell of the row","shortcut.gridEnds":"First cell of the first row / last cell of the last row","shortcut.pageRows":"Move one viewport of rows","shortcut.nextCell":"Leave the grid for the next / previous focusable element (arrows move between cells)","shortcut.undo":"Undo the last edit, paste, fill or clear","shortcut.redo":"Redo the step that was undone","shortcut.startEdit":"Start editing the focused cell","shortcut.toggleRow":"Toggle selection of the focused row","shortcut.cancel":"Cancel the current edit or drag","shortcut.expandCollapse":"Expand / collapse a group or tree row","shortcut.focusHeader":"Move focus to the column header","shortcut.focusPanel":"Move focus to the tool panel","shortcut.contextMenu":"Open the context menu for the focused cell","shortcut.moveRow":"Move the focused row, when row reorder is enabled","shortcut.manualOrder":"Order the rows by hand, or return to the sort, when row reorder allows a manual order","shortcut.headingMove":"Move between headings","shortcut.headingEnds":"First / last heading","shortcut.headingSort":"Sort by the column, Shift to add to the sort","shortcut.headingResize":"Resize the column, Ctrl for a coarse step","shortcut.headingAutosize":"Size the column to its content","shortcut.headingReorder":"Move the column","shortcut.headingMenu":"Open the column menu","shortcut.headingExit":"Return focus to the data","shortcut.listGroup":"Group by the column, or stop grouping by it","shortcut.listValues":"Add the column to values, or take it out","shortcut.listPivot":"Pivot by the column, or stop pivoting by it","shortcut.listMove":"Move the column","shortcut.find":"Find in the grid","tags.label":"Show columns","tags.all":"All columns","tags.showing":"Showing {tag}","form.title":"Edit row","form.save":"Save","form.cancel":"Cancel","form.loading":"Loading…","form.loadFailed":"Could not load this record.","form.loadTimeout":"The record did not arrive in time.","form.retry":"Try again","form.choose":"Choose…","form.newTitle":"New row","form.createFailed":"Could not add this record.","presentation.cards":"Showing records as cards","presentation.table":"Showing records as a table","editor.format":"Format","editor.codeHint":"Tab indents · Esc cancels · Ctrl+Enter saves","editor.colours":"Colours","editor.customColour":"Custom colour","editor.hexValue":"Hex value","editor.hexPlaceholder":"#rrggbb","editor.clearColour":"Clear colour","editor.time":"Time","editor.noIcon":"No icon","editor.selectAll":"Select all","editor.passwordHint":"Enter the value twice to save it.","editor.clearRating":"Clear rating","editor.clear":"Clear","editor.value":"Value","editor.currency":"Currency","editor.richtext.formatting":"Formatting","editor.richtext.richText":"Rich text","editor.richtext.placeholder":"Start writing…","editor.richtext.linkLabel":"Link address","editor.richtext.linkPlaceholder":"https://","editor.richtext.linkAdd":"Add link","editor.richtext.bold":"Bold (Ctrl+B)","editor.richtext.italic":"Italic (Ctrl+I)","editor.richtext.underline":"Underline (Ctrl+U)","editor.richtext.strike":"Strikethrough","editor.richtext.heading":"Paragraph style","editor.richtext.alignLeft":"Align left","editor.richtext.alignCenter":"Align centre","editor.richtext.alignRight":"Align right","editor.richtext.ul":"Bulleted list","editor.richtext.ol":"Numbered list","editor.richtext.color":"Text colour","editor.richtext.link":"Link (Ctrl+K)","editor.richtext.image":"Insert image","editor.richtext.clear":"Clear formatting","editor.richtext.source":"HTML source","editor.richtext.undo":"Undo (Ctrl+Z)","editor.richtext.redo":"Redo (Ctrl+Y)","formatting.format":"Format","formatting.noRules":"No rules yet. The first one that matches a cell wins.","formatting.clearAll":"Clear all","formatting.addRule":"Add rule","formatting.condition":"Condition","formatting.value":"Value","formatting.secondValue":"Second value","formatting.moveEarlier":"Move earlier","formatting.moveLater":"Move later","formatting.ruleKind":"Rule type","formatting.aCondition":"A condition","formatting.aColourScale":"A colour scale","formatting.compare":"Compare a value","formatting.distribution":"By the distribution","formatting.colourScale":"Colour scale","formatting.scaleBounds":"Scale bounds","formatting.preview":"Preview","formatting.livePreview":"Live preview","history.title":"History","history.show":"Show history","history.empty":"Nothing to undo yet.","prompt.ask":"Ask","prompt.apply":"Apply","prompt.discard":"Discard","panel.searchColumns":"Search columns","panel.searchColumnsPlaceholder":"Search columns…","panel.searchColumnsToFilter":"Search columns to filter","panel.showAll":"Show all","panel.hideAll":"Hide all","panel.clearAll":"Clear all","panel.clear":"Clear","panel.filterAllColumns":"Filter all columns","panel.columnFiltered":"This column is filtered","panel.clearFilterOn":"Clear the filter on {column}","panel.clearFilter":"Clear this filter","panel.filterEmptyNoMatch":"No column matches “{query}”.","panel.filterEmptyNone":"No column on this grid can be filtered.","panel.filterSummaryActive":"{active} of {total} columns filtered","panel.filterSummaryNone":"No filters · {total} columns available","panel.filterBy":"Filter by {column}","panel.filteredBy":"Filtered by {column}","panel.columnDragHint":"Drag {column} into a zone above, or onto another column to reorder","panel.gridActions":"Grid actions","views.default":"Default","views.namePlaceholder":"Name this view…","views.nameLabel":"Name for the current layout","views.save":"Save view","licence.watermark":"Unlicensed: Lattice Grid trial","licence.watermark.free":M,"filter.op.contains":"Contains","filter.op.notContains":"Does not contain","filter.op.equals":"Equals","filter.op.notEqual":"Does not equal","filter.op.startsWith":"Starts with","filter.op.endsWith":"Ends with","filter.op.blank":"Is blank","filter.op.notBlank":"Is not blank","filter.op.lessThan":"Less than","filter.op.lessThanOrEqual":"Less than or equal","filter.op.greaterThan":"Greater than","filter.op.greaterThanOrEqual":"Greater than or equal","filter.op.inRange":"In range","filter.op.matches":"Matches","filter.op.before":"Before","filter.op.after":"After","filter.op.relative":"Relative to today","filter.rel.today":"Today","filter.rel.yesterday":"Yesterday","filter.rel.tomorrow":"Tomorrow","filter.rel.lastNDays":"Last N days","filter.rel.nextNDays":"Next N days","filter.rel.thisWeek":"This week","filter.rel.lastWeek":"Last week","filter.rel.thisMonth":"This month","filter.rel.lastMonth":"Last month","filter.rel.thisQuarter":"This quarter","filter.rel.quarterToDate":"Quarter to date","filter.rel.thisYear":"This year","filter.rel.yearToDate":"Year to date","filter.operator":"Operator","filter.join":"Join","filter.value":"Value","filter.from":"From","filter.to":"To","filter.addCondition":"Add condition","filter.noConditions":"No conditions","filter.removeCondition":"Remove condition","filter.search":"Search","filter.searchValues":"Search values","filter.noMatches":"No values match","filter.selectAll":"Select all","filter.clear":"Clear","filter.all":"All","filter.allExcept":"All but {count}","filter.loadingValues":"Loading values…","filter.topValues":"Top {shown} of {total} values","filter.valuesFailed":"Values could not be loaded: {error}","filter.valuesUnsupported":"This source cannot list the values of {column}; filter by condition instead.","filter.true":"True","filter.false":"False","filter.expression":"Filter expression","filter.column":"Column","filter.relativePeriod":"Relative period","filter.days":"Number of days","filter.tab.set":"Values","filter.tab.text":"Text","filter.tab.number":"Number","filter.tab.date":"Date","filter.tab.advanced":"Advanced","filterRow.label":"Filter row","filterRow.conditions":{one:"{count} condition",other:"{count} conditions"},"chart.empty":"Nothing to chart","chart.summary":"{type} chart of {measure} by {dimension}","chart.summaryShare":"{type} chart of {measure}","chart.summaryType":"{type} chart","chart.summaryGauge":"{type} chart of {measure}, {fn}: {value}","chart.waterfallTotal":"Total","chart.summaryEngine":"Figures computed by the data engine over every matching row","chart.summaryEngineViewport":"{count} points in this view, fetched from the data engine","chart.summaryEngineDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells counted by the data engine","chart.summaryClientDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells computed in the browser","chart.viewportOverCap":"{count} rows in this view, more than the {cap} this map draws; zoom in or narrow the filter","chart.dataTable":"Chart data","chart.viewportFilter.label":"Map view","chart.annotate.rail":"Drawing tools","chart.annotate.select":"Select and move a drawing","chart.annotate.trendLine":"Trend line","chart.annotate.horizontalLine":"Horizontal line","chart.annotate.verticalLine":"Vertical line","chart.annotate.channel":"Parallel channel","chart.annotate.fibonacci":"Fibonacci retracement","chart.annotate.arrow":"Arrow","chart.annotate.pen":"Freehand pen","chart.annotate.pen.described":"Freehand drawing from {from} to {to}","chart.annotate.measure-x":"Date range","chart.annotate.measure-y":"Price range","chart.annotate.measure-xy":"Date and price range","chart.annotate.measure.bars":{one:"{count} bar",other:"{count} bars"},"chart.annotate.measure.points":{one:"{count} point",other:"{count} points"},"chart.annotate.measure.volume":"Vol {value}","chart.annotate.measure.seconds":"{count}s","chart.annotate.measure.minutes":"{count}m","chart.annotate.measure.hours":"{count}h","chart.annotate.measure.days":"{count}d","chart.annotate.measure.weeks":"{count}w","chart.annotate.measure.months":"{count}mo","chart.annotate.measure.years":"{count}y","chart.annotate.measure":"Measure","chart.annotate.measure.dx":"Δx {value}","chart.annotate.measure.dy":"Δy {value}","chart.annotate.measure.pct":"{value}%","chart.annotate.measure.categories":{one:"{count} category",other:"{count} categories"},"chart.annotate.measure.slope.perDay":"Slope {value} per day","chart.annotate.measure.slope.perCategory":"Slope {value} per category","chart.annotate.measure.slope.perUnit":"Slope {value} per unit","chart.annotate.measure.dur.d":"{count} d","chart.annotate.measure.dur.h":"{count} h","chart.annotate.measure.dur.min":"{count} min","chart.annotate.measure.dur.s":"{count} s","chart.annotate.measure.dur.ms":"{count} ms","chart.annotate.measure.announce":"Measurement: {readout}","chart.annotate.measure.start":"Measure start: {x}, {y}","chart.annotate.text":"Text","chart.annotate.callout":"Callout","chart.annotate.note":"Note","chart.annotate.delete":"Delete the selected drawing","chart.annotate.editLabel":"Annotation text","chart.zoom.toolbar":"Zoom controls","chart.zoom.in":"Zoom in","chart.zoom.out":"Zoom out","chart.zoom.left":"Pan left","chart.zoom.right":"Pan right","chart.zoom.reset":"Reset the zoom","chart.legendMore":{one:"+{count} more",other:"+{count} more"},"chart.type.line":"Line","chart.type.area":"Area","chart.type.bar":"Bar","chart.type.pie":"Pie","chart.type.donut":"Donut","chart.type.sunburst":"Sunburst","chart.type.scatter":"Scatter","chart.type.step":"Step","chart.type.rangeArea":"Range","chart.type.horizontalBar":"Horizontal bar","chart.type.waterfall":"Waterfall","chart.type.floatingBar":"Floating bar","chart.type.horizontalFloatingBar":"Horizontal floating bar","chart.type.populationPyramid":"Population pyramid","chart.type.bullet":"Bullet","chart.type.bubble":"Bubble","chart.type.histogram":"Histogram","chart.type.boxplot":"Box plot","chart.type.forest":"Forest plot","chart.type.qq":"QQ plot","chart.type.ecdf":"ECDF","chart.type.lorenz":"Lorenz","chart.type.correlogram":"Correlogram","chart.type.control":"Control","chart.type.capability":"Capability","chart.type.movingRange":"Moving range","chart.type.treemap":"Treemap","chart.type.combo":"Combination","chart.type.pareto":"Pareto","chart.type.heatmap":"Heat map","chart.type.radar":"Radar","chart.type.gauge":"Gauge","chart.type.funnel":"Funnel","chart.type.candlestick":"Candlestick","chart.type.ohlc":"OHLC","chart.type.polarArea":"Polar area","chart.type.nightingale":"Nightingale rose","chart.type.rose":"Rose","chart.type.radialBar":"Radial bar","chart.type.polarScatter":"Polar scatter","chart.type.geomap":"Map","chart.type.sankey":"Sankey","chart.type.chord":"Chord","chart.type.pyramid":"Pyramid","chart.type.pictorial":"Pictorial","chart.type.serpentine":"Serpentine timeline","chart.type.spiral":"Spiral timeline","chart.edit.aggregated":"This value is a total of several rows, so it cannot be dragged.","chart.edit.refused":"That change was not applied.","chart.edit.refusedWhy":"That change was not applied: {reason}","chart.type.network":"Network","chart.type.stream":"Stream","chart.type.marimekko":"Marimekko","chart.type.violin":"Violin","chart.type.gantt":"Gantt","chart.type.forceTree":"Force-directed tree","chart.type.pack":"Packed circles","chart.type.tree":"Tree","chart.type.voronoiTreemap":"Voronoi treemap","chart.type.alluvial":"Alluvial","chart.type.arc":"Arc diagram","chart.type.barRace":"Bar chart race","chart.type.bubblemap":"Bubble map","chart.type.bump":"Bump chart","chart.type.calendar":"Calendar heat map","chart.type.choropleth":"Choropleth map","chart.type.decomposition":"Decomposition tree","chart.type.diverging":"Diverging bar","chart.type.dumbbell":"Dumbbell","chart.type.fan":"Fan chart","chart.type.hexbin":"Hexagonal bin","chart.type.hexmap":"Hex map","chart.type.icicle":"Icicle","chart.type.markermap":"Marker map","chart.type.motion":"Motion chart","chart.type.parallel":"Parallel coordinates","chart.type.ridgeline":"Ridgeline","chart.type.roc":"ROC curve","chart.type.scatter3d":"3D scatter","chart.type.slope":"Slope chart","chart.type.splom":"Scatter plot matrix","chart.type.venn":"Venn diagram","chart.type.waffle":"Waffle","chart.type.wordCloud":"Word cloud","chart.tasksDropped":{one:"{count} more task not shown",other:"{count} more tasks not shown"},"chart.geoUnmatched":{one:"{count} row could not be placed on the map",other:"{count} rows could not be placed on the map"},"chart.r2":"R² {value}","ai.insights":"Insights","ai.explainView":"Explain this view","ai.explain":"Explain","ai.ask":"Ask","ai.apply":"Apply","ai.discard":"Discard","ai.propose":"Propose","ai.approve":"Approve","ai.thinking":"Thinking…","ai.applying":"Applying…","ai.applied":"Applied: {what}","ai.couldNotApply":"Could not apply: {why}","ai.applyFailed":"it failed","ai.discarded":"Discarded.","ai.discardedNothingWritten":"Discarded. Nothing was written.","ai.nothingWritten":"Nothing was written.","ai.nothingWrittenVetoed":"Nothing was written — a before-handler vetoed it.","ai.scope":"Scope: {scope}","ai.unsafeQuery":"I could not turn that into a safe query: {why}","ai.nothingToDo":"nothing to do","ai.insightsFailed":"Could not generate insights right now. The grid is unaffected.","ai.modelUnreachable":"Could not reach the model right now. The grid is unaffected.","ai.flagged":{one:"{count} unverified figure was removed as ungrounded.",other:"{count} unverified figures were removed as ungrounded."},"ai.askPlaceholder":"Ask your data: “EMEA deals over 50k, biggest first”","ai.askLabel":"Ask your data","ai.actorPlaceholder":"Ask AI to change data: “set the Network Upgrade project to In Progress”","ai.actorLabel":"Ask AI to change data","editor.password.show":"Show value","editor.password.hide":"Hide value","editor.password.showField":"Show {column}","editor.password.hideField":"Hide {column}","facets.computing":"Computing…","facets.suppressed.cardinality":"Too many distinct values to chart","facets.suppressed.rows":"Too many rows to chart","facets.suppressed.streaming":"Paused while live data is streaming","facets.suppressed.noProvider":"No distribution available for this data source","facets.suppressed.type":"This column has no chartable distribution","facets.bucketOf":"{count} of {whole} rows","history.undo":"Undo","history.redo":"Redo","history.described":"{action} {label}","history.nothingToUndo":"Nothing to undo","history.nothingToRedo":"Nothing to redo","history.undoDisabled":"Undo (nothing to undo)","history.redoDisabled":"Redo (nothing to redo)","a11y.presence.joined":"{name} joined","a11y.presence.left":"{name} left","prompt.asking":"Asking…","prompt.moreNotes":{one:"and {count} more",other:"and {count} more"},"shortcuts.key.cmd":"Cmd","timeline.live":"Live","timeline.recording":"recording…","panel.zoneHint.group":"Drag a column here to group rows by its values","panel.zoneHint.values":"Drag a column here to total it","panel.zoneHint.pivot":"Drag a column here to pivot across its values","panel.zoneHint.any":"Drag a column here","panel.rowsOf":"{shown} of {total} rows","views.empty":"No saved views yet. Set the grid up as you want it, then save it below.","views.applied":"Applied","views.matchesGrid":"Matches the grid as it is","views.delete":"Delete","views.confirmDelete":"Delete {name}?","views.confirmDeleteLabel":"Confirm deleting {name}","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","kanban.board":"Board","kanban.requiredTitle":"Required fields","kanban.requiredSave":"Save","kanban.requiredCancel":"Cancel","kanban.moveRefused":'Move refused: a card in "{from}" cannot move to "{to}".',"kpi.status.good":"good","kpi.status.warn":"warn","kpi.status.critical":"critical","kpi.status.unknown":"No data","kpi.node.item":"{count} item","kpi.node.items":"{count} items","kpi.node.worst":"worst status {status}","kpi.node.unknown":"{count} unknown"}),B=Object.freeze(Object.keys(X))}),De("packages/core/src/i18n/format.js",function(e,U){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return O}});const M=U("packages/core/src/internal/predicates.js").isFunction,X=/\{(\w+)\}/g,B=new Map,D=new Map;function Z(b){const c=b||"";if(B.has(c))return B.get(c);let f=null;try{f=new Intl.PluralRules(b||void 0)}catch{f=null}return B.set(c,f),f}function K(b,c,f="conjunction"){const o=Array.isArray(b)?b.filter(i=>i!=null&&i!==""):[];if(o.length===0)return"";if(o.length===1)return String(o[0]);const n=`${c||""}|${f}`;let t=D.get(n);if(t===void 0){try{t=new Intl.ListFormat(c||void 0,{style:"long",type:f})}catch{t=null}D.set(n,t)}return t?t.format(o.map(String)):o.map(String).join(", ")}function I(b,c){return b==null?"":typeof b=="number"?Number.isFinite(b)?b.toLocaleString(c||void 0,{maximumFractionDigits:20}):"":String(b)}function G(b,c,f){if(typeof b=="string")return b;if(!b||typeof b!="object")return"";const o=c&&typeof c.count=="number"?c.count:null;if(o===null)return b.other??"";const n=Z(f),t=n?n.select(o):o===1?"one":"other";return b[t]??b.other??""}function H(b,c={},f){const o=G(b,c,f);return o?o.replace(X,(n,t)=>Object.prototype.hasOwnProperty.call(c,t)?I(c[t],f):n):""}function S(b,c,f="en-GB"){return typeof b=="string"&&b?b:typeof c=="string"&&c?c:f}function O(b,c){const f=b?b[c]:void 0;return f==null||M(f)?c:f}}),De("packages/core/src/i18n/registry.js",function(e,U){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Z}});const M=U("packages/core/src/i18n/catalogue.js").EN_GB,X=new Map([["en-gb",M]]);function B(K,I){const G=typeof K=="string"?K.toLowerCase():"";return!G||!I||typeof I!="object"?!1:(X.set(G,I),!0)}function D(K){if(typeof K!="string"||!K)return null;const I=K.toLowerCase(),G=X.get(I);if(G)return G;const H=I.split("-")[0],S=X.get(H);if(S)return S;for(const[O,b]of X)if(O.split("-")[0]===H)return b;return null}function Z(){return[...X.keys()]}}),De("packages/core/src/i18n/index.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return s}});const te=U("packages/core/src/i18n/catalogue.js"),M=te.EN_GB,X=te.MESSAGE_KEYS,B=U("packages/core/src/i18n/format.js"),D=B.formatMessage,Z=B.formatList,K=B.lookup,I=B.resolveLocale,H=U("packages/core/src/internal/predicates.js").isFunction,O=U("packages/core/src/internal/warn.js").warnOnce,b=U("packages/core/src/i18n/registry.js"),c=b.registerLocale,f=b.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return te.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return te.MESSAGE_KEYS}}),Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return B.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return B.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return b.registerLocale}});const o="en-GB";class n{#e=o;#t=M;constructor(u={}){this.configure(u)}configure(u={}){this.#e=I(u.locale,u.declared,o);const a=u.messages,l=f(this.#e);if(!l&&this.#e.toLowerCase()!=="en-gb"&&(!a||typeof a!="object")&&O(`i18n:locale:not-loaded:${this.#e.toLowerCase()}`,`locale "${this.#e}" is not loaded: import "@toclocoinc/lattice-grid/locales/${this.#e}" to add its text; English is used until then.`),!a||typeof a!="object"){this.#t=l?{...M,...l}:M;return}const y=Object.keys(a).filter(m=>!(m in M));y.length&&O(`i18n:unknown:${y[0]}`,`message keys not in the catalogue and so ignored: ${y.slice(0,5).join(", ")}${y.length>5?`, and ${y.length-5} more`:""}`),this.#t={...M,...l||{},...a}}get locale(){return this.#e}t(u,a){return D(K(this.#t,u),a||{},this.#e)}list(u,a){return Z(u,this.#e,a)}number(u,a){const l=Number(u);return Number.isFinite(l)?l.toLocaleString(this.#e,a||{maximumFractionDigits:20}):""}}const t=new n;function i(r){return r instanceof n?r:new n(r||{})}function s(r){const u=r&&typeof r=="object"?r:{},a=X.filter(h=>{const y=u[h];return y==null||y===""||H(y)}),l=Object.keys(u).filter(h=>!(h in M));return{missing:a,unknown:l}}}),De("packages/core/src/columns/types/structured.js",function(e,U){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const te=U("packages/core/src/internal/predicates.js"),M=te.isNil,X=te.isObject,D=U("packages/core/src/i18n/index.js").defaultMessages,Z=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function K(n,t){const i=t||{},s=i.emptyDisplay??Z.emptyDisplay;if(M(n)||n==="")return s;const u=[...typeof i.char=="string"&&i.char!==""?i.char:Z.char][0]||Z.char,a=i.fixedLength??Z.fixedLength,l=Number.isFinite(i.length)&&Number(i.length)>0?Math.floor(Number(i.length)):Z.length,h=typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"||typeof n=="bigint"?String(n):null;let y=0;if(h!==null){const m=Number.isFinite(i.lastVisible)?Math.floor(Number(i.lastVisible)):Z.lastVisible,v=[...h];if(y=m>0&&m<v.length?m:0,y>0){const d=v.slice(v.length-y).join(""),p=Math.max(1,(a?l:v.length)-y);return u.repeat(p)+d}return u.repeat(a?l:Math.max(1,v.length))}return u.repeat(l)}const I=48;function G(n){try{const t=JSON.stringify(n);return t===void 0?null:t}catch{return null}}function H(n,t){if(M(n))return"";const i=Number.isFinite(t&&t.inlineLimit)?Number(t.inlineLimit):I;if(typeof n=="string")return n.length>i?`${n.slice(0,i-1)}…`:n;if(typeof n!="object")return String(n);const s=G(n);if(s!==null&&s.length<=i)return s;if(Array.isArray(n)){const u=n.length;return`[${D.t("count.items",{count:u})}]`}const r=Object.keys(n).length;return`{${D.t("count.keys",{count:r})}}`}function S(n,t){if(n==null)return"null";const i=typeof n;if(i==="number"||i==="boolean"||i==="bigint")return String(n);if(i==="string")return JSON.stringify(n);if(i!=="object")return JSON.stringify(String(n));const s=t||new WeakSet;return s.has(n)?'"[circular]"':(s.add(n),n instanceof Date?JSON.stringify(n.toISOString()):Array.isArray(n)?`[${n.map(a=>S(a,s)).join(",")}]`:`{${Object.keys(n).sort().map(a=>`${JSON.stringify(a)}:${S(n[a],s)}`).join(",")}}`)}function O(n,t){if(M(n))return M(t)?0:1;if(M(t))return-1;const i=S(n),s=S(t);return i<s?-1:i>s?1:0}function b(n){if(M(n))return null;const t=String(n);if(t.trim()==="")return null;try{return JSON.parse(t)}catch{return t}}function c(n){const t=n&&n.cell&&n.cell.props;return X(t)?t:{}}const f=Object.freeze({json:{base:"object",storage:"object",format:n=>H(n&&n.value,c(n&&n.column)),parse:n=>b(n&&n.text),compare:O,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:n=>{if(M(n))return"";if(typeof n=="string")return n;try{const t=JSON.stringify(n,null,2);return t===void 0?String(n):t}catch{return String(n)}},fromClipboard:n=>b(n)},secret:{base:"text",storage:"object",format:n=>K(n&&n.value,c(n&&n.column)),parse:n=>{const t=n&&n.text;return M(t)||String(t)===""?null:String(t)},compare:(n,t)=>{const i=M(n)||n==="",s=M(t)||t==="";return i===s?0:i?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:n=>K(n),fromClipboard:n=>M(n)||String(n)===""?null:String(n)}}),o=f}),De("packages/core/src/columns/types/unit.js",function(e,U){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return T}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/internal/warn.js").warnOnce;function D(A,C,z,Y){return Object.freeze({symbol:A,factor:C,aliases:Object.freeze(z||[]),binary:!!(Y&&Y.binary),prefix:Y&&Y.prefix||null,auto:!(Y&&Y.auto===!1)})}function Z(A,C,z,Y){return D(A,C,z,Y)}const K=Object.freeze({data:Object.freeze([D("B",1,["byte","bytes"]),D("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),D("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),D("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),D("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),D("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),D("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),D("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),D("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),D("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([D("bps",1,["bit","bits","bit/s","b/s"]),D("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),D("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),D("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),D("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([D("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),D("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),D("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),D("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),D("in",.0254,["inch","inches"],{auto:!1}),D("ft",.3048,["foot","feet"],{auto:!1}),D("yd",.9144,["yard","yards"],{auto:!1}),D("m",1,["metre","metres","meter","meters"]),D("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),D("mi",1609.344,["mile","miles"],{auto:!1}),D("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([D("mg",.001,["milligram","milligrams"]),D("g",1,["gram","grams"]),D("oz",28.349523125,["ounce","ounces"],{auto:!1}),D("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),D("kg",1e3,["kilogram","kilograms"]),D("st",6350.29318,["stone"],{auto:!1}),D("t",1e6,["tonne","tonnes","ton"],{auto:!1}),D("ton (US)",907184.74,["ton","shortton"],{auto:!1}),D("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([D("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),D("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),D("ms",.001,["msec","msecs","millisecond","milliseconds"]),D("s",1,["sec","secs","second","seconds"]),D("m",60,["min","mins","minute","minutes"]),D("h",3600,["hr","hrs","hour","hours"]),D("d",86400,["day","days"])]),speed:Object.freeze([D("mm/s",.001,["millimetre/s","millimeter/s"]),D("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),D("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),D("mph",.44704,["mile/h","miles/h"],{auto:!1}),D("kn",1852/3600,["knot","knots"],{auto:!1}),D("m/s",1,["metre/s","meter/s","mps"]),D("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([D("mm/s²",.001,["mm/s2"]),D("ft/s²",.3048,["ft/s2"],{auto:!1}),D("m/s²",1,["m/s2","metre/s2","meter/s2"]),D("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([D("mm²",1e-6,["mm2"]),D("cm²",1e-4,["cm2"]),D("in²",64516e-8,["in2","sqin"],{auto:!1}),D("ft²",.09290304,["ft2","sqft"],{auto:!1}),D("yd²",.83612736,["yd2","sqyd"],{auto:!1}),D("m²",1,["m2","sqm"]),D("ha",1e4,["hectare","hectares"],{auto:!1}),D("ac",4046.8564224,["acre","acres"],{auto:!1}),D("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([D("µL",1e-6,["ul","microlitre","microliter"]),D("mL",.001,["millilitre","milliliter"]),D("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),D("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),D("L",1,["litre","litres","liter","liters"]),D("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),D("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),D("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),D("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([D("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),D("J",1,["joule","joules"]),D("cal",4.184,["calorie","calories"],{auto:!1}),D("kJ",1e3,["kilojoule","kilojoules"]),D("BTU",1055.05585262,["btu"],{auto:!1}),D("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),D("MJ",1e6,["megajoule","megajoules"]),D("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),D("GJ",1e9,["gigajoule","gigajoules"]),D("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([D("mW",.001,["milliwatt","milliwatts"]),D("W",1,["watt","watts"]),D("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),D("kW",1e3,["kilowatt","kilowatts"]),D("hp",745.6998715822702,["horsepower"],{auto:!1}),D("MW",1e6,["megawatt","megawatts"]),D("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([D("mN",.001,["millinewton","millinewtons"]),D("N",1,["newton","newtons"]),D("lbf",4.4482216152605,["poundforce"],{auto:!1}),D("kgf",9.80665,["kilogramforce"],{auto:!1}),D("kN",1e3,["kilonewton","kilonewtons"]),D("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([D("Pa",1,["pascal","pascals"]),D("mbar",100,["millibar"],{auto:!1}),D("inH₂O",249.0889,["inh2o"],{auto:!1}),D("mmHg",133.322387415,["torr"],{auto:!1}),D("kPa",1e3,["kilopascal","kilopascals"]),D("inHg",3386.388640341,["inhg"],{auto:!1}),D("psi",6894.757293168361,["lbf/in2"],{auto:!1}),D("bar",1e5,[],{auto:!1}),D("atm",101325,["atmosphere","atmospheres"],{auto:!1}),D("MPa",1e6,["megapascal","megapascals"]),D("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([D("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),D("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),D("kN·m",1e3,["knm","kn.m"],{auto:!1}),D("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([D("kg/m³",1,["kg/m3"]),D("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),D("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),D("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([D("L/min",1/6e4,["lpm","l/min"],{auto:!1}),D("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),D("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),D("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),D("cfm",.0004719474432,["ft3/min"],{auto:!1}),D("L/s",.001,["lps","l/s"],{auto:!1}),D("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([D("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),D("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),D("mrad",.001,["milliradian","milliradians"],{auto:!1}),D("mil",Math.PI/3200,["nato-mil"],{auto:!1}),D("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),D("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),D("rad",1,["radian","radians"]),D("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([D("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),D("rad/s",1,["radps","radians/s"]),D("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),D("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([D("ppt",1e-12,["partspertrillion"],{auto:!1}),D("ppb",1e-9,["partsperbillion"]),D("ppm",1e-6,["partspermillion"]),D("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),D("‰",.001,["permille","permil"],{auto:!1}),D("%",.01,["pct","percent"]),D("×",1,["x","ratio","times"])]),molarity:Object.freeze([D("pM",1e-12,["picomolar","picomolarity"]),D("nM",1e-9,["nanomolar","nanomolarity"]),D("µM",1e-6,["um-molar","micromolar","micromolarity"]),D("mM",.001,["millimolar","millimolarity"]),D("M",1,["molar","mol/l","mol/L","molarity"]),D("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([D("mg/s",1e-6,["milligrams/s"]),D("g/s",.001,["grams/s"]),D("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),D("kg/s",1,["kilograms/s","kgps"]),D("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),D("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),D("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([D("µPa·s",1e-6,["upas","micropascalsecond"]),D("cP",.001,["centipoise"],{auto:!1}),D("mPa·s",.001,["mpas","millipascalsecond"]),D("P",.1,["poise"],{auto:!1}),D("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([D("cSt",1e-6,["centistokes","centistoke"]),D("mm²/s",1e-6,["mm2/s"],{auto:!1}),D("St",1e-4,["stokes","stoke"],{auto:!1}),D("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([D("mW/(m·K)",.001,["mw/mk"]),D("W/(m·K)",1,["w/mk","wmk"]),D("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),D("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([D("J/(kg·K)",1,["j/kgk","jkgk"]),D("kJ/(kg·K)",1e3,["kj/kgk"]),D("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([D("nSv/h",1e-9,["nsvh"]),D("µSv/h",1e-6,["usv/h","usvh"]),D("mSv/h",.001,["msvh"]),D("Sv/h",1,["svh"]),D("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),I=Symbol("ambiguous"),G=new Map,H=new Map;function S(A,C){const z=String(A||"").trim();if(!z)throw new Error("[lattice] a unit system needs a name");if(K[z]||H.has(z))throw new Error(`[lattice] unit system "${z}" already exists`);const Y=[...C||[]];if(!Y.length)throw new Error(`[lattice] unit system "${z}" has no units`);if(!Y.some(V=>V.factor===1))throw new Error(`[lattice] unit system "${z}" has no base unit (none with factor 1)`);const q=new Set;for(const V of Y){if(q.has(V.symbol))throw new Error(`[lattice] unit system "${z}" declares "${V.symbol}" twice`);q.add(V.symbol)}return H.set(z,Object.freeze(Y)),G.delete(z),z}function O(){return[...Object.keys(K),...H.keys()]}function b(A){const C=c(A);return C?C.units:[]}function c(A){const C=String(A||""),z=G.get(C);if(z!==void 0)return z;const Y=K[C]||H.get(C);if(!Y)return G.set(C,null),null;const q=Object.freeze([...Y].sort((oe,re)=>oe.factor-re.factor)),V=new Map,J=new Map,ee=(oe,re)=>{const ae=V.get(oe);ae===void 0?V.set(oe,re):ae!==re&&V.set(oe,I)};for(const oe of q){ee(oe.symbol.toLowerCase(),oe);for(const re of oe.aliases)ee(re.toLowerCase(),oe);if(oe.prefix){const re=J.get(oe.prefix)||[];re.push(oe),J.set(oe.prefix,re)}}const ne={units:q,byToken:V,byPrefix:J,decimal:q.filter(oe=>!oe.binary&&oe.auto),binary:q.some(oe=>oe.binary)?q.filter(oe=>(oe.binary||oe.factor===1)&&oe.auto):null};return G.set(C,ne),ne}function f(A,C){return C&&A.binary||A.decimal}function o(A,C){const z=c(A);if(!z||M(C))return null;const Y=z.units.find(V=>V.symbol===String(C));if(Y)return Y;const q=z.byToken.get(String(C).trim().toLowerCase());return q&&q!==I?q:null}const n=new WeakMap;function t(A){const C=A||{};if(typeof C=="object"&&C!==null){const V=n.get(C);if(V!==void 0)return V}const z=C.system||"data",Y=c(z);let q=null;if(!Y)B(`unit:system:${z}`,`unknown unit system "${z}"; known systems are ${O().join(", ")}`);else{let V=C.unit?o(z,C.unit):null;V||(C.unit&&B(`unit:unit:${z}:${C.unit}`,`unknown unit "${C.unit}" in system "${z}"; falling back to ${Y.units[0].symbol}`),V=Y.units.find(J=>J.factor===1)||Y.units[0]),q={index:Y,base:V,binary:C.binary===!0}}return typeof C=="object"&&C!==null&&n.set(C,q),q}const i=new WeakMap;function s(A,C){if(!A||!C||!Array.isArray(A.compound)||A.compound.length===0)return null;const z=i.get(A);if(z!==void 0)return z;const Y=new Set,q=[];for(const J of A.compound){const ee=o(A.system||"data",J);if(!ee){B(`unit:compound:${A.system}:${J}`,`unknown compound unit "${J}" in system "${A.system||"data"}"; ignoring it`);continue}Y.has(ee.symbol)||(Y.add(ee.symbol),q.push(ee))}q.sort((J,ee)=>ee.factor-J.factor);const V=q.length>=2?q:null;return i.set(A,V),V}function r(A,C,z){return C===z||C.factor===z.factor?A:A*C.factor/z.factor}const u=new Map;function a(A){const C=A||"",z=u.get(C);if(z)return z;const Y={group:",",decimal:"."};try{for(const q of new Intl.NumberFormat(A||void 0).formatToParts(12345.6))q.type==="group"?Y.group=q.value:q.type==="decimal"&&(Y.decimal=q.value)}catch{}return u.set(C,Y),Y}const l=/[\s   ]/g,h=/^[+-]?[\d   '’ .,]*(?:[eE][+-]?\d+)?/,y=/^[^\d+\-(.,\s]+\s*/,m=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function v(A,C){const{group:z,decimal:Y}=a(C);let q=String(A).replace(l,"");if(q==="")return null;const V=Y?q.indexOf(Y):-1;if(z&&z!==Y){if(V>=0&&q.indexOf(z,V+Y.length)>=0)return null;q=q.split(z).join("")}if(Y&&Y!=="."&&(q=q.split(Y).join(".")),!m.test(q))return null;const J=Number(q);return Number.isFinite(J)?J:null}function d(A,C,z){const Y=String(A).trim().replace(/\.$/,"");if(Y==="")return null;const q=C.units.find(re=>re.symbol===Y);if(q)return q;const V=Y.toLowerCase(),J=C.byToken.get(V);if(J===I)return null;if(J)return J;const ee=C.byPrefix.get(V);if(!ee||!ee.length)return null;const ne=f(C,z),oe=ee.filter(re=>ne.includes(re));return oe.length===1?oe[0]:null}function p(A,C,z,Y){let q=A,V=0,J=!1,ee=!1;for(;q!=="";){const ne=h.exec(q)[0];if(ne==="")return null;const oe=v(ne,Y&&Y.locale);if(oe===null)return null;q=q.slice(ne.length).trim();const re=q.search(/[+-]?[\d]/),ae=(re>=0?q.slice(0,re):q).trim();if(q=re>=0?q.slice(re).trim():"",ae===""){if(J)return null;ee=!0,V+=r(oe,z[0],C.base)}else{const fe=d(ae,C.index,C.binary);if(!fe)return null;V+=r(oe,fe,C.base)}if(J=!0,ee&&q!=="")return null}return J?V:null}function g(A,C){if(M(A))return null;if(typeof A=="number")return Number.isFinite(A)?A:null;const z=t(C);if(!z)return null;let Y=String(A).trim();if(Y==="")return null;let q=!1;Y.startsWith("(")&&Y.endsWith(")")&&(q=!0,Y=Y.slice(1,-1).trim());const V=s(C,z);if(V){Y.startsWith("-")&&(q=!0,Y=Y.slice(1).trim());const de=p(Y,z,V,C);return de===null?null:q?-de:de}let J=null;const ee=y.exec(Y);if(ee&&ee[0]){const de=d(ee[0].trim(),z.index,z.binary);de&&(J=de,Y=Y.slice(ee[0].length).trim())}const ne=h.exec(Y)[0],oe=v(ne,C&&C.locale);if(oe===null)return null;const re=Y.slice(ne.length).trim();if(J&&re!=="")return null;const ae=J||(re===""?z.base:d(re,z.index,z.binary));if(!ae)return null;const fe=r(oe,ae,z.base);return q?-fe:fe}const k=new Map;function w(A,C,z,Y){const q=`${A||""}|${C}|${z}|${Y?1:0}`;let V=k.get(q);return V||(V=new Intl.NumberFormat(A||void 0,{minimumFractionDigits:C,maximumFractionDigits:z,useGrouping:Y}),k.set(q,V)),V}function E(A,C){if(!Number.isFinite(A)||A===0)return Math.max(0,C-1);const z=Math.floor(Math.log10(Math.abs(A)));return Math.min(20,Math.max(0,C-1-z))}function N(A,C){if(!Number.isFinite(A)||A===0)return A;const z=Math.ceil(Math.log10(Math.abs(A))),Y=10**(C-z);return Math.round(A*Y)/Y}function x(A,C,z){if(!z||z===C.base.symbol)return C.base;if(z!=="auto")return _(C,z);if(A===0||!Number.isFinite(A))return C.base;const Y=Math.abs(A)*C.base.factor,q=f(C.index,C.binary);let V=q[0];for(const ne of q)Y>=ne.factor&&(V=ne);if(Y>=V.factor)return V;let J=V;for(const ne of C.index.units)ne.binary!==C.binary&&ne.factor!==1||ne.factor<=Y&&ne.factor>(J===V?0:J.factor)&&(J=ne);if(J!==V)return J;let ee=V;for(const ne of C.index.units)ne.binary!==C.binary&&ne.factor!==1||ne.factor<ee.factor&&(ee=ne);return ee.factor<C.base.factor?ee:C.base}function _(A,C){const z=A.index.units.find(q=>q.symbol===C);if(z)return z;const Y=A.index.byToken.get(String(C).toLowerCase());return Y&&Y!==I?Y:(B(`unit:display:${C}`,`unknown display unit "${C}"; rendering in ${A.base.symbol}`),A.base)}function F(A,C,z,Y){const q=A<0;let V=Math.abs(A)*C.base.factor;const J=typeof Y.decimals=="number"?Y.decimals:Y.minDecimals??0,ee=typeof Y.decimals=="number"?Y.decimals:Y.maxDecimals??Math.max(J,2),ne=Y.space??" ",oe=[];for(let ae=0;ae<z.length;ae++){const fe=z[ae],de=ae===z.length-1;let ve=de?V/fe.factor:Math.floor(V/fe.factor);if(V-=ve*fe.factor,de){const Le=10**ee;ve=Math.round(ve*Le)/Le+0}const Ie=de?w(Y.locale,J,ee,Y.group!==!1):w(Y.locale,0,0,Y.group!==!1);oe.push(`${Ie.format(ve)}${ne}${fe.symbol}`)}const re=oe.join(" ");return q?`-${re}`:re}function L(A,C){const z=C||{},Y=z.nullDisplay??"";if(M(A)||A==="")return Y;const q=typeof A=="number"?A:Number(A);if(!Number.isFinite(q))return Y;const V=t(z);if(!V)return String(q);const J=s(z,V);if(J)return F(q,V,J,z);const ee=typeof z.significantFigures=="number"&&z.significantFigures>0?z.significantFigures:0,ne=ee?N(q,ee):q,oe=x(ne,V,z.display),re=r(ne,V.base,oe);let ae=typeof z.decimals=="number"?z.decimals:z.minDecimals??0,fe=typeof z.decimals=="number"?z.decimals:z.maxDecimals??Math.max(ae,2);ee&&(ae=E(re,ee),fe=ae);const de=w(z.locale,ae,fe,z.group!==!1).format(re),ve=z.space??" ";return z.placement==="prefix"?`${oe.symbol}${z.space??""}${de}`:`${de}${ve}${oe.symbol}`}function j(A,C){const z=M(A)||Number.isNaN(A)?null:Number(A),Y=M(C)||Number.isNaN(C)?null:Number(C);return z===null||Number.isNaN(z)?Y===null||Number.isNaN(Y)?0:1:Y===null||Number.isNaN(Y)||z<Y?-1:z>Y?1:0}function R(A){const C=typeof A.decimals=="number"&&A.decimals>0?`.${"0".repeat(A.decimals)}`:"";return`${typeof A.decimals=="number"?`#,##0${C}`:"#,##0.##"}" ${A.symbol}"`}function $(A){const C={system:"data",...A||{}},z=t(C),Y=z?z.base.symbol:String(C.unit||""),q=Object.freeze({...C,unit:Y}),V=Object.freeze({...q,display:Y,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),J=new Map([[q.locale||"",q]]),ee=ne=>{const oe=ne||"";let re=J.get(oe);return re||(re=Object.freeze({...q,locale:ne||void 0}),J.set(oe,re)),re};return{base:"number",extends:"number",storage:"float64",unitConfig:q,format:ne=>L(ne.value,ne.locale?ee(ne.locale):q),parse:ne=>g(ne.text,ne.locale?ee(ne.locale):q),compare:j,defaults:{filter:"number",editor:"unit",align:"end",total:C.total||"sum"},...C.totals?{totals:C.totals}:{},excel:C.excel||R({decimals:C.decimals,symbol:Y}),toStorage:ne=>typeof ne=="number"?Number.isFinite(ne)?ne:null:typeof ne=="string"?g(ne,q):M(ne)?null:g(String(ne),q),toClipboard:ne=>L(ne,V),fromClipboard:ne=>g(ne,q)}}const T=$}),De("packages/core/src/columns/types/engineering.js",function(e,U){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return D}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/columns/types/unit.js").createUnitType;function D(I){const G=2*Math.PI/I;return H=>{let S=0,O=0,b=0;for(const f of H||[]){if(M(f))continue;const o=Number(f);Number.isFinite(o)&&(S+=Math.cos(o*G),O+=Math.sin(o*G),b+=1)}return!b||Math.hypot(S,O)/b<1e-12?null:(Math.atan2(O,S)/G%I+I)%I}}function Z(I){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:D(I)}}}const K=Object.freeze({metres:B({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:B({system:"length",unit:"mm",maxDecimals:2}),kilometres:B({system:"length",unit:"km",maxDecimals:3}),grams:B({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:B({system:"mass",unit:"kg",maxDecimals:3}),tonnes:B({system:"mass",unit:"t",maxDecimals:3}),seconds:B({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:B({system:"duration",unit:"ms",maxDecimals:3}),hours:B({system:"duration",unit:"h",maxDecimals:2}),speed:B({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:B({system:"speed",unit:"km/h",maxDecimals:1}),mph:B({system:"speed",unit:"mph",maxDecimals:1}),knots:B({system:"speed",unit:"kn",maxDecimals:1}),acceleration:B({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:B({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:B({system:"area",unit:"ha",maxDecimals:4}),volume:B({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:B({system:"volume",unit:"m³",maxDecimals:3}),energy:B({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:B({system:"energy",unit:"kWh",maxDecimals:2}),power:B({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:B({system:"power",unit:"kW",maxDecimals:2}),force:B({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:B({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:B({system:"pressure",unit:"bar",maxDecimals:3}),psi:B({system:"pressure",unit:"psi",maxDecimals:1}),torque:B({system:"torque",unit:"N·m",maxDecimals:2}),density:B({system:"density",unit:"kg/m³",maxDecimals:2}),flow:B({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:B({system:"flow",unit:"L/min",maxDecimals:1}),radians:B({system:"angle",unit:"rad",maxDecimals:4,totals:Z(2*Math.PI)}),degrees:B({system:"angle",unit:"°",maxDecimals:2,totals:Z(360)}),rpm:B({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:B({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:B({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:B({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:B({system:"fraction",unit:"bp",maxDecimals:1}),molarity:B({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:B({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:B({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:B({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:B({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:B({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:B({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:B({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),De("packages/core/src/columns/types/si.js",function(e,U){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return S}});const te=U("packages/core/src/columns/types/unit.js"),M=te.defineUnit,X=te.registerUnitSystem,B=te.createUnitType,D=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),Z=Object.freeze(["p","n","µ","m","","k","M","G"]);function K(O){const b=String(O.base),c=new Set([...O.prefixes||Z,""]),f=[];for(const o of D){if(!c.has(o.symbol))continue;const n=`${o.symbol}${b}`,t=[];if(O.name){t.push(`${o.name}${O.name}`,`${o.name}${O.name}s`);const i=o.name.slice(-1);if(i&&O.name.startsWith(i)){const s=`${o.name.slice(0,-1)}${O.name}`;t.push(s,`${s}s`)}}o.symbol==="µ"&&t.push(`u${b}`),o.factor===1&&O.aliases&&t.push(...O.aliases),f.push(M(n,o.factor,t))}for(const o of O.extra||[])f.push(o);return f}function I(O,b){const c=K(b);return X(O,c)}function G(O,b,c){return I(O,b),B({system:O,unit:b.base,display:"auto",maxDecimals:3,...c||{}})}const H=Object.freeze({voltage:G("voltage",{base:"V",name:"volt"}),current:G("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:G("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:G("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:G("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:G("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[M("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),M("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:G("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:G("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[M("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:G("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:G("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:G("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:G("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:G("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:G("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:G("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[M("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:G("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),S=G}),De("packages/core/src/columns/types/temperature.js",function(e,U){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});const M=U("packages/core/src/internal/predicates.js").isNil,X=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:f=>f+273.15,fromKelvin:f=>f-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:f=>(f+459.67)*(5/9),fromKelvin:f=>f*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:f=>f,fromKelvin:f=>f}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:f=>f*(5/9),fromKelvin:f=>f*(9/5)})});function B(f){if(M(f))return null;const o=String(f).trim();if(o==="")return null;for(const[t,i]of Object.entries(X))if(o===t||o===i.symbol)return{key:t,scale:i};const n=o.toLowerCase();for(const[t,i]of Object.entries(X))if(i.aliases.includes(n))return{key:t,scale:i};return null}function D(f,o,n){const t=B(o),i=B(n);return!t||!i||!Number.isFinite(Number(f))?null:t.key===i.key?Number(f):i.scale.fromKelvin(t.scale.toKelvin(Number(f)))}const Z=new Map;function K(f,o,n){const t=`${f||""}|${o}|${n}`;let i=Z.get(t);return i||(i=new Intl.NumberFormat(f||void 0,{minimumFractionDigits:o,maximumFractionDigits:n}),Z.set(t,i)),i}function I(f,o){const n=o||{},t=n.nullDisplay??"";if(M(f)||f==="")return t;const i=Number(f);if(!Number.isFinite(i))return t;const s=B(n.scale||"C");if(!s)return String(i);const r=B(n.display||n.scale||"C")||s,u=r.key===s.key?i:r.scale.fromKelvin(s.scale.toKelvin(i)),a=typeof n.decimals=="number"?n.decimals:null,l=a??n.minDecimals??0,h=a??n.maxDecimals??1;return`${K(n.locale,l,h).format(u)}${n.space??" "}${r.scale.symbol}`}const G=/^[+-]?[\d\s.,  ]*\d/;function H(f,o){const n=String(f).trim();if(n==="")return null;const t=new Intl.NumberFormat(o||void 0).formatToParts(1.1).find(u=>u.type==="decimal")?.value||".",i=t===","?".":",",s=n.split(i).join("").split(/[\s  ]/).join("").replace(t,"."),r=Number(s);return Number.isFinite(r)?r:null}function S(f,o){if(M(f))return null;const n=o||{},t=B(n.scale||"C");if(!t)return null;if(typeof f=="number")return Number.isFinite(f)?f:null;let i=String(f).trim();if(i==="")return null;let s=!1;i.startsWith("(")&&i.endsWith(")")&&(s=!0,i=i.slice(1,-1).trim());const r=G.exec(i);if(!r)return null;const u=H(r[0],n.locale);if(u===null)return null;const a=i.slice(r[0].length).trim();if(a==="")return s?-u:u;const l=B(a);if(!l)return null;const h=l.key===t.key?u:t.scale.fromKelvin(l.scale.toKelvin(u));return s?-h:h}function O(f){const o=Object.freeze({scale:"C",...f||{}}),t=(B(o.scale)||B("C")).scale.symbol,i=Object.freeze({...o,display:o.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),s=new Map([[o.locale||"",o]]),r=u=>{const a=u||"";let l=s.get(a);return l||(l=Object.freeze({...o,locale:u||void 0}),s.set(a,l)),l};return{base:"number",extends:"number",storage:"float64",temperatureConfig:o,format:u=>I(u.value,u.locale?r(u.locale):o),parse:u=>S(u.text,u.locale?r(u.locale):o),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:o.excel||`#,##0${typeof o.decimals=="number"&&o.decimals>0?`.${"0".repeat(o.decimals)}`:".#"}" ${t}"`,toStorage:u=>typeof u=="number"?Number.isFinite(u)?u:null:typeof u=="string"?S(u,o):M(u)?null:S(String(u),o),toClipboard:u=>I(u,i),fromClipboard:u=>S(u,o)}}const b=Object.freeze({celsius:O({scale:"C"}),fahrenheit:O({scale:"F"}),kelvin:O({scale:"K"})}),c=O}),De("packages/core/src/columns/types/radix.js",function(e,U){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return F}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/internal/warn.js").warnOnce,D=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),Z=Object.freeze({2:1,8:3,16:4}),K=Object.freeze({2:"0b",8:"0o",16:"0x"}),I=Object.freeze({2:4,8:3,16:2}),G=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),H=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),S=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),O=/[\s\u00a0\u202f_,']/g,b=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,c=Object.freeze([8,16,32,53]),f=new WeakSet,o=new WeakMap,n=new Map,t=new WeakMap,i=new WeakMap,s=Object.freeze({hex:Object.freeze({radix:16}),hex8:Object.freeze({radix:16,bitWidth:8,pad:!0,signed:!1}),hex16:Object.freeze({radix:16,bitWidth:16,pad:!0,signed:!1}),hex32:Object.freeze({radix:16,bitWidth:32,pad:!0,signed:!1}),binary:Object.freeze({radix:2}),binary8:Object.freeze({radix:2,bitWidth:8,pad:!0,signed:!1,group:4}),octal:Object.freeze({radix:8})});function r(L){if(L==null)return 16;const j=typeof L=="string"?L.toLowerCase():L,R=D[j];return R||(B(`radix:base:${String(L)}`,`unsupported radix ${String(L)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function u(L,j){return Math.ceil(L/Z[j])}function a(L,j){if(!L)return j?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!j)return{min:0,max:2**L-1};const R=2**(L-1);return{min:-R,max:R-1}}function l(L){return H[L]||"hexadecimal"}function h(L){if(typeof L=="string"){const j=s[L];return j||B(`radix:preset:${L}`,`unknown radix preset "${L}"; known presets are ${Object.keys(s).join(", ")}`),{...j||{}}}if(L&&typeof L.preset=="string"){const j=s[L.preset];return j||B(`radix:preset:${L.preset}`,`unknown radix preset "${L.preset}"; known presets are ${Object.keys(s).join(", ")}`),{...j||{},...L}}return L||{}}function y(L){const j=h(L),R=r(j.radix),$=Z[R];let T=null;if(j.bitWidth!==void 0&&j.bitWidth!==null&&j.bitWidth!==!1){const ne=Number(j.bitWidth);c.includes(ne)?T=ne:B(`radix:width:${String(j.bitWidth)}`,`unsupported bitWidth ${String(j.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let A=j.signed!==!1;!A&&T===null&&(B("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),T=32);const C=j.prefix===void 0||j.prefix===!0?K[R]:j.prefix===!1?"":String(j.prefix);let z=0;j.pad===!0?z=T?u(T,R):0:typeof j.pad=="number"&&j.pad>0&&(z=Math.floor(j.pad));let Y=0;j.group===!0?Y=I[R]:typeof j.group=="number"&&j.group>0&&(Y=Math.floor(j.group));const q=a(T,A),V=typeof j.min=="number"?Math.max(q.min,j.min):q.min,J=typeof j.max=="number"?Math.min(q.max,j.max):q.max,ee=Object.freeze({radix:R,bits:$,prefix:C,uppercase:j.uppercase!==!1,pad:z,group:Y,groupSeparator:typeof j.groupSeparator=="string"?j.groupSeparator:" ",bitWidth:T,signed:A,min:V,max:J<V?V:J,nullDisplay:typeof j.nullDisplay=="string"?j.nullDisplay:"",name:l(R)});return f.add(ee),ee}function m(L){if(L&&f.has(L))return L;if(typeof L=="string"){let j=n.get(L);return j||(j=y(L),n.set(L,j)),j}if(L&&typeof L=="object"){let j=o.get(L);return j||(j=y(L),o.set(L,j)),j}return m("hex")}function v(L){return L<0?-Math.round(-L):Math.round(L)}function d(L,j,R){if(j<=0||L.length<=j)return L;const $=L.length%j||j,T=[L.slice(0,$)];for(let A=$;A<L.length;A+=j)T.push(L.slice(A,A+j));return T.join(R)}function p(L){const j=m(L),{radix:R,prefix:$,uppercase:T,pad:A,group:C,groupSeparator:z,signed:Y,bitWidth:q,nullDisplay:V}=j,J=q?2**q:0,ee=ne=>{if(M(ne)||ne==="")return V;const oe=typeof ne=="number"?ne:Number(ne);if(!Number.isFinite(oe))return V;const re=v(oe);let ae="",fe=re;re<0&&(Y?(ae="-",fe=-re):fe=(re%J+J)%J);let de=fe.toString(R);return de=T?de.toUpperCase():de.toLowerCase(),A>0&&de.length<A&&(de=de.padStart(A,"0")),C>0&&(de=d(de,C,z)),ae+$+de};return ee.options=j,ee}function g(L,j){const R=m(j);let $=t.get(R);return $||($=p(R),t.set(R,$)),$(L)}function k(L){const j=m(L),{radix:R,groupSeparator:$,signed:T,min:A,max:C}=j,z=G[R],Y=q=>{if(M(q))return{ok:!0,value:null,reason:"blank"};let V=String(q);if($&&$!==""&&(V=V.split($).join("")),V=V.replace(O,""),V==="")return{ok:!0,value:null,reason:"blank"};let J=!1;if((V[0]==="-"||V[0]==="+")&&(J=V[0]==="-",V=V.slice(1)),V==="")return{ok:!1,value:null,reason:"digits"};let ee=null;for(const[oe,re]of S){const ae=oe.exec(V);if(!ae)continue;const fe=V.slice(ae[0].length);if(fe==="")break;if(!G[re].test(fe))return{ok:!1,value:null,reason:"digits"};ee=parseInt(fe,re);break}if(ee===null)if(z.test(V))ee=parseInt(V,R);else if(b.test(V))ee=Number(V);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(ee))return{ok:!1,value:null,reason:"digits"};const ne=v(J?-ee:ee);return!T&&ne<0?{ok:!1,value:ne,reason:"negative"}:ne<A||ne>C?{ok:!1,value:ne,reason:"range"}:{ok:!0,value:ne,reason:"ok"}};return Y.options=j,Y}function w(L,j){const R=m(j);let $=i.get(R);return $||($=k(R),i.set(R,$)),$(L)}function E(L,j){const R=w(L,j);return R.ok?R.value:null}function N(L,j){const R=M(L)||Number.isNaN(L)?null:Number(L),$=M(j)||Number.isNaN(j)?null:Number(j);return R===null?$===null?0:1:$===null||R<$?-1:R>$?1:0}function x(L){const j=L.min>=-2147483648&&L.max<=2147483647;return L.bitWidth&&j?"int32":"float64"}function _(L){const j=y(L),R=p(j),$=k(j);return{base:"number",extends:"number",storage:x(j),matches:null,format:T=>R(T.value),parse:T=>{const A=$(T.text);return A.ok?A.value:null},compare:N,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:T=>R(T),fromClipboard:T=>{const A=$(T);return A.ok?A.value:null},radix:j,formatValue:R,parseText:$}}const F=_}),De("packages/core/src/columns/types/aggregable.js",function(e,U){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return D}});const M=U("packages/core/src/internal/predicates.js").isNil;function X(H){const S=[];for(const O of H||[]){if(M(O))continue;const b=Number(O);Number.isFinite(b)&&S.push(b)}return S}function B(H){return S=>{const O=X(S);if(!O.length)return null;let b=0;for(const c of O)b+=10**(c/H);return H*Math.log10(b)}}function D(H){return S=>{const O=X(S);if(!O.length)return null;let b=0;for(const c of O)b+=10**(c/H);return H*Math.log10(b/O.length)}}function Z(H,S){const O=S&&S.column,c=(O&&O.typeOptions||{}).weight,f=S&&S.valueAt;if(!c||typeof f!="function")return null;let o=0,n=0;for(let t=0;t<H.length;t++){if(M(H[t]))continue;const i=Number(H[t]);if(!Number.isFinite(i))continue;const s=f(c,t);if(M(s))continue;const r=Number(s);!Number.isFinite(r)||r<=0||(o+=i*r,n+=r)}return n===0?null:o/n}function K(H={}){const S=H.factor===20?20:10,O=typeof H.suffix=="string"?H.suffix:"",b=Number.isInteger(H.decimals)?H.decimals:1;return{base:"number",storage:"float64",name:H.name||"logarithmic",format:c=>{const f=c&&c.value;return M(f)||!Number.isFinite(Number(f))?"":`${Number(f).toFixed(b)}${O}`},parse:c=>{const f=String((c&&c.text)??"").replace(O,"").trim();if(!f)return null;const o=Number(f);return Number.isFinite(o)?o:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:B(S),avg:D(S)}}}}function I(H={}){const S=Number.isInteger(H.decimals)?H.decimals:1,O=H.percent===!0;return{base:"number",storage:"float64",name:H.name||"ratio",format:b=>{const c=b&&b.value;return M(c)||!Number.isFinite(Number(c))?"":O?`${Number(c).toFixed(S)}%`:Number(c).toFixed(S)},parse:b=>{const c=String((b&&b.text)??"").replace("%","").trim();if(!c)return null;const f=Number(c);return Number.isFinite(f)?f:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Z}}}}const G=Object.freeze({decibel:K({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:K({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:I({name:"ratio"}),percentRate:I({name:"percentRate",percent:!0})})}),De("packages/core/src/columns/types/currency.js",function(e,U){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"moneyToText",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});const M=U("packages/core/src/internal/predicates.js").isNil,X="⚠ no rate";function B(u){if(M(u))return null;const a=String(u).trim().toUpperCase();return a===""?null:a}function D(u){if(M(u))return null;if(typeof u=="object"&&!Array.isArray(u)){const a=Number(u.amount),l=B(u.code);return!l||!Number.isFinite(a)?null:{amount:a,code:l}}if(Array.isArray(u)&&u.length===2){const a=Number(u[0]),l=B(u[1]);return!l||!Number.isFinite(a)?null:{amount:a,code:l}}return null}const Z=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),K=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),I=/[+-]?[\d\s., ]*\d/;function G(u,a){const l=String(u).trim();if(l==="")return null;const h=new Intl.NumberFormat(a||void 0).formatToParts(1.1).find(d=>d.type==="decimal")?.value||".",y=h===","?".":",",m=l.split(y).join("").split(/[\s ]/).join("").replace(h,"."),v=Number(m);return Number.isFinite(v)?v:null}function H(u,a){const l=a||{},h=B(l.code);if(M(u))return null;const y=D(u);if(y)return y;if(typeof u=="number")return Number.isFinite(u)&&h?{amount:u,code:h}:null;let m=String(u).trim();if(m==="")return null;let v=!1;m.startsWith("(")&&m.endsWith(")")&&(v=!0,m=m.slice(1,-1).trim());let d=null;for(const[N,x]of Object.entries(Z)){if(m.startsWith(N)){d=x,m=m.slice(N.length).trim();break}if(m.endsWith(N)){d=x,m=m.slice(0,-N.length).trim();break}}const p=I.exec(m);if(!p)return null;const g=G(p[0],l.locale);if(g===null)return null;const k=(m.slice(0,p.index)+" "+m.slice(p.index+p[0].length)).trim();!d&&k!==""&&(d=B(k));const w=d||h;return w?{amount:v?-g:g,code:w}:null}function S(u,a){if(typeof u=="function")return(l,h)=>{if(l===h)return 1;const y=u(l,h);return typeof y=="number"&&Number.isFinite(y)&&y>0?y:null};if(u&&typeof u=="object"){const l=u;return(h,y)=>{if(h===y)return 1;const m=Number(l[h]),v=Number(l[y]);return!Number.isFinite(m)||!Number.isFinite(v)||m<=0||v<=0?null:v/m}}return(l,h)=>l===h?1:null}function O(u,a,l){if(!u)return null;if(u.code===a)return u.amount;const h=l(u.code,a);return h===null?null:u.amount*h}const b=new Map;function c(u,a,l){const h=`${u||""}|${a}|${l??""}`;let y=b.get(h);if(!y){const m={style:"currency",currency:a};typeof l=="number"&&(m.minimumFractionDigits=l,m.maximumFractionDigits=l);try{y={fmt:new Intl.NumberFormat(u||void 0,m),currency:!0}}catch{y={fmt:new Intl.NumberFormat(u||void 0,typeof l=="number"?{minimumFractionDigits:l,maximumFractionDigits:l}:{}),currency:!1}}b.set(h,y)}return y}function f(u,a){const l=a||{},h=l.nullDisplay??"",y=D(u);if(!y)return h;const m=B(l.display)||y.code;let v=y.amount,d=y.code;if(m!==y.code){const k=l.rateFn||S(l.rates,l.rateBase),w=O(y,m,k);if(w===null)return`${l.missingRate??X} ${y.code}→${m}`;v=w,d=m}const{fmt:p,currency:g}=c(l.locale,d,l.decimals);return g?p.format(v):`${p.format(v)} ${d}`}function o(u){const a=D(u);return a?`${a.amount} ${a.code}`:""}function n(u){const a=u||{},l=B(a.display),h=a.rateFn||S(a.rates,a.rateBase);return(y,m)=>{const v=D(y),d=D(m);if(!v&&!d)return 0;if(!v)return 1;if(!d)return-1;if(l){const p=O(v,l,h),g=O(d,l,h);if(p!==null&&g!==null)return p===g?0:p<g?-1:1}return v.code===d.code?v.amount===d.amount?0:v.amount<d.amount?-1:1:v.code<d.code?-1:1}}function t(u){const a=u||{},l=(y,m)=>{const v=[];for(const w of y||[]){const E=D(w);E&&v.push(E)}if(!v.length)return null;if(new Set(v.map(w=>w.code)).size===1){const w=v[0].code;return{amount:m(v.map(E=>E.amount)),code:w}}const p=B(a.display);if(!p)return`${a.missingRate??X}: mixed currencies, no display currency set`;const g=a.rateFn||S(a.rates,a.rateBase),k=[];for(const w of v){const E=O(w,p,g);if(E===null)return`${a.missingRate??X}: ${w.code}→${p}`;k.push(E)}return{amount:m(k),code:p}},h=y=>y.reduce((m,v)=>m+v,0);return{sum:y=>l(y,h),avg:y=>l(y,m=>h(m)/m.length),min:y=>l(y,m=>Math.min(...m)),max:y=>l(y,m=>Math.max(...m))}}function i(u){const a=Object.freeze({code:"USD",...u||{}}),l=S(a.rates,a.rateBase),h=Object.freeze({...a,rateFn:l}),y=t(h),m=n(h),v=new Map([[a.locale||"",h]]),d=k=>{const w=k||"";let E=v.get(w);return E||(E=Object.freeze({...h,locale:k||void 0}),v.set(w,E)),E},p=K[B(a.display||a.code)]||"",g=typeof a.decimals=="number"&&a.decimals>0?`.${"0".repeat(a.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:h,format:k=>f(k.value,k.locale?d(k.locale):h),parse:k=>H(k.text,k.locale?d(k.locale):h),compare:m,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:y},excel:a.excel||(p?`"${p}"#,##0${g}`:`#,##0${g}`),toStorage:k=>{const w=D(k);return w||(typeof k=="string"||typeof k=="number"?H(k,h):null)},toClipboard:k=>o(k),fromClipboard:k=>H(k,h)}}const s=Object.freeze({currency:i({code:"USD"}),usd:i({code:"USD"}),eur:i({code:"EUR"}),gbp:i({code:"GBP"}),jpy:i({code:"JPY",decimals:0})}),r=i}),De("packages/core/src/columns/types/index.js",function(e,U){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return N}});const te=U("packages/core/src/columns/types/temporal.js"),M=te.TEMPORAL_TYPES,X=U("packages/core/src/columns/types/network.js"),B=X.NETWORK_TYPES,D=U("packages/core/src/columns/types/structured.js"),Z=D.STRUCTURED_TYPES,K=U("packages/core/src/columns/types/unit.js"),I=K.createUnitType,G=K.UNIT_SYSTEMS,H=K.parseUnit,S=K.formatUnit,O=K.registerUnitSystem,b=K.unitSystemNames,c=K.unitsOf,f=K.defineUnit,o=U("packages/core/src/columns/types/engineering.js"),n=o.ENGINEERING_TYPES,t=U("packages/core/src/columns/types/si.js"),i=t.SI_TYPES,s=t.createSiType,r=t.createSiSystem,u=t.siUnits,a=t.SI_PREFIXES,l=U("packages/core/src/columns/types/temperature.js"),h=l.TEMPERATURE_TYPES,y=l.createTemperatureType,m=l.convertTemperature,v=l.formatTemperature,d=l.parseTemperature,p=l.TEMPERATURE_SCALES,g=U("packages/core/src/columns/types/radix.js"),k=g.createRadixType,w=g.RADIX_PRESETS,E=g.parseRadix,N=g.formatRadix,x=U("packages/core/src/columns/types/aggregable.js"),_=x.AGGREGABLE_TYPES,F=U("packages/core/src/columns/types/currency.js"),L=F.CURRENCY_TYPES,j=F.createCurrencyType,R=F.parseMoney,$=F.formatMoney,T=F.convertMoney,A=F.toMoney,C=F.rateFunction,z=F.moneyComparator,Y=F.normaliseCode,q=F.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return K.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return o.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return o.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return l.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return l.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return l.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return l.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return l.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return l.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return l.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return F.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return F.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return F.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return F.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return F.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return F.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return F.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return F.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return F.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return F.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return te.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return X.NETWORK_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return D.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return x.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return x.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return x.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return te.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return te.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return te.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return te.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return te.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return te.formatDuration}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return X.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return X.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return X.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return X.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return X.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return X.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return X.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return X.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return X.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return X.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return X.overlaps}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return D.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return D.summariseJson}});const V=Object.freeze({...M,...B,...Z,..._,hex:k(w.hex),hex8:k(w.hex8),hex16:k(w.hex16),hex32:k(w.hex32),binary:k(w.binary),binary8:k(w.binary8),octal:k(w.octal),bytes:I({system:"data",unit:"B",display:"auto"}),megabytes:I({system:"data",unit:"MB"}),gigabytes:I({system:"data",unit:"GB"}),bitrate:I({system:"bitrate",unit:"Mbps"}),gigabits:I({system:"bitrate",unit:"Gbps"}),...n,...i,...h,...L});{const J=new Set;for(const ee of[M,B,Z,_,n,i,h,L])for(const ne of Object.keys(ee)){if(J.has(ne))throw new Error(`[lattice] data type "${ne}" is declared twice`);J.add(ne)}}}),De("packages/core/src/compute/handle.js",function(e,U){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return i}});const te=U("packages/core/src/internal/compare.js"),M=te.collator,X=te.defaultCompare,D=U("packages/core/src/internal/warn.js").warnOnce;function Z(s){const r=new Uint32Array(s);for(let u=0;u<s;u++)r[u]=u;return r}function K(s,r){if(r&&typeof r.count=="number")return r.count;if(!s)return 0;if(typeof s.count=="number")return s.count;if(typeof s.length=="number")return s.length;const u=s.values;return s.kind==="multi"&&s.offsets?Math.max(0,s.offsets.length-1):u?s.kind==="bitset"?typeof u.size=="number"?u.size:s.presence&&typeof s.presence.size=="number"?s.presence.size:(D(`count:${s.id}`,`column "${s.id}" is bitset-backed with no declared row count; assuming ${u.length*8}`),u.length*8):u.length:s.presence&&typeof s.presence.size=="number"?s.presence.size:0}const I=new WeakMap;function G(s){const r=s.constructor;if(!r)return"unknown";const u=I.get(r);if(u)return u;let a="unknown";try{let l=null;typeof r.from=="function"?l=r.from([!1,!0]):(l=new r(8),l.set(1));const h=l&&l.words;h&&h.length&&(h[0]===2?a="lsb":h[0]===64&&(a="msb"))}catch{a="unknown"}return I.set(r,a),a}function H(s){if(!s)return()=>0;const r=s instanceof Uint8Array?s:s.words;if(r instanceof Uint8Array){const u=s instanceof Uint8Array?"lsb":G(s);if(u==="lsb")return a=>r[a>>>3]>>>(a&7)&1;if(u==="msb")return a=>r[a>>>3]>>>7-(a&7)&1}return typeof s.get=="function"?u=>s.get(u)?1:0:()=>0}function S(s){return!s||!s.presence?null:H(s.presence)}function O(s){return s?typeof s.size=="number"?s.size:typeof s.values=="function"?s.values().length:0:0}function b(s,r){return s?typeof s.valueOf=="function"?s.valueOf(r):typeof s.values=="function"?s.values()[r]:null:null}function c(s,r){const u=s.offsets,a=s.values;if(!u||!a)return[];const l=u[r],h=u[r+1];if(!(h>l))return[];const y=s.dict,m=new Array(h-l);for(let v=l;v<h;v++)m[v-l]=y?b(y,a[v]):a[v];return m}function f(s){if(!s)return()=>{};const r=s.values,u=S(s),a=s.kind;if(a==="dictionary"){const l=s.dict;return u?h=>u(h)?b(l,r[h]):null:h=>b(l,r[h])}if(a==="bitset"){const l=H(r);return u?h=>u(h)?l(h)===1:null:h=>l(h)===1}if(a==="multi")return u?l=>u(l)?c(s,l):null:l=>c(s,l);if(!r&&typeof s.get=="function"){const l=s.get.bind(s);return h=>{const y=l(h);return y===void 0?null:y}}return u?l=>{if(!u(l))return null;const h=r[l];return h===void 0?null:h}:l=>{const h=r[l];return h===void 0?null:h}}function o(s,r){if(s<r)return-1;if(s>r)return 1;if(s===r){const l=Object.is(s,-0),h=Object.is(r,-0);return l===h?0:l?-1:1}const u=Number.isNaN(s),a=Number.isNaN(r);return u&&a?0:u?1:-1}function n(s){const r=M(s);return(u,a)=>{if(u===a)return 0;const l=typeof u,h=typeof a;if(l==="string"&&h==="string")return r.compare(u,a);if(l==="number"&&h==="number")return o(u,a);if(l==="boolean"&&h==="boolean")return u===a?0:u?1:-1;if(u instanceof Date||a instanceof Date){const y=u instanceof Date?u.getTime():Number(u),m=a instanceof Date?a.getTime():Number(a);return o(y,m)}return X(u,a)}}function t(s,r){if(s&&typeof s.ranks=="function")return s.ranks(r);const u=s&&typeof s.values=="function"?s.values():[],a=u.length,l=n(r),h=new Array(a);for(let m=0;m<a;m++)h[m]=m;h.sort((m,v)=>l(u[m],u[v])||m-v);const y=new Uint32Array(a);for(let m=0;m<a;m++)y[h[m]]=m;return y}function i(s){return s==null||typeof s=="number"&&Number.isNaN(s)}}),De("packages/core/src/compute/filter.js",function(e,U){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return fe}});const M=U("packages/core/src/internal/predicates.js").isBlank,B=U("packages/core/src/internal/merge.js").toArray,Z=U("packages/core/src/internal/warn.js").warnOnce,K=U("packages/core/src/format/date.js"),I=K.toDate,G=K.toIsoDate,H=U("packages/core/src/compute/handle.js"),S=H.bitReader,O=H.dictSize,b=H.dictValue,c=H.presenceReader,f=H.valueComparator,o=H.valueReader,n=/^\d{4}-\d{2}-\d{2}$/,t="\0null\0";function i(de,ve){const Ie=de&&de.pool;if(Ie){const Le=Ie.mask||Ie.acquireMask||Ie.acquire||Ie.take;if(typeof Le=="function"){const se=Le.call(Ie,ve);if(se&&se.length>=ve)return se}}return new Uint8Array(ve)}function s(de,ve){const Ie=de&&de.pool;if(!Ie||!ve)return;const Le=Ie.release||Ie.releaseMask||Ie.free||Ie.recycle;typeof Le=="function"&&Le.call(Ie,ve)}function r(de,ve,Ie){return de.fill(Ie,0,ve),de}function u(de){return de==null||typeof de=="number"&&Number.isNaN(de)}function a(de,ve){if(de==null)return de;if(ve==="number")return typeof de=="number"?de:Number(de);if(ve==="date"||ve==="dateString"){const Ie=G(de);return Ie===null?l(de):Ie}return ve==="boolean"?typeof de=="boolean"?de:de==="true"||de===1?!0:de==="false"||de===0?!1:!!de:de}function l(de){return de instanceof Date?de.getTime():typeof de=="number"?de:Date.parse(String(de))}function h(de){return typeof de=="number"?de:de instanceof Date?de.getTime():de==null||de===""?NaN:Number(de)}function y(de,ve){const Ie=typeof de=="string"?de:String(de);return ve?Ie:Ie.toLowerCase()}function m(de,ve){return de==null?t:typeof de=="string"?ve?de:de.toLowerCase():de instanceof Date?de.getTime():de}function v(de,ve,Ie){const Le=new Set;for(const se of B(de)){const pe=a(se,Ie);Le.add(m(pe,ve)),typeof pe=="string"&&pe!==""&&Number.isFinite(Number(pe))?Le.add(Number(pe)):typeof pe=="number"&&Number.isFinite(pe)&&Le.add(m(String(pe),ve))}return Le}function d(de,ve,Ie){if(de==null||ve===null||ve===void 0)return de==null&&ve==null;const Le=typeof de,se=typeof ve;return Le==="string"&&se==="string"?Ie?de===ve:de.toLowerCase()===ve.toLowerCase():de instanceof Date||ve instanceof Date?l(de)===l(ve):Le==="number"&&se==="number"?de===ve||Number.isNaN(de)&&Number.isNaN(ve):Le==="number"&&se==="string"?de===Number(ve):Le==="string"&&se==="number"?Number(de)===ve:Le==="boolean"||se==="boolean"?de===ve:Array.isArray(de)&&Array.isArray(ve)?de.length===ve.length&&de.every((pe,be)=>d(pe,ve[be],Ie)):de===ve}function p(de,ve){try{if(de instanceof RegExp){const Ie=de.flags.replace(/[gy]/g,"");return new RegExp(de.source,ve||Ie.includes("i")?Ie:`${Ie}i`)}return new RegExp(String(de),ve?"":"i")}catch(Ie){return Z(`regex:${String(de)}`,`filter operator "matches" received an invalid pattern: ${String(de)}`,Ie),null}}function g(de,ve){if(de&&de.type==="datetime"&&k.has(de.op))return _(de,ve);const Ie=F(de,ve),Le=de&&de.type;return Le!=="date"&&Le!=="dateString"?Ie:se=>Ie(typeof se=="string"&&n.test(se)?se:G(se)??se)}const k=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),w=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,E=new Map;function N(de,ve){let Ie=E.get(ve);if(Ie===void 0){try{Ie=new Intl.DateTimeFormat("en-CA",{timeZone:ve,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{Ie=null}E.set(ve,Ie)}if(!Ie)return null;const Le={};for(const se of Ie.formatToParts(de))se.type!=="literal"&&(Le[se.type]=se.value);return Le}function x(de,ve){if(de==null||de==="")return null;if(typeof de=="string"){const pe=w.exec(de.trim());if(pe)return Date.UTC(+pe[1],+pe[2]-1,+pe[3],+(pe[4]||0),+(pe[5]||0),+(pe[6]||0),+(pe[7]||"0").padEnd(3,"0"))}const Ie=I(de);if(!Ie)return null;const Le=Ie.getUTCMilliseconds(),se=ve?N(Ie,ve):null;return se?Date.UTC(+se.year,+se.month-1,+se.day,se.hour==="24"?0:+se.hour,+se.minute,+se.second,Le):Date.UTC(Ie.getFullYear(),Ie.getMonth(),Ie.getDate(),Ie.getHours(),Ie.getMinutes(),Ie.getSeconds(),Le)}function _(de,ve){const Ie=typeof de.timeZone=="string"&&de.timeZone?de.timeZone:void 0,Le=be=>x(be,Ie),se=Array.isArray(de.value)?de.value.map(Le):Le(de.value),pe=F({...de,type:"number",value:se},ve);return be=>pe(x(be))}function F(de,ve){const Ie=de&&de.op,Le=!!(de&&de.caseSensitive),se=de&&de.type,pe=f(ve),be=ke=>je=>!ke(je);switch(Ie){case"eq":{const ke=a(de.value,se);return je=>d(je,ke,Le)}case"ne":{const ke=a(de.value,se);return je=>!d(je,ke,Le)}case"lt":case"lte":case"gt":case"gte":{const ke=a(de.value,se);if(u(ke))return()=>!1;const je=Ie==="lt"?-1:Ie==="lte"?0:Ie==="gt"?1:2;return xe=>{if(u(xe))return!1;const ge=pe(xe,ke);return je===-1?ge<0:je===0?ge<=0:je===1?ge>0:ge>=0}}case"between":case"notBetween":{const ke=B(de.value),je=a(ke[0],se),xe=a(ke[1],se),ge=de.bounds||"[]",we=ge.charAt(0)!=="(",Me=ge.charAt(1)!==")";if(u(je)||u(xe))return Ie==="between"?()=>!1:()=>!0;const Ye=Ae=>{if(u(Ae))return!1;const Ve=pe(Ae,je),Pe=pe(Ae,xe);return(we?Ve>=0:Ve>0)&&(Me?Pe<=0:Pe<0)};return Ie==="between"?Ye:be(Ye)}case"in":case"notIn":{const ke=v(de.value,Le,se),je=xe=>ke.has(m(xe,Le));return Ie==="in"?je:be(je)}case"contains":case"notContains":{const ke=y(a(de.value,se),Le),je=xe=>xe==null?!1:y(xe,Le).includes(ke);return Ie==="contains"?je:be(je)}case"startsWith":{const ke=y(a(de.value,se),Le);return je=>je==null?!1:y(je,Le).startsWith(ke)}case"endsWith":{const ke=y(a(de.value,se),Le);return je=>je==null?!1:y(je,Le).endsWith(ke)}case"matches":{const ke=p(de.value,Le);return ke?je=>je==null?!1:ke.test(String(je)):()=>!1}case"blank":return ke=>M(ke)||Array.isArray(ke)&&ke.length===0;case"notBlank":return ke=>!(M(ke)||Array.isArray(ke)&&ke.length===0);case"containsAny":case"containsNone":{const ke=v(de.value,Le,se),je=xe=>{const ge=xe==null?[]:B(xe);for(let we=0;we<ge.length;we++)if(ke.has(m(ge[we],Le)))return!0;return!1};return Ie==="containsAny"?je:be(je)}case"containsAll":{const ke=B(de.value).map(je=>m(a(je,se),Le));return je=>{const xe=je==null?[]:B(je);if(ke.length===0)return!0;const ge=new Set(xe.map(we=>m(we,Le)));for(let we=0;we<ke.length;we++)if(!ge.has(ke[we]))return!1;return!0}}default:{const ke=fe(Ie);return ke?ke.compile(de.value):(Z(`op:${String(Ie)}`,`unknown filter operator "${String(Ie)}"; the condition is refused rather than matching every row`),()=>!1)}}}function L(de,ve,Ie){return g(ve,Ie)(de)}const j=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),R=new Set(["containsAny","containsAll","containsNone"]);function $(de,ve,Ie){const Le=de&&de.op,se=j[Le]||Le,pe=g({...de,op:se,type:ve.type},Ie),be=ve.items,ke=je=>{const xe=be(je);if(!xe)return!1;for(let ge=0;ge<xe.length;ge++)if(pe(xe[ge]))return!0;return!1};return j[Le]?je=>!ke(je):ke}function T(de,ve,Ie,Le){const se=c(de);if(se){const ke=ve?1:0;for(let je=0;je<Le;je++)Ie[je]=se(je)===ke?1:0;return Ie}const pe=de.kind;if(pe==="float64"||pe==="int32"||pe==="bitset")return r(Ie,Le,ve?1:0);const be=o(de);for(let ke=0;ke<Le;ke++){const je=be(ke),xe=M(je)||Array.isArray(je)&&je.length===0;Ie[ke]=xe===ve?0:1}return Ie}function A(de,ve,Ie,Le){const se=de.dict,pe=O(se),be=new Uint8Array(pe);for(let ge=0;ge<pe;ge++)be[ge]=ve(b(se,ge))?1:0;const ke=de.values,je=c(de);if(!je){for(let ge=0;ge<Le;ge++)Ie[ge]=be[ke[ge]];return Ie}const xe=ve(null)?1:0;for(let ge=0;ge<Le;ge++)Ie[ge]=je(ge)===1?be[ke[ge]]:xe;return Ie}function C(de,ve,Ie,Le){const se=S(de.values),pe=ve(!0)?1:0,be=ve(!1)?1:0,ke=c(de);if(!ke){for(let xe=0;xe<Le;xe++)Ie[xe]=se(xe)===1?pe:be;return Ie}const je=ve(null)?1:0;for(let xe=0;xe<Le;xe++)Ie[xe]=ke(xe)===0?je:se(xe)===1?pe:be;return Ie}function z(de,ve,Ie,Le,se){const pe=de.values,be=ve.type,ke=ve.op;let je=!0;switch(ke){case"eq":case"ne":{const ge=h(a(ve.value,be)),we=typeof ve.value=="number"&&Number.isNaN(ve.value),Me=ke==="ne"?1:0;if(we)for(let Ye=0;Ye<se;Ye++)Le[Ye]=(Number.isNaN(pe[Ye])?1:0)^Me;else for(let Ye=0;Ye<se;Ye++)Le[Ye]=(pe[Ye]===ge?1:0)^Me;break}case"lt":{const ge=h(a(ve.value,be));for(let we=0;we<se;we++)Le[we]=pe[we]<ge?1:0;break}case"lte":{const ge=h(a(ve.value,be));for(let we=0;we<se;we++)Le[we]=pe[we]<=ge?1:0;break}case"gt":{const ge=h(a(ve.value,be));for(let we=0;we<se;we++)Le[we]=pe[we]>ge?1:0;break}case"gte":{const ge=h(a(ve.value,be));for(let we=0;we<se;we++)Le[we]=pe[we]>=ge?1:0;break}case"between":case"notBetween":{const ge=B(ve.value),we=h(a(ge[0],be)),Me=h(a(ge[1],be)),Ye=ve.bounds||"[]",Ae=Ye.charAt(0)!=="(",Ve=Ye.charAt(1)!==")",Pe=ke==="notBetween"?1:0;if(Ae&&Ve)for(let Oe=0;Oe<se;Oe++)Le[Oe]=(pe[Oe]>=we&pe[Oe]<=Me?1:0)^Pe;else if(Ae)for(let Oe=0;Oe<se;Oe++)Le[Oe]=(pe[Oe]>=we&pe[Oe]<Me?1:0)^Pe;else if(Ve)for(let Oe=0;Oe<se;Oe++)Le[Oe]=(pe[Oe]>we&pe[Oe]<=Me?1:0)^Pe;else for(let Oe=0;Oe<se;Oe++)Le[Oe]=(pe[Oe]>we&pe[Oe]<Me?1:0)^Pe;break}case"in":case"notIn":{const ge=new Set;for(const Me of B(ve.value)){const Ye=h(a(Me,be));Number.isNaN(Ye)||ge.add(Ye)}const we=ke==="notIn"?1:0;for(let Me=0;Me<se;Me++)Le[Me]=(ge.has(pe[Me])?1:0)^we;break}default:je=!1;break}if(!je)return!1;const xe=c(de);if(xe){const ge=Ie(null)?1:0;for(let we=0;we<se;we++)xe(we)===0&&(Le[we]=ge)}return!0}function Y(de,ve,Ie,Le){const se=o(de);for(let pe=0;pe<Le;pe++)Ie[pe]=ve(se(pe))?1:0;return Ie}function q(de,ve,Ie){const Le=ve.count|0,se=Ie||i(ve,Le);if(!de)return r(se,Le,1);const pe=typeof ve.handle=="function"?ve.handle(de.col):void 0,be=typeof ve.custom=="function"?ve.custom:null;if(!pe){if(be){for(let ge=0;ge<Le;ge++)se[ge]=be(de,ge)?1:0;return se}return Z(`filter:col:${String(de.col)}`,`filter references unknown column "${String(de.col)}"; the condition is refused rather than matching every row`),r(se,Le,0)}const ke=de.op;if(ke==="blank"||ke==="notBlank")return T(pe,ke==="notBlank",se,Le);const je=typeof ve.itemwise=="function"?ve.itemwise(de.col):null;if(je&&!fe(ke)&&!R.has(ke))return Y(pe,$(de,je,ve.locale),se,Le);const xe=g(de,ve.locale);switch(pe.kind){case"dictionary":return A(pe,xe,se,Le);case"bitset":return C(pe,xe,se,Le);case"float64":case"int32":return z(pe,de,xe,se,Le)?se:Y(pe,xe,se,Le);default:return Y(pe,xe,se,Le)}}function V(de,ve,Ie){if(!de)return r(i(ve,Ie),Ie,1);if(Array.isArray(de.conditions)){const Le=de.conditions.filter(be=>be!=null),se=de.op==="or"?"or":de.op==="not"?"not":"and";if(Le.length===0)return r(i(ve,Ie),Ie,1);const pe=V(Le[0],ve,Ie);for(let be=1;be<Le.length;be++){const ke=V(Le[be],ve,Ie);if(se==="or")for(let je=0;je<Ie;je++)pe[je]|=ke[je];else for(let je=0;je<Ie;je++)pe[je]&=ke[je];s(ve,ke)}if(se==="not")for(let be=0;be<Ie;be++)pe[be]^=1;return pe}return q(de,ve,i(ve,Ie))}function J(de,ve){return V(de,ve,ve.count|0)}function ee(de,ve){if(!de||!ve)return de||null;const Ie=de;if(Array.isArray(Ie.conditions)){if((Ie.op==="or"?"or":Ie.op==="not"?"not":"and")!=="and")return ne(Ie,ve)?null:de;const se=[];for(const pe of Ie.conditions){const be=ee(pe,ve);be&&se.push(be)}return se.length?{...Ie,op:"and",conditions:se}:null}return Ie.col===ve?null:de}function ne(de,ve){if(!de||typeof de!="object")return!1;const Ie=de;if(Ie.col===ve)return!0;if(Array.isArray(Ie.conditions)){for(const Le of Ie.conditions)if(ne(Le,ve))return!0}return!1}function oe(de,ve,Ie){if(Ie&&Ie.length>=ve){let be=0;for(let ke=0;ke<ve;ke++)de[ke]&&(Ie[be++]=ke);return Ie.subarray(0,be)}let Le=0;for(let be=0;be<ve;be++)Le+=de[be]?1:0;const se=new Uint32Array(Le);let pe=0;for(let be=0;be<ve;be++)de[be]&&(se[pe++]=be);return se}const re=new Map;function ae(de){if(!(!de||typeof de!="object"))for(const[ve,Ie]of Object.entries(de))Ie&&typeof Ie.compile=="function"&&re.set(ve,Ie)}function fe(de){return typeof de=="string"?re.get(de):void 0}}),De("packages/core/src/columns/datatypes.js",function(e,U){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return $}});const te=U("packages/core/src/internal/compare.js"),M=te.collator,X=te.defaultCompare,B=U("packages/core/src/internal/predicates.js"),D=B.isNil,Z=B.isObject,K=B.isFunction,G=U("packages/core/src/internal/warn.js").fail,S=U("packages/core/src/internal/text.js").titleCase,O=U("packages/core/src/format/date.js"),b=O.toDate,c=O.toIsoDate,f=O.compareIso,n=U("packages/core/src/format/boolean.js").toTriState,i=U("packages/core/src/columns/types/index.js").EXTENDED_TYPES,s=U("packages/core/src/formula/index.js"),r=s.evaluateFormula,u=s.looksLikeFormula,l=U("packages/core/src/compute/filter.js").declareOperators,h=/^\d{4}-\d{2}-\d{2}$/;function y(T){return T.getHours()===0&&T.getMinutes()===0&&T.getSeconds()===0&&T.getMilliseconds()===0}const m=new Map;function v(T){const A=T||"",C=m.get(A);if(C)return C;const z={group:",",decimal:"."};try{for(const Y of new Intl.NumberFormat(T||void 0).formatToParts(12345.6))Y.type==="group"?z.group=Y.value:Y.type==="decimal"&&(z.decimal=Y.value)}catch{}return m.set(A,z),z}const d=/\d\s*[*/^]\s*[\d.(]/;function p(T,A){if(D(T))return null;let C=String(T).trim();if(C===""||C.startsWith("=")||d.test(C))return null;let z=1;C.startsWith("(")&&C.endsWith(")")&&(z=-1,C=C.slice(1,-1));const Y=C.endsWith("%"),{group:q,decimal:V}=v(A);if(C=C.replace(/[\s\u00a0\u202f\u2009']/g,""),q&&q!=="."&&q!==","&&(C=C.split(q).join("")),C=C.replace(/[^0-9eE+\-.,]/g,""),V===","?C=C.split(".").join("").replace(",","."):C=C.split(",").join(""),C===""||C==="-"||C==="+")return null;const J=Number(C);return Number.isNaN(J)?null:z*(Y?J/100:J)}function g(T,A){const C=D(T)||Number.isNaN(T)?null:Number(T),z=D(A)||Number.isNaN(A)?null:Number(A);return C===null?z===null?0:1:z===null||C<z?-1:C>z?1:0}function k(T,A){const C=n(T),z=n(A);return C===null?z===null?0:1:z===null?-1:C===z?0:C?1:-1}function w(T,A){const C=b(T),z=b(A);if(!C)return z?1:0;if(!z)return-1;const Y=C.getTime(),q=z.getTime();return Y<q?-1:Y>q?1:0}const E=new Map;function N(T){const A=b(T.value);if(!A)return"";const C=T.locale||"";let z=E.get(C);return z||(z=new Intl.DateTimeFormat(T.locale||void 0,{dateStyle:"medium"}),E.set(C,z)),z.format(A)}const x={boolean:{base:"boolean",storage:"bitset",matches:T=>typeof T=="boolean",parse:T=>n(T.text),compare:k,format:T=>n(T.value)===null?"":n(T.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:T=>n(T)===null?"":String(n(T)),fromClipboard:T=>n(T)},number:{base:"number",storage:"float64",matches:T=>typeof T=="number"&&!Number.isNaN(T),parse:T=>{if(u(T.text)){const A=r(T.text,T);if(!A.ok)return null;const C=Number(A.value);return Number.isFinite(C)?C:null}return p(T.text,T.locale)},compare:g,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:T=>D(T)?"":String(T),fromClipboard:(T,A)=>p(T,A&&A.locale)},date:{base:"dateString",storage:"dictionary",matches:T=>typeof T=="string"&&h.test(T)&&!Number.isNaN(Date.parse(T))||T instanceof Date&&!Number.isNaN(T.getTime())&&y(T),parse:T=>c(T.text),compare:f,format:N,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:T=>c(T),toClipboard:T=>D(T)?"":String(T),fromClipboard:T=>c(T)},dateString:{base:"dateString",storage:"dictionary",matches:T=>typeof T=="string"&&h.test(T)&&!Number.isNaN(Date.parse(T)),parse:T=>c(T.text),compare:f,format:N,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:T=>c(T),toClipboard:T=>D(T)?"":String(T),fromClipboard:T=>c(T)},text:{base:"text",storage:"dictionary",matches:T=>typeof T=="string",parse:T=>T.text===""?null:String(T.text),compare:(T,A)=>D(T)?D(A)?0:1:D(A)?-1:M().compare(String(T),String(A)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:T=>D(T)?"":String(T),fromClipboard:T=>T},image:{base:"text",storage:"dictionary",parse:T=>T.text===""||T.text==null?null:String(T.text).trim(),compare:(T,A)=>D(T)?D(A)?0:1:D(A)?-1:M().compare(String(T),String(A)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:T=>D(T)?"":String(T),fromClipboard:T=>T},lookup:{base:"text",storage:"dictionary",parse:T=>{if(T.text===""||T.text==null)return null;const A=T.column&&T.column.lookup,C=A&&K(A.options)?A.options():null;if(!C)return T.text;const z=String(T.text),Y=C.find(J=>String(J.id)===z);if(Y)return Y.id;const q=z.trim().toLowerCase(),V=C.find(J=>String(J.label).toLowerCase()===q);return V?V.id:T.text},compare:X,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:T=>D(T)?"":String(T),fromClipboard:T=>T},object:{base:"object",storage:"object",matches:T=>T!==null&&typeof T=="object"&&!(T instanceof Date),parse:T=>{try{return T.text===""?null:JSON.parse(T.text)}catch{return T.text}},compare:(T,A)=>X(T,A),format:T=>{const A=T.value;if(D(A))return"";if(typeof A=="string")return A;try{return JSON.stringify(A)}catch{return String(A)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:T=>D(T)?"":typeof T=="string"?T:JSON.stringify(T),fromClipboard:T=>T}},_=["boolean","number","date","dateString","datetime","text","object"];function F(T,A,C,z){const Y=C.get(T);if(Y)return Y;z.includes(T)&&G(`circular data type extends chain: ${[...z,T].join(" → ")}`);const q=A[T];q||G(`unknown data type "${T}"`);let V=null;q.extends&&(V=F(q.extends,A,C,[...z,T]));const J={...V||{},...q,name:T,defaults:{...V&&V.defaults||{},...q.defaults||{}}};return J.base||(J.base=V&&V.base||"text"),J.storage||(J.storage=V&&V.storage||"object"),C.set(T,J),J}function L(T,A){const C={...x,...i};if(A&&typeof A.dataType=="function"&&typeof A.names=="function")for(const Y of A.names("dataType")){const q=A.dataType(Y);q&&(C[Y]=q)}if(Z(T))for(const[Y,q]of Object.entries(T))C[Y]=q;const z=new Map;for(const Y of _)F(Y,C,z,[]);F("lookup",C,z,[]);for(const Y of Object.keys(C))F(Y,C,z,[]);for(const Y of z.values())l(Y.operators);return z}function j(T,A){if(T.base==="text"&&(!T.compare||T.compare===x.text.compare)){const C=M(A);return(z,Y)=>D(z)?D(Y)?0:1:D(Y)?-1:C.compare(String(z),String(Y))}return T.compare||X}function R(T,A){return A?T.multiStorage||"multi":T.storage||"object"}function $(T){return S(String(T).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),De("packages/core/src/columns/infer.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return K}});const M=U("packages/core/src/internal/warn.js").infoOnce,B=U("packages/core/src/internal/predicates.js").isNil,D=100;function Z(I,G,H={}){const S=H.sampleSize??D,O=[];for(let b=0;b<I.length&&O.length<S;b++){const c=I[b];B(c)||typeof c=="number"&&Number.isNaN(c)||O.push(c)}if(O.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[b,c]of G){if(typeof c.matches!="function")continue;let f=!0;for(let o=0;o<O.length;o++)if(!c.matches(O[o])){f=!1;break}if(f)return{type:b,unanimous:!0,sampled:O.length}}return H.quiet||M(`infer:${H.colId||"?"}`,`column "${H.colId||"?"}" has mixed or ambiguous values and was inferred as "text". Declare \`type\` on the column to get correct sorting, filtering and export.`),{type:"text",unanimous:!1,sampled:O.length}}function K(I,G,H,S,O={}){const b=O.sampleSize??D,c=[];for(let f=0;f<G.length&&c.length<b;f++){const o=H(G[f]);B(o)||typeof o=="number"&&Number.isNaN(o)||c.push(o)}return Z(c,S,{...O,colId:I}).type}}),De("packages/core/src/columns/graph.js",function(e,U){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return S}});const te=U("packages/core/src/internal/warn.js"),M=te.DEV,X=te.fail,B=te.warnOnce,Z=U("packages/core/src/internal/predicates.js").isFunction,K="*";function I(O){const b=O.value||{};if(!Z(b.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const f=b.pure!==!1;return b.deps===K?{computed:!0,wholeRow:!0,deps:[],pure:f}:Array.isArray(b.deps)?{computed:!0,wholeRow:!1,deps:b.deps.slice(),pure:f}:(B(`deps:missing:${O.id}`,`computed column "${O.id}" declares no \`value.deps\`; treating it as \`deps: '*'\` (a whole-row dependency). Declare the dependencies to get precise invalidation.`),{computed:!0,wholeRow:!0,deps:[],pure:f})}function G(O){const b=new Map;for(const h of O)b.set(h.id,h);const c=new Map,f=new Map,o=new Set,n=new Set,t=new Set,i=new Set;for(const h of O){const y=I(h);if(!y.computed){c.set(h.id,[]);continue}n.add(h.id),(y.pure?t:i).add(h.id),y.wholeRow&&o.add(h.id);const m=[],v=[];for(const d of y.deps)(b.has(d)?m:v).push(d);c.set(h.id,m),v.length&&f.set(h.id,v)}for(const h of t)for(const y of c.get(h))i.has(y)&&X(`pure computed column "${h}" depends on impure column "${y}". Mark it \`value.pure: false\` or make the dependency pure.`);const s=[],r=new Map,u=[],a=h=>{const y=r.get(h);if(y!=="done"){if(y==="open"){const m=u.indexOf(h);X(`circular column dependency: ${[...u.slice(m),h].join(" → ")}`)}r.set(h,"open"),u.push(h);for(const m of c.get(h)||[])b.has(m)&&a(m);u.pop(),r.set(h,"done"),s.push(h)}};for(const h of O)a(h.id);const l=new Map;for(const h of O)l.set(h.id,[]);for(const h of O)for(const y of c.get(h.id)||[]){const m=l.get(y);m&&!m.includes(h.id)&&m.push(h.id)}if(o.size)for(const h of O){if(n.has(h.id))continue;const y=l.get(h.id);for(const m of o)y.includes(m)||y.push(m)}return{order:s,dependents:l,pure:t,impure:i,computed:n,deps:c,wholeRow:o,external:f,index:b}}function H(O,b){const c=Array.isArray(b)?b:[b],f=new Set,o=[...c];for(;o.length;){const n=o.shift();for(const t of O.dependents.get(n)||[])f.has(t)||(f.add(t),o.push(t))}for(const n of c)f.delete(n);return O.order.filter(n=>f.has(n))}function S(O,b,c){if(!M)return O;const f=b instanceof Set?b:new Set(b);return new Proxy(O,{get(o,n){return typeof n=="string"&&!f.has(n)&&!Object.hasOwn(o,n)&&B(`undeclared:${c}:${n}`,`computed column "${c}" read undeclared dependency "${n}". Add it to \`value.deps\` or the value will go stale.`),o[n]}})}}),De("packages/core/src/model/rowkey.js",function(e,U){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return n}});const M=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/internal/paths.js").pathGetter,D=U("packages/core/src/internal/predicates.js"),Z=D.isFunction,K=D.isBlank,I=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],G="";function H(t){if(t===null)return"\0n";if(t===void 0)return"\0u";const i=typeof t;if(i==="string")return t;if(i==="number"||i==="bigint"||i==="boolean")return String(t);if(t instanceof Date)return`\0d${t.getTime()}`;try{return`\0o${JSON.stringify(t)}`}catch{return"\0o?"}}function S(t){if(t.length===1)return H(t[0]);let i="";for(let s=0;s<t.length;s++)s&&(i+=G),i+=H(t[s]);return i}function O(t,i={}){const s=i.warn!==!1;if(Z(t)){const r=t;return{stable:!0,fields:[],disabled:[],key(u,a){try{const l=r(u);return Array.isArray(l)?S(l):H(l)}catch(l){return M("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",l),`#${a??-1}`}},keyEmpty(u){try{const a=r(u);return Array.isArray(a)?a.length===0||a.some(K):K(a)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(t)&&t.length>0){const r=t.filter(l=>typeof l=="string"),u=r.map(l=>B(l)),a=u.length;return{stable:!0,fields:r,disabled:[],key(l){const h=new Array(a);for(let y=0;y<a;y++)h[y]=u[y](l);return S(h)},keyEmpty(l){for(let h=0;h<a;h++)if(K(u[h](l)))return!0;return!1},missingFields(l){const h=[];for(let y=0;y<a;y++)K(u[y](l))&&h.push(r[y]);return h}}}if(typeof t=="string"&&t.length>0){const r=B(t);return{stable:!0,fields:[t],disabled:[],key(u){return H(r(u))},keyEmpty(u){return K(r(u))},missingFields(u){return K(r(u))?[t]:[]}}}return s&&M("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${I.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:I.slice(),key(r,u){if(r===null||typeof r!="object")return`#${u??0}:${String(r)}`;let a=b.get(r);return a===void 0&&(a=`#${c++}`,b.set(r,a)),a}}}const b=new WeakMap;let c=0;function f(t,i){if(!t||t.stable===!1||!Z(t.keyEmpty)||!Array.isArray(i)||i.length===0)return;let s=0,r=null,u;for(let y=0;y<i.length;y++){const m=i[y];t.keyEmpty(m)&&(s++,r===null&&(r=Z(t.missingFields)?t.missingFields(m):[],u=m))}if(s===0)return;const a=t.fields.length?t.fields.join(","):"(function)",l=r&&r.length?r.join(", "):t.fields.length?t.fields.join(", "):"the rowKey function",h=u!==null&&typeof u=="object"?Object.keys(u).join(", ")||"(no fields)":String(u);M(`rowKey.emptyValue:${a}`,`rowKey ${l} is missing on ${s} of ${i.length} rows; the first such row has: ${h}. Rows without a key value collapse onto one key, so selection, edits and rows.apply updates land on whichever row now shares it. Set rowKey to a field present on every row, or fix the source data.`)}function o(t){return S(t)}function n(t){return t.split(G)}}),De("packages/core/src/columns/lookup.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return t}});const te=U("packages/core/src/internal/compare.js"),M=te.collator,X=te.defaultCompare,B=U("packages/core/src/internal/predicates.js"),D=B.isFunction,Z=B.isNil,I=U("packages/core/src/internal/warn.js").warnOnce,H=U("packages/core/src/model/rowkey.js").compositeKey,S=", ",O="";function b(i,s,r,u){if(i===null||typeof i!="object")return{id:i,label:i==null?"":String(i)};const a=i[s],l=i[r],h={id:a,label:l==null?String(a??""):String(l)};i.disabled&&(h.disabled=!0),i.variant&&(h.variant=i.variant),i.icon&&(h.icon=i.icon);const y=u?i[u]:i.group;return y!==void 0&&(h.group=y),h}function c(i,s,r=0,u=[],a=[]){for(const l of i||[]){const h=l&&typeof l=="object"?l[s]:null;if(a.push({raw:l,depth:r,path:u}),Array.isArray(h)&&h.length){const y=String(l&&typeof l=="object"?l.label??l.name??l.id??"":l);c(h,s,r+1,[...u,y],a)}}return a}function f(i){return!!i&&typeof i=="object"&&!Array.isArray(i)&&D(i.router&&i.router.subscribe)}class o{#e;#t;#n;#r;#s=[];#i=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#f=null;#d=new Map;constructor(s,r={}){this.#e=s||{},this.#t=r.colId||"?",this.#n=r.locale,this.#r=r.onChange||null,this.#u=M(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#a="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#a}get ready(){return this.#a==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??S}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#s}setLocale(s){this.#n=s,this.#u=M(s)}#h(s){const r=this.#e,u=r.valueKey||"id",a=r.labelKey||"label",l=r.childrenKey||"children";this.#s=c(s,l).map(h=>{const y=b(h.raw,u,a,r.groupKey);return h.depth&&(y.depth=h.depth,y.path=h.path),y}),this.#i=new Map,this.#o=new Map,this.#s.forEach((h,y)=>{this.#i.set(h.id,h),this.#o.set(h.id,y)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const s=this.#e.options;if(Array.isArray(s)||s===void 0)return this.#c=Promise.resolve(this.#s),this.#c;if(f(s))return this.#c=this.#p(s),this.#c;if(!D(s))return I(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#a="ready",this.#c=Promise.resolve([]),this.#c;this.#a="loading";let r;try{r=s()}catch(u){return this.#a="error",I(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,u),this.#c=Promise.resolve([]),this.#c}return!r||!D(r.then)?(this.#h(r),this.#c=Promise.resolve(this.#s),this.#r&&this.#r(this),this.#c):(this.#c=r.then(u=>(this.#h(u),this.#r&&this.#r(this),this.#s),u=>(this.#a="error",I(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,u),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#s)):this.load()}#p(s){if(this.#f)return Promise.resolve(this.#s);const r=this.#e,u=r.valueKey||"id",a=r.labelKey||"label",l=r.groupKey,h=D(s.map)?s.map:null,y=v=>b(h?h(v):v,u,a,l).id,m=v=>this.#m(v,h,u,a,l);return s.router.subscribe(s.predicate,m,{rowKey:y}),this.#f=()=>{D(s.router.detach)&&s.router.detach(m)},this.#a="ready",Promise.resolve(this.#s)}#m(s,r,u,a,l){const h=s&&s.add||[],y=s&&s.update||[],m=s&&s.remove||[];if(!(!h.length&&!y.length&&!m.length)){for(const v of h)this.#g(v,r,u,a,l);for(const v of y)this.#g(v,r,u,a,l);for(const v of m){if(!this.#d.has(v))continue;const d=this.#d.get(v);this.#d.delete(v),this.#i.delete(d);const p=this.#s.findIndex(g=>g.id===d);p>=0&&this.#s.splice(p,1)}this.#o=new Map(this.#s.map((v,d)=>[v.id,d])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(s,r,u,a,l){const h=b(r?r(s):s,u,a,l);this.#d.set(H([h.id]),h.id);const y=this.#s.findIndex(m=>m.id===h.id);y>=0?this.#s[y]=h:this.#s.push(h),this.#i.set(h.id,h)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(s,r){const u=this.#e;if(!D(u.search)){const h=String(s||"").toLowerCase();return Promise.resolve(h===""?this.#s:this.#s.filter(y=>y.label.toLowerCase().includes(h)))}const a=u.valueKey||"id",l=u.labelKey||"label";return Promise.resolve(u.search(s,r)).then(h=>(h||[]).map(y=>b(y,a,l,u.groupKey)))}option(s){return this.#i.get(s)}has(s){return this.#i.has(s)}label(s){if(Z(s)||s==="")return"";const r=this.#i.get(s);if(r)return r.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||I(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(s)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const u=this.#e.unknownLabel;return D(u)?String(u(s)??""):typeof u=="string"?u:String(s)}text(s){if(this.multiple){const r=n(s);return r.length===0?"":r.map(u=>this.label(u)).join(this.separator)}return this.label(s)}dictionary(){return this.#s.map(s=>s.id)}sorted(){const s=this.sortBy;if(s==="optionOrder"||s==="count")return this.#s.slice();if(s==="value")return this.#s.slice().sort((u,a)=>X(u.id,a.id));const r=this.#u;return this.#s.slice().sort((u,a)=>r.compare(u.label,a.label))}comparator(){const s=this.sortBy,r=this.multiple,u=this.#u,a=this.#o;if(r&&s==="count")return(h,y)=>n(h).length-n(y).length;const l=r?h=>n(h)[0]:h=>h;return s==="value"?(h,y)=>X(l(h),l(y)):s==="optionOrder"?(h,y)=>{const m=a.has(l(h))?a.get(l(h)):Number.MAX_SAFE_INTEGER,v=a.has(l(y))?a.get(l(y)):Number.MAX_SAFE_INTEGER;return m-v}:(h,y)=>{const m=l(h),v=l(y);return Z(m)?Z(v)?0:1:Z(v)?-1:u.compare(this.label(m),this.label(v))}}groupKey(s){return this.multiple?n(s).map(u=>String(u)).sort().join(O):Z(s)?"":String(s)}countValues(s){return this.multiple?n(s).length:Z(s)?0:1}contains(s,r,u){const a=this.multiple?n(s):Z(s)?[]:[s],l=Array.isArray(r)?r:[r];switch(u){case"containsAll":return l.every(h=>a.includes(h));case"containsNone":return!l.some(h=>a.includes(h));default:return l.some(h=>a.includes(h))}}exportText(s,r="label"){return r==="value"?this.multiple?n(s).join(this.separator):Z(s)?"":String(s):this.text(s)}exportColumns(){const s=this.multiple;return this.#s.map(r=>({id:r.id,label:r.label,has:u=>s?n(u).includes(r.id):u===r.id}))}}function n(i){return Array.isArray(i)?i:Z(i)||i===""?[]:[i]}function t(i,s={}){const r=i.lookup;if(!r)return null;const u=new o(r,{colId:i.id,locale:s.locale,onChange:s.onChange});return!Array.isArray(r.options)&&r.options!==void 0&&u.load(),u}}),De("packages/core/src/columns/value.js",function(e,U){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return o}});const M=U("packages/core/src/internal/paths.js").getPath,X=U("packages/core/src/internal/predicates.js"),B=X.isFunction,D=X.isNil,K=U("packages/core/src/internal/lru.js").Lru,G=U("packages/core/src/internal/warn.js").warnOnce,S=U("packages/core/src/columns/graph.js").depsProxy,O="\0";function b(s,r={}){const u=r.locale,a=r.grid??null,l=r.context,h=s.value&&s.value.format,y=s.formatter||null,m=s.dataType&&s.dataType.format,v=s.lookup||null,d=(p,g,k)=>({value:p,data:k,row:g,column:s,colId:s.id,grid:a,context:l,locale:u});if(B(h))return(p,g,k)=>{const w=h(d(p,g,k));return w==null?"":String(w)};if(y){if(v){const p=y.kind==="text";return(g,k,w)=>y(p?v.text(g):g,d(g,k,w))}return(p,g,k)=>y(p,d(p,g,k))}return B(m)?(p,g,k)=>{const w=m(d(p,g,k));return w==null?"":String(w)}:v?p=>v.text(p):p=>D(p)?"":typeof p=="string"?p:String(p)}function c(s,r){!s||!s.value||s.value.pure!==!1||G(`impure:${r}:${s.id}`,`column "${s.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${r}. The result is not stable across passes.`)}class f{#e;#t;#n;#r;#s;#i;#o=new K(4096);constructor(r){this.#e=r.columns instanceof Map?r.columns:new Map((r.columns||[]).map(u=>[u.id,u])),this.#t=r.graph,this.#n=r.grid??null,this.#r=r.context,this.#i=r.stored||null,this.#s=r.rowKey||o}get graph(){return this.#t}setGraph(r){this.#t=r,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(r){if(this.#o.size===0)return;const u=r&&r.rows?new Set([...r.rows].map(String)):null,a=r&&r.columns?[...r.columns]:null;if(!u&&!a){this.#o.clear();return}const l=a?this.#l(a):null;for(const h of[...this.#o.keys()]){const y=String(h).split(O);y.length===3&&(u&&!u.has(y[0])||l&&!l.has(y[2])||this.#o.delete(h))}}#l(r){const u=new Set,a=this.#t,l=[...r];for(;l.length;){const h=l.pop();if(!u.has(h)){u.add(h);for(const y of a?a.dependents.get(h)||[]:[])l.push(y)}}return u}value(r,u,a){const l=typeof r=="string"?this.#e.get(r):r;if(!l)return;if(!l.computed)return this.#c(l,u,a);if(l.value.pure!==!1&&this.#i&&a&&a.physical!=null&&this.#i.has(l.id))return this.#i.get(l.id,a.physical);if(l.volatile)return this.compute(l,u,a);if(l.value.pure===!1)return this.compute(l,u,a);const h=`${this.#a(u,a)}${O}${l.id}`;if(this.#o.has(h))return this.#o.get(h);const y=this.compute(l,u,a);return this.#o.set(h,y),y}#a(r,u){return`${this.#s(r,u)}${O}${n(r)}`}#c(r,u,a){if(this.#i&&a&&a.physical!=null&&this.#i.has(r.id))return this.#i.get(r.id,a.physical);if(r.field)return r.read?r.read(u):M(u,r.field)}compute(r,u,a){const l=this.#t,h=l&&l.wholeRow.has(r.id);let y;if(h)y=u??{};else{y={};const v=l&&l.deps.get(r.id)||[];for(const p of v)y[p]=this.value(p,u,a);const d=l&&l.external.get(r.id)||[];for(const p of d)y[p]=M(u,p);y=S(y,[...v,...d],r.id)}const m={data:u,row:a,column:r,grid:this.#n,context:this.#r};return r.value.compute(y,m)}values(r,u){const a={},l=this.#t?this.#t.order:[...this.#e.keys()];for(const h of l)a[h]=this.value(h,r,u);return a}text(r,u,a){const l=typeof r=="string"?this.#e.get(r):r;return l?l.formatValue(this.value(l,u,a),a,u):""}key(r,u,a){const l=typeof r=="string"?this.#e.get(r):r;if(!l)return"";const h=this.value(l,u,a);return B(l.value.key)?String(l.value.key(this.#u(l,h,u,a))):l.lookup?l.lookup.groupKey(h):D(h)?"":String(h)}quickFilterText(r,u,a){const l=typeof r=="string"?this.#e.get(r):r;if(!l)return"";if(B(l.value.quickFilterText)){const h=this.value(l,u,a);return String(l.value.quickFilterText(this.#u(l,h,u,a))??"")}return this.text(l,u,a)}#u(r,u,a,l){return{value:u,data:a,row:l,column:r,colId:r.id,grid:this.#n,context:this.#r}}parse(r,u,a,l){const h=typeof r=="string"?this.#e.get(r):r;if(!h)return u;const y={text:u,value:this.value(h,a,l),data:a,row:l,column:h,grid:this.#n,context:this.#r,locale:this.#n&&B(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&B(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return B(h.value.parse)?h.value.parse(y):h.dataType&&B(h.dataType.parse)?h.dataType.parse(y):u}validate(r,u,a,l,h){const y=typeof r=="string"?this.#e.get(r):r;if(!y||!B(y.edit.validate))return!0;const m=y.edit.validate({value:u,oldValue:a,data:l,row:h,column:y,grid:this.#n,context:this.#r});return m===!0||m===void 0?!0:String(m)}apply(r,u,a,l){const h=typeof r=="string"?this.#e.get(r):r;if(!h)return!1;const y=this.value(h,a,l);if(B(h.value.apply)){const m=h.value.apply({value:u,oldValue:y,data:a,row:l,column:h,grid:this.#n,context:this.#r});return this.#f(h,a,l),m!==!1}return h.field?y===u?!1:(h.write(a,u),this.#f(h,a,l),!0):(G(`apply:${h.id}`,`column "${h.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(r,u,a,l){const h=typeof r=="string"?this.#e.get(r):r;if(!h)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const y=this.value(h,a,l),m=this.parse(h,u,a,l),v=this.validate(h,m,y,a,l);if(v!==!0)return{ok:!1,value:m,oldValue:y,changed:!1,error:v};const d=this.apply(h,m,a,l);return{ok:!0,value:m,oldValue:y,changed:d}}#f(r,u,a){if(this.#o.size===0)return;const l=this.#a(u,a);this.#o.delete(`${l}${O}${r.id}`);for(const h of this.#t?this.#t.dependents.get(r.id)||[]:[])this.#o.delete(`${l}${O}${h}`)}}function o(s,r){return r&&r.key!=null?String(r.key):n(s)}function n(s){if(s&&typeof s=="object"){let r=t.get(s);return r===void 0&&(r=`#${i++}`,t.set(s,r)),r}return String(s)}const t=new WeakMap;let i=0}),De("packages/core/src/model/shadow.js",function(e,U){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return a}});const M=U("packages/core/src/internal/warn.js").warnOnce,X=2e5,B=20,D=1e3,Z=50;function K(l){return Math.min(D,Math.max(Z,Math.floor(l)))}const I=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),G=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),H=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),S=.6745,O=3.5,b=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),c=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),f=Object.freeze({updates:"Updates",updatedAt:"Updated at",sinceUpdate:"Since update",delta:"Change",deltaPercent:"Change %",rate:"Rate of change",history:"History",firstValue:"Baseline",streak:"Streak",rank:"Rank",rankAsc:"Rank, ascending",rankChange:"Rank change",percentile:"Percentile",quartile:"Quartile",zScore:"Z-score",shareOfTotal:"Share of total",anomalyScore:"Anomaly score",anomalyFlag:"Anomaly",specStatus:"Spec status",rollingSum:"Rolling sum",rollingAvg:"Rolling average",rollingMin:"Rolling minimum",rollingMax:"Rolling maximum",windowCoverage:"Window coverage",cumulativeToDate:"Cumulative to date",periodOverPeriod:"Period over period",rollingQuantile:"Rolling quantile",windowApproximate:"Window approximate",tsTrend:"Trend",tsSeasonal:"Seasonal",tsResidual:"Seasonal residual",tsCoverage:"Decomposition coverage",tsSmoothed:"Smoothed",tsSmoothingAlpha:"Smoothing α",tsSmoothingBeta:"Smoothing β",fitPredicted:"Predicted",fitResidual:"Residual",fitInfluence:"Influence",fitStdResidual:"Std. residual",fitLeverage:"Leverage",fitCooksD:"Cook's D"});function o(l,h){if(!h)return null;const y=Number.isFinite(Number(h.lower))?Number(h.lower):null,m=Number.isFinite(Number(h.upper))?Number(h.upper):null;if(y===null&&m===null||!Number.isFinite(l))return null;if(y!==null&&l<y||m!==null&&l>m)return b.FAIL;const v=Number.isFinite(Number(h.warnLower))?Number(h.warnLower):null,d=Number.isFinite(Number(h.warnUpper))?Number(h.warnUpper):null;return v!==null&&l<v||d!==null&&l>d?b.WARN:b.PASS}function n(l,h,y){if(!h||typeof h!="object")return null;if(h.kind!=="time")return h.kind!==void 0&&M(`shadow.history.window.kind:${l}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${h.kind}' is not honoured (a plain count is already what 'depth' means, and a session has no span to divide into buckets), so it reported the original, unwindowed history.`),null;const m=h.minutes!=null?Number(h.minutes)*6e4:Number(h.span);if(!(m>0))return M(`shadow.history.window.span:${l}`,"a 'history' shadow's time window needs a positive 'span' (ms) or 'minutes'; it had none, so it reported the original, unwindowed history."),null;const v=Math.max(2,Math.floor(y)||B);return{span:m,bucketMs:Math.max(1,Math.floor(m/v))}}class t{#e;#t=new Map;#n=new Map;#r=new Map;#s=new Map;#i=new Map;#o=new Map;#l=0;#a;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(h){this.#e=h.colId,this.#a=Math.max(2,h.depth||B),this.#c=Math.max(1,h.max||X),this.#u=h.now||(()=>Date.now()),this.#f=n(this.#e,h.historyWindow,this.#a),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(h,y){const m=u(y);if(m===null)return;if(!this.#n.has(h)){this.#p=null,this.#m=null,this.#g(),this.#t.set(h,m),this.#n.set(h,m),this.#r.set(h,0),this.#s.set(h,this.#u()),this.#i.set(h,[m]),this.#f&&this.#d.set(h,[m]),this.#o.set(h,0);return}const v=this.#n.get(h);if(v===m)return;this.#p=null,this.#m=null,this.#n.set(h,m),this.#r.set(h,(this.#r.get(h)||0)+1),this.#s.set(h,this.#u());const d=this.#i.get(h)||[];d.push(m),d.length>this.#a&&d.splice(0,d.length-this.#a),this.#i.set(h,d);const p=Math.sign(m-v),g=this.#o.get(h)||0;this.#o.set(h,Math.sign(g)===p?g+p:p)}#g(){if(this.#n.size<this.#c)return;const h=this.#n.keys().next().value;h!==void 0&&(this.#t.delete(h),this.#n.delete(h),this.#r.delete(h),this.#s.delete(h),this.#i.delete(h),this.#d.delete(h),this.#o.delete(h),this.#l++)}rebase(){for(const[h,y]of this.#n)this.#t.set(h,y);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#s.clear(),this.#i.clear(),this.#d.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(h){const y=h instanceof Set?h:new Set(h);let m=0;for(const v of[...this.#n.keys()])y.has(v)||(this.#t.delete(v),this.#n.delete(v),this.#r.delete(v),this.#s.delete(v),this.#i.delete(v),this.#d.delete(v),this.#o.delete(v),m++);return m&&(this.#p=null,this.#m=null),m}advanceHistoryWindow(h=this.#u()){const y=this.#f;if(!y)return 0;const m=Math.floor(h/y.bucketMs),v=m-this.#h;if(!(v>0))return 0;const d=Math.min(v,this.#a);for(const[p,g]of this.#d){const k=this.#n.get(p);for(let w=0;w<d;w++)g.push(k);g.length>this.#a&&g.splice(0,g.length-this.#a)}return this.#h=m,v}read(h,y,m,v){switch(h){case"updates":return this.#r.has(y)?this.#r.get(y):0;case"updatedAt":{const d=this.#s.get(y);return d===void 0?null:new Date(d)}case"sinceUpdate":{const d=this.#s.get(y);return d===void 0?null:this.#u()-d}case"firstValue":return this.#t.has(y)?this.#t.get(y):null;case"delta":return this.#n.has(y)?this.#n.get(y)-this.#t.get(y):null;case"deltaPercent":{if(!this.#n.has(y))return null;const d=this.#t.get(y);return d?(this.#n.get(y)-d)/Math.abs(d)*100:null}case"rate":{const d=this.#i.get(y),p=this.#s.get(y);if(!d||d.length<2||p===void 0)return null;const g=this.#u()-p,k=d[d.length-1]-d[d.length-2];return g>0?k/g*1e3:k}case"history":return this.#f?this.#d.has(y)?[...this.#d.get(y)]:null:this.#i.has(y)?[...this.#i.get(y)]:null;case"streak":return this.#o.has(y)?this.#o.get(y):0;case"specStatus":return this.#n.has(y)?o(this.#n.get(y),v):null;default:return c.includes(h)?this.#j(h,y,m,v):null}}#b(h){if(h){if(this.#m&&this.#m.only===h)return this.#m.view;const y=this.#y(h);return this.#m={only:h,view:y},y}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(h){const y=[];for(const[x,_]of this.#n)h&&!h.has(x)||y.push(_);const m=y.sort((x,_)=>x-_);let v=0,d=0,p=0,g=0;for(const x of m){g+=x,v++;const _=x-d;d+=_/v,p+=_*(x-d)}const k=[];for(const[x,_]of this.#t)h&&!h.has(x)||k.push(_);const w=v?i(m):0,E=m.map(x=>Math.abs(x-w)).sort((x,_)=>x-_),N=v?i(E):0;return{sorted:m,baseline:k.sort((x,_)=>x-_),sum:g,mean:v?d:0,sd:v>1?Math.sqrt(p/(v-1)):0,median:w,mad:N}}#j(h,y,m,v){if(!this.#n.has(y)||m&&!m.has(y))return null;const d=this.#n.get(y),p=this.#b(m),g=p.sorted.length;if(!g)return null;switch(h){case"rank":return g-r(p.sorted,d)+1;case"rankAsc":return s(p.sorted,d)+1;case"rankChange":{if(!this.#t.has(y)||!p.baseline.length)return null;const k=p.baseline.length-r(p.baseline,this.#t.get(y))+1,w=g-r(p.sorted,d)+1;return k-w}case"percentile":return r(p.sorted,d)/g*100;case"quartile":{const k=r(p.sorted,d)/g;return Math.min(4,Math.max(1,Math.ceil(k*4)))}case"zScore":return p.sd?(d-p.mean)/p.sd:null;case"anomalyScore":return p.mad?S*(d-p.median)/p.mad:null;case"anomalyFlag":{if(!p.mad)return null;const k=v&&Number.isFinite(Number(v.threshold))?Number(v.threshold):O;return Math.abs(S*(d-p.median)/p.mad)>k}case"shareOfTotal":return p.sum?d/p.sum*100:null;default:return null}}}function i(l){const h=l.length;if(!h)return 0;const y=(h-1)*.5,m=Math.floor(y),v=Math.ceil(y);return m===v?l[m]:l[m]+(y-m)*(l[v]-l[m])}function s(l,h){let y=0,m=l.length;for(;y<m;){const v=y+m>>1;l[v]<h?y=v+1:m=v}return y}function r(l,h){let y=0,m=l.length;for(;y<m;){const v=y+m>>1;l[v]<=h?y=v+1:m=v}return y}function u(l){if(l==null||l==="")return null;if(l instanceof Date){const y=l.getTime();return Number.isFinite(y)?y:null}const h=typeof l=="number"?l:Number(l);return Number.isFinite(h)?h:null}function a(l){const h=[];for(const y of l||[]){const m=y.shadow;if(!m)continue;const v=typeof m=="string"?{kind:m}:m,d=v.kind;I.includes(d)&&(G.includes(d)||H.includes(d)||h.push({colId:y.id||y.field,of:v.of||y.field||y.id,kind:d,depth:v.depth,historyWindow:d==="history"?v.window:void 0}))}return h}}),De("packages/core/src/columns/model.js",function(e,U){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return ve}});const te=U("packages/core/src/internal/merge.js"),M=te.expand,X=te.merge,B=te.toArray,D=U("packages/core/src/internal/warn.js"),Z=D.fail,K=D.warnOnce,I=U("packages/core/src/internal/paths.js"),G=I.getPath,H=I.pathGetter,S=I.pathSetter,b=U("packages/core/src/internal/text.js").humanise,c=U("packages/core/src/internal/predicates.js"),f=c.isFunction,o=c.isObject,t=U("packages/core/src/internal/uid.js").uid,s=U("packages/core/src/format/index.js").compileFormat,r=U("packages/core/src/columns/datatypes.js"),u=r.comparatorFor,a=r.createTypeRegistry,l=r.storageKind,h=U("packages/core/src/columns/infer.js"),y=h.inferColumnType,m=h.DEFAULT_SAMPLE,v=U("packages/core/src/columns/graph.js"),d=v.buildGraph,p=v.affectedBy,k=U("packages/core/src/columns/lookup.js").createLookup,w=U("packages/core/src/columns/value.js"),E=w.compileDisplay,N=w.ValuePipeline,x=w.warnImpureUse,F=U("packages/core/src/model/shadow.js").FIT_SHADOW_KINDS,L=Object.freeze({geometry:"geometry",list:"list"}),j={value:{pure:!0},cell:{},edit:{enabled:!1},sort:{enabled:!0,direction:null,order:0,nullsFirst:!1},filter:{enabled:!0,type:"text"},group:{enabled:!1,index:-1,explode:!1},pivot:{enabled:!1,index:-1},total:null,layout:{width:150,min:40,max:null,flex:0,pin:null,hidden:!1,resizable:!0,movable:!0,lockVisible:!1,lockPosition:!1},header:{},facet:{},export:{lookup:"label",csv:!0,excel:!0},allowGroup:!0,allowPivot:!0,allowTotal:!0,nullable:!0,quickFilter:!0},R={centre:"center"},$=new Set(["start","center","end","left","right"]);function T(Le){if(typeof Le!="string")return;const se=Le.toLowerCase();return R[se]?R[se]:$.has(se)?se:void 0}function A(Le){if(typeof Le!="string")return;const se=Le.toLowerCase();return se==="center"||se==="centre"?"middle":se==="top"||se==="middle"||se==="bottom"?se:void 0}const C=["cell","layout","header"];function z(Le){if(!o(Le))return{};const se={...Le},pe=(be,ke)=>{if(Le[be]===void 0)return;const je=M(Le[be],ke);je&&C.includes(be)&&!o(Le[be])&&delete je.enabled,se[be]=je};return pe("sort","direction"),pe("filter","type"),pe("cell","render"),pe("edit","editor"),pe("layout","width"),pe("group","index"),pe("pivot","index"),pe("header","render"),pe("facet","strategy"),se}function Y(Le,se){const pe={...Le||{}},be=o(se)&&o(se.layout)&&se.layout.width!==void 0;return pe.fit==="content"&&!be&&delete pe.width,pe}const q=new Set(["allowGroup","allowPivot","allowTotal","cell","colSpan","contextMenu","diff","edit","export","facet","field","filter","filterRow","format","grandTotal","group","groupTotal","header","headerControls","id","layout","lookup","nullable","pivot","preset","quickFilter","rowSpan","running","shadow","showWhen","sort","spec","tags","title","total","type","typeOptions","validation","value","verticalAlign"]),V=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function J(Le,se,pe,be){const ke=pe==="columnGroup"?"column group":"column";for(const je of Object.keys(Le))if(!se.has(je)){if(je==="timeZone"&&pe==="column"){K("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${be}". A date column stores, displays, sorts and filters in the grid-level \`timeZone\` (else the viewer's); set \`timeZone\` on the grid, not the column.`);continue}K(`${pe}.unknown:${je}`,`'${je}' is not a configuration key this grid recognises, so it had no effect on ${ke} "${be}". Check the spelling against the reference.`)}}function ee(Le){o(Le.cell)&&Le.cell.autoHeight!==void 0&&K("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${Le.id||Le.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function ne(Le,se){const pe=se&&f(Le.defaultsFor)?Le.defaultsFor(se):null,be={...Le.defaults||{},...o(pe)?pe:{}},ke={};return be.align&&(ke.align=be.align,ke.cell={align:be.align},ke.header={align:be.align}),be.filter&&(ke.filter=be.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:be.filter}),be.editor&&(ke.edit=be.editor==="none"?{editor:null}:{editor:be.editor}),be.total&&(ke.total=be.total),be.render&&(ke.cell={...ke.cell||{},render:be.render}),Le.export&&(ke.export={...Le.export}),ke}function oe(Le){if(typeof Le=="string")return Le.trim()?[Le.trim()]:[];if(!Array.isArray(Le))return[];const se=[];for(const pe of Le){if(typeof pe!="string")continue;const be=pe.trim();be&&!se.includes(be)&&se.push(be)}return se}class re{#e=new Map;#t=[];#n=[];#r=new WeakMap;#s;#i;#o;#l;#a;#c;#u(se,pe,be){const ke=this.#f(se,pe,be);if(typeof ke!="string"||!this.#d)return ke??null;const je=pe&&pe.totals&&pe.totals.implement;if(je&&f(je[ke])){const ge=je[ke];return ge.totalName=ke,ge}const xe=this.#d.totalFn?.(ke);return f(xe)?xe:ke}#f(se,pe,be){if(typeof se!="string")return se;const ke=pe&&pe.totals&&pe.totals.supported;if(!Array.isArray(ke)||ke.includes(se))return se;const je=ke.length?ke.join(", "):"none";return Z(`column "${be}" is typed ${pe.name||"a type"}, for which the total "${se}" is not meaningful. Supported: ${je}. Aggregating it anyway would produce a confident wrong number.`),se}#d;#h;#p;#m;#g;#b;#y=!1;#j;#w;constructor(se={}){this.#i=z(se.columnDefaults||{}),this.#o=se.columnPresets||{},this.#a=se.locale,this.#l=se.timeZone,this.#c=A(se.verticalAlign),this.#d=se.registry||null,this.#h=se.grid||null,this.#p=se.context,this.#j=se.sampleSize??m,this.#w=se.onChange||null,this.#b=f(se.rowKey)?se.rowKey:void 0,this.#s=a(se.dataTypes,this.#d);const{leaves:pe,groups:be}=ve(se.columns||[]);this.#n=be;for(const ke of pe){ke.facet!==void 0&&this.#r.set(ke.def,ke.facet);const je=this.#O(ke.def,null);if(je.groupPath=ke.path,this.#e.has(je.id)){K(`columns.duplicate:${je.id}`,`two columns resolve to the id '${je.id}', so the second is ignored. An id defaults to the column's field, so declare an explicit \`id\` when two columns read the same field.`);continue}ke.column=je,this.#e.set(je.id,je),this.#t.push(je.id)}this.#E(se.stored||null)}#O(se,pe){J(se,q,"column",se.id||se.field||"(unnamed)"),ee(se);const be=z(se),ke=B(se.preset),je=ke.map(Ke=>{const Xe=this.#o[Ke];return Xe?z(Xe):(K(`preset:${Ke}`,`unknown column preset "${Ke}"; ignoring`),{})}),xe=this.#S(be,je,pe),ge=this.#s.get(xe)||this.#s.get("text");if(!this.#s.has(xe)&&se.type){const Ke=L[xe];K(`type:${xe}`,`unknown data type "${xe}"; falling back to "text"`+(Ke?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${Ke}'.`:""))}const we=f(ge.items)?this.#T(be,je,se.id||se.field||"(unnamed)"):null;let Me=j;Me=X(Me,this.#i),se.type!==!1&&(Me=X(Me,ne(ge,we)));for(const Ke of je)Me=X(Me,Ke);this.#r.has(se)&&(Me=X(Me,z({facet:this.#r.get(se)}))),Me=X(Me,be);const Ye=Me.edit;Ye&&Ye.editor&&Ye.enabled!==!0&&!f(Ye.enabled)&&(se.edit||{}).editor&&K(`column.editor-not-enabled:${se.id||se.field}`,`column '${se.id||se.field}' names the editor '${Ye.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const Ae=se.id||se.field||t("col");if(se.shadow&&!f(Me.value&&Me.value.compute)){const Ke=typeof se.shadow=="string"?{kind:se.shadow}:se.shadow,Xe=Ke.of||se.field||Ae,nt=F.includes(Ke.kind),st=nt?Ke.model||Ke:null,wt=nt&&st?[...Array.isArray(st.predictors)?st.predictors:[],st.response].filter(Boolean):null;Me.value={...Me.value||{},deps:wt&&wt.length?wt:Ke.orderBy&&Ke.orderBy!==Xe?[Xe,Ke.orderBy]:[Xe],pure:!1,compute:(pt,St)=>{const Ct=St.grid&&St.grid.statistics;if(!Ct)return null;const Mt=St.row&&St.row.key||Ct.keyOf(St.data);if(!Mt)return null;if(nt){if(!f(Ct.fitShadow))return null;const at=Ke.model?{...Ke.model,threshold:Ke.threshold}:Ke;return Ct.fitShadow(Ke.kind,Mt,at)}return Ct.shadow(Xe,Ke.kind,Mt,Ke.scope,Ke)}}}if(se.running&&!f(Me.value&&Me.value.compute)){const Ke=typeof se.running=="string"?{kind:se.running}:se.running,Xe=Ke.of||se.field||Ae;Me.value={...Me.value||{},deps:[Xe],pure:!1,compute:(nt,st)=>{const wt=st.grid&&st.grid.statistics;if(!wt||!f(wt.running))return null;const pt=st.row&&st.row.key||wt.keyOf(st.data);return pt?wt.running(Xe,Ke.kind||"total",pt):null}},se.sort===void 0&&(Me.sort={...Me.sort||{},enabled:!1})}const Ve=se.field??(f(Me.value&&Me.value.compute)?null:se.id??null),Pe=f(Me.value&&Me.value.compute),Oe={id:Ae,field:Ve,shadow:se.shadow||null,running:se.running||null,spec:se.spec||null,validation:se.validation||null,volatile:!!(se.shadow||se.running),title:Me.title??b(Ve||Ae),type:ge.name,dataType:ge,itemType:we,nullable:Me.nullable!==!1,align:T(be.cell&&be.cell.align||be.align||Me.cell&&Me.cell.align||Me.align||ge.defaults&&ge.defaults.align)||"start",verticalAlign:A(be.cell&&be.cell.verticalAlign||be.verticalAlign||Me.cell&&Me.cell.verticalAlign||Me.verticalAlign)||this.#c,rowSpan:f(Me.rowSpan)?Me.rowSpan:null,colSpan:f(Me.colSpan)?Me.colSpan:null,value:{pure:!0,...Me.value||{}},cell:{...Me.cell||{}},edit:{...Me.edit||{}},sort:{...Me.sort||{}},filter:{...Me.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Me.group||{}},pivot:{enabled:!1,index:-1,...Me.pivot||{}},total:this.#u(Me.total,ge,se.id||se.field||"(unnamed)"),groupTotal:Me.groupTotal===void 0?null:this.#u(Me.groupTotal,ge,se.id||se.field||"(unnamed)"),grandTotal:Me.grandTotal===void 0?null:this.#u(Me.grandTotal,ge,se.id||se.field||"(unnamed)"),tags:oe(Me.tags),typeOptions:Me.typeOptions??null,...o(Me[xe])?{[xe]:Me[xe]}:{},layout:Y(Me.layout,be),header:{...Me.header||{}},contextMenu:Me.contextMenu===void 0?null:Me.contextMenu,facet:{...Me.facet||{}},export:{...Me.export||{}},allowGroup:Me.allowGroup!==!1,allowPivot:Me.allowPivot!==!1,allowTotal:Me.allowTotal!==!1,quickFilter:Me.quickFilter!==!1,def:se,format:Me.format,presets:ke,inferred:pe!=null&&!se.type,computed:Pe,diff:se.diff===void 0?void 0:!!se.diff,read:Ve?H(Ve):null,write:Ve?S(Ve):null};Oe.cell.align=T(be.cell&&be.cell.align)||Oe.align,Oe.header.align=T(be.header&&be.header.align)||Oe.align;const He=Me.lookup||null;return Oe.lookup=He?k({id:Ae,lookup:He},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:Ae})}}):null,Oe.group.explode&&Oe.lookup&&Oe.lookup.multiple&&K(`explode:${Ae}`,`column "${Ae}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Oe),Oe}#v(se){se.formatter=s(se.format,se.dataType,this.#a,this.#l,se.id),se.formatValue=E(se,{locale:this.#a,grid:this.#h,context:this.#p}),se.itemCompare=se.itemType?u(se.itemType,this.#a):null,se.compare=f(se.value.compare)?se.value.compare:se.lookup?se.lookup.comparator():f(se.dataType.compareFor)?se.dataType.compareFor(se):u(se.dataType,this.#a),se.excel=se.formatter&&se.formatter.ooxml||se.dataType&&se.dataType.excel||"General",se.storeKind=l(se.dataType,!!(se.lookup&&se.lookup.multiple))}#T(se,pe,be){let ke=o(se.typeOptions)?se.typeOptions:null;for(let we=pe.length-1;!ke&&we>=0;we--)o(pe[we].typeOptions)&&(ke=pe[we].typeOptions);!ke&&o(this.#i.typeOptions)&&(ke=this.#i.typeOptions);const je=ke&&ke.of!==void 0?ke.of:"text",xe=typeof je=="string"?this.#s.get(je):void 0;return xe&&!f(xe.items)&&xe.storage!=="object"?xe:(K(`type:of:${String(je)}`,`column "${be}" names "${String(je)}" as its item type (typeOptions.of), which is not ${xe?"a scalar data type":"a known data type"}; its items are read as text.`),this.#s.get("text"))}#S(se,pe,be){if(se.type===!1)return"text";if(se.type)return se.type;for(let ke=pe.length-1;ke>=0;ke--)if(pe[ke].type)return pe[ke].type;if(this.#i.type)return this.#i.type;if(se.shadow){const ke=typeof se.shadow=="string"?se.shadow:se.shadow.kind;if(ke==="fitInfluence")return"boolean";if(ke==="fitPredicted"||ke==="fitResidual"||ke==="fitStdResidual"||ke==="fitLeverage"||ke==="fitCooksD"||ke==="tsTrend"||ke==="tsSeasonal"||ke==="tsResidual"||ke==="tsCoverage"||ke==="tsSmoothed"||ke==="tsSmoothingAlpha"||ke==="tsSmoothingBeta")return"number"}return be||(se.lookup?"lookup":"text")}#E(se){const pe=this.all();this.#m=d(pe),this.#g?this.#g.setGraph(this.#m):this.#g=new N({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:se||null,rowKey:this.#b});const be=this.#g;for(const ke of pe)ke.getValue=(je,xe)=>be.value(ke,je,xe)}all(){return this.#t.map(se=>this.#e.get(se))}visible(){return this.all().filter(se=>!se.layout.hidden)}get(se){return this.#e.get(se)}groups(){const se=pe=>{const be=[];for(const ke of pe)Array.isArray(ke.columns)?be.push({...ke,columns:se(ke.columns)}):ke.column&&be.push(ke.column);return be};return se(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#s}affectedBy(se){return p(this.#m,se)}value(se,pe,be){return this.#g.value(se,pe,be)}text(se,pe,be){return this.#g.text(se,pe,be)}checkImpure(se,pe){x(this.#e.get(se),pe)}setLocale(se){this.#a=se;for(const pe of this.all())pe.lookup&&pe.lookup.setLocale(se),this.#v(pe);this.#w&&this.#w("locale",{locale:se})}infer(se){const pe={};if(this.#y||!Array.isArray(se)||se.length===0)return pe;this.#y=!0;let be=!1;for(const ke of this.all()){const je=ke.def;if(je.type!==void 0||!ke.field||ke.computed||ke.lookup||this.#N(ke))continue;const xe=ke.read||(Me=>G(Me,ke.field)),ge=y(ke.id,se,xe,this.#s,{sampleSize:this.#j});if(ge===ke.type)continue;pe[ke.id]=ge;const we=this.#O(je,ge);we.groupPath=ke.groupPath,we.layout={...we.layout,...ae(ke.layout)},this.#e.set(ke.id,we),Ie(this.#n,ke.id,we),be=!0}return be&&this.#E(null),pe}redecorate(se,pe,be={}){const ke=this.#e.get(se);if(!ke){K(`redecorate:${se}`,`columns.decorate('${se}', …): no column with id '${se}'.`);return}const je=ke.def||{},xe={...o(je.cell)?je.cell:{}};xe.decoration=pe??void 0,be&&"variant"in be&&(xe.variant=be.variant);const ge={...je,cell:xe};this.#r.has(je)&&this.#r.set(ge,this.#r.get(je));const we=this.#O(ge,ke.type);return we.groupPath=ke.groupPath,we.layout={...we.layout,...ae(ke.layout)},ke.lookup&&ke.lookup!==we.lookup&&f(ke.lookup.destroy)&&ke.lookup.destroy(),this.#e.set(se,we),Ie(this.#n,se,we),this.#E(null),this.#w&&this.#w("decorate",{colId:se}),we}destroy(){for(const se of this.#e.values())se.lookup&&f(se.lookup.destroy)&&se.lookup.destroy()}#N(se){for(const pe of se.presets){const be=this.#o[pe];if(be&&be.type)return!0}return!!this.#i.type}#P(se){return!se.computed&&f(se.dataType&&se.dataType.toStorage)}storeReader(se){if(se.computed)return pe=>this.#g.value(se,pe,null);if(this.#P(se)){const pe=se.dataType.toStorage,be={timeZone:this.#l,colId:se.id,itemType:se.itemType||null};return ke=>pe(se.read(ke),be)}return se.read}storeValue(se,pe){if(!(!se||se.computed)&&f(se.read))return this.storeReader(se)(pe)}storeSchema(){const se=[];for(const pe of this.all()){if(pe.computed&&pe.value.pure===!1||!pe.computed&&!pe.field)continue;const be=this.storeReader(pe);let ke=null;!pe.computed&&!this.#P(pe)&&typeof pe.field=="string"&&!pe.lookup&&(ke=pe.field);const je={id:pe.id,kind:pe.storeKind,nullable:pe.nullable,read:be};ke!==null&&(je.field=ke),pe.lookup&&(je.dictionary=pe.lookup.dictionary()),se.push(je)}return se}state(){return this.all().map(se=>({id:se.id,width:se.layout.width,flex:se.layout.flex||void 0,hidden:!!se.layout.hidden,headerWrap:se.header?.wrap===!0?!0:void 0,headerOrientation:se.header?.orientation==="vertical"?"vertical":void 0,pin:se.layout.pin??null,sort:se.sort.direction??null,sortIndex:se.sort.direction?se.sort.order??0:null,groupIndex:se.group.enabled?se.group.index??0:null,pivotIndex:se.pivot.enabled?se.pivot.index??0:null,total:typeof se.total=="string"?se.total:null,groupTotal:typeof se.groupTotal=="string"?se.groupTotal:void 0,grandTotal:typeof se.grandTotal=="string"?se.grandTotal:void 0,decoration:se.cell&&se.cell.decoration!=null?fe(se.cell.decoration):void 0,variant:se.cell&&se.cell.variant!=null?fe(se.cell.variant):void 0}))}applyState(se,pe={}){const be={applied:[],skipped:[]},ke=Array.isArray(se)?se:se&&se.columns||[],je=!Array.isArray(se)&&se&&se.columnOrder||null;for(const ge of ke){if(!ge||!ge.id){be.skipped.push({key:"?",reason:"no id"});continue}let we=this.#e.get(ge.id);if(!we){be.skipped.push({key:ge.id,reason:"unknown column"});continue}if(Object.hasOwn(ge,"decoration")||Object.hasOwn(ge,"variant")){const Me=we.cell?we.cell.decoration:void 0,Ye=ge.decoration??null,Ae=Object.hasOwn(ge,"variant"),Ve=Ae&&!de(we.cell?we.cell.variant:void 0,ge.variant);(!de(Me,Ye)||Ve)&&(this.redecorate(ge.id,Ye,Ae?{variant:ge.variant??void 0}:{}),we=this.#e.get(ge.id)||we)}ge.width!=null&&(we.layout.width=ge.width),ge.flex!=null&&(we.layout.flex=ge.flex),ge.hidden!=null&&(we.layout.hidden=!!ge.hidden),ge.headerWrap!==void 0&&(we.header.wrap=!!ge.headerWrap),ge.headerOrientation!==void 0&&(we.header.orientation=ge.headerOrientation==="vertical"?"vertical":"horizontal"),ge.pin!==void 0&&(we.layout.pin=ge.pin),ge.sort!==void 0&&(we.sort.direction=ge.sort),ge.sortIndex!=null&&(we.sort.order=ge.sortIndex),ge.groupIndex!=null&&(we.group.enabled=!0,we.group.index=ge.groupIndex),ge.pivotIndex!=null&&(we.pivot.enabled=!0,we.pivot.index=ge.pivotIndex),ge.total!==void 0&&(we.total=ge.total),ge.groupTotal!==void 0&&(we.groupTotal=ge.groupTotal),ge.grandTotal!==void 0&&(we.grandTotal=ge.grandTotal),be.applied.push(ge.id)}const xe=je||(pe&&pe.keepOrder?[]:ke.map(ge=>ge&&ge.id).filter(Boolean));if(xe.length){const ge=xe.filter(Me=>this.#e.has(Me)),we=this.#t.filter(Me=>!ge.includes(Me));this.#t=[...ge,...we]}return this.#w&&this.#w("state",be),be}move(se,pe){this.#M(se,pe)&&(this.#L(),this.#w&&this.#w("move",{id:se,to:pe}))}reorder(se){const pe={applied:[],skipped:[]},be=[];let ke=0;for(const je of Array.isArray(se)?se:[]){const xe=ke++;this.#M(je,xe)&&(pe.applied.push(je),be.push({id:je,to:xe}))}if(!be.length)return pe;if(this.#L(),this.#w)for(const je of be)this.#w("move",je);return pe}#M(se,pe){const be=this.#t.indexOf(se);if(be===-1||Math.max(0,Math.min(Number(pe)||0,this.#t.length-1))===be)return!1;const je=this.#e.get(se);if(je.layout.movable===!1||je.layout.lockPosition)return K(`move:${se}`,`column "${se}" is not movable; the move was ignored`),!1;const xe=this.#R(se,pe);return xe?(K(`move.married:${xe}`,`band "${xe}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(be,1),this.#t.splice(Math.max(0,Math.min(pe,this.#t.length)),0,se),!0)}#R(se,pe){if(!this.#n||!this.#n.length)return null;const be=this.#t.filter(ge=>ge!==se),ke=Math.max(0,Math.min(pe,be.length)),je=(ge,we)=>{if(Array.isArray(ge.columns)){for(const Ye of ge.columns)je(Ye,we);return we}const Me=ge.column?ge.column.id:ge.id;return Me&&we.push(Me),we},xe=ge=>{for(const we of ge){if(!Array.isArray(we.columns))continue;if(we.marryChildren===!0){const Ye=je(we,[]),Ae=Ye.includes(se),Ve=Ye.map(Pe=>be.indexOf(Pe)).filter(Pe=>Pe>=0);if(Ve.length){const Pe=Math.min(...Ve),Oe=Math.max(...Ve);if(Ae?ke<Pe||ke>Oe+1:ke>Pe&&ke<=Oe)return we.id}}const Me=xe(we.columns);if(Me)return Me}return null};return xe(this.#n)}#L(){const se=new Map(this.#t.map((ke,je)=>[ke,je])),pe=ke=>{if(!Array.isArray(ke.columns)){const xe=ke.column?ke.column.id:ke.id;return se.has(xe)?se.get(xe):1/0}let je=1/0;for(const xe of ke.columns)je=Math.min(je,pe(xe));return je},be=ke=>{ke.sort((je,xe)=>pe(je)-pe(xe));for(const je of ke)Array.isArray(je.columns)&&be(je.columns)};be(this.#n)}#G(se){const pe=be=>{for(let ke=0;ke<be.length;ke++){const je=be[ke];if(Array.isArray(je.columns)){const xe=pe(je.columns);if(xe)return xe}else if(je.column&&je.column.id===se)return be.splice(ke,1)[0]}return null};return pe(this.#n)}#_(se){const pe=[];for(let be=se.length-1;be>=0;be--){const ke=se[be];Array.isArray(ke.columns)&&(pe.push(...this.#_(ke.columns)),ke.columns.length===0&&(pe.push(ke.id),se.splice(be,1)))}return pe}#x(){const se=(pe,be,ke)=>{for(const je of pe)Array.isArray(je.columns)?se(je.columns,[...be,je.id]):je.column&&(je.column.groupPath=be)};se(this.#n,[])}#I(se){const pe=new Set(se),be=this.#t.filter(ge=>pe.has(ge));if(!be.length)return;const ke=Math.min(...be.map(ge=>this.#t.indexOf(ge))),je=this.#t.slice(0,ke).filter(ge=>!pe.has(ge)),xe=this.#t.slice(ke).filter(ge=>!pe.has(ge));this.#t=[...je,...be,...xe]}#Y(se){const pe=[],be=ke=>{if(Array.isArray(ke.columns))for(const je of ke.columns)be(je);else ke.column&&pe.push(ke.column.id)};return be(se),pe}#D(se){const pe=be=>{for(const ke of be){if(!Array.isArray(ke.columns))continue;if(ke.id===se)return{node:ke,parent:be};const je=pe(ke.columns);if(je)return je}return null};return pe(this.#n)}groupColumns(se,pe={}){const be=B(se).filter(we=>this.#e.has(we));if(!be.length)return K("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const we of be)if(this.#e.get(we).layout.lockPosition)return K(`columns.group.locked:${we}`,`column "${we}" is position-locked and cannot be grouped.`),null;const ke=pe.groupId?this.#D(pe.groupId):null;if(pe.groupId&&!ke)return K(`columns.group.unknown:${pe.groupId}`,`no band "${pe.groupId}" to add to; nothing was grouped.`),null;let je=null;if(!ke&&pe.id!=null&&(je=String(pe.id),this.#D(je)||this.#e.has(je)))return K(`columns.group.idtaken:${je}`,`band id "${je}" is already in use; nothing was grouped.`),null;const xe=be.map(we=>this.#G(we)).filter(Boolean);if(!xe.length)return null;let ge;if(ke)ke.node.columns.push(...xe),ge=ke.node.id;else{const we={id:je||t("grp"),title:pe.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:xe},Me=Number.isInteger(pe.at)?Math.max(0,Math.min(pe.at,this.#n.length)):this.#n.length;this.#n.splice(Me,0,we),ge=we.id}return this.#_(this.#n),this.#I(be),this.#x(),this.#L(),this.#w&&this.#w("columngroup",{action:"formed",groupId:ge,ids:be}),ge}ungroupColumn(se){const pe=this.#e.get(se);if(!pe){K(`columns.ungroup.unknown:${se}`,`no column "${se}" to ungroup.`);return}const be=pe.groupPath||[];if(!be.length)return;const ke=be[be.length-1],je=this.#D(ke);if(!je)return;const xe=this.#G(se);if(!xe)return;const ge=je.parent.indexOf(je.node);je.parent.splice(ge+1,0,xe);const we=this.#_(this.#n),Me=this.#Y(je.node);if(Me.length){this.#I(Me);const Ye=Math.max(...Me.map(Ve=>this.#t.indexOf(Ve))),Ae=this.#t.filter(Ve=>Ve!==se);Ae.splice(Ye+1,0,se),this.#t=Ae}this.#x(),this.#L(),this.#w&&this.#w("columngroup",{action:"removed",id:se,dissolved:we})}renameGroup(se,pe){const be=this.#D(se);if(!be){K(`columns.group.rename:${se}`,`no band "${se}" to rename.`);return}be.node.title=String(pe??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:se,title:be.node.title})}dissolveGroup(se){const pe=this.#D(se);if(!pe){K(`columns.group.dissolve:${se}`,`no band "${se}" to dissolve.`);return}const be=pe.parent.indexOf(pe.node);pe.parent.splice(be,1,...pe.node.columns),this.#x(),this.#L(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:se})}moveGroup(se,pe){const be=this.#D(se);if(!be){K(`columns.group.move:${se}`,`no band "${se}" to move.`);return}const ke=be.parent,je=ke.indexOf(be.node);je!==-1&&(ke.splice(je,1),ke.splice(Math.max(0,Math.min(pe,ke.length)),0,be.node),this.#K(),this.#x(),this.#w&&this.#w("columngroup",{action:"moved",groupId:se,to:pe}))}#K(){const se=[],pe=ke=>{for(const je of ke)Array.isArray(je.columns)?pe(je.columns):je.column&&se.push(je.column.id)};pe(this.#n);const be=new Set(se);this.#t=[...se,...this.#t.filter(ke=>!be.has(ke))]}groupTree(){const se=be=>be.map(ke=>Array.isArray(ke.columns)?{id:ke.id,title:ke.title||"",collapsible:!!ke.collapsible,openByDefault:ke.openByDefault!==!1,columns:se(ke.columns)}:ke.column?ke.column.id:null).filter(ke=>ke!==null),pe=se(this.#n);return pe.some(be=>be&&typeof be=="object")?pe:[]}applyGroupTree(se){if(!Array.isArray(se))return;const pe=new Set,be=je=>{const xe=[];for(const ge of je)if(ge&&typeof ge=="object"&&Array.isArray(ge.columns)){const we=be(ge.columns);if(!we.length)continue;xe.push({id:ge.id||t("grp"),title:ge.title||"",collapsible:ge.collapsible===!0,openByDefault:ge.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:we})}else if(typeof ge=="string"){const we=this.#e.get(ge);we&&!pe.has(ge)&&(pe.add(ge),xe.push({column:we,path:[]}))}return xe},ke=be(se);for(const je of this.#t){if(pe.has(je))continue;const xe=this.#e.get(je);xe&&ke.push({column:xe,path:[]})}this.#n=ke,this.#x(),this.#L(),this.#w&&this.#w("columngroup",{action:"applied"})}show(se){this.#H(se,!1)}hide(se){this.#H(se,!0)}#H(se,pe){const be=[];for(const ke of B(se)){const je=this.#e.get(ke);if(je){if(pe&&je.layout.lockVisible){K(`lockVisible:${ke}`,`column "${ke}" is \`layout.lockVisible\` and cannot be hidden`);continue}je.layout.hidden!==pe&&(je.layout.hidden=pe,be.push(ke))}}be.length&&this.#w&&this.#w("visible",{ids:be,hidden:pe})}pin(se,pe){const be=this.#e.get(se);be&&(be.layout.pin=pe??null,this.#w&&this.#w("pin",{id:se,side:be.layout.pin}))}pinMany(se){const pe={};for(const[ke,je]of se){const xe=this.#e.get(ke);xe&&(xe.layout.pin=je??null,pe[ke]=xe.layout.pin)}const be=Object.keys(pe);be.length&&this.#w&&this.#w("pin",{ids:be,pins:pe})}#B(se,pe){const be=se.layout.min??0,ke=se.layout.max;let je=Math.max(be,pe);return ke!=null&&(je=Math.min(ke,je)),se.layout.width=je,se.layout.flex=0,je}resize(se,pe){const be=this.#e.get(se);if(!be)return;if(be.layout.resizable===!1){K(`resize:${se}`,`column "${se}" is not resizable; the resize was ignored`);return}const ke=this.#B(be,pe);this.#w&&this.#w("resize",{id:se,width:ke})}resizeMany(se){const pe={};for(const[ke,je]of se){const xe=this.#e.get(ke);if(xe){if(xe.layout.resizable===!1){K(`resize:${ke}`,`column "${ke}" is not resizable; the resize was ignored`);continue}pe[ke]=this.#B(xe,je)}}const be=Object.keys(pe);be.length&&this.#w&&this.#w("resize",{ids:be,widths:pe})}}function ae(Le){const se={};return Le.width!=null&&(se.width=Le.width),Le.hidden!=null&&(se.hidden=Le.hidden),Le.pin!==void 0&&(se.pin=Le.pin),se}function fe(Le){if(Le===null||typeof Le!="object")return Le;try{return structuredClone(Le)}catch{}try{return JSON.parse(JSON.stringify(Le))}catch{return Le}}function de(Le,se){const pe=Le??null,be=se??null;if(pe===be)return!0;if(pe===null||be===null)return!1;if(typeof pe!="object"||typeof be!="object")return pe===be;try{return JSON.stringify(pe)===JSON.stringify(be)}catch{return!1}}function ve(Le){const se=[],pe=(ke,je,xe)=>{const ge=[];for(const we of ke){if(!o(we)){Z("a column definition must be an object");continue}if(Array.isArray(we.columns)){J(we,V,"columnGroup",we.title||we.id||"(unnamed)");const Me={id:we.id||t("grp"),title:we.title||"",collapsible:we.collapsible===!0,openByDefault:we.openByDefault!==!1,showWhen:we.showWhen||"always",marryChildren:we.marryChildren===!0,header:we.header||{},def:we,columns:[]};Me.columns=pe(we.columns,[...je,Me.id],we.facet!==void 0?we.facet:xe),ge.push(Me)}else{const Me={def:we,path:je,facet:xe};se.push(Me),ge.push(Me)}}return ge},be=pe(Le,[],void 0);return{leaves:se,groups:be}}function Ie(Le,se,pe){for(const be of Le){if(be.columns){if(Ie(be.columns,se,pe))return!0;continue}if(be.column&&be.column.id===se)return be.column=pe,!0}return!1}}),De("packages/core/src/columns/autogroup.js",function(e,U){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return K}});const M=U("packages/core/src/internal/warn.js").warnOnce,X="__lattice_group",B=240,D=.5;function Z(I){const{columns:G,groupBy:H}=I,S=H.map(c=>G.get(c)).filter(Boolean),O=S.length?S.map(c=>c.title||c.id).join(" > "):"Group",b=I.config&&I.config.autoGroupColumnWidth||B;return{id:X,field:null,title:O,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:H.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:b,min:120,pin:I.config&&I.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(c,f){return f&&f.group?f.groupValue:null},formatValue(c,f){if(!f||!f.group)return"";if(f.grandTotal)return I.config&&I.config.grandTotalLabel||"Total";const o=S[Math.min(f.level||0,S.length-1)];return o&&typeof o.formatValue=="function"?o.formatValue(c,f):c==null?"":String(c)}}}function K(I,G,H){!I.length||H<100||G<H*D||M(`grouping.cardinality:${I.join(",")}`,`grouping by ${I.join(", ")} produced ${G} groups for ${H} rows: nearly one group per row. Grouping a continuous value such as a percentage or a timestamp rarely reads usefully; consider a computed banding column.`)}}),De("packages/core/src/columns/selectcolumn.js",function(e,U){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return B}});const te="__lattice_select",M=44;function X(D){const Z=D.selection||{},K=D.config&&D.config.selectionColumnWidth||M;return{id:te,field:null,title:"",type:"boolean",dataType:{base:"boolean"},nullable:!1,align:"center",generated:!0,control:!0,value:{pure:!0},cell:{render:"checkbox",props:{mode:"selection"},align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:K,min:K,max:K,pin:D.config&&D.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Z.headerCheckbox===!0,def:{},getValue(I,G){return G?G.selected:!1},formatValue(){return""}}}const B=X}),De("packages/core/src/columns/rownumbercolumn.js",function(e,U){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return G}});const M=U("packages/core/src/internal/predicates.js").isFunction,X="__lattice_rownumber",B=40,D=9,Z=22;function K(H){const S=String(Math.max(1,Math.trunc(Math.abs(H))||1)).length;return Math.max(B,S*D+Z)}function I(H){const S=H.rowNumbers,O=S&&typeof S=="object"?S:{},b=Number.isFinite(O.start)?O.start:1,c=Number.isFinite(O.width)?O.width:K((H.maxNumber||0)+b),f=M(H.rank)?H.rank:()=>null;return{id:X,field:null,title:typeof O.title=="string"?O.title:"",type:"number",dataType:{base:"number"},nullable:!0,align:"end",generated:!0,control:!0,value:{pure:!0},cell:{align:"end"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:c,min:c,max:c,pin:"start",hidden:!1,resizable:O.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(o,n){const t=f(n);return t==null?null:t-1+b},formatValue(o){return o==null?"":String(o)}}}const G=I}),De("packages/core/src/model/detail.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return G}});const M=U("packages/core/src/internal/predicates.js").isFunction,B=U("packages/core/src/internal/warn.js").warnOnce,D=240,Z=10;function K(H){if(!H)return null;const S=H===!0?{}:H;return S.enabled===!1?null:!M(S.rows)&&!S.render?(B("detail.rows","detail is enabled but neither `rows` nor `render` was supplied; expanding a master would show an empty region, so it stays off."),null):{render:S.render||null,config:S.config||null,rows:M(S.rows)?S.rows:null,height:S.height??D,maxHeight:S.maxHeight??null,cacheLimit:Number.isFinite(S.cacheLimit)?Math.max(0,S.cacheLimit):Z,isMaster:M(S.isMaster)?S.isMaster:null,target:S.target||null,onCreate:M(S.onCreate)?S.onCreate:null,path:typeof S.path=="string"?S.path:null}}class I{#e;#t=new Set;#n;#r=0;constructor(S){this.#e=S.config,this.#n=M(S.onChange)?S.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(S){if(!S||S.group||S.detail)return!1;const O=this.#e.isMaster;return O?!!O(S.data,S):!0}isOpen(S){return this.#t.has(S)}keys(){return[...this.#t]}activeKey(){for(const S of this.#t)return S;return null}heightOf(S){const O=this.#e.height;return M(O)?Number(O(S))||D:O==="auto"?D:Number(O)||D}open(S){return this.#t.has(S)?!1:(this.inline||this.#t.clear(),this.#t.add(S),this.#s(),!0)}close(S){return this.#t.delete(S)?(this.#s(),!0):!1}toggle(S){return this.#t.has(S)?(this.close(S),!1):(this.open(S),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#s())}prune(S){if(!this.#t.size||!M(S))return;let O=!1;for(const b of[...this.#t])S(b)||(this.#t.delete(b),O=!0);O&&this.#s()}signature(){return`${this.#r}`}set(S){this.#t.clear();const O=Array.isArray(S)?S:[];for(const b of this.inline?O:O.slice(0,1))this.#t.add(b);this.#s()}#s(){this.#r++,this.#n()}}const G=I}),De("packages/core/src/compute/special.js",function(e,U){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return o}});const te=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),M=3e-12,X=1e-300;function B(n){if(n<.5)return Math.log(Math.PI/Math.sin(Math.PI*n))-B(1-n);const t=n-1;let i=.9999999999998099;const s=t+7.5;for(let r=0;r<te.length;r++)i+=te[r]/(t+r+1);return .5*Math.log(2*Math.PI)+(t+.5)*Math.log(s)-s+Math.log(i)}function D(n,t,i){const s=n+t,r=n+1,u=n-1;let a=1,l=1-s*i/r;Math.abs(l)<X&&(l=X),l=1/l;let h=l;for(let y=1;y<=300;y++){const m=2*y;let v=y*(t-y)*i/((u+m)*(n+m));l=1+v*l,Math.abs(l)<X&&(l=X),a=1+v/a,Math.abs(a)<X&&(a=X),l=1/l,h*=l*a,v=-(n+y)*(s+y)*i/((n+m)*(r+m)),l=1+v*l,Math.abs(l)<X&&(l=X),a=1+v/a,Math.abs(a)<X&&(a=X),l=1/l;const d=l*a;if(h*=d,Math.abs(d-1)<M)break}return h}function Z(n,t,i){if(!(n>0)||!(t>0)||!Number.isFinite(i))return Number.NaN;if(i<=0)return 0;if(i>=1)return 1;const s=Math.exp(B(n+t)-B(n)-B(t)+n*Math.log(i)+t*Math.log(1-i));return i<(n+1)/(n+t+2)?s*D(n,t,i)/n:1-s*D(t,n,1-i)/t}function K(n){if(!(n>0)||!(n<1))return n===0?-1/0:n===1?1/0:Number.NaN;const t=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],i=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],s=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],r=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],u=.02425;let a,l,h;n<u?(a=Math.sqrt(-2*Math.log(n)),h=(((((s[0]*a+s[1])*a+s[2])*a+s[3])*a+s[4])*a+s[5])/((((r[0]*a+r[1])*a+r[2])*a+r[3])*a+1)):n<=1-u?(a=n-.5,l=a*a,h=(((((t[0]*l+t[1])*l+t[2])*l+t[3])*l+t[4])*l+t[5])*a/(((((i[0]*l+i[1])*l+i[2])*l+i[3])*l+i[4])*l+1)):(a=Math.sqrt(-2*Math.log(1-n)),h=-(((((s[0]*a+s[1])*a+s[2])*a+s[3])*a+s[4])*a+s[5])/((((r[0]*a+r[1])*a+r[2])*a+r[3])*a+1));const m=(.5*I(-h/Math.SQRT2)-n)*Math.sqrt(2*Math.PI)*Math.exp(h*h/2);return h-m/(1+h*m/2)}function I(n){const t=Math.abs(n),i=2/(2+t),s=4*i-2,r=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,15626441722e-18,-85238095915e-18,6529054439e-18,5059343495e-18,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18];let u=0,a=0,l;for(let y=r.length-1;y>0;y--)l=a,a=s*a-u+r[y],u=l;const h=i*Math.exp(-t*t+.5*(r[0]+s*a)-u);return n>=0?h:2-h}function G(n){return .5*I(-n/Math.SQRT2)}function H(n,t){if(!(t>0)||!Number.isFinite(n))return Number.NaN;const i=.5*Z(t/2,.5,t/(t+n*n));return n>0?1-i:i}function S(n,t){if(!(n>0)||!(n<1)||!(t>0))return Number.NaN;if(t>1e7)return K(n);let i=-1e4,s=1e4,r=K(n);const u=B(t/2)+B(.5)-B((t+1)/2);for(let a=0;a<60;a++){const l=H(r,t);l<n?i=r:s=r;const h=Math.exp(-((t+1)/2)*Math.log(1+r*r/t)-u)/Math.sqrt(t),y=h>0?(l-n)/h:0;if(Math.abs(y)<1e-12)break;const m=r-y;if(r=m>i&&m<s&&Number.isFinite(m)?m:(i+s)/2,s-i<1e-12)break}return r}function O(n,t){let i=n,s=1/n,r=s;for(let u=0;u<300&&(i+=1,r*=t/i,s+=r,!(Math.abs(r)<Math.abs(s)*M));u++);return s*Math.exp(-t+n*Math.log(t)-B(n))}function b(n,t){let i=t+1-n,s=1/X,r=1/i,u=r;for(let a=1;a<=300;a++){const l=-a*(a-n);i+=2,r=l*r+i,Math.abs(r)<X&&(r=X),s=i+l/s,Math.abs(s)<X&&(s=X),r=1/r;const h=r*s;if(u*=h,Math.abs(h-1)<M)break}return Math.exp(-t+n*Math.log(t)-B(n))*u}function c(n,t){return!(n>0)||!(t>=0)||!Number.isFinite(t)?Number.NaN:t===0?0:t<n+1?O(n,t):1-b(n,t)}function f(n,t){return t>0?c(t/2,n/2):Number.NaN}function o(n,t){const i=f(n,t);return Number.isNaN(i)?Number.NaN:Math.min(1,Math.max(0,1-i))}}),De("packages/core/src/compute/linalg.js",function(e,U){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Z}});function te(K){const I=K.length,G=Array.from({length:I},()=>new Array(I).fill(0));for(let H=0;H<I;H++)for(let S=0;S<=H;S++){let O=K[H][S];for(let b=0;b<S;b++)O-=G[H][b]*G[S][b];if(H===S){if(!(O>0))return null;G[H][S]=Math.sqrt(O)}else G[H][S]=O/G[S][S]}return G}function M(K,I){const G=K.length,H=new Array(G).fill(0);for(let O=0;O<G;O++){let b=I[O];for(let c=0;c<O;c++)b-=K[O][c]*H[c];H[O]=b/K[O][O]}const S=new Array(G).fill(0);for(let O=G-1;O>=0;O--){let b=H[O];for(let c=O+1;c<G;c++)b-=K[c][O]*S[c];S[O]=b/K[O][O]}return S}function X(K){const I=K.length,G=Array.from({length:I},()=>new Array(I).fill(0));for(let H=0;H<I;H++){const S=new Array(I).fill(0);S[H]=1;const O=M(K,S);for(let b=0;b<I;b++)G[b][H]=O[b]}return G}function B(K,I,G){const H=K.length,S=H?K[0].length:0,O=Array.from({length:S},()=>new Array(S).fill(0)),b=new Array(S).fill(0);for(let c=0;c<H;c++){const f=G?G[c]:1,o=K[c];for(let n=0;n<S;n++){const t=f*o[n];b[n]+=t*I[c];for(let i=n;i<S;i++)O[n][i]+=t*o[i]}}for(let c=0;c<S;c++)for(let f=0;f<c;f++)O[c][f]=O[f][c];return{xtwx:O,xtwy:b}}function D(K,I){return K.map(G=>G.reduce((H,S,O)=>H+S*I[O],0))}function Z(K,I){let G=0;for(let H=0;H<K.length;H++){let S=0;for(let O=0;O<K.length;O++)S+=I[H][O]*K[O];G+=K[H]*S}return G}}),De("packages/core/src/compute/sketch.js",function(e,U){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return O}});class te{#e=0;#t=0;#n=0;static get errorBound(){return Object.freeze({kind:"exact",metric:"none",value:0,statement:"mean and variance match a full recompute to float rounding"})}get count(){return this.#e}add(c){if(!Number.isFinite(c))return;this.#e++;const f=c-this.#t;this.#t+=f/this.#e,this.#n+=f*(c-this.#t)}merge(c){if(c.#e===0)return;if(this.#e===0){this.#e=c.#e,this.#t=c.#t,this.#n=c.#n;return}const f=this.#e+c.#e,o=c.#t-this.#t;this.#t+=o*(c.#e/f),this.#n+=c.#n+o*o*(this.#e*c.#e/f),this.#e=f}mean(){return this.#e?this.#t:null}variance(){return this.#e>1?this.#n/(this.#e-1):null}varianceP(){return this.#e?this.#n/this.#e:null}stddev(){const c=this.variance();return c===null?null:Math.sqrt(c)}stddevP(){const c=this.varianceP();return c===null?null:Math.sqrt(c)}}class M{#e=[];#t=0;#n;#r;constructor(c,f=Math.random){if(!(c>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(c),this.#r=f}static get errorBound(){return Object.freeze({kind:"probabilistic",metric:"none",value:0,statement:"uniform sample: each element included with probability capacity/n; sample statistics are unbiased estimators"})}get seen(){return this.#t}get size(){return this.#e.length}add(c){if(!Number.isFinite(c))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(c);return}const f=Math.floor(this.#r()*this.#t);f<this.#n&&(this.#e[f]=c)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let c=0;for(const f of this.#e)c+=f;return c/this.#e.length}quantile(c){const f=this.#e.length;if(!f)return null;const o=this.#e.slice().sort((s,r)=>s-r);if(f===1)return o[0];const n=(f-1)*Math.min(1,Math.max(0,c)),t=Math.floor(n),i=Math.ceil(n);return t===i?o[t]:o[t]+(n-t)*(o[i]-o[t])}}function X(b){return b^=b>>>16,b=Math.imul(b,2246822507),b^=b>>>13,b=Math.imul(b,3266489909),b^=b>>>15,b>>>0}function B(b){if(typeof b=="number"){const o=new DataView(new ArrayBuffer(8));return o.setFloat64(0,b===0?0:b),X(o.getUint32(0)^o.getUint32(4))}const c=typeof b=="string"?b:String(b);let f=2166136261;for(let o=0;o<c.length;o++)f^=c.charCodeAt(o),f=Math.imul(f,16777619);return X(f)}class D{#e;#t;#n;constructor(c=14){const f=Math.floor(c);if(f<4||f>16)throw new RangeError("HLL precision must be 4..16");this.#e=f,this.#t=1<<f,this.#n=new Uint8Array(this.#t)}static errorBoundFor(c=14){const f=1<<Math.floor(c),o=1.04/Math.sqrt(f);return Object.freeze({kind:"probabilistic",metric:"relative",value:o,statement:`distinct count within ~${(o*100).toFixed(2)}% relative standard error (m=${f} buckets)`})}errorBound(){return D.errorBoundFor(this.#e)}add(c){const f=B(c),o=f&this.#t-1,n=f>>>this.#e|1<<32-this.#e;let t=1,i=n;for(;(i&1)===0;)t++,i>>>=1;t>this.#n[o]&&(this.#n[o]=t)}count(){const c=this.#t,f=32-this.#e,o=new Float64Array(f+2);for(let i=0;i<c;i++)o[this.#n[i]]++;let n=c*I(1-o[f+1]/c);for(let i=f;i>=1;i--)n=.5*(n+o[i]);n+=c*K(o[0]/c);const t=Z*c*c/n;return Math.round(t)}}const Z=.5/Math.log(2);function K(b){if(b===1)return 1/0;let c=1,f=b,o;do b*=b,o=f,f+=b*c,c+=c;while(f!==o);return f}function I(b){if(b===0||b===1)return 0;let c=1,f=1-b,o;do b=Math.sqrt(b),o=f,c*=.5,f-=(1-b)**2*c;while(f!==o);return f/3}class G{#e=new Map;#t;#n=0;constructor(c){if(!(c>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(c)}errorBoundFor(c){const f=c/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:f,statement:`each count overestimates the truth by at most N/m = ${f.toFixed(2)} (N=${c}, m=${this.#t})`})}get seen(){return this.#n}add(c){this.#n++;const f=this.#e.get(c);if(f){f.count++;return}if(this.#e.size<this.#t){this.#e.set(c,{count:1,error:0});return}let o,n=1/0;for(const[t,i]of this.#e)i.count<n&&(n=i.count,o=t);this.#e.delete(o),this.#e.set(c,{count:n+1,error:n})}top(c=this.#t){return[...this.#e.entries()].map(([o,n])=>({item:o,count:n.count,error:n.error})).sort((o,n)=>n.count-o.count).slice(0,Math.max(0,Math.floor(c)))}}class H{#e;#t=[[]];#n=0;#r;#s;constructor(c=200,f=Math.random){this.#e=Math.max(8,Math.floor(c)),this.#r=f,this.#s=2/3}static errorBoundFor(c=200){const f=1/Math.max(8,Math.floor(c));return Object.freeze({kind:"probabilistic",metric:"rank",value:f,statement:`queried quantile's true rank within ~${(f*100).toFixed(2)}% of N of the requested rank (k=${c})`})}errorBound(){return H.errorBoundFor(this.#e)}get count(){return this.#n}#i(c){const o=this.#t.length-1-c,n=Math.ceil(this.#e*this.#s**o);return Math.max(2,n)}add(c){Number.isFinite(c)&&(this.#n++,this.#t[0].push(c),this.#t[0].length>=this.#i(0)&&this.#o(0))}#o(c){const f=this.#t[c];f.sort((t,i)=>t-i),c+1>=this.#t.length&&this.#t.push([]);const o=this.#t[c+1],n=this.#r()<.5?0:1;for(let t=n;t<f.length;t+=2)o.push(f[t]);this.#t[c]=[];for(let t=0;t<this.#t.length;t++)if(this.#t[t].length>=this.#i(t)){this.#o(t);return}}#l(){const c=[];for(let f=0;f<this.#t.length;f++){const o=1<<f;for(const n of this.#t[f])c.push({v:n,w:o})}return c}quantile(c){const f=this.#l();if(!f.length)return null;f.sort((i,s)=>i.v-s.v);let o=0;for(const i of f)o+=i.w;const n=Math.min(1,Math.max(0,c))*o;let t=0;for(const i of f)if(t+=i.w,t>=n)return i.v;return f[f.length-1].v}rank(c){let f=0;for(let o=0;o<this.#t.length;o++){const n=1<<o;for(const t of this.#t[o])t<=c&&(f+=n)}return f}}const S=Object.freeze({distinct:D.errorBoundFor(14),median:H.errorBoundFor(200),p25:H.errorBoundFor(200),p75:H.errorBoundFor(200),p90:H.errorBoundFor(200),p95:H.errorBoundFor(200),p99:H.errorBoundFor(200),iqr:H.errorBoundFor(200),topK:Object.freeze({kind:"deterministic",metric:"absolute",value:0,statement:"each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m"})}),O={Welford:te,Reservoir:M,HyperLogLog:D,SpaceSaving:G,KLL:H,hash32:B,SKETCH_BOUNDS:S}}),De("packages/core/src/compute/statistics.js",function(e,U){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return St}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return at}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return Ce}});const te=U("packages/core/src/compute/handle.js"),M=te.presenceReader,X=te.valueReader,B=U("packages/core/src/compute/special.js"),D=B.studentTQuantile,Z=B.studentT,K=B.normalQuantile,I=B.normalCdf,G=B.chiSquareUpperTail,H=U("packages/core/src/compute/linalg.js"),S=H.cholesky,O=H.choleskySolve,b=H.choleskyInverse,c=H.normalEquations,f=H.quadForm,n=U("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,t=5e3,i=Object.freeze({variance:"rescan",varianceP:"rescan",stddev:"rescan",stddevP:"rescan",sumSquares:"rescan",weightedAvg:"rescan",median:"rescan",p25:"rescan",p75:"rescan",p90:"rescan",p95:"rescan",p99:"rescan",iqr:"rescan",mode:"rescan",distinct:"rescan",range:"rescan",skewness:"rescan",kurtosis:"rescan",geomean:"rescan",harmean:"rescan",mad:"rescan",argmin:"rescan",argmax:"rescan",hhi:"rescan",entropy:"rescan",evenness:"rescan",top3Share:"rescan",top10Share:"rescan",gini:"rescan",trimmedMean:"rescan",winsorizedMean:"rescan",robustOutliers:"rescan",jarqueBera:"rescan",passRate:"rescan",failureCount:"rescan"}),s=Object.freeze({distinct:Object.freeze({sketch:"HyperLogLog",bound:n.distinct}),median:Object.freeze({sketch:"KLL",bound:n.median}),p25:Object.freeze({sketch:"KLL",bound:n.p25}),p75:Object.freeze({sketch:"KLL",bound:n.p75}),p90:Object.freeze({sketch:"KLL",bound:n.p90}),p95:Object.freeze({sketch:"KLL",bound:n.p95}),p99:Object.freeze({sketch:"KLL",bound:n.p99}),iqr:Object.freeze({sketch:"KLL",bound:n.iqr}),top3Share:Object.freeze({sketch:"SpaceSaving",bound:n.topK}),top10Share:Object.freeze({sketch:"SpaceSaving",bound:n.topK})});function r(ce){const ye=ce==="sum"||ce==="avg"||ce==="countValues"||ce==="min"||ce==="max"?"maintained":Object.prototype.hasOwnProperty.call(i,ce)?i[ce]:null,he=Object.prototype.hasOwnProperty.call(s,ce)?s[ce]:null;return{stat:ce,exact:ye,approximate:he}}function u(ce,ye){const he=ye.length,Se=new Float64Array(he);let Ee=0;if(ce&&(ce.kind==="float64"||ce.kind==="int32")){const Ue=ce.values,_e=M(ce);for(let Je=0;Je<he;Je++){const $e=ye[Je];if(_e&&_e($e)!==1)continue;const ze=Ue[$e];Number.isNaN(ze)||(Se[Ee++]=ze)}return Se.subarray(0,Ee)}const Fe=X(ce);for(let Ue=0;Ue<he;Ue++){const _e=Fe(ye[Ue]);if(_e==null||_e==="")continue;const Je=typeof _e=="number"?_e:Number(_e);Number.isFinite(Je)&&(Se[Ee++]=Je)}return Se.subarray(0,Ee)}function a(ce,ye){const he=new Map,Se=X(ce);let Ee=0;for(let Fe=0;Fe<ye.length;Fe++){const Ue=Se(ye[Fe]);if(Ue==null||Ue===""||typeof Ue=="number"&&Number.isNaN(Ue))continue;const _e=typeof Ue=="object"?String(Ue):Ue;he.set(_e,(he.get(_e)||0)+1),Ee++}const Te=[...he.values()].sort((Fe,Ue)=>Ue-Fe);return{counts:Te,total:Ee,distinct:Te.length}}function l(ce){return ce.total>0?ce.counts.map(ye=>ye/ce.total):[]}function h(ce,ye){const he=a(ce,ye);if(!he.total)return null;let Se=0;for(const Ee of l(he))Se+=Ee*Ee;return Se}function y(ce,ye){const he=a(ce,ye);if(!he.total)return null;let Se=0;for(const Ee of l(he))Ee>0&&(Se-=Ee*Math.log2(Ee));return Se}function m(ce,ye){const he=a(ce,ye);if(!he.total||he.distinct<2)return he.total?1:null;let Se=0;for(const Ee of l(he))Ee>0&&(Se-=Ee*Math.log2(Ee));return Se/Math.log2(he.distinct)}function v(ce,ye,he=3){const Se=a(ce,ye);if(!Se.total)return null;const Ee=Math.max(1,Math.floor(he));let Te=0;for(let Fe=0;Fe<Math.min(Ee,Se.counts.length);Fe++)Te+=Se.counts[Fe];return Te/Se.total}function d(ce,ye){const he=u(ce,ye),Se=he.length;if(!Se)return null;const Ee=he.slice().sort();if(Ee[0]<0)return null;let Te=0,Fe=0;for(let Ue=0;Ue<Se;Ue++)Te+=Ee[Ue],Fe+=(Ue+1)*Ee[Ue];return Te===0?0:2*Fe/(Se*Te)-(Se+1)/Se}function p(ce){let ye=0,he=0,Se=0;for(let Ee=0;Ee<ce.length;Ee++){const Te=ce[Ee];ye++;const Fe=Te-he;he+=Fe/ye,Se+=Fe*(Te-he)}return{n:ye,mean:he,m2:Se}}function g(ce,ye){const he=ce.length;if(!he)return NaN;if(he===1)return ce[0];const Se=(he-1)*Math.min(1,Math.max(0,ye)),Ee=Math.floor(Se),Te=Math.ceil(Se);return Ee===Te?ce[Ee]:ce[Ee]+(Se-Ee)*(ce[Te]-ce[Ee])}function k(ce,ye){if(!ce.length)return NaN;const he=ce.slice().sort();return g(he,ye)}function w(ce,ye){const he=X(ce);let Se=0,Ee=0,Te=0;for(let Fe=0;Fe<ye.length;Fe++){const Ue=he(ye[Fe]);if(Ue==null||Ue==="")continue;const _e=String(Ue).toUpperCase();_e==="PASS"?Se++:_e==="FAIL"?Ee++:_e==="WARN"&&Te++}return{pass:Se+Te,fail:Ee,warn:Te,judged:Se+Te+Ee}}const E=Object.freeze({hhi:(ce,ye)=>h(ce,ye),entropy:(ce,ye)=>y(ce,ye),evenness:(ce,ye)=>m(ce,ye),top3Share:(ce,ye)=>v(ce,ye,3),top10Share:(ce,ye)=>v(ce,ye,10),gini:(ce,ye)=>d(ce,ye),trimmedMean:(ce,ye)=>L(u(ce,ye),.1),winsorizedMean:(ce,ye)=>j(u(ce,ye),.1),robustOutliers:(ce,ye)=>R(u(ce,ye),3.5),jarqueBera:(ce,ye)=>$(u(ce,ye)),variance:(ce,ye)=>{const{n:he,m2:Se}=p(u(ce,ye));return he>1?Se/(he-1):null},varianceP:(ce,ye)=>{const{n:he,m2:Se}=p(u(ce,ye));return he>0?Se/he:null},stddev:(ce,ye)=>{const{n:he,m2:Se}=p(u(ce,ye));return he>1?Math.sqrt(Se/(he-1)):null},stddevP:(ce,ye)=>{const{n:he,m2:Se}=p(u(ce,ye));return he>0?Math.sqrt(Se/he):null},median:(ce,ye)=>{const he=u(ce,ye);return he.length?k(he,.5):null},p25:(ce,ye)=>{const he=u(ce,ye);return he.length?k(he,.25):null},p75:(ce,ye)=>{const he=u(ce,ye);return he.length?k(he,.75):null},p90:(ce,ye)=>{const he=u(ce,ye);return he.length?k(he,.9):null},p95:(ce,ye)=>{const he=u(ce,ye);return he.length?k(he,.95):null},p99:(ce,ye)=>{const he=u(ce,ye);return he.length?k(he,.99):null},iqr:(ce,ye)=>{const he=u(ce,ye);if(!he.length)return null;const Se=he.slice().sort();return g(Se,.75)-g(Se,.25)},mad:(ce,ye)=>{const he=u(ce,ye);if(!he.length)return null;const Se=k(he,.5),Ee=new Float64Array(he.length);for(let Te=0;Te<he.length;Te++)Ee[Te]=Math.abs(he[Te]-Se);return k(Ee,.5)},range:(ce,ye)=>{const he=u(ce,ye);if(!he.length)return null;let Se=1/0,Ee=-1/0;for(let Te=0;Te<he.length;Te++)he[Te]<Se&&(Se=he[Te]),he[Te]>Ee&&(Ee=he[Te]);return Ee-Se},distinct:(ce,ye)=>{const he=X(ce),Se=new Set;for(let Ee=0;Ee<ye.length;Ee++){const Te=he(ye[Ee]);Te==null||Te===""||Se.add(Te instanceof Date?Te.getTime():Te)}return Se.size},mode:(ce,ye)=>{const he=X(ce),Se=new Map;for(let Fe=0;Fe<ye.length;Fe++){const Ue=he(ye[Fe]);if(Ue==null||Ue==="")continue;const _e=Ue instanceof Date?Ue.getTime():Ue;Se.set(_e,(Se.get(_e)||0)+1)}let Ee=null,Te=1;for(const[Fe,Ue]of Se)Ue>Te&&(Te=Ue,Ee=Fe);return Ee},skewness:(ce,ye)=>{const he=u(ce,ye),{n:Se,mean:Ee,m2:Te}=p(he);if(Se<3||Te<=0)return null;const Fe=Math.sqrt(Te/(Se-1));let Ue=0;for(let _e=0;_e<he.length;_e++)Ue+=((he[_e]-Ee)/Fe)**3;return Se/((Se-1)*(Se-2))*Ue},kurtosis:(ce,ye)=>{const he=u(ce,ye),{n:Se,mean:Ee,m2:Te}=p(he);if(Se<4||Te<=0)return null;const Fe=Math.sqrt(Te/(Se-1));let Ue=0;for(let $e=0;$e<he.length;$e++)Ue+=((he[$e]-Ee)/Fe)**4;const _e=Se*(Se+1)/((Se-1)*(Se-2)*(Se-3)),Je=3*(Se-1)**2/((Se-2)*(Se-3));return _e*Ue-Je},geomean:(ce,ye)=>{const he=u(ce,ye);if(!he.length)return null;let Se=0;for(let Ee=0;Ee<he.length;Ee++){if(he[Ee]<=0)return null;Se+=Math.log(he[Ee])}return Math.exp(Se/he.length)},harmean:(ce,ye)=>{const he=u(ce,ye);if(!he.length)return null;let Se=0;for(let Ee=0;Ee<he.length;Ee++){if(he[Ee]===0)return null;Se+=1/he[Ee]}return he.length/Se},sumSquares:(ce,ye)=>{const he=u(ce,ye);let Se=0;for(let Ee=0;Ee<he.length;Ee++)Se+=he[Ee]*he[Ee];return Se},passRate:(ce,ye)=>{const{pass:he,judged:Se}=w(ce,ye);return Se?he/Se:null},failureCount:(ce,ye)=>w(ce,ye).fail}),N=Object.freeze({hhi:"Concentration (HHI)",entropy:"Entropy",evenness:"Evenness",top3Share:"Top 3 share",top10Share:"Top 10 share",gini:"Gini coefficient",trimmedMean:"Trimmed mean",winsorizedMean:"Winsorized mean",robustOutliers:"Outliers (robust)",jarqueBera:"Jarque–Bera",median:"Median",p25:"25th percentile",p75:"75th percentile",p90:"90th percentile",p95:"95th percentile",p99:"99th percentile",iqr:"Interquartile range",mad:"Median absolute deviation",variance:"Variance",varianceP:"Variance (population)",stddev:"Standard deviation",stddevP:"Standard deviation (population)",range:"Range",distinct:"Distinct",mode:"Mode",skewness:"Skewness",kurtosis:"Kurtosis",geomean:"Geometric mean",harmean:"Harmonic mean",sumSquares:"Sum of squares",weightedAvg:"Weighted average",argmin:"Lowest by",argmax:"Highest by",passRate:"Pass rate",failureCount:"Failures"});function x(ce,ye,he){const Se=X(ce),Ee=X(ye);let Te=0,Fe=0;for(let Ue=0;Ue<he.length;Ue++){const _e=he[Ue],Je=Number(Se(_e)),$e=Number(Ee(_e));!Number.isFinite(Je)||!Number.isFinite($e)||(Te+=Je*$e,Fe+=$e)}return Fe===0?null:Te/Fe}function _(ce,ye,he){const Se=X(ce);let Ee=null,Te=he?-1/0:1/0;for(let Fe=0;Fe<ye.length;Fe++){const Ue=ye[Fe],_e=Number(Se(Ue));Number.isFinite(_e)&&(he?_e>Te:_e<Te)&&(Te=_e,Ee=Ue)}return Ee}function F(ce,ye,he){const Se=X(ce),Ee=X(ye);let Te=0,Fe=0,Ue=0,_e=0,Je=0,$e=0;for(let et=0;et<he.length;et++){const dt=he[et],ft=Number(Se(dt)),lt=Number(Ee(dt));!Number.isFinite(ft)||!Number.isFinite(lt)||(Te++,Fe+=ft,Ue+=lt,_e+=ft*ft,Je+=lt*lt,$e+=ft*lt)}if(Te<2)return null;const ze=Te*$e-Fe*Ue,Qe=Math.sqrt((Te*_e-Fe*Fe)*(Te*Je-Ue*Ue));if(Qe===0)return null;const tt=ze/Qe;return Math.max(-1,Math.min(1,tt))}function L(ce,ye=.1){const he=ce.length;if(!he)return null;const Se=Array.from(ce).sort((Ue,_e)=>Ue-_e),Ee=Math.floor(he*Math.min(.49,Math.max(0,ye))),Te=Se.slice(Ee,he-Ee);if(!Te.length)return g(Se,.5);let Fe=0;for(const Ue of Te)Fe+=Ue;return Fe/Te.length}function j(ce,ye=.1){const he=ce.length;if(!he)return null;const Se=Array.from(ce).sort((_e,Je)=>_e-Je),Ee=Math.floor(he*Math.min(.49,Math.max(0,ye))),Te=Se[Ee],Fe=Se[he-1-Ee];let Ue=0;for(const _e of Se)Ue+=Math.min(Fe,Math.max(Te,_e));return Ue/he}function R(ce,ye=3.5){if(!ce.length)return null;const Se=Array.from(ce).sort((_e,Je)=>_e-Je),Ee=g(Se,.5),Te=Se.map(_e=>Math.abs(_e-Ee)).sort((_e,Je)=>_e-Je),Fe=g(Te,.5);if(Fe===0)return null;let Ue=0;for(const _e of Se)Math.abs(.6745*(_e-Ee)/Fe)>ye&&Ue++;return Ue}function $(ce){const ye=ce.length;if(ye<8)return null;let he=0;for(const _e of ce)he+=_e;he/=ye;let Se=0,Ee=0,Te=0;for(const _e of ce){const Je=_e-he;Se+=Je*Je,Ee+=Je*Je*Je,Te+=Je*Je*Je*Je}if(Se/=ye,Ee/=ye,Te/=ye,Se===0)return null;const Fe=Ee/Se**1.5,Ue=Te/(Se*Se)-3;return ye/6*(Fe*Fe+Ue*Ue/4)}function T(ce,ye,he){const Se=[];let Ee=0;for(let _e=0;_e<ce.length;_e++){const Je=Number(ce[_e]),$e=Number(ye[_e]);!Number.isFinite(Je)||!Number.isFinite($e)||$e<=0||(Se.push([Je,$e]),Ee+=$e)}if(!Se.length||Ee<=0)return null;if(Se.sort((_e,Je)=>_e[0]-Je[0]),Se.length===1)return Se[0][0];const Te=[];let Fe=0;for(const[,_e]of Se)Te.push((Fe+_e/2)/Ee),Fe+=_e;const Ue=Math.max(0,Math.min(1,he));if(Ue<=Te[0])return Se[0][0];if(Ue>=Te[Te.length-1])return Se[Se.length-1][0];for(let _e=1;_e<Te.length;_e++){if(Ue>Te[_e])continue;const Je=Te[_e]-Te[_e-1],$e=Je>0?(Ue-Te[_e-1])/Je:0;return Se[_e-1][0]+(Se[_e][0]-Se[_e-1][0])*$e}return Se[Se.length-1][0]}function A(ce,ye,he){const Se=X(ce),Ee=X(ye),Te=new Float64Array(he.length),Fe=new Float64Array(he.length);let Ue=0;for(let _e=0;_e<he.length;_e++){const Je=he[_e],$e=Number(Se(Je)),ze=Number(Ee(Je));!Number.isFinite($e)||!Number.isFinite(ze)||(Te[Ue]=$e,Fe[Ue]=ze,Ue++)}return{xs:Te.subarray(0,Ue),ys:Fe.subarray(0,Ue),n:Ue}}function C(ce,ye,he,Se=!1){const{xs:Ee,ys:Te,n:Fe}=A(ce,ye,he);if(Fe<2)return null;let Ue=0,_e=0;for(let $e=0;$e<Fe;$e++)Ue+=Ee[$e],_e+=Te[$e];Ue/=Fe,_e/=Fe;let Je=0;for(let $e=0;$e<Fe;$e++)Je+=(Ee[$e]-Ue)*(Te[$e]-_e);return Je/(Se?Fe:Fe-1)}function z(ce,ye,he){const{xs:Se,ys:Ee,n:Te}=A(ce,ye,he);if(Te<2)return null;let Fe=0,Ue=0;for(let ft=0;ft<Te;ft++)Fe+=Se[ft],Ue+=Ee[ft];Fe/=Te,Ue/=Te;let _e=0,Je=0,$e=0;for(let ft=0;ft<Te;ft++){const lt=Se[ft]-Fe,At=Ee[ft]-Ue;_e+=lt*lt,Je+=lt*At,$e+=At*At}if(_e===0)return null;const ze=Je/_e,Qe=Ue-ze*Fe,tt=$e===0?1:Math.max(0,Math.min(1,Je*Je/(_e*$e))),et=Math.max(0,$e-ze*Je),dt=Te>2?Math.sqrt(et/(Te-2)/_e):0;return{slope:ze,intercept:Qe,r2:tt,stdError:dt,n:Te}}const Y=new Set(["ols","wls","robust"]),q=new Set(["quantile"]),V=new Set(["ridge","lasso","elasticnet","mixed","gls"]),J=1.345;function ee(ce,ye,he){const{xtwx:Se,xtwy:Ee}=c(ce,ye,he),Te=S(Se);if(!Te)return null;const Fe=O(Te,Ee),Ue=b(Te),_e=ne(ce,Fe),Je=ye.map(($e,ze)=>$e-_e[ze]);return{beta:Fe,cov:Ue,fitted:_e,residuals:Je}}function ne(ce,ye){return ce.map(he=>he.reduce((Se,Ee,Te)=>Se+Ee*ye[Te],0))}function oe(ce,ye){const he=ce.length,Se=ce.map(Je=>Je[ye]),Ee=ce.map(Je=>[1,...Je.filter(($e,ze)=>ze!==ye)]),Te=ee(Ee,Se,null);if(!Te)return 1;const Fe=Se.reduce((Je,$e)=>Je+$e,0)/he;let Ue=0,_e=0;for(let Je=0;Je<he;Je++)Ue+=Te.residuals[Je]**2,_e+=(Se[Je]-Fe)**2;return _e===0?1:Math.max(0,Math.min(1,1-Ue/_e))}function re(ce){const ye=[...ce].sort((Ee,Te)=>Ee-Te),he=ae(ye),Se=ce.map(Ee=>Math.abs(Ee-he)).sort((Ee,Te)=>Ee-Te);return ae(Se)/.6745}function ae(ce){const ye=ce.length;if(!ye)return 0;const he=Math.floor(ye/2);return ye%2?ce[he]:(ce[he-1]+ce[he])/2}function fe(ce,ye,he={}){const Se=he.method||"ols";if(V.has(Se))throw new Error(`[lattice] regression method "${Se}" is out of scope; use ols, wls or robust.`);if(q.has(Se))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!Y.has(Se))throw new Error(`[lattice] unknown regression method "${Se}"; use ols, wls or robust.`);const Ee=Array.isArray(ye)?ye.length:0,Te=Ee&&Array.isArray(ce[0])?ce[0].length:0,Fe=Te+1;if(!(Ee>Fe))return null;for(let $t=0;$t<Ee;$t++){if(!Number.isFinite(ye[$t])||!Array.isArray(ce[$t])||ce[$t].length!==Te)return null;for(let Dt=0;Dt<Te;Dt++)if(!Number.isFinite(ce[$t][Dt]))return null}let Ue=null;if(Se==="wls"){if(Ue=he.weights,!Array.isArray(Ue)||Ue.length!==Ee)return null;for(let $t=0;$t<Ee;$t++)if(!(Ue[$t]>0)||!Number.isFinite(Ue[$t]))return null}const _e=ce.map($t=>[1,...$t]);let Je,$e=null;if(Se==="robust"){if(Je=ee(_e,ye,null),!Je)return null;for(let $t=0;$t<50;$t++){const Dt=re(Je.residuals);if(!(Dt>0))break;const _t=Je.residuals.map(Jt=>{const qt=Math.abs(Jt/Dt);return qt<=J?1:J/qt}),Yt=ee(_e,ye,_t);if(!Yt)return null;const Qt=Yt.beta.reduce((Jt,qt,rn)=>Math.max(Jt,Math.abs(qt-Je.beta[rn])),0);if(Je=Yt,$e=_t,Qt<1e-10)break}}else if(Je=ee(_e,ye,Ue),!Je)return null;const ze=Se==="robust"?$e:Ue,{beta:Qe,cov:tt,fitted:et,residuals:dt}=Je;let ft=0,lt=0,At=0;for(let $t=0;$t<Ee;$t++){const Dt=ze?ze[$t]:1;ft+=Dt*dt[$t]**2,lt+=Dt,At+=Dt*ye[$t]}const Tt=At/lt;let It=0;for(let $t=0;$t<Ee;$t++){const Dt=ze?ze[$t]:1;It+=Dt*(ye[$t]-Tt)**2}const Ge=Ee-Fe,vt=ft/Ge,ht=It===0?1:Math.max(0,Math.min(1,1-ft/It)),kt=1-(1-ht)*(Ee-1)/Ge,Nt=Array.isArray(he.names)&&he.names.length===Te?he.names:ce[0].map(($t,Dt)=>`x${Dt+1}`),bt=st(he.confidence),mt=Ge>0?D(1-(1-bt)/2,Ge):1/0,Lt=Qe.map(($t,Dt)=>{const _t=Math.sqrt(Math.max(0,vt*tt[Dt][Dt])),Yt=_t>0?$t/_t:$t===0?0:1/0,Qt=Number.isFinite(Yt)?2*(1-Z(Math.abs(Yt),Ge)):0,Jt=Number.isFinite(mt)?mt*_t:null;return{name:Dt===0?"(intercept)":Nt[Dt-1],estimate:$t,stdError:_t,t:Yt,p:Math.max(0,Math.min(1,Qt)),lower:Jt===null?null:$t-Jt,upper:Jt===null?null:$t+Jt}}),Ht=new Array(Ee),Xt=new Array(Ee);for(let $t=0;$t<Ee;$t++){const Dt=ze?ze[$t]:1,_t=Math.max(0,Math.min(1,Dt*f(_e[$t],tt)));Ht[$t]=_t;const Yt=(1-_t)**2;Xt[$t]=Yt>0&&vt>0?dt[$t]**2/(Fe*vt)*(_t/Yt):null}const mn=ce[0].map(($t,Dt)=>{if(Te<2)return 1;const _t=oe(ce,Dt);return _t>=1?1/0:1/(1-_t)});let fn=null;{const $t=dt.map(_t=>_t*_t),Dt=ee(_e,$t,null);if(Dt){const _t=$t.reduce((en,gn)=>en+gn,0)/Ee;let Yt=0,Qt=0;for(let en=0;en<Ee;en++)Yt+=Dt.residuals[en]**2,Qt+=($t[en]-_t)**2;const Jt=Qt===0?0:Math.max(0,Math.min(1,1-Yt/Qt)),qt=Ee*Jt,rn=G(qt,Te);fn={statistic:qt,df:Te,p:rn,heteroscedastic:rn<.05}}}let an=null;if(Te===1){const $t=ce.map((Dt,_t)=>_t).sort((Dt,_t)=>ce[Dt][0]-ce[_t][0]);an={confidence:bt,points:$t.map(Dt=>{const _t=_e[Dt],Yt=Math.sqrt(Math.max(0,vt*f(_t,tt)));return{x:ce[Dt][0],yhat:et[Dt],lower:et[Dt]-mt*Yt,upper:et[Dt]+mt*Yt}})}}return{method:Se,coefficients:Lt,r2:ht,adjR2:kt,n:Ee,df:Ge,sigma2:vt,fitted:et,residuals:dt,leverage:Ht,cooksD:Xt,vif:mn,heteroscedasticity:fn,band:an,weights:ze?[...ze]:null}}function de(ce){const ye=ce.length,he=Array.from({length:ye},(Te,Fe)=>Fe).sort((Te,Fe)=>ce[Te]-ce[Fe]),Se=new Float64Array(ye);let Ee=0;for(;Ee<ye;){let Te=Ee;for(;Te+1<ye&&ce[he[Te+1]]===ce[he[Ee]];)Te++;const Fe=(Ee+Te)/2+1;for(let Ue=Ee;Ue<=Te;Ue++)Se[he[Ue]]=Fe;Ee=Te+1}return Se}const ve=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Ie(ce){const ye=[.01,.05,.1],he=[ve["1%"],ve["5%"],ve["10%"]];if(ce<=he[0]){const Te=(Math.log(ye[1])-Math.log(ye[0]))/(he[1]-he[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(ye[0])+Te*(ce-he[0]))))}if(ce>=he[2]){const Te=(Math.log(ye[2])-Math.log(ye[1]))/(he[2]-he[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(ye[2])+Te*(ce-he[2]))))}const Se=ce<he[1]?0:1,Ee=(ce-he[Se])/(he[Se+1]-he[Se]);return Math.exp(Math.log(ye[Se])+Ee*(Math.log(ye[Se+1])-Math.log(ye[Se])))}function Le(ce,ye,he,Se){const Ee=he-Se,Te=Se+3,Fe=new Array(Ee),Ue=new Array(Ee);let _e=!0,Je=Se;for(let et=0;et<Ee;et++){const dt=Se+et,ft=new Float64Array(Te);ft[0]=1,ft[1]=et+1,ft[2]=ce[dt];for(let lt=1;lt<=Se;lt++)ft[2+lt]=ye[dt-lt];for(let lt=1;lt<Te;lt++)Number.isFinite(ft[lt])||(Je=Math.min(Je,lt-3));Fe[et]=ft,Ue[et]=ye[dt],Number.isFinite(Ue[et])||(_e=!1)}if(!_e)return 0;const{xtwx:$e,xtwy:ze}=c(Fe,Ue,null);let Qe=0,tt=1/0;for(let et=0;et<=Je;et++){const dt=et+3;if(!(Ee>dt))continue;const ft=new Array(dt);for(let ht=0;ht<dt;ht++)ft[ht]=$e[ht].slice(0,dt);const lt=S(ft);if(!lt)continue;const At=O(lt,ze.slice(0,dt));let Tt=0;for(let ht=0;ht<Ee;ht++){const kt=Fe[ht];let Nt=0;for(let bt=0;bt<dt;bt++)Nt+=kt[bt]*At[bt];Tt+=(Ue[ht]-Nt)**2}const Ge=Tt/(Ee-dt)*(Ee-dt);if(!(Ge>0))continue;const vt=Ee*Math.log(Ge/Ee)+2*dt;vt<tt&&(tt=vt,Qe=et)}return Qe}function se(ce,ye={}){const he=[];for(let tt=0;tt<ce.length;tt++){const et=Number(ce[tt]);Number.isFinite(et)&&he.push(et)}const Se=he.length,Ee=Se-1;if(Se<8||Ee<6)return null;const Te=new Array(Ee);for(let tt=0;tt<Ee;tt++)Te[tt]=he[tt+1]-he[tt];let Fe=Number.isFinite(ye.maxlag)?Math.floor(ye.maxlag):Math.ceil(12*(Se/100)**.25);Fe=Math.max(0,Math.min(Fe,Math.floor((Ee-5)/2)));const Ue=(tt,et)=>{const dt=[],ft=[];for(let lt=et;lt<Ee;lt++){const At=[lt-et+1,he[lt]];for(let Tt=1;Tt<=tt;Tt++)At.push(Te[lt-Tt]);dt.push(At),ft.push(Te[lt])}return fe(dt,ft,{method:"ols"})},_e=Le(he,Te,Ee,Fe),Je=Ue(_e,_e);if(!Je||!Je.coefficients[2])return null;const $e=Je.coefficients[2].t,ze=Ie($e),Qe=$e<ve["5%"];return{statistic:$e,usedLag:_e,nobs:Ee-_e,criticalValues:{...ve},pValue:ze,pApproximate:!0,stationary:Qe,verdict:Qe?"stationary":"non-stationary",regression:"ct"}}function pe(ce,ye={}){const he=[];for(let Qe=0;Qe<ce.length;Qe++){const tt=Number(ce[Qe]);Number.isFinite(tt)&&he.push(tt)}const Se=he.length;if(Se<3)return null;let Ee=Number.isFinite(ye.maxlag)?Math.floor(ye.maxlag):Math.min(10,Se-1);Ee=Math.max(1,Math.min(Ee,Se-1));let Te=0;for(const Qe of he)Te+=Qe;Te/=Se;const Fe=he.map(Qe=>Qe-Te);let Ue=0;for(const Qe of Fe)Ue+=Qe*Qe;Ue/=Se;const _e=new Array(Ee+1).fill(0);_e[0]=1;for(let Qe=1;Qe<=Ee;Qe++){let tt=0;for(let et=Qe;et<Se;et++)tt+=Fe[et]*Fe[et-Qe];_e[Qe]=Ue>0?tt/Se/Ue:0}const Je=new Array(Ee+1).fill(0);Je[0]=1;let $e=[];for(let Qe=1;Qe<=Ee;Qe++){let tt=_e[Qe];for(let lt=1;lt<Qe;lt++)tt-=$e[lt-1]*_e[Qe-lt];let et=1;for(let lt=1;lt<Qe;lt++)et-=$e[lt-1]*_e[lt];const dt=et!==0?tt/et:0,ft=new Array(Qe);for(let lt=1;lt<Qe;lt++)ft[lt-1]=$e[lt-1]-dt*$e[Qe-1-lt];ft[Qe-1]=dt,Je[Qe]=dt,$e=ft}const ze=1.96/Math.sqrt(Se);return{acf:_e,pacf:Je,bounds:{upper:ze,lower:-ze},n:Se,nlags:Ee,approximate:!0}}function be(ce,ye,he){const{xs:Se,ys:Ee,n:Te}=A(ce,ye,he);if(Te<2)return null;const Fe=de(Se),Ue=de(Ee);let _e=0,Je=0;for(let tt=0;tt<Te;tt++)_e+=Fe[tt],Je+=Ue[tt];_e/=Te,Je/=Te;let $e=0,ze=0,Qe=0;for(let tt=0;tt<Te;tt++){const et=Fe[tt]-_e,dt=Ue[tt]-Je;$e+=et*dt,ze+=et*et,Qe+=dt*dt}return ze===0||Qe===0?null:Math.max(-1,Math.min(1,$e/Math.sqrt(ze*Qe)))}function ke(ce,ye,he){const{xs:Se,ys:Ee,n:Te}=A(ce,ye,he);if(Te<2||Te>t)return null;let Fe=0,Ue=0,_e=0,Je=0;for(let Qe=0;Qe<Te;Qe++)for(let tt=Qe+1;tt<Te;tt++){const et=Math.sign(Se[Qe]-Se[tt]),dt=Math.sign(Ee[Qe]-Ee[tt]),ft=et*dt;ft>0?Fe++:ft<0?Ue++:et===0&&dt===0||(et===0?_e++:Je++)}const $e=Fe+Ue+Je,ze=Fe+Ue+_e;return $e===0||ze===0?null:(Fe-Ue)/Math.sqrt($e*ze)}function je(ce,ye={}){const he=ce.length;if(he<2)return null;const Se=ce[0],Ee=ce[he-1],Te=[];for(let lt=1;lt<he;lt++){const At=ce[lt-1];At!==0&&Te.push((ce[lt]-At)/Math.abs(At))}let Fe=null;if(Te.length>1){let lt=0;for(const Tt of Te)lt+=Tt;lt/=Te.length;let At=0;for(const Tt of Te)At+=(Tt-lt)**2;Fe=Math.sqrt(At/(Te.length-1))}const Ue=Number(ye.periodsPerYear)>0?Number(ye.periodsPerYear):null;let _e=ce[0],Je=0,$e=0,ze=0,Qe=0;for(let lt=1;lt<he;lt++){if(ce[lt]>_e){_e=ce[lt],Je=lt;continue}if(_e<=0)continue;const At=(_e-ce[lt])/_e;At>$e&&($e=At,ze=Je,Qe=lt)}let tt=null;if(he>2){let lt=0;for(let It=0;It<he;It++)lt+=ce[It];lt/=he;let At=0,Tt=0;for(let It=0;It<he;It++){const Ge=ce[It]-lt;Tt+=Ge*Ge,It>0&&(At+=Ge*(ce[It-1]-lt))}tt=Tt>0?At/Tt:null}let et=0,dt=0;for(const lt of Te)lt>0?et++:lt<0&&dt++;let ft=null;if(Se>0&&Ee>0){const lt=(Ee/Se)**(1/(he-1))-1;ft=Ue?(1+lt)**Ue-1:lt}return{n:he,first:Se,last:Ee,change:Ee-Se,changePercent:Se===0?null:(Ee-Se)/Math.abs(Se)*100,volatility:Fe,annualisedVolatility:Fe!==null&&Ue?Fe*Math.sqrt(Ue):null,growth:ft,maxDrawdown:$e,maxDrawdownFrom:ze,maxDrawdownTo:Qe,autocorrelation:tt,upDays:et,downDays:dt}}const xe=1.128,ge=3.267;function we(ce){const ye=ce.length;if(ye<2)return null;const he=[];for(let Ee=1;Ee<ye;Ee++)he.push(Math.abs(ce[Ee]-ce[Ee-1]));const Se=he.reduce((Ee,Te)=>Ee+Te,0)/he.length;return{ranges:he,centre:Se,upper:ge*Se,lower:0}}function Me(ce){const ye=ce.length;if(ye<2)return null;let he=0;for(let Ee=1;Ee<ye;Ee++)he+=Math.abs(ce[Ee]-ce[Ee-1]);const Se=he/(ye-1);return{sigma:Se/xe,meanRange:Se}}function Ye(ce,ye){const he=ce.length;if(he<2||!ye)return null;const Se=Number.isFinite(Number(ye.lower))?Number(ye.lower):null,Ee=Number.isFinite(Number(ye.upper))?Number(ye.upper):null;if(Se===null&&Ee===null)return null;let Te=0;for(let et=0;et<he;et++)Te+=ce[et];Te/=he;let Fe=0;for(let et=0;et<he;et++)Fe+=(ce[et]-Te)**2;const Ue=Math.sqrt(Fe/(he-1)),_e=Me(ce),Je=_e?_e.sigma:null,$e=et=>{if(!et||et<=0)return{index:null,k:null};const ft=Se!==null&&Ee!==null?(Ee-Se)/(6*et):null,lt=Ee!==null?(Ee-Te)/(3*et):1/0,At=Se!==null?(Te-Se)/(3*et):1/0;return{index:ft,k:Math.min(lt,At)}},ze=$e(Je),Qe=$e(Ue);let tt=0;for(let et=0;et<he;et++){if(Se!==null&&ce[et]<Se){tt++;continue}Ee!==null&&ce[et]>Ee&&tt++}return{n:he,mean:Te,lower:Se,upper:Ee,target:Number.isFinite(Number(ye.target))?Number(ye.target):null,sigmaWithin:Je,sigmaOverall:Ue,cp:ze.index,cpk:ze.k,pp:Qe.index,ppk:Qe.k,outOfSpec:tt,defectRate:he?tt/he:null}}function Ae(ce){const ye=ce.length;if(ye<2)return null;const he=Me(ce);if(!he||!(he.sigma>0))return null;let Se=0;for(let Ee=0;Ee<ye;Ee++)Se+=ce[Ee];return Se/=ye,{centre:Se,sigma:he.sigma,upper:Se+3*he.sigma,lower:Se-3*he.sigma}}function Ve(ce,ye){if(!ye||!(ye.sigma>0))return[];const he=ce.length,{centre:Se,sigma:Ee}=ye,Te=Ue=>(ce[Ue]-Se)/Ee,Fe=[];for(let Ue=0;Ue<he;Ue++){if(Math.abs(Te(Ue))>3&&Fe.push({index:Ue,rule:1,description:"beyond three sigma"}),Ue>=2)for(const _e of[1,-1]){let Je=0;for(let $e=Ue-2;$e<=Ue;$e++)Te($e)*_e>2&&Je++;if(Je>=2){Fe.push({index:Ue,rule:2,description:"two of three past two sigma"});break}}if(Ue>=4)for(const _e of[1,-1]){let Je=0;for(let $e=Ue-4;$e<=Ue;$e++)Te($e)*_e>1&&Je++;if(Je>=4){Fe.push({index:Ue,rule:3,description:"four of five past one sigma"});break}}if(Ue>=7)for(const _e of[1,-1]){let Je=!0;for(let $e=Ue-7;$e<=Ue;$e++)if(Te($e)*_e<=0){Je=!1;break}if(Je){Fe.push({index:Ue,rule:4,description:"eight in a row on one side"});break}}}return Fe}function Pe(ce,ye){if(!ye||!(ye.sigma>0))return[];const he=ce.length,{centre:Se,sigma:Ee}=ye,Te=_e=>(ce[_e]-Se)/Ee,Fe=(_e,Je,$e,ze)=>{for(const Qe of[1,-1]){let tt=0;for(let et=_e;et<=Je;et++)Te(et)*Qe>$e&&tt++;if(tt>=ze)return!0}return!1},Ue=[];for(let _e=0;_e<he;_e++){if(Math.abs(Te(_e))>3&&Ue.push({index:_e,rule:1,description:"beyond three sigma"}),_e>=8)for(const Je of[1,-1]){let $e=!0;for(let ze=_e-8;ze<=_e;ze++)if(Te(ze)*Je<=0){$e=!1;break}if($e){Ue.push({index:_e,rule:2,description:"nine in a row on one side"});break}}if(_e>=5)for(const Je of[1,-1]){let $e=!0;for(let ze=_e-4;ze<=_e;ze++)if((ce[ze]-ce[ze-1])*Je<=0){$e=!1;break}if($e){Ue.push({index:_e,rule:3,description:Je>0?"six rising":"six falling"});break}}if(_e>=13){let Je=!0;for(let $e=_e-12;$e<=_e;$e++){const ze=ce[$e]-ce[$e-1],Qe=ce[$e+1<=_e?$e+1:$e]-ce[$e];if($e+1>_e)break;if(ze===0||Qe===0||ze>0==Qe>0){Je=!1;break}}Je&&Ue.push({index:_e,rule:4,description:"fourteen alternating"})}if(_e>=2&&Fe(_e-2,_e,2,2)&&Ue.push({index:_e,rule:5,description:"two of three past two sigma"}),_e>=4&&Fe(_e-4,_e,1,4)&&Ue.push({index:_e,rule:6,description:"four of five past one sigma"}),_e>=14){let Je=!0;for(let $e=_e-14;$e<=_e;$e++)if(Math.abs(Te($e))>=1){Je=!1;break}Je&&Ue.push({index:_e,rule:7,description:"fifteen within one sigma"})}if(_e>=7){let Je=!0;for(let $e=_e-7;$e<=_e;$e++)if(Math.abs(Te($e))<=1){Je=!1;break}Je&&Ue.push({index:_e,rule:8,description:"eight beyond one sigma"})}}return Ue}const Oe=Object.freeze(["westernElectric","nelson"]);function He(ce,ye,he="westernElectric"){return String(he)==="nelson"?Pe(ce,ye):Ve(ce,ye)}function Ke(ce,ye,he){let Se=0;for(let Ee=0;Ee<ce.length;Ee++)(ce[Ee]<ye||ce[Ee]>he)&&Se++;return Se}function Xe(ce,ye,he,Se=20){const Ee=ce.length;if(!Ee)return[];const Te=ce[0],Fe=ce[Ee-1];if(Fe===Te)return[{from:Te,to:Fe,count:Ee}];const Ue=he-ye,_e=1.5*Ue;let Je=Ue>0?Math.max(Te,ye-_e):Te,$e=Ue>0?Math.min(Fe,he+_e):Fe;$e>Je||(Je=Te,$e=Fe);const ze=Ue>0?2*Ue/Math.cbrt(Ee):($e-Je)/(Math.ceil(Math.log2(Ee))+1),Qe=ze>0?Math.min(Se,Math.max(1,Math.ceil(($e-Je)/ze))):1,tt=($e-Je)/Qe,et=[];for(let dt=0;dt<Qe;dt++)et.push({from:Je+dt*tt,to:Je+(dt+1)*tt,count:0});for(let dt=0;dt<Ee;dt++){const ft=Math.min(Qe-1,Math.max(0,Math.floor((ce[dt]-Je)/tt)));et[ft].count++}return et[0].from=Te,et[Qe-1].to=Fe,et}const nt=.95;function st(ce){const ye=Number(ce);return Number.isFinite(ye)&&ye>0&&ye<1?ye:nt}function wt(ce,ye=nt){const he=ce.length;if(he<2)return null;let Se=0;for(let $e=0;$e<he;$e++)Se+=ce[$e];const Ee=Se/he;let Te=0;for(let $e=0;$e<he;$e++){const ze=ce[$e]-Ee;Te+=ze*ze}const Fe=Math.sqrt(Te/(he-1)),Ue=st(ye),Je=D(1-(1-Ue)/2,he-1)*Fe/Math.sqrt(he);return{mean:Ee,lower:Ee-Je,upper:Ee+Je,margin:Je,n:he,confidence:Ue}}function pt(ce,ye,he=nt){const Se=Number(ce),Ee=Number(ye);if(!(Ee>0)||!(Se>=0)||Se>Ee)return null;const Te=st(he),Fe=K(1-(1-Te)/2),Ue=Se/Ee,_e=Fe*Fe,Je=1+_e/Ee,$e=(Ue+_e/(2*Ee))/Je,ze=Fe/Je*Math.sqrt(Ue*(1-Ue)/Ee+_e/(4*Ee*Ee));return{proportion:Ue,lower:Math.max(0,$e-ze),upper:Math.min(1,$e+ze),n:Ee,confidence:Te}}function St(ce,ye=nt){if(!ce||!(ce.n>2)||!Number.isFinite(ce.stdError))return null;const he=st(ye),Ee=D(1-(1-he)/2,ce.n-2)*ce.stdError;return{slope:ce.slope,lower:ce.slope-Ee,upper:ce.slope+Ee,margin:Ee,confidence:he}}function Ct(ce,ye,he=nt){const Se=Number(ce),Ee=Number(ye);if(!Number.isFinite(Se)||!(Ee>1))return null;const Te=st(he),Ue=K(1-(1-Te)/2)*Math.sqrt(1/(9*Ee)+Se*Se/(2*(Ee-1)));return{index:Se,lower:Se-Ue,upper:Se+Ue,margin:Ue,n:Ee,confidence:Te}}function Mt(ce,ye){return!ce||!(ce.sd>0)||!Number.isFinite(ye)||!Number.isFinite(ce.mean)?null:(ye-ce.mean)/ce.sd}function at(ce){return Number.isFinite(ce)?Math.min(1,Math.max(0,2*I(Math.abs(ce)/2)-1)):0}function ot(ce,ye){const he=new Map,Se=X(ce);let Ee=0;for(let Te=0;Te<ye.length;Te++){const Fe=Se(ye[Te]);if(Fe==null||Fe===""||typeof Fe=="number"&&Number.isNaN(Fe))continue;const Ue=Fe instanceof Date?Fe.getTime():typeof Fe=="object"?String(Fe):Fe;he.set(Ue,(he.get(Ue)||0)+1),Ee++}return{map:he,total:Ee}}function gt(ce,ye,he,Se){if(!(ye>0)||!(Se>0))return null;let Ee=0;const Te=new Set(ce.keys());for(const Fe of he.keys())Te.add(Fe);for(const Fe of Te){const Ue=(ce.get(Fe)||0)/ye,_e=(he.get(Fe)||0)/Se;Ee+=Math.abs(Ue-_e)}return Ee/2}const Et=10;function ut(ce,ye,he){if(he&&he.numeric){const Ue=u(ce,ye),{n:_e,mean:Je}=p(Ue),$e=_e>0?Mt({mean:he.mean,sd:he.sd},Je):null;return{measure:"standardizedMeanDifference",magnitude:$e,distance:$e===null?0:at($e),direction:$e===null?0:Math.sign($e),subsetN:_e,populationN:he.n||0,reliable:_e>=Et}}const{map:Ee,total:Te}=ot(ce,ye),Fe=gt(Ee,Te,he.map,he.total);return{measure:"categoricalTotalVariation",magnitude:Fe,distance:Fe===null?0:Fe,direction:0,subsetN:Te,populationN:he.total||0,reliable:Te>=Et}}function me(ce,ye){if(ce&&(ce.kind==="float64"||ce.kind==="int32"))return!0;const he=X(ce);let Se=0,Ee=0;for(let Te=0;Te<ye.length&&Se<200;Te++){const Fe=he(ye[Te]);if(Fe==null||Fe==="")continue;if(Fe instanceof Date)return!1;Se++;const Ue=typeof Fe=="number"?Fe:Number(Fe);Number.isFinite(Ue)&&Ee++}return Se===0?!1:Ee/Se>=.9}function Ce(ce,ye){if(me(ce,ye)){const Ee=u(ce,ye),{n:Te,mean:Fe,m2:Ue}=p(Ee);return{numeric:!0,mean:Fe,sd:Te>0?Math.sqrt(Ue/Te):0,n:Te}}const{map:he,total:Se}=ot(ce,ye);return{numeric:!1,map:he,total:Se}}}),De("packages/core/src/compute/total.js",function(e,U){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return p}});const M=U("packages/core/src/internal/predicates.js").isFunction,B=U("packages/core/src/internal/warn.js").warnOnce,D=U("packages/core/src/compute/handle.js"),Z=D.presenceReader,K=D.valueComparator,I=D.valueReader,G=U("packages/core/src/compute/statistics.js"),H=G.STAT_FNS,S=G.STAT_LABELS;function O(g){return!!g&&(g.kind==="float64"||g.kind==="int32")}function b(g,k){const w=k.length;let E=0;if(O(g)){const x=g.values,_=Z(g);if(!_){for(let F=0;F<w;F++){const L=x[k[F]];Number.isNaN(L)||(E+=L)}return E}for(let F=0;F<w;F++){const L=k[F];if(_(L)===1){const j=x[L];Number.isNaN(j)||(E+=j)}}return E}const N=I(g);for(let x=0;x<w;x++){const _=u(N(k[x]));_!==null&&(E+=_)}return E}b.kernel=!0;function c(g,k){const w=k.length;let E=0;if(O(g)){const x=g.values,_=Z(g);if(!_){for(let F=0;F<w;F++)Number.isNaN(x[k[F]])||E++;return E}for(let F=0;F<w;F++){const L=k[F];_(L)===1&&!Number.isNaN(x[L])&&E++}return E}const N=I(g);for(let x=0;x<w;x++){const _=N(k[x]);_!=null&&!(typeof _=="number"&&Number.isNaN(_))&&E++}return E}c.kernel=!0;function f(g,k){return k.length}f.kernel=!0;function o(g,k){const w=c(g,k);return w===0?null:b(g,k)/w}o.kernel=!0;function n(g,k,w,E){const N=k.length;if(O(g)){const L=g.values,j=Z(g);let R=null;if(!j){for(let $=0;$<N;$++){const T=L[k[$]];Number.isNaN(T)||(R===null||(w<0?T<R:T>R))&&(R=T)}return R}for(let $=0;$<N;$++){const T=k[$];if(j(T)===0)continue;const A=L[T];Number.isNaN(A)||(R===null||(w<0?A<R:A>R))&&(R=A)}return R}const x=I(g),_=K(E);let F=null;for(let L=0;L<N;L++){const j=x(k[L]);j==null||typeof j=="number"&&Number.isNaN(j)||(F===null||(w<0?_(j,F)<0:_(j,F)>0))&&(F=j)}return F}function t(g,k,w){return n(g,k,-1,w&&w.locale)}t.kernel=!0;function i(g,k,w){return n(g,k,1,w&&w.locale)}i.kernel=!0;function s(g,k){return k.length===0?null:I(g)(k[0])}s.kernel=!0;function r(g,k){return k.length===0?null:I(g)(k[k.length-1])}r.kernel=!0;function u(g){if(typeof g=="number")return Number.isNaN(g)?null:g;if(g==null||g===""||typeof g=="boolean")return null;if(g instanceof Date)return g.getTime();const k=Number(g);return Number.isNaN(k)?null:k}const a={sum:b,min:t,max:i,avg:o,count:f,first:s,last:r,countValues:c,...H},l=Object.freeze({...S,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function h(g){return g?typeof g=="string"?l[g]||g:"Total":""}const y=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function m(g){const k=g&&g.dataType&&g.dataType.totals&&g.dataType.totals.supported;if(Array.isArray(k))return k.slice();const w=y.filter(E=>E in a);for(const E of Object.keys(a))w.includes(E)||w.push(E);return w}function v(g,k){return typeof k!="string"?!0:m(g).includes(k)}function d(g,k){const w=I(g),E=[];for(let N=0;N<k.length;N++){const x=w(k[N]);x!=null&&E.push(x)}return E}function p(g,k,w,E){const N=k||[];if(typeof w=="string"){const x=a[w];return x?x(g,N,E):(B(`total:${w}`,`unknown total function "${w}"; register it in config.totalFns`),null)}return M(w)?w.kernel===!0?w(g,N,E):w(d(g,N),E||{}):null}}),De("packages/core/src/compute/windowed.js",function(e,U){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const M=U("packages/core/src/compute/sketch.js").Welford;class X{#e;#t;#n=[];#r;#s;constructor(I,G=0,H=Date.now){if(I!=="count"&&I!=="time"&&I!=="session")throw new RangeError(`unknown window kind: ${I}`);if((I==="count"||I==="time")&&!(G>0))throw new RangeError(`a ${I} window needs a positive span`);this.#e=I,this.#t=Math.floor(G),this.#r=H,this.#s=H()}get size(){return this.#n.length}push(I,G=this.#r()){Number.isFinite(I)&&(this.#n.push({t:G,v:I}),this.#i(G))}#i(I){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const G=I-this.#t;for(;this.#n.length&&this.#n[0].t<G;)this.#n.shift()}}spec(){const I=this.#e==="session"?this.#r()-this.#s:this.#t;return{kind:this.#e,span:I,size:this.#n.length}}values(){return this.#n.map(I=>I.v)}aggregate(){const I=this.spec();if(!this.#n.length)return{over:I,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const G=new M;let H=0,S=1/0,O=-1/0;for(const{v:b}of this.#n)H+=b,b<S&&(S=b),b>O&&(O=b),G.add(b);return{over:I,count:this.#n.length,sum:H,mean:G.mean(),min:S,max:O,variance:G.variance(),stddev:G.stddev()}}reduce(I){const G=this.aggregate(),H={sum:G.sum,avg:G.mean,mean:G.mean,min:G.min,max:G.max,count:G.count,variance:G.variance,stddev:G.stddev};if(!(I in H))throw new RangeError(`unknown windowed aggregate: ${I}`);return{value:H[I],over:G.over}}}const B=Object.freeze(["count","time","session"]);function D(K,I=Date.now){const G=K.kind==="time"&&K.minutes!=null?K.minutes*6e4:K.span??0;return new X(K.kind,G,I)}const Z={Window:X,WINDOW_KINDS:B,openWindow:D}}),De("packages/core/src/compute/rolling.js",function(e,U){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});const M=U("packages/core/src/compute/windowed.js").openWindow,B=U("packages/core/src/compute/sketch.js").KLL,D=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Z(a,l,h,y){if(a.kind==="count"){const m=Math.max(1,Math.floor(a.span||0));return{coverage:Math.min(1,l/m),partial:l<m}}if(a.kind==="time"){const m=a.minutes!=null?a.minutes*6e4:a.span||0;if(!(m>0))return{coverage:1,partial:!1};const v=h-y;return{coverage:Math.min(1,v/m),partial:v<m}}return{coverage:null,partial:!1}}function K(a,l){const h=M(l),y=new Map,m=a.length?a[0].at:0;for(let v=0;v<a.length;v++){const{key:d,at:p,value:g}=a[v];Number.isFinite(g)&&h.push(g,p);const k=h.aggregate(),w=Z(l,k.count,p,m);d!=null&&y.set(String(d),{sum:k.sum,avg:k.mean,min:k.min,max:k.max,count:k.count,coverage:w.coverage,partial:w.partial})}return y}function I(a){const l=new Map;let h=0;for(const{key:y,value:m}of a)Number.isFinite(m)&&(h+=m),y!=null&&l.set(String(y),h);return l}function G(a,l=1){const h=new Map,y=Math.max(1,Math.floor(l));for(let m=0;m<a.length;m++){const{key:v,value:d}=a[m];if(v==null)continue;const p=m>=y?a[m-y].value:null,g=Number.isFinite(d)?d:null,k=Number.isFinite(p)?p:null;h.set(String(v),g!==null&&k!==null?g-k:null)}return h}const H=4096;function S(a){let l=a>>>0;return()=>{l+=1831565813;let h=l;return h=Math.imul(h^h>>>15,h|1),h^=h+Math.imul(h^h>>>7,h|61),((h^h>>>14)>>>0)/4294967296}}function O(a,l){const h=a.length;if(h===1)return a[0];const y=(h-1)*l,m=Math.floor(y),v=Math.ceil(y);return m===v?a[m]:a[m]+(y-m)*(a[v]-a[m])}function b(a,l,h={}){const y=Math.min(1,Math.max(0,h.q==null?.5:h.q)),m=Math.max(1,Math.floor(h.cap==null?H:h.cap)),v=S(h.seed==null?2654435769:h.seed),d=new Map,p=a.length?a[0].at:0;if(l.kind==="session"){const k=new B(200,v);let w=0;for(const{key:E,value:N}of a)Number.isFinite(N)&&(k.add(N),w++),E!=null&&d.set(String(E),{value:w?k.quantile(y):null,approx:w>0,count:w,coverage:null,partial:!1});return d}const g=M(l);for(const{key:k,at:w,value:E}of a){Number.isFinite(E)&&g.push(E,w);const N=g.values(),x=N.length;let _=null,F=!1;if(x)if(x<=m)_=O([...N].sort((j,R)=>j-R),y);else{const j=new B(200,v);for(const R of N)j.add(R);_=j.quantile(y),F=!0}const L=Z(l,x,w,p);k!=null&&d.set(String(k),{value:_,approx:F,count:x,coverage:L.coverage,partial:L.partial})}return d}function c(a,l){const h=a.length,y=new Array(h).fill(null),m=Math.floor(l/2),v=l%2===0;for(let d=0;d<h;d++){if(d-m<0||d+m>=h)continue;let p=0,g=!0;if(v)for(let k=-m;k<=m;k++){const w=a[d+k];if(!Number.isFinite(w)){g=!1;break}p+=k===-m||k===m?w*.5:w}else for(let k=-m;k<=m;k++){const w=a[d+k];if(!Number.isFinite(w)){g=!1;break}p+=w}g&&(y[d]=p/l)}return y}function f(a,l){const h=new Map,y=Math.floor(Number(l&&l.period));if(!(y>=2))return h;const m=l&&l.model==="multiplicative",v=a.length,d=a.map(F=>Number.isFinite(F.value)?F.value:null),p=c(d,y),g=new Array(v).fill(null);for(let F=0;F<v;F++){const L=p[F],j=d[F];L===null||j===null||(m?L!==0&&(g[F]=j/L):g[F]=j-L)}const k=new Array(y).fill(0),w=new Array(y).fill(0);for(let F=0;F<v;F++){if(g[F]===null)continue;const L=F%y;k[L]+=g[F],w[L]+=1}const E=m?1:0,N=k.map((F,L)=>w[L]?F/w[L]:E),x=N.reduce((F,L)=>F+L,0)/y,_=m?N.map(F=>x!==0?F/x:1):N.map(F=>F-x);for(let F=0;F<v;F++){const{key:L}=a[F];if(L==null)continue;const j=p[F],R=_[F%y],$=d[F];let T=null;j!==null&&$!==null&&(T=m?j*R!==0?$/(j*R):null:$-j-R),h.set(String(L),{trend:j,seasonal:$===null?null:R,residual:T,coverage:j===null?0:1,partial:j===null})}return h}function o(a,l,h,y=80){const m=(Math.sqrt(5)-1)/2;let v=l,d=h,p=d-m*(d-v),g=v+m*(d-v),k=a(p),w=a(g);for(let E=0;E<y;E++)k<w?(d=g,g=p,w=k,p=d-m*(d-v),k=a(p)):(v=p,p=g,k=w,g=v+m*(d-v),w=a(g));return(v+d)/2}const n=1e-4,t=1-1e-4;function i(a,l){const h=a.length,y=new Array(h).fill(null),m=new Array(h).fill(null);let v=null,d=0;for(let p=0;p<h;p++){const g=a[p];if(!Number.isFinite(g)){v!==null&&(m[p]=v,y[p]=v);continue}if(v===null){v=g,m[p]=g,y[p]=g;continue}m[p]=v,d+=(g-v)**2,v=l*g+(1-l)*v,y[p]=v}return{smoothed:y,fitted:m,sse:d}}function s(a,l,h){const y=a.length,m=new Array(y).fill(null),v=new Array(y).fill(null);let d=null,p=null,g=0;for(let k=0;k<y;k++){const w=a[k];if(!Number.isFinite(w)){d!==null&&(d+=p,m[k]=d);continue}if(d===null){d=w,m[k]=w;continue}if(p===null){p=w-d;const x=d+p;v[k]=x,g+=(w-x)**2;const _=d;d=l*w+(1-l)*(_+p),p=h*(d-_)+(1-h)*p,m[k]=d;continue}const E=d+p;v[k]=E,g+=(w-E)**2;const N=d;d=l*w+(1-l)*(N+p),p=h*(d-N)+(1-h)*p,m[k]=d}return{smoothed:m,fitted:v,sse:g}}function r(a,l={}){const h=new Map,y=l.method==="holt",m=a.map(E=>Number.isFinite(E.value)?E.value:null),v=m.filter(E=>E!==null).length,d=E=>Math.min(t,Math.max(n,E)),p=()=>{for(const{key:E}of a)E!=null&&h.set(String(E),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return h};if(v<(y?2:1))return p();let g=Number.isFinite(l.alpha)?d(l.alpha):null,k=y&&Number.isFinite(l.beta)?d(l.beta):null;if(y){if(g===null||k===null){let E=g===null?.5:g,N=k===null?.5:k;for(let x=0;x<6;x++)g===null&&(E=o(_=>s(m,_,N).sse,n,t)),k===null&&(N=o(_=>s(m,E,_).sse,n,t));g=g===null?E:g,k=k===null?N:k}}else g===null&&(g=o(E=>i(m,E).sse,n,t));const w=y?s(m,g,k):i(m,g);for(let E=0;E<a.length;E++){const{key:N}=a[E];N!=null&&h.set(String(N),{smoothed:w.smoothed[E],fitted:w.fitted[E],alpha:g,beta:y?k:null,sse:w.sse})}return h}const u={ROLLING_WINDOW_FIELDS:D,QUANTILE_SPAN_CAP:H,rollingWindow:K,rollingQuantile:b,cumulativeToDate:I,periodOverPeriod:G,seasonalDecompose:f,exponentialSmoothing:r}}),De("packages/core/src/compute/compare.js",function(e,U){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return c}});const te=U("packages/core/src/compute/statistics.js"),M=te.numbers,X=te.moments,B=te.frequencyMap,D=te.categoricalDistance,Z=te.normalTotalVariation,K=te.isNumericColumn,I=te.SUBSET_RELIABILITY_FLOOR,G=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function H(f,o){if(!f||!o||!(f.n>0)||!(o.n>0)||!Number.isFinite(f.mean)||!Number.isFinite(o.mean))return null;const n=(f.n*f.sd*f.sd+o.n*o.sd*o.sd)/(f.n+o.n);return n>0?(f.mean-o.mean)/Math.sqrt(n):null}function S(f,o){const n=M(f,o),{n:t,mean:i,m2:s}=X(n),r=t>0?Math.sqrt(s/t):0;return{mean:i,sd:r,n:t}}function O(f,o,n,t){return K(f,o)&&K(n,t)}function b(f,o,n,t){if(O(f,o,n,t)){const u=S(f,o),a=S(n,t),l=H(u,a);return{measure:G.numeric,magnitude:l,distance:l===null?0:Z(l),direction:l===null?0:Math.sign(l),nA:u.n,nB:a.n,reliable:u.n>=I&&a.n>=I}}const i=B(f,o),s=B(n,t),r=D(i.map,i.total,s.map,s.total);return{measure:G.categorical,magnitude:r,distance:r===null?0:r,direction:0,nA:i.total,nB:s.total,reliable:i.total>=I&&s.total>=I}}function c(f,o,n={}){const t=new Set(f.columns),i=new Set(o.columns),s=f.columns.filter(h=>i.has(h)),r=Array.isArray(n.columns)&&n.columns.length?s.filter(h=>n.columns.includes(h)):s,u=f.indices(),a=o.indices(),l=[];for(const h of r){const y=f.handle(h),m=o.handle(h);if(!y||!m)continue;const v=b(y,u,m,a);l.push({column:h,name:f.name&&f.name(h)||o.name&&o.name(h)||h,measure:v.measure,magnitude:v.magnitude,distance:v.distance,direction:v.direction,nA:v.nA,nB:v.nB,reliable:v.reliable})}return l.sort((h,y)=>y.distance-h.distance||Math.abs(y.magnitude||0)-Math.abs(h.magnitude||0)),{ranked:l,nA:u.length,nB:a.length,unmatched:{onlyA:f.columns.filter(h=>!i.has(h)),onlyB:o.columns.filter(h=>!t.has(h))},measures:G}}}),De("packages/core/src/compute/anomaly.js",function(e,U){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return u}});const M=U("packages/core/src/compute/statistics.js").quantileSorted,B=U("packages/core/src/compute/special.js").logGamma,D=.6745,Z=3.5,K=1.5,I=.975,G=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function H(a){if(!a.length)return null;const h=Array.from(a,Number).sort((d,p)=>d-p),y=M(h,.5),m=h.map(d=>Math.abs(d-y)).sort((d,p)=>d-p),v=M(m,.5);return{median:y,mad:v}}function S(a,l={}){const h=Number.isFinite(l.threshold)?l.threshold:Z,y=a.length,m=new Array(y).fill(null),v=new Array(y).fill(!1),d=[];for(let k=0;k<y;k++){const w=Number(a[k]);Number.isFinite(w)&&d.push(w)}if(!d.length)return{median:null,mad:null,threshold:h,scores:m,flags:v,flagged:0};const p=H(d);if(p.mad===0)return{median:p.median,mad:0,threshold:h,scores:m,flags:v,flagged:0};let g=0;for(let k=0;k<y;k++){const w=Number(a[k]);if(!Number.isFinite(w))continue;const E=D*(w-p.median)/p.mad;m[k]=E,Math.abs(E)>h&&(v[k]=!0,g++)}return{median:p.median,mad:p.mad,threshold:h,scores:m,flags:v,flagged:g}}function O(a,l={}){const h=Number.isFinite(l.k)?l.k:K,y=[];for(let g=0;g<a.length;g++){const k=Number(a[g]);Number.isFinite(k)&&y.push(k)}if(!y.length)return null;const m=y.sort((g,k)=>g-k),v=M(m,.25),d=M(m,.75),p=d-v;return{q1:v,q3:d,iqr:p,lower:v-h*p,upper:d+h*p,k:h}}function b(a,l){if(l<=0)return 0;const h=B(a);if(l<a+1){let k=a,w=1/a,E=w;for(let N=0;N<1e3&&(k+=1,E*=l/k,w+=E,!(Math.abs(E)<Math.abs(w)*1e-15));N++);return w*Math.exp(-l+a*Math.log(l)-h)}const y=1e-300;let m=l+1-a,v=1/y,d=1/m,p=d;for(let k=1;k<1e3;k++){const w=-k*(k-a);m+=2,d=w*d+m,Math.abs(d)<y&&(d=y),v=m+w/v,Math.abs(v)<y&&(v=y),d=1/d;const E=d*v;if(p*=E,Math.abs(E-1)<1e-15)break}return 1-Math.exp(-l+a*Math.log(l)-h)*p}function c(a,l){return a<=0?0:b(l/2,a/2)}function f(a,l=I){if(!(l>0)||!(l<1))return NaN;let h=0,y=Math.max(1,a);for(;c(y,a)<l;)y*=2;for(let m=0;m<200;m++){const v=(h+y)/2;if(c(v,a)<l?h=v:y=v,y-h<1e-10)break}return(h+y)/2}function o(a){const l=a.length,h=a.map((y,m)=>{const v=y.slice();for(let d=0;d<l;d++)v.push(m===d?1:0);return v});for(let y=0;y<l;y++){let m=y;for(let d=y+1;d<l;d++)Math.abs(h[d][y])>Math.abs(h[m][y])&&(m=d);if(Math.abs(h[m][y])<1e-12)return null;if(m!==y){const d=h[m];h[m]=h[y],h[y]=d}const v=h[y][y];for(let d=0;d<2*l;d++)h[y][d]/=v;for(let d=0;d<l;d++){if(d===y)continue;const p=h[d][y];if(p!==0)for(let g=0;g<2*l;g++)h[d][g]-=p*h[y][g]}}return h.map(y=>y.slice(l))}function n(a,l){const h=a.length,y=new Array(l).fill(0);for(const d of a)for(let p=0;p<l;p++)y[p]+=d[p];for(let d=0;d<l;d++)y[d]/=h;const m=Array.from({length:l},()=>new Array(l).fill(0));for(const d of a)for(let p=0;p<l;p++){const g=d[p]-y[p];for(let k=p;k<l;k++)m[p][k]+=g*(d[k]-y[k])}const v=h>1?h-1:1;for(let d=0;d<l;d++)for(let p=d;p<l;p++)m[d][p]/=v,m[p][d]=m[d][p];return{mean:y,cov:m}}function t(a,l={}){const h=Number.isFinite(l.p)?l.p:I,y=Number.isFinite(l.ridge)?l.ridge:1e-6,m=a.length;if(!m)return null;const v=a[0].length;if(!v)return null;const d=new Array(m).fill(null),p=new Array(m).fill(null),g=new Array(m).fill(!1),k=[],w=[];for(let R=0;R<m;R++){const $=a[R];let T=$.length===v;const A=new Array(v);for(let C=0;T&&C<v;C++){const z=Number($[C]);Number.isFinite(z)?A[C]=z:T=!1}T&&(k.push(R),w.push(A))}const E=v,N=f(E,h);if(w.length<=v)return{center:[],df:E,cutoff:N,singular:!0,used:w.length,distances:d,squared:p,flags:g,flagged:0};const{mean:x,cov:_}=n(w,v);let F=o(_),L=!1;if(!F){L=!0;let R=0;for(let A=0;A<v;A++)R+=_[A][A];const $=R/v*y||y,T=_.map((A,C)=>A.map((z,Y)=>C===Y?z+$:z));if(F=o(T),!F)return{center:x,df:E,cutoff:N,singular:!0,used:w.length,distances:d,squared:p,flags:g,flagged:0}}let j=0;for(let R=0;R<w.length;R++){const $=w[R],T=new Array(v);for(let z=0;z<v;z++)T[z]=$[z]-x[z];let A=0;for(let z=0;z<v;z++){let Y=0;for(let q=0;q<v;q++)Y+=F[z][q]*T[q];A+=T[z]*Y}A<0&&(A=0);const C=k[R];p[C]=A,d[C]=Math.sqrt(A),A>N&&(g[C]=!0,j++)}return{center:x,df:E,cutoff:N,singular:L,used:w.length,distances:d,squared:p,flags:g,flagged:j}}const i=20,s=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function r(a,l={}){const h=l.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",y=Number.isFinite(l.windowLen)&&l.windowLen>=1?Math.floor(l.windowLen):i,m=Number.isFinite(l.threshold)?l.threshold:Z,v=Number.isFinite(l.k)?l.k:K,d=Number.isFinite(l.minPeriods)&&l.minPeriods>=1?Math.floor(l.minPeriods):y,p=a.length,g=new Array(p).fill(null),k=new Array(p).fill(!1);let w=0;for(let E=0;E<p;E++){const N=Number(a[E]);if(!Number.isFinite(N))continue;const x=Math.max(0,E-y+1),_=[];for(let F=x;F<=E;F++){const L=Number(a[F]);Number.isFinite(L)&&_.push(L)}if(!(_.length<d))if(h==="rollingIqr"){const F=O(_,{k:v});if(!F)continue;(N<F.lower||N>F.upper)&&(k[E]=!0,w++)}else{const F=H(_);if(!F||F.mad===0)continue;const L=D*(N-F.median)/F.mad;g[E]=L,Math.abs(L)>m&&(k[E]=!0,w++)}}return{method:h,windowLen:y,minPeriods:d,threshold:m,k:v,scores:g,flags:k,flagged:w}}function u(a={}){const l=a||{},h=l.field;if(typeof h!="string"||!h)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const y=l.method||"modifiedZScore";if(!(G.includes(y)||s.includes(y))||y==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${y}'`);const v=typeof l.orderBy=="string"?l.orderBy:null,d=l.latest===!0,p=s.includes(y),g=k=>Number(k==null?NaN:k[h]);return k=>{const w=Array.isArray(k)?k.slice():[...k];v&&w.sort((F,L)=>{const j=F?.[v],R=L?.[v];return j===R?0:j==null?-1:R==null?1:j<R?-1:1});const E=w.map(g);let N,x;if(p)({flags:N,scores:x}=r(E,{method:y,windowLen:l.windowLen,threshold:l.threshold,k:l.k,minPeriods:l.minPeriods}));else if(y==="iqr"){const F=O(E,{k:l.k});N=E.map(L=>F?Number.isFinite(L)&&(L<F.lower||L>F.upper):!1),x=E.map(()=>null)}else({flags:N,scores:x}=S(E,{threshold:l.threshold}));if(d){const F=N.length-1;return F<0||!N[F]?!1:{method:y,field:h,flagged:[{row:w[F],score:x[F]}]}}const _=[];for(let F=0;F<N.length;F++)N[F]&&_.push({row:w[F],score:x[F]});return _.length?{method:y,field:h,flagged:_}:!1}}}),De("packages/core/src/compute/forecast.js",function(e,U){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return a}});const te=U("packages/core/src/compute/special.js"),M=te.normalQuantile,X=te.studentTQuantile,D=U("packages/core/src/internal/warn.js").warnOnce,Z=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),K=1e-4,I=1-1e-4;function G(l){const h=[];for(let y=0;y<l.length;y++){const m=l[y];if(m!==null&&typeof m=="object"){const v=Number.isFinite(m.at)?m.at:y,d=Number.isFinite(m.value)?m.value:null;h.push({at:v,value:d})}else h.push({at:y,value:Number.isFinite(m)?Number(m):null})}return h}function H(l){const h=l.filter(p=>p.value!==null),y=h[0],m=h[h.length-1],v=m.at-y.at,d=h.length>1&&v>0?v/(h.length-1):1;return{lastAt:m.at,step:d}}function S(l){return Math.min(I,Math.max(K,l))}function O(l,h=K,y=I,m=80){const v=(Math.sqrt(5)-1)/2;let d=h,p=y,g=p-v*(p-d),k=d+v*(p-d),w=l(g),E=l(k);for(let N=0;N<m;N++)w<E?(p=k,k=g,E=w,g=p-v*(p-d),w=l(g)):(d=g,g=k,w=E,k=d+v*(p-d),E=l(k));return(d+p)/2}function b(l,h){let y=null,m=0,v=0;for(let d=0;d<l.length;d++){const p=l[d];if(p!==null){if(y===null){y=p;continue}m+=(p-y)**2,v+=1,y=h*p+(1-h)*y}}return{level:y,sse:m,m:v}}function c(l,h,y){let m=null,v=null,d=0,p=0;for(let g=0;g<l.length;g++){const k=l[g];if(k===null){m!==null&&v!==null&&(m+=v);continue}if(m===null){m=k;continue}v===null&&(v=k-m);const w=m+v;d+=(k-w)**2,p+=1;const E=m;m=h*k+(1-h)*(E+v),v=y*(m-E)+(1-y)*v}return{level:m,trend:v,sse:d,m:p}}function f(l,h,y,m,v){const d=l.length;if(d<2*h)return null;const p=L=>{let j=0,R=0;for(let $=L;$<L+h&&$<d;$++)l[$]!==null&&(j+=l[$],R+=1);return R?j/R:null},g=p(0),k=p(h);if(g===null||k===null)return null;let w=g,E=(k-g)/h;const N=new Array(h).fill(0);for(let L=0;L<h;L++)N[L]=l[L]===null?0:l[L]-w;const x=N.reduce((L,j)=>L+j,0)/h;for(let L=0;L<h;L++)N[L]-=x;let _=0,F=0;for(let L=h;L<d;L++){const j=L%h,R=N[j],$=l[L];if($===null){w+=E;continue}const T=w+E+R;_+=($-T)**2,F+=1;const A=w;w=y*($-R)+(1-y)*(w+E),E=m*(w-A)+(1-m)*E,N[j]=v*($-w)+(1-v)*R}return{level:w,trend:E,season:N,phase:(d-1)%h,sse:_,count:F}}function o(l,h,y){let m=1;for(const d of h)m+=d*d;const v=Math.sqrt(l*m);return{se:v,margin:y*v}}function n(l,h={}){if(!l||typeof l.length!="number"||l.length===0)return null;const y=Z.includes(h.method)?h.method:"linear",m=Math.max(1,Math.floor(Number(h.horizon)||1)),v=Number.isFinite(h.confidence)&&h.confidence>0&&h.confidence<1?h.confidence:.95,d=1-(1-v)/2,p=G(l),g=p.map(_=>_.value),k=g.filter(_=>_!==null),w=k.length,{lastAt:E,step:N}=w?H(p):{lastAt:0,step:1},x=_=>E+_*N;return y==="linear"?t(p,w,m,v,d,x):y==="movingAverage"?i(k,w,m,v,d,h,x):y==="ses"?s(g,w,m,v,d,h,x):y==="holt"?r(g,w,m,v,d,h,x):u(g,w,m,v,d,h,x)}function t(l,h,y,m,v,d){if(h<2)return null;let p=0,g=0;for(const $ of l)$.value!==null&&(p+=$.at,g+=$.value);p/=h,g/=h;let k=0,w=0,E=0;for(const $ of l){if($.value===null)continue;const T=$.at-p,A=$.value-g;k+=T*T,w+=T*A,E+=A*A}if(k===0)return null;const N=w/k,x=g-N*p,_=E===0?1:Math.max(0,Math.min(1,w*w/(k*E))),F=Math.max(0,E-N*w),L=h>2?Math.sqrt(F/(h-2)):null,j=h>2?X(v,h-2):null,R=[];for(let $=1;$<=y;$++){const T=d($),A=x+N*T;let C=null,z=null,Y=null,q=null,V=null;if(L!==null){const J=1/h+(T-p)**2/k,ee=L*Math.sqrt(1+J),ne=L*Math.sqrt(J);V=ee,C=A-j*ee,z=A+j*ee,Y=A-j*ne,q=A+j*ne}R.push({step:$,at:T,mean:A,lower:C,upper:z,lowerMean:Y,upperMean:q,se:V})}return{method:"linear",horizon:y,confidence:m,n:h,sigma:L,r2:_,params:{slope:N,intercept:x},points:R}}function i(l,h,y,m,v,d,p){if(h<1)return null;const g=Math.max(1,Math.min(h,Math.floor(Number(d.windowLen)||h))),k=l.slice(h-g);let w=0;for(const L of k)w+=L;const E=w/g;let N=null,x=null;if(g>1){let L=0;for(const R of k)L+=(R-E)**2;N=Math.sqrt(L/(g-1))*Math.sqrt(1+1/g),x=X(v,g-1)}const _=N===null?null:x*N,F=[];for(let L=1;L<=y;L++)F.push({step:L,at:p(L),mean:E,lower:_===null?null:E-_,upper:_===null?null:E+_,se:N});return{method:"movingAverage",horizon:y,confidence:m,n:h,sigma:N===null?null:N,params:{windowLen:g},points:F}}function s(l,h,y,m,v,d,p){if(h<1)return null;let g=Number.isFinite(d.alpha)?S(d.alpha):null;g===null&&(g=O(x=>b(l,x).sse));const k=b(l,g),w=M(v),E=k.m>0?k.sse/k.m:null,N=[];for(let x=1;x<=y;x++){const _=k.level;let F=null,L=null,j=null;if(E!==null){const R=[];for(let T=1;T<x;T++)R.push(g);const $=o(E,R,w);j=$.se,F=_-$.margin,L=_+$.margin}N.push({step:x,at:p(x),mean:_,lower:F,upper:L,se:j})}return{method:"ses",horizon:y,confidence:m,n:h,sigma:E===null?null:Math.sqrt(E),params:{alpha:g},points:N}}function r(l,h,y,m,v,d,p){if(h<2)return null;let g=Number.isFinite(d.alpha)?S(d.alpha):null,k=Number.isFinite(d.beta)?S(d.beta):null;if(g===null||k===null){let F=g===null?.5:g,L=k===null?.5:k;for(let j=0;j<6;j++)g===null&&(F=O(R=>c(l,R,L).sse)),k===null&&(L=O(R=>c(l,F,R).sse));g=g===null?F:g,k=k===null?L:k}const w=c(l,g,k),E=M(v),N=w.m>0?w.sse/w.m:null,x=g*k,_=[];for(let F=1;F<=y;F++){const L=w.level+F*w.trend;let j=null,R=null,$=null;if(N!==null){const T=[];for(let C=1;C<F;C++)T.push(g+C*x);const A=o(N,T,E);$=A.se,j=L-A.margin,R=L+A.margin}_.push({step:F,at:p(F),mean:L,lower:j,upper:R,se:$})}return{method:"holt",horizon:y,confidence:m,n:h,sigma:N===null?null:Math.sqrt(N),params:{alpha:g,beta:k},points:_}}function u(l,h,y,m,v,d,p){const g=Math.floor(Number(d.period));if(!(g>=2))return D("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(h<2*g)return null;let k=Number.isFinite(d.alpha)?S(d.alpha):null,w=Number.isFinite(d.beta)?S(d.beta):null,E=Number.isFinite(d.gamma)?S(d.gamma):null;const N=($,T,A)=>{const C=f(l,g,$,T,A);return C?C.sse:1/0};if(k===null||w===null||E===null){let $=k===null?.5:k,T=w===null?.5:w,A=E===null?.5:E;for(let C=0;C<8;C++)k===null&&($=O(z=>N(z,T,A))),w===null&&(T=O(z=>N($,z,A))),E===null&&(A=O(z=>N($,T,z)));k=k===null?$:k,w=w===null?T:w,E=E===null?A:E}const x=f(l,g,k,w,E);if(!x)return null;const _=M(v),F=x.count>0?x.sse/x.count:null,L=k*w,j=E*(1-k),R=[];for(let $=1;$<=y;$++){const T=x.season[(x.phase+$)%g],A=x.level+$*x.trend+T;let C=null,z=null,Y=null;if(F!==null){const q=[];for(let J=1;J<$;J++)q.push(k+J*L+(J%g===0?j:0));const V=o(F,q,_);Y=V.se,C=A-V.margin,z=A+V.margin}R.push({step:$,at:p($),mean:A,lower:C,upper:z,se:Y})}return{method:"holtWinters",horizon:y,confidence:m,n:h,sigma:F===null?null:Math.sqrt(F),params:{alpha:k,beta:w,gamma:E,period:g},points:R}}const a={FORECAST_METHODS:Z,forecast:n}}),De("packages/core/src/compute/hypothesis.js",function(e,U){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return _}});const M=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/compute/handle.js").valueReader,D=U("packages/core/src/compute/statistics.js"),Z=D.numbers,K=D.moments,I=D.frequencyMap,G=D.categoricalDistance,H=D.isNumericColumn,S=D.jarqueBera,O=D.proportionInterval,b=D.SUBSET_RELIABILITY_FLOOR,f=U("packages/core/src/compute/compare.js").pooledStandardMeanDifference,o=U("packages/core/src/compute/special.js"),n=o.studentT,t=o.studentTQuantile,i=o.normalCdf,s=o.normalQuantile,r=o.chiSquareUpperTail,u=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),a=.05,l=2e6;function h(F){const L=Number(F);return Number.isFinite(L)&&L>0&&L<1?L:.95}function y(F){const{n:L,mean:j,m2:R}=K(F);return{mean:j,sd:L>0?Math.sqrt(R/L):0,n:L}}function m(F,L){const j=F.length;if(j<2)return 0;let R=0;for(let $=0;$<j;$++){const T=F[$]-L;R+=T*T}return R/(j-1)}function v(F,L){return{name:"pooledStandardMeanDifference",value:f(y(F),y(L))}}function d(F,L,j){const R=F.length,$=L.length;if(R<2||$<2)return null;const T=h(j),{mean:A}=K(F),{mean:C}=K(L),z=m(F,A),Y=m(L,C),q=z/R+Y/$;if(!(q>0))return null;const V=Math.sqrt(q),J=(A-C)/V,ee=z/R*(z/R)/(R-1),ne=Y/$*(Y/$)/($-1),oe=q*q/(ee+ne),re=Math.min(1,Math.max(0,2*(1-n(Math.abs(J),oe)))),ae=A-C,fe=t(1-(1-T)/2,oe)*V;return{test:u.WELCH,statistic:J,statisticName:"t",df:oe,pValue:re,interval:{estimate:ae,lower:ae-fe,upper:ae+fe,confidence:T,method:"welch-t (difference of means)"},effectSize:v(F,L),nA:R,nB:$,reliable:R>=b&&$>=b,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function p(F){const L=F.length;if(L===0)return Number.NaN;const j=L>>1;return L%2?F[j]:(F[j-1]+F[j])/2}function g(F,L,j){const R=F.length,$=L.length,T=R*$;if(T===0||T>l)return null;const A=new Float64Array(T);let C=0;for(let ee=0;ee<R;ee++)for(let ne=0;ne<$;ne++)A[C++]=F[ee]-L[ne];A.sort();const z=p(A),Y=Math.sqrt(R*$*(R+$+1)/12),q=s(1-(1-j)/2);let V=Math.round(T/2-q*Y);V>=0||(V=0);const J=Math.floor((T-1)/2);return V>J&&(V=J),{estimate:z,lower:A[V],upper:A[T-1-V],confidence:j,method:"hodges-lehmann (normal approximation)"}}function k(F,L,j){const R=F.length,$=L.length;if(R<1||$<1)return null;const T=h(j),A=R+$,C=new Array(A);for(let re=0;re<R;re++)C[re]={v:F[re],g:0};for(let re=0;re<$;re++)C[R+re]={v:L[re],g:1};C.sort((re,ae)=>re.v-ae.v);let z=0,Y=0,q=0;for(;q<A;){let re=q;for(;re<A&&C[re].v===C[q].v;)re++;const ae=re-q,fe=(q+1+re)/2;for(let de=q;de<re;de++)C[de].g===0&&(z+=fe);Y+=ae*ae*ae-ae,q=re}const V=z-R*(R+1)/2,J=R*$/2,ee=R*$/12*(A+1-Y/(A*(A-1)));let ne=1;if(ee>0){const re=Math.max(0,Math.abs(V-J)-.5);ne=Math.min(1,2*i(-re/Math.sqrt(ee)))}const oe=g(F,L,T);return{test:u.MANN_WHITNEY,statistic:V,statisticName:"U",df:null,pValue:ne,interval:oe,effectSize:v(F,L),nA:R,nB:$,reliable:R>=b&&$>=b,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function w(F,L,j,R,$){const T=O(F,L,$),A=O(j,R,$);if(!T||!A)return null;const C=T.proportion-A.proportion,z=C-Math.sqrt((T.proportion-T.lower)**2+(A.upper-A.proportion)**2),Y=C+Math.sqrt((T.upper-T.proportion)**2+(A.proportion-A.lower)**2);return{lower:z,upper:Y}}function E(F,L,j,R,$,T={}){if(!(L>0)||!(R>0))return null;const A=new Set([...F.keys(),...j.keys()]),C=A.size;if(C<2)return null;const z=L+R;let Y=0;for(const ne of A){const oe=F.get(ne)||0,re=j.get(ne)||0,ae=oe+re,fe=L*ae/z,de=R*ae/z;fe>0&&(Y+=(oe-fe)*(oe-fe)/fe),de>0&&(Y+=(re-de)*(re-de)/de)}const q=C-1,V=r(Y,q);let J=null;T.category!==void 0&&A.has(T.category)?J=T.category:C===2&&([J]=[...A]);let ee=null;if(J!==null){const ne=w(F.get(J)||0,L,j.get(J)||0,R,h($));ne&&(ee={estimate:(F.get(J)||0)/L-(j.get(J)||0)/R,lower:ne.lower,upper:ne.upper,confidence:h($),method:"newcombe (difference in this category's share)",category:J})}return{test:u.CHI_SQUARE,statistic:Y,statisticName:"chiSquare",df:q,pValue:V,interval:ee,effectSize:{name:"categoricalTotalVariation",value:G(F,L,j,R)},nA:L,nB:R,reliable:L>=b&&R>=b,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function N(F){return F==null||F===""||typeof F=="number"&&Number.isNaN(F)?null:F instanceof Date?F.getTime():typeof F=="object"?String(F):F}function x(F,L,j){if(j===u.WELCH||j===u.MANN_WHITNEY)return{test:j,chosenBy:"override",reason:`caller override: ${j}`};const R=S(F),$=S(L),T=R===null?null:Math.exp(-R/2),A=$===null?null:Math.exp(-$/2);return T!==null&&T<a||A!==null&&A<a?{test:u.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${a})`}:{test:u.WELCH,chosenBy:"auto",reason:T!==null||A!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function _(F,L,j,R={}){if(!F||!L)return null;const $=h(R.confidence),T=B(L);let A;if(Array.isArray(R.groups)&&R.groups.length===2)A=[N(R.groups[0]),N(R.groups[1])];else{const{map:re}=I(L,j),ae=[...re.entries()].sort((fe,de)=>de[1]-fe[1]).slice(0,2).map(fe=>fe[0]);if(ae.length<2)return M("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;A=ae}const[C,z]=A;if(C===null||z===null||C===z)return M("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const Y=[],q=[];for(let re=0;re<j.length;re++){const ae=N(T(j[re]));ae===C?Y.push(j[re]):ae===z&&q.push(j[re])}if(Y.length===0||q.length===0)return M("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const V=R.test&&R.test!=="auto"?String(R.test):null,J=H(F,Y.concat(q));let ee,ne,oe;if(V===u.CHI_SQUARE||!V&&!J){ne=V?"override":"auto",oe=V?"caller override: chiSquare":"column family: categorical";const re=I(F,Y),ae=I(F,q);ee=E(re.map,re.total,ae.map,ae.total,$,{category:R.category})}else{if((V===u.WELCH||V===u.MANN_WHITNEY)&&!J)return M("compareGroups:numeric-override",`[lattice] compareGroups: ${V} needs a numeric column, but the column is not numeric.`),null;const re=Z(F,Y),ae=Z(F,q),fe=x(re,ae,V);ne=fe.chosenBy,oe=fe.reason,ee=fe.test===u.MANN_WHITNEY?k(re,ae,$):d(re,ae,$)}return ee?{...ee,chosenBy:ne,reason:oe,groups:[C,z]}:(M("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),De("packages/core/src/columns/detailcolumn.js",function(e,U){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return B}});const te="__lattice_detail",M=36;function X(D){const Z=D.config&&D.config.detailColumnWidth||M;return{id:te,field:null,title:"",type:"text",dataType:{base:"text"},nullable:!0,align:"center",generated:!0,control:!0,detailExpander:!0,value:{pure:!0},cell:{render:"detailExpander",align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:Z,min:Z,max:Z,pin:D.config&&D.config.detailColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(K,I){return!!(I&&I.expanded)},formatValue(){return""}}}const B=X}),De("packages/core/src/columns/treecolumn.js",function(e,U){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const M=U("packages/core/src/internal/predicates.js").isFunction,X="__lattice_tree",B=260;function D(K){const I=K.tree||{},G=K.config&&K.config.treeColumnWidth||B,H=()=>(K.columns&&M(K.columns.visible)?K.columns.visible():[]).find(c=>!c.generated)||null,S=(b,c)=>{if(c&&c.group)return c.groupValue;if(M(I.label))return I.label(b,c);if(typeof I.label=="string")return b==null?null:b[I.label];const f=H();return f&&M(f.getValue)?f.getValue(b,c):null},O=()=>{if(I.title)return I.title;const b=typeof I.label=="string"?K.columns&&M(K.columns.get)?K.columns.get(I.label):null:H();return b&&(b.title||b.id)||"Hierarchy"};return{id:X,get title(){return O()},field:null,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:G,min:140,pin:K.config&&K.config.treeColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(b,c){return S(b,c)},formatValue(b,c){if(c&&c.grandTotal)return K.config&&K.config.grandTotalLabel||"Total";if(b==null)return"";if(!I.label){const f=H();if(f&&M(f.formatValue))return f.formatValue(b,c)}return String(b)}}}const Z=D}),De("packages/core/src/columns/pivotcolumns.js",function(e,U){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return D}});const M=U("packages/core/src/internal/warn.js").warnOnce,X="__lattice_pivot",B=500;function D(G){const{pivot:H,valueColumns:S,config:O}=G,b=H&&H.paths||[],c=G.separator||O&&O.pivot&&O.pivot.separator||" | ",f=O&&O.pivot&&O.pivot.maxColumns||B;if(!b.length||!S.length)return{tree:[],leaves:[],error:null};const o=Z(O),n=b.length*S.length+(o?S.length:0);if(n>f){const s=`pivot would generate ${n} columns, above the limit of ${f}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return M(`pivot.maxColumns:${n}`,s),{tree:[],leaves:[],error:s}}const t=[],i=[];for(const s of b){const r=[];for(const u of S){const a=I(s,u,c);r.push(a),i.push(a)}r.length===1?(r[0].title=String(s),t.push(r[0])):t.push({id:`${X}:group:${s}`,title:String(s),columns:r,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(o){const s=S.map(u=>K(u,O));i.push(...s);const r=O&&O.pivot&&O.pivot.totalsLabel||"Total";if(s.length===1)s[0].title=r,o==="before"?t.unshift(s[0]):t.push(s[0]);else{const u={id:`${X}:group:__totals`,title:r,columns:s,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};o==="before"?t.unshift(u):t.push(u)}}return{tree:t,leaves:i,error:null}}function Z(G){const H=G&&G.pivot&&G.pivot.groupTotals;return H==="before"||H==="after"?H:null}function K(G,H){return{id:`${X}:__total${H&&H.pivot&&H.pivot.separator||" | "}${G.id}`,field:null,title:G.title||G.id,type:G.type,dataType:G.dataType,nullable:!0,align:G.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:G.id,total:!0},value:{pure:!0},cell:{align:G.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:G.total,lookup:null,layout:{width:G.layout&&G.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(S,O){const b=O&&O.totals;return b&&Object.hasOwn(b,G.id)?b[G.id]:null},formatValue(S,O){return S==null?"":G.formatValue?G.formatValue(S,O):String(S)}}}function I(G,H,S){return{id:`${X}:${G}${S}${H.id}`,field:null,title:H.title||H.id,type:H.type,dataType:H.dataType,nullable:!0,align:H.align,generated:!0,pivot:{enabled:!1,index:0,path:G,sourceId:H.id},value:{pure:!0},cell:{align:H.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:H.total,lookup:null,layout:{width:H.layout&&H.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(O,b){return O==null?"":H.formatValue?H.formatValue(O,b):String(O)}}}}),De("packages/core/src/compute/group.js",function(e,U){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return O}});const te=U("packages/core/src/compute/handle.js"),M=te.dictSize,X=te.identity,B=te.presenceReader,D=te.rowCount,Z=te.valueReader,K="",I="\0",G=1<<20;function H(b,c,f,o){const n=b.length,t=b.map(l=>Z(l)),i=Array.isArray(o)&&o.some(Boolean),s=i?t.map((l,h)=>o[h]?y=>o[h](l(y)):l):t;if(!i&&n>0&&b.every(l=>l&&l.kind==="dictionary"&&l.dict)){const l=b.map(y=>M(y.dict)+1);let h=1;for(let y=0;y<n;y++)h*=l[y];if(h<=Number.MAX_SAFE_INTEGER){const y=b.map(p=>p.values),m=b.map(p=>B(p)),v=p=>{let g=0;for(let k=0;k<n;k++){const w=m[k],E=w&&w(p)===0?l[k]-1:y[k][p];g=g*l[k]+E}return g},d=new Float64Array(f);for(let p=0;p<f;p++)d[p]=v(c[p]);return{packed:d,strings:null,product:h,readers:s,keyOf:v}}}const u=l=>{let h="";for(let y=0;y<n;y++){const m=s[y](l);h+=(y===0?"":K)+(m==null?I:String(m))}return h},a=new Array(f);for(let l=0;l<f;l++)a[l]=u(c[l]);return{packed:null,strings:a,product:1/0,readers:s,keyOf:u}}function S(b,c,f,o){const n=new Uint32Array(o+1);for(let r=0;r<f;r++)n[c[r]+1]++;for(let r=0;r<o;r++)n[r+1]+=n[r];const t=new Uint32Array(f),i=n.slice(0,o);for(let r=0;r<f;r++)t[i[c[r]]++]=b[r];const s=new Array(o);for(let r=0;r<o;r++)s[r]=t.subarray(n[r],n[r+1]);return s}function O(b,c,f={}){const o=b||[],n=c||X(D(o[0],f)),t=n.length;if(o.length===0||t===0)return{keys:[],buckets:[]};const{packed:i,strings:s,product:r,readers:u}=H(o,n,t,f.project),a=new Uint32Array(t);let l=0,h=null;if(i&&r<=Math.max(1024,Math.min(G,t*4))){const d=r,p=new Int32Array(d).fill(-1);for(let g=0;g<t;g++)p[i[g]]=0;for(let g=0;g<d;g++)p[g]===0&&(p[g]=l++);for(let g=0;g<t;g++)a[g]=p[i[g]];h=new Float64Array(l);for(let g=0;g<d;g++)p[g]>=0&&(h[p[g]]=g)}else if(i){const d=new Map;for(let p=0;p<t;p++){const g=i[p];let k=d.get(g);k===void 0&&(k=l++,d.set(g,k)),a[p]=k}h=new Float64Array(l);for(const[p,g]of d)h[g]=p}else{const d=new Map;for(let p=0;p<t;p++){const g=s[p];let k=d.get(g);k===void 0&&(k=l++,d.set(g,k)),a[p]=k}}const y=S(n,a,t,l),m=new Array(l);for(let d=0;d<l;d++){const p=y[d][0],g=new Array(u.length);for(let k=0;k<u.length;k++)g[k]=u[k](p);m[d]=g}const v={keys:m,buckets:y};return h&&(v.packed=h),v}}),De("packages/core/src/compute/pivot.js",function(e,U){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return t}});const M=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/compute/handle.js").valueComparator,Z=U("packages/core/src/compute/group.js").packKeys,I=U("packages/core/src/compute/total.js").total,G="|",H="/",S=2e3;function O(r,u,a){return`${r}${G}${u}${G}${a}`}function b(r,u){let a="";for(let l=0;l<r.length;l++){const h=r[l];a+=(l===0?"":u)+(h==null?"":String(h))}return a}function c(r,u,a={}){const l=a.separator||H,h=u.length,{keyOf:y,readers:m}=Z(r,u,0),v=new Map,d=[],p=[];for(let _=0;_<h;_++){const F=u[_],L=y(F);if(v.has(L))continue;v.set(L,d.length),p.push(L);const j=new Array(m.length);for(let R=0;R<m.length;R++)j[R]=m[R](F);d.push(j)}const g=B(a.locale),k=d.map((_,F)=>F);k.sort((_,F)=>{const L=d[_],j=d[F];for(let R=0;R<L.length;R++){const $=f(L[R],j[R],g);if($!==0)return $}return _-F});const w=new Array(k.length),E=new Array(k.length),N=new Map;for(let _=0;_<k.length;_++){const F=k[_];w[_]=d[F],E[_]=b(d[F],l),N.set(p[F],_)}return{keys:w,paths:E,idOf:_=>{const F=N.get(y(_));return F===void 0?-1:F}}}function f(r,u,a){const l=r==null,h=u==null;return l||h?l&&h?0:l?1:-1:a(r,u)}function o(r){const u=r.values||r.totals||[];if(u.length&&typeof u[0]=="object"&&u[0]!==null)return u.filter(y=>y&&y.handle);const a=typeof r.handle=="function"?r.handle:null;if(!a)return u.length&&M("pivot:handles","pivot was given total column ids but no handle(colId) resolver, so no cell values were reduced. Pass values: [{ colId, handle, fn }] or opts.handle."),[];const l=typeof r.totalOf=="function"?r.totalOf:null,h=[];for(const y of u){const m=a(y);m&&h.push({colId:y,handle:m,fn:l?l(y):"sum"})}return h}function n(r,u,a){if(Array.isArray(r)){const l=a||{};return{...l,pivotHandles:r,order:u||null,groups:l.groups||null}}return r||{}}function t(r,u,a){const l=n(r,u,a),h=l.separator||H,y=o(l),m=l.maxColumns===void 0?S:l.maxColumns,v=l.groups&&l.groups.buckets?l.groups:null,d=v?v.buckets:[l.order||new Uint32Array(0)],p=l.groupPaths||(v?v.keys.map(L=>b(L,h)):[""]),g=s(d),{keys:k,paths:w,idOf:E}=c(l.pivotHandles||[],g,l),N=w.length*Math.max(1,y.length),x=i(w,y,h);if(m&&N>m){const L=new Map;return{keys:k,paths:w,fields:x,groupPaths:p,columns:N,values:L,cells:L,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${N} columns, above pivot.maxColumns of ${m}. Narrow the pivot columns or raise the limit.`,columns:N,maxColumns:m}}}const _=new Map,F=w.length;for(let L=0;L<d.length;L++){const j=d[L],R=p[L]===void 0?"":p[L],$=j.length;if($===0)continue;const T=new Int32Array($),A=new Uint32Array(F+1);for(let Y=0;Y<$;Y++){const q=E(j[Y]);T[Y]=q,q>=0&&A[q+1]++}for(let Y=0;Y<F;Y++)A[Y+1]+=A[Y];const C=new Uint32Array($),z=A.slice(0,F);for(let Y=0;Y<$;Y++){const q=T[Y];q>=0&&(C[z[q]++]=j[Y])}for(let Y=0;Y<F;Y++){const q=A[Y],V=A[Y+1];if(V===q)continue;const J=C.subarray(q,V);for(let ee=0;ee<y.length;ee++){const ne=y[ee],oe=I(ne.handle,J,ne.fn,l.totalContext||{locale:l.locale});_.set(O(R,w[Y],ne.colId),oe)}}}return{keys:k,paths:w,fields:x,groupPaths:p,columns:N,values:_,cells:_,error:null}}function i(r,u,a){if(u.length===0)return r.slice();const l=[];for(const h of r)for(const y of u)l.push(`${h}${a}${y.colId}`);return l}function s(r){if(r.length===1)return r[0]||new Uint32Array(0);let u=0;for(const h of r)u+=h?h.length:0;const a=new Uint32Array(u);let l=0;for(const h of r)!h||h.length===0||(a.set(h,l),l+=h.length);return a}}),De("packages/core/src/store/bitset.js",function(e,U){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return M}});const te=8;class M{static#e=new Uint8Array(256);static{for(let B=1;B<256;B++)M.#e[B]=M.#e[B>>1]+(B&1)}#t;#n;constructor(B=0){const D=Math.max(0,B|0);this.#n=D,this.#t=new Uint8Array(Math.ceil(D/te))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(B){return B<0||B>=this.#n?0:this.#t[B>>3]>>(B&7)&1}set(B){return B>=0&&B<this.#n&&(this.#t[B>>3]|=1<<(B&7)),this}clear(B){return B>=0&&B<this.#n&&(this.#t[B>>3]&=~(1<<(B&7))),this}assign(B,D){return D?this.set(B):this.clear(B)}fill(B=!1){return this.#t.fill(B?255:0),B&&this.#r(),this}grow(B){const D=Math.max(0,B|0);if(D<=this.#n)return this;const Z=Math.ceil(D/te);if(Z>this.#t.length){const K=new Uint8Array(Z);K.set(this.#t),this.#t=K}return this.#n=D,this}count(){const B=this.#t,D=M.#e;let Z=0;for(let K=0;K<B.length;K++)Z+=D[B[K]];return Z}and(B){const D=B instanceof M?B.words:B,Z=this.#t,K=Math.min(Z.length,D.length);for(let I=0;I<K;I++)Z[I]&=D[I];for(let I=K;I<Z.length;I++)Z[I]=0;return this}or(B){const D=B instanceof M?B.words:B,Z=this.#t,K=Math.min(Z.length,D.length);for(let I=0;I<K;I++)Z[I]|=D[I];return this}not(){const B=this.#t;for(let D=0;D<B.length;D++)B[D]=~B[D]&255;return this.#r(),this}clone(){const B=new M(this.#n);return B.words.set(this.#t.subarray(0,B.words.length)),B}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const B=this.#n&7;if(B===0)return;const D=this.#n>>3;D<this.#t.length&&(this.#t[D]&=(1<<B)-1)}static from(B){const D=Array.isArray(B)?B:Array.from(B),Z=new M(D.length);for(let K=0;K<D.length;K++)D[K]&&Z.set(K);return Z}}}),De("packages/core/src/store/dictionary.js",function(e,U){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return B}});const te=U("packages/core/src/internal/compare.js"),M=te.collator,X=te.defaultCompare;class B{#e;#t=new Map;#n=0;#r=null;#s=-1;#i="\0";constructor(Z=[]){this.#e=[];for(let K=0;K<Z.length;K++){const I=Z[K];this.#t.has(I)||(this.#t.set(I,this.#e.length),this.#e.push(I))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Z=this.#e.length*8;for(let K=0;K<this.#e.length;K++){const I=this.#e[K];typeof I=="string"&&(Z+=I.length*2),Z+=16}return Z}codeOf(Z){const K=this.#t.get(Z);if(K!==void 0)return K;const I=this.#e.length;return this.#e.push(Z),this.#t.set(Z,I),this.#n++,I}lookup(Z){const K=this.#t.get(Z);return K===void 0?-1:K}has(Z){return this.#t.has(Z)}valueOf(Z){return this.#e[Z]}values(){return this.#e}ranks(Z){const K=Z||"";if(this.#r&&this.#s===this.#n&&this.#i===K)return this.#r;const I=this.#e.length,G=new Array(I);for(let b=0;b<I;b++)G[b]=b;const H=M(Z).compare,S=this.#e;G.sort((b,c)=>this.#o(S[b],S[c],H));const O=new Uint32Array(I);for(let b=0;b<I;b++)O[G[b]]=b;return this.#r=O,this.#s=this.#n,this.#i=K,O}#o(Z,K,I){return typeof Z=="string"&&typeof K=="string"?I(Z,K):X(Z,K)}}}),De("packages/core/src/store/multivalue.js",function(e,U){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return te}});class te{#e;#t;#n=0;#r=0;constructor(X={}){const B=Math.max(1,X.rows??16),D=Math.max(1,X.values??B);this.#e=new Int32Array(D),this.#t=new Uint32Array(B+1)}get values(){return this.#e}get offsets(){return this.#t}get rows(){return this.#n}get length(){return this.#r}get bytes(){return this.#e.byteLength+this.#t.byteLength}count(X){return X<0||X>=this.#n?0:this.#t[X+1]-this.#t[X]}at(X){return X<0||X>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[X],this.#t[X+1])}has(X,B){if(X<0||X>=this.#n)return!1;const D=this.#e,Z=this.#t[X+1];for(let K=this.#t[X];K<Z;K++)if(D[K]===B)return!0;return!1}hasAny(X,B){for(let D=0;D<B.length;D++)if(this.has(X,B[D]))return!0;return!1}hasAll(X,B){for(let D=0;D<B.length;D++)if(!this.has(X,B[D]))return!1;return!0}hasNone(X,B){return!this.hasAny(X,B)}push(X){const B=this.#n,D=X.length;this.#s(B+1),this.#i(this.#r+D);const Z=this.#r;for(let K=0;K<D;K++)this.#e[Z+K]=X[K]|0;return this.#r+=D,this.#n=B+1,this.#t[B]=Z,this.#t[B+1]=this.#r,B}write(X,B){if(X===this.#n){this.push(B);return}if(X<0||X>this.#n)return;const D=this.#t[X],Z=this.#t[X+1],K=B.length;if(Z-D===K){for(let I=0;I<K;I++)this.#e[D+I]=B[I]|0;return}this.#o(X,B)}compact(X,B,D){const Z=this.#e,K=this.#t,I=this.#n,G=new Int32Array(Math.max(1,this.#r)),H=new Uint32Array(B+1);let S=0;for(let O=0;O<I;O++){if(X[O]===D)continue;const b=K[O],c=K[O+1];H[X[O]]=S;for(let f=b;f<c;f++)G[S++]=Z[f];H[X[O]+1]=S}this.#e=G,this.#t=H,this.#n=B,this.#r=S}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#s(X){if(X+1<=this.#t.length)return;let B=this.#t.length-1;for(;B<X;)B=B*2||16;const D=new Uint32Array(B+1);D.set(this.#t),this.#t=D}#i(X){if(X<=this.#e.length)return;let B=this.#e.length;for(;B<X;)B=B*2||16;const D=new Int32Array(B);D.set(this.#e),this.#e=D}#o(X,B){const D=this.#e,Z=this.#t,K=this.#n,I=B.length-(Z[X+1]-Z[X]),G=new Int32Array(Math.max(1,this.#r+I)),H=new Uint32Array(Z.length);let S=0;for(let O=0;O<K;O++){if(H[O]=S,O===X)for(let b=0;b<B.length;b++)G[S++]=B[b]|0;else for(let b=Z[O];b<Z[O+1];b++)G[S++]=D[b];H[O+1]=S}this.#e=G,this.#t=H,this.#r=S}}}),De("packages/core/src/compute/sort.js",function(e,U){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return F}});const te=U("packages/core/src/compute/handle.js"),M=te.bitReader,X=te.dictRanks,B=te.dictSize,D=te.identity,Z=te.isMissing,K=te.presenceReader,I=te.rowCount,G=te.valueComparator,H=te.valueReader,S=new Uint32Array(0),O=new ArrayBuffer(8),b=new Float64Array(O),c=new Uint32Array(O),f=(b[0]=-1,(c[1]&2147483648)!==0?1:0),o=f===1?0:1;function n(j,R){b[0]=j;let $=c[f],T=c[o];($&2147483648)!==0?($=~$>>>0,T=~T>>>0):$=($^2147483648)>>>0,R[0]=T,R[1]=$}function t(j,R,$,T){if(T<2)return j;const A=new Uint32Array(256*8);for(let ne=0;ne<T;ne++){const oe=R[ne],re=$[ne];A[oe&255]++,A[256+(oe>>>8&255)]++,A[512+(oe>>>16&255)]++,A[768+(oe>>>24&255)]++,A[1024+(re&255)]++,A[1280+(re>>>8&255)]++,A[1536+(re>>>16&255)]++,A[1792+(re>>>24&255)]++}let C=j,z=R,Y=$,q=new Uint32Array(T),V=new Uint32Array(T),J=new Uint32Array(T);const ee=new Uint32Array(256);for(let ne=0;ne<8;ne++){const oe=ne<<8,re=(ne&3)<<3,ae=ne>=4;let fe=!1;for(let Ie=0;Ie<256;Ie++)if(A[oe+Ie]===T){fe=!0;break}if(fe)continue;let de=0;for(let Ie=0;Ie<256;Ie++)ee[Ie]=de,de+=A[oe+Ie];for(let Ie=0;Ie<T;Ie++){const Le=z[Ie],se=Y[Ie],pe=(ae?se:Le)>>>re&255,be=ee[pe]++;q[be]=C[Ie],V[be]=Le,J[be]=se}let ve=C;C=q,q=ve,ve=z,z=V,V=ve,ve=Y,Y=J,J=ve}return C}function i(j,R,$){if($<2)return j;const T=new Uint32Array(256*4);for(let V=0;V<$;V++){const J=R[V];T[J&255]++,T[256+(J>>>8&255)]++,T[512+(J>>>16&255)]++,T[768+(J>>>24&255)]++}let A=j,C=R,z=new Uint32Array($),Y=new Uint32Array($);const q=new Uint32Array(256);for(let V=0;V<4;V++){const J=V<<8,ee=V<<3;let ne=!1;for(let ae=0;ae<256;ae++)if(T[J+ae]===$){ne=!0;break}if(ne)continue;let oe=0;for(let ae=0;ae<256;ae++)q[ae]=oe,oe+=T[J+ae];for(let ae=0;ae<$;ae++){const fe=C[ae],de=q[fe>>>ee&255]++;z[de]=A[ae],Y[de]=fe}let re=A;A=z,z=re,re=C,C=Y,Y=re}return A}function s(j,R,$,T){const A=new Uint32Array(T+1);for(let Y=0;Y<$;Y++)A[R[Y]]++;let C=0;for(let Y=0;Y<=T;Y++){const q=A[Y];A[Y]=C,C+=q}const z=new Uint32Array($);for(let Y=0;Y<$;Y++)z[A[R[Y]]++]=j[Y];return z}function r(j,R,$,T){return $<2?j:T<=65536||T<=$*2?s(j,R,$,T):i(j,R,$)}function u(j,R){return j.length===R&&j.byteOffset===0?j:Uint32Array.prototype.slice.call(j,0,R)}function a(j,R,$=!1){const T=R||D(j.length),A=T.length;if(A<2)return Uint32Array.from(T);const C=new Uint32Array(A),z=new Uint32Array(A),Y=new Uint32Array(A),q=new Uint32Array(A),V=new Uint32Array(2);let J=0,ee=0;for(let re=0;re<A;re++){const ae=T[re],fe=j[ae];if(Number.isNaN(fe)){q[ee++]=ae;continue}n(fe,V),$?(z[J]=~V[0]>>>0,Y[J]=~V[1]>>>0):(z[J]=V[0],Y[J]=V[1]),C[J++]=ae}const ne=t(C.subarray(0,J),z.subarray(0,J),Y.subarray(0,J),J);if(ee===0)return u(ne,J);const oe=new Uint32Array(A);return oe.set(ne.subarray(0,J),0),oe.set(q.subarray(0,ee),J),oe}function l(j,R,$=!1){const T=R||D(j.length),A=T.length;if(A<2)return Uint32Array.from(T);const C=Uint32Array.from(T),z=new Uint32Array(A);for(let Y=0;Y<A;Y++){const q=(j[C[Y]]^2147483648)>>>0;z[Y]=$?~q>>>0:q}return u(i(C,z,A),A)}function h(j,R,$={}){const T=R||D(I(j,$)),A=T.length;if(A<2)return Uint32Array.from(T);const C=X(j.dict,$.locale),z=j.values,Y=K(j),q=Math.max(B(j.dict),C.length),V=q,J=Uint32Array.from(T),ee=new Uint32Array(A),ne=!!$.descending;for(let oe=0;oe<A;oe++){const re=J[oe];let ae=Y&&Y(re)===0?V:C[z[re]];ae===void 0&&(ae=V),ee[oe]=ne?V-ae:ae}return u(r(J,ee,A,q+1),A)}function y(j,R,$){const T=R.length;let A=Uint32Array.from(R);if(T<2)return A;let C=new Uint32Array(T);for(let z=1;z<T;z<<=1){for(let q=0;q<T;q+=z<<1){const V=Math.min(q+z,T),J=Math.min(q+(z<<1),T);let ee=q,ne=V,oe=q;for(;ee<V&&ne<J;)C[oe++]=$(j[A[ee]],j[A[ne]])<=0?A[ee++]:A[ne++];for(;ee<V;)C[oe++]=A[ee++];for(;ne<J;)C[oe++]=A[ne++]}const Y=A;A=C,C=Y}return A}function m(j,R,$){const T=M(j.values),A=R.length,C=new Uint32Array(A),z=$?1:0;let Y=0;for(let q=0;q<A;q++)T(R[q])===z&&(C[Y++]=R[q]);for(let q=0;q<A;q++)T(R[q])!==z&&(C[Y++]=R[q]);return C}function v(j,R){const $=j.values,T=j.kind;if((T==="object"||T===void 0)&&(Array.isArray($)||ArrayBuffer.isView($))&&!j.presence)return $;const C=H(j),z=new Array(I(j)||0);for(let Y=0;Y<R.length;Y++){const q=R[Y];z[q]=C(q)}return z}function d(j,R){for(let $=0;$<R.length;$++)if(typeof j[R[$]]!="string")return!1;return!0}function p(j,R,$,T,A){const C=j.length,z=Uint32Array.from(j);if(C<2||T<1)return z;const Y=new Uint32Array(C),q=T-1;for(let V=0;V<C;V++){const J=$[R[V]];Y[V]=A?q-J:J}return u(r(z,Y,C,T),C)}function g(j,R,$){const T=G($),A=new Array(R);for(let z=0;z<R;z++)A[z]=z;A.sort((z,Y)=>T(j[z],j[Y])||z-Y);const C=new Uint32Array(R);for(let z=0;z<R;z++)C[A[z]]=z;return C}function k(j,R,$){const T=R.length,A=new Map,C=[],z=new Uint32Array(T);for(let V=0;V<T;V++){const J=j[R[V]];let ee=A.get(J);ee===void 0&&(ee=C.length,A.set(J,ee),C.push(J)),z[V]=ee}const Y=C.length,q=g(C,Y,$.locale);return p(R,z,q,Y,!!$.descending)}function w(j,R,$){const T=v(j,R);if(R.length>=2&&d(T,R)){const z=j.stringRank;return z&&z.version===j.version&&z.usable(R,T,$.locale)?z.sort(R,$):k(T,R,$)}const A=G($.locale),C=$.descending?(z,Y)=>A(Y,z):A;return y(T,R,C)}function E(j,R,$){const T=v(j,R),A=$.compare,z=!!$.descending?(Y,q)=>-A(Y,q,void 0,void 0,!0):(Y,q)=>A(Y,q,void 0,void 0,!1);return y(T,R,z)}function N(j,R){const $=R.length,T=K(j),A=j.values,C=j.kind==="float64"&&!!A,z=j.kind==="object"||j.kind==="multi"||j.kind===void 0;if(!T&&!C&&!z)return{present:R,absent:S};const Y=new Uint32Array($),q=new Uint32Array($);let V=0,J=0;if(T&&C)for(let ee=0;ee<$;ee++){const ne=R[ee];T(ne)===1&&!Number.isNaN(A[ne])?Y[V++]=ne:q[J++]=ne}else if(C&&!T)for(let ee=0;ee<$;ee++){const ne=R[ee];Number.isNaN(A[ne])?q[J++]=ne:Y[V++]=ne}else if(T&&!z)for(let ee=0;ee<$;ee++){const ne=R[ee];T(ne)===1?Y[V++]=ne:q[J++]=ne}else{const ee=H(j);for(let ne=0;ne<$;ne++){const oe=R[ne];Z(ee(oe))?q[J++]=oe:Y[V++]=oe}}return J===0?{present:R,absent:S}:{present:Y.subarray(0,V),absent:q.subarray(0,J)}}function x(j,R,$){if(R.length===0)return j;const T=new Uint32Array(j.length+R.length);return $?(T.set(R,0),T.set(j,R.length)):(T.set(j,0),T.set(R,j.length)),T}function _(j,R,$={}){const T=R||D(I(j,$));if(!j||T.length<2)return Uint32Array.from(T);const{present:A,absent:C}=N(j,T);if(A.length===0)return Uint32Array.from(T);const z=!!$.descending;let Y;if(typeof $.compare=="function")Y=E(j,A,$);else switch(j.kind){case"float64":Y=a(j.values,A,z);break;case"int32":Y=l(j.values,A,z);break;case"dictionary":Y=h(j,A,$);break;case"bitset":Y=m(j,A,z);break;default:Y=w(j,A,$);break}return x(Y,C,!!$.nullsFirst)}function F(j,R,$,T={}){const A=R||[],C=A.length&&(A[0].handle||L(j,A[0].col))||j&&j[0];let z=$||D(I(C,T));for(let Y=A.length-1;Y>=0;Y--){const q=A[Y],V=q.handle||L(j,q.col)||j&&j[Y];V&&(z=_(V,z,{descending:q.descending!==void 0?!!q.descending:q.dir==="desc",nullsFirst:!!q.nullsFirst,locale:q.locale!==void 0?q.locale:T.locale,compare:q.compare}))}return z instanceof Uint32Array?z:Uint32Array.from(z)}function L(j,R){if(!(!j||R===void 0)){for(let $=0;$<j.length;$++)if(j[$]&&j[$].id===R)return j[$]}}}),De("packages/core/src/store/stringrank.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return D}});const te=U("packages/core/src/compute/sort.js"),M=te.collateStringRanks,X=te.rankSortStrings,B=1e5;class D{#e=[];#t=new Map;#n;#r=0;#s=0;#i=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(K=B){this.#o=K>0?K:B,this.#n=new Uint32Array(0)}get version(){return this.#i}set version(K){this.#i=K}get generation(){return this.#s}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let K=this.#n.byteLength;const I=this.#e;for(let G=0;G<I.length;G++)K+=I[G].length*2+24;return K}#f(K,I){const G=this.#t.get(K);if(G!==void 0)return G;if(this.#l)return-1;if(I&&this.#e.length>=this.#o)return this.#l=!0,-1;const H=this.#e.length;return this.#e.push(K),this.#t.set(K,H),this.#s++,H}build(K,I){const G=I|0;this.#e=[],this.#t=new Map,this.#s=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(G);for(let H=0;H<G;H++){const S=K[H],O=typeof S=="string"?this.#f(S,!1):-1;this.#n[H]=O<0?0:O}this.#r=G}append(K,I,G){const H=(I|0)+(G|0);if(H>this.#n.length){const S=new Uint32Array(H);S.set(this.#n.subarray(0,this.#r)),this.#n=S}for(let S=I|0;S<H;S++){const O=K[S],b=typeof O=="string"?this.#f(O,!0):-1;this.#n[S]=b<0?0:b}this.#r=Math.max(this.#r,H)}ranks(K){const I=K||"";if(this.#a&&this.#c===this.#s&&this.#u===I)return this.#a;const G=M(this.#e,this.#e.length,K);return this.#a=G,this.#c=this.#s,this.#u=I,G}usable(K,I,G){if(this.#l||this.#e.length===0)return!1;const H=this.#n,S=this.#e,O=this.#r;for(let b=0;b<K.length;b++){const c=K[b];if(c>=O||S[H[c]]!==I[c])return!1}return!0}sort(K,I){const G=this.ranks(I.locale),H=this.#e.length,S=K.length,O=new Uint32Array(S),b=this.#n;for(let c=0;c<S;c++)O[c]=b[K[c]];return X(K,O,G,H,!!I.descending)}}}),De("packages/core/src/store/columnstore.js",function(e,U){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return m}});const M=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/paths.js").pathGetter,I=U("packages/core/src/store/bitset.js").Bitset,H=U("packages/core/src/store/dictionary.js").Dictionary,O=U("packages/core/src/store/multivalue.js").MultiValue,c=U("packages/core/src/store/stringrank.js").StringRankIndex,f=4294967295,o=1024,n=5e3,t=.2,i=new Set(["float64","int32","bitset","dictionary","object","multi"]);function s(v){return v==null}function r(v){if(typeof v=="number")return v;if(v instanceof Date)return v.getTime();if(typeof v=="boolean")return v?1:0;const d=Number(v);return Number.isNaN(d)&&typeof v=="string"?Date.parse(v):d}function u(v){const d=r(v);return Number.isFinite(d)?d|0:0}function a(v){return s(v)?[]:Array.isArray(v)?v:[v]}function l(v,d){switch(v.kind){case"float64":case"int32":return v.buf[d];case"bitset":return v.bits.get(d)===1;case"dictionary":return v.dict.valueOf(v.buf[d]);case"multi":{const p=v.mv.at(d),g=new Array(p.length);for(let k=0;k<p.length;k++)g[k]=v.dict.valueOf(p[k]);return g}default:return v.buf[d]}}function h(v,d){switch(v.kind){case"float64":case"int32":return v.values[d];case"bitset":return(v.values[d>>3]&1<<(d&7))!==0;case"dictionary":return(v.table||[])[v.values[d]];case"multi":{const p=v.offsets[d],g=v.offsets[d+1],k=v.table||[],w=new Array(g-p);for(let E=p;E<g;E++)w[E-p]=k[v.values[E]];return w}default:return v.values[d]}}class y{#e;#t;#n;#r;#s;#i;#o;#l=!1;#a=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#j=null;#w=null;#O=!1;constructor(d,p){this.#e=d.id;const g=i.has(d.kind)?d.kind:"object";d.kind&&!i.has(d.kind)&&M(`store.kind.${d.id}`,`column "${d.id}" declares unknown storage kind "${d.kind}"; falling back to object`),this.#n=g,this.#t=g,this.#r=d.nullable!==!1,this.#o=d.dictionary??null,this.#i=p,this.#s=B(d.read)?d.read:Z(d.field||d.id),this.#h=d.stringRankIndex!=="off",this.#p=typeof d.stringRankMaxDistinct=="number"?d.stringRankMaxDistinct:0,this.#j=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#O?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#a:this.#P().values}get presence(){return this.#O||!this.#r?null:this.#l?this.#g:this.#P().presence}get dict(){return this.#O||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#O||!this.#h||this.kind!=="object")return null;const d=this.values,p=this.#i.physical();if(!d||p===0)return null;if(this.#d===null){if(typeof d[0]!="string")return null;const g=new c(this.#v());return g.build(d,p),g.version=this.#y,this.#d=g,this.#m=this.#y,g.capped?null:g}return this.#d.length<p&&this.#d.append(d,this.#d.length,p-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#T(){this.#d=null,this.#m=-1}get offsets(){return this.#O||!this.#l||this.#t!=="multi"?null:this.#u.offsets}get version(){return this.#y}get bytes(){let d=0;return this.#a&&(d+=this.#a.byteLength??this.#a.length*8),this.#c&&(d+=this.#c.bytes),this.#u&&(d+=this.#u.bytes),this.#g&&(d+=this.#g.bytes),this.#f&&(d+=this.#f.bytes),this.#j&&(d+=this.#j.size*24),d}get(d){if(!this.#O&&!(d<0||d>=this.#i.physical())){if(!this.#l)return this.#N(d);if(this.#r&&this.#g.get(d)===0)return null;switch(this.#t){case"float64":case"int32":return this.#a[d];case"bitset":return this.#c.get(d)===1;case"dictionary":return this.#f.valueOf(this.#a[d]);case"multi":{const p=this.#u.at(d),g=new Array(p.length);for(let k=0;k<p.length;k++)g[k]=this.#f.valueOf(p[k]);return g}default:return this.#a[d]}}}set(d,p){this.#O||(this.#l?this.#E(d,p):this.#j.set(d,p===void 0?null:p),this.#d&&this.#T(),this.#y++)}read(d){return this.#s(d)}appendColumn(d,p,g){if(this.#O||g<=0)return;if(!this.#l){this.#y++;return}const k=this.#s,w=this.#r,E=this.#g;let N=!1;switch(this.#t){case"float64":{const x=this.#a;for(let _=0;_<g;_++){const F=k(d[_]);if(typeof F=="number"){w&&E.set(p+_),x[p+_]=F;continue}const L=F==null;w?E.assign(p+_,!L):L&&(N=!0),x[p+_]=L?NaN:r(F)}break}case"int32":{const x=this.#a;for(let _=0;_<g;_++){const F=k(d[_]),L=F==null;w?E.assign(p+_,!L):L&&(N=!0),x[p+_]=L?0:u(F)}break}case"bitset":{const x=this.#c;for(let _=0;_<g;_++){const F=k(d[_]),L=F==null;w?E.assign(p+_,!L):L&&(N=!0),x.assign(p+_,!L&&!!F)}break}case"dictionary":{const x=this.#a,_=this.#f;for(let F=0;F<g;F++){const L=k(d[F]),j=L==null;w?E.assign(p+F,!j):j&&(N=!0),x[p+F]=j?0:_.codeOf(L)}break}case"multi":{const x=this.#u,_=this.#f;for(let F=0;F<g;F++){const L=k(d[F]),j=L==null;w?E.assign(p+F,!j):j&&(N=!0);const R=a(L),$=new Array(R.length);for(let T=0;T<R.length;T++)$[T]=_.codeOf(R[T]);x.write(p+F,$)}break}default:{const x=this.#a;for(let _=0;_<g;_++){const F=k(d[_]),L=F==null;w?E.assign(p+_,!L):L&&(N=!0),x[p+_]=L?null:F}break}}N&&M(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#a,p,g),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(d,p,g){if(this.#O||g<=0||!d)return;if(!this.#l){this.#y++;return}const k=this.#g,w=d.presence;if(k)if(w)for(let N=0;N<g;N++)k.assign(p+N,(w[N>>3]&1<<(N&7))!==0);else for(let N=0;N<g;N++)k.set(p+N);const E=d.kind===this.#t;if(E&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(d.values,p),this.#y++;return}if(E&&this.#t==="bitset"){const N=d.values;for(let x=0;x<g;x++)this.#c.assign(p+x,(N[x>>3]&1<<(x&7))!==0);this.#y++;return}if(E&&this.#t==="dictionary"){const N=d.table||[],x=new Uint32Array(N.length);for(let j=0;j<N.length;j++)x[j]=this.#f.codeOf(N[j]);const _=d.values,F=this.#a,L=k;for(let j=0;j<g;j++){if(L&&(w&&(w[j>>3]&1<<(j&7))===0)){F[p+j]=0;continue}F[p+j]=x[_[j]]??0}this.#y++;return}if(E&&this.#t==="multi"){const N=d.table||[],x=new Uint32Array(N.length);for(let L=0;L<N.length;L++)x[L]=this.#f.codeOf(N[L]);const _=d.values,F=d.offsets;for(let L=0;L<g;L++){const j=F[L],R=F[L+1],$=new Array(R-j);for(let T=j;T<R;T++)$[T-j]=x[_[T]]??0;this.#u.write(p+L,$)}this.#y++;return}for(let N=0;N<g;N++){const x=w?(w[N>>3]&1<<(N&7))===0:d.kind==="object"?d.values[N]===null:!1;this.#E(p+N,x?null:h(d,N))}this.#y++}touch(){this.#y++}columnarise(d,p){if(this.#l||this.#O)return;const g=new Array(p);for(let k=0;k<p;k++)g[k]=this.#N(k);this.#t=this.#n,this.#l=!0,this.#S(d);for(let k=0;k<p;k++)this.#E(k,g[k]);this.#j.clear(),this.#w=null,this.#T(),this.#y++}grow(d){if(!(!this.#l||this.#O||d<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const p=new this.#a.constructor(d);p.set(this.#a),this.#a=p;break}case"bitset":this.#c.grow(d);break;case"multi":break;default:this.#a.length=d;break}this.#g&&this.#g.grow(d),this.#b=d,this.#y++}}convert(d){if(this.#O||!i.has(d)||(this.#n=d,!this.#l||d===this.#t))return!1;const p={kind:this.#t,buf:this.#a,bits:this.#c,mv:this.#u,dict:this.#f},g=this.#i.physical(),k=this.#g;this.#t=d,this.#S(this.#b);for(let w=0;w<g;w++){const E=k!==null&&k.get(w)===0;E&&d!=="multi"||this.#E(w,E?null:l(p,w))}return this.#T(),this.#y++,!0}compact(d,p,g){if(!this.#O){if(this.#T(),!this.#l){const k=this.#j;if(k.size){const w=new Map;for(const[E,N]of k)d[E]!==f&&w.set(d[E],N);this.#j=w}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const k=this.#a;for(let w=0;w<p;w++)d[w]!==f&&(k[d[w]]=k[w]);if(this.#t==="object")for(let w=g;w<p;w++)k[w]=void 0;break}case"bitset":{const k=this.#c;for(let w=0;w<p;w++)d[w]!==f&&k.assign(d[w],k.get(w)===1);for(let w=g;w<p;w++)k.clear(w);break}case"multi":this.#u.compact(d,g,f);break;default:break}if(this.#g){const k=this.#g;for(let w=0;w<p;w++)d[w]!==f&&k.assign(d[w],k.get(w)===1);for(let w=g;w<p;w++)k.clear(w)}this.#y++}}release(){this.#O||(this.#O=!0,this.#a=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#j=new Map,this.#w=null,this.#b=0,this.#y++)}#S(d){const p=Math.max(1,d);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(p);break;case"int32":this.#a=new Int32Array(p);break;case"bitset":this.#c=new I(p);break;case"dictionary":this.#a=new Uint32Array(p),this.#f=this.#f??new H(this.#o??[]);break;case"multi":this.#u=new O({rows:p,values:p}),this.#f=this.#f??new H(this.#o??[]);break;default:this.#a=new Array(p);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(p):this.#g=new I(p)),this.#b=p}#E(d,p){const g=s(p);switch(this.#r?this.#g.assign(d,!g):g&&M(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[d]=g?NaN:r(p);break;case"int32":this.#a[d]=g?0:u(p);break;case"bitset":this.#c.assign(d,!g&&!!p);break;case"dictionary":this.#a[d]=g?0:this.#f.codeOf(p);break;case"multi":{const k=a(p),w=new Array(k.length);for(let E=0;E<k.length;E++)w[E]=this.#f.codeOf(k[E]);this.#u.write(d,w);break}default:this.#a[d]=g?null:p;break}}#N(d){if(this.#j.has(d))return this.#j.get(d);const p=this.#s(this.#i.rowAt(d));return p===void 0?null:p}#P(){if(this.#w&&this.#w.version===this.#y)return this.#w;const d=this.#i.physical(),p=new Array(d),g=this.#r?new I(d):null;for(let k=0;k<d;k++){const w=this.#N(k);p[k]=w,g&&!s(w)&&g.set(k)}return this.#w={version:this.#y,values:p,presence:g},this.#w}}class m{#e;#t=new Map;#n=[];#r=[];#s=0;#i=0;#o=0;#l=0;#a=new I(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(d,p={}){this.#e=Array.isArray(d)?d:[],this.#d=Math.max(1,p.initialCapacity??o),this.#u=p.retainSource!==!1,this.#f=this.#u?p.columnarBelow??n:0,this.#h=p.compactRatio??t;const g={rowAt:k=>this.#r[k],physical:()=>this.#s};for(const k of this.#e){if(!k||!k.id)continue;if(this.#t.has(k.id)){M(`store.dup.${k.id}`,`duplicate column id "${k.id}" in the store schema; ignoring the second`);continue}const w=new y(k,g);this.#t.set(k.id,w),this.#n.push(w)}this.#f<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#s}get capacity(){return this.#c?this.#i:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let d=this.#a.bytes+this.#r.length*8;for(const p of this.#n)d+=p.bytes;return d}append(d){const p=this.#s;if(this.#p||!d)return{from:p,to:p};const g=d.length|0;if(g===0)return{from:p,to:p};if(this.#u)for(let w=0;w<g;w++)this.#r[p+w]=d[w];if(this.#s=p+g,this.#o+=g,this.#a.grow(this.#s),!this.#c){if(this.#s>=this.#f)this.#b();else for(const w of this.#n)w.touch();return{from:p,to:this.#s}}this.#m(this.#s);const k=this.#n;for(let w=0;w<k.length;w++)k[w].appendColumn(d,p,g);return{from:p,to:this.#s}}appendPacked(d,p){const g=this.#s;if(this.#p||!d)return{from:g,to:g};const k=d.count|0;if(k===0)return{from:g,to:g};if(this.#u&&p)for(let E=0;E<k;E++)this.#r[g+E]=p[E];this.#s=g+k,this.#o+=k,this.#a.grow(this.#s),this.#c||this.#b(),this.#m(this.#s);const w=new Map;for(const E of d.columns)w.set(E.id,E);for(const E of this.#n){const N=w.get(E.id);N?E.appendPacked(N,g,k):E.grow(this.#i)}return{from:g,to:this.#s}}source(d){if(this.#u)return this.#r[d];if(!(d<0||d>=this.#s))return this.#g(d)}setSource(d,p){this.#p||d<0||d>=this.#s||this.#u&&(this.#r[d]=p)}get(d,p){const g=this.#t.get(d);return g?g.get(p):void 0}set(d,p,g){if(this.#p||p<0||p>=this.#s)return;const k=this.#t.get(d);if(!k){M(`store.set.${d}`,`set() on unknown column "${d}"`);return}k.set(p,g)}remove(d){return this.#p||d<0||d>=this.#s||this.#a.get(d)===1?!1:(this.#a.set(d),this.#l++,this.#o--,!0)}live(d){return d<0||d>=this.#s?!1:this.#a.get(d)===0}compact(d={}){if(this.#p||this.#l===0||!d.force&&this.#l/this.#s<this.#h)return null;const p=this.#s,g=new Uint32Array(p);let k=0;for(let w=0;w<p;w++)g[w]=this.#a.get(w)===1?f:k++;for(const w of this.#n)w.compact(g,p,k);if(this.#u){const w=this.#r;for(let E=0;E<p;E++)g[E]!==f&&(w[g[E]]=w[E]);w.length=k}return this.#s=k,this.#o=k,this.#l=0,this.#a=new I(Math.max(this.#i,k)),g}column(d){return this.#t.get(d)}columns(){return this.#n.slice()}liveIndices(){const d=new Uint32Array(this.#o);if(this.#l===0){for(let g=0;g<this.#s;g++)d[g]=g;return d}let p=0;for(let g=0;g<this.#s;g++)this.#a.get(g)===0&&(d[p++]=g);return d}convert(d,p){const g=this.#t.get(d);return g?g.convert(p):!1}destroy(){if(!this.#p){this.#p=!0;for(const d of this.#n)d.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#a.release(),this.#s=0,this.#o=0,this.#l=0,this.#i=0}}#m(d){if(d<=this.#i)return;let p=this.#i||this.#d;for(;p<d;)p*=2;for(const g of this.#n)g.grow(p);this.#a.grow(p),this.#i=p}#g(d){const p={};for(const g of this.#n)p[g.id]=g.get(d);return p}#b(){if(this.#c)return;let d=this.#d;for(;d<this.#s;)d*=2;this.#c=!0,this.#i=d,this.#a.grow(d);for(const p of this.#n)p.columnarise(d,this.#s)}}}),De("packages/core/src/store/pool.js",function(e,U){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return D}});const te=64,M=8;function X(K){let I=te;for(;I<K;)I*=2;return I}class B{#e=new Map;#t=new WeakSet;#n;#r=0;#s={acquired:0,reused:0,released:0};constructor(I={}){this.#n=I.limit??M}get bytes(){return this.#r}mask(I){const G=new Uint8Array(this.#i(I),0,I);return G.fill(0),G}indices(I){return new Uint32Array(this.#i(I*4),0,I)}release(I){if(!I||!I.buffer)return!1;const G=I.buffer;if(!this.#t.has(G))return!1;this.#t.delete(G),this.#s.released++;const H=G.byteLength;let S=this.#e.get(H);return S||this.#e.set(H,S=[]),S.length>=this.#n||(S.push(G),this.#r+=H),!0}releaseAll(I){for(const G of I)this.release(G)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#s,retained:this.#r}}#i(I){const G=X(I),H=this.#e.get(G);this.#s.acquired++;let S;return H&&H.length?(S=H.pop(),this.#r-=G,this.#s.reused++):S=new ArrayBuffer(G),this.#t.add(S),S}}function D(){return Z??=new B,Z}let Z=null}),De("packages/core/src/compute/sortspec.js",function(e,U){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return D}});function te(Z){return{locale:Z===void 0?void 0:String(Z),numeric:!0,sensitivity:"variant"}}function M(Z){return!!Z&&typeof Z.compare!="function"}function X(Z){if(!Z)return!0;for(let K=0;K<Z.length;K++)if(!M(Z[K]))return!1;return!0}function B(Z,K){const I=Z.col!==void 0?Z.col:Z.handle&&Z.handle.id,G=Z.locale!==void 0?Z.locale:K;return{col:I,descending:Z.descending!==void 0?!!Z.descending:Z.dir==="desc",nullsFirst:!!Z.nullsFirst,collation:te(G)}}function D(Z,K){const I=Z||[],G=new Array(I.length);for(let H=0;H<I.length;H++)G[H]=B(I[H],K);return G}}),De("packages/core/src/compute/facet.js",function(e,U){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return p}});const te=U("packages/core/src/compute/handle.js"),M=te.presenceReader,X=te.valueReader,B=te.dictSize,D=te.dictValue,Z=Object.freeze(["equal","quantile","log"]),K=Object.freeze(["hour","day","week","month","quarter","year"]),I=20,G=50,H=1e4;function S(g,k){if(!g)return"none";const w=k;if(w&&(w.multi===!0||typeof w.items=="function"))return"category";const E=k&&k.base;if(E==="date"||E==="datetime"||E==="time"||E==="dateString")return"date";switch(g.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return E==="number"?"numeric":E==="boolean"?"boolean":E==="text"?"category":"none"}}function O(g){const k=g.values,w=g.kind;if((w==="float64"||w==="int32")&&k)return N=>k[N];const E=X(g);return N=>b(E(N))}function b(g){if(typeof g=="number")return g;if(g instanceof Date)return g.getTime();if(g==null||g==="")return NaN;if(typeof g=="boolean")return g?1:0;if(typeof g=="string"){const k=Number(g);if(Number.isFinite(k))return k;const w=Date.parse(g);return Number.isFinite(w)?w:NaN}return NaN}function c(g,k,w,E=G){if(!g)return{cardinality:0,exact:!0};if(g.dict)return{cardinality:B(g.dict),exact:!0};if(g.kind==="bitset")return{cardinality:2,exact:!0};const N=X(g),x=k?k.length:w,_=new Set;for(let F=0;F<x;F++){const L=N(k?k[F]:F);if(L!=null&&(_.add(L),_.size>E))return{cardinality:_.size,exact:!1}}return{cardinality:_.size,exact:!0}}const f=36e5,o=864e5;function n(g,k=I){const w=Number.isFinite(g)&&g>0?g:0,E=Math.max(1,k)*2;return w/f<=E?"hour":w/o<=E?"day":w/(7*o)<=E?"week":w/(30*o)<=E?"month":w/(91*o)<=E?"quarter":"year"}function t(g,k){if(!Number.isFinite(g))return NaN;const w=new Date(g);switch(k){case"hour":return w.setMinutes(0,0,0),w.getTime();case"day":return w.setHours(0,0,0,0),w.getTime();case"week":{w.setHours(0,0,0,0);const E=(w.getDay()+6)%7;return w.setDate(w.getDate()-E),w.getTime()}case"month":return w.setDate(1),w.setHours(0,0,0,0),w.getTime();case"quarter":return w.setMonth(Math.floor(w.getMonth()/3)*3,1),w.setHours(0,0,0,0),w.getTime();default:return w.setMonth(0,1),w.setHours(0,0,0,0),w.getTime()}}function i(g,k){const w=new Date(g);switch(k){case"hour":w.setHours(w.getHours()+1);break;case"day":w.setDate(w.getDate()+1);break;case"week":w.setDate(w.getDate()+7);break;case"month":w.setMonth(w.getMonth()+1);break;case"quarter":w.setMonth(w.getMonth()+3);break;default:w.setFullYear(w.getFullYear()+1);break}return w.getTime()}function s(g,k,w){const E=O(g),N=M(g),x=k?k.length:w;let _=1/0,F=-1/0,L=0,j=0;for(let R=0;R<x;R++){const $=k?k[R]:R;if(N&&!N($)){L++;continue}const T=E($);if(!Number.isFinite(T)){L++;continue}T<_&&(_=T),T>F&&(F=T),j++}return{min:_,max:F,nulls:L,finite:j}}function r(g,k,w,E){const N=O(g),x=M(g),_=k?k.length:w,F=_>E?_/E:1,L=[];for(let R=0;R<_;R+=F){const $=k?k[Math.floor(R)]:Math.floor(R);if(x&&!x($))continue;const T=N($);Number.isFinite(T)&&L.push(T)}const j=Float64Array.from(L);return j.sort(),j}function u(g,k,w,E={}){const N=E.kind||S(g,E.type);return N==="none"||!g?{kind:"none",buckets:[],suppressed:"type"}:N==="boolean"?a(g,k,w):N==="category"?l(g,k,w,E):h(g,k,w,N,E)}function a(g,k,w){const E=M(g);let N=0;if(E){const _=k?k.length:w;for(let F=0;F<_;F++)E(k?k[F]:F)||N++}const x=[{value:!1,label:"false"},{value:!0,label:"true"}];return N>0&&x.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:x}}function l(g,k,w,E){const N=E.cardinalityLimit??G,{cardinality:x}=c(g,k,w,N);if(x>N&&(E.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:x};const _=X(g),F=k?k.length:w,L=new Map;let j=0;for(let C=0;C<F;C++){const z=_(k?k[C]:C);if(z==null||z===""){j++;continue}if(Array.isArray(z)){if(!z.length){j++;continue}for(const Y of z)L.set(Y,(L.get(Y)||0)+1);continue}L.set(z,(L.get(z)||0)+1)}let R=[...L.entries()];E.order==="alpha"?R.sort((C,z)=>String(C[0]).localeCompare(String(z[0]))):R.sort((C,z)=>z[1]-C[1]);let $=0,T=0;if(R.length>N){T=R.length-N;for(let C=N;C<R.length;C++)$+=R[C][1];R=R.slice(0,N)}const A=R.map(([C])=>({value:C,label:String(C)}));return $>0&&A.push({remainder:!0,label:`Other (${T} values)`}),j>0&&A.push({null:!0,label:"Empty"}),{kind:"category",buckets:A,cardinality:x}}function h(g,k,w,E,N){const{min:x,max:_,nulls:F,finite:L}=s(g,k,w);if(!L)return{kind:E,buckets:F?[{null:!0,label:"Empty"}]:[],empty:!0};const j=Math.max(1,Math.floor(N.buckets||I));let R=[];if(E==="date"){const T=K.includes(N.granularity)?N.granularity:n(_-x,j);let A=t(x,T);for(;A<=_&&R.length<4096;){const C=i(A,T);if(!(C>A))break;R.push({from:A,to:C}),A=C}return{kind:E,buckets:y(R,F),granularity:T}}const $=Z.includes(N.strategy)?N.strategy:"equal";if($==="quantile"){const T=r(g,k,w,H);if(T.length){const A=[T[0]];for(let C=1;C<j;C++){const z=T[Math.min(T.length-1,Math.floor(C/j*T.length))];z>A[A.length-1]&&A.push(z)}A.push(_);for(let C=0;C<A.length-1;C++)R.push({from:A[C],to:A[C+1]})}}else if($==="log"&&x>0){const T=Math.log10(x),C=(Math.log10(_)-T)/j||1;for(let z=0;z<j;z++)R.push({from:10**(T+z*C),to:10**(T+(z+1)*C)})}if(!R.length){const T=(_-x)/j||1;for(let A=0;A<j;A++)R.push({from:x+A*T,to:x+(A+1)*T})}return R[R.length-1].to=_,{kind:E,buckets:y(R,F),strategy:$,min:x,max:_}}function y(g,k){return k>0?[...g,{null:!0,label:"Empty"}]:g}function m(g,k,w,E,N){const x=E&&E.buckets||[],_=N&&N.length>=x.length?N.subarray(0,x.length):new Uint32Array(x.length);if(_.fill(0),!g||!x.length)return _;const F=x.length-1,L=!!x[F]&&x[F].null===!0,j=k?k.length:w;if(E.kind==="boolean"){const C=X(g);for(let z=0;z<j;z++){const Y=C(k?k[z]:z);if(Y==null){L&&_[F]++;continue}_[Y?1:0]++}return _}if(E.kind==="category"){const C=new Map;for(let q=0;q<x.length;q++)!x[q].null&&!x[q].remainder&&C.set(x[q].value,q);const z=x.findIndex(q=>q.remainder),Y=X(g);for(let q=0;q<j;q++){const V=Y(k?k[q]:q);if(V==null||V===""){L&&_[F]++;continue}if(Array.isArray(V)){if(!V.length){L&&_[F]++;continue}for(const ee of V){const ne=C.get(ee);ne!==void 0?_[ne]++:z>=0&&_[z]++}continue}const J=C.get(V);J!==void 0?_[J]++:z>=0&&_[z]++}return _}const R=L?x.length-1:x.length,$=new Float64Array(R+1);for(let C=0;C<R;C++)$[C]=x[C].from;$[R]=R?x[R-1].to:0;const T=O(g),A=M(g);for(let C=0;C<j;C++){const z=k?k[C]:C;if(A&&!A(z)){L&&_[F]++;continue}const Y=T(z);if(!Number.isFinite(Y)){L&&_[F]++;continue}const q=v($,R,Y);q>=0&&_[q]++}return _}function v(g,k,w){if(!k||w<g[0])return-1;if(w>=g[k])return w===g[k]?k-1:-1;let E=0,N=k-1;for(;E<N;){const x=E+N+1>>>1;w>=g[x]?E=x:N=x-1}return E}function d(g,k,w,E={}){const N=E.bounds||u(g,E.boundsIndices??k,w,E);return{bounds:N,counts:m(g,k,w,N)}}const p=d}),De("packages/core/src/compute/pivotmatrix.js",function(e,U){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return t}});const M=U("packages/core/src/compute/handle.js").valueComparator,B=U("packages/core/src/compute/total.js").total,Z=U("packages/core/src/compute/group.js").packKeys,K=U("packages/core/src/compute/pivot.js"),I=K.joinPath,G=K.DEFAULT_PATH_SEPARATOR,H=K.DEFAULT_MAX_COLUMNS,S="";function O(i,s,r={}){const u=r.separator||G,a=i||[],l=s instanceof Uint32Array?s:Uint32Array.from(s||[]),h=l.length;if(a.length===0)return{tuples:[[]],paths:[S],buckets:[l]};const{keyOf:y,readers:m}=Z(a,l,0),v=new Map,d=[],p=[],g=[];for(let _=0;_<h;_++){const F=l[_],L=y(F);let j=v.get(L);if(j===void 0){j=d.length,v.set(L,j),p.push(L);const R=new Array(m.length);for(let $=0;$<m.length;$++)R[$]=m[$](F);d.push(R),g.push([])}g[j].push(F)}const k=M(r.locale),w=d.map((_,F)=>F);w.sort((_,F)=>{const L=d[_],j=d[F];for(let R=0;R<L.length;R++){const $=b(L[R],j[R],k);if($!==0)return $}return _-F});const E=new Array(w.length),N=new Array(w.length),x=new Array(w.length);for(let _=0;_<w.length;_++){const F=w[_];E[_]=d[F],N[_]=I(d[F],u),x[_]=Uint32Array.from(g[F])}return{tuples:E,paths:N,buckets:x}}function b(i,s,r){const u=i==null,a=s==null;return u||a?u&&a?0:u?1:-1:r(i,s)}function c(i,s,r){const u=[];for(let a=0;a<i.length;a++)r.has(i[a])&&u.push(i[a]);return Uint32Array.from(u)}function f(i,s,r,u){return{value:s.length?B(i,s,r,u):null,leaves:s,count:s.length}}function o(i){const s=i&&i.opts||{},r=s.separator||G,u=s.totalContext||{locale:s.locale},a=(i.measures||[]).filter(N=>N&&N.handle),l=i.leaves instanceof Uint32Array?i.leaves:Uint32Array.from(i.leaves||[]),h=O(i.rowHandles||[],l,{...s,separator:r}),y=O(i.columnHandles||[],l,{...s,separator:r}),m=s.maxColumns===void 0?H:s.maxColumns,v=y.paths.length*Math.max(1,a.length),d=new Map;if(m&&v>m)return{rowAxis:h,columnAxis:y,measures:a.map(N=>({colId:N.colId,fn:N.fn})),body:d,rowMargin:d,columnMargin:d,grand:d,columns:v,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${v} columns, above pivot.maxColumns of ${m}. Narrow the pivot columns or raise the limit.`,columns:v,maxColumns:m}};const p=new Map,g=new Map,k=new Map,w=new Map,E=y.buckets.map(N=>new Set(N));for(let N=0;N<y.paths.length;N++){const x=y.buckets[N],_=y.paths[N];for(const F of a)k.set(t(_,F.colId),f(F.handle,x,F.fn,u))}for(let N=0;N<h.paths.length;N++){const x=h.buckets[N],_=h.paths[N];for(const F of a)g.set(t(_,F.colId),f(F.handle,x,F.fn,u));for(let F=0;F<y.paths.length;F++){const L=c(x,y.buckets[F],E[F]);if(L.length===0)continue;const j=y.paths[F];for(const R of a)p.set(n(_,j,R.colId),f(R.handle,L,R.fn,u))}}for(const N of a)w.set(N.colId,f(N.handle,l,N.fn,u));return{rowAxis:h,columnAxis:y,measures:a.map(N=>({colId:N.colId,fn:N.fn})),body:p,rowMargin:g,columnMargin:k,grand:w,columns:v,error:null}}function n(i,s,r){return`${i}\0${s}\0${r}`}function t(i,s){return`${i}\0${s}`}}),De("packages/core/src/compute/reference.js",function(e,U){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return o}});const M=U("packages/core/src/internal/paths.js").getPath,X=U("packages/core/src/compute/handle.js"),B=X.isMissing,D=X.valueComparator,K=U("packages/core/src/compute/filter.js").testValue,I="",G="\0";function H(i,s){const r=s.includes(".")?M(i,s):i?.[s];return r===void 0?null:r}function S(i,s,r={}){const u=s||[];let a=i.map((l,h)=>h);if(u.length===0)return a;for(let l=u.length-1;l>=0;l--)a=O(i,a,u[l],r);return a}function O(i,s,r,u){const a=r.locale!==void 0?r.locale:u.locale,l=D(a),h=r.descending!==void 0?!!r.descending:r.dir==="desc",y=[],m=[];for(const p of s){const g=H(i[p],r.col);B(g)?m.push(p):y.push(p)}const v=new Map;for(let p=0;p<y.length;p++)v.set(y[p],p);const d=(p,g)=>{const k=H(i[p],r.col),w=H(i[g],r.col);let E;return typeof r.compare=="function"?(E=r.compare(k,w,i[p],i[g],h),h&&(E=-E)):E=h?l(w,k):l(k,w),E!==0?E:v.get(p)-v.get(g)};return y.sort(d),r.nullsFirst?m.concat(y):y.concat(m)}function b(i,s,r={}){const u=[];for(let a=0;a<i.length;a++)c(i[a],s,r,a)&&u.push(a);return u}function c(i,s,r,u){if(!s)return!0;if(Array.isArray(s.conditions)){const a=s.conditions.filter(h=>h!=null);if(a.length===0)return!0;if(s.op==="or")return a.some(h=>c(i,h,r,u));const l=a.every(h=>c(i,h,r,u));return s.op==="not"?!l:l}return s.col===void 0&&typeof r.custom=="function"?!!r.custom(s,i,u):K(H(i,s.col),s,r.locale)}function f(i,s,r,u){const a=r||i.map((m,v)=>v),l=new Map,h=[],y=[];for(const m of a){const v=s.map((g,k)=>{const w=H(i[m],g);return u&&u[k]?u[k](w):w}),d=v.map(g=>g==null?G:String(g)).join(I);let p=l.get(d);p===void 0&&(p=h.length,l.set(d,p),h.push(v),y.push([])),y[p].push(m)}return{keys:h,buckets:y}}function o(i,s,r={}){const u=D(r.locale),a=i.filter(h=>!B(h)),l=a.map(n).filter(h=>h!==null);switch(s){case"count":return i.length;case"countValues":return a.length;case"sum":return l.reduce((h,y)=>h+y,0);case"avg":return a.length===0?null:l.reduce((h,y)=>h+y,0)/a.length;case"min":return a.length===0?null:a.reduce((h,y)=>u(y,h)<0?y:h);case"max":return a.length===0?null:a.reduce((h,y)=>u(y,h)>0?y:h);case"first":return i.length===0?null:t(i[0]);case"last":return i.length===0?null:t(i[i.length-1]);default:return null}}function n(i){if(typeof i=="number")return Number.isNaN(i)?null:i;if(i==null||i===""||typeof i=="boolean")return null;if(i instanceof Date)return i.getTime();const s=Number(i);return Number.isNaN(s)?null:s}function t(i){return i===void 0?null:i}}),De("packages/core/src/compute/index.js",function(e,U){"use strict";const te=U("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return te.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return te.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return te.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return te.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return te.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return te.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return te.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return te.rankSortStrings}});const M=U("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return M.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return M.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return M.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return M.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return M.describeSort}});const X=U("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return X.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return X.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return X.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return X.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return X.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return X.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return X.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return X.mentionsColumn}});const B=U("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return B.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return B.packKeys}});const D=U("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return D.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return D.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return D.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return D.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return D.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return D.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return D.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return D.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return D.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return D.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return D.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return D.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return D.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return D.QUANTILE_SAMPLE}});const Z=U("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return Z.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return Z.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return Z.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return Z.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return Z.collectValues}});const K=U("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return K.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return K.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return K.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return K.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return K.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return K.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return K.DEFAULT_MAX_COLUMNS}});const I=U("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return I.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return I.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return I.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return I.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return I.GRAND_PATH}});const G=U("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return G.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return G.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return G.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return G.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return G.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return G.referenceValue}});const H=U("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return H.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return H.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return H.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return H.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return H.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return H.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return H.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return H.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return H.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return H.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return H.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return H.isMissing}});const S=U("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return S.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return S.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return S.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return S.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return S.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return S.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return S.SKETCH_BOUNDS}});const O=U("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return O.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return O.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return O.openWindow}});const b=U("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return b.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return b.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return b.maintenanceOf}});const c=U("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return c.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return c.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return c.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return c.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return c.anomalyCondition}});const f=U("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return f.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return f.forecast}})}),De("packages/core/src/source/rows.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return f}});const M=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/internal/predicates.js").isFunction,D=32,Z="\0";function K(o){return new I(o)}class I{#e;#t;constructor(n){this.#e=B(n&&n.rowKey)?n.rowKey:null;const t=n&&n.config?n.config.rowHeight:void 0;this.#t=typeof t=="number"||B(t)?t:D}get keyed(){return this.#e!==null}keyOf(n,t){if(this.#e){const i=this.#e(n);if(i!=null)return String(i)}else M("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${t}`}heightOf(n){return B(this.#t)?Number(this.#t(n))||D:this.#t}leaf(n,t,i=0,s=null){const r={key:this.keyOf(n,t),data:n,level:i,parent:s,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:t};return r.height=this.heightOf(r),r}group(n){const t={key:c(n.keyPath||n.path),data:null,level:n.level,parent:n.parent||null,children:[],group:!0,expanded:n.expanded!==!1,leafCount:n.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:n.column,groupValue:n.value,groupPath:n.path,hasChildren:n.hasChildren!==!1};return n.totals&&(t.totals=n.totals),t.height=this.heightOf(t),t}footer(n){const t={key:`${n.key}${Z}footer`,data:null,level:n.level,parent:n,group:!0,footer:!0,expanded:!1,leafCount:n.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:n.groupColumn,groupValue:n.groupValue,groupPath:n.groupPath,hasChildren:!1,totals:n.totals};return t.height=this.heightOf(t),t}detail(n,t){return{key:`${n.key}${Z}detail`,data:n.data,level:n.level+1,parent:n,group:!1,detail:!0,expanded:!1,leafCount:0,height:t,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:n.key}}grandTotal(n,t){const i={key:`${Z}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:t,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:n};return i.height=this.heightOf(i),i}skeleton(n,t=0,i=!1){const s={key:`${Z}pending${Z}${n}`,data:null,level:t,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:n,selected:!1,physical:null,pending:!0};return i&&(s.loadError=!0),s.height=this.heightOf(s),s}}function G(o,n,t,i){return{key:`${Z}pinned${Z}${t}${Z}${n}`,data:o,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:i,index:null,selected:!1,physical:null,hasChildren:!1,pinned:t}}function H(o,n){return new Proxy([],{get(t,i,s){if(i==="length")return o();if(typeof i=="string"){const r=Number(i);if(Number.isInteger(r)&&r>=0)return n(r)}return Reflect.get(t,i,s)},has(t,i){if(typeof i=="string"){const s=Number(i);if(Number.isInteger(s)&&s>=0)return s<o()}return Reflect.has(t,i)}})}function S(o){return o==null?"":String(o)}const O="";function b(o){if(o==null)return O;const n=String(o);return n.startsWith(O)?O+n:n}function c(o){const n=o||[];let t="g";for(let i=0;i<n.length;i++)t+=Z+b(n[i]);return t}function f(o){const n=new Array(o.length),t=[];for(let i=0;i<o.length;i++)t.push(o[i]),n[i]=c(t);return n}}),De("packages/core/src/source/handles.js",function(e,U){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return Z}});const M=U("packages/core/src/internal/predicates.js").isFunction,B=U("packages/core/src/internal/warn.js").warnOnce;class D{#e;#t;#n;#r=new Map;#s=0;constructor(I,G,H){this.#e=I,this.#t=G,this.#n=M(H)?H:()=>!1}get store(){const I=this.#e.store;return I&&M(I.column)?I:null}invalidate(){this.#s++}handle(I){const G=this.store;if(G){const b=G.column(I);if(b)return b}const H=this.#r.get(I);if(H&&H.builtAt===this.#s)return H.handle;const S=this.#i(I);if(!S)return;if(G&&this.#n()){B(`source.dropped.${I}`,`column "${I}" cannot be served under ingest.dropSourceRows: it is an impure computed column (a shadow or a positional/rank column) that is never stored, so it can only be read from the caller's row objects — which dropSourceRows has released. Do not sort, filter, group or total on such a column with dropSourceRows enabled.`);return}const O=this.#o(S);return this.#r.set(I,{handle:O,builtAt:this.#s}),O}#i(I){const G=this.#e.columns;return G&&M(G.get)?G.get(I):void 0}#o(I){const G=this.#t()||[],H=G.length,S=new Array(H),O=M(I.getValue)?c=>I.getValue(c):c=>c?.[I.field||I.id];for(let c=0;c<H;c++)S[c]=G[c]===void 0?void 0:O(G[c]);const b=this.#s;return{id:I.id,kind:"object",nullable:!1,values:S,presence:null,dict:null,offsets:null,get(c){return S[c]},version:b}}}function Z(K,I,G){return new D(K,I,G)}}),De("packages/core/src/compute/incremental.js",function(e,U){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return G}});const M=U("packages/core/src/store/columnstore.js").toFloat,X=Object.freeze(["sum","avg","countValues","min","max"]),B=Object.freeze(["float64"]),D=1e15;function Z(H,S){return typeof H!="string"||!X.includes(H)?!1:!!S&&B.includes(S.kind)}function K(H){if(H==null)return null;const S=M(H);return Number.isNaN(S)?null:S}class I{#e;#t=0;#n=0;#r=0;#s=1/0;#i=-1/0;#o=!1;#l=!1;constructor(S){this.#e=S}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(S){this.#a();for(let O=0;O<S.length;O++){const b=K(S[O]);b!==null&&this.#c(b)}this.#o=!0}seedColumn(S,O,b){this.#a();for(let c=0;c<b.length;c++){const f=b[c];if(O&&O(f)===0)continue;const o=S[f];Number.isNaN(o)||this.#c(o)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#s=1/0,this.#i=-1/0,this.#l=!1}#c(S){if(!Number.isFinite(S)){this.#l=!0;return}const O=this.#t+S;this.#n+=Math.abs(this.#t)>=Math.abs(S)?this.#t-O+S:S-O+this.#t,this.#t=O,this.#r++,S<this.#s&&(this.#s=S),S>this.#i&&(this.#i=S)}#u(S){const O=this.#t-S;this.#n+=Math.abs(this.#t)>=Math.abs(S)?this.#t-O-S:-S-O+this.#t,this.#t=O,this.#r--}update(S,O){if(!this.#o)return!1;const b=K(S),c=K(O);return b===null&&c===null?!0:b!==null&&!Number.isFinite(b)||c!==null&&!Number.isFinite(c)?!1:this.#e==="min"||this.#e==="max"?b===null||c===null?!1:this.#e==="min"?c<this.#s?(this.#s=c,!0):b>this.#s:c>this.#i?(this.#i=c,!0):b<this.#i:Math.abs(this.#t)>D?!1:(b!==null&&this.#u(b),c!==null&&this.#c(c),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#s:null;case"max":return this.#r?this.#i:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const G=I}),De("packages/core/src/source/filterwire.js",function(e,U){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return k}});const M=U("packages/core/src/internal/warn.js").warnOnce,X="source.remote.hostFilter",B="source.where.pageRelative";function D(N,x){!Array.isArray(N)||!N.length||M(B,`filters.where (${N.join(", ")}) runs over the rows the ${x} source fetched,`,"not the whole dataset: match counts and totals are page-relative.","Give the predicate a { condition } twin so the engine can narrow the fetch itself.")}function Z(N){const x=(N||{}).config;!x||!x.hostFilter||M(X,"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 K="source.where.notApplied";function I(N,x){M(`${K}:${N}`,`filters.where("${N}") is registered but the ${x} 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 G="source.where.overThreshold";function H(N,x,_,F){!Array.isArray(N)||!N.length||M(`${G}:${x}`,`filters.where (${N.join(", ")}) is not applied to the ${x} pushdown source:`,_===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${_.toLocaleString()} rows, at or past the whereRowLimit of ${F.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const S=new Map;function O(N){let x=S.get(N);return x||(x=new Intl.DateTimeFormat("en-US",{timeZone:N,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),S.set(N,x)),x}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function c(N,x){const _=O(x).formatToParts(new Date(N)),F={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const L of _)L.type==="year"?F.y=+L.value:L.type==="month"?F.m=+L.value:L.type==="day"?F.d=+L.value:L.type==="hour"?F.h=+L.value%24:L.type==="minute"?F.mi=+L.value:L.type==="second"&&(F.s=+L.value);return F}function f(N,x){const _=c(N,x);return Date.UTC(_.y,_.m-1,_.d,_.h,_.mi,_.s)-Math.floor(N/1e3)*1e3}function o(N,x,_,F){const L=Date.UTC(N,x-1,_),j=L-f(L,F);return L-f(j,F)}function n(N,x,_){const F=new Date(Date.UTC(N.y,N.m-1,N.d+x));return o(F.getUTCFullYear(),F.getUTCMonth()+1,F.getUTCDate(),_)}const t=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function i(N,x){if(typeof N!="string")return null;const _=N.trim().toLowerCase().replace(/[\s_-]+/g,""),F=/^last(\d*|n)days?$/.exec(_);if(F){const L=F[1]==="n"?"":F[1],j=Number(L||x);return!Number.isFinite(j)||j<=0?null:{kind:"lastNDays",n:Math.floor(j)}}switch(_){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function s(N,x={}){const _=i(N,x.n);if(!_)return null;const F=x.tz||b(),L=x.now instanceof Date?x.now.getTime():typeof x.now=="number"?x.now:Date.now(),j=c(L,F),R=o(j.y,j.m,j.d,F),$=n(j,1,F);let T=R,A=$;switch(_.kind){case"today":break;case"yesterday":T=n(j,-1,F),A=R;break;case"lastNDays":A=x.includeToday?$:R,T=n(j,x.includeToday?-(_.n-1):-_.n,F);break;case"thisWeek":{const C=Number.isFinite(x.weekStartsOn)?Number(x.weekStartsOn):1,Y=(new Date(Date.UTC(j.y,j.m-1,j.d)).getUTCDay()-C+7)%7;T=n(j,-Y,F),A=n(j,-Y+7,F);break}case"thisMonth":T=o(j.y,j.m,1,F),A=o(j.m===12?j.y+1:j.y,j.m===12?1:j.m+1,1,F);break;case"thisQuarter":case"quarterToDate":{const C=Math.floor((j.m-1)/3)*3+1;T=o(j.y,C,1,F),A=_.kind==="quarterToDate"?$:C===10?o(j.y+1,1,1,F):o(j.y,C+3,1,F);break}case"thisYear":case"yearToDate":T=o(j.y,1,1,F),A=_.kind==="yearToDate"?$:o(j.y+1,1,1,F);break;default:return null}return{from:new Date(T).toISOString(),to:new Date(A).toISOString(),bounds:"[)",tz:F,relative:_.kind==="lastNDays"?`last${_.n}Days`:_.kind,n:_.n}}function r(N){if(!N||typeof N!="object")return null;const x=N.value;if(x&&typeof x=="object"&&!Array.isArray(x)&&"relative"in x)return{token:String(x.relative),n:typeof x.n=="number"?x.n:void 0};if(N.op==="relative"&&typeof N.value=="string")return{token:N.value,n:void 0};const _=N.meta;return _&&typeof _.relative=="string"&&N.value===void 0?{token:_.relative,n:typeof _.n=="number"?_.n:void 0}:null}function u(){return`Known tokens: ${t.filter(x=>x!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function a(N){const x=r(N);return x?i(x.token,x.n)!==null:!1}function l(N,x={}){const _=r(N);if(!_)return N;const F=s(_.token,{...x,n:_.n});return F?{...N,type:N.type||"date",op:"between",value:[F.from,F.to],bounds:N.bounds||F.bounds,meta:{...N.meta||{},relative:F.relative,tz:F.tz}}:(M(`source.relative.${_.token}`,`unknown relative date token "${_.token}"; sending the condition unresolved.`,u()),N)}function h(N){return!!N&&typeof N=="object"&&Array.isArray(N.conditions)}function y(N,x){if(N){if(h(N)){for(const _ of N.conditions)y(_,x);return}x(N)}}function m(N,x){if(!N)return null;if(!h(N))return x(N);const _=N;let F=!1;const L=[];for(const j of _.conditions){const R=m(j,x);R!==j&&(F=!0),R&&L.push(R)}return!F&&L.length===_.conditions.length?N:L.length?{..._,conditions:L}:null}function v(N){if(!N)return null;if(!h(N))return N;const x=N,_=[];for(const F of x.conditions){const L=v(F);L&&_.push(L)}return _.length?{op:x.op,conditions:_}:null}function d(N){const x=v(N);return x?h(x)&&x.op==="and"?x:{op:"and",conditions:[x]}:null}function p(N){const x=(N||[]).filter(Boolean);return x.length?{op:"and",conditions:x}:null}function g(N,x={}){const _=m(N,F=>l(F,x));return d(_)}function k(N){const x=w(N.filters??null);return JSON.stringify([x,N.sort??null,N.quick??"",N.groupBy??null,N.pivotBy??null,E(N.context)])}function w(N){if(!N)return null;if(h(N)){const F=N;return{op:F.op,conditions:F.conditions.map(w)}}const x=N,_=x.meta&&typeof x.meta.relative=="string"?x.meta.relative:r(x)?.token;return{col:x.col,op:x.op,bounds:x.bounds??null,caseSensitive:x.caseSensitive??!1,value:_?`rel:${_}`:x.value??null}}function E(N){if(N==null)return null;try{return JSON.parse(JSON.stringify(N))}catch{return M("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),De("packages/core/src/source/tree.js",function(e,U){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return c}});const M=U("packages/core/src/internal/predicates.js").isFunction,B=U("packages/core/src/internal/warn.js").warnOnce,D="",Z="\0tree:";function K(f,o){return{physical:f,key:o,level:0,children:[],value:void 0}}function I(f,o){const n=[],t=new Map;for(let i=0;i<f.length;i++){const s=f[i],r=o.pathOf(s),u=Array.isArray(r)?r.map(l=>String(l)):[];if(!u.length){const l=K(s,o.keyOf(s));n.push(l);continue}let a=null;for(let l=0;l<u.length;l++){const h=u.slice(0,l+1).join(D),y=l===u.length-1;let m=t.get(h);m&&y&&m.physical===-1&&(m.physical=s,m.key=o.keyOf(s)),m||(m=K(y?s:-1,y?o.keyOf(s):Z+h),m.level=l,m.value=u[l],t.set(h,m),a?a.children.push(m):n.push(m)),a=m}}return{roots:n,nodes:t}}function G(f,o){const n=new Map,t=[];for(let u=0;u<f.length;u++){const a=f[u],l=o.keyOf(a),h=K(a,l);n.set(l,h);const y=o.parentOf(a);y!=null&&y!==""&&t.push({node:h,parent:String(y)})}let i=null;const s=new Map;for(const{node:u,parent:a}of t){const l=n.get(a);if(l){s.set(u.key,l);continue}o.orphans&&o.orphans!=="root"&&(i||(i=K(-1,`${Z}orphans`),i.value=o.orphans),s.set(u.key,i))}const r=[];for(const u of n.values()){const a=s.get(u.key);a?a.children.push(u):r.push(u)}return i&&i.children.length&&r.push(i),{roots:H(r,n,o.orphans,i),nodes:n}}function H(f,o,n,t){const i=new Set,s=[...f];for(;s.length;){const h=s.pop();if(!i.has(h.key)){i.add(h.key);for(const y of h.children)s.push(y)}}const r=[];for(const h of o.values())i.has(h.key)||r.push(h);if(!r.length)return f;const u=!!n&&n!=="root";B("tree.cycle",`tree.parentKey produced ${r.length} row(s) inside a parent cycle; `+(u?`they are shown under "${n}".`:"they are shown at the root."));for(const h of r)h.children=h.children.filter(y=>i.has(y.key));if(!u)return[...f,...r];let a=t;const l=[...f];return a||(a=K(-1,`${Z}orphans`),a.value=n,l.push(a)),a.children.push(...r),l}function S(f){let o=0;const n=(t,i)=>{for(const s of t)s.level=i,i>o&&(o=i),s.children.length&&n(s.children,i+1)};return n(f,0),o}function O(f,o){if(!f||typeof f!="object")return null;const n=f.path,t=f.parentKey,i=M(f.hasChildren)?s=>!!f.hasChildren(o.dataAt(s)):null;if(M(n))return{mode:"path",pathOf:s=>n(o.dataAt(s)),keyOf:o.keyOf,declaresChildren:i};if(t!=null){const s=M(t)?t:r=>r?.[t];return{mode:"parentKey",parentOf:r=>s(o.dataAt(r)),keyOf:o.keyOf,orphans:f.orphans||"root",declaresChildren:i}}return B("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function b(f,o){const n=o.mode==="path"?I(f,o):G(f,o),t=S(n.roots);return{...n,depth:t}}function c(f,o){const n=new Map,t=i=>{for(let s=0;s<i.length;s++){const r=i[s];if(r.physical>=0){const u=o?o(r.physical):!1,a=u&&r.children.length===0;n.set(r.physical,{level:r.level,posinset:s+1,setsize:i.length,hasChildren:r.children.length>0||u,lazy:a})}r.children.length&&t(r.children)}};return t(f),n}}),De("packages/core/src/source/settle.js",function(e,U){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return M}});const te=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function M(X){const B=X&&typeof X=="object"?X.reason:null;return typeof B=="string"&&te.includes(B)}}),De("packages/core/src/source/memory.js",function(e,U){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return Y}});const M=U("packages/core/src/internal/lru.js").Lru,X=U("packages/core/src/internal/warn.js"),B=X.warnOnce,D=X.fail,K=U("packages/core/src/internal/predicates.js").isFunction,G=U("packages/core/src/internal/compare.js").defaultCompare,S=U("packages/core/src/internal/merge.js").mergeRow,O=U("packages/core/src/source/rows.js"),b=O.createRowFactory,c=O.groupKey,f=O.groupPathElement,o=O.groupPrefixKeys,n=O.lazyRowView,i=U("packages/core/src/source/handles.js").createHandleProvider,s=U("packages/core/src/compute/incremental.js"),r=s.RunningTotal,u=s.isIncremental,l=U("packages/core/src/compute/handle.js").presenceReader,h=U("packages/core/src/source/filterwire.js"),y=h.querySignature,m=h.mapConditions,v=h.resolveRelativeCondition,d=U("packages/core/src/source/tree.js"),p=d.buildTree,g=d.resolveTree,k=d.indexTree,w=U("packages/core/src/source/settle.js"),E=w.PIPELINE_SETTLE_REASONS,N=w.isPipelineSettle,x=Object.freeze(["filter","sort","group","total","pivot","flatten"]),_=Object.freeze([]);function F(q,V){if(!q)return null;const J=V==="grand"?q.grandTotal:q.groupTotal;return J??q.total}function L(q){return!!q&&!q.running}function j(q){if(q)return q.value&&K(q.value.compare)?q.value.compare:K(q.compare)?q.compare:void 0}function R(q){const V=q&&q.dataType;return!V||!K(V.items)?null:{items:V.items,type:q.itemType&&q.itemType.name||"text"}}function $(q){return!!q&&(typeof q=="object"||typeof q=="function")&&K(q.then)}const T=new Uint32Array(0),A=4096;function C(q,V){return new Y(q,V)}function z(q,V){if(V==="regex")try{const J=new RegExp(q,"iu");return ee=>J.test(ee)}catch{return J=>J.includes(q)}if(V==="fuzzy"){const J=[...q].filter(ee=>ee!==" ");return J.length?ee=>{let ne=0;for(let oe=0;oe<ee.length&&ne<J.length;oe++)ee[oe]===J[ne]&&ne++;return ne===J.length}:()=>!0}if(V==="words"){const J=q.split(/\s+/).filter(Boolean);return J.length?ee=>J.every(ne=>ee.includes(ne)):()=>!0}return J=>J.includes(q)}class Y{mode="memory";#e;#t;#n;#r=!1;#s=null;#i;#o;#l=new Map;#a=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=Y.#g();static#g(){return{slots:[],groupHeadings:_,unnumbered:_,pivot:null,inlineLeaves:null,matchCount:0,grand:null,grandLeaves:0,groupLeaves:null}}#b=new Map;#y=null;#j=new Map;#w=-1;#O=[];#v=new Map;#T=-1;#S=[];#E=null;#N=null;#P=null;#M=null;#R=null;#L=null;#G=null;#_=null;#x=Symbol("unset");#I=new Map;#Y=null;get#D(){return this.#m.slots}set#D(V){this.#m.slots=V}get#K(){return this.#m.inlineLeaves}set#K(V){this.#m.inlineLeaves=V}get#H(){return this.#m.groupHeadings}set#H(V){this.#m.groupHeadings=V}get#B(){return this.#m.unnumbered}set#B(V){this.#m.unnumbered=V}get#fe(){return this.#m.pivot}set#fe(V){this.#m.pivot=V}constructor(V,J){this.#t=V||{mode:"memory"},this.#e=J||{};const ee=this.#e.config||{};this.#n=this.#t.rows||ee.rows||[],this.#i=b(this.#e),this.#o=i(this.#e,()=>this.#n,()=>this.#r),this.#h=new M(Number(ee.rowCacheSize)||A);for(const ne of x)this.#l.set(ne,{key:null,result:null,id:0,computed:!1})}count(){this.#F();const V=this.#pe();return V?V.length:this.#D.length}#pe(){const V=Number(this.#z("pageSize",0))||0;if(V<=0)return null;const J=this.#D.length,ee=Math.max(1,Math.ceil(J/V)),oe=Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1)*V;return{offset:oe,length:Math.max(0,Math.min(V,J-oe))}}pageInfo(){this.#F();const V=Number(this.#z("pageSize",0))||0,J=this.#D.length;if(V<=0)return{page:0,pageSize:0,total:J,pageCount:1};const ee=Math.max(1,Math.ceil(J/V));return{page:Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1),pageSize:V,total:J,pageCount:ee}}totalCount(){return this.#Ke().length}matchCount(){return this.#F(),this.#m.matchCount}at(V){this.#F();const J=this.#pe();if(J)return V<0||V>=J.length?void 0:this.#Ne(J.offset+V,V);if(!(V<0||V>=this.#D.length))return this.#Ne(V,V)}byKey(V){this.#F(),this.#p||this.#Ce();const J=this.#p.get(V);if(J!==void 0)return this.#ee(J);for(let ee=0;ee<this.#D.length;ee++){const ne=this.#D[ee];if(typeof ne!="number"&&ne&&ne.key===V)return this.#Ne(ee)}}loaded(V){return V>=0&&V<this.count()}hint(V,J){}display(){return this.#F(),this.#Y||(this.#Y=this.#ct()),this.#Y}invalidateQuickText(){this.#I.clear(),this.invalidate("filter")}invalidate(V){const J=x.indexOf(V);J<0&&D(`unknown pipeline stage "${V}"; expected one of ${x.join(", ")}`);for(let ee=J;ee<x.length;ee++){const ne=this.#l.get(x[ee]);ne.key=null,ne.computed=!1}this.#Y=null}apply(V){const J=[],ee={added:[],updated:[],removed:[],rejected:J};if(!V)return ee;let ne=!1;const oe=new Set;if(V.remove&&V.remove.length)for(const re of V.remove){const ae=this.#Pe(re);if(ae===void 0){J.push({operation:"remove",id:this.#be(re),reason:"unknown-id"});continue}ee.removed.push(this.#i.keyOf(this.#r?this.#ue(ae):this.#n[ae],ae)),this.#r||(this.#n[ae]=void 0),this.#h.delete(ae),this.#I.delete(ae),ne=!0}if(V.update&&V.update.length){const re=this.#j.size||this.#Ze()?this.#it():null,ae=this.#v.size?this.#lt():null,fe=ae&&ae.length?this.#it():null;for(const de of V.update){const ve=this.#Pe(de);if(ve===void 0){J.push({operation:"update",id:this.#Ae(de),reason:"unknown-id"});continue}const Ie=this.#r?this.#s&&this.#s.has(ve)?this.#s.get(ve):this.#ue(ve):this.#n[ve],Le=S(Ie,de);for(const se of this.#re(Ie,Le))oe.add(se);if(this.#r||(this.#n[ve]=Le),re&&this.#ht(re,ve,Ie,Le),fe&&this.#wt(ae,fe,ve,Ie,Le),this.#p){const se=this.#i.keyOf(Ie,ve),pe=this.#i.keyOf(Le,ve);se!==pe&&(this.#p.delete(se),this.#p.set(pe,ve))}this.#h.delete(ve),this.#I.delete(ve),ee.updated.push(this.#ee(ve))}}if(V.add&&V.add.length&&this.#r){typeof V.at=="number"&&V.at<this.#xe()&&(this.#h.clear(),this.#I.clear()),this.#p=null;for(const re of V.add){const ae=this.#ne(this.#Ae(re));ae!==void 0&&ee.added.push(this.#ee(ae))}ne=!0}else if(V.add&&V.add.length){const re=typeof V.at=="number"?V.at:this.#n.length,ae=this.#n.length;let fe=V.add===this.#n?V.add.slice():V.add;if(this.#i.keyed){const de=[];for(const ve of fe){const Ie=this.#Ae(ve);if(this.#Pe(Ie)!==void 0){J.push({operation:"add",id:Ie,reason:"duplicate-id"});continue}de.push(ve)}de.length!==fe.length&&(fe=de)}if(!fe.length)return ee;if(re>=ae)for(let de=0;de<fe.length;de++)this.#n.push(fe[de]);else this.#n.splice(re,0,...fe),this.#h.clear(),this.#I.clear();for(let de=0;de<fe.length;de++)ee.added.push(this.#ee(re>=ae?ae+de:re+de));ne=!0}return this.#c++,ne&&(this.#p=null,this.#We()),this.#o.invalidate(),this.#Y=null,ne||this.#q(oe)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#Je("rows:changed",{companion:!0,added:ee.added.length,updated:ee.updated.length,removed:ee.removed.length}),this.#s=null,ee}groupHeadingsAt(V){this.#F();const J=this.#H;if(!J.length||!Number.isInteger(V)||V<0)return _;let ee=0,ne=J.length-1,oe=-1;for(;ee<=ne;){const ae=ee+ne>>1;J[ae].at<=V?(oe=ae,ee=ae+1):ne=ae-1}if(oe<0)return _;const re=[];for(let ae=J[oe].row;ae;ae=ae.parent)re.push(ae);return re.reverse(),re}unnumberedRowCount(V){this.#F();const J=this.#B;if(!J.length||!Number.isInteger(V)||V<0)return 0;let ee=0,ne=J.length-1,oe=-1;for(;ee<=ne;){const re=ee+ne>>1;J[re].at<=V?(oe=re,ee=re+1):ne=re-1}return oe+1}moveRow(V,J){if(this.#r)return B("source.moveRow.dropped","rows.move() is not supported under ingest.dropSourceRows: the source objects have been released and the store cannot reorder its columns in place. Enable retainSource (leave dropSourceRows off) to reorder rows."),!1;const ee=this.#n;if(!Number.isInteger(V)||!Number.isInteger(J)||V<0||V>=ee.length)return!1;const ne=Math.max(0,Math.min(ee.length-1,J));if(ne===V)return!1;const[oe]=ee.splice(V,1);return ee.splice(ne,0,oe),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#I.clear(),this.#We(),this.#o.invalidate(),this.#Y=null,this.invalidate("filter"),this.#Je("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(V){this.#ie(),this.#c++,this.#u++,this.#p=null,this.#I.clear(),this.#h.clear(),this.#We(),this.#o.invalidate(),this.invalidate("filter"),this.#Je("model:changed",{reason:"reload"})}destroy(){this.#ie(),this.#h.clear(),this.#I.clear(),this.#p=null,this.#D=[],this.#K=null,this.#Y=null,this.#We();for(const V of x)this.#l.set(V,{key:null,result:null,id:0,computed:!1})}#ie(){for(const{controller:V}of this.#b.values())try{V.abort()}catch{}this.#b.clear()}setRows(V){this.#n=V||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#I.clear(),this.#h.clear(),this.#We(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(V){this.#s=V||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#I.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const V=this.#e.store;if(!V||!K(V.source))return this.#n;const J=V.physical||0,ee=new Array(J);for(let ne=0;ne<J;ne++)ee[ne]=V.live&&!V.live(ne)?void 0:V.source(ne);return ee}#Be(){const V=this.#z("detail",null);return!V||!K(V.isOpen)||V.inline===!1?null:V}#Se(){const V=(this.#e.config||{}).tree;return this.#x!==V&&(this.#x=V,this.#_=g(V,{dataAt:J=>this.#ue(J),keyOf:J=>this.#i.keyOf(this.#ue(J),J)})),this.#_}#ge(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#ge())return null;this.#F();const V=this.#m.grand;return V?this.#i.grandTotal(V,this.#nt(this.#m.grandLeaves)):null}pivot(){return this.#F(),this.#fe}pivotMatrix(){this.#F();const V=this.#m.groupLeaves,J=(this.#e.compute||{}).pivotMatrix;if(!K(J))return null;const ee=this.#z("groupBy",[]),ne=this.#z("pivotBy",[]);if(!ee.length&&!ne.length)return B("pivotView.no-dimension","pivotView is on but the grid has no pivot dimension, so there is no matrix to draw. Put a column on the pivot (its `pivot` setting, or `pivotBy` in the query) for the columns across the top, and group by a column for the rows down the side."),null;const oe=this.#it().map(ae=>({colId:ae.id,handle:this.#o.handle(ae.id),fn:F(ae,"group")})).filter(ae=>ae.handle&&ae.fn),re=this.#e.config||{};return J({rowHandles:ee.map(ae=>this.#o.handle(ae)).filter(Boolean),columnHandles:ne.map(ae=>this.#o.handle(ae)).filter(Boolean),measures:oe,leaves:V||new Uint32Array(0),opts:{locale:re.locale,separator:(re.pivot||{}).separator,maxColumns:(re.pivot||{}).maxColumns}})}keysForLeaves(V){const J=[];if(!V)return J;for(let ee=0;ee<V.length;ee++){const ne=this.#ee(V[ee]);ne&&ne.key!=null&&J.push(String(ne.key))}return J}leavesOf(V){this.#F();const J=this.#l.get("group"),ee=J&&J.result;if(!ee||!ee.nodes)return[];const ne=ee.nodes.get(V);if(!ne)return[];const oe=[],re=ae=>{const fe=ae.row&&ae.row.children;if(fe&&fe.length){for(const de of fe){const ve=ee.nodes.get(de.key);ve&&re(ve)}return}if(ae.leaves)for(let de=0;de<ae.leaves.length;de++)oe.push(this.#ee(ae.leaves[de]))};return re(ne),oe}#be(V){return typeof V=="string"?V:this.#Ae(V)}#Ae(V){try{return this.#i.keyOf(V,-1)}catch{return"(unkeyed)"}}#Pe(V){if(typeof V=="string")return this.#ne(V);if(this.#i.keyed){const ee=this.#i.keyOf(V,-1),ne=this.#ne(ee);if(ne!==void 0)return ne}if(this.#r)return;const J=this.#n.indexOf(V);return J>=0?J:void 0}#ne(V){return this.#p||this.#Ce(),this.#p.get(V)}#Ce(){this.#p=new Map;const V=this.#xe(),J=this.#e.store,ee=J&&K(J.live)?ne=>J.live(ne):null;for(let ne=0;ne<V;ne++){if(ee&&!ee(ne))continue;const oe=this.#ue(ne);oe!==void 0&&this.#p.set(this.#i.keyOf(oe,ne),ne)}}#re(V,J){const ee=[];for(const ne of this.#V())this.#ze(ne)&&this.#J(ne,V,J,new Set)&&ee.push(ne);return ee}#J(V,J,ee,ne){if(ne.has(V))return!1;ne.add(V);const oe=this.#ze(V);if(!oe)return!1;const re=oe.value&&oe.value.deps;return Array.isArray(re)&&re.length?re.some(ae=>this.#J(String(ae),J,ee,ne)):K(oe.getValue)?!Object.is(oe.getValue(J),oe.getValue(ee)):!1}#V(){const V=new Set;for(const ee of this.#z("sort",[]))V.add(ee.col);for(const ee of this.#z("groupBy",[]))V.add(ee);const J=ee=>{if(ee){if(Array.isArray(ee.conditions)){ee.conditions.forEach(J);return}ee.col&&V.add(ee.col)}};return J(this.#z("filters",null)),[...V]}#q(V){if(!V.size)return!1;if(this.#z("quick",""))return!0;for(const J of this.#V())if(V.has(J))return!0;return!1}#F(){if(!this.#a){this.#a=!0;try{this.#Te()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#Te(){const V=this.#U("filter",()=>this.#W(),()=>this.#ve()),J=this.#X(V),ee=this.#U("group",()=>this.#de(),()=>this.#at(J)),ne=this.#U("total",()=>this.#he(),()=>this.#Ue(ee));this.#U("pivot",()=>this.#$e(),()=>this.#Rt(ee)),this.#U("flatten",()=>this.#Ie(),()=>this.#A(ee)),this.#Le(ee,ne)}#X(V){const J=this.#l.get("sort"),ee=this.#se();if(J.computed&&J.key===ee&&!this.#b.has("sort"))return J.result;const ne=this.#b.get("sort");return ne&&ne.key===ee?J.result:J.result&&this.#we(V)?(this.#Ee(V,ee),J.result):this.#U("sort",()=>ee,()=>this.#Me(V))}#oe(){if(this.#y===null){const V=this.#e.pipelineWorker,J=K(V)?V():null;this.#y=J||!1}return this.#y||null}#Oe(){const V=this.#z("sort",[]);if(!Array.isArray(V)||!V.length)return null;const J=(this.#e.config||{}).locale,ee=[],ne=[];for(const oe of V){const re=this.#ze(oe.col);if(re&&re.running)continue;if(re&&re.value&&K(re.value.compare))return null;const ae=this.#o.handle(oe.col);if(!ae)return null;ee.push({col:oe.col,descending:oe.dir==="desc",nullsFirst:!!oe.nullsFirst,locale:J}),ne.push(ae)}return ee.length?{entries:ee,handles:ne,locale:J}:null}#we(V){if(this.#me())return!1;const J=this.#oe();if(!J)return!1;const ee=Number(J.threshold);return Number.isFinite(ee)&&V.length<ee?!1:!!this.#Oe()}#Ee(V,J){const ee=this.#oe(),ne=ee&&this.#Oe();if(!ne){this.#U("sort",()=>J,()=>this.#Me(V));return}const oe=new AbortController;this.#b.set("sort",{key:J,controller:oe});const re=ne.entries.length===1?ee.sortColumn(ne.handles[0],V,{descending:ne.entries[0].descending,nullsFirst:ne.entries[0].nullsFirst,locale:ne.locale,signal:oe.signal,key:"sort"}):ee.sortMulti(ne.handles,ne.entries.map((ae,fe)=>({...ae,handle:ne.handles[fe]})),V,{signal:oe.signal,key:"sort"});if(!$(re)){this.#b.delete("sort"),this.#U("sort",()=>J,()=>re);return}re.then(ae=>this.#ae(J,ae),ae=>this.#ce("sort",J,ae))}#ae(V,J){const ee=this.#b.get("sort");if(!(!ee||ee.key!==V)){if(this.#se()!==V){this.#b.delete("sort");return}this.#b.delete("sort"),this.#U("sort",()=>V,()=>J),this.#Y=null,this.#F(),this.#Je("model:changed",{reason:E[0]})}}#ce(V,J,ee){const ne=this.#b.get(V);if(!(!ne||ne.key!==J)&&(this.#b.delete(V),!(ee&&ee.name==="AbortError")&&V==="sort"&&this.#se()===J)){const oe=this.#U("filter",()=>this.#W(),()=>this.#ve());this.#U("sort",()=>J,()=>this.#Me(oe)),this.#Y=null,this.#F(),B("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",ee),this.#Je("model:changed",{reason:E[1]})}}#Le(V,J){const ee=V&&V.leaves?V.leaves.length:this.#m.slots.length;this.#m.matchCount=ee,this.#m.grand=J&&J.grand||null,this.#m.grandLeaves=V&&V.leaves?V.leaves.length:0,this.#m.groupLeaves=V&&V.leaves?V.leaves:null}#U(V,J,ee){const ne=this.#l.get(V),oe=J();return ne.computed&&ne.key===oe||(ne.result=ee(),ne.key=oe,ne.computed=!0,ne.id++,V==="flatten"&&(this.#Y=null)),ne.result}#C(V){return this.#l.get(V).id}#W(){const V=(this.#e.config||{}).hostFilter,J=V&&K(V.active)&&V.active()?1:0,ee=this.#z("where",null),ne=ee?ee.version:0,oe=this.#st("filter.sig",`${this.#Qe()}`,()=>y({filters:this.#z("filters",null),quick:this.#z("quick",""),quickMode:this.#z("quickMode","contains")}));return`${this.#u}|${oe}|${J}|${ne}`}#se(){const V=this.#me();return`${this.#C("filter")}|${JSON.stringify(this.#z("sort",[]))}`+(V?`|manual:${V.version}`:"")}#me(){const V=this.#z("rowOrder",null);return V&&Array.isArray(V.keys)?V:null}#le(V,J){this.#p||this.#Ce();const ee=this.#p,ne=this.#xe(),oe=J.keys.length,re=new Float64Array(ne);for(let ae=0;ae<ne;ae++)re[ae]=oe+ae;for(let ae=0;ae<oe;ae++){const fe=ee.get(J.keys[ae]);fe!==void 0&&(re[fe]=ae)}return Uint32Array.from(V).sort((ae,fe)=>re[ae]-re[fe])}orderedKeys(){this.#p||this.#Ce();const V=this.#p,J=new Map;for(const[ae,fe]of V)J.set(fe,ae);const ee=Uint32Array.from([...J.keys()]).sort(),ne=this.#me(),oe=ne?this.#le(ee,ne):this.#Me(ee),re=new Array(oe.length);for(let ae=0;ae<oe.length;ae++)re[ae]=J.get(oe[ae]);return re}#de(){const V=this.#z("pivotBy",[]).length>0?"p":"u";return`${this.#C("sort")}|${JSON.stringify(this.#z("groupBy",[]))}|${V}`}#he(){const V=this.#Ge()?"f":"a",J=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#C("group")}|${JSON.stringify(this.#z("totals",[]))}|${V}${J}|${this.#c}`}#$e(){return`${this.#C("group")}|${JSON.stringify(this.#z("pivotBy",[]))}`}#Ie(){const J=this.#k()||!this.#ge()?this.#C("total"):"x",ee=`${this.#Qe()}`,ne=this.#st("flatten.keys",ee,()=>{const re=this.#z("expanded",null);return re?[...re].sort().join(""):"*"}),oe=this.#st("flatten.detail",ee,()=>{const re=this.#z("detail",null);return re&&K(re.signature)?re.signature():""});return`${J}|${this.#C("pivot")}|${ne}|${oe}`}#k(){const V=this.#z("groupBy",[]);return Array.isArray(V)&&V.length>0}stageState(){const V=[];for(const[J,ee]of this.#l){const ne=ee.result;V.push({stage:J,materialised:!!ee.computed,bytes:ne&&typeof ne.byteLength=="number"?ne.byteLength:null,rows:ne&&typeof ne.length=="number"?ne.length:null,rebuilds:ee.id})}return V}facetIndices(V){return this.#ve(V||null)}facetRows(V){const J=this.facetIndices(V),ee=[];for(let ne=0;ne<J.length;ne++){const oe=this.#ee(J[ne]);oe&&ee.push(oe)}return ee}invalidateRows(){this.#h.clear(),this.#I.clear(),this.#Y=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#Ke()}filteredIndices(){const V=this.#l.get("filter");if(V&&V.computed&&V.key===this.#W())return V.result||this.#Ke();this.#F();const J=this.#l.get("filter");return(J&&J.computed?J.result:null)||this.#Ke()}unfilteredRows(){const V=this.#Ke(),J=[];for(let ee=0;ee<V.length;ee++){const ne=this.#ee(V[ee]);ne&&J.push(ne)}return J}#ve(V=null){const J=this.#Ke(),ee=this.#z("filters",null),ne=V?this.#ot("pruneColumn")(ee,V):ee,oe=this.#kt(ne),re=String(this.#z("quick","")||"").trim().toLowerCase(),ae=re?z(re,String(this.#z("quickMode","contains")||"contains")):null,fe=(this.#e.config||{}).hostFilter,de=!!(fe&&K(fe.active)&&fe.active()),ve=this.#z("where",null),Ie=!!(ve&&ve.active);if(!oe&&!re&&!de&&!Ie)return J;let Le=null;oe&&(Le=this.#ot("evaluateFilters")(oe,{handle:ke=>this.#o.handle(ke),count:this.#xe(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:ke=>R(this.#ze(ke))}));const se=new Uint32Array(J.length);let pe=0;for(let be=0;be<J.length;be++){const ke=J[be];if(!(Le&&!Le[ke])&&!(ae&&!this.#vt(ke,ae))){if(de||Ie){const je=this.#ee(ke);if(de&&!fe.passes(je)||Ie&&!ve.passes(je.data,je.key))continue}se[pe++]=ke}}if(Le){const be=(this.#e.compute||{}).releaseMask;K(be)&&be({pool:this.#e.pool},Le)}return se.subarray(0,pe)}handleFor(V){return this.#o.handle(V)}#Me(V){const J=this.#me();if(J)return this.#le(V,J);const ee=this.#z("sort",[]).filter(re=>{const ae=this.#ze(re.col);return!ae||!ae.running?!0:(B(`source.sort.running.${re.col}`,`sort ignores "${re.col}": a running total is a function of the sort order, so it cannot also decide it. Sort by the column it runs over instead.`),!1)});if(!ee.length)return V;const ne=(this.#e.config||{}).locale;if(ee.length===1){const re=ee[0],ae=this.#o.handle(re.col);if(!ae)return B(`source.sort.${re.col}`,`sort ignores unknown column "${re.col}".`),V;const fe=this.#ze(re.col);return this.#ot("sortColumn")(ae,V,{descending:re.dir==="desc",nullsFirst:re.nullsFirst,locale:ne,compare:j(fe)})}const oe=[];for(const re of ee){const ae=this.#o.handle(re.col);if(!ae){B(`source.sort.${re.col}`,`sort ignores unknown column "${re.col}".`);continue}oe.push({handle:ae,descending:re.dir==="desc",nullsFirst:re.nullsFirst,locale:ne,compare:j(this.#ze(re.col))})}return oe.length?this.#ot("sortMulti")(oe.map(re=>re.handle),oe,V):V}#at(V){const J=this.#z("groupBy",[]),ee=this.#Se();if(ee&&!J.length){const be=p(V,ee);return this.#L=k(be.roots,ee.declaresChildren),{roots:null,leaves:V,nodes:new Map,tree:be}}if(this.#L=null,ee&&J.length&&B("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!J.length)return{roots:null,leaves:V,nodes:new Map};const ne=(this.#e.config||{}).timeZone,oe=[],re=[];let ae=!1;for(const be of J){const ke=this.#o.handle(be);if(!ke){B(`source.group.${be}`,`grouping ignores unknown column "${be}".`);continue}oe.push(ke);const je=this.#ze(be),xe=je&&je.dataType;if(xe&&K(xe.groupProjector)){const ge=je.typeOptions&&je.typeOptions.timeZone||ne||void 0,we=xe.groupProjector(je,ge);re.push(we||null),we&&(ae=!0)}else re.push(null)}if(!oe.length)return{roots:null,leaves:V,nodes:new Map};const{keys:fe,buckets:de}=this.#ot("groupByColumns")(oe,V,{locale:(this.#e.config||{}).locale,project:ae?re:void 0}),ve=this.#z("pivotBy",[]).length>0,Ie=[],Le=new Map;for(let be=0;be<de.length;be++){const ke=fe[be];let je=null;const xe=[];for(let ge=0;ge<ke.length;ge++){xe.push(f(ke[ge]));const we=c(xe),Me=ge===ke.length-1;let Ye=Le.get(we);if(!Ye){const Ae=this.#i.group({path:[...xe],column:J[ge],value:ke[ge],level:ge,parent:je,expanded:ve&&Me?!1:this.#ut(we,{key:we,column:J[ge],value:ke[ge],level:ge,path:[...xe]}),hasChildren:!(ve&&Me)});Ye={row:Ae,leaves:null},Le.set(we,Ye),je?je.children.push(Ae):Ie.push(Ae)}Ye.row.leafCount+=de[be].length,ge===ke.length-1&&(Ye.leaves=de[be]),je=Ye.row}}const se=this.#z("sort",[])||[],pe=(be,ke)=>{if(!be||be.length<2){if(be)for(const we of be)pe(we.children,ke+1);return}const je=J[ke],xe=se.find(we=>we.col===je),ge=xe&&xe.dir==="desc"?-1:1;be.sort((we,Me)=>ge*G(we.groupValue,Me.groupValue));for(const we of be)pe(we.children,ke+1)};return pe(Ie,0),{roots:Ie,leaves:V,nodes:Le,keys:fe,buckets:de}}#Ve(V,J){const ee=new Map,ne=new Map,oe=re=>{const ae=re.physical>=0?[re.physical]:[];for(const fe of re.children)ae.push(...oe(fe));if(re.children.length){const fe=this.#Ye(J,Uint32Array.from(ae),null);re.physical>=0?ee.set(re.physical,fe):ne.set(re.key,fe)}return ae};for(const re of V.roots)oe(re);return{byPhysical:ee,byKey:ne}}#Ue(V){const J=this.#it();if(!J.length)return this.#N=null,this.#P=null,{grand:null};const ee={id:this.#C("group"),columns:J.map(se=>se.id).join("")},ne=this.#N&&this.#N.id===ee.id&&this.#N.columns===ee.columns,oe=this.#Ze()&&ne?this.#E:null,re=oe?J.filter(se=>oe.has(se.id)):J,ae=ne?this.#P:null,fe=this.#Ge()?null:this.#Mt(),de=this.#ye(J),ve=se=>{const pe=V.nodes.get(se.key);let be=pe&&pe.leaves?pe.leaves:null;if(se.children&&se.children.length){const xe=se.children.map(ve);let ge=0;for(const Ye of xe)ge+=Ye.length;const we=new Uint32Array(ge);let Me=0;for(const Ye of xe)we.set(Ye,Me),Me+=Ye.length;be=we}be=be||new Uint32Array(0);const ke=fe?fe.get(se.key)||T:be,je=this.#bt(se,oe?re:J,ke,de);return se.totals=oe?{...se.totals,...je}:je,be};if(V.roots&&re.length)for(const se of V.roots)ve(se);if(this.#G=V.tree?this.#Ve(V.tree,J):null,this.#N=ee,this.#E=this.#Ze()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#O.length=0,this.#P=null,{grand:null};const Le=fe?this.#rt():V.leaves;return this.#P=this.#Xe(J,Le,oe,ae),{grand:this.#P}}#Xe(V,J,ee,ne){const oe={},re=this.#C("group");re!==this.#w&&(this.#qe(),this.#w=re);const ae=this.#O;this.#O=[];for(const fe of V){if(!L(fe))continue;const de=this.#o.handle(fe.id);if(!de)continue;const ve=F(fe,"grand");if(!u(ve,de)){if(ee&&!ee.has(fe.id)&&ne&&fe.id in ne){oe[fe.id]=ne[fe.id];continue}oe[fe.id]=this.#Ye([fe],J,null,"grand")[fe.id];continue}let Ie=this.#j.get(fe.id);if((!Ie||Ie.fn!==ve)&&(Ie=new r(ve),this.#j.set(fe.id,Ie)),Ie.valid){let Le=!0;for(const se of ae)if(se.colId===fe.id&&!Ie.update(se.before,se.after)){Le=!1;break}if(Le){oe[fe.id]=Ie.value();continue}Ie.invalidate()}Ie.seedColumn(de.values,l(de),J),oe[fe.id]=Ie.valid?Ie.value():this.#Ye([fe],J,null,"grand")[fe.id]}return oe}#ye(V){const J=this.#C("group");J!==this.#T&&(this.#v.clear(),this.#T=J);const ee=new Map;for(const oe of V){if(!L(oe))continue;const re=this.#o.handle(oe.id),ae=F(oe,"group");u(ae,re)&&ee.set(oe.id,{fn:ae})}if(!ee.size)return this.#S.length=0,ee;const ne=this.#S;this.#S=[];for(const oe of ne){const{beforeKeys:re,afterKeys:ae,colDeltas:fe}=oe,de=re.length?new Set(re):null,ve=ae.length?new Set(ae):null;for(const{colId:Ie,before:Le,after:se}of fe)if(ee.has(Ie)){for(const pe of re)ve&&ve.has(pe)||this.#ke(pe,Ie,Le,null);for(const pe of ae)de&&de.has(pe)||this.#ke(pe,Ie,null,se);for(const pe of re)ve&&!ve.has(pe)||this.#ke(pe,Ie,Le,se)}}return ee}#ke(V,J,ee,ne){const oe=this.#v.get(V),re=oe&&oe.get(J);!re||!re.valid||re.update(ee,ne)||re.invalidate()}#bt(V,J,ee,ne){if(!ne||!ne.size)return this.#Ye(J,ee,V);const oe={};let re=null,ae=this.#v.get(V.key);for(const fe of J){const de=ne.get(fe.id);if(!de){(re||(re=[])).push(fe);continue}const ve=this.#o.handle(fe.id);if(!ve)continue;ae||(ae=new Map,this.#v.set(V.key,ae));let Ie=ae.get(fe.id);if((!Ie||Ie.fn!==de.fn)&&(Ie=new r(de.fn),ae.set(fe.id,Ie)),Ie.valid||Ie.seedColumn(ve.values,l(ve),ee),Ie.valid){oe[fe.id]=Ie.value();continue}(re||(re=[])).push(fe)}return re&&Object.assign(oe,this.#Ye(re,ee,V)),oe}#ht(V,J,ee,ne){const oe=!this.#Ge()||this.#te(J);for(const re of V){const ae=re.getValue;if(!K(ae))continue;const fe=ae(ee),de=ae(ne);Object.is(fe,de)||(this.#E&&this.#E.add(re.id),oe&&this.#j.has(re.id)&&this.#O.push({colId:re.id,before:fe,after:de}))}}#lt(){const V=this.#z("groupBy",[]),J=[];for(const ee of V){const ne=this.#ze(ee);ne&&J.push(ne)}return J}#yt(V,J){const ee=new Array(V.length);for(let ne=0;ne<V.length;ne++){const oe=V[ne].getValue;ee[ne]=f(K(oe)?oe(J):void 0)}return ee}#wt(V,J,ee,ne,oe){if(this.#Ge()&&!this.#te(ee))return;const re=o(this.#yt(V,ne)),ae=o(this.#yt(V,oe)),fe=re.length!==ae.length||re.some((ve,Ie)=>ve!==ae[Ie]),de=[];for(const ve of J){const Ie=ve.getValue;if(!K(Ie))continue;const Le=Ie(ne),se=Ie(oe);!fe&&Object.is(Le,se)||de.push({colId:ve.id,before:Le,after:se})}!de.length&&!fe||this.#S.push({beforeKeys:re,afterKeys:ae,colDeltas:de})}#te(V){const J=this.#l.get("filter"),ee=J&&J.computed?J.result:null;if(!ee)return!0;let ne=0,oe=ee.length-1;for(;ne<=oe;){const re=ne+oe>>1,ae=ee[re];if(ae===V)return!0;ae<V?ne=re+1:oe=re-1}return!1}#Ge(){return(this.#e.config||{}).totalFilteredOnly!==!1}#nt(V){return this.#Ge()?V:this.#rt().length}#rt(){return(!this.#M||this.#M.version!==this.#u)&&(this.#M={version:this.#u,indices:this.#Ke()}),this.#M.indices}#Mt(){const V=this.#z("groupBy",[]),J=`${this.#u}|${JSON.stringify(V)}`;if(this.#R&&this.#R.key===J)return this.#R.map;const ee=new Map,ne=[];for(const oe of V){const re=this.#o.handle(oe);re&&ne.push(re)}if(ne.length){const oe=this.#rt(),{keys:re,buckets:ae}=this.#ot("groupByColumns")(ne,oe,{locale:(this.#e.config||{}).locale}),fe=new Map;for(let de=0;de<ae.length;de++){const ve=re[de],Ie=[];for(let Le=0;Le<ve.length;Le++){Ie.push(f(ve[Le]));const se=c(Ie);let pe=fe.get(se);pe||(pe=[],fe.set(se,pe));for(let be=0;be<ae[de].length;be++)pe.push(ae[de][be])}}for(const[de,ve]of fe)ee.set(de,Uint32Array.from(ve))}return this.#R={key:J,map:ee},ee}#Ze(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#We(){this.#qe(),this.#Nt(),this.#E=null,this.#N=null,this.#P=null}#qe(){this.#j.clear(),this.#O.length=0,this.#w=-1}#Nt(){this.#v.clear(),this.#S.length=0,this.#T=-1}#Rt(V){const J=this.#z("pivotBy",[]);if(!J.length)return this.#fe=null,null;const ee=(this.#e.compute||{}).pivot;if(!K(ee))return B("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#fe=null,null;const ne=J.map(re=>this.#o.handle(re)).filter(Boolean),oe=this.#it();return this.#fe=ee(ne,V.leaves,{groups:V.keys&&V.buckets?{keys:V.keys,buckets:V.buckets}:null,totals:oe.map(re=>re.id),handle:re=>this.#o.handle(re),totalOf:re=>F(oe.find(ae=>ae.id===re),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#fe}#A(V){const J=this.#l.get("total").result,ee=!!(this.#e.config||{}).groupFooter,ne=this.#Be();if(V.tree)return this.#He(V,J,ne);if(!V.roots&&!ne){if(J&&J.grand&&!this.#ge()){const ve=this.#i.grandTotal(J.grand,this.#nt(V.leaves.length));if(this.#K===V.leaves&&Array.isArray(this.#D))this.#D[this.#D.length-1]=ve;else{const Ie=Array.from(V.leaves);Ie.push(ve),this.#D=Ie,this.#K=V.leaves}this.#B=[{at:this.#D.length-1}]}else this.#K=null,this.#D=V.leaves,this.#B=_;return this.#H=_,this.#D}const oe=[],re=[],ae=[],fe=ve=>{if(oe.push(ve),!ne)return;const Ie=this.#ee(ve);!Ie||!ne.isOpen(Ie.key)||(Ie.master=!0,Ie.expanded=!0,ae.push({at:oe.length}),oe.push(this.#i.detail(Ie,ne.heightOf(Ie))))};if(!V.roots){for(let ve=0;ve<V.leaves.length;ve++)fe(V.leaves[ve]);return J&&J.grand&&!this.#ge()&&(ae.push({at:oe.length}),oe.push(this.#i.grandTotal(J.grand,this.#nt(V.leaves.length)))),this.#K=null,this.#H=_,this.#B=ae.length?ae:_,this.#D=oe,oe}const de=(ve,Ie,Le)=>{if(ve.expanded=ve.hasChildren===!1?!1:this.#ut(ve.key,{key:ve.key,column:ve.groupColumn,value:ve.groupValue,level:ve.level,path:ve.groupPath}),ve.posinset=Ie+1,ve.setsize=Le,re.push({at:oe.length,row:ve}),ae.push({at:oe.length}),oe.push(ve),!!ve.expanded){if(ve.children&&ve.children.length)for(let se=0;se<ve.children.length;se++)de(ve.children[se],se,ve.children.length);else{const se=V.nodes.get(ve.key),pe=se&&se.leaves?se.leaves:null;if(pe)for(let be=0;be<pe.length;be++)fe(pe[be])}ee&&ve.totals&&(ae.push({at:oe.length}),oe.push(this.#i.footer(ve)))}};for(let ve=0;ve<V.roots.length;ve++)de(V.roots[ve],ve,V.roots.length);return J&&J.grand&&!this.#ge()&&(ae.push({at:oe.length}),oe.push(this.#i.grandTotal(J.grand,this.#nt(V.leaves.length)))),this.#H=re,this.#B=ae,this.#D=oe,oe}#Ke(){const V=this.#e.store;if(V&&K(V.liveIndices))return V.liveIndices();const J=new Uint32Array(this.#n.length);let ee=0;for(let ne=0;ne<this.#n.length;ne++)this.#n[ne]!==void 0&&(J[ee++]=ne);return J.subarray(0,ee)}#xe(){const V=this.#e.store;return V&&typeof V.physical=="number"?V.physical:this.#n.length}#ue(V){const J=this.#e.store;return J&&K(J.source)?J.source(V):this.#n[V]}#Ne(V,J=V){const ee=this.#D[V];if(typeof ee!="number")return ee.index=J,ee;const ne=this.#ee(ee);return ne.index=J,ne}#ee(V){let J=this.#h.get(V);J||(J=this.#i.leaf(this.#ue(V),V),this.#h.set(V,J));const ee=this.#L?this.#L.get(V):null;if(ee){J.level=ee.level,J.posinset=ee.posinset,J.setsize=ee.setsize,J.hasChildren=ee.hasChildren,J.expanded=ee.hasChildren&&!ee.lazy&&this.#ut(J.key);const ne=this.#G?this.#G.byPhysical.get(V):void 0;ne?J.totals=ne:J.totals&&(J.totals=null)}else J.hasChildren&&(J.level=0,J.hasChildren=!1,J.expanded=!1,J.posinset=void 0,J.setsize=void 0);return J}#He(V,J,ee){const ne=[],oe=[],re=fe=>{if(fe.leafCount!==void 0)return fe.leafCount;let de=fe.physical>=0?1:0;for(const ve of fe.children)de+=re(ve);return fe.leafCount=de,de},ae=fe=>{const de=this.#ut(fe.key);if(fe.physical>=0){if(ne.push(fe.physical),ee&&ee.isOpen(this.#ee(fe.physical).key)){const ve=this.#ee(fe.physical);oe.push({at:ne.length}),ne.push(this.#i.detail(ve,ee.heightOf(ve)))}}else ne.push(this.#i.group({path:[fe.key],column:null,value:fe.value,level:fe.level,parent:null,expanded:de,hasChildren:fe.children.length>0,leafCount:re(fe),totals:this.#G?this.#G.byKey.get(fe.key):void 0}));if(de)for(const ve of fe.children)ae(ve)};for(const fe of V.tree.roots)ae(fe);return J&&J.grand&&!this.#ge()&&(oe.push({at:ne.length}),ne.push(this.#i.grandTotal(J.grand,this.#nt(V.leaves.length)))),this.#K=null,this.#H=_,this.#B=oe.length?oe:_,this.#D=ne,ne}#ct(){return n(()=>this.count(),V=>this.at(V))}#vt(V,J){let ee=this.#I.get(V);if(ee===void 0){const ne=this.#ue(V),oe=this.#St(),re=[],ae=this.#e.columnHidden;for(const fe of oe){if(fe.quickFilter===!1||K(ae)&&ae(fe.id))continue;const de=fe.value&&K(fe.value.quickFilterText)?fe.value.quickFilterText({value:void 0,data:ne,row:null,column:fe,colId:fe.id,grid:null,context:this.#z("context",null)}):null,ve=de??(K(fe.formatValue)?fe.formatValue(K(fe.getValue)?fe.getValue(ne):void 0):"");ve!=null&&ve!==""&&re.push(String(ve))}ee=re.join(" ").toLowerCase(),this.#I.set(V,ee)}return J(ee)}#it(){const V=this.#z("totals",[]),J=V&&V.length?new Set(V):null;return this.#St().filter(ee=>J?J.has(ee.id):!!(ee.total||ee.groupTotal||ee.grandTotal))}#Ye(V,J,ee,ne="group"){const oe={},re=(this.#e.compute||{}).total;for(const ae of V){if(!L(ae))continue;const fe=this.#o.handle(ae.id);if(!fe)continue;const de=F(ae,ne);if(de)if(K(de)){const ve=new Array(J.length);for(let Ie=0;Ie<J.length;Ie++)ve[Ie]=fe.get(J[Ie]);oe[ae.id]=de(ve,{row:ee,column:ae,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(Ie,Le)=>{const se=this.#o.handle(Ie);return se&&Le>=0&&Le<J.length?se.get(J[Le]):null}})}else K(re)&&(oe[ae.id]=re(fe,J,de))}return oe}#kt(V){if(!V)return V;const J=this.#e.config||{},ee={tz:J.timeZone,weekStartsOn:J.weekStartsOn};return m(V,ne=>{const oe=v(ne,ee),re=this.#ze(oe&&oe.col),ae=re&&re.type==="datetime";if(oe&&oe.type)return oe.type==="datetime"&&!oe.timeZone&&re?{...oe,timeZone:J.timeZone||void 0}:oe;if(ae)return{...oe,type:"datetime",timeZone:J.timeZone||void 0};const fe=re&&(re.dataType?.base||re.type);return fe?{...oe,type:fe}:oe})}#ut(V,J){const ee=this.#z("expanded",null);return ee?K(ee.has)?ee.has(V,J):Array.prototype.includes.call(ee,V):!0}#z(V,J){if(V==="context"||!K(this.#e.stateVersion))return this.#Lt(V,J);const ee=this.#Ot(V),ne=this.#f.get(V);if(ne&&ne.version===ee)return ne.value;const oe=this.#Lt(V,J);return this.#f.set(V,{version:ee,value:oe}),oe}#Lt(V,J){const ee=this.#e.state;if(ee&&K(ee[V])){const ne=ee[V]();return ne??J}return J}#Qe(){const V=this.#e.stateVersion;return K(V)?V():0}#Ft(){const V=this.#e.columnsVersion,J=this.#e.permissionsVersion;return`${K(V)?V():0}|${K(J)?J():0}`}#Ot(V){return V==="totals"?this.#Ft():`${this.#Qe()}`}#st(V,J,ee){if(!K(this.#e.stateVersion))return ee();const ne=this.#d.get(V);if(ne&&ne.version===J)return ne.key;const oe=ee();return this.#d.set(V,{version:J,key:oe}),oe}#ot(V){const J=(this.#e.compute||{})[V];return K(J)||D(`ctx.compute.${V} is required by the memory source pipeline`),J}#St(){const V=this.#e.columns;return V&&K(V.all)?V.all():[]}#ze(V){const J=this.#e.columns;return J&&K(J.get)?J.get(V):void 0}#Je(V,J){const ee=this.#e.emit;K(ee)&&ee(V,J)}}}),De("packages/core/src/source/abort.js",function(e,U){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return D}});class te extends Error{constructor(K,I="superseded"){super(`[lattice] request ${K?`"${K}" `:""}${I}`),this.name="SupersededError",this.superseded=!0,this.key=K}}class M{#e;constructor(K,I,G,H){this.#e=K,this.key=I,this.controller=G,this.signal=G.signal,this.seq=H}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(K){this.signal.aborted||this.controller.abort(new te(this.key,K)),this.#e.settle(this)}}class X{#e=new Map;#t=0;begin(K="",I="superseded"){const G=this.#e.get(K);G&&!G.signal.aborted&&G.controller.abort(new te(K,I));const H=new M(this,K,new AbortController,++this.#t);return this.#e.set(K,H),H}tokenFor(K){return this.#e.get(K)}pending(K=""){const I=this.#e.get(K);return!!I&&!I.signal.aborted}get size(){return this.#e.size}settle(K){this.#e.get(K.key)===K&&this.#e.delete(K.key)}abort(K="",I="superseded"){const G=this.#e.get(K);G&&G.abort(I)}abortAll(K="superseded"){for(const I of[...this.#e.values()])I.abort(K);this.#e.clear()}}function B(){return new X}function D(Z){if(!Z||typeof Z!="object")return!1;const K=Z;return K.superseded===!0||K.name==="AbortError"||K.name==="SupersededError"}}),De("packages/core/src/source/blockcache.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return B}});const te=100,M=32;class X{constructor(Z){this.id=Z,this.rows=null,this.state="pending",this.token=null,this.error=null}}class B{#e=new Map;#t;#n;#r=0;#s=-1;constructor(Z={}){this.#t=Math.max(1,Math.floor(Number(Z.pageSize)||te)),this.#n=Math.max(1,Math.floor(Number(Z.maxCachedPages)||M))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(Z){return Math.floor(Z/this.#t)}rangeOf(Z){return{start:Z*this.#t,end:(Z+1)*this.#t}}has(Z){return this.#e.has(Z)}pending(Z){const K=this.#e.get(Z);return!!K&&K.state==="pending"}loaded(Z){const K=this.#e.get(Z);return!!K&&K.state==="loaded"}begin(Z,K){let I=this.#e.get(Z);return I||(I=new X(Z)),I.state="pending",I.token=K,I.error=null,this.#i(Z,I),I}fill(Z,K){const I=this.#e.get(Z)||new X(Z);I.rows=K,I.state="loaded",I.token=null,this.#i(Z,I)}failed(Z,K){const I=this.#e.get(Z)||new X(Z);I.state="error",I.error=K,I.token=null,this.#i(Z,I)}delete(Z){return this.#e.delete(Z)}rowAt(Z){const K=this.blockOf(Z),I=this.#e.get(K);if(!(!I||I.state!=="loaded"||!I.rows))return this.#i(K,I),I.rows[Z-K*this.#t]}rowLoaded(Z){const K=this.blockOf(Z),I=this.#e.get(K);return!!I&&I.state==="loaded"&&!!I.rows&&Z-K*this.#t<I.rows.length}erroredAt(Z){const K=this.#e.get(this.blockOf(Z));return!!K&&K.state==="error"}loadedExtent(){let Z=0;for(const K of this.#e.values()){if(K.state!=="loaded"||!K.rows)continue;const I=K.id*this.#t+K.rows.length;I>Z&&(Z=I)}return Z}fillOf(Z){const K=this.#e.get(Z);return K&&K.state==="loaded"&&K.rows?K.rows.length:null}protect(Z,K){this.#r=this.blockOf(Math.max(0,Z)),this.#s=this.blockOf(Math.max(0,K))}evict(){const Z=[];if(this.#e.size<=this.#n)return Z;for(const[K,I]of this.#e){if(this.#e.size-Z.length<=this.#n)break;K>=this.#r&&K<=this.#s||I.state!=="pending"&&Z.push(K)}for(const K of Z)this.#e.delete(K);return Z}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#i(Z,K){this.#e.delete(Z),this.#e.set(Z,K)}}}),De("packages/core/src/source/pagewindow.js",function(e,U){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return te}});function te(M,X,B,D){const Z=Math.floor(Number(M)||0);if(Z<=0)return null;const K=Math.max(0,Math.floor(Number(X)||0)),I=Math.max(0,Math.floor(Number(B)||0));if(D){const G=Math.max(1,Math.ceil(I/Z)),H=Math.min(K,G-1),S=H*Z;return{page:H,pageSize:Z,offset:S,length:Math.max(0,Math.min(Z,I-S)),pageCount:G,total:I}}return{page:K,pageSize:Z,offset:K*Z,length:Z,pageCount:Math.max(K+2,Math.ceil(I/Z)),total:null}}}),De("packages/core/src/source/paged.js",function(e,U){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return y}});const M=U("packages/core/src/internal/lru.js").Lru,B=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/warn.js").warnOnce,I=U("packages/core/src/internal/schedule.js").settleDebounce,G=U("packages/core/src/source/abort.js"),H=G.createAbortScope,S=G.isAbortError,O=U("packages/core/src/source/blockcache.js"),b=O.BlockCache,c=O.DEFAULT_PAGE_SIZE,f=O.DEFAULT_MAX_CACHED_PAGES,n=U("packages/core/src/source/rows.js").createRowFactory,t=U("packages/core/src/source/filterwire.js"),i=t.wireFilters,s=t.querySignature,r=t.warnHostFilterNotApplied,a=U("packages/core/src/source/pagewindow.js").pageWindow,l=120;function h(m,v){return new y(m,v)}class y{mode="paged";#e;#t;#n;#r=H();#s;#i;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(v,d){this.#e=v||{mode:"paged"},this.#t=d||{},this.#n=new b({pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||f}),this.#s=n(this.#t),this.#i=new M(this.#n.pageSize*4),this.#h=I((p,g)=>this.#w(p,g),l),this.#f=this.#E(),B(this.#e.fetch)||Z("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),r(this.#t)}count(){const v=this.#y();return v?v.length:this.#b()}#b(){if(this.#T(),this.#l!==null)return this.#l;const v=Math.max(this.#u,this.#n.loadedExtent());return this.#c?v:v+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const v=this.#y();if(!v){const d=this.#b();return{page:0,pageSize:0,total:this.exact()?d:null,pageCount:1,counting:!1}}return{page:v.page,pageSize:v.pageSize,total:v.total,pageCount:v.pageCount,counting:v.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const v=this.#b(),d=a(this.#P("pageSize",0),this.#P("page",0),v,this.exact());if(!d)return this.#g="",null;const p=`${this.#m}:${d.offset}:${d.length}`;if(p!==this.#g&&!this.#p&&(this.#g=p,d.length>0)){const g=d.offset+d.length-1;this.#d={start:d.offset,end:g},this.#w(d.offset,g)}return d}at(v){const d=this.#y();if(d){if(v<0||v>=d.length)return;const p=this.#j(d.offset+v);return p&&(p.index=v),p}return this.#j(v)}#j(v){if(v<0||v>=this.#b())return;const d=this.#i.get(v);if(d&&(d.data!==null||!this.#n.rowLoaded(v)))return d;const p=this.#n.rowAt(v);if(p===void 0){const k=this.#s.skeleton(v,0,this.#n.erroredAt(v));return this.#i.set(v,k),k}const g=this.#s.leaf(p,v);return g.index=v,this.#i.set(v,g),this.#o.set(g.key,v),g}byKey(v){const d=this.#o.get(v);return d===void 0?void 0:this.#j(d)}loaded(v){const d=this.#y();return d?v>=0&&v<d.length&&this.#n.rowLoaded(d.offset+v):this.#n.rowLoaded(v)}loadedCount(){this.#T();let v=0;for(const d of this.#n.ids()){if(!this.#n.loaded(d))continue;const p=this.#n.fillOf(d);typeof p=="number"&&(v+=p)}return v}residentRows(){this.#T();const v=this.#y(),d=v?v.offset:0,p=v?v.offset+v.length:1/0,g=[],k=this.#n.ids().sort((w,E)=>w-E);for(const w of k){if(!this.#n.loaded(w))continue;const{start:E}=this.#n.rangeOf(w),N=this.#n.fillOf(w)||0;for(let x=E;x<E+N;x++){if(x<d||x>=p)continue;const _=this.#i.peek(x);if(_&&_.data!==null&&_.data!==void 0){g.push(_);continue}const F=this.#n.rowAt(x);if(F===void 0)continue;const L=this.#s.leaf(F,x);L.index=x,this.#i.set(x,L),this.#o.set(L.key,x),g.push(L)}}return g}hint(v,d){if(this.#p)return;const p=this.#T();let g=Math.max(0,Math.floor(v)),k=Math.max(g,Math.floor(d));const w=this.#y();if(w){if(w.length===0)return;g=w.offset,k=w.offset+w.length-1}this.#d={start:g,end:k},this.#n.protect(g,k);for(const E of this.#n.evict())this.#v(E);this.#h(g,k),p&&this.#h.flush()}#w(v,d){if(this.#p)return;this.#n.protect(v,d);const p=this.#n.blockOf(v),g=this.#n.blockOf(d);for(let k=p;k<=g&&!(this.#l!==null&&k*this.#n.pageSize>=this.#l);k++)this.#n.has(k)||this.#O(k)}apply(v){const d={added:[],updated:[],removed:[]};if(!v)return d;if(v.update)for(const p of v.update){const g=this.#s.keyOf(p,-1),k=this.#o.get(g);if(k===void 0)continue;const w=this.#s.leaf(p,k);w.index=k,this.#i.set(k,w),d.updated.push(w)}return(v.add&&v.add.length||v.remove&&v.remove.length)&&this.reload(),d}reload(v){this.#S("reload"),this.#h.cancel(),this.hint(this.#d.start,this.#d.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#i.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#O(v){if(!B(this.#e.fetch))return;const d=this.#r.begin(`block:${v}`);this.#n.begin(v,d);const{start:p,end:g}=this.#n.rangeOf(v),k=this.#f;try{const w=await this.#e.fetch({range:{start:p,end:g},sort:this.#P("sort",[]),filters:i(this.#P("filters",null),this.#N()),quick:this.#P("quick","")||void 0,context:this.#P("context",null),signal:d.signal});if(!d.current||k!==this.#f||this.#p)return;d.settle();const E=w&&w.rows||[];this.#n.fill(v,E);for(let x=0;x<E.length;x++)this.#i.delete(p+x);const N=w&&typeof w.total=="number"?w.total:w&&typeof w.count=="number"?w.count:null;N!==null?(this.#l=N,this.#c=!0):E.length<this.#n.pageSize?(this.#c=!0,this.#l=p+E.length):this.#u=Math.max(this.#u,p+E.length),this.#M("model:changed",{reason:"page",block:v,from:p,to:p+E.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:v,from:p,to:p+E.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(w){if(d.settle(),S(w))return;this.#n.failed(v,w);for(let E=p;E<g;E++)this.#i.delete(E);this.#M("model:changed",{reason:"page-error",block:v,range:{start:p,end:g}}),this.#M("source:error",{error:w,block:v,range:{start:p,end:g}})}}#v(v){const{start:d,end:p}=this.#n.rangeOf(v);for(let g=d;g<p;g++){const k=this.#i.peek(g);k&&this.#o.delete(k.key),this.#i.delete(g)}}#T(){const v=this.#E();return v===this.#f?!1:(this.#f=v,this.#S("query"),!0)}#S(v){this.#r.abortAll(v),this.#n.clear(),this.#i.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:v})}#E(){return s({filters:this.#P("filters",null),sort:this.#P("sort",[]),quick:this.#P("quick",""),context:this.#P("context",null)})}#N(){const v=this.#t.config||{};return{tz:v.timeZone,weekStartsOn:v.weekStartsOn}}#P(v,d){const p=this.#t.state;if(p&&B(p[v])){const g=p[v]();return g??d}return d}#M(v,d){const p=this.#t.emit;B(p)&&p(v,d)}}}),De("packages/core/src/source/aggregates.js",function(e,U){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return G}});const te=Object.freeze({sum:{pushable:!0,class:"identical",sql:"sum(%c)"},avg:{pushable:!0,class:"identical",sql:"avg(%c)"},min:{pushable:!0,class:"identical",sql:"min(%c)"},max:{pushable:!0,class:"identical",sql:"max(%c)"},count:{pushable:!0,class:"identical",sql:"count(*)"},countValues:{pushable:!0,class:"identical",sql:"count(%c)",blankAware:!0},range:{pushable:!0,class:"identical",sql:"(max(%c) - min(%c))"},variance:{pushable:!0,class:"identical",sql:"var_samp(%c)"},varianceP:{pushable:!0,class:"identical",sql:"var_pop(%c)"},stddev:{pushable:!0,class:"identical",sql:"stddev_samp(%c)"},stddevP:{pushable:!0,class:"identical",sql:"stddev_pop(%c)"},sumSquares:{pushable:!0,class:"identical",sql:"sum(%c * %c)"},median:{pushable:!0,class:"identical",sql:"median(%c)"},p25:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.25)"},p75:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.75)"},p90:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.9)"},p95:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.95)"},p99:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.99)"},iqr:{pushable:!0,class:"identical",sql:"(quantile_cont(%c, 0.75) - quantile_cont(%c, 0.25))"},mad:{pushable:!0,class:"identical",sql:"mad(%c)"},distinct:{pushable:!0,class:"identical",sql:"count(DISTINCT %c)",blankAware:!0},skewness:{pushable:!0,class:"identical",sql:"skewness(%c)"},kurtosis:{pushable:!0,class:"identical",sql:"kurtosis(%c)"},geomean:{pushable:!0,class:"identical",sql:"exp(avg(ln(%c)))"},harmean:{pushable:!0,class:"identical",sql:"(count(%c) / sum(1.0 / %c))"},entropy:{pushable:!0,class:"identical",sql:"entropy(%c)",blankAware:!0},correlation:{pushable:!0,class:"identical",sql:"corr(%w, %c)",twoColumn:!0},hhi:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_transform(map_values(histogram(%c)), lambda v: (v::DOUBLE/count(%c))*(v::DOUBLE/count(%c)))) END"},evenness:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL WHEN count(DISTINCT %c)<2 THEN 1.0 ELSE entropy(%c)/log2(count(DISTINCT %c)) END"},top3Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,3))::DOUBLE/count(%c) END"},top10Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,10))::DOUBLE/count(%c) END"},gini:{pushable:!0,class:"identical",sql:"CASE WHEN list_min(list(%c) FILTER (WHERE isfinite(%c)))<0 THEN NULL WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL WHEN list_sum(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN 0 ELSE 2.0*list_sum(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v, i: i*v))/(len(list(%c) FILTER (WHERE isfinite(%c)))*list_sum(list(%c) FILTER (WHERE isfinite(%c))))-(len(list(%c) FILTER (WHERE isfinite(%c)))+1.0)/len(list(%c) FILTER (WHERE isfinite(%c))) END"},trimmedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_slice(list_sort(list(%c) FILTER (WHERE isfinite(%c))), floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1, len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT)) END"},winsorizedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v: least(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT], greatest(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1], v)))) END"},robustOutliers:{pushable:!0,class:"identical",sql:"(SELECT CASE WHEN len(d.a)=0 THEN NULL WHEN d.mad=0 THEN NULL ELSE len(list_filter(d.a, lambda v: abs(0.6745*(v-d.med)/d.mad)>3.5)) END FROM (SELECT xs AS a, list_median(xs) AS med, list_median(list_transform(xs, lambda w: abs(w-list_median(xs)))) AS mad FROM (SELECT list(%c) FILTER (WHERE isfinite(%c)) AS xs)) d)"},jarqueBera:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))<8 THEN NULL WHEN list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2)))=0 THEN NULL ELSE (len(list(%c) FILTER (WHERE isfinite(%c)))/6.0)*(power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),3)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),1.5),2)+power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),4)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),2)-3,2)/4.0) END"},weightedAvg:{pushable:!0,class:"identical",twoColumn:!0,sql:"sum(%c*%w) FILTER (WHERE isfinite(%c) AND isfinite(%w))/nullif(sum(%w) FILTER (WHERE isfinite(%c) AND isfinite(%w)),0)"},mode:{pushable:!0,class:"may-differ",sql:"mode(%c)",note:"DuckDB returns a modal value even for an all-distinct column; the grid returns null. Tie-breaking can also differ, and on a text column an empty string counts as a value. Under pushdown you will see a value."},weightedQuantile:{pushable:!1,class:"fallback",note:"No SQL equivalent for the grid's weighted-quantile midpoint convention; always computed client-side (needs a full-dataset pull for a correct figure over a remote source)."}});function M(){const H=new Set;for(const[S,O]of Object.entries(te))O.pushable&&H.add(S);return H}function X(H,S,O){let b=H.split("%c").join(S);return O!==void 0&&(b=b.split("%w").join(O)),b}function B(H){const S=H||{},O=S.default==="engine"||S.default==="engine-if-identical"?S.default:"client",b={};if(S.overrides&&typeof S.overrides=="object")for(const[c,f]of Object.entries(S.overrides))(f==="engine"||f==="client")&&(b[c]=f);return{default:O,overrides:b}}function D(H,S){const O=te[H];if(!O||!O.pushable)return"client";const b=S.overrides[H];return b==="engine"||b==="client"?b:S.default==="client"?"client":S.default==="engine-if-identical"?O.class==="identical"?"engine":"client":"engine"}function Z(H,S){const O=B(S),b=[],c=[];for(const f of H||[]){const o=te[f.fn],n=D(f.fn,O),t={id:f.id,col:f.col,fn:f.fn,class:o?o.class:"fallback"};f.weight!==void 0&&(t.weight=f.weight),f.params!==void 0&&(t.params=f.params),n==="engine"?b.push(t):(t.reason=o&&!o.pushable?o.note||"the engine cannot express this stat":"client by config",c.push(t))}return{engine:b,client:c,config:O}}const K=/^[A-Za-z_][A-Za-z0-9_$]*$/;function I(H,S=[]){return(H||[]).every(b=>{if(typeof b=="string")return K.test(b);if(!b||typeof b!="object")return!1;const c=b;return Array.isArray(S)&&S.includes(c.bucket)&&typeof c.col=="string"&&K.test(c.col)&&typeof c.size=="number"&&Number.isFinite(c.size)&&c.size>0})}function G(){return Object.entries(te).map(([H,S])=>({stat:H,class:S.class,sql:S.sql?X(S.sql,"col",S.twoColumn?"weight":void 0):"",note:S.note||(S.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),De("packages/core/src/source/pushdown.js",function(e,U){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return q}});const M=U("packages/core/src/internal/compare.js").defaultCompare,B=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/merge.js").toArray,I=U("packages/core/src/internal/warn.js").warnOnce,G=U("packages/core/src/source/filterwire.js"),H=G.isGroup,S=G.warnWherePageRelative,O=G.warnWhereOverThreshold,b=G.wireFilters,c=U("packages/core/src/source/aggregates.js"),f=c.resolveAggregatePlan,o=c.groupKeysPushable,n=c.STAT_PUSHDOWN,i=U("packages/core/src/source/abort.js").SupersededError,s=1e3;function r(V){const J=V&&V.signal;if(!J||!J.aborted)return;const ee=J.reason;throw ee instanceof Error?ee:new i("","superseded before it was sent")}const u=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function a(V){if(!V||typeof V!="object")return!1;const J=V.returning==="row"||V.returning==="key"?V.returning:"none";return{append:V.append===!0,update:V.update===!0,delete:V.delete===!0,returning:J}}function l(V,J){if(!V||typeof J!="string")return;if(!J.includes("."))return V[J];let ee=V;for(const ne of J.split(".")){if(ee===null||typeof ee!="object")return;ee=ee[ne]}return ee}function h(V){if(V===!0)return!0;if(!V||typeof V!="object")return!1;const J=V;return J.enabled===!1?!1:J.enabled===!0||B(J.commit)}function y(V){const J={...u,...V||{}};return J.operators=new Set(J.operators||[]),J.mutate=a(J.mutate),J}function m(V,J){return!V||!V.op||!J.operators.size?!1:J.operators.has(V.op)}function v(V,J){if(!V)return{pushed:null,residual:null};if(!J.filter)return{pushed:null,residual:V};if(J.filter==="term"){if(H(V)){const re=V.conditions||[];if(String(V.op)!=="and")return{pushed:null,residual:V};const ae=re.findIndex(de=>!H(de)&&m(de,J));if(ae<0)return{pushed:null,residual:V};const fe=re.filter((de,ve)=>ve!==ae);return{pushed:re[ae],residual:fe.length?{op:"and",conditions:fe}:null}}return m(V,J)?{pushed:V,residual:null}:{pushed:null,residual:V}}if(!H(V))return m(V,J)?{pushed:V,residual:null}:{pushed:null,residual:V};if(String(V.op)!=="and")return(V.conditions||[]).every(ae=>H(ae)?v(ae,J).residual===null:m(ae,J))?{pushed:V,residual:null}:{pushed:null,residual:V};const ee=[],ne=[];for(const re of V.conditions||[]){if(H(re)){if(J.filter==="flat"){ne.push(re);continue}const ae=v(re,J);ae.pushed&&ee.push(ae.pushed),ae.residual&&ne.push(ae.residual);continue}(m(re,J)?ee:ne).push(re)}const oe=re=>re.length===0?null:re.length===1?re[0]:{op:"and",conditions:re};return{pushed:oe(ee),residual:oe(ne)}}const d="__lattice_leaves";function p(V){return V.aggregates?V.aggregates instanceof Set?V.aggregates:new Set(Z(V.aggregates)):new Set}function g(V){const J=p(V);return J.size?J.has("count")?V.filter!=="tree"||!V.operators||!V.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 k(V,J,ee,ne,oe,re,ae){const fe=Array.isArray(V.groupBy)?V.groupBy:[],de=Array.isArray(V.groupPath)?V.groupPath:[],ve=Array.isArray(V.groupValues)?V.groupValues:null;if(!J.group){const Ie=g(J);if(Ie)return Ie}return o(fe)?ee.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ne?oe?re?"a host `where` predicate can only run in the browser, over rows the engine grouped":ae?"fullDataset holds the whole matching set, so the grid groups it itself":!ve||ve.length!==de.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 w="pushdown:pivot-unsupported",E="pushdown:group-unsupported",N=Symbol("lattice.remote.ungroupedLevel");function x(V,J,ee,ne,oe,re){const ae=Array.isArray(V.pivotBy)?V.pivotBy:[],fe=Array.isArray(V.groupBy)?V.groupBy:[],de=Array.isArray(V.groupPath)?V.groupPath:[],ve=Array.isArray(V.groupValues)?V.groupValues:null;return J.pivot?o(ae)?fe.length&&!o(fe)?"a grouping key is not a plain column the engine can name in a GROUP BY":ee.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ne?oe?re?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!ve||ve.length!==de.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 _(V,J,ee=!1){const ne=v(V.filters||null,J),oe=[];ne.residual&&oe.push("filter");const re=V.sort||[],ae=re.length===0||J.sort==="multi"&&re.length>=1||J.sort==="single"&&re.length===1;!ae&&re.length&&oe.push("sort");const fe=V.quick?String(V.quick):"",de=!fe||!!J.quick;de||oe.push("quick");const ve=V.where&&V.where.active?V.where:null;ve&&oe.push("where");const Ie={filters:ne.residual,sort:ae?null:re,quick:de?"":fe,where:ve},Le=!!ee,se=Array.isArray(V.groupBy)&&V.groupBy.length>0,pe=se?k(V,J,ne,ae,de,ve,Le):"",be=V.pivotMode!==!1&&Array.isArray(V.pivotBy)&&V.pivotBy.length>0,ke=be?x(V,J,ne,ae,de,ve):"",je=be&&ke==="";be&&!je&&oe.push("pivot");const xe=be?je&&se:se&&pe==="";se&&!be&&!xe&&oe.push("group");const ge=(xe||je)&&Array.isArray(V.groupValues)?V.groupValues.length:0,we=xe||be?!1:Le||!!(Ie.filters||Ie.sort||Ie.quick||Ie.where)||!J.range;return{pushed:{...V,filters:ne.pushed,sort:ae?re:[],quick:de?fe:"",range:we?null:V.range},residual:Ie,needsAll:we,unpushed:oe,full:Le,grouped:xe,groupLevel:ge,groupReason:be?"":pe,pivoted:je,pivotReason:ke}}function F(V){const J=Array.isArray(V.totals)?V.totals:[],ee=V.totalFns&&typeof V.totalFns=="object"?V.totalFns:{},ne=[],oe=[];for(const re of J){const ae=String(re),fe=typeof ee[ae]=="string"?ee[ae]:null,de=fe?n[fe]:null;fe?!de||!de.pushable||!de.sql?oe.push({id:ae,fn:fe,class:de?de.class:"fallback",reason:de&&de.note?de.note:`the pushdown map cannot express "${fe}"`}):de.twoColumn?oe.push({id:ae,fn:fe,class:de.class,reason:`"${fe}" reduces two columns, and a grouped request carries no weight column`}):ne.push({id:ae,col:ae,fn:fe,class:de.class}):oe.push({id:ae,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ne,client:oe}}const L=Object.freeze({items:V=>V==null?[]:Array.isArray(V)?V:[V]});function j(V,J,ee){if(!J)return V;let ne=V;if(J.filters&&B(ee.evaluateFilters)){const oe=ne,re={count:ne.length,handle:de=>({id:de,get:ve=>l(oe[ve],de)}),itemwise:de=>oe.some(ve=>Array.isArray(l(ve,de)))?L:null},ae=ee.evaluateFilters(J.filters,re),fe=[];for(let de=0;de<ne.length;de++)ae[de]&&fe.push(ne[de]);ne=fe}if(J.where&&J.where.active&&(J.whole||S(J.where.names,"pushdown"),ne=ne.filter(oe=>J.where.passes(oe))),J.quick){const oe=J.quick.toLowerCase();ne=ne.filter(re=>{if(!re||typeof re!="object")return!1;for(const ae of Object.values(re))if(ae!=null&&String(ae).toLowerCase().includes(oe))return!0;return!1})}if(J.sort&&J.sort.length&&B(ee.sortMulti)){const oe=[...new Set(J.sort.map(de=>de.col))],re=ne,ae=oe.map(de=>({id:de,get:ve=>l(re[ve],de)})),fe=ee.sortMulti(ae,J.sort.map(de=>({col:de.col,dir:de.dir})),Uint32Array.from({length:ne.length},(de,ve)=>ve),{});ne=Array.from(fe,de=>re[de])}return ne}function R(V){return JSON.stringify({filters:V.filters||null,sort:V.sort||[],quick:V.quick||"",groupBy:V.groupBy||[],groupPath:V.groupPath||[],context:V.context??null})}function $(V){if(!V||typeof V!="object")return 16;let J="";try{J=JSON.stringify(V)}catch{return 200}return J.length*2+64}function T(V){const J=V||{};return{enabled:!!J.enabled,maxRows:Number.isFinite(J.maxRows)?J.maxRows:1e6,maxBytesEstimate:Number.isFinite(J.maxBytesEstimate)?J.maxBytesEstimate:512*1024*1024}}const A=5e4;function C(V){return Number.isFinite(V)&&V>=0?V:A}function z(V){return!!V&&B(V.then)}async function Y(V){if(!V||V.total!==void 0||!z(V.pendingTotal))return V;const J=await V.pendingTotal,{pendingTotal:ee,...ne}=V;return typeof J=="number"?{...ne,total:J}:ne}function q(V={}){const J=V.adapter;if(!J||!B(J.execute))return I("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...V,mode:"remote",fetch:async()=>({rows:[],total:0})};const ee=y(J.capabilities),ne=J.capabilities&&Object.getOwnPropertyDescriptor(J.capabilities,"operators");ne&&B(ne.get)&&Object.defineProperty(ee,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(J.capabilities.operators||[]),set:()=>{}});const oe=J.name||"adapter";let re=null;const ae=()=>B(J.ready)?(re||(re=Promise.resolve(J.ready()).then(()=>{Object.assign(ee,y(J.capabilities))},he=>{throw re=null,he})),re):null,fe=T(V.fullDataset),de=!!V.allowPartialResults,ve=C(V.whereRowLimit);let Ie=null;const Le=V.aggregates;let se=null,pe=null,be=null,ke=null,je=null,xe,ge=null,we=0,Me=null;const Ye=()=>!fe.enabled||!se?null:(Me!==se.key&&(we++,Me=se.key),{rows:se.rows,version:we}),Ae=async he=>{const Se=he.where&&he.where.active?he.where:null;if(!Se)return{request:he,probe:null};const{where:Ee,...Te}=he,Fe=_(Te,ee,fe.enabled);if(Fe.needsAll)return{request:he,probe:null};const Ue=R(Fe.pushed);let _e=null;return(!Ie||Ie.key!==Ue)&&(ee.total?(r(he),_e=await Y(await J.execute(Fe.pushed,he)),Ie={key:Ue,size:_e&&typeof _e.total=="number"?_e.total:null}):Ie={key:Ue,size:null}),Ie.size!==null&&Ie.size<ve?{request:he,probe:null}:(O(Se.names,oe,Ie.size,ve),{request:Te,probe:_e})},Ve=async(he,Se)=>{ge=null;const Ee=F(he.pushed);be={engine:Ee.engine,client:Ee.client,groupBy:he.pushed.groupBy},Ee.client.length&&I(`source.pushdown.group.totals.${oe}.${Ee.client.map(Ue=>Ue.id).join(".")}`,`the ${oe} adapter cannot compute the group subtotal for ${Ee.client.map(Ue=>`"${Ue.id}" (${Ue.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 Te=await J.executeGroupLevel(he.pushed,Ee.engine,Se)||{};let Fe=Te.rows||[];return!ee.range&&Se.range&&(Fe=Fe.slice(Se.range.start,Se.range.end)),Ke(Te),Te.total===void 0?{rows:Fe}:{rows:Fe,total:Te.total}},Pe=new Map,Oe=64,He=async(he,Se)=>{ge=null;const Ee=he.pushed,Te=Ee.groupBy,Fe=Array.isArray(Ee.groupValues)?Ee.groupValues:[],Ue=Fe.length,_e=[...Ee.filters?[Ee.filters]:[],...Te.slice(0,Ue).map((bt,mt)=>({col:bt,op:"eq",value:Fe[mt]===void 0?null:Fe[mt],caseSensitive:!0}))],Je=_e.length===0?null:_e.length===1?_e[0]:{op:"and",conditions:_e},$e=Se.range?Se.range.start:0;if(Ue>=Te.length){const bt={...Ee,filters:Je,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},mt=await Y(await J.execute(bt,Se))||{};let Lt=mt.rows||[];return!ee.range&&Se.range&&(Lt=Lt.slice(Se.range.start,Se.range.end)),typeof mt.total=="number"?{rows:Lt,total:mt.total}:{rows:Lt}}const ze=Te[Ue],Qe=F(Ee),tt=p(ee),et=Qe.engine.filter(bt=>tt.has(bt.fn)),dt=[...Qe.engine.filter(bt=>!tt.has(bt.fn)).map(bt=>({id:bt.id,fn:bt.fn,class:bt.class,reason:`the ${oe} adapter does not compute "${bt.fn}"`})),...Qe.client];be={engine:et,client:dt,groupBy:Te},dt.length&&I(`source.pushdown.group.totals.${oe}.${dt.map(bt=>bt.id).join(".")}`,`the ${oe} adapter cannot compute the group subtotal for ${dt.map(bt=>`"${bt.id}" (${bt.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 ft=[...et.map(bt=>({id:bt.id,col:bt.col,fn:bt.fn})),{id:d,col:ze,fn:"count"}],lt={...Ee,filters:Je,range:null},At=JSON.stringify([R(lt),Fe,ze,ft]);let Tt=$e>0?Pe.get(At):void 0;if(!Tt){for(Tt=Promise.resolve(J.executeGroupedAggregates(lt,[ze],ft)),Pe.delete(At),Pe.set(At,Tt);Pe.size>Oe;)Pe.delete(Pe.keys().next().value);Tt.catch(()=>{Pe.get(At)===Tt&&Pe.delete(At)})}const It=await Tt||[];r(Se);const Ge=bt=>{const mt={};for(const Lt of et)mt[Lt.id]=bt?bt[Lt.id]:void 0;return mt},vt=(Ee.sort||[]).find(bt=>bt&&bt.col===ze),ht=vt&&vt.dir==="desc"?-1:1,kt=It.filter(bt=>bt&&bt.level===1).map(bt=>({[ze]:bt.keys[0]===void 0?null:bt.keys[0],leafCount:Number(bt.values&&bt.values[d])||0,totals:Ge(bt.values)})).sort((bt,mt)=>ht*M(bt[ze],mt[ze]));if(Ue===0){const bt=It.find(Lt=>Lt&&Lt.level===0),mt=bt?Number(bt.values&&bt.values[d]):NaN;Ke({matchCount:Number.isFinite(mt)?mt:kt.reduce((Lt,Ht)=>Lt+Ht.leafCount,0),...bt?{grand:Ge(bt.values)}:{}})}const Nt=Se.range?Se.range.end:kt.length;return{rows:kt.slice($e,Nt),total:kt.length}},Ke=he=>{typeof he.matchCount=="number"&&(ke=he.matchCount,je=he.grand?{totals:he.grand,leafCount:he.matchCount}:null,xe===void 0&&B(J.unfilteredCount)&&(xe=null,Promise.resolve(J.unfilteredCount()).then(Se=>{xe=typeof Se=="number"?Se:null}).catch(Se=>{I(`source.pushdown.group.unfiltered.${oe}`,`the ${oe} adapter could not count the unfiltered set (${Se&&Se.message?Se.message:Se}), so "N of M" falls back to the display count for its denominator.`)})))},Xe=async(he,Se)=>{ge=null;const Ee=F(he.pushed);be={engine:Ee.engine,client:Ee.client,groupBy:he.pushed.groupBy,pivotBy:he.pushed.pivotBy},Ee.client.length&&I(`source.pushdown.pivot.totals.${oe}.${Ee.client.map(Je=>Je.id).join(".")}`,`the ${oe} adapter cannot compute the pivot cells for ${Ee.client.map(Je=>`"${Je.id}" (${Je.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 Te=await J.executePivotLevel(he.pushed,Ee.engine,Se)||{};let Fe=Te.rows||[];!ee.range&&Se.range&&(Fe=Fe.slice(Se.range.start,Se.range.end)),Ke(Te);const Ue=Te.pivot&&typeof Te.pivot=="object"?Te.pivot:{},_e={cells:Array.isArray(Ue.cells)?Ue.cells:[],...Array.isArray(Ue.axis)?{axis:Ue.axis}:{}};return Te.total===void 0?{rows:Fe,pivot:_e}:{rows:Fe,total:Te.total,pivot:_e}},nt=he=>{I(`source.pushdown.pivot.${oe}.${he}`,`pushdown:pivot-unsupported: the ${oe} adapter cannot pivot this query because ${he}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Se=new Error(`[lattice] ${w}: the ${oe} adapter cannot pivot this query because ${he}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Se.code=w,Se.reason=he,Se},st=(he,Se)=>{const Ee={key:Se,state:"pending",value:null};return ge=Ee,he.then(Te=>(ge===Ee&&(ge={key:Se,state:"settled",value:typeof Te=="number"?Te:null}),Te),Te=>{throw ge===Ee&&(ge={key:Se,state:"failed",value:null}),Te})};let wt=0,pt=[];const St=()=>wt===0?null:new Promise(he=>{const Se=setTimeout(he,s);pt.push(()=>{clearTimeout(Se),he()})});let Ct;const Mt=async he=>{const Se=ae();Se&&await Se;const Te=he&&he.pivotMode!==!1&&Array.isArray(he.pivotBy)&&he.pivotBy.length>0?{request:he,probe:null}:await Ae(he);r(he);let Fe=_(Te.request,ee,fe.enabled);if(ee.group&&Fe.grouped&&!Fe.pivoted&&!B(J.executeGroupLevel)&&(I(`source.pushdown.group.method.${oe}`,`the ${oe} 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.`),Fe=_(Te.request,{...ee,group:!1,aggregates:null},fe.enabled)),Fe.pivoted&&!B(J.executePivotLevel)&&(Fe=_(Te.request,{...ee,pivot:!1},fe.enabled),Fe.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Fe.grouped&&!Fe.pivoted&&!ee.group&&!B(J.executeGroupedAggregates)&&(I(`source.pushdown.group.aggregates.method.${oe}`,`the ${oe} 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\`.`),Fe=_(Te.request,{...ee,aggregates:null},fe.enabled)),pe=Fe,Fe.pivoted)return Xe(Fe,he);if(Fe.pivotReason&&nt(Fe.pivotReason),Fe.grouped)return ee.group?Ve(Fe,he):He(Fe,he);const _e=!!Fe.groupReason&&!Fe.full;_e?I(`source.pushdown.group-unsupported.${oe}.${Fe.groupReason}`,`pushdown:group-unsupported: the ${oe} adapter was not asked to group this query because ${Fe.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.`):Fe.groupReason&&I(`source.pushdown.group.${oe}.${Fe.groupReason}`,`the ${oe} adapter was not asked to group this query because ${Fe.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 Je=ft=>_e?{...ft,[N]:!0}:ft;if(!Fe.needsAll){const ft=Te.probe||await J.execute(Fe.pushed,he),lt=ft.rows||[];return z(ft.pendingTotal)&&ft.total===void 0?Je({rows:lt,pendingTotal:st(ft.pendingTotal,R(Fe.pushed))}):(ge=null,!ee.total&&ft.total===void 0?Je({rows:lt}):Je({rows:lt,total:ft.total??lt.length}))}Fe.unpushed.length&&I(`source.pushdown.residual.${oe}.${Fe.unpushed.join(".")}`,`the ${oe} adapter cannot push ${Fe.unpushed.join(" or ")}, so every matching row is fetched and the rest is applied in the browser. Correct, and slower than it needs to be: widening the adapter is the fix.`);const $e=R(Fe.pushed);if(!se||se.key!==$e){const ft=await Y(await J.execute(Fe.pushed,he));ge=null;const lt=ft.rows||[];if(Fe.full){const At=typeof ft.total=="number"?Math.max(ft.total,lt.length):lt.length;if(At>fe.maxRows)throw new Error(`[lattice] fullDataset refused: the ${oe} adapter's matching set is ${At.toLocaleString()} rows, past the configured maxRows of ${fe.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 Tt=lt.length*$(lt[0]);if(Tt>fe.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${oe} adapter's matching set is an estimated ${Math.round(Tt/(1024*1024)).toLocaleString()} MB across ${lt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(fe.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 ft.total=="number"&&lt.length<ft.total){const At=!!(Fe.residual.filters||Fe.residual.quick||Fe.residual.sort&&Fe.residual.sort.length);if(At&&!de)throw new Error(`[lattice] the ${oe} adapter returned ${lt.length} of ${ft.total} matching rows when asked for the whole result, and the query has residual ${Fe.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.`);At?I(`source.pushdown.partial.residual.${oe}`,`the ${oe} adapter returned ${lt.length} of ${ft.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.`):I(`source.pushdown.partial.${oe}`,`the ${oe} adapter returned ${lt.length} of ${ft.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}se={key:$e,rows:lt,total:typeof ft.total=="number"?ft.total:null}}let ze=Fe;if(Fe.residual.where){const ft=se.total??se.rows.length;if(ft>=ve){O(Fe.residual.where.names,oe,ft,ve);const{where:lt,...At}=Te.request;ze=_(At,ee,fe.enabled),pe=ze}}const Qe=se.total!==null&&se.rows.length>=se.total,tt=j(se.rows,{...ze.residual,whole:Qe},V.compute||{}),et=he.range?he.range.start:0,dt=he.range?he.range.end:tt.length;return Je({rows:tt.slice(et,dt),total:tt.length})},at=async(he,Se,Ee)=>{const Fe=Ee&&Ee.waitForPage&&Ct&&B(Ct.pageForegroundIdle)?Ct.pageForegroundIdle():St();Fe&&await Fe;const Ue=ae();Ue&&await Ue;const _e=_(he,ee,fe.enabled);pe=_e;const Je=f(Se,Le),$e=Array.isArray(he.groupBy)?he.groupBy:[],ze=$e.length>0,Qe=!_e.residual.filters&&!_e.residual.quick,tt=!ze||o($e,ee.buckets);let et=Je.engine,dt=Je.client;if(ee.aggregates&&et.length){const Tt=ee.aggregates instanceof Set?ee.aggregates:new Set(Z(ee.aggregates)),It=et.filter(Ge=>!Tt.has(Ge.fn));It.length&&(et=et.filter(Ge=>Tt.has(Ge.fn)),dt=[...It.map(Ge=>({...Ge,reason:`the ${oe} adapter does not compute "${Ge.fn}"`})),...dt])}const ft=Tt=>{dt=[...et.map(It=>({...It,reason:Tt})),...dt],et=[]};et.length&&!Qe?ft(_e.residual.quick&&!_e.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):et.length&&!tt&&ft("a grouping key the engine cannot form forces all-client (no mixed provenance)");let lt={},At;return et.length&&(B(ze?J.executeGroupedAggregates:J.executeAggregates)?ze?At=await J.executeGroupedAggregates(_e.pushed,$e,et)||[]:lt=await J.executeAggregates(_e.pushed,et)||{}:(I(`source.pushdown.aggregates.${oe}${ze?".grouped":""}`,`the ${oe} adapter cannot compute ${ze?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),ft(`adapter cannot compute ${ze?"grouped ":""}aggregates`))),be={engine:et,client:dt,...ze?{groupBy:$e}:{}},{values:lt,engine:et,client:dt,...At!==void 0?{groups:At}:{}}},ot=async he=>{wt++;try{return await Mt(he)}finally{if(wt--,wt===0&&pt.length){const Se=pt;pt=[];for(const Ee of Se)Ee()}}},gt=h(V.edit),Et=V.edit&&typeof V.edit=="object"&&B(V.edit.commit);let ut=V.edit;if(gt&&!Et)if(ee.mutate&&ee.mutate.update){const he=Se=>{if(!ee.mutate||!ee.mutate.update)throw new Error(`[lattice] the ${oe} 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 Ee={kind:"update",key:String(Se.key),patch:{[Se.colId]:Se.value}};return J.mutate(Ee,Se.request||{})};ut={...V.edit===!0?{}:V.edit,commit:he}}else I(`source.pushdown.readonly.${oe}`,`edit is enabled but the ${oe} adapter declares mutate: ${ee.mutate?"without update":"false"} (read-only by declaration), so no commit is synthesised and the grid stays read-only. Declare \`mutate: { update: true }\` on the adapter to allow cell edits.`);const me=gt&&ee.mutate&&(ee.mutate.append||ee.mutate.delete)?{append:ee.mutate.append===!0,remove:ee.mutate.delete===!0,returning:ee.mutate.returning,mutate:(he,Se)=>J.mutate(he,Se||{})}:null,Ce=async he=>{const Se=ae();Se&&await Se;const{range:Ee,signal:Te,export:Fe,...Ue}=he||{},_e={...Ue,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:_(_e,ee,fe.enabled),signal:Te}};async function*ce(he,Se={}){const{plan:Ee,signal:Te}=await Ce(he),Fe=Math.max(1,Math.floor(Number(Se.pageSize))||5e3),Ue={signal:Te,stream:!0};if(!Ee.needsAll)for(let $e=0;;$e+=Fe){r(Ue);const ze=await J.execute({...Ee.pushed,range:{start:$e,end:$e+Fe}},Ue);ze&&z(ze.pendingTotal)&&ze.pendingTotal.then(null,()=>{});const Qe=ze&&ze.rows||[];if(Qe.length&&(yield Qe),Qe.length<Fe)return}r(Ue);const _e=await Y(await J.execute({...Ee.pushed,range:void 0},Ue)),Je=j(_e&&_e.rows||[],{...Ee.residual,whole:!0},V.compute||{});for(let $e=0;$e<Je.length;$e+=Fe)yield Je.slice($e,$e+Fe)}return Ct={...V,edit:ut,rowMutate:me,mode:"remote",fetch:ot,foregroundIdle:St,aggregate:at,countMatching:async he=>{const{plan:Se,signal:Ee}=await Ce(he);if(!Se.needsAll&&ee.total){r({signal:Ee});const Fe=await Y(await J.execute({...Se.pushed,range:{start:0,end:0}},{signal:Ee}));if(Fe&&typeof Fe.total=="number")return Fe.total}let Te=0;for await(const Fe of ce(he))Te+=Fe.length;return Te},streamMatching:ce,capabilitiesOf:y,planQuery:_,wireFilters:b,resolveAggregatePlan:he=>f(he,Le),STAT_PUSHDOWN:n,lastPlan:()=>pe?{...pe,...be?{aggregates:be}:{},...ge?{total:{deferred:!0,state:ge.state,value:ge.value}}:{}}:null,fullFrame:Ye,counts:()=>({match:ke,total:xe??null,pending:!!ge&&ge.state==="pending"}),grandTotals:()=>je},Ct}}),De("packages/core/src/source/remote.js",function(e,U){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return R}});const M=U("packages/core/src/internal/lru.js").Lru,B=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/warn.js").warnOnce,I=U("packages/core/src/internal/schedule.js").settleDebounce,G=U("packages/core/src/source/abort.js"),H=G.createAbortScope,S=G.isAbortError,O=U("packages/core/src/source/blockcache.js"),b=O.BlockCache,c=O.DEFAULT_PAGE_SIZE,f=O.DEFAULT_MAX_CACHED_PAGES,o=U("packages/core/src/source/rows.js"),n=o.createRowFactory,t=o.groupKey,i=U("packages/core/src/source/filterwire.js"),s=i.wireFilters,r=i.querySignature,u=i.warnHostFilterNotApplied,l=U("packages/core/src/source/pagewindow.js").pageWindow,y=U("packages/core/src/source/memory.js").MemorySource,v=U("packages/core/src/compute/handle.js").valueComparator,d=U("packages/core/src/compute/pivot.js"),p=d.pivotKey,g=d.joinPath,k=d.DEFAULT_PATH_SEPARATOR,E=U("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,N=1,x=120,_=1e3;function F($,T,A){for(let C=0;C<Math.max($.length,T.length);C++){const z=$[C],Y=T[C],q=z==null,V=Y==null;if(q||V){if(q&&V)continue;return q?1:-1}const J=A(z,Y);if(J!==0)return J}return 0}function L($,T){return new R($,T)}class j{constructor(T,A,C,z){this.path=T,this.keyPath=z||T,this.values=[],this.level=A,this.key=t(this.keyPath),this.cache=new b(C),this.count=null,this.complete=!1,this.announced=null,this.counting=!1,this.failed=!1,this.children=new Map,this.row=null,this.flat=!1}}class R{mode="remote";#e;#t;#n;#r;#s=new Map;#i=new Set;#o=H();#l;#a;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#j="";#w=null;#O=-1;constructor(T,A){this.#e=T||{mode:"remote"},this.#t=A||{},B(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#G(),this.unfilteredIndices=()=>this.#_(),this.handleFor=V=>this.#x(V),this.display=()=>this.#I(),this.grandTotalRow=()=>this.#D(),this.unfilteredRows=()=>this.#B(),this.facetIndices=V=>this.#Y(V));const C=this.#e.counts;B(C)&&(this.matchCount=()=>this.#K("match"),this.totalCount=()=>this.#K("total"));const z=this.#e.grandTotals;B(z)&&(this.grandTotalRow=()=>this.#H());const Y=this.#e.foregroundIdle;B(Y)&&(this.foregroundIdle=()=>this.#be(Y),this.#e.pageForegroundIdle=()=>this.#b?this.#be(Y):null);const q=this.#e;B(q.countMatching)&&B(q.streamMatching)&&(this.selectionQuery=()=>this.#fe(),this.countMatching=V=>q.countMatching(V),this.streamMatching=(V,J)=>q.streamMatching(V,J),this.loadedRows=()=>this.#pe(),this.resident=()=>this.#R()!==null),this.#n={pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||f},this.#l=n(this.#t),this.#a=new M(this.#n.pageSize*4),this.#h=I((V,J)=>this.#P(V,J),x),this.#r=new j([],0,this.#n),this.#s.set(this.#r.key,this.#r),this.#d=this.#Oe(),B(this.#e.fetch)||Z("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#Le()}count(){const T=this.#S();return T?T.length:this.#v()}#v(){const T=this.#R();return T?T.count():(this.#X(),this.#re(this.#r))}#T(){if(this.#R())return!0;const T=A=>{if(A.count===null&&!A.complete)return!1;for(const C of A.children.values())if(this.#we(C.key)&&!T(C))return!1;return!0};return T(this.#r)}pageInfo(){const T=this.#S(),A=this.totalPending();if(!T){const C=this.#v();return{page:0,pageSize:0,total:this.#T()?C:null,pageCount:1,counting:A}}return{page:T.page,pageSize:T.pageSize,total:T.total,pageCount:T.pageCount,counting:A||T.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const T=this.#v(),A=l(this.#C("pageSize",0),this.#C("page",0),T,this.#T());if(!A)return this.#j="",null;const C=`${this.#y}:${A.offset}:${A.length}`;return C!==this.#j&&!this.#p&&(this.#j=C,A.length>0&&!this.#R()&&this.#P(A.offset,A.offset+A.length-1)),A}at(T){const A=this.#S();if(A){if(T<0||T>=A.length)return;const C=this.#E(A.offset+T);return C&&(C.index=T),C}return this.#E(T)}#E(T){const A=this.#R();if(A)return A.at(T);if(this.#X(),T<0||T>=this.#v())return;const C=this.#V(this.#r,T);if(!C)return;const z=this.#q(C.node,C.local);return z&&(z.index=T),z||this.#l.skeleton(T,C.node.level,C.node.cache.erroredAt(C.local))}byKey(T){const A=this.#R();if(A)return A.byKey(T);const C=this.#c.get(T);if(!C)return;const z=C.lastIndexOf(":"),Y=this.#s.get(C.slice(0,z));return Y&&this.#q(Y,Number(C.slice(z+1)))||void 0}loaded(T){const A=this.#S();if(A){if(T<0||T>=A.length)return!1;T+=A.offset}const C=this.#R();if(C)return C.loaded(T);if(T<0||T>=this.#v())return!1;const z=this.#V(this.#r,T);return!!z&&z.node.cache.rowLoaded(z.local)}hint(T,A){if(this.#p)return;this.#b=!0;const C=this.#X();let z=Math.max(0,Math.floor(T)),Y=Math.max(z,Math.floor(A));const q=this.#S();if(q){if(q.length===0)return;z=q.offset,Y=q.offset+q.length-1}for(const[V,J]of this.#N(z,Y)){V.cache.protect(J.min,J.max);for(const ee of V.cache.evict())this.#Te(V,ee)}this.#h(z,Y),C&&this.#h.flush()}#N(T,A){const C=this.#v(),z=new Map;for(let Y=T;Y<=A&&Y<C;Y++){const q=this.#V(this.#r,Y);if(!q)continue;const V=z.get(q.node);V?(V.min=Math.min(V.min,q.local),V.max=Math.max(V.max,q.local)):z.set(q.node,{min:q.local,max:q.local})}return z.size||z.set(this.#r,{min:T,max:T}),z}#P(T,A){if(!this.#p)for(const[C,z]of this.#N(T,A)){C.cache.protect(z.min,z.max);const Y=C.cache.blockOf(z.min),q=C.cache.blockOf(z.max);for(let V=Y;V<=q&&!(C.count!==null&&V*C.cache.pageSize>=C.count);V++)C.cache.has(V)||this.#Be(C,V)}}apply(T){const A={added:[],updated:[],removed:[]};if(!T)return A;if(T.update)for(const C of T.update){const z=this.#c.get(this.#l.keyOf(C,-1));if(!z)continue;this.#a.delete(z);const Y=z.lastIndexOf(":"),q=this.#s.get(z.slice(0,Y));if(!q)continue;const V=Number(z.slice(Y+1)),J=q.cache.blockOf(V);if(!q.cache.loaded(J))continue;const{start:ee}=q.cache.rangeOf(J),ne=[];for(let re=ee;re<ee+q.cache.pageSize;re++){const ae=q.cache.rowAt(re);if(ae===void 0)break;ne.push(re===V?C:ae)}q.cache.fill(J,ne);const oe=this.#q(q,V);oe&&A.updated.push(oe)}return(T.add&&T.add.length||T.remove&&T.remove.length)&&this.reload({keepExpanded:!0}),A}reload(T){this.#o.abortAll("reload"),this.#h.cancel(),T&&T.keepExpanded===!1&&this.#i.clear(),this.#oe(),this.#W("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#oe(),this.#s.clear(),this.#i.clear(),this.#w&&B(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(T){this.#i.has(T)||(this.#i.add(T),this.#W("group:toggled",{key:T,expanded:!0}),this.#W("model:changed",{reason:"expand",key:T}))}collapse(T){this.#i.delete(T)&&(this.#W("group:toggled",{key:T,expanded:!1}),this.#W("model:changed",{reason:"collapse",key:T}))}expandedKeys(){return[...this.#i]}pivotFields(){return this.#u}pivot(){this.#X();const T=this.#f;if(!T||!T.keys.size||!this.#C("pivotBy",[]).length)return null;if(!T.result){const A=v((this.#t.config||{}).locale),C=[...T.keys.entries()].sort((Y,q)=>F(Y[1],q[1],A)),z=C.map(([Y])=>Y);T.result={keys:C.map(([,Y])=>Y),paths:z,fields:this.#ne(z),groupPaths:[],columns:z.length*Math.max(1,this.#Ee().length),values:T.cells,cells:T.cells,error:null}}return T.result}invalidateHandles(){this.#w&&(B(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),B(this.#w.invalidate)&&this.#w.invalidate("filter"))}#M(){const T=this.#e.fullFrame;return B(T)?T():null}#R(){const T=this.#M();return T?(this.#w||(this.#w=new y({mode:"memory"},this.#L())),T.version!==this.#O&&(this.#w.setRows(T.rows),this.#O=T.version),this.#w):null}#L(){const T=this.#t,A=T.state||{};return{...T,state:{...A,page:()=>0,pageSize:()=>0}}}#G(){const T=this.#R();return T?T.filteredIndices():new Uint32Array(0)}#_(){const T=this.#R();return T?T.unfilteredIndices():new Uint32Array(0)}#x(T){const A=this.#R();return A?A.handleFor(T):void 0}#I(){const T=this.#R();return T?T.display():[]}#Y(T){const A=this.#R();return A&&B(A.facetIndices)?A.facetIndices(T):new Uint32Array(0)}#D(){const T=this.#R();return T&&B(T.grandTotalRow)?T.grandTotalRow():null}#K(T){const A=this.#R();if(A){const q=T==="match"?A.matchCount:A.totalCount;if(B(q))return q.call(A)}const C=this.#e.counts,z=B(C)?C():null,Y=z?z[T]:null;return typeof Y=="number"?Y:this.#v()}#H(){const T=this.#R();if(T&&B(T.grandTotalRow))return T.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const C=this.#e.grandTotals,z=B(C)?C():null;return!z||!z.totals?null:this.#l.grandTotal(z.totals,z.leafCount||0)}#B(){const T=this.#R();if(T&&B(T.unfilteredRows))return T.unfilteredRows();const A=[],C=this.count();for(let z=0;z<C;z++){const Y=this.at(z);Y&&A.push(Y)}return A}#fe(){const T=this.#C("quick",""),A={protocol:N,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:s(this.#C("filters",null),this.#U()),sort:this.#C("sort",[]),context:this.#C("context",null)};T&&(A.quick=T);const C=this.#C("where",null);return C&&C.active&&(A.where=C),A}#pe(){const T=this.#C("groupBy",[]).length,A=[];for(const C of this.#s.values())if(!(C.level!==T&&!C.flat))for(const z of C.cache.ids()){if(!C.cache.loaded(z))continue;const{start:Y,end:q}=C.cache.rangeOf(z);for(let V=Y;V<q&&C.cache.rowLoaded(V);V++){const J=this.#q(C,V);J&&!J.group&&A.push(J)}}return A}loadedCount(){const T=this.#R();if(T){const z=T.matchCount();return typeof z=="number"?z:T.count()}this.#X();const A=this.#C("groupBy",[]).length;let C=0;for(const z of this.#s.values())if(!(z.level!==A&&!z.flat))for(const Y of z.cache.ids()){if(!z.cache.loaded(Y))continue;const q=z.cache.fillOf(Y);typeof q=="number"&&(C+=q)}return C}residentRows(){const T=this.#R();return T?T.display():this.#C("groupBy",[]).length>0?null:(this.#X(),this.#pe())}#ie(T,A,C){const{start:z,end:Y}=T.cache.rangeOf(A),q=this.#C("groupBy",[]),V=this.#C("pivotBy",[]),J=this.#C("quick",""),ee=this.#Ee(),ne={protocol:N,range:{start:z,end:Y},groupPath:T.path,groupValues:T.values,groupBy:q,totals:ee,totalFns:this.#ae(ee),pivotBy:V,pivotMode:V.length>0,filters:s(this.#C("filters",null),this.#U()),sort:this.#C("sort",[]),context:this.#C("context",null),signal:C};J&&(ne.quick=J);const oe=this.#C("where",null);return oe&&oe.active&&(ne.where=oe),ne}async#Be(T,A){if(!B(this.#e.fetch))return;if(!this.#m){this.#m=!0;const q=this.#g;this.#g=[],queueMicrotask(()=>{for(const V of q)V()})}const C=this.#o.begin(`${T.key}:${A}`);T.cache.begin(A,C);const z=this.#d,{start:Y}=T.cache.rangeOf(A);try{const q=await this.#e.fetch(this.#ie(T,A,C.signal));if(!C.current||z!==this.#d||this.#p)return;C.settle();const V=q&&q.rows||[];if(!!(q&&q[E])&&!T.flat){T.flat=!0,T.children.clear();for(const[oe,re]of[...this.#c])re.startsWith(`${T.key}:`)&&(this.#a.delete(re),this.#c.delete(oe))}T.cache.fill(A,V),T.failed=!1;for(let oe=0;oe<V.length;oe++)this.#a.delete(`${T.key}:${Y+oe}`);const ee=q&&typeof q.count=="number"?q.count:q&&typeof q.total=="number"?q.total:null,ne=q&&B(q.pendingTotal?.then)?q.pendingTotal:null;ee!==null?(T.count=ee,T.complete=!0):V.length<T.cache.pageSize?(T.count=Y+V.length,T.complete=!0):ne&&(T.counting=!0,T.announced=null),q&&Array.isArray(q.pivotFields)&&this.#Ae(q.pivotFields),q&&q.pivot&&typeof q.pivot=="object"&&this.#Ce(q.pivot),this.#W("model:changed",{reason:"page",groupPath:T.path,block:A}),this.#W("rows:changed",{companion:!0,reason:"page",groupPath:T.path,block:A}),this.#ge(T),ne&&this.#Se(T,ne,z)}catch(q){if(C.settle(),S(q))return;T.cache.failed(A,q),T.failed=!0;const{end:V}=T.cache.rangeOf(A);for(let J=Y;J<V;J++)this.#a.delete(`${T.key}:${J}`);this.#W("model:changed",{reason:"page-error",groupPath:T.path,block:A}),this.#W("source:error",{error:q,groupPath:T.path,block:A})}}async#Se(T,A,C){let z;try{z=await A}catch(Y){if(C!==this.#d||this.#p)return;T.counting=!1,S(Y)||(T.failed=!0),S(Y)||this.#W("source:error",{error:Y,groupPath:T.path});return}C!==this.#d||this.#p||(T.counting=!1,typeof z=="number"&&(T.count=z,T.complete=!0,this.#ge(T),this.#W("model:changed",{reason:"total",count:z,groupPath:T.path})))}#ge(T){typeof T.count!="number"||!T.complete||T.announced!==T.count&&(T.announced=T.count,this.#W("source:total",{total:T.count,groupPath:T.path}))}#be(T){if(this.#p)return null;this.#X();const A=this.#m?null:new Promise(V=>{this.#g.push(V),setTimeout(V,_)}),C=T();if(!A&&!C)return null;const z=(async()=>{A&&await A;for(let V=T();V;V=T())await V})();let Y;const q=new Promise(V=>{Y=setTimeout(V,_)});return Promise.race([z,q]).then(()=>clearTimeout(Y))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#R())return!1;this.#X();const T=this.#r;return T.count===null&&!T.complete&&T.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Ae(T){T.length===this.#u.length&&T.every((A,C)=>A===this.#u[C])||(this.#u=T,this.#W("column:pivoted",{pivotFields:T,remote:!0}))}#Pe(){const T=this.#t.config||{};return T.pivot&&T.pivot.separator||k}#ne(T){const A=this.#Pe(),C=this.#Ee();if(!C.length)return T.slice();const z=[];for(const Y of T)for(const q of C)z.push(`${Y}${A}${q}`);return z}#Ce(T){const A=this.#Pe();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const C=this.#f;let z=!1;const Y=V=>{const J=Array.isArray(V)?V:[V],ee=g(J,A);return C.keys.has(ee)||(C.keys.set(ee,J),z=!0),ee},q=this.#C("groupBy",[]).length>0;for(const V of Array.isArray(T.axis)?T.axis:[])Y(V);for(const V of Array.isArray(T.cells)?T.cells:[]){if(!V||typeof V!="object")continue;const J=Y(V.pivot);if(q&&!(Array.isArray(V.group)&&V.group.length))continue;const ee=g(Array.isArray(V.group)?V.group:[],A);for(const[ne,oe]of Object.entries(V.values||{}))C.cells.set(p(ee,J,ne),oe)}C.result=null,z&&this.#Ae((this.pivot()||{fields:[]}).fields)}#re(T){let A=this.#J(T);for(const C of T.children.values())this.#we(C.key)&&(A+=this.#re(C));return A}#J(T){if(T.count!==null)return T.count;const A=T.cache.loadedExtent();return T.complete?A:T.row&&T.row.leafCount>0?T.level>=this.#C("groupBy",[]).length?Math.max(A,T.row.leafCount):A===0?1:Math.min(A+T.cache.pageSize,Math.max(A,T.row.leafCount)):A+T.cache.pageSize}#V(T,A){let C=A,z=0;const Y=[...T.children.entries()].filter(([,V])=>this.#we(V.key)).sort((V,J)=>V[0]-J[0]);for(const[V,J]of Y){const ee=V-z+1;if(C<ee)return{node:T,local:z+C};C-=ee,z=V+1;const ne=this.#re(J);if(C<ne)return this.#V(J,C);C-=ne}const q=this.#J(T);return z+C<q?{node:T,local:z+C}:null}#q(T,A){const C=`${T.key}:${A}`,z=this.#a.get(C);if(z)return z;const Y=T.cache.rowAt(A);if(Y===void 0)return null;const q=this.#C("groupBy",[]);let V;if(T.level<q.length&&!T.flat){const J=q[T.level],ee=this.#f!==null&&T.level===q.length-1&&this.#C("pivotBy",[]).length>0,ne=this.#ce(Y,J),oe=ne==null,re=[...T.path,oe?"":String(ne)],ae=[...T.keyPath,oe?null:String(ne)];if(V=this.#l.group({path:re,keyPath:ae,column:J,value:ne,level:T.level,parent:T.row,leafCount:Number(Y.leafCount)||0,expanded:ee?!1:this.#we(t(ae)),...ee?{hasChildren:!1}:{}}),V.totals=this.#F(Y),V.data=Y,!ee){let fe=this.#s.get(V.key);fe?fe.row=V:(fe=new j(re,T.level+1,this.#n,ae),fe.row=V,this.#s.set(fe.key,fe)),fe.values=[...T.values,ne],T.children.set(A,fe)}}else V=this.#l.leaf(Y,A,T.level,T.row);return this.#a.set(C,V),this.#c.set(V.key,C),V}#F(T){const A=T||{};if(A.totals&&typeof A.totals=="object")return A.totals;const C={};for(const z of this.#Ee())Object.hasOwn(A,z)&&(C[z]=A[z]);return C}#Te(T,A){const{start:C,end:z}=T.cache.rangeOf(A);for(let Y=C;Y<z;Y++){const q=`${T.key}:${Y}`,V=this.#a.peek(q);V&&this.#c.delete(V.key),this.#a.delete(q)}}#X(){const T=this.#Oe();return T===this.#d?!1:(this.#d=T,this.#o.abortAll("query"),this.#oe(),this.#m=!1,this.#W("model:changed",{reason:"query"}),!0)}#oe(){for(const T of this.#s.values())T.cache.clear(),T.count=null,T.complete=!1,T.announced=null,T.counting=!1,T.failed=!1,T.children.clear(),T.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#f=null}#Oe(){const T=this.#C("where",null);return`${r({filters:this.#C("filters",null),sort:this.#C("sort",[]),quick:this.#C("quick",""),groupBy:this.#C("groupBy",[]),pivotBy:this.#C("pivotBy",[]),context:this.#C("context",null)})}|${T?T.version:0}`}#we(T){const A=this.#C("expanded",null);return A?B(A.has)?A.has(T):Array.prototype.includes.call(A,T):this.#i.has(T)}#Ee(){const T=this.#C("totals",[]);if(T&&T.length)return[...T];const A=this.#t.columns;return!A||!B(A.all)?[]:A.all().filter(C=>!!C.total).map(C=>C.id)}#ae(T){const A=this.#t.columns,C={};if(!A||!B(A.get))return C;for(const z of T){const Y=A.get(z);if(!Y)continue;const q=Y.groupTotal!=null?Y.groupTotal:Y.total;typeof q=="string"&&(C[z]=q)}return C}#ce(T,A){const C=this.#t.columns,z=C&&B(C.get)?C.get(A):void 0;return z&&B(z.getValue)?z.getValue(T):T?.[A]}#Le(){u(this.#t)}#U(){const T=this.#t.config||{};return{tz:T.timeZone,weekStartsOn:T.weekStartsOn}}#C(T,A){const C=this.#t.state;if(C&&B(C[T])){const z=C[T]();return z??A}return A}#W(T,A){const C=this.#t.emit;B(C)&&C(T,A)}}}),De("packages/core/src/source/gapbuffer.js",function(e,U){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return M}});const te=64;class M{#e;#t=0;#n=0;constructor(B=te){this.#e=new Uint32Array(Math.max(1,B)),this.#n=this.#e.length}static from(B,D=te){const Z=new M(B.length+Math.max(1,D));return Z.#e.set(B,0),Z.#t=B.length,Z.#n=Z.#e.length,Z}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(B){return B<0||B>=this.length?0:B<this.#t?this.#e[B]:this.#e[B+(this.#n-this.#t)]}insert(B,D){const Z=B<0?0:B>this.length?this.length:B;this.#r(Z),this.#t===this.#n&&this.#s(),this.#e[this.#t++]=D}push(B){this.insert(this.length,B)}removeAt(B){return!Number.isInteger(B)||B<0||B>=this.length?!1:(this.#r(B),this.#n++,!0)}toArray(){const B=new Uint32Array(this.length);return B.set(this.#e.subarray(0,this.#t),0),B.set(this.#e.subarray(this.#n),this.#t),B}clear(){this.#t=0,this.#n=this.#e.length}#r(B){if(B!==this.#t)if(B<this.#t){const D=this.#t-B;this.#e.copyWithin(this.#n-D,B,this.#t),this.#t=B,this.#n-=D}else{const D=B-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+D),this.#t=B,this.#n+=D}}#s(){const B=this.#e.length-this.#n,D=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+te));D.set(this.#e.subarray(0,this.#t),0),D.set(this.#e.subarray(this.#n),D.length-B),this.#e=D,this.#n=D.length-B}}}),De("packages/core/src/store/ingest.js",function(e,U){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return s}});const te=U("packages/core/src/internal/schedule.js"),M=te.now,X=te.nextFrame,B=U("packages/core/src/internal/warn.js"),D=B.infoOnce,Z=B.warnOnce,I=U("packages/core/src/internal/predicates.js").isFunction,H=U("packages/core/src/internal/paths.js").pathGetter,O=U("packages/core/src/store/columnstore.js").ColumnStore,b=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function c(r,u={}){if(u.multi)return"multi";if(r.length===0)return"object";let a=0,l=0,h=0,y=0,m=0;for(let d=0;d<r.length;d++){const p=r[d];typeof p=="number"?a++:typeof p=="boolean"?l++:typeof p=="string"?h++:p instanceof Date?y++:Array.isArray(p)&&m++}const v=r.length;return a===v?"float64":l===v?"bitset":y===v?"float64":h===v?"text":m===v?"multi":"object"}function f(r,u,a){return u<=0||r<a*u?"dictionary":"object"}function o(r,u,a){const l=new Map,h=new Map;for(const N of r){if(N.computed)continue;const x=I(N.read)?N.read:H(N.field||N.id);h.set(N.id,x),l.set(N.id,x)}const y=u?.order??[],m=u?.fns??{},v=u?.deps??{},d=u?.wrapDeps??null,p=y.filter(N=>I(m[N])),g=p.some(N=>v[N]==="*");let k=new WeakMap;const w=N=>{const x={};if(g)for(const[_,F]of h)x[_]=F(N);for(const _ of p){const F=v[_];let L;if(F==="*")L=x;else{L={};const j=F||[];for(let R=0;R<j.length;R++){const $=j[R];L[$]=$ in x?x[$]:h.get($)?.(N)}}x[_]=m[_](d?d(L,_):L,{data:N,row:null,column:null,grid:null,context:a})}return x},E=N=>{if(N===null||typeof N!="object"&&typeof N!="function")return w(N);let x=k.get(N);return x===void 0&&(x=w(N),k.set(N,x)),x};for(const N of p)l.set(N,x=>E(x)[N]);return{readers:l,reset(){k=new WeakMap}}}class n{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(u,a){this.spec=u,this.read=a,this.kind="object",this.inferred=!1,this.nullable=u.nullable!==!1}}class t{#e;#t=[];#n=null;#r;#s=0;#i;#o=!1;#l=!1;#a=0;#c;constructor(u,a={},l={}){this.#e=Array.isArray(u)?u:Array.from(u||[]),this.#i={...b,...l};const h=a.columns??[];this.#r=o(h,a.computed??null,a.context),this.#c=this.#e.length>=this.#i.columnarBelow,this.#u(h,a.computed??null),this.#n=new O(this.#t.map(y=>({id:y.spec.id,kind:y.kind,nullable:y.nullable,read:y.read,dictionary:y.spec.dictionary})),{initialCapacity:this.#i.initialCapacity,columnarBelow:this.#i.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#s}slice(){if(this.done)return!1;if(this.#i.signal?.aborted)return this.#l=!0,!1;const u=M(),{chunkMs:a,chunkRows:l}=this.#i,h=this.#e.length;do{const y=Math.min(this.#s+l,h);this.#n.append(this.#e.slice(this.#s,y)),this.#f(this.#s,y),this.#s=y,this.#r.reset(),this.#h(!1)}while(this.#s<h&&M()-u<a);return this.#a+=M()-u,this.#i.onProgress?.({loaded:this.#s,total:h}),this.#s>=h?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(u=>({id:u.spec.id,kind:u.kind,nullable:u.nullable,read:u.read,dictionary:u.spec.dictionary})),decisions:this.#t.map(u=>({id:u.spec.id,kind:u.kind,nullable:u.nullable,inferred:u.inferred,distinct:u.candidate||u.change?this.#d(u):null,change:u.change,reason:u.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(u,a){const l=this.#e,h=Math.min(this.#i.sampleSize,l.length),y=this.#i.dictionaryRatio,m=a?.pure instanceof Set?a.pure:new Set(a?.pure??a?.order??[]);for(const v of u){if(!v||!v.id)continue;if(v.computed&&(v.pure===!1||a&&!m.has(v.id))){Z(`ingest.impure.${v.id}`,`column "${v.id}" is an impure computed column and is not materialised into the store`);continue}const d=this.#r.readers.get(v.id)??(I(v.read)?v.read:H(v.field||v.id)),p=new n(v,d);if(v.kind)p.kind=v.kind,p.reason="declared by the caller";else if(v.dictionary)p.kind=v.multi?"multi":"dictionary",p.reason="value table supplied (lookup column)";else{const g=[];for(let w=0;w<h&&g.length<this.#i.sampleSize;w++){const E=d(l[w]);E!=null&&g.push(E)}p.inferred=!0;const k=c(g,{multi:v.multi});if(k==="text"){const w=new Set(g).size;p.kind=f(w,g.length,y),p.candidate=this.#c,p.reason=`sampled ${w} distinct in ${g.length}`}else p.kind=k,p.reason=`inferred from ${g.length} sampled values`,k==="object"&&g.length&&D(`ingest.mixed.${v.id}`,`column "${v.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);p.kind==="object"&&p.candidate&&(p.distinct=new Set(g))}this.#t.push(p)}}#f(u,a){const l=this.#e;for(const h of this.#t){if(!h.candidate||!h.distinct)continue;const y=h.distinct;for(let m=u;m<a;m++){const v=h.read(l[m]);v!=null&&y.add(v)}}}#d(u){if(u.distinct)return u.distinct.size;const a=this.#n.column(u.spec.id);return a?.dict?a.dict.size:0}#h(u){const a=this.#i.dictionaryRatio,l=this.#e.length;for(const h of this.#t){if(!h.candidate)continue;const y=this.#d(h);if(h.kind==="dictionary"&&y>=a*l){const m=this.#n.column(h.spec.id);h.distinct=new Set(m?.dict?m.dict.values():[]),this.#n.convert(h.spec.id,"object"),h.kind="object",h.change="demoted",h.reason=`${y} distinct values is at or above ${a*100}% of ${l} rows`;continue}if(h.kind==="object"&&y>=a*l){h.candidate=!1,h.distinct=null,h.reason=`${y} distinct values is at or above ${a*100}% of ${l} rows`;continue}u&&h.kind==="object"&&y<a*l&&(this.#n.convert(h.spec.id,"dictionary"),h.kind="dictionary",h.change=h.change==="demoted"?null:"promoted",h.reason=`${y} distinct values is below ${a*100}% of ${l} rows`,h.distinct=null),u&&(h.candidate=!1)}}}async function i(r,u={},a={}){const l=new t(r,u,a),h=a.scheduler?.frame??X;for(;l.slice();)await new Promise(y=>{h(y)});return l.result()}function s(r,u={},a={}){const l=new t(r,u,{...a,chunkMs:1/0});for(;l.slice(););return l.result()}}),De("packages/core/src/store/columnpack.js",function(e,U){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return f}});const M=U("packages/core/src/internal/paths.js").pathGetter,X=U("packages/core/src/store/ingest.js"),B=X.inferKind,D=X.decideText,Z=X.INGEST_DEFAULTS,I=U("packages/core/src/store/columnstore.js").toFloat,G=new Set(["float64","int32","bitset","dictionary","object","multi"]);function H(o){if(!Array.isArray(o)||o.length===0)return!1;for(const n of o)if(!n||typeof n.id!="string"||typeof n.field!="string"||n.field===""||n.kind&&!G.has(n.kind))return!1;return!0}function S(o){const n=I(o);return Number.isFinite(n)?n|0:0}function O(o){return o==null?[]:Array.isArray(o)?o:[o]}function b(o,n,t,i){if(o.kind)return o.kind;const s=[];for(let a=0;a<n.length&&s.length<Z.sampleSize;a++){const l=n[a];l!=null&&s.push(l)}const r=B(s,{multi:o.multi});if(r!=="text")return r;const u=new Set(s).size;return D(u,s.length,i)}function c(o,n,t={}){const i=n.length|0,s=t.dictionaryRatio??Z.dictionaryRatio,r=[];for(const u of o){const a=M(u.field||u.id),l=u.nullable!==!1,h=new Array(i);for(let p=0;p<i;p++){const g=a(n[p]);h[p]=g===void 0?null:g}const y=b(u,h,i,s),m=l?new Uint8Array(i+7>>3):null,v=p=>{m&&(m[p>>3]|=1<<(p&7))};let d;switch(y){case"float64":{const p=new Float64Array(i);for(let g=0;g<i;g++){const k=h[g],w=k===null;w||v(g),p[g]=w?NaN:I(k)}d={id:u.id,kind:y,nullable:l,values:p,presence:m,offsets:null,table:null};break}case"int32":{const p=new Int32Array(i);for(let g=0;g<i;g++){const k=h[g],w=k===null;w||v(g),p[g]=w?0:S(k)}d={id:u.id,kind:y,nullable:l,values:p,presence:m,offsets:null,table:null};break}case"bitset":{const p=new Uint8Array(i+7>>3);for(let g=0;g<i;g++){const k=h[g],w=k===null;w||v(g),!w&&k&&(p[g>>3]|=1<<(g&7))}d={id:u.id,kind:y,nullable:l,values:p,presence:m,offsets:null,table:null};break}case"dictionary":{const p=new Uint32Array(i),g=[],k=new Map;for(let w=0;w<i;w++){const E=h[w];if(E===null){p[w]=0;continue}v(w);let N=k.get(E);N===void 0&&(N=g.length,g.push(E),k.set(E,N)),p[w]=N}d={id:u.id,kind:y,nullable:l,values:p,presence:m,offsets:null,table:g};break}case"multi":{const p=[],g=new Map,k=new Uint32Array(i+1),w=[];for(let E=0;E<i;E++){const N=h[E];k[E]=w.length,N===null||v(E);const _=O(N);for(let F=0;F<_.length;F++){const L=_[F];let j=g.get(L);j===void 0&&(j=p.length,p.push(L),g.set(L,j)),w.push(j)}}k[i]=w.length,d={id:u.id,kind:y,nullable:l,values:Int32Array.from(w),presence:m,offsets:k,table:p};break}default:{const p=new Array(i);for(let g=0;g<i;g++){const k=h[g];k!==null&&v(g),p[g]=k}d={id:u.id,kind:"object",nullable:l,values:p,presence:m,offsets:null,table:null};break}}r.push(d)}return{count:i,columns:r}}function f(o){const n=[];if(!o||!Array.isArray(o.columns))return n;const t=i=>{ArrayBuffer.isView(i)&&i.buffer&&!n.includes(i.buffer)&&n.push(i.buffer)};for(const i of o.columns)t(i.values),t(i.presence),t(i.offsets);return n}}),De("packages/core/src/source/stream.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return j}});const M=U("packages/core/src/internal/lru.js").Lru,B=U("packages/core/src/internal/predicates.js").isFunction,D=U("packages/core/src/internal/schedule.js"),Z=D.now,K=D.nextFrame,I=D.cancelFrame,G=D.whenIdle,S=U("packages/core/src/internal/compare.js").defaultCompare,O=U("packages/core/src/internal/warn.js"),b=O.warnOnce,c=O.infoOnce,o=U("packages/core/src/internal/paths.js").getPath,n=U("packages/core/src/source/abort.js"),t=n.createAbortScope,i=n.isAbortError,s=U("packages/core/src/source/rows.js"),r=s.createRowFactory,u=s.lazyRowView,l=U("packages/core/src/source/gapbuffer.js").GapBuffer,y=U("packages/core/src/source/memory.js").createMemorySource,v=U("packages/core/src/source/filterwire.js").querySignature,p=U("packages/core/src/store/columnpack.js").isPortableSchema,g=25e4,k=Symbol("lattice.stream.storeBacked"),w=8,E=.1,N=1e3,x=50;function _(R){return Math.min(N,Math.max(x,Math.floor(R/4)))}function F(R){if(R instanceof Date)return R.getTime();if(typeof R=="number")return Number.isFinite(R)?R:NaN;if(typeof R=="string"){const $=R.trim();if(!$)return NaN;const T=Date.parse($);return Number.isNaN(T)?Number($):T}return NaN}function L(R,$){return new j(R,$)}class j{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#s=[];#i=null;#o;#l;#a=new Map;#c=t();#u={loaded:0,estimated:void 0};#f=null;#d=0;#h=0;#p=0;#m=0;#g=null;#b=null;#y=null;#j=!1;#w=!1;#O=!1;#v=!1;#T="";#S=0;#E=0;#N=0;#P=null;#M=1/0;#R=!1;#L=null;#G=null;#_=null;#x=null;#I=!1;#Y=0;#D=0;#K=!1;constructor($,T){this.#e=$||{mode:"stream"},this.#t=T||{},this.#o=r(this.#t),this.#l=new M(4096),this.#T=this.#Xe();const A=(this.#t.config||{}).ingest;this.#I=!!A&&A.retainSource===!1,B(this.#e.open)||b("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const C=Number(this.#e.poll);Number.isFinite(C)&&C>0&&(this.#x=setInterval(()=>{this.#v||this.reload()},C),this.#x&&B(this.#x.unref)&&this.#x.unref()),this.#B()}#H(){const $=Number(this.#e.maxAge);return Number.isFinite($)&&$>0?$:0}#B(){const $=this.#H();if(!$)return;const T=this.#e.ageBy;B(T)?this.#G=T:typeof T=="string"&&T?this.#G=A=>o(A,T):this.#G=null,this.#P=[],this.#L=setInterval(()=>{this.#v||this.#fe()&&(this.#X(),this.#me())},_($)),this.#L&&B(this.#L.unref)&&this.#L.unref()}#fe(){const $=this.#H();return!$||!this.#P?!1:this.#R?!0:this.#M<Date.now()-$*(1+E)}#pe($,T){if(!this.#P)return;const A=this.#G?F(this.#G(T)):Date.now();this.#P[$]=A,Number.isNaN(A)||(A<this.#M&&(this.#M=A),A<Date.now()-this.#H()&&(this.#R=!0))}#ie(){return this.#ye("groupBy",[]).length>0?!0:!!this.#ye("pivotMode",!1)&&this.#ye("pivotBy",[]).length>0}#Be(){if(this.#g||this.#v)return;const $=this.#ie();if($&&!this.#b){this.#b=y({mode:"memory",rows:this.#n},this.#Se()),this.#j=!1;return}!$&&this.#b&&(this.#b.destroy(),this.#b=null)}#Se(){if(this.#y)return this.#y;const $=this,T={liveIndices:()=>$.#ge(),live:A=>$.#n[A]!==void 0,source:A=>$.#Ie(A),get physical(){return $.#n.length}};return this.#I&&(T.column=A=>{const C=$.#t.store;return C&&B(C.column)?C.column(A):void 0}),this.#y=Object.create(this.#t,{store:{value:T,enumerable:!0,configurable:!0}}),this.#y}#ge(){const $=new Uint32Array(this.#n.length);let T=0;for(let A=0;A<this.#n.length;A++)this.#n[A]!==void 0&&($[T++]=A);return $.subarray(0,T)}#be(){return this.#g?this.#g:this.#b?(this.#j&&(this.#j=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate($="filter"){if(this.#g){this.#g.invalidate($);return}this.#Be(),this.#b&&this.#b.invalidate($),($==="filter"||$==="sort")&&this.#Ee()}count(){const $=this.#be();return $?$.count():this.#r?this.#r.length:this.#S}matchCount(){const $=this.#be();return $&&B($.matchCount)?$.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const $=this.#be();return $&&B($.totalCount)?$.totalCount():this.#S}unfilteredRows(){const $=this.#be();if($&&B($.unfilteredRows))return $.unfilteredRows();const T=[];for(let A=0;A<this.#n.length;A++){if(!this.#n[A])continue;const C=this.#ve(A);C&&T.push(C)}return T}at($){const T=this.#be();if(T)return T.at($);if($<0||$>=this.count())return;const A=this.#r?this.#r.at($):$,C=this.#ve(A);return C.index=$,C}byKey($){const T=this.#be();if(T)return T.byKey($);const A=this.#a.get($);return A===void 0?void 0:this.#ve(A)}leavesOf($){const T=this.#be();return T&&B(T.leavesOf)?T.leavesOf($):[]}loaded($){return $>=0&&$<this.count()}hint($,T){if(this.#g){this.#g.hint($,T);return}this.#Ae(),this.#p=Math.max(0,Math.floor($))}#Ae(){this.#v||this.#Xe()===this.#T||this.reload()}display(){const $=this.#be();return $?$.display():u(()=>this.count(),T=>this.at(T))}apply($){if(this.#g)return this.#g.apply($);const T={added:[],updated:[],removed:[]};if(!$)return T;if($.update){let A=!1;for(const C of $.update){const z=this.#a.get(this.#o.keyOf(C,-1));if(z===void 0)continue;const Y=this.#Le(z);this.#I?this.#k(z,C):this.#n[z]=C,this.#l.delete(z),this.#U(z,Y),this.#P&&(this.#pe(z,C),A=!0),this.#j=!0,T.updated.push(this.#ve(z))}A&&this.#X()}if($.add&&$.add.length){const A=this.#F($.add);for(const C of A)T.added.push(this.#ve(C))}return $.remove&&$.remove.length&&b("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#me(),T}reload($){this.#c.abortAll("reload"),this.#Ue(),this.#b&&(this.#b.destroy(),this.#b=null),this.#j=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#E=0,this.#N=0,this.#P&&(this.#P=[]),this.#M=1/0,this.#R=!1,this.#w=!1,this.#O=!1,this.#u={loaded:0,estimated:void 0},this.#T=this.#Xe(),this.#ke("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#x!==null&&(clearInterval(this.#x),this.#x=null),this.#L!==null&&(clearInterval(this.#L),this.#L=null),this.#P=null,this.#c.abortAll("destroyed"),this.#Ue(),this.#f!==null&&(this.#$e(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear()}async start(){if(this.#O||this.#v||!B(this.#e.open))return;this.#O=!0;const $=this.#c.begin("stream");this.#Ee(),this.#Be();let T;try{T=this.#e.open({sort:this.#ye("sort",[]),filters:this.#ye("filters",null),quick:this.#ye("quick","")||void 0,context:this.#ye("context",null),signal:$.signal})}catch(C){this.#ke("source:error",{error:C});return}const A=B(T[Symbol.asyncIterator])?T[Symbol.asyncIterator]():T[Symbol.iterator]();this.#_=A;try{for(;;){const C=await A.next();if(!$.current||this.#v)return;if(C.done){this.#se();return}if(await this.#Pe(C.value,$),!$.current||this.#v)return;if(C.value&&C.value.done){this.#se();return}if(await this.#le(),!$.current||this.#v)return}}catch(C){if(i(C))return;this.#ke("source:error",{error:C})}finally{$.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#S,evicted:this.#E}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const $=this.#be();$&&(B($.invalidateHandles)&&$.invalidateHandles(),B($.invalidate)&&$.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#Y,inline:this.#D,storeBacked:this.#I}}#Pe($,T){if(!$)return;const A=$.rows;if(A&&A.length&&this.#Ce(A))return this.#J($,T);const C=Z();A&&A.length&&(this.#F(A),this.#D++),this.#ne($),this.#h+=Z()-C,this.#me()}#ne($){this.#u.loaded=$.progress&&typeof $.progress.loaded=="number"?$.progress.loaded:this.#n.length,$.progress&&typeof $.progress.estimated=="number"&&(this.#u.estimated=$.progress.estimated)}#Ce($){if(this.#K||this.#g)return!1;const T=this.#V();if(!T)return!1;const A=this.#t.store;if(!A||!B(A.appendPacked))return!1;const C=this.#q();return!C||!p(C)?(this.#K=!0,c("source.stream.ingest-worker","stream ingest.useWorker is on but a column reads through a closure (a computed or date column); columnizing on the main thread instead."),!1):$.length<T.threshold?!1:!this.#re($)}#re($){if(!this.#o.keyed)return!1;const T=new Set;for(let A=0;A<$.length;A++){const C=this.#o.keyOf($[A],this.#n.length+A);if(C!=null){if(T.has(C)||this.#a.has(C))return!0;T.add(C)}}return!1}async#J($,T){const A=$.rows,C=this.#V(),z=this.#q();let Y;try{Y=await C.columnize(z,A,{key:"ingest:stream",signal:T&&T.signal})}catch(ne){if(i(ne)||(b("source.stream.columnize","worker columnization failed; columnizing on the main thread",ne),this.#K=!0,T&&(!T.current||this.#v)))return;this.#F(A),this.#D++,this.#ne($),this.#me();return}if(T&&(!T.current||this.#v))return;const q=this.#t.store,V=this.#I?void 0:A,{from:J}=q.appendPacked(Y,V),ee=Y.count|0;for(let ne=0;ne<ee;ne++){const oe=J+ne,re=A[ne],ae=this.#o.keyed?this.#o.keyOf(re,oe):null;if(this.#n[oe]=this.#I?k:re,this.#S++,this.#pe(oe,re),ae!==null&&this.#a.set(ae,oe),!this.#r||!this.#ae(oe))continue;const fe=this.#C(oe);this.#r.insert(fe,oe),fe<=this.#p&&this.#m++}this.#j=!0,this.#X(),this.#Y++,this.#ne($),this.#me()}#V(){const $=this.#t.ingestWorker;return B($)?$():null}#q(){const $=this.#t.storeSchema;return B($)?$():null}#F($){const T=[],A=this.#t.store,C=new Array($.length),z=[],Y=new Set;for(let V=0;V<$.length;V++){const J=this.#o.keyed?this.#o.keyOf($[V],this.#n.length+z.length):null;C[V]=J,!(J!==null&&(this.#a.has(J)||Y.has(J)))&&(J!==null&&Y.add(J),z.push($[V]))}let q=z.length&&A&&B(A.append)?A.append(z).from:this.#n.length;for(let V=0;V<$.length;V++){const J=$[V],ee=C[V];if(ee!==null&&this.#a.has(ee)){const re=this.#a.get(ee),ae=this.#Le(re);this.#I||(this.#n[re]=J,A&&B(A.setSource)&&A.setSource(re,J)),this.#k(re,J),this.#l.delete(re),this.#pe(re,J),this.#U(re,ae);continue}const ne=q++;if(this.#n[ne]=this.#I?k:J,this.#S++,this.#pe(ne,J),ee!==null&&this.#a.set(ee,ne),T.push(ne),!this.#r||!this.#ae(ne))continue;const oe=this.#C(ne);this.#r.insert(oe,ne),oe<=this.#p&&this.#m++}return this.#j=!0,this.#X(),T}#Te($){const T=this.#n[$];let A=!1;if(this.#r){const q=this.#we($);q>=0&&q<=this.#p&&(A=!0)}else $<=this.#p&&(A=!0);const C=T===k?this.#Ie($):T,z=this.#o.keyed?this.#o.keyOf(C,$):null;z!==null&&this.#a.get(z)===$&&this.#a.delete(z),this.#n[$]=void 0,this.#P&&(this.#P[$]=NaN),this.#l.delete($);const Y=this.#t.store;return Y&&B(Y.remove)&&Y.remove($),this.#S--,A}#X(){let $=0,T=0;const A=this.#Oe();$+=A.dropped,T+=A.aboveAnchor;const C=this.#oe();$+=C.dropped,T+=C.aboveAnchor,$&&(this.#j=!0,this.#E+=$,this.#Ee(),this.#m-=T,this.#ke("stream:evicted",{evicted:$,total:this.#E,live:this.#S}))}#oe(){const $=this.#e.maxRows;if(!Number.isFinite($)||$<=0||this.#S<=$)return{dropped:0,aboveAnchor:0};const T=Math.max(1,Math.floor($*(1-E)));let A=0,C=0;for(;this.#S>T&&this.#N<this.#n.length;){const z=this.#N++;this.#n[z]!==void 0&&(this.#Te(z)&&C++,A++)}return{dropped:A,aboveAnchor:C}}#Oe(){const $=this.#H();if(!$||!this.#P||!this.#fe())return{dropped:0,aboveAnchor:0};const T=Date.now()-$;let A=0,C=0,z=1/0;for(let Y=this.#N;Y<this.#n.length;Y++){if(this.#n[Y]===void 0)continue;const q=this.#P[Y];if(!(Number.isNaN(q)||q===void 0)){if(q>=T){q<z&&(z=q);continue}this.#Te(Y)&&C++,A++}}for(this.#M=z,this.#R=!1;this.#N<this.#n.length&&this.#n[this.#N]===void 0;)this.#N++;return{dropped:A,aboveAnchor:C}}#we($){if(!this.#r)return $;for(let T=0;T<this.#r.length;T++)if(this.#r.at(T)===$)return T;return-1}#Ee(){this.#s=this.#ye("sort",[]),this.#i=this.#ye("filters",null);const $=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#H()>0,T=this.#ye("where",null),A=(this.#t.config||{}).hostFilter,C=!!(T&&T.active)||!!(A&&B(A.active)&&A.active());if(!($||this.#s.length>0||!!this.#i||!!this.#ye("quick","")||C)){this.#r=null;return}this.#r=new l(Math.max(64,this.#n.length+64));for(let Y=0;Y<this.#n.length;Y++)this.#n[Y]!==void 0&&this.#ae(Y)&&this.#r.insert(this.#C(Y),Y)}#ae($){const T=this.#Ie($);if(this.#i&&!this.#ce(this.#i,T))return!1;const A=String(this.#ye("quick","")||"").toLowerCase();if(A&&!this.#at(T).includes(A))return!1;const C=(this.#t.config||{}).hostFilter;if(C&&B(C.active)&&C.active()&&!C.passes(this.#ve($)))return!1;const z=this.#ye("where",null);if(z&&z.active){const Y=this.#ve($);if(!z.passes(Y.data,Y.key))return!1}return!0}#ce($,T){if(!$)return!0;const A=$;if(Array.isArray(A.conditions))return A.op==="or"?A.conditions.some(Y=>this.#ce(Y,T)):A.op==="not"?!A.conditions.some(Y=>this.#ce(Y,T)):A.conditions.every(Y=>this.#ce(Y,T));const C=$,z=(this.#t.compute||{}).testValue;return B(z)?!!z(this.#Me(T,C.col),C,(this.#t.config||{}).locale):(b("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Le($){if(!this.#r)return-1;if(!this.#s.length)return this.#we($);let T=0,A=this.#r.length;for(;T<A;){const C=T+A>>>1;this.#W(this.#r.at(C),$)<0?T=C+1:A=C}for(let C=T;C<this.#r.length;C++){const z=this.#r.at(C);if(z===$)return C;if(this.#W(z,$)>0)break}return this.#we($)}#U($,T){if(!this.#r||!this.#s.length)return;const A=this.#ae($);if(T>=0&&this.#r.at(T)===$)this.#r.removeAt(T),T<=this.#p&&this.#m--;else if(T>=0)return;if(!A)return;const C=this.#C($);this.#r.insert(C,$),C<=this.#p&&this.#m++}#C($){if(!this.#r||!this.#s.length)return this.#r?this.#r.length:0;let T=0,A=this.#r.length;for(;T<A;){const C=T+A>>>1;this.#W($,this.#r.at(C))<0?A=C:T=C+1}return T}#W($,T){const A=this.#Ie($),C=this.#Ie(T);for(const z of this.#s){const Y=this.#Ve(z.col),q=this.#Me(A,z.col),V=this.#Me(C,z.col),ee=(Y&&Y.value&&B(Y.value.compare)?Y.value.compare:S)(q,V);if(ee!==0)return z.dir==="desc"?-ee:ee}return 0}#se(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const $=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:g;!this.#I&&this.#n.length<$&&(this.#g=y({mode:"memory",rows:this.#n},this.#t),this.#L!==null&&(clearInterval(this.#L),this.#L=null),this.#b&&(this.#b.destroy(),this.#b=null)),this.#me(),this.#ke("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:$})}#me(){this.#f!==null||this.#v||(this.#f=this.#he(()=>{this.#f=null,this.#d++;const $=this.#m;this.#m=0,this.#h=0,this.#ke("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#d}),this.#ke("model:changed",{reason:"stream",shiftAboveViewport:$,anchor:this.#p}),this.#ke("rows:changed",{companion:!0,reason:"stream"})}))}#le(){return this.#d===0||this.#h<this.#de()?Promise.resolve():(this.#h=0,new Promise($=>{const T=(this.#t.scheduler||{}).idle;B(T)?T(()=>$()):G(()=>$())}))}#de(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:w}#he($){const T=this.#t.scheduler||{};return B(T.frame)?T.frame($):K($)}#$e($){const T=this.#t.scheduler||{};B(T.cancel)?T.cancel($):I($)}#Ie($){const T=this.#n[$];if(T!==void 0&&T!==k)return T;if(T===void 0)return;const A=this.#t.store;return A&&B(A.source)?A.source($):void 0}#k($,T){const A=this.#t.store;if(!A||!B(A.set))return;const C=this.#q();if(Array.isArray(C))for(const z of C){if(!z||!z.id)continue;const Y=B(z.read)?z.read:q=>o(q,z.field||z.id);A.set(z.id,$,Y(T))}}#ve($){let T=this.#l.get($);return T||(T=this.#o.leaf(this.#Ie($),$),this.#l.set($,T)),T}#Me($,T){const A=this.#Ve(T);return A&&B(A.getValue)?A.getValue($):$?.[T]}#at($){const T=this.#t.columns,A=T&&B(T.all)?T.all():[],C=[];for(const z of A){const Y=B(z.getValue)?z.getValue($):void 0;Y!=null&&Y!==""&&C.push(String(Y))}return C.join(" ").toLowerCase()}#Ve($){const T=this.#t.columns;return T&&B(T.get)?T.get($):void 0}#Ue(){const $=this.#_;if(this.#_=null,$&&B($.return))try{$.return()}catch{}}#Xe(){return v({context:this.#ye("context",null)})}#ye($,T){const A=this.#t.state;if(A&&B(A[$])){const C=A[$]();return C??T}return T}#ke($,T){const A=this.#t.emit;B(A)&&A($,T)}}}),De("packages/core/src/source/url.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return b}});const M=U("packages/core/src/internal/warn.js").warnOnce,X=U("packages/core/src/internal/predicates.js"),B=X.isObject,D=X.isFunction,K=U("packages/core/src/internal/paths.js").getPath,G=U("packages/core/src/source/abort.js").isAbortError,H=500,S=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),O=Symbol("lattice.url.skip");function b(m,v={}){const d=B(v)?v:{},p=D(d.fetch)?d.fetch:typeof globalThis<"u"&&D(globalThis.fetch)?globalThis.fetch:null,g=d.format==="json"||d.format==="ndjson"?d.format:void 0,k=typeof d.rowsPath=="string"&&d.rowsPath?d.rowsPath:void 0,w=D(d.map)?d.map:void 0,E=B(d.headers)?d.headers:void 0,N=Number.isFinite(d.batchSize)&&d.batchSize>0?Math.floor(d.batchSize):H,x=d.lenient===!0,_=Number.isFinite(d.poll)&&d.poll>0?Math.floor(d.poll):void 0,F=typeof m=="string"&&m.length>0;F||M("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*L(R={}){if(!F)return;if(!p)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const $=R&&R.signal;let T;try{T=await p(m,E?{signal:$,headers:E}:{signal:$})}catch(z){throw G(z)?z:new Error(`[lattice] createUrlSource: request to ${m} failed — ${z&&z.message||z}`)}if(!T||!T.ok){const z=T?T.status:"no response";throw new Error(`[lattice] createUrlSource: ${z} for ${m}`)}const A=c(m,g,T),C=T.body&&D(T.body.getReader)?T.body.getReader():null;try{if(!C){const q=await T.text();(A||n(q,m))==="ndjson"?yield*a(null,null,q,0,T,m,N,x):yield*u(q,m,k,w);return}const z=new TextDecoder("utf-8");if(A==="json"){yield*u(await r(C,z,""),m,k,w);return}if(A==="ndjson"){yield*a(C,z,"",0,T,m,N,x);return}const Y=await t(C,z,m);Y.format==="json"?yield*u(await r(C,z,Y.seed),m,k,w):yield*a(C,z,Y.seed,Y.bytes,T,m,N,x)}finally{if(C&&D(C.cancel))try{await C.cancel()}catch{}}}const j={mode:"stream",open:L,autoStart:d.autoStart!==!1};return _!==void 0&&(j.poll=_),Number.isFinite(d.maxRows)&&(j.maxRows=d.maxRows),Number.isFinite(d.maxAge)&&(j.maxAge=d.maxAge),(typeof d.ageBy=="string"||D(d.ageBy))&&(j.ageBy=d.ageBy),Number.isFinite(d.coalesceMs)&&(j.coalesceMs=d.coalesceMs),Number.isFinite(d.promoteToMemoryBelow)&&(j.promoteToMemoryBelow=d.promoteToMemoryBelow),j}function c(m,v,d){if(v)return v;const p=f(m);if(p)return p;const g=d&&d.headers&&D(d.headers.get)?d.headers.get("content-type"):null;return o(g)}function f(m){const v=String(m).split(/[?#]/)[0].toLowerCase();if(v.endsWith(".ndjson")||v.endsWith(".jsonl"))return"ndjson";if(v.endsWith(".json"))return"json"}function o(m){if(!m)return;const v=m.split(";")[0].trim().toLowerCase();if(S.has(v))return"ndjson";if(v==="application/json"||v==="text/json"||v.endsWith("+json"))return"json"}function n(m,v){const d=m.replace(/^\s+/,""),p=i(d);if(p==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${v} — pass opts.format: 'json' | 'ndjson'.`);return p}async function t(m,v,d){let p="",g=0;for(;;){const{value:w,done:E}=await m.read();if(w&&(g+=w.byteLength,p+=v.decode(w,{stream:!0})),E){p+=v.decode();break}const N=p.replace(/^\s+/,"");if(N){if(N[0]==="[")return{format:"json",seed:p,bytes:g};if(N[0]!=="{"||p.indexOf(`
7
+ `||u==="\r"){r++;continue}if(u>="0"&&u<="9"){r=O(i,r,s);continue}if(u==="."&&i[r+1]>="0"&&i[r+1]<="9"){r=O(i,r,s);continue}if(u==='"'||u==="'"){r=b(i,r,s);continue}if(u==="["){const l=i.indexOf("]",r+1);if(l<0)throw new G("a [column reference] was opened and never closed",r);s.push({kind:X,value:i.slice(r+1,l).trim(),at:r}),r=l+1;continue}if(S(u)){r=c(i,r,s);continue}const a=i.slice(r,r+2);if(K.includes(a)){s.push({kind:D,value:a==="!="?"<>":a,at:r}),r+=2;continue}if(I.includes(u)){s.push({kind:D,value:u,at:r}),r++;continue}throw new G(`unexpected character ${JSON.stringify(u)}`,r)}return s.push({kind:Z,value:null,at:i.length}),s}function S(i){return/[A-Za-z_À-￿]/.test(i)}function O(i,s,r){let u=s,a=!1;for(;u<i.length;){const l=i[u];if(l>="0"&&l<="9"){u++;continue}if(l==="."&&!a){a=!0,u++;continue}if((l==="e"||l==="E")&&/[0-9+-]/.test(i[u+1]||"")){for(u+=2;u<i.length&&i[u]>="0"&&i[u]<="9";)u++;break}break}return r.push({kind:te,value:Number(i.slice(s,u)),at:s}),u}function b(i,s,r){const u=i[s];let a=s+1,l="";for(;a<i.length;){if(i[a]===u){if(i[a+1]===u){l+=u,a+=2;continue}return r.push({kind:M,value:l,at:s}),a+1}l+=i[a],a++}throw new G("a string was opened and never closed",s)}function c(i,s,r){let u=s;for(;u<i.length&&/[A-Za-z0-9_.À-￿]/.test(i[u]);)u++;const a=i.slice(s,u);let l=u;for(;l<i.length&&i[l]===" ";)l++;return r.push({kind:i[l]==="("?B:X,value:a,at:s}),u}const f={"=":1,"<>":1,"<":1,"<=":1,">":1,">=":1,"+":2,"-":2,"*":3,"/":3,"^":4};function o(i){const s=String(i??"").replace(/^\s*=/,"");if(!s.trim())throw new G("the formula is empty");const r=H(s);let u=0;const a=()=>r[u],l=()=>r[u++],h=k=>{const w=a();if(w.kind!==D||w.value!==k)throw new G(`expected ${JSON.stringify(k)}`,w.at);u++},y=k=>{let w=m();for(;;){const E=a();if(E.kind!==D)break;const N=f[E.value];if(!N||N<k)break;u++;const x=y(E.value==="^"?N:N+1);w={kind:"bin",op:E.value,left:w,right:x}}return w},m=()=>{const k=a();return k.kind===D&&(k.value==="-"||k.value==="+")?(u++,{kind:"unary",op:k.value,arg:m()}):v()},v=()=>{let k=d();for(;a().kind===D&&a().value==="%";)u++,k={kind:"unary",op:"%",arg:k};return k},d=()=>{const k=l();if(k.kind===te)return{kind:"num",value:k.value};if(k.kind===M)return{kind:"str",value:k.value};if(k.kind===X)return{kind:"ref",name:k.value};if(k.kind===B){h("(");const w=[];if(!(a().kind===D&&a().value===")"))for(;;){if(w.push(y(1)),a().kind===D&&a().value===","){u++;continue}break}return h(")"),{kind:"call",name:String(k.value).toUpperCase(),args:w}}if(k.kind===D&&k.value==="("){const w=y(1);return h(")"),w}throw k.kind===Z?new G("the formula ends unexpectedly",k.at):new G(`unexpected ${JSON.stringify(k.value)}`,k.at)},p=y(1),g=a();if(g.kind!==Z)throw new G(`unexpected ${JSON.stringify(g.value)}: is an operator missing?`,g.at);return p}function n(i){const s=new Set,r=u=>{if(!(!u||typeof u!="object")){if(u.kind==="ref"){s.add(String(u.name));return}if(u.kind==="bin"){r(u.left),r(u.right);return}if(u.kind==="unary"){r(u.arg);return}if(u.kind==="call")for(const a of u.args)r(a)}};return r(i),[...s]}function t(i){return typeof i=="string"&&/^\s*=/.test(i)&&i.trim()!=="="}}),De("packages/core/src/formula/evaluate.js",function(e,U){"use strict";Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return O}});const M=U("packages/core/src/formula/parse.js").FormulaError;function X(b){if(b==null||b==="")return 0;if(typeof b=="boolean")return b?1:0;if(b instanceof Date)return b.getTime();const c=typeof b=="number"?b:Number(String(b).replace(/[,\s]/g,""));if(!Number.isFinite(c))throw new M(`${JSON.stringify(b)} is not a number`);return c}function B(b){return b==null?"":String(b)}function D(b){if(typeof b=="boolean")return b;if(b==null||b==="")return!1;if(typeof b=="number")return b!==0;const c=String(b).trim().toLowerCase();return c==="false"||c==="no"||c==="0"?!1:c!==""}function Z(b){const c=[];for(const f of b){if(Array.isArray(f)){for(const o of f)o!=null&&o!==""&&c.push(X(o));continue}f==null||f===""||c.push(X(f))}return c}function K(b,c){const f=10**c,o=b*f;return Math.sign(o)*Math.round(Math.abs(o)+Number.EPSILON*Math.abs(o))/f}function I(b,c){if(!b.length)return 0;const f=b.slice().sort((i,s)=>i-s),o=(f.length-1)*Math.min(1,Math.max(0,c)),n=Math.floor(o),t=Math.ceil(o);return n===t?f[n]:f[n]+(o-n)*(f[t]-f[n])}function G(b,c){let f=0,o=0,n=0;for(const i of b){f++;const s=i-o;o+=s/f,n+=s*(i-o)}const t=c?f-1:f;return t>0?Math.sqrt(n/t):0}const H={SUM:b=>Z(b).reduce((c,f)=>c+f,0),AVERAGE:b=>{const c=Z(b);return c.length?c.reduce((f,o)=>f+o,0)/c.length:0},MIN:b=>{const c=Z(b);return c.length?Math.min(...c):0},MAX:b=>{const c=Z(b);return c.length?Math.max(...c):0},COUNT:b=>Z(b).length,PRODUCT:b=>Z(b).reduce((c,f)=>c*f,1),ROUND:b=>K(X(b[0]),b.length>1?X(b[1]):0),ROUNDDOWN:b=>{const c=10**(b.length>1?X(b[1]):0),f=X(b[0])*c;return(f<0?Math.ceil(f):Math.floor(f))/c},ROUNDUP:b=>{const c=10**(b.length>1?X(b[1]):0),f=X(b[0])*c;return(f<0?Math.floor(f):Math.ceil(f))/c},ABS:b=>Math.abs(X(b[0])),FLOOR:b=>Math.floor(X(b[0])),CEILING:b=>Math.ceil(X(b[0])),SQRT:b=>Math.sqrt(X(b[0])),POWER:b=>X(b[0])**X(b[1]),MOD:b=>{const c=X(b[1]);if(c===0)throw new M("MOD by zero");return(X(b[0])%c+c)%c},IF:b=>D(b[0])?b[1]:b.length>2?b[2]:!1,AND:b=>b.every(D),OR:b=>b.some(D),NOT:b=>!D(b[0]),COALESCE:b=>b.find(c=>c!=null&&c!=="")??null,CONCAT:b=>b.map(B).join(""),LEN:b=>B(b[0]).length,UPPER:b=>B(b[0]).toUpperCase(),LOWER:b=>B(b[0]).toLowerCase(),TRIM:b=>B(b[0]).trim(),LEFT:b=>B(b[0]).slice(0,b.length>1?X(b[1]):1),RIGHT:b=>{const c=b.length>1?X(b[1]):1;return c<=0?"":B(b[0]).slice(-c)},MEDIAN:b=>I(Z(b),.5),PERCENTILE:b=>{const c=X(b[b.length-1]);return I(Z(b.slice(0,-1)),c>1?c/100:c)},QUARTILE1:b=>I(Z(b),.25),QUARTILE3:b=>I(Z(b),.75),STDEV:b=>G(Z(b),!0),STDEVP:b=>G(Z(b),!1),VAR:b=>{const c=G(Z(b),!0);return c*c},VARP:b=>{const c=G(Z(b),!1);return c*c},COUNTDISTINCT:b=>{const c=new Set;for(const f of b){const o=Array.isArray(f)?f:[f];for(const n of o)n!=null&&n!==""&&c.add(n)}return c.size},IQR:b=>{const c=Z(b);return I(c,.75)-I(c,.25)}};H.AVG=H.AVERAGE,H.CEIL=H.CEILING,H.POW=H.POWER,H.STDEVS=H.STDEV,H.PERCENTILEINC=H.PERCENTILE;function S(b,c){const f=Number(b),o=Number(c);if(b!==null&&b!==""&&c!==null&&c!==""&&Number.isFinite(f)&&Number.isFinite(o))return f<o?-1:f>o?1:0;const t=B(b).toLowerCase(),i=B(c).toLowerCase();return t<i?-1:t>i?1:0}function O(b,c={}){const f=typeof c.lookup=="function"?c.lookup:null,o=c.functions?{...H,...c.functions}:H,n=t=>{switch(t.kind){case"num":return t.value;case"str":return t.value;case"ref":{if(!f)throw new M(`there is no column called ${JSON.stringify(t.name)} here`);const i=f(String(t.name));if(i===void 0)throw new M(`there is no column called ${JSON.stringify(t.name)}`);return i}case"unary":{if(t.op==="%")return X(n(t.arg))/100;const i=X(n(t.arg));return t.op==="-"?-i:i}case"bin":{const i=t.op;if(i==="=")return S(n(t.left),n(t.right))===0;if(i==="<>")return S(n(t.left),n(t.right))!==0;if(i==="<")return S(n(t.left),n(t.right))<0;if(i==="<=")return S(n(t.left),n(t.right))<=0;if(i===">")return S(n(t.left),n(t.right))>0;if(i===">=")return S(n(t.left),n(t.right))>=0;const s=X(n(t.left)),r=X(n(t.right));if(i==="+")return s+r;if(i==="-")return s-r;if(i==="*")return s*r;if(i==="^")return s**r;if(i==="/"){if(r===0)throw new M("division by zero");return s/r}throw new M(`unknown operator ${JSON.stringify(i)}`)}case"call":{const i=c.lazy&&c.lazy[t.name];if(typeof i=="function")return i(t.args,n,c);const s=o[t.name];if(typeof s!="function")throw new M(`there is no function called ${t.name}`);return s(t.args.map(n),c)}default:throw new M("the formula could not be read")}};return n(b)}}),De("packages/core/src/formula/index.js",function(e,U){"use strict";Object.defineProperty(e,"parseFormula",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"referencesOf",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"looksLikeFormula",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"FormulaError",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"tokenise",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"evaluateAst",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"FUNCTIONS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"rowLookup",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"evaluateFormula",{enumerable:!0,get:function(){return S}});const te=U("packages/core/src/formula/parse.js"),M=te.parseFormula,X=te.referencesOf,B=te.looksLikeFormula,D=te.FormulaError,Z=te.tokenise,K=U("packages/core/src/formula/evaluate.js"),I=K.evaluateAst,G=K.FUNCTIONS;function H(O){const{grid:b,row:c,data:f}=O||{},o=r=>String(r).toLowerCase().replace(/[\s_-]/g,""),n=b&&b.columns&&typeof b.columns.all=="function"?b.columns.all():[],t=b&&b.permissions,i=t&&typeof t.isReadable=="function"?r=>t.isReadable(r):()=>!0,s=new Set;for(const r of n)i(r)||(s.add(o(r.id)),r.field&&s.add(o(r.field)),r.title&&s.add(o(r.title)));return r=>{const u=o(r);if(s.has(u))throw new D(`"${r}" cannot be read`);for(const a of n)if(o(a.id)===u||a.field&&o(a.field)===u||a.title&&o(a.title)===u)return c&&b.rows&&typeof b.rows.value=="function"?b.rows.value(c.key,a.id):f?f[a.field||a.id]:void 0;if(f&&typeof f=="object"){for(const a of Object.keys(f))if(o(a)===u){if(!i(a))throw new D(`"${r}" cannot be read`);return f[a]}}}}function S(O,b={}){try{const c=M(O);return{ok:!0,value:I(c,{lookup:H(b),functions:b.formulaFunctions}),references:X(c)}}catch(c){return{ok:!1,error:c instanceof D?c.message:"the formula could not be read",at:c instanceof D?c.at:void 0}}}}),De("packages/core/src/internal/version.js",function(e,U){"use strict";Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return X}});const te="1.103.2";async function M(){return te}const X="1.103.2"}),De("packages/core/src/internal/merge.js",function(e,U){"use strict";Object.defineProperty(e,"expand",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"merge",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"mergeRow",{enumerable:!0,get:function(){return K}});const M=U("packages/core/src/internal/predicates.js").isObject;function X(I,G,H){if(I!==void 0)return I===!0?{enabled:!0,...H}:I===!1?{enabled:!1}:M(I)?I:{[G]:I,enabled:!0}}function B(I){return I==null?[]:Array.isArray(I)?I:[I]}const D=Object.freeze(new Set(["__proto__","constructor","prototype"]));function Z(I,G){if(!M(I))return M(G)?{...G}:G;if(!M(G))return G===void 0?I:G;const H={...I};for(const S of Object.keys(G)){if(D.has(S))continue;const O=G[S];O!==void 0&&(H[S]=M(O)&&M(H[S])?Z(H[S],O):O)}return H}function K(I,G){if(!M(I)||!M(G)||I===G)return G;const H=Object.create(Object.getPrototypeOf(I));return Object.assign(H,I,G),H}}),De("packages/core/src/internal/schedule.js",function(e,U){"use strict";Object.defineProperty(e,"now",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"nextFrame",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"cancelFrame",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"frameBatched",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"settleDebounce",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"whenIdle",{enumerable:!0,get:function(){return K}});function te(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const M=typeof requestAnimationFrame=="function";function X(I){return M?requestAnimationFrame(I):setTimeout(()=>I(te()),16)}function B(I){I!=null&&(M?cancelAnimationFrame(I):clearTimeout(I))}function D(I){let G=null,H=null;const S=()=>{G=null;const b=H;H=null,I(...b||[])},O=(...b)=>{H=b,G===null&&(G=X(S))};return O.cancel=()=>{B(G),G=null,H=null},O.flush=()=>{G!==null&&(B(G),S())},O}function Z(I,G){let H=null,S=null;const O=()=>{if(H=null,S===null)return;const f=S;S=null,I(...f),b()},b=()=>{H=setTimeout(O,G),typeof H?.unref=="function"&&H.unref()},c=(...f)=>{H===null?(I(...f),b()):(S=f,clearTimeout(H),b())};return c.flush=()=>{if(H!==null&&clearTimeout(H),H=null,S===null)return;const f=S;S=null,I(...f)},c.cancel=()=>{H!==null&&clearTimeout(H),H=null,S=null},c.pending=()=>H!==null||S!==null,c}function K(I,G=50){return typeof requestIdleCallback=="function"?requestIdleCallback(I,{timeout:G}):setTimeout(()=>I({timeRemaining:()=>0,didTimeout:!0}),1)}}),De("packages/core/src/internal/paths.js",function(e,U){"use strict";Object.defineProperty(e,"pathGetter",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"pathSetter",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"getPath",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"setPath",{enumerable:!0,get:function(){return Z}});const te=new Map;function M(K){let I=te.get(K);if(I)return I;if(!K.includes("."))I=G=>G?.[K];else{const G=K.split("."),H=G.length;I=S=>{let O=S;for(let b=0;b<H;b++){if(O==null)return;O=O[G[b]]}return O}}return te.set(K,I),I}const X=new Map;function B(K){let I=X.get(K);if(I)return I;if(!K.includes("."))I=(G,H)=>{G!=null&&(G[K]=H)};else{const G=K.split("."),H=G.length-1;I=(S,O)=>{let b=S;for(let c=0;c<H;c++){if(b==null)return;const f=G[c];b[f]==null&&(b[f]={}),b=b[f]}b!=null&&(b[G[H]]=O)}}return X.set(K,I),I}function D(K,I){return M(I)(K)}function Z(K,I,G){B(I)(K,G)}}),De("packages/core/src/internal/compare.js",function(e,U){"use strict";Object.defineProperty(e,"collator",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"defaultCompare",{enumerable:!0,get:function(){return X}});const te=new Map;function M(B,D){const Z=`${B||""}|${D?JSON.stringify(D):""}`;let K=te.get(Z);return K||(K=new Intl.Collator(B||void 0,{numeric:!0,sensitivity:"variant",...D}),te.set(Z,K)),K}function X(B,D){if(B===D)return 0;if(B==null)return 1;if(D==null)return-1;if(typeof B=="number"&&typeof D=="number")return Number.isNaN(B)?Number.isNaN(D)?0:1:Number.isNaN(D)||B<D?-1:B>D?1:0;const Z=String(B),K=String(D);return Z<K?-1:Z>K?1:0}}),De("packages/core/src/defaults.js",function(e,U){"use strict";Object.defineProperty(e,"defaults",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"applyDefaults",{enumerable:!0,get:function(){return S}});const M=U("packages/core/src/internal/predicates.js").isObject,B=U("packages/core/src/internal/merge.js").merge,Z=U("packages/core/src/internal/warn.js").warnOnce;let K=null;class I extends Error{}function G(O,b=new Set){if(Array.isArray(O)){if(b.has(O))throw new I;b.add(O);const f=O.map(o=>G(o,b));return b.delete(O),f}if(!M(O)||Object.getPrototypeOf(O)!==Object.prototype&&Object.getPrototypeOf(O)!==null)return O;if(b.has(O))throw new I;b.add(O);const c={};for(const[f,o]of Object.entries(O))c[f]=G(o,b);return b.delete(O),c}function H(O){if(O===void 0)return G(K??{});if(O===null)return K=null,{};if(!M(O))return Z("defaults:type",`defaults() expects a configuration object, or null to clear it, but got ${Array.isArray(O)?"an array":typeof O}. The call was ignored and the defaults are unchanged.`),G(K??{});try{K=G(O)}catch(b){if(!(b instanceof I))throw b;return Z("defaults:cyclic","defaults() expects a configuration object with no circular references, but the object passed refers back to itself. The call was ignored and the defaults are unchanged."),G(K??{})}return G(K)}function S(O){return K===null?O:B(G(K),O)}}),De("packages/core/src/internal/uid.js",function(e,U){"use strict";Object.defineProperty(e,"uid",{enumerable:!0,get:function(){return M}});let te=0;function M(X="l"){return`${X}${(++te).toString(36)}`}}),De("packages/core/src/events/names.js",function(e,U){"use strict";Object.defineProperty(e,"EVENT_NAMES",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isKnownEvent",{enumerable:!0,get:function(){return X}});const te=Object.freeze(["ready","destroy","render:first","render:done","config:changed","licence:changed","model:changed","rows:changed","rows:queued","rows:deferred","rows:paused","rows:resumed","row:received","row:sent","row:copied","row:moved","source:error","source:total","stream:chunk","stream:end","stream:evicted","rowDrag:started","rowDrag:moved","rowDrag:left","rowDrag:ended","cell:changed","cell:pending","cell:confirmed","cell:reverted","cell:conflict","cell:clicked","cell:dblclicked","cell:contextmenu","cell:mouseover","cell:mouseout","cell:mousedown","cell:mouseup","cell:edit:start","cell:edit:end","row:edit:start","row:edit:end","row:clicked","row:dblclicked","row:pending","row:confirmed","row:reverted","row:conflict","form:opened","form:closed","form:saved","form:error","sort:changed","filter:changed","group:toggled","facet:computed","facet:filtered","facet:expanded","facet:failed","column:moved","column:resized","column:visible","column:pinned","column:grouped","column:pivoted","column:filter:open","column:profile:open","column:menu:open","columns:changed","columns:tagged","columngroup:changed","header:contextmenu","pivot:drill","selection:changed","range:changed","clipboard:copy","page:changed","scroll","scroll:end","size:changed","detail:toggled","detail:cell:edit:start","detail:cell:edit:end","detail:row:edit:start","detail:row:edit:end","detail:cell:changed","toolpanel:focus","highlight:changed","find:changed","tree:loading","tree:loaded","tree:loadFailed","tree:loadAborted","state:changed","state:reset","history:changed","history:applied","views:changed","view:applied","view:saved","view:removed","view:renamed","view:default","validation:failed","validation:cleared","formatting:changed","redaction:changed","permissions:changed","presentation:changed","presentation:started","presentation:ended","presentation:view","presentation:scale","presentation:spotlight","presentation:captured","comment:added","comment:edited","comment:deleted","comment:failed","comment:resolved","comment:unresolved","comment:threadOpened","comment:threadClosed","comment:indexLoaded","presence:published","presence:joined","presence:updated","presence:left","presence:failed","presence:lockRefused","diff:changed","diff:swapped","timeline:attached","timeline:detached","timeline:seek","timeline:seeking","annotation:changed","export:progress","export:request","export:done","shortcuts:opened","shortcuts:closed","print:before","print:after","beforeEdit","beforeSort","beforeFilter","beforeColumnMove","beforeColumnResize","beforeColumnHide","beforeSelect","beforeRowAdd","beforeDelete","beforeRowMove","beforeGroup","beforeRowReceive","edit:cancelled","sort:cancelled","filter:cancelled","columnMove:cancelled","columnResize:cancelled","columnHide:cancelled","selection:cancelled","rowAdd:cancelled","delete:cancelled","rowMove:cancelled","group:cancelled","rowReceive:cancelled"]),M=new Set(te);function X(B){return B==="*"||M.has(B)}}),De("packages/core/src/events/bus.js",function(e,U){"use strict";Object.defineProperty(e,"WILDCARD",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return f}});const te=U("packages/core/src/internal/warn.js"),M=te.warnOnce,X=te.DEV,D=U("packages/core/src/internal/uid.js").uid,K=U("packages/core/src/events/names.js").isKnownEvent,I="*";function G(o,n){!X||K(n)||M(`bus.unknown:${n}`,`${o}('${n}') subscribes to an event the grid never raises, so the handler will never fire. Check the name against the EventName list — a common cause is a near miss such as 'row:click' for 'row:clicked'.`)}const H=new Set(["api","user","init","ai"]),S=new WeakMap;function O(o){let n=S.get(o);return n||(n=D("h"),S.set(o,n)),n}function b(){return typeof performance=="object"&&performance?performance.now():Date.now()}function c(o){if(!o||typeof o!="object")return{};const n={};for(const[t,i]of Object.entries(o))t!=="grid"&&(i==null?n[t]=String(i):Array.isArray(i)?n[t]=`[${i.length}]`:typeof i=="object"?n[t]=i.key?`row ${i.key}`:"{…}":typeof i=="function"?n[t]="[function]":n[t]=String(i).slice(0,60));return n}class f{#e=new Map;#t=!1;#n=[];#r=200;#s=new Map;#i=null;#o=!1;#l=0;constructor(n=null){this.#i=n}attach(n){this.#i=n}get grid(){return this.#i}get destroyed(){return this.#o}on(n,t){if(typeof t!="function")return M(`bus.handler:${n}`,`on('${n}') needs a function; ignored.`),()=>{};G("on",n);let i=this.#e.get(n);return i||(i=[],this.#e.set(n,i)),i.push(t),()=>this.off(n,t)}once(n,t){if(typeof t!="function")return M(`bus.handler:${n}`,`once('${n}') needs a function; ignored.`),()=>{};G("once",n);const i=s=>{this.off(n,t),t(s)};return this.#s.set(t,i),this.on(n,i)}off(n,t){if(t===void 0){this.#e.delete(n);return}const i=this.#e.get(n);if(!i)return;const s=this.#s.get(t),r=s&&i.includes(s)?s:t,u=i.indexOf(r);u>=0&&i.splice(u,1),s&&r===s&&this.#s.delete(t),i.length===0&&this.#e.delete(n)}count(n){const t=this.#e.get(n),i=n===I?null:this.#e.get(I);return(t?t.length:0)+(i?i.length:0)}#a(n,t,i,s,r){this.#n.push({type:n,origin:t,listeners:(s?s.length:0)+(r?r.length:0),payload:c(i),at:Date.now(),ms:0}),this.#n.length>this.#r&&this.#n.shift()}recordEvents(n,t){this.#t=!!n,Number.isFinite(t)&&t>0&&(this.#r=Math.floor(t)),n||(this.#n=[])}eventLog(){return this.#n.map(n=>({...n}))}clearEventLog(){this.#n=[]}counts(){const n={};for(const[t,i]of this.#e)n[t]=i.length;return n}emit(n,t,i){const s=i??(t&&t.origin),r=H.has(s)?s:"api",u={...t||null,type:n,origin:r,grid:this.#i};if(this.#o)return u;const a=this.#e.get(n),l=n===I?void 0:this.#e.get(I);if(this.#t&&this.#a(n,r,t,a,l),!a&&!l)return u;const h=this.#t?b():0;this.#l++;try{a&&this.#c(a.slice(),u,n),l&&this.#c(l.slice(),u,I)}finally{this.#l--,this.#t&&this.#n.length&&(this.#n[this.#n.length-1].ms=b()-h)}return u}emitBefore(n,t,i){const s=i??(t&&t.origin),r=H.has(s)?s:"user";let u=!1,a=null;const l=p=>{u=!0,p!=null&&a===null&&(a=String(p))},h={...t||null,type:n,origin:r,grid:this.#i,get defaultPrevented(){return u},get reason(){return a},preventDefault(p){l(p)}};if(this.#o)return!0;const y=this.#e.get(n);this.#t&&this.#a(n,r,t,y,void 0);const m=y?y.slice():[];if(m.length===0)return!0;const v=()=>(u&&a===null&&(a="prevented"),u&&t&&typeof t=="object"&&(t.reason=a),!u),d=[];for(const p of m)try{const g=p(h);g&&typeof g.then=="function"?d.push(g):g===!1&&l("prevented")}catch(g){l("error"),M(`bus.beforeThrow:${n}:${O(p)}`,`a '${n}' before-handler threw; the action was cancelled.`,g)}return d.length===0?v():Promise.allSettled(d).then(p=>{for(const g of p)g.status==="rejected"?(l("error"),M(`bus.beforeReject:${n}`,`a '${n}' before-handler rejected; the action was cancelled.`,g.reason)):g.value===!1&&l("prevented");return v()})}#c(n,t,i){for(let s=0;s<n.length;s++)try{n[s](t)}catch(r){M(`bus.throw:${i}:${O(n[s])}`,`a '${i}' handler threw; other handlers were unaffected.`,r)}}clear(){this.#e.clear(),this.#s.clear()}destroy(){this.clear(),this.#o=!0,this.#i=null}}}),De("packages/core/src/registry/free-tier-notice.js",function(e,U){"use strict";Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return te}});const te="Free for non-commercial use: latticegrid.dev/free"}),De("packages/core/src/registry/licence.js",function(e,U){"use strict";Object.defineProperty(e,"PRODUCT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"LICENCE_VERSION",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"PUBLIC_KEY",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"fromBase64Url",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"toBase64Url",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"asciiBytes",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"parseLicence",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"hasEd25519",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"verifyLicence",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"isLocalHost",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"currentHost",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"matchesDomain",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"LicenceHolder",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setLicence",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"licenceInfo",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"watermark",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"licenceState",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"sharedLicence",{enumerable:!0,get:function(){return F}});const M=U("packages/core/src/internal/warn.js").warnOnce,X=U("packages/core/src/registry/free-tier-notice.js"),B=X.FREE_TIER_NOTICE;Object.defineProperty(e,"FREE_TIER_NOTICE",{enumerable:!0,get:function(){return X.FREE_TIER_NOTICE}});const D="lattice-grid",Z=1,K="LG1",I=64,G="GwmaCOkGedHulqsa-DOV1TU8On1rsalWv519c_dW4j4",H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",S=(()=>{const L=new Int16Array(128).fill(-1);for(let j=0;j<H.length;j++)L[H.charCodeAt(j)]=j;return L[43]=62,L[47]=63,L})();function O(L){if(typeof L!="string")return null;let j="";for(let z=0;z<L.length;z++){const Y=L.charCodeAt(z);if(Y!==61){if(Y>127||S[Y]<0)return null;j+=L[z]}}const R=j.length;if(R%4===1)return null;const $=new Uint8Array(Math.floor(R*3/4));let T=0,A=0,C=0;for(let z=0;z<R;z++)T=T<<6|S[j.charCodeAt(z)],A+=6,A>=8&&(A-=8,$[C++]=T>>A&255);return C===$.length?$:$.subarray(0,C)}function b(L){let j="",R=0;for(;R+2<L.length;R+=3){const T=L[R]<<16|L[R+1]<<8|L[R+2];j+=H[T>>18&63]+H[T>>12&63]+H[T>>6&63]+H[T&63]}const $=L.length-R;if($===1){const T=L[R]<<16;j+=H[T>>18&63]+H[T>>12&63]}else if($===2){const T=L[R]<<16|L[R+1]<<8;j+=H[T>>18&63]+H[T>>12&63]+H[T>>6&63]}return j}function c(L){const j=new Uint8Array(L.length);for(let R=0;R<L.length;R++)j[R]=L.charCodeAt(R)&127;return j}function f(L){if(typeof TextDecoder=="function")return new TextDecoder().decode(L);let j="";for(let R=0;R<L.length;R++)j+=String.fromCharCode(L[R]);return j}function o(L){const j={ok:!1,reason:"malformed",product:null,issuedTo:null,expires:null,terms:null,features:[],deployments:[],version:0,message:null,signature:null,raw:typeof L=="string"?L:""};if(typeof L!="string"||L.length===0)return{...j,reason:"missing"};const R=L.trim(),$=R.split(".");if($.length!==3)return j;const[T,A,C]=$;if(T!==K)return{...j,reason:"prefix"};const z=O(A),Y=O(C);if(!z||!Y)return j;let q;try{q=JSON.parse(f(z))}catch{return j}return q===null||typeof q!="object"?j:{ok:!0,reason:null,product:typeof q.p=="string"?q.p:null,issuedTo:typeof q.t=="string"?q.t:null,expires:typeof q.e=="string"?q.e:null,terms:typeof q.terms=="string"?q.terms:null,features:Array.isArray(q.f)?q.f.slice():[],deployments:Array.isArray(q.d)?q.d.slice():[],version:typeof q.v=="number"?q.v:0,message:c(A),signature:Y,raw:R}}function n(L,j){if(!L)return!1;const R=Date.parse(/^\d{4}-\d{2}-\d{2}$/.test(L)?`${L}T23:59:59.999Z`:L);return Number.isNaN(R)?!0:j>R}function t(L){return L==="non-commercial"?"non-commercial":"commercial"}let i=null,s=null,r=null;function u(){const L=globalThis.crypto;return L&&L.subtle?L.subtle:null}async function a(L){if(i&&s===L)return i;const j=u();if(!j)return null;const R=O(L);if(!R)return null;try{const $=await j.importKey("raw",R,{name:"Ed25519"},!1,["verify"]);return i=$,s=L,$}catch{return null}}async function l(){return r!==null||(r=await a(G)!==null),r}async function h(L,j={}){const R=j.warn!==!1,$=j.product||D,T=j.publicKey||G,A=j.now??Date.now(),C=j.host??m(),z=y(C)?"":` ${B}`,Y=o(L);if(!Y.ok){const ne=Y.reason==="missing"?"missing":"malformed";return R&&M(`licence.${ne}`,ne==="missing"?`no licence key supplied. The grid renders in full and carries a trial watermark on any host other than localhost. Get a key at latticegrid.dev.${z}`:`licence key could not be read. The grid will render with a watermark.${z}`),{valid:!1,reason:ne,terms:"commercial"}}const q={product:Y.product||void 0,issuedTo:Y.issuedTo||void 0,expires:Y.expires||void 0,terms:t(Y.terms)};if(Y.product!==$)return R&&M("licence.product",`licence key is for '${Y.product}', not '${$}'. The grid will render with a watermark.`),{valid:!1,...q,reason:"product"};if(n(Y.expires,A))return R&&M("licence.expired",`licence expired on ${Y.expires}. The grid will render with a watermark. Renew at latticegrid.dev.`),{valid:!1,...q,reason:"expired"};const V=Y.deployments||[];if(V.length&&C&&!y(C)&&!v(C,V))return R&&M("licence.domain",`licence key is not valid for ${C}; it covers ${V.join(", ")}. The grid will render with a watermark.`),{valid:!1,...q,reason:"domain"};const J=await a(T);if(!J){const ne=!!Y.signature&&Y.signature.length===I;return R&&M("licence.algorithm","this host does not provide crypto.subtle Ed25519, so the licence signature could not be verified. A structural check was used instead."),ne?{valid:!0,...q,reason:"unverified"}:{valid:!1,...q,reason:"signature"}}let ee=!1;try{ee=await u().verify({name:"Ed25519"},J,Y.signature,Y.message)}catch{ee=!1}return ee?{valid:!0,...q}:(R&&M("licence.signature","licence signature is not valid. The grid will render with a watermark."),{valid:!1,...q,reason:"signature"})}function y(L){const j=String(L??m()??"").trim().toLowerCase().replace(/^\[/,"").replace(/\]$/,"");return!j||j==="localhost"||j.endsWith(".localhost")||j==="::1"||j==="0:0:0:0:0:0:0:1"?!0:/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(j)}function m(){const L=globalThis.location;return L&&typeof L.hostname=="string"?L.hostname:null}function v(L,j){const R=d(L);return!R||!Array.isArray(j)?!1:j.some($=>{const T=d($);if(!T)return!1;if(T==="*")return!0;if(T.startsWith("*.")){const A=T.slice(2);return R===A||R.endsWith(`.${A}`)}return R===T})}function d(L){return String(L??"").trim().toLowerCase().replace(/\.$/,"")}class p{#e="";#t={valid:!1,reason:"missing",terms:"commercial"};#n=null;#r=null;#s;#i=new Set;constructor(j={}){this.#s=j}set(j){this.#e=typeof j=="string"?j.trim():"";const R=o(this.#e);return this.#t=R.ok?{valid:!n(R.expires,Date.now())&&R.product===(this.#s.product||D),product:R.product||void 0,issuedTo:R.issuedTo||void 0,expires:R.expires||void 0,terms:t(R.terms),reason:"pending"}:{valid:!1,reason:R.reason||"malformed",terms:"commercial"},this.#n=null,this.#e&&this.verify(),this.#t}verify(){if(this.#n)return this.#n;const j=this.#e;return this.#n=h(j,this.#s).then(R=>{if(this.#e===j){this.#t=R;for(const $ of this.#i)$(R)}return R}),this.#n}onSettled(j){return this.#i.add(j),()=>this.#i.delete(j)}info(){return{...this.#t}}watermark(){return this.#t.valid?!1:!y(this.#r)}setHost(j){this.#r=j}state(){return this.#t.valid?"licensed":y(this.#r)?"localhost":"trial"}reset(){this.#e="",this.#t={valid:!1,reason:"missing",terms:"commercial"},this.#n=null,this.#i.clear()}}const g=Symbol.for("lattice-grid/licence/holder");function k(){const L=globalThis,j=L&&L[g];if(j&&typeof j.set=="function"&&typeof j.watermark=="function")return j;const R=new p;if(L)try{L[g]=R}catch{}return R}const w=k();function E(L){return w.set(L)}function N(){return w.info()}function x(){return w.watermark()}function _(){return w.state()}function F(){return w}}),De("packages/core/src/registry/registry.js",function(e,U){"use strict";Object.defineProperty(e,"KINDS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"REGIONS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"Registry",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"sharedRegistry",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"registerModules",{enumerable:!0,get:function(){return i}});const te=U("packages/core/src/internal/warn.js"),M=te.warnOnce,X=te.DEV,D=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/registry/licence.js"),K=Z.LicenceHolder,I=Z.sharedLicence,G=["renderer","editor","filter","dataType","totalFn","pipe","component"],H=["all","header","body","totals","panels"];class S{#e=new Map;#t=new Map;#n=new Set;#r=new Set;#s;#i=null;#o=null;#l=new Set;#a=new Map;constructor(r={}){for(const u of G)this.#t.set(u,new Map);this.#s=r.holder||I(),this.#o=r.grid??null,this.#i=this.#s.onSettled(()=>{this.#f({reason:"licence",name:"licence",capabilities:this.capabilities(),regions:["all"]})}),r.licence&&this.setLicence(r.licence)}registerModules(r,u={}){u.licence&&this.setLicence(u.licence),u.grid!==void 0&&(this.#o=u.grid);const a=Array.isArray(r)?r:[r],l=[];for(const h of a){if(!h||typeof h!="object"||typeof h.name!="string"||!h.name){M("registry.module.shape","registerModules received something that is not a module; ignored.");continue}if(this.#e.has(h.name)){X&&this.#u(this.#e.get(h.name),h);continue}if(!D(h.install)){M(`registry.module.install:${h.name}`,`module '${h.name}' has no install() and was ignored.`);continue}const y={registry:this,grid:this.#o};try{h.install(y)}catch(m){M(`registry.module.throw:${h.name}`,`module '${h.name}' threw during install; it was not registered.`,m);continue}this.#e.set(h.name,h);for(const m of O(h))this.#n.add(m);l.push(h.name),this.#f({reason:"module",name:h.name,capabilities:this.capabilities(),regions:f(h)})}return l}unregisterModule(r){const u=this.#e.get(r);if(!u)return!1;if(D(u.uninstall))try{u.uninstall({registry:this,grid:this.#o})}catch(a){M(`registry.module.uninstall:${r}`,`module '${r}' threw during uninstall.`,a)}return this.#e.delete(r),this.#c(),this.#f({reason:"unmodule",name:r,capabilities:this.capabilities(),regions:f(u)}),!0}modules(){return[...this.#e.values()]}has(r){return this.#e.has(r)}#c(){this.#n.clear();for(const r of this.#e.values())for(const u of O(r))this.#n.add(u)}#u(r,u){!r||r===u||b(r,u)||M(`registry.module.reconfigure:${u.name}`,`module '${u.name}' was re-registered with different options; the first registration is kept and this call was ignored. Unregister it first if you mean to replace it.`)}capabilities(){return[...this.#n].sort()}can(r){return this.#n.has(r)}onChange(r){return D(r)?(this.#r.add(r),this.#a.set(r,this.#o),()=>{this.#r.delete(r),this.#a.delete(r)}):()=>{}}#f(r){for(const u of[...this.#r])try{u(r)}catch(a){M("registry.onChange.throw","a registry change handler threw.",a)}}register(r,u,a){const l=this.#t.get(r);if(!l){M(`registry.kind:${r}`,`unknown registry kind '${r}'; expected one of ${G.join(", ")}.`);return}if(!u||typeof u!="string"){M(`registry.name:${r}`,`register('${r}', ...) needs a name.`);return}l.has(u)&&l.get(u)!==a&&M(`registry.replace:${r}:${u}`,`'${u}' was already registered as a ${r} and has been replaced.`),l.set(u,a),this.#f({reason:"register",name:u,kind:r,capabilities:this.capabilities(),regions:o(r)})}registerAll(r,u){if(u)for(const a of Object.keys(u))this.register(r,a,u[a])}get(r,u){const a=this.#t.get(r);return a?a.get(u):void 0}names(r){const u=this.#t.get(r);return u?[...u.keys()]:[]}#d(r,u){const a=this.#t.get(r).get(u);return a!==void 0?a:this.#t.get("component").get(u)}renderer(r){return this.#d("renderer",r)}editor(r){return this.#d("editor",r)}filter(r){return this.#d("filter",r)}dataType(r){return this.get("dataType",r)}totalFn(r){return this.get("totalFn",r)}pipe(r){return this.get("pipe",r)}setLicence(r){return this.#s.set(r)}licence(){return this.#s.info()}licenceVerified(){return this.#s.verify()}watermark(){return this.#s.watermark()}attach(r){r!=null&&(this.#l.add(r),this.#o=r)}detach(r){if(r!=null){this.#l.delete(r);for(const[u,a]of[...this.#a])a===r&&(this.#r.delete(u),this.#a.delete(u));if(this.#o===r){const u=this.#l.size?[...this.#l][this.#l.size-1]:null;this.#o=u}this.#l.size===0&&this.#i&&(this.#i(),this.#i=null)}}destroy(r){if(r!=null){this.detach(r);return}for(const u of[...this.#e.keys()])this.unregisterModule(u);this.#r.clear(),this.#a.clear(),this.#l.clear(),this.#i&&this.#i(),this.#i=null,this.#o=null}}function O(s){const r=s.capabilities,u=Array.isArray(r)?r.filter(a=>typeof a=="string"):[];return[s.name,...u]}function b(s,r){return s.install!==r.install||s.uninstall!==r.uninstall||(s.version||"")!==(r.version||"")?!1:c(O(s),O(r))&&c(f(s),f(r))}function c(s,r){const u=new Set(s),a=new Set(r);if(u.size!==a.size)return!1;for(const l of u)if(!a.has(l))return!1;return!0}function f(s){const r=s.regions;return!Array.isArray(r)||r.length===0?["all"]:r.filter(u=>H.includes(u))}function o(s){switch(s){case"filter":return["header"];case"totalFn":return["totals"];case"renderer":case"editor":case"pipe":return["body"];default:return["all"]}}const n=new S;function t(){return n}function i(s,r={}){return n.registerModules(s,r)}}),De("packages/core/src/internal/text.js",function(e,U){"use strict";Object.defineProperty(e,"humanise",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"escapeHtml",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"titleCase",{enumerable:!0,get:function(){return B}});function te(D){return D?(D.includes(".")?D.slice(D.lastIndexOf(".")+1):D).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(/^./,K=>K.toUpperCase()):""}const M={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function X(D){const Z=D==null?"":String(D);return/[&<>"']/.test(Z)?Z.replace(/[&<>"']/g,K=>M[K]):Z}function B(D){return String(D).replace(/\w\S*/g,Z=>Z[0].toUpperCase()+Z.slice(1).toLowerCase())}}),De("packages/core/src/format/mask.js",function(e,U){"use strict";Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return Z}});const te=new Set(["0","#","?",",","."]),M="\0";function X(I){const G=[];let H="",S=!1;for(let O=0;O<I.length;O++){const b=I[O];if(b==="\\"){H+=b+(I[O+1]??""),O+=1;continue}if(b==='"'){S=!S,H+=b;continue}if(b===";"&&!S){G.push(H),H="";continue}H+=b}return G.push(H),G}function B(I){let G="",H="",S="",O=1,b=!1,c=!1;const f=l=>{c?H+=l:G+=l};for(let l=0;l<I.length;l++){const h=I[l];if(h==="\\"){f(I[l+1]??""),l+=1;continue}if(h==='"'){const y=I.indexOf('"',l+1);f(y===-1?I.slice(l+1):I.slice(l+1,y)),l=y===-1?I.length:y;continue}if(h==="%"){O*=100,f("%");continue}if(h==="@"){b=!0,f("\0");continue}if(te.has(h)){S+=h,c=!0;continue}f(h)}let o=-1;for(let l=S.length-1;l>=0;l--){const h=S[l];if(h==="0"||h==="#"||h==="?"){o=l;break}}let n=!1,t="";for(let l=0;l<S.length;l++){const h=S[l];if(h===","){l>o?O/=1e3:n=!0;continue}t+=h}const i=t.indexOf("."),s=i===-1?t:t.slice(0,i),r=i===-1?"":t.slice(i+1);let u=0;for(const l of s)l==="0"&&(u+=1);let a=0;for(const l of r)l==="0"&&(a+=1);return{prefix:G,suffix:H,minInt:u,minDec:a,maxDec:r.length,grouping:n,scale:O,hasNumber:o!==-1,isText:b}}function D(I,G){const H=new Intl.NumberFormat(G,{minimumIntegerDigits:Math.max(I.minInt,1),minimumFractionDigits:I.minDec,maximumFractionDigits:Math.max(I.maxDec,I.minDec),useGrouping:I.grouping}),{prefix:S,suffix:O,scale:b,hasNumber:c}=I;return f=>{if(!c)return S+O;const o=b===1?f:f*b;return S+H.format(o)+O}}function Z(I,G){const S=X(String(I)).map(B),O=S.map(t=>D(t,G)),b=0,c=S.length>1?1:-1,f=S.length>2?2:-1,o=S.length>3?3:-1,n=t=>{if(t==null||t==="")return"";if(typeof t!="number"||Number.isNaN(t)){const i=Number(t);if(Number.isNaN(i))return o===-1?String(t):(S[o].prefix+S[o].suffix).split("\0").join(String(t));t=i}return t===0&&f!==-1?O[f](0):t<0&&c!==-1?O[c](-t):O[b](t)};return n.spec={mask:I},{format:n,ooxml:K(String(I))}}function K(I){return I.trim()}}),De("packages/core/src/format/pattern.js",function(e,U){"use strict";Object.defineProperty(e,"parseNumberPattern",{enumerable:!0,get:function(){return D}});const M=U("packages/core/src/format/mask.js").splitSections;function X(Z){let K="",I="",G="",H="",S=!1,O=!1,b=!1,c=!1;const f=n=>{b?I+=n:K+=n};for(let n=0;n<Z.length;n++){const t=Z[n];if(t==="\\"){f(Z[n+1]??""),n+=1;continue}if(t==='"'){const i=Z.indexOf('"',n+1);f(i===-1?Z.slice(n+1):Z.slice(n+1,i)),n=i===-1?Z.length:i;continue}if(t==="%"){O=!0;continue}if(t==="0"||t==="#"){b=!0,c?H+=t:G+=t;continue}if(t===","){c||(S=!0);continue}if(t==="."&&!c){c=!0;continue}f(t)}if(!b)return{hasDigit:!1,prefix:K,suffix:I,minDec:0,maxDec:0,grouping:!1,percent:O};let o=0;for(const n of H)n==="0"&&(o+=1);return{hasDigit:!0,prefix:K,suffix:I,minDec:o,maxDec:H.length,grouping:S,percent:O}}function B(Z,K){const I=K.trim(),G=Z.trim();return I.startsWith("(")&&I.endsWith(")")&&I.slice(1,-1).trim()===G?"parentheses":I.endsWith("-")?"suffix":"minus"}function D(Z){if(typeof Z!="string")return null;const K=M(Z);if(K.length===0)return null;const I=X(K[0]);if(!I.hasDigit)return null;const G={style:I.percent?"percent":"decimal",prefix:I.prefix,suffix:I.suffix,minDecimals:I.minDec,maxDecimals:Math.max(I.maxDec,I.minDec),thousandsSeparator:I.grouping?void 0:!1};if(K.length>1&&(G.negative=B(K[0],K[1])),K.length>2){const H=X(K[2]);H.hasDigit||(G.zeroDisplay=H.prefix+H.suffix)}return G}}),De("packages/core/src/format/number.js",function(e,U){"use strict";Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return K}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/internal/warn.js").warnOnce,Z=U("packages/core/src/format/pattern.js").parseNumberPattern;function K(I,G){const H=typeof I=="string"?{pattern:I}:I||{};let S=H;if(typeof H.pattern=="string"){const k=Z(H.pattern);if(k){const{pattern:w,...E}=H;S={...k,...E}}else B(`format:pattern:${H.pattern}`,`invalid number format pattern "${H.pattern}"; the value will use the default number format`)}const O=S.locale||G||void 0,b=S.style||"decimal",c=typeof S.scale=="number"?S.scale:1,f=S.nullDisplay??"",o=S.zeroDisplay,n=S.prefix||"",t=S.suffix||"",i=S.negative||"minus",s=S.signed===!0,r={style:b,notation:S.notation||"standard"};b==="currency"&&(r.currency=S.currency||"USD",S.currencyDisplay&&(r.currencyDisplay=S.currencyDisplay)),typeof S.decimals=="number"?(r.minimumFractionDigits=S.decimals,r.maximumFractionDigits=S.decimals):(typeof S.minDecimals=="number"&&(r.minimumFractionDigits=S.minDecimals),typeof S.maxDecimals=="number"&&(r.maximumFractionDigits=S.maxDecimals),r.minimumFractionDigits>(r.maximumFractionDigits??20)&&(r.maximumFractionDigits=r.minimumFractionDigits)),S.thousandsSeparator===!1&&(r.useGrouping=!1),r.notation==="compact"&&(r.compactDisplay=S.compactDisplay||"short");const u=new Intl.NumberFormat(O,r),a=typeof S.thousandsSeparator=="string"?S.thousandsSeparator:null,l=typeof S.decimalSeparator=="string"?S.decimalSeparator:null;let h=",",y=".";if(a||l)for(const k of u.formatToParts(12345.6))k.type==="group"?h=k.value:k.type==="decimal"&&(y=k.value);const m=k=>{let w=k;return a&&(w=w.split(h).join("")),l&&(w=w.split(y).join("")),a&&(w=w.split("").join(a)),l&&(w=w.split("").join(l)),w},v=!!(a||l),d=n!==""&&b==="currency",p=k=>{let w;if(d){const E=u.formatToParts(k);let N=!1;w="";for(const x of E)w+=x.value,!N&&x.type==="currency"&&(w+=n,N=!0);N||(w=n+w)}else w=n+u.format(k);return v&&(w=m(w)),w+t},g=k=>{if(M(k)||k==="")return f;const w=typeof k=="number"?k:Number(k);if(Number.isNaN(w))return f;const E=c===1?w:w*c;return E===0&&o!==void 0?o:E<0?i==="parentheses"?`(${p(-E)})`:i==="suffix"?`${p(-E)}-`:p(E):s&&E>0?`+${p(E)}`:p(E)};return g.negativeClass=S.negativeClass||null,g.spec=S,g}}),De("packages/core/src/format/date.js",function(e,U){"use strict";Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"toIsoDate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"toIsoDateTime",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"compareIso",{enumerable:!0,get:function(){return t}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/internal/warn.js").warnOnce,D=["yyyy","yy","MMMM","MMM","MM","M","dd","d","EEEE","EEE","HH","H","hh","h","mm","m","ss","s","SSS","a"];function Z(i){const s=[];let r=0,u="";const a=()=>{u&&(s.push({token:null,text:u}),u="")};for(;r<i.length;){const l=i[r];if(l==="'"){if(i[r+1]==="'"){u+="'",r+=2;continue}const y=i.indexOf("'",r+1);if(y===-1){u+=i.slice(r+1),r=i.length;continue}u+=i.slice(r+1,y),r=y+1;continue}const h=D.find(y=>i.startsWith(y,r));if(h){a(),s.push({token:h,text:h}),r+=h.length;continue}/[A-Za-z]/.test(l)&&B(`date.pattern.token:${l}`,`the date pattern "${i}" contains '${l}', which is not a supported token, so it is rendered as text. Quote it as a literal to silence this. Supported: ${D.join(" ")}.`),u+=l,r+=1}return a(),s}const K=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?(?:\.\d+)?)?$/;function I(i){if(M(i)||i==="")return null;if(i instanceof Date)return Number.isNaN(i.getTime())?null:i;if(typeof i=="number")return Number.isNaN(i)?null:new Date(i);if(typeof i=="string"){const s=K.exec(i.trim());if(s){const[,u,a,l,h="0",y="0",m="0"]=s;return new Date(+u,+a-1,+l,+h,+y,+m)}const r=new Date(i);return Number.isNaN(r.getTime())?null:r}return null}function G(i,s){return String(i).padStart(s,"0")}function H(i){if(!i)return u=>({year:u.getFullYear(),month:u.getMonth()+1,day:u.getDate(),hour:u.getHours(),minute:u.getMinutes(),second:u.getSeconds(),ms:u.getMilliseconds(),weekday:u.getDay()});const s=new Intl.DateTimeFormat("en-US",{timeZone:i,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,weekday:"short"}),r={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};return u=>{const a={year:0,month:1,day:1,hour:0,minute:0,second:0,ms:u.getMilliseconds(),weekday:0};for(const l of s.formatToParts(u))switch(l.type){case"year":a.year=Number(l.value);break;case"month":a.month=Number(l.value);break;case"day":a.day=Number(l.value);break;case"hour":a.hour=Number(l.value)%24;break;case"minute":a.minute=Number(l.value);break;case"second":a.second=Number(l.value);break;case"weekday":a.weekday=r[l.value]??0;break;default:break}return a}}function S(i,s,r){const u=Z(i),a=H(r),l=new Set(u.filter(d=>d.token).map(d=>d.token)),h=l.has("MMM")?new Intl.DateTimeFormat(s,{month:"short",timeZone:r}):null,y=l.has("MMMM")?new Intl.DateTimeFormat(s,{month:"long",timeZone:r}):null,m=l.has("EEE")?new Intl.DateTimeFormat(s,{weekday:"short",timeZone:r}):null,v=l.has("EEEE")?new Intl.DateTimeFormat(s,{weekday:"long",timeZone:r}):null;return d=>{const p=a(d);let g="";for(const k of u){if(!k.token){g+=k.text;continue}switch(k.token){case"yyyy":g+=G(p.year,4);break;case"yy":g+=G(p.year%100,2);break;case"MMMM":g+=y.format(d);break;case"MMM":g+=h.format(d);break;case"MM":g+=G(p.month,2);break;case"M":g+=String(p.month);break;case"dd":g+=G(p.day,2);break;case"d":g+=String(p.day);break;case"EEEE":g+=v.format(d);break;case"EEE":g+=m.format(d);break;case"HH":g+=G(p.hour,2);break;case"H":g+=String(p.hour);break;case"hh":g+=G(p.hour%12===0?12:p.hour%12,2);break;case"h":g+=String(p.hour%12===0?12:p.hour%12);break;case"mm":g+=G(p.minute,2);break;case"m":g+=String(p.minute);break;case"ss":g+=G(p.second,2);break;case"s":g+=String(p.second);break;case"SSS":g+=G(p.ms,3);break;case"a":g+=p.hour<12?"AM":"PM";break;default:g+=k.text;break}}return g}}const O=[["year",365*24*36e5],["month",720*36e5],["week",168*36e5],["day",24*36e5],["hour",36e5],["minute",6e4],["second",1e3]];function b(i,s){const r=i||{},u=r.locale||s||void 0,a=r.nullDisplay??"",l=r.timeZone;let h;if(r.pattern)h=S(r.pattern,u,l);else if(r.dateStyle||r.timeStyle){const p={timeZone:l};r.dateStyle&&(p.dateStyle=r.dateStyle),r.timeStyle&&(p.timeStyle=r.timeStyle);const g=new Intl.DateTimeFormat(u,p);h=k=>g.format(k)}else{const p=new Intl.DateTimeFormat(u,{dateStyle:"medium",timeZone:l});h=g=>p.format(g)}const y=r.relative?new Intl.RelativeTimeFormat(u,{numeric:"auto"}):null,v=(typeof r.relative=="object"&&r.relative?r.relative.threshold??7:7)*24*36e5,d=(p,g)=>{const k=I(p);if(!k)return a;if(y){const w=g&&typeof g.now=="number"?g.now:Date.now(),E=k.getTime()-w;if(Math.abs(E)<v){for(const[N,x]of O)if(Math.abs(E)>=x||N==="second")return y.format(Math.round(E/x),N)}}return h(k)};return d.spec=r,d}function c(i){if(M(i)||i==="")return null;if(typeof i=="string"){const u=/^(\d{4}-\d{2}-\d{2})/.exec(i.trim());if(u)return u[1];const a=I(i);return a?c(a):null}const s=I(i);if(!s)return null;const r=u=>String(u).padStart(2,"0");return`${s.getFullYear()}-${r(s.getMonth()+1)}-${r(s.getDate())}`}function f(i,s){if(M(i)||i==="")return null;if(typeof i=="string"){const u=i.trim();if(o.test(u)){const h=I(u);return h?n(h,s):null}const a=/^(\d{4}-\d{2}-\d{2})[T ](\d{2}):(\d{2})(?::(\d{2}))?/.exec(u);if(a){const[,h,y,m,v]=a;return`${h}T${y}:${m}${v&&v!=="00"?`:${v}`:""}`}if(/^\d{4}-\d{2}-\d{2}$/.test(u))return`${u}T00:00`;const l=I(u);return l?f(l):null}const r=I(i);return r?n(r,s):null}const o=/(?:Z|[+-]\d{2}:?\d{2})$/i;function n(i,s){const r=h=>String(h).padStart(2,"0");if(s)try{const h=new Intl.DateTimeFormat("en-CA",{timeZone:s,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).formatToParts(i).reduce((v,d)=>(d.type!=="literal"&&(v[d.type]=d.value),v),{}),y=h.hour==="24"?"00":h.hour,m=Number(h.second);return`${h.year}-${h.month}-${h.day}T${y}:${h.minute}`+(m?`:${h.second}`:"")}catch{}const u=`${i.getFullYear()}-${r(i.getMonth()+1)}-${r(i.getDate())}`,a=i.getSeconds(),l=`${r(i.getHours())}:${r(i.getMinutes())}${a?`:${r(a)}`:""}`;return`${u}T${l}`}function t(i,s){const r=M(i)||i===""?null:String(i),u=M(s)||s===""?null:String(s);return r===null?u===null?0:1:u===null||r<u?-1:r>u?1:0}}),De("packages/core/src/format/boolean.js",function(e,U){"use strict";Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return Z}});const M=U("packages/core/src/internal/predicates.js").isNil,X={true:"☑",false:"☐",null:""},B={true:"◉",false:"◯",null:""};function D(K){if(M(K)||K==="")return null;if(typeof K=="boolean")return K;if(typeof K=="number")return K!==0;const I=String(K).trim().toLowerCase();return I==="true"||I==="yes"||I==="y"||I==="1"?!0:I==="false"||I==="no"||I==="n"||I==="0"?!1:null}function Z(K,I){const G=K||{},H=G.display||"text",S=G.trueLabel??"Yes",O=G.falseLabel??"No",b=G.nullLabel??"";let c=S,f=O;const o=b;H==="checkbox"?(c=X.true,f=X.false):H==="switch"?(c=B.true,f=B.false):H==="icon"&&(c=G.trueIcon??S,f=G.falseIcon??O);const n=t=>{const i=D(t);return i===null?o:i?c:f};return n.display=H,n.labels={true:S,false:O,null:b},n.locale=I,n.spec=G,n}}),De("packages/core/src/format/text.js",function(e,U){"use strict";Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return D}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/internal/text.js").titleCase;function D(Z,K){const I=Z||{},G=I.locale||K||void 0,H=I.nullDisplay??"",S=I.emptyDisplay??"",O=I.transform||"none",b=typeof I.truncate=="number"?{chars:I.truncate}:I.truncate||null,c=b?b.chars:0,f=b?b.ellipsis??"…":"",o=t=>{switch(O){case"upper":return G?t.toLocaleUpperCase(G):t.toUpperCase();case"lower":return G?t.toLocaleLowerCase(G):t.toLowerCase();case"title":return B(t);default:return t}},n=t=>{if(M(t))return H;let i=typeof t=="string"?t:String(t);return i===""?S:(O!=="none"&&(i=o(i)),c>0&&i.length>c&&(i=i.slice(0,c)+f),i)};return n.spec=I,n}}),De("packages/core/src/format/shorthand.js",function(e,U){"use strict";Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return K}});const te=["currency","number","percent","date","boolean","text","relative"],M=/[#0?@;"\\]/,X=/(yyyy|yy|MMMM|MMM|MM|EEEE|EEE|dd|HH|hh|mm|ss|SSS)/;function B(I){return typeof I!="string"||I===""||Z(I)?!1:M.test(I)}function D(I){return typeof I!="string"||I===""||Z(I)?!1:X.test(I)}function Z(I){const G=I.indexOf(":"),H=G===-1?I:I.slice(0,G);return te.includes(H)?H:null}function K(I){const G=Z(I);if(!G)return null;const H=I.indexOf(":"),S=H===-1?"":I.slice(H+1),O=S===""?[]:S.split(":");switch(G){case"currency":{const b={type:"number",style:"currency",currency:O[0]||"USD"};return O[1]!==void 0&&O[1]!==""&&(b.decimals=Number(O[1])),b}case"number":{const b={type:"number",style:"decimal"};return O[0]!==void 0&&O[0]!==""&&(b.decimals=Number(O[0])),b}case"percent":{const b={type:"number",style:"percent"};return O[0]!==void 0&&O[0]!==""&&(b.decimals=Number(O[0])),b}case"date":return{type:"date",pattern:S||void 0};case"relative":return{type:"date",relative:!0};case"boolean":{const b=S.split("/"),c={type:"boolean",display:"text"};return b[0]!==void 0&&b[0]!==""&&(c.trueLabel=b[0]),b[1]!==void 0&&b[1]!==""&&(c.falseLabel=b[1]),b[2]!==void 0&&(c.nullLabel=b[2]),c}case"text":{const b={type:"text"};return O[0]&&(b.transform=O[0]),O[1]!==void 0&&O[1]!==""&&(b.truncate=Number(O[1])),b}default:return null}}}),De("packages/core/src/format/index.js",function(e,U){"use strict";Object.defineProperty(e,"compileFormat",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"specToOoxml",{enumerable:!0,get:function(){return w}});const te=U("packages/core/src/internal/predicates.js"),M=te.isFunction,X=te.isObject,D=U("packages/core/src/internal/warn.js").warnOnce,Z=U("packages/core/src/format/number.js"),K=Z.compileNumber,I=U("packages/core/src/format/date.js"),G=I.compileDate,H=I.scanPattern,S=U("packages/core/src/format/boolean.js"),O=S.compileBoolean,b=U("packages/core/src/format/text.js"),c=b.compileText,f=U("packages/core/src/format/mask.js"),o=f.compileMask,n=U("packages/core/src/format/shorthand.js"),t=n.parseShorthand,i=n.looksLikeMask,s=n.looksLikeDatePattern,u=U("packages/core/src/format/pattern.js").parseNumberPattern;Object.defineProperty(e,"compileNumber",{enumerable:!0,get:function(){return Z.compileNumber}}),Object.defineProperty(e,"compileDate",{enumerable:!0,get:function(){return I.compileDate}}),Object.defineProperty(e,"compilePattern",{enumerable:!0,get:function(){return I.compilePattern}}),Object.defineProperty(e,"scanPattern",{enumerable:!0,get:function(){return I.scanPattern}}),Object.defineProperty(e,"toDate",{enumerable:!0,get:function(){return I.toDate}}),Object.defineProperty(e,"compileBoolean",{enumerable:!0,get:function(){return S.compileBoolean}}),Object.defineProperty(e,"toTriState",{enumerable:!0,get:function(){return S.toTriState}}),Object.defineProperty(e,"compileText",{enumerable:!0,get:function(){return b.compileText}}),Object.defineProperty(e,"compileMask",{enumerable:!0,get:function(){return f.compileMask}}),Object.defineProperty(e,"splitSections",{enumerable:!0,get:function(){return f.splitSections}}),Object.defineProperty(e,"parseSection",{enumerable:!0,get:function(){return f.parseSection}}),Object.defineProperty(e,"parseShorthand",{enumerable:!0,get:function(){return n.parseShorthand}}),Object.defineProperty(e,"looksLikeMask",{enumerable:!0,get:function(){return n.looksLikeMask}}),Object.defineProperty(e,"looksLikeDatePattern",{enumerable:!0,get:function(){return n.looksLikeDatePattern}});const a=new Set(["decimal","currency","percent","unit"]),l=new Set(["type","locale"]),h={number:new Set(["style","currency","currencyDisplay","decimals","minDecimals","maxDecimals","thousandsSeparator","decimalSeparator","notation","compactDisplay","negative","negativeClass","signed","prefix","suffix","zeroDisplay","nullDisplay","messages","scale","pattern"]),date:new Set(["pattern","dateStyle","timeStyle","timeZone","relative","nullDisplay"]),boolean:new Set(["display","trueLabel","falseLabel","nullLabel","trueIcon","falseIcon"]),text:new Set(["transform","truncate","nullDisplay","emptyDisplay"])},y=new Set(["number","date","boolean","text"]);function m(_,F){const L=_.type;if(L===void 0||y.has(L)||!a.has(String(L)))return;const j=F?`"${F}"`:"with no id";D(`format:unknown-style-key:${F||""}:${L}`,`column ${j} has format: { type: "${L}" }, which is not a valid format type ("number", "date", "boolean" or "text") and is ignored; did you mean style: "${L}" instead?`)}function v(_,F,L){const j=h[F],R=L?`"${L}"`:"with no id";for(const $ of _){if(l.has($)||j.has($))continue;const T=Object.keys(h).find(A=>A!==F&&h[A].has($));T?D(`format:inapplicable:${L||""}:${$}`,`column ${R} has format key "${$}", which applies to a ${T} column, not the ${F} column it was applied to; it is ignored.`):D(`format:unknown:${L||""}:${$}`,`column ${R} has an unrecognised format key "${$}" for its ${F} format; it is ignored.`)}}function d(_){if(_.type==="number"||_.type==="date"||_.type==="boolean"||_.type==="text")return!0;const F=a.has(String(_.style));return!!(_.pattern||_.dateStyle||_.timeStyle||_.relative||_.timeZone||_.trueLabel||_.falseLabel||_.display||_.trueIcon||_.falseIcon||_.transform||_.truncate||_.emptyDisplay||F||_.currency||_.decimals!==void 0||_.minDecimals!==void 0||_.maxDecimals!==void 0||_.notation||_.negative||_.scale!==void 0||_.prefix||_.suffix||_.zeroDisplay!==void 0)}function p(_,F){if(_.type==="number"||_.type==="date"||_.type==="boolean"||_.type==="text")return _.type;if(_.pattern){if(i(_.pattern))return"number";if(s(_.pattern))return"date"}if(_.dateStyle||_.timeStyle||_.relative||_.timeZone)return"date";if(_.trueLabel||_.falseLabel||_.display||_.trueIcon||_.falseIcon)return"boolean";if(_.transform||_.truncate||_.emptyDisplay)return"text";if(_.style||_.currency||_.decimals!==void 0||_.minDecimals!==void 0||_.maxDecimals!==void 0||_.notation||_.negative||_.scale!==void 0||_.prefix||_.suffix||_.zeroDisplay!==void 0)return"number";const L=F&&F.base;return L==="number"?"number":L==="date"||L==="dateString"?"date":L==="boolean"?"boolean":"text"}function g(_,F=null,L=void 0,j=void 0,R=void 0){if(_==null||_==="")return null;const $=X(_)?Object.keys(_):null;if(typeof _=="function"){const C=(z,Y)=>String(_({...Y||{},value:z,locale:L})??"");return C.ooxml=F&&F.excel||"General",C}if(typeof _=="string"){if(i(_)){const{format:z,ooxml:Y}=o(_,L);return z.ooxml=Y,z}const C=t(_)||(s(_)?{type:"date",pattern:_}:null);return C?g(C,F,L,j,R):(D(`format:${_}`,`unrecognised format string "${_}"; the value will be stringified`),null)}if(!X(_))return D("format:shape","format must be a spec object or a string; ignoring",_),null;if(F&&M(F.format)&&!d(_)||F&&M(F.format)&&Array.isArray(F.formatPatterns)&&_.type===void 0)return null;const T=p(_,F);T==="date"&&j&&_.timeZone===void 0&&(_={..._,timeZone:j}),m(_,R),v($||Object.keys(_),T,R);let A;switch(T){case"number":A=K(_,L);break;case"date":A=G(_,L);break;case"boolean":A=O(_,L);break;default:A=c(_,L);break}return A.ooxml=w(_,T,L,F),A.kind=T,A}const k={yyyy:"yyyy",yy:"yy",MMMM:"mmmm",MMM:"mmm",MM:"mm",M:"m",dd:"dd",d:"d",EEEE:"dddd",EEE:"ddd",HH:"hh",H:"h",hh:"hh",h:"h",mm:"mm",m:"m",ss:"ss",s:"s",SSS:"000",a:"AM/PM"};function w(_,F,L=void 0,j=null){if(F==="date"){if(_.pattern){let C="";for(const z of H(_.pattern))C+=z.token?k[z.token]??z.text:z.text;return C}return j&&j.excel||"yyyy-mm-dd"}if(F==="boolean")return"General";if(F==="text")return"@";if(typeof _.pattern=="string"&&u(_.pattern))return String(_.pattern).trim();if(_.notation==="compact"||_.notation==="scientific")return"General";const R=typeof _.decimals=="number"?_.decimals:typeof _.minDecimals=="number"?_.minDecimals:_.style==="currency"?2:0;let T=`${_.thousandsSeparator===!1?"":"#,#"}#0${R>0?`.${"0".repeat(R)}`:""}`,A="";return _.style==="currency"&&(A+=E(x(_.currency||"USD",L))),_.prefix&&(A+=E(_.prefix)),T=A+T,_.style==="percent"&&(T=`${T}%`),_.suffix&&(T+=E(_.suffix)),_.negative==="parentheses"?`${T};(${T})`:_.negative==="suffix"?`${T};${T}-`:T}function E(_){return`"${String(_).split('"').join("")}"`}const N=new Map;function x(_,F){const L=`${_}|${F||""}`;let j=N.get(L);if(j!==void 0)return j;j=_;try{const $=new Intl.NumberFormat(F,{style:"currency",currency:_}).formatToParts(0).find(T=>T.type==="currency");$&&(j=$.value)}catch{}return N.set(L,j),j}}),De("packages/core/src/columns/types/temporal.js",function(e,U){"use strict";Object.defineProperty(e,"MS_SECOND",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"MS_MINUTE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"MS_HOUR",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MS_DAY",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MS_WEEK",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toTimeMs",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"zonedParts",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"zoneOffsetAt",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"instantFromParts",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"toEpochMs",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"toDurationMs",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return de}}),Object.defineProperty(e,"zoneAbbrev",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"resolveZoneName",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"zoneLabel",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"formatInstant",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"bucketInstant",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"timestampGroupProjector",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"TEMPORAL_INFERENCE_ORDER",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Ye}});const te=U("packages/core/src/internal/predicates.js"),M=te.isNil,X=te.isFunction,B=U("packages/core/src/format/date.js"),D=B.toDate,Z=B.compilePattern,K=B.compileDate,I=B.toIsoDateTime,G=B.compareIso,H=864e5,S=Object.freeze({}),O=1e3,b=60*O,c=60*b,f=24*c,o=7*f,n=new WeakMap;function t(Ae,Ve){const Pe=Ae&&Ae.locale||"",Oe=Ae&&Ae.column;if(!Oe)return Pe?{locale:Pe}:S;const He=n.get(Oe);if(He&&He.locale===Pe)return He.bag;const Ke=Oe.typeOptions||Oe[Ve]||(i(Oe.format)?Oe.format:null),Xe={...Ke||S,locale:Ke&&Ke.locale||Pe||void 0};return n.set(Oe,{locale:Pe,bag:Xe}),Xe}function i(Ae){return Ae!==null&&typeof Ae=="object"&&!Array.isArray(Ae)&&!(Ae instanceof Date)}function s(Ae,Ve){const Pe=Ae===null||Number.isNaN(Ae)?null:Ae,Oe=Ve===null||Number.isNaN(Ve)?null:Ve;return Pe===null?Oe===null?0:1:Oe===null||Pe<Oe?-1:Pe>Oe?1:0}const r=/^(\d{1,2})(?:\s*[:.h]\s*(\d{1,2})(?:\s*[:.]\s*(\d{1,2})(?:[.,](\d{1,3}))?)?)?\s*(a\.?m\.?|p\.?m\.?|a|p)?$/i,u=/^(\d{3,6})$/;function a(Ae,Ve,Pe,Oe){return!(Ae>=0&&Ae<=23)||!(Ve>=0&&Ve<=59)||!(Pe>=0&&Pe<=59)||!(Oe>=0&&Oe<=999)?null:Ae*c+Ve*b+Pe*O+Oe}function l(Ae){if(M(Ae))return null;const Ve=String(Ae).trim();if(Ve==="")return null;const Pe=u.exec(Ve);if(Pe){const wt=Pe[1];if(wt.length===5)return null;const pt=wt.length===3?1:2;return a(Number(wt.slice(0,pt)),Number(wt.slice(pt,pt+2)),Number(wt.slice(pt+2,pt+4)||0),0)}const Oe=r.exec(Ve);if(!Oe)return null;let He=Number(Oe[1]);const Ke=Number(Oe[2]||0),Xe=Number(Oe[3]||0),nt=Oe[4]?Number(Oe[4].padEnd(3,"0")):0,st=Oe[5]?Oe[5][0].toLowerCase():null;if(st){if(He<1||He>12)return null;He=He%12,st==="p"&&(He+=12)}return a(He,Ke,Xe,nt)}function h(Ae){return M(Ae)||Ae===""?null:typeof Ae=="number"?Number.isFinite(Ae)?(Ae%f+f)%f:null:Ae instanceof Date?Number.isNaN(Ae.getTime())?null:Ae.getHours()*c+Ae.getMinutes()*b+Ae.getSeconds()*O+Ae.getMilliseconds():l(Ae)}const y=new Map;function m(Ae){const Ve=Ae.pattern||"",Pe=Ae.timeStyle||(Ae.seconds?"medium":"short"),Oe=`${Ae.locale||""}|${Ve}|${Pe}`;let He=y.get(Oe);if(He)return He;if(Ve)He=Z(Ve,Ae.locale||void 0,"UTC");else{const Ke=new Intl.DateTimeFormat(Ae.locale||void 0,{timeStyle:Pe,timeZone:"UTC"});He=Xe=>Ke.format(Xe)}return y.set(Oe,He),He}function v(Ae,Ve){const Pe=Ve||S;if(Ae==null||typeof Ae!="number"||!Number.isFinite(Ae))return Pe.nullDisplay??"";const Oe=(Ae%f+f)%f;return m(Pe)(new Date(Oe))}function d(Ae){return Ae instanceof Date?!Number.isNaN(Ae.getTime()):typeof Ae=="number"?Number.isFinite(Ae)&&Ae>=0&&Ae<f:typeof Ae!="string"||!Ae.includes(":")?!1:l(Ae)!==null}function p(Ae){const Ve=h(Ae);return Ve==null?"":v(Ve,{pattern:Ve%O===0?"HH:mm:ss":"HH:mm:ss.SSS"})}const g=new Map;function k(Ae){const Ve=Ae||"";let Pe=g.get(Ve);return Pe||(Pe=new Intl.DateTimeFormat("en-GB",{timeZone:Ae||void 0,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}),g.set(Ve,Pe)),Pe}function w(Ae,Ve){const Pe={year:1970,month:1,day:1,hour:0,minute:0,second:0};for(const Oe of k(Ve).formatToParts(new Date(Ae)))Oe.type==="year"?Pe.year=Number(Oe.value):Oe.type==="month"?Pe.month=Number(Oe.value):Oe.type==="day"?Pe.day=Number(Oe.value):Oe.type==="hour"?Pe.hour=Number(Oe.value)%24:Oe.type==="minute"?Pe.minute=Number(Oe.value):Oe.type==="second"&&(Pe.second=Number(Oe.value));return Pe}function E(Ae,Ve){const Pe=w(Ae,Ve);return Date.UTC(Pe.year,Pe.month-1,Pe.day,Pe.hour,Pe.minute,Pe.second,0)-Math.floor(Ae/1e3)*1e3}function N(Ae,Ve){const Pe=Ae.hour||0,Oe=Ae.minute||0,He=Ae.second||0,Ke=Ae.ms||0;if(!Ve)return new Date(Ae.year,Ae.month-1,Ae.day,Pe,Oe,He,Ke).getTime();const Xe=Date.UTC(Ae.year,Ae.month-1,Ae.day,Pe,Oe,He,Ke);let nt=Xe-E(Xe,Ve);return nt=Xe-E(nt,Ve),nt}const x=/(?:Z|[+-]\d{2}:?\d{2})$/i,_=/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s]+(.*))?$/;function F(Ae,Ve){if(M(Ae))return null;const Pe=String(Ae).trim();if(Pe==="")return null;const Oe=Ve&&Ve.timeZone||void 0;if(!x.test(Pe)){const He=_.exec(Pe);if(He){const Ke=(He[4]||"").trim(),Xe=Ke===""?0:l(Ke);if(Xe===null)return null;const nt=N({year:Number(He[1]),month:Number(He[2]),day:Number(He[3]),hour:Math.floor(Xe/c),minute:Math.floor(Xe/b)%60,second:Math.floor(Xe/O)%60,ms:Xe%O},Oe);return Number.isNaN(nt)?null:new Date(nt)}}return D(Pe)}function L(Ae){if(typeof Ae=="number")return Number.isFinite(Ae)?Ae:null;const Ve=D(Ae);return Ve?Ve.getTime():null}const j=new Map;function R(Ae){const Ve=[Ae.locale||"",Ae.pattern||"",Ae.dateStyle||"",Ae.timeStyle||"",Ae.timeZone||"",Ae.seconds?"1":""].join("|");let Pe=j.get(Ve);if(Pe)return Pe;const Oe=Ae.pattern?{type:"date",pattern:Ae.pattern,timeZone:Ae.timeZone}:{type:"date",dateStyle:Ae.dateStyle||"medium",timeStyle:Ae.timeStyle||(Ae.seconds?"medium":"short"),timeZone:Ae.timeZone};return Pe=K(Oe,Ae.locale||void 0),j.set(Ve,Pe),Pe}function $(Ae,Ve){const Pe=Ve||S,Oe=L(Ae);return Oe==null?Pe.nullDisplay??"":R(Pe)(Oe)}function T(Ae){return Ae instanceof Date?!Number.isNaN(Ae.getTime()):typeof Ae!="string"||!_.test(Ae.trim())?!1:F(Ae)!==null}const A=Object.freeze([{key:"w",ms:o,intl:"week",long:["week","weeks"],names:["w","wk","wks","week","weeks"]},{key:"d",ms:f,intl:"day",long:["day","days"],names:["d","dy","day","days"]},{key:"h",ms:c,intl:"hour",long:["hour","hours"],names:["h","hr","hrs","hour","hours"]},{key:"m",ms:b,intl:"minute",long:["minute","minutes"],names:["m","min","mins","minute","minutes"]},{key:"s",ms:O,intl:"second",long:["second","seconds"],names:["s","sec","secs","second","seconds"]},{key:"ms",ms:1,intl:"millisecond",long:["millisecond","milliseconds"],names:["ms","msec","msecs","milli","millis","millisecond","milliseconds"]}]),C=new Map;for(const Ae of A)for(const Ve of Ae.names)C.set(Ve,Ae);const z=Object.freeze(A.filter(Ae=>Ae.key!=="w")),Y=/^(\d+(?:\.\d+)?)\s*([a-z]+)\s*(?:,\s*)?/,q=/^\d+(?:\.\d+)?$/,V=/^(\d+):([0-5]?\d)(?::([0-5]?\d))?(?:\.(\d{1,3}))?$/;function J(Ae){const Ve=Ae&&Ae.defaultUnit?C.get(String(Ae.defaultUnit).toLowerCase()):null;return Ve?Ve.ms:b}function ee(Ae){return(Ae&&Ae.defaultUnit?C.get(String(Ae.defaultUnit).toLowerCase()):null)||C.get("m")}function ne(Ae,Ve){if(M(Ae))return null;let Pe=String(Ae).trim().toLowerCase();if(Pe==="")return null;let Oe=1;if(Pe[0]==="-"?(Oe=-1,Pe=Pe.slice(1).trim()):Pe[0]==="+"&&(Pe=Pe.slice(1).trim()),Pe==="")return null;const He=V.exec(Pe);if(He){const st=He[3]!==void 0,wt=Number(He[1])*c+Number(He[2])*b+(st?Number(He[3])*O:0)+(He[4]?Number(He[4].padEnd(3,"0")):0);return Oe*wt}if(q.test(Pe))return Math.round(Oe*Number(Pe)*J(Ve||S));let Ke=Pe,Xe=0,nt=0;for(;Ke!=="";){const st=Y.exec(Ke);if(!st)return null;const wt=C.get(st[2]);if(!wt)return null;Xe+=Number(st[1])*wt.ms,Ke=Ke.slice(st[0].length),nt++}return nt===0?null:Math.round(Oe*Xe)}function oe(Ae){return M(Ae)||Ae===""?null:typeof Ae=="number"?Number.isFinite(Ae)?Ae:null:ne(Ae)}const re=new Map;function ae(Ae,Ve,Pe){const Oe=`${Pe||""}|${Ve.intl}`;let He=re.get(Oe);if(He===void 0){try{He=new Intl.NumberFormat(Pe||void 0,{style:"unit",unit:Ve.intl,unitDisplay:"long"})}catch{He=null}re.set(Oe,He)}return He?He.format(Ae):`${Ae} ${Ae===1?Ve.long[0]:Ve.long[1]}`}function fe(Ae,Ve){return String(Ae).padStart(Ve,"0")}function de(Ae,Ve){const Pe=Ve||S;if(Ae==null||typeof Ae!="number"||!Number.isFinite(Ae))return Pe.nullDisplay??"";const Oe=Pe.style||"short",He=Ae<0;let Ke=Math.round(Math.abs(Ae));const Xe=He?"-":"";if(Ke===0&&Pe.zeroDisplay!=null)return Pe.zeroDisplay;if(Oe==="clock"){const pt=Math.floor(Ke/c),St=Math.floor(Ke/b)%60,Ct=Math.floor(Ke/O)%60;return`${Xe}${fe(pt,2)}:${fe(St,2)}:${fe(Ct,2)}`}if(Ke===0){const pt=ee(Pe);return Oe==="long"?ae(0,pt,Pe.locale):`0${pt.key}`}const nt=Pe.weeks===!0?A:z,st=typeof Pe.maxUnits=="number"&&Pe.maxUnits>0?Pe.maxUnits:Pe.maxUnits===void 0?2:1/0,wt=[];for(const pt of nt){if(wt.length>=st)break;const St=Math.floor(Ke/pt.ms);St!==0&&(Ke-=St*pt.ms,wt.push(Oe==="long"?ae(St,pt,Pe.locale):`${St}${pt.key}`))}return Xe+wt.join(" ")}function ve(Ae){if(typeof Ae!="string")return!1;const Ve=Ae.trim();return Ve===""||V.test(Ve)||!/[a-z]/i.test(Ve)?!1:ne(Ve)!==null}const Ie=Date.UTC(1899,11,30),Le=new Map;function se(Ae,Ve){const Pe=Ae||"";let Oe=Le.get(Pe);Oe||(Oe=new Intl.DateTimeFormat("en-GB",{timeZone:Ae||void 0,timeZoneName:"short",hour:"2-digit",hour12:!1}),Le.set(Pe,Oe));const He=typeof Ve=="number"?Ve:Date.now();for(const Ke of Oe.formatToParts(new Date(He)))if(Ke.type==="timeZoneName")return Ke.value;return""}function pe(Ae){if(Ae)return Ae;try{return new Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function be(Ae,Ve){const Pe=pe(Ae),Oe=se(Ae,Ve);return Oe?`${Pe} (${Oe})`:Pe}function ke(Ae,Ve){if(Ae&&Ae.timeZone)return Ae.timeZone;const Pe=Ve&&Ve.grid;return(Pe&&X(Pe.get)?Pe.get("timeZone"):void 0)||void 0}function je(Ae,Ve){const Pe=Ve||S,Oe=L(Ae);if(Oe==null)return Pe.nullDisplay??"";const He=R(Pe)(Oe);if(!Pe.showOrigin)return He;const Ke=Pe.originZone;return Ke?Ke===(Pe.timeZone||pe(Pe.timeZone))?He:`${He} (${be(Ke,Oe)})`:`${He} (no origin recorded)`}function xe(Ae,Ve,Pe,Oe){if(Ve==="instant"||!Ve)return Ae;const He=w(Ae,Pe);if(Ve==="month")return N({year:He.year,month:He.month,day:1},Pe);if(Ve==="week"){const Ke=Oe>=1&&Oe<=7?Oe:1,nt=((new Date(Date.UTC(He.year,He.month-1,He.day)).getUTCDay()+6)%7+1-Ke+7)%7,st=new Date(Date.UTC(He.year,He.month-1,He.day-nt));return N({year:st.getUTCFullYear(),month:st.getUTCMonth()+1,day:st.getUTCDate()},Pe)}return N({year:He.year,month:He.month,day:He.day},Pe)}function ge(Ae,Ve){const Pe=Ae&&Ae.group,Oe=Pe&&Pe.granularity||"day";if(Oe==="instant")return null;const He=Pe&&Pe.weekStart;return Ke=>typeof Ke=="number"?xe(Ke,Oe,Ve,He):Ke}const we={time:{base:"number",storage:"float64",matches:d,format:Ae=>v(h(Ae.value),t(Ae,"time")),parse:Ae=>l(Ae.text),compare:(Ae,Ve)=>s(h(Ae),h(Ve)),defaults:{filter:"number",editor:"time",align:"start"},excel:"hh:mm:ss",excelKind:"number",toExcelValue:Ae=>{const Ve=h(Ae);return Ve===null?null:Ve/H},toStorage:Ae=>h(Ae),toClipboard:p,fromClipboard:l},datetime:{base:"dateString",storage:"dictionary",matches:T,format:Ae=>$(Ae.value,t(Ae,"datetime")),parse:Ae=>I(F(Ae.text,t(Ae,"datetime"))??Ae.text),compare:G,defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",toStorage:(Ae,Ve)=>I(Ae,Ve&&Ve.timeZone),toClipboard:Ae=>M(Ae)?"":String(Ae),fromClipboard:Ae=>I(Ae)},duration:{base:"number",storage:"float64",matches:ve,format:Ae=>de(oe(Ae.value),t(Ae,"duration")),parse:Ae=>ne(Ae.text,t(Ae,"duration")),compare:(Ae,Ve)=>s(oe(Ae),oe(Ve)),defaults:{filter:"number",editor:"duration",align:"end",total:"sum"},excel:"[h]:mm:ss",excelKind:"number",toExcelValue:Ae=>{const Ve=oe(Ae);return Ve===null?null:Ve/H},toStorage:Ae=>oe(Ae),toClipboard:Ae=>de(oe(Ae),{style:"short",maxUnits:-1}),fromClipboard:Ae=>ne(Ae)},timestamp:{base:"number",storage:"float64",format:Ae=>{const Ve=t(Ae,"timestamp");return je(Ae.value,{...Ve,timeZone:ke(Ve,Ae)})},parse:Ae=>{const Ve=t(Ae,"timestamp"),Pe=F(Ae.text,{timeZone:ke(Ve,Ae)});return Pe?Pe.getTime():null},compare:(Ae,Ve)=>s(L(Ae),L(Ve)),groupProjector:(Ae,Ve)=>ge(Ae,Ve),defaults:{filter:"date",editor:"datetime",align:"start"},excel:"yyyy-mm-dd hh:mm",excelKind:"number",toExcelValue:(Ae,Ve)=>{const Pe=L(Ae);if(Pe==null)return null;const Oe=w(Pe,Ve&&Ve.timeZone||void 0);return(Date.UTC(Oe.year,Oe.month-1,Oe.day,Oe.hour,Oe.minute,Oe.second)-Ie)/H},toStorage:Ae=>L(Ae),toClipboard:Ae=>{const Ve=L(Ae);return Ve==null?"":new Date(Ve).toISOString()},fromClipboard:Ae=>L(Ae)}},Me=["datetime","time","duration"],Ye=we}),De("packages/core/src/internal/lru.js",function(e,U){"use strict";Object.defineProperty(e,"Lru",{enumerable:!0,get:function(){return te}});class te{#e;#t=new Map;#n;constructor(X=256,B=null){this.#e=X,this.#n=B}get size(){return this.#t.size}get max(){return this.#e}set max(X){this.#e=X,this.#r()}has(X){return this.#t.has(X)}get(X){const B=this.#t;if(!B.has(X))return;const D=B.get(X);return B.delete(X),B.set(X,D),D}peek(X){return this.#t.get(X)}set(X,B){const D=this.#t;return D.has(X)&&D.delete(X),D.set(X,B),this.#r(),B}delete(X){const B=this.#t.get(X);return this.#t.delete(X)&&this.#n&&this.#n(B,X),B}clear(){if(this.#n)for(const[X,B]of this.#t)this.#n(B,X);this.#t.clear()}keys(){return this.#t.keys()}values(){return this.#t.values()}#r(){const X=this.#t;for(;X.size>this.#e;){const B=X.keys().next().value,D=X.get(B);X.delete(B),this.#n&&this.#n(D,B)}}}}),De("packages/core/src/columns/types/network.js",function(e,U){"use strict";Object.defineProperty(e,"toUint32",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"isIpv4",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"compareIpv4",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"packCidr",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"cidrParts",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isCidr",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"compareCidr",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"netmask",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"addressCount",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"ipv6Groups",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"isIpv6",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"compareIpv6",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return L}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/internal/lru.js").Lru,D=4294967295,Z=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function K(j){if(M(j))return null;if(typeof j=="string")return I(j);const R=Number(j);return Number.isFinite(R)?R<0?R<-2147483648?null:R>>>0:R>D?null:Math.trunc(R)>>>0:null}function I(j){if(M(j))return null;const R=String(j).trim();if(R==="")return null;const $=Z.exec(R);if(!$)return null;let T=0;for(let A=1;A<=4;A++){const C=$[A];if(C.length>1&&C.charCodeAt(0)===48)return null;const z=Number(C);if(z>255)return null;T=T*256+z}return T}function G(j){const R=K(j);return R===null?"":`${R>>>24&255}.${R>>>16&255}.${R>>>8&255}.${R&255}`}function H(j){return typeof j=="string"&&I(j)!==null}function S(j,R){const $=K(j),T=K(R);return $===null?T===null?0:1:T===null||$<T?-1:$>T?1:0}const O=64,b=D*O+32,c=/^(?:0|[1-9]\d?)$/;function f(j,R){return j*O+R}function o(j){if(M(j))return null;if(typeof j=="string"){const T=n(j);return T===null?null:o(T)}if(typeof j=="object"){const T=K(j.address),A=Number(j.prefix);return T===null||!Number.isInteger(A)||A<0||A>32?null:{address:T,prefix:A}}const R=Number(j);if(!Number.isInteger(R)||R<0||R>b)return null;const $=R%O;return $>32?null:{address:(R-$)/O,prefix:$}}function n(j){if(M(j))return null;const R=String(j).trim();if(R==="")return null;const $=R.indexOf("/");if($<0)return null;const T=I(R.slice(0,$));if(T===null)return null;const A=R.slice($+1).trim();if(!c.test(A))return null;const C=Number(A);return C>32?null:f(T,C)}function t(j){const R=o(j);return R?`${G(R.address)}/${R.prefix}`:""}function i(j){return typeof j=="string"&&n(j)!==null}function s(j,R){const $=o(j),T=o(R);return $?T?$.address!==T.address?$.address<T.address?-1:1:$.prefix-T.prefix:-1:T?1:0}function r(j){return j===0?0:4294967295<<32-j>>>0}function u(j){const R=o(j);return R?(R.address&r(R.prefix))>>>0:null}function a(j){const R=o(j);return R?(R.address&r(R.prefix)|~r(R.prefix)>>>0)>>>0:null}function l(j){const R=o(j);return R?2**(32-R.prefix):null}function h(j){const R=o(j);return R?R.prefix===32?1:R.prefix===31?2:2**(32-R.prefix)-2:null}function y(j,R){const $=o(j);if(!$)return!1;const T=K(R);if(T===null)return!1;const A=r($.prefix);return(T&A)>>>0===($.address&A)>>>0}function m(j,R){const $=u(j),T=u(R);return $===null||T===null?!1:$<=a(R)&&T<=a(j)}const v=/^[0-9a-fA-F]{1,4}$/,d=new B(512);function p(j){if(M(j))return null;let R=String(j).trim();if(R==="")return null;const $=R.indexOf("%");if($>=0&&(R=R.slice(0,$)),R==="")return null;if(R.indexOf(".")>=0){const q=R.lastIndexOf(":");if(q<0)return null;const V=I(R.slice(q+1));if(V===null)return null;R=`${R.slice(0,q+1)}${(V>>>16&65535).toString(16)}:${(V&65535).toString(16)}`}const T=R.split("::");if(T.length>2)return null;const A=g(T[0]);if(A===null)return null;if(T.length===1)return A.length===8?A:null;const C=g(T[1]);if(C===null)return null;const z=8-A.length-C.length;if(z<1)return null;const Y=A.slice();for(let q=0;q<z;q++)Y.push(0);for(const q of C)Y.push(q);return Y}function g(j){if(j==="")return[];const R=[];for(const $ of j.split(":")){if(!v.test($))return null;R.push(parseInt($,16))}return R}function k(j){if(typeof j!="string")return p(j);if(d.has(j))return d.get(j);const R=p(j);return d.set(j,R),R}function w(j){if(j[0]===0&&j[1]===0&&j[2]===0&&j[3]===0&&j[4]===0&&j[5]===65535)return`::ffff:${G((j[6]<<16|j[7])>>>0)}`;let R=-1,$=0,T=-1,A=0;for(let Y=0;Y<8;Y++)j[Y]===0?(T<0?(T=Y,A=1):A++,A>$&&($=A,R=T)):(T=-1,A=0);if($<2)return j.map(Y=>Y.toString(16)).join(":");const C=j.slice(0,R).map(Y=>Y.toString(16)).join(":"),z=j.slice(R+$).map(Y=>Y.toString(16)).join(":");return`${C}::${z}`}function E(j){const R=p(j);return R===null?null:w(R)}function N(j){return E(j)??""}function x(j){return typeof j=="string"&&j.indexOf(":")>=0&&p(j)!==null}function _(j,R){const $=k(j),T=k(R);if(!$)return T?1:0;if(!T)return-1;for(let A=0;A<8;A++)if($[A]!==T[A])return $[A]<T[A]?-1:1;return 0}const F=Object.freeze({ipv4:{base:"number",storage:"int32",unsignedInt32:!0,matches:H,parse:j=>I(j.text),compare:S,format:j=>G(j.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:j=>K(j),toClipboard:j=>G(j),fromClipboard:j=>I(j)},cidr:{base:"number",storage:"float64",matches:i,parse:j=>n(j.text),compare:s,format:j=>t(j.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",excelKind:"string",toStorage:j=>{const R=o(j);return R===null?null:f(R.address,R.prefix)},toClipboard:j=>t(j),fromClipboard:j=>n(j)},ipv6:{base:"text",storage:"dictionary",matches:x,parse:j=>E(j.text),compare:_,format:j=>N(j.value),defaults:{filter:"text",editor:"ipaddress",align:"start"},excel:"@",toStorage:j=>E(j),toClipboard:j=>N(j),fromClipboard:j=>E(j)}}),L=F}),De("packages/core/src/i18n/catalogue.js",function(e,U){"use strict";Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return B}});const M=U("packages/core/src/registry/free-tier-notice.js").FREE_TIER_NOTICE,X=Object.freeze({"count.rows":{one:"{count} row",other:"{count} rows"},"count.comments":{one:"{count} comment",other:"{count} comments"},"comments.someUnresolved":"{comments}, {unresolved} unresolved","comments.allResolved":"{comments}, all resolved","count.unresolvedComments":{one:"{count} unresolved comment",other:"{count} unresolved comments"},"count.items":{one:"{count} item",other:"{count} items"},"count.keys":{one:"{count} key",other:"{count} keys"},"count.values":{one:"value",other:"values"},"count.waiting":{one:"{count} waiting",other:"{count} waiting"},"count.rowsAdded":{one:"{count} row added",other:"{count} rows added"},"count.rowsRemoved":{one:"{count} row removed",other:"{count} rows removed"},"value.empty":"empty","a11y.sort.cleared":"Sort cleared","a11y.sort.by":"Sorted by {columns}","a11y.sort.column":"{column} {direction}","a11y.sort.ascending":"ascending","a11y.sort.descending":"descending","a11y.filter.cleared":"Filter cleared, {rows}","a11y.filter.applied":"Filtered to {shown} of {total}","a11y.find.count":{one:"{current} of {count} match",other:"{current} of {count} matches"},"a11y.find.countLoaded":{one:"{current} of {count} match in loaded rows",other:"{current} of {count} matches in loaded rows"},"a11y.find.none":"No matches","a11y.find.noneLoaded":"No matches in loaded rows","a11y.selection.cleared":"Selection cleared","a11y.selection.count":{one:"{count} row selected",other:"{count} rows selected"},"tabs.tablist":"Tabs","a11y.tabs.selected":"{label} tab selected","a11y.scrollbar.horizontal":"Horizontal scrollbar","a11y.scrollbar.vertical":"Vertical scrollbar","designer.canvas":"Dashboard canvas","designer.chrome":"Designer tools","designer.page":"Page {n}","a11y.designer.edit":"Edit mode","a11y.designer.view":"View mode","layout.region":"Dashboard layout","layout.move":"Move {title}","layout.resize":"Resize {title}","layout.close":"Close {title}","a11y.layout.grabbed":"{title} grabbed, column {x} of {columns}, row {y}","a11y.layout.position":"{title}, column {x} of {columns}, row {y}","a11y.layout.dropped":"{title} dropped, column {x} of {columns}, row {y}","a11y.layout.cancelled":"{title} move cancelled","a11y.layout.resizeCancelled":"{title} resize cancelled","a11y.layout.reverted":"{title} returned to column {x}, row {y}","a11y.layout.resizeGrabbed":"{title} resize grabbed, {w} by {h} cells","a11y.layout.resizeStep":"{title}, {w} by {h} cells","a11y.layout.resized":"{title} resized to {w} by {h} cells","a11y.layout.closed":"{title} closed","layout.maximise":"Maximise {title}","layout.minimise":"Minimise {title}","layout.restore":"Restore {title}","a11y.layout.maximised":"{title} maximised, filling the dashboard; press Escape to restore it","a11y.layout.minimised":"{title} minimised","a11y.layout.restored":"{title} restored to column {x}, row {y}","a11y.group.cleared":"Grouping cleared","a11y.group.by":"Grouped by {columns}","a11y.group.expanded":"{label} expanded, {rows} shown","a11y.group.collapsed":"{label} collapsed, {rows} shown","a11y.page.position":"Page {page} of {pages}","a11y.updates.paused":"Updates paused","a11y.updates.resumed":"Updates resumed","a11y.edit.refusedOne":"Edit to {column} was refused and put back to {value}{reason}","a11y.edit.refusedMany":{one:"{count} edit was refused and put back{reason}",other:"{count} edits were refused and put back{reason}"},"a11y.edit.reason":", {reason}","a11y.history.undo":"Undid {label}","a11y.history.redo":"Redid {label}","a11y.history.undoLast":"Undid the last change","a11y.history.redoLast":"Redid the last change","a11y.column.cannotResize":"{column} cannot be resized","a11y.column.resized":"{column} is {width} pixels wide","a11y.column.atMinimum":"{column} is at its narrowest, {width} pixels","a11y.column.atMaximum":"{column} is at its widest, {width} pixels","a11y.column.cannotMove":"{column} cannot be moved","a11y.column.alreadyFirst":"{column} is already first in its group","a11y.column.alreadyLast":"{column} is already last in its group","a11y.column.cannotMoveThere":"{column} cannot be moved there","a11y.column.moved":"{column} moved to position {at} of {of}","a11y.group.formed":"{column} grouped with {other} in a new band","a11y.group.dissolved":"band {group} dissolved","a11y.group.renamed":"band renamed to {group}","a11y.group.moved":"band {group} moved to position {at} of {of}","a11y.column.addedToGroup":"{column} added to band {group}","a11y.column.removedFromGroup":"{column} removed from its band","a11y.column.notInGroup":"{column} is not in a band","a11y.column.cannotGroup":"{column} cannot be grouped","a11y.group.cannotMove":"band {group} cannot be moved there","columngroup.newGroup":"New group","columngroup.rename":"Rename band","columngroup.dissolve":"Dissolve band","columngroup.group":"Group with adjacent column","columngroup.untitled":"Untitled band","panel.bandCollapse":"Collapse band {band}","panel.bandExpand":"Expand band {band}","panel.bandVisible":"Show or hide every column in band {band}","panel.bandRenameFor":"Rename band {band}","panel.bandDissolveFor":"Dissolve band {band}","header.filter":"Filter {column}","header.menu":"Column menu for {column}","header.toggleGroup":"Toggle {group}","header.dragHint":"Drag {column} to reorder, or onto another column to group","header.dragRole":"draggable column header","header.group":"group","header.selectAllRows":"Select all rows","header.clearSelection":"Clear selection","cell.selectRow":"Select row","cell.detail.show":"Show detail","cell.detail.hide":"Hide detail","cell.detail.showInPane":"Show in the detail pane","cell.detail.showingInPane":"Showing in the detail pane","cell.group.expand":"Expand","cell.group.collapse":"Collapse","cell.delta.up":"up","cell.delta.down":"down","cell.delta.unchanged":"unchanged","cell.delta.moved":"{direction} {magnitude}","cell.delta.describedUnchanged":"{label}, unchanged","cell.delta.described":"{label}, {direction} by {magnitude}","cell.qr.of":"QR code for {text}","cell.qr.empty":"No QR code","cell.barcode.of":"Barcode for {text}","cell.barcode.empty":"No barcode","cell.barcode.invalid":"Invalid value for this barcode","cell.rating.of":"{rating} of {max}","cell.rating.empty":"Not rated","cell.stage.of":"Stage {current} of {total}: {label}","cell.stage.empty":"No stage","a11y.panel.cannotMove":"{column} cannot be moved","a11y.panel.alreadyFirst":"{column} is already first","a11y.panel.alreadyLast":"{column} is already last","a11y.panel.moved":"{column} moved to position {at} of {of}","a11y.panel.removedFrom":"{column} removed from {list}","a11y.panel.addedTo":"{column} added to {list}","a11y.panel.cannotAddTo":"{column} cannot be added to {list}","a11y.annotate.erased":"Annotation removed","a11y.annotate.noMarks":"No annotations to erase","a11y.annotate.focusedMark":"Mark {at} of {of} selected","a11y.annotate.confirmClear":"Clear all annotations? Choose Clear or Keep.","a11y.annotate.cleared":"All annotations cleared","a11y.range.written":{one:"{count} cell updated",other:"{count} cells updated"},"a11y.range.cleared":{one:"{count} cell cleared",other:"{count} cells cleared"},"paste.preview.title":"Review paste","paste.preview.summary":{one:"{changes} cell will change, {rejected} rejected.",other:"{changes} cells will change, {rejected} rejected."},"paste.preview.changesHeading":{one:"{count} change",other:"{count} changes"},"paste.preview.rejectedHeading":{one:"{count} rejected",other:"{count} rejected"},"paste.preview.colOld":"Current","paste.preview.colNew":"New","paste.preview.colCell":"Cell","paste.preview.colReason":"Reason","paste.preview.empty":"This paste would change nothing.","paste.preview.confirm":"Apply","paste.preview.cancel":"Cancel","paste.preview.reason.permission":"Not permitted","paste.preview.reason.readOnly":"Read-only","paste.preview.reason.validation":"Invalid value","paste.preview.reason.locked":"Being edited","paste.preview.reason.missing":"No such cell","a11y.paste.previewOpened":{one:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel.",other:"Paste preview: {changes} cell changes, {rejected} rejected. Review, then apply or cancel."},"a11y.paste.cancelled":"Paste cancelled; nothing changed","status.total":"{rows}","status.counting":"Counting rows…","status.shownOfTotal":"{shown} of {total}","status.selected":"{count} selected","status.selectedAcrossSource":"{count} selected across the source","status.selectedAcrossSourceCounting":"All matching rows selected, counting…","status.count":"Count {count}","status.loading":"Loading {count}…","status.loadingOf":"Loading {loaded} of {total} ({percent}%)","status.stat.sum":"Sum","status.stat.min":"Min","status.stat.max":"Max","status.stat.avg":"Avg","status.paused":"Paused","status.pausedWaiting":"Paused · {waiting}","status.coalesced":"{count} coalesced","status.hiddenComments":"{comments} on hidden rows","pagination.label":"Pagination","pagination.first":"First page","pagination.previous":"Previous page","pagination.next":"Next page","pagination.last":"Last page","pagination.page":"Page","pagination.ofPages":"of {pages}","pagination.summary":"{from}–{to} of {total}","pagination.pageSize":"Rows per page","pagination.range":"{from}–{to}","pagination.counting":"{from}–{to}, counting…","pagination.jump":"Page number, press Enter to jump","pagination.jumpBounded":"Page number, 1 to {pages}, press Enter to jump","panel.columns":"Columns","panel.filters":"Filters","panel.views":"Views","panel.quickFilter":"Quick filter","find.label":"Find in grid","find.placeholder":"Find in grid","find.next":"Next match","find.previous":"Previous match","find.close":"Close find","find.matchCase":"Match case","find.wholeCell":"Whole cell","find.columnScope":"Search in","find.allColumns":"All columns","find.count":"{current} of {total}","find.countPartial":"{current} of {total} so far","find.none":"No matches","find.searching":"Searching…","find.loadedRows":"in loaded rows","panel.formatting":"Formatting","panel.statistics":"Statistics","stat.noData":"No data","stat.tone.good":"good","stat.tone.bad":"bad","stat.tone.flat":"flat","panel.regression":"Regression","panel.compare":"Compare","panel.insights":"Insights","insights.subset":"Filtered subset vs whole","insights.dataset":"This grid vs another dataset","insights.groups":"Group comparison","insights.noFilter":"Filter the grid to compare the subset against the whole.","insights.by":"Group by","insights.test":"Test","insights.effect":"Effect size","insights.interval":"Confidence interval","insights.pValue":"p-value","insights.smallSample":"small sample — interpret with care","insights.needGroups":"Choose two columns with groups to compare.","insights.empty":"No columns to analyse.","insights.anomalies":"Anomalies","insights.anomalyCount":"{count} flagged of {n}","insights.anomalyMethod":"Method","insights.anomalyThreshold":"Threshold","anomaly.chip":"{count} anomalies flagged","anomaly.chipActive":"Showing {count} anomalies — clear","compare.first":"First column","compare.second":"Second column","compare.needTwo":"Two numeric columns are needed to compare","compare.noPairs":"No rows have a value in both","compare.pairs":"{count} pairs","compare.pearson":"Correlation (Pearson)","compare.spearman":"Rank correlation (Spearman)","compare.kendall":"Kendall’s tau","compare.covariance":"Covariance","compare.slope":"Slope","compare.intercept":"Intercept","compare.r2":"R²","compare.stdError":"Standard error","compare.weighted":"Weighted average","panel.zone.group":"row groups","panel.zone.values":"values","panel.zone.pivot":"pivot columns","groupZone.label":"Row groups","groupZone.title":"Group by","groupZone.hint":"Drag a column here to group rows by its values","groupZone.chip":"{column}, group {at} of {of}","groupZone.remove":"Stop grouping by {column}","groupZone.add":"Add a group","total.sum":"Sum","total.avg":"Average","total.min":"Min","total.max":"Max","total.count":"Count","total.countValues":"Count of values","total.first":"First","total.last":"Last","total.custom":"Total","total.median":"Median","total.p25":"25th percentile","total.p75":"75th percentile","total.p90":"90th percentile","total.p95":"95th percentile","total.p99":"99th percentile","total.iqr":"Interquartile range","total.mad":"Median absolute deviation","total.variance":"Variance","total.varianceP":"Variance (population)","total.stddev":"Standard deviation","total.stddevP":"Standard deviation (population)","total.range":"Range","total.distinct":"Distinct","total.mode":"Mode","total.skewness":"Skewness","total.kurtosis":"Kurtosis","total.geomean":"Geometric mean","total.harmean":"Harmonic mean","total.sumSquares":"Sum of squares","total.weightedAvg":"Weighted average","total.argmin":"Lowest by","total.argmax":"Highest by","total.hhi":"Concentration (HHI)","total.entropy":"Entropy","total.evenness":"Evenness","total.top3Share":"Top 3 share","total.top10Share":"Top 10 share","total.gini":"Gini coefficient","total.trimmedMean":"Trimmed mean","total.winsorizedMean":"Winsorized mean","total.robustOutliers":"Outliers (robust)","total.jarqueBera":"Jarque–Bera","total.passRate":"Pass rate","total.failureCount":"Failures","stats.column":"Column","stats.choose":"Choose a column to profile","stats.noColumns":"No numeric columns to profile","stats.noValues":"Nothing numeric in this column","stats.count":"Count","stats.present":"Present","stats.missing":"Missing","stats.distinct":"Distinct","stats.min":"Minimum","stats.max":"Maximum","stats.mean":"Mean","stats.median":"Median","stats.q1":"Lower quartile","stats.q3":"Upper quartile","stats.iqr":"Interquartile range","stats.stddev":"Standard deviation","stats.outliers":"Outliers","stats.distribution":"Distribution","stats.distribution.detail":"Distribution: rows per range","stats.bin":"{count} between {from} and {to}","stats.topValues":"Top values","stats.section.shape":"Shape","stats.section.robust":"Robust","stats.section.concentration":"Concentration","stats.section.capability":"Capability","stats.cp":"Cp","stats.cpk":"Cpk","stats.pp":"Pp","stats.ppk":"Ppk","stats.outOfSpec":"Out of specification","stats.filtered":"Over the {count} filtered rows","stats.unavailable":"Not computed by the source: {stats}.","stats.unavailable.notPlain":"`{column}` is not a plain column the engine can name","stats.unavailable.where":"a `where` predicate is in force ({list}), which only the browser can run","stats.unavailable.filter":"the grid's filter did not fully push to the engine","stats.unavailable.quick":"the quick search did not push to the engine","stats.unavailable.client":'the source did not compute "{fn}" in the engine ({reason}); set the pushdown source\'s `{setting}`',"stats.unavailable.outliers":"the count of values outside Tukey's fences is not an engine aggregate","stats.unavailable.histogram":"the shape of the column is not an engine aggregate","stats.unavailable.topValues":"the source did not answer a grouped count in the engine","regression.noModel":"No model configured. Set predictors and a response on the panel.","regression.cannotFit":"The model cannot be fitted over the current rows.","regression.observations":"Fitted over {count} rows","regression.r2":"R²","regression.adjR2":"Adjusted R²","regression.coefficients":"Coefficients","regression.term":"Term","regression.estimate":"Estimate ± SE","regression.stdError":"Std error","regression.t":"t","regression.p":"p","regression.vif":"Variance inflation (VIF)","regression.heteroscedasticity":"Heteroscedasticity (Breusch–Pagan)","regression.heteroscedastic":"Heteroscedastic: BP {statistic}, p {p}","regression.homoscedastic":"No heteroscedasticity detected: BP {statistic}, p {p}","menu.sortAscending":"Sort ascending","menu.sortDescending":"Sort descending","menu.clearSort":"Clear sort","menu.groupBy":"Group by this column","menu.ungroup":"Stop grouping by this column","menu.hideColumn":"Hide column","menu.pinStart":"Pin to start","menu.pinEnd":"Pin to end","menu.unpin":"Unpin","menu.autosize":"Fit to content","ai.valuesNotAmongOptions":'{values} {shown} not among the options for "{column}"',"menu.clearCells":{one:"Clear cell",other:"Clear {count} cells"},"menu.fillDown":"Fill down","menu.copy":"Copy","menu.copyWithHeaders":"Copy with headers","menu.paste":"Paste","menu.filterEllipsis":"Filter…","menu.columnStatistics":"Column statistics","menu.pinColumn":"Pin column","menu.sizeToFit":"Size to fit content","menu.sizeAllToFit":"Size all columns to fit","menu.width":"Width","menu.narrower":"Narrower","menu.wider":"Wider","menu.moveColumn":"Move column","menu.moveLeft":"Move left","menu.moveRight":"Move right","menu.moveToStart":"Move to start","menu.moveToEnd":"Move to end","menu.unpivot":"Remove from pivot","menu.pivotBy":"Pivot by this column","menu.stopTotalling":"Stop totalling","menu.totalColumn":"Total this column","menu.aggregate":"Aggregate","menu.aggregateNone":"None","menu.aggregateGroup":"Group subtotals","menu.aggregateGrand":"Grand total","menu.aggregateSame":"Same as total","menu.redactColumn":"Redact column","menu.stopRedacting":"Stop redacting","menu.stopRedactingAll":"Stop redacting everything","menu.sortGroupsAscending":"Sort groups ascending","menu.sortGroupsDescending":"Sort groups descending","menu.filterGroups":"Filter groups…","menu.expandAll":"Expand all","menu.collapseAll":"Collapse all","menu.clearGrouping":"Clear grouping","menu.colour":"Colour","menu.importCsv":"Import rows from CSV…","import.title":"Import rows","import.clipboard":"the clipboard","import.summary":{one:"{count} row from {name}",other:"{count} rows from {name}"},"import.opened":{one:"Import preview open, {count} row",other:"Import preview open, {count} rows"},"import.done":{one:"{count} row imported",other:"{count} rows imported"},"import.confirm":"Import","import.cancel":"Cancel","import.colSource":"Column","import.colField":"Maps to","import.colType":"Type","import.skip":"— skip —","import.mapLabel":'Map "{source}" to a field',"import.modeLabel":"On import","import.sheetLabel":"Sheet","import.append":"Add to existing rows","import.replace":"Replace all rows","menu.deleteRow":{one:"Delete row",other:"Delete {count} rows"},"toolbar.undo":"Undo","toolbar.redo":"Redo","toolbar.undoLabelled":"Undo {label}","toolbar.redoLabelled":"Redo {label}","toolbar.exportCsv":"Export to CSV","toolbar.exportExcel":"Export to Excel","toolbar.clipboard":"Copy visible rows to the clipboard","toolbar.print":"Print","toolbar.pause":"Hold incoming updates","toolbar.resume":"Resume updates","toolbar.applyHeld":{one:"Apply {count} held update",other:"Apply {count} held updates"},"toolbar.restoreView":"Restore the default view","toolbar.maximiseGrid":"Maximise the grid to fill the window","toolbar.restoreSize":"Restore the grid to the page (Esc)","toolbar.annotate.pen":"Draw freehand","toolbar.annotate.arrow":"Draw an arrow","toolbar.annotate.rect":"Draw a rectangle","toolbar.annotate.highlight":"Highlight","toolbar.annotate.erase":"Erase","toolbar.annotate.clearAll":"Clear all annotations","toolbar.annotate.clearAllConfirm":"Clear","toolbar.annotate.clearAllKeep":"Keep","overlay.noRows":"No rows to show","overlay.noResults":"No rows match the current filters","overlay.loading":"Loading…","overlay.error":"Something went wrong","overlay.loadingRows":"Loading rows {from} to {to}","overlay.rowError":"Failed to load","comments.panel":"Cell comments","comments.close":"Close comments","comments.write":"Write a comment","comments.post":"Comment","comments.delete":"Delete","comments.valueMoved":"Written when the value was {was}: it is now {now}.","comments.resolve":"Resolve","comments.reopen":"Reopen","comments.loading":"Loading…","comments.empty":"No comments yet.","comments.unknownAuthor":"Unknown","comments.edited":"{time} (edited)","comments.cellTitle":"{column}: {row}","presence.hidden":{one:"{count} not in view",other:"{count} not in view"},"presence.someoneElse":"someone else","a11y.presence.refused":"This cell is being edited by {name}","presence.peer":"{name}: jump to their cursor","presence.peerIdle":"{name}, idle: jump to their cursor","presence.peerHidden":"{name}, not in the current view","facets.filter":"{column} distribution filter","header.totalOf":"{total} of {column}","diff.before":"Was: {value}","diff.empty":"(empty)","kanban.columnCards":{one:"{title}, {count} card",other:"{title}, {count} cards"},"kanban.laneCards":{one:"{lane}, {title}, {count} card",other:"{lane}, {title}, {count} cards"},"kanban.blocked":"Blocked","kanban.ready":"Ready","kanban.blockedBy":{one:"blocked by {count} card",other:"blocked by {count} cards"},"kanban.card.assignedTo":"Assigned to {names}","kanban.card.overdue":"Overdue","kanban.card.dueSoon":"Due soon","kanban.card.progress":"{percent}% complete","kanban.card.checklist":"{done} of {total} done","gantt.lag":"+{days}d","gantt.lead":"{days}d","gantt.a11y.moved":"{name} moved to {date}","gantt.a11y.day":"day {day}","gantt.a11y.resized":"{name} resized to {days} days","gantt.a11y.linkFrom":"Linking from {name}. Focus the successor and press L.","gantt.a11y.linked":"Linked {from} to {to}, finish to start.","gantt.a11y.linkCancelled":"Link cancelled.","gantt.a11y.deleted":"{name} deleted.","gantt.a11y.readOnly":"Read-only.","gantt.row.moveHandle":"Drag to reorder or re-parent {name}","gantt.a11y.rowMoved":"{name} moved.","gantt.a11y.rowReparented":"{name} moved under {parent}.","gantt.a11y.rowPromoted":"{name} moved to the top level.","gantt.a11y.rowMoveCancelled":"Move cancelled.","gantt.a11y.copied":"{count} tasks copied.","gantt.a11y.cut":"{count} tasks cut.","gantt.a11y.pasted":"{count} tasks pasted.","gantt.task.newName":"New task","gantt.a11y.taskAdded":"{name} added.","gantt.menu.addAbove":"Add task above","gantt.menu.addBelow":"Add task below","gantt.menu.addChild":"Add subtask","gantt.menu.addSuccessor":"Add successor","gantt.menu.addPredecessor":"Add predecessor","gantt.menu.toMilestone":"Convert to milestone","gantt.menu.toTask":"Convert to task","gantt.menu.delete":"Delete task","gantt.a11y.linkCycle":"Linking {from} to {to} would create a cycle; link not created.","gantt.a11y.linkCreated":"{from} linked to {to}, {type}.","gantt.a11y.linkDeleted":"Link from {from} to {to} deleted.","gantt.a11y.linkLabel":"Link, {from} to {to}, {type}","gantt.linkEditor.title":"Edit link from {from} to {to}","gantt.linkEditor.type":"Link type","gantt.linkEditor.lag":"Lag, in days","gantt.linkEditor.apply":"Apply","gantt.linkEditor.delete":"Delete link","gantt.linkEditor.cancel":"Cancel","gantt.a11y.undone":"Undone.","gantt.a11y.redone":"Redone.","gantt.a11y.nothingToUndo":"Nothing to undo.","gantt.a11y.nothingToRedo":"Nothing to redo.","gantt.workload.title":"Resource workload","gantt.workload.resource":"Resource","gantt.workload.total":"Total","gantt.workload.unassigned":"Unassigned","gantt.workload.ungrouped":"No group","gantt.workload.cell":"{hours} h from {date}","gantt.workload.over":"{hours} h from {date}, over a capacity of {capacity} h","gantt.workload.expand":"Show {name}’s tasks","gantt.workload.collapse":"Hide {name}’s tasks","gantt.workload.expandGroup":"Show the {name} group","gantt.workload.collapseGroup":"Hide the {name} group","gantt.workload.unitToggle":"Hours / % / Cost","gantt.workload.unitHours":"Showing hours","gantt.workload.unitPercent":"Showing percent of capacity","gantt.workload.unitCost":"Showing cost","gantt.workload.cellPercent":"{percent}% from {date}","gantt.workload.overPercent":"{percent}% from {date}, over capacity","gantt.workload.cellNoCapacity":"No available hours from {date}","gantt.workload.cellCost":"{cost} from {date}","gantt.workload.otherProjectLabel":"{name} (other project)","gantt.workload.external":"External booking","gantt.a11y.hoursSet":"{name}: {hours} h from {date}","gantt.a11y.hoursCleared":"{name}: no hours from {date}","gantt.a11y.hoursRefused":"{date} is not a working day; {name} was not changed.","gantt.histogram.title":"Resource histogram","gantt.histogram.tableTitle":"Resource histogram data","gantt.histogram.resource":"Resource","gantt.histogram.period":"Period","gantt.histogram.hours":"Hours","gantt.histogram.percent":"Percent of capacity","gantt.histogram.cost":"Cost","gantt.histogram.capacity":"Capacity","gantt.histogram.overAllocated":"Over-allocated","gantt.histogram.yes":"Yes","gantt.histogram.no":"No","gantt.histogram.tip":"{name}, {from} to {to}: {value}{capacity}{tasks}","gantt.histogram.tipHours":"{hours} h","gantt.histogram.tipPercent":"{percent}% of capacity","gantt.histogram.tipCost":"{cost}","gantt.histogram.tipCapacity":", capacity {hours} h","gantt.histogram.tipTasks":" ({tasks})","gantt.histogram.tipOver":", over capacity","gantt.histogram.tipNoCapacity":"no available hours","gantt.picker.title":"Assign resources to {name}","gantt.picker.open":"Edit assignments for {name}","gantt.picker.search":"Search resources","gantt.picker.list":"Resources","gantt.picker.selected":"Assigned resources","gantt.picker.load":"{load}% booked of {capacity}% over these dates","gantt.picker.none":"No matching resources","gantt.picker.units":"{name}, units in percent","gantt.picker.remove":"Remove {name}","gantt.picker.apply":"Apply","gantt.picker.cancel":"Cancel","gantt.picker.warn":"{name} would be over-allocated: {load}% booked of {capacity}%","gantt.picker.ok":"No resource would be over-allocated","gantt.picker.assign":"Assign","gantt.col.effort":"Effort","gantt.col.units":"Units","gantt.unscheduled":"Unscheduled","gantt.col.unscheduled":"Unscheduled","gantt.inactive":"Inactive","gantt.col.inactive":"Inactive","gantt.col.slack":"Slack","gantt.col.deadline":"Deadline","gantt.col.constraint":"Constraint","gantt.col.constraintDate":"Constraint date","gantt.col.earlyStart":"Early start","gantt.col.lateStart":"Late start","gantt.col.lateFinish":"Late finish","gantt.col.baselineStart":"Baseline start","gantt.col.baselineEnd":"Baseline finish","gantt.col.variance":"Variance","gantt.col.note":"Note","gantt.col.sequence":"#","gantt.col.predecessors":"Predecessors","gantt.col.successors":"Successors","gantt.link.invalid":"Cannot read “{token}” as a link. Write a task number, a type and a lag, like 3FS+2; links not changed.","gantt.link.unknownRef":"No task is numbered “{token}”; links not changed.","gantt.link.self":"“{token}” links a task to itself; links not changed.","gantt.link.duplicate":"“{token}” repeats a link already listed; links not changed.","gantt.link.cycle":"“{token}” would create a cycle; links not changed.","gantt.constraint.ASAP":"As soon as possible","gantt.constraint.MSO":"Must start on","gantt.constraint.MFO":"Must finish on","gantt.constraint.ALAP":"As late as possible","gantt.constraint.SNET":"Start no earlier than","gantt.constraint.SNLT":"Start no later than","gantt.constraint.FNET":"Finish no earlier than","gantt.constraint.FNLT":"Finish no later than","gantt.row.ancestor":"Shown because a task inside it matches the filter","gantt.progress.handle":"Drag to set the progress of {name}","gantt.a11y.progress":"{name} {percent}% complete","gantt.col.name":"Task name","gantt.col.start":"Start","gantt.col.end":"Finish","gantt.col.duration":"Duration","gantt.col.assignee":"Assignee","gantt.col.progress":"%","gantt.col.wbs":"WBS","gantt.zoom.label":"Zoom","gantt.zoom.day":"Day","gantt.zoom.week":"Week","gantt.zoom.month":"Month","gantt.zoom.quarter":"Quarter","gantt.zoom.fit":"Fit to plan","gantt.tip.range":"{from} to {to}","gantt.tip.duration":"{days}d","gantt.tip.slack":"slack {days}d","gantt.tip.effort":"{hours}h","gantt.tip.row":"{label}: {value}","gantt.tip.start":"Start","gantt.tip.end":"End","gantt.tip.date":"Date","gantt.tip.durationLabel":"Duration","gantt.tip.durationValue":"{days} days","gantt.tip.complete":"Complete","gantt.tip.effortLabel":"Effort","gantt.tip.effortValue":"{hours} h","gantt.tip.assigned":"Assigned","gantt.tip.cost":"Cost","gantt.tip.slackLabel":"Slack","gantt.tip.slackValue":"{days} days","gantt.tip.deadline":"Deadline","gantt.mode.fixedDuration":"Fixed duration","gantt.mode.fixedEffort":"Fixed effort","gantt.mode.fixedUnits":"Fixed units","gantt.scurve.spi":"SPI {index}","gantt.scurve.cpi":"CPI {index}","gantt.print.page":"Page {page} of {pages}","gantt.print.printed":"Printed {date}","gantt.dataBand.title":"Data band","gantt.dataBand.name":"Task","gantt.dataBand.resource":"Resource","gantt.dataBand.total":"Total","gantt.dataBand.unassigned":"Unassigned","gantt.dataBand.collapse":"Collapse {name}","gantt.dataBand.expand":"Expand {name}","gantt.dataBand.cell":"{name}, {date}: {value}","gantt.issues.title":"Scheduling conflicts","gantt.issues.empty":"No scheduling conflicts","gantt.issues.count":"{count} scheduling conflicts","gantt.issues.toggle":"Toggle the conflicts panel","gantt.issues.cycle":"Circular dependency: {tasks}","gantt.issues.constraint":"{task} cannot meet its {constraint} constraint of {date}","gantt.issues.lock":"{task} is locked but a dependency would move it","gantt.issues.deadline":"{task} finishes after its deadline of {date}","gantt.issues.fixRemoveLink":"Remove link","gantt.issues.fixAsap":"Set as soon as possible","gantt.issues.fixUnlock":"Unlock task","gantt.issues.fixClearDeadline":"Clear deadline","gantt.resize.startHandle":"Drag to change the start of {name}","gantt.a11y.resizedStart":"{name} start moved to {date}, now {days} days","gantt.a11y.startEdge":"Start edge can be resized: drag the left edge, or press Ctrl+Shift+Left or Right.","gantt.a11y.chain":"Dependency chain highlighted: {preds} predecessors, {succs} successors.","timeline.scrub":"Scrub through recent changes","timeline.goLive":"Go live","timeline.returnToPresent":"Return to the present","a11y.fillHandle":"Drag to fill","panel.icons":"Icons","value.tooLong":"Too long","shortcuts.title":"Keyboard shortcuts","shortcuts.close":"Close keyboard shortcuts","shortcuts.hint":"Press Escape to close.","shortcuts.or":"or","a11y.reorder.moved":"Moved to position {position} of {total}","a11y.reorder.sorted":"Rows cannot be reordered while the grid is sorted","a11y.reorder.filtered":"Rows cannot be reordered while a filter is applied","a11y.reorder.grouped":"Rows cannot be reordered while the grid is grouped","a11y.reorder.grab":"Reorder row","a11y.reorder.sortedManual":"Rows cannot be reordered while the grid is sorted. Press Alt+Shift+M, or the Manual order button in the heading, to order them by hand","a11y.reorder.groupDerived":"The row cannot join that group: the group is worked out from the value, so there is no single value to give it","a11y.reorder.groupReadOnly":"The row cannot join that group: its grouping value cannot be edited","a11y.reorder.invalid":"The row cannot join that group: the new value was not valid","a11y.reorder.vetoed":"The move was declined; the row stays where it was","a11y.reorder.vetoedBecause":"The move was declined ({reason}); the row stays where it was","a11y.reorder.refused":"The row cannot be moved there","a11y.reorder.regrouped":"Moved into {group}","a11y.rowOrder.entered":"Manual order: the rows keep their places and can be moved by hand","a11y.rowOrder.exited":"Manual order ended; the rows follow the sort","rowOrder.button":"Manual order","rowOrder.enter":"Order the rows by hand instead of by the sort","rowOrder.exit":"Return to the sorted order","a11y.transfer.moved":"Row moved to the other grid","a11y.transfer.copied":"Row copied to the other grid","a11y.transfer.refused":"That grid does not accept this row","a11y.transfer.declined":"The drop was declined; the row stays where it was","a11y.transfer.stale":"The drop target changed while it was being confirmed; the row stays where it was","shortcuts.group.grid":"In the data","shortcuts.group.header":"On a column heading","shortcuts.group.panel":"In the column list","shortcut.moveCell":"Move the focused cell","shortcut.rowEnds":"First / last cell of the row","shortcut.gridEnds":"First cell of the first row / last cell of the last row","shortcut.pageRows":"Move one viewport of rows","shortcut.nextCell":"Leave the grid for the next / previous focusable element (arrows move between cells)","shortcut.undo":"Undo the last edit, paste, fill or clear","shortcut.redo":"Redo the step that was undone","shortcut.startEdit":"Start editing the focused cell","shortcut.toggleRow":"Toggle selection of the focused row","shortcut.cancel":"Cancel the current edit or drag","shortcut.expandCollapse":"Expand / collapse a group or tree row","shortcut.focusHeader":"Move focus to the column header","shortcut.focusPanel":"Move focus to the tool panel","shortcut.contextMenu":"Open the context menu for the focused cell","shortcut.moveRow":"Move the focused row, when row reorder is enabled","shortcut.manualOrder":"Order the rows by hand, or return to the sort, when row reorder allows a manual order","shortcut.headingMove":"Move between headings","shortcut.headingEnds":"First / last heading","shortcut.headingSort":"Sort by the column, Shift to add to the sort","shortcut.headingResize":"Resize the column, Ctrl for a coarse step","shortcut.headingAutosize":"Size the column to its content","shortcut.headingReorder":"Move the column","shortcut.headingMenu":"Open the column menu","shortcut.headingExit":"Return focus to the data","shortcut.listGroup":"Group by the column, or stop grouping by it","shortcut.listValues":"Add the column to values, or take it out","shortcut.listPivot":"Pivot by the column, or stop pivoting by it","shortcut.listMove":"Move the column","shortcut.find":"Find in the grid","tags.label":"Show columns","tags.all":"All columns","tags.showing":"Showing {tag}","form.title":"Edit row","form.save":"Save","form.cancel":"Cancel","form.loading":"Loading…","form.loadFailed":"Could not load this record.","form.loadTimeout":"The record did not arrive in time.","form.retry":"Try again","form.choose":"Choose…","form.newTitle":"New row","form.createFailed":"Could not add this record.","presentation.cards":"Showing records as cards","presentation.table":"Showing records as a table","editor.format":"Format","editor.codeHint":"Tab indents · Esc cancels · Ctrl+Enter saves","editor.colours":"Colours","editor.customColour":"Custom colour","editor.hexValue":"Hex value","editor.hexPlaceholder":"#rrggbb","editor.clearColour":"Clear colour","editor.time":"Time","editor.noIcon":"No icon","editor.selectAll":"Select all","editor.passwordHint":"Enter the value twice to save it.","editor.clearRating":"Clear rating","editor.clear":"Clear","editor.value":"Value","editor.currency":"Currency","editor.richtext.formatting":"Formatting","editor.richtext.richText":"Rich text","editor.richtext.placeholder":"Start writing…","editor.richtext.linkLabel":"Link address","editor.richtext.linkPlaceholder":"https://","editor.richtext.linkAdd":"Add link","editor.richtext.bold":"Bold (Ctrl+B)","editor.richtext.italic":"Italic (Ctrl+I)","editor.richtext.underline":"Underline (Ctrl+U)","editor.richtext.strike":"Strikethrough","editor.richtext.heading":"Paragraph style","editor.richtext.alignLeft":"Align left","editor.richtext.alignCenter":"Align centre","editor.richtext.alignRight":"Align right","editor.richtext.ul":"Bulleted list","editor.richtext.ol":"Numbered list","editor.richtext.color":"Text colour","editor.richtext.link":"Link (Ctrl+K)","editor.richtext.image":"Insert image","editor.richtext.clear":"Clear formatting","editor.richtext.source":"HTML source","editor.richtext.undo":"Undo (Ctrl+Z)","editor.richtext.redo":"Redo (Ctrl+Y)","formatting.format":"Format","formatting.noRules":"No rules yet. The first one that matches a cell wins.","formatting.clearAll":"Clear all","formatting.addRule":"Add rule","formatting.condition":"Condition","formatting.value":"Value","formatting.secondValue":"Second value","formatting.moveEarlier":"Move earlier","formatting.moveLater":"Move later","formatting.ruleKind":"Rule type","formatting.aCondition":"A condition","formatting.aColourScale":"A colour scale","formatting.compare":"Compare a value","formatting.distribution":"By the distribution","formatting.colourScale":"Colour scale","formatting.scaleBounds":"Scale bounds","formatting.preview":"Preview","formatting.livePreview":"Live preview","history.title":"History","history.show":"Show history","history.empty":"Nothing to undo yet.","prompt.ask":"Ask","prompt.apply":"Apply","prompt.discard":"Discard","panel.searchColumns":"Search columns","panel.searchColumnsPlaceholder":"Search columns…","panel.searchColumnsToFilter":"Search columns to filter","panel.showAll":"Show all","panel.hideAll":"Hide all","panel.clearAll":"Clear all","panel.clear":"Clear","panel.filterAllColumns":"Filter all columns","panel.columnFiltered":"This column is filtered","panel.clearFilterOn":"Clear the filter on {column}","panel.clearFilter":"Clear this filter","panel.filterEmptyNoMatch":"No column matches “{query}”.","panel.filterEmptyNone":"No column on this grid can be filtered.","panel.filterSummaryActive":"{active} of {total} columns filtered","panel.filterSummaryNone":"No filters · {total} columns available","panel.filterBy":"Filter by {column}","panel.filteredBy":"Filtered by {column}","panel.columnDragHint":"Drag {column} into a zone above, or onto another column to reorder","panel.gridActions":"Grid actions","views.default":"Default","views.namePlaceholder":"Name this view…","views.nameLabel":"Name for the current layout","views.save":"Save view","licence.watermark":"Unlicensed: Lattice Grid trial","licence.watermark.free":M,"filter.op.contains":"Contains","filter.op.notContains":"Does not contain","filter.op.equals":"Equals","filter.op.notEqual":"Does not equal","filter.op.startsWith":"Starts with","filter.op.endsWith":"Ends with","filter.op.blank":"Is blank","filter.op.notBlank":"Is not blank","filter.op.lessThan":"Less than","filter.op.lessThanOrEqual":"Less than or equal","filter.op.greaterThan":"Greater than","filter.op.greaterThanOrEqual":"Greater than or equal","filter.op.inRange":"In range","filter.op.matches":"Matches","filter.op.before":"Before","filter.op.after":"After","filter.op.relative":"Relative to today","filter.rel.today":"Today","filter.rel.yesterday":"Yesterday","filter.rel.tomorrow":"Tomorrow","filter.rel.lastNDays":"Last N days","filter.rel.nextNDays":"Next N days","filter.rel.thisWeek":"This week","filter.rel.lastWeek":"Last week","filter.rel.thisMonth":"This month","filter.rel.lastMonth":"Last month","filter.rel.thisQuarter":"This quarter","filter.rel.quarterToDate":"Quarter to date","filter.rel.thisYear":"This year","filter.rel.yearToDate":"Year to date","filter.operator":"Operator","filter.join":"Join","filter.value":"Value","filter.from":"From","filter.to":"To","filter.addCondition":"Add condition","filter.noConditions":"No conditions","filter.removeCondition":"Remove condition","filter.search":"Search","filter.searchValues":"Search values","filter.noMatches":"No values match","filter.selectAll":"Select all","filter.clear":"Clear","filter.all":"All","filter.allExcept":"All but {count}","filter.loadingValues":"Loading values…","filter.topValues":"Top {shown} of {total} values","filter.valuesFailed":"Values could not be loaded: {error}","filter.valuesUnsupported":"This source cannot list the values of {column}; filter by condition instead.","filter.true":"True","filter.false":"False","filter.expression":"Filter expression","filter.column":"Column","filter.relativePeriod":"Relative period","filter.days":"Number of days","filter.tab.set":"Values","filter.tab.text":"Text","filter.tab.number":"Number","filter.tab.date":"Date","filter.tab.advanced":"Advanced","filterRow.label":"Filter row","filterRow.conditions":{one:"{count} condition",other:"{count} conditions"},"chart.empty":"Nothing to chart","chart.summary":"{type} chart of {measure} by {dimension}","chart.summaryShare":"{type} chart of {measure}","chart.summaryType":"{type} chart","chart.summaryGauge":"{type} chart of {measure}, {fn}: {value}","chart.waterfallTotal":"Total","chart.summaryEngine":"Figures computed by the data engine over every matching row","chart.summaryEngineViewport":"{count} points in this view, fetched from the data engine","chart.summaryEngineDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells counted by the data engine","chart.summaryClientDensity":"{count} rows in this view, more than the {cap} drawn as points, so shown as {cells} density cells computed in the browser","chart.viewportOverCap":"{count} rows in this view, more than the {cap} this map draws; zoom in or narrow the filter","chart.dataTable":"Chart data","chart.viewportFilter.label":"Map view","chart.annotate.rail":"Drawing tools","chart.annotate.select":"Select and move a drawing","chart.annotate.trendLine":"Trend line","chart.annotate.horizontalLine":"Horizontal line","chart.annotate.verticalLine":"Vertical line","chart.annotate.channel":"Parallel channel","chart.annotate.fibonacci":"Fibonacci retracement","chart.annotate.arrow":"Arrow","chart.annotate.pen":"Freehand pen","chart.annotate.pen.described":"Freehand drawing from {from} to {to}","chart.annotate.measure-x":"Date range","chart.annotate.measure-y":"Price range","chart.annotate.measure-xy":"Date and price range","chart.annotate.measure.bars":{one:"{count} bar",other:"{count} bars"},"chart.annotate.measure.points":{one:"{count} point",other:"{count} points"},"chart.annotate.measure.volume":"Vol {value}","chart.annotate.measure.seconds":"{count}s","chart.annotate.measure.minutes":"{count}m","chart.annotate.measure.hours":"{count}h","chart.annotate.measure.days":"{count}d","chart.annotate.measure.weeks":"{count}w","chart.annotate.measure.months":"{count}mo","chart.annotate.measure.years":"{count}y","chart.annotate.measure":"Measure","chart.annotate.measure.dx":"Δx {value}","chart.annotate.measure.dy":"Δy {value}","chart.annotate.measure.pct":"{value}%","chart.annotate.measure.categories":{one:"{count} category",other:"{count} categories"},"chart.annotate.measure.slope.perDay":"Slope {value} per day","chart.annotate.measure.slope.perCategory":"Slope {value} per category","chart.annotate.measure.slope.perUnit":"Slope {value} per unit","chart.annotate.measure.dur.d":"{count} d","chart.annotate.measure.dur.h":"{count} h","chart.annotate.measure.dur.min":"{count} min","chart.annotate.measure.dur.s":"{count} s","chart.annotate.measure.dur.ms":"{count} ms","chart.annotate.measure.announce":"Measurement: {readout}","chart.annotate.measure.start":"Measure start: {x}, {y}","chart.annotate.text":"Text","chart.annotate.callout":"Callout","chart.annotate.note":"Note","chart.annotate.delete":"Delete the selected drawing","chart.annotate.editLabel":"Annotation text","chart.zoom.toolbar":"Zoom controls","chart.zoom.in":"Zoom in","chart.zoom.out":"Zoom out","chart.zoom.left":"Pan left","chart.zoom.right":"Pan right","chart.zoom.reset":"Reset the zoom","chart.legendMore":{one:"+{count} more",other:"+{count} more"},"chart.type.line":"Line","chart.type.area":"Area","chart.type.bar":"Bar","chart.type.pie":"Pie","chart.type.donut":"Donut","chart.type.sunburst":"Sunburst","chart.type.scatter":"Scatter","chart.type.step":"Step","chart.type.rangeArea":"Range","chart.type.horizontalBar":"Horizontal bar","chart.type.waterfall":"Waterfall","chart.type.floatingBar":"Floating bar","chart.type.horizontalFloatingBar":"Horizontal floating bar","chart.type.populationPyramid":"Population pyramid","chart.type.bullet":"Bullet","chart.type.bubble":"Bubble","chart.type.histogram":"Histogram","chart.type.boxplot":"Box plot","chart.type.forest":"Forest plot","chart.type.qq":"QQ plot","chart.type.ecdf":"ECDF","chart.type.lorenz":"Lorenz","chart.type.correlogram":"Correlogram","chart.type.control":"Control","chart.type.capability":"Capability","chart.type.movingRange":"Moving range","chart.type.treemap":"Treemap","chart.type.combo":"Combination","chart.type.pareto":"Pareto","chart.type.heatmap":"Heat map","chart.type.radar":"Radar","chart.type.gauge":"Gauge","chart.type.funnel":"Funnel","chart.type.candlestick":"Candlestick","chart.type.ohlc":"OHLC","chart.type.polarArea":"Polar area","chart.type.nightingale":"Nightingale rose","chart.type.rose":"Rose","chart.type.radialBar":"Radial bar","chart.type.polarScatter":"Polar scatter","chart.type.geomap":"Map","chart.type.sankey":"Sankey","chart.type.chord":"Chord","chart.type.pyramid":"Pyramid","chart.type.pictorial":"Pictorial","chart.type.serpentine":"Serpentine timeline","chart.type.spiral":"Spiral timeline","chart.edit.aggregated":"This value is a total of several rows, so it cannot be dragged.","chart.edit.refused":"That change was not applied.","chart.edit.refusedWhy":"That change was not applied: {reason}","chart.type.network":"Network","chart.type.stream":"Stream","chart.type.marimekko":"Marimekko","chart.type.violin":"Violin","chart.type.gantt":"Gantt","chart.type.forceTree":"Force-directed tree","chart.type.pack":"Packed circles","chart.type.tree":"Tree","chart.type.voronoiTreemap":"Voronoi treemap","chart.type.alluvial":"Alluvial","chart.type.arc":"Arc diagram","chart.type.barRace":"Bar chart race","chart.type.bubblemap":"Bubble map","chart.type.bump":"Bump chart","chart.type.calendar":"Calendar heat map","chart.type.choropleth":"Choropleth map","chart.type.decomposition":"Decomposition tree","chart.type.diverging":"Diverging bar","chart.type.dumbbell":"Dumbbell","chart.type.fan":"Fan chart","chart.type.hexbin":"Hexagonal bin","chart.type.hexmap":"Hex map","chart.type.icicle":"Icicle","chart.type.markermap":"Marker map","chart.type.motion":"Motion chart","chart.type.parallel":"Parallel coordinates","chart.type.ridgeline":"Ridgeline","chart.type.roc":"ROC curve","chart.type.scatter3d":"3D scatter","chart.type.slope":"Slope chart","chart.type.splom":"Scatter plot matrix","chart.type.venn":"Venn diagram","chart.type.waffle":"Waffle","chart.type.wordCloud":"Word cloud","chart.tasksDropped":{one:"{count} more task not shown",other:"{count} more tasks not shown"},"chart.geoUnmatched":{one:"{count} row could not be placed on the map",other:"{count} rows could not be placed on the map"},"chart.r2":"R² {value}","ai.insights":"Insights","ai.explainView":"Explain this view","ai.explain":"Explain","ai.ask":"Ask","ai.apply":"Apply","ai.discard":"Discard","ai.propose":"Propose","ai.approve":"Approve","ai.thinking":"Thinking…","ai.applying":"Applying…","ai.applied":"Applied: {what}","ai.couldNotApply":"Could not apply: {why}","ai.applyFailed":"it failed","ai.discarded":"Discarded.","ai.discardedNothingWritten":"Discarded. Nothing was written.","ai.nothingWritten":"Nothing was written.","ai.nothingWrittenVetoed":"Nothing was written — a before-handler vetoed it.","ai.scope":"Scope: {scope}","ai.unsafeQuery":"I could not turn that into a safe query: {why}","ai.nothingToDo":"nothing to do","ai.insightsFailed":"Could not generate insights right now. The grid is unaffected.","ai.modelUnreachable":"Could not reach the model right now. The grid is unaffected.","ai.flagged":{one:"{count} unverified figure was removed as ungrounded.",other:"{count} unverified figures were removed as ungrounded."},"ai.askPlaceholder":"Ask your data: “EMEA deals over 50k, biggest first”","ai.askLabel":"Ask your data","ai.actorPlaceholder":"Ask AI to change data: “set the Network Upgrade project to In Progress”","ai.actorLabel":"Ask AI to change data","editor.password.show":"Show value","editor.password.hide":"Hide value","editor.password.showField":"Show {column}","editor.password.hideField":"Hide {column}","facets.computing":"Computing…","facets.suppressed.cardinality":"Too many distinct values to chart","facets.suppressed.rows":"Too many rows to chart","facets.suppressed.streaming":"Paused while live data is streaming","facets.suppressed.noProvider":"No distribution available for this data source","facets.suppressed.type":"This column has no chartable distribution","facets.bucketOf":"{count} of {whole} rows","history.undo":"Undo","history.redo":"Redo","history.described":"{action} {label}","history.nothingToUndo":"Nothing to undo","history.nothingToRedo":"Nothing to redo","history.undoDisabled":"Undo (nothing to undo)","history.redoDisabled":"Redo (nothing to redo)","a11y.presence.joined":"{name} joined","a11y.presence.left":"{name} left","prompt.asking":"Asking…","prompt.moreNotes":{one:"and {count} more",other:"and {count} more"},"shortcuts.key.cmd":"Cmd","timeline.live":"Live","timeline.recording":"recording…","panel.zoneHint.group":"Drag a column here to group rows by its values","panel.zoneHint.values":"Drag a column here to total it","panel.zoneHint.pivot":"Drag a column here to pivot across its values","panel.zoneHint.any":"Drag a column here","panel.rowsOf":"{shown} of {total} rows","views.empty":"No saved views yet. Set the grid up as you want it, then save it below.","views.applied":"Applied","views.matchesGrid":"Matches the grid as it is","views.delete":"Delete","views.confirmDelete":"Delete {name}?","views.confirmDeleteLabel":"Confirm deleting {name}","gantt.row.expand":"Expand {name}","gantt.row.collapse":"Collapse {name}","gantt.resource.over":"{name} — over-allocated","kanban.board":"Board","kanban.requiredTitle":"Required fields","kanban.requiredSave":"Save","kanban.requiredCancel":"Cancel","kanban.moveRefused":'Move refused: a card in "{from}" cannot move to "{to}".',"kpi.status.good":"good","kpi.status.warn":"warn","kpi.status.critical":"critical","kpi.status.unknown":"No data","kpi.node.item":"{count} item","kpi.node.items":"{count} items","kpi.node.worst":"worst status {status}","kpi.node.unknown":"{count} unknown"}),B=Object.freeze(Object.keys(X))}),De("packages/core/src/i18n/format.js",function(e,U){"use strict";Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"formatMessage",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"lookup",{enumerable:!0,get:function(){return O}});const M=U("packages/core/src/internal/predicates.js").isFunction,X=/\{(\w+)\}/g,B=new Map,D=new Map;function Z(b){const c=b||"";if(B.has(c))return B.get(c);let f=null;try{f=new Intl.PluralRules(b||void 0)}catch{f=null}return B.set(c,f),f}function K(b,c,f="conjunction"){const o=Array.isArray(b)?b.filter(i=>i!=null&&i!==""):[];if(o.length===0)return"";if(o.length===1)return String(o[0]);const n=`${c||""}|${f}`;let t=D.get(n);if(t===void 0){try{t=new Intl.ListFormat(c||void 0,{style:"long",type:f})}catch{t=null}D.set(n,t)}return t?t.format(o.map(String)):o.map(String).join(", ")}function I(b,c){return b==null?"":typeof b=="number"?Number.isFinite(b)?b.toLocaleString(c||void 0,{maximumFractionDigits:20}):"":String(b)}function G(b,c,f){if(typeof b=="string")return b;if(!b||typeof b!="object")return"";const o=c&&typeof c.count=="number"?c.count:null;if(o===null)return b.other??"";const n=Z(f),t=n?n.select(o):o===1?"one":"other";return b[t]??b.other??""}function H(b,c={},f){const o=G(b,c,f);return o?o.replace(X,(n,t)=>Object.prototype.hasOwnProperty.call(c,t)?I(c[t],f):n):""}function S(b,c,f="en-GB"){return typeof b=="string"&&b?b:typeof c=="string"&&c?c:f}function O(b,c){const f=b?b[c]:void 0;return f==null||M(f)?c:f}}),De("packages/core/src/i18n/registry.js",function(e,U){"use strict";Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"localeCatalogue",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"registeredTags",{enumerable:!0,get:function(){return Z}});const M=U("packages/core/src/i18n/catalogue.js").EN_GB,X=new Map([["en-gb",M]]);function B(K,I){const G=typeof K=="string"?K.toLowerCase():"";return!G||!I||typeof I!="object"?!1:(X.set(G,I),!0)}function D(K){if(typeof K!="string"||!K)return null;const I=K.toLowerCase(),G=X.get(I);if(G)return G;const H=I.split("-")[0],S=X.get(H);if(S)return S;for(const[O,b]of X)if(O.split("-")[0]===H)return b;return null}function Z(){return[...X.keys()]}}),De("packages/core/src/i18n/index.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_LOCALE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"Messages",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"defaultMessages",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"createMessages",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"auditCatalogue",{enumerable:!0,get:function(){return s}});const te=U("packages/core/src/i18n/catalogue.js"),M=te.EN_GB,X=te.MESSAGE_KEYS,B=U("packages/core/src/i18n/format.js"),D=B.formatMessage,Z=B.formatList,K=B.lookup,I=B.resolveLocale,H=U("packages/core/src/internal/predicates.js").isFunction,O=U("packages/core/src/internal/warn.js").warnOnce,b=U("packages/core/src/i18n/registry.js"),c=b.registerLocale,f=b.localeCatalogue;Object.defineProperty(e,"EN_GB",{enumerable:!0,get:function(){return te.EN_GB}}),Object.defineProperty(e,"MESSAGE_KEYS",{enumerable:!0,get:function(){return te.MESSAGE_KEYS}}),Object.defineProperty(e,"formatList",{enumerable:!0,get:function(){return B.formatList}}),Object.defineProperty(e,"resolveLocale",{enumerable:!0,get:function(){return B.resolveLocale}}),Object.defineProperty(e,"registerLocale",{enumerable:!0,get:function(){return b.registerLocale}});const o="en-GB";class n{#e=o;#t=M;constructor(u={}){this.configure(u)}configure(u={}){this.#e=I(u.locale,u.declared,o);const a=u.messages,l=f(this.#e);if(!l&&this.#e.toLowerCase()!=="en-gb"&&(!a||typeof a!="object")&&O(`i18n:locale:not-loaded:${this.#e.toLowerCase()}`,`locale "${this.#e}" is not loaded: import "@toclocoinc/lattice-grid/locales/${this.#e}" to add its text; English is used until then.`),!a||typeof a!="object"){this.#t=l?{...M,...l}:M;return}const y=Object.keys(a).filter(m=>!(m in M));y.length&&O(`i18n:unknown:${y[0]}`,`message keys not in the catalogue and so ignored: ${y.slice(0,5).join(", ")}${y.length>5?`, and ${y.length-5} more`:""}`),this.#t={...M,...l||{},...a}}get locale(){return this.#e}t(u,a){return D(K(this.#t,u),a||{},this.#e)}list(u,a){return Z(u,this.#e,a)}number(u,a){const l=Number(u);return Number.isFinite(l)?l.toLocaleString(this.#e,a||{maximumFractionDigits:20}):""}}const t=new n;function i(r){return r instanceof n?r:new n(r||{})}function s(r){const u=r&&typeof r=="object"?r:{},a=X.filter(h=>{const y=u[h];return y==null||y===""||H(y)}),l=Object.keys(u).filter(h=>!(h in M));return{missing:a,unknown:l}}}),De("packages/core/src/columns/types/structured.js",function(e,U){"use strict";Object.defineProperty(e,"MASK_DEFAULTS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"canonicalJson",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"parseJsonText",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}});const te=U("packages/core/src/internal/predicates.js"),M=te.isNil,X=te.isObject,D=U("packages/core/src/i18n/index.js").defaultMessages,Z=Object.freeze({char:"•",length:8,fixedLength:!0,lastVisible:0,emptyDisplay:""});function K(n,t){const i=t||{},s=i.emptyDisplay??Z.emptyDisplay;if(M(n)||n==="")return s;const u=[...typeof i.char=="string"&&i.char!==""?i.char:Z.char][0]||Z.char,a=i.fixedLength??Z.fixedLength,l=Number.isFinite(i.length)&&Number(i.length)>0?Math.floor(Number(i.length)):Z.length,h=typeof n=="string"?n:typeof n=="number"||typeof n=="boolean"||typeof n=="bigint"?String(n):null;let y=0;if(h!==null){const m=Number.isFinite(i.lastVisible)?Math.floor(Number(i.lastVisible)):Z.lastVisible,v=[...h];if(y=m>0&&m<v.length?m:0,y>0){const d=v.slice(v.length-y).join(""),p=Math.max(1,(a?l:v.length)-y);return u.repeat(p)+d}return u.repeat(a?l:Math.max(1,v.length))}return u.repeat(l)}const I=48;function G(n){try{const t=JSON.stringify(n);return t===void 0?null:t}catch{return null}}function H(n,t){if(M(n))return"";const i=Number.isFinite(t&&t.inlineLimit)?Number(t.inlineLimit):I;if(typeof n=="string")return n.length>i?`${n.slice(0,i-1)}…`:n;if(typeof n!="object")return String(n);const s=G(n);if(s!==null&&s.length<=i)return s;if(Array.isArray(n)){const u=n.length;return`[${D.t("count.items",{count:u})}]`}const r=Object.keys(n).length;return`{${D.t("count.keys",{count:r})}}`}function S(n,t){if(n==null)return"null";const i=typeof n;if(i==="number"||i==="boolean"||i==="bigint")return String(n);if(i==="string")return JSON.stringify(n);if(i!=="object")return JSON.stringify(String(n));const s=t||new WeakSet;return s.has(n)?'"[circular]"':(s.add(n),n instanceof Date?JSON.stringify(n.toISOString()):Array.isArray(n)?`[${n.map(a=>S(a,s)).join(",")}]`:`{${Object.keys(n).sort().map(a=>`${JSON.stringify(a)}:${S(n[a],s)}`).join(",")}}`)}function O(n,t){if(M(n))return M(t)?0:1;if(M(t))return-1;const i=S(n),s=S(t);return i<s?-1:i>s?1:0}function b(n){if(M(n))return null;const t=String(n);if(t.trim()==="")return null;try{return JSON.parse(t)}catch{return t}}function c(n){const t=n&&n.cell&&n.cell.props;return X(t)?t:{}}const f=Object.freeze({json:{base:"object",storage:"object",format:n=>H(n&&n.value,c(n&&n.column)),parse:n=>b(n&&n.text),compare:O,defaults:{editor:"code",filter:"text",align:"start"},excel:"@",toClipboard:n=>{if(M(n))return"";if(typeof n=="string")return n;try{const t=JSON.stringify(n,null,2);return t===void 0?String(n):t}catch{return String(n)}},fromClipboard:n=>b(n)},secret:{base:"text",storage:"object",format:n=>K(n&&n.value,c(n&&n.column)),parse:n=>{const t=n&&n.text;return M(t)||String(t)===""?null:String(t)},compare:(n,t)=>{const i=M(n)||n==="",s=M(t)||t==="";return i===s?0:i?1:-1},defaults:{editor:"password",filter:"none",align:"start"},excel:"@",export:{csv:!1,excel:!1},toClipboard:n=>K(n),fromClipboard:n=>M(n)||String(n)===""?null:String(n)}}),o=f}),De("packages/core/src/columns/types/unit.js",function(e,U){"use strict";Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return T}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/internal/warn.js").warnOnce;function D(A,C,z,Y){return Object.freeze({symbol:A,factor:C,aliases:Object.freeze(z||[]),binary:!!(Y&&Y.binary),prefix:Y&&Y.prefix||null,auto:!(Y&&Y.auto===!1)})}function Z(A,C,z,Y){return D(A,C,z,Y)}const K=Object.freeze({data:Object.freeze([D("B",1,["byte","bytes"]),D("kB",1e3,["kilobyte","kilobytes"],{prefix:"k"}),D("KiB",1024,["kibibyte","kibibytes"],{binary:!0,prefix:"k"}),D("MB",1e6,["megabyte","megabytes"],{prefix:"m"}),D("MiB",1024**2,["mebibyte","mebibytes"],{binary:!0,prefix:"m"}),D("GB",1e9,["gigabyte","gigabytes"],{prefix:"g"}),D("GiB",1024**3,["gibibyte","gibibytes"],{binary:!0,prefix:"g"}),D("TB",1e12,["terabyte","terabytes"],{prefix:"t"}),D("TiB",1024**4,["tebibyte","tebibytes"],{binary:!0,prefix:"t"}),D("PB",1e15,["petabyte","petabytes"],{prefix:"p"})]),bitrate:Object.freeze([D("bps",1,["bit","bits","bit/s","b/s"]),D("kbps",1e3,["kbit","kbits","kbit/s","kb/s","kilobit","kilobits"],{prefix:"k"}),D("Mbps",1e6,["mbit","mbits","mbit/s","mb/s","megabit","megabits"],{prefix:"m"}),D("Gbps",1e9,["gbit","gbits","gbit/s","gb/s","gigabit","gigabits"],{prefix:"g"}),D("Tbps",1e12,["tbit","tbits","tbit/s","tb/s","terabit","terabits"],{prefix:"t"})]),length:Object.freeze([D("nm",1e-9,["nanometre","nanometres","nanometer","nanometers"]),D("µm",1e-6,["um","micrometre","micrometres","micrometer","micrometers","micron","microns"]),D("mm",.001,["millimetre","millimetres","millimeter","millimeters"]),D("cm",.01,["centimetre","centimetres","centimeter","centimeters"]),D("in",.0254,["inch","inches"],{auto:!1}),D("ft",.3048,["foot","feet"],{auto:!1}),D("yd",.9144,["yard","yards"],{auto:!1}),D("m",1,["metre","metres","meter","meters"]),D("km",1e3,["kilometre","kilometres","kilometer","kilometers"]),D("mi",1609.344,["mile","miles"],{auto:!1}),D("nmi",1852,["nauticalmile","nauticalmiles"],{auto:!1})]),mass:Object.freeze([D("mg",.001,["milligram","milligrams"]),D("g",1,["gram","grams"]),D("oz",28.349523125,["ounce","ounces"],{auto:!1}),D("lb",453.59237,["pound","pounds","lbs"],{auto:!1}),D("kg",1e3,["kilogram","kilograms"]),D("st",6350.29318,["stone"],{auto:!1}),D("t",1e6,["tonne","tonnes","ton"],{auto:!1}),D("ton (US)",907184.74,["ton","shortton"],{auto:!1}),D("ton (UK)",10160469088e-4,["ton","longton"],{auto:!1})]),duration:Object.freeze([D("ns",1e-9,["nsec","nsecs","nanosecond","nanoseconds"]),D("µs",1e-6,["us","usec","usecs","microsecond","microseconds"]),D("ms",.001,["msec","msecs","millisecond","milliseconds"]),D("s",1,["sec","secs","second","seconds"]),D("m",60,["min","mins","minute","minutes"]),D("h",3600,["hr","hrs","hour","hours"]),D("d",86400,["day","days"])]),speed:Object.freeze([D("mm/s",.001,["millimetre/s","millimeter/s"]),D("ft/s",.3048,["fps","foot/s","feet/s"],{auto:!1}),D("km/h",1/3.6,["kph","kmh","kilometre/h","kilometer/h"],{auto:!1}),D("mph",.44704,["mile/h","miles/h"],{auto:!1}),D("kn",1852/3600,["knot","knots"],{auto:!1}),D("m/s",1,["metre/s","meter/s","mps"]),D("km/s",1e3,["kilometre/s","kilometer/s"])]),acceleration:Object.freeze([D("mm/s²",.001,["mm/s2"]),D("ft/s²",.3048,["ft/s2"],{auto:!1}),D("m/s²",1,["m/s2","metre/s2","meter/s2"]),D("g",9.80665,["gee","gravity"],{auto:!1})]),area:Object.freeze([D("mm²",1e-6,["mm2"]),D("cm²",1e-4,["cm2"]),D("in²",64516e-8,["in2","sqin"],{auto:!1}),D("ft²",.09290304,["ft2","sqft"],{auto:!1}),D("yd²",.83612736,["yd2","sqyd"],{auto:!1}),D("m²",1,["m2","sqm"]),D("ha",1e4,["hectare","hectares"],{auto:!1}),D("ac",4046.8564224,["acre","acres"],{auto:!1}),D("km²",1e6,["km2","sqkm"])]),volume:Object.freeze([D("µL",1e-6,["ul","microlitre","microliter"]),D("mL",.001,["millilitre","milliliter"]),D("fl oz (US)",.0295735295625,["fl oz","usfloz"],{auto:!1}),D("fl oz (imp)",.0284130625,["fl oz","impfloz"],{auto:!1}),D("L",1,["litre","litres","liter","liters"]),D("gal (US)",3.785411784,["gal","usgal","usgallon"],{auto:!1}),D("gal (imp)",4.54609,["gal","impgal","impgallon"],{auto:!1}),D("m³",1e3,["m3","cubicmetre","cubicmeter","kl"],{auto:!1}),D("bbl",158.987294928,["barrel","barrels"],{auto:!1})]),energy:Object.freeze([D("eV",1602176634e-28,["electronvolt","electronvolts"],{auto:!1}),D("J",1,["joule","joules"]),D("cal",4.184,["calorie","calories"],{auto:!1}),D("kJ",1e3,["kilojoule","kilojoules"]),D("BTU",1055.05585262,["btu"],{auto:!1}),D("kcal",4184,["kilocalorie","kilocalories","Cal"],{auto:!1}),D("MJ",1e6,["megajoule","megajoules"]),D("kWh",36e5,["kilowatthour","kilowatthours"],{auto:!1}),D("GJ",1e9,["gigajoule","gigajoules"]),D("MWh",36e8,["megawatthour","megawatthours"],{auto:!1})]),power:Object.freeze([D("mW",.001,["milliwatt","milliwatts"]),D("W",1,["watt","watts"]),D("BTU/h",1055.05585262/3600,["btuh","btu/h"],{auto:!1}),D("kW",1e3,["kilowatt","kilowatts"]),D("hp",745.6998715822702,["horsepower"],{auto:!1}),D("MW",1e6,["megawatt","megawatts"]),D("GW",1e9,["gigawatt","gigawatts"])]),force:Object.freeze([D("mN",.001,["millinewton","millinewtons"]),D("N",1,["newton","newtons"]),D("lbf",4.4482216152605,["poundforce"],{auto:!1}),D("kgf",9.80665,["kilogramforce"],{auto:!1}),D("kN",1e3,["kilonewton","kilonewtons"]),D("MN",1e6,["meganewton","meganewtons"])]),pressure:Object.freeze([D("Pa",1,["pascal","pascals"]),D("mbar",100,["millibar"],{auto:!1}),D("inH₂O",249.0889,["inh2o"],{auto:!1}),D("mmHg",133.322387415,["torr"],{auto:!1}),D("kPa",1e3,["kilopascal","kilopascals"]),D("inHg",3386.388640341,["inhg"],{auto:!1}),D("psi",6894.757293168361,["lbf/in2"],{auto:!1}),D("bar",1e5,[],{auto:!1}),D("atm",101325,["atmosphere","atmospheres"],{auto:!1}),D("MPa",1e6,["megapascal","megapascals"]),D("GPa",1e9,["gigapascal","gigapascals"])]),torque:Object.freeze([D("N·m",1,["nm","n.m","newtonmetre","newtonmeter"]),D("lbf·ft",1.3558179483314003,["lbfft","lbf.ft","ftlb","ft-lb"],{auto:!1}),D("kN·m",1e3,["knm","kn.m"],{auto:!1}),D("MN·m",1e6,["mnm","mn.m"],{auto:!1})]),density:Object.freeze([D("kg/m³",1,["kg/m3"]),D("lb/ft³",16.01846337396014,["lb/ft3","pcf"],{auto:!1}),D("g/cm³",1e3,["g/cm3","g/ml","kg/l"],{auto:!1}),D("t/m³",1e3,["t/m3"],{auto:!1})]),flow:Object.freeze([D("L/min",1/6e4,["lpm","l/min"],{auto:!1}),D("m³/h",1/3600,["m3/h","cmh"],{auto:!1}),D("gpm (US)",.003785411784/60,["gpm","usgpm"],{auto:!1}),D("gpm (imp)",.00454609/60,["gpm","impgpm"],{auto:!1}),D("cfm",.0004719474432,["ft3/min"],{auto:!1}),D("L/s",.001,["lps","l/s"],{auto:!1}),D("m³/s",1,["m3/s","cms"])]),angle:Object.freeze([D("″",Math.PI/648e3,["arcsec","arcsecond","arcseconds"],{auto:!1}),D("′",Math.PI/10800,["arcmin","arcminute","arcminutes"],{auto:!1}),D("mrad",.001,["milliradian","milliradians"],{auto:!1}),D("mil",Math.PI/3200,["nato-mil"],{auto:!1}),D("°",Math.PI/180,["deg","degree","degrees"],{auto:!1}),D("gon",Math.PI/200,["grad","gradian","gradians"],{auto:!1}),D("rad",1,["radian","radians"]),D("turn",2*Math.PI,["rev","revolution","revolutions"],{auto:!1})]),angularVelocity:Object.freeze([D("°/s",Math.PI/180,["degps","deg/s","degrees/s"],{auto:!1}),D("rad/s",1,["radps","radians/s"]),D("rpm",2*Math.PI/60,["rev/min","r/min","revolutions/min"],{auto:!1}),D("rps",2*Math.PI,["rev/s","r/s","revolutions/s"],{auto:!1})]),fraction:Object.freeze([D("ppt",1e-12,["partspertrillion"],{auto:!1}),D("ppb",1e-9,["partsperbillion"]),D("ppm",1e-6,["partspermillion"]),D("bp",1e-4,["bps-finance","basispoint","basispoints","bips"],{auto:!1}),D("‰",.001,["permille","permil"],{auto:!1}),D("%",.01,["pct","percent"]),D("×",1,["x","ratio","times"])]),molarity:Object.freeze([D("pM",1e-12,["picomolar","picomolarity"]),D("nM",1e-9,["nanomolar","nanomolarity"]),D("µM",1e-6,["um-molar","micromolar","micromolarity"]),D("mM",.001,["millimolar","millimolarity"]),D("M",1,["molar","mol/l","mol/L","molarity"]),D("mol/m³",.001,["mol/m3"],{auto:!1})]),massFlow:Object.freeze([D("mg/s",1e-6,["milligrams/s"]),D("g/s",.001,["grams/s"]),D("kg/h",1/3600,["kilograms/h","kgph"],{auto:!1}),D("kg/s",1,["kilograms/s","kgps"]),D("t/h",1e3/3600,["tonnes/h","tph"],{auto:!1}),D("lb/h",.45359237/3600,["pounds/h","pph"],{auto:!1}),D("t/s",1e3,["tonnes/s"],{auto:!1})]),viscosity:Object.freeze([D("µPa·s",1e-6,["upas","micropascalsecond"]),D("cP",.001,["centipoise"],{auto:!1}),D("mPa·s",.001,["mpas","millipascalsecond"]),D("P",.1,["poise"],{auto:!1}),D("Pa·s",1,["pas","pascalsecond"])]),kinematicViscosity:Object.freeze([D("cSt",1e-6,["centistokes","centistoke"]),D("mm²/s",1e-6,["mm2/s"],{auto:!1}),D("St",1e-4,["stokes","stoke"],{auto:!1}),D("m²/s",1,["m2/s"])]),thermalConductivity:Object.freeze([D("mW/(m·K)",.001,["mw/mk"]),D("W/(m·K)",1,["w/mk","wmk"]),D("kW/(m·K)",1e3,["kw/mk"],{auto:!1}),D("BTU/(hr·ft·°F)",1.730734666,["btu/hrftf"],{auto:!1})]),specificHeat:Object.freeze([D("J/(kg·K)",1,["j/kgk","jkgk"]),D("kJ/(kg·K)",1e3,["kj/kgk"]),D("cal/(g·°C)",4184,["cal/gc"],{auto:!1})]),doseRate:Object.freeze([D("nSv/h",1e-9,["nsvh"]),D("µSv/h",1e-6,["usv/h","usvh"]),D("mSv/h",.001,["msvh"]),D("Sv/h",1,["svh"]),D("mSv/a",.001/8766,["msv/year","msvpa"],{auto:!1})])}),I=Symbol("ambiguous"),G=new Map,H=new Map;function S(A,C){const z=String(A||"").trim();if(!z)throw new Error("[lattice] a unit system needs a name");if(K[z]||H.has(z))throw new Error(`[lattice] unit system "${z}" already exists`);const Y=[...C||[]];if(!Y.length)throw new Error(`[lattice] unit system "${z}" has no units`);if(!Y.some(V=>V.factor===1))throw new Error(`[lattice] unit system "${z}" has no base unit (none with factor 1)`);const q=new Set;for(const V of Y){if(q.has(V.symbol))throw new Error(`[lattice] unit system "${z}" declares "${V.symbol}" twice`);q.add(V.symbol)}return H.set(z,Object.freeze(Y)),G.delete(z),z}function O(){return[...Object.keys(K),...H.keys()]}function b(A){const C=c(A);return C?C.units:[]}function c(A){const C=String(A||""),z=G.get(C);if(z!==void 0)return z;const Y=K[C]||H.get(C);if(!Y)return G.set(C,null),null;const q=Object.freeze([...Y].sort((oe,re)=>oe.factor-re.factor)),V=new Map,J=new Map,ee=(oe,re)=>{const ae=V.get(oe);ae===void 0?V.set(oe,re):ae!==re&&V.set(oe,I)};for(const oe of q){ee(oe.symbol.toLowerCase(),oe);for(const re of oe.aliases)ee(re.toLowerCase(),oe);if(oe.prefix){const re=J.get(oe.prefix)||[];re.push(oe),J.set(oe.prefix,re)}}const ne={units:q,byToken:V,byPrefix:J,decimal:q.filter(oe=>!oe.binary&&oe.auto),binary:q.some(oe=>oe.binary)?q.filter(oe=>(oe.binary||oe.factor===1)&&oe.auto):null};return G.set(C,ne),ne}function f(A,C){return C&&A.binary||A.decimal}function o(A,C){const z=c(A);if(!z||M(C))return null;const Y=z.units.find(V=>V.symbol===String(C));if(Y)return Y;const q=z.byToken.get(String(C).trim().toLowerCase());return q&&q!==I?q:null}const n=new WeakMap;function t(A){const C=A||{};if(typeof C=="object"&&C!==null){const V=n.get(C);if(V!==void 0)return V}const z=C.system||"data",Y=c(z);let q=null;if(!Y)B(`unit:system:${z}`,`unknown unit system "${z}"; known systems are ${O().join(", ")}`);else{let V=C.unit?o(z,C.unit):null;V||(C.unit&&B(`unit:unit:${z}:${C.unit}`,`unknown unit "${C.unit}" in system "${z}"; falling back to ${Y.units[0].symbol}`),V=Y.units.find(J=>J.factor===1)||Y.units[0]),q={index:Y,base:V,binary:C.binary===!0}}return typeof C=="object"&&C!==null&&n.set(C,q),q}const i=new WeakMap;function s(A,C){if(!A||!C||!Array.isArray(A.compound)||A.compound.length===0)return null;const z=i.get(A);if(z!==void 0)return z;const Y=new Set,q=[];for(const J of A.compound){const ee=o(A.system||"data",J);if(!ee){B(`unit:compound:${A.system}:${J}`,`unknown compound unit "${J}" in system "${A.system||"data"}"; ignoring it`);continue}Y.has(ee.symbol)||(Y.add(ee.symbol),q.push(ee))}q.sort((J,ee)=>ee.factor-J.factor);const V=q.length>=2?q:null;return i.set(A,V),V}function r(A,C,z){return C===z||C.factor===z.factor?A:A*C.factor/z.factor}const u=new Map;function a(A){const C=A||"",z=u.get(C);if(z)return z;const Y={group:",",decimal:"."};try{for(const q of new Intl.NumberFormat(A||void 0).formatToParts(12345.6))q.type==="group"?Y.group=q.value:q.type==="decimal"&&(Y.decimal=q.value)}catch{}return u.set(C,Y),Y}const l=/[\s   ]/g,h=/^[+-]?[\d   '’ .,]*(?:[eE][+-]?\d+)?/,y=/^[^\d+\-(.,\s]+\s*/,m=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;function v(A,C){const{group:z,decimal:Y}=a(C);let q=String(A).replace(l,"");if(q==="")return null;const V=Y?q.indexOf(Y):-1;if(z&&z!==Y){if(V>=0&&q.indexOf(z,V+Y.length)>=0)return null;q=q.split(z).join("")}if(Y&&Y!=="."&&(q=q.split(Y).join(".")),!m.test(q))return null;const J=Number(q);return Number.isFinite(J)?J:null}function d(A,C,z){const Y=String(A).trim().replace(/\.$/,"");if(Y==="")return null;const q=C.units.find(re=>re.symbol===Y);if(q)return q;const V=Y.toLowerCase(),J=C.byToken.get(V);if(J===I)return null;if(J)return J;const ee=C.byPrefix.get(V);if(!ee||!ee.length)return null;const ne=f(C,z),oe=ee.filter(re=>ne.includes(re));return oe.length===1?oe[0]:null}function p(A,C,z,Y){let q=A,V=0,J=!1,ee=!1;for(;q!=="";){const ne=h.exec(q)[0];if(ne==="")return null;const oe=v(ne,Y&&Y.locale);if(oe===null)return null;q=q.slice(ne.length).trim();const re=q.search(/[+-]?[\d]/),ae=(re>=0?q.slice(0,re):q).trim();if(q=re>=0?q.slice(re).trim():"",ae===""){if(J)return null;ee=!0,V+=r(oe,z[0],C.base)}else{const fe=d(ae,C.index,C.binary);if(!fe)return null;V+=r(oe,fe,C.base)}if(J=!0,ee&&q!=="")return null}return J?V:null}function g(A,C){if(M(A))return null;if(typeof A=="number")return Number.isFinite(A)?A:null;const z=t(C);if(!z)return null;let Y=String(A).trim();if(Y==="")return null;let q=!1;Y.startsWith("(")&&Y.endsWith(")")&&(q=!0,Y=Y.slice(1,-1).trim());const V=s(C,z);if(V){Y.startsWith("-")&&(q=!0,Y=Y.slice(1).trim());const de=p(Y,z,V,C);return de===null?null:q?-de:de}let J=null;const ee=y.exec(Y);if(ee&&ee[0]){const de=d(ee[0].trim(),z.index,z.binary);de&&(J=de,Y=Y.slice(ee[0].length).trim())}const ne=h.exec(Y)[0],oe=v(ne,C&&C.locale);if(oe===null)return null;const re=Y.slice(ne.length).trim();if(J&&re!=="")return null;const ae=J||(re===""?z.base:d(re,z.index,z.binary));if(!ae)return null;const fe=r(oe,ae,z.base);return q?-fe:fe}const k=new Map;function w(A,C,z,Y){const q=`${A||""}|${C}|${z}|${Y?1:0}`;let V=k.get(q);return V||(V=new Intl.NumberFormat(A||void 0,{minimumFractionDigits:C,maximumFractionDigits:z,useGrouping:Y}),k.set(q,V)),V}function E(A,C){if(!Number.isFinite(A)||A===0)return Math.max(0,C-1);const z=Math.floor(Math.log10(Math.abs(A)));return Math.min(20,Math.max(0,C-1-z))}function N(A,C){if(!Number.isFinite(A)||A===0)return A;const z=Math.ceil(Math.log10(Math.abs(A))),Y=10**(C-z);return Math.round(A*Y)/Y}function x(A,C,z){if(!z||z===C.base.symbol)return C.base;if(z!=="auto")return _(C,z);if(A===0||!Number.isFinite(A))return C.base;const Y=Math.abs(A)*C.base.factor,q=f(C.index,C.binary);let V=q[0];for(const ne of q)Y>=ne.factor&&(V=ne);if(Y>=V.factor)return V;let J=V;for(const ne of C.index.units)ne.binary!==C.binary&&ne.factor!==1||ne.factor<=Y&&ne.factor>(J===V?0:J.factor)&&(J=ne);if(J!==V)return J;let ee=V;for(const ne of C.index.units)ne.binary!==C.binary&&ne.factor!==1||ne.factor<ee.factor&&(ee=ne);return ee.factor<C.base.factor?ee:C.base}function _(A,C){const z=A.index.units.find(q=>q.symbol===C);if(z)return z;const Y=A.index.byToken.get(String(C).toLowerCase());return Y&&Y!==I?Y:(B(`unit:display:${C}`,`unknown display unit "${C}"; rendering in ${A.base.symbol}`),A.base)}function F(A,C,z,Y){const q=A<0;let V=Math.abs(A)*C.base.factor;const J=typeof Y.decimals=="number"?Y.decimals:Y.minDecimals??0,ee=typeof Y.decimals=="number"?Y.decimals:Y.maxDecimals??Math.max(J,2),ne=Y.space??" ",oe=[];for(let ae=0;ae<z.length;ae++){const fe=z[ae],de=ae===z.length-1;let ve=de?V/fe.factor:Math.floor(V/fe.factor);if(V-=ve*fe.factor,de){const Le=10**ee;ve=Math.round(ve*Le)/Le+0}const Ie=de?w(Y.locale,J,ee,Y.group!==!1):w(Y.locale,0,0,Y.group!==!1);oe.push(`${Ie.format(ve)}${ne}${fe.symbol}`)}const re=oe.join(" ");return q?`-${re}`:re}function L(A,C){const z=C||{},Y=z.nullDisplay??"";if(M(A)||A==="")return Y;const q=typeof A=="number"?A:Number(A);if(!Number.isFinite(q))return Y;const V=t(z);if(!V)return String(q);const J=s(z,V);if(J)return F(q,V,J,z);const ee=typeof z.significantFigures=="number"&&z.significantFigures>0?z.significantFigures:0,ne=ee?N(q,ee):q,oe=x(ne,V,z.display),re=r(ne,V.base,oe);let ae=typeof z.decimals=="number"?z.decimals:z.minDecimals??0,fe=typeof z.decimals=="number"?z.decimals:z.maxDecimals??Math.max(ae,2);ee&&(ae=E(re,ee),fe=ae);const de=w(z.locale,ae,fe,z.group!==!1).format(re),ve=z.space??" ";return z.placement==="prefix"?`${oe.symbol}${z.space??""}${de}`:`${de}${ve}${oe.symbol}`}function j(A,C){const z=M(A)||Number.isNaN(A)?null:Number(A),Y=M(C)||Number.isNaN(C)?null:Number(C);return z===null||Number.isNaN(z)?Y===null||Number.isNaN(Y)?0:1:Y===null||Number.isNaN(Y)||z<Y?-1:z>Y?1:0}function R(A){const C=typeof A.decimals=="number"&&A.decimals>0?`.${"0".repeat(A.decimals)}`:"";return`${typeof A.decimals=="number"?`#,##0${C}`:"#,##0.##"}" ${A.symbol}"`}function $(A){const C={system:"data",...A||{}},z=t(C),Y=z?z.base.symbol:String(C.unit||""),q=Object.freeze({...C,unit:Y}),V=Object.freeze({...q,display:Y,decimals:void 0,minDecimals:0,maxDecimals:20,group:!1}),J=new Map([[q.locale||"",q]]),ee=ne=>{const oe=ne||"";let re=J.get(oe);return re||(re=Object.freeze({...q,locale:ne||void 0}),J.set(oe,re)),re};return{base:"number",extends:"number",storage:"float64",unitConfig:q,format:ne=>L(ne.value,ne.locale?ee(ne.locale):q),parse:ne=>g(ne.text,ne.locale?ee(ne.locale):q),compare:j,defaults:{filter:"number",editor:"unit",align:"end",total:C.total||"sum"},...C.totals?{totals:C.totals}:{},excel:C.excel||R({decimals:C.decimals,symbol:Y}),toStorage:ne=>typeof ne=="number"?Number.isFinite(ne)?ne:null:typeof ne=="string"?g(ne,q):M(ne)?null:g(String(ne),q),toClipboard:ne=>L(ne,V),fromClipboard:ne=>g(ne,q)}}const T=$}),De("packages/core/src/columns/types/engineering.js",function(e,U){"use strict";Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return D}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/columns/types/unit.js").createUnitType;function D(I){const G=2*Math.PI/I;return H=>{let S=0,O=0,b=0;for(const f of H||[]){if(M(f))continue;const o=Number(f);Number.isFinite(o)&&(S+=Math.cos(o*G),O+=Math.sin(o*G),b+=1)}return!b||Math.hypot(S,O)/b<1e-12?null:(Math.atan2(O,S)/G%I+I)%I}}function Z(I){return{supported:["sum","avg","min","max","count","countValues"],implement:{avg:D(I)}}}const K=Object.freeze({metres:B({system:"length",unit:"m",display:"auto",maxDecimals:3}),millimetres:B({system:"length",unit:"mm",maxDecimals:2}),kilometres:B({system:"length",unit:"km",maxDecimals:3}),grams:B({system:"mass",unit:"g",display:"auto",maxDecimals:3}),kilograms:B({system:"mass",unit:"kg",maxDecimals:3}),tonnes:B({system:"mass",unit:"t",maxDecimals:3}),seconds:B({system:"duration",unit:"s",display:"auto",maxDecimals:3}),milliseconds:B({system:"duration",unit:"ms",maxDecimals:3}),hours:B({system:"duration",unit:"h",maxDecimals:2}),speed:B({system:"speed",unit:"m/s",display:"auto",maxDecimals:2}),kph:B({system:"speed",unit:"km/h",maxDecimals:1}),mph:B({system:"speed",unit:"mph",maxDecimals:1}),knots:B({system:"speed",unit:"kn",maxDecimals:1}),acceleration:B({system:"acceleration",unit:"m/s²",maxDecimals:3}),area:B({system:"area",unit:"m²",display:"auto",maxDecimals:2}),hectares:B({system:"area",unit:"ha",maxDecimals:4}),volume:B({system:"volume",unit:"L",display:"auto",maxDecimals:3}),cubicMetres:B({system:"volume",unit:"m³",maxDecimals:3}),energy:B({system:"energy",unit:"J",display:"auto",maxDecimals:3}),kilowattHours:B({system:"energy",unit:"kWh",maxDecimals:2}),power:B({system:"power",unit:"W",display:"auto",maxDecimals:2}),kilowatts:B({system:"power",unit:"kW",maxDecimals:2}),force:B({system:"force",unit:"N",display:"auto",maxDecimals:2}),pressure:B({system:"pressure",unit:"Pa",display:"auto",maxDecimals:2}),bar:B({system:"pressure",unit:"bar",maxDecimals:3}),psi:B({system:"pressure",unit:"psi",maxDecimals:1}),torque:B({system:"torque",unit:"N·m",maxDecimals:2}),density:B({system:"density",unit:"kg/m³",maxDecimals:2}),flow:B({system:"flow",unit:"m³/s",maxDecimals:4}),litresPerMinute:B({system:"flow",unit:"L/min",maxDecimals:1}),radians:B({system:"angle",unit:"rad",maxDecimals:4,totals:Z(2*Math.PI)}),degrees:B({system:"angle",unit:"°",maxDecimals:2,totals:Z(360)}),rpm:B({system:"angularVelocity",unit:"rpm",maxDecimals:0}),angularVelocity:B({system:"angularVelocity",unit:"rad/s",maxDecimals:3}),ppm:B({system:"fraction",unit:"ppm",maxDecimals:2}),ppb:B({system:"fraction",unit:"ppb",maxDecimals:2}),basisPoints:B({system:"fraction",unit:"bp",maxDecimals:1}),molarity:B({system:"molarity",unit:"M",display:"auto",maxDecimals:3}),massFlow:B({system:"massFlow",unit:"kg/s",maxDecimals:3}),tonnesPerHour:B({system:"massFlow",unit:"t/h",maxDecimals:2}),viscosity:B({system:"viscosity",unit:"Pa·s",display:"auto",maxDecimals:3}),kinematicViscosity:B({system:"kinematicViscosity",unit:"cSt",maxDecimals:2}),thermalConductivity:B({system:"thermalConductivity",unit:"W/(m·K)",maxDecimals:3}),specificHeat:B({system:"specificHeat",unit:"J/(kg·K)",maxDecimals:1}),doseRate:B({system:"doseRate",unit:"µSv/h",display:"auto",maxDecimals:2})})}),De("packages/core/src/columns/types/si.js",function(e,U){"use strict";Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return S}});const te=U("packages/core/src/columns/types/unit.js"),M=te.defineUnit,X=te.registerUnitSystem,B=te.createUnitType,D=Object.freeze([Object.freeze({symbol:"f",name:"femto",factor:1e-15}),Object.freeze({symbol:"p",name:"pico",factor:1e-12}),Object.freeze({symbol:"n",name:"nano",factor:1e-9}),Object.freeze({symbol:"µ",name:"micro",factor:1e-6}),Object.freeze({symbol:"m",name:"milli",factor:.001}),Object.freeze({symbol:"c",name:"centi",factor:.01}),Object.freeze({symbol:"",name:"",factor:1}),Object.freeze({symbol:"k",name:"kilo",factor:1e3}),Object.freeze({symbol:"M",name:"mega",factor:1e6}),Object.freeze({symbol:"G",name:"giga",factor:1e9}),Object.freeze({symbol:"T",name:"tera",factor:1e12}),Object.freeze({symbol:"P",name:"peta",factor:1e15})]),Z=Object.freeze(["p","n","µ","m","","k","M","G"]);function K(O){const b=String(O.base),c=new Set([...O.prefixes||Z,""]),f=[];for(const o of D){if(!c.has(o.symbol))continue;const n=`${o.symbol}${b}`,t=[];if(O.name){t.push(`${o.name}${O.name}`,`${o.name}${O.name}s`);const i=o.name.slice(-1);if(i&&O.name.startsWith(i)){const s=`${o.name.slice(0,-1)}${O.name}`;t.push(s,`${s}s`)}}o.symbol==="µ"&&t.push(`u${b}`),o.factor===1&&O.aliases&&t.push(...O.aliases),f.push(M(n,o.factor,t))}for(const o of O.extra||[])f.push(o);return f}function I(O,b){const c=K(b);return X(O,c)}function G(O,b,c){return I(O,b),B({system:O,unit:b.base,display:"auto",maxDecimals:3,...c||{}})}const H=Object.freeze({voltage:G("voltage",{base:"V",name:"volt"}),current:G("current",{base:"A",name:"amp",aliases:["ampere","amperes"]}),resistance:G("resistance",{base:"Ω",name:"ohm",aliases:["ohm","ohms","R"],prefixes:["m","","k","M","G"]}),capacitance:G("capacitance",{base:"F",name:"farad",prefixes:["f","p","n","µ","m",""]}),inductance:G("inductance",{base:"H",name:"henry",prefixes:["p","n","µ","m",""]}),charge:G("charge",{base:"C",name:"coulomb",prefixes:["p","n","µ","m",""],extra:[M("mAh",3.6,["milliamphour","milliamphours"],{auto:!1}),M("Ah",3600,["amphour","amphours"],{auto:!1})]}),conductance:G("conductance",{base:"S",name:"siemens",prefixes:["n","µ","m","","k"]}),fluxDensity:G("fluxDensity",{base:"T",name:"tesla",prefixes:["n","µ","m",""],extra:[M("G",1e-4,["gauss"],{auto:!1})]}),luminousFlux:G("luminousFlux",{base:"lm",name:"lumen",prefixes:["m","","k"]}),illuminance:G("illuminance",{base:"lx",name:"lux",prefixes:["m","","k"]}),luminousIntensity:G("luminousIntensity",{base:"cd",name:"candela",prefixes:["m","","k"]}),substance:G("substance",{base:"mol",name:"mole",prefixes:["n","µ","m","","k"]}),absorbedDose:G("absorbedDose",{base:"Gy",name:"gray",prefixes:["µ","m",""]}),equivalentDose:G("equivalentDose",{base:"Sv",name:"sievert",prefixes:["n","µ","m",""]}),radioactivity:G("radioactivity",{base:"Bq",name:"becquerel",prefixes:["","k","M","G","T"],extra:[M("Ci",37e9,["curie","curies"],{auto:!1})]}),frequency:G("frequency",{base:"Hz",name:"hertz",prefixes:["m","","k","M","G","T"]})}),S=G}),De("packages/core/src/columns/types/temperature.js",function(e,U){"use strict";Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});const M=U("packages/core/src/internal/predicates.js").isNil,X=Object.freeze({C:Object.freeze({symbol:"°C",aliases:["c","°c","celsius","centigrade"],toKelvin:f=>f+273.15,fromKelvin:f=>f-273.15}),F:Object.freeze({symbol:"°F",aliases:["f","°f","fahrenheit"],toKelvin:f=>(f+459.67)*(5/9),fromKelvin:f=>f*(9/5)-459.67}),K:Object.freeze({symbol:"K",aliases:["k","kelvin"],toKelvin:f=>f,fromKelvin:f=>f}),R:Object.freeze({symbol:"°R",aliases:["r","°r","rankine"],toKelvin:f=>f*(5/9),fromKelvin:f=>f*(9/5)})});function B(f){if(M(f))return null;const o=String(f).trim();if(o==="")return null;for(const[t,i]of Object.entries(X))if(o===t||o===i.symbol)return{key:t,scale:i};const n=o.toLowerCase();for(const[t,i]of Object.entries(X))if(i.aliases.includes(n))return{key:t,scale:i};return null}function D(f,o,n){const t=B(o),i=B(n);return!t||!i||!Number.isFinite(Number(f))?null:t.key===i.key?Number(f):i.scale.fromKelvin(t.scale.toKelvin(Number(f)))}const Z=new Map;function K(f,o,n){const t=`${f||""}|${o}|${n}`;let i=Z.get(t);return i||(i=new Intl.NumberFormat(f||void 0,{minimumFractionDigits:o,maximumFractionDigits:n}),Z.set(t,i)),i}function I(f,o){const n=o||{},t=n.nullDisplay??"";if(M(f)||f==="")return t;const i=Number(f);if(!Number.isFinite(i))return t;const s=B(n.scale||"C");if(!s)return String(i);const r=B(n.display||n.scale||"C")||s,u=r.key===s.key?i:r.scale.fromKelvin(s.scale.toKelvin(i)),a=typeof n.decimals=="number"?n.decimals:null,l=a??n.minDecimals??0,h=a??n.maxDecimals??1;return`${K(n.locale,l,h).format(u)}${n.space??" "}${r.scale.symbol}`}const G=/^[+-]?[\d\s.,  ]*\d/;function H(f,o){const n=String(f).trim();if(n==="")return null;const t=new Intl.NumberFormat(o||void 0).formatToParts(1.1).find(u=>u.type==="decimal")?.value||".",i=t===","?".":",",s=n.split(i).join("").split(/[\s  ]/).join("").replace(t,"."),r=Number(s);return Number.isFinite(r)?r:null}function S(f,o){if(M(f))return null;const n=o||{},t=B(n.scale||"C");if(!t)return null;if(typeof f=="number")return Number.isFinite(f)?f:null;let i=String(f).trim();if(i==="")return null;let s=!1;i.startsWith("(")&&i.endsWith(")")&&(s=!0,i=i.slice(1,-1).trim());const r=G.exec(i);if(!r)return null;const u=H(r[0],n.locale);if(u===null)return null;const a=i.slice(r[0].length).trim();if(a==="")return s?-u:u;const l=B(a);if(!l)return null;const h=l.key===t.key?u:t.scale.fromKelvin(l.scale.toKelvin(u));return s?-h:h}function O(f){const o=Object.freeze({scale:"C",...f||{}}),t=(B(o.scale)||B("C")).scale.symbol,i=Object.freeze({...o,display:o.scale,decimals:void 0,minDecimals:0,maxDecimals:20}),s=new Map([[o.locale||"",o]]),r=u=>{const a=u||"";let l=s.get(a);return l||(l=Object.freeze({...o,locale:u||void 0}),s.set(a,l)),l};return{base:"number",extends:"number",storage:"float64",temperatureConfig:o,format:u=>I(u.value,u.locale?r(u.locale):o),parse:u=>S(u.text,u.locale?r(u.locale):o),defaults:{filter:"number",editor:"temperature",align:"end",total:"avg"},totals:{supported:["avg","min","max","count","countValues"]},excel:o.excel||`#,##0${typeof o.decimals=="number"&&o.decimals>0?`.${"0".repeat(o.decimals)}`:".#"}" ${t}"`,toStorage:u=>typeof u=="number"?Number.isFinite(u)?u:null:typeof u=="string"?S(u,o):M(u)?null:S(String(u),o),toClipboard:u=>I(u,i),fromClipboard:u=>S(u,o)}}const b=Object.freeze({celsius:O({scale:"C"}),fahrenheit:O({scale:"F"}),kelvin:O({scale:"K"})}),c=O}),De("packages/core/src/columns/types/radix.js",function(e,U){"use strict";Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"digitsForWidth",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"radixRange",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"radixName",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"normaliseRadixOptions",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"compileRadixFormat",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"compileRadixParse",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"parseRadixResult",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return F}});const M=U("packages/core/src/internal/predicates.js").isNil,B=U("packages/core/src/internal/warn.js").warnOnce,D=Object.freeze({2:2,8:8,16:16,bin:2,binary:2,base2:2,oct:8,octal:8,base8:8,hex:16,hexadecimal:16,base16:16}),Z=Object.freeze({2:1,8:3,16:4}),K=Object.freeze({2:"0b",8:"0o",16:"0x"}),I=Object.freeze({2:4,8:3,16:2}),G=Object.freeze({2:/^[01]+$/,8:/^[0-7]+$/,16:/^[0-9a-f]+$/i}),H=Object.freeze({2:"binary",8:"octal",16:"hexadecimal"}),S=Object.freeze([[/^0x/i,16],[/^0b/i,2],[/^0o/i,8],[/^#/,16]]),O=/[\s\u00a0\u202f_,']/g,b=/^\d+(?:\.\d+)?(?:e[+-]?\d+)?$/i,c=Object.freeze([8,16,32,53]),f=new WeakSet,o=new WeakMap,n=new Map,t=new WeakMap,i=new WeakMap,s=Object.freeze({hex:Object.freeze({radix:16}),hex8:Object.freeze({radix:16,bitWidth:8,pad:!0,signed:!1}),hex16:Object.freeze({radix:16,bitWidth:16,pad:!0,signed:!1}),hex32:Object.freeze({radix:16,bitWidth:32,pad:!0,signed:!1}),binary:Object.freeze({radix:2}),binary8:Object.freeze({radix:2,bitWidth:8,pad:!0,signed:!1,group:4}),octal:Object.freeze({radix:8})});function r(L){if(L==null)return 16;const j=typeof L=="string"?L.toLowerCase():L,R=D[j];return R||(B(`radix:base:${String(L)}`,`unsupported radix ${String(L)}; use 2, 8, 16, 'binary', 'octal' or 'hex'. Falling back to hex`),16)}function u(L,j){return Math.ceil(L/Z[j])}function a(L,j){if(!L)return j?{min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}:{min:0,max:Number.MAX_SAFE_INTEGER};if(!j)return{min:0,max:2**L-1};const R=2**(L-1);return{min:-R,max:R-1}}function l(L){return H[L]||"hexadecimal"}function h(L){if(typeof L=="string"){const j=s[L];return j||B(`radix:preset:${L}`,`unknown radix preset "${L}"; known presets are ${Object.keys(s).join(", ")}`),{...j||{}}}if(L&&typeof L.preset=="string"){const j=s[L.preset];return j||B(`radix:preset:${L.preset}`,`unknown radix preset "${L.preset}"; known presets are ${Object.keys(s).join(", ")}`),{...j||{},...L}}return L||{}}function y(L){const j=h(L),R=r(j.radix),$=Z[R];let T=null;if(j.bitWidth!==void 0&&j.bitWidth!==null&&j.bitWidth!==!1){const ne=Number(j.bitWidth);c.includes(ne)?T=ne:B(`radix:width:${String(j.bitWidth)}`,`unsupported bitWidth ${String(j.bitWidth)}; use 8, 16, 32 or 53. Ignoring it`)}let A=j.signed!==!1;!A&&T===null&&(B("radix:unsigned:width","signed: false needs a bitWidth to render a two's-complement pattern; defaulting to 32"),T=32);const C=j.prefix===void 0||j.prefix===!0?K[R]:j.prefix===!1?"":String(j.prefix);let z=0;j.pad===!0?z=T?u(T,R):0:typeof j.pad=="number"&&j.pad>0&&(z=Math.floor(j.pad));let Y=0;j.group===!0?Y=I[R]:typeof j.group=="number"&&j.group>0&&(Y=Math.floor(j.group));const q=a(T,A),V=typeof j.min=="number"?Math.max(q.min,j.min):q.min,J=typeof j.max=="number"?Math.min(q.max,j.max):q.max,ee=Object.freeze({radix:R,bits:$,prefix:C,uppercase:j.uppercase!==!1,pad:z,group:Y,groupSeparator:typeof j.groupSeparator=="string"?j.groupSeparator:" ",bitWidth:T,signed:A,min:V,max:J<V?V:J,nullDisplay:typeof j.nullDisplay=="string"?j.nullDisplay:"",name:l(R)});return f.add(ee),ee}function m(L){if(L&&f.has(L))return L;if(typeof L=="string"){let j=n.get(L);return j||(j=y(L),n.set(L,j)),j}if(L&&typeof L=="object"){let j=o.get(L);return j||(j=y(L),o.set(L,j)),j}return m("hex")}function v(L){return L<0?-Math.round(-L):Math.round(L)}function d(L,j,R){if(j<=0||L.length<=j)return L;const $=L.length%j||j,T=[L.slice(0,$)];for(let A=$;A<L.length;A+=j)T.push(L.slice(A,A+j));return T.join(R)}function p(L){const j=m(L),{radix:R,prefix:$,uppercase:T,pad:A,group:C,groupSeparator:z,signed:Y,bitWidth:q,nullDisplay:V}=j,J=q?2**q:0,ee=ne=>{if(M(ne)||ne==="")return V;const oe=typeof ne=="number"?ne:Number(ne);if(!Number.isFinite(oe))return V;const re=v(oe);let ae="",fe=re;re<0&&(Y?(ae="-",fe=-re):fe=(re%J+J)%J);let de=fe.toString(R);return de=T?de.toUpperCase():de.toLowerCase(),A>0&&de.length<A&&(de=de.padStart(A,"0")),C>0&&(de=d(de,C,z)),ae+$+de};return ee.options=j,ee}function g(L,j){const R=m(j);let $=t.get(R);return $||($=p(R),t.set(R,$)),$(L)}function k(L){const j=m(L),{radix:R,groupSeparator:$,signed:T,min:A,max:C}=j,z=G[R],Y=q=>{if(M(q))return{ok:!0,value:null,reason:"blank"};let V=String(q);if($&&$!==""&&(V=V.split($).join("")),V=V.replace(O,""),V==="")return{ok:!0,value:null,reason:"blank"};let J=!1;if((V[0]==="-"||V[0]==="+")&&(J=V[0]==="-",V=V.slice(1)),V==="")return{ok:!1,value:null,reason:"digits"};let ee=null;for(const[oe,re]of S){const ae=oe.exec(V);if(!ae)continue;const fe=V.slice(ae[0].length);if(fe==="")break;if(!G[re].test(fe))return{ok:!1,value:null,reason:"digits"};ee=parseInt(fe,re);break}if(ee===null)if(z.test(V))ee=parseInt(V,R);else if(b.test(V))ee=Number(V);else return{ok:!1,value:null,reason:"digits"};if(!Number.isFinite(ee))return{ok:!1,value:null,reason:"digits"};const ne=v(J?-ee:ee);return!T&&ne<0?{ok:!1,value:ne,reason:"negative"}:ne<A||ne>C?{ok:!1,value:ne,reason:"range"}:{ok:!0,value:ne,reason:"ok"}};return Y.options=j,Y}function w(L,j){const R=m(j);let $=i.get(R);return $||($=k(R),i.set(R,$)),$(L)}function E(L,j){const R=w(L,j);return R.ok?R.value:null}function N(L,j){const R=M(L)||Number.isNaN(L)?null:Number(L),$=M(j)||Number.isNaN(j)?null:Number(j);return R===null?$===null?0:1:$===null||R<$?-1:R>$?1:0}function x(L){const j=L.min>=-2147483648&&L.max<=2147483647;return L.bitWidth&&j?"int32":"float64"}function _(L){const j=y(L),R=p(j),$=k(j);return{base:"number",extends:"number",storage:x(j),matches:null,format:T=>R(T.value),parse:T=>{const A=$(T.text);return A.ok?A.value:null},compare:N,defaults:{filter:"number",editor:"radix",total:"sum",align:"end"},excel:"General",toClipboard:T=>R(T),fromClipboard:T=>{const A=$(T);return A.ok?A.value:null},radix:j,formatValue:R,parseText:$}}const F=_}),De("packages/core/src/columns/types/aggregable.js",function(e,U){"use strict";Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"weightedMean",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"logarithmicSum",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"logarithmicMean",{enumerable:!0,get:function(){return D}});const M=U("packages/core/src/internal/predicates.js").isNil;function X(H){const S=[];for(const O of H||[]){if(M(O))continue;const b=Number(O);Number.isFinite(b)&&S.push(b)}return S}function B(H){return S=>{const O=X(S);if(!O.length)return null;let b=0;for(const c of O)b+=10**(c/H);return H*Math.log10(b)}}function D(H){return S=>{const O=X(S);if(!O.length)return null;let b=0;for(const c of O)b+=10**(c/H);return H*Math.log10(b/O.length)}}function Z(H,S){const O=S&&S.column,c=(O&&O.typeOptions||{}).weight,f=S&&S.valueAt;if(!c||typeof f!="function")return null;let o=0,n=0;for(let t=0;t<H.length;t++){if(M(H[t]))continue;const i=Number(H[t]);if(!Number.isFinite(i))continue;const s=f(c,t);if(M(s))continue;const r=Number(s);!Number.isFinite(r)||r<=0||(o+=i*r,n+=r)}return n===0?null:o/n}function K(H={}){const S=H.factor===20?20:10,O=typeof H.suffix=="string"?H.suffix:"",b=Number.isInteger(H.decimals)?H.decimals:1;return{base:"number",storage:"float64",name:H.name||"logarithmic",format:c=>{const f=c&&c.value;return M(f)||!Number.isFinite(Number(f))?"":`${Number(f).toFixed(b)}${O}`},parse:c=>{const f=String((c&&c.text)??"").replace(O,"").trim();if(!f)return null;const o=Number(f);return Number.isFinite(o)?o:null},defaults:{align:"end",filter:"number"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:{sum:B(S),avg:D(S)}}}}function I(H={}){const S=Number.isInteger(H.decimals)?H.decimals:1,O=H.percent===!0;return{base:"number",storage:"float64",name:H.name||"ratio",format:b=>{const c=b&&b.value;return M(c)||!Number.isFinite(Number(c))?"":O?`${Number(c).toFixed(S)}%`:Number(c).toFixed(S)},parse:b=>{const c=String((b&&b.text)??"").replace("%","").trim();if(!c)return null;const f=Number(c);return Number.isFinite(f)?f:null},defaults:{align:"end",filter:"number"},totals:{supported:["avg","min","max","count","countValues"],implement:{avg:Z}}}}const G=Object.freeze({decibel:K({name:"decibel",factor:10,suffix:" dB"}),decibelAmplitude:K({name:"decibelAmplitude",factor:20,suffix:" dB"}),ratio:I({name:"ratio"}),percentRate:I({name:"percentRate",percent:!0})})}),De("packages/core/src/columns/types/currency.js",function(e,U){"use strict";Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"moneyToText",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r}});const M=U("packages/core/src/internal/predicates.js").isNil,X="⚠ no rate";function B(u){if(M(u))return null;const a=String(u).trim().toUpperCase();return a===""?null:a}function D(u){if(M(u))return null;if(typeof u=="object"&&!Array.isArray(u)){const a=Number(u.amount),l=B(u.code);return!l||!Number.isFinite(a)?null:{amount:a,code:l}}if(Array.isArray(u)&&u.length===2){const a=Number(u[0]),l=B(u[1]);return!l||!Number.isFinite(a)?null:{amount:a,code:l}}return null}const Z=Object.freeze({$:"USD","€":"EUR","£":"GBP","¥":"JPY","₹":"INR","₩":"KRW","₽":"RUB","₺":"TRY","₴":"UAH","₪":"ILS"}),K=Object.freeze({USD:"$",EUR:"€",GBP:"£",JPY:"¥",INR:"₹",KRW:"₩",RUB:"₽",TRY:"₺",UAH:"₴",ILS:"₪"}),I=/[+-]?[\d\s., ]*\d/;function G(u,a){const l=String(u).trim();if(l==="")return null;const h=new Intl.NumberFormat(a||void 0).formatToParts(1.1).find(d=>d.type==="decimal")?.value||".",y=h===","?".":",",m=l.split(y).join("").split(/[\s ]/).join("").replace(h,"."),v=Number(m);return Number.isFinite(v)?v:null}function H(u,a){const l=a||{},h=B(l.code);if(M(u))return null;const y=D(u);if(y)return y;if(typeof u=="number")return Number.isFinite(u)&&h?{amount:u,code:h}:null;let m=String(u).trim();if(m==="")return null;let v=!1;m.startsWith("(")&&m.endsWith(")")&&(v=!0,m=m.slice(1,-1).trim());let d=null;for(const[N,x]of Object.entries(Z)){if(m.startsWith(N)){d=x,m=m.slice(N.length).trim();break}if(m.endsWith(N)){d=x,m=m.slice(0,-N.length).trim();break}}const p=I.exec(m);if(!p)return null;const g=G(p[0],l.locale);if(g===null)return null;const k=(m.slice(0,p.index)+" "+m.slice(p.index+p[0].length)).trim();!d&&k!==""&&(d=B(k));const w=d||h;return w?{amount:v?-g:g,code:w}:null}function S(u,a){if(typeof u=="function")return(l,h)=>{if(l===h)return 1;const y=u(l,h);return typeof y=="number"&&Number.isFinite(y)&&y>0?y:null};if(u&&typeof u=="object"){const l=u;return(h,y)=>{if(h===y)return 1;const m=Number(l[h]),v=Number(l[y]);return!Number.isFinite(m)||!Number.isFinite(v)||m<=0||v<=0?null:v/m}}return(l,h)=>l===h?1:null}function O(u,a,l){if(!u)return null;if(u.code===a)return u.amount;const h=l(u.code,a);return h===null?null:u.amount*h}const b=new Map;function c(u,a,l){const h=`${u||""}|${a}|${l??""}`;let y=b.get(h);if(!y){const m={style:"currency",currency:a};typeof l=="number"&&(m.minimumFractionDigits=l,m.maximumFractionDigits=l);try{y={fmt:new Intl.NumberFormat(u||void 0,m),currency:!0}}catch{y={fmt:new Intl.NumberFormat(u||void 0,typeof l=="number"?{minimumFractionDigits:l,maximumFractionDigits:l}:{}),currency:!1}}b.set(h,y)}return y}function f(u,a){const l=a||{},h=l.nullDisplay??"",y=D(u);if(!y)return h;const m=B(l.display)||y.code;let v=y.amount,d=y.code;if(m!==y.code){const k=l.rateFn||S(l.rates,l.rateBase),w=O(y,m,k);if(w===null)return`${l.missingRate??X} ${y.code}→${m}`;v=w,d=m}const{fmt:p,currency:g}=c(l.locale,d,l.decimals);return g?p.format(v):`${p.format(v)} ${d}`}function o(u){const a=D(u);return a?`${a.amount} ${a.code}`:""}function n(u){const a=u||{},l=B(a.display),h=a.rateFn||S(a.rates,a.rateBase);return(y,m)=>{const v=D(y),d=D(m);if(!v&&!d)return 0;if(!v)return 1;if(!d)return-1;if(l){const p=O(v,l,h),g=O(d,l,h);if(p!==null&&g!==null)return p===g?0:p<g?-1:1}return v.code===d.code?v.amount===d.amount?0:v.amount<d.amount?-1:1:v.code<d.code?-1:1}}function t(u){const a=u||{},l=(y,m)=>{const v=[];for(const w of y||[]){const E=D(w);E&&v.push(E)}if(!v.length)return null;if(new Set(v.map(w=>w.code)).size===1){const w=v[0].code;return{amount:m(v.map(E=>E.amount)),code:w}}const p=B(a.display);if(!p)return`${a.missingRate??X}: mixed currencies, no display currency set`;const g=a.rateFn||S(a.rates,a.rateBase),k=[];for(const w of v){const E=O(w,p,g);if(E===null)return`${a.missingRate??X}: ${w.code}→${p}`;k.push(E)}return{amount:m(k),code:p}},h=y=>y.reduce((m,v)=>m+v,0);return{sum:y=>l(y,h),avg:y=>l(y,m=>h(m)/m.length),min:y=>l(y,m=>Math.min(...m)),max:y=>l(y,m=>Math.max(...m))}}function i(u){const a=Object.freeze({code:"USD",...u||{}}),l=S(a.rates,a.rateBase),h=Object.freeze({...a,rateFn:l}),y=t(h),m=n(h),v=new Map([[a.locale||"",h]]),d=k=>{const w=k||"";let E=v.get(w);return E||(E=Object.freeze({...h,locale:k||void 0}),v.set(w,E)),E},p=K[B(a.display||a.code)]||"",g=typeof a.decimals=="number"&&a.decimals>0?`.${"0".repeat(a.decimals)}`:".00";return{base:"object",extends:"object",storage:"object",name:"currency",currencyConfig:h,format:k=>f(k.value,k.locale?d(k.locale):h),parse:k=>H(k.text,k.locale?d(k.locale):h),compare:m,defaults:{filter:"number",editor:"currency",align:"end",total:"sum"},totals:{supported:["sum","avg","min","max","count","countValues"],implement:y},excel:a.excel||(p?`"${p}"#,##0${g}`:`#,##0${g}`),toStorage:k=>{const w=D(k);return w||(typeof k=="string"||typeof k=="number"?H(k,h):null)},toClipboard:k=>o(k),fromClipboard:k=>H(k,h)}}const s=Object.freeze({currency:i({code:"USD"}),usd:i({code:"USD"}),eur:i({code:"EUR"}),gbp:i({code:"GBP"}),jpy:i({code:"JPY",decimals:0})}),r=i}),De("packages/core/src/columns/types/index.js",function(e,U){"use strict";Object.defineProperty(e,"EXTENDED_TYPES",{enumerable:!0,get:function(){return V}}),Object.defineProperty(e,"createUnitType",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"UNIT_SYSTEMS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"parseUnit",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"formatUnit",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"registerUnitSystem",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"unitSystemNames",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"unitsOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"defineUnit",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SI_TYPES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"createSiType",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"createSiSystem",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"siUnits",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SI_PREFIXES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"createRadixType",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"RADIX_PRESETS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"parseRadix",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"formatRadix",{enumerable:!0,get:function(){return N}});const te=U("packages/core/src/columns/types/temporal.js"),M=te.TEMPORAL_TYPES,X=U("packages/core/src/columns/types/network.js"),B=X.NETWORK_TYPES,D=U("packages/core/src/columns/types/structured.js"),Z=D.STRUCTURED_TYPES,K=U("packages/core/src/columns/types/unit.js"),I=K.createUnitType,G=K.UNIT_SYSTEMS,H=K.parseUnit,S=K.formatUnit,O=K.registerUnitSystem,b=K.unitSystemNames,c=K.unitsOf,f=K.defineUnit,o=U("packages/core/src/columns/types/engineering.js"),n=o.ENGINEERING_TYPES,t=U("packages/core/src/columns/types/si.js"),i=t.SI_TYPES,s=t.createSiType,r=t.createSiSystem,u=t.siUnits,a=t.SI_PREFIXES,l=U("packages/core/src/columns/types/temperature.js"),h=l.TEMPERATURE_TYPES,y=l.createTemperatureType,m=l.convertTemperature,v=l.formatTemperature,d=l.parseTemperature,p=l.TEMPERATURE_SCALES,g=U("packages/core/src/columns/types/radix.js"),k=g.createRadixType,w=g.RADIX_PRESETS,E=g.parseRadix,N=g.formatRadix,x=U("packages/core/src/columns/types/aggregable.js"),_=x.AGGREGABLE_TYPES,F=U("packages/core/src/columns/types/currency.js"),L=F.CURRENCY_TYPES,j=F.createCurrencyType,R=F.parseMoney,$=F.formatMoney,T=F.convertMoney,A=F.toMoney,C=F.rateFunction,z=F.moneyComparator,Y=F.normaliseCode,q=F.MISSING_RATE;Object.defineProperty(e,"findUnit",{enumerable:!0,get:function(){return K.findUnit}}),Object.defineProperty(e,"ENGINEERING_TYPES",{enumerable:!0,get:function(){return o.ENGINEERING_TYPES}}),Object.defineProperty(e,"circularMean",{enumerable:!0,get:function(){return o.circularMean}}),Object.defineProperty(e,"TEMPERATURE_TYPES",{enumerable:!0,get:function(){return l.TEMPERATURE_TYPES}}),Object.defineProperty(e,"createTemperatureType",{enumerable:!0,get:function(){return l.createTemperatureType}}),Object.defineProperty(e,"convertTemperature",{enumerable:!0,get:function(){return l.convertTemperature}}),Object.defineProperty(e,"formatTemperature",{enumerable:!0,get:function(){return l.formatTemperature}}),Object.defineProperty(e,"parseTemperature",{enumerable:!0,get:function(){return l.parseTemperature}}),Object.defineProperty(e,"TEMPERATURE_SCALES",{enumerable:!0,get:function(){return l.TEMPERATURE_SCALES}}),Object.defineProperty(e,"findScale",{enumerable:!0,get:function(){return l.findScale}}),Object.defineProperty(e,"CURRENCY_TYPES",{enumerable:!0,get:function(){return F.CURRENCY_TYPES}}),Object.defineProperty(e,"createCurrencyType",{enumerable:!0,get:function(){return F.createCurrencyType}}),Object.defineProperty(e,"parseMoney",{enumerable:!0,get:function(){return F.parseMoney}}),Object.defineProperty(e,"formatMoney",{enumerable:!0,get:function(){return F.formatMoney}}),Object.defineProperty(e,"convertMoney",{enumerable:!0,get:function(){return F.convertMoney}}),Object.defineProperty(e,"toMoney",{enumerable:!0,get:function(){return F.toMoney}}),Object.defineProperty(e,"rateFunction",{enumerable:!0,get:function(){return F.rateFunction}}),Object.defineProperty(e,"moneyComparator",{enumerable:!0,get:function(){return F.moneyComparator}}),Object.defineProperty(e,"normaliseCode",{enumerable:!0,get:function(){return F.normaliseCode}}),Object.defineProperty(e,"MISSING_RATE",{enumerable:!0,get:function(){return F.MISSING_RATE}}),Object.defineProperty(e,"TEMPORAL_TYPES",{enumerable:!0,get:function(){return te.TEMPORAL_TYPES}}),Object.defineProperty(e,"NETWORK_TYPES",{enumerable:!0,get:function(){return X.NETWORK_TYPES}}),Object.defineProperty(e,"STRUCTURED_TYPES",{enumerable:!0,get:function(){return D.STRUCTURED_TYPES}}),Object.defineProperty(e,"AGGREGABLE_TYPES",{enumerable:!0,get:function(){return x.AGGREGABLE_TYPES}}),Object.defineProperty(e,"createLogarithmicType",{enumerable:!0,get:function(){return x.createLogarithmicType}}),Object.defineProperty(e,"createRatioType",{enumerable:!0,get:function(){return x.createRatioType}}),Object.defineProperty(e,"parseTime",{enumerable:!0,get:function(){return te.parseTime}}),Object.defineProperty(e,"formatTime",{enumerable:!0,get:function(){return te.formatTime}}),Object.defineProperty(e,"parseDateTime",{enumerable:!0,get:function(){return te.parseDateTime}}),Object.defineProperty(e,"formatDateTime",{enumerable:!0,get:function(){return te.formatDateTime}}),Object.defineProperty(e,"parseDuration",{enumerable:!0,get:function(){return te.parseDuration}}),Object.defineProperty(e,"formatDuration",{enumerable:!0,get:function(){return te.formatDuration}}),Object.defineProperty(e,"parseIpv4",{enumerable:!0,get:function(){return X.parseIpv4}}),Object.defineProperty(e,"formatIpv4",{enumerable:!0,get:function(){return X.formatIpv4}}),Object.defineProperty(e,"parseCidr",{enumerable:!0,get:function(){return X.parseCidr}}),Object.defineProperty(e,"formatCidr",{enumerable:!0,get:function(){return X.formatCidr}}),Object.defineProperty(e,"parseIpv6",{enumerable:!0,get:function(){return X.parseIpv6}}),Object.defineProperty(e,"formatIpv6",{enumerable:!0,get:function(){return X.formatIpv6}}),Object.defineProperty(e,"networkAddress",{enumerable:!0,get:function(){return X.networkAddress}}),Object.defineProperty(e,"broadcastAddress",{enumerable:!0,get:function(){return X.broadcastAddress}}),Object.defineProperty(e,"hostCount",{enumerable:!0,get:function(){return X.hostCount}}),Object.defineProperty(e,"containsAddress",{enumerable:!0,get:function(){return X.containsAddress}}),Object.defineProperty(e,"overlaps",{enumerable:!0,get:function(){return X.overlaps}}),Object.defineProperty(e,"maskValue",{enumerable:!0,get:function(){return D.maskValue}}),Object.defineProperty(e,"summariseJson",{enumerable:!0,get:function(){return D.summariseJson}});const V=Object.freeze({...M,...B,...Z,..._,hex:k(w.hex),hex8:k(w.hex8),hex16:k(w.hex16),hex32:k(w.hex32),binary:k(w.binary),binary8:k(w.binary8),octal:k(w.octal),bytes:I({system:"data",unit:"B",display:"auto"}),megabytes:I({system:"data",unit:"MB"}),gigabytes:I({system:"data",unit:"GB"}),bitrate:I({system:"bitrate",unit:"Mbps"}),gigabits:I({system:"bitrate",unit:"Gbps"}),...n,...i,...h,...L});{const J=new Set;for(const ee of[M,B,Z,_,n,i,h,L])for(const ne of Object.keys(ee)){if(J.has(ne))throw new Error(`[lattice] data type "${ne}" is declared twice`);J.add(ne)}}}),De("packages/core/src/compute/handle.js",function(e,U){"use strict";Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return i}});const te=U("packages/core/src/internal/compare.js"),M=te.collator,X=te.defaultCompare,D=U("packages/core/src/internal/warn.js").warnOnce;function Z(s){const r=new Uint32Array(s);for(let u=0;u<s;u++)r[u]=u;return r}function K(s,r){if(r&&typeof r.count=="number")return r.count;if(!s)return 0;if(typeof s.count=="number")return s.count;if(typeof s.length=="number")return s.length;const u=s.values;return s.kind==="multi"&&s.offsets?Math.max(0,s.offsets.length-1):u?s.kind==="bitset"?typeof u.size=="number"?u.size:s.presence&&typeof s.presence.size=="number"?s.presence.size:(D(`count:${s.id}`,`column "${s.id}" is bitset-backed with no declared row count; assuming ${u.length*8}`),u.length*8):u.length:s.presence&&typeof s.presence.size=="number"?s.presence.size:0}const I=new WeakMap;function G(s){const r=s.constructor;if(!r)return"unknown";const u=I.get(r);if(u)return u;let a="unknown";try{let l=null;typeof r.from=="function"?l=r.from([!1,!0]):(l=new r(8),l.set(1));const h=l&&l.words;h&&h.length&&(h[0]===2?a="lsb":h[0]===64&&(a="msb"))}catch{a="unknown"}return I.set(r,a),a}function H(s){if(!s)return()=>0;const r=s instanceof Uint8Array?s:s.words;if(r instanceof Uint8Array){const u=s instanceof Uint8Array?"lsb":G(s);if(u==="lsb")return a=>r[a>>>3]>>>(a&7)&1;if(u==="msb")return a=>r[a>>>3]>>>7-(a&7)&1}return typeof s.get=="function"?u=>s.get(u)?1:0:()=>0}function S(s){return!s||!s.presence?null:H(s.presence)}function O(s){return s?typeof s.size=="number"?s.size:typeof s.values=="function"?s.values().length:0:0}function b(s,r){return s?typeof s.valueOf=="function"?s.valueOf(r):typeof s.values=="function"?s.values()[r]:null:null}function c(s,r){const u=s.offsets,a=s.values;if(!u||!a)return[];const l=u[r],h=u[r+1];if(!(h>l))return[];const y=s.dict,m=new Array(h-l);for(let v=l;v<h;v++)m[v-l]=y?b(y,a[v]):a[v];return m}function f(s){if(!s)return()=>{};const r=s.values,u=S(s),a=s.kind;if(a==="dictionary"){const l=s.dict;return u?h=>u(h)?b(l,r[h]):null:h=>b(l,r[h])}if(a==="bitset"){const l=H(r);return u?h=>u(h)?l(h)===1:null:h=>l(h)===1}if(a==="multi")return u?l=>u(l)?c(s,l):null:l=>c(s,l);if(!r&&typeof s.get=="function"){const l=s.get.bind(s);return h=>{const y=l(h);return y===void 0?null:y}}return u?l=>{if(!u(l))return null;const h=r[l];return h===void 0?null:h}:l=>{const h=r[l];return h===void 0?null:h}}function o(s,r){if(s<r)return-1;if(s>r)return 1;if(s===r){const l=Object.is(s,-0),h=Object.is(r,-0);return l===h?0:l?-1:1}const u=Number.isNaN(s),a=Number.isNaN(r);return u&&a?0:u?1:-1}function n(s){const r=M(s);return(u,a)=>{if(u===a)return 0;const l=typeof u,h=typeof a;if(l==="string"&&h==="string")return r.compare(u,a);if(l==="number"&&h==="number")return o(u,a);if(l==="boolean"&&h==="boolean")return u===a?0:u?1:-1;if(u instanceof Date||a instanceof Date){const y=u instanceof Date?u.getTime():Number(u),m=a instanceof Date?a.getTime():Number(a);return o(y,m)}return X(u,a)}}function t(s,r){if(s&&typeof s.ranks=="function")return s.ranks(r);const u=s&&typeof s.values=="function"?s.values():[],a=u.length,l=n(r),h=new Array(a);for(let m=0;m<a;m++)h[m]=m;h.sort((m,v)=>l(u[m],u[v])||m-v);const y=new Uint32Array(a);for(let m=0;m<a;m++)y[h[m]]=m;return y}function i(s){return s==null||typeof s=="number"&&Number.isNaN(s)}}),De("packages/core/src/compute/filter.js",function(e,U){"use strict";Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"wallMs",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"itemwisePredicate",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return q}}),Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return J}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(e,"declareOperators",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(e,"declaredOperator",{enumerable:!0,get:function(){return fe}});const M=U("packages/core/src/internal/predicates.js").isBlank,B=U("packages/core/src/internal/merge.js").toArray,Z=U("packages/core/src/internal/warn.js").warnOnce,K=U("packages/core/src/format/date.js"),I=K.toDate,G=K.toIsoDate,H=U("packages/core/src/compute/handle.js"),S=H.bitReader,O=H.dictSize,b=H.dictValue,c=H.presenceReader,f=H.valueComparator,o=H.valueReader,n=/^\d{4}-\d{2}-\d{2}$/,t="\0null\0";function i(de,ve){const Ie=de&&de.pool;if(Ie){const Le=Ie.mask||Ie.acquireMask||Ie.acquire||Ie.take;if(typeof Le=="function"){const se=Le.call(Ie,ve);if(se&&se.length>=ve)return se}}return new Uint8Array(ve)}function s(de,ve){const Ie=de&&de.pool;if(!Ie||!ve)return;const Le=Ie.release||Ie.releaseMask||Ie.free||Ie.recycle;typeof Le=="function"&&Le.call(Ie,ve)}function r(de,ve,Ie){return de.fill(Ie,0,ve),de}function u(de){return de==null||typeof de=="number"&&Number.isNaN(de)}function a(de,ve){if(de==null)return de;if(ve==="number")return typeof de=="number"?de:Number(de);if(ve==="date"||ve==="dateString"){const Ie=G(de);return Ie===null?l(de):Ie}return ve==="boolean"?typeof de=="boolean"?de:de==="true"||de===1?!0:de==="false"||de===0?!1:!!de:de}function l(de){return de instanceof Date?de.getTime():typeof de=="number"?de:Date.parse(String(de))}function h(de){return typeof de=="number"?de:de instanceof Date?de.getTime():de==null||de===""?NaN:Number(de)}function y(de,ve){const Ie=typeof de=="string"?de:String(de);return ve?Ie:Ie.toLowerCase()}function m(de,ve){return de==null?t:typeof de=="string"?ve?de:de.toLowerCase():de instanceof Date?de.getTime():de}function v(de,ve,Ie){const Le=new Set;for(const se of B(de)){const pe=a(se,Ie);Le.add(m(pe,ve)),typeof pe=="string"&&pe!==""&&Number.isFinite(Number(pe))?Le.add(Number(pe)):typeof pe=="number"&&Number.isFinite(pe)&&Le.add(m(String(pe),ve))}return Le}function d(de,ve,Ie){if(de==null||ve===null||ve===void 0)return de==null&&ve==null;const Le=typeof de,se=typeof ve;return Le==="string"&&se==="string"?Ie?de===ve:de.toLowerCase()===ve.toLowerCase():de instanceof Date||ve instanceof Date?l(de)===l(ve):Le==="number"&&se==="number"?de===ve||Number.isNaN(de)&&Number.isNaN(ve):Le==="number"&&se==="string"?de===Number(ve):Le==="string"&&se==="number"?Number(de)===ve:Le==="boolean"||se==="boolean"?de===ve:Array.isArray(de)&&Array.isArray(ve)?de.length===ve.length&&de.every((pe,be)=>d(pe,ve[be],Ie)):de===ve}function p(de,ve){try{if(de instanceof RegExp){const Ie=de.flags.replace(/[gy]/g,"");return new RegExp(de.source,ve||Ie.includes("i")?Ie:`${Ie}i`)}return new RegExp(String(de),ve?"":"i")}catch(Ie){return Z(`regex:${String(de)}`,`filter operator "matches" received an invalid pattern: ${String(de)}`,Ie),null}}function g(de,ve){if(de&&de.type==="datetime"&&k.has(de.op))return _(de,ve);const Ie=F(de,ve),Le=de&&de.type;return Le!=="date"&&Le!=="dateString"?Ie:se=>Ie(typeof se=="string"&&n.test(se)?se:G(se)??se)}const k=new Set(["eq","ne","lt","lte","gt","gte","between","notBetween","in","notIn"]),w=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{1,3})\d*)?)?)?$/,E=new Map;function N(de,ve){let Ie=E.get(ve);if(Ie===void 0){try{Ie=new Intl.DateTimeFormat("en-CA",{timeZone:ve,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{Ie=null}E.set(ve,Ie)}if(!Ie)return null;const Le={};for(const se of Ie.formatToParts(de))se.type!=="literal"&&(Le[se.type]=se.value);return Le}function x(de,ve){if(de==null||de==="")return null;if(typeof de=="string"){const pe=w.exec(de.trim());if(pe)return Date.UTC(+pe[1],+pe[2]-1,+pe[3],+(pe[4]||0),+(pe[5]||0),+(pe[6]||0),+(pe[7]||"0").padEnd(3,"0"))}const Ie=I(de);if(!Ie)return null;const Le=Ie.getUTCMilliseconds(),se=ve?N(Ie,ve):null;return se?Date.UTC(+se.year,+se.month-1,+se.day,se.hour==="24"?0:+se.hour,+se.minute,+se.second,Le):Date.UTC(Ie.getFullYear(),Ie.getMonth(),Ie.getDate(),Ie.getHours(),Ie.getMinutes(),Ie.getSeconds(),Le)}function _(de,ve){const Ie=typeof de.timeZone=="string"&&de.timeZone?de.timeZone:void 0,Le=be=>x(be,Ie),se=Array.isArray(de.value)?de.value.map(Le):Le(de.value),pe=F({...de,type:"number",value:se},ve);return be=>pe(x(be))}function F(de,ve){const Ie=de&&de.op,Le=!!(de&&de.caseSensitive),se=de&&de.type,pe=f(ve),be=ke=>je=>!ke(je);switch(Ie){case"eq":{const ke=a(de.value,se);return je=>d(je,ke,Le)}case"ne":{const ke=a(de.value,se);return je=>!d(je,ke,Le)}case"lt":case"lte":case"gt":case"gte":{const ke=a(de.value,se);if(u(ke))return()=>!1;const je=Ie==="lt"?-1:Ie==="lte"?0:Ie==="gt"?1:2;return xe=>{if(u(xe))return!1;const ge=pe(xe,ke);return je===-1?ge<0:je===0?ge<=0:je===1?ge>0:ge>=0}}case"between":case"notBetween":{const ke=B(de.value),je=a(ke[0],se),xe=a(ke[1],se),ge=de.bounds||"[]",we=ge.charAt(0)!=="(",Me=ge.charAt(1)!==")";if(u(je)||u(xe))return Ie==="between"?()=>!1:()=>!0;const Ye=Ae=>{if(u(Ae))return!1;const Ve=pe(Ae,je),Pe=pe(Ae,xe);return(we?Ve>=0:Ve>0)&&(Me?Pe<=0:Pe<0)};return Ie==="between"?Ye:be(Ye)}case"in":case"notIn":{const ke=v(de.value,Le,se),je=xe=>ke.has(m(xe,Le));return Ie==="in"?je:be(je)}case"contains":case"notContains":{const ke=y(a(de.value,se),Le),je=xe=>xe==null?!1:y(xe,Le).includes(ke);return Ie==="contains"?je:be(je)}case"startsWith":{const ke=y(a(de.value,se),Le);return je=>je==null?!1:y(je,Le).startsWith(ke)}case"endsWith":{const ke=y(a(de.value,se),Le);return je=>je==null?!1:y(je,Le).endsWith(ke)}case"matches":{const ke=p(de.value,Le);return ke?je=>je==null?!1:ke.test(String(je)):()=>!1}case"blank":return ke=>M(ke)||Array.isArray(ke)&&ke.length===0;case"notBlank":return ke=>!(M(ke)||Array.isArray(ke)&&ke.length===0);case"containsAny":case"containsNone":{const ke=v(de.value,Le,se),je=xe=>{const ge=xe==null?[]:B(xe);for(let we=0;we<ge.length;we++)if(ke.has(m(ge[we],Le)))return!0;return!1};return Ie==="containsAny"?je:be(je)}case"containsAll":{const ke=B(de.value).map(je=>m(a(je,se),Le));return je=>{const xe=je==null?[]:B(je);if(ke.length===0)return!0;const ge=new Set(xe.map(we=>m(we,Le)));for(let we=0;we<ke.length;we++)if(!ge.has(ke[we]))return!1;return!0}}default:{const ke=fe(Ie);return ke?ke.compile(de.value):(Z(`op:${String(Ie)}`,`unknown filter operator "${String(Ie)}"; the condition is refused rather than matching every row`),()=>!1)}}}function L(de,ve,Ie){return g(ve,Ie)(de)}const j=Object.freeze({ne:"eq",notIn:"in",notBetween:"between",notContains:"contains"}),R=new Set(["containsAny","containsAll","containsNone"]);function $(de,ve,Ie){const Le=de&&de.op,se=j[Le]||Le,pe=g({...de,op:se,type:ve.type},Ie),be=ve.items,ke=je=>{const xe=be(je);if(!xe)return!1;for(let ge=0;ge<xe.length;ge++)if(pe(xe[ge]))return!0;return!1};return j[Le]?je=>!ke(je):ke}function T(de,ve,Ie,Le){const se=c(de);if(se){const ke=ve?1:0;for(let je=0;je<Le;je++)Ie[je]=se(je)===ke?1:0;return Ie}const pe=de.kind;if(pe==="float64"||pe==="int32"||pe==="bitset")return r(Ie,Le,ve?1:0);const be=o(de);for(let ke=0;ke<Le;ke++){const je=be(ke),xe=M(je)||Array.isArray(je)&&je.length===0;Ie[ke]=xe===ve?0:1}return Ie}function A(de,ve,Ie,Le){const se=de.dict,pe=O(se),be=new Uint8Array(pe);for(let ge=0;ge<pe;ge++)be[ge]=ve(b(se,ge))?1:0;const ke=de.values,je=c(de);if(!je){for(let ge=0;ge<Le;ge++)Ie[ge]=be[ke[ge]];return Ie}const xe=ve(null)?1:0;for(let ge=0;ge<Le;ge++)Ie[ge]=je(ge)===1?be[ke[ge]]:xe;return Ie}function C(de,ve,Ie,Le){const se=S(de.values),pe=ve(!0)?1:0,be=ve(!1)?1:0,ke=c(de);if(!ke){for(let xe=0;xe<Le;xe++)Ie[xe]=se(xe)===1?pe:be;return Ie}const je=ve(null)?1:0;for(let xe=0;xe<Le;xe++)Ie[xe]=ke(xe)===0?je:se(xe)===1?pe:be;return Ie}function z(de,ve,Ie,Le,se){const pe=de.values,be=ve.type,ke=ve.op;let je=!0;switch(ke){case"eq":case"ne":{const ge=h(a(ve.value,be)),we=typeof ve.value=="number"&&Number.isNaN(ve.value),Me=ke==="ne"?1:0;if(we)for(let Ye=0;Ye<se;Ye++)Le[Ye]=(Number.isNaN(pe[Ye])?1:0)^Me;else for(let Ye=0;Ye<se;Ye++)Le[Ye]=(pe[Ye]===ge?1:0)^Me;break}case"lt":{const ge=h(a(ve.value,be));for(let we=0;we<se;we++)Le[we]=pe[we]<ge?1:0;break}case"lte":{const ge=h(a(ve.value,be));for(let we=0;we<se;we++)Le[we]=pe[we]<=ge?1:0;break}case"gt":{const ge=h(a(ve.value,be));for(let we=0;we<se;we++)Le[we]=pe[we]>ge?1:0;break}case"gte":{const ge=h(a(ve.value,be));for(let we=0;we<se;we++)Le[we]=pe[we]>=ge?1:0;break}case"between":case"notBetween":{const ge=B(ve.value),we=h(a(ge[0],be)),Me=h(a(ge[1],be)),Ye=ve.bounds||"[]",Ae=Ye.charAt(0)!=="(",Ve=Ye.charAt(1)!==")",Pe=ke==="notBetween"?1:0;if(Ae&&Ve)for(let Oe=0;Oe<se;Oe++)Le[Oe]=(pe[Oe]>=we&pe[Oe]<=Me?1:0)^Pe;else if(Ae)for(let Oe=0;Oe<se;Oe++)Le[Oe]=(pe[Oe]>=we&pe[Oe]<Me?1:0)^Pe;else if(Ve)for(let Oe=0;Oe<se;Oe++)Le[Oe]=(pe[Oe]>we&pe[Oe]<=Me?1:0)^Pe;else for(let Oe=0;Oe<se;Oe++)Le[Oe]=(pe[Oe]>we&pe[Oe]<Me?1:0)^Pe;break}case"in":case"notIn":{const ge=new Set;for(const Me of B(ve.value)){const Ye=h(a(Me,be));Number.isNaN(Ye)||ge.add(Ye)}const we=ke==="notIn"?1:0;for(let Me=0;Me<se;Me++)Le[Me]=(ge.has(pe[Me])?1:0)^we;break}default:je=!1;break}if(!je)return!1;const xe=c(de);if(xe){const ge=Ie(null)?1:0;for(let we=0;we<se;we++)xe(we)===0&&(Le[we]=ge)}return!0}function Y(de,ve,Ie,Le){const se=o(de);for(let pe=0;pe<Le;pe++)Ie[pe]=ve(se(pe))?1:0;return Ie}function q(de,ve,Ie){const Le=ve.count|0,se=Ie||i(ve,Le);if(!de)return r(se,Le,1);const pe=typeof ve.handle=="function"?ve.handle(de.col):void 0,be=typeof ve.custom=="function"?ve.custom:null;if(!pe){if(be){for(let ge=0;ge<Le;ge++)se[ge]=be(de,ge)?1:0;return se}return Z(`filter:col:${String(de.col)}`,`filter references unknown column "${String(de.col)}"; the condition is refused rather than matching every row`),r(se,Le,0)}const ke=de.op;if(ke==="blank"||ke==="notBlank")return T(pe,ke==="notBlank",se,Le);const je=typeof ve.itemwise=="function"?ve.itemwise(de.col):null;if(je&&!fe(ke)&&!R.has(ke))return Y(pe,$(de,je,ve.locale),se,Le);const xe=g(de,ve.locale);switch(pe.kind){case"dictionary":return A(pe,xe,se,Le);case"bitset":return C(pe,xe,se,Le);case"float64":case"int32":return z(pe,de,xe,se,Le)?se:Y(pe,xe,se,Le);default:return Y(pe,xe,se,Le)}}function V(de,ve,Ie){if(!de)return r(i(ve,Ie),Ie,1);if(Array.isArray(de.conditions)){const Le=de.conditions.filter(be=>be!=null),se=de.op==="or"?"or":de.op==="not"?"not":"and";if(Le.length===0)return r(i(ve,Ie),Ie,1);const pe=V(Le[0],ve,Ie);for(let be=1;be<Le.length;be++){const ke=V(Le[be],ve,Ie);if(se==="or")for(let je=0;je<Ie;je++)pe[je]|=ke[je];else for(let je=0;je<Ie;je++)pe[je]&=ke[je];s(ve,ke)}if(se==="not")for(let be=0;be<Ie;be++)pe[be]^=1;return pe}return q(de,ve,i(ve,Ie))}function J(de,ve){return V(de,ve,ve.count|0)}function ee(de,ve){if(!de||!ve)return de||null;const Ie=de;if(Array.isArray(Ie.conditions)){if((Ie.op==="or"?"or":Ie.op==="not"?"not":"and")!=="and")return ne(Ie,ve)?null:de;const se=[];for(const pe of Ie.conditions){const be=ee(pe,ve);be&&se.push(be)}return se.length?{...Ie,op:"and",conditions:se}:null}return Ie.col===ve?null:de}function ne(de,ve){if(!de||typeof de!="object")return!1;const Ie=de;if(Ie.col===ve)return!0;if(Array.isArray(Ie.conditions)){for(const Le of Ie.conditions)if(ne(Le,ve))return!0}return!1}function oe(de,ve,Ie){if(Ie&&Ie.length>=ve){let be=0;for(let ke=0;ke<ve;ke++)de[ke]&&(Ie[be++]=ke);return Ie.subarray(0,be)}let Le=0;for(let be=0;be<ve;be++)Le+=de[be]?1:0;const se=new Uint32Array(Le);let pe=0;for(let be=0;be<ve;be++)de[be]&&(se[pe++]=be);return se}const re=new Map;function ae(de){if(!(!de||typeof de!="object"))for(const[ve,Ie]of Object.entries(de))Ie&&typeof Ie.compile=="function"&&re.set(ve,Ie)}function fe(de){return typeof de=="string"?re.get(de):void 0}}),De("packages/core/src/columns/datatypes.js",function(e,U){"use strict";Object.defineProperty(e,"localeSeparators",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"parseNumberText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BUILTIN_TYPES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"INFERENCE_ORDER",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"createTypeRegistry",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"comparatorFor",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"storageKind",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"typeLabel",{enumerable:!0,get:function(){return $}});const te=U("packages/core/src/internal/compare.js"),M=te.collator,X=te.defaultCompare,B=U("packages/core/src/internal/predicates.js"),D=B.isNil,Z=B.isObject,K=B.isFunction,G=U("packages/core/src/internal/warn.js").fail,S=U("packages/core/src/internal/text.js").titleCase,O=U("packages/core/src/format/date.js"),b=O.toDate,c=O.toIsoDate,f=O.compareIso,n=U("packages/core/src/format/boolean.js").toTriState,i=U("packages/core/src/columns/types/index.js").EXTENDED_TYPES,s=U("packages/core/src/formula/index.js"),r=s.evaluateFormula,u=s.looksLikeFormula,l=U("packages/core/src/compute/filter.js").declareOperators,h=/^\d{4}-\d{2}-\d{2}$/;function y(T){return T.getHours()===0&&T.getMinutes()===0&&T.getSeconds()===0&&T.getMilliseconds()===0}const m=new Map;function v(T){const A=T||"",C=m.get(A);if(C)return C;const z={group:",",decimal:"."};try{for(const Y of new Intl.NumberFormat(T||void 0).formatToParts(12345.6))Y.type==="group"?z.group=Y.value:Y.type==="decimal"&&(z.decimal=Y.value)}catch{}return m.set(A,z),z}const d=/\d\s*[*/^]\s*[\d.(]/;function p(T,A){if(D(T))return null;let C=String(T).trim();if(C===""||C.startsWith("=")||d.test(C))return null;let z=1;C.startsWith("(")&&C.endsWith(")")&&(z=-1,C=C.slice(1,-1));const Y=C.endsWith("%"),{group:q,decimal:V}=v(A);if(C=C.replace(/[\s\u00a0\u202f\u2009']/g,""),q&&q!=="."&&q!==","&&(C=C.split(q).join("")),C=C.replace(/[^0-9eE+\-.,]/g,""),V===","?C=C.split(".").join("").replace(",","."):C=C.split(",").join(""),C===""||C==="-"||C==="+")return null;const J=Number(C);return Number.isNaN(J)?null:z*(Y?J/100:J)}function g(T,A){const C=D(T)||Number.isNaN(T)?null:Number(T),z=D(A)||Number.isNaN(A)?null:Number(A);return C===null?z===null?0:1:z===null||C<z?-1:C>z?1:0}function k(T,A){const C=n(T),z=n(A);return C===null?z===null?0:1:z===null?-1:C===z?0:C?1:-1}function w(T,A){const C=b(T),z=b(A);if(!C)return z?1:0;if(!z)return-1;const Y=C.getTime(),q=z.getTime();return Y<q?-1:Y>q?1:0}const E=new Map;function N(T){const A=b(T.value);if(!A)return"";const C=T.locale||"";let z=E.get(C);return z||(z=new Intl.DateTimeFormat(T.locale||void 0,{dateStyle:"medium"}),E.set(C,z)),z.format(A)}const x={boolean:{base:"boolean",storage:"bitset",matches:T=>typeof T=="boolean",parse:T=>n(T.text),compare:k,format:T=>n(T.value)===null?"":n(T.value)?"Yes":"No",defaults:{filter:"set",editor:"checkbox",align:"center"},excel:"General",toClipboard:T=>n(T)===null?"":String(n(T)),fromClipboard:T=>n(T)},number:{base:"number",storage:"float64",matches:T=>typeof T=="number"&&!Number.isNaN(T),parse:T=>{if(u(T.text)){const A=r(T.text,T);if(!A.ok)return null;const C=Number(A.value);return Number.isFinite(C)?C:null}return p(T.text,T.locale)},compare:g,defaults:{filter:"number",editor:"number",align:"end"},excel:"General",toClipboard:T=>D(T)?"":String(T),fromClipboard:(T,A)=>p(T,A&&A.locale)},date:{base:"dateString",storage:"dictionary",matches:T=>typeof T=="string"&&h.test(T)&&!Number.isNaN(Date.parse(T))||T instanceof Date&&!Number.isNaN(T.getTime())&&y(T),parse:T=>c(T.text),compare:f,format:N,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:T=>c(T),toClipboard:T=>D(T)?"":String(T),fromClipboard:T=>c(T)},dateString:{base:"dateString",storage:"dictionary",matches:T=>typeof T=="string"&&h.test(T)&&!Number.isNaN(Date.parse(T)),parse:T=>c(T.text),compare:f,format:N,defaults:{filter:"date",editor:"date",align:"start"},excel:"yyyy-mm-dd",toStorage:T=>c(T),toClipboard:T=>D(T)?"":String(T),fromClipboard:T=>c(T)},text:{base:"text",storage:"dictionary",matches:T=>typeof T=="string",parse:T=>T.text===""?null:String(T.text),compare:(T,A)=>D(T)?D(A)?0:1:D(A)?-1:M().compare(String(T),String(A)),defaults:{filter:"text",editor:"text",align:"start"},excel:"@",toClipboard:T=>D(T)?"":String(T),fromClipboard:T=>T},image:{base:"text",storage:"dictionary",parse:T=>T.text===""||T.text==null?null:String(T.text).trim(),compare:(T,A)=>D(T)?D(A)?0:1:D(A)?-1:M().compare(String(T),String(A)),defaults:{filter:"text",editor:"text",align:"center",render:"image"},excel:"@",toClipboard:T=>D(T)?"":String(T),fromClipboard:T=>T},lookup:{base:"text",storage:"dictionary",parse:T=>{if(T.text===""||T.text==null)return null;const A=T.column&&T.column.lookup,C=A&&K(A.options)?A.options():null;if(!C)return T.text;const z=String(T.text),Y=C.find(J=>String(J.id)===z);if(Y)return Y.id;const q=z.trim().toLowerCase(),V=C.find(J=>String(J.label).toLowerCase()===q);return V?V.id:T.text},compare:X,defaults:{filter:"set",editor:"select",align:"start"},excel:"@",multiStorage:"multi",toClipboard:T=>D(T)?"":String(T),fromClipboard:T=>T},object:{base:"object",storage:"object",matches:T=>T!==null&&typeof T=="object"&&!(T instanceof Date),parse:T=>{try{return T.text===""?null:JSON.parse(T.text)}catch{return T.text}},compare:(T,A)=>X(T,A),format:T=>{const A=T.value;if(D(A))return"";if(typeof A=="string")return A;try{return JSON.stringify(A)}catch{return String(A)}},defaults:{filter:"none",editor:"none",align:"start"},excel:"@",toClipboard:T=>D(T)?"":typeof T=="string"?T:JSON.stringify(T),fromClipboard:T=>T}},_=["boolean","number","date","dateString","datetime","text","object"];function F(T,A,C,z){const Y=C.get(T);if(Y)return Y;z.includes(T)&&G(`circular data type extends chain: ${[...z,T].join(" → ")}`);const q=A[T];q||G(`unknown data type "${T}"`);let V=null;q.extends&&(V=F(q.extends,A,C,[...z,T]));const J={...V||{},...q,name:T,defaults:{...V&&V.defaults||{},...q.defaults||{}}};return J.base||(J.base=V&&V.base||"text"),J.storage||(J.storage=V&&V.storage||"object"),C.set(T,J),J}function L(T,A){const C={...x,...i};if(A&&typeof A.dataType=="function"&&typeof A.names=="function")for(const Y of A.names("dataType")){const q=A.dataType(Y);q&&(C[Y]=q)}if(Z(T))for(const[Y,q]of Object.entries(T))C[Y]=q;const z=new Map;for(const Y of _)F(Y,C,z,[]);F("lookup",C,z,[]);for(const Y of Object.keys(C))F(Y,C,z,[]);for(const Y of z.values())l(Y.operators);return z}function j(T,A){if(T.base==="text"&&(!T.compare||T.compare===x.text.compare)){const C=M(A);return(z,Y)=>D(z)?D(Y)?0:1:D(Y)?-1:C.compare(String(z),String(Y))}return T.compare||X}function R(T,A){return A?T.multiStorage||"multi":T.storage||"object"}function $(T){return S(String(T).replace(/([a-z])([A-Z])/g,"$1 $2"))}}),De("packages/core/src/columns/infer.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_SAMPLE",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"inferFromValues",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"inferColumnType",{enumerable:!0,get:function(){return K}});const M=U("packages/core/src/internal/warn.js").infoOnce,B=U("packages/core/src/internal/predicates.js").isNil,D=100;function Z(I,G,H={}){const S=H.sampleSize??D,O=[];for(let b=0;b<I.length&&O.length<S;b++){const c=I[b];B(c)||typeof c=="number"&&Number.isNaN(c)||O.push(c)}if(O.length===0)return{type:"text",unanimous:!1,sampled:0};for(const[b,c]of G){if(typeof c.matches!="function")continue;let f=!0;for(let o=0;o<O.length;o++)if(!c.matches(O[o])){f=!1;break}if(f)return{type:b,unanimous:!0,sampled:O.length}}return H.quiet||M(`infer:${H.colId||"?"}`,`column "${H.colId||"?"}" has mixed or ambiguous values and was inferred as "text". Declare \`type\` on the column to get correct sorting, filtering and export.`),{type:"text",unanimous:!1,sampled:O.length}}function K(I,G,H,S,O={}){const b=O.sampleSize??D,c=[];for(let f=0;f<G.length&&c.length<b;f++){const o=H(G[f]);B(o)||typeof o=="number"&&Number.isNaN(o)||c.push(o)}return Z(c,S,{...O,colId:I}).type}}),De("packages/core/src/columns/graph.js",function(e,U){"use strict";Object.defineProperty(e,"WHOLE_ROW",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"declarationOf",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"buildGraph",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"affectedBy",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"depsProxy",{enumerable:!0,get:function(){return S}});const te=U("packages/core/src/internal/warn.js"),M=te.DEV,X=te.fail,B=te.warnOnce,Z=U("packages/core/src/internal/predicates.js").isFunction,K="*";function I(O){const b=O.value||{};if(!Z(b.compute))return{computed:!1,wholeRow:!1,deps:[],pure:!0};const f=b.pure!==!1;return b.deps===K?{computed:!0,wholeRow:!0,deps:[],pure:f}:Array.isArray(b.deps)?{computed:!0,wholeRow:!1,deps:b.deps.slice(),pure:f}:(B(`deps:missing:${O.id}`,`computed column "${O.id}" declares no \`value.deps\`; treating it as \`deps: '*'\` (a whole-row dependency). Declare the dependencies to get precise invalidation.`),{computed:!0,wholeRow:!0,deps:[],pure:f})}function G(O){const b=new Map;for(const h of O)b.set(h.id,h);const c=new Map,f=new Map,o=new Set,n=new Set,t=new Set,i=new Set;for(const h of O){const y=I(h);if(!y.computed){c.set(h.id,[]);continue}n.add(h.id),(y.pure?t:i).add(h.id),y.wholeRow&&o.add(h.id);const m=[],v=[];for(const d of y.deps)(b.has(d)?m:v).push(d);c.set(h.id,m),v.length&&f.set(h.id,v)}for(const h of t)for(const y of c.get(h))i.has(y)&&X(`pure computed column "${h}" depends on impure column "${y}". Mark it \`value.pure: false\` or make the dependency pure.`);const s=[],r=new Map,u=[],a=h=>{const y=r.get(h);if(y!=="done"){if(y==="open"){const m=u.indexOf(h);X(`circular column dependency: ${[...u.slice(m),h].join(" → ")}`)}r.set(h,"open"),u.push(h);for(const m of c.get(h)||[])b.has(m)&&a(m);u.pop(),r.set(h,"done"),s.push(h)}};for(const h of O)a(h.id);const l=new Map;for(const h of O)l.set(h.id,[]);for(const h of O)for(const y of c.get(h.id)||[]){const m=l.get(y);m&&!m.includes(h.id)&&m.push(h.id)}if(o.size)for(const h of O){if(n.has(h.id))continue;const y=l.get(h.id);for(const m of o)y.includes(m)||y.push(m)}return{order:s,dependents:l,pure:t,impure:i,computed:n,deps:c,wholeRow:o,external:f,index:b}}function H(O,b){const c=Array.isArray(b)?b:[b],f=new Set,o=[...c];for(;o.length;){const n=o.shift();for(const t of O.dependents.get(n)||[])f.has(t)||(f.add(t),o.push(t))}for(const n of c)f.delete(n);return O.order.filter(n=>f.has(n))}function S(O,b,c){if(!M)return O;const f=b instanceof Set?b:new Set(b);return new Proxy(O,{get(o,n){return typeof n=="string"&&!f.has(n)&&!Object.hasOwn(o,n)&&B(`undeclared:${c}:${n}`,`computed column "${c}" read undeclared dependency "${n}". Add it to \`value.deps\` or the value will go stale.`),o[n]}})}}),De("packages/core/src/model/rowkey.js",function(e,U){"use strict";Object.defineProperty(e,"KEY_DEPENDENT_FEATURES",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"compositeKey",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"createRowKey",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"warnMissingKeys",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"groupPathKey",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"splitPathKey",{enumerable:!0,get:function(){return n}});const M=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/internal/paths.js").pathGetter,D=U("packages/core/src/internal/predicates.js"),Z=D.isFunction,K=D.isBlank,I=["changes (rows.apply / rows.queue)","streaming dedupe","selection persistence","remote reload","cell comments"],G="";function H(t){if(t===null)return"\0n";if(t===void 0)return"\0u";const i=typeof t;if(i==="string")return t;if(i==="number"||i==="bigint"||i==="boolean")return String(t);if(t instanceof Date)return`\0d${t.getTime()}`;try{return`\0o${JSON.stringify(t)}`}catch{return"\0o?"}}function S(t){if(t.length===1)return H(t[0]);let i="";for(let s=0;s<t.length;s++)s&&(i+=G),i+=H(t[s]);return i}function O(t,i={}){const s=i.warn!==!1;if(Z(t)){const r=t;return{stable:!0,fields:[],disabled:[],key(u,a){try{const l=r(u);return Array.isArray(l)?S(l):H(l)}catch(l){return M("rowKey.throw","rowKey function threw; falling back to index identity for the affected rows.",l),`#${a??-1}`}},keyEmpty(u){try{const a=r(u);return Array.isArray(a)?a.length===0||a.some(K):K(a)}catch{return!1}},missingFields(){return[]}}}if(Array.isArray(t)&&t.length>0){const r=t.filter(l=>typeof l=="string"),u=r.map(l=>B(l)),a=u.length;return{stable:!0,fields:r,disabled:[],key(l){const h=new Array(a);for(let y=0;y<a;y++)h[y]=u[y](l);return S(h)},keyEmpty(l){for(let h=0;h<a;h++)if(K(u[h](l)))return!0;return!1},missingFields(l){const h=[];for(let y=0;y<a;y++)K(u[y](l))&&h.push(r[y]);return h}}}if(typeof t=="string"&&t.length>0){const r=B(t);return{stable:!0,fields:[t],disabled:[],key(u){return H(r(u))},keyEmpty(u){return K(r(u))},missingFields(u){return K(r(u))?[t]:[]}}}return s&&M("rowKey.missing",`no rowKey configured, so rows are identified by object identity. This disables: ${I.join(", ")}. Set rowKey to a field name, an array of field names, or a function.`),{stable:!1,fields:[],disabled:I.slice(),key(r,u){if(r===null||typeof r!="object")return`#${u??0}:${String(r)}`;let a=b.get(r);return a===void 0&&(a=`#${c++}`,b.set(r,a)),a}}}const b=new WeakMap;let c=0;function f(t,i){if(!t||t.stable===!1||!Z(t.keyEmpty)||!Array.isArray(i)||i.length===0)return;let s=0,r=null,u;for(let y=0;y<i.length;y++){const m=i[y];t.keyEmpty(m)&&(s++,r===null&&(r=Z(t.missingFields)?t.missingFields(m):[],u=m))}if(s===0)return;const a=t.fields.length?t.fields.join(","):"(function)",l=r&&r.length?r.join(", "):t.fields.length?t.fields.join(", "):"the rowKey function",h=u!==null&&typeof u=="object"?Object.keys(u).join(", ")||"(no fields)":String(u);M(`rowKey.emptyValue:${a}`,`rowKey ${l} is missing on ${s} of ${i.length} rows; the first such row has: ${h}. Rows without a key value collapse onto one key, so selection, edits and rows.apply updates land on whichever row now shares it. Set rowKey to a field present on every row, or fix the source data.`)}function o(t){return S(t)}function n(t){return t.split(G)}}),De("packages/core/src/columns/lookup.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_SEPARATOR",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"normaliseOption",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"flattenOptions",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"Lookup",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toValueArray",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"createLookup",{enumerable:!0,get:function(){return t}});const te=U("packages/core/src/internal/compare.js"),M=te.collator,X=te.defaultCompare,B=U("packages/core/src/internal/predicates.js"),D=B.isFunction,Z=B.isNil,I=U("packages/core/src/internal/warn.js").warnOnce,H=U("packages/core/src/model/rowkey.js").compositeKey,S=", ",O="";function b(i,s,r,u){if(i===null||typeof i!="object")return{id:i,label:i==null?"":String(i)};const a=i[s],l=i[r],h={id:a,label:l==null?String(a??""):String(l)};i.disabled&&(h.disabled=!0),i.variant&&(h.variant=i.variant),i.icon&&(h.icon=i.icon);const y=u?i[u]:i.group;return y!==void 0&&(h.group=y),h}function c(i,s,r=0,u=[],a=[]){for(const l of i||[]){const h=l&&typeof l=="object"?l[s]:null;if(a.push({raw:l,depth:r,path:u}),Array.isArray(h)&&h.length){const y=String(l&&typeof l=="object"?l.label??l.name??l.id??"":l);c(h,s,r+1,[...u,y],a)}}return a}function f(i){return!!i&&typeof i=="object"&&!Array.isArray(i)&&D(i.router&&i.router.subscribe)}class o{#e;#t;#n;#r;#s=[];#i=new Map;#o=new Map;#l=0;#a="idle";#c=null;#u;#f=null;#d=new Map;constructor(s,r={}){this.#e=s||{},this.#t=r.colId||"?",this.#n=r.locale,this.#r=r.onChange||null,this.#u=M(this.#n),Array.isArray(this.#e.options)?this.#h(this.#e.options):this.#e.options===void 0&&(this.#a="ready")}get colId(){return this.#t}get version(){return this.#l}get state(){return this.#a}get ready(){return this.#a==="ready"}get multiple(){return this.#e.multiple===!0}get separator(){return this.#e.separator??S}get allowCustom(){return this.#e.allowCustom===!0}get sortBy(){return this.#e.sortBy||"label"}get spec(){return this.#e}options(){return this.#s}setLocale(s){this.#n=s,this.#u=M(s)}#h(s){const r=this.#e,u=r.valueKey||"id",a=r.labelKey||"label",l=r.childrenKey||"children";this.#s=c(s,l).map(h=>{const y=b(h.raw,u,a,r.groupKey);return h.depth&&(y.depth=h.depth,y.path=h.path),y}),this.#i=new Map,this.#o=new Map,this.#s.forEach((h,y)=>{this.#i.set(h.id,h),this.#o.set(h.id,y)}),this.#a="ready",this.#l+=1}load(){if(this.#c)return this.#c;const s=this.#e.options;if(Array.isArray(s)||s===void 0)return this.#c=Promise.resolve(this.#s),this.#c;if(f(s))return this.#c=this.#p(s),this.#c;if(!D(s))return I(`lookup:options:${this.#t}`,`column "${this.#t}" has an invalid \`lookup.options\`; expected an array, a function, or a router route`),this.#a="ready",this.#c=Promise.resolve([]),this.#c;this.#a="loading";let r;try{r=s()}catch(u){return this.#a="error",I(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,u),this.#c=Promise.resolve([]),this.#c}return!r||!D(r.then)?(this.#h(r),this.#c=Promise.resolve(this.#s),this.#r&&this.#r(this),this.#c):(this.#c=r.then(u=>(this.#h(u),this.#r&&this.#r(this),this.#s),u=>(this.#a="error",I(`lookup:load:${this.#t}`,`column "${this.#t}" failed to load lookup options`,u),[])),this.#c)}refresh(){return this.#c=null,Array.isArray(this.#e.options)?(this.#h(this.#e.options),this.#r&&this.#r(this),Promise.resolve(this.#s)):this.load()}#p(s){if(this.#f)return Promise.resolve(this.#s);const r=this.#e,u=r.valueKey||"id",a=r.labelKey||"label",l=r.groupKey,h=D(s.map)?s.map:null,y=v=>b(h?h(v):v,u,a,l).id,m=v=>this.#m(v,h,u,a,l);return s.router.subscribe(s.predicate,m,{rowKey:y}),this.#f=()=>{D(s.router.detach)&&s.router.detach(m)},this.#a="ready",Promise.resolve(this.#s)}#m(s,r,u,a,l){const h=s&&s.add||[],y=s&&s.update||[],m=s&&s.remove||[];if(!(!h.length&&!y.length&&!m.length)){for(const v of h)this.#g(v,r,u,a,l);for(const v of y)this.#g(v,r,u,a,l);for(const v of m){if(!this.#d.has(v))continue;const d=this.#d.get(v);this.#d.delete(v),this.#i.delete(d);const p=this.#s.findIndex(g=>g.id===d);p>=0&&this.#s.splice(p,1)}this.#o=new Map(this.#s.map((v,d)=>[v.id,d])),this.#a="ready",this.#l+=1,this.#r&&this.#r(this)}}#g(s,r,u,a,l){const h=b(r?r(s):s,u,a,l);this.#d.set(H([h.id]),h.id);const y=this.#s.findIndex(m=>m.id===h.id);y>=0?this.#s[y]=h:this.#s.push(h),this.#i.set(h.id,h)}destroy(){this.#f&&(this.#f(),this.#f=null)}search(s,r){const u=this.#e;if(!D(u.search)){const h=String(s||"").toLowerCase();return Promise.resolve(h===""?this.#s:this.#s.filter(y=>y.label.toLowerCase().includes(h)))}const a=u.valueKey||"id",l=u.labelKey||"label";return Promise.resolve(u.search(s,r)).then(h=>(h||[]).map(y=>b(y,a,l,u.groupKey)))}option(s){return this.#i.get(s)}has(s){return this.#i.has(s)}label(s){if(Z(s)||s==="")return"";const r=this.#i.get(s);if(r)return r.label;if(this.#a==="loading"||this.#a==="idle")return"";this.allowCustom||I(`lookup:unknown:${this.#t}`,`column "${this.#t}" holds value ${JSON.stringify(s)} which is not in its lookup options. Showing the raw value; set \`lookup.unknownLabel\` or \`lookup.allowCustom\` to change that.`);const u=this.#e.unknownLabel;return D(u)?String(u(s)??""):typeof u=="string"?u:String(s)}text(s){if(this.multiple){const r=n(s);return r.length===0?"":r.map(u=>this.label(u)).join(this.separator)}return this.label(s)}dictionary(){return this.#s.map(s=>s.id)}sorted(){const s=this.sortBy;if(s==="optionOrder"||s==="count")return this.#s.slice();if(s==="value")return this.#s.slice().sort((u,a)=>X(u.id,a.id));const r=this.#u;return this.#s.slice().sort((u,a)=>r.compare(u.label,a.label))}comparator(){const s=this.sortBy,r=this.multiple,u=this.#u,a=this.#o;if(r&&s==="count")return(h,y)=>n(h).length-n(y).length;const l=r?h=>n(h)[0]:h=>h;return s==="value"?(h,y)=>X(l(h),l(y)):s==="optionOrder"?(h,y)=>{const m=a.has(l(h))?a.get(l(h)):Number.MAX_SAFE_INTEGER,v=a.has(l(y))?a.get(l(y)):Number.MAX_SAFE_INTEGER;return m-v}:(h,y)=>{const m=l(h),v=l(y);return Z(m)?Z(v)?0:1:Z(v)?-1:u.compare(this.label(m),this.label(v))}}groupKey(s){return this.multiple?n(s).map(u=>String(u)).sort().join(O):Z(s)?"":String(s)}countValues(s){return this.multiple?n(s).length:Z(s)?0:1}contains(s,r,u){const a=this.multiple?n(s):Z(s)?[]:[s],l=Array.isArray(r)?r:[r];switch(u){case"containsAll":return l.every(h=>a.includes(h));case"containsNone":return!l.some(h=>a.includes(h));default:return l.some(h=>a.includes(h))}}exportText(s,r="label"){return r==="value"?this.multiple?n(s).join(this.separator):Z(s)?"":String(s):this.text(s)}exportColumns(){const s=this.multiple;return this.#s.map(r=>({id:r.id,label:r.label,has:u=>s?n(u).includes(r.id):u===r.id}))}}function n(i){return Array.isArray(i)?i:Z(i)||i===""?[]:[i]}function t(i,s={}){const r=i.lookup;if(!r)return null;const u=new o(r,{colId:i.id,locale:s.locale,onChange:s.onChange});return!Array.isArray(r.options)&&r.options!==void 0&&u.load(),u}}),De("packages/core/src/columns/value.js",function(e,U){"use strict";Object.defineProperty(e,"compileDisplay",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"warnImpureUse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"ValuePipeline",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"defaultRowKey",{enumerable:!0,get:function(){return o}});const M=U("packages/core/src/internal/paths.js").getPath,X=U("packages/core/src/internal/predicates.js"),B=X.isFunction,D=X.isNil,K=U("packages/core/src/internal/lru.js").Lru,G=U("packages/core/src/internal/warn.js").warnOnce,S=U("packages/core/src/columns/graph.js").depsProxy,O="\0";function b(s,r={}){const u=r.locale,a=r.grid??null,l=r.context,h=s.value&&s.value.format,y=s.formatter||null,m=s.dataType&&s.dataType.format,v=s.lookup||null,d=(p,g,k)=>({value:p,data:k,row:g,column:s,colId:s.id,grid:a,context:l,locale:u});if(B(h))return(p,g,k)=>{const w=h(d(p,g,k));return w==null?"":String(w)};if(y){if(v){const p=y.kind==="text";return(g,k,w)=>y(p?v.text(g):g,d(g,k,w))}return(p,g,k)=>y(p,d(p,g,k))}return B(m)?(p,g,k)=>{const w=m(d(p,g,k));return w==null?"":String(w)}:v?p=>v.text(p):p=>D(p)?"":typeof p=="string"?p:String(p)}function c(s,r){!s||!s.value||s.value.pure!==!1||G(`impure:${r}:${s.id}`,`column "${s.id}" is an impure computed column (\`value.pure: false\`) and is being used to ${r}. The result is not stable across passes.`)}class f{#e;#t;#n;#r;#s;#i;#o=new K(4096);constructor(r){this.#e=r.columns instanceof Map?r.columns:new Map((r.columns||[]).map(u=>[u.id,u])),this.#t=r.graph,this.#n=r.grid??null,this.#r=r.context,this.#i=r.stored||null,this.#s=r.rowKey||o}get graph(){return this.#t}setGraph(r){this.#t=r,this.#o.clear()}beginPass(){this.#o.clear()}endPass(){this.#o.clear()}invalidate(r){if(this.#o.size===0)return;const u=r&&r.rows?new Set([...r.rows].map(String)):null,a=r&&r.columns?[...r.columns]:null;if(!u&&!a){this.#o.clear();return}const l=a?this.#l(a):null;for(const h of[...this.#o.keys()]){const y=String(h).split(O);y.length===3&&(u&&!u.has(y[0])||l&&!l.has(y[2])||this.#o.delete(h))}}#l(r){const u=new Set,a=this.#t,l=[...r];for(;l.length;){const h=l.pop();if(!u.has(h)){u.add(h);for(const y of a?a.dependents.get(h)||[]:[])l.push(y)}}return u}value(r,u,a){const l=typeof r=="string"?this.#e.get(r):r;if(!l)return;if(!l.computed)return this.#c(l,u,a);if(l.value.pure!==!1&&this.#i&&a&&a.physical!=null&&this.#i.has(l.id))return this.#i.get(l.id,a.physical);if(l.volatile)return this.compute(l,u,a);if(l.value.pure===!1)return this.compute(l,u,a);const h=`${this.#a(u,a)}${O}${l.id}`;if(this.#o.has(h))return this.#o.get(h);const y=this.compute(l,u,a);return this.#o.set(h,y),y}#a(r,u){return`${this.#s(r,u)}${O}${n(r)}`}#c(r,u,a){if(this.#i&&a&&a.physical!=null&&this.#i.has(r.id))return this.#i.get(r.id,a.physical);if(r.field)return r.read?r.read(u):M(u,r.field)}compute(r,u,a){const l=this.#t,h=l&&l.wholeRow.has(r.id);let y;if(h)y=u??{};else{y={};const v=l&&l.deps.get(r.id)||[];for(const p of v)y[p]=this.value(p,u,a);const d=l&&l.external.get(r.id)||[];for(const p of d)y[p]=M(u,p);y=S(y,[...v,...d],r.id)}const m={data:u,row:a,column:r,grid:this.#n,context:this.#r};return r.value.compute(y,m)}values(r,u){const a={},l=this.#t?this.#t.order:[...this.#e.keys()];for(const h of l)a[h]=this.value(h,r,u);return a}text(r,u,a){const l=typeof r=="string"?this.#e.get(r):r;return l?l.formatValue(this.value(l,u,a),a,u):""}key(r,u,a){const l=typeof r=="string"?this.#e.get(r):r;if(!l)return"";const h=this.value(l,u,a);return B(l.value.key)?String(l.value.key(this.#u(l,h,u,a))):l.lookup?l.lookup.groupKey(h):D(h)?"":String(h)}quickFilterText(r,u,a){const l=typeof r=="string"?this.#e.get(r):r;if(!l)return"";if(B(l.value.quickFilterText)){const h=this.value(l,u,a);return String(l.value.quickFilterText(this.#u(l,h,u,a))??"")}return this.text(l,u,a)}#u(r,u,a,l){return{value:u,data:a,row:l,column:r,colId:r.id,grid:this.#n,context:this.#r}}parse(r,u,a,l){const h=typeof r=="string"?this.#e.get(r):r;if(!h)return u;const y={text:u,value:this.value(h,a,l),data:a,row:l,column:h,grid:this.#n,context:this.#r,locale:this.#n&&B(this.#n.get)?this.#n.get("locale"):void 0,formulaFunctions:this.#n&&B(this.#n.get)?this.#n.get("formulaFunctions"):void 0};return B(h.value.parse)?h.value.parse(y):h.dataType&&B(h.dataType.parse)?h.dataType.parse(y):u}validate(r,u,a,l,h){const y=typeof r=="string"?this.#e.get(r):r;if(!y||!B(y.edit.validate))return!0;const m=y.edit.validate({value:u,oldValue:a,data:l,row:h,column:y,grid:this.#n,context:this.#r});return m===!0||m===void 0?!0:String(m)}apply(r,u,a,l){const h=typeof r=="string"?this.#e.get(r):r;if(!h)return!1;const y=this.value(h,a,l);if(B(h.value.apply)){const m=h.value.apply({value:u,oldValue:y,data:a,row:l,column:h,grid:this.#n,context:this.#r});return this.#f(h,a,l),m!==!1}return h.field?y===u?!1:(h.write(a,u),this.#f(h,a,l),!0):(G(`apply:${h.id}`,`column "${h.id}" has no \`field\` and no \`value.apply\`, so an edit cannot be written back.`),!1)}commit(r,u,a,l){const h=typeof r=="string"?this.#e.get(r):r;if(!h)return{ok:!1,value:void 0,oldValue:void 0,changed:!1,error:"unknown column"};const y=this.value(h,a,l),m=this.parse(h,u,a,l),v=this.validate(h,m,y,a,l);if(v!==!0)return{ok:!1,value:m,oldValue:y,changed:!1,error:v};const d=this.apply(h,m,a,l);return{ok:!0,value:m,oldValue:y,changed:d}}#f(r,u,a){if(this.#o.size===0)return;const l=this.#a(u,a);this.#o.delete(`${l}${O}${r.id}`);for(const h of this.#t?this.#t.dependents.get(r.id)||[]:[])this.#o.delete(`${l}${O}${h}`)}}function o(s,r){return r&&r.key!=null?String(r.key):n(s)}function n(s){if(s&&typeof s=="object"){let r=t.get(s);return r===void 0&&(r=`#${i++}`,t.set(s,r)),r}return String(s)}const t=new WeakMap;let i=0}),De("packages/core/src/model/shadow.js",function(e,U){"use strict";Object.defineProperty(e,"MAX_TRACKED",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"DEFAULT_DEPTH",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"HISTORY_TICK_MAX_MS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"HISTORY_TICK_MIN_MS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"historyTickFor",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"SHADOW_KINDS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"ROLLING_KINDS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"FIT_SHADOW_KINDS",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"DEFAULT_ANOMALY_THRESHOLD",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"SPEC_STATUS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"POSITIONAL_KINDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"SHADOW_LABELS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"specStatusOf",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"ShadowTracker",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shadowsIn",{enumerable:!0,get:function(){return a}});const M=U("packages/core/src/internal/warn.js").warnOnce,X=2e5,B=20,D=1e3,Z=50;function K(l){return Math.min(D,Math.max(Z,Math.floor(l)))}const I=Object.freeze(["updates","updatedAt","sinceUpdate","delta","deltaPercent","rate","history","firstValue","streak","rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag","specStatus","rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta","fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),G=Object.freeze(["rollingSum","rollingAvg","rollingMin","rollingMax","windowCoverage","cumulativeToDate","periodOverPeriod","rollingQuantile","windowApproximate","tsTrend","tsSeasonal","tsResidual","tsCoverage","tsSmoothed","tsSmoothingAlpha","tsSmoothingBeta"]),H=Object.freeze(["fitPredicted","fitResidual","fitInfluence","fitStdResidual","fitLeverage","fitCooksD"]),S=.6745,O=3.5,b=Object.freeze({PASS:"PASS",WARN:"WARN",FAIL:"FAIL"}),c=Object.freeze(["rank","rankAsc","rankChange","percentile","quartile","zScore","shareOfTotal","anomalyScore","anomalyFlag"]),f=Object.freeze({updates:"Updates",updatedAt:"Updated at",sinceUpdate:"Since update",delta:"Change",deltaPercent:"Change %",rate:"Rate of change",history:"History",firstValue:"Baseline",streak:"Streak",rank:"Rank",rankAsc:"Rank, ascending",rankChange:"Rank change",percentile:"Percentile",quartile:"Quartile",zScore:"Z-score",shareOfTotal:"Share of total",anomalyScore:"Anomaly score",anomalyFlag:"Anomaly",specStatus:"Spec status",rollingSum:"Rolling sum",rollingAvg:"Rolling average",rollingMin:"Rolling minimum",rollingMax:"Rolling maximum",windowCoverage:"Window coverage",cumulativeToDate:"Cumulative to date",periodOverPeriod:"Period over period",rollingQuantile:"Rolling quantile",windowApproximate:"Window approximate",tsTrend:"Trend",tsSeasonal:"Seasonal",tsResidual:"Seasonal residual",tsCoverage:"Decomposition coverage",tsSmoothed:"Smoothed",tsSmoothingAlpha:"Smoothing α",tsSmoothingBeta:"Smoothing β",fitPredicted:"Predicted",fitResidual:"Residual",fitInfluence:"Influence",fitStdResidual:"Std. residual",fitLeverage:"Leverage",fitCooksD:"Cook's D"});function o(l,h){if(!h)return null;const y=Number.isFinite(Number(h.lower))?Number(h.lower):null,m=Number.isFinite(Number(h.upper))?Number(h.upper):null;if(y===null&&m===null||!Number.isFinite(l))return null;if(y!==null&&l<y||m!==null&&l>m)return b.FAIL;const v=Number.isFinite(Number(h.warnLower))?Number(h.warnLower):null,d=Number.isFinite(Number(h.warnUpper))?Number(h.warnUpper):null;return v!==null&&l<v||d!==null&&l>d?b.WARN:b.PASS}function n(l,h,y){if(!h||typeof h!="object")return null;if(h.kind!=="time")return h.kind!==void 0&&M(`shadow.history.window.kind:${l}`,`a 'history' shadow's 'window' only accepts {kind: 'time', span}; '${h.kind}' is not honoured (a plain count is already what 'depth' means, and a session has no span to divide into buckets), so it reported the original, unwindowed history.`),null;const m=h.minutes!=null?Number(h.minutes)*6e4:Number(h.span);if(!(m>0))return M(`shadow.history.window.span:${l}`,"a 'history' shadow's time window needs a positive 'span' (ms) or 'minutes'; it had none, so it reported the original, unwindowed history."),null;const v=Math.max(2,Math.floor(y)||B);return{span:m,bucketMs:Math.max(1,Math.floor(m/v))}}class t{#e;#t=new Map;#n=new Map;#r=new Map;#s=new Map;#i=new Map;#o=new Map;#l=0;#a;#c;#u;#f;#d=new Map;#h=null;#p=null;#m=null;constructor(h){this.#e=h.colId,this.#a=Math.max(2,h.depth||B),this.#c=Math.max(1,h.max||X),this.#u=h.now||(()=>Date.now()),this.#f=n(this.#e,h.historyWindow,this.#a),this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}get colId(){return this.#e}get forgotten(){return this.#l}get size(){return this.#n.size}get historyWindow(){return this.#f}observe(h,y){const m=u(y);if(m===null)return;if(!this.#n.has(h)){this.#p=null,this.#m=null,this.#g(),this.#t.set(h,m),this.#n.set(h,m),this.#r.set(h,0),this.#s.set(h,this.#u()),this.#i.set(h,[m]),this.#f&&this.#d.set(h,[m]),this.#o.set(h,0);return}const v=this.#n.get(h);if(v===m)return;this.#p=null,this.#m=null,this.#n.set(h,m),this.#r.set(h,(this.#r.get(h)||0)+1),this.#s.set(h,this.#u());const d=this.#i.get(h)||[];d.push(m),d.length>this.#a&&d.splice(0,d.length-this.#a),this.#i.set(h,d);const p=Math.sign(m-v),g=this.#o.get(h)||0;this.#o.set(h,Math.sign(g)===p?g+p:p)}#g(){if(this.#n.size<this.#c)return;const h=this.#n.keys().next().value;h!==void 0&&(this.#t.delete(h),this.#n.delete(h),this.#r.delete(h),this.#s.delete(h),this.#i.delete(h),this.#d.delete(h),this.#o.delete(h),this.#l++)}rebase(){for(const[h,y]of this.#n)this.#t.set(h,y);this.#p=null,this.#m=null}reset(){this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#s.clear(),this.#i.clear(),this.#d.clear(),this.#o.clear(),this.#l=0,this.#p=null,this.#m=null,this.#f&&(this.#h=Math.floor(this.#u()/this.#f.bucketMs))}retain(h){const y=h instanceof Set?h:new Set(h);let m=0;for(const v of[...this.#n.keys()])y.has(v)||(this.#t.delete(v),this.#n.delete(v),this.#r.delete(v),this.#s.delete(v),this.#i.delete(v),this.#d.delete(v),this.#o.delete(v),m++);return m&&(this.#p=null,this.#m=null),m}advanceHistoryWindow(h=this.#u()){const y=this.#f;if(!y)return 0;const m=Math.floor(h/y.bucketMs),v=m-this.#h;if(!(v>0))return 0;const d=Math.min(v,this.#a);for(const[p,g]of this.#d){const k=this.#n.get(p);for(let w=0;w<d;w++)g.push(k);g.length>this.#a&&g.splice(0,g.length-this.#a)}return this.#h=m,v}read(h,y,m,v){switch(h){case"updates":return this.#r.has(y)?this.#r.get(y):0;case"updatedAt":{const d=this.#s.get(y);return d===void 0?null:new Date(d)}case"sinceUpdate":{const d=this.#s.get(y);return d===void 0?null:this.#u()-d}case"firstValue":return this.#t.has(y)?this.#t.get(y):null;case"delta":return this.#n.has(y)?this.#n.get(y)-this.#t.get(y):null;case"deltaPercent":{if(!this.#n.has(y))return null;const d=this.#t.get(y);return d?(this.#n.get(y)-d)/Math.abs(d)*100:null}case"rate":{const d=this.#i.get(y),p=this.#s.get(y);if(!d||d.length<2||p===void 0)return null;const g=this.#u()-p,k=d[d.length-1]-d[d.length-2];return g>0?k/g*1e3:k}case"history":return this.#f?this.#d.has(y)?[...this.#d.get(y)]:null:this.#i.has(y)?[...this.#i.get(y)]:null;case"streak":return this.#o.has(y)?this.#o.get(y):0;case"specStatus":return this.#n.has(y)?o(this.#n.get(y),v):null;default:return c.includes(h)?this.#j(h,y,m,v):null}}#b(h){if(h){if(this.#m&&this.#m.only===h)return this.#m.view;const y=this.#y(h);return this.#m={only:h,view:y},y}return this.#p?this.#p:(this.#p=this.#y(null),this.#p)}#y(h){const y=[];for(const[x,_]of this.#n)h&&!h.has(x)||y.push(_);const m=y.sort((x,_)=>x-_);let v=0,d=0,p=0,g=0;for(const x of m){g+=x,v++;const _=x-d;d+=_/v,p+=_*(x-d)}const k=[];for(const[x,_]of this.#t)h&&!h.has(x)||k.push(_);const w=v?i(m):0,E=m.map(x=>Math.abs(x-w)).sort((x,_)=>x-_),N=v?i(E):0;return{sorted:m,baseline:k.sort((x,_)=>x-_),sum:g,mean:v?d:0,sd:v>1?Math.sqrt(p/(v-1)):0,median:w,mad:N}}#j(h,y,m,v){if(!this.#n.has(y)||m&&!m.has(y))return null;const d=this.#n.get(y),p=this.#b(m),g=p.sorted.length;if(!g)return null;switch(h){case"rank":return g-r(p.sorted,d)+1;case"rankAsc":return s(p.sorted,d)+1;case"rankChange":{if(!this.#t.has(y)||!p.baseline.length)return null;const k=p.baseline.length-r(p.baseline,this.#t.get(y))+1,w=g-r(p.sorted,d)+1;return k-w}case"percentile":return r(p.sorted,d)/g*100;case"quartile":{const k=r(p.sorted,d)/g;return Math.min(4,Math.max(1,Math.ceil(k*4)))}case"zScore":return p.sd?(d-p.mean)/p.sd:null;case"anomalyScore":return p.mad?S*(d-p.median)/p.mad:null;case"anomalyFlag":{if(!p.mad)return null;const k=v&&Number.isFinite(Number(v.threshold))?Number(v.threshold):O;return Math.abs(S*(d-p.median)/p.mad)>k}case"shareOfTotal":return p.sum?d/p.sum*100:null;default:return null}}}function i(l){const h=l.length;if(!h)return 0;const y=(h-1)*.5,m=Math.floor(y),v=Math.ceil(y);return m===v?l[m]:l[m]+(y-m)*(l[v]-l[m])}function s(l,h){let y=0,m=l.length;for(;y<m;){const v=y+m>>1;l[v]<h?y=v+1:m=v}return y}function r(l,h){let y=0,m=l.length;for(;y<m;){const v=y+m>>1;l[v]<=h?y=v+1:m=v}return y}function u(l){if(l==null||l==="")return null;if(l instanceof Date){const y=l.getTime();return Number.isFinite(y)?y:null}const h=typeof l=="number"?l:Number(l);return Number.isFinite(h)?h:null}function a(l){const h=[];for(const y of l||[]){const m=y.shadow;if(!m)continue;const v=typeof m=="string"?{kind:m}:m,d=v.kind;I.includes(d)&&(G.includes(d)||H.includes(d)||h.push({colId:y.id||y.field,of:v.of||y.field||y.id,kind:d,depth:v.depth,historyWindow:d==="history"?v.window:void 0}))}return h}}),De("packages/core/src/columns/model.js",function(e,U){"use strict";Object.defineProperty(e,"BUILTIN_DEFAULTS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"normaliseAlign",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"normaliseVAlign",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"expandColumn",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"ColumnModel",{enumerable:!0,get:function(){return re}}),Object.defineProperty(e,"flattenTree",{enumerable:!0,get:function(){return ve}});const te=U("packages/core/src/internal/merge.js"),M=te.expand,X=te.merge,B=te.toArray,D=U("packages/core/src/internal/warn.js"),Z=D.fail,K=D.warnOnce,I=U("packages/core/src/internal/paths.js"),G=I.getPath,H=I.pathGetter,S=I.pathSetter,b=U("packages/core/src/internal/text.js").humanise,c=U("packages/core/src/internal/predicates.js"),f=c.isFunction,o=c.isObject,t=U("packages/core/src/internal/uid.js").uid,s=U("packages/core/src/format/index.js").compileFormat,r=U("packages/core/src/columns/datatypes.js"),u=r.comparatorFor,a=r.createTypeRegistry,l=r.storageKind,h=U("packages/core/src/columns/infer.js"),y=h.inferColumnType,m=h.DEFAULT_SAMPLE,v=U("packages/core/src/columns/graph.js"),d=v.buildGraph,p=v.affectedBy,k=U("packages/core/src/columns/lookup.js").createLookup,w=U("packages/core/src/columns/value.js"),E=w.compileDisplay,N=w.ValuePipeline,x=w.warnImpureUse,F=U("packages/core/src/model/shadow.js").FIT_SHADOW_KINDS,L=Object.freeze({geometry:"geometry",list:"list"}),j={value:{pure:!0},cell:{},edit:{enabled:!1},sort:{enabled:!0,direction:null,order:0,nullsFirst:!1},filter:{enabled:!0,type:"text"},group:{enabled:!1,index:-1,explode:!1},pivot:{enabled:!1,index:-1},total:null,layout:{width:150,min:40,max:null,flex:0,pin:null,hidden:!1,resizable:!0,movable:!0,lockVisible:!1,lockPosition:!1},header:{},facet:{},export:{lookup:"label",csv:!0,excel:!0},allowGroup:!0,allowPivot:!0,allowTotal:!0,nullable:!0,quickFilter:!0},R={centre:"center"},$=new Set(["start","center","end","left","right"]);function T(Le){if(typeof Le!="string")return;const se=Le.toLowerCase();return R[se]?R[se]:$.has(se)?se:void 0}function A(Le){if(typeof Le!="string")return;const se=Le.toLowerCase();return se==="center"||se==="centre"?"middle":se==="top"||se==="middle"||se==="bottom"?se:void 0}const C=["cell","layout","header"];function z(Le){if(!o(Le))return{};const se={...Le},pe=(be,ke)=>{if(Le[be]===void 0)return;const je=M(Le[be],ke);je&&C.includes(be)&&!o(Le[be])&&delete je.enabled,se[be]=je};return pe("sort","direction"),pe("filter","type"),pe("cell","render"),pe("edit","editor"),pe("layout","width"),pe("group","index"),pe("pivot","index"),pe("header","render"),pe("facet","strategy"),se}function Y(Le,se){const pe={...Le||{}},be=o(se)&&o(se.layout)&&se.layout.width!==void 0;return pe.fit==="content"&&!be&&delete pe.width,pe}const q=new Set(["allowGroup","allowPivot","allowTotal","cell","colSpan","contextMenu","diff","edit","export","facet","field","filter","filterRow","format","grandTotal","group","groupTotal","header","headerControls","id","layout","lookup","nullable","pivot","preset","quickFilter","rowSpan","running","shadow","showWhen","sort","spec","tags","title","total","type","typeOptions","validation","value","verticalAlign"]),V=new Set(["collapsible","columns","facet","header","id","marryChildren","openByDefault","showWhen","title"]);function J(Le,se,pe,be){const ke=pe==="columnGroup"?"column group":"column";for(const je of Object.keys(Le))if(!se.has(je)){if(je==="timeZone"&&pe==="column"){K("column.timeZone",`\`timeZone\` is not a column option, so it had no effect on column "${be}". A date column stores, displays, sorts and filters in the grid-level \`timeZone\` (else the viewer's); set \`timeZone\` on the grid, not the column.`);continue}K(`${pe}.unknown:${je}`,`'${je}' is not a configuration key this grid recognises, so it had no effect on ${ke} "${be}". Check the spelling against the reference.`)}}function ee(Le){o(Le.cell)&&Le.cell.autoHeight!==void 0&&K("column.cell.autoHeight",`\`cell.autoHeight\` is not a column option, so it had no effect on column "${Le.id||Le.field||"(unnamed)"}". Rows grow to fit with the grid-level \`autoHeight\`; \`cell.wrap\` lets this column's text wrap.`)}function ne(Le,se){const pe=se&&f(Le.defaultsFor)?Le.defaultsFor(se):null,be={...Le.defaults||{},...o(pe)?pe:{}},ke={};return be.align&&(ke.align=be.align,ke.cell={align:be.align},ke.header={align:be.align}),be.filter&&(ke.filter=be.filter==="none"?{enabled:!1,type:"none"}:{enabled:!0,type:be.filter}),be.editor&&(ke.edit=be.editor==="none"?{editor:null}:{editor:be.editor}),be.total&&(ke.total=be.total),be.render&&(ke.cell={...ke.cell||{},render:be.render}),Le.export&&(ke.export={...Le.export}),ke}function oe(Le){if(typeof Le=="string")return Le.trim()?[Le.trim()]:[];if(!Array.isArray(Le))return[];const se=[];for(const pe of Le){if(typeof pe!="string")continue;const be=pe.trim();be&&!se.includes(be)&&se.push(be)}return se}class re{#e=new Map;#t=[];#n=[];#r=new WeakMap;#s;#i;#o;#l;#a;#c;#u(se,pe,be){const ke=this.#f(se,pe,be);if(typeof ke!="string"||!this.#d)return ke??null;const je=pe&&pe.totals&&pe.totals.implement;if(je&&f(je[ke])){const ge=je[ke];return ge.totalName=ke,ge}const xe=this.#d.totalFn?.(ke);return f(xe)?xe:ke}#f(se,pe,be){if(typeof se!="string")return se;const ke=pe&&pe.totals&&pe.totals.supported;if(!Array.isArray(ke)||ke.includes(se))return se;const je=ke.length?ke.join(", "):"none";return Z(`column "${be}" is typed ${pe.name||"a type"}, for which the total "${se}" is not meaningful. Supported: ${je}. Aggregating it anyway would produce a confident wrong number.`),se}#d;#h;#p;#m;#g;#b;#y=!1;#j;#w;constructor(se={}){this.#i=z(se.columnDefaults||{}),this.#o=se.columnPresets||{},this.#a=se.locale,this.#l=se.timeZone,this.#c=A(se.verticalAlign),this.#d=se.registry||null,this.#h=se.grid||null,this.#p=se.context,this.#j=se.sampleSize??m,this.#w=se.onChange||null,this.#b=f(se.rowKey)?se.rowKey:void 0,this.#s=a(se.dataTypes,this.#d);const{leaves:pe,groups:be}=ve(se.columns||[]);this.#n=be;for(const ke of pe){ke.facet!==void 0&&this.#r.set(ke.def,ke.facet);const je=this.#O(ke.def,null);if(je.groupPath=ke.path,this.#e.has(je.id)){K(`columns.duplicate:${je.id}`,`two columns resolve to the id '${je.id}', so the second is ignored. An id defaults to the column's field, so declare an explicit \`id\` when two columns read the same field.`);continue}ke.column=je,this.#e.set(je.id,je),this.#t.push(je.id)}this.#E(se.stored||null)}#O(se,pe){J(se,q,"column",se.id||se.field||"(unnamed)"),ee(se);const be=z(se),ke=B(se.preset),je=ke.map(Ke=>{const Xe=this.#o[Ke];return Xe?z(Xe):(K(`preset:${Ke}`,`unknown column preset "${Ke}"; ignoring`),{})}),xe=this.#S(be,je,pe),ge=this.#s.get(xe)||this.#s.get("text");if(!this.#s.has(xe)&&se.type){const Ke=L[xe];K(`type:${xe}`,`unknown data type "${xe}"; falling back to "text"`+(Ke?`. It is registered by importing '@toclocoinc/lattice-grid/modules/${Ke}'.`:""))}const we=f(ge.items)?this.#T(be,je,se.id||se.field||"(unnamed)"):null;let Me=j;Me=X(Me,this.#i),se.type!==!1&&(Me=X(Me,ne(ge,we)));for(const Ke of je)Me=X(Me,Ke);this.#r.has(se)&&(Me=X(Me,z({facet:this.#r.get(se)}))),Me=X(Me,be);const Ye=Me.edit;Ye&&Ye.editor&&Ye.enabled!==!0&&!f(Ye.enabled)&&(se.edit||{}).editor&&K(`column.editor-not-enabled:${se.id||se.field}`,`column '${se.id||se.field}' names the editor '${Ye.editor}' but does not enable editing, so it stays read-only. Add \`enabled: true\`, or use \`edit: true\` and set \`editor\` alongside it.`);const Ae=se.id||se.field||t("col");if(se.shadow&&!f(Me.value&&Me.value.compute)){const Ke=typeof se.shadow=="string"?{kind:se.shadow}:se.shadow,Xe=Ke.of||se.field||Ae,nt=F.includes(Ke.kind),st=nt?Ke.model||Ke:null,wt=nt&&st?[...Array.isArray(st.predictors)?st.predictors:[],st.response].filter(Boolean):null;Me.value={...Me.value||{},deps:wt&&wt.length?wt:Ke.orderBy&&Ke.orderBy!==Xe?[Xe,Ke.orderBy]:[Xe],pure:!1,compute:(pt,St)=>{const Ct=St.grid&&St.grid.statistics;if(!Ct)return null;const Mt=St.row&&St.row.key||Ct.keyOf(St.data);if(!Mt)return null;if(nt){if(!f(Ct.fitShadow))return null;const at=Ke.model?{...Ke.model,threshold:Ke.threshold}:Ke;return Ct.fitShadow(Ke.kind,Mt,at)}return Ct.shadow(Xe,Ke.kind,Mt,Ke.scope,Ke)}}}if(se.running&&!f(Me.value&&Me.value.compute)){const Ke=typeof se.running=="string"?{kind:se.running}:se.running,Xe=Ke.of||se.field||Ae;Me.value={...Me.value||{},deps:[Xe],pure:!1,compute:(nt,st)=>{const wt=st.grid&&st.grid.statistics;if(!wt||!f(wt.running))return null;const pt=st.row&&st.row.key||wt.keyOf(st.data);return pt?wt.running(Xe,Ke.kind||"total",pt):null}},se.sort===void 0&&(Me.sort={...Me.sort||{},enabled:!1})}const Ve=se.field??(f(Me.value&&Me.value.compute)?null:se.id??null),Pe=f(Me.value&&Me.value.compute),Oe={id:Ae,field:Ve,shadow:se.shadow||null,running:se.running||null,spec:se.spec||null,validation:se.validation||null,volatile:!!(se.shadow||se.running),title:Me.title??b(Ve||Ae),type:ge.name,dataType:ge,itemType:we,nullable:Me.nullable!==!1,align:T(be.cell&&be.cell.align||be.align||Me.cell&&Me.cell.align||Me.align||ge.defaults&&ge.defaults.align)||"start",verticalAlign:A(be.cell&&be.cell.verticalAlign||be.verticalAlign||Me.cell&&Me.cell.verticalAlign||Me.verticalAlign)||this.#c,rowSpan:f(Me.rowSpan)?Me.rowSpan:null,colSpan:f(Me.colSpan)?Me.colSpan:null,value:{pure:!0,...Me.value||{}},cell:{...Me.cell||{}},edit:{...Me.edit||{}},sort:{...Me.sort||{}},filter:{...Me.filter||{}},group:{enabled:!1,index:-1,explode:!1,...Me.group||{}},pivot:{enabled:!1,index:-1,...Me.pivot||{}},total:this.#u(Me.total,ge,se.id||se.field||"(unnamed)"),groupTotal:Me.groupTotal===void 0?null:this.#u(Me.groupTotal,ge,se.id||se.field||"(unnamed)"),grandTotal:Me.grandTotal===void 0?null:this.#u(Me.grandTotal,ge,se.id||se.field||"(unnamed)"),tags:oe(Me.tags),typeOptions:Me.typeOptions??null,...o(Me[xe])?{[xe]:Me[xe]}:{},layout:Y(Me.layout,be),header:{...Me.header||{}},contextMenu:Me.contextMenu===void 0?null:Me.contextMenu,facet:{...Me.facet||{}},export:{...Me.export||{}},allowGroup:Me.allowGroup!==!1,allowPivot:Me.allowPivot!==!1,allowTotal:Me.allowTotal!==!1,quickFilter:Me.quickFilter!==!1,def:se,format:Me.format,presets:ke,inferred:pe!=null&&!se.type,computed:Pe,diff:se.diff===void 0?void 0:!!se.diff,read:Ve?H(Ve):null,write:Ve?S(Ve):null};Oe.cell.align=T(be.cell&&be.cell.align)||Oe.align,Oe.header.align=T(be.header&&be.header.align)||Oe.align;const He=Me.lookup||null;return Oe.lookup=He?k({id:Ae,lookup:He},{locale:this.#a,onChange:()=>{this.#w&&this.#w("lookup",{colId:Ae})}}):null,Oe.group.explode&&Oe.lookup&&Oe.lookup.multiple&&K(`explode:${Ae}`,`column "${Ae}" has \`group.explode\`, so rows appear under each of their values and totals double-count. Group footers should be annotated accordingly.`),this.#v(Oe),Oe}#v(se){se.formatter=s(se.format,se.dataType,this.#a,this.#l,se.id),se.formatValue=E(se,{locale:this.#a,grid:this.#h,context:this.#p}),se.itemCompare=se.itemType?u(se.itemType,this.#a):null,se.compare=f(se.value.compare)?se.value.compare:se.lookup?se.lookup.comparator():f(se.dataType.compareFor)?se.dataType.compareFor(se):u(se.dataType,this.#a),se.excel=se.formatter&&se.formatter.ooxml||se.dataType&&se.dataType.excel||"General",se.storeKind=l(se.dataType,!!(se.lookup&&se.lookup.multiple))}#T(se,pe,be){let ke=o(se.typeOptions)?se.typeOptions:null;for(let we=pe.length-1;!ke&&we>=0;we--)o(pe[we].typeOptions)&&(ke=pe[we].typeOptions);!ke&&o(this.#i.typeOptions)&&(ke=this.#i.typeOptions);const je=ke&&ke.of!==void 0?ke.of:"text",xe=typeof je=="string"?this.#s.get(je):void 0;return xe&&!f(xe.items)&&xe.storage!=="object"?xe:(K(`type:of:${String(je)}`,`column "${be}" names "${String(je)}" as its item type (typeOptions.of), which is not ${xe?"a scalar data type":"a known data type"}; its items are read as text.`),this.#s.get("text"))}#S(se,pe,be){if(se.type===!1)return"text";if(se.type)return se.type;for(let ke=pe.length-1;ke>=0;ke--)if(pe[ke].type)return pe[ke].type;if(this.#i.type)return this.#i.type;if(se.shadow){const ke=typeof se.shadow=="string"?se.shadow:se.shadow.kind;if(ke==="fitInfluence")return"boolean";if(ke==="fitPredicted"||ke==="fitResidual"||ke==="fitStdResidual"||ke==="fitLeverage"||ke==="fitCooksD"||ke==="tsTrend"||ke==="tsSeasonal"||ke==="tsResidual"||ke==="tsCoverage"||ke==="tsSmoothed"||ke==="tsSmoothingAlpha"||ke==="tsSmoothingBeta")return"number"}return be||(se.lookup?"lookup":"text")}#E(se){const pe=this.all();this.#m=d(pe),this.#g?this.#g.setGraph(this.#m):this.#g=new N({columns:this.#e,graph:this.#m,grid:this.#h,context:this.#p,stored:se||null,rowKey:this.#b});const be=this.#g;for(const ke of pe)ke.getValue=(je,xe)=>be.value(ke,je,xe)}all(){return this.#t.map(se=>this.#e.get(se))}visible(){return this.all().filter(se=>!se.layout.hidden)}get(se){return this.#e.get(se)}groups(){const se=pe=>{const be=[];for(const ke of pe)Array.isArray(ke.columns)?be.push({...ke,columns:se(ke.columns)}):ke.column&&be.push(ke.column);return be};return se(this.#n)}graph(){return this.#m}pipeline(){return this.#g}types(){return this.#s}affectedBy(se){return p(this.#m,se)}value(se,pe,be){return this.#g.value(se,pe,be)}text(se,pe,be){return this.#g.text(se,pe,be)}checkImpure(se,pe){x(this.#e.get(se),pe)}setLocale(se){this.#a=se;for(const pe of this.all())pe.lookup&&pe.lookup.setLocale(se),this.#v(pe);this.#w&&this.#w("locale",{locale:se})}infer(se){const pe={};if(this.#y||!Array.isArray(se)||se.length===0)return pe;this.#y=!0;let be=!1;for(const ke of this.all()){const je=ke.def;if(je.type!==void 0||!ke.field||ke.computed||ke.lookup||this.#N(ke))continue;const xe=ke.read||(Me=>G(Me,ke.field)),ge=y(ke.id,se,xe,this.#s,{sampleSize:this.#j});if(ge===ke.type)continue;pe[ke.id]=ge;const we=this.#O(je,ge);we.groupPath=ke.groupPath,we.layout={...we.layout,...ae(ke.layout)},this.#e.set(ke.id,we),Ie(this.#n,ke.id,we),be=!0}return be&&this.#E(null),pe}redecorate(se,pe,be={}){const ke=this.#e.get(se);if(!ke){K(`redecorate:${se}`,`columns.decorate('${se}', …): no column with id '${se}'.`);return}const je=ke.def||{},xe={...o(je.cell)?je.cell:{}};xe.decoration=pe??void 0,be&&"variant"in be&&(xe.variant=be.variant);const ge={...je,cell:xe};this.#r.has(je)&&this.#r.set(ge,this.#r.get(je));const we=this.#O(ge,ke.type);return we.groupPath=ke.groupPath,we.layout={...we.layout,...ae(ke.layout)},ke.lookup&&ke.lookup!==we.lookup&&f(ke.lookup.destroy)&&ke.lookup.destroy(),this.#e.set(se,we),Ie(this.#n,se,we),this.#E(null),this.#w&&this.#w("decorate",{colId:se}),we}destroy(){for(const se of this.#e.values())se.lookup&&f(se.lookup.destroy)&&se.lookup.destroy()}#N(se){for(const pe of se.presets){const be=this.#o[pe];if(be&&be.type)return!0}return!!this.#i.type}#P(se){return!se.computed&&f(se.dataType&&se.dataType.toStorage)}storeReader(se){if(se.computed)return pe=>this.#g.value(se,pe,null);if(this.#P(se)){const pe=se.dataType.toStorage,be={timeZone:this.#l,colId:se.id,itemType:se.itemType||null};return ke=>pe(se.read(ke),be)}return se.read}storeValue(se,pe){if(!(!se||se.computed)&&f(se.read))return this.storeReader(se)(pe)}storeSchema(){const se=[];for(const pe of this.all()){if(pe.computed&&pe.value.pure===!1||!pe.computed&&!pe.field)continue;const be=this.storeReader(pe);let ke=null;!pe.computed&&!this.#P(pe)&&typeof pe.field=="string"&&!pe.lookup&&(ke=pe.field);const je={id:pe.id,kind:pe.storeKind,nullable:pe.nullable,read:be};ke!==null&&(je.field=ke),pe.lookup&&(je.dictionary=pe.lookup.dictionary()),se.push(je)}return se}state(){return this.all().map(se=>({id:se.id,width:se.layout.width,flex:se.layout.flex||void 0,hidden:!!se.layout.hidden,headerWrap:se.header?.wrap===!0?!0:void 0,headerOrientation:se.header?.orientation==="vertical"?"vertical":void 0,pin:se.layout.pin??null,sort:se.sort.direction??null,sortIndex:se.sort.direction?se.sort.order??0:null,groupIndex:se.group.enabled?se.group.index??0:null,pivotIndex:se.pivot.enabled?se.pivot.index??0:null,total:typeof se.total=="string"?se.total:null,groupTotal:typeof se.groupTotal=="string"?se.groupTotal:void 0,grandTotal:typeof se.grandTotal=="string"?se.grandTotal:void 0,decoration:se.cell&&se.cell.decoration!=null?fe(se.cell.decoration):void 0,variant:se.cell&&se.cell.variant!=null?fe(se.cell.variant):void 0}))}applyState(se,pe={}){const be={applied:[],skipped:[]},ke=Array.isArray(se)?se:se&&se.columns||[],je=!Array.isArray(se)&&se&&se.columnOrder||null;for(const ge of ke){if(!ge||!ge.id){be.skipped.push({key:"?",reason:"no id"});continue}let we=this.#e.get(ge.id);if(!we){be.skipped.push({key:ge.id,reason:"unknown column"});continue}if(Object.hasOwn(ge,"decoration")||Object.hasOwn(ge,"variant")){const Me=we.cell?we.cell.decoration:void 0,Ye=ge.decoration??null,Ae=Object.hasOwn(ge,"variant"),Ve=Ae&&!de(we.cell?we.cell.variant:void 0,ge.variant);(!de(Me,Ye)||Ve)&&(this.redecorate(ge.id,Ye,Ae?{variant:ge.variant??void 0}:{}),we=this.#e.get(ge.id)||we)}ge.width!=null&&(we.layout.width=ge.width),ge.flex!=null&&(we.layout.flex=ge.flex),ge.hidden!=null&&(we.layout.hidden=!!ge.hidden),ge.headerWrap!==void 0&&(we.header.wrap=!!ge.headerWrap),ge.headerOrientation!==void 0&&(we.header.orientation=ge.headerOrientation==="vertical"?"vertical":"horizontal"),ge.pin!==void 0&&(we.layout.pin=ge.pin),ge.sort!==void 0&&(we.sort.direction=ge.sort),ge.sortIndex!=null&&(we.sort.order=ge.sortIndex),ge.groupIndex!=null&&(we.group.enabled=!0,we.group.index=ge.groupIndex),ge.pivotIndex!=null&&(we.pivot.enabled=!0,we.pivot.index=ge.pivotIndex),ge.total!==void 0&&(we.total=ge.total),ge.groupTotal!==void 0&&(we.groupTotal=ge.groupTotal),ge.grandTotal!==void 0&&(we.grandTotal=ge.grandTotal),be.applied.push(ge.id)}const xe=je||(pe&&pe.keepOrder?[]:ke.map(ge=>ge&&ge.id).filter(Boolean));if(xe.length){const ge=xe.filter(Me=>this.#e.has(Me)),we=this.#t.filter(Me=>!ge.includes(Me));this.#t=[...ge,...we]}return this.#w&&this.#w("state",be),be}move(se,pe){this.#M(se,pe)&&(this.#L(),this.#w&&this.#w("move",{id:se,to:pe}))}reorder(se){const pe={applied:[],skipped:[]},be=[];let ke=0;for(const je of Array.isArray(se)?se:[]){const xe=ke++;this.#M(je,xe)&&(pe.applied.push(je),be.push({id:je,to:xe}))}if(!be.length)return pe;if(this.#L(),this.#w)for(const je of be)this.#w("move",je);return pe}#M(se,pe){const be=this.#t.indexOf(se);if(be===-1||Math.max(0,Math.min(Number(pe)||0,this.#t.length-1))===be)return!1;const je=this.#e.get(se);if(je.layout.movable===!1||je.layout.lockPosition)return K(`move:${se}`,`column "${se}" is not movable; the move was ignored`),!1;const xe=this.#R(se,pe);return xe?(K(`move.married:${xe}`,`band "${xe}" declares marryChildren, so its columns stay together; the move was ignored`),!1):(this.#t.splice(be,1),this.#t.splice(Math.max(0,Math.min(pe,this.#t.length)),0,se),!0)}#R(se,pe){if(!this.#n||!this.#n.length)return null;const be=this.#t.filter(ge=>ge!==se),ke=Math.max(0,Math.min(pe,be.length)),je=(ge,we)=>{if(Array.isArray(ge.columns)){for(const Ye of ge.columns)je(Ye,we);return we}const Me=ge.column?ge.column.id:ge.id;return Me&&we.push(Me),we},xe=ge=>{for(const we of ge){if(!Array.isArray(we.columns))continue;if(we.marryChildren===!0){const Ye=je(we,[]),Ae=Ye.includes(se),Ve=Ye.map(Pe=>be.indexOf(Pe)).filter(Pe=>Pe>=0);if(Ve.length){const Pe=Math.min(...Ve),Oe=Math.max(...Ve);if(Ae?ke<Pe||ke>Oe+1:ke>Pe&&ke<=Oe)return we.id}}const Me=xe(we.columns);if(Me)return Me}return null};return xe(this.#n)}#L(){const se=new Map(this.#t.map((ke,je)=>[ke,je])),pe=ke=>{if(!Array.isArray(ke.columns)){const xe=ke.column?ke.column.id:ke.id;return se.has(xe)?se.get(xe):1/0}let je=1/0;for(const xe of ke.columns)je=Math.min(je,pe(xe));return je},be=ke=>{ke.sort((je,xe)=>pe(je)-pe(xe));for(const je of ke)Array.isArray(je.columns)&&be(je.columns)};be(this.#n)}#G(se){const pe=be=>{for(let ke=0;ke<be.length;ke++){const je=be[ke];if(Array.isArray(je.columns)){const xe=pe(je.columns);if(xe)return xe}else if(je.column&&je.column.id===se)return be.splice(ke,1)[0]}return null};return pe(this.#n)}#_(se){const pe=[];for(let be=se.length-1;be>=0;be--){const ke=se[be];Array.isArray(ke.columns)&&(pe.push(...this.#_(ke.columns)),ke.columns.length===0&&(pe.push(ke.id),se.splice(be,1)))}return pe}#x(){const se=(pe,be,ke)=>{for(const je of pe)Array.isArray(je.columns)?se(je.columns,[...be,je.id]):je.column&&(je.column.groupPath=be)};se(this.#n,[])}#I(se){const pe=new Set(se),be=this.#t.filter(ge=>pe.has(ge));if(!be.length)return;const ke=Math.min(...be.map(ge=>this.#t.indexOf(ge))),je=this.#t.slice(0,ke).filter(ge=>!pe.has(ge)),xe=this.#t.slice(ke).filter(ge=>!pe.has(ge));this.#t=[...je,...be,...xe]}#Y(se){const pe=[],be=ke=>{if(Array.isArray(ke.columns))for(const je of ke.columns)be(je);else ke.column&&pe.push(ke.column.id)};return be(se),pe}#D(se){const pe=be=>{for(const ke of be){if(!Array.isArray(ke.columns))continue;if(ke.id===se)return{node:ke,parent:be};const je=pe(ke.columns);if(je)return je}return null};return pe(this.#n)}groupColumns(se,pe={}){const be=B(se).filter(we=>this.#e.has(we));if(!be.length)return K("columns.group.empty","groupColumns was given no known column ids; nothing was grouped."),null;for(const we of be)if(this.#e.get(we).layout.lockPosition)return K(`columns.group.locked:${we}`,`column "${we}" is position-locked and cannot be grouped.`),null;const ke=pe.groupId?this.#D(pe.groupId):null;if(pe.groupId&&!ke)return K(`columns.group.unknown:${pe.groupId}`,`no band "${pe.groupId}" to add to; nothing was grouped.`),null;let je=null;if(!ke&&pe.id!=null&&(je=String(pe.id),this.#D(je)||this.#e.has(je)))return K(`columns.group.idtaken:${je}`,`band id "${je}" is already in use; nothing was grouped.`),null;const xe=be.map(we=>this.#G(we)).filter(Boolean);if(!xe.length)return null;let ge;if(ke)ke.node.columns.push(...xe),ge=ke.node.id;else{const we={id:je||t("grp"),title:pe.title||"",collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!1,header:{},def:{},columns:xe},Me=Number.isInteger(pe.at)?Math.max(0,Math.min(pe.at,this.#n.length)):this.#n.length;this.#n.splice(Me,0,we),ge=we.id}return this.#_(this.#n),this.#I(be),this.#x(),this.#L(),this.#w&&this.#w("columngroup",{action:"formed",groupId:ge,ids:be}),ge}ungroupColumn(se){const pe=this.#e.get(se);if(!pe){K(`columns.ungroup.unknown:${se}`,`no column "${se}" to ungroup.`);return}const be=pe.groupPath||[];if(!be.length)return;const ke=be[be.length-1],je=this.#D(ke);if(!je)return;const xe=this.#G(se);if(!xe)return;const ge=je.parent.indexOf(je.node);je.parent.splice(ge+1,0,xe);const we=this.#_(this.#n),Me=this.#Y(je.node);if(Me.length){this.#I(Me);const Ye=Math.max(...Me.map(Ve=>this.#t.indexOf(Ve))),Ae=this.#t.filter(Ve=>Ve!==se);Ae.splice(Ye+1,0,se),this.#t=Ae}this.#x(),this.#L(),this.#w&&this.#w("columngroup",{action:"removed",id:se,dissolved:we})}renameGroup(se,pe){const be=this.#D(se);if(!be){K(`columns.group.rename:${se}`,`no band "${se}" to rename.`);return}be.node.title=String(pe??""),this.#w&&this.#w("columngroup",{action:"renamed",groupId:se,title:be.node.title})}dissolveGroup(se){const pe=this.#D(se);if(!pe){K(`columns.group.dissolve:${se}`,`no band "${se}" to dissolve.`);return}const be=pe.parent.indexOf(pe.node);pe.parent.splice(be,1,...pe.node.columns),this.#x(),this.#L(),this.#w&&this.#w("columngroup",{action:"dissolved",groupId:se})}moveGroup(se,pe){const be=this.#D(se);if(!be){K(`columns.group.move:${se}`,`no band "${se}" to move.`);return}const ke=be.parent,je=ke.indexOf(be.node);je!==-1&&(ke.splice(je,1),ke.splice(Math.max(0,Math.min(pe,ke.length)),0,be.node),this.#K(),this.#x(),this.#w&&this.#w("columngroup",{action:"moved",groupId:se,to:pe}))}#K(){const se=[],pe=ke=>{for(const je of ke)Array.isArray(je.columns)?pe(je.columns):je.column&&se.push(je.column.id)};pe(this.#n);const be=new Set(se);this.#t=[...se,...this.#t.filter(ke=>!be.has(ke))]}groupTree(){const se=be=>be.map(ke=>Array.isArray(ke.columns)?{id:ke.id,title:ke.title||"",collapsible:!!ke.collapsible,openByDefault:ke.openByDefault!==!1,columns:se(ke.columns)}:ke.column?ke.column.id:null).filter(ke=>ke!==null),pe=se(this.#n);return pe.some(be=>be&&typeof be=="object")?pe:[]}applyGroupTree(se){if(!Array.isArray(se))return;const pe=new Set,be=je=>{const xe=[];for(const ge of je)if(ge&&typeof ge=="object"&&Array.isArray(ge.columns)){const we=be(ge.columns);if(!we.length)continue;xe.push({id:ge.id||t("grp"),title:ge.title||"",collapsible:ge.collapsible===!0,openByDefault:ge.openByDefault!==!1,showWhen:"always",marryChildren:!1,header:{},def:{},columns:we})}else if(typeof ge=="string"){const we=this.#e.get(ge);we&&!pe.has(ge)&&(pe.add(ge),xe.push({column:we,path:[]}))}return xe},ke=be(se);for(const je of this.#t){if(pe.has(je))continue;const xe=this.#e.get(je);xe&&ke.push({column:xe,path:[]})}this.#n=ke,this.#x(),this.#L(),this.#w&&this.#w("columngroup",{action:"applied"})}show(se){this.#H(se,!1)}hide(se){this.#H(se,!0)}#H(se,pe){const be=[];for(const ke of B(se)){const je=this.#e.get(ke);if(je){if(pe&&je.layout.lockVisible){K(`lockVisible:${ke}`,`column "${ke}" is \`layout.lockVisible\` and cannot be hidden`);continue}je.layout.hidden!==pe&&(je.layout.hidden=pe,be.push(ke))}}be.length&&this.#w&&this.#w("visible",{ids:be,hidden:pe})}pin(se,pe){const be=this.#e.get(se);be&&(be.layout.pin=pe??null,this.#w&&this.#w("pin",{id:se,side:be.layout.pin}))}pinMany(se){const pe={};for(const[ke,je]of se){const xe=this.#e.get(ke);xe&&(xe.layout.pin=je??null,pe[ke]=xe.layout.pin)}const be=Object.keys(pe);be.length&&this.#w&&this.#w("pin",{ids:be,pins:pe})}#B(se,pe){const be=se.layout.min??0,ke=se.layout.max;let je=Math.max(be,pe);return ke!=null&&(je=Math.min(ke,je)),se.layout.width=je,se.layout.flex=0,je}resize(se,pe){const be=this.#e.get(se);if(!be)return;if(be.layout.resizable===!1){K(`resize:${se}`,`column "${se}" is not resizable; the resize was ignored`);return}const ke=this.#B(be,pe);this.#w&&this.#w("resize",{id:se,width:ke})}resizeMany(se){const pe={};for(const[ke,je]of se){const xe=this.#e.get(ke);if(xe){if(xe.layout.resizable===!1){K(`resize:${ke}`,`column "${ke}" is not resizable; the resize was ignored`);continue}pe[ke]=this.#B(xe,je)}}const be=Object.keys(pe);be.length&&this.#w&&this.#w("resize",{ids:be,widths:pe})}}function ae(Le){const se={};return Le.width!=null&&(se.width=Le.width),Le.hidden!=null&&(se.hidden=Le.hidden),Le.pin!==void 0&&(se.pin=Le.pin),se}function fe(Le){if(Le===null||typeof Le!="object")return Le;try{return structuredClone(Le)}catch{}try{return JSON.parse(JSON.stringify(Le))}catch{return Le}}function de(Le,se){const pe=Le??null,be=se??null;if(pe===be)return!0;if(pe===null||be===null)return!1;if(typeof pe!="object"||typeof be!="object")return pe===be;try{return JSON.stringify(pe)===JSON.stringify(be)}catch{return!1}}function ve(Le){const se=[],pe=(ke,je,xe)=>{const ge=[];for(const we of ke){if(!o(we)){Z("a column definition must be an object");continue}if(Array.isArray(we.columns)){J(we,V,"columnGroup",we.title||we.id||"(unnamed)");const Me={id:we.id||t("grp"),title:we.title||"",collapsible:we.collapsible===!0,openByDefault:we.openByDefault!==!1,showWhen:we.showWhen||"always",marryChildren:we.marryChildren===!0,header:we.header||{},def:we,columns:[]};Me.columns=pe(we.columns,[...je,Me.id],we.facet!==void 0?we.facet:xe),ge.push(Me)}else{const Me={def:we,path:je,facet:xe};se.push(Me),ge.push(Me)}}return ge},be=pe(Le,[],void 0);return{leaves:se,groups:be}}function Ie(Le,se,pe){for(const be of Le){if(be.columns){if(Ie(be.columns,se,pe))return!0;continue}if(be.column&&be.column.id===se)return be.column=pe,!0}return!1}}),De("packages/core/src/columns/autogroup.js",function(e,U){"use strict";Object.defineProperty(e,"AUTO_GROUP_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createAutoGroupColumn",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"warnOnAbsurdGrouping",{enumerable:!0,get:function(){return K}});const M=U("packages/core/src/internal/warn.js").warnOnce,X="__lattice_group",B=240,D=.5;function Z(I){const{columns:G,groupBy:H}=I,S=H.map(c=>G.get(c)).filter(Boolean),O=S.length?S.map(c=>c.title||c.id).join(" > "):"Group",b=I.config&&I.config.autoGroupColumnWidth||B;return{id:X,field:null,title:O,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!0},groupedIds:H.slice(),group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:b,min:120,pin:I.config&&I.config.autoGroupColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(c,f){return f&&f.group?f.groupValue:null},formatValue(c,f){if(!f||!f.group)return"";if(f.grandTotal)return I.config&&I.config.grandTotalLabel||"Total";const o=S[Math.min(f.level||0,S.length-1)];return o&&typeof o.formatValue=="function"?o.formatValue(c,f):c==null?"":String(c)}}}function K(I,G,H){!I.length||H<100||G<H*D||M(`grouping.cardinality:${I.join(",")}`,`grouping by ${I.join(", ")} produced ${G} groups for ${H} rows: nearly one group per row. Grouping a continuous value such as a percentage or a timestamp rarely reads usefully; consider a computed banding column.`)}}),De("packages/core/src/columns/selectcolumn.js",function(e,U){"use strict";Object.defineProperty(e,"SELECT_COLUMN_ID",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"createSelectionColumn",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return B}});const te="__lattice_select",M=44;function X(D){const Z=D.selection||{},K=D.config&&D.config.selectionColumnWidth||M;return{id:te,field:null,title:"",type:"boolean",dataType:{base:"boolean"},nullable:!1,align:"center",generated:!0,control:!0,value:{pure:!0},cell:{render:"checkbox",props:{mode:"selection"},align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:K,min:K,max:K,pin:D.config&&D.config.selectionColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,headerCheckbox:Z.headerCheckbox===!0,def:{},getValue(I,G){return G?G.selected:!1},formatValue(){return""}}}const B=X}),De("packages/core/src/columns/rownumbercolumn.js",function(e,U){"use strict";Object.defineProperty(e,"ROW_NUMBER_COLUMN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createRowNumberColumn",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return G}});const M=U("packages/core/src/internal/predicates.js").isFunction,X="__lattice_rownumber",B=40,D=9,Z=22;function K(H){const S=String(Math.max(1,Math.trunc(Math.abs(H))||1)).length;return Math.max(B,S*D+Z)}function I(H){const S=H.rowNumbers,O=S&&typeof S=="object"?S:{},b=Number.isFinite(O.start)?O.start:1,c=Number.isFinite(O.width)?O.width:K((H.maxNumber||0)+b),f=M(H.rank)?H.rank:()=>null;return{id:X,field:null,title:typeof O.title=="string"?O.title:"",type:"number",dataType:{base:"number"},nullable:!0,align:"end",generated:!0,control:!0,value:{pure:!0},cell:{align:"end"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:c,min:c,max:c,pin:"start",hidden:!1,resizable:O.width==null,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(o,n){const t=f(n);return t==null?null:t-1+b},formatValue(o){return o==null?"":String(o)}}}const G=I}),De("packages/core/src/model/detail.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_DETAIL_HEIGHT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"DEFAULT_CACHE_LIMIT",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"resolveDetail",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DetailModel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return G}});const M=U("packages/core/src/internal/predicates.js").isFunction,B=U("packages/core/src/internal/warn.js").warnOnce,D=240,Z=10;function K(H){if(!H)return null;const S=H===!0?{}:H;return S.enabled===!1?null:!M(S.rows)&&!S.render?(B("detail.rows","detail is enabled but neither `rows` nor `render` was supplied; expanding a master would show an empty region, so it stays off."),null):{render:S.render||null,config:S.config||null,rows:M(S.rows)?S.rows:null,height:S.height??D,maxHeight:S.maxHeight??null,cacheLimit:Number.isFinite(S.cacheLimit)?Math.max(0,S.cacheLimit):Z,isMaster:M(S.isMaster)?S.isMaster:null,target:S.target||null,onCreate:M(S.onCreate)?S.onCreate:null,path:typeof S.path=="string"?S.path:null}}class I{#e;#t=new Set;#n;#r=0;constructor(S){this.#e=S.config,this.#n=M(S.onChange)?S.onChange:()=>{}}get config(){return this.#e}get inline(){return!this.#e.target}isMaster(S){if(!S||S.group||S.detail)return!1;const O=this.#e.isMaster;return O?!!O(S.data,S):!0}isOpen(S){return this.#t.has(S)}keys(){return[...this.#t]}activeKey(){for(const S of this.#t)return S;return null}heightOf(S){const O=this.#e.height;return M(O)?Number(O(S))||D:O==="auto"?D:Number(O)||D}open(S){return this.#t.has(S)?!1:(this.inline||this.#t.clear(),this.#t.add(S),this.#s(),!0)}close(S){return this.#t.delete(S)?(this.#s(),!0):!1}toggle(S){return this.#t.has(S)?(this.close(S),!1):(this.open(S),!0)}closeAll(){this.#t.size&&(this.#t.clear(),this.#s())}prune(S){if(!this.#t.size||!M(S))return;let O=!1;for(const b of[...this.#t])S(b)||(this.#t.delete(b),O=!0);O&&this.#s()}signature(){return`${this.#r}`}set(S){this.#t.clear();const O=Array.isArray(S)?S:[];for(const b of this.inline?O:O.slice(0,1))this.#t.add(b);this.#s()}#s(){this.#r++,this.#n()}}const G=I}),De("packages/core/src/compute/special.js",function(e,U){"use strict";Object.defineProperty(e,"logGamma",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"incompleteBeta",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"normalQuantile",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"normalCdf",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"studentT",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"studentTQuantile",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"regularizedGammaP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"chiSquareUpperTail",{enumerable:!0,get:function(){return o}});const te=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),M=3e-12,X=1e-300;function B(n){if(n<.5)return Math.log(Math.PI/Math.sin(Math.PI*n))-B(1-n);const t=n-1;let i=.9999999999998099;const s=t+7.5;for(let r=0;r<te.length;r++)i+=te[r]/(t+r+1);return .5*Math.log(2*Math.PI)+(t+.5)*Math.log(s)-s+Math.log(i)}function D(n,t,i){const s=n+t,r=n+1,u=n-1;let a=1,l=1-s*i/r;Math.abs(l)<X&&(l=X),l=1/l;let h=l;for(let y=1;y<=300;y++){const m=2*y;let v=y*(t-y)*i/((u+m)*(n+m));l=1+v*l,Math.abs(l)<X&&(l=X),a=1+v/a,Math.abs(a)<X&&(a=X),l=1/l,h*=l*a,v=-(n+y)*(s+y)*i/((n+m)*(r+m)),l=1+v*l,Math.abs(l)<X&&(l=X),a=1+v/a,Math.abs(a)<X&&(a=X),l=1/l;const d=l*a;if(h*=d,Math.abs(d-1)<M)break}return h}function Z(n,t,i){if(!(n>0)||!(t>0)||!Number.isFinite(i))return Number.NaN;if(i<=0)return 0;if(i>=1)return 1;const s=Math.exp(B(n+t)-B(n)-B(t)+n*Math.log(i)+t*Math.log(1-i));return i<(n+1)/(n+t+2)?s*D(n,t,i)/n:1-s*D(t,n,1-i)/t}function K(n){if(!(n>0)||!(n<1))return n===0?-1/0:n===1?1/0:Number.NaN;const t=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],i=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],s=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],r=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],u=.02425;let a,l,h;n<u?(a=Math.sqrt(-2*Math.log(n)),h=(((((s[0]*a+s[1])*a+s[2])*a+s[3])*a+s[4])*a+s[5])/((((r[0]*a+r[1])*a+r[2])*a+r[3])*a+1)):n<=1-u?(a=n-.5,l=a*a,h=(((((t[0]*l+t[1])*l+t[2])*l+t[3])*l+t[4])*l+t[5])*a/(((((i[0]*l+i[1])*l+i[2])*l+i[3])*l+i[4])*l+1)):(a=Math.sqrt(-2*Math.log(1-n)),h=-(((((s[0]*a+s[1])*a+s[2])*a+s[3])*a+s[4])*a+s[5])/((((r[0]*a+r[1])*a+r[2])*a+r[3])*a+1));const m=(.5*I(-h/Math.SQRT2)-n)*Math.sqrt(2*Math.PI)*Math.exp(h*h/2);return h-m/(1+h*m/2)}function I(n){const t=Math.abs(n),i=2/(2+t),s=4*i-2,r=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,15626441722e-18,-85238095915e-18,6529054439e-18,5059343495e-18,-991364156e-18,-227365122e-18,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18];let u=0,a=0,l;for(let y=r.length-1;y>0;y--)l=a,a=s*a-u+r[y],u=l;const h=i*Math.exp(-t*t+.5*(r[0]+s*a)-u);return n>=0?h:2-h}function G(n){return .5*I(-n/Math.SQRT2)}function H(n,t){if(!(t>0)||!Number.isFinite(n))return Number.NaN;const i=.5*Z(t/2,.5,t/(t+n*n));return n>0?1-i:i}function S(n,t){if(!(n>0)||!(n<1)||!(t>0))return Number.NaN;if(t>1e7)return K(n);let i=-1e4,s=1e4,r=K(n);const u=B(t/2)+B(.5)-B((t+1)/2);for(let a=0;a<60;a++){const l=H(r,t);l<n?i=r:s=r;const h=Math.exp(-((t+1)/2)*Math.log(1+r*r/t)-u)/Math.sqrt(t),y=h>0?(l-n)/h:0;if(Math.abs(y)<1e-12)break;const m=r-y;if(r=m>i&&m<s&&Number.isFinite(m)?m:(i+s)/2,s-i<1e-12)break}return r}function O(n,t){let i=n,s=1/n,r=s;for(let u=0;u<300&&(i+=1,r*=t/i,s+=r,!(Math.abs(r)<Math.abs(s)*M));u++);return s*Math.exp(-t+n*Math.log(t)-B(n))}function b(n,t){let i=t+1-n,s=1/X,r=1/i,u=r;for(let a=1;a<=300;a++){const l=-a*(a-n);i+=2,r=l*r+i,Math.abs(r)<X&&(r=X),s=i+l/s,Math.abs(s)<X&&(s=X),r=1/r;const h=r*s;if(u*=h,Math.abs(h-1)<M)break}return Math.exp(-t+n*Math.log(t)-B(n))*u}function c(n,t){return!(n>0)||!(t>=0)||!Number.isFinite(t)?Number.NaN:t===0?0:t<n+1?O(n,t):1-b(n,t)}function f(n,t){return t>0?c(t/2,n/2):Number.NaN}function o(n,t){const i=f(n,t);return Number.isNaN(i)?Number.NaN:Math.min(1,Math.max(0,1-i))}}),De("packages/core/src/compute/linalg.js",function(e,U){"use strict";Object.defineProperty(e,"cholesky",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"choleskySolve",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"choleskyInverse",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"normalEquations",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"matVec",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"quadForm",{enumerable:!0,get:function(){return Z}});function te(K){const I=K.length,G=Array.from({length:I},()=>new Array(I).fill(0));for(let H=0;H<I;H++)for(let S=0;S<=H;S++){let O=K[H][S];for(let b=0;b<S;b++)O-=G[H][b]*G[S][b];if(H===S){if(!(O>0))return null;G[H][S]=Math.sqrt(O)}else G[H][S]=O/G[S][S]}return G}function M(K,I){const G=K.length,H=new Array(G).fill(0);for(let O=0;O<G;O++){let b=I[O];for(let c=0;c<O;c++)b-=K[O][c]*H[c];H[O]=b/K[O][O]}const S=new Array(G).fill(0);for(let O=G-1;O>=0;O--){let b=H[O];for(let c=O+1;c<G;c++)b-=K[c][O]*S[c];S[O]=b/K[O][O]}return S}function X(K){const I=K.length,G=Array.from({length:I},()=>new Array(I).fill(0));for(let H=0;H<I;H++){const S=new Array(I).fill(0);S[H]=1;const O=M(K,S);for(let b=0;b<I;b++)G[b][H]=O[b]}return G}function B(K,I,G){const H=K.length,S=H?K[0].length:0,O=Array.from({length:S},()=>new Array(S).fill(0)),b=new Array(S).fill(0);for(let c=0;c<H;c++){const f=G?G[c]:1,o=K[c];for(let n=0;n<S;n++){const t=f*o[n];b[n]+=t*I[c];for(let i=n;i<S;i++)O[n][i]+=t*o[i]}}for(let c=0;c<S;c++)for(let f=0;f<c;f++)O[c][f]=O[f][c];return{xtwx:O,xtwy:b}}function D(K,I){return K.map(G=>G.reduce((H,S,O)=>H+S*I[O],0))}function Z(K,I){let G=0;for(let H=0;H<K.length;H++){let S=0;for(let O=0;O<K.length;O++)S+=I[H][O]*K[O];G+=K[H]*S}return G}}),De("packages/core/src/compute/sketch.js",function(e,U){"use strict";Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return O}});class te{#e=0;#t=0;#n=0;static get errorBound(){return Object.freeze({kind:"exact",metric:"none",value:0,statement:"mean and variance match a full recompute to float rounding"})}get count(){return this.#e}add(c){if(!Number.isFinite(c))return;this.#e++;const f=c-this.#t;this.#t+=f/this.#e,this.#n+=f*(c-this.#t)}merge(c){if(c.#e===0)return;if(this.#e===0){this.#e=c.#e,this.#t=c.#t,this.#n=c.#n;return}const f=this.#e+c.#e,o=c.#t-this.#t;this.#t+=o*(c.#e/f),this.#n+=c.#n+o*o*(this.#e*c.#e/f),this.#e=f}mean(){return this.#e?this.#t:null}variance(){return this.#e>1?this.#n/(this.#e-1):null}varianceP(){return this.#e?this.#n/this.#e:null}stddev(){const c=this.variance();return c===null?null:Math.sqrt(c)}stddevP(){const c=this.varianceP();return c===null?null:Math.sqrt(c)}}class M{#e=[];#t=0;#n;#r;constructor(c,f=Math.random){if(!(c>0))throw new RangeError("reservoir capacity must be positive");this.#n=Math.floor(c),this.#r=f}static get errorBound(){return Object.freeze({kind:"probabilistic",metric:"none",value:0,statement:"uniform sample: each element included with probability capacity/n; sample statistics are unbiased estimators"})}get seen(){return this.#t}get size(){return this.#e.length}add(c){if(!Number.isFinite(c))return;if(this.#t++,this.#e.length<this.#n){this.#e.push(c);return}const f=Math.floor(this.#r()*this.#t);f<this.#n&&(this.#e[f]=c)}sample(){return this.#e.slice()}mean(){if(!this.#e.length)return null;let c=0;for(const f of this.#e)c+=f;return c/this.#e.length}quantile(c){const f=this.#e.length;if(!f)return null;const o=this.#e.slice().sort((s,r)=>s-r);if(f===1)return o[0];const n=(f-1)*Math.min(1,Math.max(0,c)),t=Math.floor(n),i=Math.ceil(n);return t===i?o[t]:o[t]+(n-t)*(o[i]-o[t])}}function X(b){return b^=b>>>16,b=Math.imul(b,2246822507),b^=b>>>13,b=Math.imul(b,3266489909),b^=b>>>15,b>>>0}function B(b){if(typeof b=="number"){const o=new DataView(new ArrayBuffer(8));return o.setFloat64(0,b===0?0:b),X(o.getUint32(0)^o.getUint32(4))}const c=typeof b=="string"?b:String(b);let f=2166136261;for(let o=0;o<c.length;o++)f^=c.charCodeAt(o),f=Math.imul(f,16777619);return X(f)}class D{#e;#t;#n;constructor(c=14){const f=Math.floor(c);if(f<4||f>16)throw new RangeError("HLL precision must be 4..16");this.#e=f,this.#t=1<<f,this.#n=new Uint8Array(this.#t)}static errorBoundFor(c=14){const f=1<<Math.floor(c),o=1.04/Math.sqrt(f);return Object.freeze({kind:"probabilistic",metric:"relative",value:o,statement:`distinct count within ~${(o*100).toFixed(2)}% relative standard error (m=${f} buckets)`})}errorBound(){return D.errorBoundFor(this.#e)}add(c){const f=B(c),o=f&this.#t-1,n=f>>>this.#e|1<<32-this.#e;let t=1,i=n;for(;(i&1)===0;)t++,i>>>=1;t>this.#n[o]&&(this.#n[o]=t)}count(){const c=this.#t,f=32-this.#e,o=new Float64Array(f+2);for(let i=0;i<c;i++)o[this.#n[i]]++;let n=c*I(1-o[f+1]/c);for(let i=f;i>=1;i--)n=.5*(n+o[i]);n+=c*K(o[0]/c);const t=Z*c*c/n;return Math.round(t)}}const Z=.5/Math.log(2);function K(b){if(b===1)return 1/0;let c=1,f=b,o;do b*=b,o=f,f+=b*c,c+=c;while(f!==o);return f}function I(b){if(b===0||b===1)return 0;let c=1,f=1-b,o;do b=Math.sqrt(b),o=f,c*=.5,f-=(1-b)**2*c;while(f!==o);return f/3}class G{#e=new Map;#t;#n=0;constructor(c){if(!(c>0))throw new RangeError("Space-Saving capacity must be positive");this.#t=Math.floor(c)}errorBoundFor(c){const f=c/this.#t;return Object.freeze({kind:"deterministic",metric:"absolute",value:f,statement:`each count overestimates the truth by at most N/m = ${f.toFixed(2)} (N=${c}, m=${this.#t})`})}get seen(){return this.#n}add(c){this.#n++;const f=this.#e.get(c);if(f){f.count++;return}if(this.#e.size<this.#t){this.#e.set(c,{count:1,error:0});return}let o,n=1/0;for(const[t,i]of this.#e)i.count<n&&(n=i.count,o=t);this.#e.delete(o),this.#e.set(c,{count:n+1,error:n})}top(c=this.#t){return[...this.#e.entries()].map(([o,n])=>({item:o,count:n.count,error:n.error})).sort((o,n)=>n.count-o.count).slice(0,Math.max(0,Math.floor(c)))}}class H{#e;#t=[[]];#n=0;#r;#s;constructor(c=200,f=Math.random){this.#e=Math.max(8,Math.floor(c)),this.#r=f,this.#s=2/3}static errorBoundFor(c=200){const f=1/Math.max(8,Math.floor(c));return Object.freeze({kind:"probabilistic",metric:"rank",value:f,statement:`queried quantile's true rank within ~${(f*100).toFixed(2)}% of N of the requested rank (k=${c})`})}errorBound(){return H.errorBoundFor(this.#e)}get count(){return this.#n}#i(c){const o=this.#t.length-1-c,n=Math.ceil(this.#e*this.#s**o);return Math.max(2,n)}add(c){Number.isFinite(c)&&(this.#n++,this.#t[0].push(c),this.#t[0].length>=this.#i(0)&&this.#o(0))}#o(c){const f=this.#t[c];f.sort((t,i)=>t-i),c+1>=this.#t.length&&this.#t.push([]);const o=this.#t[c+1],n=this.#r()<.5?0:1;for(let t=n;t<f.length;t+=2)o.push(f[t]);this.#t[c]=[];for(let t=0;t<this.#t.length;t++)if(this.#t[t].length>=this.#i(t)){this.#o(t);return}}#l(){const c=[];for(let f=0;f<this.#t.length;f++){const o=1<<f;for(const n of this.#t[f])c.push({v:n,w:o})}return c}quantile(c){const f=this.#l();if(!f.length)return null;f.sort((i,s)=>i.v-s.v);let o=0;for(const i of f)o+=i.w;const n=Math.min(1,Math.max(0,c))*o;let t=0;for(const i of f)if(t+=i.w,t>=n)return i.v;return f[f.length-1].v}rank(c){let f=0;for(let o=0;o<this.#t.length;o++){const n=1<<o;for(const t of this.#t[o])t<=c&&(f+=n)}return f}}const S=Object.freeze({distinct:D.errorBoundFor(14),median:H.errorBoundFor(200),p25:H.errorBoundFor(200),p75:H.errorBoundFor(200),p90:H.errorBoundFor(200),p95:H.errorBoundFor(200),p99:H.errorBoundFor(200),iqr:H.errorBoundFor(200),topK:Object.freeze({kind:"deterministic",metric:"absolute",value:0,statement:"each count overestimates the truth by at most N/m; top-K exact when the K-th item exceeds N/m"})}),O={Welford:te,Reservoir:M,HyperLogLog:D,SpaceSaving:G,KLL:H,hash32:B,SKETCH_BOUNDS:S}}),De("packages/core/src/compute/statistics.js",function(e,U){"use strict";Object.defineProperty(e,"KENDALL_LIMIT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"numbers",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"frequencies",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"herfindahl",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"entropy",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"evenness",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"topShare",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"gini",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"moments",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantileSorted",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"quantile",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"STAT_FNS",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"STAT_LABELS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"weightedAverage",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"extremeRow",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"correlation",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"trimmedMean",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"winsorizedMean",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"modifiedZOutliers",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"jarqueBera",{enumerable:!0,get:function(){return $}}),Object.defineProperty(e,"weightedQuantile",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"pairs",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"covariance",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"regression",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"fitLinearModel",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(e,"ADF_CT_CRITICAL",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(e,"augmentedDickeyFuller",{enumerable:!0,get:function(){return se}}),Object.defineProperty(e,"autocorrelations",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(e,"spearman",{enumerable:!0,get:function(){return be}}),Object.defineProperty(e,"kendall",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(e,"seriesStats",{enumerable:!0,get:function(){return je}}),Object.defineProperty(e,"D2_N2",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(e,"D4_N2",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(e,"movingRanges",{enumerable:!0,get:function(){return we}}),Object.defineProperty(e,"withinSigma",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(e,"capability",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(e,"controlLimits",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(e,"westernElectricViolations",{enumerable:!0,get:function(){return Ve}}),Object.defineProperty(e,"nelsonViolations",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(e,"CONTROL_RULE_SETS",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(e,"controlViolations",{enumerable:!0,get:function(){return He}}),Object.defineProperty(e,"countOutside",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(e,"histogram",{enumerable:!0,get:function(){return Xe}}),Object.defineProperty(e,"DEFAULT_CONFIDENCE",{enumerable:!0,get:function(){return nt}}),Object.defineProperty(e,"meanInterval",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(e,"proportionInterval",{enumerable:!0,get:function(){return pt}}),Object.defineProperty(e,"slopeInterval",{enumerable:!0,get:function(){return St}}),Object.defineProperty(e,"capabilityInterval",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(e,"standardizedMeanDifference",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(e,"normalTotalVariation",{enumerable:!0,get:function(){return at}}),Object.defineProperty(e,"frequencyMap",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(e,"categoricalDistance",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(e,"SUBSET_RELIABILITY_FLOOR",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(e,"compareColumn",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(e,"isNumericColumn",{enumerable:!0,get:function(){return me}}),Object.defineProperty(e,"populationRead",{enumerable:!0,get:function(){return Ce}});const te=U("packages/core/src/compute/handle.js"),M=te.presenceReader,X=te.valueReader,B=U("packages/core/src/compute/special.js"),D=B.studentTQuantile,Z=B.studentT,K=B.normalQuantile,I=B.normalCdf,G=B.chiSquareUpperTail,H=U("packages/core/src/compute/linalg.js"),S=H.cholesky,O=H.choleskySolve,b=H.choleskyInverse,c=H.normalEquations,f=H.quadForm,n=U("packages/core/src/compute/sketch.js").SKETCH_BOUNDS,t=5e3,i=Object.freeze({variance:"rescan",varianceP:"rescan",stddev:"rescan",stddevP:"rescan",sumSquares:"rescan",weightedAvg:"rescan",median:"rescan",p25:"rescan",p75:"rescan",p90:"rescan",p95:"rescan",p99:"rescan",iqr:"rescan",mode:"rescan",distinct:"rescan",range:"rescan",skewness:"rescan",kurtosis:"rescan",geomean:"rescan",harmean:"rescan",mad:"rescan",argmin:"rescan",argmax:"rescan",hhi:"rescan",entropy:"rescan",evenness:"rescan",top3Share:"rescan",top10Share:"rescan",gini:"rescan",trimmedMean:"rescan",winsorizedMean:"rescan",robustOutliers:"rescan",jarqueBera:"rescan",passRate:"rescan",failureCount:"rescan"}),s=Object.freeze({distinct:Object.freeze({sketch:"HyperLogLog",bound:n.distinct}),median:Object.freeze({sketch:"KLL",bound:n.median}),p25:Object.freeze({sketch:"KLL",bound:n.p25}),p75:Object.freeze({sketch:"KLL",bound:n.p75}),p90:Object.freeze({sketch:"KLL",bound:n.p90}),p95:Object.freeze({sketch:"KLL",bound:n.p95}),p99:Object.freeze({sketch:"KLL",bound:n.p99}),iqr:Object.freeze({sketch:"KLL",bound:n.iqr}),top3Share:Object.freeze({sketch:"SpaceSaving",bound:n.topK}),top10Share:Object.freeze({sketch:"SpaceSaving",bound:n.topK})});function r(ce){const ye=ce==="sum"||ce==="avg"||ce==="countValues"||ce==="min"||ce==="max"?"maintained":Object.prototype.hasOwnProperty.call(i,ce)?i[ce]:null,he=Object.prototype.hasOwnProperty.call(s,ce)?s[ce]:null;return{stat:ce,exact:ye,approximate:he}}function u(ce,ye){const he=ye.length,Se=new Float64Array(he);let Ee=0;if(ce&&(ce.kind==="float64"||ce.kind==="int32")){const Ue=ce.values,_e=M(ce);for(let Je=0;Je<he;Je++){const $e=ye[Je];if(_e&&_e($e)!==1)continue;const ze=Ue[$e];Number.isNaN(ze)||(Se[Ee++]=ze)}return Se.subarray(0,Ee)}const Fe=X(ce);for(let Ue=0;Ue<he;Ue++){const _e=Fe(ye[Ue]);if(_e==null||_e==="")continue;const Je=typeof _e=="number"?_e:Number(_e);Number.isFinite(Je)&&(Se[Ee++]=Je)}return Se.subarray(0,Ee)}function a(ce,ye){const he=new Map,Se=X(ce);let Ee=0;for(let Fe=0;Fe<ye.length;Fe++){const Ue=Se(ye[Fe]);if(Ue==null||Ue===""||typeof Ue=="number"&&Number.isNaN(Ue))continue;const _e=typeof Ue=="object"?String(Ue):Ue;he.set(_e,(he.get(_e)||0)+1),Ee++}const Te=[...he.values()].sort((Fe,Ue)=>Ue-Fe);return{counts:Te,total:Ee,distinct:Te.length}}function l(ce){return ce.total>0?ce.counts.map(ye=>ye/ce.total):[]}function h(ce,ye){const he=a(ce,ye);if(!he.total)return null;let Se=0;for(const Ee of l(he))Se+=Ee*Ee;return Se}function y(ce,ye){const he=a(ce,ye);if(!he.total)return null;let Se=0;for(const Ee of l(he))Ee>0&&(Se-=Ee*Math.log2(Ee));return Se}function m(ce,ye){const he=a(ce,ye);if(!he.total||he.distinct<2)return he.total?1:null;let Se=0;for(const Ee of l(he))Ee>0&&(Se-=Ee*Math.log2(Ee));return Se/Math.log2(he.distinct)}function v(ce,ye,he=3){const Se=a(ce,ye);if(!Se.total)return null;const Ee=Math.max(1,Math.floor(he));let Te=0;for(let Fe=0;Fe<Math.min(Ee,Se.counts.length);Fe++)Te+=Se.counts[Fe];return Te/Se.total}function d(ce,ye){const he=u(ce,ye),Se=he.length;if(!Se)return null;const Ee=he.slice().sort();if(Ee[0]<0)return null;let Te=0,Fe=0;for(let Ue=0;Ue<Se;Ue++)Te+=Ee[Ue],Fe+=(Ue+1)*Ee[Ue];return Te===0?0:2*Fe/(Se*Te)-(Se+1)/Se}function p(ce){let ye=0,he=0,Se=0;for(let Ee=0;Ee<ce.length;Ee++){const Te=ce[Ee];ye++;const Fe=Te-he;he+=Fe/ye,Se+=Fe*(Te-he)}return{n:ye,mean:he,m2:Se}}function g(ce,ye){const he=ce.length;if(!he)return NaN;if(he===1)return ce[0];const Se=(he-1)*Math.min(1,Math.max(0,ye)),Ee=Math.floor(Se),Te=Math.ceil(Se);return Ee===Te?ce[Ee]:ce[Ee]+(Se-Ee)*(ce[Te]-ce[Ee])}function k(ce,ye){if(!ce.length)return NaN;const he=ce.slice().sort();return g(he,ye)}function w(ce,ye){const he=X(ce);let Se=0,Ee=0,Te=0;for(let Fe=0;Fe<ye.length;Fe++){const Ue=he(ye[Fe]);if(Ue==null||Ue==="")continue;const _e=String(Ue).toUpperCase();_e==="PASS"?Se++:_e==="FAIL"?Ee++:_e==="WARN"&&Te++}return{pass:Se+Te,fail:Ee,warn:Te,judged:Se+Te+Ee}}const E=Object.freeze({hhi:(ce,ye)=>h(ce,ye),entropy:(ce,ye)=>y(ce,ye),evenness:(ce,ye)=>m(ce,ye),top3Share:(ce,ye)=>v(ce,ye,3),top10Share:(ce,ye)=>v(ce,ye,10),gini:(ce,ye)=>d(ce,ye),trimmedMean:(ce,ye)=>L(u(ce,ye),.1),winsorizedMean:(ce,ye)=>j(u(ce,ye),.1),robustOutliers:(ce,ye)=>R(u(ce,ye),3.5),jarqueBera:(ce,ye)=>$(u(ce,ye)),variance:(ce,ye)=>{const{n:he,m2:Se}=p(u(ce,ye));return he>1?Se/(he-1):null},varianceP:(ce,ye)=>{const{n:he,m2:Se}=p(u(ce,ye));return he>0?Se/he:null},stddev:(ce,ye)=>{const{n:he,m2:Se}=p(u(ce,ye));return he>1?Math.sqrt(Se/(he-1)):null},stddevP:(ce,ye)=>{const{n:he,m2:Se}=p(u(ce,ye));return he>0?Math.sqrt(Se/he):null},median:(ce,ye)=>{const he=u(ce,ye);return he.length?k(he,.5):null},p25:(ce,ye)=>{const he=u(ce,ye);return he.length?k(he,.25):null},p75:(ce,ye)=>{const he=u(ce,ye);return he.length?k(he,.75):null},p90:(ce,ye)=>{const he=u(ce,ye);return he.length?k(he,.9):null},p95:(ce,ye)=>{const he=u(ce,ye);return he.length?k(he,.95):null},p99:(ce,ye)=>{const he=u(ce,ye);return he.length?k(he,.99):null},iqr:(ce,ye)=>{const he=u(ce,ye);if(!he.length)return null;const Se=he.slice().sort();return g(Se,.75)-g(Se,.25)},mad:(ce,ye)=>{const he=u(ce,ye);if(!he.length)return null;const Se=k(he,.5),Ee=new Float64Array(he.length);for(let Te=0;Te<he.length;Te++)Ee[Te]=Math.abs(he[Te]-Se);return k(Ee,.5)},range:(ce,ye)=>{const he=u(ce,ye);if(!he.length)return null;let Se=1/0,Ee=-1/0;for(let Te=0;Te<he.length;Te++)he[Te]<Se&&(Se=he[Te]),he[Te]>Ee&&(Ee=he[Te]);return Ee-Se},distinct:(ce,ye)=>{const he=X(ce),Se=new Set;for(let Ee=0;Ee<ye.length;Ee++){const Te=he(ye[Ee]);Te==null||Te===""||Se.add(Te instanceof Date?Te.getTime():Te)}return Se.size},mode:(ce,ye)=>{const he=X(ce),Se=new Map;for(let Fe=0;Fe<ye.length;Fe++){const Ue=he(ye[Fe]);if(Ue==null||Ue==="")continue;const _e=Ue instanceof Date?Ue.getTime():Ue;Se.set(_e,(Se.get(_e)||0)+1)}let Ee=null,Te=1;for(const[Fe,Ue]of Se)Ue>Te&&(Te=Ue,Ee=Fe);return Ee},skewness:(ce,ye)=>{const he=u(ce,ye),{n:Se,mean:Ee,m2:Te}=p(he);if(Se<3||Te<=0)return null;const Fe=Math.sqrt(Te/(Se-1));let Ue=0;for(let _e=0;_e<he.length;_e++)Ue+=((he[_e]-Ee)/Fe)**3;return Se/((Se-1)*(Se-2))*Ue},kurtosis:(ce,ye)=>{const he=u(ce,ye),{n:Se,mean:Ee,m2:Te}=p(he);if(Se<4||Te<=0)return null;const Fe=Math.sqrt(Te/(Se-1));let Ue=0;for(let $e=0;$e<he.length;$e++)Ue+=((he[$e]-Ee)/Fe)**4;const _e=Se*(Se+1)/((Se-1)*(Se-2)*(Se-3)),Je=3*(Se-1)**2/((Se-2)*(Se-3));return _e*Ue-Je},geomean:(ce,ye)=>{const he=u(ce,ye);if(!he.length)return null;let Se=0;for(let Ee=0;Ee<he.length;Ee++){if(he[Ee]<=0)return null;Se+=Math.log(he[Ee])}return Math.exp(Se/he.length)},harmean:(ce,ye)=>{const he=u(ce,ye);if(!he.length)return null;let Se=0;for(let Ee=0;Ee<he.length;Ee++){if(he[Ee]===0)return null;Se+=1/he[Ee]}return he.length/Se},sumSquares:(ce,ye)=>{const he=u(ce,ye);let Se=0;for(let Ee=0;Ee<he.length;Ee++)Se+=he[Ee]*he[Ee];return Se},passRate:(ce,ye)=>{const{pass:he,judged:Se}=w(ce,ye);return Se?he/Se:null},failureCount:(ce,ye)=>w(ce,ye).fail}),N=Object.freeze({hhi:"Concentration (HHI)",entropy:"Entropy",evenness:"Evenness",top3Share:"Top 3 share",top10Share:"Top 10 share",gini:"Gini coefficient",trimmedMean:"Trimmed mean",winsorizedMean:"Winsorized mean",robustOutliers:"Outliers (robust)",jarqueBera:"Jarque–Bera",median:"Median",p25:"25th percentile",p75:"75th percentile",p90:"90th percentile",p95:"95th percentile",p99:"99th percentile",iqr:"Interquartile range",mad:"Median absolute deviation",variance:"Variance",varianceP:"Variance (population)",stddev:"Standard deviation",stddevP:"Standard deviation (population)",range:"Range",distinct:"Distinct",mode:"Mode",skewness:"Skewness",kurtosis:"Kurtosis",geomean:"Geometric mean",harmean:"Harmonic mean",sumSquares:"Sum of squares",weightedAvg:"Weighted average",argmin:"Lowest by",argmax:"Highest by",passRate:"Pass rate",failureCount:"Failures"});function x(ce,ye,he){const Se=X(ce),Ee=X(ye);let Te=0,Fe=0;for(let Ue=0;Ue<he.length;Ue++){const _e=he[Ue],Je=Number(Se(_e)),$e=Number(Ee(_e));!Number.isFinite(Je)||!Number.isFinite($e)||(Te+=Je*$e,Fe+=$e)}return Fe===0?null:Te/Fe}function _(ce,ye,he){const Se=X(ce);let Ee=null,Te=he?-1/0:1/0;for(let Fe=0;Fe<ye.length;Fe++){const Ue=ye[Fe],_e=Number(Se(Ue));Number.isFinite(_e)&&(he?_e>Te:_e<Te)&&(Te=_e,Ee=Ue)}return Ee}function F(ce,ye,he){const Se=X(ce),Ee=X(ye);let Te=0,Fe=0,Ue=0,_e=0,Je=0,$e=0;for(let et=0;et<he.length;et++){const dt=he[et],ft=Number(Se(dt)),lt=Number(Ee(dt));!Number.isFinite(ft)||!Number.isFinite(lt)||(Te++,Fe+=ft,Ue+=lt,_e+=ft*ft,Je+=lt*lt,$e+=ft*lt)}if(Te<2)return null;const ze=Te*$e-Fe*Ue,Qe=Math.sqrt((Te*_e-Fe*Fe)*(Te*Je-Ue*Ue));if(Qe===0)return null;const tt=ze/Qe;return Math.max(-1,Math.min(1,tt))}function L(ce,ye=.1){const he=ce.length;if(!he)return null;const Se=Array.from(ce).sort((Ue,_e)=>Ue-_e),Ee=Math.floor(he*Math.min(.49,Math.max(0,ye))),Te=Se.slice(Ee,he-Ee);if(!Te.length)return g(Se,.5);let Fe=0;for(const Ue of Te)Fe+=Ue;return Fe/Te.length}function j(ce,ye=.1){const he=ce.length;if(!he)return null;const Se=Array.from(ce).sort((_e,Je)=>_e-Je),Ee=Math.floor(he*Math.min(.49,Math.max(0,ye))),Te=Se[Ee],Fe=Se[he-1-Ee];let Ue=0;for(const _e of Se)Ue+=Math.min(Fe,Math.max(Te,_e));return Ue/he}function R(ce,ye=3.5){if(!ce.length)return null;const Se=Array.from(ce).sort((_e,Je)=>_e-Je),Ee=g(Se,.5),Te=Se.map(_e=>Math.abs(_e-Ee)).sort((_e,Je)=>_e-Je),Fe=g(Te,.5);if(Fe===0)return null;let Ue=0;for(const _e of Se)Math.abs(.6745*(_e-Ee)/Fe)>ye&&Ue++;return Ue}function $(ce){const ye=ce.length;if(ye<8)return null;let he=0;for(const _e of ce)he+=_e;he/=ye;let Se=0,Ee=0,Te=0;for(const _e of ce){const Je=_e-he;Se+=Je*Je,Ee+=Je*Je*Je,Te+=Je*Je*Je*Je}if(Se/=ye,Ee/=ye,Te/=ye,Se===0)return null;const Fe=Ee/Se**1.5,Ue=Te/(Se*Se)-3;return ye/6*(Fe*Fe+Ue*Ue/4)}function T(ce,ye,he){const Se=[];let Ee=0;for(let _e=0;_e<ce.length;_e++){const Je=Number(ce[_e]),$e=Number(ye[_e]);!Number.isFinite(Je)||!Number.isFinite($e)||$e<=0||(Se.push([Je,$e]),Ee+=$e)}if(!Se.length||Ee<=0)return null;if(Se.sort((_e,Je)=>_e[0]-Je[0]),Se.length===1)return Se[0][0];const Te=[];let Fe=0;for(const[,_e]of Se)Te.push((Fe+_e/2)/Ee),Fe+=_e;const Ue=Math.max(0,Math.min(1,he));if(Ue<=Te[0])return Se[0][0];if(Ue>=Te[Te.length-1])return Se[Se.length-1][0];for(let _e=1;_e<Te.length;_e++){if(Ue>Te[_e])continue;const Je=Te[_e]-Te[_e-1],$e=Je>0?(Ue-Te[_e-1])/Je:0;return Se[_e-1][0]+(Se[_e][0]-Se[_e-1][0])*$e}return Se[Se.length-1][0]}function A(ce,ye,he){const Se=X(ce),Ee=X(ye),Te=new Float64Array(he.length),Fe=new Float64Array(he.length);let Ue=0;for(let _e=0;_e<he.length;_e++){const Je=he[_e],$e=Number(Se(Je)),ze=Number(Ee(Je));!Number.isFinite($e)||!Number.isFinite(ze)||(Te[Ue]=$e,Fe[Ue]=ze,Ue++)}return{xs:Te.subarray(0,Ue),ys:Fe.subarray(0,Ue),n:Ue}}function C(ce,ye,he,Se=!1){const{xs:Ee,ys:Te,n:Fe}=A(ce,ye,he);if(Fe<2)return null;let Ue=0,_e=0;for(let $e=0;$e<Fe;$e++)Ue+=Ee[$e],_e+=Te[$e];Ue/=Fe,_e/=Fe;let Je=0;for(let $e=0;$e<Fe;$e++)Je+=(Ee[$e]-Ue)*(Te[$e]-_e);return Je/(Se?Fe:Fe-1)}function z(ce,ye,he){const{xs:Se,ys:Ee,n:Te}=A(ce,ye,he);if(Te<2)return null;let Fe=0,Ue=0;for(let ft=0;ft<Te;ft++)Fe+=Se[ft],Ue+=Ee[ft];Fe/=Te,Ue/=Te;let _e=0,Je=0,$e=0;for(let ft=0;ft<Te;ft++){const lt=Se[ft]-Fe,At=Ee[ft]-Ue;_e+=lt*lt,Je+=lt*At,$e+=At*At}if(_e===0)return null;const ze=Je/_e,Qe=Ue-ze*Fe,tt=$e===0?1:Math.max(0,Math.min(1,Je*Je/(_e*$e))),et=Math.max(0,$e-ze*Je),dt=Te>2?Math.sqrt(et/(Te-2)/_e):0;return{slope:ze,intercept:Qe,r2:tt,stdError:dt,n:Te}}const Y=new Set(["ols","wls","robust"]),q=new Set(["quantile"]),V=new Set(["ridge","lasso","elasticnet","mixed","gls"]),J=1.345;function ee(ce,ye,he){const{xtwx:Se,xtwy:Ee}=c(ce,ye,he),Te=S(Se);if(!Te)return null;const Fe=O(Te,Ee),Ue=b(Te),_e=ne(ce,Fe),Je=ye.map(($e,ze)=>$e-_e[ze]);return{beta:Fe,cov:Ue,fitted:_e,residuals:Je}}function ne(ce,ye){return ce.map(he=>he.reduce((Se,Ee,Te)=>Se+Ee*ye[Te],0))}function oe(ce,ye){const he=ce.length,Se=ce.map(Je=>Je[ye]),Ee=ce.map(Je=>[1,...Je.filter(($e,ze)=>ze!==ye)]),Te=ee(Ee,Se,null);if(!Te)return 1;const Fe=Se.reduce((Je,$e)=>Je+$e,0)/he;let Ue=0,_e=0;for(let Je=0;Je<he;Je++)Ue+=Te.residuals[Je]**2,_e+=(Se[Je]-Fe)**2;return _e===0?1:Math.max(0,Math.min(1,1-Ue/_e))}function re(ce){const ye=[...ce].sort((Ee,Te)=>Ee-Te),he=ae(ye),Se=ce.map(Ee=>Math.abs(Ee-he)).sort((Ee,Te)=>Ee-Te);return ae(Se)/.6745}function ae(ce){const ye=ce.length;if(!ye)return 0;const he=Math.floor(ye/2);return ye%2?ce[he]:(ce[he-1]+ce[he])/2}function fe(ce,ye,he={}){const Se=he.method||"ols";if(V.has(Se))throw new Error(`[lattice] regression method "${Se}" is out of scope; use ols, wls or robust.`);if(q.has(Se))throw new Error("[lattice] quantile regression is coming next and not yet available; use ols, wls or robust.");if(!Y.has(Se))throw new Error(`[lattice] unknown regression method "${Se}"; use ols, wls or robust.`);const Ee=Array.isArray(ye)?ye.length:0,Te=Ee&&Array.isArray(ce[0])?ce[0].length:0,Fe=Te+1;if(!(Ee>Fe))return null;for(let $t=0;$t<Ee;$t++){if(!Number.isFinite(ye[$t])||!Array.isArray(ce[$t])||ce[$t].length!==Te)return null;for(let Dt=0;Dt<Te;Dt++)if(!Number.isFinite(ce[$t][Dt]))return null}let Ue=null;if(Se==="wls"){if(Ue=he.weights,!Array.isArray(Ue)||Ue.length!==Ee)return null;for(let $t=0;$t<Ee;$t++)if(!(Ue[$t]>0)||!Number.isFinite(Ue[$t]))return null}const _e=ce.map($t=>[1,...$t]);let Je,$e=null;if(Se==="robust"){if(Je=ee(_e,ye,null),!Je)return null;for(let $t=0;$t<50;$t++){const Dt=re(Je.residuals);if(!(Dt>0))break;const _t=Je.residuals.map(Jt=>{const qt=Math.abs(Jt/Dt);return qt<=J?1:J/qt}),Yt=ee(_e,ye,_t);if(!Yt)return null;const Qt=Yt.beta.reduce((Jt,qt,rn)=>Math.max(Jt,Math.abs(qt-Je.beta[rn])),0);if(Je=Yt,$e=_t,Qt<1e-10)break}}else if(Je=ee(_e,ye,Ue),!Je)return null;const ze=Se==="robust"?$e:Ue,{beta:Qe,cov:tt,fitted:et,residuals:dt}=Je;let ft=0,lt=0,At=0;for(let $t=0;$t<Ee;$t++){const Dt=ze?ze[$t]:1;ft+=Dt*dt[$t]**2,lt+=Dt,At+=Dt*ye[$t]}const Tt=At/lt;let It=0;for(let $t=0;$t<Ee;$t++){const Dt=ze?ze[$t]:1;It+=Dt*(ye[$t]-Tt)**2}const Ge=Ee-Fe,vt=ft/Ge,ht=It===0?1:Math.max(0,Math.min(1,1-ft/It)),kt=1-(1-ht)*(Ee-1)/Ge,Nt=Array.isArray(he.names)&&he.names.length===Te?he.names:ce[0].map(($t,Dt)=>`x${Dt+1}`),bt=st(he.confidence),mt=Ge>0?D(1-(1-bt)/2,Ge):1/0,Lt=Qe.map(($t,Dt)=>{const _t=Math.sqrt(Math.max(0,vt*tt[Dt][Dt])),Yt=_t>0?$t/_t:$t===0?0:1/0,Qt=Number.isFinite(Yt)?2*(1-Z(Math.abs(Yt),Ge)):0,Jt=Number.isFinite(mt)?mt*_t:null;return{name:Dt===0?"(intercept)":Nt[Dt-1],estimate:$t,stdError:_t,t:Yt,p:Math.max(0,Math.min(1,Qt)),lower:Jt===null?null:$t-Jt,upper:Jt===null?null:$t+Jt}}),Ht=new Array(Ee),Xt=new Array(Ee);for(let $t=0;$t<Ee;$t++){const Dt=ze?ze[$t]:1,_t=Math.max(0,Math.min(1,Dt*f(_e[$t],tt)));Ht[$t]=_t;const Yt=(1-_t)**2;Xt[$t]=Yt>0&&vt>0?dt[$t]**2/(Fe*vt)*(_t/Yt):null}const mn=ce[0].map(($t,Dt)=>{if(Te<2)return 1;const _t=oe(ce,Dt);return _t>=1?1/0:1/(1-_t)});let fn=null;{const $t=dt.map(_t=>_t*_t),Dt=ee(_e,$t,null);if(Dt){const _t=$t.reduce((en,gn)=>en+gn,0)/Ee;let Yt=0,Qt=0;for(let en=0;en<Ee;en++)Yt+=Dt.residuals[en]**2,Qt+=($t[en]-_t)**2;const Jt=Qt===0?0:Math.max(0,Math.min(1,1-Yt/Qt)),qt=Ee*Jt,rn=G(qt,Te);fn={statistic:qt,df:Te,p:rn,heteroscedastic:rn<.05}}}let an=null;if(Te===1){const $t=ce.map((Dt,_t)=>_t).sort((Dt,_t)=>ce[Dt][0]-ce[_t][0]);an={confidence:bt,points:$t.map(Dt=>{const _t=_e[Dt],Yt=Math.sqrt(Math.max(0,vt*f(_t,tt)));return{x:ce[Dt][0],yhat:et[Dt],lower:et[Dt]-mt*Yt,upper:et[Dt]+mt*Yt}})}}return{method:Se,coefficients:Lt,r2:ht,adjR2:kt,n:Ee,df:Ge,sigma2:vt,fitted:et,residuals:dt,leverage:Ht,cooksD:Xt,vif:mn,heteroscedasticity:fn,band:an,weights:ze?[...ze]:null}}function de(ce){const ye=ce.length,he=Array.from({length:ye},(Te,Fe)=>Fe).sort((Te,Fe)=>ce[Te]-ce[Fe]),Se=new Float64Array(ye);let Ee=0;for(;Ee<ye;){let Te=Ee;for(;Te+1<ye&&ce[he[Te+1]]===ce[he[Ee]];)Te++;const Fe=(Ee+Te)/2+1;for(let Ue=Ee;Ue<=Te;Ue++)Se[he[Ue]]=Fe;Ee=Te+1}return Se}const ve=Object.freeze({"1%":-3.9638,"5%":-3.4126,"10%":-3.1279});function Ie(ce){const ye=[.01,.05,.1],he=[ve["1%"],ve["5%"],ve["10%"]];if(ce<=he[0]){const Te=(Math.log(ye[1])-Math.log(ye[0]))/(he[1]-he[0]);return Math.max(1e-4,Math.min(.01,Math.exp(Math.log(ye[0])+Te*(ce-he[0]))))}if(ce>=he[2]){const Te=(Math.log(ye[2])-Math.log(ye[1]))/(he[2]-he[1]);return Math.max(.1,Math.min(.999,Math.exp(Math.log(ye[2])+Te*(ce-he[2]))))}const Se=ce<he[1]?0:1,Ee=(ce-he[Se])/(he[Se+1]-he[Se]);return Math.exp(Math.log(ye[Se])+Ee*(Math.log(ye[Se+1])-Math.log(ye[Se])))}function Le(ce,ye,he,Se){const Ee=he-Se,Te=Se+3,Fe=new Array(Ee),Ue=new Array(Ee);let _e=!0,Je=Se;for(let et=0;et<Ee;et++){const dt=Se+et,ft=new Float64Array(Te);ft[0]=1,ft[1]=et+1,ft[2]=ce[dt];for(let lt=1;lt<=Se;lt++)ft[2+lt]=ye[dt-lt];for(let lt=1;lt<Te;lt++)Number.isFinite(ft[lt])||(Je=Math.min(Je,lt-3));Fe[et]=ft,Ue[et]=ye[dt],Number.isFinite(Ue[et])||(_e=!1)}if(!_e)return 0;const{xtwx:$e,xtwy:ze}=c(Fe,Ue,null);let Qe=0,tt=1/0;for(let et=0;et<=Je;et++){const dt=et+3;if(!(Ee>dt))continue;const ft=new Array(dt);for(let ht=0;ht<dt;ht++)ft[ht]=$e[ht].slice(0,dt);const lt=S(ft);if(!lt)continue;const At=O(lt,ze.slice(0,dt));let Tt=0;for(let ht=0;ht<Ee;ht++){const kt=Fe[ht];let Nt=0;for(let bt=0;bt<dt;bt++)Nt+=kt[bt]*At[bt];Tt+=(Ue[ht]-Nt)**2}const Ge=Tt/(Ee-dt)*(Ee-dt);if(!(Ge>0))continue;const vt=Ee*Math.log(Ge/Ee)+2*dt;vt<tt&&(tt=vt,Qe=et)}return Qe}function se(ce,ye={}){const he=[];for(let tt=0;tt<ce.length;tt++){const et=Number(ce[tt]);Number.isFinite(et)&&he.push(et)}const Se=he.length,Ee=Se-1;if(Se<8||Ee<6)return null;const Te=new Array(Ee);for(let tt=0;tt<Ee;tt++)Te[tt]=he[tt+1]-he[tt];let Fe=Number.isFinite(ye.maxlag)?Math.floor(ye.maxlag):Math.ceil(12*(Se/100)**.25);Fe=Math.max(0,Math.min(Fe,Math.floor((Ee-5)/2)));const Ue=(tt,et)=>{const dt=[],ft=[];for(let lt=et;lt<Ee;lt++){const At=[lt-et+1,he[lt]];for(let Tt=1;Tt<=tt;Tt++)At.push(Te[lt-Tt]);dt.push(At),ft.push(Te[lt])}return fe(dt,ft,{method:"ols"})},_e=Le(he,Te,Ee,Fe),Je=Ue(_e,_e);if(!Je||!Je.coefficients[2])return null;const $e=Je.coefficients[2].t,ze=Ie($e),Qe=$e<ve["5%"];return{statistic:$e,usedLag:_e,nobs:Ee-_e,criticalValues:{...ve},pValue:ze,pApproximate:!0,stationary:Qe,verdict:Qe?"stationary":"non-stationary",regression:"ct"}}function pe(ce,ye={}){const he=[];for(let Qe=0;Qe<ce.length;Qe++){const tt=Number(ce[Qe]);Number.isFinite(tt)&&he.push(tt)}const Se=he.length;if(Se<3)return null;let Ee=Number.isFinite(ye.maxlag)?Math.floor(ye.maxlag):Math.min(10,Se-1);Ee=Math.max(1,Math.min(Ee,Se-1));let Te=0;for(const Qe of he)Te+=Qe;Te/=Se;const Fe=he.map(Qe=>Qe-Te);let Ue=0;for(const Qe of Fe)Ue+=Qe*Qe;Ue/=Se;const _e=new Array(Ee+1).fill(0);_e[0]=1;for(let Qe=1;Qe<=Ee;Qe++){let tt=0;for(let et=Qe;et<Se;et++)tt+=Fe[et]*Fe[et-Qe];_e[Qe]=Ue>0?tt/Se/Ue:0}const Je=new Array(Ee+1).fill(0);Je[0]=1;let $e=[];for(let Qe=1;Qe<=Ee;Qe++){let tt=_e[Qe];for(let lt=1;lt<Qe;lt++)tt-=$e[lt-1]*_e[Qe-lt];let et=1;for(let lt=1;lt<Qe;lt++)et-=$e[lt-1]*_e[lt];const dt=et!==0?tt/et:0,ft=new Array(Qe);for(let lt=1;lt<Qe;lt++)ft[lt-1]=$e[lt-1]-dt*$e[Qe-1-lt];ft[Qe-1]=dt,Je[Qe]=dt,$e=ft}const ze=1.96/Math.sqrt(Se);return{acf:_e,pacf:Je,bounds:{upper:ze,lower:-ze},n:Se,nlags:Ee,approximate:!0}}function be(ce,ye,he){const{xs:Se,ys:Ee,n:Te}=A(ce,ye,he);if(Te<2)return null;const Fe=de(Se),Ue=de(Ee);let _e=0,Je=0;for(let tt=0;tt<Te;tt++)_e+=Fe[tt],Je+=Ue[tt];_e/=Te,Je/=Te;let $e=0,ze=0,Qe=0;for(let tt=0;tt<Te;tt++){const et=Fe[tt]-_e,dt=Ue[tt]-Je;$e+=et*dt,ze+=et*et,Qe+=dt*dt}return ze===0||Qe===0?null:Math.max(-1,Math.min(1,$e/Math.sqrt(ze*Qe)))}function ke(ce,ye,he){const{xs:Se,ys:Ee,n:Te}=A(ce,ye,he);if(Te<2||Te>t)return null;let Fe=0,Ue=0,_e=0,Je=0;for(let Qe=0;Qe<Te;Qe++)for(let tt=Qe+1;tt<Te;tt++){const et=Math.sign(Se[Qe]-Se[tt]),dt=Math.sign(Ee[Qe]-Ee[tt]),ft=et*dt;ft>0?Fe++:ft<0?Ue++:et===0&&dt===0||(et===0?_e++:Je++)}const $e=Fe+Ue+Je,ze=Fe+Ue+_e;return $e===0||ze===0?null:(Fe-Ue)/Math.sqrt($e*ze)}function je(ce,ye={}){const he=ce.length;if(he<2)return null;const Se=ce[0],Ee=ce[he-1],Te=[];for(let lt=1;lt<he;lt++){const At=ce[lt-1];At!==0&&Te.push((ce[lt]-At)/Math.abs(At))}let Fe=null;if(Te.length>1){let lt=0;for(const Tt of Te)lt+=Tt;lt/=Te.length;let At=0;for(const Tt of Te)At+=(Tt-lt)**2;Fe=Math.sqrt(At/(Te.length-1))}const Ue=Number(ye.periodsPerYear)>0?Number(ye.periodsPerYear):null;let _e=ce[0],Je=0,$e=0,ze=0,Qe=0;for(let lt=1;lt<he;lt++){if(ce[lt]>_e){_e=ce[lt],Je=lt;continue}if(_e<=0)continue;const At=(_e-ce[lt])/_e;At>$e&&($e=At,ze=Je,Qe=lt)}let tt=null;if(he>2){let lt=0;for(let It=0;It<he;It++)lt+=ce[It];lt/=he;let At=0,Tt=0;for(let It=0;It<he;It++){const Ge=ce[It]-lt;Tt+=Ge*Ge,It>0&&(At+=Ge*(ce[It-1]-lt))}tt=Tt>0?At/Tt:null}let et=0,dt=0;for(const lt of Te)lt>0?et++:lt<0&&dt++;let ft=null;if(Se>0&&Ee>0){const lt=(Ee/Se)**(1/(he-1))-1;ft=Ue?(1+lt)**Ue-1:lt}return{n:he,first:Se,last:Ee,change:Ee-Se,changePercent:Se===0?null:(Ee-Se)/Math.abs(Se)*100,volatility:Fe,annualisedVolatility:Fe!==null&&Ue?Fe*Math.sqrt(Ue):null,growth:ft,maxDrawdown:$e,maxDrawdownFrom:ze,maxDrawdownTo:Qe,autocorrelation:tt,upDays:et,downDays:dt}}const xe=1.128,ge=3.267;function we(ce){const ye=ce.length;if(ye<2)return null;const he=[];for(let Ee=1;Ee<ye;Ee++)he.push(Math.abs(ce[Ee]-ce[Ee-1]));const Se=he.reduce((Ee,Te)=>Ee+Te,0)/he.length;return{ranges:he,centre:Se,upper:ge*Se,lower:0}}function Me(ce){const ye=ce.length;if(ye<2)return null;let he=0;for(let Ee=1;Ee<ye;Ee++)he+=Math.abs(ce[Ee]-ce[Ee-1]);const Se=he/(ye-1);return{sigma:Se/xe,meanRange:Se}}function Ye(ce,ye){const he=ce.length;if(he<2||!ye)return null;const Se=Number.isFinite(Number(ye.lower))?Number(ye.lower):null,Ee=Number.isFinite(Number(ye.upper))?Number(ye.upper):null;if(Se===null&&Ee===null)return null;let Te=0;for(let et=0;et<he;et++)Te+=ce[et];Te/=he;let Fe=0;for(let et=0;et<he;et++)Fe+=(ce[et]-Te)**2;const Ue=Math.sqrt(Fe/(he-1)),_e=Me(ce),Je=_e?_e.sigma:null,$e=et=>{if(!et||et<=0)return{index:null,k:null};const ft=Se!==null&&Ee!==null?(Ee-Se)/(6*et):null,lt=Ee!==null?(Ee-Te)/(3*et):1/0,At=Se!==null?(Te-Se)/(3*et):1/0;return{index:ft,k:Math.min(lt,At)}},ze=$e(Je),Qe=$e(Ue);let tt=0;for(let et=0;et<he;et++){if(Se!==null&&ce[et]<Se){tt++;continue}Ee!==null&&ce[et]>Ee&&tt++}return{n:he,mean:Te,lower:Se,upper:Ee,target:Number.isFinite(Number(ye.target))?Number(ye.target):null,sigmaWithin:Je,sigmaOverall:Ue,cp:ze.index,cpk:ze.k,pp:Qe.index,ppk:Qe.k,outOfSpec:tt,defectRate:he?tt/he:null}}function Ae(ce){const ye=ce.length;if(ye<2)return null;const he=Me(ce);if(!he||!(he.sigma>0))return null;let Se=0;for(let Ee=0;Ee<ye;Ee++)Se+=ce[Ee];return Se/=ye,{centre:Se,sigma:he.sigma,upper:Se+3*he.sigma,lower:Se-3*he.sigma}}function Ve(ce,ye){if(!ye||!(ye.sigma>0))return[];const he=ce.length,{centre:Se,sigma:Ee}=ye,Te=Ue=>(ce[Ue]-Se)/Ee,Fe=[];for(let Ue=0;Ue<he;Ue++){if(Math.abs(Te(Ue))>3&&Fe.push({index:Ue,rule:1,description:"beyond three sigma"}),Ue>=2)for(const _e of[1,-1]){let Je=0;for(let $e=Ue-2;$e<=Ue;$e++)Te($e)*_e>2&&Je++;if(Je>=2){Fe.push({index:Ue,rule:2,description:"two of three past two sigma"});break}}if(Ue>=4)for(const _e of[1,-1]){let Je=0;for(let $e=Ue-4;$e<=Ue;$e++)Te($e)*_e>1&&Je++;if(Je>=4){Fe.push({index:Ue,rule:3,description:"four of five past one sigma"});break}}if(Ue>=7)for(const _e of[1,-1]){let Je=!0;for(let $e=Ue-7;$e<=Ue;$e++)if(Te($e)*_e<=0){Je=!1;break}if(Je){Fe.push({index:Ue,rule:4,description:"eight in a row on one side"});break}}}return Fe}function Pe(ce,ye){if(!ye||!(ye.sigma>0))return[];const he=ce.length,{centre:Se,sigma:Ee}=ye,Te=_e=>(ce[_e]-Se)/Ee,Fe=(_e,Je,$e,ze)=>{for(const Qe of[1,-1]){let tt=0;for(let et=_e;et<=Je;et++)Te(et)*Qe>$e&&tt++;if(tt>=ze)return!0}return!1},Ue=[];for(let _e=0;_e<he;_e++){if(Math.abs(Te(_e))>3&&Ue.push({index:_e,rule:1,description:"beyond three sigma"}),_e>=8)for(const Je of[1,-1]){let $e=!0;for(let ze=_e-8;ze<=_e;ze++)if(Te(ze)*Je<=0){$e=!1;break}if($e){Ue.push({index:_e,rule:2,description:"nine in a row on one side"});break}}if(_e>=5)for(const Je of[1,-1]){let $e=!0;for(let ze=_e-4;ze<=_e;ze++)if((ce[ze]-ce[ze-1])*Je<=0){$e=!1;break}if($e){Ue.push({index:_e,rule:3,description:Je>0?"six rising":"six falling"});break}}if(_e>=13){let Je=!0;for(let $e=_e-12;$e<=_e;$e++){const ze=ce[$e]-ce[$e-1],Qe=ce[$e+1<=_e?$e+1:$e]-ce[$e];if($e+1>_e)break;if(ze===0||Qe===0||ze>0==Qe>0){Je=!1;break}}Je&&Ue.push({index:_e,rule:4,description:"fourteen alternating"})}if(_e>=2&&Fe(_e-2,_e,2,2)&&Ue.push({index:_e,rule:5,description:"two of three past two sigma"}),_e>=4&&Fe(_e-4,_e,1,4)&&Ue.push({index:_e,rule:6,description:"four of five past one sigma"}),_e>=14){let Je=!0;for(let $e=_e-14;$e<=_e;$e++)if(Math.abs(Te($e))>=1){Je=!1;break}Je&&Ue.push({index:_e,rule:7,description:"fifteen within one sigma"})}if(_e>=7){let Je=!0;for(let $e=_e-7;$e<=_e;$e++)if(Math.abs(Te($e))<=1){Je=!1;break}Je&&Ue.push({index:_e,rule:8,description:"eight beyond one sigma"})}}return Ue}const Oe=Object.freeze(["westernElectric","nelson"]);function He(ce,ye,he="westernElectric"){return String(he)==="nelson"?Pe(ce,ye):Ve(ce,ye)}function Ke(ce,ye,he){let Se=0;for(let Ee=0;Ee<ce.length;Ee++)(ce[Ee]<ye||ce[Ee]>he)&&Se++;return Se}function Xe(ce,ye,he,Se=20){const Ee=ce.length;if(!Ee)return[];const Te=ce[0],Fe=ce[Ee-1];if(Fe===Te)return[{from:Te,to:Fe,count:Ee}];const Ue=he-ye,_e=1.5*Ue;let Je=Ue>0?Math.max(Te,ye-_e):Te,$e=Ue>0?Math.min(Fe,he+_e):Fe;$e>Je||(Je=Te,$e=Fe);const ze=Ue>0?2*Ue/Math.cbrt(Ee):($e-Je)/(Math.ceil(Math.log2(Ee))+1),Qe=ze>0?Math.min(Se,Math.max(1,Math.ceil(($e-Je)/ze))):1,tt=($e-Je)/Qe,et=[];for(let dt=0;dt<Qe;dt++)et.push({from:Je+dt*tt,to:Je+(dt+1)*tt,count:0});for(let dt=0;dt<Ee;dt++){const ft=Math.min(Qe-1,Math.max(0,Math.floor((ce[dt]-Je)/tt)));et[ft].count++}return et[0].from=Te,et[Qe-1].to=Fe,et}const nt=.95;function st(ce){const ye=Number(ce);return Number.isFinite(ye)&&ye>0&&ye<1?ye:nt}function wt(ce,ye=nt){const he=ce.length;if(he<2)return null;let Se=0;for(let $e=0;$e<he;$e++)Se+=ce[$e];const Ee=Se/he;let Te=0;for(let $e=0;$e<he;$e++){const ze=ce[$e]-Ee;Te+=ze*ze}const Fe=Math.sqrt(Te/(he-1)),Ue=st(ye),Je=D(1-(1-Ue)/2,he-1)*Fe/Math.sqrt(he);return{mean:Ee,lower:Ee-Je,upper:Ee+Je,margin:Je,n:he,confidence:Ue}}function pt(ce,ye,he=nt){const Se=Number(ce),Ee=Number(ye);if(!(Ee>0)||!(Se>=0)||Se>Ee)return null;const Te=st(he),Fe=K(1-(1-Te)/2),Ue=Se/Ee,_e=Fe*Fe,Je=1+_e/Ee,$e=(Ue+_e/(2*Ee))/Je,ze=Fe/Je*Math.sqrt(Ue*(1-Ue)/Ee+_e/(4*Ee*Ee));return{proportion:Ue,lower:Math.max(0,$e-ze),upper:Math.min(1,$e+ze),n:Ee,confidence:Te}}function St(ce,ye=nt){if(!ce||!(ce.n>2)||!Number.isFinite(ce.stdError))return null;const he=st(ye),Ee=D(1-(1-he)/2,ce.n-2)*ce.stdError;return{slope:ce.slope,lower:ce.slope-Ee,upper:ce.slope+Ee,margin:Ee,confidence:he}}function Ct(ce,ye,he=nt){const Se=Number(ce),Ee=Number(ye);if(!Number.isFinite(Se)||!(Ee>1))return null;const Te=st(he),Ue=K(1-(1-Te)/2)*Math.sqrt(1/(9*Ee)+Se*Se/(2*(Ee-1)));return{index:Se,lower:Se-Ue,upper:Se+Ue,margin:Ue,n:Ee,confidence:Te}}function Mt(ce,ye){return!ce||!(ce.sd>0)||!Number.isFinite(ye)||!Number.isFinite(ce.mean)?null:(ye-ce.mean)/ce.sd}function at(ce){return Number.isFinite(ce)?Math.min(1,Math.max(0,2*I(Math.abs(ce)/2)-1)):0}function ot(ce,ye){const he=new Map,Se=X(ce);let Ee=0;for(let Te=0;Te<ye.length;Te++){const Fe=Se(ye[Te]);if(Fe==null||Fe===""||typeof Fe=="number"&&Number.isNaN(Fe))continue;const Ue=Fe instanceof Date?Fe.getTime():typeof Fe=="object"?String(Fe):Fe;he.set(Ue,(he.get(Ue)||0)+1),Ee++}return{map:he,total:Ee}}function gt(ce,ye,he,Se){if(!(ye>0)||!(Se>0))return null;let Ee=0;const Te=new Set(ce.keys());for(const Fe of he.keys())Te.add(Fe);for(const Fe of Te){const Ue=(ce.get(Fe)||0)/ye,_e=(he.get(Fe)||0)/Se;Ee+=Math.abs(Ue-_e)}return Ee/2}const Et=10;function ut(ce,ye,he){if(he&&he.numeric){const Ue=u(ce,ye),{n:_e,mean:Je}=p(Ue),$e=_e>0?Mt({mean:he.mean,sd:he.sd},Je):null;return{measure:"standardizedMeanDifference",magnitude:$e,distance:$e===null?0:at($e),direction:$e===null?0:Math.sign($e),subsetN:_e,populationN:he.n||0,reliable:_e>=Et}}const{map:Ee,total:Te}=ot(ce,ye),Fe=gt(Ee,Te,he.map,he.total);return{measure:"categoricalTotalVariation",magnitude:Fe,distance:Fe===null?0:Fe,direction:0,subsetN:Te,populationN:he.total||0,reliable:Te>=Et}}function me(ce,ye){if(ce&&(ce.kind==="float64"||ce.kind==="int32"))return!0;const he=X(ce);let Se=0,Ee=0;for(let Te=0;Te<ye.length&&Se<200;Te++){const Fe=he(ye[Te]);if(Fe==null||Fe==="")continue;if(Fe instanceof Date)return!1;Se++;const Ue=typeof Fe=="number"?Fe:Number(Fe);Number.isFinite(Ue)&&Ee++}return Se===0?!1:Ee/Se>=.9}function Ce(ce,ye){if(me(ce,ye)){const Ee=u(ce,ye),{n:Te,mean:Fe,m2:Ue}=p(Ee);return{numeric:!0,mean:Fe,sd:Te>0?Math.sqrt(Ue/Te):0,n:Te}}const{map:he,total:Se}=ot(ce,ye);return{numeric:!1,map:he,total:Se}}}),De("packages/core/src/compute/total.js",function(e,U){"use strict";Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"aggregatesFor",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"aggregateAllowed",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return p}});const M=U("packages/core/src/internal/predicates.js").isFunction,B=U("packages/core/src/internal/warn.js").warnOnce,D=U("packages/core/src/compute/handle.js"),Z=D.presenceReader,K=D.valueComparator,I=D.valueReader,G=U("packages/core/src/compute/statistics.js"),H=G.STAT_FNS,S=G.STAT_LABELS;function O(g){return!!g&&(g.kind==="float64"||g.kind==="int32")}function b(g,k){const w=k.length;let E=0;if(O(g)){const x=g.values,_=Z(g);if(!_){for(let F=0;F<w;F++){const L=x[k[F]];Number.isNaN(L)||(E+=L)}return E}for(let F=0;F<w;F++){const L=k[F];if(_(L)===1){const j=x[L];Number.isNaN(j)||(E+=j)}}return E}const N=I(g);for(let x=0;x<w;x++){const _=u(N(k[x]));_!==null&&(E+=_)}return E}b.kernel=!0;function c(g,k){const w=k.length;let E=0;if(O(g)){const x=g.values,_=Z(g);if(!_){for(let F=0;F<w;F++)Number.isNaN(x[k[F]])||E++;return E}for(let F=0;F<w;F++){const L=k[F];_(L)===1&&!Number.isNaN(x[L])&&E++}return E}const N=I(g);for(let x=0;x<w;x++){const _=N(k[x]);_!=null&&!(typeof _=="number"&&Number.isNaN(_))&&E++}return E}c.kernel=!0;function f(g,k){return k.length}f.kernel=!0;function o(g,k){const w=c(g,k);return w===0?null:b(g,k)/w}o.kernel=!0;function n(g,k,w,E){const N=k.length;if(O(g)){const L=g.values,j=Z(g);let R=null;if(!j){for(let $=0;$<N;$++){const T=L[k[$]];Number.isNaN(T)||(R===null||(w<0?T<R:T>R))&&(R=T)}return R}for(let $=0;$<N;$++){const T=k[$];if(j(T)===0)continue;const A=L[T];Number.isNaN(A)||(R===null||(w<0?A<R:A>R))&&(R=A)}return R}const x=I(g),_=K(E);let F=null;for(let L=0;L<N;L++){const j=x(k[L]);j==null||typeof j=="number"&&Number.isNaN(j)||(F===null||(w<0?_(j,F)<0:_(j,F)>0))&&(F=j)}return F}function t(g,k,w){return n(g,k,-1,w&&w.locale)}t.kernel=!0;function i(g,k,w){return n(g,k,1,w&&w.locale)}i.kernel=!0;function s(g,k){return k.length===0?null:I(g)(k[0])}s.kernel=!0;function r(g,k){return k.length===0?null:I(g)(k[k.length-1])}r.kernel=!0;function u(g){if(typeof g=="number")return Number.isNaN(g)?null:g;if(g==null||g===""||typeof g=="boolean")return null;if(g instanceof Date)return g.getTime();const k=Number(g);return Number.isNaN(k)?null:k}const a={sum:b,min:t,max:i,avg:o,count:f,first:s,last:r,countValues:c,...H},l=Object.freeze({...S,sum:"Sum",avg:"Average",min:"Min",max:"Max",count:"Count",countValues:"Count of values",first:"First",last:"Last"});function h(g){return g?typeof g=="string"?l[g]||g:"Total":""}const y=Object.freeze(["sum","avg","min","max","count","countValues","first","last"]);function m(g){const k=g&&g.dataType&&g.dataType.totals&&g.dataType.totals.supported;if(Array.isArray(k))return k.slice();const w=y.filter(E=>E in a);for(const E of Object.keys(a))w.includes(E)||w.push(E);return w}function v(g,k){return typeof k!="string"?!0:m(g).includes(k)}function d(g,k){const w=I(g),E=[];for(let N=0;N<k.length;N++){const x=w(k[N]);x!=null&&E.push(x)}return E}function p(g,k,w,E){const N=k||[];if(typeof w=="string"){const x=a[w];return x?x(g,N,E):(B(`total:${w}`,`unknown total function "${w}"; register it in config.totalFns`),null)}return M(w)?w.kernel===!0?w(g,N,E):w(d(g,N),E||{}):null}}),De("packages/core/src/compute/windowed.js",function(e,U){"use strict";Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const M=U("packages/core/src/compute/sketch.js").Welford;class X{#e;#t;#n=[];#r;#s;constructor(I,G=0,H=Date.now){if(I!=="count"&&I!=="time"&&I!=="session")throw new RangeError(`unknown window kind: ${I}`);if((I==="count"||I==="time")&&!(G>0))throw new RangeError(`a ${I} window needs a positive span`);this.#e=I,this.#t=Math.floor(G),this.#r=H,this.#s=H()}get size(){return this.#n.length}push(I,G=this.#r()){Number.isFinite(I)&&(this.#n.push({t:G,v:I}),this.#i(G))}#i(I){if(this.#e==="count")for(;this.#n.length>this.#t;)this.#n.shift();else if(this.#e==="time"){const G=I-this.#t;for(;this.#n.length&&this.#n[0].t<G;)this.#n.shift()}}spec(){const I=this.#e==="session"?this.#r()-this.#s:this.#t;return{kind:this.#e,span:I,size:this.#n.length}}values(){return this.#n.map(I=>I.v)}aggregate(){const I=this.spec();if(!this.#n.length)return{over:I,count:0,sum:null,mean:null,min:null,max:null,variance:null,stddev:null};const G=new M;let H=0,S=1/0,O=-1/0;for(const{v:b}of this.#n)H+=b,b<S&&(S=b),b>O&&(O=b),G.add(b);return{over:I,count:this.#n.length,sum:H,mean:G.mean(),min:S,max:O,variance:G.variance(),stddev:G.stddev()}}reduce(I){const G=this.aggregate(),H={sum:G.sum,avg:G.mean,mean:G.mean,min:G.min,max:G.max,count:G.count,variance:G.variance,stddev:G.stddev};if(!(I in H))throw new RangeError(`unknown windowed aggregate: ${I}`);return{value:H[I],over:G.over}}}const B=Object.freeze(["count","time","session"]);function D(K,I=Date.now){const G=K.kind==="time"&&K.minutes!=null?K.minutes*6e4:K.span??0;return new X(K.kind,G,I)}const Z={Window:X,WINDOW_KINDS:B,openWindow:D}}),De("packages/core/src/compute/rolling.js",function(e,U){"use strict";Object.defineProperty(e,"ROLLING_WINDOW_FIELDS",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"rollingWindow",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"cumulativeToDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"periodOverPeriod",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"QUANTILE_SPAN_CAP",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"rollingQuantile",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"seasonalDecompose",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"exponentialSmoothing",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});const M=U("packages/core/src/compute/windowed.js").openWindow,B=U("packages/core/src/compute/sketch.js").KLL,D=Object.freeze({rollingSum:"sum",rollingAvg:"avg",rollingMin:"min",rollingMax:"max"});function Z(a,l,h,y){if(a.kind==="count"){const m=Math.max(1,Math.floor(a.span||0));return{coverage:Math.min(1,l/m),partial:l<m}}if(a.kind==="time"){const m=a.minutes!=null?a.minutes*6e4:a.span||0;if(!(m>0))return{coverage:1,partial:!1};const v=h-y;return{coverage:Math.min(1,v/m),partial:v<m}}return{coverage:null,partial:!1}}function K(a,l){const h=M(l),y=new Map,m=a.length?a[0].at:0;for(let v=0;v<a.length;v++){const{key:d,at:p,value:g}=a[v];Number.isFinite(g)&&h.push(g,p);const k=h.aggregate(),w=Z(l,k.count,p,m);d!=null&&y.set(String(d),{sum:k.sum,avg:k.mean,min:k.min,max:k.max,count:k.count,coverage:w.coverage,partial:w.partial})}return y}function I(a){const l=new Map;let h=0;for(const{key:y,value:m}of a)Number.isFinite(m)&&(h+=m),y!=null&&l.set(String(y),h);return l}function G(a,l=1){const h=new Map,y=Math.max(1,Math.floor(l));for(let m=0;m<a.length;m++){const{key:v,value:d}=a[m];if(v==null)continue;const p=m>=y?a[m-y].value:null,g=Number.isFinite(d)?d:null,k=Number.isFinite(p)?p:null;h.set(String(v),g!==null&&k!==null?g-k:null)}return h}const H=4096;function S(a){let l=a>>>0;return()=>{l+=1831565813;let h=l;return h=Math.imul(h^h>>>15,h|1),h^=h+Math.imul(h^h>>>7,h|61),((h^h>>>14)>>>0)/4294967296}}function O(a,l){const h=a.length;if(h===1)return a[0];const y=(h-1)*l,m=Math.floor(y),v=Math.ceil(y);return m===v?a[m]:a[m]+(y-m)*(a[v]-a[m])}function b(a,l,h={}){const y=Math.min(1,Math.max(0,h.q==null?.5:h.q)),m=Math.max(1,Math.floor(h.cap==null?H:h.cap)),v=S(h.seed==null?2654435769:h.seed),d=new Map,p=a.length?a[0].at:0;if(l.kind==="session"){const k=new B(200,v);let w=0;for(const{key:E,value:N}of a)Number.isFinite(N)&&(k.add(N),w++),E!=null&&d.set(String(E),{value:w?k.quantile(y):null,approx:w>0,count:w,coverage:null,partial:!1});return d}const g=M(l);for(const{key:k,at:w,value:E}of a){Number.isFinite(E)&&g.push(E,w);const N=g.values(),x=N.length;let _=null,F=!1;if(x)if(x<=m)_=O([...N].sort((j,R)=>j-R),y);else{const j=new B(200,v);for(const R of N)j.add(R);_=j.quantile(y),F=!0}const L=Z(l,x,w,p);k!=null&&d.set(String(k),{value:_,approx:F,count:x,coverage:L.coverage,partial:L.partial})}return d}function c(a,l){const h=a.length,y=new Array(h).fill(null),m=Math.floor(l/2),v=l%2===0;for(let d=0;d<h;d++){if(d-m<0||d+m>=h)continue;let p=0,g=!0;if(v)for(let k=-m;k<=m;k++){const w=a[d+k];if(!Number.isFinite(w)){g=!1;break}p+=k===-m||k===m?w*.5:w}else for(let k=-m;k<=m;k++){const w=a[d+k];if(!Number.isFinite(w)){g=!1;break}p+=w}g&&(y[d]=p/l)}return y}function f(a,l){const h=new Map,y=Math.floor(Number(l&&l.period));if(!(y>=2))return h;const m=l&&l.model==="multiplicative",v=a.length,d=a.map(F=>Number.isFinite(F.value)?F.value:null),p=c(d,y),g=new Array(v).fill(null);for(let F=0;F<v;F++){const L=p[F],j=d[F];L===null||j===null||(m?L!==0&&(g[F]=j/L):g[F]=j-L)}const k=new Array(y).fill(0),w=new Array(y).fill(0);for(let F=0;F<v;F++){if(g[F]===null)continue;const L=F%y;k[L]+=g[F],w[L]+=1}const E=m?1:0,N=k.map((F,L)=>w[L]?F/w[L]:E),x=N.reduce((F,L)=>F+L,0)/y,_=m?N.map(F=>x!==0?F/x:1):N.map(F=>F-x);for(let F=0;F<v;F++){const{key:L}=a[F];if(L==null)continue;const j=p[F],R=_[F%y],$=d[F];let T=null;j!==null&&$!==null&&(T=m?j*R!==0?$/(j*R):null:$-j-R),h.set(String(L),{trend:j,seasonal:$===null?null:R,residual:T,coverage:j===null?0:1,partial:j===null})}return h}function o(a,l,h,y=80){const m=(Math.sqrt(5)-1)/2;let v=l,d=h,p=d-m*(d-v),g=v+m*(d-v),k=a(p),w=a(g);for(let E=0;E<y;E++)k<w?(d=g,g=p,w=k,p=d-m*(d-v),k=a(p)):(v=p,p=g,k=w,g=v+m*(d-v),w=a(g));return(v+d)/2}const n=1e-4,t=1-1e-4;function i(a,l){const h=a.length,y=new Array(h).fill(null),m=new Array(h).fill(null);let v=null,d=0;for(let p=0;p<h;p++){const g=a[p];if(!Number.isFinite(g)){v!==null&&(m[p]=v,y[p]=v);continue}if(v===null){v=g,m[p]=g,y[p]=g;continue}m[p]=v,d+=(g-v)**2,v=l*g+(1-l)*v,y[p]=v}return{smoothed:y,fitted:m,sse:d}}function s(a,l,h){const y=a.length,m=new Array(y).fill(null),v=new Array(y).fill(null);let d=null,p=null,g=0;for(let k=0;k<y;k++){const w=a[k];if(!Number.isFinite(w)){d!==null&&(d+=p,m[k]=d);continue}if(d===null){d=w,m[k]=w;continue}if(p===null){p=w-d;const x=d+p;v[k]=x,g+=(w-x)**2;const _=d;d=l*w+(1-l)*(_+p),p=h*(d-_)+(1-h)*p,m[k]=d;continue}const E=d+p;v[k]=E,g+=(w-E)**2;const N=d;d=l*w+(1-l)*(N+p),p=h*(d-N)+(1-h)*p,m[k]=d}return{smoothed:m,fitted:v,sse:g}}function r(a,l={}){const h=new Map,y=l.method==="holt",m=a.map(E=>Number.isFinite(E.value)?E.value:null),v=m.filter(E=>E!==null).length,d=E=>Math.min(t,Math.max(n,E)),p=()=>{for(const{key:E}of a)E!=null&&h.set(String(E),{smoothed:null,fitted:null,alpha:null,beta:null,sse:null});return h};if(v<(y?2:1))return p();let g=Number.isFinite(l.alpha)?d(l.alpha):null,k=y&&Number.isFinite(l.beta)?d(l.beta):null;if(y){if(g===null||k===null){let E=g===null?.5:g,N=k===null?.5:k;for(let x=0;x<6;x++)g===null&&(E=o(_=>s(m,_,N).sse,n,t)),k===null&&(N=o(_=>s(m,E,_).sse,n,t));g=g===null?E:g,k=k===null?N:k}}else g===null&&(g=o(E=>i(m,E).sse,n,t));const w=y?s(m,g,k):i(m,g);for(let E=0;E<a.length;E++){const{key:N}=a[E];N!=null&&h.set(String(N),{smoothed:w.smoothed[E],fitted:w.fitted[E],alpha:g,beta:y?k:null,sse:w.sse})}return h}const u={ROLLING_WINDOW_FIELDS:D,QUANTILE_SPAN_CAP:H,rollingWindow:K,rollingQuantile:b,cumulativeToDate:I,periodOverPeriod:G,seasonalDecompose:f,exponentialSmoothing:r}}),De("packages/core/src/compute/compare.js",function(e,U){"use strict";Object.defineProperty(e,"COMPARE_MEASURES",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"pooledStandardMeanDifference",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"numericSummary",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"bothNumeric",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"compareColumnAcross",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"compareDatasets",{enumerable:!0,get:function(){return c}});const te=U("packages/core/src/compute/statistics.js"),M=te.numbers,X=te.moments,B=te.frequencyMap,D=te.categoricalDistance,Z=te.normalTotalVariation,K=te.isNumericColumn,I=te.SUBSET_RELIABILITY_FLOOR,G=Object.freeze({numeric:"pooledStandardMeanDifference",categorical:"categoricalTotalVariation",common:"totalVariationDistance"});function H(f,o){if(!f||!o||!(f.n>0)||!(o.n>0)||!Number.isFinite(f.mean)||!Number.isFinite(o.mean))return null;const n=(f.n*f.sd*f.sd+o.n*o.sd*o.sd)/(f.n+o.n);return n>0?(f.mean-o.mean)/Math.sqrt(n):null}function S(f,o){const n=M(f,o),{n:t,mean:i,m2:s}=X(n),r=t>0?Math.sqrt(s/t):0;return{mean:i,sd:r,n:t}}function O(f,o,n,t){return K(f,o)&&K(n,t)}function b(f,o,n,t){if(O(f,o,n,t)){const u=S(f,o),a=S(n,t),l=H(u,a);return{measure:G.numeric,magnitude:l,distance:l===null?0:Z(l),direction:l===null?0:Math.sign(l),nA:u.n,nB:a.n,reliable:u.n>=I&&a.n>=I}}const i=B(f,o),s=B(n,t),r=D(i.map,i.total,s.map,s.total);return{measure:G.categorical,magnitude:r,distance:r===null?0:r,direction:0,nA:i.total,nB:s.total,reliable:i.total>=I&&s.total>=I}}function c(f,o,n={}){const t=new Set(f.columns),i=new Set(o.columns),s=f.columns.filter(h=>i.has(h)),r=Array.isArray(n.columns)&&n.columns.length?s.filter(h=>n.columns.includes(h)):s,u=f.indices(),a=o.indices(),l=[];for(const h of r){const y=f.handle(h),m=o.handle(h);if(!y||!m)continue;const v=b(y,u,m,a);l.push({column:h,name:f.name&&f.name(h)||o.name&&o.name(h)||h,measure:v.measure,magnitude:v.magnitude,distance:v.distance,direction:v.direction,nA:v.nA,nB:v.nB,reliable:v.reliable})}return l.sort((h,y)=>y.distance-h.distance||Math.abs(y.magnitude||0)-Math.abs(h.magnitude||0)),{ranked:l,nA:u.length,nB:a.length,unmatched:{onlyA:f.columns.filter(h=>!i.has(h)),onlyB:o.columns.filter(h=>!t.has(h))},measures:G}}}),De("packages/core/src/compute/anomaly.js",function(e,U){"use strict";Object.defineProperty(e,"MAD_SCALE",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"DEFAULT_MODIFIED_Z_THRESHOLD",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"DEFAULT_IQR_K",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_CHI_SQUARE_P",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"robustSpread",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"chiSquareCdf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"chiSquareQuantile",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_ROLLING_WINDOW",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return u}});const M=U("packages/core/src/compute/statistics.js").quantileSorted,B=U("packages/core/src/compute/special.js").logGamma,D=.6745,Z=3.5,K=1.5,I=.975,G=Object.freeze(["modifiedZScore","iqr","mahalanobis"]);function H(a){if(!a.length)return null;const h=Array.from(a,Number).sort((d,p)=>d-p),y=M(h,.5),m=h.map(d=>Math.abs(d-y)).sort((d,p)=>d-p),v=M(m,.5);return{median:y,mad:v}}function S(a,l={}){const h=Number.isFinite(l.threshold)?l.threshold:Z,y=a.length,m=new Array(y).fill(null),v=new Array(y).fill(!1),d=[];for(let k=0;k<y;k++){const w=Number(a[k]);Number.isFinite(w)&&d.push(w)}if(!d.length)return{median:null,mad:null,threshold:h,scores:m,flags:v,flagged:0};const p=H(d);if(p.mad===0)return{median:p.median,mad:0,threshold:h,scores:m,flags:v,flagged:0};let g=0;for(let k=0;k<y;k++){const w=Number(a[k]);if(!Number.isFinite(w))continue;const E=D*(w-p.median)/p.mad;m[k]=E,Math.abs(E)>h&&(v[k]=!0,g++)}return{median:p.median,mad:p.mad,threshold:h,scores:m,flags:v,flagged:g}}function O(a,l={}){const h=Number.isFinite(l.k)?l.k:K,y=[];for(let g=0;g<a.length;g++){const k=Number(a[g]);Number.isFinite(k)&&y.push(k)}if(!y.length)return null;const m=y.sort((g,k)=>g-k),v=M(m,.25),d=M(m,.75),p=d-v;return{q1:v,q3:d,iqr:p,lower:v-h*p,upper:d+h*p,k:h}}function b(a,l){if(l<=0)return 0;const h=B(a);if(l<a+1){let k=a,w=1/a,E=w;for(let N=0;N<1e3&&(k+=1,E*=l/k,w+=E,!(Math.abs(E)<Math.abs(w)*1e-15));N++);return w*Math.exp(-l+a*Math.log(l)-h)}const y=1e-300;let m=l+1-a,v=1/y,d=1/m,p=d;for(let k=1;k<1e3;k++){const w=-k*(k-a);m+=2,d=w*d+m,Math.abs(d)<y&&(d=y),v=m+w/v,Math.abs(v)<y&&(v=y),d=1/d;const E=d*v;if(p*=E,Math.abs(E-1)<1e-15)break}return 1-Math.exp(-l+a*Math.log(l)-h)*p}function c(a,l){return a<=0?0:b(l/2,a/2)}function f(a,l=I){if(!(l>0)||!(l<1))return NaN;let h=0,y=Math.max(1,a);for(;c(y,a)<l;)y*=2;for(let m=0;m<200;m++){const v=(h+y)/2;if(c(v,a)<l?h=v:y=v,y-h<1e-10)break}return(h+y)/2}function o(a){const l=a.length,h=a.map((y,m)=>{const v=y.slice();for(let d=0;d<l;d++)v.push(m===d?1:0);return v});for(let y=0;y<l;y++){let m=y;for(let d=y+1;d<l;d++)Math.abs(h[d][y])>Math.abs(h[m][y])&&(m=d);if(Math.abs(h[m][y])<1e-12)return null;if(m!==y){const d=h[m];h[m]=h[y],h[y]=d}const v=h[y][y];for(let d=0;d<2*l;d++)h[y][d]/=v;for(let d=0;d<l;d++){if(d===y)continue;const p=h[d][y];if(p!==0)for(let g=0;g<2*l;g++)h[d][g]-=p*h[y][g]}}return h.map(y=>y.slice(l))}function n(a,l){const h=a.length,y=new Array(l).fill(0);for(const d of a)for(let p=0;p<l;p++)y[p]+=d[p];for(let d=0;d<l;d++)y[d]/=h;const m=Array.from({length:l},()=>new Array(l).fill(0));for(const d of a)for(let p=0;p<l;p++){const g=d[p]-y[p];for(let k=p;k<l;k++)m[p][k]+=g*(d[k]-y[k])}const v=h>1?h-1:1;for(let d=0;d<l;d++)for(let p=d;p<l;p++)m[d][p]/=v,m[p][d]=m[d][p];return{mean:y,cov:m}}function t(a,l={}){const h=Number.isFinite(l.p)?l.p:I,y=Number.isFinite(l.ridge)?l.ridge:1e-6,m=a.length;if(!m)return null;const v=a[0].length;if(!v)return null;const d=new Array(m).fill(null),p=new Array(m).fill(null),g=new Array(m).fill(!1),k=[],w=[];for(let R=0;R<m;R++){const $=a[R];let T=$.length===v;const A=new Array(v);for(let C=0;T&&C<v;C++){const z=Number($[C]);Number.isFinite(z)?A[C]=z:T=!1}T&&(k.push(R),w.push(A))}const E=v,N=f(E,h);if(w.length<=v)return{center:[],df:E,cutoff:N,singular:!0,used:w.length,distances:d,squared:p,flags:g,flagged:0};const{mean:x,cov:_}=n(w,v);let F=o(_),L=!1;if(!F){L=!0;let R=0;for(let A=0;A<v;A++)R+=_[A][A];const $=R/v*y||y,T=_.map((A,C)=>A.map((z,Y)=>C===Y?z+$:z));if(F=o(T),!F)return{center:x,df:E,cutoff:N,singular:!0,used:w.length,distances:d,squared:p,flags:g,flagged:0}}let j=0;for(let R=0;R<w.length;R++){const $=w[R],T=new Array(v);for(let z=0;z<v;z++)T[z]=$[z]-x[z];let A=0;for(let z=0;z<v;z++){let Y=0;for(let q=0;q<v;q++)Y+=F[z][q]*T[q];A+=T[z]*Y}A<0&&(A=0);const C=k[R];p[C]=A,d[C]=Math.sqrt(A),A>N&&(g[C]=!0,j++)}return{center:x,df:E,cutoff:N,singular:L,used:w.length,distances:d,squared:p,flags:g,flagged:j}}const i=20,s=Object.freeze(["rollingModifiedZScore","rollingIqr"]);function r(a,l={}){const h=l.method==="rollingIqr"?"rollingIqr":"rollingModifiedZScore",y=Number.isFinite(l.windowLen)&&l.windowLen>=1?Math.floor(l.windowLen):i,m=Number.isFinite(l.threshold)?l.threshold:Z,v=Number.isFinite(l.k)?l.k:K,d=Number.isFinite(l.minPeriods)&&l.minPeriods>=1?Math.floor(l.minPeriods):y,p=a.length,g=new Array(p).fill(null),k=new Array(p).fill(!1);let w=0;for(let E=0;E<p;E++){const N=Number(a[E]);if(!Number.isFinite(N))continue;const x=Math.max(0,E-y+1),_=[];for(let F=x;F<=E;F++){const L=Number(a[F]);Number.isFinite(L)&&_.push(L)}if(!(_.length<d))if(h==="rollingIqr"){const F=O(_,{k:v});if(!F)continue;(N<F.lower||N>F.upper)&&(k[E]=!0,w++)}else{const F=H(_);if(!F||F.mad===0)continue;const L=D*(N-F.median)/F.mad;g[E]=L,Math.abs(L)>m&&(k[E]=!0,w++)}}return{method:h,windowLen:y,minPeriods:d,threshold:m,k:v,scores:g,flags:k,flagged:w}}function u(a={}){const l=a||{},h=l.field;if(typeof h!="string"||!h)throw new TypeError("[lattice] anomalyCondition: a string `field` naming the numeric property to monitor is required");const y=l.method||"modifiedZScore";if(!(G.includes(y)||s.includes(y))||y==="mahalanobis")throw new RangeError(`[lattice] anomalyCondition: unknown or unsupported method '${y}'`);const v=typeof l.orderBy=="string"?l.orderBy:null,d=l.latest===!0,p=s.includes(y),g=k=>Number(k==null?NaN:k[h]);return k=>{const w=Array.isArray(k)?k.slice():[...k];v&&w.sort((F,L)=>{const j=F?.[v],R=L?.[v];return j===R?0:j==null?-1:R==null?1:j<R?-1:1});const E=w.map(g);let N,x;if(p)({flags:N,scores:x}=r(E,{method:y,windowLen:l.windowLen,threshold:l.threshold,k:l.k,minPeriods:l.minPeriods}));else if(y==="iqr"){const F=O(E,{k:l.k});N=E.map(L=>F?Number.isFinite(L)&&(L<F.lower||L>F.upper):!1),x=E.map(()=>null)}else({flags:N,scores:x}=S(E,{threshold:l.threshold}));if(d){const F=N.length-1;return F<0||!N[F]?!1:{method:y,field:h,flagged:[{row:w[F],score:x[F]}]}}const _=[];for(let F=0;F<N.length;F++)N[F]&&_.push({row:w[F],score:x[F]});return _.length?{method:y,field:h,flagged:_}:!1}}}),De("packages/core/src/compute/forecast.js",function(e,U){"use strict";Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return a}});const te=U("packages/core/src/compute/special.js"),M=te.normalQuantile,X=te.studentTQuantile,D=U("packages/core/src/internal/warn.js").warnOnce,Z=Object.freeze(["movingAverage","ses","holt","holtWinters","linear"]),K=1e-4,I=1-1e-4;function G(l){const h=[];for(let y=0;y<l.length;y++){const m=l[y];if(m!==null&&typeof m=="object"){const v=Number.isFinite(m.at)?m.at:y,d=Number.isFinite(m.value)?m.value:null;h.push({at:v,value:d})}else h.push({at:y,value:Number.isFinite(m)?Number(m):null})}return h}function H(l){const h=l.filter(p=>p.value!==null),y=h[0],m=h[h.length-1],v=m.at-y.at,d=h.length>1&&v>0?v/(h.length-1):1;return{lastAt:m.at,step:d}}function S(l){return Math.min(I,Math.max(K,l))}function O(l,h=K,y=I,m=80){const v=(Math.sqrt(5)-1)/2;let d=h,p=y,g=p-v*(p-d),k=d+v*(p-d),w=l(g),E=l(k);for(let N=0;N<m;N++)w<E?(p=k,k=g,E=w,g=p-v*(p-d),w=l(g)):(d=g,g=k,w=E,k=d+v*(p-d),E=l(k));return(d+p)/2}function b(l,h){let y=null,m=0,v=0;for(let d=0;d<l.length;d++){const p=l[d];if(p!==null){if(y===null){y=p;continue}m+=(p-y)**2,v+=1,y=h*p+(1-h)*y}}return{level:y,sse:m,m:v}}function c(l,h,y){let m=null,v=null,d=0,p=0;for(let g=0;g<l.length;g++){const k=l[g];if(k===null){m!==null&&v!==null&&(m+=v);continue}if(m===null){m=k;continue}v===null&&(v=k-m);const w=m+v;d+=(k-w)**2,p+=1;const E=m;m=h*k+(1-h)*(E+v),v=y*(m-E)+(1-y)*v}return{level:m,trend:v,sse:d,m:p}}function f(l,h,y,m,v){const d=l.length;if(d<2*h)return null;const p=L=>{let j=0,R=0;for(let $=L;$<L+h&&$<d;$++)l[$]!==null&&(j+=l[$],R+=1);return R?j/R:null},g=p(0),k=p(h);if(g===null||k===null)return null;let w=g,E=(k-g)/h;const N=new Array(h).fill(0);for(let L=0;L<h;L++)N[L]=l[L]===null?0:l[L]-w;const x=N.reduce((L,j)=>L+j,0)/h;for(let L=0;L<h;L++)N[L]-=x;let _=0,F=0;for(let L=h;L<d;L++){const j=L%h,R=N[j],$=l[L];if($===null){w+=E;continue}const T=w+E+R;_+=($-T)**2,F+=1;const A=w;w=y*($-R)+(1-y)*(w+E),E=m*(w-A)+(1-m)*E,N[j]=v*($-w)+(1-v)*R}return{level:w,trend:E,season:N,phase:(d-1)%h,sse:_,count:F}}function o(l,h,y){let m=1;for(const d of h)m+=d*d;const v=Math.sqrt(l*m);return{se:v,margin:y*v}}function n(l,h={}){if(!l||typeof l.length!="number"||l.length===0)return null;const y=Z.includes(h.method)?h.method:"linear",m=Math.max(1,Math.floor(Number(h.horizon)||1)),v=Number.isFinite(h.confidence)&&h.confidence>0&&h.confidence<1?h.confidence:.95,d=1-(1-v)/2,p=G(l),g=p.map(_=>_.value),k=g.filter(_=>_!==null),w=k.length,{lastAt:E,step:N}=w?H(p):{lastAt:0,step:1},x=_=>E+_*N;return y==="linear"?t(p,w,m,v,d,x):y==="movingAverage"?i(k,w,m,v,d,h,x):y==="ses"?s(g,w,m,v,d,h,x):y==="holt"?r(g,w,m,v,d,h,x):u(g,w,m,v,d,h,x)}function t(l,h,y,m,v,d){if(h<2)return null;let p=0,g=0;for(const $ of l)$.value!==null&&(p+=$.at,g+=$.value);p/=h,g/=h;let k=0,w=0,E=0;for(const $ of l){if($.value===null)continue;const T=$.at-p,A=$.value-g;k+=T*T,w+=T*A,E+=A*A}if(k===0)return null;const N=w/k,x=g-N*p,_=E===0?1:Math.max(0,Math.min(1,w*w/(k*E))),F=Math.max(0,E-N*w),L=h>2?Math.sqrt(F/(h-2)):null,j=h>2?X(v,h-2):null,R=[];for(let $=1;$<=y;$++){const T=d($),A=x+N*T;let C=null,z=null,Y=null,q=null,V=null;if(L!==null){const J=1/h+(T-p)**2/k,ee=L*Math.sqrt(1+J),ne=L*Math.sqrt(J);V=ee,C=A-j*ee,z=A+j*ee,Y=A-j*ne,q=A+j*ne}R.push({step:$,at:T,mean:A,lower:C,upper:z,lowerMean:Y,upperMean:q,se:V})}return{method:"linear",horizon:y,confidence:m,n:h,sigma:L,r2:_,params:{slope:N,intercept:x},points:R}}function i(l,h,y,m,v,d,p){if(h<1)return null;const g=Math.max(1,Math.min(h,Math.floor(Number(d.windowLen)||h))),k=l.slice(h-g);let w=0;for(const L of k)w+=L;const E=w/g;let N=null,x=null;if(g>1){let L=0;for(const R of k)L+=(R-E)**2;N=Math.sqrt(L/(g-1))*Math.sqrt(1+1/g),x=X(v,g-1)}const _=N===null?null:x*N,F=[];for(let L=1;L<=y;L++)F.push({step:L,at:p(L),mean:E,lower:_===null?null:E-_,upper:_===null?null:E+_,se:N});return{method:"movingAverage",horizon:y,confidence:m,n:h,sigma:N===null?null:N,params:{windowLen:g},points:F}}function s(l,h,y,m,v,d,p){if(h<1)return null;let g=Number.isFinite(d.alpha)?S(d.alpha):null;g===null&&(g=O(x=>b(l,x).sse));const k=b(l,g),w=M(v),E=k.m>0?k.sse/k.m:null,N=[];for(let x=1;x<=y;x++){const _=k.level;let F=null,L=null,j=null;if(E!==null){const R=[];for(let T=1;T<x;T++)R.push(g);const $=o(E,R,w);j=$.se,F=_-$.margin,L=_+$.margin}N.push({step:x,at:p(x),mean:_,lower:F,upper:L,se:j})}return{method:"ses",horizon:y,confidence:m,n:h,sigma:E===null?null:Math.sqrt(E),params:{alpha:g},points:N}}function r(l,h,y,m,v,d,p){if(h<2)return null;let g=Number.isFinite(d.alpha)?S(d.alpha):null,k=Number.isFinite(d.beta)?S(d.beta):null;if(g===null||k===null){let F=g===null?.5:g,L=k===null?.5:k;for(let j=0;j<6;j++)g===null&&(F=O(R=>c(l,R,L).sse)),k===null&&(L=O(R=>c(l,F,R).sse));g=g===null?F:g,k=k===null?L:k}const w=c(l,g,k),E=M(v),N=w.m>0?w.sse/w.m:null,x=g*k,_=[];for(let F=1;F<=y;F++){const L=w.level+F*w.trend;let j=null,R=null,$=null;if(N!==null){const T=[];for(let C=1;C<F;C++)T.push(g+C*x);const A=o(N,T,E);$=A.se,j=L-A.margin,R=L+A.margin}_.push({step:F,at:p(F),mean:L,lower:j,upper:R,se:$})}return{method:"holt",horizon:y,confidence:m,n:h,sigma:N===null?null:Math.sqrt(N),params:{alpha:g,beta:k},points:_}}function u(l,h,y,m,v,d,p){const g=Math.floor(Number(d.period));if(!(g>=2))return D("forecast.holtWinters.period","forecast: holtWinters needs a period (opts.period >= 2)"),null;if(h<2*g)return null;let k=Number.isFinite(d.alpha)?S(d.alpha):null,w=Number.isFinite(d.beta)?S(d.beta):null,E=Number.isFinite(d.gamma)?S(d.gamma):null;const N=($,T,A)=>{const C=f(l,g,$,T,A);return C?C.sse:1/0};if(k===null||w===null||E===null){let $=k===null?.5:k,T=w===null?.5:w,A=E===null?.5:E;for(let C=0;C<8;C++)k===null&&($=O(z=>N(z,T,A))),w===null&&(T=O(z=>N($,z,A))),E===null&&(A=O(z=>N($,T,z)));k=k===null?$:k,w=w===null?T:w,E=E===null?A:E}const x=f(l,g,k,w,E);if(!x)return null;const _=M(v),F=x.count>0?x.sse/x.count:null,L=k*w,j=E*(1-k),R=[];for(let $=1;$<=y;$++){const T=x.season[(x.phase+$)%g],A=x.level+$*x.trend+T;let C=null,z=null,Y=null;if(F!==null){const q=[];for(let J=1;J<$;J++)q.push(k+J*L+(J%g===0?j:0));const V=o(F,q,_);Y=V.se,C=A-V.margin,z=A+V.margin}R.push({step:$,at:p($),mean:A,lower:C,upper:z,se:Y})}return{method:"holtWinters",horizon:y,confidence:m,n:h,sigma:F===null?null:Math.sqrt(F),params:{alpha:k,beta:w,gamma:E,period:g},points:R}}const a={FORECAST_METHODS:Z,forecast:n}}),De("packages/core/src/compute/hypothesis.js",function(e,U){"use strict";Object.defineProperty(e,"GROUP_TESTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"NORMALITY_ALPHA",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"HL_PAIR_LIMIT",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"welchTTest",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"mannWhitneyUTest",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"chiSquareTest",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"compareGroups",{enumerable:!0,get:function(){return _}});const M=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/compute/handle.js").valueReader,D=U("packages/core/src/compute/statistics.js"),Z=D.numbers,K=D.moments,I=D.frequencyMap,G=D.categoricalDistance,H=D.isNumericColumn,S=D.jarqueBera,O=D.proportionInterval,b=D.SUBSET_RELIABILITY_FLOOR,f=U("packages/core/src/compute/compare.js").pooledStandardMeanDifference,o=U("packages/core/src/compute/special.js"),n=o.studentT,t=o.studentTQuantile,i=o.normalCdf,s=o.normalQuantile,r=o.chiSquareUpperTail,u=Object.freeze({WELCH:"welch",MANN_WHITNEY:"mannWhitney",CHI_SQUARE:"chiSquare"}),a=.05,l=2e6;function h(F){const L=Number(F);return Number.isFinite(L)&&L>0&&L<1?L:.95}function y(F){const{n:L,mean:j,m2:R}=K(F);return{mean:j,sd:L>0?Math.sqrt(R/L):0,n:L}}function m(F,L){const j=F.length;if(j<2)return 0;let R=0;for(let $=0;$<j;$++){const T=F[$]-L;R+=T*T}return R/(j-1)}function v(F,L){return{name:"pooledStandardMeanDifference",value:f(y(F),y(L))}}function d(F,L,j){const R=F.length,$=L.length;if(R<2||$<2)return null;const T=h(j),{mean:A}=K(F),{mean:C}=K(L),z=m(F,A),Y=m(L,C),q=z/R+Y/$;if(!(q>0))return null;const V=Math.sqrt(q),J=(A-C)/V,ee=z/R*(z/R)/(R-1),ne=Y/$*(Y/$)/($-1),oe=q*q/(ee+ne),re=Math.min(1,Math.max(0,2*(1-n(Math.abs(J),oe)))),ae=A-C,fe=t(1-(1-T)/2,oe)*V;return{test:u.WELCH,statistic:J,statisticName:"t",df:oe,pValue:re,interval:{estimate:ae,lower:ae-fe,upper:ae+fe,confidence:T,method:"welch-t (difference of means)"},effectSize:v(F,L),nA:R,nB:$,reliable:R>=b&&$>=b,method:"Welch's t-test (unequal variances; Welch–Satterthwaite df)"}}function p(F){const L=F.length;if(L===0)return Number.NaN;const j=L>>1;return L%2?F[j]:(F[j-1]+F[j])/2}function g(F,L,j){const R=F.length,$=L.length,T=R*$;if(T===0||T>l)return null;const A=new Float64Array(T);let C=0;for(let ee=0;ee<R;ee++)for(let ne=0;ne<$;ne++)A[C++]=F[ee]-L[ne];A.sort();const z=p(A),Y=Math.sqrt(R*$*(R+$+1)/12),q=s(1-(1-j)/2);let V=Math.round(T/2-q*Y);V>=0||(V=0);const J=Math.floor((T-1)/2);return V>J&&(V=J),{estimate:z,lower:A[V],upper:A[T-1-V],confidence:j,method:"hodges-lehmann (normal approximation)"}}function k(F,L,j){const R=F.length,$=L.length;if(R<1||$<1)return null;const T=h(j),A=R+$,C=new Array(A);for(let re=0;re<R;re++)C[re]={v:F[re],g:0};for(let re=0;re<$;re++)C[R+re]={v:L[re],g:1};C.sort((re,ae)=>re.v-ae.v);let z=0,Y=0,q=0;for(;q<A;){let re=q;for(;re<A&&C[re].v===C[q].v;)re++;const ae=re-q,fe=(q+1+re)/2;for(let de=q;de<re;de++)C[de].g===0&&(z+=fe);Y+=ae*ae*ae-ae,q=re}const V=z-R*(R+1)/2,J=R*$/2,ee=R*$/12*(A+1-Y/(A*(A-1)));let ne=1;if(ee>0){const re=Math.max(0,Math.abs(V-J)-.5);ne=Math.min(1,2*i(-re/Math.sqrt(ee)))}const oe=g(F,L,T);return{test:u.MANN_WHITNEY,statistic:V,statisticName:"U",df:null,pValue:ne,interval:oe,effectSize:v(F,L),nA:R,nB:$,reliable:R>=b&&$>=b,method:"Mann-Whitney U (normal approximation, tie- and continuity-corrected)"}}function w(F,L,j,R,$){const T=O(F,L,$),A=O(j,R,$);if(!T||!A)return null;const C=T.proportion-A.proportion,z=C-Math.sqrt((T.proportion-T.lower)**2+(A.upper-A.proportion)**2),Y=C+Math.sqrt((T.upper-T.proportion)**2+(A.proportion-A.lower)**2);return{lower:z,upper:Y}}function E(F,L,j,R,$,T={}){if(!(L>0)||!(R>0))return null;const A=new Set([...F.keys(),...j.keys()]),C=A.size;if(C<2)return null;const z=L+R;let Y=0;for(const ne of A){const oe=F.get(ne)||0,re=j.get(ne)||0,ae=oe+re,fe=L*ae/z,de=R*ae/z;fe>0&&(Y+=(oe-fe)*(oe-fe)/fe),de>0&&(Y+=(re-de)*(re-de)/de)}const q=C-1,V=r(Y,q);let J=null;T.category!==void 0&&A.has(T.category)?J=T.category:C===2&&([J]=[...A]);let ee=null;if(J!==null){const ne=w(F.get(J)||0,L,j.get(J)||0,R,h($));ne&&(ee={estimate:(F.get(J)||0)/L-(j.get(J)||0)/R,lower:ne.lower,upper:ne.upper,confidence:h($),method:"newcombe (difference in this category's share)",category:J})}return{test:u.CHI_SQUARE,statistic:Y,statisticName:"chiSquare",df:q,pValue:V,interval:ee,effectSize:{name:"categoricalTotalVariation",value:G(F,L,j,R)},nA:L,nB:R,reliable:L>=b&&R>=b,method:"Pearson chi-square test of independence (2×k, no continuity correction)"}}function N(F){return F==null||F===""||typeof F=="number"&&Number.isNaN(F)?null:F instanceof Date?F.getTime():typeof F=="object"?String(F):F}function x(F,L,j){if(j===u.WELCH||j===u.MANN_WHITNEY)return{test:j,chosenBy:"override",reason:`caller override: ${j}`};const R=S(F),$=S(L),T=R===null?null:Math.exp(-R/2),A=$===null?null:Math.exp(-$/2);return T!==null&&T<a||A!==null&&A<a?{test:u.MANN_WHITNEY,chosenBy:"auto",reason:`column family: numeric, non-normal by Jarque-Bera (p < ${a})`}:{test:u.WELCH,chosenBy:"auto",reason:T!==null||A!==null?"column family: numeric, no departure from normality detected":"column family: numeric (too few rows to screen normality)"}}function _(F,L,j,R={}){if(!F||!L)return null;const $=h(R.confidence),T=B(L);let A;if(Array.isArray(R.groups)&&R.groups.length===2)A=[N(R.groups[0]),N(R.groups[1])];else{const{map:re}=I(L,j),ae=[...re.entries()].sort((fe,de)=>de[1]-fe[1]).slice(0,2).map(fe=>fe[0]);if(ae.length<2)return M("compareGroups:groups",'[lattice] compareGroups: the "by" column has fewer than two distinct values to group by.'),null;A=ae}const[C,z]=A;if(C===null||z===null||C===z)return M("compareGroups:distinct","[lattice] compareGroups: the two groups must be two distinct, present values."),null;const Y=[],q=[];for(let re=0;re<j.length;re++){const ae=N(T(j[re]));ae===C?Y.push(j[re]):ae===z&&q.push(j[re])}if(Y.length===0||q.length===0)return M("compareGroups:empty","[lattice] compareGroups: one of the two groups has no rows in the current set."),null;const V=R.test&&R.test!=="auto"?String(R.test):null,J=H(F,Y.concat(q));let ee,ne,oe;if(V===u.CHI_SQUARE||!V&&!J){ne=V?"override":"auto",oe=V?"caller override: chiSquare":"column family: categorical";const re=I(F,Y),ae=I(F,q);ee=E(re.map,re.total,ae.map,ae.total,$,{category:R.category})}else{if((V===u.WELCH||V===u.MANN_WHITNEY)&&!J)return M("compareGroups:numeric-override",`[lattice] compareGroups: ${V} needs a numeric column, but the column is not numeric.`),null;const re=Z(F,Y),ae=Z(F,q),fe=x(re,ae,V);ne=fe.chosenBy,oe=fe.reason,ee=fe.test===u.MANN_WHITNEY?k(re,ae,$):d(re,ae,$)}return ee?{...ee,chosenBy:ne,reason:oe,groups:[C,z]}:(M("compareGroups:degenerate","[lattice] compareGroups: the chosen test had too little to work with (too few values, or no variation)."),null)}}),De("packages/core/src/columns/detailcolumn.js",function(e,U){"use strict";Object.defineProperty(e,"DETAIL_COLUMN_ID",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"createDetailColumn",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return B}});const te="__lattice_detail",M=36;function X(D){const Z=D.config&&D.config.detailColumnWidth||M;return{id:te,field:null,title:"",type:"text",dataType:{base:"text"},nullable:!0,align:"center",generated:!0,control:!0,detailExpander:!0,value:{pure:!0},cell:{render:"detailExpander",align:"center"},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:Z,min:Z,max:Z,pin:D.config&&D.config.detailColumnPin||"start",hidden:!1,resizable:!1,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(K,I){return!!(I&&I.expanded)},formatValue(){return""}}}const B=X}),De("packages/core/src/columns/treecolumn.js",function(e,U){"use strict";Object.defineProperty(e,"TREE_COLUMN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createTreeColumn",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return Z}});const M=U("packages/core/src/internal/predicates.js").isFunction,X="__lattice_tree",B=260;function D(K){const I=K.tree||{},G=K.config&&K.config.treeColumnWidth||B,H=()=>(K.columns&&M(K.columns.visible)?K.columns.visible():[]).find(c=>!c.generated)||null,S=(b,c)=>{if(c&&c.group)return c.groupValue;if(M(I.label))return I.label(b,c);if(typeof I.label=="string")return b==null?null:b[I.label];const f=H();return f&&M(f.getValue)?f.getValue(b,c):null},O=()=>{if(I.title)return I.title;const b=typeof I.label=="string"?K.columns&&M(K.columns.get)?K.columns.get(I.label):null:H();return b&&(b.title||b.id)||"Hierarchy"};return{id:X,get title(){return O()},field:null,type:"text",dataType:{base:"text"},nullable:!0,align:"start",generated:!0,value:{pure:!0},cell:{render:"group"},edit:{enabled:!1},sort:{enabled:!0,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},pivot:{enabled:!1,index:0},total:null,lookup:null,layout:{width:G,min:140,pin:K.config&&K.config.treeColumnPin||null,hidden:!1,resizable:!0,movable:!1,lockPosition:!0},header:{},export:{csv:!1,excel:!1},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(b,c){return S(b,c)},formatValue(b,c){if(c&&c.grandTotal)return K.config&&K.config.grandTotalLabel||"Total";if(b==null)return"";if(!I.label){const f=H();if(f&&M(f.formatValue))return f.formatValue(b,c)}return String(b)}}}const Z=D}),De("packages/core/src/columns/pivotcolumns.js",function(e,U){"use strict";Object.defineProperty(e,"PIVOT_PREFIX",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createPivotColumns",{enumerable:!0,get:function(){return D}});const M=U("packages/core/src/internal/warn.js").warnOnce,X="__lattice_pivot",B=500;function D(G){const{pivot:H,valueColumns:S,config:O}=G,b=H&&H.paths||[],c=G.separator||O&&O.pivot&&O.pivot.separator||" | ",f=O&&O.pivot&&O.pivot.maxColumns||B;if(!b.length||!S.length)return{tree:[],leaves:[],error:null};const o=Z(O),n=b.length*S.length+(o?S.length:0);if(n>f){const s=`pivot would generate ${n} columns, above the limit of ${f}. Pivot on a lower-cardinality column, or raise pivot.maxColumns.`;return M(`pivot.maxColumns:${n}`,s),{tree:[],leaves:[],error:s}}const t=[],i=[];for(const s of b){const r=[];for(const u of S){const a=I(s,u,c);r.push(a),i.push(a)}r.length===1?(r[0].title=String(s),t.push(r[0])):t.push({id:`${X}:group:${s}`,title:String(s),columns:r,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0})}if(o){const s=S.map(u=>K(u,O));i.push(...s);const r=O&&O.pivot&&O.pivot.totalsLabel||"Total";if(s.length===1)s[0].title=r,o==="before"?t.unshift(s[0]):t.push(s[0]);else{const u={id:`${X}:group:__totals`,title:r,columns:s,collapsible:!1,openByDefault:!0,showWhen:"always",marryChildren:!0,generated:!0};o==="before"?t.unshift(u):t.push(u)}}return{tree:t,leaves:i,error:null}}function Z(G){const H=G&&G.pivot&&G.pivot.groupTotals;return H==="before"||H==="after"?H:null}function K(G,H){return{id:`${X}:__total${H&&H.pivot&&H.pivot.separator||" | "}${G.id}`,field:null,title:G.title||G.id,type:G.type,dataType:G.dataType,nullable:!0,align:G.align,generated:!0,pivot:{enabled:!1,index:0,sourceId:G.id,total:!0},value:{pure:!0},cell:{align:G.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:G.total,lookup:null,layout:{width:G.layout&&G.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(S,O){const b=O&&O.totals;return b&&Object.hasOwn(b,G.id)?b[G.id]:null},formatValue(S,O){return S==null?"":G.formatValue?G.formatValue(S,O):String(S)}}}function I(G,H,S){return{id:`${X}:${G}${S}${H.id}`,field:null,title:H.title||H.id,type:H.type,dataType:H.dataType,nullable:!0,align:H.align,generated:!0,pivot:{enabled:!1,index:0,path:G,sourceId:H.id},value:{pure:!0},cell:{align:H.align},edit:{enabled:!1},sort:{enabled:!1,direction:null},filter:{enabled:!1},group:{enabled:!1,index:0,explode:!1},total:H.total,lookup:null,layout:{width:H.layout&&H.layout.width||120,min:80,pin:null,hidden:!1,resizable:!0,movable:!1},header:{},export:{csv:!0,excel:!0},allowGroup:!1,allowPivot:!1,allowTotal:!1,def:{},getValue(){return null},formatValue(O,b){return O==null?"":H.formatValue?H.formatValue(O,b):String(O)}}}}),De("packages/core/src/compute/group.js",function(e,U){"use strict";Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return O}});const te=U("packages/core/src/compute/handle.js"),M=te.dictSize,X=te.identity,B=te.presenceReader,D=te.rowCount,Z=te.valueReader,K="",I="\0",G=1<<20;function H(b,c,f,o){const n=b.length,t=b.map(l=>Z(l)),i=Array.isArray(o)&&o.some(Boolean),s=i?t.map((l,h)=>o[h]?y=>o[h](l(y)):l):t;if(!i&&n>0&&b.every(l=>l&&l.kind==="dictionary"&&l.dict)){const l=b.map(y=>M(y.dict)+1);let h=1;for(let y=0;y<n;y++)h*=l[y];if(h<=Number.MAX_SAFE_INTEGER){const y=b.map(p=>p.values),m=b.map(p=>B(p)),v=p=>{let g=0;for(let k=0;k<n;k++){const w=m[k],E=w&&w(p)===0?l[k]-1:y[k][p];g=g*l[k]+E}return g},d=new Float64Array(f);for(let p=0;p<f;p++)d[p]=v(c[p]);return{packed:d,strings:null,product:h,readers:s,keyOf:v}}}const u=l=>{let h="";for(let y=0;y<n;y++){const m=s[y](l);h+=(y===0?"":K)+(m==null?I:String(m))}return h},a=new Array(f);for(let l=0;l<f;l++)a[l]=u(c[l]);return{packed:null,strings:a,product:1/0,readers:s,keyOf:u}}function S(b,c,f,o){const n=new Uint32Array(o+1);for(let r=0;r<f;r++)n[c[r]+1]++;for(let r=0;r<o;r++)n[r+1]+=n[r];const t=new Uint32Array(f),i=n.slice(0,o);for(let r=0;r<f;r++)t[i[c[r]]++]=b[r];const s=new Array(o);for(let r=0;r<o;r++)s[r]=t.subarray(n[r],n[r+1]);return s}function O(b,c,f={}){const o=b||[],n=c||X(D(o[0],f)),t=n.length;if(o.length===0||t===0)return{keys:[],buckets:[]};const{packed:i,strings:s,product:r,readers:u}=H(o,n,t,f.project),a=new Uint32Array(t);let l=0,h=null;if(i&&r<=Math.max(1024,Math.min(G,t*4))){const d=r,p=new Int32Array(d).fill(-1);for(let g=0;g<t;g++)p[i[g]]=0;for(let g=0;g<d;g++)p[g]===0&&(p[g]=l++);for(let g=0;g<t;g++)a[g]=p[i[g]];h=new Float64Array(l);for(let g=0;g<d;g++)p[g]>=0&&(h[p[g]]=g)}else if(i){const d=new Map;for(let p=0;p<t;p++){const g=i[p];let k=d.get(g);k===void 0&&(k=l++,d.set(g,k)),a[p]=k}h=new Float64Array(l);for(const[p,g]of d)h[g]=p}else{const d=new Map;for(let p=0;p<t;p++){const g=s[p];let k=d.get(g);k===void 0&&(k=l++,d.set(g,k)),a[p]=k}}const y=S(n,a,t,l),m=new Array(l);for(let d=0;d<l;d++){const p=y[d][0],g=new Array(u.length);for(let k=0;k<u.length;k++)g[k]=u[k](p);m[d]=g}const v={keys:m,buckets:y};return h&&(v.packed=h),v}}),De("packages/core/src/compute/pivot.js",function(e,U){"use strict";Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return t}});const M=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/compute/handle.js").valueComparator,Z=U("packages/core/src/compute/group.js").packKeys,I=U("packages/core/src/compute/total.js").total,G="|",H="/",S=2e3;function O(r,u,a){return`${r}${G}${u}${G}${a}`}function b(r,u){let a="";for(let l=0;l<r.length;l++){const h=r[l];a+=(l===0?"":u)+(h==null?"":String(h))}return a}function c(r,u,a={}){const l=a.separator||H,h=u.length,{keyOf:y,readers:m}=Z(r,u,0),v=new Map,d=[],p=[];for(let _=0;_<h;_++){const F=u[_],L=y(F);if(v.has(L))continue;v.set(L,d.length),p.push(L);const j=new Array(m.length);for(let R=0;R<m.length;R++)j[R]=m[R](F);d.push(j)}const g=B(a.locale),k=d.map((_,F)=>F);k.sort((_,F)=>{const L=d[_],j=d[F];for(let R=0;R<L.length;R++){const $=f(L[R],j[R],g);if($!==0)return $}return _-F});const w=new Array(k.length),E=new Array(k.length),N=new Map;for(let _=0;_<k.length;_++){const F=k[_];w[_]=d[F],E[_]=b(d[F],l),N.set(p[F],_)}return{keys:w,paths:E,idOf:_=>{const F=N.get(y(_));return F===void 0?-1:F}}}function f(r,u,a){const l=r==null,h=u==null;return l||h?l&&h?0:l?1:-1:a(r,u)}function o(r){const u=r.values||r.totals||[];if(u.length&&typeof u[0]=="object"&&u[0]!==null)return u.filter(y=>y&&y.handle);const a=typeof r.handle=="function"?r.handle:null;if(!a)return u.length&&M("pivot:handles","pivot was given total column ids but no handle(colId) resolver, so no cell values were reduced. Pass values: [{ colId, handle, fn }] or opts.handle."),[];const l=typeof r.totalOf=="function"?r.totalOf:null,h=[];for(const y of u){const m=a(y);m&&h.push({colId:y,handle:m,fn:l?l(y):"sum"})}return h}function n(r,u,a){if(Array.isArray(r)){const l=a||{};return{...l,pivotHandles:r,order:u||null,groups:l.groups||null}}return r||{}}function t(r,u,a){const l=n(r,u,a),h=l.separator||H,y=o(l),m=l.maxColumns===void 0?S:l.maxColumns,v=l.groups&&l.groups.buckets?l.groups:null,d=v?v.buckets:[l.order||new Uint32Array(0)],p=l.groupPaths||(v?v.keys.map(L=>b(L,h)):[""]),g=s(d),{keys:k,paths:w,idOf:E}=c(l.pivotHandles||[],g,l),N=w.length*Math.max(1,y.length),x=i(w,y,h);if(m&&N>m){const L=new Map;return{keys:k,paths:w,fields:x,groupPaths:p,columns:N,values:L,cells:L,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${N} columns, above pivot.maxColumns of ${m}. Narrow the pivot columns or raise the limit.`,columns:N,maxColumns:m}}}const _=new Map,F=w.length;for(let L=0;L<d.length;L++){const j=d[L],R=p[L]===void 0?"":p[L],$=j.length;if($===0)continue;const T=new Int32Array($),A=new Uint32Array(F+1);for(let Y=0;Y<$;Y++){const q=E(j[Y]);T[Y]=q,q>=0&&A[q+1]++}for(let Y=0;Y<F;Y++)A[Y+1]+=A[Y];const C=new Uint32Array($),z=A.slice(0,F);for(let Y=0;Y<$;Y++){const q=T[Y];q>=0&&(C[z[q]++]=j[Y])}for(let Y=0;Y<F;Y++){const q=A[Y],V=A[Y+1];if(V===q)continue;const J=C.subarray(q,V);for(let ee=0;ee<y.length;ee++){const ne=y[ee],oe=I(ne.handle,J,ne.fn,l.totalContext||{locale:l.locale});_.set(O(R,w[Y],ne.colId),oe)}}}return{keys:k,paths:w,fields:x,groupPaths:p,columns:N,values:_,cells:_,error:null}}function i(r,u,a){if(u.length===0)return r.slice();const l=[];for(const h of r)for(const y of u)l.push(`${h}${a}${y.colId}`);return l}function s(r){if(r.length===1)return r[0]||new Uint32Array(0);let u=0;for(const h of r)u+=h?h.length:0;const a=new Uint32Array(u);let l=0;for(const h of r)!h||h.length===0||(a.set(h,l),l+=h.length);return a}}),De("packages/core/src/store/bitset.js",function(e,U){"use strict";Object.defineProperty(e,"Bitset",{enumerable:!0,get:function(){return M}});const te=8;class M{static#e=new Uint8Array(256);static{for(let B=1;B<256;B++)M.#e[B]=M.#e[B>>1]+(B&1)}#t;#n;constructor(B=0){const D=Math.max(0,B|0);this.#n=D,this.#t=new Uint8Array(Math.ceil(D/te))}get size(){return this.#n}get words(){return this.#t}get bytes(){return this.#t?this.#t.byteLength:0}get(B){return B<0||B>=this.#n?0:this.#t[B>>3]>>(B&7)&1}set(B){return B>=0&&B<this.#n&&(this.#t[B>>3]|=1<<(B&7)),this}clear(B){return B>=0&&B<this.#n&&(this.#t[B>>3]&=~(1<<(B&7))),this}assign(B,D){return D?this.set(B):this.clear(B)}fill(B=!1){return this.#t.fill(B?255:0),B&&this.#r(),this}grow(B){const D=Math.max(0,B|0);if(D<=this.#n)return this;const Z=Math.ceil(D/te);if(Z>this.#t.length){const K=new Uint8Array(Z);K.set(this.#t),this.#t=K}return this.#n=D,this}count(){const B=this.#t,D=M.#e;let Z=0;for(let K=0;K<B.length;K++)Z+=D[B[K]];return Z}and(B){const D=B instanceof M?B.words:B,Z=this.#t,K=Math.min(Z.length,D.length);for(let I=0;I<K;I++)Z[I]&=D[I];for(let I=K;I<Z.length;I++)Z[I]=0;return this}or(B){const D=B instanceof M?B.words:B,Z=this.#t,K=Math.min(Z.length,D.length);for(let I=0;I<K;I++)Z[I]|=D[I];return this}not(){const B=this.#t;for(let D=0;D<B.length;D++)B[D]=~B[D]&255;return this.#r(),this}clone(){const B=new M(this.#n);return B.words.set(this.#t.subarray(0,B.words.length)),B}release(){this.#t=new Uint8Array(0),this.#n=0}#r(){const B=this.#n&7;if(B===0)return;const D=this.#n>>3;D<this.#t.length&&(this.#t[D]&=(1<<B)-1)}static from(B){const D=Array.isArray(B)?B:Array.from(B),Z=new M(D.length);for(let K=0;K<D.length;K++)D[K]&&Z.set(K);return Z}}}),De("packages/core/src/store/dictionary.js",function(e,U){"use strict";Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return B}});const te=U("packages/core/src/internal/compare.js"),M=te.collator,X=te.defaultCompare;class B{#e;#t=new Map;#n=0;#r=null;#s=-1;#i="\0";constructor(Z=[]){this.#e=[];for(let K=0;K<Z.length;K++){const I=Z[K];this.#t.has(I)||(this.#t.set(I,this.#e.length),this.#e.push(I))}}get size(){return this.#e.length}get version(){return this.#n}get bytes(){let Z=this.#e.length*8;for(let K=0;K<this.#e.length;K++){const I=this.#e[K];typeof I=="string"&&(Z+=I.length*2),Z+=16}return Z}codeOf(Z){const K=this.#t.get(Z);if(K!==void 0)return K;const I=this.#e.length;return this.#e.push(Z),this.#t.set(Z,I),this.#n++,I}lookup(Z){const K=this.#t.get(Z);return K===void 0?-1:K}has(Z){return this.#t.has(Z)}valueOf(Z){return this.#e[Z]}values(){return this.#e}ranks(Z){const K=Z||"";if(this.#r&&this.#s===this.#n&&this.#i===K)return this.#r;const I=this.#e.length,G=new Array(I);for(let b=0;b<I;b++)G[b]=b;const H=M(Z).compare,S=this.#e;G.sort((b,c)=>this.#o(S[b],S[c],H));const O=new Uint32Array(I);for(let b=0;b<I;b++)O[G[b]]=b;return this.#r=O,this.#s=this.#n,this.#i=K,O}#o(Z,K,I){return typeof Z=="string"&&typeof K=="string"?I(Z,K):X(Z,K)}}}),De("packages/core/src/store/multivalue.js",function(e,U){"use strict";Object.defineProperty(e,"MultiValue",{enumerable:!0,get:function(){return te}});class te{#e;#t;#n=0;#r=0;constructor(X={}){const B=Math.max(1,X.rows??16),D=Math.max(1,X.values??B);this.#e=new Int32Array(D),this.#t=new Uint32Array(B+1)}get values(){return this.#e}get offsets(){return this.#t}get rows(){return this.#n}get length(){return this.#r}get bytes(){return this.#e.byteLength+this.#t.byteLength}count(X){return X<0||X>=this.#n?0:this.#t[X+1]-this.#t[X]}at(X){return X<0||X>=this.#n?this.#e.subarray(0,0):this.#e.subarray(this.#t[X],this.#t[X+1])}has(X,B){if(X<0||X>=this.#n)return!1;const D=this.#e,Z=this.#t[X+1];for(let K=this.#t[X];K<Z;K++)if(D[K]===B)return!0;return!1}hasAny(X,B){for(let D=0;D<B.length;D++)if(this.has(X,B[D]))return!0;return!1}hasAll(X,B){for(let D=0;D<B.length;D++)if(!this.has(X,B[D]))return!1;return!0}hasNone(X,B){return!this.hasAny(X,B)}push(X){const B=this.#n,D=X.length;this.#s(B+1),this.#i(this.#r+D);const Z=this.#r;for(let K=0;K<D;K++)this.#e[Z+K]=X[K]|0;return this.#r+=D,this.#n=B+1,this.#t[B]=Z,this.#t[B+1]=this.#r,B}write(X,B){if(X===this.#n){this.push(B);return}if(X<0||X>this.#n)return;const D=this.#t[X],Z=this.#t[X+1],K=B.length;if(Z-D===K){for(let I=0;I<K;I++)this.#e[D+I]=B[I]|0;return}this.#o(X,B)}compact(X,B,D){const Z=this.#e,K=this.#t,I=this.#n,G=new Int32Array(Math.max(1,this.#r)),H=new Uint32Array(B+1);let S=0;for(let O=0;O<I;O++){if(X[O]===D)continue;const b=K[O],c=K[O+1];H[X[O]]=S;for(let f=b;f<c;f++)G[S++]=Z[f];H[X[O]+1]=S}this.#e=G,this.#t=H,this.#n=B,this.#r=S}release(){this.#e=new Int32Array(0),this.#t=new Uint32Array(1),this.#n=0,this.#r=0}#s(X){if(X+1<=this.#t.length)return;let B=this.#t.length-1;for(;B<X;)B=B*2||16;const D=new Uint32Array(B+1);D.set(this.#t),this.#t=D}#i(X){if(X<=this.#e.length)return;let B=this.#e.length;for(;B<X;)B=B*2||16;const D=new Int32Array(B);D.set(this.#e),this.#e=D}#o(X,B){const D=this.#e,Z=this.#t,K=this.#n,I=B.length-(Z[X+1]-Z[X]),G=new Int32Array(Math.max(1,this.#r+I)),H=new Uint32Array(Z.length);let S=0;for(let O=0;O<K;O++){if(H[O]=S,O===X)for(let b=0;b<B.length;b++)G[S++]=B[b]|0;else for(let b=Z[O];b<Z[O+1];b++)G[S++]=D[b];H[O+1]=S}this.#e=G,this.#t=H,this.#r=S}}}),De("packages/core/src/compute/sort.js",function(e,U){"use strict";Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return F}});const te=U("packages/core/src/compute/handle.js"),M=te.bitReader,X=te.dictRanks,B=te.dictSize,D=te.identity,Z=te.isMissing,K=te.presenceReader,I=te.rowCount,G=te.valueComparator,H=te.valueReader,S=new Uint32Array(0),O=new ArrayBuffer(8),b=new Float64Array(O),c=new Uint32Array(O),f=(b[0]=-1,(c[1]&2147483648)!==0?1:0),o=f===1?0:1;function n(j,R){b[0]=j;let $=c[f],T=c[o];($&2147483648)!==0?($=~$>>>0,T=~T>>>0):$=($^2147483648)>>>0,R[0]=T,R[1]=$}function t(j,R,$,T){if(T<2)return j;const A=new Uint32Array(256*8);for(let ne=0;ne<T;ne++){const oe=R[ne],re=$[ne];A[oe&255]++,A[256+(oe>>>8&255)]++,A[512+(oe>>>16&255)]++,A[768+(oe>>>24&255)]++,A[1024+(re&255)]++,A[1280+(re>>>8&255)]++,A[1536+(re>>>16&255)]++,A[1792+(re>>>24&255)]++}let C=j,z=R,Y=$,q=new Uint32Array(T),V=new Uint32Array(T),J=new Uint32Array(T);const ee=new Uint32Array(256);for(let ne=0;ne<8;ne++){const oe=ne<<8,re=(ne&3)<<3,ae=ne>=4;let fe=!1;for(let Ie=0;Ie<256;Ie++)if(A[oe+Ie]===T){fe=!0;break}if(fe)continue;let de=0;for(let Ie=0;Ie<256;Ie++)ee[Ie]=de,de+=A[oe+Ie];for(let Ie=0;Ie<T;Ie++){const Le=z[Ie],se=Y[Ie],pe=(ae?se:Le)>>>re&255,be=ee[pe]++;q[be]=C[Ie],V[be]=Le,J[be]=se}let ve=C;C=q,q=ve,ve=z,z=V,V=ve,ve=Y,Y=J,J=ve}return C}function i(j,R,$){if($<2)return j;const T=new Uint32Array(256*4);for(let V=0;V<$;V++){const J=R[V];T[J&255]++,T[256+(J>>>8&255)]++,T[512+(J>>>16&255)]++,T[768+(J>>>24&255)]++}let A=j,C=R,z=new Uint32Array($),Y=new Uint32Array($);const q=new Uint32Array(256);for(let V=0;V<4;V++){const J=V<<8,ee=V<<3;let ne=!1;for(let ae=0;ae<256;ae++)if(T[J+ae]===$){ne=!0;break}if(ne)continue;let oe=0;for(let ae=0;ae<256;ae++)q[ae]=oe,oe+=T[J+ae];for(let ae=0;ae<$;ae++){const fe=C[ae],de=q[fe>>>ee&255]++;z[de]=A[ae],Y[de]=fe}let re=A;A=z,z=re,re=C,C=Y,Y=re}return A}function s(j,R,$,T){const A=new Uint32Array(T+1);for(let Y=0;Y<$;Y++)A[R[Y]]++;let C=0;for(let Y=0;Y<=T;Y++){const q=A[Y];A[Y]=C,C+=q}const z=new Uint32Array($);for(let Y=0;Y<$;Y++)z[A[R[Y]]++]=j[Y];return z}function r(j,R,$,T){return $<2?j:T<=65536||T<=$*2?s(j,R,$,T):i(j,R,$)}function u(j,R){return j.length===R&&j.byteOffset===0?j:Uint32Array.prototype.slice.call(j,0,R)}function a(j,R,$=!1){const T=R||D(j.length),A=T.length;if(A<2)return Uint32Array.from(T);const C=new Uint32Array(A),z=new Uint32Array(A),Y=new Uint32Array(A),q=new Uint32Array(A),V=new Uint32Array(2);let J=0,ee=0;for(let re=0;re<A;re++){const ae=T[re],fe=j[ae];if(Number.isNaN(fe)){q[ee++]=ae;continue}n(fe,V),$?(z[J]=~V[0]>>>0,Y[J]=~V[1]>>>0):(z[J]=V[0],Y[J]=V[1]),C[J++]=ae}const ne=t(C.subarray(0,J),z.subarray(0,J),Y.subarray(0,J),J);if(ee===0)return u(ne,J);const oe=new Uint32Array(A);return oe.set(ne.subarray(0,J),0),oe.set(q.subarray(0,ee),J),oe}function l(j,R,$=!1){const T=R||D(j.length),A=T.length;if(A<2)return Uint32Array.from(T);const C=Uint32Array.from(T),z=new Uint32Array(A);for(let Y=0;Y<A;Y++){const q=(j[C[Y]]^2147483648)>>>0;z[Y]=$?~q>>>0:q}return u(i(C,z,A),A)}function h(j,R,$={}){const T=R||D(I(j,$)),A=T.length;if(A<2)return Uint32Array.from(T);const C=X(j.dict,$.locale),z=j.values,Y=K(j),q=Math.max(B(j.dict),C.length),V=q,J=Uint32Array.from(T),ee=new Uint32Array(A),ne=!!$.descending;for(let oe=0;oe<A;oe++){const re=J[oe];let ae=Y&&Y(re)===0?V:C[z[re]];ae===void 0&&(ae=V),ee[oe]=ne?V-ae:ae}return u(r(J,ee,A,q+1),A)}function y(j,R,$){const T=R.length;let A=Uint32Array.from(R);if(T<2)return A;let C=new Uint32Array(T);for(let z=1;z<T;z<<=1){for(let q=0;q<T;q+=z<<1){const V=Math.min(q+z,T),J=Math.min(q+(z<<1),T);let ee=q,ne=V,oe=q;for(;ee<V&&ne<J;)C[oe++]=$(j[A[ee]],j[A[ne]])<=0?A[ee++]:A[ne++];for(;ee<V;)C[oe++]=A[ee++];for(;ne<J;)C[oe++]=A[ne++]}const Y=A;A=C,C=Y}return A}function m(j,R,$){const T=M(j.values),A=R.length,C=new Uint32Array(A),z=$?1:0;let Y=0;for(let q=0;q<A;q++)T(R[q])===z&&(C[Y++]=R[q]);for(let q=0;q<A;q++)T(R[q])!==z&&(C[Y++]=R[q]);return C}function v(j,R){const $=j.values,T=j.kind;if((T==="object"||T===void 0)&&(Array.isArray($)||ArrayBuffer.isView($))&&!j.presence)return $;const C=H(j),z=new Array(I(j)||0);for(let Y=0;Y<R.length;Y++){const q=R[Y];z[q]=C(q)}return z}function d(j,R){for(let $=0;$<R.length;$++)if(typeof j[R[$]]!="string")return!1;return!0}function p(j,R,$,T,A){const C=j.length,z=Uint32Array.from(j);if(C<2||T<1)return z;const Y=new Uint32Array(C),q=T-1;for(let V=0;V<C;V++){const J=$[R[V]];Y[V]=A?q-J:J}return u(r(z,Y,C,T),C)}function g(j,R,$){const T=G($),A=new Array(R);for(let z=0;z<R;z++)A[z]=z;A.sort((z,Y)=>T(j[z],j[Y])||z-Y);const C=new Uint32Array(R);for(let z=0;z<R;z++)C[A[z]]=z;return C}function k(j,R,$){const T=R.length,A=new Map,C=[],z=new Uint32Array(T);for(let V=0;V<T;V++){const J=j[R[V]];let ee=A.get(J);ee===void 0&&(ee=C.length,A.set(J,ee),C.push(J)),z[V]=ee}const Y=C.length,q=g(C,Y,$.locale);return p(R,z,q,Y,!!$.descending)}function w(j,R,$){const T=v(j,R);if(R.length>=2&&d(T,R)){const z=j.stringRank;return z&&z.version===j.version&&z.usable(R,T,$.locale)?z.sort(R,$):k(T,R,$)}const A=G($.locale),C=$.descending?(z,Y)=>A(Y,z):A;return y(T,R,C)}function E(j,R,$){const T=v(j,R),A=$.compare,z=!!$.descending?(Y,q)=>-A(Y,q,void 0,void 0,!0):(Y,q)=>A(Y,q,void 0,void 0,!1);return y(T,R,z)}function N(j,R){const $=R.length,T=K(j),A=j.values,C=j.kind==="float64"&&!!A,z=j.kind==="object"||j.kind==="multi"||j.kind===void 0;if(!T&&!C&&!z)return{present:R,absent:S};const Y=new Uint32Array($),q=new Uint32Array($);let V=0,J=0;if(T&&C)for(let ee=0;ee<$;ee++){const ne=R[ee];T(ne)===1&&!Number.isNaN(A[ne])?Y[V++]=ne:q[J++]=ne}else if(C&&!T)for(let ee=0;ee<$;ee++){const ne=R[ee];Number.isNaN(A[ne])?q[J++]=ne:Y[V++]=ne}else if(T&&!z)for(let ee=0;ee<$;ee++){const ne=R[ee];T(ne)===1?Y[V++]=ne:q[J++]=ne}else{const ee=H(j);for(let ne=0;ne<$;ne++){const oe=R[ne];Z(ee(oe))?q[J++]=oe:Y[V++]=oe}}return J===0?{present:R,absent:S}:{present:Y.subarray(0,V),absent:q.subarray(0,J)}}function x(j,R,$){if(R.length===0)return j;const T=new Uint32Array(j.length+R.length);return $?(T.set(R,0),T.set(j,R.length)):(T.set(j,0),T.set(R,j.length)),T}function _(j,R,$={}){const T=R||D(I(j,$));if(!j||T.length<2)return Uint32Array.from(T);const{present:A,absent:C}=N(j,T);if(A.length===0)return Uint32Array.from(T);const z=!!$.descending;let Y;if(typeof $.compare=="function")Y=E(j,A,$);else switch(j.kind){case"float64":Y=a(j.values,A,z);break;case"int32":Y=l(j.values,A,z);break;case"dictionary":Y=h(j,A,$);break;case"bitset":Y=m(j,A,z);break;default:Y=w(j,A,$);break}return x(Y,C,!!$.nullsFirst)}function F(j,R,$,T={}){const A=R||[],C=A.length&&(A[0].handle||L(j,A[0].col))||j&&j[0];let z=$||D(I(C,T));for(let Y=A.length-1;Y>=0;Y--){const q=A[Y],V=q.handle||L(j,q.col)||j&&j[Y];V&&(z=_(V,z,{descending:q.descending!==void 0?!!q.descending:q.dir==="desc",nullsFirst:!!q.nullsFirst,locale:q.locale!==void 0?q.locale:T.locale,compare:q.compare}))}return z instanceof Uint32Array?z:Uint32Array.from(z)}function L(j,R){if(!(!j||R===void 0)){for(let $=0;$<j.length;$++)if(j[$]&&j[$].id===R)return j[$]}}}),De("packages/core/src/store/stringrank.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_MAX_DISTINCT",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"StringRankIndex",{enumerable:!0,get:function(){return D}});const te=U("packages/core/src/compute/sort.js"),M=te.collateStringRanks,X=te.rankSortStrings,B=1e5;class D{#e=[];#t=new Map;#n;#r=0;#s=0;#i=-1;#o;#l=!1;#a=null;#c=-1;#u="\0";constructor(K=B){this.#o=K>0?K:B,this.#n=new Uint32Array(0)}get version(){return this.#i}set version(K){this.#i=K}get generation(){return this.#s}get size(){return this.#e.length}get capped(){return this.#l}get length(){return this.#r}get bytes(){let K=this.#n.byteLength;const I=this.#e;for(let G=0;G<I.length;G++)K+=I[G].length*2+24;return K}#f(K,I){const G=this.#t.get(K);if(G!==void 0)return G;if(this.#l)return-1;if(I&&this.#e.length>=this.#o)return this.#l=!0,-1;const H=this.#e.length;return this.#e.push(K),this.#t.set(K,H),this.#s++,H}build(K,I){const G=I|0;this.#e=[],this.#t=new Map,this.#s=0,this.#l=!1,this.#a=null,this.#c=-1,this.#n=new Uint32Array(G);for(let H=0;H<G;H++){const S=K[H],O=typeof S=="string"?this.#f(S,!1):-1;this.#n[H]=O<0?0:O}this.#r=G}append(K,I,G){const H=(I|0)+(G|0);if(H>this.#n.length){const S=new Uint32Array(H);S.set(this.#n.subarray(0,this.#r)),this.#n=S}for(let S=I|0;S<H;S++){const O=K[S],b=typeof O=="string"?this.#f(O,!0):-1;this.#n[S]=b<0?0:b}this.#r=Math.max(this.#r,H)}ranks(K){const I=K||"";if(this.#a&&this.#c===this.#s&&this.#u===I)return this.#a;const G=M(this.#e,this.#e.length,K);return this.#a=G,this.#c=this.#s,this.#u=I,G}usable(K,I,G){if(this.#l||this.#e.length===0)return!1;const H=this.#n,S=this.#e,O=this.#r;for(let b=0;b<K.length;b++){const c=K[b];if(c>=O||S[H[c]]!==I[c])return!1}return!0}sort(K,I){const G=this.ranks(I.locale),H=this.#e.length,S=K.length,O=new Uint32Array(S),b=this.#n;for(let c=0;c<S;c++)O[c]=b[K[c]];return X(K,O,G,H,!!I.descending)}}}),De("packages/core/src/store/columnstore.js",function(e,U){"use strict";Object.defineProperty(e,"REMOVED",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"toFloat",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"ColumnHandle",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"ColumnStore",{enumerable:!0,get:function(){return m}});const M=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/paths.js").pathGetter,I=U("packages/core/src/store/bitset.js").Bitset,H=U("packages/core/src/store/dictionary.js").Dictionary,O=U("packages/core/src/store/multivalue.js").MultiValue,c=U("packages/core/src/store/stringrank.js").StringRankIndex,f=4294967295,o=1024,n=5e3,t=.2,i=new Set(["float64","int32","bitset","dictionary","object","multi"]);function s(v){return v==null}function r(v){if(typeof v=="number")return v;if(v instanceof Date)return v.getTime();if(typeof v=="boolean")return v?1:0;const d=Number(v);return Number.isNaN(d)&&typeof v=="string"?Date.parse(v):d}function u(v){const d=r(v);return Number.isFinite(d)?d|0:0}function a(v){return s(v)?[]:Array.isArray(v)?v:[v]}function l(v,d){switch(v.kind){case"float64":case"int32":return v.buf[d];case"bitset":return v.bits.get(d)===1;case"dictionary":return v.dict.valueOf(v.buf[d]);case"multi":{const p=v.mv.at(d),g=new Array(p.length);for(let k=0;k<p.length;k++)g[k]=v.dict.valueOf(p[k]);return g}default:return v.buf[d]}}function h(v,d){switch(v.kind){case"float64":case"int32":return v.values[d];case"bitset":return(v.values[d>>3]&1<<(d&7))!==0;case"dictionary":return(v.table||[])[v.values[d]];case"multi":{const p=v.offsets[d],g=v.offsets[d+1],k=v.table||[],w=new Array(g-p);for(let E=p;E<g;E++)w[E-p]=k[v.values[E]];return w}default:return v.values[d]}}class y{#e;#t;#n;#r;#s;#i;#o;#l=!1;#a=null;#c=null;#u=null;#f=null;#d=null;#h;#p;#m=-1;#g=null;#b=0;#y=0;#j=null;#w=null;#O=!1;constructor(d,p){this.#e=d.id;const g=i.has(d.kind)?d.kind:"object";d.kind&&!i.has(d.kind)&&M(`store.kind.${d.id}`,`column "${d.id}" declares unknown storage kind "${d.kind}"; falling back to object`),this.#n=g,this.#t=g,this.#r=d.nullable!==!1,this.#o=d.dictionary??null,this.#i=p,this.#s=B(d.read)?d.read:Z(d.field||d.id),this.#h=d.stringRankIndex!=="off",this.#p=typeof d.stringRankMaxDistinct=="number"?d.stringRankMaxDistinct:0,this.#j=new Map}get id(){return this.#e}get kind(){return this.#l?this.#t:"object"}get target(){return this.#n}get nullable(){return this.#r}get values(){return this.#O?null:this.#l?this.#t==="bitset"?this.#c.words:this.#t==="multi"?this.#u.values:this.#a:this.#P().values}get presence(){return this.#O||!this.#r?null:this.#l?this.#g:this.#P().presence}get dict(){return this.#O||!this.#l?null:this.#t==="dictionary"||this.#t==="multi"?this.#f:null}get stringRank(){if(this.#O||!this.#h||this.kind!=="object")return null;const d=this.values,p=this.#i.physical();if(!d||p===0)return null;if(this.#d===null){if(typeof d[0]!="string")return null;const g=new c(this.#v());return g.build(d,p),g.version=this.#y,this.#d=g,this.#m=this.#y,g.capped?null:g}return this.#d.length<p&&this.#d.append(d,this.#d.length,p-this.#d.length),this.#d.version=this.#y,this.#m=this.#y,this.#d.capped?null:this.#d}#v(){return this.#p}#T(){this.#d=null,this.#m=-1}get offsets(){return this.#O||!this.#l||this.#t!=="multi"?null:this.#u.offsets}get version(){return this.#y}get bytes(){let d=0;return this.#a&&(d+=this.#a.byteLength??this.#a.length*8),this.#c&&(d+=this.#c.bytes),this.#u&&(d+=this.#u.bytes),this.#g&&(d+=this.#g.bytes),this.#f&&(d+=this.#f.bytes),this.#j&&(d+=this.#j.size*24),d}get(d){if(!this.#O&&!(d<0||d>=this.#i.physical())){if(!this.#l)return this.#N(d);if(this.#r&&this.#g.get(d)===0)return null;switch(this.#t){case"float64":case"int32":return this.#a[d];case"bitset":return this.#c.get(d)===1;case"dictionary":return this.#f.valueOf(this.#a[d]);case"multi":{const p=this.#u.at(d),g=new Array(p.length);for(let k=0;k<p.length;k++)g[k]=this.#f.valueOf(p[k]);return g}default:return this.#a[d]}}}set(d,p){this.#O||(this.#l?this.#E(d,p):this.#j.set(d,p===void 0?null:p),this.#d&&this.#T(),this.#y++)}read(d){return this.#s(d)}appendColumn(d,p,g){if(this.#O||g<=0)return;if(!this.#l){this.#y++;return}const k=this.#s,w=this.#r,E=this.#g;let N=!1;switch(this.#t){case"float64":{const x=this.#a;for(let _=0;_<g;_++){const F=k(d[_]);if(typeof F=="number"){w&&E.set(p+_),x[p+_]=F;continue}const L=F==null;w?E.assign(p+_,!L):L&&(N=!0),x[p+_]=L?NaN:r(F)}break}case"int32":{const x=this.#a;for(let _=0;_<g;_++){const F=k(d[_]),L=F==null;w?E.assign(p+_,!L):L&&(N=!0),x[p+_]=L?0:u(F)}break}case"bitset":{const x=this.#c;for(let _=0;_<g;_++){const F=k(d[_]),L=F==null;w?E.assign(p+_,!L):L&&(N=!0),x.assign(p+_,!L&&!!F)}break}case"dictionary":{const x=this.#a,_=this.#f;for(let F=0;F<g;F++){const L=k(d[F]),j=L==null;w?E.assign(p+F,!j):j&&(N=!0),x[p+F]=j?0:_.codeOf(L)}break}case"multi":{const x=this.#u,_=this.#f;for(let F=0;F<g;F++){const L=k(d[F]),j=L==null;w?E.assign(p+F,!j):j&&(N=!0);const R=a(L),$=new Array(R.length);for(let T=0;T<R.length;T++)$[T]=_.codeOf(R[T]);x.write(p+F,$)}break}default:{const x=this.#a;for(let _=0;_<g;_++){const F=k(d[_]),L=F==null;w?E.assign(p+_,!L):L&&(N=!0),x[p+_]=L?null:F}break}}N&&M(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#d&&this.#t==="object"&&(this.#d.append(this.#a,p,g),this.#d.version=this.#y+1,this.#m=this.#y+1),this.#y++}appendPacked(d,p,g){if(this.#O||g<=0||!d)return;if(!this.#l){this.#y++;return}const k=this.#g,w=d.presence;if(k)if(w)for(let N=0;N<g;N++)k.assign(p+N,(w[N>>3]&1<<(N&7))!==0);else for(let N=0;N<g;N++)k.set(p+N);const E=d.kind===this.#t;if(E&&(this.#t==="float64"||this.#t==="int32")){this.#a.set(d.values,p),this.#y++;return}if(E&&this.#t==="bitset"){const N=d.values;for(let x=0;x<g;x++)this.#c.assign(p+x,(N[x>>3]&1<<(x&7))!==0);this.#y++;return}if(E&&this.#t==="dictionary"){const N=d.table||[],x=new Uint32Array(N.length);for(let j=0;j<N.length;j++)x[j]=this.#f.codeOf(N[j]);const _=d.values,F=this.#a,L=k;for(let j=0;j<g;j++){if(L&&(w&&(w[j>>3]&1<<(j&7))===0)){F[p+j]=0;continue}F[p+j]=x[_[j]]??0}this.#y++;return}if(E&&this.#t==="multi"){const N=d.table||[],x=new Uint32Array(N.length);for(let L=0;L<N.length;L++)x[L]=this.#f.codeOf(N[L]);const _=d.values,F=d.offsets;for(let L=0;L<g;L++){const j=F[L],R=F[L+1],$=new Array(R-j);for(let T=j;T<R;T++)$[T-j]=x[_[T]]??0;this.#u.write(p+L,$)}this.#y++;return}for(let N=0;N<g;N++){const x=w?(w[N>>3]&1<<(N&7))===0:d.kind==="object"?d.values[N]===null:!1;this.#E(p+N,x?null:h(d,N))}this.#y++}touch(){this.#y++}columnarise(d,p){if(this.#l||this.#O)return;const g=new Array(p);for(let k=0;k<p;k++)g[k]=this.#N(k);this.#t=this.#n,this.#l=!0,this.#S(d);for(let k=0;k<p;k++)this.#E(k,g[k]);this.#j.clear(),this.#w=null,this.#T(),this.#y++}grow(d){if(!(!this.#l||this.#O||d<=this.#b)){switch(this.#t){case"float64":case"int32":case"dictionary":{const p=new this.#a.constructor(d);p.set(this.#a),this.#a=p;break}case"bitset":this.#c.grow(d);break;case"multi":break;default:this.#a.length=d;break}this.#g&&this.#g.grow(d),this.#b=d,this.#y++}}convert(d){if(this.#O||!i.has(d)||(this.#n=d,!this.#l||d===this.#t))return!1;const p={kind:this.#t,buf:this.#a,bits:this.#c,mv:this.#u,dict:this.#f},g=this.#i.physical(),k=this.#g;this.#t=d,this.#S(this.#b);for(let w=0;w<g;w++){const E=k!==null&&k.get(w)===0;E&&d!=="multi"||this.#E(w,E?null:l(p,w))}return this.#T(),this.#y++,!0}compact(d,p,g){if(!this.#O){if(this.#T(),!this.#l){const k=this.#j;if(k.size){const w=new Map;for(const[E,N]of k)d[E]!==f&&w.set(d[E],N);this.#j=w}this.#w=null,this.#y++;return}switch(this.#t){case"float64":case"int32":case"dictionary":case"object":{const k=this.#a;for(let w=0;w<p;w++)d[w]!==f&&(k[d[w]]=k[w]);if(this.#t==="object")for(let w=g;w<p;w++)k[w]=void 0;break}case"bitset":{const k=this.#c;for(let w=0;w<p;w++)d[w]!==f&&k.assign(d[w],k.get(w)===1);for(let w=g;w<p;w++)k.clear(w);break}case"multi":this.#u.compact(d,g,f);break;default:break}if(this.#g){const k=this.#g;for(let w=0;w<p;w++)d[w]!==f&&k.assign(d[w],k.get(w)===1);for(let w=g;w<p;w++)k.clear(w)}this.#y++}}release(){this.#O||(this.#O=!0,this.#a=null,this.#c&&this.#c.release(),this.#c=null,this.#u&&this.#u.release(),this.#u=null,this.#g&&this.#g.release(),this.#g=null,this.#f=null,this.#d=null,this.#j=new Map,this.#w=null,this.#b=0,this.#y++)}#S(d){const p=Math.max(1,d);switch(this.#a=null,this.#c=null,this.#u=null,this.#t){case"float64":this.#a=new Float64Array(p);break;case"int32":this.#a=new Int32Array(p);break;case"bitset":this.#c=new I(p);break;case"dictionary":this.#a=new Uint32Array(p),this.#f=this.#f??new H(this.#o??[]);break;case"multi":this.#u=new O({rows:p,values:p}),this.#f=this.#f??new H(this.#o??[]);break;default:this.#a=new Array(p);break}this.#t!=="dictionary"&&this.#t!=="multi"&&(this.#f=null),this.#r&&(this.#g?this.#g.grow(p):this.#g=new I(p)),this.#b=p}#E(d,p){const g=s(p);switch(this.#r?this.#g.assign(d,!g):g&&M(`store.null.${this.#e}`,`column "${this.#e}" is declared non-nullable but received null; storing a filler value`),this.#t){case"float64":this.#a[d]=g?NaN:r(p);break;case"int32":this.#a[d]=g?0:u(p);break;case"bitset":this.#c.assign(d,!g&&!!p);break;case"dictionary":this.#a[d]=g?0:this.#f.codeOf(p);break;case"multi":{const k=a(p),w=new Array(k.length);for(let E=0;E<k.length;E++)w[E]=this.#f.codeOf(k[E]);this.#u.write(d,w);break}default:this.#a[d]=g?null:p;break}}#N(d){if(this.#j.has(d))return this.#j.get(d);const p=this.#s(this.#i.rowAt(d));return p===void 0?null:p}#P(){if(this.#w&&this.#w.version===this.#y)return this.#w;const d=this.#i.physical(),p=new Array(d),g=this.#r?new I(d):null;for(let k=0;k<d;k++){const w=this.#N(k);p[k]=w,g&&!s(w)&&g.set(k)}return this.#w={version:this.#y,values:p,presence:g},this.#w}}class m{#e;#t=new Map;#n=[];#r=[];#s=0;#i=0;#o=0;#l=0;#a=new I(0);#c=!1;#u=!0;#f;#d;#h;#p=!1;constructor(d,p={}){this.#e=Array.isArray(d)?d:[],this.#d=Math.max(1,p.initialCapacity??o),this.#u=p.retainSource!==!1,this.#f=this.#u?p.columnarBelow??n:0,this.#h=p.compactRatio??t;const g={rowAt:k=>this.#r[k],physical:()=>this.#s};for(const k of this.#e){if(!k||!k.id)continue;if(this.#t.has(k.id)){M(`store.dup.${k.id}`,`duplicate column id "${k.id}" in the store schema; ignoring the second`);continue}const w=new y(k,g);this.#t.set(k.id,w),this.#n.push(w)}this.#f<=0&&this.#b()}get count(){return this.#o}get physical(){return this.#s}get capacity(){return this.#c?this.#i:this.#r.length}get tombstones(){return this.#l}get columnar(){return this.#c}get destroyed(){return this.#p}get bytes(){let d=this.#a.bytes+this.#r.length*8;for(const p of this.#n)d+=p.bytes;return d}append(d){const p=this.#s;if(this.#p||!d)return{from:p,to:p};const g=d.length|0;if(g===0)return{from:p,to:p};if(this.#u)for(let w=0;w<g;w++)this.#r[p+w]=d[w];if(this.#s=p+g,this.#o+=g,this.#a.grow(this.#s),!this.#c){if(this.#s>=this.#f)this.#b();else for(const w of this.#n)w.touch();return{from:p,to:this.#s}}this.#m(this.#s);const k=this.#n;for(let w=0;w<k.length;w++)k[w].appendColumn(d,p,g);return{from:p,to:this.#s}}appendPacked(d,p){const g=this.#s;if(this.#p||!d)return{from:g,to:g};const k=d.count|0;if(k===0)return{from:g,to:g};if(this.#u&&p)for(let E=0;E<k;E++)this.#r[g+E]=p[E];this.#s=g+k,this.#o+=k,this.#a.grow(this.#s),this.#c||this.#b(),this.#m(this.#s);const w=new Map;for(const E of d.columns)w.set(E.id,E);for(const E of this.#n){const N=w.get(E.id);N?E.appendPacked(N,g,k):E.grow(this.#i)}return{from:g,to:this.#s}}source(d){if(this.#u)return this.#r[d];if(!(d<0||d>=this.#s))return this.#g(d)}setSource(d,p){this.#p||d<0||d>=this.#s||this.#u&&(this.#r[d]=p)}get(d,p){const g=this.#t.get(d);return g?g.get(p):void 0}set(d,p,g){if(this.#p||p<0||p>=this.#s)return;const k=this.#t.get(d);if(!k){M(`store.set.${d}`,`set() on unknown column "${d}"`);return}k.set(p,g)}remove(d){return this.#p||d<0||d>=this.#s||this.#a.get(d)===1?!1:(this.#a.set(d),this.#l++,this.#o--,!0)}live(d){return d<0||d>=this.#s?!1:this.#a.get(d)===0}compact(d={}){if(this.#p||this.#l===0||!d.force&&this.#l/this.#s<this.#h)return null;const p=this.#s,g=new Uint32Array(p);let k=0;for(let w=0;w<p;w++)g[w]=this.#a.get(w)===1?f:k++;for(const w of this.#n)w.compact(g,p,k);if(this.#u){const w=this.#r;for(let E=0;E<p;E++)g[E]!==f&&(w[g[E]]=w[E]);w.length=k}return this.#s=k,this.#o=k,this.#l=0,this.#a=new I(Math.max(this.#i,k)),g}column(d){return this.#t.get(d)}columns(){return this.#n.slice()}liveIndices(){const d=new Uint32Array(this.#o);if(this.#l===0){for(let g=0;g<this.#s;g++)d[g]=g;return d}let p=0;for(let g=0;g<this.#s;g++)this.#a.get(g)===0&&(d[p++]=g);return d}convert(d,p){const g=this.#t.get(d);return g?g.convert(p):!1}destroy(){if(!this.#p){this.#p=!0;for(const d of this.#n)d.release();this.#t.clear(),this.#n.length=0,this.#r.length=0,this.#a.release(),this.#s=0,this.#o=0,this.#l=0,this.#i=0}}#m(d){if(d<=this.#i)return;let p=this.#i||this.#d;for(;p<d;)p*=2;for(const g of this.#n)g.grow(p);this.#a.grow(p),this.#i=p}#g(d){const p={};for(const g of this.#n)p[g.id]=g.get(d);return p}#b(){if(this.#c)return;let d=this.#d;for(;d<this.#s;)d*=2;this.#c=!0,this.#i=d,this.#a.grow(d);for(const p of this.#n)p.columnarise(d,this.#s)}}}),De("packages/core/src/store/pool.js",function(e,U){"use strict";Object.defineProperty(e,"MaskPool",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"sharedPool",{enumerable:!0,get:function(){return D}});const te=64,M=8;function X(K){let I=te;for(;I<K;)I*=2;return I}class B{#e=new Map;#t=new WeakSet;#n;#r=0;#s={acquired:0,reused:0,released:0};constructor(I={}){this.#n=I.limit??M}get bytes(){return this.#r}mask(I){const G=new Uint8Array(this.#i(I),0,I);return G.fill(0),G}indices(I){return new Uint32Array(this.#i(I*4),0,I)}release(I){if(!I||!I.buffer)return!1;const G=I.buffer;if(!this.#t.has(G))return!1;this.#t.delete(G),this.#s.released++;const H=G.byteLength;let S=this.#e.get(H);return S||this.#e.set(H,S=[]),S.length>=this.#n||(S.push(G),this.#r+=H),!0}releaseAll(I){for(const G of I)this.release(G)}clear(){this.#e.clear(),this.#r=0}stats(){return{...this.#s,retained:this.#r}}#i(I){const G=X(I),H=this.#e.get(G);this.#s.acquired++;let S;return H&&H.length?(S=H.pop(),this.#r-=G,this.#s.reused++):S=new ArrayBuffer(G),this.#t.add(S),S}}function D(){return Z??=new B,Z}let Z=null}),De("packages/core/src/compute/sortspec.js",function(e,U){"use strict";Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return D}});function te(Z){return{locale:Z===void 0?void 0:String(Z),numeric:!0,sensitivity:"variant"}}function M(Z){return!!Z&&typeof Z.compare!="function"}function X(Z){if(!Z)return!0;for(let K=0;K<Z.length;K++)if(!M(Z[K]))return!1;return!0}function B(Z,K){const I=Z.col!==void 0?Z.col:Z.handle&&Z.handle.id,G=Z.locale!==void 0?Z.locale:K;return{col:I,descending:Z.descending!==void 0?!!Z.descending:Z.dir==="desc",nullsFirst:!!Z.nullsFirst,collation:te(G)}}function D(Z,K){const I=Z||[],G=new Array(I.length);for(let H=0;H<I.length;H++)G[H]=B(I[H],K);return G}}),De("packages/core/src/compute/facet.js",function(e,U){"use strict";Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"orderedReader",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"toNumeric",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return p}});const te=U("packages/core/src/compute/handle.js"),M=te.presenceReader,X=te.valueReader,B=te.dictSize,D=te.dictValue,Z=Object.freeze(["equal","quantile","log"]),K=Object.freeze(["hour","day","week","month","quarter","year"]),I=20,G=50,H=1e4;function S(g,k){if(!g)return"none";const w=k;if(w&&(w.multi===!0||typeof w.items=="function"))return"category";const E=k&&k.base;if(E==="date"||E==="datetime"||E==="time"||E==="dateString")return"date";switch(g.kind){case"bitset":return"boolean";case"float64":case"int32":return"numeric";case"dictionary":return"category";case"multi":return"category";default:return E==="number"?"numeric":E==="boolean"?"boolean":E==="text"?"category":"none"}}function O(g){const k=g.values,w=g.kind;if((w==="float64"||w==="int32")&&k)return N=>k[N];const E=X(g);return N=>b(E(N))}function b(g){if(typeof g=="number")return g;if(g instanceof Date)return g.getTime();if(g==null||g==="")return NaN;if(typeof g=="boolean")return g?1:0;if(typeof g=="string"){const k=Number(g);if(Number.isFinite(k))return k;const w=Date.parse(g);return Number.isFinite(w)?w:NaN}return NaN}function c(g,k,w,E=G){if(!g)return{cardinality:0,exact:!0};if(g.dict)return{cardinality:B(g.dict),exact:!0};if(g.kind==="bitset")return{cardinality:2,exact:!0};const N=X(g),x=k?k.length:w,_=new Set;for(let F=0;F<x;F++){const L=N(k?k[F]:F);if(L!=null&&(_.add(L),_.size>E))return{cardinality:_.size,exact:!1}}return{cardinality:_.size,exact:!0}}const f=36e5,o=864e5;function n(g,k=I){const w=Number.isFinite(g)&&g>0?g:0,E=Math.max(1,k)*2;return w/f<=E?"hour":w/o<=E?"day":w/(7*o)<=E?"week":w/(30*o)<=E?"month":w/(91*o)<=E?"quarter":"year"}function t(g,k){if(!Number.isFinite(g))return NaN;const w=new Date(g);switch(k){case"hour":return w.setMinutes(0,0,0),w.getTime();case"day":return w.setHours(0,0,0,0),w.getTime();case"week":{w.setHours(0,0,0,0);const E=(w.getDay()+6)%7;return w.setDate(w.getDate()-E),w.getTime()}case"month":return w.setDate(1),w.setHours(0,0,0,0),w.getTime();case"quarter":return w.setMonth(Math.floor(w.getMonth()/3)*3,1),w.setHours(0,0,0,0),w.getTime();default:return w.setMonth(0,1),w.setHours(0,0,0,0),w.getTime()}}function i(g,k){const w=new Date(g);switch(k){case"hour":w.setHours(w.getHours()+1);break;case"day":w.setDate(w.getDate()+1);break;case"week":w.setDate(w.getDate()+7);break;case"month":w.setMonth(w.getMonth()+1);break;case"quarter":w.setMonth(w.getMonth()+3);break;default:w.setFullYear(w.getFullYear()+1);break}return w.getTime()}function s(g,k,w){const E=O(g),N=M(g),x=k?k.length:w;let _=1/0,F=-1/0,L=0,j=0;for(let R=0;R<x;R++){const $=k?k[R]:R;if(N&&!N($)){L++;continue}const T=E($);if(!Number.isFinite(T)){L++;continue}T<_&&(_=T),T>F&&(F=T),j++}return{min:_,max:F,nulls:L,finite:j}}function r(g,k,w,E){const N=O(g),x=M(g),_=k?k.length:w,F=_>E?_/E:1,L=[];for(let R=0;R<_;R+=F){const $=k?k[Math.floor(R)]:Math.floor(R);if(x&&!x($))continue;const T=N($);Number.isFinite(T)&&L.push(T)}const j=Float64Array.from(L);return j.sort(),j}function u(g,k,w,E={}){const N=E.kind||S(g,E.type);return N==="none"||!g?{kind:"none",buckets:[],suppressed:"type"}:N==="boolean"?a(g,k,w):N==="category"?l(g,k,w,E):h(g,k,w,N,E)}function a(g,k,w){const E=M(g);let N=0;if(E){const _=k?k.length:w;for(let F=0;F<_;F++)E(k?k[F]:F)||N++}const x=[{value:!1,label:"false"},{value:!0,label:"true"}];return N>0&&x.push({null:!0,label:"Empty"}),{kind:"boolean",buckets:x}}function l(g,k,w,E){const N=E.cardinalityLimit??G,{cardinality:x}=c(g,k,w,N);if(x>N&&(E.aboveLimit||"suppress")==="suppress")return{kind:"category",buckets:[],suppressed:"cardinality",cardinality:x};const _=X(g),F=k?k.length:w,L=new Map;let j=0;for(let C=0;C<F;C++){const z=_(k?k[C]:C);if(z==null||z===""){j++;continue}if(Array.isArray(z)){if(!z.length){j++;continue}for(const Y of z)L.set(Y,(L.get(Y)||0)+1);continue}L.set(z,(L.get(z)||0)+1)}let R=[...L.entries()];E.order==="alpha"?R.sort((C,z)=>String(C[0]).localeCompare(String(z[0]))):R.sort((C,z)=>z[1]-C[1]);let $=0,T=0;if(R.length>N){T=R.length-N;for(let C=N;C<R.length;C++)$+=R[C][1];R=R.slice(0,N)}const A=R.map(([C])=>({value:C,label:String(C)}));return $>0&&A.push({remainder:!0,label:`Other (${T} values)`}),j>0&&A.push({null:!0,label:"Empty"}),{kind:"category",buckets:A,cardinality:x}}function h(g,k,w,E,N){const{min:x,max:_,nulls:F,finite:L}=s(g,k,w);if(!L)return{kind:E,buckets:F?[{null:!0,label:"Empty"}]:[],empty:!0};const j=Math.max(1,Math.floor(N.buckets||I));let R=[];if(E==="date"){const T=K.includes(N.granularity)?N.granularity:n(_-x,j);let A=t(x,T);for(;A<=_&&R.length<4096;){const C=i(A,T);if(!(C>A))break;R.push({from:A,to:C}),A=C}return{kind:E,buckets:y(R,F),granularity:T}}const $=Z.includes(N.strategy)?N.strategy:"equal";if($==="quantile"){const T=r(g,k,w,H);if(T.length){const A=[T[0]];for(let C=1;C<j;C++){const z=T[Math.min(T.length-1,Math.floor(C/j*T.length))];z>A[A.length-1]&&A.push(z)}A.push(_);for(let C=0;C<A.length-1;C++)R.push({from:A[C],to:A[C+1]})}}else if($==="log"&&x>0){const T=Math.log10(x),C=(Math.log10(_)-T)/j||1;for(let z=0;z<j;z++)R.push({from:10**(T+z*C),to:10**(T+(z+1)*C)})}if(!R.length){const T=(_-x)/j||1;for(let A=0;A<j;A++)R.push({from:x+A*T,to:x+(A+1)*T})}return R[R.length-1].to=_,{kind:E,buckets:y(R,F),strategy:$,min:x,max:_}}function y(g,k){return k>0?[...g,{null:!0,label:"Empty"}]:g}function m(g,k,w,E,N){const x=E&&E.buckets||[],_=N&&N.length>=x.length?N.subarray(0,x.length):new Uint32Array(x.length);if(_.fill(0),!g||!x.length)return _;const F=x.length-1,L=!!x[F]&&x[F].null===!0,j=k?k.length:w;if(E.kind==="boolean"){const C=X(g);for(let z=0;z<j;z++){const Y=C(k?k[z]:z);if(Y==null){L&&_[F]++;continue}_[Y?1:0]++}return _}if(E.kind==="category"){const C=new Map;for(let q=0;q<x.length;q++)!x[q].null&&!x[q].remainder&&C.set(x[q].value,q);const z=x.findIndex(q=>q.remainder),Y=X(g);for(let q=0;q<j;q++){const V=Y(k?k[q]:q);if(V==null||V===""){L&&_[F]++;continue}if(Array.isArray(V)){if(!V.length){L&&_[F]++;continue}for(const ee of V){const ne=C.get(ee);ne!==void 0?_[ne]++:z>=0&&_[z]++}continue}const J=C.get(V);J!==void 0?_[J]++:z>=0&&_[z]++}return _}const R=L?x.length-1:x.length,$=new Float64Array(R+1);for(let C=0;C<R;C++)$[C]=x[C].from;$[R]=R?x[R-1].to:0;const T=O(g),A=M(g);for(let C=0;C<j;C++){const z=k?k[C]:C;if(A&&!A(z)){L&&_[F]++;continue}const Y=T(z);if(!Number.isFinite(Y)){L&&_[F]++;continue}const q=v($,R,Y);q>=0&&_[q]++}return _}function v(g,k,w){if(!k||w<g[0])return-1;if(w>=g[k])return w===g[k]?k-1:-1;let E=0,N=k-1;for(;E<N;){const x=E+N+1>>>1;w>=g[x]?E=x:N=x-1}return E}function d(g,k,w,E={}){const N=E.bounds||u(g,E.boundsIndices??k,w,E);return{bounds:N,counts:m(g,k,w,N)}}const p=d}),De("packages/core/src/compute/pivotmatrix.js",function(e,U){"use strict";Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return t}});const M=U("packages/core/src/compute/handle.js").valueComparator,B=U("packages/core/src/compute/total.js").total,Z=U("packages/core/src/compute/group.js").packKeys,K=U("packages/core/src/compute/pivot.js"),I=K.joinPath,G=K.DEFAULT_PATH_SEPARATOR,H=K.DEFAULT_MAX_COLUMNS,S="";function O(i,s,r={}){const u=r.separator||G,a=i||[],l=s instanceof Uint32Array?s:Uint32Array.from(s||[]),h=l.length;if(a.length===0)return{tuples:[[]],paths:[S],buckets:[l]};const{keyOf:y,readers:m}=Z(a,l,0),v=new Map,d=[],p=[],g=[];for(let _=0;_<h;_++){const F=l[_],L=y(F);let j=v.get(L);if(j===void 0){j=d.length,v.set(L,j),p.push(L);const R=new Array(m.length);for(let $=0;$<m.length;$++)R[$]=m[$](F);d.push(R),g.push([])}g[j].push(F)}const k=M(r.locale),w=d.map((_,F)=>F);w.sort((_,F)=>{const L=d[_],j=d[F];for(let R=0;R<L.length;R++){const $=b(L[R],j[R],k);if($!==0)return $}return _-F});const E=new Array(w.length),N=new Array(w.length),x=new Array(w.length);for(let _=0;_<w.length;_++){const F=w[_];E[_]=d[F],N[_]=I(d[F],u),x[_]=Uint32Array.from(g[F])}return{tuples:E,paths:N,buckets:x}}function b(i,s,r){const u=i==null,a=s==null;return u||a?u&&a?0:u?1:-1:r(i,s)}function c(i,s,r){const u=[];for(let a=0;a<i.length;a++)r.has(i[a])&&u.push(i[a]);return Uint32Array.from(u)}function f(i,s,r,u){return{value:s.length?B(i,s,r,u):null,leaves:s,count:s.length}}function o(i){const s=i&&i.opts||{},r=s.separator||G,u=s.totalContext||{locale:s.locale},a=(i.measures||[]).filter(N=>N&&N.handle),l=i.leaves instanceof Uint32Array?i.leaves:Uint32Array.from(i.leaves||[]),h=O(i.rowHandles||[],l,{...s,separator:r}),y=O(i.columnHandles||[],l,{...s,separator:r}),m=s.maxColumns===void 0?H:s.maxColumns,v=y.paths.length*Math.max(1,a.length),d=new Map;if(m&&v>m)return{rowAxis:h,columnAxis:y,measures:a.map(N=>({colId:N.colId,fn:N.fn})),body:d,rowMargin:d,columnMargin:d,grand:d,columns:v,error:{code:"pivot-max-columns",message:`[lattice] pivot would generate ${v} columns, above pivot.maxColumns of ${m}. Narrow the pivot columns or raise the limit.`,columns:v,maxColumns:m}};const p=new Map,g=new Map,k=new Map,w=new Map,E=y.buckets.map(N=>new Set(N));for(let N=0;N<y.paths.length;N++){const x=y.buckets[N],_=y.paths[N];for(const F of a)k.set(t(_,F.colId),f(F.handle,x,F.fn,u))}for(let N=0;N<h.paths.length;N++){const x=h.buckets[N],_=h.paths[N];for(const F of a)g.set(t(_,F.colId),f(F.handle,x,F.fn,u));for(let F=0;F<y.paths.length;F++){const L=c(x,y.buckets[F],E[F]);if(L.length===0)continue;const j=y.paths[F];for(const R of a)p.set(n(_,j,R.colId),f(R.handle,L,R.fn,u))}}for(const N of a)w.set(N.colId,f(N.handle,l,N.fn,u));return{rowAxis:h,columnAxis:y,measures:a.map(N=>({colId:N.colId,fn:N.fn})),body:p,rowMargin:g,columnMargin:k,grand:w,columns:v,error:null}}function n(i,s,r){return`${i}\0${s}\0${r}`}function t(i,s){return`${i}\0${s}`}}),De("packages/core/src/compute/reference.js",function(e,U){"use strict";Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return o}});const M=U("packages/core/src/internal/paths.js").getPath,X=U("packages/core/src/compute/handle.js"),B=X.isMissing,D=X.valueComparator,K=U("packages/core/src/compute/filter.js").testValue,I="",G="\0";function H(i,s){const r=s.includes(".")?M(i,s):i?.[s];return r===void 0?null:r}function S(i,s,r={}){const u=s||[];let a=i.map((l,h)=>h);if(u.length===0)return a;for(let l=u.length-1;l>=0;l--)a=O(i,a,u[l],r);return a}function O(i,s,r,u){const a=r.locale!==void 0?r.locale:u.locale,l=D(a),h=r.descending!==void 0?!!r.descending:r.dir==="desc",y=[],m=[];for(const p of s){const g=H(i[p],r.col);B(g)?m.push(p):y.push(p)}const v=new Map;for(let p=0;p<y.length;p++)v.set(y[p],p);const d=(p,g)=>{const k=H(i[p],r.col),w=H(i[g],r.col);let E;return typeof r.compare=="function"?(E=r.compare(k,w,i[p],i[g],h),h&&(E=-E)):E=h?l(w,k):l(k,w),E!==0?E:v.get(p)-v.get(g)};return y.sort(d),r.nullsFirst?m.concat(y):y.concat(m)}function b(i,s,r={}){const u=[];for(let a=0;a<i.length;a++)c(i[a],s,r,a)&&u.push(a);return u}function c(i,s,r,u){if(!s)return!0;if(Array.isArray(s.conditions)){const a=s.conditions.filter(h=>h!=null);if(a.length===0)return!0;if(s.op==="or")return a.some(h=>c(i,h,r,u));const l=a.every(h=>c(i,h,r,u));return s.op==="not"?!l:l}return s.col===void 0&&typeof r.custom=="function"?!!r.custom(s,i,u):K(H(i,s.col),s,r.locale)}function f(i,s,r,u){const a=r||i.map((m,v)=>v),l=new Map,h=[],y=[];for(const m of a){const v=s.map((g,k)=>{const w=H(i[m],g);return u&&u[k]?u[k](w):w}),d=v.map(g=>g==null?G:String(g)).join(I);let p=l.get(d);p===void 0&&(p=h.length,l.set(d,p),h.push(v),y.push([])),y[p].push(m)}return{keys:h,buckets:y}}function o(i,s,r={}){const u=D(r.locale),a=i.filter(h=>!B(h)),l=a.map(n).filter(h=>h!==null);switch(s){case"count":return i.length;case"countValues":return a.length;case"sum":return l.reduce((h,y)=>h+y,0);case"avg":return a.length===0?null:l.reduce((h,y)=>h+y,0)/a.length;case"min":return a.length===0?null:a.reduce((h,y)=>u(y,h)<0?y:h);case"max":return a.length===0?null:a.reduce((h,y)=>u(y,h)>0?y:h);case"first":return i.length===0?null:t(i[0]);case"last":return i.length===0?null:t(i[i.length-1]);default:return null}}function n(i){if(typeof i=="number")return Number.isNaN(i)?null:i;if(i==null||i===""||typeof i=="boolean")return null;if(i instanceof Date)return i.getTime();const s=Number(i);return Number.isNaN(s)?null:s}function t(i){return i===void 0?null:i}}),De("packages/core/src/compute/index.js",function(e,U){"use strict";const te=U("packages/core/src/compute/sort.js");Object.defineProperty(e,"sortColumn",{enumerable:!0,get:function(){return te.sortColumn}}),Object.defineProperty(e,"sortMulti",{enumerable:!0,get:function(){return te.sortMulti}}),Object.defineProperty(e,"radixSortFloat64",{enumerable:!0,get:function(){return te.radixSortFloat64}}),Object.defineProperty(e,"radixSortInt32",{enumerable:!0,get:function(){return te.radixSortInt32}}),Object.defineProperty(e,"rankSortDictionary",{enumerable:!0,get:function(){return te.rankSortDictionary}}),Object.defineProperty(e,"mergeSortComparator",{enumerable:!0,get:function(){return te.mergeSortComparator}}),Object.defineProperty(e,"collateStringRanks",{enumerable:!0,get:function(){return te.collateStringRanks}}),Object.defineProperty(e,"rankSortStrings",{enumerable:!0,get:function(){return te.rankSortStrings}});const M=U("packages/core/src/compute/sortspec.js");Object.defineProperty(e,"collationDescriptor",{enumerable:!0,get:function(){return M.collationDescriptor}}),Object.defineProperty(e,"isPortableSort",{enumerable:!0,get:function(){return M.isPortableSort}}),Object.defineProperty(e,"isPortableSortSet",{enumerable:!0,get:function(){return M.isPortableSortSet}}),Object.defineProperty(e,"describeSortEntry",{enumerable:!0,get:function(){return M.describeSortEntry}}),Object.defineProperty(e,"describeSort",{enumerable:!0,get:function(){return M.describeSort}});const X=U("packages/core/src/compute/filter.js");Object.defineProperty(e,"evaluateFilters",{enumerable:!0,get:function(){return X.evaluateFilters}}),Object.defineProperty(e,"evaluateCondition",{enumerable:!0,get:function(){return X.evaluateCondition}}),Object.defineProperty(e,"compact",{enumerable:!0,get:function(){return X.compact}}),Object.defineProperty(e,"testValue",{enumerable:!0,get:function(){return X.testValue}}),Object.defineProperty(e,"compilePredicate",{enumerable:!0,get:function(){return X.compilePredicate}}),Object.defineProperty(e,"releaseMask",{enumerable:!0,get:function(){return X.releaseMask}}),Object.defineProperty(e,"pruneColumn",{enumerable:!0,get:function(){return X.pruneColumn}}),Object.defineProperty(e,"mentionsColumn",{enumerable:!0,get:function(){return X.mentionsColumn}});const B=U("packages/core/src/compute/group.js");Object.defineProperty(e,"groupByColumns",{enumerable:!0,get:function(){return B.groupByColumns}}),Object.defineProperty(e,"packKeys",{enumerable:!0,get:function(){return B.packKeys}});const D=U("packages/core/src/compute/facet.js");Object.defineProperty(e,"facet",{enumerable:!0,get:function(){return D.facet}}),Object.defineProperty(e,"computeBounds",{enumerable:!0,get:function(){return D.computeBounds}}),Object.defineProperty(e,"countInto",{enumerable:!0,get:function(){return D.countInto}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return D.bucketOf}}),Object.defineProperty(e,"facetKind",{enumerable:!0,get:function(){return D.facetKind}}),Object.defineProperty(e,"cardinalityOf",{enumerable:!0,get:function(){return D.cardinalityOf}}),Object.defineProperty(e,"pickGranularity",{enumerable:!0,get:function(){return D.pickGranularity}}),Object.defineProperty(e,"floorTo",{enumerable:!0,get:function(){return D.floorTo}}),Object.defineProperty(e,"advance",{enumerable:!0,get:function(){return D.advance}}),Object.defineProperty(e,"STRATEGIES",{enumerable:!0,get:function(){return D.STRATEGIES}}),Object.defineProperty(e,"GRANULARITIES",{enumerable:!0,get:function(){return D.GRANULARITIES}}),Object.defineProperty(e,"DEFAULT_BUCKETS",{enumerable:!0,get:function(){return D.DEFAULT_BUCKETS}}),Object.defineProperty(e,"DEFAULT_CARDINALITY_LIMIT",{enumerable:!0,get:function(){return D.DEFAULT_CARDINALITY_LIMIT}}),Object.defineProperty(e,"QUANTILE_SAMPLE",{enumerable:!0,get:function(){return D.QUANTILE_SAMPLE}});const Z=U("packages/core/src/compute/total.js");Object.defineProperty(e,"TOTAL_FNS",{enumerable:!0,get:function(){return Z.TOTAL_FNS}}),Object.defineProperty(e,"TOTAL_LABELS",{enumerable:!0,get:function(){return Z.TOTAL_LABELS}}),Object.defineProperty(e,"totalLabel",{enumerable:!0,get:function(){return Z.totalLabel}}),Object.defineProperty(e,"total",{enumerable:!0,get:function(){return Z.total}}),Object.defineProperty(e,"collectValues",{enumerable:!0,get:function(){return Z.collectValues}});const K=U("packages/core/src/compute/pivot.js");Object.defineProperty(e,"pivot",{enumerable:!0,get:function(){return K.pivot}}),Object.defineProperty(e,"resolvePivotKeys",{enumerable:!0,get:function(){return K.resolvePivotKeys}}),Object.defineProperty(e,"pivotKey",{enumerable:!0,get:function(){return K.pivotKey}}),Object.defineProperty(e,"joinPath",{enumerable:!0,get:function(){return K.joinPath}}),Object.defineProperty(e,"KEY_DELIMITER",{enumerable:!0,get:function(){return K.KEY_DELIMITER}}),Object.defineProperty(e,"DEFAULT_PATH_SEPARATOR",{enumerable:!0,get:function(){return K.DEFAULT_PATH_SEPARATOR}}),Object.defineProperty(e,"DEFAULT_MAX_COLUMNS",{enumerable:!0,get:function(){return K.DEFAULT_MAX_COLUMNS}});const I=U("packages/core/src/compute/pivotmatrix.js");Object.defineProperty(e,"pivotMatrix",{enumerable:!0,get:function(){return I.pivotMatrix}}),Object.defineProperty(e,"resolveAxis",{enumerable:!0,get:function(){return I.resolveAxis}}),Object.defineProperty(e,"cellKey",{enumerable:!0,get:function(){return I.cellKey}}),Object.defineProperty(e,"marginKey",{enumerable:!0,get:function(){return I.marginKey}}),Object.defineProperty(e,"GRAND_PATH",{enumerable:!0,get:function(){return I.GRAND_PATH}});const G=U("packages/core/src/compute/reference.js");Object.defineProperty(e,"referenceSort",{enumerable:!0,get:function(){return G.referenceSort}}),Object.defineProperty(e,"referenceFilter",{enumerable:!0,get:function(){return G.referenceFilter}}),Object.defineProperty(e,"referenceGroup",{enumerable:!0,get:function(){return G.referenceGroup}}),Object.defineProperty(e,"referenceTotal",{enumerable:!0,get:function(){return G.referenceTotal}}),Object.defineProperty(e,"referencePasses",{enumerable:!0,get:function(){return G.referencePasses}}),Object.defineProperty(e,"referenceValue",{enumerable:!0,get:function(){return G.referenceValue}});const H=U("packages/core/src/compute/handle.js");Object.defineProperty(e,"identity",{enumerable:!0,get:function(){return H.identity}}),Object.defineProperty(e,"rowCount",{enumerable:!0,get:function(){return H.rowCount}}),Object.defineProperty(e,"presenceReader",{enumerable:!0,get:function(){return H.presenceReader}}),Object.defineProperty(e,"bitReader",{enumerable:!0,get:function(){return H.bitReader}}),Object.defineProperty(e,"valueReader",{enumerable:!0,get:function(){return H.valueReader}}),Object.defineProperty(e,"valueComparator",{enumerable:!0,get:function(){return H.valueComparator}}),Object.defineProperty(e,"numericTotalOrder",{enumerable:!0,get:function(){return H.numericTotalOrder}}),Object.defineProperty(e,"dictRanks",{enumerable:!0,get:function(){return H.dictRanks}}),Object.defineProperty(e,"dictSize",{enumerable:!0,get:function(){return H.dictSize}}),Object.defineProperty(e,"dictValue",{enumerable:!0,get:function(){return H.dictValue}}),Object.defineProperty(e,"multiValue",{enumerable:!0,get:function(){return H.multiValue}}),Object.defineProperty(e,"isMissing",{enumerable:!0,get:function(){return H.isMissing}});const S=U("packages/core/src/compute/sketch.js");Object.defineProperty(e,"Welford",{enumerable:!0,get:function(){return S.Welford}}),Object.defineProperty(e,"Reservoir",{enumerable:!0,get:function(){return S.Reservoir}}),Object.defineProperty(e,"HyperLogLog",{enumerable:!0,get:function(){return S.HyperLogLog}}),Object.defineProperty(e,"SpaceSaving",{enumerable:!0,get:function(){return S.SpaceSaving}}),Object.defineProperty(e,"KLL",{enumerable:!0,get:function(){return S.KLL}}),Object.defineProperty(e,"hash32",{enumerable:!0,get:function(){return S.hash32}}),Object.defineProperty(e,"SKETCH_BOUNDS",{enumerable:!0,get:function(){return S.SKETCH_BOUNDS}});const O=U("packages/core/src/compute/windowed.js");Object.defineProperty(e,"Window",{enumerable:!0,get:function(){return O.Window}}),Object.defineProperty(e,"WINDOW_KINDS",{enumerable:!0,get:function(){return O.WINDOW_KINDS}}),Object.defineProperty(e,"openWindow",{enumerable:!0,get:function(){return O.openWindow}});const b=U("packages/core/src/compute/statistics.js");Object.defineProperty(e,"MAINTENANCE",{enumerable:!0,get:function(){return b.MAINTENANCE}}),Object.defineProperty(e,"APPROXIMATE",{enumerable:!0,get:function(){return b.APPROXIMATE}}),Object.defineProperty(e,"maintenanceOf",{enumerable:!0,get:function(){return b.maintenanceOf}});const c=U("packages/core/src/compute/anomaly.js");Object.defineProperty(e,"ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ANOMALY_METHODS}}),Object.defineProperty(e,"modifiedZScores",{enumerable:!0,get:function(){return c.modifiedZScores}}),Object.defineProperty(e,"iqrFences",{enumerable:!0,get:function(){return c.iqrFences}}),Object.defineProperty(e,"mahalanobis",{enumerable:!0,get:function(){return c.mahalanobis}}),Object.defineProperty(e,"ROLLING_ANOMALY_METHODS",{enumerable:!0,get:function(){return c.ROLLING_ANOMALY_METHODS}}),Object.defineProperty(e,"rollingAnomalies",{enumerable:!0,get:function(){return c.rollingAnomalies}}),Object.defineProperty(e,"anomalyCondition",{enumerable:!0,get:function(){return c.anomalyCondition}});const f=U("packages/core/src/compute/forecast.js");Object.defineProperty(e,"FORECAST_METHODS",{enumerable:!0,get:function(){return f.FORECAST_METHODS}}),Object.defineProperty(e,"forecast",{enumerable:!0,get:function(){return f.forecast}})}),De("packages/core/src/source/rows.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_ROW_HEIGHT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"KEY_SEP",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"createRowFactory",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"RowFactory",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"pinnedRow",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"lazyRowView",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"groupPathElement",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"groupKey",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"groupPrefixKeys",{enumerable:!0,get:function(){return f}});const M=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/internal/predicates.js").isFunction,D=32,Z="\0";function K(o){return new I(o)}class I{#e;#t;constructor(n){this.#e=B(n&&n.rowKey)?n.rowKey:null;const t=n&&n.config?n.config.rowHeight:void 0;this.#t=typeof t=="number"||B(t)?t:D}get keyed(){return this.#e!==null}keyOf(n,t){if(this.#e){const i=this.#e(n);if(i!=null)return String(i)}else M("source.rowKey.missing","no config.rowKey; falling back to index identity.","Row changes, streaming dedupe, selection persistence and remote reload are disabled.");return`#${t}`}heightOf(n){return B(this.#t)?Number(this.#t(n))||D:this.#t}leaf(n,t,i=0,s=null){const r={key:this.keyOf(n,t),data:n,level:i,parent:s,group:!1,expanded:!1,leafCount:1,height:0,index:null,selected:!1,physical:t};return r.height=this.heightOf(r),r}group(n){const t={key:c(n.keyPath||n.path),data:null,level:n.level,parent:n.parent||null,children:[],group:!0,expanded:n.expanded!==!1,leafCount:n.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:n.column,groupValue:n.value,groupPath:n.path,hasChildren:n.hasChildren!==!1};return n.totals&&(t.totals=n.totals),t.height=this.heightOf(t),t}footer(n){const t={key:`${n.key}${Z}footer`,data:null,level:n.level,parent:n,group:!0,footer:!0,expanded:!1,leafCount:n.leafCount||0,height:0,index:null,selected:!1,physical:null,groupColumn:n.groupColumn,groupValue:n.groupValue,groupPath:n.groupPath,hasChildren:!1,totals:n.totals};return t.height=this.heightOf(t),t}detail(n,t){return{key:`${n.key}${Z}detail`,data:n.data,level:n.level+1,parent:n,group:!1,detail:!0,expanded:!1,leafCount:0,height:t,index:null,selected:!1,physical:null,hasChildren:!1,masterKey:n.key}}grandTotal(n,t){const i={key:`${Z}grandTotal`,data:null,level:0,parent:null,group:!0,grandTotal:!0,expanded:!1,leafCount:t,height:0,index:null,selected:!1,physical:null,groupPath:[],hasChildren:!1,totals:n};return i.height=this.heightOf(i),i}skeleton(n,t=0,i=!1){const s={key:`${Z}pending${Z}${n}`,data:null,level:t,parent:null,group:!1,expanded:!1,leafCount:1,height:0,index:n,selected:!1,physical:null,pending:!0};return i&&(s.loadError=!0),s.height=this.heightOf(s),s}}function G(o,n,t,i){return{key:`${Z}pinned${Z}${t}${Z}${n}`,data:o,level:0,parent:null,group:!1,expanded:!1,leafCount:0,height:i,index:null,selected:!1,physical:null,hasChildren:!1,pinned:t}}function H(o,n){return new Proxy([],{get(t,i,s){if(i==="length")return o();if(typeof i=="string"){const r=Number(i);if(Number.isInteger(r)&&r>=0)return n(r)}return Reflect.get(t,i,s)},has(t,i){if(typeof i=="string"){const s=Number(i);if(Number.isInteger(s)&&s>=0)return s<o()}return Reflect.has(t,i)}})}function S(o){return o==null?"":String(o)}const O="";function b(o){if(o==null)return O;const n=String(o);return n.startsWith(O)?O+n:n}function c(o){const n=o||[];let t="g";for(let i=0;i<n.length;i++)t+=Z+b(n[i]);return t}function f(o){const n=new Array(o.length),t=[];for(let i=0;i<o.length;i++)t.push(o[i]),n[i]=c(t);return n}}),De("packages/core/src/source/handles.js",function(e,U){"use strict";Object.defineProperty(e,"HandleProvider",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"createHandleProvider",{enumerable:!0,get:function(){return Z}});const M=U("packages/core/src/internal/predicates.js").isFunction,B=U("packages/core/src/internal/warn.js").warnOnce;class D{#e;#t;#n;#r=new Map;#s=0;constructor(I,G,H){this.#e=I,this.#t=G,this.#n=M(H)?H:()=>!1}get store(){const I=this.#e.store;return I&&M(I.column)?I:null}invalidate(){this.#s++}handle(I){const G=this.store;if(G){const b=G.column(I);if(b)return b}const H=this.#r.get(I);if(H&&H.builtAt===this.#s)return H.handle;const S=this.#i(I);if(!S)return;if(G&&this.#n()){B(`source.dropped.${I}`,`column "${I}" cannot be served under ingest.dropSourceRows: it is an impure computed column (a shadow or a positional/rank column) that is never stored, so it can only be read from the caller's row objects — which dropSourceRows has released. Do not sort, filter, group or total on such a column with dropSourceRows enabled.`);return}const O=this.#o(S);return this.#r.set(I,{handle:O,builtAt:this.#s}),O}#i(I){const G=this.#e.columns;return G&&M(G.get)?G.get(I):void 0}#o(I){const G=this.#t()||[],H=G.length,S=new Array(H),O=M(I.getValue)?c=>I.getValue(c):c=>c?.[I.field||I.id];for(let c=0;c<H;c++)S[c]=G[c]===void 0?void 0:O(G[c]);const b=this.#s;return{id:I.id,kind:"object",nullable:!1,values:S,presence:null,dict:null,offsets:null,get(c){return S[c]},version:b}}}function Z(K,I,G){return new D(K,I,G)}}),De("packages/core/src/compute/incremental.js",function(e,U){"use strict";Object.defineProperty(e,"INCREMENTAL_FNS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"INCREMENTAL_KINDS",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"MAGNITUDE_LIMIT",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"isIncremental",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"RunningTotal",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return G}});const M=U("packages/core/src/store/columnstore.js").toFloat,X=Object.freeze(["sum","avg","countValues","min","max"]),B=Object.freeze(["float64"]),D=1e15;function Z(H,S){return typeof H!="string"||!X.includes(H)?!1:!!S&&B.includes(S.kind)}function K(H){if(H==null)return null;const S=M(H);return Number.isNaN(S)?null:S}class I{#e;#t=0;#n=0;#r=0;#s=1/0;#i=-1/0;#o=!1;#l=!1;constructor(S){this.#e=S}get valid(){return this.#o&&!this.#l}get fn(){return this.#e}seed(S){this.#a();for(let O=0;O<S.length;O++){const b=K(S[O]);b!==null&&this.#c(b)}this.#o=!0}seedColumn(S,O,b){this.#a();for(let c=0;c<b.length;c++){const f=b[c];if(O&&O(f)===0)continue;const o=S[f];Number.isNaN(o)||this.#c(o)}this.#o=!0}#a(){this.#t=0,this.#n=0,this.#r=0,this.#s=1/0,this.#i=-1/0,this.#l=!1}#c(S){if(!Number.isFinite(S)){this.#l=!0;return}const O=this.#t+S;this.#n+=Math.abs(this.#t)>=Math.abs(S)?this.#t-O+S:S-O+this.#t,this.#t=O,this.#r++,S<this.#s&&(this.#s=S),S>this.#i&&(this.#i=S)}#u(S){const O=this.#t-S;this.#n+=Math.abs(this.#t)>=Math.abs(S)?this.#t-O-S:-S-O+this.#t,this.#t=O,this.#r--}update(S,O){if(!this.#o)return!1;const b=K(S),c=K(O);return b===null&&c===null?!0:b!==null&&!Number.isFinite(b)||c!==null&&!Number.isFinite(c)?!1:this.#e==="min"||this.#e==="max"?b===null||c===null?!1:this.#e==="min"?c<this.#s?(this.#s=c,!0):b>this.#s:c>this.#i?(this.#i=c,!0):b<this.#i:Math.abs(this.#t)>D?!1:(b!==null&&this.#u(b),c!==null&&this.#c(c),!0)}value(){switch(this.#e){case"countValues":return this.#r;case"avg":return this.#r?(this.#t+this.#n)/this.#r:null;case"min":return this.#r?this.#s:null;case"max":return this.#r?this.#i:null;default:return this.#t+this.#n}}invalidate(){this.#o=!1}}const G=I}),De("packages/core/src/source/filterwire.js",function(e,U){"use strict";Object.defineProperty(e,"HOST_FILTER_WARN_ID",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"WHERE_PAGE_RELATIVE_WARN_ID",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"warnWherePageRelative",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"warnHostFilterNotApplied",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"WHERE_NOT_APPLIED_WARN_ID",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"warnWhereNotApplied",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"WHERE_OVER_THRESHOLD_WARN_ID",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"warnWhereOverThreshold",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"RELATIVE_TOKENS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"parseRelativeToken",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveRelativeRange",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"relativeTokenOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"relativeTokenHelp",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"isResolvableRelative",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"resolveRelativeCondition",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"isGroup",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"forEachCondition",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"mapConditions",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"normaliseFilterSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"buildFilterSet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"wireFilters",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"querySignature",{enumerable:!0,get:function(){return k}});const M=U("packages/core/src/internal/warn.js").warnOnce,X="source.remote.hostFilter",B="source.where.pageRelative";function D(N,x){!Array.isArray(N)||!N.length||M(B,`filters.where (${N.join(", ")}) runs over the rows the ${x} source fetched,`,"not the whole dataset: match counts and totals are page-relative.","Give the predicate a { condition } twin so the engine can narrow the fetch itself.")}function Z(N){const x=(N||{}).config;!x||!x.hostFilter||M(X,"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 K="source.where.notApplied";function I(N,x){M(`${K}:${N}`,`filters.where("${N}") is registered but the ${x} 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 G="source.where.overThreshold";function H(N,x,_,F){!Array.isArray(N)||!N.length||M(`${G}:${x}`,`filters.where (${N.join(", ")}) is not applied to the ${x} pushdown source:`,_===null?"the adapter reports no row total, so the size of the matching set is unknown.":`its matching set is ${_.toLocaleString()} rows, at or past the whereRowLimit of ${F.toLocaleString()}.`,"Running the predicate needs every matching row fetched and held here, which is the whole","download a pushdown source exists to avoid, so it is refused and the rows the predicate","would exclude stay on screen.","Give the predicate a { condition } twin so the engine narrows the fetch itself — that is the","route that works at any size — or raise `whereRowLimit` on the source config if you want the","download.")}const S=new Map;function O(N){let x=S.get(N);return x||(x=new Intl.DateTimeFormat("en-US",{timeZone:N,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),S.set(N,x)),x}function b(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function c(N,x){const _=O(x).formatToParts(new Date(N)),F={y:1970,m:1,d:1,h:0,mi:0,s:0};for(const L of _)L.type==="year"?F.y=+L.value:L.type==="month"?F.m=+L.value:L.type==="day"?F.d=+L.value:L.type==="hour"?F.h=+L.value%24:L.type==="minute"?F.mi=+L.value:L.type==="second"&&(F.s=+L.value);return F}function f(N,x){const _=c(N,x);return Date.UTC(_.y,_.m-1,_.d,_.h,_.mi,_.s)-Math.floor(N/1e3)*1e3}function o(N,x,_,F){const L=Date.UTC(N,x-1,_),j=L-f(L,F);return L-f(j,F)}function n(N,x,_){const F=new Date(Date.UTC(N.y,N.m-1,N.d+x));return o(F.getUTCFullYear(),F.getUTCMonth()+1,F.getUTCDate(),_)}const t=Object.freeze(["today","yesterday","lastNDays","thisWeek","thisMonth","thisQuarter","thisYear","quarterToDate","yearToDate"]);function i(N,x){if(typeof N!="string")return null;const _=N.trim().toLowerCase().replace(/[\s_-]+/g,""),F=/^last(\d*|n)days?$/.exec(_);if(F){const L=F[1]==="n"?"":F[1],j=Number(L||x);return!Number.isFinite(j)||j<=0?null:{kind:"lastNDays",n:Math.floor(j)}}switch(_){case"today":return{kind:"today",n:0};case"yesterday":return{kind:"yesterday",n:0};case"thisweek":return{kind:"thisWeek",n:0};case"thismonth":return{kind:"thisMonth",n:0};case"thisquarter":return{kind:"thisQuarter",n:0};case"thisyear":return{kind:"thisYear",n:0};case"quartertodate":case"qtd":return{kind:"quarterToDate",n:0};case"yeartodate":case"ytd":return{kind:"yearToDate",n:0};default:return null}}function s(N,x={}){const _=i(N,x.n);if(!_)return null;const F=x.tz||b(),L=x.now instanceof Date?x.now.getTime():typeof x.now=="number"?x.now:Date.now(),j=c(L,F),R=o(j.y,j.m,j.d,F),$=n(j,1,F);let T=R,A=$;switch(_.kind){case"today":break;case"yesterday":T=n(j,-1,F),A=R;break;case"lastNDays":A=x.includeToday?$:R,T=n(j,x.includeToday?-(_.n-1):-_.n,F);break;case"thisWeek":{const C=Number.isFinite(x.weekStartsOn)?Number(x.weekStartsOn):1,Y=(new Date(Date.UTC(j.y,j.m-1,j.d)).getUTCDay()-C+7)%7;T=n(j,-Y,F),A=n(j,-Y+7,F);break}case"thisMonth":T=o(j.y,j.m,1,F),A=o(j.m===12?j.y+1:j.y,j.m===12?1:j.m+1,1,F);break;case"thisQuarter":case"quarterToDate":{const C=Math.floor((j.m-1)/3)*3+1;T=o(j.y,C,1,F),A=_.kind==="quarterToDate"?$:C===10?o(j.y+1,1,1,F):o(j.y,C+3,1,F);break}case"thisYear":case"yearToDate":T=o(j.y,1,1,F),A=_.kind==="yearToDate"?$:o(j.y+1,1,1,F);break;default:return null}return{from:new Date(T).toISOString(),to:new Date(A).toISOString(),bounds:"[)",tz:F,relative:_.kind==="lastNDays"?`last${_.n}Days`:_.kind,n:_.n}}function r(N){if(!N||typeof N!="object")return null;const x=N.value;if(x&&typeof x=="object"&&!Array.isArray(x)&&"relative"in x)return{token:String(x.relative),n:typeof x.n=="number"?x.n:void 0};if(N.op==="relative"&&typeof N.value=="string")return{token:N.value,n:void 0};const _=N.meta;return _&&typeof _.relative=="string"&&N.value===void 0?{token:_.relative,n:typeof _.n=="number"?_.n:void 0}:null}function u(){return`Known tokens: ${t.filter(x=>x!=="lastNDays").join(", ")}. "lastNDays" needs a count: pass "last7Days", or the value object { relative: 'lastNDays', n: 7 }.`}function a(N){const x=r(N);return x?i(x.token,x.n)!==null:!1}function l(N,x={}){const _=r(N);if(!_)return N;const F=s(_.token,{...x,n:_.n});return F?{...N,type:N.type||"date",op:"between",value:[F.from,F.to],bounds:N.bounds||F.bounds,meta:{...N.meta||{},relative:F.relative,tz:F.tz}}:(M(`source.relative.${_.token}`,`unknown relative date token "${_.token}"; sending the condition unresolved.`,u()),N)}function h(N){return!!N&&typeof N=="object"&&Array.isArray(N.conditions)}function y(N,x){if(N){if(h(N)){for(const _ of N.conditions)y(_,x);return}x(N)}}function m(N,x){if(!N)return null;if(!h(N))return x(N);const _=N;let F=!1;const L=[];for(const j of _.conditions){const R=m(j,x);R!==j&&(F=!0),R&&L.push(R)}return!F&&L.length===_.conditions.length?N:L.length?{..._,conditions:L}:null}function v(N){if(!N)return null;if(!h(N))return N;const x=N,_=[];for(const F of x.conditions){const L=v(F);L&&_.push(L)}return _.length?{op:x.op,conditions:_}:null}function d(N){const x=v(N);return x?h(x)&&x.op==="and"?x:{op:"and",conditions:[x]}:null}function p(N){const x=(N||[]).filter(Boolean);return x.length?{op:"and",conditions:x}:null}function g(N,x={}){const _=m(N,F=>l(F,x));return d(_)}function k(N){const x=w(N.filters??null);return JSON.stringify([x,N.sort??null,N.quick??"",N.groupBy??null,N.pivotBy??null,E(N.context)])}function w(N){if(!N)return null;if(h(N)){const F=N;return{op:F.op,conditions:F.conditions.map(w)}}const x=N,_=x.meta&&typeof x.meta.relative=="string"?x.meta.relative:r(x)?.token;return{col:x.col,op:x.op,bounds:x.bounds??null,caseSensitive:x.caseSensitive??!1,value:_?`rel:${_}`:x.value??null}}function E(N){if(N==null)return null;try{return JSON.parse(JSON.stringify(N))}catch{return M("source.context.unserialisable","config.context is not JSON-serialisable; cache keys ignore it."),"[unserialisable]"}}}),De("packages/core/src/source/tree.js",function(e,U){"use strict";Object.defineProperty(e,"SYNTHETIC",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"buildFromPath",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"buildFromParentKey",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"assignLevels",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"resolveTree",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"buildTree",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"indexTree",{enumerable:!0,get:function(){return c}});const M=U("packages/core/src/internal/predicates.js").isFunction,B=U("packages/core/src/internal/warn.js").warnOnce,D="",Z="\0tree:";function K(f,o){return{physical:f,key:o,level:0,children:[],value:void 0}}function I(f,o){const n=[],t=new Map;for(let i=0;i<f.length;i++){const s=f[i],r=o.pathOf(s),u=Array.isArray(r)?r.map(l=>String(l)):[];if(!u.length){const l=K(s,o.keyOf(s));n.push(l);continue}let a=null;for(let l=0;l<u.length;l++){const h=u.slice(0,l+1).join(D),y=l===u.length-1;let m=t.get(h);m&&y&&m.physical===-1&&(m.physical=s,m.key=o.keyOf(s)),m||(m=K(y?s:-1,y?o.keyOf(s):Z+h),m.level=l,m.value=u[l],t.set(h,m),a?a.children.push(m):n.push(m)),a=m}}return{roots:n,nodes:t}}function G(f,o){const n=new Map,t=[];for(let u=0;u<f.length;u++){const a=f[u],l=o.keyOf(a),h=K(a,l);n.set(l,h);const y=o.parentOf(a);y!=null&&y!==""&&t.push({node:h,parent:String(y)})}let i=null;const s=new Map;for(const{node:u,parent:a}of t){const l=n.get(a);if(l){s.set(u.key,l);continue}o.orphans&&o.orphans!=="root"&&(i||(i=K(-1,`${Z}orphans`),i.value=o.orphans),s.set(u.key,i))}const r=[];for(const u of n.values()){const a=s.get(u.key);a?a.children.push(u):r.push(u)}return i&&i.children.length&&r.push(i),{roots:H(r,n,o.orphans,i),nodes:n}}function H(f,o,n,t){const i=new Set,s=[...f];for(;s.length;){const h=s.pop();if(!i.has(h.key)){i.add(h.key);for(const y of h.children)s.push(y)}}const r=[];for(const h of o.values())i.has(h.key)||r.push(h);if(!r.length)return f;const u=!!n&&n!=="root";B("tree.cycle",`tree.parentKey produced ${r.length} row(s) inside a parent cycle; `+(u?`they are shown under "${n}".`:"they are shown at the root."));for(const h of r)h.children=h.children.filter(y=>i.has(y.key));if(!u)return[...f,...r];let a=t;const l=[...f];return a||(a=K(-1,`${Z}orphans`),a.value=n,l.push(a)),a.children.push(...r),l}function S(f){let o=0;const n=(t,i)=>{for(const s of t)s.level=i,i>o&&(o=i),s.children.length&&n(s.children,i+1)};return n(f,0),o}function O(f,o){if(!f||typeof f!="object")return null;const n=f.path,t=f.parentKey,i=M(f.hasChildren)?s=>!!f.hasChildren(o.dataAt(s)):null;if(M(n))return{mode:"path",pathOf:s=>n(o.dataAt(s)),keyOf:o.keyOf,declaresChildren:i};if(t!=null){const s=M(t)?t:r=>r?.[t];return{mode:"parentKey",parentOf:r=>s(o.dataAt(r)),keyOf:o.keyOf,orphans:f.orphans||"root",declaresChildren:i}}return B("tree.shape","tree is configured with neither `path` nor `parentKey`; rows stay flat."),null}function b(f,o){const n=o.mode==="path"?I(f,o):G(f,o),t=S(n.roots);return{...n,depth:t}}function c(f,o){const n=new Map,t=i=>{for(let s=0;s<i.length;s++){const r=i[s];if(r.physical>=0){const u=o?o(r.physical):!1,a=u&&r.children.length===0;n.set(r.physical,{level:r.level,posinset:s+1,setsize:i.length,hasChildren:r.children.length>0||u,lazy:a})}r.children.length&&t(r.children)}};return t(f),n}}),De("packages/core/src/source/settle.js",function(e,U){"use strict";Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return M}});const te=Object.freeze(["pipeline:sort","pipeline:sort:error"]);function M(X){const B=X&&typeof X=="object"?X.reason:null;return typeof B=="string"&&te.includes(B)}}),De("packages/core/src/source/memory.js",function(e,U){"use strict";Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"PIPELINE_SETTLE_REASONS",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"isPipelineSettle",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"createMemorySource",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"quickMatcher",{enumerable:!0,get:function(){return z}}),Object.defineProperty(e,"MemorySource",{enumerable:!0,get:function(){return Y}});const M=U("packages/core/src/internal/lru.js").Lru,X=U("packages/core/src/internal/warn.js"),B=X.warnOnce,D=X.fail,K=U("packages/core/src/internal/predicates.js").isFunction,G=U("packages/core/src/internal/compare.js").defaultCompare,S=U("packages/core/src/internal/merge.js").mergeRow,O=U("packages/core/src/source/rows.js"),b=O.createRowFactory,c=O.groupKey,f=O.groupPathElement,o=O.groupPrefixKeys,n=O.lazyRowView,i=U("packages/core/src/source/handles.js").createHandleProvider,s=U("packages/core/src/compute/incremental.js"),r=s.RunningTotal,u=s.isIncremental,l=U("packages/core/src/compute/handle.js").presenceReader,h=U("packages/core/src/source/filterwire.js"),y=h.querySignature,m=h.mapConditions,v=h.resolveRelativeCondition,d=U("packages/core/src/source/tree.js"),p=d.buildTree,g=d.resolveTree,k=d.indexTree,w=U("packages/core/src/source/settle.js"),E=w.PIPELINE_SETTLE_REASONS,N=w.isPipelineSettle,x=Object.freeze(["filter","sort","group","total","pivot","flatten"]),_=Object.freeze([]);function F(q,V){if(!q)return null;const J=V==="grand"?q.grandTotal:q.groupTotal;return J??q.total}function L(q){return!!q&&!q.running}function j(q){if(q)return q.value&&K(q.value.compare)?q.value.compare:K(q.compare)?q.compare:void 0}function R(q){const V=q&&q.dataType;return!V||!K(V.items)?null:{items:V.items,type:q.itemType&&q.itemType.name||"text"}}function $(q){return!!q&&(typeof q=="object"||typeof q=="function")&&K(q.then)}const T=new Uint32Array(0),A=4096;function C(q,V){return new Y(q,V)}function z(q,V){if(V==="regex")try{const J=new RegExp(q,"iu");return ee=>J.test(ee)}catch{return J=>J.includes(q)}if(V==="fuzzy"){const J=[...q].filter(ee=>ee!==" ");return J.length?ee=>{let ne=0;for(let oe=0;oe<ee.length&&ne<J.length;oe++)ee[oe]===J[ne]&&ne++;return ne===J.length}:()=>!0}if(V==="words"){const J=q.split(/\s+/).filter(Boolean);return J.length?ee=>J.every(ne=>ee.includes(ne)):()=>!0}return J=>J.includes(q)}class Y{mode="memory";#e;#t;#n;#r=!1;#s=null;#i;#o;#l=new Map;#a=!1;#c=0;#u=0;#f=new Map;#d=new Map;#h;#p=null;#m=Y.#g();static#g(){return{slots:[],groupHeadings:_,unnumbered:_,pivot:null,inlineLeaves:null,matchCount:0,grand:null,grandLeaves:0,groupLeaves:null}}#b=new Map;#y=null;#j=new Map;#w=-1;#O=[];#v=new Map;#T=-1;#S=[];#E=null;#N=null;#P=null;#M=null;#R=null;#L=null;#G=null;#_=null;#x=Symbol("unset");#I=new Map;#Y=null;get#D(){return this.#m.slots}set#D(V){this.#m.slots=V}get#K(){return this.#m.inlineLeaves}set#K(V){this.#m.inlineLeaves=V}get#H(){return this.#m.groupHeadings}set#H(V){this.#m.groupHeadings=V}get#B(){return this.#m.unnumbered}set#B(V){this.#m.unnumbered=V}get#fe(){return this.#m.pivot}set#fe(V){this.#m.pivot=V}constructor(V,J){this.#t=V||{mode:"memory"},this.#e=J||{};const ee=this.#e.config||{};this.#n=this.#t.rows||ee.rows||[],this.#i=b(this.#e),this.#o=i(this.#e,()=>this.#n,()=>this.#r),this.#h=new M(Number(ee.rowCacheSize)||A);for(const ne of x)this.#l.set(ne,{key:null,result:null,id:0,computed:!1})}count(){this.#F();const V=this.#pe();return V?V.length:this.#D.length}#pe(){const V=Number(this.#z("pageSize",0))||0;if(V<=0)return null;const J=this.#D.length,ee=Math.max(1,Math.ceil(J/V)),oe=Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1)*V;return{offset:oe,length:Math.max(0,Math.min(V,J-oe))}}pageInfo(){this.#F();const V=Number(this.#z("pageSize",0))||0,J=this.#D.length;if(V<=0)return{page:0,pageSize:0,total:J,pageCount:1};const ee=Math.max(1,Math.ceil(J/V));return{page:Math.min(Math.max(0,Number(this.#z("page",0))||0),ee-1),pageSize:V,total:J,pageCount:ee}}totalCount(){return this.#Ke().length}matchCount(){return this.#F(),this.#m.matchCount}at(V){this.#F();const J=this.#pe();if(J)return V<0||V>=J.length?void 0:this.#Ne(J.offset+V,V);if(!(V<0||V>=this.#D.length))return this.#Ne(V,V)}byKey(V){this.#F(),this.#p||this.#Ce();const J=this.#p.get(V);if(J!==void 0)return this.#ee(J);for(let ee=0;ee<this.#D.length;ee++){const ne=this.#D[ee];if(typeof ne!="number"&&ne&&ne.key===V)return this.#Ne(ee)}}loaded(V){return V>=0&&V<this.count()}hint(V,J){}display(){return this.#F(),this.#Y||(this.#Y=this.#ct()),this.#Y}invalidateQuickText(){this.#I.clear(),this.invalidate("filter")}invalidate(V){const J=x.indexOf(V);J<0&&D(`unknown pipeline stage "${V}"; expected one of ${x.join(", ")}`);for(let ee=J;ee<x.length;ee++){const ne=this.#l.get(x[ee]);ne.key=null,ne.computed=!1}this.#Y=null}apply(V){const J=[],ee={added:[],updated:[],removed:[],rejected:J};if(!V)return ee;let ne=!1;const oe=new Set;if(V.remove&&V.remove.length)for(const re of V.remove){const ae=this.#Pe(re);if(ae===void 0){J.push({operation:"remove",id:this.#be(re),reason:"unknown-id"});continue}ee.removed.push(this.#i.keyOf(this.#r?this.#ue(ae):this.#n[ae],ae)),this.#r||(this.#n[ae]=void 0),this.#h.delete(ae),this.#I.delete(ae),ne=!0}if(V.update&&V.update.length){const re=this.#j.size||this.#Ze()?this.#it():null,ae=this.#v.size?this.#lt():null,fe=ae&&ae.length?this.#it():null;for(const de of V.update){const ve=this.#Pe(de);if(ve===void 0){J.push({operation:"update",id:this.#Ae(de),reason:"unknown-id"});continue}const Ie=this.#r?this.#s&&this.#s.has(ve)?this.#s.get(ve):this.#ue(ve):this.#n[ve],Le=S(Ie,de);for(const se of this.#re(Ie,Le))oe.add(se);if(this.#r||(this.#n[ve]=Le),re&&this.#ht(re,ve,Ie,Le),fe&&this.#wt(ae,fe,ve,Ie,Le),this.#p){const se=this.#i.keyOf(Ie,ve),pe=this.#i.keyOf(Le,ve);se!==pe&&(this.#p.delete(se),this.#p.set(pe,ve))}this.#h.delete(ve),this.#I.delete(ve),ee.updated.push(this.#ee(ve))}}if(V.add&&V.add.length&&this.#r){typeof V.at=="number"&&V.at<this.#xe()&&(this.#h.clear(),this.#I.clear()),this.#p=null;for(const re of V.add){const ae=this.#ne(this.#Ae(re));ae!==void 0&&ee.added.push(this.#ee(ae))}ne=!0}else if(V.add&&V.add.length){const re=typeof V.at=="number"?V.at:this.#n.length,ae=this.#n.length;let fe=V.add===this.#n?V.add.slice():V.add;if(this.#i.keyed){const de=[];for(const ve of fe){const Ie=this.#Ae(ve);if(this.#Pe(Ie)!==void 0){J.push({operation:"add",id:Ie,reason:"duplicate-id"});continue}de.push(ve)}de.length!==fe.length&&(fe=de)}if(!fe.length)return ee;if(re>=ae)for(let de=0;de<fe.length;de++)this.#n.push(fe[de]);else this.#n.splice(re,0,...fe),this.#h.clear(),this.#I.clear();for(let de=0;de<fe.length;de++)ee.added.push(this.#ee(re>=ae?ae+de:re+de));ne=!0}return this.#c++,ne&&(this.#p=null,this.#We()),this.#o.invalidate(),this.#Y=null,ne||this.#q(oe)?(this.#u++,this.invalidate("filter")):this.invalidate("total"),this.#Je("rows:changed",{companion:!0,added:ee.added.length,updated:ee.updated.length,removed:ee.removed.length}),this.#s=null,ee}groupHeadingsAt(V){this.#F();const J=this.#H;if(!J.length||!Number.isInteger(V)||V<0)return _;let ee=0,ne=J.length-1,oe=-1;for(;ee<=ne;){const ae=ee+ne>>1;J[ae].at<=V?(oe=ae,ee=ae+1):ne=ae-1}if(oe<0)return _;const re=[];for(let ae=J[oe].row;ae;ae=ae.parent)re.push(ae);return re.reverse(),re}unnumberedRowCount(V){this.#F();const J=this.#B;if(!J.length||!Number.isInteger(V)||V<0)return 0;let ee=0,ne=J.length-1,oe=-1;for(;ee<=ne;){const re=ee+ne>>1;J[re].at<=V?(oe=re,ee=re+1):ne=re-1}return oe+1}moveRow(V,J){if(this.#r)return B("source.moveRow.dropped","rows.move() is not supported under ingest.dropSourceRows: the source objects have been released and the store cannot reorder its columns in place. Enable retainSource (leave dropSourceRows off) to reorder rows."),!1;const ee=this.#n;if(!Number.isInteger(V)||!Number.isInteger(J)||V<0||V>=ee.length)return!1;const ne=Math.max(0,Math.min(ee.length-1,J));if(ne===V)return!1;const[oe]=ee.splice(V,1);return ee.splice(ne,0,oe),this.#c++,this.#u++,this.#p=null,this.#h.clear(),this.#I.clear(),this.#We(),this.#o.invalidate(),this.#Y=null,this.invalidate("filter"),this.#Je("rows:changed",{companion:!0,added:0,updated:0,removed:0,moved:1}),!0}reload(V){this.#ie(),this.#c++,this.#u++,this.#p=null,this.#I.clear(),this.#h.clear(),this.#We(),this.#o.invalidate(),this.invalidate("filter"),this.#Je("model:changed",{reason:"reload"})}destroy(){this.#ie(),this.#h.clear(),this.#I.clear(),this.#p=null,this.#D=[],this.#K=null,this.#Y=null,this.#We();for(const V of x)this.#l.set(V,{key:null,result:null,id:0,computed:!1})}#ie(){for(const{controller:V}of this.#b.values())try{V.abort()}catch{}this.#b.clear()}setRows(V){this.#n=V||[],this.#r=!1,this.#c++,this.#u++,this.#p=null,this.#I.clear(),this.#h.clear(),this.#We(),this.#o.invalidate(),this.invalidate("filter")}notePriorRows(V){this.#s=V||null}releaseSource(){this.#r=!0,this.#n=[],this.#p=null,this.#h.clear(),this.#I.clear(),this.#o.invalidate()}data(){if(!this.#r)return this.#n;const V=this.#e.store;if(!V||!K(V.source))return this.#n;const J=V.physical||0,ee=new Array(J);for(let ne=0;ne<J;ne++)ee[ne]=V.live&&!V.live(ne)?void 0:V.source(ne);return ee}#Be(){const V=this.#z("detail",null);return!V||!K(V.isOpen)||V.inline===!1?null:V}#Se(){const V=(this.#e.config||{}).tree;return this.#x!==V&&(this.#x=V,this.#_=g(V,{dataAt:J=>this.#ue(J),keyOf:J=>this.#i.keyOf(this.#ue(J),J)})),this.#_}#ge(){return(this.#e.config||{}).grandTotalRow==="bottom"}grandTotalRow(){if(!this.#ge())return null;this.#F();const V=this.#m.grand;return V?this.#i.grandTotal(V,this.#nt(this.#m.grandLeaves)):null}pivot(){return this.#F(),this.#fe}pivotMatrix(){this.#F();const V=this.#m.groupLeaves,J=(this.#e.compute||{}).pivotMatrix;if(!K(J))return null;const ee=this.#z("groupBy",[]),ne=this.#z("pivotBy",[]);if(!ee.length&&!ne.length)return B("pivotView.no-dimension","pivotView is on but the grid has no pivot dimension, so there is no matrix to draw. Put a column on the pivot (its `pivot` setting, or `pivotBy` in the query) for the columns across the top, and group by a column for the rows down the side."),null;const oe=this.#it().map(ae=>({colId:ae.id,handle:this.#o.handle(ae.id),fn:F(ae,"group")})).filter(ae=>ae.handle&&ae.fn),re=this.#e.config||{};return J({rowHandles:ee.map(ae=>this.#o.handle(ae)).filter(Boolean),columnHandles:ne.map(ae=>this.#o.handle(ae)).filter(Boolean),measures:oe,leaves:V||new Uint32Array(0),opts:{locale:re.locale,separator:(re.pivot||{}).separator,maxColumns:(re.pivot||{}).maxColumns}})}keysForLeaves(V){const J=[];if(!V)return J;for(let ee=0;ee<V.length;ee++){const ne=this.#ee(V[ee]);ne&&ne.key!=null&&J.push(String(ne.key))}return J}leavesOf(V){this.#F();const J=this.#l.get("group"),ee=J&&J.result;if(!ee||!ee.nodes)return[];const ne=ee.nodes.get(V);if(!ne)return[];const oe=[],re=ae=>{const fe=ae.row&&ae.row.children;if(fe&&fe.length){for(const de of fe){const ve=ee.nodes.get(de.key);ve&&re(ve)}return}if(ae.leaves)for(let de=0;de<ae.leaves.length;de++)oe.push(this.#ee(ae.leaves[de]))};return re(ne),oe}#be(V){return typeof V=="string"?V:this.#Ae(V)}#Ae(V){try{return this.#i.keyOf(V,-1)}catch{return"(unkeyed)"}}#Pe(V){if(typeof V=="string")return this.#ne(V);if(this.#i.keyed){const ee=this.#i.keyOf(V,-1),ne=this.#ne(ee);if(ne!==void 0)return ne}if(this.#r)return;const J=this.#n.indexOf(V);return J>=0?J:void 0}#ne(V){return this.#p||this.#Ce(),this.#p.get(V)}#Ce(){this.#p=new Map;const V=this.#xe(),J=this.#e.store,ee=J&&K(J.live)?ne=>J.live(ne):null;for(let ne=0;ne<V;ne++){if(ee&&!ee(ne))continue;const oe=this.#ue(ne);oe!==void 0&&this.#p.set(this.#i.keyOf(oe,ne),ne)}}#re(V,J){const ee=[];for(const ne of this.#V())this.#ze(ne)&&this.#J(ne,V,J,new Set)&&ee.push(ne);return ee}#J(V,J,ee,ne){if(ne.has(V))return!1;ne.add(V);const oe=this.#ze(V);if(!oe)return!1;const re=oe.value&&oe.value.deps;return Array.isArray(re)&&re.length?re.some(ae=>this.#J(String(ae),J,ee,ne)):K(oe.getValue)?!Object.is(oe.getValue(J),oe.getValue(ee)):!1}#V(){const V=new Set;for(const ee of this.#z("sort",[]))V.add(ee.col);for(const ee of this.#z("groupBy",[]))V.add(ee);const J=ee=>{if(ee){if(Array.isArray(ee.conditions)){ee.conditions.forEach(J);return}ee.col&&V.add(ee.col)}};return J(this.#z("filters",null)),[...V]}#q(V){if(!V.size)return!1;if(this.#z("quick",""))return!0;for(const J of this.#V())if(V.has(J))return!0;return!1}#F(){if(!this.#a){this.#a=!0;try{this.#Te()}finally{this.#a=!1}}}pipelineRunning(){return this.#a}#Te(){const V=this.#U("filter",()=>this.#W(),()=>this.#ve()),J=this.#X(V),ee=this.#U("group",()=>this.#de(),()=>this.#at(J)),ne=this.#U("total",()=>this.#he(),()=>this.#Ue(ee));this.#U("pivot",()=>this.#$e(),()=>this.#Rt(ee)),this.#U("flatten",()=>this.#Ie(),()=>this.#A(ee)),this.#Le(ee,ne)}#X(V){const J=this.#l.get("sort"),ee=this.#se();if(J.computed&&J.key===ee&&!this.#b.has("sort"))return J.result;const ne=this.#b.get("sort");return ne&&ne.key===ee?J.result:J.result&&this.#we(V)?(this.#Ee(V,ee),J.result):this.#U("sort",()=>ee,()=>this.#Me(V))}#oe(){if(this.#y===null){const V=this.#e.pipelineWorker,J=K(V)?V():null;this.#y=J||!1}return this.#y||null}#Oe(){const V=this.#z("sort",[]);if(!Array.isArray(V)||!V.length)return null;const J=(this.#e.config||{}).locale,ee=[],ne=[];for(const oe of V){const re=this.#ze(oe.col);if(re&&re.running)continue;if(re&&re.value&&K(re.value.compare))return null;const ae=this.#o.handle(oe.col);if(!ae)return null;ee.push({col:oe.col,descending:oe.dir==="desc",nullsFirst:!!oe.nullsFirst,locale:J}),ne.push(ae)}return ee.length?{entries:ee,handles:ne,locale:J}:null}#we(V){if(this.#me())return!1;const J=this.#oe();if(!J)return!1;const ee=Number(J.threshold);return Number.isFinite(ee)&&V.length<ee?!1:!!this.#Oe()}#Ee(V,J){const ee=this.#oe(),ne=ee&&this.#Oe();if(!ne){this.#U("sort",()=>J,()=>this.#Me(V));return}const oe=new AbortController;this.#b.set("sort",{key:J,controller:oe});const re=ne.entries.length===1?ee.sortColumn(ne.handles[0],V,{descending:ne.entries[0].descending,nullsFirst:ne.entries[0].nullsFirst,locale:ne.locale,signal:oe.signal,key:"sort"}):ee.sortMulti(ne.handles,ne.entries.map((ae,fe)=>({...ae,handle:ne.handles[fe]})),V,{signal:oe.signal,key:"sort"});if(!$(re)){this.#b.delete("sort"),this.#U("sort",()=>J,()=>re);return}re.then(ae=>this.#ae(J,ae),ae=>this.#ce("sort",J,ae))}#ae(V,J){const ee=this.#b.get("sort");if(!(!ee||ee.key!==V)){if(this.#se()!==V){this.#b.delete("sort");return}this.#b.delete("sort"),this.#U("sort",()=>V,()=>J),this.#Y=null,this.#F(),this.#Je("model:changed",{reason:E[0]})}}#ce(V,J,ee){const ne=this.#b.get(V);if(!(!ne||ne.key!==J)&&(this.#b.delete(V),!(ee&&ee.name==="AbortError")&&V==="sort"&&this.#se()===J)){const oe=this.#U("filter",()=>this.#W(),()=>this.#ve());this.#U("sort",()=>J,()=>this.#Me(oe)),this.#Y=null,this.#F(),B("source.pipeline.sort","off-thread sort failed; recomputed on the main thread.",ee),this.#Je("model:changed",{reason:E[1]})}}#Le(V,J){const ee=V&&V.leaves?V.leaves.length:this.#m.slots.length;this.#m.matchCount=ee,this.#m.grand=J&&J.grand||null,this.#m.grandLeaves=V&&V.leaves?V.leaves.length:0,this.#m.groupLeaves=V&&V.leaves?V.leaves:null}#U(V,J,ee){const ne=this.#l.get(V),oe=J();return ne.computed&&ne.key===oe||(ne.result=ee(),ne.key=oe,ne.computed=!0,ne.id++,V==="flatten"&&(this.#Y=null)),ne.result}#C(V){return this.#l.get(V).id}#W(){const V=(this.#e.config||{}).hostFilter,J=V&&K(V.active)&&V.active()?1:0,ee=this.#z("where",null),ne=ee?ee.version:0,oe=this.#st("filter.sig",`${this.#Qe()}`,()=>y({filters:this.#z("filters",null),quick:this.#z("quick",""),quickMode:this.#z("quickMode","contains")}));return`${this.#u}|${oe}|${J}|${ne}`}#se(){const V=this.#me();return`${this.#C("filter")}|${JSON.stringify(this.#z("sort",[]))}`+(V?`|manual:${V.version}`:"")}#me(){const V=this.#z("rowOrder",null);return V&&Array.isArray(V.keys)?V:null}#le(V,J){this.#p||this.#Ce();const ee=this.#p,ne=this.#xe(),oe=J.keys.length,re=new Float64Array(ne);for(let ae=0;ae<ne;ae++)re[ae]=oe+ae;for(let ae=0;ae<oe;ae++){const fe=ee.get(J.keys[ae]);fe!==void 0&&(re[fe]=ae)}return Uint32Array.from(V).sort((ae,fe)=>re[ae]-re[fe])}orderedKeys(){this.#p||this.#Ce();const V=this.#p,J=new Map;for(const[ae,fe]of V)J.set(fe,ae);const ee=Uint32Array.from([...J.keys()]).sort(),ne=this.#me(),oe=ne?this.#le(ee,ne):this.#Me(ee),re=new Array(oe.length);for(let ae=0;ae<oe.length;ae++)re[ae]=J.get(oe[ae]);return re}#de(){const V=this.#z("pivotBy",[]).length>0?"p":"u";return`${this.#C("sort")}|${JSON.stringify(this.#z("groupBy",[]))}|${V}`}#he(){const V=this.#Ge()?"f":"a",J=(this.#e.config||{}).totalOnlyChangedColumns?"n":"w";return`${this.#C("group")}|${JSON.stringify(this.#z("totals",[]))}|${V}${J}|${this.#c}`}#$e(){return`${this.#C("group")}|${JSON.stringify(this.#z("pivotBy",[]))}`}#Ie(){const J=this.#k()||!this.#ge()?this.#C("total"):"x",ee=`${this.#Qe()}`,ne=this.#st("flatten.keys",ee,()=>{const re=this.#z("expanded",null);return re?[...re].sort().join(""):"*"}),oe=this.#st("flatten.detail",ee,()=>{const re=this.#z("detail",null);return re&&K(re.signature)?re.signature():""});return`${J}|${this.#C("pivot")}|${ne}|${oe}`}#k(){const V=this.#z("groupBy",[]);return Array.isArray(V)&&V.length>0}stageState(){const V=[];for(const[J,ee]of this.#l){const ne=ee.result;V.push({stage:J,materialised:!!ee.computed,bytes:ne&&typeof ne.byteLength=="number"?ne.byteLength:null,rows:ne&&typeof ne.length=="number"?ne.length:null,rebuilds:ee.id})}return V}facetIndices(V){return this.#ve(V||null)}facetRows(V){const J=this.facetIndices(V),ee=[];for(let ne=0;ne<J.length;ne++){const oe=this.#ee(J[ne]);oe&&ee.push(oe)}return ee}invalidateRows(){this.#h.clear(),this.#I.clear(),this.#Y=null}invalidateHandles(){this.#o.invalidate()}rows(){return this.#n}unfilteredIndices(){return this.#Ke()}filteredIndices(){const V=this.#l.get("filter");if(V&&V.computed&&V.key===this.#W())return V.result||this.#Ke();this.#F();const J=this.#l.get("filter");return(J&&J.computed?J.result:null)||this.#Ke()}unfilteredRows(){const V=this.#Ke(),J=[];for(let ee=0;ee<V.length;ee++){const ne=this.#ee(V[ee]);ne&&J.push(ne)}return J}#ve(V=null){const J=this.#Ke(),ee=this.#z("filters",null),ne=V?this.#ot("pruneColumn")(ee,V):ee,oe=this.#kt(ne),re=String(this.#z("quick","")||"").trim().toLowerCase(),ae=re?z(re,String(this.#z("quickMode","contains")||"contains")):null,fe=(this.#e.config||{}).hostFilter,de=!!(fe&&K(fe.active)&&fe.active()),ve=this.#z("where",null),Ie=!!(ve&&ve.active);if(!oe&&!re&&!de&&!Ie)return J;let Le=null;oe&&(Le=this.#ot("evaluateFilters")(oe,{handle:ke=>this.#o.handle(ke),count:this.#xe(),pool:this.#e.pool,locale:(this.#e.config||{}).locale,itemwise:ke=>R(this.#ze(ke))}));const se=new Uint32Array(J.length);let pe=0;for(let be=0;be<J.length;be++){const ke=J[be];if(!(Le&&!Le[ke])&&!(ae&&!this.#vt(ke,ae))){if(de||Ie){const je=this.#ee(ke);if(de&&!fe.passes(je)||Ie&&!ve.passes(je.data,je.key))continue}se[pe++]=ke}}if(Le){const be=(this.#e.compute||{}).releaseMask;K(be)&&be({pool:this.#e.pool},Le)}return se.subarray(0,pe)}handleFor(V){return this.#o.handle(V)}#Me(V){const J=this.#me();if(J)return this.#le(V,J);const ee=this.#z("sort",[]).filter(re=>{const ae=this.#ze(re.col);return!ae||!ae.running?!0:(B(`source.sort.running.${re.col}`,`sort ignores "${re.col}": a running total is a function of the sort order, so it cannot also decide it. Sort by the column it runs over instead.`),!1)});if(!ee.length)return V;const ne=(this.#e.config||{}).locale;if(ee.length===1){const re=ee[0],ae=this.#o.handle(re.col);if(!ae)return B(`source.sort.${re.col}`,`sort ignores unknown column "${re.col}".`),V;const fe=this.#ze(re.col);return this.#ot("sortColumn")(ae,V,{descending:re.dir==="desc",nullsFirst:re.nullsFirst,locale:ne,compare:j(fe)})}const oe=[];for(const re of ee){const ae=this.#o.handle(re.col);if(!ae){B(`source.sort.${re.col}`,`sort ignores unknown column "${re.col}".`);continue}oe.push({handle:ae,descending:re.dir==="desc",nullsFirst:re.nullsFirst,locale:ne,compare:j(this.#ze(re.col))})}return oe.length?this.#ot("sortMulti")(oe.map(re=>re.handle),oe,V):V}#at(V){const J=this.#z("groupBy",[]),ee=this.#Se();if(ee&&!J.length){const be=p(V,ee);return this.#L=k(be.roots,ee.declaresChildren),{roots:null,leaves:V,nodes:new Map,tree:be}}if(this.#L=null,ee&&J.length&&B("tree.grouped","grouping is active on a grid configured with `tree`; the grouping wins and the hierarchy is not shown."),!J.length)return{roots:null,leaves:V,nodes:new Map};const ne=(this.#e.config||{}).timeZone,oe=[],re=[];let ae=!1;for(const be of J){const ke=this.#o.handle(be);if(!ke){B(`source.group.${be}`,`grouping ignores unknown column "${be}".`);continue}oe.push(ke);const je=this.#ze(be),xe=je&&je.dataType;if(xe&&K(xe.groupProjector)){const ge=je.typeOptions&&je.typeOptions.timeZone||ne||void 0,we=xe.groupProjector(je,ge);re.push(we||null),we&&(ae=!0)}else re.push(null)}if(!oe.length)return{roots:null,leaves:V,nodes:new Map};const{keys:fe,buckets:de}=this.#ot("groupByColumns")(oe,V,{locale:(this.#e.config||{}).locale,project:ae?re:void 0}),ve=this.#z("pivotBy",[]).length>0,Ie=[],Le=new Map;for(let be=0;be<de.length;be++){const ke=fe[be];let je=null;const xe=[];for(let ge=0;ge<ke.length;ge++){xe.push(f(ke[ge]));const we=c(xe),Me=ge===ke.length-1;let Ye=Le.get(we);if(!Ye){const Ae=this.#i.group({path:[...xe],column:J[ge],value:ke[ge],level:ge,parent:je,expanded:ve&&Me?!1:this.#ut(we,{key:we,column:J[ge],value:ke[ge],level:ge,path:[...xe]}),hasChildren:!(ve&&Me)});Ye={row:Ae,leaves:null},Le.set(we,Ye),je?je.children.push(Ae):Ie.push(Ae)}Ye.row.leafCount+=de[be].length,ge===ke.length-1&&(Ye.leaves=de[be]),je=Ye.row}}const se=this.#z("sort",[])||[],pe=(be,ke)=>{if(!be||be.length<2){if(be)for(const we of be)pe(we.children,ke+1);return}const je=J[ke],xe=se.find(we=>we.col===je),ge=xe&&xe.dir==="desc"?-1:1;be.sort((we,Me)=>ge*G(we.groupValue,Me.groupValue));for(const we of be)pe(we.children,ke+1)};return pe(Ie,0),{roots:Ie,leaves:V,nodes:Le,keys:fe,buckets:de}}#Ve(V,J){const ee=new Map,ne=new Map,oe=re=>{const ae=re.physical>=0?[re.physical]:[];for(const fe of re.children)ae.push(...oe(fe));if(re.children.length){const fe=this.#Ye(J,Uint32Array.from(ae),null);re.physical>=0?ee.set(re.physical,fe):ne.set(re.key,fe)}return ae};for(const re of V.roots)oe(re);return{byPhysical:ee,byKey:ne}}#Ue(V){const J=this.#it();if(!J.length)return this.#N=null,this.#P=null,{grand:null};const ee={id:this.#C("group"),columns:J.map(se=>se.id).join("")},ne=this.#N&&this.#N.id===ee.id&&this.#N.columns===ee.columns,oe=this.#Ze()&&ne?this.#E:null,re=oe?J.filter(se=>oe.has(se.id)):J,ae=ne?this.#P:null,fe=this.#Ge()?null:this.#Mt(),de=this.#ye(J),ve=se=>{const pe=V.nodes.get(se.key);let be=pe&&pe.leaves?pe.leaves:null;if(se.children&&se.children.length){const xe=se.children.map(ve);let ge=0;for(const Ye of xe)ge+=Ye.length;const we=new Uint32Array(ge);let Me=0;for(const Ye of xe)we.set(Ye,Me),Me+=Ye.length;be=we}be=be||new Uint32Array(0);const ke=fe?fe.get(se.key)||T:be,je=this.#bt(se,oe?re:J,ke,de);return se.totals=oe?{...se.totals,...je}:je,be};if(V.roots&&re.length)for(const se of V.roots)ve(se);if(this.#G=V.tree?this.#Ve(V.tree,J):null,this.#N=ee,this.#E=this.#Ze()?new Set:null,!(this.#e.config||{}).grandTotalRow)return this.#O.length=0,this.#P=null,{grand:null};const Le=fe?this.#rt():V.leaves;return this.#P=this.#Xe(J,Le,oe,ae),{grand:this.#P}}#Xe(V,J,ee,ne){const oe={},re=this.#C("group");re!==this.#w&&(this.#qe(),this.#w=re);const ae=this.#O;this.#O=[];for(const fe of V){if(!L(fe))continue;const de=this.#o.handle(fe.id);if(!de)continue;const ve=F(fe,"grand");if(!u(ve,de)){if(ee&&!ee.has(fe.id)&&ne&&fe.id in ne){oe[fe.id]=ne[fe.id];continue}oe[fe.id]=this.#Ye([fe],J,null,"grand")[fe.id];continue}let Ie=this.#j.get(fe.id);if((!Ie||Ie.fn!==ve)&&(Ie=new r(ve),this.#j.set(fe.id,Ie)),Ie.valid){let Le=!0;for(const se of ae)if(se.colId===fe.id&&!Ie.update(se.before,se.after)){Le=!1;break}if(Le){oe[fe.id]=Ie.value();continue}Ie.invalidate()}Ie.seedColumn(de.values,l(de),J),oe[fe.id]=Ie.valid?Ie.value():this.#Ye([fe],J,null,"grand")[fe.id]}return oe}#ye(V){const J=this.#C("group");J!==this.#T&&(this.#v.clear(),this.#T=J);const ee=new Map;for(const oe of V){if(!L(oe))continue;const re=this.#o.handle(oe.id),ae=F(oe,"group");u(ae,re)&&ee.set(oe.id,{fn:ae})}if(!ee.size)return this.#S.length=0,ee;const ne=this.#S;this.#S=[];for(const oe of ne){const{beforeKeys:re,afterKeys:ae,colDeltas:fe}=oe,de=re.length?new Set(re):null,ve=ae.length?new Set(ae):null;for(const{colId:Ie,before:Le,after:se}of fe)if(ee.has(Ie)){for(const pe of re)ve&&ve.has(pe)||this.#ke(pe,Ie,Le,null);for(const pe of ae)de&&de.has(pe)||this.#ke(pe,Ie,null,se);for(const pe of re)ve&&!ve.has(pe)||this.#ke(pe,Ie,Le,se)}}return ee}#ke(V,J,ee,ne){const oe=this.#v.get(V),re=oe&&oe.get(J);!re||!re.valid||re.update(ee,ne)||re.invalidate()}#bt(V,J,ee,ne){if(!ne||!ne.size)return this.#Ye(J,ee,V);const oe={};let re=null,ae=this.#v.get(V.key);for(const fe of J){const de=ne.get(fe.id);if(!de){(re||(re=[])).push(fe);continue}const ve=this.#o.handle(fe.id);if(!ve)continue;ae||(ae=new Map,this.#v.set(V.key,ae));let Ie=ae.get(fe.id);if((!Ie||Ie.fn!==de.fn)&&(Ie=new r(de.fn),ae.set(fe.id,Ie)),Ie.valid||Ie.seedColumn(ve.values,l(ve),ee),Ie.valid){oe[fe.id]=Ie.value();continue}(re||(re=[])).push(fe)}return re&&Object.assign(oe,this.#Ye(re,ee,V)),oe}#ht(V,J,ee,ne){const oe=!this.#Ge()||this.#te(J);for(const re of V){const ae=re.getValue;if(!K(ae))continue;const fe=ae(ee),de=ae(ne);Object.is(fe,de)||(this.#E&&this.#E.add(re.id),oe&&this.#j.has(re.id)&&this.#O.push({colId:re.id,before:fe,after:de}))}}#lt(){const V=this.#z("groupBy",[]),J=[];for(const ee of V){const ne=this.#ze(ee);ne&&J.push(ne)}return J}#yt(V,J){const ee=new Array(V.length);for(let ne=0;ne<V.length;ne++){const oe=V[ne].getValue;ee[ne]=f(K(oe)?oe(J):void 0)}return ee}#wt(V,J,ee,ne,oe){if(this.#Ge()&&!this.#te(ee))return;const re=o(this.#yt(V,ne)),ae=o(this.#yt(V,oe)),fe=re.length!==ae.length||re.some((ve,Ie)=>ve!==ae[Ie]),de=[];for(const ve of J){const Ie=ve.getValue;if(!K(Ie))continue;const Le=Ie(ne),se=Ie(oe);!fe&&Object.is(Le,se)||de.push({colId:ve.id,before:Le,after:se})}!de.length&&!fe||this.#S.push({beforeKeys:re,afterKeys:ae,colDeltas:de})}#te(V){const J=this.#l.get("filter"),ee=J&&J.computed?J.result:null;if(!ee)return!0;let ne=0,oe=ee.length-1;for(;ne<=oe;){const re=ne+oe>>1,ae=ee[re];if(ae===V)return!0;ae<V?ne=re+1:oe=re-1}return!1}#Ge(){return(this.#e.config||{}).totalFilteredOnly!==!1}#nt(V){return this.#Ge()?V:this.#rt().length}#rt(){return(!this.#M||this.#M.version!==this.#u)&&(this.#M={version:this.#u,indices:this.#Ke()}),this.#M.indices}#Mt(){const V=this.#z("groupBy",[]),J=`${this.#u}|${JSON.stringify(V)}`;if(this.#R&&this.#R.key===J)return this.#R.map;const ee=new Map,ne=[];for(const oe of V){const re=this.#o.handle(oe);re&&ne.push(re)}if(ne.length){const oe=this.#rt(),{keys:re,buckets:ae}=this.#ot("groupByColumns")(ne,oe,{locale:(this.#e.config||{}).locale}),fe=new Map;for(let de=0;de<ae.length;de++){const ve=re[de],Ie=[];for(let Le=0;Le<ve.length;Le++){Ie.push(f(ve[Le]));const se=c(Ie);let pe=fe.get(se);pe||(pe=[],fe.set(se,pe));for(let be=0;be<ae[de].length;be++)pe.push(ae[de][be])}}for(const[de,ve]of fe)ee.set(de,Uint32Array.from(ve))}return this.#R={key:J,map:ee},ee}#Ze(){return!!(this.#e.config||{}).totalOnlyChangedColumns}#We(){this.#qe(),this.#Nt(),this.#E=null,this.#N=null,this.#P=null}#qe(){this.#j.clear(),this.#O.length=0,this.#w=-1}#Nt(){this.#v.clear(),this.#S.length=0,this.#T=-1}#Rt(V){const J=this.#z("pivotBy",[]);if(!J.length)return this.#fe=null,null;const ee=(this.#e.compute||{}).pivot;if(!K(ee))return B("source.pivot.kernel","pivot requested but ctx.compute.pivot is not available; showing unpivoted rows."),this.#fe=null,null;const ne=J.map(re=>this.#o.handle(re)).filter(Boolean),oe=this.#it();return this.#fe=ee(ne,V.leaves,{groups:V.keys&&V.buckets?{keys:V.keys,buckets:V.buckets}:null,totals:oe.map(re=>re.id),handle:re=>this.#o.handle(re),totalOf:re=>F(oe.find(ae=>ae.id===re),"group"),separator:((this.#e.config||{}).pivot||{}).separator,maxColumns:((this.#e.config||{}).pivot||{}).maxColumns})||null,this.#fe}#A(V){const J=this.#l.get("total").result,ee=!!(this.#e.config||{}).groupFooter,ne=this.#Be();if(V.tree)return this.#He(V,J,ne);if(!V.roots&&!ne){if(J&&J.grand&&!this.#ge()){const ve=this.#i.grandTotal(J.grand,this.#nt(V.leaves.length));if(this.#K===V.leaves&&Array.isArray(this.#D))this.#D[this.#D.length-1]=ve;else{const Ie=Array.from(V.leaves);Ie.push(ve),this.#D=Ie,this.#K=V.leaves}this.#B=[{at:this.#D.length-1}]}else this.#K=null,this.#D=V.leaves,this.#B=_;return this.#H=_,this.#D}const oe=[],re=[],ae=[],fe=ve=>{if(oe.push(ve),!ne)return;const Ie=this.#ee(ve);!Ie||!ne.isOpen(Ie.key)||(Ie.master=!0,Ie.expanded=!0,ae.push({at:oe.length}),oe.push(this.#i.detail(Ie,ne.heightOf(Ie))))};if(!V.roots){for(let ve=0;ve<V.leaves.length;ve++)fe(V.leaves[ve]);return J&&J.grand&&!this.#ge()&&(ae.push({at:oe.length}),oe.push(this.#i.grandTotal(J.grand,this.#nt(V.leaves.length)))),this.#K=null,this.#H=_,this.#B=ae.length?ae:_,this.#D=oe,oe}const de=(ve,Ie,Le)=>{if(ve.expanded=ve.hasChildren===!1?!1:this.#ut(ve.key,{key:ve.key,column:ve.groupColumn,value:ve.groupValue,level:ve.level,path:ve.groupPath}),ve.posinset=Ie+1,ve.setsize=Le,re.push({at:oe.length,row:ve}),ae.push({at:oe.length}),oe.push(ve),!!ve.expanded){if(ve.children&&ve.children.length)for(let se=0;se<ve.children.length;se++)de(ve.children[se],se,ve.children.length);else{const se=V.nodes.get(ve.key),pe=se&&se.leaves?se.leaves:null;if(pe)for(let be=0;be<pe.length;be++)fe(pe[be])}ee&&ve.totals&&(ae.push({at:oe.length}),oe.push(this.#i.footer(ve)))}};for(let ve=0;ve<V.roots.length;ve++)de(V.roots[ve],ve,V.roots.length);return J&&J.grand&&!this.#ge()&&(ae.push({at:oe.length}),oe.push(this.#i.grandTotal(J.grand,this.#nt(V.leaves.length)))),this.#H=re,this.#B=ae,this.#D=oe,oe}#Ke(){const V=this.#e.store;if(V&&K(V.liveIndices))return V.liveIndices();const J=new Uint32Array(this.#n.length);let ee=0;for(let ne=0;ne<this.#n.length;ne++)this.#n[ne]!==void 0&&(J[ee++]=ne);return J.subarray(0,ee)}#xe(){const V=this.#e.store;return V&&typeof V.physical=="number"?V.physical:this.#n.length}#ue(V){const J=this.#e.store;return J&&K(J.source)?J.source(V):this.#n[V]}#Ne(V,J=V){const ee=this.#D[V];if(typeof ee!="number")return ee.index=J,ee;const ne=this.#ee(ee);return ne.index=J,ne}#ee(V){let J=this.#h.get(V);J||(J=this.#i.leaf(this.#ue(V),V),this.#h.set(V,J));const ee=this.#L?this.#L.get(V):null;if(ee){J.level=ee.level,J.posinset=ee.posinset,J.setsize=ee.setsize,J.hasChildren=ee.hasChildren,J.expanded=ee.hasChildren&&!ee.lazy&&this.#ut(J.key);const ne=this.#G?this.#G.byPhysical.get(V):void 0;ne?J.totals=ne:J.totals&&(J.totals=null)}else J.hasChildren&&(J.level=0,J.hasChildren=!1,J.expanded=!1,J.posinset=void 0,J.setsize=void 0);return J}#He(V,J,ee){const ne=[],oe=[],re=fe=>{if(fe.leafCount!==void 0)return fe.leafCount;let de=fe.physical>=0?1:0;for(const ve of fe.children)de+=re(ve);return fe.leafCount=de,de},ae=fe=>{const de=this.#ut(fe.key);if(fe.physical>=0){if(ne.push(fe.physical),ee&&ee.isOpen(this.#ee(fe.physical).key)){const ve=this.#ee(fe.physical);oe.push({at:ne.length}),ne.push(this.#i.detail(ve,ee.heightOf(ve)))}}else ne.push(this.#i.group({path:[fe.key],column:null,value:fe.value,level:fe.level,parent:null,expanded:de,hasChildren:fe.children.length>0,leafCount:re(fe),totals:this.#G?this.#G.byKey.get(fe.key):void 0}));if(de)for(const ve of fe.children)ae(ve)};for(const fe of V.tree.roots)ae(fe);return J&&J.grand&&!this.#ge()&&(oe.push({at:ne.length}),ne.push(this.#i.grandTotal(J.grand,this.#nt(V.leaves.length)))),this.#K=null,this.#H=_,this.#B=oe.length?oe:_,this.#D=ne,ne}#ct(){return n(()=>this.count(),V=>this.at(V))}#vt(V,J){let ee=this.#I.get(V);if(ee===void 0){const ne=this.#ue(V),oe=this.#St(),re=[],ae=this.#e.columnHidden;for(const fe of oe){if(fe.quickFilter===!1||K(ae)&&ae(fe.id))continue;const de=fe.value&&K(fe.value.quickFilterText)?fe.value.quickFilterText({value:void 0,data:ne,row:null,column:fe,colId:fe.id,grid:null,context:this.#z("context",null)}):null,ve=de??(K(fe.formatValue)?fe.formatValue(K(fe.getValue)?fe.getValue(ne):void 0):"");ve!=null&&ve!==""&&re.push(String(ve))}ee=re.join(" ").toLowerCase(),this.#I.set(V,ee)}return J(ee)}#it(){const V=this.#z("totals",[]),J=V&&V.length?new Set(V):null;return this.#St().filter(ee=>J?J.has(ee.id):!!(ee.total||ee.groupTotal||ee.grandTotal))}#Ye(V,J,ee,ne="group"){const oe={},re=(this.#e.compute||{}).total;for(const ae of V){if(!L(ae))continue;const fe=this.#o.handle(ae.id);if(!fe)continue;const de=F(ae,ne);if(de)if(K(de)){const ve=new Array(J.length);for(let Ie=0;Ie<J.length;Ie++)ve[Ie]=fe.get(J[Ie]);oe[ae.id]=de(ve,{row:ee,column:ae,grid:this.#e.grid||null,context:this.#z("context",null),valueAt:(Ie,Le)=>{const se=this.#o.handle(Ie);return se&&Le>=0&&Le<J.length?se.get(J[Le]):null}})}else K(re)&&(oe[ae.id]=re(fe,J,de))}return oe}#kt(V){if(!V)return V;const J=this.#e.config||{},ee={tz:J.timeZone,weekStartsOn:J.weekStartsOn};return m(V,ne=>{const oe=v(ne,ee),re=this.#ze(oe&&oe.col),ae=re&&re.type==="datetime";if(oe&&oe.type)return oe.type==="datetime"&&!oe.timeZone&&re?{...oe,timeZone:J.timeZone||void 0}:oe;if(ae)return{...oe,type:"datetime",timeZone:J.timeZone||void 0};const fe=re&&(re.dataType?.base||re.type);return fe?{...oe,type:fe}:oe})}#ut(V,J){const ee=this.#z("expanded",null);return ee?K(ee.has)?ee.has(V,J):Array.prototype.includes.call(ee,V):!0}#z(V,J){if(V==="context"||!K(this.#e.stateVersion))return this.#Lt(V,J);const ee=this.#Ot(V),ne=this.#f.get(V);if(ne&&ne.version===ee)return ne.value;const oe=this.#Lt(V,J);return this.#f.set(V,{version:ee,value:oe}),oe}#Lt(V,J){const ee=this.#e.state;if(ee&&K(ee[V])){const ne=ee[V]();return ne??J}return J}#Qe(){const V=this.#e.stateVersion;return K(V)?V():0}#Ft(){const V=this.#e.columnsVersion,J=this.#e.permissionsVersion;return`${K(V)?V():0}|${K(J)?J():0}`}#Ot(V){return V==="totals"?this.#Ft():`${this.#Qe()}`}#st(V,J,ee){if(!K(this.#e.stateVersion))return ee();const ne=this.#d.get(V);if(ne&&ne.version===J)return ne.key;const oe=ee();return this.#d.set(V,{version:J,key:oe}),oe}#ot(V){const J=(this.#e.compute||{})[V];return K(J)||D(`ctx.compute.${V} is required by the memory source pipeline`),J}#St(){const V=this.#e.columns;return V&&K(V.all)?V.all():[]}#ze(V){const J=this.#e.columns;return J&&K(J.get)?J.get(V):void 0}#Je(V,J){const ee=this.#e.emit;K(ee)&&ee(V,J)}}}),De("packages/core/src/source/abort.js",function(e,U){"use strict";Object.defineProperty(e,"SupersededError",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"RequestToken",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"AbortScope",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"createAbortScope",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"isAbortError",{enumerable:!0,get:function(){return D}});class te extends Error{constructor(K,I="superseded"){super(`[lattice] request ${K?`"${K}" `:""}${I}`),this.name="SupersededError",this.superseded=!0,this.key=K}}class M{#e;constructor(K,I,G,H){this.#e=K,this.key=I,this.controller=G,this.signal=G.signal,this.seq=H}get current(){return!this.signal.aborted&&this.#e.tokenFor(this.key)===this}settle(){this.#e.settle(this)}abort(K){this.signal.aborted||this.controller.abort(new te(this.key,K)),this.#e.settle(this)}}class X{#e=new Map;#t=0;begin(K="",I="superseded"){const G=this.#e.get(K);G&&!G.signal.aborted&&G.controller.abort(new te(K,I));const H=new M(this,K,new AbortController,++this.#t);return this.#e.set(K,H),H}tokenFor(K){return this.#e.get(K)}pending(K=""){const I=this.#e.get(K);return!!I&&!I.signal.aborted}get size(){return this.#e.size}settle(K){this.#e.get(K.key)===K&&this.#e.delete(K.key)}abort(K="",I="superseded"){const G=this.#e.get(K);G&&G.abort(I)}abortAll(K="superseded"){for(const I of[...this.#e.values()])I.abort(K);this.#e.clear()}}function B(){return new X}function D(Z){if(!Z||typeof Z!="object")return!1;const K=Z;return K.superseded===!0||K.name==="AbortError"||K.name==="SupersededError"}}),De("packages/core/src/source/blockcache.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PAGE_SIZE",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"DEFAULT_MAX_CACHED_PAGES",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"BlockCache",{enumerable:!0,get:function(){return B}});const te=100,M=32;class X{constructor(Z){this.id=Z,this.rows=null,this.state="pending",this.token=null,this.error=null}}class B{#e=new Map;#t;#n;#r=0;#s=-1;constructor(Z={}){this.#t=Math.max(1,Math.floor(Number(Z.pageSize)||te)),this.#n=Math.max(1,Math.floor(Number(Z.maxCachedPages)||M))}get pageSize(){return this.#t}get maxBlocks(){return this.#n}get size(){return this.#e.size}blockOf(Z){return Math.floor(Z/this.#t)}rangeOf(Z){return{start:Z*this.#t,end:(Z+1)*this.#t}}has(Z){return this.#e.has(Z)}pending(Z){const K=this.#e.get(Z);return!!K&&K.state==="pending"}loaded(Z){const K=this.#e.get(Z);return!!K&&K.state==="loaded"}begin(Z,K){let I=this.#e.get(Z);return I||(I=new X(Z)),I.state="pending",I.token=K,I.error=null,this.#i(Z,I),I}fill(Z,K){const I=this.#e.get(Z)||new X(Z);I.rows=K,I.state="loaded",I.token=null,this.#i(Z,I)}failed(Z,K){const I=this.#e.get(Z)||new X(Z);I.state="error",I.error=K,I.token=null,this.#i(Z,I)}delete(Z){return this.#e.delete(Z)}rowAt(Z){const K=this.blockOf(Z),I=this.#e.get(K);if(!(!I||I.state!=="loaded"||!I.rows))return this.#i(K,I),I.rows[Z-K*this.#t]}rowLoaded(Z){const K=this.blockOf(Z),I=this.#e.get(K);return!!I&&I.state==="loaded"&&!!I.rows&&Z-K*this.#t<I.rows.length}erroredAt(Z){const K=this.#e.get(this.blockOf(Z));return!!K&&K.state==="error"}loadedExtent(){let Z=0;for(const K of this.#e.values()){if(K.state!=="loaded"||!K.rows)continue;const I=K.id*this.#t+K.rows.length;I>Z&&(Z=I)}return Z}fillOf(Z){const K=this.#e.get(Z);return K&&K.state==="loaded"&&K.rows?K.rows.length:null}protect(Z,K){this.#r=this.blockOf(Math.max(0,Z)),this.#s=this.blockOf(Math.max(0,K))}evict(){const Z=[];if(this.#e.size<=this.#n)return Z;for(const[K,I]of this.#e){if(this.#e.size-Z.length<=this.#n)break;K>=this.#r&&K<=this.#s||I.state!=="pending"&&Z.push(K)}for(const K of Z)this.#e.delete(K);return Z}ids(){return[...this.#e.keys()]}clear(){this.#e.clear()}#i(Z,K){this.#e.delete(Z),this.#e.set(Z,K)}}}),De("packages/core/src/source/pagewindow.js",function(e,U){"use strict";Object.defineProperty(e,"pageWindow",{enumerable:!0,get:function(){return te}});function te(M,X,B,D){const Z=Math.floor(Number(M)||0);if(Z<=0)return null;const K=Math.max(0,Math.floor(Number(X)||0)),I=Math.max(0,Math.floor(Number(B)||0));if(D){const G=Math.max(1,Math.ceil(I/Z)),H=Math.min(K,G-1),S=H*Z;return{page:H,pageSize:Z,offset:S,length:Math.max(0,Math.min(Z,I-S)),pageCount:G,total:I}}return{page:K,pageSize:Z,offset:K*Z,length:Z,pageCount:Math.max(K+2,Math.ceil(I/Z)),total:null}}}),De("packages/core/src/source/paged.js",function(e,U){"use strict";Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"createPagedSource",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"PagedSource",{enumerable:!0,get:function(){return y}});const M=U("packages/core/src/internal/lru.js").Lru,B=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/warn.js").warnOnce,I=U("packages/core/src/internal/schedule.js").settleDebounce,G=U("packages/core/src/source/abort.js"),H=G.createAbortScope,S=G.isAbortError,O=U("packages/core/src/source/blockcache.js"),b=O.BlockCache,c=O.DEFAULT_PAGE_SIZE,f=O.DEFAULT_MAX_CACHED_PAGES,n=U("packages/core/src/source/rows.js").createRowFactory,t=U("packages/core/src/source/filterwire.js"),i=t.wireFilters,s=t.querySignature,r=t.warnHostFilterNotApplied,a=U("packages/core/src/source/pagewindow.js").pageWindow,l=120;function h(m,v){return new y(m,v)}class y{mode="paged";#e;#t;#n;#r=H();#s;#i;#o=new Map;#l=null;#a=null;#c=!1;#u=0;#f="";#d={start:0,end:0};#h;#p=!1;#m=0;#g="";constructor(v,d){this.#e=v||{mode:"paged"},this.#t=d||{},this.#n=new b({pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||f}),this.#s=n(this.#t),this.#i=new M(this.#n.pageSize*4),this.#h=I((p,g)=>this.#w(p,g),l),this.#f=this.#E(),B(this.#e.fetch)||Z("source.paged.fetch",'source.mode "paged" requires a fetch function; the grid will stay empty.'),r(this.#t)}count(){const v=this.#y();return v?v.length:this.#b()}#b(){if(this.#T(),this.#l!==null)return this.#l;const v=Math.max(this.#u,this.#n.loadedExtent());return this.#c?v:v+this.#n.pageSize}matchCount(){return this.#b()}totalCount(){return this.#b()}pageInfo(){const v=this.#y();if(!v){const d=this.#b();return{page:0,pageSize:0,total:this.exact()?d:null,pageCount:1,counting:!1}}return{page:v.page,pageSize:v.pageSize,total:v.total,pageCount:v.pageCount,counting:v.total===null&&this.#r.size>0&&this.#u===0&&this.#n.loadedExtent()===0}}#y(){const v=this.#b(),d=a(this.#P("pageSize",0),this.#P("page",0),v,this.exact());if(!d)return this.#g="",null;const p=`${this.#m}:${d.offset}:${d.length}`;if(p!==this.#g&&!this.#p&&(this.#g=p,d.length>0)){const g=d.offset+d.length-1;this.#d={start:d.offset,end:g},this.#w(d.offset,g)}return d}at(v){const d=this.#y();if(d){if(v<0||v>=d.length)return;const p=this.#j(d.offset+v);return p&&(p.index=v),p}return this.#j(v)}#j(v){if(v<0||v>=this.#b())return;const d=this.#i.get(v);if(d&&(d.data!==null||!this.#n.rowLoaded(v)))return d;const p=this.#n.rowAt(v);if(p===void 0){const k=this.#s.skeleton(v,0,this.#n.erroredAt(v));return this.#i.set(v,k),k}const g=this.#s.leaf(p,v);return g.index=v,this.#i.set(v,g),this.#o.set(g.key,v),g}byKey(v){const d=this.#o.get(v);return d===void 0?void 0:this.#j(d)}loaded(v){const d=this.#y();return d?v>=0&&v<d.length&&this.#n.rowLoaded(d.offset+v):this.#n.rowLoaded(v)}loadedCount(){this.#T();let v=0;for(const d of this.#n.ids()){if(!this.#n.loaded(d))continue;const p=this.#n.fillOf(d);typeof p=="number"&&(v+=p)}return v}residentRows(){this.#T();const v=this.#y(),d=v?v.offset:0,p=v?v.offset+v.length:1/0,g=[],k=this.#n.ids().sort((w,E)=>w-E);for(const w of k){if(!this.#n.loaded(w))continue;const{start:E}=this.#n.rangeOf(w),N=this.#n.fillOf(w)||0;for(let x=E;x<E+N;x++){if(x<d||x>=p)continue;const _=this.#i.peek(x);if(_&&_.data!==null&&_.data!==void 0){g.push(_);continue}const F=this.#n.rowAt(x);if(F===void 0)continue;const L=this.#s.leaf(F,x);L.index=x,this.#i.set(x,L),this.#o.set(L.key,x),g.push(L)}}return g}hint(v,d){if(this.#p)return;const p=this.#T();let g=Math.max(0,Math.floor(v)),k=Math.max(g,Math.floor(d));const w=this.#y();if(w){if(w.length===0)return;g=w.offset,k=w.offset+w.length-1}this.#d={start:g,end:k},this.#n.protect(g,k);for(const E of this.#n.evict())this.#v(E);this.#h(g,k),p&&this.#h.flush()}#w(v,d){if(this.#p)return;this.#n.protect(v,d);const p=this.#n.blockOf(v),g=this.#n.blockOf(d);for(let k=p;k<=g&&!(this.#l!==null&&k*this.#n.pageSize>=this.#l);k++)this.#n.has(k)||this.#O(k)}apply(v){const d={added:[],updated:[],removed:[]};if(!v)return d;if(v.update)for(const p of v.update){const g=this.#s.keyOf(p,-1),k=this.#o.get(g);if(k===void 0)continue;const w=this.#s.leaf(p,k);w.index=k,this.#i.set(k,w),d.updated.push(w)}return(v.add&&v.add.length||v.remove&&v.remove.length)&&this.reload(),d}reload(v){this.#S("reload"),this.#h.cancel(),this.hint(this.#d.start,this.#d.end)}destroy(){this.#p=!0,this.#h.cancel(),this.#r.abortAll("destroyed"),this.#n.clear(),this.#i.clear(),this.#o.clear()}exact(){return this.#l!==null||this.#c}pending(){return this.#r.size}async#O(v){if(!B(this.#e.fetch))return;const d=this.#r.begin(`block:${v}`);this.#n.begin(v,d);const{start:p,end:g}=this.#n.rangeOf(v),k=this.#f;try{const w=await this.#e.fetch({range:{start:p,end:g},sort:this.#P("sort",[]),filters:i(this.#P("filters",null),this.#N()),quick:this.#P("quick","")||void 0,context:this.#P("context",null),signal:d.signal});if(!d.current||k!==this.#f||this.#p)return;d.settle();const E=w&&w.rows||[];this.#n.fill(v,E);for(let x=0;x<E.length;x++)this.#i.delete(p+x);const N=w&&typeof w.total=="number"?w.total:w&&typeof w.count=="number"?w.count:null;N!==null?(this.#l=N,this.#c=!0):E.length<this.#n.pageSize?(this.#c=!0,this.#l=p+E.length):this.#u=Math.max(this.#u,p+E.length),this.#M("model:changed",{reason:"page",block:v,from:p,to:p+E.length}),this.#M("rows:changed",{companion:!0,reason:"page",block:v,from:p,to:p+E.length}),this.#l!==null&&this.#l!==this.#a&&(this.#a=this.#l,this.#M("source:total",{total:this.#l,groupPath:[]}))}catch(w){if(d.settle(),S(w))return;this.#n.failed(v,w);for(let E=p;E<g;E++)this.#i.delete(E);this.#M("model:changed",{reason:"page-error",block:v,range:{start:p,end:g}}),this.#M("source:error",{error:w,block:v,range:{start:p,end:g}})}}#v(v){const{start:d,end:p}=this.#n.rangeOf(v);for(let g=d;g<p;g++){const k=this.#i.peek(g);k&&this.#o.delete(k.key),this.#i.delete(g)}}#T(){const v=this.#E();return v===this.#f?!1:(this.#f=v,this.#S("query"),!0)}#S(v){this.#r.abortAll(v),this.#n.clear(),this.#i.clear(),this.#o.clear(),this.#l=null,this.#a=null,this.#c=!1,this.#u=0,this.#m++,this.#M("model:changed",{reason:v})}#E(){return s({filters:this.#P("filters",null),sort:this.#P("sort",[]),quick:this.#P("quick",""),context:this.#P("context",null)})}#N(){const v=this.#t.config||{};return{tz:v.timeZone,weekStartsOn:v.weekStartsOn}}#P(v,d){const p=this.#t.state;if(p&&B(p[v])){const g=p[v]();return g??d}return d}#M(v,d){const p=this.#t.emit;B(p)&&p(v,d)}}}),De("packages/core/src/source/aggregates.js",function(e,U){"use strict";Object.defineProperty(e,"STAT_PUSHDOWN",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"pushableAggregates",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"fillAggregateSql",{enumerable:!0,get:function(){return X}}),Object.defineProperty(e,"resolveAggregatesConfig",{enumerable:!0,get:function(){return B}}),Object.defineProperty(e,"routeAggregate",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"resolveAggregatePlan",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"groupKeysPushable",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"pushdownDocRows",{enumerable:!0,get:function(){return G}});const te=Object.freeze({sum:{pushable:!0,class:"identical",sql:"sum(%c)"},avg:{pushable:!0,class:"identical",sql:"avg(%c)"},min:{pushable:!0,class:"identical",sql:"min(%c)"},max:{pushable:!0,class:"identical",sql:"max(%c)"},count:{pushable:!0,class:"identical",sql:"count(*)"},countValues:{pushable:!0,class:"identical",sql:"count(%c)",blankAware:!0},range:{pushable:!0,class:"identical",sql:"(max(%c) - min(%c))"},variance:{pushable:!0,class:"identical",sql:"var_samp(%c)"},varianceP:{pushable:!0,class:"identical",sql:"var_pop(%c)"},stddev:{pushable:!0,class:"identical",sql:"stddev_samp(%c)"},stddevP:{pushable:!0,class:"identical",sql:"stddev_pop(%c)"},sumSquares:{pushable:!0,class:"identical",sql:"sum(%c * %c)"},median:{pushable:!0,class:"identical",sql:"median(%c)"},p25:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.25)"},p75:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.75)"},p90:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.9)"},p95:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.95)"},p99:{pushable:!0,class:"identical",sql:"quantile_cont(%c, 0.99)"},iqr:{pushable:!0,class:"identical",sql:"(quantile_cont(%c, 0.75) - quantile_cont(%c, 0.25))"},mad:{pushable:!0,class:"identical",sql:"mad(%c)"},distinct:{pushable:!0,class:"identical",sql:"count(DISTINCT %c)",blankAware:!0},skewness:{pushable:!0,class:"identical",sql:"skewness(%c)"},kurtosis:{pushable:!0,class:"identical",sql:"kurtosis(%c)"},geomean:{pushable:!0,class:"identical",sql:"exp(avg(ln(%c)))"},harmean:{pushable:!0,class:"identical",sql:"(count(%c) / sum(1.0 / %c))"},entropy:{pushable:!0,class:"identical",sql:"entropy(%c)",blankAware:!0},correlation:{pushable:!0,class:"identical",sql:"corr(%w, %c)",twoColumn:!0},hhi:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_transform(map_values(histogram(%c)), lambda v: (v::DOUBLE/count(%c))*(v::DOUBLE/count(%c)))) END"},evenness:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL WHEN count(DISTINCT %c)<2 THEN 1.0 ELSE entropy(%c)/log2(count(DISTINCT %c)) END"},top3Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,3))::DOUBLE/count(%c) END"},top10Share:{pushable:!0,class:"identical",blankAware:!0,sql:"CASE WHEN count(%c)=0 THEN NULL ELSE list_sum(list_slice(list_sort(map_values(histogram(%c)),'DESC'),1,10))::DOUBLE/count(%c) END"},gini:{pushable:!0,class:"identical",sql:"CASE WHEN list_min(list(%c) FILTER (WHERE isfinite(%c)))<0 THEN NULL WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL WHEN list_sum(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN 0 ELSE 2.0*list_sum(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v, i: i*v))/(len(list(%c) FILTER (WHERE isfinite(%c)))*list_sum(list(%c) FILTER (WHERE isfinite(%c))))-(len(list(%c) FILTER (WHERE isfinite(%c)))+1.0)/len(list(%c) FILTER (WHERE isfinite(%c))) END"},trimmedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_slice(list_sort(list(%c) FILTER (WHERE isfinite(%c))), floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1, len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT)) END"},winsorizedMean:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))=0 THEN NULL ELSE list_avg(list_transform(list_sort(list(%c) FILTER (WHERE isfinite(%c))), lambda v: least(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[len(list(%c) FILTER (WHERE isfinite(%c)))-floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT], greatest(list_sort(list(%c) FILTER (WHERE isfinite(%c)))[floor(len(list(%c) FILTER (WHERE isfinite(%c)))*0.1)::BIGINT+1], v)))) END"},robustOutliers:{pushable:!0,class:"identical",sql:"(SELECT CASE WHEN len(d.a)=0 THEN NULL WHEN d.mad=0 THEN NULL ELSE len(list_filter(d.a, lambda v: abs(0.6745*(v-d.med)/d.mad)>3.5)) END FROM (SELECT xs AS a, list_median(xs) AS med, list_median(list_transform(xs, lambda w: abs(w-list_median(xs)))) AS mad FROM (SELECT list(%c) FILTER (WHERE isfinite(%c)) AS xs)) d)"},jarqueBera:{pushable:!0,class:"identical",sql:"CASE WHEN len(list(%c) FILTER (WHERE isfinite(%c)))<8 THEN NULL WHEN list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2)))=0 THEN NULL ELSE (len(list(%c) FILTER (WHERE isfinite(%c)))/6.0)*(power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),3)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),1.5),2)+power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),4)))/power(list_avg(list_transform(list(%c) FILTER (WHERE isfinite(%c)), lambda v: power(v-list_avg(list(%c) FILTER (WHERE isfinite(%c))),2))),2)-3,2)/4.0) END"},weightedAvg:{pushable:!0,class:"identical",twoColumn:!0,sql:"sum(%c*%w) FILTER (WHERE isfinite(%c) AND isfinite(%w))/nullif(sum(%w) FILTER (WHERE isfinite(%c) AND isfinite(%w)),0)"},mode:{pushable:!0,class:"may-differ",sql:"mode(%c)",note:"DuckDB returns a modal value even for an all-distinct column; the grid returns null. Tie-breaking can also differ, and on a text column an empty string counts as a value. Under pushdown you will see a value."},weightedQuantile:{pushable:!1,class:"fallback",note:"No SQL equivalent for the grid's weighted-quantile midpoint convention; always computed client-side (needs a full-dataset pull for a correct figure over a remote source)."}});function M(){const H=new Set;for(const[S,O]of Object.entries(te))O.pushable&&H.add(S);return H}function X(H,S,O){let b=H.split("%c").join(S);return O!==void 0&&(b=b.split("%w").join(O)),b}function B(H){const S=H||{},O=S.default==="engine"||S.default==="engine-if-identical"?S.default:"client",b={};if(S.overrides&&typeof S.overrides=="object")for(const[c,f]of Object.entries(S.overrides))(f==="engine"||f==="client")&&(b[c]=f);return{default:O,overrides:b}}function D(H,S){const O=te[H];if(!O||!O.pushable)return"client";const b=S.overrides[H];return b==="engine"||b==="client"?b:S.default==="client"?"client":S.default==="engine-if-identical"?O.class==="identical"?"engine":"client":"engine"}function Z(H,S){const O=B(S),b=[],c=[];for(const f of H||[]){const o=te[f.fn],n=D(f.fn,O),t={id:f.id,col:f.col,fn:f.fn,class:o?o.class:"fallback"};f.weight!==void 0&&(t.weight=f.weight),f.params!==void 0&&(t.params=f.params),n==="engine"?b.push(t):(t.reason=o&&!o.pushable?o.note||"the engine cannot express this stat":"client by config",c.push(t))}return{engine:b,client:c,config:O}}const K=/^[A-Za-z_][A-Za-z0-9_$]*$/;function I(H,S=[]){return(H||[]).every(b=>{if(typeof b=="string")return K.test(b);if(!b||typeof b!="object")return!1;const c=b;return Array.isArray(S)&&S.includes(c.bucket)&&typeof c.col=="string"&&K.test(c.col)&&typeof c.size=="number"&&Number.isFinite(c.size)&&c.size>0})}function G(){return Object.entries(te).map(([H,S])=>({stat:H,class:S.class,sql:S.sql?X(S.sql,"col",S.twoColumn?"weight":void 0):"",note:S.note||(S.class==="identical"?"Pushes to DuckDB with the same result.":"")}))}}),De("packages/core/src/source/pushdown.js",function(e,U){"use strict";Object.defineProperty(e,"FOREGROUND_WAIT_MS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"NO_CAPABILITIES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveMutate",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"capabilitiesOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"splitFilters",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"LEAF_COUNT_ID",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"PIVOT_UNSUPPORTED",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"GROUP_UNSUPPORTED",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"UNGROUPED_LEVEL",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"planQuery",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"applyResidual",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"DEFAULT_WHERE_ROW_LIMIT",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"createPushdownSource",{enumerable:!0,get:function(){return q}});const M=U("packages/core/src/internal/compare.js").defaultCompare,B=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/merge.js").toArray,I=U("packages/core/src/internal/warn.js").warnOnce,G=U("packages/core/src/source/filterwire.js"),H=G.isGroup,S=G.warnWherePageRelative,O=G.warnWhereOverThreshold,b=G.wireFilters,c=U("packages/core/src/source/aggregates.js"),f=c.resolveAggregatePlan,o=c.groupKeysPushable,n=c.STAT_PUSHDOWN,i=U("packages/core/src/source/abort.js").SupersededError,s=1e3;function r(V){const J=V&&V.signal;if(!J||!J.aborted)return;const ee=J.reason;throw ee instanceof Error?ee:new i("","superseded before it was sent")}const u=Object.freeze({filter:!1,operators:Object.freeze([]),sort:!1,quick:!1,range:!1,total:!1,group:!1,pivot:!1,mutate:!1});function a(V){if(!V||typeof V!="object")return!1;const J=V.returning==="row"||V.returning==="key"?V.returning:"none";return{append:V.append===!0,update:V.update===!0,delete:V.delete===!0,returning:J}}function l(V,J){if(!V||typeof J!="string")return;if(!J.includes("."))return V[J];let ee=V;for(const ne of J.split(".")){if(ee===null||typeof ee!="object")return;ee=ee[ne]}return ee}function h(V){if(V===!0)return!0;if(!V||typeof V!="object")return!1;const J=V;return J.enabled===!1?!1:J.enabled===!0||B(J.commit)}function y(V){const J={...u,...V||{}};return J.operators=new Set(J.operators||[]),J.mutate=a(J.mutate),J}function m(V,J){return!V||!V.op||!J.operators.size?!1:J.operators.has(V.op)}function v(V,J){if(!V)return{pushed:null,residual:null};if(!J.filter)return{pushed:null,residual:V};if(J.filter==="term"){if(H(V)){const re=V.conditions||[];if(String(V.op)!=="and")return{pushed:null,residual:V};const ae=re.findIndex(de=>!H(de)&&m(de,J));if(ae<0)return{pushed:null,residual:V};const fe=re.filter((de,ve)=>ve!==ae);return{pushed:re[ae],residual:fe.length?{op:"and",conditions:fe}:null}}return m(V,J)?{pushed:V,residual:null}:{pushed:null,residual:V}}if(!H(V))return m(V,J)?{pushed:V,residual:null}:{pushed:null,residual:V};if(String(V.op)!=="and")return(V.conditions||[]).every(ae=>H(ae)?v(ae,J).residual===null:m(ae,J))?{pushed:V,residual:null}:{pushed:null,residual:V};const ee=[],ne=[];for(const re of V.conditions||[]){if(H(re)){if(J.filter==="flat"){ne.push(re);continue}const ae=v(re,J);ae.pushed&&ee.push(ae.pushed),ae.residual&&ne.push(ae.residual);continue}(m(re,J)?ee:ne).push(re)}const oe=re=>re.length===0?null:re.length===1?re[0]:{op:"and",conditions:re};return{pushed:oe(ee),residual:oe(ne)}}const d="__lattice_leaves";function p(V){return V.aggregates?V.aggregates instanceof Set?V.aggregates:new Set(Z(V.aggregates)):new Set}function g(V){const J=p(V);return J.size?J.has("count")?V.filter!=="tree"||!V.operators||!V.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 k(V,J,ee,ne,oe,re,ae){const fe=Array.isArray(V.groupBy)?V.groupBy:[],de=Array.isArray(V.groupPath)?V.groupPath:[],ve=Array.isArray(V.groupValues)?V.groupValues:null;if(!J.group){const Ie=g(J);if(Ie)return Ie}return o(fe)?ee.residual?"the filter did not fully push, so the engine would group a superset of the matching rows":ne?oe?re?"a host `where` predicate can only run in the browser, over rows the engine grouped":ae?"fullDataset holds the whole matching set, so the grid groups it itself":!ve||ve.length!==de.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 w="pushdown:pivot-unsupported",E="pushdown:group-unsupported",N=Symbol("lattice.remote.ungroupedLevel");function x(V,J,ee,ne,oe,re){const ae=Array.isArray(V.pivotBy)?V.pivotBy:[],fe=Array.isArray(V.groupBy)?V.groupBy:[],de=Array.isArray(V.groupPath)?V.groupPath:[],ve=Array.isArray(V.groupValues)?V.groupValues:null;return J.pivot?o(ae)?fe.length&&!o(fe)?"a grouping key is not a plain column the engine can name in a GROUP BY":ee.residual?"the filter did not fully push, so the engine would pivot a superset of the matching rows":ne?oe?re?"a host `where` predicate can only run in the browser, over rows the engine pivoted":!ve||ve.length!==de.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 _(V,J,ee=!1){const ne=v(V.filters||null,J),oe=[];ne.residual&&oe.push("filter");const re=V.sort||[],ae=re.length===0||J.sort==="multi"&&re.length>=1||J.sort==="single"&&re.length===1;!ae&&re.length&&oe.push("sort");const fe=V.quick?String(V.quick):"",de=!fe||!!J.quick;de||oe.push("quick");const ve=V.where&&V.where.active?V.where:null;ve&&oe.push("where");const Ie={filters:ne.residual,sort:ae?null:re,quick:de?"":fe,where:ve},Le=!!ee,se=Array.isArray(V.groupBy)&&V.groupBy.length>0,pe=se?k(V,J,ne,ae,de,ve,Le):"",be=V.pivotMode!==!1&&Array.isArray(V.pivotBy)&&V.pivotBy.length>0,ke=be?x(V,J,ne,ae,de,ve):"",je=be&&ke==="";be&&!je&&oe.push("pivot");const xe=be?je&&se:se&&pe==="";se&&!be&&!xe&&oe.push("group");const ge=(xe||je)&&Array.isArray(V.groupValues)?V.groupValues.length:0,we=xe||be?!1:Le||!!(Ie.filters||Ie.sort||Ie.quick||Ie.where)||!J.range;return{pushed:{...V,filters:ne.pushed,sort:ae?re:[],quick:de?fe:"",range:we?null:V.range},residual:Ie,needsAll:we,unpushed:oe,full:Le,grouped:xe,groupLevel:ge,groupReason:be?"":pe,pivoted:je,pivotReason:ke}}function F(V){const J=Array.isArray(V.totals)?V.totals:[],ee=V.totalFns&&typeof V.totalFns=="object"?V.totalFns:{},ne=[],oe=[];for(const re of J){const ae=String(re),fe=typeof ee[ae]=="string"?ee[ae]:null,de=fe?n[fe]:null;fe?!de||!de.pushable||!de.sql?oe.push({id:ae,fn:fe,class:de?de.class:"fallback",reason:de&&de.note?de.note:`the pushdown map cannot express "${fe}"`}):de.twoColumn?oe.push({id:ae,fn:fe,class:de.class,reason:`"${fe}" reduces two columns, and a grouped request carries no weight column`}):ne.push({id:ae,col:ae,fn:fe,class:de.class}):oe.push({id:ae,fn:null,class:"fallback",reason:"the column totals with a host function, so there is no named statistic to push"})}return{engine:ne,client:oe}}const L=Object.freeze({items:V=>V==null?[]:Array.isArray(V)?V:[V]});function j(V,J,ee){if(!J)return V;let ne=V;if(J.filters&&B(ee.evaluateFilters)){const oe=ne,re={count:ne.length,handle:de=>({id:de,get:ve=>l(oe[ve],de)}),itemwise:de=>oe.some(ve=>Array.isArray(l(ve,de)))?L:null},ae=ee.evaluateFilters(J.filters,re),fe=[];for(let de=0;de<ne.length;de++)ae[de]&&fe.push(ne[de]);ne=fe}if(J.where&&J.where.active&&(J.whole||S(J.where.names,"pushdown"),ne=ne.filter(oe=>J.where.passes(oe))),J.quick){const oe=J.quick.toLowerCase();ne=ne.filter(re=>{if(!re||typeof re!="object")return!1;for(const ae of Object.values(re))if(ae!=null&&String(ae).toLowerCase().includes(oe))return!0;return!1})}if(J.sort&&J.sort.length&&B(ee.sortMulti)){const oe=[...new Set(J.sort.map(de=>de.col))],re=ne,ae=oe.map(de=>({id:de,get:ve=>l(re[ve],de)})),fe=ee.sortMulti(ae,J.sort.map(de=>({col:de.col,dir:de.dir})),Uint32Array.from({length:ne.length},(de,ve)=>ve),{});ne=Array.from(fe,de=>re[de])}return ne}function R(V){return JSON.stringify({filters:V.filters||null,sort:V.sort||[],quick:V.quick||"",groupBy:V.groupBy||[],groupPath:V.groupPath||[],context:V.context??null})}function $(V){if(!V||typeof V!="object")return 16;let J="";try{J=JSON.stringify(V)}catch{return 200}return J.length*2+64}function T(V){const J=V||{};return{enabled:!!J.enabled,maxRows:Number.isFinite(J.maxRows)?J.maxRows:1e6,maxBytesEstimate:Number.isFinite(J.maxBytesEstimate)?J.maxBytesEstimate:512*1024*1024}}const A=5e4;function C(V){return Number.isFinite(V)&&V>=0?V:A}function z(V){return!!V&&B(V.then)}async function Y(V){if(!V||V.total!==void 0||!z(V.pendingTotal))return V;const J=await V.pendingTotal,{pendingTotal:ee,...ne}=V;return typeof J=="number"?{...ne,total:J}:ne}function q(V={}){const J=V.adapter;if(!J||!B(J.execute))return I("source.pushdown.adapter","createPushdownSource needs an `adapter` with an `execute(query)` function."),{...V,mode:"remote",fetch:async()=>({rows:[],total:0})};const ee=y(J.capabilities),ne=J.capabilities&&Object.getOwnPropertyDescriptor(J.capabilities,"operators");ne&&B(ne.get)&&Object.defineProperty(ee,"operators",{enumerable:!0,configurable:!0,get:()=>new Set(J.capabilities.operators||[]),set:()=>{}});const oe=J.name||"adapter";let re=null;const ae=()=>B(J.ready)?(re||(re=Promise.resolve(J.ready()).then(()=>{Object.assign(ee,y(J.capabilities))},he=>{throw re=null,he})),re):null,fe=T(V.fullDataset),de=!!V.allowPartialResults,ve=C(V.whereRowLimit);let Ie=null;const Le=V.aggregates;let se=null,pe=null,be=null,ke=null,je=null,xe,ge=null,we=0,Me=null;const Ye=()=>!fe.enabled||!se?null:(Me!==se.key&&(we++,Me=se.key),{rows:se.rows,version:we}),Ae=async he=>{const Se=he.where&&he.where.active?he.where:null;if(!Se)return{request:he,probe:null};const{where:Ee,...Te}=he,Fe=_(Te,ee,fe.enabled);if(Fe.needsAll)return{request:he,probe:null};const Ue=R(Fe.pushed);let _e=null;return(!Ie||Ie.key!==Ue)&&(ee.total?(r(he),_e=await Y(await J.execute(Fe.pushed,he)),Ie={key:Ue,size:_e&&typeof _e.total=="number"?_e.total:null}):Ie={key:Ue,size:null}),Ie.size!==null&&Ie.size<ve?{request:he,probe:null}:(O(Se.names,oe,Ie.size,ve),{request:Te,probe:_e})},Ve=async(he,Se)=>{ge=null;const Ee=F(he.pushed);be={engine:Ee.engine,client:Ee.client,groupBy:he.pushed.groupBy},Ee.client.length&&I(`source.pushdown.group.totals.${oe}.${Ee.client.map(Ue=>Ue.id).join(".")}`,`the ${oe} adapter cannot compute the group subtotal for ${Ee.client.map(Ue=>`"${Ue.id}" (${Ue.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 Te=await J.executeGroupLevel(he.pushed,Ee.engine,Se)||{};let Fe=Te.rows||[];return!ee.range&&Se.range&&(Fe=Fe.slice(Se.range.start,Se.range.end)),Ke(Te),Te.total===void 0?{rows:Fe}:{rows:Fe,total:Te.total}},Pe=new Map,Oe=64,He=async(he,Se)=>{ge=null;const Ee=he.pushed,Te=Ee.groupBy,Fe=Array.isArray(Ee.groupValues)?Ee.groupValues:[],Ue=Fe.length,_e=[...Ee.filters?[Ee.filters]:[],...Te.slice(0,Ue).map((bt,mt)=>({col:bt,op:"eq",value:Fe[mt]===void 0?null:Fe[mt],caseSensitive:!0}))],Je=_e.length===0?null:_e.length===1?_e[0]:{op:"and",conditions:_e},$e=Se.range?Se.range.start:0;if(Ue>=Te.length){const bt={...Ee,filters:Je,groupBy:[],groupPath:[],groupValues:[],totals:[],totalFns:{}},mt=await Y(await J.execute(bt,Se))||{};let Lt=mt.rows||[];return!ee.range&&Se.range&&(Lt=Lt.slice(Se.range.start,Se.range.end)),typeof mt.total=="number"?{rows:Lt,total:mt.total}:{rows:Lt}}const ze=Te[Ue],Qe=F(Ee),tt=p(ee),et=Qe.engine.filter(bt=>tt.has(bt.fn)),dt=[...Qe.engine.filter(bt=>!tt.has(bt.fn)).map(bt=>({id:bt.id,fn:bt.fn,class:bt.class,reason:`the ${oe} adapter does not compute "${bt.fn}"`})),...Qe.client];be={engine:et,client:dt,groupBy:Te},dt.length&&I(`source.pushdown.group.totals.${oe}.${dt.map(bt=>bt.id).join(".")}`,`the ${oe} adapter cannot compute the group subtotal for ${dt.map(bt=>`"${bt.id}" (${bt.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 ft=[...et.map(bt=>({id:bt.id,col:bt.col,fn:bt.fn})),{id:d,col:ze,fn:"count"}],lt={...Ee,filters:Je,range:null},At=JSON.stringify([R(lt),Fe,ze,ft]);let Tt=$e>0?Pe.get(At):void 0;if(!Tt){for(Tt=Promise.resolve(J.executeGroupedAggregates(lt,[ze],ft)),Pe.delete(At),Pe.set(At,Tt);Pe.size>Oe;)Pe.delete(Pe.keys().next().value);Tt.catch(()=>{Pe.get(At)===Tt&&Pe.delete(At)})}const It=await Tt||[];r(Se);const Ge=bt=>{const mt={};for(const Lt of et)mt[Lt.id]=bt?bt[Lt.id]:void 0;return mt},vt=(Ee.sort||[]).find(bt=>bt&&bt.col===ze),ht=vt&&vt.dir==="desc"?-1:1,kt=It.filter(bt=>bt&&bt.level===1).map(bt=>({[ze]:bt.keys[0]===void 0?null:bt.keys[0],leafCount:Number(bt.values&&bt.values[d])||0,totals:Ge(bt.values)})).sort((bt,mt)=>ht*M(bt[ze],mt[ze]));if(Ue===0){const bt=It.find(Lt=>Lt&&Lt.level===0),mt=bt?Number(bt.values&&bt.values[d]):NaN;Ke({matchCount:Number.isFinite(mt)?mt:kt.reduce((Lt,Ht)=>Lt+Ht.leafCount,0),...bt?{grand:Ge(bt.values)}:{}})}const Nt=Se.range?Se.range.end:kt.length;return{rows:kt.slice($e,Nt),total:kt.length}},Ke=he=>{typeof he.matchCount=="number"&&(ke=he.matchCount,je=he.grand?{totals:he.grand,leafCount:he.matchCount}:null,xe===void 0&&B(J.unfilteredCount)&&(xe=null,Promise.resolve(J.unfilteredCount()).then(Se=>{xe=typeof Se=="number"?Se:null}).catch(Se=>{I(`source.pushdown.group.unfiltered.${oe}`,`the ${oe} adapter could not count the unfiltered set (${Se&&Se.message?Se.message:Se}), so "N of M" falls back to the display count for its denominator.`)})))},Xe=async(he,Se)=>{ge=null;const Ee=F(he.pushed);be={engine:Ee.engine,client:Ee.client,groupBy:he.pushed.groupBy,pivotBy:he.pushed.pivotBy},Ee.client.length&&I(`source.pushdown.pivot.totals.${oe}.${Ee.client.map(Je=>Je.id).join(".")}`,`the ${oe} adapter cannot compute the pivot cells for ${Ee.client.map(Je=>`"${Je.id}" (${Je.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 Te=await J.executePivotLevel(he.pushed,Ee.engine,Se)||{};let Fe=Te.rows||[];!ee.range&&Se.range&&(Fe=Fe.slice(Se.range.start,Se.range.end)),Ke(Te);const Ue=Te.pivot&&typeof Te.pivot=="object"?Te.pivot:{},_e={cells:Array.isArray(Ue.cells)?Ue.cells:[],...Array.isArray(Ue.axis)?{axis:Ue.axis}:{}};return Te.total===void 0?{rows:Fe,pivot:_e}:{rows:Fe,total:Te.total,pivot:_e}},nt=he=>{I(`source.pushdown.pivot.${oe}.${he}`,`pushdown:pivot-unsupported: the ${oe} adapter cannot pivot this query because ${he}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);const Se=new Error(`[lattice] ${w}: the ${oe} adapter cannot pivot this query because ${he}, so no rows are fetched rather than every leaf row being pulled into the browser to pivot there. \`lastPlan().pivotReason\` says the same.`);throw Se.code=w,Se.reason=he,Se},st=(he,Se)=>{const Ee={key:Se,state:"pending",value:null};return ge=Ee,he.then(Te=>(ge===Ee&&(ge={key:Se,state:"settled",value:typeof Te=="number"?Te:null}),Te),Te=>{throw ge===Ee&&(ge={key:Se,state:"failed",value:null}),Te})};let wt=0,pt=[];const St=()=>wt===0?null:new Promise(he=>{const Se=setTimeout(he,s);pt.push(()=>{clearTimeout(Se),he()})});let Ct;const Mt=async he=>{const Se=ae();Se&&await Se;const Te=he&&he.pivotMode!==!1&&Array.isArray(he.pivotBy)&&he.pivotBy.length>0?{request:he,probe:null}:await Ae(he);r(he);let Fe=_(Te.request,ee,fe.enabled);if(ee.group&&Fe.grouped&&!Fe.pivoted&&!B(J.executeGroupLevel)&&(I(`source.pushdown.group.method.${oe}`,`the ${oe} 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.`),Fe=_(Te.request,{...ee,group:!1,aggregates:null},fe.enabled)),Fe.pivoted&&!B(J.executePivotLevel)&&(Fe=_(Te.request,{...ee,pivot:!1},fe.enabled),Fe.pivotReason="the adapter declares the `pivot` capability but has no `executePivotLevel(query, aggregates, request)`"),Fe.grouped&&!Fe.pivoted&&!ee.group&&!B(J.executeGroupedAggregates)&&(I(`source.pushdown.group.aggregates.method.${oe}`,`the ${oe} 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\`.`),Fe=_(Te.request,{...ee,aggregates:null},fe.enabled)),pe=Fe,Fe.pivoted)return Xe(Fe,he);if(Fe.pivotReason&&nt(Fe.pivotReason),Fe.grouped)return ee.group?Ve(Fe,he):He(Fe,he);const _e=!!Fe.groupReason&&!Fe.full;_e?I(`source.pushdown.group-unsupported.${oe}.${Fe.groupReason}`,`pushdown:group-unsupported: the ${oe} adapter was not asked to group this query because ${Fe.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.`):Fe.groupReason&&I(`source.pushdown.group.${oe}.${Fe.groupReason}`,`the ${oe} adapter was not asked to group this query because ${Fe.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 Je=ft=>_e?{...ft,[N]:!0}:ft;if(!Fe.needsAll){const ft=Te.probe||await J.execute(Fe.pushed,he),lt=ft.rows||[];return z(ft.pendingTotal)&&ft.total===void 0?Je({rows:lt,pendingTotal:st(ft.pendingTotal,R(Fe.pushed))}):(ge=null,!ee.total&&ft.total===void 0?Je({rows:lt}):Je({rows:lt,total:ft.total??lt.length}))}Fe.unpushed.length&&I(`source.pushdown.residual.${oe}.${Fe.unpushed.join(".")}`,`the ${oe} adapter cannot push ${Fe.unpushed.join(" or ")}, so every matching row is fetched and the rest is applied in the browser. Correct, and slower than it needs to be: widening the adapter is the fix.`);const $e=R(Fe.pushed);if(!se||se.key!==$e){const ft=await Y(await J.execute(Fe.pushed,he));ge=null;const lt=ft.rows||[];if(Fe.full){const At=typeof ft.total=="number"?Math.max(ft.total,lt.length):lt.length;if(At>fe.maxRows)throw new Error(`[lattice] fullDataset refused: the ${oe} adapter's matching set is ${At.toLocaleString()} rows, past the configured maxRows of ${fe.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 Tt=lt.length*$(lt[0]);if(Tt>fe.maxBytesEstimate)throw new Error(`[lattice] fullDataset refused: the ${oe} adapter's matching set is an estimated ${Math.round(Tt/(1024*1024)).toLocaleString()} MB across ${lt.length.toLocaleString()} rows, past the configured maxBytesEstimate of ${Math.round(fe.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 ft.total=="number"&&lt.length<ft.total){const At=!!(Fe.residual.filters||Fe.residual.quick||Fe.residual.sort&&Fe.residual.sort.length);if(At&&!de)throw new Error(`[lattice] the ${oe} adapter returned ${lt.length} of ${ft.total} matching rows when asked for the whole result, and the query has residual ${Fe.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.`);At?I(`source.pushdown.partial.residual.${oe}`,`the ${oe} adapter returned ${lt.length} of ${ft.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.`):I(`source.pushdown.partial.${oe}`,`the ${oe} adapter returned ${lt.length} of ${ft.total} matching rows when asked for the whole result. The adapter must follow the engine's own paging before returning.`)}se={key:$e,rows:lt,total:typeof ft.total=="number"?ft.total:null}}let ze=Fe;if(Fe.residual.where){const ft=se.total??se.rows.length;if(ft>=ve){O(Fe.residual.where.names,oe,ft,ve);const{where:lt,...At}=Te.request;ze=_(At,ee,fe.enabled),pe=ze}}const Qe=se.total!==null&&se.rows.length>=se.total,tt=j(se.rows,{...ze.residual,whole:Qe},V.compute||{}),et=he.range?he.range.start:0,dt=he.range?he.range.end:tt.length;return Je({rows:tt.slice(et,dt),total:tt.length})},at=async(he,Se,Ee)=>{const Fe=Ee&&Ee.waitForPage&&Ct&&B(Ct.pageForegroundIdle)?Ct.pageForegroundIdle():St();Fe&&await Fe;const Ue=ae();Ue&&await Ue;const _e=_(he,ee,fe.enabled);pe=_e;const Je=f(Se,Le),$e=Array.isArray(he.groupBy)?he.groupBy:[],ze=$e.length>0,Qe=!_e.residual.filters&&!_e.residual.quick,tt=!ze||o($e,ee.buckets);let et=Je.engine,dt=Je.client;if(ee.aggregates&&et.length){const Tt=ee.aggregates instanceof Set?ee.aggregates:new Set(Z(ee.aggregates)),It=et.filter(Ge=>!Tt.has(Ge.fn));It.length&&(et=et.filter(Ge=>Tt.has(Ge.fn)),dt=[...It.map(Ge=>({...Ge,reason:`the ${oe} adapter does not compute "${Ge.fn}"`})),...dt])}const ft=Tt=>{dt=[...et.map(It=>({...It,reason:Tt})),...dt],et=[]};et.length&&!Qe?ft(_e.residual.quick&&!_e.residual.filters?"a quick search the adapter cannot push forces all-client (no mixed provenance)":"residual filter forces all-client (no mixed provenance)"):et.length&&!tt&&ft("a grouping key the engine cannot form forces all-client (no mixed provenance)");let lt={},At;return et.length&&(B(ze?J.executeGroupedAggregates:J.executeAggregates)?ze?At=await J.executeGroupedAggregates(_e.pushed,$e,et)||[]:lt=await J.executeAggregates(_e.pushed,et)||{}:(I(`source.pushdown.aggregates.${oe}${ze?".grouped":""}`,`the ${oe} adapter cannot compute ${ze?"grouped ":""}aggregates, so every requested statistic is computed client-side. Correct, and slower than it needs to be.`),ft(`adapter cannot compute ${ze?"grouped ":""}aggregates`))),be={engine:et,client:dt,...ze?{groupBy:$e}:{}},{values:lt,engine:et,client:dt,...At!==void 0?{groups:At}:{}}},ot=async he=>{wt++;try{return await Mt(he)}finally{if(wt--,wt===0&&pt.length){const Se=pt;pt=[];for(const Ee of Se)Ee()}}},gt=h(V.edit),Et=V.edit&&typeof V.edit=="object"&&B(V.edit.commit);let ut=V.edit;if(gt&&!Et)if(ee.mutate&&ee.mutate.update){const he=Se=>{if(!ee.mutate||!ee.mutate.update)throw new Error(`[lattice] the ${oe} 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 Ee={kind:"update",key:String(Se.key),patch:{[Se.colId]:Se.value}};return J.mutate(Ee,Se.request||{})};ut={...V.edit===!0?{}:V.edit,commit:he}}else I(`source.pushdown.readonly.${oe}`,`edit is enabled but the ${oe} adapter declares mutate: ${ee.mutate?"without update":"false"} (read-only by declaration), so no commit is synthesised and the grid stays read-only. Declare \`mutate: { update: true }\` on the adapter to allow cell edits.`);const me=gt&&ee.mutate&&(ee.mutate.append||ee.mutate.delete)?{append:ee.mutate.append===!0,remove:ee.mutate.delete===!0,returning:ee.mutate.returning,mutate:(he,Se)=>J.mutate(he,Se||{})}:null,Ce=async he=>{const Se=ae();Se&&await Se;const{range:Ee,signal:Te,export:Fe,...Ue}=he||{},_e={...Ue,groupBy:[],groupPath:[],groupValues:[],pivotBy:[],pivotMode:!1,totals:[]};return{plan:_(_e,ee,fe.enabled),signal:Te}};async function*ce(he,Se={}){const{plan:Ee,signal:Te}=await Ce(he),Fe=Math.max(1,Math.floor(Number(Se.pageSize))||5e3),Ue={signal:Te,stream:!0};if(!Ee.needsAll)for(let $e=0;;$e+=Fe){r(Ue);const ze=await J.execute({...Ee.pushed,range:{start:$e,end:$e+Fe}},Ue);ze&&z(ze.pendingTotal)&&ze.pendingTotal.then(null,()=>{});const Qe=ze&&ze.rows||[];if(Qe.length&&(yield Qe),Qe.length<Fe)return}r(Ue);const _e=await Y(await J.execute({...Ee.pushed,range:void 0},Ue)),Je=j(_e&&_e.rows||[],{...Ee.residual,whole:!0},V.compute||{});for(let $e=0;$e<Je.length;$e+=Fe)yield Je.slice($e,$e+Fe)}return Ct={...V,edit:ut,rowMutate:me,mode:"remote",fetch:ot,foregroundIdle:St,aggregate:at,countMatching:async he=>{const{plan:Se,signal:Ee}=await Ce(he);if(!Se.needsAll&&ee.total){r({signal:Ee});const Fe=await Y(await J.execute({...Se.pushed,range:{start:0,end:0}},{signal:Ee}));if(Fe&&typeof Fe.total=="number")return Fe.total}let Te=0;for await(const Fe of ce(he))Te+=Fe.length;return Te},streamMatching:ce,capabilitiesOf:y,planQuery:_,wireFilters:b,resolveAggregatePlan:he=>f(he,Le),STAT_PUSHDOWN:n,lastPlan:()=>pe?{...pe,...be?{aggregates:be}:{},...ge?{total:{deferred:!0,state:ge.state,value:ge.value}}:{}}:null,fullFrame:Ye,counts:()=>({match:ke,total:xe??null,pending:!!ge&&ge.state==="pending"}),grandTotals:()=>je},Ct}}),De("packages/core/src/source/remote.js",function(e,U){"use strict";Object.defineProperty(e,"PROTOCOL",{enumerable:!0,get:function(){return N}}),Object.defineProperty(e,"HINT_SETTLE_MS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"createRemoteSource",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"RemoteSource",{enumerable:!0,get:function(){return R}});const M=U("packages/core/src/internal/lru.js").Lru,B=U("packages/core/src/internal/predicates.js").isFunction,Z=U("packages/core/src/internal/warn.js").warnOnce,I=U("packages/core/src/internal/schedule.js").settleDebounce,G=U("packages/core/src/source/abort.js"),H=G.createAbortScope,S=G.isAbortError,O=U("packages/core/src/source/blockcache.js"),b=O.BlockCache,c=O.DEFAULT_PAGE_SIZE,f=O.DEFAULT_MAX_CACHED_PAGES,o=U("packages/core/src/source/rows.js"),n=o.createRowFactory,t=o.groupKey,i=U("packages/core/src/source/filterwire.js"),s=i.wireFilters,r=i.querySignature,u=i.warnHostFilterNotApplied,l=U("packages/core/src/source/pagewindow.js").pageWindow,y=U("packages/core/src/source/memory.js").MemorySource,v=U("packages/core/src/compute/handle.js").valueComparator,d=U("packages/core/src/compute/pivot.js"),p=d.pivotKey,g=d.joinPath,k=d.DEFAULT_PATH_SEPARATOR,E=U("packages/core/src/source/pushdown.js").UNGROUPED_LEVEL,N=1,x=120,_=1e3;function F($,T,A){for(let C=0;C<Math.max($.length,T.length);C++){const z=$[C],Y=T[C],q=z==null,V=Y==null;if(q||V){if(q&&V)continue;return q?1:-1}const J=A(z,Y);if(J!==0)return J}return 0}function L($,T){return new R($,T)}class j{constructor(T,A,C,z){this.path=T,this.keyPath=z||T,this.values=[],this.level=A,this.key=t(this.keyPath),this.cache=new b(C),this.count=null,this.complete=!1,this.announced=null,this.counting=!1,this.failed=!1,this.children=new Map,this.row=null,this.flat=!1}}class R{mode="remote";#e;#t;#n;#r;#s=new Map;#i=new Set;#o=H();#l;#a;#c=new Map;#u=[];#f=null;#d="";#h;#p=!1;#m=!1;#g=[];#b=!1;#y=0;#j="";#w=null;#O=-1;constructor(T,A){this.#e=T||{mode:"remote"},this.#t=A||{},B(this.#e.fullFrame)&&(this.filteredIndices=()=>this.#G(),this.unfilteredIndices=()=>this.#_(),this.handleFor=V=>this.#x(V),this.display=()=>this.#I(),this.grandTotalRow=()=>this.#D(),this.unfilteredRows=()=>this.#B(),this.facetIndices=V=>this.#Y(V));const C=this.#e.counts;B(C)&&(this.matchCount=()=>this.#K("match"),this.totalCount=()=>this.#K("total"));const z=this.#e.grandTotals;B(z)&&(this.grandTotalRow=()=>this.#H());const Y=this.#e.foregroundIdle;B(Y)&&(this.foregroundIdle=()=>this.#be(Y),this.#e.pageForegroundIdle=()=>this.#b?this.#be(Y):null);const q=this.#e;B(q.countMatching)&&B(q.streamMatching)&&(this.selectionQuery=()=>this.#fe(),this.countMatching=V=>q.countMatching(V),this.streamMatching=(V,J)=>q.streamMatching(V,J),this.loadedRows=()=>this.#pe(),this.resident=()=>this.#R()!==null),this.#n={pageSize:this.#e.pageSize||c,maxCachedPages:this.#e.maxCachedPages||f},this.#l=n(this.#t),this.#a=new M(this.#n.pageSize*4),this.#h=I((V,J)=>this.#P(V,J),x),this.#r=new j([],0,this.#n),this.#s.set(this.#r.key,this.#r),this.#d=this.#Oe(),B(this.#e.fetch)||Z("source.remote.fetch",'source.mode "remote" requires a fetch function; the grid will stay empty.'),this.#Le()}count(){const T=this.#S();return T?T.length:this.#v()}#v(){const T=this.#R();return T?T.count():(this.#X(),this.#re(this.#r))}#T(){if(this.#R())return!0;const T=A=>{if(A.count===null&&!A.complete)return!1;for(const C of A.children.values())if(this.#we(C.key)&&!T(C))return!1;return!0};return T(this.#r)}pageInfo(){const T=this.#S(),A=this.totalPending();if(!T){const C=this.#v();return{page:0,pageSize:0,total:this.#T()?C:null,pageCount:1,counting:A}}return{page:T.page,pageSize:T.pageSize,total:T.total,pageCount:T.pageCount,counting:A||T.total===null&&this.#o.size>0&&this.#r.cache.loadedExtent()===0}}#S(){const T=this.#v(),A=l(this.#C("pageSize",0),this.#C("page",0),T,this.#T());if(!A)return this.#j="",null;const C=`${this.#y}:${A.offset}:${A.length}`;return C!==this.#j&&!this.#p&&(this.#j=C,A.length>0&&!this.#R()&&this.#P(A.offset,A.offset+A.length-1)),A}at(T){const A=this.#S();if(A){if(T<0||T>=A.length)return;const C=this.#E(A.offset+T);return C&&(C.index=T),C}return this.#E(T)}#E(T){const A=this.#R();if(A)return A.at(T);if(this.#X(),T<0||T>=this.#v())return;const C=this.#V(this.#r,T);if(!C)return;const z=this.#q(C.node,C.local);return z&&(z.index=T),z||this.#l.skeleton(T,C.node.level,C.node.cache.erroredAt(C.local))}byKey(T){const A=this.#R();if(A)return A.byKey(T);const C=this.#c.get(T);if(!C)return;const z=C.lastIndexOf(":"),Y=this.#s.get(C.slice(0,z));return Y&&this.#q(Y,Number(C.slice(z+1)))||void 0}loaded(T){const A=this.#S();if(A){if(T<0||T>=A.length)return!1;T+=A.offset}const C=this.#R();if(C)return C.loaded(T);if(T<0||T>=this.#v())return!1;const z=this.#V(this.#r,T);return!!z&&z.node.cache.rowLoaded(z.local)}hint(T,A){if(this.#p)return;this.#b=!0;const C=this.#X();let z=Math.max(0,Math.floor(T)),Y=Math.max(z,Math.floor(A));const q=this.#S();if(q){if(q.length===0)return;z=q.offset,Y=q.offset+q.length-1}for(const[V,J]of this.#N(z,Y)){V.cache.protect(J.min,J.max);for(const ee of V.cache.evict())this.#Te(V,ee)}this.#h(z,Y),C&&this.#h.flush()}#N(T,A){const C=this.#v(),z=new Map;for(let Y=T;Y<=A&&Y<C;Y++){const q=this.#V(this.#r,Y);if(!q)continue;const V=z.get(q.node);V?(V.min=Math.min(V.min,q.local),V.max=Math.max(V.max,q.local)):z.set(q.node,{min:q.local,max:q.local})}return z.size||z.set(this.#r,{min:T,max:T}),z}#P(T,A){if(!this.#p)for(const[C,z]of this.#N(T,A)){C.cache.protect(z.min,z.max);const Y=C.cache.blockOf(z.min),q=C.cache.blockOf(z.max);for(let V=Y;V<=q&&!(C.count!==null&&V*C.cache.pageSize>=C.count);V++)C.cache.has(V)||this.#Be(C,V)}}apply(T){const A={added:[],updated:[],removed:[]};if(!T)return A;if(T.update)for(const C of T.update){const z=this.#c.get(this.#l.keyOf(C,-1));if(!z)continue;this.#a.delete(z);const Y=z.lastIndexOf(":"),q=this.#s.get(z.slice(0,Y));if(!q)continue;const V=Number(z.slice(Y+1)),J=q.cache.blockOf(V);if(!q.cache.loaded(J))continue;const{start:ee}=q.cache.rangeOf(J),ne=[];for(let re=ee;re<ee+q.cache.pageSize;re++){const ae=q.cache.rowAt(re);if(ae===void 0)break;ne.push(re===V?C:ae)}q.cache.fill(J,ne);const oe=this.#q(q,V);oe&&A.updated.push(oe)}return(T.add&&T.add.length||T.remove&&T.remove.length)&&this.reload({keepExpanded:!0}),A}reload(T){this.#o.abortAll("reload"),this.#h.cancel(),T&&T.keepExpanded===!1&&this.#i.clear(),this.#oe(),this.#W("model:changed",{reason:"reload"})}destroy(){this.#p=!0,this.#h.cancel(),this.#o.abortAll("destroyed"),this.#oe(),this.#s.clear(),this.#i.clear(),this.#w&&B(this.#w.destroy)&&this.#w.destroy(),this.#w=null}expand(T){this.#i.has(T)||(this.#i.add(T),this.#W("group:toggled",{key:T,expanded:!0}),this.#W("model:changed",{reason:"expand",key:T}))}collapse(T){this.#i.delete(T)&&(this.#W("group:toggled",{key:T,expanded:!1}),this.#W("model:changed",{reason:"collapse",key:T}))}expandedKeys(){return[...this.#i]}pivotFields(){return this.#u}pivot(){this.#X();const T=this.#f;if(!T||!T.keys.size||!this.#C("pivotBy",[]).length)return null;if(!T.result){const A=v((this.#t.config||{}).locale),C=[...T.keys.entries()].sort((Y,q)=>F(Y[1],q[1],A)),z=C.map(([Y])=>Y);T.result={keys:C.map(([,Y])=>Y),paths:z,fields:this.#ne(z),groupPaths:[],columns:z.length*Math.max(1,this.#Ee().length),values:T.cells,cells:T.cells,error:null}}return T.result}invalidateHandles(){this.#w&&(B(this.#w.invalidateHandles)&&this.#w.invalidateHandles(),B(this.#w.invalidate)&&this.#w.invalidate("filter"))}#M(){const T=this.#e.fullFrame;return B(T)?T():null}#R(){const T=this.#M();return T?(this.#w||(this.#w=new y({mode:"memory"},this.#L())),T.version!==this.#O&&(this.#w.setRows(T.rows),this.#O=T.version),this.#w):null}#L(){const T=this.#t,A=T.state||{};return{...T,state:{...A,page:()=>0,pageSize:()=>0}}}#G(){const T=this.#R();return T?T.filteredIndices():new Uint32Array(0)}#_(){const T=this.#R();return T?T.unfilteredIndices():new Uint32Array(0)}#x(T){const A=this.#R();return A?A.handleFor(T):void 0}#I(){const T=this.#R();return T?T.display():[]}#Y(T){const A=this.#R();return A&&B(A.facetIndices)?A.facetIndices(T):new Uint32Array(0)}#D(){const T=this.#R();return T&&B(T.grandTotalRow)?T.grandTotalRow():null}#K(T){const A=this.#R();if(A){const q=T==="match"?A.matchCount:A.totalCount;if(B(q))return q.call(A)}const C=this.#e.counts,z=B(C)?C():null,Y=z?z[T]:null;return typeof Y=="number"?Y:this.#v()}#H(){const T=this.#R();if(T&&B(T.grandTotalRow))return T.grandTotalRow();if((this.#t.config||{}).grandTotalRow!=="bottom")return null;const C=this.#e.grandTotals,z=B(C)?C():null;return!z||!z.totals?null:this.#l.grandTotal(z.totals,z.leafCount||0)}#B(){const T=this.#R();if(T&&B(T.unfilteredRows))return T.unfilteredRows();const A=[],C=this.count();for(let z=0;z<C;z++){const Y=this.at(z);Y&&A.push(Y)}return A}#fe(){const T=this.#C("quick",""),A={protocol:N,groupPath:[],groupValues:[],groupBy:[],totals:[],totalFns:{},pivotBy:[],pivotMode:!1,filters:s(this.#C("filters",null),this.#U()),sort:this.#C("sort",[]),context:this.#C("context",null)};T&&(A.quick=T);const C=this.#C("where",null);return C&&C.active&&(A.where=C),A}#pe(){const T=this.#C("groupBy",[]).length,A=[];for(const C of this.#s.values())if(!(C.level!==T&&!C.flat))for(const z of C.cache.ids()){if(!C.cache.loaded(z))continue;const{start:Y,end:q}=C.cache.rangeOf(z);for(let V=Y;V<q&&C.cache.rowLoaded(V);V++){const J=this.#q(C,V);J&&!J.group&&A.push(J)}}return A}loadedCount(){const T=this.#R();if(T){const z=T.matchCount();return typeof z=="number"?z:T.count()}this.#X();const A=this.#C("groupBy",[]).length;let C=0;for(const z of this.#s.values())if(!(z.level!==A&&!z.flat))for(const Y of z.cache.ids()){if(!z.cache.loaded(Y))continue;const q=z.cache.fillOf(Y);typeof q=="number"&&(C+=q)}return C}residentRows(){const T=this.#R();return T?T.display():this.#C("groupBy",[]).length>0?null:(this.#X(),this.#pe())}#ie(T,A,C){const{start:z,end:Y}=T.cache.rangeOf(A),q=this.#C("groupBy",[]),V=this.#C("pivotBy",[]),J=this.#C("quick",""),ee=this.#Ee(),ne={protocol:N,range:{start:z,end:Y},groupPath:T.path,groupValues:T.values,groupBy:q,totals:ee,totalFns:this.#ae(ee),pivotBy:V,pivotMode:V.length>0,filters:s(this.#C("filters",null),this.#U()),sort:this.#C("sort",[]),context:this.#C("context",null),signal:C};J&&(ne.quick=J);const oe=this.#C("where",null);return oe&&oe.active&&(ne.where=oe),ne}async#Be(T,A){if(!B(this.#e.fetch))return;if(!this.#m){this.#m=!0;const q=this.#g;this.#g=[],queueMicrotask(()=>{for(const V of q)V()})}const C=this.#o.begin(`${T.key}:${A}`);T.cache.begin(A,C);const z=this.#d,{start:Y}=T.cache.rangeOf(A);try{const q=await this.#e.fetch(this.#ie(T,A,C.signal));if(!C.current||z!==this.#d||this.#p)return;C.settle();const V=q&&q.rows||[];if(!!(q&&q[E])&&!T.flat){T.flat=!0,T.children.clear();for(const[oe,re]of[...this.#c])re.startsWith(`${T.key}:`)&&(this.#a.delete(re),this.#c.delete(oe))}T.cache.fill(A,V),T.failed=!1;for(let oe=0;oe<V.length;oe++)this.#a.delete(`${T.key}:${Y+oe}`);const ee=q&&typeof q.count=="number"?q.count:q&&typeof q.total=="number"?q.total:null,ne=q&&B(q.pendingTotal?.then)?q.pendingTotal:null;ee!==null?(T.count=ee,T.complete=!0):V.length<T.cache.pageSize?(T.count=Y+V.length,T.complete=!0):ne&&(T.counting=!0,T.announced=null),q&&Array.isArray(q.pivotFields)&&this.#Ae(q.pivotFields),q&&q.pivot&&typeof q.pivot=="object"&&this.#Ce(q.pivot),this.#W("model:changed",{reason:"page",groupPath:T.path,block:A}),this.#W("rows:changed",{companion:!0,reason:"page",groupPath:T.path,block:A}),this.#ge(T),ne&&this.#Se(T,ne,z)}catch(q){if(C.settle(),S(q))return;T.cache.failed(A,q),T.failed=!0;const{end:V}=T.cache.rangeOf(A);for(let J=Y;J<V;J++)this.#a.delete(`${T.key}:${J}`);this.#W("model:changed",{reason:"page-error",groupPath:T.path,block:A}),this.#W("source:error",{error:q,groupPath:T.path,block:A})}}async#Se(T,A,C){let z;try{z=await A}catch(Y){if(C!==this.#d||this.#p)return;T.counting=!1,S(Y)||(T.failed=!0),S(Y)||this.#W("source:error",{error:Y,groupPath:T.path});return}C!==this.#d||this.#p||(T.counting=!1,typeof z=="number"&&(T.count=z,T.complete=!0,this.#ge(T),this.#W("model:changed",{reason:"total",count:z,groupPath:T.path})))}#ge(T){typeof T.count!="number"||!T.complete||T.announced!==T.count&&(T.announced=T.count,this.#W("source:total",{total:T.count,groupPath:T.path}))}#be(T){if(this.#p)return null;this.#X();const A=this.#m?null:new Promise(V=>{this.#g.push(V),setTimeout(V,_)}),C=T();if(!A&&!C)return null;const z=(async()=>{A&&await A;for(let V=T();V;V=T())await V})();let Y;const q=new Promise(V=>{Y=setTimeout(V,_)});return Promise.race([z,q]).then(()=>clearTimeout(Y))}totalPending(){if(this.#r.failed)return!1;if(this.#r.counting===!0)return!0;if(this.#R())return!1;this.#X();const T=this.#r;return T.count===null&&!T.complete&&T.cache.loadedExtent()===0}totalFailed(){return this.#r.failed===!0}#Ae(T){T.length===this.#u.length&&T.every((A,C)=>A===this.#u[C])||(this.#u=T,this.#W("column:pivoted",{pivotFields:T,remote:!0}))}#Pe(){const T=this.#t.config||{};return T.pivot&&T.pivot.separator||k}#ne(T){const A=this.#Pe(),C=this.#Ee();if(!C.length)return T.slice();const z=[];for(const Y of T)for(const q of C)z.push(`${Y}${A}${q}`);return z}#Ce(T){const A=this.#Pe();this.#f||(this.#f={keys:new Map,cells:new Map,result:null});const C=this.#f;let z=!1;const Y=V=>{const J=Array.isArray(V)?V:[V],ee=g(J,A);return C.keys.has(ee)||(C.keys.set(ee,J),z=!0),ee},q=this.#C("groupBy",[]).length>0;for(const V of Array.isArray(T.axis)?T.axis:[])Y(V);for(const V of Array.isArray(T.cells)?T.cells:[]){if(!V||typeof V!="object")continue;const J=Y(V.pivot);if(q&&!(Array.isArray(V.group)&&V.group.length))continue;const ee=g(Array.isArray(V.group)?V.group:[],A);for(const[ne,oe]of Object.entries(V.values||{}))C.cells.set(p(ee,J,ne),oe)}C.result=null,z&&this.#Ae((this.pivot()||{fields:[]}).fields)}#re(T){let A=this.#J(T);for(const C of T.children.values())this.#we(C.key)&&(A+=this.#re(C));return A}#J(T){if(T.count!==null)return T.count;const A=T.cache.loadedExtent();return T.complete?A:T.row&&T.row.leafCount>0?T.level>=this.#C("groupBy",[]).length?Math.max(A,T.row.leafCount):A===0?1:Math.min(A+T.cache.pageSize,Math.max(A,T.row.leafCount)):A+T.cache.pageSize}#V(T,A){let C=A,z=0;const Y=[...T.children.entries()].filter(([,V])=>this.#we(V.key)).sort((V,J)=>V[0]-J[0]);for(const[V,J]of Y){const ee=V-z+1;if(C<ee)return{node:T,local:z+C};C-=ee,z=V+1;const ne=this.#re(J);if(C<ne)return this.#V(J,C);C-=ne}const q=this.#J(T);return z+C<q?{node:T,local:z+C}:null}#q(T,A){const C=`${T.key}:${A}`,z=this.#a.get(C);if(z)return z;const Y=T.cache.rowAt(A);if(Y===void 0)return null;const q=this.#C("groupBy",[]);let V;if(T.level<q.length&&!T.flat){const J=q[T.level],ee=this.#f!==null&&T.level===q.length-1&&this.#C("pivotBy",[]).length>0,ne=this.#ce(Y,J),oe=ne==null,re=[...T.path,oe?"":String(ne)],ae=[...T.keyPath,oe?null:String(ne)];if(V=this.#l.group({path:re,keyPath:ae,column:J,value:ne,level:T.level,parent:T.row,leafCount:Number(Y.leafCount)||0,expanded:ee?!1:this.#we(t(ae)),...ee?{hasChildren:!1}:{}}),V.totals=this.#F(Y),V.data=Y,!ee){let fe=this.#s.get(V.key);fe?fe.row=V:(fe=new j(re,T.level+1,this.#n,ae),fe.row=V,this.#s.set(fe.key,fe)),fe.values=[...T.values,ne],T.children.set(A,fe)}}else V=this.#l.leaf(Y,A,T.level,T.row);return this.#a.set(C,V),this.#c.set(V.key,C),V}#F(T){const A=T||{};if(A.totals&&typeof A.totals=="object")return A.totals;const C={};for(const z of this.#Ee())Object.hasOwn(A,z)&&(C[z]=A[z]);return C}#Te(T,A){const{start:C,end:z}=T.cache.rangeOf(A);for(let Y=C;Y<z;Y++){const q=`${T.key}:${Y}`,V=this.#a.peek(q);V&&this.#c.delete(V.key),this.#a.delete(q)}}#X(){const T=this.#Oe();return T===this.#d?!1:(this.#d=T,this.#o.abortAll("query"),this.#oe(),this.#m=!1,this.#W("model:changed",{reason:"query"}),!0)}#oe(){for(const T of this.#s.values())T.cache.clear(),T.count=null,T.complete=!1,T.announced=null,T.counting=!1,T.failed=!1,T.children.clear(),T.flat=!1;this.#a.clear(),this.#c.clear(),this.#y++,this.#f=null}#Oe(){const T=this.#C("where",null);return`${r({filters:this.#C("filters",null),sort:this.#C("sort",[]),quick:this.#C("quick",""),groupBy:this.#C("groupBy",[]),pivotBy:this.#C("pivotBy",[]),context:this.#C("context",null)})}|${T?T.version:0}`}#we(T){const A=this.#C("expanded",null);return A?B(A.has)?A.has(T):Array.prototype.includes.call(A,T):this.#i.has(T)}#Ee(){const T=this.#C("totals",[]);if(T&&T.length)return[...T];const A=this.#t.columns;return!A||!B(A.all)?[]:A.all().filter(C=>!!C.total).map(C=>C.id)}#ae(T){const A=this.#t.columns,C={};if(!A||!B(A.get))return C;for(const z of T){const Y=A.get(z);if(!Y)continue;const q=Y.groupTotal!=null?Y.groupTotal:Y.total;typeof q=="string"&&(C[z]=q)}return C}#ce(T,A){const C=this.#t.columns,z=C&&B(C.get)?C.get(A):void 0;return z&&B(z.getValue)?z.getValue(T):T?.[A]}#Le(){u(this.#t)}#U(){const T=this.#t.config||{};return{tz:T.timeZone,weekStartsOn:T.weekStartsOn}}#C(T,A){const C=this.#t.state;if(C&&B(C[T])){const z=C[T]();return z??A}return A}#W(T,A){const C=this.#t.emit;B(C)&&C(T,A)}}}),De("packages/core/src/source/gapbuffer.js",function(e,U){"use strict";Object.defineProperty(e,"GapBuffer",{enumerable:!0,get:function(){return M}});const te=64;class M{#e;#t=0;#n=0;constructor(B=te){this.#e=new Uint32Array(Math.max(1,B)),this.#n=this.#e.length}static from(B,D=te){const Z=new M(B.length+Math.max(1,D));return Z.#e.set(B,0),Z.#t=B.length,Z.#n=Z.#e.length,Z}get length(){return this.#t+(this.#e.length-this.#n)}get capacity(){return this.#e.length}at(B){return B<0||B>=this.length?0:B<this.#t?this.#e[B]:this.#e[B+(this.#n-this.#t)]}insert(B,D){const Z=B<0?0:B>this.length?this.length:B;this.#r(Z),this.#t===this.#n&&this.#s(),this.#e[this.#t++]=D}push(B){this.insert(this.length,B)}removeAt(B){return!Number.isInteger(B)||B<0||B>=this.length?!1:(this.#r(B),this.#n++,!0)}toArray(){const B=new Uint32Array(this.length);return B.set(this.#e.subarray(0,this.#t),0),B.set(this.#e.subarray(this.#n),this.#t),B}clear(){this.#t=0,this.#n=this.#e.length}#r(B){if(B!==this.#t)if(B<this.#t){const D=this.#t-B;this.#e.copyWithin(this.#n-D,B,this.#t),this.#t=B,this.#n-=D}else{const D=B-this.#t;this.#e.copyWithin(this.#t,this.#n,this.#n+D),this.#t=B,this.#n+=D}}#s(){const B=this.#e.length-this.#n,D=new Uint32Array(Math.max(this.#e.length*2,this.#e.length+te));D.set(this.#e.subarray(0,this.#t),0),D.set(this.#e.subarray(this.#n),D.length-B),this.#e=D,this.#n=D.length-B}}}),De("packages/core/src/store/ingest.js",function(e,U){"use strict";Object.defineProperty(e,"INGEST_DEFAULTS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"inferKind",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"decideText",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"createReaders",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"Ingest",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ingest",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingestSync",{enumerable:!0,get:function(){return s}});const te=U("packages/core/src/internal/schedule.js"),M=te.now,X=te.nextFrame,B=U("packages/core/src/internal/warn.js"),D=B.infoOnce,Z=B.warnOnce,I=U("packages/core/src/internal/predicates.js").isFunction,H=U("packages/core/src/internal/paths.js").pathGetter,O=U("packages/core/src/store/columnstore.js").ColumnStore,b=Object.freeze({chunkMs:8,chunkRows:512,sampleSize:100,dictionaryRatio:.1,columnarBelow:5e3,initialCapacity:1024});function c(r,u={}){if(u.multi)return"multi";if(r.length===0)return"object";let a=0,l=0,h=0,y=0,m=0;for(let d=0;d<r.length;d++){const p=r[d];typeof p=="number"?a++:typeof p=="boolean"?l++:typeof p=="string"?h++:p instanceof Date?y++:Array.isArray(p)&&m++}const v=r.length;return a===v?"float64":l===v?"bitset":y===v?"float64":h===v?"text":m===v?"multi":"object"}function f(r,u,a){return u<=0||r<a*u?"dictionary":"object"}function o(r,u,a){const l=new Map,h=new Map;for(const N of r){if(N.computed)continue;const x=I(N.read)?N.read:H(N.field||N.id);h.set(N.id,x),l.set(N.id,x)}const y=u?.order??[],m=u?.fns??{},v=u?.deps??{},d=u?.wrapDeps??null,p=y.filter(N=>I(m[N])),g=p.some(N=>v[N]==="*");let k=new WeakMap;const w=N=>{const x={};if(g)for(const[_,F]of h)x[_]=F(N);for(const _ of p){const F=v[_];let L;if(F==="*")L=x;else{L={};const j=F||[];for(let R=0;R<j.length;R++){const $=j[R];L[$]=$ in x?x[$]:h.get($)?.(N)}}x[_]=m[_](d?d(L,_):L,{data:N,row:null,column:null,grid:null,context:a})}return x},E=N=>{if(N===null||typeof N!="object"&&typeof N!="function")return w(N);let x=k.get(N);return x===void 0&&(x=w(N),k.set(N,x)),x};for(const N of p)l.set(N,x=>E(x)[N]);return{readers:l,reset(){k=new WeakMap}}}class n{spec;read;kind;inferred;nullable;candidate=!1;distinct=null;change=null;reason="";constructor(u,a){this.spec=u,this.read=a,this.kind="object",this.inferred=!1,this.nullable=u.nullable!==!1}}class t{#e;#t=[];#n=null;#r;#s=0;#i;#o=!1;#l=!1;#a=0;#c;constructor(u,a={},l={}){this.#e=Array.isArray(u)?u:Array.from(u||[]),this.#i={...b,...l};const h=a.columns??[];this.#r=o(h,a.computed??null,a.context),this.#c=this.#e.length>=this.#i.columnarBelow,this.#u(h,a.computed??null),this.#n=new O(this.#t.map(y=>({id:y.spec.id,kind:y.kind,nullable:y.nullable,read:y.read,dictionary:y.spec.dictionary})),{initialCapacity:this.#i.initialCapacity,columnarBelow:this.#i.columnarBelow})}get store(){return this.#n}get done(){return this.#o||this.#l}get progress(){return this.#s}slice(){if(this.done)return!1;if(this.#i.signal?.aborted)return this.#l=!0,!1;const u=M(),{chunkMs:a,chunkRows:l}=this.#i,h=this.#e.length;do{const y=Math.min(this.#s+l,h);this.#n.append(this.#e.slice(this.#s,y)),this.#f(this.#s,y),this.#s=y,this.#r.reset(),this.#h(!1)}while(this.#s<h&&M()-u<a);return this.#a+=M()-u,this.#i.onProgress?.({loaded:this.#s,total:h}),this.#s>=h?(this.#h(!0),this.#o=!0,!1):!0}cancel(){this.#l=!0}result(){return{store:this.#n,schema:this.#t.map(u=>({id:u.spec.id,kind:u.kind,nullable:u.nullable,read:u.read,dictionary:u.spec.dictionary})),decisions:this.#t.map(u=>({id:u.spec.id,kind:u.kind,nullable:u.nullable,inferred:u.inferred,distinct:u.candidate||u.change?this.#d(u):null,change:u.change,reason:u.reason})),count:this.#n.count,elapsed:this.#a,cancelled:this.#l}}#u(u,a){const l=this.#e,h=Math.min(this.#i.sampleSize,l.length),y=this.#i.dictionaryRatio,m=a?.pure instanceof Set?a.pure:new Set(a?.pure??a?.order??[]);for(const v of u){if(!v||!v.id)continue;if(v.computed&&(v.pure===!1||a&&!m.has(v.id))){Z(`ingest.impure.${v.id}`,`column "${v.id}" is an impure computed column and is not materialised into the store`);continue}const d=this.#r.readers.get(v.id)??(I(v.read)?v.read:H(v.field||v.id)),p=new n(v,d);if(v.kind)p.kind=v.kind,p.reason="declared by the caller";else if(v.dictionary)p.kind=v.multi?"multi":"dictionary",p.reason="value table supplied (lookup column)";else{const g=[];for(let w=0;w<h&&g.length<this.#i.sampleSize;w++){const E=d(l[w]);E!=null&&g.push(E)}p.inferred=!0;const k=c(g,{multi:v.multi});if(k==="text"){const w=new Set(g).size;p.kind=f(w,g.length,y),p.candidate=this.#c,p.reason=`sampled ${w} distinct in ${g.length}`}else p.kind=k,p.reason=`inferred from ${g.length} sampled values`,k==="object"&&g.length&&D(`ingest.mixed.${v.id}`,`column "${v.id}" holds mixed or unrecognised value types; storing as an object array. Declare a type to avoid this.`);p.kind==="object"&&p.candidate&&(p.distinct=new Set(g))}this.#t.push(p)}}#f(u,a){const l=this.#e;for(const h of this.#t){if(!h.candidate||!h.distinct)continue;const y=h.distinct;for(let m=u;m<a;m++){const v=h.read(l[m]);v!=null&&y.add(v)}}}#d(u){if(u.distinct)return u.distinct.size;const a=this.#n.column(u.spec.id);return a?.dict?a.dict.size:0}#h(u){const a=this.#i.dictionaryRatio,l=this.#e.length;for(const h of this.#t){if(!h.candidate)continue;const y=this.#d(h);if(h.kind==="dictionary"&&y>=a*l){const m=this.#n.column(h.spec.id);h.distinct=new Set(m?.dict?m.dict.values():[]),this.#n.convert(h.spec.id,"object"),h.kind="object",h.change="demoted",h.reason=`${y} distinct values is at or above ${a*100}% of ${l} rows`;continue}if(h.kind==="object"&&y>=a*l){h.candidate=!1,h.distinct=null,h.reason=`${y} distinct values is at or above ${a*100}% of ${l} rows`;continue}u&&h.kind==="object"&&y<a*l&&(this.#n.convert(h.spec.id,"dictionary"),h.kind="dictionary",h.change=h.change==="demoted"?null:"promoted",h.reason=`${y} distinct values is below ${a*100}% of ${l} rows`,h.distinct=null),u&&(h.candidate=!1)}}}async function i(r,u={},a={}){const l=new t(r,u,a),h=a.scheduler?.frame??X;for(;l.slice();)await new Promise(y=>{h(y)});return l.result()}function s(r,u={},a={}){const l=new t(r,u,{...a,chunkMs:1/0});for(;l.slice(););return l.result()}}),De("packages/core/src/store/columnpack.js",function(e,U){"use strict";Object.defineProperty(e,"isPortableSchema",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"packChunk",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"packedTransfers",{enumerable:!0,get:function(){return f}});const M=U("packages/core/src/internal/paths.js").pathGetter,X=U("packages/core/src/store/ingest.js"),B=X.inferKind,D=X.decideText,Z=X.INGEST_DEFAULTS,I=U("packages/core/src/store/columnstore.js").toFloat,G=new Set(["float64","int32","bitset","dictionary","object","multi"]);function H(o){if(!Array.isArray(o)||o.length===0)return!1;for(const n of o)if(!n||typeof n.id!="string"||typeof n.field!="string"||n.field===""||n.kind&&!G.has(n.kind))return!1;return!0}function S(o){const n=I(o);return Number.isFinite(n)?n|0:0}function O(o){return o==null?[]:Array.isArray(o)?o:[o]}function b(o,n,t,i){if(o.kind)return o.kind;const s=[];for(let a=0;a<n.length&&s.length<Z.sampleSize;a++){const l=n[a];l!=null&&s.push(l)}const r=B(s,{multi:o.multi});if(r!=="text")return r;const u=new Set(s).size;return D(u,s.length,i)}function c(o,n,t={}){const i=n.length|0,s=t.dictionaryRatio??Z.dictionaryRatio,r=[];for(const u of o){const a=M(u.field||u.id),l=u.nullable!==!1,h=new Array(i);for(let p=0;p<i;p++){const g=a(n[p]);h[p]=g===void 0?null:g}const y=b(u,h,i,s),m=l?new Uint8Array(i+7>>3):null,v=p=>{m&&(m[p>>3]|=1<<(p&7))};let d;switch(y){case"float64":{const p=new Float64Array(i);for(let g=0;g<i;g++){const k=h[g],w=k===null;w||v(g),p[g]=w?NaN:I(k)}d={id:u.id,kind:y,nullable:l,values:p,presence:m,offsets:null,table:null};break}case"int32":{const p=new Int32Array(i);for(let g=0;g<i;g++){const k=h[g],w=k===null;w||v(g),p[g]=w?0:S(k)}d={id:u.id,kind:y,nullable:l,values:p,presence:m,offsets:null,table:null};break}case"bitset":{const p=new Uint8Array(i+7>>3);for(let g=0;g<i;g++){const k=h[g],w=k===null;w||v(g),!w&&k&&(p[g>>3]|=1<<(g&7))}d={id:u.id,kind:y,nullable:l,values:p,presence:m,offsets:null,table:null};break}case"dictionary":{const p=new Uint32Array(i),g=[],k=new Map;for(let w=0;w<i;w++){const E=h[w];if(E===null){p[w]=0;continue}v(w);let N=k.get(E);N===void 0&&(N=g.length,g.push(E),k.set(E,N)),p[w]=N}d={id:u.id,kind:y,nullable:l,values:p,presence:m,offsets:null,table:g};break}case"multi":{const p=[],g=new Map,k=new Uint32Array(i+1),w=[];for(let E=0;E<i;E++){const N=h[E];k[E]=w.length,N===null||v(E);const _=O(N);for(let F=0;F<_.length;F++){const L=_[F];let j=g.get(L);j===void 0&&(j=p.length,p.push(L),g.set(L,j)),w.push(j)}}k[i]=w.length,d={id:u.id,kind:y,nullable:l,values:Int32Array.from(w),presence:m,offsets:k,table:p};break}default:{const p=new Array(i);for(let g=0;g<i;g++){const k=h[g];k!==null&&v(g),p[g]=k}d={id:u.id,kind:"object",nullable:l,values:p,presence:m,offsets:null,table:null};break}}r.push(d)}return{count:i,columns:r}}function f(o){const n=[];if(!o||!Array.isArray(o.columns))return n;const t=i=>{ArrayBuffer.isView(i)&&i.buffer&&!n.includes(i.buffer)&&n.push(i.buffer)};for(const i of o.columns)t(i.values),t(i.presence),t(i.offsets);return n}}),De("packages/core/src/source/stream.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PROMOTE_BELOW",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"createStreamSource",{enumerable:!0,get:function(){return L}}),Object.defineProperty(e,"StreamSource",{enumerable:!0,get:function(){return j}});const M=U("packages/core/src/internal/lru.js").Lru,B=U("packages/core/src/internal/predicates.js").isFunction,D=U("packages/core/src/internal/schedule.js"),Z=D.now,K=D.nextFrame,I=D.cancelFrame,G=D.whenIdle,S=U("packages/core/src/internal/compare.js").defaultCompare,O=U("packages/core/src/internal/warn.js"),b=O.warnOnce,c=O.infoOnce,o=U("packages/core/src/internal/paths.js").getPath,n=U("packages/core/src/source/abort.js"),t=n.createAbortScope,i=n.isAbortError,s=U("packages/core/src/source/rows.js"),r=s.createRowFactory,u=s.lazyRowView,l=U("packages/core/src/source/gapbuffer.js").GapBuffer,y=U("packages/core/src/source/memory.js").createMemorySource,v=U("packages/core/src/source/filterwire.js").querySignature,p=U("packages/core/src/store/columnpack.js").isPortableSchema,g=25e4,k=Symbol("lattice.stream.storeBacked"),w=8,E=.1,N=1e3,x=50;function _(R){return Math.min(N,Math.max(x,Math.floor(R/4)))}function F(R){if(R instanceof Date)return R.getTime();if(typeof R=="number")return Number.isFinite(R)?R:NaN;if(typeof R=="string"){const $=R.trim();if(!$)return NaN;const T=Date.parse($);return Number.isNaN(T)?Number($):T}return NaN}function L(R,$){return new j(R,$)}class j{mode="stream";writesStore=!0;#e;#t;#n=[];#r=null;#s=[];#i=null;#o;#l;#a=new Map;#c=t();#u={loaded:0,estimated:void 0};#f=null;#d=0;#h=0;#p=0;#m=0;#g=null;#b=null;#y=null;#j=!1;#w=!1;#O=!1;#v=!1;#T="";#S=0;#E=0;#N=0;#P=null;#M=1/0;#R=!1;#L=null;#G=null;#_=null;#x=null;#I=!1;#Y=0;#D=0;#K=!1;constructor($,T){this.#e=$||{mode:"stream"},this.#t=T||{},this.#o=r(this.#t),this.#l=new M(4096),this.#T=this.#Xe();const A=(this.#t.config||{}).ingest;this.#I=!!A&&A.retainSource===!1,B(this.#e.open)||b("source.stream.open",'source.mode "stream" requires an open function; the grid will stay empty.'),this.#e.autoStart!==!1&&queueMicrotask(()=>this.start());const C=Number(this.#e.poll);Number.isFinite(C)&&C>0&&(this.#x=setInterval(()=>{this.#v||this.reload()},C),this.#x&&B(this.#x.unref)&&this.#x.unref()),this.#B()}#H(){const $=Number(this.#e.maxAge);return Number.isFinite($)&&$>0?$:0}#B(){const $=this.#H();if(!$)return;const T=this.#e.ageBy;B(T)?this.#G=T:typeof T=="string"&&T?this.#G=A=>o(A,T):this.#G=null,this.#P=[],this.#L=setInterval(()=>{this.#v||this.#fe()&&(this.#X(),this.#me())},_($)),this.#L&&B(this.#L.unref)&&this.#L.unref()}#fe(){const $=this.#H();return!$||!this.#P?!1:this.#R?!0:this.#M<Date.now()-$*(1+E)}#pe($,T){if(!this.#P)return;const A=this.#G?F(this.#G(T)):Date.now();this.#P[$]=A,Number.isNaN(A)||(A<this.#M&&(this.#M=A),A<Date.now()-this.#H()&&(this.#R=!0))}#ie(){return this.#ye("groupBy",[]).length>0?!0:!!this.#ye("pivotMode",!1)&&this.#ye("pivotBy",[]).length>0}#Be(){if(this.#g||this.#v)return;const $=this.#ie();if($&&!this.#b){this.#b=y({mode:"memory",rows:this.#n},this.#Se()),this.#j=!1;return}!$&&this.#b&&(this.#b.destroy(),this.#b=null)}#Se(){if(this.#y)return this.#y;const $=this,T={liveIndices:()=>$.#ge(),live:A=>$.#n[A]!==void 0,source:A=>$.#Ie(A),get physical(){return $.#n.length}};return this.#I&&(T.column=A=>{const C=$.#t.store;return C&&B(C.column)?C.column(A):void 0}),this.#y=Object.create(this.#t,{store:{value:T,enumerable:!0,configurable:!0}}),this.#y}#ge(){const $=new Uint32Array(this.#n.length);let T=0;for(let A=0;A<this.#n.length;A++)this.#n[A]!==void 0&&($[T++]=A);return $.subarray(0,T)}#be(){return this.#g?this.#g:this.#b?(this.#j&&(this.#j=!1,this.#b.setRows(this.#n)),this.#b):null}invalidate($="filter"){if(this.#g){this.#g.invalidate($);return}this.#Be(),this.#b&&this.#b.invalidate($),($==="filter"||$==="sort")&&this.#Ee()}count(){const $=this.#be();return $?$.count():this.#r?this.#r.length:this.#S}matchCount(){const $=this.#be();return $&&B($.matchCount)?$.matchCount():this.#r?this.#r.length:this.#S}totalCount(){const $=this.#be();return $&&B($.totalCount)?$.totalCount():this.#S}unfilteredRows(){const $=this.#be();if($&&B($.unfilteredRows))return $.unfilteredRows();const T=[];for(let A=0;A<this.#n.length;A++){if(!this.#n[A])continue;const C=this.#ve(A);C&&T.push(C)}return T}at($){const T=this.#be();if(T)return T.at($);if($<0||$>=this.count())return;const A=this.#r?this.#r.at($):$,C=this.#ve(A);return C.index=$,C}byKey($){const T=this.#be();if(T)return T.byKey($);const A=this.#a.get($);return A===void 0?void 0:this.#ve(A)}leavesOf($){const T=this.#be();return T&&B(T.leavesOf)?T.leavesOf($):[]}loaded($){return $>=0&&$<this.count()}hint($,T){if(this.#g){this.#g.hint($,T);return}this.#Ae(),this.#p=Math.max(0,Math.floor($))}#Ae(){this.#v||this.#Xe()===this.#T||this.reload()}display(){const $=this.#be();return $?$.display():u(()=>this.count(),T=>this.at(T))}apply($){if(this.#g)return this.#g.apply($);const T={added:[],updated:[],removed:[]};if(!$)return T;if($.update){let A=!1;for(const C of $.update){const z=this.#a.get(this.#o.keyOf(C,-1));if(z===void 0)continue;const Y=this.#Le(z);this.#I?this.#k(z,C):this.#n[z]=C,this.#l.delete(z),this.#U(z,Y),this.#P&&(this.#pe(z,C),A=!0),this.#j=!0,T.updated.push(this.#ve(z))}A&&this.#X()}if($.add&&$.add.length){const A=this.#F($.add);for(const C of A)T.added.push(this.#ve(C))}return $.remove&&$.remove.length&&b("source.stream.remove","removing rows from a live stream is not supported; reload instead."),this.#me(),T}reload($){this.#c.abortAll("reload"),this.#Ue(),this.#b&&(this.#b.destroy(),this.#b=null),this.#j=!1,this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear(),this.#g=null,this.#S=0,this.#E=0,this.#N=0,this.#P&&(this.#P=[]),this.#M=1/0,this.#R=!1,this.#w=!1,this.#O=!1,this.#u={loaded:0,estimated:void 0},this.#T=this.#Xe(),this.#ke("model:changed",{reason:"reload"}),this.start()}destroy(){this.#v=!0,this.#x!==null&&(clearInterval(this.#x),this.#x=null),this.#L!==null&&(clearInterval(this.#L),this.#L=null),this.#P=null,this.#c.abortAll("destroyed"),this.#Ue(),this.#f!==null&&(this.#$e(this.#f),this.#f=null),this.#b&&(this.#b.destroy(),this.#b=null),this.#g&&this.#g.destroy(),this.#n=[],this.#r=null,this.#a.clear(),this.#l.clear()}async start(){if(this.#O||this.#v||!B(this.#e.open))return;this.#O=!0;const $=this.#c.begin("stream");this.#Ee(),this.#Be();let T;try{T=this.#e.open({sort:this.#ye("sort",[]),filters:this.#ye("filters",null),quick:this.#ye("quick","")||void 0,context:this.#ye("context",null),signal:$.signal})}catch(C){this.#ke("source:error",{error:C});return}const A=B(T[Symbol.asyncIterator])?T[Symbol.asyncIterator]():T[Symbol.iterator]();this.#_=A;try{for(;;){const C=await A.next();if(!$.current||this.#v)return;if(C.done){this.#se();return}if(await this.#Pe(C.value,$),!$.current||this.#v)return;if(C.value&&C.value.done){this.#se();return}if(await this.#le(),!$.current||this.#v)return}}catch(C){if(i(C))return;this.#ke("source:error",{error:C})}finally{$.settle()}}progress(){return{loaded:this.#u.loaded,estimated:this.#u.estimated,done:this.#w,live:this.#S,evicted:this.#E}}promoted(){return this.#g!==null}memorySource(){return this.#g}invalidateHandles(){const $=this.#be();$&&(B($.invalidateHandles)&&$.invalidateHandles(),B($.invalidate)&&$.invalidate("sort"))}renderCount(){return this.#d}ingestStats(){return{worker:this.#Y,inline:this.#D,storeBacked:this.#I}}#Pe($,T){if(!$)return;const A=$.rows;if(A&&A.length&&this.#Ce(A))return this.#J($,T);const C=Z();A&&A.length&&(this.#F(A),this.#D++),this.#ne($),this.#h+=Z()-C,this.#me()}#ne($){this.#u.loaded=$.progress&&typeof $.progress.loaded=="number"?$.progress.loaded:this.#n.length,$.progress&&typeof $.progress.estimated=="number"&&(this.#u.estimated=$.progress.estimated)}#Ce($){if(this.#K||this.#g)return!1;const T=this.#V();if(!T)return!1;const A=this.#t.store;if(!A||!B(A.appendPacked))return!1;const C=this.#q();return!C||!p(C)?(this.#K=!0,c("source.stream.ingest-worker","stream ingest.useWorker is on but a column reads through a closure (a computed or date column); columnizing on the main thread instead."),!1):$.length<T.threshold?!1:!this.#re($)}#re($){if(!this.#o.keyed)return!1;const T=new Set;for(let A=0;A<$.length;A++){const C=this.#o.keyOf($[A],this.#n.length+A);if(C!=null){if(T.has(C)||this.#a.has(C))return!0;T.add(C)}}return!1}async#J($,T){const A=$.rows,C=this.#V(),z=this.#q();let Y;try{Y=await C.columnize(z,A,{key:"ingest:stream",signal:T&&T.signal})}catch(ne){if(i(ne)||(b("source.stream.columnize","worker columnization failed; columnizing on the main thread",ne),this.#K=!0,T&&(!T.current||this.#v)))return;this.#F(A),this.#D++,this.#ne($),this.#me();return}if(T&&(!T.current||this.#v))return;const q=this.#t.store,V=this.#I?void 0:A,{from:J}=q.appendPacked(Y,V),ee=Y.count|0;for(let ne=0;ne<ee;ne++){const oe=J+ne,re=A[ne],ae=this.#o.keyed?this.#o.keyOf(re,oe):null;if(this.#n[oe]=this.#I?k:re,this.#S++,this.#pe(oe,re),ae!==null&&this.#a.set(ae,oe),!this.#r||!this.#ae(oe))continue;const fe=this.#C(oe);this.#r.insert(fe,oe),fe<=this.#p&&this.#m++}this.#j=!0,this.#X(),this.#Y++,this.#ne($),this.#me()}#V(){const $=this.#t.ingestWorker;return B($)?$():null}#q(){const $=this.#t.storeSchema;return B($)?$():null}#F($){const T=[],A=this.#t.store,C=new Array($.length),z=[],Y=new Set;for(let V=0;V<$.length;V++){const J=this.#o.keyed?this.#o.keyOf($[V],this.#n.length+z.length):null;C[V]=J,!(J!==null&&(this.#a.has(J)||Y.has(J)))&&(J!==null&&Y.add(J),z.push($[V]))}let q=z.length&&A&&B(A.append)?A.append(z).from:this.#n.length;for(let V=0;V<$.length;V++){const J=$[V],ee=C[V];if(ee!==null&&this.#a.has(ee)){const re=this.#a.get(ee),ae=this.#Le(re);this.#I||(this.#n[re]=J,A&&B(A.setSource)&&A.setSource(re,J)),this.#k(re,J),this.#l.delete(re),this.#pe(re,J),this.#U(re,ae);continue}const ne=q++;if(this.#n[ne]=this.#I?k:J,this.#S++,this.#pe(ne,J),ee!==null&&this.#a.set(ee,ne),T.push(ne),!this.#r||!this.#ae(ne))continue;const oe=this.#C(ne);this.#r.insert(oe,ne),oe<=this.#p&&this.#m++}return this.#j=!0,this.#X(),T}#Te($){const T=this.#n[$];let A=!1;if(this.#r){const q=this.#we($);q>=0&&q<=this.#p&&(A=!0)}else $<=this.#p&&(A=!0);const C=T===k?this.#Ie($):T,z=this.#o.keyed?this.#o.keyOf(C,$):null;z!==null&&this.#a.get(z)===$&&this.#a.delete(z),this.#n[$]=void 0,this.#P&&(this.#P[$]=NaN),this.#l.delete($);const Y=this.#t.store;return Y&&B(Y.remove)&&Y.remove($),this.#S--,A}#X(){let $=0,T=0;const A=this.#Oe();$+=A.dropped,T+=A.aboveAnchor;const C=this.#oe();$+=C.dropped,T+=C.aboveAnchor,$&&(this.#j=!0,this.#E+=$,this.#Ee(),this.#m-=T,this.#ke("stream:evicted",{evicted:$,total:this.#E,live:this.#S}))}#oe(){const $=this.#e.maxRows;if(!Number.isFinite($)||$<=0||this.#S<=$)return{dropped:0,aboveAnchor:0};const T=Math.max(1,Math.floor($*(1-E)));let A=0,C=0;for(;this.#S>T&&this.#N<this.#n.length;){const z=this.#N++;this.#n[z]!==void 0&&(this.#Te(z)&&C++,A++)}return{dropped:A,aboveAnchor:C}}#Oe(){const $=this.#H();if(!$||!this.#P||!this.#fe())return{dropped:0,aboveAnchor:0};const T=Date.now()-$;let A=0,C=0,z=1/0;for(let Y=this.#N;Y<this.#n.length;Y++){if(this.#n[Y]===void 0)continue;const q=this.#P[Y];if(!(Number.isNaN(q)||q===void 0)){if(q>=T){q<z&&(z=q);continue}this.#Te(Y)&&C++,A++}}for(this.#M=z,this.#R=!1;this.#N<this.#n.length&&this.#n[this.#N]===void 0;)this.#N++;return{dropped:A,aboveAnchor:C}}#we($){if(!this.#r)return $;for(let T=0;T<this.#r.length;T++)if(this.#r.at(T)===$)return T;return-1}#Ee(){this.#s=this.#ye("sort",[]),this.#i=this.#ye("filters",null);const $=Number.isFinite(this.#e.maxRows)&&this.#e.maxRows>0||this.#H()>0,T=this.#ye("where",null),A=(this.#t.config||{}).hostFilter,C=!!(T&&T.active)||!!(A&&B(A.active)&&A.active());if(!($||this.#s.length>0||!!this.#i||!!this.#ye("quick","")||C)){this.#r=null;return}this.#r=new l(Math.max(64,this.#n.length+64));for(let Y=0;Y<this.#n.length;Y++)this.#n[Y]!==void 0&&this.#ae(Y)&&this.#r.insert(this.#C(Y),Y)}#ae($){const T=this.#Ie($);if(this.#i&&!this.#ce(this.#i,T))return!1;const A=String(this.#ye("quick","")||"").toLowerCase();if(A&&!this.#at(T).includes(A))return!1;const C=(this.#t.config||{}).hostFilter;if(C&&B(C.active)&&C.active()&&!C.passes(this.#ve($)))return!1;const z=this.#ye("where",null);if(z&&z.active){const Y=this.#ve($);if(!z.passes(Y.data,Y.key))return!1}return!0}#ce($,T){if(!$)return!0;const A=$;if(Array.isArray(A.conditions))return A.op==="or"?A.conditions.some(Y=>this.#ce(Y,T)):A.op==="not"?!A.conditions.some(Y=>this.#ce(Y,T)):A.conditions.every(Y=>this.#ce(Y,T));const C=$,z=(this.#t.compute||{}).testValue;return B(z)?!!z(this.#Me(T,C.col),C,(this.#t.config||{}).locale):(b("source.stream.testValue","ctx.compute.testValue is unavailable; streamed rows are not filtered client-side."),!0)}#Le($){if(!this.#r)return-1;if(!this.#s.length)return this.#we($);let T=0,A=this.#r.length;for(;T<A;){const C=T+A>>>1;this.#W(this.#r.at(C),$)<0?T=C+1:A=C}for(let C=T;C<this.#r.length;C++){const z=this.#r.at(C);if(z===$)return C;if(this.#W(z,$)>0)break}return this.#we($)}#U($,T){if(!this.#r||!this.#s.length)return;const A=this.#ae($);if(T>=0&&this.#r.at(T)===$)this.#r.removeAt(T),T<=this.#p&&this.#m--;else if(T>=0)return;if(!A)return;const C=this.#C($);this.#r.insert(C,$),C<=this.#p&&this.#m++}#C($){if(!this.#r||!this.#s.length)return this.#r?this.#r.length:0;let T=0,A=this.#r.length;for(;T<A;){const C=T+A>>>1;this.#W($,this.#r.at(C))<0?A=C:T=C+1}return T}#W($,T){const A=this.#Ie($),C=this.#Ie(T);for(const z of this.#s){const Y=this.#Ve(z.col),q=this.#Me(A,z.col),V=this.#Me(C,z.col),ee=(Y&&Y.value&&B(Y.value.compare)?Y.value.compare:S)(q,V);if(ee!==0)return z.dir==="desc"?-ee:ee}return 0}#se(){this.#w=!0,this.#u.loaded=this.#u.loaded||this.#n.length;const $=typeof this.#e.promoteToMemoryBelow=="number"?this.#e.promoteToMemoryBelow:g;!this.#I&&this.#n.length<$&&(this.#g=y({mode:"memory",rows:this.#n},this.#t),this.#L!==null&&(clearInterval(this.#L),this.#L=null),this.#b&&(this.#b.destroy(),this.#b=null)),this.#me(),this.#ke("stream:end",{loaded:this.#n.length,promoted:this.#g!==null,threshold:$})}#me(){this.#f!==null||this.#v||(this.#f=this.#he(()=>{this.#f=null,this.#d++;const $=this.#m;this.#m=0,this.#h=0,this.#ke("stream:chunk",{loaded:this.#u.loaded,estimated:this.#u.estimated,count:this.count(),renders:this.#d}),this.#ke("model:changed",{reason:"stream",shiftAboveViewport:$,anchor:this.#p}),this.#ke("rows:changed",{companion:!0,reason:"stream"})}))}#le(){return this.#d===0||this.#h<this.#de()?Promise.resolve():(this.#h=0,new Promise($=>{const T=(this.#t.scheduler||{}).idle;B(T)?T(()=>$()):G(()=>$())}))}#de(){return typeof this.#e.coalesceMs=="number"&&this.#e.coalesceMs>0?this.#e.coalesceMs:w}#he($){const T=this.#t.scheduler||{};return B(T.frame)?T.frame($):K($)}#$e($){const T=this.#t.scheduler||{};B(T.cancel)?T.cancel($):I($)}#Ie($){const T=this.#n[$];if(T!==void 0&&T!==k)return T;if(T===void 0)return;const A=this.#t.store;return A&&B(A.source)?A.source($):void 0}#k($,T){const A=this.#t.store;if(!A||!B(A.set))return;const C=this.#q();if(Array.isArray(C))for(const z of C){if(!z||!z.id)continue;const Y=B(z.read)?z.read:q=>o(q,z.field||z.id);A.set(z.id,$,Y(T))}}#ve($){let T=this.#l.get($);return T||(T=this.#o.leaf(this.#Ie($),$),this.#l.set($,T)),T}#Me($,T){const A=this.#Ve(T);return A&&B(A.getValue)?A.getValue($):$?.[T]}#at($){const T=this.#t.columns,A=T&&B(T.all)?T.all():[],C=[];for(const z of A){const Y=B(z.getValue)?z.getValue($):void 0;Y!=null&&Y!==""&&C.push(String(Y))}return C.join(" ").toLowerCase()}#Ve($){const T=this.#t.columns;return T&&B(T.get)?T.get($):void 0}#Ue(){const $=this.#_;if(this.#_=null,$&&B($.return))try{$.return()}catch{}}#Xe(){return v({context:this.#ye("context",null)})}#ye($,T){const A=this.#t.state;if(A&&B(A[$])){const C=A[$]();return C??T}return T}#ke($,T){const A=this.#t.emit;B(A)&&A($,T)}}}),De("packages/core/src/source/url.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_URL_BATCH",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"createUrlSource",{enumerable:!0,get:function(){return b}});const M=U("packages/core/src/internal/warn.js").warnOnce,X=U("packages/core/src/internal/predicates.js"),B=X.isObject,D=X.isFunction,K=U("packages/core/src/internal/paths.js").getPath,G=U("packages/core/src/source/abort.js").isAbortError,H=500,S=new Set(["application/x-ndjson","application/ndjson","application/jsonlines","application/jsonl","application/x-jsonlines","text/x-ndjson"]),O=Symbol("lattice.url.skip");function b(m,v={}){const d=B(v)?v:{},p=D(d.fetch)?d.fetch:typeof globalThis<"u"&&D(globalThis.fetch)?globalThis.fetch:null,g=d.format==="json"||d.format==="ndjson"?d.format:void 0,k=typeof d.rowsPath=="string"&&d.rowsPath?d.rowsPath:void 0,w=D(d.map)?d.map:void 0,E=B(d.headers)?d.headers:void 0,N=Number.isFinite(d.batchSize)&&d.batchSize>0?Math.floor(d.batchSize):H,x=d.lenient===!0,_=Number.isFinite(d.poll)&&d.poll>0?Math.floor(d.poll):void 0,F=typeof m=="string"&&m.length>0;F||M("source.url.url","createUrlSource needs a URL string; the grid will stay empty.");async function*L(R={}){if(!F)return;if(!p)throw new Error("[lattice] createUrlSource: no fetch available — pass opts.fetch or run where globalThis.fetch exists.");const $=R&&R.signal;let T;try{T=await p(m,E?{signal:$,headers:E}:{signal:$})}catch(z){throw G(z)?z:new Error(`[lattice] createUrlSource: request to ${m} failed — ${z&&z.message||z}`)}if(!T||!T.ok){const z=T?T.status:"no response";throw new Error(`[lattice] createUrlSource: ${z} for ${m}`)}const A=c(m,g,T),C=T.body&&D(T.body.getReader)?T.body.getReader():null;try{if(!C){const q=await T.text();(A||n(q,m))==="ndjson"?yield*a(null,null,q,0,T,m,N,x):yield*u(q,m,k,w);return}const z=new TextDecoder("utf-8");if(A==="json"){yield*u(await r(C,z,""),m,k,w);return}if(A==="ndjson"){yield*a(C,z,"",0,T,m,N,x);return}const Y=await t(C,z,m);Y.format==="json"?yield*u(await r(C,z,Y.seed),m,k,w):yield*a(C,z,Y.seed,Y.bytes,T,m,N,x)}finally{if(C&&D(C.cancel))try{await C.cancel()}catch{}}}const j={mode:"stream",open:L,autoStart:d.autoStart!==!1};return _!==void 0&&(j.poll=_),Number.isFinite(d.maxRows)&&(j.maxRows=d.maxRows),Number.isFinite(d.maxAge)&&(j.maxAge=d.maxAge),(typeof d.ageBy=="string"||D(d.ageBy))&&(j.ageBy=d.ageBy),Number.isFinite(d.coalesceMs)&&(j.coalesceMs=d.coalesceMs),Number.isFinite(d.promoteToMemoryBelow)&&(j.promoteToMemoryBelow=d.promoteToMemoryBelow),j}function c(m,v,d){if(v)return v;const p=f(m);if(p)return p;const g=d&&d.headers&&D(d.headers.get)?d.headers.get("content-type"):null;return o(g)}function f(m){const v=String(m).split(/[?#]/)[0].toLowerCase();if(v.endsWith(".ndjson")||v.endsWith(".jsonl"))return"ndjson";if(v.endsWith(".json"))return"json"}function o(m){if(!m)return;const v=m.split(";")[0].trim().toLowerCase();if(S.has(v))return"ndjson";if(v==="application/json"||v==="text/json"||v.endsWith("+json"))return"json"}function n(m,v){const d=m.replace(/^\s+/,""),p=i(d);if(p==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${v} — pass opts.format: 'json' | 'ndjson'.`);return p}async function t(m,v,d){let p="",g=0;for(;;){const{value:w,done:E}=await m.read();if(w&&(g+=w.byteLength,p+=v.decode(w,{stream:!0})),E){p+=v.decode();break}const N=p.replace(/^\s+/,"");if(N){if(N[0]==="[")return{format:"json",seed:p,bytes:g};if(N[0]!=="{"||p.indexOf(`
8
8
  `)!==-1)break}}const k=i(p.replace(/^\s+/,""));if(k==="error")throw new Error(`[lattice] createUrlSource: could not tell JSON from NDJSON for ${d} — pass opts.format: 'json' | 'ndjson'.`);return{format:k,seed:p,bytes:g}}function i(m){if(!m||m[0]==="[")return"json";if(m[0]!=="{")return"error";const v=m.indexOf(`
9
9
  `);if(v===-1)return"json";let d=m.slice(0,v);return d.endsWith("\r")&&(d=d.slice(0,-1)),s(d)?"ndjson":"json"}function s(m){try{return JSON.parse(m),!0}catch{return!1}}async function r(m,v,d){let p=d;for(;;){const{value:g,done:k}=await m.read();if(g&&(p+=v.decode(g,{stream:!0})),k)break}return p+=v.decode(),p}function*u(m,v,d,p){let g;try{g=JSON.parse(m)}catch(w){throw new Error(`[lattice] createUrlSource: ${v} is not valid JSON — ${w.message}`)}let k=d!==void 0?K(g,d):g;if(p&&(k=p(k)),!Array.isArray(k)){const w=d!==void 0||p?"":"; pass opts.rowsPath or opts.map to select the array";throw new Error(`[lattice] createUrlSource: ${v} did not resolve to an array${w}.`)}yield{rows:k,progress:{loaded:k.length,estimated:k.length}}}async function*a(m,v,d,p,g,k,w,E){const N=y(g);let x=d||"",_=p||0,F=0,L=0,j=[];function*R(){let T;for(;(T=x.indexOf(`
10
10
  `))!==-1;){const A=x.slice(0,T);x=x.slice(T+1),L++;const C=l(A,L,k,E);C!==O&&(j.push(C),j.length>=w&&(F+=j.length,yield h(j,F,N,_),j=[]))}}if(m){for(;;){const{value:T,done:A}=await m.read();if(T&&(_+=T.byteLength,x+=v.decode(T,{stream:!0}),yield*R()),A)break}x+=v.decode()}yield*R(),L++;const $=l(x,L,k,E);$!==O&&j.push($),j.length&&(F+=j.length,yield h(j,F,N,_))}function l(m,v,d,p){let g=m;if(g.endsWith("\r")&&(g=g.slice(0,-1)),!g.trim())return O;try{return JSON.parse(g)}catch(k){if(p)return M(`source.url.badline.${d}`,`skipping a malformed NDJSON line (line ${v}) from ${d} — ${k.message}`),O;throw new Error(`[lattice] createUrlSource: malformed NDJSON at line ${v} of ${d} — ${k.message}`)}}function h(m,v,d,p){const g=d&&p>0&&v>0?Math.max(v,Math.round(d/(p/v))):void 0;return{rows:m,progress:{loaded:v,estimated:g}}}function y(m){const v=m&&m.headers&&D(m.headers.get)?m.headers.get("content-length"):null,d=v!=null?Number(v):NaN;return Number.isFinite(d)&&d>0?d:void 0}}),De("packages/core/src/source/derive.js",function(e,U){"use strict";Object.defineProperty(e,"FOLLOW_MODES",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"BUCKETS",{enumerable:!0,get:function(){return K}}),Object.defineProperty(e,"DERIVED_ROW_KEY",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"DERIVED_SOURCE_KEY",{enumerable:!0,get:function(){return G}}),Object.defineProperty(e,"UNION_KEY_SEP",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"readPath",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"unnest",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"bucketOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"reduceValues",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"applyLimit",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"applyCumulative",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"groupRows",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"finishGroups",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"derive",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"normalizeUnionSource",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"namespaceUnionKeys",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"joinRows",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"preGroup",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"buildJoinIndex",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"joinOne",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"joinKeyOf",{enumerable:!0,get:function(){return g}});const te=U("packages/core/src/internal/predicates.js"),M=te.isFunction,X=te.isObject,D=U("packages/core/src/compute/total.js").TOTAL_FNS,Z=Object.freeze(["filtered","all","selected","grouped"]),K=Object.freeze(["day","week","month","quarter","year"]),I="__key",G="__source",H="";function S(k,w){if(!X(k)||typeof w!="string")return;if(!w.includes("."))return k[w];let E=k;for(const N of w.split(".")){if(!X(E))return;E=E[N]}return E}function O(k,w){const E=[];for(const N of k){const x=S(N,w);if(!(!Array.isArray(x)||!x.length))for(const _ of x)E.push({...N,[w]:_})}return E}function b(k,w){const E=k instanceof Date?k:new Date(k),N=E.getTime();if(!Number.isFinite(N))return null;const x=E.getUTCFullYear(),_=E.getUTCMonth(),F=E.getUTCDate(),L=j=>j.toISOString().slice(0,10);switch(w){case"year":return L(new Date(Date.UTC(x,0,1)));case"quarter":return L(new Date(Date.UTC(x,Math.floor(_/3)*3,1)));case"month":return L(new Date(Date.UTC(x,_,1)));case"week":{const j=(E.getUTCDay()+6)%7;return L(new Date(Date.UTC(x,_,F-j)))}default:return L(new Date(Date.UTC(x,_,F)))}}function c(k,w,E){const N=w.map(x=>E&&E.of===x?b(S(k,x),E.by):S(k,x));return{key:N.map(x=>x==null?"\0":String(x)).join(""),values:N}}function f(k,w){const E=D[w];return E?E({get:N=>k[N]},t(k.length)):null}function o(k,w){return!w||typeof w.of!="string"||w.of===""||k&&k.includes(w.of)?k:[w.of,...k||[]]}function n(k,w){const E={},N=t(k.length);for(const[x,_]of Object.entries(w)){const F=_.fn||"count",L=D[F];if(!L){E[x]=null;continue}const j=_.of?k.map(R=>S(R,_.of)):[];E[x]=L({get:R=>j[R]},N)}return E}const t=(()=>{const k=new Map;return w=>{let E=k.get(w);if(!E){E=new Uint32Array(w);for(let N=0;N<w;N++)E[N]=N;k.size<512&&k.set(w,E)}return E}})();function i(k,w,E){if(!Number.isFinite(w)||w<=0)return k;if(!E)return k.slice(0,w);const N=new Map,x=[];for(const _ of k){const F=String(S(_,E)),L=N.get(F)||0;L>=w||(N.set(F,L+1),x.push(_))}return x}function s(k,w){const E=k.reduce((F,L)=>F+(Number(S(L,w.of))||0),0);if(!E)return k;const N=E*w.upTo;let x=0;const _=[];for(const F of k)if(_.push(F),x+=Number(S(F,w.of))||0,x>=N)break;return _}function r(k,w){return!Array.isArray(w)||!w.length?k:[...k].sort((E,N)=>{for(const x of w){const _=S(E,x.col),F=S(N,x.col);if(_===F)continue;return _==null?1:F==null?-1:((typeof _=="number"&&typeof F=="number"?_<F:String(_)<String(F))?-1:1)*(x.dir==="desc"?-1:1)}return 0})}function u(k,w,E){const N=w.groupBy?Array.isArray(w.groupBy)?w.groupBy:[w.groupBy]:null,x=X(w.bucket)?w.bucket:null,_=o(N,x),F=new Map,L=new Map;if(!_)return{groups:F,rowGroup:L};for(const j of k){const{key:R,values:$}=c(j,_,x);let T=F.get(R);T||(T={values:$,rows:new Map},F.set(R,T));const A=E(j);T.rows.set(A,j),L.set(A,R)}return{groups:F,rowGroup:L}}function a(k,w,E=null,N=null){const x=w.groupBy?Array.isArray(w.groupBy)?w.groupBy:[w.groupBy]:null,_=X(w.bucket)?w.bucket:null,F=o(x,_);let L=[...k.entries()].map(([j,R])=>{if(E&&N&&!N.has(j)){const T=E.get(j);if(T)return T}const $={[I]:j};return F.forEach((T,A)=>{$[T.includes(".")?T.split(".").pop():T]=R.values[A]}),Object.assign($,n([...R.rows.values()],w.select||{})),E&&E.set(j,$),$});return L=r(L,w.sort),X(w.cumulative)&&(L=s(L,w.cumulative)),i(L,w.limit,w.limitPer||null)}function l(k,w){const E=v(k,w),N=w.groupBy?Array.isArray(w.groupBy)?w.groupBy:[w.groupBy]:null,x=X(w.bucket)?w.bucket:null,_=o(N,x);let F;if(!_)F=E.map((L,j)=>({...L,[I]:String(S(L,w.rowKey||"id")??j)}));else{const L=new Map;for(const j of E){const{key:R,values:$}=c(j,_,x);let T=L.get(R);T||(T={values:$,rows:[]},L.set(R,T)),T.rows.push(j)}F=[...L.entries()].map(([j,R])=>{const $={[I]:j};return _.forEach((T,A)=>{$[T.includes(".")?T.split(".").pop():T]=R.values[A]}),Object.assign($,n(R.rows,w.select||{})),$})}return F=r(F,w.sort),X(w.cumulative)&&(F=s(F,w.cumulative)),i(F,w.limit,w.limitPer||null)}function h(k,w){const N=X(k)&&X(k.grid)?k:{grid:k};return{grid:X(N.grid)?N.grid:null,label:N.label!=null&&N.label!==""?String(N.label):String(w),follow:typeof N.follow=="string"?N.follow:void 0,map:M(N.map)?N.map:null}}function y(k){for(const w of k){const E=w[G];E!==void 0&&(w[I]=`${E}${H}${w[I]}`)}return k}function m(k,w){const E=w.on,N=X(E)?String(E.left||E.right||""):String(E||""),x=X(E)?String(E.right||E.left||""):String(E||"");if(!N||!x)return k;const _=w.index instanceof Map?w.index:d(Array.isArray(w.rows)?w.rows:[],x),F=Array.isArray(w.select)?w.select.map(String):null,L=w.prefix?String(w.prefix):"",j=String(w.type||"inner")==="left",R=[];for(const $ of k){const T=S($,N),A=T==null?void 0:_.get(String(T));if(!A){j&&R.push($);continue}const C={...$},z=F||Object.keys(A);for(const Y of z)!L&&Y===N||(C[L?L+Y:Y]=S(A,Y));R.push(C)}return R}function v(k,w){let E=Array.isArray(k)?k:[];return w.unnest&&(E=O(E,w.unnest)),X(w.join)&&(Array.isArray(w.join.rows)||w.join.index instanceof Map)&&(E=m(E,w.join)),M(w.where)&&(E=E.filter(N=>!!w.where(N))),E}function d(k,w){const E=new Map;for(const N of k){const x=S(N,w);if(x==null)continue;const _=String(x);E.has(_)||E.set(_,N)}return E}function p(k,w){const E=w.on,N=X(E)?String(E.left||E.right||""):String(E||""),x=X(E)?String(E.right||E.left||""):String(E||"");if(!N||!x)return k;const _=w.index instanceof Map?w.index:new Map,F=S(k,N),L=F==null?void 0:_.get(String(F));if(!L)return String(w.type||"inner")==="left"?k:null;const j=Array.isArray(w.select)?w.select.map(String):null,R=w.prefix?String(w.prefix):"",$={...k};for(const T of j||Object.keys(L))!R&&T===N||($[R?R+T:T]=S(L,T));return $}function g(k,w){const E=S(k,w);return E==null?null:String(E)}}),De("packages/core/src/source/derived.js",function(e,U){"use strict";Object.defineProperty(e,"IDLE_REFRESH_MS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"PROFILE_FIELDS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ALERT_THRESHOLDS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"STATISTICS_FNS",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"SERIES_METRICS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"PRODUCER_IGNORED_KEYS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"profileAlerts",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"DerivedSource",{enumerable:!0,get:function(){return g}}),Object.defineProperty(e,"createDerivedSource",{enumerable:!0,get:function(){return x}});const te=U("packages/core/src/internal/predicates.js"),M=te.isFunction,X=te.isObject,D=U("packages/core/src/internal/warn.js").warnOnce,K=U("packages/core/src/source/memory.js").MemorySource,G=U("packages/core/src/source/settle.js").isPipelineSettle,H=U("packages/core/src/source/derive.js"),S=H.derive,O=H.preGroup,b=H.groupRows,c=H.finishGroups,f=H.readPath,o=H.buildJoinIndex,n=H.joinOne,t=H.joinKeyOf,i=H.FOLLOW_MODES,s=H.DERIVED_ROW_KEY,r=H.DERIVED_SOURCE_KEY,u=H.normalizeUnionSource,a=H.namespaceUnionKeys,l=16,h=Object.freeze(["column","rows","present","missing","numeric","distinct","min","max","mean","median","q1","q3","iqr","stddev","outliers","alerts","alertCount"]),y=Object.freeze({missing:.2,cardinality:.9,skew:1,outliers:.05}),m=Object.freeze(["correlation","series","datasetVsDataset"]),v=Object.freeze(["n","first","last","change","changePercent","volatility","annualisedVolatility","growth","maxDrawdown","maxDrawdownFrom","maxDrawdownTo","autocorrelation","upDays","downDays"]),d=Object.freeze(["unnest","join","where","bucket","groupBy","select","sort","limit","limitPer","cumulative"]);function p(_,F={}){const L={...y,...X(F)?F:{}},j=ee=>typeof ee=="number"&&Number.isFinite(ee)?ee:null,R=j(_.rows)??0,$=j(_.numeric)??0,T=j(_.missing)??0,A=j(_.distinct),C=j(_.mean),z=j(_.median),Y=j(_.stddev),q=j(Array.isArray(_.outliers)?_.outliers.length:_.outliers),V=$>0,J=[];return A===0?["empty"]:(A===1&&J.push("constant"),R>0&&T/R>=L.missing&&J.push("high-missing"),!V&&A!==null&&R>1&&A===R&&T===0?J.push("unique"):A!==null&&R>0&&A/R>=L.cardinality&&J.push("high-cardinality"),V&&C!==null&&z!==null&&Y!==null&&Y>0&&Math.abs(3*(C-z)/Y)>=L.skew&&J.push("skewed"),V&&q!==null&&q/$>=L.outliers&&J.push("outliers"),J)}class g extends K{#e=null;#t={};#n=[];#r=null;#s=!1;#i={};#o=!1;#l=null;#a=null;#c=!1;#u=null;#f=!1;#d=null;constructor(F,L){super({mode:"memory",rows:[]},L),this.#i=L||{},this.#t=X(F)?F:{};const j=this.#t.from;if(Array.isArray(j)){if(this.#e=null,this.#d=this.#g(j),!this.#d.length){D("source.derived.from",'source.mode "derived" needs `from`: at least one grid to derive from.');return}this.#t.follow!==void 0&&D("source.derived.union.follow",'source.mode "derived": `follow` is ignored when `from` is a union of several grids (BACKLOG-0001045) — each entry carries its own `follow` instead.'),this.#t.crossFilter&&D("source.derived.union.crossfilter",'source.mode "derived": `crossFilter` is not supported when `from` is a union of several grids (BACKLOG-0001045) — it has no single target once there is more than one parent. Push a filter onto the individual source grid you mean instead.'),this.#t.statistics!==void 0&&(D("source.derived.union.statistics",'source.mode "derived": `statistics` is not supported when `from` is a union of several grids (BACKLOG-0001046) — a relational statistic reduces one grid\'s own columns, and a union has no single set of them. Derive the statistics of a single grid instead.'),this.#f=!0),this.#m(),this.#b(),this.refresh();return}if(this.#e=j||null,!this.#e){D("source.derived.from",'source.mode "derived" needs `from`: the grid to derive from.');return}this.#t.follow&&!i.includes(String(this.#t.follow))&&D(`source.derived.follow.${this.#t.follow}`,`unknown follow "${this.#t.follow}"; using "filtered". Known: ${i.join(", ")}.`),this.#h()||(this.#f=!0),this.#m(),this.#b(),this.refresh()}#h(){const F=this.#t.statistics;if(F===void 0)return!0;if(this.#t.profile!==void 0)return D("source.derived.producer.conflict",'source.mode "derived": `profile` and `statistics` are both terminal producers and cannot be used together — each replaces the pipeline with its own output builder. Declare one, or chain a second derived grid whose `from` is the first.'),!1;if(!X(F))return D("source.derived.statistics.shape",`source.mode "derived": \`statistics\` needs an object naming the statistic, e.g. \`{ fn: 'correlation', columns: ['a', 'b'] }\`. Known fn: ${m.join(", ")}.`),!1;const L=String(F.fn||"");return m.includes(L)?this.#p(L,F):(D(`source.derived.statistics.fn.${L}`,`source.mode "derived": unknown \`statistics.fn\` "${L}". Known: ${m.join(", ")}. Every *single-column* statistic is reached through \`select\` instead, e.g. \`select: { p95: { of: 'amount', fn: 'p95' } }\`.`),!1)}#p(F,L){if(F==="correlation"){if((Array.isArray(L.columns)?L.columns.filter(Boolean):[]).length<2)return D("source.derived.statistics.columns","source.mode \"derived\": `statistics: { fn: 'correlation' }` needs `columns`: at least two column ids to correlate pairwise."),!1;const R=L.orient===void 0?"pairs":String(L.orient);return R!=="pairs"&&R!=="matrix"&&D(`source.derived.statistics.orient.${R}`,`source.mode "derived": unknown \`statistics.orient\` "${R}" for \`fn: 'correlation'\`; using "pairs". Known: pairs, matrix.`),!0}return F==="series"?!L.of||!L.by?(D("source.derived.statistics.series","source.mode \"derived\": `statistics: { fn: 'series' }` needs both `of` (the column to summarise) and `by` (the column that orders it). `by` is never guessed — kernels see rows in arrival order, which is not the grid's sort."),!1):!0:X(L.with)?!0:(D("source.derived.statistics.with","source.mode \"derived\": `statistics: { fn: 'datasetVsDataset' }` needs `with`: the second grid to compare this one against."),!1)}#m(){const F=this.#t.statistics!==void 0?"statistics":this.#t.profile!==void 0?"profile":null;if(!F)return;const L=d.filter(j=>this.#t[j]!==void 0);L.length&&D(`source.derived.producer.ignored.${F}`,`source.mode "derived": \`${F}\` is a terminal producer and replaces the pipeline, so ${L.map(j=>`\`${j}\``).join(", ")} ${L.length>1?"are":"is"} ignored. Sort, filter or limit the derived grid itself, or chain a second derived grid whose \`from\` is this one.`)}#g(F){const L=this.#i&&this.#i.grid,j=new Set,R=[];return F.forEach(($,T)=>{const A=u($,T);if(j.has(A.label)&&D(`source.derived.union.label.${A.label}`,`source.mode "derived": two union sources share the label "${A.label}"; give each a distinct \`label\` or __source/__key will not distinguish them.`),j.add(A.label),!A.grid){D(`source.derived.union.missing.${A.label}`,`source.mode "derived": union source "${A.label}" has no grid and was skipped.`),R.push(A);return}if(L&&M(A.grid.on)){const C=w(L,A.grid,[A.label]);if(C){D(`source.derived.union.cycle.${A.label}`,`source.mode "derived": union source "${A.label}" was refused — it derives from the grid being derived, directly or through a chain (${C.join(" → ")}). Remove it from \`from\`.`),R.push({...A,grid:null});return}}R.push(A)}),R}#b(){if(this.#d){this.#j(),this.#w();return}const F=this.#e;if(!F||!M(F.on))return;const L=String(this.#t.follow||"filtered"),j=["rows:changed"];(L==="filtered"||L==="grouped")&&j.push("filter:changed","model:changed"),L==="selected"&&j.push("selection:changed"),L==="grouped"&&j.push("column:grouped");for(const R of j){const $=T=>{R==="rows:changed"&&k(T)||R==="model:changed"&&!G(T)||this.schedule(R==="rows:changed"?T:null)};F.on(R,$),this.#n.push(()=>M(F.off)&&F.off(R,$))}this.#w(),this.#y()}#y(){const F=this.#t.statistics,L=X(F)?F.with:null;if(!X(L)||!M(L.on))return;const j=L;for(const R of["rows:changed","filter:changed","model:changed"]){const $=T=>{R==="rows:changed"&&k(T)||R==="model:changed"&&!G(T)||this.schedule(null)};j.on(R,$),this.#n.push(()=>M(j.off)&&j.off(R,$))}}#j(){for(const F of this.#d){const L=F.grid;if(!L||!M(L.on))continue;const j=i.includes(String(F.follow))?String(F.follow):"filtered",R=["rows:changed"];(j==="filtered"||j==="grouped")&&R.push("filter:changed","model:changed"),j==="selected"&&R.push("selection:changed"),j==="grouped"&&R.push("column:grouped");for(const $ of R){const T=A=>{$==="rows:changed"&&k(A)||$==="model:changed"&&!G(A)||this.schedule(null)};L.on($,T),this.#n.push(()=>M(L.off)&&L.off($,T))}}}#w(){const F=this.#t.join,L=F&&F.with;if(!L||!M(L.on))return;const R=String(F.follow||"all")==="all"?["rows:changed"]:["rows:changed","filter:changed","model:changed"];for(const $ of R){const T=A=>{$==="rows:changed"&&k(A)||$==="model:changed"&&!G(A)||this.schedule({partner:!0})};L.on($,T),this.#n.push(()=>M(L.off)&&L.off($,T))}}#O(){const F=this.#t.join;if(!F||!F.with)return null;const L=F.on,j=X(L)?String(L.left||L.right||""):String(L||""),R=X(L)?String(L.right||L.left||""):String(L||"");return j&&R?{left:j,right:R}:null}#v(){const F=this.#O();if(!F)return this.#u=null,null;const L=this.#u;if(this.#u=o(this.#E(),F.right),!L)return null;const j=this.#t.join||{},R=Array.isArray(j.select)?j.select.map(String):null,$=C=>C?(R||Object.keys(C)).map(Y=>String(f(C,Y))).join(""):null,T=new Set,A=new Set;for(const[C,z]of this.#u)$(z)!==$(L.get(C))&&(T.add(C),L.has(C)||A.add(C));for(const C of L.keys())this.#u.has(C)||T.add(C);return{affected:T,gained:A}}#T(F,L){const j=this.#l;if(!j||!j.leftByJoinKey)return null;const R=[];for(const $ of F){const T=j.leftByJoinKey.get($);if(T)for(const A of T){const C=j.rowData.get(A);C!==void 0&&R.push({key:A,data:C})}}return this.#M({updated:R,added:[],removed:[]},L)}#S(F,L){if(!this.#l||!this.#l.leftByJoinKey||F.unnest||F.where||String(F.follow||"filtered")==="grouped")return!1;const j=F.join||{};return String(j.type||"inner")==="left"?!0:L.size===0}#E(){const F=this.#t.join,L=F&&F.with;if(!L||!L.rows)return[];const j=[],R=$=>{$.group||j.push(E($))};return String(F.follow||"all")==="filtered"&&M(L.rows.forEach)?L.rows.forEach(R):M(L.rows.forEachAll)&&L.rows.forEachAll(R),j}schedule(F){const L=this.#t.refresh===void 0?"idle":this.#t.refresh;if(L==="manual")return;if(L==="live"){this.refresh(F);return}const j=typeof L=="number"&&Number.isFinite(L)?L:l;if(this.#r){this.#c=!0;return}this.#c=!1,this.#r=setTimeout(()=>{this.#r=null,this.refresh(this.#c?null:F)},j)}refresh(F){if(!(this.#s||!this.#e&&!this.#d)){if(this.#o){D("source.derived.cycle","a derived grid is deriving from itself, directly or through a chain. The cycle was refused; check the `from` of each grid in the chain.");return}this.#o=!0;try{const L=this.#f?[]:this.#d?this.#t.profile?this.#Y():this.#I():this.#t.statistics!==void 0?this.#pe():this.#t.profile?this.#ge():this.#N(F);this.setRows(L),this.invalidate("filter"),M(this.#i.emit)&&this.#i.emit("rows:changed",{derived:!0},"derived")}finally{this.#o=!1}}}#N(F){const j=X(F)&&F.partner===!0?this.#v():null,R=this.#G();if(j&&this.#l){if(!j.affected.size)return c(this.#l.groups,R,this.#l.reduced,new Set);if(this.#S(R,j.gained)){const ne=this.#T(j.affected,R);if(ne)return c(this.#l.groups,R,this.#l.reduced,ne)}}const $=this.#P(R,F);if($&&this.#l){const ne=this.#M($,R);return c(this.#l.groups,R,this.#l.reduced,ne)}const T=O(this.#D(),R);if(this.#a=this.#L(),!R.groupBy)return this.#l=null,S(T,R);const A=this.#R(),{groups:C,rowGroup:z}=b(T,R,A),Y=new Map;for(const[ne,oe]of z){const re=C.get(oe);re&&Y.set(ne,re.rows.get(ne))}const q=new Map,V=this.#O(),J=new Map,ee=new Map;if(V)for(const[ne,oe]of Y){const re=t(oe,V.left);if(re===null)continue;J.set(ne,re);let ae=ee.get(re);ae||(ae=new Set,ee.set(re,ae)),ae.add(ne)}return this.#l={groups:C,rowGroup:z,rowData:Y,reduced:q,leftJoinKey:J,leftByJoinKey:ee},c(C,R,q,null)}#P(F,L){if(!this.#l||!F.groupBy||F.unnest||F.where||String(F.follow||"filtered")==="grouped"||X(F.join)&&F.join.with&&!(F.join.index instanceof Map)||!X(L))return null;const j=Array.isArray(L.updated)?L.updated:null,R=Array.isArray(L.added)?L.added:null,$=Array.isArray(L.removed)?L.removed:null;if(!j&&!R&&!$)return null;const T=this.#a;if(T&&T.size&&String(F.follow||"filtered")!=="all"){if(L.edit===!0&&Array.isArray(L.columns)){for(const A of L.columns)if(T.has(String(A)))return null}for(const A of j||[]){const C=A&&A.key,z=C===void 0?void 0:this.#l.rowData.get(String(C)),Y=E(A);for(const q of T)if(f(z,q)!==f(Y,q))return null}}return{updated:j||[],added:R||[],removed:$||[]}}#M(F,L){const j=this.#l,R=this.#R(),$=new Set,T=X(L.join)&&L.join.index instanceof Map?L.join:null,A=this.#O(),C=Y=>{const q=j.rowGroup.get(Y);if(q===void 0)return;$.add(q);const V=j.groups.get(q);if(V&&(V.rows.delete(Y),V.rows.size||j.groups.delete(q)),j.rowGroup.delete(Y),j.rowData.delete(Y),j.leftJoinKey){const J=j.leftJoinKey.get(Y);if(J!==void 0){const ee=j.leftByJoinKey.get(J);ee&&(ee.delete(Y),ee.size||j.leftByJoinKey.delete(J)),j.leftJoinKey.delete(Y)}}},z=Y=>{const q=T?n(Y,T):Y;if(!q)return;const V=R(q),J=b([q],L,R);for(const[ee,ne]of J.groups){let oe=j.groups.get(ee);oe||(oe={values:ne.values,rows:new Map},j.groups.set(ee,oe)),oe.rows.set(V,q),j.rowGroup.set(V,ee),$.add(ee)}if(j.rowData.set(V,q),A&&j.leftByJoinKey){const ee=t(q,A.left);if(ee!==null){j.leftJoinKey.set(V,ee);let ne=j.leftByJoinKey.get(ee);ne||(ne=new Set,j.leftByJoinKey.set(ee,ne)),ne.add(V)}}};for(const Y of F.removed)C(String(Y));for(const Y of F.updated)C(String(Y.key)),z(E(Y));for(const Y of F.added)z(E(Y));return $}#R(){const F=this.#e,L=F&&F.config&&F.config.rowKey||"id";return j=>String(f(j,typeof L=="string"?L:"id")??"")}#L(){const F=this.#e,L=F&&F.state&&M(F.state.get)?F.state.get():null,j=new Set,R=$=>{if($){if(Array.isArray($.conditions)){$.conditions.forEach(R);return}$.col&&j.add(String($.col))}};return L&&R(L.filters),j}#G(){let F=this.#t;if(F.join&&F.join.with&&(this.#u||this.#v(),F={...F,join:{...F.join,index:this.#u}}),this.#d||String(F.follow||"filtered")!=="grouped")return F;const L=this.#e,j=L&&L.state&&M(L.state.get)?L.state.get():null,R=j&&Array.isArray(j.group)?j.group:[];return R.length?{...F,groupBy:[...R]}:F}#_(){const F=[];for(const L of this.#d)if(L.grid)try{const j=i.includes(String(L.follow))?String(L.follow):"filtered",R=this.#x(L.grid,j);for(const $ of R){const T=L.map?L.map($):$;X(T)&&F.push({...T,[r]:L.label})}}catch(j){D(`source.derived.union.failed.${L.label}`,`source.mode "derived": union source "${L.label}" failed to read (${j&&j.message?j.message:j}) and was skipped this pass.`)}return F}#x(F,L){if(!F||!F.rows)return[];if(L==="all"){const R=[];return M(F.rows.forEachAll)&&F.rows.forEachAll($=>{$.group||R.push(E($))}),R}if(L==="selected")return(F.selection&&M(F.selection.rows)?F.selection.rows():[]).filter(Boolean).map(E);const j=[];return M(F.rows.forEach)&&F.rows.forEach(R=>{R.group||j.push(E(R))}),j}#I(){const F=this.#G(),L=this.#_(),j=S(L,F);return F.groupBy?j:a(j)}#Y(){return D("source.derived.union.profile",'source.mode "derived": `profile` is not supported when `from` is a union of several grids (BACKLOG-0001045); profile a single grid instead.'),[]}#D(){const F=this.#e,L=String(this.#t.follow||"filtered");if(!F||!F.rows)return[];if(L==="all"){const $=[];return M(F.rows.forEachAll)&&F.rows.forEachAll(T=>{T.group||$.push(E(T))}),$}if(L==="selected")return(F.selection&&M(F.selection.rows)?F.selection.rows():[]).filter(Boolean).map(E);const j=this.#K(),R=[];return j&&this.#H().length&&M(F.rows.forEachExcept)?(F.rows.forEachExcept(j,$=>{$.group||R.push(E($))}),R):(M(F.rows.forEach)&&F.rows.forEach($=>{$.group||R.push(E($))}),R)}#K(){const F=this.#t.crossFilter;if(!F||this.#d)return null;if(typeof F=="string")return F;if(F.col)return String(F.col);const L=this.#t.groupBy,j=Array.isArray(L)?L[0]:L;return j?String(j):null}#H(){const F=this.#K(),L=this.#e;if(!F||!L||!L.filters||!M(L.filters.get))return[];const j=N(L.filters.get(),F);return j?j.op==="in"&&Array.isArray(j.value)?j.value.map(String):j.op==="eq"&&j.value!==void 0?[String(j.value)]:[]:[]}#B(F){const L=this.#K(),j=this.#e;if(!L||!j||!j.filters||!M(j.filters.set))return;const R=this.#i.compute||{},$=M(j.filters.get)?j.filters.get():null,T=M(R.pruneColumn)?R.pruneColumn($,L):null;if(!F.length){j.filters.set(T||null);return}const A=F.length===1?{col:L,op:"eq",value:F[0]}:{col:L,op:"in",value:F.slice()},C=T?T.conditions&&T.op?T.conditions:[T]:[];j.filters.set(C.length?{op:"and",conditions:[...C,A]}:A)}crossFilter(){const F=this;return{enabled(){return!!F.#K()},column(){return F.#K()},get(){return F.#H()},set(L){const j=L==null?[]:(Array.isArray(L)?L:[L]).map(R=>String(R));F.#B(j)},toggle(L){const j=String(L),R=F.#H(),T=R.indexOf(j)>=0?R.filter(A=>A!==j):[...R,j];F.#B(T)},clear(){F.#B([])}}}#fe(F){const L=F&&F.rows;if(L&&M(L.matchCount)){const j=L.matchCount(),R=Number(j);if(j!==null&&Number.isFinite(R))return R}if(L&&M(L.count)){const j=Number(L.count());if(Number.isFinite(j))return j}return 0}#pe(){const F=this.#e,L=this.#t.statistics;if(!F||!F.statistics||!X(L))return[];switch(String(L.fn)){case"correlation":return this.#ie(F,L);case"series":return this.#Be(F,L);case"datasetVsDataset":return this.#Se(F,L);default:return[]}}#ie(F,L){const j=L.columns.filter(Boolean).map(String),R=this.#fe(F),$=(T,A)=>{const C=F.statistics.correlation(T,A);return typeof C=="number"&&Number.isFinite(C)?C:null};if(String(L.orient||"pairs")!=="matrix"){const T=[];for(let A=0;A<j.length;A++)for(let C=A+1;C<j.length;C++)T.push({[s]:`${j[A]}${j[C]}`,a:j[A],b:j[C],coefficient:$(j[A],j[C]),n:R});return T}return j.map(T=>{const A={[s]:T,column:T};for(const C of j)A[C]=T===C?1:$(T,C);return A.n=R,A})}#Be(F,L){const j=this.#fe(F),R={by:String(L.by)};L.periodsPerYear!==void 0&&(R.periodsPerYear=Number(L.periodsPerYear));const $=F.statistics.series(String(L.of),R)||{};return v.map(T=>({[s]:T,metric:T,value:$[T]??null,n:j}))}#Se(F,L){const j=L.with,R=Array.isArray(L.columns)?{columns:L.columns.map(String)}:void 0,$=F.statistics.datasetVsDataset(j,R);if(!X($))return[];const A=(Array.isArray($.ranked)?$.ranked:[]).map(Y=>({[s]:String(Y.column),column:Y.column,measure:Y.measure??null,magnitude:Y.magnitude??null,distance:Y.distance??null,direction:Y.direction??null,nA:Y.nA??null,nB:Y.nB??null,reliable:Y.reliable??null,unmatched:""})),C=$.unmatched,z=[["A",C&&C.onlyA],["B",C&&C.onlyB]];for(const[Y,q]of z)for(const V of q||[])A.push({[s]:`${Y}${V}`,column:V,measure:null,magnitude:null,distance:null,direction:null,nA:null,nB:null,reliable:!1,unmatched:Y});return A}#ge(){const F=this.#e;if(!F||!F.statistics||!M(F.statistics.profile))return[];const j=(Array.isArray(this.#t.profile)?this.#t.profile:[this.#t.profile]).filter(Boolean).map($=>{const T=F.statistics.profile(String($))||{},A={[s]:String($)};for(const z of h)A[z]=z==="column"?String($):T[z]??null;A.outliers=Array.isArray(T.outliers)?T.outliers.length:T.outliers??null;const C=p({...T,rows:A.rows,outliers:A.outliers,numeric:T.numeric},this.#t.alerts);return A.alerts=C.join(", "),A.alertCount=C.length,A});if(this.#t.orient!=="metrics")return j;const R=j[0];return R?h.filter($=>$!=="column").map($=>({[s]:$,metric:$,value:R[$]})):[]}apply(F){const L=["add","update","remove"],j=[];for(const R of L)for(const $ of F&&F[R]||[])j.push({operation:R,id:$&&$.id,reason:"derived-read-only"});return j.length&&D("source.derived.readonly","a derived grid is read-only: its rows are computed from another grid. Write to the source grid instead, and the derived one follows."),{added:[],updated:[],removed:[],rejected:j}}destroy(){this.#s=!0,this.#r&&(clearTimeout(this.#r),this.#r=null),this.#K()&&this.#H().length&&this.#B([]);for(const F of this.#n)try{F()}catch{}this.#n=[],this.#e=null,this.#d=null,super.destroy()}}function k(_){return X(_)&&_.companion===!0}function w(_,F,L,j=new Set){if(F===_)return L;if(j.has(F))return null;j.add(F);let R=null;try{R=M(F.config)?F.config():null}catch{R=null}const $=R&&X(R.source)?R.source:null;if(!$||$.mode!=="derived")return null;const T=$.from;if(Array.isArray(T)){for(let A=0;A<T.length;A++){const C=u(T[A],A);if(!C.grid||!M(C.grid.on))continue;const z=w(_,C.grid,[...L,C.label],j);if(z)return z}return null}return X(T)&&M(T.on)?w(_,T,[...L,"(from)"],j):null}function E(_){return X(_)&&"data"in _?_.data:_}function N(_,F){if(!_||typeof _!="object")return null;if(Array.isArray(_.conditions)){for(const j of _.conditions){const R=N(j,F);if(R)return R}return null}return _.col===F?_:null}function x(_,F){return new g(_,F)}}),De("packages/core/src/source/adapters/odata.js",function(e,U){"use strict";Object.defineProperty(e,"conditionToOData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"filtersToOData",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"odataAdapter",{enumerable:!0,get:function(){return h}});const M=U("packages/core/src/internal/warn.js").warnOnce,B=U("packages/core/src/source/filterwire.js").isGroup,D=Object.freeze(["eq","ne","gt","gte","lt","lte","contains","startsWith","endsWith","blank","notBlank","between","notBetween"]),Z=/^\d{4}-\d{2}-\d{2}$/,K=/^\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/,I=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$/;function G(y){const m=y instanceof Date?y:typeof y=="number"&&Number.isFinite(y)?new Date(y):typeof y=="string"&&I.test(y)?new Date(y):null;return m&&!Number.isNaN(m.getTime())?m:null}const H=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function S(y,m){throw typeof m=="string"&&H.test(m)?new Error(`odataAdapter: "${m}" needs a zone designator to be used as a ${y} value — add "Z" for UTC or a "+HH:MM"/"-HH:MM" offset. A date-time with no zone is ambiguous (whose local time?) and would otherwise silently become the wrong instant rather than the one intended.`):new Error(`odataAdapter: "${String(m)}" is not a usable ${y} value`)}function O(y){const m=G(y);return m||S("DateTimeOffset",y),m.toISOString()}function b(y){if(typeof y=="string"&&Z.test(y))return y;const m=G(y);return m||S("Date",y),m.toISOString().slice(0,10)}function c(y){if(typeof y=="string"&&K.test(y))return y.length===5?`${y}:00`:y;if(typeof y=="number"&&Number.isFinite(y)&&y>=0&&y<864e5){const m=Math.floor(y),v=d=>String(d).padStart(2,"0");return`${v(Math.floor(m/36e5))}:${v(Math.floor(m%36e5/6e4))}:${v(Math.floor(m%6e4/1e3))}`}throw new Error(`odataAdapter: "${String(y)}" is not a usable TimeOfDay value`)}const f=Object.freeze({timestamp:O,datetime:O,date:b,dateString:b,time:c}),o=200,n=1e3,t=Object.freeze({eq:"eq",ne:"ne",gt:"gt",gte:"ge",lt:"lt",lte:"le"});function i(y,m){if(y==null)return"null";const v=m&&f[String(m)];return v?v(y):typeof y=="number"||typeof y=="boolean"?String(y):y instanceof Date?y.toISOString():`'${String(y).replace(/'/g,"''")}'`}function s(y){const m=String(y),v=/^[A-Za-z_][A-Za-z0-9_]*$/;if(!m||!m.split("/").every(d=>v.test(d)))throw new Error(`odataAdapter: "${m}" is not a usable column name`);return m}const r=Object.freeze({lo:{incl:"ge",excl:"gt"},hi:{incl:"le",excl:"lt"}});function u(y){const m=s(y.col),v=String(y.op),d=y.type;if(t[v])return`${m} ${t[v]} ${i(y.value,d)}`;if(v==="contains")return`contains(${m},${i(y.value,d)})`;if(v==="startsWith")return`startswith(${m},${i(y.value,d)})`;if(v==="endsWith")return`endswith(${m},${i(y.value,d)})`;if(v==="blank")return`(${m} eq null)`;if(v==="notBlank")return`(${m} ne null)`;if(v==="between"||v==="notBetween"){const p=Array.isArray(y.value)?y.value:[y.value,y.value],g=String(y.bounds||"[]"),k=g.charAt(0)==="("?r.lo.excl:r.lo.incl,w=g.charAt(1)===")"?r.hi.excl:r.hi.incl,E=`(${m} ${k} ${i(p[0],d)} and ${m} ${w} ${i(p[1],d)})`;return v==="between"?E:`(${m} eq null or not ${E})`}return null}function a(y){const m=String(y&&y.op);throw M(`source.odata.filter.refuse.${m}`,`a "${m}" filter condition cannot be written as an OData $filter expression, so the request was refused rather than sent without it — silently dropping it would have matched more or fewer rows than the filter asked for. Route this condition through a source that can pushdown-split it as residual (source.filter capability), or drop it from the tree before building the URL.`),new Error(`odataAdapter: a "${m}" filter condition cannot be expressed in OData and was refused`)}function l(y){if(!y)return"";if(!B(y)){const d=u(y);return d===null?a(y):d}const m=String(y.op)==="or"?" or ":" and ",v=(y.conditions||[]).map(d=>{if(B(d))return l(d);const p=u(d);return p===null?a(d):p}).filter(Boolean);return v.length?v.length===1?v[0]:`(${v.join(m)})`:""}function h(y={}){const m=String(y.url||""),v=y.fetch||(typeof fetch=="function"?fetch:null),d=y.count!==!1,p=s(y.key||"id"),g=y.edit===!0;return{name:"odata",capabilities:{filter:"tree",operators:D,sort:"multi",quick:y.search===!0,range:!0,total:d,mutate:g?{update:!0,delete:!0,append:!0,returning:"row"}:!1},urlFor(k){const w=[],E=(x,_)=>w.push(`${x}=${encodeURIComponent(_)}`),N=l(k.filters);return N&&E("$filter",N),k.sort&&k.sort.length&&E("$orderby",k.sort.map(x=>`${s(x.col)}${x.dir==="desc"?" desc":" asc"}`).join(",")),k.range&&(E("$skip",String(k.range.start)),E("$top",String(k.range.end-k.range.start))),k.quick&&E("$search",`"${String(k.quick).replace(/"/g,"")}"`),d&&E("$count","true"),w.length?`${m}?${w.join("&")}`:m},async execute(k,w){if(!v)throw new Error("odataAdapter needs a fetch implementation");const E={Accept:"application/json",...y.headers||{}},N=w&&w.signal,x=async j=>{const R=await v(j,{headers:E,signal:N});if(!R.ok)throw new Error(`OData request failed: ${R.status}`);return R.json()};let _=await x(this.urlFor(k)),F=_.value||_.rows||[];const L=_["@odata.count"]??_.count;if(!k.range){let j=_["@odata.nextLink"];for(;j&&F.length<o*n;)_=await x(j),F=F.concat(_.value||_.rows||[]),j=_["@odata.nextLink"]}return L==null?(d&&M("source.odata.nocount",`${m} was asked for $count=true and answered without an @odata.count, so the grid has no total for this query and will scroll open-ended rather than present the page size as the whole. The endpoint does not support $count, or filters it out.`),{rows:F}):{rows:F,total:Number(L)}},urlForKey(k){return`${m}(${i(k)})`},async mutate(k,w){if(!v)throw new Error("odataAdapter needs a fetch implementation");if(!k||k.kind!=="update"&&k.kind!=="delete"&&k.kind!=="append")throw new Error(`odataAdapter: mutation kind "${k&&k.kind}" is not supported (update, delete and append are wired)`);const E={Accept:"application/json","Content-Type":"application/json",...y.headers||{}},N=w&&w.signal;if(k.kind==="delete"){const j=Array.isArray(k.keys)&&k.keys.length?k.keys[0]:k.key;if(j==null)throw new Error("odataAdapter: a delete needs a row key");const R=await v(this.urlForKey(j),{method:"DELETE",headers:E,signal:N});if(!R.ok)throw new Error(`OData delete failed: ${R.status}`);return{ok:!0}}if(k.kind==="append"){const j=Array.isArray(k.rows)?k.rows.filter(C=>C&&typeof C=="object"):[];if(j.length!==1)throw new Error("odataAdapter: an append needs exactly one row object (OData creates one entity per POST)");const R=await v(m,{method:"POST",headers:E,signal:N,body:JSON.stringify(j[0])});if(!R.ok)throw new Error(`OData add-row failed: ${R.status}`);const $=R.status===204?null:await R.json().catch(()=>null),T=$&&typeof $=="object"&&"value"in $?$.value:$;if(!T||typeof T!="object")throw new Error("odataAdapter: the POST returned no created entity to rekey the appended row by. Have the service return the created entity (Prefer: return=representation).");const A=T[p];if(A==null)throw new Error(`odataAdapter: the created entity carried no ${p} to rekey the appended row by.`);return{ok:!0,keys:[String(A)],rows:[T]}}const x=this.urlForKey(k.key),_=await v(x,{method:"PATCH",headers:E,signal:N,body:JSON.stringify(k.patch||{})});if(!_.ok)throw new Error(`OData update failed: ${_.status}`);if(_.status===204)return{ok:!0};const F=await _.json(),L=F&&typeof F=="object"&&"value"in F?F.value:F;return L==null?{ok:!0}:{ok:!0,rows:[L]}}}}}),De("packages/core/src/source/adapters/rest.js",function(e,U){"use strict";Object.defineProperty(e,"DEFAULT_PARAMS",{enumerable:!0,get:function(){return te}}),Object.defineProperty(e,"DEFAULT_VERBS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"restAdapter",{enumerable:!0,get:function(){return X}});const te=Object.freeze({offset:"offset",limit:"limit",sort:"sort",order:"order",filter:"filter",search:"q"}),M=Object.freeze({update:"PATCH",delete:"DELETE",append:"POST"});function X(B={}){const D=String(B.url||""),Z=B.fetch||(typeof fetch=="function"?fetch:null),K={...te,...B.params||{}},I=B.encodeFilter||(n=>JSON.stringify(n)),G=B.rows||(n=>Array.isArray(n)?n:n.rows||n.data||[]),H=B.total||((n,t)=>Array.isArray(n)?t.length:n.total??n.count??t.length),S=B.edit===!0,O=B.returning==="row"?"row":B.returning==="key"?"key":"none",b=B.keyField||"id",c=B.writeUrlFor||(n=>`${D}/${encodeURIComponent(String(n.key??(n.keys&&n.keys[0])))}`),f=B.encodeMutation||(n=>{const t=M[n.kind];if(n.kind==="update")return{method:t,url:c(n),headers:{"Content-Type":"application/json"},body:JSON.stringify(n.patch||{})};if(n.kind==="append"){const i=Array.isArray(n.rows)?n.rows:n.rows?[n.rows]:[];return{method:t,url:D,headers:{"Content-Type":"application/json"},body:JSON.stringify(i.length===1?i[0]:i)}}return{method:t,url:c(n)}}),o=B.writeRow||(n=>{if(n===null||typeof n!="object")return null;if(Array.isArray(n))return n.length?n[0]:null;const t=n;return t.row??t.data??n});return{name:"rest",capabilities:{range:!0,total:!0,sort:"multi",filter:!1,quick:!1,mutate:S?{update:!0,delete:!0,append:!0,returning:O}:!1,...B.capabilities||{},...B.operators?{filter:"tree",operators:B.operators}:{}},urlFor(n){const t=new URLSearchParams;n.range&&(t.set(K.offset,String(n.range.start)),t.set(K.limit,String(n.range.end-n.range.start))),n.sort&&n.sort.length&&(t.set(K.sort,n.sort.map(s=>s.col).join(",")),t.set(K.order,n.sort.map(s=>s.dir||"asc").join(","))),n.filters&&t.set(K.filter,I(n.filters)),n.quick&&t.set(K.search,String(n.quick));const i=t.toString();return i?`${D}?${i}`:D},async execute(n,t){if(!Z)throw new Error("restAdapter needs a fetch implementation");const i=await Z(this.urlFor(n),{headers:{Accept:"application/json",...B.headers||{}},signal:t&&t.signal});if(!i.ok)throw new Error(`request failed: ${i.status}`);const s=await i.json(),r=G(s);return{rows:r,total:H(s,r)}},writeUrlFor(n){return c(n)},encodeMutation(n){return f(n)},async mutate(n,t){if(!Z)throw new Error("restAdapter needs a fetch implementation");if(!n||n.kind!=="update"&&n.kind!=="delete"&&n.kind!=="append")throw new Error(`restAdapter: mutation kind "${n&&n.kind}" is not supported (update, delete and append are wired)`);const i=f(n);if(!i||!i.url||!i.method)throw new Error("restAdapter: encodeMutation must return { method, url }");const s={Accept:"application/json",...B.headers||{},...i.headers||{}},r=await Z(i.url,{method:i.method,headers:s,signal:t&&t.signal,...i.body!==void 0?{body:i.body}:{}});if(!r.ok)throw new Error(`REST ${n.kind} failed: ${r.status}`);if(n.kind==="append"){if(O==="none")return{ok:!0};if(r.status===204)throw new Error("restAdapter: the add-row POST returned 204 with no body, so the appended row has no server key to rekey by. Declare returning: 'row'/'key' and have the endpoint return the created row.");const l=await r.json(),h=o(l),y=h&&typeof h=="object"?h[b]:void 0;if(y==null)throw new Error(`restAdapter: the add-row response carried no ${b} to rekey the appended row by. Point \`keyField\` at the primary key the endpoint returns, or override \`writeRow\`.`);return O==="row"?{ok:!0,keys:[String(y)],rows:[h]}:{ok:!0,keys:[String(y)]}}if(O!=="row"||r.status===204)return{ok:!0};const u=await r.json(),a=o(u);return a==null?{ok:!0}:{ok:!0,rows:[a]}}}}}),De("packages/core/src/source/adapters/dfql.js",function(e,U){"use strict";Object.defineProperty(e,"DFQL_BASE",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"DFQL_WRITE_URL",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(e,"dfqlAdapter",{enumerable:!0,get:function(){return S}});const M=U("packages/core/src/internal/predicates.js").isFunction,B=U("packages/core/src/internal/warn.js").warnOnce,D="https://rest.demandflow.com",Z="https://stream.demandflow.com/dfql",K=Object.freeze(["id","created","updated","ownerId","entity"]);function I(O){const b={},c=[];for(const[f,o]of Object.entries(O||{})){if(K.includes(f)){c.push(f);continue}b[f]=o}return c.length&&B("source.dfql.protected",`a DFQL update tried to write protected field(s) ${c.join(", ")}; they are server-assigned and immutable, so they were dropped from the PATCH.`),b}function G(O){if(!O||typeof O!="object"||Array.isArray(O))return["fields (must be an object)"];const b=O,c=[];return(typeof b.entity!="string"||!b.entity)&&c.push("entity (uppercase code)"),Number.isFinite(Number(b.level))||c.push("level (numeric)"),(typeof b.comboKey!="string"||!b.comboKey.endsWith("|ENT:"))&&c.push("comboKey (a string ending '|ENT:')"),c}async function H(O){const b=[],c=t=>{const i=t.trim();if(i)try{b.push(JSON.parse(i))}catch{}};if(!O.body||typeof O.body.getReader!="function")return(await O.text()).split(`