semiotic 3.8.1 → 3.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/CLAUDE.md +3 -1
  2. package/README.md +53 -52
  3. package/ai/behaviorContracts.cjs +9 -0
  4. package/ai/dist/mcp-server.js +142 -13
  5. package/ai/schema.json +616 -42
  6. package/ai/surface-manifest.json +1 -1
  7. package/ai/system-prompt.md +5 -2
  8. package/dist/chunk-OrdinalBrushOverlay-PXHQYDB2.module.min.js +2 -0
  9. package/dist/chunk-XYBrushOverlay-ECZJJLAJ.module.min.js +1 -0
  10. package/dist/chunk-XYBrushOverlay-EP2SV3UI.module.min.js +2 -0
  11. package/dist/chunk-chunk-255KDHW5.module.min.js +1 -0
  12. package/dist/chunk-chunk-27HVVXS6.module.min.js +1 -0
  13. package/dist/chunk-chunk-2CXCXRB4.module.min.js +1 -0
  14. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +2 -0
  15. package/dist/chunk-chunk-2UN3ANRN.module.min.js +2 -0
  16. package/dist/chunk-chunk-2VUEY5TH.module.min.js +1 -0
  17. package/dist/chunk-chunk-2WVCH4PL.module.min.js +1 -0
  18. package/dist/chunk-chunk-5UKL5W76.module.min.js +2 -0
  19. package/dist/chunk-chunk-5WEFWNUW.module.min.js +2 -0
  20. package/dist/chunk-chunk-6F6GEAQU.module.min.js +1 -0
  21. package/dist/chunk-chunk-7LHMKRKE.module.min.js +2 -0
  22. package/dist/chunk-chunk-BHYTYMY2.module.min.js +2 -0
  23. package/dist/chunk-chunk-C6EJ4IOD.module.min.js +2 -0
  24. package/dist/chunk-chunk-CA3YDW6F.module.min.js +1 -0
  25. package/dist/chunk-chunk-CP3EN6KZ.module.min.js +1 -0
  26. package/dist/chunk-chunk-CYIML3AV.module.min.js +2 -0
  27. package/dist/chunk-chunk-DNY43POY.module.min.js +1 -0
  28. package/dist/chunk-chunk-DSNGDNJY.module.min.js +1 -0
  29. package/dist/chunk-chunk-E7MIQX7D.module.min.js +2 -0
  30. package/dist/chunk-chunk-EMO5NUGE.module.min.js +1 -0
  31. package/dist/chunk-chunk-ES4DCG3L.module.min.js +1 -0
  32. package/dist/chunk-chunk-FAKO3RGQ.module.min.js +2 -0
  33. package/dist/chunk-chunk-FYY2ACNJ.module.min.js +2 -0
  34. package/dist/chunk-chunk-G7WFWHAD.module.min.js +2 -0
  35. package/dist/chunk-chunk-GMQ5AYTD.module.min.js +1 -0
  36. package/dist/chunk-chunk-H4PPRW6N.module.min.js +1 -0
  37. package/dist/chunk-chunk-IFYPMWKY.module.min.js +1 -0
  38. package/dist/chunk-chunk-J3ELI22J.module.min.js +1 -0
  39. package/dist/chunk-chunk-J3QOW4OE.module.min.js +0 -0
  40. package/dist/chunk-chunk-J3XWETBJ.module.min.js +2 -0
  41. package/dist/chunk-chunk-JCG72SGW.module.min.js +2 -0
  42. package/dist/{semiotic-ai-chunk-OG7BQUUW.module.min.js → chunk-chunk-JJ2OOIET.module.min.js} +0 -1
  43. package/dist/chunk-chunk-KTWEBFMX.module.min.js +2 -0
  44. package/dist/chunk-chunk-L6D3I3V7.module.min.js +2 -0
  45. package/dist/chunk-chunk-M337NY6L.module.min.js +1 -0
  46. package/dist/chunk-chunk-NO4MCQVD.module.min.js +1 -0
  47. package/dist/chunk-chunk-ODUZEEBH.module.min.js +2 -0
  48. package/dist/chunk-chunk-P6UBCMSQ.module.min.js +2 -0
  49. package/dist/chunk-chunk-Q2YADC2V.module.min.js +2 -0
  50. package/dist/chunk-chunk-QRIBHZYW.module.min.js +1 -0
  51. package/dist/chunk-chunk-QSQVBIJA.module.min.js +1 -0
  52. package/dist/chunk-chunk-RCF52Z42.module.min.js +2 -0
  53. package/dist/chunk-chunk-RH5TSQPH.module.min.js +1 -0
  54. package/dist/chunk-chunk-ROP4HI7H.module.min.js +2 -0
  55. package/dist/chunk-chunk-RZH7VZYS.module.min.js +2 -0
  56. package/dist/chunk-chunk-SIRIJ3DY.module.min.js +1 -0
  57. package/dist/chunk-chunk-STZFFTAN.module.min.js +2 -0
  58. package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
  59. package/dist/chunk-chunk-T27ZEV6A.module.min.js +1 -0
  60. package/dist/chunk-chunk-U3AGQ5EF.module.min.js +2 -0
  61. package/dist/chunk-chunk-U66USBWU.module.min.js +1 -0
  62. package/dist/chunk-chunk-VVCA3DB7.module.min.js +1 -0
  63. package/dist/chunk-chunk-W3DB2MN4.module.min.js +2 -0
  64. package/dist/chunk-chunk-WCX6U47H.module.min.js +2 -0
  65. package/dist/chunk-chunk-WDIN4LRC.module.min.js +1 -0
  66. package/dist/chunk-chunk-XEVJDUTH.module.min.js +1 -0
  67. package/dist/chunk-chunk-XOYX77KF.module.min.js +2 -0
  68. package/dist/chunk-chunk-YCQYG6J5.module.min.js +2 -0
  69. package/dist/chunk-chunk-YHNZCPOZ.module.min.js +2 -0
  70. package/dist/chunk-chunk-YWZB3KPI.module.min.js +2 -0
  71. package/dist/chunk-chunk-Z5KXAVQD.module.min.js +2 -0
  72. package/dist/chunk-chunk-ZCNBUZPL.module.min.js +2 -0
  73. package/dist/chunk-chunk-ZLKRTF5N.module.min.js +2 -0
  74. package/dist/chunk-chunk-ZTNVDWAK.module.min.js +2 -0
  75. package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +2 -0
  76. package/dist/components/charts/physics/PhysicalFlowChart.d.ts +7 -0
  77. package/dist/components/charts/shared/auditAccessibilityText.d.ts +13 -0
  78. package/dist/components/server/staticSVGChrome.d.ts +3 -2
  79. package/dist/components/stream/OrdinalBrushOverlay.d.ts +1 -2
  80. package/dist/components/stream/OrdinalBrushOverlayLazy.d.ts +9 -0
  81. package/dist/components/stream/XYBrushOverlayLazy.d.ts +17 -0
  82. package/dist/controls.min.js +1 -1
  83. package/dist/controls.module.min.js +1 -1
  84. package/dist/geo.min.js +1 -1
  85. package/dist/geo.module.min.js +1 -1
  86. package/dist/network.min.js +1 -1
  87. package/dist/network.module.min.js +1 -1
  88. package/dist/ordinal.min.js +1 -1
  89. package/dist/ordinal.module.min.js +1 -1
  90. package/dist/physics-matter.min.js +1 -1
  91. package/dist/physics-matter.module.min.js +1 -1
  92. package/dist/physics-rapier.min.js +1 -1
  93. package/dist/physics-rapier.module.min.js +1 -1
  94. package/dist/physics.min.js +1 -1
  95. package/dist/physics.module.min.js +1 -1
  96. package/dist/realtime.min.js +1 -1
  97. package/dist/realtime.module.min.js +1 -1
  98. package/dist/rough.min.js +1 -1
  99. package/dist/rough.module.min.js +1 -1
  100. package/dist/semiotic-ai-core.min.js +1 -1
  101. package/dist/semiotic-ai-core.module.min.js +1 -1
  102. package/dist/semiotic-ai.min.js +1 -1
  103. package/dist/semiotic-ai.module.min.js +1 -1
  104. package/dist/semiotic-data.min.js +1 -1
  105. package/dist/semiotic-data.module.min.js +1 -1
  106. package/dist/semiotic-experimental.min.js +1 -1
  107. package/dist/semiotic-experimental.module.min.js +1 -1
  108. package/dist/semiotic-realtime-core.min.js +1 -1
  109. package/dist/semiotic-realtime-core.module.min.js +1 -1
  110. package/dist/semiotic-realtime-react.min.js +1 -1
  111. package/dist/semiotic-realtime-react.module.min.js +1 -1
  112. package/dist/semiotic-recipes-core.min.js +1 -1
  113. package/dist/semiotic-recipes-core.module.min.js +1 -1
  114. package/dist/semiotic-recipes-react.min.js +1 -1
  115. package/dist/semiotic-recipes-react.module.min.js +1 -1
  116. package/dist/semiotic-recipes.min.js +1 -1
  117. package/dist/semiotic-recipes.module.min.js +1 -1
  118. package/dist/semiotic-server-edge.min.js +1 -1
  119. package/dist/semiotic-server-edge.module.min.js +1 -1
  120. package/dist/semiotic-server-node.min.js +1 -1
  121. package/dist/semiotic-server-node.module.min.js +1 -1
  122. package/dist/semiotic-themes-core.min.js +1 -1
  123. package/dist/semiotic-themes-core.module.min.js +1 -1
  124. package/dist/semiotic-themes-react.min.js +1 -1
  125. package/dist/semiotic-themes-react.module.min.js +1 -1
  126. package/dist/semiotic-themes.min.js +1 -1
  127. package/dist/semiotic-themes.module.min.js +1 -1
  128. package/dist/semiotic-utils-core.min.js +1 -1
  129. package/dist/semiotic-utils-core.module.min.js +1 -1
  130. package/dist/semiotic-utils-react.min.js +1 -1
  131. package/dist/semiotic-utils-react.module.min.js +1 -1
  132. package/dist/semiotic-utils.min.js +1 -1
  133. package/dist/semiotic-utils.module.min.js +1 -1
  134. package/dist/semiotic-value.min.js +1 -1
  135. package/dist/semiotic-value.module.min.js +1 -1
  136. package/dist/semiotic.min.js +1 -1
  137. package/dist/semiotic.module.min.js +1 -1
  138. package/dist/server.min.js +1 -1
  139. package/dist/server.module.min.js +1 -1
  140. package/dist/xy.min.js +1 -1
  141. package/dist/xy.module.min.js +1 -1
  142. package/package.json +4 -4
  143. package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +0 -2
  144. package/dist/semiotic-chunk-3FSVZ46U.module.min.js +0 -2
  145. package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +0 -2
  146. package/dist/xy-chunk-IWD6IB6V.module.min.js +0 -2
  147. package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +0 -2
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{getMinMax as e}from"./chunk-chunk-JJ2OOIET.module.min.js";import{createStore as t,useTheme as n,useThemeSelector as r}from"./chunk-chunk-WCX6U47H.module.min.js";import{glyphFractionClipRect as o,glyphPlacement as i,resolveGlyphPaint as a}from"./chunk-chunk-KTWEBFMX.module.min.js";import{useHydrationLifecycle as s}from"./chunk-chunk-ZCNBUZPL.module.min.js";import{useReducedMotion as l}from"./chunk-chunk-YHNZCPOZ.module.min.js";var c={fresh:1,aging:1.5,stale:3};function u(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}function d(e,t,n){if(null!=e)return"function"==typeof e?e(t,n):"object"==typeof e&&null!==e&&"constant"in e?e.constant:t[e]}function h(e){const{data:t,encoding:n}=e,r=[],o=new Map;return t.forEach((e,t)=>{const i=d(n.id,e,t);if(null==i||""===i)throw Error(`[semiotic] Motion encoding row ${t} resolved an empty id.`);const a=i+"";if(o.has(a))throw Error(`[semiotic] Duplicate motion encoding id "${a}".`);const s=d(n.process?.group,e,t),l=d(n.process?.stage,e,t),c=d(n.accessible?.group,e,t)??(null!=s?s+"":null!=l?l+"":void 0),u={};for(const r of Object.keys(n.evidence??{}))u[r]=d(n.evidence?.[r],e,t);const h={id:a,datum:e,time:{arrival:d(n.time?.arrival,e,t),basis:n.time?.basis,unit:n.time?.unit},placement:{x:d(n.placement?.x,e,t),y:d(n.placement?.y,e,t),lane:d(n.placement?.lane,e,t),space:n.placement?.space},kinematics:{velocityX:d(n.kinematics?.velocityX,e,t),velocityY:d(n.kinematics?.velocityY,e,t),space:n.kinematics?.space},process:{group:s,stage:l,target:d(n.process?.target,e,t),work:d(n.process?.work,e,t)},evidence:u,accessible:{description:d(n.accessible?.description,e,t),group:c,label:d(n.accessible?.label,e,t)??a}};r.push(h),o.set(a,h)}),{rows:r,byId:o}}function f(e){const t=e.now-e.arrival;return{age:t,progress:Number.isFinite(t)&&Number.isFinite(e.ttl)&&e.ttl>0?Math.max(0,t)/e.ttl:t===1/0&&Number.isFinite(e.ttl)&&e.ttl>0?1/0:0,lifecycle:u(t,e.ttl,e.thresholds)}}function y(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const r=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(r>0?r:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}function p(e,t){const n=Number.isFinite(e)?e:0,r=Number.isFinite(t)?t:0;return{velocityX:n,velocityY:r,speed:Math.hypot(n,r),direction:Math.atan2(r,n)}}function m(e,t,n){return Number.isFinite(n)&&n>0?p((t.x-e.x)/n,(t.y-e.y)/n):p(0,0)}var g=null;function b(e={},t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:a=45}=e,s=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(g||(g=document.createElement("canvas")),g.width=e,g.height=e,g)}(s)}catch{return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,s,s)):c.clearRect(0,0,s,s),c.strokeStyle=r,c.lineWidth=o,c.lineCap="square";const u=a*Math.PI/180;if(45===a||-45===a){const e=a>0?1:-1;for(let t=-s;2*s>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*s,s),c.stroke()}else{c.save(),c.translate(s/2,s/2),c.rotate(u);const e=2*s;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}import{jsx as x,jsxs as v}from"react/jsx-runtime";function k(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function w(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function $(e,t){let n=2166136261;const r=w(t);for(let e=0;r.length>e;e++)n^=r.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var M=new Map;function A(e,t){const{background:n="transparent",stroke:r="#000",lineWidth:o=1.5,spacing:i=6,angle:a=45,lineOpacity:s=1}=e,l=Math.max(8,Math.ceil(2*i));return v("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==a?`rotate(${a})`:void 0,children:[n&&"transparent"!==n&&x("rect",{width:l,height:l,fill:n}),x("line",{x1:0,y1:0,x2:0,y2:l,stroke:r,strokeWidth:o,strokeOpacity:s}),x("line",{x1:i,y1:0,x2:i,y2:l,stroke:r,strokeWidth:o,strokeOpacity:s})]},t)}function S(e,t,n="#4e79a7"){if(k(e)){const n=$(t,e);return{fill:`url(#${n})`,def:A(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}import*as W from"react";var[C,j]=t(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function I(e){const t=j(e=>e.pushObservation),n=W.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return W.useMemo(()=>({...e,onObservation:n}),[n,e])}function O(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}function N(e,t={}){const n=O(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const o=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(r);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:o}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:o,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}function R(e){return e instanceof Element&&null!=e.closest("[data-semiotic-annotation-widget]")}import{jsx as L,jsxs as P}from"react/jsx-runtime";var z="var(--semiotic-bg, #ffffff)";function F(e,t){return(e+"").length*t*.6}function T(e){const{x:t,y:n,text:r,fill:o,fontSize:i=12,fontWeight:a,fontFamily:s,textAnchor:l="start",dominantBaseline:c,background:u,className:d}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>L("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:o,fontSize:i,fontWeight:a,fontFamily:s,className:d,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??z,strokeWidth:h.haloWidth??3});const y=h.padding??{x:6,y:3},p="number"==typeof y?y:y.x,m="number"==typeof y?y:y.y,g=F(r,i),b=i+2*m;let x,v;return x="middle"===l?t-g/2-p:"end"===l?t-g-p:t-p,v="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-m:n-.8*i-m,P("g",{className:d,children:[L("rect",{x:x,y:v,width:g+2*p,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??z,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}var D=["name","label","title"],E=["type","kind","category","group","class","status","role","shape"],B=["value","amount","total","count","weight","score"],H=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function q(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}function G(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,r=!1!==t.skipPositional,o=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(r&&H.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&o.push({key:t,lower:t.toLowerCase(),value:n})}if(0===o.length)return{entries:[]};let i=o.findIndex(e=>D.includes(e.lower));const a=i>=0;0>i&&(i=o.findIndex(e=>"id"===e.lower)),0>i&&(i=o.findIndex(e=>"string"==typeof e.value));const s=0>i?void 0:o[i];let l=o.filter((e,t)=>t!==i);a&&(l=l.filter(e=>"id"!==e.lower));const c=q(l,E),u=q(l,B),d=new Set(E),h=new Set(B),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(d.has(e.lower)||h.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:s?.key,title:s?.value,entries:f}}function V(e,t){return"touch"===t?Math.max(e,24):e}function _(e){return Array.isArray(e)?e[0]:e}function U(e,t,n,r){return{data:_(e),x:t,y:n,__semioticHoverData:!0,...r}}import{jsx as Y,jsxs as Z}from"react/jsx-runtime";var X={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function K(e,t){return"function"==typeof t?t(e):e[t]}function J(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function Q(e={}){const{fields:t,title:n,format:r,style:o={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let a;const s=[];if(n){const t=K(e,n);a=J(t,r)}if(t&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const a=K(e,o);s.push({label:n,value:J(a,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){a=J(e[n],r);break}if(!a){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(a=J(e[t[0]],r))}}const l={...X,...o};return Z("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[a&&Y("div",{style:{fontWeight:s.length>0?"bold":"normal"},children:a}),s.map((e,t)=>Z("div",{style:{marginTop:0===t&&a?"4px":0},children:[e.label&&Z("span",{children:[e.label,": "]}),e.value]},t))]})}}function ee(e={}){const{fields:t=[],title:n,format:r,style:o={},className:i="",showLabels:a=!0,separator:s=": "}=e;return e=>{if(!e||"object"!=typeof e)return null;const l=[];if(n){const t=K(e,n);l.push({value:J(t,r)})}if(t&&Array.isArray(t)&&t.length>0)t.forEach(t=>{let n,o,i;"string"==typeof t?(n=t,o=t,i=r):(n=t.label,o=t.accessor||t.key||"",i=t.format||r);const s=J(K(e,o),i);l.push({label:a?n:void 0,value:s})});else{const t=G(e,{skipPositional:!1});null!=t.title&&l.push({label:void 0,value:J(t.title,r),bold:!0}),t.entries.forEach(e=>{l.push({label:a?e.key:void 0,value:J(e.value,r)})})}const c={...X,...o};return Array.isArray(l)&&0!==l.length?Y("div",{className:("semiotic-tooltip semiotic-tooltip-multiline "+i).trim(),style:c,children:l.map((e,t)=>Z("div",{style:{marginBottom:l.length-1>t?"4px":0,fontWeight:e.bold?"bold":void 0},children:[e.label&&Z("strong",{children:[e.label,s]}),e.value]},t))}):null}}function te(){return e=>{const t=e.allSeries;if(!t||0===t.length)return Y("div",{className:"semiotic-tooltip",style:X,children:Y("div",{children:J(e.data?.value??e.data?.y)})});const n=e.xValue??e.data?.time??e.data?.x;return Z("div",{className:"semiotic-tooltip",style:X,children:[null!=n&&Y("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:J(n)}),t.map((e,t)=>Z("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[Y("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),Y("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),Y("span",{style:{fontWeight:500,fontSize:"0.85em"},children:J(e.value)})]},t))]})}}function ne(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=_(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const r=t(n);return null==r?null:Y("div",{className:"semiotic-tooltip",style:X,children:r})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?Q(e):Q())}}import{createContext as re,useContext as oe,useMemo as ie}from"react";import{scaleOrdinal as ae}from"d3-scale";function se(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function le(e,t,n){const r=e=>e.toString(16).padStart(2,"0");return`#${r(e)}${r(t)}${r(n)}`}function ce(e){const t=e.map(se),n=t.length-1;return e=>{if(0>=e){const[e,n,r]=t[0];return le(e,n,r)}if(e>=1){const[e,r,o]=t[n];return le(e,r,o)}const r=e*n,o=Math.floor(r),i=r-o,[a,s,l]=t[o],[c,u,d]=t[o+1];return le(Math.round(a+(c-a)*i),Math.round(s+(u-s)*i),Math.round(l+(d-l)*i))}}var ue=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],de=ce(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),he=ce(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),fe=ce(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),ye=ce(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),pe=ce(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),me=ce(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),ge=ce(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),be=ce(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),xe=ce(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),ve=ce(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),ke=ce(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),we=ce(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),$e={blues:de,reds:he,greens:fe,viridis:ge,oranges:ye,purples:pe,greys:me,plasma:be,inferno:xe,magma:ve,cividis:ke,turbo:we};function Me(e){return e&&$e[e]||de}var Ae=ce(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),Se=ce(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),We=ce(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),Ce=ce(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),je=ce(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),Ie=ce(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),Oe=ce(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]),Ne={category10:ue,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...$e},Re=ue,Le=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Pe=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],ze=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function Fe(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||ze.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):Re[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(r))%Re.length]}function Te(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function De(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>Te(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),o=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return ae().domain(r).range(n).unknown("#999");const i=Ne[n]||Ne.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:Re;return ae().domain(r).range(e).unknown("#999")}}function Ee(e,t,n=[3,20],r){let o;if(o="function"==typeof t?t(e):e?.[t],!r)return o;const[i,a]=r,[s,l]=n;if(a===i)return(s+l)/2;let c=(o-i)/(a-i);return 0>c?c=0:c>1&&(c=1),s+c*(l-s)}import{jsx as Be}from"react/jsx-runtime";var He=re(null);function qe({colors:e,categories:t,colorScheme:n="category10",children:r}){const o=ie(()=>{if(e)return e;if(t){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n,r={};let o=0;for(const n of t)r[n]=Te(e,n)??Re[o++%Re.length];return r}const e=Array.isArray(n)?n:Ne[n]||Re,r={};for(let n=0;t.length>n;n++)r[t[n]]=e[n%e.length];return r}return{}},[e,t,n]);return Be(He.Provider,{value:o,children:r})}function Ge(){return oe(He)}qe.displayName="CategoryColorProvider";import{useId as Ve,useMemo as _e,useCallback as Ue}from"react";function Ye(e){const t=[];for(const[n,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[n]));else{const[e,o]=r.range;t.push(t=>{const r=t[n];return r>=e&&o>=r})}return e=>t.every(t=>t(e))}function Ze(e,t){const n=[];for(const[r,o]of e.clauses)"crossfilter"===e.resolution&&r===t||n.push(Ye(o));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}function Xe(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Ke(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[Je,Qe]=t(e=>({selections:new Map,setClause(t,n){e(e=>{const r=e.selections.get(t),o=r?.clauses.get(n.clientId);if(o&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,r]of n){const n=t.fields[e];if(!n||!Ke(r,n))return!1}return!0}(o,n))return{};const i=new Map(e.selections),a=Xe(i,t),s=new Map(a.clauses);return s.set(n.clientId,n),i.set(t,{...a,clauses:s}),{selections:i}})},clearClause(t,n){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(n))return{};const o=new Map(e.selections),i=new Map(r.clauses);return i.delete(n),o.set(t,{...r,clauses:i}),{selections:o}})},setResolution(t,n){e(e=>{const r=e.selections.get(t);if(r?.resolution===n)return{};const o=new Map(e.selections),i=Xe(o,t);return o.set(t,{...i,resolution:n}),{selections:o}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...n,clauses:new Map}),{selections:r}})}}));import{useSyncExternalStore as et}from"react";var tt={positions:new Map},nt=new Set;function rt(){for(const e of nt)e()}function ot(e,t){const n=tt.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const r=new Map(tt.positions);r.delete(e),tt={positions:r},rt()}function it(e,t){const n=tt.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const r=new Map(tt.positions);r.delete(e),tt={positions:r},rt()}function at(){return tt}function st(e){return nt.add(e),()=>nt.delete(e)}var lt={positions:new Map};function ct(){return()=>{}}function ut(){return lt}function dt(e){const t=et(e?st:ct,e?at:ut,e?at:ut);return e?t.positions.get(e)??null:null}function ht(e){const t=Ve(),n=e.clientId||t,{name:r}=e,o=Qe(e=>e.selections.get(r)),i=Qe(e=>e.setClause),a=Qe(e=>e.clearClause),s=_e(()=>!!o&&o.clauses.size>0,[o]);return{predicate:_e(()=>o&&0!==o.clauses.size?Ze(o,n):()=>!0,[o,n]),isActive:s,selectPoints:Ue(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"point",values:new Set(r)},o=!0;o&&i(r,{clientId:n,type:"point",fields:t})},[n,r,i]),selectInterval:Ue(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"interval",range:r},o=!0;o&&i(r,{clientId:n,type:"interval",fields:t})},[n,r,i]),clear:Ue(()=>{a(r,n)},[a,r,n]),clientId:n}}function ft(e,t){const n=Ve(),r=t||n,o=Qe(e=>e.setClause),i=Qe(e=>e.clearClause);return{selectPoints:Ue(t=>{const n={};let i=!1;for(const[e,r]of Object.entries(t))n[e]={type:"point",values:new Set(r)},i=!0;i&&o(e,{clientId:r,type:"point",fields:n})},[e,r,o]),clear:Ue(()=>i(e,r),[e,r,i]),clientId:r}}function yt(e){const t=e.name||"hover",{fields:n}=e,{predicate:r,isActive:o,selectPoints:i,clear:a}=ht({name:t,fields:n});return{onHover:Ue(e=>{if(!e)return void a();const t={};for(const r of n){const n=e[r];void 0!==n&&(t[r]=[n])}gt(t)&&i(t)},[n,i,a]),predicate:r,isActive:o}}function pt(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function mt(e){const{name:t,xField:n,yField:r}=e,{predicate:o,isActive:i,selectInterval:a,clear:s}=ht({name:t,fields:[n,r].filter(Boolean)}),l=n&&r?"xyBrush":n?"xBrush":"yBrush",c=Ue(e=>{if(!e)return void s();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&pt(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&pt(e)&&r&&(t[r]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),gt(t)&&a(t)},[l,n,r,a,s]);return{brushInteraction:_e(()=>({brush:l,during:c,end:c}),[l,c]),predicate:o,isActive:i,clear:s}}function gt(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function bt(e,t,n){const r=Qe(e=>e.selections.get(t));return _e(()=>{if(!r||0===r.clauses.size)return e;const t=Ze(r,n);return e.filter(t)},[e,r,n])}import{useMemo as xt}from"react";function vt(e={}){const{limit:t=50,types:n,chartId:r}=e,o=j(e=>e.version),i=j(e=>e.observations),a=j(e=>e.clearObservations),s=xt(()=>{let e=i;if(n&&n.length>0){const t=new Set(n);e=e.filter(e=>t.has(e.type))}return r&&(e=e.filter(e=>e.chartId===r)),e.length>t&&(e=e.slice(e.length-t)),e},[i,n,r,t,o]);return{observations:s,latest:s.length>0?s[s.length-1]:null,clear:a}}import{createContext as kt,useContext as wt,useEffect as $t,useId as Mt,useLayoutEffect as At,useMemo as St,useRef as Wt,useState as Ct,useCallback as jt}from"react";import*as It from"react";import{jsx as Ot,jsxs as Nt}from"react/jsx-runtime";var Rt={fill:(e,t)=>Ot("rect",{style:e,width:t,height:t}),line:(e,t)=>Ot("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Lt(e,t,n,r,o){let i;return i="function"==typeof n?n(e):(0,Rt[n])(r(e,t),o),i}function Pt({swatchSize:e}){return Ot("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function zt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Ft=(e,t,n,r,o,i,a,s,l,c,u)=>{const{type:d="fill",styleFn:h,items:f}=e,y=[];let p=0;const m=!(!t&&!n),g="isolate"===c||void 0===c&&null!=o,{swatchSize:b,labelGap:x,rowHeight:v}=u;return f.forEach((e,c)=>{const u=Lt(e,c,d,h,b),k=zt(e,r,o),w=o&&o.size>0&&o.has(e.label);y.push(Nt("g",{transform:`translate(0,${p})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?s===i&&c===a?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&g?w||!1:void 0,"aria-current":m&&!g&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:m?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(s,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:m?t=>{l(s,c),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&Ot("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&Ot(Pt,{swatchSize:b}),Ot("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),p+=v}),y};function Tt({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:o,label:i,format:a}=e,s=a||(e=>Math.round(100*e)/100+""),l="grad-legend-"+It.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Ot("stop",{offset:100*t+"%",stopColor:r(o[0]+t*(o[1]-o[0]))},e))}return Nt("g",{"aria-label":i||"Gradient legend",children:[Ot("defs",{children:Ot("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&Ot("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Ot("rect",{x:a,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),Ot("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[0])}),Ot("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Ot("stop",{offset:100*t+"%",stopColor:r(o[1]-t*(o[1]-o[0]))},e))}return Nt("g",{"aria-label":i||"Gradient legend",children:[i&&Ot("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Ot("defs",{children:Ot("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),Ot("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),Ot("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[1])}),Ot("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[0])})]})}function Dt(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:d}=e,h=function(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(d),[f,y]=It.useState(0),[p,m]=It.useState(0),g=It.useCallback((e,t)=>{y(e),m(t)},[]),b="vertical"===u?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let d=24;const h=[];return e.forEach((e,f)=>{d+=5,h.push(Ot("line",{stroke:"gray",x1:0,y1:d,x2:t,y2:d},"legend-top-line legend-symbol-"+f)),d+=8,e.label&&(d+=16,h.push(Ot("text",{y:d,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),d+=8),h.push(Ot("g",{className:"legend-item",transform:`translate(0,${d})`,children:Ft(e,n,r,o,i,a,s,f,l,c,u)},"legend-group-"+f)),d+=e.items.length*u.rowHeight+8}),h})({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:g,legendInteraction:a,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=0;const f=[];e.forEach((e,t)=>{let y=0;e.label&&(y+=16);const p=((e,t,n,r,o,i,a,s,l,c,u,d)=>{const{type:h="fill",styleFn:f,items:y}=e,p=[],{swatchSize:m,labelGap:g,itemGap:b,rowHeight:x,align:v}=u,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=o,$=y.map(e=>m+g+7*e.label.length),M=[];let A=0,S=0;$.forEach((e,t)=>{const n=0===S?e:S+b+e;d&&d>0&&S>0&&n>d?(M.push({start:A,end:t,width:S}),A=t,S=e):S=n}),y.length>0&&M.push({start:A,end:y.length,width:S}),M.forEach((e,c)=>{let u="center"===v?Math.max(0,((d??e.width)-e.width)/2):"end"===v?Math.max(0,(d??e.width)-e.width):0;for(let d=e.start;e.end>d;d++){const e=y[d],v=Lt(e,d,h,f,m),M=zt(e,r,o),A=o&&o.size>0&&o.has(e.label);p.push(Nt("g",{transform:`translate(${u},${c*x})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?s===i&&d===a?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?A||!1:void 0,"aria-current":k&&!w&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(d+("ArrowRight"===n.key?1:-1)+y.length)%y.length;l(s,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(s,d),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:M,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&Ot("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+g+2+7*e.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,A&&Ot(Pt,{swatchSize:m}),Ot("text",{y:m/2,x:m+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+d)),u+=$[d]+b}});const W=Math.max(0,...M.map(e=>e.width)),C=M.length;return{items:p,offset:W,totalRows:C,totalHeight:C*x}})(e,r,o,i,a,s,l,t,c,u,d,d.maxWidth??n);y+=p.offset+5,f.push({label:e.label,...p,offset:y,totalRows:p.totalRows,totalHeight:p.totalHeight}),h+=y+12});const y=d.maxWidth??n;let p=h>y?0:"center"===d.align?Math.max(0,(y-h)/2):"end"===d.align?Math.max(0,y-h):0;const m=[];return f.forEach((n,r)=>{const o=e[r];o.label&&(m.push(Ot("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label},"legend-text-"+r)),p+=16),m.push(Ot("g",{className:"legend-item",transform:`translate(${p},0)`,children:n.items},"legend-group-"+r)),p+=n.offset+5,e[r+1]&&m.push(Ot("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),p+=12}),Ot("g",{children:m})})({legendGroups:t||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:g,legendInteraction:a,metrics:h}),x=!(!n&&!r);return Nt("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==s&&""!==s&&"vertical"===u&&Ot("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:s}),b]})}import{useRef as Et,useState as Bt,useEffect as Ht}from"react";function qt(e,t,n){const r=Et(null),[o,i]=Bt(null);return Ht(()=>{if(!t&&!n)return;const e=r.current;if(!e)return;const o=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return o.observe(e),()=>o.disconnect()},[t,n]),[r,[t&&o?o.w:e[0],n&&o?o.h:e[1]]]}import{jsx as Gt,jsxs as Vt}from"react/jsx-runtime";var _t=kt(!1),Ut=kt(!1);function Yt(){return wt(Ut)}var Zt=kt(null),Xt="undefined"==typeof window?$t:At;function Kt(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function Jt(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}function Qt(e){const t=wt(Zt),n=Mt(),r=Kt(e),o=Wt([]);Jt(o.current,r)||(o.current=r);const i=o.current;Xt(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Xt(()=>{t&&t.registerCategories(n,i)},[t,n,i])}var en="__linked-legend-isolate__",tn="__linked-legend-highlight__";function nn({categoryColors:e,interaction:t,selectionName:n,field:r}){const o=Object.entries(e),i=o.map(([e])=>e),a=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:o.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:s,clear:l}=ht({name:n,fields:[r],clientId:en}),{selectPoints:c,clear:u}=ht({name:n,fields:[r],clientId:tn}),d=Qe(e=>e.selections.get(n)),{isolatedCategories:h,highlightedCategory:f}=St(()=>{const e=new Set;let t=null;const n=d?.clauses.get(en)?.fields[r];if("point"===n?.type)for(const t of n.values)e.add(t+"");const o=d?.clauses.get(tn)?.fields[r];if("point"===o?.type){const e=o.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[d,r]),y=jt(e=>{"highlight"===t&&(e?c({[r]:[e.label]}):u())},[t,r,c,u]),p=jt(e=>{if("isolate"!==t)return;const n=new Set(h);n.has(e.label)?n.delete(e.label):n.add(e.label),0===n.size||n.size===i.length?l():s({[r]:Array.from(n)})},[t,r,h,i.length,s,l]),[m,[g]]=qt([0,0],!0,!1),b=St(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,r=1;for(const o of e){const e=26+7*o.length;n>0&&n+e>t&&(r++,n=0),n+=e}return r}(o.map(([e])=>e),g),[o,g]);return 0===o.length?null:Gt("div",{ref:m,style:{width:"100%",display:"block"},children:Gt("svg",{width:"100%",height:Math.max(30,22*b+8),style:{display:"block",overflow:"visible"},children:Gt(Dt,{legendGroups:a,title:!1,orientation:"horizontal",width:g,height:20,customHoverBehavior:"highlight"===t?y:void 0,customClickBehavior:"isolate"===t?p:void 0,highlightedCategory:f,isolatedCategories:h})})})}function rn({children:e,selections:t,showLegend:n,legendPosition:r="top",legendInteraction:o="none",legendSelectionName:i="legend",legendField:a="category"}){const s=St(()=>{if(!t)return;const e=new Map;for(const[n,r]of Object.entries(t))r.resolution&&e.set(n,{name:n,resolution:r.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=Ge(),[c,u]=Ct({}),d=Wt({}),h=St(()=>({registerCategories:(e,t)=>{const n=Kt(t);u(t=>Jt(t[e]??[],n)?t:{...t,[e]:n})},unregisterCategories:e=>{u(t=>{if(!(e in t))return t;const n={...t};return delete n[e],n})}}),[]),f=St(()=>{const e=[];for(const t of Object.values(c))for(const n of t)e.push(n);return Kt(e)},[c]),y=St(()=>{const e=l??{},t=d.current;let n=Object.keys(e).length+Object.keys(t).length;for(const r of f)e[r]||t[r]||(t[r]=Re[n%Re.length],n++);const r={...e};for(const n of f)r[n]=e[n]??t[n];return r},[l,f]),p=void 0===n||n,m=Object.keys(y).length>0;return Gt(Je,{initialState:s,children:Gt(C,{children:Gt(Ut.Provider,{value:!0,children:Gt(Zt.Provider,{value:h,children:Gt(qe,{colors:y,children:Vt(_t.Provider,{value:p&&m,children:[p&&"top"===r&&Gt(nn,{categoryColors:y,interaction:o,selectionName:i,field:a}),e,p&&"bottom"===r&&Gt(nn,{categoryColors:y,interaction:o,selectionName:i,field:a})]})})})})})})}function on(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function an(e,t){const{when:n}=e,r=t.width,o=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),a=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof o||n.minHeight>o)||"number"==typeof n.maxHeight&&("number"!=typeof o||o>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&a!==n.orientation)}function sn(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const r=n.map((e,t)=>({rule:e,index:t})).filter(e=>an(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:r.reduce((e,t)=>function(e,t){const n={...e,...t};for(const r of["margin","frameProps","mobileSemantics","style"])on(e[r])&&on(t[r])&&(n[r]={...e[r],...t[r]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:r}}var ln=Object.freeze([]);function cn(e){if(!e)return ln;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var un={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function dn(e,t){const n={...e};for(const e of t)n[un[e]]++;return n}function hn(e,t,n){const r=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:r,revisions:dn(n,r)}}var fn=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=hn({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=hn(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}};import{memo as yn,useEffect as pn,useRef as mn}from"react";var gn={sceneGeometry:0,layout:0,domain:0};function bn(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function xn(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var vn="production"!==process.env.NODE_ENV,kn={revisions:gn,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},wn=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=gn,this.lastObserved=gn,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){vn&&(this.lastObserved=xn(this.lastObserved,bn(e)))}beforeCompute(e,t){if(!vn)return kn;const n=xn(bn(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),o=!((i=n).sceneGeometry===(a=this.lastConsumed).sceneGeometry&&i.layout===a.layout&&i.domain===a.domain);var i,a;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:o,warnUnconsumed:!t&&o&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(vn){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}};function $n(e){return mn(new wn(e))}function Mn(e,t,n,r=!1,o=!1){const i=e.beforeCompute(t.getLastUpdateResult(),r);n(),e.afterCompute(i,!0,o)}var An=yn(function({store:e,diagnostics:t}){return pn(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null});function Sn(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}import{jsx as Wn}from"react/jsx-runtime";function Cn(e){const{legend:t,totalWidth:n,totalHeight:r,margin:o,legendPosition:i="right",legendLayout:a,title:s,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:d,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,y=!!s,p=Math.max(0,n-o.left-o.right),m=Math.max(1,f?a?.maxWidth??p:100);let g,b;return"left"===i?(g=Math.max(4,o.left-m-10),b=o.top):"top"===i?(g=o.left,b=y?32:8):"bottom"===i?(g=o.left,b=r-o.bottom+38):(g=n-o.right+10,b=o.top),Wn("g",{transform:`translate(${g}, ${b})`,children:(x=t,"object"==typeof x&&null!==x&&"gradient"in x?Wn(Tt,{config:t.gradient,orientation:f?"horizontal":"vertical",width:m}):Sn(t)?Wn(Dt,{legendGroups:t.legendGroups,title:"",width:m,orientation:f?"horizontal":"vertical",legendLayout:a,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:d,legendInteraction:h}):t)});var x}import{jsx as jn}from"react/jsx-runtime";var In={secondary:0,primary:3},On=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function Nn(e){return!0===e?._annotationDeferred}function Rn(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function Ln(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Pn(e){return Math.max(.72,.95-.06*e)}import*as zn from"react";import{jsx as Fn,jsxs as Tn}from"react/jsx-runtime";function Dn(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),o=e.split(/\s+/),i=[];let a="";for(const e of o)a&&a.length+1+e.length>r?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function En(e,t,n,r){return"curly"===e?r?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:r?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Bn(e,t,n,r){if(!e)return Fn("g",{className:"annotation-note"});const{label:o,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=e;if(!o&&!i)return Fn("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let d=s;d&&"dynamic"!==d||(d="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===u?"right"===d?h="end":"middle"===d&&(h="middle"):h=0>t?"end":"start";const f=16,y=i?c?[i]:Dn(i,l):[],p=o?c?[o]:Dn(o,l):[],m="leftRight"===u?"end"===h?-4:4:0;let g=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push(Fn("foreignObject",{className:"annotation-note-html",x:"end"===h?m-l:"middle"===h?m-l/2:m,y:-16,width:l,height:Math.max(f,(y.length+p.length)*f+(i&&o?2:0))+f,style:{overflow:"visible"},children:Tn("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:x,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&Fn("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&Fn("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(y.length>0&&(b.push(Fn("text",{className:"annotation-note-title",fill:x,textAnchor:h,fontWeight:"bold",children:y.map((e,t)=>Fn("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=y.length*f),p.length>0&&b.push(Fn("text",{className:"annotation-note-label",fill:x,textAnchor:h,y:g,children:p.map((e,t)=>Fn("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let v=null;if((i||o)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),v=Fn("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+p.length)*f+(p.length>0?f:0);let t=0,n=e;"bottom"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),v=Fn("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,y.length+p.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===d?-(k+f+(p.length>0&&y.length>0?2:0))/2+8:"bottom"===d||0>n?-(k+2):18),Tn("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[Fn("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),v]})}function Hn(e,t,n,r,o){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push(Fn("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&i.push(Fn("rect",{width:e,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,a=o||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push(Fn("line",{x1:r,y1:(t.y1||0)-a,x2:r,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-a;i.push(Fn("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push(Fn("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push(Fn("line",{x1:0,y1:(t.y1||0)-a,x2:0,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&i.push(Fn("path",{d:En(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return Fn("g",{className:"annotation-subject",children:i})}function qn(e,t,n,r,o,i){const a=[];let s=0,l=0;if("callout-circle"!==o&&"label"!==o||!i?.radius){if("callout-rect"===o&&i){const n=i.width||0,r=i.height||0;if(n>0||r>0){const o=n/2,i=r/2,a=e-o,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),u=n/2,d=r/2,h=e*d>t*u?u/e:d/t;s=o+a*h,l=i+c*h}}}else if("bracket"===o&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(s=e/2,l=n):void 0!==t&&(s=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);s=Math.cos(r)*n,l=Math.sin(r)*n}}const c=Math.sqrt((e-s)**2+(t-l)**2);if(c>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-s);if(i){const r=(s+e)/2,i=(l+t)/2,d=-(t-l)/c,h=(e-s)/c,f=(n?.curve??.25)*c,y=r+d*f,p=i+h*f;a.push(Fn("path",{className:"connector-curve",d:`M${s},${l}Q${y},${p} ${e},${t}`,fill:"none",stroke:o},"connector-line")),u=Math.atan2(p-l,y-s)}else a.push(Fn("line",{x1:s,y1:l,x2:e,y2:t,stroke:o},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;a.push(Fn("path",{d:`M${s},${l}L${s+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${s+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return Fn("g",{className:"annotation-connector",children:a})}function Gn(e){const{x:t=0,y:n=0,dx:r,dy:o,nx:i,ny:a,note:s,connector:l,subject:c,type:u,color:d,className:h,disable:f,opacity:y,strokeDasharray:p,events:m={},"data-testid":g}=e,b=Array.isArray(t)?t[0]??0:t,x=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=r||0,w=o||0;null!=i&&(k=i-b),null!=a&&(w=a-x);const $="string"==typeof u?u:"label";if("bracket"===$&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return Tn("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${x})`,"data-testid":g,...null!=y&&{opacity:y},...p&&{strokeDasharray:p},...m,children:[!v.has("connector")&&qn(k,w,l,d,$,c),!v.has("subject")&&Hn($,c,d,b,x),!v.has("note")&&Bn(s,k,w,d)]})}function Vn(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",o=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),o=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const a=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:o});return Fn(Gn,{"data-testid":"semiotic-annotation",...a,type:r},"multi-annotation-"+i)});return Fn("g",{children:i})}const i=t.note||{title:"none",label:t.label},a=`${i.label}-${i.title}-${t.i}`;return Fn(Gn,{"data-testid":"semiotic-annotation",events:o,...t,type:r},a)}import{packEnclose as _n}from"d3-hierarchy";import{area as Un,curveLinear as Yn,curveMonotoneX as Zn,curveMonotoneY as Xn,curveStep as Kn,curveStepAfter as Jn,curveStepBefore as Qn,curveBasis as er,curveCardinal as tr,curveCatmullRom as nr}from"d3-shape";function rr(e){return Math.round(100*e)/100}function or(e,t=2){const n=[],r=[],o=t+1;for(let t=0;o>t;t++){let i=0;for(const[n,r]of e)null!==r&&(i+=n**t*r);n.push(i);const a=[];for(let n=0;o>n;n++){let r=0;for(const[o,i]of e)null!==i&&(r+=o**(t+n));a.push(r)}r.push(a)}r.push(n);const i=function(e,t){const n=e,r=e.length-1,o=[t];for(let e=0;r>e;e++){let t=e;for(let o=e+1;r>o;o++)Math.abs(n[e][o])>Math.abs(n[e][t])&&(t=o);for(let o=e;r+1>o;o++){const r=n[o][e];n[o][e]=n[o][t],n[o][t]=r}for(let t=e+1;r>t;t++)for(let o=r;o>=e;o--)n[o][t]-=n[o][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let i=e+1;r>i;i++)t+=n[i][e]*o[i];o[e]=(n[r][e]-t)/n[e][e]}return o}(r,o).map(rr);return{points:e.map(([e])=>[rr(e),rr(i.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...i].reverse()}}function ir(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function ar(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function sr(e){return null==e?null:e+""}function lr(e,t,n){return t.stickyPositionCache?.set(e,n),n}function cr(e,t,n){const r=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===r){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let r=n.pointNodes.length-1;r>=0;r--){const o=n.pointNodes[r];if(o.pointId===e.pointId)return lr(t,n,{x:o.x,y:o.y})}const r=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],r=e.scales?.x??e.scales?.time,o=e.scales?.y??e.scales?.value;if(!r||!o)return null;const i=n[e.xAccessor||"x"],a=n[e.yAccessor||"y"];return null==i||null==a?null:{x:r(i),y:o(a)}}(n);return r?lr(t,n,r):null}if("semantic"===r){const r=function(e,t,n){const r=function(e){return sr(e.provenance?.stableId??e.stableId)}(e);if(!r)return null;const o=n.pointNodes?.find(e=>sr(e.pointId)===r);if(o)return lr(t,n,{x:o.x,y:o.y});const i=n.data?.find(e=>function(e){return sr(e.stableId??e.id??e.provenance?.stableId)}(e)===r);if(!i)return null;const a=ir(i,n),s=ar(i,n);return null==a||null==s?null:lr(t,n,{x:a,y:s})}(e,t,n);if(r)return r}let o=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(o=t.x,i=t.y)}if(null!=o&&null!=i||(o=ir(e,n),i=ar(e,n)),null!=o&&null!=i)return lr(t,n,{x:o,y:i});if("sticky"===r){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function ur(e,t,n,r=50){return!(-r>e||e>(n.width||0)+r||-r>t||t>(n.height||0)+r)}import{jsx as dr,jsxs as hr}from"react/jsx-runtime";var fr={linear:Yn,monotoneX:Zn,monotoneY:Xn,step:Kn,stepAfter:Jn,stepBefore:Qn,basis:er,cardinal:tr,catmullRom:nr};function yr(e,t,n,r){const o=[];return e.forEach((e,i)=>{let a;if(n){const o=n(e,i,r);a=null!=o?o:t(e,i,r)}else a=t(e,i,r);a&&o.push({node:a,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:Ln(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>Nn(e.annotation)),o=e.some(e=>null!=Rn(e.annotation)),i=e.some(e=>"layer"===Rn(e.annotation));if(!n&&!r&&!o)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of t)e.emphasis&&(e.rank=In[e.emphasis]);const s=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:o}=e,i=Nn(t.annotation);let a=t.node;if("primary"===r||"secondary"===r||null!=o){const e=null==r&&null!=o;a=jn("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Pn(o),"data-annotation-reading-order":o}:{},children:t.node},"annotation-emphasis-"+n)}const s=Rn(t.annotation);return s&&(a=jn("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+n)),i&&(a=jn("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return r&&s.unshift(jn("style",{children:On},"annotation-disclosure-style")),i&&s.unshift(jn("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),s}(o)}function pr(t,n={}){return function(t,r,o){switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const e=cr(t,r,o);if(!e)return null;const{x:n,y:i}=e;if(!ur(n,i,o))return null;const a="callout"===t.type?"callout-circle":t.type,s="callout-circle"===a?{radius:t.radius??12,radiusPadding:t.radiusPadding}:"callout-rect"===a?{width:t.width,height:t.height}:void 0;return dr(Vn,{noteData:{x:n,y:i,dx:t.dx??30,dy:t.dy??-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:a,...s?{subject:s}:{},connector:t.connector||{end:"arrow"},color:t.color,disable:t.disable,opacity:t.opacity,strokeDasharray:t.strokeDasharray,className:t.className}},"ann-"+r)}case"x-threshold":{const e=ir(null!=t.value?{...t,x:t.value}:t,o);if(null==e)return null;const n=t.color||"#f97316",i=t.labelPosition||"top";let a;a="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const s=e>.6*(o.width||0),l=s?e-4:e+4,c=s?"end":"start";return hr("g",{opacity:t.opacity,children:[dr("line",{x1:e,y1:0,x2:e,y2:o.height||0,stroke:n,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&dr(T,{x:l,y:a,text:t.label,textAnchor:c,fill:n,fontSize:12,fontWeight:"bold",background:t.labelBackground??"halo"})]},"ann-"+r)}case"y-threshold":{const e=ar(null!=t.value?{...t,y:t.value}:t,o);if(null==e)return null;const n=t.color||"#f97316",i=t.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end");const c=20>(s=e)?Math.min((o.height||0)-4,s+16):s-4;return hr("g",{opacity:t.opacity,children:[dr("line",{x1:0,y1:e,x2:o.width||0,y2:e,stroke:n,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&dr(T,{x:a,y:c,text:t.label,textAnchor:l,fill:n,fontSize:12,fontWeight:"bold",background:t.labelBackground??"halo"})]},"ann-"+r)}case"enclose":{const e=(t.coordinates||[]).map(e=>({x:ir({...e,type:"point"},o),y:ar({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>e.length)return null;const n=_n(e),i=t.padding||10;return hr("g",{children:[dr("circle",{cx:n.x,cy:n.y,r:n.r+i,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&dr(T,{x:n.x,y:n.y-n.r-i-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:t.label,background:t.labelBackground??"none"})]},"ann-"+r)}case"rect-enclose":{const n=(t.coordinates||[]).map(e=>({x:ir({...e,type:"point"},o),y:ar({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>n.length)return null;const i=t.padding||10,a=n.map(e=>e.x),s=n.map(e=>e.y),[l,c]=e(a),[u,d]=e(s),h=l-i,f=c+i,y=u-i;return hr("g",{children:[dr("rect",{x:h,y:y,width:f-h,height:d+i-y,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&dr(T,{x:(h+f)/2,y:y-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:t.label,background:t.labelBackground??"none"})]},"ann-"+r)}case"highlight":{const e=o.data||[],n="function"==typeof t.filter?e.filter(t.filter):t.field&&null!=t.value?e.filter(e=>e[t.field]===t.value):[],i={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return dr("g",{children:n.map((e,n)=>{const r=ir(e,o),a=ar(e,o);if(null==r||null==a)return null;const s="function"==typeof t.r?t.r(e):t.r||6,l="function"==typeof t.style?t.style(e):t.style||i;return dr("circle",{cx:r,cy:a,r:s,...l},"hl-"+n)})},"ann-"+r)}case"bracket":{const e=ir(t,o),n=ar(t,o);return dr(Vn,{noteData:{x:e??0,y:n??0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+r)}case"trend":{const e=o.data||[];if(2>e.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",a="ordinal"===o.frameType,s="horizontal"===o.projection,l=a?n:null,c=a?i:null;let u;const d=[],h=new Map;if(a&&l&&c){for(const t of e){const e=t[l];if(null==e)continue;const n=e+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=e.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else u=e.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=o.scales?.x??o.scales?.time,y=o.scales?.y??o.scales?.value;if(!f||!y)return null;const p=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(d.length-1,n+1),o=t-n,i=e(d[n]);return i+(e(d[r])-i)*o},m=f,g=y;let b;if(a)if(s){const e=p(g);b=(t,n)=>[m(n),e(t)]}else{const e=p(m);b=(t,n)=>[e(t),g(n)]}else b=(e,t)=>[m(e),g(t)];const x=t.method||"linear";let v;if("loess"===x)v=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),o=r.map(e=>e[0]),i=r.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),s=[];for(let e=0;n>e;e++){const t=o[e],r=o.map(e=>Math.abs(e-t)),l=r.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:r[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,y=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*o[e],h+=t*i[e],f+=t*o[e]*o[e],y+=t*o[e]*i[e])}if(0===u){s.push([t,i[e]]);continue}const p=u*f-d*d;if(1e-12>Math.abs(p))s.push([t,h/u]);else{const e=(u*y-d*h)/p;s.push([t,(h-e*d)/u+e*t])}}return s}(u,t.bandwidth??.3);else{const e="polynomial"===x?or(u,t.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,o]of e)null!==o&&(n++,t[0]+=r,t[1]+=o,t[2]+=r*r,t[3]+=r*o);const r=n*t[2]-t[0]*t[0],o=0===r?0:rr((n*t[3]-t[0]*t[1])/r),i=rr(t[1]/n-o*t[0]/n);return{points:e.map(([e])=>[rr(e),rr(o*e+i)]),equation:[o,i]}}(u);v=e.points}const k=v.map(([e,t])=>{const[n,r]=b(e,t);return`${n},${r}`}).join(" "),w=t.color||"#6366f1",$=v[v.length-1],[M,A]=b($[0],$[1]);return hr("g",{children:[dr("polyline",{points:k,fill:"none",stroke:w,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&dr("text",{x:M+4,y:A-4,fill:w,fontSize:11,children:t.label})]},"ann-"+r)}case"band":{const e=o.scales?.y??o.scales?.value,n=e?.(t.y0)??0,s=e?.(t.y1)??(o.height||0),l=S(t.fill,"ann-"+r,"var(--semiotic-primary, #6366f1)");return hr("g",{opacity:t.opacity,children:[l.def&&dr("defs",{children:l.def}),dr("rect",{x:0,y:Math.min(n,s),width:o.width||0,height:Math.abs(s-n),fill:l.fill,fillOpacity:t.fillOpacity||.1}),t.label&&dr(T,{x:(o.width||0)-4,y:(i=n,a=s,Math.max(Math.min(i,a),0)+16),textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:t.label,background:t.labelBackground??"halo"})]},"ann-"+r)}case"x-band":{const e=o.scales?.x??o.scales?.time,n=null!=t.x0&&e?e(t.x0):null,i=null!=t.x1&&e?e(t.x1):null;if(null==n||null==i)return null;const a=S(t.fill||t.color,"ann-"+r,"var(--semiotic-primary, #6366f1)");return hr("g",{opacity:t.opacity,children:[a.def&&dr("defs",{children:a.def}),dr("rect",{x:Math.min(n,i),y:0,width:Math.abs(i-n),height:o.height||0,fill:a.fill,fillOpacity:t.fillOpacity??.1}),t.label&&dr(T,{x:Math.min(n,i)+4,y:16,textAnchor:"start",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:t.label,background:t.labelBackground??"halo"})]},"ann-"+r)}case"envelope":{const e=o.data||[];if(2>e.length)return null;const n=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const s=t.upperAccessor||"upperBounds",l=t.lowerAccessor||"lowerBounds",c=t.filter,u=e.filter(e=>null!=e[s]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[n]-t[n]);if(2>u.length)return null;const d=fr[o.curve||"linear"]||Yn,h=Un().x(e=>i(e[n])).y0(e=>a(e[l])).y1(e=>a(e[s])).curve(d)(u);if(!h)return null;const f=t.fill||"#6366f1";return hr("g",{children:[dr("path",{d:h,fill:f,fillOpacity:t.fillOpacity??.15,stroke:"none"}),t.label&&u.length>0&&dr("text",{x:i(u[u.length-1][n])+4,y:a(u[u.length-1][s])-4,fill:f,fontSize:11,children:t.label})]},"ann-"+r)}case"anomaly-band":{const e=o.data||[];if(2>e.length)return null;const n=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const s=e.map(e=>e[n]).filter(e=>null!=e&&isFinite(e));if(2>s.length)return null;const l=s.reduce((e,t)=>e+t,0)/s.length,c=s.reduce((e,t)=>e+(t-l)**2,0)/s.length,u=Math.sqrt(c),d=t.threshold??2,h=l-d*u,f=!1!==t.showBand,y=t.fill||"#6366f1",p=t.fillOpacity??.1,m=t.anomalyColor||"#ef4444",g=t.anomalyRadius??6,b=a(l+d*u),x=a(h),v=e.filter(e=>{const t=e[n];return null!=t&&Math.abs(t-l)>d*u});return hr("g",{children:[f&&dr("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:y,fillOpacity:p}),v.map((e,t)=>{const n=ir(e,o),r=ar(e,o);return null==n||null==r?null:dr("circle",{cx:n,cy:r,r:g,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+t)}),t.label&&dr("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:y,fontSize:11,children:t.label})]},"ann-"+r)}case"forecast":{const e=o.data||[];if(3>e.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",a=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!a||!s)return null;const l=e.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(t.method||"linear")){const e=or(l,t.order||2).equation;c=t=>e.reduce((e,n,r)=>e+n*Math.pow(t,r),0)}else{const e=l.length;let t=0,n=0,r=0,o=0;for(const[e,i]of l)t+=e,n+=i,r+=e*e,o+=e*i;const i=e*r-t*t;if(1e-12>Math.abs(i))return null;const a=(e*o-t*n)/i,s=(n-a*t)/e;c=e=>s+a*e}const u=l.length,d=l.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),y=l.reduce((e,t)=>e+t[0],0)/u,p=l.reduce((e,t)=>e+(t[0]-y)**2,0),m=t.confidence??.95,g=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=t.steps??5,x=l[u-1][0],v=(x-l[0][0])/Math.max(u-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*v);const w=[];for(const e of k){const t=c(e),n=f*Math.sqrt(1+1/u+(p>0?(e-y)**2/p:0))*g;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const $=`M${w.map(e=>`${a(e.x)},${s(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${s(e.yLower)}`).join(" L")} Z`,M=w.map(e=>`${a(e.x)},${s(e.yCenter)}`).join(" "),A=`${a(x)},${s(c(x))}`,S=t.strokeColor||"#6366f1";return hr("g",{children:[dr("path",{d:$,fill:t.fill||"#6366f1",fillOpacity:t.fillOpacity??.15,stroke:"none"}),dr("polyline",{points:`${A} ${M}`,fill:"none",stroke:S,strokeWidth:t.strokeWidth??2,strokeDasharray:t.strokeDasharray??"6,3"}),t.label&&w.length>0&&dr("text",{x:a(w[w.length-1].x)+4,y:s(w[w.length-1].yCenter)-4,fill:S,fontSize:11,children:t.label})]},"ann-"+r)}case"widget":{let e,i;if(null!=t.px&&null!=t.py)e=t.px,i=t.py;else{const n=cr(t,r,o);if(!n)return null;e=n.x,i=n.y}if(!ur(e,i,o))return null;const a=t.dx??0,s=t.dy??0,l=t.width??32,c=t.height??32,u=t.content??dr("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return dr("foreignObject",{x:e+a-l/2,y:i+s-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:dr("div",{...N(t,n),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+r)}case"text":{const e=cr(t,r,o);if(!e)return null;const{x:n,y:i}=e,a=n+(t.dx||0),s=i+(t.dy||0),l=t.color||"var(--semiotic-text, #333)",c=dr("text",{x:a,y:s,fill:l,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?zn.cloneElement(c,{key:"ann-text-"+r}):hr("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[dr("line",{x1:n,y1:i,x2:a,y2:s,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),zn.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+r)}case"category-highlight":{const e=t.category;if(null==e)return null;const n=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,a=o.scales?.x,s=o.scales?.y,l=n(i)?i:n(a)?a:n(s)?s:null;if(!l)return null;const c=l(e+"");if(null==c)return null;const u=l.bandwidth(),d=t.color||"var(--semiotic-primary, #4589ff)",h=t.opacity??.15,f=t.label;return hr("g",(o.projection?"vertical"===o.projection:l===a)?{children:[dr("rect",{x:c,y:0,width:u,height:o.height||0,fill:d,fillOpacity:h}),f&&dr(T,{x:c+u/2,y:16,textAnchor:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:t.labelBackground??"none"})]}:{children:[dr("rect",{x:0,y:c,width:o.width||0,height:u,fill:d,fillOpacity:h}),f&&dr(T,{x:12,y:c+u/2,dominantBaseline:"middle",fill:d,fontSize:12,fontWeight:"bold",text:f,background:t.labelBackground??"none"})]},"ann-"+r)}default:return null}var i,a,s}}var mr=new Set(["label","callout","callout-circle","callout-rect","text","widget"]),gr=new Set(["label","callout","callout-circle","callout-rect"]);function br(e){return"string"==typeof e?.type?e.type:""}function xr(e){return!!e&&"object"==typeof e&&mr.has(br(e))}function vr(e){return gr.has(br(e))&&!function(e){return Array.isArray(e?.disable)&&e.disable.includes("connector")}(e)}function kr(e){return"primary"===e?.emphasis||!0===e?.defensive}function wr(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function $r(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const r=e?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(t+=15*Math.max(0,Math.min(1,r))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}var Mr=32,Ar=6,Sr=4,Wr=8,Cr=72;var jr={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Ir(e){if(!Or(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function Or(e){return xr(e)}function Nr(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),r=e.split(/\s+/).filter(Boolean),o=[];let i="";for(const e of r)i&&i.length+e.length+1>n?(o.push(i),i=e):i=i?`${i} ${e}`:e;return i&&o.push(i),o}function Rr(e,t,n,r,o){const i=e+n,a=t+r;return Math.abs(n)>Math.abs(r)?{x:0>n?i-o.width-4:i+4,y:0>r?a-o.height:a,width:o.width,height:o.height}:{x:0>n?i-o.width:i,y:0>r?a-o.height-4:a+4,width:o.width,height:o.height}}function Lr(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Pr(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function zr(e,t,n,r,o,i,a,s){const l=Lr(e,a);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,r){const o=Math.max(0,r-e.x),i=Math.max(0,r-e.y);return(o+Math.max(0,e.x+e.width-(t-r)))*e.height+(i+Math.max(0,e.y+e.height-(n-r)))*e.width}(l,o,i,s);for(const e of n)c+=12*Pr(l,e);for(const e of r)c+=4*Pr(l,e);return c}function Fr(e){const{annotations:t,context:n,defaultOffset:r=Mr,notePadding:o=Ar,markPadding:i=Sr,edgePadding:a=Wr,preserveManualOffsets:s=!0,routeLongConnectors:l=!0,connectorThreshold:c=Cr,density:u,progressiveDisclosure:d=!1,redundantCues:h=!1,responsive:f,mobile:y,cohesion:p,audience:m}=e,g=n.width||0,b=n.height||0,x="object"==typeof y?y:{},v=x.breakpoint??480,k=!!y&&v>=g,w=k&&!1!==x.preferShortText?t.map(Ir):t,$=k&&!u?{maxAnnotations:x.maxAnnotations??("callout-list"===x.strategy?1:2),minVisible:x.minVisible??1}:u,M=d||k&&(!1!==x.progressiveDisclosure||"callout-list"===x.strategy),A=k&&!f?x.responsive??{minWidth:v}:f,S=k&&!p?x.cohesion:p;if(0===w.length||0>=g||0>=b)return w.slice();const W=[],C=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let j=!1;const I=w.map((e,t)=>{if(!Or(e))return e;const i=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const r=e.pointId??e.nodeId;if(null!=r&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===r);if(e)return{x:e.x,y:e.y}}const o=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(o)&&o.length>=2&&i){const e=o[0],t=o[1];if("number"==typeof e&&"number"==typeof t){const n=i([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?cr(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...Nr("string"==typeof e.title?e.title:void 0,t),...Nr("string"==typeof e.label?e.label:void 0,t)],r=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*r)+10),height:Math.max(18,16*n.length+6)}}(e);if(s&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return W.push(Lr(Rr(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),o)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(r)){const t=zr(Rr(i.x,i.y,e.dx,e.dy,u),e,W,C,g,b,o,a);f>t&&(h=e,f=t)}if(!h)return e;const y=Lr(Rr(i.x,i.y,h.dx,h.dy,u),o);W.push(y);const p=Math.hypot(h.dx,h.dy),m=l&&p>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return j=!0,{...e,dx:h.dx,dy:h.dy,...m?{connector:m}:{}}}),O=j?I:w.slice();let N=O;if(h){let e=!1;const t=O.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});N=e?t:O}{let e=!1;const t=N.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?jr[t.source]??t.source:null,r="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!r)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const o=[n,r].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${o})`)?e:{...e,label:i?`${i} (${o})`:`(${o})`}}(t);return n!==t&&(e=!0),n});N=e?t:N}const R=new Set;if($){const e="object"==typeof $?$:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(m),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??wr(g,b,e))*t))},{deferred:r}=function(e){const{annotations:t,width:n,height:r}=e,o=Math.max(0,e.minVisible??1),i=wr(n,r,e),a=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,xr(n))};var n}),s=a.filter(e=>e.note);if(0===s.length||i>=s.length)return{visible:t.slice(),deferred:[],budget:i};const l=s.filter(e=>kr(e.annotation)),c=s.filter(e=>!kr(e.annotation)).sort((e,t)=>$r(t.annotation)-$r(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,o-l.length))),d=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),h=[],f=[];for(const{annotation:e,index:t,note:n}of a)!n||d.has(t)?h.push(e):f.push(e);return{visible:h,deferred:f,budget:i}}({annotations:N,width:g,height:b,...n});for(const e of r)R.add(e)}if(A&&("object"==typeof A&&"number"==typeof A.minWidth?A.minWidth:480)>=g)for(const e of N)Or(e)&&"secondary"===e.emphasis&&R.add(e);if(R.size>0)for(const e of N)!0===e?.defensive&&R.delete(e);let L;return L=0===R.size?N:M?N.map(e=>R.has(e)?{...e,_annotationDeferred:!0}:e):N.filter(e=>!R.has(e)),S?function(e,t){let n=!1;const r=e.map(e=>Or(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?r:e}(L,S):L}import*as Tr from"react";import{arc as Dr}from"d3-shape";import{symbol as Er,symbolCircle as Br,symbolCross as Hr,symbolDiamond as qr,symbolSquare as Gr,symbolStar as Vr,symbolTriangle as _r,symbolWye as Ur}from"d3-shape";var Yr={circle:Br,square:Gr,triangle:_r,diamond:qr,star:Vr,cross:Hr,wye:Ur},Zr=["circle","triangle","diamond","star","square","chevron","cross","wye"];function Xr(e,t,n){if(n)return n;const r=e??"circle";return"chevron"===r?function(e){const t=1.5*Kr(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t):Er(Yr[r]??Br,Math.max(1,t))()??""}function Kr(e){return Math.sqrt(Math.max(1,e)/Math.PI)}function Jr(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function Qr(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,r=e=>Math.max(0,Math.min(e??0,n));return{tl:r(t.tl),tr:r(t.tr),br:r(t.br),bl:r(t.bl)}}var eo=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function to(e){const{innerRadius:t,outerRadius:n,startAngle:r,endAngle:o}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=eo(n,r),t=eo(n,o);return`M0,0 L${e.x},${e.y} A${n},${n} 0 ${o-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=eo(n,r),a=eo(n,o),s=eo(t,o),l=eo(t,r),c=o-r>Math.PI?1:0;return`M${e.x},${e.y} A${n},${n} 0 ${c} 1 ${a.x},${a.y} L${s.x},${s.y} A${t},${t} 0 ${c} 0 ${l.x},${l.y} Z`}const a=Math.max(0,Math.min(e.cornerRadius??0,(n-t)/2));if(0===a)return to({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const s=Math.asin(Math.min(1,a/Math.max(1e-9,n-a))),l=i?0:Math.asin(Math.min(1,a/Math.max(1e-9,t+a))),c=o-r,u=e.roundStart&&e.roundEnd?c/2:c,d=!!e.roundStart&&u>s,h=!!e.roundEnd&&u>s;if(!d&&!h)return to({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=r+(d?s:0),y=o-(h?s:0),p=r+(d?l:0),m=o-(h?l:0),g=eo(n,f),b=eo(n,y),x=(n-a)*Math.cos(s),v=eo(x,r),k=eo(x,o),w=i?null:eo(t,m),$=i?null:eo(t,p),M=i?0:(t+a)*Math.cos(l),A=i?null:eo(M,r),S=i?null:eo(M,o),W=y-f>Math.PI?1:0,C=i?0:m-p>Math.PI?1:0;let j="";if(d)j+=`M${v.x},${v.y}`,j+=` A${a},${a} 0 0 1 ${g.x},${g.y}`;else{const e=eo(n,r);j+=`M${e.x},${e.y}`}if(h)j+=` A${n},${n} 0 ${W} 1 ${b.x},${b.y}`,j+=` A${a},${a} 0 0 1 ${k.x},${k.y}`;else{const e=eo(n,o);j+=` A${n},${n} 0 ${W} 1 ${e.x},${e.y}`}if(i)j+=" L0,0";else{if(h)j+=` L${S.x},${S.y}`,j+=` A${a},${a} 0 0 1 ${w.x},${w.y}`;else{const e=eo(t,o);j+=` L${e.x},${e.y}`}if(d)j+=` A${t},${t} 0 ${C} 0 ${$.x},${$.y}`,j+=` A${a},${a} 0 0 1 ${A.x},${A.y}`;else{const e=eo(t,r);j+=` A${t},${t} 0 ${C} 0 ${e.x},${e.y}`}}return j+=" Z",j}function no(e){const t=to({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],r=e.colors;if(r.length>0){const t=(e.endAngle-e.startAngle)/r.length;for(let o=0;r.length>o;o++)n.push({d:to({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+o*t,endAngle:e.endAngle}),color:r[o]})}return{clipPath:t,slices:n}}import{jsx as ro,jsxs as oo}from"react/jsx-runtime";var io={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function ao(e,t="#4e79a7"){return k(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function so(e,t,n){const r=Xr(e.symbolType,e.size,e.path);return ro("path",{d:r,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?ao(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${n??""}symbol-${t}`)}function lo(e,t,n,r){const s=e.glyph;if(!s?.parts?.length||0>=e.size)return null;const l=i(s,e.size);if(0>=l.scale)return null;const c=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${l.offsetX},${l.offsetY}) scale(${l.scale})`,u=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),d=o(s,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),h=d?co(r+"-clip"):void 0,f=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),y=t=>s.parts.map((n,r)=>{const o=t?"none"===n.fill?void 0:t:a(n.fill,u,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:a(n.stroke??"none",u,e.accent);return o||i?ro("path",{d:n.d,fill:o??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});return oo("g",{transform:c,opacity:1===f?void 0:f,children:[d&&h&&ro("clipPath",{id:h,children:ro("rect",{x:d.x,y:d.y,width:d.width,height:d.height})}),d&&e.ghostColor?ro("g",{children:y(e.ghostColor)}):null,d&&h?ro("g",{clipPath:`url(#${h})`,children:y()}):y()]},r)}function co(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}function uo(e,t,n){switch(e.type){case"line":{const n=e;if(0===n.path.length)return null;const r="M"+n.path.map(([e,t])=>`${e},${t}`).join("L");return ro("path",{d:r,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||2,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity},"line-"+t)}case"area":{const r=e;if(0===r.topPath.length)return null;const o=`M${r.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...r.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`,i=`${n?n+"-":""}area-${t}-hatch`,a=k(r.style.fill)?A(r.style.fill,i):void 0,s=a?`url(#${i})`:ao(r.style.fill);if(r.clipRect){const e=`${n?n+"-":""}area-clip-${t}`;return oo("g",{children:[oo("defs",{children:[a,ro("clipPath",{id:e,children:ro("rect",{x:r.clipRect.x,y:r.clipRect.y,width:r.clipRect.width,height:r.clipRect.height})})]}),ro("path",{d:o,fill:s,fillOpacity:r.style.fillOpacity??r.style.opacity??.7,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,clipPath:`url(#${e})`})]},"area-"+t)}return oo(Tr.Fragment,{children:[a&&ro("defs",{children:a}),ro("path",{d:o,fill:s,fillOpacity:r.style.fillOpacity??r.style.opacity??.7,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"area-"+t)}case"point":{const r=e,o=`${n?n+"-":""}point-${t}-hatch`,i=k(r.style.fill)?A(r.style.fill,o):void 0;return oo(Tr.Fragment,{children:[i&&ro("defs",{children:i}),ro("circle",{cx:r.x,cy:r.y,r:r.r,fill:i?`url(#${o})`:ao(r.style.fill),opacity:r.style.opacity??.8,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"point-"+t)}case"symbol":return so(e,t);case"glyph":return lo(e,e.x,e.y,`${n??""}glyph-${e.pointId??t}`);case"rect":{const r=e,o=`${n?n+"-":""}xyrect-${t}-hatch`,i=k(r.style.fill)?A(r.style.fill,o):void 0;return oo(Tr.Fragment,{children:[i&&ro("defs",{children:i}),ro("rect",{x:r.x,y:r.y,width:r.w,height:r.h,fill:i?`url(#${o})`:ao(r.style.fill),opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const n=e;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const e=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[r,o,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),a=.299*r+.587*o+.114*i>128?"#000":"#fff",s=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return oo("g",{children:[ro("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill}),ro("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:s+"px",children:e})]},"heatcell-"+t)}return ro("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill},"heatcell-"+t)}case"candlestick":{const n=e,r=Math.min(n.openY,n.closeY),o=Math.max(Math.abs(n.openY-n.closeY),1),i=n.isUp?n.upColor:n.downColor;return oo("g",{children:[ro("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),ro("rect",{x:n.x-n.bodyWidth/2,y:r,width:n.bodyWidth,height:o,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}function ho(e,t){switch(e.type){case"circle":{const n=e,r=k(n.style.fill)?A(n.style.fill,`net-circle-${t}-hatch`):void 0;return oo(Tr.Fragment,{children:[r&&ro("defs",{children:r}),ro("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:r?`url(#net-circle-${t}-hatch)`:ao(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-circle-"+t)}case"rect":{const n=e,r=k(n.style.fill)?A(n.style.fill,`net-rect-${t}-hatch`):void 0;return oo(Tr.Fragment,{children:[r&&ro("defs",{children:r}),ro("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r?`url(#net-rect-${t}-hatch)`:ao(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-rect-"+t)}case"arc":{const n=e,r=Dr().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(io)||"",o=k(n.style.fill)?A(n.style.fill,`net-arc-${t}-hatch`):void 0;return oo(Tr.Fragment,{children:[o&&ro("defs",{children:o}),ro("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:o?`url(#net-arc-${t}-hatch)`:ao(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-arc-"+t)}case"symbol":{const n=e,r=Xr(n.symbolType,n.size,n.path);return ro("path",{d:r,transform:n.rotation?`translate(${n.cx},${n.cy}) rotate(${180*n.rotation/Math.PI})`:`translate(${n.cx},${n.cy})`,fill:n.style.fill?ao(n.style.fill):"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-symbol-"+t)}case"glyph":return lo(e,e.cx,e.cy,"net-glyph-"+(e.id??t));default:return null}}function fo(e,t){switch(e.type){case"line":return ro("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+t);case"bezier":{const n=e;return ro("path",{d:n.pathD,fill:ao(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"ribbon":{const n=e;return ro("path",{d:n.pathD,fill:ao(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"curved":{const n=e;return ro("path",{d:n.pathD,fill:ao(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+t)}default:return null}}function yo(e,t){return ro("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}function po(e,t,n){const r=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",o=n=>`ord-${e.type}-${r}-${t}-${n}`,i=`ord-${e.type}-${r}-${t}`;switch(e.type){case"rect":{const t=e,n=co(i)+"-grad",r=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let r=e.x,o=e.y,i=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(o=e.y+e.h,a=e.y):"right"===e.roundedEdge?(r=e.x+e.w,o=e.y,i=e.x,a=e.y):"left"===e.roundedEdge&&(r=e.x,o=e.y,i=e.x+e.w,a=e.y);const s=[];if("colorStops"in n){const e=n.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>e.length)return null;for(let t=0;e.length>t;t++)s.push(ro("stop",{offset:e[t].offset,stopColor:e[t].color},t))}else{const t=ao(e.style.fill);s.push(ro("stop",{offset:0,stopColor:t,stopOpacity:n.topOpacity},"0")),s.push(ro("stop",{offset:1,stopColor:t,stopOpacity:n.bottomOpacity},"1"))}return ro("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:r,y1:o,x2:i,y2:a,children:s})}(t,n);let o,a;if(r)a=`url(#${n})`;else if(k(t.style.fill)){const e=co(i)+"-hatch";o=A(t.style.fill,e),a=`url(#${e})`}else a=ao(t.style.fill);const s=r||o?oo("defs",{children:[r,o]}):null;if(t.cornerRadii&&Jr(t.cornerRadii)){const e=function(e){const{x:t,y:n,w:r,h:o}=e,{tl:i,tr:a,br:s,bl:l}=Qr(e);let c=`M${t+i},${n}`;return c+=` L${t+r-a},${n}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+r},${n+a}`),c+=` L${t+r},${n+o-s}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+r-s},${n+o}`),c+=` L${t+l},${n+o}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t},${n+o-l}`),c+=` L${t},${n+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${n}`),c+=" Z",c}(t);return oo(Tr.Fragment,{children:[s,ro("path",{d:e,fill:a,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:n,y:r,w:o,h:l}=t;let c;switch(t.roundedEdge){case"right":c=`M${n},${r} L${n+o-e},${r} A${e},${e} 0 0 1 ${n+o},${r+e} L${n+o},${r+l-e} A${e},${e} 0 0 1 ${n+o-e},${r+l} L${n},${r+l} Z`;break;case"left":c=`M${n+o},${r} L${n+e},${r} A${e},${e} 0 0 0 ${n},${r+e} L${n},${r+l-e} A${e},${e} 0 0 0 ${n+e},${r+l} L${n+o},${r+l} Z`;break;case"bottom":c=`M${n},${r} L${n+o},${r} L${n+o},${r+l-e} A${e},${e} 0 0 1 ${n+o-e},${r+l} L${n+e},${r+l} A${e},${e} 0 0 1 ${n},${r+l-e} Z`;break;default:c=`M${n},${r+l} L${n},${r+e} A${e},${e} 0 0 1 ${n+e},${r} L${n+o-e},${r} A${e},${e} 0 0 1 ${n+o},${r+e} L${n+o},${r+l} Z`}return oo(Tr.Fragment,{children:[s,ro("path",{d:c,fill:a,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}return oo(Tr.Fragment,{children:[s,ro("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:a,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},i)}case"point":{const t=e;return ro("circle",{cx:t.x,cy:t.y,r:t.r,fill:ao(t.style.fill),opacity:t.style.opacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}case"symbol":return so(e,t,n);case"glyph":return lo(e,e.x,e.y,`${n??""}ord-glyph-${e.pointId??t}`);case"wedge":{const r=e;if(r._gradientBand&&r._gradientBand.colors.length>0){const e=co(`${n?n+"-":""}gauge-grad-${r.category||i}-${t}`),{clipPath:o,slices:a}=no({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds?.start??!0,roundEnd:r.roundedEnds?.end??!0,colors:r._gradientBand.colors});return oo("g",{transform:`translate(${r.cx},${r.cy})`,opacity:r.style.opacity,fillOpacity:r.style.fillOpacity,children:[ro("defs",{children:ro("clipPath",{id:e,children:ro("path",{d:o})})}),ro("g",{clipPath:`url(#${e})`,children:a.map((e,t)=>ro("path",{d:e.d,fill:ao(e.color)},t))}),r.style.stroke&&"none"!==r.style.stroke&&ro("path",{d:o,fill:"none",stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},i)}let o;if(r.roundedEnds)o=to({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds.start,roundEnd:r.roundedEnds.end});else{const e=Dr().innerRadius(r.innerRadius).outerRadius(r.outerRadius).startAngle(r.startAngle+Math.PI/2).endAngle(r.endAngle+Math.PI/2);r.cornerRadius&&e.cornerRadius(r.cornerRadius),o=e(io)||""}return ro("path",{d:o,transform:`translate(${r.cx},${r.cy})`,fill:ao(r.style.fill),stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,opacity:r.style.opacity},i)}case"boxplot":{const t=e,n=t.columnWidth/2;return oo("g","vertical"===t.projection?{children:[ro("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),ro("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:ao(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),ro("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),ro("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),ro("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[ro("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),ro("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:ao(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),ro("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),ro("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),ro("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const t=e,n=[ro("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:ao(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},o("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,r=e.x+e.width/2,i=e.y+e.height/2;e.height>e.width?n.push(ro("line",{x1:r,y1:t.iqrLine.q1Pos,x2:r,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},o("iqr")),ro("circle",{cx:r,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},o("med"))):n.push(ro("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},o("iqr")),ro("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},o("med")))}return ro("g",{children:n},i)}case"connector":return ro("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},i);case"trapezoid":{const t=e,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return ro("polygon",{points:n,fill:ao(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},i)}default:return null}}function mo(e,t){switch(e.type){case"geoarea":{const n=e;if(!n.pathData)return null;const r=k(n.style.fill)?A(n.style.fill,`geoarea-${t}-hatch`):void 0;return oo(Tr.Fragment,{children:[r&&ro("defs",{children:r}),ro("path",{d:n.pathData,fill:r?`url(#geoarea-${t}-hatch)`:ao(n.style.fill,"#e0e0e0"),fillOpacity:n.style.fillOpacity??1,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth||.5,strokeDasharray:n.style.strokeDasharray,opacity:n._decayOpacity??1})]},"geoarea-"+t)}case"point":{const n=e,r=k(n.style.fill)?A(n.style.fill,`geopoint-${t}-hatch`):void 0;return oo(Tr.Fragment,{children:[r&&ro("defs",{children:r}),ro("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${t}-hatch)`:ao(n.style.fill),fillOpacity:n.style.fillOpacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n._decayOpacity??n.style.opacity??1})]},"point-"+t)}case"line":{const n=e;if(2>n.path.length)return null;const r="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return ro("path",{d:r,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity??1},"line-"+t)}case"glyph":return lo(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}var go="undefined"==typeof window||"undefined"==typeof document;import*as bo from"react";import{jsx as xo}from"react/jsx-runtime";var vo=bo.createContext(null);function ko({children:e}){const[t,n]=bo.useState(!1),r=bo.useCallback(()=>n(e=>!e),[]),o=bo.useMemo(()=>({visible:t,setVisible:n,toggle:r}),[t,r]);return xo(vo.Provider,{value:o,children:e})}function wo(){return bo.useContext(vo)}function $o(){const e=bo.useContext(vo);return e?e.toggle:null}import{jsx as Mo}from"react/jsx-runtime";var Ao={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function So({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return Mo("div",{"aria-live":"polite","aria-atomic":"true",style:Ao,children:t})}function Wo(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,r]of Object.entries(e))n.startsWith("_")||null!=r&&""!==r&&("number"==typeof r?Number.isFinite(r)&&(t[n]=r):"string"==typeof r?t[n]=r:"boolean"==typeof r?t[n]=r+"":r instanceof Date&&(t[n]=r.toISOString().slice(0,10)));return t}function Co(e){return e&&"object"==typeof e?e:{}}function jo(e){return Co(e.accessibility).tableFields??e.accessibleDatum??e.datum}function Io(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const r of e)if(r&&"object"==typeof r&&null!==r.datum)try{switch(r.type){case"point":if(n)break;t.push({label:"Point",values:Wo(jo(r))});break;case"line":case"area":{const e=jo(r),n=Array.isArray(e)?e:[],o="line"===r.type?"Line point":"Area point";for(const e of n)t.push({label:o,values:Wo(e)});break}case"rect":{const e=jo(r),n=null!=e&&"object"==typeof e?e:{},o=n.category??r.group??"",i=n.value??n.__aggregateValue??n.total,a=Wo(n);null==a.category&&""!==o&&(a.category=o+""),null==a.value&&null!=i&&(a.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:a});break}case"heatcell":{const e=Wo(jo(r));null==e.value&&"number"==typeof r.value&&Number.isFinite(r.value)&&(e.value=r.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=jo(r),n=Wo(e);if(null==n.category){const t=Co(e),r=t.category??t.label;null!=r&&(n.category=r+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:Wo(jo(r))});break;case"arc":t.push({label:"Arc",values:Wo(jo(r))});break;case"candlestick":t.push({label:"Candlestick",values:Wo(jo(r))});break;case"geoarea":{const e=Co(jo(r)),n=Wo(e);if(null==n.name){const t=Co(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}import*as Oo from"react";import{jsx as No,jsxs as Ro}from"react/jsx-runtime";function Lo(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const r=[],o={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),r=i.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of a)r.push(`${n[e]} ${o[e]||e}`);return`${t}, ${r.join(", ")}`}function Po(e,t,n){const r=[];return e>0&&r.push(e+" nodes"),t>0&&r.push(t+" edges"),0===r.length?n+", empty":`${n}, ${r.join(", ")}`}var zo=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Fo="semiotic-accessible-data-table",To=Fo+" semiotic-accessible-data-table-hidden",Do=Fo+" semiotic-accessible-data-table-visible",Eo=Do+" semiotic-accessible-data-table-network",Bo={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Ho={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},qo={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Go={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Vo={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},_o={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Uo={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Yo={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function Zo({scene:e,chartType:t,tableId:n,chartTitle:r}){const[o,i]=Oo.useState(!1),[a,s]=Oo.useState(5),l=wo(),c=l?.visible??!1,u=o||c,d=Oo.useRef(null),h=r?"Data summary for "+r:n?`Data summary for ${t} ${n}`:"Data summary for "+t;Oo.useEffect(()=>{u||s(5)},[u]);const f=Oo.useCallback(e=>{e.target===e.currentTarget&&(o||c||i(!0))},[o,c]),y=Oo.useCallback(e=>{c||d.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?No("span",{id:n,tabIndex:-1,style:Ao}):null;if(!u)return No("div",{id:n,className:To,tabIndex:-1,onFocus:f,style:Ao,role:"region","aria-label":h,children:Ro("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const p=Io(e),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const r of t){const t=[],o=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[r];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&o.add(e+""))}if(t.length>0){let e=t[0],o=t[0],i=0;for(const n of t)e>n&&(e=n),n>o&&(o=n),i+=n;n.push({name:r,count:t.length,numeric:!0,min:e,max:o,mean:i/t.length})}else if(o.size>0){const e=Array.from(o);n.push({name:r,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(p),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${zo(e.min)} to ${zo(e.max)}, mean ${zo(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${r}.`)}return n.join(" ")}(p.length,m),b=Math.min(a,p.length),x=p.slice(0,b),v=p.length-b,k=new Set;for(const e of x)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return Ro("div",{ref:d,id:n,className:Do,tabIndex:-1,onBlur:y,style:Bo,role:"region","aria-label":h,children:[No("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:qo,children:"×"}),No("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ho,children:g}),Ro("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:Go,children:[No("caption",{className:"semiotic-accessible-data-table-caption",style:Uo,children:v>0?`First ${b} of ${p.length} data points`:`All ${p.length} data points`}),No("thead",{children:Ro("tr",{children:[No("th",{style:Vo,children:"type"}),w.map(e=>No("th",{style:Vo,children:e},e))]})}),No("tbody",{children:x.map((e,t)=>Ro("tr",{children:[No("td",{style:_o,children:e.label}),w.map(t=>{return No("td",{style:_o,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":zo(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),v>0&&Ro("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:Yo,children:["Show ",Math.min(25,v)," more"," ",1===v?"row":"rows"," (",v," remaining)"]})]})}function Xo({nodes:e,edges:t,chartType:n,tableId:r,chartTitle:o}){const[i,a]=Oo.useState(!1),[s,l]=Oo.useState(5),c=wo(),u=c?.visible??!1,d=i||u,h=o?"Data summary for "+o:r?`Data summary for ${n} ${r}`:"Data summary for "+n,f=Oo.useRef(null);Oo.useEffect(()=>{d||l(5)},[d]);const y=Oo.useCallback(e=>{e.target===e.currentTarget&&(i||u||a(!0))},[i,u]),p=Oo.useCallback(e=>{u||f.current?.contains(e.relatedTarget)||a(!1)},[u]);if(!e||0===e.length)return r?No("span",{id:r,tabIndex:-1,style:Ao}):null;if(!d)return No("div",{id:r,className:To,tabIndex:-1,onFocus:y,style:Ao,role:"region","aria-label":h,children:Ro("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const m=Array.isArray(e)?e:[],g=Array.isArray(t)?t:[],b=new Map,x=new Map,v=new Map,k=new Map;for(const e of g){if(!e||"object"!=typeof e)continue;const t=e.datum??{source:e.source,target:e.target},n="object"==typeof t.source?t.source?.id:t.source,r="object"==typeof t.target?t.target?.id:t.target,o="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";x.set(e,(x.get(e)??0)+1),k.set(e,(k.get(e)??0)+o)}if(null!=r&&""!==r){const e=r+"";b.set(e,(b.get(e)??0)+1),v.set(e,(v.get(e)??0)+o)}}const w=[];for(let e=0;m.length>e;e++){const t=m[e];if(!t||"object"!=typeof t)continue;const n=t.datum?.id??t.id,r=null!=n?n+"":"node-"+e,o=b.get(r)??0,i=x.get(r)??0,a=v.get(r)??0,s=k.get(r)??0;w.push({id:r,degree:o+i,inDeg:o,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}w.sort((e,t)=>t.degree-e.degree);let $=0,M=0;if(w.length>0){let e=0;for(const t of w)e+=t.degree,t.degree>M&&(M=t.degree);$=e/w.length}const A=g.some(e=>{const t=e?.datum??{source:e?.source,target:e?.target};return"number"==typeof t?.value&&Number.isFinite(t.value)}),S=[`${w.length} nodes, ${g.length} edges.`];w.length>0&&S.push(`Mean degree: ${zo($)}, max degree: ${M}.`);const W=Math.min(s,w.length),C=w.slice(0,W),j=w.length-W;return Ro("div",{ref:f,id:r,className:Eo,tabIndex:-1,onBlur:p,style:Bo,role:"region","aria-label":h,children:[No("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:qo,children:"×"}),No("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ho,children:S.join(" ")}),Ro("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:Go,children:[No("caption",{className:"semiotic-accessible-data-table-caption",style:Uo,children:j>0?`Top ${W} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),No("thead",{children:Ro("tr",{children:[No("th",{style:Vo,children:"id"}),No("th",{style:Vo,children:"degree"}),No("th",{style:Vo,children:"in"}),No("th",{style:Vo,children:"out"}),A&&No("th",{style:Vo,children:"w. degree"}),A&&No("th",{style:Vo,children:"w. in"}),A&&No("th",{style:Vo,children:"w. out"})]})}),No("tbody",{children:C.map((e,t)=>Ro("tr",{children:[No("td",{style:_o,children:e.id}),No("td",{style:_o,children:e.degree}),No("td",{style:_o,children:e.inDeg}),No("td",{style:_o,children:e.outDeg}),A&&No("td",{style:_o,children:zo(e.wDegree)}),A&&No("td",{style:_o,children:zo(e.wInDeg)}),A&&No("td",{style:_o,children:zo(e.wOutDeg)})]},t))})]}),j>0&&Ro("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>l(e=>e+25),style:Yo,children:["Show ",Math.min(25,j)," more"," ",1===j?"node":"nodes"," (",j," remaining)"]})]})}function Ko({summary:e}){return e?No("div",{role:"note",style:Ao,children:e}):null}function Jo({tableId:e}){return No("a",{href:"#"+e,style:Ao,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Ao)},children:"Skip to data table"})}import{jsx as Qo}from"react/jsx-runtime";var ei="var(--semiotic-focus, #005fcc)";function ti({active:e,hoverPoint:t,margin:n,size:r,shape:o="circle",width:i,height:a,pathData:s}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==o&&"path"!==o||!s)if("rect"===o&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);u=Qo("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:ei,strokeWidth:2,strokeDasharray:"4,2"})}else u=Qo("circle","wedge"===o?{cx:l,cy:c,r:12,fill:"none",stroke:ei,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:ei,strokeWidth:2,strokeDasharray:"4,2"});else u=Qo("g",{transform:`translate(${n.left},${n.top})`,children:Qo("path",{d:s,fill:"none",stroke:ei,strokeWidth:2.5,strokeDasharray:"6,3"})});return Qo("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}import*as ni from"react";import{jsx as ri}from"react/jsx-runtime";function oi({x:e,y:t,containerWidth:n,containerHeight:r,margin:o,children:i,className:a="stream-frame-tooltip",zIndex:s=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=ni.useRef(null),[u,d]=ni.useState(null);ni.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&d(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[a,n,r,l]);let h;h=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>r-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*r>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!ni.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(i),y=f?null:X;return l?ri("div",{ref:c,className:f?a:(a+" semiotic-tooltip").trim(),style:{...y||{},position:"absolute",left:o.left+e,top:o.top+t,transform:h,pointerEvents:"none",zIndex:s,width:"max-content"},children:i}):null}import*as ii from"react";import{useCallback as ai,useEffect as si,useLayoutEffect as li,useMemo as ci,useRef as ui}from"react";function di(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function hi(e,t){return Math.min((e-t.startTime)/t.duration,1)}function fi(e,t,n){return e+(t-e)*n}function yi(){return"undefined"!=typeof performance?performance.now():Date.now()}var pi=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,mi=new WeakMap,gi=0,bi=!1,xi=null,vi=null;function ki(e,t){if(!t)return t;const n=pi.exec(t);if(!n)return t;const r=e.canvas;if(!r)return n[2]?.trim()||t;!function(){if(bi)return;if("undefined"==typeof window||"undefined"==typeof document)return;bi=!0;const e=()=>{gi++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]}),"function"==typeof window.matchMedia)try{xi=window.matchMedia("(prefers-color-scheme: dark)"),vi=e,"function"==typeof xi.addEventListener?xi.addEventListener("change",vi):"function"==typeof xi.addListener&&xi.addListener(vi)}catch{}}();let o=mi.get(r);o&&o.version===gi||(o={version:gi,map:new Map},mi.set(r,o));const i=o.map.get(t);if(void 0!==i)return i;const a=getComputedStyle(r).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return o.map.set(t,a),a}function wi(){return gi}var $i=()=>"undefined"!=typeof performance?performance.now():Date.now();function Mi(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}function Ai(e,t){const n=e();return Number.isFinite(n)?n:t}var Si=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??$i,this.lastWallTime=Ai(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=Ai(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??$i;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=Ai(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:Mi(n)))}},Wi=22,Ci="undefined"==typeof window?si:li,ji={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function Ii(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Oi(e){const t=l(),n=ui(t);n.current=t;const[o,i]=qt(e.sizeProp,e.responsiveWidth,e.responsiveHeight),a=!!e.title,s=!!e.legend&&"top"===e.legendPosition,c=ci(()=>function(e,t,n=!1){const r=n?t?58:34:t?36:0;return r>e.top?{...e,top:r}:e}({...e.marginDefault,...e.userMargin},a,s),[e.marginDefault,e.userMargin,a,s]),u=i[0]-c.left-c.right,d=i[1]-c.top-c.bottom,h=Ii(e.foregroundGraphics,i,c),f=Ii(e.backgroundGraphics,i,c),y=r(e=>e.theme),{transition:p,introEnabled:m}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),g="semiotic-table-"+ii.useId(),b=ui(null);if(!b.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;b.current=new Si({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const x=b.current;x.configure({clock:e.clock,random:e.random,seed:e.seed});const v=ui(null),k=ui(e.frameScheduler??ji);k.current=e.frameScheduler??ji;const w=ui(null),$=ui(!1),M=ui(()=>{}),A=ai(()=>{if(null!==v.current||$.current)return;const e=k.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&($.current=!0),v.current=null,w.current=null;try{M.current()}finally{e&&($.current=!1)}});n=!0,t||(v.current=r,w.current=e)},[]),S=ai(()=>{null!==v.current&&((w.current??k.current).cancelAnimationFrame(v.current),v.current=null,w.current=null)},[]);Ci(()=>{x.setPaused(!0===e.paused)},[x,e.paused]),si(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void x.setVisible(!0);const t=()=>x.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[x,e.suspendWhenHidden]),si(()=>()=>{S()},[S]);const W=ui(()=>{}),C=ui(()=>{}),j=ui(null),I=ui(null),O=ui(null),N=ai(()=>{const e=j.current;j.current=null,e&&W.current(e)},[]),R=ai(e=>{if(j.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===I.current){const e=k.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,I.current=null,O.current=null,N()});t||(I.current=n,O.current=e)}},[N]),L=ai(()=>{j.current=null,null!==I.current&&((O.current??k.current).cancelAnimationFrame(I.current),I.current=null,O.current=null),C.current()},[]);si(()=>()=>{j.current=null,null!==I.current&&((O.current??k.current).cancelAnimationFrame(I.current),I.current=null,O.current=null)},[]);const P=e.themeDirtyRef;return Ci(()=>{P&&(gi++,P.current=!0,A())},[y,A,P]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:i,margin:c,adjustedWidth:u,adjustedHeight:d,resolvedForeground:h,resolvedBackground:f,currentTheme:y,transition:p,introEnabled:m,tableId:g,frameRuntime:x,rafRef:v,renderFnRef:M,scheduleRender:A,cancelRender:S,hoverHandlerRef:W,hoverLeaveRef:C,onPointerMove:R,onPointerLeave:L}}import{useEffect as Ni,useRef as Ri}from"react";import{jsx as Li}from"react/jsx-runtime";function Pi(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:o,scheduleRender:i}=e,a=Ri(null),l=Ri(null),c=Ri(!1);return s({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),Ni(()=>{if(!1!==o)return r.subscribe(()=>{r.isActive?(n.current=!0,i()):t()})},[t,n,r,o,i]),Ni(()=>{!c.current&&(c.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:a,interactionCanvasRef:l}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}function zi({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?Li("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:Li("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function Fi(e,t,n,r){const o=e.getContext("2d");if(!o)return null;const i=Math.round(t[0]*r),a=Math.round(t[1]*r),s=i/t[0],l=a/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===a||(e.width=i,e.height=a),o.setTransform(s,0,0,l,0,0),o.translate(n.left,n.top),o}function Ti(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}function Di(e){return"touch"===e?"touch":"pointer"}function Ei(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function Bi(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:a}),"focus"===s?.type&&t({type:"focus",datum:n,inputType:"touch"===s.inputType?"pointer":s.inputType,timestamp:l,chartType:i,chartId:a})):t({type:"hover-end",timestamp:l,chartType:i,chartId:a}))}function Hi(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:s,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:a}),"activate"===s?.type&&t({type:"activate",datum:n,inputType:s.inputType,timestamp:l,chartType:i,chartId:a})):t({type:"click-end",timestamp:l,chartType:i,chartId:a}))}function qi(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}function Gi(e){return e?"string"==typeof e?{name:e}:e:null}var Vi=.5;function _i(e,t,n){return t?(r,...o)=>{const i={...e(r,...o)};if(t.isActive)if(t.predicate(r))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}import{useMemo as Ui,useCallback as Yi,useState as Zi,useId as Xi,useEffect as Ki,useRef as Ji}from"react";function Qi({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:o,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==o&&(n.stroke=o),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const a=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),s=a?r(a,t,n):n?n(o):Le[i%Le.length];return{label:o+"",color:s}}),label:""}]}}function ea(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const o=Number(r);return Number.isFinite(o)?o:null}function ta(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}function na(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var ra="#007bff",oa=[],ia={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function aa(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,o="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==r,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!o&&!i)return ia;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??r??44,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??44,standardControls:s.standardControls??!1}}function sa(){const e=n(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function la(){const e=n();return e?.colors?.sequential||void 0}function ca(){const e=n();return e?.colors?.diverging||void 0}function ua(e,t,n,r,o){if(e)return e;if(n&&"object"==typeof n&&!Array.isArray(n)){const e=Te(n,r);if(e)return e}let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=Ne[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=r?(o.has(r)||o.set(r,o.size),i[o.get(r)%i.length]):i[0]:ra}function da(e,t,n){const r=Ge(),o=sa();return Ui(()=>{if(!t)return;const i=r??void 0,a=n??(o&&o.length>0?o:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&na(i)){const e=De(n.map(e=>({_cat:e})),"_cat",a);return t=>i[t]||e(t)}return De(n.map(e=>({_cat:e})),"_cat",a)}if(i&&na(i)){const n=De(e,t,a);return e=>i[e]||n(e)}return De(e,t,a)}if(i&&na(i)){const e=De([{_:"a"}],"_",a);return t=>i[t]||e(t)}},[e,t,n,r,o])}function ha(e,t,n){return Ui(()=>{if(!t||"auto"===t||"function"==typeof t)return e;const r=[...e],o="function"==typeof(i=n)?i:e=>e[i];var i;return r.sort("asc"===t?(e,t)=>o(e)-o(t):(e,t)=>o(t)-o(e))},[e,t,n])}function fa({selection:e,linkedHover:t,fallbackFields:n=oa,unwrapData:r=!1,onObservation:o,chartType:i,chartId:a,onClick:s,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const d=Xi(),h=Ui(()=>qi(t,n),[t,n]),f=Ui(()=>"series"===h?.mode?[h.seriesField||c||n[0]].filter(e=>!!e):h?.fields||n,[h,c,n]),y=ht({name:e?.name||"__unused__",fields:f}),p=yt({name:h?.name||"hover",fields:f}),m=j(e=>e.pushObservation),g=Yi(e=>{o?.(e),m?.(e)},[o,m]),b=e?{isActive:y.isActive,predicate:y.predicate}:null,[x,v]=Zi(null),k=Ji(!1),w=c||n[0],$=Ui(()=>{if(!l||null==x||!w)return null;const e=x,t=w;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,x,w]),M=Yi((e,n)=>{const r=!e&&k.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===h?.mode&&h.xField){const n=ea(e,t,h.xField);null!=n&&function(e,t,n){const r=tt.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===n||(tt={positions:new Map(tt.positions).set(e,{xValue:t,sourceId:n})},rt())}(h.name||"hover",n,d)}"x-position"!==h?.mode&&p.onHover(t)}else"x-position"!==h?.mode||r||ot(h.name||"hover",d),"x-position"===h?.mode||r||p.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[w];v(null!=n?n+"":null)}else r||v(null);(o||m)&&Bi({onObservation:g,datum:e?ta(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:a,context:n})},[t,p,h,d,o,i,a,m,g,l,w,u]),A=Yi((n=!0)=>{k.current=!1,t&&"x-position"!==h?.mode&&p.onHover(null),e&&u?.tapToSelect&&y.clear(),n&&l&&v(null),"x-position"===h?.mode&&(it(h.name||"hover",d),ot(h.name||"hover",d))},[t,h,p,e,u,y,l,d]),S=Yi((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),b=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===h?.mode&&h.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=ea(n,e,h.xField);null!=t&&function(e,t,n){const r=tt.positions.get(e);if(r?.locked){const t=new Map(tt.positions);return t.delete(e),tt={positions:t},rt(),!1}tt={positions:new Map(tt.positions).set(e,{xValue:t,sourceId:n,locked:!0})},rt()}(h.name||"hover",t,d)}if(c)if(n){k.current=!0;const r=ta(n);if(t&&"x-position"!==h?.mode&&p.onHover(r),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=r[t];void 0!==n&&(e[t]=[n])}na(e)&&y.selectPoints(e)}if(l&&w){const e=r?.[w];v(null!=e?e+"":null)}}else b&&A();if(n||b){if(n&&s){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),s(e,{x:n.x??0,y:n.y??0})}(o||m)&&Hi({onObservation:g,datum:n?ta(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:a,context:r})}},[s,o,m,g,i,a,h,d,u,t,p,e,y,f,l,w,A]);return Ki(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&k.current&&A()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,A]),Ki(()=>()=>{k.current&&A(!1)},[A]),Ki(()=>{if("x-position"!==h?.mode)return;const e=h.name||"hover";return()=>{it(e,d),ot(e,d)}},[h?.mode,h?.name,d]),{activeSelectionHook:b,hoverSelectionHook:$,customHoverBehavior:M,customClickBehavior:S,crosshairSourceId:d}}function ya(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function pa({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:o="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:s}){const l=wt(_t),c=null!==wt(Zt),u=void 0!==r?r:!l&&!!t,d=!!t&&(u||c),h=Ui(()=>{if(!d)return[];if(void 0!==s)return s;const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(e+"")}return Array.from(n)},[s,t,e,d]);Qt(c&&t?h:[]);const f=Ui(()=>{if(!u||!t)return;const r=Qi({data:e,colorBy:t,colorScale:n,getColor:Fe,categories:h});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[u,t,e,n,h]),y=Ui(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];return f&&("right"===o&&!r("right")&&110>n.right?n.right=110:"left"===o&&!r("left")&&110>n.left?n.left=110:"top"===o&&!r("top")&&50>n.top?n.top=50:"bottom"===o&&!r("bottom")&&80>n.bottom&&(n.bottom=80)),n},[a,i,f,o]);return{legend:f,margin:y,legendPosition:o}}function ma(e,t,n){const[r,o]=Zi(null),[i,a]=Zi(new Set),s=Ui(()=>new Set,[]),l=Yi(t=>{"highlight"===e&&o(t?t.label:null)},[e]),c=Yi(t=>{"isolate"===e&&a(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===n.length?new Set:r})},[e,n.length]),u=Ui(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const r=n?e[n]:"function"==typeof t?t(e):null;return i.has(r)}}:null},[e,t,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:s,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}var ga={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function ba(e,t,n){const r=ga[e||"primary"],o=e&&"primary"!==e||!n?.width?r.width:n.width,i=e&&"primary"!==e||!n?.height?r.height:n.height,a=sn({...t,mode:e},{width:t.width??o,height:t.height??i}).props,s=a.mode||e,l=ga[s||"primary"],c="context"===s||"sparkline"===s,u=s&&"primary"!==s||!n?.width?l.width:n.width;return{width:a.width??u,height:a.height??(s&&"primary"!==s||!n?.height?l.height:n.height),showAxes:a.showAxes??l.showAxes,showGrid:a.showGrid??l.showGrid,enableHover:a.enableHover??(!!a.linkedHover||l.enableHover),showLegend:a.showLegend??l.showLegend,showLabels:a.showLabels??l.showLabels,title:c?void 0:a.title,description:a.description,summary:a.summary,accessibleTable:a.accessibleTable,xLabel:c?void 0:a.xLabel,yLabel:c?void 0:a.yLabel,categoryLabel:c?void 0:a.categoryLabel,valueLabel:c?void 0:a.valueLabel,marginDefaults:xa(l.marginDefaults,a.showCategoryTicks,a.orientation),compactMode:c,mobileInteraction:aa(a.mobileInteraction,{mode:s,width:a.width??u,mobileSemantics:a.mobileSemantics}),mobileSemantics:a.mobileSemantics}}function xa(e,t,n){if(!1!==t)return e;const r={...e};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}function va(e,t){const n=e.fillStyle,r="#010203";try{e.fillStyle=r,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const o=e.fillStyle;if(e.fillStyle=n,"string"!=typeof o)return[78,121,167];if(o.toLowerCase()===r&&t.trim().toLowerCase()!==r)return[78,121,167];if(o.startsWith("#"))return[parseInt(o.slice(1,3),16),parseInt(o.slice(3,5),16),parseInt(o.slice(5,7),16)];const i=o.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}import{curveMonotoneX as ka,curveMonotoneY as wa,curveCardinal as $a,curveCatmullRom as Ma,curveStep as Aa,curveStepBefore as Sa,curveStepAfter as Wa,curveBasis as Ca,curveNatural as ja}from"d3-shape";function Ia(e){switch(e){case"monotoneX":return ka;case"monotoneY":return wa;case"cardinal":return $a;case"catmullRom":return Ma;case"step":return Aa;case"stepBefore":return Sa;case"stepAfter":return Wa;case"basis":return Ca;case"natural":return ja;default:return null}}function Oa(e,t,n){if(null==t)return n;if(k(t)){const r=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,r=`${w(e)}@${n}`,o=M.get(r);if(void 0!==o)return o;const i=b({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return M.set(r,i),i}(t,e);return r||t.background&&ki(e,t.background)||n}return"string"!=typeof t?t:ki(e,t)||n}function Na(e,t){if(null==t)return;const n=Oa(e,t,"");return""===n?void 0:n}function Ra(e,t,n,r,o,i,a){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const s=e.createLinearGradient(r,o,i,a);for(const e of n)s.addColorStop(e.offset,e.color);return s}const{topOpacity:s,bottomOpacity:l}=t;if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,s)),u=Math.max(0,Math.min(1,l)),d=e.createLinearGradient(r,o,i,a),[h,f,y]=va(e,n);return d.addColorStop(0,`rgba(${h},${f},${y},${c})`),d.addColorStop(1,`rgba(${h},${f},${y},${u})`),d}function La(e,t,n,r,o,i){const a=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>a.length)return null;const s=e.createLinearGradient(n,r,o,i);for(const e of a)s.addColorStop(e.offset,e.color);return s}export{ln as EMPTY_ARRAY,cn as filterSparseArray,ue as schemeCategory10,ge as interpolateViridis,$e as SEQUENTIAL_INTERPOLATORS,Me as getSequentialInterpolator,Ae as interpolateRdBu,Se as interpolatePiYG,We as interpolatePRGn,Ce as interpolateBrBG,je as interpolateRdYlBu,Ie as interpolateRdYlGn,Oe as interpolateSpectral,Ne as COLOR_SCHEMES,Re as DEFAULT_COLORS,Le as STREAMING_PALETTE,Pe as DEPTH_PALETTE_COLORS,Fe as getColor,Te as resolveExplicitColor,De as createColorScale,Ee as getSize,di as computeEasing,hi as computeRawProgress,fi as lerp,yi as now,c as DEFAULT_LIFECYCLE_THRESHOLDS,u as bandFromAge,d as resolveMotionAccessor,h as compileMotionEncoding,f as resolveMotionAge,y as opacityFromAge,p as resolveMotionVector,m as deriveMotionVector,Zr as SYMBOL_SEQUENCE,Xr as symbolPathString,Kr as symbolRadius,fn as UpdateResultTracker,$n as useSceneRevisionDiagnostics,Mn as runSceneBuild,An as SceneRevisionDiagnosticsObserver,ki as resolveCSSColor,wi as getCSSColorCacheVersion,va as parseCanvasColor,b as createHatchPattern,k as isHatchFill,$ as hatchFillId,A as hatchPatternDef,S as resolveSvgFill,Ia as resolveCurveFactory,Oa as resolveCanvasFill,Na as coerceCanvasFill,Ra as buildLinearFillGradient,La as buildColorStopGradient,Cn as renderLegendFromConfig,On as ANNOTATION_DISCLOSURE_REVEAL_CSS,j as useObservationSelector,I as useAnnotationActivationOptions,O as annotationStableId,N as annotationActivationProps,R as isAnnotationActivationTarget,F as estimateLabelWidth,T as AnnotationLabel,yr as renderAnnotationPass,pr as createDefaultAnnotationRules,br as annotationType,xr as isNoteAnnotation,vr as annotationDrawsConnector,wr as annotationBudget,Fr as annotationLayout,it as unlockCrosshair,dt as useCrosshairPosition,Wi as TITLE_BASELINE,Jr as hasAnyCornerRadius,Qr as clampCornerRadii,to as annularSectorPath,no as buildGaugeGradientGeometry,uo as xySceneNodeToSVG,ho as networkSceneNodeToSVG,fo as networkSceneEdgeToSVG,yo as networkLabelToSVG,po as ordinalSceneNodeToSVG,mo as geoSceneNodeToSVG,go as isServerEnvironment,ko as DataSummaryProvider,wo as useDataSummary,$o as useDataSummaryToggle,So as AriaLiveTooltip,Io as extractAllRows,Lo as computeCanvasAriaLabel,Po as computeNetworkAriaLabel,Zo as AccessibleDataTable,Xo as NetworkAccessibleDataTable,Ko as ScreenReaderSummary,Jo as SkipToTableLink,ti as FocusRing,V as getPointerHitRadius,U as buildHoverData,G as smartTooltipEntries,X as defaultTooltipStyle,Q as Tooltip,ee as MultiLineTooltip,te as MultiPointTooltip,ne as normalizeTooltip,oi as FlippingTooltip,Mi as createSeededFrameRandom,Oi as useFrame,Pi as useFrameCanvasHost,zi as CanvasFrameBackground,Fi as prepareCanvas,Ti as getDevicePixelRatio,Di as observationInputType,Ei as isInteractiveKeyboardTarget,Bi as emitHoverObservations,Hi as emitClickObservations,qe as CategoryColorProvider,Ge as useCategoryColors,Qe as useSelectionSelector,ht as useSelection,ft as useSelectionActions,yt as useLinkedHover,mt as useBrushSelection,bt as useFilteredData,vt as useChartObserver,Yt as useLinkedChartsActive,Qt as useLinkedChartCategories,rn as LinkedCharts,Qi as createLegend,qi as normalizeLinkedHover,Gi as normalizeLinkedBrush,Vi as DEFAULT_SELECTION_OPACITY,_i as wrapStyleWithSelection,an as responsiveRuleMatches,sn as resolveResponsiveRules,ra as DEFAULT_COLOR,aa as resolveMobileInteraction,sa as useThemeCategorical,la as useThemeSequential,ca as useThemeDiverging,ua as resolveDefaultFill,da as useColorScale,ha as useSortedData,fa as useChartSelection,ya as getCrosshairProps,pa as useChartLegendAndMargin,ma as useLegendInteraction,ba as useChartMode};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{useChartSetup as t,useCustomChartScaffold as e}from"./chunk-chunk-BHYTYMY2.module.min.js";import{lineCanvasRenderer as n,resolveNodeColor as i}from"./chunk-chunk-CYIML3AV.module.min.js";import{RingBuffer as o,compactTimestampBufferForRemoval as r,computePulseIntensity as s,hasActivePulses as a,pointCanvasRenderer as c,pushWithTimestamp as l,refreshIdlePulse as u,setPulseState as h,useGeoKeyboardNavigation as d,useLegendCategoryEmission as p,useSemanticFrameInteractions as f}from"./chunk-chunk-5WEFWNUW.module.min.js";import{needsDataCanvasPaint as m,needsInteractionCanvasPaint as g,paintCanvasBackground as y}from"./chunk-chunk-XOYX77KF.module.min.js";import{StalenessBadge as v,attachUpdateResultStore as b,buildBaseMetadataProps as w,buildCustomBehaviorProps as P,composeOverlays as L,computeDecayOpacity as S,createCustomLayoutFailureDiagnostic as x,findHitPointInQuadtree as R,formatVal as k,getHitRadius as A,glyphCanvasRenderer as C,paintSceneWithBackend as D,renderPathPulse as j,renderSceneWithBackend as T,useConfigSync as M,useLayoutSelectionSync as B,useStableShallow as _,useStalenessCheck as I,warnCustomLayoutDiagnostics as E}from"./chunk-chunk-FAKO3RGQ.module.min.js";import{wrapWithCustomLayoutSelection as N}from"./chunk-chunk-5UKL5W76.module.min.js";import{buildResolveColor as O,resolveCustomLayoutPalette as F}from"./chunk-chunk-STZFFTAN.module.min.js";import{AccessibleDataTable as W,AriaLiveTooltip as z,CanvasFrameBackground as H,FlippingTooltip as G,FocusRing as q,STREAMING_PALETTE as Z,SceneRevisionDiagnosticsObserver as Y,ScreenReaderSummary as X,SkipToTableLink as U,TITLE_BASELINE as Q,UpdateResultTracker as $,annotationLayout as V,coerceCanvasFill as K,computeCanvasAriaLabel as J,computeEasing as tt,computeRawProgress as et,createDefaultAnnotationRules as nt,defaultTooltipStyle as it,filterSparseArray as ot,geoSceneNodeToSVG as rt,getDevicePixelRatio as st,getPointerHitRadius as at,isAnnotationActivationTarget as ct,isServerEnvironment as lt,lerp as ut,normalizeTooltip as ht,now as dt,observationInputType as pt,prepareCanvas as ft,renderAnnotationPass as mt,renderLegendFromConfig as gt,resolveCSSColor as yt,smartTooltipEntries as vt,useAnnotationActivationOptions as bt,useFrame as wt,useFrameCanvasHost as Pt,useSceneRevisionDiagnostics as Lt}from"./chunk-chunk-ODUZEEBH.module.min.js";import{getMax as St}from"./chunk-chunk-JJ2OOIET.module.min.js";import{resolveThemeSemanticColors as xt}from"./chunk-chunk-WCX6U47H.module.min.js";import{glyphHitGeometry as Rt}from"./chunk-chunk-KTWEBFMX.module.min.js";import{SafeRender as kt,useHydration as At,useWasHydratingFromSSR as Ct}from"./chunk-chunk-ZCNBUZPL.module.min.js";import{useRef as Dt,useState as jt,useEffect as Tt,useMemo as Mt,useCallback as Bt,useImperativeHandle as _t,forwardRef as It,memo as Et}from"react";import{geoPath as Nt}from"d3-geo";import{quadtree as Ot}from"d3-quadtree";import{geoMercator as Ft,geoEqualEarth as Wt,geoAlbersUsa as zt,geoOrthographic as Ht,geoNaturalEarth1 as Gt,geoEquirectangular as qt}from"d3-geo";var Zt={mercator:Ft,equalEarth:Wt,albersUsa:zt,orthographic:Ht,naturalEarth:Gt,equirectangular:qt};function Yt(t,e){return t?"function"==typeof t?t:e=>e[t]:t=>t[e]}function Xt(t){return t?"function"==typeof t?t:e=>e[t]:t=>t.coordinates||t.data||[]}function Ut(t,e,n){return t?"function"==typeof t?{...n,...t(e)}:{...n,...t}:{...n}}function Qt(t,e){if(2>t.length)return[t];const n=.4*e,i=[];let o=[t[0]];for(let e=1;t.length>e;e++){const r=t[e];Math.abs(r[0]-t[e-1][0])>n?(2>o.length||i.push(o),o=[r]):o.push(r)}return 2>o.length||i.push(o),i}function $t(t,e,n=24){const i=e[0]-t[0],o=e[1]-t[1],r=Math.sqrt(i*i+o*o);if(0===r)return[t,e];const s=-o/r,a=i/r,c=Math.min(.3*r,80),l=(t[0]+e[0])/2+s*c,u=(t[1]+e[1])/2+a*c,h=[];for(let i=0;n>=i;i++){const o=i/n,r=1-o;h.push([r*r*t[0]+2*r*o*l+o*o*e[0],r*r*t[1]+2*r*o*u+o*o*e[1]])}return h}function Vt(t,e){if(2>t.length)return t;const n=e/2+1,i=[];for(let e=0;t.length>e;e++){const o=t[e];let r,s;0===e?(r=t[1][0]-o[0],s=t[1][1]-o[1]):e===t.length-1?(r=o[0]-t[e-1][0],s=o[1]-t[e-1][1]):(r=t[e+1][0]-t[e-1][0],s=t[e+1][1]-t[e-1][1]);const a=Math.sqrt(r*r+s*s)||1;i.push([o[0]+s/a*n,o[1]+-r/a*n])}return i}function Kt(t,e,n,i,o){const r=e[0]-t[0],s=e[1]-t[1],a=Math.sqrt(r*r+s*s);if(0===a)return[t,e];const c=s/a,l=-r/a,u=o/2+1;return[[t[0]+c*u,t[1]+l*u],[e[0]+c*u,e[1]+l*u]]}import{scaleLinear as Jt}from"d3-scale";var te=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ee=["scene-style","data-paint","accessibility","evidence"],ne=(t,e)=>({retainedData:t,invalidations:e}),ie=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],oe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],re=["scene-geometry","data-paint","accessibility","evidence"],se=["scene-style","data-paint","accessibility","evidence"],ae=["overlay","accessibility","evidence"],ce=[],le={xAccessor:ne("rebuild",ie),yAccessor:ne("rebuild",ie),lineDataAccessor:ne("rebuild",ie),pointIdAccessor:ne("rebuild",re),lineIdAccessor:ne("rebuild",re),windowSize:ne("rebuild",ie),projection:ne("preserve",oe),projectionExtent:ne("preserve",oe),fitPadding:ne("preserve",oe),lineType:ne("preserve",oe),flowStyle:ne("preserve",oe),graticule:ne("preserve",oe),projectionTransform:ne("preserve",oe),customLayout:ne("preserve",oe),layoutConfig:ne("preserve",oe),layoutMargin:ne("preserve",oe),areaStyle:ne("preserve",se),pointStyle:ne("preserve",["scene-geometry","scene-style","data-paint","accessibility","evidence"]),lineStyle:ne("preserve",se),colorScheme:ne("preserve",se),themeCategorical:ne("preserve",se),themeDiverging:ne("preserve",se),themeSemantic:ne("preserve",se),themeSequential:ne("preserve",se),decay:ne("preserve",se),pulse:ne("preserve",se),layoutSelection:ne("preserve",se),annotations:ne("preserve",ae),autoPlaceAnnotations:ne("preserve",ae),clock:ne("preserve",ce),transition:ne("preserve",ce),introAnimation:ne("preserve",ce),onLayoutError:ne("preserve",ce)},ue=ne("preserve",oe),he=class{constructor(){this.tracker=new $}get last(){return this.tracker.last}subscribe(t){return this.tracker.subscribe(t)}recordData(t,e){return this.tracker.record({kind:t,...void 0===e?{}:{count:e}},te)}recordNoop(t){return this.tracker.record({kind:t,..."restyle"===t?{}:{count:0}},[])}recordRestyle(t){return t?this.tracker.record({kind:"restyle"},ee):this.recordNoop("restyle")}recordConfig(t,e={}){const n=function(t){let e="preserve";const n=new Set;for(const i of t){const t=le[i]??ue;"rebuild"===t.retainedData&&(e="rebuild");for(const e of t.invalidations)n.add(e)}return{retainedData:e,invalidations:n}}(t),i=new Set(n.invalidations);return e.retainedDataChanged&&i.add("data"),this.tracker.record({kind:"config",keys:t},i)}};import{geoDistance as de,geoGraticule as pe,geoInterpolate as fe}from"d3-geo";function me(t){if(null==t)return 0;if("number"==typeof t&&Number.isFinite(t)&&t>=0&&.5>t)return t;throw new RangeError(`[semiotic] fitPadding must be a finite fraction in [0, 0.5); received ${t+""}.`)}var ge=class t{constructor(t){this.updateResults=new he,this.scene=[],this.scales=null,this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._customLayoutFailedThisBuild=!1,this._quadtree=null,this._maxPointRadius=0,this.projection=null,this.geoPath=null,this.baseScale=0,this.baseTranslate=[0,0],this.baseRotation=[0,0,0],this.currentZoom=1,this.cartogramLayout=null,this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.streaming=!1,this.lastIngestTime=0,this.timestampBuffer=null,this.activeTransition=null,this.prevPositions=null,this._hasRenderedOnce=!1,this.config=function(t){return{...t,fitPadding:me(t.fitPadding)}}(t)}currentTime(){return this.config.clock?.()??dt()}getConfiguredWindowSize(){const t=this.config.windowSize??500;if(!Number.isInteger(t)||1>t)throw Error("GeoPipelineStore windowSize must be a positive integer");return t}retainNewestLines(t=this.getConfiguredWindowSize()){this.lineData.length>t&&(this.lineData=this.lineData.slice(-t))}resizeStreamingWindow(t){if(this.pointBuffer){const e=this.pointBuffer.toArray(),n=this.timestampBuffer?.toArray()??[],i=e.slice(-t),r=n.slice(-i.length),s=this.currentTime();this.pointBuffer=new o(t),this.timestampBuffer=new o(t),i.forEach((t,e)=>{this.pointBuffer.push(t),this.timestampBuffer.push(r[e]??s)})}this.retainNewestLines(t)}updateConfig(t){const e=function(t){return"fitPadding"in t?{...t,fitPadding:me(t.fitPadding)}:t}(t),n=this.config,i=this.getConfiguredWindowSize(),o=Object.keys(e).filter(t=>e[t]!==n[t]);this.config={...this.config,...e};const r=this.getConfiguredWindowSize(),s=this.streaming&&r!==i;s&&(this.resizeStreamingWindow(r),this.version++),"customLayout"in e&&!e.customLayout&&(this.lastCustomLayoutFailure=null),this.updateResults.recordConfig(o,{retainedDataChanged:s})}updateConfigWithResult(t){return this.updateConfig(t),this.updateResults.last}setAreas(t){this.areas=t,this.updateResults.recordData("replace",t.length)}setAreasWithResult(t){return this.setAreas(t),this.updateResults.last}setPoints(t){this.pointData=t.slice(),this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.updateResults.recordData("replace",t.length)}setPointsWithResult(t){return this.setPoints(t),this.updateResults.last}setLines(t){this.lineData=t.slice(),this.streaming&&this.retainNewestLines(),this.updateResults.recordData("replace",t.length)}setLinesWithResult(t){return this.setLines(t),this.updateResults.last}initStreaming(t){void 0!==t&&t!==this.config.windowSize&&(this.config={...this.config,windowSize:t});const e=this.getConfiguredWindowSize(),n=this.pointBuffer?this.pointBuffer.toArray():this.pointData,i=this.timestampBuffer?.toArray()??[],r=n.slice(-e),s=i.slice(-r.length),a=this.currentTime();this.pointBuffer=new o(e),this.timestampBuffer=new o(e),r.forEach((t,e)=>{this.pointBuffer.push(t),this.timestampBuffer.push(s[e]??a)}),this.pointData=[],this.retainNewestLines(e),this.streaming=!0}pushPoint(t){this.pointBuffer||this.initStreaming();const e=this.currentTime();l(this.pointBuffer,t,this.timestampBuffer,e),this.lastIngestTime=e,this.updateResults.recordData("ingest",1)}pushPointWithResult(t){return this.pushPoint(t),this.updateResults.last}pushMany(t){this.pointBuffer||this.initStreaming();const e=this.currentTime();for(const n of t)l(this.pointBuffer,n,this.timestampBuffer,e);this.lastIngestTime=e,this.updateResults.recordData("ingest",t.length)}pushManyWithResult(t){return this.pushMany(t),this.updateResults.last}pushLine(t){null!=t&&"object"==typeof t?(this.streaming||this.initStreaming(),this.lineData.push(t),this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",1)):this.updateResults.recordNoop("ingest")}pushManyLines(t){if(!Array.isArray(t)||0===t.length)return void this.updateResults.recordNoop("ingest");const e=t.filter(t=>null!=t&&"object"==typeof t);if(0!==e.length){this.streaming||this.initStreaming();for(const t of e)this.lineData.push(t);this.retainNewestLines(),this.version++,this.updateResults.recordData("ingest",e.length)}else this.updateResults.recordNoop("ingest")}removeLine(t){const{lineIdAccessor:e}=this.config;if(!e)throw Error("removeLine() requires lineIdAccessor to be configured");const n="function"==typeof e?e:t=>t[e],i=new Set(Array.isArray(t)?t:[t]),o=[];return this.lineData=this.lineData.filter(t=>!i.has(n(t)+"")||(o.push(t),!1)),o.length>0?(this.version++,this.updateResults.recordData("remove",o.length)):this.updateResults.recordNoop("remove"),o}getLines(){return this.lineData.slice()}removePoint(t){const{pointIdAccessor:e}=this.config;if(!e)throw Error("removePoint() requires pointIdAccessor to be configured");const n="function"==typeof e?e:t=>t[e],i=new Set(Array.isArray(t)?t:[t]);if(this.streaming&&this.pointBuffer){const t=t=>i.has(n(t)+"");r(this.pointBuffer,this.timestampBuffer,t);const e=this.pointBuffer.remove(t);return e.length>0?(this.version++,this.updateResults.recordData("remove",e.length)):this.updateResults.recordNoop("remove"),e}{const t=[];return this.pointData=this.pointData.filter(e=>!i.has(n(e)+"")||(t.push(e),!1)),t.length>0?(this.version++,this.updateResults.recordData("remove",t.length)):this.updateResults.recordNoop("remove"),t}}clear(){this.areas=[],this.pointData=[],this.lineData=[],this.pointBuffer=null,this.timestampBuffer=null,this.streaming=!1,this.scene=[],this.scales=null,this._hasRenderedOnce=!1,this.activeTransition=null,this.prevPositions=null,this._quadtree=null,this._maxPointRadius=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._customLayoutFailedThisBuild=!1,this.version++,this.updateResults.recordData("clear")}restyleScene(t){const e=this._customRestyle;if(e){for(const n of this.scene){const i=this._baseStyles.get(n)??n.style,o=e(n,t);n.style=o?{...i,...o}:i}this.markStylePaintPending(),this.updateResults.recordRestyle(!0)}else this.updateResults.recordRestyle(!1)}computeScene(t){const{config:e}=this,n=this.projection,i=this.geoPath,o=this.scales,r=this.baseScale,s=[...this.baseTranslate],a=[...this.baseRotation],c=this.scene;this.projection=function(t){if(!t)return Wt();if("string"==typeof t){const e=Zt[t];return e?e():("production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Unknown projection "${t}", falling back to equalEarth`),Wt())}if("object"==typeof t&&"type"in t){const e=Zt[t.type],n=e?e():Wt();return t.rotate&&"rotate"in n&&n.rotate(t.rotate),t.center&&"center"in n&&n.center(t.center),n}return t}(e.projection),this.geoPath=Nt(this.projection),this.fitProjection(t),this.geoPath=Nt(this.projection);const l=this.projection;this.scales={projection:l,geoPath:this.geoPath,projectedPoint:(t,e)=>l([t,e]),invertedPoint:(t,e)=>l.invert?l.invert([t,e]):null},this._customLayoutFailedThisBuild=!1;const u=this.buildSceneNodes(t);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=n,this.geoPath=i,this.scales=o,this.baseScale=r,this.baseTranslate=s,this.baseRotation=a):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=u,this.rebuildQuadtree(),e.projectionTransform&&this.applyCartogramTransform(e.projectionTransform,t),e.decay&&this.streaming&&this.applyDecay(),e.pulse&&this.streaming&&this.applyPulse(),e.transition&&!this._hasRenderedOnce&&this.scene.length>0&&e.introAnimation){const e=t.width/2,n=t.height/2,i=this.scene.filter(t=>"point"===t.type).map(t=>({...t,x:e,y:n}));i.length>0&&this.startTransition(i)}this._hasRenderedOnce=!0,e.transition&&c.length>0&&this.startTransition(c),this.version++}}fitProjection(t){const e=this.projection,n=this.config,i=[...this.areas],o=Yt(n.xAccessor,"lon"),r=Yt(n.yAccessor,"lat"),s=this.getPoints();if(s.length>0){const t=s.map(t=>[o(t),r(t)]);i.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:t}})}const a=Xt(n.lineDataAccessor);for(const t of this.lineData){const e=a(t);if(e&&e.length>0){const t=e.map(t=>[o(t),r(t)]);i.push({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:t}})}}if(0!==i.length){if(n.projectionExtent){const[[i,o],[r,s]]=n.projectionExtent;e.fitExtent([[0,0],[t.width,t.height]],{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[i,o],[r,o],[r,s],[i,s],[i,o]]]}})}else if(e.clipAngle&&(e.clipAngle()??0)>0){const i=n.fitPadding??0,o=Math.min(t.width,t.height);e.scale(o/2-o*i),e.translate([t.width/2,t.height/2])}else{const o=n.fitPadding??0,r=t.width*o,s=t.height*o;e.fitExtent([[r,s],[t.width-r,t.height-s]],{type:"FeatureCollection",features:i})}this.baseScale=e.scale(),this.baseTranslate=e.translate(),this.baseRotation=e.rotate?.()??[0,0,0]}}applyZoomTransform(t,e){const n=this.projection;if(!n)return;const i=this.geoPath,o=this.scales,r=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*t.k),n.translate([this.baseTranslate[0]*t.k+t.x,this.baseTranslate[1]*t.k+t.y]),this.currentZoom=t.k,this.geoPath=Nt(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(t,e)=>n([t,e]),invertedPoint:(t,e)=>n.invert?n.invert([t,e]):null},this._customLayoutFailedThisBuild=!1;const c=this.buildSceneNodes(e);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(r),n.translate(s),this.currentZoom=a,this.geoPath=i,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=c,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,e),this.version++)}applyZoomScale(t,e){const n=this.projection;if(!n)return;const i=this.geoPath,o=this.scales,r=n.scale(),s=[...n.translate()],a=this.currentZoom;n.scale(this.baseScale*t),n.translate(this.baseTranslate),this.currentZoom=t,this.geoPath=Nt(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(t,e)=>n([t,e]),invertedPoint:(t,e)=>n.invert?n.invert([t,e]):null},this._customLayoutFailedThisBuild=!1;const c=this.buildSceneNodes(e);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.scale(r),n.translate(s),this.currentZoom=a,this.geoPath=i,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=c,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,e),this.version++)}applyRotation(t,e){const n=this.projection;if(!n||!n.rotate)return;const i=this.geoPath,o=this.scales,r=[...n.rotate()];n.rotate(t),this.geoPath=Nt(n),this.scales={projection:n,geoPath:this.geoPath,projectedPoint:(t,e)=>n([t,e]),invertedPoint:(t,e)=>n.invert?n.invert([t,e]):null},this._customLayoutFailedThisBuild=!1;const s=this.buildSceneNodes(e);this._customLayoutFailedThisBuild?this.lastCustomLayoutFailure?.preservedLastGoodScene?(n.rotate(r),this.geoPath=i,this.scales=o):(this.scene=[],this.rebuildQuadtree()):(this.scene=s,this.rebuildQuadtree(),this.config.projectionTransform&&this.applyCartogramTransform(this.config.projectionTransform,e),this.version++)}setRotation(t){const e=this.projection;e&&e.rotate&&e.rotate(t)}getRotation(){return this.projection?.rotate?.()??this.baseRotation}getBaseProjectionState(){return{scale:this.baseScale,translate:[...this.baseTranslate]}}getPoints(){return this.streaming&&this.pointBuffer?this.pointBuffer.toArray():this.pointData}rebuildQuadtree(){let e=0,n=0;for(const t of this.scene)"point"===t.type&&(n++,t.r>e&&(e=t.r));if(this._maxPointRadius=e,t.QUADTREE_THRESHOLD>=n)return void(this._quadtree=null);const i=Array(n);let o=0;for(const t of this.scene)"point"===t.type&&(i[o++]=t);this._quadtree=Ot().x(t=>t.x).y(t=>t.y).addAll(i)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}buildSceneNodes(t){this._customLayoutFailedThisBuild=!1;const{config:e}=this,n=this.projection,i=this.geoPath;if(e.customLayout&&this.scales){const n=e.layoutMargin??{top:0,right:0,bottom:0,left:0},i=F(e.colorScheme,e.themeCategorical,Z),o={areas:this.areas.slice(),points:this.getPoints().slice(),lines:this.lineData.slice(),scales:this.scales,dimensions:{width:t.width,height:t.height,margin:n,plot:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:e.themeSemantic??{},categorical:[...i]},resolveColor:O(i,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};let r;try{r=e.customLayout(o)}catch(t){const n=null!==this.lastCustomLayoutResult,i=x("geo",t,n,this.version);this.lastCustomLayoutFailure=i,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] geo customLayout threw:",t);try{e.onLayoutError?.(i)}catch(t){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",t)}return n?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}const s=r.nodes??[];if(this.customLayoutOverlays=r.overlays??null,this.lastCustomLayoutResult=r,this.lastCustomLayoutFailure=null,this._customRestyle=r.restyle,this.hasCustomRestyle=!!r.restyle,this._baseStyles=new WeakMap,this.hasCustomRestyle){for(const t of s)this._baseStyles.set(t,t.style);this.restyleScene(e.layoutSelection??null)}return E({label:"geo customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}return this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,function({config:t,projection:e,path:n,areas:i,points:o,lines:r,layout:s}){const a=Yt(t.xAccessor,"lon"),c=Yt(t.yAccessor,"lat"),l=[],u=function(t){return{fill:t.themeSemantic?.surface||"#e0e0e0",stroke:t.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}(t),h=function(t){return{stroke:t.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}(t),d=function(t){return{fill:t.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}(t);if(t.graticule){const e=!0===t.graticule?{}:t.graticule,i=pe();e.step&&i.step(e.step);const o=n(i())||"";o&&l.push({type:"geoarea",pathData:o,centroid:[s.width/2,s.height/2],bounds:[[0,0],[s.width,s.height]],screenArea:0,style:{fill:"none",stroke:e.stroke||"#e0e0e0",strokeWidth:e.strokeWidth||.5,strokeDasharray:e.strokeDasharray||"2,2"},datum:null,interactive:!1})}for(const e of i){const i=n(e);if(!i)continue;const o=n.centroid(e),r=n.bounds(e),s=n.area(e);l.push({type:"geoarea",pathData:i,centroid:o,bounds:r,screenArea:s,style:Ut(t.areaStyle,e,u),datum:e,interactive:!0})}const p=Xt(t.lineDataAccessor);for(const n of r){const i=p(n);if(!i||2>i.length)continue;let o=[];if("geo"===t.lineType){const t=Array(i.length);for(let e=0;i.length>e;e++)t[e]=[a(i[e]),c(i[e])];for(let n=0;t.length-1>n;n++){const i=t[n],r=t[n+1],s=de(i,r)||0,a=Math.max(2,Math.ceil(s/(Math.PI/180))),c=fe(i,r);for(let t=0;a>=t;t++){if(n>0&&0===t)continue;const i=e(c(t/a));null!=i&&o.push(i)}}}else for(let t=0;i.length>t;t++){const n=i[t],r=e([a(n),c(n)]);null!=r&&o.push(r)}if(2>o.length)continue;const r=Ut(t.lineStyle,n,h),u="number"==typeof r.strokeWidth?r.strokeWidth:1;2!==i.length||2>o.length||"arc"!==t.flowStyle?2!==i.length||2>o.length||"offset"!==t.flowStyle||(o="geo"===t.lineType?Vt(o,u):Kt(o[0],o[o.length-1],0,0,u)):o=$t(o[0],o[o.length-1]);const d=Qt(o,s.width);if(d.length>1)for(const t of d)2>t.length||l.push({type:"line",path:t,style:{...r,_edgeFade:!0},datum:n});else l.push({type:"line",path:2>o.length&&d[0]||o,style:r,datum:n})}const f=t.pointIdAccessor?"function"==typeof t.pointIdAccessor?t.pointIdAccessor:e=>e[t.pointIdAccessor]:null,m=e.clipAngle?e.clipAngle()??0:0,g=m>0?m*Math.PI/180:null,y=e.rotate?e.rotate():[0,0,0],v="function"==typeof e.center?e.center():[0,0],b=[(v[0]??0)-y[0],(v[1]??0)-y[1]];for(const n of o){const i=a(n),o=c(n);if(null!=g&&de([i,o],b)>g)continue;const r=e([i,o]);if(!r)continue;const s=t.pointStyle?t.pointStyle(n):{...d},u={type:"point",x:r[0],y:r[1],r:s.r||4,style:s,datum:n,pointId:f?f(n)+"":void 0};l.push(u)}return l}({config:e,projection:n,path:i,areas:this.areas,points:this.getPoints(),lines:this.lineData,layout:t})}applyCartogramTransform(t,e){const n=function(t,e,n,i){const o=t.filter(t=>"point"===t.type);if(2>o.length)return null;const r=e.strength??1;if(0===r)return null;const s=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:t=>t.id,a="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],c=o.find(t=>t.datum&&s(t.datum)+""==e.center+"");if(!c)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`),null;const l=c.x,u=c.y,h=o.map(t=>t.datum?a(t.datum):NaN).filter(t=>isFinite(t)&&t>=0),d=St(h,1),p=Math.min(n.width,n.height)/2,f=Jt().domain([0,d]).range([0,p]);i>0&&"production"!==process.env.NODE_ENV&&console.warn("GeoFrame: Distance cartogram does not support area rendering. Areas will be ignored. Remove areas or set projectionTransform to null to render them.");for(let e=t.length-1;e>=0;e--){const n=t[e];"geoarea"===n.type&&n.interactive&&t.splice(e,1)}for(const t of o){if(t===c)continue;if(!t.datum)continue;const e=Math.atan2(t.y-u,t.x-l),n=Math.sqrt((t.x-l)**2+(t.y-u)**2),i=a(t.datum),o=n+((isFinite(i)?f(i):n)-n)*r;t.x=l+Math.cos(e)*o,t.y=u+Math.sin(e)*o}const m=n.width/2,g=n.height/2,y=m-c.x,v=g-c.y;if(Math.abs(y)>.5||Math.abs(v)>.5)for(const t of o)t.x+=y,t.y+=v;const b={cx:m,cy:g,maxCost:d,availableRadius:p},w=t.filter(t=>"line"===t.type);if(w.length>0&&"fractional"!==e.lineMode){const t=new Map;for(const e of o)e.pointId&&t.set(e.pointId,[e.x,e.y]);for(const e of w){const n=e.datum?.source,i=e.datum?.target;if(n&&i){const o=t.get(n+""),r=t.get(i+"");o&&r&&(e.path=[o,r])}}}return b}(this.scene,t,e,this.areas.length);n&&(this.cartogramLayout=n)}applyDecay(){const t=this.config.decay;if(!t||!this.pointBuffer)return;const e=this.pointBuffer.size;if(0===e)return;const n=this.scene.filter(t=>"point"===t.type);for(let i=0;n.length>i;i++){const o=S(t,i,e);n[i]._decayOpacity=o,n[i].style={...n[i].style,opacity:o}}}applyPulse(t=this.currentTime()){const e=this.config.pulse;if(!e||!this.timestampBuffer)return!1;const n=this.scene.filter(t=>"point"===t.type),i=this.timestampBuffer.toArray(),o=e.color||"rgba(255,255,255,0.6)",r=e.glowRadius??4;let a=!1;for(let c=0;n.length>c&&i.length>c;c++){const l=s(e,i[c],t);a=h(n[c],l,o,r)||a}return a}refreshPulse(t){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(t)}hasActivePulsesAt(t){return!!this.config.pulse&&a(this.config.pulse,this.timestampBuffer,t)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}startTransition(t){const e=this.config.transition?.duration??300;if(0>=e)return;const n=new Map;for(const e of t)"point"===e.type&&e.pointId&&n.set(e.pointId,[e.x,e.y]);const i=this.scene.filter(t=>"point"===t.type);let o=!1;for(const t of i)if(t.pointId){const e=n.get(t.pointId);e&&(t._targetX=t.x,t._targetY=t.y,t.x=e[0],t.y=e[1],(Math.abs(e[0]-t._targetX)>.5||Math.abs(e[1]-t._targetY)>.5)&&(o=!0))}for(const t of i)t.pointId&&!n.has(t.pointId)&&(t._targetOpacity=t.style?.opacity??1,t.style={...t.style,opacity:0},o=!0);o&&(this.activeTransition={startTime:this.currentTime(),duration:e})}cancelIntroAnimation(){this.activeTransition=null}advanceTransition(t){if(!this.activeTransition)return!1;const e=et(t,this.activeTransition),n=tt(e),i=this.scene.filter(t=>"point"===t.type);for(const t of i){if(null!=t._targetX&&null!=t._targetY){const e=t.y;t.x=ut(t.x,t._targetX,n),t.y=ut(e,t._targetY,n)}null!=t._targetOpacity&&(t.style={...t.style,opacity:t._targetOpacity*n})}if(e>=1){for(const t of i)null!=t._targetX&&(t.x=t._targetX,t.y=t._targetY,t._targetX=void 0,t._targetY=void 0),null!=t._targetOpacity&&(t.style={...t.style,opacity:t._targetOpacity},t._targetOpacity=void 0);return this.activeTransition=null,!1}return!0}};ge.QUADTREE_THRESHOLD=500;var ye=ge;function ve(t,e,n,i,o,r,s=0,a=i){if(r){const t=R(r,e,n,i,s);if(t)return t}else{let o=null,r=i;for(const s of t){if("point"!==s.type)continue;const t=s.x-e,a=s.y-n,c=Math.sqrt(t*t+a*a);A(s.r,i)>=c&&r>c&&(o=s,r=c)}if(o)return{node:o,distance:r}}let c=null,l=i;for(const o of t){if("glyph"!==o.type)continue;if(null==o.datum)continue;const t=Rt(o.glyph,o.size),r=o.x+t.centerDx-e,s=o.y+t.centerDy-n,a=Math.sqrt(r*r+s*s);A(t.radius,i)>=a&&l>a&&(c=o,l=a)}if(c)return{node:c,distance:l};for(let i=t.length-1;i>=0;i--){const r=t[i];if("geoarea"!==r.type)continue;const s=r;if(!1===s.interactive)continue;const[[a,c],[l,u]]=s.bounds;if(!(a>e||e>l||c>n||n>u)&&(s._cachedPath2D||(s._cachedPath2D=new Path2D(s.pathData)),o.isPointInPath(s._cachedPath2D,e,n)))return{node:s,distance:0}}let u=null,h=a;for(const i of t){if("line"!==i.type)continue;const t=i,{path:o}=t,r=Math.max((t.style.strokeWidth||2)+4,5,a);for(let i=0;o.length-1>i;i++){const[s,a]=o[i],[c,l]=o[i+1],d=be(e,n,s,a,c,l);r>=d&&h>d&&(u=t,h=d)}}return u?{node:u,distance:h}:null}function be(t,e,n,i,o,r){const s=o-n,a=r-i,c=s*s+a*a;if(0===c)return Math.sqrt((t-n)**2+(e-i)**2);let l=((t-n)*s+(e-i)*a)/c;return l=Math.max(0,Math.min(1,l)),Math.sqrt((t-(n+l*s))**2+(e-(i+l*a))**2)}b(ye);import{useMemo as we,useRef as Pe}from"react";import{jsx as Le,jsxs as Se}from"react/jsx-runtime";function xe(t){const{width:e,height:n,totalWidth:i,totalHeight:o,margin:r,showAxes:s,title:a,legend:c,legendHoverBehavior:l,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:d,legendPosition:p,legendLayout:f,foregroundGraphics:m,annotations:g,onAnnotationActivate:y,onObservation:v,chartId:b,chartType:w,autoPlaceAnnotations:P,pointNodes:L}=t,S=bt({onAnnotationActivate:y,onObservation:v,chartId:b,chartType:w}),x=Pe([g?.length??0,new Map]),R=g?.length??0;x.current[0]!==R&&(x.current=[R,new Map]);const k=we(()=>{if(!g||0===g.length)return null;const t={scales:null,timeAxis:"x",width:e,height:n,frameType:"xy",pointNodes:L,stickyPositionCache:x.current[1]},i=P?V({annotations:g,context:t,..."object"==typeof P?P:{}}):g;return mt(i,nt("xy",S),void 0,t)},[g,P,e,n,L,S]);return s||a||c||m||k&&k.length>0?Se("svg",{role:"img",width:i,height:o,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[Le("title",{children:"string"==typeof a?a:"XY Chart"}),Le("desc",{children:"string"==typeof a?a+" (XY data visualization)":"XY data visualization"}),Se("g",{transform:"translate("+r.left+","+r.top+")",children:[k,m]}),a&&"string"==typeof a?Le("text",{x:i/2,y:Q,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?Le("foreignObject",{x:0,y:0,width:i,height:r.top,children:a}):null,gt({legend:c,totalWidth:i,totalHeight:o,margin:r,legendPosition:p,title:a,legendLayout:f,legendHoverBehavior:l,legendClickBehavior:u,legendHighlightedCategory:h,legendIsolatedCategories:d})]}):null}import{zoom as Re,zoomIdentity as ke}from"d3-zoom";import{select as Ae}from"d3-selection";function Ce([t,e,n]){const i=1<<n;return[t-Math.floor(t/i)*i,e,n]}function De(t,e,n,i,o){return"function"==typeof t?t(e,n,i,o):t.replace("{z}",e+"").replace("{x}",n+"").replace("{y}",i+"").replace("{r}",o>1?"@2x":"")}var je=class{constructor(t=256){this.cache=new Map,this.limit=t}get(t){const e=this.cache.get(t);return e&&(e.lastUsed=performance.now()),e}set(t,e){this.cache.set(t,e),this.cache.size>this.limit&&this.evict()}evict(){for(;this.cache.size>this.limit;){let t,e=1/0;for(const[n,i]of this.cache)e>i.lastUsed&&(e=i.lastUsed,t=n);if(!t)break;{const e=this.cache.get(t);e&&(e.img.onload=null,e.img.onerror=null,e.img.src=""),this.cache.delete(t)}}}clear(){for(const t of this.cache.values())t.img.onload=null,t.img.onerror=null,t.img.src="";this.cache.clear()}};var Te=class{constructor(t){this.capacity=t,this.particles=Array(t);for(let e=0;t>e;e++)this.particles[e]={t:0,offset:0,lineIndex:0,active:!1,x:0,y:0}}spawn(t,e=Math.random){for(let n=0;this.capacity>n;n++){const i=this.particles[n];if(!i.active)return i.active=!0,i.t=0,i.offset=.6*(e()-.5),i.lineIndex=t,i.x=0,i.y=0,i}return null}step(t,e,n,i){for(let o=0;this.capacity>o;o++){const r=this.particles[o];if(!r.active)continue;const s=n[r.lineIndex];if(!s||2>s.length){r.active=!1;continue}if(r.t+=t*e,r.t>=1){r.active=!1;continue}const a=Me(s),c=Be(s,r.t*a),l=(i[r.lineIndex]||2)/2;r.x=c.x+c.nx*r.offset*l*2,r.y=c.y+c.ny*r.offset*l*2}}countForLine(t){let e=0;for(let n=0;this.capacity>n;n++)this.particles[n].active&&this.particles[n].lineIndex===t&&e++;return e}clear(){for(let t=0;this.capacity>t;t++)this.particles[t].active=!1}};function Me(t){let e=0;for(let n=1;t.length>n;n++){const i=t[n][0]-t[n-1][0],o=t[n][1]-t[n-1][1];e+=Math.sqrt(i*i+o*o)}return e}function Be(t,e){let n=0;for(let i=1;t.length>i;i++){const o=t[i][0]-t[i-1][0],r=t[i][1]-t[i-1][1],s=Math.sqrt(o*o+r*r);if(n+s>=e||i===t.length-1){const a=s>0?(e-n)/s:0,c=s>.001?s:1;return{x:t[i-1][0]+o*a,y:t[i-1][1]+r*a,nx:-r/c,ny:o/c}}n+=s}const i=t[t.length-1];return{x:i[0],y:i[1],nx:0,ny:0}}function _e(t){if(!t)return;const e=[];for(const n of t)if("point"===n.type)e.push(n);else if("glyph"===n.type){const t=n,i=Rt(t.glyph,t.size);e.push({pointId:t.pointId,x:t.x+i.centerDx,y:t.y+i.centerDy,r:i.radius})}return e}import{jsx as Ie,jsxs as Ee}from"react/jsx-runtime";function Ne({data:t}){if(!t)return null;if(t.properties)return Ie("div",{className:"semiotic-tooltip",style:it,children:Ie("div",{style:{fontWeight:600},children:t.properties.name||t.properties.NAME||t.properties.id||"Feature"})});const e=null!=t.data?t.data:t;if(!e||"object"!=typeof e)return null;const n=vt(e),i=null!=n.title?n.title+"":null;return null==i&&0===n.entries.length?null:Ee("div",{className:"semiotic-tooltip",style:it,children:[null!=i&&Ie("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:i}),n.entries.map(t=>Ee("div",{children:[Ee("span",{style:{opacity:.7},children:[t.key,": "]}),Ie("span",{style:{fontWeight:600},children:k(t.value)})]},t.key))]})}Ne.ownsChrome=!0;var Oe={top:10,right:10,bottom:10,left:10},Fe=null;function We(){if(null!==Fe)return Fe;if("undefined"==typeof window)return!1;const t="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,e="undefined"!=typeof navigator&&"number"==typeof navigator.hardwareConcurrency&&4>=navigator.hardwareConcurrency,n="undefined"!=typeof navigator&&"number"==typeof navigator.deviceMemory&&4>=navigator.deviceMemory;return Fe=t||e||n}function ze(){return We()?12:30}var He={width:28,height:28,border:"1px solid rgba(0,0,0,0.2)",borderRadius:4,background:"rgba(255,255,255,0.9)",color:"#333",fontSize:16,fontWeight:600,lineHeight:1,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,boxShadow:"0 1px 3px rgba(0,0,0,0.1)"};function Ge(t){return"string"==typeof t?t:"object"==typeof t&&t&&"type"in t?t.type:null}function qe(t){return t?t.getContext("2d"):null}import{jsx as Ze,jsxs as Ye}from"react/jsx-runtime";var Xe=Et(It(function(t,e){const{projection:o,projectionExtent:r,fitPadding:s,projectionTransform:a,areas:l,points:h,lines:b,customLayout:w,layoutConfig:P,layoutSelection:S,onLayoutError:x,xAccessor:R,yAccessor:k,lineDataAccessor:A,pointIdAccessor:E,lineIdAccessor:O,lineType:F="geo",flowStyle:Z="basic",graticule:Q,zoomable:$,zoomExtent:V,onZoom:tt,dragRotate:et,showParticles:nt,particleStyle:it,tileURL:ut,tileAttribution:ht,tileCacheSize:dt,size:mt,width:gt,height:vt,responsiveWidth:bt,responsiveHeight:St,margin:Rt,className:kt,background:It,windowSize:Et=500,renderMode:Nt,areaStyle:Ot,pointStyle:Ft,lineStyle:Wt,colorScheme:zt,enableHover:Ht=!0,hoverAnnotation:Gt,tooltipContent:qt,allowTooltipOverflow:Zt=!1,customClickBehavior:Yt,customHoverBehavior:Xt,onObservation:Ut,annotationObservationCallback:Qt,chartId:$t,annotations:Vt,onAnnotationActivate:Kt,autoPlaceAnnotations:Jt,decay:te,pulse:ee,transition:ne,animate:ie,staleness:oe,frameScheduler:re,clock:se,random:ae,seed:ce,paused:le=!1,suspendWhenHidden:ue=!0,backgroundGraphics:he,foregroundGraphics:de,title:pe,legend:fe,legendPosition:me,legendLayout:ge,legendHoverBehavior:be,legendClickBehavior:we,legendHighlightedCategory:Pe,legendIsolatedCategories:Le,legendCategoryAccessor:Se,onCategoriesChange:Me,showAxes:Be,accessibleTable:Ie=!0,description:Ee,summary:Fe}=t,{customHoverBehavior:Xe,customClickBehavior:Ue,hasClickBehavior:Qe}=f({customHoverBehavior:Xt,customClickBehavior:Yt,onObservation:Ut,chartId:$t,chartType:"StreamGeoFrame"}),$e=mt||[gt||600,vt||400],Ve=Dt(!0),Ke=wt({sizeProp:$e,responsiveWidth:bt,responsiveHeight:St,userMargin:Rt,marginDefault:Oe,title:pe,legend:fe,legendPosition:me,foregroundGraphics:de,backgroundGraphics:he,animate:ie,transitionProp:ne,frameScheduler:re,clock:se,random:ae,seed:ce,paused:le,suspendWhenHidden:ue,themeDirtyRef:Ve}),{reducedMotionRef:Je,responsiveRef:tn,size:en,margin:nn,adjustedWidth:on,adjustedHeight:rn,resolvedForeground:sn,resolvedBackground:an,transition:cn,introEnabled:ln,tableId:un,frameRuntime:hn,rafRef:dn,renderFnRef:pn,scheduleRender:fn,currentTheme:mn}=Ke,gn=At(),yn=Ct(),vn=Mt(()=>Array.isArray(l)?ot(l):l,[l]),bn=Mt(()=>ot(h),[h]),wn=Mt(()=>ot(b),[b]),Pn=Mt(()=>null!=et?et:"orthographic"===Ge(o),[et,o]),Ln=Mt(()=>({projection:o,projectionExtent:r,fitPadding:s,xAccessor:R,yAccessor:k,lineDataAccessor:A,lineType:F,flowStyle:Z,areaStyle:Ot,pointStyle:Ft,lineStyle:Wt,colorScheme:zt,themeSemantic:xt(mn),themeSequential:mn?.colors?.sequential,themeDiverging:mn?.colors?.diverging,themeCategorical:mn?.colors?.categorical,graticule:Q,projectionTransform:a,windowSize:Et,clock:hn.now,decay:te,pulse:ee,transition:cn,introAnimation:ln,annotations:Vt,pointIdAccessor:E,lineIdAccessor:O,customLayout:w,layoutConfig:P,onLayoutError:x,layoutMargin:nn}),[o,r,s,R,k,A,F,Z,Ot,Ft,Wt,zt,mn,Q,a,Et,hn.now,te,ee,cn,ln,Vt,E,O,w,P,x,nn]),Sn=_(Ln),xn=Dt(null);xn.current||(xn.current=new ye(Sn));const Rn=Dt(null),kn=Dt(null),An=Dt(null);ut&&!An.current&&(An.current=new je(dt||256));const Cn=Dt(Vt),Dn=Dt(null),jn=Dt(ke),Tn=Dt(!1),Mn=Dt(null),Bn=Bt(t=>{Mn.current=t,tn&&"object"==typeof tn&&(tn.current=t)},[tn]),_n=Dt(null),In=Dt(null),En=Dt(null),Nn=Dt(0);if(nt&&!En.current){const t=it?.maxPerLine??ze();En.current=new Te(50*t)}const On=Dt(null),Fn=Dt(null),Wn=Dt(!1),zn=Dt(!1),Hn=Lt("StreamGeoFrame"),Gn=Dt(void 0),[qn,Zn]=jt(null),[,Yn]=jt(0),Xn=Dt(0),[Un,Qn]=jt(!1),$n=p(xn,Se,Me,t=>t.getPoints());M(xn,Sn,Ve,fn),B(xn,S,Ve,fn),Tt(()=>{const t=xn.current;t&&(vn&&t.setAreas(vn),h&&t.setPoints(bn),b&&t.setLines(wn),Ve.current=!0,fn())},[vn,h,bn,b,wn,fn]);const Vn=Bt(t=>{null!=t&&"object"==typeof t&&(xn.current?.pushPoint(t),Ve.current=!0,fn())},[fn]),Kn=Bt(t=>{const e=ot(t);0!==e.length&&(xn.current?.pushMany(e),Ve.current=!0,fn())},[fn]),Jn=Bt(t=>{null!=t&&"object"==typeof t&&(xn.current?.pushLine(t),Ve.current=!0,fn())},[fn]),ti=Bt(t=>{const e=ot(t);0!==e.length&&(xn.current?.pushManyLines(e),Ve.current=!0,fn())},[fn]),ei=Bt(()=>{xn.current?.clear(),Ve.current=!0,fn()},[fn]);_t(e,()=>({push:Vn,pushMany:Kn,removePoint:t=>{const e=xn.current?.removePoint(t)??[];return e.length>0&&(Ve.current=!0,fn()),e},pushLine:Jn,pushManyLines:ti,removeLine:t=>{const e=xn.current?.removeLine(t)??[];return e.length>0&&(Ve.current=!0,fn()),e},getLines:()=>xn.current?.getLines()??[],clear:ei,getProjection:()=>xn.current?.scales?.projection??null,getGeoPath:()=>xn.current?.scales?.geoPath??null,getCartogramLayout:()=>xn.current?.cartogramLayout??null,getCustomLayout:()=>xn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>xn.current?.lastCustomLayoutFailure??null,getZoom:()=>jn.current.k,resetZoom:()=>{const t=Mn.current;t&&Dn.current&&Ae(t).call(Dn.current.transform,ke)},getData:()=>xn.current?.getPoints()??[]}),[Vn,Kn,Jn,ti,ei,fn]);const{hoverHandlerRef:ni,onPointerMove:ii,onPointerLeave:oi}=Ke,{canvasRef:ri,interactionCanvasRef:si}=Pt(Ke,{hydrated:gn,wasHydratingFromSSR:yn,storeRef:xn,dirtyRef:Ve,cleanup:()=>An.current?.clear(),canvasPaintDependencies:[on,rn,It,he,Nt,fn]});Tt(()=>{ni.current=t=>{if(!Ht)return;const e=xn.current;if(!e||!e.scene.length)return;const n=ri.current;if(!n)return;const i=n.getBoundingClientRect(),o=t.clientX-i.left-nn.left,r=t.clientY-i.top-nn.top;if(0>o||o>on||0>r||r>rn)return On.current=null,Fn.current=null,Zn(null),Xe?.(null),void fn();kn.current||(kn.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=qe(kn.current);if(!s)return;const a=at(30,t.pointerType),c=at(6,t.pointerType),l=ve(e.scene,o,r,a,s,e.quadtree,e.maxPointRadius,c);if(l){const t=l.node,e=t.datum,n=Array.isArray(e)?null:e?.properties?e:e?.data||e;let i,s;"point"===t.type?(i=t.x,s=t.y):"geoarea"===t.type?(i=t.centroid[0],s=t.centroid[1]):(i=o,s=r);const a={...n,...n?.properties||{},data:n,properties:n?.properties,__semioticHoverData:!0,x:i,y:s};On.current=a,Fn.current=t,Zn(a),Xe?.(a),fn()}else On.current&&(On.current=null,Fn.current=null,Zn(null),Xe?.(null),fn())}},[Ht,on,rn,nn,Xe,fn,ni,ri]),Ke.hoverLeaveRef.current=()=>{On.current=null,Fn.current=null,Zn(null),Xe?.(null),fn()};const ai=Bt(t=>{if(ct(t.target))return;if(!Ue)return;const e=xn.current;if(!e||!e.scene.length)return void Ue(null);const n=t.currentTarget.getBoundingClientRect(),i=t.clientX-n.left-nn.left,o=t.clientY-n.top-nn.top;if(0>i||i>on||0>o||o>rn)return void Ue(null);kn.current||(kn.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=qe(kn.current);if(!r)return void Ue(null);const s=at(30,Gn.current),a=at(6,Gn.current),c=ve(e.scene,i,o,s,r,e.quadtree,e.maxPointRadius,a);if(c){const t=c.node.datum,e=Array.isArray(t)?null:t?.properties?t:t?.data||t,n=e?.properties?{...e,...e.properties}:e;return void Ue({...n,data:e,properties:e?.properties,__semioticHoverData:!0,x:i,y:o,time:i,value:o},{type:"activate",inputType:pt(Gn.current)})}Ue(null)},[rn,on,Ue,nn]),{kbFocusIndexRef:ci,focusedNavPointRef:li,onKeyDown:ui}=d({storeRef:xn,hoverRef:On,hoveredNodeRef:Fn,setHoverPoint:Zn,customHoverBehavior:Xe,customClickBehavior:Ue,scheduleRender:fn}),hi=Bt(t=>{Gn.current=t.pointerType,ci.current=-1,li.current=null,ii(t)},[li,ci,ii]),di=Bt(t=>{Gn.current=t.pointerType},[]);pn.current=()=>{if(dn.current=null,!hn.isActive)return;const t=ri.current,e=xn.current;if(!t||!e)return;const o=hn.now();let r=!1;const s=In.current;let a=!1;s&&(In.current=null,e.applyRotation(s,{width:on,height:rn}),a=!0);const l=e.advanceTransition(Je.current?o+1e6:o),h=!Je.current&&l,d=Hn.current.beforeCompute(e.getLastUpdateResult(),h);let p=!1;if(Ve.current&&!l){const n={width:on,height:rn},i=Pn?e.getRotation():null;e.computeScene(n);const o=jn.current,r=1!==o.k||0!==o.x||0!==o.y;Pn&&i?r?(e.setRotation(i),e.applyZoomScale(o.k,n)):e.applyRotation(i,n):r&&e.applyZoomTransform(o,n),Ve.current=!1,p=!0,t.setAttribute("aria-label",J(e.scene,"Geographic chart")),$n()}Hn.current.afterCompute(d,p,!1);const f=st(),v=nt&&!Je.current&&!!En.current,b=e.consumeStylePaintPending(),w=u(e,o,p,zn),P=m({dirtyOrRebuilt:p,transitioning:h,continuous:v,liveEncoding:w.changed,forced:a||b});if(ut&&An.current){const t=Rn.current;if(t&&e.scales?.projection){const n=ft(t,en,nn,f);if(n){n.clearRect(-nn.left,-nn.top,en[0],en[1]),n.save(),n.beginPath(),n.rect(0,0,on,rn),n.clip();const t=function(t,e){const{tileURL:n,projection:i,width:o,height:r,tileCache:s,onTileLoad:a}=e,c=i.scale(),l=i.translate(),u=function(t){const{size:e,scale:n,translate:i,clampX:o=!0,clampY:r=!0}=t,s=Math.max(Math.log(n)/Math.LN2-8,0),a=Math.round(s),c=1<<a,l=Math.pow(2,s-a+8),u=i[0]-n/2,h=i[1]-n/2,d=Math.max(o?0:-1/0,Math.floor((0-u)/l)),p=Math.min(o?c:1/0,Math.ceil((e[0]-u)/l)),f=Math.max(r?0:-1/0,Math.floor((0-h)/l)),m=Math.min(r?c:1/0,Math.ceil((e[1]-h)/l)),g=[];for(let t=f;m>t;++t)for(let e=d;p>e;++e)g.push([e,t,a]);return{tiles:g,translate:[u/l,h/l],scale:l}}({size:[o,r],scale:2*c*Math.PI,translate:l}),h=st();let d=!0;for(const e of u.tiles){const[i,o,r]=Ce(e),c=`${r}/${i}/${o}`;let l=s.get(c);if(!l){const t=new Image;t.crossOrigin="anonymous";const e={img:t,loaded:!1,key:c,lastUsed:performance.now()};s.set(c,e),t.onload=()=>{e.loaded=!0,a?.()},t.onerror=()=>{e.loaded=!0},t.src=De(n,r,i,o,h),l=e}if(!l.loaded){d=!1;continue}const p=u.scale;t.drawImage(l.img,(e[0]+u.translate[0])*p-.5,(e[1]+u.translate[1])*p-.5,p+1,p+1)}return d}(n,{tileURL:ut,projection:e.scales.projection,width:on,height:rn,tileCache:An.current,onTileLoad:()=>fn()});n.restore(),t||(r=!0)}}}if(P){const i=ft(t,en,nn,f);if(!i)return;i.clearRect(-nn.left,-nn.top,en[0],en[1]),ut||y(i,{background:It,hasBackgroundGraphics:!!he,width:on,height:rn}),i.save(),i.beginPath(),i.rect(0,0,on,rn),i.clip();const s=e.scene,a=e.scales,l={width:on,height:rn};if(D({context:i,nodes:s,renderMode:Nt,pixelRatio:f,paintBuiltIn:t=>{!function(t,e){const n=e.filter(t=>"geoarea"===t.type);for(const e of n){if(!e.pathData)continue;e._cachedPath2D||(e._cachedPath2D=new Path2D(e.pathData));const n=e._cachedPath2D,i=K(t,e.style.fill)||"#e0e0e0";if("none"!==i&&(t.fillStyle=i,t.globalAlpha=(e._decayOpacity??1)*(e.style.fillOpacity??1),t.fill(n)),e.style.stroke&&"none"!==e.style.stroke){if(t.strokeStyle=yt(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||.5,t.globalAlpha=e._decayOpacity??1,e.style.strokeDasharray){const n=e.style.strokeDasharray.split(",").map(Number);t.setLineDash(n)}else t.setLineDash([]);t.stroke(n)}j(t,e,n),t.globalAlpha=1,t.setLineDash([])}}(i,t),n(i,t,a,l),c(i,t,a,l),C(i,t,a,l)}}),v&&En.current){const t=En.current,e=s.filter(t=>"line"===t.type);if(e.length>0){const n=it||{},s=.3*(n.speedMultiplier??1),a=n.maxPerLine??ze(),c=n.spawnRate??(We()?.06:.15),l=n.radius??2,u=n.opacity??.7,h=o/1e3,d=Nn.current>0?Math.min(h-Nn.current,.1):.016;Nn.current=h;const p=e.map(t=>t.path),f=e.map(t=>t.style.strokeWidth||2);for(let n=0;e.length>n;n++)hn.random()<c&&t.countForLine(n)<a&&t.spawn(n,hn.random);t.step(d,s,p,f),i.globalAlpha=u;for(let o=0;t.particles.length>o;o++){const r=t.particles[o];if(!r.active)continue;const s=e[r.lineIndex],a="function"==typeof n.color?n.color(s?.datum??{}):"source"!==n.color&&n.color?n.color:s?.style.stroke||"#fff";i.beginPath(),i.arc(r.x,r.y,l,0,2*Math.PI),i.fillStyle=a,i.fill()}i.globalAlpha=1,r=!0}}i.restore()}const L=Fn.current,S=!(!L||"geoarea"!==L.type&&"point"!==L.type),x=g(S,Wn.current),R=si.current;if(R&&x){const t=ft(R,en,nn,f);if(t){if(t.clearRect(-nn.left,-nn.top,en[0],en[1]),L&&"geoarea"===L.type){const e=new Path2D(L.pathData);t.fillStyle="rgba(255, 255, 255, 0.3)",t.fill(e),t.strokeStyle="rgba(0, 0, 0, 0.5)",t.lineWidth=2,t.stroke(e)}if(L&&"point"===L.type){const e=L,n="object"==typeof Gt?Gt:void 0,o=n?.pointColor||i(L);t.beginPath(),t.arc(e.x,e.y,e.r+3,0,2*Math.PI),o?(t.save(),t.globalAlpha=.4,t.fillStyle=o,t.fill(),t.restore()):(t.fillStyle="rgba(255, 255, 255, 0.4)",t.fill()),t.strokeStyle=o||"rgba(0, 0, 0, 0.5)",t.lineWidth=2,t.stroke()}}Wn.current=S}const k=Vt!==Cn.current;k&&(Cn.current=Vt),(p||k||h&&Vt&&Vt.length>0)&&(p||k||o-Xn.current>=33)&&(Yn(t=>t+1),Xn.current=o),(h||null!=e.activeTransition||w.pending||r)&&fn()},I(oe,xn,Ve,fn,Un,Qn),Tt(()=>{if("production"!==process.env.NODE_ENV&&ut){const t=Ge(o);t&&"mercator"!==t&&console.warn(`[StreamGeoFrame] tileURL is set but projection is "${t}". Raster tiles use Web Mercator and will not align with other projections.`)}},[ut,o]),Tt(()=>{const t=Mn.current;if(!$||!t)return Dn.current&&t&&(Ae(t).on(".zoom",null),Dn.current=null),void(t&&Ae(t).on("mousedown.rotate",null).on("touchstart.rotate",null));const[e,n]=V||[1,8],i={width:on,height:rn};if(Pn){let o=jn.current.k;const r=t=>{o=Math.max(e,Math.min(n,t)),jn.current=ke.scale(o);const r=xn.current;r&&(r.applyZoomScale(o,i),Ve.current=!1,fn(),r.scales?.projection&&tt?.({projection:r.scales.projection,zoom:r.currentZoom}))};Dn.current={scaleBy:(t,e)=>r(o*e),transform:(t,e)=>r(e?.k??1)};const s=t=>{t.preventDefault(),r(o*(0>t.deltaY?1.1:1/1.1))},a=t=>{const e=t.target;e&&(e.closest("button")||e.closest(".stream-geo-zoom-controls"))||(t.preventDefault(),r(1.5*o))};t.addEventListener("wheel",s,{passive:!1}),t.addEventListener("dblclick",a);const c=.4,l=e=>{if(0!==e.button)return;const n=e.target;if(n.closest("button")||n.closest(".stream-geo-zoom-controls"))return;const i=xn.current;if(!i)return;const o=i.getRotation();_n.current={x:e.clientX,y:e.clientY,rotation:[...o]},t.setPointerCapture(e.pointerId),e.preventDefault()},u=t=>{const e=_n.current;e&&(In.current=[e.rotation[0]+(t.clientX-e.x)*c,Math.max(-90,Math.min(90,e.rotation[1]-(t.clientY-e.y)*c)),e.rotation[2]],fn())},h=e=>{if(!_n.current)return;_n.current=null,t.releasePointerCapture(e.pointerId);const n=In.current;if(n){In.current=null;const t=xn.current;t&&(t.applyRotation(n,i),fn())}const o=xn.current;o?.scales?.projection&&tt?.({projection:o.scales.projection,zoom:o.currentZoom})};return t.addEventListener("pointerdown",l),t.addEventListener("pointermove",u),t.addEventListener("pointerup",h),t.addEventListener("pointercancel",h),()=>{t.removeEventListener("wheel",s),t.removeEventListener("dblclick",a),t.removeEventListener("pointerdown",l),t.removeEventListener("pointermove",u),t.removeEventListener("pointerup",h),t.removeEventListener("pointercancel",h),Dn.current=null}}const o=Re().scaleExtent([e,n]).extent([[0,0],[en[0],en[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",t=>{const e=t.transform;jn.current=e,Tn.current=!0;const n=xn.current;n&&(n.applyZoomTransform(e,i),Ve.current=!1,fn())}).on("end",t=>{jn.current=t.transform,Tn.current=!1;const e=xn.current;e?.scales?.projection&&tt?.({projection:e.scales.projection,zoom:e.currentZoom})});return Dn.current=o,Ae(t).call(o),()=>{Ae(t).on(".zoom",null)}},[$,V,Pn,en,on,rn,nn,tt,fn]);const pi=Ht&&!1!==Gt,fi=pi&&qn?qt?qt(qn):Ze(Ne,{data:qn}):null,mi=fi?Ze(G,{x:qn.x,y:qn.y,containerWidth:on,containerHeight:rn,margin:nn,className:"stream-frame-tooltip",zIndex:10,children:fi}):null;if(lt||!gn&&yn){const t=xn.current;t&&(vn||h||b)&&(vn&&t.setAreas(vn),h&&t.setPoints(bn),b&&t.setLines(wn),t.computeScene({width:on,height:rn}));const e=t?.scene??[];return Ye("div",{ref:Bn,className:"stream-geo-frame"+(kt?" "+kt:""),role:"img","aria-label":Ee||("string"==typeof pe?pe:"Geographic chart"),style:{position:"relative",width:bt?"100%":en[0],height:St?"100%":en[1]},children:[Ze(X,{summary:Fe}),Ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:en[0],height:en[1],style:{position:"absolute",left:0,top:0},children:[Ze("g",{transform:`translate(${nn.left},${nn.top})`,children:an}),Ye("g",{transform:`translate(${nn.left},${nn.top})`,children:[It&&Ze("rect",{x:0,y:0,width:on,height:rn,fill:It}),e.map((t,e)=>T({node:t,index:e,renderMode:Nt,fallback:()=>rt(t,e)}))]})]}),Ze(xe,{width:on,height:rn,totalWidth:en[0],totalHeight:en[1],margin:nn,showAxes:!1,title:pe,legend:fe,legendPosition:me,legendLayout:ge,legendHoverBehavior:be,legendClickBehavior:we,legendHighlightedCategory:Pe,legendIsolatedCategories:Le,foregroundGraphics:L(sn,N(xn.current?.customLayoutOverlays,S??null)),annotations:Vt,onAnnotationActivate:Kt,onObservation:Qt??Ut,chartId:$t,chartType:"StreamGeoFrame",autoPlaceAnnotations:Jt,pointNodes:_e(e)})]})}return Ye("div",{ref:Bn,className:"stream-geo-frame"+(kt?" "+kt:""),role:"group","aria-label":Ee||("string"==typeof pe?pe:"Geographic chart"),tabIndex:0,style:{position:"relative",width:bt?"100%":en[0],height:St?"100%":en[1],overflow:Zt?"visible":"hidden",...$?{touchAction:"none"}:{}},onKeyDown:ui,children:["production"!==process.env.NODE_ENV&&xn.current&&Ze(Y,{store:xn.current,diagnostics:Hn.current}),Ie&&Ze(U,{tableId:un}),Ie&&Ze(W,{scene:xn.current?.scene??[],chartType:"Geographic chart",tableId:un,chartTitle:"string"==typeof pe?pe:void 0}),Ze(X,{summary:Fe}),Ze(z,{hoverPoint:qn}),Ye("div",{role:"img","aria-label":Ee||("string"==typeof pe?pe:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:pi?hi:void 0,onPointerLeave:pi?oi:void 0,onPointerDown:pi||Qe?di:void 0,onClick:Qe?ai:void 0,children:[Ze(H,{size:en,margin:nn,children:an}),ut&&Ze("canvas",{ref:Rn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Ze("canvas",{ref:ri,"aria-label":J(xn.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),Ze("canvas",{ref:si,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Ze(xe,{width:on,height:rn,totalWidth:en[0],totalHeight:en[1],margin:nn,showAxes:Be,title:pe,legend:fe,legendPosition:me,legendLayout:ge,legendHoverBehavior:be,legendClickBehavior:we,legendHighlightedCategory:Pe,legendIsolatedCategories:Le,foregroundGraphics:L(sn,N(xn.current?.customLayoutOverlays,S??null)),annotations:Vt,onAnnotationActivate:Kt,onObservation:Qt??Ut,chartId:$t,chartType:"StreamGeoFrame",autoPlaceAnnotations:Jt,pointNodes:_e(xn.current?.scene)}),oe?.showBadge&&Ze(v,{isStale:Un,position:oe.badgePosition}),$&&Ye("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:nn.bottom+8,left:nn.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[Ze("button",{type:"button","aria-label":"Zoom in",onClick:t=>{t.stopPropagation();const e=Mn.current,n=Dn.current;e&&n?.scaleBy&&n.scaleBy(Ae(e),1.5)},style:He,children:"+"}),Ze("button",{type:"button","aria-label":"Zoom out",onClick:t=>{t.stopPropagation();const e=Mn.current,n=Dn.current;e&&n?.scaleBy&&n.scaleBy(Ae(e),1/1.5)},style:He,children:"−"})]}),ht&&Ze("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:nn.bottom+2,right:nn.right+4,fontSize:10,color:"rgba(0,0,0,0.6)",background:"rgba(255,255,255,0.7)",padding:"1px 4px",borderRadius:2,pointerEvents:"none",zIndex:2},children:ht}),Ze(q,{active:ci.current>=0,hoverPoint:qn,margin:nn,size:en,shape:li.current?.shape,width:li.current?.w,height:li.current?.h,pathData:li.current?.pathData}),mi]})]})}));Xe.displayName="StreamGeoFrame";var Ue=Xe;import{forwardRef as Qe,useMemo as $e}from"react";import{jsx as Ve}from"react/jsx-runtime";var Ke=Qe(function(n,i){const{points:o,areas:r,lines:s,layout:a,layoutConfig:c,onLayoutError:l,projection:u="equirectangular",xAccessor:h="lon",yAccessor:d="lat",lineDataAccessor:p,colorBy:f,colorScheme:m,tooltip:g,annotations:y,margin:v,selection:b,linkedHover:L,onObservation:S,onClick:x,chartId:R,loading:k,loadingContent:A,emptyContent:C,className:D,frameProps:j={}}=n,{frameRef:T,resolved:M,normalizedMargin:B}=e({imperativeRef:i,imperativeVariant:"geo-points",margin:v,width:n.width,height:n.height,enableHover:n.enableHover,title:n.title,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable,mode:n.mode,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),_=$e(()=>ot(o),[o]),I=$e(()=>ot(r),[r]),E=$e(()=>ot(s),[s]),N=$e(()=>[..._,...E,...I],[_,E,I]),O=t({data:N,rawData:void 0!==o||void 0!==s||void 0!==r?N:void 0,colorBy:f,colorScheme:m,legendInteraction:void 0,selection:b,linkedHover:L,fallbackFields:"string"==typeof f?[f]:[],unwrapData:!1,onObservation:S,onClick:x,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"GeoCustomChart",chartId:R,showLegend:!1,userMargin:B,marginDefaults:M.marginDefaults,loading:k,loadingContent:A,emptyContent:C,width:M.width,height:M.height}),F=O.effectiveSelectionHook,W=$e(()=>F?.isActive?{isActive:!0,predicate:F.predicate}:null,[F?.isActive,F?.predicate]);if(O.earlyReturn)return O.earlyReturn;const{width:z,height:H,enableHover:G,title:q,description:Z,summary:Y,accessibleTable:X}=M,U=ht(g),Q={projection:u,...null!=o&&{points:_},...null!=r&&{areas:I},...null!=s&&{lines:E},xAccessor:h,yAccessor:d,...null!=p&&{lineDataAccessor:p},customLayout:a,layoutConfig:c,onLayoutError:l,layoutSelection:W,colorBy:f,colorScheme:m,size:[z,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:O.margin,enableHover:G,...w({title:q,description:Z,summary:Y,accessibleTable:X,className:D,animate:n.animate,autoPlaceAnnotations:n.autoPlaceAnnotations}),...!1===g?{tooltipContent:()=>null}:U?{tooltipContent:U}:{},...P({linkedHover:L,selection:b,onObservation:S,onClick:x,hoverHighlight:!1,mobileInteraction:O.mobileInteraction,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior,linkedHoverInClickPredicate:!1}),...y&&y.length>0&&{annotations:y},...j};return Ve(kt,{componentName:"GeoCustomChart",width:z,height:H,children:Ve(Ue,{ref:T,...Q})})});Ke.displayName="GeoCustomChart";export{Ue as StreamGeoFrame_default,Ke as GeoCustomChart};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{useEffect as e,useMemo as n,useRef as t}from"react";function r(e,n,t,r){const o=new Map;t.forEach((e,n)=>{o.set(r?r(e,n):n+"",e)});const u=[];n.forEach((e,n)=>{o.has(n)||u.push(n)}),u.length>0&&e.remove?.(u);const s=[];if(o.forEach((t,r)=>{const o=n.get(r);void 0===o?s.push(t):o!==t&&(e.update?e.update(r,()=>t):(e.remove?.(r),s.push(t)))}),s.length>0)if(e.pushMany)e.pushMany(s);else if(e.push)for(const n of s)e.push(n);return o}function o(o,u,s={}){const{id:c,resetKey:a}=s,p=n(()=>function(e){return null==e?null:"function"==typeof e?(n,t)=>{const r=e(n,t);return null==r?t+"":r+""}:(n,t)=>{const r=n[e];return null==r?t+"":r+""}}(c),[c]),l=t({map:new Map,handle:null,resetKey:void 0});e(()=>{const e=o.current;if(!e)return;const n=l.current;n.handle===e&&n.resetKey===a||(e.clear?.(),n.map=new Map,n.handle=e,n.resetKey=a),n.map=r(e,n.map,u,p)},[o,u,p,a])}export{r as syncPushBuffer,o as useSyncedPushData};
@@ -0,0 +1 @@
1
+ var e=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,t=new WeakMap,n=0,r=!1,i=null,o=null;function a(a,u){if(!u)return u;const d=e.exec(u);if(!d)return u;const c=a.canvas;if(!c)return d[2]?.trim()||u;!function(){if(r)return;if("undefined"==typeof window||"undefined"==typeof document)return;r=!0;const e=()=>{n++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]}),"function"==typeof window.matchMedia)try{i=window.matchMedia("(prefers-color-scheme: dark)"),o=e,"function"==typeof i.addEventListener?i.addEventListener("change",o):"function"==typeof i.addListener&&i.addListener(o)}catch{}}();let s=t.get(c);s&&s.version===n||(s={version:n,map:new Map},t.set(c,s));const f=s.map.get(u);if(void 0!==f)return f;const m=getComputedStyle(c).getPropertyValue(d[1]).trim()||d[2]?.trim()||u;return s.map.set(u,m),m}function u(e){n++}function d(){return n}export{a as resolveCSSColor,u as clearCSSColorCache,d as getCSSColorCacheVersion};
@@ -0,0 +1 @@
1
+ import{getMinMax as e}from"./chunk-chunk-JJ2OOIET.module.min.js";function t(t,a){const{field:r,bins:s=10}=a,o=t.map(e=>Number(e[r])).filter(e=>!isNaN(e));if(0===o.length)return[];const[n,c]=e(o),l=a.domain?a.domain[0]:n,d=a.domain?a.domain[1]:c;if(l===d)return[{category:`${l}-${d}`,value:o.length}];const u=(d-l)/s,f=Array(s).fill(0);for(const e of o){let t=Math.floor((e-l)/u);t===s&&(t=s-1),t>=0&&s>t&&f[t]++}return f.map((e,t)=>{const a=l+t*u,r=a+u;return{category:`${i(a)}-${i(r)}`,value:e}})}function a(t,a){const{groupBy:r,value:s,agg:i="sum"}=a,o=new Map;for(const e of t){const t=e[r]+"";o.has(t)||o.set(t,[]),o.get(t).push(Number(e[s]))}const n=[];for(const[t,a]of o){let s;switch(i){case"count":s=a.length;break;case"mean":s=a.reduce((e,t)=>e+t,0)/a.length;break;case"min":s=e(a)[0];break;case"max":s=e(a)[1];break;default:s=a.reduce((e,t)=>e+t,0)}n.push({[r]:t,value:s})}return n}function r(e,t){const{key:a,fields:r}=t,s=new Map;for(const t of e){const e=t[a]+"";if(s.has(e)||s.set(e,[]),r){const a={};for(const e of r)e in t&&(a[e]=t[e]);s.get(e).push(a)}else s.get(e).push({...t})}const i=[];for(const[e,t]of s)i.push({id:e,coordinates:t});return i}function s(e,t){const{columns:a,nameField:r="name",valueField:s="value"}=t,i=new Set(a),o=[];for(const t of e){const e={};for(const a of Object.keys(t))i.has(a)||(e[a]=t[a]);for(const i of a)o.push({...e,[r]:i,[s]:t[i]})}return o}function i(e){return Math.round(1e3*e)/1e3+""}function o(e){if(!e)return{type:"",markProps:{}};if("string"==typeof e)return{type:e,markProps:{}};const{type:t,...a}=e;return{type:t,markProps:a}}function n(e){return"nominal"===e||"ordinal"===e}function c(e){return"quantitative"===e||"temporal"===e}function l(e){return e.usermeta?.idid}function d(e){if(!l(e)||!Array.isArray(e.layer))return e;const t=e.layer.filter(e=>!function(e){return"annotation-layer"===e.usermeta?.idid?.role}(e));if(1!==t.length)return e;const{layer:a,...r}=e,{usermeta:s,...i}=t[0];return{...r,...i}}var u={category10:"category10",category20:"category20",category20b:"category20",category20c:"category20",accent:"accent",dark2:"dark2",paired:"paired",pastel1:"pastel1",pastel2:"pastel2",set1:"set1",set2:"set2",set3:"set3",tableau10:"category10",tableau20:"category20"},f={linear:"linear","monotone-x":"monotoneX","monotone-y":"monotoneY",monotone:"monotoneX",step:"step","step-after":"stepAfter","step-before":"stepBefore",basis:"basis",cardinal:"cardinal","catmull-rom":"catmullRom"},p={sum:"sum",mean:"mean",average:"mean",count:"count",min:"min",max:"max",median:"mean"};function m(e){e=d(e);const t=[],{type:r,markProps:s}=o(e.mark),i=e.encoding||{},l=i.x,m=i.y,g=i.color,v=i.size,b=i.theta,A=i.opacity;let x;e.data?.values?x=e.data.values:e.data?.url&&t.push("data.url is not supported — only inline data.values can be translated. Provide data manually."),e.transform&&e.transform.length>0&&t.push("Vega-Lite transforms are not supported. Pre-transform your data before passing to fromVegaLite()."),e.layer&&t.push('Layered specs ("layer") are not supported. Only single-mark specs can be translated.'),(e.hconcat||e.vconcat||e.concat)&&t.push('Concatenated views ("hconcat"/"vconcat"/"concat") are not supported. Translate each sub-spec individually.'),(e.facet||i.facet||i.row||i.column)&&t.push("Faceted views are not supported. Use Semiotic's LinkedCharts or render multiple charts manually."),e.repeat&&t.push('Repeated views ("repeat") are not supported. Translate each field combination individually.'),(e.params||e.selection)&&t.push("Selections/params are not supported. Use Semiotic's LinkedCharts and selection props for interactivity.");const k={};e.width&&(k.width=e.width),e.height&&(k.height=e.height);const L=function(e){if(e)return"string"==typeof e?e:e.text}(e.title);if(L&&(k.title=L),g?.field&&(k.colorBy=g.field,g.scale?.scheme)){const e=u[g.scale.scheme];e&&(k.colorScheme=e)}void 0!==A?.value&&(k.pointOpacity=A.value);const S=l?.aggregate,w=m?.aggregate;if(x&&(S||w)){const e=w?m:l,t=w?l:m,r=p[e.aggregate];if(r&&t?.field&&e.field)x=a(x,{groupBy:t.field,value:e.field,agg:r});else if(("count"===r||"count"===e.aggregate)&&t?.field&&x){const e=new Map;for(const a of x){const r=a[t.field]+"";e.set(r,(e.get(r)||0)+1)}x=Array.from(e,([e,a])=>({[t.field]:e,value:a}))}}if(l?.bin||m?.bin){const e="Histogram";x&&(k.data=x),l?.bin?(k.valueAccessor=l.field,m?.field&&(k.categoryAccessor=m.field),l.axis?.title&&(k.valueLabel=l.axis.title)):m?.bin&&(k.valueAccessor=m.field,l?.field&&(k.categoryAccessor=l.field),m.axis?.title&&(k.valueLabel=m.axis.title));const a=l?.bin||m?.bin,r="object"==typeof a?a.maxbins:void 0;return r&&(k.bins=r),h(e,k,t)}let R;switch(r){case"bar":R=function(e,t,a,r,s,i,o){let l;return a?.field&&!1!==e?.stack&&!1!==t?.stack&&null!==e?.stack&&null!==t?.stack?(l="StackedBarChart",r.stackBy=a.field):l="BarChart",n(e?.type)&&c(t?.type)?(r.categoryAccessor=e.field,r.valueAccessor=o?"value":t.field,e?.axis?.title&&(r.categoryLabel=e.axis.title),t?.axis?.title&&(r.valueLabel=t.axis.title)):c(e?.type)&&n(t?.type)?(r.categoryAccessor=t.field,r.valueAccessor=i?"value":e.field,r.orientation="horizontal",t?.axis?.title&&(r.categoryLabel=t.axis.title),e?.axis?.title&&(r.valueLabel=e.axis.title)):(e?.field&&(r.categoryAccessor=e.field),t?.field&&(r.valueAccessor=o?"value":t.field),e?.axis?.title&&(r.categoryLabel=e.axis.title),t?.axis?.title&&(r.valueLabel=t.axis.title)),s&&(r.data=s),l}(l,m,g,k,x,S,w);break;case"line":if(R="LineChart",y(l,m,k,S,w),g?.field&&(k.lineBy=g.field),s.interpolate){const e=f[s.interpolate];e&&(k.curve=e)}!0===s.point&&(k.showPoints=!0),x&&(k.data=x);break;case"area":if(g?.field?(R="StackedAreaChart",k.areaBy=g.field):R="AreaChart",y(l,m,k,S,w),s.interpolate){const e=f[s.interpolate];e&&(k.curve=e)}void 0!==s.opacity&&(k.areaOpacity=s.opacity),x&&(k.data=x);break;case"point":case"circle":case"square":v?.field?(R="BubbleChart",k.sizeBy=v.field,v.scale?.range&&(k.sizeRange=v.scale.range)):R="Scatterplot",y(l,m,k,S,w),x&&(k.data=x);break;case"rect":R="Heatmap",l?.field&&(k.xAccessor=l.field),m?.field&&(k.yAccessor=m.field),g?.field&&(k.valueAccessor=g.field,delete k.colorBy),l?.axis?.title&&(k.xLabel=l.axis.title),m?.axis?.title&&(k.yLabel=m.axis.title),x&&(k.data=x);break;case"arc":s.innerRadius&&s.innerRadius>0?(R="DonutChart",k.innerRadius=s.innerRadius):R="PieChart",b?.field?k.valueAccessor=b.field:m?.field&&(k.valueAccessor=w?"value":m.field),g?.field&&(k.categoryAccessor=g.field),l?.field&&!b?.field&&(k.categoryAccessor=l.field),x&&(k.data=x);break;case"tick":R="DotPlot",n(l?.type)?(k.categoryAccessor=l.field,m?.field&&(k.valueAccessor=w?"value":m.field),l?.axis?.title&&(k.categoryLabel=l.axis.title),m?.axis?.title&&(k.valueLabel=m.axis.title)):n(m?.type)?(k.categoryAccessor=m.field,l?.field&&(k.valueAccessor=S?"value":l.field),k.orientation="horizontal",m?.axis?.title&&(k.categoryLabel=m.axis.title),l?.axis?.title&&(k.valueLabel=l.axis.title)):(l?.field&&(k.categoryAccessor=l.field),m?.field&&(k.valueAccessor=w?"value":m.field)),x&&(k.data=x);break;default:t.push(`Unsupported mark type "${r}". Defaulting to Scatterplot.`),R="Scatterplot",y(l,m,k,S,w),x&&(k.data=x)}return h(R,k,t)}function g(e,t={}){const a=function(e){const t=e,a=d(e),r=a,s=[];if(Array.isArray(t.layer)&&a===e&&s.push({code:"UNSUPPORTED_COMPOSITION",severity:"error",path:"/layer",message:"Only the single base view in an IDID-enriched annotation layer can be imported."}),void 0===r.mark)s.push({code:"MISSING_MARK",severity:"error",path:"/mark",message:"A Vega-Lite spec needs a supported single-view mark."});else{const{type:e}=o(r.mark);new Set(["bar","line","area","point","circle","square","rect","arc","tick"]).has(e)||s.push({code:"UNSUPPORTED_MARK",severity:"error",path:"/mark",message:`Vega-Lite mark "${e||"(missing)"}" has no supported Semiotic translation.`})}Array.isArray(r.transform)&&r.transform.length>0&&s.push({code:"UNSUPPORTED_TRANSFORM",severity:"error",path:"/transform",message:"Vega-Lite transforms must be materialized before strict import."});for(const e of["hconcat","vconcat","concat","facet","repeat","params","selection"])void 0!==r[e]&&s.push({code:"UNSUPPORTED_COMPOSITION",severity:"error",path:"/"+e,message:`Vega-Lite "${e}" is not part of the supported single-view import subset.`});return"string"==typeof r.data?.url&&s.push({code:"UNSUPPORTED_DATA_URL",severity:"error",path:"/data/url",message:"Strict import accepts inline data.values only; load URL data before importing."}),s}(e),r=a.filter(e=>"error"===e.severity),s=l(e),i={adapter:"semiotic/vega-lite",direction:"import",sourceFormat:"vega-lite",targetFormat:"semiotic-chart-config",..."string"==typeof s?.specVersion?{specVersion:s.specVersion}:{},...s?{metadata:{idid:s}}:{}};if(r.length>0&&"lossy"!==t.mode)return{status:"refused",diagnostics:a,lossReport:r.map(({code:e,message:t,path:a})=>({code:e,message:t,path:a})),provenance:i};const n=m(e),c=(n.warnings||[]).map(e=>({code:"LEGACY_TRANSLATION_WARNING",severity:"warning",message:e})),u=r.map(({code:e,message:t,path:a})=>({code:e,message:t,path:a})),f="lossy"===t.mode?a.map(e=>"error"===e.severity?{...e,severity:"warning"}:e):a;return{status:u.length>0?"lossy":"success",config:n,diagnostics:[...f,...c],lossReport:u,provenance:i}}function y(e,t,a,r,s){e?.field&&(a.xAccessor=r?"value":e.field),t?.field&&(a.yAccessor=s?"value":t.field),e?.axis?.title&&(a.xLabel=e.axis.title),t?.axis?.title&&(a.yLabel=t.axis.title)}function h(e,t,a){const r={component:e,props:t,version:"1",createdAt:(new Date).toISOString()};if(a.length>0){r.warnings=a;for(const e of a)console.warn("[semiotic/fromVegaLite] "+e)}return r}export{t as bin,a as rollup,r as groupBy,s as pivot,d as unwrapIDIDEnrichedVegaLiteSpec,m as fromVegaLite,g as fromVegaLiteResult};