semiotic 3.8.3 → 3.8.5

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 (215) hide show
  1. package/CLAUDE.md +13 -10
  2. package/README.md +52 -45
  3. package/ai/componentMetadata.cjs +1 -1
  4. package/ai/dist/mcp-server.js +4 -2
  5. package/ai/examples.md +168 -1
  6. package/ai/schema.json +3756 -327
  7. package/ai/surface-manifest.json +6 -4
  8. package/ai/system-prompt.md +1 -1
  9. package/dist/chunk-chartContainerDataAudit-74TLKIP6.module.min.js +2 -0
  10. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +0 -1
  11. package/dist/chunk-chunk-4AANPFOX.module.min.js +2 -0
  12. package/dist/{chunk-chunk-JNCHKRIR.module.min.js → chunk-chunk-5I3UZV4Q.module.min.js} +1 -1
  13. package/dist/chunk-chunk-74CCPVXB.module.min.js +1 -0
  14. package/dist/{chunk-chunk-VVCA3DB7.module.min.js → chunk-chunk-7ALTGHK6.module.min.js} +1 -1
  15. package/dist/chunk-chunk-ACLDBMRH.module.min.js +2 -0
  16. package/dist/chunk-chunk-AVBI6GDT.module.min.js +1 -0
  17. package/dist/{chunk-chunk-XQYVEKEJ.module.min.js → chunk-chunk-BANTPINB.module.min.js} +1 -1
  18. package/dist/chunk-chunk-C4YA6TDR.module.min.js +1 -0
  19. package/dist/chunk-chunk-C57LR3YG.module.min.js +1 -0
  20. package/dist/chunk-chunk-CKMD5NV3.module.min.js +2 -0
  21. package/dist/chunk-chunk-CO5KQMGH.module.min.js +1 -0
  22. package/dist/chunk-chunk-CWQ5YIHX.module.min.js +2 -0
  23. package/dist/chunk-chunk-E6TXX6MI.module.min.js +1 -0
  24. package/dist/{chunk-chunk-7FW6EGLP.module.min.js → chunk-chunk-I36PJ4OC.module.min.js} +1 -1
  25. package/dist/chunk-chunk-IY7RYD4S.module.min.js +1 -0
  26. package/dist/chunk-chunk-K3DMEW22.module.min.js +1 -0
  27. package/dist/chunk-chunk-KT2VAZMZ.module.min.js +1 -0
  28. package/dist/{chunk-chunk-AZJUDQRM.module.min.js → chunk-chunk-L6EA5V3G.module.min.js} +1 -1
  29. package/dist/{chunk-chunk-SANERMIZ.module.min.js → chunk-chunk-LJLS6DY7.module.min.js} +1 -1
  30. package/dist/chunk-chunk-LJPCLYSC.module.min.js +2 -0
  31. package/dist/chunk-chunk-LRIFN2HK.module.min.js +1 -0
  32. package/dist/chunk-chunk-N5DDKCCF.module.min.js +1 -0
  33. package/dist/chunk-chunk-NEVE562N.module.min.js +1 -0
  34. package/dist/chunk-chunk-NLO44TOS.module.min.js +2 -0
  35. package/dist/{chunk-chunk-FYY2ACNJ.module.min.js → chunk-chunk-PRDGLMJT.module.min.js} +1 -1
  36. package/dist/chunk-chunk-PZJ2SBLL.module.min.js +2 -0
  37. package/dist/chunk-chunk-QUJ6TTLY.module.min.js +1 -0
  38. package/dist/chunk-chunk-RBIDBUT4.module.min.js +2 -0
  39. package/dist/chunk-chunk-RFLAG356.module.min.js +1 -0
  40. package/dist/chunk-chunk-RPU4IZAV.module.min.js +2 -0
  41. package/dist/chunk-chunk-SKMBCFIL.module.min.js +2 -0
  42. package/dist/chunk-chunk-TAE7W424.module.min.js +2 -0
  43. package/dist/{chunk-chunk-OQTLSTGI.module.min.js → chunk-chunk-TMWIZL3K.module.min.js} +1 -1
  44. package/dist/chunk-chunk-TUBMTZMU.module.min.js +2 -0
  45. package/dist/chunk-chunk-UFFEXJQY.module.min.js +1 -0
  46. package/dist/chunk-chunk-XSCHTS4D.module.min.js +2 -0
  47. package/dist/chunk-chunk-XXWSHGPL.module.min.js +2 -0
  48. package/dist/chunk-chunk-ZOAQDIJO.module.min.js +1 -0
  49. package/dist/chunk-chunk-ZXIXAPRE.module.min.js +2 -0
  50. package/dist/chunk-minimapBrushOverlay-JU57U7NM.module.min.js +2 -0
  51. package/dist/chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js +2 -0
  52. package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +1 -0
  53. package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +1 -0
  54. package/dist/components/ChartContainer.d.ts +12 -2
  55. package/dist/components/ai/chartCapabilities.d.ts +2 -1
  56. package/dist/components/ai/chartCapabilityTypes.d.ts +19 -0
  57. package/dist/components/chartContainerDataAudit.d.ts +10 -0
  58. package/dist/components/charts/geo/ChoroplethMap.d.ts +2 -0
  59. package/dist/components/charts/geo/DistanceCartogram.d.ts +35 -5
  60. package/dist/components/charts/geo/FlowMap.d.ts +4 -0
  61. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +3 -1
  62. package/dist/components/charts/index.d.ts +1 -0
  63. package/dist/components/charts/network/ForceDirectedGraph.d.ts +36 -1
  64. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +6 -1
  65. package/dist/components/charts/physics/CrucibleChart.capability.d.ts +8 -0
  66. package/dist/components/charts/physics/CrucibleChart.d.ts +63 -0
  67. package/dist/components/charts/physics/GaltonBoardChart.d.ts +6 -1
  68. package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +27 -0
  69. package/dist/components/charts/physics/crucibleChartProps.d.ts +90 -0
  70. package/dist/components/charts/physics/crucibleChrome.d.ts +47 -0
  71. package/dist/components/charts/physics/crucibleController.d.ts +59 -0
  72. package/dist/components/charts/physics/crucibleEffects.d.ts +30 -0
  73. package/dist/components/charts/physics/cruciblePhysics.d.ts +54 -0
  74. package/dist/components/charts/physics/crucibleProgram.d.ts +38 -0
  75. package/dist/components/charts/physics/crucibleTypes.d.ts +415 -0
  76. package/dist/components/charts/physics/gauntletChartProps.d.ts +7 -1
  77. package/dist/components/charts/physics/gauntletChrome.d.ts +2 -1
  78. package/dist/components/charts/physics/gauntletPhysics.d.ts +19 -4
  79. package/dist/components/charts/physics/gauntletRuntime.d.ts +3 -0
  80. package/dist/components/charts/physics/physicsHocUtils.d.ts +12 -0
  81. package/dist/components/charts/shared/chartMode.d.ts +8 -0
  82. package/dist/components/charts/shared/chartSpecCore.d.ts +10 -2
  83. package/dist/components/charts/shared/crucibleWireSchema.d.ts +5 -0
  84. package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
  85. package/dist/components/charts/shared/hatchPattern.d.ts +8 -3
  86. package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
  87. package/dist/components/charts/shared/lineSeriesSsr.d.ts +55 -0
  88. package/dist/components/charts/shared/types.d.ts +2 -2
  89. package/dist/components/charts/shared/validateProps.d.ts +1 -1
  90. package/dist/components/charts/xy/AreaChart.d.ts +10 -0
  91. package/dist/components/charts/xy/minimapBrushOverlay.d.ts +17 -0
  92. package/dist/components/charts/xy/minimapBrushOverlayLazy.d.ts +4 -0
  93. package/dist/components/charts/xy/scatterplotMatrixBrushOverlay.d.ts +8 -0
  94. package/dist/components/charts/xy/scatterplotMatrixBrushOverlayLazy.d.ts +3 -0
  95. package/dist/components/data/auditData.d.ts +51 -0
  96. package/dist/components/data/dataAuditPresentation.d.ts +18 -0
  97. package/dist/components/data/dataAuditSources.d.ts +9 -0
  98. package/dist/components/data/numericContracts.d.ts +59 -0
  99. package/dist/components/data/numericFieldProfiler.d.ts +23 -0
  100. package/dist/components/realtime/types.d.ts +5 -0
  101. package/dist/components/recipes/gridObservatory.d.ts +176 -0
  102. package/dist/components/recipes/netEnsembleLayout.d.ts +167 -0
  103. package/dist/components/recipes/netEnsembleOverlays.d.ts +20 -0
  104. package/dist/components/recipes/recipeChrome.d.ts +24 -0
  105. package/dist/components/recipes/sequenceLayout.d.ts +139 -0
  106. package/dist/components/recipes/wordTrails.d.ts +156 -0
  107. package/dist/components/recipes/wordTrailsProgressiveReveal.d.ts +42 -0
  108. package/dist/components/semiotic-ai-core.d.ts +3 -0
  109. package/dist/components/semiotic-ai-data-audit.d.ts +4 -0
  110. package/dist/components/semiotic-ai.d.ts +7 -5
  111. package/dist/components/semiotic-physics.d.ts +1 -0
  112. package/dist/components/semiotic-recipes-core.d.ts +10 -2
  113. package/dist/components/semiotic-utils-core.d.ts +3 -0
  114. package/dist/components/semiotic.d.ts +1 -1
  115. package/dist/components/server/renderEvidence.d.ts +27 -0
  116. package/dist/components/server/serverChartConfigs.d.ts +1 -0
  117. package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
  118. package/dist/components/server/staticAnnotations.d.ts +15 -1
  119. package/dist/components/stream/GeoPipelineStore.d.ts +1 -0
  120. package/dist/components/stream/GeoSVGOverlay.d.ts +7 -0
  121. package/dist/components/stream/SceneToSVG.d.ts +6 -6
  122. package/dist/components/stream/SceneToSVGOrdinal.d.ts +12 -0
  123. package/dist/components/stream/geoCartogram.d.ts +7 -0
  124. package/dist/components/stream/geoTypes.d.ts +17 -2
  125. package/dist/components/stream/networkFrameHandleTypes.d.ts +4 -0
  126. package/dist/components/stream/networkFramePaint.d.ts +2 -0
  127. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +18 -2
  128. package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +8 -0
  129. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +7 -0
  130. package/dist/components/stream/physics/physicsPipelineEviction.d.ts +15 -0
  131. package/dist/components/stream/physics/physicsPipelineObservations.d.ts +1 -1
  132. package/dist/components/stream/physics/physicsPipelineQuiescence.d.ts +20 -0
  133. package/dist/components/stream/sceneToSVGShared.d.ts +30 -1
  134. package/dist/components/stream/types.d.ts +4 -0
  135. package/dist/components/stream/useHydration.d.ts +7 -1
  136. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +1 -1
  137. package/dist/components/useChartContainerDataAudit.d.ts +7 -0
  138. package/dist/forceLayoutWorker.js +1 -1
  139. package/dist/geo.min.js +1 -1
  140. package/dist/geo.module.min.js +1 -1
  141. package/dist/network.min.js +1 -1
  142. package/dist/network.module.min.js +1 -1
  143. package/dist/ordinal.min.js +1 -1
  144. package/dist/ordinal.module.min.js +1 -1
  145. package/dist/physics.min.js +1 -1
  146. package/dist/physics.module.min.js +1 -1
  147. package/dist/physicsWorker.js +1 -1
  148. package/dist/realtime.min.js +1 -1
  149. package/dist/realtime.module.min.js +1 -1
  150. package/dist/rough.min.js +1 -1
  151. package/dist/rough.module.min.js +1 -1
  152. package/dist/semiotic-ai-core.d.ts +3 -0
  153. package/dist/semiotic-ai-core.min.js +1 -1
  154. package/dist/semiotic-ai-core.module.min.js +1 -1
  155. package/dist/semiotic-ai.d.ts +7 -5
  156. package/dist/semiotic-ai.min.js +1 -1
  157. package/dist/semiotic-ai.module.min.js +1 -1
  158. package/dist/semiotic-experimental.min.js +1 -1
  159. package/dist/semiotic-experimental.module.min.js +1 -1
  160. package/dist/semiotic-physics.d.ts +1 -0
  161. package/dist/semiotic-realtime-core.min.js +1 -1
  162. package/dist/semiotic-realtime-core.module.min.js +1 -1
  163. package/dist/semiotic-recipes-core.d.ts +10 -2
  164. package/dist/semiotic-recipes-core.min.js +1 -1
  165. package/dist/semiotic-recipes-core.module.min.js +1 -1
  166. package/dist/semiotic-recipes.min.js +1 -1
  167. package/dist/semiotic-recipes.module.min.js +1 -1
  168. package/dist/semiotic-server-edge.min.js +1 -1
  169. package/dist/semiotic-server-edge.module.min.js +1 -1
  170. package/dist/semiotic-server-node.min.js +1 -1
  171. package/dist/semiotic-server-node.module.min.js +1 -1
  172. package/dist/semiotic-utils-core.d.ts +3 -0
  173. package/dist/semiotic-utils-core.min.js +1 -1
  174. package/dist/semiotic-utils-core.module.min.js +1 -1
  175. package/dist/semiotic-utils.min.js +1 -1
  176. package/dist/semiotic-utils.module.min.js +1 -1
  177. package/dist/semiotic-value.module.min.js +1 -1
  178. package/dist/semiotic.d.ts +1 -1
  179. package/dist/semiotic.min.js +1 -1
  180. package/dist/semiotic.module.min.js +1 -1
  181. package/dist/server.min.js +1 -1
  182. package/dist/server.module.min.js +1 -1
  183. package/dist/xy.min.js +1 -1
  184. package/dist/xy.module.min.js +1 -1
  185. package/package.json +4 -3
  186. package/dist/chunk-chunk-255KDHW5.module.min.js +0 -1
  187. package/dist/chunk-chunk-2CCFBTQC.module.min.js +0 -2
  188. package/dist/chunk-chunk-2RXP3FS3.module.min.js +0 -1
  189. package/dist/chunk-chunk-2WVCH4PL.module.min.js +0 -1
  190. package/dist/chunk-chunk-4TMZXLCR.module.min.js +0 -1
  191. package/dist/chunk-chunk-5APBQXZA.module.min.js +0 -1
  192. package/dist/chunk-chunk-6HSGDMTA.module.min.js +0 -2
  193. package/dist/chunk-chunk-7OEOSCBP.module.min.js +0 -1
  194. package/dist/chunk-chunk-A63CTACR.module.min.js +0 -2
  195. package/dist/chunk-chunk-B6V35LMY.module.min.js +0 -2
  196. package/dist/chunk-chunk-BOSVL645.module.min.js +0 -2
  197. package/dist/chunk-chunk-CP3EN6KZ.module.min.js +0 -1
  198. package/dist/chunk-chunk-F25UA5HT.module.min.js +0 -1
  199. package/dist/chunk-chunk-FRIO6MCV.module.min.js +0 -1
  200. package/dist/chunk-chunk-GWSWSPXN.module.min.js +0 -1
  201. package/dist/chunk-chunk-I6C3KR5H.module.min.js +0 -2
  202. package/dist/chunk-chunk-IP2UE74X.module.min.js +0 -1
  203. package/dist/chunk-chunk-J3ELI22J.module.min.js +0 -1
  204. package/dist/chunk-chunk-J5RL6GXU.module.min.js +0 -2
  205. package/dist/chunk-chunk-L3H6DQCR.module.min.js +0 -2
  206. package/dist/chunk-chunk-M337NY6L.module.min.js +0 -1
  207. package/dist/chunk-chunk-M7VYYHCE.module.min.js +0 -2
  208. package/dist/chunk-chunk-MC35ILYP.module.min.js +0 -2
  209. package/dist/chunk-chunk-N72SWNBV.module.min.js +0 -1
  210. package/dist/chunk-chunk-OBQRFTIL.module.min.js +0 -2
  211. package/dist/chunk-chunk-QRIBHZYW.module.min.js +0 -1
  212. package/dist/chunk-chunk-SA3D43RA.module.min.js +0 -2
  213. package/dist/chunk-chunk-UHSZEB74.module.min.js +0 -1
  214. package/dist/chunk-chunk-Y6AXCRVO.module.min.js +0 -1
  215. package/dist/chunk-chunk-ZCNBUZPL.module.min.js +0 -2
@@ -1,2 +0,0 @@
1
- "use client";
2
- import{buildRegressionAnnotation as e}from"./chunk-chunk-YCQYG6J5.module.min.js";import{validateArrayData as t}from"./chunk-chunk-JCG72SGW.module.min.js";import{mergeShapeStyle as o,normalizePartialMargin as n,useChartSetup as i,useCustomChartSetup as r,useFrameImperativeHandle as a,useResolvedSelection as s}from"./chunk-chunk-I6C3KR5H.module.min.js";import{StreamXYFrame_default as l}from"./chunk-chunk-J5RL6GXU.module.min.js";import{accessorName as c,bandTooltipFields as h,buildBaseMetadataProps as d,buildCustomBehaviorProps as u,buildDefaultTooltip as m,buildTooltipProps as p}from"./chunk-chunk-A63CTACR.module.min.js";import{makeXYRuleContext as f,resolveStyleRules as y}from"./chunk-chunk-EMO5NUGE.module.min.js";import{COLOR_SCHEMES as g,DEFAULT_COLOR as b,DEFAULT_COLORS as v,DEFAULT_SELECTION_OPACITY as x,LinkedCharts as A,MultiPointTooltip as w,composeLegendConfigs as k,defaultTooltipStyle as S,filterSparseArray as C,getColor as L,getCrosshairProps as H,getSequentialInterpolator as I,getSize as B,interpolateViridis as R,normalizeLinkedBrush as F,normalizeTooltip as _,resolveMobileInteraction as N,useBrushSelection as P,useChartLegendAndMargin as W,useChartMode as D,useChartSelection as E,useColorScale as M,useLegendInteraction as T,useSelection as O,useSelectionSelector as G,useThemeCategorical as z,useThemeSequential as j,wrapStyleWithSelection as $}from"./chunk-chunk-6HSGDMTA.module.min.js";import{getMax as Q,getMinMax as X}from"./chunk-chunk-JJ2OOIET.module.min.js";import{ChartError as V,SafeRender as q,renderEmptyState as Y,renderLoadingState as J,warnMissingField as K}from"./chunk-chunk-ZCNBUZPL.module.min.js";import*as U from"react";import{useMemo as Z,useCallback as ee,forwardRef as te,useRef as oe}from"react";import{useMemo as ne}from"react";function ie(e){const{colorBy:t,colorScale:n,color:i,pointRadius:r=5,radiusFn:a,fillOpacity:s=1,fallbackFill:l,baseStyleExtras:c,stroke:h,strokeWidth:d,opacity:u,effectiveSelectionHook:m,resolvedSelection:p,colorDatumAccessor:f,styleRules:g,ruleContext:v}=e,x=ne(()=>e=>{const o="function"==typeof c?c(e):c,h=o?{...o}:{};if(void 0===h.fillOpacity&&(h.fillOpacity=s),void 0===h.fill)if(t){if(n){const o=f?f(e):e;h.fill=L(o,t,n)}}else h.fill=l?l(e):i||b;return void 0===h.r&&(h.r=a?a(e):r),g&&g.length>0&&Object.assign(h,y(e,g,v?v(e):{value:void 0})),h},[t,n,i,r,a,s,l,c,f,g,v]),A=ne(()=>o(x,{stroke:h,strokeWidth:d,opacity:u}),[x,h,d,u]);return ne(()=>$(A,m??null,p),[A,m,p])}import{useCallback as re,useMemo as ae,useRef as se,useState as le}from"react";function ce(e){const{accessor:t,data:o,isPushMode:n}=e,i=se(null),[r,a]=le(0),s=re(e=>{if(!n||!t)return;let o=!1;for(const n of e){const e="function"==typeof t?t(n):n[t];if(null==e)continue;const r="number"==typeof e?e:Number(e);Number.isFinite(r)&&(i.current?(i.current[0]>r&&(i.current[0]=r,o=!0),r>i.current[1]&&(i.current[1]=r,o=!0)):(i.current=[r,r],o=!0))}o&&a(e=>e+1)},[n,t]),l=re(()=>{n&&(i.current=null,a(e=>e+1))},[n]);return{domain:ae(()=>{if(n)return i.current??void 0;if(!t||0===o.length)return;const e="function"==typeof t?t:e=>e[t];let r=1/0,a=-1/0;for(const t of o){const o=e(t);if(null==o)continue;const n="number"==typeof o?o:Number(o);Number.isFinite(n)&&(r>n&&(r=n),n>a&&(a=n))}return Number.isFinite(r)&&Number.isFinite(a)?[r,a]:void 0},[o,t,n,r]),trackPushed:s,reset:l}}import{useEffect as he,useMemo as de,useRef as ue,useState as me}from"react";var pe="__forecastSegment",fe=null;async function ye(){return fe||(fe=await import("./chunk-statisticalOverlays-6MVAK5RW.module.min.js")),fe}var ge="__semiotic_resolvedX",be="__semiotic_resolvedY";function ve(e){const{data:t,xAccessor:o,yAccessor:n,forecast:i,anomaly:r,groupBy:a}=e,s="string"==typeof o?o:ge,l="string"==typeof n?n:be,c=de(()=>{if(!i&&!r)return t;const e="function"==typeof o,a="function"==typeof n;return e||a?t.map(t=>{const i={...t};return e&&(i[ge]=o(t)),a&&(i[be]=n(t)),i}):t},[t,i,r,o,n]),[h,d]=me(null),[u,m]=me([]),p=ue(i),f=ue(r);return he(()=>{if(!i&&!r)return void((p.current||f.current)&&(d(null),m([]),p.current=i,f.current=r));let e=!1;const t=i!==p.current||r!==f.current;if(p.current=i,f.current=r,t&&(d(null),m([])),i){const t=a&&"string"==typeof a&&"object"==typeof i?{...i,_groupBy:a}:i;(async function(...e){return(await ye()).buildForecast(...e)})(c,s,l,t,r).then(t=>{e||(d(t),m(t.annotations))}).catch(()=>{e||(d(null),m([]))})}else r&&async function(...e){return(await ye()).buildAnomalyAnnotations(...e)}(r).then(t=>{e||(d(null),m(t))}).catch(()=>{e||m([])});return()=>{e=!0}},[c,i,r,s,l,a]),{effectiveData:h?h.processedData:t,statisticalAnnotations:u,hasForecast:!!h,xAccessorKey:s,yAccessorKey:l}}import{jsx as xe}from"react/jsx-runtime";var Ae=te(function(o,n){const r=oe(null),s=D(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:h,margin:y,className:g,xFormat:b,yFormat:v,xAccessor:x="x",yAccessor:A="y",xScaleType:w,yScaleType:k,colorBy:S,colorScheme:L,styleRules:H,sizeBy:I,sizeRange:R=[3,15],symbolBy:_,symbolMap:N,pointRadius:W=5,pointOpacity:E=.8,tooltip:M,marginalGraphics:T,pointIdAccessor:O,annotations:G,regression:z,forecast:j,anomaly:$,xExtent:Q,yExtent:X,frameProps:Y={},selection:J,linkedHover:te,linkedBrush:ne,onObservation:re,onClick:ae,hoverHighlight:se,chartId:le,loading:he,loadingContent:de,emptyContent:ue,legendInteraction:me,legendPosition:pe,color:fe,stroke:ye,strokeWidth:ge,opacity:be}=o,{width:Ae,height:we,enableHover:ke,showGrid:Se,showLegend:Ce,title:Le,description:He,summary:Ie,accessibleTable:Be,xLabel:Re,yLabel:Fe}=s,_e=Z(()=>C(h),[h]),Ne=void 0===h,{domain:Pe,trackPushed:We,reset:De}=ce({accessor:I,data:_e,isPushMode:Ne}),Ee=ee(e=>{We([e]),r.current?.push(e)},[We]),Me=ee(e=>{We(e),r.current?.pushMany(e)},[We]);a(n,{variant:"xy",frameRef:r,overrides:{push:Ee,pushMany:Me,clear:()=>{De(),r.current?.clear()}}});const Te=i({data:_e,rawData:h,colorBy:S,colorScheme:L,legendInteraction:me,legendPosition:pe,selection:J,linkedHover:te,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:re,onClick:ae,hoverHighlight:se,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"Scatterplot",chartId:le,showLegend:Ce,userMargin:y,marginDefaults:s.marginDefaults,loading:he,loadingContent:de,emptyContent:ue,width:Ae,height:we}),Oe=F(ne),Ge=P({name:Oe?.name||"__unused_brush__",xField:Oe?.xField||("string"==typeof x?x:void 0),yField:Oe?.yField||("string"==typeof A?A:void 0)}),ze=Oe?"xyBrush"===Ge.brushInteraction.brush?"xy":"xBrush"===Ge.brushInteraction.brush?"x":"y":void 0,je=U.useRef(Ge.brushInteraction);je.current=Ge.brushInteraction;const $e=ee(e=>{const t=je.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);K("Scatterplot",_e,"xAccessor",x),K("Scatterplot",_e,"yAccessor",A);const Qe=Z(()=>I?Pe??[0,1]:void 0,[I,Pe]),Xe=Z(()=>I?e=>B(e,I,R,Qe):void 0,[I,R,Qe]),Ve=Z(()=>f(x,A),[x,A]),qe=ie({colorBy:S,colorScale:Te.colorScale,color:fe,pointRadius:W,fillOpacity:E,radiusFn:Xe,stroke:ye,strokeWidth:ge,opacity:be,styleRules:H,ruleContext:Ve,effectiveSelectionHook:Te.effectiveSelectionHook,resolvedSelection:Te.resolvedSelection}),Ye=Z(()=>m([{label:Re||c(x),accessor:x,role:"x",format:b},{label:Fe||c(A),accessor:A,role:"y",format:v},...S?[{label:c(S),accessor:S,role:"color"}]:[],...I?[{label:c(I),accessor:I,role:"size"}]:[]]),[x,A,Re,Fe,S,I,b,v]),{effectiveData:Je,statisticalAnnotations:Ke}=ve({data:_e,xAccessor:x,yAccessor:A,forecast:j,anomaly:$}),Ue=Z(()=>{const t=e(z);return t||0!==Ke.length?[...t?[t]:[],...G||[],...Ke]:G},[z,G,Ke]);if(Te.earlyReturn)return Te.earlyReturn;const Ze=t({componentName:"Scatterplot",data:h,accessors:{xAccessor:x,yAccessor:A}});if(Ze)return xe(V,{componentName:"Scatterplot",message:Ze,width:Ae,height:we});const et={chartType:"scatter",...null!=h&&{data:Je},xAccessor:x,yAccessor:A,xScaleType:w,yScaleType:k,colorAccessor:S||void 0,sizeAccessor:I||void 0,..._&&{symbolAccessor:_},...N&&{symbolMap:N},sizeRange:R,pointStyle:qe,colorScheme:L,size:[Ae,we],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:Te.margin,showAxes:s.showAxes,xLabel:Re,yLabel:Fe,xFormat:b,yFormat:v,enableHover:ke,showGrid:Se,...Te.legendBehaviorProps,...d({title:Le,description:He,summary:Ie,accessibleTable:Be,className:g,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...p({tooltip:M,defaultTooltipContent:Ye}),...u({linkedHover:te,selection:J,onObservation:re,onClick:ae,hoverHighlight:se,mobileInteraction:Te.mobileInteraction,customHoverBehavior:Te.customHoverBehavior,customClickBehavior:Te.customClickBehavior}),...T&&{marginalGraphics:T},...O&&{pointIdAccessor:O},...Ue&&Ue.length>0&&{annotations:Ue},...Q&&{xExtent:Q},...X&&{yExtent:X},...Oe&&{brush:{dimension:ze},onBrush:$e},...Te.crosshairProps,...Y};return xe(q,{componentName:"Scatterplot",width:Ae,height:we,children:xe(l,{ref:r,...et})})});Ae.displayName="Scatterplot";import{useMemo as we,forwardRef as ke,useRef as Se}from"react";import{Fragment as Ce,jsx as Le}from"react/jsx-runtime";function He(e,t){return R(1===t?.5:e/(t-1))}var Ie=ke(function(o,n){const r=Se(null);a(n,{variant:"xy",frameRef:r});const s=D(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:h,margin:y,className:g,xFormat:b,yFormat:v,xAccessor:A="x",yAccessor:w="y",orderAccessor:k,orderLabel:S,styleRules:C,pointRadius:L=4,tooltip:H,pointIdAccessor:I,annotations:B,regression:R,forecast:F,anomaly:_,xExtent:N,yExtent:P,frameProps:W={},selection:E,linkedHover:M,onObservation:T,onClick:O,hoverHighlight:G,chartId:z,loading:j,loadingContent:$,emptyContent:Q,legendInteraction:X,stroke:Y,strokeWidth:J,opacity:U}=o,{width:Z,height:ee,enableHover:te,showGrid:oe,title:ne,description:re,summary:ae,accessibleTable:se,xLabel:le,yLabel:ce}=s,{safeData:he,orderMap:de}=we(()=>{const e=h||[],t="function"==typeof A?A:e=>e[A],o="function"==typeof w?w:e=>e[w];let n=e;if(k&&e.length>0){const t="function"==typeof k?k:e=>e[k];n=[...e].sort((e,o)=>{const n=t(e),i=t(o);return(n instanceof Date?n.getTime():+n)-(i instanceof Date?i.getTime():+i)})}const i=new WeakMap;let r=0;for(const e of n){const n=t(e),i=o(e);null!=n&&null!=i&&isFinite(n)&&isFinite(i)&&r++}let a=0;for(const e of n){const n=t(e),s=o(e);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&i.set(e,{idx:a++,total:r})}return{safeData:n,orderMap:i}},[h,k,A,w]);K("ConnectedScatterplot",he,"xAccessor",A),K("ConnectedScatterplot",he,"yAccessor",w);const ue=i({data:he,rawData:h,colorBy:void 0,colorScheme:void 0,legendInteraction:X,selection:E,linkedHover:M,fallbackFields:[],unwrapData:!1,onObservation:T,onClick:O,hoverHighlight:G,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"ConnectedScatterplot",chartId:z,showLegend:void 0,userMargin:y,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:j,loadingContent:$,emptyContent:Q,width:Z,height:ee}),me=ue.resolvedSelection?.unselectedOpacity??x,pe=we(()=>(e,t)=>{const o=t.filter(e=>"point"===e.type);if(2>o.length)return;const n=ue.effectiveSelectionHook?.isActive,i=ue.effectiveSelectionHook?.predicate,r=100>o.length,a=o.length;e.lineCap="round";for(let t=0;a-1>t;t++){const s=o[t],l=o[t+1],c=He(t,a),h=!n||!i||i(s.datum??s)||i(l.datum??l),d=n?h?1:me:1;r&&(e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=L+2,e.globalAlpha=.5*d,e.stroke()),e.beginPath(),e.moveTo(s.x,s.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=L,e.globalAlpha=d,e.stroke()}e.globalAlpha=1},[L,ue.effectiveSelectionHook,me]),fe=we(()=>[pe],[pe]),ye=we(()=>(e,t,o)=>{const n=e.filter(e=>"point"===e.type);if(2>n.length)return null;const i=n.length,r=100>i,a=[];for(let e=0;i-1>e;e++){const t=n[e],o=n[e+1],s=He(e,i),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof o.style?.opacity?o.style.opacity:1);r&&a.push(Le("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:L+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),a.push(Le("line",{x1:t.x,y1:t.y,x2:o.x,y2:o.y,stroke:s,strokeWidth:L,strokeLinecap:"round",opacity:l},"seg-"+e))}return Le(Ce,{children:a})},[L]),ge=we(()=>[ye],[ye]),be=ie({colorScale:void 0,baseStyleExtras:we(()=>e=>{const t=de.get(e),o=t?.idx??0,n=t?.total??1;return{fill:n>0?He(o,n):"#6366f1",stroke:"white",strokeWidth:1,r:L,fillOpacity:1}},[L,de]),stroke:Y,strokeWidth:J,opacity:U,styleRules:C,ruleContext:we(()=>f(A,w),[A,w]),effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection}),xe=S||("string"==typeof k?k:"Order"),Ae=we(()=>m([{label:le||c(A),accessor:A,role:"x",format:b},{label:ce||c(w),accessor:w,role:"y",format:v},...k?[{label:xe,accessor:k,role:"group"}]:[]]),[A,w,le,ce,k,xe,b,v]),ke=t({componentName:"ConnectedScatterplot",data:h,accessors:{xAccessor:A,yAccessor:w}}),{effectiveData:Ie,statisticalAnnotations:Be}=ve({data:he,xAccessor:A,yAccessor:w,forecast:F,anomaly:_});if(ue.earlyReturn)return ue.earlyReturn;const Re=e(R),Fe=Re||Be.length>0?[...Re?[Re]:[],...B||[],...Be]:B,_e={chartType:"scatter",...null!=h&&{data:Ie},xAccessor:A,yAccessor:w,pointStyle:be,size:[Z,ee],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:ue.margin,showAxes:s.showAxes,xLabel:le,yLabel:ce,xFormat:b,yFormat:v,enableHover:te,showGrid:oe,...d({title:ne,description:re,summary:ae,accessibleTable:se,className:g,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...p({tooltip:H,defaultTooltipContent:Ae}),...u({linkedHover:M,selection:E,onObservation:T,onClick:O,hoverHighlight:G,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...I&&{pointIdAccessor:I},canvasPreRenderers:fe,svgPreRenderers:ge,...Fe&&Fe.length>0&&{annotations:Fe},...N&&{xExtent:N},...P&&{yExtent:P},...ue.crosshairProps,...W};return ke?Le(V,{componentName:"ConnectedScatterplot",message:ke,width:Z,height:ee}):Le(q,{componentName:"ConnectedScatterplot",width:Z,height:ee,children:Le(l,{ref:r,..._e})})});Ie.displayName="ConnectedScatterplot";import{useMemo as Be,useCallback as Re,useState as Fe,useEffect as _e,forwardRef as Ne,useRef as Pe}from"react";import{useMemo as We}from"react";function De(e){const{lineWidth:t=2,colorBy:n,colorScale:i,color:r,resolveStroke:a,fillArea:s,areaOpacity:l=.3,stroke:c,strokeWidth:h,opacity:d,effectiveSelectionHook:u,resolvedSelection:m,styleRules:p,ruleContext:f}=e,g=We(()=>function(e){const{lineWidth:t=2,colorBy:o,colorScale:n,color:i,resolveStroke:r,fillArea:a,areaOpacity:s=.3,styleRules:l,ruleContext:c}=e;return(e,h)=>{const d={strokeWidth:t},u=!0===a||Array.isArray(a)&&null!=h&&a.includes(h);let m;return r?m=r(e,h):o?n&&(m=L(e,o,n)):m=i||b,void 0!==m&&(d.stroke=m,u&&(d.fill=m,d.fillOpacity=s)),l?.length&&Object.assign(d,y(e,l,c?c(e,h):{value:void 0,category:h})),d}}({lineWidth:t,colorBy:n,colorScale:i,color:r,resolveStroke:a,fillArea:s,areaOpacity:l,styleRules:p,ruleContext:f}),[t,n,i,r,a,s,l,p,f]),v=We(()=>o(g,{stroke:c,strokeWidth:h,opacity:d}),[g,c,h,d]);return We(()=>$(v,u??null,m),[v,u,m])}import{jsx as Ee}from"react/jsx-runtime";var Me="__lineObjectSeries",Te=Ne(function(e,o){const n=Pe(null);a(o,{variant:"xy",frameRef:n});const r=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:d,className:p,xFormat:y,yFormat:g,axisExtent:v,xAccessor:x="x",yAccessor:A="y",lineBy:S,lineDataAccessor:H="coordinates",colorBy:I,colorScheme:B,styleRules:R,curve:F="linear",showPoints:N=!1,pointRadius:P=3,fillArea:W=!1,areaOpacity:E=.3,lineWidth:M=2,lineGradient:T,tooltip:O,pointIdAccessor:G,annotations:z,directLabel:j,gapStrategy:$="break",anomaly:Q,forecast:X,band:Y,xExtent:J,yExtent:U,frameProps:Z={},selection:ee,linkedHover:te,onObservation:oe,onClick:ne,hoverHighlight:ie,hoverRadius:re,chartId:ae,loading:se,loadingContent:le,emptyContent:ce,legendInteraction:he,legendPosition:de,legend:ue,xScaleType:me,yScaleType:fe,color:ge,stroke:be,strokeWidth:xe,opacity:Ae}=e,{legend:we,...ke}=Z,Se=Be(()=>k(we,ue),[we,ue]),{width:Ce,height:Le,enableHover:He,showGrid:Ie,showLegend:Ne,title:We,description:Te,summary:Oe,accessibleTable:Ge,xLabel:ze,yLabel:je}=r,$e=Be(()=>C(s),[s]),Qe=Array.isArray($e[0]?.[H])?$e[0][H]:$e;K("LineChart",Qe,"xAccessor",x),K("LineChart",Qe,"yAccessor",A);const{effectiveData:Xe,statisticalAnnotations:Ve}=ve({data:$e,xAccessor:x,yAccessor:A,forecast:X,anomaly:Q,groupBy:S}),qe="__compoundGroup",Ye=!(!X||!S),Je=Ye?qe:X?pe:S,Ke=Be(()=>{if(!Ye)return Xe;const e="function"==typeof S?S:e=>e[S];return Xe.map(t=>{const o={...t};return o[qe]=`${e(t)}__${t[pe]||"observed"}`,o})},[Xe,Ye,S]),Ue=Ye?Ke:Xe,Ze=I||S,et=Be(()=>{if(!X)return;const e=X.upperBounds,t=X.lowerBounds;if(!e&&!t)return;const o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,n="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,r=-1/0;const a=Xe;for(const e of a){const t="function"==typeof A?A(e):+e[A];if(isFinite(t)&&(i>t&&(i=t),t>r&&(r=t)),o){const t=o(e);null!=t&&isFinite(t)&&(t>r&&(r=t),i>t&&(i=t))}if(n){const t=n(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>r&&(r=t))}}return isFinite(i)&&isFinite(r)?[i,r]:void 0},[X,Xe,A]),tt=Re(e=>{const t="function"==typeof x?x(e):e[x],o="function"==typeof A?A(e):e[A];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[x,A]),ot=void 0!==Ue[0]?.[H],nt=ot?Me:Je,it=Be(()=>{if(ot)return Ue.map((e,t)=>{const o="function"==typeof S?S(e):"string"==typeof S?e[S]:void 0,n=null==o?"line-"+t:o+"",i=Array.isArray(e[H])?e[H]:[];return{...e,[Me]:n,[H]:i.map(t=>({...t,[Me]:n,parentLine:e,..."string"==typeof S&&void 0!==e[S]?{[S]:e[S]}:{}}))}});if(Je){const e=Ue.reduce((e,t)=>{const o="function"==typeof Je?Je(t):t[Je];if(!e[o]){const n={[H]:[]};"string"==typeof Je&&(n[Je]=o),Ye&&(n[pe]=t[pe],"string"==typeof S&&(n[S]=t[S])),e[o]=n}return e[o][H].push(t),e},{});return Object.values(e)}return[{[H]:Ue}]},[ot,Je,H,Ue,S,Ye]),{gapProcessedLineData:rt,hasGaps:at}=Be(()=>{if("interpolate"===$){let e=!1;const t=[];for(const o of it){const n=(o[H]||[]).filter(t=>!tt(t)||(e=!0,!1));n.length>0&&t.push({...o,[H]:n})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===$){let e=!1;const t=[];for(const o of it){const n=o[H]||[];let i=[],r=0;const a=nt&&"string"==typeof nt?o[nt]:void 0;for(const s of n)if(tt(s))e=!0,i.length>0&&(t.push({...o,[H]:i}),i=[],r++);else{const e=null!=a?`${a}__seg${r}`:"__seg"+r;i.push({...s,_gapSegment:e})}i.length>0&&t.push({...o,[H]:i})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===$){let e=!1;const t="string"==typeof A?A:"y",o=[];for(const n of it){const i=n[H]||[],r=[];for(const o of i)tt(o)?(e=!0,r.push({...o,[t]:0})):r.push(o);o.push({...n,[H]:r})}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:it,hasGaps:!1}},[it,$,H,tt,nt,A]),st="object"==typeof j?j:{},lt=st.position||"end",ct=st.fontSize||11,ht=Be(()=>{if(!j||!Ze)return[];const e="function"==typeof Ze?Ze:e=>e[Ze],t=new Set;for(const o of rt){const n=o[H]||[];if(0===n.length)continue;const i=e("end"===lt?n[n.length-1]:n[0])??e(o);if(null==i)continue;const r=i+"";""!==r&&t.add(r)}return Array.from(t)},[j,Ze,rt,H,lt]),dt=Be(()=>{if(!j)return r.marginDefaults;const e=ht.reduce((e,t)=>Math.max(e,t.length*(.6*ct)),0)+10,t="end"===lt?"right":"left";return{...r.marginDefaults,[t]:Math.max(r.marginDefaults[t]||0,e)}},[j,ht,ct,lt,r.marginDefaults]),ut=i({data:Xe,rawData:s,colorBy:Ze,colorScheme:B,legendInteraction:he,legendPosition:de,selection:ee,linkedHover:te,fallbackFields:Ze?["string"==typeof Ze?Ze:""]:[],unwrapData:!1,onObservation:oe,onClick:ne,hoverHighlight:ie,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"LineChart",chartId:ae,showLegend:(!j||void 0!==Ne)&&Ne,legend:Se,userMargin:d,marginDefaults:dt,loading:se,loadingContent:le,emptyContent:ce,width:Ce,height:Le}),mt=ut.colorScale,pt=ut.effectiveSelectionHook,ft=ut.resolvedSelection,yt=ut.customHoverBehavior,gt=ut.customClickBehavior,bt=ut.crosshairProps,vt=Be(()=>{if(Ze)return ot?e=>{const t=e.parentLine||e;return"function"==typeof Ze?Ze(t):t[Ze]}:Ze},[Ze,ot]),xt=Be(()=>f(x,A),[x,A]),At=De({lineWidth:M,colorBy:vt,colorScale:mt,color:ge,fillArea:W,areaOpacity:E,stroke:be,strokeWidth:xe,opacity:Ae,effectiveSelectionHook:pt,resolvedSelection:ft,styleRules:R,ruleContext:xt}),[wt,kt]=Fe(null);_e(()=>{if(!X)return void kt(null);let e=!1;return async function(...e){return(await ye()).createSegmentLineStyle(...e)}(At,X).then(t=>{e||kt(()=>t)}).catch(()=>{e||kt(null)}),()=>{e=!0}},[At,X]);const St=wt||At,Ct=Be(()=>{if(N)return e=>{const t={r:P,fillOpacity:1};return Ze?mt&&(t.fill=L(e.parentLine||e,Ze,mt)):t.fill=ge||b,t}},[N,P,Ze,mt,ge]),Lt=Array.isArray(W)?"mixed":W?"area":"line",Ht=Be(()=>{if(!j||!Ze)return[];const e="function"==typeof x?x:e=>e[x],t="function"==typeof A?A:e=>e[A],o="function"==typeof Ze?Ze:e=>e[Ze],n=new Map;for(const e of rt){const t=e[H]||[];if(0===t.length)continue;const i="end"===lt?t[t.length-1]:t[0],r=o(i)??o(e);if(null==r)continue;const a=r+"";""===a||n.has(a)||n.set(a,i)}const i=Array.from(n.entries()).map(([o,n])=>({type:"text",label:o,["string"==typeof x?x:"x"]:e(n),["string"==typeof A?A:"y"]:t(n),dx:"end"===lt?6:-6,dy:0,color:mt?mt(o):b,fontSize:ct}));i.sort((e,t)=>{const o="string"==typeof A?A:"y";return e[o]-t[o]});for(let e=1;i.length>e;e++){const t="string"==typeof A?A:"y",o=i[e-1],n=i[e];ct+2>Math.abs(n[t]+n.dy-(o[t]+o.dy))&&(n.dy+=ct+2)}return i},[j,Ze,mt,rt,H,x,A,lt,ct]),It=ut.margin,Bt=S||I,Rt=Be(()=>m([{label:ze||c(x),accessor:x,role:"x",format:y},{label:je||c(A),accessor:A,role:"y",format:g},...Bt?[{label:c(Bt),accessor:Bt,role:"group"}]:[],...h(Y,g)]),[x,A,ze,je,Bt,y,g,Y]),Ft=t({componentName:"LineChart",data:ot?Xe[0]?.[H]||[]:s,accessors:{xAccessor:x,yAccessor:A}}),_t=Be(()=>ot||nt||at?rt.flatMap(e=>{const t=e[H]||[];return nt&&"string"==typeof nt?t.map(t=>({...t,[nt]:t[nt]??e[nt]})):t}):Ue,[rt,H,ot,nt,Ue,at]),Nt={chartType:Lt,...Array.isArray(W)&&{areaGroups:W},...T&&{lineGradient:T},...null!=s&&{data:_t},xAccessor:x,yAccessor:A,xScaleType:me,yScaleType:fe,...J&&{xExtent:J},...!U||null==U[0]&&null==U[1]?et?{yExtent:et}:{}:{yExtent:U},groupAccessor:"break"===$&&at?"_gapSegment":nt||void 0,...Y&&{band:Y},curve:F,lineStyle:St,...N&&{pointStyle:Ct},size:[Ce,Le],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:It,showAxes:r.showAxes,xLabel:ze,yLabel:je,xFormat:y,yFormat:g,...void 0!==v&&{axisExtent:v},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:He,showGrid:Ie,...ut.legendBehaviorProps,...We&&{title:We},...Te&&{description:Te},...Oe&&{summary:Oe},...void 0!==Ge&&{accessibleTable:Ge},...p&&{className:p},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===O?()=>null:"multi"===O?w():_(O)||Rt,..."multi"===O&&{tooltipMode:"multi"},...u({linkedHover:te,selection:ee,onObservation:oe,onClick:ne,hoverRadius:re,hoverHighlight:ie,mobileInteraction:ut.mobileInteraction,customHoverBehavior:yt,customClickBehavior:gt}),...G&&{pointIdAccessor:G},...(z?.length||Ve.length||Ht.length)&&{annotations:[...z||[],...Ve,...Ht]},...bt,...ke};return ut.earlyReturn?ut.earlyReturn:Ft?Ee(V,{componentName:"LineChart",message:Ft,width:Ce,height:Le}):Ee(q,{componentName:"LineChart",width:Ce,height:Le,children:Ee(l,{ref:n,...Nt})})});Te.displayName="LineChart";import{useMemo as Oe,forwardRef as Ge,useRef as ze}from"react";import{useMemo as je}from"react";function $e(e){const{safeData:t,data:n,areaBy:i,lineDataAccessor:r,colorBy:a,colorScale:s,color:l,stroke:d,strokeWidth:u,opacity:p,effectiveSelectionHook:f,resolvedSelection:g,areaOpacity:v,showLine:x,lineWidth:A,showPoints:w,pointRadius:k,xAccessor:S,yAccessor:C,xLabel:H,yLabel:I,xFormat:B,yFormat:R,groupField:F,styleRules:_,ruleContext:N}=e,P=je(()=>function({data:e,safeData:t,areaBy:o,lineDataAccessor:n}){if(null==e)return[];const i=void 0!==t[0]?.[n];if(!i&&!o)return t;let r;if(i)r=t;else{const e=t.reduce((e,t)=>{const i="function"==typeof o?o(t):t[o],r=i+"";if(!e[r]){const t={[n]:[]};"string"==typeof o&&(t[o]=i),e[r]=t}return e[r][n].push(t),e},{});r=Object.values(e)}return r.flatMap(e=>{const t=Array.isArray(e[n])?e[n]:[];return"string"==typeof o?t.map(t=>({...t,[o]:t[o]??e[o]})):t})}({data:n,safeData:t,areaBy:i,lineDataAccessor:r}),[n,t,i,r]),W=je(()=>e=>{const t={};if(a){if(s){const o=L(e,a,s);t.fill=o,x?(t.stroke=o,t.strokeWidth=A):t.stroke="none"}}else{const e=l||b;t.fill=e,x?(t.stroke=e,t.strokeWidth=A):t.stroke="none"}return t.fillOpacity=v,_&&_.length>0&&Object.assign(t,y(e,_,N?N(e):{value:void 0})),t},[a,s,l,v,x,A,_,N]),D=je(()=>o(W,{stroke:d,strokeWidth:u,opacity:p}),[W,d,u,p]);return{flattenedData:P,lineStyle:je(()=>$(D,f??null,g),[D,f,g]),pointStyle:je(()=>{if(w)return e=>{const t={r:k,fillOpacity:1};return a?s&&(t.fill=L(e.parentLine||e,a,s)):t.fill=l||b,t}},[w,k,a,s,l]),defaultTooltipContent:je(()=>m([{label:H||c(S),accessor:S,role:"x",format:B},{label:I||c(C),accessor:C,role:"y",format:R},...F?[{label:c(F),accessor:F,role:"group"}]:[],...h(e.band,R)]),[S,C,H,I,F,B,R,e.band])}}import{jsx as Qe}from"react/jsx-runtime";function Xe(e,t){if(null==t)return e;const o=e.trim(),n=o.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(n){const e=n[1],o=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(o.slice(0,2),16)}, ${parseInt(o.slice(2,4),16)}, ${parseInt(o.slice(4,6),16)}, ${t})`}if(o.startsWith("rgba(")){const e=o.lastIndexOf(","),n=o.lastIndexOf(")");if(-1!==e&&n>e)return`${o.slice(0,e+1)} ${t})`}return o.startsWith("rgb(")?o.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}var Ve=Ge(function(e,o){const n=ze(null);a(o,{variant:"xy",frameRef:n});const r=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:c,className:h,xFormat:m,yFormat:y,xAccessor:g="x",yAccessor:b="y",areaBy:v,y0Accessor:x,gradientFill:A=!1,semanticGradient:k,lineDataAccessor:S="coordinates",colorBy:L,colorScheme:H,styleRules:I,curve:B="monotoneX",areaOpacity:R=.7,lineGradient:F,showLine:_=!0,lineWidth:N=2,showPoints:P=!1,pointRadius:W=3,tooltip:E,annotations:M,forecast:T,anomaly:O,band:G,xExtent:z,yExtent:j,frameProps:$={},selection:Q,linkedHover:X,onObservation:Y,onClick:J,hoverHighlight:U,chartId:Z,loading:ee,loadingContent:te,emptyContent:oe,legendInteraction:ne,legendPosition:ie,color:re,stroke:ae,strokeWidth:se,opacity:le}=e,{width:ce,height:he,enableHover:de,showGrid:ue,showLegend:me,title:pe,description:fe,summary:ye,accessibleTable:ge,xLabel:be,yLabel:xe}=r,Ae=Oe(()=>C(s),[s]),we=L||v,ke=Oe(()=>{return k&&k.length>0?{colorStops:(e=k,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:Xe(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:A;var e},[k,A]);K("AreaChart",Ae,"xAccessor",g),K("AreaChart",Ae,"yAccessor",b);const Se=i({data:Ae,rawData:s,colorBy:we,colorScheme:H,legendInteraction:ne,legendPosition:ie,selection:Q,linkedHover:X,fallbackFields:we?["string"==typeof we?we:""]:[],unwrapData:!1,onObservation:Y,onClick:J,hoverHighlight:U,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"AreaChart",chartId:Z,showLegend:me,userMargin:c,marginDefaults:r.marginDefaults,loading:ee,loadingContent:te,emptyContent:oe,width:ce,height:he}),{effectiveData:Ce,statisticalAnnotations:Le}=ve({data:Ae,xAccessor:g,yAccessor:b,forecast:T,anomaly:O,groupBy:v}),He=Oe(()=>f(g,b),[g,b]),{flattenedData:Ie,lineStyle:Be,pointStyle:Re,defaultTooltipContent:Fe}=$e({safeData:Ce,data:s,areaBy:v,lineDataAccessor:S,colorBy:we,colorScale:Se.colorScale,color:re,stroke:ae,strokeWidth:se,opacity:le,effectiveSelectionHook:Se.effectiveSelectionHook,resolvedSelection:Se.resolvedSelection,areaOpacity:R,showLine:_,lineWidth:N,showPoints:P,pointRadius:W,xAccessor:g,yAccessor:b,xLabel:be,yLabel:xe,xFormat:m,yFormat:y,groupField:v||L,band:G,styleRules:I,ruleContext:He}),_e=t({componentName:"AreaChart",data:s,accessors:{xAccessor:g,yAccessor:b}}),Ne={chartType:"area",...null!=s&&{data:Ie},xAccessor:g,yAccessor:b,groupAccessor:v||void 0,...x&&{y0Accessor:x},...G&&{band:G},...ke&&{gradientFill:ke},...F&&{lineGradient:F},curve:B,lineStyle:Be,...P&&Re&&{pointStyle:Re},size:[ce,he],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Se.margin,showAxes:r.showAxes,xLabel:be,yLabel:xe,xFormat:m,yFormat:y,enableHover:de,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:ue,...Se.legendBehaviorProps,...d({title:pe,description:fe,summary:ye,accessibleTable:ge,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===E?{tooltipContent:w(),tooltipMode:"multi"}:p({tooltip:E,defaultTooltipContent:Fe}),...u({linkedHover:X,selection:Q,onObservation:Y,onClick:J,hoverHighlight:U,mobileInteraction:Se.mobileInteraction,customHoverBehavior:Se.customHoverBehavior,customClickBehavior:Se.customClickBehavior}),...(M&&M.length>0||Le.length>0)&&{annotations:[...M||[],...Le]},...z&&{xExtent:z},...j&&{yExtent:j},...Se.crosshairProps,...$};return Se.earlyReturn?Se.earlyReturn:_e?Qe(V,{componentName:"AreaChart",message:_e,width:ce,height:he}):Qe(q,{componentName:"AreaChart",width:ce,height:he,children:Qe(l,{ref:n,...Ne})})});Ve.displayName="AreaChart";import{useMemo as qe,forwardRef as Ye,useRef as Je,useState as Ke,useImperativeHandle as Ue,useCallback as Ze}from"react";import{jsx as et,jsxs as tt}from"react/jsx-runtime";function ot(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var nt=Ye(function(e,t){const o=Je(null),n=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:a,className:s,xFormat:c,yFormat:h,xAccessor:m="x",seriesAAccessor:p="a",seriesBAccessor:f="b",seriesALabel:y="A",seriesBLabel:g="B",seriesAColor:b="var(--semiotic-danger, #dc2626)",seriesBColor:v="var(--semiotic-info, #2563eb)",showLines:x=!0,lineWidth:A=1.5,showPoints:w=!1,pointRadius:k=3,curve:L="linear",areaOpacity:H=.6,gradientFill:I,tooltip:B,annotations:R,xExtent:F,yExtent:N,frameProps:P={},selection:W,linkedHover:E,onObservation:M,onClick:T,hoverHighlight:O,chartId:G,loading:z,loadingContent:j,emptyContent:$,legendInteraction:Q,legendPosition:X,pointIdAccessor:V,windowSize:Y}=e,{width:J,height:K,enableHover:U,showGrid:Z,showLegend:ee,title:te,description:oe,summary:ne,accessibleTable:ie,xLabel:re,yLabel:ae}=n,se=qe(()=>"function"==typeof m?e=>ot(m(e)):e=>ot(e[m]),[m]),le=qe(()=>"function"==typeof p?e=>ot(p(e)):e=>ot(e[p]),[p]),ce=qe(()=>"function"==typeof f?e=>ot(f(e)):e=>ot(e[f]),[f]),[he,de]=Ke([]),ue=Je([]),me=null==r,pe=qe(()=>C(me?he:r),[me,he,r]),fe=qe(()=>function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];let a=0,s=null,l=null,c=[];const h=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${a}-${e}`,u=e=>r.push(e),m=(e,t)=>{u({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const r=i[e],p=t(r),f=o(r),y=n(r);if(!Number.isFinite(p)||!Number.isFinite(f)||!Number.isFinite(y))continue;const g=h(f,y);if(null!==g)if(null!=s){if(l&&l.w!==g){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const o=f-l.a-(y-l.b);if(0!==o){const n=Math.max(0,Math.min(1,(l.b-l.a)/o));e=l.x+n*(p-l.x),t=l.a+n*(f-l.a)}else e=l.x,t=l.a}u({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t}),a++,s=g,u({__x:e,__y:t,__y0:t,__diffSegment:d(s),__diffWinner:s,__valA:t,__valB:t});for(let e=1;c.length>e;e++)m(c[e],s)}else for(const e of c)m(e,s);c=[],u({__x:p,__y:y>f?y:f,__y0:y>f?f:y,__diffSegment:d(s),__diffWinner:s,__valA:f,__valB:y,__sourceDatum:r}),l={x:p,a:f,b:y,w:g}}else{s=g;for(const e of c)m(e,s);c=[],u({__x:p,__y:y>f?y:f,__y0:y>f?f:y,__diffSegment:d(s),__diffWinner:s,__valA:f,__valB:y,__sourceDatum:r}),l={x:p,a:f,b:y,w:g}}else c.push({x:p,y:f,datum:r})}for(const e of c)m(e,s??"A");return r}(pe,se,le,ce),[pe,se,le,ce]),ye=qe(()=>x?function(e,t,o,n){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,o)=>t(e)-t(o)),r=[];for(const e of i){const i=t(e),a=o(e),s=n(e);Number.isFinite(a)&&r.push({__x:i,__y:a,__diffSegment:"line-A"}),Number.isFinite(s)&&r.push({__x:i,__y:s,__diffSegment:"line-B"})}return r}(pe,se,le,ce):[],[x,pe,se,le,ce]),ge=qe(()=>[...fe,...ye],[fe,ye]),be=qe(()=>{const e=new Set;for(const t of fe)e.add(t.__diffSegment);return Array.from(e)},[fe]);Ue(t,()=>{const e=e=>{const t=Y&&e.length>Y?e.slice(e.length-Y):e;ue.current=t,de(t)},t=V?"function"==typeof V?V:e=>e[V]:null;return{push:t=>e([...ue.current,t]),pushMany:t=>e([...ue.current,...t]),remove:o=>{if(!t)return[];const n=Array.isArray(o)?o:[o],i=[],r=[];for(const e of ue.current)n.includes(t(e))?i.push(e):r.push(e);return e(r),i},update:(o,n)=>{if(!t)return[];const i=Array.isArray(o)?o:[o],r=[],a=ue.current.map(e=>{if(i.includes(t(e))){const t=n(e);return r.push(t),t}return e});return e(a),r},clear:()=>e([]),getData:()=>me?ue.current:pe,getScales:()=>o.current?.getScales()??null}},[me,pe,V,Y]);const ve=i({data:pe,rawData:r,colorBy:"__diffWinner",colorScheme:[b,v],legendInteraction:Q,legendPosition:X,selection:W,linkedHover:E,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:M,onClick:T,hoverHighlight:O,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"DifferenceChart",chartId:G,showLegend:ee,userMargin:a,marginDefaults:n.marginDefaults,loading:z,loadingContent:j,emptyContent:$,width:J,height:K}),xe=qe(()=>{if(!1!==ee)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:y,color:b},{label:g,color:v}]}]}},[ee,y,g,b,v]),Ae=Ze(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?b:v,stroke:"none",fillOpacity:H}},[b,v,H]),we=Ze(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?b:v,strokeWidth:A,fill:"none"}),[b,v,A]),ke=Ze(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?b:v,r:k}),[b,v,k]),Se=Ze(e=>{const t=e.data,o=e.allSeries,n=e.xValue??t?.__x;let i=t?.__valA,r=t?.__valB;if(o&&o.length>0){const e=o.find(e=>"line-A"===e.group),t=o.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(i=e.value),null!=t?.value&&Number.isFinite(t.value)&&(r=t.value)}if(null!=n&&(null==i||null==r)){const e=pe.find(e=>se(e)===n);e&&(null==i&&(i=le(e)),null==r&&(r=ce(e)))}const a=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",s=c&&null!=n?c(n):null!=n?n+"":"";return tt("div",{className:"semiotic-tooltip",style:S,children:[s&&et("div",{style:{fontWeight:600,marginBottom:4},children:s}),tt("div",{style:{display:"flex",alignItems:"center",gap:6},children:[et("span",{style:{width:10,height:10,background:b,display:"inline-block",borderRadius:2}}),tt("span",{children:[y,": ",a(i)]})]}),tt("div",{style:{display:"flex",alignItems:"center",gap:6},children:[et("span",{style:{width:10,height:10,background:v,display:"inline-block",borderRadius:2}}),tt("span",{children:[g,": ",a(r)]})]}),null!=i&&null!=r&&Number.isFinite(i)&&Number.isFinite(r)&&tt("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",a(i-r)]})]})},[pe,se,le,ce,c,b,v,y,g]),Ce="multi"===B,Le=qe(()=>!1===B?()=>null:Ce?Se:_(B)||Se,[B,Ce,Se]);if(ve.earlyReturn)return ve.earlyReturn;const He={chartType:"mixed",data:ge,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:be,curve:L,areaStyle:Ae,lineStyle:we,...w&&{pointStyle:ke},size:[J,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ve.margin,showAxes:n.showAxes,xLabel:re,yLabel:ae,xFormat:c,yFormat:h,enableHover:U,showGrid:Z,...I&&{gradientFill:!0===I?{topOpacity:.85,bottomOpacity:.15}:I},...xe&&{legend:xe,legendPosition:ve.legendPosition},...d({title:te,description:oe,summary:ne,accessibleTable:ie,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:Le,...Ce&&{tooltipMode:"multi"},...u({linkedHover:E,selection:W,onObservation:M,onClick:T,hoverHighlight:O,mobileInteraction:ve.mobileInteraction,customHoverBehavior:ve.customHoverBehavior,customClickBehavior:ve.customClickBehavior}),...R&&R.length>0&&{annotations:R},...F&&{xExtent:F},...N&&{yExtent:N},...ve.crosshairProps,...P};return et(q,{componentName:"DifferenceChart",width:J,height:K,children:et(l,{ref:o,...He})})});"function"==typeof nt&&(nt.displayName="DifferenceChart");import{useMemo as it,forwardRef as rt,useRef as at}from"react";import{jsx as st}from"react/jsx-runtime";var lt=rt(function(e,o){const n=at(null),r=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:c,className:h,xFormat:m,yFormat:y,xAccessor:g="x",yAccessor:b="y",areaBy:v,lineDataAccessor:x="coordinates",colorBy:A,colorScheme:k,styleRules:S,curve:L="monotoneX",areaOpacity:H=.7,showLine:I=!0,lineWidth:B=2,showPoints:R=!1,pointRadius:F=3,normalize:_=!1,baseline:N="zero",stackOrder:P,tooltip:W,annotations:E,xExtent:M,yExtent:T,frameProps:O={},selection:G,linkedHover:z,onObservation:j,onClick:$,hoverHighlight:Q,chartId:X,loading:Y,loadingContent:J,emptyContent:K,legendInteraction:U,legendPosition:Z,color:ee,stroke:te,strokeWidth:oe,opacity:ne}=e,{width:ie,height:re,enableHover:ae,showGrid:se,showLegend:le,title:ce,description:he,summary:de,accessibleTable:ue,xLabel:me,yLabel:pe}=r,fe=it(()=>C(s),[s]),ye=A||v;a(o,{variant:"xy",frameRef:n});const ge=i({data:fe,rawData:s,colorBy:ye,colorScheme:k,legendInteraction:U,legendPosition:Z,selection:G,linkedHover:z,fallbackFields:ye?["string"==typeof ye?ye:""]:[],unwrapData:!1,onObservation:j,onClick:$,hoverHighlight:Q,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"StackedAreaChart",chartId:X,showLegend:le,userMargin:c,marginDefaults:r.marginDefaults,loading:Y,loadingContent:J,emptyContent:K,width:ie,height:re}),be=it(()=>f(g,b),[g,b]),{flattenedData:ve,lineStyle:xe,pointStyle:Ae,defaultTooltipContent:we}=$e({safeData:fe,data:s,areaBy:v,lineDataAccessor:x,colorBy:ye,colorScale:ge.colorScale,color:ee,stroke:te,strokeWidth:oe,opacity:ne,effectiveSelectionHook:ge.effectiveSelectionHook,resolvedSelection:ge.resolvedSelection,areaOpacity:H,showLine:I,lineWidth:B,showPoints:R,pointRadius:F,xAccessor:g,yAccessor:b,xLabel:me,yLabel:pe,xFormat:m,yFormat:y,groupField:v||A,styleRules:S,ruleContext:be}),ke=t({componentName:"StackedAreaChart",data:s,accessors:{xAccessor:g,yAccessor:b}}),Se={chartType:"stackedarea",...null!=s&&{data:ve},xAccessor:g,yAccessor:b,groupAccessor:v||void 0,curve:L,normalize:_,baseline:_?"zero":N,stackOrder:P,lineStyle:xe,...R&&Ae&&{pointStyle:Ae},size:[ie,re],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ge.margin,showAxes:r.showAxes,xLabel:me,yLabel:pe,xFormat:m,yFormat:y,enableHover:ae,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:se,...ge.legendBehaviorProps,...d({title:ce,description:he,summary:de,accessibleTable:ue,className:h,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===W?{tooltipContent:w(),tooltipMode:"multi"}:p({tooltip:W,defaultTooltipContent:we}),...u({linkedHover:z,selection:G,onObservation:j,onClick:$,hoverHighlight:Q,mobileInteraction:ge.mobileInteraction,customHoverBehavior:ge.customHoverBehavior,customClickBehavior:ge.customClickBehavior}),...E&&E.length>0&&{annotations:E},...M&&{xExtent:M},...T&&{yExtent:T},...ge.crosshairProps,...O};return ge.earlyReturn?ge.earlyReturn:ke?st(V,{componentName:"StackedAreaChart",message:ke,width:ie,height:re}):st(q,{componentName:"StackedAreaChart",width:ie,height:re,children:st(l,{ref:n,...Se})})});lt.displayName="StackedAreaChart";import{useMemo as ct,forwardRef as ht,useRef as dt}from"react";import{scaleSequential as ut}from"d3-scale";import{jsx as mt}from"react/jsx-runtime";var pt=ht(function(e,o){const n=dt(null);a(o,{variant:"xy",frameRef:n});const i=D(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:h,className:f,xAccessor:y="x",yAccessor:g="y",valueAccessor:b="value",xFormat:v,yFormat:x,colorScheme:A,customColorScale:w,showValues:k=!1,valueFormat:S,cellBorderColor:L="#fff",cellBorderWidth:B=1,tooltip:R,annotations:F,xExtent:_,yExtent:N,frameProps:P={},selection:M,linkedHover:O,onObservation:G,onClick:z,hoverHighlight:$,chartId:Q,loading:K,loadingContent:U,emptyContent:Z,showLegend:ee,legendPosition:te,legendInteraction:oe}=e,{width:ne,height:ie,enableHover:re,title:ae,description:se,summary:le,accessibleTable:ce,xLabel:he,yLabel:de}=i,ue=J(K,ne,ie,U),me=ue?null:Y(r,ne,ie,Z),pe=ct(()=>C(r),[r]),fe=j(),ye=A??fe??"blues",ge=ee??!1,be=te??"right",{margin:ve}=W({data:pe,colorBy:ge?"value":void 0,colorScale:void 0,showLegend:ge,legendPosition:be,userMargin:h,defaults:i.marginDefaults}),{customHoverBehavior:xe,customClickBehavior:Ae,crosshairSourceId:we}=E({selection:M,linkedHover:O,fallbackFields:[],onObservation:G,onClick:z,chartType:"Heatmap",chartId:Q,hoverHighlight:$,colorByField:void 0,mobileInteraction:i.mobileInteraction});s(M);const ke=H(O,we);T(oe,void 0,[]);const Se=ct(()=>"function"==typeof b?e=>b(e):e=>e[b],[b]),Ce=ct(()=>{const e=pe.map(Se);return X(e)},[pe,Se]),Le=ct(()=>{if("custom"===ye&&w)return w;const e=I(ye);return ut(e).domain(Ce)},[ye,w,Ce]),He=ct(()=>m([{label:he||c(y),accessor:y,role:"x",format:v},{label:de||c(g),accessor:g,role:"y",format:x},{label:c(b),accessor:b,role:"value",format:S}]),[y,g,he,de,b,v,x,S]),Ie=t({componentName:"Heatmap",data:r,accessors:{xAccessor:y,yAccessor:g,valueAccessor:b}}),Be=ct(()=>{if(ge)return{gradient:{colorFn:e=>Le(e),domain:Ce,label:"string"==typeof b?b:"value",format:S}}},[ge,Le,Ce,b,S]),Re={chartType:"heatmap",...null!=r&&{data:pe},xAccessor:y,yAccessor:g,valueAccessor:b,colorScheme:"custom"!==ye?ye:void 0,showValues:k,heatmapValueFormat:S,size:[ne,ie],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ve,showAxes:i.showAxes,xLabel:he,yLabel:de,xFormat:v,yFormat:x,enableHover:re,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...Be&&{legend:Be,legendPosition:be},...d({title:ae,description:se,summary:le,accessibleTable:ce,className:f,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...p({tooltip:R,defaultTooltipContent:He}),...u({linkedHover:O,selection:M,onObservation:G,onClick:z,hoverHighlight:$,mobileInteraction:i.mobileInteraction,customHoverBehavior:xe,customClickBehavior:Ae}),...F&&F.length>0&&{annotations:F},..._&&{xExtent:_},...N&&{yExtent:N},...ke,...P};return ue||me||(Ie?mt(V,{componentName:"Heatmap",message:Ie,width:ne,height:ie}):mt(q,{componentName:"Heatmap",width:ne,height:ie,children:mt(l,{ref:n,...Re})}))});pt.displayName="Heatmap";import{useMemo as ft,useCallback as yt,forwardRef as gt,useRef as bt}from"react";import{jsx as vt}from"react/jsx-runtime";var xt=gt(function(o,n){const r=bt(null),s=D(o.mode,{width:o.width,height:o.height,showGrid:o.showGrid,enableHover:o.enableHover,showLegend:o.showLegend,title:o.title,xLabel:o.xLabel,yLabel:o.yLabel,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,responsiveRules:o.responsiveRules}),{data:h,margin:y,className:g,xFormat:b,yFormat:v,xAccessor:x="x",yAccessor:A="y",sizeBy:w,sizeRange:k=[5,40],colorBy:S,colorScheme:L,styleRules:H,bubbleOpacity:I=.6,bubbleStrokeWidth:R=1,bubbleStrokeColor:_="white",tooltip:N,marginalGraphics:W,pointIdAccessor:E,annotations:M,regression:T,xExtent:O,yExtent:G,frameProps:z={},selection:j,linkedHover:$,linkedBrush:Q,onObservation:X,onClick:Y,hoverHighlight:J,chartId:K,loading:U,loadingContent:Z,emptyContent:ee,legendInteraction:te,legendPosition:oe,color:ne,stroke:re,strokeWidth:ae,opacity:se}=o,{width:le,height:he,enableHover:de,showGrid:ue,showLegend:me,title:pe,description:fe,summary:ye,accessibleTable:ge,xLabel:be,yLabel:ve}=s,xe=ft(()=>C(h),[h]),Ae=void 0===h,we=i({data:xe,rawData:h,colorBy:S,colorScheme:L,legendInteraction:te,legendPosition:oe,selection:j,linkedHover:$,fallbackFields:S?["string"==typeof S?S:""]:[],unwrapData:!1,onObservation:X,onClick:Y,hoverHighlight:J,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"BubbleChart",chartId:K,showLegend:me,userMargin:y,marginDefaults:s.marginDefaults,loading:U,loadingContent:Z,emptyContent:ee,width:le,height:he}),{domain:ke,trackPushed:Se,reset:Ce}=ce({accessor:w,data:xe,isPushMode:Ae}),Le=yt(e=>{Se([e]),r.current?.push(e)},[Se]),He=yt(e=>{Se(e),r.current?.pushMany(e)},[Se]);a(n,{variant:"xy",frameRef:r,overrides:{push:Le,pushMany:He,clear:()=>{Ce(),r.current?.clear()}}});const Ie=F(Q),Be=(P({name:Ie?.name||"__unused_brush__",xField:Ie?.xField||("string"==typeof x?x:void 0),yField:Ie?.yField||("string"==typeof A?A:void 0)}),ft(()=>({stroke:_,strokeWidth:R}),[_,R])),Re=ft(()=>ke??[0,1],[ke]),Fe=yt(e=>B(e,w,k,Re),[w,k,Re]),_e=ft(()=>f(x,A),[x,A]),Ne=ie({colorBy:S,colorScale:we.colorScale,color:ne,fillOpacity:I,radiusFn:Fe,baseStyleExtras:Be,stroke:re,strokeWidth:ae,opacity:se,styleRules:H,ruleContext:_e,effectiveSelectionHook:we.effectiveSelectionHook,resolvedSelection:we.resolvedSelection}),Pe=ft(()=>m([{label:be||c(x),accessor:x,role:"x",format:b},{label:ve||c(A),accessor:A,role:"y",format:v},{label:c(w),accessor:w,role:"size"},...S?[{label:c(S),accessor:S,role:"color"}]:[]]),[x,A,be,ve,w,S,b,v]);if(we.earlyReturn)return we.earlyReturn;const We=t({componentName:"BubbleChart",data:h,accessors:{xAccessor:x,yAccessor:A},requiredProps:{sizeBy:w}});if(We)return vt(V,{componentName:"BubbleChart",message:We,width:le,height:he});const De=e(T),Ee=De?[De,...M||[]]:M,Me={chartType:"bubble",...null!=h&&{data:xe},xAccessor:x,yAccessor:A,colorAccessor:S||void 0,sizeAccessor:w,sizeRange:k,pointStyle:Ne,colorScheme:L,size:[le,he],responsiveWidth:o.responsiveWidth,responsiveHeight:o.responsiveHeight,margin:we.margin,showAxes:s.showAxes,xLabel:be,yLabel:ve,xFormat:b,yFormat:v,enableHover:de,showGrid:ue,...we.legendBehaviorProps,...d({title:pe,description:fe,summary:ye,accessibleTable:ge,className:g,animate:o.animate,axisExtent:o.axisExtent,autoPlaceAnnotations:o.autoPlaceAnnotations}),...p({tooltip:N,defaultTooltipContent:Pe}),...u({linkedHover:$,selection:j,onObservation:X,onClick:Y,hoverHighlight:J,mobileInteraction:we.mobileInteraction,customHoverBehavior:we.customHoverBehavior,customClickBehavior:we.customClickBehavior}),...W&&{marginalGraphics:W},...E&&{pointIdAccessor:E},...Ee&&Ee.length>0&&{annotations:Ee},...O&&{xExtent:O},...G&&{yExtent:G},...we.crosshairProps,...z};return vt(q,{componentName:"BubbleChart",width:le,height:he,children:vt(l,{ref:r,...Me})})});xt.displayName="BubbleChart";import*as At from"react";import{useMemo as wt,useCallback as kt,useState as St,useRef as Ct,useEffect as Lt}from"react";import{brush as Ht}from"d3-brush";import{select as It}from"d3-selection";import{jsx as Bt,jsxs as Rt}from"react/jsx-runtime";var Ft="__splomIdx",_t={top:4,bottom:4,left:4,right:4};function Nt({frameRef:e,cellSize:t,onBrush:o}){const n=Ct(null),i=t-_t.left-_t.right,r=t-_t.top-_t.bottom;return Lt(()=>{if(!n.current)return;const t=It(n.current).select(".brush-g"),a=Ht().extent([[0,0],[i,r]]).on("brush end",t=>{const n=e.current?.getScales();if(!n)return;if(!(i=t.selection)||!Array.isArray(i[0]))return void o(null);var i;const[[r,a],[s,l]]=t.selection,c=[[n.x.invert(r),n.y.invert(a)],[n.x.invert(s),n.y.invert(l)]];o(c)});return t.call(a),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{a.on("brush end",null)}},[i,r,e,o]),Bt("svg",{ref:n,width:t,height:t,style:{position:"absolute",top:0,left:0},children:Bt("g",{className:"brush-g",transform:`translate(${_t.left},${_t.top})`})})}function Pt({data:e,xField:t,yField:o,cellSize:n,pointRadius:i,pointOpacity:r,colorBy:a,colorScale:s,brushSelectionName:c,hoverSelectionName:h,unselectedOpacity:d,mobileInteraction:m,mode:p,onPointHover:f,onPointClick:y}){const g=Ct(null),v=O({name:c,clientId:`splom-${t}-${o}`,fields:[t,o]}),x=P({name:c,xField:t,yField:o}),A=O({name:h,clientId:"splom-hover-source",fields:[Ft]}),w=A.selectPoints,k=kt(e=>{e?x.brushInteraction.during(e):x.brushInteraction.end(null)},[x.brushInteraction]),S=kt(e=>{if(!e)return void f?.(null);const t=e.data,o=t?.[Ft];void 0!==o&&(w({[Ft]:[o]}),f?.(t,e.x+_t.left,e.y+_t.top))},[w,f]),C=kt(e=>{if(!e)return void y?.(null);const t=e.data;t&&y?.(t,e.x+_t.left,e.y+_t.top)},[y]),H=kt(e=>{const t={opacity:r,r:i};return t.fill=a?L(e,a,s):b,"hover"===p?A.isActive&&A.predicate(e)?(t.opacity=1,t.r=2.5*i,t.stroke="#333",t.strokeWidth=1.5):A.isActive&&(t.opacity=.6*r):v.isActive&&!v.predicate(e)&&(t.opacity=d),t},[r,i,a,p,s,A,v,d]);return Rt("div",{style:{position:"relative",width:n,height:n},children:[Bt(l,{ref:g,chartType:"scatter",data:e,size:[n,n],xAccessor:t,yAccessor:o,pointStyle:H,margin:_t,showAxes:!1,enableHover:"hover"===p,...u({forceHoverBehavior:"hover"===p,forceClickBehavior:!!y,mobileInteraction:m,customHoverBehavior:S,customClickBehavior:C}),tooltipContent:"hover"===p?()=>null:void 0}),"brush"===p&&Bt(Nt,{frameRef:g,cellSize:n,xField:t,yField:o,onBrush:k})]})}function Wt({data:e,field:t,label:o,cellSize:n,bins:i,colorBy:r,colorScale:a,brushSelectionName:s,hoverSelectionName:l,mode:c}){const h=O({name:s,clientId:"splom-diag-"+t,fields:[t]}),d=O({name:l,clientId:`splom-diag-${t}-hover`,fields:[Ft]}),u="hover"===c?d:h,m=u.isActive,p=u.predicate,f=wt(()=>{const o="string"==typeof r?r:null,a=[],s=new Set;for(const n of e){const e=n[t];if(null==e||isNaN(e)||a.push(Number(e)),o){const e=n[o];null!=e&&s.add(e+"")}}if(0===a.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=X(a),h=(c-l)/i||1,d=Array.from(s),u=new Map(d.map((e,t)=>[e,t])),f=Array(i).fill(0),y=Array(i).fill(0),g=Array.from({length:i},()=>Array(d.length).fill(0)),b=Array.from({length:i},()=>Array(d.length).fill(0));for(const n of e){const e=n[t];if(null==e||isNaN(e))continue;const r=Math.min(Math.floor((e-l)/h),i-1);if(f[r]++,m&&!p(n)||y[r]++,o){const e=u.get(n[o]+"");void 0!==e&&(g[r][e]++,m&&!p(n)||b[r][e]++)}}const v=Q(f,1),x=g.map((e,t)=>{let o=0;return e.map((e,r)=>{const a=e/v*(n-24),s={x:t/i*n,w:n/i-1,h:a,y0:o,category:d[r]};return o+=a,s})}),A=b.map((e,t)=>{let o=0;return e.map((e,r)=>{const a=e/v*(n-24),s={x:t/i*n,w:n/i-1,h:a,y0:o,category:d[r]};return o+=a,s})});return{bars:f.map((e,t)=>({x:t/i*n,w:n/i-1,h:e/v*(n-24),count:e})),selectedBars:y.map((e,t)=>({x:t/i*n,w:n/i-1,h:e/v*(n-24),count:e})),categoryBars:x,selectedCategoryBars:A,max:v,categories:d}},[e,t,i,n,m,p,r]);return Rt("svg",{width:n,height:n,style:{overflow:"hidden"},children:[Bt("text",{x:n/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:o}),f.categories.length>0?f.categoryBars.map((e,t)=>e.map((e,o)=>Bt("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:a?a(e.category):b,opacity:m?.3:.6},`bg-${t}-${o}`))):f.bars.map((e,t)=>Bt("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:b,opacity:m?.3:.6},"bg-"+t)),m&&(f.categories.length>0?f.selectedCategoryBars.map((e,t)=>e.map((e,o)=>Bt("rect",{x:e.x,y:n-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:a?a(e.category):b,opacity:.7},`sel-${t}-${o}`))):f.selectedBars.map((e,t)=>Bt("rect",{x:e.x,y:n-e.h,width:Math.max(e.w,1),height:e.h,fill:b,opacity:.7},"sel-"+t)))]})}function Dt({label:e,cellSize:t}){return Bt("svg",{width:t,height:t,children:Bt("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function Et(e){const{data:t,fields:o,fieldLabels:n={},colorBy:i,colorScheme:r,cellSize:a=150,cellGap:s=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:h="histogram",histogramBins:d=20,brushMode:u="crossfilter",hoverMode:m=!0,unselectedOpacity:p=.1,showGrid:f=!1,tooltip:y,showLegend:g,idAccessor:v,width:x,className:A,onObservation:w,onClick:k,chartId:S}=e,C="splom",L="splom-hover",H=N(e.mobileInteraction,{mode:e.mode,width:x??o.length*a,mobileSemantics:e.mobileSemantics}),I=m?"hover":u?"brush":"hover",B=G(e=>e.clearSelection),[R,F]=St(null),_=kt(()=>{B(L),F(null)},[B,L]),P=wt(()=>(t||[]).map((e,t)=>void 0!==e[Ft]?e:{...e,[Ft]:t}),[t]),W=M(P,i,r),D=kt((e,t,o,n)=>[40+e*(a+s)+(o??0),t*(a+s)+(n??0)],[40,a,s]),E=void 0!==g?g:!!i,T=wt(()=>{if(!E||!i)return null;const e="string"==typeof i?i:null;return e?Array.from(new Set(P.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:W?W(e+""):b})):null},[E,i,P,W]),O=wt(()=>({display:"grid",gridTemplateColumns:"40px "+o.map(()=>a+"px").join(" "),gridTemplateRows:o.map(()=>a+"px").join(" ")+" 40px",gap:s+"px",width:"fit-content"}),[o,a,s,40]);return Rt("div",{className:A,style:{position:"relative"},children:[T&&Bt("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:T.map(e=>Rt("div",{style:{display:"flex",alignItems:"center",gap:4},children:[Bt("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),Bt("span",{style:{fontSize:11},children:e.label})]},e.label))}),Rt("div",{style:O,onMouseLeave:"hover"===I?_:void 0,children:[o.map((e,t)=>Rt(At.Fragment,{children:[Bt("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e}),o.map((o,r)=>t===r?"label"===h?Bt(Dt,{label:n[e]||e,cellSize:a},"diag-"+e):Bt(Wt,{data:P,field:e,label:n[e]||e,cellSize:a,bins:d,colorBy:i,colorScale:W,brushSelectionName:C,hoverSelectionName:L,unselectedOpacity:p,mode:I},"diag-"+e):Bt(Pt,{data:P,xField:o,yField:e,fieldLabels:n,cellSize:a,pointRadius:l,pointOpacity:c,colorBy:i,colorScale:W,brushSelectionName:C,hoverSelectionName:L,unselectedOpacity:p,showGrid:f,tooltip:y,mobileInteraction:H,mode:I,onPointHover:"hover"===I?(n,i,a)=>{if(n){if(F({datum:n,xField:o,yField:e,colIndex:r,rowIndex:t,px:i??0,py:a??0}),w){const[e,o]=D(r,t,i,a);w({type:"hover",datum:n,x:e,y:o,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}}else F(null),w&&w({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0,onPointClick:k||w?(e,o,n)=>{if(!e)return;const[i,a]=D(r,t,o,n);k&&k(e,{x:i,y:a}),w&&w({type:"click",datum:e,x:i,y:a,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:S})}:void 0},`cell-${e}-${o}`))]},"row-"+e)),Bt("div",{})," ",o.map(e=>Bt("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:n[e]||e},"col-label-"+e))]}),R&&"hover"===I&&(()=>{const e=R.datum,t=n[R.xField]||R.xField,o=n[R.yField]||R.yField,r=i?"function"==typeof i?i(e):e[i]:null,l=v?"function"==typeof v?v(e):e[v]:"Row "+e[Ft];return Rt("div",{style:{position:"absolute",left:40+R.colIndex*(a+s)+R.px,top:R.rowIndex*(a+s)+R.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[Bt("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),Rt("div",{children:[t,": ",null!=e[R.xField]?Number(e[R.xField]).toFixed(1):"–"]}),Rt("div",{children:[o,": ",null!=e[R.yField]?Number(e[R.yField]).toFixed(1):"–"]}),null!=r&&Rt("div",{style:{opacity:.8},children:["string"==typeof i?i:"group",": ",r+""]})]})})()]})}function Mt(e){const{brushMode:t="crossfilter",hoverMode:o=!0}=e,n={};return!o&&t&&(n.splom={resolution:t}),o&&(n["splom-hover"]={resolution:"union"}),Bt(A,{selections:n,children:Bt(Et,{...e})})}Mt.displayName="ScatterplotMatrix";import{useState as Tt,useRef as Ot,useEffect as Gt,useMemo as zt,useCallback as jt}from"react";import{brushX as $t,brushY as Qt}from"d3-brush";import{select as Xt}from"d3-selection";import{jsx as Vt,jsxs as qt}from"react/jsx-runtime";function Yt({width:e,height:t,margin:o,scales:n,brushDirection:i,extent:r,onBrush:a}){const s=Ot(null),l=Ot(null),c=Ot(!1),h=e+o.left+o.right,d=t+o.top+o.bottom;return Gt(()=>{if(!s.current||!n)return;const o=Xt(s.current).select(".brush-group"),r="x"===i?$t().extent([[0,0],[e,t]]):Qt().extent([[0,0],[e,t]]);return r.on("brush end",e=>{if(c.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void a(null);const o=("x"===i?n.x:n.y).invert;if(!o)return;const r=[o(t[0]),o(t[1])];a(r)}),o.call(r),l.current=e=>{o.call(r.move,e)},o.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{l.current=null,r.on("brush end",null)}},[n,e,t,i,a]),Gt(()=>{if(!l.current||!n||!s.current)return;const e="x"===i?n.x:n.y;if(c.current=!0,r){const t=[e(r[0]),e(r[1])];l.current(t)}else l.current(null);c.current=!1},[r,n,i]),Vt("svg",{ref:s,width:h,height:d,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:Vt("g",{className:"brush-group",transform:`translate(${o.left},${o.top})`})})}function Jt(e){const{data:o,width:n=600,height:i=400,margin:r,className:a,title:s,description:h,summary:d,xLabel:u,yLabel:p,xFormat:f,yFormat:y,xAccessor:g="x",yAccessor:v="y",lineBy:x,lineDataAccessor:A="coordinates",colorBy:w,colorScheme:k,curve:S="linear",lineWidth:H=2,fillArea:I=!1,areaOpacity:B=.3,showPoints:R=!1,pointRadius:F=3,enableHover:N=!0,showGrid:P=!1,showLegend:D,legendPosition:E,tooltip:T,minimap:O={},renderBefore:G=!1,onBrush:z,brushExtent:j,yExtent:$,frameProps:Q={},loading:X,loadingContent:K,emptyContent:U}=e,Z=J(X,n,i,K),ee=Z?null:Y(o,n,i,U),te=zt(()=>C(o),[o]),[oe,ne]=Tt(null),ie=j??oe,re=jt(e=>{j||ne(e),z?.(e)},[j,z]),ae=Ot(null),[se,le]=Tt(null);Gt(()=>{let e=0,t=!1;const o=()=>{if(t)return;const n=ae.current?.getScales?.();n?le(n):e=requestAnimationFrame(o)};return e=requestAnimationFrame(o),()=>{t=!0,e&&cancelAnimationFrame(e)}},[o]);const ce=void 0!==te[0]?.[A],he=zt(()=>{if(ce)return te;if(x){const e=te.reduce((e,t)=>{const o="function"==typeof x?x(t):t[x];if(!e[o]){const t={[A]:[]};"string"==typeof x&&(t[x]=o),e[o]=t}return e[o][A].push(t),e},{});return Object.values(e)}return[{[A]:te}]},[te,x,A,ce]),de=zt(()=>ce||x?he.flatMap(e=>{const t=e[A]||[];return x&&"string"==typeof x?t.map(t=>({...t,[x]:e[x]})):t}):te,[he,A,ce,x,te]),ue=M(te,w,k),me=De({lineWidth:H,colorBy:w,colorScale:ue,fillArea:I,areaOpacity:B}),pe=zt(()=>{if(O.lineStyle)return O.lineStyle},[O.lineStyle]),fe=De({lineWidth:1,colorBy:w,colorScale:ue}),ye=pe??fe,ge=zt(()=>{if(R)return e=>{const t={r:F,fillOpacity:1};return t.fill=w?L(e.parentLine||e,w,ue):b,t}},[R,F,w,ue]),{legend:be,margin:ve,legendPosition:xe}=W({data:he,colorBy:w,colorScale:ue,showLegend:D,legendPosition:E,userMargin:r}),Ae=O.height||60,we=zt(()=>({top:O.margin?.top??0,bottom:O.margin?.bottom??20,left:O.margin?.left??ve.left,right:O.margin?.right??ve.right}),[O.margin,ve]),ke=O.brushDirection||"x",Se=zt(()=>m([{label:u||c(g),accessor:g,role:"x",format:f},{label:p||c(v),accessor:v,role:"y",format:y}]),[g,v,u,p,f,y]),Ce=t({componentName:"MinimapChart",data:o,accessors:{xAccessor:g,yAccessor:v}});if(Ce)return Vt(V,{componentName:"MinimapChart",message:Ce,width:n,height:i});const Le=I?"area":"line",He={chartType:Le,data:de,xAccessor:g,yAccessor:v,groupAccessor:x||void 0,curve:S,lineStyle:me,...R&&{pointStyle:ge},size:[n,i],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ve,showAxes:!0,xLabel:u,yLabel:p,xFormat:f,yFormat:y,enableHover:N,showGrid:P,...be&&{legend:be,legendPosition:xe},...s&&{title:s},...h&&{description:h},...d&&{summary:d},tooltipContent:!1===T?()=>null:_(T)||Se,...ie&&{xExtent:ie},...$&&{yExtent:$},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...Q},Ie={chartType:Le,data:de,xAccessor:g,yAccessor:v,groupAccessor:x||void 0,curve:S,lineStyle:ye,size:[n,Ae+we.top+we.bottom],margin:we,showAxes:O.showAxes??!1,background:O.background,enableHover:!1,...$&&{yExtent:$}},Be=qt("div",{style:{position:"relative",width:n,overflow:"hidden"},children:[Vt(l,{ref:ae,...Ie}),Vt(Yt,{width:n-we.left-we.right,height:Ae,margin:we,scales:se,brushDirection:ke,extent:ie,onBrush:re})]},"minimap"),Re=Vt("div",{style:{overflow:"hidden"},children:Vt(l,{...He})},"main");return Z||ee||Vt(q,{componentName:"MinimapChart",width:n,height:i,children:qt("div",{className:"minimap-chart"+(a?" "+a:""),children:[G?Be:Re,G?Re:Be]})})}Jt.displayName="MinimapChart";import{useMemo as Kt,forwardRef as Ut,useRef as Zt}from"react";var eo={topLeft:{label:"Low / High",color:"#E9C46A",opacity:.08},topRight:{label:"High / High",color:"#2A9D8F",opacity:.08},bottomLeft:{label:"Low / Low",color:"#E76F51",opacity:.08},bottomRight:{label:"High / Low",color:"#86BBD8",opacity:.08}};import{Fragment as to,jsx as oo,jsxs as no}from"react/jsx-runtime";function io(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var ro=Ut(function(e,o){const n=Zt(null);a(o,{variant:"xy",frameRef:n});const r=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:h,className:d,xFormat:p,yFormat:y,xAccessor:g="x",yAccessor:v="y",xCenter:x,yCenter:A,quadrants:w,centerlineStyle:k={},showQuadrantLabels:S=!0,quadrantLabelSize:L=12,colorBy:H,colorScheme:I,styleRules:R,sizeBy:F,sizeRange:N=[3,15],pointRadius:P=5,pointOpacity:W=.8,tooltip:E,pointIdAccessor:M,annotations:T,frameProps:O={},selection:G,linkedHover:z,onObservation:j,onClick:$,hoverHighlight:Q,chartId:Y,loading:J,loadingContent:U,emptyContent:Z,legendInteraction:ee,legendPosition:te,color:oe,stroke:ne,strokeWidth:re,opacity:ae}=e,{width:se,height:le,enableHover:ce,showGrid:he,showLegend:de,title:ue,description:me,summary:pe,accessibleTable:fe,xLabel:ye,yLabel:ge}=r,be=Kt(()=>({topLeft:io(eo.topLeft,w?.topLeft),topRight:io(eo.topRight,w?.topRight),bottomLeft:io(eo.bottomLeft,w?.bottomLeft),bottomRight:io(eo.bottomRight,w?.bottomRight)}),[w]),ve=Kt(()=>C(s),[s]),xe=i({data:ve,rawData:s,colorBy:H,colorScheme:I,legendInteraction:ee,legendPosition:te,selection:G,linkedHover:z,fallbackFields:"string"==typeof H?[H]:[],unwrapData:!1,onObservation:j,onClick:$,hoverHighlight:Q,mobileInteraction:r.mobileInteraction,mobileSemantics:r.mobileSemantics,chartType:"QuadrantChart",chartId:Y,showLegend:de,userMargin:h,marginDefaults:r.marginDefaults,loading:J,loadingContent:U,emptyContent:Z,width:se,height:le});K("QuadrantChart",ve,"xAccessor",g),K("QuadrantChart",ve,"yAccessor",v);const Ae=Kt(()=>{if(!ve.length)return;const e="function"==typeof g?g:e=>+e[g],t="function"==typeof v?v:e=>+e[v];let o=1/0,n=-1/0,i=1/0,r=-1/0;for(const a of ve){const s=e(a),l=t(a);isFinite(s)&&(o>s&&(o=s),s>n&&(n=s)),isFinite(l)&&(i>l&&(i=l),l>r&&(r=l))}if(null!=x&&isFinite(x)&&(o>x&&(o=x),x>n&&(n=x)),null!=A&&isFinite(A)&&(i>A&&(i=A),A>r&&(r=A)),o===1/0)return;const a=.1*(n-o)||1,s=.1*(r-i)||1;return{xExtent:[o-a,n+a],yExtent:[i-s,r+s]}},[ve,g,v,x,A]),we=Kt(()=>{if(!F||0===ve.length)return;const e=ve.map(e=>"function"==typeof F?F(e):e[F]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?X(e):void 0},[ve,F]),ke=Kt(()=>"function"==typeof g?g:e=>+e[g],[g]),Se=Kt(()=>"function"==typeof v?v:e=>+e[v],[v]),Ce=Kt(()=>e=>{const t=ke(e),o=Se(e),n=null!=x?t>=x:void 0,i=null!=A?o>=A:void 0;return void 0===i||void 0===n?oe||b:i&&n?be.topRight.color:i&&!n?be.topLeft.color:!i&&n?be.bottomRight.color:be.bottomLeft.color},[ke,Se,x,A,be,oe]),Le=Kt(()=>F?e=>B(e,F,N,we):void 0,[F,N,we]),He=Kt(()=>f(g,v),[g,v]),Ie=ie({colorBy:H,colorScale:xe.colorScale,color:oe,pointRadius:P,fillOpacity:W,radiusFn:Le,fallbackFill:Ce,stroke:ne,strokeWidth:re,opacity:ae,styleRules:R,ruleContext:He,effectiveSelectionHook:xe.effectiveSelectionHook,resolvedSelection:xe.resolvedSelection}),Be=Kt(()=>{if(!ve.length)return;const e=new Set;"string"==typeof g&&e.add(g),"string"==typeof v&&e.add(v),"string"==typeof H&&e.add(H),"string"==typeof F&&e.add(F);const t=ve[0];for(const o of Object.keys(t))if(!o.startsWith("_")&&!e.has(o)&&"string"==typeof t[o])return o},[ve,g,v,H,F]),Re=Kt(()=>m([...Be?[{label:Be,accessor:Be,role:"title"}]:[],{label:ye||c(g),accessor:g,role:"x",format:p},{label:ge||c(v),accessor:v,role:"y",format:y},...H?[{label:c(H),accessor:H,role:"color"}]:[],...F?[{label:c(F),accessor:F,role:"size"}]:[]]),[Be,g,v,ye,ge,H,F,p,y]),Fe=t({componentName:"QuadrantChart",data:s,accessors:{xAccessor:g,yAccessor:v}}),_e=Kt(()=>{const e={stroke:k.stroke||"#999",strokeWidth:k.strokeWidth??1,dashArray:k.strokeDasharray||[]};return[(t,o,n,i)=>{if(!n?.x||!n?.y)return;const r=i.width,a=i.height,s=null!=x?n.x(x):r/2,l=null!=A?n.y(A):a/2;if(null!=x&&!isFinite(s))return;if(null!=A&&!isFinite(l))return;const c=Math.max(0,Math.min(r,s)),h=Math.max(0,Math.min(a,l)),d=[{config:be.topLeft,x:0,y:0,w:c,h:h},{config:be.topRight,x:c,y:0,w:r-c,h:h},{config:be.bottomLeft,x:0,y:h,w:c,h:a-h},{config:be.bottomRight,x:c,y:h,w:r-c,h:a-h}];for(const e of d)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,a),t.stroke(),t.beginPath(),t.moveTo(0,h),t.lineTo(r,h),t.stroke(),t.setLineDash([])}]},[x,A,be,k]),Ne=Kt(()=>S?[..._e,(e,t,o,n)=>{if(!o?.x||!o?.y)return;const i=n.width,r=n.height,a=null!=x?o.x(x):i/2,s=null!=A?o.y(A):r/2;(null==x||isFinite(a))&&(null==A||isFinite(s))&&(e.font=`600 ${L}px sans-serif`,e.globalAlpha=.5,e.fillStyle=be.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(be.topLeft.label,8,8),e.fillStyle=be.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(be.topRight.label,i-8,8),e.fillStyle=be.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(be.bottomLeft.label,8,r-8),e.fillStyle=be.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(be.bottomRight.label,i-8,r-8),e.globalAlpha=1)}]:_e,[_e,S,L,be,x,A]),Pe=Kt(()=>{const e=O.canvasPreRenderers||[];return[...Ne,...e]},[Ne,O.canvasPreRenderers]),We=Kt(()=>{const e={stroke:k.stroke||"#999",strokeWidth:k.strokeWidth??1,dashArray:k.strokeDasharray?Array.isArray(k.strokeDasharray)?k.strokeDasharray.join(","):k.strokeDasharray:void 0};return[(t,o,n)=>{if(!o?.x||!o?.y)return null;const i=n.width,r=n.height,a=null!=x?o.x(x):i/2,s=null!=A?o.y(A):r/2;if(null!=x&&!isFinite(a))return null;if(null!=A&&!isFinite(s))return null;const l=Math.max(0,Math.min(i,a)),c=Math.max(0,Math.min(r,s));return no(to,{children:[[{config:be.topLeft,x:0,y:0,w:l,h:c},{config:be.topRight,x:l,y:0,w:i-l,h:c},{config:be.bottomLeft,x:0,y:c,w:l,h:r-c},{config:be.bottomRight,x:l,y:c,w:i-l,h:r-c}].map((e,t)=>e.w>0&&e.h>0?oo("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),oo("line",{x1:l,y1:0,x2:l,y2:r,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),oo("line",{x1:0,y1:c,x2:i,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),S&&no(to,{children:[oo("text",{x:8,y:8+L,fill:be.topLeft.color,fontWeight:600,fontSize:L,opacity:.5,children:be.topLeft.label}),oo("text",{x:i-8,y:8+L,fill:be.topRight.color,fontWeight:600,fontSize:L,opacity:.5,textAnchor:"end",children:be.topRight.label}),oo("text",{x:8,y:r-8,fill:be.bottomLeft.color,fontWeight:600,fontSize:L,opacity:.5,children:be.bottomLeft.label}),oo("text",{x:i-8,y:r-8,fill:be.bottomRight.color,fontWeight:600,fontSize:L,opacity:.5,textAnchor:"end",children:be.bottomRight.label})]})]})}]},[x,A,be,k,S,L]);if(xe.earlyReturn)return xe.earlyReturn;const De={chartType:"scatter",...null!=s&&{data:ve},xAccessor:g,yAccessor:v,colorAccessor:H||void 0,sizeAccessor:F||void 0,sizeRange:N,pointStyle:Ie,colorScheme:I,size:[se,le],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:xe.margin,showAxes:r.showAxes,xLabel:ye,yLabel:ge,xFormat:p,yFormat:y,enableHover:ce,showGrid:he,...Ae&&{xExtent:Ae.xExtent,yExtent:Ae.yExtent},...xe.legendBehaviorProps,...ue&&{title:ue},...me&&{description:me},...pe&&{summary:pe},...void 0!==fe&&{accessibleTable:fe},...d&&{className:d},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===E?()=>null:!0===E||void 0===E?Re:_(E)||Re,...u({linkedHover:z,selection:G,onObservation:j,onClick:$,hoverHighlight:Q,mobileInteraction:xe.mobileInteraction,customHoverBehavior:xe.customHoverBehavior,customClickBehavior:xe.customClickBehavior}),...M&&{pointIdAccessor:M},...T&&T.length>0&&{annotations:T},canvasPreRenderers:Pe,...xe.crosshairProps,...O,...Pe.length>0&&{canvasPreRenderers:Pe},svgPreRenderers:We};return Fe?oo(V,{componentName:"QuadrantChart",message:Fe,width:se,height:le}):oo(q,{componentName:"QuadrantChart",width:se,height:le,children:oo(l,{ref:n,...De})})});ro.displayName="QuadrantChart";import*as ao from"react";import{useMemo as so,useCallback as lo,forwardRef as co,useRef as ho,useImperativeHandle as uo}from"react";import{jsx as mo}from"react/jsx-runtime";var po="__ma_unitized",fo="__ma_series";function yo(e,t){const o=t[1]-t[0];return 0===o?.5:(e-t[0])/o}function go(e,t){return t[0]+e*(t[1]-t[0])}var bo=co(function(e,o){const n=ho(null),r=ho([]),a=ho(e.series);a.current=e.series,uo(o,()=>{const e=()=>(a.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!n.current)return;const o=e(),i=t;for(let e=0;o.length>e&&2>e;e++){const t=o[e],a=t.extent||r.current[e];if(!a)continue;const s=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=s&&isFinite(s)&&n.current.push({...i,[po]:yo(s,a),[fo]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!n.current)return;const o=e(),i=[];for(const e of t)for(let t=0;o.length>t&&2>t;t++){const n=o[t],a=n.extent||r.current[t];if(!a)continue;const s=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=s&&isFinite(s)&&i.push({...e,[po]:yo(s,a),[fo]:n.label||"Series "+(t+1)})}n.current.pushMany(i)},remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>n.current?.clear(),getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}},[]);const s=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:c,margin:h,className:d,xFormat:m,xAccessor:p="x",series:f,colorScheme:y,curve:b="monotoneX",lineWidth:x=2,tooltip:A,annotations:w,frameProps:k={},selection:S,linkedHover:L,onObservation:H,onClick:I,hoverHighlight:B,chartId:R,loading:F,loadingContent:N,emptyContent:P,legendInteraction:W,legendPosition:E,stroke:M,strokeWidth:T,opacity:O}=e,{width:G,height:j,enableHover:$,showGrid:Q,showLegend:X=!0,title:K,description:U,summary:Z,accessibleTable:ee,xLabel:te}=s,oe=so(()=>C(c),[c]),ne=so(()=>C(f),[f]),ie=ne,re=2===ne.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||re||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${ne.length}. Rendering as a standard multi-line chart.`);const ae=J(F,G,j,N),se=ae?null:Y(c,G,j,P),le=z(),ce=so(()=>{let e;if(Array.isArray(y))e=y;else if(le&&le.length>0)e=le;else{const t=g[y];e=Array.isArray(t)?t:v}return ie.map((t,o)=>t.color||e[o%e.length])},[ie,y,le]),he=so(()=>ne.map((e,t)=>e.label||"Series "+(t+1)),[ne]),{unitizedData:de,extents:ue}=so(()=>{if(0===oe.length){const e=ne.map(e=>e.extent||null).filter(Boolean);return e.length===ne.length&&(r.current=e),{unitizedData:[],extents:e.length===ne.length?e:[]}}const e=ne.map(e=>e.extent||function(e,t){let o=1/0,n=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(o>e&&(o=e),e>n&&(n=e))}if(!isFinite(o)||!isFinite(n))return[0,1];if(o===n){const e=0===o?1:.1*Math.abs(o);return[o-e,n+e]}return[o,n]}(oe,e.yAccessor));if(r.current=e,!re){const t=[];for(const e of oe)for(let o=0;ne.length>o;o++){const n=ne[o],i=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=i&&t.push({...e,[po]:i,[fo]:he[o]})}return{unitizedData:t,extents:e}}const t=[];for(const o of oe)for(let n=0;2>n;n++){const i=ne[n],r=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(o);null!=r&&t.push({...o,[po]:yo(r,e[n]),[fo]:he[n]})}return{unitizedData:t,extents:e}},[oe,ne,re,he]),me=so(()=>{if(re&&ue.length>=2)return[{orient:"left",label:he[0],tickFormat:ne[0].format||(e=>{const t=go(e,ue[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:he[1],tickFormat:ne[1].format||(e=>{const t=go(e,ue[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[re,ue,ne,he]),pe=so(()=>de.length>0?de:he.map(e=>({[fo]:e})),[de,he]),fe=i({data:pe,rawData:c,colorBy:fo,colorScheme:ce,legendInteraction:W,legendPosition:E,selection:S,linkedHover:L,fallbackFields:[fo],unwrapData:!1,onObservation:H,onClick:I,hoverHighlight:B,mobileInteraction:s.mobileInteraction,mobileSemantics:s.mobileSemantics,chartType:"MultiAxisLineChart",chartId:R,showLegend:X,userMargin:h,marginDefaults:re?{...s.marginDefaults,left:70,right:70}:s.marginDefaults,loading:F,loadingContent:N,emptyContent:P,width:G,height:j}),ye=so(()=>{const e=new Map;return he.forEach((t,o)=>e.set(t,ce[o])),e},[he,ce]),ge=De({lineWidth:x,resolveStroke:lo(e=>ye.get(e[fo])||ce[0],[ye,ce]),stroke:M,strokeWidth:T,opacity:O,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),be=so(()=>{if(!1===A)return()=>null;return _(A)||(e=>{const t=e.data||e,o=t[fo],n=he.indexOf(o),i=t[po],r=re&&n>=0&&ue[n]?go(i,ue[n]):i,a=n>=0&&ne[n]?.format?ne[n].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),s="function"==typeof p?p(t):t[p];return ao.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},ao.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ce[n]||"inherit"}},o),ao.createElement("div",null,`${"string"==typeof p?p:"x"}: ${s}`),ao.createElement("div",null,`${o}: ${a(r)}`))})},[A,he,ce,ue,re,ne,p]);if(fe.earlyReturn)return fe.earlyReturn;const ve=t({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:p}}),xe=re?[0,1]:void 0,Ae={chartType:"line",...null!=c&&{data:de},xAccessor:p,yAccessor:po,groupAccessor:fo,lineStyle:ge,colorScheme:ce,size:[G,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe.margin,showAxes:s.showAxes,...me&&{axes:me},xLabel:te,...re?{}:{yLabel:he[0]},xFormat:m,...re&&xe&&{yExtent:xe},enableHover:$,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:Q,curve:b,...fe.legendBehaviorProps,...K&&{title:K},...U&&{description:U},...Z&&{summary:Z},...void 0!==ee&&{accessibleTable:ee},...d&&{className:d},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:be,...w&&{annotations:w},...u({linkedHover:L,selection:S,onObservation:H,onClick:I,hoverHighlight:B,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior}),...fe.crosshairProps,...k};return ae||se||(ve?mo(V,{componentName:"MultiAxisLineChart",message:ve,width:G,height:j}):mo(q,{componentName:"MultiAxisLineChart",width:G,height:j,children:mo(l,{ref:n,...Ae})}))});bo.displayName="MultiAxisLineChart";import{useMemo as vo,forwardRef as xo,useRef as Ao}from"react";import{jsx as wo}from"react/jsx-runtime";var ko=xo(function(e,o){const i=Ao(null);a(o,{variant:"xy",frameRef:i});const r=D(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:s,margin:h,className:f,xFormat:y,yFormat:g,xAccessor:b="x",highAccessor:v="high",lowAccessor:x="low",openAccessor:A,closeAccessor:w,candlestickStyle:k,tooltip:S,annotations:L,xExtent:I,yExtent:B,frameProps:R={},selection:F,linkedHover:_,onObservation:N,onClick:P,chartId:W,loading:M,loadingContent:T,emptyContent:O}=e,{width:G,height:z,enableHover:j,showGrid:$,title:Q,description:X,summary:U,accessibleTable:Z,xLabel:ee,yLabel:te}=r,oe=J(M,G,z,T),ne=oe?null:Y(s,G,z,O),ie=vo(()=>C(s),[s]),re=null==A||null==w;K("CandlestickChart",ie,"xAccessor",b),K("CandlestickChart",ie,"highAccessor",v),K("CandlestickChart",ie,"lowAccessor",x),re||(K("CandlestickChart",ie,"openAccessor",A),K("CandlestickChart",ie,"closeAccessor",w));const{customHoverBehavior:ae,customClickBehavior:se,crosshairSourceId:le}=E({selection:F,linkedHover:_,onObservation:N,onClick:P,chartType:"CandlestickChart",chartId:W,mobileInteraction:r.mobileInteraction}),ce=H(_,le),he=vo(()=>{const t=r.marginDefaults,o="sparkline"===e.mode?{...t,top:0,bottom:0}:t;return null==h?o:{...o,...n(h)}},[h,r.marginDefaults,e.mode]),de=vo(()=>{const e=[{label:ee||c(b),accessor:b,role:"x",format:y}];return re?(e.push({label:"High",accessor:v,role:"y",format:g}),e.push({label:"Low",accessor:x,format:g})):(e.push({label:"Open",accessor:A,format:g}),e.push({label:"High",accessor:v,format:g}),e.push({label:"Low",accessor:x,format:g}),e.push({label:"Close",accessor:w,format:g})),m(e)},[b,ee,y,g,v,x,A,w,re]),ue=t({componentName:"CandlestickChart",data:s,accessors:{xAccessor:b,highAccessor:v,lowAccessor:x,...!re&&{openAccessor:A,closeAccessor:w}}}),me={chartType:"candlestick",...null!=s&&{data:ie},xAccessor:b,yAccessor:v,highAccessor:v,lowAccessor:x,...!re&&{openAccessor:A,closeAccessor:w},...k&&{candlestickStyle:k},scalePadding:Math.max(2,Math.min(12,Math.round(G/40))),extentPadding:G>200?.1:.02,size:[G,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he,showAxes:r.showAxes,xLabel:ee,yLabel:te,xFormat:y,yFormat:g,enableHover:j,showGrid:$,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...d({title:Q,description:X,summary:U,accessibleTable:Z,className:f,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...p({tooltip:S,defaultTooltipContent:de}),...u({linkedHover:_,selection:F,onObservation:N,onClick:P,mobileInteraction:r.mobileInteraction,customHoverBehavior:ae,customClickBehavior:se}),...L&&L.length>0&&{annotations:L},...I&&{xExtent:I},...B&&{yExtent:B},...ce,...R};return oe||ne||(ue?wo(V,{componentName:"CandlestickChart",message:ue,width:G,height:z}):wo(q,{componentName:"CandlestickChart",width:G,height:z,children:wo(l,{ref:i,...me})}))});ko.displayName="CandlestickChart";import{forwardRef as So,useMemo as Co}from"react";import{jsx as Lo}from"react/jsx-runtime";var Ho=So(function(e,t){const{data:o,layout:n,layoutConfig:i,onLayoutError:a,xExtent:s,yExtent:c,showAxes:h=!1,margin:m,className:p,annotations:f,onObservation:y,onClick:g,selection:b,linkedHover:v,chartId:x,loading:A,loadingContent:w,emptyContent:S,colorBy:C,colorScheme:L,legend:H,frameProps:I={}}=e,{legend:B,...R}=I,F=Co(()=>k(B,H),[B,H]),{frameRef:_,resolved:N,safeData:P,setup:W,earlyReturn:D}=r({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:o,colorBy:C,colorScheme:L,legend:F,selection:b,linkedHover:v,onObservation:y,onClick:g,chartId:x,loading:A,loadingContent:w,emptyContent:S,margin:m,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),E=W.effectiveSelectionHook,M=Co(()=>E?.isActive?{isActive:!0,predicate:E.predicate}:null,[E?.isActive,E?.predicate]);if(D)return D;const{width:T,height:O,enableHover:G,showGrid:z,title:j,description:$,summary:Q,accessibleTable:X,xLabel:V,yLabel:Y}=N,J={chartType:"custom",...null!=o&&{data:P},customLayout:n,layoutConfig:i,onLayoutError:a,...M&&{layoutSelection:M},xExtent:s,yExtent:c,colorAccessor:C,colorScheme:L,size:[T,O],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:W.margin,showAxes:h,xLabel:V,yLabel:Y,enableHover:G,showGrid:z,...W.legendBehaviorProps,...d({title:j,description:$,summary:Q,accessibleTable:X,className:p,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...u({linkedHover:v,selection:b,onObservation:y,onClick:g,hoverHighlight:!1,mobileInteraction:W.mobileInteraction,customHoverBehavior:W.customHoverBehavior,customClickBehavior:W.customClickBehavior}),...f&&f.length>0&&{annotations:f},...W.crosshairProps,...R};return Lo(q,{componentName:"XYCustomChart",width:T,height:O,children:Lo(l,{ref:_,...J})})});Ho.displayName="XYCustomChart";export{Ae as Scatterplot,Ie as ConnectedScatterplot,Te as LineChart,Ve as AreaChart,nt as DifferenceChart,lt as StackedAreaChart,pt as Heatmap,xt as BubbleChart,Mt as ScatterplotMatrix,Jt as MinimapChart,eo as DEFAULT_QUADRANTS,ro as QuadrantChart,bo as MultiAxisLineChart,ko as CandlestickChart,Ho as XYCustomChart};
@@ -1 +0,0 @@
1
- import{makeRuleValueResolver as t,resolveStyleRules as e}from"./chunk-chunk-IP2UE74X.module.min.js";import{PhysicsPipelineStore as o,absorbRegion as n,bodyGroupSpec as i,capacitatedRegion as a,collidersFromPlotBounds as r,collidersFromXScaleBins as s,forceFieldRegion as l,groupCompletionRows as c,portalRegion as u,pressureFieldRegion as p,processStageLayout as d,routeSurfaceRegion as h}from"./chunk-chunk-UHSZEB74.module.min.js";import{buildResolveColor as g,resolveCustomLayoutPalette as m,xySceneNodeToSVG as f}from"./chunk-chunk-F25UA5HT.module.min.js";import{schemeCategory10 as y}from"./chunk-chunk-5RKXZQ2P.module.min.js";function x(t=[]){return t.map(t=>({id:t.id,label:t.label,count:t.count,...null!=t.secondary?{secondary:t.secondary}:{},...t.secondaryLabel?{secondaryLabel:t.secondaryLabel}:{},...null!=t.observed?{observed:t.observed}:{}}))}function w(t,e={}){const o=e.bodies??function(t){return t.world.bodies.map(t=>({id:t.id,x:t.x,y:t.y,prevX:t.prevX,prevY:t.prevY,vx:t.vx,vy:t.vy,angle:t.angle,mass:t.mass,shape:{...t.shape},sleeping:t.sleeping,datum:t.datum}))}(t),n=o.filter(t=>t.sleeping).length;return{bodyCount:o.length,sleepingCount:n,settled:"settled"===t.simulationState&&0===t.queue.length&&n===o.length,stepsRun:Math.max(0,Math.floor(e.stepsRun??0)),seed:t.world.options.seed,binCounts:x(e.projectionRows)}}var b={fill:"#4e79a7",stroke:"#172033",strokeWidth:1,opacity:.85};function M(t){const e=t.datum;if(e&&"object"==typeof e){const t=e.label??e.name??e.id;if(null!=t&&""!==t)return t+""}return t.id}function v(t,e){const o="function"==typeof e?e(t):e;return{...b,...o??{}}}function k(t,e={}){const o=function(t){return t.datum&&"object"==typeof t.datum?t.datum:null}(t),n={label:e.getBodyLabel?.(t)??M(t)},i={style:v(t,e.bodyStyle),datum:o,accessibleDatum:o,accessibility:n,_transitionKey:t.id};return"aabb"===t.shape.type?{type:"rect",x:t.x-t.shape.width/2,y:t.y-t.shape.height/2,w:t.shape.width,h:t.shape.height,...i}:{type:"point",x:t.x,y:t.y,r:t.shape.radius,pointId:t.id,...i}}function S(t,e={}){return t.map(t=>k(t,e))}function P(t,e={}){const o=t.settle(e.maxSteps),n=t.readBodies(),i=t.snapshot();return{snapshot:i,bodies:n,sceneNodes:S(n,e),evidence:w(i,{bodies:n,projectionRows:e.projectionRows,stepsRun:o}),stepsRun:o}}import*as A from"react-dom/server";import{jsx as I,jsxs as C}from"react/jsx-runtime";function z(t,e={}){const{width:o=640,height:n=360,title:i,description:a,background:r,className:s,idPrefix:l="physics",...c}=e,u=P(t,c),p=function(t){const e=t.replace(/[^A-Za-z0-9_-]/g,"_");return!e||/^\d/.test(e)?"physics-"+e:e}(l),d=i?p+"-title":void 0,h=a?p+"-desc":void 0,g=[d,h].filter(Boolean).join(" ")||void 0;return{svg:A.renderToStaticMarkup(C("svg",{xmlns:"http://www.w3.org/2000/svg",className:s??"stream-physics-frame",width:o,height:n,viewBox:`0 0 ${o} ${n}`,role:"img","aria-labelledby":g,children:[i&&I("title",{id:d,children:i}),a&&I("desc",{id:h,children:a}),r&&"transparent"!==r?I("rect",{x:0,y:0,width:o,height:n,fill:r}):null,I("g",{id:p+"-data-area",children:u.sceneNodes.map((t,e)=>f(t,e,p))})]})),scene:u,evidence:u.evidence}}import{scaleLinear as R}from"d3-scale";function T(t){const[e,o]=t;return{width:e,height:o,plot:{x:32,y:24,width:Math.max(80,e-64),height:Math.max(80,o-58)}}}function L(t){const e=(t??"")+"";if(!e)return"#4e79a7";const o=["#4e79a7","#59a14f","#e15759","#f28e2b","#76b7b2","#edc948","#b07aa1","#ff9da7"];let n=0;for(let t=0;e.length>t;t+=1)n=31*n+e.charCodeAt(t)>>>0;return o[n%o.length]}function E(o,n="#4e79a7",i){const a=i?.styleRules,r=!!a&&a.length>0,s=r?t(i?.valueAccessor):void 0;return t=>{const i=t.datum,l=i&&o?"function"==typeof o?o(i,0):i[o]:void 0,c={fill:null==l?n:L(l),stroke:"#111827",strokeWidth:1,opacity:.9};return r&&i&&Object.assign(c,e(i,a,{value:s?s(i):void 0,category:null==l?void 0:l+""})),c}}function j(t,e,o,n){return{fixedDt:1/120,maxSubsteps:8,colliders:e,observation:{chartType:o},kernel:{seed:t,gravity:{x:0,y:760},cellSize:36,collisionIterations:6,velocityDamping:.995,restitution:.08,friction:.4,sleepSpeed:8,sleepAfter:.6,...n}}}function Y(t,e,o){return"function"==typeof o?o(t,e):t[o]}function $(t){if(t instanceof Date){const e=t.getTime();return Number.isFinite(e)?e:null}const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:null}function N(t,e,o){return Math.max(e,Math.min(o,t))}function F(t,e){const o=$(t);return null!=o&&o>0?o:e}function B(t){return((t??"unknown")+"").trim().replace(/[^A-Za-z0-9_-]+/g,"_")||"unknown"}function D(t){let e=t>>>0;return()=>{e+=1831565813;let t=e;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}import{scaleLinear as X}from"d3-scale";function W(t){const e=Math.max(2,Math.round(t.bins)),o=Math.max(1,Math.round(t.pegRows??e-1)),n=Math.max(1,Math.round(t.count??Math.max(64,4*e))),i=N(Number.isFinite(t.branchProbability)?t.branchProbability??.5:.5,0,1),a=D(t.seed??1),r=t.idPrefix??"mechanical";return Array.from({length:n},(t,e)=>{let n=0;for(let t=0;o>t;t+=1)a()<i&&(n+=1);const s=o/2;return{id:`${r}-${e}`,value:n,mechanical:!0,pegRows:o,branchProbability:i,pathRights:n,side:s>n?"left":n>s?"right":"center"}})}function U(t){const{data:e,valueAccessor:o,bins:n,ballRadius:i,seed:a,size:l,valueExtent:c}=t,u=T(l),p=e.map((t,e)=>$(Y(t,e,o))).filter(t=>null!=t),d=function(t){if(!t)return;const e=$(t[0]),o=$(t[1]);return null!=e&&null!=o?e>o?[o,e]:[e,o]:void 0}(c),h=d?.[0]??(p.length?Math.min(...p):0),g=d?.[1]??(p.length?Math.max(...p):1),m=g===h?1:g-h,f=X().domain([0,n]).range([u.plot.x,u.plot.x+u.plot.width]),y=Array.from({length:n},()=>0),x=[];e.forEach((t,e)=>{const a=$(Y(t,e,o));if(null==a)return;const r=Math.max(0,Math.min(n-1,Math.floor((a-h)/m*n)));y[r]+=1,x.push({id:(t.id??"galton-"+e)+"",x:f(r+.5),y:u.plot.y+i+2,vx:8*(e%5-2),vy:0,mass:1,shape:{type:"circle",radius:i},datum:{...t,value:a,bin:r}})});const w=u.plot.y+u.plot.height;return{config:j(a,[...r({x:u.plot.x,y:u.plot.y,width:u.plot.width,height:u.plot.height},{idPrefix:"galton",wallThickness:20,floorThickness:20}),...s({idPrefix:"galton-bin",count:n,domainStart:0,domainStep:1,xScale:f,yTop:u.plot.y-400,yBottom:w,wallThickness:6})],"GaltonBoardChart"),initialSpawns:x,initialSpawnPacing:{pacing:{ratePerSec:55}},projectionRows:y.map((t,e)=>({label:e+1+"",value:t})),metadata:{kind:"galton-board",bins:n,plot:u.plot,valueExtent:[h,g]}}}import{scaleLinear as _}from"d3-scale";function V(t){const{count:e,idPrefix:o,wallThickness:n,xScale:i,yBottom:a,yTop:r,yTopForIndex:s}=t;return Array.from({length:e+1},(t,e)=>{const l=Math.min(a-1,s?.(e)??r),c=Math.max(1,a-l);return{id:`${o}-wall-${e}`,shape:{type:"aabb",x:i(e),y:l+c/2,width:n,height:c}}})}function O(t){const{data:e,timeAccessor:o,arrivalAccessor:n,windows:i,watermark:a,ballRadius:s,seed:l,size:c,timeExtent:u,timeScale:p=1}=t,d=T(c),h=e.map((t,e)=>$(Y(t,e,o))).filter(t=>null!=t),g=$(u?.[0]),m=$(u?.[1]),f=h.length?Math.min(...h):0,y=h.length?Math.max(...h):f+i.size,x=Math.min(g??f,f),w=Math.max(m??y,y),b=Math.floor(x/i.size)*i.size,M=Math.max(1,Math.ceil((w-b+i.size)/i.size)),v=h.length?Math.max(...h):0,k="function"==typeof a?a(v):$(a?.value)??v-(a?.delay??i.size),S=Math.max(0,Math.min(M,Array.from({length:M},(t,e)=>e).reduce((t,e)=>b+(e+1)*i.size>k?t:t+1,0))),P=function(t,e){const o=Math.max(5*e,Math.min(92,.13*t.plot.width));return{gutter:{x:t.plot.x,y:t.plot.y,width:o,height:t.plot.height},windowPlot:{x:t.plot.x+o,y:t.plot.y,width:Math.max(40,t.plot.width-o),height:t.plot.height},wallTop:t.plot.y+.48*t.plot.height}}(d,s),A=b+M*i.size,I=_().domain([b,A]).range([P.windowPlot.x,P.windowPlot.x+P.windowPlot.width]),C=Array.from({length:M},()=>({value:0,secondary:0})),z=[];e.forEach((t,e)=>{const a=$(Y(t,e,o));if(null==a)return;const r=$(Y(t,e,n))??a,l=Math.max(0,Math.min(M-1,Math.floor((a-b)/i.size))),c=k>=b+(l+1)*i.size;C[l].value+=c?0:1,C[l].secondary+=c?1:0,z.push({id:(t.id??"event-"+e)+"",x:Math.max(P.windowPlot.x+s,Math.min(P.windowPlot.x+P.windowPlot.width-s,I(a))),y:d.plot.y+s+2,vx:8*(e%3-1),vy:0,mass:1,friction:.02,spawnAt:r,shape:{type:"circle",radius:s},datum:{...t,eventTime:a,arrivalTime:r,windowIndex:l,late:c}})});const R=d.plot.y+d.plot.height,L=function(t,e){const o=Math.max(0,Math.min(t.windowCount,t.closedWindowCount));if(!o)return[];const n=t.windowStart,i=t.windowStart+t.windowCount*t.windowSize,a=_().domain([n,i]).range([t.windowPlot.x,t.windowPlot.x+t.windowPlot.width]),r=a(t.windowStart+o*t.windowSize),s=t.windowPlot.x,l=e+Math.max(18,Math.min(.3*t.windowPlot.height,r-s)),c=t=>r===s?e:l+(t-s)/(r-s)*(e-l),u=[];for(let e=0;o>e;e+=1){const o=t.windowStart+e*t.windowSize,n=o+t.windowSize,i=a(o),r=a(n);u.push({id:"eventdrop-lid-"+e,windowIndex:e,x1:i,y1:c(i),x2:r,y2:c(r)})}return u}({closedWindowCount:S,gutter:P.gutter,plot:d.plot,windowCount:M,windowPlot:P.windowPlot,windowSize:i.size,windowStart:b},d.plot.y+.28*d.plot.height);return{config:j(l,[...r({x:d.plot.x,y:d.plot.y,width:d.plot.width,height:d.plot.height},{idPrefix:"eventdrop",wallThickness:20,floorThickness:20}),...V({idPrefix:"eventdrop-window",count:M,xScale:t=>I(b+t*i.size),yTop:P.wallTop,yTopForIndex:t=>{const e=(t=>{if(0>t||t>S)return null;const e=0===t?L[0]?.y1:L[t-1]?.y2??L[t]?.y1;return"number"==typeof e&&Number.isFinite(e)?e:null})(t);return null==e?P.wallTop:e+1.25*s},yBottom:R,wallThickness:6}),...L.map(t=>({id:t.id,shape:{type:"segment",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,thickness:Math.max(4,.42*s)},friction:.02,restitution:.01}))],"EventDropChart",{friction:.08}),initialSpawns:z,initialSpawnPacing:{pacing:"arrival",timeAccessor:t=>t.datum?.arrivalTime,timeScale:p},projectionRows:C.map((t,e)=>({label:`${b+e*i.size}-${b+(e+1)*i.size}`,value:t.value,secondary:t.secondary})),metadata:{kind:"event-drop",closedWindowCount:S,gutter:P.gutter,lidSegments:L,lateCount:C.reduce((t,e)=>t+e.secondary,0),plot:d.plot,windowPlot:P.windowPlot,watermarkValue:k,windowCount:M,windowSize:i.size,windowStart:b}}}function Z(t={}){const e=(t.categories?.length?t.categories:["Intake","Review","Build","Ship"]).map(t=>(t+"").trim()).filter(Boolean),o=e.length?e:["Intake"],n=Math.max(o.length,Math.round(t.count??Math.max(48,12*o.length))),i=F(t.unitValue,1),a=D(t.seed??1),r=t.idPrefix??"mechanical-pile",s=o.map(()=>.65+.9*a()),l=s.reduce((t,e)=>t+e,0)||1,c=n-o.length,u=s.map(t=>t/l*c),p=u.map(t=>1+Math.floor(t));let d=n-p.reduce((t,e)=>t+e,0);const h=u.map((t,e)=>({index:e,fraction:t-Math.floor(t)})).sort((t,e)=>e.fraction-t.fraction);for(let t=0;d>0;t=(t+1)%h.length)p[h[t].index]+=1,d-=1;return o.map((t,e)=>({id:`${r}-${e}`,category:t,value:p[e]*i,mechanical:!0,unitCount:p[e],unitValue:i,share:p[e]/n}))}function H(t){const{data:e,categoryAccessor:o,valueAccessor:n,unitValue:i,ballRadius:a,seed:s,size:l}=t,c=F(i,1),u=T(l),p=[],d=new Map,h=new Map,g=[];function m(t){let e=d.get(t);return null==e&&(e=p.length,p.push(t),d.set(t,e)),e}e.forEach((t,e)=>{m((Y(t,e,o)??"unknown")+"")});const f=Math.max(1,p.length),y=function(t,e,o){const n=t.width/Math.max(1,e),i=Math.max(2,2*o),a=Math.min(.7*n,Math.max(3.2*i,i+8)),r=Math.max(1,Math.floor(a/i));return{laneWidth:n,tubeWidth:a,ballDiameter:i,perRow:r,centerX:e=>t.x+(e+.5)*n,pileHeight:t=>Math.ceil(Math.max(0,t)/r)*i}}(u.plot,f,a),x=Math.max(0,y.tubeWidth/2-a-1),w=p.map(()=>[]);e.forEach((t,e)=>{const i=(Y(t,e,o)??"unknown")+"",r=m(i),s=n?$(Y(t,e,n)):1,l=Math.max(0,Math.round((s??0)/c)),p=y.centerX(r);for(let o=0;l>o;o+=1){const n=h.get(i)??0,s=y.perRow>1?((y.perRow>1?n%y.perRow:0)/(y.perRow-1)*2-1)*x:0;h.set(i,n+1),w[r].push({id:`${(t.id??"pile-"+e)+""}-${o}`,x:p+s,y:u.plot.y+a+2,vx:(o%3-1)*a/2,vy:0,mass:1,shape:{type:"circle",radius:a},datum:{...t,category:i,unitIndex:o}})}});const b=w.reduce((t,e)=>Math.max(t,e.length),0);for(let t=0;b>t;t+=1)for(const e of w)e.length>t&&g.push(e[t]);const M=u.plot.y+u.plot.height,v=[...r({x:u.plot.x,y:u.plot.y,width:u.plot.width,height:u.plot.height},{idPrefix:"pile",wallThickness:20,floorThickness:20})],k=u.plot.y-400;for(let t=0;f>t;t+=1){const e=y.centerX(t);for(const o of[-1,1])v.push({id:`pile-tube-${t}-${0>o?"l":"r"}`,shape:{type:"aabb",x:e+o*y.tubeWidth/2,y:(k+M)/2,width:6,height:M-k}})}return{config:j(s,v,"PhysicsPileChart"),initialSpawns:g,initialSpawnPacing:{pacing:{ratePerSec:20}},projectionRows:p.map(t=>({label:t,value:h.get(t)??0}))}}import{scaleLinear as q}from"d3-scale";function K(t){const{data:e,xAccessor:o,groupAccessor:n,radiusAccessor:i,pointRadius:a,seed:s,size:l,xExtent:c,collisionIterations:u,settle:p}=t,d=T(l),h=D(s),g=[],m=[],f=new Map;e.forEach((t,e)=>{const r=$(Y(t,e,o));if(null==r)return;const s=n?(Y(t,e,n)??"All")+"":"All",l=i?$(Y(t,e,i)):null,c=N(null!=l&&l>0?l:a,2,18);!function(t){let e=f.get(t);null==e&&(e=m.length,m.push(t),f.set(t,e))}(s),g.push({datum:t,index:e,value:r,group:s,radius:c})});const y=g.map(t=>t.value),x=c?$(c[0]):null,w=c?$(c[1]):null,b=y.length?Math.min(...y):0,M=y.length?Math.max(...y):1;let v=x??b,k=w??M;if(v===k&&(v-=.5,k+=.5),v>k){const t=k;k=v,v=t}const S=Math.max(a,...g.map(t=>t.radius)),P=d.plot.x+S+8,A=d.plot.x+d.plot.width-S-8,I=q().domain([v,k]).range([P,A]),C=Math.max(1,m.length),z=d.plot.y+Math.max(28,3*S),R=Math.max(0,d.plot.y+d.plot.height-Math.max(28,3*S)-z),L=t=>{const e=f.get(t)??0;return 1===C?d.plot.y+.54*d.plot.height:z+e/(C-1)*R},E=new Map,F=g.map((t,e)=>{E.set(t.group,(E.get(t.group)??0)+1);const o=I(t.value),n=L(t.group),i=(h()-.5)*t.radius*1.6,a=(h()-.5)*t.radius*1.6;return{id:(t.datum.id??"collision-swarm-"+e)+"",x:p?o+i:N(o+(e%9-4)*t.radius*2.5,P,A),y:p?n+a:d.plot.y-18-e%12*t.radius,vx:p?0:22*(h()-.5),vy:p?0:24+18*h(),mass:1,shape:{type:"circle",radius:t.radius},datum:{...t.datum,xValue:t.value,group:t.group,radius:t.radius,targetX:o,targetY:n},springs:[{target:{type:"point",x:o,y:n},restLength:0,stiffness:34,damping:5.5}]}});return{config:j(s,r({x:d.plot.x,y:d.plot.y,width:d.plot.width,height:d.plot.height},{idPrefix:"collision-swarm",includeCeiling:!1,wallThickness:20,floorThickness:20}),"CollisionSwarmChart",{gravity:{x:0,y:0},cellSize:Math.max(24,4*S),collisionIterations:Math.max(1,Math.round(u??6)),velocityDamping:.992,restitution:.02,friction:.18,sleepSpeed:3,sleepAfter:.5}),initialSpawns:F,projectionRows:m.map(t=>({label:t,value:E.get(t)??0})),metadata:{kind:"collision-swarm",xExtent:[v,k],xRange:[P,A],groups:m.map(t=>({label:t,y:L(t),count:E.get(t)??0})),plot:d.plot}}}function G(t){if(Array.isArray(t)&&t.length>=2){const e=$(t[0]),o=$(t[1]);return null!=e&&null!=o?{x:e,y:o}:null}if(t&&"object"==typeof t){const e=t,o=$(e.x),n=$(e.y);return null!=o&&null!=n?{x:o,y:n}:null}return null}function Q(t){return Array.isArray(t)?t.map(G).filter(t=>null!=t):[]}function J(t,e,o){return"normalized"===o?{x:e.plot.x+t.x*e.plot.width,y:e.plot.y+t.y*e.plot.height}:{x:N(t.x,e.plot.x,e.plot.x+e.plot.width),y:N(t.y,e.plot.y,e.plot.y+e.plot.height)}}function tt(t){let e=0;for(let o=1;t.length>o;o+=1)e+=Math.hypot(t[o].x-t[o-1].x,t[o].y-t[o-1].y);return e}function et(t,e){if(0===t.length)return{x:0,y:0};if(1===t.length)return{...t[0]};const o=N(e,0,1)*tt(t);let n=0;for(let e=1;t.length>e;e+=1){const i=t[e-1],a=t[e],r=Math.hypot(a.x-i.x,a.y-i.y);if(r>0){if(n+r>=o){const t=(o-n)/r;return{x:i.x+(a.x-i.x)*t,y:i.y+(a.y-i.y)*t}}n+=r}}return{...t[t.length-1]}}function ot(t,e){const o=et(t,Math.max(0,e-.02)),n=et(t,Math.min(1,e+.02)),i=n.x-o.x,a=n.y-o.y,r=Math.hypot(i,a)||1;return{x:i/r,y:a/r}}function nt(t){const{coordinateMode:e,flowSpeed:o,links:n,maxParticles:i,nodeIdAccessor:a,nodeXAccessor:s,nodeYAccessor:l,nodes:c,particleRadius:u,particleRate:p,pathAccessor:d,pathConstraint:h="path",reducedMotion:g,seed:m,size:f,sourceAccessor:y,targetAccessor:x,throughputAccessor:w}=t,b=T(f),M=D(m),v=new Map,k=new Map,S=[];function P(t){if(t&&"object"==typeof t){const e=t;if("function"==typeof a){const t=a(e,0);if(null!=t)return t+""}if("string"==typeof a&&null!=e[a])return e[a]+"";if(null!=e.id)return e.id+""}return(t??"unknown")+""}c.forEach((t,e)=>{const o=(Y(t,e,a)??t.id??e)+"",n=$(Y(t,e,s)),i=$(Y(t,e,l));if(null!=n&&null!=i){const t={x:n,y:i};v.set(o,t),S.push(t)}k.set(o,(t.label??t.name??o)+"")});const A=[];n.forEach((t,e)=>{const o=P(Y(t,e,y)),n=P(Y(t,e,x)),i=Math.max(0,$(Y(t,e,w))??0),a=Q(d?Y(t,e,d):void 0),r=a.length?a:Q(t.path??t.points??t.route);r.forEach(t=>S.push(t)),A.push({id:(t.id??`physical-flow-${o}-${n}-${e}`)+"",link:t,index:e,source:o,target:n,throughput:i,rawPath:r})});const I=(z=S,"normalized"===(C=e)||"pixels"===C?C:z.length>0&&z.every(t=>!(0>t.x||t.x>1||0>t.y||t.y>1))?"normalized":"pixels");var C,z;const R=new Map;for(const[t,e]of v)R.set(t,J(e,b,I));const L=[];for(const t of A){let e=t.rawPath.map(t=>J(t,b,I));if(2>e.length){const o=R.get(t.source),n=R.get(t.target);o&&n&&(e=[o,n])}else R.has(t.source)||R.set(t.source,e[0]),R.has(t.target)||R.set(t.target,e[e.length-1]);e.length>=2&&t.throughput>0&&(k.has(t.source)||k.set(t.source,t.source),k.has(t.target)||k.set(t.target,t.target),L.push({...t,path:e,packetCount:0}))}const E=F(p,.12),X=Math.max(1,Math.round(i)),W=L.map(t=>Math.max(1,Math.round(t.throughput*E))),U=W.reduce((t,e)=>t+e,0),_=U>X?X/U:1;L.forEach((t,e)=>{t.packetCount=Math.max(1,Math.floor(W[e]*_))});let V=L.reduce((t,e)=>t+e.packetCount,0);for(;V>X;){const t=L.reduce((t,e,o)=>e.packetCount>1&&(-1===t||e.packetCount>L[t].packetCount)?o:t,-1);if(-1===t)break;L[t].packetCount-=1,V-=1}const O=new Map,Z=new Map,H=[],q=F(o,90),K=F(u,4);L.forEach((t,e)=>{O.set(t.target,(O.get(t.target)??0)+t.throughput),Z.set(t.source,(Z.get(t.source)??0)+t.throughput);const o=tt(t.path);for(let n=0;t.packetCount>n;n+=1){const i=(n+.5)/t.packetCount,a=g?i:N(.12+.84*i+.04*(M()-.5),.04,.98),r=g?a:Math.max(0,a-(.18+.12*M())),s=et(t.path,r),l=et(t.path,a),c=ot(t.path,r),u={x:-c.y,y:c.x},p=(M()-.5)*K*1.5;H.push({id:`${t.id}-packet-${n}`,x:s.x+u.x*p,y:s.y+u.y*p,vx:g?0:c.x*q+10*(M()-.5),vy:g?0:c.y*q+10*(M()-.5),mass:.8,spawnAt:g?0:.04*e+n/32,shape:{type:"circle",radius:K},datum:{...t.link,source:t.source,target:t.target,throughput:t.throughput,packetIndex:n,packetCount:t.packetCount,routeProgress:a,flowPath:t.path,flowPathLength:o,flowRouteId:t.id,flowSpeed:q,sourceLabel:k.get(t.source)??t.source,targetLabel:k.get(t.target)??t.target},springs:"none"!==h&&g?[{target:{type:"point",x:l.x,y:l.y},restLength:.7*K,stiffness:26,damping:4.25}]:void 0})}});const G=Math.max(18,5*K),nt=Array.from(R,([t,e])=>({nodeId:t,label:k.get(t)??t,sensorId:"physical-flow-node-"+B(t),point:e})),it=nt.map(t=>({id:t.sensorId,sensor:!0,shape:{type:"aabb",x:t.point.x,y:t.point.y,width:G,height:G}})),at=Object.fromEntries(nt.map(t=>[t.sensorId,{binId:t.label,enterType:"physics-proximity-enter",exitType:"physics-proximity-exit"}])),rt=j(m,[...r({x:b.plot.x,y:b.plot.y,width:b.plot.width,height:b.plot.height},{idPrefix:"physical-flow",wallThickness:18,floorThickness:18}),...it],"PhysicalFlowChart",{gravity:{x:0,y:0},cellSize:Math.max(24,7*K),collisionIterations:3,velocityDamping:.994,restitution:.01,friction:.16,sleepSpeed:2.5,sleepAfter:.7});rt.bodyLimit=X,rt.eviction="oldest",rt.observation={...rt.observation,sensors:at};const st=Array.from(R,([t,e])=>({id:t,label:k.get(t)??t,x:e.x,y:e.y,sensorId:"physical-flow-node-"+B(t),incoming:O.get(t)??0,outgoing:Z.get(t)??0})),lt=L.map(t=>({id:t.id,source:t.source,target:t.target,sourceLabel:k.get(t.source)??t.source,targetLabel:k.get(t.target)??t.target,throughput:t.throughput,packetCount:t.packetCount,path:t.path}));return{config:rt,initialSpawns:H,projectionRows:st.filter(t=>t.incoming>0||t.outgoing>0).map(t=>({label:t.label,value:t.incoming,secondary:t.outgoing})),metadata:{kind:"physical-flow",coordinateMode:I,particleCount:H.length,totalThroughput:L.reduce((t,e)=>t+e.throughput,0),plot:b.plot,nodes:st,links:lt}}}function it(t,e=12){return"number"==typeof t?{x:t,y:0}:t&&"object"==typeof t?{x:Number.isFinite(t.x)?Number(t.x):e,y:Number.isFinite(t.y)?Number(t.y):0}:{x:e,y:0}}function at(t){const e=t.stages;if(!e.length)throw Error("buildProcessFlowPhysics requires at least one stage");const o=t.size,r=T(o),s=N(t.ballRadius??6,2,18),g=t.seed??1,m=D(g),f=t.idAccessor,y=t.stageAccessor??"stage",x=t.groupBy,w=t.groupLabelAccessor,b=t.workAccessor,M=t.radiusAccessor,v=t.groupCompletion??(x?"allAbsorbed":"none"),k=t.springStiffness??.28,S=t.springDamping??.72,P=!0===t.settle,A=e.map(t=>({id:t.id,label:t.label??t.id,description:t.description,share:t.share})),I=d({width:o[0],height:o[1],shape:"lane",padX:Math.max(28,r.plot.x),padY:Math.max(36,r.plot.y+8),stages:A,idPrefix:"process-flow",includeMembraneRegions:!1,friction:.48,restitution:.14}),C=new Map(I.stages.map((t,e)=>[t.id,e])),z=new Map(I.stages.map(t=>[t.id,t])),R=I.stages[0].id,L=I.stages[0],E=new Set(e.filter(t=>t.absorb).map(t=>t.id)),j=e.map(t=>{const e=z.get(t.id)??L;return function(t,e){const o={id:"process-stage-"+t.id,label:t.label??t.id,description:t.description,x:e.x,y:e.y,width:Math.max(12,.92*e.width),height:Math.max(40,.88*e.height),semanticItem:!1,attributes:{stageId:t.id}};if(t.absorb)return n({...o,kind:t.kind??"sink",force:it(t.force,28),damping:t.damping??.04,charge:"absorbed",attributes:{...o.attributes,primitive:"absorb"}});if(t.portal){const e=t.portal.force??t.force??{x:-40,y:0};return u({...o,kind:t.kind??"force-field",force:it(e,-40),damping:t.damping??.1,targetStage:t.portal.targetStageId,attributes:{...o.attributes,primitive:"portal",targetStage:t.portal.targetStageId}})}if(t.capacity){const e=Math.max(.1,t.capacity.unitsPerSecond);return a({...o,kind:t.kind??"force-field",capacity:e,unitsPerSecond:e,force:it(t.force,10+.8*e),damping:t.damping??Math.max(.04,.32-.01*e),attributes:{...o.attributes,unitAccessor:t.capacity.unitAccessor,reviewerCapacity:e}})}if(t.pressure){const e="object"==typeof t.pressure&&t.pressure?t.pressure:{};return p({...o,kind:t.kind??"membrane",pressure:e.pressure,occupancy:e.occupancy,baseDamping:e.baseDamping??t.damping??.1,dampingPerUnit:e.dampingPerUnit??.1,energyPerUnit:e.energyPerUnit??0,force:it(t.force,8),attributes:{...o.attributes,primitive:"pressureField"}})}return null!=t.force||null!=t.damping?h({...o,kind:t.kind??"force-field",force:it(t.force,14),damping:t.damping??.02,attributes:{...o.attributes,primitive:"routeSurface"}}):l({...o,kind:t.kind??"force-field",force:{x:10,y:0},damping:.02,attributes:{...o.attributes,primitive:"forceField"}})}(t,{x:e.x,y:I.midY,width:e.width,height:I.bottomY-I.topY})});j.unshift(h({id:"process-flow-route",label:"process route",description:"Baseline conveyor along the process lane.",x:(I.left+I.right)/2,y:I.midY,width:I.right-I.left,height:I.bottomY-I.topY-12,force:8,damping:.012,semanticItem:!1}));const F=new Map;for(const t of I.stages)F.set(t.id,0);const B=[];t.data.forEach((t,e)=>{const o=(f?Y(t,e,f)??t.id??"process-flow-"+e:t.id??"process-flow-"+e)+"",n=(Y(t,e,y)??R)+"",i=C.has(n)?n:R;F.set(i,(F.get(i)??0)+1);const a=x?(Y(t,e,x)??"")+"":void 0,r=a&&w?(Y(t,e,w)??a)+"":a,l=b?$(Y(t,e,b))??1:1,c=M?$(Y(t,e,M)):null,u=N(null!=c&&c>0?c:s,2,18);B.push({datum:t,id:o,stageId:i,groupId:a||void 0,groupLabel:r||void 0,work:l,radius:u,index:e})});const X=new Map,W=new Map;for(const t of B){if(!t.groupId)continue;const e=X.get(t.groupId)??[];e.push(t.id),X.set(t.groupId,e),t.groupLabel&&W.set(t.groupId,t.groupLabel)}const U=N(t.groupAnchorAlong??.55,.15,.9),_=I.left+(I.right-I.left)*U,V=Array.from(X.keys()),O=V.map((t,o)=>{const n=X.get(t)??[],a=V.length>1?I.topY+28+o/Math.max(1,V.length-1)*(I.bottomY-I.topY-56):I.midY;return i({id:t,label:W.get(t)??t,bodyIds:n,anchor:{x:_,y:a},x:_,y:a,completion:"allAbsorbed"===v?{mode:"allMembersAbsorbed",targetZone:e.find(t=>t.absorb)?.id??"merged"}:void 0,tether:{stiffness:.06,visible:!0,restLength:18}})}),Z=B.filter(t=>E.has(t.stageId)).map(t=>t.id),H=c(O,Z),q=new Map(O.map(t=>[t.id,t])),K=B.map((t,e)=>{const o=z.get(t.stageId)??L,n=o.x+(m()-.5)*Math.min(24,.2*o.width),i=I.boundaryY(n,"top")+t.radius+10,a=I.boundaryY(n,"bottom")-t.radius-10,r=a>i?i+m()*Math.max(1,a-i):I.midY,s=P?n:I.left+18+e%7*4,l=P?r:I.midY+(m()-.5)*(I.bottomY-I.topY)*.35,c=[{target:{type:"point",x:n,y:r},restLength:.45*t.radius,stiffness:k,damping:S}];if(t.groupId){const e=q.get(t.groupId);e?.anchor&&!E.has(t.stageId)&&c.push({target:{type:"point",x:e.anchor.x,y:e.anchor.y},restLength:e.tether?.restLength??22,stiffness:e.tether?.stiffness??.05,damping:.8})}return{id:t.id,x:s,y:l,vx:P?0:40+40*m(),vy:P?0:20*(m()-.5),mass:1,shape:{type:"circle",radius:t.radius},spawnAt:P?0:.03*e,springs:c,datum:{...t.datum,id:t.id,stage:t.stageId,groupId:t.groupId,groupLabel:t.groupLabel,work:t.work,__processFlow:!0}}}),G={kernel:{seed:g,gravity:{x:t.gravityX??22,y:t.gravityY??0},restitution:.14,friction:.48,velocityDamping:.988,maxVelocity:420,sleepSpeed:8,sleepAfter:.9,collisionIterations:4},colliders:I.colliders,fixedDt:1/60,maxSubsteps:8},Q=I.stages.map(t=>({label:t.label??t.id,value:F.get(t.id)??0})),J=e.map(t=>{const e=z.get(t.id)??L;return{id:t.id,label:t.label??t.id,x:e.x,width:e.width,count:F.get(t.id)??0,capacity:t.capacity?.unitsPerSecond,absorb:!0===t.absorb,portalTarget:t.portal?.targetStageId}});return{config:G,initialSpawns:K,initialSpawnPacing:P?void 0:{pacing:"arrival",timeAccessor:"spawnAt",timeScale:1},projectionRows:Q,metadata:{kind:"process-flow",plot:r.plot,volume:I,stages:J,groups:O,groupCompletion:H,regionEffects:j}}}function rt(t,e){const o=e.config??{},n=(e.sensors??[]).map(t=>({...t,sensor:!0})),i=[...e.colliders??[],...n],a=[...t.colliders??[],...o.colliders??[],...i];return{...t,...o,observation:{...t.observation,...o.observation},...a.length>0&&{colliders:a}}}function st(t){const e=function(t,e,o){const n=t?.observation;return{...t,observation:{...n,chartId:e??n?.chartId??"physics-custom",chartType:n?.chartType??"PhysicsCustomChart",onObservation:o??n?.onObservation}}}(t.config,t.chartId,t.onObservation),n=m(t.colorScheme,t.themeCategorical,y),i=T(t.size),a={data:t.data,scales:{x:R().domain(t.xExtent??[0,1]).range([i.plot.x,i.plot.x+i.plot.width]),y:R().domain(t.yExtent??[0,1]).range([i.plot.y+i.plot.height,i.plot.y])},dimensions:i,theme:{semantic:t.semantic,categorical:[...n]},resolveColor:g(n,t.colorScheme),config:t.layoutConfig??{},world:new o(e)},r=t.skipLayout?{}:t.layout(a)??{},s=function(t,e){if(!e?.length)return t;const o=new Map;for(const t of e){const{bodyId:e,...n}=t,i=o.get(e)??[];i.push(n),o.set(e,i)}return t.map(t=>{const e=o.get(t.id);return e?.length?{...t,springs:[...t.springs??[],...e]}:t})}([...r.initialSpawns??r.bodies??[]],r.constraints);return{config:rt(e,r),context:a,initialSpawnPacing:r.initialSpawnPacing,initialSpawns:s,result:r}}export{E as styleFromColorAccessor,W as generateGaltonMechanicalSamples,U as buildGaltonBoardPhysics,O as buildEventDropPhysics,Z as generatePhysicsPileMechanicalSamples,H as buildPhysicsPile,K as buildCollisionSwarmPhysics,nt as buildPhysicalFlowPhysics,at as buildProcessFlowPhysics,st as resolveCustomLayout,w as buildPhysicsSettledEvidence,k as physicsBodyToXYSceneNode,S as physicsBodiesToXYSceneNodes,P as buildPhysicsSettledScene,z as renderPhysicsSettledSVG};
@@ -1,2 +0,0 @@
1
- "use client";
2
- import{useChartSetup as t,useCustomChartScaffold as e}from"./chunk-chunk-I6C3KR5H.module.min.js";import{lineCanvasRenderer as n,resolveNodeColor as i}from"./chunk-chunk-XQYVEKEJ.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-M7VYYHCE.module.min.js";import{needsDataCanvasPaint as m,needsInteractionCanvasPaint as g,paintCanvasBackground as y}from"./chunk-chunk-OQTLSTGI.module.min.js";import{StalenessBadge as v,attachUpdateResultStore as b,buildBaseMetadataProps as w,buildCustomBehaviorProps as P,composeOverlays as S,computeDecayOpacity as x,createCustomLayoutFailureDiagnostic as R,findHitPointInQuadtree as L,formatVal as A,getHitRadius as k,glyphCanvasRenderer as C,paintSceneWithBackend as j,renderPathPulse as D,renderSceneWithBackend as T,useConfigSync as M,useLayoutSelectionSync as B,useStableShallow as _,useStalenessCheck as I,warnCustomLayoutDiagnostics as E}from"./chunk-chunk-A63CTACR.module.min.js";import{wrapWithCustomLayoutSelection as N}from"./chunk-chunk-5UKL5W76.module.min.js";import{buildResolveColor as O,resolveCustomLayoutPalette as H}from"./chunk-chunk-SANERMIZ.module.min.js";import{AccessibleDataTable as W,AriaLiveTooltip as z,CanvasFrameBackground as F,FlippingTooltip as G,FocusRing as q,STREAMING_PALETTE as Z,SceneRevisionDiagnosticsObserver as X,ScreenReaderSummary as Y,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 St}from"./chunk-chunk-6HSGDMTA.module.min.js";import{getMax as xt}from"./chunk-chunk-JJ2OOIET.module.min.js";import{resolveThemeSemanticColors as Rt}from"./chunk-chunk-WCX6U47H.module.min.js";import{glyphHitGeometry as Lt}from"./chunk-chunk-KTWEBFMX.module.min.js";import{SafeRender as At,useHydration as kt,useWasHydratingFromSSR as Ct}from"./chunk-chunk-ZCNBUZPL.module.min.js";import{useRef as jt,useState as Dt,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 Ht,geoEqualEarth as Wt,geoAlbersUsa as zt,geoOrthographic as Ft,geoNaturalEarth1 as Gt,geoEquirectangular as qt}from"d3-geo";var Zt={mercator:Ht,equalEarth:Wt,albersUsa:zt,orthographic:Ft,naturalEarth:Gt,equirectangular:qt};function Xt(t,e){return t?"function"==typeof t?t:e=>e[t]:t=>t[e]}function Yt(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=Xt(n.xAccessor,"lon"),r=Xt(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=Yt(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],[i,s],[r,s],[r,o],[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)}hasProjection(){return null!=this.projection}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=H(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=R("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=Xt(t.xAccessor,"lon"),c=Xt(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=Yt(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=xt(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=x(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=L(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);k(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=Lt(o.glyph,o.size),r=o.x+t.centerDx-e,s=o.y+t.centerDy-n,a=Math.sqrt(r*r+s*s);k(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 Se,jsxs as xe}from"react/jsx-runtime";function Re(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:S,geoProjection:x}=t,R=bt({onAnnotationActivate:y,onObservation:v,chartId:b,chartType:w}),L=Pe([g?.length??0,new Map]),A=g?.length??0;L.current[0]!==A&&(L.current=[A,new Map]);const k=we(()=>{if(!g||0===g.length)return null;const t=x?g.map(t=>{if(!Array.isArray(t.coordinates)||2>t.coordinates.length)return t;const e=x(Number(t.coordinates[0]),Number(t.coordinates[1]));return e?{...t,x:e[0],y:e[1]}:t}):g,i={scales:{x:t=>Number(t),y:t=>Number(t)},timeAxis:"x",width:e,height:n,frameType:"xy",pointNodes:S,stickyPositionCache:L.current[1]},o=P?V({annotations:t,context:i,..."object"==typeof P?P:{}}):t;return mt(o,nt("xy",R),void 0,i)},[g,P,e,n,S,R,x]);return s||a||c||m||k&&k.length>0?xe("svg",{role:"img",width:i,height:o,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[Se("title",{children:"string"==typeof a?a:"XY Chart"}),Se("desc",{children:"string"==typeof a?a+" (XY data visualization)":"XY data visualization"}),xe("g",{transform:"translate("+r.left+","+r.top+")",children:[k,m]}),a&&"string"==typeof a?Se("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?Se("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 Le,zoomIdentity as Ae}from"d3-zoom";import{select as ke}from"d3-selection";function Ce([t,e,n]){const i=1<<n;return[t-Math.floor(t/i)*i,e,n]}function je(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 De=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=Lt(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:A(t.value)})]},t.key))]})}Ne.ownsChrome=!0;var Oe={top:10,right:10,bottom:10,left:10},He=null;function We(){if(null!==He)return He;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 He=t||e||n}function ze(){return We()?12:30}var Fe={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 Xe}from"react/jsx-runtime";var Ye=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:x,onLayoutError:R,xAccessor:L,yAccessor:A,lineDataAccessor:k,pointIdAccessor:E,lineIdAccessor:O,lineType:H="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:xt,margin:Lt,className:At,background:It,windowSize:Et=500,renderMode:Nt,areaStyle:Ot,pointStyle:Ht,lineStyle:Wt,colorScheme:zt,enableHover:Ft=!0,hoverAnnotation:Gt,tooltipContent:qt,allowTooltipOverflow:Zt=!1,customClickBehavior:Xt,customHoverBehavior:Yt,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:Se,legendCategoryAccessor:xe,onCategoriesChange:Me,showAxes:Be,accessibleTable:Ie=!0,description:Ee,summary:He}=t,{customHoverBehavior:Ye,customClickBehavior:Ue,hasClickBehavior:Qe}=f({customHoverBehavior:Yt,customClickBehavior:Xt,onObservation:Ut,chartId:$t,chartType:"StreamGeoFrame"}),$e=mt||[gt||600,vt||400],Ve=jt(!0),Ke=wt({sizeProp:$e,responsiveWidth:bt,responsiveHeight:xt,userMargin:Lt,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=kt(),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]),Sn=Mt(()=>({projection:o,projectionExtent:r,fitPadding:s,xAccessor:L,yAccessor:A,lineDataAccessor:k,lineType:H,flowStyle:Z,areaStyle:Ot,pointStyle:Ht,lineStyle:Wt,colorScheme:zt,themeSemantic:Rt(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:R,layoutMargin:nn}),[o,r,s,L,A,k,H,Z,Ot,Ht,Wt,zt,mn,Q,a,Et,hn.now,te,ee,cn,ln,Vt,E,O,w,P,R,nn]),xn=_(Sn),Rn=jt(null);Rn.current||(Rn.current=new ye(xn));const Ln=jt(null),An=jt(null),kn=jt(null);ut&&!kn.current&&(kn.current=new De(dt||256));const Cn=jt(Vt),jn=jt(null),Dn=jt(Ae),Tn=jt(!1),Mn=jt(null),Bn=Bt(t=>{Mn.current=t,tn&&"object"==typeof tn&&(tn.current=t)},[tn]),_n=jt(null),In=jt(null),En=jt(null),Nn=jt(0);if(nt&&!En.current){const t=it?.maxPerLine??ze();En.current=new Te(50*t)}const On=jt(null),Hn=jt(null),Wn=jt(!1),zn=jt(!1),Fn=St("StreamGeoFrame"),Gn=jt(void 0),[qn,Zn]=Dt(null),[,Xn]=Dt(0),Yn=jt(0),[Un,Qn]=Dt(!1),$n=p(Rn,xe,Me,t=>t.getPoints());M(Rn,xn,Ve,fn),B(Rn,x,Ve,fn),Tt(()=>{const t=Rn.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&&(Rn.current?.pushPoint(t),Ve.current=!0,fn())},[fn]),Kn=Bt(t=>{const e=ot(t);0!==e.length&&(Rn.current?.pushMany(e),Ve.current=!0,fn())},[fn]),Jn=Bt(t=>{null!=t&&"object"==typeof t&&(Rn.current?.pushLine(t),Ve.current=!0,fn())},[fn]),ti=Bt(t=>{const e=ot(t);0!==e.length&&(Rn.current?.pushManyLines(e),Ve.current=!0,fn())},[fn]),ei=Bt(()=>{Rn.current?.clear(),Ve.current=!0,fn()},[fn]);_t(e,()=>({push:Vn,pushMany:Kn,removePoint:t=>{const e=Rn.current?.removePoint(t)??[];return e.length>0&&(Ve.current=!0,fn()),e},pushLine:Jn,pushManyLines:ti,removeLine:t=>{const e=Rn.current?.removeLine(t)??[];return e.length>0&&(Ve.current=!0,fn()),e},getLines:()=>Rn.current?.getLines()??[],clear:ei,getProjection:()=>Rn.current?.scales?.projection??null,getGeoPath:()=>Rn.current?.scales?.geoPath??null,getCartogramLayout:()=>Rn.current?.cartogramLayout??null,getCustomLayout:()=>Rn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Rn.current?.lastCustomLayoutFailure??null,getZoom:()=>Dn.current.k,resetZoom:()=>{const t=Mn.current;t&&jn.current&&ke(t).call(jn.current.transform,Ae)},getData:()=>Rn.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:Rn,dirtyRef:Ve,cleanup:()=>kn.current?.clear(),canvasPaintDependencies:[on,rn,It,he,Nt,fn]});Tt(()=>{ni.current=t=>{if(!Ft)return;const e=Rn.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,Hn.current=null,Zn(null),Ye?.(null),void fn();An.current||(An.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=qe(An.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,Hn.current=t,Zn(a),Ye?.(a),fn()}else On.current&&(On.current=null,Hn.current=null,Zn(null),Ye?.(null),fn())}},[Ft,on,rn,nn,Ye,fn,ni,ri]),Ke.hoverLeaveRef.current=()=>{On.current=null,Hn.current=null,Zn(null),Ye?.(null),fn()};const ai=Bt(t=>{if(ct(t.target))return;if(!Ue)return;const e=Rn.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);An.current||(An.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=qe(An.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:Rn,hoverRef:On,hoveredNodeRef:Hn,setHoverPoint:Zn,customHoverBehavior:Ye,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=Rn.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=Fn.current.beforeCompute(e.getLastUpdateResult(),h);let p=!1;if(Ve.current&&!l){const n={width:on,height:rn},i=e.hasProjection(),o=Pn&&i?e.getRotation():null;e.computeScene(n);const r=Dn.current,s=1!==r.k||0!==r.x||0!==r.y;Pn&&o?s?(e.setRotation(o),e.applyZoomScale(r.k,n)):e.applyRotation(o,n):s&&e.applyZoomTransform(r,n),Ve.current=!1,p=!0,t.setAttribute("aria-label",J(e.scene,"Geographic chart")),$n()}Fn.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&&kn.current){const t=Ln.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=je(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:kn.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(j({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)}D(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 S=Hn.current,x=!(!S||"geoarea"!==S.type&&"point"!==S.type),R=g(x,Wn.current),L=si.current;if(L&&R){const t=ft(L,en,nn,f);if(t){if(t.clearRect(-nn.left,-nn.top,en[0],en[1]),S&&"geoarea"===S.type){const e=new Path2D(S.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(S&&"point"===S.type){const e=S,n="object"==typeof Gt?Gt:void 0,o=n?.pointColor||i(S);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=x}const A=Vt!==Cn.current;A&&(Cn.current=Vt),(p||A||h&&Vt&&Vt.length>0)&&(p||A||o-Yn.current>=33)&&(Xn(t=>t+1),Yn.current=o),(h||null!=e.activeTransition||w.pending||r)&&fn()},I(oe,Rn,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 jn.current&&t&&(ke(t).on(".zoom",null),jn.current=null),void(t&&ke(t).on("mousedown.rotate",null).on("touchstart.rotate",null));const[e,n]=V||[1,8],i={width:on,height:rn};if(Pn){let o=Dn.current.k;const r=t=>{o=Math.max(e,Math.min(n,t)),Dn.current=Ae.scale(o);const r=Rn.current;r&&(r.applyZoomScale(o,i),Ve.current=!1,fn(),r.scales?.projection&&tt?.({projection:r.scales.projection,zoom:r.currentZoom}))};jn.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=Rn.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=Rn.current;t&&(t.applyRotation(n,i),fn())}const o=Rn.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),jn.current=null}}const o=Le().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;Dn.current=e,Tn.current=!0;const n=Rn.current;n&&(n.applyZoomTransform(e,i),Ve.current=!1,fn())}).on("end",t=>{Dn.current=t.transform,Tn.current=!1;const e=Rn.current;e?.scales?.projection&&tt?.({projection:e.scales.projection,zoom:e.currentZoom})});return jn.current=o,ke(t).call(o),()=>{ke(t).on(".zoom",null)}},[$,V,Pn,en,on,rn,nn,tt,fn]);const pi=Ft&&!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=Rn.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 Xe("div",{ref:Bn,className:"stream-geo-frame"+(At?" "+At:""),role:"img","aria-label":Ee||("string"==typeof pe?pe:"Geographic chart"),style:{position:"relative",width:bt?"100%":en[0],height:xt?"100%":en[1]},children:[Ze(Y,{summary:He}),Xe("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}),Xe("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(Re,{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:Se,foregroundGraphics:S(sn,N(Rn.current?.customLayoutOverlays,x??null)),annotations:Vt,onAnnotationActivate:Kt,onObservation:Qt??Ut,chartId:$t,chartType:"StreamGeoFrame",autoPlaceAnnotations:Jt,pointNodes:_e(e),geoProjection:Rn.current?.scales?.projectedPoint})]})}return Xe("div",{ref:Bn,className:"stream-geo-frame"+(At?" "+At:""),role:"group","aria-label":Ee||("string"==typeof pe?pe:"Geographic chart"),tabIndex:0,style:{position:"relative",width:bt?"100%":en[0],height:xt?"100%":en[1],overflow:Zt?"visible":"hidden",...$?{touchAction:"none"}:{}},onKeyDown:ui,children:["production"!==process.env.NODE_ENV&&Rn.current&&Ze(X,{store:Rn.current,diagnostics:Fn.current}),Ie&&Ze(U,{tableId:un}),Ie&&Ze(W,{scene:Rn.current?.scene??[],chartType:"Geographic chart",tableId:un,chartTitle:"string"==typeof pe?pe:void 0}),Ze(Y,{summary:He}),Ze(z,{hoverPoint:qn}),Xe("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(F,{size:en,margin:nn,children:an}),ut&&Ze("canvas",{ref:Ln,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Ze("canvas",{ref:ri,"aria-label":J(Rn.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(Re,{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:Se,foregroundGraphics:S(sn,N(Rn.current?.customLayoutOverlays,x??null)),annotations:Vt,onAnnotationActivate:Kt,onObservation:Qt??Ut,chartId:$t,chartType:"StreamGeoFrame",autoPlaceAnnotations:Jt,pointNodes:_e(Rn.current?.scene),geoProjection:Rn.current?.scales?.projectedPoint}),oe?.showBadge&&Ze(v,{isStale:Un,position:oe.badgePosition}),$&&Xe("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=jn.current;e&&n?.scaleBy&&n.scaleBy(ke(e),1.5)},style:Fe,children:"+"}),Ze("button",{type:"button","aria-label":"Zoom out",onClick:t=>{t.stopPropagation();const e=Mn.current,n=jn.current;e&&n?.scaleBy&&n.scaleBy(ke(e),1/1.5)},style:Fe,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]})]})}));Ye.displayName="StreamGeoFrame";var Ue=Ye;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:S,onObservation:x,onClick:R,chartId:L,loading:A,loadingContent:k,emptyContent:C,className:j,frameProps:D={}}=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:S,fallbackFields:"string"==typeof f?[f]:[],unwrapData:!1,onObservation:x,onClick:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"GeoCustomChart",chartId:L,showLegend:!1,userMargin:B,marginDefaults:M.marginDefaults,loading:A,loadingContent:k,emptyContent:C,width:M.width,height:M.height}),H=O.effectiveSelectionHook,W=$e(()=>H?.isActive?{isActive:!0,predicate:H.predicate}:null,[H?.isActive,H?.predicate]);if(O.earlyReturn)return O.earlyReturn;const{width:z,height:F,enableHover:G,title:q,description:Z,summary:X,accessibleTable:Y}=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,F],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:O.margin,enableHover:G,...w({title:q,description:Z,summary:X,accessibleTable:Y,className:j,animate:n.animate,autoPlaceAnnotations:n.autoPlaceAnnotations}),...!1===g?{tooltipContent:()=>null}:U?{tooltipContent:U}:{},...P({linkedHover:S,selection:b,onObservation:x,onClick:R,hoverHighlight:!1,mobileInteraction:O.mobileInteraction,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior,linkedHoverInClickPredicate:!1}),...y&&y.length>0&&{annotations:y},...D};return Ve(At,{componentName:"GeoCustomChart",width:z,height:F,children:Ve(Ue,{ref:T,...Q})})});Ke.displayName="GeoCustomChart";export{Ue as StreamGeoFrame_default,Ke as GeoCustomChart};
@@ -1 +0,0 @@
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};