@toclocoinc/lattice-grid 1.71.0 → 1.71.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +1 -1
  3. package/angular/package.json +1 -1
  4. package/docs/API.html +73 -15
  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/charts.html +70 -12
  9. package/docs/api/data-router.html +1 -1
  10. package/docs/api/gantt.html +1 -1
  11. package/docs/api/grid.html +2 -2
  12. package/docs/api/index.html +2 -2
  13. package/docs/api/kanban.html +1 -1
  14. package/docs/api/kpi.html +1 -1
  15. package/docs/api/layout.html +1 -1
  16. package/docs/api/mock-socket.html +1 -1
  17. package/docs/api/tabs.html +1 -1
  18. package/docs/api/types.html +1 -1
  19. package/docs/api-detail.html +4 -4
  20. package/docs/warnings.json +13 -2
  21. package/lattice-grid.d.ts +53 -7
  22. package/lattice-grid.esm.min.js +3 -3
  23. package/lattice-grid.min.cjs +3 -3
  24. package/lattice-grid.min.js +3 -3
  25. package/modules/ai.d.ts +1 -1
  26. package/modules/ai.esm.min.js +2 -2
  27. package/modules/ai.min.cjs +2 -2
  28. package/modules/ai.min.js +2 -2
  29. package/modules/alarms.d.ts +1 -1
  30. package/modules/alarms.esm.min.js +2 -2
  31. package/modules/alarms.min.cjs +2 -2
  32. package/modules/alarms.min.js +2 -2
  33. package/modules/angular.d.ts +1 -1
  34. package/modules/angular.esm.min.js +2 -2
  35. package/modules/angular.min.cjs +2 -2
  36. package/modules/angular.min.js +2 -2
  37. package/modules/chart-alluvial.d.ts +1 -1
  38. package/modules/chart-alluvial.esm.min.js +1 -1
  39. package/modules/chart-alluvial.min.cjs +1 -1
  40. package/modules/chart-alluvial.min.js +1 -1
  41. package/modules/chart-arc.d.ts +1 -1
  42. package/modules/chart-arc.esm.min.js +1 -1
  43. package/modules/chart-arc.min.cjs +1 -1
  44. package/modules/chart-arc.min.js +1 -1
  45. package/modules/chart-bubblemap.d.ts +1 -1
  46. package/modules/chart-bubblemap.esm.min.js +1 -1
  47. package/modules/chart-bubblemap.min.cjs +1 -1
  48. package/modules/chart-bubblemap.min.js +1 -1
  49. package/modules/chart-bump.d.ts +1 -1
  50. package/modules/chart-bump.esm.min.js +1 -1
  51. package/modules/chart-bump.min.cjs +1 -1
  52. package/modules/chart-bump.min.js +1 -1
  53. package/modules/chart-calendar.d.ts +1 -1
  54. package/modules/chart-calendar.esm.min.js +1 -1
  55. package/modules/chart-calendar.min.cjs +1 -1
  56. package/modules/chart-calendar.min.js +1 -1
  57. package/modules/chart-decomposition.d.ts +1 -1
  58. package/modules/chart-decomposition.esm.min.js +1 -1
  59. package/modules/chart-decomposition.min.cjs +1 -1
  60. package/modules/chart-decomposition.min.js +1 -1
  61. package/modules/chart-diverging.d.ts +1 -1
  62. package/modules/chart-diverging.esm.min.js +1 -1
  63. package/modules/chart-diverging.min.cjs +1 -1
  64. package/modules/chart-diverging.min.js +1 -1
  65. package/modules/chart-dumbbell.d.ts +1 -1
  66. package/modules/chart-dumbbell.esm.min.js +1 -1
  67. package/modules/chart-dumbbell.min.cjs +1 -1
  68. package/modules/chart-dumbbell.min.js +1 -1
  69. package/modules/chart-fan.d.ts +1 -1
  70. package/modules/chart-fan.esm.min.js +1 -1
  71. package/modules/chart-fan.min.cjs +1 -1
  72. package/modules/chart-fan.min.js +1 -1
  73. package/modules/chart-hexbin.d.ts +1 -1
  74. package/modules/chart-hexbin.esm.min.js +1 -1
  75. package/modules/chart-hexbin.min.cjs +1 -1
  76. package/modules/chart-hexbin.min.js +1 -1
  77. package/modules/chart-hexmap.d.ts +1 -1
  78. package/modules/chart-hexmap.esm.min.js +1 -1
  79. package/modules/chart-hexmap.min.cjs +1 -1
  80. package/modules/chart-hexmap.min.js +1 -1
  81. package/modules/chart-icicle.d.ts +1 -1
  82. package/modules/chart-icicle.esm.min.js +1 -1
  83. package/modules/chart-icicle.min.cjs +1 -1
  84. package/modules/chart-icicle.min.js +1 -1
  85. package/modules/chart-markermap.d.ts +1 -1
  86. package/modules/chart-markermap.esm.min.js +1 -1
  87. package/modules/chart-markermap.min.cjs +1 -1
  88. package/modules/chart-markermap.min.js +1 -1
  89. package/modules/chart-parallel.d.ts +1 -1
  90. package/modules/chart-parallel.esm.min.js +1 -1
  91. package/modules/chart-parallel.min.cjs +1 -1
  92. package/modules/chart-parallel.min.js +1 -1
  93. package/modules/chart-ridgeline.d.ts +1 -1
  94. package/modules/chart-ridgeline.esm.min.js +1 -1
  95. package/modules/chart-ridgeline.min.cjs +1 -1
  96. package/modules/chart-ridgeline.min.js +1 -1
  97. package/modules/chart-roc.d.ts +1 -1
  98. package/modules/chart-roc.esm.min.js +1 -1
  99. package/modules/chart-roc.min.cjs +1 -1
  100. package/modules/chart-roc.min.js +1 -1
  101. package/modules/chart-slope.d.ts +1 -1
  102. package/modules/chart-slope.esm.min.js +1 -1
  103. package/modules/chart-slope.min.cjs +1 -1
  104. package/modules/chart-slope.min.js +1 -1
  105. package/modules/chart-splom.d.ts +1 -1
  106. package/modules/chart-splom.esm.min.js +1 -1
  107. package/modules/chart-splom.min.cjs +1 -1
  108. package/modules/chart-splom.min.js +1 -1
  109. package/modules/chart-waffle.d.ts +1 -1
  110. package/modules/chart-waffle.esm.min.js +1 -1
  111. package/modules/chart-waffle.min.cjs +1 -1
  112. package/modules/chart-waffle.min.js +1 -1
  113. package/modules/charts.d.ts +1 -1
  114. package/modules/charts.esm.min.js +141 -137
  115. package/modules/charts.esm.min.js.map +2 -2
  116. package/modules/charts.min.cjs +141 -137
  117. package/modules/charts.min.js +141 -137
  118. package/modules/charts.min.js.map +2 -2
  119. package/modules/data-router.d.ts +1 -1
  120. package/modules/data-router.esm.min.js +2 -2
  121. package/modules/data-router.min.cjs +2 -2
  122. package/modules/data-router.min.js +2 -2
  123. package/modules/devtools.d.ts +1 -1
  124. package/modules/devtools.esm.min.js +1 -1
  125. package/modules/devtools.min.cjs +1 -1
  126. package/modules/devtools.min.js +1 -1
  127. package/modules/dhtmlx-compat.d.ts +1 -1
  128. package/modules/dhtmlx-compat.esm.min.js +2 -2
  129. package/modules/dhtmlx-compat.min.cjs +2 -2
  130. package/modules/dhtmlx-compat.min.js +2 -2
  131. package/modules/gantt.d.ts +1 -1
  132. package/modules/gantt.esm.min.js +2 -2
  133. package/modules/gantt.min.cjs +2 -2
  134. package/modules/gantt.min.js +2 -2
  135. package/modules/geo-europe-nuts.d.ts +1 -1
  136. package/modules/geo-europe-nuts.esm.min.js +1 -1
  137. package/modules/geo-europe-nuts.min.cjs +8 -0
  138. package/modules/geo-europe-nuts.min.js +8 -0
  139. package/modules/geo-europe-nuts.min.js.map +6 -0
  140. package/modules/geo-uk.d.ts +1 -1
  141. package/modules/geo-uk.esm.min.js +1 -1
  142. package/modules/geo-uk.min.cjs +8 -0
  143. package/modules/geo-uk.min.js +8 -0
  144. package/modules/geo-uk.min.js.map +6 -0
  145. package/modules/geo-us-states.d.ts +1 -1
  146. package/modules/geo-us-states.esm.min.js +1 -1
  147. package/modules/geo-us-states.min.cjs +8 -0
  148. package/modules/geo-us-states.min.js +8 -0
  149. package/modules/geo-us-states.min.js.map +6 -0
  150. package/modules/geo-world-110m.d.ts +1 -1
  151. package/modules/geo-world-110m.esm.min.js +1 -1
  152. package/modules/geo-world-110m.min.cjs +8 -0
  153. package/modules/geo-world-110m.min.js +8 -0
  154. package/modules/geo-world-110m.min.js.map +6 -0
  155. package/modules/geo-world-50m.d.ts +1 -1
  156. package/modules/geo-world-50m.esm.min.js +1 -1
  157. package/modules/geo-world-50m.min.cjs +8 -0
  158. package/modules/geo-world-50m.min.js +8 -0
  159. package/modules/geo-world-50m.min.js.map +6 -0
  160. package/modules/htmx.d.ts +1 -1
  161. package/modules/htmx.esm.min.js +3 -3
  162. package/modules/htmx.min.cjs +3 -3
  163. package/modules/htmx.min.js +3 -3
  164. package/modules/kanban.d.ts +1 -1
  165. package/modules/kanban.esm.min.js +2 -2
  166. package/modules/kanban.min.cjs +2 -2
  167. package/modules/kanban.min.js +2 -2
  168. package/modules/kpi.d.ts +1 -1
  169. package/modules/kpi.esm.min.js +2 -2
  170. package/modules/kpi.min.cjs +2 -2
  171. package/modules/kpi.min.js +2 -2
  172. package/modules/layout.d.ts +1 -1
  173. package/modules/layout.esm.min.js +2 -2
  174. package/modules/layout.min.cjs +2 -2
  175. package/modules/layout.min.js +2 -2
  176. package/modules/mock-socket.d.ts +1 -1
  177. package/modules/mock-socket.esm.min.js +1 -1
  178. package/modules/mock-socket.min.cjs +1 -1
  179. package/modules/mock-socket.min.js +1 -1
  180. package/modules/react.d.ts +1 -1
  181. package/modules/react.esm.min.js +2 -2
  182. package/modules/react.min.cjs +2 -2
  183. package/modules/react.min.js +2 -2
  184. package/modules/svelte.d.ts +1 -1
  185. package/modules/svelte.esm.min.js +2 -2
  186. package/modules/svelte.min.cjs +2 -2
  187. package/modules/svelte.min.js +2 -2
  188. package/modules/tabs.d.ts +1 -1
  189. package/modules/tabs.esm.min.js +2 -2
  190. package/modules/tabs.min.cjs +2 -2
  191. package/modules/tabs.min.js +2 -2
  192. package/modules/vue.d.ts +1 -1
  193. package/modules/vue.esm.min.js +2 -2
  194. package/modules/vue.min.cjs +2 -2
  195. package/modules/vue.min.js +2 -2
  196. package/modules/webcomponent.d.ts +1 -1
  197. package/modules/webcomponent.esm.min.js +3 -3
  198. package/modules/webcomponent.min.cjs +3 -3
  199. package/modules/webcomponent.min.js +3 -3
  200. package/package.json +1 -1
@@ -1,197 +1,201 @@
1
1
  /*!
2
- * Lattice Grid 1.71.0, charts module
2
+ * Lattice Grid 1.71.3, charts module
3
3
  * Copyright (c) 2026 TOCLOCO Inc. All rights reserved.
4
4
  * https://latticegrid.dev
5
5
  */
6
- var cn=Object.create(null),un=Object.create(null);function Je(s,K){cn[s]=K}function fn(s){var K=un[s];if(K)return K;var Ae=Object.create(null);un[s]=Ae;var W=cn[s];if(!W)throw new Error("[lattice] missing module: "+s);return W(Ae,fn),Ae}Je("packages/modules/charts/svg.js",function(s,K){"use strict";Object.defineProperty(s,"SVG_NS",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(s,"el",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"svg",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"attr",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"attrs",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"setText",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"clear",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"append",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"path",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"ribbonPath",{enumerable:!0,get:function(){return j}}),Object.defineProperty(s,"round",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"pathRings",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"insideRings",{enumerable:!0,get:function(){return M}});const Ae="http://www.w3.org/2000/svg";function W(k,F,J){const Z=k.createElement(F);return J&&Z.setAttribute("class",J),Z}function S(k,F,J){const Z=k.createElementNS(Ae,F);if(J)for(const E of Object.keys(J))Z.setAttribute(E,String(J[E]));return Z}function pe(k,F,J){k&&(J==null?k.removeAttribute(F):k.setAttribute(F,String(J)))}function ue(k,F){if(k)for(const J of Object.keys(F))pe(k,J,F[J])}function V(k,F){k&&(k.textContent=F==null?"":String(F))}function Q(k){if(k)for(;k.firstChild;)k.removeChild(k.firstChild)}function G(k,F){for(const J of F)J&&k.appendChild(J);return k}function te(k){return k.join(" ")}function j(k){if(!k||k.length<2)return"";const F=["M",k[0].x,k[0].upper];for(let J=1;J<k.length;J++)F.push("L",k[J].x,k[J].upper);for(let J=k.length-1;J>=0;J--)F.push("L",k[J].x,k[J].lower);return F.push("Z"),te(F)}function c(k){return Math.round(k*100)/100}function Y(k){const F=[];let J=[];const Z=String(k||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let E="",ne=[];const v=()=>{if(!E||!ne.length){ne=[];return}if(E==="M"||E==="L")for(let X=0;X+1<ne.length;X+=2)J.push([ne[X],ne[X+1]]);else E!=="Z"&&ne.length>=2&&J.push([ne[ne.length-2],ne[ne.length-1]]);ne=[]};for(const X of Z){if(/[A-Za-z]/.test(X)){if(v(),X==="Z"||X==="z"){J.length>2&&F.push(J),J=[],E="";continue}X==="M"&&J.length>2&&(F.push(J),J=[]),E=X;continue}ne.push(Number(X))}return v(),J.length>2&&F.push(J),F}function M(k,F,J){let Z=!1;for(const E of k)for(let ne=0,v=E.length-1;ne<E.length;v=ne++){const[X,oe]=E[ne],[ee,C]=E[v];oe>J!=C>J&&F<(ee-X)*(J-oe)/(C-oe||1e-12)+X&&(Z=!Z)}return Z}}),Je("packages/modules/charts/typography.js",function(s,K){"use strict";Object.defineProperty(s,"BASE_SIZE",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(s,"BASE_FAMILY",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"CHAR_RATIO",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"resolveType",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"textWidth",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"widestLabel",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"truncateTo",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"applySize",{enumerable:!0,get:function(){return te}});const Ae=12,W="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",S=.62;function pe(j){const c=j&&j.font,Y=typeof c=="number"?{size:c}:c||{},M=ue(Y.size,Ae);return{family:Y.family||W,size:M,small:ue(Y.small??Y.tickSize,Math.max(9,M-1)),title:ue(Y.title,Math.round(M*1.15)),axisTitle:ue(Y.axisTitle,Math.max(10,M-1)),weight:Y.weight||"inherit"}}function ue(j,c){const Y=Number(j);return Number.isFinite(Y)&&Y>0?Y:c}function V(j,c){return String(j??"").length*c*S}function Q(j,c){let Y=0;for(const M of j||[]){const k=V(M,c);k>Y&&(Y=k)}return Y}function G(j,c,Y){const M=String(j??""),k=Math.floor(c/(Y*S));return k<=0?"":M.length<=k?M:k===1?"…":`${M.slice(0,k-1)}…`}function te(j,c){!j||!Number.isFinite(c)||(j.style?j.style.fontSize=`${c}px`:j.setAttribute("style",`font-size:${c}px`))}}),Je("packages/modules/charts/frame.js",function(s,K){"use strict";Object.defineProperty(s,"LABEL_GAP",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"resolveMargin",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"plotRect",{enumerable:!0,get:function(){return j}}),Object.defineProperty(s,"shouldRotate",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"Pool",{enumerable:!0,get:function(){return Y}});const W=K("packages/modules/charts/svg.js").SVG_NS,S=K("packages/modules/charts/typography.js"),pe=S.textWidth,ue=S.widestLabel,V=8,Q=6,G=.4;function te(M,k){const F=typeof M=="number"?M:k,J=M&&typeof M=="object"?M:{},Z=E=>Number.isFinite(E)&&E>=0?Number(E):F;return{base:F,top:Z(J.top),right:Z(J.right),bottom:Z(J.bottom),left:Z(J.left)}}function j(M){const k=te(M.margin,typeof M.padding=="number"?M.padding:8),F=k.base,J=M.fontSize||12,Z=M.yLabels||[],E=M.xLabels||[],ne=M.titles||{},v=M.titleSize||J,X=r=>r?v+Q:0,oe=ue(Z,J),ee=(Z.length?Math.min(M.width*G,k.left+oe+Q):Math.max(V,k.left))+X(ne.left),C=ue(E.map(r=>String(r).slice(0,14)),J),R=(E.length?M.rotated?Math.min(M.height*G,Q+C):J+Q+k.bottom:Math.max(V,k.bottom))+X(ne.bottom),ie=k.right+X(ne.right)+(M.rightGutter||0),I=k.top+(M.topGutter||0),$=Math.max(0,M.width-ee-ie),me=Math.max(0,M.height-I-R);return{left:ee,top:I,width:$,height:me,right:ee+$,bottom:I+me,gutter:{left:ee,bottom:R,right:ie,top:I}}}function c(M,k,F,J){if(!M.length||k<=0)return!1;const Z=Number.isFinite(J)&&J>0?Number(J):1;return ue(M,F)>k*Z-4}class Y{#l;#n=0;constructor(k){this.#l=k}next(k,F){const J=this.#l.childNodes[this.#n],Z=J&&J.tagName;if(Z&&String(Z).toLowerCase()===k.toLowerCase())return this.#n++,J;const E=this.#l.ownerDocument.createElementNS(W,k);return F&&E.setAttribute("class",F),J?this.#l.insertBefore(E,J):this.#l.appendChild(E),this.#n++,E}finish(){for(;this.#l.childNodes.length>this.#n;)this.#l.removeChild(this.#l.lastChild);this.#n=0}}}),Je("packages/modules/charts/scheme.js",function(s,K){"use strict";Object.defineProperty(s,"PALETTE",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(s,"SCHEMES",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"registerScheme",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"setDefaultScheme",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"schemeNames",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"resolveScheme",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"toRgb",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"rampStops",{enumerable:!0,get:function(){return Y}});const Ae=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),W=Object.freeze({default:{series:Ae,sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"},bright:{series:["#1f77d0","#ff7f0e","#2ca02c","#d62728","#9467bd","#17becf","#e377c2","#7f7f7f"],sequential:["#eef4fb","#1f77d0"],diverging:["#d62728","#f7f7f7","#1f77d0"],positive:"#2ca02c",negative:"#d62728"},earth:{series:["#5b7c6f","#c08b52","#7a6a53","#a4553f","#4e6a83","#8f8259","#6d5566","#8c9196"],sequential:["#f2efe9","#4e6a83"],diverging:["#a4553f","#f2efe9","#4e6a83"],positive:"#5b7c6f",negative:"#a4553f"},mono:{series:["#0b2a3d","#17475f","#2c6480","#4a82a0","#6da0bd","#94bcd6","#bcd7e9","#dfecf5"],sequential:["#eef3f7","#0b2a3d"],diverging:["#7a5c00","#f5f5f5","#0b2a3d"],positive:"#17475f",negative:"#7a5c00"}}),S=new Map;let pe="default";function ue(M,k){!M||!k||S.set(String(M),k)}function V(M){if(typeof M=="string"){pe=M;return}M&&typeof M=="object"&&(S.set("__default__",M),pe="__default__")}function Q(){return[...Object.keys(W),...S.keys()].filter(M=>!M.startsWith("__"))}function G(M){return S.has(M)?S.get(M):W[M]||null}function te(M){const k=G(pe)||W.default,F=M&&M.scheme,J=typeof F=="string"?G(F):F||null,Z=M&&Array.isArray(M.palette)&&M.palette.length?M.palette:null,E={...W.default,...k,...J||{}};Z&&(E.series=Z);const ne=!!(J||Z),v=E.series&&E.series.length?E.series:Ae;return{...E,series:X=>j(v,X,ne),explicit:ne}}function j(M,k,F){const J=(k%M.length+M.length)%M.length;return F?M[J]:`var(--lattice-chart-${J+1}, ${M[J]})`}function c(M){if(typeof M!="string")return null;const k=M.trim(),F=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(k);if(F){const E=F[1];return E.length===3?[0,1,2].map(ne=>parseInt(E[ne]+E[ne],16)):[0,2,4].map(ne=>parseInt(E.slice(ne,ne+2),16))}const J=/^rgba?\(([^)]+)\)$/i.exec(k);if(!J)return null;const Z=J[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return Z.length===3&&Z.every(E=>Number.isFinite(E))?Z:null}function Y(M,k){const F=k?M.diverging:M.sequential,J=k?W.default.diverging:W.default.sequential,Z=(Array.isArray(F)?F:J).map((E,ne)=>c(E)||c(J[ne])||[0,0,0]);return Z.length>=2?Z:J.map(E=>c(E))}}),Je("packages/modules/charts/styles.js",function(s,K){"use strict";Object.defineProperty(s,"NS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"seriesColour",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"css",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"injectStyles",{enumerable:!0,get:function(){return Q}});const W=K("packages/modules/charts/scheme.js").PALETTE,S="lat-chartview",pe="data-lattice-chartview";function ue(G){const te=(G%W.length+W.length)%W.length;return`var(--lattice-chart-${te+1}, ${W[te]})`}function V(){return`
7
- .${S}{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;
6
+ var yn=Object.create(null),wn=Object.create(null);function Xe(a,V){yn[a]=V}function kn(a){var V=wn[a];if(V)return V;var ve=Object.create(null);wn[a]=ve;var ee=yn[a];if(!ee)throw new Error("[lattice] missing module: "+a);return ee(ve,kn),ve}Xe("packages/modules/charts/svg.js",function(a,V){"use strict";Object.defineProperty(a,"SVG_NS",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(a,"el",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"svg",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"attr",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"attrs",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"setText",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"clear",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"append",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"path",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(a,"ribbonPath",{enumerable:!0,get:function(){return N}}),Object.defineProperty(a,"round",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"pathRings",{enumerable:!0,get:function(){return D}}),Object.defineProperty(a,"insideRings",{enumerable:!0,get:function(){return z}});const ve="http://www.w3.org/2000/svg";function ee(x,B,Q){const F=x.createElement(B);return Q&&F.setAttribute("class",Q),F}function M(x,B,Q){const F=x.createElementNS(ve,B);if(Q)for(const I of Object.keys(Q))F.setAttribute(I,String(Q[I]));return F}function de(x,B,Q){x&&(Q==null?x.removeAttribute(B):x.setAttribute(B,String(Q)))}function ce(x,B){if(x)for(const Q of Object.keys(B))de(x,Q,B[Q])}function Y(x,B){x&&(x.textContent=B==null?"":String(B))}function X(x){if(x)for(;x.firstChild;)x.removeChild(x.firstChild)}function U(x,B){for(const Q of B)Q&&x.appendChild(Q);return x}function ae(x){return x.join(" ")}function N(x){if(!x||x.length<2)return"";const B=["M",x[0].x,x[0].upper];for(let Q=1;Q<x.length;Q++)B.push("L",x[Q].x,x[Q].upper);for(let Q=x.length-1;Q>=0;Q--)B.push("L",x[Q].x,x[Q].lower);return B.push("Z"),ae(B)}function d(x){return Math.round(x*100)/100}function D(x){const B=[];let Q=[];const F=String(x||"").match(/[A-Za-z]|-?\d*\.?\d+(?:e[-+]?\d+)?/gi)||[];let I="",ne=[];const S=()=>{if(!I||!ne.length){ne=[];return}if(I==="M"||I==="L")for(let Z=0;Z+1<ne.length;Z+=2)Q.push([ne[Z],ne[Z+1]]);else I!=="Z"&&ne.length>=2&&Q.push([ne[ne.length-2],ne[ne.length-1]]);ne=[]};for(const Z of F){if(/[A-Za-z]/.test(Z)){if(S(),Z==="Z"||Z==="z"){Q.length>2&&B.push(Q),Q=[],I="";continue}Z==="M"&&Q.length>2&&(B.push(Q),Q=[]),I=Z;continue}ne.push(Number(Z))}return S(),Q.length>2&&B.push(Q),B}function z(x,B,Q){let F=!1;for(const I of x)for(let ne=0,S=I.length-1;ne<I.length;S=ne++){const[Z,te]=I[ne],[q,E]=I[S];te>Q!=E>Q&&B<(q-Z)*(Q-te)/(E-te||1e-12)+Z&&(F=!F)}return F}}),Xe("packages/modules/charts/typography.js",function(a,V){"use strict";Object.defineProperty(a,"BASE_SIZE",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(a,"BASE_FAMILY",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"CHAR_RATIO",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"resolveType",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"textWidth",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"widestLabel",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"truncateTo",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"applySize",{enumerable:!0,get:function(){return ae}});const ve=12,ee="var(--lattice-font-family, system-ui, -apple-system, sans-serif)",M=.62;function de(N){const d=N&&N.font,D=typeof d=="number"?{size:d}:d||{},z=ce(D.size,ve);return{family:D.family||ee,size:z,small:ce(D.small??D.tickSize,Math.max(9,z-1)),title:ce(D.title,Math.round(z*1.15)),axisTitle:ce(D.axisTitle,Math.max(10,z-1)),weight:D.weight||"inherit"}}function ce(N,d){const D=Number(N);return Number.isFinite(D)&&D>0?D:d}function Y(N,d){return String(N??"").length*d*M}function X(N,d){let D=0;for(const z of N||[]){const x=Y(z,d);x>D&&(D=x)}return D}function U(N,d,D){const z=String(N??""),x=Math.floor(d/(D*M));return x<=0?"":z.length<=x?z:x===1?"…":`${z.slice(0,x-1)}…`}function ae(N,d){!N||!Number.isFinite(d)||(N.style?N.style.fontSize=`${d}px`:N.setAttribute("style",`font-size:${d}px`))}}),Xe("packages/modules/charts/frame.js",function(a,V){"use strict";Object.defineProperty(a,"LABEL_GAP",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"LABEL_GUTTER_SHARE",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"resolveMargin",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(a,"plotRect",{enumerable:!0,get:function(){return N}}),Object.defineProperty(a,"shouldRotate",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"Pool",{enumerable:!0,get:function(){return D}});const ee=V("packages/modules/charts/svg.js").SVG_NS,M=V("packages/modules/charts/typography.js"),de=M.textWidth,ce=M.widestLabel,Y=8,X=6,U=.4;function ae(z,x){const B=typeof z=="number"?z:x,Q=z&&typeof z=="object"?z:{},F=I=>Number.isFinite(I)&&I>=0?Number(I):B;return{base:B,top:F(Q.top),right:F(Q.right),bottom:F(Q.bottom),left:F(Q.left)}}function N(z){const x=ae(z.margin,typeof z.padding=="number"?z.padding:8),B=x.base,Q=z.fontSize||12,F=z.yLabels||[],I=z.xLabels||[],ne=z.titles||{},S=z.titleSize||Q,Z=f=>f?S+X:0,te=ce(F,Q),q=(F.length?Math.min(z.width*U,x.left+te+X):Math.max(Y,x.left))+Z(ne.left),E=ce(I.map(f=>String(f).slice(0,14)),Q),L=(I.length?z.rotated?Math.min(z.height*U,X+E):Q+X+x.bottom:Math.max(Y,x.bottom))+Z(ne.bottom),se=x.right+Z(ne.right)+(z.rightGutter||0),R=x.top+(z.topGutter||0),$=Math.max(0,z.width-q-se),he=Math.max(0,z.height-R-L);return{left:q,top:R,width:$,height:he,right:q+$,bottom:R+he,gutter:{left:q,bottom:L,right:se,top:R}}}function d(z,x,B,Q){if(!z.length||x<=0)return!1;const F=Number.isFinite(Q)&&Q>0?Number(Q):1;return ce(z,B)>x*F-4}class D{#l;#n=0;constructor(x){this.#l=x}next(x,B){const Q=this.#l.childNodes[this.#n],F=Q&&Q.tagName;if(F&&String(F).toLowerCase()===x.toLowerCase())return this.#n++,Q;const I=this.#l.ownerDocument.createElementNS(ee,x);return B&&I.setAttribute("class",B),Q?this.#l.insertBefore(I,Q):this.#l.appendChild(I),this.#n++,I}finish(){for(;this.#l.childNodes.length>this.#n;)this.#l.removeChild(this.#l.lastChild);this.#n=0}}}),Xe("packages/core/src/internal/util.js",function(a,V){"use strict";Object.defineProperty(a,"VERSION",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"reportedWarnings",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"warnOnce",{enumerable:!0,get:function(){return D}}),Object.defineProperty(a,"infoOnce",{enumerable:!0,get:function(){return z}}),Object.defineProperty(a,"resetWarnings",{enumerable:!0,get:function(){return x}}),Object.defineProperty(a,"fail",{enumerable:!0,get:function(){return B}}),Object.defineProperty(a,"invariant",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(a,"DEV",{enumerable:!0,get:function(){return F}}),Object.defineProperty(a,"isObject",{enumerable:!0,get:function(){return I}}),Object.defineProperty(a,"isFunction",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(a,"isNil",{enumerable:!0,get:function(){return S}}),Object.defineProperty(a,"isBlank",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(a,"isCtor",{enumerable:!0,get:function(){return te}}),Object.defineProperty(a,"pathGetter",{enumerable:!0,get:function(){return E}}),Object.defineProperty(a,"pathSetter",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"getPath",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"setPath",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"humanise",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"escapeHtml",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"titleCase",{enumerable:!0,get:function(){return H}}),Object.defineProperty(a,"expand",{enumerable:!0,get:function(){return e}}),Object.defineProperty(a,"toArray",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"merge",{enumerable:!0,get:function(){return r}}),Object.defineProperty(a,"mergeRow",{enumerable:!0,get:function(){return w}}),Object.defineProperty(a,"Lru",{enumerable:!0,get:function(){return p}}),Object.defineProperty(a,"collator",{enumerable:!0,get:function(){return v}}),Object.defineProperty(a,"defaultCompare",{enumerable:!0,get:function(){return o}}),Object.defineProperty(a,"now",{enumerable:!0,get:function(){return s}}),Object.defineProperty(a,"nextFrame",{enumerable:!0,get:function(){return t}}),Object.defineProperty(a,"cancelFrame",{enumerable:!0,get:function(){return c}}),Object.defineProperty(a,"frameBatched",{enumerable:!0,get:function(){return P}}),Object.defineProperty(a,"settleDebounce",{enumerable:!0,get:function(){return g}}),Object.defineProperty(a,"whenIdle",{enumerable:!0,get:function(){return y}}),Object.defineProperty(a,"uid",{enumerable:!0,get:function(){return h}});const ve="1.71.3";async function ee(){return ve}const M="1.71.3",de=new Set,ce=2e3;function Y(i){if(de.add(i),de.size>ce){const n=de.values().next().value;n!==void 0&&de.delete(n)}}const X=[],U=500;function ae(i,n,m){X.push({key:i,level:n,message:m.map(G=>typeof G=="string"?G:N(G)).join(" "),at:Date.now()}),X.length>U&&X.shift()}function N(i){if(i instanceof Error)return i.message;try{return JSON.stringify(i)}catch{return String(i)}}function d(){return X.map(i=>({...i}))}function D(i,...n){de.has(i)||(Y(i),ae(i,"warn",n),console.warn("[lattice]",...n))}function z(i,...n){de.has(i)||(Y(i),ae(i,"info",n),console.info("[lattice]",...n))}function x(){de.clear(),X.length=0}function B(i,n){const m=new Error(`[lattice] ${i}`);throw n!==void 0&&(m.cause=n),m}function Q(i,n){i||B(n)}const F=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function I(i){return i!==null&&typeof i=="object"&&!Array.isArray(i)}function ne(i){return typeof i=="function"}function S(i){return i==null}function Z(i){return i==null||i===""}function te(i){return typeof i!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(i))?!0:!!(i.prototype&&Object.getOwnPropertyNames(i.prototype).length>1)}const q=new Map;function E(i){let n=q.get(i);if(n)return n;if(!i.includes("."))n=m=>m?.[i];else{const m=i.split("."),G=m.length;n=C=>{let O=C;for(let W=0;W<G;W++){if(O==null)return;O=O[m[W]]}return O}}return q.set(i,n),n}const L=new Map;function se(i){let n=L.get(i);if(n)return n;if(!i.includes("."))n=(m,G)=>{m!=null&&(m[i]=G)};else{const m=i.split("."),G=m.length-1;n=(C,O)=>{let W=C;for(let oe=0;oe<G;oe++){if(W==null)return;const _=m[oe];W[_]==null&&(W[_]={}),W=W[_]}W!=null&&(W[m[G]]=O)}}return L.set(i,n),n}function R(i,n){return E(n)(i)}function $(i,n,m){se(n)(i,m)}function he(i){return i?(i.includes(".")?i.slice(i.lastIndexOf(".")+1):i).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(/^./,m=>m.toUpperCase()):""}const f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function J(i){const n=i==null?"":String(i);return/[&<>"']/.test(n)?n.replace(/[&<>"']/g,m=>f[m]):n}function H(i){return String(i).replace(/\w\S*/g,n=>n[0].toUpperCase()+n.slice(1).toLowerCase())}function e(i,n,m){if(i!==void 0)return i===!0?{enabled:!0,...m}:i===!1?{enabled:!1}:I(i)?i:{[n]:i,enabled:!0}}function u(i){return i==null?[]:Array.isArray(i)?i:[i]}const k=Object.freeze(new Set(["__proto__","constructor","prototype"]));function r(i,n){if(!I(i))return I(n)?{...n}:n;if(!I(n))return n===void 0?i:n;const m={...i};for(const G of Object.keys(n)){if(k.has(G))continue;const C=n[G];C!==void 0&&(m[G]=I(C)&&I(m[G])?r(m[G],C):C)}return m}function w(i,n){if(!I(i)||!I(n)||i===n)return n;const m=Object.create(Object.getPrototypeOf(i));return Object.assign(m,i,n),m}class p{#l;#n=new Map;#c;constructor(n=256,m=null){this.#l=n,this.#c=m}get size(){return this.#n.size}get max(){return this.#l}set max(n){this.#l=n,this.#e()}has(n){return this.#n.has(n)}get(n){const m=this.#n;if(!m.has(n))return;const G=m.get(n);return m.delete(n),m.set(n,G),G}peek(n){return this.#n.get(n)}set(n,m){const G=this.#n;return G.has(n)&&G.delete(n),G.set(n,m),this.#e(),m}delete(n){const m=this.#n.get(n);return this.#n.delete(n)&&this.#c&&this.#c(m,n),m}clear(){if(this.#c)for(const[n,m]of this.#n)this.#c(m,n);this.#n.clear()}keys(){return this.#n.keys()}values(){return this.#n.values()}#e(){const n=this.#n;for(;n.size>this.#l;){const m=n.keys().next().value,G=n.get(m);n.delete(m),this.#c&&this.#c(G,m)}}}const l=new Map;function v(i,n){const m=`${i||""}|${n?JSON.stringify(n):""}`;let G=l.get(m);return G||(G=new Intl.Collator(i||void 0,{numeric:!0,sensitivity:"variant",...n}),l.set(m,G)),G}function o(i,n){if(i===n)return 0;if(i==null)return 1;if(n==null)return-1;if(typeof i=="number"&&typeof n=="number")return Number.isNaN(i)?Number.isNaN(n)?0:1:Number.isNaN(n)||i<n?-1:i>n?1:0;const m=String(i),G=String(n);return m<G?-1:m>G?1:0}function s(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const b=typeof requestAnimationFrame=="function";function t(i){return b?requestAnimationFrame(i):setTimeout(()=>i(s()),16)}function c(i){i!=null&&(b?cancelAnimationFrame(i):clearTimeout(i))}function P(i){let n=null,m=null;const G=()=>{n=null;const O=m;m=null,i(...O||[])},C=(...O)=>{m=O,n===null&&(n=t(G))};return C.cancel=()=>{c(n),n=null,m=null},C.flush=()=>{n!==null&&(c(n),G())},C}function g(i,n){let m=null,G=null;const C=()=>{if(m=null,G===null)return;const oe=G;G=null,i(...oe),O()},O=()=>{m=setTimeout(C,n),typeof m?.unref=="function"&&m.unref()},W=(...oe)=>{m===null?(i(...oe),O()):(G=oe,clearTimeout(m),O())};return W.flush=()=>{if(m!==null&&clearTimeout(m),m=null,G===null)return;const oe=G;G=null,i(...oe)},W.cancel=()=>{m!==null&&clearTimeout(m),m=null,G=null},W.pending=()=>m!==null||G!==null,W}function y(i,n=50){return typeof requestIdleCallback=="function"?requestIdleCallback(i,{timeout:n}):setTimeout(()=>i({timeRemaining:()=>0,didTimeout:!0}),1)}let j=0;function h(i="l"){return`${i}${(++j).toString(36)}`}}),Xe("packages/modules/charts/scheme.js",function(a,V){"use strict";Object.defineProperty(a,"PALETTE",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"SCHEMES",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"registerScheme",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"setDefaultScheme",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"schemeNames",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(a,"resolveScheme",{enumerable:!0,get:function(){return z}}),Object.defineProperty(a,"toRgb",{enumerable:!0,get:function(){return B}}),Object.defineProperty(a,"rampStops",{enumerable:!0,get:function(){return Q}});const ee=V("packages/core/src/internal/util.js").warnOnce,M=Object.freeze(["#0072b2","#e69f00","#009e73","#cc79a7","#56b4e9","#d55e00","#7a5195","#6b7d8c"]),de=Object.freeze({default:{series:M,sequential:["#ecf3f9","#005280"],diverging:["#b04a00","#f7f7f7","#005280"],positive:"#009e73",negative:"#d55e00"},bright:{series:["#1f77d0","#ff7f0e","#2ca02c","#d62728","#9467bd","#17becf","#e377c2","#7f7f7f"],sequential:["#eef4fb","#1f77d0"],diverging:["#d62728","#f7f7f7","#1f77d0"],positive:"#2ca02c",negative:"#d62728"},earth:{series:["#5b7c6f","#c08b52","#7a6a53","#a4553f","#4e6a83","#8f8259","#6d5566","#8c9196"],sequential:["#f2efe9","#4e6a83"],diverging:["#a4553f","#f2efe9","#4e6a83"],positive:"#5b7c6f",negative:"#a4553f"},mono:{series:["#0b2a3d","#17475f","#2c6480","#4a82a0","#6da0bd","#94bcd6","#bcd7e9","#dfecf5"],sequential:["#eef3f7","#0b2a3d"],diverging:["#7a5c00","#f5f5f5","#0b2a3d"],positive:"#17475f",negative:"#7a5c00"}}),ce=new Map;let Y="default";function X(F,I){!F||!I||ce.set(String(F),I)}function U(F){if(typeof F=="string"){Y=F;return}F&&typeof F=="object"&&(ce.set("__default__",F),Y="__default__")}function ae(){return[...Object.keys(de),...ce.keys()].filter(F=>!F.startsWith("__"))}function N(F){return ce.has(F)?ce.get(F):de[F]||null}const d=["series","sequential","diverging","positive","negative"];function D(F){return!F||typeof F!="object"||Array.isArray(F)?!1:!d.some(I=>I in F)}function z(F){const I=N(Y)||de.default,ne=F&&F.scheme,S=D(ne)?ne:null,Z=typeof ne=="string"?N(ne):S?null:ne||null,te=F&&Array.isArray(F.palette)&&F.palette.length?F.palette:null;S&&te&&ee("chart:scheme:array-and-map",'chart "scheme" was given as a name map together with a "palette" array; the two do not combine. Colours came from the map and the array was ignored. Pass one or the other.');const q=S?null:te,E={...de.default,...I,...Z||{}};q&&(E.series=q);const L=!!(Z||q||S),se=E.series&&E.series.length?E.series:M,R=new Map;let $=0;return{...E,series:(f,J)=>{if(S&&J!==void 0&&J!==null){const H=String(J);return Object.prototype.hasOwnProperty.call(S,H)?S[H]:(R.has(H)||R.set(H,$++),x(se,R.get(H),!0))}return x(se,f,L)},explicit:L,nameMap:!!S}}function x(F,I,ne){const S=(I%F.length+F.length)%F.length;return ne?F[S]:`var(--lattice-chart-${S+1}, ${F[S]})`}function B(F){if(typeof F!="string")return null;const I=F.trim(),ne=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(I);if(ne){const te=ne[1];return te.length===3?[0,1,2].map(q=>parseInt(te[q]+te[q],16)):[0,2,4].map(q=>parseInt(te.slice(q,q+2),16))}const S=/^rgba?\(([^)]+)\)$/i.exec(I);if(!S)return null;const Z=S[1].split(/[\s,/]+/).filter(Boolean).slice(0,3).map(Number);return Z.length===3&&Z.every(te=>Number.isFinite(te))?Z:null}function Q(F,I){const ne=I?F.diverging:F.sequential,S=I?de.default.diverging:de.default.sequential,Z=(Array.isArray(ne)?ne:S).map((te,q)=>B(te)||B(S[q])||[0,0,0]);return Z.length>=2?Z:S.map(te=>B(te))}}),Xe("packages/modules/charts/styles.js",function(a,V){"use strict";Object.defineProperty(a,"NS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"seriesColour",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"css",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"injectStyles",{enumerable:!0,get:function(){return X}});const ee=V("packages/modules/charts/scheme.js").PALETTE,M="lat-chartview",de="data-lattice-chartview";function ce(U){const ae=(U%ee.length+ee.length)%ee.length;return`var(--lattice-chart-${ae+1}, ${ee[ae]})`}function Y(){return`
7
+ .${M}{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;
8
8
  width:100%;height:100%;box-sizing:border-box;
9
9
  font-family:var(--lattice-font-family,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif);
10
10
  font-size:var(--lattice-font-size,13px);
11
11
  color:var(--lattice-foreground,#1c2126);
12
12
  background:var(--lattice-background,#fff);
13
- --lattice-chart-1:${W[0]};--lattice-chart-2:${W[1]};
14
- --lattice-chart-3:${W[2]};--lattice-chart-4:${W[3]};
15
- --lattice-chart-5:${W[4]};--lattice-chart-6:${W[5]};
16
- --lattice-chart-7:${W[6]};--lattice-chart-8:${W[7]};
13
+ --lattice-chart-1:${ee[0]};--lattice-chart-2:${ee[1]};
14
+ --lattice-chart-3:${ee[2]};--lattice-chart-4:${ee[3]};
15
+ --lattice-chart-5:${ee[4]};--lattice-chart-6:${ee[5]};
16
+ --lattice-chart-7:${ee[6]};--lattice-chart-8:${ee[7]};
17
17
  --lattice-chart-grid:var(--lattice-border-color,#dfe3e6);
18
18
  --lattice-chart-empty:var(--lattice-surface,#f7f8f9);
19
19
  --lattice-chart-axis:var(--lattice-foreground-muted,#5b6670);
20
20
  --lattice-chart-map-stroke:var(--lattice-border-color,#dfe3e6)}
21
- .${S}__figure{margin:0;display:flex;flex-direction:column;flex:1 1 auto;min-height:0}
22
- .${S}__caption{padding:2px 4px 6px;display:flex;flex-direction:column;gap:2px}
23
- .${S}__title{font-weight:var(--lattice-header-font-weight,600);
21
+ .${M}__figure{margin:0;display:flex;flex-direction:column;flex:1 1 auto;min-height:0}
22
+ .${M}__caption{padding:2px 4px 6px;display:flex;flex-direction:column;gap:2px}
23
+ .${M}__title{font-weight:var(--lattice-header-font-weight,600);
24
24
  font-size:var(--lattice-font-size,13px)}
25
- .${S}__subtitle{color:var(--lattice-foreground-muted,#5b6670);
25
+ .${M}__subtitle{color:var(--lattice-foreground-muted,#5b6670);
26
26
  font-size:var(--lattice-font-size-sm,11px)}
27
- .${S}__footnote{color:var(--lattice-foreground-muted,#5b6670);
27
+ .${M}__footnote{color:var(--lattice-foreground-muted,#5b6670);
28
28
  font-size:var(--lattice-font-size-sm,11px);padding:2px 4px 4px}
29
29
  /* A label outside its mark sits on the chart's background and takes the axis
30
30
  colour; one inside sits on the series colour and needs the contrast the
31
31
  background gives it. */
32
- .${S}__data-label{fill:var(--lattice-chart-axis);pointer-events:none}
33
- .${S}__data-label[data-inside="true"]{fill:var(--lattice-background,#fff)}
34
- .${S}__plot{flex:1 1 auto;min-height:0;display:block;width:100%;height:100%;overflow:visible}
32
+ .${M}__data-label{fill:var(--lattice-chart-axis);pointer-events:none}
33
+ .${M}__data-label[data-inside="true"]{fill:var(--lattice-background,#fff)}
34
+ .${M}__plot{flex:1 1 auto;min-height:0;display:block;width:100%;height:100%;overflow:visible}
35
35
  /* The plot is hidden while the empty state is up; the author display:block
36
36
  above would otherwise keep an empty frame painted behind the message — the
37
37
  mirror of the placeholder's own trap (BACKLOG-0001023). */
38
- .${S}__plot[hidden]{display:none}
39
- .${S}__grid line{stroke:var(--lattice-chart-grid);stroke-width:1;shape-rendering:crispEdges}
40
- .${S}__axis line{stroke:var(--lattice-chart-axis);stroke-width:1;shape-rendering:crispEdges}
41
- .${S}__axis text{fill:var(--lattice-chart-axis);
38
+ .${M}__plot[hidden]{display:none}
39
+ .${M}__grid line{stroke:var(--lattice-chart-grid);stroke-width:1;shape-rendering:crispEdges}
40
+ .${M}__axis line{stroke:var(--lattice-chart-axis);stroke-width:1;shape-rendering:crispEdges}
41
+ .${M}__axis text{fill:var(--lattice-chart-axis);
42
42
  font-size:var(--lattice-font-size-sm,11px)}
43
- .${S}__axis-title{fill:var(--lattice-chart-axis);
43
+ .${M}__axis-title{fill:var(--lattice-chart-axis);
44
44
  font-size:var(--lattice-font-size-sm,11px);font-weight:600}
45
- .${S}__line{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
46
- .${S}__area{stroke:none;opacity:0.18}
47
- .${S}__bar,.${S}__slice{stroke:var(--lattice-background,#fff);stroke-width:1}
48
- .${S}__point{stroke:var(--lattice-background,#fff);stroke-width:1}
49
- .${S}__mark[data-dim]{opacity:0.18}
50
- .${S}__brush{fill:var(--lattice-range-background,#e7f1fd);fill-opacity:0.5;
45
+ .${M}__line{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
46
+ .${M}__area{stroke:none;opacity:0.18}
47
+ .${M}__bar,.${M}__slice{stroke:var(--lattice-background,#fff);stroke-width:1}
48
+ .${M}__point{stroke:var(--lattice-background,#fff);stroke-width:1}
49
+ .${M}__mark[data-dim]{opacity:0.18}
50
+ .${M}__brush{fill:var(--lattice-range-background,#e7f1fd);fill-opacity:0.5;
51
51
  stroke:var(--lattice-range-border,#1a6bc7);stroke-width:1;pointer-events:none}
52
- .${S}__plot:focus{outline:none}
53
- .${S}__plot:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
52
+ .${M}__plot:focus{outline:none}
53
+ .${M}__plot:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
54
54
  outline-offset:-2px}
55
- .${S}__mark:focus{outline:none}
56
- .${S}__mark:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
55
+ .${M}__mark:focus{outline:none}
56
+ .${M}__mark:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
57
57
  outline-offset:1px}
58
- .${S}__box{stroke-width:1}
59
- .${S}__whisker{stroke-width:1;fill:none}
60
- .${S}__density{stroke-width:1.5;fill:none;opacity:.85}
61
- .${S}__fit{stroke-width:1.5;fill:none;opacity:.9}
62
- .${S}__fit-label{font-weight:600;opacity:.9}
63
- .${S}__trend{stroke-width:1.75;fill:none;opacity:.9}
64
- .${S}__trend-forecast{stroke-width:1.75;fill:none;opacity:.9;stroke-dasharray:5 4}
65
- .${S}__trend-label{font-weight:600;opacity:.9}
66
- .${S}__trend-band{stroke:none;pointer-events:none}
67
- .${S}__qq-line{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:4 3;fill:none}
68
- .${S}__ecdf{stroke-width:1.5;fill:none}
69
- .${S}__control-line{stroke-width:1.25;fill:none}
70
- .${S}__error-bar{stroke:var(--lattice-foreground,#1a1a1a);stroke-width:1.5;fill:none;stroke-linecap:round}
71
- .${S}__control-centre{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;fill:none}
72
- .${S}__control-limit{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:6 3;fill:none}
73
- .${S}__spec-limit{stroke:var(--lattice-danger,#a4262c);stroke-width:1;stroke-dasharray:2 3;fill:none}
74
- .${S}__spec-target{stroke:var(--lattice-success,#107c41);stroke-width:1;stroke-dasharray:1 4;fill:none}
75
- .${S}__control-name{fill:var(--lattice-foreground-muted,#5b6570);font-size:9px;letter-spacing:.04em}
76
- .${S}__control-rule{fill:var(--lattice-danger,#a4262c);font-size:9px;font-weight:600}
77
- .${S}__capability-within{stroke:var(--lattice-foreground,#1a1a1a);stroke-width:1.5;fill:none}
78
- .${S}__capability-overall{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1.5;stroke-dasharray:4 3;fill:none}
79
- .${S}__lorenz{stroke-width:1.75;fill:none}
80
- .${S}__lorenz-equality{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:4 3;fill:none}
81
- .${S}__median{fill:none}
82
- .${S}__tile{stroke:var(--lattice-background,#fff);stroke-width:1}
83
- .${S}__tile-label{fill:var(--lattice-background,#fff);
58
+ .${M}__box{stroke-width:1}
59
+ .${M}__whisker{stroke-width:1;fill:none}
60
+ .${M}__density{stroke-width:1.5;fill:none;opacity:.85}
61
+ .${M}__fit{stroke-width:1.5;fill:none;opacity:.9}
62
+ .${M}__fit-label{font-weight:600;opacity:.9}
63
+ .${M}__trend{stroke-width:1.75;fill:none;opacity:.9}
64
+ .${M}__trend-forecast{stroke-width:1.75;fill:none;opacity:.9;stroke-dasharray:5 4}
65
+ .${M}__trend-label{font-weight:600;opacity:.9}
66
+ .${M}__trend-band{stroke:none;pointer-events:none}
67
+ .${M}__qq-line{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:4 3;fill:none}
68
+ .${M}__ecdf{stroke-width:1.5;fill:none}
69
+ .${M}__control-line{stroke-width:1.25;fill:none}
70
+ .${M}__error-bar{stroke:var(--lattice-foreground,#1a1a1a);stroke-width:1.5;fill:none;stroke-linecap:round}
71
+ .${M}__control-centre{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;fill:none}
72
+ .${M}__control-limit{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:6 3;fill:none}
73
+ .${M}__spec-limit{stroke:var(--lattice-danger,#a4262c);stroke-width:1;stroke-dasharray:2 3;fill:none}
74
+ .${M}__spec-target{stroke:var(--lattice-success,#107c41);stroke-width:1;stroke-dasharray:1 4;fill:none}
75
+ .${M}__control-name{fill:var(--lattice-foreground-muted,#5b6570);font-size:9px;letter-spacing:.04em}
76
+ .${M}__control-rule{fill:var(--lattice-danger,#a4262c);font-size:9px;font-weight:600}
77
+ .${M}__capability-within{stroke:var(--lattice-foreground,#1a1a1a);stroke-width:1.5;fill:none}
78
+ .${M}__capability-overall{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1.5;stroke-dasharray:4 3;fill:none}
79
+ .${M}__lorenz{stroke-width:1.75;fill:none}
80
+ .${M}__lorenz-equality{stroke:var(--lattice-foreground-muted,#5b6570);stroke-width:1;stroke-dasharray:4 3;fill:none}
81
+ .${M}__median{fill:none}
82
+ .${M}__tile{stroke:var(--lattice-background,#fff);stroke-width:1}
83
+ .${M}__tile-label{fill:var(--lattice-background,#fff);
84
84
  font-size:var(--lattice-font-size-sm,11px);pointer-events:none}
85
- .${S}__tile-label--branch{fill:var(--lattice-foreground,#1d2733)}
86
- .${S}__reference{stroke:var(--lattice-chart-axis);stroke-width:1}
87
- .${S}__reference-label{fill:var(--lattice-chart-axis);
85
+ .${M}__tile-label--branch{fill:var(--lattice-foreground,#1d2733)}
86
+ .${M}__reference{stroke:var(--lattice-chart-axis);stroke-width:1}
87
+ .${M}__reference-label{fill:var(--lattice-chart-axis);
88
88
  font-size:var(--lattice-font-size-sm,11px)}
89
- .${S}__annotation-line{stroke:var(--lattice-chart-axis);stroke-width:1;stroke-dasharray:4 3;fill:none}
90
- .${S}__annotation-target{stroke:var(--lattice-success,#107c41);stroke-width:1.5;stroke-dasharray:2 2;fill:none}
91
- .${S}__annotation-band{stroke:none}
92
- .${S}__annotation-point{stroke:var(--lattice-background,#fff);stroke-width:1}
93
- .${S}__annotation-event{stroke:var(--lattice-chart-axis);stroke-width:1;fill:none}
94
- .${S}__annotation-event-flag{stroke:var(--lattice-background,#fff);stroke-width:1}
95
- .${S}__annotation-label{fill:var(--lattice-chart-axis);
89
+ .${M}__annotation-line{stroke:var(--lattice-chart-axis);stroke-width:1;stroke-dasharray:4 3;fill:none}
90
+ .${M}__annotation-target{stroke:var(--lattice-success,#107c41);stroke-width:1.5;stroke-dasharray:2 2;fill:none}
91
+ .${M}__annotation-band{stroke:none}
92
+ .${M}__annotation-point{stroke:var(--lattice-background,#fff);stroke-width:1}
93
+ .${M}__annotation-event{stroke:var(--lattice-chart-axis);stroke-width:1;fill:none}
94
+ .${M}__annotation-event-flag{stroke:var(--lattice-background,#fff);stroke-width:1}
95
+ .${M}__annotation-label{fill:var(--lattice-chart-axis);
96
96
  font-size:var(--lattice-font-size-sm,11px)}
97
- .${S}__annotation-list{list-style:none;margin:0;padding:0;
97
+ .${M}__annotation-list{list-style:none;margin:0;padding:0;
98
98
  position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
99
- .${S}__ribbon{stroke:none;fill-opacity:0.62}
100
- .${S}__ribbon:hover{fill-opacity:0.85}
101
- .${S}__node{stroke:var(--lattice-background,#fff);stroke-width:1}
102
- .${S}__edge{stroke:var(--lattice-chart-grid);stroke-opacity:0.7}
99
+ .${M}__ribbon{stroke:none;fill-opacity:0.62}
100
+ .${M}__ribbon:hover{fill-opacity:0.85}
101
+ .${M}__node{stroke:var(--lattice-background,#fff);stroke-width:1}
102
+ .${M}__edge{stroke:var(--lattice-chart-grid);stroke-opacity:0.7}
103
103
  /* A node's glyph, knocked out of its disc in the chart's own background colour
104
104
  so it takes the theme rather than a colour written into the drawing. Drawn as
105
105
  SVG paths from the grid's sprite registry, so it is sharp at any chart size
106
106
  and any device pixel ratio. */
107
- .${S}__node-icon{fill:var(--lattice-background,#fff);stroke:none;pointer-events:none}
108
- .${S}__node-icon--stroke{fill:none;stroke:var(--lattice-background,#fff);
107
+ .${M}__node-icon{fill:var(--lattice-background,#fff);stroke:none;pointer-events:none}
108
+ .${M}__node-icon--stroke{fill:none;stroke:var(--lattice-background,#fff);
109
109
  stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
110
- .${S}__node-icon[data-dim]{opacity:0.18}
111
- .${S}__flow-label{fill:var(--lattice-chart-axis);pointer-events:none}
112
- .${S}__stream{stroke:none}
113
- .${S}__violin{stroke:none;fill-opacity:0.55}
114
- .${S}__task{stroke:var(--lattice-background,#fff);stroke-width:1;rx:2}
115
- .${S}__web{stroke:var(--lattice-chart-grid);fill:none}
116
- .${S}__radar-fill{opacity:0.18;stroke:none}
117
- .${S}__radar-line{stroke-width:2;fill:none}
118
- .${S}__gauge-track{fill:var(--lattice-chart-grid)}
119
- .${S}__gauge-target{stroke:var(--lattice-foreground,#1c2126);stroke-width:2}
120
- .${S}__gauge-reading{fill:var(--lattice-foreground,#1c2126);
110
+ .${M}__node-icon[data-dim]{opacity:0.18}
111
+ .${M}__flow-label{fill:var(--lattice-chart-axis);pointer-events:none}
112
+ .${M}__stream{stroke:none}
113
+ .${M}__violin{stroke:none;fill-opacity:0.55}
114
+ .${M}__task{stroke:var(--lattice-background,#fff);stroke-width:1;rx:2}
115
+ .${M}__web{stroke:var(--lattice-chart-grid);fill:none}
116
+ .${M}__radar-fill{opacity:0.18;stroke:none}
117
+ .${M}__radar-line{stroke-width:2;fill:none}
118
+ .${M}__gauge-track{fill:var(--lattice-chart-grid)}
119
+ .${M}__gauge-target{stroke:var(--lattice-foreground,#1c2126);stroke-width:2}
120
+ .${M}__gauge-reading{fill:var(--lattice-foreground,#1c2126);
121
121
  font-size:calc(var(--lattice-font-size,13px) * 1.8);font-weight:600}
122
- .${S}__gauge-caption{fill:var(--lattice-chart-axis);
122
+ .${M}__gauge-caption{fill:var(--lattice-chart-axis);
123
123
  font-size:var(--lattice-font-size-sm,11px)}
124
- .${S}__cell{stroke:var(--lattice-background,#fff);stroke-width:1}
125
- .${S}__funnel{stroke:var(--lattice-background,#fff);stroke-width:1}
126
- .${S}__funnel-label,.${S}__funnel-value{fill:var(--lattice-foreground,#1c2126);
124
+ .${M}__cell{stroke:var(--lattice-background,#fff);stroke-width:1}
125
+ .${M}__funnel{stroke:var(--lattice-background,#fff);stroke-width:1}
126
+ .${M}__funnel-label,.${M}__funnel-value{fill:var(--lattice-foreground,#1c2126);
127
127
  font-size:var(--lattice-font-size-sm,11px)}
128
- .${S}__wick{stroke-width:1}
129
- .${S}__candle{stroke-width:1}
130
- .${S}__axis-right{stroke-width:1}
131
- .${S}__panel-title{fill:var(--lattice-chart-axis);
128
+ .${M}__wick{stroke-width:1}
129
+ .${M}__candle{stroke-width:1}
130
+ .${M}__axis-right{stroke-width:1}
131
+ .${M}__panel-title{fill:var(--lattice-chart-axis);
132
132
  font-size:var(--lattice-font-size-sm,11px)}
133
- .${S}__region{stroke:var(--lattice-chart-map-stroke,var(--lattice-chart-grid,#dfe3e6));
133
+ .${M}__region{stroke:var(--lattice-chart-map-stroke,var(--lattice-chart-grid,#dfe3e6));
134
134
  stroke-width:0.5;vector-effect:non-scaling-stroke}
135
- .${S}__graticule{fill:none;stroke:var(--lattice-chart-grid,#dfe3e6);stroke-width:0.5;
135
+ .${M}__graticule{fill:none;stroke:var(--lattice-chart-grid,#dfe3e6);stroke-width:0.5;
136
136
  stroke-opacity:0.6;vector-effect:non-scaling-stroke;pointer-events:none}
137
- .${S}__geo-note{fill:var(--lattice-chart-axis);
137
+ .${M}__geo-note{fill:var(--lattice-chart-axis);
138
138
  font-size:var(--lattice-font-size-sm,11px)}
139
- .${S}__attribution{color:var(--lattice-foreground-muted,#5b6670);
139
+ .${M}__attribution{color:var(--lattice-foreground-muted,#5b6670);
140
140
  font-size:var(--lattice-font-size-sm,11px);padding:0 4px 4px}
141
- .${S}__attribution[hidden]{display:none}
142
- .${S}__slice-label{fill:var(--lattice-background,#fff);font-size:var(--lattice-font-size-sm,11px);
141
+ .${M}__attribution[hidden]{display:none}
142
+ .${M}__slice-label{fill:var(--lattice-background,#fff);font-size:var(--lattice-font-size-sm,11px);
143
143
  pointer-events:none;text-anchor:middle}
144
- .${S}__legend{display:flex;flex-wrap:wrap;gap:2px 12px;padding:6px 4px 2px;
144
+ .${M}__donut-centre-value{fill:var(--lattice-foreground,#1c2126);font-weight:600;
145
+ pointer-events:none;text-anchor:middle}
146
+ .${M}__donut-centre-label{fill:var(--lattice-chart-axis);
147
+ pointer-events:none;text-anchor:middle}
148
+ .${M}__legend{display:flex;flex-wrap:wrap;gap:2px 12px;padding:6px 4px 2px;
145
149
  font-size:var(--lattice-font-size-sm,11px)}
146
- .${S}__legend-item{display:inline-flex;align-items:center;gap:5px;border:0;padding:1px 3px;
150
+ .${M}__legend-item{display:inline-flex;align-items:center;gap:5px;border:0;padding:1px 3px;
147
151
  background:none;color:inherit;font:inherit;cursor:pointer;border-radius:3px}
148
- .${S}__legend-item:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
152
+ .${M}__legend-item:focus-visible{outline:var(--lattice-focus-width,2px) solid var(--lattice-focus-color,#1a6bc7);
149
153
  outline-offset:1px}
150
- .${S}__legend-item[aria-pressed="false"]{opacity:0.45}
151
- .${S}__swatch{width:10px;height:10px;border-radius:2px;flex:0 0 auto}
152
- .${S}__swatch--circle{border-radius:50%}
154
+ .${M}__legend-item[aria-pressed="false"]{opacity:0.45}
155
+ .${M}__swatch{width:10px;height:10px;border-radius:2px;flex:0 0 auto}
156
+ .${M}__swatch--circle{border-radius:50%}
153
157
  /* A line swatch for a series drawn as a line: the symbol should say which mark
154
158
  the reader is looking for, not merely which colour. */
155
- .${S}__swatch--line{height:3px;border-radius:2px}
156
- .${S}__legend[data-align="centre"],.${S}__legend[data-align="center"]{justify-content:center}
157
- .${S}__legend[data-align="end"]{justify-content:flex-end}
159
+ .${M}__swatch--line{height:3px;border-radius:2px}
160
+ .${M}__legend[data-align="centre"],.${M}__legend[data-align="center"]{justify-content:center}
161
+ .${M}__legend[data-align="end"]{justify-content:flex-end}
158
162
  /* Top and bottom are the default row; the sides become a column beside the
159
163
  plot, which is why the figure itself changes direction rather than the
160
164
  legend floating over the marks. */
161
- .${S}__figure:has(> .${S}__legend[data-position="top"]){flex-direction:column}
162
- .${S}__legend[data-position="top"]{order:-1}
163
- .${S}__figure:has(> .${S}__legend[data-position="left"]),
164
- .${S}__figure:has(> .${S}__legend[data-position="right"]){flex-direction:row;align-items:stretch}
165
- .${S}__legend[data-position="left"],.${S}__legend[data-position="right"]{
165
+ .${M}__figure:has(> .${M}__legend[data-position="top"]){flex-direction:column}
166
+ .${M}__legend[data-position="top"]{order:-1}
167
+ .${M}__figure:has(> .${M}__legend[data-position="left"]),
168
+ .${M}__figure:has(> .${M}__legend[data-position="right"]){flex-direction:row;align-items:stretch}
169
+ .${M}__legend[data-position="left"],.${M}__legend[data-position="right"]{
166
170
  flex-direction:column;flex:0 0 auto;align-content:flex-start;
167
171
  max-width:40%;overflow:auto;padding:4px 8px}
168
- .${S}__legend[data-position="left"]{order:-1}
169
- .${S}__legend-more{align-self:center;color:var(--lattice-foreground-muted,#5b6670)}
170
- .${S}__tooltip{position:fixed;z-index:5;pointer-events:none;max-width:260px;
172
+ .${M}__legend[data-position="left"]{order:-1}
173
+ .${M}__legend-more{align-self:center;color:var(--lattice-foreground-muted,#5b6670)}
174
+ .${M}__tooltip{position:fixed;z-index:5;pointer-events:none;max-width:260px;
171
175
  padding:5px 8px;border-radius:4px;font-size:var(--lattice-font-size-sm,11px);
172
176
  background:var(--lattice-surface,#f7f8f9);color:var(--lattice-foreground,#1c2126);
173
177
  border:1px solid var(--lattice-border-color,#dfe3e6);
174
178
  box-shadow:var(--lattice-popup-shadow,0 6px 16px -4px rgb(16 20 24/24%))}
175
- .${S}__tooltip[hidden]{display:none}
176
- .${S}__tooltip-row{display:flex;align-items:center;gap:5px;white-space:nowrap}
177
- .${S}__tooltip-value{font-weight:600;margin-inline-start:auto;padding-inline-start:10px}
178
- .${S}__empty{display:flex;align-items:center;justify-content:center;flex:1 1 auto;
179
+ .${M}__tooltip[hidden]{display:none}
180
+ .${M}__tooltip-row{display:flex;align-items:center;gap:5px;white-space:nowrap}
181
+ .${M}__tooltip-value{font-weight:600;margin-inline-start:auto;padding-inline-start:10px}
182
+ .${M}__empty{display:flex;align-items:center;justify-content:center;flex:1 1 auto;
179
183
  color:var(--lattice-foreground-muted,#5b6670)}
180
184
  /* The author display:flex above outranks the browser's own [hidden] rule, so
181
185
  without this the placeholder stays painted under a drawn chart whenever the
182
186
  pane has a fixed height (BACKLOG-0001023). Same guard as the tooltip. */
183
- .${S}__empty[hidden]{display:none}
184
- .${S}__watermark{position:absolute;right:4px;bottom:4px;z-index:6;
187
+ .${M}__empty[hidden]{display:none}
188
+ .${M}__watermark{position:absolute;right:4px;bottom:4px;z-index:6;
185
189
  font-size:var(--lattice-font-size-sm,11px);pointer-events:auto;
186
190
  background:var(--lattice-overlay-background,rgb(255 255 255/72%));
187
191
  padding:1px 6px;border-radius:3px}
188
- .${S}__watermark-link{color:var(--lattice-foreground-muted,#5b6670);text-decoration:none}
189
- .${S}__watermark-link:hover{text-decoration:underline}
190
- .${S}__table{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;
192
+ .${M}__watermark-link{color:var(--lattice-foreground-muted,#5b6670);text-decoration:none}
193
+ .${M}__watermark-link:hover{text-decoration:underline}
194
+ .${M}__table{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;
191
195
  clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
192
196
 
193
- .${S}[data-theme="dark"],
194
- .lattice[data-theme="dark"] .${S}{
197
+ .${M}[data-theme="dark"],
198
+ .lattice[data-theme="dark"] .${M}{
195
199
  --lattice-chart-1:#4ea6dd;--lattice-chart-2:#f0b429;--lattice-chart-3:#34c79a;
196
200
  --lattice-chart-4:#e39ec4;--lattice-chart-5:#7cc7f0;--lattice-chart-6:#f07c3f;
197
201
  --lattice-chart-7:#a48ad4;--lattice-chart-8:#93a3b1}
@@ -199,15 +203,15 @@ var cn=Object.create(null),un=Object.create(null);function Je(s,K){cn[s]=K}funct
199
203
  @media (prefers-color-scheme: dark){
200
204
  /* Guarded so an explicit light theme still wins on a dark desktop, which is
201
205
  the same rule the grid's own tokens follow. */
202
- .${S}:not([data-theme="light"]){
206
+ .${M}:not([data-theme="light"]){
203
207
  --lattice-chart-1:#4ea6dd;--lattice-chart-2:#f0b429;--lattice-chart-3:#34c79a;
204
208
  --lattice-chart-4:#e39ec4;--lattice-chart-5:#7cc7f0;--lattice-chart-6:#f07c3f;
205
209
  --lattice-chart-7:#a48ad4;--lattice-chart-8:#93a3b1}
206
210
  }
207
211
 
208
212
  @media (prefers-reduced-motion: no-preference){
209
- .${S}__line,.${S}__area{transition:d 160ms ease-out}
210
- .${S}__bar{transition:x 160ms ease-out,y 160ms ease-out,width 160ms ease-out,height 160ms ease-out}
213
+ .${M}__line,.${M}__area{transition:d 160ms ease-out}
214
+ .${M}__bar{transition:x 160ms ease-out,y 160ms ease-out,width 160ms ease-out,height 160ms ease-out}
211
215
  }
212
216
 
213
217
  @media (forced-colors: active){
@@ -215,14 +219,14 @@ var cn=Object.create(null),un=Object.create(null);function Je(s,K){cn[s]=K}funct
215
219
  meaning entirely. What survives is position, the stroke that separates one
216
220
  mark from the next, and the label, which is why the legend carries text
217
221
  and the tooltip names its series rather than relying on a swatch. */
218
- .${S}__bar,.${S}__slice,.${S}__point{fill:CanvasText;stroke:Canvas;stroke-width:1}
219
- .${S}__line{stroke:CanvasText}
220
- .${S}__area{fill:CanvasText;opacity:0.12}
221
- .${S}__swatch{border:1px solid CanvasText}
222
- .${S}__mark[data-dim]{opacity:1;fill:GrayText}
222
+ .${M}__bar,.${M}__slice,.${M}__point{fill:CanvasText;stroke:Canvas;stroke-width:1}
223
+ .${M}__line{stroke:CanvasText}
224
+ .${M}__area{fill:CanvasText;opacity:0.12}
225
+ .${M}__swatch{border:1px solid CanvasText}
226
+ .${M}__mark[data-dim]{opacity:1;fill:GrayText}
223
227
  }
224
- `}function Q(G){const te=G.documentElement;if(!te||te.getAttribute(pe))return;te.setAttribute(pe,"1");const j=G.createElement("style");j.textContent=V(),(G.head||G.body||te).appendChild(j)}}),Je("packages/modules/charts/axis.js",function(s,K){"use strict";Object.defineProperty(s,"normaliseAxes",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"tickValues",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"tickLabeller",{enumerable:!0,get:function(){return E}}),Object.defineProperty(s,"drawAxisTitle",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(s,"labelEvery",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"drawMeasureAxis",{enumerable:!0,get:function(){return X}}),Object.defineProperty(s,"drawCategoryAxis",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(s,"leftLabelRoom",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(s,"setLabelText",{enumerable:!0,get:function(){return C}}),Object.defineProperty(s,"drawBandLabels",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"drawContinuousAxis",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"drawAxisLines",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"createGroups",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"MARK_OVERHANG",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"overhangFor",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"setPlotClip",{enumerable:!0,get:function(){return _}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/svg.js"),pe=S.attrs,ue=S.round,V=S.setText,Q=S.svg,G=K("packages/modules/charts/typography.js"),te=G.applySize,j=G.CHAR_RATIO,c=G.truncateTo,M=K("packages/modules/charts/styles.js").NS,k=6,F=1.2;function J(e){if(e===!1){const t={labels:!1,grid:!1};return{x:{...t},y:{...t},y2:{...t}}}const i=e&&typeof e=="object"?e:{},y=t=>typeof t=="string"?{title:t}:t&&typeof t=="object"?{...t}:{};return{x:y(i.x),y:y(i.y),y2:y(i.y2||i.right)}}function Z(e,i){const y=i&&i.ticks;if(Array.isArray(y)){const g=e.domain;return!g||g.min===void 0?y:y.filter(m=>Number(m)>=g.min&&Number(m)<=g.max)}const t=Number.isFinite(y)&&y>0?Number(y):5;return e.ticks(t)}function E(e,i,y){const t=e&&e.format;return typeof t=="function"?g=>String(t(g)):typeof t=="string"&&y&&y.formatting&&y.formatting.format?g=>String(y.formatting.format(g,t)):i.tick}function ne(e){if(!e.text)return;const i=e.side==="left"||e.side==="right"?e.plot.height:e.plot.width,y=Number.isFinite(i)?c(String(e.text),Math.max(0,i),e.size):String(e.text);if(!y||y==="…")return;const t=Q(e.group.ownerDocument,"text",{class:`${M}__axis-title`});if(te(t,e.size),e.side==="left"){const g=Math.max(e.size,e.plot.left-e.plot.gutter.left+e.size),m=e.plot.top+e.plot.height/2;pe(t,{transform:`translate(${ue(g)} ${ue(m)}) rotate(-90)`,"text-anchor":"middle"})}else if(e.side==="right"){const g=e.plot.right+e.plot.gutter.right-e.size,m=e.plot.top+e.plot.height/2;pe(t,{transform:`translate(${ue(g)} ${ue(m)}) rotate(90)`,"text-anchor":"middle"})}else pe(t,{x:ue(e.plot.left+e.plot.width/2),y:ue(e.plot.bottom+e.plot.gutter.bottom-2),"text-anchor":"middle"});V(t,y),y!==String(e.text)&&t.setAttribute("aria-label",String(e.text)),e.group.appendChild(t)}function v(e){const{values:i,scale:y,size:t,horizontal:g,label:m}=e;if(i.length<2)return 1;let b=1/0;for(let l=1;l<i.length;l++){const u=Math.abs(y.of(i[l])-y.of(i[l-1]));Number.isFinite(u)&&u<b&&(b=u)}if(!Number.isFinite(b))return 1;if(b<=0)return i.length;let O=t*F+2;if(g){let l=0;for(const u of i){const x=String(m(u)||"").length*t*j;x>l&&(l=x)}O=l+k}return Math.max(1,Math.ceil(O/b))}function X(e){const{gridGroup:i,axisGroup:y,plot:t,scale:g,format:m}=e,b=e.config||{},O=Z(g,b),l=E(b,m,e.grid),u=e.size||11,x=v({values:O,scale:g,size:u,horizontal:!!e.horizontal,label:l}),n=b.grid===!1?null:i,d=n?new W(n):null,A=new W(y);for(let p=0;p<O.length;p++){const w=O[p],N=ue(g.of(w)),f=w===0,a=p%x!==0;if(e.horizontal){if(d&&pe(d.next("line",`${M}__gridline`),{x1:N,x2:N,y1:ue(t.top),y2:ue(t.bottom),"stroke-opacity":f?1:.6,"stroke-width":f?1.5:1}),b.labels===!1||a)continue;const o=A.next("text",`${M}__tick`);te(o,u),pe(o,{x:N,y:ue(t.bottom+k),"text-anchor":"middle","dominant-baseline":"hanging"}),V(o,l(w))}else{if(d&&pe(d.next("line",`${M}__gridline`),{x1:ue(t.left),x2:ue(t.right),y1:N,y2:N,"stroke-opacity":f?1:.6,"stroke-width":f?1.5:1}),b.labels===!1||a)continue;const o=A.next("text",`${M}__tick`);te(o,u),pe(o,{x:ue(t.left-k),y:N,"text-anchor":"end","dominant-baseline":"middle"}),V(o,l(w))}}return d?d.finish():new W(i).finish(),A.finish(),O}function oe(e){const{group:i,plot:y,scale:t,labels:g,fontSize:m}=e,b=e.config||{};if(b.labels===!1){new W(i).finish();return}const O=new W(i),l=t.domain,u=t.step,x=b.rotate===void 0||b.rotate==="auto"?e.rotated:!!b.rotate,n=x&&u>0?Math.max(1,Math.ceil(m*Math.SQRT2/u)):1,d=Number.isFinite(b.every)&&b.every>0?Number(b.every):n,A=u*d;for(let p=0;p<l.length;p++){const w=ue(t.centre(l[p]));if(Number.isNaN(w)||p%d!==0)continue;const N=O.next("text",`${M}__tick`);te(N,m);const f=g[p]===void 0?"":g[p];x?(pe(N,{x:0,y:0,"text-anchor":"end","dominant-baseline":"middle",transform:`translate(${w} ${ue(y.bottom+k)}) rotate(-45)`}),C(N,f,Math.max(0,y.gutter.bottom-k)*Math.SQRT2,m)):(pe(N,{x:w,y:ue(y.bottom+k),"text-anchor":"middle","dominant-baseline":"hanging",transform:null}),C(N,f,A,m))}O.finish()}function ee(e){return Math.max(0,(e.gutter?e.gutter.left:e.left)-k)}function C(e,i,y,t){const g=String(i??""),m=c(g,y,t);return V(e,m),m!==g?e.setAttribute("aria-label",g):e.removeAttribute("aria-label"),m}function R(e){const{group:i,plot:y,scale:t,labels:g}=e,m=e.config||{},b=new W(i),O=t.domain,l=e.fontSize,u=ee(y),x=t.step>0?Math.max(1,Math.ceil(l*F/t.step)):1,n=Number.isFinite(m.every)&&m.every>0?Number(m.every):x;for(let d=0;d<O.length;d++){if(d%n!==0)continue;const A=ue(t.centre(O[d]));if(Number.isNaN(A))continue;const p=b.next("text",`${M}__tick`);pe(p,{x:ue(y.left-k),y:A,"text-anchor":"end","dominant-baseline":"middle"}),te(p,l),C(p,g[d],u,l)}b.finish()}function ie(e){const{group:i,plot:y,scale:t,format:g}=e,m=e.config||{};if(m.labels===!1){new W(i).finish();return}const b=E(m,g,e.grid),O=new W(i);for(const l of Z(t,m)){const u=ue(t.of(l));if(u<y.left-1||u>y.right+1)continue;const x=O.next("text",`${M}__tick`);te(x,e.size||11),pe(x,{x:u,y:ue(y.bottom+k),"text-anchor":"middle","dominant-baseline":"hanging"}),V(x,b(l))}O.finish()}function I(e){const{group:i,plot:y}=e,t=new W(i);pe(t.next("line"),{x1:ue(y.left),x2:ue(y.left),y1:ue(y.top),y2:ue(y.bottom)}),pe(t.next("line"),{x1:ue(y.left),x2:ue(y.right),y1:ue(y.bottom),y2:ue(y.bottom)}),t.finish()}let $=0;function me(e,i){const y=`${M}-plot-clip-${++$}`,t=Q(e,"rect"),g=Q(e,"clipPath",{id:y});g.appendChild(t);const m=`${M}-box-clip-${$}`,b=Q(e,"clipPath",{id:m});b.appendChild(Q(e,"rect",{x:0,y:0,width:"100%",height:"100%"}));const O=Q(e,"defs");O.appendChild(g),O.appendChild(b);const l={grid:Q(e,"g",{class:`${M}__grid`}),marks:Q(e,"g",{class:`${M}__marks`}),rules:Q(e,"g",{class:`${M}__axis`}),axis:Q(e,"g",{class:`${M}__axis`}),labels:Q(e,"g",{class:`${M}__labels`}),overlay:Q(e,"g",{class:`${M}__overlay`}),clip:t,clipId:y,boxClipId:m};i.appendChild(O);for(const u of["grid","marks","rules","axis","labels","overlay"])i.appendChild(l[u]);return l}const r=30;function D(e){return e==="bubble"?r:e==="scatter"?6:3}function _(e,i,y){if(!e||!e.marks||!e.clip)return;if(!i||!Number.isFinite(i.width)||!Number.isFinite(i.height)){e.marks.removeAttribute("clip-path");return}const t=Number.isFinite(y)&&y>=0?Number(y):r;pe(e.clip,{x:ue(i.left-t),y:ue(i.top-t),width:ue(Math.max(0,i.width)+t*2),height:ue(Math.max(0,i.height)+t*2)}),e.marks.setAttribute("clip-path",`url(#${e.clipId})`)}}),Je("packages/modules/charts/scale.js",function(s,K){"use strict";Object.defineProperty(s,"isNumber",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"toNumber",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"toTime",{enumerable:!0,get:function(){return j}}),Object.defineProperty(s,"extent",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"niceStep",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"niceDomain",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"measureDomain",{enumerable:!0,get:function(){return k}}),Object.defineProperty(s,"linearTicks",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"timeStepFor",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"timeTicks",{enumerable:!0,get:function(){return E}}),Object.defineProperty(s,"linearScale",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(s,"timeScale",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"key",{enumerable:!0,get:function(){return X}}),Object.defineProperty(s,"bandScale",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(s,"sqrtScale",{enumerable:!0,get:function(){return ee}});const Ae=[1,2,2.5,5,10],W=6e4,S=36e5,pe=864e5,ue=365.25*pe,V=[1,2,5,10,20,25,50,100],Q=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,W,5*W,15*W,30*W,S,3*S,6*S,12*S,pe,2*pe,7*pe,14*pe,30*pe,90*pe,180*pe,...V.map(C=>C*ue)];function G(C){return typeof C=="number"&&Number.isFinite(C)}function te(C){if(C==null||C==="")return null;if(C instanceof Date){const ie=C.getTime();return Number.isFinite(ie)?ie:null}if(typeof C=="boolean")return C?1:0;const R=Number(C);return Number.isFinite(R)?R:null}function j(C){if(C==null||C==="")return null;if(C instanceof Date){const ie=C.getTime();return Number.isFinite(ie)?ie:null}if(typeof C=="number")return Number.isFinite(C)?C:null;const R=Date.parse(String(C));return Number.isFinite(R)?R:null}function c(C){let R=1/0,ie=-1/0;for(let I=0;I<C.length;I++){const $=C[I];G($)&&($<R&&(R=$),$>ie&&(ie=$))}return R===1/0?null:{min:R,max:ie}}function Y(C){if(!(C>0))return 1;const R=10**Math.floor(Math.log10(C));for(const ie of Ae)if(C<=ie*R)return ie*R;return 10*R}function M(C,R=5){const ie=Y((C.max-C.min)/Math.max(1,R));return{min:Math.floor(C.min/ie)*ie,max:Math.ceil(C.max/ie)*ie,step:ie}}function k(C,R={}){const ie=c(C)||{min:0,max:1};let{min:I,max:$}=ie;if(R.zero&&(I>0&&(I=0),$<0&&($=0)),I===$){const me=Math.abs(I)>0?Math.abs(I)/10:1;I-=me,$+=me}if(R.nice!==!1){const me=M({min:I,max:$},R.ticks||5);I=me.min,$=me.max}return G(R.min)&&(I=R.min),G(R.max)&&($=R.max),I===$&&($=I+1),{min:I,max:$}}function F(C,R=5){const ie=Y((C.max-C.min)/Math.max(1,R)),I=Math.ceil(C.min/ie),$=Math.floor(C.max/ie),me=[];for(let r=I;r<=$;r++){const D=r*ie;me.push(Math.abs(D)<ie/1e6?0:Number(D.toPrecision(12)))}return me}function J(C,R=5){const ie=Math.max(1,R),I=C/ie;let $=Q[Q.length-1];for(const D of Q)if(D>=I){$=D;break}if($<ue)return $;let me=$,r=Math.abs(C/$-ie);for(const D of Q){if(D<ue)continue;const _=Math.abs(C/D-ie);_<r&&(r=_,me=D)}return me}function Z(C,R){const ie=new Date(C.min).getUTCFullYear();let I=Math.ceil(ie/R)*R;Date.UTC(I,0,1)<C.min&&(I+=R);const $=[];for(;Date.UTC(I,0,1)<=C.max;I+=R)$.push(Date.UTC(I,0,1));return $}function E(C,R=5){const ie=J(C.max-C.min,R);if(ie>=ue)return Z(C,Math.round(ie/ue));const I=[],$=Math.ceil(C.min/ie)*ie;for(let me=$;me<=C.max;me+=ie)I.push(me);return I}function ne(C,R){const ie=C.max-C.min||1,[I,$]=R;return{kind:"linear",domain:C,range:R,of(me){return I+(me-C.min)/ie*($-I)},invert(me){return C.min+(me-I)/($-I||1)*ie},ticks(me=5){return F(C,me)}}}function v(C,R){return{...ne(C,R),kind:"time",ticks(I=5){return E(C,I)}}}function X(C){if(C==null)return" null";if(C instanceof Date)return` date:${C.getTime()}`;if(typeof C=="object"){const R=C,ie=R.id??R.key??R.value;return ie!==void 0&&typeof ie!="object"?` obj:${String(ie)}`:` obj:${String(C)}`}return String(C)}function oe(C,R,ie=.2){const I=Math.min(.9,Math.max(0,ie)),[$,me]=R,r=new Map;for(let e=0;e<C.length;e++){const i=X(C[e]);r.has(i)||r.set(i,e)}const D=C.length?(me-$)/C.length:me-$,_=Math.max(0,D*(1-I));return{kind:"band",domain:C,range:R,bandwidth:_,step:D,of(e){const i=r.get(X(e));return i===void 0?NaN:$+i*D+(D-_)/2},centre(e){const i=this.of(e);return Number.isNaN(i)?NaN:i+_/2},ticks(){return C}}}function ee(C,R){const[ie,I]=R,$=Math.max(Math.abs(C.max),Math.abs(C.min),0)||1;return{kind:"sqrt",domain:C,range:R,of(me){const r=Math.sqrt(Math.abs(me)/$);return ie+r*(I-ie)}}}}),Je("packages/modules/charts/format.js",function(s,K){"use strict";Object.defineProperty(s,"precisionFor",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"axisNumber",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"r2Digits",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"dateFormatFor",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"formatters",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"measureText",{enumerable:!0,get:function(){return G}});const W=K("packages/modules/charts/scale.js").timeStepFor;function S(te){if(!Number.isFinite(te)||te<=0)return 0;const j=Math.ceil(-Math.log10(te));return Math.min(6,Math.max(0,j))}function pe(te,j,c=0){return Number.isFinite(te)?Math.abs(te)>=1e4?j.number(te,{notation:"compact",maximumFractionDigits:1}):j.number(te,{minimumFractionDigits:c,maximumFractionDigits:c}):""}function ue(te,j){const c=te&&te.messages;return!c||typeof c.number!="function"?Number(j).toFixed(2):c.number(j,{minimumFractionDigits:2,maximumFractionDigits:2})}function V(te){if(te>0){const c=W(te);if(c<1e3)return{minute:"2-digit",second:"2-digit",fractionalSecondDigits:3};if(c<6e4)return{hour:"2-digit",minute:"2-digit",second:"2-digit"}}return te<=2*36e5?{hour:"2-digit",minute:"2-digit"}:te<=3*864e5?{weekday:"short",hour:"2-digit"}:te<=180*864e5?{day:"numeric",month:"short"}:te<=3*365*864e5?{month:"short",year:"numeric"}:{year:"numeric"}}function Q(te,j){const c=te.messages,Y=c.locale,M=te.get("timeZone")||void 0;if(j.kind==="time"){const F=V(j.span||0),J=new Intl.DateTimeFormat(Y,M?{...F,timeZone:M}:F),Z=new Intl.DateTimeFormat(Y,M?{dateStyle:"medium",timeStyle:"short",timeZone:M}:{dateStyle:"medium",timeStyle:"short"});return{tick:E=>Number.isFinite(Number(E))?J.format(new Date(Number(E))):"",value:E=>Number.isFinite(Number(E))?Z.format(new Date(Number(E))):""}}const k=S(j.step||0);return{tick:F=>typeof F=="number"?pe(F,c,k):String(F??""),value:F=>typeof F=="number"?c.number(F):String(F??"")}}function G(te,j){if(te==null||!Number.isFinite(te))return"";const c=Math.abs(te)>=1e-6?Number(te.toPrecision(6)):te;return j.number(c)}}),Je("packages/modules/charts/labels.js",function(s,K){"use strict";Object.defineProperty(s,"resolveLabels",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"collides",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"placeLabels",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"labelText",{enumerable:!0,get:function(){return E}}),Object.defineProperty(s,"drawAnchoredLabels",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(s,"drawDataLabels",{enumerable:!0,get:function(){return v}});const W=K("packages/modules/charts/frame.js").Pool,pe=K("packages/modules/charts/format.js").measureText,ue=K("packages/modules/charts/svg.js"),V=ue.attrs,Q=ue.round,G=ue.setText,j=K("packages/modules/charts/styles.js").NS,c=K("packages/modules/charts/typography.js"),Y=c.applySize,M=c.textWidth,k=4;function F(X){const oe=X&&X.labels;if(!oe)return{show:!1,names:oe!==!1,position:"outside",format:null,minGap:2,total:!1};const ee=typeof oe=="object"?oe:{};return{show:!0,names:!0,position:["outside","inside","auto"].includes(ee.position)?ee.position:"outside",format:ee.format||null,minGap:Number.isFinite(ee.minGap)?Number(ee.minGap):2,total:!!ee.total}}function J(X,oe,ee){for(const C of oe)if(X.x-ee<C.x+C.width&&X.x+X.width+ee>C.x&&X.y-ee<C.y+C.height&&X.y+X.height+ee>C.y)return!0;return!1}function Z(X){const{points:oe,plot:ee,size:C}=X,R=X.minGap===void 0?2:X.minGap,ie=[],I=[];for(const $ of oe){if($.px===void 0||$.py===void 0)continue;const me=X.text($);if(!me)continue;const r=M(me,C),D=C;let _=$.px,e=$.py-k,i="middle",y=!1;X.horizontal?(_=$.px+k,e=$.py,i="start",X.position!=="outside"&&$.pbase!==void 0&&Math.abs($.px-$.pbase)>r+k*2&&(_=$.px-k,i="end",y=!0)):X.position!=="outside"&&$.pbase!==void 0&&Math.abs($.pbase-$.py)>D+k*2&&(e=$.py+D+k,y=!0);const t=()=>({x:i==="middle"?_-r/2:i==="end"?_-r:_,y:e-D,width:r,height:D});let g=t();!(g.y>=ee.top-1)&&!y&&!X.horizontal&&$.pbase!==void 0&&Math.abs($.pbase-$.py)>D+k*2&&(e=$.py+D+k,y=!0,g=t()),!(g.x<ee.left-1||g.x+g.width>ee.right+1)&&(g.y<ee.top-1||g.y+g.height>ee.bottom+D||J(g,ie,R)||(ie.push(g),I.push({x:Q(_),y:Q(e),text:me,anchor:i,inside:y})))}return I}function E(X,oe,ee){return X==null?"":typeof oe.format=="function"?String(oe.format(X)):typeof oe.format=="string"&&ee&&ee.formatting&&ee.formatting.format?String(ee.formatting.format(X,oe.format)):pe(X,ee&&ee.messages)}function ne(X){const oe=new W(X.group),ee=X.minGap===void 0?2:X.minGap,C=X.size,R=[];let ie=0;for(const I of X.anchors){if(!I||!I.text)continue;const $=I.width===void 0?M(I.text,X.size):I.width,me=I.anchor||"middle",D={x:me==="end"?I.x-$:me==="start"?I.x:I.x-$/2,y:I.y-C/2,width:$,height:C};if(X.plot&&(D.x<X.plot.left-1||D.x+D.width>X.plot.right+1||D.y<X.plot.top-1||D.y+D.height>X.plot.bottom+1)||I.width!==void 0&&$>I.width||I.height!==void 0&&C>I.height||J(D,R,ee))continue;R.push(D);const _=oe.next("text",I.className||`${j}__data-label`);Y(_,X.size),V(_,{x:Q(I.x),y:Q(I.y),"text-anchor":me,"dominant-baseline":I.baseline||"middle","data-inside":I.inside?"true":null}),G(_,I.text),ie++}return oe.finish(),ie}function v(X){const oe=new W(X.group),{options:ee}=X;let C=0;const R=ie=>typeof ee.format=="function"&&ie.y!==null&&ie.y!==void 0?String(ee.format(ie.y,ie)):E(ie.y,ee,X.grid);for(const ie of X.series){const I=Z({points:ie.points,plot:X.plot,size:X.size,position:ee.position,horizontal:X.horizontal,minGap:ee.minGap,text:R});for(const $ of I){const me=oe.next("text",`${j}__data-label`);Y(me,X.size),V(me,{x:$.x,y:$.y,"text-anchor":$.anchor,"data-inside":$.inside?"true":null}),G(me,$.text),C++}}return oe.finish(),C}}),Je("packages/modules/charts/dense.js",function(s,K){"use strict";Object.defineProperty(s,"CANVAS_THRESHOLD",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(s,"downsample",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"markCount",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"wantsCanvas",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"paintDense",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"sizeCanvas",{enumerable:!0,get:function(){return V}});const Ae=3e3;function W(Q,G){const te=Q.length;if(!Number.isFinite(G)||G>=te||G<3||te<3)return Q;const j=[Q[0]],c=(te-2)/(G-2);let Y=0;for(let M=0;M<G-2;M++){const k=Math.floor(M*c)+1,F=Math.min(Math.floor((M+1)*c)+1,te-1),J=F,Z=Math.min(Math.floor((M+2)*c)+1,te);let E=0,ne=0,v=0;for(let C=J;C<Z;C++){const R=Q[C];!R||!Number.isFinite(R.y)||(E+=R.x,ne+=R.y,v++)}v&&(E/=v,ne/=v);const X=Q[Y];if(k>=F)continue;let oe=k,ee=-1;for(let C=k;C<F;C++){const R=Q[C];if(!R||!Number.isFinite(R.y))continue;const ie=Math.abs((X.x-E)*(R.y-X.y)-(X.x-R.x)*(ne-X.y));ie>ee&&(ee=ie,oe=C)}oe<=Y||(j.push(Q[oe]),Y=oe)}return j.push(Q[te-1]),j}function S(Q){let G=0;for(const te of Q)G+=te.points.length;return G}function pe(Q){if(Q.canvas===!0)return!0;if(Q.canvas===!1)return!1;const G=Number.isFinite(Q.canvas)?Number(Q.canvas):Ae;return S(Q.series)>G}function ue(Q){const{context:G,series:te,ratio:j}=Q;G.save(),G.scale(j,j);for(const c of te){const Y=Q.colour(c.index);if(Q.type==="scatter"||Q.type==="bubble"){G.fillStyle=Y;for(const k of c.points)k.px!==void 0&&(G.beginPath(),G.arc(k.px,k.py,k.pr||2,0,Math.PI*2),G.fill());continue}G.strokeStyle=Y,G.lineWidth=2,G.lineJoin="round",G.beginPath();let M=!1;for(const k of c.points){if(k.px===void 0||k.py===void 0){M=!1;continue}M?G.lineTo(k.px,k.py):G.moveTo(k.px,k.py),M=!0}G.stroke()}G.restore()}function V(Q){const{canvas:G}=Q;return G.width=Math.max(1,Math.round(Q.width*Q.ratio)),G.height=Math.max(1,Math.round(Q.height*Q.ratio)),G.style&&(G.style.width=`${Q.width}px`,G.style.height=`${Q.height}px`),typeof G.getContext=="function"?G.getContext("2d"):null}}),Je("packages/core/src/internal/util.js",function(s,K){"use strict";Object.defineProperty(s,"VERSION",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"reportedWarnings",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"warnOnce",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"infoOnce",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"resetWarnings",{enumerable:!0,get:function(){return k}}),Object.defineProperty(s,"fail",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"invariant",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"DEV",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"isObject",{enumerable:!0,get:function(){return E}}),Object.defineProperty(s,"isFunction",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(s,"isNil",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"isBlank",{enumerable:!0,get:function(){return X}}),Object.defineProperty(s,"isCtor",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(s,"pathGetter",{enumerable:!0,get:function(){return C}}),Object.defineProperty(s,"pathSetter",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"getPath",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"setPath",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"humanise",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"escapeHtml",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"titleCase",{enumerable:!0,get:function(){return _}}),Object.defineProperty(s,"expand",{enumerable:!0,get:function(){return e}}),Object.defineProperty(s,"toArray",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"merge",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"mergeRow",{enumerable:!0,get:function(){return g}}),Object.defineProperty(s,"Lru",{enumerable:!0,get:function(){return m}}),Object.defineProperty(s,"collator",{enumerable:!0,get:function(){return O}}),Object.defineProperty(s,"defaultCompare",{enumerable:!0,get:function(){return l}}),Object.defineProperty(s,"now",{enumerable:!0,get:function(){return u}}),Object.defineProperty(s,"nextFrame",{enumerable:!0,get:function(){return n}}),Object.defineProperty(s,"cancelFrame",{enumerable:!0,get:function(){return d}}),Object.defineProperty(s,"frameBatched",{enumerable:!0,get:function(){return A}}),Object.defineProperty(s,"settleDebounce",{enumerable:!0,get:function(){return p}}),Object.defineProperty(s,"whenIdle",{enumerable:!0,get:function(){return w}}),Object.defineProperty(s,"uid",{enumerable:!0,get:function(){return f}});const Ae="1.71.0";async function W(){return Ae}const S="1.71.0",pe=new Set,ue=2e3;function V(a){if(pe.add(a),pe.size>ue){const o=pe.values().next().value;o!==void 0&&pe.delete(o)}}const Q=[],G=500;function te(a,o,h){Q.push({key:a,level:o,message:h.map(B=>typeof B=="string"?B:j(B)).join(" "),at:Date.now()}),Q.length>G&&Q.shift()}function j(a){if(a instanceof Error)return a.message;try{return JSON.stringify(a)}catch{return String(a)}}function c(){return Q.map(a=>({...a}))}function Y(a,...o){pe.has(a)||(V(a),te(a,"warn",o),console.warn("[lattice]",...o))}function M(a,...o){pe.has(a)||(V(a),te(a,"info",o),console.info("[lattice]",...o))}function k(){pe.clear(),Q.length=0}function F(a,o){const h=new Error(`[lattice] ${a}`);throw o!==void 0&&(h.cause=o),h}function J(a,o){a||F(o)}const Z=(()=>{try{return!(typeof process<"u"&&process.env&&process.env.NODE_ENV==="production")}catch{return!0}})();function E(a){return a!==null&&typeof a=="object"&&!Array.isArray(a)}function ne(a){return typeof a=="function"}function v(a){return a==null}function X(a){return a==null||a===""}function oe(a){return typeof a!="function"?!1:/^class[\s{]/.test(Function.prototype.toString.call(a))?!0:!!(a.prototype&&Object.getOwnPropertyNames(a.prototype).length>1)}const ee=new Map;function C(a){let o=ee.get(a);if(o)return o;if(!a.includes("."))o=h=>h?.[a];else{const h=a.split("."),B=h.length;o=z=>{let U=z;for(let q=0;q<B;q++){if(U==null)return;U=U[h[q]]}return U}}return ee.set(a,o),o}const R=new Map;function ie(a){let o=R.get(a);if(o)return o;if(!a.includes("."))o=(h,B)=>{h!=null&&(h[a]=B)};else{const h=a.split("."),B=h.length-1;o=(z,U)=>{let q=z;for(let se=0;se<B;se++){if(q==null)return;const T=h[se];q[T]==null&&(q[T]={}),q=q[T]}q!=null&&(q[h[B]]=U)}}return R.set(a,o),o}function I(a,o){return C(o)(a)}function $(a,o,h){ie(o)(a,h)}function me(a){return a?(a.includes(".")?a.slice(a.lastIndexOf(".")+1):a).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(/^./,h=>h.toUpperCase()):""}const r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function D(a){const o=a==null?"":String(a);return/[&<>"']/.test(o)?o.replace(/[&<>"']/g,h=>r[h]):o}function _(a){return String(a).replace(/\w\S*/g,o=>o[0].toUpperCase()+o.slice(1).toLowerCase())}function e(a,o,h){if(a!==void 0)return a===!0?{enabled:!0,...h}:a===!1?{enabled:!1}:E(a)?a:{[o]:a,enabled:!0}}function i(a){return a==null?[]:Array.isArray(a)?a:[a]}const y=Object.freeze(new Set(["__proto__","constructor","prototype"]));function t(a,o){if(!E(a))return E(o)?{...o}:o;if(!E(o))return o===void 0?a:o;const h={...a};for(const B of Object.keys(o)){if(y.has(B))continue;const z=o[B];z!==void 0&&(h[B]=E(z)&&E(h[B])?t(h[B],z):z)}return h}function g(a,o){if(!E(a)||!E(o)||a===o)return o;const h=Object.create(Object.getPrototypeOf(a));return Object.assign(h,a,o),h}class m{#l;#n=new Map;#c;constructor(o=256,h=null){this.#l=o,this.#c=h}get size(){return this.#n.size}get max(){return this.#l}set max(o){this.#l=o,this.#e()}has(o){return this.#n.has(o)}get(o){const h=this.#n;if(!h.has(o))return;const B=h.get(o);return h.delete(o),h.set(o,B),B}peek(o){return this.#n.get(o)}set(o,h){const B=this.#n;return B.has(o)&&B.delete(o),B.set(o,h),this.#e(),h}delete(o){const h=this.#n.get(o);return this.#n.delete(o)&&this.#c&&this.#c(h,o),h}clear(){if(this.#c)for(const[o,h]of this.#n)this.#c(h,o);this.#n.clear()}keys(){return this.#n.keys()}values(){return this.#n.values()}#e(){const o=this.#n;for(;o.size>this.#l;){const h=o.keys().next().value,B=o.get(h);o.delete(h),this.#c&&this.#c(B,h)}}}const b=new Map;function O(a,o){const h=`${a||""}|${o?JSON.stringify(o):""}`;let B=b.get(h);return B||(B=new Intl.Collator(a||void 0,{numeric:!0,sensitivity:"variant",...o}),b.set(h,B)),B}function l(a,o){if(a===o)return 0;if(a==null)return 1;if(o==null)return-1;if(typeof a=="number"&&typeof o=="number")return Number.isNaN(a)?Number.isNaN(o)?0:1:Number.isNaN(o)||a<o?-1:a>o?1:0;const h=String(a),B=String(o);return h<B?-1:h>B?1:0}function u(){return typeof performance<"u"&&performance.now?performance.now():Date.now()}const x=typeof requestAnimationFrame=="function";function n(a){return x?requestAnimationFrame(a):setTimeout(()=>a(u()),16)}function d(a){a!=null&&(x?cancelAnimationFrame(a):clearTimeout(a))}function A(a){let o=null,h=null;const B=()=>{o=null;const U=h;h=null,a(...U||[])},z=(...U)=>{h=U,o===null&&(o=n(B))};return z.cancel=()=>{d(o),o=null,h=null},z.flush=()=>{o!==null&&(d(o),B())},z}function p(a,o){let h=null,B=null;const z=()=>{if(h=null,B===null)return;const se=B;B=null,a(...se),U()},U=()=>{h=setTimeout(z,o),typeof h?.unref=="function"&&h.unref()},q=(...se)=>{h===null?(a(...se),U()):(B=se,clearTimeout(h),U())};return q.flush=()=>{if(h!==null&&clearTimeout(h),h=null,B===null)return;const se=B;B=null,a(...se)},q.cancel=()=>{h!==null&&clearTimeout(h),h=null,B=null},q.pending=()=>h!==null||B!==null,q}function w(a,o=50){return typeof requestIdleCallback=="function"?requestIdleCallback(a,{timeout:o}):setTimeout(()=>a({timeRemaining:()=>0,didTimeout:!0}),1)}let N=0;function f(a="l"){return`${a}${(++N).toString(36)}`}}),Je("packages/modules/charts/annotations.js",function(s,K){"use strict";Object.defineProperty(s,"overlayLayer",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"annotationValue",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"annotationAxis",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"annotationText",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"drawAnnotations",{enumerable:!0,get:function(){return me}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/scale.js"),pe=S.isNumber,ue=S.toNumber,V=S.toTime,Q=K("packages/modules/charts/svg.js"),G=Q.attrs,te=Q.path,j=Q.round,c=Q.setText,Y=Q.SVG_NS,k=K("packages/modules/charts/styles.js").NS,J=K("packages/core/src/internal/util.js").warnOnce;function Z(r,D){for(const e of r.childNodes||[])if(e&&String(e.getAttribute&&e.getAttribute("class"))===D)return e;const _=r.ownerDocument.createElementNS(Y,"g");return _.setAttribute("class",D),r.appendChild(_),_}const E=new Set(["line","target","band","callout","event"]);function ne(r,D){return r.kind==="time"?V(D):ue(D)}function v(r,D,_){if(r.kind==="band"){const i=r.of(D);if(!Number.isFinite(i))return NaN;const y=Number(r.bandwidth)||0;return _==="right"?i+y:i}const e=ne(r,D);return e===null?NaN:r.of(e)}function X(r,D,_){const e=r.kind||"line",i=r.label?` (${JSON.stringify(r.label)})`:"";J(`chart:annotation:dropped:${e}:${D}:${_}`,`chart annotation${i} of kind ${JSON.stringify(e)}, reading the ${D} axis, was not drawn: ${_}.`)}function oe(r,D){if(r instanceof Date){const e=r.getTime();return Number.isFinite(e)?r.toISOString().slice(0,10):String(r)}if(typeof r=="number")return Number.isFinite(r)?D(r):String(r);const _=ue(r);return _===null||typeof r=="string"?String(r):D(_)}function ee(r,D,_){const e=[];for(const i of r)if((i.axis==="right"?"right":"left")===_&&!(D.series!==void 0&&i.key!==D.series))for(const t of i.points)pe(t.y)&&e.push(Number(t.y));return e}function C(r,D){if(!r.length)return null;const _=[...r].sort((t,g)=>t-g);if(_.length===1)return _[0];const e=Math.min(100,Math.max(0,D))/100*(_.length-1),i=Math.floor(e),y=Math.ceil(e);return i===y?_[i]:_[i]+(_[y]-_[i])*(e-i)}function R(r,D,_){if(!r.compute)return ue(r.value);const e=ee(D,r,_);if(!e.length)return null;const i=String(r.compute).toLowerCase();if(i==="mean"||i==="avg")return e.reduce((t,g)=>t+g,0)/e.length;if(i==="median"||i==="p50")return C(e,50);if(i==="min")return Math.min(...e);if(i==="max")return Math.max(...e);const y=/^p(\d+(?:\.\d+)?)$/.exec(i);return y?C(e,Number(y[1])):null}function ie(r){return r.axis==="right"||r.axis==="y2"?"right":"left"}function I(r,D,_,e){const i=r.label?`${r.label}: `:"",y=e?` (${ie(r)==="right"?"right axis":"left axis"})`:"",t=r.kind||"line";if(t==="band"){if(!Array.isArray(D)||D[0]===null||D[1]===null)return"";const[m,b]=D;return`${i||"Band: "}${_(Math.min(m,b))} to ${_(Math.max(m,b))}${y}`}return D==null?"":`${i||`${t==="target"?"Target":t==="callout"?"Callout":"Reference"}: `}${_(D)}${y}`}function $(r){return(r.kind||"line")==="band"?0:1}function me(r){const{group:D,plot:_,xScale:e,yScale:i,rightScale:y,series:t,format:g}=r,m=new W(Z(D,`${k}__annotations`)),b=[],l=[...Array.isArray(r.annotations)?r.annotations:[]].sort((u,x)=>$(u)-$(x));for(const u of l){const x=u.kind||"line";if(!E.has(x))continue;const n=ie(u),d=n==="right"&&y?y:i;if(x==="band"){if(u.orient==="vertical"){const h=v(e,u.from,"left"),B=v(e,u.to,"right");if(Number.isNaN(h)||Number.isNaN(B)){const se=Number.isNaN(h)&&Number.isNaN(B)?"from and to":Number.isNaN(h)?"from":"to";X(u,n,`its ${se} value could not be placed on the x scale`);continue}const z=j(Math.min(h,B)),U=j(Math.max(h,B));if(G(m.next("rect",`${k}__annotation-band ${u.className||""}`.trim()),{x:z,y:j(_.top),width:Math.max(0,U-z),height:j(Math.max(0,_.bottom-_.top)),fill:u.colour||"currentColor","fill-opacity":u.opacity===void 0?.12:u.opacity}),u.label){const se=m.next("text",`${k}__annotation-label`);G(se,{x:z+4,y:j(_.top+12),"text-anchor":"start"}),c(se,u.label)}const q=u.label?`${u.label}: `:"Event window: ";b.push({text:`${q}${oe(u.from,g)} to ${oe(u.to,g)}`});continue}const N=R({...u,value:u.from,compute:u.fromCompute},t,n),f=R({...u,value:u.to,compute:u.toCompute},t,n);if(N===null||f===null)continue;const a=j(d.of(N)),o=j(d.of(f));if(G(m.next("rect",`${k}__annotation-band ${u.className||""}`.trim()),{x:j(_.left),y:Math.min(a,o),width:j(Math.max(0,_.right-_.left)),height:Math.max(0,Math.abs(o-a)),fill:u.colour||"currentColor","fill-opacity":u.opacity===void 0?.12:u.opacity}),u.label){const h=m.next("text",`${k}__annotation-label`);G(h,{x:j(_.left+4),y:Math.min(a,o)+12,"text-anchor":"start"}),c(h,u.label)}b.push({text:I(u,[N,f],g,r.dual)});continue}if(x==="event"){const N=u.x!==void 0?u.x:u.at,f=j(v(e,N,"left")+(e.kind==="band"?(Number(e.bandwidth)||0)/2:0));if(Number.isNaN(f)){X(u,n,"its x value could not be placed on the x scale");continue}if(G(m.next("path",`${k}__annotation-event`),{d:te(["M",f,j(_.top),"L",f,j(_.bottom)]),stroke:u.colour||"currentColor",fill:"none"}),G(m.next("circle",`${k}__annotation-event-flag`),{cx:f,cy:j(_.top),r:3,fill:u.colour||"currentColor"}),u.label){const o=m.next("text",`${k}__annotation-label`);G(o,{x:f+5,y:j(_.top+10),"text-anchor":"start"}),c(o,u.label)}const a=u.label?`${u.label} — `:"Event — ";b.push({text:`${a}at ${oe(N,g)}`});continue}if(x==="callout"){const N=R(u,t,n);if(N===null)continue;const f=u.at!==void 0?j(e.kind==="band"?e.centre(u.at):e.of(ne(e,u.at)??NaN)):j(_.right-4),a=j(d.of(N));if(Number.isNaN(f)){X(u,n,"its x value could not be placed on the x scale");continue}if(G(m.next("circle",`${k}__annotation-point`),{cx:f,cy:a,r:3.5,fill:u.colour||"currentColor"}),u.label){const o=m.next("text",`${k}__annotation-label`);G(o,{x:f+6,y:a-6,"text-anchor":"start"}),c(o,u.label)}b.push({text:I(u,N,g,r.dual)});continue}if(u.orient==="vertical"||u.x!==void 0){const N=u.x!==void 0?u.x:u.value,f=e.kind==="band"?j(e.centre(N)):j(e.of(ne(e,N)??NaN));if(Number.isNaN(f)){X(u,n,"its x value could not be placed on the x scale");continue}const a=x==="target"?`${k}__annotation-target`:`${k}__annotation-line`;if(G(m.next("path",a),{d:te(["M",f,j(_.top),"L",f,j(_.bottom)]),stroke:u.colour||"currentColor",fill:"none"}),u.label){const o=m.next("text",`${k}__annotation-label`);G(o,{x:f+4,y:j(_.top+10),"text-anchor":"start"}),c(o,u.label)}b.push({text:u.label?`${u.label} — at ${oe(N,g)}`:""});continue}const A=R(u,t,n);if(A===null)continue;const p=j(d.of(A)),w=x==="target"?`${k}__annotation-target`:`${k}__annotation-line`;if(G(m.next("path",w),{d:te(["M",j(_.left),p,"L",j(_.right),p]),stroke:u.colour||"currentColor",fill:"none"}),u.label){const N=m.next("text",`${k}__annotation-label`);G(N,{x:j(_.right-4),y:p-4,"text-anchor":"end"}),c(N,u.label)}b.push({text:I(u,A,g,r.dual)})}return m.finish(),b.filter(u=>u.text)}}),Je("packages/modules/charts/combo.js",function(s,K){"use strict";Object.defineProperty(s,"toPareto",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"drawCombo",{enumerable:!0,get:function(){return b}}),Object.defineProperty(s,"drawRightAxis",{enumerable:!0,get:function(){return O}});const Ae=K("packages/modules/charts/axis.js"),W=Ae.drawAxisLines,S=Ae.drawCategoryAxis,pe=Ae.drawContinuousAxis,ue=Ae.drawMeasureAxis,V=Ae.overhangFor,Q=Ae.setPlotClip,G=K("packages/modules/charts/frame.js"),te=G.Pool,j=G.shouldRotate,Y=K("packages/modules/charts/format.js").formatters,M=K("packages/modules/charts/scale.js"),k=M.bandScale,F=M.extent,J=M.isNumber,Z=M.linearScale,E=M.measureDomain,ne=M.timeScale,v=M.toNumber,X=M.toTime,oe=K("packages/modules/charts/svg.js"),ee=oe.attrs,C=oe.path,R=oe.round,I=K("packages/modules/charts/styles.js").NS,me=K("packages/modules/charts/scheme.js").resolveScheme,D=K("packages/modules/charts/labels.js").drawDataLabels,e=K("packages/modules/charts/annotations.js").drawAnnotations;function i(l){return{left:l.filter(u=>u.axis!=="right"),right:l.filter(u=>u.axis==="right")}}function y(l,u){const x=[];for(const n of l)for(const d of n.points)x.push(d.y);return E(x,{zero:u})}function t(l){const u=l.series[0];if(!u)return l;const x=u.points.map((p,w)=>({point:p,label:l.labels[w],category:l.categories[w]})).filter(p=>J(p.point.y)).sort((p,w)=>w.point.y-p.point.y),n=x.reduce((p,w)=>p+w.point.y,0);let d=0;const A=x.map(p=>(d+=p.point.y,n>0?d/n*100:0));return{...l,categories:x.map(p=>p.category),labels:x.map(p=>p.label),series:[{...u,index:0,mark:"bar",axis:"left",points:x.map(p=>p.point)},{key:"cumulative",label:l.cumulativeLabel||"%",index:1,mark:"line",axis:"right",points:x.map((p,w)=>({x:p.category,xKey:p.point.xKey,label:p.label,y:A[w],rows:p.point.rows,rowKey:p.point.rowKey}))}]}}function g(l,u){const x=[u.left,u.right];if(l.kind!=="time"&&l.kind!=="linear")return k(l.categories,x,.2);const n=l.kind==="time"?l.categories.map(X):l.categories.map(v);if(l.kind==="time"){const A=F(n);if(A&&A.min===A.max)return ne({min:A.min-3e4,max:A.max+3e4},x)}const d=E(n,{zero:!1,nice:l.kind!=="time"});return l.kind==="time"?ne(d,x):Z(d,x)}function m(l,u){const x=[...new Set(l.filter(w=>Number.isFinite(w)))].sort((w,N)=>w-N);if(x.length<2){const[w,N]=u.range;return Math.max(4,(N-w)/10)}const n=[];for(let w=1;w<x.length;w++)n.push(x[w]-x[w-1]);n.sort((w,N)=>w-N);const d=Math.floor(n.length/2),A=n.length%2?n[d]:(n[d-1]+n[d])/2,p=Math.abs(u.of(x[0]+A)-u.of(x[0]));return Math.max(1,p*.8)}function b(l){const u=l.scheme||me(),{plot:x}=l,n=l.pareto?t(l.bound):l.bound,d=n.series.filter(he=>!l.hidden.has(he.key)),A=i(d),p=A.left.some(he=>(he.mark||"bar")==="bar"),w=y(A.left,p),N=Z(w,[x.bottom,x.top]),f=A.right.length?l.pareto?{min:0,max:100}:y(A.right,!1):null,a=f?Z(f,[x.bottom,x.top]):null,o=g(n,x),h=o.kind!=="band",B=h?n.categories.map(he=>n.kind==="time"?X(he):v(he)):null;ue({gridGroup:l.groups.grid,axisGroup:l.groups.axis,plot:x,scale:N,format:Y(l.grid,{kind:"linear",step:(w.max-w.min)/5})}),h?pe({group:l.groups.overlay,plot:x,scale:o,format:Y(l.grid,{kind:n.kind,span:o.domain.max-o.domain.min,step:(o.domain.max-o.domain.min)/5}),grid:l.grid,size:l.fontSize}):S({group:l.groups.overlay,plot:x,scale:o,labels:n.labels,fontSize:l.fontSize,rotated:j(n.labels,o.step,l.fontSize)}),W({group:l.groups.rules,plot:x}),a&&O({group:l.groups.axis,plot:x,scale:a,colour:u.series(A.right[0].index),format:Y(l.grid,{kind:"linear",step:(f.max-f.min)/5}),suffix:l.pareto?"%":""}),Q(l.groups,x,V(l.type));const z=new te(l.groups.marks),U=d.filter(he=>(he.mark||"bar")==="bar"),q=h?m(B,o):o.bandwidth,se=U.length?q/U.length:q;let T=0;for(const he of d){const be=he.mark||"bar",we=he.axis==="right"&&a?a:N,ye=u.series(he.index);if(be==="bar"){const xe=T*se;T++;const _e=we.of(Math.max(we.domain.min,0));for(let $e=0;$e<he.points.length;$e++){const Oe=he.points[$e];if(!J(Oe.y))continue;let Ie;if(h){const We=n.kind==="time"?X(Oe.x):v(Oe.x);Ie=We===null?NaN:o.of(We)-q/2}else Ie=o.of(Oe.x);if(Number.isNaN(Ie))continue;const He=we.of(Oe.y);ee(z.next("rect",`${I}__bar ${I}__mark`),{x:R(Ie+xe),y:R(Math.min(He,_e)),width:R(Math.max(0,se)),height:R(Math.max(1,Math.abs(_e-He))),fill:ye,"data-series":he.index,"data-point":$e}),Oe.px=R(Ie+xe+se/2),Oe.py=R(Math.min(He,_e))}continue}const ve=[];let Te=!1;for(const xe of he.points){if(!J(xe.y)){Te=!1;continue}let _e;if(h){const Oe=n.kind==="time"?X(xe.x):v(xe.x);_e=Oe===null?NaN:R(o.of(Oe))}else _e=R(o.centre(xe.x));if(Number.isNaN(_e)){Te=!1;continue}const $e=R(we.of(xe.y));ve.push(Te?"L":"M",_e,$e),Te=!0,xe.px=_e,xe.py=$e}ee(z.next("path",`${I}__line ${I}__mark`),{d:ve.length?C(ve):"",stroke:ye,"data-series":he.index});for(const xe of he.points)xe.px!==void 0&&ee(z.next("circle",`${I}__point ${I}__mark`),{cx:xe.px,cy:xe.py,r:3,fill:ye})}z.finish(),l.labels&&l.labels.show&&D({group:l.groups.labels,series:d,plot:x,options:l.labels,grid:l.grid,size:l.typography&&l.typography.small||l.fontSize});let le=null;return l.annotations&&l.annotations.length&&(le=e({group:l.groups.overlay,plot:x,xScale:o,yScale:N,rightScale:a,series:d,annotations:l.annotations,dual:!!a,format:Y(l.grid,{kind:"linear",step:(w.max-w.min)/5}).tick})),{xScale:o,yScale:N,rightScale:a,dual:!!a,series:d,bound:n,annotations:le}}function O(l){const{group:u,plot:x,scale:n,format:d}=l,A=new te(u);ee(A.next("line",`${I}__axis-right`),{x1:R(x.right),x2:R(x.right),y1:R(x.top),y2:R(x.bottom),stroke:l.colour});for(const p of n.ticks(5)){const w=R(n.of(p)),N=A.next("text",`${I}__tick`);ee(N,{x:R(x.right+6),y:w,"text-anchor":"start","dominant-baseline":"middle",fill:l.colour}),N.textContent=`${d.tick(p)}${l.suffix||""}`}A.finish()}}),Je("packages/modules/charts/quantile.js",function(s,K){"use strict";Object.defineProperty(s,"normalQuantile",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"studentTQuantile",{enumerable:!0,get:function(){return j}});const Ae=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),W=3e-12,S=1e-300;function pe(c){if(c<.5)return Math.log(Math.PI/Math.sin(Math.PI*c))-pe(1-c);const Y=c-1;let M=.9999999999998099;const k=Y+7.5;for(let F=0;F<Ae.length;F++)M+=Ae[F]/(Y+F+1);return .5*Math.log(2*Math.PI)+(Y+.5)*Math.log(k)-k+Math.log(M)}function ue(c,Y,M){const k=c+Y,F=c+1,J=c-1;let Z=1,E=1-k*M/F;Math.abs(E)<S&&(E=S),E=1/E;let ne=E;for(let v=1;v<=300;v++){const X=2*v;let oe=v*(Y-v)*M/((J+X)*(c+X));E=1+oe*E,Math.abs(E)<S&&(E=S),Z=1+oe/Z,Math.abs(Z)<S&&(Z=S),E=1/E,ne*=E*Z,oe=-(c+v)*(k+v)*M/((c+X)*(F+X)),E=1+oe*E,Math.abs(E)<S&&(E=S),Z=1+oe/Z,Math.abs(Z)<S&&(Z=S),E=1/E;const ee=E*Z;if(ne*=ee,Math.abs(ee-1)<W)break}return ne}function V(c,Y,M){if(!(c>0)||!(Y>0)||!Number.isFinite(M))return Number.NaN;if(M<=0)return 0;if(M>=1)return 1;const k=Math.exp(pe(c+Y)-pe(c)-pe(Y)+c*Math.log(M)+Y*Math.log(1-M));return M<(c+1)/(c+Y+2)?k*ue(c,Y,M)/c:1-k*ue(Y,c,1-M)/Y}function Q(c){const Y=Math.abs(c),M=2/(2+Y),k=4*M-2,F=[-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 J=0,Z=0,E;for(let v=F.length-1;v>0;v--)E=Z,Z=k*Z-J+F[v],J=E;const ne=M*Math.exp(-Y*Y+.5*(F[0]+k*Z)-J);return c>=0?ne:2-ne}function G(c){if(!(c>0)||!(c<1))return c===0?-1/0:c===1?1/0:Number.NaN;const Y=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],M=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],k=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],F=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],J=.02425;let Z,E,ne;c<J?(Z=Math.sqrt(-2*Math.log(c)),ne=(((((k[0]*Z+k[1])*Z+k[2])*Z+k[3])*Z+k[4])*Z+k[5])/((((F[0]*Z+F[1])*Z+F[2])*Z+F[3])*Z+1)):c<=1-J?(Z=c-.5,E=Z*Z,ne=(((((Y[0]*E+Y[1])*E+Y[2])*E+Y[3])*E+Y[4])*E+Y[5])*Z/(((((M[0]*E+M[1])*E+M[2])*E+M[3])*E+M[4])*E+1)):(Z=Math.sqrt(-2*Math.log(1-c)),ne=-(((((k[0]*Z+k[1])*Z+k[2])*Z+k[3])*Z+k[4])*Z+k[5])/((((F[0]*Z+F[1])*Z+F[2])*Z+F[3])*Z+1));const X=(.5*Q(-ne/Math.SQRT2)-c)*Math.sqrt(2*Math.PI)*Math.exp(ne*ne/2);return ne-X/(1+ne*X/2)}function te(c,Y){if(!(Y>0)||!Number.isFinite(c))return Number.NaN;const M=.5*V(Y/2,.5,Y/(Y+c*c));return c>0?1-M:M}function j(c,Y){if(!(c>0)||!(c<1)||!(Y>0))return Number.NaN;if(Y>1e7)return G(c);let M=-1e4,k=1e4,F=G(c);const J=pe(Y/2)+pe(.5)-pe((Y+1)/2);for(let Z=0;Z<60;Z++){const E=te(F,Y);E<c?M=F:k=F;const ne=Math.exp(-((Y+1)/2)*Math.log(1+F*F/Y)-J)/Math.sqrt(Y),v=ne>0?(E-c)/ne:0;if(Math.abs(v)<1e-12)break;const X=F-v;if(F=X>M&&X<k&&Number.isFinite(X)?X:(M+k)/2,k-M<1e-12)break}return F}}),Je("packages/modules/charts/trendline.js",function(s,K){"use strict";Object.defineProperty(s,"normaliseTrends",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"linearTrend",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"movingAverageTrend",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"exponentialTrend",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"computeTrend",{enumerable:!0,get:function(){return y}}),Object.defineProperty(s,"trendText",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"drawTrendlines",{enumerable:!0,get:function(){return g}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/svg.js"),pe=S.attrs,ue=S.path,V=S.ribbonPath,Q=S.round,G=S.setText,te=S.SVG_NS,c=K("packages/modules/charts/typography.js").applySize,M=K("packages/modules/charts/styles.js").NS,k=K("packages/modules/charts/scale.js"),F=k.toNumber,J=k.toTime,E=K("packages/modules/charts/quantile.js").studentTQuantile,v=K("packages/modules/charts/format.js").r2Digits,X={linear:new Set(["linear","lr","ols","regression","least-squares"]),movingAverage:new Set(["movingaverage","moving-average","ma","sma","rolling"]),exponential:new Set(["exponential","exp","ewma","ses","holt","smoothing"])},oe=1e-4,ee=1-1e-4;function C(m){const b=String(m||"linear").toLowerCase();return X.linear.has(b)?"linear":X.movingAverage.has(b)?"movingAverage":X.exponential.has(b)?"exponential":null}function R(m){if(!m)return[];const b=Array.isArray(m)?m:[m],O=[];for(const l of b){if(l===!0){O.push({method:"linear"});continue}if(typeof l=="string"){const u=C(l);u&&O.push({method:u});continue}if(l&&typeof l=="object"){const u=C(l.method);u&&O.push({...l,method:u})}}return O}function ie(m,b){if(m.kind==="band")return m.centre(b);const O=m.kind==="time"?J(b):F(b);return O===null?NaN:m.of(O)}function I(m){const b=[];for(const O of m.points){const l=Number(O.y);b.push({value:Number.isFinite(l)?l:null,rawX:O.x})}return b}function $(m,b){const O=[];for(const l of m.points){const u=b.kind==="time"?J(l.x):F(l.x),x=Number(l.y);u===null||!Number.isFinite(u)||!Number.isFinite(x)||O.push({x:u,y:x})}return O.sort((l,u)=>l.x-u.x),O}function me(m,b,O={}){const l=m.length;if(l<2)return null;let u=0,x=0;for(const q of m)u+=q.x,x+=q.y;u/=l,x/=l;let n=0,d=0,A=0;for(const q of m){const se=q.x-u,T=q.y-x;n+=se*se,d+=se*T,A+=T*T}if(n===0)return null;const p=d/n,w=x-p*u,N=A===0?1:Math.max(0,Math.min(1,d*d/(n*A))),f=m[0].x,a=m[l-1].x,o=q=>({x:q,y:w+p*q}),h=[o(f),o(a)],B=[];let z=null;const U=Math.max(0,Math.floor(Number(b)||0));if(U>0&&a>f){const q=(a-f)/(l-1);if(q>0&&(B.push(o(a),o(a+U*q)),l>2)){const se=Number.isFinite(O.confidence)&&O.confidence>0&&O.confidence<1?Number(O.confidence):.95,T=1-(1-se)/2,le=Math.max(0,A-p*d),he=Math.sqrt(le/(l-2)),be=E(T,l-2),we=[];for(let ye=0;ye<=U;ye++){const ve=a+ye*q,Te=w+p*ve,xe=1/l+(ve-u)**2/n,_e=he*Math.sqrt(1+xe),$e=he*Math.sqrt(xe);we.push({x:ve,mean:Te,lower:Te-be*_e,upper:Te+be*_e,lowerMean:Te-be*$e,upperMean:Te+be*$e})}z={confidence:se,points:we}}}return{fit:h,forecast:B,band:z,stats:{method:"linear",slope:p,intercept:w,r2:N,n:l,forecast:B.length?U:0,confidence:z?z.confidence:null}}}function r(m,b){const O=Math.max(1,Math.floor(Number(b)||3)),l=[];let u=0;const x=[];for(const n of m)Number.isFinite(n.value)&&(l.push(n.value),u+=n.value,l.length>O&&(u-=l.shift())),l.length&&x.push({x:n.rawX,y:u/l.length});return x.length<2?null:{fit:x,stats:{method:"movingAverage",window:O}}}function D(m,b){const O=m.length,l=new Array(O).fill(null);let u=null,x=0;for(let n=0;n<O;n++){const d=m[n];if(!Number.isFinite(d)){u!==null&&(l[n]=u);continue}if(u===null){u=d,l[n]=d;continue}x+=(d-u)**2,u=b*d+(1-b)*u,l[n]=u}return{smoothed:l,sse:x}}function _(m,b,O){const l=m.length,u=new Array(l).fill(null);let x=null,n=null,d=0;for(let A=0;A<l;A++){const p=m[A];if(!Number.isFinite(p)){x!==null&&(x+=n,u[A]=x);continue}if(x===null){x=p,u[A]=p;continue}if(n===null){n=p-x;const f=x+n;d+=(p-f)**2;const a=x;x=b*p+(1-b)*(a+n),n=O*(x-a)+(1-O)*n,u[A]=x;continue}const w=x+n;d+=(p-w)**2;const N=x;x=b*p+(1-b)*(N+n),n=O*(x-N)+(1-O)*n,u[A]=x}return{smoothed:u,sse:d}}function e(m,b,O,l=80){const u=(Math.sqrt(5)-1)/2;let x=b,n=O,d=n-u*(n-x),A=x+u*(n-x),p=m(d),w=m(A);for(let N=0;N<l;N++)p<w?(n=A,A=d,w=p,d=n-u*(n-x),p=m(d)):(x=d,d=A,p=w,A=x+u*(n-x),w=m(A));return(x+n)/2}function i(m,b){const O=String(b.kind||b.model||"").toLowerCase()==="holt",l=m.map(w=>Number.isFinite(w.value)?w.value:null);if(l.filter(w=>w!==null).length<(O?2:1))return null;const x=w=>Math.min(ee,Math.max(oe,w));let n=Number.isFinite(b.alpha)?x(Number(b.alpha)):null,d=O&&Number.isFinite(b.beta)?x(Number(b.beta)):null;if(O){if(n===null||d===null){let w=n===null?.5:n,N=d===null?.5:d;for(let f=0;f<6;f++)n===null&&(w=e(a=>_(l,a,N).sse,oe,ee)),d===null&&(N=e(a=>_(l,w,a).sse,oe,ee));n=n===null?w:n,d=d===null?N:d}}else n===null&&(n=e(w=>D(l,w).sse,oe,ee));const A=O?_(l,n,d):D(l,n),p=[];for(let w=0;w<m.length;w++){const N=A.smoothed[w];N===null||!Number.isFinite(N)||p.push({x:m[w].rawX,y:N})}return p.length<2?null:{fit:p,stats:{method:"exponential",kind:O?"holt":"ses",alpha:n,beta:O?d:null}}}function y(m,b,O){if(b.method==="linear"){const u=$(m,O);return me(u,b.forecast,{confidence:b.confidence})}const l=I(m);return b.method==="movingAverage"?r(l,b.window||b.period):i(l,b)}function t(m,b,O,l,u,x){const n=b?` for ${b}`:"";if(m.method==="linear"){const w=Number.isFinite(m.r2)?`, R² ${m.r2.toFixed(2)}`:"";let N=`Trend (linear)${n}: slope ${O(m.slope)}${w}`;if(m.forecast>0&&l&&l.length){const f=l[l.length-1];if(N+=`; forecast ${m.forecast} step${m.forecast===1?"":"s"} ahead to ${O(f.y)}`,u&&u.points.length){const a=u.points[u.points.length-1],o=x==="confidence"||x==="mean",h=o?a.lowerMean:a.lower,B=o?a.upperMean:a.upper,z=o?"confidence":"prediction",U=Math.round(u.confidence*100);N+=`; ${U}% ${z} band ${O(h)} to ${O(B)} at the horizon`}}return N}if(m.method==="movingAverage")return`Trend (moving average, window ${m.window})${n}`;const d=m.kind==="holt"?"Holt":"single",A=Number.isFinite(m.alpha)?`, α ${m.alpha.toFixed(2)}`:"",p=Number.isFinite(m.beta)?`, β ${m.beta.toFixed(2)}`:"";return`Trend (exponential, ${d})${n}${A}${p}`}function g(m){const b=R(m.trend);if(!b.length)return[];const O=m.group.ownerDocument;let l=null;for(const n of m.group.childNodes||[])if(n&&String(n.getAttribute&&n.getAttribute("class"))===`${M}__trends`){l=n;break}l||(l=O.createElementNS(te,"g"),l.setAttribute("class",`${M}__trends`),m.group.appendChild(l)),m.clip?l.setAttribute("clip-path",`url(#${m.clip})`):l.removeAttribute("clip-path");const u=new W(l),x=[];for(const n of b)for(const d of m.series){const A=d.axis==="right"&&m.rightScale?m.rightScale:m.yScale,p=y(d,n,m.xScale);if(!p)continue;const w=m.scheme.series(d.index),N=[];for(const o of p.fit){const h=ie(m.xScale,o.x),B=A.of(o.y);!Number.isFinite(h)||!Number.isFinite(B)||N.push(N.length?"L":"M",Q(h),Q(B))}if(N.length<4)continue;if(pe(u.next("path",`${M}__trend`),{d:ue(N),fill:"none",stroke:w,"data-series":d.index}),n.band!==!1&&p.band&&p.band.points.length>=2){const o=n.band==="confidence"||n.band==="mean",h=[];for(const z of p.band.points){const U=ie(m.xScale,z.x),q=o?z.lowerMean:z.lower,se=o?z.upperMean:z.upper,T=A.of(q),le=A.of(se);!Number.isFinite(U)||!Number.isFinite(T)||!Number.isFinite(le)||h.push({x:Q(U),lower:Q(T),upper:Q(le)})}const B=V(h);B&&pe(u.next("path",`${M}__trend-band`),{d:B,fill:w,"fill-opacity":.15,stroke:"none","data-series":d.index})}const a=p.forecast||[];if(a.length>=2){const o=[];for(const h of a){const B=ie(m.xScale,h.x),z=A.of(h.y);!Number.isFinite(B)||!Number.isFinite(z)||o.push(o.length?"L":"M",Q(B),Q(z))}o.length>=4&&pe(u.next("path",`${M}__trend-forecast`),{d:ue(o),fill:"none",stroke:w,"data-series":d.index})}if(n.label!==!1&&p.stats.method==="linear"&&Number.isFinite(p.stats.r2)){const o=p.fit[p.fit.length-1],h=u.next("text",`${M}__trend-label`);c(h,m.size),pe(h,{x:Q(ie(m.xScale,o.x)),y:Q(A.of(o.y))-4,"text-anchor":"end",fill:w}),G(h,m.grid.messages.t("chart.r2",{value:v(m.grid,p.stats.r2)}))}x.push({text:t(p.stats,d.label,m.format,a,n.band===!1?null:p.band,n.band)})}return u.finish(),x.filter(n=>n.text)}}),Je("packages/modules/charts/cartesian.js",function(s,K){"use strict";Object.defineProperty(s,"CARTESIAN",{enumerable:!0,get:function(){return h}}),Object.defineProperty(s,"axisWindowSpan",{enumerable:!0,get:function(){return se}}),Object.defineProperty(s,"rollingDomain",{enumerable:!0,get:function(){return T}}),Object.defineProperty(s,"WINDOW_LEAD",{enumerable:!0,get:function(){return le}}),Object.defineProperty(s,"aheadOfWindow",{enumerable:!0,get:function(){return be}}),Object.defineProperty(s,"staleWindow",{enumerable:!0,get:function(){return we}}),Object.defineProperty(s,"windowedBound",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(s,"drawFits",{enumerable:!0,get:function(){return We}}),Object.defineProperty(s,"drawConfidenceBand",{enumerable:!0,get:function(){return ot}}),Object.defineProperty(s,"drawBoundErrorBars",{enumerable:!0,get:function(){return dt}}),Object.defineProperty(s,"drawForest",{enumerable:!0,get:function(){return ut}}),Object.defineProperty(s,"drawReferenceLines",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(s,"drawCartesian",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(s,"HIT_TOLERANCE",{enumerable:!0,get:function(){return At}}),Object.defineProperty(s,"nearestDrawnPoint",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(s,"nearestCategory",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(s,"categoryKeyAt",{enumerable:!0,get:function(){return Ft}});const Ae=K("packages/modules/charts/axis.js"),W=Ae.drawAxisLines,S=Ae.drawAxisTitle,pe=Ae.drawBandLabels,ue=Ae.drawCategoryAxis,V=Ae.drawContinuousAxis,Q=Ae.drawMeasureAxis,G=Ae.overhangFor,te=Ae.setPlotClip,j=K("packages/modules/charts/frame.js"),c=j.Pool,Y=j.shouldRotate,M=K("packages/modules/charts/format.js"),k=M.formatters,F=M.r2Digits,J=K("packages/modules/charts/scale.js"),Z=J.bandScale,E=J.extent,ne=J.isNumber,v=J.key,X=J.linearScale,oe=J.measureDomain,ee=J.timeScale,C=J.toNumber,R=J.toTime,ie=K("packages/modules/charts/svg.js"),I=ie.attrs,$=ie.path,me=ie.ribbonPath,r=ie.round,D=ie.setText,_=ie.SVG_NS,i=K("packages/modules/charts/styles.js").NS,t=K("packages/modules/charts/labels.js").drawDataLabels,m=K("packages/modules/charts/dense.js").downsample,O=K("packages/modules/charts/scheme.js").resolveScheme,u=K("packages/modules/charts/typography.js").applySize,n=K("packages/modules/charts/combo.js").drawRightAxis,d=K("packages/modules/charts/annotations.js"),A=d.drawAnnotations,p=d.overlayLayer,N=K("packages/modules/charts/trendline.js").drawTrendlines,a=K("packages/core/src/internal/util.js").warnOnce,o=3.5,h=Object.freeze({line:{zero:!1,marks:"path"},step:{zero:!1,marks:"path"},area:{zero:!0,marks:"path"},rangeArea:{zero:!1,marks:"path"},bar:{zero:!0,marks:"rect"},horizontalBar:{zero:!0,marks:"rect",horizontal:!0},waterfall:{zero:!0,marks:"rect"},scatter:{zero:!1,marks:"circle"},bubble:{zero:!1,marks:"circle"}});function B(P){const fe=[];for(let de=0;de<P.length;de++){const ge=P[de];if(de===0){fe.push("M",ge.x,ge.y);continue}fe.push("L",ge.x,P[de-1].y),fe.push("L",ge.x,ge.y)}return fe}function z(P,fe,de){if(de)return[0,100];if(!fe){const ke=[];for(const Pe of P)for(const Ne of Pe.points)ke.push(Ne.y);return ke}const ge=[],Se=[],ce=P[0]?P[0].points.length:0;for(let ke=0;ke<ce;ke++){let Pe=0,Ne=0;for(const Ce of P){const je=Ce.points[ke]?Ce.points[ke].y:null;ne(je)&&(je>=0?Pe+=je:Ne+=je)}ge.push(Pe),Se.push(Ne)}return[...ge,...Se]}function U(P){const fe=[0];if(!P)return fe;let de=0;for(const ge of P.points)ne(ge.y)&&(de+=ge.y,fe.push(de));return fe}function q(P,fe){const de=new Float64Array(P),ge=new Float64Array(P);return{take(Se,ce){const ke=fe?fe[Se]:0,Pe=fe?ke?ce/ke*100:0:ce;if(Pe>=0){const Ce=de[Se];return de[Se]+=Pe,[Ce,de[Se]]}const Ne=ge[Se];return ge[Se]+=Pe,[Ne,ge[Se]]}}}function se(P){const fe=P&&P.window;if(!fe||typeof fe!="object")return 0;const de=Number(fe.span);return!Number.isFinite(de)||de<=0?0:fe.kind!=="time"?(a("chart.axis.window.kind",`axis window kind "${fe.kind}" is not supported on a chart axis; only { kind: "time", span } rolls the domain. Bound the row count with the source's maxRows instead.`),0):de}function T(P,fe,de){const ge=de+P*le;let Se=de;for(const ce of fe)Number.isFinite(ce)&&ce>Se&&ce<=ge&&(Se=ce);return{min:Se-P,max:Se}}const le=.25;function he(P,fe,de){const ge=se(fe);if(!ge||!P||!Array.isArray(P.categories))return null;const Se=h[de];if(!Se||Se.horizontal||de==="bar"||P.kind==="category")return null;const ce=P.categories.map(ke=>P.kind==="time"?R(ke):C(ke));return{span:ge,values:ce}}function be(P,fe,de,ge){const Se=he(P,fe,de);if(!Se)return null;const ce=Se.span*le;let ke=0,Pe=0;for(const Ne of Se.values)Ne===null||!Number.isFinite(Ne)||Ne-ge<=ce||(ke+=1,Ne-ge>Pe&&(Pe=Ne-ge));return ke?{span:Se.span,limit:ce,count:ke,lead:Pe}:null}function we(P,fe,de,ge){const Se=he(P,fe,de);if(!Se)return null;const{span:ce}=Se,ke=Se.values.filter(je=>je!==null&&Number.isFinite(je));if(!ke.length)return null;const{min:Pe,max:Ne}=T(ce,ke,ge);let Ce=-1/0;for(const je of ke){if(je>=Pe&&je<=Ne)return null;je<Pe&&je>Ce&&(Ce=je)}return Ce===-1/0?{span:ce,newest:null,age:null,points:ke.length}:{span:ce,newest:Ce,age:ge-Ce,points:ke.length}}function ye(P,fe,de,ge){const Se=he(P,fe,de);if(!Se)return P;const{span:ce,values:ke}=Se,Pe=ke.filter(ze=>ze!==null&&Number.isFinite(ze));if(!Pe.length)return P;const{min:Ne,max:Ce}=T(ce,Pe,ge),je=[];for(let ze=0;ze<ke.length;ze++){const De=ke[ze];(De===null||!Number.isFinite(De)||De>=Ne&&De<=Ce)&&je.push(ze)}return je.length===ke.length?P:{...P,categories:je.map(ze=>P.categories[ze]),labels:Array.isArray(P.labels)?je.map(ze=>P.labels[ze]):P.labels,series:(P.series||[]).map(ze=>({...ze,points:Array.isArray(ze.points)?je.map(De=>ze.points[De]).filter(De=>De!==void 0):ze.points})),windowed:ke.length-je.length}}function ve(P,fe,de,ge){const Se=[fe.left,fe.right],ce=se(ge);if(P.kind==="category"||de==="bar")return ce&&a("chart.axis.window.band","a rolling time window needs a continuous x axis; this chart bands its x values, so the window is ignored. Bind a date or numeric column to x."),Z(P.categories,Se,de==="bar"?.2:.4);const ke=P.kind==="time"?P.categories.map(R):P.categories.map(C);if(P.kind==="time"&&!ce){const Ne=E(ke);if(Ne&&Ne.min===Ne.max)return ee({min:Ne.min-3e4,max:Ne.max+3e4},Se)}const Pe=ce?T(ce,ke,Date.now()):oe(ke,{zero:!1,nice:P.kind!=="time"});return P.kind==="time"?ee(Pe,Se):X(Pe,Se)}function Te(P,fe){if(P.kind==="band")return P.centre(fe.x);const de=P.kind==="time"?R(fe.x):C(fe.x);return de===null?NaN:P.of(de)}function xe(P){const{series:fe,xScale:de,yScale:ge,baseline:Se,fill:ce,colour:ke,stack:Pe}=P,Ne=[],Ce=[];let je=!1;const ze=[];for(let Ve=0;Ve<fe.points.length;Ve++){const Qe=fe.points[Ve],st=r(Te(de,Qe));if(!ne(Qe.y)||Number.isNaN(st)){je=!1;continue}ze[Ve]=!0;const rt=Qe.y,Ze=Pe?Pe.take(Ve,rt):null,nt=r(ge.of(Ze?Ze[1]:rt)),at=r(ge.of(Ze?Ze[0]:Se));P.step&&je&&Ne.push("L",st,P.previous),Ne.push(je?"L":"M",st,nt),P.previous=nt,ce&&Ce.push(je?"L":"M",st,nt),ce&&!je&&Ce.push("M",st,nt),je=!0,Qe.px=st,Qe.py=nt,Qe.pbase=at}if(I(P.pool.next("path",`${i}__line ${i}__mark`),{d:Ne.length?$(Ne):"",stroke:ke,"data-series":P.index}),!ce){_e({...P,placed:ze});return}const De=[];let Ge=[];const tt=()=>{if(Ge.length<2){Ge=[];return}De.push("M",Ge[0].x,Ge[0].base);for(const Ve of Ge)De.push("L",Ve.x,Ve.y);for(let Ve=Ge.length-1;Ve>=0;Ve--)De.push("L",Ge[Ve].x,Ge[Ve].base);De.push("Z"),Ge=[]};for(const Ve of fe.points){if(!ne(Ve.y)||Ve.px===void 0){tt();continue}Ge.push({x:Ve.px,y:Ve.py,base:Ve.pbase})}tt(),I(P.pool.next("path",`${i}__area ${i}__mark`),{d:De.length?$(De):"",fill:ke,"data-series":P.index}),_e({...P,placed:ze})}function _e(P){const{series:fe,placed:de}=P;for(let ge=0;ge<fe.points.length;ge++){if(!de[ge]||de[ge-1]||de[ge+1])continue;const Se=fe.points[ge];I(P.pool.next("circle",`${i}__point ${i}__mark`),{cx:Se.px,cy:Se.py,r:o,fill:P.colour,"data-series":P.index,"data-point":ge})}}function $e(P,fe){const de=P&&P.range;if(!Array.isArray(de)||de.length!==2)return fe;const[ge,Se]=de;return!Number.isFinite(ge)||!Number.isFinite(Se)||!Number.isFinite(fe)?fe:Math.min(Math.max(ge,Se),Math.max(Math.min(ge,Se),fe))}function Oe(P){const{series:fe,xScale:de,yScale:ge,baseline:Se,colour:ce,stack:ke,slot:Pe}=P;for(let Ne=0;Ne<fe.points.length;Ne++){const Ce=fe.points[Ne];if(!ne(Ce.y))continue;const je=de.of(Ce.x);if(Number.isNaN(je))continue;const ze=Ce.y,De=ke?ke.take(Ne,ze):[Se,ze],Ge=$e(ge,ge.of(De[1])),tt=$e(ge,ge.of(De[0])),Ve=P.pool.next("rect",`${i}__bar ${i}__mark`);I(Ve,{x:r(je+Pe.offset),y:r(Math.min(Ge,tt)),width:r(Math.max(0,Pe.width)),height:r(Math.max(1,Math.abs(tt-Ge))),fill:ce,"data-series":P.index,"data-point":Ne}),Ce.px=r(je+Pe.offset+Pe.width/2),Ce.py=r(Math.min(Ge,tt)),Ce.pbase=r(Math.max(Ge,tt))}}function Ie(P){const{series:fe,xScale:de,yScale:ge}=P;let Se=0;for(let ce=0;ce<fe.points.length;ce++){const ke=fe.points[ce];if(!ne(ke.y))continue;const Pe=ke.y,Ne=ce===fe.points.length-1,Ce=P.total&&Ne?0:Se,je=(P.total&&Ne,Se+Pe);P.total,Se+=Pe;const ze=$e(ge,ge.of(Math.max(Ce,je))),De=$e(ge,ge.of(Math.min(Ce,je))),Ge=P.pool.next("rect",`${i}__bar ${i}__mark`);I(Ge,{x:r(de.of(ke.x)),y:r(ze),width:r(de.bandwidth),height:r(Math.max(1,De-ze)),fill:Pe>=0?P.positive:P.negative,"data-series":P.index,"data-point":ce}),ke.px=r(de.of(ke.x)+de.bandwidth/2),ke.py=r(ze)}}function He(P){const{series:fe,valueScale:de,baseline:ge,colour:Se,stack:ce,slot:ke}=P;for(let Pe=0;Pe<fe.points.length;Pe++){const Ne=fe.points[Pe];if(!ne(Ne.y))continue;const Ce=P.bandScale.of(Ne.x);if(Number.isNaN(Ce))continue;const je=Ne.y,ze=ce?ce.take(Pe,je):[ge,je],De=$e(de,de.of(ze[0])),Ge=$e(de,de.of(ze[1]));I(P.pool.next("rect",`${i}__bar ${i}__mark`),{x:r(Math.min(De,Ge)),y:r(Ce+ke.offset),width:r(Math.max(1,Math.abs(Ge-De))),height:r(Math.max(0,ke.width)),fill:Se,"data-series":P.index,"data-point":Pe}),Ne.px=r(Ge),Ne.py=r(Ce+ke.offset+ke.width/2),Ne.pbase=r(De)}}function We(P){const fe=P.group.ownerDocument;let de=null;for(const ce of P.group.childNodes||[])if(ce&&String(ce.getAttribute&&ce.getAttribute("class"))===`${i}__fits`){de=ce;break}de||(de=fe.createElementNS(_,"g"),de.setAttribute("class",`${i}__fits`),P.group.appendChild(de));const ge=new c(de),Se=[];for(const ce of P.series){let ke=0,Pe=0,Ne=0;for(const nt of ce.points){const at=Number(nt.x),ft=Number(nt.y);!Number.isFinite(at)||!Number.isFinite(ft)||(ke++,Pe+=at,Ne+=ft)}if(ke<2)continue;const Ce=Pe/ke,je=Ne/ke;let ze=0,De=0,Ge=0,tt=1/0,Ve=-1/0;for(const nt of ce.points){const at=Number(nt.x),ft=Number(nt.y);if(!Number.isFinite(at)||!Number.isFinite(ft))continue;const lt=at-Ce,jt=ft-je;ze+=lt*lt,De+=lt*jt,Ge+=jt*jt,at<tt&&(tt=at),at>Ve&&(Ve=at)}if(ze===0)continue;const Qe=De/ze,st=je-Qe*Ce,rt=Ge===0?1:Math.max(0,Math.min(1,De*De/(ze*Ge))),Ze=P.scheme.series(ce.index);if(I(ge.next("path",`${i}__fit`),{d:$(["M",r(P.xScale.of(tt)),r(P.yScale.of(st+Qe*tt)),"L",r(P.xScale.of(Ve)),r(P.yScale.of(st+Qe*Ve))]),fill:"none",stroke:Ze,"data-series":ce.index}),P.showR2){const nt=ge.next("text",`${i}__fit-label`);u(nt,P.size),I(nt,{x:r(P.xScale.of(Ve)),y:r(P.yScale.of(st+Qe*Ve))-4,"text-anchor":"end",fill:Ze}),D(nt,P.grid.messages.t("chart.r2",{value:F(P.grid,rt)}))}Se.push({key:ce.key,slope:Qe,intercept:st,r2:rt,n:ke})}return ge.finish(),Se}function ot(P){const fe=P.group.ownerDocument;let de=null;for(const Ce of P.group.childNodes||[])if(Ce&&String(Ce.getAttribute&&Ce.getAttribute("class"))===`${i}__band`){de=Ce;break}de||(de=fe.createElementNS(_,"g"),de.setAttribute("class",`${i}__band`),P.group.firstChild?P.group.insertBefore(de,P.group.firstChild):P.group.appendChild(de));const ge=new c(de),Se=P.band&&Array.isArray(P.band.points)?P.band.points:[],ce=Number.isFinite(P.index)?Number(P.index):0,ke=P.scheme.series(ce),Pe=Number.isFinite(P.opacity)?Number(P.opacity):.15,Ne=[];for(const Ce of Se){const je=Number(Ce.x),ze=Number(Ce.lower),De=Number(Ce.upper);if(!Number.isFinite(je)||!Number.isFinite(ze)||!Number.isFinite(De))continue;const Ge=Number(Ce.yhat);Ne.push({x:r(P.xScale.of(je)),lower:r(P.yScale.of(ze)),upper:r(P.yScale.of(De)),yhat:Number.isFinite(Ge)?r(P.yScale.of(Ge)):null})}if(Ne.length>=2&&(I(ge.next("path",`${i}__band-fill`),{d:me(Ne),fill:ke,"fill-opacity":Pe,stroke:"none","data-series":ce}),P.line!==!1)){const Ce=[];let je=!1;for(const ze of Ne){if(ze.yhat===null){je=!1;continue}Ce.push(je?"L":"M",ze.x,ze.yhat),je=!0}I(ge.next("path",`${i}__band-line`),{d:Ce.length?$(Ce):"",fill:"none",stroke:ke,"data-series":ce})}return ge.finish(),{points:Ne.length,confidence:P.band&&Number.isFinite(P.band.confidence)?Number(P.band.confidence):null}}function dt(P){const fe=P.group.ownerDocument;let de=null;for(const Ne of P.group.childNodes||[])if(Ne&&String(Ne.getAttribute&&Ne.getAttribute("class"))===`${i}__whiskers`){de=Ne;break}de||(de=fe.createElementNS(_,"g"),de.setAttribute("class",`${i}__whiskers`),P.group.appendChild(de));const ge=new c(de),Se=Number.isFinite(P.cap)?Number(P.cap):4,ce=P.colour||"currentColor",ke=P.orient!=="v";let Pe=0;for(const Ne of P.points||[]){const Ce=Number(Ne.main),je=Number(Ne.lo),ze=Number(Ne.hi);if(!Number.isFinite(Ce)||!Number.isFinite(je)||!Number.isFinite(ze))continue;const De=ke?["M",je,Ce,"L",ze,Ce,"M",je,Ce-Se,"L",je,Ce+Se,"M",ze,Ce-Se,"L",ze,Ce+Se]:["M",Ce,je,"L",Ce,ze,"M",Ce-Se,je,"L",Ce+Se,je,"M",Ce-Se,ze,"L",Ce+Se,ze];I(ge.next("path",`${i}__whisker`),{d:$(De),stroke:ce,fill:"none"}),Pe++}return ge.finish(),Pe}function ut(P){const fe=P.scheme||O(),de=P.typography||{small:P.fontSize||11,axisTitle:11},{plot:ge,bound:Se}=P,ce=Se.series[0]&&Se.series[0].points||[],ke=ce.map(Ge=>Ge.label),Pe=fe.series(0),Ne=Z(ke,[ge.top,ge.bottom],.4),Ce=[0];for(const Ge of ce)for(const tt of[Ge.x,Ge.lower,Ge.upper])Number.isFinite(tt)&&Ce.push(tt);const je=X(oe(Ce,{zero:!1}),[ge.left,ge.right]);dt({group:P.groups.overlay,orient:"h",colour:Pe,points:ce.map(Ge=>({main:r(Ne.centre(Ge.label)),lo:r(je.of(Ge.lower)),hi:r(je.of(Ge.upper))}))});const ze=new c(P.groups.marks);let De=0;for(const Ge of ce)Number.isFinite(Ge.x)&&(I(ze.next("circle",`${i}__point ${i}__mark`),{cx:r(je.of(Ge.x)),cy:r(Ne.centre(Ge.label)),r:o,fill:Pe}),De++);return ze.finish(),bt({group:P.groups.rules,plot:ge,scale:je,lines:[{value:0}]}),V({group:P.groups.axis,plot:ge,scale:je,format:k(P.grid,{kind:"linear",step:(je.domain.max-je.domain.min)/5}),config:{},grid:P.grid,size:de.small}),pe({group:P.groups.labels,plot:ge,scale:Ne,labels:ke,fontSize:de.small,config:{}}),{series:[],marks:De}}function bt(P){const fe=new c(p(P.group,`${i}__reflines`));for(const de of P.lines||[]){if(!ne(de.value))continue;const ge=r(P.scale.of(de.value));if(I(fe.next("path",`${i}__reference`),{d:$(["M",r(P.plot.left),ge,"L",r(P.plot.right),ge]),stroke:de.colour||"currentColor","stroke-dasharray":"4 3",fill:"none"}),!de.label)continue;const Se=fe.next("text",`${i}__reference-label`);I(Se,{x:r(P.plot.right-4),y:ge-4,"text-anchor":"end"}),D(Se,de.label)}fe.finish()}function wt(P){const{series:fe,xScale:de,yScale:ge,colour:Se}=P,ce=P.size||null;for(let ke=0;ke<fe.points.length;ke++){const Pe=fe.points[ke];if(!ne(Pe.y))continue;const Ne=r(Te(de,Pe));if(Number.isNaN(Ne))continue;const Ce=r(ge.of(Pe.y));I(P.pool.next("circle",`${i}__point ${i}__mark`),{cx:Ne,cy:Ce,r:ce&&ne(Pe.size)?r(ce.of(Pe.size)):o,fill:Se,"fill-opacity":ce?.7:1,"data-series":P.index,"data-point":ke}),Pe.px=Ne,Pe.py=Ce}}function vt(P){const{group:fe,series:de,xScale:ge,yScale:Se,options:ce}=P,ke=P.grid&&P.grid.statistics,Pe=ke&&typeof ke.intervalOf=="function"?(Ve,Qe)=>ke.intervalOf(Ve,Qe):null,Ne=new c(p(fe,`${i}__errorbars`)),Ce=Number.isFinite(Number(ce.confidence))?Number(ce.confidence):.95,je=4;let ze=0,De=0,Ge=0,tt=0;for(const Ve of de)for(const Qe of Ve.points){if(Qe.y===null||Qe.y===void 0)continue;De++;const st=Array.isArray(Qe.values)&&Qe.values.length===1;st&&Ge++;let rt=null,Ze=null;if(ce.of!==void 0&&Number.isFinite(Number(Qe[ce.of]))){const lt=Math.abs(Number(Qe[ce.of]));rt=Qe.y-lt,Ze=Qe.y+lt}else if(Array.isArray(Qe.values)&&Qe.values.length>1&&Pe){const lt=Pe(Qe.values,Ce);lt&&(rt=lt.lower,Ze=lt.upper)}if(rt===null||!Number.isFinite(rt)||!Number.isFinite(Ze)){st&&tt++;continue}const nt=r(ge.of(Qe.xKey!==void 0?Qe.xKey:Qe.x)+(ge.bandwidth?ge.bandwidth/2:0)),at=r(Se.of(Ze)),ft=r(Se.of(rt));I(Ne.next("path",`${i}__error-bar ${i}__mark`),{d:$(["M",nt-je,at,"L",nt+je,at,"M",nt,at,"L",nt,ft,"M",nt-je,ft,"L",nt+je,ft]),fill:"none",stroke:"currentColor","data-lower":rt,"data-upper":Ze}),ze++}return Ne.finish(),{drawn:ze,marks:De,single:Ge,singleSkipped:tt}}function Nt(P){const fe=P.scheme||O(),de=P.axis||{x:{},y:{},y2:{}},ge=P.typography||{small:P.fontSize||11,axisTitle:11},{bound:Se,plot:ce,type:ke}=P,Pe=h[ke]||h.line,Ne=Se.series.filter(qe=>!P.hidden.has(qe.key)),Ce=!!Pe.horizontal,je=!Ce&&ke!=="waterfall"?Ne.filter(qe=>qe.axis==="right"):[],ze=je.length?Ne.filter(qe=>qe.axis!=="right"):Ne,De=je.length>0,Ge=(ke==="bar"||ke==="area"||ke==="horizontalBar")&&!De,tt=P.stack==="percent"&&Ge&&ze.length>1,Ve=(tt||!!P.stack)&&ze.length>1&&Ge,Qe=ke==="waterfall"?U(Ne[0]):z(ze,Ve,tt),st=P.domain||oe(Qe,{zero:Pe.zero,min:de.y.min,max:de.y.max}),rt=Ce?X(st,[ce.left,ce.right]):X(st,[ce.bottom,ce.top]),Ze=Ce?Z(Se.categories,[ce.top,ce.bottom],.2):ve(Se,ce,ke,de.x),nt=st.min<=0&&st.max>=0?0:st.min,at=je.some(qe=>(qe.mark||(ke==="bar"?"bar":ke))==="bar"),ft=De?oe(z(je,!1,!1),{zero:at,min:de.y2.min,max:de.y2.max}):null,lt=ft?X(ft,[ce.bottom,ce.top]):null,jt=k(P.grid,{kind:"linear",step:(st.max-st.min)/5}),Lt=P.axes!==!1;if(Lt&&Q({gridGroup:P.groups.grid,axisGroup:P.groups.axis,plot:ce,scale:rt,format:jt,horizontal:Ce,config:de.y,grid:P.grid,size:ge.small}),Lt&&(Ce?pe({group:P.groups.overlay,plot:ce,scale:Ze,labels:Se.labels,fontSize:ge.small,config:de.x}):Ze.kind==="band"?ue({group:P.groups.overlay,plot:ce,scale:Ze,labels:Se.labels,fontSize:ge.small,rotated:Y(Se.labels,Ze.step,ge.small,de.x.every),config:de.x}):V({group:P.groups.overlay,plot:ce,scale:Ze,format:k(P.grid,{kind:Se.kind,span:Ze.domain.max-Ze.domain.min,step:(Ze.domain.max-Ze.domain.min)/5}),config:de.x,grid:P.grid,size:ge.small})),Lt&&(W({group:P.groups.rules,plot:ce}),S({group:P.groups.axis,plot:ce,text:de.y.title,side:Ce?"bottom":"left",size:ge.axisTitle}),S({group:P.groups.axis,plot:ce,text:de.x.title,side:Ce?"left":"bottom",size:ge.axisTitle})),Lt&&lt){n({group:P.groups.axis,plot:ce,scale:lt,colour:fe.series(je[0].index),format:k(P.grid,{kind:"linear",step:(ft.max-ft.min)/5})});const qe=de.y2.title||(je.length===1?je[0].label:"");S({group:P.groups.axis,plot:ce,text:qe,side:"right",size:ge.axisTitle}),!de.y.title&&ze.length===1&&ze[0].label&&S({group:P.groups.axis,plot:ce,text:ze[0].label,side:"left",size:ge.axisTitle})}const Gt=Number.isFinite(P.downsampleTo)?Number(P.downsampleTo):Math.max(2,Math.round(ce.width));let Rt=!1;if(Pe.marks==="path"||ke==="scatter"||ke==="bubble"){for(const qe of Ne)if(qe.kept=null,qe.points.length>Gt*1.5){const it=qe.points.map((gt,xt)=>({x:xt,y:gt.y,point:gt})),mt=m(it,Gt);qe.points=mt.map(gt=>gt.point),qe.kept=mt.map(gt=>gt.x),Rt=!0}}P.pool||te(P.groups,ce,G(ke));const St=P.pool||new c(P.groups.marks),Zt=tt?Se.categories.map((qe,it)=>Ne.reduce((mt,gt)=>{const xt=gt.points[it]?gt.points[it].y:null;return ne(xt)?mt+Math.abs(xt):mt},0)):null,Bt=Ve?q(Se.categories.length,Zt):null,Ut=De?Ne.filter(qe=>(qe.mark||(ke==="bar"?"bar":ke))==="bar"):Ne,Jt=De?Math.max(1,Ut.length):Math.max(1,Ne.length),_t=Ze.kind==="band"?Ve?Ze.bandwidth:Ze.bandwidth/Jt:0,It=new Map;for(const qe of Ut)It.set(qe.key,It.size);for(let qe=0;qe<Ne.length;qe++){const it=Ne[qe],mt=fe.series(it.index),gt=it.axis==="right"&&lt?lt:rt,xt=De?it.mark||(ke==="bar"?"bar":ke):ke,Ht=De&&It.has(it.key)?It.get(it.key):qe;ke==="horizontalBar"?He({pool:St,series:it,bandScale:Ze,valueScale:rt,baseline:nt,colour:mt,stack:Bt,index:it.index,slot:{offset:Ve?0:qe*_t,width:_t}}):ke==="waterfall"?Ie({pool:St,series:it,xScale:Ze,yScale:rt,index:it.index,total:!0,positive:fe.positive,negative:fe.negative}):xt==="bar"?Oe({pool:St,series:it,xScale:Ze,yScale:gt,baseline:gt===lt?ft.min<=0&&ft.max>=0?0:ft.min:nt,colour:mt,stack:Bt,index:it.index,slot:{offset:Ve?0:Ht*_t,width:_t}}):ke==="scatter"||ke==="bubble"?wt({pool:St,series:it,xScale:Ze,yScale:gt,colour:mt,index:it.index,size:ke==="bubble"?P.sizes:null}):xe({pool:St,series:it,xScale:Ze,yScale:gt,baseline:nt,fill:xt==="area"||xt==="rangeArea",step:xt==="step",colour:mt,stack:Bt,index:it.index})}P.pool||St.finish(),P.band&&typeof Ze.invert=="function"&&ot({group:P.groups.overlay,band:P.band,xScale:Ze,yScale:rt,scheme:fe,index:0,line:P.band.line!==!1&&!P.fit}),P.fit&&(ke==="scatter"||ke==="bubble")&&typeof Ze.invert=="function"&&We({group:P.groups.overlay,series:Ne,xScale:Ze,yScale:rt,plot:ce,scheme:fe,grid:P.grid,size:ge.small,showR2:P.fit!=="line"});let Et=null;P.trend&&(Et=N({group:P.groups.overlay,series:Ne,xScale:Ze,yScale:rt,rightScale:lt,plot:ce,scheme:fe,trend:P.trend,grid:P.grid,format:qe=>jt.tick(qe),size:ge.small,clip:P.groups.boxClipId}));let Ct=null;if(P.error&&(Ct=vt({group:P.groups.overlay,series:Ne,xScale:Ze,yScale:rt,grid:P.grid,options:P.error===!0?{}:P.error})),P.labels&&P.labels.show&&t({group:P.groups.labels,series:Ne,plot:ce,options:P.labels,grid:P.grid,size:ge.small,horizontal:Ce}),P.reference&&P.reference.length){const qe=P.reference.filter(mt=>!(mt.axis==="right"||mt.axis==="y2")),it=lt?P.reference.filter(mt=>mt.axis==="right"||mt.axis==="y2"):[];qe.length&&bt({group:P.groups.overlay,plot:ce,scale:rt,lines:qe}),it.length&&bt({group:P.groups.overlay,plot:ce,scale:lt,lines:it})}let Dt=null;P.annotations&&P.annotations.length&&(Dt=A({group:P.groups.overlay,plot:ce,xScale:Ze,yScale:rt,rightScale:lt,series:Ne,annotations:P.annotations,dual:De,format:qe=>jt.tick(qe),size:ge.small}));const Qt=Array.isArray(Et)&&Et.length?[...Dt||[],...Et]:Dt;return{xScale:Ze,yScale:rt,rightScale:lt,dual:De,series:Ne,horizontal:Ce,percent:tt,plot:ce,errorBars:Ct,annotations:Qt,trendlines:Et,reduced:Rt}}const At=32;function zt(P){const{series:fe,xScale:de,at:ge}=P,Se=Number.isFinite(P.tolerance)?Number(P.tolerance):At,ce=[];let ke=-1,Pe=1/0;for(const Ne of fe){let Ce=null,je=-1,ze=1/0;const De=Ne.points||[];for(let Ge=0;Ge<De.length;Ge++){const tt=De[Ge];if(!tt||!ne(tt.y))continue;const Ve=Te(de,tt);if(Number.isNaN(Ve))continue;const Qe=Math.abs(Ve-ge);Qe>=ze||(ze=Qe,Ce=tt,je=Array.isArray(Ne.kept)?Ne.kept[Ge]:Ge)}!Ce||ze>Se||(ce.push({series:Ne,point:Ce}),ze<Pe&&(Pe=ze,ke=je))}return ke<0?null:{index:ke,entries:ce}}function Tt(P){const{bound:fe,xScale:de,at:ge}=P;if(!fe.categories.length)return-1;if(de.kind==="band"){const ke=Math.floor((ge-de.range[0])/(de.step||1));return ke>=0&&ke<fe.categories.length?ke:-1}let Se=-1,ce=1/0;for(let ke=0;ke<fe.categories.length;ke++){const Pe=de.kind==="time"?R(fe.categories[ke]):C(fe.categories[ke]);if(Pe===null)continue;const Ne=Math.abs(de.of(Pe)-ge);Ne<ce&&(ce=Ne,Se=ke)}return Se}function Ft(P,fe){return fe<0||fe>=P.categories.length?"":v(P.categories[fe])}}),Je("packages/modules/charts/drawable.js",function(s,K){"use strict";Object.defineProperty(s,"REASONS",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"DRAWABLE",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"namedColumns",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"missingColumns",{enumerable:!0,get:function(){return j}}),Object.defineProperty(s,"bucketKey",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"bucketMessage",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"continuousX",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"drawability",{enumerable:!0,get:function(){return k}});const Ae=K("packages/modules/charts/scale.js"),W=Ae.extent,S=Ae.toNumber,pe=Ae.toTime,V=K("packages/modules/charts/cartesian.js").staleWindow,Q=Object.freeze({EMPTY:"empty",INCOMPLETE:"incomplete",STALE:"stale",MISSING_COLUMN:"missing-column",NO_DOMAIN:"no-domain",BUCKETED:"bucketed"}),G=Object.freeze({ok:!0});function te(F){if(!F||typeof F!="object")return[];const J=[],Z=(E,ne)=>{typeof ne=="string"&&ne?J.push({key:E,col:ne}):ne&&typeof ne=="object"&&typeof ne.col=="string"&&ne.col&&J.push({key:E,col:ne.col})};if(Array.isArray(F.points))return[];if(Z("x",F.x),Z("code",F.code),Z("y",F.y),Z("series",F.series),Z("size",F.size),Z("source",F.source),Z("target",F.target),typeof F.multiples=="string"&&Z("multiples",F.multiples),Array.isArray(F.measures))for(const E of F.measures)Z("measures",E);return J}function j(F,J){const Z=F&&F.columns;return!Z||typeof Z.get!="function"?[]:te(J).filter(({col:E})=>!Z.get(E))}function c(F){return`chart:x:date-bucket:${F}`}function Y(F,J,Z){return`chart x column ${JSON.stringify(F)} is a 'date', which stores a calendar day, so all ${J} rows collapsed into one point and were reduced by '${Z}'. For a series inside a single day, type the column 'datetime' or bind epoch milliseconds.`}function M(F,J){return!J||J.kind!=="time"&&J.kind!=="linear"?!1:F!=="bar"&&F!=="horizontalBar"}function k(F){const{grid:J,spec:Z,type:E,bound:ne}=F,v=F.id===void 0?"":String(F.id),X=Number.isFinite(F.now)?Number(F.now):Date.now(),oe=(R,ie,I,$=!0)=>({ok:!1,reason:R,key:I||`chart:${v}:${R}`,message:ie,tell:$}),ee=j(J,Z);if(ee.length){const R=ee.map(I=>`${I.key}: ${JSON.stringify(I.col)}`).join(", "),ie=J&&J.columns&&typeof J.columns.all=="function"?J.columns.all().map(I=>I.id||I.field).filter(Boolean):[];return oe(Q.MISSING_COLUMN,`chart ${R} ${ee.length>1?"name columns":"names a column"} this grid does not have, so there is nothing to read and nothing to draw.${ie.length?` The columns it does have: ${ie.slice(0,12).map(I=>JSON.stringify(I)).join(", ")}${ie.length>12?", …":""}.`:""} Bind a column the grid declares, or declare the column.`)}if(ne&&ne.empty){const R=J&&J.rows&&typeof J.rows.count=="function"?J.rows.count():0;return oe(Q.EMPTY,R?`chart bound nothing from the ${R} row(s) the grid is showing, so it shows its empty state. The binding named no series to draw: check that the spec names the columns this chart needs — a flow type needs source and target, a measure needs a column with values in it.`:"chart has no rows to draw, so it shows its empty state.",void 0,R>0)}if(E==="candlestick"&&(!ne||!ne.series||ne.series.length<4)){const R=ne&&ne.series?ne.series.length:0;return oe(Q.INCOMPLETE,`a candlestick chart needs four measures — open, high, low and close, in that order — and ${R===0?"none was":`only ${R} were`} bound. Pass them as measures: [open, high, low, close].`)}const C=V(ne,F.axis&&F.axis.x,E,X);if(C){const R=C.newest===null?"and every one of them is stamped ahead of it":`and the newest of ${C.points} x value(s) is ${Math.round(C.age/1e3)}s old`;return oe(Q.STALE,`the rolling x window covers the last ${C.span} ms, ${R}, so every mark would be drawn outside the plot. The chart shows its empty state instead. Seed it with data inside the window, widen axis.x.window.span, or drop the window while showing history.`,`chart:${v}:x:window:stale:${Z&&Z.x||""}`,C.newest!==null)}if(M(E,ne)){const R=Array.isArray(ne.categories)?ne.categories:[],ie=ne.kind==="time"?R.map(pe):R.map(S);if(R.length&&!W(ie)){const I=Z&&typeof Z.x=="string"&&Z.x||ne.dimension&&ne.dimension.col||"";return oe(Q.NO_DOMAIN,`chart x ${I?`column ${JSON.stringify(I)} `:""}is drawn on a ${ne.kind==="time"?"time":"continuous"} axis, and not one of its ${R.length} value(s) reads as a ${ne.kind==="time"?"date":"number"} — so the axis would be drawn over a domain invented from nothing rather than measured from the data. Remove axis.x.scale to let the column choose its own scale, or type the column so its values parse.`)}}if(ne&&ne.bucketed&&M(E,ne)){const{col:R,rows:ie,fn:I}=ne.bucketed;return oe(Q.BUCKETED,Y(R,ie,I),c(R))}return G}}),Je("packages/modules/charts/bind.js",function(s,K){"use strict";Object.defineProperty(s,"AGGREGATIONS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(s,"DEFAULT_AGGREGATION",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"resolveAggregation",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"defaultAggregationFor",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"measureOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(s,"walkRows",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"leafRows",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"selectedRows",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"topGroups",{enumerable:!0,get:function(){return E}}),Object.defineProperty(s,"forcedScaleKind",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"scaleKindFor",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"bindSeries",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"bindPoints",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"bindMeasures",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"bindLinks",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"bindHierarchy",{enumerable:!0,get:function(){return _}});const Ae=K("packages/modules/charts/scale.js"),W=Ae.key,S=Ae.toNumber,pe=Ae.toTime,ue=K("packages/modules/charts/drawable.js"),V=ue.bucketKey,Q=ue.bucketMessage,te=K("packages/core/src/internal/util.js").warnOnce,j={sum:e=>e.length?e.reduce((i,y)=>i+y,0):null,avg:e=>e.length?e.reduce((i,y)=>i+y,0)/e.length:null,mean:e=>e.length?e.reduce((i,y)=>i+y,0)/e.length:null,min:e=>{let i=null;for(let y=0;y<e.length;y++)(i===null||e[y]<i)&&(i=e[y]);return i},max:e=>{let i=null;for(let y=0;y<e.length;y++)(i===null||e[y]>i)&&(i=e[y]);return i},median:e=>{if(!e.length)return null;const i=e.slice().sort((m,b)=>m-b),y=(i.length-1)/2,t=Math.floor(y),g=Math.ceil(y);return t===g?i[t]:(i[t]+i[g])/2},count:(e,i)=>i,countValues:e=>e.length,first:e=>e.length?e[0]:null,last:e=>e.length?e[e.length-1]:null},c="sum";function Y(e){return e==null?c:typeof e=="string"&&e in j?e:(te(`chart:measure:fn:${String(e)}`,`chart measure fn ${JSON.stringify(e)} is not a known aggregation; using '${c}'. Supported: ${Object.keys(j).join(", ")}.`),c)}function M(e){if(!e)return c;const i=e.groupTotal??e.total;if(typeof i=="string"&&i in j)return i;const y=e.dataType&&e.dataType.totals?e.dataType.totals.supported:null;if(Array.isArray(y)&&!y.includes(c)){const t=["avg","mean","max","min","countValues","count"].find(g=>y.includes(g)&&g in j);if(t)return t}return c}function k(e,i){const y=M(i);return e?typeof e=="string"?{col:e,fn:y}:{col:e.col||null,fn:e.fn==null?y:Y(e.fn)}:{col:null,fn:y}}function F(e,i){const y=new Set,t=g=>{if(!g||y.has(g)||(y.add(g),i(g),!g.group)||g.expanded)return;const m=g.filteredChildren||g.children;if(Array.isArray(m))for(const b of m)t(b)};e.rows.forEach(t)}function J(e){const i=[];return F(e,y=>{!y.group&&y.data!==null&&y.data!==void 0&&i.push(y)}),i}function Z(e){const i=new Set(e.selection.keys());if(!i.size)return[];const y=[];return F(e,t=>{!t.group&&i.has(t.key)&&y.push(t)}),y}function E(e){const i=[];let y=1/0;return F(e,t=>{t.group&&(t.level<y&&(y=t.level,i.length=0),t.level===y&&i.push(t))}),i}function ne(e,i,y){return i.group&&i.totals&&y in i.totals?S(i.totals[y]):S(e.rows.value(i.key,y))}function v(e,i,y,t){if(!i.group){const g=e.rows.text(i.key,y);if(g)return g}return t==null?"":t instanceof Date?t.toISOString().slice(0,10):String(t)}function X(e,i){return(j[i]||j[c])(e.values,e.rows)}const oe=Object.freeze(["number","currency","percent"]),ee=Object.freeze(["date","datetime","timestamp","dateString"]),C=Object.freeze({auto:"",band:"category",category:"category",linear:"linear",time:"time"});function R(e){const i=e&&typeof e=="object"?e.axis:null;if(!i||typeof i!="object")return"";const y=i.x;if(!y||typeof y!="object")return"";const t=typeof y.scale=="string"?y.scale:"";return t?Object.hasOwn(C,t)?C[t]:(te(`chart:x:scale:unknown:${t}`,`chart axis.x.scale ${JSON.stringify(t)} is not a scale this chart draws. Use one of: ${Object.keys(C).join(", ")}. The scale was chosen from the column instead.`),""):""}function ie(e){if(e.length<3)return"";let i=0,y=0;for(const t of e){if(t==null||t===""||typeof t=="boolean")return"";S(t)!==null?i++:typeof t=="string"&&pe(t)!==null&&y++}return y===e.length?"time":i===e.length?"linear":""}function I(e,i,y={}){if(y.forced)return y.forced;const t=e&&typeof e.type=="string"?e.type:"";if(ee.includes(t)||i.length&&i.every(b=>b instanceof Date))return"time";if(oe.includes(t))return"linear";const g=y.id?String(y.id):"";if(!g)return"category";const m=t&&t!=="text"?"":ie(i);return m&&te(`chart:x:banded:${g}`,`chart x column ${JSON.stringify(g)} is typed ${JSON.stringify(t||"text")}, so its ${i.length} values are drawn as categories on a band scale even though they all read as ${m==="time"?"dates":"numbers"}. Type the column ${m==="time"?"'date' (or 'datetime'/'timestamp'/'dateString')":"'number'"} for a continuous axis, or pin it with axis: { x: { scale: '${m}' } }.`),"category"}function $(e,i){const y=i.x||null,t=i.series||(typeof i.multiples=="string"?i.multiples:null)||null,g=e.columns,m=y?g.get(y):void 0,b=k(i.y),O=b.col?g.get(b.col):void 0,l=k(i.y,O);let u;const x=typeof i.rows=="function"?i.rows(e):i.rows;Array.isArray(x)?u=x:i.from==="groups"?u=E(e):i.from==="selection"?u=Z(e):u=J(e);const n=u.length?u:J(e),d=new Map,A=new Map,p=[];for(let z=0;z<n.length;z++){const U=n[z],q=y?U.group&&U.groupColumn===y?U.groupValue:e.rows.value(U.key,y):z,se=W(q);d.has(se)||(d.set(se,{value:q,label:y?v(e,U,y,q):String(z),order:d.size}),p.push(q));const T=t?U.group&&U.groupColumn===t?U.groupValue:e.rows.value(U.key,t):null,le=t?W(T):"";A.has(le)||A.set(le,{label:t?v(e,U,t,T):O?.title||"",points:new Map});const he=A.get(le);let be=he.points.get(se);be||(be={values:[],rows:0,rowKey:U.key},he.points.set(se,be)),be.rows+=U.group&&U.leafCount||1;const we=l.col?ne(e,U,l.col):null;if(we!==null&&be.values.push(we),i.size){const ye=S(e.rows.value(U.key,i.size));ye!==null&&(be.sizes=(be.sizes||0)+ye)}}const w=[...d.values()].sort((z,U)=>z.order-U.order),N=typeof i.limit=="number"&&i.limit>0?w.slice(0,i.limit):w,f=I(m,p,{forced:R(i),id:y});let a=null;f==="time"&&n.length>1&&d.size===1&&m&&(m.type==="date"||m.type==="dateString")&&(a={col:String(y),rows:n.length,fn:l.fn},te(V(a.col),Q(a.col,a.rows,a.fn)));const h=oe.includes(m&&typeof m.type=="string"?m.type:"")?[...N].sort((z,U)=>(S(z.value)??0)-(S(U.value)??0)):N,B=[...A.entries()].map(([z,U],q)=>({key:z,label:U.label,index:q,points:h.map(se=>{const T=W(se.value),le=U.points.get(T);return{x:se.value,xKey:T,label:se.label,y:le?X(le,l.fn):null,size:le&&le.sizes!==void 0?le.sizes:null,rows:le?le.rows:0,rowKey:le?le.rowKey:null,values:le&&le.values?le.values:null}})}));return{series:B,categories:h.map(z=>z.value),labels:h.map(z=>z.label),kind:f,measure:{...l,title:O?.title||l.col||""},dimension:{col:y,title:m?.title||y||""},empty:B.length===0||h.length===0,rows:n.length,truncated:w.length-h.length,bucketed:a}}function me(e){const i=Array.isArray(e.points)?e.points:[],y=i.length>0&&i.every(m=>typeof m.x=="number"&&Number.isFinite(m.x)),t=m=>typeof m=="number"&&Number.isFinite(m)?m:null,g=i.map((m,b)=>({x:m.x,xKey:W(m.x),label:m.label!=null?String(m.label):String(m.x),y:t(m.y),size:t(m.size),lower:t(m.lower),upper:t(m.upper),rows:1,rowKey:m.key!=null?String(m.key):String(b),values:null}));return{series:[{key:e.seriesKey||"",label:e.seriesLabel||"",index:0,points:g}],categories:g.map(m=>m.x),labels:g.map(m=>m.label),kind:y?"linear":"category",measure:{col:null,fn:"sum",title:e.measureTitle||""},dimension:{col:null,title:e.dimensionTitle||""},empty:g.length===0,rows:g.length,truncated:0}}function r(e,i){const y=Array.isArray(i.measures)?i.measures:[];if(!y.length)return $(e,i);const t=y.map(O=>{const l=typeof O=="string"?{col:O}:O;return{spec:l,result:$(e,{x:i.x,from:i.from,limit:i.limit,axis:i.axis,y:{col:l.col,fn:l.fn}})}}),g=t[0].result,m=new Map(g.categories.map((O,l)=>[W(O),l])),b=t.map(({spec:O,result:l},u)=>{const x=e.columns.get(O.col),n=g.categories.map(()=>null),d=l.series[0];if(d)for(const A of d.points){const p=m.get(A.xKey);p!==void 0&&(n[p]=A)}return{key:O.col,label:O.title||O.label||x&&x.title||O.col,index:u,mark:O.type||null,axis:O.axis==="right"?"right":"left",points:g.categories.map((A,p)=>n[p]||{x:A,xKey:W(A),label:g.labels[p],y:null,rows:0,rowKey:null})}});return{series:b,categories:g.categories,labels:g.labels,kind:g.kind,measure:{col:null,fn:"sum",title:b.map(O=>O.label).join(", ")},dimension:g.dimension,empty:!b.length||!g.categories.length,rows:g.rows,truncated:g.truncated}}function D(e,i,y={}){const t=k(i.y),g=!!y.perRow,m=Array.isArray(y.nodes)?y.nodes:[],b=i.source||i.x||null,O=i.target||null;if(!b||!O)return{nodes:[],links:[],measure:{...t,title:""},dimension:{col:null,title:""},series:[],categories:[],labels:[],empty:!0,total:0};const l=t.col?e.columns.get(t.col):void 0,u=new Map,x=new Map,n=(w,N,f)=>{const a=W(w);return u.has(a)||u.set(a,{key:a,value:w,label:v(e,N,f,w),index:u.size,in:0,out:0}),u.get(a)},d=new Map;for(const w of m)!w||w.id===null||w.id===void 0||d.set(W(w.id),w);for(const w of J(e)){const N=e.rows.value(w.key,b),f=e.rows.value(w.key,O);if(N==null||f===null||f===void 0)continue;const a=t.col?S(e.rows.value(w.key,t.col)):1;if(a===null||a<=0)continue;const o=n(N,w,b),h=n(f,w,O);if(g){const B=o.key>h.key,z=B?h:o,U=B?o:h;x.set(`${z.key}\0${U.key}\0${x.size}`,{source:z,target:U,value:a,undirected:!0,pair:`${z.key}\0${U.key}`,rowKeys:[w.key]})}else{const B=`${o.key}\0${h.key}`,z=x.get(B)||{source:o,target:h,value:0,rowKeys:[]};z.value+=a,z.rowKeys.length<64&&z.rowKeys.push(w.key),x.set(B,z)}o.out+=a,h.in+=a}for(const[w,N]of d)u.has(w)||u.set(w,{key:w,value:N.id,label:String(N.label??N.id),index:u.size,in:0,out:0});for(const[w,N]of d){const f=u.get(w);f&&(f.declared=!0,N.label!==void 0&&N.label!==null&&(f.label=String(N.label)),typeof N.icon=="string"&&N.icon&&(f.icon=N.icon),Number.isFinite(N.x)&&Number.isFinite(N.y)&&(f.fx=Number(N.x),f.fy=Number(N.y)))}const A=g?[...x.values()]:[...x.values()].sort((w,N)=>N.value-w.value),p=typeof i.limit=="number"&&i.limit>0?A.slice(0,i.limit):A;return{nodes:[...u.values()],links:p,measure:{...t,title:l?.title||t.col||""},dimension:{col:b,title:e.columns.get(b)?.title||b},series:[],categories:[],labels:[],empty:!p.length,total:p.reduce((w,N)=>w+N.value,0)}}function _(e,i){const y=k(i.y),t=typeof i.depth=="number"&&i.depth>0?i.depth:1/0,g=y.col?e.columns.get(y.col):void 0,m=(x,n,d)=>({label:x,value:n,depth:d,total:0,children:[],rowKey:null}),b=m("",null,0),O=E(e);if(O.length){const x=(n,d,A)=>{const p=n.groupColumn?v(e,n,n.groupColumn,n.groupValue):"",w=m(p,n.groupValue,A);w.rowKey=n.key;const N=y.col?ne(e,n,y.col):null;w.total=N===null?0:Math.abs(N),d.children.push(w);const f=n.filteredChildren||n.children;if(A<t&&Array.isArray(f))for(const a of f)a.group&&x(a,w,A+1);return!w.total&&w.children.length&&(w.total=w.children.reduce((a,o)=>a+o.total,0)),w};for(const n of O)x(n,b,1)}else{const n=$(e,{x:i.x,y:i.y,limit:i.limit}).series[0];if(n)for(const d of n.points){const A=m(d.label,d.x,1);A.total=d.y===null?0:Math.abs(d.y),A.rowKey=d.rowKey,b.children.push(A)}}b.total=b.children.reduce((x,n)=>x+n.total,0);let l=0;const u=x=>{x.depth>l&&(l=x.depth);for(const n of x.children)u(n)};return u(b),{root:b,depth:l,measure:{...y,title:g?.title||y.col||""},empty:b.total<=0||b.children.length===0}}}),Je("packages/modules/charts/radial.js",function(s,K){"use strict";Object.defineProperty(s,"horizontalRoom",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"arcPath",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"layoutRings",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"drawRadial",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"arcAt",{enumerable:!0,get:function(){return me}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/svg.js"),pe=S.attrs,ue=S.path,V=S.round,Q=S.setText,te=K("packages/modules/charts/styles.js").NS,c=K("packages/modules/charts/scheme.js").resolveScheme,Y=K("packages/modules/charts/labels.js"),M=Y.drawAnchoredLabels,k=Y.labelText,F=K("packages/modules/charts/typography.js"),J=F.applySize,Z=F.truncateTo,E=Math.PI*2,ne=-Math.PI/2,v=.25,X=2,oe=3,ee=.58;function C(r,D,_,e){return[r+_*Math.cos(e),D+_*Math.sin(e)]}function R(r,D,_){const{inner:e,outer:i,from:y,to:t}=r;if(_*_>=i*i)return 0;const g=Math.sqrt(i*i-_*_);let m=D+g,b=g-D;if(e>0&&_*_<e*e){const O=Math.sqrt(e*e-_*_);if(D>=O)m=Math.min(m,D-O);else if(D<=-O)b=Math.min(b,-O-D);else return 0}if(t-y<E-1e-9)for(const O of[y,t]){const l=Math.sin(O);if(Math.abs(l)<1e-9)continue;const u=_/l;if(u<=0)continue;const x=u*Math.cos(O);x>=D?b=Math.min(b,x-D):m=Math.min(m,D-x)}return Math.max(0,m)+Math.max(0,b)}function ie(r){const{cx:D,cy:_,inner:e,outer:i}=r,y=r.to-r.from;if(y<=0)return"";if(y>=E-1e-9){const[u,x]=C(D,_,i,r.from),[n,d]=C(D,_,i,r.from+Math.PI),A=["M",V(u),V(x),"A",V(i),V(i),0,1,1,V(n),V(d),"A",V(i),V(i),0,1,1,V(u),V(x)];if(e>0){const[p,w]=C(D,_,e,r.from),[N,f]=C(D,_,e,r.from+Math.PI);A.push("M",V(p),V(w),"A",V(e),V(e),0,1,0,V(N),V(f),"A",V(e),V(e),0,1,0,V(p),V(w))}return ue(A)}const t=y>Math.PI?1:0,[g,m]=C(D,_,i,r.from),[b,O]=C(D,_,i,r.to),l=["M",V(g),V(m),"A",V(i),V(i),0,t,1,V(b),V(O)];if(e>0){const[u,x]=C(D,_,e,r.to),[n,d]=C(D,_,e,r.from);l.push("L",V(u),V(x)),l.push("A",V(e),V(e),0,t,0,V(n),V(d))}else l.push("L",V(D),V(_));return l.push("Z"),ue(l)}function I(r){const D=[],_=(e,i,y,t,g,m)=>{if(t>0&&D.push({node:e,from:i,to:y,depth:t,index:g,label:e.label,total:e.total,path:m}),t>=r.maxRings||!e.children.length)return;const b=e.children.reduce((u,x)=>u+x.total,0),O=y-i;if(b<=0||O<=0)return;let l=i;for(let u=0;u<e.children.length;u++){const x=e.children[u],n=x.total/b*O;_(x,l,l+n,t+1,t===0?u:g,[...m,x.label]),l+=n}};return _(r.root,ne,ne+E,0,0,[]),D}function $(r){const D=r.scheme||c(),{plot:_,tree:e,type:i}=r,y=_.left+_.width/2,t=_.top+_.height/2,g=Math.max(0,Math.min(_.width,_.height)/2-2),m=i==="sunburst"?Math.max(1,e.depth):1,b=I({root:e.root,depth:e.depth,maxRings:m}).filter(A=>!r.hidden.has(A.label)),O=i==="donut"?g*ee:0,l=m>0?(g-O)/m:g;new W(r.groups.grid).finish(),new W(r.groups.axis).finish(),new W(r.groups.rules).finish(),new W(r.groups.labels).finish();const u=new W(r.groups.marks);for(const A of b){const p=O+(A.depth-1)*l,w=p+l,N=u.next("path",`${te}__slice ${te}__mark`);pe(N,{d:ie({cx:y,cy:t,inner:p,outer:w,from:A.from,to:A.to}),fill:D.series(A.index),"fill-opacity":A.depth>1?Math.max(.45,1-(A.depth-1)*.22):1,"data-arc":b.indexOf(A)}),A.geometry={cx:y,cy:t,inner:p,outer:w}}u.finish();const x=r.typography&&r.typography.small||r.fontSize||11,n=!(r.labels&&r.labels.names===!1),d=new W(r.groups.overlay);if(n)for(const A of b){if(A.to-A.from<v||A.geometry.outer-A.geometry.inner<x+X*2)continue;const p=(A.from+A.to)/2,w=A.geometry.inner+(A.geometry.outer-A.geometry.inner)/2;if((A.to-A.from)*w<x+X*2)continue;const[N,f]=C(y,t,w,p),{inner:a,outer:o}=A.geometry,h=R({inner:a,outer:o,from:A.from,to:A.to},N-y,f-t)-X*2,B=String(A.label===null||A.label===void 0?"":A.label),z=Z(B,h,x);if(z!==B&&z.length<oe)continue;const U=d.next("text",`${te}__slice-label`);pe(U,{x:V(N),y:V(f),"dominant-baseline":"middle"}),J(U,x),Q(U,z)}return d.finish(),r.labels&&r.labels.show&&M({group:r.groups.labels,size:x,minGap:r.labels.minGap,anchors:b.filter(A=>A.depth===1&&A.to-A.from>=v).map(A=>{const p=(A.from+A.to)/2,w=A.geometry.inner+(A.geometry.outer-A.geometry.inner)/2,[N,f]=C(y,t,w,p);return{x:V(N),y:V(f+x+1),text:k(A.total,r.labels,r.grid),inside:!0}})}),{arcs:b,centre:{x:y,y:t,r:g}}}function me(r){for(const D of r.arcs){const _=D.geometry;if(!_)continue;const e=r.x-_.cx,i=r.y-_.cy,y=Math.sqrt(e*e+i*i);if(y<_.inner||y>_.outer)continue;let t=Math.atan2(i,e);for(;t<ne;)t+=E;for(;t>=ne+E;)t-=E;if(t>=D.from&&t<D.to)return D}return null}}),Je("packages/modules/charts/distribution.js",function(s,K){"use strict";Object.defineProperty(s,"FENCE",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"quantile",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"summarise",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"binEdge",{enumerable:!0,get:function(){return _}}),Object.defineProperty(s,"outsideDomain",{enumerable:!0,get:function(){return e}}),Object.defineProperty(s,"histogram",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"readingsOf",{enumerable:!0,get:function(){return y}}),Object.defineProperty(s,"valuesByCategory",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"allReadings",{enumerable:!0,get:function(){return g}}),Object.defineProperty(s,"distributionDomain",{enumerable:!0,get:function(){return m}}),Object.defineProperty(s,"density",{enumerable:!0,get:function(){return b}}),Object.defineProperty(s,"drawHistogram",{enumerable:!0,get:function(){return l}}),Object.defineProperty(s,"drawBoxPlot",{enumerable:!0,get:function(){return u}}),Object.defineProperty(s,"probit",{enumerable:!0,get:function(){return x}}),Object.defineProperty(s,"drawQQ",{enumerable:!0,get:function(){return n}}),Object.defineProperty(s,"drawEcdf",{enumerable:!0,get:function(){return d}}),Object.defineProperty(s,"drawLorenz",{enumerable:!0,get:function(){return A}}),Object.defineProperty(s,"drawControl",{enumerable:!0,get:function(){return p}}),Object.defineProperty(s,"drawCapability",{enumerable:!0,get:function(){return w}}),Object.defineProperty(s,"drawMovingRange",{enumerable:!0,get:function(){return N}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/axis.js"),pe=S.drawAxisLines,ue=S.drawCategoryAxis,V=S.drawContinuousAxis,Q=S.drawMeasureAxis,G=S.tickLabeller,j=K("packages/modules/charts/format.js").formatters,c=K("packages/modules/charts/scale.js"),Y=c.bandScale,M=c.isNumber,k=c.linearScale,F=c.measureDomain,J=c.niceStep,Z=K("packages/modules/charts/svg.js"),E=Z.attrs,ne=Z.path,v=Z.round,oe=K("packages/modules/charts/styles.js").NS,C=K("packages/modules/charts/scheme.js").resolveScheme,R=K("packages/modules/charts/labels.js"),ie=R.drawAnchoredLabels,I=R.labelText,$=1.5,me="–";function r(f,a){const o=f.length;if(!o)return NaN;if(o===1)return f[0];const h=(o-1)*Math.min(1,Math.max(0,a)),B=Math.floor(h),z=Math.ceil(h);return B===z?f[B]:f[B]+(h-B)*(f[z]-f[B])}function D(f){const a=f.filter(M).slice().sort((le,he)=>le-he);if(!a.length)return null;const o=r(a,.25),h=r(a,.5),B=r(a,.75),z=B-o,U=o-$*z,q=B+$*z;let se=a[0];for(const le of a)if(le>=U){se=le;break}let T=a[a.length-1];for(let le=a.length-1;le>=0;le--)if(a[le]<=q){T=a[le];break}return{min:a[0],q1:o,median:h,q3:B,max:a[a.length-1],low:se,high:T,outliers:a.filter(le=>le<U||le>q),count:a.length}}function _(f,a,o){const h=f+o*a;return Math.abs(h)<a/1e6?0:Number(h.toPrecision(12))}function e(f,a){const o=a||{},h=M(o.min),B=M(o.max);if(!h&&!B)return 0;let z=0;for(let U=0;U<f.length;U++){const q=f[U];M(q)&&(h&&q<o.min||B&&q>o.max)&&z++}return z}function i(f,a=12,o){const h=o||{},B=M(h.min),z=M(h.max);let U=1/0,q=-1/0,se=0;for(let ye=0;ye<f.length;ye++){const ve=f[ye];M(ve)&&(B&&ve<h.min||z&&ve>h.max||(ve<U&&(U=ve),ve>q&&(q=ve),se++))}if(!se)return[];if(B&&(U=Number(h.min)),z&&(q=Number(h.max)),U===q){const ye=Math.abs(U)>0?Math.abs(U)/10:.5;U-=ye,q+=ye}const T=J((q-U)/Math.max(1,a)),le=Math.floor(U/T)*T,he=Math.ceil(q/T)*T,be=[],we=Math.max(1,Math.round((he-le)/T));for(let ye=0;ye<we;ye++)be.push({from:_(le,T,ye),to:_(le,T,ye+1),count:0});for(let ye=0;ye<f.length;ye++){const ve=f[ye];if(!M(ve)||B&&ve<h.min||z&&ve>h.max)continue;let Te=Math.floor((ve-le)/T);Te>=be.length&&(Te=be.length-1),Te<0&&(Te=0),be[Te].count++}return be}function y(f){if(!f)return[];if(Array.isArray(f.values)){const a=f.values.filter(M);if(a.length)return a}return M(f.y)?[f.y]:[]}function t(f){const a=new Map,o=!(f.dimension&&f.dimension.col),h=o&&f.measure&&f.measure.title||"";for(const B of f.series)for(const z of B.points){const U=y(z);if(!U.length)continue;const q=o?h:z.label;a.has(q)||a.set(q,[]);const se=a.get(q);for(const T of U)se.push(T)}return a}function g(f){const a=[];for(const o of f.series||[])for(const h of o.points||[])for(const B of y(h))a.push(B);return a}function m(f,a){const o=a&&a.y||{};return F(f,{zero:!1,min:o.min,max:o.max})}function b(f,a,o){const h=f.length;if(!h)return[];const B=f.reduce((le,he)=>le+he,0)/h,z=f.reduce((le,he)=>le+(he-B)**2,0)/Math.max(1,h-1),U=Math.sqrt(z)||1,q=Math.max(1e-9,1.06*U*h**(-1/5)),se=[],T=a.max-a.min||1;for(let le=0;le<o;le++){const he=a.min+T*le/(o-1||1);let be=0;for(const we of f){const ye=(he-we)/q;be+=Math.exp(-.5*ye*ye)}se.push({at:he,density:be/(h*q*Math.sqrt(Math.PI*2))})}return se}function O(f,a,o){const h=j(f.grid,{kind:"linear",step:o}),B=a.measure&&a.measure.col&&f.grid.columns?f.grid.columns.get(a.measure.col):null,U=!!(B&&B.format&&typeof B.formatValue=="function")?{tick:q=>String(B.formatValue(q,null))}:h;return G(f.axis&&f.axis.x||{},U,f.grid)}function l(f){const a=f.scheme||C(),{plot:o,bound:h}=f,B=g(h),z=f.axis&&f.axis.y||{},U=i(B,f.buckets||12,z),q=e(B,z),se=U.map($e=>$e.count),T=F(se,{zero:!0}),le=k(T,[o.bottom,o.top]),he=U.length?U[0].to-U[0].from:1,be=O(f,h,he),we=U.map($e=>be($e.from)),ye=U.map($e=>`${be($e.from)} ${me} ${be($e.to)}`),ve=U.map(($e,Oe)=>Oe),Te=Y(ve,[o.left,o.right],.08);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:le,format:j(f.grid,{kind:"linear",step:(T.max-T.min)/5})}),ue({group:f.groups.overlay,plot:o,scale:Te,labels:we,fontSize:f.fontSize,rotated:we.length>8}),pe({group:f.groups.rules,plot:o});const xe=new W(f.groups.marks),_e=le.of(T.min<=0?0:T.min);if(U.forEach(($e,Oe)=>{const Ie=le.of($e.count);E(xe.next("rect",`${oe}__bar ${oe}__mark`),{x:v(Te.of(Oe)),y:v(Math.min(Ie,_e)),width:v(Te.bandwidth),height:v(Math.max($e.count>0?1:0,Math.abs(_e-Ie))),fill:a.series(0),"data-point":Oe})}),xe.finish(),f.curve&&B.length>1){const $e={min:U[0].from,max:U[U.length-1].to},Oe=b(B,$e,Math.max(24,U.length*4)),Ie=Oe.reduce((He,We)=>Math.max(He,We.density),0);if(Ie>0){const He=$e.max-$e.min||1,We=le.of(T.max),ot=Oe.map(ut=>[v(o.left+(ut.at-$e.min)/He*(o.right-o.left)),v(_e-ut.density/Ie*(_e-We))]),dt=new W(f.groups.overlay);E(dt.next("path",`${oe}__density ${oe}__mark`),{d:ne(ot.flatMap(([ut,bt],wt)=>[wt?"L":"M",ut,bt])),fill:"none",stroke:a.series(1)}),dt.finish()}}if(f.labels&&f.labels.show){const $e=f.typography&&f.typography.small||f.fontSize||11;ie({group:f.groups.labels,size:$e,minGap:f.labels.minGap,plot:o,anchors:U.map((Oe,Ie)=>{const He=Math.min(le.of(Oe.count),_e),We=He-$e/2-2,ot=We<o.top;return{x:v(Te.of(Ie)+Te.bandwidth/2),y:v(ot?He+$e/2+2:We),text:Oe.count?I(Oe.count,f.labels,f.grid):"",inside:ot,height:ot?Math.abs(_e-He)-2:void 0}})})}return{xScale:Te,yScale:le,buckets:U,labels:ye,categories:U.map($e=>$e.from),outside:q,series:[{key:"",label:h.measure.title,index:0,points:U.map(($e,Oe)=>({x:Oe,xKey:String(Oe),label:ye[Oe],from:$e.from,to:$e.to,y:$e.count,rows:$e.count}))}]}}function u(f){const a=f.scheme||C(),{plot:o,bound:h}=f,B=t(h),z=[...B.keys()],U=z.map(we=>D(B.get(we))).filter(Boolean),q=[];for(const we of U)q.push(we.min,we.max);const se=m(q,f.axis),T=k(se,[o.bottom,o.top]),le=Y(z,[o.left,o.right],.4);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:T,format:j(f.grid,{kind:"linear",step:(se.max-se.min)/5})}),ue({group:f.groups.overlay,plot:o,scale:le,labels:z,fontSize:f.fontSize,rotated:z.length>6}),pe({group:f.groups.rules,plot:o});const he=new W(f.groups.marks),be=le.bandwidth;return z.forEach((we,ye)=>{const ve=U[ye];if(!ve)return;const Te=le.of(we),xe=Te+be/2,_e=a.series(ye);E(he.next("rect",`${oe}__box ${oe}__mark`),{x:v(Te),y:v(T.of(ve.q3)),width:v(be),height:v(Math.max(1,T.of(ve.q1)-T.of(ve.q3))),fill:_e,"fill-opacity":.35,stroke:_e,"data-point":ye}),E(he.next("path",`${oe}__whisker ${oe}__mark`),{d:ne(["M",v(xe),v(T.of(ve.high)),"L",v(xe),v(T.of(ve.q3)),"M",v(xe),v(T.of(ve.q1)),"L",v(xe),v(T.of(ve.low)),"M",v(Te+be*.25),v(T.of(ve.high)),"L",v(Te+be*.75),v(T.of(ve.high)),"M",v(Te+be*.25),v(T.of(ve.low)),"L",v(Te+be*.75),v(T.of(ve.low))]),stroke:_e,fill:"none"}),E(he.next("path",`${oe}__median ${oe}__mark`),{d:ne(["M",v(Te),v(T.of(ve.median)),"L",v(Te+be),v(T.of(ve.median))]),stroke:_e,"stroke-width":2,fill:"none"});for(const $e of ve.outliers)E(he.next("circle",`${oe}__point ${oe}__mark`),{cx:v(xe),cy:v(T.of($e)),r:2.5,fill:_e,"fill-opacity":.8})}),he.finish(),{xScale:le,yScale:T,boxes:U,series:[{key:"",label:h.measure.title,index:0,points:z.map((we,ye)=>({x:we,xKey:we,label:we,y:U[ye]?U[ye].median:null,rows:U[ye]?U[ye].count:0}))}]}}function x(f){if(!(f>0&&f<1))return Number.NaN;const a=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],o=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],h=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],B=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],z=.02425;if(f<z){const se=Math.sqrt(-2*Math.log(f));return(((((h[0]*se+h[1])*se+h[2])*se+h[3])*se+h[4])*se+h[5])/((((B[0]*se+B[1])*se+B[2])*se+B[3])*se+1)}if(f>1-z){const se=Math.sqrt(-2*Math.log(1-f));return-(((((h[0]*se+h[1])*se+h[2])*se+h[3])*se+h[4])*se+h[5])/((((B[0]*se+B[1])*se+B[2])*se+B[3])*se+1)}const U=f-.5,q=U*U;return(((((a[0]*q+a[1])*q+a[2])*q+a[3])*q+a[4])*q+a[5])*U/(((((o[0]*q+o[1])*q+o[2])*q+o[3])*q+o[4])*q+1)}function n(f){const a=f.scheme||C(),{plot:o,bound:h}=f;new W(f.groups.grid).finish(),new W(f.groups.axis).finish(),new W(f.groups.rules).finish(),new W(f.groups.labels).finish();const B=g(h);if(B.length<3)return null;const z=B.slice().sort((Ie,He)=>Ie-He),U=z.length,q=z.map((Ie,He)=>x((He+1-.375)/(U+.25))),se=F(q,{zero:!1,nice:!0}),T=F(z,{zero:!1,nice:!0}),le=k(se,[o.left,o.right]),he=k(T,[o.bottom,o.top]);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:he,format:j(f.grid,{kind:"linear",step:(T.max-T.min)/5})}),V({group:f.groups.overlay,plot:o,scale:le,fontSize:f.fontSize,format:j(f.grid,{kind:"linear",step:(se.max-se.min)/5})}),pe({group:f.groups.rules,plot:o});const be=r(z,.25),we=r(z,.75),ye=x(.25),ve=x(.75),Te=(we-be)/(ve-ye),xe=be-Te*ye,_e=new W(f.groups.rules);E(_e.next("path",`${oe}__qq-line`),{d:ne(["M",v(le.of(se.min)),v(he.of(xe+Te*se.min)),"L",v(le.of(se.max)),v(he.of(xe+Te*se.max))]),fill:"none"}),_e.finish();const $e=new W(f.groups.marks),Oe=[];for(let Ie=0;Ie<U;Ie++){const He=v(le.of(q[Ie])),We=v(he.of(z[Ie]));E($e.next("circle",`${oe}__point ${oe}__mark`),{cx:He,cy:We,r:2.5,fill:a.series(0),"data-point":Ie}),Oe.push({x:He,y:We,theoretical:q[Ie],sample:z[Ie]})}return $e.finish(),{points:Oe,line:{slope:Te,intercept:xe}}}function d(f){const a=f.scheme||C(),{plot:o,bound:h}=f;new W(f.groups.grid).finish(),new W(f.groups.axis).finish(),new W(f.groups.rules).finish(),new W(f.groups.labels).finish();const B=g(h);if(!B.length)return null;const z=B.slice().sort((we,ye)=>we-ye),U=z.length,q=F(z,{zero:!1,nice:!0}),se=k(q,[o.left,o.right]),T=k({min:0,max:1},[o.bottom,o.top]);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:T,format:j(f.grid,{kind:"linear",step:.2})}),V({group:f.groups.overlay,plot:o,scale:se,fontSize:f.fontSize,format:j(f.grid,{kind:"linear",step:(q.max-q.min)/5})}),pe({group:f.groups.rules,plot:o});const le=["M",v(se.of(q.min)),v(T.of(0))],he=[];for(let we=0;we<U;we++){const ye=v(se.of(z[we])),ve=(we+1)/U;le.push("L",ye,v(T.of(we/U)),"L",ye,v(T.of(ve))),he.push({value:z[we],share:ve})}le.push("L",v(se.of(q.max)),v(T.of(1)));const be=new W(f.groups.marks);return E(be.next("path",`${oe}__ecdf ${oe}__mark`),{d:ne(le),fill:"none",stroke:a.series(0)}),be.finish(),{steps:he}}function A(f){const a=f.scheme||C(),{plot:o,bound:h}=f;new W(f.groups.grid).finish(),new W(f.groups.axis).finish(),new W(f.groups.rules).finish(),new W(f.groups.labels).finish();const B=g(h).filter(xe=>xe>=0);if(!B.length)return null;const z=B.slice().sort((xe,_e)=>xe-_e),U=z.length,q=z.reduce((xe,_e)=>xe+_e,0);if(q<=0)return null;const se=k({min:0,max:1},[o.left,o.right]),T=k({min:0,max:1},[o.bottom,o.top]);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:T,format:j(f.grid,{kind:"linear",step:.2})}),V({group:f.groups.overlay,plot:o,scale:se,fontSize:f.fontSize,format:j(f.grid,{kind:"linear",step:.2})}),pe({group:f.groups.rules,plot:o});const le=new W(f.groups.rules);E(le.next("path",`${oe}__lorenz-equality`),{d:ne(["M",v(se.of(0)),v(T.of(0)),"L",v(se.of(1)),v(T.of(1))]),fill:"none"}),le.finish();const he=["M",v(se.of(0)),v(T.of(0))],be=[{rows:0,held:0}];let we=0;for(let xe=0;xe<U;xe++){we+=z[xe];const _e={rows:(xe+1)/U,held:we/q};he.push("L",v(se.of(_e.rows)),v(T.of(_e.held))),be.push(_e)}const ye=new W(f.groups.marks);E(ye.next("path",`${oe}__lorenz ${oe}__mark`),{d:ne(he),fill:"none",stroke:a.series(0)}),ye.finish();let ve=0;for(let xe=0;xe<U;xe++)ve+=(xe+1)*z[xe];const Te=2*ve/(U*q)-(U+1)/U;return{curve:be,gini:Te}}function p(f){const a=f.scheme||C(),{plot:o,bound:h}=f;new W(f.groups.grid).finish(),new W(f.groups.labels).finish();const B=[];for(const Oe of h.series)for(const Ie of Oe.points)M(Ie.y)&&B.push(Ie.y);if(B.length<2)return null;const z=f.capability||null,U=z&&z.limits?z.limits:null,q=[...B];U&&q.push(U.upper,U.lower),z&&(z.lower!==null&&q.push(z.lower),z.upper!==null&&q.push(z.upper));const se=F(q,{zero:!1,nice:!0}),T=k(se,[o.bottom,o.top]),le=B.length>1?(o.right-o.left)/(B.length-1):0;Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:T,format:j(f.grid,{kind:"linear",step:(se.max-se.min)/5})}),pe({group:f.groups.rules,plot:o});const he=new W(f.groups.overlay),be=[],we=(Oe,Ie,He,We="end")=>{!Number.isFinite(Oe)||Oe<se.min||Oe>se.max||(E(he.next("path",Ie),{d:ne(["M",v(o.left),v(T.of(Oe)),"L",v(o.right),v(T.of(Oe))]),fill:"none"}),He&&be.push({y:T.of(Oe),text:He,side:We}))};U&&(we(U.centre,`${oe}__control-centre`,"CL","end"),we(U.upper,`${oe}__control-limit`,"UCL","end"),we(U.lower,`${oe}__control-limit`,"LCL","end")),z&&(z.lower!==null&&we(z.lower,`${oe}__spec-limit`,"LSL","start"),z.upper!==null&&we(z.upper,`${oe}__spec-limit`,"USL","start"),z.target!==null&&we(z.target,`${oe}__spec-target`,"Target","start")),he.finish();const ye=new Map;for(const Oe of z&&z.violations?z.violations:[]){const Ie=ye.get(Oe.index);Ie?Ie.includes(Oe.rule)||Ie.push(Oe.rule):ye.set(Oe.index,[Oe.rule])}const ve=new Set(ye.keys()),Te=new W(f.groups.marks),xe=[],_e=[];for(let Oe=0;Oe<B.length;Oe++){const Ie=v(o.left+Oe*le),He=v(T.of(B[Oe]));xe.push(Oe?"L":"M",Ie,He),_e.push({x:Ie,y:He,index:Oe,value:B[Oe],violating:ve.has(Oe)})}E(Te.next("path",`${oe}__control-line ${oe}__mark`),{d:ne(xe),fill:"none",stroke:a.series(0)});for(const Oe of _e)E(Te.next("circle",`${oe}__point ${oe}__mark`),{cx:Oe.x,cy:Oe.y,r:Oe.violating?4:2.5,fill:Oe.violating?"var(--lattice-danger, #a4262c)":a.series(0),"data-violation":Oe.violating?"true":null});Te.finish();const $e=[];for(const{y:Oe,text:Ie,side:He}of be)$e.push({x:He==="start"?o.left+2:o.right-2,y:Oe-3,text:Ie,anchor:He,className:`${oe}__control-name`});for(const Oe of _e){const Ie=ye.get(Oe.index);Ie&&$e.push({x:Oe.x,y:Oe.y-7,text:Ie.sort((He,We)=>He-We).join(","),anchor:"middle",className:`${oe}__control-rule`})}return ie({group:f.groups.labels,anchors:$e,size:9,grid:f.grid,minGap:1}),{points:_e,limits:U,ruleSet:z?z.ruleSet:null}}function w(f){const a=f.scheme||C(),{plot:o,bound:h}=f;new W(f.groups.grid).finish();const B=[];for(const $e of h.series)for(const Oe of $e.points)M(Oe.y)&&B.push(Oe.y);if(B.length<2)return null;const z=f.capability||null,U=[...B];z&&(z.lower!==null&&U.push(z.lower),z.upper!==null&&U.push(z.upper),z.target!==null&&U.push(z.target));const q=F(U,{zero:!1,nice:!0}),se=k(q,[o.left,o.right]),T=i(B,f.buckets||14),le=T.map($e=>$e.count),he=F(le,{zero:!0}),be=k(he,[o.bottom,o.top]);Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:be,format:j(f.grid,{kind:"linear",step:(he.max-he.min)/5})}),V({group:f.groups.overlay,plot:o,scale:se,fontSize:f.fontSize,format:j(f.grid,{kind:"linear",step:(q.max-q.min)/5})}),pe({group:f.groups.rules,plot:o});const we=be.of(0),ye=new W(f.groups.marks);for(let $e=0;$e<T.length;$e++){const Oe=T[$e],Ie=se.of(Oe.from),He=se.of(Oe.to),We=be.of(Oe.count);E(ye.next("rect",`${oe}__bar ${oe}__mark`),{x:v(Math.min(Ie,He)),y:v(Math.min(We,we)),width:v(Math.max(1,Math.abs(He-Ie)-1)),height:v(Math.max(Oe.count>0?1:0,Math.abs(we-We))),fill:a.series(0),"data-point":$e})}ye.finish();const ve=new W(f.groups.overlay),Te=[];if(z&&Number.isFinite(z.mean)){const Oe=ot=>{if(!Number.isFinite(ot)||ot<=0)return null;const dt=[];for(let ut=0;ut<=96;ut++){const bt=q.min+(q.max-q.min)*ut/96,wt=(bt-z.mean)/ot;dt.push({at:bt,y:Math.exp(-.5*wt*wt)/ot})}return dt},Ie=Oe(z.sigmaWithin),He=Oe(z.sigmaOverall);let We=0;for(const ot of[Ie,He])if(ot)for(const dt of ot)We=Math.max(We,dt.y);if(We>0){const ot=be.of(he.max),dt=(ut,bt,wt)=>{if(!ut)return;const vt=ut.flatMap((Nt,At)=>[At?"L":"M",v(se.of(Nt.at)),v(we-Nt.y/We*(we-ot))]);E(ve.next("path",`${bt} ${oe}__mark`),{d:ne(vt),fill:"none"}),Te.push(wt)};dt(Ie,`${oe}__capability-within`,"within"),dt(He,`${oe}__capability-overall`,"overall")}}const xe=[],_e=($e,Oe,Ie)=>{if($e===null||!Number.isFinite($e)||$e<q.min||$e>q.max)return;const He=v(se.of($e));E(ve.next("path",Oe),{d:ne(["M",He,v(o.top),"L",He,v(o.bottom)]),fill:"none"}),xe.push({x:He,text:Ie})};return z&&(_e(z.lower,`${oe}__spec-limit`,"LSL"),_e(z.upper,`${oe}__spec-limit`,"USL"),_e(z.target,`${oe}__spec-target`,"Target")),ve.finish(),ie({group:f.groups.labels,anchors:xe.map(({x:$e,text:Oe})=>({x:$e,y:o.top+6,text:Oe,anchor:"middle",className:`${oe}__control-name`})),size:9,grid:f.grid,minGap:1}),{buckets:T,capability:z,curves:Te}}function N(f){const a=f.scheme||C(),{plot:o,bound:h}=f;new W(f.groups.grid).finish();const B=[];for(const xe of h.series)for(const _e of xe.points)M(_e.y)&&B.push(_e.y);if(B.length<3)return null;const z=[];for(let xe=1;xe<B.length;xe++)z.push(Math.abs(B[xe]-B[xe-1]));const U=z.reduce((xe,_e)=>xe+_e,0)/z.length,q=3.267*U,se=F([...z,0,q],{zero:!0,nice:!0}),T=k(se,[o.bottom,o.top]),le=z.length>1?(o.right-o.left)/(z.length-1):0;Q({gridGroup:f.groups.grid,axisGroup:f.groups.axis,plot:o,scale:T,format:j(f.grid,{kind:"linear",step:(se.max-se.min)/5})}),pe({group:f.groups.rules,plot:o});const he=new W(f.groups.overlay),be=[],we=(xe,_e,$e)=>{!Number.isFinite(xe)||xe<se.min||xe>se.max||(E(he.next("path",_e),{d:ne(["M",v(o.left),v(T.of(xe)),"L",v(o.right),v(T.of(xe))]),fill:"none"}),be.push({y:T.of(xe),text:$e}))};we(U,`${oe}__control-centre`,"MR"),we(q,`${oe}__control-limit`,"UCL"),he.finish();const ye=new W(f.groups.marks),ve=[],Te=[];for(let xe=0;xe<z.length;xe++){const _e=v(o.left+xe*le),$e=v(T.of(z[xe]));ve.push(xe?"L":"M",_e,$e),Te.push({x:_e,y:$e,index:xe,value:z[xe],violating:z[xe]>q})}E(ye.next("path",`${oe}__control-line ${oe}__mark`),{d:ne(ve),fill:"none",stroke:a.series(0)});for(const xe of Te)E(ye.next("circle",`${oe}__point ${oe}__mark`),{cx:xe.x,cy:xe.y,r:xe.violating?4:2.5,fill:xe.violating?"var(--lattice-danger, #a4262c)":a.series(0),"data-violation":xe.violating?"true":null});return ye.finish(),ie({group:f.groups.labels,anchors:be.map(({y:xe,text:_e})=>({x:o.right-2,y:xe-3,text:_e,anchor:"end",className:`${oe}__control-name`})),size:9,grid:f.grid,minGap:1}),{points:Te,centre:U,upper:q}}}),Je("packages/modules/charts/treemap.js",function(s,K){"use strict";Object.defineProperty(s,"squarify",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"layoutTree",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"drawTreemap",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"tileAt",{enumerable:!0,get:function(){return me}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/svg.js"),pe=S.attrs,ue=S.round,V=S.setText,G=K("packages/modules/charts/styles.js").NS,j=K("packages/modules/charts/scheme.js").resolveScheme,c=K("packages/modules/charts/labels.js"),Y=c.drawAnchoredLabels,M=c.labelText,k=K("packages/modules/charts/typography.js"),F=k.applySize,J=k.truncateTo,Z=34,E=6,ne=3,v=3,X=.28;function oe(r){return r*1.6}function ee(r){return Math.round(r*1.6)}function C(r){return r>1?Math.max(.45,1-(r-1)*.22):1}function R(r,D,_){if(!r.length||D<=0||_<=0)return 1/0;const e=Math.max(...r),i=Math.min(...r),y=D*D,t=_*_;return Math.max(y*e/t,t/(y*i))}function ie(r,D){const _=[],e=r.filter(l=>l.value>0),i=e.reduce((l,u)=>l+u.value,0);if(!e.length||i<=0||D.width<=0||D.height<=0)return _;const y=e.slice().sort((l,u)=>u.value-l.value),t=D.width*D.height/i;let g={...D},m=[],b=[];const O=()=>{if(!m.length)return;const l=Math.min(g.width,g.height),x=b.reduce((d,A)=>d+A,0)/l;let n=0;for(let d=0;d<m.length;d++){const A=b[d]/x;_.push(g.width>=g.height?{item:m[d],x:g.x,y:g.y+n,width:x,height:A}:{item:m[d],x:g.x+n,y:g.y,width:A,height:x}),n+=A}g.width>=g.height?g={x:g.x+x,y:g.y,width:g.width-x,height:g.height}:g={x:g.x,y:g.y+x,width:g.width,height:g.height-x},m=[],b=[]};for(const l of y){const u=l.value*t,x=Math.min(g.width,g.height),n=R(b,x,b.reduce((A,p)=>A+p,0)),d=R([...b,u],x,b.reduce((A,p)=>A+p,0)+u);m.length&&d>n&&O(),m.push(l),b.push(l.value*t)}return O(),_}function I(r){const{plot:D,tree:_}=r,e=oe(r.fontSize),i=ee(r.fontSize),y=[],t=(g,m,b,O,l)=>{const u=g.children.filter(x=>b>0||!r.hidden.has(x.label)).map((x,n)=>({node:x,value:x.total,index:b===0?n:O}));for(const x of ie(u,m)){if(b>0&&(x.width<e||x.height<e))continue;const n={...x,depth:b+1,path:[...l,x.item.node.label],children:!1};y.push(n);const d={x:n.x+v,y:n.y+i,width:n.width-v*2,height:n.height-i-v};if(x.item.node.children.length&&d.width>=e&&d.height>=e){const A=y.length;t(x.item.node,d,b+1,n.item.index,n.path),n.children=y.length>A}}};return t(_.root,{x:D.left,y:D.top,width:D.width,height:D.height},0,0,[]),y}function $(r){const D=r.scheme||j();new W(r.groups.grid).finish(),new W(r.groups.axis).finish(),new W(r.groups.rules).finish(),new W(r.groups.labels).finish();const _=I(r),e=r.typography&&r.typography.small||r.fontSize||11,i=new W(r.groups.marks);for(const t of _)pe(i.next("rect",`${G}__tile ${G}__mark${t.children?` ${G}__tile--branch`:""}`),{x:ue(t.x),y:ue(t.y),width:ue(Math.max(0,t.width)),height:ue(Math.max(0,t.height)),fill:D.series(t.item.index),"fill-opacity":t.children?X:C(t.depth),"data-point":t.item.index,"data-depth":t.depth});i.finish();const y=new W(r.groups.overlay);for(const t of _){if(t.width<Z||t.height<r.fontSize*1.6)continue;const g=String(t.item.node.label??""),m=J(g,t.width-E*2,e);if(m!==g&&m.length<ne)continue;const b=y.next("text",`${G}__tile-label${t.children?` ${G}__tile-label--branch`:""}`);pe(b,{x:ue(t.x+E),y:ue(t.y+r.fontSize+2),"text-anchor":"start"}),F(b,e),V(b,m)}return y.finish(),r.labels&&r.labels.show&&Y({group:r.groups.labels,size:e,minGap:r.labels.minGap,anchors:_.filter(t=>!t.children&&t.width>=Z&&t.height>=r.fontSize*1.6+e).sort((t,g)=>g.width*g.height-t.width*t.height).map(t=>({x:ue(t.x+E),y:ue(t.y+r.fontSize*2+4),text:M(t.item.value,r.labels,r.grid),anchor:"start",inside:!0,width:t.width-E*2}))}),{tiles:_}}function me(r){let D=null;for(const _ of r.tiles)r.x>=_.x&&r.x<=_.x+_.width&&r.y>=_.y&&r.y<=_.y+_.height&&(!D||(_.depth||1)>(D.depth||1))&&(D=_);return D}}),Je("packages/modules/charts/matrix.js",function(s,K){"use strict";Object.defineProperty(s,"colourRamp",{enumerable:!0,get:function(){return y}}),Object.defineProperty(s,"drawHeatmap",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"drawFunnel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(s,"drawCandlestick",{enumerable:!0,get:function(){return m}}),Object.defineProperty(s,"drawCorrelogram",{enumerable:!0,get:function(){return O}}),Object.defineProperty(s,"title",{enumerable:!0,get:function(){return u}}),Object.defineProperty(s,"cellAt",{enumerable:!0,get:function(){return x}});const W=K("packages/modules/charts/frame.js").Pool,S=K("packages/modules/charts/axis.js"),pe=S.drawAxisLines,ue=S.drawBandLabels,V=S.drawCategoryAxis,Q=S.drawMeasureAxis,G=S.leftLabelRoom,te=S.setLabelText,j=K("packages/modules/charts/format.js"),c=j.formatters,Y=j.measureText,M=K("packages/modules/charts/scale.js"),k=M.bandScale,F=M.isNumber,J=M.measureDomain,Z=K("packages/modules/charts/svg.js"),E=Z.attrs,ne=Z.path,v=Z.round,X=Z.setText,ee=K("packages/modules/charts/typography.js").applySize,R=K("packages/modules/charts/styles.js").NS,ie=K("packages/modules/charts/scheme.js"),I=ie.rampStops,$=ie.resolveScheme,me=K("packages/modules/charts/labels.js"),r=me.drawAnchoredLabels,D=me.labelText,_=Object.freeze([[236,243,249],[0,82,128]]),e=Object.freeze([[176,74,0],[247,247,247],[0,82,128]]);function i(n,d,A){const p=Math.min(1,Math.max(0,A)),w=N=>Math.round(n[N]+(d[N]-n[N])*p);return`rgb(${w(0)} ${w(1)} ${w(2)})`}function y(n,d,A){const p=n.max-n.min||1,w=A?I(A,d):d?e:_;if(!d)return f=>i(w[0],w[w.length-1],(f-n.min)/p);const N=Math.max(Math.abs(n.min),Math.abs(n.max))||1;return f=>f>=0?i(w[1],w[2],f/N):i(w[1],w[0],-f/N)}function t(n){const d=n.scheme||$(),{plot:A,bound:p}=n;new W(n.groups.grid).finish(),new W(n.groups.axis).finish(),new W(n.groups.rules).finish(),new W(n.groups.labels).finish();const w=p.series.filter(z=>!n.hidden.has(z.key)),N=[];for(const z of w)for(const U of z.points)N.push(U.y);const f=J(N,{zero:!1,nice:!1}),a=y(f,!!n.diverging,d),o=k(p.categories,[A.left,A.right],.04),h=k(w.map(z=>z.label),[A.top,A.bottom],.04),B=new W(n.groups.marks);for(const z of w){const U=h.of(z.label);if(!Number.isNaN(U))for(let q=0;q<z.points.length;q++){const se=z.points[q],T=o.of(se.x);if(Number.isNaN(T))continue;const le=B.next("rect",`${R}__cell ${R}__mark`);E(le,{x:v(T),y:v(U),width:v(o.bandwidth),height:v(h.bandwidth),fill:F(se.y)?a(se.y):"transparent","data-series":z.index,"data-point":q}),se.px=v(T+o.bandwidth/2),se.py=v(U+h.bandwidth/2)}}if(B.finish(),V({group:n.groups.overlay,plot:A,scale:o,labels:p.labels,fontSize:n.fontSize,rotated:p.labels.length>6}),ue({group:n.groups.axis,plot:A,scale:h,labels:w.map(z=>z.label),fontSize:n.fontSize}),n.labels&&n.labels.show){const z=n.typography&&n.typography.small||n.fontSize||11,U=[];for(const q of w)for(const se of q.points)se.px===void 0||!F(se.y)||U.push({x:se.px,y:se.py,text:D(se.y,n.labels,n.grid),inside:!0,width:o.bandwidth-4,height:h.bandwidth-2});r({group:n.groups.labels,size:z,minGap:0,anchors:U})}return{xScale:o,yScale:h,series:w,ramp:a}}function g(n){const d=n.scheme||$(),{plot:A,bound:p}=n;new W(n.groups.grid).finish(),new W(n.groups.axis).finish(),new W(n.groups.rules).finish(),new W(n.groups.labels).finish();const w=p.series[0],N=w?w.points.map((U,q)=>({point:U,label:p.labels[q],value:F(U.y)?U.y:0})).filter(U=>U.value>0):[];if(!N.length)return{stages:N};let f=0;for(let U=0;U<N.length;U++)N[U].value>f&&(f=N[U].value);const a=A.height/N.length,o=A.left+A.width/2,h=A.width*.62,B=new W(n.groups.marks);N.forEach((U,q)=>{const se=N[q+1],T=A.top+q*a,le=U.value/f*h/2,he=(se?se.value:U.value)/f*h/2;E(B.next("path",`${R}__funnel ${R}__mark`),{d:ne(["M",v(o-le),v(T),"L",v(o+le),v(T),"L",v(o+he),v(T+a-2),"L",v(o-he),v(T+a-2),"Z"]),fill:d.series(q),"data-point":q}),U.point.px=v(o),U.point.py=v(T+a/2)}),B.finish();const z=new W(n.groups.overlay);return N.forEach((U,q)=>{const se=A.top+q*a,T=z.next("text",`${R}__funnel-label`);E(T,{x:v(A.left+4),y:v(se+a/2),"text-anchor":"start","dominant-baseline":"middle"}),X(T,U.label);const le=z.next("text",`${R}__funnel-value`);E(le,{x:v(A.right-4),y:v(se+a/2),"text-anchor":"end","dominant-baseline":"middle"});const he=q===0?1:U.value/N[q-1].value,be=n.labels&&n.labels.show?D(U.value,n.labels,n.grid):Y(U.value,n.grid.messages);X(le,q===0?be:`${be} · ${Math.round(he*100)}%`)}),z.finish(),{stages:N}}function m(n){const d=n.scheme||$(),{plot:A,bound:p}=n,[w,N,f,a]=p.series;if(!w||!N||!f||!a)return{xScale:null,yScale:null,series:[]};const o=[];for(const se of[N,f])for(const T of se.points)o.push(T.y);const h=J(o,{zero:!1}),B={...k([],[0,0])},z=b(h,A),U=k(p.categories,[A.left,A.right],.3);Q({gridGroup:n.groups.grid,axisGroup:n.groups.axis,plot:A,scale:z,format:c(n.grid,{kind:"linear",step:(h.max-h.min)/5})}),pe({group:n.groups.rules,plot:A}),V({group:n.groups.overlay,plot:A,scale:U,labels:p.labels,fontSize:n.fontSize,rotated:p.labels.length>10});const q=new W(n.groups.marks);for(let se=0;se<p.categories.length;se++){const T=w.points[se],le=N.points[se],he=f.points[se],be=a.points[se];if(![T,le,he,be].every($e=>$e&&F($e.y)))continue;const we=U.of(p.categories[se]),ye=we+U.bandwidth/2,ve=be.y>=T.y,Te=ve?d.positive:d.negative;E(q.next("path",`${R}__wick ${R}__mark`),{d:ne(["M",v(ye),v(z.of(le.y)),"L",v(ye),v(z.of(he.y))]),stroke:Te,fill:"none"});const xe=z.of(Math.max(T.y,be.y)),_e=z.of(Math.min(T.y,be.y));E(q.next("rect",`${R}__candle ${R}__mark`),{x:v(we),y:v(xe),width:v(U.bandwidth),height:v(Math.max(1,_e-xe)),fill:ve?"transparent":Te,stroke:Te,"data-point":se}),be.px=v(ye),be.py=v(xe)}return q.finish(),{xScale:U,yScale:z,series:[a],candles:p.categories.length}}function b(n,d){const A=n.max-n.min||1;return{kind:"linear",domain:n,range:[d.bottom,d.top],of(p){return d.bottom+(p-n.min)/A*(d.top-d.bottom)},ticks(p=5){const w=[];for(let N=0;N<=p;N++)w.push(n.min+A*N/p);return w}}}function O(n){const d=n.scheme||$(),{plot:A}=n;new W(n.groups.grid).finish(),new W(n.groups.rules).finish(),new W(n.groups.labels).finish();const p=n.columns||[];if(p.length<2)return null;const w=n.grid&&n.grid.statistics;if(!w)return null;const N=n.method==="spearman"?"spearman":n.method==="kendall"?"kendall":"correlation",f=[];for(let q=0;q<p.length;q++)for(let se=0;se<p.length;se++){const T=q===se?1:w[N](p[q],p[se]);f.push({row:q,col:se,a:p[q],b:p[se],r:T})}const a=p.length,o=A.width/a,h=A.height/a,B=new W(n.groups.marks);for(const q of f){const se=A.left+q.col*o,T=A.top+q.row*h;q.x=se,q.y=T,q.width=o,q.height=h;const le=B.next("rect",`${R}__cell ${R}__mark`);E(le,{x:v(se),y:v(T),width:v(Math.max(0,o-1)),height:v(Math.max(0,h-1)),fill:q.row===q.col||q.r===null?"var(--lattice-chart-empty, #eceff1)":l(q.r,d),"data-row":q.row,"data-col":q.col}),q.element=le}B.finish();const z=new W(n.groups.overlay),U=G(A);for(let q=0;q<a;q++){const se=z.next("text",`${R}__tick`);ee(se,n.fontSize),E(se,{x:v(A.left-4),y:v(A.top+q*h+h/2),"text-anchor":"end","dominant-baseline":"middle"}),te(se,u(n.grid,p[q]),U,n.fontSize);const T=z.next("text",`${R}__tick`);ee(T,n.fontSize),E(T,{x:v(A.left+q*o+o/2),y:v(A.top-4),"text-anchor":"middle"}),te(T,u(n.grid,p[q]),o,n.fontSize)}if(n.values!==!1&&o>n.fontSize*2.6&&h>n.fontSize*1.5)for(const q of f){if(q.row===q.col||q.r===null)continue;const se=z.next("text",`${R}__data-label`);ee(se,n.fontSize),E(se,{x:v(A.left+q.col*o+o/2),y:v(A.top+q.row*h+h/2),"text-anchor":"middle","dominant-baseline":"middle","data-inside":"true"}),X(se,q.r.toFixed(2))}return z.finish(),{cells:f,columns:p}}function l(n,d){const A=Math.min(1,Math.abs(n)),p=d?I(d,!0):e,w=p[Math.floor(p.length/2)],N=n>=0?p[p.length-1]:p[0];return i(w,N,A)}function u(n,d){const A=n&&n.columns&&typeof n.columns.get=="function"?n.columns.get(d):null;return String(A&&A.title||d)}function x(n){for(const d of n.cells||[])if(d.x!==void 0&&n.x>=d.x&&n.x<=d.x+d.width&&n.y>=d.y&&n.y<=d.y+d.height)return d;return null}}),Je("packages/modules/charts/topojson.js",function(s,K){"use strict";Object.defineProperty(s,"transformer",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(s,"arcPoints",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"stitch",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"decodeGeometry",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"feature",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"isTopology",{enumerable:!0,get:function(){return Q}});function Ae(G){if(!G)return F=>[F[0],F[1]];const[te,j]=G.scale,[c,Y]=G.translate;let M=0,k=0;return(F,J)=>(J||(M=0,k=0),M+=F[0],k+=F[1],[M*te+c,k*j+Y])}function W(G,te){const j=G.arcs[te],c=Ae(G.transform);return j.map((Y,M)=>c(Y,M))}function S(G,te){const j=W(G,te<0?~te:te);return te<0?j.slice().reverse():j}function pe(G,te){const j=[];for(const c of te){const Y=S(G,c);for(let M=j.length?1:0;M<Y.length;M++)j.push(Y[M])}return j}function ue(G,te){if(!te||!te.type)return null;const j=Ae(G.transform);switch(te.type){case"Point":return{type:"Point",coordinates:j(te.coordinates,0)};case"MultiPoint":return{type:"MultiPoint",coordinates:te.coordinates.map(c=>j(c,0))};case"LineString":return{type:"LineString",coordinates:pe(G,te.arcs)};case"MultiLineString":return{type:"MultiLineString",coordinates:te.arcs.map(c=>pe(G,c))};case"Polygon":return{type:"Polygon",coordinates:te.arcs.map(c=>pe(G,c))};case"MultiPolygon":return{type:"MultiPolygon",coordinates:te.arcs.map(c=>c.map(Y=>pe(G,Y)))};case"GeometryCollection":return{type:"GeometryCollection",geometries:(te.geometries||[]).map(c=>ue(G,c)).filter(Boolean)};default:return null}}function V(G,te){const j=typeof te=="string"?(G.objects||{})[te]:te;if(!j)return{type:"FeatureCollection",features:[]};const c=j.type==="GeometryCollection"?j.geometries||[]:[j],Y=[];for(const M of c){const k=ue(G,M);k&&Y.push({type:"Feature",id:M.id,properties:M.properties||{},geometry:k})}return{type:"FeatureCollection",features:Y}}function Q(G){return!!G&&typeof G=="object"&&G.type==="Topology"&&Array.isArray(G.arcs)}}),Je("packages/modules/charts/projection.js",function(s,K){"use strict";Object.defineProperty(s,"MERCATOR_LIMIT",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"equalEarth",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"robinson",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"mercator",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"equirectangular",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"albers",{enumerable:!0,get:function(){return te}}),Object.defineProperty(s,"transverseMercator",{enumerable:!0,get:function(){return j}}),Object.defineProperty(s,"PROJECTIONS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(s,"DEFAULT_PROJECTION",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(s,"resolveProjection",{enumerable:!0,get:function(){return M}}),Object.defineProperty(s,"WRAP_DEGREES",{enumerable:!0,get:function(){return k}}),Object.defineProperty(s,"splitAntimeridian",{enumerable:!0,get:function(){return F}}),Object.defineProperty(s,"boundsOf",{enumerable:!0,get:function(){return J}}),Object.defineProperty(s,"fitted",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(s,"graticule",{enumerable:!0,get:function(){return ne}});const Ae=Math.PI/180,W=Object.freeze([1.340264,-.081106,893e-6,.003796]),S=Object.freeze([[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]]),pe=85.05113;function ue(v,X){const[oe,ee,C,R]=W,ie=X*Ae,I=Math.asin(Math.min(1,Math.max(-1,Math.sqrt(3)/2*Math.sin(ie)))),$=I*I,me=$*$*$,r=Math.sqrt(3)/2*(oe+3*ee*$+me*(7*C+9*R*$));return[v*Ae*Math.cos(I)/r,I*(oe+ee*$+me*(C+R*$))]}function V(v,X){const oe=Math.min(Math.abs(X),90),ee=Math.min(S.length-2,Math.floor(oe/5)),C=(oe-ee*5)/5,[R,ie]=S[ee],[I,$]=S[ee+1],me=R+(I-R)*C,r=ie+($-ie)*C;return[v*Ae*me,(X<0?-r:r)*(Math.PI/2)]}function Q(v,X){const oe=Math.min(pe,Math.max(-pe,X))*Ae;return[v*Ae,Math.log(Math.tan(Math.PI/4+oe/2))]}function G(v,X){return[v*Ae,X*Ae]}function te(v={}){const[X,oe]=v.parallels||[29.5,45.5],[ee,C]=v.centre||[-96,37.5],R=X*Ae,ie=oe*Ae,I=Math.sin(R),$=Math.abs(R-ie)<1e-9?I:(I+Math.sin(ie))/2,me=Math.cos(R)**2+2*$*I,r=Math.sqrt(me-2*$*Math.sin(C*Ae))/$;return(D,_)=>{const e=$*((D-ee)*Ae),i=Math.max(0,me-2*$*Math.sin(_*Ae)),y=Math.sqrt(i)/$;return[y*Math.sin(e),r-y*Math.cos(e)]}}function j(v={}){const[X,oe]=v.centre||[-2,49];return(ee,C)=>{const R=C*Ae,ie=(ee-X)*Ae,I=Math.cos(R)*Math.sin(ie),$=Math.min(1-1e-12,Math.max(-1+1e-12,I));return[.5*Math.log((1+$)/(1-$)),Math.atan2(Math.tan(R),Math.cos(ie))-oe*Ae]}}const c=Object.freeze({equalEarth:()=>ue,robinson:()=>V,mercator:()=>Q,equirectangular:()=>G,albers:te,transverseMercator:j,britishNationalGrid:v=>j({centre:[-2,49],...v})}),Y="equalEarth";function M(v,X={},oe){if(typeof v=="function")return v;const C=c[typeof v=="string"&&v?v:Y];return C?C(X):(oe&&oe(`chart projection ${JSON.stringify(v)} is not one this module draws; using '${Y}'. Supported: ${Object.keys(c).join(", ")}.`),c[Y]({}))}const k=180;function F(v){if(!Array.isArray(v)||v.length<2)return v&&v.length?[v]:[];const X=[];let oe=[v[0]];for(let ee=1;ee<v.length;ee++){const[C,R]=v[ee-1],[ie,I]=v[ee],$=ie-C;if(Math.abs($)>k){const me=$>0?-180:180,r=$>0?$-360:$+360,D=r===0?0:Math.min(1,Math.max(0,(me-C)/r)),_=R+(I-R)*D;oe.push([me,_]),X.push(oe),oe=[[-me,_],[ie,I]]}else oe.push([ie,I])}return X.push(oe),X.filter(ee=>ee.length>1)}function J(v){let X=1/0,oe=1/0,ee=-1/0,C=-1/0;for(const R of v||[])for(const[ie,I]of R)ie<X&&(X=ie),ie>ee&&(ee=ie),I<oe&&(oe=I),I>C&&(C=I);return Number.isFinite(X)?{west:X,south:oe,east:ee,north:C}:null}function Z(v){const{project:X,rings:oe,plot:ee}=v,C=typeof v.padding=="number"?v.padding:4;let R=1/0,ie=1/0,I=-1/0,$=-1/0;for(const x of oe||[])for(const[n,d]of x){const[A,p]=X(n,d);!Number.isFinite(A)||!Number.isFinite(p)||(A<R&&(R=A),A>I&&(I=A),p<ie&&(ie=p),p>$&&($=p))}if(!Number.isFinite(R)||I===R||$===ie)return{to:(n,d)=>{const[A,p]=X(n,d);return[ee.left+ee.width/2+A,ee.top+ee.height/2-p]},scale:1,width:ee.width,height:ee.height,left:ee.left,top:ee.top,aspect:1};const me=Math.max(1,ee.width-C*2),r=Math.max(1,ee.height-C*2),D=typeof v.zoom=="number"&&v.zoom>0?v.zoom:1,_=Math.min(me/(I-R),r/($-ie))*D,e=(I-R)*_,i=($-ie)*_,[y,t]=v.centre?X(v.centre[0],v.centre[1]):[(R+I)/2,(ie+$)/2],g=v.centreOffset||[0,0],m=y+(g[0]||0),b=t+(g[1]||0),O=ee.left+ee.width/2,l=ee.top+ee.height/2;return{to:(x,n)=>{const[d,A]=X(x,n);return[O+(d-m)*_,l-(A-b)*_]},scale:_,width:e,height:i,left:O-e/2,top:l-i/2,aspect:(I-R)/($-ie)}}const E=2;function ne(v={}){const X=v.step&&v.step>0?v.step:30,oe=[];for(let ee=-180;ee<=180;ee+=X){const C=[];for(let R=-80;R<=80;R+=E)C.push([ee,R]);oe.push(C)}for(let ee=-60;ee<=60;ee+=X){const C=[];for(let R=-180;R<=180;R+=E)C.push([R,ee]);oe.push(C)}return oe}}),Je("packages/modules/charts/geo.js",function(s,K){"use strict";Object.defineProperty(s,"CONTINENTS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(s,"CONTINENT_NAMES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"OUTLINES",{enumerable:!0,get:function(){return y}}),Object.defineProperty(s,"COUNTRY_CONTINENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(s,"ALPHA3",{enumerable:!0,get:function(){return g}}),Object.defineProperty(s,"NUMERIC",{enumerable:!0,get:function(){return m}}),Object.defineProperty(s,"normaliseCode",{enumerable:!0,get:function(){return b}}),Object.defineProperty(s,"continentOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(s,"projection",{enumerable:!0,get:function(){return l}}),Object.defineProperty(s,"projectedPath",{enumerable:!0,get:function(){return u}}),Object.defineProperty(s,"ringPath",{enumerable:!0,get:function(){return x}}),Object.defineProperty(s,"shapesToPaths",{enumerable:!0,get:function(){return n}}),Object.defineProperty(s,"registerGeoPack",{enumerable:!0,get:function(){return A}}),Object.defineProperty(s,"geoPack",{enumerable:!0,get:function(){return p}}),Object.defineProperty(s,"geoPacks",{enumerable:!0,get:function(){return w}}),Object.defineProperty(s,"resolvePack",{enumerable:!0,get:function(){return N}}),Object.defineProperty(s,"packRegions",{enumerable:!0,get:function(){return a}}),Object.defineProperty(s,"regionLabelPoint",{enumerable:!0,get:function(){return h}}),Object.defineProperty(s,"geoRamp",{enumerable:!0,get:function(){return B}}),Object.defineProperty(s,"drawGeomap",{enumerable:!0,get:function(){return U}}),Object.defineProperty(s,"regionAt",{enumerable:!0,get:function(){return q}}),Object.defineProperty(s,"markerAt",{enumerable:!0,get:function(){return se}});const W=K("packages/modules/charts/frame.js").Pool,pe=K("packages/modules/charts/matrix.js").colourRamp,V=K("packages/modules/charts/topojson.js").feature,Q=K("packages/modules/charts/projection.js"),G=Q.fitted,te=Q.graticule,j=Q.resolveProjection,c=Q.splitAntimeridian,M=K("packages/modules/charts/labels.js").drawAnchoredLabels,k=K("packages/modules/charts/axis.js"),F=k.overhangFor,J=k.setPlotClip,E=K("packages/core/src/internal/util.js").warnOnce,v=K("packages/modules/charts/scheme.js").resolveScheme,X=K("packages/modules/charts/scale.js"),oe=X.isNumber,ee=X.measureDomain,C=K("packages/modules/charts/svg.js"),R=C.attrs,ie=C.insideRings,I=C.path,$=C.pathRings,me=C.round,r=C.setText,_=K("packages/modules/charts/styles.js").NS,e=Object.freeze(["AF","AN","AS","EU","NA","OC","SA"]),i=Object.freeze({AF:"Africa",AN:"Antarctica",AS:"Asia",EU:"Europe",NA:"North America",OC:"Oceania",SA:"South America"}),y=Object.freeze({NA:[[[-168,66],[-156,71],[-130,70],[-115,69],[-100,69],[-85,70],[-75,73],[-64,66],[-78,62],[-79,55],[-65,60],[-56,52],[-60,45],[-67,45],[-70,42],[-74,40],[-76,37],[-81,32],[-80,27],[-81,25],[-84,30],[-90,29],[-94,29],[-97,26],[-97,21],[-91,19],[-88,21],[-87,16],[-83,9],[-79,9],[-85,13],[-92,16],[-96,16],[-105,20],[-110,24],[-114,28],[-117,32],[-122,37],[-124,42],[-124,48],[-130,55],[-140,60],[-150,59],[-160,55],[-165,60],[-168,66]],[[-43,60],[-32,64],[-22,70],[-20,74],[-25,78],[-33,83],[-45,83],[-58,82],[-62,76],[-56,70],[-55,66],[-52,61],[-43,60]]],SA:[[[-81,12],[-72,12],[-62,11],[-52,5],[-50,0],[-44,-2],[-35,-6],[-38,-13],[-39,-18],[-48,-25],[-53,-34],[-57,-38],[-62,-40],[-65,-45],[-68,-52],[-75,-53],[-73,-45],[-73,-37],[-71,-30],[-70,-23],[-71,-18],[-76,-14],[-81,-6],[-80,-2],[-78,1],[-77,8],[-81,12]]],EU:[[[-10,36],[-9,44],[-2,43],[-4,48],[-1,49],[4,52],[7,53],[8,57],[10,58],[5,58],[5,62],[11,64],[15,69],[21,70],[28,71],[32,70],[40,67],[44,68],[50,69],[60,70],[60,60],[58,52],[50,46],[40,44],[36,45],[30,46],[28,41],[26,40],[23,38],[18,40],[13,38],[15,37],[12,44],[8,44],[3,42],[-2,37],[-10,36]],[[-5,50],[1,51],[2,53],[-1,55],[-3,58],[-5,58],[-6,55],[-5,50]],[[-10,52],[-6,52],[-6,55],[-10,55],[-10,52]]],AF:[[[-17,21],[-16,15],[-17,12],[-13,8],[-8,5],[-3,5],[3,6],[8,4],[9,2],[10,-2],[12,-6],[12,-12],[14,-18],[15,-23],[18,-29],[23,-34],[27,-34],[32,-29],[33,-26],[35,-22],[40,-16],[41,-10],[40,-3],[43,0],[51,4],[51,11],[45,12],[43,12],[39,15],[37,21],[34,28],[32,31],[25,32],[20,31],[15,32],[10,37],[3,36],[-2,35],[-6,36],[-10,30],[-13,27],[-17,21]]],AS:[[[26,40],[35,36],[36,31],[43,30],[48,30],[50,27],[56,25],[57,22],[60,25],[62,25],[67,24],[70,21],[73,16],[77,8],[80,6],[80,13],[84,19],[87,21],[92,21],[95,16],[98,10],[104,1],[104,10],[107,11],[109,17],[117,23],[122,30],[122,37],[126,34],[129,35],[130,43],[135,45],[142,45],[143,53],[140,58],[155,59],[162,60],[170,66],[180,68],[170,71],[150,73],[130,74],[110,76],[90,76],[75,73],[70,70],[60,70],[60,60],[58,52],[50,46],[40,44],[36,45],[30,46],[28,41],[26,40]],[[130,31],[132,32],[135,33],[137,34],[140,35],[141,38],[141,41],[142,42],[145,43],[145,45],[141,45],[140,42],[139,40],[137,37],[135,35],[133,34],[131,33],[130,31]]],OC:[[[113,-22],[114,-26],[115,-34],[119,-34],[126,-32],[132,-32],[137,-35],[141,-38],[147,-38],[150,-37],[153,-30],[153,-25],[146,-19],[142,-11],[136,-12],[130,-12],[126,-14],[122,-18],[113,-22]],[[145,-41],[148,-41],[148,-43],[145,-43],[145,-41]],[[173,-35],[178,-38],[174,-41],[172,-43],[167,-46],[170,-44],[173,-35]]],AN:[[[-180,-78],[-150,-76],[-120,-74],[-100,-73],[-80,-72],[-60,-63],[-45,-60],[-58,-64],[-70,-70],[-60,-76],[-30,-77],[0,-70],[20,-70],[40,-68],[60,-67],[80,-66],[100,-66],[120,-66],[140,-66],[160,-78],[170,-84],[180,-85],[-180,-85],[-180,-78]]]}),t=Object.freeze({AD:"EU",AE:"AS",AF:"AS",AG:"NA",AI:"NA",AL:"EU",AM:"AS",AO:"AF",AQ:"AN",AR:"SA",AS:"OC",AT:"EU",AU:"OC",AW:"NA",AX:"EU",AZ:"AS",BA:"EU",BB:"NA",BD:"AS",BE:"EU",BF:"AF",BG:"EU",BH:"AS",BI:"AF",BJ:"AF",BM:"NA",BN:"AS",BO:"SA",BR:"SA",BS:"NA",BT:"AS",BW:"AF",BY:"EU",BZ:"NA",CA:"NA",CD:"AF",CF:"AF",CG:"AF",CH:"EU",CI:"AF",CL:"SA",CM:"AF",CN:"AS",CO:"SA",CR:"NA",CU:"NA",CV:"AF",CY:"AS",CZ:"EU",DE:"EU",DJ:"AF",DK:"EU",DM:"NA",DO:"NA",DZ:"AF",EC:"SA",EE:"EU",EG:"AF",ER:"AF",ES:"EU",ET:"AF",FI:"EU",FJ:"OC",FK:"SA",FM:"OC",FO:"EU",FR:"EU",GA:"AF",GB:"EU",GD:"NA",GE:"AS",GF:"SA",GG:"EU",GH:"AF",GI:"EU",GL:"NA",GM:"AF",GN:"AF",GP:"NA",GQ:"AF",GR:"EU",GT:"NA",GU:"OC",GW:"AF",GY:"SA",HK:"AS",HN:"NA",HR:"EU",HT:"NA",HU:"EU",ID:"AS",IE:"EU",IL:"AS",IM:"EU",IN:"AS",IQ:"AS",IR:"AS",IS:"EU",IT:"EU",JE:"EU",JM:"NA",JO:"AS",JP:"AS",KE:"AF",KG:"AS",KH:"AS",KI:"OC",KM:"AF",KN:"NA",KP:"AS",KR:"AS",KW:"AS",KY:"NA",KZ:"AS",LA:"AS",LB:"AS",LC:"NA",LI:"EU",LK:"AS",LR:"AF",LS:"AF",LT:"EU",LU:"EU",LV:"EU",LY:"AF",MA:"AF",MC:"EU",MD:"EU",ME:"EU",MG:"AF",MH:"OC",MK:"EU",ML:"AF",MM:"AS",MN:"AS",MO:"AS",MQ:"NA",MR:"AF",MT:"EU",MU:"AF",MV:"AS",MW:"AF",MX:"NA",MY:"AS",MZ:"AF",NA:"AF",NC:"OC",NE:"AF",NG:"AF",NI:"NA",NL:"EU",NO:"EU",NP:"AS",NR:"OC",NZ:"OC",OM:"AS",PA:"NA",PE:"SA",PF:"OC",PG:"OC",PH:"AS",PK:"AS",PL:"EU",PM:"NA",PR:"NA",PS:"AS",PT:"EU",PW:"OC",PY:"SA",QA:"AS",RE:"AF",RO:"EU",RS:"EU",RU:"EU",RW:"AF",SA:"AS",SB:"OC",SC:"AF",SD:"AF",SE:"EU",SG:"AS",SI:"EU",SK:"EU",SL:"AF",SM:"EU",SN:"AF",SO:"AF",SR:"SA",SS:"AF",ST:"AF",SV:"NA",SY:"AS",SZ:"AF",TC:"NA",TD:"AF",TG:"AF",TH:"AS",TJ:"AS",TL:"AS",TM:"AS",TN:"AF",TO:"OC",TR:"AS",TT:"NA",TV:"OC",TW:"AS",TZ:"AF",UA:"EU",UG:"AF",US:"NA",UY:"SA",UZ:"AS",VA:"EU",VC:"NA",VE:"SA",VG:"NA",VI:"NA",VN:"AS",VU:"OC",WS:"OC",YE:"AS",YT:"AF",ZA:"AF",ZM:"AF",ZW:"AF"}),g=Object.freeze({AFG:"AF",ALB:"AL",DZA:"DZ",AND:"AD",AGO:"AO",ARG:"AR",ARM:"AM",AUS:"AU",AUT:"AT",AZE:"AZ",BHS:"BS",BHR:"BH",BGD:"BD",BRB:"BB",BLR:"BY",BEL:"BE",BLZ:"BZ",BEN:"BJ",BTN:"BT",BOL:"BO",BIH:"BA",BWA:"BW",BRA:"BR",BRN:"BN",BGR:"BG",BFA:"BF",BDI:"BI",KHM:"KH",CMR:"CM",CAN:"CA",CPV:"CV",CAF:"CF",TCD:"TD",CHL:"CL",CHN:"CN",COL:"CO",COM:"KM",COG:"CG",COD:"CD",CRI:"CR",CIV:"CI",HRV:"HR",CUB:"CU",CYP:"CY",CZE:"CZ",DNK:"DK",DJI:"DJ",DMA:"DM",DOM:"DO",ECU:"EC",EGY:"EG",SLV:"SV",GNQ:"GQ",ERI:"ER",EST:"EE",ETH:"ET",FJI:"FJ",FIN:"FI",FRA:"FR",GAB:"GA",GMB:"GM",GEO:"GE",DEU:"DE",GHA:"GH",GRC:"GR",GRL:"GL",GTM:"GT",GIN:"GN",GNB:"GW",GUY:"GY",HTI:"HT",HND:"HN",HKG:"HK",HUN:"HU",ISL:"IS",IND:"IN",IDN:"ID",IRN:"IR",IRQ:"IQ",IRL:"IE",ISR:"IL",ITA:"IT",JAM:"JM",JPN:"JP",JOR:"JO",KAZ:"KZ",KEN:"KE",KIR:"KI",PRK:"KP",KOR:"KR",KWT:"KW",KGZ:"KG",LAO:"LA",LVA:"LV",LBN:"LB",LSO:"LS",LBR:"LR",LBY:"LY",LIE:"LI",LTU:"LT",LUX:"LU",MKD:"MK",MDG:"MG",MWI:"MW",MYS:"MY",MDV:"MV",MLI:"ML",MLT:"MT",MHL:"MH",MRT:"MR",MUS:"MU",MEX:"MX",FSM:"FM",MDA:"MD",MCO:"MC",MNG:"MN",MNE:"ME",MAR:"MA",MOZ:"MZ",MMR:"MM",NAM:"NA",NRU:"NR",NPL:"NP",NLD:"NL",NZL:"NZ",NIC:"NI",NER:"NE",NGA:"NG",NOR:"NO",OMN:"OM",PAK:"PK",PLW:"PW",PSE:"PS",PAN:"PA",PNG:"PG",PRY:"PY",PER:"PE",PHL:"PH",POL:"PL",PRT:"PT",PRI:"PR",QAT:"QA",ROU:"RO",RUS:"RU",RWA:"RW",KNA:"KN",LCA:"LC",VCT:"VC",WSM:"WS",SMR:"SM",STP:"ST",SAU:"SA",SEN:"SN",SRB:"RS",SYC:"SC",SLE:"SL",SGP:"SG",SVK:"SK",SVN:"SI",SLB:"SB",SOM:"SO",ZAF:"ZA",SSD:"SS",ESP:"ES",LKA:"LK",SDN:"SD",SUR:"SR",SWZ:"SZ",SWE:"SE",CHE:"CH",SYR:"SY",TWN:"TW",TJK:"TJ",TZA:"TZ",THA:"TH",TLS:"TL",TGO:"TG",TON:"TO",TTO:"TT",TUN:"TN",TUR:"TR",TKM:"TM",TUV:"TV",UGA:"UG",UKR:"UA",ARE:"AE",GBR:"GB",USA:"US",URY:"UY",UZB:"UZ",VUT:"VU",VEN:"VE",VNM:"VN",YEM:"YE",ZMB:"ZM",ZWE:"ZW"}),m=Object.freeze({4:"AF",8:"AL",12:"DZ",20:"AD",24:"AO",32:"AR",36:"AU",40:"AT",44:"BS",48:"BH",50:"BD",51:"AM",52:"BB",56:"BE",64:"BT",68:"BO",70:"BA",72:"BW",76:"BR",84:"BZ",90:"SB",96:"BN",100:"BG",104:"MM",108:"BI",112:"BY",116:"KH",120:"CM",124:"CA",132:"CV",140:"CF",144:"LK",148:"TD",152:"CL",156:"CN",170:"CO",174:"KM",178:"CG",180:"CD",188:"CR",191:"HR",192:"CU",196:"CY",203:"CZ",204:"BJ",208:"DK",212:"DM",214:"DO",218:"EC",222:"SV",226:"GQ",231:"ET",232:"ER",233:"EE",246:"FI",250:"FR",262:"DJ",266:"GA",268:"GE",270:"GM",276:"DE",288:"GH",300:"GR",304:"GL",320:"GT",324:"GN",328:"GY",332:"HT",340:"HN",344:"HK",348:"HU",352:"IS",356:"IN",360:"ID",364:"IR",368:"IQ",372:"IE",376:"IL",380:"IT",384:"CI",388:"JM",392:"JP",398:"KZ",400:"JO",404:"KE",408:"KP",410:"KR",414:"KW",417:"KG",418:"LA",422:"LB",426:"LS",428:"LV",430:"LR",434:"LY",438:"LI",440:"LT",442:"LU",450:"MG",454:"MW",458:"MY",462:"MV",466:"ML",470:"MT",478:"MR",480:"MU",484:"MX",496:"MN",498:"MD",499:"ME",504:"MA",508:"MZ",512:"OM",516:"NA",520:"NR",524:"NP",528:"NL",548:"VU",554:"NZ",558:"NI",562:"NE",566:"NG",578:"NO",586:"PK",585:"PW",591:"PA",598:"PG",600:"PY",604:"PE",608:"PH",616:"PL",620:"PT",624:"GW",626:"TL",630:"PR",634:"QA",642:"RO",643:"RU",646:"RW",682:"SA",686:"SN",688:"RS",690:"SC",694:"SL",702:"SG",703:"SK",704:"VN",705:"SI",706:"SO",710:"ZA",716:"ZW",724:"ES",728:"SS",729:"SD",740:"SR",748:"SZ",752:"SE",756:"CH",760:"SY",762:"TJ",764:"TH",768:"TG",776:"TO",780:"TT",784:"AE",788:"TN",792:"TR",795:"TM",798:"TV",800:"UG",804:"UA",807:"MK",818:"EG",826:"GB",834:"TZ",840:"US",858:"UY",860:"UZ",862:"VE",882:"WS",887:"YE",894:"ZM"});function b(T){if(T==null||T==="")return null;const le=String(T).trim().toUpperCase();return le?/^\d+$/.test(le)?m[String(Number(le))]||null:le.length===2?le:le.length===3&&g[le]||null:null}function O(T){return T?e.includes(T)&&!(T in t)||e.includes(T)?T:t[T]||null:null}function l(T,le={}){const he=le.antarctic?-90:-58,be=84,we=be-he,ye=Math.min(T.width/360,T.height/we),ve=360*ye,Te=we*ye,xe=T.left+(T.width-ve)/2,_e=T.top+(T.height-Te)/2;return($e,Oe)=>[xe+($e+180)*ye,_e+(be-Oe)*ye]}function u(T,le){const he=[];for(let be=0;be<T.length;be++){const[we,ye]=le(T[be][0],T[be][1]);if(!Number.isFinite(we)||!Number.isFinite(ye))return he.length>4?I([...he,"Z"]):"";he.push(be?"L":"M",me(we),me(ye))}return he.length?I([...he,"Z"]):""}function x(T,le){const he=Array.isArray(T)&&Array.isArray(T[0])&&Array.isArray(T[0][0])?T:[T],be=[];for(const we of he)if(!(!Array.isArray(we)||!we.length)){for(let ye=0;ye<we.length;ye++){const[ve,Te]=le(we[ye][0],we[ye][1]);be.push(ye?"L":"M",me(ve),me(Te))}be.push("Z")}return I(be)}function n(T){const le=new Map,he=T.shapes;if(!he)return le;const be=l(T.plot),we=T.codeProperty||"iso_a2";if(!Array.isArray(he)&&!he.type){for(const ve of Object.keys(he)){const Te=b(ve);Te&&typeof he[ve]=="string"&&le.set(Te,he[ve])}return le}const ye=he.type==="FeatureCollection"?he.features||[]:[he];for(const ve of ye){const Te=ve.properties||{},xe=b(Te[we]??Te.iso??Te.code),_e=ve.geometry;if(!xe||!_e)continue;const $e=_e.type==="MultiPolygon"?_e.coordinates:_e.type==="Polygon"?[_e.coordinates]:[],Oe=[];for(const Ie of $e)for(const He of Ie)Oe.push(x(He,be));Oe.length&&le.set(xe,Oe.join(" "))}return le}const d=new Map;function A(T){return T&&typeof T=="object"&&typeof T.id=="string"&&d.set(T.id,T),T}function p(T){return d.get(T)||null}function w(){return[...d.keys()]}function N(T,le){if(!T||typeof T!="object")return null;const he=T;let be=T;if(typeof he.pack=="string"){if(be=d.get(he.pack),!be)return E(`chart:geomap:pack:${he.pack}`,`geometry pack ${JSON.stringify(he.pack)} has not been loaded, so the map fell back to the schematic continents. Import the pack module and pass it as \`shapes\` — import { pack } from '@toclocoinc/lattice-grid/modules/geo-${he.pack}'; createChart({ …, shapes: pack })${d.size?`. Loaded: ${[...d.keys()].join(", ")}.`:"."}`),null}else he.pack&&typeof he.pack=="object"&&(be=he.pack);if(!be||typeof be!="object")return null;const we=be;if(we.topology)return{pack:we,topology:we.topology};if(we.layers){const ye=typeof he.layer=="string"&&he.layer||typeof le=="string"&&le||we.defaultLayer||Object.keys(we.layers)[0],ve=we.layers[ye];if(ve&&ve.topology)return{pack:we,topology:ve.topology,layer:ye}}return null}const f=new WeakMap;function a(T){const le=f.get(T);if(le)return le;const he=[];for(const be of V(T,"regions").features){const we=[],ye=be.geometry,ve=ye.type==="MultiPolygon"?ye.coordinates:ye.type==="Polygon"?[ye.coordinates]:[];for(const Te of ve)for(const xe of Te)for(const _e of c(xe))we.push(_e);we.length&&he.push({code:String(be.id===void 0||be.id===null?"":be.id),label:be.properties&&be.properties.name||String(be.id||""),properties:be.properties||{},rings:we})}return f.set(T,he),he}function o(T,le){const he=[];for(let be=0;be<T.length;be++){const[we,ye]=le(T[be][0],T[be][1]);!Number.isFinite(we)||!Number.isFinite(ye)||he.push(he.length?"L":"M",me(we),me(ye))}return he.length>2?I(he):""}function h(T){let le=null,he=-1;for(const ye of T){if(!ye||ye.length<3)continue;let ve=0,Te=0,xe=0;for(let $e=0;$e<ye.length;$e++){const[Oe,Ie]=ye[$e],[He,We]=ye[($e+1)%ye.length],ot=Oe*We-He*Ie;ve+=ot,Te+=(Oe+He)*ot,xe+=(Ie+We)*ot}ve/=2;const _e=Math.abs(ve);_e<1e-9||_e>he&&(he=_e,le=[Te/(6*ve),xe/(6*ve)])}if(le)return le;const be=T.flat();if(!be.length)return null;const we=be.reduce((ye,[ve,Te])=>[ye[0]+ve,ye[1]+Te],[0,0]);return[we[0]/be.length,we[1]/be.length]}function B(T,le,he){const be=pe(T,le,he);if(le)return be;const we=T.max-T.min||1,ye=1/6;return ve=>be(T.min+(ye+(ve-T.min)/we*(1-ye))*we)}function z(T,le){return(he,be)=>{const[we,ye]=T(he,be);return!Number.isFinite(we)||!Number.isFinite(ye)?[we,ye]:[Math.min(Math.max(we,le.left),le.right),Math.min(Math.max(ye,le.top),le.bottom)]}}function U(T){const le=T.scheme||v(),{plot:he,bound:be}=T;new W(T.groups.grid).finish(),new W(T.groups.axis).finish(),new W(T.groups.rules).finish(),new W(T.groups.labels).finish();const we=N(T.shapes,T.layer),ye=we?new Map:n({shapes:T.shapes,plot:he,codeProperty:T.codeProperty}),ve=ye.size>0||!!we,Te=we?a(we.topology):null,xe=new Map;if(Te)for(const fe of Te){xe.set(fe.code,fe);const de=fe.properties||{};de.alpha3&&xe.set(String(de.alpha3).toUpperCase(),fe),de.numeric&&xe.set(String(Number(de.numeric)),fe),de.fips&&xe.set(String(de.fips),fe)}const _e=new Map,$e=[],Oe=be.series[0];if(Oe)for(let fe=0;fe<Oe.points.length;fe++){const de=Oe.points[fe];if(!oe(de.y))continue;const ge=be.categories[fe],Se=b(ge),ce=Te?[Se,ge==null?"":String(ge).trim().toUpperCase()].map(Ce=>Ce?xe.get(Ce):null).find(Boolean):null,ke=ce?ce.code:null,Pe=Te?ke:ve?Se:O(Se);if(!Pe||ve&&!Te&&!ye.has(Pe)){be.labels[fe]&&$e.push(be.labels[fe]);continue}const Ne=_e.get(Pe)||{value:0,labels:[]};Ne.value+=de.y,Ne.labels.push(be.labels[fe]),_e.set(Pe,Ne)}const Ie=_e.has("AN")||_e.has("AQ"),He=l(he,{antarctic:Ie});let We=null;if(Te){const fe=Ie?Te:Te.filter(ge=>ge.code!=="AQ"&&ge.code!=="AN"),de=j(T.projection||we.pack.projection,{...we.pack.projectionOptions||{},...T.projectionOptions||{}},ge=>E(`chart:geomap:projection:${String(T.projection)}`,ge));We={project:de,...G({project:de,rings:fe.flatMap(ge=>ge.rings),plot:he,zoom:T.zoom,centre:T.centre,centreOffset:T.centreOffset}),drawn:fe}}const ot=ee([..._e.values()].map(fe=>fe.value),{zero:!T.diverging,nice:!1}),dt=B(ot,!!T.diverging,le),ut=F("geomap");J(T.groups,he,ut);const bt={left:he.left-ut,top:he.top-ut,right:he.right+ut,bottom:he.bottom+ut},wt=We?z(We.to,bt):null,vt=new W(T.groups.marks);if(!!T.graticule&&!!We){const fe=T.graticule&&typeof T.graticule=="object"&&T.graticule.step||30;for(const de of te({step:fe}))for(const ge of c(de)){const Se=o(ge,wt);if(!Se)continue;const ce=vt.next("path",`${_}__graticule`);R(ce,{d:Se,class:`${_}__graticule`})}}const At=[],zt=We?We.drawn.map(fe=>fe.code):ve?[...ye.keys()]:e.filter(fe=>fe!=="AN"||Ie),Tt=We?new Map(We.drawn.map(fe=>[fe.code,fe])):null;for(const fe of zt){const de=We?Tt.get(fe).rings.map(ce=>u(ce,wt)).filter(Boolean).join(" "):ve?ye.get(fe):x(y[fe],He),ge=_e.get(fe),Se=vt.next("path",`${_}__region ${_}__mark`);R(Se,{d:de,fill:ge?dt(ge.value):"var(--lattice-chart-empty, #eceff1)","data-code":fe,class:`${_}__region ${_}__mark`}),At.push({code:fe,value:ge?ge.value:null,label:!ve&&i[fe]||Tt&&Tt.get(fe).label||ge&&ge.labels[0]||fe,element:Se,d:de})}vt.finish();const Ft=new W(T.groups.overlay);if($e.length){const fe=Ft.next("text",`${_}__geo-note`);R(fe,{x:me(he.left),y:me(he.bottom),"text-anchor":"start"}),r(fe,T.grid.messages.t("chart.geoUnmatched",{count:$e.length}))}Ft.finish();let P=0;if(T.labels&&T.labels.show&&We){const fe=At.filter(de=>de.value!==null).sort((de,ge)=>ge.value-de.value).map(de=>{const ge=Tt.get(de.code).rings.map(ce=>ce.map(([ke,Pe])=>We.to(ke,Pe))),Se=h(ge);return Se&&{x:Se[0],y:Se[1],text:de.label}}).filter(Boolean);P=M({group:T.groups.labels,size:T.fontSize,minGap:T.labels.minGap,anchors:fe,plot:he})}return{regions:At,ramp:dt,unmatched:$e,useCountries:ve,packed:!!We,scale:We?We.scale:null,attribution:we&&we.pack.attribution||"",aspect:We?We.aspect:null,labelsDrawn:P}}function q(T){for(const le of T.regions||[]){if(!le.rings){le.rings=$(le.d);let be=1/0,we=1/0,ye=-1/0,ve=-1/0;for(const Te of le.rings)for(const[xe,_e]of Te)xe<be&&(be=xe),xe>ye&&(ye=xe),_e<we&&(we=_e),_e>ve&&(ve=_e);le.box={minX:be,minY:we,maxX:ye,maxY:ve}}const he=le.box;if(!(!he||T.x<he.minX||T.x>he.maxX||T.y<he.minY||T.y>he.maxY)&&ie(le.rings,T.x,T.y))return le}return null}function se(T){let he=null,be=1/0;for(const we of T.markers||[]){if(!we)continue;const ye=(we.r||0)+3,ve=T.x-we.x,Te=T.y-we.y,xe=Math.sqrt(ve*ve+Te*Te);xe>ye||xe>=be||(be=xe,he=we)}return he}}),Je("packages/modules/charts/rulecolour.js",function(s,K){"use strict";Object.defineProperty(s,"colourOf",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"ruleColour",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"ruleLegend",{enumerable:!0,get:function(){return pe}});const Ae="*";function W(ue){if(!ue||typeof ue!="object")return null;for(const V of["background","backgroundColor","color"]){const Q=ue[V];if(typeof Q=="string"&&Q.trim())return Q.trim()}return null}function S(ue){const{grid:V,col:Q,value:G}=ue;if(!V||!Q||!V.formatting||typeof V.formatting.styleFor!="function")return null;try{return W(V.formatting.styleFor(Q,G))}catch{return null}}function pe(ue){const{grid:V,col:Q}=ue,G=new Set([...ue.colours||[]].filter(Boolean));if(!G.size||!V||!V.formatting||typeof V.formatting.list!="function")return[];let te;try{te=[...V.formatting.list(Ae)||[],...Q?V.formatting.list(Q)||[]:[]]}catch{return[]}const j=[],c=new Set;for(const Y of te){if(!Y||Y.enabled===!1)continue;const M=W(Y.style);!M||!G.has(M)||c.has(M)||(c.add(M),j.push({key:Y.id||`rule:${j.length}`,label:Y.label||Y.id||M,colour:M,index:j.length}))}return j}}),Je("packages/modules/charts/network.js",function(s,K){"use strict";Object.defineProperty(s,"ITERATIONS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(s,"LINK_GAP",{enumerable:!0,get:function(){return C}}),Object.defineProperty(s,"ICON_RADIUS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"sequence",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"layoutNetwork",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"glyphFor",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"glyphTransform",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"offsetParallel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"drawNetwork",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"emphasiseNetwork",{enumerable:!0,get:function(){return _}}),Object.defineProperty(s,"nodeAt",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"linkAt",{enumerable:!0,get:function(){return y}});const W=K("packages/modules/charts/frame.js").Pool,pe=K("packages/modules/charts/scheme.js").resolveScheme,ue=K("packages/modules/charts/svg.js"),V=ue.attrs,Q=ue.path,G=ue.round,te=ue.setText,c=K("packages/modules/charts/styles.js").NS,Y=K("packages/modules/charts/typography.js"),M=Y.applySize,k=Y.truncateTo,F=K("packages/modules/charts/rulecolour.js"),J=F.ruleColour,Z=F.ruleLegend,ne=K("packages/core/src/internal/util.js").warnOnce,v=220,X=2400,oe=.006,ee=.015,C=4,R=10;function ie(t){let g=t>>>0||1;return()=>(g^=g<<13,g>>>=0,g^=g>>17,g^=g<<5,g>>>=0,g/4294967296)}function I(t){const{nodes:g,links:m,plot:b}=t;if(!g.length)return g;const O=ie(g.length*2654435761),l=b.left+b.width/2,u=b.top+b.height/2,x=Math.min(b.width,b.height)/3;for(const d of g){const A=O()*Math.PI*2,p=x*(.35+O()*.65);d.x=l+Math.cos(A)*p,d.y=u+Math.sin(A)*p,d.vx=0,d.vy=0}for(const d of g)d.pinned=Number.isFinite(d.fx)&&Number.isFinite(d.fy),d.pinned&&(d.x=b.left+Math.max(0,Math.min(1,d.fx))*b.width,d.y=b.top+Math.max(0,Math.min(1,d.fy))*b.height);const n=t.iterations||v;for(let d=0;d<n;d++){const A=1-d/n;for(let p=0;p<g.length;p++){const w=g[p];for(let N=p+1;N<g.length;N++){const f=g[N];let a=w.x-f.x,o=w.y-f.y,h=Math.sqrt(a*a+o*o);h<.01&&(a=p-N||1,o=1,h=Math.sqrt(a*a+o*o));const B=X/(h*h),z=a/h*B,U=o/h*B;w.vx+=z,w.vy+=U,f.vx-=z,f.vy-=U}}for(const p of m){const w=p.source,N=p.target;if(w===N)continue;const f=N.x-w.x,a=N.y-w.y,o=oe*(p.weight||1);w.vx+=f*o,w.vy+=a*o,N.vx-=f*o,N.vy-=a*o}for(const p of g){if(p.pinned){p.vx=0,p.vy=0;continue}p.vx+=(l-p.x)*ee,p.vy+=(u-p.y)*ee,p.x+=p.vx*A*.08,p.y+=p.vy*A*.08,p.vx*=.82,p.vy*=.82,p.x=Math.max(b.left+8,Math.min(b.right-8,p.x)),p.y=Math.max(b.top+8,Math.min(b.bottom-8,p.y))}}return g}function $(t,g){if(!g)return null;const m=t&&t.icons;if(!m||typeof m.get!="function")return ne(`chart:icons:${g}`,`A network node asked for the icon '${g}', but this grid publishes no icon registry — a headless grid has no sprites. The node drew as a plain disc.`),null;const b=m.get(g);return b||(ne(`chart:icon:${g}`,`Unknown icon '${g}' on a network node; drew a plain disc instead. Register it with registerIcon or config.icons, or name a built-in.`),null)}function me(t,g){const m=String(t.viewBox||"0 0 16 16").trim().split(/[\s,]+/).map(Number),[b,O,l,u]=m.length===4&&m.every(Number.isFinite)?m:[0,0,16,16],x=Math.max(l||16,u||16),n=g.size/x,d=g.x-l*n/2,A=g.y-u*n/2;return`translate(${G(d-b*n)} ${G(A-O*n)}) scale(${G(n)})`}function r(t){const g=new Map;for(const m of t){const b=m.pair||`${m.source.key}\0${m.target.key}`;g.has(b)||g.set(b,[]),g.get(b).push(m)}for(const m of g.values()){const b=m.length;for(let O=0;O<b;O++){const l=m[O],u=l.source,x=l.target,n=x.x-u.x,d=x.y-u.y,A=Math.sqrt(n*n+d*d)||1,p=A?-d/A:0,w=A?n/A:1,N=(O-(b-1)/2)*C;l.offset=N,l.bundled=b>1,l.line={x1:u.x+p*N,y1:u.y+w*N,x2:x.x+p*N,y2:x.y+w*N}}}}function D(t){const g=t.scheme||pe(),{plot:m,bound:b}=t;for(const h of["grid","axis","rules","labels"])new W(t.groups[h]).finish();const O=b.nodes,l=b.links.map(h=>({...h,weight:h.value}));if(!O.length)return{nodes:[],links:[],legend:[]};const u=l.reduce((h,B)=>Math.max(h,B.value),0)||1;for(const h of l)h.weight=h.value/u;I({nodes:O,links:l,plot:m,iterations:t.iterations}),r(l);const x=b.measure&&b.measure.col||null,n=new Set;for(const h of l)h.colour=J({grid:t.grid,col:x,value:h.value}),h.colour&&n.add(h.colour);const d=O.reduce((h,B)=>Math.max(h,B.in+B.out),0)||1,A=new W(t.groups.marks),p=Number.isFinite(t.linkWidth)&&t.linkWidth>0?Number(t.linkWidth):null;for(const h of l){h.drawnWidth=p===null?.5+h.weight*3:p;const B=A.next("path",`${c}__edge ${c}__mark`);V(B,{d:Q(["M",G(h.line.x1),G(h.line.y1),"L",G(h.line.x2),G(h.line.y2)]),style:h.colour?`stroke:${h.colour};stroke-opacity:1`:null,"stroke-width":G(h.drawnWidth),fill:"none"}),h.el=B}for(const h of O){const B=(h.in+h.out)/d,z=h.icon||t.icon||null;h.glyph=$(t.grid,z),h.r=4+Math.sqrt(B)*12,h.glyph&&(h.r=Math.max(h.r,R));const U=A.next("circle",`${c}__node ${c}__mark`);V(U,{cx:G(h.x),cy:G(h.y),r:G(h.r),fill:g.series(h.index),"data-node":h.key}),h.el=U}A.finish();const w=new W(t.groups.overlay),N=[];for(const h of O){if(!h.glyph){h.glyphEls=[];continue}const B=h.glyph.paint==="stroke",z=me(h.glyph,{x:h.x,y:h.y,size:h.r*1.3});h.glyphEls=h.glyph.paths.map(U=>{const q=w.next("path",`${c}__node-icon${B?` ${c}__node-icon--stroke`:""}`);return V(q,{d:U,transform:z}),q}),N.push(...h.glyphEls)}const f=t.typography&&t.typography.small||t.fontSize,a=O.filter(h=>h.declared),o=O.filter(h=>!h.declared).sort((h,B)=>B.in+B.out-(h.in+h.out)).slice(0,12);for(const h of[...a,...o]){const B=w.next("text",`${c}__flow-label`);M(B,f),V(B,{x:G(h.x),y:G(h.y+h.r+f),"text-anchor":"middle"}),te(B,k(h.label,90,f)),h.labelEl=B}return w.finish(),{nodes:O,links:l,glyphs:N,legend:Z({grid:t.grid,col:x,colours:n})}}function _(t){const g=t.drawn||{},m=t.keys||new Set,b=m.size>0;let O=0;const l=new Set;for(const u of g.links||[]){const x=b&&(u.rowKeys||[]).some(n=>m.has(n));x&&(O++,l.add(u.source),l.add(u.target)),e(u.el,b&&!x)}for(const u of g.nodes||[]){const x=l.has(u);x&&O++,e(u.el,b&&!x);for(const n of u.glyphEls||[])e(n,b&&!x)}return O}function e(t,g){!t||!t.setAttribute||(g?t.setAttribute("data-dim","true"):t.removeAttribute("data-dim"))}function i(t){const g=typeof t.slack=="number"?t.slack:2;let m=null,b=1/0;for(const O of t.nodes||[]){if(typeof O.x!="number"||typeof O.y!="number")continue;const l=t.x-O.x,u=t.y-O.y,x=Math.sqrt(l*l+u*u);x<=(O.r||0)+g&&x<b&&(b=x,m=O)}return m}function y(t){let g=null,m=1/0;for(const b of t.links||[]){const O=b.line,l=O?{x:O.x1,y:O.y1}:b.source,u=O?{x:O.x2,y:O.y2}:b.target;if(!l||!u||typeof l.x!="number"||typeof u.x!="number")continue;const x=u.x-l.x,n=u.y-l.y,d=x*x+n*n,A=d?Math.max(0,Math.min(1,((t.x-l.x)*x+(t.y-l.y)*n)/d)):0,p=t.x-(l.x+A*x),w=t.y-(l.y+A*n),N=Math.sqrt(p*p+w*w),f=Number.isFinite(b.drawnWidth)?b.drawnWidth:.5+(b.weight||0)*3,a=b.bundled?Math.min(Math.max(2,f/2),C/2):Math.max(3,f/2);N<=a&&N<m&&(m=N,g=b)}return g}}),Je("packages/modules/charts/flow.js",function(s,K){"use strict";Object.defineProperty(s,"assignDepths",{enumerable:!0,get:function(){return C}}),Object.defineProperty(s,"layoutSankey",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"ribbon",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"drawSankey",{enumerable:!0,get:function(){return I}}),Object.defineProperty(s,"layoutChord",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"drawChord",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"describeLink",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"flowNodeAt",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"ribbonAt",{enumerable:!0,get:function(){return _}}),Object.defineProperty(s,"chordArcAt",{enumerable:!0,get:function(){return e}}),Object.defineProperty(s,"chordRibbonAt",{enumerable:!0,get:function(){return i}}),Object.defineProperty(s,"chordPolygon",{enumerable:!0,get:function(){return y}});const W=K("packages/modules/charts/frame.js").Pool,pe=K("packages/modules/charts/format.js").measureText,V=K("packages/modules/charts/scheme.js").resolveScheme,Q=K("packages/modules/charts/svg.js"),G=Q.attrs,te=Q.insideRings,j=Q.path,c=Q.round,Y=Q.setText,k=K("packages/modules/charts/styles.js").NS,F=K("packages/modules/charts/typography.js"),J=F.applySize,Z=F.textWidth,E=F.truncateTo,ne=Math.PI*2,v=12,X=8,oe=-Math.PI/2,ee=16;function C(t,g){for(const u of t)u.depth=0;const m=t.length+1;for(let u=0;u<m;u++){let x=!1;for(const n of g){if(n.source===n.target)continue;const d=n.source.depth+1;d>n.target.depth&&d<m&&(n.target.depth=d,x=!0)}if(!x)break}const b=t.reduce((u,x)=>Math.max(u,x.depth),0),O=new Set,l=new Set;for(const u of g)u.source!==u.target&&(O.add(u.source),l.add(u.target));for(const u of t)!O.has(u)&&l.has(u)&&(u.depth=b);return b+1}function R(t){const{nodes:g,links:m,plot:b}=t,O=C(g,m),l=t.nodeWidth||v,u=new Map;for(const p of g)u.has(p.depth)||u.set(p.depth,[]),u.get(p.depth).push(p);let x=0;for(const p of u.values()){const w=p.reduce((f,a)=>f+Math.max(a.in,a.out),0),N=Math.max(0,p.length-1)*X;w>0&&(x=Math.max(x,w/Math.max(1,b.height-N)))}const n=x>0?1/x:0,d=O>1?(b.width-l)/(O-1):0;for(const[p,w]of u){w.sort((o,h)=>Math.max(h.in,h.out)-Math.max(o.in,o.out));const N=w.map(o=>Math.max(1,Math.max(o.in,o.out)*n)),f=N.reduce((o,h)=>o+h,0)+(w.length-1)*X;let a=b.top+Math.max(0,(b.height-f)/2);w.forEach((o,h)=>{o.x=b.left+p*d,o.width=l,o.y=a,o.height=N[h],o.inAt=a,o.outAt=a,a+=N[h]+X})}const A=m.slice().sort((p,w)=>p.source.y-w.source.y||w.value-p.value);for(const p of A){const w=Math.max(1,p.value*n);p.thickness=w,p.y0=p.source.outAt+w/2,p.source.outAt+=w}for(const p of A.slice().sort((w,N)=>w.target.y-N.target.y||N.value-w.value))p.y1=p.target.inAt+p.thickness/2,p.target.inAt+=p.thickness;return{columns:O,scale:n}}function ie(t){const g=t.source.x+t.source.width,m=t.target.x,b=(g+m)/2,O=t.thickness/2;return j(["M",c(g),c(t.y0-O),"C",c(b),c(t.y0-O),c(b),c(t.y1-O),c(m),c(t.y1-O),"L",c(m),c(t.y1+O),"C",c(b),c(t.y1+O),c(b),c(t.y0+O),c(g),c(t.y0+O),"Z"])}function I(t){const g=t.scheme||V(),{plot:m,bound:b}=t;for(const d of["grid","axis","rules","labels"])new W(t.groups[d]).finish();const O=b.nodes,l=b.links;if(!O.length||!l.length)return{nodes:[],links:[]};R({nodes:O,links:l,plot:m});const u=new W(t.groups.marks);for(const d of l){const A=u.next("path",`${k}__ribbon ${k}__mark`);G(A,{d:ie(d),fill:g.series(d.source.index),"data-link":`${d.source.key}->${d.target.key}`})}for(const d of O)G(u.next("rect",`${k}__node ${k}__mark`),{x:c(d.x),y:c(d.y),width:c(d.width),height:c(d.height),fill:g.series(d.index),"data-node":d.key});u.finish();const x=new W(t.groups.overlay),n=t.typography&&t.typography.small||t.fontSize;for(const d of O){const A=d.x<m.left+m.width/2,p=x.next("text",`${k}__flow-label`);J(p,n),G(p,{x:c(A?d.x+d.width+4:d.x-4),y:c(d.y+d.height/2),"text-anchor":A?"start":"end","dominant-baseline":"middle"});const w=A?m.right-(d.x+d.width)-6:d.x-m.left-6;Y(p,E(d.label,Math.max(0,w),n))}return x.finish(),{nodes:O,links:l}}function $(t){const{nodes:g,links:m}=t,b=new Map;for(const p of g)b.set(p.key,0);for(const p of m)b.set(p.source.key,(b.get(p.source.key)||0)+p.value),b.set(p.target.key,(b.get(p.target.key)||0)+p.value);const O=[...b.values()].reduce((p,w)=>p+w,0);if(O<=0)return{arcs:[],ribbons:[]};const l=Math.min(.04,ne/(g.length*8||1)),u=ne-l*g.length,x=[];let n=-Math.PI/2;const d=new Map;for(const p of g){const N=(b.get(p.key)||0)/O*u;x.push({node:p,from:n,to:n+N}),d.set(p.key,n),n+=N+l}const A=[];for(const p of m.slice().sort((w,N)=>N.value-w.value)){const w=p.value/O*u,N=d.get(p.source.key),f=d.get(p.target.key);d.set(p.source.key,N+w),d.set(p.target.key,f+w),A.push({link:p,source:{from:N,to:N+w},target:{from:f,to:f+w}})}return{arcs:x,ribbons:A}}function me(t){const g=t.scheme||V(),{plot:m,bound:b}=t;for(const a of["grid","axis","rules","labels"])new W(t.groups[a]).finish();const O=m.left+m.width/2,l=m.top+m.height/2,u=t.typography&&t.typography.small||t.fontSize,x=Math.max(...b.nodes.map(a=>Z(a.label,u)),0),n=Math.max(10,Math.min(m.width,m.height)/2-Math.min(x+8,90)),d=n*.92,{arcs:A,ribbons:p}=$({nodes:b.nodes,links:b.links,cx:O,cy:l,radius:n}),w=(a,o)=>[O+o*Math.cos(a),l+o*Math.sin(a)],N=new W(t.groups.marks);for(const{link:a,source:o,target:h}of p){const[B,z]=w(o.from,d),[U,q]=w(o.to,d),[se,T]=w(h.from,d),[le,he]=w(h.to,d);G(N.next("path",`${k}__ribbon ${k}__mark`),{d:j(["M",c(B),c(z),"A",c(d),c(d),0,0,1,c(U),c(q),"Q",c(O),c(l),c(se),c(T),"A",c(d),c(d),0,0,1,c(le),c(he),"Q",c(O),c(l),c(B),c(z),"Z"]),fill:g.series(a.source.index),"fill-opacity":.55,"data-link":`${a.source.key}->${a.target.key}`})}for(const a of A){const[o,h]=w(a.from,n),[B,z]=w(a.to,n),[U,q]=w(a.to,d),[se,T]=w(a.from,d),le=a.to-a.from>Math.PI?1:0;G(N.next("path",`${k}__node ${k}__mark`),{d:j(["M",c(o),c(h),"A",c(n),c(n),0,le,1,c(B),c(z),"L",c(U),c(q),"A",c(d),c(d),0,le,0,c(se),c(T),"Z"]),fill:g.series(a.node.index),"data-node":a.node.key})}N.finish();const f=new W(t.groups.overlay);for(const a of A){const o=(a.from+a.to)/2,[h,B]=w(o,n+6),z=f.next("text",`${k}__flow-label`);J(z,u);const U=Math.cos(o)>=0;G(z,{x:c(h),y:c(B),"text-anchor":U?"start":"end","dominant-baseline":"middle"}),Y(z,a.node.label)}return f.finish(),{arcs:A,ribbons:p,ring:{cx:O,cy:l,inner:d,radius:n}}}function r(t,g){return`${t.source.label} → ${t.target.label}: ${pe(t.value,g)}`}function D(t){for(const g of t.nodes||[])if(!(typeof g.x!="number"||typeof g.width!="number")&&t.x>=g.x&&t.x<=g.x+g.width&&t.y>=g.y&&t.y<=g.y+g.height)return g;return null}function _(t){let g=null,m=1/0;for(const b of t.links||[]){const O=b.source,l=b.target;if(!O||!l||typeof b.y0!="number")continue;const u=O.x+O.width,x=l.x;if(t.x<Math.min(u,x)||t.x>Math.max(u,x))continue;const n=(u+x)/2,d=o=>{const h=1-o;return h*h*h*u+3*h*h*o*n+3*h*o*o*n+o*o*o*x};let A=0,p=1;for(let o=0;o<24;o++){const h=(A+p)/2;d(h)<t.x?A=h:p=h}const w=(A+p)/2,N=1-w,f=N*N*N*b.y0+3*N*N*w*b.y0+3*N*w*w*b.y1+w*w*w*b.y1,a=Math.max(1,b.thickness||1)/2;Math.abs(t.y-f)<=a&&(b.thickness||1)<m&&(m=b.thickness||1,g=b)}return g}function e(t){const g=t.ring;if(!g)return null;const m=t.x-g.cx,b=t.y-g.cy,O=Math.sqrt(m*m+b*b);if(O<g.inner||O>g.radius)return null;let l=Math.atan2(b,m);for(;l<oe;)l+=ne;for(;l>=oe+ne;)l-=ne;for(const u of t.arcs||[])if(l>=u.from&&l<u.to)return u;return null}function i(t){const g=t.ring;if(!g)return null;const m=t.x-g.cx,b=t.y-g.cy;if(Math.sqrt(m*m+b*b)>g.inner)return null;for(const O of t.ribbons||[])if(te([y(O,g)],t.x,t.y))return O;return null}function y(t,g){const{cx:m,cy:b,inner:O}=g,l=d=>[m+O*Math.cos(d),b+O*Math.sin(d)],u=[],x=(d,A)=>{for(let p=0;p<=ee;p++)u.push(l(d+(A-d)*p/ee))},n=(d,A)=>{for(let p=1;p<ee;p++){const w=p/ee,N=1-w;u.push([N*N*d[0]+2*N*w*m+w*w*A[0],N*N*d[1]+2*N*w*b+w*w*A[1]])}};return x(t.source.from,t.source.to),n(l(t.source.to),l(t.target.from)),x(t.target.from,t.target.to),n(l(t.target.to),l(t.source.from)),u}}),Je("packages/modules/charts/hit.js",function(s,K){"use strict";Object.defineProperty(s,"valueText",{enumerable:!0,get:function(){return X}}),Object.defineProperty(s,"ownsGeometry",{enumerable:!0,get:function(){return $}}),Object.defineProperty(s,"resolveHit",{enumerable:!0,get:function(){return me}});const W=K("packages/modules/charts/format.js").measureText,pe=K("packages/modules/charts/treemap.js").tileAt,ue=K("packages/modules/charts/geo.js"),V=ue.markerAt,Q=ue.regionAt,te=K("packages/modules/charts/matrix.js").cellAt,j=K("packages/modules/charts/network.js"),c=j.linkAt,Y=j.nodeAt,M=K("packages/modules/charts/flow.js"),k=M.chordArcAt,F=M.chordRibbonAt,J=M.flowNodeAt,Z=M.ribbonAt,E=" → ",ne=" – ",v=" › ";function X(r,D,_){const e=W(r,_);if(!D||typeof r!="number"||!Number.isFinite(r))return e;const i=r/D;return Number.isFinite(i)?`${e} (${_.number(i,{style:"percent",maximumFractionDigits:1})})`:e}function oe(r,D){const _=r.item.node,e=D.bound.root&&D.bound.root.total||0,i=Array.isArray(r.path)?[...r.path]:[_.label];return{heading:i.length>1?i.join(v):_.label,rows:[{label:D.bound.measure.title,value:X(_.total,e,D.grid.messages),colour:D.scheme.series(r.item.index||0)}],datum:{label:_.label,value:_.total,category:_.value,column:D.bound.measure.col&&D.spec.x||null,series:null,depth:r.depth,path:i,rowKeys:_.rowKey?[_.rowKey]:[]}}}function ee(r,D,_){const e=D.reduce((i,y)=>i+(y.value||0),0);return{heading:r.label||r.code,rows:[{label:_.bound.measure.title,value:X(r.value,e,_.grid.messages),colour:_.scheme.series(0)}],datum:{label:r.label||r.code,value:r.value,category:r.code,column:_.spec.code||_.spec.x||null,series:null,path:[r.label||r.code],rowKeys:[]}}}function C(r,D,_){const e=_.spec.value||_.spec.y||null,i=e?_.grid.columns.get(e):null,y=m=>`${Number(m).toFixed(4)}°`,t=(D.legend||[]).find(m=>m.colour===r.fill)||null,g=[{label:i&&i.title||e||"",value:r.text||"",colour:r.fill},{label:"",value:`${y(r.lat)}, ${y(r.lon)}`,colour:"transparent"}];return t&&t.label&&g.push({label:"",value:t.label,colour:r.fill}),{heading:r.label||r.text||"",rows:g,datum:{label:r.label||r.text||"",value:r.value,category:r.value,column:e,series:null,path:[r.label||r.text||""],lon:r.lon,lat:r.lat,status:t?t.label:null,rowKeys:r.rowKey?[r.rowKey]:[]}}}function R(r,D){const _=y=>{const t=D.grid.columns.get(y);return t&&t.title||y},e=_(r.a),i=_(r.b);return{heading:`${e} × ${i}`,rows:[{label:D.spec.method==="spearman"?"ρ":"r",value:typeof r.r=="number"&&Number.isFinite(r.r)?r.r.toFixed(2):"",colour:D.scheme.series(0)}],datum:{label:`${e} × ${i}`,value:typeof r.r=="number"?r.r:null,category:null,column:null,series:null,path:[e,i],rowKeys:[]}}}function ie(r,D){const _=[];for(const i of D.drawn&&D.drawn.links||[])if(!(i.source!==r&&i.target!==r))for(const y of i.rowKeys||[])_.includes(y)||_.push(y);const e=Math.max(r.in||0,r.out||0);return{heading:r.label,rows:[{label:D.bound.measure.title,value:W(e,D.grid.messages),colour:D.scheme.series(r.index||0)}],datum:{label:r.label,value:e,category:r.value===void 0?r.key:r.value,column:null,series:null,path:[r.label],rowKeys:_}}}function I(r,D){const _=`${r.source.label}${r.undirected?ne:E}${r.target.label}`;return{heading:_,rows:[{label:D.bound.measure.title,value:X(r.value,r.undirected?0:D.bound.total||0,D.grid.messages),colour:r.colour||D.scheme.series(r.source.index||0)}],datum:{label:_,value:r.value,category:null,column:null,series:null,path:[r.source.label,r.target.label],rowKeys:Array.isArray(r.rowKeys)?[...r.rowKeys]:[]}}}function $(r){return r?!!(Array.isArray(r.tiles)||Array.isArray(r.regions)||Array.isArray(r.markers)||Array.isArray(r.cells)&&Array.isArray(r.columns)||Array.isArray(r.ribbons)&&r.ring||Array.isArray(r.nodes)&&Array.isArray(r.links)):!1}function me(r){const D=r.drawn;if(!D||!r.bound||!$(D))return null;const{x:_,y:e}=r.at;if(Array.isArray(D.tiles)){const i=pe({tiles:D.tiles,x:_,y:e});return i?oe(i,r):null}if(Array.isArray(D.regions)){const i=Q({regions:D.regions,x:_,y:e});return i?ee(i,D.regions,r):null}if(Array.isArray(D.markers)){const i=V({markers:D.markers,x:_,y:e});return i?C(i,D,r):null}if(Array.isArray(D.cells)&&Array.isArray(D.columns)){const i=te({cells:D.cells,x:_,y:e});return i?R(i,r):null}if(Array.isArray(D.ribbons)&&D.ring){const i=F({ribbons:D.ribbons,ring:D.ring,x:_,y:e});if(i)return I(i.link,r);const y=k({arcs:D.arcs,ring:D.ring,x:_,y:e});return y?ie(y.node,r):null}if(Array.isArray(D.nodes)&&Array.isArray(D.links)){const i=D.nodes.some(g=>typeof g.r=="number"),y=i?Y({nodes:D.nodes,x:_,y:e}):J({nodes:D.nodes,x:_,y:e});if(y)return ie(y,r);const t=i?c({links:D.links,x:_,y:e}):Z({links:D.links,x:_,y:e});return t?I(t,r):null}return null}}),Je("packages/modules/charts/polar.js",function(s,K){"use strict";Object.defineProperty(s,"arcBand",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"drawRadar",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(s,"drawGauge",{enumerable:!0,get:function(){return I}});const W=K("packages/modules/charts/frame.js").Pool,pe=K("packages/modules/charts/format.js").measureText,ue=K("packages/modules/charts/scale.js"),V=ue.isNumber,Q=ue.measureDomain,G=K("packages/modules/charts/svg.js"),te=G.attrs,j=G.path,c=G.round,Y=G.setText,k=K("packages/modules/charts/styles.js").NS,J=K("packages/modules/charts/scheme.js").resolveScheme,Z=K("packages/modules/charts/labels.js"),E=Z.drawAnchoredLabels,ne=Z.labelText,v=Math.PI*2,X=4,oe=v*2/3,ee=Math.PI/2+(v-oe)/2;function C($,me,r,D){const _=D-Math.PI/2;return[$+r*Math.cos(_),me+r*Math.sin(_)]}function R($){const me=$.to-$.from;if(me<=0)return"";const r=Math.max(0,$.r-$.width),D=me>Math.PI?1:0,[_,e]=C($.cx,$.cy,$.r,$.from),[i,y]=C($.cx,$.cy,$.r,$.to),[t,g]=C($.cx,$.cy,r,$.to),[m,b]=C($.cx,$.cy,r,$.from);return j(["M",c(_),c(e),"A",c($.r),c($.r),0,D,1,c(i),c(y),"L",c(t),c(g),"A",c(r),c(r),0,D,0,c(m),c(b),"Z"])}function ie($){const me=$.scheme||J(),{plot:r,bound:D}=$;new W($.groups.grid).finish(),new W($.groups.axis).finish(),new W($.groups.rules).finish(),new W($.groups.labels).finish();const _=r.left+r.width/2,e=r.top+r.height/2,i=Math.max(0,Math.min(r.width,r.height)/2-$.fontSize*2),y=D.labels,t=D.series.filter(n=>!$.hidden.has(n.key)),g=[];for(const n of t)for(const d of n.points)g.push(d.y);const m=Q(g,{zero:!0}),b=y.length?v/y.length:v,O=n=>{const d=m.max-m.min||1;return Math.max(0,(n-m.min)/d*i)},l=new W($.groups.grid);for(let n=1;n<=X;n++){const d=i*n/X,A=y.map((p,w)=>C(_,e,d,w*b));te(l.next("path",`${k}__web`),{d:A.length?j([...A.flatMap(([p,w],N)=>[N?"L":"M",c(p),c(w)]),"Z"]):"",fill:"none"})}for(let n=0;n<y.length;n++){const[d,A]=C(_,e,i,n*b);te(l.next("path",`${k}__web`),{d:j(["M",c(_),c(e),"L",c(d),c(A)]),fill:"none"})}l.finish();const u=new W($.groups.marks);for(const n of t){const d=[];for(let w=0;w<y.length;w++){const N=n.points[w],f=V(N&&N.y)?N.y:m.min,[a,o]=C(_,e,O(f),w*b);d.push([c(a),c(o)]),N&&(N.px=c(a),N.py=c(o))}const A=d.length?j([...d.flatMap(([w,N],f)=>[f?"L":"M",w,N]),"Z"]):"",p=me.series(n.index);te(u.next("path",`${k}__radar-fill ${k}__mark`),{d:A,fill:p,"data-series":n.index}),te(u.next("path",`${k}__radar-line ${k}__mark`),{d:A,stroke:p,fill:"none","data-series":n.index})}u.finish();const x=new W($.groups.overlay);for(let n=0;n<y.length;n++){const[d,A]=C(_,e,i+$.fontSize,n*b),p=x.next("text",`${k}__tick`),w=Math.abs(d-_)<1?"middle":d>_?"start":"end";te(p,{x:c(d),y:c(A),"text-anchor":w,"dominant-baseline":"middle"}),Y(p,y[n])}if(x.finish(),$.labels&&$.labels.show){const n=$.typography&&$.typography.small||$.fontSize||11,d=[];for(const A of t)for(const p of A.points){if(!p||p.px===void 0||!V(p.y))continue;const w=p.px-_,N=p.py-e,f=Math.hypot(w,N)||1;d.push({x:c(p.px+w/f*(n*.8)),y:c(p.py+N/f*(n*.8)),text:ne(p.y,$.labels,$.grid)})}E({group:$.groups.labels,size:n,minGap:$.labels.minGap,anchors:d,plot:r})}return{centre:{x:_,y:e,r:i},series:t,axes:y}}function I($){const me=$.scheme||J(),{plot:r,bound:D}=$;new W($.groups.grid).finish(),new W($.groups.axis).finish(),new W($.groups.rules).finish(),new W($.groups.labels).finish();const _=D.series[0],i=(_?_.points.filter(p=>V(p.y)):[]).reduce((p,w)=>p+w.y,0),y=V($.min)?$.min:0,t=V($.max)?$.max:Math.max(i,1),g=t-y||1,m=Math.min(1,Math.max(0,(i-y)/g)),b=r.left+r.width/2,O=r.top+r.height/2,l=Math.max(0,Math.min(r.width,r.height)/2-4),u=Math.max(6,l*.24),x=new W($.groups.marks);if(te(x.next("path",`${k}__gauge-track`),{d:R({cx:b,cy:O,r:l,width:u,from:ee,to:ee+oe})}),te(x.next("path",`${k}__gauge-value ${k}__mark`),{d:R({cx:b,cy:O,r:l,width:u,from:ee,to:ee+oe*m}),fill:me.series(0)}),V($.target)){const p=Math.min(1,Math.max(0,($.target-y)/g)),w=ee+oe*p,[N,f]=C(b,O,l-u,w),[a,o]=C(b,O,l,w);te(x.next("path",`${k}__gauge-target`),{d:j(["M",c(N),c(f),"L",c(a),c(o)]),fill:"none"})}x.finish();const n=new W($.groups.overlay),d=n.next("text",`${k}__gauge-reading`);te(d,{x:c(b),y:c(O),"text-anchor":"middle","dominant-baseline":"middle"}),Y(d,pe(i,$.grid.messages));const A=n.next("text",`${k}__gauge-caption`);return te(A,{x:c(b),y:c(O+$.fontSize*1.6),"text-anchor":"middle","dominant-baseline":"middle"}),Y(A,D.measure.title||""),n.finish(),{value:i,domain:{min:y,max:t}}}}),Je("packages/modules/charts/multiples.js",function(s,K){"use strict";Object.defineProperty(s,"MAX_PANELS",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(s,"panelGrid",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"panelRects",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"splitPanels",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"sharedDomain",{enumerable:!0,get:function(){return ue}});const Ae=24;function W(V,Q){if(V<=1)return{columns:1,rows:1};const G=(Q.width||1)/(Q.height||1);let te=Math.max(1,Math.round(Math.sqrt(V*G)));te=Math.min(te,V);const j=Math.ceil(V/te);return{columns:te,rows:j}}function S(V){const Q=Math.min(V.count,Ae),G=V.gap===void 0?10:V.gap,te=V.titleHeight===void 0?14:V.titleHeight,{columns:j,rows:c}=W(Q,V.plot),Y=(V.plot.width-G*(j-1))/j,M=(V.plot.height-G*(c-1))/c,k=[];for(let F=0;F<Q;F++){const J=F%j,Z=Math.floor(F/j);k.push({index:F,x:V.plot.left+J*(Y+G),y:V.plot.top+Z*(M+G)+te,width:Math.max(0,Y),height:Math.max(0,M-te)})}return k}function pe(V){return V.series.map((Q,G)=>({label:Q.label,key:Q.key,index:G,bound:{...V,series:[{...Q,index:G}]}}))}function ue(V,Q,G){const te=[];for(const j of V.series)for(const c of j.points)te.push(c.y);return G(te,{zero:Q})}}),Je("packages/modules/charts/stream.js",function(s,K){"use strict";Object.defineProperty(s,"wiggleBaseline",{enumerable:!0,get:function(){return me}}),Object.defineProperty(s,"drawStream",{enumerable:!0,get:function(){return r}}),Object.defineProperty(s,"drawMarimekko",{enumerable:!0,get:function(){return D}}),Object.defineProperty(s,"drawViolin",{enumerable:!0,get:function(){return _}});const Ae=K("packages/modules/charts/axis.js"),W=Ae.drawAxisLines,S=Ae.drawCategoryAxis,pe=Ae.drawMeasureAxis,ue=K("packages/modules/charts/distribution.js"),V=ue.density,Q=ue.distributionDomain,G=ue.summarise,te=ue.valuesByCategory,j=K("packages/modules/charts/frame.js"),c=j.Pool,Y=j.shouldRotate,k=K("packages/modules/charts/format.js").formatters,F=K("packages/modules/charts/scale.js"),J=F.bandScale,Z=F.isNumber,E=F.linearScale,ne=F.measureDomain,X=K("packages/modules/charts/scheme.js").resolveScheme,oe=K("packages/modules/charts/svg.js"),ee=oe.attrs,C=oe.path,R=oe.round,I=K("packages/modules/charts/styles.js").NS,$=32;function me(e){const i=[];let y=0;for(let t=0;t<e.length;t++){const g=e[t],m=g.reduce((u,x)=>u+x,0);if(t===0){y=-m/2,i.push(y);continue}const b=e[t-1];let O=0;const l=g.length;for(let u=0;u<l;u++){let x=0;for(let n=0;n<u;n++)x+=(g[n]||0)-(b[n]||0);O+=(l-u-.5)*((g[u]||0)-(b[u]||0))+x*0}y-=l>0?O/l:0,i.push(y)}return i}function r(e){const i=e.scheme||X(),{plot:y,bound:t}=e;new c(e.groups.grid).finish(),new c(e.groups.rules).finish(),new c(e.groups.labels).finish();const g=t.series.filter(d=>!e.hidden.has(d.key)),m=t.categories.map((d,A)=>g.map(p=>{const w=p.points[A];return Z(w&&w.y)?Math.max(0,w.y):0})),b=me(m),O=[];m.forEach((d,A)=>{O.push(b[A]),O.push(b[A]+d.reduce((p,w)=>p+w,0))});const l=ne(O,{zero:!1,nice:!1}),u=E(l,[y.bottom,y.top]),x=J(t.categories,[y.left,y.right],0),n=new c(e.groups.marks);return g.forEach((d,A)=>{const p=[],w=[];m.forEach((f,a)=>{let o=b[a];for(let B=0;B<A;B++)o+=f[B];const h=R(x.centre(t.categories[a]));w.push([h,R(u.of(o))]),p.push([h,R(u.of(o+f[A]))])});const N=[];p.forEach(([f,a],o)=>N.push(o?"L":"M",f,a));for(let f=w.length-1;f>=0;f--)N.push("L",w[f][0],w[f][1]);N.push("Z"),ee(n.next("path",`${I}__stream ${I}__mark`),{d:C(N),fill:i.series(d.index),"data-series":d.index})}),n.finish(),S({group:e.groups.overlay,plot:y,scale:x,labels:t.labels,fontSize:e.typography&&e.typography.small||e.fontSize,rotated:Y(t.labels,x.step,e.fontSize,(e.axis&&e.axis.x||{}).every),config:e.axis&&e.axis.x||{}}),{xScale:x,yScale:u,series:g}}function D(e){const i=e.scheme||X(),{plot:y,bound:t}=e,g=t.series.filter(w=>!e.hidden.has(w.key)),m=t.categories.map((w,N)=>g.reduce((f,a)=>{const o=a.points[N];return f+(Z(o&&o.y)?Math.abs(o.y):0)},0)),b=m.reduce((w,N)=>w+N,0);if(b<=0)return{series:g,columns:[]};const O=2,l=y.width-O*Math.max(0,t.categories.length-1),u=E({min:0,max:100},[y.bottom,y.top]);pe({gridGroup:e.groups.grid,axisGroup:e.groups.axis,plot:y,scale:u,format:k(e.grid,{kind:"linear",step:20}),config:e.axis&&e.axis.y||{},grid:e.grid,size:e.typography&&e.typography.small||e.fontSize}),W({group:e.groups.rules,plot:y});const x=new c(e.groups.marks),n=[];let d=y.left;t.categories.forEach((w,N)=>{const f=m[N]/b*l;let a=y.bottom;g.forEach((o,h)=>{const B=o.points[N],z=Z(B&&B.y)?Math.abs(B.y):0,q=(m[N]>0?z/m[N]:0)*y.height;ee(x.next("rect",`${I}__bar ${I}__mark`),{x:R(d),y:R(a-q),width:R(Math.max(0,f)),height:R(Math.max(0,q)),fill:i.series(o.index),"data-series":o.index,"data-point":N}),B&&(B.px=R(d+f/2),B.py=R(a-q)),a-=q}),n.push({category:w,label:t.labels[N],x:d,width:f,total:m[N]}),d+=f+O}),x.finish();const A=new c(e.groups.overlay),p=e.typography&&e.typography.small||e.fontSize;for(const w of n){if(w.width<p*2)continue;const N=A.next("text",`${I}__tick`);N.style.fontSize=`${p}px`,ee(N,{x:R(w.x+w.width/2),y:R(y.top-2),"text-anchor":"middle"}),N.textContent=w.label}return A.finish(),{series:g,columns:n}}function _(e){const i=e.scheme||X(),{plot:y,bound:t}=e,g=te(t),m=[...g.keys()],b=[];for(const n of g.values())for(let d=0;d<n.length;d++)b.push(n[d]);const O=Q(b,e.axis),l=E(O,[y.bottom,y.top]),u=J(m,[y.left,y.right],.3);pe({gridGroup:e.groups.grid,axisGroup:e.groups.axis,plot:y,scale:l,format:k(e.grid,{kind:"linear",step:(O.max-O.min)/5}),config:e.axis&&e.axis.y||{},grid:e.grid,size:e.typography&&e.typography.small||e.fontSize}),S({group:e.groups.overlay,plot:y,scale:u,labels:m,fontSize:e.typography&&e.typography.small||e.fontSize,rotated:m.length>6,config:e.axis&&e.axis.x||{}}),W({group:e.groups.rules,plot:y});const x=new c(e.groups.marks);return m.forEach((n,d)=>{const A=g.get(n),p=V(A,O,$),w=p.reduce((z,U)=>Math.max(z,U.density),0)||1,N=u.bandwidth/2,f=u.of(n)+N,a=p.map(z=>[R(f+z.density/w*N),R(l.of(z.at))]),o=p.map(z=>[R(f-z.density/w*N),R(l.of(z.at))]),h=[];a.forEach(([z,U],q)=>h.push(q?"L":"M",z,U));for(let z=o.length-1;z>=0;z--)h.push("L",o[z][0],o[z][1]);h.push("Z"),ee(x.next("path",`${I}__violin ${I}__mark`),{d:C(h),fill:i.series(d),"data-point":d});const B=G(A);B&&ee(x.next("path",`${I}__median ${I}__mark`),{d:C(["M",R(f-N*.5),R(l.of(B.median)),"L",R(f+N*.5),R(l.of(B.median))]),stroke:i.series(d),"stroke-width":2,fill:"none"})}),x.finish(),{xScale:u,yScale:l,series:[{key:"",label:t.measure.title,index:0,points:m.map(n=>{const d=G(g.get(n));return{x:n,xKey:n,label:n,y:d?d.median:null,rows:(g.get(n)||[]).length}})}]}}}),Je("packages/modules/charts/gantt.js",function(s,K){"use strict";Object.defineProperty(s,"readTasks",{enumerable:!0,get:function(){return R}}),Object.defineProperty(s,"drawGantt",{enumerable:!0,get:function(){return ie}});const Ae=K("packages/modules/charts/axis.js"),W=Ae.drawAxisLines,S=Ae.drawBandLabels,pe=Ae.drawContinuousAxis,V=K("packages/modules/charts/frame.js").Pool,G=K("packages/modules/charts/format.js").formatters,te=K("packages/modules/charts/scale.js"),j=te.bandScale,c=te.timeScale,Y=te.toTime,k=K("packages/modules/charts/scheme.js").resolveScheme,F=K("packages/modules/charts/svg.js"),J=F.attrs,Z=F.round,E=F.setText,v=K("packages/modules/charts/styles.js").NS,X=K("packages/modules/charts/typography.js"),oe=X.applySize,ee=X.truncateTo,C=8;function R(I,$,me){const r=[];let D=1/0,_=-1/0;for(const e of me){const i=Y(I.rows.value(e.key,$.start)),y=Y(I.rows.value(e.key,$.end));if(i===null||y===null)continue;const t=$.label?I.rows.text(e.key,$.label):e.key,g=$.series?I.rows.value(e.key,$.series):null;r.push({key:e.key,label:t,group:g,from:Math.min(i,y),to:Math.max(i,y)}),D=Math.min(D,i,y),_=Math.max(_,i,y)}return{tasks:r,span:r.length?{min:D,max:_}:null}}function ie(I){const $=I.scheme||k(),{plot:me}=I,{tasks:r,span:D}=R(I.grid,I.spec,I.rows);if(!D)return{tasks:[],xScale:null,dropped:0};const _=Math.max(1,Math.floor(me.height/C)),e=r.slice(0,_),i=r.length-e.length,y=c({min:D.min,max:D.max},[me.left,me.right]),t=j(e.map(l=>l.key),[me.top,me.bottom],.25),g=I.typography&&I.typography.small||I.fontSize;pe({group:I.groups.overlay,plot:me,scale:y,format:G(I.grid,{kind:"time",span:D.max-D.min}),config:I.axis&&I.axis.x||{},grid:I.grid,size:g}),S({group:I.groups.axis,plot:me,scale:t,labels:e.map(l=>l.label),fontSize:g}),W({group:I.groups.rules,plot:me});const m=[...new Set(e.map(l=>String(l.group)))],b=new V(I.groups.marks);e.forEach((l,u)=>{const x=t.of(l.key),n=y.of(l.from),d=y.of(l.to);J(b.next("rect",`${v}__task ${v}__mark`),{x:Z(n),width:Z(Math.max(2,d-n)),y:Z(x),height:Z(t.bandwidth),fill:$.series(l.group===null?0:m.indexOf(String(l.group))),"data-point":u,"data-key":l.key}),l.px=Z((n+d)/2),l.py=Z(x+t.bandwidth/2)}),b.finish();const O=new V(I.groups.labels);if(i>0){const l=O.next("text",`${v}__geo-note`);oe(l,g),J(l,{x:Z(me.left),y:Z(me.bottom+g+4),"text-anchor":"start"}),E(l,ee(I.grid.messages.t("chart.tasksDropped",{count:i}),me.width,g))}return O.finish(),{tasks:e,xScale:y,dropped:i,series:[{key:"",label:I.spec.label||"",index:0,points:e.map(l=>({x:l.key,xKey:l.key,label:l.label,y:l.to-l.from,rows:1,rowKey:l.key,px:l.px,py:l.py}))}]}}}),Je("packages/modules/charts/interaction.js",function(s,K){"use strict";Object.defineProperty(s,"resolveBrush",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(s,"brushed",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(s,"brushCondition",{enumerable:!0,get:function(){return V}}),Object.defineProperty(s,"attachBrush",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(s,"applySelection",{enumerable:!0,get:function(){return G}}),Object.defineProperty(s,"attachKeyboard",{enumerable:!0,get:function(){return te}});const W=K("packages/modules/charts/svg.js").attrs,S=4;function pe(j){const c=j&&j.brush;if(c===!0)return{mode:"filter",axis:"x"};if(c==="filter"||c==="zoom"||c==="select")return{mode:c,axis:"x"};if(c&&typeof c=="object"&&c.mode){const Y=["filter","zoom","select"].includes(c.mode)?c.mode:null,M=c.axis==="y"||c.axis==="y2"?c.axis:"x";return{mode:Y,axis:M}}return{mode:null,axis:"x"}}function ue(j){const{bound:c,xScale:Y}=j,M=Math.min(j.from,j.to),k=Math.max(j.from,j.to);if(j.axis==="y"||j.axis==="y2"){const Z=j.axis==="y2"&&j.rightScale?j.rightScale:j.yScale||Y;if(!Z||typeof Z.invert!="function")return{kind:"range",values:[],range:null,axis:j.axis};const E=Z.invert(M),ne=Z.invert(k);return{kind:"range",values:[],range:[E,ne],axis:j.axis}}if(Y.kind==="band"){const Z=[];for(const E of c.categories){const ne=Y.centre(E);!Number.isNaN(ne)&&ne>=M&&ne<=k&&Z.push(E)}return{kind:"set",values:Z,range:null,axis:"x"}}const F=Y.invert(M),J=Y.invert(k);return{kind:"range",values:[],range:[F,J],axis:"x"}}function V(j){const{column:c,result:Y}=j;if(!c)return null;if(Y.kind==="set")return Y.values.length?{col:c,op:"in",value:Y.values.slice()}:null;if(!Y.range)return null;const[M,k]=Y.range;if(!Number.isFinite(M)||!Number.isFinite(k))return null;const F=j.kind==="time"?[new Date(Math.min(M,k)),new Date(Math.max(M,k))]:[Math.min(M,k),Math.max(M,k)];return{col:c,op:"between",value:F,bounds:"[]"}}function Q(j){let c=null,Y=null;const M=()=>{const Z=typeof j.axis=="function"?j.axis():"x",E=Z==="y"||Z==="y2";return(typeof j.horizontal=="function"?j.horizontal():!1)!==E},k=Z=>{if(!j.enabled())return;const E=j.pointOf(Z);c=M()?E.y:E.x,Y=j.svg.ownerDocument.createElementNS("http://www.w3.org/2000/svg","rect"),Y.setAttribute("class","lat-chartview__brush"),j.overlay.appendChild(Y)},F=Z=>{if(c===null||!Y)return;const E=j.plot();if(M()){const oe=j.pointOf(Z).y,ee=Math.max(E.top,Math.min(c,oe)),C=Math.min(E.bottom,Math.max(c,oe));W(Y,{x:E.left,y:ee,width:Math.max(0,E.right-E.left),height:Math.max(0,C-ee)});return}const ne=j.pointOf(Z).x,v=Math.max(E.left,Math.min(c,ne)),X=Math.min(E.right,Math.max(c,ne));W(Y,{x:v,y:E.top,width:Math.max(0,X-v),height:E.height})},J=Z=>{if(c===null)return;const E=j.pointOf(Z),ne=M()?E.y:E.x,v=Math.abs(ne-c),X=c;c=null,Y&&Y.parentNode&&Y.parentNode.removeChild(Y),Y=null,v>=S&&j.onBrush(X,ne)};return j.svg.addEventListener("pointerdown",k),j.svg.addEventListener("pointermove",F),j.svg.addEventListener("pointerup",J),j.svg.addEventListener("pointerleave",J),()=>{j.svg.removeEventListener("pointerdown",k),j.svg.removeEventListener("pointermove",F),j.svg.removeEventListener("pointerup",J),j.svg.removeEventListener("pointerleave",J)}}function G(j){const c=j.groups.marks,Y=j.keys.size>0||j.categories.size>0;let M=0;for(const k of c.childNodes||[]){if(!k.getAttribute)continue;const F=Number(k.getAttribute("data-series")),J=Number(k.getAttribute("data-point")),Z=j.series[F],E=Z&&Z.points[J],ne=!!E&&(E.rowKey&&j.keys.has(E.rowKey)||E.xKey!==void 0&&j.categories.has(E.xKey));ne&&M++,Y&&!ne?k.setAttribute("data-dim","true"):k.removeAttribute("data-dim")}return M}function te(j){let c=0;const Y=k=>{const F=j.marks();if(F.length){c=Math.max(0,Math.min(F.length-1,k));for(let J=0;J<F.length;J++)F[J].setAttribute("tabindex",J===c?"0":"-1");F[c].focus&&F[c].focus(),j.onFocus(c)}},M=k=>{const F=j.marks();if(F.length){switch(k.key){case"ArrowRight":case"ArrowDown":Y(c+1);break;case"ArrowLeft":case"ArrowUp":Y(c-1);break;case"Home":Y(0);break;case"End":Y(F.length-1);break;case"Enter":case" ":j.onActivate(c);break;default:return}k.preventDefault&&k.preventDefault()}};return j.svg.addEventListener("keydown",M),()=>j.svg.removeEventListener("keydown",M)}}),Je("packages/modules/charts/range.js",function(s,K){"use strict";Object.defineProperty(s,"deriveRangeSpec",{enumerable:!0,get:function(){return ue}});const Ae=new Set(["number","currency","percent","integer"]);function W(V){return!!V&&typeof V.type=="string"&&Ae.has(V.type)}function S(V){const Q=V&&V.selection&&typeof V.selection.ranges=="function"?V.selection.ranges():[];return!Array.isArray(Q)||!Q.length?null:Q[Q.length-1]}function pe(V,Q){const G=[],te=Math.min(Q.startRow,Q.endRow),j=Math.max(Q.startRow,Q.endRow);for(let c=te;c<=j;c++){const Y=V.rows.get(c);Y&&!Y.group&&Y.data!==null&&Y.data!==void 0&&G.push(Y)}return G}function ue(V,Q={}){const G=ee=>({spec:null,type:null,x:null,measures:[],columns:[],reason:ee}),te=Q.range||S(V);if(!te)return G("no-range");const j=V.columns.visible(),c=new Set(j.map(ee=>ee.id)),Y=(te.columns||[]).filter(ee=>c.has(ee));if(!Y.length)return G("no-visible-columns");const M=Y.map(ee=>({id:ee,column:V.columns.get(ee)})),k=M.filter(ee=>W(ee.column)).map(ee=>ee.id),F=M.filter(ee=>!W(ee.column)).map(ee=>ee.id);if(!k.length)return G("no-measure");const J=F.length?F[0]:null,Z=k,ne={rows:pe(V,te)},v=new Set(["bar","line","area"]);if(Z.length>1){const ee=Q.type,C=v.has(ee)?ee:null,R=ee&&!v.has(ee)?ee:"combo";return{spec:{...ne,type:R,x:J,measures:Z.map(I=>C?{col:I,type:C}:{col:I})},type:R,x:J,measures:Z,columns:Y,reason:null}}const X=Q.type||"bar";return{spec:{...ne,type:X,x:J,y:Z[0]},type:X,x:J,measures:Z,columns:Y,reason:null}}}),Je("packages/modules/charts/regression.js",function(s,K){"use strict";Object.defineProperty(s,"regressionPlots",{enumerable:!0,get:function(){return ue}});const Ae=new Set(["number","currency","percent","integer"]);function W(V,Q={}){return{spec:V,reason:null,...Q}}function S(V,Q={}){return{spec:null,reason:V,...Q}}function pe(V){if(!V||!Array.isArray(V.fitted)||!Array.isArray(V.residuals)||!Array.isArray(V.leverage)||!(V.sigma2>0))return null;const Q=Math.sqrt(V.sigma2),G=[];for(let te=0;te<V.fitted.length;te++){const j=V.leverage[te];if(!Number.isFinite(j)||j>=1)continue;const c=Q*Math.sqrt(1-j);if(!(c>0))continue;const Y=V.residuals[te]/c;G.push({x:V.fitted[te],y:Math.sqrt(Math.abs(Y)),key:String(te)})}return G}function ue(V,Q={}){const G=Q.model||(V&&V.statistics&&typeof V.statistics.regressionModel=="function"?V.statistics.regressionModel(Q.spec||{}):null),te=me=>({fit:S(me),residualsFitted:S(me),qq:S(me),multicollinearity:S(me),scaleLocation:S(me),residualsLeverage:S(me),coefficientForest:S(me)});if(!G||!Array.isArray(G.predictors)||!G.predictors.length||!G.response)return{model:null,plots:te("no-model")};const j=G.predictors,c=G.response,Y=Q.rows,M=()=>Y===void 0?{}:{rows:Y},k=Q.fitted||null,F=Q.residual||null,J=Q.stdResidual||null,Z=Q.leverage||null,E=Q.cooksD||null,ne=j.length===1?W({type:"scatter",x:j[0],y:c,fit:!0,band:G.band||null,...M()}):S("multiple-predictors"),v=k&&F?W({type:"scatter",x:k,y:F,reference:[{value:0}],...M()}):S("needs-fitted-and-residual-columns"),X=F?W({type:"qq",y:F,...M()}):S("needs-residual-column"),oe=j.filter(me=>{const r=V&&V.columns&&typeof V.columns.get=="function"?V.columns.get(me):null;return!r||typeof r.type=="string"&&Ae.has(r.type)}),ee=j.length>=2?W({type:"correlogram",columns:oe},{vif:G.vif||null}):S("single-predictor",{vif:G.vif||null}),C=Z&&J?W({type:E?"bubble":"scatter",x:Z,y:J,...E?{size:E}:{},reference:[{value:0}],...M()}):S("needs-leverage-and-standardised-residual-columns"),R=pe(G),ie=R&&R.length?W({type:"scatter",points:R,fit:!0,dimensionTitle:"Fitted",measureTitle:"√|standardised residual|"}):S("needs-fitted-model"),I=Array.isArray(G.coefficients)?G.coefficients.filter(me=>me&&Number.isFinite(me.estimate)&&Number.isFinite(me.lower)&&Number.isFinite(me.upper)).map(me=>({x:me.estimate,label:me.name,lower:me.lower,upper:me.upper})):[],$=I.length?W({type:"forest",points:I,dimensionTitle:"Coefficient",measureTitle:"Estimate"},{coefficients:G.coefficients||null}):S("needs-coefficient-intervals",{coefficients:G.coefficients||null});return{model:G,plots:{fit:ne,residualsFitted:v,qq:X,multicollinearity:ee,scaleLocation:ie,residualsLeverage:C,coefficientForest:$}}}}),Je("packages/modules/charts/registry.js",function(s,K){"use strict";Object.defineProperty(s,"registerChartType",{enumerable:!0,get:function(){return W}}),Object.defineProperty(s,"chartTypeDef",{enumerable:!0,get:function(){return S}}),Object.defineProperty(s,"registeredChartTypes",{enumerable:!0,get:function(){return pe}});const Ae=new Map;function W(ue,V){if(typeof ue!="string"||!ue)throw new TypeError("[lattice] registerChartType needs a non-empty type name.");if(!V||typeof V.draw!="function")throw new TypeError(`[lattice] registerChartType('${ue}') needs a { draw } function.`);Ae.set(ue,V)}function S(ue){return Ae.get(ue)||null}function pe(){return[...Ae.keys()]}}),Je("packages/modules/charts/index.js",function(s,K){"use strict";Object.defineProperty(s,"TYPES",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(s,"Chart",{enumerable:!0,get:function(){return sn}}),Object.defineProperty(s,"createChart",{enumerable:!0,get:function(){return an}}),Object.defineProperty(s,"deriveRangeSpec",{enumerable:!0,get:function(){return _t}}),Object.defineProperty(s,"regressionPlots",{enumerable:!0,get:function(){return Et}}),Object.defineProperty(s,"chartRange",{enumerable:!0,get:function(){return Jn}}),Object.defineProperty(s,"canChartRange",{enumerable:!0,get:function(){return Qn}});const Ae=K("packages/modules/charts/cartesian.js"),W=Ae.aheadOfWindow,S=Ae.axisWindowSpan,pe=Ae.CARTESIAN,ue=Ae.drawCartesian,V=Ae.drawForest,Q=Ae.nearestCategory,G=Ae.nearestDrawnPoint,te=Ae.WINDOW_LEAD,j=Ae.windowedBound,Y=K("packages/modules/charts/drawable.js").drawability,M=K("packages/modules/charts/axis.js"),k=M.createGroups,F=M.drawAxisTitle,J=M.normaliseAxes,Z=M.setPlotClip,E=K("packages/modules/charts/bind.js"),ne=E.bindHierarchy,v=E.bindLinks,X=E.bindMeasures,oe=E.bindPoints,ee=E.bindSeries,C=E.leafRows,R=K("packages/modules/charts/frame.js"),ie=R.Pool,I=R.plotRect,$=K("packages/modules/charts/scale.js"),me=$.key,r=$.measureDomain,D=$.sqrtScale,_=K("packages/modules/charts/format.js"),e=_.measureText,i=K("packages/modules/charts/radial.js"),y=i.arcAt,t=i.drawRadial,g=K("packages/modules/charts/distribution.js"),m=g.drawBoxPlot,b=g.drawCapability,O=g.drawControl,l=g.drawEcdf,u=g.drawHistogram,x=g.drawLorenz,n=g.drawMovingRange,d=g.drawQQ,p=K("packages/modules/charts/treemap.js").drawTreemap,w=K("packages/modules/charts/hit.js"),N=w.ownsGeometry,f=w.resolveHit,o=K("packages/modules/charts/combo.js").drawCombo,h=K("packages/modules/charts/polar.js"),B=h.drawGauge,z=h.drawRadar,U=K("packages/modules/charts/matrix.js"),q=U.drawCandlestick,se=U.drawCorrelogram,T=U.drawFunnel,le=U.drawHeatmap,he=U.title,be=K("packages/modules/charts/multiples.js"),we=be.panelRects,ye=be.splitPanels,ve=K("packages/modules/charts/geo.js"),Te=ve.drawGeomap,xe=ve.packRegions,_e=ve.projectedPath,$e=ve.resolvePack,Oe=K("packages/modules/charts/projection.js"),Ie=Oe.fitted,He=Oe.resolveProjection,We=Oe.splitAntimeridian,ot=K("packages/modules/charts/flow.js"),dt=ot.drawChord,ut=ot.drawSankey,bt=K("packages/modules/charts/network.js"),wt=bt.drawNetwork,vt=bt.emphasiseNetwork,Nt=K("packages/modules/charts/stream.js"),At=Nt.drawMarimekko,zt=Nt.drawStream,Tt=Nt.drawViolin,P=K("packages/modules/charts/gantt.js").drawGantt,fe=K("packages/modules/charts/svg.js"),de=fe.attrs,ge=fe.append,Se=fe.clear,ce=fe.el,ke=fe.round,Pe=fe.setText,Ne=fe.svg,Ce=K("packages/modules/charts/styles.js"),je=Ce.NS,ze=Ce.injectStyles,De=K("packages/modules/charts/scheme.js"),Ge=De.resolveScheme,tt=K("packages/modules/charts/typography.js"),Ve=tt.applySize,Qe=tt.resolveType,st=tt.textWidth,rt=K("packages/modules/charts/labels.js"),Ze=rt.collides,nt=rt.resolveLabels,at=K("packages/modules/charts/interaction.js"),ft=at.applySelection,lt=at.attachBrush,jt=at.attachKeyboard,Lt=at.brushCondition,Gt=at.brushed,Rt=at.resolveBrush,St=K("packages/modules/charts/dense.js"),Zt=St.downsample,Bt=St.markCount,Ut=St.wantsCanvas,_t=K("packages/modules/charts/range.js").deriveRangeSpec,Et=K("packages/modules/charts/regression.js").regressionPlots,Ct=K("packages/modules/charts/registry.js"),Dt=Ct.chartTypeDef,Qt=Ct.registeredChartTypes,qe=Ct.registerChartType,it=$.linearScale,mt=$.bandScale,gt=$.extent,xt=$.toNumber,Ht=$.isNumber,hn=$.niceDomain,dn=$.linearTicks,mn=$.timeScale,gn=$.toTime,pn=$.niceStep,bn=U.colourRamp,yn=fe.path,wn=fe.attr,Wt=K("packages/core/src/internal/util.js").warnOnce,kn=M.drawMeasureAxis,xn=M.drawCategoryAxis,An=M.drawAxisLines,Sn=M.drawContinuousAxis,Mn=M.drawBandLabels,vn=M.tickValues,Nn=g.density,jn=g.valuesByCategory,Pn=g.summarise,On=g.quantile,$n=g.histogram,Tn=_.formatters;Object.defineProperty(s,"registerScheme",{enumerable:!0,get:function(){return De.registerScheme}}),Object.defineProperty(s,"resolveScheme",{enumerable:!0,get:function(){return De.resolveScheme}}),Object.defineProperty(s,"schemeNames",{enumerable:!0,get:function(){return De.schemeNames}}),Object.defineProperty(s,"setDefaultScheme",{enumerable:!0,get:function(){return De.setDefaultScheme}}),Object.defineProperty(s,"SCHEMES",{enumerable:!0,get:function(){return De.SCHEMES}}),Object.defineProperty(s,"PALETTE",{enumerable:!0,get:function(){return De.PALETTE}}),Object.defineProperty(s,"registerChartType",{enumerable:!0,get:function(){return Ct.registerChartType}}),Object.defineProperty(s,"registeredChartTypes",{enumerable:!0,get:function(){return Ct.registeredChartTypes}});const _n=Object.freeze({el:ce,svg:Ne,attr:wn,attrs:de,append:ge,clear:Se,path:yn,round:ke,setText:Pe,Pool:ie,plotRect:I,linearScale:it,bandScale:mt,sqrtScale:D,extent:gt,measureDomain:r,niceDomain:hn,linearTicks:dn,timeScale:mn,toTime:gn,niceStep:pn,toNumber:xt,isNumber:Ht,key:me,drawMeasureAxis:kn,drawCategoryAxis:xn,drawAxisLines:An,drawContinuousAxis:Sn,drawBandLabels:Mn,tickValues:vn,formatters:Tn,resolveScheme:Ge,colourRamp:bn,density:Nn,valuesByCategory:jn,summarise:Pn,quantile:On,histogram:$n,resolvePack:$e,packRegions:xe,fitted:Ie,resolveProjection:He,splitAntimeridian:We,projectedPath:_e,textWidth:st,applySize:Ve,collides:Ze,NS:je}),Vt=Object.freeze(["line","step","area","rangeArea","bar","horizontalBar","waterfall","scatter","bubble","forest","combo","pareto","histogram","boxplot","heatmap","qq","ecdf","lorenz","correlogram","control","capability","movingRange","pie","donut","sunburst","treemap","radar","gauge","funnel","candlestick","geomap","sankey","chord","network","stream","marimekko","violin","gantt"]),Xt=new Set(["bar","column","line","area","scatter","bubble","combo","pareto","histogram","heatmap","pie","donut","sunburst","treemap","radar","geomap"]),Cn=new Set(["pie","donut","sunburst"]),En=new Set(["pie","donut","sunburst","treemap"]),qt=20,Ln=new Set(["histogram","boxplot","qq","ecdf","lorenz","control","capability","movingRange"]),Rn=new Set(["histogram","boxplot","qq","ecdf","lorenz","violin"]);function zn(Ye){const L=Ye.y||(Array.isArray(Ye.measures)&&Ye.measures.length?Ye.measures[0]:null);if(!L)return Ye;const H=typeof L=="string"?L:L.col;if(!H)return Ye;const ae=typeof L=="object"&&L.fn!=null?L.fn:"median";return{...Ye,y:{col:H,fn:ae}}}const Fn=new Set(["combo","candlestick"]),en=new Set(["bar","line","step","area","scatter","bubble"]),In=new Set(["sankey","chord","network"]),Dn=new Set(["gantt"]),Gn=new Set(["radar","gauge","funnel","heatmap","geomap","sankey","chord","network"]),Mt=Object.freeze({width:480,height:300}),tn=Object.freeze(["00000"]),nn=new Set(["horizontalBar","forest"]);function on(Ye,L,H,ae){return Ye==="correlogram"?(Array.isArray(ae.columns)?ae.columns:[]).map(re=>he(H,re)):Ye==="heatmap"?(L.series||[]).map(Me=>Me.label):Ye==="gantt"?(L.rows||[]).map(Me=>ae.label?H.rows.text(Me.key,ae.label):String(Me.key)):nn.has(Ye)?L.labels||[]:tn}const Bn=1e3,Un=50;let Kn=0;function Hn(Ye){const L=Ye/1e3;return`${L>=10?Math.round(L):Math.round(L*10)/10}s`}function rn(Ye){return`${Ye/1e3}s`}function Pt(Ye){return Ye&&Ye.defaultView||globalThis}function Wn(Ye,L){return L?typeof L=="string"?Ye.querySelector(L):L:null}function Vn(Ye,L,H){const ae=["fill","fill-opacity","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linejoin","stroke-linecap","font-size","font-family","font-weight","opacity","text-anchor","dominant-baseline","visibility"],Me=[Ye,...Ye.querySelectorAll("*")],re=[L,...L.querySelectorAll("*")];for(let Le=0;Le<Me.length&&Le<re.length;Le++){const Re=H.getComputedStyle(Me[Le]),Ee=[];for(const Fe of ae){const Ue=Re.getPropertyValue(Fe);Ue&&Ee.push(`${Fe}:${Ue}`)}Ee.length&&re[Le].setAttribute("style",Ee.join(";"))}}function Yn(Ye,L){let H=Ye.root;const ae=[];for(const Me of L){const re=(H.children||[]).find(Le=>Le.label===Me);if(!re||!re.children||!re.children.length)break;H=re,ae.push(Me)}return ae.length?{...Ye,root:H,path:ae,empty:!H.children.length}:Ye}function Zn(Ye,L,H){return Ye&&Ye.plot?Ye.plot:{left:0,top:0,right:L,bottom:H,width:L,height:H,gutter:{left:0,bottom:0,right:0,top:0}}}class sn{#l=++Kn;#n;#c;#e;#i;#f=null;#o=null;#a=null;#p=null;#d=null;#F=!1;#w=null;#k=null;#b=[];#h=new Set;#t=null;#m={zoom:1,offset:[0,0]};#y=null;#x=null;#I=!1;#D=!1;#r=null;#_=0;#v=null;#O=null;#G=!1;#A=!1;#S=new Map;#N=Ge();#C=Qe();#ye=null;#u=null;#g=null;#M=null;#E=0;constructor(L){this.#n=L.grid,this.#c=L.container,this.#e=L.spec,this.#i=L.container.ownerDocument,this.#Q(),this.#X(),this.draw()}#Q(){ze(this.#i);const L=this.#i;this.#f=ce(L,"div",je);const H=ce(L,"figure",`${je}__figure`);if(this.#e.title||this.#e.subtitle){const ae=ce(L,"figcaption",`${je}__caption`);if(this.#e.title){const Me=ce(L,"div",`${je}__title`);Pe(Me,this.#e.title),ae.appendChild(Me)}if(this.#e.subtitle){const Me=ce(L,"div",`${je}__subtitle`);Pe(Me,this.#e.subtitle),ae.appendChild(Me)}H.appendChild(ae)}if(this.#o=Ne(L,"svg",{class:`${je}__plot`,preserveAspectRatio:"xMidYMid meet",role:"img"}),this.#a=k(L,this.#o),H.appendChild(this.#o),this.#k=ce(L,"div",`${je}__empty`),this.#k.setAttribute("hidden",""),H.appendChild(this.#k),this.#w=ce(L,"div",`${je}__table`),H.appendChild(this.#w),this.#p=ce(L,"div",`${je}__legend`),H.appendChild(this.#p),this.#e.footnote){const ae=ce(L,"div",`${je}__footnote`);Pe(ae,this.#e.footnote),H.appendChild(ae)}this.#x=ce(L,"div",`${je}__attribution`),this.#x.setAttribute("hidden",""),H.appendChild(this.#x),this.#d=ce(L,"div",`${je}__tooltip`),this.#d.setAttribute("hidden",""),this.#f.appendChild(H),this.#f.appendChild(this.#d),this.#c.appendChild(this.#f),this.#q()}#X(){const L=["model:changed","rows:changed","filter:changed","sort:changed","column:grouped","column:pivoted","cell:changed","timeline:seek","timeline:attached","timeline:detached"];this.#e.selection&&this.#b.push(this.#n.on("selection:changed",()=>this.#V()));for(const ae of L)this.#b.push(this.#n.on(ae,()=>this.schedule()));const H=Pt(this.#i);H&&typeof H.ResizeObserver=="function"&&(this.#O=this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():null,this.#v=new H.ResizeObserver(()=>{if(!this.#G){this.#G=!0;const ae=this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():null;if(ae&&this.#O&&Math.round(ae.width)===Math.round(this.#O.width)&&Math.round(ae.height)===Math.round(this.#O.height))return}this.schedule()}),this.#v.observe(this.#c))}#B(){const L=this.#o&&this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():null;return L&&L.width>0&&L.height>0?L:this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():Mt}#q(){const L=Ee=>{this.#y||this.#te(Ee)},H=()=>this.#j();this.#o.addEventListener("pointermove",L),this.#o.addEventListener("pointerleave",H),this.#o.addEventListener("click",Ee=>this.#W(Ee));const ae=Ee=>{!this.#t||!this.#t.packed||(this.#y={x:Ee.clientX||0,y:Ee.clientY||0})},Me=Ee=>{if(!this.#y)return;const Fe=Ee.clientX||0,Ue=Ee.clientY||0;this.#P(Fe-this.#y.x,Ue-this.#y.y),this.#y={x:Fe,y:Ue}},re=()=>{this.#y=null},Le=Ee=>{!this.#t||!this.#t.packed||(Ee.preventDefault&&Ee.preventDefault(),this.#R(Ee.deltaY<0?1.15:1/1.15))},Re=Ee=>{if(!this.#t||!this.#t.packed)return;const Fe=40;if(Ee.shiftKey&&Ee.key==="ArrowLeft")this.#P(-Fe,0);else if(Ee.shiftKey&&Ee.key==="ArrowRight")this.#P(Fe,0);else if(Ee.shiftKey&&Ee.key==="ArrowUp")this.#P(0,-Fe);else if(Ee.shiftKey&&Ee.key==="ArrowDown")this.#P(0,Fe);else if(Ee.key==="+"||Ee.key==="=")this.#R(1.25);else if(Ee.key==="-"||Ee.key==="_")this.#R(1/1.25);else if(Ee.key==="0")this.#le();else return;Ee.preventDefault&&Ee.preventDefault()};this.#o.addEventListener("pointerdown",ae),this.#o.addEventListener("pointermove",Me),this.#o.addEventListener("pointerup",re),this.#o.addEventListener("pointerleave",re),this.#o.addEventListener("wheel",Le,{passive:!1}),this.#o.addEventListener("keydown",Re),this.#b.push(lt({svg:this.#o,overlay:this.#a.overlay,plot:()=>this.#t&&this.#t.plot||{left:0,top:0,right:0,bottom:0,height:0},pointOf:Ee=>this.#$(Ee),axis:()=>Rt(this.#e).axis,horizontal:()=>!!(this.#t&&this.#t.horizontal),enabled:()=>!!Rt(this.#e).mode&&!!(this.#t&&this.#t.xScale),onBrush:(Ee,Fe)=>this.#ie(Ee,Fe)})),this.#o.setAttribute("tabindex","0"),this.#b.push(jt({svg:this.#o,marks:()=>[...this.#a.marks.childNodes||[]].filter(Ee=>Ee.setAttribute),onFocus:Ee=>this.#se(Ee),onActivate:Ee=>this.#ae(Ee)})),this.#b.push(()=>{this.#o.removeEventListener("pointermove",L),this.#o.removeEventListener("pointerleave",H),this.#o.removeEventListener("pointerdown",ae),this.#o.removeEventListener("pointermove",Me),this.#o.removeEventListener("pointerup",re),this.#o.removeEventListener("pointerleave",re),this.#o.removeEventListener("wheel",Le),this.#o.removeEventListener("keydown",Re)})}#$(L){const H=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():{left:0,top:0,width:Mt.width,height:Mt.height};return{x:(L.clientX||0)-H.left,y:(L.clientY||0)-H.top}}#ee(L){return Q({bound:{categories:this.#T().categories},xScale:this.#t.xScale,at:this.#t.horizontal?L.y:L.x})}#T(){const L=this.#t;return L&&Array.isArray(L.labels)&&Array.isArray(L.categories)?{labels:L.labels,categories:L.categories}:{labels:this.#r&&this.#r.labels||[],categories:this.#r&&this.#r.categories||[]}}#U(L){if(!this.#t||!Array.isArray(this.#t.series))return null;if(this.#t.reduced)return G({series:this.#t.series,xScale:this.#t.xScale,at:this.#t.horizontal?L.y:L.x});const H=this.#ee(L);return H<0?null:{index:H,entries:this.#t.series.map(ae=>({series:ae,point:ae.points[H]})).filter(ae=>ae.point&&ae.point.y!==null)}}#L(L){return f({drawn:this.#t,bound:this.#r,spec:this.#e,grid:this.#n,scheme:this.#N,at:L})}#te(L){if(!this.#t||!this.#r||this.#e.tooltip===!1)return;const H=this.#$(L),ae=[];let Me="";const re=this.#L(H);if(re){this.#K(re.heading,re.rows,L),this.emit("hover",{...re.datum,native:L});return}if(N(this.#t)){this.#j();return}if(this.#t.arcs){const Re=y({arcs:this.#t.arcs,x:H.x,y:H.y});if(!Re){this.#j();return}Me=Re.label;const Ee=this.#r.root.total>0?Re.total/this.#r.root.total:0;ae.push({label:this.#r.measure.title,value:`${e(Re.total,this.#n.messages)} (${this.#n.messages.number(Ee,{style:"percent",maximumFractionDigits:1})})`,colour:this.#N.series(Re.index)})}else{const Re=this.#U(H);if(!Re){this.#j();return}Me=this.#T().labels[Re.index]||"";for(const Ee of Re.entries)ae.push({label:Ee.series.label,value:e(Ee.point.y,this.#n.messages),colour:this.#N.series(Ee.series.index)})}if(!ae.length){this.#j();return}this.#K(Me,ae,L);const Le=this.#H(H);Le&&this.emit("hover",{...Le,native:L})}#K(L,H,ae){const Me=this.#i;if(Se(this.#d),L){const re=ce(Me,"div",`${je}__tooltip-row`),Le=ce(Me,"strong");Pe(Le,L),re.appendChild(Le),this.#d.appendChild(re)}for(const re of H){const Le=ce(Me,"div",`${je}__tooltip-row`),Re=ce(Me,"span",`${je}__swatch`);Re.setAttribute("style",`background:${re.colour}`);const Ee=ce(Me,"span");Pe(Ee,re.label);const Fe=ce(Me,"span",`${je}__tooltip-value`);Pe(Fe,re.value),ge(Le,[Re,Ee,Fe]),this.#d.appendChild(Le)}this.#d.removeAttribute("hidden"),this.#ne(ae)}#ne(L){if(!this.#F&&(this.#F=!0,this.#oe())){const ct=this.#i&&this.#i.body;ct&&typeof ct.appendChild=="function"&&ct.appendChild(this.#d)}const H=Pt(this.#i),ae=12,Me=L&&L.clientX||0,re=L&&L.clientY||0,Le=typeof this.#d.getBoundingClientRect=="function"?this.#d.getBoundingClientRect():{width:0,height:0},Re=H.innerWidth||0,Ee=H.innerHeight||0;let Fe=Me+ae;Re&&Fe+Le.width>Re-ae&&(Fe=Me-ae-Le.width),Fe=Math.max(ae,Fe);let Ue=re+ae;Ee&&Ue+Le.height>Ee-ae&&(Ue=re-ae-Le.height),Ue=Math.max(ae,Ue),this.#d.style.left=`${Math.round(Fe)}px`,this.#d.style.top=`${Math.round(Ue)}px`}#oe(){const L=Pt(this.#i);if(typeof L.getComputedStyle!="function")return!1;let H=this.#f&&this.#f.parentNode;for(;H;){if(H.nodeType===11&&H.host){H=H.host;continue}if(H.nodeType!==1)break;const ae=L.getComputedStyle(H);if(ae&&(ae.transform&&ae.transform!=="none"||ae.perspective&&ae.perspective!=="none"||ae.filter&&ae.filter!=="none"||ae.backdropFilter&&ae.backdropFilter!=="none"||ae.contain&&/layout|paint|strict|content/.test(ae.contain)))return!0;H=H.parentNode}return!1}#j(){this.#d&&this.#d.setAttribute("hidden",""),this.emit("leave",{})}#H(L){if(!this.#t||!this.#r)return null;const H=this.#L(L);if(H)return H.datum;if(N(this.#t))return null;if(this.#t.arcs){const Re=y({arcs:this.#t.arcs,x:L.x,y:L.y});return Re?{label:Re.label,value:Re.total,category:Re.node.value,column:this.#e.x||null,series:null,depth:Re.depth,path:Array.isArray(Re.path)?[...Re.path]:[Re.label],rowKeys:Re.node.rowKey?[Re.node.rowKey]:[]}:null}const ae=this.#U(L);if(!ae)return null;const Me=ae.entries,re=this.#T(),Le=Me.length===1&&Me[0].point.from!==void 0?{from:Me[0].point.from,to:Me[0].point.to}:null;return{label:re.labels[ae.index]||"",category:re.categories[ae.index],column:this.#r.dimension.col,value:Me.length===1?Me[0].point.y:null,...Le||{},series:Me.map(Re=>({key:Re.series.key,label:Re.series.label,value:Re.point.y,rows:Re.point.rows})),rowKeys:Me.map(Re=>Re.point.rowKey).filter(Boolean)}}#W(L){if(!this.#t||!this.#r)return;const H=this.#H(this.#$(L));if(!H)return;let ae=!1;const Me=this.emit("click",{...H,native:L,preventDefault(){ae=!0}});if(!(ae||Me.defaultPrevented)){if(this.#e.drill&&this.#r&&this.#r.root&&H.label){const re=Array.isArray(H.path)&&H.path.length?H.path:[H.label];this.#u=[...this.#u||[],...re],this.emit("drill",{path:[...this.#u],label:H.label}),this.draw();return}if(this.#e.selection&&Array.isArray(this.#t.markers)&&Array.isArray(H.rowKeys)&&H.rowKeys.length){this.#n.selection.set([...H.rowKeys]);return}if(this.#e.selection&&this.#e.type==="network"&&Array.isArray(H.rowKeys)&&H.rowKeys.length){this.#n.selection.set([...new Set(H.rowKeys)]);return}!this.#e.filterOnClick||!H.column||this.#n.filters.set({col:H.column,op:"eq",value:H.category})}}#V(){if(!this.#t)return;if(Array.isArray(this.#t.markers)){this.#re();return}if(Array.isArray(this.#t.links)&&Array.isArray(this.#t.nodes)&&!this.#t.series){vt({drawn:this.#t,keys:new Set(this.#n.selection.keys())});return}if(!this.#t.series)return;const L=this.#n.selection.keys(),H=this.#r&&this.#r.dimension&&this.#r.dimension.col,ae=new Set;if(H)for(const Me of L)ae.add(me(this.#n.rows.value(Me,H)));ft({groups:this.#a,series:this.#t.series,keys:new Set(L),categories:ae})}#re(){const L=new Set(this.#n.selection.keys());for(const H of this.#t.markers){const ae=H.element;!ae||!ae.setAttribute||(L.size&&!L.has(H.rowKey)?ae.setAttribute("data-dim","true"):ae.removeAttribute("data-dim"))}}#ie(L,H){const ae=Rt(this.#e),Me=ae.mode;if(!Me||!this.#t||!this.#t.xScale||!this.#r)return;const re=Gt({bound:this.#r,xScale:this.#t.xScale,yScale:this.#t.yScale,rightScale:this.#t.rightScale||null,axis:ae.axis,from:L,to:H});let Le=!1;const Re=this.emit("brush",{mode:Me,kind:re.kind,values:re.values,range:re.range,axis:re.axis,column:re.axis==="y"||re.axis==="y2"?this.#r.measure&&this.#r.measure.col||null:this.#r.dimension.col,preventDefault(){Le=!0}});if(Le||Re.defaultPrevented)return;if(Me==="zoom"){if(re.range){const Fe=re.axis==="y2"?"y2":re.axis==="y"?"y":"x";this.#e={...this.#e,axis:{...this.#e.axis||{},[Fe]:{...(this.#e.axis||{})[Fe]||{},min:Math.min(re.range[0],re.range[1]),max:Math.max(re.range[0],re.range[1])}}},this.draw()}return}if(Me==="select"){const Fe=[];for(const Ue of this.#t.series||[])for(const ct of Ue.points){if(!ct.rowKey)continue;(re.kind!=="set"||re.values.some(Be=>me(Be)===ct.xKey))&&Fe.push(ct.rowKey)}this.#n.selection.set([...new Set(Fe)]);return}const Ee=Lt({column:this.#r.dimension.col,result:re,kind:this.#r.kind});Ee&&this.#n.filters.set(Ee)}#se(L){const H=(this.#a.marks.childNodes||[])[L];if(!H||!H.setAttribute)return;const ae=this.#t&&this.#t.series?this.#t.series[Number(H.getAttribute("data-series"))||0]:null,Me=ae&&ae.points[Number(H.getAttribute("data-point"))||0];if(!Me){if(!H.getBoundingClientRect)return;const re=H.getBoundingClientRect(),Le=this.#L(this.#$({clientX:re.left+re.width/2,clientY:re.top+re.height/2}));if(!Le)return;H.setAttribute("role","img"),H.setAttribute("aria-label",`${Le.heading}: ${Le.rows.map(Re=>Re.value).filter(Boolean).join(", ")}`),this.emit("focus",{label:Le.datum.label,value:Le.datum.value,index:L});return}H.setAttribute("role","img"),H.setAttribute("aria-label",`${Me.label}: ${e(Me.y,this.#n.messages)}`),this.emit("focus",{label:Me.label,value:Me.y,index:L})}#ae(L){const H=(this.#a.marks.childNodes||[])[L];if(!H||!H.getBoundingClientRect)return;const ae=H.getBoundingClientRect();this.#W({clientX:ae.left+ae.width/2,clientY:ae.top+ae.height/2})}#Y(L){const H=L&&L.attribution||"";H?(Pe(this.#x,H),this.#x.removeAttribute("hidden")):this.#x.setAttribute("hidden","");const ae=L&&Number.isFinite(L.aspect)&&L.aspect>0?L.aspect:null;this.#o&&this.#o.style&&(ae?this.#o.style.setProperty("aspect-ratio",String(ae)):this.#o.style.removeProperty("aspect-ratio"))}#le(){this.#m={zoom:1,offset:[0,0]},this.schedule()}#R(L){const H=this.#m.zoom*L;this.#m={...this.#m,zoom:Math.min(8,Math.max(1,H))},this.schedule()}#P(L,H){const ae=this.#t&&this.#t.scale||0;if(!ae)return;const[Me,re]=this.#m.offset;this.#m={...this.#m,offset:[Me-L/ae,re+H/ae]},this.schedule()}schedule(){if(this.#A||this.#_)return;const L=Pt(this.#i),H=typeof L.requestAnimationFrame=="function"?L.requestAnimationFrame.bind(L):ae=>setTimeout(ae,16);this.#_=H(()=>{this.#_=0,this.draw()})||1}draw(){if(this.#A)return;const L=this.#Z();if(!L)return;const H=this.#B(),ae=Math.round(H.width||Mt.width),Me=Math.round(H.height||Mt.height),re=ae!==L.width||Me!==L.height?this.#Z():L;re&&this.emit("draw",{chartType:re.chartType,categories:re.categories,empty:re.empty})}#Z(){const L=this.#B(),H=Math.round(L.width||Mt.width),ae=Math.round(L.height||Mt.height),Me=Vt.includes(this.#e.type)?null:Dt(this.#e.type),re=Vt.includes(this.#e.type)||Me?this.#e.type:"bar";Array.isArray(this.#e.x)&&Wt(`chart:${this.#l}:x:array`,`chart "x" expects one column id (a string) and was given an array [${this.#e.x.map(et=>JSON.stringify(et)).join(", ")}]. A chart takes one category column on "x". For a hierarchy, group the grid — grid.columns.group([...]) — and the hierarchical types (pie, donut, sunburst, treemap) read the grouping.`);const Le=Ge(this.#e);this.#N=Le;const Re=J(this.#e.axis),Ee=this.#n.messages,Fe=Qe(this.#e);this.#C=Fe;const Ue=Fe.small,ct=nt(this.#e);if(ct.show&&!Xt.has(re)&&!(Me&&Me.labelled)&&!this.#I){this.#I=!0;const et=this.#i&&this.#i.defaultView,Ke=et&&et.console||(typeof globalThis<"u"?globalThis.console:null);Ke&&typeof Ke.warn=="function"&&Ke.warn(`[lattice] a "${re}" chart does not draw data labels; "labels" has no effect on it. Types that do: ${[...Xt].join(", ")}.`)}de(this.#o,{viewBox:`0 0 ${H} ${ae}`,width:H,height:ae});const kt=En.has(re)||!!(Me&&Me.hierarchical);let Be;if(Me&&typeof Me.bind=="function")Be=Me.bind(this.#n,this.#e);else if(kt)Be=ne(this.#n,this.#e),this.#u&&this.#u.length&&(Be=Yn(Be,this.#u));else if(Fn.has(re))Be=X(this.#n,this.#e);else if(en.has(re)&&Array.isArray(this.#e.measures)&&this.#e.measures.length)Be=X(this.#n,this.#e);else if(In.has(re))Be=v(this.#n,this.#e,re==="network"?{perRow:!0,nodes:this.#e.nodes}:void 0);else if(Dn.has(re)){const et=C(this.#n);Be={rows:et,series:[],categories:[],labels:[],measure:{col:null,fn:"sum",title:""},dimension:{col:this.#e.label||null,title:""},empty:!et.length}}else re==="geomap"?Be=ee(this.#n,{...this.#e,x:this.#e.code||this.#e.x}):Array.isArray(this.#e.points)?Be=oe(this.#e):Rn.has(re)?Be=ee(this.#n,zn(this.#e)):Be=ee(this.#n,this.#e);const Ot=Date.now();this.#r=Be;const $t=W(Be,Re&&Re.x,re,Ot);if($t){const et=typeof this.#e.x=="string"?` "${this.#e.x}"`:"",Ke=`${Math.round(te*1e3)/10}%`;Wt(`chart:${this.#l}:x:window:ahead`,`${$t.count} reading(s) on the x axis${et} were not drawn: stamped up to ${Hn($t.lead)} ahead of this device's clock, which is more than the ${rn($t.limit)} (${Ke} of the ${rn($t.span)} rolling window) a reading may run ahead and still move the window. This is a producer whose clock is wrong, not a window that is too narrow: letting that reading carry the window would push every other producer's recent readings out of it, so it is left out instead. Correct the producer's clock (NTP), or stamp readings where they are received.`)}const pt=Y({grid:this.#n,spec:this.#e,type:re,bound:Be,axis:Re,now:Ot,id:this.#l});if(!pt.ok)return pt.tell&&Wt(pt.key,pt.message),this.#de(this.#e.emptyText||Ee.t("chart.empty")),null;if(Be=j(Be,Re&&Re.x,re,Ot),this.#r=Be,this.#k.setAttribute("hidden",""),this.#o.removeAttribute("hidden"),Z(this.#a,null),Me){const et=Me.freeform?I({width:H,height:ae,fontSize:Ue,margin:this.#e.margin}):I({width:H,height:ae,fontSize:Ue,margin:this.#e.margin,titleSize:Fe.axisTitle,titles:{left:Re.y.title,bottom:Re.x.title,right:Re.y2.title},yLabels:tn,xLabels:Be.labels,rotated:!0});this.#t=Me.draw({doc:this.#i,groups:this.#a,plot:et,bound:Be,type:re,grid:this.#n,fontSize:Ue,hidden:this.#h,scheme:Le,axis:Re,typography:Fe,labels:ct,spec:this.#e,geoView:{zoom:this.#m.zoom,offset:this.#m.offset},helpers:_n})||{},this.#s(Array.isArray(this.#t.legend)?this.#t.legend:[])}else if(re==="treemap"){const et=I({width:H,height:ae,fontSize:Ue,padding:2,margin:this.#e.margin});this.#t=p({scheme:Le,groups:this.#a,plot:et,tree:Be,grid:this.#n,hidden:this.#h,fontSize:Ue,typography:Fe,labels:ct}),this.#s(Be.root.children.map((Ke,Xe)=>({key:Ke.label,label:Ke.label,index:Xe})))}else if(Cn.has(re)){const et=I({width:H,height:ae,fontSize:Ue});this.#t=t({scheme:Le,doc:this.#i,groups:this.#a,plot:et,tree:Be,type:re,grid:this.#n,hidden:this.#h,fontSize:Ue,typography:Fe,labels:ct}),this.#s(Be.root.children.map((Ke,Xe)=>({key:Ke.label,label:Ke.label,index:Xe})))}else{const et=Gn.has(re)?I({width:H,height:ae,fontSize:Ue,margin:this.#e.margin,yLabels:re==="heatmap"?on(re,Be,this.#n,this.#e):[],xLabels:re==="heatmap"?Be.labels:[],rotated:!0}):I({width:H,height:ae,fontSize:Ue,margin:this.#e.margin,titleSize:Fe.axisTitle,titles:pe[re]&&pe[re].horizontal?{left:Re.x.title,bottom:Re.y.title,right:Re.y2.title}:{left:Re.y.title,bottom:Re.x.title,right:Re.y2.title},rightGutter:this.#fe(re,Be)?Math.round(Ue*3):0,yLabels:on(re,Be,this.#n,this.#e),xLabels:nn.has(re)?[]:Be.labels,rotated:!0}),Ke={doc:this.#i,groups:this.#a,plot:et,bound:Be,type:re,grid:this.#n,fontSize:Ue,hidden:this.#h,scheme:Le,axis:Re,typography:Fe,labels:ct};if(re!=="geomap"&&this.#Y(null),this.#e.multiples)this.#t=this.#ue(Ke),this.#s([]);else if(re==="combo"||re==="pareto")this.#t=o({...Ke,pareto:re==="pareto",reference:this.#e.reference,annotations:this.#e.annotations}),this.#s(this.#t.series.map(Xe=>({key:Xe.key,label:Xe.label,index:Xe.index})));else if(re==="heatmap")this.#t=le({...Ke,diverging:this.#e.diverging}),this.#s([]);else if(re==="radar")this.#t=z(Ke),this.#s(Be.series.map(Xe=>({key:Xe.key,label:Xe.label,index:Xe.index})));else if(re==="gauge")this.#t=B({...Ke,min:this.#e.min,max:this.#e.max,target:this.#e.target}),this.#s([]);else if(re==="sankey")this.#t=ut(Ke),this.#s([]);else if(re==="chord")this.#t=dt(Ke),this.#s([]);else if(re==="network")this.#t=wt({...Ke,iterations:this.#e.iterations,icon:this.#e.icon,linkWidth:this.#e.linkWidth}),this.#s(Array.isArray(this.#t.legend)?this.#t.legend:[]);else if(re==="stream")this.#t=zt(Ke),this.#s(Be.series.map(Xe=>({key:Xe.key,label:Xe.label,index:Xe.index})));else if(re==="marimekko")this.#t=At(Ke),this.#s(Be.series.map(Xe=>({key:Xe.key,label:Xe.label,index:Xe.index})));else if(re==="violin")this.#t=Tt(Ke),this.#s([]);else if(re==="gantt")this.#t=P({...Ke,spec:this.#e,rows:Be.rows||[]}),this.#s([]);else if(re==="geomap")this.#t=Te({...Ke,shapes:this.#e.shapes,codeProperty:this.#e.codeProperty,diverging:this.#e.diverging,projection:this.#e.projection,projectionOptions:this.#e.projectionOptions,layer:this.#e.layer,graticule:this.#e.graticule,zoom:this.#m.zoom,centreOffset:this.#m.offset}),this.#s([]),this.#Y(this.#t);else if(re==="correlogram")this.#t=se({...Ke,columns:this.#ge(),method:this.#e.method,values:this.#e.values}),this.#s([]);else if(re==="forest")this.#t=V(Ke),this.#s([]);else if(re==="funnel")this.#t=T(Ke),this.#s([]);else if(re==="candlestick")this.#t=q(Ke),this.#s([]);else if(Ln.has(re)){if(re==="histogram")this.#t=u({...Ke,buckets:this.#e.buckets,curve:this.#e.curve});else if(re==="movingRange")this.#t=n(Ke);else if(re==="control"||re==="capability"){const Xe=this.#e.y||this.#e.measure,Kt=this.#n&&this.#n.statistics;this.#t=(re==="capability"?b:O)({...Ke,capability:Kt&&Xe?Kt.capability(Xe,{by:this.#e.x,baseline:this.#e.baseline,rules:this.#e.rules,confidence:this.#e.confidence,...this.#e.spec||{}}):null})}else re==="qq"?this.#t=d(Ke):re==="ecdf"?this.#t=l(Ke):re==="lorenz"?this.#t=x(Ke):this.#t=m(Ke);this.#s([])}else this.#t=ue({...Ke,fit:this.#e.fit,trend:this.#e.trend,band:this.#e.band,error:this.#e.error,dense:Ut({series:Be.series,canvas:this.#e.canvas}),downsampleTo:this.#e.downsample,stack:this.#e.stack,reference:this.#e.reference,annotations:this.#e.annotations,sizes:this.#he(Be)}),this.#s(Be.series.length>1?Be.series.map(Xe=>({key:Xe.key,label:Xe.label,index:Xe.index})):[])}const ht=this.#t&&this.#t.errorBars;if(this.#e.error&&ht&&ht.marks&&!this.#D&&(!ht.drawn||ht.singleSkipped)){this.#D=!0;const et=this.#i&&this.#i.defaultView,Ke=et&&et.console||(typeof globalThis<"u"?globalThis.console:null);if(Ke&&typeof Ke.warn=="function"){let Xe;ht.drawn?Xe=`[lattice] error bars were requested but ${ht.singleSkipped} of ${ht.marks} marks have a single reading behind them, so their whiskers were not drawn; the other marks are shown. A bar with no whisker is easily read as the certain one: bind those categories to the readings they summarise, or supply a margin column with \`error: { of: "column" }\`.`:Xe=ht.single===ht.marks?'[lattice] error bars were requested but every mark has a single reading behind it, so there is no spread to compute. A chart bound to a summary or derived grid sees one row per mark: bind it to the rows the summary was computed from, or supply a margin column with `error: { of: "column" }`.':"[lattice] error bars were requested but no mark had enough readings to compute an interval.",Ke.warn(Xe)}}return this.#t&&(this.#t.plot=this.#t.plot||Zn(this.#t,H,ae)),this.#r&&(this.#r.outside=this.#t&&this.#t.outside||0),this.#e.selection&&this.#V(),this.#J(),this.#be(re,Be,kt),this.#ce(Re),{width:H,height:ae,chartType:re,categories:Be.categories||[],empty:!!Be.empty}}#ce(L){const H=S(L&&L.x),ae=H?Math.min(Bn,Math.max(Un,Math.floor(H/4))):0;if(this.#A||!ae){this.#z();return}if(this.#M&&this.#E===ae)return;this.#z(),this.#E=ae;const Me=Pt(this.#i),re=Me&&typeof Me.setInterval=="function"?Me.setInterval.bind(Me):setInterval;this.#M=re(()=>{this.#A||this.#i&&this.#i.hidden||this.#f&&this.#f.isConnected===!1||this.schedule()},ae);const Le=this.#M;Le&&typeof Le.unref=="function"&&Le.unref()}#z(){if(this.#M===null)return;const L=Pt(this.#i);(L&&typeof L.clearInterval=="function"?L.clearInterval.bind(L):clearInterval)(this.#M),this.#M=null,this.#E=0}#ue(L){const H=ye(L.bound),ae=we({count:H.length,plot:L.plot}),Me=[];for(const Fe of L.bound.series)for(const Ue of Fe.points)Me.push(Ue.y);const re=r(Me,{zero:L.type!=="line"}),Le=new ie(this.#a.overlay);Z(this.#a,L.plot);const Re=new ie(this.#a.marks);new ie(this.#a.grid).finish(),new ie(this.#a.axis).finish(),new ie(this.#a.rules).finish();let Ee=null;for(let Fe=0;Fe<ae.length;Fe++){const Ue=ae[Fe],ct=H[Fe],kt={left:Ue.x,top:Ue.y,width:Ue.width,height:Ue.height,right:Ue.x+Ue.width,bottom:Ue.y+Ue.height,gutter:{left:0,bottom:0}};Ee=ue({...L,plot:kt,bound:ct.bound,domain:re,pool:Re,axes:!1});const Be=Le.next("text",`${je}__panel-title`);de(Be,{x:ke(Ue.x),y:ke(Ue.y-4),"text-anchor":"start"}),Pe(Be,ct.label)}return Re.finish(),Le.finish(),{...Ee||{},panels:ae,multiples:!0}}#fe(L,H){return L==="combo"||L==="pareto"?!0:!en.has(L)||L==="horizontalBar"||L==="waterfall"?!1:!!(H&&Array.isArray(H.series)&&H.series.some(ae=>ae.axis==="right"&&!this.#h.has(ae.key)))}#he(L){if(this.#e.type!=="bubble"||!this.#e.size)return null;const H=[];for(const Me of L.series||[])for(const re of Me.points)typeof re.size=="number"&&H.push(re.size);const ae=gt(H);return ae?D(ae,[3,Math.max(6,Math.min(28,this.#e.maxRadius||22))]):null}#de(L){this.#J(),Pe(this.#k,L),this.#k.removeAttribute("hidden"),this.#o.setAttribute("hidden","");for(const H of Object.values(this.#a))Se(H);Se(this.#p),Se(this.#w),this.#t=null}#J(){const L=this.#n.licence;if(!!!(L&&typeof L.watermark=="function"&&L.watermark())){this.#g&&this.#g.parentNode&&this.#g.parentNode.removeChild(this.#g),this.#g=null;return}if(this.#g&&this.#g.parentNode)return;const ae=this.#i,Me=ce(ae,"div",`${je}__watermark`);Me.setAttribute("role","note");const re=ce(ae,"a",`${je}__watermark-link`);re.setAttribute("href","https://www.latticegrid.dev"),re.setAttribute("target","_blank"),re.setAttribute("rel","noopener noreferrer"),Pe(re,this.#n.messages.t("licence.watermark")),Me.appendChild(re),this.#g=Me,this.#f&&this.#f.appendChild(Me)}#me(){const L=this.#e.legend;if(L===!1)return{show:!1,position:"bottom",align:"start",shape:"square",maxItems:0,isolate:!1};const H=L&&typeof L=="object"?L:{};return{show:!0,position:["top","bottom","left","right"].includes(H.position)?H.position:"bottom",align:["start","centre","center","end"].includes(H.align)?H.align:"start",shape:["square","circle","line"].includes(H.shape)?H.shape:"square",maxItems:Number.isFinite(H.maxItems)&&H.maxItems>0?Number(H.maxItems):0,isolate:!!H.isolate}}#ge(){const L=this.#e.columns;if(Array.isArray(L)&&L.length)return L.slice(0,qt);const H=this.#n;return!H||!H.columns||typeof H.columns.visible!="function"?[]:H.columns.visible().filter(ae=>!ae.generated&&(ae.type==="number"||ae.type==="currency"||ae.type==="percent"||ae.type==="integer")).map(ae=>ae.id).slice(0,qt)}#s(L){Se(this.#p);const H=this.#me();if(de(this.#p,{"data-position":H.position,"data-align":H.align}),!L.length||!H.show)return;const ae=this.#i,Me=H.maxItems?L.slice(0,H.maxItems):L;for(const re of Me){const Le=ce(ae,"button",`${je}__legend-item`);Le.setAttribute("type","button");const Re=!this.#h.has(re.key);Le.setAttribute("aria-pressed",Re?"true":"false");const Ee=ce(ae,"span",`${je}__swatch ${je}__swatch--${H.shape}`);Ee.setAttribute("style",`background:${re.colour||this.#N.series(re.index)}`);const Fe=ce(ae,"span");Ve(Fe,this.#C.small),Pe(Fe,re.label),ge(Le,[Ee,Fe]),Le.addEventListener("click",()=>{this.#pe(re,L,H)}),this.#p.appendChild(Le)}if(H.maxItems&&L.length>Me.length){const re=ce(ae,"span",`${je}__legend-more`);Ve(re,this.#C.small),Pe(re,this.#n.messages.t("chart.legendMore",{count:L.length-Me.length})),this.#p.appendChild(re)}}#pe(L,H,ae){if(ae.isolate){const Me=H.filter(Le=>Le.key!==L.key),re=Me.every(Le=>this.#h.has(Le.key))&&!this.#h.has(L.key);if(this.#h.clear(),!re)for(const Le of Me)this.#h.add(Le.key)}else this.#h.has(L.key)?this.#h.delete(L.key):this.#h.add(L.key);this.emit("legend",{label:L.label,key:L.key,hidden:this.#h.has(L.key),hiddenKeys:[...this.#h]}),this.draw()}#be(L,H,ae){const Me=this.#n.messages,re=H.measure&&H.measure.title||"",Le=H.dimension&&H.dimension.title||"",Re=re?Le&&!ae?"chart.summary":"chart.summaryShare":"chart.summaryType",Ee=Me.t(Re,{type:Me.t(`chart.type.${L}`),measure:re,dimension:Le});de(this.#o,{"aria-label":Ee}),Se(this.#w);const Fe=this.#i,Ue=ce(Fe,"table"),ct=ce(Fe,"caption");Pe(ct,Me.t("chart.dataTable")),Ue.appendChild(ct);const kt=ce(Fe,"tr"),Be=ce(Fe,"th");Pe(Be,ae?"":Le),kt.appendChild(Be);const Ot=[];if(ae&&H.root){for(const ht of H.root.children){const et=ce(Fe,"tr"),Ke=ce(Fe,"th");Pe(Ke,ht.label);const Xe=ce(Fe,"td");Pe(Xe,e(ht.total,Me)),ge(et,[Ke,Xe]),Ot.push(et)}const pt=ce(Fe,"th");Pe(pt,re),kt.appendChild(pt)}else{const pt=this.#T(),ht=this.#t&&Array.isArray(this.#t.labels)&&Array.isArray(this.#t.series)&&Array.isArray(this.#t.categories)?this.#t.series:H.series||[];for(const et of ht){const Ke=ce(Fe,"th");Pe(Ke,et.label),kt.appendChild(Ke)}for(let et=0;et<(pt.labels||[]).length;et++){const Ke=ce(Fe,"tr"),Xe=ce(Fe,"th");Pe(Xe,pt.labels[et]),Ke.appendChild(Xe);for(const Kt of ht){const ln=ce(Fe,"td"),Yt=Kt.points[et];Pe(ln,Yt&&Yt.y!==null?e(Yt.y,Me):""),Ke.appendChild(ln)}Ot.push(Ke)}}Ue.appendChild(kt);for(const pt of Ot)Ue.appendChild(pt);this.#w.appendChild(Ue);const $t=this.#t&&this.#t.annotations;if(Array.isArray($t)&&$t.length){const pt=ce(Fe,"ul",`${je}__annotation-list`);for(const ht of $t){if(!ht||!ht.text)continue;const et=ce(Fe,"li");Pe(et,ht.text),pt.appendChild(et)}pt.childNodes&&pt.childNodes.length&&this.#w.appendChild(pt)}}on(L,H){return typeof H!="function"?()=>{}:(this.#S.has(L)||this.#S.set(L,new Set),this.#S.get(L).add(H),()=>{const ae=this.#S.get(L);ae&&ae.delete(H)})}emit(L,H){const ae={...H,type:L,chart:this,grid:this.#n},Me=this.#e[`on${L.charAt(0).toUpperCase()}${L.slice(1)}`],re=[...this.#S.get(L)||[]];typeof Me=="function"&&re.unshift(Me);for(const Le of re)try{Le(ae)}catch(Re){const Ee=Pt(this.#i);Ee.console&&typeof Ee.console.error=="function"&&Ee.console.error(`[lattice] a chart "${L}" listener threw`,Re)}return ae}data(){return this.#r}ascend(L){if(!this.#u||!this.#u.length)return[];const H=Number.isFinite(L)&&L>0?Number(L):this.#u.length;return this.#u=this.#u.slice(0,Math.max(0,this.#u.length-H)),this.emit("drill",{path:[...this.#u],label:this.#u[this.#u.length-1]||null}),this.draw(),[...this.#u]}update(L){this.#e={...this.#e,...L},this.draw()}get element(){return this.#f}toSVG(L){if(!this.#o)return"";const H=Pt(this.#i);let ae=this.#o;return L&&L.inlineStyles&&H.getComputedStyle&&this.#o.cloneNode&&(ae=this.#o.cloneNode(!0),Vn(this.#o,ae,H),ae.setAttribute("xmlns","http://www.w3.org/2000/svg")),typeof H.XMLSerializer=="function"?new H.XMLSerializer().serializeToString(ae):ae.outerHTML||""}async toPNG(L){const H=Pt(this.#i);if(!this.#o||!H.Image||!this.#i.createElement)return null;const ae=L&&L.scale||H.devicePixelRatio||1,Me=this.#o.getBoundingClientRect?this.#o.getBoundingClientRect():Mt,re=Math.max(1,Math.round(Me.width||Mt.width)),Le=Math.max(1,Math.round(Me.height||Mt.height)),Re=this.toSVG({inlineStyles:!0}),Ee=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Re)}`,Fe=new H.Image;await new Promise((Be,Ot)=>{Fe.onload=Be,Fe.onerror=()=>Ot(new Error("the chart could not be rasterised")),Fe.src=Ee});const Ue=this.#i.createElement("canvas");Ue.width=Math.round(re*ae),Ue.height=Math.round(Le*ae);const ct=Ue.getContext("2d"),kt=L&&"background"in L?L.background:"#ffffff";return kt&&(ct.fillStyle=kt,ct.fillRect(0,0,Ue.width,Ue.height)),ct.drawImage(Fe,0,0,Ue.width,Ue.height),new Promise(Be=>Ue.toBlob(Be,"image/png"))}toCSV(){const L=this.#r;if(!L)return"";const H=re=>{const Le=re==null?"":String(re);return/[",\n]/.test(Le)?`"${Le.replace(/"/g,'""')}"`:Le};if(L.root){const re=[["Label",L.measure.title||"Value"].map(H).join(",")];for(const Le of L.root.children)re.push([H(Le.label),H(Le.total)].join(","));return re.join(`
225
- `)}const Me=[[L.dimension.title||"",...L.series.map(re=>re.label)].map(H).join(",")];for(let re=0;re<L.labels.length;re++){const Le=[H(L.labels[re])];for(const Re of L.series){const Ee=Re.points[re];Le.push(H(Ee&&Ee.y!==null?Ee.y:""))}Me.push(Le.join(","))}return Me.join(`
226
- `)}destroy(){if(!this.#A){this.#A=!0,this.#z();for(const L of this.#b)L();this.#b=[],this.#v&&this.#v.disconnect(),this.#v=null,this.#f&&this.#f.parentNode&&this.#f.parentNode.removeChild(this.#f),this.#t=null,this.#r=null,this.#S.clear()}}}function an(Ye){if(!Ye||!Ye.grid)throw new Error("createChart needs a grid");const L=Ye.grid.element?Ye.grid.element.ownerDocument:globalThis.document,H=Wn(L,Ye.container);if(!H)throw new Error("createChart needs a container element");const{grid:ae,container:Me,...re}=Ye;return new sn({grid:ae,container:H,spec:re})}function Jn(Ye,L){if(!L||!L.container)return null;const H=_t(Ye,L);if(!H.spec)return null;const{container:ae,range:Me,...re}=L,Le=[{provided:["x"],derivedKeys:["x"]},{provided:["y","measures"],derivedKeys:["y","measures"]},{provided:["series"],derivedKeys:["series"]}],Re={...H.spec};for(const Ee of Le)if(Ee.provided.some(Fe=>Fe in re))for(const Fe of Ee.derivedKeys)delete Re[Fe];return an({...re,...Re,grid:Ye,container:ae})}function Qn(Ye,L={}){return!!_t(Ye,L).spec}});const yt=fn("packages/modules/charts/index.js"),qn=yt.registerScheme,eo=yt.resolveScheme,to=yt.schemeNames,no=yt.setDefaultScheme,oo=yt.SCHEMES,ro=yt.PALETTE,io=yt.registerChartType,so=yt.registeredChartTypes,ao=yt.TYPES,lo=yt.Chart,co=yt.createChart,uo=yt.deriveRangeSpec,fo=yt.regressionPlots,ho=yt.chartRange,mo=yt.canChartRange;export{lo as Chart,ro as PALETTE,oo as SCHEMES,ao as TYPES,mo as canChartRange,ho as chartRange,co as createChart,uo as deriveRangeSpec,io as registerChartType,qn as registerScheme,so as registeredChartTypes,fo as regressionPlots,eo as resolveScheme,to as schemeNames,no as setDefaultScheme};
228
+ `}function X(U){const ae=U.documentElement;if(!ae||ae.getAttribute(de))return;ae.setAttribute(de,"1");const N=U.createElement("style");N.textContent=Y(),(U.head||U.body||ae).appendChild(N)}}),Xe("packages/modules/charts/axis.js",function(a,V){"use strict";Object.defineProperty(a,"normaliseAxes",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(a,"tickValues",{enumerable:!0,get:function(){return F}}),Object.defineProperty(a,"tickLabeller",{enumerable:!0,get:function(){return I}}),Object.defineProperty(a,"drawAxisTitle",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(a,"labelEvery",{enumerable:!0,get:function(){return S}}),Object.defineProperty(a,"drawMeasureAxis",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(a,"drawCategoryAxis",{enumerable:!0,get:function(){return te}}),Object.defineProperty(a,"leftLabelRoom",{enumerable:!0,get:function(){return q}}),Object.defineProperty(a,"setLabelText",{enumerable:!0,get:function(){return E}}),Object.defineProperty(a,"drawBandLabels",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"drawContinuousAxis",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"drawAxisLines",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"createGroups",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"MARK_OVERHANG",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"overhangFor",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"setPlotClip",{enumerable:!0,get:function(){return H}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/svg.js"),de=M.attrs,ce=M.round,Y=M.setText,X=M.svg,U=V("packages/modules/charts/typography.js"),ae=U.applySize,N=U.CHAR_RATIO,d=U.truncateTo,z=V("packages/modules/charts/styles.js").NS,x=6,B=1.2;function Q(e){if(e===!1){const r={labels:!1,grid:!1};return{x:{...r},y:{...r},y2:{...r}}}const u=e&&typeof e=="object"?e:{},k=r=>typeof r=="string"?{title:r}:r&&typeof r=="object"?{...r}:{};return{x:k(u.x),y:k(u.y),y2:k(u.y2||u.right)}}function F(e,u){const k=u&&u.ticks;if(Array.isArray(k)){const w=e.domain;return!w||w.min===void 0?k:k.filter(p=>Number(p)>=w.min&&Number(p)<=w.max)}const r=Number.isFinite(k)&&k>0?Number(k):5;return e.ticks(r)}function I(e,u,k){const r=e&&e.format;return typeof r=="function"?w=>String(r(w)):typeof r=="string"&&k&&k.formatting&&k.formatting.format?w=>String(k.formatting.format(w,r)):u.tick}function ne(e){if(!e.text)return;const u=e.side==="left"||e.side==="right"?e.plot.height:e.plot.width,k=Number.isFinite(u)?d(String(e.text),Math.max(0,u),e.size):String(e.text);if(!k||k==="…")return;const r=X(e.group.ownerDocument,"text",{class:`${z}__axis-title`});if(ae(r,e.size),e.side==="left"){const w=Math.max(e.size,e.plot.left-e.plot.gutter.left+e.size),p=e.plot.top+e.plot.height/2;de(r,{transform:`translate(${ce(w)} ${ce(p)}) rotate(-90)`,"text-anchor":"middle"})}else if(e.side==="right"){const w=e.plot.right+e.plot.gutter.right-e.size,p=e.plot.top+e.plot.height/2;de(r,{transform:`translate(${ce(w)} ${ce(p)}) rotate(90)`,"text-anchor":"middle"})}else de(r,{x:ce(e.plot.left+e.plot.width/2),y:ce(e.plot.bottom+e.plot.gutter.bottom-2),"text-anchor":"middle"});Y(r,k),k!==String(e.text)&&r.setAttribute("aria-label",String(e.text)),e.group.appendChild(r)}function S(e){const{values:u,scale:k,size:r,horizontal:w,label:p}=e;if(u.length<2)return 1;let l=1/0;for(let o=1;o<u.length;o++){const s=Math.abs(k.of(u[o])-k.of(u[o-1]));Number.isFinite(s)&&s<l&&(l=s)}if(!Number.isFinite(l))return 1;if(l<=0)return u.length;let v=r*B+2;if(w){let o=0;for(const s of u){const b=String(p(s)||"").length*r*N;b>o&&(o=b)}v=o+x}return Math.max(1,Math.ceil(v/l))}function Z(e){const{gridGroup:u,axisGroup:k,plot:r,scale:w,format:p}=e,l=e.config||{},v=F(w,l),o=I(l,p,e.grid),s=e.size||11,b=S({values:v,scale:w,size:s,horizontal:!!e.horizontal,label:o}),t=l.grid===!1?null:u,c=t?new ee(t):null,P=new ee(k);for(let g=0;g<v.length;g++){const y=v[g],j=ce(w.of(y)),h=y===0,i=g%b!==0;if(e.horizontal){if(c&&de(c.next("line",`${z}__gridline`),{x1:j,x2:j,y1:ce(r.top),y2:ce(r.bottom),"stroke-opacity":h?1:.6,"stroke-width":h?1.5:1}),l.labels===!1||i)continue;const n=P.next("text",`${z}__tick`);ae(n,s),de(n,{x:j,y:ce(r.bottom+x),"text-anchor":"middle","dominant-baseline":"hanging"}),Y(n,o(y))}else{if(c&&de(c.next("line",`${z}__gridline`),{x1:ce(r.left),x2:ce(r.right),y1:j,y2:j,"stroke-opacity":h?1:.6,"stroke-width":h?1.5:1}),l.labels===!1||i)continue;const n=P.next("text",`${z}__tick`);ae(n,s),de(n,{x:ce(r.left-x),y:j,"text-anchor":"end","dominant-baseline":"middle"}),Y(n,o(y))}}return c?c.finish():new ee(u).finish(),P.finish(),v}function te(e){const{group:u,plot:k,scale:r,labels:w,fontSize:p}=e,l=e.config||{};if(l.labels===!1){new ee(u).finish();return}const v=new ee(u),o=r.domain,s=r.step,b=l.rotate===void 0||l.rotate==="auto"?e.rotated:!!l.rotate,t=b&&s>0?Math.max(1,Math.ceil(p*Math.SQRT2/s)):1,c=Number.isFinite(l.every)&&l.every>0?Number(l.every):t,P=s*c;for(let g=0;g<o.length;g++){const y=ce(r.centre(o[g]));if(Number.isNaN(y)||g%c!==0)continue;const j=v.next("text",`${z}__tick`);ae(j,p);const h=w[g]===void 0?"":w[g];b?(de(j,{x:0,y:0,"text-anchor":"end","dominant-baseline":"middle",transform:`translate(${y} ${ce(k.bottom+x)}) rotate(-45)`}),E(j,h,Math.max(0,k.gutter.bottom-x)*Math.SQRT2,p)):(de(j,{x:y,y:ce(k.bottom+x),"text-anchor":"middle","dominant-baseline":"hanging",transform:null}),E(j,h,P,p))}v.finish()}function q(e){return Math.max(0,(e.gutter?e.gutter.left:e.left)-x)}function E(e,u,k,r){const w=String(u??""),p=d(w,k,r);return Y(e,p),p!==w?e.setAttribute("aria-label",w):e.removeAttribute("aria-label"),p}function L(e){const{group:u,plot:k,scale:r,labels:w}=e,p=e.config||{},l=new ee(u),v=r.domain,o=e.fontSize,s=q(k),b=r.step>0?Math.max(1,Math.ceil(o*B/r.step)):1,t=Number.isFinite(p.every)&&p.every>0?Number(p.every):b;for(let c=0;c<v.length;c++){if(c%t!==0)continue;const P=ce(r.centre(v[c]));if(Number.isNaN(P))continue;const g=l.next("text",`${z}__tick`);de(g,{x:ce(k.left-x),y:P,"text-anchor":"end","dominant-baseline":"middle"}),ae(g,o),E(g,w[c],s,o)}l.finish()}function se(e){const{group:u,plot:k,scale:r,format:w}=e,p=e.config||{};if(p.labels===!1){new ee(u).finish();return}const l=I(p,w,e.grid),v=new ee(u);for(const o of F(r,p)){const s=ce(r.of(o));if(s<k.left-1||s>k.right+1)continue;const b=v.next("text",`${z}__tick`);ae(b,e.size||11),de(b,{x:s,y:ce(k.bottom+x),"text-anchor":"middle","dominant-baseline":"hanging"}),Y(b,l(o))}v.finish()}function R(e){const{group:u,plot:k}=e,r=new ee(u);de(r.next("line"),{x1:ce(k.left),x2:ce(k.left),y1:ce(k.top),y2:ce(k.bottom)}),de(r.next("line"),{x1:ce(k.left),x2:ce(k.right),y1:ce(k.bottom),y2:ce(k.bottom)}),r.finish()}let $=0;function he(e,u){const k=`${z}-plot-clip-${++$}`,r=X(e,"rect"),w=X(e,"clipPath",{id:k});w.appendChild(r);const p=`${z}-box-clip-${$}`,l=X(e,"clipPath",{id:p});l.appendChild(X(e,"rect",{x:0,y:0,width:"100%",height:"100%"}));const v=X(e,"defs");v.appendChild(w),v.appendChild(l);const o={grid:X(e,"g",{class:`${z}__grid`}),marks:X(e,"g",{class:`${z}__marks`}),rules:X(e,"g",{class:`${z}__axis`}),axis:X(e,"g",{class:`${z}__axis`}),labels:X(e,"g",{class:`${z}__labels`}),overlay:X(e,"g",{class:`${z}__overlay`}),clip:r,clipId:k,boxClipId:p};u.appendChild(v);for(const s of["grid","marks","rules","axis","labels","overlay"])u.appendChild(o[s]);return o}const f=30;function J(e){return e==="bubble"?f:e==="scatter"?6:3}function H(e,u,k){if(!e||!e.marks||!e.clip)return;if(!u||!Number.isFinite(u.width)||!Number.isFinite(u.height)){e.marks.removeAttribute("clip-path");return}const r=Number.isFinite(k)&&k>=0?Number(k):f;de(e.clip,{x:ce(u.left-r),y:ce(u.top-r),width:ce(Math.max(0,u.width)+r*2),height:ce(Math.max(0,u.height)+r*2)}),e.marks.setAttribute("clip-path",`url(#${e.clipId})`)}}),Xe("packages/modules/charts/scale.js",function(a,V){"use strict";Object.defineProperty(a,"isNumber",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"toNumber",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(a,"toTime",{enumerable:!0,get:function(){return N}}),Object.defineProperty(a,"extent",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"niceStep",{enumerable:!0,get:function(){return D}}),Object.defineProperty(a,"niceDomain",{enumerable:!0,get:function(){return z}}),Object.defineProperty(a,"measureDomain",{enumerable:!0,get:function(){return x}}),Object.defineProperty(a,"linearTicks",{enumerable:!0,get:function(){return B}}),Object.defineProperty(a,"timeStepFor",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(a,"timeTicks",{enumerable:!0,get:function(){return I}}),Object.defineProperty(a,"linearScale",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(a,"timeScale",{enumerable:!0,get:function(){return S}}),Object.defineProperty(a,"key",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(a,"bandScale",{enumerable:!0,get:function(){return te}}),Object.defineProperty(a,"sqrtScale",{enumerable:!0,get:function(){return q}});const ve=[1,2,2.5,5,10],ee=6e4,M=36e5,de=864e5,ce=365.25*de,Y=[1,2,5,10,20,25,50,100],X=[1,5,10,25,50,100,250,500,1e3,5e3,15e3,3e4,ee,5*ee,15*ee,30*ee,M,3*M,6*M,12*M,de,2*de,7*de,14*de,30*de,90*de,180*de,...Y.map(E=>E*ce)];function U(E){return typeof E=="number"&&Number.isFinite(E)}function ae(E){if(E==null||E==="")return null;if(E instanceof Date){const se=E.getTime();return Number.isFinite(se)?se:null}if(typeof E=="boolean")return E?1:0;const L=Number(E);return Number.isFinite(L)?L:null}function N(E){if(E==null||E==="")return null;if(E instanceof Date){const se=E.getTime();return Number.isFinite(se)?se:null}if(typeof E=="number")return Number.isFinite(E)?E:null;const L=Date.parse(String(E));return Number.isFinite(L)?L:null}function d(E){let L=1/0,se=-1/0;for(let R=0;R<E.length;R++){const $=E[R];U($)&&($<L&&(L=$),$>se&&(se=$))}return L===1/0?null:{min:L,max:se}}function D(E){if(!(E>0))return 1;const L=10**Math.floor(Math.log10(E));for(const se of ve)if(E<=se*L)return se*L;return 10*L}function z(E,L=5){const se=D((E.max-E.min)/Math.max(1,L));return{min:Math.floor(E.min/se)*se,max:Math.ceil(E.max/se)*se,step:se}}function x(E,L={}){const se=d(E)||{min:0,max:1};let{min:R,max:$}=se;if(L.zero&&(R>0&&(R=0),$<0&&($=0)),R===$){const he=Math.abs(R)>0?Math.abs(R)/10:1;R-=he,$+=he}if(L.nice!==!1){const he=z({min:R,max:$},L.ticks||5);R=he.min,$=he.max}return U(L.min)&&(R=L.min),U(L.max)&&($=L.max),R===$&&($=R+1),{min:R,max:$}}function B(E,L=5){const se=D((E.max-E.min)/Math.max(1,L)),R=Math.ceil(E.min/se),$=Math.floor(E.max/se),he=[];for(let f=R;f<=$;f++){const J=f*se;he.push(Math.abs(J)<se/1e6?0:Number(J.toPrecision(12)))}return he}function Q(E,L=5){const se=Math.max(1,L),R=E/se;let $=X[X.length-1];for(const J of X)if(J>=R){$=J;break}if($<ce)return $;let he=$,f=Math.abs(E/$-se);for(const J of X){if(J<ce)continue;const H=Math.abs(E/J-se);H<f&&(f=H,he=J)}return he}function F(E,L){const se=new Date(E.min).getUTCFullYear();let R=Math.ceil(se/L)*L;Date.UTC(R,0,1)<E.min&&(R+=L);const $=[];for(;Date.UTC(R,0,1)<=E.max;R+=L)$.push(Date.UTC(R,0,1));return $}function I(E,L=5){const se=Q(E.max-E.min,L);if(se>=ce)return F(E,Math.round(se/ce));const R=[],$=Math.ceil(E.min/se)*se;for(let he=$;he<=E.max;he+=se)R.push(he);return R}function ne(E,L){const se=E.max-E.min||1,[R,$]=L;return{kind:"linear",domain:E,range:L,of(he){return R+(he-E.min)/se*($-R)},invert(he){return E.min+(he-R)/($-R||1)*se},ticks(he=5){return B(E,he)}}}function S(E,L){return{...ne(E,L),kind:"time",ticks(R=5){return I(E,R)}}}function Z(E){if(E==null)return" null";if(E instanceof Date)return` date:${E.getTime()}`;if(typeof E=="object"){const L=E,se=L.id??L.key??L.value;return se!==void 0&&typeof se!="object"?` obj:${String(se)}`:` obj:${String(E)}`}return String(E)}function te(E,L,se=.2){const R=Math.min(.9,Math.max(0,se)),[$,he]=L,f=new Map;for(let e=0;e<E.length;e++){const u=Z(E[e]);f.has(u)||f.set(u,e)}const J=E.length?(he-$)/E.length:he-$,H=Math.max(0,J*(1-R));return{kind:"band",domain:E,range:L,bandwidth:H,step:J,of(e){const u=f.get(Z(e));return u===void 0?NaN:$+u*J+(J-H)/2},centre(e){const u=this.of(e);return Number.isNaN(u)?NaN:u+H/2},ticks(){return E}}}function q(E,L){const[se,R]=L,$=Math.max(Math.abs(E.max),Math.abs(E.min),0)||1;return{kind:"sqrt",domain:E,range:L,of(he){const f=Math.sqrt(Math.abs(he)/$);return se+f*(R-se)}}}}),Xe("packages/modules/charts/format.js",function(a,V){"use strict";Object.defineProperty(a,"precisionFor",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"axisNumber",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"r2Digits",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"dateFormatFor",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"formatters",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"measureText",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"measureFormat",{enumerable:!0,get:function(){return ae}});const ee=V("packages/modules/charts/scale.js").timeStepFor;function M(N){if(!Number.isFinite(N)||N<=0)return 0;const d=Math.ceil(-Math.log10(N));return Math.min(6,Math.max(0,d))}function de(N,d,D=0){return Number.isFinite(N)?Math.abs(N)>=1e4?d.number(N,{notation:"compact",maximumFractionDigits:1}):d.number(N,{minimumFractionDigits:D,maximumFractionDigits:D}):""}function ce(N,d){const D=N&&N.messages;return!D||typeof D.number!="function"?Number(d).toFixed(2):D.number(d,{minimumFractionDigits:2,maximumFractionDigits:2})}function Y(N){if(N>0){const D=ee(N);if(D<1e3)return{minute:"2-digit",second:"2-digit",fractionalSecondDigits:3};if(D<6e4)return{hour:"2-digit",minute:"2-digit",second:"2-digit"}}return N<=2*36e5?{hour:"2-digit",minute:"2-digit"}:N<=3*864e5?{weekday:"short",hour:"2-digit"}:N<=180*864e5?{day:"numeric",month:"short"}:N<=3*365*864e5?{month:"short",year:"numeric"}:{year:"numeric"}}function X(N,d){const D=N.messages,z=D.locale,x=N.get("timeZone")||void 0;if(d.kind==="time"){const Q=Y(d.span||0),F=new Intl.DateTimeFormat(z,x?{...Q,timeZone:x}:Q),I=new Intl.DateTimeFormat(z,x?{dateStyle:"medium",timeStyle:"short",timeZone:x}:{dateStyle:"medium",timeStyle:"short"});return{tick:ne=>Number.isFinite(Number(ne))?F.format(new Date(Number(ne))):"",value:ne=>Number.isFinite(Number(ne))?I.format(new Date(Number(ne))):""}}const B=M(d.step||0);return{tick:Q=>typeof Q=="number"?de(Q,D,B):String(Q??""),value:Q=>typeof Q=="number"?D.number(Q):String(Q??"")}}function U(N,d){if(N==null||!Number.isFinite(N))return"";const D=Math.abs(N)>=1e-6?Number(N.toPrecision(6)):N;return d.number(D)}function ae(N,d,D){return N==null||!Number.isFinite(Number(N))?"":d&&d.format&&typeof d.formatValue=="function"?String(d.formatValue(N,null)):U(Number(N),D&&D.messages)}}),Xe("packages/modules/charts/labels.js",function(a,V){"use strict";Object.defineProperty(a,"resolveLabels",{enumerable:!0,get:function(){return B}}),Object.defineProperty(a,"collides",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(a,"placeLabels",{enumerable:!0,get:function(){return F}}),Object.defineProperty(a,"labelText",{enumerable:!0,get:function(){return I}}),Object.defineProperty(a,"drawAnchoredLabels",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(a,"drawDataLabels",{enumerable:!0,get:function(){return S}});const ee=V("packages/modules/charts/frame.js").Pool,de=V("packages/modules/charts/format.js").measureText,ce=V("packages/modules/charts/svg.js"),Y=ce.attrs,X=ce.round,U=ce.setText,N=V("packages/modules/charts/styles.js").NS,d=V("packages/modules/charts/typography.js"),D=d.applySize,z=d.textWidth,x=4;function B(Z){const te=Z&&Z.labels;if(!te)return{show:!1,names:te!==!1,position:"outside",format:null,minGap:2,total:!1};const q=typeof te=="object"?te:{};return{show:!0,names:!0,position:["outside","inside","auto"].includes(q.position)?q.position:"outside",format:q.format||null,minGap:Number.isFinite(q.minGap)?Number(q.minGap):2,total:!!q.total}}function Q(Z,te,q){for(const E of te)if(Z.x-q<E.x+E.width&&Z.x+Z.width+q>E.x&&Z.y-q<E.y+E.height&&Z.y+Z.height+q>E.y)return!0;return!1}function F(Z){const{points:te,plot:q,size:E}=Z,L=Z.minGap===void 0?2:Z.minGap,se=[],R=[];for(const $ of te){if($.px===void 0||$.py===void 0)continue;const he=Z.text($);if(!he)continue;const f=z(he,E),J=E;let H=$.px,e=$.py-x,u="middle",k=!1;Z.horizontal?(H=$.px+x,e=$.py,u="start",Z.position!=="outside"&&$.pbase!==void 0&&Math.abs($.px-$.pbase)>f+x*2&&(H=$.px-x,u="end",k=!0)):Z.position!=="outside"&&$.pbase!==void 0&&Math.abs($.pbase-$.py)>J+x*2&&(e=$.py+J+x,k=!0);const r=()=>({x:u==="middle"?H-f/2:u==="end"?H-f:H,y:e-J,width:f,height:J});let w=r();!(w.y>=q.top-1)&&!k&&!Z.horizontal&&$.pbase!==void 0&&Math.abs($.pbase-$.py)>J+x*2&&(e=$.py+J+x,k=!0,w=r()),!(w.x+w.width<=q.right+1)&&!k&&Z.horizontal&&$.pbase!==void 0&&Math.abs($.px-$.pbase)>f+x*2&&(H=$.px-x,u="end",k=!0,w=r()),!(w.x<q.left-1||w.x+w.width>q.right+1)&&(w.y<q.top-1||w.y+w.height>q.bottom+J||Q(w,se,L)||(se.push(w),R.push({x:X(H),y:X(e),text:he,anchor:u,inside:k})))}return R}function I(Z,te,q){return Z==null?"":typeof te.format=="function"?String(te.format(Z)):typeof te.format=="string"&&q&&q.formatting&&q.formatting.format?String(q.formatting.format(Z,te.format)):de(Z,q&&q.messages)}function ne(Z){const te=new ee(Z.group),q=Z.minGap===void 0?2:Z.minGap,E=Z.size,L=[];let se=0;for(const R of Z.anchors){if(!R||!R.text)continue;const $=R.width===void 0?z(R.text,Z.size):R.width,he=R.anchor||"middle",J={x:he==="end"?R.x-$:he==="start"?R.x:R.x-$/2,y:R.y-E/2,width:$,height:E};if(Z.plot&&(J.x<Z.plot.left-1||J.x+J.width>Z.plot.right+1||J.y<Z.plot.top-1||J.y+J.height>Z.plot.bottom+1)||R.width!==void 0&&$>R.width||R.height!==void 0&&E>R.height||Q(J,L,q))continue;L.push(J);const H=te.next("text",R.className||`${N}__data-label`);D(H,Z.size),Y(H,{x:X(R.x),y:X(R.y),"text-anchor":he,"dominant-baseline":R.baseline||"middle","data-inside":R.inside?"true":null}),U(H,R.text),se++}return te.finish(),se}function S(Z){const te=new ee(Z.group),{options:q}=Z;let E=0;const L=se=>typeof q.format=="function"&&se.y!==null&&se.y!==void 0?String(q.format(se.y,se)):I(se.y,q,Z.grid);for(const se of Z.series){const R=F({points:se.points,plot:Z.plot,size:Z.size,position:q.position,horizontal:Z.horizontal,minGap:q.minGap,text:L});for(const $ of R){const he=te.next("text",`${N}__data-label`);D(he,Z.size),Y(he,{x:$.x,y:$.y,"text-anchor":$.anchor,"data-inside":$.inside?"true":null}),U(he,$.text),E++}}return te.finish(),E}}),Xe("packages/modules/charts/dense.js",function(a,V){"use strict";Object.defineProperty(a,"CANVAS_THRESHOLD",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(a,"downsample",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"markCount",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"wantsCanvas",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"paintDense",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"sizeCanvas",{enumerable:!0,get:function(){return Y}});const ve=3e3;function ee(X,U){const ae=X.length;if(!Number.isFinite(U)||U>=ae||U<3||ae<3)return X;const N=[X[0]],d=(ae-2)/(U-2);let D=0;for(let z=0;z<U-2;z++){const x=Math.floor(z*d)+1,B=Math.min(Math.floor((z+1)*d)+1,ae-1),Q=B,F=Math.min(Math.floor((z+2)*d)+1,ae);let I=0,ne=0,S=0;for(let E=Q;E<F;E++){const L=X[E];!L||!Number.isFinite(L.y)||(I+=L.x,ne+=L.y,S++)}S&&(I/=S,ne/=S);const Z=X[D];if(x>=B)continue;let te=x,q=-1;for(let E=x;E<B;E++){const L=X[E];if(!L||!Number.isFinite(L.y))continue;const se=Math.abs((Z.x-I)*(L.y-Z.y)-(Z.x-L.x)*(ne-Z.y));se>q&&(q=se,te=E)}te<=D||(N.push(X[te]),D=te)}return N.push(X[ae-1]),N}function M(X){let U=0;for(const ae of X)U+=ae.points.length;return U}function de(X){if(X.canvas===!0)return!0;if(X.canvas===!1)return!1;const U=Number.isFinite(X.canvas)?Number(X.canvas):ve;return M(X.series)>U}function ce(X){const{context:U,series:ae,ratio:N}=X;U.save(),U.scale(N,N);for(const d of ae){const D=X.colour(d.index);if(X.type==="scatter"||X.type==="bubble"){U.fillStyle=D;for(const x of d.points)x.px!==void 0&&(U.beginPath(),U.arc(x.px,x.py,x.pr||2,0,Math.PI*2),U.fill());continue}U.strokeStyle=D,U.lineWidth=2,U.lineJoin="round",U.beginPath();let z=!1;for(const x of d.points){if(x.px===void 0||x.py===void 0){z=!1;continue}z?U.lineTo(x.px,x.py):U.moveTo(x.px,x.py),z=!0}U.stroke()}U.restore()}function Y(X){const{canvas:U}=X;return U.width=Math.max(1,Math.round(X.width*X.ratio)),U.height=Math.max(1,Math.round(X.height*X.ratio)),U.style&&(U.style.width=`${X.width}px`,U.style.height=`${X.height}px`),typeof U.getContext=="function"?U.getContext("2d"):null}}),Xe("packages/modules/charts/annotations.js",function(a,V){"use strict";Object.defineProperty(a,"overlayLayer",{enumerable:!0,get:function(){return F}}),Object.defineProperty(a,"annotationValue",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"annotationAxis",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"annotationText",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"drawAnnotations",{enumerable:!0,get:function(){return he}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/scale.js"),de=M.isNumber,ce=M.toNumber,Y=M.toTime,X=V("packages/modules/charts/svg.js"),U=X.attrs,ae=X.path,N=X.round,d=X.setText,D=X.SVG_NS,x=V("packages/modules/charts/styles.js").NS,Q=V("packages/core/src/internal/util.js").warnOnce;function F(f,J){for(const e of f.childNodes||[])if(e&&String(e.getAttribute&&e.getAttribute("class"))===J)return e;const H=f.ownerDocument.createElementNS(D,"g");return H.setAttribute("class",J),f.appendChild(H),H}const I=new Set(["line","target","band","callout","event"]);function ne(f,J){return f.kind==="time"?Y(J):ce(J)}function S(f,J,H){if(f.kind==="band"){const u=f.of(J);if(!Number.isFinite(u))return NaN;const k=Number(f.bandwidth)||0;return H==="right"?u+k:u}const e=ne(f,J);return e===null?NaN:f.of(e)}function Z(f,J,H){const e=f.kind||"line",u=f.label?` (${JSON.stringify(f.label)})`:"";Q(`chart:annotation:dropped:${e}:${J}:${H}`,`chart annotation${u} of kind ${JSON.stringify(e)}, reading the ${J} axis, was not drawn: ${H}.`)}function te(f,J){if(f instanceof Date){const e=f.getTime();return Number.isFinite(e)?f.toISOString().slice(0,10):String(f)}if(typeof f=="number")return Number.isFinite(f)?J(f):String(f);const H=ce(f);return H===null||typeof f=="string"?String(f):J(H)}function q(f,J,H){const e=[];for(const u of f)if((u.axis==="right"?"right":"left")===H&&!(J.series!==void 0&&u.key!==J.series))for(const r of u.points)de(r.y)&&e.push(Number(r.y));return e}function E(f,J){if(!f.length)return null;const H=[...f].sort((r,w)=>r-w);if(H.length===1)return H[0];const e=Math.min(100,Math.max(0,J))/100*(H.length-1),u=Math.floor(e),k=Math.ceil(e);return u===k?H[u]:H[u]+(H[k]-H[u])*(e-u)}function L(f,J,H){if(!f.compute)return ce(f.value);const e=q(J,f,H);if(!e.length)return null;const u=String(f.compute).toLowerCase();if(u==="mean"||u==="avg")return e.reduce((r,w)=>r+w,0)/e.length;if(u==="median"||u==="p50")return E(e,50);if(u==="min")return Math.min(...e);if(u==="max")return Math.max(...e);const k=/^p(\d+(?:\.\d+)?)$/.exec(u);return k?E(e,Number(k[1])):null}function se(f){return f.axis==="right"||f.axis==="y2"?"right":"left"}function R(f,J,H,e){const u=f.label?`${f.label}: `:"",k=e?` (${se(f)==="right"?"right axis":"left axis"})`:"",r=f.kind||"line";if(r==="band"){if(!Array.isArray(J)||J[0]===null||J[1]===null)return"";const[p,l]=J;return`${u||"Band: "}${H(Math.min(p,l))} to ${H(Math.max(p,l))}${k}`}return J==null?"":`${u||`${r==="target"?"Target":r==="callout"?"Callout":"Reference"}: `}${H(J)}${k}`}function $(f){return(f.kind||"line")==="band"?0:1}function he(f){const{group:J,plot:H,xScale:e,yScale:u,rightScale:k,series:r,format:w}=f,p=new ee(F(J,`${x}__annotations`)),l=[],o=[...Array.isArray(f.annotations)?f.annotations:[]].sort((s,b)=>$(s)-$(b));for(const s of o){const b=s.kind||"line";if(!I.has(b))continue;const t=se(s),c=t==="right"&&k?k:u;if(b==="band"){if(s.orient==="vertical"){const m=S(e,s.from,"left"),G=S(e,s.to,"right");if(Number.isNaN(m)||Number.isNaN(G)){const oe=Number.isNaN(m)&&Number.isNaN(G)?"from and to":Number.isNaN(m)?"from":"to";Z(s,t,`its ${oe} value could not be placed on the x scale`);continue}const C=N(Math.min(m,G)),O=N(Math.max(m,G));if(U(p.next("rect",`${x}__annotation-band ${s.className||""}`.trim()),{x:C,y:N(H.top),width:Math.max(0,O-C),height:N(Math.max(0,H.bottom-H.top)),fill:s.colour||"currentColor","fill-opacity":s.opacity===void 0?.12:s.opacity}),s.label){const oe=p.next("text",`${x}__annotation-label`);U(oe,{x:C+4,y:N(H.top+12),"text-anchor":"start"}),d(oe,s.label)}const W=s.label?`${s.label}: `:"Event window: ";l.push({text:`${W}${te(s.from,w)} to ${te(s.to,w)}`});continue}const j=L({...s,value:s.from,compute:s.fromCompute},r,t),h=L({...s,value:s.to,compute:s.toCompute},r,t);if(j===null||h===null)continue;const i=N(c.of(j)),n=N(c.of(h));if(U(p.next("rect",`${x}__annotation-band ${s.className||""}`.trim()),{x:N(H.left),y:Math.min(i,n),width:N(Math.max(0,H.right-H.left)),height:Math.max(0,Math.abs(n-i)),fill:s.colour||"currentColor","fill-opacity":s.opacity===void 0?.12:s.opacity}),s.label){const m=p.next("text",`${x}__annotation-label`);U(m,{x:N(H.left+4),y:Math.min(i,n)+12,"text-anchor":"start"}),d(m,s.label)}l.push({text:R(s,[j,h],w,f.dual)});continue}if(b==="event"){const j=s.x!==void 0?s.x:s.at,h=N(S(e,j,"left")+(e.kind==="band"?(Number(e.bandwidth)||0)/2:0));if(Number.isNaN(h)){Z(s,t,"its x value could not be placed on the x scale");continue}if(U(p.next("path",`${x}__annotation-event`),{d:ae(["M",h,N(H.top),"L",h,N(H.bottom)]),stroke:s.colour||"currentColor",fill:"none"}),U(p.next("circle",`${x}__annotation-event-flag`),{cx:h,cy:N(H.top),r:3,fill:s.colour||"currentColor"}),s.label){const n=p.next("text",`${x}__annotation-label`);U(n,{x:h+5,y:N(H.top+10),"text-anchor":"start"}),d(n,s.label)}const i=s.label?`${s.label} — `:"Event — ";l.push({text:`${i}at ${te(j,w)}`});continue}if(b==="callout"){const j=L(s,r,t);if(j===null)continue;const h=s.at!==void 0?N(e.kind==="band"?e.centre(s.at):e.of(ne(e,s.at)??NaN)):N(H.right-4),i=N(c.of(j));if(Number.isNaN(h)){Z(s,t,"its x value could not be placed on the x scale");continue}if(U(p.next("circle",`${x}__annotation-point`),{cx:h,cy:i,r:3.5,fill:s.colour||"currentColor"}),s.label){const n=p.next("text",`${x}__annotation-label`);U(n,{x:h+6,y:i-6,"text-anchor":"start"}),d(n,s.label)}l.push({text:R(s,j,w,f.dual)});continue}if(s.orient==="vertical"||s.x!==void 0){const j=s.x!==void 0?s.x:s.value,h=e.kind==="band"?N(e.centre(j)):N(e.of(ne(e,j)??NaN));if(Number.isNaN(h)){Z(s,t,"its x value could not be placed on the x scale");continue}const i=b==="target"?`${x}__annotation-target`:`${x}__annotation-line`;if(U(p.next("path",i),{d:ae(["M",h,N(H.top),"L",h,N(H.bottom)]),stroke:s.colour||"currentColor",fill:"none"}),s.label){const n=p.next("text",`${x}__annotation-label`);U(n,{x:h+4,y:N(H.top+10),"text-anchor":"start"}),d(n,s.label)}l.push({text:s.label?`${s.label} — at ${te(j,w)}`:""});continue}const P=L(s,r,t);if(P===null)continue;const g=N(c.of(P)),y=b==="target"?`${x}__annotation-target`:`${x}__annotation-line`;if(U(p.next("path",y),{d:ae(["M",N(H.left),g,"L",N(H.right),g]),stroke:s.colour||"currentColor",fill:"none"}),s.label){const j=p.next("text",`${x}__annotation-label`);U(j,{x:N(H.right-4),y:g-4,"text-anchor":"end"}),d(j,s.label)}l.push({text:R(s,P,w,f.dual)})}return p.finish(),l.filter(s=>s.text)}}),Xe("packages/modules/charts/combo.js",function(a,V){"use strict";Object.defineProperty(a,"toPareto",{enumerable:!0,get:function(){return r}}),Object.defineProperty(a,"drawCombo",{enumerable:!0,get:function(){return l}}),Object.defineProperty(a,"drawRightAxis",{enumerable:!0,get:function(){return v}});const ve=V("packages/modules/charts/axis.js"),ee=ve.drawAxisLines,M=ve.drawCategoryAxis,de=ve.drawContinuousAxis,ce=ve.drawMeasureAxis,Y=ve.overhangFor,X=ve.setPlotClip,U=V("packages/modules/charts/frame.js"),ae=U.Pool,N=U.shouldRotate,D=V("packages/modules/charts/format.js").formatters,z=V("packages/modules/charts/scale.js"),x=z.bandScale,B=z.extent,Q=z.isNumber,F=z.linearScale,I=z.measureDomain,ne=z.timeScale,S=z.toNumber,Z=z.toTime,te=V("packages/modules/charts/svg.js"),q=te.attrs,E=te.path,L=te.round,R=V("packages/modules/charts/styles.js").NS,he=V("packages/modules/charts/scheme.js").resolveScheme,J=V("packages/modules/charts/labels.js").drawDataLabels,e=V("packages/modules/charts/annotations.js").drawAnnotations;function u(o){return{left:o.filter(s=>s.axis!=="right"),right:o.filter(s=>s.axis==="right")}}function k(o,s){const b=[];for(const t of o)for(const c of t.points)b.push(c.y);return I(b,{zero:s})}function r(o){const s=o.series[0];if(!s)return o;const b=s.points.map((g,y)=>({point:g,label:o.labels[y],category:o.categories[y]})).filter(g=>Q(g.point.y)).sort((g,y)=>y.point.y-g.point.y),t=b.reduce((g,y)=>g+y.point.y,0);let c=0;const P=b.map(g=>(c+=g.point.y,t>0?c/t*100:0));return{...o,categories:b.map(g=>g.category),labels:b.map(g=>g.label),series:[{...s,index:0,mark:"bar",axis:"left",points:b.map(g=>g.point)},{key:"cumulative",label:o.cumulativeLabel||"%",index:1,mark:"line",axis:"right",points:b.map((g,y)=>({x:g.category,xKey:g.point.xKey,label:g.label,y:P[y],rows:g.point.rows,rowKey:g.point.rowKey}))}]}}function w(o,s){const b=[s.left,s.right];if(o.kind!=="time"&&o.kind!=="linear")return x(o.categories,b,.2);const t=o.kind==="time"?o.categories.map(Z):o.categories.map(S);if(o.kind==="time"){const P=B(t);if(P&&P.min===P.max)return ne({min:P.min-3e4,max:P.max+3e4},b)}const c=I(t,{zero:!1,nice:o.kind!=="time"});return o.kind==="time"?ne(c,b):F(c,b)}function p(o,s){const b=[...new Set(o.filter(y=>Number.isFinite(y)))].sort((y,j)=>y-j);if(b.length<2){const[y,j]=s.range;return Math.max(4,(j-y)/10)}const t=[];for(let y=1;y<b.length;y++)t.push(b[y]-b[y-1]);t.sort((y,j)=>y-j);const c=Math.floor(t.length/2),P=t.length%2?t[c]:(t[c-1]+t[c])/2,g=Math.abs(s.of(b[0]+P)-s.of(b[0]));return Math.max(1,g*.8)}function l(o){const s=o.scheme||he(),{plot:b}=o,t=o.pareto?r(o.bound):o.bound,c=t.series.filter(ue=>!o.hidden.has(ue.key)),P=u(c),g=P.left.some(ue=>(ue.mark||"bar")==="bar"),y=k(P.left,g),j=F(y,[b.bottom,b.top]),h=P.right.length?o.pareto?{min:0,max:100}:k(P.right,!1):null,i=h?F(h,[b.bottom,b.top]):null,n=w(t,b),m=n.kind!=="band",G=m?t.categories.map(ue=>t.kind==="time"?Z(ue):S(ue)):null;ce({gridGroup:o.groups.grid,axisGroup:o.groups.axis,plot:b,scale:j,format:D(o.grid,{kind:"linear",step:(y.max-y.min)/5})}),m?de({group:o.groups.overlay,plot:b,scale:n,format:D(o.grid,{kind:t.kind,span:n.domain.max-n.domain.min,step:(n.domain.max-n.domain.min)/5}),grid:o.grid,size:o.fontSize}):M({group:o.groups.overlay,plot:b,scale:n,labels:t.labels,fontSize:o.fontSize,rotated:N(t.labels,n.step,o.fontSize)}),ee({group:o.groups.rules,plot:b}),i&&v({group:o.groups.axis,plot:b,scale:i,colour:s.series(P.right[0].index),format:D(o.grid,{kind:"linear",step:(h.max-h.min)/5}),suffix:o.pareto?"%":""}),X(o.groups,b,Y(o.type));const C=new ae(o.groups.marks),O=c.filter(ue=>(ue.mark||"bar")==="bar"),W=m?p(G,n):n.bandwidth,oe=O.length?W/O.length:W;let _=0;for(const ue of c){const ge=ue.mark||"bar",ye=ue.axis==="right"&&i?i:j,be=s.series(ue.index);if(ge==="bar"){const xe=_*oe;_++;const $e=ye.of(Math.max(ye.domain.min,0));for(let Oe=0;Oe<ue.points.length;Oe++){const Pe=ue.points[Oe];if(!Q(Pe.y))continue;let De;if(m){const Ve=t.kind==="time"?Z(Pe.x):S(Pe.x);De=Ve===null?NaN:n.of(Ve)-W/2}else De=n.of(Pe.x);if(Number.isNaN(De))continue;const Ge=ye.of(Pe.y);q(C.next("rect",`${R}__bar ${R}__mark`),{x:L(De+xe),y:L(Math.min(Ge,$e)),width:L(Math.max(0,oe)),height:L(Math.max(1,Math.abs($e-Ge))),fill:be,"data-series":ue.index,"data-point":Oe}),Pe.px=L(De+xe+oe/2),Pe.py=L(Math.min(Ge,$e))}continue}const Me=[];let je=!1;for(const xe of ue.points){if(!Q(xe.y)){je=!1;continue}let $e;if(m){const Pe=t.kind==="time"?Z(xe.x):S(xe.x);$e=Pe===null?NaN:L(n.of(Pe))}else $e=L(n.centre(xe.x));if(Number.isNaN($e)){je=!1;continue}const Oe=L(ye.of(xe.y));Me.push(je?"L":"M",$e,Oe),je=!0,xe.px=$e,xe.py=Oe}q(C.next("path",`${R}__line ${R}__mark`),{d:Me.length?E(Me):"",stroke:be,"data-series":ue.index});for(const xe of ue.points)xe.px!==void 0&&q(C.next("circle",`${R}__point ${R}__mark`),{cx:xe.px,cy:xe.py,r:3,fill:be})}C.finish(),o.labels&&o.labels.show&&J({group:o.groups.labels,series:c,plot:b,options:o.labels,grid:o.grid,size:o.typography&&o.typography.small||o.fontSize});let le=null;return o.annotations&&o.annotations.length&&(le=e({group:o.groups.overlay,plot:b,xScale:n,yScale:j,rightScale:i,series:c,annotations:o.annotations,dual:!!i,format:D(o.grid,{kind:"linear",step:(y.max-y.min)/5}).tick})),{xScale:n,yScale:j,rightScale:i,dual:!!i,series:c,bound:t,annotations:le}}function v(o){const{group:s,plot:b,scale:t,format:c}=o,P=new ae(s);q(P.next("line",`${R}__axis-right`),{x1:L(b.right),x2:L(b.right),y1:L(b.top),y2:L(b.bottom),stroke:o.colour});for(const g of t.ticks(5)){const y=L(t.of(g)),j=P.next("text",`${R}__tick`);q(j,{x:L(b.right+6),y,"text-anchor":"start","dominant-baseline":"middle",fill:o.colour}),j.textContent=`${c.tick(g)}${o.suffix||""}`}P.finish()}}),Xe("packages/modules/charts/quantile.js",function(a,V){"use strict";Object.defineProperty(a,"normalQuantile",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"studentTQuantile",{enumerable:!0,get:function(){return N}});const ve=Object.freeze([676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,15056327351493116e-23]),ee=3e-12,M=1e-300;function de(d){if(d<.5)return Math.log(Math.PI/Math.sin(Math.PI*d))-de(1-d);const D=d-1;let z=.9999999999998099;const x=D+7.5;for(let B=0;B<ve.length;B++)z+=ve[B]/(D+B+1);return .5*Math.log(2*Math.PI)+(D+.5)*Math.log(x)-x+Math.log(z)}function ce(d,D,z){const x=d+D,B=d+1,Q=d-1;let F=1,I=1-x*z/B;Math.abs(I)<M&&(I=M),I=1/I;let ne=I;for(let S=1;S<=300;S++){const Z=2*S;let te=S*(D-S)*z/((Q+Z)*(d+Z));I=1+te*I,Math.abs(I)<M&&(I=M),F=1+te/F,Math.abs(F)<M&&(F=M),I=1/I,ne*=I*F,te=-(d+S)*(x+S)*z/((d+Z)*(B+Z)),I=1+te*I,Math.abs(I)<M&&(I=M),F=1+te/F,Math.abs(F)<M&&(F=M),I=1/I;const q=I*F;if(ne*=q,Math.abs(q-1)<ee)break}return ne}function Y(d,D,z){if(!(d>0)||!(D>0)||!Number.isFinite(z))return Number.NaN;if(z<=0)return 0;if(z>=1)return 1;const x=Math.exp(de(d+D)-de(d)-de(D)+d*Math.log(z)+D*Math.log(1-z));return z<(d+1)/(d+D+2)?x*ce(d,D,z)/d:1-x*ce(D,d,1-z)/D}function X(d){const D=Math.abs(d),z=2/(2+D),x=4*z-2,B=[-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 Q=0,F=0,I;for(let S=B.length-1;S>0;S--)I=F,F=x*F-Q+B[S],Q=I;const ne=z*Math.exp(-D*D+.5*(B[0]+x*F)-Q);return d>=0?ne:2-ne}function U(d){if(!(d>0)||!(d<1))return d===0?-1/0:d===1?1/0:Number.NaN;const D=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],z=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],x=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],B=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],Q=.02425;let F,I,ne;d<Q?(F=Math.sqrt(-2*Math.log(d)),ne=(((((x[0]*F+x[1])*F+x[2])*F+x[3])*F+x[4])*F+x[5])/((((B[0]*F+B[1])*F+B[2])*F+B[3])*F+1)):d<=1-Q?(F=d-.5,I=F*F,ne=(((((D[0]*I+D[1])*I+D[2])*I+D[3])*I+D[4])*I+D[5])*F/(((((z[0]*I+z[1])*I+z[2])*I+z[3])*I+z[4])*I+1)):(F=Math.sqrt(-2*Math.log(1-d)),ne=-(((((x[0]*F+x[1])*F+x[2])*F+x[3])*F+x[4])*F+x[5])/((((B[0]*F+B[1])*F+B[2])*F+B[3])*F+1));const Z=(.5*X(-ne/Math.SQRT2)-d)*Math.sqrt(2*Math.PI)*Math.exp(ne*ne/2);return ne-Z/(1+ne*Z/2)}function ae(d,D){if(!(D>0)||!Number.isFinite(d))return Number.NaN;const z=.5*Y(D/2,.5,D/(D+d*d));return d>0?1-z:z}function N(d,D){if(!(d>0)||!(d<1)||!(D>0))return Number.NaN;if(D>1e7)return U(d);let z=-1e4,x=1e4,B=U(d);const Q=de(D/2)+de(.5)-de((D+1)/2);for(let F=0;F<60;F++){const I=ae(B,D);I<d?z=B:x=B;const ne=Math.exp(-((D+1)/2)*Math.log(1+B*B/D)-Q)/Math.sqrt(D),S=ne>0?(I-d)/ne:0;if(Math.abs(S)<1e-12)break;const Z=B-S;if(B=Z>z&&Z<x&&Number.isFinite(Z)?Z:(z+x)/2,x-z<1e-12)break}return B}}),Xe("packages/modules/charts/trendline.js",function(a,V){"use strict";Object.defineProperty(a,"normaliseTrends",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"linearTrend",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"movingAverageTrend",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"exponentialTrend",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"computeTrend",{enumerable:!0,get:function(){return k}}),Object.defineProperty(a,"trendText",{enumerable:!0,get:function(){return r}}),Object.defineProperty(a,"drawTrendlines",{enumerable:!0,get:function(){return w}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/svg.js"),de=M.attrs,ce=M.path,Y=M.ribbonPath,X=M.round,U=M.setText,ae=M.SVG_NS,d=V("packages/modules/charts/typography.js").applySize,z=V("packages/modules/charts/styles.js").NS,x=V("packages/modules/charts/scale.js"),B=x.toNumber,Q=x.toTime,I=V("packages/modules/charts/quantile.js").studentTQuantile,S=V("packages/modules/charts/format.js").r2Digits,Z={linear:new Set(["linear","lr","ols","regression","least-squares"]),movingAverage:new Set(["movingaverage","moving-average","ma","sma","rolling"]),exponential:new Set(["exponential","exp","ewma","ses","holt","smoothing"])},te=1e-4,q=1-1e-4;function E(p){const l=String(p||"linear").toLowerCase();return Z.linear.has(l)?"linear":Z.movingAverage.has(l)?"movingAverage":Z.exponential.has(l)?"exponential":null}function L(p){if(!p)return[];const l=Array.isArray(p)?p:[p],v=[];for(const o of l){if(o===!0){v.push({method:"linear"});continue}if(typeof o=="string"){const s=E(o);s&&v.push({method:s});continue}if(o&&typeof o=="object"){const s=E(o.method);s&&v.push({...o,method:s})}}return v}function se(p,l){if(p.kind==="band")return p.centre(l);const v=p.kind==="time"?Q(l):B(l);return v===null?NaN:p.of(v)}function R(p){const l=[];for(const v of p.points){const o=Number(v.y);l.push({value:Number.isFinite(o)?o:null,rawX:v.x})}return l}function $(p,l){const v=[];for(const o of p.points){const s=l.kind==="time"?Q(o.x):B(o.x),b=Number(o.y);s===null||!Number.isFinite(s)||!Number.isFinite(b)||v.push({x:s,y:b})}return v.sort((o,s)=>o.x-s.x),v}function he(p,l,v={}){const o=p.length;if(o<2)return null;let s=0,b=0;for(const W of p)s+=W.x,b+=W.y;s/=o,b/=o;let t=0,c=0,P=0;for(const W of p){const oe=W.x-s,_=W.y-b;t+=oe*oe,c+=oe*_,P+=_*_}if(t===0)return null;const g=c/t,y=b-g*s,j=P===0?1:Math.max(0,Math.min(1,c*c/(t*P))),h=p[0].x,i=p[o-1].x,n=W=>({x:W,y:y+g*W}),m=[n(h),n(i)],G=[];let C=null;const O=Math.max(0,Math.floor(Number(l)||0));if(O>0&&i>h){const W=(i-h)/(o-1);if(W>0&&(G.push(n(i),n(i+O*W)),o>2)){const oe=Number.isFinite(v.confidence)&&v.confidence>0&&v.confidence<1?Number(v.confidence):.95,_=1-(1-oe)/2,le=Math.max(0,P-g*c),ue=Math.sqrt(le/(o-2)),ge=I(_,o-2),ye=[];for(let be=0;be<=O;be++){const Me=i+be*W,je=y+g*Me,xe=1/o+(Me-s)**2/t,$e=ue*Math.sqrt(1+xe),Oe=ue*Math.sqrt(xe);ye.push({x:Me,mean:je,lower:je-ge*$e,upper:je+ge*$e,lowerMean:je-ge*Oe,upperMean:je+ge*Oe})}C={confidence:oe,points:ye}}}return{fit:m,forecast:G,band:C,stats:{method:"linear",slope:g,intercept:y,r2:j,n:o,forecast:G.length?O:0,confidence:C?C.confidence:null}}}function f(p,l){const v=Math.max(1,Math.floor(Number(l)||3)),o=[];let s=0;const b=[];for(const t of p)Number.isFinite(t.value)&&(o.push(t.value),s+=t.value,o.length>v&&(s-=o.shift())),o.length&&b.push({x:t.rawX,y:s/o.length});return b.length<2?null:{fit:b,stats:{method:"movingAverage",window:v}}}function J(p,l){const v=p.length,o=new Array(v).fill(null);let s=null,b=0;for(let t=0;t<v;t++){const c=p[t];if(!Number.isFinite(c)){s!==null&&(o[t]=s);continue}if(s===null){s=c,o[t]=c;continue}b+=(c-s)**2,s=l*c+(1-l)*s,o[t]=s}return{smoothed:o,sse:b}}function H(p,l,v){const o=p.length,s=new Array(o).fill(null);let b=null,t=null,c=0;for(let P=0;P<o;P++){const g=p[P];if(!Number.isFinite(g)){b!==null&&(b+=t,s[P]=b);continue}if(b===null){b=g,s[P]=g;continue}if(t===null){t=g-b;const h=b+t;c+=(g-h)**2;const i=b;b=l*g+(1-l)*(i+t),t=v*(b-i)+(1-v)*t,s[P]=b;continue}const y=b+t;c+=(g-y)**2;const j=b;b=l*g+(1-l)*(j+t),t=v*(b-j)+(1-v)*t,s[P]=b}return{smoothed:s,sse:c}}function e(p,l,v,o=80){const s=(Math.sqrt(5)-1)/2;let b=l,t=v,c=t-s*(t-b),P=b+s*(t-b),g=p(c),y=p(P);for(let j=0;j<o;j++)g<y?(t=P,P=c,y=g,c=t-s*(t-b),g=p(c)):(b=c,c=P,g=y,P=b+s*(t-b),y=p(P));return(b+t)/2}function u(p,l){const v=String(l.kind||l.model||"").toLowerCase()==="holt",o=p.map(y=>Number.isFinite(y.value)?y.value:null);if(o.filter(y=>y!==null).length<(v?2:1))return null;const b=y=>Math.min(q,Math.max(te,y));let t=Number.isFinite(l.alpha)?b(Number(l.alpha)):null,c=v&&Number.isFinite(l.beta)?b(Number(l.beta)):null;if(v){if(t===null||c===null){let y=t===null?.5:t,j=c===null?.5:c;for(let h=0;h<6;h++)t===null&&(y=e(i=>H(o,i,j).sse,te,q)),c===null&&(j=e(i=>H(o,y,i).sse,te,q));t=t===null?y:t,c=c===null?j:c}}else t===null&&(t=e(y=>J(o,y).sse,te,q));const P=v?H(o,t,c):J(o,t),g=[];for(let y=0;y<p.length;y++){const j=P.smoothed[y];j===null||!Number.isFinite(j)||g.push({x:p[y].rawX,y:j})}return g.length<2?null:{fit:g,stats:{method:"exponential",kind:v?"holt":"ses",alpha:t,beta:v?c:null}}}function k(p,l,v){if(l.method==="linear"){const s=$(p,v);return he(s,l.forecast,{confidence:l.confidence})}const o=R(p);return l.method==="movingAverage"?f(o,l.window||l.period):u(o,l)}function r(p,l,v,o,s,b){const t=l?` for ${l}`:"";if(p.method==="linear"){const y=Number.isFinite(p.r2)?`, R² ${p.r2.toFixed(2)}`:"";let j=`Trend (linear)${t}: slope ${v(p.slope)}${y}`;if(p.forecast>0&&o&&o.length){const h=o[o.length-1];if(j+=`; forecast ${p.forecast} step${p.forecast===1?"":"s"} ahead to ${v(h.y)}`,s&&s.points.length){const i=s.points[s.points.length-1],n=b==="confidence"||b==="mean",m=n?i.lowerMean:i.lower,G=n?i.upperMean:i.upper,C=n?"confidence":"prediction",O=Math.round(s.confidence*100);j+=`; ${O}% ${C} band ${v(m)} to ${v(G)} at the horizon`}}return j}if(p.method==="movingAverage")return`Trend (moving average, window ${p.window})${t}`;const c=p.kind==="holt"?"Holt":"single",P=Number.isFinite(p.alpha)?`, α ${p.alpha.toFixed(2)}`:"",g=Number.isFinite(p.beta)?`, β ${p.beta.toFixed(2)}`:"";return`Trend (exponential, ${c})${t}${P}${g}`}function w(p){const l=L(p.trend);if(!l.length)return[];const v=p.group.ownerDocument;let o=null;for(const t of p.group.childNodes||[])if(t&&String(t.getAttribute&&t.getAttribute("class"))===`${z}__trends`){o=t;break}o||(o=v.createElementNS(ae,"g"),o.setAttribute("class",`${z}__trends`),p.group.appendChild(o)),p.clip?o.setAttribute("clip-path",`url(#${p.clip})`):o.removeAttribute("clip-path");const s=new ee(o),b=[];for(const t of l)for(const c of p.series){const P=c.axis==="right"&&p.rightScale?p.rightScale:p.yScale,g=k(c,t,p.xScale);if(!g)continue;const y=p.scheme.series(c.index),j=[];for(const n of g.fit){const m=se(p.xScale,n.x),G=P.of(n.y);!Number.isFinite(m)||!Number.isFinite(G)||j.push(j.length?"L":"M",X(m),X(G))}if(j.length<4)continue;if(de(s.next("path",`${z}__trend`),{d:ce(j),fill:"none",stroke:y,"data-series":c.index}),t.band!==!1&&g.band&&g.band.points.length>=2){const n=t.band==="confidence"||t.band==="mean",m=[];for(const C of g.band.points){const O=se(p.xScale,C.x),W=n?C.lowerMean:C.lower,oe=n?C.upperMean:C.upper,_=P.of(W),le=P.of(oe);!Number.isFinite(O)||!Number.isFinite(_)||!Number.isFinite(le)||m.push({x:X(O),lower:X(_),upper:X(le)})}const G=Y(m);G&&de(s.next("path",`${z}__trend-band`),{d:G,fill:y,"fill-opacity":.15,stroke:"none","data-series":c.index})}const i=g.forecast||[];if(i.length>=2){const n=[];for(const m of i){const G=se(p.xScale,m.x),C=P.of(m.y);!Number.isFinite(G)||!Number.isFinite(C)||n.push(n.length?"L":"M",X(G),X(C))}n.length>=4&&de(s.next("path",`${z}__trend-forecast`),{d:ce(n),fill:"none",stroke:y,"data-series":c.index})}if(t.label!==!1&&g.stats.method==="linear"&&Number.isFinite(g.stats.r2)){const n=g.fit[g.fit.length-1],m=s.next("text",`${z}__trend-label`);d(m,p.size),de(m,{x:X(se(p.xScale,n.x)),y:X(P.of(n.y))-4,"text-anchor":"end",fill:y}),U(m,p.grid.messages.t("chart.r2",{value:S(p.grid,g.stats.r2)}))}b.push({text:r(g.stats,c.label,p.format,i,t.band===!1?null:g.band,t.band)})}return s.finish(),b.filter(t=>t.text)}}),Xe("packages/modules/charts/rulecolour.js",function(a,V){"use strict";Object.defineProperty(a,"colourOf",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"ruleColour",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"ruleLegend",{enumerable:!0,get:function(){return de}});const ve="*";function ee(ce){if(!ce||typeof ce!="object")return null;for(const Y of["background","backgroundColor","color"]){const X=ce[Y];if(typeof X=="string"&&X.trim())return X.trim()}return null}function M(ce){const{grid:Y,col:X,value:U}=ce;if(!Y||!X||!Y.formatting||typeof Y.formatting.styleFor!="function")return null;try{return ee(Y.formatting.styleFor(X,U))}catch{return null}}function de(ce){const{grid:Y,col:X}=ce,U=new Set([...ce.colours||[]].filter(Boolean));if(!U.size||!Y||!Y.formatting||typeof Y.formatting.list!="function")return[];let ae;try{ae=[...Y.formatting.list(ve)||[],...X?Y.formatting.list(X)||[]:[]]}catch{return[]}const N=[],d=new Set;for(const D of ae){if(!D||D.enabled===!1)continue;const z=ee(D.style);!z||!U.has(z)||d.has(z)||(d.add(z),N.push({key:D.id||`rule:${N.length}`,label:D.label||D.id||z,colour:z,index:N.length}))}return N}}),Xe("packages/modules/charts/cartesian.js",function(a,V){"use strict";Object.defineProperty(a,"CARTESIAN",{enumerable:!0,get:function(){return O}}),Object.defineProperty(a,"axisWindowSpan",{enumerable:!0,get:function(){return ue}}),Object.defineProperty(a,"rollingDomain",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(a,"WINDOW_LEAD",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(a,"aheadOfWindow",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(a,"staleWindow",{enumerable:!0,get:function(){return je}}),Object.defineProperty(a,"windowedBound",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(a,"drawFits",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(a,"drawConfidenceBand",{enumerable:!0,get:function(){return At}}),Object.defineProperty(a,"drawBoundErrorBars",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(a,"drawForest",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(a,"drawReferenceLines",{enumerable:!0,get:function(){return Ot}}),Object.defineProperty(a,"drawCartesian",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(a,"HIT_TOLERANCE",{enumerable:!0,get:function(){return It}}),Object.defineProperty(a,"nearestDrawnPoint",{enumerable:!0,get:function(){return Ht}}),Object.defineProperty(a,"nearestCategory",{enumerable:!0,get:function(){return Ye}}),Object.defineProperty(a,"categoryKeyAt",{enumerable:!0,get:function(){return qe}});const ve=V("packages/modules/charts/axis.js"),ee=ve.drawAxisLines,M=ve.drawAxisTitle,de=ve.drawBandLabels,ce=ve.drawCategoryAxis,Y=ve.drawContinuousAxis,X=ve.drawMeasureAxis,U=ve.overhangFor,ae=ve.setPlotClip,N=V("packages/modules/charts/frame.js"),d=N.Pool,D=N.shouldRotate,z=V("packages/modules/charts/format.js"),x=z.formatters,B=z.r2Digits,Q=V("packages/modules/charts/scale.js"),F=Q.bandScale,I=Q.extent,ne=Q.isNumber,S=Q.key,Z=Q.linearScale,te=Q.measureDomain,q=Q.timeScale,E=Q.toNumber,L=Q.toTime,se=V("packages/modules/charts/svg.js"),R=se.attrs,$=se.path,he=se.ribbonPath,f=se.round,J=se.setText,H=se.SVG_NS,u=V("packages/modules/charts/styles.js").NS,r=V("packages/modules/charts/labels.js").drawDataLabels,p=V("packages/modules/charts/dense.js").downsample,v=V("packages/modules/charts/scheme.js").resolveScheme,s=V("packages/modules/charts/typography.js").applySize,t=V("packages/modules/charts/combo.js").drawRightAxis,c=V("packages/modules/charts/annotations.js"),P=c.drawAnnotations,g=c.overlayLayer,j=V("packages/modules/charts/trendline.js").drawTrendlines,h=V("packages/modules/charts/rulecolour.js"),i=h.ruleColour,n=h.ruleLegend,G=V("packages/core/src/internal/util.js").warnOnce,C=3.5,O=Object.freeze({line:{zero:!1,marks:"path"},step:{zero:!1,marks:"path"},area:{zero:!0,marks:"path"},rangeArea:{zero:!1,marks:"path"},bar:{zero:!0,marks:"rect"},horizontalBar:{zero:!0,marks:"rect",horizontal:!0},waterfall:{zero:!0,marks:"rect"},scatter:{zero:!1,marks:"circle"},bubble:{zero:!1,marks:"circle"}});function W(A){const Ae=[];for(let pe=0;pe<A.length;pe++){const fe=A[pe];if(pe===0){Ae.push("M",fe.x,fe.y);continue}Ae.push("L",fe.x,A[pe-1].y),Ae.push("L",fe.x,fe.y)}return Ae}function oe(A,Ae,pe){if(pe)return[0,100];if(!Ae){const ke=[];for(const Le of A)for(const we of Le.points)ke.push(we.y);return ke}const fe=[],Ne=[],me=A[0]?A[0].points.length:0;for(let ke=0;ke<me;ke++){let Le=0,we=0;for(const _e of A){const Te=_e.points[ke]?_e.points[ke].y:null;ne(Te)&&(Te>=0?Le+=Te:we+=Te)}fe.push(Le),Ne.push(we)}return[...fe,...Ne]}function _(A){const Ae=[0];if(!A)return Ae;let pe=0;for(const fe of A.points)ne(fe.y)&&(pe+=fe.y,Ae.push(pe));return Ae}function le(A,Ae){const pe=new Float64Array(A),fe=new Float64Array(A);return{take(Ne,me){const ke=Ae?Ae[Ne]:0,Le=Ae?ke?me/ke*100:0:me;if(Le>=0){const _e=pe[Ne];return pe[Ne]+=Le,[_e,pe[Ne]]}const we=fe[Ne];return fe[Ne]+=Le,[we,fe[Ne]]}}}function ue(A){const Ae=A&&A.window;if(!Ae||typeof Ae!="object")return 0;const pe=Number(Ae.span);return!Number.isFinite(pe)||pe<=0?0:Ae.kind!=="time"?(G("chart.axis.window.kind",`axis window kind "${Ae.kind}" is not supported on a chart axis; only { kind: "time", span } rolls the domain. Bound the row count with the source's maxRows instead.`),0):pe}function ge(A,Ae,pe){const fe=pe+A*ye;let Ne=pe;for(const me of Ae)Number.isFinite(me)&&me>Ne&&me<=fe&&(Ne=me);return{min:Ne-A,max:Ne}}const ye=.25;function be(A,Ae,pe){const fe=ue(Ae);if(!fe||!A||!Array.isArray(A.categories))return null;const Ne=O[pe];if(!Ne||Ne.horizontal||pe==="bar"||A.kind==="category")return null;const me=A.categories.map(ke=>A.kind==="time"?L(ke):E(ke));return{span:fe,values:me}}function Me(A,Ae,pe,fe){const Ne=be(A,Ae,pe);if(!Ne)return null;const me=Ne.span*ye;let ke=0,Le=0;for(const we of Ne.values)we===null||!Number.isFinite(we)||we-fe<=me||(ke+=1,we-fe>Le&&(Le=we-fe));return ke?{span:Ne.span,limit:me,count:ke,lead:Le}:null}function je(A,Ae,pe,fe){const Ne=be(A,Ae,pe);if(!Ne)return null;const{span:me}=Ne,ke=Ne.values.filter(Te=>Te!==null&&Number.isFinite(Te));if(!ke.length)return null;const{min:Le,max:we}=ge(me,ke,fe);let _e=-1/0;for(const Te of ke){if(Te>=Le&&Te<=we)return null;Te<Le&&Te>_e&&(_e=Te)}return _e===-1/0?{span:me,newest:null,age:null,points:ke.length}:{span:me,newest:_e,age:fe-_e,points:ke.length}}function xe(A,Ae,pe,fe){const Ne=be(A,Ae,pe);if(!Ne)return A;const{span:me,values:ke}=Ne,Le=ke.filter(Fe=>Fe!==null&&Number.isFinite(Fe));if(!Le.length)return A;const{min:we,max:_e}=ge(me,Le,fe),Te=[];for(let Fe=0;Fe<ke.length;Fe++){const He=ke[Fe];(He===null||!Number.isFinite(He)||He>=we&&He<=_e)&&Te.push(Fe)}return Te.length===ke.length?A:{...A,categories:Te.map(Fe=>A.categories[Fe]),labels:Array.isArray(A.labels)?Te.map(Fe=>A.labels[Fe]):A.labels,series:(A.series||[]).map(Fe=>({...Fe,points:Array.isArray(Fe.points)?Te.map(He=>Fe.points[He]).filter(He=>He!==void 0):Fe.points})),windowed:ke.length-Te.length}}function $e(A,Ae,pe,fe){const Ne=[Ae.left,Ae.right],me=ue(fe);if(A.kind==="category"||pe==="bar")return me&&G("chart.axis.window.band","a rolling time window needs a continuous x axis; this chart bands its x values, so the window is ignored. Bind a date or numeric column to x."),F(A.categories,Ne,pe==="bar"?.2:.4);const ke=A.kind==="time"?A.categories.map(L):A.categories.map(E);if(A.kind==="time"&&!me){const we=I(ke);if(we&&we.min===we.max)return q({min:we.min-3e4,max:we.max+3e4},Ne)}const Le=me?ge(me,ke,Date.now()):te(ke,{zero:!1,nice:A.kind!=="time"});return A.kind==="time"?q(Le,Ne):Z(Le,Ne)}function Oe(A,Ae){if(A.kind==="band")return A.centre(Ae.x);const pe=A.kind==="time"?L(Ae.x):E(Ae.x);return pe===null?NaN:A.of(pe)}function Pe(A){const{series:Ae,xScale:pe,yScale:fe,baseline:Ne,fill:me,colour:ke,stack:Le}=A,we=[],_e=[];let Te=!1;const Fe=[];for(let Je=0;Je<Ae.points.length;Je++){const Ze=Ae.points[Je],st=f(Oe(pe,Ze));if(!ne(Ze.y)||Number.isNaN(st)){Te=!1;continue}Fe[Je]=!0;const at=Ze.y,lt=Le?Le.take(Je,at):null,rt=f(fe.of(lt?lt[1]:at)),ct=f(fe.of(lt?lt[0]:Ne));A.step&&Te&&we.push("L",st,A.previous),we.push(Te?"L":"M",st,rt),A.previous=rt,me&&_e.push(Te?"L":"M",st,rt),me&&!Te&&_e.push("M",st,rt),Te=!0,Ze.px=st,Ze.py=rt,Ze.pbase=ct}if(R(A.pool.next("path",`${u}__line ${u}__mark`),{d:we.length?$(we):"",stroke:ke,"data-series":A.index}),!me){De({...A,placed:Fe});return}const He=[];let Be=[];const et=()=>{if(Be.length<2){Be=[];return}He.push("M",Be[0].x,Be[0].base);for(const Je of Be)He.push("L",Je.x,Je.y);for(let Je=Be.length-1;Je>=0;Je--)He.push("L",Be[Je].x,Be[Je].base);He.push("Z"),Be=[]};for(const Je of Ae.points){if(!ne(Je.y)||Je.px===void 0){et();continue}Be.push({x:Je.px,y:Je.py,base:Je.pbase})}et(),R(A.pool.next("path",`${u}__area ${u}__mark`),{d:He.length?$(He):"",fill:ke,"data-series":A.index}),De({...A,placed:Fe})}function De(A){const{series:Ae,placed:pe}=A;for(let fe=0;fe<Ae.points.length;fe++){if(!pe[fe]||pe[fe-1]||pe[fe+1])continue;const Ne=Ae.points[fe];R(A.pool.next("circle",`${u}__point ${u}__mark`),{cx:Ne.px,cy:Ne.py,r:C,fill:A.colour,"data-series":A.index,"data-point":fe})}}function Ge(A,Ae){const pe=A&&A.range;if(!Array.isArray(pe)||pe.length!==2)return Ae;const[fe,Ne]=pe;return!Number.isFinite(fe)||!Number.isFinite(Ne)||!Number.isFinite(Ae)?Ae:Math.min(Math.max(fe,Ne),Math.max(Math.min(fe,Ne),Ae))}function Ve(A){const{series:Ae,xScale:pe,yScale:fe,baseline:Ne,colour:me,stack:ke,slot:Le}=A;for(let we=0;we<Ae.points.length;we++){const _e=Ae.points[we];if(!ne(_e.y))continue;const Te=pe.of(_e.x);if(Number.isNaN(Te))continue;const Fe=_e.y,He=A.pointColour&&A.pointColour(_e)||me,Be=ke?ke.take(we,Fe):[Ne,Fe],et=Ge(fe,fe.of(Be[1])),Je=Ge(fe,fe.of(Be[0])),Ze=A.pool.next("rect",`${u}__bar ${u}__mark`);R(Ze,{x:f(Te+Le.offset),y:f(Math.min(et,Je)),width:f(Math.max(0,Le.width)),height:f(Math.max(1,Math.abs(Je-et))),fill:He,"data-series":A.index,"data-point":we}),_e.px=f(Te+Le.offset+Le.width/2),_e.py=f(Math.min(et,Je)),_e.pbase=f(Math.max(et,Je))}}function it(A){const{series:Ae,xScale:pe,yScale:fe}=A;let Ne=0;for(let me=0;me<Ae.points.length;me++){const ke=Ae.points[me];if(!ne(ke.y))continue;const Le=ke.y,we=me===Ae.points.length-1,_e=A.total&&we?0:Ne,Te=(A.total&&we,Ne+Le);A.total,Ne+=Le;const Fe=Ge(fe,fe.of(Math.max(_e,Te))),He=Ge(fe,fe.of(Math.min(_e,Te))),Be=A.pool.next("rect",`${u}__bar ${u}__mark`);R(Be,{x:f(pe.of(ke.x)),y:f(Fe),width:f(pe.bandwidth),height:f(Math.max(1,He-Fe)),fill:Le>=0?A.positive:A.negative,"data-series":A.index,"data-point":me}),ke.px=f(pe.of(ke.x)+pe.bandwidth/2),ke.py=f(Fe)}}function gt(A){const{series:Ae,valueScale:pe,baseline:fe,colour:Ne,stack:me,slot:ke}=A;for(let Le=0;Le<Ae.points.length;Le++){const we=Ae.points[Le];if(!ne(we.y))continue;const _e=A.bandScale.of(we.x);if(Number.isNaN(_e))continue;const Te=we.y,Fe=A.pointColour&&A.pointColour(we)||Ne,He=me?me.take(Le,Te):[fe,Te],Be=Ge(pe,pe.of(He[0])),et=Ge(pe,pe.of(He[1]));R(A.pool.next("rect",`${u}__bar ${u}__mark`),{x:f(Math.min(Be,et)),y:f(_e+ke.offset),width:f(Math.max(1,Math.abs(et-Be))),height:f(Math.max(0,ke.width)),fill:Fe,"data-series":A.index,"data-point":Le}),we.px=f(et),we.py=f(_e+ke.offset+ke.width/2),we.pbase=f(Be)}}function ft(A){const Ae=A.group.ownerDocument;let pe=null;for(const me of A.group.childNodes||[])if(me&&String(me.getAttribute&&me.getAttribute("class"))===`${u}__fits`){pe=me;break}pe||(pe=Ae.createElementNS(H,"g"),pe.setAttribute("class",`${u}__fits`),A.group.appendChild(pe));const fe=new d(pe),Ne=[];for(const me of A.series){let ke=0,Le=0,we=0;for(const rt of me.points){const ct=Number(rt.x),St=Number(rt.y);!Number.isFinite(ct)||!Number.isFinite(St)||(ke++,Le+=ct,we+=St)}if(ke<2)continue;const _e=Le/ke,Te=we/ke;let Fe=0,He=0,Be=0,et=1/0,Je=-1/0;for(const rt of me.points){const ct=Number(rt.x),St=Number(rt.y);if(!Number.isFinite(ct)||!Number.isFinite(St))continue;const dt=ct-_e,bt=St-Te;Fe+=dt*dt,He+=dt*bt,Be+=bt*bt,ct<et&&(et=ct),ct>Je&&(Je=ct)}if(Fe===0)continue;const Ze=He/Fe,st=Te-Ze*_e,at=Be===0?1:Math.max(0,Math.min(1,He*He/(Fe*Be))),lt=A.scheme.series(me.index);if(R(fe.next("path",`${u}__fit`),{d:$(["M",f(A.xScale.of(et)),f(A.yScale.of(st+Ze*et)),"L",f(A.xScale.of(Je)),f(A.yScale.of(st+Ze*Je))]),fill:"none",stroke:lt,"data-series":me.index}),A.showR2){const rt=fe.next("text",`${u}__fit-label`);s(rt,A.size),R(rt,{x:f(A.xScale.of(Je)),y:f(A.yScale.of(st+Ze*Je))-4,"text-anchor":"end",fill:lt}),J(rt,A.grid.messages.t("chart.r2",{value:B(A.grid,at)}))}Ne.push({key:me.key,slope:Ze,intercept:st,r2:at,n:ke})}return fe.finish(),Ne}function At(A){const Ae=A.group.ownerDocument;let pe=null;for(const _e of A.group.childNodes||[])if(_e&&String(_e.getAttribute&&_e.getAttribute("class"))===`${u}__band`){pe=_e;break}pe||(pe=Ae.createElementNS(H,"g"),pe.setAttribute("class",`${u}__band`),A.group.firstChild?A.group.insertBefore(pe,A.group.firstChild):A.group.appendChild(pe));const fe=new d(pe),Ne=A.band&&Array.isArray(A.band.points)?A.band.points:[],me=Number.isFinite(A.index)?Number(A.index):0,ke=A.scheme.series(me),Le=Number.isFinite(A.opacity)?Number(A.opacity):.15,we=[];for(const _e of Ne){const Te=Number(_e.x),Fe=Number(_e.lower),He=Number(_e.upper);if(!Number.isFinite(Te)||!Number.isFinite(Fe)||!Number.isFinite(He))continue;const Be=Number(_e.yhat);we.push({x:f(A.xScale.of(Te)),lower:f(A.yScale.of(Fe)),upper:f(A.yScale.of(He)),yhat:Number.isFinite(Be)?f(A.yScale.of(Be)):null})}if(we.length>=2&&(R(fe.next("path",`${u}__band-fill`),{d:he(we),fill:ke,"fill-opacity":Le,stroke:"none","data-series":me}),A.line!==!1)){const _e=[];let Te=!1;for(const Fe of we){if(Fe.yhat===null){Te=!1;continue}_e.push(Te?"L":"M",Fe.x,Fe.yhat),Te=!0}R(fe.next("path",`${u}__band-line`),{d:_e.length?$(_e):"",fill:"none",stroke:ke,"data-series":me})}return fe.finish(),{points:we.length,confidence:A.band&&Number.isFinite(A.band.confidence)?Number(A.band.confidence):null}}function kt(A){const Ae=A.group.ownerDocument;let pe=null;for(const we of A.group.childNodes||[])if(we&&String(we.getAttribute&&we.getAttribute("class"))===`${u}__whiskers`){pe=we;break}pe||(pe=Ae.createElementNS(H,"g"),pe.setAttribute("class",`${u}__whiskers`),A.group.appendChild(pe));const fe=new d(pe),Ne=Number.isFinite(A.cap)?Number(A.cap):4,me=A.colour||"currentColor",ke=A.orient!=="v";let Le=0;for(const we of A.points||[]){const _e=Number(we.main),Te=Number(we.lo),Fe=Number(we.hi);if(!Number.isFinite(_e)||!Number.isFinite(Te)||!Number.isFinite(Fe))continue;const He=ke?["M",Te,_e,"L",Fe,_e,"M",Te,_e-Ne,"L",Te,_e+Ne,"M",Fe,_e-Ne,"L",Fe,_e+Ne]:["M",_e,Te,"L",_e,Fe,"M",_e-Ne,Te,"L",_e+Ne,Te,"M",_e-Ne,Fe,"L",_e+Ne,Fe];R(fe.next("path",`${u}__whisker`),{d:$(He),stroke:me,fill:"none"}),Le++}return fe.finish(),Le}function Tt(A){const Ae=A.scheme||v(),pe=A.typography||{small:A.fontSize||11,axisTitle:11},{plot:fe,bound:Ne}=A,me=Ne.series[0]&&Ne.series[0].points||[],ke=me.map(Be=>Be.label),Le=Ae.series(0),we=F(ke,[fe.top,fe.bottom],.4),_e=[0];for(const Be of me)for(const et of[Be.x,Be.lower,Be.upper])Number.isFinite(et)&&_e.push(et);const Te=Z(te(_e,{zero:!1}),[fe.left,fe.right]);kt({group:A.groups.overlay,orient:"h",colour:Le,points:me.map(Be=>({main:f(we.centre(Be.label)),lo:f(Te.of(Be.lower)),hi:f(Te.of(Be.upper))}))});const Fe=new d(A.groups.marks);let He=0;for(const Be of me)Number.isFinite(Be.x)&&(R(Fe.next("circle",`${u}__point ${u}__mark`),{cx:f(Te.of(Be.x)),cy:f(we.centre(Be.label)),r:C,fill:Le}),He++);return Fe.finish(),Ot({group:A.groups.rules,plot:fe,scale:Te,lines:[{value:0}]}),Y({group:A.groups.axis,plot:fe,scale:Te,format:x(A.grid,{kind:"linear",step:(Te.domain.max-Te.domain.min)/5}),config:{},grid:A.grid,size:pe.small}),de({group:A.groups.labels,plot:fe,scale:we,labels:ke,fontSize:pe.small,config:{}}),{series:[],marks:He}}function Ot(A){const Ae=new d(g(A.group,`${u}__reflines`));for(const pe of A.lines||[]){if(!ne(pe.value))continue;const fe=f(A.scale.of(pe.value));if(R(Ae.next("path",`${u}__reference`),{d:$(["M",f(A.plot.left),fe,"L",f(A.plot.right),fe]),stroke:pe.colour||"currentColor","stroke-dasharray":"4 3",fill:"none"}),!pe.label)continue;const Ne=Ae.next("text",`${u}__reference-label`);R(Ne,{x:f(A.plot.right-4),y:fe-4,"text-anchor":"end"}),J(Ne,pe.label)}Ae.finish()}function jt(A){const{series:Ae,xScale:pe,yScale:fe,colour:Ne}=A,me=A.size||null;for(let ke=0;ke<Ae.points.length;ke++){const Le=Ae.points[ke];if(!ne(Le.y))continue;const we=f(Oe(pe,Le));if(Number.isNaN(we))continue;const _e=f(fe.of(Le.y));R(A.pool.next("circle",`${u}__point ${u}__mark`),{cx:we,cy:_e,r:me&&ne(Le.size)?f(me.of(Le.size)):C,fill:Ne,"fill-opacity":me?.7:1,"data-series":A.index,"data-point":ke}),Le.px=we,Le.py=_e}}function Kt(A){const{group:Ae,series:pe,xScale:fe,yScale:Ne,options:me}=A,ke=A.grid&&A.grid.statistics,Le=ke&&typeof ke.intervalOf=="function"?(Je,Ze)=>ke.intervalOf(Je,Ze):null,we=new d(g(Ae,`${u}__errorbars`)),_e=Number.isFinite(Number(me.confidence))?Number(me.confidence):.95,Te=4;let Fe=0,He=0,Be=0,et=0;for(const Je of pe)for(const Ze of Je.points){if(Ze.y===null||Ze.y===void 0)continue;He++;const st=Array.isArray(Ze.values)&&Ze.values.length===1;st&&Be++;let at=null,lt=null;if(me.of!==void 0&&Number.isFinite(Number(Ze[me.of]))){const dt=Math.abs(Number(Ze[me.of]));at=Ze.y-dt,lt=Ze.y+dt}else if(Array.isArray(Ze.values)&&Ze.values.length>1&&Le){const dt=Le(Ze.values,_e);dt&&(at=dt.lower,lt=dt.upper)}if(at===null||!Number.isFinite(at)||!Number.isFinite(lt)){st&&et++;continue}const rt=f(fe.of(Ze.xKey!==void 0?Ze.xKey:Ze.x)+(fe.bandwidth?fe.bandwidth/2:0)),ct=f(Ne.of(lt)),St=f(Ne.of(at));R(we.next("path",`${u}__error-bar ${u}__mark`),{d:$(["M",rt-Te,ct,"L",rt+Te,ct,"M",rt,ct,"L",rt,St,"M",rt-Te,St,"L",rt+Te,St]),fill:"none",stroke:"currentColor","data-lower":at,"data-upper":lt}),Fe++}return we.finish(),{drawn:Fe,marks:He,single:Be,singleSkipped:et}}function zt(A){const Ae=A.scheme||v(),pe=A.axis||{x:{},y:{},y2:{}},fe=A.typography||{small:A.fontSize||11,axisTitle:11},{bound:Ne,plot:me,type:ke}=A,Le=O[ke]||O.line,we=Ne.series.filter(Qe=>!A.hidden.has(Qe.key)),_e=!!Le.horizontal,Te=(ke==="bar"||ke==="horizontalBar")&&A.byRuleColour&&we.length===1&&Ne.measure&&Ne.measure.col||null,Fe=Te?new Set:null,He=Te?Qe=>{const nt=i({grid:A.grid,col:Te,value:Qe.y});return nt&&Fe.add(nt),nt}:null,et=(ke==="bar"||ke==="horizontalBar")&&A.byRuleColour&&we.length===1&&Ae.nameMap?Qe=>Ae.series(0,Qe.label):null,Je=He||et?Qe=>He&&He(Qe)||et&&et(Qe)||null:null,Ze=!_e&&ke!=="waterfall"?we.filter(Qe=>Qe.axis==="right"):[],st=Ze.length?we.filter(Qe=>Qe.axis!=="right"):we,at=Ze.length>0,lt=(ke==="bar"||ke==="area"||ke==="horizontalBar")&&!at,rt=A.stack==="percent"&&lt&&st.length>1,ct=(rt||!!A.stack)&&st.length>1&&lt,St=ke==="waterfall"?_(we[0]):oe(st,ct,rt),dt=A.domain||te(St,{zero:Le.zero,min:pe.y.min,max:pe.y.max}),bt=_e?Z(dt,[me.left,me.right]):Z(dt,[me.bottom,me.top]),ot=_e?F(Ne.categories,[me.top,me.bottom],.2):$e(Ne,me,ke,pe.x),Dt=dt.min<=0&&dt.max>=0?0:dt.min,an=Ze.some(Qe=>(Qe.mark||(ke==="bar"?"bar":ke))==="bar"),Rt=at?te(oe(Ze,!1,!1),{zero:an,min:pe.y2.min,max:pe.y2.max}):null,Mt=Rt?Z(Rt,[me.bottom,me.top]):null,Vt=x(A.grid,{kind:"linear",step:(dt.max-dt.min)/5}),Ft=A.axes!==!1;if(Ft&&X({gridGroup:A.groups.grid,axisGroup:A.groups.axis,plot:me,scale:bt,format:Vt,horizontal:_e,config:pe.y,grid:A.grid,size:fe.small}),Ft&&(_e?de({group:A.groups.overlay,plot:me,scale:ot,labels:Ne.labels,fontSize:fe.small,config:pe.x}):ot.kind==="band"?ce({group:A.groups.overlay,plot:me,scale:ot,labels:Ne.labels,fontSize:fe.small,rotated:D(Ne.labels,ot.step,fe.small,pe.x.every),config:pe.x}):Y({group:A.groups.overlay,plot:me,scale:ot,format:x(A.grid,{kind:Ne.kind,span:ot.domain.max-ot.domain.min,step:(ot.domain.max-ot.domain.min)/5}),config:pe.x,grid:A.grid,size:fe.small})),Ft&&(ee({group:A.groups.rules,plot:me}),M({group:A.groups.axis,plot:me,text:pe.y.title,side:_e?"bottom":"left",size:fe.axisTitle}),M({group:A.groups.axis,plot:me,text:pe.x.title,side:_e?"left":"bottom",size:fe.axisTitle})),Ft&&Mt){t({group:A.groups.axis,plot:me,scale:Mt,colour:Ae.series(Ze[0].index),format:x(A.grid,{kind:"linear",step:(Rt.max-Rt.min)/5})});const Qe=pe.y2.title||(Ze.length===1?Ze[0].label:"");M({group:A.groups.axis,plot:me,text:Qe,side:"right",size:fe.axisTitle}),!pe.y.title&&st.length===1&&st[0].label&&M({group:A.groups.axis,plot:me,text:st[0].label,side:"left",size:fe.axisTitle})}const Qt=Number.isFinite(A.downsampleTo)?Number(A.downsampleTo):Math.max(2,Math.round(me.width));let Yt=!1;if(Le.marks==="path"||ke==="scatter"||ke==="bubble"){for(const Qe of we)if(Qe.kept=null,Qe.points.length>Qt*1.5){const nt=Qe.points.map((wt,Pt)=>({x:Pt,y:wt.y,point:wt})),pt=p(nt,Qt);Qe.points=pt.map(wt=>wt.point),Qe.kept=pt.map(wt=>wt.x),Yt=!0}}A.pool||ae(A.groups,me,U(ke));const Nt=A.pool||new d(A.groups.marks),Xt=rt?Ne.categories.map((Qe,nt)=>we.reduce((pt,wt)=>{const Pt=wt.points[nt]?wt.points[nt].y:null;return ne(Pt)?pt+Math.abs(Pt):pt},0)):null,Zt=ct?le(Ne.categories.length,Xt):null,qt=at?we.filter(Qe=>(Qe.mark||(ke==="bar"?"bar":ke))==="bar"):we,en=at?Math.max(1,qt.length):Math.max(1,we.length),Ut=ot.kind==="band"?ct?ot.bandwidth:ot.bandwidth/en:0,Gt=new Map;for(const Qe of qt)Gt.set(Qe.key,Gt.size);for(let Qe=0;Qe<we.length;Qe++){const nt=we[Qe],pt=Ae.series(nt.index,nt.label),wt=nt.axis==="right"&&Mt?Mt:bt,Pt=at?nt.mark||(ke==="bar"?"bar":ke):ke,nn=at&&Gt.has(nt.key)?Gt.get(nt.key):Qe;ke==="horizontalBar"?gt({pool:Nt,series:nt,bandScale:ot,valueScale:bt,baseline:Dt,colour:pt,stack:Zt,index:nt.index,slot:{offset:ct?0:Qe*Ut,width:Ut},pointColour:Je}):ke==="waterfall"?it({pool:Nt,series:nt,xScale:ot,yScale:bt,index:nt.index,total:!0,positive:Ae.positive,negative:Ae.negative}):Pt==="bar"?Ve({pool:Nt,series:nt,xScale:ot,yScale:wt,baseline:wt===Mt?Rt.min<=0&&Rt.max>=0?0:Rt.min:Dt,colour:pt,stack:Zt,index:nt.index,slot:{offset:ct?0:nn*Ut,width:Ut},pointColour:Je}):ke==="scatter"||ke==="bubble"?jt({pool:Nt,series:nt,xScale:ot,yScale:wt,colour:pt,index:nt.index,size:ke==="bubble"?A.sizes:null}):Pe({pool:Nt,series:nt,xScale:ot,yScale:wt,baseline:Dt,fill:Pt==="area"||Pt==="rangeArea",step:Pt==="step",colour:pt,stack:Zt,index:nt.index})}A.pool||Nt.finish(),A.band&&typeof ot.invert=="function"&&At({group:A.groups.overlay,band:A.band,xScale:ot,yScale:bt,scheme:Ae,index:0,line:A.band.line!==!1&&!A.fit}),A.fit&&(ke==="scatter"||ke==="bubble")&&typeof ot.invert=="function"&&ft({group:A.groups.overlay,series:we,xScale:ot,yScale:bt,plot:me,scheme:Ae,grid:A.grid,size:fe.small,showR2:A.fit!=="line"});let Bt=null;A.trend&&(Bt=j({group:A.groups.overlay,series:we,xScale:ot,yScale:bt,rightScale:Mt,plot:me,scheme:Ae,trend:A.trend,grid:A.grid,format:Qe=>Vt.tick(Qe),size:fe.small,clip:A.groups.boxClipId}));let Jt=null;if(A.error&&(Jt=Kt({group:A.groups.overlay,series:we,xScale:ot,yScale:bt,grid:A.grid,options:A.error===!0?{}:A.error})),A.labels&&A.labels.show&&r({group:A.groups.labels,series:we,plot:me,options:A.labels,grid:A.grid,size:fe.small,horizontal:_e}),A.reference&&A.reference.length){const Qe=A.reference.filter(pt=>!(pt.axis==="right"||pt.axis==="y2")),nt=Mt?A.reference.filter(pt=>pt.axis==="right"||pt.axis==="y2"):[];Qe.length&&Ot({group:A.groups.overlay,plot:me,scale:bt,lines:Qe}),nt.length&&Ot({group:A.groups.overlay,plot:me,scale:Mt,lines:nt})}let Wt=null;A.annotations&&A.annotations.length&&(Wt=P({group:A.groups.overlay,plot:me,xScale:ot,yScale:bt,rightScale:Mt,series:we,annotations:A.annotations,dual:at,format:Qe=>Vt.tick(Qe),size:fe.small}));const tn=Array.isArray(Bt)&&Bt.length?[...Wt||[],...Bt]:Wt;return{xScale:ot,yScale:bt,rightScale:Mt,dual:at,series:we,horizontal:_e,percent:rt,plot:me,errorBars:Jt,annotations:tn,trendlines:Bt,reduced:Yt,legend:Te?n({grid:A.grid,col:Te,colours:Fe}):null}}const It=32;function Ht(A){const{series:Ae,xScale:pe,at:fe}=A,Ne=Number.isFinite(A.tolerance)?Number(A.tolerance):It,me=[];let ke=-1,Le=1/0;for(const we of Ae){let _e=null,Te=-1,Fe=1/0;const He=we.points||[];for(let Be=0;Be<He.length;Be++){const et=He[Be];if(!et||!ne(et.y))continue;const Je=Oe(pe,et);if(Number.isNaN(Je))continue;const Ze=Math.abs(Je-fe);Ze>=Fe||(Fe=Ze,_e=et,Te=Array.isArray(we.kept)?we.kept[Be]:Be)}!_e||Fe>Ne||(me.push({series:we,point:_e}),Fe<Le&&(Le=Fe,ke=Te))}return ke<0?null:{index:ke,entries:me}}function Ye(A){const{bound:Ae,xScale:pe,at:fe}=A;if(!Ae.categories.length)return-1;if(pe.kind==="band"){const ke=Math.floor((fe-pe.range[0])/(pe.step||1));return ke>=0&&ke<Ae.categories.length?ke:-1}let Ne=-1,me=1/0;for(let ke=0;ke<Ae.categories.length;ke++){const Le=pe.kind==="time"?L(Ae.categories[ke]):E(Ae.categories[ke]);if(Le===null)continue;const we=Math.abs(pe.of(Le)-fe);we<me&&(me=we,Ne=ke)}return Ne}function qe(A,Ae){return Ae<0||Ae>=A.categories.length?"":S(A.categories[Ae])}}),Xe("packages/modules/charts/drawable.js",function(a,V){"use strict";Object.defineProperty(a,"REASONS",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"DRAWABLE",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"namedColumns",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(a,"missingColumns",{enumerable:!0,get:function(){return N}}),Object.defineProperty(a,"bucketKey",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"bucketMessage",{enumerable:!0,get:function(){return D}}),Object.defineProperty(a,"continuousX",{enumerable:!0,get:function(){return z}}),Object.defineProperty(a,"drawability",{enumerable:!0,get:function(){return x}});const ve=V("packages/modules/charts/scale.js"),ee=ve.extent,M=ve.toNumber,de=ve.toTime,Y=V("packages/modules/charts/cartesian.js").staleWindow,X=Object.freeze({EMPTY:"empty",INCOMPLETE:"incomplete",STALE:"stale",MISSING_COLUMN:"missing-column",NO_DOMAIN:"no-domain",BUCKETED:"bucketed"}),U=Object.freeze({ok:!0});function ae(B){if(!B||typeof B!="object")return[];const Q=[],F=(I,ne)=>{typeof ne=="string"&&ne?Q.push({key:I,col:ne}):ne&&typeof ne=="object"&&typeof ne.col=="string"&&ne.col&&Q.push({key:I,col:ne.col})};if(Array.isArray(B.points))return[];if(F("x",B.x),F("code",B.code),F("y",B.y),F("series",B.series),F("size",B.size),F("source",B.source),F("target",B.target),typeof B.multiples=="string"&&F("multiples",B.multiples),Array.isArray(B.measures))for(const I of B.measures)F("measures",I);return Q}function N(B,Q){const F=B&&B.columns;return!F||typeof F.get!="function"?[]:ae(Q).filter(({col:I})=>!F.get(I))}function d(B){return`chart:x:date-bucket:${B}`}function D(B,Q,F){return`chart x column ${JSON.stringify(B)} is a 'date', which stores a calendar day, so all ${Q} rows collapsed into one point and were reduced by '${F}'. For a series inside a single day, type the column 'datetime' or bind epoch milliseconds.`}function z(B,Q){return!Q||Q.kind!=="time"&&Q.kind!=="linear"?!1:B!=="bar"&&B!=="horizontalBar"}function x(B){const{grid:Q,spec:F,type:I,bound:ne}=B,S=B.id===void 0?"":String(B.id),Z=Number.isFinite(B.now)?Number(B.now):Date.now(),te=(L,se,R,$=!0)=>({ok:!1,reason:L,key:R||`chart:${S}:${L}`,message:se,tell:$}),q=N(Q,F);if(q.length){const L=q.map(R=>`${R.key}: ${JSON.stringify(R.col)}`).join(", "),se=Q&&Q.columns&&typeof Q.columns.all=="function"?Q.columns.all().map(R=>R.id||R.field).filter(Boolean):[];return te(X.MISSING_COLUMN,`chart ${L} ${q.length>1?"name columns":"names a column"} this grid does not have, so there is nothing to read and nothing to draw.${se.length?` The columns it does have: ${se.slice(0,12).map(R=>JSON.stringify(R)).join(", ")}${se.length>12?", …":""}.`:""} Bind a column the grid declares, or declare the column.`)}if(ne&&ne.empty){const L=Q&&Q.rows&&typeof Q.rows.count=="function"?Q.rows.count():0;return te(X.EMPTY,L?`chart bound nothing from the ${L} row(s) the grid is showing, so it shows its empty state. The binding named no series to draw: check that the spec names the columns this chart needs — a flow type needs source and target, a measure needs a column with values in it.`:"chart has no rows to draw, so it shows its empty state.",void 0,L>0)}if(I==="candlestick"&&(!ne||!ne.series||ne.series.length<4)){const L=ne&&ne.series?ne.series.length:0;return te(X.INCOMPLETE,`a candlestick chart needs four measures — open, high, low and close, in that order — and ${L===0?"none was":`only ${L} were`} bound. Pass them as measures: [open, high, low, close].`)}const E=Y(ne,B.axis&&B.axis.x,I,Z);if(E){const L=E.newest===null?"and every one of them is stamped ahead of it":`and the newest of ${E.points} x value(s) is ${Math.round(E.age/1e3)}s old`;return te(X.STALE,`the rolling x window covers the last ${E.span} ms, ${L}, so every mark would be drawn outside the plot. The chart shows its empty state instead. Seed it with data inside the window, widen axis.x.window.span, or drop the window while showing history.`,`chart:${S}:x:window:stale:${F&&F.x||""}`,E.newest!==null)}if(z(I,ne)){const L=Array.isArray(ne.categories)?ne.categories:[],se=ne.kind==="time"?L.map(de):L.map(M);if(L.length&&!ee(se)){const R=F&&typeof F.x=="string"&&F.x||ne.dimension&&ne.dimension.col||"";return te(X.NO_DOMAIN,`chart x ${R?`column ${JSON.stringify(R)} `:""}is drawn on a ${ne.kind==="time"?"time":"continuous"} axis, and not one of its ${L.length} value(s) reads as a ${ne.kind==="time"?"date":"number"} — so the axis would be drawn over a domain invented from nothing rather than measured from the data. Remove axis.x.scale to let the column choose its own scale, or type the column so its values parse.`)}}if(ne&&ne.bucketed&&z(I,ne)){const{col:L,rows:se,fn:R}=ne.bucketed;return te(X.BUCKETED,D(L,se,R),d(L))}return U}}),Xe("packages/modules/charts/bind.js",function(a,V){"use strict";Object.defineProperty(a,"AGGREGATIONS",{enumerable:!0,get:function(){return N}}),Object.defineProperty(a,"DEFAULT_AGGREGATION",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"resolveAggregation",{enumerable:!0,get:function(){return D}}),Object.defineProperty(a,"defaultAggregationFor",{enumerable:!0,get:function(){return z}}),Object.defineProperty(a,"measureOf",{enumerable:!0,get:function(){return x}}),Object.defineProperty(a,"walkRows",{enumerable:!0,get:function(){return B}}),Object.defineProperty(a,"leafRows",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(a,"selectedRows",{enumerable:!0,get:function(){return F}}),Object.defineProperty(a,"topGroups",{enumerable:!0,get:function(){return I}}),Object.defineProperty(a,"forcedScaleKind",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"scaleKindFor",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"bindSeries",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"bindPoints",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"bindMeasures",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"bindLinks",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"bindHierarchy",{enumerable:!0,get:function(){return H}});const ve=V("packages/modules/charts/scale.js"),ee=ve.key,M=ve.toNumber,de=ve.toTime,ce=V("packages/modules/charts/drawable.js"),Y=ce.bucketKey,X=ce.bucketMessage,ae=V("packages/core/src/internal/util.js").warnOnce,N={sum:e=>e.length?e.reduce((u,k)=>u+k,0):null,avg:e=>e.length?e.reduce((u,k)=>u+k,0)/e.length:null,mean:e=>e.length?e.reduce((u,k)=>u+k,0)/e.length:null,min:e=>{let u=null;for(let k=0;k<e.length;k++)(u===null||e[k]<u)&&(u=e[k]);return u},max:e=>{let u=null;for(let k=0;k<e.length;k++)(u===null||e[k]>u)&&(u=e[k]);return u},median:e=>{if(!e.length)return null;const u=e.slice().sort((p,l)=>p-l),k=(u.length-1)/2,r=Math.floor(k),w=Math.ceil(k);return r===w?u[r]:(u[r]+u[w])/2},count:(e,u)=>u,countValues:e=>e.length,first:e=>e.length?e[0]:null,last:e=>e.length?e[e.length-1]:null},d="sum";function D(e){return e==null?d:typeof e=="string"&&e in N?e:(ae(`chart:measure:fn:${String(e)}`,`chart measure fn ${JSON.stringify(e)} is not a known aggregation; using '${d}'. Supported: ${Object.keys(N).join(", ")}.`),d)}function z(e){if(!e)return d;const u=e.groupTotal??e.total;if(typeof u=="string"&&u in N)return u;const k=e.dataType&&e.dataType.totals?e.dataType.totals.supported:null;if(Array.isArray(k)&&!k.includes(d)){const r=["avg","mean","max","min","countValues","count"].find(w=>k.includes(w)&&w in N);if(r)return r}return d}function x(e,u){const k=z(u);return e?typeof e=="string"?{col:e,fn:k}:{col:e.col||null,fn:e.fn==null?k:D(e.fn)}:{col:null,fn:k}}function B(e,u){const k=new Set,r=w=>{if(!w||k.has(w)||(k.add(w),u(w),!w.group)||w.expanded)return;const p=w.filteredChildren||w.children;if(Array.isArray(p))for(const l of p)r(l)};e.rows.forEach(r)}function Q(e){const u=[];return B(e,k=>{!k.group&&k.data!==null&&k.data!==void 0&&u.push(k)}),u}function F(e){const u=new Set(e.selection.keys());if(!u.size)return[];const k=[];return B(e,r=>{!r.group&&u.has(r.key)&&k.push(r)}),k}function I(e){const u=[];let k=1/0;return B(e,r=>{r.group&&(r.level<k&&(k=r.level,u.length=0),r.level===k&&u.push(r))}),u}function ne(e,u,k){return u.group&&u.totals&&k in u.totals?M(u.totals[k]):M(e.rows.value(u.key,k))}function S(e,u,k,r){if(!u.group){const w=e.rows.text(u.key,k);if(w)return w}return r==null?"":r instanceof Date?r.toISOString().slice(0,10):String(r)}function Z(e,u){return(N[u]||N[d])(e.values,e.rows)}const te=Object.freeze(["number","currency","percent"]),q=Object.freeze(["date","datetime","timestamp","dateString"]),E=Object.freeze({auto:"",band:"category",category:"category",linear:"linear",time:"time"});function L(e){const u=e&&typeof e=="object"?e.axis:null;if(!u||typeof u!="object")return"";const k=u.x;if(!k||typeof k!="object")return"";const r=typeof k.scale=="string"?k.scale:"";return r?Object.hasOwn(E,r)?E[r]:(ae(`chart:x:scale:unknown:${r}`,`chart axis.x.scale ${JSON.stringify(r)} is not a scale this chart draws. Use one of: ${Object.keys(E).join(", ")}. The scale was chosen from the column instead.`),""):""}function se(e){if(e.length<3)return"";let u=0,k=0;for(const r of e){if(r==null||r===""||typeof r=="boolean")return"";M(r)!==null?u++:typeof r=="string"&&de(r)!==null&&k++}return k===e.length?"time":u===e.length?"linear":""}function R(e,u,k={}){if(k.forced)return k.forced;const r=e&&typeof e.type=="string"?e.type:"";if(q.includes(r)||u.length&&u.every(l=>l instanceof Date))return"time";if(te.includes(r))return"linear";const w=k.id?String(k.id):"";if(!w)return"category";const p=r&&r!=="text"?"":se(u);return p&&ae(`chart:x:banded:${w}`,`chart x column ${JSON.stringify(w)} is typed ${JSON.stringify(r||"text")}, so its ${u.length} values are drawn as categories on a band scale even though they all read as ${p==="time"?"dates":"numbers"}. Type the column ${p==="time"?"'date' (or 'datetime'/'timestamp'/'dateString')":"'number'"} for a continuous axis, or pin it with axis: { x: { scale: '${p}' } }.`),"category"}function $(e,u){const k=u.x||null,r=u.series||(typeof u.multiples=="string"?u.multiples:null)||null,w=e.columns,p=k?w.get(k):void 0,l=x(u.y),v=l.col?w.get(l.col):void 0,o=x(u.y,v);let s;const b=typeof u.rows=="function"?u.rows(e):u.rows;Array.isArray(b)?s=b:u.from==="groups"?s=I(e):u.from==="selection"?s=F(e):s=Q(e);const t=s.length?s:Q(e),c=new Map,P=new Map,g=[];for(let C=0;C<t.length;C++){const O=t[C],W=k?O.group&&O.groupColumn===k?O.groupValue:e.rows.value(O.key,k):C,oe=ee(W);c.has(oe)||(c.set(oe,{value:W,label:k?S(e,O,k,W):String(C),order:c.size}),g.push(W));const _=r?O.group&&O.groupColumn===r?O.groupValue:e.rows.value(O.key,r):null,le=r?ee(_):"";P.has(le)||P.set(le,{label:r?S(e,O,r,_):v?.title||"",points:new Map});const ue=P.get(le);let ge=ue.points.get(oe);ge||(ge={values:[],rows:0,rowKey:O.key},ue.points.set(oe,ge)),ge.rows+=O.group&&O.leafCount||1;const ye=o.col?ne(e,O,o.col):null;if(ye!==null&&ge.values.push(ye),u.size){const be=M(e.rows.value(O.key,u.size));be!==null&&(ge.sizes=(ge.sizes||0)+be)}}const y=[...c.values()].sort((C,O)=>C.order-O.order),j=typeof u.limit=="number"&&u.limit>0?y.slice(0,u.limit):y,h=R(p,g,{forced:L(u),id:k});let i=null;h==="time"&&t.length>1&&c.size===1&&p&&(p.type==="date"||p.type==="dateString")&&(i={col:String(k),rows:t.length,fn:o.fn},ae(Y(i.col),X(i.col,i.rows,i.fn)));const m=te.includes(p&&typeof p.type=="string"?p.type:"")?[...j].sort((C,O)=>(M(C.value)??0)-(M(O.value)??0)):j,G=[...P.entries()].map(([C,O],W)=>({key:C,label:O.label,index:W,points:m.map(oe=>{const _=ee(oe.value),le=O.points.get(_);return{x:oe.value,xKey:_,label:oe.label,y:le?Z(le,o.fn):null,size:le&&le.sizes!==void 0?le.sizes:null,rows:le?le.rows:0,rowKey:le?le.rowKey:null,values:le&&le.values?le.values:null}})}));return{series:G,categories:m.map(C=>C.value),labels:m.map(C=>C.label),kind:h,measure:{...o,title:v?.title||o.col||""},dimension:{col:k,title:p?.title||k||""},empty:G.length===0||m.length===0,rows:t.length,truncated:y.length-m.length,bucketed:i}}function he(e){const u=Array.isArray(e.points)?e.points:[],k=u.length>0&&u.every(p=>typeof p.x=="number"&&Number.isFinite(p.x)),r=p=>typeof p=="number"&&Number.isFinite(p)?p:null,w=u.map((p,l)=>({x:p.x,xKey:ee(p.x),label:p.label!=null?String(p.label):String(p.x),y:r(p.y),size:r(p.size),lower:r(p.lower),upper:r(p.upper),rows:1,rowKey:p.key!=null?String(p.key):String(l),values:null}));return{series:[{key:e.seriesKey||"",label:e.seriesLabel||"",index:0,points:w}],categories:w.map(p=>p.x),labels:w.map(p=>p.label),kind:k?"linear":"category",measure:{col:null,fn:"sum",title:e.measureTitle||""},dimension:{col:null,title:e.dimensionTitle||""},empty:w.length===0,rows:w.length,truncated:0}}function f(e,u){const k=Array.isArray(u.measures)?u.measures:[];if(!k.length)return $(e,u);const r=k.map(v=>{const o=typeof v=="string"?{col:v}:v;return{spec:o,result:$(e,{x:u.x,from:u.from,limit:u.limit,axis:u.axis,y:{col:o.col,fn:o.fn}})}}),w=r[0].result,p=new Map(w.categories.map((v,o)=>[ee(v),o])),l=r.map(({spec:v,result:o},s)=>{const b=e.columns.get(v.col),t=w.categories.map(()=>null),c=o.series[0];if(c)for(const P of c.points){const g=p.get(P.xKey);g!==void 0&&(t[g]=P)}return{key:v.col,label:v.title||v.label||b&&b.title||v.col,index:s,mark:v.type||null,axis:v.axis==="right"?"right":"left",points:w.categories.map((P,g)=>t[g]||{x:P,xKey:ee(P),label:w.labels[g],y:null,rows:0,rowKey:null})}});return{series:l,categories:w.categories,labels:w.labels,kind:w.kind,measure:{col:null,fn:"sum",title:l.map(v=>v.label).join(", ")},dimension:w.dimension,empty:!l.length||!w.categories.length,rows:w.rows,truncated:w.truncated}}function J(e,u,k={}){const r=x(u.y),w=!!k.perRow,p=Array.isArray(k.nodes)?k.nodes:[],l=u.source||u.x||null,v=u.target||null;if(!l||!v)return{nodes:[],links:[],measure:{...r,title:""},dimension:{col:null,title:""},series:[],categories:[],labels:[],empty:!0,total:0};const o=r.col?e.columns.get(r.col):void 0,s=new Map,b=new Map,t=(y,j,h)=>{const i=ee(y);return s.has(i)||s.set(i,{key:i,value:y,label:S(e,j,h,y),index:s.size,in:0,out:0}),s.get(i)},c=new Map;for(const y of p)!y||y.id===null||y.id===void 0||c.set(ee(y.id),y);for(const y of Q(e)){const j=e.rows.value(y.key,l),h=e.rows.value(y.key,v);if(j==null||h===null||h===void 0)continue;const i=r.col?M(e.rows.value(y.key,r.col)):1;if(i===null||i<=0)continue;const n=t(j,y,l),m=t(h,y,v);if(w){const G=n.key>m.key,C=G?m:n,O=G?n:m;b.set(`${C.key}\0${O.key}\0${b.size}`,{source:C,target:O,value:i,undirected:!0,pair:`${C.key}\0${O.key}`,rowKeys:[y.key]})}else{const G=`${n.key}\0${m.key}`,C=b.get(G)||{source:n,target:m,value:0,rowKeys:[]};C.value+=i,C.rowKeys.length<64&&C.rowKeys.push(y.key),b.set(G,C)}n.out+=i,m.in+=i}for(const[y,j]of c)s.has(y)||s.set(y,{key:y,value:j.id,label:String(j.label??j.id),index:s.size,in:0,out:0});for(const[y,j]of c){const h=s.get(y);h&&(h.declared=!0,j.label!==void 0&&j.label!==null&&(h.label=String(j.label)),typeof j.icon=="string"&&j.icon&&(h.icon=j.icon),Number.isFinite(j.x)&&Number.isFinite(j.y)&&(h.fx=Number(j.x),h.fy=Number(j.y)))}const P=w?[...b.values()]:[...b.values()].sort((y,j)=>j.value-y.value),g=typeof u.limit=="number"&&u.limit>0?P.slice(0,u.limit):P;return{nodes:[...s.values()],links:g,measure:{...r,title:o?.title||r.col||""},dimension:{col:l,title:e.columns.get(l)?.title||l},series:[],categories:[],labels:[],empty:!g.length,total:g.reduce((y,j)=>y+j.value,0)}}function H(e,u){const k=x(u.y),r=typeof u.depth=="number"&&u.depth>0?u.depth:1/0,w=k.col?e.columns.get(k.col):void 0,p=(b,t,c)=>({label:b,value:t,depth:c,total:0,children:[],rowKey:null}),l=p("",null,0),v=I(e);if(v.length){const b=(t,c,P)=>{const g=t.groupColumn?S(e,t,t.groupColumn,t.groupValue):"",y=p(g,t.groupValue,P);y.rowKey=t.key;const j=k.col?ne(e,t,k.col):null;y.total=j===null?0:Math.abs(j),c.children.push(y);const h=t.filteredChildren||t.children;if(P<r&&Array.isArray(h))for(const i of h)i.group&&b(i,y,P+1);return!y.total&&y.children.length&&(y.total=y.children.reduce((i,n)=>i+n.total,0)),y};for(const t of v)b(t,l,1)}else{const t=$(e,{x:u.x,y:u.y,limit:u.limit}).series[0];if(t)for(const c of t.points){const P=p(c.label,c.x,1);P.total=c.y===null?0:Math.abs(c.y),P.rowKey=c.rowKey,l.children.push(P)}}l.total=l.children.reduce((b,t)=>b+t.total,0);let o=0;const s=b=>{b.depth>o&&(o=b.depth);for(const t of b.children)s(t)};return s(l),{root:l,depth:o,measure:{...k,title:w?.title||k.col||""},empty:l.total<=0||l.children.length===0}}}),Xe("packages/modules/charts/radial.js",function(a,V){"use strict";Object.defineProperty(a,"horizontalRoom",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"arcPath",{enumerable:!0,get:function(){return k}}),Object.defineProperty(a,"layoutRings",{enumerable:!0,get:function(){return r}}),Object.defineProperty(a,"drawRadial",{enumerable:!0,get:function(){return w}}),Object.defineProperty(a,"arcAt",{enumerable:!0,get:function(){return p}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/svg.js"),de=M.attrs,ce=M.path,Y=M.round,X=M.setText,ae=V("packages/modules/charts/styles.js").NS,d=V("packages/modules/charts/scheme.js").resolveScheme,D=V("packages/modules/charts/labels.js"),z=D.drawAnchoredLabels,x=D.labelText,B=V("packages/modules/charts/typography.js"),Q=B.applySize,F=B.textWidth,I=B.truncateTo,S=V("packages/modules/charts/format.js").measureFormat,Z=Math.PI*2,te=-Math.PI/2,q=.25,E=2,L=3,se=.58,R=8,$=2;function he(l,v,o,s){return l==="total"?S(v,o,s):typeof l=="number"?S(l,o,s):l==null?"":String(l)}function f(l,v,o){if(!l||o<=0)return R;let s=v;for(;s>R&&F(l,s)>o;)s-=1;return Math.max(R,s)}function J(l,v,o,s){const b=o*Math.SQRT2-4;if(b<=0||!l&&!v)return null;let t=f(l,Math.min(b,s*(v?1.6:2.2)),b),c=v?f(v,Math.min(b,t*.55),b):0;const P=v?$:0;for(;t+P+c>b&&(t>R||c>R);)t>R&&(t-=1),v&&c>R&&(c-=1);const g=F(l,t)>b?I(l,b,t):l,y=v&&F(v,c)>b?I(v,b,c):v;return{value:g,valueSize:t,label:y||"",labelSize:c,gap:P,height:t+P+c}}function H(l,v){const{cx:o,cy:s,hole:b,centre:t,total:c,column:P,grid:g,baseSize:y}=v,j=he(t.value,c,P,g),h=t.label?String(t.label):"",i=J(j,h,b,y);if(!i)return;const n=i.label?s-i.height/2+i.valueSize/2:s;if(i.value){const m=l.next("text",`${ae}__donut-centre-value`);de(m,{x:Y(o),y:Y(n),"dominant-baseline":"middle"}),Q(m,i.valueSize),X(m,i.value)}if(i.label){const m=l.next("text",`${ae}__donut-centre-label`);de(m,{x:Y(o),y:Y(n+i.valueSize/2+i.gap+i.labelSize/2),"dominant-baseline":"middle"}),Q(m,i.labelSize),X(m,i.label)}}function e(l,v,o,s){return[l+o*Math.cos(s),v+o*Math.sin(s)]}function u(l,v,o){const{inner:s,outer:b,from:t,to:c}=l;if(o*o>=b*b)return 0;const P=Math.sqrt(b*b-o*o);let g=v+P,y=P-v;if(s>0&&o*o<s*s){const j=Math.sqrt(s*s-o*o);if(v>=j)g=Math.min(g,v-j);else if(v<=-j)y=Math.min(y,-j-v);else return 0}if(c-t<Z-1e-9)for(const j of[t,c]){const h=Math.sin(j);if(Math.abs(h)<1e-9)continue;const i=o/h;if(i<=0)continue;const n=i*Math.cos(j);n>=v?y=Math.min(y,n-v):g=Math.min(g,v-n)}return Math.max(0,g)+Math.max(0,y)}function k(l){const{cx:v,cy:o,inner:s,outer:b}=l,t=l.to-l.from;if(t<=0)return"";if(t>=Z-1e-9){const[i,n]=e(v,o,b,l.from),[m,G]=e(v,o,b,l.from+Math.PI),C=["M",Y(i),Y(n),"A",Y(b),Y(b),0,1,1,Y(m),Y(G),"A",Y(b),Y(b),0,1,1,Y(i),Y(n)];if(s>0){const[O,W]=e(v,o,s,l.from),[oe,_]=e(v,o,s,l.from+Math.PI);C.push("M",Y(O),Y(W),"A",Y(s),Y(s),0,1,0,Y(oe),Y(_),"A",Y(s),Y(s),0,1,0,Y(O),Y(W))}return ce(C)}const c=t>Math.PI?1:0,[P,g]=e(v,o,b,l.from),[y,j]=e(v,o,b,l.to),h=["M",Y(P),Y(g),"A",Y(b),Y(b),0,c,1,Y(y),Y(j)];if(s>0){const[i,n]=e(v,o,s,l.to),[m,G]=e(v,o,s,l.from);h.push("L",Y(i),Y(n)),h.push("A",Y(s),Y(s),0,c,0,Y(m),Y(G))}else h.push("L",Y(v),Y(o));return h.push("Z"),ce(h)}function r(l){const v=[],o=(s,b,t,c,P,g)=>{if(c>0&&v.push({node:s,from:b,to:t,depth:c,index:P,label:s.label,total:s.total,path:g}),c>=l.maxRings||!s.children.length)return;const y=s.children.reduce((i,n)=>i+n.total,0),j=t-b;if(y<=0||j<=0)return;let h=b;for(let i=0;i<s.children.length;i++){const n=s.children[i],m=n.total/y*j;o(n,h,h+m,c+1,c===0?i:P,[...g,n.label]),h+=m}};return o(l.root,te,te+Z,0,0,[]),v}function w(l){const v=l.scheme||d(),{plot:o,tree:s,type:b}=l,t=o.left+o.width/2,c=o.top+o.height/2,P=Math.max(0,Math.min(o.width,o.height)/2-2),g=b==="sunburst"?Math.max(1,s.depth):1,y=r({root:s.root,depth:s.depth,maxRings:g}).filter(O=>!l.hidden.has(O.label)),j=b==="donut"?P*se:0,h=g>0?(P-j)/g:P;new ee(l.groups.grid).finish(),new ee(l.groups.axis).finish(),new ee(l.groups.rules).finish(),new ee(l.groups.labels).finish();const i=s.root.children.map(O=>O.label),n=new ee(l.groups.marks);for(const O of y){const W=j+(O.depth-1)*h,oe=W+h,_=n.next("path",`${ae}__slice ${ae}__mark`);de(_,{d:k({cx:t,cy:c,inner:W,outer:oe,from:O.from,to:O.to}),fill:v.series(O.index,i[O.index]),"fill-opacity":O.depth>1?Math.max(.45,1-(O.depth-1)*.22):1,"data-arc":y.indexOf(O)}),O.geometry={cx:t,cy:c,inner:W,outer:oe}}n.finish();const m=l.typography&&l.typography.small||l.fontSize||11,G=!(l.labels&&l.labels.names===!1),C=new ee(l.groups.overlay);if(G)for(const O of y){if(O.to-O.from<q||O.geometry.outer-O.geometry.inner<m+E*2)continue;const W=(O.from+O.to)/2,oe=O.geometry.inner+(O.geometry.outer-O.geometry.inner)/2;if((O.to-O.from)*oe<m+E*2)continue;const[_,le]=e(t,c,oe,W),{inner:ue,outer:ge}=O.geometry,ye=u({inner:ue,outer:ge,from:O.from,to:O.to},_-t,le-c)-E*2,be=String(O.label===null||O.label===void 0?"":O.label),Me=I(be,ye,m);if(Me!==be&&Me.length<L)continue;const je=C.next("text",`${ae}__slice-label`);de(je,{x:Y(_),y:Y(le),"dominant-baseline":"middle"}),Q(je,m),X(je,Me)}if(b==="donut"&&l.centre&&j>0){const O=l.grid&&l.grid.columns&&s.measure&&s.measure.col?l.grid.columns.get(s.measure.col):null;H(C,{cx:t,cy:c,hole:j,centre:l.centre,total:y.filter(W=>W.depth===1).reduce((W,oe)=>W+oe.total,0),column:O,grid:l.grid,baseSize:m})}return C.finish(),l.labels&&l.labels.show&&z({group:l.groups.labels,size:m,minGap:l.labels.minGap,anchors:y.filter(O=>O.depth===1&&O.to-O.from>=q).map(O=>{const W=(O.from+O.to)/2,oe=O.geometry.inner+(O.geometry.outer-O.geometry.inner)/2,[_,le]=e(t,c,oe,W);return{x:Y(_),y:Y(le+m+1),text:x(O.total,l.labels,l.grid),inside:!0}})}),{arcs:y,centre:{x:t,y:c,r:P}}}function p(l){for(const v of l.arcs){const o=v.geometry;if(!o)continue;const s=l.x-o.cx,b=l.y-o.cy,t=Math.sqrt(s*s+b*b);if(t<o.inner||t>o.outer)continue;let c=Math.atan2(b,s);for(;c<te;)c+=Z;for(;c>=te+Z;)c-=Z;if(c>=v.from&&c<v.to)return v}return null}}),Xe("packages/modules/charts/distribution.js",function(a,V){"use strict";Object.defineProperty(a,"FENCE",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"quantile",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"summarise",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"binEdge",{enumerable:!0,get:function(){return H}}),Object.defineProperty(a,"outsideDomain",{enumerable:!0,get:function(){return e}}),Object.defineProperty(a,"histogram",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"readingsOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(a,"valuesByCategory",{enumerable:!0,get:function(){return r}}),Object.defineProperty(a,"allReadings",{enumerable:!0,get:function(){return w}}),Object.defineProperty(a,"distributionDomain",{enumerable:!0,get:function(){return p}}),Object.defineProperty(a,"density",{enumerable:!0,get:function(){return l}}),Object.defineProperty(a,"drawHistogram",{enumerable:!0,get:function(){return o}}),Object.defineProperty(a,"drawBoxPlot",{enumerable:!0,get:function(){return s}}),Object.defineProperty(a,"probit",{enumerable:!0,get:function(){return b}}),Object.defineProperty(a,"drawQQ",{enumerable:!0,get:function(){return t}}),Object.defineProperty(a,"drawEcdf",{enumerable:!0,get:function(){return c}}),Object.defineProperty(a,"drawLorenz",{enumerable:!0,get:function(){return P}}),Object.defineProperty(a,"drawControl",{enumerable:!0,get:function(){return g}}),Object.defineProperty(a,"drawCapability",{enumerable:!0,get:function(){return y}}),Object.defineProperty(a,"drawMovingRange",{enumerable:!0,get:function(){return j}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/axis.js"),de=M.drawAxisLines,ce=M.drawCategoryAxis,Y=M.drawContinuousAxis,X=M.drawMeasureAxis,U=M.tickLabeller,N=V("packages/modules/charts/format.js").formatters,d=V("packages/modules/charts/scale.js"),D=d.bandScale,z=d.isNumber,x=d.linearScale,B=d.measureDomain,Q=d.niceStep,F=V("packages/modules/charts/svg.js"),I=F.attrs,ne=F.path,S=F.round,te=V("packages/modules/charts/styles.js").NS,E=V("packages/modules/charts/scheme.js").resolveScheme,L=V("packages/modules/charts/labels.js"),se=L.drawAnchoredLabels,R=L.labelText,$=1.5,he="–";function f(h,i){const n=h.length;if(!n)return NaN;if(n===1)return h[0];const m=(n-1)*Math.min(1,Math.max(0,i)),G=Math.floor(m),C=Math.ceil(m);return G===C?h[G]:h[G]+(m-G)*(h[C]-h[G])}function J(h){const i=h.filter(z).slice().sort((le,ue)=>le-ue);if(!i.length)return null;const n=f(i,.25),m=f(i,.5),G=f(i,.75),C=G-n,O=n-$*C,W=G+$*C;let oe=i[0];for(const le of i)if(le>=O){oe=le;break}let _=i[i.length-1];for(let le=i.length-1;le>=0;le--)if(i[le]<=W){_=i[le];break}return{min:i[0],q1:n,median:m,q3:G,max:i[i.length-1],low:oe,high:_,outliers:i.filter(le=>le<O||le>W),count:i.length}}function H(h,i,n){const m=h+n*i;return Math.abs(m)<i/1e6?0:Number(m.toPrecision(12))}function e(h,i){const n=i||{},m=z(n.min),G=z(n.max);if(!m&&!G)return 0;let C=0;for(let O=0;O<h.length;O++){const W=h[O];z(W)&&(m&&W<n.min||G&&W>n.max)&&C++}return C}function u(h,i=12,n){const m=n||{},G=z(m.min),C=z(m.max);let O=1/0,W=-1/0,oe=0;for(let be=0;be<h.length;be++){const Me=h[be];z(Me)&&(G&&Me<m.min||C&&Me>m.max||(Me<O&&(O=Me),Me>W&&(W=Me),oe++))}if(!oe)return[];if(G&&(O=Number(m.min)),C&&(W=Number(m.max)),O===W){const be=Math.abs(O)>0?Math.abs(O)/10:.5;O-=be,W+=be}const _=Q((W-O)/Math.max(1,i)),le=Math.floor(O/_)*_,ue=Math.ceil(W/_)*_,ge=[],ye=Math.max(1,Math.round((ue-le)/_));for(let be=0;be<ye;be++)ge.push({from:H(le,_,be),to:H(le,_,be+1),count:0});for(let be=0;be<h.length;be++){const Me=h[be];if(!z(Me)||G&&Me<m.min||C&&Me>m.max)continue;let je=Math.floor((Me-le)/_);je>=ge.length&&(je=ge.length-1),je<0&&(je=0),ge[je].count++}return ge}function k(h){if(!h)return[];if(Array.isArray(h.values)){const i=h.values.filter(z);if(i.length)return i}return z(h.y)?[h.y]:[]}function r(h){const i=new Map,n=!(h.dimension&&h.dimension.col),m=n&&h.measure&&h.measure.title||"";for(const G of h.series)for(const C of G.points){const O=k(C);if(!O.length)continue;const W=n?m:C.label;i.has(W)||i.set(W,[]);const oe=i.get(W);for(const _ of O)oe.push(_)}return i}function w(h){const i=[];for(const n of h.series||[])for(const m of n.points||[])for(const G of k(m))i.push(G);return i}function p(h,i){const n=i&&i.y||{};return B(h,{zero:!1,min:n.min,max:n.max})}function l(h,i,n){const m=h.length;if(!m)return[];const G=h.reduce((le,ue)=>le+ue,0)/m,C=h.reduce((le,ue)=>le+(ue-G)**2,0)/Math.max(1,m-1),O=Math.sqrt(C)||1,W=Math.max(1e-9,1.06*O*m**(-1/5)),oe=[],_=i.max-i.min||1;for(let le=0;le<n;le++){const ue=i.min+_*le/(n-1||1);let ge=0;for(const ye of h){const be=(ue-ye)/W;ge+=Math.exp(-.5*be*be)}oe.push({at:ue,density:ge/(m*W*Math.sqrt(Math.PI*2))})}return oe}function v(h,i,n){const m=N(h.grid,{kind:"linear",step:n}),G=i.measure&&i.measure.col&&h.grid.columns?h.grid.columns.get(i.measure.col):null,O=!!(G&&G.format&&typeof G.formatValue=="function")?{tick:W=>String(G.formatValue(W,null))}:m;return U(h.axis&&h.axis.x||{},O,h.grid)}function o(h){const i=h.scheme||E(),{plot:n,bound:m}=h,G=w(m),C=h.axis&&h.axis.y||{},O=u(G,h.buckets||12,C),W=e(G,C),oe=O.map(Oe=>Oe.count),_=B(oe,{zero:!0}),le=x(_,[n.bottom,n.top]),ue=O.length?O[0].to-O[0].from:1,ge=v(h,m,ue),ye=O.map(Oe=>ge(Oe.from)),be=O.map(Oe=>`${ge(Oe.from)} ${he} ${ge(Oe.to)}`),Me=O.map((Oe,Pe)=>Pe),je=D(Me,[n.left,n.right],.08);X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:le,format:N(h.grid,{kind:"linear",step:(_.max-_.min)/5})}),ce({group:h.groups.overlay,plot:n,scale:je,labels:ye,fontSize:h.fontSize,rotated:ye.length>8}),de({group:h.groups.rules,plot:n});const xe=new ee(h.groups.marks),$e=le.of(_.min<=0?0:_.min);if(O.forEach((Oe,Pe)=>{const De=le.of(Oe.count);I(xe.next("rect",`${te}__bar ${te}__mark`),{x:S(je.of(Pe)),y:S(Math.min(De,$e)),width:S(je.bandwidth),height:S(Math.max(Oe.count>0?1:0,Math.abs($e-De))),fill:i.series(0),"data-point":Pe})}),xe.finish(),h.curve&&G.length>1){const Oe={min:O[0].from,max:O[O.length-1].to},Pe=l(G,Oe,Math.max(24,O.length*4)),De=Pe.reduce((Ge,Ve)=>Math.max(Ge,Ve.density),0);if(De>0){const Ge=Oe.max-Oe.min||1,Ve=le.of(_.max),it=Pe.map(ft=>[S(n.left+(ft.at-Oe.min)/Ge*(n.right-n.left)),S($e-ft.density/De*($e-Ve))]),gt=new ee(h.groups.overlay);I(gt.next("path",`${te}__density ${te}__mark`),{d:ne(it.flatMap(([ft,At],kt)=>[kt?"L":"M",ft,At])),fill:"none",stroke:i.series(1)}),gt.finish()}}if(h.labels&&h.labels.show){const Oe=h.typography&&h.typography.small||h.fontSize||11;se({group:h.groups.labels,size:Oe,minGap:h.labels.minGap,plot:n,anchors:O.map((Pe,De)=>{const Ge=Math.min(le.of(Pe.count),$e),Ve=Ge-Oe/2-2,it=Ve<n.top;return{x:S(je.of(De)+je.bandwidth/2),y:S(it?Ge+Oe/2+2:Ve),text:Pe.count?R(Pe.count,h.labels,h.grid):"",inside:it,height:it?Math.abs($e-Ge)-2:void 0}})})}return{xScale:je,yScale:le,buckets:O,labels:be,categories:O.map(Oe=>Oe.from),outside:W,series:[{key:"",label:m.measure.title,index:0,points:O.map((Oe,Pe)=>({x:Pe,xKey:String(Pe),label:be[Pe],from:Oe.from,to:Oe.to,y:Oe.count,rows:Oe.count}))}]}}function s(h){const i=h.scheme||E(),{plot:n,bound:m}=h,G=r(m),C=[...G.keys()],O=C.map(ye=>J(G.get(ye))).filter(Boolean),W=[];for(const ye of O)W.push(ye.min,ye.max);const oe=p(W,h.axis),_=x(oe,[n.bottom,n.top]),le=D(C,[n.left,n.right],.4);X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:_,format:N(h.grid,{kind:"linear",step:(oe.max-oe.min)/5})}),ce({group:h.groups.overlay,plot:n,scale:le,labels:C,fontSize:h.fontSize,rotated:C.length>6}),de({group:h.groups.rules,plot:n});const ue=new ee(h.groups.marks),ge=le.bandwidth;return C.forEach((ye,be)=>{const Me=O[be];if(!Me)return;const je=le.of(ye),xe=je+ge/2,$e=i.series(be);I(ue.next("rect",`${te}__box ${te}__mark`),{x:S(je),y:S(_.of(Me.q3)),width:S(ge),height:S(Math.max(1,_.of(Me.q1)-_.of(Me.q3))),fill:$e,"fill-opacity":.35,stroke:$e,"data-point":be}),I(ue.next("path",`${te}__whisker ${te}__mark`),{d:ne(["M",S(xe),S(_.of(Me.high)),"L",S(xe),S(_.of(Me.q3)),"M",S(xe),S(_.of(Me.q1)),"L",S(xe),S(_.of(Me.low)),"M",S(je+ge*.25),S(_.of(Me.high)),"L",S(je+ge*.75),S(_.of(Me.high)),"M",S(je+ge*.25),S(_.of(Me.low)),"L",S(je+ge*.75),S(_.of(Me.low))]),stroke:$e,fill:"none"}),I(ue.next("path",`${te}__median ${te}__mark`),{d:ne(["M",S(je),S(_.of(Me.median)),"L",S(je+ge),S(_.of(Me.median))]),stroke:$e,"stroke-width":2,fill:"none"});for(const Oe of Me.outliers)I(ue.next("circle",`${te}__point ${te}__mark`),{cx:S(xe),cy:S(_.of(Oe)),r:2.5,fill:$e,"fill-opacity":.8})}),ue.finish(),{xScale:le,yScale:_,boxes:O,series:[{key:"",label:m.measure.title,index:0,points:C.map((ye,be)=>({x:ye,xKey:ye,label:ye,y:O[be]?O[be].median:null,rows:O[be]?O[be].count:0}))}]}}function b(h){if(!(h>0&&h<1))return Number.NaN;const i=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],n=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],m=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],G=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],C=.02425;if(h<C){const oe=Math.sqrt(-2*Math.log(h));return(((((m[0]*oe+m[1])*oe+m[2])*oe+m[3])*oe+m[4])*oe+m[5])/((((G[0]*oe+G[1])*oe+G[2])*oe+G[3])*oe+1)}if(h>1-C){const oe=Math.sqrt(-2*Math.log(1-h));return-(((((m[0]*oe+m[1])*oe+m[2])*oe+m[3])*oe+m[4])*oe+m[5])/((((G[0]*oe+G[1])*oe+G[2])*oe+G[3])*oe+1)}const O=h-.5,W=O*O;return(((((i[0]*W+i[1])*W+i[2])*W+i[3])*W+i[4])*W+i[5])*O/(((((n[0]*W+n[1])*W+n[2])*W+n[3])*W+n[4])*W+1)}function t(h){const i=h.scheme||E(),{plot:n,bound:m}=h;new ee(h.groups.grid).finish(),new ee(h.groups.axis).finish(),new ee(h.groups.rules).finish(),new ee(h.groups.labels).finish();const G=w(m);if(G.length<3)return null;const C=G.slice().sort((De,Ge)=>De-Ge),O=C.length,W=C.map((De,Ge)=>b((Ge+1-.375)/(O+.25))),oe=B(W,{zero:!1,nice:!0}),_=B(C,{zero:!1,nice:!0}),le=x(oe,[n.left,n.right]),ue=x(_,[n.bottom,n.top]);X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:ue,format:N(h.grid,{kind:"linear",step:(_.max-_.min)/5})}),Y({group:h.groups.overlay,plot:n,scale:le,fontSize:h.fontSize,format:N(h.grid,{kind:"linear",step:(oe.max-oe.min)/5})}),de({group:h.groups.rules,plot:n});const ge=f(C,.25),ye=f(C,.75),be=b(.25),Me=b(.75),je=(ye-ge)/(Me-be),xe=ge-je*be,$e=new ee(h.groups.rules);I($e.next("path",`${te}__qq-line`),{d:ne(["M",S(le.of(oe.min)),S(ue.of(xe+je*oe.min)),"L",S(le.of(oe.max)),S(ue.of(xe+je*oe.max))]),fill:"none"}),$e.finish();const Oe=new ee(h.groups.marks),Pe=[];for(let De=0;De<O;De++){const Ge=S(le.of(W[De])),Ve=S(ue.of(C[De]));I(Oe.next("circle",`${te}__point ${te}__mark`),{cx:Ge,cy:Ve,r:2.5,fill:i.series(0),"data-point":De}),Pe.push({x:Ge,y:Ve,theoretical:W[De],sample:C[De]})}return Oe.finish(),{points:Pe,line:{slope:je,intercept:xe}}}function c(h){const i=h.scheme||E(),{plot:n,bound:m}=h;new ee(h.groups.grid).finish(),new ee(h.groups.axis).finish(),new ee(h.groups.rules).finish(),new ee(h.groups.labels).finish();const G=w(m);if(!G.length)return null;const C=G.slice().sort((ye,be)=>ye-be),O=C.length,W=B(C,{zero:!1,nice:!0}),oe=x(W,[n.left,n.right]),_=x({min:0,max:1},[n.bottom,n.top]);X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:_,format:N(h.grid,{kind:"linear",step:.2})}),Y({group:h.groups.overlay,plot:n,scale:oe,fontSize:h.fontSize,format:N(h.grid,{kind:"linear",step:(W.max-W.min)/5})}),de({group:h.groups.rules,plot:n});const le=["M",S(oe.of(W.min)),S(_.of(0))],ue=[];for(let ye=0;ye<O;ye++){const be=S(oe.of(C[ye])),Me=(ye+1)/O;le.push("L",be,S(_.of(ye/O)),"L",be,S(_.of(Me))),ue.push({value:C[ye],share:Me})}le.push("L",S(oe.of(W.max)),S(_.of(1)));const ge=new ee(h.groups.marks);return I(ge.next("path",`${te}__ecdf ${te}__mark`),{d:ne(le),fill:"none",stroke:i.series(0)}),ge.finish(),{steps:ue}}function P(h){const i=h.scheme||E(),{plot:n,bound:m}=h;new ee(h.groups.grid).finish(),new ee(h.groups.axis).finish(),new ee(h.groups.rules).finish(),new ee(h.groups.labels).finish();const G=w(m).filter(xe=>xe>=0);if(!G.length)return null;const C=G.slice().sort((xe,$e)=>xe-$e),O=C.length,W=C.reduce((xe,$e)=>xe+$e,0);if(W<=0)return null;const oe=x({min:0,max:1},[n.left,n.right]),_=x({min:0,max:1},[n.bottom,n.top]);X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:_,format:N(h.grid,{kind:"linear",step:.2})}),Y({group:h.groups.overlay,plot:n,scale:oe,fontSize:h.fontSize,format:N(h.grid,{kind:"linear",step:.2})}),de({group:h.groups.rules,plot:n});const le=new ee(h.groups.rules);I(le.next("path",`${te}__lorenz-equality`),{d:ne(["M",S(oe.of(0)),S(_.of(0)),"L",S(oe.of(1)),S(_.of(1))]),fill:"none"}),le.finish();const ue=["M",S(oe.of(0)),S(_.of(0))],ge=[{rows:0,held:0}];let ye=0;for(let xe=0;xe<O;xe++){ye+=C[xe];const $e={rows:(xe+1)/O,held:ye/W};ue.push("L",S(oe.of($e.rows)),S(_.of($e.held))),ge.push($e)}const be=new ee(h.groups.marks);I(be.next("path",`${te}__lorenz ${te}__mark`),{d:ne(ue),fill:"none",stroke:i.series(0)}),be.finish();let Me=0;for(let xe=0;xe<O;xe++)Me+=(xe+1)*C[xe];const je=2*Me/(O*W)-(O+1)/O;return{curve:ge,gini:je}}function g(h){const i=h.scheme||E(),{plot:n,bound:m}=h;new ee(h.groups.grid).finish(),new ee(h.groups.labels).finish();const G=[];for(const Pe of m.series)for(const De of Pe.points)z(De.y)&&G.push(De.y);if(G.length<2)return null;const C=h.capability||null,O=C&&C.limits?C.limits:null,W=[...G];O&&W.push(O.upper,O.lower),C&&(C.lower!==null&&W.push(C.lower),C.upper!==null&&W.push(C.upper));const oe=B(W,{zero:!1,nice:!0}),_=x(oe,[n.bottom,n.top]),le=G.length>1?(n.right-n.left)/(G.length-1):0;X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:_,format:N(h.grid,{kind:"linear",step:(oe.max-oe.min)/5})}),de({group:h.groups.rules,plot:n});const ue=new ee(h.groups.overlay),ge=[],ye=(Pe,De,Ge,Ve="end")=>{!Number.isFinite(Pe)||Pe<oe.min||Pe>oe.max||(I(ue.next("path",De),{d:ne(["M",S(n.left),S(_.of(Pe)),"L",S(n.right),S(_.of(Pe))]),fill:"none"}),Ge&&ge.push({y:_.of(Pe),text:Ge,side:Ve}))};O&&(ye(O.centre,`${te}__control-centre`,"CL","end"),ye(O.upper,`${te}__control-limit`,"UCL","end"),ye(O.lower,`${te}__control-limit`,"LCL","end")),C&&(C.lower!==null&&ye(C.lower,`${te}__spec-limit`,"LSL","start"),C.upper!==null&&ye(C.upper,`${te}__spec-limit`,"USL","start"),C.target!==null&&ye(C.target,`${te}__spec-target`,"Target","start")),ue.finish();const be=new Map;for(const Pe of C&&C.violations?C.violations:[]){const De=be.get(Pe.index);De?De.includes(Pe.rule)||De.push(Pe.rule):be.set(Pe.index,[Pe.rule])}const Me=new Set(be.keys()),je=new ee(h.groups.marks),xe=[],$e=[];for(let Pe=0;Pe<G.length;Pe++){const De=S(n.left+Pe*le),Ge=S(_.of(G[Pe]));xe.push(Pe?"L":"M",De,Ge),$e.push({x:De,y:Ge,index:Pe,value:G[Pe],violating:Me.has(Pe)})}I(je.next("path",`${te}__control-line ${te}__mark`),{d:ne(xe),fill:"none",stroke:i.series(0)});for(const Pe of $e)I(je.next("circle",`${te}__point ${te}__mark`),{cx:Pe.x,cy:Pe.y,r:Pe.violating?4:2.5,fill:Pe.violating?"var(--lattice-danger, #a4262c)":i.series(0),"data-violation":Pe.violating?"true":null});je.finish();const Oe=[];for(const{y:Pe,text:De,side:Ge}of ge)Oe.push({x:Ge==="start"?n.left+2:n.right-2,y:Pe-3,text:De,anchor:Ge,className:`${te}__control-name`});for(const Pe of $e){const De=be.get(Pe.index);De&&Oe.push({x:Pe.x,y:Pe.y-7,text:De.sort((Ge,Ve)=>Ge-Ve).join(","),anchor:"middle",className:`${te}__control-rule`})}return se({group:h.groups.labels,anchors:Oe,size:9,grid:h.grid,minGap:1}),{points:$e,limits:O,ruleSet:C?C.ruleSet:null}}function y(h){const i=h.scheme||E(),{plot:n,bound:m}=h;new ee(h.groups.grid).finish();const G=[];for(const Oe of m.series)for(const Pe of Oe.points)z(Pe.y)&&G.push(Pe.y);if(G.length<2)return null;const C=h.capability||null,O=[...G];C&&(C.lower!==null&&O.push(C.lower),C.upper!==null&&O.push(C.upper),C.target!==null&&O.push(C.target));const W=B(O,{zero:!1,nice:!0}),oe=x(W,[n.left,n.right]),_=u(G,h.buckets||14),le=_.map(Oe=>Oe.count),ue=B(le,{zero:!0}),ge=x(ue,[n.bottom,n.top]);X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:ge,format:N(h.grid,{kind:"linear",step:(ue.max-ue.min)/5})}),Y({group:h.groups.overlay,plot:n,scale:oe,fontSize:h.fontSize,format:N(h.grid,{kind:"linear",step:(W.max-W.min)/5})}),de({group:h.groups.rules,plot:n});const ye=ge.of(0),be=new ee(h.groups.marks);for(let Oe=0;Oe<_.length;Oe++){const Pe=_[Oe],De=oe.of(Pe.from),Ge=oe.of(Pe.to),Ve=ge.of(Pe.count);I(be.next("rect",`${te}__bar ${te}__mark`),{x:S(Math.min(De,Ge)),y:S(Math.min(Ve,ye)),width:S(Math.max(1,Math.abs(Ge-De)-1)),height:S(Math.max(Pe.count>0?1:0,Math.abs(ye-Ve))),fill:i.series(0),"data-point":Oe})}be.finish();const Me=new ee(h.groups.overlay),je=[];if(C&&Number.isFinite(C.mean)){const Pe=it=>{if(!Number.isFinite(it)||it<=0)return null;const gt=[];for(let ft=0;ft<=96;ft++){const At=W.min+(W.max-W.min)*ft/96,kt=(At-C.mean)/it;gt.push({at:At,y:Math.exp(-.5*kt*kt)/it})}return gt},De=Pe(C.sigmaWithin),Ge=Pe(C.sigmaOverall);let Ve=0;for(const it of[De,Ge])if(it)for(const gt of it)Ve=Math.max(Ve,gt.y);if(Ve>0){const it=ge.of(ue.max),gt=(ft,At,kt)=>{if(!ft)return;const Tt=ft.flatMap((Ot,jt)=>[jt?"L":"M",S(oe.of(Ot.at)),S(ye-Ot.y/Ve*(ye-it))]);I(Me.next("path",`${At} ${te}__mark`),{d:ne(Tt),fill:"none"}),je.push(kt)};gt(De,`${te}__capability-within`,"within"),gt(Ge,`${te}__capability-overall`,"overall")}}const xe=[],$e=(Oe,Pe,De)=>{if(Oe===null||!Number.isFinite(Oe)||Oe<W.min||Oe>W.max)return;const Ge=S(oe.of(Oe));I(Me.next("path",Pe),{d:ne(["M",Ge,S(n.top),"L",Ge,S(n.bottom)]),fill:"none"}),xe.push({x:Ge,text:De})};return C&&($e(C.lower,`${te}__spec-limit`,"LSL"),$e(C.upper,`${te}__spec-limit`,"USL"),$e(C.target,`${te}__spec-target`,"Target")),Me.finish(),se({group:h.groups.labels,anchors:xe.map(({x:Oe,text:Pe})=>({x:Oe,y:n.top+6,text:Pe,anchor:"middle",className:`${te}__control-name`})),size:9,grid:h.grid,minGap:1}),{buckets:_,capability:C,curves:je}}function j(h){const i=h.scheme||E(),{plot:n,bound:m}=h;new ee(h.groups.grid).finish();const G=[];for(const xe of m.series)for(const $e of xe.points)z($e.y)&&G.push($e.y);if(G.length<3)return null;const C=[];for(let xe=1;xe<G.length;xe++)C.push(Math.abs(G[xe]-G[xe-1]));const O=C.reduce((xe,$e)=>xe+$e,0)/C.length,W=3.267*O,oe=B([...C,0,W],{zero:!0,nice:!0}),_=x(oe,[n.bottom,n.top]),le=C.length>1?(n.right-n.left)/(C.length-1):0;X({gridGroup:h.groups.grid,axisGroup:h.groups.axis,plot:n,scale:_,format:N(h.grid,{kind:"linear",step:(oe.max-oe.min)/5})}),de({group:h.groups.rules,plot:n});const ue=new ee(h.groups.overlay),ge=[],ye=(xe,$e,Oe)=>{!Number.isFinite(xe)||xe<oe.min||xe>oe.max||(I(ue.next("path",$e),{d:ne(["M",S(n.left),S(_.of(xe)),"L",S(n.right),S(_.of(xe))]),fill:"none"}),ge.push({y:_.of(xe),text:Oe}))};ye(O,`${te}__control-centre`,"MR"),ye(W,`${te}__control-limit`,"UCL"),ue.finish();const be=new ee(h.groups.marks),Me=[],je=[];for(let xe=0;xe<C.length;xe++){const $e=S(n.left+xe*le),Oe=S(_.of(C[xe]));Me.push(xe?"L":"M",$e,Oe),je.push({x:$e,y:Oe,index:xe,value:C[xe],violating:C[xe]>W})}I(be.next("path",`${te}__control-line ${te}__mark`),{d:ne(Me),fill:"none",stroke:i.series(0)});for(const xe of je)I(be.next("circle",`${te}__point ${te}__mark`),{cx:xe.x,cy:xe.y,r:xe.violating?4:2.5,fill:xe.violating?"var(--lattice-danger, #a4262c)":i.series(0),"data-violation":xe.violating?"true":null});return be.finish(),se({group:h.groups.labels,anchors:ge.map(({y:xe,text:$e})=>({x:n.right-2,y:xe-3,text:$e,anchor:"end",className:`${te}__control-name`})),size:9,grid:h.grid,minGap:1}),{points:je,centre:O,upper:W}}}),Xe("packages/modules/charts/treemap.js",function(a,V){"use strict";Object.defineProperty(a,"squarify",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"layoutTree",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"drawTreemap",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"tileAt",{enumerable:!0,get:function(){return he}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/svg.js"),de=M.attrs,ce=M.round,Y=M.setText,U=V("packages/modules/charts/styles.js").NS,N=V("packages/modules/charts/scheme.js").resolveScheme,d=V("packages/modules/charts/labels.js"),D=d.drawAnchoredLabels,z=d.labelText,x=V("packages/modules/charts/typography.js"),B=x.applySize,Q=x.truncateTo,F=34,I=6,ne=3,S=3,Z=.28;function te(f){return f*1.6}function q(f){return Math.round(f*1.6)}function E(f){return f>1?Math.max(.45,1-(f-1)*.22):1}function L(f,J,H){if(!f.length||J<=0||H<=0)return 1/0;const e=Math.max(...f),u=Math.min(...f),k=J*J,r=H*H;return Math.max(k*e/r,r/(k*u))}function se(f,J){const H=[],e=f.filter(o=>o.value>0),u=e.reduce((o,s)=>o+s.value,0);if(!e.length||u<=0||J.width<=0||J.height<=0)return H;const k=e.slice().sort((o,s)=>s.value-o.value),r=J.width*J.height/u;let w={...J},p=[],l=[];const v=()=>{if(!p.length)return;const o=Math.min(w.width,w.height),b=l.reduce((c,P)=>c+P,0)/o;let t=0;for(let c=0;c<p.length;c++){const P=l[c]/b;H.push(w.width>=w.height?{item:p[c],x:w.x,y:w.y+t,width:b,height:P}:{item:p[c],x:w.x+t,y:w.y,width:P,height:b}),t+=P}w.width>=w.height?w={x:w.x+b,y:w.y,width:w.width-b,height:w.height}:w={x:w.x,y:w.y+b,width:w.width,height:w.height-b},p=[],l=[]};for(const o of k){const s=o.value*r,b=Math.min(w.width,w.height),t=L(l,b,l.reduce((P,g)=>P+g,0)),c=L([...l,s],b,l.reduce((P,g)=>P+g,0)+s);p.length&&c>t&&v(),p.push(o),l.push(o.value*r)}return v(),H}function R(f){const{plot:J,tree:H}=f,e=te(f.fontSize),u=q(f.fontSize),k=[],r=(w,p,l,v,o)=>{const s=w.children.filter(b=>l>0||!f.hidden.has(b.label)).map((b,t)=>({node:b,value:b.total,index:l===0?t:v}));for(const b of se(s,p)){if(l>0&&(b.width<e||b.height<e))continue;const t={...b,depth:l+1,path:[...o,b.item.node.label],children:!1};k.push(t);const c={x:t.x+S,y:t.y+u,width:t.width-S*2,height:t.height-u-S};if(b.item.node.children.length&&c.width>=e&&c.height>=e){const P=k.length;r(b.item.node,c,l+1,t.item.index,t.path),t.children=k.length>P}}};return r(H.root,{x:J.left,y:J.top,width:J.width,height:J.height},0,0,[]),k}function $(f){const J=f.scheme||N();new ee(f.groups.grid).finish(),new ee(f.groups.axis).finish(),new ee(f.groups.rules).finish(),new ee(f.groups.labels).finish();const H=R(f),e=f.typography&&f.typography.small||f.fontSize||11,u=new ee(f.groups.marks);for(const r of H)de(u.next("rect",`${U}__tile ${U}__mark${r.children?` ${U}__tile--branch`:""}`),{x:ce(r.x),y:ce(r.y),width:ce(Math.max(0,r.width)),height:ce(Math.max(0,r.height)),fill:J.series(r.item.index),"fill-opacity":r.children?Z:E(r.depth),"data-point":r.item.index,"data-depth":r.depth});u.finish();const k=new ee(f.groups.overlay);for(const r of H){if(r.width<F||r.height<f.fontSize*1.6)continue;const w=String(r.item.node.label??""),p=Q(w,r.width-I*2,e);if(p!==w&&p.length<ne)continue;const l=k.next("text",`${U}__tile-label${r.children?` ${U}__tile-label--branch`:""}`);de(l,{x:ce(r.x+I),y:ce(r.y+f.fontSize+2),"text-anchor":"start"}),B(l,e),Y(l,p)}return k.finish(),f.labels&&f.labels.show&&D({group:f.groups.labels,size:e,minGap:f.labels.minGap,anchors:H.filter(r=>!r.children&&r.width>=F&&r.height>=f.fontSize*1.6+e).sort((r,w)=>w.width*w.height-r.width*r.height).map(r=>({x:ce(r.x+I),y:ce(r.y+f.fontSize*2+4),text:z(r.item.value,f.labels,f.grid),anchor:"start",inside:!0,width:r.width-I*2}))}),{tiles:H}}function he(f){let J=null;for(const H of f.tiles)f.x>=H.x&&f.x<=H.x+H.width&&f.y>=H.y&&f.y<=H.y+H.height&&(!J||(H.depth||1)>(J.depth||1))&&(J=H);return J}}),Xe("packages/modules/charts/matrix.js",function(a,V){"use strict";Object.defineProperty(a,"colourRamp",{enumerable:!0,get:function(){return k}}),Object.defineProperty(a,"drawHeatmap",{enumerable:!0,get:function(){return r}}),Object.defineProperty(a,"drawFunnel",{enumerable:!0,get:function(){return w}}),Object.defineProperty(a,"drawCandlestick",{enumerable:!0,get:function(){return p}}),Object.defineProperty(a,"drawCorrelogram",{enumerable:!0,get:function(){return v}}),Object.defineProperty(a,"title",{enumerable:!0,get:function(){return s}}),Object.defineProperty(a,"cellAt",{enumerable:!0,get:function(){return b}});const ee=V("packages/modules/charts/frame.js").Pool,M=V("packages/modules/charts/axis.js"),de=M.drawAxisLines,ce=M.drawBandLabels,Y=M.drawCategoryAxis,X=M.drawMeasureAxis,U=M.leftLabelRoom,ae=M.setLabelText,N=V("packages/modules/charts/format.js"),d=N.formatters,D=N.measureText,z=V("packages/modules/charts/scale.js"),x=z.bandScale,B=z.isNumber,Q=z.measureDomain,F=V("packages/modules/charts/svg.js"),I=F.attrs,ne=F.path,S=F.round,Z=F.setText,q=V("packages/modules/charts/typography.js").applySize,L=V("packages/modules/charts/styles.js").NS,se=V("packages/modules/charts/scheme.js"),R=se.rampStops,$=se.resolveScheme,he=V("packages/modules/charts/labels.js"),f=he.drawAnchoredLabels,J=he.labelText,H=Object.freeze([[236,243,249],[0,82,128]]),e=Object.freeze([[176,74,0],[247,247,247],[0,82,128]]);function u(t,c,P){const g=Math.min(1,Math.max(0,P)),y=j=>Math.round(t[j]+(c[j]-t[j])*g);return`rgb(${y(0)} ${y(1)} ${y(2)})`}function k(t,c,P){const g=t.max-t.min||1,y=P?R(P,c):c?e:H;if(!c)return h=>u(y[0],y[y.length-1],(h-t.min)/g);const j=Math.max(Math.abs(t.min),Math.abs(t.max))||1;return h=>h>=0?u(y[1],y[2],h/j):u(y[1],y[0],-h/j)}function r(t){const c=t.scheme||$(),{plot:P,bound:g}=t;new ee(t.groups.grid).finish(),new ee(t.groups.axis).finish(),new ee(t.groups.rules).finish(),new ee(t.groups.labels).finish();const y=g.series.filter(C=>!t.hidden.has(C.key)),j=[];for(const C of y)for(const O of C.points)j.push(O.y);const h=Q(j,{zero:!1,nice:!1}),i=k(h,!!t.diverging,c),n=x(g.categories,[P.left,P.right],.04),m=x(y.map(C=>C.label),[P.top,P.bottom],.04),G=new ee(t.groups.marks);for(const C of y){const O=m.of(C.label);if(!Number.isNaN(O))for(let W=0;W<C.points.length;W++){const oe=C.points[W],_=n.of(oe.x);if(Number.isNaN(_))continue;const le=G.next("rect",`${L}__cell ${L}__mark`);I(le,{x:S(_),y:S(O),width:S(n.bandwidth),height:S(m.bandwidth),fill:B(oe.y)?i(oe.y):"transparent","data-series":C.index,"data-point":W}),oe.px=S(_+n.bandwidth/2),oe.py=S(O+m.bandwidth/2)}}if(G.finish(),Y({group:t.groups.overlay,plot:P,scale:n,labels:g.labels,fontSize:t.fontSize,rotated:g.labels.length>6}),ce({group:t.groups.axis,plot:P,scale:m,labels:y.map(C=>C.label),fontSize:t.fontSize}),t.labels&&t.labels.show){const C=t.typography&&t.typography.small||t.fontSize||11,O=[];for(const W of y)for(const oe of W.points)oe.px===void 0||!B(oe.y)||O.push({x:oe.px,y:oe.py,text:J(oe.y,t.labels,t.grid),inside:!0,width:n.bandwidth-4,height:m.bandwidth-2});f({group:t.groups.labels,size:C,minGap:0,anchors:O})}return{xScale:n,yScale:m,series:y,ramp:i}}function w(t){const c=t.scheme||$(),{plot:P,bound:g}=t;new ee(t.groups.grid).finish(),new ee(t.groups.axis).finish(),new ee(t.groups.rules).finish(),new ee(t.groups.labels).finish();const y=g.series[0],j=y?y.points.map((O,W)=>({point:O,label:g.labels[W],value:B(O.y)?O.y:0})).filter(O=>O.value>0):[];if(!j.length)return{stages:j};let h=0;for(let O=0;O<j.length;O++)j[O].value>h&&(h=j[O].value);const i=P.height/j.length,n=P.left+P.width/2,m=P.width*.62,G=new ee(t.groups.marks);j.forEach((O,W)=>{const oe=j[W+1],_=P.top+W*i,le=O.value/h*m/2,ue=(oe?oe.value:O.value)/h*m/2;I(G.next("path",`${L}__funnel ${L}__mark`),{d:ne(["M",S(n-le),S(_),"L",S(n+le),S(_),"L",S(n+ue),S(_+i-2),"L",S(n-ue),S(_+i-2),"Z"]),fill:c.series(W),"data-point":W}),O.point.px=S(n),O.point.py=S(_+i/2)}),G.finish();const C=new ee(t.groups.overlay);return j.forEach((O,W)=>{const oe=P.top+W*i,_=C.next("text",`${L}__funnel-label`);I(_,{x:S(P.left+4),y:S(oe+i/2),"text-anchor":"start","dominant-baseline":"middle"}),Z(_,O.label);const le=C.next("text",`${L}__funnel-value`);I(le,{x:S(P.right-4),y:S(oe+i/2),"text-anchor":"end","dominant-baseline":"middle"});const ue=W===0?1:O.value/j[W-1].value,ge=t.labels&&t.labels.show?J(O.value,t.labels,t.grid):D(O.value,t.grid.messages);Z(le,W===0?ge:`${ge} · ${Math.round(ue*100)}%`)}),C.finish(),{stages:j}}function p(t){const c=t.scheme||$(),{plot:P,bound:g}=t,[y,j,h,i]=g.series;if(!y||!j||!h||!i)return{xScale:null,yScale:null,series:[]};const n=[];for(const oe of[j,h])for(const _ of oe.points)n.push(_.y);const m=Q(n,{zero:!1}),G={...x([],[0,0])},C=l(m,P),O=x(g.categories,[P.left,P.right],.3);X({gridGroup:t.groups.grid,axisGroup:t.groups.axis,plot:P,scale:C,format:d(t.grid,{kind:"linear",step:(m.max-m.min)/5})}),de({group:t.groups.rules,plot:P}),Y({group:t.groups.overlay,plot:P,scale:O,labels:g.labels,fontSize:t.fontSize,rotated:g.labels.length>10});const W=new ee(t.groups.marks);for(let oe=0;oe<g.categories.length;oe++){const _=y.points[oe],le=j.points[oe],ue=h.points[oe],ge=i.points[oe];if(![_,le,ue,ge].every(Oe=>Oe&&B(Oe.y)))continue;const ye=O.of(g.categories[oe]),be=ye+O.bandwidth/2,Me=ge.y>=_.y,je=Me?c.positive:c.negative;I(W.next("path",`${L}__wick ${L}__mark`),{d:ne(["M",S(be),S(C.of(le.y)),"L",S(be),S(C.of(ue.y))]),stroke:je,fill:"none"});const xe=C.of(Math.max(_.y,ge.y)),$e=C.of(Math.min(_.y,ge.y));I(W.next("rect",`${L}__candle ${L}__mark`),{x:S(ye),y:S(xe),width:S(O.bandwidth),height:S(Math.max(1,$e-xe)),fill:Me?"transparent":je,stroke:je,"data-point":oe}),ge.px=S(be),ge.py=S(xe)}return W.finish(),{xScale:O,yScale:C,series:[i],candles:g.categories.length}}function l(t,c){const P=t.max-t.min||1;return{kind:"linear",domain:t,range:[c.bottom,c.top],of(g){return c.bottom+(g-t.min)/P*(c.top-c.bottom)},ticks(g=5){const y=[];for(let j=0;j<=g;j++)y.push(t.min+P*j/g);return y}}}function v(t){const c=t.scheme||$(),{plot:P}=t;new ee(t.groups.grid).finish(),new ee(t.groups.rules).finish(),new ee(t.groups.labels).finish();const g=t.columns||[];if(g.length<2)return null;const y=t.grid&&t.grid.statistics;if(!y)return null;const j=t.method==="spearman"?"spearman":t.method==="kendall"?"kendall":"correlation",h=[];for(let W=0;W<g.length;W++)for(let oe=0;oe<g.length;oe++){const _=W===oe?1:y[j](g[W],g[oe]);h.push({row:W,col:oe,a:g[W],b:g[oe],r:_})}const i=g.length,n=P.width/i,m=P.height/i,G=new ee(t.groups.marks);for(const W of h){const oe=P.left+W.col*n,_=P.top+W.row*m;W.x=oe,W.y=_,W.width=n,W.height=m;const le=G.next("rect",`${L}__cell ${L}__mark`);I(le,{x:S(oe),y:S(_),width:S(Math.max(0,n-1)),height:S(Math.max(0,m-1)),fill:W.row===W.col||W.r===null?"var(--lattice-chart-empty, #eceff1)":o(W.r,c),"data-row":W.row,"data-col":W.col}),W.element=le}G.finish();const C=new ee(t.groups.overlay),O=U(P);for(let W=0;W<i;W++){const oe=C.next("text",`${L}__tick`);q(oe,t.fontSize),I(oe,{x:S(P.left-4),y:S(P.top+W*m+m/2),"text-anchor":"end","dominant-baseline":"middle"}),ae(oe,s(t.grid,g[W]),O,t.fontSize);const _=C.next("text",`${L}__tick`);q(_,t.fontSize),I(_,{x:S(P.left+W*n+n/2),y:S(P.top-4),"text-anchor":"middle"}),ae(_,s(t.grid,g[W]),n,t.fontSize)}if(t.values!==!1&&n>t.fontSize*2.6&&m>t.fontSize*1.5)for(const W of h){if(W.row===W.col||W.r===null)continue;const oe=C.next("text",`${L}__data-label`);q(oe,t.fontSize),I(oe,{x:S(P.left+W.col*n+n/2),y:S(P.top+W.row*m+m/2),"text-anchor":"middle","dominant-baseline":"middle","data-inside":"true"}),Z(oe,W.r.toFixed(2))}return C.finish(),{cells:h,columns:g}}function o(t,c){const P=Math.min(1,Math.abs(t)),g=c?R(c,!0):e,y=g[Math.floor(g.length/2)],j=t>=0?g[g.length-1]:g[0];return u(y,j,P)}function s(t,c){const P=t&&t.columns&&typeof t.columns.get=="function"?t.columns.get(c):null;return String(P&&P.title||c)}function b(t){for(const c of t.cells||[])if(c.x!==void 0&&t.x>=c.x&&t.x<=c.x+c.width&&t.y>=c.y&&t.y<=c.y+c.height)return c;return null}}),Xe("packages/modules/charts/topojson.js",function(a,V){"use strict";Object.defineProperty(a,"transformer",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(a,"arcPoints",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"stitch",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"decodeGeometry",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"feature",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"isTopology",{enumerable:!0,get:function(){return X}});function ve(U){if(!U)return B=>[B[0],B[1]];const[ae,N]=U.scale,[d,D]=U.translate;let z=0,x=0;return(B,Q)=>(Q||(z=0,x=0),z+=B[0],x+=B[1],[z*ae+d,x*N+D])}function ee(U,ae){const N=U.arcs[ae],d=ve(U.transform);return N.map((D,z)=>d(D,z))}function M(U,ae){const N=ee(U,ae<0?~ae:ae);return ae<0?N.slice().reverse():N}function de(U,ae){const N=[];for(const d of ae){const D=M(U,d);for(let z=N.length?1:0;z<D.length;z++)N.push(D[z])}return N}function ce(U,ae){if(!ae||!ae.type)return null;const N=ve(U.transform);switch(ae.type){case"Point":return{type:"Point",coordinates:N(ae.coordinates,0)};case"MultiPoint":return{type:"MultiPoint",coordinates:ae.coordinates.map(d=>N(d,0))};case"LineString":return{type:"LineString",coordinates:de(U,ae.arcs)};case"MultiLineString":return{type:"MultiLineString",coordinates:ae.arcs.map(d=>de(U,d))};case"Polygon":return{type:"Polygon",coordinates:ae.arcs.map(d=>de(U,d))};case"MultiPolygon":return{type:"MultiPolygon",coordinates:ae.arcs.map(d=>d.map(D=>de(U,D)))};case"GeometryCollection":return{type:"GeometryCollection",geometries:(ae.geometries||[]).map(d=>ce(U,d)).filter(Boolean)};default:return null}}function Y(U,ae){const N=typeof ae=="string"?(U.objects||{})[ae]:ae;if(!N)return{type:"FeatureCollection",features:[]};const d=N.type==="GeometryCollection"?N.geometries||[]:[N],D=[];for(const z of d){const x=ce(U,z);x&&D.push({type:"Feature",id:z.id,properties:z.properties||{},geometry:x})}return{type:"FeatureCollection",features:D}}function X(U){return!!U&&typeof U=="object"&&U.type==="Topology"&&Array.isArray(U.arcs)}}),Xe("packages/modules/charts/projection.js",function(a,V){"use strict";Object.defineProperty(a,"MERCATOR_LIMIT",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"equalEarth",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"robinson",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"mercator",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"equirectangular",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"albers",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(a,"transverseMercator",{enumerable:!0,get:function(){return N}}),Object.defineProperty(a,"PROJECTIONS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(a,"DEFAULT_PROJECTION",{enumerable:!0,get:function(){return D}}),Object.defineProperty(a,"resolveProjection",{enumerable:!0,get:function(){return z}}),Object.defineProperty(a,"WRAP_DEGREES",{enumerable:!0,get:function(){return x}}),Object.defineProperty(a,"splitAntimeridian",{enumerable:!0,get:function(){return B}}),Object.defineProperty(a,"boundsOf",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(a,"fitted",{enumerable:!0,get:function(){return F}}),Object.defineProperty(a,"graticule",{enumerable:!0,get:function(){return ne}});const ve=Math.PI/180,ee=Object.freeze([1.340264,-.081106,893e-6,.003796]),M=Object.freeze([[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]]),de=85.05113;function ce(S,Z){const[te,q,E,L]=ee,se=Z*ve,R=Math.asin(Math.min(1,Math.max(-1,Math.sqrt(3)/2*Math.sin(se)))),$=R*R,he=$*$*$,f=Math.sqrt(3)/2*(te+3*q*$+he*(7*E+9*L*$));return[S*ve*Math.cos(R)/f,R*(te+q*$+he*(E+L*$))]}function Y(S,Z){const te=Math.min(Math.abs(Z),90),q=Math.min(M.length-2,Math.floor(te/5)),E=(te-q*5)/5,[L,se]=M[q],[R,$]=M[q+1],he=L+(R-L)*E,f=se+($-se)*E;return[S*ve*he,(Z<0?-f:f)*(Math.PI/2)]}function X(S,Z){const te=Math.min(de,Math.max(-de,Z))*ve;return[S*ve,Math.log(Math.tan(Math.PI/4+te/2))]}function U(S,Z){return[S*ve,Z*ve]}function ae(S={}){const[Z,te]=S.parallels||[29.5,45.5],[q,E]=S.centre||[-96,37.5],L=Z*ve,se=te*ve,R=Math.sin(L),$=Math.abs(L-se)<1e-9?R:(R+Math.sin(se))/2,he=Math.cos(L)**2+2*$*R,f=Math.sqrt(he-2*$*Math.sin(E*ve))/$;return(J,H)=>{const e=$*((J-q)*ve),u=Math.max(0,he-2*$*Math.sin(H*ve)),k=Math.sqrt(u)/$;return[k*Math.sin(e),f-k*Math.cos(e)]}}function N(S={}){const[Z,te]=S.centre||[-2,49];return(q,E)=>{const L=E*ve,se=(q-Z)*ve,R=Math.cos(L)*Math.sin(se),$=Math.min(1-1e-12,Math.max(-1+1e-12,R));return[.5*Math.log((1+$)/(1-$)),Math.atan2(Math.tan(L),Math.cos(se))-te*ve]}}const d=Object.freeze({equalEarth:()=>ce,robinson:()=>Y,mercator:()=>X,equirectangular:()=>U,albers:ae,transverseMercator:N,britishNationalGrid:S=>N({centre:[-2,49],...S})}),D="equalEarth";function z(S,Z={},te){if(typeof S=="function")return S;const E=d[typeof S=="string"&&S?S:D];return E?E(Z):(te&&te(`chart projection ${JSON.stringify(S)} is not one this module draws; using '${D}'. Supported: ${Object.keys(d).join(", ")}.`),d[D]({}))}const x=180;function B(S){if(!Array.isArray(S)||S.length<2)return S&&S.length?[S]:[];const Z=[];let te=[S[0]];for(let q=1;q<S.length;q++){const[E,L]=S[q-1],[se,R]=S[q],$=se-E;if(Math.abs($)>x){const he=$>0?-180:180,f=$>0?$-360:$+360,J=f===0?0:Math.min(1,Math.max(0,(he-E)/f)),H=L+(R-L)*J;te.push([he,H]),Z.push(te),te=[[-he,H],[se,R]]}else te.push([se,R])}return Z.push(te),Z.filter(q=>q.length>1)}function Q(S){let Z=1/0,te=1/0,q=-1/0,E=-1/0;for(const L of S||[])for(const[se,R]of L)se<Z&&(Z=se),se>q&&(q=se),R<te&&(te=R),R>E&&(E=R);return Number.isFinite(Z)?{west:Z,south:te,east:q,north:E}:null}function F(S){const{project:Z,rings:te,plot:q}=S,E=typeof S.padding=="number"?S.padding:4;let L=1/0,se=1/0,R=-1/0,$=-1/0;for(const b of te||[])for(const[t,c]of b){const[P,g]=Z(t,c);!Number.isFinite(P)||!Number.isFinite(g)||(P<L&&(L=P),P>R&&(R=P),g<se&&(se=g),g>$&&($=g))}if(!Number.isFinite(L)||R===L||$===se)return{to:(t,c)=>{const[P,g]=Z(t,c);return[q.left+q.width/2+P,q.top+q.height/2-g]},scale:1,width:q.width,height:q.height,left:q.left,top:q.top,aspect:1};const he=Math.max(1,q.width-E*2),f=Math.max(1,q.height-E*2),J=typeof S.zoom=="number"&&S.zoom>0?S.zoom:1,H=Math.min(he/(R-L),f/($-se))*J,e=(R-L)*H,u=($-se)*H,[k,r]=S.centre?Z(S.centre[0],S.centre[1]):[(L+R)/2,(se+$)/2],w=S.centreOffset||[0,0],p=k+(w[0]||0),l=r+(w[1]||0),v=q.left+q.width/2,o=q.top+q.height/2;return{to:(b,t)=>{const[c,P]=Z(b,t);return[v+(c-p)*H,o-(P-l)*H]},scale:H,width:e,height:u,left:v-e/2,top:o-u/2,aspect:(R-L)/($-se)}}const I=2;function ne(S={}){const Z=S.step&&S.step>0?S.step:30,te=[];for(let q=-180;q<=180;q+=Z){const E=[];for(let L=-80;L<=80;L+=I)E.push([q,L]);te.push(E)}for(let q=-60;q<=60;q+=Z){const E=[];for(let L=-180;L<=180;L+=I)E.push([L,q]);te.push(E)}return te}}),Xe("packages/modules/charts/geo.js",function(a,V){"use strict";Object.defineProperty(a,"CONTINENTS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(a,"CONTINENT_NAMES",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"OUTLINES",{enumerable:!0,get:function(){return k}}),Object.defineProperty(a,"COUNTRY_CONTINENT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(a,"ALPHA3",{enumerable:!0,get:function(){return w}}),Object.defineProperty(a,"NUMERIC",{enumerable:!0,get:function(){return p}}),Object.defineProperty(a,"normaliseCode",{enumerable:!0,get:function(){return l}}),Object.defineProperty(a,"continentOf",{enumerable:!0,get:function(){return v}}),Object.defineProperty(a,"projection",{enumerable:!0,get:function(){return o}}),Object.defineProperty(a,"projectedPath",{enumerable:!0,get:function(){return s}}),Object.defineProperty(a,"ringPath",{enumerable:!0,get:function(){return b}}),Object.defineProperty(a,"shapesToPaths",{enumerable:!0,get:function(){return t}}),Object.defineProperty(a,"registerGeoPack",{enumerable:!0,get:function(){return P}}),Object.defineProperty(a,"geoPack",{enumerable:!0,get:function(){return g}}),Object.defineProperty(a,"geoPacks",{enumerable:!0,get:function(){return y}}),Object.defineProperty(a,"resolvePack",{enumerable:!0,get:function(){return j}}),Object.defineProperty(a,"packRegions",{enumerable:!0,get:function(){return i}}),Object.defineProperty(a,"regionLabelPoint",{enumerable:!0,get:function(){return m}}),Object.defineProperty(a,"geoRamp",{enumerable:!0,get:function(){return G}}),Object.defineProperty(a,"drawGeomap",{enumerable:!0,get:function(){return O}}),Object.defineProperty(a,"regionAt",{enumerable:!0,get:function(){return W}}),Object.defineProperty(a,"markerAt",{enumerable:!0,get:function(){return oe}});const ee=V("packages/modules/charts/frame.js").Pool,de=V("packages/modules/charts/matrix.js").colourRamp,Y=V("packages/modules/charts/topojson.js").feature,X=V("packages/modules/charts/projection.js"),U=X.fitted,ae=X.graticule,N=X.resolveProjection,d=X.splitAntimeridian,z=V("packages/modules/charts/labels.js").drawAnchoredLabels,x=V("packages/modules/charts/axis.js"),B=x.overhangFor,Q=x.setPlotClip,I=V("packages/core/src/internal/util.js").warnOnce,S=V("packages/modules/charts/scheme.js").resolveScheme,Z=V("packages/modules/charts/scale.js"),te=Z.isNumber,q=Z.measureDomain,E=V("packages/modules/charts/svg.js"),L=E.attrs,se=E.insideRings,R=E.path,$=E.pathRings,he=E.round,f=E.setText,H=V("packages/modules/charts/styles.js").NS,e=Object.freeze(["AF","AN","AS","EU","NA","OC","SA"]),u=Object.freeze({AF:"Africa",AN:"Antarctica",AS:"Asia",EU:"Europe",NA:"North America",OC:"Oceania",SA:"South America"}),k=Object.freeze({NA:[[[-168,66],[-156,71],[-130,70],[-115,69],[-100,69],[-85,70],[-75,73],[-64,66],[-78,62],[-79,55],[-65,60],[-56,52],[-60,45],[-67,45],[-70,42],[-74,40],[-76,37],[-81,32],[-80,27],[-81,25],[-84,30],[-90,29],[-94,29],[-97,26],[-97,21],[-91,19],[-88,21],[-87,16],[-83,9],[-79,9],[-85,13],[-92,16],[-96,16],[-105,20],[-110,24],[-114,28],[-117,32],[-122,37],[-124,42],[-124,48],[-130,55],[-140,60],[-150,59],[-160,55],[-165,60],[-168,66]],[[-43,60],[-32,64],[-22,70],[-20,74],[-25,78],[-33,83],[-45,83],[-58,82],[-62,76],[-56,70],[-55,66],[-52,61],[-43,60]]],SA:[[[-81,12],[-72,12],[-62,11],[-52,5],[-50,0],[-44,-2],[-35,-6],[-38,-13],[-39,-18],[-48,-25],[-53,-34],[-57,-38],[-62,-40],[-65,-45],[-68,-52],[-75,-53],[-73,-45],[-73,-37],[-71,-30],[-70,-23],[-71,-18],[-76,-14],[-81,-6],[-80,-2],[-78,1],[-77,8],[-81,12]]],EU:[[[-10,36],[-9,44],[-2,43],[-4,48],[-1,49],[4,52],[7,53],[8,57],[10,58],[5,58],[5,62],[11,64],[15,69],[21,70],[28,71],[32,70],[40,67],[44,68],[50,69],[60,70],[60,60],[58,52],[50,46],[40,44],[36,45],[30,46],[28,41],[26,40],[23,38],[18,40],[13,38],[15,37],[12,44],[8,44],[3,42],[-2,37],[-10,36]],[[-5,50],[1,51],[2,53],[-1,55],[-3,58],[-5,58],[-6,55],[-5,50]],[[-10,52],[-6,52],[-6,55],[-10,55],[-10,52]]],AF:[[[-17,21],[-16,15],[-17,12],[-13,8],[-8,5],[-3,5],[3,6],[8,4],[9,2],[10,-2],[12,-6],[12,-12],[14,-18],[15,-23],[18,-29],[23,-34],[27,-34],[32,-29],[33,-26],[35,-22],[40,-16],[41,-10],[40,-3],[43,0],[51,4],[51,11],[45,12],[43,12],[39,15],[37,21],[34,28],[32,31],[25,32],[20,31],[15,32],[10,37],[3,36],[-2,35],[-6,36],[-10,30],[-13,27],[-17,21]]],AS:[[[26,40],[35,36],[36,31],[43,30],[48,30],[50,27],[56,25],[57,22],[60,25],[62,25],[67,24],[70,21],[73,16],[77,8],[80,6],[80,13],[84,19],[87,21],[92,21],[95,16],[98,10],[104,1],[104,10],[107,11],[109,17],[117,23],[122,30],[122,37],[126,34],[129,35],[130,43],[135,45],[142,45],[143,53],[140,58],[155,59],[162,60],[170,66],[180,68],[170,71],[150,73],[130,74],[110,76],[90,76],[75,73],[70,70],[60,70],[60,60],[58,52],[50,46],[40,44],[36,45],[30,46],[28,41],[26,40]],[[130,31],[132,32],[135,33],[137,34],[140,35],[141,38],[141,41],[142,42],[145,43],[145,45],[141,45],[140,42],[139,40],[137,37],[135,35],[133,34],[131,33],[130,31]]],OC:[[[113,-22],[114,-26],[115,-34],[119,-34],[126,-32],[132,-32],[137,-35],[141,-38],[147,-38],[150,-37],[153,-30],[153,-25],[146,-19],[142,-11],[136,-12],[130,-12],[126,-14],[122,-18],[113,-22]],[[145,-41],[148,-41],[148,-43],[145,-43],[145,-41]],[[173,-35],[178,-38],[174,-41],[172,-43],[167,-46],[170,-44],[173,-35]]],AN:[[[-180,-78],[-150,-76],[-120,-74],[-100,-73],[-80,-72],[-60,-63],[-45,-60],[-58,-64],[-70,-70],[-60,-76],[-30,-77],[0,-70],[20,-70],[40,-68],[60,-67],[80,-66],[100,-66],[120,-66],[140,-66],[160,-78],[170,-84],[180,-85],[-180,-85],[-180,-78]]]}),r=Object.freeze({AD:"EU",AE:"AS",AF:"AS",AG:"NA",AI:"NA",AL:"EU",AM:"AS",AO:"AF",AQ:"AN",AR:"SA",AS:"OC",AT:"EU",AU:"OC",AW:"NA",AX:"EU",AZ:"AS",BA:"EU",BB:"NA",BD:"AS",BE:"EU",BF:"AF",BG:"EU",BH:"AS",BI:"AF",BJ:"AF",BM:"NA",BN:"AS",BO:"SA",BR:"SA",BS:"NA",BT:"AS",BW:"AF",BY:"EU",BZ:"NA",CA:"NA",CD:"AF",CF:"AF",CG:"AF",CH:"EU",CI:"AF",CL:"SA",CM:"AF",CN:"AS",CO:"SA",CR:"NA",CU:"NA",CV:"AF",CY:"AS",CZ:"EU",DE:"EU",DJ:"AF",DK:"EU",DM:"NA",DO:"NA",DZ:"AF",EC:"SA",EE:"EU",EG:"AF",ER:"AF",ES:"EU",ET:"AF",FI:"EU",FJ:"OC",FK:"SA",FM:"OC",FO:"EU",FR:"EU",GA:"AF",GB:"EU",GD:"NA",GE:"AS",GF:"SA",GG:"EU",GH:"AF",GI:"EU",GL:"NA",GM:"AF",GN:"AF",GP:"NA",GQ:"AF",GR:"EU",GT:"NA",GU:"OC",GW:"AF",GY:"SA",HK:"AS",HN:"NA",HR:"EU",HT:"NA",HU:"EU",ID:"AS",IE:"EU",IL:"AS",IM:"EU",IN:"AS",IQ:"AS",IR:"AS",IS:"EU",IT:"EU",JE:"EU",JM:"NA",JO:"AS",JP:"AS",KE:"AF",KG:"AS",KH:"AS",KI:"OC",KM:"AF",KN:"NA",KP:"AS",KR:"AS",KW:"AS",KY:"NA",KZ:"AS",LA:"AS",LB:"AS",LC:"NA",LI:"EU",LK:"AS",LR:"AF",LS:"AF",LT:"EU",LU:"EU",LV:"EU",LY:"AF",MA:"AF",MC:"EU",MD:"EU",ME:"EU",MG:"AF",MH:"OC",MK:"EU",ML:"AF",MM:"AS",MN:"AS",MO:"AS",MQ:"NA",MR:"AF",MT:"EU",MU:"AF",MV:"AS",MW:"AF",MX:"NA",MY:"AS",MZ:"AF",NA:"AF",NC:"OC",NE:"AF",NG:"AF",NI:"NA",NL:"EU",NO:"EU",NP:"AS",NR:"OC",NZ:"OC",OM:"AS",PA:"NA",PE:"SA",PF:"OC",PG:"OC",PH:"AS",PK:"AS",PL:"EU",PM:"NA",PR:"NA",PS:"AS",PT:"EU",PW:"OC",PY:"SA",QA:"AS",RE:"AF",RO:"EU",RS:"EU",RU:"EU",RW:"AF",SA:"AS",SB:"OC",SC:"AF",SD:"AF",SE:"EU",SG:"AS",SI:"EU",SK:"EU",SL:"AF",SM:"EU",SN:"AF",SO:"AF",SR:"SA",SS:"AF",ST:"AF",SV:"NA",SY:"AS",SZ:"AF",TC:"NA",TD:"AF",TG:"AF",TH:"AS",TJ:"AS",TL:"AS",TM:"AS",TN:"AF",TO:"OC",TR:"AS",TT:"NA",TV:"OC",TW:"AS",TZ:"AF",UA:"EU",UG:"AF",US:"NA",UY:"SA",UZ:"AS",VA:"EU",VC:"NA",VE:"SA",VG:"NA",VI:"NA",VN:"AS",VU:"OC",WS:"OC",YE:"AS",YT:"AF",ZA:"AF",ZM:"AF",ZW:"AF"}),w=Object.freeze({AFG:"AF",ALB:"AL",DZA:"DZ",AND:"AD",AGO:"AO",ARG:"AR",ARM:"AM",AUS:"AU",AUT:"AT",AZE:"AZ",BHS:"BS",BHR:"BH",BGD:"BD",BRB:"BB",BLR:"BY",BEL:"BE",BLZ:"BZ",BEN:"BJ",BTN:"BT",BOL:"BO",BIH:"BA",BWA:"BW",BRA:"BR",BRN:"BN",BGR:"BG",BFA:"BF",BDI:"BI",KHM:"KH",CMR:"CM",CAN:"CA",CPV:"CV",CAF:"CF",TCD:"TD",CHL:"CL",CHN:"CN",COL:"CO",COM:"KM",COG:"CG",COD:"CD",CRI:"CR",CIV:"CI",HRV:"HR",CUB:"CU",CYP:"CY",CZE:"CZ",DNK:"DK",DJI:"DJ",DMA:"DM",DOM:"DO",ECU:"EC",EGY:"EG",SLV:"SV",GNQ:"GQ",ERI:"ER",EST:"EE",ETH:"ET",FJI:"FJ",FIN:"FI",FRA:"FR",GAB:"GA",GMB:"GM",GEO:"GE",DEU:"DE",GHA:"GH",GRC:"GR",GRL:"GL",GTM:"GT",GIN:"GN",GNB:"GW",GUY:"GY",HTI:"HT",HND:"HN",HKG:"HK",HUN:"HU",ISL:"IS",IND:"IN",IDN:"ID",IRN:"IR",IRQ:"IQ",IRL:"IE",ISR:"IL",ITA:"IT",JAM:"JM",JPN:"JP",JOR:"JO",KAZ:"KZ",KEN:"KE",KIR:"KI",PRK:"KP",KOR:"KR",KWT:"KW",KGZ:"KG",LAO:"LA",LVA:"LV",LBN:"LB",LSO:"LS",LBR:"LR",LBY:"LY",LIE:"LI",LTU:"LT",LUX:"LU",MKD:"MK",MDG:"MG",MWI:"MW",MYS:"MY",MDV:"MV",MLI:"ML",MLT:"MT",MHL:"MH",MRT:"MR",MUS:"MU",MEX:"MX",FSM:"FM",MDA:"MD",MCO:"MC",MNG:"MN",MNE:"ME",MAR:"MA",MOZ:"MZ",MMR:"MM",NAM:"NA",NRU:"NR",NPL:"NP",NLD:"NL",NZL:"NZ",NIC:"NI",NER:"NE",NGA:"NG",NOR:"NO",OMN:"OM",PAK:"PK",PLW:"PW",PSE:"PS",PAN:"PA",PNG:"PG",PRY:"PY",PER:"PE",PHL:"PH",POL:"PL",PRT:"PT",PRI:"PR",QAT:"QA",ROU:"RO",RUS:"RU",RWA:"RW",KNA:"KN",LCA:"LC",VCT:"VC",WSM:"WS",SMR:"SM",STP:"ST",SAU:"SA",SEN:"SN",SRB:"RS",SYC:"SC",SLE:"SL",SGP:"SG",SVK:"SK",SVN:"SI",SLB:"SB",SOM:"SO",ZAF:"ZA",SSD:"SS",ESP:"ES",LKA:"LK",SDN:"SD",SUR:"SR",SWZ:"SZ",SWE:"SE",CHE:"CH",SYR:"SY",TWN:"TW",TJK:"TJ",TZA:"TZ",THA:"TH",TLS:"TL",TGO:"TG",TON:"TO",TTO:"TT",TUN:"TN",TUR:"TR",TKM:"TM",TUV:"TV",UGA:"UG",UKR:"UA",ARE:"AE",GBR:"GB",USA:"US",URY:"UY",UZB:"UZ",VUT:"VU",VEN:"VE",VNM:"VN",YEM:"YE",ZMB:"ZM",ZWE:"ZW"}),p=Object.freeze({4:"AF",8:"AL",12:"DZ",20:"AD",24:"AO",32:"AR",36:"AU",40:"AT",44:"BS",48:"BH",50:"BD",51:"AM",52:"BB",56:"BE",64:"BT",68:"BO",70:"BA",72:"BW",76:"BR",84:"BZ",90:"SB",96:"BN",100:"BG",104:"MM",108:"BI",112:"BY",116:"KH",120:"CM",124:"CA",132:"CV",140:"CF",144:"LK",148:"TD",152:"CL",156:"CN",170:"CO",174:"KM",178:"CG",180:"CD",188:"CR",191:"HR",192:"CU",196:"CY",203:"CZ",204:"BJ",208:"DK",212:"DM",214:"DO",218:"EC",222:"SV",226:"GQ",231:"ET",232:"ER",233:"EE",246:"FI",250:"FR",262:"DJ",266:"GA",268:"GE",270:"GM",276:"DE",288:"GH",300:"GR",304:"GL",320:"GT",324:"GN",328:"GY",332:"HT",340:"HN",344:"HK",348:"HU",352:"IS",356:"IN",360:"ID",364:"IR",368:"IQ",372:"IE",376:"IL",380:"IT",384:"CI",388:"JM",392:"JP",398:"KZ",400:"JO",404:"KE",408:"KP",410:"KR",414:"KW",417:"KG",418:"LA",422:"LB",426:"LS",428:"LV",430:"LR",434:"LY",438:"LI",440:"LT",442:"LU",450:"MG",454:"MW",458:"MY",462:"MV",466:"ML",470:"MT",478:"MR",480:"MU",484:"MX",496:"MN",498:"MD",499:"ME",504:"MA",508:"MZ",512:"OM",516:"NA",520:"NR",524:"NP",528:"NL",548:"VU",554:"NZ",558:"NI",562:"NE",566:"NG",578:"NO",586:"PK",585:"PW",591:"PA",598:"PG",600:"PY",604:"PE",608:"PH",616:"PL",620:"PT",624:"GW",626:"TL",630:"PR",634:"QA",642:"RO",643:"RU",646:"RW",682:"SA",686:"SN",688:"RS",690:"SC",694:"SL",702:"SG",703:"SK",704:"VN",705:"SI",706:"SO",710:"ZA",716:"ZW",724:"ES",728:"SS",729:"SD",740:"SR",748:"SZ",752:"SE",756:"CH",760:"SY",762:"TJ",764:"TH",768:"TG",776:"TO",780:"TT",784:"AE",788:"TN",792:"TR",795:"TM",798:"TV",800:"UG",804:"UA",807:"MK",818:"EG",826:"GB",834:"TZ",840:"US",858:"UY",860:"UZ",862:"VE",882:"WS",887:"YE",894:"ZM"});function l(_){if(_==null||_==="")return null;const le=String(_).trim().toUpperCase();return le?/^\d+$/.test(le)?p[String(Number(le))]||null:le.length===2?le:le.length===3&&w[le]||null:null}function v(_){return _?e.includes(_)&&!(_ in r)||e.includes(_)?_:r[_]||null:null}function o(_,le={}){const ue=le.antarctic?-90:-58,ge=84,ye=ge-ue,be=Math.min(_.width/360,_.height/ye),Me=360*be,je=ye*be,xe=_.left+(_.width-Me)/2,$e=_.top+(_.height-je)/2;return(Oe,Pe)=>[xe+(Oe+180)*be,$e+(ge-Pe)*be]}function s(_,le){const ue=[];for(let ge=0;ge<_.length;ge++){const[ye,be]=le(_[ge][0],_[ge][1]);if(!Number.isFinite(ye)||!Number.isFinite(be))return ue.length>4?R([...ue,"Z"]):"";ue.push(ge?"L":"M",he(ye),he(be))}return ue.length?R([...ue,"Z"]):""}function b(_,le){const ue=Array.isArray(_)&&Array.isArray(_[0])&&Array.isArray(_[0][0])?_:[_],ge=[];for(const ye of ue)if(!(!Array.isArray(ye)||!ye.length)){for(let be=0;be<ye.length;be++){const[Me,je]=le(ye[be][0],ye[be][1]);ge.push(be?"L":"M",he(Me),he(je))}ge.push("Z")}return R(ge)}function t(_){const le=new Map,ue=_.shapes;if(!ue)return le;const ge=o(_.plot),ye=_.codeProperty||"iso_a2";if(!Array.isArray(ue)&&!ue.type){for(const Me of Object.keys(ue)){const je=l(Me);je&&typeof ue[Me]=="string"&&le.set(je,ue[Me])}return le}const be=ue.type==="FeatureCollection"?ue.features||[]:[ue];for(const Me of be){const je=Me.properties||{},xe=l(je[ye]??je.iso??je.code),$e=Me.geometry;if(!xe||!$e)continue;const Oe=$e.type==="MultiPolygon"?$e.coordinates:$e.type==="Polygon"?[$e.coordinates]:[],Pe=[];for(const De of Oe)for(const Ge of De)Pe.push(b(Ge,ge));Pe.length&&le.set(xe,Pe.join(" "))}return le}const c=new Map;function P(_){return _&&typeof _=="object"&&typeof _.id=="string"&&c.set(_.id,_),_}function g(_){return c.get(_)||null}function y(){return[...c.keys()]}function j(_,le){if(!_||typeof _!="object")return null;const ue=_;let ge=_;if(typeof ue.pack=="string"){if(ge=c.get(ue.pack),!ge)return I(`chart:geomap:pack:${ue.pack}`,`geometry pack ${JSON.stringify(ue.pack)} has not been loaded, so the map fell back to the schematic continents. Import the pack module and pass it as \`shapes\` — import { pack } from '@toclocoinc/lattice-grid/modules/geo-${ue.pack}'; createChart({ …, shapes: pack })${c.size?`. Loaded: ${[...c.keys()].join(", ")}.`:"."}`),null}else ue.pack&&typeof ue.pack=="object"&&(ge=ue.pack);if(!ge||typeof ge!="object")return null;const ye=ge;if(ye.topology)return{pack:ye,topology:ye.topology};if(ye.layers){const be=typeof ue.layer=="string"&&ue.layer||typeof le=="string"&&le||ye.defaultLayer||Object.keys(ye.layers)[0],Me=ye.layers[be];if(Me&&Me.topology)return{pack:ye,topology:Me.topology,layer:be}}return null}const h=new WeakMap;function i(_){const le=h.get(_);if(le)return le;const ue=[];for(const ge of Y(_,"regions").features){const ye=[],be=ge.geometry,Me=be.type==="MultiPolygon"?be.coordinates:be.type==="Polygon"?[be.coordinates]:[];for(const je of Me)for(const xe of je)for(const $e of d(xe))ye.push($e);ye.length&&ue.push({code:String(ge.id===void 0||ge.id===null?"":ge.id),label:ge.properties&&ge.properties.name||String(ge.id||""),properties:ge.properties||{},rings:ye})}return h.set(_,ue),ue}function n(_,le){const ue=[];for(let ge=0;ge<_.length;ge++){const[ye,be]=le(_[ge][0],_[ge][1]);!Number.isFinite(ye)||!Number.isFinite(be)||ue.push(ue.length?"L":"M",he(ye),he(be))}return ue.length>2?R(ue):""}function m(_){let le=null,ue=-1;for(const be of _){if(!be||be.length<3)continue;let Me=0,je=0,xe=0;for(let Oe=0;Oe<be.length;Oe++){const[Pe,De]=be[Oe],[Ge,Ve]=be[(Oe+1)%be.length],it=Pe*Ve-Ge*De;Me+=it,je+=(Pe+Ge)*it,xe+=(De+Ve)*it}Me/=2;const $e=Math.abs(Me);$e<1e-9||$e>ue&&(ue=$e,le=[je/(6*Me),xe/(6*Me)])}if(le)return le;const ge=_.flat();if(!ge.length)return null;const ye=ge.reduce((be,[Me,je])=>[be[0]+Me,be[1]+je],[0,0]);return[ye[0]/ge.length,ye[1]/ge.length]}function G(_,le,ue){const ge=de(_,le,ue);if(le)return ge;const ye=_.max-_.min||1,be=1/6;return Me=>ge(_.min+(be+(Me-_.min)/ye*(1-be))*ye)}function C(_,le){return(ue,ge)=>{const[ye,be]=_(ue,ge);return!Number.isFinite(ye)||!Number.isFinite(be)?[ye,be]:[Math.min(Math.max(ye,le.left),le.right),Math.min(Math.max(be,le.top),le.bottom)]}}function O(_){const le=_.scheme||S(),{plot:ue,bound:ge}=_;new ee(_.groups.grid).finish(),new ee(_.groups.axis).finish(),new ee(_.groups.rules).finish(),new ee(_.groups.labels).finish();const ye=j(_.shapes,_.layer),be=ye?new Map:t({shapes:_.shapes,plot:ue,codeProperty:_.codeProperty}),Me=be.size>0||!!ye,je=ye?i(ye.topology):null,xe=new Map;if(je)for(const Ye of je){xe.set(Ye.code,Ye);const qe=Ye.properties||{};qe.alpha3&&xe.set(String(qe.alpha3).toUpperCase(),Ye),qe.numeric&&xe.set(String(Number(qe.numeric)),Ye),qe.fips&&xe.set(String(qe.fips),Ye)}const $e=new Map,Oe=[],Pe=ge.series[0];if(Pe)for(let Ye=0;Ye<Pe.points.length;Ye++){const qe=Pe.points[Ye];if(!te(qe.y))continue;const A=ge.categories[Ye],Ae=l(A),pe=je?[Ae,A==null?"":String(A).trim().toUpperCase()].map(ke=>ke?xe.get(ke):null).find(Boolean):null,fe=pe?pe.code:null,Ne=je?fe:Me?Ae:v(Ae);if(!Ne||Me&&!je&&!be.has(Ne)){ge.labels[Ye]&&Oe.push(ge.labels[Ye]);continue}const me=$e.get(Ne)||{value:0,labels:[]};me.value+=qe.y,me.labels.push(ge.labels[Ye]),$e.set(Ne,me)}const De=$e.has("AN")||$e.has("AQ"),Ge=o(ue,{antarctic:De});let Ve=null;if(je){const Ye=De?je:je.filter(A=>A.code!=="AQ"&&A.code!=="AN"),qe=N(_.projection||ye.pack.projection,{...ye.pack.projectionOptions||{},..._.projectionOptions||{}},A=>I(`chart:geomap:projection:${String(_.projection)}`,A));Ve={project:qe,...U({project:qe,rings:Ye.flatMap(A=>A.rings),plot:ue,zoom:_.zoom,centre:_.centre,centreOffset:_.centreOffset}),drawn:Ye}}const it=q([...$e.values()].map(Ye=>Ye.value),{zero:!_.diverging,nice:!1}),gt=G(it,!!_.diverging,le),ft=B("geomap");Q(_.groups,ue,ft);const At={left:ue.left-ft,top:ue.top-ft,right:ue.right+ft,bottom:ue.bottom+ft},kt=Ve?C(Ve.to,At):null,Tt=new ee(_.groups.marks);if(!!_.graticule&&!!Ve){const Ye=_.graticule&&typeof _.graticule=="object"&&_.graticule.step||30;for(const qe of ae({step:Ye}))for(const A of d(qe)){const Ae=n(A,kt);if(!Ae)continue;const pe=Tt.next("path",`${H}__graticule`);L(pe,{d:Ae,class:`${H}__graticule`})}}const jt=[],Kt=Ve?Ve.drawn.map(Ye=>Ye.code):Me?[...be.keys()]:e.filter(Ye=>Ye!=="AN"||De),zt=Ve?new Map(Ve.drawn.map(Ye=>[Ye.code,Ye])):null;for(const Ye of Kt){const qe=Ve?zt.get(Ye).rings.map(pe=>s(pe,kt)).filter(Boolean).join(" "):Me?be.get(Ye):b(k[Ye],Ge),A=$e.get(Ye),Ae=Tt.next("path",`${H}__region ${H}__mark`);L(Ae,{d:qe,fill:A?gt(A.value):"var(--lattice-chart-empty, #eceff1)","data-code":Ye,class:`${H}__region ${H}__mark`}),jt.push({code:Ye,value:A?A.value:null,label:!Me&&u[Ye]||zt&&zt.get(Ye).label||A&&A.labels[0]||Ye,element:Ae,d:qe})}Tt.finish();const It=new ee(_.groups.overlay);if(Oe.length){const Ye=It.next("text",`${H}__geo-note`);L(Ye,{x:he(ue.left),y:he(ue.bottom),"text-anchor":"start"}),f(Ye,_.grid.messages.t("chart.geoUnmatched",{count:Oe.length}))}It.finish();let Ht=0;if(_.labels&&_.labels.show&&Ve){const Ye=jt.filter(qe=>qe.value!==null).sort((qe,A)=>A.value-qe.value).map(qe=>{const A=zt.get(qe.code).rings.map(pe=>pe.map(([fe,Ne])=>Ve.to(fe,Ne))),Ae=m(A);return Ae&&{x:Ae[0],y:Ae[1],text:qe.label}}).filter(Boolean);Ht=z({group:_.groups.labels,size:_.fontSize,minGap:_.labels.minGap,anchors:Ye,plot:ue})}return{regions:jt,ramp:gt,unmatched:Oe,useCountries:Me,packed:!!Ve,scale:Ve?Ve.scale:null,attribution:ye&&ye.pack.attribution||"",aspect:Ve?Ve.aspect:null,labelsDrawn:Ht}}function W(_){for(const le of _.regions||[]){if(!le.rings){le.rings=$(le.d);let ge=1/0,ye=1/0,be=-1/0,Me=-1/0;for(const je of le.rings)for(const[xe,$e]of je)xe<ge&&(ge=xe),xe>be&&(be=xe),$e<ye&&(ye=$e),$e>Me&&(Me=$e);le.box={minX:ge,minY:ye,maxX:be,maxY:Me}}const ue=le.box;if(!(!ue||_.x<ue.minX||_.x>ue.maxX||_.y<ue.minY||_.y>ue.maxY)&&se(le.rings,_.x,_.y))return le}return null}function oe(_){let ue=null,ge=1/0;for(const ye of _.markers||[]){if(!ye)continue;const be=(ye.r||0)+3,Me=_.x-ye.x,je=_.y-ye.y,xe=Math.sqrt(Me*Me+je*je);xe>be||xe>=ge||(ge=xe,ue=ye)}return ue}}),Xe("packages/modules/charts/network.js",function(a,V){"use strict";Object.defineProperty(a,"ITERATIONS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(a,"LINK_GAP",{enumerable:!0,get:function(){return E}}),Object.defineProperty(a,"ICON_RADIUS",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"sequence",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"layoutNetwork",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"glyphFor",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"glyphTransform",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"offsetParallel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"drawNetwork",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"emphasiseNetwork",{enumerable:!0,get:function(){return H}}),Object.defineProperty(a,"nodeAt",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"linkAt",{enumerable:!0,get:function(){return k}});const ee=V("packages/modules/charts/frame.js").Pool,de=V("packages/modules/charts/scheme.js").resolveScheme,ce=V("packages/modules/charts/svg.js"),Y=ce.attrs,X=ce.path,U=ce.round,ae=ce.setText,d=V("packages/modules/charts/styles.js").NS,D=V("packages/modules/charts/typography.js"),z=D.applySize,x=D.truncateTo,B=V("packages/modules/charts/rulecolour.js"),Q=B.ruleColour,F=B.ruleLegend,ne=V("packages/core/src/internal/util.js").warnOnce,S=220,Z=2400,te=.006,q=.015,E=4,L=10;function se(r){let w=r>>>0||1;return()=>(w^=w<<13,w>>>=0,w^=w>>17,w^=w<<5,w>>>=0,w/4294967296)}function R(r){const{nodes:w,links:p,plot:l}=r;if(!w.length)return w;const v=se(w.length*2654435761),o=l.left+l.width/2,s=l.top+l.height/2,b=Math.min(l.width,l.height)/3;for(const c of w){const P=v()*Math.PI*2,g=b*(.35+v()*.65);c.x=o+Math.cos(P)*g,c.y=s+Math.sin(P)*g,c.vx=0,c.vy=0}for(const c of w)c.pinned=Number.isFinite(c.fx)&&Number.isFinite(c.fy),c.pinned&&(c.x=l.left+Math.max(0,Math.min(1,c.fx))*l.width,c.y=l.top+Math.max(0,Math.min(1,c.fy))*l.height);const t=r.iterations||S;for(let c=0;c<t;c++){const P=1-c/t;for(let g=0;g<w.length;g++){const y=w[g];for(let j=g+1;j<w.length;j++){const h=w[j];let i=y.x-h.x,n=y.y-h.y,m=Math.sqrt(i*i+n*n);m<.01&&(i=g-j||1,n=1,m=Math.sqrt(i*i+n*n));const G=Z/(m*m),C=i/m*G,O=n/m*G;y.vx+=C,y.vy+=O,h.vx-=C,h.vy-=O}}for(const g of p){const y=g.source,j=g.target;if(y===j)continue;const h=j.x-y.x,i=j.y-y.y,n=te*(g.weight||1);y.vx+=h*n,y.vy+=i*n,j.vx-=h*n,j.vy-=i*n}for(const g of w){if(g.pinned){g.vx=0,g.vy=0;continue}g.vx+=(o-g.x)*q,g.vy+=(s-g.y)*q,g.x+=g.vx*P*.08,g.y+=g.vy*P*.08,g.vx*=.82,g.vy*=.82,g.x=Math.max(l.left+8,Math.min(l.right-8,g.x)),g.y=Math.max(l.top+8,Math.min(l.bottom-8,g.y))}}return w}function $(r,w){if(!w)return null;const p=r&&r.icons;if(!p||typeof p.get!="function")return ne(`chart:icons:${w}`,`A network node asked for the icon '${w}', but this grid publishes no icon registry — a headless grid has no sprites. The node drew as a plain disc.`),null;const l=p.get(w);return l||(ne(`chart:icon:${w}`,`Unknown icon '${w}' on a network node; drew a plain disc instead. Register it with registerIcon or config.icons, or name a built-in.`),null)}function he(r,w){const p=String(r.viewBox||"0 0 16 16").trim().split(/[\s,]+/).map(Number),[l,v,o,s]=p.length===4&&p.every(Number.isFinite)?p:[0,0,16,16],b=Math.max(o||16,s||16),t=w.size/b,c=w.x-o*t/2,P=w.y-s*t/2;return`translate(${U(c-l*t)} ${U(P-v*t)}) scale(${U(t)})`}function f(r){const w=new Map;for(const p of r){const l=p.pair||`${p.source.key}\0${p.target.key}`;w.has(l)||w.set(l,[]),w.get(l).push(p)}for(const p of w.values()){const l=p.length;for(let v=0;v<l;v++){const o=p[v],s=o.source,b=o.target,t=b.x-s.x,c=b.y-s.y,P=Math.sqrt(t*t+c*c)||1,g=P?-c/P:0,y=P?t/P:1,j=(v-(l-1)/2)*E;o.offset=j,o.bundled=l>1,o.line={x1:s.x+g*j,y1:s.y+y*j,x2:b.x+g*j,y2:b.y+y*j}}}}function J(r){const w=r.scheme||de(),{plot:p,bound:l}=r;for(const m of["grid","axis","rules","labels"])new ee(r.groups[m]).finish();const v=l.nodes,o=l.links.map(m=>({...m,weight:m.value}));if(!v.length)return{nodes:[],links:[],legend:[]};const s=o.reduce((m,G)=>Math.max(m,G.value),0)||1;for(const m of o)m.weight=m.value/s;R({nodes:v,links:o,plot:p,iterations:r.iterations}),f(o);const b=l.measure&&l.measure.col||null,t=new Set;for(const m of o)m.colour=Q({grid:r.grid,col:b,value:m.value}),m.colour&&t.add(m.colour);const c=v.reduce((m,G)=>Math.max(m,G.in+G.out),0)||1,P=new ee(r.groups.marks),g=Number.isFinite(r.linkWidth)&&r.linkWidth>0?Number(r.linkWidth):null;for(const m of o){m.drawnWidth=g===null?.5+m.weight*3:g;const G=P.next("path",`${d}__edge ${d}__mark`);Y(G,{d:X(["M",U(m.line.x1),U(m.line.y1),"L",U(m.line.x2),U(m.line.y2)]),style:m.colour?`stroke:${m.colour};stroke-opacity:1`:null,"stroke-width":U(m.drawnWidth),fill:"none"}),m.el=G}for(const m of v){const G=(m.in+m.out)/c,C=m.icon||r.icon||null;m.glyph=$(r.grid,C),m.r=4+Math.sqrt(G)*12,m.glyph&&(m.r=Math.max(m.r,L));const O=P.next("circle",`${d}__node ${d}__mark`);Y(O,{cx:U(m.x),cy:U(m.y),r:U(m.r),fill:w.series(m.index),"data-node":m.key}),m.el=O}P.finish();const y=new ee(r.groups.overlay),j=[];for(const m of v){if(!m.glyph){m.glyphEls=[];continue}const G=m.glyph.paint==="stroke",C=he(m.glyph,{x:m.x,y:m.y,size:m.r*1.3});m.glyphEls=m.glyph.paths.map(O=>{const W=y.next("path",`${d}__node-icon${G?` ${d}__node-icon--stroke`:""}`);return Y(W,{d:O,transform:C}),W}),j.push(...m.glyphEls)}const h=r.typography&&r.typography.small||r.fontSize,i=v.filter(m=>m.declared),n=v.filter(m=>!m.declared).sort((m,G)=>G.in+G.out-(m.in+m.out)).slice(0,12);for(const m of[...i,...n]){const G=y.next("text",`${d}__flow-label`);z(G,h),Y(G,{x:U(m.x),y:U(m.y+m.r+h),"text-anchor":"middle"}),ae(G,x(m.label,90,h)),m.labelEl=G}return y.finish(),{nodes:v,links:o,glyphs:j,legend:F({grid:r.grid,col:b,colours:t})}}function H(r){const w=r.drawn||{},p=r.keys||new Set,l=p.size>0;let v=0;const o=new Set;for(const s of w.links||[]){const b=l&&(s.rowKeys||[]).some(t=>p.has(t));b&&(v++,o.add(s.source),o.add(s.target)),e(s.el,l&&!b)}for(const s of w.nodes||[]){const b=o.has(s);b&&v++,e(s.el,l&&!b);for(const t of s.glyphEls||[])e(t,l&&!b)}return v}function e(r,w){!r||!r.setAttribute||(w?r.setAttribute("data-dim","true"):r.removeAttribute("data-dim"))}function u(r){const w=typeof r.slack=="number"?r.slack:2;let p=null,l=1/0;for(const v of r.nodes||[]){if(typeof v.x!="number"||typeof v.y!="number")continue;const o=r.x-v.x,s=r.y-v.y,b=Math.sqrt(o*o+s*s);b<=(v.r||0)+w&&b<l&&(l=b,p=v)}return p}function k(r){let w=null,p=1/0;for(const l of r.links||[]){const v=l.line,o=v?{x:v.x1,y:v.y1}:l.source,s=v?{x:v.x2,y:v.y2}:l.target;if(!o||!s||typeof o.x!="number"||typeof s.x!="number")continue;const b=s.x-o.x,t=s.y-o.y,c=b*b+t*t,P=c?Math.max(0,Math.min(1,((r.x-o.x)*b+(r.y-o.y)*t)/c)):0,g=r.x-(o.x+P*b),y=r.y-(o.y+P*t),j=Math.sqrt(g*g+y*y),h=Number.isFinite(l.drawnWidth)?l.drawnWidth:.5+(l.weight||0)*3,i=l.bundled?Math.min(Math.max(2,h/2),E/2):Math.max(3,h/2);j<=i&&j<p&&(p=j,w=l)}return w}}),Xe("packages/modules/charts/flow.js",function(a,V){"use strict";Object.defineProperty(a,"assignDepths",{enumerable:!0,get:function(){return E}}),Object.defineProperty(a,"layoutSankey",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"ribbon",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"drawSankey",{enumerable:!0,get:function(){return R}}),Object.defineProperty(a,"layoutChord",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"drawChord",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"describeLink",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"flowNodeAt",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"ribbonAt",{enumerable:!0,get:function(){return H}}),Object.defineProperty(a,"chordArcAt",{enumerable:!0,get:function(){return e}}),Object.defineProperty(a,"chordRibbonAt",{enumerable:!0,get:function(){return u}}),Object.defineProperty(a,"chordPolygon",{enumerable:!0,get:function(){return k}});const ee=V("packages/modules/charts/frame.js").Pool,de=V("packages/modules/charts/format.js").measureText,Y=V("packages/modules/charts/scheme.js").resolveScheme,X=V("packages/modules/charts/svg.js"),U=X.attrs,ae=X.insideRings,N=X.path,d=X.round,D=X.setText,x=V("packages/modules/charts/styles.js").NS,B=V("packages/modules/charts/typography.js"),Q=B.applySize,F=B.textWidth,I=B.truncateTo,ne=Math.PI*2,S=12,Z=8,te=-Math.PI/2,q=16;function E(r,w){for(const s of r)s.depth=0;const p=r.length+1;for(let s=0;s<p;s++){let b=!1;for(const t of w){if(t.source===t.target)continue;const c=t.source.depth+1;c>t.target.depth&&c<p&&(t.target.depth=c,b=!0)}if(!b)break}const l=r.reduce((s,b)=>Math.max(s,b.depth),0),v=new Set,o=new Set;for(const s of w)s.source!==s.target&&(v.add(s.source),o.add(s.target));for(const s of r)!v.has(s)&&o.has(s)&&(s.depth=l);return l+1}function L(r){const{nodes:w,links:p,plot:l}=r,v=E(w,p),o=r.nodeWidth||S,s=new Map;for(const g of w)s.has(g.depth)||s.set(g.depth,[]),s.get(g.depth).push(g);let b=0;for(const g of s.values()){const y=g.reduce((h,i)=>h+Math.max(i.in,i.out),0),j=Math.max(0,g.length-1)*Z;y>0&&(b=Math.max(b,y/Math.max(1,l.height-j)))}const t=b>0?1/b:0,c=v>1?(l.width-o)/(v-1):0;for(const[g,y]of s){y.sort((n,m)=>Math.max(m.in,m.out)-Math.max(n.in,n.out));const j=y.map(n=>Math.max(1,Math.max(n.in,n.out)*t)),h=j.reduce((n,m)=>n+m,0)+(y.length-1)*Z;let i=l.top+Math.max(0,(l.height-h)/2);y.forEach((n,m)=>{n.x=l.left+g*c,n.width=o,n.y=i,n.height=j[m],n.inAt=i,n.outAt=i,i+=j[m]+Z})}const P=p.slice().sort((g,y)=>g.source.y-y.source.y||y.value-g.value);for(const g of P){const y=Math.max(1,g.value*t);g.thickness=y,g.y0=g.source.outAt+y/2,g.source.outAt+=y}for(const g of P.slice().sort((y,j)=>y.target.y-j.target.y||j.value-y.value))g.y1=g.target.inAt+g.thickness/2,g.target.inAt+=g.thickness;return{columns:v,scale:t}}function se(r){const w=r.source.x+r.source.width,p=r.target.x,l=(w+p)/2,v=r.thickness/2;return N(["M",d(w),d(r.y0-v),"C",d(l),d(r.y0-v),d(l),d(r.y1-v),d(p),d(r.y1-v),"L",d(p),d(r.y1+v),"C",d(l),d(r.y1+v),d(l),d(r.y0+v),d(w),d(r.y0+v),"Z"])}function R(r){const w=r.scheme||Y(),{plot:p,bound:l}=r;for(const c of["grid","axis","rules","labels"])new ee(r.groups[c]).finish();const v=l.nodes,o=l.links;if(!v.length||!o.length)return{nodes:[],links:[]};L({nodes:v,links:o,plot:p});const s=new ee(r.groups.marks);for(const c of o){const P=s.next("path",`${x}__ribbon ${x}__mark`);U(P,{d:se(c),fill:w.series(c.source.index),"data-link":`${c.source.key}->${c.target.key}`})}for(const c of v)U(s.next("rect",`${x}__node ${x}__mark`),{x:d(c.x),y:d(c.y),width:d(c.width),height:d(c.height),fill:w.series(c.index),"data-node":c.key});s.finish();const b=new ee(r.groups.overlay),t=r.typography&&r.typography.small||r.fontSize;for(const c of v){const P=c.x<p.left+p.width/2,g=b.next("text",`${x}__flow-label`);Q(g,t),U(g,{x:d(P?c.x+c.width+4:c.x-4),y:d(c.y+c.height/2),"text-anchor":P?"start":"end","dominant-baseline":"middle"});const y=P?p.right-(c.x+c.width)-6:c.x-p.left-6;D(g,I(c.label,Math.max(0,y),t))}return b.finish(),{nodes:v,links:o}}function $(r){const{nodes:w,links:p}=r,l=new Map;for(const g of w)l.set(g.key,0);for(const g of p)l.set(g.source.key,(l.get(g.source.key)||0)+g.value),l.set(g.target.key,(l.get(g.target.key)||0)+g.value);const v=[...l.values()].reduce((g,y)=>g+y,0);if(v<=0)return{arcs:[],ribbons:[]};const o=Math.min(.04,ne/(w.length*8||1)),s=ne-o*w.length,b=[];let t=-Math.PI/2;const c=new Map;for(const g of w){const j=(l.get(g.key)||0)/v*s;b.push({node:g,from:t,to:t+j}),c.set(g.key,t),t+=j+o}const P=[];for(const g of p.slice().sort((y,j)=>j.value-y.value)){const y=g.value/v*s,j=c.get(g.source.key),h=c.get(g.target.key);c.set(g.source.key,j+y),c.set(g.target.key,h+y),P.push({link:g,source:{from:j,to:j+y},target:{from:h,to:h+y}})}return{arcs:b,ribbons:P}}function he(r){const w=r.scheme||Y(),{plot:p,bound:l}=r;for(const i of["grid","axis","rules","labels"])new ee(r.groups[i]).finish();const v=p.left+p.width/2,o=p.top+p.height/2,s=r.typography&&r.typography.small||r.fontSize,b=Math.max(...l.nodes.map(i=>F(i.label,s)),0),t=Math.max(10,Math.min(p.width,p.height)/2-Math.min(b+8,90)),c=t*.92,{arcs:P,ribbons:g}=$({nodes:l.nodes,links:l.links,cx:v,cy:o,radius:t}),y=(i,n)=>[v+n*Math.cos(i),o+n*Math.sin(i)],j=new ee(r.groups.marks);for(const{link:i,source:n,target:m}of g){const[G,C]=y(n.from,c),[O,W]=y(n.to,c),[oe,_]=y(m.from,c),[le,ue]=y(m.to,c);U(j.next("path",`${x}__ribbon ${x}__mark`),{d:N(["M",d(G),d(C),"A",d(c),d(c),0,0,1,d(O),d(W),"Q",d(v),d(o),d(oe),d(_),"A",d(c),d(c),0,0,1,d(le),d(ue),"Q",d(v),d(o),d(G),d(C),"Z"]),fill:w.series(i.source.index),"fill-opacity":.55,"data-link":`${i.source.key}->${i.target.key}`})}for(const i of P){const[n,m]=y(i.from,t),[G,C]=y(i.to,t),[O,W]=y(i.to,c),[oe,_]=y(i.from,c),le=i.to-i.from>Math.PI?1:0;U(j.next("path",`${x}__node ${x}__mark`),{d:N(["M",d(n),d(m),"A",d(t),d(t),0,le,1,d(G),d(C),"L",d(O),d(W),"A",d(c),d(c),0,le,0,d(oe),d(_),"Z"]),fill:w.series(i.node.index),"data-node":i.node.key})}j.finish();const h=new ee(r.groups.overlay);for(const i of P){const n=(i.from+i.to)/2,[m,G]=y(n,t+6),C=h.next("text",`${x}__flow-label`);Q(C,s);const O=Math.cos(n)>=0;U(C,{x:d(m),y:d(G),"text-anchor":O?"start":"end","dominant-baseline":"middle"}),D(C,i.node.label)}return h.finish(),{arcs:P,ribbons:g,ring:{cx:v,cy:o,inner:c,radius:t}}}function f(r,w){return`${r.source.label} → ${r.target.label}: ${de(r.value,w)}`}function J(r){for(const w of r.nodes||[])if(!(typeof w.x!="number"||typeof w.width!="number")&&r.x>=w.x&&r.x<=w.x+w.width&&r.y>=w.y&&r.y<=w.y+w.height)return w;return null}function H(r){let w=null,p=1/0;for(const l of r.links||[]){const v=l.source,o=l.target;if(!v||!o||typeof l.y0!="number")continue;const s=v.x+v.width,b=o.x;if(r.x<Math.min(s,b)||r.x>Math.max(s,b))continue;const t=(s+b)/2,c=n=>{const m=1-n;return m*m*m*s+3*m*m*n*t+3*m*n*n*t+n*n*n*b};let P=0,g=1;for(let n=0;n<24;n++){const m=(P+g)/2;c(m)<r.x?P=m:g=m}const y=(P+g)/2,j=1-y,h=j*j*j*l.y0+3*j*j*y*l.y0+3*j*y*y*l.y1+y*y*y*l.y1,i=Math.max(1,l.thickness||1)/2;Math.abs(r.y-h)<=i&&(l.thickness||1)<p&&(p=l.thickness||1,w=l)}return w}function e(r){const w=r.ring;if(!w)return null;const p=r.x-w.cx,l=r.y-w.cy,v=Math.sqrt(p*p+l*l);if(v<w.inner||v>w.radius)return null;let o=Math.atan2(l,p);for(;o<te;)o+=ne;for(;o>=te+ne;)o-=ne;for(const s of r.arcs||[])if(o>=s.from&&o<s.to)return s;return null}function u(r){const w=r.ring;if(!w)return null;const p=r.x-w.cx,l=r.y-w.cy;if(Math.sqrt(p*p+l*l)>w.inner)return null;for(const v of r.ribbons||[])if(ae([k(v,w)],r.x,r.y))return v;return null}function k(r,w){const{cx:p,cy:l,inner:v}=w,o=c=>[p+v*Math.cos(c),l+v*Math.sin(c)],s=[],b=(c,P)=>{for(let g=0;g<=q;g++)s.push(o(c+(P-c)*g/q))},t=(c,P)=>{for(let g=1;g<q;g++){const y=g/q,j=1-y;s.push([j*j*c[0]+2*j*y*p+y*y*P[0],j*j*c[1]+2*j*y*l+y*y*P[1]])}};return b(r.source.from,r.source.to),t(o(r.source.to),o(r.target.from)),b(r.target.from,r.target.to),t(o(r.target.to),o(r.source.from)),s}}),Xe("packages/modules/charts/hit.js",function(a,V){"use strict";Object.defineProperty(a,"valueText",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(a,"ownsGeometry",{enumerable:!0,get:function(){return $}}),Object.defineProperty(a,"resolveHit",{enumerable:!0,get:function(){return he}});const ee=V("packages/modules/charts/format.js").measureText,de=V("packages/modules/charts/treemap.js").tileAt,ce=V("packages/modules/charts/geo.js"),Y=ce.markerAt,X=ce.regionAt,ae=V("packages/modules/charts/matrix.js").cellAt,N=V("packages/modules/charts/network.js"),d=N.linkAt,D=N.nodeAt,z=V("packages/modules/charts/flow.js"),x=z.chordArcAt,B=z.chordRibbonAt,Q=z.flowNodeAt,F=z.ribbonAt,I=" → ",ne=" – ",S=" › ";function Z(f,J,H){const e=ee(f,H);if(!J||typeof f!="number"||!Number.isFinite(f))return e;const u=f/J;return Number.isFinite(u)?`${e} (${H.number(u,{style:"percent",maximumFractionDigits:1})})`:e}function te(f,J){const H=f.item.node,e=J.bound.root&&J.bound.root.total||0,u=Array.isArray(f.path)?[...f.path]:[H.label];return{heading:u.length>1?u.join(S):H.label,rows:[{label:J.bound.measure.title,value:Z(H.total,e,J.grid.messages),colour:J.scheme.series(f.item.index||0)}],datum:{label:H.label,value:H.total,category:H.value,column:J.bound.measure.col&&J.spec.x||null,series:null,depth:f.depth,path:u,rowKeys:H.rowKey?[H.rowKey]:[]}}}function q(f,J,H){const e=J.reduce((u,k)=>u+(k.value||0),0);return{heading:f.label||f.code,rows:[{label:H.bound.measure.title,value:Z(f.value,e,H.grid.messages),colour:H.scheme.series(0)}],datum:{label:f.label||f.code,value:f.value,category:f.code,column:H.spec.code||H.spec.x||null,series:null,path:[f.label||f.code],rowKeys:[]}}}function E(f,J,H){const e=H.spec.value||H.spec.y||null,u=e?H.grid.columns.get(e):null,k=p=>`${Number(p).toFixed(4)}°`,r=(J.legend||[]).find(p=>p.colour===f.fill)||null,w=[{label:u&&u.title||e||"",value:f.text||"",colour:f.fill},{label:"",value:`${k(f.lat)}, ${k(f.lon)}`,colour:"transparent"}];return r&&r.label&&w.push({label:"",value:r.label,colour:f.fill}),{heading:f.label||f.text||"",rows:w,datum:{label:f.label||f.text||"",value:f.value,category:f.value,column:e,series:null,path:[f.label||f.text||""],lon:f.lon,lat:f.lat,status:r?r.label:null,rowKeys:f.rowKey?[f.rowKey]:[]}}}function L(f,J){const H=k=>{const r=J.grid.columns.get(k);return r&&r.title||k},e=H(f.a),u=H(f.b);return{heading:`${e} × ${u}`,rows:[{label:J.spec.method==="spearman"?"ρ":"r",value:typeof f.r=="number"&&Number.isFinite(f.r)?f.r.toFixed(2):"",colour:J.scheme.series(0)}],datum:{label:`${e} × ${u}`,value:typeof f.r=="number"?f.r:null,category:null,column:null,series:null,path:[e,u],rowKeys:[]}}}function se(f,J){const H=[];for(const u of J.drawn&&J.drawn.links||[])if(!(u.source!==f&&u.target!==f))for(const k of u.rowKeys||[])H.includes(k)||H.push(k);const e=Math.max(f.in||0,f.out||0);return{heading:f.label,rows:[{label:J.bound.measure.title,value:ee(e,J.grid.messages),colour:J.scheme.series(f.index||0)}],datum:{label:f.label,value:e,category:f.value===void 0?f.key:f.value,column:null,series:null,path:[f.label],rowKeys:H}}}function R(f,J){const H=`${f.source.label}${f.undirected?ne:I}${f.target.label}`;return{heading:H,rows:[{label:J.bound.measure.title,value:Z(f.value,f.undirected?0:J.bound.total||0,J.grid.messages),colour:f.colour||J.scheme.series(f.source.index||0)}],datum:{label:H,value:f.value,category:null,column:null,series:null,path:[f.source.label,f.target.label],rowKeys:Array.isArray(f.rowKeys)?[...f.rowKeys]:[]}}}function $(f){return f?!!(Array.isArray(f.tiles)||Array.isArray(f.regions)||Array.isArray(f.markers)||Array.isArray(f.cells)&&Array.isArray(f.columns)||Array.isArray(f.ribbons)&&f.ring||Array.isArray(f.nodes)&&Array.isArray(f.links)):!1}function he(f){const J=f.drawn;if(!J||!f.bound||!$(J))return null;const{x:H,y:e}=f.at;if(Array.isArray(J.tiles)){const u=de({tiles:J.tiles,x:H,y:e});return u?te(u,f):null}if(Array.isArray(J.regions)){const u=X({regions:J.regions,x:H,y:e});return u?q(u,J.regions,f):null}if(Array.isArray(J.markers)){const u=Y({markers:J.markers,x:H,y:e});return u?E(u,J,f):null}if(Array.isArray(J.cells)&&Array.isArray(J.columns)){const u=ae({cells:J.cells,x:H,y:e});return u?L(u,f):null}if(Array.isArray(J.ribbons)&&J.ring){const u=B({ribbons:J.ribbons,ring:J.ring,x:H,y:e});if(u)return R(u.link,f);const k=x({arcs:J.arcs,ring:J.ring,x:H,y:e});return k?se(k.node,f):null}if(Array.isArray(J.nodes)&&Array.isArray(J.links)){const u=J.nodes.some(w=>typeof w.r=="number"),k=u?D({nodes:J.nodes,x:H,y:e}):Q({nodes:J.nodes,x:H,y:e});if(k)return se(k,f);const r=u?d({links:J.links,x:H,y:e}):F({links:J.links,x:H,y:e});return r?R(r,f):null}return null}}),Xe("packages/modules/charts/polar.js",function(a,V){"use strict";Object.defineProperty(a,"arcBand",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"drawRadar",{enumerable:!0,get:function(){return se}}),Object.defineProperty(a,"drawGauge",{enumerable:!0,get:function(){return R}});const ee=V("packages/modules/charts/frame.js").Pool,de=V("packages/modules/charts/format.js").measureText,ce=V("packages/modules/charts/scale.js"),Y=ce.isNumber,X=ce.measureDomain,U=V("packages/modules/charts/svg.js"),ae=U.attrs,N=U.path,d=U.round,D=U.setText,x=V("packages/modules/charts/styles.js").NS,Q=V("packages/modules/charts/scheme.js").resolveScheme,F=V("packages/modules/charts/labels.js"),I=F.drawAnchoredLabels,ne=F.labelText,S=Math.PI*2,Z=4,te=S*2/3,q=Math.PI/2+(S-te)/2;function E($,he,f,J){const H=J-Math.PI/2;return[$+f*Math.cos(H),he+f*Math.sin(H)]}function L($){const he=$.to-$.from;if(he<=0)return"";const f=Math.max(0,$.r-$.width),J=he>Math.PI?1:0,[H,e]=E($.cx,$.cy,$.r,$.from),[u,k]=E($.cx,$.cy,$.r,$.to),[r,w]=E($.cx,$.cy,f,$.to),[p,l]=E($.cx,$.cy,f,$.from);return N(["M",d(H),d(e),"A",d($.r),d($.r),0,J,1,d(u),d(k),"L",d(r),d(w),"A",d(f),d(f),0,J,0,d(p),d(l),"Z"])}function se($){const he=$.scheme||Q(),{plot:f,bound:J}=$;new ee($.groups.grid).finish(),new ee($.groups.axis).finish(),new ee($.groups.rules).finish(),new ee($.groups.labels).finish();const H=f.left+f.width/2,e=f.top+f.height/2,u=Math.max(0,Math.min(f.width,f.height)/2-$.fontSize*2),k=J.labels,r=J.series.filter(t=>!$.hidden.has(t.key)),w=[];for(const t of r)for(const c of t.points)w.push(c.y);const p=X(w,{zero:!0}),l=k.length?S/k.length:S,v=t=>{const c=p.max-p.min||1;return Math.max(0,(t-p.min)/c*u)},o=new ee($.groups.grid);for(let t=1;t<=Z;t++){const c=u*t/Z,P=k.map((g,y)=>E(H,e,c,y*l));ae(o.next("path",`${x}__web`),{d:P.length?N([...P.flatMap(([g,y],j)=>[j?"L":"M",d(g),d(y)]),"Z"]):"",fill:"none"})}for(let t=0;t<k.length;t++){const[c,P]=E(H,e,u,t*l);ae(o.next("path",`${x}__web`),{d:N(["M",d(H),d(e),"L",d(c),d(P)]),fill:"none"})}o.finish();const s=new ee($.groups.marks);for(const t of r){const c=[];for(let y=0;y<k.length;y++){const j=t.points[y],h=Y(j&&j.y)?j.y:p.min,[i,n]=E(H,e,v(h),y*l);c.push([d(i),d(n)]),j&&(j.px=d(i),j.py=d(n))}const P=c.length?N([...c.flatMap(([y,j],h)=>[h?"L":"M",y,j]),"Z"]):"",g=he.series(t.index);ae(s.next("path",`${x}__radar-fill ${x}__mark`),{d:P,fill:g,"data-series":t.index}),ae(s.next("path",`${x}__radar-line ${x}__mark`),{d:P,stroke:g,fill:"none","data-series":t.index})}s.finish();const b=new ee($.groups.overlay);for(let t=0;t<k.length;t++){const[c,P]=E(H,e,u+$.fontSize,t*l),g=b.next("text",`${x}__tick`),y=Math.abs(c-H)<1?"middle":c>H?"start":"end";ae(g,{x:d(c),y:d(P),"text-anchor":y,"dominant-baseline":"middle"}),D(g,k[t])}if(b.finish(),$.labels&&$.labels.show){const t=$.typography&&$.typography.small||$.fontSize||11,c=[];for(const P of r)for(const g of P.points){if(!g||g.px===void 0||!Y(g.y))continue;const y=g.px-H,j=g.py-e,h=Math.hypot(y,j)||1;c.push({x:d(g.px+y/h*(t*.8)),y:d(g.py+j/h*(t*.8)),text:ne(g.y,$.labels,$.grid)})}I({group:$.groups.labels,size:t,minGap:$.labels.minGap,anchors:c,plot:f})}return{centre:{x:H,y:e,r:u},series:r,axes:k}}function R($){const he=$.scheme||Q(),{plot:f,bound:J}=$;new ee($.groups.grid).finish(),new ee($.groups.axis).finish(),new ee($.groups.rules).finish(),new ee($.groups.labels).finish();const H=J.series[0],u=(H?H.points.filter(g=>Y(g.y)):[]).reduce((g,y)=>g+y.y,0),k=Y($.min)?$.min:0,r=Y($.max)?$.max:Math.max(u,1),w=r-k||1,p=Math.min(1,Math.max(0,(u-k)/w)),l=f.left+f.width/2,v=f.top+f.height/2,o=Math.max(0,Math.min(f.width,f.height)/2-4),s=Math.max(6,o*.24),b=new ee($.groups.marks);if(ae(b.next("path",`${x}__gauge-track`),{d:L({cx:l,cy:v,r:o,width:s,from:q,to:q+te})}),ae(b.next("path",`${x}__gauge-value ${x}__mark`),{d:L({cx:l,cy:v,r:o,width:s,from:q,to:q+te*p}),fill:he.series(0)}),Y($.target)){const g=Math.min(1,Math.max(0,($.target-k)/w)),y=q+te*g,[j,h]=E(l,v,o-s,y),[i,n]=E(l,v,o,y);ae(b.next("path",`${x}__gauge-target`),{d:N(["M",d(j),d(h),"L",d(i),d(n)]),fill:"none"})}b.finish();const t=new ee($.groups.overlay),c=t.next("text",`${x}__gauge-reading`);ae(c,{x:d(l),y:d(v),"text-anchor":"middle","dominant-baseline":"middle"}),D(c,de(u,$.grid.messages));const P=t.next("text",`${x}__gauge-caption`);return ae(P,{x:d(l),y:d(v+$.fontSize*1.6),"text-anchor":"middle","dominant-baseline":"middle"}),D(P,J.measure.title||""),t.finish(),{value:u,domain:{min:k,max:r}}}}),Xe("packages/modules/charts/multiples.js",function(a,V){"use strict";Object.defineProperty(a,"MAX_PANELS",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(a,"panelGrid",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"panelRects",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"splitPanels",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"sharedDomain",{enumerable:!0,get:function(){return ce}});const ve=24;function ee(Y,X){if(Y<=1)return{columns:1,rows:1};const U=(X.width||1)/(X.height||1);let ae=Math.max(1,Math.round(Math.sqrt(Y*U)));ae=Math.min(ae,Y);const N=Math.ceil(Y/ae);return{columns:ae,rows:N}}function M(Y){const X=Math.min(Y.count,ve),U=Y.gap===void 0?10:Y.gap,ae=Y.titleHeight===void 0?14:Y.titleHeight,{columns:N,rows:d}=ee(X,Y.plot),D=(Y.plot.width-U*(N-1))/N,z=(Y.plot.height-U*(d-1))/d,x=[];for(let B=0;B<X;B++){const Q=B%N,F=Math.floor(B/N);x.push({index:B,x:Y.plot.left+Q*(D+U),y:Y.plot.top+F*(z+U)+ae,width:Math.max(0,D),height:Math.max(0,z-ae)})}return x}function de(Y){return Y.series.map((X,U)=>({label:X.label,key:X.key,index:U,bound:{...Y,series:[{...X,index:U}]}}))}function ce(Y,X,U){const ae=[];for(const N of Y.series)for(const d of N.points)ae.push(d.y);return U(ae,{zero:X})}}),Xe("packages/modules/charts/stream.js",function(a,V){"use strict";Object.defineProperty(a,"wiggleBaseline",{enumerable:!0,get:function(){return he}}),Object.defineProperty(a,"drawStream",{enumerable:!0,get:function(){return f}}),Object.defineProperty(a,"drawMarimekko",{enumerable:!0,get:function(){return J}}),Object.defineProperty(a,"drawViolin",{enumerable:!0,get:function(){return H}});const ve=V("packages/modules/charts/axis.js"),ee=ve.drawAxisLines,M=ve.drawCategoryAxis,de=ve.drawMeasureAxis,ce=V("packages/modules/charts/distribution.js"),Y=ce.density,X=ce.distributionDomain,U=ce.summarise,ae=ce.valuesByCategory,N=V("packages/modules/charts/frame.js"),d=N.Pool,D=N.shouldRotate,x=V("packages/modules/charts/format.js").formatters,B=V("packages/modules/charts/scale.js"),Q=B.bandScale,F=B.isNumber,I=B.linearScale,ne=B.measureDomain,Z=V("packages/modules/charts/scheme.js").resolveScheme,te=V("packages/modules/charts/svg.js"),q=te.attrs,E=te.path,L=te.round,R=V("packages/modules/charts/styles.js").NS,$=32;function he(e){const u=[];let k=0;for(let r=0;r<e.length;r++){const w=e[r],p=w.reduce((s,b)=>s+b,0);if(r===0){k=-p/2,u.push(k);continue}const l=e[r-1];let v=0;const o=w.length;for(let s=0;s<o;s++){let b=0;for(let t=0;t<s;t++)b+=(w[t]||0)-(l[t]||0);v+=(o-s-.5)*((w[s]||0)-(l[s]||0))+b*0}k-=o>0?v/o:0,u.push(k)}return u}function f(e){const u=e.scheme||Z(),{plot:k,bound:r}=e;new d(e.groups.grid).finish(),new d(e.groups.rules).finish(),new d(e.groups.labels).finish();const w=r.series.filter(c=>!e.hidden.has(c.key)),p=r.categories.map((c,P)=>w.map(g=>{const y=g.points[P];return F(y&&y.y)?Math.max(0,y.y):0})),l=he(p),v=[];p.forEach((c,P)=>{v.push(l[P]),v.push(l[P]+c.reduce((g,y)=>g+y,0))});const o=ne(v,{zero:!1,nice:!1}),s=I(o,[k.bottom,k.top]),b=Q(r.categories,[k.left,k.right],0),t=new d(e.groups.marks);return w.forEach((c,P)=>{const g=[],y=[];p.forEach((h,i)=>{let n=l[i];for(let G=0;G<P;G++)n+=h[G];const m=L(b.centre(r.categories[i]));y.push([m,L(s.of(n))]),g.push([m,L(s.of(n+h[P]))])});const j=[];g.forEach(([h,i],n)=>j.push(n?"L":"M",h,i));for(let h=y.length-1;h>=0;h--)j.push("L",y[h][0],y[h][1]);j.push("Z"),q(t.next("path",`${R}__stream ${R}__mark`),{d:E(j),fill:u.series(c.index),"data-series":c.index})}),t.finish(),M({group:e.groups.overlay,plot:k,scale:b,labels:r.labels,fontSize:e.typography&&e.typography.small||e.fontSize,rotated:D(r.labels,b.step,e.fontSize,(e.axis&&e.axis.x||{}).every),config:e.axis&&e.axis.x||{}}),{xScale:b,yScale:s,series:w}}function J(e){const u=e.scheme||Z(),{plot:k,bound:r}=e,w=r.series.filter(y=>!e.hidden.has(y.key)),p=r.categories.map((y,j)=>w.reduce((h,i)=>{const n=i.points[j];return h+(F(n&&n.y)?Math.abs(n.y):0)},0)),l=p.reduce((y,j)=>y+j,0);if(l<=0)return{series:w,columns:[]};const v=2,o=k.width-v*Math.max(0,r.categories.length-1),s=I({min:0,max:100},[k.bottom,k.top]);de({gridGroup:e.groups.grid,axisGroup:e.groups.axis,plot:k,scale:s,format:x(e.grid,{kind:"linear",step:20}),config:e.axis&&e.axis.y||{},grid:e.grid,size:e.typography&&e.typography.small||e.fontSize}),ee({group:e.groups.rules,plot:k});const b=new d(e.groups.marks),t=[];let c=k.left;r.categories.forEach((y,j)=>{const h=p[j]/l*o;let i=k.bottom;w.forEach((n,m)=>{const G=n.points[j],C=F(G&&G.y)?Math.abs(G.y):0,W=(p[j]>0?C/p[j]:0)*k.height;q(b.next("rect",`${R}__bar ${R}__mark`),{x:L(c),y:L(i-W),width:L(Math.max(0,h)),height:L(Math.max(0,W)),fill:u.series(n.index),"data-series":n.index,"data-point":j}),G&&(G.px=L(c+h/2),G.py=L(i-W)),i-=W}),t.push({category:y,label:r.labels[j],x:c,width:h,total:p[j]}),c+=h+v}),b.finish();const P=new d(e.groups.overlay),g=e.typography&&e.typography.small||e.fontSize;for(const y of t){if(y.width<g*2)continue;const j=P.next("text",`${R}__tick`);j.style.fontSize=`${g}px`,q(j,{x:L(y.x+y.width/2),y:L(k.top-2),"text-anchor":"middle"}),j.textContent=y.label}return P.finish(),{series:w,columns:t}}function H(e){const u=e.scheme||Z(),{plot:k,bound:r}=e,w=ae(r),p=[...w.keys()],l=[];for(const t of w.values())for(let c=0;c<t.length;c++)l.push(t[c]);const v=X(l,e.axis),o=I(v,[k.bottom,k.top]),s=Q(p,[k.left,k.right],.3);de({gridGroup:e.groups.grid,axisGroup:e.groups.axis,plot:k,scale:o,format:x(e.grid,{kind:"linear",step:(v.max-v.min)/5}),config:e.axis&&e.axis.y||{},grid:e.grid,size:e.typography&&e.typography.small||e.fontSize}),M({group:e.groups.overlay,plot:k,scale:s,labels:p,fontSize:e.typography&&e.typography.small||e.fontSize,rotated:p.length>6,config:e.axis&&e.axis.x||{}}),ee({group:e.groups.rules,plot:k});const b=new d(e.groups.marks);return p.forEach((t,c)=>{const P=w.get(t),g=Y(P,v,$),y=g.reduce((C,O)=>Math.max(C,O.density),0)||1,j=s.bandwidth/2,h=s.of(t)+j,i=g.map(C=>[L(h+C.density/y*j),L(o.of(C.at))]),n=g.map(C=>[L(h-C.density/y*j),L(o.of(C.at))]),m=[];i.forEach(([C,O],W)=>m.push(W?"L":"M",C,O));for(let C=n.length-1;C>=0;C--)m.push("L",n[C][0],n[C][1]);m.push("Z"),q(b.next("path",`${R}__violin ${R}__mark`),{d:E(m),fill:u.series(c),"data-point":c});const G=U(P);G&&q(b.next("path",`${R}__median ${R}__mark`),{d:E(["M",L(h-j*.5),L(o.of(G.median)),"L",L(h+j*.5),L(o.of(G.median))]),stroke:u.series(c),"stroke-width":2,fill:"none"})}),b.finish(),{xScale:s,yScale:o,series:[{key:"",label:r.measure.title,index:0,points:p.map(t=>{const c=U(w.get(t));return{x:t,xKey:t,label:t,y:c?c.median:null,rows:(w.get(t)||[]).length}})}]}}}),Xe("packages/modules/charts/gantt.js",function(a,V){"use strict";Object.defineProperty(a,"readTasks",{enumerable:!0,get:function(){return L}}),Object.defineProperty(a,"drawGantt",{enumerable:!0,get:function(){return se}});const ve=V("packages/modules/charts/axis.js"),ee=ve.drawAxisLines,M=ve.drawBandLabels,de=ve.drawContinuousAxis,Y=V("packages/modules/charts/frame.js").Pool,U=V("packages/modules/charts/format.js").formatters,ae=V("packages/modules/charts/scale.js"),N=ae.bandScale,d=ae.timeScale,D=ae.toTime,x=V("packages/modules/charts/scheme.js").resolveScheme,B=V("packages/modules/charts/svg.js"),Q=B.attrs,F=B.round,I=B.setText,S=V("packages/modules/charts/styles.js").NS,Z=V("packages/modules/charts/typography.js"),te=Z.applySize,q=Z.truncateTo,E=8;function L(R,$,he){const f=[];let J=1/0,H=-1/0;for(const e of he){const u=D(R.rows.value(e.key,$.start)),k=D(R.rows.value(e.key,$.end));if(u===null||k===null)continue;const r=$.label?R.rows.text(e.key,$.label):e.key,w=$.series?R.rows.value(e.key,$.series):null;f.push({key:e.key,label:r,group:w,from:Math.min(u,k),to:Math.max(u,k)}),J=Math.min(J,u,k),H=Math.max(H,u,k)}return{tasks:f,span:f.length?{min:J,max:H}:null}}function se(R){const $=R.scheme||x(),{plot:he}=R,{tasks:f,span:J}=L(R.grid,R.spec,R.rows);if(!J)return{tasks:[],xScale:null,dropped:0};const H=Math.max(1,Math.floor(he.height/E)),e=f.slice(0,H),u=f.length-e.length,k=d({min:J.min,max:J.max},[he.left,he.right]),r=N(e.map(o=>o.key),[he.top,he.bottom],.25),w=R.typography&&R.typography.small||R.fontSize;de({group:R.groups.overlay,plot:he,scale:k,format:U(R.grid,{kind:"time",span:J.max-J.min}),config:R.axis&&R.axis.x||{},grid:R.grid,size:w}),M({group:R.groups.axis,plot:he,scale:r,labels:e.map(o=>o.label),fontSize:w}),ee({group:R.groups.rules,plot:he});const p=[...new Set(e.map(o=>String(o.group)))],l=new Y(R.groups.marks);e.forEach((o,s)=>{const b=r.of(o.key),t=k.of(o.from),c=k.of(o.to);Q(l.next("rect",`${S}__task ${S}__mark`),{x:F(t),width:F(Math.max(2,c-t)),y:F(b),height:F(r.bandwidth),fill:$.series(o.group===null?0:p.indexOf(String(o.group))),"data-point":s,"data-key":o.key}),o.px=F((t+c)/2),o.py=F(b+r.bandwidth/2)}),l.finish();const v=new Y(R.groups.labels);if(u>0){const o=v.next("text",`${S}__geo-note`);te(o,w),Q(o,{x:F(he.left),y:F(he.bottom+w+4),"text-anchor":"start"}),I(o,q(R.grid.messages.t("chart.tasksDropped",{count:u}),he.width,w))}return v.finish(),{tasks:e,xScale:k,dropped:u,series:[{key:"",label:R.spec.label||"",index:0,points:e.map(o=>({x:o.key,xKey:o.key,label:o.label,y:o.to-o.from,rows:1,rowKey:o.key,px:o.px,py:o.py}))}]}}}),Xe("packages/modules/charts/interaction.js",function(a,V){"use strict";Object.defineProperty(a,"resolveBrush",{enumerable:!0,get:function(){return de}}),Object.defineProperty(a,"brushed",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(a,"brushCondition",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(a,"attachBrush",{enumerable:!0,get:function(){return X}}),Object.defineProperty(a,"applySelection",{enumerable:!0,get:function(){return U}}),Object.defineProperty(a,"attachKeyboard",{enumerable:!0,get:function(){return ae}});const ee=V("packages/modules/charts/svg.js").attrs,M=4;function de(N){const d=N&&N.brush;if(d===!0)return{mode:"filter",axis:"x"};if(d==="filter"||d==="zoom"||d==="select")return{mode:d,axis:"x"};if(d&&typeof d=="object"&&d.mode){const D=["filter","zoom","select"].includes(d.mode)?d.mode:null,z=d.axis==="y"||d.axis==="y2"?d.axis:"x";return{mode:D,axis:z}}return{mode:null,axis:"x"}}function ce(N){const{bound:d,xScale:D}=N,z=Math.min(N.from,N.to),x=Math.max(N.from,N.to);if(N.axis==="y"||N.axis==="y2"){const F=N.axis==="y2"&&N.rightScale?N.rightScale:N.yScale||D;if(!F||typeof F.invert!="function")return{kind:"range",values:[],range:null,axis:N.axis};const I=F.invert(z),ne=F.invert(x);return{kind:"range",values:[],range:[I,ne],axis:N.axis}}if(D.kind==="band"){const F=[];for(const I of d.categories){const ne=D.centre(I);!Number.isNaN(ne)&&ne>=z&&ne<=x&&F.push(I)}return{kind:"set",values:F,range:null,axis:"x"}}const B=D.invert(z),Q=D.invert(x);return{kind:"range",values:[],range:[B,Q],axis:"x"}}function Y(N){const{column:d,result:D}=N;if(!d)return null;if(D.kind==="set")return D.values.length?{col:d,op:"in",value:D.values.slice()}:null;if(!D.range)return null;const[z,x]=D.range;if(!Number.isFinite(z)||!Number.isFinite(x))return null;const B=N.kind==="time"?[new Date(Math.min(z,x)),new Date(Math.max(z,x))]:[Math.min(z,x),Math.max(z,x)];return{col:d,op:"between",value:B,bounds:"[]"}}function X(N){let d=null,D=null;const z=()=>{const F=typeof N.axis=="function"?N.axis():"x",I=F==="y"||F==="y2";return(typeof N.horizontal=="function"?N.horizontal():!1)!==I},x=F=>{if(!N.enabled())return;const I=N.pointOf(F);d=z()?I.y:I.x,D=N.svg.ownerDocument.createElementNS("http://www.w3.org/2000/svg","rect"),D.setAttribute("class","lat-chartview__brush"),N.overlay.appendChild(D)},B=F=>{if(d===null||!D)return;const I=N.plot();if(z()){const te=N.pointOf(F).y,q=Math.max(I.top,Math.min(d,te)),E=Math.min(I.bottom,Math.max(d,te));ee(D,{x:I.left,y:q,width:Math.max(0,I.right-I.left),height:Math.max(0,E-q)});return}const ne=N.pointOf(F).x,S=Math.max(I.left,Math.min(d,ne)),Z=Math.min(I.right,Math.max(d,ne));ee(D,{x:S,y:I.top,width:Math.max(0,Z-S),height:I.height})},Q=F=>{if(d===null)return;const I=N.pointOf(F),ne=z()?I.y:I.x,S=Math.abs(ne-d),Z=d;d=null,D&&D.parentNode&&D.parentNode.removeChild(D),D=null,S>=M&&N.onBrush(Z,ne)};return N.svg.addEventListener("pointerdown",x),N.svg.addEventListener("pointermove",B),N.svg.addEventListener("pointerup",Q),N.svg.addEventListener("pointerleave",Q),()=>{N.svg.removeEventListener("pointerdown",x),N.svg.removeEventListener("pointermove",B),N.svg.removeEventListener("pointerup",Q),N.svg.removeEventListener("pointerleave",Q)}}function U(N){const d=N.groups.marks,D=N.keys.size>0||N.categories.size>0;let z=0;for(const x of d.childNodes||[]){if(!x.getAttribute)continue;const B=Number(x.getAttribute("data-series")),Q=Number(x.getAttribute("data-point")),F=N.series[B],I=F&&F.points[Q],ne=!!I&&(I.rowKey&&N.keys.has(I.rowKey)||I.xKey!==void 0&&N.categories.has(I.xKey));ne&&z++,D&&!ne?x.setAttribute("data-dim","true"):x.removeAttribute("data-dim")}return z}function ae(N){let d=0;const D=x=>{const B=N.marks();if(B.length){d=Math.max(0,Math.min(B.length-1,x));for(let Q=0;Q<B.length;Q++)B[Q].setAttribute("tabindex",Q===d?"0":"-1");B[d].focus&&B[d].focus(),N.onFocus(d)}},z=x=>{const B=N.marks();if(B.length){switch(x.key){case"ArrowRight":case"ArrowDown":D(d+1);break;case"ArrowLeft":case"ArrowUp":D(d-1);break;case"Home":D(0);break;case"End":D(B.length-1);break;case"Enter":case" ":N.onActivate(d);break;default:return}x.preventDefault&&x.preventDefault()}};return N.svg.addEventListener("keydown",z),()=>N.svg.removeEventListener("keydown",z)}}),Xe("packages/modules/charts/range.js",function(a,V){"use strict";Object.defineProperty(a,"deriveRangeSpec",{enumerable:!0,get:function(){return ce}});const ve=new Set(["number","currency","percent","integer"]);function ee(Y){return!!Y&&typeof Y.type=="string"&&ve.has(Y.type)}function M(Y){const X=Y&&Y.selection&&typeof Y.selection.ranges=="function"?Y.selection.ranges():[];return!Array.isArray(X)||!X.length?null:X[X.length-1]}function de(Y,X){const U=[],ae=Math.min(X.startRow,X.endRow),N=Math.max(X.startRow,X.endRow);for(let d=ae;d<=N;d++){const D=Y.rows.get(d);D&&!D.group&&D.data!==null&&D.data!==void 0&&U.push(D)}return U}function ce(Y,X={}){const U=q=>({spec:null,type:null,x:null,measures:[],columns:[],reason:q}),ae=X.range||M(Y);if(!ae)return U("no-range");const N=Y.columns.visible(),d=new Set(N.map(q=>q.id)),D=(ae.columns||[]).filter(q=>d.has(q));if(!D.length)return U("no-visible-columns");const z=D.map(q=>({id:q,column:Y.columns.get(q)})),x=z.filter(q=>ee(q.column)).map(q=>q.id),B=z.filter(q=>!ee(q.column)).map(q=>q.id);if(!x.length)return U("no-measure");const Q=B.length?B[0]:null,F=x,ne={rows:de(Y,ae)},S=new Set(["bar","line","area"]);if(F.length>1){const q=X.type,E=S.has(q)?q:null,L=q&&!S.has(q)?q:"combo";return{spec:{...ne,type:L,x:Q,measures:F.map(R=>E?{col:R,type:E}:{col:R})},type:L,x:Q,measures:F,columns:D,reason:null}}const Z=X.type||"bar";return{spec:{...ne,type:Z,x:Q,y:F[0]},type:Z,x:Q,measures:F,columns:D,reason:null}}}),Xe("packages/modules/charts/regression.js",function(a,V){"use strict";Object.defineProperty(a,"regressionPlots",{enumerable:!0,get:function(){return ce}});const ve=new Set(["number","currency","percent","integer"]);function ee(Y,X={}){return{spec:Y,reason:null,...X}}function M(Y,X={}){return{spec:null,reason:Y,...X}}function de(Y){if(!Y||!Array.isArray(Y.fitted)||!Array.isArray(Y.residuals)||!Array.isArray(Y.leverage)||!(Y.sigma2>0))return null;const X=Math.sqrt(Y.sigma2),U=[];for(let ae=0;ae<Y.fitted.length;ae++){const N=Y.leverage[ae];if(!Number.isFinite(N)||N>=1)continue;const d=X*Math.sqrt(1-N);if(!(d>0))continue;const D=Y.residuals[ae]/d;U.push({x:Y.fitted[ae],y:Math.sqrt(Math.abs(D)),key:String(ae)})}return U}function ce(Y,X={}){const U=X.model||(Y&&Y.statistics&&typeof Y.statistics.regressionModel=="function"?Y.statistics.regressionModel(X.spec||{}):null),ae=he=>({fit:M(he),residualsFitted:M(he),qq:M(he),multicollinearity:M(he),scaleLocation:M(he),residualsLeverage:M(he),coefficientForest:M(he)});if(!U||!Array.isArray(U.predictors)||!U.predictors.length||!U.response)return{model:null,plots:ae("no-model")};const N=U.predictors,d=U.response,D=X.rows,z=()=>D===void 0?{}:{rows:D},x=X.fitted||null,B=X.residual||null,Q=X.stdResidual||null,F=X.leverage||null,I=X.cooksD||null,ne=N.length===1?ee({type:"scatter",x:N[0],y:d,fit:!0,band:U.band||null,...z()}):M("multiple-predictors"),S=x&&B?ee({type:"scatter",x,y:B,reference:[{value:0}],...z()}):M("needs-fitted-and-residual-columns"),Z=B?ee({type:"qq",y:B,...z()}):M("needs-residual-column"),te=N.filter(he=>{const f=Y&&Y.columns&&typeof Y.columns.get=="function"?Y.columns.get(he):null;return!f||typeof f.type=="string"&&ve.has(f.type)}),q=N.length>=2?ee({type:"correlogram",columns:te},{vif:U.vif||null}):M("single-predictor",{vif:U.vif||null}),E=F&&Q?ee({type:I?"bubble":"scatter",x:F,y:Q,...I?{size:I}:{},reference:[{value:0}],...z()}):M("needs-leverage-and-standardised-residual-columns"),L=de(U),se=L&&L.length?ee({type:"scatter",points:L,fit:!0,dimensionTitle:"Fitted",measureTitle:"√|standardised residual|"}):M("needs-fitted-model"),R=Array.isArray(U.coefficients)?U.coefficients.filter(he=>he&&Number.isFinite(he.estimate)&&Number.isFinite(he.lower)&&Number.isFinite(he.upper)).map(he=>({x:he.estimate,label:he.name,lower:he.lower,upper:he.upper})):[],$=R.length?ee({type:"forest",points:R,dimensionTitle:"Coefficient",measureTitle:"Estimate"},{coefficients:U.coefficients||null}):M("needs-coefficient-intervals",{coefficients:U.coefficients||null});return{model:U,plots:{fit:ne,residualsFitted:S,qq:Z,multicollinearity:q,scaleLocation:se,residualsLeverage:E,coefficientForest:$}}}}),Xe("packages/modules/charts/registry.js",function(a,V){"use strict";Object.defineProperty(a,"registerChartType",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(a,"chartTypeDef",{enumerable:!0,get:function(){return M}}),Object.defineProperty(a,"registeredChartTypes",{enumerable:!0,get:function(){return de}});const ve=new Map;function ee(ce,Y){if(typeof ce!="string"||!ce)throw new TypeError("[lattice] registerChartType needs a non-empty type name.");if(!Y||typeof Y.draw!="function")throw new TypeError(`[lattice] registerChartType('${ce}') needs a { draw } function.`);ve.set(ce,Y)}function M(ce){return ve.get(ce)||null}function de(){return[...ve.keys()]}}),Xe("packages/modules/charts/index.js",function(a,V){"use strict";Object.defineProperty(a,"TYPES",{enumerable:!0,get:function(){return on}}),Object.defineProperty(a,"Chart",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(a,"createChart",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(a,"deriveRangeSpec",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(a,"regressionPlots",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(a,"chartRange",{enumerable:!0,get:function(){return Xn}}),Object.defineProperty(a,"canChartRange",{enumerable:!0,get:function(){return qn}});const ve=V("packages/modules/charts/cartesian.js"),ee=ve.aheadOfWindow,M=ve.axisWindowSpan,de=ve.CARTESIAN,ce=ve.drawCartesian,Y=ve.drawForest,X=ve.nearestCategory,U=ve.nearestDrawnPoint,ae=ve.WINDOW_LEAD,N=ve.windowedBound,D=V("packages/modules/charts/drawable.js").drawability,z=V("packages/modules/charts/axis.js"),x=z.createGroups,B=z.drawAxisTitle,Q=z.normaliseAxes,F=z.setPlotClip,I=V("packages/modules/charts/bind.js"),ne=I.bindHierarchy,S=I.bindLinks,Z=I.bindMeasures,te=I.bindPoints,q=I.bindSeries,E=I.leafRows,L=V("packages/modules/charts/frame.js"),se=L.Pool,R=L.plotRect,$=V("packages/modules/charts/scale.js"),he=$.key,f=$.measureDomain,J=$.sqrtScale,H=V("packages/modules/charts/format.js"),e=H.measureFormat,u=H.measureText,k=V("packages/modules/charts/radial.js"),r=k.arcAt,w=k.drawRadial,p=V("packages/modules/charts/distribution.js"),l=p.drawBoxPlot,v=p.drawCapability,o=p.drawControl,s=p.drawEcdf,b=p.drawHistogram,t=p.drawLorenz,c=p.drawMovingRange,P=p.drawQQ,y=V("packages/modules/charts/treemap.js").drawTreemap,j=V("packages/modules/charts/hit.js"),h=j.ownsGeometry,i=j.resolveHit,m=V("packages/modules/charts/combo.js").drawCombo,G=V("packages/modules/charts/polar.js"),C=G.drawGauge,O=G.drawRadar,W=V("packages/modules/charts/matrix.js"),oe=W.drawCandlestick,_=W.drawCorrelogram,le=W.drawFunnel,ue=W.drawHeatmap,ge=W.title,ye=V("packages/modules/charts/multiples.js"),be=ye.panelRects,Me=ye.splitPanels,je=V("packages/modules/charts/geo.js"),xe=je.drawGeomap,$e=je.packRegions,Oe=je.projectedPath,Pe=je.resolvePack,De=V("packages/modules/charts/projection.js"),Ge=De.fitted,Ve=De.resolveProjection,it=De.splitAntimeridian,gt=V("packages/modules/charts/flow.js"),ft=gt.drawChord,At=gt.drawSankey,kt=V("packages/modules/charts/network.js"),Tt=kt.drawNetwork,Ot=kt.emphasiseNetwork,jt=V("packages/modules/charts/stream.js"),Kt=jt.drawMarimekko,zt=jt.drawStream,It=jt.drawViolin,Ye=V("packages/modules/charts/gantt.js").drawGantt,qe=V("packages/modules/charts/svg.js"),A=qe.attrs,Ae=qe.append,pe=qe.clear,fe=qe.el,Ne=qe.round,me=qe.setText,ke=qe.svg,Le=V("packages/modules/charts/styles.js"),we=Le.NS,_e=Le.injectStyles,Te=V("packages/modules/charts/scheme.js"),Fe=Te.resolveScheme,He=V("packages/modules/charts/typography.js"),Be=He.applySize,et=He.resolveType,Je=He.textWidth,Ze=V("packages/modules/charts/labels.js"),st=Ze.collides,at=Ze.resolveLabels,lt=V("packages/modules/charts/interaction.js"),rt=lt.applySelection,ct=lt.attachBrush,St=lt.attachKeyboard,dt=lt.brushCondition,bt=lt.brushed,ot=lt.resolveBrush,Dt=V("packages/modules/charts/dense.js"),an=Dt.downsample,Rt=Dt.markCount,Mt=Dt.wantsCanvas,Ft=V("packages/modules/charts/range.js").deriveRangeSpec,Yt=V("packages/modules/charts/regression.js").regressionPlots,Nt=V("packages/modules/charts/registry.js"),Xt=Nt.chartTypeDef,Zt=Nt.registeredChartTypes,qt=Nt.registerChartType,en=$.linearScale,Ut=$.bandScale,Gt=$.extent,Bt=$.toNumber,Jt=$.isNumber,Wt=$.niceDomain,tn=$.linearTicks,Qe=$.timeScale,nt=$.toTime,pt=$.niceStep,wt=W.colourRamp,Pt=qe.path,nn=qe.attr,rn=V("packages/core/src/internal/util.js").warnOnce,xn=z.drawMeasureAxis,An=z.drawCategoryAxis,Sn=z.drawAxisLines,vn=z.drawContinuousAxis,Mn=z.drawBandLabels,Nn=z.tickValues,jn=p.density,Pn=p.valuesByCategory,On=p.summarise,$n=p.quantile,_n=p.histogram,Tn=H.formatters;Object.defineProperty(a,"registerScheme",{enumerable:!0,get:function(){return Te.registerScheme}}),Object.defineProperty(a,"resolveScheme",{enumerable:!0,get:function(){return Te.resolveScheme}}),Object.defineProperty(a,"schemeNames",{enumerable:!0,get:function(){return Te.schemeNames}}),Object.defineProperty(a,"setDefaultScheme",{enumerable:!0,get:function(){return Te.setDefaultScheme}}),Object.defineProperty(a,"SCHEMES",{enumerable:!0,get:function(){return Te.SCHEMES}}),Object.defineProperty(a,"PALETTE",{enumerable:!0,get:function(){return Te.PALETTE}}),Object.defineProperty(a,"registerChartType",{enumerable:!0,get:function(){return Nt.registerChartType}}),Object.defineProperty(a,"registeredChartTypes",{enumerable:!0,get:function(){return Nt.registeredChartTypes}});const Cn=Object.freeze({el:fe,svg:ke,attr:nn,attrs:A,append:Ae,clear:pe,path:Pt,round:Ne,setText:me,Pool:se,plotRect:R,linearScale:en,bandScale:Ut,sqrtScale:J,extent:Gt,measureDomain:f,niceDomain:Wt,linearTicks:tn,timeScale:Qe,toTime:nt,niceStep:pt,toNumber:Bt,isNumber:Jt,key:he,drawMeasureAxis:xn,drawCategoryAxis:An,drawAxisLines:Sn,drawContinuousAxis:vn,drawBandLabels:Mn,tickValues:Nn,formatters:Tn,resolveScheme:Fe,colourRamp:wt,density:jn,valuesByCategory:Pn,summarise:On,quantile:$n,histogram:_n,resolvePack:Pe,packRegions:$e,fitted:Ge,resolveProjection:Ve,splitAntimeridian:it,projectedPath:Oe,textWidth:Je,applySize:Be,collides:st,NS:we}),on=Object.freeze(["line","step","area","rangeArea","bar","horizontalBar","waterfall","scatter","bubble","forest","combo","pareto","histogram","boxplot","heatmap","qq","ecdf","lorenz","correlogram","control","capability","movingRange","pie","donut","sunburst","treemap","radar","gauge","funnel","candlestick","geomap","sankey","chord","network","stream","marimekko","violin","gantt"]),ln=new Set(["bar","column","horizontalBar","line","area","scatter","bubble","combo","pareto","histogram","heatmap","pie","donut","sunburst","treemap","radar","geomap"]),En=new Set(["pie","donut","sunburst"]),Ln=new Set(["pie","donut","sunburst","treemap"]),cn=20,zn=new Set(["histogram","boxplot","qq","ecdf","lorenz","control","capability","movingRange"]),Rn=new Set(["histogram","boxplot","qq","ecdf","lorenz","violin"]);function Fn(We){const T=We.y||(Array.isArray(We.measures)&&We.measures.length?We.measures[0]:null);if(!T)return We;const K=typeof T=="string"?T:T.col;if(!K)return We;const ie=typeof T=="object"&&T.fn!=null?T.fn:"median";return{...We,y:{col:K,fn:ie}}}const In=new Set(["combo","candlestick"]),un=new Set(["bar","line","step","area","scatter","bubble"]),Dn=new Set(["sankey","chord","network"]),Gn=new Set(["gantt"]),Bn=new Set(["radar","gauge","funnel","heatmap","geomap","sankey","chord","network"]),$t=Object.freeze({width:480,height:300}),fn=Object.freeze(["00000"]),hn=new Set(["horizontalBar","forest"]);function Un(We){if(!We||!Array.isArray(We.points))return null;let T=0,K=!1;for(const ie of We.points)typeof ie.y=="number"&&Number.isFinite(ie.y)&&(T+=ie.y,K=!0);return K?T:null}function dn(We,T,K,ie){return We==="correlogram"?(Array.isArray(ie.columns)?ie.columns:[]).map(re=>ge(K,re)):We==="heatmap"?(T.series||[]).map(Se=>Se.label):We==="gantt"?(T.rows||[]).map(Se=>ie.label?K.rows.text(Se.key,ie.label):String(Se.key)):hn.has(We)?T.labels||[]:fn}const Kn=1e3,Hn=50;let Wn=0;function Vn(We){const T=We/1e3;return`${T>=10?Math.round(T):Math.round(T*10)/10}s`}function mn(We){return`${We/1e3}s`}function Ct(We){return We&&We.defaultView||globalThis}function Yn(We,T){return T?typeof T=="string"?We.querySelector(T):T:null}function Zn(We,T,K){const ie=["fill","fill-opacity","stroke","stroke-width","stroke-opacity","stroke-dasharray","stroke-linejoin","stroke-linecap","font-size","font-family","font-weight","opacity","text-anchor","dominant-baseline","visibility"],Se=[We,...We.querySelectorAll("*")],re=[T,...T.querySelectorAll("*")];for(let Ce=0;Ce<Se.length&&Ce<re.length;Ce++){const ze=K.getComputedStyle(Se[Ce]),Ee=[];for(const Re of ie){const Ue=ze.getPropertyValue(Re);Ue&&Ee.push(`${Re}:${Ue}`)}Ee.length&&re[Ce].setAttribute("style",Ee.join(";"))}}function Jn(We,T){let K=We.root;const ie=[];for(const Se of T){const re=(K.children||[]).find(Ce=>Ce.label===Se);if(!re||!re.children||!re.children.length)break;K=re,ie.push(Se)}return ie.length?{...We,root:K,path:ie,empty:!K.children.length}:We}function Qn(We,T,K){return We&&We.plot?We.plot:{left:0,top:0,right:T,bottom:K,width:T,height:K,gutter:{left:0,bottom:0,right:0,top:0}}}class gn{#l=++Wn;#n;#c;#e;#i;#f=null;#r=null;#a=null;#p=null;#d=null;#I=!1;#w=null;#k=null;#b=[];#h=new Set;#t=null;#m={zoom:1,offset:[0,0]};#y=null;#x=null;#D=!1;#G=!1;#o=null;#C=0;#M=null;#$=null;#B=!1;#A=!1;#S=new Map;#N=Fe();#E=et();#we=null;#u=null;#g=null;#v=null;#L=0;constructor(T){this.#n=T.grid,this.#c=T.container,this.#e=T.spec,this.#i=T.container.ownerDocument,this.#X(),this.#q(),this.draw()}#X(){_e(this.#i);const T=this.#i;this.#f=fe(T,"div",we);const K=fe(T,"figure",`${we}__figure`);if(this.#e.title||this.#e.subtitle){const ie=fe(T,"figcaption",`${we}__caption`);if(this.#e.title){const Se=fe(T,"div",`${we}__title`);me(Se,this.#e.title),ie.appendChild(Se)}if(this.#e.subtitle){const Se=fe(T,"div",`${we}__subtitle`);me(Se,this.#e.subtitle),ie.appendChild(Se)}K.appendChild(ie)}if(this.#r=ke(T,"svg",{class:`${we}__plot`,preserveAspectRatio:"xMidYMid meet",role:"img"}),this.#a=x(T,this.#r),K.appendChild(this.#r),this.#k=fe(T,"div",`${we}__empty`),this.#k.setAttribute("hidden",""),K.appendChild(this.#k),this.#w=fe(T,"div",`${we}__table`),K.appendChild(this.#w),this.#p=fe(T,"div",`${we}__legend`),K.appendChild(this.#p),this.#e.footnote){const ie=fe(T,"div",`${we}__footnote`);me(ie,this.#e.footnote),K.appendChild(ie)}this.#x=fe(T,"div",`${we}__attribution`),this.#x.setAttribute("hidden",""),K.appendChild(this.#x),this.#d=fe(T,"div",`${we}__tooltip`),this.#d.setAttribute("hidden",""),this.#f.appendChild(K),this.#f.appendChild(this.#d),this.#c.appendChild(this.#f),this.#ee()}#q(){const T=["model:changed","rows:changed","filter:changed","sort:changed","column:grouped","column:pivoted","cell:changed","timeline:seek","timeline:attached","timeline:detached"];this.#e.selection&&this.#b.push(this.#n.on("selection:changed",()=>this.#Y()));for(const ie of T)this.#b.push(this.#n.on(ie,()=>this.schedule()));const K=Ct(this.#i);K&&typeof K.ResizeObserver=="function"&&(this.#$=this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():null,this.#M=new K.ResizeObserver(()=>{if(!this.#B){this.#B=!0;const ie=this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():null;if(ie&&this.#$&&Math.round(ie.width)===Math.round(this.#$.width)&&Math.round(ie.height)===Math.round(this.#$.height))return}this.schedule()}),this.#M.observe(this.#c))}#U(){const T=this.#r&&this.#r.getBoundingClientRect?this.#r.getBoundingClientRect():null;return T&&T.width>0&&T.height>0?T:this.#c.getBoundingClientRect?this.#c.getBoundingClientRect():$t}#ee(){const T=Ee=>{this.#y||this.#ne(Ee)},K=()=>this.#j();this.#r.addEventListener("pointermove",T),this.#r.addEventListener("pointerleave",K),this.#r.addEventListener("click",Ee=>this.#V(Ee));const ie=Ee=>{!this.#t||!this.#t.packed||(this.#y={x:Ee.clientX||0,y:Ee.clientY||0})},Se=Ee=>{if(!this.#y)return;const Re=Ee.clientX||0,Ue=Ee.clientY||0;this.#P(Re-this.#y.x,Ue-this.#y.y),this.#y={x:Re,y:Ue}},re=()=>{this.#y=null},Ce=Ee=>{!this.#t||!this.#t.packed||(Ee.preventDefault&&Ee.preventDefault(),this.#R(Ee.deltaY<0?1.15:1/1.15))},ze=Ee=>{if(!this.#t||!this.#t.packed)return;const Re=40;if(Ee.shiftKey&&Ee.key==="ArrowLeft")this.#P(-Re,0);else if(Ee.shiftKey&&Ee.key==="ArrowRight")this.#P(Re,0);else if(Ee.shiftKey&&Ee.key==="ArrowUp")this.#P(0,-Re);else if(Ee.shiftKey&&Ee.key==="ArrowDown")this.#P(0,Re);else if(Ee.key==="+"||Ee.key==="=")this.#R(1.25);else if(Ee.key==="-"||Ee.key==="_")this.#R(1/1.25);else if(Ee.key==="0")this.#ce();else return;Ee.preventDefault&&Ee.preventDefault()};this.#r.addEventListener("pointerdown",ie),this.#r.addEventListener("pointermove",Se),this.#r.addEventListener("pointerup",re),this.#r.addEventListener("pointerleave",re),this.#r.addEventListener("wheel",Ce,{passive:!1}),this.#r.addEventListener("keydown",ze),this.#b.push(ct({svg:this.#r,overlay:this.#a.overlay,plot:()=>this.#t&&this.#t.plot||{left:0,top:0,right:0,bottom:0,height:0},pointOf:Ee=>this.#_(Ee),axis:()=>ot(this.#e).axis,horizontal:()=>!!(this.#t&&this.#t.horizontal),enabled:()=>!!ot(this.#e).mode&&!!(this.#t&&this.#t.xScale),onBrush:(Ee,Re)=>this.#se(Ee,Re)})),this.#r.setAttribute("tabindex","0"),this.#b.push(St({svg:this.#r,marks:()=>[...this.#a.marks.childNodes||[]].filter(Ee=>Ee.setAttribute),onFocus:Ee=>this.#ae(Ee),onActivate:Ee=>this.#le(Ee)})),this.#b.push(()=>{this.#r.removeEventListener("pointermove",T),this.#r.removeEventListener("pointerleave",K),this.#r.removeEventListener("pointerdown",ie),this.#r.removeEventListener("pointermove",Se),this.#r.removeEventListener("pointerup",re),this.#r.removeEventListener("pointerleave",re),this.#r.removeEventListener("wheel",Ce),this.#r.removeEventListener("keydown",ze)})}#_(T){const K=this.#r.getBoundingClientRect?this.#r.getBoundingClientRect():{left:0,top:0,width:$t.width,height:$t.height};return{x:(T.clientX||0)-K.left,y:(T.clientY||0)-K.top}}#te(T){return X({bound:{categories:this.#T().categories},xScale:this.#t.xScale,at:this.#t.horizontal?T.y:T.x})}#T(){const T=this.#t;return T&&Array.isArray(T.labels)&&Array.isArray(T.categories)?{labels:T.labels,categories:T.categories}:{labels:this.#o&&this.#o.labels||[],categories:this.#o&&this.#o.categories||[]}}#K(T){if(!this.#t||!Array.isArray(this.#t.series))return null;if(this.#t.reduced)return U({series:this.#t.series,xScale:this.#t.xScale,at:this.#t.horizontal?T.y:T.x});const K=this.#te(T);return K<0?null:{index:K,entries:this.#t.series.map(ie=>({series:ie,point:ie.points[K]})).filter(ie=>ie.point&&ie.point.y!==null)}}#z(T){return i({drawn:this.#t,bound:this.#o,spec:this.#e,grid:this.#n,scheme:this.#N,at:T})}#ne(T){if(!this.#t||!this.#o||this.#e.tooltip===!1)return;const K=this.#_(T),ie=[];let Se="";const re=this.#z(K);if(re){this.#H(re.heading,re.rows,T),this.emit("hover",{...re.datum,native:T});return}if(h(this.#t)){this.#j();return}if(this.#t.arcs){const ze=r({arcs:this.#t.arcs,x:K.x,y:K.y});if(!ze){this.#j();return}Se=ze.label;const Ee=this.#o.root.total>0?ze.total/this.#o.root.total:0;ie.push({label:this.#o.measure.title,value:`${u(ze.total,this.#n.messages)} (${this.#n.messages.number(Ee,{style:"percent",maximumFractionDigits:1})})`,colour:this.#N.series(ze.index)})}else{const ze=this.#K(K);if(!ze){this.#j();return}Se=this.#T().labels[ze.index]||"";for(const Ee of ze.entries)ie.push({label:Ee.series.label,value:u(Ee.point.y,this.#n.messages),colour:this.#N.series(Ee.series.index)})}if(!ie.length){this.#j();return}this.#H(Se,ie,T);const Ce=this.#W(K);Ce&&this.emit("hover",{...Ce,native:T})}#H(T,K,ie){const Se=this.#i;if(pe(this.#d),T){const re=fe(Se,"div",`${we}__tooltip-row`),Ce=fe(Se,"strong");me(Ce,T),re.appendChild(Ce),this.#d.appendChild(re)}for(const re of K){const Ce=fe(Se,"div",`${we}__tooltip-row`),ze=fe(Se,"span",`${we}__swatch`);ze.setAttribute("style",`background:${re.colour}`);const Ee=fe(Se,"span");me(Ee,re.label);const Re=fe(Se,"span",`${we}__tooltip-value`);me(Re,re.value),Ae(Ce,[ze,Ee,Re]),this.#d.appendChild(Ce)}this.#d.removeAttribute("hidden"),this.#re(ie)}#re(T){if(!this.#I&&(this.#I=!0,this.#oe())){const ut=this.#i&&this.#i.body;ut&&typeof ut.appendChild=="function"&&ut.appendChild(this.#d)}const K=Ct(this.#i),ie=12,Se=T&&T.clientX||0,re=T&&T.clientY||0,Ce=typeof this.#d.getBoundingClientRect=="function"?this.#d.getBoundingClientRect():{width:0,height:0},ze=K.innerWidth||0,Ee=K.innerHeight||0;let Re=Se+ie;ze&&Re+Ce.width>ze-ie&&(Re=Se-ie-Ce.width),Re=Math.max(ie,Re);let Ue=re+ie;Ee&&Ue+Ce.height>Ee-ie&&(Ue=re-ie-Ce.height),Ue=Math.max(ie,Ue),this.#d.style.left=`${Math.round(Re)}px`,this.#d.style.top=`${Math.round(Ue)}px`}#oe(){const T=Ct(this.#i);if(typeof T.getComputedStyle!="function")return!1;let K=this.#f&&this.#f.parentNode;for(;K;){if(K.nodeType===11&&K.host){K=K.host;continue}if(K.nodeType!==1)break;const ie=T.getComputedStyle(K);if(ie&&(ie.transform&&ie.transform!=="none"||ie.perspective&&ie.perspective!=="none"||ie.filter&&ie.filter!=="none"||ie.backdropFilter&&ie.backdropFilter!=="none"||ie.contain&&/layout|paint|strict|content/.test(ie.contain)))return!0;K=K.parentNode}return!1}#j(){this.#d&&this.#d.setAttribute("hidden",""),this.emit("leave",{})}#W(T){if(!this.#t||!this.#o)return null;const K=this.#z(T);if(K)return K.datum;if(h(this.#t))return null;if(this.#t.arcs){const ze=r({arcs:this.#t.arcs,x:T.x,y:T.y});return ze?{label:ze.label,value:ze.total,category:ze.node.value,column:this.#e.x||null,series:null,depth:ze.depth,path:Array.isArray(ze.path)?[...ze.path]:[ze.label],rowKeys:ze.node.rowKey?[ze.node.rowKey]:[]}:null}const ie=this.#K(T);if(!ie)return null;const Se=ie.entries,re=this.#T(),Ce=Se.length===1&&Se[0].point.from!==void 0?{from:Se[0].point.from,to:Se[0].point.to}:null;return{label:re.labels[ie.index]||"",category:re.categories[ie.index],column:this.#o.dimension.col,value:Se.length===1?Se[0].point.y:null,...Ce||{},series:Se.map(ze=>({key:ze.series.key,label:ze.series.label,value:ze.point.y,rows:ze.point.rows})),rowKeys:Se.map(ze=>ze.point.rowKey).filter(Boolean)}}#V(T){if(!this.#t||!this.#o)return;const K=this.#W(this.#_(T));if(!K)return;let ie=!1;const Se=this.emit("click",{...K,native:T,preventDefault(){ie=!0}});if(!(ie||Se.defaultPrevented)){if(this.#e.drill&&this.#o&&this.#o.root&&K.label){const re=Array.isArray(K.path)&&K.path.length?K.path:[K.label];this.#u=[...this.#u||[],...re],this.emit("drill",{path:[...this.#u],label:K.label}),this.draw();return}if(this.#e.selection&&Array.isArray(this.#t.markers)&&Array.isArray(K.rowKeys)&&K.rowKeys.length){this.#n.selection.set([...K.rowKeys]);return}if(this.#e.selection&&this.#e.type==="network"&&Array.isArray(K.rowKeys)&&K.rowKeys.length){this.#n.selection.set([...new Set(K.rowKeys)]);return}!this.#e.filterOnClick||!K.column||this.#n.filters.set({col:K.column,op:"eq",value:K.category})}}#Y(){if(!this.#t)return;if(Array.isArray(this.#t.markers)){this.#ie();return}if(Array.isArray(this.#t.links)&&Array.isArray(this.#t.nodes)&&!this.#t.series){Ot({drawn:this.#t,keys:new Set(this.#n.selection.keys())});return}if(!this.#t.series)return;const T=this.#n.selection.keys(),K=this.#o&&this.#o.dimension&&this.#o.dimension.col,ie=new Set;if(K)for(const Se of T)ie.add(he(this.#n.rows.value(Se,K)));rt({groups:this.#a,series:this.#t.series,keys:new Set(T),categories:ie})}#ie(){const T=new Set(this.#n.selection.keys());for(const K of this.#t.markers){const ie=K.element;!ie||!ie.setAttribute||(T.size&&!T.has(K.rowKey)?ie.setAttribute("data-dim","true"):ie.removeAttribute("data-dim"))}}#se(T,K){const ie=ot(this.#e),Se=ie.mode;if(!Se||!this.#t||!this.#t.xScale||!this.#o)return;const re=bt({bound:this.#o,xScale:this.#t.xScale,yScale:this.#t.yScale,rightScale:this.#t.rightScale||null,axis:ie.axis,from:T,to:K});let Ce=!1;const ze=this.emit("brush",{mode:Se,kind:re.kind,values:re.values,range:re.range,axis:re.axis,column:re.axis==="y"||re.axis==="y2"?this.#o.measure&&this.#o.measure.col||null:this.#o.dimension.col,preventDefault(){Ce=!0}});if(Ce||ze.defaultPrevented)return;if(Se==="zoom"){if(re.range){const Re=re.axis==="y2"?"y2":re.axis==="y"?"y":"x";this.#e={...this.#e,axis:{...this.#e.axis||{},[Re]:{...(this.#e.axis||{})[Re]||{},min:Math.min(re.range[0],re.range[1]),max:Math.max(re.range[0],re.range[1])}}},this.draw()}return}if(Se==="select"){const Re=[];for(const Ue of this.#t.series||[])for(const ut of Ue.points){if(!ut.rowKey)continue;(re.kind!=="set"||re.values.some(Ie=>he(Ie)===ut.xKey))&&Re.push(ut.rowKey)}this.#n.selection.set([...new Set(Re)]);return}const Ee=dt({column:this.#o.dimension.col,result:re,kind:this.#o.kind});Ee&&this.#n.filters.set(Ee)}#ae(T){const K=(this.#a.marks.childNodes||[])[T];if(!K||!K.setAttribute)return;const ie=this.#t&&this.#t.series?this.#t.series[Number(K.getAttribute("data-series"))||0]:null,Se=ie&&ie.points[Number(K.getAttribute("data-point"))||0];if(!Se){if(!K.getBoundingClientRect)return;const re=K.getBoundingClientRect(),Ce=this.#z(this.#_({clientX:re.left+re.width/2,clientY:re.top+re.height/2}));if(!Ce)return;K.setAttribute("role","img"),K.setAttribute("aria-label",`${Ce.heading}: ${Ce.rows.map(ze=>ze.value).filter(Boolean).join(", ")}`),this.emit("focus",{label:Ce.datum.label,value:Ce.datum.value,index:T});return}K.setAttribute("role","img"),K.setAttribute("aria-label",`${Se.label}: ${u(Se.y,this.#n.messages)}`),this.emit("focus",{label:Se.label,value:Se.y,index:T})}#le(T){const K=(this.#a.marks.childNodes||[])[T];if(!K||!K.getBoundingClientRect)return;const ie=K.getBoundingClientRect();this.#V({clientX:ie.left+ie.width/2,clientY:ie.top+ie.height/2})}#Z(T){const K=T&&T.attribution||"";K?(me(this.#x,K),this.#x.removeAttribute("hidden")):this.#x.setAttribute("hidden","");const ie=T&&Number.isFinite(T.aspect)&&T.aspect>0?T.aspect:null;this.#r&&this.#r.style&&(ie?this.#r.style.setProperty("aspect-ratio",String(ie)):this.#r.style.removeProperty("aspect-ratio"))}#ce(){this.#m={zoom:1,offset:[0,0]},this.schedule()}#R(T){const K=this.#m.zoom*T;this.#m={...this.#m,zoom:Math.min(8,Math.max(1,K))},this.schedule()}#P(T,K){const ie=this.#t&&this.#t.scale||0;if(!ie)return;const[Se,re]=this.#m.offset;this.#m={...this.#m,offset:[Se-T/ie,re+K/ie]},this.schedule()}schedule(){if(this.#A||this.#C)return;const T=Ct(this.#i),K=typeof T.requestAnimationFrame=="function"?T.requestAnimationFrame.bind(T):ie=>setTimeout(ie,16);this.#C=K(()=>{this.#C=0,this.draw()})||1}draw(){if(this.#A)return;const T=this.#J();if(!T)return;const K=this.#U(),ie=Math.round(K.width||$t.width),Se=Math.round(K.height||$t.height),re=ie!==T.width||Se!==T.height?this.#J():T;re&&this.emit("draw",{chartType:re.chartType,categories:re.categories,empty:re.empty})}#J(){const T=this.#U(),K=Math.round(T.width||$t.width),ie=Math.round(T.height||$t.height),Se=on.includes(this.#e.type)?null:Xt(this.#e.type),re=on.includes(this.#e.type)||Se?this.#e.type:"bar";Array.isArray(this.#e.x)&&rn(`chart:${this.#l}:x:array`,`chart "x" expects one column id (a string) and was given an array [${this.#e.x.map(tt=>JSON.stringify(tt)).join(", ")}]. A chart takes one category column on "x". For a hierarchy, group the grid — grid.columns.group([...]) — and the hierarchical types (pie, donut, sunburst, treemap) read the grouping.`);const Ce=Fe(this.#e);this.#N=Ce;const ze=Q(this.#e.axis),Ee=this.#n.messages,Re=et(this.#e);this.#E=Re;const Ue=Re.small,ut=at(this.#e);if(ut.show&&!ln.has(re)&&!(Se&&Se.labelled)&&!this.#D){this.#D=!0;const tt=this.#i&&this.#i.defaultView,Ke=tt&&tt.console||(typeof globalThis<"u"?globalThis.console:null);Ke&&typeof Ke.warn=="function"&&Ke.warn(`[lattice] a "${re}" chart does not draw data labels; "labels" has no effect on it. Types that do: ${[...ln].join(", ")}.`)}A(this.#r,{viewBox:`0 0 ${K} ${ie}`,width:K,height:ie});const vt=Ln.has(re)||!!(Se&&Se.hierarchical);let Ie;if(Se&&typeof Se.bind=="function")Ie=Se.bind(this.#n,this.#e);else if(vt)Ie=ne(this.#n,this.#e),this.#u&&this.#u.length&&(Ie=Jn(Ie,this.#u));else if(In.has(re))Ie=Z(this.#n,this.#e);else if(un.has(re)&&Array.isArray(this.#e.measures)&&this.#e.measures.length)Ie=Z(this.#n,this.#e);else if(Dn.has(re))Ie=S(this.#n,this.#e,re==="network"?{perRow:!0,nodes:this.#e.nodes}:void 0);else if(Gn.has(re)){const tt=E(this.#n);Ie={rows:tt,series:[],categories:[],labels:[],measure:{col:null,fn:"sum",title:""},dimension:{col:this.#e.label||null,title:""},empty:!tt.length}}else re==="geomap"?Ie=q(this.#n,{...this.#e,x:this.#e.code||this.#e.x}):Array.isArray(this.#e.points)?Ie=te(this.#e):Rn.has(re)?Ie=q(this.#n,Fn(this.#e)):Ie=q(this.#n,this.#e);const Et=Date.now();this.#o=Ie;const Lt=ee(Ie,ze&&ze.x,re,Et);if(Lt){const tt=typeof this.#e.x=="string"?` "${this.#e.x}"`:"",Ke=`${Math.round(ae*1e3)/10}%`;rn(`chart:${this.#l}:x:window:ahead`,`${Lt.count} reading(s) on the x axis${tt} were not drawn: stamped up to ${Vn(Lt.lead)} ahead of this device's clock, which is more than the ${mn(Lt.limit)} (${Ke} of the ${mn(Lt.span)} rolling window) a reading may run ahead and still move the window. This is a producer whose clock is wrong, not a window that is too narrow: letting that reading carry the window would push every other producer's recent readings out of it, so it is left out instead. Correct the producer's clock (NTP), or stamp readings where they are received.`)}const yt=D({grid:this.#n,spec:this.#e,type:re,bound:Ie,axis:ze,now:Et,id:this.#l});if(!yt.ok)return yt.tell&&rn(yt.key,yt.message),this.#me(this.#e.emptyText||Ee.t("chart.empty")),null;if(Ie=N(Ie,ze&&ze.x,re,Et),this.#o=Ie,this.#k.setAttribute("hidden",""),this.#r.removeAttribute("hidden"),F(this.#a,null),Se){const tt=Se.freeform?R({width:K,height:ie,fontSize:Ue,margin:this.#e.margin}):R({width:K,height:ie,fontSize:Ue,margin:this.#e.margin,titleSize:Re.axisTitle,titles:{left:ze.y.title,bottom:ze.x.title,right:ze.y2.title},yLabels:fn,xLabels:Ie.labels,rotated:!0});this.#t=Se.draw({doc:this.#i,groups:this.#a,plot:tt,bound:Ie,type:re,grid:this.#n,fontSize:Ue,hidden:this.#h,scheme:Ce,axis:ze,typography:Re,labels:ut,spec:this.#e,geoView:{zoom:this.#m.zoom,offset:this.#m.offset},helpers:Cn})||{},this.#s(Array.isArray(this.#t.legend)?this.#t.legend:[])}else if(re==="treemap"){const tt=R({width:K,height:ie,fontSize:Ue,padding:2,margin:this.#e.margin});this.#t=y({scheme:Ce,groups:this.#a,plot:tt,tree:Ie,grid:this.#n,hidden:this.#h,fontSize:Ue,typography:Re,labels:ut}),this.#s(Ie.root.children.map((Ke,ht)=>({key:Ke.label,label:Ke.label,index:ht})))}else if(En.has(re)){const tt=R({width:K,height:ie,fontSize:Ue});this.#t=w({scheme:Ce,doc:this.#i,groups:this.#a,plot:tt,tree:Ie,type:re,grid:this.#n,hidden:this.#h,fontSize:Ue,typography:Re,labels:ut,centre:this.#e.centre});const Ke=this.#n.columns&&Ie.measure&&Ie.measure.col?this.#n.columns.get(Ie.measure.col):null;this.#s(Ie.root.children.map((ht,_t)=>({key:ht.label,label:ht.label,index:_t,value:e(ht.total,Ke,this.#n),colour:Ce.series(_t,ht.label)})))}else{const tt=Bn.has(re)?R({width:K,height:ie,fontSize:Ue,margin:this.#e.margin,yLabels:re==="heatmap"?dn(re,Ie,this.#n,this.#e):[],xLabels:re==="heatmap"?Ie.labels:[],rotated:!0}):R({width:K,height:ie,fontSize:Ue,margin:this.#e.margin,titleSize:Re.axisTitle,titles:de[re]&&de[re].horizontal?{left:ze.x.title,bottom:ze.y.title,right:ze.y2.title}:{left:ze.y.title,bottom:ze.x.title,right:ze.y2.title},rightGutter:this.#he(re,Ie)?Math.round(Ue*3):0,yLabels:dn(re,Ie,this.#n,this.#e),xLabels:hn.has(re)?[]:Ie.labels,rotated:!0}),Ke={doc:this.#i,groups:this.#a,plot:tt,bound:Ie,type:re,grid:this.#n,fontSize:Ue,hidden:this.#h,scheme:Ce,axis:ze,typography:Re,labels:ut,byRuleColour:!this.#e.series};if(re!=="geomap"&&this.#Z(null),this.#e.multiples)this.#t=this.#fe(Ke),this.#s([]);else if(re==="combo"||re==="pareto")this.#t=m({...Ke,pareto:re==="pareto",reference:this.#e.reference,annotations:this.#e.annotations}),this.#s(this.#O(this.#t.series,Ie.measure&&Ie.measure.col));else if(re==="heatmap")this.#t=ue({...Ke,diverging:this.#e.diverging}),this.#s([]);else if(re==="radar")this.#t=O(Ke),this.#s(this.#O(Ie.series,Ie.measure&&Ie.measure.col));else if(re==="gauge")this.#t=C({...Ke,min:this.#e.min,max:this.#e.max,target:this.#e.target}),this.#s([]);else if(re==="sankey")this.#t=At(Ke),this.#s([]);else if(re==="chord")this.#t=ft(Ke),this.#s([]);else if(re==="network")this.#t=Tt({...Ke,iterations:this.#e.iterations,icon:this.#e.icon,linkWidth:this.#e.linkWidth}),this.#s(Array.isArray(this.#t.legend)?this.#t.legend:[]);else if(re==="stream")this.#t=zt(Ke),this.#s(this.#O(Ie.series,Ie.measure&&Ie.measure.col));else if(re==="marimekko")this.#t=Kt(Ke),this.#s(this.#O(Ie.series,Ie.measure&&Ie.measure.col));else if(re==="violin")this.#t=It(Ke),this.#s([]);else if(re==="gantt")this.#t=Ye({...Ke,spec:this.#e,rows:Ie.rows||[]}),this.#s([]);else if(re==="geomap")this.#t=xe({...Ke,shapes:this.#e.shapes,codeProperty:this.#e.codeProperty,diverging:this.#e.diverging,projection:this.#e.projection,projectionOptions:this.#e.projectionOptions,layer:this.#e.layer,graticule:this.#e.graticule,zoom:this.#m.zoom,centreOffset:this.#m.offset}),this.#s([]),this.#Z(this.#t);else if(re==="correlogram")this.#t=_({...Ke,columns:this.#pe(),method:this.#e.method,values:this.#e.values}),this.#s([]);else if(re==="forest")this.#t=Y(Ke),this.#s([]);else if(re==="funnel")this.#t=le(Ke),this.#s([]);else if(re==="candlestick")this.#t=oe(Ke),this.#s([]);else if(zn.has(re)){if(re==="histogram")this.#t=b({...Ke,buckets:this.#e.buckets,curve:this.#e.curve});else if(re==="movingRange")this.#t=c(Ke);else if(re==="control"||re==="capability"){const ht=this.#e.y||this.#e.measure,_t=this.#n&&this.#n.statistics;this.#t=(re==="capability"?v:o)({...Ke,capability:_t&&ht?_t.capability(ht,{by:this.#e.x,baseline:this.#e.baseline,rules:this.#e.rules,confidence:this.#e.confidence,...this.#e.spec||{}}):null})}else re==="qq"?this.#t=P(Ke):re==="ecdf"?this.#t=s(Ke):re==="lorenz"?this.#t=t(Ke):this.#t=l(Ke);this.#s([])}else{this.#t=ce({...Ke,fit:this.#e.fit,trend:this.#e.trend,band:this.#e.band,error:this.#e.error,dense:Mt({series:Ie.series,canvas:this.#e.canvas}),downsampleTo:this.#e.downsample,stack:this.#e.stack,reference:this.#e.reference,annotations:this.#e.annotations,sizes:this.#de(Ie)});const ht=Array.isArray(this.#t.legend)?this.#t.legend:null;this.#s(ht||(Ie.series.length>1?this.#O(Ie.series,Ie.measure&&Ie.measure.col,_t=>Ce.series(_t.index,_t.label)):[]))}}const mt=this.#t&&this.#t.errorBars;if(this.#e.error&&mt&&mt.marks&&!this.#G&&(!mt.drawn||mt.singleSkipped)){this.#G=!0;const tt=this.#i&&this.#i.defaultView,Ke=tt&&tt.console||(typeof globalThis<"u"?globalThis.console:null);if(Ke&&typeof Ke.warn=="function"){let ht;mt.drawn?ht=`[lattice] error bars were requested but ${mt.singleSkipped} of ${mt.marks} marks have a single reading behind them, so their whiskers were not drawn; the other marks are shown. A bar with no whisker is easily read as the certain one: bind those categories to the readings they summarise, or supply a margin column with \`error: { of: "column" }\`.`:ht=mt.single===mt.marks?'[lattice] error bars were requested but every mark has a single reading behind it, so there is no spread to compute. A chart bound to a summary or derived grid sees one row per mark: bind it to the rows the summary was computed from, or supply a margin column with `error: { of: "column" }`.':"[lattice] error bars were requested but no mark had enough readings to compute an interval.",Ke.warn(ht)}}return this.#t&&(this.#t.plot=this.#t.plot||Qn(this.#t,K,ie)),this.#o&&(this.#o.outside=this.#t&&this.#t.outside||0),this.#e.selection&&this.#Y(),this.#Q(),this.#ye(re,Ie,vt),this.#ue(ze),{width:K,height:ie,chartType:re,categories:Ie.categories||[],empty:!!Ie.empty}}#ue(T){const K=M(T&&T.x),ie=K?Math.min(Kn,Math.max(Hn,Math.floor(K/4))):0;if(this.#A||!ie){this.#F();return}if(this.#v&&this.#L===ie)return;this.#F(),this.#L=ie;const Se=Ct(this.#i),re=Se&&typeof Se.setInterval=="function"?Se.setInterval.bind(Se):setInterval;this.#v=re(()=>{this.#A||this.#i&&this.#i.hidden||this.#f&&this.#f.isConnected===!1||this.schedule()},ie);const Ce=this.#v;Ce&&typeof Ce.unref=="function"&&Ce.unref()}#F(){if(this.#v===null)return;const T=Ct(this.#i);(T&&typeof T.clearInterval=="function"?T.clearInterval.bind(T):clearInterval)(this.#v),this.#v=null,this.#L=0}#fe(T){const K=Me(T.bound),ie=be({count:K.length,plot:T.plot}),Se=[];for(const Re of T.bound.series)for(const Ue of Re.points)Se.push(Ue.y);const re=f(Se,{zero:T.type!=="line"}),Ce=new se(this.#a.overlay);F(this.#a,T.plot);const ze=new se(this.#a.marks);new se(this.#a.grid).finish(),new se(this.#a.axis).finish(),new se(this.#a.rules).finish();let Ee=null;for(let Re=0;Re<ie.length;Re++){const Ue=ie[Re],ut=K[Re],vt={left:Ue.x,top:Ue.y,width:Ue.width,height:Ue.height,right:Ue.x+Ue.width,bottom:Ue.y+Ue.height,gutter:{left:0,bottom:0}};Ee=ce({...T,plot:vt,bound:ut.bound,domain:re,pool:ze,axes:!1});const Ie=Ce.next("text",`${we}__panel-title`);A(Ie,{x:Ne(Ue.x),y:Ne(Ue.y-4),"text-anchor":"start"}),me(Ie,ut.label)}return ze.finish(),Ce.finish(),{...Ee||{},panels:ie,multiples:!0}}#he(T,K){return T==="combo"||T==="pareto"?!0:!un.has(T)||T==="horizontalBar"||T==="waterfall"?!1:!!(K&&Array.isArray(K.series)&&K.series.some(ie=>ie.axis==="right"&&!this.#h.has(ie.key)))}#de(T){if(this.#e.type!=="bubble"||!this.#e.size)return null;const K=[];for(const Se of T.series||[])for(const re of Se.points)typeof re.size=="number"&&K.push(re.size);const ie=Gt(K);return ie?J(ie,[3,Math.max(6,Math.min(28,this.#e.maxRadius||22))]):null}#me(T){this.#Q(),me(this.#k,T),this.#k.removeAttribute("hidden"),this.#r.setAttribute("hidden","");for(const K of Object.values(this.#a))pe(K);pe(this.#p),pe(this.#w),this.#t=null}#Q(){const T=this.#n.licence;if(!!!(T&&typeof T.watermark=="function"&&T.watermark())){this.#g&&this.#g.parentNode&&this.#g.parentNode.removeChild(this.#g),this.#g=null;return}if(this.#g&&this.#g.parentNode)return;const ie=this.#i,Se=fe(ie,"div",`${we}__watermark`);Se.setAttribute("role","note");const re=fe(ie,"a",`${we}__watermark-link`);re.setAttribute("href","https://www.latticegrid.dev"),re.setAttribute("target","_blank"),re.setAttribute("rel","noopener noreferrer"),me(re,this.#n.messages.t("licence.watermark")),Se.appendChild(re),this.#g=Se,this.#f&&this.#f.appendChild(Se)}#ge(){const T=this.#e.legend;if(T===!1)return{show:!1,position:"bottom",align:"start",shape:"square",maxItems:0,isolate:!1,values:!1};const K=T&&typeof T=="object"?T:{};return{show:!0,position:["top","bottom","left","right"].includes(K.position)?K.position:"bottom",align:["start","centre","center","end"].includes(K.align)?K.align:"start",shape:["square","circle","line"].includes(K.shape)?K.shape:"square",maxItems:Number.isFinite(K.maxItems)&&K.maxItems>0?Number(K.maxItems):0,isolate:!!K.isolate,values:!!K.values}}#O(T,K,ie){const Se=K&&this.#n.columns?this.#n.columns.get(K):null;return(T||[]).map(re=>({key:re.key,label:re.label,index:re.index,value:e(Un(re),Se,this.#n),...ie?{colour:ie(re)}:{}}))}#pe(){const T=this.#e.columns;if(Array.isArray(T)&&T.length)return T.slice(0,cn);const K=this.#n;return!K||!K.columns||typeof K.columns.visible!="function"?[]:K.columns.visible().filter(ie=>!ie.generated&&(ie.type==="number"||ie.type==="currency"||ie.type==="percent"||ie.type==="integer")).map(ie=>ie.id).slice(0,cn)}#s(T){pe(this.#p);const K=this.#ge();if(A(this.#p,{"data-position":K.position,"data-align":K.align}),!T.length||!K.show)return;const ie=this.#i,Se=K.maxItems?T.slice(0,K.maxItems):T;for(const re of Se){const Ce=fe(ie,"button",`${we}__legend-item`);Ce.setAttribute("type","button");const ze=!this.#h.has(re.key);Ce.setAttribute("aria-pressed",ze?"true":"false");const Ee=fe(ie,"span",`${we}__swatch ${we}__swatch--${K.shape}`);Ee.setAttribute("style",`background:${re.colour||this.#N.series(re.index)}`);const Re=fe(ie,"span");Be(Re,this.#E.small),me(Re,K.values&&re.value?`${re.label} ${re.value}`:re.label),Ae(Ce,[Ee,Re]),Ce.addEventListener("click",()=>{this.#be(re,T,K)}),this.#p.appendChild(Ce)}if(K.maxItems&&T.length>Se.length){const re=fe(ie,"span",`${we}__legend-more`);Be(re,this.#E.small),me(re,this.#n.messages.t("chart.legendMore",{count:T.length-Se.length})),this.#p.appendChild(re)}}#be(T,K,ie){if(ie.isolate){const Se=K.filter(Ce=>Ce.key!==T.key),re=Se.every(Ce=>this.#h.has(Ce.key))&&!this.#h.has(T.key);if(this.#h.clear(),!re)for(const Ce of Se)this.#h.add(Ce.key)}else this.#h.has(T.key)?this.#h.delete(T.key):this.#h.add(T.key);this.emit("legend",{label:T.label,key:T.key,hidden:this.#h.has(T.key),hiddenKeys:[...this.#h]}),this.draw()}#ye(T,K,ie){const Se=this.#n.messages,re=K.measure&&K.measure.title||"",Ce=K.dimension&&K.dimension.title||"",ze=re?Ce&&!ie?"chart.summary":"chart.summaryShare":"chart.summaryType",Ee=Se.t(ze,{type:Se.t(`chart.type.${T}`),measure:re,dimension:Ce});A(this.#r,{"aria-label":Ee}),pe(this.#w);const Re=this.#i,Ue=fe(Re,"table"),ut=fe(Re,"caption");me(ut,Se.t("chart.dataTable")),Ue.appendChild(ut);const vt=fe(Re,"tr"),Ie=fe(Re,"th");me(Ie,ie?"":Ce),vt.appendChild(Ie);const Et=[];if(ie&&K.root){for(const mt of K.root.children){const tt=fe(Re,"tr"),Ke=fe(Re,"th");me(Ke,mt.label);const ht=fe(Re,"td");me(ht,u(mt.total,Se)),Ae(tt,[Ke,ht]),Et.push(tt)}const yt=fe(Re,"th");me(yt,re),vt.appendChild(yt)}else{const yt=this.#T(),mt=this.#t&&Array.isArray(this.#t.labels)&&Array.isArray(this.#t.series)&&Array.isArray(this.#t.categories)?this.#t.series:K.series||[];for(const tt of mt){const Ke=fe(Re,"th");me(Ke,tt.label),vt.appendChild(Ke)}for(let tt=0;tt<(yt.labels||[]).length;tt++){const Ke=fe(Re,"tr"),ht=fe(Re,"th");me(ht,yt.labels[tt]),Ke.appendChild(ht);for(const _t of mt){const bn=fe(Re,"td"),sn=_t.points[tt];me(bn,sn&&sn.y!==null?u(sn.y,Se):""),Ke.appendChild(bn)}Et.push(Ke)}}Ue.appendChild(vt);for(const yt of Et)Ue.appendChild(yt);this.#w.appendChild(Ue);const Lt=this.#t&&this.#t.annotations;if(Array.isArray(Lt)&&Lt.length){const yt=fe(Re,"ul",`${we}__annotation-list`);for(const mt of Lt){if(!mt||!mt.text)continue;const tt=fe(Re,"li");me(tt,mt.text),yt.appendChild(tt)}yt.childNodes&&yt.childNodes.length&&this.#w.appendChild(yt)}}on(T,K){return typeof K!="function"?()=>{}:(this.#S.has(T)||this.#S.set(T,new Set),this.#S.get(T).add(K),()=>{const ie=this.#S.get(T);ie&&ie.delete(K)})}emit(T,K){const ie={...K,type:T,chart:this,grid:this.#n},Se=this.#e[`on${T.charAt(0).toUpperCase()}${T.slice(1)}`],re=[...this.#S.get(T)||[]];typeof Se=="function"&&re.unshift(Se);for(const Ce of re)try{Ce(ie)}catch(ze){const Ee=Ct(this.#i);Ee.console&&typeof Ee.console.error=="function"&&Ee.console.error(`[lattice] a chart "${T}" listener threw`,ze)}return ie}data(){return this.#o}ascend(T){if(!this.#u||!this.#u.length)return[];const K=Number.isFinite(T)&&T>0?Number(T):this.#u.length;return this.#u=this.#u.slice(0,Math.max(0,this.#u.length-K)),this.emit("drill",{path:[...this.#u],label:this.#u[this.#u.length-1]||null}),this.draw(),[...this.#u]}update(T){this.#e={...this.#e,...T},this.draw()}get element(){return this.#f}toSVG(T){if(!this.#r)return"";const K=Ct(this.#i);let ie=this.#r;return T&&T.inlineStyles&&K.getComputedStyle&&this.#r.cloneNode&&(ie=this.#r.cloneNode(!0),Zn(this.#r,ie,K),ie.setAttribute("xmlns","http://www.w3.org/2000/svg")),typeof K.XMLSerializer=="function"?new K.XMLSerializer().serializeToString(ie):ie.outerHTML||""}async toPNG(T){const K=Ct(this.#i);if(!this.#r||!K.Image||!this.#i.createElement)return null;const ie=T&&T.scale||K.devicePixelRatio||1,Se=this.#r.getBoundingClientRect?this.#r.getBoundingClientRect():$t,re=Math.max(1,Math.round(Se.width||$t.width)),Ce=Math.max(1,Math.round(Se.height||$t.height)),ze=this.toSVG({inlineStyles:!0}),Ee=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(ze)}`,Re=new K.Image;await new Promise((Ie,Et)=>{Re.onload=Ie,Re.onerror=()=>Et(new Error("the chart could not be rasterised")),Re.src=Ee});const Ue=this.#i.createElement("canvas");Ue.width=Math.round(re*ie),Ue.height=Math.round(Ce*ie);const ut=Ue.getContext("2d"),vt=T&&"background"in T?T.background:"#ffffff";return vt&&(ut.fillStyle=vt,ut.fillRect(0,0,Ue.width,Ue.height)),ut.drawImage(Re,0,0,Ue.width,Ue.height),new Promise(Ie=>Ue.toBlob(Ie,"image/png"))}toCSV(){const T=this.#o;if(!T)return"";const K=re=>{const Ce=re==null?"":String(re);return/[",\n]/.test(Ce)?`"${Ce.replace(/"/g,'""')}"`:Ce};if(T.root){const re=[["Label",T.measure.title||"Value"].map(K).join(",")];for(const Ce of T.root.children)re.push([K(Ce.label),K(Ce.total)].join(","));return re.join(`
229
+ `)}const Se=[[T.dimension.title||"",...T.series.map(re=>re.label)].map(K).join(",")];for(let re=0;re<T.labels.length;re++){const Ce=[K(T.labels[re])];for(const ze of T.series){const Ee=ze.points[re];Ce.push(K(Ee&&Ee.y!==null?Ee.y:""))}Se.push(Ce.join(","))}return Se.join(`
230
+ `)}destroy(){if(!this.#A){this.#A=!0,this.#F();for(const T of this.#b)T();this.#b=[],this.#M&&this.#M.disconnect(),this.#M=null,this.#f&&this.#f.parentNode&&this.#f.parentNode.removeChild(this.#f),this.#t=null,this.#o=null,this.#S.clear()}}}function pn(We){if(!We||!We.grid)throw new Error("createChart needs a grid");const T=We.grid.element?We.grid.element.ownerDocument:globalThis.document,K=Yn(T,We.container);if(!K)throw new Error("createChart needs a container element");const{grid:ie,container:Se,...re}=We;return new gn({grid:ie,container:K,spec:re})}function Xn(We,T){if(!T||!T.container)return null;const K=Ft(We,T);if(!K.spec)return null;const{container:ie,range:Se,...re}=T,Ce=[{provided:["x"],derivedKeys:["x"]},{provided:["y","measures"],derivedKeys:["y","measures"]},{provided:["series"],derivedKeys:["series"]}],ze={...K.spec};for(const Ee of Ce)if(Ee.provided.some(Re=>Re in re))for(const Re of Ee.derivedKeys)delete ze[Re];return pn({...re,...ze,grid:We,container:ie})}function qn(We,T={}){return!!Ft(We,T).spec}});const xt=kn("packages/modules/charts/index.js"),tr=xt.registerScheme,nr=xt.resolveScheme,rr=xt.schemeNames,or=xt.setDefaultScheme,ir=xt.SCHEMES,sr=xt.PALETTE,ar=xt.registerChartType,lr=xt.registeredChartTypes,cr=xt.TYPES,ur=xt.Chart,fr=xt.createChart,hr=xt.deriveRangeSpec,dr=xt.regressionPlots,mr=xt.chartRange,gr=xt.canChartRange;export{ur as Chart,sr as PALETTE,ir as SCHEMES,cr as TYPES,gr as canChartRange,mr as chartRange,fr as createChart,hr as deriveRangeSpec,ar as registerChartType,tr as registerScheme,lr as registeredChartTypes,dr as regressionPlots,nr as resolveScheme,rr as schemeNames,or as setDefaultScheme};
227
231
 
228
232
  //# sourceMappingURL=charts.esm.min.js.map