semiotic 3.8.7 → 3.8.9

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 (227) hide show
  1. package/CLAUDE.md +6 -5
  2. package/README.md +58 -48
  3. package/ai/dist/mcp-server.js +28 -2
  4. package/ai/schema.json +386 -4
  5. package/ai/surface-manifest.json +1 -1
  6. package/ai/system-prompt.md +1 -1
  7. package/dist/{chunk-chartContainerDataAudit-JDSVSKGM.module.min.js → chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js} +1 -1
  8. package/dist/chunk-chunk-2B3AIKUZ.module.min.js +2 -0
  9. package/dist/chunk-chunk-2NVFEB7P.module.min.js +2 -0
  10. package/dist/chunk-chunk-2X3FJCME.module.min.js +1 -0
  11. package/dist/{chunk-chunk-LVHDZAT3.module.min.js → chunk-chunk-2ZHHWZQM.module.min.js} +1 -1
  12. package/dist/chunk-chunk-5VVNW5AZ.module.min.js +1 -0
  13. package/dist/chunk-chunk-5ZON5NMV.module.min.js +2 -0
  14. package/dist/chunk-chunk-66PCWJUG.module.min.js +1 -0
  15. package/dist/chunk-chunk-6S3YGYW7.module.min.js +1 -0
  16. package/dist/chunk-chunk-7C5EDZ3Z.module.min.js +2 -0
  17. package/dist/chunk-chunk-A3I4HBD5.module.min.js +1 -0
  18. package/dist/{chunk-chunk-5SD6BHVW.module.min.js → chunk-chunk-AFQHURLO.module.min.js} +1 -1
  19. package/dist/chunk-chunk-DDB4TLQG.module.min.js +2 -0
  20. package/dist/{chunk-chunk-OI7R7EJB.module.min.js → chunk-chunk-DTH3SUOU.module.min.js} +1 -1
  21. package/dist/chunk-chunk-DTSNLGRK.module.min.js +2 -0
  22. package/dist/{chunk-chunk-NH4MEAKP.module.min.js → chunk-chunk-DVCWU7MT.module.min.js} +1 -1
  23. package/dist/chunk-chunk-FEPXDKJP.module.min.js +1 -0
  24. package/dist/chunk-chunk-FJ76HWQZ.module.min.js +1 -0
  25. package/dist/chunk-chunk-FSIHAW6L.module.min.js +2 -0
  26. package/dist/chunk-chunk-G2RGVEYY.module.min.js +2 -0
  27. package/dist/chunk-chunk-G75OPF5N.module.min.js +2 -0
  28. package/dist/chunk-chunk-HADHLMY5.module.min.js +1 -0
  29. package/dist/chunk-chunk-HAJVODLO.module.min.js +2 -0
  30. package/dist/chunk-chunk-HBFA4NN6.module.min.js +1 -0
  31. package/dist/{chunk-chunk-FRO4TRXK.module.min.js → chunk-chunk-HIV7AW2V.module.min.js} +1 -1
  32. package/dist/{chunk-chunk-Z2AJERX5.module.min.js → chunk-chunk-JZAMMSQQ.module.min.js} +1 -1
  33. package/dist/chunk-chunk-LSJUXBMF.module.min.js +1 -0
  34. package/dist/chunk-chunk-MXMRXSCI.module.min.js +2 -0
  35. package/dist/chunk-chunk-MXVBXFKW.module.min.js +2 -0
  36. package/dist/chunk-chunk-NWIGA3UK.module.min.js +1 -0
  37. package/dist/chunk-chunk-OFAP623Y.module.min.js +2 -0
  38. package/dist/{chunk-chunk-JWXLNZSM.module.min.js → chunk-chunk-OHLRAEQZ.module.min.js} +1 -1
  39. package/dist/{chunk-chunk-XEVJDUTH.module.min.js → chunk-chunk-OZK46A5U.module.min.js} +1 -1
  40. package/dist/chunk-chunk-PMR47KRY.module.min.js +2 -0
  41. package/dist/chunk-chunk-PRNXOCYZ.module.min.js +2 -0
  42. package/dist/chunk-chunk-RLKZVJMQ.module.min.js +2 -0
  43. package/dist/chunk-chunk-SK2TQMG4.module.min.js +2 -0
  44. package/dist/chunk-chunk-SKLYXNYW.module.min.js +2 -0
  45. package/dist/chunk-chunk-TCMHJWFJ.module.min.js +1 -0
  46. package/dist/chunk-chunk-U4NZCU5T.module.min.js +2 -0
  47. package/dist/chunk-chunk-VKL6DI43.module.min.js +2 -0
  48. package/dist/chunk-chunk-W62673ZE.module.min.js +1 -0
  49. package/dist/chunk-chunk-WFHZHWT7.module.min.js +1 -0
  50. package/dist/{chunk-chunk-GU2EJIDJ.module.min.js → chunk-chunk-XCC25CZZ.module.min.js} +1 -1
  51. package/dist/chunk-chunk-XECNOUZY.module.min.js +2 -0
  52. package/dist/{chunk-chunk-BNGBEY7N.module.min.js → chunk-chunk-XYZDTYAF.module.min.js} +1 -1
  53. package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +2 -0
  54. package/dist/components/Tooltip/Tooltip.d.ts +54 -1
  55. package/dist/components/charts/index.d.ts +2 -2
  56. package/dist/components/charts/network/ProcessSankey.d.ts +105 -74
  57. package/dist/components/charts/network/processSankey/accessors.d.ts +7 -0
  58. package/dist/components/charts/network/processSankey/algorithm.d.ts +14 -193
  59. package/dist/components/charts/network/processSankey/axisChrome.d.ts +31 -0
  60. package/dist/components/charts/network/processSankey/bandPaths.d.ts +45 -0
  61. package/dist/components/charts/network/processSankey/buildScenes.d.ts +41 -3
  62. package/dist/components/charts/network/processSankey/fixtures.d.ts +17 -0
  63. package/dist/components/charts/network/processSankey/frameMargins.d.ts +11 -0
  64. package/dist/components/charts/network/processSankey/groupBonding.d.ts +13 -0
  65. package/dist/components/charts/network/processSankey/inventoryAtTime.d.ts +41 -0
  66. package/dist/components/charts/network/processSankey/labelPlacement.d.ts +34 -0
  67. package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +47 -0
  68. package/dist/components/charts/network/processSankey/layoutOrchestrator.d.ts +44 -0
  69. package/dist/components/charts/network/processSankey/layoutQualityProduct.d.ts +27 -0
  70. package/dist/components/charts/network/processSankey/massSimulation.d.ts +16 -0
  71. package/dist/components/charts/network/processSankey/ordering.d.ts +55 -0
  72. package/dist/components/charts/network/processSankey/orderingBond.d.ts +33 -0
  73. package/dist/components/charts/network/processSankey/orientation.d.ts +5 -0
  74. package/dist/components/charts/network/processSankey/packing.d.ts +8 -0
  75. package/dist/components/charts/network/processSankey/packingCache.d.ts +23 -0
  76. package/dist/components/charts/network/processSankey/processSankeyLayoutAsync.d.ts +27 -0
  77. package/dist/components/charts/network/processSankey/processSankeyLayoutWorkerClient.d.ts +72 -0
  78. package/dist/components/charts/network/processSankey/processSankeyTooltip.d.ts +26 -0
  79. package/dist/components/charts/network/processSankey/processSankeyTypes.d.ts +163 -0
  80. package/dist/components/charts/network/processSankey/ribbonInputs.d.ts +26 -2
  81. package/dist/components/charts/network/processSankey/ribbonRunway.d.ts +45 -0
  82. package/dist/components/charts/network/processSankey/streamingLayout.d.ts +23 -0
  83. package/dist/components/charts/network/processSankey/time.d.ts +11 -0
  84. package/dist/components/charts/network/processSankey/useProcessSankeyPush.d.ts +29 -0
  85. package/dist/components/charts/network/processSankey/useProcessSankeyScenes.d.ts +26 -0
  86. package/dist/components/charts/network/processSankey/validation.d.ts +33 -0
  87. package/dist/components/charts/physics/chainReactionTypes.d.ts +1 -0
  88. package/dist/components/charts/physics/physicsHocUtils.d.ts +1 -1
  89. package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +2 -0
  90. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +2 -0
  91. package/dist/components/charts/realtime/RealtimeLineChart.d.ts +2 -0
  92. package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +2 -0
  93. package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +2 -0
  94. package/dist/components/charts/shared/chartFamilySets.d.ts +1 -0
  95. package/dist/components/charts/shared/formatUtils.d.ts +45 -3
  96. package/dist/components/charts/shared/hatchFill.d.ts +2 -0
  97. package/dist/components/charts/shared/hooks.d.ts +1 -1
  98. package/dist/components/charts/shared/leastSquaresRegression.d.ts +31 -0
  99. package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -0
  100. package/dist/components/charts/shared/styleRules.d.ts +5 -1
  101. package/dist/components/charts/shared/types.d.ts +8 -1
  102. package/dist/components/charts/shared/useChartLegend.d.ts +6 -0
  103. package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
  104. package/dist/components/charts/shared/validateProps.d.ts +2 -2
  105. package/dist/components/charts/shared/withChartWrapper.d.ts +0 -6
  106. package/dist/components/data/numericFieldProfiler.d.ts +2 -0
  107. package/dist/components/recipes/layout1d.d.ts +68 -0
  108. package/dist/components/semiotic-network.d.ts +2 -2
  109. package/dist/components/semiotic-recipes-core.d.ts +2 -0
  110. package/dist/components/semiotic-utils-core.d.ts +1 -0
  111. package/dist/components/semiotic.d.ts +6 -3
  112. package/dist/components/server/staticSVGChrome.d.ts +2 -1
  113. package/dist/components/store/createStore.d.ts +2 -0
  114. package/dist/components/stream/GeoTileRenderer.d.ts +1 -0
  115. package/dist/components/stream/OrdinalPipelineStore.d.ts +3 -0
  116. package/dist/components/stream/PipelineStore.d.ts +5 -0
  117. package/dist/components/stream/accessorUtils.d.ts +21 -0
  118. package/dist/components/stream/canvasSetup.d.ts +15 -4
  119. package/dist/components/stream/frameKeyboardNavigation.d.ts +3 -2
  120. package/dist/components/stream/geoTypes.d.ts +2 -0
  121. package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +3 -8
  122. package/dist/components/stream/layouts/index.d.ts +1 -1
  123. package/dist/components/stream/moduleWorkerSession.d.ts +67 -0
  124. package/dist/components/stream/networkFramePaint.d.ts +8 -0
  125. package/dist/components/stream/networkTypes.d.ts +4 -0
  126. package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +2 -1
  127. package/dist/components/stream/ordinalTypes.d.ts +2 -0
  128. package/dist/components/stream/physics/PhysicsKernel.d.ts +9 -0
  129. package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -0
  130. package/dist/components/stream/pipelineConfig.d.ts +2 -0
  131. package/dist/components/stream/pipelineDomainResolution.d.ts +1 -1
  132. package/dist/components/stream/pipelineIntroCancellation.d.ts +6 -0
  133. package/dist/components/stream/pipelineTransitions.d.ts +15 -1
  134. package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +16 -4
  135. package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +4 -0
  136. package/dist/components/stream/symbolPath.d.ts +8 -0
  137. package/dist/components/stream/types.d.ts +10 -1
  138. package/dist/components/stream/useCanvasFrameHost.d.ts +15 -0
  139. package/dist/components/stream/useSemanticFrameInteractions.d.ts +12 -3
  140. package/dist/components/stream/xyFrameAxisTypes.d.ts +9 -0
  141. package/dist/forceLayoutWorker.js +1 -1
  142. package/dist/geo.min.js +1 -1
  143. package/dist/geo.module.min.js +1 -1
  144. package/dist/network.min.js +1 -1
  145. package/dist/network.module.min.js +1 -1
  146. package/dist/ordinal.min.js +1 -1
  147. package/dist/ordinal.module.min.js +1 -1
  148. package/dist/physics.min.js +1 -1
  149. package/dist/physics.module.min.js +1 -1
  150. package/dist/physicsWorker.js +1 -1
  151. package/dist/processSankeyLayoutWorker.js +1 -0
  152. package/dist/realtime.min.js +1 -1
  153. package/dist/realtime.module.min.js +1 -1
  154. package/dist/semiotic-ai-core.min.js +1 -1
  155. package/dist/semiotic-ai-core.module.min.js +1 -1
  156. package/dist/semiotic-ai.min.js +1 -1
  157. package/dist/semiotic-ai.module.min.js +1 -1
  158. package/dist/semiotic-experimental-vacp.min.js +1 -1
  159. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  160. package/dist/semiotic-experimental.min.js +1 -1
  161. package/dist/semiotic-experimental.module.min.js +1 -1
  162. package/dist/semiotic-network.d.ts +2 -2
  163. package/dist/semiotic-realtime-core.min.js +1 -1
  164. package/dist/semiotic-realtime-core.module.min.js +1 -1
  165. package/dist/semiotic-recipes-core.d.ts +2 -0
  166. package/dist/semiotic-recipes-core.min.js +1 -1
  167. package/dist/semiotic-recipes-core.module.min.js +1 -1
  168. package/dist/semiotic-recipes.min.js +1 -1
  169. package/dist/semiotic-recipes.module.min.js +1 -1
  170. package/dist/semiotic-server-edge.min.js +1 -1
  171. package/dist/semiotic-server-edge.module.min.js +1 -1
  172. package/dist/semiotic-server-node.min.js +1 -1
  173. package/dist/semiotic-server-node.module.min.js +1 -1
  174. package/dist/semiotic-themes-core.module.min.js +1 -1
  175. package/dist/semiotic-themes-react.module.min.js +1 -1
  176. package/dist/semiotic-themes.module.min.js +1 -1
  177. package/dist/semiotic-utils-core.d.ts +1 -0
  178. package/dist/semiotic-utils-core.min.js +1 -1
  179. package/dist/semiotic-utils-core.module.min.js +1 -1
  180. package/dist/semiotic-utils-react.module.min.js +1 -1
  181. package/dist/semiotic-utils.min.js +1 -1
  182. package/dist/semiotic-utils.module.min.js +1 -1
  183. package/dist/semiotic-value.min.js +1 -1
  184. package/dist/semiotic-value.module.min.js +1 -1
  185. package/dist/semiotic.d.ts +6 -3
  186. package/dist/semiotic.min.js +1 -1
  187. package/dist/semiotic.module.min.js +1 -1
  188. package/dist/server.min.js +1 -1
  189. package/dist/server.module.min.js +1 -1
  190. package/dist/xy.min.js +1 -1
  191. package/dist/xy.module.min.js +1 -1
  192. package/package.json +4 -3
  193. package/dist/chunk-chunk-2YAZHXL4.module.min.js +0 -2
  194. package/dist/chunk-chunk-3NGIKFD6.module.min.js +0 -1
  195. package/dist/chunk-chunk-7TTBHSAG.module.min.js +0 -2
  196. package/dist/chunk-chunk-7ZDJSYKI.module.min.js +0 -2
  197. package/dist/chunk-chunk-BGHPD3RA.module.min.js +0 -1
  198. package/dist/chunk-chunk-BMRZ2SPU.module.min.js +0 -2
  199. package/dist/chunk-chunk-C7APLVQD.module.min.js +0 -2
  200. package/dist/chunk-chunk-DGWFBOGB.module.min.js +0 -1
  201. package/dist/chunk-chunk-DIVE2DRA.module.min.js +0 -2
  202. package/dist/chunk-chunk-DSNGDNJY.module.min.js +0 -1
  203. package/dist/chunk-chunk-FBUNUIPV.module.min.js +0 -2
  204. package/dist/chunk-chunk-G7QVPZUD.module.min.js +0 -2
  205. package/dist/chunk-chunk-GBPYV4FP.module.min.js +0 -2
  206. package/dist/chunk-chunk-KXAFCCDB.module.min.js +0 -2
  207. package/dist/chunk-chunk-LG7YKJAK.module.min.js +0 -2
  208. package/dist/chunk-chunk-LWITSR2O.module.min.js +0 -2
  209. package/dist/chunk-chunk-MX35T6RX.module.min.js +0 -2
  210. package/dist/chunk-chunk-NJETWX42.module.min.js +0 -2
  211. package/dist/chunk-chunk-NW25WGLS.module.min.js +0 -2
  212. package/dist/chunk-chunk-ONMLEXHR.module.min.js +0 -2
  213. package/dist/chunk-chunk-OY66GCE6.module.min.js +0 -1
  214. package/dist/chunk-chunk-PRDGLMJT.module.min.js +0 -2
  215. package/dist/chunk-chunk-PZFT457G.module.min.js +0 -1
  216. package/dist/chunk-chunk-Q3WW6JGR.module.min.js +0 -1
  217. package/dist/chunk-chunk-Q6XKQTOQ.module.min.js +0 -1
  218. package/dist/chunk-chunk-RJRM2E6P.module.min.js +0 -1
  219. package/dist/chunk-chunk-RPL7WYXI.module.min.js +0 -1
  220. package/dist/chunk-chunk-V3OAKG32.module.min.js +0 -1
  221. package/dist/chunk-chunk-WCX6U47H.module.min.js +0 -2
  222. package/dist/chunk-chunk-WLOIUMWG.module.min.js +0 -2
  223. package/dist/chunk-chunk-XEGXX4F7.module.min.js +0 -1
  224. package/dist/chunk-chunk-XFRBLXYM.module.min.js +0 -1
  225. package/dist/chunk-chunk-ZXYDYAB7.module.min.js +0 -2
  226. package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +0 -2
  227. package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +0 -2
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{lineCanvasRenderer as t,resolveNodeColor as e}from"./chunk-chunk-XECNOUZY.module.min.js";import{coerceDateLikeValue as i,parseDateLikeString as o}from"./chunk-chunk-6V5VQVCT.module.min.js";import{DataSourceAdapter as s,IncrementalExtent as n,barCanvasRenderer as r,buildAreaNode as a,buildEnrichAnnotationData as l,buildHeatcellNode as c,buildLineNode as h,buildPointNode as u,buildRectNode as g,buildStackedAreaNodes as d,buildSymbolNode as f,computeDivergingStackExtent as p,computeStackOffsets as y,normalizeColorGradient as m,normalizeGradient as x,resolveAnnotationAccessor as v,resolveFrameGraphics as b,snapXYIntroTargets as k,ticksForMode as w,toIdSet as A}from"./chunk-chunk-U4NZCU5T.module.min.js";import{RingBuffer as C,applyPulse as _,buildAggregateRibbons as S,buildPerSeriesRibbons as M,compactTimestampBufferForRemoval as P,createTimestampBufferForData as Y,enrichDatumWithBand as R,ensureRingBufferCapacity as T,hasActivePulses as N,partitionRibbons as W,pointCanvasRenderer as O,pushWithTimestamp as D,refreshIdlePulse as z,useLegendCategoryEmission as E,useSemanticFrameInteractions as L,useXYKeyboardNavigation as B}from"./chunk-chunk-VKL6DI43.module.min.js";import{needsInteractionCanvasPaint as F,paintCanvasBackground as I,resolveCanvasBackground as X}from"./chunk-chunk-DTH3SUOU.module.min.js";import{symbolCanvasRenderer as $}from"./chunk-chunk-PRNXOCYZ.module.min.js";import{StalenessBadge as V,applyDecay as G,attachUpdateResultStore as H,buildDatumIndexMap as j,composeOverlays as q,computeDecayOpacity as U,createCustomLayoutFailureDiagnostic as K,findHitPointInQuadtree as Z,getHitRadius as J,glyphCanvasRenderer as Q,hitTestRect as tt,isTimeLandmark as et,paintSceneWithBackend as it,renderPathPulse as ot,renderRectPulse as st,renderSceneWithBackend as nt,resolveStaleness as rt,useConfigSync as at,useLayoutSelectionSync as lt,useStableShallow as ct,useStalenessCheck as ht,warnCustomLayoutDiagnostics as ut}from"./chunk-chunk-DVCWU7MT.module.min.js";import{wrapWithCustomLayoutSelection as gt}from"./chunk-chunk-5UKL5W76.module.min.js";import{accessorsEquivalent as dt,resolveAccessor as ft,resolveRawAccessor as pt,resolveStringAccessor as yt}from"./chunk-chunk-NWIGA3UK.module.min.js";import{filterAnnotationsByStatus as mt}from"./chunk-chunk-XYZDTYAF.module.min.js";import{AccessibleDataTable as xt,AriaLiveTooltip as vt,CanvasFrameBackground as bt,FlippingTooltip as kt,FocusRing as wt,SEQUENTIAL_INTERPOLATORS as At,STREAMING_PALETTE as Ct,SceneRevisionDiagnosticsObserver as _t,ScreenReaderSummary as St,SkipToTableLink as Mt,TITLE_BASELINE as Pt,UpdateResultTracker as Yt,annotationLayout as Rt,buildHoverData as Tt,buildLinearFillGradient as Nt,buildThresholdLineSegments as Wt,computeCanvasAriaLabel as Ot,computeEasing as Dt,computeRawProgress as zt,createDefaultAnnotationRules as Et,defaultTooltipStyle as Lt,filterSparseArray as Bt,getCSSColorCacheVersion as Ft,getDevicePixelRatio as It,getPointerHitRadius as Xt,getSequentialInterpolator as $t,isAnnotationActivationTarget as Vt,isServerEnvironment as Gt,lerp as Ht,makeSymbolResolver as jt,now as qt,observationInputType as Ut,prepareCanvas as Kt,renderAnnotationPass as Zt,renderLegendFromConfig as Jt,resolveCSSColor as Qt,resolveCanvasFill as te,resolveCurveFactory as ee,resolveLegendSideGutter as ie,smartTooltipEntries as oe,symbolRadius as se,unlockCrosshair as ne,useAnnotationActivationOptions as re,useCrosshairPosition as ae,useFrame as le,useFrameCanvasHost as ce,useSceneRevisionDiagnostics as he,xySceneNodeToSVG as ue}from"./chunk-chunk-SK2TQMG4.module.min.js";import{getMax as ge}from"./chunk-chunk-2NVFEB7P.module.min.js";import{resolveThemeSemanticColors as de}from"./chunk-chunk-PMR47KRY.module.min.js";import{glyphHitGeometry as fe}from"./chunk-chunk-KTWEBFMX.module.min.js";import{useHydration as pe,useWasHydratingFromSSR as ye}from"./chunk-chunk-ACLDBMRH.module.min.js";import*as me from"react";import{useRef as xe,useState as ve,useEffect as be,useMemo as ke,useCallback as we,useImperativeHandle as Ae,useId as Ce,forwardRef as _e,memo as Se}from"react";import*as Me from"react";import{jsx as Pe}from"react/jsx-runtime";var Ye=null,Re=null;function Te(t){const[e,i]=Me.useState(()=>Ye);return Me.useEffect(()=>{if(e)return;let t=!1;return(Ye?Promise.resolve(Ye):(Re||(Re=import("./chunk-XYBrushOverlay-EP2SV3UI.module.min.js").then(t=>Ye=t.XYBrushOverlay).catch(t=>{throw Re=null,t})),Re)).then(e=>{t||i(()=>e)}),()=>{t=!0}},[e]),e?Pe(e,{...t}):null}function Ne(t,e,i){if(e._transitionKey)return e._transitionKey;switch(e.type){case"point":if(e.pointId)return"p:"+e.pointId;if("streaming"===t.runtimeMode&&e.datum){const i=t.getX(e.datum),o=t.getY(e.datum);if(t.getCategory)return`p:${t.getCategory(e.datum)}:${i}:${o}`;if(null!=i&&null!=o)return`p:${i}:${o}`}return"p:"+i;case"glyph":return e.pointId?"g:"+e.pointId:"g:"+i;case"rect":return`r:${e.group||""}:${e.datum?.binStart??e.datum?.category??i}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return null==e.datum?"c:"+i:"c:"+t.getX(e.datum);case"line":return"l:"+(e.group||"_default");case"area":return"a:"+(e.group||"_default");default:return null}}function We(t){return t?null!=t.opacity?t.opacity:null!=t.fillOpacity?t.fillOpacity:1:1}function Oe(t,e,i,o){if(!t.config.pointStyle)return;const s=o??t.getY;for(const o of e){const e=t.resolveGroupColor(o.key);for(const n of o.data){let o=t.config.pointStyle(n);!o.fill&&e&&(o={...o,fill:e});const r=o.r??3,a=t.getPointId?t.getPointId(n)+"":void 0,l=u(n,t.scales,t.getX,s,r,o,a);l&&i.push(l)}}}function De(t){return"threshold"===t.type&&"string"==typeof t.color&&"number"==typeof t.value}function ze(t){return x(t)}var Ee=new Map;function Le(t,e,i){const o=i.config.areaStyle?.(e);return o&&(t.style=o),t}function Be(t,e,i,o,s){const n=new Map;for(const r of t){const t=e(r),a=i(r);if(null==t||null==a||Number.isNaN(t)||Number.isNaN(a))continue;const l=Math.floor(t/o)*o;let c=n.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},n.set(l,c)),c.total+=a,s){const t=s(r);c.categories.set(t,(c.categories.get(t)||0)+a)}}return n}function Fe(t,e){const i="function"==typeof t?t:i=>i[t||e];return t=>{const e=i(t);return null==e?NaN:+e}}function Ie(t){const e=[],i=["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode,o=Fe(i&&t.valueAccessor||t.yAccessor,i?"value":"y");if(t.boundsAccessor){const i=ft(t.boundsAccessor,"bounds");e.push({kind:"bounds",getTop:t=>{const e=o(t);if(!Number.isFinite(e))return NaN;const s=i(t);return Number.isFinite(s)&&0!==s?e+s:e},getBottom:t=>{const e=o(t);if(!Number.isFinite(e))return NaN;const s=i(t);return Number.isFinite(s)&&0!==s?e-s:e},style:t.boundsStyle,perSeries:!0,interactive:!1})}if(t.band){const i=Array.isArray(t.band)?t.band:[t.band];for(const t of i)e.push({kind:"band",getTop:Fe(t.y1Accessor,"y1"),getBottom:Fe(t.y0Accessor,"y0"),style:t.style,perSeries:!1!==t.perSeries,interactive:!0===t.interactive})}return e}import{scaleLinear as Xe,scaleLog as $e,scaleSymlog as Ve,scaleTime as Ge}from"d3-scale";function He(t,e){return e?[e[0]??t[0],e[1]??t[1]]:t}function je(t,e,i){if("log"===t){const t=[Math.max(e[0],1e-6),Math.max(e[1],1e-6)];return $e().domain(t).range(i).clamp(!0)}return"symlog"===t?Ve().domain(e).range(i):"time"===t?Ge().domain([new Date(e[0]),new Date(e[1])]).range(i):Xe().domain(e).range(i)}var qe=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ue=["scene-style","data-paint","accessibility","evidence"],Ke=(t,e)=>({retainedData:t,invalidations:e}),Ze=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Je=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Qe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ti=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ei=["scene-geometry","data-paint","accessibility","evidence"],ii=["scene-style","data-paint","accessibility","evidence"],oi=[],si={chartType:Ke("rebuild",Ze),runtimeMode:Ke("rebuild",Ze),xAccessor:Ke("rebuild",Ze),yAccessor:Ke("rebuild",Ze),timeAccessor:Ke("rebuild",Ze),valueAccessor:Ke("rebuild",Ze),y0Accessor:Ke("rebuild",Ze),boundsAccessor:Ke("rebuild",Ze),band:Ke("rebuild",Ze),openAccessor:Ke("rebuild",Ze),highAccessor:Ke("rebuild",Ze),lowAccessor:Ke("rebuild",Ze),closeAccessor:Ke("rebuild",Ze),candlestickRangeMode:Ke("rebuild",Ze),accessorRevision:Ke("rebuild",Ze),groupAccessor:Ke("rebuild",Je),categoryAccessor:Ke("rebuild",Je),lineDataAccessor:Ke("rebuild",Je),colorAccessor:Ke("rebuild",ii),sizeAccessor:Ke("rebuild",ei),symbolAccessor:Ke("rebuild",ei),pointIdAccessor:Ke("rebuild",ei),xScaleType:Ke("preserve",Qe),yScaleType:Ke("preserve",Qe),xExtent:Ke("preserve",Qe),yExtent:Ke("preserve",Qe),extentPadding:Ke("preserve",Qe),scalePadding:Ke("preserve",Qe),axisExtent:Ke("preserve",Qe),yAxisExtent:Ke("preserve",Qe),binSize:Ke("preserve",Qe),normalize:Ke("preserve",Qe),heatmapAggregation:Ke("preserve",Qe),heatmapXBins:Ke("preserve",Qe),heatmapYBins:Ke("preserve",Qe),arrowOfTime:Ke("preserve",ti),baseline:Ke("preserve",ti),stackOrder:Ke("preserve",ti),sizeRange:Ke("preserve",ti),curve:Ke("preserve",ti),areaGroups:Ke("preserve",ti),customLayout:Ke("preserve",ti),layoutConfig:Ke("preserve",ti),layoutMargin:Ke("preserve",ti),symbolMap:Ke("preserve",ei),showValues:Ke("preserve",ei),heatmapValueFormat:Ke("preserve",ei),lineStyle:Ke("preserve",ii),pointStyle:Ke("preserve",ii),areaStyle:Ke("preserve",ii),barStyle:Ke("preserve",ii),swarmStyle:Ke("preserve",ii),waterfallStyle:Ke("preserve",ii),candlestickStyle:Ke("preserve",ii),boundsStyle:Ke("preserve",ii),gradientFill:Ke("preserve",ii),lineGradient:Ke("preserve",ii),semanticLineStops:Ke("preserve",ii),colorScheme:Ke("preserve",ii),themeCategorical:Ke("preserve",ii),themeSemantic:Ke("preserve",ii),themeSequential:Ke("preserve",ii),themeDiverging:Ke("preserve",ii),barColors:Ke("preserve",ii),decay:Ke("preserve",ii),pulse:Ke("preserve",ii),staleness:Ke("preserve",ii),layoutSelection:Ke("preserve",ii),annotations:Ke("preserve",["overlay","accessibility","evidence"]),windowSize:Ke("preserve",oi),windowMode:Ke("preserve",oi),maxCapacity:Ke("preserve",oi),clock:Ke("preserve",oi),transition:Ke("preserve",oi),introAnimation:Ke("preserve",oi),onLayoutError:Ke("preserve",oi)},ni=Ke("preserve",ti),ri=class{constructor(){this.tracker=new Yt}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}},qe)}recordNoop(t){return this.tracker.record({kind:t,..."restyle"===t?{}:{count:0}},[])}recordRestyle(t){return t?this.tracker.record({kind:"restyle"},Ue):this.recordNoop("restyle")}recordConfig(t){const e=function(t){let e="preserve";const i=new Set;for(const o of t){const t=si[o]??ni;"rebuild"===t.retainedData&&(e="rebuild");for(const e of t.invalidations)i.add(e)}return{retainedData:e,invalidations:i}}(t);return this.tracker.record({kind:"config",keys:t},e.invalidations)}};import{quadtree as ai}from"d3-quadtree";var li=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(t,e){if("scatter"!==t&&"bubble"!==t&&"custom"!==t)return void this.clear();let i=0,o=0;for(const t of e)"point"===t.type&&(i++,t.r>o&&(o=t.r));if(this.maxRadius=o,500>=i)return void(this.tree=null);const s=Array(i);let n=0;for(const t of e)"point"===t.type&&(s[n++]=t);this.tree=ai().x(t=>t.x).y(t=>t.y).addAll(s)}},ci=class t{constructor(t){if(this.xExtent=new n,this.yExtent=new n,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new ri,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this.spatialIndex=new li,this._lastBoundedInsertsRef=null,this.applyPulse=(t,e,i)=>!(!this.config.pulse||!this.timestampBuffer)&&_(this.config.pulse,t,e,this.timestampBuffer,this.getDatumIndexMap(e),i),this.config=t,this.buffer=new C(t.windowSize),this.growingCap=t.windowSize,["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode?(this.getX=ft(t.timeAccessor||t.xAccessor,"time"),this.getY=ft(t.valueAccessor||t.yAccessor,"value")):(this.getX=ft(t.xAccessor,"x"),this.getY=ft(t.yAccessor,"y")),this.getGroup=yt(t.groupAccessor),this.getCategory=yt(t.categoryAccessor),this.getSize=t.sizeAccessor?ft(t.sizeAccessor,"size"):void 0,this.getColor=yt(t.colorAccessor),this.getSymbol=yt(t.symbolAccessor),this.getY0=t.y0Accessor?ft(t.y0Accessor,"y0"):void 0,this.resolvedRibbons=Ie(t),this.getPointId=yt(t.pointIdAccessor),"candlestick"===t.chartType){const e=null!=t.openAccessor,i=null!=t.closeAccessor;this.getOpen=e?ft(t.openAccessor,"open"):void 0,this.getHigh=ft(t.highAccessor,"high"),this.getLow=ft(t.lowAccessor,"low"),this.getClose=i?ft(t.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!i}t.pulse&&(this.timestampBuffer=new C(t.windowSize))}currentTime(){return this.config.clock?.()??qt()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=Y(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(t){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(t)),void this.yExtent.push(this.getLow(t));this.yExtent.push(this.getY(t)),this.getY0&&this.yExtent.push(this.getY0(t));for(const e of this.resolvedRibbons){const i=e.getTop(t),o=e.getBottom(t);Number.isFinite(i)&&this.yExtent.push(i),Number.isFinite(o)&&this.yExtent.push(o)}}evictDatumYExtent(t){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(t)),void this.yExtent.evict(this.getLow(t));this.yExtent.evict(this.getY(t)),this.getY0&&this.yExtent.evict(this.getY0(t));for(const e of this.resolvedRibbons){const i=e.getTop(t),o=e.getBottom(t);Number.isFinite(i)&&this.yExtent.evict(i),Number.isFinite(o)&&this.yExtent.evict(o)}}rebuildYExtent(){this.yExtent.clear();for(const t of this.buffer)this.pushDatumYExtent(t)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const t of this.buffer)this.xExtent.push(this.getX(t)),this.pushDatumYExtent(t)}ingest(t){if(t.bounded&&this._lastBoundedInsertsRef===t.inserts)return this.updateResults.recordNoop("replace"),!1;const e=this.currentTime();if(this.lastIngestTime=e,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,t.bounded){this._lastBoundedInsertsRef=t.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const s=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=s?ft(this.config.timeAccessor||this.config.xAccessor,"time"):ft(this.config.xAccessor,"x"),this.xIsDate=!1,t.inserts.length>0){const e=t.inserts[0],s=this.config.xAccessor,n="function"==typeof s?s(e):e[s||"x"],r=n instanceof Date,a="string"==typeof n&&Number.isFinite(o(n));if(this.xIsDate=r||a,a){const t="string"==typeof s?s:void 0;this.getX=t?e=>i(e[t]):t=>i(s(t))}}T(this.buffer,t.totalSize||t.inserts.length,this.timestampBuffer);for(const i of t.inserts)D(this.buffer,i,this.timestampBuffer,e),this.xExtent.push(this.getX(i)),this.pushDatumYExtent(i)}else for(const i of t.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const t=this.config.maxCapacity??1e5;t>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,t),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${t}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const t=D(this.buffer,i,this.timestampBuffer,e);this.xExtent.push(this.getX(i)),this.pushDatumYExtent(i),null!=t&&(this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t))}return this.updateResults.recordData(t.bounded?"replace":"ingest",t.inserts.length),!0}ingestWithResult(t){return this.ingest(t),this.updateResults.last}computeScene(t){const{config:e,buffer:i}=this,o=this.scales,s=this.lastLayout;if(!this.needsFullRebuild&&!e.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==t.width||this.lastLayout.height!==t.height))return void this.remapScene(t);this.xExtent.dirty&&this.xExtent.recalculate(i,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const n=this.getBufferArray(),r=this.yExtent.extent;let a=He(this.xExtent.extent,e.xExtent),l=He(r,e.yExtent);const c=!(!(h=e.yExtent)||null==h[0]||null==h[1]);var h;const u="exact"===(e.yAxisExtent??e.axisExtent);if("stackedarea"===e.chartType&&!c&&i.size>0){const t=function(t){const{config:e,groups:i,getX:o,getY:s}=t,n="exact"===(e.yAxisExtent??e.axisExtent);if(e.normalize){const i=[0,n?1:1+e.extentPadding];return{yDomain:i,stackExtentCache:{key:`${t.bufferSize}:${t.ingestVersion}:norm`,yDomain:i}}}const r=`${t.bufferSize}:${t.ingestVersion}:${e.baseline??"zero"}:${e.stackOrder??"key"}`;if(t.stackExtentCache&&t.stackExtentCache.key===r)return{yDomain:t.stackExtentCache.yDomain,stackExtentCache:t.stackExtentCache};const a=new Map,l=new Set;let c=0;const h=new Map,u=new Map;for(const t of i){const e=new Map;let i=0;for(const n of t.data){const t=o(n),r=s(n);if(!Number.isFinite(t)||!Number.isFinite(r))continue;e.set(t,(e.get(t)||0)+r),l.add(t),i+=r;const a=(h.get(t)||0)+r;h.set(t,a),a>c&&(c=a)}a.set(t.key,e),u.set(t.key,i)}const g=e.stackOrder??"key",d=(t,e)=>e>t?-1:t>e?1:0;let f,m;if("input"===g)f=i.map(t=>t.key);else if("insideOut"===g){const t=[...i].map(t=>t.key).sort((t,e)=>{const i=(u.get(e)??0)-(u.get(t)??0);return 0!==i?i:d(t,e)}),e=[],o=[];let s=0,n=0;for(const i of t)n>s?(e.push(i),s+=u.get(i)??0):(o.push(i),n+=u.get(i)??0);f=[...o.reverse(),...e]}else f="asc"===g?i.map(t=>t.key).sort((t,e)=>{const i=(u.get(t)??0)-(u.get(e)??0);return 0!==i?i:d(t,e)}):"desc"===g?i.map(t=>t.key).sort((t,e)=>{const i=(u.get(e)??0)-(u.get(t)??0);return 0!==i?i:d(t,e)}):i.map(t=>t.key).sort(d);if("wiggle"===e.baseline||"silhouette"===e.baseline){const t=Array.from(l).sort((t,e)=>t-e),i=y(t,f,(t,e)=>a.get(t)?.get(e)||0,e.baseline);let o=1/0,s=-1/0;for(const e of t){const t=i.get(e)??0,n=h.get(e)??0;o>t&&(o=t),t+n>s&&(s=t+n)}Number.isFinite(o)&&Number.isFinite(s)||(o=0,s=0);const r=s-o,c=n?0:r>0?r*e.extentPadding:1;m=[o-c,s+c]}else if("diverging"===e.baseline){const t=Array.from(l).sort((t,e)=>t-e),[i,o]=p(t,f,(t,e)=>a.get(t)?.get(e)||0),s=o-i,r=n?0:s>0?s*e.extentPadding:1;m=[i-r,o+r]}else m=[0,c+(n?0:c>0?c*e.extentPadding:1)];return{yDomain:m,stackExtentCache:{key:r,yDomain:m}}}({config:e,groups:this.groupData(n),getX:this.getX,getY:this.getY,bufferSize:i.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=t.yDomain,this._stackExtentCache=t.stackExtentCache}else"bar"===e.chartType&&e.binSize&&!c&&i.size>0?l=function(t,e,i,o,s,n,r){const[,a]=function(t,e,i,o,s){const n=Be(t,e,i,o,s);if(0===n.size)return[0,0];let r=0;for(const t of n.values())t.total>r&&(r=t.total);return[0,r]}(t,e,i,o,s);return[0,r?a:a+a*n]}(i,this.getX,this.getY,e.binSize,this.getCategory,e.extentPadding,u):"waterfall"===e.chartType&&!c&&i.size>0?l=function(t,e,i,o){const[s,n]=function(t,e){let i=0,o=0,s=0;for(const n of t){const t=e(n);null==t||Number.isNaN(t)||(s+=t,i>s&&(i=s),s>o&&(o=s))}return[i,o]}(t,e),r=n-s,a=o?0:r>0?r*i:1;return[Math.min(0,s-Math.abs(a)),Math.max(0,n+Math.abs(a))]}(i,this.getY,e.extentPadding,u):c||l[0]===1/0||(l=function(t,e,i){if(!i.length)return t;let[o,s]=t;for(const t of e)for(const e of i){const i=e.getTop(t),n=e.getBottom(t);Number.isFinite(i)&&(o>i&&(o=i),i>s&&(s=i)),Number.isFinite(n)&&(o>n&&(o=n),n>s&&(s=n))}return[o,s]}(l,n,this.resolvedRibbons),l=function(t,e){const i=t[1]-t[0],o=e.exactMode?0:i>0?i*e.extentPadding:1,s=[null!=e.userMin?t[0]:t[0]-o,null!=e.userMax?t[1]:t[1]+o];return"log"!==e.yScaleType||s[0]>0||0>=e.dataYDomain[0]||e.exactMode||null==e.userMin&&(s[0]=e.dataYDomain[0]/(1+e.extentPadding)),s}(l,{exactMode:u,extentPadding:e.extentPadding,userMin:e.yExtent?.[0],userMax:e.yExtent?.[1],yScaleType:e.yScaleType,dataYDomain:r}));l=function(t,e,i){if(!e||i)return t;const o=e[0],s=e[1];return null==o&&null==s?t:[null!=o?o:t[0],null!=s?s:t[1]]}(l,e.yExtent,!!c),({xDomain:a,yDomain:l}=function(t,e,i){let o=t,s=e;if(o[0]===1/0||o[1]===-1/0)if("time"===i){const t=Date.now();o=[t-864e5,t]}else o=[0,1];return s[0]!==1/0&&s[1]!==-1/0||(s=[0,1]),{xDomain:o,yDomain:s}}(a,l,e.xScaleType)),this.scales=function(t){const{config:e,layout:i,xDomain:o,yDomain:s}=t,n="streaming"===e.runtimeMode,r=Math.max(0,Math.min(e.scalePadding||0,Math.min(i.width,i.height)/2-1));if(n){if("x"==("up"===(a=e.arrowOfTime)||"down"===a?"y":"x")){const t="right"===e.arrowOfTime?[r,i.width-r]:[i.width-r,r];return{x:Xe().domain(o).range(t),y:je(e.yScaleType,s,[i.height-r,r])}}const t="down"===e.arrowOfTime?[r,i.height-r]:[i.height-r,r];return{x:je(e.yScaleType,s,[r,i.width-r]),y:Xe().domain(o).range(t)}}var a;return{x:je(e.xScaleType,o,[r,i.width-r]),y:je(e.yScaleType,s,[i.height-r,r])}}({config:e,layout:t,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const g=this.buildSceneNodes(t,n);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.lastLayout=s):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=g,this.config.decay&&this.applyDecay(this.scene,n),this.config.pulse&&this.applyPulse(this.scene,n,this.currentTime()),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:t.width,height:t.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(t){const e=t.width/this.lastLayout.width,i=t.height/this.lastLayout.height;for(const t of this.scene)switch(t.type){case"line":for(const o of t.path)o[0]*=e,o[1]*=i;break;case"area":for(const o of t.topPath)o[0]*=e,o[1]*=i;for(const o of t.bottomPath)o[0]*=e,o[1]*=i;t.clipRect&&(t.clipRect={x:t.clipRect.x*e,y:t.clipRect.y*i,width:t.clipRect.width*e,height:t.clipRect.height*i}),t.strokeColorBands&&(t.strokeColorBands=t.strokeColorBands.map(t=>({...t,y:t.y*i,height:t.height*i})));break;case"point":case"glyph":t.x*=e,t.y*=i;break;case"rect":case"heatcell":t.x*=e,t.y*=i,t.w*=e,t.h*=i;break;case"candlestick":t.x*=e,t.openY*=i,t.closeY*=i,t.highY*=i,t.lowY*=i}const o=this.scales.x.domain(),s=this.scales.y.domain(),n=this.scales.x.range(),r=this.scales.y.range(),a=je,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(t.width,t.height)/2-1)),c=r[1]>r[0];this.scales={x:a(this.config.xScaleType,o,n[0]>n[1]?[t.width-l,l]:[l,t.width-l]),y:a(this.config.yScaleType,s,c?[l,t.height-l]:[t.height-l,l])},this.lastLayout={width:t.width,height:t.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(t,e){const{config:i,scales:o}=this;if(!o)return[];if(i.customLayout){const s={data:e,scales:o,dimensions:{width:t.width,height:t.height,margin:i.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:i.themeSemantic??{},categorical:i.themeCategorical??Ct},resolveColor:(t,e)=>{const o=this.resolveGroupColor(t);if(o)return o;const s=this.resolveLineStyle(t,e);return s.stroke?s.stroke:"string"==typeof s.fill?s.fill:i.themeSemantic?.primary??"#4e79a7"},config:i.layoutConfig??{},selection:i.layoutSelection??null};let n;try{n=i.customLayout(s)}catch(t){const e=null!==this.lastCustomLayoutResult,o=K("xy",t,e,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",t);try{i.onLayoutError?.(o)}catch(t){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",t)}return e?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=n.overlays??null,this.lastCustomLayoutResult=n,this.lastCustomLayoutFailure=null;const r=n.nodes??[];if(this._customRestyle=n.restyle,this.hasCustomRestyle=!!n.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const t of r)t.style&&this._baseStyles.set(t,t.style);this.applyCustomRestyle(r,i.layoutSelection??null)}return ut({label:"customLayout",nodes:r,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),r}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===e.length)return[];const s={scales:o,config:i,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(t,e)=>this.resolveLineStyle(t,e),resolveAreaStyle:(t,e)=>this.resolveAreaStyle(t,e),resolveBoundsStyle:(t,e)=>this.resolveBoundsStyle(t,e),resolveColorMap:t=>this.resolveColorMap(t),resolveGroupColor:t=>this.resolveGroupColor(t),groupData:t=>this.groupData(t),barCategoryCache:this._barCategoryCache};switch(i.chartType){case"line":return function(t,e){const i=t.groupData(e),o=[],s=t.config.annotations?.filter(De).map(t=>({value:t.value,color:t.color,thresholdType:t.thresholdType||"greater"}));if(t.ribbons&&t.ribbons.length>0){const{perSeries:s,aggregate:n}=W(t.ribbons);if(n.length>0&&o.push(...S(t,e,n)),s.length>0)for(const e of i)o.push(...M(t,e.data,e.key,s))}for(const e of i){const i=t.resolveLineStyle(e.key,e.data[0]),n=h(e.data,t.scales,t.getX,t.getY,i,e.key);s&&s.length>0&&(n.colorThresholds=s),t.config.curve&&"linear"!==t.config.curve&&(n.curve=t.config.curve),t.config.lineGradient&&(n.strokeGradient=t.config.lineGradient),o.push(n)}return Oe(t,i,o),o}(s,e);case"area":return function(t,e){const i=t.groupData(e),o=[];if(t.ribbons&&t.ribbons.length>0){const{perSeries:s,aggregate:n}=W(t.ribbons);if(n.length>0&&o.push(...S(t,e,n)),s.length>0)for(const e of i)o.push(...M(t,e.data,e.key,s))}const s=t.scales.y.domain(),n=s[0],r=t.config.semanticLineStops?.filter(t=>Number.isFinite(t.offset)).map(t=>({value:s[0]+Math.max(0,Math.min(1,t.offset))*(s[1]-s[0]),color:t.color,thresholdType:"greater"})).sort((t,e)=>t.value-e.value),l=r&&r.length>0?(()=>{const e=r.reduce((t,e)=>(t.at(-1)?.value===e.value?t[t.length-1]=e:t.push(e),t),[]),i=[{from:s[0],to:e[0].value}];for(let t=0;e.length>t;t++)i.push({from:e[t].value,to:e[t+1]?.value??s[1],color:e[t].color});return i.map(({from:e,to:i,color:o})=>{const s=t.scales.y(e),n=t.scales.y(i);return{y:Math.min(s,n),height:Math.abs(n-s),color:o}}).filter(t=>t.height>0)})():void 0,c=t.getY0?e=>{const i=t.getY0(e);return null==i?n:i}:void 0;for(const e of i){const i=t.resolveAreaStyle(e.key,e.data[0]),s=a(e.data,t.scales,t.getX,t.getY,n,i,e.key,c),h=ze(t.config.gradientFill);h&&(s.fillGradient=h),t.config.curve&&"linear"!==t.config.curve&&(s.curve=t.config.curve),t.config.lineGradient&&(s.strokeGradient=t.config.lineGradient),r&&r.length>0&&(s.colorThresholds=r,s.strokeColorBands=l),o.push(s)}return Oe(t,i,o),o}(s,e);case"mixed":return function(t,e){const i=t.groupData(e),o=[],s=t.config.areaGroups||new Set;if(t.ribbons&&t.ribbons.length>0){const{perSeries:s,aggregate:n}=W(t.ribbons);if(n.length>0&&o.push(...S(t,e,n)),s.length>0)for(const e of i)o.push(...M(t,e.data,e.key,s))}const n=t.scales.y.domain()[0],r=t.getY0?e=>{const i=t.getY0(e);return null==i?n:i}:void 0;for(const e of i)if(s.has(e.key)){const i=t.resolveAreaStyle(e.key,e.data[0]),s=a(e.data,t.scales,t.getX,t.getY,n,i,e.key,r),l=ze(t.config.gradientFill);l&&(s.fillGradient=l),t.config.curve&&"linear"!==t.config.curve&&(s.curve=t.config.curve),t.config.lineGradient&&(s.strokeGradient=t.config.lineGradient),o.push(s)}else{const i=t.resolveLineStyle(e.key,e.data[0]),s=h(e.data,t.scales,t.getX,t.getY,i,e.key);t.config.curve&&"linear"!==t.config.curve&&(s.curve=t.config.curve),t.config.lineGradient&&(s.strokeGradient=t.config.lineGradient),o.push(s)}return Oe(t,i,o),o}(s,e);case"stackedarea":return function(t,e){const i=t.groupData(e),o=t.config.stackOrder??"key",s=()=>i.sort((t,e)=>e.key>t.key?-1:t.key>e.key?1:0);if("input"===o);else if("key"===o)s();else if("asc"===o||"desc"===o||"insideOut"===o){const e=new Map;for(const o of i){let i=0;for(const e of o.data){const o=t.getX(e),s=t.getY(e);Number.isFinite(o)&&Number.isFinite(s)&&(i+=s)}e.set(o.key,i)}const s=(t,e)=>e>t?-1:t>e?1:0;if("asc"===o)i.sort((t,i)=>{const o=(e.get(t.key)??0)-(e.get(i.key)??0);return 0!==o?o:s(t.key,i.key)});else if("desc"===o)i.sort((t,i)=>{const o=(e.get(i.key)??0)-(e.get(t.key)??0);return 0!==o?o:s(t.key,i.key)});else{const t=[...i].sort((t,i)=>{const o=(e.get(i.key)??0)-(e.get(t.key)??0);return 0!==o?o:s(t.key,i.key)}),o=[],n=[];let r=0,a=0;for(const i of t)a>r?(o.push(i),r+=e.get(i.key)??0):(n.push(i),a+=e.get(i.key)??0);i.length=0,i.push(...n.reverse(),...o)}}else s();const n=t.config.curve&&"linear"!==t.config.curve?t.config.curve:void 0,r=t.config.normalize?"zero":t.config.baseline??"zero",{nodes:a,stackedTops:l}=d(i,t.scales,t.getX,t.getY,(e,i)=>t.resolveAreaStyle(e,i),t.config.normalize,n,r),c=a;if(t.config.pointStyle){const e=new WeakMap;for(const o of i){const i=l.get(o.key);if(i)for(const s of o.data){const o=t.getX(s),n=t.getY(s);null==o||Number.isNaN(o)||null==n||Number.isNaN(n)||!i.has(o)||e.set(s,i.get(o))}}const o=i=>e.get(i)??t.getY(i);Oe(t,i,c,o)}return c}(s,e);case"scatter":case"bubble":return function(t,e){const i=[],o="bubble"===t.config.chartType?10:5,s=t.config.sizeRange||[3,15];let n=null;if(t.getSize&&!t.config.pointStyle){const i=e.map(e=>t.getSize(e)).filter(t=>null!=t&&!Number.isNaN(t));if(i.length>0){let t=1/0,e=-1/0;for(const o of i)t>o&&(t=o),o>e&&(e=o);n=i=>t===e?(s[0]+s[1])/2:s[0]+(i-t)/(e-t)*(s[1]-s[0])}}const r=t.getColor?t.resolveColorMap(e):null,a=t.config.themeSemantic?.primary||"#4e79a7",l=t.getSymbol,c=l?jt(l,t.config.symbolMap):null;for(const s of e){let e=t.config.pointStyle?t.config.pointStyle(s):{fill:a,opacity:.8},l=e.r||o;if(n&&t.getSize){const e=t.getSize(s);null==e||Number.isNaN(e)||(l=n(e))}if(r&&t.getColor&&!e.fill){const i=t.getColor(s);i&&r.has(i)&&(e={...e,fill:r.get(i)})}const h=t.getPointId?t.getPointId(s)+"":void 0;if(c){const o=c(s),n=f(s,t.scales,t.getX,t.getY,Math.PI*l*l,o,e,h);n&&i.push(n)}else{const o=u(s,t.scales,t.getX,t.getY,l,e,h);o&&i.push(o)}}return i}(s,e);case"heatmap":return function(t,e,i){if(t.config.heatmapAggregation)return function(t,e,i){const o=Math.max(1,Math.floor(t.config.heatmapXBins??20)),s=Math.max(1,Math.floor(t.config.heatmapYBins??20)),n=t.config.heatmapAggregation??"count",r=ft(t.config.valueAccessor,"value");if(!t.scales||0===e.length)return[];const[a,l]=t.scales.x.domain(),[h,u]=t.scales.y.domain(),g=(l-a||1)/o,d=(u-h||1)/s,f=o*s;if(f>1e6)return[];const p=new Int32Array(f),y=new Float64Array(f);for(let i=0;e.length>i;i++){const n=e[i],l=t.getX(n),c=t.getY(n);if(!isFinite(l)||!isFinite(c))continue;const u=Math.min(Math.floor((l-a)/g),o-1),f=Math.min(Math.floor((c-h)/d),s-1);if(0>u||0>f)continue;const m=f*o+u;p[m]++;const x=r(n);y[m]+=isFinite(x)?x:0}let m=1/0,x=-1/0;for(let t=0;f>t;t++){if(0===p[t])continue;let e;switch(n){case"sum":e=y[t];break;case"mean":e=y[t]/p[t];break;default:e=p[t]}m>e&&(m=e),e>x&&(x=e)}if(!isFinite(m))return[];const v=x-m||1,b=i.width/o,k=i.height/s,w=t.config.showValues,A=t.config.heatmapValueFormat,C=[];for(let e=0;s>e;e++){const i=e*o;for(let r=0;o>r;r++){const o=i+r;if(0===p[o])continue;let l;switch(n){case"sum":l=y[o];break;case"mean":l=y[o]/p[o];break;default:l=p[o]}const u=(l-m)/v,f={xi:r,yi:e,value:l,count:p[o],sum:y[o],xCenter:a+(r+.5)*g,yCenter:h+(e+.5)*d,agg:n};C.push(Le(c(r*b,(s-1-e)*k,b,k,`rgb(${220-(180*u+.5)|0},${220-(100*u+.5)|0},${255-(50*u+.5)|0})`,f,w?{value:l,showValues:!0,valueFormat:A}:void 0),f,t))}}return C}(t,e,i);if(0===e.length)return[];const o=ft(t.config.valueAccessor,"value"),s=pt(t.config.xAccessor,"x"),n=pt(t.config.yAccessor,"y"),r=new Map,a=new Map,l=Array(e.length),h=Array(e.length);for(let t=0;e.length>t;t++){const i=e[t],o=s(i),c=n(i);l[t]=o,h[t]=c,r.has(o)||r.set(o,r.size),a.has(c)||a.set(c,a.size)}const u=r.size,g=a.size;if(0===u||0===g)return[];const d=Array.from(r.keys()),f=Array.from(a.keys()),p=d.every(t=>"number"==typeof t&&!isNaN(t)),y=f.every(t=>"number"==typeof t&&!isNaN(t));if(p){d.sort((t,e)=>Number(t)-Number(e)),r.clear();for(let t=0;d.length>t;t++)r.set(d[t],t)}if(y){f.sort((t,e)=>Number(t)-Number(e)),a.clear();for(let t=0;f.length>t;t++)a.set(f[t],t)}const m=new Float64Array(e.length),x=new Float64Array(e.length),v=Array(e.length),b=new Map;let k=0;for(let t=0;e.length>t;t++){const i=e[t],s=r.get(l[t]),n=a.get(h[t]);if(void 0===s||void 0===n)continue;const c=o(i),g=n*u+s,d=b.get(g);let f;void 0!==d?f=d:(f=k++,b.set(g,f)),m[f]=g,x[f]=c,v[f]=i}let w=1/0,A=-1/0;for(let t=0;k>t;t++){const e=x[t];isFinite(e)&&(w>e&&(w=e),e>A&&(A=e))}if(!isFinite(w)||!isFinite(A))return[];const C=function(t){const e=t in At?t:"blues";let i=Ee.get(e);if(i)return i;i=Array(256);const o=$t(e);for(let t=0;256>t;t++)i[t]=o(t/255);return Ee.set(e,i),i}("string"==typeof t.config.colorScheme?t.config.colorScheme:t.config.themeSequential||"blues"),_=255/(A-w||1),S=i.width/u,M=i.height/g,P=t.config.showValues,Y=t.config.heatmapValueFormat,R=[];for(let e=0;k>e;e++){const i=x[e];if(!isFinite(i))continue;const o=m[e],s=o%u,n=v[e];R.push(Le(c(s*S,(g-1-(o-s)/u)*M,S,M,C[Math.min((i-w)*_+.5|0,255)],n,P?{value:i,showValues:!0,valueFormat:Y}:void 0),n,t))}return R}(s,e,t);case"bar":{const t=function(t,e){if(!t.config.binSize)return{nodes:[],binBoundaries:[]};const i=Be(e,t.getX,t.getY,t.config.binSize,t.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let o=null;if(t.getCategory){const e=new Set;for(const t of i.values())for(const i of t.categories.keys())e.add(i);const s=t.config.barColors?Object.keys(t.config.barColors):[],n=new Set(s),r=Array.from(e).filter(t=>!n.has(t)).sort(),a=s.filter(t=>e.has(t)),l=a.join("\0")+""+r.join("\0");t.barCategoryCache&&t.barCategoryCache.key===l?o=t.barCategoryCache.order:(o=[...a,...r],t.barCategoryCache={key:l,order:o})}const s=[],n=t.scales,[r,a]=n.x.domain(),l=t.config.barStyle,c=t.config.themeSemantic?.primary,h=l?.gap,u="number"!=typeof h||0>h?1:h,d={};l?.stroke&&(d.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(d.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(d.opacity=l.opacity);for(const e of i.values()){const i=Math.max(e.start,r),h=Math.min(e.end,a);if(i>=h)continue;const f=n.x(i),p=n.x(h),y=Math.abs(p-f),m=y>u+1?u:0,x=Math.min(f,p)+m/2,v=Math.max(y-m,1);if(v>0)if(o&&e.categories.size>0){let i=0;for(const r of o){const o=e.categories.get(r)||0;if(0===o)continue;const a=n.y(i),h=n.y(i+o);s.push(g(x,Math.min(a,h),v,Math.abs(a-h),{fill:t.config.barColors?.[r]||l?.fill||c||"#4e79a7",...d},{binStart:e.start,binEnd:e.end,total:e.total,category:r,categoryValue:o},r)),i+=o}}else{const t=n.y(0),i=n.y(e.total);s.push(g(x,Math.min(t,i),v,Math.abs(t-i),{fill:l?.fill||c||"#007bff",...d},{binStart:e.start,binEnd:e.end,total:e.total}))}}const f=new Set;for(const t of i.values())f.add(t.start),f.add(t.end);return{nodes:s,binBoundaries:Array.from(f).sort((t,e)=>t-e)}}(s,e);return this._barCategoryCache=s.barCategoryCache??null,this._binBoundaries=t.binBoundaries,t.nodes}case"swarm":return function(t,e){const i=[],o=t.config.swarmStyle||{},s=o.radius??3,n=o.fill??t.config.themeSemantic?.primary??"#007bff",r=o.opacity??.7,a=o.stroke,l=o.strokeWidth;for(const o of e){const e=t.getX(o),c=t.getY(o);if(null==c||Number.isNaN(c))continue;const h=t.scales.x(e),u=t.scales.y(c);let g=n;if(t.getCategory){const e=t.getCategory(o);g=t.config.barColors?.[e]||g}const{r:d,...f}=t.config.pointStyle?.(o)??{},p={type:"point",x:h,y:u,r:d??s,style:{fill:g,opacity:r,stroke:a,strokeWidth:l,...f},datum:o};t.getPointId&&(p.pointId=t.getPointId(o)+""),i.push(p)}return i}(s,e);case"waterfall":return function(t,e,i){const o=[],s=t.scales,n=t.config.waterfallStyle,r=e.filter(e=>{const i=t.getY(e),o=t.getX(e);return null!=i&&!Number.isNaN(i)&&null!=o&&isFinite(o)});if(0===r.length)return o;const a=n?.positiveColor??t.config.themeSemantic?.success??"#28a745",l=n?.negativeColor??t.config.themeSemantic?.danger??"#dc3545",c=n?.gap??1,h=n?.stroke,u=n?.strokeWidth,d=n?.opacity;let f=0;for(let e=0;r.length>e;e++){const p=r[e],y=t.getX(p),m=t.getY(p),x=f+m;let v;v=r.length-1>e?t.getX(r[e+1])-y:e>0?y-t.getX(r[e-1]):0;const b=s.x(y),k=0!==v?s.x(y+v):b+i.width/10,w=Math.min(b,k)+c/2,A=Math.max(b,k)-c/2-w;if(0>=A){f=x;continue}const C=s.y(f),_=s.y(x),S=Math.min(C,_),M=Math.abs(C-_),P={fill:0>m?l:a,stroke:h,strokeWidth:u};null!=d&&(P.opacity=d),o.push(g(w,S,A,M,P,{...p,baseline:f,cumEnd:x,delta:m,_connectorStroke:n?.connectorStroke,_connectorWidth:n?.connectorWidth})),f=x}return o}(s,e,t);case"candlestick":return function(t,e,i){if(!t.getHigh||!t.getLow||!t.scales)return[];const o=t.config.candlestickRangeMode??!1;if(!(o||t.getOpen&&t.getClose))return[];const s=[],n=t.config.candlestickStyle||{},r=n.rangeColor||"#6366f1",a=o?r:n.upColor||"#28a745",l=o?r:n.downColor||"#dc3545",c=o?r:n.wickColor||"#333",h=n.wickWidth||(o?2:1),u=e.map(e=>t.getX(e)).filter(t=>null!=t&&!Number.isNaN(t)).sort((t,e)=>t-e);let g=n.bodyWidth??0;if(null==n.bodyWidth)if(u.length>1){let e=1/0;for(let i=1;u.length>i;i++){const o=Math.abs(t.scales.x(u[i])-t.scales.x(u[i-1]));o>0&&e>o&&(e=o)}g=e!==1/0?Math.max(2,Math.min(.6*e,20)):6}else g=6;for(const n of e){const e=t.getX(n);if(null==e||Number.isNaN(e))continue;const r=t.getHigh(n),u=t.getLow(n);if(null==r||Number.isNaN(r)||null==u||Number.isNaN(u))continue;const d=o?r:t.getOpen(n),f=o?u:t.getClose(n);if(!o&&[d,f].some(t=>null==t||Number.isNaN(t)))continue;const p=f>=d,y={type:"candlestick",x:t.scales.x(e),openY:t.scales.y(d),closeY:t.scales.y(f),highY:t.scales.y(r),lowY:t.scales.y(u),bodyWidth:g,upColor:a,downColor:l,wickColor:c,wickWidth:h,isUp:p,datum:n};o&&(y.isRange=!0,y.dotRadius=Math.max(2,Math.min(g/2,.12*i.height))),s.push(y)}return s}(s,e,t);default:return[]}}resolveBoundsStyle(t,e){return function(t,e,i,o){const s=t.boundsStyle;return"function"==typeof s?s(i||{},e):s&&"object"==typeof s?s:{fill:o(e,i).stroke||t.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,t,e,(t,e)=>this.resolveLineStyle(t,e))}computeDecayOpacity(t,e){const i=this.config.decay;return i&&e>1?U(i,t,e):1}getDatumIndexMap(t){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const e=j(t);return this._datumIndexCache={version:this._ingestVersion,map:e},e}applyDecay(t,e){this.config.decay&&G(this.config.decay,t,e,this.getDatumIndexMap(e))}refreshPulse(t){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),t)}hasActivePulsesAt(t){return!!this.config.pulse&&N(this.config.pulse,this.timestampBuffer,t)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(t,e,i,o){i.clear(),o.clear();for(let s=0;e.length>s;s++){const n=e[s],r=Ne(t,n,s);r&&("point"===n.type?i.set(r,{x:n.x,y:n.y,r:n.r,opacity:We(n.style)}):"glyph"===n.type?i.set(r,{x:n.x,y:n.y,r:n.size,opacity:We(n.style),glyph:n.glyph}):"rect"===n.type||"heatcell"===n.type?i.set(r,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:We(n.style)}):"candlestick"===n.type?i.set(r,{x:n.x,y:n.openY,w:n.bodyWidth,openY:n.openY,closeY:n.closeY,highY:n.highY,lowY:n.lowY,opacity:We(n.style)}):"line"===n.type?o.set(r,{path:n.path.map(t=>[t[0],t[1]]),opacity:n.style?.opacity}):"area"===n.type&&o.set(r,{topPath:n.topPath.map(t=>[t[0],t[1]]),bottomPath:n.bottomPath.map(t=>[t[0],t[1]]),opacity:n.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const t=this.scales?.y(0)??0;for(let e=0;this.scene.length>e;e++){const i=this.scene[e],o=Ne(this.transitionContext,i,e);o&&("point"===i.type?this.prevPositionMap.set(o,{x:i.x,y:i.y,r:0,opacity:0}):"rect"===i.type?this.prevPositionMap.set(o,{x:i.x,y:t,w:i.w,h:0,opacity:i.style.opacity??1}):"heatcell"===i.type?this.prevPositionMap.set(o,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:0}):"line"===i.type?(i._introClipFraction=0,this.prevPathMap.set(o,{path:i.path.map(t=>[t[0],t[1]]),opacity:i.style.opacity})):"area"===i.type&&(i._introClipFraction=0,this.prevPathMap.set(o,{topPath:i.topPath.map(t=>[t[0],t[1]]),bottomPath:i.bottomPath.map(t=>[t[0],t[1]]),opacity:i.style.opacity})))}}startTransition(){if(!this.config.transition)return;const t=function(t,e,i,o,s,n=qt()){if(0===o.size&&0===s.size)return i;const r=e.duration??300;if(i.exitNodes.length>0){const t=new Set(i.exitNodes);i.scene=i.scene.filter(e=>!t.has(e)),i.exitNodes=[]}let a=!1;const l=new Set,c=new Set;for(let e=0;i.scene.length>e;e++){const n=i.scene[e],r=Ne(t,n,e);if(!r)continue;if(n._transitionKey=r,"line"===n.type||"area"===n.type){const t=s.get(r);if(t){if(c.add(r),"line"===n.type&&t.path&&t.path.length===n.path.length){n._targetPath=n.path.map(t=>[t[0],t[1]]),n._prevPath=t.path;for(let e=0;n.path.length>e;e++)n.path[e]=[t.path[e][0],t.path[e][1]];a=!0}else if("area"===n.type&&t.topPath&&t.bottomPath&&t.topPath.length===n.topPath.length&&t.bottomPath.length===n.bottomPath.length){n._targetTopPath=n.topPath.map(t=>[t[0],t[1]]),n._targetBottomPath=n.bottomPath.map(t=>[t[0],t[1]]),n._prevTopPath=t.topPath,n._prevBottomPath=t.bottomPath;for(let e=0;n.topPath.length>e;e++)n.topPath[e]=[t.topPath[e][0],t.topPath[e][1]];for(let e=0;n.bottomPath.length>e;e++)n.bottomPath[e]=[t.bottomPath[e][0],t.bottomPath[e][1]];a=!0}n._targetOpacity=n.style.opacity??1,n._startOpacity=t.opacity??n.style.opacity??1}else n._targetOpacity=n.style.opacity??1,n._startOpacity=0,n.style={...n.style,opacity:0},a=!0;continue}const h=o.get(r);if("point"===n.type)if(h){l.add(r);const t={x:n.x,y:n.y,r:n.r};n._targetOpacity=We(n.style),h.x===t.x&&h.y===t.y&&h.r===t.r||(n._targetX=t.x,n._targetY=t.y,n._targetR=t.r,n.x=h.x,n.y=h.y,n.r=h.r??n.r,a=!0)}else n._targetOpacity=We(n.style),n.style={...n.style,opacity:0},a=!0;else if("glyph"===n.type)if(h){l.add(r);const t={x:n.x,y:n.y,size:n.size};n._targetOpacity=We(n.style),h.x===t.x&&h.y===t.y&&h.r===t.size||(n._targetX=t.x,n._targetY=t.y,n._targetR=t.size,n.x=h.x,n.y=h.y,n.size=h.r??n.size,a=!0)}else n._targetOpacity=We(n.style),n.style={...n.style,opacity:0},a=!0;else if("rect"===n.type)if(h){l.add(r);const t={x:n.x,y:n.y,w:n.w,h:n.h};n._targetOpacity=We(n.style),h.x===t.x&&h.y===t.y&&h.w===t.w&&h.h===t.h||(n._targetX=t.x,n._targetY=t.y,n._targetW=t.w,n._targetH=t.h,n.x=h.x,n.y=h.y,n.w=h.w??n.w,n.h=h.h??n.h,a=!0)}else n._targetOpacity=We(n.style),n.style={...n.style,opacity:0},a=!0;else if("heatcell"===n.type)if(h){l.add(r);const t={x:n.x,y:n.y,w:n.w,h:n.h};n._targetOpacity=We(n.style),h.x===t.x&&h.y===t.y&&h.w===t.w&&h.h===t.h||(n._targetX=t.x,n._targetY=t.y,n._targetW=t.w,n._targetH=t.h,n.x=h.x,n.y=h.y,n.w=h.w??n.w,n.h=h.h??n.h,a=!0)}else n._targetOpacity=We(n.style),n.style={...n.style||{},opacity:0},a=!0;else if("candlestick"===n.type)if(h&&null!=h.openY){l.add(r);const t={x:n.x,openY:n.openY,closeY:n.closeY,highY:n.highY,lowY:n.lowY};n._targetOpacity=We(n.style),(h.x!==t.x||h.openY!==t.openY||h.closeY!==t.closeY||h.highY!==t.highY||h.lowY!==t.lowY)&&(n._targetX=t.x,n._targetOpenY=t.openY,n._targetCloseY=t.closeY,n._targetHighY=t.highY,n._targetLowY=t.lowY,n.x=h.x,n.openY=h.openY,n.closeY=h.closeY??n.closeY,n.highY=h.highY??n.highY,n.lowY=h.lowY??n.lowY,a=!0)}else n._targetOpacity=We(n.style),n.style={...n.style||{},opacity:0},a=!0}for(const[t,e]of s)if(!c.has(t))if(t.startsWith("l:")&&e.path){const o={type:"line",path:e.path.map(t=>[t[0],t[1]]),group:t.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t,datum:null};i.exitNodes.push(o),a=!0}else if(t.startsWith("a:")&&e.topPath&&e.bottomPath){const o={type:"area",topPath:e.topPath.map(t=>[t[0],t[1]]),bottomPath:e.bottomPath.map(t=>[t[0],t[1]]),group:t.slice(2),style:{fill:"#999",opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t,datum:null};i.exitNodes.push(o),a=!0}for(const[t,e]of o)if(!l.has(t)){if(t.startsWith("p:"))i.exitNodes.push({type:"point",x:e.x,y:e.y,r:e.r??3,style:{opacity:e.opacity??1},datum:null,_targetOpacity:0,_transitionKey:t});else if(t.startsWith("g:")&&e.glyph)i.exitNodes.push({type:"glyph",x:e.x,y:e.y,size:e.r??12,glyph:e.glyph,color:"#999",accent:"#999",style:{opacity:e.opacity??1},datum:null,_targetOpacity:0,_transitionKey:t});else if(t.startsWith("r:"))i.exitNodes.push({type:"rect",x:e.x,y:e.y,w:e.w??0,h:e.h??0,style:{opacity:e.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:t});else if(t.startsWith("h:"))i.exitNodes.push({type:"heatcell",x:e.x,y:e.y,w:e.w??0,h:e.h??0,fill:"#999",datum:null,style:{opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t});else if(t.startsWith("c:")){const o=e.openY??e.y;i.exitNodes.push({type:"candlestick",x:e.x,openY:o,closeY:e.closeY??o,highY:e.highY??o,lowY:e.lowY??o,bodyWidth:e.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:e.opacity??1},_targetOpacity:0,_transitionKey:t})}a=!0}return i.exitNodes.length>0&&(i.scene=[...i.scene,...i.exitNodes]),a&&(i.activeTransition={startTime:n,duration:r}),i}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition}advanceTransition(t){if(!this.activeTransition||!this.config.transition)return!1;const e={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},i=function(t,e,i,o){if(!i.activeTransition)return!1;const s=zt(t,i.activeTransition),n=Dt(s,"linear"===e.easing?"linear":"ease-out-cubic");for(const t of i.scene){const e=t._transitionKey;if("point"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style.opacity=Ht(i?i.opacity??1:0,t._targetOpacity,n)}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=Ht(i.x,t._targetX,n),t.y=Ht(i.y,t._targetY,n),void 0!==t._targetR&&void 0!==i.r&&(t.r=Ht(i.r,t._targetR,n))}else if("glyph"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style.opacity=Ht(i?i.opacity??1:0,t._targetOpacity,n)}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=Ht(i.x,t._targetX,n),t.y=Ht(i.y,t._targetY,n),void 0!==t._targetR&&void 0!==i.r&&(t.size=Ht(i.r,t._targetR,n))}else if("rect"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style.opacity=Ht(i?i.opacity??1:0,t._targetOpacity,n)}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=Ht(i.x,t._targetX,n),t.y=Ht(i.y,t._targetY,n),void 0!==i.w&&(t.w=Ht(i.w,t._targetW,n)),void 0!==i.h&&(t.h=Ht(i.h,t._targetH,n))}else if("heatcell"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style={...t.style||{},opacity:Ht(i?i.opacity??1:0,t._targetOpacity,n)}}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=Ht(i.x,t._targetX,n),t.y=Ht(i.y,t._targetY,n),void 0!==i.w&&(t.w=Ht(i.w,t._targetW,n)),void 0!==i.h&&(t.h=Ht(i.h,t._targetH,n))}else if("candlestick"===t.type){if(void 0!==t._targetOpacity){const i=e?o.get(e):void 0;t.style={...t.style||{},opacity:Ht(i?i.opacity??1:0,t._targetOpacity,n)}}if(void 0===t._targetX)continue;if(!e)continue;const i=o.get(e);if(!i)continue;t.x=Ht(i.x,t._targetX,n),void 0!==i.openY&&(t.openY=Ht(i.openY,t._targetOpenY,n)),void 0!==i.closeY&&(t.closeY=Ht(i.closeY,t._targetCloseY,n)),void 0!==i.highY&&(t.highY=Ht(i.highY,t._targetHighY,n)),void 0!==i.lowY&&(t.lowY=Ht(i.lowY,t._targetLowY,n))}else if("line"===t.type){void 0!==t._targetOpacity&&(t.style={...t.style,opacity:Ht(t._startOpacity??0,t._targetOpacity,n)}),void 0!==t._introClipFraction&&(t._introClipFraction=n);const e=t._prevPath,i=t._targetPath;if(e&&i&&e.length===t.path.length)for(let o=0;t.path.length>o;o++)t.path[o][0]=Ht(e[o][0],i[o][0],n),t.path[o][1]=Ht(e[o][1],i[o][1],n)}else if("area"===t.type){void 0!==t._targetOpacity&&(t.style={...t.style,opacity:Ht(t._startOpacity??0,t._targetOpacity,n)}),void 0!==t._introClipFraction&&(t._introClipFraction=n);const e=t._prevTopPath,i=t._prevBottomPath,o=t._targetTopPath,s=t._targetBottomPath;if(e&&o&&e.length===t.topPath.length)for(let i=0;t.topPath.length>i;i++)t.topPath[i][0]=Ht(e[i][0],o[i][0],n),t.topPath[i][1]=Ht(e[i][1],o[i][1],n);if(i&&s&&i.length===t.bottomPath.length)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e][0]=Ht(i[e][0],s[e][0],n),t.bottomPath[e][1]=Ht(i[e][1],s[e][1],n)}}if(s>=1){for(const t of i.scene){if(void 0!==t._targetOpacity){const e=t._targetOpacity;t.style="line"===t.type||"area"===t.type?{...t.style,opacity:0===e?0:e}:{...t.style||{},opacity:0===e?0:e},t._targetOpacity=void 0}if("point"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.r=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0}else if("glyph"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,void 0!==t._targetR&&(t.size=t._targetR),t._targetX=void 0,t._targetY=void 0,t._targetR=void 0}else if("rect"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0}else if("heatcell"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,t.y=t._targetY,t.w=t._targetW,t.h=t._targetH,t._targetX=void 0,t._targetY=void 0,t._targetW=void 0,t._targetH=void 0}else if("candlestick"===t.type){if(void 0===t._targetX)continue;t.x=t._targetX,void 0!==t._targetOpenY&&(t.openY=t._targetOpenY),void 0!==t._targetCloseY&&(t.closeY=t._targetCloseY),void 0!==t._targetHighY&&(t.highY=t._targetHighY),void 0!==t._targetLowY&&(t.lowY=t._targetLowY),t._targetX=void 0,t._targetOpenY=void 0,t._targetCloseY=void 0,t._targetHighY=void 0,t._targetLowY=void 0}else if("line"===t.type){const e=t._targetPath;if(e)for(let i=0;t.path.length>i;i++)t.path[i]=e[i];t._prevPath=void 0,t._targetPath=void 0,t._introClipFraction=void 0}else if("area"===t.type){const e=t._targetTopPath,i=t._targetBottomPath;if(e)for(let i=0;t.topPath.length>i;i++)t.topPath[i]=e[i];if(i)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e]=i[e];t._prevTopPath=void 0,t._prevBottomPath=void 0,t._targetTopPath=void 0,t._targetBottomPath=void 0,t._introClipFraction=void 0}}if(i.exitNodes.length>0){const t=new Set(i.exitNodes);i.scene=i.scene.filter(e=>!t.has(e)),i.exitNodes=[]}return i.activeTransition=null,!1}return!0}(t,this.config.transition,e,this.prevPositionMap);return this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition,i}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null,k(this.scene),this.exitNodes=[]}groupData(t){const{result:e,cache:i}=function(t,e,i,o){if(o&&o.version===i&&o.group===e&&o.data===t)return{result:o.result,cache:o};let s;if(e){const i=new Map;for(const o of t){const t=e(o);i.has(t)||i.set(t,[]),i.get(t).push(o)}s=Array.from(i.entries()).map(([t,e])=>({key:t,data:e}))}else s=[{key:"_default",data:t}];return{result:s,cache:{version:i,group:e,data:t,result:s}}}(t,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=i,e}resolveColorMap(t){const{map:e,cache:i}=function(t,e,i,o,s){if(s&&s.version===o)return{map:s.map,cache:s};const n=new Set;if(e)for(const i of t){const t=e(i);t&&n.add(t)}const r=Array.from(n).sort(),a=r.join("\0");if(s&&s.key===a){const t={...s,version:o};return{map:t.map,cache:t}}const l=Array.isArray(i.colorScheme)?i.colorScheme:i.themeCategorical||Ct,c=new Map;for(let t=0;r.length>t;t++)c.set(r[t],l[t%l.length]);return{map:c,cache:{key:a,map:c,version:o}}}(t,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=i,e}resolveLineStyle(t,e){return function(t,e,i,o){const s=t.lineStyle;if("function"==typeof s){const t=s(i||{},e);if(t&&!t.stroke&&e){const i=o(e);if(i)return{...t,stroke:i}}return t}const n=t.themeSemantic?.primary;return s&&"object"==typeof s?{stroke:s.stroke||n||"#007bff",strokeWidth:s.strokeWidth||2,strokeDasharray:s.strokeDasharray,fill:s.fill,fillOpacity:s.fillOpacity,opacity:s.opacity}:{stroke:o(e)||n||"#007bff",strokeWidth:2}}(this.config,t,e,t=>this.resolveGroupColor(t))}resolveAreaStyle(t,e){return function(t,e,i,o){if(t.areaStyle){const s=t.areaStyle(i||{});if(s&&!s.fill&&e){const t=o(e);if(t)return{...s,fill:t,stroke:s.stroke||t}}return s}const s=t.lineStyle;if("function"==typeof s){const t=s(i||{},e);if(t&&!t.fill&&e){const i=o(e);if(i)return{...t,fill:i,stroke:t.stroke||i}}return t}const n=t.themeSemantic?.primary;if(s&&"object"==typeof s)return{fill:s.fill||s.stroke||n||"#4e79a7",fillOpacity:s.fillOpacity??.7,stroke:s.stroke||n||"#4e79a7",strokeWidth:s.strokeWidth||2};const r=o(e)||n||"#4e79a7";return{fill:r,fillOpacity:.7,stroke:r,strokeWidth:2}}(this.config,t,e,t=>this.resolveGroupColor(t))}resolveGroupColor(e){const{color:i,groupColorCounter:o}=function(t){const{group:e,colorMapCache:i,groupColorMap:o,groupColorMapCap:s,config:n}=t;let{groupColorCounter:r}=t;if(i){const t=i.map.get(e);if(t)return{color:t,groupColorCounter:r}}const a=o.get(e);if(a)return{color:a,groupColorCounter:r};const l=(Array.isArray(n.colorScheme)&&n.colorScheme.length>0?n.colorScheme:null)||(Array.isArray(n.themeCategorical)&&n.themeCategorical.length>0?n.themeCategorical:null)||Ct;if(0===l.length)return{color:null,groupColorCounter:r};const c=l[r%l.length];if(r++,o.set(e,c),o.size>s){const t=o.keys().next().value;void 0!==t&&o.delete(t)}return{color:c,groupColorCounter:r}}({group:e,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:t.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=o,i}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(t){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const e=A(t),i=this.getPointId,o=t=>e.has(i(t));P(this.buffer,this.timestampBuffer,o);const s=this.buffer.remove(o);if(0===s.length)return this.updateResults.recordNoop("remove"),s;for(const t of s)this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",s.length),s}update(t,e){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const i=A(t),o=this.getPointId,s=new Set;this.buffer.forEach((t,e)=>{i.has(o(t))&&s.add(e)});const n=this.buffer.update(t=>i.has(o(t)),e);if(0===n.length)return this.updateResults.recordNoop("update"),n;for(const t of n)this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t);return this.buffer.forEach((t,e)=>{s.has(e)&&(this.xExtent.push(this.getX(t)),this.pushDatumYExtent(t))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",n.length),n}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}applyCustomRestyle(t,e){const i=this._customRestyle;if(i)for(const o of t){const t=this._baseStyles.get(o)??o.style??{},s=i(o,e);o.style=s?{...t,...s}:t}}restyleScene(t){this._customRestyle?(this.applyCustomRestyle(this.scene,t),this.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(t){const e={...this.config},i=Object.keys(t).filter(i=>t[i]!==e[i]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in t&&t.windowSize!==e.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${e.windowSize} → ${t.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in t||"themeCategorical"in t||"colorAccessor"in t)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in t||"colorScheme"in t)&&(this._barCategoryCache=null),("normalize"in t||"extentPadding"in t||"xAccessor"in t||"yAccessor"in t||"timeAccessor"in t||"valueAccessor"in t||"boundsAccessor"in t||"band"in t||"y0Accessor"in t||"openAccessor"in t||"highAccessor"in t||"lowAccessor"in t||"closeAccessor"in t||"groupAccessor"in t||"categoryAccessor"in t||"chartType"in t||"runtimeMode"in t)&&(this._stackExtentCache=null);let o=!1,s=!1;Object.assign(this.config,t),"pulse"in t&&this.syncPulseTimestampBuffer();const n="chartType"in t&&t.chartType!==e.chartType||"runtimeMode"in t&&t.runtimeMode!==e.runtimeMode;if(n||"xAccessor"in t||"yAccessor"in t||"timeAccessor"in t||"valueAccessor"in t){const t=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,i=t&&this.config.valueAccessor||this.config.yAccessor,r=t&&e.valueAccessor||e.yAccessor,a=n||!dt(t&&this.config.timeAccessor||this.config.xAccessor,t&&e.timeAccessor||e.xAccessor),l=n||!dt(i,r);(a||l)&&(t?(this.getX=ft(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=ft(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=ft(this.config.xAccessor,"x"),this.getY=ft(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(t=>"bounds"===t.kind)&&(this.resolvedRibbons=Ie(this.config)),o=!0,s=!0)}if("groupAccessor"in t&&!dt(t.groupAccessor,e.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?yt(this.config.groupAccessor):void 0,o=!0),"categoryAccessor"in t&&!dt(t.categoryAccessor,e.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?yt(this.config.categoryAccessor):void 0,o=!0),"sizeAccessor"in t&&!dt(t.sizeAccessor,e.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?ft(this.config.sizeAccessor,"size"):void 0,o=!0),"symbolAccessor"in t&&!dt(t.symbolAccessor,e.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?yt(this.config.symbolAccessor):void 0,o=!0),"colorAccessor"in t&&!dt(t.colorAccessor,e.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?yt(this.config.colorAccessor):void 0,o=!0),"y0Accessor"in t&&!dt(t.y0Accessor,e.y0Accessor)&&(this.getY0=this.config.y0Accessor?ft(this.config.y0Accessor,"y0"):void 0,o=!0,s=!0),("boundsAccessor"in t&&!dt(t.boundsAccessor,e.boundsAccessor)||"band"in t&&t.band!==e.band||"boundsStyle"in t&&t.boundsStyle!==e.boundsStyle)&&(this.resolvedRibbons=Ie(this.config),o=!0,s=!0),"pointIdAccessor"in t&&!dt(t.pointIdAccessor,e.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?yt(this.config.pointIdAccessor):void 0,o=!0),"candlestick"===this.config.chartType&&(n||"openAccessor"in t&&!dt(t.openAccessor,e.openAccessor)||"closeAccessor"in t&&!dt(t.closeAccessor,e.closeAccessor)||"highAccessor"in t&&!dt(t.highAccessor,e.highAccessor)||"lowAccessor"in t&&!dt(t.lowAccessor,e.lowAccessor))){const t=null!=this.config.openAccessor,e=null!=this.config.closeAccessor;this.getOpen=t?ft(this.config.openAccessor,"open"):void 0,this.getHigh=ft(this.config.highAccessor,"high"),this.getLow=ft(this.config.lowAccessor,"low"),this.getClose=e?ft(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!e,o=!0,s=!0}if("accessorRevision"in t&&t.accessorRevision!==e.accessorRevision&&(o=!0,s=!0),!o){const i=Object.keys(t).filter(t=>!t.endsWith("Accessor")&&"timeAccessor"!==t&&"valueAccessor"!==t);for(const s of i)if(t[s]!==e[s]){o=!0;break}}o&&(s&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(i)}updateConfigWithResult(t){return this.updateConfig(t),this.updateResults.last}};ci.GROUP_COLOR_MAP_CAP=1e3;var hi=ci;H(hi);import{line as ui}from"d3-shape";var gi=new WeakMap;function di(t,e){const i=ee(e);if(!i)return t;const o=gi.get(t);if(o)return o;const s=function(t,e,i=8){if(!e||2>t.length)return t.map(([t,e])=>[t,e]);const o=[];let s=null;const n={moveTo(t,e){s=[t,e],o.push([t,e])},lineTo(t,e){s=[t,e],o.push([t,e])},bezierCurveTo(t,e,n,r,a,l){if(!s)return s=[a,l],void o.push([a,l]);const[c,h]=s;for(let s=1;i>=s;s++){const u=s/i,g=1-u;o.push([g*g*g*c+3*g*g*u*t+3*g*u*u*n+u*u*u*a,g*g*g*h+3*g*g*u*e+3*g*u*u*r+u*u*u*l])}s=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(t,e,i,n){s=[i,n],o.push([i,n])}};return ui().x(t=>t[0]).y(t=>t[1]).curve(e).context(n)(t),o}(t,i);return gi.set(t,s),s}function fi(t,e,i,o=30,s,n=0){let r=null;if(s){const t=Z(s,e,i,o,n);t&&(r={node:t.node,datum:t.node.datum,x:t.node.x,y:t.node.y,distance:t.distance})}for(const n of t){let t=null;switch(n.type){case"point":if(s)break;t=yi(n,e,i,o);break;case"symbol":t=mi(n,e,i,o);break;case"glyph":t=xi(n,e,i,o);break;case"line":t=vi(n,e,i,o);break;case"rect":if(null==n.datum)break;t=ki(n,e,i);break;case"heatcell":t=wi(n,e,i);break;case"area":if(!1===n.interactive)break;t=Ci(n,e,i);break;case"candlestick":t=Ai(n,e,i)}t&&o>t.distance&&(r&&t.distance>=r.distance||(r=t))}return r}function pi(t,e,i){if(0===t.length)return null;if(t[0][0]>e||e>t[t.length-1][0])return null;const o=_i(t,e);if(0>o)return null;if(Math.abs(t[o][0]-e)>i)return null;let s=o,n=o;o>0&&t[o][0]>=e?(s=o-1,n=o):t.length-1>o&&(s=o,n=o+1);const[r,a]=t[s],[l,c]=t[n];return l===r?a:a+Math.max(0,Math.min(1,(e-r)/(l-r)))*(c-a)}function yi(t,e,i,o=30){const s=e-t.x,n=i-t.y,r=Math.sqrt(s*s+n*n);return r>J(t.r,o)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:r}}function mi(t,e,i,o=30){const s=e-t.x,n=i-t.y,r=Math.sqrt(s*s+n*n);return r>J(se(t.size),o)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:r}}function xi(t,e,i,o=30){if(null==t.datum)return null;const s=fe(t.glyph,t.size),n=t.x+s.centerDx,r=t.y+s.centerDy,a=e-n,l=i-r,c=Math.sqrt(a*a+l*l);return c>J(s.radius,o)?null:{node:t,datum:t.datum,x:n,y:r,distance:c}}function vi(t,e,i,o=30){if(0===t.path.length)return null;const s=_i(t.path,e);if(0>s)return null;const[n,r]=t.path[s];let a;if(t.path.length>1){let o=1/0;const n=Math.max(0,s-1),r=Math.min(t.path.length-2,s);for(let s=n;r>=s;s++){const[n,r]=t.path[s],[a,l]=t.path[s+1],c=bi(e,i,n,r,a,l);o>c&&(o=c)}a=o}else{const t=e-n,o=i-r;a=Math.sqrt(t*t+o*o)}const l=t.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,o)?null:{node:t,datum:Array.isArray(t.datum)&&t.datum[s]?t.datum[s]:t.datum,x:n,y:r,distance:a}}function bi(t,e,i,o,s,n){const r=s-i,a=n-o,l=r*r+a*a;if(0===l)return Math.sqrt((t-i)**2+(e-o)**2);let c=((t-i)*r+(e-o)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((t-(i+c*r))**2+(e-(o+c*a))**2)}function ki(t,e,i){const o=tt(e,i,t);return o.hit?{node:t,datum:t.datum,x:o.cx,y:o.cy,distance:0}:null}function wi(t,e,i){const o=tt(e,i,t);return o.hit?{node:t,datum:t.datum,x:o.cx,y:o.cy,distance:0}:null}function Ai(t,e,i){const o=t.bodyWidth/2,s=Math.min(t.openY,t.closeY);if(!(t.x-o-3>e||e>t.x+o+3||t.highY-3>i||i>t.lowY+3)){const o=s+Math.max(Math.max(t.openY,t.closeY)-s,1)/2,n=e-t.x,r=i-o;return{node:t,datum:t.datum,x:t.x,y:o,distance:Math.sqrt(n*n+r*r)}}return null}function Ci(t,e,i){if(0===t.topPath.length)return null;const o=_i(t.topPath,e);if(0>o)return null;const[s,n]=t.topPath[o],r=e-s,a=i-n,l=Math.sqrt(r*r+a*a);return{node:t,datum:Array.isArray(t.datum)&&t.datum[o]?t.datum[o]:t.datum,x:s,y:n,distance:l}}function _i(t,e){if(0===t.length)return-1;let i=0,o=t.length-1;for(;o>i;){const s=i+o>>1;e>t[s][0]?i=s+1:o=s}return i>0&&Math.abs(t[i][0]-e)>=Math.abs(t[i-1][0]-e)?i-1:i}import{useMemo as Si,useRef as Mi,useEffect as Pi}from"react";import{useMemo as Yi}from"react";import{bin as Ri}from"d3-array";import{jsx as Ti,jsxs as Ni}from"react/jsx-runtime";function Wi(t){return"string"==typeof t?{type:t}:t}function Oi({orient:t,config:e,values:i,scale:o,size:s,length:n}){const r=function(t){return{type:t.type,bins:t.bins??20,fill:t.fill??"#4e79a7",fillOpacity:t.fillOpacity??.5,stroke:t.stroke??"none",strokeWidth:t.strokeWidth??1}}(e),a="top"===t||"bottom"===t,l=Yi(()=>{if(0===i.length)return null;const e=o.domain(),l=s-8;if("boxplot"===r.type){const e=function(t){const e=[...t].sort((t,e)=>t-e),i=e.length;if(0===i)return null;const o=e[Math.floor(.25*i)],s=e[Math.floor(.5*i)],n=e[Math.floor(.75*i)],r=n-o;return{q1:o,median:s,q3:n,whiskerLow:Math.max(e[0],o-1.5*r),whiskerHigh:Math.min(e[i-1],n+1.5*r)}}(i);if(!e)return null;const{q1:s,median:n,q3:c,whiskerLow:h,whiskerHigh:u}=e,g=Math.min(.5*l,20),d=(l-g)/2+4;if(a){const e=o(s),i=o(c),a=o(n),l=o(h),f=o(u),p="top"===t?-1:1,y=0;return Ni("g",{"data-testid":"marginal-boxplot-"+t,children:[Ti("line",{x1:l,y1:y+p*(d+g/2),x2:f,y2:y+p*(d+g/2),stroke:r.fill,strokeWidth:r.strokeWidth}),Ti("line",{x1:l,y1:y+p*d,x2:l,y2:y+p*(d+g),stroke:r.fill,strokeWidth:r.strokeWidth}),Ti("line",{x1:f,y1:y+p*d,x2:f,y2:y+p*(d+g),stroke:r.fill,strokeWidth:r.strokeWidth}),Ti("rect",{x:Math.min(e,i),y:"top"===t?y-d-g:y+d,width:Math.abs(i-e),height:g,fill:r.fill,fillOpacity:r.fillOpacity,stroke:"none"===r.stroke?r.fill:r.stroke,strokeWidth:r.strokeWidth}),Ti("line",{x1:a,y1:"top"===t?y-d-g:y+d,x2:a,y2:"top"===t?y-d:y+d+g,stroke:r.fill,strokeWidth:2})]})}{const e=o(s),i=o(c),a=o(n),l=o(h),f=o(u),p="left"===t?-1:1,y=0;return Ni("g",{"data-testid":"marginal-boxplot-"+t,children:[Ti("line",{x1:y+p*(d+g/2),y1:l,x2:y+p*(d+g/2),y2:f,stroke:r.fill,strokeWidth:r.strokeWidth}),Ti("line",{x1:y+p*d,y1:l,x2:y+p*(d+g),y2:l,stroke:r.fill,strokeWidth:r.strokeWidth}),Ti("line",{x1:y+p*d,y1:f,x2:y+p*(d+g),y2:f,stroke:r.fill,strokeWidth:r.strokeWidth}),Ti("rect",{x:"left"===t?y-d-g:y+d,y:Math.min(e,i),width:g,height:Math.abs(i-e),fill:r.fill,fillOpacity:r.fillOpacity,stroke:"none"===r.stroke?r.fill:r.stroke,strokeWidth:r.strokeWidth}),Ti("line",{x1:"left"===t?y-d-g:y+d,y1:a,x2:"left"===t?y-d:y+d+g,y2:a,stroke:r.fill,strokeWidth:2})]})}}const c=Ri().domain(e).thresholds(r.bins)(i);if(0===c.length)return null;const h=ge(c.map(t=>t.length));if(0===h)return null;if("histogram"===r.type)return Ti("g",{"data-testid":"marginal-histogram-"+t,children:c.map((e,i)=>{if(null==e.x0||null==e.x1)return null;const s=e.length/h*l;if(a){const n=o(e.x0),a=o(e.x1)-o(e.x0);return Ti("rect",{x:n,y:"top"===t?-4-s:4,width:Math.max(a,.5),height:s,fill:r.fill,fillOpacity:r.fillOpacity,stroke:r.stroke,strokeWidth:r.strokeWidth},i)}{const n=o(e.x0),a=o(e.x1)-o(e.x0);return Ti("rect",{x:"left"===t?-4-s:4,y:Math.min(n,n+a),width:s,height:Math.abs(a),fill:r.fill,fillOpacity:r.fillOpacity,stroke:r.stroke,strokeWidth:r.strokeWidth},i)}})});if("violin"===r.type){const e=l/2+4,i=[];for(const s of c){if(null==s.x0||null==s.x1)continue;const n=s.length/h*(l/2),r=o((s.x0+s.x1)/2);i.push(a?`${r},${"top"===t?-(e-n):e-n}`:`${"left"===t?-(e-n):e-n},${r}`)}for(let s=c.length-1;s>=0;s--){const n=c[s];if(null==n.x0||null==n.x1)continue;const r=n.length/h*(l/2),u=o((n.x0+n.x1)/2);i.push(a?`${u},${"top"===t?-(e+r):e+r}`:`${"left"===t?-(e+r):e+r},${u}`)}return Ti("g",{"data-testid":"marginal-violin-"+t,children:Ti("polygon",{points:i.join(" "),fill:r.fill,fillOpacity:r.fillOpacity,stroke:"none"===r.stroke?r.fill:r.stroke,strokeWidth:r.strokeWidth})})}if("ridgeline"===r.type){const e=[];if(a){const i=0,s=null!=c[0].x0?o(c[0].x0):0;e.push(`M${s},${i}`);for(const i of c){if(null==i.x0||null==i.x1)continue;const s=i.length/h*l,n=o((i.x0+i.x1)/2);e.push(`L${n},${"top"===t?-s-4:s+4}`)}const r=null!=c[c.length-1].x1?o(c[c.length-1].x1):n;e.push(`L${r},${i}`),e.push("Z")}else{const i=0,s=null!=c[0].x0?o(c[0].x0):0;e.push(`M${i},${s}`);for(const i of c){if(null==i.x0||null==i.x1)continue;const s=i.length/h*l,n=o((i.x0+i.x1)/2);e.push(`L${"left"===t?-s-4:s+4},${n}`)}const r=null!=c[c.length-1].x1?o(c[c.length-1].x1):n;e.push(`L${i},${r}`),e.push("Z")}return Ti("g",{"data-testid":"marginal-ridgeline-"+t,children:Ti("path",{d:e.join(" "),fill:r.fill,fillOpacity:r.fillOpacity,stroke:"none"===r.stroke?r.fill:r.stroke,strokeWidth:r.strokeWidth})})}return null},[i,o,r,s,n,t,a,4]);return l?Ti("g",{className:"marginal-"+t,"data-testid":"marginal-"+t,children:l}):null}function Di(t,e,i){if("edges"===t){if(e)return"start";if(i)return"end"}return"middle"}function zi(t,e,i){if("edges"===t){if(e)return"hanging";if(i)return"auto"}return"middle"}function Ei(t){if(0===t.length)return{min:null,max:null};let e=1/0,i=-1/0;for(const o of t)e>o.pixel&&(e=o.pixel),o.pixel>i&&(i=o.pixel);return{min:e,max:i}}function Li(t){if(t)return"dashed"===t?"6,4":"dotted"===t?"2,4":t}function Bi(t,e,i){if("left"===t||"right"===t){const o="left"===t?i:0,s="left"===t?-1:1,n=Math.ceil(e/8);let r="M0,"+o;for(let t=0;n>t;t++){const i=8*(t+1);r+=`L${Math.min(8*t+4,e)},${o+4*s}`,r+=`L${Math.min(i,e)},${o}`}return r}const o="bottom"===t?0:e,s="bottom"===t?1:-1,n=Math.ceil(i/8);let r=`M${o},0`;for(let t=0;n>t;t++){const e=8*(t+1);r+=`L${o+4*s},${Math.min(8*t+4,i)}`,r+=`L${o},${Math.min(e,i)}`}return r}import{Fragment as Fi,jsx as Ii,jsxs as Xi}from"react/jsx-runtime";function $i(t){const{width:e,height:i,totalWidth:o,totalHeight:s,margin:n,scales:r,showAxes:a,axes:l,showGrid:c,xFormat:h,yFormat:u,axisExtent:g}=t,d=Si(()=>{if(!r)return[];const t=l?.find(t=>"bottom"===t.orient),i=l?.find(t=>"top"===t.orient),o=t??i,s=o?.extent??g,n=o?.tickFormat||h||Vi,a=Math.max(2,Math.floor(e/70)),c=o?.ticks??5,u="exact"===s?Math.max(2,c):Math.min(c,a),d=o?.tickValues??w(r.x,u,s),f=d.map(t=>t.valueOf()),p=d.map((t,e)=>({value:t,pixel:r.x(t),label:n(t,e,f)})),y=p.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:"number"==typeof e.label?6.5*(e.label+"").length:60),0);return Gi(p,Math.max(55,y+8))},[r,l,h,e,g]),f=Si(()=>{if(!r)return[];const t=l?.find(t=>"left"===t.orient),e=t?.extent??g,o=t?.tickFormat||u||Vi,s=Math.max(2,Math.floor(i/30)),n=t?.ticks??5,a="exact"===e?Math.max(2,n):Math.min(n,s);return Gi((t?.tickValues??w(r.y,a,e)).map(t=>({value:t,pixel:r.y(t),label:o(t)})),22)},[r,l,u,i,g]),p=c&&r,y=a&&r;if(!p&&!y)return null;const m=l?.find(t=>"bottom"===t.orient),x=l?.find(t=>"left"===t.orient),v=y&&(!m||!1!==m.baseline),b=y&&(!x||!1!==x.baseline),k=m?.jaggedBase||!1,A=x?.jaggedBase||!1,C="var(--semiotic-border, #ccc)";return Ii("svg",{width:o,height:s,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:Xi("g",{transform:`translate(${n.left},${n.top})`,children:[p&&(()=>{const t=Li(l?.find(t=>"bottom"===t.orient)?.gridStyle),o=Li(l?.find(t=>"left"===t.orient)?.gridStyle),s=!1!==l?.find(t=>"bottom"===t.orient)?.grid,n=!1!==l?.find(t=>"left"===t.orient)?.grid;return Xi("g",{className:"stream-grid",children:[s&&d.map((e,o)=>Ii("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:t},"xgrid-"+o)),n&&f.map((t,i)=>Ii("line",{x1:0,y1:t.pixel,x2:e,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+i))]})})(),v&&!k&&Ii("line",{x1:0,y1:i,x2:e,y2:i,stroke:C,strokeWidth:1}),k&&Ii("path",{d:Bi("bottom",e,i),fill:"none",stroke:C,strokeWidth:1}),b&&!A&&Ii("line",{x1:0,y1:0,x2:0,y2:i,stroke:C,strokeWidth:1}),A&&Ii("path",{d:Bi("left",e,i),fill:"none",stroke:C,strokeWidth:1})]})})}function Vi(t,e,i){return t instanceof Date?`${t.toLocaleString("en",{month:"short"})} ${t.getDate()}`:"number"==typeof t?Math.round(100*t)/100+"":t+""}function Gi(t,e){if(2>=t.length)return t;const i=[t[0]];for(let o=1;t.length-1>o;o++)e>Math.abs(t[o].pixel-i[i.length-1].pixel)||i.push(t[o]);const o=t[t.length-1];return e>Math.abs(o.pixel-i[i.length-1].pixel)?i[i.length-1]=o:i.push(o),i}function Hi(t){const{width:e,height:i,totalWidth:o,totalHeight:s,margin:n,scales:r,showAxes:a,axes:l,xLabel:c,yLabel:h,yLabelRight:u,xFormat:g,yFormat:d,axisExtent:f,showGrid:p,title:y,legend:m,legendHoverBehavior:x,legendClickBehavior:v,legendHighlightedCategory:b,legendIsolatedCategories:k,legendPosition:A="right",legendLayout:C,foregroundGraphics:_,marginalGraphics:S,xValues:M,yValues:P,annotations:Y,onAnnotationActivate:R,onObservation:T,chartId:N,chartType:W,autoPlaceAnnotations:O,svgAnnotationRules:D,xAccessor:z,yAccessor:E,annotationData:L,pointNodes:B,curve:F,underlayRendered:I,canvasObscuresUnderlay:X=!0,linkedCrosshairName:$,linkedCrosshairSourceId:V,children:G}=t,H=re({onAnnotationActivate:R,onObservation:T,chartId:N,chartType:W}),j=ie(C),q=m&&"left"===A&&j>0?j:n.left,U=m&&"right"===A&&j>0?j:n.right,K=Si(()=>{if(!a||!r)return[];const t=l?.find(t=>"bottom"===t.orient),i=l?.find(t=>"top"===t.orient),o=t??i,s=o?.extent??f,n=o?.tickFormat||g||Vi,c=Math.max(2,Math.floor(e/70)),h=o?.ticks??5,u="exact"===s?Math.max(2,h):Math.min(h,c),d=o?.tickValues??w(r.x,u,s),p=d.map(t=>t.valueOf()),y=d.map((t,e)=>({value:t,pixel:r.x(t),label:n(t,e,p)})),m=y.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:"number"==typeof e.label?6.5*(e.label+"").length:60),0),x=o?.autoRotate?Math.max(20,Math.min(m+8,55)):Math.max(55,m+8);let v=Gi(y,x);if(v.length>1&&(v=v.filter((t,e)=>0===e||t.label+""!=v[e-1].label+"")),o?.includeMax&&v.length>0&&"exact"!==s&&!o?.tickValues){const t=r.x.domain()[1],e=r.x(t),i=v[v.length-1].pixel;if(Math.abs(e-i)>1){const o=n(t,v.length,p);x>e-i&&v.length>1&&(v=v.slice(0,-1)),v.push({value:t,pixel:e,label:o})}}return v},[a,r,l,g,e,f]),Z=Si(()=>{const t=l?.find(t=>"bottom"===t.orient);if(!t?.autoRotate||1>=K.length)return!1;const i=e/Math.max(K.length-1,1);return K.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:60),0)+8>i},[l,K,e]),J=Si(()=>{if(!a||!r)return[];const t=l?.find(t=>"left"===t.orient),e=t?.extent??f,o=t?.tickFormat||d||Vi,s=Math.max(2,Math.floor(i/30)),n=t?.ticks??5,c="exact"===e?Math.max(2,n):Math.min(n,s);let h=Gi((t?.tickValues??w(r.y,c,e)).map(t=>({value:t,pixel:r.y(t),label:o(t)})),22);if(h.length>1&&(h=h.filter((t,e)=>0===e||t.label+""!=h[e-1].label+"")),t?.includeMax&&h.length>0&&"exact"!==e&&!t?.tickValues){const t=r.y.domain()[1],e=r.y(t),i=h[h.length-1].pixel;if(Math.abs(e-i)>1){const s=o(t);22>Math.abs(e-i)&&h.length>1&&(h=h.slice(0,-1)),h.push({value:t,pixel:e,label:s})}}return h},[a,r,l,d,i,f]),Q=Si(()=>{if(!a||!r)return[];const t=l?.find(t=>"right"===t.orient);if(!t)return[];const e=t.extent??f,o=t.tickFormat||d||Vi,s=Math.max(2,Math.floor(i/30)),n=t.ticks??5;return Gi((t.tickValues??w(r.y,"exact"===e?Math.max(2,n):Math.min(n,s),e)).map(t=>({value:t,pixel:r.y(t),label:o(t)})),22)},[a,r,l,d,i,f]),tt=Mi(new Map),it=Mi(Y?.length??0),ot=Y?.length??0;it.current!==ot&&(it.current=ot,tt.current=new Map);const st=Si(()=>{if(!Y||0===Y.length)return null;const t=mt(Y),o=Et("xy",H),s={scales:r?{x:r.x,y:r.y,time:r.x,value:r.y}:null,timeAxis:"x",xAccessor:z,yAccessor:E,width:e,height:i,data:L,frameType:"xy",pointNodes:B,curve:F,stickyPositionCache:tt.current},n=O?Rt({annotations:t,context:s,..."object"==typeof O?O:{}}):t;return Zt(n,o,D,s)},[Y,O,D,e,i,z,E,L,r,B,F,H]),nt=ae($);return Pi(()=>{if(!nt?.locked||!$)return;const t=t=>{"Escape"===t.key&&ne($)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[nt?.locked,$]),a||y||m||_||S||st&&st.length>0||p||G||nt?Xi("svg",{role:"img",width:o,height:s,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[Ii("title",{children:"string"==typeof y?y:"XY Chart"}),Ii("desc",{children:"string"==typeof y?y+" (XY data visualization)":"XY data visualization"}),Xi("g",{transform:`translate(${n.left},${n.top})`,children:[p&&r&&(!I||X)&&(()=>{const t=Li(l?.find(t=>"bottom"===t.orient)?.gridStyle),o=Li(l?.find(t=>"left"===t.orient)?.gridStyle),s=!1!==l?.find(t=>"bottom"===t.orient)?.grid,n=!1!==l?.find(t=>"left"===t.orient)?.grid;return Xi("g",{className:"stream-grid",children:[s&&K.map((e,o)=>Ii("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:t},"xgrid-"+o)),n&&J.map((t,i)=>Ii("line",{x1:0,y1:t.pixel,x2:e,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+i))]})})(),a&&r&&(()=>{const t=l?.find(t=>"left"===t.orient),o=l?.find(t=>"bottom"===t.orient),s=!t||!1!==t.baseline,n=!o||!1!==o.baseline,r=t?.jaggedBase||!1,a=o?.jaggedBase||!1,g=o?.landmarkTicks,d=t?.landmarkTicks,f="var(--semiotic-border, #ccc)",p="var(--semiotic-text-secondary, var(--semiotic-text, #666))",y="var(--semiotic-text, #333)",m=Z,x={fontSize:"var(--semiotic-tick-font-size, 12px)"},v={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},b={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},k=o?.tickAnchor,w=t?.tickAnchor,A=Ei(K),C=Ei(J);return Xi("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[Xi("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!I||X)&&n&&!a&&Ii("line",{x1:0,y1:i,x2:e,y2:i,stroke:f,strokeWidth:1}),(!I||X)&&a&&Ii("path",{d:Bi("bottom",e,i),fill:"none",stroke:f,strokeWidth:1}),K.map((t,e)=>{const o=!!g&&("function"==typeof g?g(t.value,e):et(t.value,e>0?K[e-1].value:void 0));return Xi("g",{transform:`translate(${t.pixel},${i})`,children:[Ii("line",{y2:5,stroke:f,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Ii("text",{y:m?12:18,textAnchor:m?"end":Di(k,t.pixel===A.min,t.pixel===A.max),fontWeight:o?600:400,fill:p,fontSize:o?13:12,className:"semiotic-axis-tick",style:{userSelect:"none",...o?v:x},transform:m?"rotate(-45)":void 0,children:t.label}):Ii("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:Ii("div",{style:{textAlign:"center",userSelect:"none",...x},children:t.label})})]},"xtick-"+e)}),c&&Ii("text",{x:e/2,y:i+(m?58:40),textAnchor:"middle",fill:y,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...b},children:c})]}),Xi("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!I||X)&&s&&!r&&Ii("line",{x1:0,y1:0,x2:0,y2:i,stroke:f,strokeWidth:1}),(!I||X)&&r&&Ii("path",{d:Bi("left",e,i),fill:"none",stroke:f,strokeWidth:1}),J.map((t,e)=>{const i=!!d&&("function"==typeof d?d(t.value,e):et(t.value,e>0?J[e-1].value:void 0));return Xi("g",{transform:`translate(0,${t.pixel})`,children:[Ii("line",{x2:-5,stroke:f,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Ii("text",{x:-8,textAnchor:"end",dominantBaseline:zi(w,t.pixel===C.min,t.pixel===C.max),fontWeight:i?600:400,fill:p,fontSize:i?13:12,className:"semiotic-axis-tick",style:{userSelect:"none",...i?v:x},children:t.label}):Ii("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:Ii("div",{style:{textAlign:"right",userSelect:"none",...x},children:t.label})})]},"ytick-"+e)}),(()=>{const e=t?.label||h;return e?Ii("text",{x:15-q,y:i/2,textAnchor:"middle",fill:y,transform:`rotate(-90, ${15-q}, ${i/2})`,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...b},children:e}):null})()]}),(()=>{const t=l?.find(t=>"right"===t.orient);if(!t||0===Q.length)return null;const o=!1!==t.baseline,s=t.landmarkTicks,n=t.label||u,r=t.tickAnchor,a=Ei(Q);return Xi("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&Ii("line",{x1:e,y1:0,x2:e,y2:i,stroke:f,strokeWidth:1}),Q.map((t,i)=>{const o=!!s&&("function"==typeof s?s(t.value,i):et(t.value,i>0?Q[i-1].value:void 0));return Xi("g",{transform:`translate(${e},${t.pixel})`,children:[Ii("line",{x2:5,stroke:f,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?Ii("text",{x:8,textAnchor:"start",dominantBaseline:zi(r,t.pixel===a.min,t.pixel===a.max),fontWeight:o?600:400,fill:p,fontSize:o?13:12,className:"semiotic-axis-tick",style:{userSelect:"none",...o?v:x},children:t.label}):Ii("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:Ii("div",{style:{textAlign:"left",userSelect:"none",...x},children:t.label})})]},"ytick-r-"+i)}),n&&Ii("text",{x:e+U-15,y:i/2,textAnchor:"middle",fill:y,transform:`rotate(90, ${e+U-15}, ${i/2})`,fontSize:12,className:"semiotic-axis-label",style:{userSelect:"none",...b},children:n})]})})()]})})(),st,S&&r&&M&&P&&Xi(Fi,{children:[S.top&&Ii("g",{transform:"translate(0, 0)",children:Ii(Oi,{orient:"top",config:Wi(S.top),values:M,scale:r.x,size:n.top,length:e})}),S.bottom&&Ii("g",{transform:`translate(0, ${i})`,children:Ii(Oi,{orient:"bottom",config:Wi(S.bottom),values:M,scale:r.x,size:n.bottom,length:e})}),S.left&&Ii("g",{transform:"translate(0, 0)",children:Ii(Oi,{orient:"left",config:Wi(S.left),values:P,scale:r.y,size:n.left,length:i})}),S.right&&Ii("g",{transform:`translate(${e}, 0)`,children:Ii(Oi,{orient:"right",config:Wi(S.right),values:P,scale:r.y,size:n.right,length:i})})]}),_,nt&&nt.sourceId!==V&&r?.x&&(()=>{const t=r.x(nt.xValue);if(null==t||0>t||t>e)return null;const o=nt.locked;return Ii("line",{x1:t,y1:0,x2:t,y2:i,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),G]}),y&&"string"==typeof y?Ii("text",{x:o/2,y:Pt,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",fontSize:14,className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:y}):y?Ii("foreignObject",{x:0,y:0,width:o,height:n.top,children:y}):null,Jt({legend:m,totalWidth:o,totalHeight:s,margin:n,legendPosition:A,title:y,legendLayout:C,axisChrome:{hasAxis:!!a,hasAxisLabel:!!c,rotatedTicks:Z},legendHoverBehavior:x,legendClickBehavior:v,legendHighlightedCategory:b,legendIsolatedCategories:k})]}):null}var ji={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function qi(t,e){const i=t.trim();if(/^#[0-9a-f]{3}$/i.test(i)){const t=i[1],o=i[2],s=i[3];return`#${t}${t}${o}${o}${s}${s}${e}`}if(/^#[0-9a-f]{6}$/i.test(i))return`${i}${e}`;const o=i.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(e,16)/255).toFixed(3)})`:i}var Ui=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ki=3156e7;function Zi(t){const e=t[1]-t[0];return 864e5>e?t=>{const e=new Date(t);return`${(e.getUTCHours()+"").padStart(2,"0")}:${(e.getUTCMinutes()+"").padStart(2,"0")}`}:Ki>e?t=>{const e=new Date(t);return`${Ui[e.getUTCMonth()]} ${e.getUTCDate()}`}:5*Ki>e?t=>{const e=new Date(t);return`${Ui[e.getUTCMonth()]} ${e.getUTCFullYear()}`}:t=>new Date(t).getUTCFullYear()+""}function Ji(t){if(!t)return;const e=[];for(const i of t)if("point"===i.type)e.push(i);else if("symbol"===i.type)e.push({pointId:i.pointId,x:i.x,y:i.y,r:se(i.size)});else if("glyph"===i.type){const t=fe(i.glyph,i.size);e.push({pointId:i.pointId,x:i.x+t.centerDx,y:i.y+t.centerDy,r:t.radius})}return e}import{area as Qi,line as to}from"d3-shape";function eo(t,e){const i=ee(e.curve);if(!i||2>e.topPath.length||2>e.bottomPath.length){t.beginPath(),t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let i=1;e.topPath.length>i;i++)t.lineTo(e.topPath[i][0],e.topPath[i][1]);for(let i=e.bottomPath.length-1;i>=0;i--)t.lineTo(e.bottomPath[i][0],e.bottomPath[i][1]);t.closePath()}else{const o=Qi().x(t=>t[0]).y0((t,i)=>e.bottomPath[i][1]).y1(t=>t[1]).curve(i).context(t);t.beginPath(),o(e.topPath)}}function io(t,e){const i=ee(e.curve);if(t.beginPath(),i)to().x(t=>t[0]).y(t=>t[1]).curve(i).context(t)(e.topPath);else{t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let i=1;e.topPath.length>i;i++)t.lineTo(e.topPath[i][0],e.topPath[i][1])}}var oo=(t,e,i,o)=>{const s=e.filter(t=>"area"===t.type);for(const e of s){if(2>e.topPath.length)continue;let i=!1;e.clipRect&&(t.save(),t.beginPath(),t.rect(e.clipRect.x,e.clipRect.y,e.clipRect.width,e.clipRect.height),t.clip(),i=!0);const s=e._introClipFraction;void 0!==s&&1>s&&(t.save(),t.beginPath(),t.rect(0,0,o.width*s,o.height),t.clip());const n=te(t,e.style.fill,"#4e79a7"),r=e._decayOpacities,a=!(!e.colorThresholds?.length||!e.rawValues||e.rawValues.length!==e.topPath.length),l=!!e.strokeColorBands?.length;if(r&&r.length===e.topPath.length&&!a&&!l){const i=e.style.fillOpacity??.7;t.fillStyle=n;for(let o=0;e.topPath.length-1>o;o++)t.globalAlpha=.5*(r[o]+r[o+1])*i,t.beginPath(),t.moveTo(e.topPath[o][0],e.topPath[o][1]),t.lineTo(e.topPath[o+1][0],e.topPath[o+1][1]),t.lineTo(e.bottomPath[o+1][0],e.bottomPath[o+1][1]),t.lineTo(e.bottomPath[o][0],e.bottomPath[o][1]),t.closePath(),t.fill();if(e.style.stroke&&"none"!==e.style.stroke){t.strokeStyle=Qt(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]);for(let i=0;e.topPath.length-1>i;i++)t.globalAlpha=.5*(r[i]+r[i+1]),t.beginPath(),t.moveTo(e.topPath[i][0],e.topPath[i][1]),t.lineTo(e.topPath[i+1][0],e.topPath[i+1][1]),t.stroke()}t.globalAlpha=1;continue}const c=e.style.opacity??1;if(eo(t,e),e.fillGradient&&e.fillGradient.stops.length>=2&&e.fillGradient){let i=1/0;for(const t of e.topPath)i>t[1]&&(i=t[1]);let o=-1/0;for(const t of e.bottomPath)t[1]>o&&(o=t[1]);const s=Nt(t,e.fillGradient,"string"==typeof n?n:"#4e79a7",0,i,0,o);t.fillStyle=s||n,t.globalAlpha=c}else t.globalAlpha=(e.style.fillOpacity??.7)*c,t.fillStyle=n;if(t.fill(),e._pulseIntensity&&e._pulseIntensity>0&&(eo(t,e),ot(t,e)),e.style.stroke&&"none"!==e.style.stroke){t.globalAlpha=c;const i=Qt(t,e.style.stroke)||e.style.stroke,o=a||l||!e.strokeGradient||2>e.topPath.length?null:Nt(t,e.strokeGradient,i,e.topPath[0][0],0,e.topPath[e.topPath.length-1][0],0);if(t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]),l){let o=1/0,s=-1/0;for(const[t]of e.topPath)o=Math.min(o,t),s=Math.max(s,t);const n=t.lineWidth;for(const r of e.strokeColorBands){t.save(),t.beginPath(),t.rect(o-n,r.y,s-o+2*n,r.height),t.clip();const a=r.color??i;t.strokeStyle=Qt(t,a)||a,io(t,e),t.stroke(),t.restore()}}else if(a){const o=Wt(e.topPath,e.rawValues,e.colorThresholds,i);for(const e of o){t.beginPath(),t.strokeStyle=Qt(t,e.color)||e.color,t.moveTo(e.path[0][0],e.path[0][1]);for(let i=1;e.path.length>i;i++)t.lineTo(e.path[i][0],e.path[i][1]);t.stroke()}}else t.strokeStyle=o||i,io(t,e),t.stroke()}void 0!==s&&1>s&&t.restore(),i&&t.restore(),t.globalAlpha=1}};function so(t){const[e,i,o]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(t);return.299*e+.587*i+.114*o>128?"#000":"#fff"}function no(t){return Number.isInteger(t)?t+"":100>Math.abs(t)?1>Math.abs(t)?t.toPrecision(3):t.toFixed(1):t.toFixed(0)}var ro=(t,e,i,o)=>{const s=e.filter(t=>"heatcell"===t.type);t.save();try{for(const e of s){const i=e.style;null!=i?.opacity&&(t.globalAlpha=i.opacity),t.fillStyle=e.fill,t.fillRect(e.x,e.y,e.w,e.h);const o=Math.max(0,i?.strokeWidth??1);if(o>0&&(t.strokeStyle=Qt(t,i?.stroke??"var(--semiotic-surface, #fff)"),t.lineWidth=o,t.strokeRect(e.x,e.y,e.w,e.h)),st(t,e),t.globalAlpha=1,e.showValues&&null!=e.value){if(20>e.w||20>e.h)continue;const i=e.valueFormat?e.valueFormat(e.value):no(e.value),o=Math.max(10,Math.min(16,.3*Math.min(e.w,e.h))),s=e.x+e.w/2,n=e.y+e.h/2;t.fillStyle=so(e.fill),t.font=o+"px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(i,s,n)}}}finally{t.restore()}},ao=(t,e,i,o)=>{for(const i of e){if("candlestick"!==i.type)continue;const e=i;t.save();const s=(e._decayOpacity??1)*(e.style?.opacity??1);1!==s&&(t.globalAlpha=s);const n=Qt(t,e.wickColor)||e.wickColor,r=60>o.height,a=r?Math.max(e.wickWidth,2):e.wickWidth,l=()=>{t.beginPath(),t.moveTo(e.x,e.highY),t.lineTo(e.x,e.lowY),t.strokeStyle=n,t.lineWidth=a,t.stroke()};if(r||l(),e.isRange){const i=e.dotRadius??Math.max(2,Math.min(e.bodyWidth/2,.12*o.height));t.fillStyle=n,t.beginPath(),t.arc(e.x,e.highY,i,0,2*Math.PI),t.fill(),t.beginPath(),t.arc(e.x,e.lowY,i,0,2*Math.PI),t.fill()}else if(e.bodyWidth>0){const i=Math.min(e.openY,e.closeY),o=Math.abs(e.openY-e.closeY),s=e.isUp?e.upColor:e.downColor,n=Qt(t,s)||s;t.fillStyle=n,t.fillRect(e.x-e.bodyWidth/2,i,e.bodyWidth,Math.max(o,1)),t.strokeStyle=n,t.lineWidth=1,t.strokeRect(e.x-e.bodyWidth/2,i,e.bodyWidth,Math.max(o,1))}r&&l(),t.restore()}},lo={line:[oo,t,O],area:[oo,O],stackedarea:[oo,O],scatter:[O,$],bubble:[O,$],heatmap:[ro],bar:[r],swarm:[O],waterfall:[(t,e,i,o)=>{r(t,e,i,o);const s=e.filter(t=>"rect"===t.type);if(2>s.length)return;const n=s[0].datum,a=n?._connectorStroke;if(a){t.save(),t.strokeStyle=Qt(t,a)||a,t.lineWidth=n?._connectorWidth??1,t.setLineDash([]);for(let e=0;s.length-1>e;e++){const o=s[e],n=s[e+1],r=o.datum,a=n.datum;if(null==r?.cumEnd||null==a?.baseline)continue;const l=i.y(r.cumEnd),c=o.x+o.w,h=n.x;t.beginPath(),t.moveTo(c,l),t.lineTo(h,l),t.stroke()}t.restore()}}],candlestick:[ao],mixed:[oo,t,O],custom:[oo,r,ro,t,O,$,Q,ao]};import{jsx as co,jsxs as ho}from"react/jsx-runtime";function uo(t){return null==t?"":"number"==typeof t?Number.isInteger(t)?t+"":t.toFixed(2):t instanceof Date?t.toLocaleString():t+""}function go({hover:t}){const e=t.data??{},i=e.y??e.value,o=e.x??e.time;if(void 0===i&&void 0===o){const t=oe(e);if(null!=t.title||t.entries.length>0)return ho("div",{className:"semiotic-tooltip",style:Lt,children:[null!=t.title&&co("div",{style:{fontWeight:600,marginBottom:t.entries.length?2:0},children:t.title+""}),t.entries.map(t=>ho("div",{style:{opacity:.7,fontSize:11},children:[t.key,":"," ",co("span",{style:{fontWeight:600},children:uo(t.value)})]},t.key))]})}return ho("div",{className:"semiotic-tooltip",style:Lt,children:[co("div",{style:{fontWeight:600,marginBottom:2},children:uo(i)}),co("div",{style:{opacity:.7,fontSize:11},children:uo(o)})]})}go.ownsChrome=!0;import{jsx as fo,jsxs as po}from"react/jsx-runtime";var yo={top:20,right:20,bottom:30,left:40},mo=ji;function xo(t){if(t)return"x"===t.dimension?"pan-y":"y"===t.dimension?"pan-x":"none"}var vo=Se(_e(function(t,i){const{chartType:o,runtimeMode:n,data:r,chunkThreshold:a,chunkSize:c,xAccessor:h,yAccessor:u,accessorRevision:g,colorAccessor:d,sizeAccessor:f,symbolAccessor:p,symbolMap:y,groupAccessor:k,lineDataAccessor:w,curve:A,normalize:C,baseline:_,stackOrder:S,binSize:M,valueAccessor:P,arrowOfTime:Y="right",windowMode:T="sliding",windowSize:N=200,timeAccessor:W,xExtent:O,yExtent:D,extentPadding:$=.1,scalePadding:G,sizeRange:H,size:j=[500,300],responsiveWidth:U,responsiveHeight:K,margin:Z,className:J,background:Q,maxDevicePixelRatio:tt,renderMode:et,lineStyle:ot,pointStyle:st,areaStyle:ut,barStyle:dt,waterfallStyle:ft,swarmStyle:pt,barColors:yt,colorScheme:mt,boundsAccessor:At,boundsStyle:Ct,y0Accessor:Pt,band:Yt,gradientFill:Rt,lineGradient:Nt,semanticLineStops:Wt,areaGroups:Dt,openAccessor:zt,highAccessor:Et,lowAccessor:Lt,closeAccessor:$t,candlestickStyle:Ht,showAxes:jt=!0,axes:qt,xLabel:Zt,yLabel:Jt,yLabelRight:Qt,xFormat:te,yFormat:ee,axisExtent:ie,tickFormatTime:oe,tickFormatValue:se,hoverAnnotation:ne,tooltipContent:re,customHoverBehavior:ae,customClickBehavior:ge,onObservation:fe,annotationObservationCallback:_e,chartId:Se,enableHover:Me,hoverRadius:Pe=30,tooltipMode:Ye,annotations:Re,onAnnotationActivate:Ne,autoPlaceAnnotations:We,svgAnnotationRules:Oe,showGrid:De,legend:ze,legendHoverBehavior:Ee,legendClickBehavior:Le,legendHighlightedCategory:Be,legendIsolatedCategories:Fe,legendPosition:Ie,legendLayout:Xe,legendCategoryAccessor:$e,onCategoriesChange:Ve,backgroundGraphics:Ge,foregroundGraphics:He,canvasPreRenderers:je,svgPreRenderers:qe,title:Ue,categoryAccessor:Ke,brush:Ze,onBrush:Je,decay:Qe,pulse:ti,transition:ei,animate:ii,staleness:oi,frameScheduler:si,clock:ni,random:ri,seed:ai,paused:li=!1,suspendWhenHidden:ci=!0,heatmapAggregation:ui,heatmapXBins:gi,heatmapYBins:yi,showValues:mi,heatmapValueFormat:xi,marginalGraphics:vi,pointIdAccessor:bi,xScaleType:ki,yScaleType:wi,accessibleTable:Ai=!0,description:Ci,summary:Si,linkedCrosshairName:Mi,linkedCrosshairSourceId:Pi,customLayout:Yi,onLayoutError:Ri,layoutConfig:Ti,layoutSelection:Ni}=t,{customHoverBehavior:Wi,customClickBehavior:Oi,hasClickBehavior:Di}=L({customHoverBehavior:ae,customClickBehavior:ge,onObservation:fe,chartId:Se,chartType:"StreamXYFrame"}),zi=Ce().replace(/:/g,""),Ei=xe(!1),Li=xe({w:-1,h:-1}),Bi=xe(!1),Fi=le({sizeProp:j,responsiveWidth:U,responsiveHeight:K,userMargin:Z,marginDefault:yo,title:Ue,legend:ze,legendPosition:Ie,animate:ii,transitionProp:ei,frameScheduler:si,clock:ni,random:ri,seed:ai,paused:li,suspendWhenHidden:ci,themeDirtyRef:Ei}),Ii=pe(),Xi=ye(),{reducedMotionRef:Vi,responsiveRef:Gi,size:Ui,currentTheme:Ki,transition:Qi,introEnabled:to,tableId:eo,rafRef:io,renderFnRef:oo,scheduleRender:so,frameRuntime:no}=Fi;let ro=Fi.margin;if(vi){const t=60,e={...Fi.margin};vi.top&&t>e.top&&(e.top=t),vi.bottom&&t>e.bottom&&(e.bottom=t),vi.left&&t>e.left&&(e.left=t),vi.right&&t>e.right&&(e.right=t),ro=e}const ao=Ui[0]-ro.left-ro.right,co=Ui[1]-ro.top-ro.bottom,ho=(qt?.find(t=>"left"===t.orient)??qt?.find(t=>"right"===t.orient))?.extent??ie,uo=ke(()=>Bt(r),[r]),vo=ne??Me,[bo,ko]=ve(0),wo=xe(0),[Ao,Co]=ve(null),_o=b(He,Ui,ro,Ao),So=b(Ge,Ui,ro,Ao),Mo=xe(null),Po=xe(null),Yo=xe(void 0),[Ro,To]=ve(null),No=xe(mo.primary),Wo=xe(function(){let t=-1,e=ji;return{resolve(i){if(!i)return ji;const o=Ft();return o===t||(e=function(t){if(!t)return ji;const e=getComputedStyle(t),i=e.getPropertyValue("--semiotic-border").trim(),o=e.getPropertyValue("--semiotic-text-secondary").trim(),s=e.getPropertyValue("--semiotic-bg").trim(),n=e.getPropertyValue("--semiotic-primary").trim(),r=o||e.getPropertyValue("--text-secondary").trim(),a=e.getPropertyValue("--text-primary").trim(),l=i||e.getPropertyValue("--surface-3").trim(),c=s||e.getPropertyValue("--surface-0").trim();return r||a||i||n?{axisStroke:l||ji.axisStroke,tickText:r||ji.tickText,crosshair:r?qi(r,"66"):ji.crosshair,hoverFill:c?qi(c,"4D"):ji.hoverFill,hoverStroke:r?qi(r,"99"):ji.hoverStroke,pointRing:c||ji.pointRing,primary:n||ji.primary,background:c||ji.background}:ji}(i),t=o),e},invalidate(){t=-1}}}()),Oo=xe(!1),Do=he("StreamXYFrame"),[zo,Eo]=ve(!1),[Lo,Bo]=ve([]),[Fo,Io]=ve([]),Xo="streaming"===n||["bar","swarm","waterfall"].includes(o),$o=ke(()=>({chartType:o,runtimeMode:Xo?"streaming":"bounded",windowSize:N,windowMode:T,arrowOfTime:Xo?Y:"right",extentPadding:$,scalePadding:G,axisExtent:ie,yAxisExtent:ho,xAccessor:h,yAccessor:u,accessorRevision:g,timeAccessor:Xo?W:void 0,valueAccessor:P,colorAccessor:d,sizeAccessor:f,symbolAccessor:p,symbolMap:y,groupAccessor:k||(w?"_lineGroup":void 0),categoryAccessor:Ke,lineDataAccessor:w,xScaleType:ki,yScaleType:wi,xExtent:O,yExtent:D,sizeRange:H,binSize:M,normalize:C,baseline:_,stackOrder:S,boundsAccessor:At,boundsStyle:Ct,y0Accessor:Pt,band:Yt,gradientFill:x(Rt),areaGroups:Dt?new Set(Dt):void 0,lineGradient:m(Nt),semanticLineStops:Wt,openAccessor:zt,highAccessor:Et,lowAccessor:Lt,closeAccessor:$t,candlestickStyle:Ht,lineStyle:ot,pointStyle:st,areaStyle:ut,swarmStyle:pt,waterfallStyle:ft,colorScheme:mt,barColors:yt,barStyle:dt,annotations:Re,decay:Qe,pulse:ti,transition:Qi,introAnimation:to,staleness:oi,clock:no.now,heatmapAggregation:ui,heatmapXBins:gi,heatmapYBins:yi,showValues:mi,heatmapValueFormat:xi,pointIdAccessor:bi,curve:A,themeCategorical:Ki?.colors?.categorical,themeSemantic:de(Ki),themeSequential:Ki?.colors?.sequential,themeDiverging:Ki?.colors?.diverging,customLayout:Yi,onLayoutError:Ri,layoutConfig:Ti,layoutMargin:ro}),[o,Xo,N,T,Y,$,G,ie,ho,h,u,g,W,P,d,f,p,y,k,w,Ke,ki,wi,O,D,H,M,C,_,S,At,Ct,Pt,Yt,Rt,Dt,Nt,Wt,zt,Et,Lt,$t,Ht,ot,st,ut,pt,ft,mt,yt,dt,Re,Qe,ti,Qi,to,oi,no.now,ui,gi,yi,mi,xi,bi,A,Ki,Yi,Ri,Ti,ro]),Vo=ct($o),Go=xe(null);Go.current||(Go.current=new hi(Vo));const Ho=E(Go,$e,Ve,t=>t.getData());at(Go,Vo,Ei,so),lt(Go,Ni,Ei,so);const jo=xe(null);jo.current||(jo.current=new s(t=>{const e=Go.current;e&&e.ingest(t)&&(Ei.current=!0,so())},{chunkThreshold:a,chunkSize:c})),be(()=>{jo.current?.updateChunkOptions({chunkThreshold:a,chunkSize:c})},[a,c]);const qo=we(t=>{jo.current?.push(t)},[]),Uo=we(t=>{jo.current?.pushMany(t)},[]),Ko=we(()=>{jo.current?.clear(),Go.current?.clear(),Ei.current=!0,so()},[so]);Ae(i,()=>({push:qo,pushMany:Uo,remove:t=>{jo.current?.flush();const e=Go.current?.remove(t)??[];return e.length>0&&(Mo.current&&e.some(t=>t===Mo.current?.data)&&(Mo.current=null,To(null)),Ei.current=!0,so()),e},update:(t,e)=>{jo.current?.flush();const i=Go.current?.update(t,e)??[];return i.length>0&&(Ei.current=!0,so()),i},clear:Ko,getData:()=>(jo.current?.flush(),Go.current?.getData()??[]),getScales:()=>Go.current?.scales??null,getExtents:()=>Go.current?.getExtents()??null,getCustomLayout:()=>Go.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>Go.current?.lastCustomLayoutFailure??null}),[qo,Uo,Ko,so]),be(()=>{if(r){if(w&&uo.length>0&&"object"==typeof uo[0]&&null!==uo[0]){const t="string"==typeof w?w:"coordinates";if(Array.isArray(uo[0][t])){const e=[];for(const i of uo){const o=i[t];if(Array.isArray(o)){const t=i.label||i.id||i.key;if(null!=t)for(const i of o)e.push({...i,_lineGroup:t});else for(const t of o)e.push(t)}}return void jo.current?.setBoundedData(e)}}jo.current?.setBoundedData(uo)}},[r,uo,w]);const{canvasRef:Zo,interactionCanvasRef:Jo,resolutionDirtyRef:Qo}=ce(Fi,{storeRef:Go,dirtyRef:Ei,hydrated:Ii,wasHydratingFromSSR:Xi,cleanup:()=>jo.current?.clear(),maxDevicePixelRatio:tt,canvasPaintDependencies:[o,ao,co,jt,Q,Ge,ot,et,je,so]}),{hoverHandlerRef:ts,hoverLeaveRef:es,onPointerMove:is,onPointerLeave:os}=Fi;ts.current=t=>{if(!vo)return;const e=Zo.current;if(!e)return;const i=e.getBoundingClientRect(),s=t.clientX-i.left-ro.left,n=t.clientY-i.top-ro.top;if(0>s||s>ao||0>n||n>co)return void(Mo.current&&(Mo.current=null,Po.current=null,To(null),Wi?.(null),so()));const r=Go.current;if(!r||0===r.scene.length)return;const a=Xt(Pe,t.pointerType),l=fi(r.scene,s,n,a,r.quadtree,r.maxPointRadius),c="multi"===Ye,u=()=>{Mo.current&&(Mo.current=null,Po.current=null,To(null),Wi&&Wi(null),so())};if(!l&&!c)return void u();const g=c||!l?s:l.x,d=c||!l?n:l.y,f=l?.datum?R(l.datum,r.resolvedRibbons):{},p=r.scales?.x?.invert,y="function"==typeof p?p(g):void 0;let m=Tt(f,g,d,null!=y?{xValue:y,xPx:g}:void 0);if(c&&r.scene.length>0&&r.scales){const t=function(t,e,i=30){const o=[];for(const s of t)if("line"===s.type){const t=s;if(2>t.path.length)continue;const n=pi(di(t.path,t.curve),e,i);if(null===n)continue;const r=_i(t.path,e);o.push({node:s,datum:Array.isArray(t.datum)&&t.datum[r]?t.datum[r]:t.datum,x:t.path[r][0],y:n,group:t.group,color:t.style.stroke})}else if("area"===s.type){const t=s;if(!1===t.interactive)continue;if(2>t.topPath.length)continue;const n=di(t.topPath,t.curve),r=di(t.bottomPath,t.curve),a=pi(n,e,i);if(null===a)continue;const l=pi(r,e,i),c=_i(t.topPath,e);o.push({node:s,datum:Array.isArray(t.datum)&&t.datum[c]?t.datum[c]:t.datum,x:t.topPath[c][0],y:a,y0:l??void 0,group:t.group,color:"string"==typeof t.style.stroke?t.style.stroke:"string"==typeof t.style.fill?t.style.fill:void 0})}return o}(r.scene,g,Math.max(a,ao));if(t.length>0){const e=r.scales.y.invert,i=No.current,s=p?p(g):g;if(l)m.xValue=s,m.xPx=g;else{const t={xValue:s};"string"==typeof h&&(t[h]=s),m=Tt(t,g,d,{xValue:s,xPx:g})}m.allSeries=t.map(t=>{const s=e?e(t.y):t.y,n=null!=t.y0?e?e(t.y0):t.y0:void 0;return{group:t.group||"",value:"stackedarea"===o&&null!=n?s-n:s,valuePx:t.y,color:t.color||i,datum:R(t.datum,r.resolvedRibbons)}})}}l||m.allSeries?.length?(Mo.current=m,Po.current=l?.node??null,To(m),Wi?.(m),so()):u()},es.current=()=>{Mo.current&&(Mo.current=null,Po.current=null,To(null),Wi?.(null),so())};const ss=xe(()=>{});ss.current=t=>{if(Vt(t.target))return;if(!Oi)return;const e=Zo.current;if(!e)return;const i=e.getBoundingClientRect(),o=t.clientX-i.left-ro.left,s=t.clientY-i.top-ro.top;if(0>o||o>ao||0>s||s>co)return void Oi(null);const n=Go.current;if(!n||0===n.scene.length)return void Oi(null);const r=Xt(Pe,Yo.current),a=fi(n.scene,o,s,r,n.quadtree,n.maxPointRadius);if(!a)return void Oi(null);const l=a.datum||{},c=n.scales?.x?.invert,h="function"==typeof c?c(a.x):void 0;Oi(Tt(l,a.x,a.y,null!=h?{xValue:h,xPx:a.x}:void 0),{type:"activate",inputType:Ut(Yo.current)})};const ns=we(t=>ss.current(t),[]),{kbFocusIndexRef:rs,focusedNavPointRef:as,onKeyDown:ls}=B({storeRef:Go,hoverRef:Mo,hoveredNodeRef:Po,setHoverPoint:To,customHoverBehavior:Wi,customClickBehavior:Oi,scheduleRender:so}),cs=we(t=>{Yo.current=t.pointerType,rs.current=-1,as.current=null,is(t)},[as,rs,is]),hs=we(t=>{Yo.current="mouse",rs.current=-1,as.current=null,is({clientX:t.clientX,clientY:t.clientY,pointerType:"mouse"})},[as,rs,is]),us=we(t=>{Yo.current=t.pointerType},[]);oo.current=()=>{if(io.current=null,!no.isActive)return;const t=Zo.current,i=Jo.current;if(!t||!i)return;const s=Go.current;if(!s)return;const n=no.now(),r=s.advanceTransition(Vi.current?n+1e6:n),a=!Vi.current&&r,l=Li.current.w!==ao||Li.current.h!==co,c=Qo.current,g=Ei.current||r||l,d=s.consumeStylePaintPending();let f=!1;const p=s.getLastUpdateResult(),y=Do.current.beforeCompute(p,a);!g||a&&!l||(s.computeScene({width:ao,height:co}),Li.current={w:ao,h:co},f=!0,Ho()),Do.current.afterCompute(y,f,l);const m=z(s,n,f,Bi),x=It(tt),v=Wo.current.resolve(t);No.current=v.primary;const b=rt(oi,s.lastIngestTime>0?n-s.lastIngestTime:0),k=oi&&b.isStale;if(g||d||m.changed||c){const e=Kt(t,Ui,ro,x);if(e){if(e.clearRect(-ro.left,-ro.top,Ui[0],Ui[1]),oi&&1>b.alpha&&(e.globalAlpha=b.alpha),I(e,{background:Q,hasBackgroundGraphics:!!Ge,themeBackground:v.background,x:-ro.left,y:-ro.top,width:Ui[0],height:Ui[1]}),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,ao,co),e.clip()),je&&s.scales)for(const t of je)e.save(),t(e,s.scene,s.scales,{width:ao,height:co}),e.restore();const t=Yi?lo.custom:lo[o];it({context:e,nodes:s.scene,renderMode:et,pixelRatio:x,paintBuiltIn:i=>{if(t&&s.scales)for(const o of t)o(e,i,s.scales,{width:ao,height:co})}}),e.restore(),oi&&1>b.alpha&&(e.globalAlpha=1)}}const w=!!(vo&&Mo.current&&s.scales),A=!!(Po.current&&Array.isArray(ne)&&ne.some(t=>t&&"object"==typeof t&&"highlight"===t.type)),C=w||A;if(F(C,Oo.current)){const t=Kt(i,Ui,ro,x);if(t&&(t.clearRect(-ro.left,-ro.top,Ui[0],Ui[1]),w&&Mo.current&&function(t,i,o,s,n,r,a){if(!1===n.crosshair)return;const l=i.allSeries,c=l&&l.length>0,h=i.xPx??i.x;t.save();const u="object"==typeof n.crosshair?n.crosshair:{};if(t.strokeStyle=u.stroke||a.crosshair,t.lineWidth=u.strokeWidth||1,t.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),t.beginPath(),t.moveTo(c?h:i.x,0),t.lineTo(c?h:i.x,s),t.stroke(),c||(t.beginPath(),t.moveTo(0,i.y),t.lineTo(o,i.y),t.stroke()),t.restore(),c){t.lineWidth=2,t.strokeStyle=a.pointRing;for(const e of l)null!=e.valuePx&&(t.beginPath(),t.arc(h,e.valuePx,4,0,2*Math.PI),t.fillStyle=e.color||a.primary,t.fill(),t.stroke())}else{const o=n.pointColor||e(r)||a.primary;t.beginPath(),t.arc(i.x,i.y,4,0,2*Math.PI),t.fillStyle=o,t.fill(),t.strokeStyle=a.pointRing,t.lineWidth=2,t.stroke()}}(t,Mo.current,ao,co,"object"==typeof vo?vo:{},Po.current,v),A&&Po.current&&Array.isArray(ne))){const e=ne.find(t=>t&&"object"==typeof t&&"highlight"===t.type);e&&function(t,e,i,o,s){if(!i)return;const n="group"in i?i.group:void 0;if(void 0!==n)for(const i of e){if("line"!==i.type)continue;if(i.group!==n)continue;if(2>i.path.length)continue;const e="function"==typeof o.style?i.datum?o.style(i.datum):{}:o.style||{};t.save(),t.beginPath(),t.moveTo(i.path[0][0],i.path[0][1]);for(let e=1;i.path.length>e;e++)t.lineTo(i.path[e][0],i.path[e][1]);t.strokeStyle=e.stroke||i.style.stroke||s.primary,t.lineWidth=e.strokeWidth||(i.style.strokeWidth||2)+2,t.globalAlpha=e.opacity??1,t.stroke(),t.restore()}}(t,s.scene,Po.current,e,v)}Oo.current=C}g&&t&&t.setAttribute("aria-label",Ot(s.scene,o+" chart"));const _=Ei.current;if(Ei.current=_&&a&&!f,Qo.current=!1,_&&s.scales){const t=t=>"object"==typeof t&&null!==t&&"function"==typeof t.valueOf?t.valueOf():t;if((!Ao||t(Ao.x.domain()[0])!==t(s.scales.x.domain()[0])||t(Ao.x.domain()[1])!==t(s.scales.x.domain()[1])||t(Ao.y.domain()[0])!==t(s.scales.y.domain()[0])||t(Ao.y.domain()[1])!==t(s.scales.y.domain()[1])||Ao.x.range()[0]!==s.scales.x.range()[0]||Ao.x.range()[1]!==s.scales.x.range()[1]||Ao.y.range()[0]!==s.scales.y.range()[0]||Ao.y.range()[1]!==s.scales.y.range()[1])&&Co(s.scales),vi){const t=s.getData(),e="function"==typeof h?h:t=>t[h||"x"],i="function"==typeof u?u:t=>t[u||"y"];Bo(t.map(t=>e(t)).filter(t=>"number"==typeof t&&isFinite(t))),Io(t.map(t=>i(t)).filter(t=>"number"==typeof t&&isFinite(t)))}}!((Re&&Re.length>0||Yi)&&(f||a))||!f&&33>n-wo.current||(ko(t=>t+1),wo.current=n),oi?.showBadge&&Eo(!!k),(a||null!=s.activeTransition||m.pending)&&so()},ht(oi,Go,Ei,so,zo,Eo);const gs=ke(()=>{if(te||oe)return;const t=Go.current;return t?.xIsDate&&Ao?Zi(Ao.x.domain()):void 0},[te,oe,Ao]),ds=te||oe||gs,fs=vo&&Ro?re?re(Ro):fo(go,{hover:Ro}):null,ps=fs?fo(kt,{x:Ro.x,y:Ro.y,containerWidth:ao,containerHeight:co,margin:ro,className:"stream-frame-tooltip",children:fs}):null,ys=as.current,ms=fo(wt,{active:rs.current>=0,hoverPoint:Ro,margin:ro,size:Ui,shape:ys?.shape,width:ys?.w,height:ys?.h}),xs=v(h,W,"__semiotic_resolvedX","__semiotic_resolvedTime"),vs=v(u,P,"__semiotic_resolvedY","__semiotic_resolvedValue"),bs=xs.key,ks=vs.key,ws=l(xs,vs,Re&&Re.length>0||!1);if(Gt||!Ii&&Xi){const t=Go.current;t&&r&&(t.ingest({inserts:uo,bounded:!0}),t.computeScene({width:ao,height:co}));const e=t?.scene??[],i=t?.scales??null,o=b(He,Ui,ro,i),s=b(Ge,Ui,ro,i),n=ds||(()=>{if(t?.xIsDate&&i)return Zi(i.x.domain())})();return po("div",{ref:Gi,className:"stream-xy-frame"+(J?" "+J:""),role:"img","aria-label":Ci||("string"==typeof Ue?Ue:"XY chart"),style:{position:"relative",width:U?"100%":Ui[0],height:K?"100%":Ui[1]},children:[fo(St,{summary:Si}),po("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ui[0],height:Ui[1],style:{position:"absolute",left:0,top:0},children:[fo("g",{transform:`translate(${ro.left},${ro.top})`,children:s}),po("g",{transform:`translate(${ro.left},${ro.top})`,children:[Q&&fo("rect",{x:0,y:0,width:ao,height:co,fill:Q}),qe&&i&&qe.map((t,o)=>fo(me.Fragment,{children:t(e,i,{width:ao,height:co})},"svgpre-"+o)),e.map((t,e)=>nt({node:t,index:e,renderMode:et,fallback:()=>ue(t,e,zi)})).filter(Boolean)]})]}),fo(Hi,{width:ao,height:co,totalWidth:Ui[0],totalHeight:Ui[1],margin:ro,scales:i,showAxes:jt,axes:qt,xLabel:Zt,yLabel:Jt,yLabelRight:Qt,xFormat:n,yFormat:ee||se,axisExtent:ie,showGrid:De,title:Ue,legend:ze,legendHoverBehavior:Ee,legendClickBehavior:Le,legendHighlightedCategory:Be,legendIsolatedCategories:Fe,legendPosition:Ie,legendLayout:Xe,foregroundGraphics:q(o,gt(Go.current?.customLayoutOverlays,Ni??null)),marginalGraphics:vi,xValues:[],yValues:[],annotations:Re,onAnnotationActivate:Ne,onObservation:_e??fe,chartId:Se,chartType:"StreamXYFrame",autoPlaceAnnotations:We,svgAnnotationRules:Oe,annotationFrame:0,xAccessor:bs,yAccessor:ks,annotationData:ws(Go.current?.getData()),pointNodes:Ji(Go.current?.scene),curve:"string"==typeof A?A:void 0,linkedCrosshairName:Mi,linkedCrosshairSourceId:Pi})]})}return po("div",{ref:Gi,className:"stream-xy-frame"+(J?" "+J:""),role:"group","aria-label":Ci||("string"==typeof Ue?Ue:"XY chart"),tabIndex:0,style:{position:"relative",width:U?"100%":Ui[0],height:K?"100%":Ui[1],overflow:"visible",touchAction:xo(Ze)},onKeyDown:ls,children:["production"!==process.env.NODE_ENV&&Go.current&&fo(_t,{store:Go.current,diagnostics:Do.current}),Ai&&fo(Mt,{tableId:eo}),Ai&&fo(xt,{scene:Go.current?.scene??[],chartType:o+" chart",tableId:eo,chartTitle:"string"==typeof Ue?Ue:void 0}),fo(St,{summary:Si}),fo(vt,{hoverPoint:Ro}),po("div",{role:"img","aria-label":Ci||("string"==typeof Ue?Ue:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:vo?cs:void 0,onMouseMove:vo?hs:void 0,onPointerLeave:vo?os:void 0,onMouseLeave:vo?os:void 0,onPointerDown:vo||Di?us:void 0,onClick:Di?ns:void 0,children:[fo(bt,{size:Ui,margin:ro,children:So}),fo($i,{width:ao,height:co,totalWidth:Ui[0],totalHeight:Ui[1],margin:ro,scales:Ao,showAxes:jt,axes:qt,showGrid:De,xFormat:ds,yFormat:ee||se,axisExtent:ie}),fo("canvas",{ref:Zo,"aria-label":Ot(Go.current?.scene??[],o+" chart"),style:{position:"absolute",left:0,top:0}}),fo("canvas",{ref:Jo,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),fo(Hi,{width:ao,height:co,totalWidth:Ui[0],totalHeight:Ui[1],margin:ro,scales:Ao,showAxes:jt,axes:qt,xLabel:Zt,yLabel:Jt,yLabelRight:Qt,xFormat:ds,yFormat:ee||se,axisExtent:ie,showGrid:De,title:Ue,legend:ze,legendHoverBehavior:Ee,legendClickBehavior:Le,legendHighlightedCategory:Be,legendIsolatedCategories:Fe,legendPosition:Ie,legendLayout:Xe,foregroundGraphics:q(_o,gt(Go.current?.customLayoutOverlays,Ni??null)),marginalGraphics:vi,xValues:Lo,yValues:Fo,annotations:Re,onAnnotationActivate:Ne,onObservation:_e??fe,chartId:Se,chartType:"StreamXYFrame",autoPlaceAnnotations:We,svgAnnotationRules:Oe,annotationFrame:bo,xAccessor:bs,yAccessor:ks,annotationData:ws(Go.current?.getData()),pointNodes:Ji(Go.current?.scene),curve:"string"==typeof A?A:void 0,underlayRendered:!0,canvasObscuresUnderlay:!!X({background:Q,hasBackgroundGraphics:!!Ge,themeBackground:Ki?.colors.background}),linkedCrosshairName:Mi,linkedCrosshairSourceId:Pi}),(Ze||Je)&&fo(Te,{width:ao,height:co,totalWidth:Ui[0],totalHeight:Ui[1],margin:ro,dimension:Ze?.dimension??"xy",scales:Ao,onBrush:Je??(()=>{}),binSize:M,snap:Ze?.snap,binBoundaries:Ze?.binBoundaries??("bar"===o?Go.current?.getBinBoundaries():void 0),snapDuring:Ze?.snapDuring,streaming:"streaming"===n}),oi?.showBadge&&fo(V,{isStale:zo,position:oi.badgePosition}),ms,ps]})]})}));vo.displayName="StreamXYFrame";var bo=vo;export{bo as StreamXYFrame_default};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{useChartSetup as t,useCustomChartScaffold as e}from"./chunk-chunk-MXMRXSCI.module.min.js";import{lineCanvasRenderer as n,resolveNodeColor as i}from"./chunk-chunk-XECNOUZY.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-VKL6DI43.module.min.js";import{needsDataCanvasPaint as m,needsInteractionCanvasPaint as g,paintCanvasBackground as y}from"./chunk-chunk-DTH3SUOU.module.min.js";import{StalenessBadge as v,attachUpdateResultStore as b,buildBaseMetadataProps as w,buildCustomBehaviorProps as x,composeOverlays as P,computeDecayOpacity as R,createCustomLayoutFailureDiagnostic as S,findHitPointInQuadtree as L,formatVal as A,getHitRadius as k,glyphCanvasRenderer as C,paintSceneWithBackend as D,renderPathPulse as j,renderSceneWithBackend as M,useConfigSync as T,useLayoutSelectionSync as B,useStableShallow as _,useStalenessCheck as I,warnCustomLayoutDiagnostics as E}from"./chunk-chunk-DVCWU7MT.module.min.js";import{wrapWithCustomLayoutSelection as N}from"./chunk-chunk-5UKL5W76.module.min.js";import{filterAnnotationsByStatus as O}from"./chunk-chunk-XYZDTYAF.module.min.js";import{buildResolveColor as F,resolveCustomLayoutPalette as z}from"./chunk-chunk-OHLRAEQZ.module.min.js";import{AccessibleDataTable as W,AriaLiveTooltip as H,CanvasFrameBackground as G,FlippingTooltip as q,FocusRing as Z,STREAMING_PALETTE as X,SceneRevisionDiagnosticsObserver as Y,ScreenReaderSummary as U,SkipToTableLink as Q,TITLE_BASELINE as V,UpdateResultTracker as $,annotationLayout as K,coerceCanvasFill as J,computeCanvasAriaLabel as tt,computeEasing as et,computeRawProgress as nt,createDefaultAnnotationRules as it,defaultTooltipStyle as ot,filterSparseArray as rt,geoSceneNodeToSVG as st,getDevicePixelRatio as at,getPointerHitRadius as ct,isAnnotationActivationTarget as lt,isServerEnvironment as ut,lerp as ht,normalizeTooltip as dt,now as pt,observationInputType as ft,prepareCanvas as mt,renderAnnotationPass as gt,renderLegendFromConfig as yt,resolveCSSColor as vt,smartTooltipEntries as bt,useAnnotationActivationOptions as wt,useFrame as xt,useFrameCanvasHost as Pt,useSceneRevisionDiagnostics as Rt}from"./chunk-chunk-SK2TQMG4.module.min.js";import{getMax as St}from"./chunk-chunk-2NVFEB7P.module.min.js";import{resolveThemeSemanticColors as Lt}from"./chunk-chunk-PMR47KRY.module.min.js";import{glyphHitGeometry as At}from"./chunk-chunk-KTWEBFMX.module.min.js";import{SafeRender as kt,useHydration as Ct,useWasHydratingFromSSR as Dt}from"./chunk-chunk-ACLDBMRH.module.min.js";import{useRef as jt,useState as Mt,useEffect as Tt,useMemo as Bt,useCallback as _t,useImperativeHandle as It,forwardRef as Et,memo as Nt}from"react";import{geoPath as Ot}from"d3-geo";import{quadtree as Ft}from"d3-quadtree";import{geoMercator as zt,geoEqualEarth as Wt,geoAlbersUsa as Ht,geoOrthographic as Gt,geoNaturalEarth1 as qt,geoEquirectangular as Zt}from"d3-geo";var Xt={mercator:zt,equalEarth:Wt,albersUsa:Ht,orthographic:Gt,naturalEarth:qt,equirectangular:Zt};function Yt(t,e){return t?"function"==typeof t?t:e=>e[t]:t=>t[e]}function Ut(t){return t?"function"==typeof t?t:e=>e[t]:t=>t.coordinates||t.data||[]}function Qt(t,e,n){return t?"function"==typeof t?{...n,...t(e)}:{...n,...t}:{...n}}function Vt(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 Kt(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 Jt(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 te}from"d3-scale";var ee=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],ne=["scene-style","data-paint","accessibility","evidence"],ie=(t,e)=>({retainedData:t,invalidations:e}),oe=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],re=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],se=["scene-geometry","data-paint","accessibility","evidence"],ae=["scene-style","data-paint","accessibility","evidence"],ce=["overlay","accessibility","evidence"],le=[],ue={xAccessor:ie("rebuild",oe),yAccessor:ie("rebuild",oe),lineDataAccessor:ie("rebuild",oe),pointIdAccessor:ie("rebuild",se),lineIdAccessor:ie("rebuild",se),windowSize:ie("rebuild",oe),projection:ie("preserve",re),projectionExtent:ie("preserve",re),fitPadding:ie("preserve",re),lineType:ie("preserve",re),flowStyle:ie("preserve",re),graticule:ie("preserve",re),projectionTransform:ie("preserve",re),customLayout:ie("preserve",re),layoutConfig:ie("preserve",re),layoutMargin:ie("preserve",re),areaStyle:ie("preserve",ae),pointStyle:ie("preserve",["scene-geometry","scene-style","data-paint","accessibility","evidence"]),lineStyle:ie("preserve",ae),colorScheme:ie("preserve",ae),themeCategorical:ie("preserve",ae),themeDiverging:ie("preserve",ae),themeSemantic:ie("preserve",ae),themeSequential:ie("preserve",ae),decay:ie("preserve",ae),pulse:ie("preserve",ae),layoutSelection:ie("preserve",ae),annotations:ie("preserve",ce),autoPlaceAnnotations:ie("preserve",ce),clock:ie("preserve",le),transition:ie("preserve",le),introAnimation:ie("preserve",le),onLayoutError:ie("preserve",le)},he=ie("preserve",re),de=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}},ee)}recordNoop(t){return this.tracker.record({kind:t,..."restyle"===t?{}:{count:0}},[])}recordRestyle(t){return t?this.tracker.record({kind:"restyle"},ne):this.recordNoop("restyle")}recordConfig(t,e={}){const n=function(t){let e="preserve";const n=new Set;for(const i of t){const t=ue[i]??he;"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 pe,geoGraticule as fe,geoInterpolate as me}from"d3-geo";function ge(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 ye=class t{constructor(t){this.updateResults=new de,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:ge(t.fitPadding)}}(t)}currentTime(){return this.config.clock?.()??pt()}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:ge(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=Xt[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=Xt[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=Ot(this.projection),this.fitProjection(t),this.geoPath=Ot(this.projection);const l=this.projection;this.scales={projection:l,geoPath:this.geoPath,projectedPoint:(t,e)=>l([t,e]),invertedPoint:(t,e)=>l.invert?l.invert([t,e]):null},this._customLayoutFailedThisBuild=!1;const u=this.buildSceneNodes(t);if(this._customLayoutFailedThisBuild)!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.projection=n,this.geoPath=i,this.scales=o,this.baseScale=r,this.baseTranslate=s,this.baseRotation=a):(this.scene=[],this.rebuildQuadtree());else{if(this.scene=u,this.rebuildQuadtree(),e.projectionTransform&&this.applyCartogramTransform(e.projectionTransform,t),e.decay&&this.streaming&&this.applyDecay(),e.pulse&&this.streaming&&this.applyPulse(),e.transition&&!this._hasRenderedOnce&&this.scene.length>0&&e.introAnimation){const e=t.width/2,n=t.height/2,i=this.scene.filter(t=>"point"===t.type).map(t=>({...t,x:e,y:n}));i.length>0&&this.startTransition(i)}this._hasRenderedOnce=!0,e.transition&&c.length>0&&this.startTransition(c),this.version++}}fitProjection(t){const e=this.projection,n=this.config,i=[...this.areas],o=Yt(n.xAccessor,"lon"),r=Yt(n.yAccessor,"lat"),s=this.getPoints();if(s.length>0){const t=s.map(t=>[o(t),r(t)]);i.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:t}})}const a=Ut(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=Ot(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=Ot(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=Ot(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&&!1!==t.interactive&&(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&&!1!==t.interactive&&(i[o++]=t);this._quadtree=Ft().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=z(e.colorScheme,e.themeCategorical,X),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:F(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=S("geo",t,n,this.version);this.lastCustomLayoutFailure=i,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] geo customLayout threw:",t);try{e.onLayoutError?.(i)}catch(t){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",t)}return n?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}const s=r.nodes??[];if(this.customLayoutOverlays=r.overlays??null,this.lastCustomLayoutResult=r,this.lastCustomLayoutFailure=null,this._customRestyle=r.restyle,this.hasCustomRestyle=!!r.restyle,this._baseStyles=new WeakMap,this.hasCustomRestyle){for(const t of s)this._baseStyles.set(t,t.style);this.restyleScene(e.layoutSelection??null)}return E({label:"geo customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}return this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,function({config:t,projection:e,path:n,areas:i,points:o,lines:r,layout:s}){const a=Yt(t.xAccessor,"lon"),c=Yt(t.yAccessor,"lat"),l=[],u=function(t){return{fill:t.themeSemantic?.surface||"#e0e0e0",stroke:t.themeSemantic?.border||"#999",strokeWidth:.5,fillOpacity:1}}(t),h=function(t){return{stroke:t.themeSemantic?.primary||"#4e79a7",strokeWidth:1.5,fill:"none"}}(t),d=function(t){return{fill:t.themeSemantic?.primary||"#4e79a7",r:4,fillOpacity:.8}}(t);if(t.graticule){const e=!0===t.graticule?{}:t.graticule,i=fe();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:Qt(t.areaStyle,e,u),datum:e,interactive:!0})}const p=Ut(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=pe(i,r)||0,a=Math.max(2,Math.ceil(s/(Math.PI/180))),c=me(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=Qt(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?Kt(o,u):Jt(o[0],o[o.length-1],0,0,u)):o=$t(o[0],o[o.length-1]);const d=Vt(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&&pe([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,s=Number.isFinite(r)?Math.max(0,Math.min(1,r)):1,a="strip"===e.layout?"strip":"radial";if("radial"===a&&0===s)return null;const c=e.centerAccessor?"function"==typeof e.centerAccessor?e.centerAccessor:t=>t[e.centerAccessor]:t=>t.id,l="function"==typeof e.costAccessor?e.costAccessor:t=>t[e.costAccessor],u=o.find(t=>t.datum&&c(t.datum)+""==e.center+"");if(!u)return"production"!==process.env.NODE_ENV&&console.warn(`GeoFrame: Distance cartogram center "${e.center}" not found in point data`),null;const h=o.map(t=>t.datum?Number(l(t.datum)):NaN).filter(t=>isFinite(t)&&t>=0),d=St(h,1);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)}const p="strip"===a?function(t,e,n,i,o){const r=Math.max(3,Math.min(8,.35*o.height)),s=Math.max(1,o.width-2*r),a=o.height/2,c=te().domain([0,i]).range([0,s]);e.x=r,e.y=a;const l=[];for(const o of t){if(o===e)continue;if(!o.datum){o.x=r,o.y=a;continue}const t=Number(n(o.datum)),s=r+(isFinite(t)&&t>=0&&i>0?c(t):0);o.x=s,o.y=a,l.push({node:o,x:s})}l.sort((t,e)=>t.x-e.x);const u=Math.max(0,Math.min(o.height/2-1,6));let h=0;for(;l.length>h;){let t=h+1;for(;l.length>t&&3>Math.abs(l[t].x-l[h].x);)t++;const e=t-h;if(e>1&&u>0)for(let t=0;e>t;t++)l[h+t].node.y=a+(t-(e-1)/2)*Math.min(2.5,2*u/Math.max(1,e-1));h=t}return{cx:r,cy:a,maxCost:i,availableRadius:s,layout:"strip"}}(o,u,l,d,n):function(t,e,n,i,o,r){const s=e.x,a=e.y,c=r.width/2,l=r.height/2,u=Math.min(r.width,r.height)/2,h=te().domain([0,i]).range([0,u]);for(const r of t){if(r===e)continue;if(!r.datum)continue;const t=r.x,u=r.y,d=Math.atan2(u-a,t-s),p=Math.hypot(t-s,u-a),f=Number(n(r.datum)),m=isFinite(f)&&f>=0?i>0?h(f):0:p,g=c+Math.cos(d)*m,y=l+Math.sin(d)*m;r.x=t+(g-t)*o,r.y=u+(y-u)*o}return e.x=s+(c-s)*o,e.y=a+(l-a)*o,{cx:e.x,cy:e.y,maxCost:i,availableRadius:u,layout:"radial"}}(o,u,l,d,s,n),f=t.filter(t=>"line"===t.type);if(f.length>0){const t=new Map;for(const e of o)null!=e.pointId&&t.set(e.pointId+"",[e.x,e.y]);for(const n of f){const i=n.datum?.source,o=n.datum?.target;if(null!=i&&null!=o){const r=t.get(i+""),s=t.get(o+"");if(r&&s)if("fractional"===e.lineMode&&n.path.length>2){const t=n.path[0],e=n.path[n.path.length-1],i=[r[0]-t[0],r[1]-t[1]],o=[s[0]-e[0],s[1]-e[1]],a=[0];for(let t=1;n.path.length>t;t++)a.push(a[t-1]+Math.hypot(n.path[t][0]-n.path[t-1][0],n.path[t][1]-n.path[t-1][1]));const c=a[a.length-1];n.path=n.path.map((t,e)=>{const r=c>0?a[e]/c:e/(n.path.length-1);return[t[0]+i[0]*(1-r)+o[0]*r,t[1]+i[1]*(1-r)+o[1]*r]})}else n.path=[r,s]}}}return p}(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=R(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??t.style?.fillOpacity??1,t.style={...t.style,opacity:0},o=!0);o&&(this.activeTransition={startTime:this.currentTime(),duration:e})}cancelIntroAnimation(){this.activeTransition=null;for(const t of this.scene)"point"===t.type&&(null!=t._targetOpacity&&(t.style={...t.style,opacity:t._targetOpacity},t._targetOpacity=void 0),null!=t._targetX&&(t.x=t._targetX,t.y=t._targetY,t._targetX=void 0,t._targetY=void 0))}advanceTransition(t){if(!this.activeTransition)return!1;const e=nt(t,this.activeTransition),n=et(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=ht(t.x,t._targetX,n),t.y=ht(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}};ye.QUADTREE_THRESHOLD=500;var ve=ye;function be(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;if(!1===s.interactive)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=At(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=we(e,n,s,a,c,l);r>=d&&h>d&&(u=t,h=d)}}return u?{node:u,distance:h}:null}function we(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(ve);import{useMemo as xe,useRef as Pe}from"react";import{jsx as Re,jsxs as Se}from"react/jsx-runtime";function Le(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:x,svgAnnotationRules:P,pointNodes:R,geoProjection:S}=t,L=wt({onAnnotationActivate:y,onObservation:v,chartId:b,chartType:w}),A=Pe([g?.length??0,new Map]),k=g?.length??0;A.current[0]!==k&&(A.current=[k,new Map]);const C=xe(()=>{if(!g||0===g.length)return null;const t=O(g),i=S?t.map(t=>{if(!Array.isArray(t.coordinates)||2>t.coordinates.length)return t;const e=S(Number(t.coordinates[0]),Number(t.coordinates[1]));return e?{...t,x:e[0],y:e[1]}:t}):t,o={scales:{x:t=>Number(t),y:t=>Number(t)},timeAxis:"x",width:e,height:n,frameType:"xy",pointNodes:R,stickyPositionCache:A.current[1]},r=x?K({annotations:i,context:o,..."object"==typeof x?x:{}}):i;return gt(r,it("xy",L),P,o)},[g,x,P,e,n,R,L,S]);return s||a||c||m||C&&C.length>0?Se("svg",{role:"img",width:i,height:o,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[Re("title",{children:"string"==typeof a?a:"XY Chart"}),Re("desc",{children:"string"==typeof a?a+" (XY data visualization)":"XY data visualization"}),Se("g",{transform:"translate("+r.left+","+r.top+")",children:[C,m]}),a&&"string"==typeof a?Re("text",{x:i/2,y:V,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",fontSize:14,className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:a}):a?Re("foreignObject",{x:0,y:0,width:i,height:r.top,children:a}):null,yt({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 Ae,zoomIdentity as ke}from"d3-zoom";import{select as Ce}from"d3-selection";function De([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 Me=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=Be(s),c=_e(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 Be(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 _e(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 Ie(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=At(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 Ee,jsxs as Ne}from"react/jsx-runtime";function Oe({data:t}){if(!t)return null;if(t.properties)return Ee("div",{className:"semiotic-tooltip",style:ot,children:Ee("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=bt(e),i=null!=n.title?n.title+"":null;return null==i&&0===n.entries.length?null:Ne("div",{className:"semiotic-tooltip",style:ot,children:[null!=i&&Ee("div",{style:{fontWeight:600,marginBottom:n.entries.length?2:0},children:i}),n.entries.map(t=>Ne("div",{children:[Ne("span",{style:{opacity:.7},children:[t.key,": "]}),Ee("span",{style:{fontWeight:600},children:A(t.value)})]},t.key))]})}Oe.ownsChrome=!0;var Fe={top:10,right:10,bottom:10,left:10},ze=null;function We(){if(null!==ze)return ze;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 ze=t||e||n}function He(){return We()?12:30}var Ge={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 qe(t){return"string"==typeof t?t:"object"==typeof t&&t&&"type"in t?t.type:null}function Ze(t){return t?t.getContext("2d"):null}import{jsx as Xe,jsxs as Ye}from"react/jsx-runtime";var Ue=Nt(Et(function(t,e){const{projection:o,projectionExtent:r,fitPadding:s,projectionTransform:a,areas:l,points:h,lines:b,customLayout:w,layoutConfig:x,layoutSelection:R,onLayoutError:S,xAccessor:L,yAccessor:A,lineDataAccessor:k,pointIdAccessor:E,lineIdAccessor:O,lineType:F="geo",flowStyle:z="basic",graticule:X,zoomable:V,zoomExtent:$,onZoom:K,dragRotate:et,showParticles:nt,particleStyle:it,tileURL:ot,tileAttribution:ht,tileCacheSize:dt,size:pt,width:gt,height:yt,responsiveWidth:bt,responsiveHeight:wt,margin:St,className:At,background:kt,maxDevicePixelRatio:Et,windowSize:Nt=500,renderMode:Ot,areaStyle:Ft,pointStyle:zt,lineStyle:Wt,colorScheme:Ht,enableHover:Gt=!0,hoverAnnotation:qt,tooltipContent:Zt,allowTooltipOverflow:Xt=!1,customClickBehavior:Yt,customHoverBehavior:Ut,onObservation:Qt,annotationObservationCallback:Vt,chartId:$t,annotations:Kt,onAnnotationActivate:Jt,autoPlaceAnnotations:te,svgAnnotationRules:ee,decay:ne,pulse:ie,transition:oe,animate:re,staleness:se,frameScheduler:ae,clock:ce,random:le,seed:ue,paused:he=!1,suspendWhenHidden:de=!0,backgroundGraphics:pe,foregroundGraphics:fe,title:me,legend:ge,legendPosition:ye,legendLayout:we,legendHoverBehavior:xe,legendClickBehavior:Pe,legendHighlightedCategory:Re,legendIsolatedCategories:Se,legendCategoryAccessor:Be,onCategoriesChange:_e,showAxes:Ee,accessibleTable:Ne=!0,description:ze,summary:Ue}=t,{customHoverBehavior:Qe,customClickBehavior:Ve,hasClickBehavior:$e}=f({customHoverBehavior:Ut,customClickBehavior:Yt,onObservation:Qt,chartId:$t,chartType:"StreamGeoFrame"}),Ke=pt||[gt||600,yt||400],Je=jt(!0),tn=xt({sizeProp:Ke,responsiveWidth:bt,responsiveHeight:wt,userMargin:St,marginDefault:Fe,title:me,legend:ge,legendPosition:ye,foregroundGraphics:fe,backgroundGraphics:pe,animate:re,transitionProp:oe,frameScheduler:ae,clock:ce,random:le,seed:ue,paused:he,suspendWhenHidden:de,themeDirtyRef:Je}),{reducedMotionRef:en,responsiveRef:nn,size:on,margin:rn,adjustedWidth:sn,adjustedHeight:an,resolvedForeground:cn,resolvedBackground:ln,transition:un,introEnabled:hn,tableId:dn,frameRuntime:pn,rafRef:fn,renderFnRef:mn,scheduleRender:gn,currentTheme:yn}=tn,vn=Ct(),bn=Dt(),wn=Bt(()=>Array.isArray(l)?rt(l):l,[l]),xn=Bt(()=>rt(h),[h]),Pn=Bt(()=>rt(b),[b]),Rn=Bt(()=>null!=et?et:"orthographic"===qe(o),[et,o]),Sn=Bt(()=>({projection:o,projectionExtent:r,fitPadding:s,xAccessor:L,yAccessor:A,lineDataAccessor:k,lineType:F,flowStyle:z,areaStyle:Ft,pointStyle:zt,lineStyle:Wt,colorScheme:Ht,themeSemantic:Lt(yn),themeSequential:yn?.colors?.sequential,themeDiverging:yn?.colors?.diverging,themeCategorical:yn?.colors?.categorical,graticule:X,projectionTransform:a,windowSize:Nt,clock:pn.now,decay:ne,pulse:ie,transition:un,introAnimation:hn,annotations:Kt,pointIdAccessor:E,lineIdAccessor:O,customLayout:w,layoutConfig:x,onLayoutError:S,layoutMargin:rn}),[o,r,s,L,A,k,F,z,Ft,zt,Wt,Ht,yn,X,a,Nt,pn.now,ne,ie,un,hn,Kt,E,O,w,x,S,rn]),Ln=_(Sn),An=jt(null);An.current||(An.current=new ve(Ln));const kn=jt(null),Cn=jt(null),Dn=jt(null);ot&&!Dn.current&&(Dn.current=new Me(dt||256));const jn=jt(Kt),Mn=jt(null),Tn=jt(ke),Bn=jt(!1),_n=jt(null),In=_t(t=>{_n.current=t,nn&&"object"==typeof nn&&(nn.current=t)},[nn]),En=jt(null),Nn=jt(null),On=jt(null),Fn=jt(0);if(nt&&!On.current){const t=it?.maxPerLine??He();On.current=new Te(50*t)}const zn=jt(null),Wn=jt(null),Hn=jt(!1),Gn=jt(!1),qn=Rt("StreamGeoFrame"),Zn=jt(void 0),[Xn,Yn]=Mt(null),[,Un]=Mt(0),Qn=jt(0),[Vn,$n]=Mt(!1),Kn=p(An,Be,_e,t=>t.getPoints());T(An,Ln,Je,gn),B(An,R,Je,gn),Tt(()=>{const t=An.current;t&&(wn&&t.setAreas(wn),h&&t.setPoints(xn),b&&t.setLines(Pn),Je.current=!0,gn())},[wn,h,xn,b,Pn,gn]);const Jn=_t(t=>{null!=t&&"object"==typeof t&&(An.current?.pushPoint(t),Je.current=!0,gn())},[gn]),ti=_t(t=>{const e=rt(t);0!==e.length&&(An.current?.pushMany(e),Je.current=!0,gn())},[gn]),ei=_t(t=>{null!=t&&"object"==typeof t&&(An.current?.pushLine(t),Je.current=!0,gn())},[gn]),ni=_t(t=>{const e=rt(t);0!==e.length&&(An.current?.pushManyLines(e),Je.current=!0,gn())},[gn]),ii=_t(()=>{An.current?.clear(),Je.current=!0,gn()},[gn]);It(e,()=>({push:Jn,pushMany:ti,removePoint:t=>{const e=An.current?.removePoint(t)??[];return e.length>0&&(Je.current=!0,gn()),e},pushLine:ei,pushManyLines:ni,removeLine:t=>{const e=An.current?.removeLine(t)??[];return e.length>0&&(Je.current=!0,gn()),e},getLines:()=>An.current?.getLines()??[],clear:ii,getProjection:()=>An.current?.scales?.projection??null,getGeoPath:()=>An.current?.scales?.geoPath??null,getCartogramLayout:()=>An.current?.cartogramLayout??null,getCustomLayout:()=>An.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>An.current?.lastCustomLayoutFailure??null,getZoom:()=>Tn.current.k,resetZoom:()=>{const t=_n.current;t&&Mn.current&&Ce(t).call(Mn.current.transform,ke)},getData:()=>An.current?.getPoints()??[]}),[Jn,ti,ei,ni,ii,gn]);const{hoverHandlerRef:oi,onPointerMove:ri,onPointerLeave:si}=tn,{canvasRef:ai,interactionCanvasRef:ci,resolutionDirtyRef:li}=Pt(tn,{hydrated:vn,wasHydratingFromSSR:bn,storeRef:An,dirtyRef:Je,cleanup:()=>Dn.current?.clear(),maxDevicePixelRatio:Et,canvasPaintDependencies:[sn,an,kt,pe,Ot,gn]});Tt(()=>{oi.current=t=>{if(!Gt)return;const e=An.current;if(!e||!e.scene.length)return;const n=ai.current;if(!n)return;const i=n.getBoundingClientRect(),o=t.clientX-i.left-rn.left,r=t.clientY-i.top-rn.top;if(0>o||o>sn||0>r||r>an)return zn.current=null,Wn.current=null,Yn(null),Qe?.(null),void gn();Cn.current||(Cn.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const s=Ze(Cn.current);if(!s)return;const a=ct(30,t.pointerType),c=ct(6,t.pointerType),l=be(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};zn.current=a,Wn.current=t,Yn(a),Qe?.(a),gn()}else zn.current&&(zn.current=null,Wn.current=null,Yn(null),Qe?.(null),gn())}},[Gt,sn,an,rn,Qe,gn,oi,ai]),tn.hoverLeaveRef.current=()=>{zn.current=null,Wn.current=null,Yn(null),Qe?.(null),gn()};const ui=_t(t=>{if(lt(t.target))return;if(!Ve)return;const e=An.current;if(!e||!e.scene.length)return void Ve(null);const n=t.currentTarget.getBoundingClientRect(),i=t.clientX-n.left-rn.left,o=t.clientY-n.top-rn.top;if(0>i||i>sn||0>o||o>an)return void Ve(null);Cn.current||(Cn.current="undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas"));const r=Ze(Cn.current);if(!r)return void Ve(null);const s=ct(30,Zn.current),a=ct(6,Zn.current),c=be(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 Ve({...n,data:e,properties:e?.properties,__semioticHoverData:!0,x:i,y:o,time:i,value:o},{type:"activate",inputType:ft(Zn.current)})}Ve(null)},[an,sn,Ve,rn]),{kbFocusIndexRef:hi,focusedNavPointRef:di,onKeyDown:pi}=d({storeRef:An,hoverRef:zn,hoveredNodeRef:Wn,setHoverPoint:Yn,customHoverBehavior:Qe,customClickBehavior:Ve,scheduleRender:gn}),fi=_t(t=>{Zn.current=t.pointerType,hi.current=-1,di.current=null,ri(t)},[di,hi,ri]),mi=_t(t=>{Zn.current=t.pointerType},[]);mn.current=()=>{if(fn.current=null,!pn.isActive)return;const t=ai.current,e=An.current;if(!t||!e)return;const o=pn.now();let r=!1;const s=Nn.current;let a=!1;s&&(Nn.current=null,e.applyRotation(s,{width:sn,height:an}),a=!0);const l=e.advanceTransition(en.current?o+1e6:o),h=!en.current&&l,d=qn.current.beforeCompute(e.getLastUpdateResult(),h);let p=!1;if(Je.current&&!l){const n={width:sn,height:an},i=e.hasProjection(),o=Rn&&i?e.getRotation():null;e.computeScene(n);const r=Tn.current,s=1!==r.k||0!==r.x||0!==r.y;Rn&&o?s?(e.setRotation(o),e.applyZoomScale(r.k,n)):e.applyRotation(o,n):s&&e.applyZoomTransform(r,n),Je.current=!1,p=!0,t.setAttribute("aria-label",tt(e.scene,"Geographic chart")),Kn()}qn.current.afterCompute(d,p,!1);const f=at(Et),v=nt&&!en.current&&!!On.current,b=e.consumeStylePaintPending(),w=u(e,o,p,Gn),x=m({dirtyOrRebuilt:p,transitioning:h,continuous:v,liveEncoding:w.changed,forced:a||b||li.current});if(li.current=!1,ot&&Dn.current){const t=kn.current;if(t&&e.scales?.projection){const n=mt(t,on,rn,f);if(n){n.clearRect(-rn.left,-rn.top,on[0],on[1]),n.save(),n.beginPath(),n.rect(0,0,sn,an),n.clip();const t=function(t,e){const{tileURL:n,projection:i,width:o,height:r,tileCache:s,onTileLoad:a,maxDevicePixelRatio:c}=e,l=i.scale(),u=i.translate(),h=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*l*Math.PI,translate:u}),d=at(c);let p=!0;for(const e of h.tiles){const[i,o,r]=De(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,d),l=e}if(!l.loaded){p=!1;continue}const u=h.scale;t.drawImage(l.img,(e[0]+h.translate[0])*u-.5,(e[1]+h.translate[1])*u-.5,u+1,u+1)}return p}(n,{tileURL:ot,projection:e.scales.projection,width:sn,height:an,tileCache:Dn.current,maxDevicePixelRatio:Et,onTileLoad:()=>gn()});n.restore(),t||(r=!0)}}}if(x){const i=mt(t,on,rn,f);if(!i)return;i.clearRect(-rn.left,-rn.top,on[0],on[1]),ot||y(i,{background:kt,hasBackgroundGraphics:!!pe,width:sn,height:an}),i.save(),i.beginPath(),i.rect(0,0,sn,an),i.clip();const s=e.scene,a=e.scales,l={width:sn,height:an};if(D({context:i,nodes:s,renderMode:Ot,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=J(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=vt(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||.5,t.globalAlpha=e._decayOpacity??1,e.style.strokeDasharray){const n=e.style.strokeDasharray.split(",").map(Number);t.setLineDash(n)}else t.setLineDash([]);t.stroke(n)}j(t,e,n),t.globalAlpha=1,t.setLineDash([])}}(i,t),n(i,t,a,l),c(i,t,a,l),C(i,t,a,l)}}),v&&On.current){const t=On.current,e=s.filter(t=>"line"===t.type);if(e.length>0){const n=it||{},s=.3*(n.speedMultiplier??1),a=n.maxPerLine??He(),c=n.spawnRate??(We()?.06:.15),l=n.radius??2,u=n.opacity??.7,h=o/1e3,d=Fn.current>0?Math.min(h-Fn.current,.1):.016;Fn.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++)pn.random()<c&&t.countForLine(n)<a&&t.spawn(n,pn.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 P=Wn.current,R=!(!P||"geoarea"!==P.type&&"point"!==P.type),S=g(R,Hn.current),L=ci.current;if(L&&S){const t=mt(L,on,rn,f);if(t){if(t.clearRect(-rn.left,-rn.top,on[0],on[1]),P&&"geoarea"===P.type){const e=new Path2D(P.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(P&&"point"===P.type){const e=P,n="object"==typeof qt?qt:void 0,o=n?.pointColor||i(P);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()}}Hn.current=R}const A=Kt!==jn.current;A&&(jn.current=Kt),(p||A||h&&Kt&&Kt.length>0)&&(p||A||o-Qn.current>=33)&&(Un(t=>t+1),Qn.current=o),(h||null!=e.activeTransition||w.pending||r)&&gn()},I(se,An,Je,gn,Vn,$n),Tt(()=>{if("production"!==process.env.NODE_ENV&&ot){const t=qe(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.`)}},[ot,o]),Tt(()=>{const t=_n.current;if(!V||!t)return Mn.current&&t&&(Ce(t).on(".zoom",null),Mn.current=null),void(t&&Ce(t).on("mousedown.rotate",null).on("touchstart.rotate",null));const[e,n]=$||[1,8],i={width:sn,height:an};if(Rn){let o=Tn.current.k;const r=t=>{o=Math.max(e,Math.min(n,t)),Tn.current=ke.scale(o);const r=An.current;r&&(r.applyZoomScale(o,i),Je.current=!1,gn(),r.scales?.projection&&K?.({projection:r.scales.projection,zoom:r.currentZoom}))};Mn.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=An.current;if(!i)return;const o=i.getRotation();En.current={x:e.clientX,y:e.clientY,rotation:[...o]},t.setPointerCapture(e.pointerId),e.preventDefault()},u=t=>{const e=En.current;e&&(Nn.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]],gn())},h=e=>{if(!En.current)return;En.current=null,t.releasePointerCapture(e.pointerId);const n=Nn.current;if(n){Nn.current=null;const t=An.current;t&&(t.applyRotation(n,i),gn())}const o=An.current;o?.scales?.projection&&K?.({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),Mn.current=null}}const o=Ae().scaleExtent([e,n]).extent([[0,0],[on[0],on[1]]]).translateExtent([[-1/0,-1/0],[1/0,1/0]]).on("zoom",t=>{const e=t.transform;Tn.current=e,Bn.current=!0;const n=An.current;n&&(n.applyZoomTransform(e,i),Je.current=!1,gn())}).on("end",t=>{Tn.current=t.transform,Bn.current=!1;const e=An.current;e?.scales?.projection&&K?.({projection:e.scales.projection,zoom:e.currentZoom})});return Mn.current=o,Ce(t).call(o),()=>{Ce(t).on(".zoom",null)}},[V,$,Rn,on,sn,an,rn,K,gn]);const gi=Gt&&!1!==qt,yi=gi&&Xn?Zt?Zt(Xn):Xe(Oe,{data:Xn}):null,vi=yi?Xe(q,{x:Xn.x,y:Xn.y,containerWidth:sn,containerHeight:an,margin:rn,className:"stream-frame-tooltip",zIndex:10,children:yi}):null;if(ut||!vn&&bn){const t=An.current;t&&(wn||h||b)&&(wn&&t.setAreas(wn),h&&t.setPoints(xn),b&&t.setLines(Pn),t.computeScene({width:sn,height:an}));const e=t?.scene??[];return Ye("div",{ref:In,className:"stream-geo-frame"+(At?" "+At:""),role:"img","aria-label":ze||("string"==typeof me?me:"Geographic chart"),style:{position:"relative",width:bt?"100%":on[0],height:wt?"100%":on[1]},children:[Xe(U,{summary:Ue}),Ye("svg",{xmlns:"http://www.w3.org/2000/svg",width:on[0],height:on[1],style:{position:"absolute",left:0,top:0},children:[Xe("g",{transform:`translate(${rn.left},${rn.top})`,children:ln}),Ye("g",{transform:`translate(${rn.left},${rn.top})`,children:[kt&&Xe("rect",{x:0,y:0,width:sn,height:an,fill:kt}),e.map((t,e)=>M({node:t,index:e,renderMode:Ot,fallback:()=>st(t,e)}))]})]}),Xe(Le,{width:sn,height:an,totalWidth:on[0],totalHeight:on[1],margin:rn,showAxes:!1,title:me,legend:ge,legendPosition:ye,legendLayout:we,legendHoverBehavior:xe,legendClickBehavior:Pe,legendHighlightedCategory:Re,legendIsolatedCategories:Se,foregroundGraphics:P(cn,N(An.current?.customLayoutOverlays,R??null)),annotations:Kt,onAnnotationActivate:Jt,onObservation:Vt??Qt,chartId:$t,chartType:"StreamGeoFrame",autoPlaceAnnotations:te,svgAnnotationRules:ee,pointNodes:Ie(e),geoProjection:An.current?.scales?.projectedPoint})]})}return Ye("div",{ref:In,className:"stream-geo-frame"+(At?" "+At:""),role:"group","aria-label":ze||("string"==typeof me?me:"Geographic chart"),tabIndex:0,style:{position:"relative",width:bt?"100%":on[0],height:wt?"100%":on[1],overflow:Xt?"visible":"hidden",...V?{touchAction:"none"}:{}},onKeyDown:pi,children:["production"!==process.env.NODE_ENV&&An.current&&Xe(Y,{store:An.current,diagnostics:qn.current}),Ne&&Xe(Q,{tableId:dn}),Ne&&Xe(W,{scene:An.current?.scene??[],chartType:"Geographic chart",tableId:dn,chartTitle:"string"==typeof me?me:void 0}),Xe(U,{summary:Ue}),Xe(H,{hoverPoint:Xn}),Ye("div",{role:"img","aria-label":ze||("string"==typeof me?me:"Geographic chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:gi?fi:void 0,onPointerLeave:gi?si:void 0,onPointerDown:gi||$e?mi:void 0,onClick:$e?ui:void 0,children:[Xe(G,{size:on,margin:rn,children:ln}),ot&&Xe("canvas",{ref:kn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Xe("canvas",{ref:ai,"aria-label":tt(An.current?.scene??[],"Geographic chart"),style:{position:"absolute",left:0,top:0}}),Xe("canvas",{ref:ci,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Xe(Le,{width:sn,height:an,totalWidth:on[0],totalHeight:on[1],margin:rn,showAxes:Ee,title:me,legend:ge,legendPosition:ye,legendLayout:we,legendHoverBehavior:xe,legendClickBehavior:Pe,legendHighlightedCategory:Re,legendIsolatedCategories:Se,foregroundGraphics:P(cn,N(An.current?.customLayoutOverlays,R??null)),annotations:Kt,onAnnotationActivate:Jt,onObservation:Vt??Qt,chartId:$t,chartType:"StreamGeoFrame",autoPlaceAnnotations:te,svgAnnotationRules:ee,pointNodes:Ie(An.current?.scene),geoProjection:An.current?.scales?.projectedPoint}),se?.showBadge&&Xe(v,{isStale:Vn,position:se.badgePosition}),V&&Ye("div",{className:"stream-geo-zoom-controls",style:{position:"absolute",bottom:rn.bottom+8,left:rn.left+8,display:"flex",flexDirection:"column",gap:2,zIndex:2},children:[Xe("button",{type:"button","aria-label":"Zoom in",onClick:t=>{t.stopPropagation();const e=_n.current,n=Mn.current;e&&n?.scaleBy&&n.scaleBy(Ce(e),1.5)},style:Ge,children:"+"}),Xe("button",{type:"button","aria-label":"Zoom out",onClick:t=>{t.stopPropagation();const e=_n.current,n=Mn.current;e&&n?.scaleBy&&n.scaleBy(Ce(e),1/1.5)},style:Ge,children:"−"})]}),ht&&Xe("div",{className:"stream-geo-tile-attribution",style:{position:"absolute",bottom:rn.bottom+2,right:rn.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}),Xe(Z,{active:hi.current>=0,hoverPoint:Xn,margin:rn,size:on,shape:di.current?.shape,width:di.current?.w,height:di.current?.h,pathData:di.current?.pathData}),vi]})]})}));Ue.displayName="StreamGeoFrame";var Qe=Ue;import{forwardRef as Ve,useMemo as $e}from"react";import{jsx as Ke}from"react/jsx-runtime";var Je=Ve(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:P,onObservation:R,onClick:S,chartId:L,loading:A,loadingContent:k,emptyContent:C,className:D,frameProps:j={}}=n,{frameRef:M,resolved:T,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(()=>rt(o),[o]),I=$e(()=>rt(r),[r]),E=$e(()=>rt(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:P,fallbackFields:"string"==typeof f?[f]:[],unwrapData:!1,onObservation:R,onClick:S,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"GeoCustomChart",chartId:L,showLegend:!1,userMargin:B,marginDefaults:T.marginDefaults,loading:A,loadingContent:k,emptyContent:C,width:T.width,height:T.height,hasTitle:!!T.title}),F=O.effectiveSelectionHook,z=$e(()=>F?.isActive?{isActive:!0,predicate:F.predicate}:null,[F?.isActive,F?.predicate]);if(O.earlyReturn)return O.earlyReturn;const{width:W,height:H,enableHover:G,title:q,description:Z,summary:X,accessibleTable:Y}=T,U=dt(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:z,colorBy:f,colorScheme:m,size:[W,H],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:O.margin,enableHover:G,...w({title:q,description:Z,summary:X,accessibleTable:Y,className:D,animate:n.animate,maxDevicePixelRatio:n.maxDevicePixelRatio,autoPlaceAnnotations:n.autoPlaceAnnotations}),...!1===g?{tooltipContent:()=>null}:U?{tooltipContent:U}:{},...x({linkedHover:P,selection:b,onObservation:R,onClick:S,hoverHighlight:!1,mobileInteraction:O.mobileInteraction,customHoverBehavior:O.customHoverBehavior,customClickBehavior:O.customClickBehavior,linkedHoverInClickPredicate:!1}),...y&&y.length>0&&{annotations:y},...j};return Ke(kt,{componentName:"GeoCustomChart",width:W,height:H,children:Ke(Qe,{ref:M,...Q})})});Je.displayName="GeoCustomChart";export{Qe as StreamGeoFrame_default,Je as GeoCustomChart};
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{mulberry32 as e}from"./chunk-chunk-SIRIJ3DY.module.min.js";function t(e){if(!e?.layoutQuality)return[];const t=[],r=e.layoutQuality,s=e.layoutQualityBefore;e.compressedPadding&&t.push({severity:"warning",code:"PROCESS_SANKEY_COMPRESSED_PADDING",message:"Lane gaps were compressed to fit peaks into the plot height.",fix:'Increase height, lower maxValueScale, use packing="reuse", or reduce concurrent peaks.'}),8>r.transitOcclusion||t.push({severity:"warning",code:"PROCESS_SANKEY_HIGH_TRANSIT",message:`High transit occlusion (${r.transitOcclusion.toFixed(1)}) — ribbons cross dense intermediate lanes.`,fix:'Try laneOrder="crossing-min+inside-out", packing="reuse", or lanePlacement="hug" with a modest maxValueScale.'}),.92>r.verticalUtilization||t.push({severity:"warning",code:"PROCESS_SANKEY_HIGH_UTILIZATION",message:`Lane utilization is ${Math.round(100*r.verticalUtilization)}% of plot height.`,fix:"Increase chart height or cap band scale with maxValueScale."});const o=e.crossingsAfter??r.crossings;return null==o||3>o||t.push({severity:"warning",code:"PROCESS_SANKEY_RESIDUAL_CROSSINGS",message:`Ordering left ${o} edge-pair crossings`+(s?` (from ${s.crossings})`:"")+".",fix:'Prefer laneOrder="crossing-min" or "crossing-min+inside-out"; check for unavoidable fan-outs.'}),t}function r(e){if(!e?.layoutQuality)return null;const t=e.layoutQuality,r=e.layoutQualityBefore,s=e.crossingsAfter??t.crossings;return[`ProcessSankey layout uses ${e.slots?.length??"?"} packed lane(s).`,null!=s?`Edge-pair crossings ${r?r.crossings+" → ":""}${s}.`:null,`Pixel path length ${r?Math.round(r.pixelLength)+" → ":""}${Math.round(t.pixelLength)}.`,`Transit occlusion ${r?r.transitOcclusion.toFixed(1)+" → ":""}${t.transitOcclusion.toFixed(1)}.`,`Lane utilization ${Math.round(100*t.verticalUtilization)}%.`,e.compressedPadding?"Lane gaps were compressed to fit the plot.":null].filter(Boolean).join(" ")}function s(e){const t=[],r=e.domain;null==r?t.push({severity:"error",code:"PROCESS_SANKEY_MISSING_DOMAIN",message:"ProcessSankey requires domain: [tStart, tEnd].",fix:"Pass domain={[start, end]} as numbers or Date-compatible values."}):Array.isArray(r)&&2===r.length&&Number.isFinite(Number(r[0]))&&Number.isFinite(Number(r[1]))||t.push({severity:"error",code:"PROCESS_SANKEY_BAD_DOMAIN",message:"domain must be a 2-tuple of finite times.",fix:"Use domain={[t0, t1]} with t0 <= t1."});const s=e.edges;if(Array.isArray(s)&&s.length>0){const e=s[0];null!=e.startTime&&null!=e.endTime||t.push({severity:"warning",code:"PROCESS_SANKEY_EDGE_TIMES",message:"Edges should carry startTime and endTime for temporal layout.",fix:"Add startTime/endTime fields or set startTimeAccessor/endTimeAccessor."})}const o=e.nodes,i=Array.isArray(o)?o.length:0;return!0!==e.showLabels||24>i||t.push({severity:"warning",code:"PROCESS_SANKEY_LABEL_DENSITY",message:`showLabels={true} with ${i} nodes may overcrowd the plot.`,fix:'Use showLabels="auto" with optional labelPriorityAccessor / maxLabels.'}),80>(Array.isArray(s)?s.length:0)||null!=e.layoutExecution||"off"===e.packing||t.push({severity:"warning",code:"PROCESS_SANKEY_WORKER_HINT",message:"Dense ProcessSankey layouts benefit from worker packing/order.",fix:'layoutExecution defaults to "auto"; set layoutExecution="worker" or raise layoutWorkerThreshold deliberately.'}),t}import{forceCenter as o,forceCollide as i,forceLink as n,forceManyBody as a,forceSimulation as c,forceX as l,forceY as u}from"d3-force";function d(t,r,s={}){const d=s.iterations??260,g=s.repulsion??5200,h=s.linkDistance??165,m=s.linkStrength??.045,f=s.centerStrength??.018,y=s.damping??.84,p=s.nodeRadius??12,S=s.nodePadding??3,E=s.inset??.06,A=e(s.seed??1),x=new Map;for(const e of t)x.set(e.id,0);for(const e of r)x.set(e.source,(x.get(e.source)??0)+1),x.set(e.target,(x.get(e.target)??0)+1);const _=500,w=t.map(e=>({id:e.id,data:e,x:200+600*A(),y:200+600*A()})),N=new Set(t.map(e=>e.id)),O=r.filter(e=>N.has(e.source)&&N.has(e.target)).map(e=>({source:e.source,target:e.target}));if(d>0){const e=c(w).randomSource(A).alphaDecay(1-Math.pow(.001,1/d)).velocityDecay(Math.max(0,Math.min(1,1-y))).force("charge",a().strength(e=>{const t=x.get(e.id)??0;return 2.5*-Math.sqrt(g)*Math.sqrt(t+1)})).force("collide",i(e=>(e=>"function"==typeof p?p(e.data):p)(e)+S).strength(.9).iterations(2)).force("center",o(_,_).strength(.8)).force("x",l(_).strength(f)).force("y",u(_).strength(f));O.length>0&&e.force("link",n(O).id(e=>e.id).distance(h).strength(e=>{const t="string"==typeof e.target?e.target:e.target.id,r=Math.max(1,Math.min(x.get("string"==typeof e.source?e.source:e.source.id)??1,x.get(t)??1));return m/.045/r})),e.stop();for(let t=0;d>t;t+=1)e.tick()}let P=1/0,k=1/0,I=-1/0,b=-1/0;for(const e of w){const t=e.x??_,r=e.y??_;P>t&&(P=t),k>r&&(k=r),t>I&&(I=t),r>b&&(b=r)}const T=I-P,M=b-k,R={};for(const e of w)R[e.id]={x:0===T?.5:E+((e.x??_)-P)/T*(1-2*E),y:0===M?.5:E+((e.y??_)-k)/M*(1-2*E)};return R}export{t as diagnoseProcessSankeyLayout,r as explainProcessSankeyLayout,s as diagnoseProcessSankeyProps,d as forceLayout};
@@ -0,0 +1 @@
1
+ import{createContext as e,useCallback as o,useContext as r,useMemo as a,useRef as t,useSyncExternalStore as i}from"react";import{jsx as c}from"react/jsx-runtime";function n(n){let l=null;const f=()=>(l||(l=e(null)),l),d=s(n);return[function({children:e,initialState:o}){const r=t(o),i=a(()=>s(n,r.current),[]),l=f();return c(l.Provider,{value:i,children:e})},(e,a)=>{const c=f(),n=r(c)??d,s=t(e);s.current=e;const l=t({hasValue:!1,value:void 0}),u=o(()=>{const e=s.current(n.getState()),o=l.current;return o.hasValue&&a&&a(o.value,e)?o.value:(l.current={hasValue:!0,value:e},e)},[n,a]),p=o(()=>s.current(n.getState()),[n]);return i(n.subscribe,u,p)}]}function s(e,o){const r=new Set;let a={...e(function(e){const o=e(a);if(l(o)){a={...a,...o};for(const e of r)e()}}),...o??{}};return{getState:()=>a,subscribe:function(e){return r.add(e),()=>{r.delete(e)}}}}function l(e){for(const o in e)if(Object.prototype.hasOwnProperty.call(e,o))return!0;return!1}function f(e){if(!e?.colors)return;const o=e.colors;return{primary:o.primary,secondary:o.secondary||o.primary,surface:o.surface||o.background,success:o.success,danger:o.danger,warning:o.warning,error:o.error,info:o.info,text:o.text,textSecondary:o.textSecondary,border:o.border,grid:o.grid}}function d(e){if(!e.accessibility)return e;let o=e;if(e.accessibility.colorBlindSafe&&(o={...o,colors:{...o.colors,categorical:u}}),e.accessibility.highContrast){const e="dark"===o.mode;o={...o,colors:{...o.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return o}var u=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],p={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},g={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},y={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:u,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function b(e,o){if("light"===o)return p;if("dark"===o)return g;if("high-contrast"===o)return y;if("string"==typeof o)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${o}". Keeping current theme.`),e;if(o.mode&&"auto"!==o.mode){const e="dark"===o.mode?g:p;return d({...e,...o,colors:{...e.colors,...o.colors||{}},typography:{...e.typography,...o.typography||{}}})}return d({...e,...o,colors:{...e.colors,...o.colors||{}},typography:{...e.typography,...o.typography||{}}})}var[m,h]=n(e=>({theme:p,setTheme(o){e(e=>({theme:b(e.theme,o)}))}}));function x(e,o=":root"){const r=[];return r.push(` --semiotic-bg: ${e.colors.background};`),r.push(` --semiotic-text: ${e.colors.text};`),r.push(` --semiotic-text-secondary: ${e.colors.textSecondary};`),r.push(` --semiotic-grid: ${e.colors.grid};`),r.push(` --semiotic-border: ${e.colors.border};`),r.push(` --semiotic-primary: ${e.colors.primary};`),r.push(` --semiotic-font-family: ${e.typography.fontFamily};`),e.colors.focus&&r.push(` --semiotic-focus: ${e.colors.focus};`),e.colors.selection&&r.push(` --semiotic-selection-color: ${e.colors.selection};`),null!=e.colors.selectionOpacity&&r.push(` --semiotic-selection-opacity: ${e.colors.selectionOpacity};`),e.colors.diverging&&r.push(` --semiotic-diverging: ${e.colors.diverging};`),e.tooltip?.background&&r.push(` --semiotic-tooltip-bg: ${e.tooltip.background};`),e.tooltip?.text&&r.push(` --semiotic-tooltip-text: ${e.tooltip.text};`),e.tooltip?.borderRadius&&r.push(` --semiotic-tooltip-radius: ${e.tooltip.borderRadius};`),e.tooltip?.fontSize&&r.push(` --semiotic-tooltip-font-size: ${e.tooltip.fontSize};`),e.tooltip?.shadow&&r.push(` --semiotic-tooltip-shadow: ${e.tooltip.shadow};`),e.borderRadius&&r.push(` --semiotic-border-radius: ${e.borderRadius};`),e.colors.annotation&&r.push(` --semiotic-annotation-color: ${e.colors.annotation};`),null!=e.typography.legendSize&&r.push(` --semiotic-legend-font-size: ${e.typography.legendSize}px;`),null!=e.typography.titleFontSize&&r.push(` --semiotic-title-font-size: ${e.typography.titleFontSize}px;`),null!=e.typography.tickFontFamily&&r.push(` --semiotic-tick-font-family: ${e.typography.tickFontFamily};`),null!=e.typography.tickSize&&r.push(` --semiotic-tick-font-size: ${e.typography.tickSize}px;`),null!=e.typography.labelSize&&r.push(` --semiotic-axis-label-font-size: ${e.typography.labelSize}px;`),r.push(` --semiotic-secondary: ${e.colors.secondary||e.colors.primary};`),r.push(` --semiotic-surface: ${e.colors.surface||e.colors.background};`),e.colors.success&&r.push(` --semiotic-success: ${e.colors.success};`),e.colors.danger&&r.push(` --semiotic-danger: ${e.colors.danger};`),e.colors.warning&&r.push(` --semiotic-warning: ${e.colors.warning};`),e.colors.error&&r.push(` --semiotic-error: ${e.colors.error};`),e.colors.info&&r.push(` --semiotic-info: ${e.colors.info};`),`${o} {\n${r.join("\n")}\n}`}function $(e){return{semiotic:{bg:{$value:e.colors.background,$type:"color"},text:{$value:e.colors.text,$type:"color"},"text-secondary":{$value:e.colors.textSecondary,$type:"color"},grid:{$value:e.colors.grid,$type:"color"},border:{$value:e.colors.border,$type:"color"},primary:{$value:e.colors.primary,$type:"color"},focus:{$value:e.colors.focus||e.colors.primary,$type:"color"},"font-family":{$value:e.typography.fontFamily,$type:"fontFamily"},"border-radius":{$value:e.borderRadius||"8px",$type:"dimension"},tooltip:{bg:{$value:e.tooltip?.background||e.colors.background,$type:"color"},text:{$value:e.tooltip?.text||e.colors.text,$type:"color"},radius:{$value:e.tooltip?.borderRadius||"6px",$type:"dimension"},"font-size":{$value:e.tooltip?.fontSize||"14px",$type:"dimension"},shadow:{$value:e.tooltip?.shadow||"0 2px 8px rgba(0,0,0,0.15)",$type:"shadow"}},selection:{color:{$value:e.colors.selection||e.colors.primary,$type:"color"},opacity:{$value:e.colors.selectionOpacity??.2,$type:"number"}},categorical:{$value:e.colors.categorical,$type:"color",$description:"Categorical color palette"},sequential:{$value:e.colors.sequential,$type:"string",$description:"d3-scale-chromatic sequential scheme name"},...e.colors.diverging?{diverging:{$value:e.colors.diverging,$type:"string",$description:"d3-scale-chromatic diverging scheme name"}}:{},...e.colors.annotation?{"annotation-color":{$value:e.colors.annotation,$type:"color"}}:{},...null!=e.typography.legendSize?{"legend-font-size":{$value:e.typography.legendSize+"px",$type:"dimension"}}:{},...null!=e.typography.titleFontSize?{"title-font-size":{$value:e.typography.titleFontSize+"px",$type:"dimension"}}:{},...null!=e.typography.tickFontFamily?{"tick-font-family":{$value:e.typography.tickFontFamily,$type:"fontFamily"}}:{},...null!=e.typography.tickSize?{"tick-font-size":{$value:e.typography.tickSize+"px",$type:"dimension"}}:{},...null!=e.typography.labelSize?{"axis-label-font-size":{$value:e.typography.labelSize+"px",$type:"dimension"}}:{},secondary:{$value:e.colors.secondary||e.colors.primary,$type:"color"},surface:{$value:e.colors.surface||e.colors.background,$type:"color"},...e.colors.success?{success:{$value:e.colors.success,$type:"color"}}:{},...e.colors.danger?{danger:{$value:e.colors.danger,$type:"color"}}:{},...e.colors.warning?{warning:{$value:e.colors.warning,$type:"color"}}:{},...e.colors.error?{error:{$value:e.colors.error,$type:"color"}}:{},...e.colors.info?{info:{$value:e.colors.info,$type:"color"}}:{}}}}var S=/^\{([^}]+)\}$/,k={bg:"background",text:"text","text-secondary":"textSecondary",grid:"grid",border:"border",primary:"primary",focus:"focus",secondary:"secondary",surface:"surface",annotation:"annotation",success:"success",danger:"danger",warning:"warning",error:"error",info:"info"},v=[["textSecondary",/^(text-?secondary|secondary-?text|muted|subtle|text-?muted|fg-?muted)$/],["text",/^(text|foreground|fg|ink|on-?background|on-?surface|text-?default|fg-?default)$/],["background",/^(background|bg|canvas|base|page|backdrop|bg-?default)$/],["surface",/^(surface|card|elevated|panel|sheet)$/],["border",/^(border|divider|outline|stroke|hairline)$/],["grid",/^(grid|gridline|gridlines)$/],["primary",/^(primary|brand|accent|brand-?primary)$/],["secondary",/^(secondary|brand-?secondary)$/],["focus",/^(focus|ring|focus-?ring)$/],["error",/^(error|critical)$/],["danger",/^(danger|negative|destructive|fail|alert)$/],["success",/^(success|positive|ok|good|pass)$/],["warning",/^(warning|warn|caution)$/],["info",/^(info|information|note)$/],["annotation",/^(annotation|callout)$/]],z=/^rgba?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)(?:\s*,\s*[\d.]+)?\s*\)$/i;function w(e){return"string"==typeof e.value&&("color"===e.type||function(e){const o=e.trim();return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(o)||z.test(o)||/^hsla?\(/i.test(o)}(e.value))}function F(e,o={}){const r=function(e){const o=new Map(e.map(e=>[e.path,e])),r=(e,a)=>{if(a>8||"string"!=typeof e)return e;const t=e.match(S);if(!t)return e;const i=o.get(t[1]);return i?r(i.value,a+1):e};return e.map(e=>({...e,value:r(e.value,0)}))}(function(e){const o=[],r=(e,a,t)=>{if(!e||"object"!=typeof e)return;const i=e,c=i.$type??t;if(function(e){return!!e&&"object"==typeof e&&"$value"in e}(i))o.push({path:a.join("."),leaf:a[a.length-1]??"",value:i.$value,type:i.$type??t});else for(const[e,o]of Object.entries(i))e.startsWith("$")||r(o,[...a,e],c)};return r(e,[]),o}(e)),a=new Map(r.map(e=>[e.path,e])),t=new Set,i={};for(const[e,r]of Object.entries(o.mapping??{})){if("fontFamily"===e||"categorical"===e)continue;const o=r?a.get(r):void 0;o&&"string"==typeof o.value&&(i[e]=o.value,t.add(o.path))}for(const e of r){const o=e.path.match(/^semiotic\.([^.]+)$/),r=o?k[o[1]]:void 0;r&&!(r in i)&&"string"==typeof e.value&&(i[r]=e.value,t.add(e.path))}for(const[e,o]of v){if(e in i)continue;const a=r.find(e=>!t.has(e.path)&&w(e)&&o.test(e.leaf.toLowerCase()));a&&"string"==typeof a.value&&(i[e]=a.value,t.add(a.path))}let c;const n=o.mapping?.categorical,s=(n?a.get(n):void 0)??a.get("semiotic.categorical")??r.find(e=>Array.isArray(e.value)&&/categor|chart|palette|qualitative|series/i.test(e.path));if(s&&Array.isArray(s.value))c=s.value.filter(e=>"string"==typeof e);else{const e=r.filter(e=>w(e)&&/(^|\.)(categorical|chart|palette|qualitative|series)\b/i.test(e.path));2>e.length||(c=e.map(e=>e.value))}const l=(o.mapping?.fontFamily?a.get(o.mapping.fontFamily):void 0)??a.get("semiotic.font-family")??r.find(e=>("fontFamily"===e.type||/font-?family|typeface/i.test(e.leaf))&&("string"==typeof e.value||Array.isArray(e.value))),f=l?Array.isArray(l.value)?l.value.join(", "):"string"==typeof l.value?l.value:void 0:void 0,d=function(e){if("string"!=typeof e)return null;const o=e.trim();let r=o.replace(/^#/,"");if(3===r.length&&(r=r.split("").map(e=>e+e).join("")),/^[0-9a-f]{6}$/i.test(r))return parseInt(r.slice(0,2),16)/255*.2126+parseInt(r.slice(2,4),16)/255*.7152+parseInt(r.slice(4,6),16)/255*.0722;const a=o.match(z);if(a){const e=Number(a[1])/255,o=Number(a[2])/255,r=Number(a[3])/255;return[e,o,r].some(e=>Number.isNaN(e)||0>e||e>1)?null:.2126*e+.7152*o+.0722*r}return null}(i.background),u=o.base?.mode??(null!=d?.5>d?"dark":"light":p.mode),y=o.base??("dark"===u?g:p);return{...y,mode:u,colors:{...y.colors,...i,...c&&c.length>0?{categorical:c}:{}},typography:{...y.typography,...f?{fontFamily:f}:{}}}}var R={mode:"light",colors:{primary:"#c9a0dc",secondary:"#b8a8c8",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#fdf6f0",surface:"#fff5ee",text:"#4a3728",textSecondary:"#7a644a",grid:"#e8d5c4",border:"#e8d5c4",focus:"#8a5fae",annotation:"#8a5fae",success:"#9ad4a3",danger:"#e8869a",warning:"#f0c888",error:"#c86070",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#fff5ee",text:"#4a3728",borderRadius:"8px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"10px"},q={mode:"dark",colors:{primary:"#c9a0dc",secondary:"#a899c0",categorical:["#f0a0c0","#88d4ab","#b0a0e8","#f0c888"],sequential:"purples",background:"#1a1525",surface:"#251e35",text:"#e8ddf0",textSecondary:"#a899c0",grid:"#3d3455",border:"#3d3455",focus:"#c9a0dc",annotation:"#c9a0dc",success:"#88d4ab",danger:"#f0a0c0",warning:"#f0c888",error:"#e87690",info:"#9cb8e0"},typography:{fontFamily:"Inter, system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#251e35",text:"#e8ddf0",borderRadius:"8px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"10px"},N={mode:"light",colors:{primary:"#2563eb",secondary:"#6b7280",categorical:["#2563eb","#0d9488","#ea580c","#6b7280"],sequential:"blues",background:"#f5f6f8",surface:"#ffffff",text:"#2c3e50",textSecondary:"#64717f",grid:"#d8dce3",border:"#d8dce3",focus:"#2563eb",annotation:"#2563eb",success:"#10b981",danger:"#ef4444",warning:"#f59e0b",error:"#dc2626",info:"#2563eb"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2c3e50",borderRadius:"6px",shadow:"0 2px 8px rgba(0, 0, 0, 0.12)"},borderRadius:"8px"},A={mode:"dark",colors:{primary:"#3b82f6",secondary:"#9ca3af",categorical:["#3b82f6","#14b8a6","#f97316","#9ca3af"],sequential:"blues",background:"#111827",surface:"#1f2937",text:"#f3f4f6",textSecondary:"#9ca3af",grid:"#374151",border:"#374151",focus:"#3b82f6",annotation:"#3b82f6",success:"#34d399",danger:"#f87171",warning:"#fbbf24",error:"#ef4444",info:"#60a5fa"},typography:{fontFamily:"'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f2937",text:"#f3f4f6",borderRadius:"6px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"8px"},j={mode:"light",colors:{primary:"#cc0000",secondary:"#666666",categorical:["#cc0000","#333333","#c8a415","#4682b4"],sequential:"reds",background:"#fafafa",surface:"#ffffff",text:"#1a1a1a",textSecondary:"#666666",grid:"#e0e0e0",border:"#e0e0e0",focus:"#cc0000",annotation:"#cc0000",success:"#556b2f",danger:"#cc0000",warning:"#c8a415",error:"#8b0000",info:"#4682b4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#1a1a1a",borderRadius:"2px",shadow:"0 2px 4px rgba(0, 0, 0, 0.15)"},borderRadius:"2px"},B={mode:"dark",colors:{primary:"#ff3333",secondary:"#aaaaaa",categorical:["#ff3333","#aaaaaa","#d4a843","#6aa4d4"],sequential:"reds",background:"#0a0a0a",surface:"#1a1a1a",text:"#f5f5f5",textSecondary:"#aaaaaa",grid:"#333333",border:"#333333",focus:"#ff3333",annotation:"#ff3333",success:"#7a8b5a",danger:"#ff3333",warning:"#d4a843",error:"#cc0000",info:"#6aa4d4"},typography:{fontFamily:"'Helvetica Neue', Helvetica, Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1a1a1a",text:"#f5f5f5",borderRadius:"2px",shadow:"0 2px 8px rgba(0, 0, 0, 0.5)"},borderRadius:"2px"},O={mode:"light",colors:{primary:"#8b0000",secondary:"#555555",categorical:["#8b4513","#556b2f","#4a5568","#800020"],sequential:"oranges",background:"#fffff8",surface:"#fffff8",text:"#111111",textSecondary:"#555555",grid:"#e0ddd0",border:"#e0ddd0",focus:"#8b0000",annotation:"#8b0000",success:"#556b2f",danger:"#8b0000",warning:"#b88700",error:"#6b0000",info:"#4a5568"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#fffff8",text:"#111111",borderRadius:"2px",shadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},borderRadius:"0px"},C={mode:"dark",colors:{primary:"#c05050",secondary:"#a09880",categorical:["#c08050","#7a8b5a","#8090a0","#a05060"],sequential:"oranges",background:"#1c1b18",surface:"#262520",text:"#e8e4d8",textSecondary:"#a09880",grid:"#3d3c35",border:"#3d3c35",focus:"#c05050",annotation:"#d06a6a",success:"#7a8b5a",danger:"#c05050",warning:"#c8a060",error:"#a04040",info:"#8090a0"},typography:{fontFamily:"Georgia, 'Times New Roman', serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262520",text:"#e8e4d8",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.4)"},borderRadius:"0px"},I={mode:"light",colors:{primary:"#e45050",secondary:"#666666",categorical:["#3a86c8","#e45050","#d4a843","#888888"],sequential:"blues",background:"#ffffff",surface:"#f8f8f8",text:"#222222",textSecondary:"#666666",grid:"#d4d4d4",border:"#d4d4d4",focus:"#e45050",annotation:"#c63b3b",success:"#2d7a3d",danger:"#c8303a",warning:"#d4a843",error:"#a02028",info:"#3a86c8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:18,labelSize:12,tickSize:12,tickFontFamily:"'Courier New', Courier, monospace",legendSize:11},tooltip:{background:"#f8f8f8",text:"#222222",borderRadius:"4px",shadow:"0 2px 6px rgba(0, 0, 0, 0.12)"},borderRadius:"4px"},M={mode:"dark",colors:{primary:"#ff6b6b",secondary:"#a0a0a0",categorical:["#5a9fd8","#ff6b6b","#e0c060","#aaaaaa"],sequential:"blues",background:"#141414",surface:"#1e1e1e",text:"#ededed",textSecondary:"#a0a0a0",grid:"#383838",border:"#383838",focus:"#ff6b6b",annotation:"#ff6b6b",success:"#6fba78",danger:"#ff6b6b",warning:"#e0c060",error:"#d04040",info:"#5a9fd8"},typography:{fontFamily:"'Franklin Gothic Medium', 'Libre Franklin', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1e1e1e",text:"#ededed",borderRadius:"4px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"4px"},H={mode:"light",colors:{primary:"#8b5cf6",secondary:"#7c5a9e",categorical:["#8b5cf6","#ec4899","#06b6d4","#84cc16"],sequential:"viridis",background:"#fdf8ff",surface:"#ffffff",text:"#2d1b4e",textSecondary:"#7c5a9e",grid:"#e8d0f8",border:"#e8d0f8",focus:"#8b5cf6",annotation:"#7a47e8",success:"#10d870",danger:"#ff4b6e",warning:"#ffaa33",error:"#e11d48",info:"#06b6d4"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#2d1b4e",borderRadius:"12px",shadow:"0 4px 12px rgba(139, 92, 246, 0.15)"},borderRadius:"12px"},P={mode:"dark",colors:{primary:"#a78bfa",secondary:"#b8a0d8",categorical:["#a78bfa","#f472b6","#22d3ee","#a3e635"],sequential:"viridis",background:"#150a28",surface:"#1f1138",text:"#f0e8ff",textSecondary:"#b8a0d8",grid:"#3a2560",border:"#3a2560",focus:"#a78bfa",annotation:"#a78bfa",success:"#4ade80",danger:"#fb7185",warning:"#fbbf24",error:"#f43f5e",info:"#22d3ee"},typography:{fontFamily:"'Nunito', 'Poppins', system-ui, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#1f1138",text:"#f0e8ff",borderRadius:"12px",shadow:"0 4px 12px rgba(0, 0, 0, 0.4)"},borderRadius:"12px"},E=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"],G={danger:"#da1e28",warning:"#f1c21b",success:"#24a148",info:"#0043ce"},T={mode:"light",colors:{primary:"#0f62fe",secondary:"#525252",categorical:["#6929c4","#1192e8","#005d5d","#9f1853"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#161616",textSecondary:"#525252",grid:"#e0e0e0",border:"#e0e0e0",focus:"#0f62fe",annotation:"#0f62fe",success:"#24a148",danger:"#da1e28",warning:"#f1c21b",error:"#a2191f",info:"#0043ce"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#ffffff",text:"#161616",borderRadius:"2px",shadow:"0 2px 6px rgba(0, 0, 0, 0.2)"},borderRadius:"0px"},L={mode:"dark",colors:{primary:"#4589ff",secondary:"#a8a8a8",categorical:["#a56eff","#33b1ff","#08bdba","#ff7eb6"],sequential:"blues",diverging:"RdBu",background:"#161616",surface:"#262626",text:"#f4f4f4",textSecondary:"#a8a8a8",grid:"#393939",border:"#393939",focus:"#4589ff",annotation:"#4589ff",success:"#42be65",danger:"#fa4d56",warning:"#f1c21b",error:"#da1e28",info:"#4589ff"},typography:{fontFamily:"'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif",titleSize:16,labelSize:12,tickSize:12},tooltip:{background:"#262626",text:"#f4f4f4",borderRadius:"2px",shadow:"0 4px 12px rgba(0, 0, 0, 0.5)"},borderRadius:"0px"},U={light:p,dark:g,"high-contrast":y,pastels:R,"pastels-dark":q,"bi-tool":N,"bi-tool-dark":A,italian:j,"italian-dark":B,tufte:O,"tufte-dark":C,journalist:I,"journalist-dark":M,playful:H,"playful-dark":P,carbon:T,"carbon-dark":L};function V(e){return U[e]}export{n as createStore,l as hasOwnEnumerableKey,f as resolveThemeSemanticColors,d as applyThemeAccessibility,u as COLOR_BLIND_SAFE_CATEGORICAL,p as LIGHT_THEME,g as DARK_THEME,y as HIGH_CONTRAST_THEME,b as resolveThemeUpdate,m as ThemeProvider,h as useThemeSelector,x as themeToCSS,$ as themeToTokens,F as designTokensToTheme,R as PASTELS_LIGHT,q as PASTELS_DARK,N as BI_TOOL_LIGHT,A as BI_TOOL_DARK,j as ITALIAN_LIGHT,B as ITALIAN_DARK,O as TUFTE_LIGHT,C as TUFTE_DARK,I as JOURNALIST_LIGHT,M as JOURNALIST_DARK,H as PLAYFUL_LIGHT,P as PLAYFUL_DARK,E as CARBON_CATEGORICAL_14,G as CARBON_ALERT,T as CARBON_LIGHT,L as CARBON_DARK,U as THEME_PRESETS,V as resolveThemePreset};