semiotic 3.8.5 → 3.8.7
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.
- package/CLAUDE.md +37 -10
- package/README.md +83 -56
- package/ai/behaviorContracts.cjs +88 -3
- package/ai/componentMetadata.cjs +5 -10
- package/ai/dist/mcp-server.js +99 -10
- package/ai/examples.md +198 -9
- package/ai/schema.json +2002 -165
- package/ai/surface-manifest.json +14 -10
- package/ai/system-prompt.md +9 -3
- package/dist/{chunk-chartContainerDataAudit-74TLKIP6.module.min.js → chunk-chartContainerDataAudit-JDSVSKGM.module.min.js} +1 -1
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +1 -0
- package/dist/chunk-chunk-2YAZHXL4.module.min.js +2 -0
- package/dist/chunk-chunk-3NGIKFD6.module.min.js +1 -0
- package/dist/{chunk-chunk-G7WFWHAD.module.min.js → chunk-chunk-4ITOQRXM.module.min.js} +1 -1
- package/dist/chunk-chunk-5SD6BHVW.module.min.js +2 -0
- package/dist/chunk-chunk-6V5VQVCT.module.min.js +2 -0
- package/dist/chunk-chunk-7TTBHSAG.module.min.js +2 -0
- package/dist/chunk-chunk-7ZDJSYKI.module.min.js +2 -0
- package/dist/chunk-chunk-BGHPD3RA.module.min.js +1 -0
- package/dist/chunk-chunk-BMRZ2SPU.module.min.js +2 -0
- package/dist/chunk-chunk-BNGBEY7N.module.min.js +2 -0
- package/dist/chunk-chunk-C7APLVQD.module.min.js +2 -0
- package/dist/chunk-chunk-DGWFBOGB.module.min.js +1 -0
- package/dist/chunk-chunk-DIVE2DRA.module.min.js +2 -0
- package/dist/chunk-chunk-FBUNUIPV.module.min.js +2 -0
- package/dist/chunk-chunk-FQPKOAIH.module.min.js +2 -0
- package/dist/chunk-chunk-FRO4TRXK.module.min.js +2 -0
- package/dist/chunk-chunk-G7QVPZUD.module.min.js +2 -0
- package/dist/chunk-chunk-GBPYV4FP.module.min.js +2 -0
- package/dist/chunk-chunk-GU2EJIDJ.module.min.js +2 -0
- package/dist/chunk-chunk-J5QD4RAM.module.min.js +2 -0
- package/dist/{chunk-chunk-LJLS6DY7.module.min.js → chunk-chunk-JWXLNZSM.module.min.js} +1 -1
- package/dist/chunk-chunk-KXAFCCDB.module.min.js +2 -0
- package/dist/chunk-chunk-LG7YKJAK.module.min.js +2 -0
- package/dist/{chunk-chunk-I36PJ4OC.module.min.js → chunk-chunk-LVHDZAT3.module.min.js} +1 -1
- package/dist/chunk-chunk-LWITSR2O.module.min.js +2 -0
- package/dist/chunk-chunk-MX35T6RX.module.min.js +2 -0
- package/dist/chunk-chunk-NH4MEAKP.module.min.js +2 -0
- package/dist/chunk-chunk-NJETWX42.module.min.js +2 -0
- package/dist/chunk-chunk-NW25WGLS.module.min.js +2 -0
- package/dist/{chunk-chunk-TMWIZL3K.module.min.js → chunk-chunk-OI7R7EJB.module.min.js} +1 -1
- package/dist/chunk-chunk-ONMLEXHR.module.min.js +2 -0
- package/dist/chunk-chunk-OY66GCE6.module.min.js +1 -0
- package/dist/chunk-chunk-PZFT457G.module.min.js +1 -0
- package/dist/chunk-chunk-Q3WW6JGR.module.min.js +1 -0
- package/dist/chunk-chunk-Q6XKQTOQ.module.min.js +1 -0
- package/dist/chunk-chunk-RJRM2E6P.module.min.js +1 -0
- package/dist/chunk-chunk-RPL7WYXI.module.min.js +1 -0
- package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
- package/dist/chunk-chunk-TSCFL235.module.min.js +1 -0
- package/dist/chunk-chunk-UOQRPGPK.module.min.js +2 -0
- package/dist/chunk-chunk-V3OAKG32.module.min.js +1 -0
- package/dist/chunk-chunk-WLOIUMWG.module.min.js +2 -0
- package/dist/chunk-chunk-XEGXX4F7.module.min.js +1 -0
- package/dist/chunk-chunk-XFRBLXYM.module.min.js +1 -0
- package/dist/chunk-chunk-Z2AJERX5.module.min.js +2 -0
- package/dist/chunk-chunk-ZXYDYAB7.module.min.js +2 -0
- package/dist/components/ai/SemioticVACPBridge.d.ts +22 -0
- package/dist/components/ai/chartCapabilities.d.ts +5 -3
- package/dist/components/ai/conversationArc.d.ts +2 -176
- package/dist/components/ai/conversationArcTypes.d.ts +202 -0
- package/dist/components/ai/readerGrounding.d.ts +12 -0
- package/dist/components/ai/vacpAdapter.d.ts +13 -0
- package/dist/components/ai/vacpAdapterActions.d.ts +2 -0
- package/dist/components/ai/vacpAdapterModel.d.ts +7 -0
- package/dist/components/ai/vacpAdapterRuntime.d.ts +26 -0
- package/dist/components/ai/vacpAdapterState.d.ts +3 -0
- package/dist/components/ai/vacpAdapterTypes.d.ts +169 -0
- package/dist/components/ai/vacpTypes.d.ts +160 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
- package/dist/components/charts/geo/DistanceCartogram.d.ts +1 -1
- package/dist/components/charts/index.d.ts +7 -4
- package/dist/components/charts/ordinal/BarChart.d.ts +7 -14
- package/dist/components/charts/ordinal/GaugeChart.d.ts +3 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +3 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +3 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +4 -14
- package/dist/components/charts/physics/ChainReactionChart.capability.d.ts +9 -0
- package/dist/components/charts/physics/ChainReactionChart.d.ts +29 -0
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +1 -1
- package/dist/components/charts/physics/EventDropChart.d.ts +7 -2
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +1 -1
- package/dist/components/charts/physics/{PhysicsPileChart.capability.d.ts → PacketFlowChart.capability.d.ts} +1 -1
- package/dist/components/charts/physics/{PhysicalFlowChart.d.ts → PacketFlowChart.d.ts} +22 -6
- package/dist/components/charts/physics/PhysicsCustomChart.d.ts +1 -1
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +7 -4
- package/dist/components/charts/physics/{PhysicalFlowChart.capability.d.ts → UnitPileChart.capability.d.ts} +1 -1
- package/dist/components/charts/physics/{PhysicsPileChart.d.ts → UnitPileChart.d.ts} +19 -6
- package/dist/components/charts/physics/crucibleChartProps.d.ts +1 -1
- package/dist/components/charts/physics/crucibleChartUtils.d.ts +9 -0
- package/dist/components/charts/physics/gauntletChartProps.d.ts +6 -1
- package/dist/components/charts/physics/gauntletTerminal.d.ts +61 -0
- package/dist/components/charts/physics/packetFlowSemantics.d.ts +6 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +45 -2
- package/dist/components/charts/shared/auditAccessibilityStyles.d.ts +9 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +2 -4
- package/dist/components/charts/shared/gaugeGradient.d.ts +4 -8
- package/dist/components/charts/shared/gradient.d.ts +35 -0
- package/dist/components/charts/shared/hatchFill.d.ts +3 -10
- package/dist/components/charts/shared/hooks.d.ts +2 -50
- package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +1 -2
- package/dist/components/charts/shared/useChartLegend.d.ts +65 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +12 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +6 -1
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -0
- package/dist/components/charts/shared/useStreamingLegend.d.ts +1 -1
- package/dist/components/charts/xy/AreaChart.d.ts +25 -42
- package/dist/components/charts/xy/BumpChart.capability.d.ts +11 -0
- package/dist/components/charts/xy/BumpChart.d.ts +161 -0
- package/dist/components/charts/xy/DifferenceChart.d.ts +3 -10
- package/dist/components/charts/xy/Heatmap.d.ts +3 -0
- package/dist/components/charts/xy/LineChart.d.ts +6 -8
- package/dist/components/data/portability/capabilityBinding.d.ts +41 -0
- package/dist/components/data/portability/index.d.ts +2 -0
- package/dist/components/geometry/bumpRibbonGeometry.d.ts +36 -0
- package/dist/components/legendLayout.d.ts +75 -1
- package/dist/components/recipes/geographicDotGrid.d.ts +82 -0
- package/dist/components/recipes/geographicGrid.d.ts +100 -0
- package/dist/components/recipes/physics.d.ts +2 -0
- package/dist/components/recipes/physicsStageGeography.d.ts +137 -0
- package/dist/components/semiotic-ai.d.ts +6 -4
- package/dist/components/semiotic-experimental-vacp.d.ts +11 -0
- package/dist/components/semiotic-experimental.d.ts +6 -3
- package/dist/components/semiotic-geo.d.ts +5 -0
- package/dist/components/semiotic-network.d.ts +1 -0
- package/dist/components/semiotic-ordinal.d.ts +2 -0
- package/dist/components/semiotic-physics.d.ts +10 -6
- package/dist/components/semiotic-realtime-core.d.ts +1 -0
- package/dist/components/semiotic-recipes-core.d.ts +6 -1
- package/dist/components/semiotic-server-edge.d.ts +1 -1
- package/dist/components/semiotic-server.d.ts +1 -1
- package/dist/components/semiotic-xy.d.ts +4 -0
- package/dist/components/semiotic.d.ts +4 -4
- package/dist/components/server/renderEvidence.d.ts +1 -1
- package/dist/components/server/renderToStaticSVG.d.ts +2 -1
- package/dist/components/server/serverChartConfigHeatmap.d.ts +6 -0
- package/dist/components/server/serverChartConfigNetworkStyles.d.ts +12 -0
- package/dist/components/server/serverChartConfigShared.d.ts +16 -0
- package/dist/components/server/serverChartConfigs.d.ts +3 -2
- package/dist/components/server/serverChartConfigsPhysics.d.ts +2 -2
- package/dist/components/server/serverChartConfigsXY.d.ts +1 -1
- package/dist/components/server/staticLegend.d.ts +10 -2
- package/dist/components/server/staticSVGChrome.d.ts +14 -6
- package/dist/components/server/staticValue.d.ts +8 -0
- package/dist/components/stream/GeoSVGOverlay.d.ts +4 -10
- package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -6
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -6
- package/dist/components/stream/SVGOverlay.d.ts +2 -6
- package/dist/components/stream/StalenessBadge.d.ts +2 -6
- package/dist/components/stream/geoPipelineConfig.d.ts +10 -0
- package/dist/components/stream/geoTypes.d.ts +3 -6
- package/dist/components/stream/legendRenderer.d.ts +10 -6
- package/dist/components/stream/ordinalTypes.d.ts +7 -31
- package/dist/components/stream/physics/PhysicsEvidence.d.ts +37 -0
- package/dist/components/stream/physics/PhysicsKernel.d.ts +1 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +9 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +2 -6
- package/dist/components/stream/physics/PhysicsSettledScene.d.ts +5 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +2 -6
- package/dist/components/stream/physics/physicsFramePipelineConfig.d.ts +19 -0
- package/dist/components/stream/physics/physicsPipelineSettle.d.ts +52 -0
- package/dist/components/stream/physics/physicsRegionRuntime.d.ts +23 -0
- package/dist/components/stream/pipelineConfig.d.ts +7 -15
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +9 -69
- package/dist/components/stream/renderers/cornerRadii.d.ts +2 -9
- package/dist/components/stream/renderers/thresholdLineSegments.d.ts +12 -0
- package/dist/components/stream/sceneToSVGShared.d.ts +3 -5
- package/dist/components/stream/types.d.ts +34 -56
- package/dist/components/stream/xySceneBuilders/areaGradient.d.ts +4 -20
- package/dist/components/stream/xySceneBuilders/types.d.ts +6 -6
- package/dist/components/types/legendTypes.d.ts +31 -6
- package/dist/controls.min.js +1 -1
- package/dist/controls.module.min.js +1 -1
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +6 -4
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental-vacp.d.ts +11 -0
- package/dist/semiotic-experimental-vacp.min.js +1 -0
- package/dist/semiotic-experimental-vacp.module.min.js +1 -0
- package/dist/semiotic-experimental.d.ts +6 -3
- package/dist/semiotic-experimental.min.js +2 -1
- package/dist/semiotic-experimental.module.min.js +2 -1
- package/dist/semiotic-geo.d.ts +5 -0
- package/dist/semiotic-network.d.ts +1 -0
- package/dist/semiotic-ordinal.d.ts +2 -0
- package/dist/semiotic-physics.d.ts +10 -6
- package/dist/semiotic-realtime-core.d.ts +1 -0
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +6 -1
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.d.ts +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-server.d.ts +1 -1
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +4 -0
- package/dist/semiotic.d.ts +4 -4
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +18 -2
- package/spec/README.md +94 -2
- package/spec/bindings/README.md +14 -3
- package/spec/v0.1/examples/annotation-provenance-reviewed-revision.json +27 -0
- package/spec/v0.1/examples/annotation-provenance-watcher-threshold.json +21 -0
- package/spec/v0.1/examples/audience-profile-executive-review.json +24 -0
- package/spec/v0.1/examples/audience-profile-incident-operators.json +42 -0
- package/spec/v0.1/examples/chart-capability-bar-comparison.json +48 -0
- package/spec/v0.1/examples/chart-capability-service-flow.json +54 -0
- package/dist/chunk-chunk-4AANPFOX.module.min.js +0 -2
- package/dist/chunk-chunk-5I3UZV4Q.module.min.js +0 -2
- package/dist/chunk-chunk-5RKXZQ2P.module.min.js +0 -1
- package/dist/chunk-chunk-74CCPVXB.module.min.js +0 -1
- package/dist/chunk-chunk-7ALTGHK6.module.min.js +0 -1
- package/dist/chunk-chunk-ANYDWOZF.module.min.js +0 -1
- package/dist/chunk-chunk-AVBI6GDT.module.min.js +0 -1
- package/dist/chunk-chunk-BANTPINB.module.min.js +0 -2
- package/dist/chunk-chunk-C4YA6TDR.module.min.js +0 -1
- package/dist/chunk-chunk-C57LR3YG.module.min.js +0 -1
- package/dist/chunk-chunk-CKMD5NV3.module.min.js +0 -2
- package/dist/chunk-chunk-CO5KQMGH.module.min.js +0 -1
- package/dist/chunk-chunk-CWQ5YIHX.module.min.js +0 -2
- package/dist/chunk-chunk-E6TXX6MI.module.min.js +0 -1
- package/dist/chunk-chunk-GMQ5AYTD.module.min.js +0 -1
- package/dist/chunk-chunk-JCG72SGW.module.min.js +0 -2
- package/dist/chunk-chunk-K3DMEW22.module.min.js +0 -1
- package/dist/chunk-chunk-KT2VAZMZ.module.min.js +0 -1
- package/dist/chunk-chunk-L6EA5V3G.module.min.js +0 -2
- package/dist/chunk-chunk-LJPCLYSC.module.min.js +0 -2
- package/dist/chunk-chunk-LRIFN2HK.module.min.js +0 -1
- package/dist/chunk-chunk-N5DDKCCF.module.min.js +0 -1
- package/dist/chunk-chunk-NEVE562N.module.min.js +0 -1
- package/dist/chunk-chunk-NLO44TOS.module.min.js +0 -2
- package/dist/chunk-chunk-PZJ2SBLL.module.min.js +0 -2
- package/dist/chunk-chunk-QSQVBIJA.module.min.js +0 -1
- package/dist/chunk-chunk-QUJ6TTLY.module.min.js +0 -1
- package/dist/chunk-chunk-RBIDBUT4.module.min.js +0 -2
- package/dist/chunk-chunk-RCF52Z42.module.min.js +0 -2
- package/dist/chunk-chunk-RFLAG356.module.min.js +0 -1
- package/dist/chunk-chunk-RPU4IZAV.module.min.js +0 -2
- package/dist/chunk-chunk-SKMBCFIL.module.min.js +0 -2
- package/dist/chunk-chunk-TAE7W424.module.min.js +0 -2
- package/dist/chunk-chunk-TUBMTZMU.module.min.js +0 -2
- package/dist/chunk-chunk-UFFEXJQY.module.min.js +0 -1
- package/dist/chunk-chunk-XSCHTS4D.module.min.js +0 -2
- package/dist/chunk-chunk-XXWSHGPL.module.min.js +0 -2
- package/dist/chunk-chunk-ZOAQDIJO.module.min.js +0 -1
- package/dist/chunk-chunk-ZXIXAPRE.module.min.js +0 -2
- package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +0 -1
- package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useReducedMotion as t,useTheme as e}from"./chunk-chunk-XEVJDUTH.module.min.js";import{IncrementalExtent as n,RingBuffer as r,annotationActivationProps as o,buildHoverData as i,coerceDateLikeValue as a,defaultTooltipStyle as s,extractAllRows as l,getHitRadius as c,getPointerHitRadius as u,hatchPatternDef as h,hitTestRect as d,isAnnotationActivationTarget as f,isHatchFill as y,isTimeLandmark as p,parseDateLikeString as g,resolveHatchCanvasPattern as m,resolveResponsiveRules as x,resolveSvgFill as b,smartTooltipEntries as v,useAnnotationActivationOptions as k,useObservationSelector as w}from"./chunk-chunk-OY66GCE6.module.min.js";import{FrameRuntime as A,SEQUENTIAL_INTERPOLATORS as M,SYMBOL_SEQUENCE as S,UpdateResultTracker as $,annotationLayout as P,drawGlyphParts as C,forceLayoutPlugin as L,getSequentialInterpolator as _,glyphFractionClipRect as T,glyphHitGeometry as D,glyphPlacement as R,isInBounds as W,resolveAnchoredPosition as E,resolveGlyphPaint as N,resolveX as I,resolveY as O,schemeCategory10 as F,schemeSet3 as z,schemeTableau10 as Y,symbolPathString as B,symbolRadius as j,wrapWithCustomLayoutSelection as G,wrapWithDataHint as X}from"./chunk-chunk-PZFT457G.module.min.js";import{accessorsEquivalent as H,bandFromAge as V,filterAnnotationsByStatus as q,resolveAccessor as U,resolveRawAccessor as Z,resolveStringAccessor as K}from"./chunk-chunk-XFRBLXYM.module.min.js";import{getMax as J,getMinMax as Q}from"./chunk-chunk-JJ2OOIET.module.min.js";import{clearCSSColorCache as tt,getCSSColorCacheVersion as et,resolveCSSColor as nt}from"./chunk-chunk-IY7RYD4S.module.min.js";import{createStore as rt,resolveThemeSemanticColors as ot,useThemeSelector as it}from"./chunk-chunk-DSNGDNJY.module.min.js";function at(t,e,n){if(null!=t)return"function"==typeof t?t(e,n):"object"==typeof t&&null!==t&&"constant"in t?t.constant:e[t]}function st(t){const{data:e,encoding:n}=t,r=[],o=new Map;return e.forEach((t,e)=>{const i=at(n.id,t,e);if(null==i||""===i)throw Error(`[semiotic] Motion encoding row ${e} resolved an empty id.`);const a=i+"";if(o.has(a))throw Error(`[semiotic] Duplicate motion encoding id "${a}".`);const s=at(n.process?.group,t,e),l=at(n.process?.stage,t,e),c=at(n.accessible?.group,t,e)??(null!=s?s+"":null!=l?l+"":void 0),u={};for(const r of Object.keys(n.evidence??{}))u[r]=at(n.evidence?.[r],t,e);const h={id:a,datum:t,time:{arrival:at(n.time?.arrival,t,e),basis:n.time?.basis,unit:n.time?.unit},placement:{x:at(n.placement?.x,t,e),y:at(n.placement?.y,t,e),lane:at(n.placement?.lane,t,e),space:n.placement?.space},kinematics:{velocityX:at(n.kinematics?.velocityX,t,e),velocityY:at(n.kinematics?.velocityY,t,e),space:n.kinematics?.space},process:{group:s,stage:l,target:at(n.process?.target,t,e),work:at(n.process?.work,t,e)},evidence:u,accessible:{description:at(n.accessible?.description,t,e),group:c,label:at(n.accessible?.label,t,e)??a}};r.push(h),o.set(a,h)}),{rows:r,byId:o}}function lt(t){const e=Math.max(0,Math.min(1,t.minOpacity??.1));if(Number.isNaN(t.age))return 1;if(t.age===1/0)return e;if(!Number.isFinite(t.extent)||0>=t.extent)return 1;const n=Math.max(0,t.age);if("step"===t.type)return(t.threshold??.5*t.extent)>n?1:e;if("exponential"===t.type){const r=t.halfLife??t.extent/2;return e+Math.pow(.5,n/(r>0?r:t.extent/2))*(1-e)}return e+Math.max(0,Math.min(1,1-n/t.extent))*(1-e)}function ct(t,e){const n=Number.isFinite(t)?t:0,r=Number.isFinite(e)?e:0;return{velocityX:n,velocityY:r,speed:Math.hypot(n,r),direction:Math.atan2(r,n)}}function ut(t,e,n){return Number.isFinite(n)&&n>0?ct((e.x-t.x)/n,(e.y-t.y)/n):ct(0,0)}import*as ht from"react";import{useRef as dt,useState as ft,useEffect as yt,useMemo as pt,useCallback as gt,useImperativeHandle as mt,useId as xt,forwardRef as bt,memo as vt}from"react";import*as kt from"react";import{jsx as wt}from"react/jsx-runtime";var At=null,Mt=null;function St(t){const[e,n]=kt.useState(()=>At);return kt.useEffect(()=>{if(e)return;let t=!1;return(At?Promise.resolve(At):(Mt||(Mt=import("./chunk-XYBrushOverlay-ECZJJLAJ.module.min.js").then(t=>At=t.XYBrushOverlay).catch(t=>{throw Mt=null,t})),Mt)).then(e=>{t||n(()=>e)}),()=>{t=!0}},[e]),e?wt(e,{...t}):null}var $t=Object.freeze([]);function Pt(t){if(!t)return $t;let e=!1;for(let n=0;t.length>n;n++){const r=t[n];if(null==r||"object"!=typeof r){e=!0;break}}if(!e)return t;const n=[];for(const e of t)null!=e&&"object"==typeof e&&n.push(e);return n}var Ct=class{constructor(t,e){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=t,this.chunkThreshold=e?.chunkThreshold??5e3,this.chunkSize=e?.chunkSize??5e3}updateChunkOptions(t){null!=t.chunkThreshold&&(this.chunkThreshold=t.chunkThreshold),null!=t.chunkSize&&(this.chunkSize=t.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(t){if(t=Pt(t),this.lastBoundedData===t)return;if(this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const r=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,r),bounded:!1}),e=r,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(t){if(t=Pt(t),this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const r=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,r),bounded:!1}),e=r,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const t=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:t,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(t){null!=t&&"object"==typeof t&&(this.pushBuffer.push(t),this.scheduleFlush())}pushMany(t){if(0===t.length)return;let e=0;for(let n=0;t.length>n;n++){const r=t[n];null!=r&&"object"==typeof r&&(this.pushBuffer.push(r),e++)}0!==e&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}};function Lt(t){return new Set(Array.isArray(t)?t:[t])}import{scaleOrdinal as _t}from"d3-scale";var Tt={category10:F,tableau10:Y,set3:z,...M},Dt=F,Rt="#007bff";function Wt(t,e,n=Dt){if(t&&"object"==typeof t&&!Array.isArray(t)){const e=Object.values(t).filter(t=>"string"==typeof t&&t.length>0);if(e.length>0)return e}if(Array.isArray(t)&&t.length>0)return t;if("string"==typeof t){const e=Tt[t];if(Array.isArray(e)&&e.length>0)return e}return e&&e.length>0?e:n}var Et=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Nt=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],It=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function Ot(t,e,n){if("function"==typeof e){const r=e(t);return n&&r&&"string"==typeof r&&!function(t){const e=t.toLowerCase();return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")||It.has(e)}(r)?n(r):r}const r=t?.[e]+"";return n?n(r):Dt[Math.abs(function(t){let e=0;for(let n=0;t.length>n;n++)e=(e<<5)-e+t.charCodeAt(n),e&=e;return Math.abs(e)}(r))%Dt.length]}function Ft(t,e){if(null==e||!Object.prototype.hasOwnProperty.call(t,e))return;const n=t[e];return"string"==typeof n&&n.length>0?n:void 0}function zt(t,e,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const t=n;return e=>Ft(t,e)??"#999"}const r=Array.from(new Set(t.map(t=>t?.[e]).filter(t=>null!=t).map(t=>t+""))),o=r.every(t=>!isNaN(Number(t)));if(Array.isArray(n))return _t().domain(r).range(n).unknown("#999");const i=Tt[n]||Tt.category10;if(o&&"function"==typeof i){let t=-1/0;for(const e of r){const n=Number(e);n>t&&(t=n)}return e=>i(Number(e)/t)}{const t=Array.isArray(i)?i:Dt;return _t().domain(r).range(t).unknown("#999")}}function Yt(t,e,n=[3,20],r){let o;if(o="function"==typeof e?e(t):t?.[e],!r)return o;const[i,a]=r,[s,l]=n;if(a===i)return(s+l)/2;let c=(o-i)/(a-i);return 0>c?c=0:c>1&&(c=1),s+c*(l-s)}function Bt(t,e="ease-out-cubic"){return"linear"===e?t:1-Math.pow(1-t,3)}function jt(t,e){return Math.min((t-e.startTime)/e.duration,1)}function Gt(t,e,n){return t+(e-t)*n}function Xt(){return"undefined"!=typeof performance?performance.now():Date.now()}function Ht(t,e,n){if(1>=n)return 1;const r=n-1;return lt({age:r-e,extent:r,type:t.type,halfLife:t.halfLife??n/2,threshold:t.stepThreshold??.5*n,minOpacity:t.minOpacity??.1})}function Vt(t){const e=new Map;for(let n=0;t.length>n;n++)e.set(t[n],n);return e}function qt(t,e,n){const r=t.duration??500,o=n-e;return r>o?1-o/r:0}function Ut(t,e,n,r){let o=!1;return e>0?(t._pulseIntensity!==e&&(t._pulseIntensity=e,o=!0),t._pulseColor!==n&&(t._pulseColor=n,o=!0),t._pulseGlowRadius!==r&&(t._pulseGlowRadius=r,o=!0),o):(0!==t._pulseIntensity&&(t._pulseIntensity=0,o=!0),void 0!==t._pulseColor&&(t._pulseColor=void 0,o=!0),void 0!==t._pulseGlowRadius&&(t._pulseGlowRadius=void 0,o=!0),o)}function Zt(t,e,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!e||0===e.size)return!1;const r=t.duration??500,o=e.peek();return null!=o&&r>n-o}function Kt(t,e,n){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 n=t.getX(e.datum),r=t.getY(e.datum);if(t.getCategory)return`p:${t.getCategory(e.datum)}:${n}:${r}`;if(null!=n&&null!=r)return`p:${n}:${r}`}return"p:"+n;case"glyph":return e.pointId?"g:"+e.pointId:"g:"+n;case"rect":return`r:${e.group||""}:${e.datum?.binStart??e.datum?.category??n}`;case"heatcell":return`h:${e.x}_${e.y}`;case"candlestick":return null==e.datum?"c:"+n:"c:"+t.getX(e.datum);case"line":return"l:"+(e.group||"_default");case"area":return"a:"+(e.group||"_default");default:return null}}function Jt(t,e,n,r,o,i){const a=[];for(const o of t){const t=n(o),i=r(o);Number.isFinite(t)&&Number.isFinite(i)&&a.push({px:e.x(t),py:e.y(i),rawY:i,d:o})}a.sort((t,e)=>t.px-e.px);const s=Array(a.length),l=Array(a.length),c=Array(a.length);for(let t=0;a.length>t;t++){const e=a[t];s[t]=[e.px,e.py],l[t]=e.rawY,c[t]=e.d}return{type:"line",path:s,rawValues:l,style:o,datum:c,group:i}}function Qt(t,e,n,r,o,i,a,s){const l=[];for(const i of t){const t=n(i),a=r(i);if(!Number.isFinite(t)||!Number.isFinite(a))continue;const c=e.x(t),u=s?s(i):o;l.push({px:c,topY:e.y(a),botY:e.y(u),rawY:a})}l.sort((t,e)=>t.px-e.px);const c=Array(l.length),u=Array(l.length),h=Array(l.length);for(let t=0;l.length>t;t++){const e=l[t];c[t]=[e.px,e.topY],u[t]=[e.px,e.botY],h[t]=e.rawY}return{type:"area",topPath:c,bottomPath:u,rawValues:h,style:i,datum:t,group:a}}function te(t,e,n,r){const o=new Map;if("silhouette"===r)for(const r of t){let t=0;for(const o of e)t+=n(o,r)||0;o.set(r,-t/2)}else if("wiggle"===r){t.length>0&&o.set(t[0],0);for(let r=1;t.length>r;r++){const i=t[r-1],a=t[r];let s=0,l=0,c=0;for(const t of e){const e=n(t,a)||0;s+=(2*c+e)*(e-(n(t,i)||0)),l+=e,c+=e}const u=o.get(i)??0;o.set(a,u-(l>0?s/(2*l):0))}if(t.length>0){let r=0;for(const i of t){let t=0;for(const r of e)t+=n(r,i)||0;r+=(o.get(i)??0)+t/2}const i=r/t.length;for(const e of t)o.set(e,(o.get(e)??0)-i)}}else for(const e of t)o.set(e,0);return o}function ee(t,e,n,r,o,i,a){const s=n(t),l=r(t);if(!Number.isFinite(s)||!Number.isFinite(l))return null;const c={type:"point",x:e.x(s),y:e.y(l),r:o,style:i,datum:t};return void 0!==a&&(c.pointId=a),c}function ne(t,e,n,r,o,i,a,s){const l=n(t),c=r(t);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:e.x(l),y:e.y(c),size:o,symbolType:i,style:a,datum:t};return void 0!==s&&(u.pointId=s),u}function re(t,e,n,r,o,i,a){return{type:"rect",x:t,y:e,w:n,h:r,style:o,datum:i,group:a}}function oe(t,e,n,r,o,i,a){const s={type:"heatcell",x:t,y:e,w:n,h:r,fill:o,datum:i};return a?.showValues&&(s.showValues=!0,s.value=a.value,a.valueFormat&&(s.valueFormat=a.valueFormat)),s}function ie(t,e,n,r){return"function"==typeof e.style?e.style(r||{},n):e.style&&"object"==typeof e.style?e.style:t.resolveBoundsStyle(n,r)}function ae(t,e,n,r){if(!t.scales)return null;const o=[],i=[];for(const n of e){const e=t.getX(n);if(!Number.isFinite(e))continue;const a=r.getTop(n),s=r.getBottom(n);if(!Number.isFinite(a)||!Number.isFinite(s))continue;const l=t.scales.x(e),c=t.scales.y(a),u=t.scales.y(s);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(o.push([l,c]),i.push([l,u]))}return 2>o.length?null:{type:"area",topPath:o,bottomPath:i,...t.config.curve&&"linear"!==t.config.curve&&{curve:t.config.curve},style:ie(t,r,n,e[0]),datum:e,group:n,interactive:r.interactive}}function se(t){const e=[],n=[];if(!t)return{perSeries:e,aggregate:n};for(const r of t)r.perSeries?e.push(r):n.push(r);return{perSeries:e,aggregate:n}}function le(t,e,n){const r=[];for(const o of n){const n=ae(t,e,"__ribbon_aggregate",o);n&&r.push(n)}return r}function ce(t,e,n,r){const o=[];for(const i of r){const r=ae(t,e,n,i);r&&o.push(r)}return o}function ue(t,e){if(!t)return{};if(!e||0===e.length)return t;const n=[];for(const r of e){if("band"!==r.kind)continue;const e=r.getTop(t),o=r.getBottom(t);Number.isFinite(o)&&Number.isFinite(e)&&n.push({y0:o,y1:e})}return 0===n.length?t:{...t,band:n[0],bands:n}}function he(t,e,n,r){if(!t.config.pointStyle)return;const o=r??t.getY;for(const r of e){const e=t.resolveGroupColor(r.key);for(const i of r.data){let r=t.config.pointStyle(i);!r.fill&&e&&(r={...r,fill:e});const a=r.r??3,s=t.getPointId?t.getPointId(i)+"":void 0,l=ee(i,t.scales,t.getX,o,a,r,s);l&&n.push(l)}}}function de(t){return"threshold"===t.type&&"string"==typeof t.color&&"number"==typeof t.value}var fe={stops:[{offset:0,opacity:.8},{offset:1,opacity:.05}]};function ye(t,e=fe){if(t)return!0===t?e:"stops"in t?Array.isArray(t.stops)?t:void 0:"colorStops"in t?Array.isArray(t.colorStops)?{stops:t.colorStops.map(({offset:t,color:e})=>({offset:t,color:e}))}:void 0:{stops:[{offset:0,opacity:t.topOpacity??e.stops[0]?.opacity??.8},{offset:1,opacity:t.bottomOpacity??e.stops.at(-1)?.opacity??.05}]}}function pe(t){return t?ye(t):void 0}function ge(t){if(t)return Array.isArray(t)?{stops:t.map(({at:t,color:e,opacity:n})=>({offset:t/100,color:e,...null!=n&&{opacity:n}}))}:Array.isArray(t.stops)?t:void 0}function me(t){return{stops:t.stops.map(t=>({...t,offset:1-t.offset})).sort((t,e)=>t.offset-e.offset)}}function xe(t){return ye(t)}var be=new Map;function ve(t,e,n){const r=n.config.areaStyle?.(e);return r&&(t.style=r),t}function ke(t,e,n,r,o){const i=new Map;for(const a of t){const t=e(a),s=n(a);if(null==t||null==s||Number.isNaN(t)||Number.isNaN(s))continue;const l=Math.floor(t/r)*r;let c=i.get(l);if(c||(c={start:l,end:l+r,total:0,categories:new Map},i.set(l,c)),c.total+=s,o){const t=o(a);c.categories.set(t,(c.categories.get(t)||0)+s)}}return i}function we(t){if("production"===process.env.NODE_ENV)return;const{label:e,nodes:n,overlays:r,warned:o}=t;Ae(r)&&0===n.length&&Me(o,"overlay-only",`[semiotic] ${e} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(t=>null==t.datum)&&Me(o,"null-datums",`[semiotic] ${e} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function Ae(t){return null!=t&&!1!==t&&""!==t&&(!Array.isArray(t)||t.some(Ae))}function Me(t,e,n){t.has(e)||(t.add(e),console.warn(n))}function Se(t,e,n,r){const o=function(t){if(t instanceof Error)return{name:t.name||"Error",message:t.message||"Custom layout threw."};if("string"==typeof t)return{name:"Error",message:t};if(null==t)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:t+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(e),i="network"===t?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:t,source:i,message:`Semiotic ${t} ${i} failed: ${o.message}`,error:o,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}function $e(t,e){const n="function"==typeof t?t:n=>n[t||e];return t=>{const e=n(t);return null==e?NaN:+e}}function Pe(t){const e=[],n=["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode,r=$e(n&&t.valueAccessor||t.yAccessor,n?"value":"y");if(t.boundsAccessor){const n=U(t.boundsAccessor,"bounds");e.push({kind:"bounds",getTop:t=>{const e=r(t);if(!Number.isFinite(e))return NaN;const o=n(t);return Number.isFinite(o)&&0!==o?e+o:e},getBottom:t=>{const e=r(t);if(!Number.isFinite(e))return NaN;const o=n(t);return Number.isFinite(o)&&0!==o?e-o:e},style:t.boundsStyle,perSeries:!0,interactive:!1})}if(t.band){const n=Array.isArray(t.band)?t.band:[t.band];for(const t of n)e.push({kind:"band",getTop:$e(t.y1Accessor,"y1"),getBottom:$e(t.y0Accessor,"y0"),style:t.style,perSeries:!1!==t.perSeries,interactive:!0===t.interactive})}return e}import{scaleLinear as Ce,scaleLog as Le,scaleSymlog as _e,scaleTime as Te}from"d3-scale";function De(t,e){return e?[e[0]??t[0],e[1]??t[1]]:t}function Re(t,e,n){if("log"===t){const t=[Math.max(e[0],1e-6),Math.max(e[1],1e-6)];return Le().domain(t).range(n).clamp(!0)}return"symlog"===t?_e().domain(e).range(n):"time"===t?Te().domain([new Date(e[0]),new Date(e[1])]).range(n):Ce().domain(e).range(n)}function We(t,e,n){e>t.capacity&&(t.resize(e),n&&e>n.capacity&&n.resize(e))}function Ee(t,e){const n=new r(t.capacity);return t.forEach(()=>n.push(e)),n}function Ne(t,e,n,r){const o=t.push(e);return n&&n.push(r),o}function Ie(t,e,n){if(!e||0===e.size)return;const r=new Set;if(t.forEach((t,e)=>{n(t)&&r.add(e)}),0===r.size)return;const o=e.toArray();e.clear();for(let t=0;o.length>t;t++)r.has(t)||e.push(o[t])}var Oe=new WeakMap;function Fe(){return this.updateResults.last}function ze(){return this.updateResults.last}function Ye(t){return this.updateResults.subscribe(t)}function Be(t){this.config.layoutSelection=t}function je(){Oe.set(this,!0)}function Ge(){const t=!0===Oe.get(this);return Oe.delete(this),t}function Xe(t){Object.assign(t.prototype,{getLastUpdateResult:Fe,getUpdateSnapshot:ze,subscribeUpdateResult:Ye,setLayoutSelection:Be,markStylePaintPending:je,consumeStylePaintPending:Ge})}var He=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ve=["scene-style","data-paint","accessibility","evidence"],qe=(t,e)=>({retainedData:t,invalidations:e}),Ue=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ze=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Ke=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Je=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Qe=["scene-geometry","data-paint","accessibility","evidence"],tn=["scene-style","data-paint","accessibility","evidence"],en=[],nn={chartType:qe("rebuild",Ue),runtimeMode:qe("rebuild",Ue),xAccessor:qe("rebuild",Ue),yAccessor:qe("rebuild",Ue),timeAccessor:qe("rebuild",Ue),valueAccessor:qe("rebuild",Ue),y0Accessor:qe("rebuild",Ue),boundsAccessor:qe("rebuild",Ue),band:qe("rebuild",Ue),openAccessor:qe("rebuild",Ue),highAccessor:qe("rebuild",Ue),lowAccessor:qe("rebuild",Ue),closeAccessor:qe("rebuild",Ue),candlestickRangeMode:qe("rebuild",Ue),accessorRevision:qe("rebuild",Ue),groupAccessor:qe("rebuild",Ze),categoryAccessor:qe("rebuild",Ze),lineDataAccessor:qe("rebuild",Ze),colorAccessor:qe("rebuild",tn),sizeAccessor:qe("rebuild",Qe),symbolAccessor:qe("rebuild",Qe),pointIdAccessor:qe("rebuild",Qe),xScaleType:qe("preserve",Ke),yScaleType:qe("preserve",Ke),xExtent:qe("preserve",Ke),yExtent:qe("preserve",Ke),extentPadding:qe("preserve",Ke),scalePadding:qe("preserve",Ke),axisExtent:qe("preserve",Ke),binSize:qe("preserve",Ke),normalize:qe("preserve",Ke),heatmapAggregation:qe("preserve",Ke),heatmapXBins:qe("preserve",Ke),heatmapYBins:qe("preserve",Ke),arrowOfTime:qe("preserve",Je),baseline:qe("preserve",Je),stackOrder:qe("preserve",Je),sizeRange:qe("preserve",Je),curve:qe("preserve",Je),areaGroups:qe("preserve",Je),customLayout:qe("preserve",Je),layoutConfig:qe("preserve",Je),layoutMargin:qe("preserve",Je),symbolMap:qe("preserve",Qe),showValues:qe("preserve",Qe),heatmapValueFormat:qe("preserve",Qe),lineStyle:qe("preserve",tn),pointStyle:qe("preserve",tn),areaStyle:qe("preserve",tn),barStyle:qe("preserve",tn),swarmStyle:qe("preserve",tn),waterfallStyle:qe("preserve",tn),candlestickStyle:qe("preserve",tn),boundsStyle:qe("preserve",tn),gradientFill:qe("preserve",tn),lineGradient:qe("preserve",tn),semanticLineStops:qe("preserve",tn),colorScheme:qe("preserve",tn),themeCategorical:qe("preserve",tn),themeSemantic:qe("preserve",tn),themeSequential:qe("preserve",tn),themeDiverging:qe("preserve",tn),barColors:qe("preserve",tn),decay:qe("preserve",tn),pulse:qe("preserve",tn),staleness:qe("preserve",tn),layoutSelection:qe("preserve",tn),annotations:qe("preserve",["overlay","accessibility","evidence"]),windowSize:qe("preserve",en),windowMode:qe("preserve",en),maxCapacity:qe("preserve",en),clock:qe("preserve",en),transition:qe("preserve",en),introAnimation:qe("preserve",en),onLayoutError:qe("preserve",en)},rn=qe("preserve",Je),on=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}},He)}recordNoop(t){return this.tracker.record({kind:t,..."restyle"===t?{}:{count:0}},[])}recordRestyle(t){return t?this.tracker.record({kind:"restyle"},Ve):this.recordNoop("restyle")}recordConfig(t){const e=function(t){let e="preserve";const n=new Set;for(const r of t){const t=nn[r]??rn;"rebuild"===t.retainedData&&(e="rebuild");for(const e of t.invalidations)n.add(e)}return{retainedData:e,invalidations:n}}(t);return this.tracker.record({kind:"config",keys:t},e.invalidations)}};import{quadtree as an}from"d3-quadtree";var sn=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 n=0,r=0;for(const t of e)"point"===t.type&&(n++,t.r>r&&(r=t.r));if(this.maxRadius=r,500>=n)return void(this.tree=null);const o=Array(n);let i=0;for(const t of e)"point"===t.type&&(o[i++]=t);this.tree=an().x(t=>t.x).y(t=>t.y).addAll(o)}},ln=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 on,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 sn,this._lastBoundedInsertsRef=null,this.applyPulse=(t,e,n)=>!(!this.config.pulse||!this.timestampBuffer)&&function(t,e,n,r,o,i=("undefined"!=typeof performance?performance.now():Date.now())){const a=t.color??"rgba(255,255,255,0.6)",s=t.glowRadius??4;let l=!1;const c=o??(()=>{const t=new Map;for(let e=0;n.length>e;e++)t.set(n[e],e);return t})();for(const n of e){if("line"===n.type)continue;if("area"===n.type){const e=Array.isArray(n.datum)?n.datum:[n.datum];let o=0,s=!1;for(const n of e){const e=c.get(n);if(null==e)continue;s=!0;const a=r.get(e);if(null==a)continue;const l=qt(t,a,i);l>o&&(o=l)}s&&(l=Ut(n,o,a)||l);continue}const e=c.get(n.datum);if(null==e)continue;const o=r.get(e);l=Ut(n,null==o?0:qt(t,o,i),a,s)||l}return l}(this.config.pulse,t,e,this.timestampBuffer,this.getDatumIndexMap(e),n),this.config=t,this.buffer=new r(t.windowSize),this.growingCap=t.windowSize,["bar","swarm","waterfall"].includes(t.chartType)||"streaming"===t.runtimeMode?(this.getX=U(t.timeAccessor||t.xAccessor,"time"),this.getY=U(t.valueAccessor||t.yAccessor,"value")):(this.getX=U(t.xAccessor,"x"),this.getY=U(t.yAccessor,"y")),this.getGroup=K(t.groupAccessor),this.getCategory=K(t.categoryAccessor),this.getSize=t.sizeAccessor?U(t.sizeAccessor,"size"):void 0,this.getColor=K(t.colorAccessor),this.getSymbol=K(t.symbolAccessor),this.getY0=t.y0Accessor?U(t.y0Accessor,"y0"):void 0,this.resolvedRibbons=Pe(t),this.getPointId=K(t.pointIdAccessor),"candlestick"===t.chartType){const e=null!=t.openAccessor,n=null!=t.closeAccessor;this.getOpen=e?U(t.openAccessor,"open"):void 0,this.getHigh=U(t.highAccessor,"high"),this.getLow=U(t.lowAccessor,"low"),this.getClose=n?U(t.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!n}t.pulse&&(this.timestampBuffer=new r(t.windowSize))}currentTime(){return this.config.clock?.()??Xt()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=Ee(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 n=e.getTop(t),r=e.getBottom(t);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(r)&&this.yExtent.push(r)}}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 n=e.getTop(t),r=e.getBottom(t);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(r)&&this.yExtent.evict(r)}}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 n=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=n?U(this.config.timeAccessor||this.config.xAccessor,"time"):U(this.config.xAccessor,"x"),this.xIsDate=!1,t.inserts.length>0){const e=t.inserts[0],n=this.config.xAccessor,r="function"==typeof n?n(e):e[n||"x"],o=r instanceof Date,i="string"==typeof r&&Number.isFinite(g(r));if(this.xIsDate=o||i,i){const t="string"==typeof n?n:void 0;this.getX=t?e=>a(e[t]):t=>a(n(t))}}We(this.buffer,t.totalSize||t.inserts.length,this.timestampBuffer);for(const n of t.inserts)Ne(this.buffer,n,this.timestampBuffer,e),this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n)}else for(const n 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=Ne(this.buffer,n,this.timestampBuffer,e);this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n),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:n}=this,r=this.scales,o=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(n,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const i=this.getBufferArray(),a=this.yExtent.extent;let s=De(this.xExtent.extent,e.xExtent),l=De(a,e.yExtent);const c=!(!(u=e.yExtent)||null==u[0]||null==u[1]);var u;const h="exact"===e.axisExtent;if("stackedarea"===e.chartType&&!c&&n.size>0){const t=function(t){const{config:e,groups:n,getX:r,getY:o}=t,i="exact"===e.axisExtent;if(e.normalize){const n=[0,i?1:1+e.extentPadding];return{yDomain:n,stackExtentCache:{key:`${t.bufferSize}:${t.ingestVersion}:norm`,yDomain:n}}}const a=`${t.bufferSize}:${t.ingestVersion}:${e.baseline??"zero"}:${e.stackOrder??"key"}`;if(t.stackExtentCache&&t.stackExtentCache.key===a)return{yDomain:t.stackExtentCache.yDomain,stackExtentCache:t.stackExtentCache};const s=new Map,l=new Set;let c=0;const u=new Map,h=new Map;for(const t of n){const e=new Map;let n=0;for(const i of t.data){const t=r(i),a=o(i);if(!Number.isFinite(t)||!Number.isFinite(a))continue;e.set(t,(e.get(t)||0)+a),l.add(t),n+=a;const s=(u.get(t)||0)+a;u.set(t,s),s>c&&(c=s)}s.set(t.key,e),h.set(t.key,n)}const d=e.stackOrder??"key",f=(t,e)=>e>t?-1:t>e?1:0;let y,p;if("input"===d)y=n.map(t=>t.key);else if("insideOut"===d){const t=[...n].map(t=>t.key).sort((t,e)=>{const n=(h.get(e)??0)-(h.get(t)??0);return 0!==n?n:f(t,e)}),e=[],r=[];let o=0,i=0;for(const n of t)i>o?(e.push(n),o+=h.get(n)??0):(r.push(n),i+=h.get(n)??0);y=[...r.reverse(),...e]}else y="asc"===d?n.map(t=>t.key).sort((t,e)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(t,e)}):"desc"===d?n.map(t=>t.key).sort((t,e)=>{const n=(h.get(e)??0)-(h.get(t)??0);return 0!==n?n:f(t,e)}):n.map(t=>t.key).sort(f);if("wiggle"===e.baseline||"silhouette"===e.baseline){const t=Array.from(l).sort((t,e)=>t-e),n=te(t,y,(t,e)=>s.get(t)?.get(e)||0,e.baseline);let r=1/0,o=-1/0;for(const e of t){const t=n.get(e)??0,i=u.get(e)??0;r>t&&(r=t),t+i>o&&(o=t+i)}Number.isFinite(r)&&Number.isFinite(o)||(r=0,o=0);const a=o-r,c=i?0:a>0?a*e.extentPadding:1;p=[r-c,o+c]}else if("diverging"===e.baseline){const t=Array.from(l).sort((t,e)=>t-e),[n,r]=function(t,e,n){let r=0,o=0;for(const i of t){let t=0,a=0;for(const r of e){const e=n(r,i)||0;0>e?a+=e:t+=e}r>a&&(r=a),t>o&&(o=t)}return[r,o]}(t,y,(t,e)=>s.get(t)?.get(e)||0),o=r-n,a=i?0:o>0?o*e.extentPadding:1;p=[n-a,r+a]}else p=[0,c+(i?0:c>0?c*e.extentPadding:1)];return{yDomain:p,stackExtentCache:{key:a,yDomain:p}}}({config:e,groups:this.groupData(i),getX:this.getX,getY:this.getY,bufferSize:n.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=t.yDomain,this._stackExtentCache=t.stackExtentCache}else"bar"===e.chartType&&e.binSize&&!c&&n.size>0?l=function(t,e,n,r,o,i,a){const[,s]=function(t,e,n,r,o){const i=ke(t,e,n,r,o);if(0===i.size)return[0,0];let a=0;for(const t of i.values())t.total>a&&(a=t.total);return[0,a]}(t,e,n,r,o);return[0,a?s:s+s*i]}(n,this.getX,this.getY,e.binSize,this.getCategory,e.extentPadding,h):"waterfall"===e.chartType&&!c&&n.size>0?l=function(t,e,n,r){const[o,i]=function(t,e){let n=0,r=0,o=0;for(const i of t){const t=e(i);null==t||Number.isNaN(t)||(o+=t,n>o&&(n=o),o>r&&(r=o))}return[n,r]}(t,e),a=i-o,s=r?0:a>0?a*n:1;return[Math.min(0,o-Math.abs(s)),Math.max(0,i+Math.abs(s))]}(n,this.getY,e.extentPadding,h):c||l[0]===1/0||(l=function(t,e,n){if(!n.length)return t;let[r,o]=t;for(const t of e)for(const e of n){const n=e.getTop(t),i=e.getBottom(t);Number.isFinite(n)&&(r>n&&(r=n),n>o&&(o=n)),Number.isFinite(i)&&(r>i&&(r=i),i>o&&(o=i))}return[r,o]}(l,i,this.resolvedRibbons),l=function(t,e){const n=t[1]-t[0],r=e.exactMode?0:n>0?n*e.extentPadding:1,o=[null!=e.userMin?t[0]:t[0]-r,null!=e.userMax?t[1]:t[1]+r];return"log"!==e.yScaleType||o[0]>0||0>=e.dataYDomain[0]||e.exactMode||null==e.userMin&&(o[0]=e.dataYDomain[0]/(1+e.extentPadding)),o}(l,{exactMode:h,extentPadding:e.extentPadding,userMin:e.yExtent?.[0],userMax:e.yExtent?.[1],yScaleType:e.yScaleType,dataYDomain:a}));l=function(t,e,n){if(!e||n)return t;const r=e[0],o=e[1];return null==r&&null==o?t:[null!=r?r:t[0],null!=o?o:t[1]]}(l,e.yExtent,!!c),({xDomain:s,yDomain:l}=function(t,e,n){let r=t,o=e;if(r[0]===1/0||r[1]===-1/0)if("time"===n){const t=Date.now();r=[t-864e5,t]}else r=[0,1];return o[0]!==1/0&&o[1]!==-1/0||(o=[0,1]),{xDomain:r,yDomain:o}}(s,l,e.xScaleType)),this.scales=function(t){const{config:e,layout:n,xDomain:r,yDomain:o}=t,i="streaming"===e.runtimeMode,a=Math.max(0,Math.min(e.scalePadding||0,Math.min(n.width,n.height)/2-1));if(i){if("x"==("up"===(s=e.arrowOfTime)||"down"===s?"y":"x")){const t="right"===e.arrowOfTime?[a,n.width-a]:[n.width-a,a];return{x:Ce().domain(r).range(t),y:Re(e.yScaleType,o,[n.height-a,a])}}const t="down"===e.arrowOfTime?[a,n.height-a]:[n.height-a,a];return{x:Re(e.yScaleType,o,[a,n.width-a]),y:Ce().domain(r).range(t)}}var s;return{x:Re(e.xScaleType,r,[a,n.width-a]),y:Re(e.yScaleType,o,[n.height-a,a])}}({config:e,layout:t,xDomain:s,yDomain:l}),this._customLayoutFailedThisBuild=!1;const d=this.buildSceneNodes(t,i);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=r,this.lastLayout=o):(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=d,this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i,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,n=t.height/this.lastLayout.height;for(const t of this.scene)switch(t.type){case"line":for(const r of t.path)r[0]*=e,r[1]*=n;break;case"area":for(const r of t.topPath)r[0]*=e,r[1]*=n;for(const r of t.bottomPath)r[0]*=e,r[1]*=n;t.clipRect&&(t.clipRect={x:t.clipRect.x*e,y:t.clipRect.y*n,width:t.clipRect.width*e,height:t.clipRect.height*n}),t.strokeColorBands&&(t.strokeColorBands=t.strokeColorBands.map(t=>({...t,y:t.y*n,height:t.height*n})));break;case"point":case"glyph":t.x*=e,t.y*=n;break;case"rect":case"heatcell":t.x*=e,t.y*=n,t.w*=e,t.h*=n;break;case"candlestick":t.x*=e,t.openY*=n,t.closeY*=n,t.highY*=n,t.lowY*=n}const r=this.scales.x.domain(),o=this.scales.y.domain(),i=this.scales.x.range(),a=this.scales.y.range(),s=Re,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(t.width,t.height)/2-1)),c=a[1]>a[0];this.scales={x:s(this.config.xScaleType,r,i[0]>i[1]?[t.width-l,l]:[l,t.width-l]),y:s(this.config.yScaleType,o,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:n,scales:r}=this;if(!r)return[];if(n.customLayout){const o={data:e,scales:r,dimensions:{width:t.width,height:t.height,margin:n.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:t.width,height:t.height}},theme:{semantic:n.themeSemantic??{},categorical:n.themeCategorical??Et},resolveColor:(t,e)=>{const r=this.resolveGroupColor(t);if(r)return r;const o=this.resolveLineStyle(t,e);return o.stroke?o.stroke:"string"==typeof o.fill?o.fill:n.themeSemantic?.primary??"#4e79a7"},config:n.layoutConfig??{},selection:n.layoutSelection??null};let i;try{i=n.customLayout(o)}catch(t){const e=null!==this.lastCustomLayoutResult,r=Se("xy",t,e,this.version);this.lastCustomLayoutFailure=r,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",t);try{n.onLayoutError?.(r)}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=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const a=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const t of a)t.style&&this._baseStyles.set(t,t.style);this.applyCustomRestyle(a,n.layoutSelection??null)}return we({label:"customLayout",nodes:a,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),a}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===e.length)return[];const o={scales:r,config:n,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(n.chartType){case"line":return function(t,e){const n=t.groupData(e),r=[],o=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:o,aggregate:i}=se(t.ribbons);if(i.length>0&&r.push(...le(t,e,i)),o.length>0)for(const e of n)r.push(...ce(t,e.data,e.key,o))}for(const e of n){const n=t.resolveLineStyle(e.key,e.data[0]),i=Jt(e.data,t.scales,t.getX,t.getY,n,e.key);o&&o.length>0&&(i.colorThresholds=o),t.config.curve&&"linear"!==t.config.curve&&(i.curve=t.config.curve),t.config.lineGradient&&(i.strokeGradient=t.config.lineGradient),r.push(i)}return he(t,n,r),r}(o,e);case"area":return function(t,e){const n=t.groupData(e),r=[];if(t.ribbons&&t.ribbons.length>0){const{perSeries:o,aggregate:i}=se(t.ribbons);if(i.length>0&&r.push(...le(t,e,i)),o.length>0)for(const e of n)r.push(...ce(t,e.data,e.key,o))}const o=t.scales.y.domain(),i=o[0],a=t.config.semanticLineStops?.filter(t=>Number.isFinite(t.offset)).map(t=>({value:o[0]+Math.max(0,Math.min(1,t.offset))*(o[1]-o[0]),color:t.color,thresholdType:"greater"})).sort((t,e)=>t.value-e.value),s=a&&a.length>0?(()=>{const e=a.reduce((t,e)=>(t.at(-1)?.value===e.value?t[t.length-1]=e:t.push(e),t),[]),n=[{from:o[0],to:e[0].value}];for(let t=0;e.length>t;t++)n.push({from:e[t].value,to:e[t+1]?.value??o[1],color:e[t].color});return n.map(({from:e,to:n,color:r})=>{const o=t.scales.y(e),i=t.scales.y(n);return{y:Math.min(o,i),height:Math.abs(i-o),color:r}}).filter(t=>t.height>0)})():void 0,l=t.getY0?e=>{const n=t.getY0(e);return null==n?i:n}:void 0;for(const e of n){const n=t.resolveAreaStyle(e.key,e.data[0]),o=Qt(e.data,t.scales,t.getX,t.getY,i,n,e.key,l),c=xe(t.config.gradientFill);c&&(o.fillGradient=c),t.config.curve&&"linear"!==t.config.curve&&(o.curve=t.config.curve),t.config.lineGradient&&(o.strokeGradient=t.config.lineGradient),a&&a.length>0&&(o.colorThresholds=a,o.strokeColorBands=s),r.push(o)}return he(t,n,r),r}(o,e);case"mixed":return function(t,e){const n=t.groupData(e),r=[],o=t.config.areaGroups||new Set;if(t.ribbons&&t.ribbons.length>0){const{perSeries:o,aggregate:i}=se(t.ribbons);if(i.length>0&&r.push(...le(t,e,i)),o.length>0)for(const e of n)r.push(...ce(t,e.data,e.key,o))}const i=t.scales.y.domain()[0],a=t.getY0?e=>{const n=t.getY0(e);return null==n?i:n}:void 0;for(const e of n)if(o.has(e.key)){const n=t.resolveAreaStyle(e.key,e.data[0]),o=Qt(e.data,t.scales,t.getX,t.getY,i,n,e.key,a),s=xe(t.config.gradientFill);s&&(o.fillGradient=s),t.config.curve&&"linear"!==t.config.curve&&(o.curve=t.config.curve),t.config.lineGradient&&(o.strokeGradient=t.config.lineGradient),r.push(o)}else{const n=t.resolveLineStyle(e.key,e.data[0]),o=Jt(e.data,t.scales,t.getX,t.getY,n,e.key);t.config.curve&&"linear"!==t.config.curve&&(o.curve=t.config.curve),t.config.lineGradient&&(o.strokeGradient=t.config.lineGradient),r.push(o)}return he(t,n,r),r}(o,e);case"stackedarea":return function(t,e){const n=t.groupData(e),r=t.config.stackOrder??"key",o=()=>n.sort((t,e)=>e.key>t.key?-1:t.key>e.key?1:0);if("input"===r);else if("key"===r)o();else if("asc"===r||"desc"===r||"insideOut"===r){const e=new Map;for(const r of n){let n=0;for(const e of r.data){const r=t.getX(e),o=t.getY(e);Number.isFinite(r)&&Number.isFinite(o)&&(n+=o)}e.set(r.key,n)}const o=(t,e)=>e>t?-1:t>e?1:0;if("asc"===r)n.sort((t,n)=>{const r=(e.get(t.key)??0)-(e.get(n.key)??0);return 0!==r?r:o(t.key,n.key)});else if("desc"===r)n.sort((t,n)=>{const r=(e.get(n.key)??0)-(e.get(t.key)??0);return 0!==r?r:o(t.key,n.key)});else{const t=[...n].sort((t,n)=>{const r=(e.get(n.key)??0)-(e.get(t.key)??0);return 0!==r?r:o(t.key,n.key)}),r=[],i=[];let a=0,s=0;for(const n of t)s>a?(r.push(n),a+=e.get(n.key)??0):(i.push(n),s+=e.get(n.key)??0);n.length=0,n.push(...i.reverse(),...r)}}else o();const i=t.config.curve&&"linear"!==t.config.curve?t.config.curve:void 0,a=t.config.normalize?"zero":t.config.baseline??"zero",{nodes:s,stackedTops:l}=function(t,e,n,r,o,i,a,s="zero"){const l=new Set;for(const e of t)for(const t of e.data){const e=n(t);Number.isFinite(e)&&l.add(e)}const c=Array.from(l).sort((t,e)=>t-e),u=new Map;for(const e of t){const t=new Map;for(const o of e.data){const e=n(o),i=r(o);Number.isFinite(e)&&Number.isFinite(i)&&t.set(e,(t.get(e)||0)+i)}u.set(e.key,t)}let h;if(i){h=new Map;for(const e of c){let n=0;for(const r of t)n+=u.get(r.key)?.get(e)||0;h.set(e,n||1)}}const d=te(c,t.map(t=>t.key),(t,e)=>u.get(t)?.get(e)||0,s),f="diverging"===s&&!i,y=[],p=new Map,g=new Map,m=new Map,x=new Map;for(const t of c)g.set(t,d.get(t)??0),m.set(t,0),x.set(t,0);for(const n of t){const t=u.get(n.key),r=new Map;let s=[],l=[];const d=()=>{if(s.length>=2){const t={type:"area",topPath:s,bottomPath:l,style:o(n.key,n.data[0]),datum:n.data,group:n.key};a&&(t.curve=a),y.push(t)}s=[],l=[]};for(const n of c){const o=t.has(n);let a,c,u=o?t.get(n):0;if(i&&o&&(u/=h.get(n)),!o||!Number.isFinite(u)||0===u){d();continue}f?u>0?(a=m.get(n),c=a+u,m.set(n,c)):(a=x.get(n),c=a+u,x.set(n,c)):(a=g.get(n),c=a+u,g.set(n,c));const y=e.x(n);l.push([y,e.y(a)]),s.push([y,e.y(c)]),r.set(n,c)}d(),p.set(n.key,r)}return{nodes:y,stackedTops:p}}(n,t.scales,t.getX,t.getY,(e,n)=>t.resolveAreaStyle(e,n),t.config.normalize,i,a),c=s;if(t.config.pointStyle){const e=new WeakMap;for(const r of n){const n=l.get(r.key);if(n)for(const o of r.data){const r=t.getX(o),i=t.getY(o);null==r||Number.isNaN(r)||null==i||Number.isNaN(i)||!n.has(r)||e.set(o,n.get(r))}}const r=n=>e.get(n)??t.getY(n);he(t,n,c,r)}return c}(o,e);case"scatter":case"bubble":return function(t,e){const n=[],r="bubble"===t.config.chartType?10:5,o=t.config.sizeRange||[3,15];let i=null;if(t.getSize&&!t.config.pointStyle){const n=e.map(e=>t.getSize(e)).filter(t=>null!=t&&!Number.isNaN(t));if(n.length>0){let t=1/0,e=-1/0;for(const r of n)t>r&&(t=r),r>e&&(e=r);i=n=>t===e?(o[0]+o[1])/2:o[0]+(n-t)/(e-t)*(o[1]-o[0])}}const a=t.getColor?t.resolveColorMap(e):null,s=t.config.themeSemantic?.primary||"#4e79a7",l=t.getSymbol,c=t.config.symbolMap,u=new Map;let h=0;const d=t=>{const e=c?.[t];if(e)return e;let n=u.get(t);return n||(n=S[h%S.length],h++,u.set(t,n)),n};for(const o of e){let e=t.config.pointStyle?t.config.pointStyle(o):{fill:s,opacity:.8},c=e.r||r;if(i&&t.getSize){const e=t.getSize(o);null==e||Number.isNaN(e)||(c=i(e))}if(a&&t.getColor&&!e.fill){const n=t.getColor(o);n&&a.has(n)&&(e={...e,fill:a.get(n)})}const u=t.getPointId?t.getPointId(o)+"":void 0;if(l){const r=d(l(o)+""),i=ne(o,t.scales,t.getX,t.getY,Math.PI*c*c,r,e,u);i&&n.push(i)}else{const r=ee(o,t.scales,t.getX,t.getY,c,e,u);r&&n.push(r)}}return n}(o,e);case"heatmap":return function(t,e,n){if(t.config.heatmapAggregation)return function(t,e,n){const r=Math.max(1,Math.floor(t.config.heatmapXBins??20)),o=Math.max(1,Math.floor(t.config.heatmapYBins??20)),i=t.config.heatmapAggregation??"count",a=U(t.config.valueAccessor,"value");if(!t.scales||0===e.length)return[];const[s,l]=t.scales.x.domain(),[c,u]=t.scales.y.domain(),h=(l-s||1)/r,d=(u-c||1)/o,f=r*o;if(f>1e6)return[];const y=new Int32Array(f),p=new Float64Array(f);for(let n=0;e.length>n;n++){const i=e[n],l=t.getX(i),u=t.getY(i);if(!isFinite(l)||!isFinite(u))continue;const f=Math.min(Math.floor((l-s)/h),r-1),g=Math.min(Math.floor((u-c)/d),o-1);if(0>f||0>g)continue;const m=g*r+f;y[m]++;const x=a(i);p[m]+=isFinite(x)?x:0}let g=1/0,m=-1/0;for(let t=0;f>t;t++){if(0===y[t])continue;let e;switch(i){case"sum":e=p[t];break;case"mean":e=p[t]/y[t];break;default:e=y[t]}g>e&&(g=e),e>m&&(m=e)}if(!isFinite(g))return[];const x=m-g||1,b=n.width/r,v=n.height/o,k=t.config.showValues,w=t.config.heatmapValueFormat,A=[];for(let e=0;o>e;e++){const n=e*r;for(let a=0;r>a;a++){const r=n+a;if(0===y[r])continue;let l;switch(i){case"sum":l=p[r];break;case"mean":l=p[r]/y[r];break;default:l=y[r]}const u=(l-g)/x,f={xi:a,yi:e,value:l,count:y[r],sum:p[r],xCenter:s+(a+.5)*h,yCenter:c+(e+.5)*d,agg:i};A.push(ve(oe(a*b,(o-1-e)*v,b,v,`rgb(${220-(180*u+.5)|0},${220-(100*u+.5)|0},${255-(50*u+.5)|0})`,f,k?{value:l,showValues:!0,valueFormat:w}:void 0),f,t))}}return A}(t,e,n);if(0===e.length)return[];const r=U(t.config.valueAccessor,"value"),o=Z(t.config.xAccessor,"x"),i=Z(t.config.yAccessor,"y"),a=new Map,s=new Map,l=Array(e.length),c=Array(e.length);for(let t=0;e.length>t;t++){const n=e[t],r=o(n),u=i(n);l[t]=r,c[t]=u,a.has(r)||a.set(r,a.size),s.has(u)||s.set(u,s.size)}const u=a.size,h=s.size;if(0===u||0===h)return[];const d=Array.from(a.keys()),f=Array.from(s.keys()),y=d.every(t=>"number"==typeof t&&!isNaN(t)),p=f.every(t=>"number"==typeof t&&!isNaN(t));if(y){d.sort((t,e)=>Number(t)-Number(e)),a.clear();for(let t=0;d.length>t;t++)a.set(d[t],t)}if(p){f.sort((t,e)=>Number(t)-Number(e)),s.clear();for(let t=0;f.length>t;t++)s.set(f[t],t)}const g=new Float64Array(e.length),m=new Float64Array(e.length),x=Array(e.length),b=new Map;let v=0;for(let t=0;e.length>t;t++){const n=e[t],o=a.get(l[t]),i=s.get(c[t]);if(void 0===o||void 0===i)continue;const h=r(n),d=i*u+o,f=b.get(d);let y;void 0!==f?y=f:(y=v++,b.set(d,y)),g[y]=d,m[y]=h,x[y]=n}let k=1/0,w=-1/0;for(let t=0;v>t;t++){const e=m[t];isFinite(e)&&(k>e&&(k=e),e>w&&(w=e))}if(!isFinite(k)||!isFinite(w))return[];const A=function(t){const e=t in M?t:"blues";let n=be.get(e);if(n)return n;n=Array(256);const r=_(e);for(let t=0;256>t;t++)n[t]=r(t/255);return be.set(e,n),n}("string"==typeof t.config.colorScheme?t.config.colorScheme:t.config.themeSequential||"blues"),S=255/(w-k||1),$=n.width/u,P=n.height/h,C=t.config.showValues,L=t.config.heatmapValueFormat,T=[];for(let e=0;v>e;e++){const n=m[e];if(!isFinite(n))continue;const r=g[e],o=r%u,i=x[e];T.push(ve(oe(o*$,(h-1-(r-o)/u)*P,$,P,A[Math.min((n-k)*S+.5|0,255)],i,C?{value:n,showValues:!0,valueFormat:L}:void 0),i,t))}return T}(o,e,t);case"bar":{const t=function(t,e){if(!t.config.binSize)return{nodes:[],binBoundaries:[]};const n=ke(e,t.getX,t.getY,t.config.binSize,t.getCategory);if(0===n.size)return{nodes:[],binBoundaries:[]};let r=null;if(t.getCategory){const e=new Set;for(const t of n.values())for(const n of t.categories.keys())e.add(n);const o=t.config.barColors?Object.keys(t.config.barColors):[],i=new Set(o),a=Array.from(e).filter(t=>!i.has(t)).sort(),s=o.filter(t=>e.has(t)),l=s.join("\0")+""+a.join("\0");t.barCategoryCache&&t.barCategoryCache.key===l?r=t.barCategoryCache.order:(r=[...s,...a],t.barCategoryCache={key:l,order:r})}const o=[],i=t.scales,[a,s]=i.x.domain(),l=t.config.barStyle,c=t.config.themeSemantic?.primary,u=l?.gap,h="number"!=typeof u||0>u?1:u,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 n.values()){const n=Math.max(e.start,a),u=Math.min(e.end,s);if(n>=u)continue;const f=i.x(n),y=i.x(u),p=Math.abs(y-f),g=p>h+1?h:0,m=Math.min(f,y)+g/2,x=Math.max(p-g,1);if(x>0)if(r&&e.categories.size>0){let n=0;for(const a of r){const r=e.categories.get(a)||0;if(0===r)continue;const s=i.y(n),u=i.y(n+r);o.push(re(m,Math.min(s,u),x,Math.abs(s-u),{fill:t.config.barColors?.[a]||l?.fill||c||"#4e79a7",...d},{binStart:e.start,binEnd:e.end,total:e.total,category:a,categoryValue:r},a)),n+=r}}else{const t=i.y(0),n=i.y(e.total);o.push(re(m,Math.min(t,n),x,Math.abs(t-n),{fill:l?.fill||c||"#007bff",...d},{binStart:e.start,binEnd:e.end,total:e.total}))}}const f=new Set;for(const t of n.values())f.add(t.start),f.add(t.end);return{nodes:o,binBoundaries:Array.from(f).sort((t,e)=>t-e)}}(o,e);return this._barCategoryCache=o.barCategoryCache??null,this._binBoundaries=t.binBoundaries,t.nodes}case"swarm":return function(t,e){const n=[],r=t.config.swarmStyle||{},o=r.radius??3,i=r.fill??t.config.themeSemantic?.primary??"#007bff",a=r.opacity??.7,s=r.stroke,l=r.strokeWidth;for(const r of e){const e=t.getX(r),c=t.getY(r);if(null==c||Number.isNaN(c))continue;const u=t.scales.x(e),h=t.scales.y(c);let d=i;if(t.getCategory){const e=t.getCategory(r);d=t.config.barColors?.[e]||d}const{r:f,...y}=t.config.pointStyle?.(r)??{},p={type:"point",x:u,y:h,r:f??o,style:{fill:d,opacity:a,stroke:s,strokeWidth:l,...y},datum:r};t.getPointId&&(p.pointId=t.getPointId(r)+""),n.push(p)}return n}(o,e);case"waterfall":return function(t,e,n){const r=[],o=t.scales,i=t.config.waterfallStyle,a=e.filter(e=>{const n=t.getY(e),r=t.getX(e);return null!=n&&!Number.isNaN(n)&&null!=r&&isFinite(r)});if(0===a.length)return r;const s=i?.positiveColor??t.config.themeSemantic?.success??"#28a745",l=i?.negativeColor??t.config.themeSemantic?.danger??"#dc3545",c=i?.gap??1,u=i?.stroke,h=i?.strokeWidth,d=i?.opacity;let f=0;for(let e=0;a.length>e;e++){const y=a[e],p=t.getX(y),g=t.getY(y),m=f+g;let x;x=a.length-1>e?t.getX(a[e+1])-p:e>0?p-t.getX(a[e-1]):0;const b=o.x(p),v=0!==x?o.x(p+x):b+n.width/10,k=Math.min(b,v)+c/2,w=Math.max(b,v)-c/2-k;if(0>=w){f=m;continue}const A=o.y(f),M=o.y(m),S=Math.min(A,M),$=Math.abs(A-M),P={fill:0>g?l:s,stroke:u,strokeWidth:h};null!=d&&(P.opacity=d),r.push(re(k,S,w,$,P,{...y,baseline:f,cumEnd:m,delta:g,_connectorStroke:i?.connectorStroke,_connectorWidth:i?.connectorWidth})),f=m}return r}(o,e,t);case"candlestick":return function(t,e,n){if(!t.getHigh||!t.getLow||!t.scales)return[];const r=t.config.candlestickRangeMode??!1;if(!(r||t.getOpen&&t.getClose))return[];const o=[],i=t.config.candlestickStyle||{},a=i.rangeColor||"#6366f1",s=r?a:i.upColor||"#28a745",l=r?a:i.downColor||"#dc3545",c=r?a:i.wickColor||"#333",u=i.wickWidth||(r?2:1),h=e.map(e=>t.getX(e)).filter(t=>null!=t&&!Number.isNaN(t)).sort((t,e)=>t-e);let d=i.bodyWidth??0;if(null==i.bodyWidth)if(h.length>1){let e=1/0;for(let n=1;h.length>n;n++){const r=Math.abs(t.scales.x(h[n])-t.scales.x(h[n-1]));r>0&&e>r&&(e=r)}d=e!==1/0?Math.max(2,Math.min(.6*e,20)):6}else d=6;for(const i of e){const e=t.getX(i);if(null==e||Number.isNaN(e))continue;const a=t.getHigh(i),h=t.getLow(i);if(null==a||Number.isNaN(a)||null==h||Number.isNaN(h))continue;const f=r?a:t.getOpen(i),y=r?h:t.getClose(i);if(!r&&[f,y].some(t=>null==t||Number.isNaN(t)))continue;const p=y>=f,g={type:"candlestick",x:t.scales.x(e),openY:t.scales.y(f),closeY:t.scales.y(y),highY:t.scales.y(a),lowY:t.scales.y(h),bodyWidth:d,upColor:s,downColor:l,wickColor:c,wickWidth:u,isUp:p,datum:i};r&&(g.isRange=!0,g.dotRadius=Math.max(2,Math.min(d/2,.12*n.height))),o.push(g)}return o}(o,e,t);default:return[]}}resolveBoundsStyle(t,e){return function(t,e,n,r){const o=t.boundsStyle;return"function"==typeof o?o(n||{},e):o&&"object"==typeof o?o:{fill:r(e,n).stroke||t.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,t,e,(t,e)=>this.resolveLineStyle(t,e))}computeDecayOpacity(t,e){const n=this.config.decay;return n&&e>1?Ht(n,t,e):1}getDatumIndexMap(t){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const e=Vt(t);return this._datumIndexCache={version:this._ingestVersion,map:e},e}applyDecay(t,e){this.config.decay&&function(t,e,n,r=Vt(n)){const o=n.length;if(o>1)for(const n of e){if("line"===n.type){const e=Array.isArray(n.datum)?n.datum:[];if(2>e.length)continue;const i=Array(e.length);let a=!1;for(let n=0;e.length>n;n++){const s=r.get(e[n]);null!=s?(i[n]=Ht(t,s,o),1>i[n]&&(a=!0)):i[n]=1}a&&(n._decayOpacities=i);continue}if("area"===n.type){const e=Array.isArray(n.datum)?n.datum:[],i=n.topPath?n.topPath.length:e.length;if(2>i)continue;if(e.length===i){const a=Array(i);let s=!1;for(let n=0;e.length>n;n++){const i=r.get(e[n]);null!=i?(a[n]=Ht(t,i,o),1>a[n]&&(s=!0)):a[n]=1}s&&(n._decayOpacities=a)}else{let a=1;for(const n of e){const e=r.get(n);if(null!=e){const n=Ht(t,e,o);a>n&&(a=n)}}if(1>a){const t=Array(i);t.fill(a),n._decayOpacities=t}}continue}const e=r.get(n.datum);if(null==e)continue;const i=Ht(t,e,o);"heatcell"===n.type?n.style={opacity:i}:"candlestick"===n.type?n._decayOpacity=i:n.style={...n.style,opacity:(n.style?.opacity??1)*i}}}(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&&Zt(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,n,r){n.clear(),r.clear();for(let o=0;e.length>o;o++){const i=e[o],a=Kt(t,i,o);a&&("point"===i.type?n.set(a,{x:i.x,y:i.y,r:i.r,opacity:i.style.opacity}):"glyph"===i.type?n.set(a,{x:i.x,y:i.y,r:i.size,opacity:i.style.opacity,glyph:i.glyph}):"rect"===i.type?n.set(a,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style.opacity}):"heatcell"===i.type?n.set(a,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style?.opacity}):"candlestick"===i.type?n.set(a,{x:i.x,y:i.openY,w:i.bodyWidth,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY,opacity:i.style?.opacity}):"line"===i.type?r.set(a,{path:i.path.map(t=>[t[0],t[1]]),opacity:i.style?.opacity}):"area"===i.type&&r.set(a,{topPath:i.topPath.map(t=>[t[0],t[1]]),bottomPath:i.bottomPath.map(t=>[t[0],t[1]]),opacity:i.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 n=this.scene[e],r=Kt(this.transitionContext,n,e);r&&("point"===n.type?this.prevPositionMap.set(r,{x:n.x,y:n.y,r:0,opacity:0}):"rect"===n.type?this.prevPositionMap.set(r,{x:n.x,y:t,w:n.w,h:0,opacity:n.style.opacity??1}):"heatcell"===n.type?this.prevPositionMap.set(r,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:0}):"line"===n.type?(n._introClipFraction=0,this.prevPathMap.set(r,{path:n.path.map(t=>[t[0],t[1]]),opacity:n.style.opacity})):"area"===n.type&&(n._introClipFraction=0,this.prevPathMap.set(r,{topPath:n.topPath.map(t=>[t[0],t[1]]),bottomPath:n.bottomPath.map(t=>[t[0],t[1]]),opacity:n.style.opacity})))}}startTransition(){if(!this.config.transition)return;const t=function(t,e,n,r,o,i=Xt()){if(0===r.size&&0===o.size)return n;const a=e.duration??300;if(n.exitNodes.length>0){const t=new Set(n.exitNodes);n.scene=n.scene.filter(e=>!t.has(e)),n.exitNodes=[]}let s=!1;const l=new Set,c=new Set;for(let e=0;n.scene.length>e;e++){const i=n.scene[e],a=Kt(t,i,e);if(!a)continue;if(i._transitionKey=a,"line"===i.type||"area"===i.type){const t=o.get(a);if(t){if(c.add(a),"line"===i.type&&t.path&&t.path.length===i.path.length){i._targetPath=i.path.map(t=>[t[0],t[1]]),i._prevPath=t.path;for(let e=0;i.path.length>e;e++)i.path[e]=[t.path[e][0],t.path[e][1]];s=!0}else if("area"===i.type&&t.topPath&&t.bottomPath&&t.topPath.length===i.topPath.length&&t.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(t=>[t[0],t[1]]),i._targetBottomPath=i.bottomPath.map(t=>[t[0],t[1]]),i._prevTopPath=t.topPath,i._prevBottomPath=t.bottomPath;for(let e=0;i.topPath.length>e;e++)i.topPath[e]=[t.topPath[e][0],t.topPath[e][1]];for(let e=0;i.bottomPath.length>e;e++)i.bottomPath[e]=[t.bottomPath[e][0],t.bottomPath[e][1]];s=!0}i._targetOpacity=i.style.opacity??1,i._startOpacity=t.opacity??i.style.opacity??1}else i._targetOpacity=i.style.opacity??1,i._startOpacity=0,i.style={...i.style,opacity:0},s=!0;continue}const u=r.get(a);if("point"===i.type)if(u){l.add(a);const t={x:i.x,y:i.y,r:i.r};i._targetOpacity=i.style.opacity??1,u.x===t.x&&u.y===t.y&&u.r===t.r||(i._targetX=t.x,i._targetY=t.y,i._targetR=t.r,i.x=u.x,i.y=u.y,i.r=u.r??i.r,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("glyph"===i.type)if(u){l.add(a);const t={x:i.x,y:i.y,size:i.size};i._targetOpacity=i.style.opacity??1,u.x===t.x&&u.y===t.y&&u.r===t.size||(i._targetX=t.x,i._targetY=t.y,i._targetR=t.size,i.x=u.x,i.y=u.y,i.size=u.r??i.size,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("rect"===i.type)if(u){l.add(a);const t={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style.opacity??1,u.x===t.x&&u.y===t.y&&u.w===t.w&&u.h===t.h||(i._targetX=t.x,i._targetY=t.y,i._targetW=t.w,i._targetH=t.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,s=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},s=!0;else if("heatcell"===i.type)if(u){l.add(a);const t={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style?.opacity??1,u.x===t.x&&u.y===t.y&&u.w===t.w&&u.h===t.h||(i._targetX=t.x,i._targetY=t.y,i._targetW=t.w,i._targetH=t.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,s=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},s=!0;else if("candlestick"===i.type)if(u&&null!=u.openY){l.add(a);const t={x:i.x,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY};i._targetOpacity=i.style?.opacity??1,(u.x!==t.x||u.openY!==t.openY||u.closeY!==t.closeY||u.highY!==t.highY||u.lowY!==t.lowY)&&(i._targetX=t.x,i._targetOpenY=t.openY,i._targetCloseY=t.closeY,i._targetHighY=t.highY,i._targetLowY=t.lowY,i.x=u.x,i.openY=u.openY,i.closeY=u.closeY??i.closeY,i.highY=u.highY??i.highY,i.lowY=u.lowY??i.lowY,s=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},s=!0}for(const[t,e]of o)if(!c.has(t))if(t.startsWith("l:")&&e.path){const r={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};n.exitNodes.push(r),s=!0}else if(t.startsWith("a:")&&e.topPath&&e.bottomPath){const r={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};n.exitNodes.push(r),s=!0}for(const[t,e]of r)if(!l.has(t)){if(t.startsWith("p:"))n.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)n.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:"))n.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:"))n.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 r=e.openY??e.y;n.exitNodes.push({type:"candlestick",x:e.x,openY:r,closeY:e.closeY??r,highY:e.highY??r,lowY:e.lowY??r,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})}s=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),s&&(n.activeTransition={startTime:i,duration:a}),n}(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},n=function(t,e,n,r){if(!n.activeTransition)return!1;const o=jt(t,n.activeTransition),i=Bt(o,"linear"===e.easing?"linear":"ease-out-cubic");for(const t of n.scene){const e=t._transitionKey;if("point"===t.type){if(void 0!==t._targetOpacity){const n=e?r.get(e):void 0;t.style.opacity=Gt(n?n.opacity??1:0,t._targetOpacity,i)}if(void 0===t._targetX)continue;if(!e)continue;const n=r.get(e);if(!n)continue;t.x=Gt(n.x,t._targetX,i),t.y=Gt(n.y,t._targetY,i),void 0!==t._targetR&&void 0!==n.r&&(t.r=Gt(n.r,t._targetR,i))}else if("glyph"===t.type){if(void 0!==t._targetOpacity){const n=e?r.get(e):void 0;t.style.opacity=Gt(n?n.opacity??1:0,t._targetOpacity,i)}if(void 0===t._targetX)continue;if(!e)continue;const n=r.get(e);if(!n)continue;t.x=Gt(n.x,t._targetX,i),t.y=Gt(n.y,t._targetY,i),void 0!==t._targetR&&void 0!==n.r&&(t.size=Gt(n.r,t._targetR,i))}else if("rect"===t.type){if(void 0!==t._targetOpacity){const n=e?r.get(e):void 0;t.style.opacity=Gt(n?n.opacity??1:0,t._targetOpacity,i)}if(void 0===t._targetX)continue;if(!e)continue;const n=r.get(e);if(!n)continue;t.x=Gt(n.x,t._targetX,i),t.y=Gt(n.y,t._targetY,i),void 0!==n.w&&(t.w=Gt(n.w,t._targetW,i)),void 0!==n.h&&(t.h=Gt(n.h,t._targetH,i))}else if("heatcell"===t.type){if(void 0!==t._targetOpacity){const n=e?r.get(e):void 0;t.style={...t.style||{},opacity:Gt(n?n.opacity??1:0,t._targetOpacity,i)}}if(void 0===t._targetX)continue;if(!e)continue;const n=r.get(e);if(!n)continue;t.x=Gt(n.x,t._targetX,i),t.y=Gt(n.y,t._targetY,i),void 0!==n.w&&(t.w=Gt(n.w,t._targetW,i)),void 0!==n.h&&(t.h=Gt(n.h,t._targetH,i))}else if("candlestick"===t.type){if(void 0!==t._targetOpacity){const n=e?r.get(e):void 0;t.style={...t.style||{},opacity:Gt(n?n.opacity??1:0,t._targetOpacity,i)}}if(void 0===t._targetX)continue;if(!e)continue;const n=r.get(e);if(!n)continue;t.x=Gt(n.x,t._targetX,i),void 0!==n.openY&&(t.openY=Gt(n.openY,t._targetOpenY,i)),void 0!==n.closeY&&(t.closeY=Gt(n.closeY,t._targetCloseY,i)),void 0!==n.highY&&(t.highY=Gt(n.highY,t._targetHighY,i)),void 0!==n.lowY&&(t.lowY=Gt(n.lowY,t._targetLowY,i))}else if("line"===t.type){void 0!==t._targetOpacity&&(t.style={...t.style,opacity:Gt(t._startOpacity??0,t._targetOpacity,i)}),void 0!==t._introClipFraction&&(t._introClipFraction=i);const e=t._prevPath,n=t._targetPath;if(e&&n&&e.length===t.path.length)for(let r=0;t.path.length>r;r++)t.path[r][0]=Gt(e[r][0],n[r][0],i),t.path[r][1]=Gt(e[r][1],n[r][1],i)}else if("area"===t.type){void 0!==t._targetOpacity&&(t.style={...t.style,opacity:Gt(t._startOpacity??0,t._targetOpacity,i)}),void 0!==t._introClipFraction&&(t._introClipFraction=i);const e=t._prevTopPath,n=t._prevBottomPath,r=t._targetTopPath,o=t._targetBottomPath;if(e&&r&&e.length===t.topPath.length)for(let n=0;t.topPath.length>n;n++)t.topPath[n][0]=Gt(e[n][0],r[n][0],i),t.topPath[n][1]=Gt(e[n][1],r[n][1],i);if(n&&o&&n.length===t.bottomPath.length)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e][0]=Gt(n[e][0],o[e][0],i),t.bottomPath[e][1]=Gt(n[e][1],o[e][1],i)}}if(o>=1){for(const t of n.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 n=0;t.path.length>n;n++)t.path[n]=e[n];t._prevPath=void 0,t._targetPath=void 0,t._introClipFraction=void 0}else if("area"===t.type){const e=t._targetTopPath,n=t._targetBottomPath;if(e)for(let n=0;t.topPath.length>n;n++)t.topPath[n]=e[n];if(n)for(let e=0;t.bottomPath.length>e;e++)t.bottomPath[e]=n[e];t._prevTopPath=void 0,t._prevBottomPath=void 0,t._targetTopPath=void 0,t._targetBottomPath=void 0,t._introClipFraction=void 0}}if(n.exitNodes.length>0){const t=new Set(n.exitNodes);n.scene=n.scene.filter(e=>!t.has(e)),n.exitNodes=[]}return n.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,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const t of this.scene)"line"!==t.type&&"area"!==t.type||(t._introClipFraction=void 0)}groupData(t){const{result:e,cache:n}=function(t,e,n,r){if(r&&r.version===n&&r.group===e&&r.data===t)return{result:r.result,cache:r};let o;if(e){const n=new Map;for(const r of t){const t=e(r);n.has(t)||n.set(t,[]),n.get(t).push(r)}o=Array.from(n.entries()).map(([t,e])=>({key:t,data:e}))}else o=[{key:"_default",data:t}];return{result:o,cache:{version:n,group:e,data:t,result:o}}}(t,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=n,e}resolveColorMap(t){const{map:e,cache:n}=function(t,e,n,r,o){if(o&&o.version===r)return{map:o.map,cache:o};const i=new Set;if(e)for(const n of t){const t=e(n);t&&i.add(t)}const a=Array.from(i).sort(),s=a.join("\0");if(o&&o.key===s){const t={...o,version:r};return{map:t.map,cache:t}}const l=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical||Et,c=new Map;for(let t=0;a.length>t;t++)c.set(a[t],l[t%l.length]);return{map:c,cache:{key:s,map:c,version:r}}}(t,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=n,e}resolveLineStyle(t,e){return function(t,e,n,r){const o=t.lineStyle;if("function"==typeof o){const t=o(n||{},e);if(t&&!t.stroke&&e){const n=r(e);if(n)return{...t,stroke:n}}return t}const i=t.themeSemantic?.primary;return o&&"object"==typeof o?{stroke:o.stroke||i||"#007bff",strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray,fill:o.fill,fillOpacity:o.fillOpacity,opacity:o.opacity}:{stroke:r(e)||i||"#007bff",strokeWidth:2}}(this.config,t,e,t=>this.resolveGroupColor(t))}resolveAreaStyle(t,e){return function(t,e,n,r){if(t.areaStyle){const o=t.areaStyle(n||{});if(o&&!o.fill&&e){const t=r(e);if(t)return{...o,fill:t,stroke:o.stroke||t}}return o}const o=t.lineStyle;if("function"==typeof o){const t=o(n||{},e);if(t&&!t.fill&&e){const n=r(e);if(n)return{...t,fill:n,stroke:t.stroke||n}}return t}const i=t.themeSemantic?.primary;if(o&&"object"==typeof o)return{fill:o.fill||o.stroke||i||"#4e79a7",fillOpacity:o.fillOpacity??.7,stroke:o.stroke||i||"#4e79a7",strokeWidth:o.strokeWidth||2};const a=r(e)||i||"#4e79a7";return{fill:a,fillOpacity:.7,stroke:a,strokeWidth:2}}(this.config,t,e,t=>this.resolveGroupColor(t))}resolveGroupColor(e){const{color:n,groupColorCounter:r}=function(t){const{group:e,colorMapCache:n,groupColorMap:r,groupColorMapCap:o,config:i}=t;let{groupColorCounter:a}=t;if(n){const t=n.map.get(e);if(t)return{color:t,groupColorCounter:a}}const s=r.get(e);if(s)return{color:s,groupColorCounter:a};const l=(Array.isArray(i.colorScheme)&&i.colorScheme.length>0?i.colorScheme:null)||(Array.isArray(i.themeCategorical)&&i.themeCategorical.length>0?i.themeCategorical:null)||Et;if(0===l.length)return{color:null,groupColorCounter:a};const c=l[a%l.length];if(a++,r.set(e,c),r.size>o){const t=r.keys().next().value;void 0!==t&&r.delete(t)}return{color:c,groupColorCounter:a}}({group:e,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:t.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=r,n}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=Lt(t),n=this.getPointId,r=t=>e.has(n(t));Ie(this.buffer,this.timestampBuffer,r);const o=this.buffer.remove(r);if(0===o.length)return this.updateResults.recordNoop("remove"),o;for(const t of o)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",o.length),o}update(t,e){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=Lt(t),r=this.getPointId,o=new Set;this.buffer.forEach((t,e)=>{n.has(r(t))&&o.add(e)});const i=this.buffer.update(t=>n.has(r(t)),e);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const t of i)this.xExtent.evict(this.getX(t)),this.evictDatumYExtent(t);return this.buffer.forEach((t,e)=>{o.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",i.length),i}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 n=this._customRestyle;if(n)for(const r of t){const t=this._baseStyles.get(r)??r.style??{},o=n(r,e);r.style=o?{...t,...o}: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},n=Object.keys(t).filter(n=>t[n]!==e[n]);"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 r=!1,o=!1;Object.assign(this.config,t),"pulse"in t&&this.syncPulseTimestampBuffer();const i="chartType"in t&&t.chartType!==e.chartType||"runtimeMode"in t&&t.runtimeMode!==e.runtimeMode;if(i||"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,n=t&&this.config.valueAccessor||this.config.yAccessor,a=t&&e.valueAccessor||e.yAccessor,s=i||!H(t&&this.config.timeAccessor||this.config.xAccessor,t&&e.timeAccessor||e.xAccessor),l=i||!H(n,a);(s||l)&&(t?(this.getX=U(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=U(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=U(this.config.xAccessor,"x"),this.getY=U(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(t=>"bounds"===t.kind)&&(this.resolvedRibbons=Pe(this.config)),r=!0,o=!0)}if("groupAccessor"in t&&!H(t.groupAccessor,e.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?K(this.config.groupAccessor):void 0,r=!0),"categoryAccessor"in t&&!H(t.categoryAccessor,e.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?K(this.config.categoryAccessor):void 0,r=!0),"sizeAccessor"in t&&!H(t.sizeAccessor,e.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?U(this.config.sizeAccessor,"size"):void 0,r=!0),"symbolAccessor"in t&&!H(t.symbolAccessor,e.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?K(this.config.symbolAccessor):void 0,r=!0),"colorAccessor"in t&&!H(t.colorAccessor,e.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?K(this.config.colorAccessor):void 0,r=!0),"y0Accessor"in t&&!H(t.y0Accessor,e.y0Accessor)&&(this.getY0=this.config.y0Accessor?U(this.config.y0Accessor,"y0"):void 0,r=!0,o=!0),("boundsAccessor"in t&&!H(t.boundsAccessor,e.boundsAccessor)||"band"in t&&t.band!==e.band||"boundsStyle"in t&&t.boundsStyle!==e.boundsStyle)&&(this.resolvedRibbons=Pe(this.config),r=!0,o=!0),"pointIdAccessor"in t&&!H(t.pointIdAccessor,e.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?K(this.config.pointIdAccessor):void 0,r=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in t&&!H(t.openAccessor,e.openAccessor)||"closeAccessor"in t&&!H(t.closeAccessor,e.closeAccessor)||"highAccessor"in t&&!H(t.highAccessor,e.highAccessor)||"lowAccessor"in t&&!H(t.lowAccessor,e.lowAccessor))){const t=null!=this.config.openAccessor,e=null!=this.config.closeAccessor;this.getOpen=t?U(this.config.openAccessor,"open"):void 0,this.getHigh=U(this.config.highAccessor,"high"),this.getLow=U(this.config.lowAccessor,"low"),this.getClose=e?U(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!e,r=!0,o=!0}if("accessorRevision"in t&&t.accessorRevision!==e.accessorRevision&&(r=!0,o=!0),!r){const n=Object.keys(t).filter(t=>!t.endsWith("Accessor")&&"timeAccessor"!==t&&"valueAccessor"!==t);for(const o of n)if(t[o]!==e[o]){r=!0;break}}r&&(o&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(n)}updateConfigWithResult(t){return this.updateConfig(t),this.updateResults.last}};ln.GROUP_COLOR_MAP_CAP=1e3;var cn=ln;Xe(cn);import{memo as un,useEffect as hn,useRef as dn}from"react";var fn={sceneGeometry:0,layout:0,domain:0};function yn(t){const{domain:e,layout:n,sceneGeometry:r}=t.revisions;return{domain:e,layout:n,sceneGeometry:r}}function pn(t,e){return{sceneGeometry:Math.max(t.sceneGeometry,e.sceneGeometry),layout:Math.max(t.layout,e.layout),domain:Math.max(t.domain,e.domain)}}var gn="production"!==process.env.NODE_ENV,mn={revisions:fn,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},xn=class{constructor(t="scene host"){this.hostName=t,this.lastConsumed=fn,this.lastObserved=fn,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(t){gn&&(this.lastObserved=pn(this.lastObserved,yn(t)))}beforeCompute(t,e){if(!gn)return mn;const n=pn(yn(t),this.lastObserved),r=function(t){return`${t.sceneGeometry}|${t.layout}|${t.domain}`}(n),o=!((i=n).sceneGeometry===(a=this.lastConsumed).sceneGeometry&&i.layout===a.layout&&i.domain===a.domain);var i,a;return{revisions:n,signature:r,sawSignals:t.changed.has("scene-geometry")||t.changed.has("layout")||t.changed.has("domain"),wasUnconsumed:o,warnUnconsumed:!e&&o&&this.lastUnconsumedWarning!==r}}afterCompute(t,e,n){if(gn){if(e&&t.wasUnconsumed&&(this.lastConsumed=t.revisions),t.warnUnconsumed&&!e)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${t.signature}.`),void(this.lastUnconsumedWarning=t.signature);e&&t.sawSignals&&!t.wasUnconsumed&&!n&&this.lastDuplicateWarning!==t.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${t.signature}.`),this.lastDuplicateWarning=t.signature):e&&!t.sawSignals&&(this.lastDuplicateWarning="")}}};function bn(t){return dn(new xn(t))}function vn(t,e,n,r=!1,o=!1){const i=t.beforeCompute(e.getLastUpdateResult(),r);n(),t.afterCompute(i,!0,o)}var kn=un(function({store:t,diagnostics:e}){return hn(()=>{const n=()=>e.observeUpdateResult(t.getUpdateSnapshot());return n(),t.subscribeUpdateResult(n)},[e,t]),null});import*as wn from"react";function An(...t){const e=t.filter(t=>null!=t);return 0===e.length?null:1===e.length?e[0]:wn.createElement(wn.Fragment,null,...e)}import{useEffect as Mn,useRef as Sn}from"react";function $n(t,e,n,r){Mn(()=>{t.current?.updateConfig(e),n.current=!0,r()},[e,r,t,n])}function Pn(t,e,n,r){const o=Sn(null);Mn(()=>{const i=t.current;if(!i)return;const a=e??null;o.current!==a&&(o.current=a,i.setLayoutSelection(a),i.hasCustomRestyle?i.restyleScene(a):n.current=!0,r())},[e,r,t,n])}function Cn(t,e,n,r,o,i=t=>t.x,a=t=>t.y,s=t=>t.r){const l=Math.max(r,o+5,12),u=e-l,h=e+l,d=n-l,f=n+l;let y=null,p=1/0;return t.visit((t,o,l,g,m)=>{if(o>h||u>g||l>f||d>m)return!0;if(!t.length){let o=t;do{const t=o.data,l=i(t)-e,u=a(t)-n,h=Math.sqrt(l*l+u*u);c(s(t),r)>=h&&p>h&&(y=t,p=h),o=o.next}while(o)}return!1}),y?{node:y,distance:p}:null}import{curveMonotoneX as Ln,curveMonotoneY as _n,curveCardinal as Tn,curveCatmullRom as Dn,curveStep as Rn,curveStepBefore as Wn,curveStepAfter as En,curveBasis as Nn,curveNatural as In}from"d3-shape";function On(t){switch(t){case"monotoneX":return Ln;case"monotoneY":return _n;case"cardinal":return Tn;case"catmullRom":return Dn;case"step":return Rn;case"stepBefore":return Wn;case"stepAfter":return En;case"basis":return Nn;case"natural":return In;default:return null}}function Fn(t,e,n){if(null==e)return n;if(y(e)){return m(e,t)||e.background&&nt(t,e.background)||n}return"string"!=typeof e?e:nt(t,e)||n}function zn(t,e,n,r,o,i,a){const s=e.stops.filter(t=>Number.isFinite(t.offset)&&(null==t.opacity||Number.isFinite(t.opacity)));if(2>s.length)return null;const l=t.createLinearGradient(r,o,i,a);for(const e of s)l.addColorStop(Math.max(0,Math.min(1,e.offset)),Yn(t,e,n));return l}function Yn(t,e,n){const r=e.color??n,o=nt(t,r)||r;if(null==e.opacity)return o;const i=Math.max(0,Math.min(1,e.opacity)),[a,s,l]=function(t,e){const n=t.fillStyle,r="#010203";try{t.fillStyle=r,t.fillStyle=e}catch{return t.fillStyle=n,[78,121,167]}const o=t.fillStyle;if(t.fillStyle=n,"string"!=typeof o)return[78,121,167];if(o.toLowerCase()===r&&e.trim().toLowerCase()!==r)return[78,121,167];if(o.startsWith("#"))return[parseInt(o.slice(1,3),16),parseInt(o.slice(3,5),16),parseInt(o.slice(5,7),16)];const i=o.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}(t,o);return`rgba(${a},${s},${l},${i})`}function Bn(t,e,n,r,o,i,a){const s=e.stops.filter(t=>Number.isFinite(t.offset)&&(null==t.opacity||Number.isFinite(t.opacity)));if(2>s.length)return null;const l=t.createLinearGradient(r,o,i,a);for(const e of s)l.addColorStop(Math.max(0,Math.min(1,e.offset)),Yn(t,e,n));return l}import{line as jn}from"d3-shape";var Gn=new WeakMap;function Xn(t,e){const n=On(e);if(!n)return t;const r=Gn.get(t);if(r)return r;const o=function(t,e,n=8){if(!e||2>t.length)return t.map(([t,e])=>[t,e]);const r=[];let o=null;const i={moveTo(t,e){o=[t,e],r.push([t,e])},lineTo(t,e){o=[t,e],r.push([t,e])},bezierCurveTo(t,e,i,a,s,l){if(!o)return o=[s,l],void r.push([s,l]);const[c,u]=o;for(let o=1;n>=o;o++){const h=o/n,d=1-h;r.push([d*d*d*c+3*d*d*h*t+3*d*h*h*i+h*h*h*s,d*d*d*u+3*d*d*h*e+3*d*h*h*a+h*h*h*l])}o=[s,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(t,e,n,i){o=[n,i],r.push([n,i])}};return jn().x(t=>t[0]).y(t=>t[1]).curve(e).context(i)(t),r}(t,n);return Gn.set(t,o),o}function Hn(t,e,n,r=30,o,i=0){let a=null;if(o){const t=Cn(o,e,n,r,i);t&&(a={node:t.node,datum:t.node.datum,x:t.node.x,y:t.node.y,distance:t.distance})}for(const i of t){let t=null;switch(i.type){case"point":if(o)break;t=qn(i,e,n,r);break;case"symbol":t=Un(i,e,n,r);break;case"glyph":t=Zn(i,e,n,r);break;case"line":t=Kn(i,e,n,r);break;case"rect":if(null==i.datum)break;t=Qn(i,e,n);break;case"heatcell":t=tr(i,e,n);break;case"area":if(!1===i.interactive)break;t=nr(i,e,n);break;case"candlestick":t=er(i,e,n)}t&&r>t.distance&&(a&&t.distance>=a.distance||(a=t))}return a}function Vn(t,e,n){if(0===t.length)return null;if(t[0][0]>e||e>t[t.length-1][0])return null;const r=rr(t,e);if(0>r)return null;if(Math.abs(t[r][0]-e)>n)return null;let o=r,i=r;r>0&&t[r][0]>=e?(o=r-1,i=r):t.length-1>r&&(o=r,i=r+1);const[a,s]=t[o],[l,c]=t[i];return l===a?s:s+Math.max(0,Math.min(1,(e-a)/(l-a)))*(c-s)}function qn(t,e,n,r=30){const o=e-t.x,i=n-t.y,a=Math.sqrt(o*o+i*i);return a>c(t.r,r)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:a}}function Un(t,e,n,r=30){const o=e-t.x,i=n-t.y,a=Math.sqrt(o*o+i*i);return a>c(j(t.size),r)?null:{node:t,datum:t.datum,x:t.x,y:t.y,distance:a}}function Zn(t,e,n,r=30){if(null==t.datum)return null;const o=D(t.glyph,t.size),i=t.x+o.centerDx,a=t.y+o.centerDy,s=e-i,l=n-a,u=Math.sqrt(s*s+l*l);return u>c(o.radius,r)?null:{node:t,datum:t.datum,x:i,y:a,distance:u}}function Kn(t,e,n,r=30){if(0===t.path.length)return null;const o=rr(t.path,e);if(0>o)return null;const[i,a]=t.path[o];let s;if(t.path.length>1){let r=1/0;const i=Math.max(0,o-1),a=Math.min(t.path.length-2,o);for(let o=i;a>=o;o++){const[i,a]=t.path[o],[s,l]=t.path[o+1],c=Jn(e,n,i,a,s,l);r>c&&(r=c)}s=r}else{const t=e-i,r=n-a;s=Math.sqrt(t*t+r*r)}const l=t.style;return s>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,r)?null:{node:t,datum:Array.isArray(t.datum)&&t.datum[o]?t.datum[o]:t.datum,x:i,y:a,distance:s}}function Jn(t,e,n,r,o,i){const a=o-n,s=i-r,l=a*a+s*s;if(0===l)return Math.sqrt((t-n)**2+(e-r)**2);let c=((t-n)*a+(e-r)*s)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((t-(n+c*a))**2+(e-(r+c*s))**2)}function Qn(t,e,n){const r=d(e,n,t);return r.hit?{node:t,datum:t.datum,x:r.cx,y:r.cy,distance:0}:null}function tr(t,e,n){const r=d(e,n,t);return r.hit?{node:t,datum:t.datum,x:r.cx,y:r.cy,distance:0}:null}function er(t,e,n){const r=t.bodyWidth/2,o=Math.min(t.openY,t.closeY);if(!(t.x-r-3>e||e>t.x+r+3||t.highY-3>n||n>t.lowY+3)){const r=o+Math.max(Math.max(t.openY,t.closeY)-o,1)/2,i=e-t.x,a=n-r;return{node:t,datum:t.datum,x:t.x,y:r,distance:Math.sqrt(i*i+a*a)}}return null}function nr(t,e,n){if(0===t.topPath.length)return null;const r=rr(t.topPath,e);if(0>r)return null;const[o,i]=t.topPath[r],a=e-o,s=n-i,l=Math.sqrt(a*a+s*s);return{node:t,datum:Array.isArray(t.datum)&&t.datum[r]?t.datum[r]:t.datum,x:o,y:i,distance:l}}function rr(t,e){if(0===t.length)return-1;let n=0,r=t.length-1;for(;r>n;){const o=n+r>>1;e>t[o][0]?n=o+1:r=o}return n>0&&Math.abs(t[n][0]-e)>=Math.abs(t[n-1][0]-e)?n-1:n}import{useEffect as or,useRef as ir}from"react";var ar={fresh:1,aging:.7,stale:.45,expired:.25},sr={alpha:1,band:"fresh",isStale:!1};function lr(t,e){if(!t||0>=e)return sr;const n=null!=t.threshold&&t.threshold>0?t.threshold:5e3,r=t.graded;if(r){const t="object"==typeof r?r:{},o=V(e,n,t.thresholds);return{alpha:{...ar,...t.opacities??{}}[o],band:o,isStale:"fresh"!==o}}return e>n?{alpha:t.dimOpacity??.5,band:"stale",isStale:!0}:sr}function cr(t,e,n,r,o,i){const a=ir("fresh");or(()=>{if(!t)return;const s=setInterval(()=>{const s=e.current;if(!s||0===s.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=lr(t,l-s.lastIngestTime);c.band===a.current&&c.isStale===o||(a.current=c.band,c.isStale!==o&&i(c.isStale),n.current=!0,r())},1e3);return()=>clearInterval(s)},[t,o,r,e,i,n])}import{jsx as ur}from"react/jsx-runtime";function hr({isStale:t,position:e}){return ur("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===e?{top:4,left:4}:"bottom-left"===e?{bottom:4,left:4}:"bottom-right"===e?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"},children:t?"STALE":"LIVE"})}import{useMemo as dr,useRef as fr,useEffect as yr}from"react";import*as pr from"react";function gr(...t){let e;for(const n of t)n&&(e=mr(e)&&mr(n)?{legendGroups:[...e.legendGroups,...n.legendGroups],legendDistance:n.legendDistance??e.legendDistance}:n);return e}function mr(t){return"object"==typeof t&&null!==t&&"legendGroups"in t&&Array.isArray(t.legendGroups)}function xr(t){return"object"==typeof t&&null!==t&&"gradient"in t}var br=22;function vr(t){return Math.ceil(7*t.length)}function kr(t,e){if(mr(t)){const n=Pr(e),r=t.legendGroups.flatMap(t=>[t.label?vr(t.label):0,...t.items.map(t=>n.swatchSize+n.labelGap+vr(t.label))]);return Math.max(100,...r)}if(xr(t)){const{gradient:e}=t,n=e.format||(t=>Math.round(100*t)/100+""),r=Math.max(vr(n(e.domain[0])),vr(n(e.domain[1]))),o=e.label?vr(e.label):0;return Math.max(100,19+r,o)}return 100}function wr(t){return(mr(t)||xr(t))&&Number.isFinite(t.legendDistance)?Math.max(0,t.legendDistance):10}function Ar(t){return Math.max(0,t?.sideGutter??0)}function Mr(t,e){return null!=e?.axisGutter?Math.max(0,e.axisGutter):t?.hasAxis?t.hasAxisLabel?t.rotatedTicks?64:46:22:0}function Sr(t,e,n){if(xr(t))return t.gradient.label?34:26;if(!mr(t))return 20;const r=Pr(n),o=Math.max(1,n?.maxWidth??e);let i=r.rowHeight;for(const e of t.legendGroups){let t=0,n=0;for(const i of e.items){const e=r.swatchSize+r.labelGap+vr(i.label),a=0===n?e:n+r.itemGap+e;n>0&&a>o?(t+=1,n=e):n=a}e.items.length>0&&(t+=1),i=Math.max(i,t*r.rowHeight,e.label?vr(e.label):0)}return i+(t.legendGroups.length>1?16:0)}function $r(t,e){return kr(t,e)+wr(t)+Ar(e)}function Pr(t){const e=Math.max(1,t?.swatchSize??16),n=Math.max(e,t?.rowHeight??22);return{swatchSize:e,labelGap:Math.max(0,t?.labelGap??6),itemGap:Math.max(0,t?.itemGap??10),rowHeight:n,align:"left"===t?.align?"start":"right"===t?.align?"end":t?.align??"start",maxWidth:t?.maxWidth}}function Cr(t,e){let n=24;return t.map(({hasLabel:t,itemCount:r})=>{n+=5;const o=n;let i;n+=8,t&&(n+=16,i=n,n+=8);const a=n;return n+=r*e+8,{lineY:o,labelY:i,itemsY:a,endY:n}})}import{jsx as Lr,jsxs as _r}from"react/jsx-runtime";var Tr={fill:(t,e)=>Lr("rect",{style:t,width:e,height:e}),line:(t,e)=>Lr("line",{style:t,x1:0,y1:0,x2:e,y2:e})};function Dr(t,e,n,r,o){let i;return i="function"==typeof n?n(t):(0,Tr[n])(r(t,e),o),i}function Rr({swatchSize:t}){return Lr("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Wr(t,e,n){return n&&n.size>0?n.has(t.label)?1:.3:null!=e?t.label===e?1:.3:1}var Er=(t,e,n,r,o,i,a,s,l,c,u)=>{const{type:h="fill",styleFn:d,items:f}=t,y=[];let p=0;const g=!(!e&&!n),m="isolate"===c||void 0===c&&null!=o,{swatchSize:x,labelGap:b,rowHeight:v}=u;return f.forEach((t,c)=>{const u=Dr(t,c,h,d,x),k=Wr(t,r,o),w=o&&o.size>0&&o.has(t.label);y.push(_r("g",{transform:`translate(0,${p})`,onClick:e?()=>e(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:g?s===i&&c===a?0:-1:void 0,role:g?"option":void 0,"aria-selected":g&&m?w||!1:void 0,"aria-current":g&&!m&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:g?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e&&e(t)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const t=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(s,t);const e=n.currentTarget.parentElement?.children[t];e instanceof SVGElement&&e.focus()}}:void 0,onFocus:g?e=>{l(s,c),n&&n(t);const r=e.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:g?t=>{n&&n(null);const e=t.currentTarget.querySelector(".semiotic-legend-focus-ring");e&&e.setAttribute("visibility","hidden")}:void 0,style:{cursor:g?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[g&&Lr("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+b+2+7*t.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&Lr(Rr,{swatchSize:x}),Lr("text",{y:x/2,x:x+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+c)),p+=v}),y};function Nr({config:t,orientation:e="vertical",width:n=100}){const{colorFn:r,domain:o,label:i,format:a}=t,s=a||(t=>Math.round(100*t)/100+""),l="grad-legend-"+pr.useId();if("horizontal"===e){const t=12,e=Math.min(n,200),a=Math.max(0,(n-e)/2),c=[];for(let t=0;64>=t;t++){const e=t/64;c.push(Lr("stop",{offset:100*e+"%",stopColor:r(o[0]+e*(o[1]-o[0]))},t))}return _r("g",{"aria-label":i||"Gradient legend",children:[Lr("defs",{children:Lr("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&Lr("text",{x:a+e/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Lr("rect",{x:a,y:0,width:e,height:t,fill:`url(#${l})`,rx:2}),Lr("text",{x:a,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[0])}),Lr("text",{x:a+e,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[1])})]})}const c=[];for(let t=0;64>=t;t++){const e=t/64;c.push(Lr("stop",{offset:100*e+"%",stopColor:r(o[1]-e*(o[1]-o[0]))},t))}return _r("g",{"aria-label":i||"Gradient legend",children:[i&&Lr("text",{x:0,y:-6,textAnchor:"start",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Lr("defs",{children:Lr("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),Lr("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),Lr("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[1])}),Lr("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:s(o[0])})]})}function Ir(t){const{legendGroups:e,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,legendInteraction:a,title:s="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:h}=t,d=Pr(h),[f,y]=pr.useState(0),[p,g]=pr.useState(0),m=pr.useCallback((t,e)=>{y(t),g(e)},[]),x="vertical"===u?(({legendGroups:t,width:e,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:s,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{const h=[],d=Cr(t.map(t=>({hasLabel:!!t.label,itemCount:t.items.length})),u.rowHeight);return t.forEach((t,f)=>{const y=d[f];h.push(Lr("line",{stroke:"gray",x1:0,y1:y.lineY,x2:e,y2:y.lineY},"legend-top-line legend-symbol-"+f)),t.label&&null!=y.labelY&&h.push(Lr("text",{y:y.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+f)),h.push(Lr("g",{className:"legend-item",transform:`translate(0,${y.itemsY})`,children:Er(t,n,r,o,i,a,s,f,l,c,u)},"legend-group-"+f))}),h})({legendGroups:e||[],width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:a,metrics:d}):(({legendGroups:t,height:e,width:n,customClickBehavior:r,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:h})=>{let d=0;const f=[];t.forEach((t,e)=>{let y=0;t.label&&(y+=16);const p=((t,e,n,r,o,i,a,s,l,c,u,h)=>{const{type:d="fill",styleFn:f,items:y}=t,p=[],{swatchSize:g,labelGap:m,itemGap:x,rowHeight:b,align:v}=u,k=!(!e&&!n),w="isolate"===c||void 0===c&&null!=o,A=y.map(t=>g+m+7*t.label.length),M=[];let S=0,$=0;A.forEach((t,e)=>{const n=0===$?t:$+x+t;h&&h>0&&$>0&&n>h?(M.push({start:S,end:e,width:$}),S=e,$=t):$=n}),y.length>0&&M.push({start:S,end:y.length,width:$}),M.forEach((t,c)=>{let u="center"===v?Math.max(0,((h??t.width)-t.width)/2):"end"===v?Math.max(0,(h??t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=y[h],v=Dr(t,h,d,f,g),M=Wr(t,r,o),S=o&&o.size>0&&o.has(t.label);p.push(_r("g",{transform:`translate(${u},${c*b})`,onClick:e?()=>e(t):void 0,onMouseEnter:n?()=>n(t):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?s===i&&h===a?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?S||!1:void 0,"aria-current":k&&!w&&null!=r&&t.label===r||void 0,"aria-label":t.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),e&&e(t)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const t=(h+("ArrowRight"===n.key?1:-1)+y.length)%y.length;l(s,t);const e=n.currentTarget.parentElement?.children[t];e instanceof SVGElement&&e.focus()}}:void 0,onFocus:k?e=>{l(s,h),n&&n(t);const r=e.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:k?t=>{n&&n(null);const e=t.currentTarget.querySelector(".semiotic-legend-focus-ring");e&&e.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:M,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&Lr("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:g+m+2+7*t.label.length,height:g+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,S&&Lr(Rr,{swatchSize:g}),Lr("text",{y:g/2,x:g+m,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),u+=A[h]+x}});const P=Math.max(0,...M.map(t=>t.width)),C=M.length;return{items:p,offset:P,totalRows:C,totalHeight:C*b}})(t,r,o,i,a,s,l,e,c,u,h,h.maxWidth??n);y+=p.offset+5,f.push({label:t.label,...p,offset:y,totalRows:p.totalRows,totalHeight:p.totalHeight}),d+=y+12});const y=h.maxWidth??n;let p=d>y?0:"center"===h.align?Math.max(0,(y-d)/2):"end"===h.align?Math.max(0,y-d):0;const g=[];return f.forEach((n,r)=>{const o=t[r];o.label&&(g.push(Lr("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label},"legend-text-"+r)),p+=16),g.push(Lr("g",{className:"legend-item",transform:`translate(${p},0)`,children:n.items},"legend-group-"+r)),p+=n.offset+5,t[r+1]&&g.push(Lr("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(n.totalHeight||e)+0+8},"legend-top-line legend-symbol-"+r)),p+=12}),Lr("g",{children:g})})({legendGroups:e||[],title:s,height:c,width:l,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:m,legendInteraction:a,metrics:d}),b=!(!n&&!r);return _r("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==s&&""!==s&&"vertical"===u&&Lr("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:s}),x]})}import{jsx as Or}from"react/jsx-runtime";function Fr(t){const{legend:e,totalWidth:n,totalHeight:r,margin:o,legendPosition:i="right",legendLayout:a,legendHoverBehavior:s,legendClickBehavior:l,legendHighlightedCategory:c,legendIsolatedCategories:u,legendInteraction:h}=t;if(!e)return null;const d="top"===i||"bottom"===i,f=Math.max(0,n-o.left-o.right),y=Math.max(1,d?a?.maxWidth??f:kr(e,a)),p=wr(e),g=Ar(a),m=Mr(t.axisChrome,a),x=Mr(void 0,a),b=Sr(e,f,a);let v,k;if("left"===i)v=o.left-g-y-p,k=o.top;else if("top"===i)v=o.left,k=o.top-x-p-b;else if("bottom"===i){v=o.left;const t=r-o.bottom;k=Math.max(t+p,Math.min(t+m+p,r-b))}else v=n-o.right+g+p,k=o.top;return Or("g",{transform:`translate(${v}, ${k})`,children:xr(e)?Or(Nr,{config:e.gradient,orientation:d?"horizontal":"vertical",width:y}):mr(e)?Or(Ir,{legendGroups:e.legendGroups,title:"",width:y,orientation:d?"horizontal":"vertical",legendLayout:a,customHoverBehavior:s,customClickBehavior:l,highlightedCategory:c,isolatedCategories:u,legendInteraction:h}):e})}import{useMemo as zr}from"react";import{bin as Yr}from"d3-array";import{jsx as Br,jsxs as jr}from"react/jsx-runtime";function Gr(t){return"string"==typeof t?{type:t}:t}function Xr({orient:t,config:e,values:n,scale:r,size:o,length:i}){const a=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),s="top"===t||"bottom"===t,l=zr(()=>{if(0===n.length)return null;const e=r.domain(),l=o-8;if("boxplot"===a.type){const e=function(t){const e=[...t].sort((t,e)=>t-e),n=e.length;if(0===n)return null;const r=e[Math.floor(.25*n)],o=e[Math.floor(.5*n)],i=e[Math.floor(.75*n)],a=i-r;return{q1:r,median:o,q3:i,whiskerLow:Math.max(e[0],r-1.5*a),whiskerHigh:Math.min(e[n-1],i+1.5*a)}}(n);if(!e)return null;const{q1:o,median:i,q3:c,whiskerLow:u,whiskerHigh:h}=e,d=Math.min(.5*l,20),f=(l-d)/2+4;if(s){const e=r(o),n=r(c),s=r(i),l=r(u),y=r(h),p="top"===t?-1:1,g=0;return jr("g",{"data-testid":"marginal-boxplot-"+t,children:[Br("line",{x1:l,y1:g+p*(f+d/2),x2:y,y2:g+p*(f+d/2),stroke:a.fill,strokeWidth:a.strokeWidth}),Br("line",{x1:l,y1:g+p*f,x2:l,y2:g+p*(f+d),stroke:a.fill,strokeWidth:a.strokeWidth}),Br("line",{x1:y,y1:g+p*f,x2:y,y2:g+p*(f+d),stroke:a.fill,strokeWidth:a.strokeWidth}),Br("rect",{x:Math.min(e,n),y:"top"===t?g-f-d:g+f,width:Math.abs(n-e),height:d,fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth}),Br("line",{x1:s,y1:"top"===t?g-f-d:g+f,x2:s,y2:"top"===t?g-f:g+f+d,stroke:a.fill,strokeWidth:2})]})}{const e=r(o),n=r(c),s=r(i),l=r(u),y=r(h),p="left"===t?-1:1,g=0;return jr("g",{"data-testid":"marginal-boxplot-"+t,children:[Br("line",{x1:g+p*(f+d/2),y1:l,x2:g+p*(f+d/2),y2:y,stroke:a.fill,strokeWidth:a.strokeWidth}),Br("line",{x1:g+p*f,y1:l,x2:g+p*(f+d),y2:l,stroke:a.fill,strokeWidth:a.strokeWidth}),Br("line",{x1:g+p*f,y1:y,x2:g+p*(f+d),y2:y,stroke:a.fill,strokeWidth:a.strokeWidth}),Br("rect",{x:"left"===t?g-f-d:g+f,y:Math.min(e,n),width:d,height:Math.abs(n-e),fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth}),Br("line",{x1:"left"===t?g-f-d:g+f,y1:s,x2:"left"===t?g-f:g+f+d,y2:s,stroke:a.fill,strokeWidth:2})]})}}const c=Yr().domain(e).thresholds(a.bins)(n);if(0===c.length)return null;const u=J(c.map(t=>t.length));if(0===u)return null;if("histogram"===a.type)return Br("g",{"data-testid":"marginal-histogram-"+t,children:c.map((e,n)=>{if(null==e.x0||null==e.x1)return null;const o=e.length/u*l;if(s){const i=r(e.x0),s=r(e.x1)-r(e.x0);return Br("rect",{x:i,y:"top"===t?-4-o:4,width:Math.max(s,.5),height:o,fill:a.fill,fillOpacity:a.fillOpacity,stroke:a.stroke,strokeWidth:a.strokeWidth},n)}{const i=r(e.x0),s=r(e.x1)-r(e.x0);return Br("rect",{x:"left"===t?-4-o:4,y:Math.min(i,i+s),width:o,height:Math.abs(s),fill:a.fill,fillOpacity:a.fillOpacity,stroke:a.stroke,strokeWidth:a.strokeWidth},n)}})});if("violin"===a.type){const e=l/2+4,n=[];for(const o of c){if(null==o.x0||null==o.x1)continue;const i=o.length/u*(l/2),a=r((o.x0+o.x1)/2);n.push(s?`${a},${"top"===t?-(e-i):e-i}`:`${"left"===t?-(e-i):e-i},${a}`)}for(let o=c.length-1;o>=0;o--){const i=c[o];if(null==i.x0||null==i.x1)continue;const a=i.length/u*(l/2),h=r((i.x0+i.x1)/2);n.push(s?`${h},${"top"===t?-(e+a):e+a}`:`${"left"===t?-(e+a):e+a},${h}`)}return Br("g",{"data-testid":"marginal-violin-"+t,children:Br("polygon",{points:n.join(" "),fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth})})}if("ridgeline"===a.type){const e=[];if(s){const n=0,o=null!=c[0].x0?r(c[0].x0):0;e.push(`M${o},${n}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const o=n.length/u*l,i=r((n.x0+n.x1)/2);e.push(`L${i},${"top"===t?-o-4:o+4}`)}const a=null!=c[c.length-1].x1?r(c[c.length-1].x1):i;e.push(`L${a},${n}`),e.push("Z")}else{const n=0,o=null!=c[0].x0?r(c[0].x0):0;e.push(`M${n},${o}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const o=n.length/u*l,i=r((n.x0+n.x1)/2);e.push(`L${"left"===t?-o-4:o+4},${i}`)}const a=null!=c[c.length-1].x1?r(c[c.length-1].x1):i;e.push(`L${n},${a}`),e.push("Z")}return Br("g",{"data-testid":"marginal-ridgeline-"+t,children:Br("path",{d:e.join(" "),fill:a.fill,fillOpacity:a.fillOpacity,stroke:"none"===a.stroke?a.fill:a.stroke,strokeWidth:a.strokeWidth})})}return null},[n,r,a,o,i,t,s,4]);return l?Br("g",{className:"marginal-"+t,"data-testid":"marginal-"+t,children:l}):null}import*as Hr from"react";import{jsx as Vr,jsxs as qr}from"react/jsx-runtime";function Ur(t,e=120,n=8){if(!t)return[];const r=Math.max(1,Math.floor(e/n)),o=t.split(/\s+/),i=[];let a="";for(const t of o)a&&a.length+1+t.length>r?(i.push(a),a=t):a=a?`${a} ${t}`:t;return a&&i.push(a),i}function Zr(t,e,n,r){return"curly"===t?r?`M0,0 C${.6*n},0 ${.4*n},${e/2} ${n},${e/2} C${.4*n},${e/2} ${.6*n},${e} 0,${e}`:`M0,0 C0,${.6*n} ${e/2},${.4*n} ${e/2},${n} C${e/2},${.4*n} ${e},${.6*n} ${e},0`:r?`M0,0 L${n},0 L${n},${e} L0,${e}`:`M0,0 L0,${n} L${e},${n} L${e},0`}function Kr(t,e,n,r){if(!t)return Vr("g",{className:"annotation-note"});const{label:o,title:i,orientation:a,align:s,wrap:l=120,noWrap:c}=t;if(!o&&!i)return Vr("g",{className:"annotation-note"});let u=a;u||(u=Math.abs(e)>Math.abs(n)?"leftRight":"topBottom");let h=s;h&&"dynamic"!==h||(h="topBottom"===u?0>e?"right":"left":0>n?"bottom":"top");let d="start";"topBottom"===u?"right"===h?d="end":"middle"===h&&(d="middle"):d=0>e?"end":"start";const f=16,y=i?c?[i]:Ur(i,l):[],p=o?c?[o]:Ur(o,l):[],g="leftRight"===u?"end"===d?-4:4:0;let m=0;const x=[],b=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";t.useHTML||t.html?x.push(Vr("foreignObject",{className:"annotation-note-html",x:"end"===d?g-l:"middle"===d?g-l/2:g,y:-16,width:l,height:Math.max(f,(y.length+p.length)*f+(i&&o?2:0))+f,style:{overflow:"visible"},children:qr("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:b,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===d?"right":"middle"===d?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&Vr("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&Vr("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(y.length>0&&(x.push(Vr("text",{className:"annotation-note-title",fill:b,textAnchor:d,fontWeight:"bold",children:y.map((t,e)=>Vr("tspan",{x:g,dy:0===e?0:f,children:t},e))},"annotation-note-title")),m=y.length*f),p.length>0&&x.push(Vr("text",{className:"annotation-note-label",fill:b,textAnchor:d,y:m,children:p.map((t,e)=>Vr("tspan",{x:g,dy:0===e?0:f,children:t},e))},"annotation-note-label")));let v=null;if((i||o)&&(0!==e||0!==n))if("topBottom"===u){const t=Math.min(l,120);let e=0,n=t;"end"===d?(e=-t,n=0):"middle"===d&&(e=-t/2,n=t/2),v=Vr("line",{className:"note-line",x1:e,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(y.length+p.length)*f+(p.length>0?f:0);let e=0,n=t;"bottom"===h?(e=-t,n=0):"middle"===h&&(e=-t/2,n=t/2),v=Vr("line",{className:"note-line",x1:0,x2:0,y1:e,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,y.length+p.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===h?-(k+f+(p.length>0&&y.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),qr("g",{className:"annotation-note",transform:`translate(${e},${n})`,children:[Vr("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:x}),v]})}function Jr(t,e,n,r,o){const i=[];switch(t){case"callout-circle":{const t=(e?.radius||0)+(e?.radiusPadding||0);t>0&&i.push(Vr("circle",{r:t,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=e?.width||0,r=e?.height||0;(t>0||r>0)&&i.push(Vr("rect",{width:t,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":e?.custom&&i.push(...Array.isArray(e.custom)?e.custom:[e.custom]);break;case"xy-threshold":{const t=r||0,a=o||0;if(void 0!==e?.x){const r=(e.x||0)-t;i.push(Vr("line",{x1:r,y1:(e.y1||0)-a,x2:r,y2:(e.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==e?.y){const r=(e.y||0)-a;i.push(Vr("line",{x1:(e.x1||0)-t,y1:r,x2:(e.x2||0)-t,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==e?.x1||void 0!==e?.x2?i.push(Vr("line",{x1:(e.x1||0)-t,y1:0,x2:(e.x2||0)-t,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===e?.y1&&void 0===e?.y2||i.push(Vr("line",{x1:0,y1:(e.y1||0)-a,x2:0,y2:(e.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=e?.type||"curly",r=e?.width??e?.height;void 0!==r&&i.push(Vr("path",{d:Zr(t,r,e?.depth||30,void 0===e?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return Vr("g",{className:"annotation-subject",children:i})}function Qr(t,e,n,r,o,i){const a=[];let s=0,l=0;if("callout-circle"!==o&&"label"!==o||!i?.radius){if("callout-rect"===o&&i){const n=i.width||0,r=i.height||0;if(n>0||r>0){const o=n/2,i=r/2,a=t-o,c=e-i;if(0!==a||0!==c){const t=Math.abs(a),e=Math.abs(c),u=n/2,h=r/2,d=t*h>e*u?u/t:h/e;s=o+a*d,l=i+c*d}}}else if("bracket"===o&&i){const t=i.width,e=i.height,n=i.depth||30;void 0!==t?(s=t/2,l=n):void 0!==e&&(s=n,l=e/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==t||0!==e)){const r=Math.atan2(e,t);s=Math.cos(r)*n,l=Math.sin(r)*n}}const c=Math.sqrt((t-s)**2+(e-l)**2);if(c>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(e-l,t-s);if(i){const r=(s+t)/2,i=(l+e)/2,h=-(e-l)/c,d=(t-s)/c,f=(n?.curve??.25)*c,y=r+h*f,p=i+d*f;a.push(Vr("path",{className:"connector-curve",d:`M${s},${l}Q${y},${p} ${t},${e}`,fill:"none",stroke:o},"connector-line")),u=Math.atan2(p-l,y-s)}else a.push(Vr("line",{x1:s,y1:l,x2:t,y2:e,stroke:o},"connector-line"));if("arrow"===n?.end){const t=10,e=16/180*Math.PI;a.push(Vr("path",{d:`M${s},${l}L${s+t*Math.cos(u+e)},${l+t*Math.sin(u+e)}L${s+t*Math.cos(u-e)},${l+t*Math.sin(u-e)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return Vr("g",{className:"annotation-connector",children:a})}function to(t){const{x:e=0,y:n=0,dx:r,dy:o,nx:i,ny:a,note:s,connector:l,subject:c,type:u,color:h,className:d,disable:f,opacity:y,strokeDasharray:p,events:g={},"data-testid":m}=t,x=Array.isArray(e)?e[0]??0:e,b=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=r||0,w=o||0;null!=i&&(k=i-x),null!=a&&(w=a-b);const A="string"==typeof u?u:"label";if("bracket"===A&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const t=c.depth||30;w=t+(0>t?-5:5)}else if(void 0!==c.height){const t=c.depth||30;k=t+(0>t?-5:5),w=c.height/2}return qr("g",{className:("annotation "+(d||"")).trim(),transform:`translate(${x},${b})`,"data-testid":m,...null!=y&&{opacity:y},...p&&{strokeDasharray:p},...g,children:[!v.has("connector")&&Qr(k,w,l,h,A,c),!v.has("subject")&&Jr(A,c,h,x,b),!v.has("note")&&Kr(s,k,w,h)]})}function eo(t){const{noteData:e}=t,{screenCoordinates:n}=e,r="string"==typeof e.type?e.type:"label",o=e.eventListeners||e.events||{};if(e.coordinates&&n){const t=e.nx||n[0][0]+(e.dx??0),o=e.ny||n[0][1]+(e.dy??0),i=n.map((n,i)=>{const a=Object.assign({},e,{note:0===i?e.note:{label:""},x:n[0],y:n[1],nx:t,ny:o});return Vr(to,{"data-testid":"semiotic-annotation",...a,type:r},"multi-annotation-"+i)});return Vr("g",{children:i})}const i=e.note||{title:"none",label:e.label},a=`${i.label}-${i.title}-${e.i}`;return Vr(to,{"data-testid":"semiotic-annotation",events:o,...e,type:r},a)}import{packEnclose as no}from"d3-hierarchy";import{area as ro,curveLinear as oo,curveMonotoneX as io,curveMonotoneY as ao,curveStep as so,curveStepAfter as lo,curveStepBefore as co,curveBasis as uo,curveCardinal as ho,curveCatmullRom as fo}from"d3-shape";function yo(t){return Math.round(100*t)/100}function po(t,e=2){const n=[],r=[],o=e+1;for(let e=0;o>e;e++){let i=0;for(const[n,r]of t)null!==r&&(i+=n**e*r);n.push(i);const a=[];for(let n=0;o>n;n++){let r=0;for(const[o,i]of t)null!==i&&(r+=o**(e+n));a.push(r)}r.push(a)}r.push(n);const i=function(t,e){const n=t,r=t.length-1,o=[e];for(let t=0;r>t;t++){let e=t;for(let o=t+1;r>o;o++)Math.abs(n[t][o])>Math.abs(n[t][e])&&(e=o);for(let o=t;r+1>o;o++){const r=n[o][t];n[o][t]=n[o][e],n[o][e]=r}for(let e=t+1;r>e;e++)for(let o=r;o>=t;o--)n[o][e]-=n[o][t]*n[t][e]/n[t][t]}for(let t=r-1;t>=0;t--){let e=0;for(let i=t+1;r>i;i++)e+=n[i][t]*o[i];o[t]=(n[r][t]-e)/n[t][t]}return o}(r,o).map(yo);return{points:t.map(([t])=>[yo(t),yo(i.reduce((e,n,r)=>e+n*t**r,0))]),equation:[...i].reverse()}}import{jsx as go}from"react/jsx-runtime";var mo={secondary:0,primary:3},xo=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function bo(t){return!0===t?._annotationDeferred}function vo(t){return"blended"===t?.cohesion||"layer"===t?.cohesion?t.cohesion:null}function ko(t){const e=t?.provenance?.confidence;return"number"==typeof e&&Number.isFinite(e)?Math.max(0,Math.min(1,e)):null}function wo(t){return Math.max(.72,.95-.06*t)}import{jsx as Ao,jsxs as Mo}from"react/jsx-runtime";var So="var(--semiotic-bg, #ffffff)";function $o(t){const{x:e,y:n,text:r,fill:o,fontSize:i=12,fontWeight:a,fontFamily:s,textAnchor:l="start",dominantBaseline:c,background:u,className:h}=t,d=function(t){return void 0===t||!0===t||"halo"===t?{type:"halo"}:!1===t||"none"===t?null:"box"===t?{type:"box"}:{type:t.type??"halo",...t}}(u),f=t=>Ao("text",{x:e,y:n,textAnchor:l,dominantBaseline:c,fill:o,fontSize:i,fontWeight:a,fontFamily:s,className:h,...t?{stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!d)return f();if("halo"===d.type)return f({stroke:d.fill??So,strokeWidth:d.haloWidth??3});const y=d.padding??{x:6,y:3},p="number"==typeof y?y:y.x,g="number"==typeof y?y:y.y,m=function(t,e){return(t+"").length*e*.6}(r,i),x=i+2*g;let b,v;return b="middle"===l?e-m/2-p:"end"===l?e-m-p:e-p,v="middle"===c||"central"===c?n-x/2:"hanging"===c||"text-before-edge"===c?n-g:n-.8*i-g,Mo("g",{className:h,children:[Ao("rect",{x:b,y:v,width:m+2*p,height:x,rx:d.radius??3,ry:d.radius??3,fill:d.fill??So,fillOpacity:d.opacity??.85,stroke:d.stroke,strokeWidth:d.strokeWidth}),f()]})}import{jsx as Po,jsxs as Co}from"react/jsx-runtime";var Lo={linear:oo,monotoneX:io,monotoneY:ao,step:so,stepAfter:lo,stepBefore:co,basis:uo,cardinal:ho,catmullRom:fo};function _o(t,e,n,r){const o=[];return t.forEach((t,i)=>{let a;if(n){const o=n(t,i,r);a=null!=o?o:e(t,i,r)}else a=e(t,i,r);a&&o.push({node:a,annotation:t})}),function(t){const e=t.map((t,e)=>{return{p:t,i:e,emphasis:(n=t.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:ko(t.annotation),readingOrder:null,rank:1};var n}),n=e.some(t=>null!=t.emphasis||null!=t.confidence),r=t.some(t=>bo(t.annotation)),o=t.some(t=>null!=vo(t.annotation)),i=t.some(t=>"layer"===vo(t.annotation));if(!n&&!r&&!o)return t.map(t=>t.node);const a=e.filter(t=>null==t.emphasis&&null!=t.confidence).slice().sort((t,e)=>(e.confidence??0)-(t.confidence??0)||t.i-e.i);a.forEach((t,e)=>{t.readingOrder=e,t.rank=2-e/Math.max(1,a.length)});for(const t of e)t.emphasis&&(t.rank=mo[t.emphasis]);const s=e.sort((t,e)=>t.rank-e.rank||t.i-e.i).map(t=>{const{p:e,i:n,emphasis:r,readingOrder:o}=t,i=bo(e.annotation);let a=e.node;if("primary"===r||"secondary"===r||null!=o){const t=null==r&&null!=o;a=go("g",{className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...t?{opacity:wo(o),"data-annotation-reading-order":o}:{},children:e.node},"annotation-emphasis-"+n)}const s=vo(e.annotation);return s&&(a=go("g",{className:"annotation-cohesion--"+s,children:a},"annotation-cohesion-"+n)),i&&(a=go("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return r&&s.unshift(go("style",{children:xo},"annotation-disclosure-style")),i&&s.unshift(go("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),s}(o)}function To(t,e={}){return function(t,n,r){switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const e=E(t,n,r);if(!e)return null;const{x:o,y:i}=e;if(!W(o,i,r))return null;const a="callout"===t.type?"callout-circle":t.type,s="callout-circle"===a?{radius:t.radius??12,radiusPadding:t.radiusPadding}:"callout-rect"===a?{width:t.width,height:t.height}:void 0;return Po(eo,{noteData:{x:o,y:i,dx:t.dx??30,dy:t.dy??-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:a,...s?{subject:s}:{},connector:t.connector||{end:"arrow"},color:t.color,disable:t.disable,opacity:t.opacity,strokeDasharray:t.strokeDasharray,className:t.className}},"ann-"+n)}case"x-threshold":{const e=I(null!=t.value?{...t,x:t.value}:t,r);if(null==e)return null;const o=t.color||"#f97316",i=t.labelPosition||"top";let a;a="bottom"===i?(r.height||0)-4:"center"===i?(r.height||0)/2:16;const s=e>.6*(r.width||0),l=s?e-4:e+4,c=s?"end":"start";return Co("g",{opacity:t.opacity,children:[Po("line",{x1:e,y1:0,x2:e,y2:r.height||0,stroke:o,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&Po($o,{x:l,y:a,text:t.label,textAnchor:c,fill:o,fontSize:12,fontWeight:"bold",background:t.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const e=O(null!=t.value?{...t,y:t.value}:t,r);if(null==e)return null;const o=t.color||"#f97316",i=t.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(r.width||0)/2,l="middle"):(a=(r.width||0)-4,l="end");const c=20>(s=e)?Math.min((r.height||0)-4,s+16):s-4;return Co("g",{opacity:t.opacity,children:[Po("line",{x1:0,y1:e,x2:r.width||0,y2:e,stroke:o,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&Po($o,{x:a,y:c,text:t.label,textAnchor:l,fill:o,fontSize:12,fontWeight:"bold",background:t.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const e=(t.coordinates||[]).map(t=>({x:I({...t,type:"point"},r),y:O({...t,type:"point"},r),r:1})).filter(t=>null!=t.x&&null!=t.y);if(2>e.length)return null;const o=no(e),i=t.padding||10;return Co("g",{children:[Po("circle",{cx:o.x,cy:o.y,r:o.r+i,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&Po($o,{x:o.x,y:o.y-o.r-i-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:t.label,background:t.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const e=(t.coordinates||[]).map(t=>({x:I({...t,type:"point"},r),y:O({...t,type:"point"},r)})).filter(t=>null!=t.x&&null!=t.y);if(2>e.length)return null;const o=t.padding||10,i=e.map(t=>t.x),a=e.map(t=>t.y),[s,l]=Q(i),[c,u]=Q(a),h=s-o,d=l+o,f=c-o;return Co("g",{children:[Po("rect",{x:h,y:f,width:d-h,height:u+o-f,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&Po($o,{x:(h+d)/2,y:f-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:t.label,background:t.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const e=r.data||[],o="function"==typeof t.filter?e.filter(t.filter):t.field&&null!=t.value?e.filter(e=>e[t.field]===t.value):[],i={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return Po("g",{children:o.map((e,n)=>{const o=I(e,r),a=O(e,r);if(null==o||null==a)return null;const s="function"==typeof t.r?t.r(e):t.r||6,l="function"==typeof t.style?t.style(e):t.style||i;return Po("circle",{cx:o,cy:a,r:s,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const e=I(t,r),o=O(t,r);return Po(eo,{noteData:{x:e??0,y:o??0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const e=r.data||[];if(2>e.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",a="ordinal"===r.frameType,s="horizontal"===r.projection,l=a?o:null,c=a?i:null;let u;const h=[],d=new Map;if(a&&l&&c){for(const t of e){const e=t[l];if(null==e)continue;const n=e+"";d.has(n)||(d.set(n,h.length),h.push(n))}u=e.map(t=>{const e=t[l],n=t[c];if(null==e||null==n)return null;const r=d.get(e+"");return null!=r?[r,+n]:null}).filter(t=>null!==t)}else u=e.map(t=>[t[o],t[i]]).filter(t=>null!=t[0]&&null!=t[1]);if(2>u.length)return null;const f=r.scales?.x??r.scales?.time,y=r.scales?.y??r.scales?.value;if(!f||!y)return null;const p=t=>e=>{const n=Math.max(0,Math.floor(e)),r=Math.min(h.length-1,n+1),o=e-n,i=t(h[n]);return i+(t(h[r])-i)*o},g=f,m=y;let x;if(a)if(s){const t=p(m);x=(e,n)=>[g(n),t(e)]}else{const t=p(g);x=(e,n)=>[t(e),m(n)]}else x=(t,e)=>[g(t),m(e)];const b=t.method||"linear";let v;if("loess"===b)v=function(t,e=.3){const n=t.length;if(2>n)return t.slice();const r=t.slice().sort((t,e)=>t[0]-e[0]),o=r.map(t=>t[0]),i=r.map(t=>t[1]),a=Math.max(2,Math.ceil(e*n)),s=[];for(let t=0;n>t;t++){const e=o[t],r=o.map(t=>Math.abs(t-e)),l=r.slice().sort((t,e)=>t-e)[Math.min(a-1,n-1)]||1,c=[];for(let t=0;n>t;t++){const e=0===l?0:r[t]/l;c[t]=1>e?Math.pow(1-Math.pow(e,3),3):0}let u=0,h=0,d=0,f=0,y=0;for(let t=0;n>t;t++){const e=c[t];0!==e&&(u+=e,h+=e*o[t],d+=e*i[t],f+=e*o[t]*o[t],y+=e*o[t]*i[t])}if(0===u){s.push([e,i[t]]);continue}const p=u*f-h*h;if(1e-12>Math.abs(p))s.push([e,d/u]);else{const t=(u*y-h*d)/p;s.push([e,(d-t*h)/u+t*e])}}return s}(u,t.bandwidth??.3);else{const e="polynomial"===b?po(u,t.order||2):function(t){const e=[0,0,0,0];let n=0;for(const[r,o]of t)null!==o&&(n++,e[0]+=r,e[1]+=o,e[2]+=r*r,e[3]+=r*o);const r=n*e[2]-e[0]*e[0],o=0===r?0:yo((n*e[3]-e[0]*e[1])/r),i=yo(e[1]/n-o*e[0]/n);return{points:t.map(([t])=>[yo(t),yo(o*t+i)]),equation:[o,i]}}(u);v=e.points}const k=v.map(([t,e])=>{const[n,r]=x(t,e);return`${n},${r}`}).join(" "),w=t.color||"#6366f1",A=v[v.length-1],[M,S]=x(A[0],A[1]);return Co("g",{children:[Po("polyline",{points:k,fill:"none",stroke:w,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&Po("text",{x:M+4,y:S-4,fill:w,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const e=r.scales?.y??r.scales?.value,o=e?.domain?.(),s=t.y0??o?.[0],l=t.y1??o?.[1],c=null!=s&&e?e(s):0,u=null!=l&&e?e(l):r.height||0,h=b(t.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return Co("g",{opacity:t.opacity,children:[h.def&&Po("defs",{children:h.def}),Po("rect",{x:0,y:Math.min(c,u),width:r.width||0,height:Math.abs(u-c),fill:h.fill,fillOpacity:t.fillOpacity||.1}),t.label&&Po($o,{x:(r.width||0)-4,y:(i=c,a=u,Math.max(Math.min(i,a),0)+16),textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:t.label,background:t.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const e=r.scales?.x??r.scales?.time,o=e?.domain?.(),i=t.x0??o?.[0],a=t.x1??o?.[1],s=null!=i&&e?e(i):null,l=null!=a&&e?e(a):null;if(null==s||null==l)return null;const c=b(t.fill||t.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return Co("g",{opacity:t.opacity,children:[c.def&&Po("defs",{children:c.def}),Po("rect",{x:Math.min(s,l),y:0,width:Math.abs(l-s),height:r.height||0,fill:c.fill,fillOpacity:t.fillOpacity??.1}),t.label&&Po($o,{x:Math.min(s,l)+4,y:16,textAnchor:"start",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:t.label,background:t.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const e=r.data||[];if(2>e.length)return null;const o=r.xAccessor||"x",i=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!i||!a)return null;const s=t.upperAccessor||"upperBounds",l=t.lowerAccessor||"lowerBounds",c=t.filter,u=e.filter(t=>null!=t[s]&&null!=t[l]&&!(c&&!c(t))).sort((t,e)=>t[o]-e[o]);if(2>u.length)return null;const h=Lo[r.curve||"linear"]||oo,d=ro().x(t=>i(t[o])).y0(t=>a(t[l])).y1(t=>a(t[s])).curve(h)(u);if(!d)return null;const f=t.fill||"#6366f1";return Co("g",{children:[Po("path",{d:d,fill:f,fillOpacity:t.fillOpacity??.15,stroke:"none"}),t.label&&u.length>0&&Po("text",{x:i(u[u.length-1][o])+4,y:a(u[u.length-1][s])-4,fill:f,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const e=r.data||[];if(2>e.length)return null;const o=r.yAccessor||"y",i=r.scales?.x??r.scales?.time,a=r.scales?.y??r.scales?.value;if(!i||!a)return null;const s=e.map(t=>t[o]).filter(t=>null!=t&&isFinite(t));if(2>s.length)return null;const l=s.reduce((t,e)=>t+e,0)/s.length,c=s.reduce((t,e)=>t+(e-l)**2,0)/s.length,u=Math.sqrt(c),h=t.threshold??2,d=l-h*u,f=!1!==t.showBand,y=t.fill||"#6366f1",p=t.fillOpacity??.1,g=t.anomalyColor||"#ef4444",m=t.anomalyRadius??6,x=a(l+h*u),b=a(d),v=e.filter(t=>{const e=t[o];return null!=e&&Math.abs(e-l)>h*u});return Co("g",{children:[f&&Po("rect",{x:0,y:Math.min(x,b),width:r.width||0,height:Math.abs(b-x),fill:y,fillOpacity:p}),v.map((t,e)=>{const n=I(t,r),o=O(t,r);return null==n||null==o?null:Po("circle",{cx:n,cy:o,r:m,fill:g,fillOpacity:.7,stroke:g,strokeWidth:1.5},"anomaly-"+e)}),t.label&&Po("text",{x:(r.width||0)-4,y:Math.min(x,b)-4,textAnchor:"end",fill:y,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const e=r.data||[];if(3>e.length)return null;const o=r.xAccessor||"x",i=r.yAccessor||"y",a=r.scales?.x??r.scales?.time,s=r.scales?.y??r.scales?.value;if(!a||!s)return null;const l=e.map(t=>[t[o],t[i]]).filter(t=>null!=t[0]&&null!=t[1]&&isFinite(t[0])&&isFinite(t[1])).sort((t,e)=>t[0]-e[0]);if(3>l.length)return null;let c;if("polynomial"===(t.method||"linear")){const e=po(l,t.order||2).equation;c=t=>e.reduce((e,n,r)=>e+n*Math.pow(t,r),0)}else{const t=l.length;let e=0,n=0,r=0,o=0;for(const[t,i]of l)e+=t,n+=i,r+=t*t,o+=t*i;const i=t*r-e*e;if(1e-12>Math.abs(i))return null;const a=(t*o-e*n)/i,s=(n-a*e)/t;c=t=>s+a*t}const u=l.length,h=l.map(([t,e])=>e-c(t)),d=h.reduce((t,e)=>t+e*e,0),f=Math.sqrt(d/Math.max(u-2,1)),y=l.reduce((t,e)=>t+e[0],0)/u,p=l.reduce((t,e)=>t+(e[0]-y)**2,0),g=t.confidence??.95,m=.99>g?.95>g?.9>g?1:1.645:1.96:2.576,x=t.steps??5,b=l[u-1][0],v=(b-l[0][0])/Math.max(u-1,1),k=[];for(let t=1;x>=t;t++)k.push(b+t*v);const w=[];for(const t of k){const e=c(t),n=f*Math.sqrt(1+1/u+(p>0?(t-y)**2/p:0))*m;w.push({x:t,yCenter:e,yUpper:e+n,yLower:e-n})}const A=`M${w.map(t=>`${a(t.x)},${s(t.yUpper)}`).join(" L")} L${w.slice().reverse().map(t=>`${a(t.x)},${s(t.yLower)}`).join(" L")} Z`,M=w.map(t=>`${a(t.x)},${s(t.yCenter)}`).join(" "),S=`${a(b)},${s(c(b))}`,$=t.strokeColor||"#6366f1";return Co("g",{children:[Po("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:t.fillOpacity??.15,stroke:"none"}),Po("polyline",{points:`${S} ${M}`,fill:"none",stroke:$,strokeWidth:t.strokeWidth??2,strokeDasharray:t.strokeDasharray??"6,3"}),t.label&&w.length>0&&Po("text",{x:a(w[w.length-1].x)+4,y:s(w[w.length-1].yCenter)-4,fill:$,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i,a;if(null!=t.px&&null!=t.py)i=t.px,a=t.py;else{const e=E(t,n,r);if(!e)return null;i=e.x,a=e.y}if(!W(i,a,r))return null;const s=t.dx??0,l=t.dy??0,c=t.width??32,u=t.height??32,h=t.content??Po("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return Po("foreignObject",{x:i+s-c/2,y:a+l-u/2,width:c,height:u,style:{overflow:"visible",pointerEvents:"auto"},children:Po("div",{...o(t,e),style:{width:c,height:u,display:"flex",alignItems:"center",justifyContent:"center"},children:h})},"ann-"+n)}case"text":{const e=E(t,n,r);if(!e)return null;const{x:o,y:i}=e,a=o+(t.dx||0),s=i+(t.dy||0),l=t.color||"var(--semiotic-text, #333)",c=Po("text",{x:a,y:s,fill:l,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?Hr.cloneElement(c,{key:"ann-text-"+n}):Co("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[Po("line",{x1:o,y1:i,x2:a,y2:s,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Hr.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const e=t.category;if(null==e)return null;const o=t=>"function"==typeof t&&"function"==typeof t.bandwidth,i=r.scales?.o,a=r.scales?.x,s=r.scales?.y,l=o(i)?i:o(a)?a:o(s)?s:null;if(!l)return null;const c=l(e+"");if(null==c)return null;const u=l.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",d=t.opacity??.15,f=t.label;return Co("g",(r.projection?"vertical"===r.projection:l===a)?{children:[Po("rect",{x:c,y:0,width:u,height:r.height||0,fill:h,fillOpacity:d}),f&&Po($o,{x:c+u/2,y:16,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:t.labelBackground??"none"})]}:{children:[Po("rect",{x:0,y:c,width:r.width||0,height:u,fill:h,fillOpacity:d}),f&&Po($o,{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:t.labelBackground??"none"})]},"ann-"+n)}default:return null}var i,a,s}}import{useSyncExternalStore as Do}from"react";var Ro={positions:new Map},Wo=new Set;function Eo(){for(const t of Wo)t()}function No(t,e){const n=Ro.positions.get(t);if(n?.locked)return;if(!n||n.sourceId!==e)return;const r=new Map(Ro.positions);r.delete(t),Ro={positions:r},Eo()}function Io(t,e){const n=Ro.positions.get(t);if(!n?.locked)return;if(e&&n.sourceId!==e)return;const r=new Map(Ro.positions);r.delete(t),Ro={positions:r},Eo()}function Oo(){return Ro}function Fo(t){return Wo.add(t),()=>Wo.delete(t)}var zo={positions:new Map};function Yo(){return()=>{}}function Bo(){return zo}function jo(t,e,n){return"exact"===n?function(t,e){const n=t.domain(),r=n[0],o=n[n.length-1],i=r instanceof Date,a=r instanceof Date?r.getTime():r,s=o instanceof Date?o.getTime():o;if(2>e||a===s)return i?[new Date(a),new Date(s)]:[a,s];const l=(s-a)/(e-1),c=Array(e);for(let t=0;e>t;t++){const n=t===e-1?s:a+t*l;c[t]=i?new Date(n):n}return c}(t,e):t.ticks(e)}function Go(t,e,n){if("edges"===t){if(e)return"start";if(n)return"end"}return"middle"}function Xo(t,e,n){if("edges"===t){if(e)return"hanging";if(n)return"auto"}return"middle"}function Ho(t){if(0===t.length)return{min:null,max:null};let e=1/0,n=-1/0;for(const r of t)e>r.pixel&&(e=r.pixel),r.pixel>n&&(n=r.pixel);return{min:e,max:n}}function Vo(t){if(t)return"dashed"===t?"6,4":"dotted"===t?"2,4":t}function qo(t,e,n){if("left"===t||"right"===t){const r="left"===t?n:0,o="left"===t?-1:1,i=Math.ceil(e/8);let a="M0,"+r;for(let t=0;i>t;t++){const n=8*(t+1);a+=`L${Math.min(8*t+4,e)},${r+4*o}`,a+=`L${Math.min(n,e)},${r}`}return a}const r="bottom"===t?0:e,o="bottom"===t?1:-1,i=Math.ceil(n/8);let a=`M${r},0`;for(let t=0;i>t;t++){const e=8*(t+1);a+=`L${r+4*o},${Math.min(8*t+4,n)}`,a+=`L${r},${Math.min(e,n)}`}return a}var Uo=22;function Zo(t){return"string"==typeof t&&t.length>0}function Ko(t,e,n=!1){const r=n?e?58:34:e?36:0;return r>t.top?{...t,top:r}:t}function Jo(t,e){return Ko(t,Zo(e))}import{Fragment as Qo,jsx as ti,jsxs as ei}from"react/jsx-runtime";function ni(t){const{width:e,height:n,totalWidth:r,totalHeight:o,margin:i,scales:a,showAxes:s,axes:l,showGrid:c,xFormat:u,yFormat:h,axisExtent:d}=t,f=dr(()=>{if(!a)return[];const t=l?.find(t=>"bottom"===t.orient),n=t?.tickFormat||u||ri,r=Math.max(2,Math.floor(e/70)),o=t?.ticks??5,i="exact"===d?Math.max(2,o):Math.min(o,r),s=t?.tickValues??jo(a.x,i,d),c=s.map(t=>t.valueOf()),h=s.map((t,e)=>({value:t,pixel:a.x(t),label:n(t,e,c)})),f=h.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 oi(h,Math.max(55,f+8))},[a,l,u,e,d]),y=dr(()=>{if(!a)return[];const t=l?.find(t=>"left"===t.orient),e=t?.tickFormat||h||ri,r=Math.max(2,Math.floor(n/30)),o=t?.ticks??5,i="exact"===d?Math.max(2,o):Math.min(o,r);return oi((t?.tickValues??jo(a.y,i,d)).map(t=>({value:t,pixel:a.y(t),label:e(t)})),22)},[a,l,h,n,d]),p=c&&a,g=s&&a;if(!p&&!g)return null;const m=l?.find(t=>"bottom"===t.orient),x=l?.find(t=>"left"===t.orient),b=g&&(!m||!1!==m.baseline),v=g&&(!x||!1!==x.baseline),k=m?.jaggedBase||!1,w=x?.jaggedBase||!1,A="var(--semiotic-border, #ccc)";return ti("svg",{width:r,height:o,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:ei("g",{transform:`translate(${i.left},${i.top})`,children:[p&&(()=>{const t=Vo(l?.find(t=>"bottom"===t.orient)?.gridStyle),r=Vo(l?.find(t=>"left"===t.orient)?.gridStyle);return ei("g",{className:"stream-grid",children:[f.map((e,r)=>ti("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:t},"xgrid-"+r)),y.map((t,n)=>ti("line",{x1:0,y1:t.pixel,x2:e,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),b&&!k&&ti("line",{x1:0,y1:n,x2:e,y2:n,stroke:A,strokeWidth:1}),k&&ti("path",{d:qo("bottom",e,n),fill:"none",stroke:A,strokeWidth:1}),v&&!w&&ti("line",{x1:0,y1:0,x2:0,y2:n,stroke:A,strokeWidth:1}),w&&ti("path",{d:qo("left",e,n),fill:"none",stroke:A,strokeWidth:1})]})})}function ri(t,e,n){return t instanceof Date?`${t.toLocaleString("en",{month:"short"})} ${t.getDate()}`:"number"==typeof t?Math.round(100*t)/100+"":t+""}function oi(t,e){if(2>=t.length)return t;const n=[t[0]];for(let r=1;t.length-1>r;r++)e>Math.abs(t[r].pixel-n[n.length-1].pixel)||n.push(t[r]);const r=t[t.length-1];return e>Math.abs(r.pixel-n[n.length-1].pixel)?n[n.length-1]=r:n.push(r),n}function ii(t){const{width:e,height:n,totalWidth:r,totalHeight:o,margin:i,scales:a,showAxes:s,axes:l,xLabel:c,yLabel:u,yLabelRight:h,xFormat:d,yFormat:f,axisExtent:y,showGrid:g,title:m,legend:x,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:w,legendIsolatedCategories:A,legendPosition:M="right",legendLayout:S,foregroundGraphics:$,marginalGraphics:C,xValues:L,yValues:_,annotations:T,onAnnotationActivate:D,onObservation:R,chartId:W,chartType:E,autoPlaceAnnotations:N,svgAnnotationRules:I,xAccessor:O,yAccessor:F,annotationData:z,pointNodes:Y,curve:B,underlayRendered:j,canvasObscuresUnderlay:G=!0,linkedCrosshairName:X,linkedCrosshairSourceId:H,children:V}=t,U=k({onAnnotationActivate:D,onObservation:R,chartId:W,chartType:E}),Z=Ar(S),K=x&&"left"===M&&Z>0?Z:i.left,J=x&&"right"===M&&Z>0?Z:i.right,Q=dr(()=>{if(!s||!a)return[];const t=l?.find(t=>"bottom"===t.orient),n=t?.tickFormat||d||ri,r=Math.max(2,Math.floor(e/70)),o=t?.ticks??5,i="exact"===y?Math.max(2,o):Math.min(o,r),c=t?.tickValues??jo(a.x,i,y),u=c.map(t=>t.valueOf()),h=c.map((t,e)=>({value:t,pixel:a.x(t),label:n(t,e,u)})),f=h.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),p=t?.autoRotate?Math.max(20,Math.min(f+8,55)):Math.max(55,f+8);let g=oi(h,p);if(g.length>1&&(g=g.filter((t,e)=>0===e||t.label+""!=g[e-1].label+"")),t?.includeMax&&g.length>0&&"exact"!==y&&!t?.tickValues){const t=a.x.domain()[1],e=a.x(t),r=g[g.length-1].pixel;if(Math.abs(e-r)>1){const o=n(t,g.length,u);p>e-r&&g.length>1&&(g=g.slice(0,-1)),g.push({value:t,pixel:e,label:o})}}return g},[s,a,l,d,e,y]),tt=dr(()=>{const t=l?.find(t=>"bottom"===t.orient);if(!t?.autoRotate||1>=Q.length)return!1;const n=e/Math.max(Q.length-1,1);return Q.reduce((t,e)=>Math.max(t,"string"==typeof e.label?6.5*e.label.length:60),0)+8>n},[l,Q,e]),et=dr(()=>{if(!s||!a)return[];const t=l?.find(t=>"left"===t.orient),e=t?.tickFormat||f||ri,r=Math.max(2,Math.floor(n/30)),o=t?.ticks??5,i="exact"===y?Math.max(2,o):Math.min(o,r);let c=oi((t?.tickValues??jo(a.y,i,y)).map(t=>({value:t,pixel:a.y(t),label:e(t)})),22);if(c.length>1&&(c=c.filter((t,e)=>0===e||t.label+""!=c[e-1].label+"")),t?.includeMax&&c.length>0&&"exact"!==y&&!t?.tickValues){const t=a.y.domain()[1],n=a.y(t),r=c[c.length-1].pixel;if(Math.abs(n-r)>1){const o=e(t);22>Math.abs(n-r)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:t,pixel:n,label:o})}}return c},[s,a,l,f,n,y]),nt=dr(()=>{if(!s||!a)return[];const t=l?.find(t=>"right"===t.orient);if(!t)return[];const e=t.tickFormat||f||ri,r=Math.max(2,Math.floor(n/30)),o=t.ticks??5;return oi((t.tickValues??jo(a.y,"exact"===y?Math.max(2,o):Math.min(o,r),y)).map(t=>({value:t,pixel:a.y(t),label:e(t)})),22)},[s,a,l,f,n,y]),rt=fr(new Map),ot=fr(T?.length??0),it=T?.length??0;ot.current!==it&&(ot.current=it,rt.current=new Map);const at=dr(()=>{if(!T||0===T.length)return null;const t=q(T),r=To(0,U),o={scales:a?{x:a.x,y:a.y,time:a.x,value:a.y}:null,timeAxis:"x",xAccessor:O,yAccessor:F,width:e,height:n,data:z,frameType:"xy",pointNodes:Y,curve:B,stickyPositionCache:rt.current};return _o(N?P({annotations:t,context:o,..."object"==typeof N?N:{}}):t,r,I,o)},[T,N,I,e,n,O,F,z,a,Y,B,U]),st=function(t){const e=Do(t?Fo:Yo,t?Oo:Bo,t?Oo:Bo);return t?e.positions.get(t)??null:null}(X);return yr(()=>{if(!st?.locked||!X)return;const t=t=>{"Escape"===t.key&&Io(X)};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[st?.locked,X]),s||m||x||$||C||at&&at.length>0||g||V||st?ei("svg",{role:"img",width:r,height:o,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[ti("title",{children:"string"==typeof m?m:"XY Chart"}),ti("desc",{children:"string"==typeof m?m+" (XY data visualization)":"XY data visualization"}),ei("g",{transform:`translate(${i.left},${i.top})`,children:[g&&a&&(!j||G)&&(()=>{const t=Vo(l?.find(t=>"bottom"===t.orient)?.gridStyle),r=Vo(l?.find(t=>"left"===t.orient)?.gridStyle);return ei("g",{className:"stream-grid",children:[Q.map((e,r)=>ti("line",{x1:e.pixel,y1:0,x2:e.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:t},"xgrid-"+r)),et.map((t,n)=>ti("line",{x1:0,y1:t.pixel,x2:e,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),s&&a&&(()=>{const t=l?.find(t=>"left"===t.orient),r=l?.find(t=>"bottom"===t.orient),o=!t||!1!==t.baseline,i=!r||!1!==r.baseline,a=t?.jaggedBase||!1,s=r?.jaggedBase||!1,d=r?.landmarkTicks,f=t?.landmarkTicks,y="var(--semiotic-border, #ccc)",g="var(--semiotic-text-secondary, var(--semiotic-text, #666))",m="var(--semiotic-text, #333)",x=tt,b=x?12:18,v=n+(x?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},M=r?.tickAnchor,S=t?.tickAnchor,$=Ho(Q),P=Ho(et);return ei("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[ei("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!j||G)&&i&&!s&&ti("line",{x1:0,y1:n,x2:e,y2:n,stroke:y,strokeWidth:1}),(!j||G)&&s&&ti("path",{d:qo("bottom",e,n),fill:"none",stroke:y,strokeWidth:1}),Q.map((t,e)=>{const r=!!d&&("function"==typeof d?d(t.value,e):p(t.value,e>0?Q[e-1].value:void 0));return ei("g",{transform:`translate(${t.pixel},${n})`,children:[ti("line",{y2:5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?ti("text",{y:b,textAnchor:x?"end":Go(M,t.pixel===$.min,t.pixel===$.max),fontWeight:r?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...r?w:k},transform:x?"rotate(-45)":void 0,children:t.label}):ti("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:ti("div",{style:{textAlign:"center",userSelect:"none",...k},children:t.label})})]},"xtick-"+e)}),c&&ti("text",{x:e/2,y:v,textAnchor:"middle",fill:m,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:c})]}),ei("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!j||G)&&o&&!a&&ti("line",{x1:0,y1:0,x2:0,y2:n,stroke:y,strokeWidth:1}),(!j||G)&&a&&ti("path",{d:qo("left",e,n),fill:"none",stroke:y,strokeWidth:1}),et.map((t,e)=>{const n=!!f&&("function"==typeof f?f(t.value,e):p(t.value,e>0?et[e-1].value:void 0));return ei("g",{transform:`translate(0,${t.pixel})`,children:[ti("line",{x2:-5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?ti("text",{x:-8,textAnchor:"end",dominantBaseline:Xo(S,t.pixel===P.min,t.pixel===P.max),fontWeight:n?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...n?w:k},children:t.label}):ti("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:ti("div",{style:{textAlign:"right",userSelect:"none",...k},children:t.label})})]},"ytick-"+e)}),(()=>{const e=t?.label||u;return e?ti("text",{x:15-K,y:n/2,textAnchor:"middle",fill:m,transform:`rotate(-90, ${15-K}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:e}):null})()]}),(()=>{const t=l?.find(t=>"right"===t.orient);if(!t||0===nt.length)return null;const r=!1!==t.baseline,o=t.landmarkTicks,i=t.label||h,a=t.tickAnchor,s=Ho(nt);return ei("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[r&&ti("line",{x1:e,y1:0,x2:e,y2:n,stroke:y,strokeWidth:1}),nt.map((t,n)=>{const r=!!o&&("function"==typeof o?o(t.value,n):p(t.value,n>0?nt[n-1].value:void 0));return ei("g",{transform:`translate(${e},${t.pixel})`,children:[ti("line",{x2:5,stroke:y,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?ti("text",{x:8,textAnchor:"start",dominantBaseline:Xo(a,t.pixel===s.min,t.pixel===s.max),fontWeight:r?600:400,fill:g,className:"semiotic-axis-tick",style:{userSelect:"none",...r?w:k},children:t.label}):ti("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:ti("div",{style:{textAlign:"left",userSelect:"none",...k},children:t.label})})]},"ytick-r-"+n)}),i&&ti("text",{x:e+J-15,y:n/2,textAnchor:"middle",fill:m,transform:`rotate(90, ${e+J-15}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:i})]})})()]})})(),at,C&&a&&L&&_&&ei(Qo,{children:[C.top&&ti("g",{transform:"translate(0, 0)",children:ti(Xr,{orient:"top",config:Gr(C.top),values:L,scale:a.x,size:i.top,length:e})}),C.bottom&&ti("g",{transform:`translate(0, ${n})`,children:ti(Xr,{orient:"bottom",config:Gr(C.bottom),values:L,scale:a.x,size:i.bottom,length:e})}),C.left&&ti("g",{transform:"translate(0, 0)",children:ti(Xr,{orient:"left",config:Gr(C.left),values:_,scale:a.y,size:i.left,length:n})}),C.right&&ti("g",{transform:`translate(${e}, 0)`,children:ti(Xr,{orient:"right",config:Gr(C.right),values:_,scale:a.y,size:i.right,length:n})})]}),$,st&&st.sourceId!==H&&a?.x&&(()=>{const t=a.x(st.xValue);if(null==t||0>t||t>e)return null;const r=st.locked;return ti("line",{x1:t,y1:0,x2:t,y2:n,stroke:r?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:r?1.5:1,strokeDasharray:r?"6,3":"4,4",pointerEvents:"none"})})(),V]}),m&&"string"==typeof m?ti("text",{x:r/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:m}):m?ti("foreignObject",{x:0,y:0,width:r,height:i.top,children:m}):null,Fr({legend:x,totalWidth:r,totalHeight:o,margin:i,legendPosition:M,title:m,legendLayout:S,axisChrome:{hasAxis:!!s,hasAxisLabel:!!c,rotatedTicks:tt},legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:w,legendIsolatedCategories:A})]}):null}import*as ai from"react";import{area as si,line as li}from"d3-shape";function ci(t,e,n){let r=n;for(const n of e)"lesser"===n.thresholdType?n.value>t&&(r=n.color):t>n.value&&(r=n.color);return r}function ui(t,e,n,r){if(2>t.length||e.length!==t.length||0===n.length)return[];const o=[],i=(t,e,n)=>{const r=o[o.length-1];r?.color===t?r.path.push(n):o.push({color:t,path:[e,n]})};for(let o=1;t.length>o;o++){const[a,s]=t[o-1],[l,c]=t[o],u=e[o-1],h=e[o]-u,d=[0,...0===h?[]:n.map(({value:t})=>(t-u)/h).filter(t=>t>0&&1>t&&Number.isFinite(t)).sort((t,e)=>t-e).filter((t,e,n)=>0===e||t!==n[e-1]),1];for(let t=1;d.length>t;t++){const e=d[t-1],o=d[t];i(ci(u+h*((e+o)/2),n,r),[a+(l-a)*e,s+(c-s)*e],[a+(l-a)*o,s+(c-s)*o])}}return o}function hi(t){return(t.tl??0)>0||(t.tr??0)>0||(t.br??0)>0||(t.bl??0)>0}function di(t){const e=t.cornerRadii;if(!e)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(t.w,t.h)/2,r=t=>Math.max(0,Math.min(t??0,n));return{tl:r(e.tl),tr:r(e.tr),br:r(e.br),bl:r(e.bl)}}import{jsx as fi,jsxs as yi}from"react/jsx-runtime";var pi={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function gi(t,e="#4e79a7"){return y(t)?t.background&&"transparent"!==t.background?t.background:e:t&&"string"==typeof t?t:e}function mi(t){const e=t.replace(/[^A-Za-z0-9_-]/g,"_");return!e||/^\d/.test(e)?"s_"+e:e}function xi(t,e,n,r){const o=t.glyph;if(!o?.parts?.length||0>=t.size)return null;const i=R(o,t.size);if(0>=i.scale)return null;const a=`translate(${e},${n})${t.rotation?` rotate(${180*t.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,s=t.color??("string"==typeof t.style.fill?t.style.fill:void 0),l=T(o,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal"),c=l?mi(r+"-clip"):void 0,u=(t.style.opacity??1)*(t._decayOpacity??1)*(t.style.fillOpacity??1),h=e=>o.parts.map((n,r)=>{const o=e?"none"===n.fill?void 0:e:N(n.fill,s,t.accent),i=e?n.stroke&&"none"!==n.stroke?e:void 0:N(n.stroke??"none",s,t.accent);return o||i?fi("path",{d:n.d,fill:o??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});return yi("g",{transform:a,opacity:1===u?void 0:u,children:[l&&c&&fi("clipPath",{id:c,children:fi("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&t.ghostColor?fi("g",{children:h(t.ghostColor)}):null,l&&c?fi("g",{clipPath:`url(#${c})`,children:h()}):h()]},r)}function bi(t,e){const n=t.filter(t=>Number.isFinite(t.offset)&&(null==t.opacity||Number.isFinite(t.opacity))).map(t=>({offset:Math.max(0,Math.min(1,t.offset)),color:t.color??e,opacity:null==t.opacity?void 0:Math.max(0,Math.min(1,t.opacity))}));return 2>n.length?null:n.map((t,e)=>fi("stop",{offset:t.offset,stopColor:t.color,stopOpacity:t.opacity},e))}function vi(t,e,n){const r=B(t.symbolType,t.size,t.path);return fi("path",{d:r,transform:t.rotation?`translate(${t.x},${t.y}) rotate(${180*t.rotation/Math.PI})`:`translate(${t.x},${t.y})`,fill:t.style.fill?gi(t.style.fill):"none",fillOpacity:t.style.fillOpacity,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},`${n??""}symbol-${e}`)}import*as ki from"react";import{arc as wi}from"d3-shape";import{jsx as Ai,jsxs as Mi}from"react/jsx-runtime";function Si(t,e){switch(t.type){case"circle":{const n=t,r=y(n.style.fill)?h(n.style.fill,`net-circle-${e}-hatch`):void 0;return Mi(ki.Fragment,{children:[r&&Ai("defs",{children:r}),Ai("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:r?`url(#net-circle-${e}-hatch)`:gi(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-circle-"+e)}case"rect":{const n=t,r=y(n.style.fill)?h(n.style.fill,`net-rect-${e}-hatch`):void 0;return Mi(ki.Fragment,{children:[r&&Ai("defs",{children:r}),Ai("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r?`url(#net-rect-${e}-hatch)`:gi(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-rect-"+e)}case"arc":{const n=t,r=wi().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(pi)||"",o=y(n.style.fill)?h(n.style.fill,`net-arc-${e}-hatch`):void 0;return Mi(ki.Fragment,{children:[o&&Ai("defs",{children:o}),Ai("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:o?`url(#net-arc-${e}-hatch)`:gi(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-arc-"+e)}case"symbol":{const n=t,r=B(n.symbolType,n.size,n.path);return Ai("path",{d:r,transform:n.rotation?`translate(${n.cx},${n.cy}) rotate(${180*n.rotation/Math.PI})`:`translate(${n.cx},${n.cy})`,fill:n.style.fill?gi(n.style.fill):"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-symbol-"+e)}case"glyph":return xi(t,t.cx,t.cy,"net-glyph-"+(t.id??e));default:return null}}function $i(t,e){switch(t.type){case"line":return Ai("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+e);case"bezier":{const n=t;return Ai("path",{d:n.pathD,fill:gi(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+e)}case"ribbon":{const n=t;return Ai("path",{d:n.pathD,fill:gi(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+e)}case"curved":{const n=t;return Ai("path",{d:n.pathD,fill:gi(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+e)}default:return null}}function Pi(t,e){return Ai("text",{x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"var(--semiotic-text, #333)",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,children:t.text},"net-label-"+e)}import*as Ci from"react";import{jsx as Li,jsxs as _i}from"react/jsx-runtime";function Ti(t,e){switch(t.type){case"geoarea":{const n=t;if(!n.pathData)return null;const r=y(n.style.fill)?h(n.style.fill,`geoarea-${e}-hatch`):void 0;return _i(Ci.Fragment,{children:[r&&Li("defs",{children:r}),Li("path",{d:n.pathData,fill:r?`url(#geoarea-${e}-hatch)`:gi(n.style.fill,"#e0e0e0"),fillOpacity:n.style.fillOpacity??1,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth||.5,strokeDasharray:n.style.strokeDasharray,opacity:n._decayOpacity??1})]},"geoarea-"+e)}case"point":{const n=t,r=y(n.style.fill)?h(n.style.fill,`geopoint-${e}-hatch`):void 0;return _i(Ci.Fragment,{children:[r&&Li("defs",{children:r}),Li("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${e}-hatch)`:gi(n.style.fill),fillOpacity:n.style.fillOpacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n._decayOpacity??n.style.opacity??1})]},"point-"+e)}case"line":{const n=t;if(2>n.path.length)return null;const r="M"+n.path.map(t=>`${t[0]},${t[1]}`).join("L");return Li("path",{d:r,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity??1},"line-"+e)}case"glyph":return xi(t,t.x,t.y,"geo-glyph-"+(t.pointId??e));default:return null}}import*as Di from"react";import{arc as Ri}from"d3-shape";var Wi=(t,e)=>({x:t*Math.cos(e),y:t*Math.sin(e)});function Ei(t){const{innerRadius:e,outerRadius:n,startAngle:r,endAngle:o}=t,i=0>=e;if(0>=(t.cornerRadius??0)||!t.roundStart&&!t.roundEnd){if(i){const t=Wi(n,r),e=Wi(n,o);return`M0,0 L${t.x},${t.y} A${n},${n} 0 ${o-r>Math.PI?1:0} 1 ${e.x},${e.y} Z`}const t=Wi(n,r),a=Wi(n,o),s=Wi(e,o),l=Wi(e,r),c=o-r>Math.PI?1:0;return`M${t.x},${t.y} A${n},${n} 0 ${c} 1 ${a.x},${a.y} L${s.x},${s.y} A${e},${e} 0 ${c} 0 ${l.x},${l.y} Z`}const a=Math.max(0,Math.min(t.cornerRadius??0,(n-e)/2));if(0===a)return Ei({...t,cornerRadius:0,roundStart:!1,roundEnd:!1});const s=Math.asin(Math.min(1,a/Math.max(1e-9,n-a))),l=i?0:Math.asin(Math.min(1,a/Math.max(1e-9,e+a))),c=o-r,u=t.roundStart&&t.roundEnd?c/2:c,h=!!t.roundStart&&u>s,d=!!t.roundEnd&&u>s;if(!h&&!d)return Ei({...t,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=r+(h?s:0),y=o-(d?s:0),p=r+(h?l:0),g=o-(d?l:0),m=Wi(n,f),x=Wi(n,y),b=(n-a)*Math.cos(s),v=Wi(b,r),k=Wi(b,o),w=i?null:Wi(e,g),A=i?null:Wi(e,p),M=i?0:(e+a)*Math.cos(l),S=i?null:Wi(M,r),$=i?null:Wi(M,o),P=y-f>Math.PI?1:0,C=i?0:g-p>Math.PI?1:0;let L="";if(h)L+=`M${v.x},${v.y}`,L+=` A${a},${a} 0 0 1 ${m.x},${m.y}`;else{const t=Wi(n,r);L+=`M${t.x},${t.y}`}if(d)L+=` A${n},${n} 0 ${P} 1 ${x.x},${x.y}`,L+=` A${a},${a} 0 0 1 ${k.x},${k.y}`;else{const t=Wi(n,o);L+=` A${n},${n} 0 ${P} 1 ${t.x},${t.y}`}if(i)L+=" L0,0";else{if(d)L+=` L${$.x},${$.y}`,L+=` A${a},${a} 0 0 1 ${w.x},${w.y}`;else{const t=Wi(e,o);L+=` L${t.x},${t.y}`}if(h)L+=` A${e},${e} 0 ${C} 0 ${A.x},${A.y}`,L+=` A${a},${a} 0 0 1 ${S.x},${S.y}`;else{const t=Wi(e,r);L+=` A${e},${e} 0 ${C} 0 ${t.x},${t.y}`}}return L+=" Z",L}import{jsx as Ni,jsxs as Ii}from"react/jsx-runtime";function Oi(t){return 1e6>t?1e4>t?1e3>t?t+"":(t/1e3).toFixed(1)+"K":(t/1e3).toFixed(0)+"K":(t/1e6).toFixed(1)+"M"}function Fi(t,e){const n=t.datum;if(!n)return null;const r=[],o=n.__funnelStepLabel,i=Number(n.__funnelStepLabelX),a=Number(n.__funnelStepLabelY),s=Number(n.__funnelRowWidth);"string"!=typeof o||!Number.isFinite(i)||!Number.isFinite(a)||Number.isFinite(s)&&8.4*o.length+16>s||r.push(Ni("text",{x:i,y:a+3,textAnchor:"middle",dominantBaseline:"hanging",fontSize:14,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.6)",strokeWidth:3,paintOrder:"stroke",children:o},e+"-funnel-step"));const l=Number(n.__funnelValue),c=Number(n.__funnelValueLabelX),u=Number(n.__funnelValueLabelY),h=Number(n.__funnelBarW);if(Number.isFinite(l)&&0!==l&&Number.isFinite(c)&&Number.isFinite(u)&&h>=60){const t=Number(n.__funnelPercent);let o=!0!==n.__funnelIsFirstStep&&Number.isFinite(t)?`${Oi(l)} (${.05>Math.abs(t-Math.round(t))?Math.round(t):t.toFixed(1)}%)`:Oi(l);7.8*o.length+16>h&&(o=Oi(l)),7.8*o.length+16>h||r.push(Ni("text",{x:c,y:u+22,textAnchor:"middle",dominantBaseline:"hanging",fontSize:13,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.5)",strokeWidth:3,paintOrder:"stroke",children:o},e+"-funnel-value"))}return r.length?Ni("g",{children:r},e+"-funnel-labels"):null}function zi(t,e,n){const r=("category"in t?t.category:void 0)||("group"in t?t.group:void 0)||"",o=n=>`ord-${t.type}-${r}-${e}-${n}`,i=`ord-${t.type}-${r}-${e}`;switch(t.type){case"rect":{const e=t,n=mi(i)+"-grad",r=function(t,e){const n=t.fillGradient;if(!n||"object"!=typeof n)return null;let r=t.x,o=t.y,i=t.x,a=t.y+t.h;"bottom"===t.roundedEdge?(o=t.y+t.h,a=t.y):"right"===t.roundedEdge?(r=t.x+t.w,o=t.y,i=t.x,a=t.y):"left"===t.roundedEdge&&(r=t.x,o=t.y,i=t.x+t.w,a=t.y);const s=bi(n.stops,gi(t.style.fill));return s?fi("linearGradient",{id:e,gradientUnits:"userSpaceOnUse",x1:r,y1:o,x2:i,y2:a,children:s}):null}(e,n);let o,a;if(r)a=`url(#${n})`;else if(y(e.style.fill)){const t=mi(i)+"-hatch";o=h(e.style.fill,t),a=`url(#${t})`}else a=gi(e.style.fill);const s=r||o?Ii("defs",{children:[r,o]}):null;if(e.cornerRadii&&hi(e.cornerRadii)){const t=function(t){const{x:e,y:n,w:r,h:o}=t,{tl:i,tr:a,br:s,bl:l}=di(t);let c=`M${e+i},${n}`;return c+=` L${e+r-a},${n}`,a>0&&(c+=` A${a},${a} 0 0 1 ${e+r},${n+a}`),c+=` L${e+r},${n+o-s}`,s>0&&(c+=` A${s},${s} 0 0 1 ${e+r-s},${n+o}`),c+=` L${e+l},${n+o}`,l>0&&(c+=` A${l},${l} 0 0 1 ${e},${n+o-l}`),c+=` L${e},${n+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${e+i},${n}`),c+=" Z",c}(e);return Ii(Di.Fragment,{children:[s,Ni("path",{d:t,fill:a,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth})]},i)}if(e.roundedTop&&e.roundedTop>0){const t=Math.min(e.roundedTop,e.w/2,e.h/2),{x:n,y:r,w:o,h:l}=e;let c;switch(e.roundedEdge){case"right":c=`M${n},${r} L${n+o-t},${r} A${t},${t} 0 0 1 ${n+o},${r+t} L${n+o},${r+l-t} A${t},${t} 0 0 1 ${n+o-t},${r+l} L${n},${r+l} Z`;break;case"left":c=`M${n+o},${r} L${n+t},${r} A${t},${t} 0 0 0 ${n},${r+t} L${n},${r+l-t} A${t},${t} 0 0 0 ${n+t},${r+l} L${n+o},${r+l} Z`;break;case"bottom":c=`M${n},${r} L${n+o},${r} L${n+o},${r+l-t} A${t},${t} 0 0 1 ${n+o-t},${r+l} L${n+t},${r+l} A${t},${t} 0 0 1 ${n},${r+l-t} Z`;break;default:c=`M${n},${r+l} L${n},${r+t} A${t},${t} 0 0 1 ${n+t},${r} L${n+o-t},${r} A${t},${t} 0 0 1 ${n+o},${r+t} L${n+o},${r+l} Z`}return Ii(Di.Fragment,{children:[s,Ni("path",{d:c,fill:a,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth})]},i)}return Ii(Di.Fragment,{children:[s,Ni("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:a,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth}),Fi(e,i)]},i)}case"point":{const e=t;return Ni("circle",{cx:e.x,cy:e.y,r:e.r,fill:gi(e.style.fill),opacity:e.style.opacity??e.style.fillOpacity??.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},i)}case"symbol":return vi(t,e,n);case"glyph":return xi(t,t.x,t.y,`${n??""}ord-glyph-${t.pointId??e}`);case"wedge":{const r=t;if(r._gradientBand&&r._gradientBand.colors.length>0){const t=mi(`${n?n+"-":""}gauge-grad-${r.category||i}-${e}`),{clipPath:o,slices:a}=function(t){const e=Ei({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundStart,roundEnd:t.roundEnd}),n=[],r=t.colors;if(r.length>0){const e=(t.endAngle-t.startAngle)/r.length;for(let o=0;r.length>o;o++)n.push({d:Ei({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+o*e,endAngle:t.endAngle}),color:r[o]})}return{clipPath:e,slices:n}}({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds?.start??!0,roundEnd:r.roundedEnds?.end??!0,colors:r._gradientBand.colors});return Ii("g",{transform:`translate(${r.cx},${r.cy})`,opacity:r.style.opacity,fillOpacity:r.style.fillOpacity,children:[Ni("defs",{children:Ni("clipPath",{id:t,children:Ni("path",{d:o})})}),Ni("g",{clipPath:`url(#${t})`,children:a.map((t,e)=>Ni("path",{d:t.d,fill:gi(t.color)},e))}),r.style.stroke&&"none"!==r.style.stroke&&Ni("path",{d:o,fill:"none",stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},i)}let o;if(r.roundedEnds)o=Ei({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds.start,roundEnd:r.roundedEnds.end});else{const t=Ri().innerRadius(r.innerRadius).outerRadius(r.outerRadius).startAngle(r.startAngle+Math.PI/2).endAngle(r.endAngle+Math.PI/2);r.cornerRadius&&t.cornerRadius(r.cornerRadius),o=t(pi)||""}return Ni("path",{d:o,transform:`translate(${r.cx},${r.cy})`,fill:gi(r.style.fill),stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,opacity:r.style.opacity},i)}case"boxplot":{const e=t,n=e.columnWidth/2;return Ii("g","vertical"===e.projection?{children:[Ni("line",{x1:e.x,y1:e.minPos,x2:e.x,y2:e.maxPos,stroke:e.style.stroke||"#333",strokeWidth:1}),Ni("rect",{x:e.x-n,y:Math.min(e.q1Pos,e.q3Pos),width:e.columnWidth,height:Math.abs(e.q3Pos-e.q1Pos),fill:gi(e.style.fill),fillOpacity:e.style.fillOpacity??.6,stroke:e.style.stroke||"#333",strokeWidth:1}),Ni("line",{x1:e.x-n,y1:e.medianPos,x2:e.x+n,y2:e.medianPos,stroke:e.style.stroke||"#333",strokeWidth:2}),Ni("line",{x1:e.x-.5*n,y1:e.minPos,x2:e.x+.5*n,y2:e.minPos,stroke:e.style.stroke||"#333",strokeWidth:1}),Ni("line",{x1:e.x-.5*n,y1:e.maxPos,x2:e.x+.5*n,y2:e.maxPos,stroke:e.style.stroke||"#333",strokeWidth:1})]}:{children:[Ni("line",{x1:e.minPos,y1:e.y,x2:e.maxPos,y2:e.y,stroke:e.style.stroke||"#333",strokeWidth:1}),Ni("rect",{x:Math.min(e.q1Pos,e.q3Pos),y:e.y-n,width:Math.abs(e.q3Pos-e.q1Pos),height:e.columnWidth,fill:gi(e.style.fill),fillOpacity:e.style.fillOpacity??.6,stroke:e.style.stroke||"#333",strokeWidth:1}),Ni("line",{x1:e.medianPos,y1:e.y-n,x2:e.medianPos,y2:e.y+n,stroke:e.style.stroke||"#333",strokeWidth:2}),Ni("line",{x1:e.minPos,y1:e.y-.5*n,x2:e.minPos,y2:e.y+.5*n,stroke:e.style.stroke||"#333",strokeWidth:1}),Ni("line",{x1:e.maxPos,y1:e.y-.5*n,x2:e.maxPos,y2:e.y+.5*n,stroke:e.style.stroke||"#333",strokeWidth:1})]},i)}case"violin":{const e=t,n=[Ni("path",{d:e.pathString,transform:e.translateX||e.translateY?`translate(${e.translateX},${e.translateY})`:void 0,fill:gi(e.style.fill),fillOpacity:e.style.fillOpacity??.6,stroke:e.style.stroke||"#333",strokeWidth:e.style.strokeWidth||1},o("path"))];if(e.iqrLine&&e.bounds){const t=e.bounds,r=t.x+t.width/2,i=t.y+t.height/2;e.iqrLine.isVertical?n.push(Ni("line",{x1:r,y1:e.iqrLine.q1Pos,x2:r,y2:e.iqrLine.q3Pos,stroke:e.style.stroke||"#333",strokeWidth:2},o("iqr")),Ni("circle",{cx:r,cy:e.iqrLine.medianPos,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},o("med"))):n.push(Ni("line",{x1:e.iqrLine.q1Pos,y1:i,x2:e.iqrLine.q3Pos,y2:i,stroke:e.style.stroke||"#333",strokeWidth:2},o("iqr")),Ni("circle",{cx:e.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},o("med")))}return Ni("g",{children:n},i)}case"connector":return Ni("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity??.5},i);case"trapezoid":{const e=t,n=e.points.map(t=>`${t[0]},${t[1]}`).join(" ");return Ni("polygon",{points:n,fill:gi(e.style.fill,"#999"),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},i)}default:return null}}import{jsx as Yi,jsxs as Bi}from"react/jsx-runtime";function ji(t,e,n,r){if(!t||2>e.length)return null;const o=bi(t.stops,r);return o?Yi("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:e[0][0],y1:0,x2:e[e.length-1][0],y2:0,children:o}):null}function Gi(t,e,n){switch(t.type){case"line":{const r=t;if(0===r.path.length)return null;const o=On(r.curve),i=o?li().x(([t])=>t).y(([,t])=>t).curve(o)(r.path)??"":"M"+r.path.map(([t,e])=>`${t},${e}`).join("L"),a=mi(`${n?n+"-":""}line-${e}-stroke-gradient`),s=ji(r.strokeGradient,r.path,a,r.style.stroke||"#4e79a7");return Bi(ai.Fragment,{children:[s&&Yi("defs",{children:s}),Yi("path",{d:i,fill:"none",stroke:s?`url(#${a})`:r.style.stroke||"#4e79a7",strokeWidth:r.style.strokeWidth||2,strokeDasharray:r.style.strokeDasharray,opacity:r.style.opacity})]},"line-"+e)}case"area":{const r=t;if(0===r.topPath.length)return null;const o=On(r.curve),i=!o||2>r.topPath.length||2>r.bottomPath.length?`M${r.topPath.map(([t,e])=>`${t},${e}`).join("L")}L${[...r.bottomPath].reverse().map(([t,e])=>`${t},${e}`).join("L")}Z`:si().x(([t])=>t).y0((t,e)=>r.bottomPath[e][1]).y1(([,t])=>t).curve(o)(r.topPath)??"",a=`${n?n+"-":""}area-${e}-hatch`,s=y(r.style.fill)?h(r.style.fill,a):void 0,l=mi(`${n?n+"-":""}area-${e}-gradient`),c=function(t,e){const n=t.fillGradient;if(!n||"object"!=typeof n)return null;let r=1/0;for(const[,e]of t.topPath)r=Math.min(r,e);let o=-1/0;for(const[,e]of t.bottomPath)o=Math.max(o,e);if(!Number.isFinite(r)||!Number.isFinite(o))return null;const i=bi(n.stops,gi(t.style.fill));return i?Yi("linearGradient",{id:e,gradientUnits:"userSpaceOnUse",x1:0,y1:r,x2:0,y2:o,children:i}):null}(r,l),u=c?`url(#${l})`:s?`url(#${a})`:gi(r.style.fill),d=c?void 0:r.style.fillOpacity??r.style.opacity??.7,f=o?li().x(([t])=>t).y(([,t])=>t).curve(o)(r.topPath)??"":"M"+r.topPath.map(([t,e])=>`${t},${e}`).join("L"),p=mi(`${n?n+"-":""}area-${e}-stroke-gradient`),g=!(!r.colorThresholds?.length||!r.rawValues||r.rawValues.length!==r.topPath.length),m=!!r.strokeColorBands?.length,x=g||m?null:ji(r.strokeGradient,r.topPath,p,r.style.stroke||"#4e79a7"),b=r.style.strokeWidth||2;let v=1/0,k=-1/0;for(const[t]of r.topPath)v>t&&(v=t),t>k&&(k=t);const w=m?r.strokeColorBands.map((t,r)=>mi(`${n?n+"-":""}area-${e}-stroke-band-${r}`)):[],A=m?r.strokeColorBands.map((t,e)=>Yi("clipPath",{id:w[e],children:Yi("rect",{x:v-b,y:t.y,width:k-v+2*b,height:t.height})},w[e])):null,M=r.style.stroke&&"none"!==r.style.stroke?m?r.strokeColorBands.map((t,n)=>Yi("path",{d:f,fill:"none",stroke:t.color??gi(r.style.stroke),strokeWidth:b,opacity:r.style.opacity,clipPath:`url(#${w[n]})`},`area-${e}-stroke-band-${n}`)):g?ui(r.topPath,r.rawValues,r.colorThresholds,gi(r.style.stroke)).map((t,n)=>Yi("path",{d:"M"+t.path.map(([t,e])=>`${t},${e}`).join("L"),fill:"none",stroke:t.color,strokeWidth:b,opacity:r.style.opacity},`area-${e}-threshold-${n}`)):Yi("path",{d:f,fill:"none",stroke:x?`url(#${p})`:gi(r.style.stroke),strokeWidth:b,opacity:r.style.opacity}):null;if(r.clipRect){const t=`${n?n+"-":""}area-clip-${e}`;return Bi("g",{children:[Bi("defs",{children:[c,!c&&s,x,A,Yi("clipPath",{id:t,children:Yi("rect",{x:r.clipRect.x,y:r.clipRect.y,width:r.clipRect.width,height:r.clipRect.height})})]}),Bi("g",{clipPath:`url(#${t})`,children:[Yi("path",{d:i,fill:u,fillOpacity:d,opacity:c?r.style.opacity:void 0,stroke:"none"}),M]})]},"area-"+e)}return Bi(ai.Fragment,{children:[(c||s||x||A)&&Bi("defs",{children:[c,!c&&s,x,A]}),Yi("path",{d:i,fill:u,fillOpacity:d,opacity:c?r.style.opacity:void 0,stroke:"none"}),M]},"area-"+e)}case"point":{const r=t,o=`${n?n+"-":""}point-${e}-hatch`,i=y(r.style.fill)?h(r.style.fill,o):void 0;return Bi(ai.Fragment,{children:[i&&Yi("defs",{children:i}),Yi("circle",{cx:r.x,cy:r.y,r:r.r,fill:i?`url(#${o})`:gi(r.style.fill),opacity:r.style.opacity??r.style.fillOpacity??.8,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"point-"+e)}case"symbol":return vi(t,e);case"glyph":return xi(t,t.x,t.y,`${n??""}glyph-${t.pointId??e}`);case"rect":{const r=t,o=`${n?n+"-":""}xyrect-${e}-hatch`,i=y(r.style.fill)?h(r.style.fill,o):void 0;return Bi(ai.Fragment,{children:[i&&Yi("defs",{children:i}),Yi("rect",{x:r.x,y:r.y,width:r.w,height:r.h,fill:i?`url(#${o})`:gi(r.style.fill),opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"rect-"+e)}case"heatcell":{const n=t,r={x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth,...null!=n.style?.opacity&&{opacity:n.style.opacity}};if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const t=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[o,i,a]=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]}(n.fill),s=.299*o+.587*i+.114*a>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return Bi("g",{children:[Yi("rect",{...r}),Yi("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:l+"px",children:t})]},"heatcell-"+e)}return Yi("rect",{...r},"heatcell-"+e)}case"candlestick":{const n=t;if(n.isRange){const t=n.dotRadius??Math.max(2,n.bodyWidth/2);return Bi("g",{children:[Yi("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),Yi("circle",{cx:n.x,cy:n.highY,r:t,fill:n.wickColor}),Yi("circle",{cx:n.x,cy:n.lowY,r:t,fill:n.wickColor})]},"candle-"+e)}const r=Math.min(n.openY,n.closeY),o=Math.max(Math.abs(n.openY-n.closeY),1),i=n.isUp?n.upColor:n.downColor;return Bi("g",{children:[Yi("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),Yi("rect",{x:n.x-n.bodyWidth/2,y:r,width:n.bodyWidth,height:o,fill:i,stroke:i,strokeWidth:1})]},"candle-"+e)}default:return null}}var Xi="undefined"==typeof window||"undefined"==typeof document;import{useEffect as Hi,useLayoutEffect as Vi,useRef as qi,useState as Ui,useSyncExternalStore as Zi}from"react";var Ki="undefined"!=typeof window?Vi:Hi;function Ji(){const[t,e]=Ui(!1);return Ki(()=>{e(!0)},[]),t}var Qi=()=>()=>{},ta=()=>!1,ea=()=>!0;function na(){const t=Zi(Qi,ta,ea);return qi(t).current}import{useRef as ra}from"react";function oa(t){const e=ra(t);return function(t,e){if(Object.is(t,e))return!0;if(Array.isArray(t)&&Array.isArray(e))return aa(t,e);if(!sa(t)||!sa(e))return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(e,r))return!1;const n=t[r],o=e[r];if(!Object.is(n,o))if(Array.isArray(n)&&Array.isArray(o)){if(!aa(n,o))return!1}else{if(!sa(n)||!sa(o))return!1;if(!ia(n,o))return!1}}return!0}(e.current,t)||(e.current=t),e.current}function ia(t,e){const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(e,r))return!1;if(!Object.is(t[r],e[r]))return!1}return!0}function aa(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(!Object.is(t[n],e[n]))return!1;return!0}function sa(t){if(null===t||"object"!=typeof t)return!1;if(Array.isArray(t))return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}function la(t){const{background:e,hasBackgroundGraphics:n=!1,themeBackground:r=""}=t;return"transparent"===e||n?null:e||(r&&"transparent"!==r?r:"")||null}function ca(t,e){const{background:n,hasBackgroundGraphics:r=!1,themeBackground:o="",x:i=0,y:a=0,width:s,height:l}=e,c=la({background:n,hasBackgroundGraphics:r,themeBackground:o});if(!c)return!1;const u=nt(t,c);return!!u&&(t.fillStyle=u,t.fillRect(i,a,s,l),!0)}function ua(t){return!!(t.dirtyOrRebuilt||t.transitioning||t.animationTicked||t.continuous||t.liveEncoding||t.forced)}var ha={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 da(t,e){const n=t.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const t=n[1],r=n[2],o=n[3];return`#${t}${t}${r}${r}${o}${o}${e}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${e}`;const r=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return r?`rgba(${r[1]}, ${(parseInt(e,16)/255).toFixed(3)})`:n}import*as fa from"react";import*as ya from"react";import{jsx as pa}from"react/jsx-runtime";var ga=ya.createContext(null);function ma(){return ya.useContext(ga)}import{jsx as xa}from"react/jsx-runtime";var ba={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function va({hoverPoint:t}){let e="";if(t){const n=t.data||t;e="object"==typeof n?"Data point: "+Object.entries(n).filter(([,t])=>"object"!=typeof t&&"function"!=typeof t).map(([t,e])=>`${t}: ${e}`).join(", "):"Data point: "+n}return xa("div",{"aria-live":"polite","aria-atomic":"true",style:ba,children:e})}import{jsx as ka,jsxs as wa}from"react/jsx-runtime";function Aa(t,e){if(!t||0===t.length)return e+", empty";const n={};for(const e of t){if(null===e?.datum)continue;const t=e.type+"";n[t]=(n[t]||0)+1}if(0===Object.keys(n).length)return e+", empty";const r=[],o={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((t,e)=>{const n=i.indexOf(t),r=i.indexOf(e);return(-1===n?999:n)-(-1===r?999:r)});for(const t of a)r.push(`${n[t]} ${o[t]||t}`);return`${e}, ${r.join(", ")}`}function Ma(t,e,n){const r=[];return t>0&&r.push(t+" nodes"),e>0&&r.push(e+" edges"),0===r.length?n+", empty":`${n}, ${r.join(", ")}`}var Sa=t=>{if(null==t)return"";const e=Math.round(100*t)/100;return Number.isNaN(e)?"":e+""},$a="semiotic-accessible-data-table",Pa=$a+" semiotic-accessible-data-table-hidden",Ca=$a+" semiotic-accessible-data-table-visible",La=Ca+" semiotic-accessible-data-table-network",_a={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Ta={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Da={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Ra={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Wa={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},Ea={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Na={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Ia={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function Oa({scene:t,chartType:e,tableId:n,chartTitle:r}){const[o,i]=fa.useState(!1),[a,s]=fa.useState(5),c=ma(),u=c?.visible??!1,h=o||u,d=fa.useRef(null),f=r?"Data summary for "+r:n?`Data summary for ${e} ${n}`:"Data summary for "+e;fa.useEffect(()=>{h||s(5)},[h]);const y=fa.useCallback(t=>{t.target===t.currentTarget&&(o||u||i(!0))},[o,u]),p=fa.useCallback(t=>{u||d.current?.contains(t.relatedTarget)||i(!1)},[u]);if(!t||0===t.length)return n?ka("span",{id:n,tabIndex:-1,style:ba}):null;if(!h)return ka("div",{id:n,className:Pa,tabIndex:-1,onFocus:y,style:ba,role:"region","aria-label":f,children:wa("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",t.length," elements)"]})});const g=l(t),m=function(t){if(!t||0===t.length)return[];const e=new Set;for(const n of t)if(n&&n.values)for(const t of Object.keys(n.values))e.add(t);const n=[];for(const r of e){const e=[],o=new Set;for(const n of t){if(!n||!n.values)continue;const t=n.values[r];null!=t&&""!==t&&("number"==typeof t&&!Number.isNaN(t)&&Number.isFinite(t)?e.push(t):"number"==typeof t||"object"!=typeof t&&"function"!=typeof t&&o.add(t+""))}if(e.length>0){let t=e[0],o=e[0],i=0;for(const n of e)t>n&&(t=n),n>o&&(o=n),i+=n;n.push({name:r,count:e.length,numeric:!0,min:t,max:o,mean:i/e.length})}else if(o.size>0){const t=Array.from(o);n.push({name:r,count:t.length,numeric:!1,uniqueValues:t.slice(0,5)})}}return n}(g),x=function(t,e){const n=[t+" data points."];for(const t of e)if(t.numeric)n.push(`${t.name}: ${Sa(t.min)} to ${Sa(t.max)}, mean ${Sa(t.mean)}.`);else{const e=t.uniqueValues,r=e.length>3?`${e.slice(0,3).join(", ")}… (${t.count} unique)`:e.join(", ");n.push(`${t.name}: ${r}.`)}return n.join(" ")}(g.length,m),b=Math.min(a,g.length),v=g.slice(0,b),k=g.length-b,w=new Set;for(const t of v)for(const e of Object.keys(t.values))w.add(e);const A=Array.from(w);return wa("div",{ref:d,id:n,className:Ca,tabIndex:-1,onBlur:p,style:_a,role:"region","aria-label":f,children:[ka("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Da,children:"×"}),ka("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ta,children:x}),wa("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+e,style:Ra,children:[ka("caption",{className:"semiotic-accessible-data-table-caption",style:Na,children:k>0?`First ${b} of ${g.length} data points`:`All ${g.length} data points`}),ka("thead",{children:wa("tr",{children:[ka("th",{style:Wa,children:"type"}),A.map(t=>ka("th",{style:Wa,children:t},t))]})}),ka("tbody",{children:v.map((t,e)=>wa("tr",{children:[ka("td",{style:Ea,children:t.label}),A.map(e=>{return ka("td",{style:Ea,children:(n=t.values[e],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Sa(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},e);var n})]},e))})]}),k>0&&wa("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(t=>t+25),style:Ia,children:["Show ",Math.min(25,k)," more"," ",1===k?"row":"rows"," (",k," remaining)"]})]})}function Fa({nodes:t,edges:e,chartType:n,tableId:r,chartTitle:o}){const[i,a]=fa.useState(!1),[s,l]=fa.useState(5),c=ma(),u=c?.visible??!1,h=i||u,d=o?"Data summary for "+o:r?`Data summary for ${n} ${r}`:"Data summary for "+n,f=fa.useRef(null);fa.useEffect(()=>{h||l(5)},[h]);const y=fa.useCallback(t=>{t.target===t.currentTarget&&(i||u||a(!0))},[i,u]),p=fa.useCallback(t=>{u||f.current?.contains(t.relatedTarget)||a(!1)},[u]);if(!t||0===t.length)return r?ka("span",{id:r,tabIndex:-1,style:ba}):null;if(!h)return ka("div",{id:r,className:Pa,tabIndex:-1,onFocus:y,style:ba,role:"region","aria-label":d,children:wa("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",t.length," nodes, ",e.length," edges)"]})});const g=Array.isArray(t)?t:[],m=Array.isArray(e)?e:[],x=new Map,b=new Map,v=new Map,k=new Map;for(const t of m){if(!t||"object"!=typeof t)continue;const e=t.datum??{source:t.source,target:t.target},n="object"==typeof e.source?e.source?.id:e.source,r="object"==typeof e.target?e.target?.id:e.target,o="number"==typeof e.value&&Number.isFinite(e.value)?e.value:0;if(null!=n&&""!==n){const t=n+"";b.set(t,(b.get(t)??0)+1),k.set(t,(k.get(t)??0)+o)}if(null!=r&&""!==r){const t=r+"";x.set(t,(x.get(t)??0)+1),v.set(t,(v.get(t)??0)+o)}}const w=[];for(let t=0;g.length>t;t++){const e=g[t];if(!e||"object"!=typeof e)continue;const n=e.datum?.id??e.id,r=null!=n?n+"":"node-"+t,o=x.get(r)??0,i=b.get(r)??0,a=v.get(r)??0,s=k.get(r)??0;w.push({id:r,degree:o+i,inDeg:o,outDeg:i,wDegree:a+s,wInDeg:a,wOutDeg:s})}w.sort((t,e)=>e.degree-t.degree);let A=0,M=0;if(w.length>0){let t=0;for(const e of w)t+=e.degree,e.degree>M&&(M=e.degree);A=t/w.length}const S=m.some(t=>{const e=t?.datum??{source:t?.source,target:t?.target};return"number"==typeof e?.value&&Number.isFinite(e.value)}),$=[`${w.length} nodes, ${m.length} edges.`];w.length>0&&$.push(`Mean degree: ${Sa(A)}, max degree: ${M}.`);const P=Math.min(s,w.length),C=w.slice(0,P),L=w.length-P;return wa("div",{ref:f,id:r,className:La,tabIndex:-1,onBlur:p,style:_a,role:"region","aria-label":d,children:[ka("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:Da,children:"×"}),ka("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ta,children:$.join(" ")}),wa("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:Ra,children:[ka("caption",{className:"semiotic-accessible-data-table-caption",style:Na,children:L>0?`Top ${P} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),ka("thead",{children:wa("tr",{children:[ka("th",{style:Wa,children:"id"}),ka("th",{style:Wa,children:"degree"}),ka("th",{style:Wa,children:"in"}),ka("th",{style:Wa,children:"out"}),S&&ka("th",{style:Wa,children:"w. degree"}),S&&ka("th",{style:Wa,children:"w. in"}),S&&ka("th",{style:Wa,children:"w. out"})]})}),ka("tbody",{children:C.map((t,e)=>wa("tr",{children:[ka("td",{style:Ea,children:t.id}),ka("td",{style:Ea,children:t.degree}),ka("td",{style:Ea,children:t.inDeg}),ka("td",{style:Ea,children:t.outDeg}),S&&ka("td",{style:Ea,children:Sa(t.wDegree)}),S&&ka("td",{style:Ea,children:Sa(t.wInDeg)}),S&&ka("td",{style:Ea,children:Sa(t.wOutDeg)})]},e))})]}),L>0&&wa("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>l(t=>t+25),style:Ia,children:["Show ",Math.min(25,L)," more"," ",1===L?"node":"nodes"," (",L," remaining)"]})]})}function za({summary:t}){return t?ka("div",{role:"note",style:ba,children:t}):null}function Ya({tableId:t}){return ka("a",{href:"#"+t,style:ba,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:t=>{Object.assign(t.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:t=>{const e=t.currentTarget;e.removeAttribute("style"),Object.assign(e.style,ba)},children:"Skip to data table"})}import{jsx as Ba}from"react/jsx-runtime";var ja="var(--semiotic-focus, #005fcc)";function Ga({active:t,hoverPoint:e,margin:n,size:r,shape:o="circle",width:i,height:a,pathData:s}){if(!t||!e)return null;const l=e.x+n.left,c=e.y+n.top;let u;if("geoarea"!==o&&"path"!==o||!s)if("rect"===o&&null!=i&&null!=a){const t=Math.max(i,4),e=Math.max(a,4);u=Ba("rect",{x:l-t/2-3,y:c-e/2-3,width:t+6,height:e+6,rx:3,fill:"none",stroke:ja,strokeWidth:2,strokeDasharray:"4,2"})}else u=Ba("circle","wedge"===o?{cx:l,cy:c,r:12,fill:"none",stroke:ja,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:ja,strokeWidth:2,strokeDasharray:"4,2"});else u=Ba("g",{transform:`translate(${n.left},${n.top})`,children:Ba("path",{d:s,fill:"none",stroke:ja,strokeWidth:2.5,strokeDasharray:"6,3"})});return Ba("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}import*as Xa from"react";import{jsx as Ha}from"react/jsx-runtime";function Va({x:t,y:e,containerWidth:n,containerHeight:r,margin:o,children:i,className:a="stream-frame-tooltip",zIndex:l=1}){const c=Number.isFinite(t)&&Number.isFinite(e),u=Xa.useRef(null),[h,d]=Xa.useState(null);Xa.useLayoutEffect(()=>{const t=u.current;if(!t)return;const e=()=>{const e=t.getBoundingClientRect();Number.isFinite(e.width)&&Number.isFinite(e.height)&&d(t=>t&&.5>Math.abs(t.width-e.width)&&.5>Math.abs(t.height-e.height)?t:{width:e.width,height:e.height})};if(e(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(e);return n.observe(t),()=>n.disconnect()},[a,n,r,c]);let f;f=h?`translate(${h.width+12>n-t?"calc(-100% - 12px)":"12px"}, ${h.height+12>r-e?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*r>e?"4px":"calc(-100% - 4px)"})`;const y=function(t){if(!Xa.isValidElement(t))return!1;const e=t.type;if("string"!=typeof e&&e&&!0===e.ownsChrome)return!0;const n=t.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(i),p=y?null:s;return c?Ha("div",{ref:u,className:y?a:(a+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:o.left+t,top:o.top+e,transform:f,pointerEvents:"none",zIndex:l,width:"max-content"},children:i}):null}import*as qa from"react";import{useCallback as Ua,useEffect as Za,useLayoutEffect as Ka,useMemo as Ja,useRef as Qa}from"react";import{useRef as ts,useState as es,useEffect as ns}from"react";var rs="undefined"==typeof window?Za:Ka,os={requestAnimationFrame:t=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(t),cancelAnimationFrame:t=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(t)};function is(t,e,n){return"function"==typeof t?t({size:e,margin:n}):t}function as(e){const n=t(),r=Qa(n);r.current=n;const[o,i]=function(t,e,n){const r=ts(null),[o,i]=es(null);return ns(()=>{if(!e&&!n)return;const t=r.current;if(!t)return;const o=new ResizeObserver(t=>{for(const e of t){const{width:t,height:n}=e.contentRect;i(e=>e&&e.w===t&&e.h===n?e:{w:t,h:n})}});return o.observe(t),()=>o.disconnect()},[e,n]),[r,[e&&o?o.w:t[0],n&&o?o.h:t[1]]]}(e.sizeProp,e.responsiveWidth,e.responsiveHeight),a=!!e.title,s=!!e.legend&&"top"===e.legendPosition,l=Ja(()=>Ko({...e.marginDefault,...e.userMargin},a,s),[e.marginDefault,e.userMargin,a,s]),c=i[0]-l.left-l.right,u=i[1]-l.top-l.bottom,h=is(e.foregroundGraphics,i,l),d=is(e.backgroundGraphics,i,l),f=it(t=>t.theme),{transition:y,introEnabled:p}=function(t,e){if(!1===t)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:t?!0===t?{duration:300}:{duration:t.duration??300,easing:"linear"===t.easing?"linear":"ease-out"}:e,introEnabled:!(n||!t||!0!==t&&!1===t.intro)}}(e.animate,e.transitionProp),g="semiotic-table-"+qa.useId(),m=Qa(null);if(!m.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;m.current=new A({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const x=m.current;x.configure({clock:e.clock,random:e.random,seed:e.seed});const b=Qa(null),v=Qa(e.frameScheduler??os);v.current=e.frameScheduler??os;const k=Qa(null),w=Qa(!1),M=Qa(()=>{}),S=Ua(()=>{if(null!==b.current||w.current)return;const t=v.current;let e=!1,n=!1;const r=t.requestAnimationFrame(()=>{e=!0;const t=!n;t&&(w.current=!0),b.current=null,k.current=null;try{M.current()}finally{t&&(w.current=!1)}});n=!0,e||(b.current=r,k.current=t)},[]),$=Ua(()=>{null!==b.current&&((k.current??v.current).cancelAnimationFrame(b.current),b.current=null,k.current=null)},[]);rs(()=>{x.setPaused(!0===e.paused)},[x,e.paused]),Za(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void x.setVisible(!0);const t=()=>x.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[x,e.suspendWhenHidden]),Za(()=>()=>{$()},[$]);const P=Qa(()=>{}),C=Qa(()=>{}),L=Qa(null),_=Qa(null),T=Qa(null),D=Ua(()=>{const t=L.current;L.current=null,t&&P.current(t)},[]),R=Ua(t=>{if(L.current={clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType},null===_.current){const t=v.current;let e=!1;const n=t.requestAnimationFrame(()=>{e=!0,_.current=null,T.current=null,D()});e||(_.current=n,T.current=t)}},[D]),W=Ua(()=>{L.current=null,null!==_.current&&((T.current??v.current).cancelAnimationFrame(_.current),_.current=null,T.current=null),C.current()},[]);Za(()=>()=>{L.current=null,null!==_.current&&((T.current??v.current).cancelAnimationFrame(_.current),_.current=null,T.current=null)},[]);const E=e.themeDirtyRef;return rs(()=>{E&&(tt(),E.current=!0,S())},[f,S,E]),{reducedMotion:n,reducedMotionRef:r,responsiveRef:o,size:i,margin:l,adjustedWidth:c,adjustedHeight:u,resolvedForeground:h,resolvedBackground:d,currentTheme:f,transition:y,introEnabled:p,tableId:g,frameRuntime:x,rafRef:b,renderFnRef:M,scheduleRender:S,cancelRender:$,hoverHandlerRef:P,hoverLeaveRef:C,onPointerMove:R,onPointerLeave:W}}import{useEffect as ss,useRef as ls}from"react";import{jsx as cs}from"react/jsx-runtime";function us(t,e){return function(t){const{cancelRender:e,dirtyRef:n,frameRuntime:r,manageFrameRuntime:o,scheduleRender:i}=t,a=ls(null),s=ls(null),l=ls(!1);return function(t){const{hydrated:e,wasHydratingFromSSR:n,storeRef:r,dirtyRef:o,renderFnRef:i,cancelRender:a,cleanup:s}=t;Ki(()=>{const t=r.current;e&&n&&t?.cancelIntroAnimation?.(),!n&&t?.sceneNodes&&t.sceneNodes.length>0&&t?.markStylePaintPending?t.markStylePaintPending():o.current=!0,a?.(),i.current()},[e,n]);const l=qi(s);l.current=s,Hi(()=>()=>l.current?.(),[])}({hydrated:t.hydrated,wasHydratingFromSSR:t.wasHydratingFromSSR,storeRef:t.storeRef,dirtyRef:t.dirtyRef,renderFnRef:t.renderFnRef,cancelRender:t.cancelRender,cleanup:t.cleanup}),ss(()=>{if(!1!==o)return r.subscribe(()=>{r.isActive?(n.current=!0,i()):e()})},[e,n,r,o,i]),ss(()=>{!l.current&&(l.current=!0,t.skipInitialCanvasPaintInvalidation)||(t.dirtyRef.current=!0,t.scheduleRender())},t.canvasPaintDependencies),{canvasRef:a,interactionCanvasRef:s}}({...e,renderFnRef:t.renderFnRef,scheduleRender:t.scheduleRender,cancelRender:t.cancelRender,frameRuntime:t.frameRuntime})}function hs({children:t,size:e,margin:n,overflowVisible:r=!1}){return t?cs("svg",{style:{position:"absolute",left:0,top:0,width:e[0],height:e[1],pointerEvents:"none",overflow:r?"visible":void 0},children:cs("g",{transform:`translate(${n.left},${n.top})`,children:t})}):null}function ds(t,e,n,r){return"function"==typeof t?t({size:e,margin:n,scales:r}):t}function fs(t,e,n,r){const o=t.getContext("2d");if(!o)return null;const i=Math.round(e[0]*r),a=Math.round(e[1]*r),s=i/e[0],l=a/e[1],c=e[0]+"px",u=e[1]+"px";return t.style.width!==c&&(t.style.width=c),t.style.height!==u&&(t.style.height=u),t.width===i&&t.height===a||(t.width=i,t.height=a),o.setTransform(s,0,0,l,0,0),o.translate(n.left,n.top),o}function ys(){if("undefined"==typeof window)return 1;const t=window.devicePixelRatio||1,e=function(){if("undefined"==typeof window)return!1;const t="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,e=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return t||e}()?2:3;return Math.max(1,Math.min(t,e))}import{useCallback as ps,useRef as gs}from"react";function ms(t,e,n,r){return"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:r,fn:e}:{key:void 0,fn:null}}var xs=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],bs=3156e7;function vs(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")}`}:bs>e?t=>{const e=new Date(t);return`${xs[e.getUTCMonth()]} ${e.getUTCDate()}`}:5*bs>e?t=>{const e=new Date(t);return`${xs[e.getUTCMonth()]} ${e.getUTCFullYear()}`}:t=>new Date(t).getUTCFullYear()+""}function ks(t){if(!t)return;const e=[];for(const n of t)if("point"===n.type)e.push(n);else if("symbol"===n.type)e.push({pointId:n.pointId,x:n.x,y:n.y,r:j(n.size)});else if("glyph"===n.type){const t=D(n.glyph,n.size);e.push({pointId:n.pointId,x:n.x+t.centerDx,y:n.y+t.centerDy,r:t.radius})}return e}import{line as ws}from"d3-shape";function As(t,e,n,r,o,i){if(2>e.length)return;const a=[0];for(let t=1;e.length>t;t++){const n=e[t][0]-e[t-1][0],r=e[t][1]-e[t-1][1];a.push(a[t-1]+Math.sqrt(n*n+r*r))}const s=a[a.length-1];if(0===s)return;const l=Math.min(.2*s,40);t.strokeStyle=n,t.lineWidth=r,t.lineCap=i;for(let n=0;e.length-1>n;n++){const r=(a[n]+a[n+1])/2;let i=o;l>r&&(i*=r/l),l>s-r&&(i*=(s-r)/l),t.globalAlpha=Math.max(0,i),t.beginPath(),t.moveTo(e[n][0],e[n][1]),t.lineTo(e[n+1][0],e[n+1][1]),t.stroke()}}var Ms=(t,e,n,r)=>{const o=e.filter(t=>"line"===t.type);for(const e of o){if(2>e.path.length)continue;const n=e._introClipFraction;void 0!==n&&1>n&&(t.save(),t.beginPath(),t.rect(0,0,r.width*n,r.height),t.clip());const o=e.style.stroke||"#007bff",i=nt(t,o)||o,a=e.style.strokeWidth||2,s=e.colorThresholds,l=e.rawValues;if(t.setLineDash(e.style.strokeDasharray?e.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=e.style.opacity&&(t.globalAlpha=e.style.opacity),t.lineWidth=a,t.lineCap=e.style.strokeLinecap||"butt",e.style._edgeFade){As(t,e.path,i,a,e.style.opacity??1,e.style.strokeLinecap||"butt"),t.globalAlpha=1,t.setLineDash([]),t.lineCap="butt";continue}const c=On(e.curve),u=s&&s.length>0&&l&&l.length===e.path.length,h=e._decayOpacities;if(h&&h.length===e.path.length&&!u){t.strokeStyle=i;const n=e.style.opacity??1;for(let r=0;e.path.length-1>r;r++)t.globalAlpha=.5*(h[r]+h[r+1])*n,t.beginPath(),t.moveTo(e.path[r][0],e.path[r][1]),t.lineTo(e.path[r+1][0],e.path[r+1][1]),t.stroke()}else if(u){const n=ui(e.path,l,s,i);for(const e of n){t.beginPath(),t.strokeStyle=nt(t,e.color)||e.color,t.moveTo(e.path[0][0],e.path[0][1]);for(let n=1;e.path.length>n;n++)t.lineTo(e.path[n][0],e.path[n][1]);t.stroke()}}else{t.beginPath();const n=e.strokeGradient&&e.path.length>=2?Bn(t,e.strokeGradient,i,e.path[0][0],0,e.path[e.path.length-1][0],0):null;if(t.strokeStyle=n||i,c)ws().x(t=>t[0]).y(t=>t[1]).curve(c).context(t)(e.path);else{const[n,r]=e.path[0];t.moveTo(n,r);for(let n=1;e.path.length>n;n++)t.lineTo(e.path[n][0],e.path[n][1])}t.stroke()}if(e.style.fill&&e.style.fillOpacity&&e.style.fillOpacity>0){if(t.beginPath(),t.globalAlpha=e.style.fillOpacity,t.fillStyle=Fn(t,e.style.fill,e.style.fill),c&&!u)ws().x(t=>t[0]).y(t=>t[1]).curve(c).context(t)(e.path);else{const[n,r]=e.path[0];t.moveTo(n,r);for(let n=1;e.path.length>n;n++)t.lineTo(e.path[n][0],e.path[n][1])}const n=e.path[0][0];t.lineTo(e.path[e.path.length-1][0],r.height),t.lineTo(n,r.height),t.closePath(),t.fill()}void 0!==n&&1>n&&t.restore(),t.globalAlpha=1,t.setLineDash([]),t.lineCap="butt"}};function Ss(t){return!(!t._pulseIntensity||0>=t._pulseIntensity)}function $s(t,e,n=.3){Ss(e)&&(t.globalAlpha=e._pulseIntensity*n,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.fillRect(e.x,e.y,e.w,e.h))}function Ps(t,e,n=.6){if(!Ss(e))return;const r=e.r+(e._pulseGlowRadius??4)*e._pulseIntensity,o=e.cx??e.x??0,i=e.cy??e.y??0;t.beginPath(),t.arc(o,i,r,0,2*Math.PI),t.strokeStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.lineWidth=2*e._pulseIntensity,t.globalAlpha=e._pulseIntensity*n,t.stroke()}function Cs(t,e,n,r=.35){Ss(e)&&(t.globalAlpha=e._pulseIntensity*r,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",n?t.fill(n):t.fill())}import{area as Ls,line as _s}from"d3-shape";function Ts(t,e){const n=On(e.curve);if(!n||2>e.topPath.length||2>e.bottomPath.length){t.beginPath(),t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let n=1;e.topPath.length>n;n++)t.lineTo(e.topPath[n][0],e.topPath[n][1]);for(let n=e.bottomPath.length-1;n>=0;n--)t.lineTo(e.bottomPath[n][0],e.bottomPath[n][1]);t.closePath()}else{const r=Ls().x(t=>t[0]).y0((t,n)=>e.bottomPath[n][1]).y1(t=>t[1]).curve(n).context(t);t.beginPath(),r(e.topPath)}}function Ds(t,e){const n=On(e.curve);if(t.beginPath(),n)_s().x(t=>t[0]).y(t=>t[1]).curve(n).context(t)(e.topPath);else{t.moveTo(e.topPath[0][0],e.topPath[0][1]);for(let n=1;e.topPath.length>n;n++)t.lineTo(e.topPath[n][0],e.topPath[n][1])}}var Rs=(t,e,n,r)=>{const o=e.filter(t=>"area"===t.type);for(const e of o){if(2>e.topPath.length)continue;let n=!1;e.clipRect&&(t.save(),t.beginPath(),t.rect(e.clipRect.x,e.clipRect.y,e.clipRect.width,e.clipRect.height),t.clip(),n=!0);const o=e._introClipFraction;void 0!==o&&1>o&&(t.save(),t.beginPath(),t.rect(0,0,r.width*o,r.height),t.clip());const i=Fn(t,e.style.fill,"#4e79a7"),a=e._decayOpacities,s=!(!e.colorThresholds?.length||!e.rawValues||e.rawValues.length!==e.topPath.length),l=!!e.strokeColorBands?.length;if(a&&a.length===e.topPath.length&&!s&&!l){const n=e.style.fillOpacity??.7;t.fillStyle=i;for(let r=0;e.topPath.length-1>r;r++)t.globalAlpha=.5*(a[r]+a[r+1])*n,t.beginPath(),t.moveTo(e.topPath[r][0],e.topPath[r][1]),t.lineTo(e.topPath[r+1][0],e.topPath[r+1][1]),t.lineTo(e.bottomPath[r+1][0],e.bottomPath[r+1][1]),t.lineTo(e.bottomPath[r][0],e.bottomPath[r][1]),t.closePath(),t.fill();if(e.style.stroke&&"none"!==e.style.stroke){t.strokeStyle=nt(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]);for(let n=0;e.topPath.length-1>n;n++)t.globalAlpha=.5*(a[n]+a[n+1]),t.beginPath(),t.moveTo(e.topPath[n][0],e.topPath[n][1]),t.lineTo(e.topPath[n+1][0],e.topPath[n+1][1]),t.stroke()}t.globalAlpha=1;continue}const c=e.style.opacity??1;if(Ts(t,e),e.fillGradient&&e.fillGradient.stops.length>=2&&e.fillGradient){let n=1/0;for(const t of e.topPath)n>t[1]&&(n=t[1]);let r=-1/0;for(const t of e.bottomPath)t[1]>r&&(r=t[1]);const o=zn(t,e.fillGradient,"string"==typeof i?i:"#4e79a7",0,n,0,r);t.fillStyle=o||i,t.globalAlpha=c}else t.globalAlpha=(e.style.fillOpacity??.7)*c,t.fillStyle=i;if(t.fill(),e._pulseIntensity&&e._pulseIntensity>0&&(Ts(t,e),Cs(t,e)),e.style.stroke&&"none"!==e.style.stroke){t.globalAlpha=c;const n=nt(t,e.style.stroke)||e.style.stroke,r=s||l||!e.strokeGradient||2>e.topPath.length?null:Bn(t,e.strokeGradient,n,e.topPath[0][0],0,e.topPath[e.topPath.length-1][0],0);if(t.lineWidth=e.style.strokeWidth||2,t.setLineDash([]),l){let r=1/0,o=-1/0;for(const[t]of e.topPath)r=Math.min(r,t),o=Math.max(o,t);const i=t.lineWidth;for(const a of e.strokeColorBands){t.save(),t.beginPath(),t.rect(r-i,a.y,o-r+2*i,a.height),t.clip();const s=a.color??n;t.strokeStyle=nt(t,s)||s,Ds(t,e),t.stroke(),t.restore()}}else if(s){const r=ui(e.topPath,e.rawValues,e.colorThresholds,n);for(const e of r){t.beginPath(),t.strokeStyle=nt(t,e.color)||e.color,t.moveTo(e.path[0][0],e.path[0][1]);for(let n=1;e.path.length>n;n++)t.lineTo(e.path[n][0],e.path[n][1]);t.stroke()}}else t.strokeStyle=r||n,Ds(t,e),t.stroke()}void 0!==o&&1>o&&t.restore(),n&&t.restore(),t.globalAlpha=1}},Ws=(t,e,n,r)=>{const o=e.filter(t=>"point"===t.type);if(0!==o.length){t.save();try{const e=t.globalAlpha;for(const n of o)t.beginPath(),t.arc(n.x,n.y,n.r,0,2*Math.PI),t.globalAlpha=e*(n.style.opacity??n.style.fillOpacity??1),t.fillStyle=Fn(t,n.style.fill,"#4e79a7"),t.fill(),n.style.stroke&&"none"!==n.style.stroke&&(t.strokeStyle=Fn(t,n.style.stroke,n.style.stroke),t.lineWidth=n.style.strokeWidth||1,t.stroke()),Ps(t,n)}finally{t.restore()}}},Es=new Map;function Ns(t){try{if(t.path)return new Path2D(t.path);const e=`${t.symbolType??"circle"}:${Math.round(t.size)}`;let n=Es.get(e);return n||(n=new Path2D(B(t.symbolType,t.size)),Es.size>256&&Es.clear(),Es.set(e,n)),n}catch{return null}}var Is=(t,e)=>{const n=t.globalAlpha;for(const r of e){if("symbol"!==r.type)continue;const e=r;if(0>=e.size)continue;const o=Ns(e);if(!o)continue;t.save(),t.translate(e.x,e.y),e.rotation&&t.rotate(e.rotation);const i=(e.style.opacity??1)*(e._decayOpacity??1);e.style.fill&&(t.globalAlpha=n*i*(e.style.fillOpacity??1),t.fillStyle=Fn(t,e.style.fill,"#4e79a7"),t.fill(o)),e.style.stroke&&"none"!==e.style.stroke&&(t.globalAlpha=n*i,t.strokeStyle=Fn(t,e.style.stroke,e.style.stroke),t.lineWidth=e.style.strokeWidth??1,t.stroke(o)),t.restore()}t.globalAlpha=n};function Os(t,e,n,r,o){if(0>=e.size)return;const i=e.glyph;if(!i||!i.parts?.length)return;const a=R(i,e.size);if(0>=a.scale)return;const s=(e.style.opacity??1)*(e._decayOpacity??1);if(0>=s)return;const l=e=>{const n=Fn(t,e,e);return"string"==typeof n?n:e},c=e.color??("string"==typeof e.style.fill?e.style.fill:void 0);t.save(),t.translate(n,r),e.rotation&&t.rotate(e.rotation),t.translate(a.offsetX,a.offsetY),t.scale(a.scale,a.scale),t.globalAlpha=o*s*(e.style.fillOpacity??1);const u=T(i,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal");u&&e.ghostColor&&C(t,i,c,e.accent,e.ghostColor,l),u&&(t.beginPath(),t.rect(u.x,u.y,u.width,u.height),t.clip()),C(t,i,c,e.accent,void 0,l),t.restore()}function Fs(t,e){const n=t.globalAlpha;for(const r of e)"glyph"===r.type&&Os(t,r,r.cx,r.cy,n);t.globalAlpha=n}function zs(t,e){const{x:n,y:r,w:o,h:i}=e,{tl:a,tr:s,br:l,bl:c}=di(e);t.beginPath(),t.moveTo(n+a,r),t.lineTo(n+o-s,r),s>0&&t.arcTo(n+o,r,n+o,r+s,s),t.lineTo(n+o,r+i-l),l>0&&t.arcTo(n+o,r+i,n+o-l,r+i,l),t.lineTo(n+c,r+i),c>0&&t.arcTo(n,r+i,n,r+i-c,c),t.lineTo(n,r+a),a>0&&t.arcTo(n,r,n+a,r,a),t.closePath()}function Ys(t){switch(t.roundedEdge){case"bottom":return{x0:t.x,y0:t.y+t.h,x1:t.x,y1:t.y};case"right":return{x0:t.x+t.w,y0:t.y,x1:t.x,y1:t.y};case"left":return{x0:t.x,y0:t.y,x1:t.x+t.w,y1:t.y};default:return{x0:t.x,y0:t.y,x1:t.x,y1:t.y+t.h}}}var Bs=(t,e,n,r)=>{const o=e.filter(t=>"rect"===t.type);for(const e of o){if(null!=e.style.opacity&&(t.globalAlpha=e.style.opacity),e.style.icon)js(t,e);else if(e.cornerRadii&&hi(e.cornerRadii)){const n=Fn(t,e.style.fill,nt(t,"var(--semiotic-primary, #007bff)")),r=Ys(e),o=e.fillGradient&&"string"==typeof n?zn(t,e.fillGradient,n,r.x0,r.y0,r.x1,r.y1):null;t.fillStyle=o||n,zs(t,e),t.fill(),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=nt(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||1,t.stroke())}else if(e.roundedTop&&e.roundedTop>0){const n=Fn(t,e.style.fill,nt(t,"var(--semiotic-primary, #007bff)")),r=Ys(e),o=e.fillGradient&&"string"==typeof n?zn(t,e.fillGradient,n,r.x0,r.y0,r.x1,r.y1):null;t.fillStyle=o||n;const i=Math.min(e.roundedTop,e.w/2,e.h/2);t.beginPath();const{x:a,y:s,w:l,h:c}=e;switch(e.roundedEdge){case"right":t.moveTo(a,s),t.lineTo(a+l-i,s),t.arcTo(a+l,s,a+l,s+i,i),t.lineTo(a+l,s+c-i),t.arcTo(a+l,s+c,a+l-i,s+c,i),t.lineTo(a,s+c);break;case"left":t.moveTo(a+l,s),t.lineTo(a+i,s),t.arcTo(a,s,a,s+i,i),t.lineTo(a,s+c-i),t.arcTo(a,s+c,a+i,s+c,i),t.lineTo(a+l,s+c);break;case"bottom":t.moveTo(a,s),t.lineTo(a+l,s),t.lineTo(a+l,s+c-i),t.arcTo(a+l,s+c,a+l-i,s+c,i),t.lineTo(a+i,s+c),t.arcTo(a,s+c,a,s+c-i,i);break;default:t.moveTo(a,s+c),t.lineTo(a,s+i),t.arcTo(a,s,a+i,s,i),t.lineTo(a+l-i,s),t.arcTo(a+l,s,a+l,s+i,i),t.lineTo(a+l,s+c)}t.closePath(),t.fill(),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=nt(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||1,t.stroke())}else{const n=Fn(t,e.style.fill,nt(t,"var(--semiotic-primary, #007bff)")),r=Ys(e),o=e.fillGradient&&"string"==typeof n?zn(t,e.fillGradient,n,r.x0,r.y0,r.x1,r.y1):null;t.fillStyle=o||n,t.fillRect(e.x,e.y,e.w,e.h),e.style.stroke&&"none"!==e.style.stroke&&(t.strokeStyle=nt(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||1,t.strokeRect(e.x,e.y,e.w,e.h))}$s(t,e),t.globalAlpha=1}};function js(t,e){const n=e.style.icon,r=e.style.iconPadding||2,o=Math.min(e.w,e.h)-r;if(0>=o)return;const i=e.h>e.w;if(t.save(),t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip(),i){const i=o+r,a=e.x+(e.w-o)/2;for(let r=e.y+e.h-o;r>=e.y-o;r-=i)t.drawImage(n,a,r,o,o)}else{const i=o+r,a=e.y+(e.h-o)/2;for(let r=e.x;e.x+e.w>r;r+=i)t.drawImage(n,r,a,o,o)}t.restore()}function Gs(t){const[e,n,r]=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*n+.114*r>128?"#000":"#fff"}function Xs(t){return Number.isInteger(t)?t+"":100>Math.abs(t)?1>Math.abs(t)?t.toPrecision(3):t.toFixed(1):t.toFixed(0)}var Hs=(t,e,n,r)=>{const o=e.filter(t=>"heatcell"===t.type);t.save();try{for(const e of o){const n=e.style;null!=n?.opacity&&(t.globalAlpha=n.opacity),t.fillStyle=e.fill,t.fillRect(e.x,e.y,e.w,e.h);const r=Math.max(0,n?.strokeWidth??1);if(r>0&&(t.strokeStyle=nt(t,n?.stroke??"var(--semiotic-surface, #fff)"),t.lineWidth=r,t.strokeRect(e.x,e.y,e.w,e.h)),$s(t,e),t.globalAlpha=1,e.showValues&&null!=e.value){if(20>e.w||20>e.h)continue;const n=e.valueFormat?e.valueFormat(e.value):Xs(e.value),r=Math.max(10,Math.min(16,.3*Math.min(e.w,e.h))),o=e.x+e.w/2,i=e.y+e.h/2;t.fillStyle=Gs(e.fill),t.font=r+"px sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(n,o,i)}}}finally{t.restore()}},Vs=(t,e,n,r)=>{for(const n of e){if("candlestick"!==n.type)continue;const e=n;t.save();const o=(e._decayOpacity??1)*(e.style?.opacity??1);1!==o&&(t.globalAlpha=o);const i=nt(t,e.wickColor)||e.wickColor,a=60>r.height,s=a?Math.max(e.wickWidth,2):e.wickWidth,l=()=>{t.beginPath(),t.moveTo(e.x,e.highY),t.lineTo(e.x,e.lowY),t.strokeStyle=i,t.lineWidth=s,t.stroke()};if(a||l(),e.isRange){const n=e.dotRadius??Math.max(2,Math.min(e.bodyWidth/2,.12*r.height));t.fillStyle=i,t.beginPath(),t.arc(e.x,e.highY,n,0,2*Math.PI),t.fill(),t.beginPath(),t.arc(e.x,e.lowY,n,0,2*Math.PI),t.fill()}else if(e.bodyWidth>0){const n=Math.min(e.openY,e.closeY),r=Math.abs(e.openY-e.closeY),o=e.isUp?e.upColor:e.downColor,i=nt(t,o)||o;t.fillStyle=i,t.fillRect(e.x-e.bodyWidth/2,n,e.bodyWidth,Math.max(r,1)),t.strokeStyle=i,t.lineWidth=1,t.strokeRect(e.x-e.bodyWidth/2,n,e.bodyWidth,Math.max(r,1))}a&&l(),t.restore()}},qs={line:[Rs,Ms,Ws],area:[Rs,Ws],stackedarea:[Rs,Ws],scatter:[Ws,Is],bubble:[Ws,Is],heatmap:[Hs],bar:[Bs],swarm:[Ws],waterfall:[(t,e,n,r)=>{Bs(t,e);const o=e.filter(t=>"rect"===t.type);if(2>o.length)return;const i=o[0].datum,a=i?._connectorStroke;if(a){t.save(),t.strokeStyle=nt(t,a)||a,t.lineWidth=i?._connectorWidth??1,t.setLineDash([]);for(let e=0;o.length-1>e;e++){const r=o[e],i=o[e+1],a=r.datum,s=i.datum;if(null==a?.cumEnd||null==s?.baseline)continue;const l=n.y(a.cumEnd),c=r.x+r.w,u=i.x;t.beginPath(),t.moveTo(c,l),t.lineTo(u,l),t.stroke()}t.restore()}}],candlestick:[Vs],mixed:[Rs,Ms,Ws],custom:[Rs,Bs,Hs,Ms,Ws,Is,(t,e)=>{const n=t.globalAlpha;for(const r of e)"glyph"===r.type&&Os(t,r,r.x,r.y,n);t.globalAlpha=n},Vs]},Us=new Set;function Zs(t,e){const n="function"==typeof t?t(e.datum??null,e):t;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function Ks(t,e){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${t}:${e}`;Us.has(n)||(Us.add(n),console.warn(`[Semiotic] Render backend "${t}" does not support scene node "${e}"; using the built-in renderer.`))}function Js(t){const{context:e,nodes:n,renderMode:r,pixelRatio:o,paintBuiltIn:i}=t;if(!r||"sketchy"===r)return void i(n);let a=[];const s=()=>{a.length&&(i(a),a=[])};for(const t of n){const n=Zs(r,t);if(!n){a.push(t);continue}let l;s(),e.save();try{l=n.drawCanvas({context:e,node:t,style:t.style??{},pixelRatio:o})}finally{e.restore()}l||(Ks(n.id,t.type??"unknown"),i([t]))}s()}function Qs(t){const{node:e,index:n,renderMode:r,fallback:o}=t,i=Zs(r,e);if(!i)return o();const a=i.renderStaticSVG({node:e,style:e.style??{},key:`${i.id}-${n}`});return null!=a?a:(Ks(i.id,e.type??"unknown"),o())}function tl(t){const e=[];return t.nodes.forEach((n,r)=>{const o=Qs({node:n,index:r,renderMode:t.renderMode,fallback:()=>t.fallback(n,r)});null!=o&&!1!==o&&e.push({node:n,element:o})}),e}import{jsx as el,jsxs as nl}from"react/jsx-runtime";function rl(t){return null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+""}import{jsx as ol,jsxs as il}from"react/jsx-runtime";function al(t){return null==t?"":"number"==typeof t?Number.isInteger(t)?t+"":t.toFixed(2):t instanceof Date?t.toLocaleString():t+""}function sl({hover:t}){const e=t.data??{},n=e.y??e.value,r=e.x??e.time;if(void 0===n&&void 0===r){const t=v(e);if(null!=t.title||t.entries.length>0)return il("div",{className:"semiotic-tooltip",style:s,children:[null!=t.title&&ol("div",{style:{fontWeight:600,marginBottom:t.entries.length?2:0},children:t.title+""}),t.entries.map(t=>il("div",{style:{opacity:.7,fontSize:11},children:[t.key,":"," ",ol("span",{style:{fontWeight:600},children:al(t.value)})]},t.key))]})}return il("div",{className:"semiotic-tooltip",style:s,children:[ol("div",{style:{fontWeight:600,marginBottom:2},children:al(n)}),ol("div",{style:{opacity:.7,fontSize:11},children:al(r)})]})}function ll(t){return"touch"===t?"touch":"pointer"}function cl(t){const e=t.target;return e instanceof Element&&e!==t.currentTarget&&null!=e.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function ul(t){const{onObservation:e,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:s,timestamp:l=Date.now()}=t;e&&(n?(e({type:"hover",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:a}),"focus"===s?.type&&e({type:"focus",datum:n,inputType:"touch"===s.inputType?"pointer":s.inputType,timestamp:l,chartType:i,chartId:a})):e({type:"hover-end",timestamp:l,chartType:i,chartId:a}))}function hl(t){const{onObservation:e,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:s,timestamp:l=Date.now()}=t;e&&(n?(e({type:"click",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:a}),"activate"===s?.type&&e({type:"activate",datum:n,inputType:s.inputType,timestamp:l,chartType:i,chartId:a})):e({type:"click-end",timestamp:l,chartType:i,chartId:a}))}sl.ownsChrome=!0;import{useCallback as dl}from"react";import{useCallback as fl,useRef as yl}from"react";function pl(t){const e=new Map;for(const n of t){const t=n.group??"_default";let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}for(const t of e.values()){t.sort((t,e)=>t.x-e.x||t.y-e.y);for(let e=0;t.length>e;e++)t[e]._groupIndex=e}const n=Array.from(e.keys()).sort((t,n)=>{const r=e.get(t),o=e.get(n);return(r.length>0?r[0].y:0)-(o.length>0?o[0].y:0)}),r=Array.from(e.values()).flat();r.sort((t,e)=>t.x-e.x||t.y-e.y);const o=new Map;for(let t=0;r.length>t;t++){r[t]._flatIndex=t;const e=r[t].datum?.id;null!=e&&o.set(e+"",t)}return{flat:r,groups:n,byGroup:e,idToIdx:o}}function gl(t,e){if(0===t.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(e,t.flat.length-1)),r=t.flat[n];return{flatIndex:n,group:r.group??"_default",indexInGroup:r._groupIndex??0}}function ml(t,e,n){const{group:r,indexInGroup:o}=e,i=n.byGroup.get(r);switch(t){case"ArrowRight":return i.length-1>o?i[o+1]._flatIndex:e.flatIndex;case"ArrowLeft":return o>0?i[o-1]._flatIndex:e.flatIndex;case"ArrowDown":{const t=n.groups.indexOf(r);return n.groups.length-1>t?xl(n,n.groups[t+1],i[o]):e.flatIndex}case"ArrowUp":{const t=n.groups.indexOf(r);return t>0?xl(n,n.groups[t-1],i[o]):e.flatIndex}case"PageDown":return Math.min(e.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(e.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function xl(t,e,n){const r=t.byGroup.get(e);let o=0,i=Math.abs(r[0].x-n.x);for(let t=1;r.length>t;t++){const e=Math.abs(r[t].x-n.x);i>e&&(i=e,o=t)}return r[o]._flatIndex}function bl(t){const e=[];for(const n of t)switch(n.type){case"point":e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const t=D(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:"_default"});break}case"line":{const t=n,r=Array.isArray(t.datum)?t.datum:[],o=t.group??"_default";for(let n=0;t.path.length>n&&r.length>n;n++)e.push({x:t.path[n][0],y:t.path[n][1],datum:r[n],shape:"circle",group:o});break}case"area":{const t=n,r=Array.isArray(t.datum)?t.datum:[],o=t.group??"_default";for(let n=0;t.topPath.length>n&&r.length>n;n++)e.push({x:t.topPath[n][0],y:t.topPath[n][1],datum:r[n],shape:"circle",group:o});break}case"rect":e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??"_default"});break;case"heatcell":e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function vl(t){const e=[];for(const n of t)if("circle"===n.type&&null!=n.cx){if(0>=n.r)continue;e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("rect"===n.type&&null!=n.x){if(0>=n.w||0>=n.h)continue;e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.datum?.id??"_default"})}else if("arc"===n.type&&null!=n.cx)e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"});else if("symbol"===n.type&&null!=n.cx){if(0>=n.size)continue;e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("glyph"===n.type&&null!=n.cx){if(0>=n.size||null==n.datum)continue;const t=D(n.glyph,n.size);e.push({x:n.cx+t.centerDx,y:n.cy+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:n.datum?.id??"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function kl(t,e,n,r,o){const i=n.flat[e.flatIndex];if(!i)return ml(t,e,n);const a=i.datum?.id;switch(t){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const r=function(t,e,n){let r=null,o=1/0;for(let i=0;t.flat.length>i;i++){const a=t.flat[i];if(a===e)continue;const s=a.x-e.x,l=a.y-e.y;let c=!1;switch(n){case"right":c=s>0&&Math.abs(s)>=Math.abs(l);break;case"left":c=0>s&&Math.abs(s)>=Math.abs(l);break;case"down":c=l>0&&Math.abs(l)>=Math.abs(s);break;case"up":c=0>l&&Math.abs(l)>=Math.abs(s)}if(!c)continue;const u=s*s+l*l;o>u&&(o=u,r=i)}return r}(n,i,"ArrowRight"===t?"right":"ArrowLeft"===t?"left":"ArrowDown"===t?"down":"up")??e.flatIndex;return r!==e.flatIndex&&(o.current=-1),r}case"Enter":{if(null==a)return e.flatIndex;const t=function(t,e){const n=t+"",r=[];for(const t of e){const e=t.datum??t,o=wl(e.source),i=wl(e.target),a=null!=o,s=null!=i;a&&o+""===n&&s?r.push(i+""):s&&i+""===n&&a&&r.push(o+"")}return r}(a,r);if(0===t.length)return e.flatIndex;const i=n.idToIdx.get(t[(o.current+1)%t.length])??-1;return 0>i?e.flatIndex:(o.current=-1,i)}default:{const r=ml(t,e,n);return null!==r&&r!==e.flatIndex&&(o.current=-1),r}}}function wl(t){return"object"==typeof t&&null!==t&&"id"in t?t.id:t}import{jsx as Al,jsxs as Ml}from"react/jsx-runtime";var Sl={top:20,right:20,bottom:30,left:40},$l=ha;function Pl(t){if(t)return"x"===t.dimension?"pan-y":"y"===t.dimension?"pan-x":"none"}var Cl=vt(bt(function(t,e){const{chartType:n,runtimeMode:r,data:o,chunkThreshold:a,chunkSize:s,xAccessor:l,yAccessor:c,accessorRevision:h,colorAccessor:d,sizeAccessor:y,symbolAccessor:p,symbolMap:g,groupAccessor:m,lineDataAccessor:x,curve:b,normalize:v,baseline:k,stackOrder:w,binSize:A,valueAccessor:M,arrowOfTime:S="right",windowMode:$="sliding",windowSize:P=200,timeAccessor:C,xExtent:L,yExtent:_,extentPadding:T=.1,scalePadding:D,sizeRange:R,size:W=[500,300],responsiveWidth:E,responsiveHeight:N,margin:I,className:O,background:F,renderMode:z,lineStyle:Y,pointStyle:B,areaStyle:j,barStyle:X,waterfallStyle:H,swarmStyle:V,barColors:q,colorScheme:U,boundsAccessor:Z,boundsStyle:K,y0Accessor:J,band:Q,gradientFill:tt,lineGradient:nt,semanticLineStops:rt,areaGroups:it,openAccessor:at,highAccessor:st,lowAccessor:lt,closeAccessor:ct,candlestickStyle:ut,showAxes:bt=!0,axes:vt,xLabel:kt,yLabel:wt,yLabelRight:At,xFormat:Mt,yFormat:$t,axisExtent:Lt,tickFormatTime:_t,tickFormatValue:Tt,hoverAnnotation:Dt,tooltipContent:Rt,customHoverBehavior:Wt,customClickBehavior:Et,onObservation:Nt,annotationObservationCallback:It,chartId:Ot,enableHover:Ft,hoverRadius:zt=30,tooltipMode:Yt,annotations:Bt,onAnnotationActivate:jt,autoPlaceAnnotations:Gt,svgAnnotationRules:Xt,showGrid:Ht,legend:Vt,legendHoverBehavior:qt,legendClickBehavior:Ut,legendHighlightedCategory:Zt,legendIsolatedCategories:Kt,legendPosition:Jt,legendLayout:Qt,legendCategoryAccessor:te,onCategoriesChange:ee,backgroundGraphics:ne,foregroundGraphics:re,canvasPreRenderers:oe,svgPreRenderers:ie,title:ae,categoryAccessor:se,brush:le,onBrush:ce,decay:he,pulse:de,transition:fe,animate:ge,staleness:me,frameScheduler:xe,clock:be,random:ve,seed:ke,paused:we=!1,suspendWhenHidden:Ae=!0,heatmapAggregation:Me,heatmapXBins:Se,heatmapYBins:$e,showValues:Pe,heatmapValueFormat:Ce,marginalGraphics:Le,pointIdAccessor:_e,xScaleType:Te,yScaleType:De,accessibleTable:Re=!0,description:We,summary:Ee,linkedCrosshairName:Ne,linkedCrosshairSourceId:Ie,customLayout:Oe,onLayoutError:Fe,layoutConfig:ze,layoutSelection:Ye}=t,{customHoverBehavior:Be,customClickBehavior:je,hasClickBehavior:Ge}=function({customHoverBehavior:t,customClickBehavior:e,onObservation:n,chartId:r,chartType:o}){return{customHoverBehavior:dl((e,i)=>{t?.(e,i),ul({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:o,chartId:r,context:i})},[r,o,t,n]),customClickBehavior:dl((t,i)=>{e?.(t,i),hl({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:o,chartId:r,context:i})},[r,o,e,n]),hasClickBehavior:!(!e&&!n)}}({customHoverBehavior:Wt,customClickBehavior:Et,onObservation:Nt,chartId:Ot,chartType:"StreamXYFrame"}),Xe=xt().replace(/:/g,""),He=dt(!1),Ve=dt({w:-1,h:-1}),qe=dt(!1),Ue=as({sizeProp:W,responsiveWidth:E,responsiveHeight:N,userMargin:I,marginDefault:Sl,title:ae,legend:Vt,legendPosition:Jt,animate:ge,transitionProp:fe,frameScheduler:xe,clock:be,random:ve,seed:ke,paused:we,suspendWhenHidden:Ae,themeDirtyRef:He}),Ze=Ji(),Ke=na(),{reducedMotionRef:Je,responsiveRef:Qe,size:tn,currentTheme:en,transition:nn,introEnabled:rn,tableId:on,rafRef:an,renderFnRef:sn,scheduleRender:ln,frameRuntime:un}=Ue;let hn=Ue.margin;if(Le){const t=60,e={...Ue.margin};Le.top&&t>e.top&&(e.top=t),Le.bottom&&t>e.bottom&&(e.bottom=t),Le.left&&t>e.left&&(e.left=t),Le.right&&t>e.right&&(e.right=t),hn=e}const dn=tn[0]-hn.left-hn.right,fn=tn[1]-hn.top-hn.bottom,yn=pt(()=>Pt(o),[o]),pn=Dt??Ft,[gn,mn]=ft(0),xn=dt(0),[vn,wn]=ft(null),Mn=ds(re,tn,hn,vn),Sn=ds(ne,tn,hn,vn),Cn=dt(null),Ln=dt(null),_n=dt(void 0),[Tn,Dn]=ft(null),Rn=dt($l.primary),Wn=dt(function(){let t=-1,e=ha;return{resolve(n){if(!n)return ha;const r=et();return r===t||(e=function(t){if(!t)return ha;const e=getComputedStyle(t),n=e.getPropertyValue("--semiotic-border").trim(),r=e.getPropertyValue("--semiotic-text-secondary").trim(),o=e.getPropertyValue("--semiotic-bg").trim(),i=e.getPropertyValue("--semiotic-primary").trim(),a=r||e.getPropertyValue("--text-secondary").trim(),s=e.getPropertyValue("--text-primary").trim(),l=n||e.getPropertyValue("--surface-3").trim(),c=o||e.getPropertyValue("--surface-0").trim();return a||s||n||i?{axisStroke:l||ha.axisStroke,tickText:a||ha.tickText,crosshair:a?da(a,"66"):ha.crosshair,hoverFill:c?da(c,"4D"):ha.hoverFill,hoverStroke:a?da(a,"99"):ha.hoverStroke,pointRing:c||ha.pointRing,primary:i||ha.primary,background:c||ha.background}:ha}(n),t=r),e},invalidate(){t=-1}}}()),En=dt(!1),Nn=bn("StreamXYFrame"),[In,On]=ft(!1),[Fn,zn]=ft([]),[Yn,Bn]=ft([]),jn="streaming"===r||["bar","swarm","waterfall"].includes(n),Gn=oa(pt(()=>({chartType:n,runtimeMode:jn?"streaming":"bounded",windowSize:P,windowMode:$,arrowOfTime:jn?S:"right",extentPadding:T,scalePadding:D,axisExtent:Lt,xAccessor:l,yAccessor:c,accessorRevision:h,timeAccessor:jn?C:void 0,valueAccessor:M,colorAccessor:d,sizeAccessor:y,symbolAccessor:p,symbolMap:g,groupAccessor:m||(x?"_lineGroup":void 0),categoryAccessor:se,lineDataAccessor:x,xScaleType:Te,yScaleType:De,xExtent:L,yExtent:_,sizeRange:R,binSize:A,normalize:v,baseline:k,stackOrder:w,boundsAccessor:Z,boundsStyle:K,y0Accessor:J,band:Q,gradientFill:ye(tt),areaGroups:it?new Set(it):void 0,lineGradient:pe(nt),semanticLineStops:rt,openAccessor:at,highAccessor:st,lowAccessor:lt,closeAccessor:ct,candlestickStyle:ut,lineStyle:Y,pointStyle:B,areaStyle:j,swarmStyle:V,waterfallStyle:H,colorScheme:U,barColors:q,barStyle:X,annotations:Bt,decay:he,pulse:de,transition:nn,introAnimation:rn,staleness:me,clock:un.now,heatmapAggregation:Me,heatmapXBins:Se,heatmapYBins:$e,showValues:Pe,heatmapValueFormat:Ce,pointIdAccessor:_e,curve:b,themeCategorical:en?.colors?.categorical,themeSemantic:ot(en),themeSequential:en?.colors?.sequential,themeDiverging:en?.colors?.diverging,customLayout:Oe,onLayoutError:Fe,layoutConfig:ze,layoutMargin:hn}),[n,jn,P,$,S,T,D,Lt,l,c,h,C,M,d,y,p,g,m,x,se,Te,De,L,_,R,A,v,k,w,Z,K,J,Q,tt,it,nt,rt,at,st,lt,ct,ut,Y,B,j,V,H,U,q,X,Bt,he,de,nn,rn,me,un.now,Me,Se,$e,Pe,Ce,_e,b,en,Oe,Fe,ze,hn])),qn=dt(null);qn.current||(qn.current=new cn(Gn));const Un=function(t,e,n,r){const o=gs({accessor:e,onChange:n,readData:r}),i=gs([]);return o.current={accessor:e,onChange:n,readData:r},ps(()=>{const{accessor:e,onChange:n,readData:r}=o.current;if(!n||!e)return;const a=function(t,e){if(!e)return[];const n=new Set,r=[];for(const o of t){if(!o||"object"!=typeof o)continue;const t="function"==typeof e?e(o):o[e];if(null==t)continue;const i=t+"";n.has(i)||(n.add(i),r.push(i))}return r}(t.current?r(t.current):[],e);(function(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(t[n]!==e[n])return!1;return!0})(a,i.current)||(i.current=a,n(a))},[t])}(qn,te,ee,t=>t.getData());$n(qn,Gn,He,ln),Pn(qn,Ye,He,ln);const Zn=dt(null);Zn.current||(Zn.current=new Ct(t=>{const e=qn.current;e&&e.ingest(t)&&(He.current=!0,ln())},{chunkThreshold:a,chunkSize:s})),yt(()=>{Zn.current?.updateChunkOptions({chunkThreshold:a,chunkSize:s})},[a,s]);const Kn=gt(t=>{Zn.current?.push(t)},[]),Jn=gt(t=>{Zn.current?.pushMany(t)},[]),Qn=gt(()=>{Zn.current?.clear(),qn.current?.clear(),He.current=!0,ln()},[ln]);mt(e,()=>({push:Kn,pushMany:Jn,remove:t=>{Zn.current?.flush();const e=qn.current?.remove(t)??[];return e.length>0&&(Cn.current&&e.some(t=>t===Cn.current?.data)&&(Cn.current=null,Dn(null)),He.current=!0,ln()),e},update:(t,e)=>{Zn.current?.flush();const n=qn.current?.update(t,e)??[];return n.length>0&&(He.current=!0,ln()),n},clear:Qn,getData:()=>(Zn.current?.flush(),qn.current?.getData()??[]),getScales:()=>qn.current?.scales??null,getExtents:()=>qn.current?.getExtents()??null,getCustomLayout:()=>qn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>qn.current?.lastCustomLayoutFailure??null}),[Kn,Jn,Qn,ln]),yt(()=>{if(o){if(x&&yn.length>0&&"object"==typeof yn[0]&&null!==yn[0]){const t="string"==typeof x?x:"coordinates";if(Array.isArray(yn[0][t])){const e=[];for(const n of yn){const r=n[t];if(Array.isArray(r)){const t=n.label||n.id||n.key;if(null!=t)for(const n of r)e.push({...n,_lineGroup:t});else for(const t of r)e.push(t)}}return void Zn.current?.setBoundedData(e)}}Zn.current?.setBoundedData(yn)}},[o,yn,x]);const{canvasRef:tr,interactionCanvasRef:er}=us(Ue,{storeRef:qn,dirtyRef:He,hydrated:Ze,wasHydratingFromSSR:Ke,cleanup:()=>Zn.current?.clear(),canvasPaintDependencies:[n,dn,fn,bt,F,ne,Y,z,oe,ln]}),{hoverHandlerRef:nr,hoverLeaveRef:or,onPointerMove:ir,onPointerLeave:ar}=Ue;nr.current=t=>{if(!pn)return;const e=tr.current;if(!e)return;const r=e.getBoundingClientRect(),o=t.clientX-r.left-hn.left,a=t.clientY-r.top-hn.top;if(0>o||o>dn||0>a||a>fn)return void(Cn.current&&(Cn.current=null,Ln.current=null,Dn(null),Be&&(Be(null),He.current=!0),ln()));const s=qn.current;if(!s||0===s.scene.length)return;const c=u(zt,t.pointerType),h=Hn(s.scene,o,a,c,s.quadtree,s.maxPointRadius),d="multi"===Yt,f=()=>{Cn.current&&(Cn.current=null,Ln.current=null,Dn(null),Be&&Be(null),ln())};if(!h&&!d)return void f();const y=d||!h?o:h.x,p=d||!h?a:h.y,g=h?.datum?ue(h.datum,s.resolvedRibbons):{},m=s.scales?.x?.invert,x="function"==typeof m?m(y):void 0;let b=i(g,y,p,null!=x?{xValue:x,xPx:y}:void 0);if(d&&s.scene.length>0&&s.scales){const t=function(t,e,n=30){const r=[];for(const o of t)if("line"===o.type){const t=o;if(2>t.path.length)continue;const i=Vn(Xn(t.path,t.curve),e,n);if(null===i)continue;const a=rr(t.path,e);r.push({node:o,datum:Array.isArray(t.datum)&&t.datum[a]?t.datum[a]:t.datum,x:t.path[a][0],y:i,group:t.group,color:t.style.stroke})}else if("area"===o.type){const t=o;if(!1===t.interactive)continue;if(2>t.topPath.length)continue;const i=Xn(t.topPath,t.curve),a=Xn(t.bottomPath,t.curve),s=Vn(i,e,n);if(null===s)continue;const l=Vn(a,e,n),c=rr(t.topPath,e);r.push({node:o,datum:Array.isArray(t.datum)&&t.datum[c]?t.datum[c]:t.datum,x:t.topPath[c][0],y:s,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 r}(s.scene,y,Math.max(c,dn));if(t.length>0){const e=s.scales.y.invert,r=Rn.current,o=m?m(y):y;if(h)b.xValue=o,b.xPx=y;else{const t={xValue:o};"string"==typeof l&&(t[l]=o),b=i(t,y,p,{xValue:o,xPx:y})}b.allSeries=t.map(t=>{const o=e?e(t.y):t.y,i=null!=t.y0?e?e(t.y0):t.y0:void 0;return{group:t.group||"",value:"stackedarea"===n&&null!=i?o-i:o,valuePx:t.y,color:t.color||r,datum:ue(t.datum,s.resolvedRibbons)}})}}h||b.allSeries?.length?(Cn.current=b,Ln.current=h?.node??null,Dn(b),Be&&(Be(b),He.current=!0),ln()):f()},or.current=()=>{Cn.current&&(Cn.current=null,Ln.current=null,Dn(null),Be&&(Be(null),He.current=!0),ln())};const sr=dt(()=>{});sr.current=t=>{if(f(t.target))return;if(!je)return;const e=tr.current;if(!e)return;const n=e.getBoundingClientRect(),r=t.clientX-n.left-hn.left,o=t.clientY-n.top-hn.top;if(0>r||r>dn||0>o||o>fn)return void je(null);const a=qn.current;if(!a||0===a.scene.length)return void je(null);const s=u(zt,_n.current),l=Hn(a.scene,r,o,s,a.quadtree,a.maxPointRadius);if(!l)return void je(null);const c=l.datum||{},h=a.scales?.x?.invert,d="function"==typeof h?h(l.x):void 0;je(i(c,l.x,l.y,null!=d?{xValue:d,xPx:l.x}:void 0),{type:"activate",inputType:ll(_n.current)})};const ur=gt(t=>sr.current(t),[]),{kbFocusIndexRef:dr,focusedNavPointRef:fr,onKeyDown:yr}=(xr={storeRef:qn,hoverRef:Cn,hoveredNodeRef:Ln,setHoverPoint:Dn,customHoverBehavior:Be,customClickBehavior:je,scheduleRender:ln},function({storeRef:t,hoverRef:e,hoveredNodeRef:n,setHoverPoint:r,customHoverBehavior:o,customClickBehavior:i,scheduleRender:a,extractPoints:s,toHover:l}){const c=yl(-1),u=yl(null),h=yl(null),d=fl(d=>{if(cl(d))return;const f=t.current;if(!f)return;const y=()=>{c.current=-1,u.current=null,e.current=null,n&&(n.current=null),r(null),o(null),a()};if(0===f.scene.length)return void(0>c.current||y());let p;if(h.current?.version===f.version)p=h.current.graph;else{const t=s(f.scene);if(0===t.length)return void(0>c.current||y());p=pl(t),h.current={version:f.version,graph:p}}let g=c.current;if(p.flat.length>g||(y(),g=-1),("Enter"===d.key||" "===d.key)&&g>=0)return d.preventDefault(),void i(l(p.flat[g],f),{type:"activate",inputType:"keyboard"});if(0>g){if("Escape"===d.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(d.key))return;d.preventDefault(),c.current=0;const t=p.flat[0];u.current=t;const n=l(t,f);return e.current=n,r(n),o(n,{type:"focus",inputType:"keyboard"}),void a()}const m=ml(d.key,gl(p,g),p);if(null===m)return;if(d.preventDefault(),0>m)return void y();c.current=m;const x=p.flat[m];u.current=x;const b=l(x,f);e.current=b,r(b),o(b,{type:"focus",inputType:"keyboard"}),a()},[i,o,s,e,n,a,r,t,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:d}}({...xr,extractPoints:bl,toHover:(t,e)=>function(t){return{data:t.datum||{},x:t.x,y:t.y,__semioticHoverData:!0}}({...t,datum:ue(t.datum,e.resolvedRibbons)})})),pr=gt(t=>{_n.current=t.pointerType,dr.current=-1,fr.current=null,ir(t)},[fr,dr,ir]),gr=gt(t=>{_n.current="mouse",dr.current=-1,fr.current=null,ir({clientX:t.clientX,clientY:t.clientY,pointerType:"mouse"})},[fr,dr,ir]),mr=gt(t=>{_n.current=t.pointerType},[]);var xr;sn.current=()=>{if(an.current=null,!un.isActive)return;const t=tr.current,e=er.current;if(!t||!e)return;const r=qn.current;if(!r)return;const o=un.now(),i=r.advanceTransition(Je.current?o+1e6:o),a=!Je.current&&i,s=Ve.current.w!==dn||Ve.current.h!==fn,u=He.current||i||s,h=r.consumeStylePaintPending();let d=!1;const f=r.getLastUpdateResult(),y=Nn.current.beforeCompute(f,a);!u||a&&!s||(r.computeScene({width:dn,height:fn}),Ve.current={w:dn,h:fn},d=!0,Un()),Nn.current.afterCompute(y,d,s);const p=function(t,e,n,r){const o=r.current,i=!0===t.lastCustomLayoutFailure?.preservedLastGoodScene,a=!i&&t.hasActivePulsesAt(e),s=!(n||i||!a&&!o)&&t.refreshPulse(e);return r.current=a,{changed:s,pending:a}}(r,o,d,qe),g=ys(),m=Wn.current.resolve(t);Rn.current=m.primary;const x=lr(me,r.lastIngestTime>0?o-r.lastIngestTime:0),b=me&&x.isStale;if(u||h||p.changed){const e=fs(t,tn,hn,g);if(e){if(e.clearRect(-hn.left,-hn.top,tn[0],tn[1]),me&&1>x.alpha&&(e.globalAlpha=x.alpha),ca(e,{background:F,hasBackgroundGraphics:!!ne,themeBackground:m.background,x:-hn.left,y:-hn.top,width:tn[0],height:tn[1]}),e.save(),"function"==typeof e.rect&&(e.beginPath(),e.rect(0,0,dn,fn),e.clip()),oe&&r.scales)for(const t of oe)e.save(),t(e,r.scene,r.scales,{width:dn,height:fn}),e.restore();const t=Oe?qs.custom:qs[n];Js({context:e,nodes:r.scene,renderMode:z,pixelRatio:g,paintBuiltIn:n=>{if(t&&r.scales)for(const o of t)o(e,n,r.scales,{width:dn,height:fn})}}),e.restore(),me&&1>x.alpha&&(e.globalAlpha=1)}}const v=!!(pn&&Cn.current&&r.scales),k=!!(Ln.current&&Array.isArray(Dt)&&Dt.some(t=>t&&"object"==typeof t&&"highlight"===t.type)),w=v||k;if(w||En.current){const t=fs(e,tn,hn,g);if(t&&(t.clearRect(-hn.left,-hn.top,tn[0],tn[1]),v&&Cn.current&&function(t,e,n,r,o,i,a){if(!1===o.crosshair)return;const s=e.allSeries,l=s&&s.length>0,c=e.xPx??e.x;t.save();const u="object"==typeof o.crosshair?o.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(l?c:e.x,0),t.lineTo(l?c:e.x,r),t.stroke(),l||(t.beginPath(),t.moveTo(0,e.y),t.lineTo(n,e.y),t.stroke()),t.restore(),l){t.lineWidth=2,t.strokeStyle=a.pointRing;for(const e of s)null!=e.valuePx&&(t.beginPath(),t.arc(c,e.valuePx,4,0,2*Math.PI),t.fillStyle=e.color||a.primary,t.fill(),t.stroke())}else{const n=o.pointColor||function(t){if(!t)return null;if("heatcell"===t.type)return t.fill||null;if("candlestick"===t.type)return t.isUp?t.upColor:t.downColor;const{style:e}=t;if(!e)return null;const n="string"==typeof e.fill?e.fill:null;return"line"===t.type||"area"===t.type?e.stroke||n||null:n||e.stroke||null}(i)||a.primary;t.beginPath(),t.arc(e.x,e.y,4,0,2*Math.PI),t.fillStyle=n,t.fill(),t.strokeStyle=a.pointRing,t.lineWidth=2,t.stroke()}}(t,Cn.current,dn,fn,"object"==typeof pn?pn:{},Ln.current,m),k&&Ln.current&&Array.isArray(Dt))){const e=Dt.find(t=>t&&"object"==typeof t&&"highlight"===t.type);e&&function(t,e,n,r,o){if(!n)return;const i="group"in n?n.group:void 0;if(void 0!==i)for(const n of e){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const e="function"==typeof r.style?n.datum?r.style(n.datum):{}:r.style||{};t.save(),t.beginPath(),t.moveTo(n.path[0][0],n.path[0][1]);for(let e=1;n.path.length>e;e++)t.lineTo(n.path[e][0],n.path[e][1]);t.strokeStyle=e.stroke||n.style.stroke||o.primary,t.lineWidth=e.strokeWidth||(n.style.strokeWidth||2)+2,t.globalAlpha=e.opacity??1,t.stroke(),t.restore()}}(t,r.scene,Ln.current,e,m)}En.current=w}u&&t&&t.setAttribute("aria-label",Aa(r.scene,n+" chart"));const A=He.current;if(He.current=A&&a&&!d,A&&r.scales){const t=t=>"object"==typeof t&&null!==t&&"function"==typeof t.valueOf?t.valueOf():t;if((!vn||t(vn.x.domain()[0])!==t(r.scales.x.domain()[0])||t(vn.x.domain()[1])!==t(r.scales.x.domain()[1])||t(vn.y.domain()[0])!==t(r.scales.y.domain()[0])||t(vn.y.domain()[1])!==t(r.scales.y.domain()[1])||vn.x.range()[0]!==r.scales.x.range()[0]||vn.x.range()[1]!==r.scales.x.range()[1]||vn.y.range()[0]!==r.scales.y.range()[0]||vn.y.range()[1]!==r.scales.y.range()[1])&&wn(r.scales),Le){const t=r.getData(),e="function"==typeof l?l:t=>t[l||"x"],n="function"==typeof c?c:t=>t[c||"y"];zn(t.map(t=>e(t)).filter(t=>"number"==typeof t&&isFinite(t))),Bn(t.map(t=>n(t)).filter(t=>"number"==typeof t&&isFinite(t)))}}!((Bt&&Bt.length>0||Oe)&&(d||a))||!d&&33>o-xn.current||(mn(t=>t+1),xn.current=o),me?.showBadge&&On(!!b),(a||null!=r.activeTransition||p.pending)&&ln()},cr(me,qn,He,ln,In,On);const br=pt(()=>{if(Mt||_t)return;const t=qn.current;return t?.xIsDate&&vn?vs(vn.x.domain()):void 0},[Mt,_t,vn]),vr=Mt||_t||br,kr=pn&&Tn?Rt?Rt(Tn):Al(sl,{hover:Tn}):null,wr=kr?Al(Va,{x:Tn.x,y:Tn.y,containerWidth:dn,containerHeight:fn,margin:hn,className:"stream-frame-tooltip",children:kr}):null,Ar=fr.current,Mr=Al(Ga,{active:dr.current>=0,hoverPoint:Tn,margin:hn,size:tn,shape:Ar?.shape,width:Ar?.w,height:Ar?.h}),Sr=ms(l,C,"__semiotic_resolvedX","__semiotic_resolvedTime"),$r=ms(c,M,"__semiotic_resolvedY","__semiotic_resolvedValue"),Pr=Sr.key,Cr=$r.key,Lr=function(t,e,n){return r=>{if(!r||!n||!t.fn&&!e.fn)return r;let o=!1;const i=r.map(n=>{const r=t.fn&&t.key&&!(t.key in n),i=e.fn&&e.key&&!(e.key in n);if(!r&&!i)return n;o=!0;const a={...n};return r&&(a[t.key]=t.fn(n)),i&&(a[e.key]=e.fn(n)),a});return o?i:r}}(Sr,$r,Bt&&Bt.length>0||!1);if(Xi||!Ze&&Ke){const t=qn.current;t&&o&&(t.ingest({inserts:yn,bounded:!0}),t.computeScene({width:dn,height:fn}));const e=t?.scene??[],n=t?.scales??null,r=ds(re,tn,hn,n),i=ds(ne,tn,hn,n),a=vr||(()=>{if(t?.xIsDate&&n)return vs(n.x.domain())})();return Ml("div",{ref:Qe,className:"stream-xy-frame"+(O?" "+O:""),role:"img","aria-label":We||("string"==typeof ae?ae:"XY chart"),style:{position:"relative",width:E?"100%":tn[0],height:N?"100%":tn[1]},children:[Al(za,{summary:Ee}),Ml("svg",{xmlns:"http://www.w3.org/2000/svg",width:tn[0],height:tn[1],style:{position:"absolute",left:0,top:0},children:[Al("g",{transform:`translate(${hn.left},${hn.top})`,children:i}),Ml("g",{transform:`translate(${hn.left},${hn.top})`,children:[F&&Al("rect",{x:0,y:0,width:dn,height:fn,fill:F}),ie&&n&&ie.map((t,r)=>Al(ht.Fragment,{children:t(e,n,{width:dn,height:fn})},"svgpre-"+r)),e.map((t,e)=>Qs({node:t,index:e,renderMode:z,fallback:()=>Gi(t,e,Xe)})).filter(Boolean)]})]}),Al(ii,{width:dn,height:fn,totalWidth:tn[0],totalHeight:tn[1],margin:hn,scales:n,showAxes:bt,axes:vt,xLabel:kt,yLabel:wt,yLabelRight:At,xFormat:a,yFormat:$t||Tt,axisExtent:Lt,showGrid:Ht,title:ae,legend:Vt,legendHoverBehavior:qt,legendClickBehavior:Ut,legendHighlightedCategory:Zt,legendIsolatedCategories:Kt,legendPosition:Jt,legendLayout:Qt,foregroundGraphics:An(r,G(qn.current?.customLayoutOverlays,Ye??null)),marginalGraphics:Le,xValues:[],yValues:[],annotations:Bt,onAnnotationActivate:jt,onObservation:It??Nt,chartId:Ot,chartType:"StreamXYFrame",autoPlaceAnnotations:Gt,svgAnnotationRules:Xt,annotationFrame:0,xAccessor:Pr,yAccessor:Cr,annotationData:Lr(qn.current?.getData()),pointNodes:ks(qn.current?.scene),curve:"string"==typeof b?b:void 0,linkedCrosshairName:Ne,linkedCrosshairSourceId:Ie})]})}return Ml("div",{ref:Qe,className:"stream-xy-frame"+(O?" "+O:""),role:"group","aria-label":We||("string"==typeof ae?ae:"XY chart"),tabIndex:0,style:{position:"relative",width:E?"100%":tn[0],height:N?"100%":tn[1],overflow:"visible",touchAction:Pl(le)},onKeyDown:yr,children:["production"!==process.env.NODE_ENV&&qn.current&&Al(kn,{store:qn.current,diagnostics:Nn.current}),Re&&Al(Ya,{tableId:on}),Re&&Al(Oa,{scene:qn.current?.scene??[],chartType:n+" chart",tableId:on,chartTitle:"string"==typeof ae?ae:void 0}),Al(za,{summary:Ee}),Al(va,{hoverPoint:Tn}),Ml("div",{role:"img","aria-label":We||("string"==typeof ae?ae:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:pn?pr:void 0,onMouseMove:pn?gr:void 0,onPointerLeave:pn?ar:void 0,onMouseLeave:pn?ar:void 0,onPointerDown:pn||Ge?mr:void 0,onClick:Ge?ur:void 0,children:[Al(hs,{size:tn,margin:hn,children:Sn}),Al(ni,{width:dn,height:fn,totalWidth:tn[0],totalHeight:tn[1],margin:hn,scales:vn,showAxes:bt,axes:vt,showGrid:Ht,xFormat:vr,yFormat:$t||Tt,axisExtent:Lt}),Al("canvas",{ref:tr,"aria-label":Aa(qn.current?.scene??[],n+" chart"),style:{position:"absolute",left:0,top:0}}),Al("canvas",{ref:er,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),Al(ii,{width:dn,height:fn,totalWidth:tn[0],totalHeight:tn[1],margin:hn,scales:vn,showAxes:bt,axes:vt,xLabel:kt,yLabel:wt,yLabelRight:At,xFormat:vr,yFormat:$t||Tt,axisExtent:Lt,showGrid:Ht,title:ae,legend:Vt,legendHoverBehavior:qt,legendClickBehavior:Ut,legendHighlightedCategory:Zt,legendIsolatedCategories:Kt,legendPosition:Jt,legendLayout:Qt,foregroundGraphics:An(Mn,G(qn.current?.customLayoutOverlays,Ye??null)),marginalGraphics:Le,xValues:Fn,yValues:Yn,annotations:Bt,onAnnotationActivate:jt,onObservation:It??Nt,chartId:Ot,chartType:"StreamXYFrame",autoPlaceAnnotations:Gt,svgAnnotationRules:Xt,annotationFrame:gn,xAccessor:Pr,yAccessor:Cr,annotationData:Lr(qn.current?.getData()),pointNodes:ks(qn.current?.scene),curve:"string"==typeof b?b:void 0,underlayRendered:!0,canvasObscuresUnderlay:!!la({background:F,hasBackgroundGraphics:!!ne,themeBackground:en?.colors.background}),linkedCrosshairName:Ne,linkedCrosshairSourceId:Ie}),(le||ce)&&Al(St,{width:dn,height:fn,totalWidth:tn[0],totalHeight:tn[1],margin:hn,dimension:le?.dimension??"xy",scales:vn,onBrush:ce??(()=>{}),binSize:A,snap:le?.snap,binBoundaries:le?.binBoundaries??("bar"===n?qn.current?.getBinBoundaries():void 0),snapDuring:le?.snapDuring,streaming:"streaming"===r}),me?.showBadge&&Al(hr,{isStale:In,position:me.badgePosition}),Mr,wr]})]})}));Cl.displayName="StreamXYFrame";var Ll=Cl;import*as _l from"react";import{jsx as Tl,jsxs as Dl}from"react/jsx-runtime";function Rl({componentName:t,message:e,diagnosticHint:n,width:r,height:o}){return Tl("div",{role:"alert",style:{width:r,height:Math.max(o,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:Dl("div",{style:{textAlign:"center",maxWidth:400},children:[Tl("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),Tl("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:e}),n&&Tl("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}import{jsx as Wl}from"react/jsx-runtime";var El=class extends _l.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,e){this.props.onError?.(t,e)}render(){if(this.state.error){const{fallback:t}=this.props,e=this.state.error;return"function"==typeof t?t(e):void 0!==t?t:Wl(Rl,{componentName:"ChartErrorBoundary",message:e.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as Nl}from"react/jsx-runtime";function Il({componentName:t,width:e,height:n,children:r}){return Nl(El,{fallback:r=>Nl(Rl,{componentName:t,message:r.message,width:e,height:n}),children:r})}"undefined"!=typeof process&&process;var Ol={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Fl={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function zl(t,e,n,r){return!1===r||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?Nl("div",{style:{...Ol,width:e,height:n},children:r||"No data available"}):null}function Yl(t,e,n,r){if(!t)return null;if(!1===r)return null;if(null!=r)return Nl("div",{style:{width:e,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),a=Math.max(6,Math.floor(n/(2.5*o))),s=Math.floor((n-(o*(i+a)-a))/2);return Nl("div",{style:{width:e,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:o},(t,n)=>Nl("div",{className:"semiotic-loading-bar",style:{...Fl,position:"absolute",top:s+n*(i+a),left:Math.floor(.1*e),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function Bl(t){return t?"string"==typeof t?{name:t}:t:null}import{useId as jl,useMemo as Gl,useCallback as Xl}from"react";function Hl(t){const e=[];for(const[n,r]of Object.entries(t.fields))if("point"===r.type)e.push(t=>r.values.has(t[n]));else{const[t,o]=r.range;e.push(e=>{const r=e[n];return r>=t&&o>=r})}return t=>e.every(e=>e(t))}function Vl(t,e){let n=t.get(e);return n||(n={name:e,resolution:"union",clauses:new Map},t.set(e,n)),n}function ql(t,e){if(t.type!==e.type)return!1;if("interval"===t.type&&"interval"===e.type)return t.range[0]===e.range[0]&&t.range[1]===e.range[1];if("point"===t.type&&"point"===e.type){if(t.values.size!==e.values.size)return!1;for(const n of t.values)if(!e.values.has(n))return!1;return!0}return!1}var[Ul,Zl]=rt(t=>({selections:new Map,setClause(e,n){t(t=>{const r=t.selections.get(e),o=r?.clauses.get(n.clientId);if(o&&function(t,e){if(t.clientId!==e.clientId||t.type!==e.type)return!1;const n=Object.entries(t.fields);if(n.length!==function(t){let e=0;for(const n in t)e++;return e}(e.fields))return!1;for(const[t,r]of n){const n=e.fields[t];if(!n||!ql(r,n))return!1}return!0}(o,n))return{};const i=new Map(t.selections),a=Vl(i,e),s=new Map(a.clauses);return s.set(n.clientId,n),i.set(e,{...a,clauses:s}),{selections:i}})},clearClause(e,n){t(t=>{const r=t.selections.get(e);if(!r||!r.clauses.has(n))return{};const o=new Map(t.selections),i=new Map(r.clauses);return i.delete(n),o.set(e,{...r,clauses:i}),{selections:o}})},setResolution(e,n){t(t=>{const r=t.selections.get(e);if(r?.resolution===n)return{};const o=new Map(t.selections),i=Vl(o,e);return o.set(e,{...i,resolution:n}),{selections:o}})},clearSelection(e){t(t=>{const n=t.selections.get(e);if(!n||0===n.clauses.size)return{};const r=new Map(t.selections);return r.set(e,{...n,clauses:new Map}),{selections:r}})}}));function Kl(t){const e=jl(),n=t.clientId||e,{name:r}=t,o=Zl(t=>t.selections.get(r)),i=Zl(t=>t.setClause),a=Zl(t=>t.clearClause),s=Gl(()=>!!o&&o.clauses.size>0,[o]);return{predicate:Gl(()=>o&&0!==o.clauses.size?function(t,e){const n=[];for(const[r,o]of t.clauses)"crossfilter"===t.resolution&&r===e||n.push(Hl(o));return 0===n.length?()=>!0:"intersect"===t.resolution?t=>n.every(e=>e(t)):t=>n.some(e=>e(t))}(o,n):()=>!0,[o,n]),isActive:s,selectPoints:Xl(t=>{const e={};let o=!1;for(const[n,r]of Object.entries(t))e[n]={type:"point",values:new Set(r)},o=!0;o&&i(r,{clientId:n,type:"point",fields:e})},[n,r,i]),selectInterval:Xl(t=>{const e={};let o=!1;for(const[n,r]of Object.entries(t))e[n]={type:"interval",range:r},o=!0;o&&i(r,{clientId:n,type:"interval",fields:e})},[n,r,i]),clear:Xl(()=>{a(r,n)},[a,r,n]),clientId:n}}function Jl(t){return 2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}function Ql(t){const{name:e,xField:n,yField:r}=t,{predicate:o,isActive:i,selectInterval:a,clear:s}=Kl({name:e,fields:[n,r].filter(Boolean)}),l=n&&r?"xyBrush":n?"xBrush":"yBrush",c=Xl(t=>{if(!t)return void s();const e={};"xyBrush"===l&&function(t){return 2===t.length&&Array.isArray(t[0])&&2===t[0].length&&Array.isArray(t[1])&&2===t[1].length}(t)?(n&&(e[n]=[Math.min(t[0][0],t[1][0]),Math.max(t[0][0],t[1][0])]),r&&(e[r]=[Math.min(t[0][1],t[1][1]),Math.max(t[0][1],t[1][1])])):"xBrush"===l&&Jl(t)?n&&(e[n]=[Math.min(t[0],t[1]),Math.max(t[0],t[1])]):"yBrush"===l&&Jl(t)&&r&&(e[r]=[Math.min(t[0],t[1]),Math.max(t[0],t[1])]),tc(e)&&a(e)},[l,n,r,a,s]);return{brushInteraction:Gl(()=>({brush:l,during:c,end:c}),[l,c]),predicate:o,isActive:i,clear:s}}function tc(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}var ec={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function nc(t,e={}){const n=e.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof e.mobileSemantics?.minimumHitTarget?e.mobileSemantics.minimumHitTarget:void 0,o="mobile"===e.mode||"number"==typeof e.width&&480>=e.width,i=!!n||void 0!==r,a=t&&"object"==typeof t?t:void 0;if(!1===t||!1===a?.enabled||void 0===t&&!o&&!i)return ec;const s=a??{};return{enabled:!0,tapToSelect:s.tapToSelect??!0,tapToLockTooltip:s.tapToLockTooltip??!0,clearSelection:s.clearSelection??"backgroundTap",targetSize:s.targetSize??r??44,snap:s.snap??"nearestDatum",brushHandleSize:s.brushHandleSize??44,standardControls:s.standardControls??!1}}var rc={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function oc(t){return"string"==typeof t&&Object.prototype.hasOwnProperty.call(rc,t)}function ic(t,e,n){const r=rc[t||"primary"],o=t&&"primary"!==t||!n?.width?r.width:n.width,i=t&&"primary"!==t||!n?.height?r.height:n.height,a={...e,mode:t},s=x(a,{width:e.width??o,height:e.height??i}).props,l=s.mode||t||"primary",c=rc[l],u="context"===l||"sparkline"===l,h="primary"===l&&n?.width?n.width:c.width;return{mode:l,width:s.width??h,height:s.height??("primary"===l&&n?.height?n.height:c.height),showAxes:s.showAxes??c.showAxes,showGrid:s.showGrid??c.showGrid,enableHover:s.enableHover??(!!s.linkedHover||c.enableHover),showLegend:s.showLegend??c.showLegend,showLabels:s.showLabels??c.showLabels,title:u?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:u?void 0:s.xLabel,yLabel:u?void 0:s.yLabel,categoryLabel:u?void 0:s.categoryLabel,valueLabel:u?void 0:s.valueLabel,marginDefaults:ac(c.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:u,mobileInteraction:nc(s.mobileInteraction,{mode:l,width:s.width??h,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function ac(t,e,n){if(!1!==e)return t;const r={...t};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}import{useMemo as sc,useCallback as lc,useState as cc}from"react";import{createContext as uc,useContext as hc,useEffect as dc,useId as fc,useLayoutEffect as yc,useMemo as pc,useRef as gc,useState as mc,useCallback as xc}from"react";import{createContext as bc,useContext as vc,useMemo as kc}from"react";import{jsx as wc}from"react/jsx-runtime";var Ac=bc(null);function Mc(){return vc(Ac)}import{jsx as Sc,jsxs as $c}from"react/jsx-runtime";var Pc=uc(!1);uc(!1);var Cc=uc(null),Lc="undefined"==typeof window?dc:yc;function _c({data:t,colorBy:e,colorScale:n,showLegend:r,legendPosition:o="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:s,additionalLegend:l,chartWidth:c,legendLayout:u,hasTitle:h=!1,axisChrome:d}){const f=hc(Pc),y=null!==hc(Cc),p=void 0!==r?r:!f&&!!e,g=!!e&&(p||y),m=sc(()=>{if(!g)return[];if(void 0!==s)return s;const n=new Set;for(const r of t){const t="function"==typeof e?e(r):r[e];null!=t&&n.add(t+"")}return Array.from(n)},[s,e,t,g]);!function(t){const e=hc(Cc),n=fc(),r=function(t){const e=new Set,n=[];for(const r of t)e.has(r)||(e.add(r),n.push(r));return n}(t),o=gc([]);(function(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(t[n]!==e[n])return!1;return!0})(o.current,r)||(o.current=r);const i=o.current;Lc(()=>{if(e)return()=>e.unregisterCategories(n)},[e,n]),Lc(()=>{e&&e.registerCategories(n,i)},[e,n,i])}(y&&e?m:[]);const x=sc(()=>{if(!p||!e)return;const r=function({data:t,colorBy:e,colorScale:n,getColor:r,strokeColor:o,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:t=>{const e=t.color||"#333",n={fill:e,stroke:e};return void 0!==o&&(n.stroke=o),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(t.map(t=>"function"==typeof e?e(t):t[e])))).map((o,i)=>{const a=t.find("function"==typeof e?t=>e(t)===o:t=>t[e]===o),s=a?r(a,e,n):n?n(o):Et[i%Et.length];return{label:o+"",color:s}}),label:""}]}}({data:t,colorBy:e,colorScale:n,getColor:Ot,categories:m});return 0!==r.legendGroups.reduce((t,e)=>t+e.items.length,0)?r:void 0},[p,e,t,n,m]),b=sc(()=>gr(x,l),[x,l]),{hasAxis:v,hasAxisLabel:k,rotatedTicks:w}=d??{},A=sc(()=>{const t="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},e=e=>{const n=t[e];return"number"==typeof n?n:a[e]},n={top:e("top"),right:e("right"),bottom:e("bottom"),left:e("left")},r=e=>"number"==typeof t[e];if(b){const t=$r(b,u),e=void 0===v?{hasAxis:!0,hasAxisLabel:!0}:{hasAxis:v,hasAxisLabel:k,rotatedTicks:w},i=Sr(b,Math.max(1,(c??600)-n.left-n.right),u)+wr(b)+Mr("bottom"===o?e:void 0,u)+("top"===o&&h?24:0);"right"===o&&!r("right")&&t>n.right?n.right=t:"left"===o&&!r("left")&&t>n.left?n.left=t:"top"!==o||r("top")?"bottom"!==o||r("bottom")||(n.bottom=Math.max(n.bottom,80,i)):n.top=Math.max(n.top,50,i)}return n},[a,i,b,o,c,u,h,v,k,w]);return{legend:b,margin:A,legendPosition:o}}function Tc(t,e,n){const[r,o]=cc(null),[i,a]=cc(new Set),s=sc(()=>new Set,[]),l=lc(e=>{"highlight"===t&&o(e?e.label:null)},[t]),c=lc(e=>{"isolate"===t&&a(t=>{const r=new Set(t);return r.has(e.label)?r.delete(e.label):r.add(e.label),r.size===n.length?new Set:r})},[t,n.length]),u=sc(()=>{if(!t||"none"===t||!e)return null;const n="string"==typeof e?e:null;return"highlight"===t&&null!=r?{isActive:!0,predicate:t=>(n?t[n]:"function"==typeof e?e(t):null)===r}:"isolate"===t&&i.size>0?{isActive:!0,predicate:t=>{const r=n?t[n]:"function"==typeof e?e(t):null;return i.has(r)}}:null},[t,e,r,i]);return{highlightedCategory:"highlight"===t?r:null,isolatedCategories:"isolate"===t?i:s,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}import{useMemo as Dc,useCallback as Rc,useState as Wc,useId as Ec,useEffect as Nc,useRef as Ic}from"react";function Oc(t,e,n){const r=t.xValue??e?.[n];if(null==r)return null;const o=Number(r);return Number.isFinite(o)?o:null}function Fc(t){let e=t.data||t.datum||t;return Array.isArray(e)&&(e=e[0]),null!=t.xValue&&e&&"object"==typeof e&&!Array.isArray(e)&&null==e.xValue?{...e,xValue:t.xValue}:e||{}}function zc(t){if(!t)return!1;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}var Yc=[];function Bc(){const t=e(),n=t?.colors?.categorical;return n&&n.length>0?n:void 0}function jc(t,e,n,r,o){if(t)return t;if(n&&"object"==typeof n&&!Array.isArray(n)){const t=Ft(n,r);if(t)return t}let i;if(Array.isArray(n))i=n;else if(e&&e.length>0)i=e;else if("string"==typeof n){const t=Tt[n];Array.isArray(t)&&(i=t)}return i&&0!==i.length?null!=r?(o.has(r)||o.set(r,o.size),i[o.get(r)%i.length]):i[0]:Rt}function Gc(t,e,n){const r=Mc(),o=Bc();return Dc(()=>{if(!e)return;const i=r??void 0,a=n??(o&&o.length>0?o:void 0)??"category10";if(0!==t.length){if("function"==typeof e){const n=Array.from(new Set(t.map(t=>e(t)+"")));if(i&&zc(i)){const t=zt(n.map(t=>({_cat:t})),"_cat",a);return e=>i[e]||t(e)}return zt(n.map(t=>({_cat:t})),"_cat",a)}if(i&&zc(i)){const n=zt(t,e,a);return t=>i[t]||n(t)}return zt(t,e,a)}if(i&&zc(i)){const t=zt([{_:"a"}],"_",a);return e=>i[e]||t(e)}},[t,e,n,r,o])}function Xc({selection:t,linkedHover:e,fallbackFields:n=Yc,unwrapData:r=!1,onObservation:o,chartType:i,chartId:a,onClick:s,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const h=Ec(),d=Dc(()=>function(t,e){return t?!0===t?{name:"hover",fields:e||[]}:"string"==typeof t?{name:t,fields:e||[]}:{name:t.name||"hover",fields:t.fields||e||[],mode:t.mode,xField:t.xField,seriesField:t.seriesField}:null}(e,n),[e,n]),f=Dc(()=>"series"===d?.mode?[d.seriesField||c||n[0]].filter(t=>!!t):d?.fields||n,[d,c,n]),y=Kl({name:t?.name||"__unused__",fields:f}),p=function(t){const e=t.name||"hover",{fields:n}=t,{predicate:r,isActive:o,selectPoints:i,clear:a}=Kl({name:e,fields:n});return{onHover:Xl(t=>{if(!t)return void a();const e={};for(const r of n){const n=t[r];void 0!==n&&(e[r]=[n])}tc(e)&&i(e)},[n,i,a]),predicate:r,isActive:o}}({name:d?.name||"hover",fields:f}),g=w(t=>t.pushObservation),m=Rc(t=>{o?.(t),g?.(t)},[o,g]),x=t?{isActive:y.isActive,predicate:y.predicate}:null,[b,v]=Wc(null),k=Ic(!1),A=c||n[0],M=Dc(()=>{if(!l||null==b||!A)return null;const t=b,e=A;return{isActive:!0,predicate:n=>("string"==typeof n[e]?n[e]:(n[e]??"")+"")===t}},[l,b,A]),S=Rc((t,n)=>{const r=!t&&k.current&&!!u?.enabled&&u.tapToLockTooltip;if(e)if(t){let e=t.data||t.datum||t;if(Array.isArray(e)&&(e=e[0]),"x-position"===d?.mode&&d.xField){const n=Oc(t,e,d.xField);null!=n&&function(t,e,n){const r=Ro.positions.get(t);r?.locked||r&&r.xValue===e&&r.sourceId===n||(Ro={positions:new Map(Ro.positions).set(t,{xValue:e,sourceId:n})},Eo())}(d.name||"hover",n,h)}"x-position"!==d?.mode&&p.onHover(e)}else"x-position"!==d?.mode||r||No(d.name||"hover",h),"x-position"===d?.mode||r||p.onHover(null);if(l&&A)if(t){let e=t.data||t.datum||t;Array.isArray(e)&&(e=e[0]);const n=e?.[A];v(null!=n?n+"":null)}else r||v(null);(o||g)&&ul({onObservation:m,datum:t?Fc(t):null,x:t?.x,y:t?.y,chartType:i||"unknown",chartId:a,context:n})},[e,p,d,h,o,i,a,g,m,l,A,u]),$=Rc((n=!0)=>{k.current=!1,e&&"x-position"!==d?.mode&&p.onHover(null),t&&u?.tapToSelect&&y.clear(),n&&l&&v(null),"x-position"===d?.mode&&(Io(d.name||"hover",h),No(d.name||"hover",h))},[e,d,p,t,u,y,l,h]),P=Rc((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),x=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===d?.mode&&d.xField&&n){let t=n.data||n.datum||n;Array.isArray(t)&&(t=t[0]);const e=Oc(n,t,d.xField);null!=e&&function(t,e,n){const r=Ro.positions.get(t);if(r?.locked){const e=new Map(Ro.positions);return e.delete(t),Ro={positions:e},Eo(),!1}Ro={positions:new Map(Ro.positions).set(t,{xValue:e,sourceId:n,locked:!0})},Eo()}(d.name||"hover",e,h)}if(c)if(n){k.current=!0;const r=Fc(n);if(e&&"x-position"!==d?.mode&&p.onHover(r),t&&u?.tapToSelect&&f.length>0){const t={};for(const e of f){const n=r[e];void 0!==n&&(t[e]=[n])}zc(t)&&y.selectPoints(t)}if(l&&A){const t=r?.[A];v(null!=t?t+"":null)}}else x&&$();if(n||x){if(n&&s){let t=n.data||n.datum||n;Array.isArray(t)&&(t=t[0]),s(t,{x:n.x??0,y:n.y??0})}(o||g)&&hl({onObservation:m,datum:n?Fc(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:a,context:r})}},[s,o,g,m,i,a,d,h,u,e,p,t,y,f,l,A,$]);return Nc(()=>{if(!u?.enabled||"undefined"==typeof document)return;const t=t=>{"Escape"===t.key&&k.current&&$()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[u?.enabled,$]),Nc(()=>()=>{k.current&&$(!1)},[$]),Nc(()=>{if("x-position"!==d?.mode)return;const t=d.name||"hover";return()=>{Io(t,h),No(t,h)}},[d?.mode,d?.name,h]),{activeSelectionHook:x,hoverSelectionHook:M,customHoverBehavior:S,customClickBehavior:P,crosshairSourceId:h}}function Hc(t,e){const n="object"==typeof t&&null!==t?t:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:e}}function Vc(t,e,n){return ic(t,e,n)}function qc(t){const{title:e,description:n,summary:r,accessibleTable:o,className:i,animate:a,axisExtent:s,autoPlaceAnnotations:l}=t,c={};return e&&(c.title=e),n&&(c.description=n),r&&(c.summary=r),void 0!==o&&(c.accessibleTable=o),i&&(c.className=i),null!=a&&(c.animate=a),void 0!==s&&(c.axisExtent=s),void 0!==l&&(c.autoPlaceAnnotations=l),c}function Uc(t){const{linkedHover:e,selection:n,onObservation:r,onClick:o,hoverRadius:i,hoverHighlight:a,forceHoverBehavior:s,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:h,linkedHoverInClickPredicate:d=!0}=t,f={};r&&(f.annotationObservationCallback=r);const y=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(s||e||r||o||a)&&(f.customHoverBehavior=u),h&&(l||(d?r||o||e:r||o)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(e||a||n))&&(f.customClickBehavior=h),null!=y&&(f.hoverRadius=y),f}function Zc(t,e,n){const r="function"==typeof e?e(t):t[e??n];if(null==r)return null;if(r instanceof Date)return r.getTime();if("string"==typeof r&&""===r.trim())return null;const o=Number(r);return Number.isFinite(o)?o:null}function Kc({data:t,valueAccessor:e,timeAccessor:n,binSize:r,valueExtent:o,extentPadding:i}){if(o)return[o[1],o[0]];if(!t||0===t.length)return;const a=new Map;for(const o of t){const t=Zc(o,n,"time"),i=Zc(o,e,"value");if(null==t||null==i)continue;const s=Math.floor(t/r)*r;a.set(s,(a.get(s)??0)+i)}let s=0;for(const t of a.values())s=Math.max(s,t);return[s>0?s+s*(i??.1):1,0]}function Jc(t,e){var n=t.get(e);if(!n)throw Error("missing: "+e);return n}function Qc(t,e){var n,r=[],o=[],i=[],a={},s=[];function l(t){i[t]=!1,a.hasOwnProperty(t)&&Object.keys(a[t]).forEach(function(e){delete a[t][e],i[e]&&l(e)})}function c(t){var e,r,h=!1;for(o.push(t),i[t]=!0,e=0;s[t].length>e;e++)(r=s[t][e])===n?(u(n,o),h=!0):i[r]||(h=c(r));if(h)l(t);else for(e=0;s[t].length>e;e++){var d=a[r=s[t][e]];d||(a[r]=d={}),d[r]=!0}return o.pop(),h}function u(t,n){var o=[].concat(n).concat(t);e?e(o):r.push(o)}function h(e){!function(e){for(var n=0;t.length>n;n++)n>=e&&t[n]||(t[n]=[]),t[n]=t[n].filter(function(t){return t>=e})}(e);for(var n,r=function(t){for(var e=t.length,n=Array(e),r=Array(e),o=Array(e),i=Array(e),a=Array(e),s=Array(e),l=0;e>l;++l)n[l]=-1,r[l]=0,o[l]=!1,i[l]=0,a[l]=-1,s[l]=[];var c,u=0,h=[],d=[];function f(e){var l=[e],c=[e];for(n[e]=r[e]=u,o[e]=!0,u+=1;c.length>0;){var f=t[e=c[c.length-1]];if(f.length>i[e]){for(var y=i[e];f.length>y;++y){var p=f[y];if(0>n[p]){n[p]=r[p]=u,o[p]=!0,u+=1,l.push(p),c.push(p);break}o[p]&&(r[e]=0|Math.min(r[e],r[p])),0>a[p]||s[e].push(a[p])}i[e]=y}else{if(r[e]===n[e]){var g=[],m=[],x=0;for(y=l.length-1;y>=0;--y){var b=l[y];if(o[b]=!1,g.push(b),m.push(s[b]),x+=s[b].length,a[b]=h.length,b===e){l.length=y;break}}h.push(g);var v=Array(x);for(y=0;m.length>y;y++)for(var k=0;m[y].length>k;k++)v[--x]=m[y][k];d.push(v)}c.pop()}}}for(l=0;e>l;++l)0>n[l]&&f(l);for(l=0;d.length>l;l++){var y=d[l];if(0!==y.length){y.sort(function(t,e){return t-e}),c=[y[0]];for(var p=1;y.length>p;p++)y[p]!==y[p-1]&&c.push(y[p]);d[l]=c}}return{components:h,adjacencyList:d}}(t),o=r.components.filter(function(t){return t.length>1}),i=1/0,a=0;o.length>a;a++)for(var s=0;o[a].length>s;s++)i>o[a][s]&&(i=o[a][s],n=a);var l=o[n];return!!l&&{leastVertex:i,adjList:t.map(function(t,e){return-1===l.indexOf(e)?[]:t.filter(function(t){return-1!==l.indexOf(t)})})}}n=0;for(var d=t.length;d>n;){var f=h(n);if(n=f.leastVertex,s=f.adjList){for(var y=0;s.length>y;y++)for(var p=0;s[y].length>p;p++){var g=s[y][p];i[+g]=!1,a[g]={}}c(n),n+=1}else n=d}return e?void 0:r}function tu(t){return t.y0-t.y1>0?"up":"down"}function eu(t,e){return e(t.source)==e(t.target)}function nu(t){var e=0;t.source.sourceLinks.forEach(function(t){e=t.circular?e+1:e});var n=0;return t.target.targetLinks.forEach(function(t){n=t.circular?n+1:n}),1>=e&&1>=n}function ru(t){return t.target.x0-t.source.x1}function ou(t,e){var n=au(t),r=ru(e)/Math.tan(n);return"up"==tu(t)?t.y1-r:t.y1+r}function iu(t,e){var n=au(t),r=ru(e)/Math.tan(n);return"up"==tu(t)?t.y1+r:t.y1-r}function au(t){var e=Math.abs(t.y1-t.y0);return Math.atan(Math.abs(t.target.x0-t.source.x1)/e)}function su(t,e){return e(t)}function lu(t){return uu(t.source)}function cu(t){return uu(t.target)}function uu(t){return(t.y0+t.y1)/2}function hu(t){return t.virtual?0:t.value}function du(t,e){var n=0;t.sourceLinks.forEach(function(t){n=t.circular&&!eu(t,e)?n+1:n});var r=0;return t.targetLinks.forEach(function(t){r=t.circular&&!eu(t,e)?r+1:r}),n+r}function fu(t){return t.target.depth}function yu(t,e){return t.sourceLinks.length?t.depth:e-1}function pu(t,e){return t.y0-e.y0}function gu(t,e){return e.y0-t.y0}function mu(t,e){return t.y1-e.y1}function xu(t,e){return e.y1-t.y1}function bu(t,e){return ku(t.source,e.source)||t.index-e.index}function vu(t,e){return ku(t.target,e.target)||t.index-e.index}function ku(t,e){return t.partOfCycle===e.partOfCycle?t.y0-e.y0:"top"===t.circularLinkType||"bottom"===e.circularLinkType?-1:1}function wu(t,e){return Au(t)==Au(e)?"bottom"==t.circularLinkType?gu(t,e):pu(t,e):Au(e)-Au(t)}function Au(t){return t.target.column-t.source.column}function Mu(t,e){return Su(t)==Su(e)}function Su(t){return t.y0-t.y1>0?"up":"down"}import{min as $u}from"d3-array";function Pu(t,e,n,r,o){let i=t;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(t){t.circular&&(t._circularWidth=Math.min(t.width,a))});var s=$u(i.links,function(t){return t.source.y0});i.links.forEach(function(t){t.circular&&(t.circularPathData={})});var l=i.links.filter(function(t){return t.circular});return l.sort(function(t,e){return e.value-t.value}),l.forEach(function(t,e){t._circularStub=e>=4}),Cu(i.links.filter(function(t){return"top"==t.circularLinkType}),e,n),Cu(i.links.filter(function(t){return"bottom"==t.circularLinkType}),e,n),i.links.forEach(function(t){if(t.circular){if(t.circularPathData.arcRadius=t._circularWidth+r,t.circularPathData.rightNodeBuffer=5,t.circularPathData.leftNodeBuffer=5,t.circularPathData.sourceWidth=t.source.x1-t.source.x0,t.circularPathData.sourceX=t.source.x0+t.circularPathData.sourceWidth,t.circularPathData.targetX=t.target.x0,t.circularPathData.sourceY=t.y0,t.circularPathData.targetY=t.y1,eu(t,e)&&nu(t))t.circularPathData.rightSmallArcRadius=r+t._circularWidth/2,t.circularPathData.rightLargeArcRadius=r+t._circularWidth/2,t.circularPathData.leftSmallArcRadius=r+t._circularWidth/2,t.circularPathData.leftLargeArcRadius=r+t._circularWidth/2,"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=t.source.y1+o+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=t.source.y0-o-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius);else{var a=t.source.column,l=t.circularLinkType,c=i.links.filter(function(t){return t.source.column==a&&t.circularLinkType==l});c.sort("bottom"==t.circularLinkType?gu:pu);var u=0;c.forEach(function(e,o){e.circularLinkID==t.circularLinkID&&(t.circularPathData.rightSmallArcRadius=r+t._circularWidth/2+u,t.circularPathData.rightLargeArcRadius=r+t._circularWidth/2+o*n+u),u+=e._circularWidth||e.width}),a=t.target.column,(c=i.links.filter(function(t){return t.target.column==a&&t.circularLinkType==l})).sort("bottom"==t.circularLinkType?xu:mu),u=0,c.forEach(function(e,o){e.circularLinkID==t.circularLinkID&&(t.circularPathData.leftSmallArcRadius=r+t._circularWidth/2+u,t.circularPathData.leftLargeArcRadius=r+t._circularWidth/2+o*n+u),u+=e._circularWidth||e.width}),"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=Math.max(i.y1,t.source.y1,t.target.y1)+o+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=s-o-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius)}t.circularPathData.rightInnerExtent=t.circularPathData.sourceX+t.circularPathData.rightNodeBuffer,t.circularPathData.leftInnerExtent=t.circularPathData.targetX-t.circularPathData.leftNodeBuffer,t.circularPathData.rightFullExtent=t.circularPathData.sourceX+t.circularPathData.rightLargeArcRadius+t.circularPathData.rightNodeBuffer,t.circularPathData.leftFullExtent=t.circularPathData.targetX-t.circularPathData.leftLargeArcRadius-t.circularPathData.leftNodeBuffer}t.path=t.circular?function(t){return"top"==t.circularLinkType?"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 0 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY-t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 0 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 0 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY-t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 0 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY:"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 1 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY+t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 1 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 1 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY+t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 1 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY}(t):function(t){var e=t.source.x1,n=t.y0,r=t.target.x0,o=t.y1,i=(e+r)/2;return"M"+e+","+n+"C"+i+","+n+" "+i+","+o+" "+r+","+o}(t)}),i}function Cu(t,e,n){t.sort(wu);var r=t.filter(function(t){return!t._circularStub});return t.forEach(function(t,o){var i=0;if(t._circularStub)t.circularPathData.verticalBuffer=0;else if(eu(t,e)&&nu(t))t.circularPathData.verticalBuffer=i+t._circularWidth/2;else{for(var a=0;r.length>a;a++){var s=r[a];if(s!==t&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&Lu(t,s)){var l=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+n;i=l>i?l:i}}t.circularPathData.verticalBuffer=i+t._circularWidth/2}}),t}function Lu(t,e){return t.source.column>=e.target.column&&e.source.column>=t.target.column}import{min as _u,max as Tu,sum as Du,mean as Ru,group as Wu,groups as Eu}from"d3-array";function Nu(t){return function(){return t}}function Iu(t){return t.index}function Ou(t){return t.nodes}function Fu(t){return t.links}function zu(t,e,n){var r=Eu(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});r.forEach(function(o,i){var a=o.length;if(e)o.sort(e);else if(i>0){var s=new Map;o.forEach(function(t,e){var n,r,o,i=(r=0,o=0,(n=t).targetLinks.forEach(function(t){if(!t.circular){var e=t.value||1;o+=uu(t.source)*e,r+=e}}),n.sourceLinks.forEach(function(t){if(!t.circular){var e=t.value||1;o+=uu(t.target)*e,r+=e}}),r>0?o/r:NaN);s.set(t,{bc:i,idx:e})}),o.sort(function(t,e){var n=s.get(t),r=s.get(e),o=n.bc,i=r.bc;if(t.circularLinkType!==e.circularLinkType){if("top"==t.circularLinkType&&"bottom"==e.circularLinkType)return-1;if("bottom"==t.circularLinkType&&"top"==e.circularLinkType)return 1;if("top"==t.circularLinkType)return-1;if("top"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return-1}return isNaN(o)||isNaN(i)?isNaN(o)?isNaN(i)?n.idx-r.idx:1:-1:o-i})}else o.sort(function(t,e){return t.circularLinkType==e.circularLinkType?du(e,n)-du(t,n):"top"==t.circularLinkType&&"bottom"==e.circularLinkType||"top"==t.circularLinkType&&0==e.partOfCycle||0==t.partOfCycle&&"bottom"==e.circularLinkType?-1:0});o.forEach(function(e,o){e.depth==r.length-1&&1==a||0==e.depth&&1==a?(e.y0=t.y1/2-e.value*t.ky,e.y1=e.y0+e.value*t.ky):e.partOfCycle?0==du(e,n)?(e.y0=t.y1/2+o,e.y1=e.y0+e.value*t.ky):"top"==e.circularLinkType?(e.y0=t.y0+o,e.y1=e.y0+e.value*t.ky):(e.y0=t.y1-e.value*t.ky-o,e.y1=e.y0+e.value*t.ky):0==t.y0||0==t.y1?(e.y0=(t.y1-t.y0)/a*o,e.y1=e.y0+e.value*t.ky):(e.y0=(t.y1-t.y0)/2-a/2+o,e.y1=e.y0+e.value*t.ky)})})}function Yu(t,e,n,r,o,i){var a=Eu(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});u();for(var s=1,l=i;l>0;--l)c(s*=.99,n),u();function c(e,n){var r=a.length;a.forEach(function(o){var i=o.length,a=o[0].depth;o.forEach(function(o){var s;if(o.sourceLinks.length||o.targetLinks.length)if(o.partOfCycle&&du(o,n)>0){var l=Ru(o.sourceLinks,cu),c=Ru(o.targetLinks,lu),u=l&&c?(l+c)/2:l||c;if(u){var h=(u-uu(o))*e*.3;o.y0+=h,o.y1+=h}}else if(0==a&&1==i)o.y0=t.y1/2-(s=o.y1-o.y0)/2,o.y1=t.y1/2+s/2;else if(a==r-1&&1==i)o.y0=t.y1/2-(s=o.y1-o.y0)/2,o.y1=t.y1/2+s/2;else if(1==o.targetLinks.length&&1==o.targetLinks[0].source.sourceLinks.length)s=o.y1-o.y0,o.y0=o.targetLinks[0].source.y0,o.y1=o.y0+s;else{var d=Ru(o.sourceLinks,cu),f=Ru(o.targetLinks,lu),y=((d&&f?(d+f)/2:d||f)-uu(o))*e;o.y0+=y,o.y1+=y}})})}function u(){a.forEach(function(n){var i,a,s,l=t.y0,c=n.length;for(n.sort(e||ku),s=0;c>s;++s)(a=l-(i=n[s]).y0)>0&&(i.y0+=a,i.y1+=a),l=i.y1+r;if((a=l-r-t.y1)>0)for(l=i.y0-=a,i.y1-=a,s=c-2;s>=0;--s)(a=(i=n[s]).y1+o-l)>0&&(i.y0-=a,i.y1-=a),l=i.y0})}}function Bu(t){t.nodes.forEach(function(t){t.sourceLinks.sort(vu),t.targetLinks.sort(bu)}),t.nodes.forEach(function(t){var e=t.y0,n=e,r=t.y1,o=r;t.sourceLinks.forEach(function(t){t.circular?(t.y0=r-t.width/2,r-=t.width):(t.y0=e+t.width/2,e+=t.width)}),t.targetLinks.forEach(function(t){t.circular?(t.y1=o-t.width/2,o-=t.width):(t.y1=n+t.width/2,n+=t.width)})})}function ju(){var t=0,e=0,n=1,r=1,o=24,i=8,a=null,s=Iu,l=yu,c=void 0,u=32,h=2,d=Ou,f=Fu;function y(){var y={nodes:d.apply(null,arguments),links:f.apply(null,arguments)};return function(d){d.x0=t,d.y0=e,d.x1=n,d.y1=r,d.py=0,function(t,e){t.nodes.forEach(function(t,e){t.index=e,t.sourceLinks=[],t.targetLinks=[]});var n=function(t,e){var n=new Map;return Wu(t,e).forEach(function(t,e){n.set(e,t[0])}),n}(t.nodes,e);t.links.forEach(function(t,e){t.index=e;var r=t.source,o=t.target;"object"!=typeof r&&(r=t.source=Jc(n,r)),"object"!=typeof o&&(o=t.target=Jc(n,o)),r.sourceLinks.push(t),o.targetLinks.push(t)})}(d,s),function(t,e){var n=0;if(null==e){for(var r=[],o=0;t.links.length>o;o++){var i=t.links[o],a=i.source.index,s=i.target.index;r[a]||(r[a]=[]),r[s]||(r[s]=[]),-1===r[a].indexOf(s)&&r[a].push(s)}var l=Qc(r);l.sort(function(t,e){return t.length-e.length});var c={};for(o=0;l.length>o;o++){var u=l[o].slice(-2);c[u[0]]||(c[u[0]]={}),c[u[0]][u[1]]=!0}t.links.forEach(function(t){var e=t.target.index,r=t.source.index;e===r||c[r]&&c[r][e]?(t.circular=!0,t.circularLinkID=n++):t.circular=!1})}else t.links.forEach(function(t){e(t.source)<e(t.target)?t.circular=!1:(t.circular=!0,t.circularLinkID=n++)})}(d,c),function(t,e){var n=0,r=0;t.links.forEach(function(o){o.circular&&(o.circularLinkType=o.source.circularLinkType||o.target.circularLinkType?o.source.circularLinkType?o.source.circularLinkType:o.target.circularLinkType:r>n?"top":"bottom","top"==o.circularLinkType?n++:r++,t.nodes.forEach(function(t){su(t,e)!=su(o.source,e)&&su(t,e)!=su(o.target,e)||(t.circularLinkType=o.circularLinkType)}))}),t.links.forEach(function(t){t.circular&&(t.source.circularLinkType==t.target.circularLinkType&&(t.circularLinkType=t.source.circularLinkType),eu(t,e)&&(t.circularLinkType=t.source.circularLinkType))})}(d,s),function(t){t.nodes.forEach(function(t){t.partOfCycle=!1,t.value=Math.max(Du(t.sourceLinks,hu),Du(t.targetLinks,hu)),t.sourceLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)}),t.targetLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)})})}(d),function(t,e,n){var r,o,i;if(null!=e){t.nodes.sort(function(t,n){return e(t)<e(n)?-1:1});var a=0,s=e(t.nodes[0]);t.nodes.forEach(function(t){a=e(t)==s?a:a+1,s=e(t)==s?s:e(t),t.column=a})}for(r=t.nodes,o=[],i=0;r.length;++i,r=o,o=[])r.forEach(function(t){t.depth=i,t.sourceLinks.forEach(function(t){0>o.indexOf(t.target)&&!t.circular&&o.push(t.target)})});for(r=t.nodes,o=[],i=0;r.length;++i,r=o,o=[])r.forEach(function(t){t.height=i,t.targetLinks.forEach(function(t){0>o.indexOf(t.source)&&!t.circular&&o.push(t.source)})});t.nodes.forEach(function(t){t.column=null==e?n(t,i):t.column})}(d,c,l);var f=i;if(null!==a){var y=Eu(d.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]}),p=Tu(y,function(t){return t.length});p>1&&(f=Math.max(1,(r-e)*a/(p-1)))}(function(t,e,n){var r=Eu(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});t.py=e;var o=_u(r,function(e){return(t.y1-t.y0-(e.length-1)*t.py)/Du(e,function(t){return t.value})});t.ky=o,t.links.forEach(function(e){e.width=e.value*t.ky});var i=Tu(t.nodes,function(t){return t.column});t.nodes.forEach(i>0?function(e){e.x0=t.x0+e.column*((t.x1-t.x0-n)/i),e.x1=e.x0+n}:function(e){e.x0=t.x0,e.x1=e.x0+n})})(d,f,o),zu(d,c,s),Yu(d,c,s,f,f,u),Bu(d),Pu(d,s,h,10,8),zu(d,c,s),Yu(d,c,s,f,f,u),Bu(d),Pu(d,s,h,10,8),function(t,e){let n=t;n.nodes.forEach(function(t){t.y+(t.y1-t.y0)>n.y1&&(t.y=t.y-(t.y+(t.y1-t.y0)-n.y1));var r=n.links.filter(function(n){return su(n.source,e)==su(t,e)}),o=r.length;o>1&&r.sort(function(t,e){if(!t.circular&&!e.circular){if(t.target.column==e.target.column)return t.y1-e.y1;if(!Mu(t,e))return t.y1-e.y1;if(t.target.column>e.target.column){var n=ou(e,t);return t.y1-n}if(e.target.column>t.target.column)return ou(t,e)-e.y1}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.target.column===e.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===e.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:"top"==t.circularLinkType?-1:1:void 0});var i=t.y0;r.forEach(function(t){t.y0=i+t.width/2,i+=t.width}),r.forEach(function(e,n){if("bottom"==e.circularLinkType){for(var i=n+1,a=0;o>i;i++)a+=r[i].width;e.y0=t.y1-a-e.width/2}})})}(d,s),function(t,e){let n=t;n.nodes.forEach(function(t){var r=n.links.filter(function(n){return su(n.target,e)==su(t,e)}),o=r.length;o>1&&r.sort(function(t,e){if(!t.circular&&!e.circular){if(t.source.column==e.source.column)return t.y0-e.y0;if(!Mu(t,e))return t.y0-e.y0;if(t.source.column>e.source.column){var n=iu(e,t);return t.y0-n}if(e.source.column>t.source.column)return iu(t,e)-e.y0}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:t.source.column-e.source.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:e.source.column-t.source.column:"top"==t.circularLinkType?-1:1:void 0});var i=t.y0;r.forEach(function(t){t.y1=i+t.width/2,i+=t.width}),r.forEach(function(e,n){if("bottom"==e.circularLinkType){for(var i=n+1,a=0;o>i;i++)a+=r[i].width;e.y1=t.y1-a-e.width/2}})})}(d,s),function(t){var e=t.nodes,n=t.links,r=!1,o=!1;if(n.forEach(function(t){"top"==t.circularLinkType?r=!0:"bottom"==t.circularLinkType&&(o=!0)}),0==r||0==o){let r=function(e){return(e-i)/(a-i)*(t.y1-t.y0)+t.y0};var i=_u(e,function(t){return t.y0}),a=Tu(e,function(t){return t.y1}),s=(t.y1-t.y0)/(a-i);1>s?(e.forEach(function(t){t.y0=r(t.y0),t.y1=r(t.y1)}),n.forEach(function(t){t.y0=r(t.y0),t.y1=r(t.y1),t.width=t.width*s})):e.forEach(function(t){var e=t.y1-t.y0,n=r(t.y0)-t.y0;t.y0=r(t.y0),t.y1=t.y0+e,t.sourceLinks.forEach(function(t){t.y0=t.y0+n}),t.targetLinks.forEach(function(t){t.y1=t.y1+n})})}}(d),Pu(d,s,h,10,8)}(y),y}return y.update=function(t){return Bu(t),Pu(t,s,h,10,8),t},y.nodeWidth=function(t){return arguments.length?(o=+t,y):o},y.nodePadding=function(t){return arguments.length?(i=+t,y):i},y.nodePaddingRatio=function(t){return arguments.length?(a=+t,y):a},y.nodes=function(t){return arguments.length?(d="function"==typeof t?t:Nu(t),y):d},y.links=function(t){return arguments.length?(f="function"==typeof t?t:Nu(t),y):f},y.nodeId=function(t){return arguments.length?(s="function"==typeof t?t:Nu(t),y):s},y.nodeAlign=function(t){return arguments.length?(l="function"==typeof t?t:Nu(t),y):l},y.nodeSort=function(t){return arguments.length?(c=t,y):c},y.iterations=function(t){return arguments.length?(u=+t,y):u},y.circularLinkGap=function(t){return arguments.length?(h=+t,y):h},y.extent=function(o){return arguments.length?(t=+o[0][0],e=+o[0][1],n=+o[1][0],r=+o[1][1],y):[[t,e],[n,r]]},y.size=function(o){return arguments.length?(t=e=0,n=+o[0],r=+o[1],y):[n-t,r-e]},y}import{interpolateNumber as Gu}from"d3-interpolate";import{line as Xu,curveLinearClosed as Hu}from"d3-shape";function Vu(t){const{sx:e,sTop:n,sBot:r,tx:o,tTop:i,tBot:a,cp1X:s,cp2X:l}=t,c=(n+r)/2,u=(i+a)/2;return{pathD:[`M${e},${n}`,`C${s},${n} ${l},${i} ${o},${i}`,`L${o},${a}`,`C${l},${a} ${s},${r} ${e},${r}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:e,y:c},{x:s,y:c},{x:l,y:u},{x:o,y:u}],halfWidth:(r-n)/2}}}var qu=t=>{let e,n,r,o,i,a,s,l,c;if("down"===t.direction)return e=t.y0-t.sankeyWidth/2,n=t.y1-t.sankeyWidth/2,r=t.y1+t.sankeyWidth/2,o=t.y0+t.sankeyWidth/2,i=t.source.x1,a=t.target.x0,s=Gu(i,a),l=s(.5),c=s(.5),`M${e},${i}C${e},${l} ${n},${c} ${n},${a}L${r},${a}C${r},${c} ${o},${l} ${o},${i}Z`;const u=t.sankeyWidth/2,h=Gu(t.source.x1,t.target.x0),{pathD:d}=Vu({sx:t.source.x1,sTop:t.y0-u,sBot:t.y0+u,tx:t.target.x0,tTop:t.y1-u,tBot:t.y1+u,cp1X:h(.5),cp2X:h(.5)});return d};function Uu(t){const e=t.sankeyWidth/2,n=(t._circularWidth??t.sankeyWidth)/2,r=t.circularPathData;if(!r)return null;if("down"===t.direction)return null;if(t._circularStub){const n=r.sourceX,o=r.sourceY,i=r.targetX,a=r.targetY;if("object"!=typeof t.source||!t.source||"object"!=typeof t.target||!t.target)return null;const s=Math.max(15,Math.min(40,.33*(r.rightFullExtent-n))),l=Math.max(15,Math.min(40,.33*(i-r.leftFullExtent)));return`M${n},${o-e}L${n+s},${o-e}L${n+s},${o+e}L${n},${o+e}ZM${i},${a-e}L${i-l},${a-e}L${i-l},${a+e}L${i},${a+e}Z`}const o=r.sourceX,i=r.sourceY,a=r.targetX,s=r.targetY,l=r.rightFullExtent,c=r.leftFullExtent,u=r.verticalFullExtent,h="bottom"===t.circularLinkType?1:-1,d=Math.max(4,Math.min(n,15));return`M${o},${i-h*e}L${l},${i-h*e}L${l+n},${i-h*e+h*d}L${l+n},${u+h*n-h*d}L${l+n-d},${u+h*n}L${c-n+d},${u+h*n}L${c-n},${u+h*n-h*d}L${c-n},${s-h*e+h*d}L${c-n+d},${s-h*e}L${a},${s-h*e}L${a},${s+h*e}L${c+n},${s+h*e}L${c+n},${u-h*n}L${l-n},${u-h*n}L${l-n},${i+h*e}L${o},${i+h*e}Z`}var Zu={left:function(t){return t.depth},right:function(t,e){return e-1-t.height},center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?Math.min.apply(Math,t.sourceLinks.map(fu))-1:0},justify:yu};function Ku(t){return"string"==typeof t?t:t.id}var Ju={supportsStreaming:!0,hierarchical:!1,computeLayout(t,e,n,r){if(0===t.length)return;const o="vertical"===n.orientation?"down":"right",i=n.nodeAlign||"justify",a=n.nodeWidth??15,s=n.nodePaddingRatio??.05,l=n.iterations??100,c=t.map(t=>({...t})),u=e.map(t=>({...t,source:"string"==typeof t.source?t.source:t.source.id,target:"string"==typeof t.target?t.target:t.target.id,value:Math.sqrt(Math.max(1,t.value||1))}));let h;h="down"===o?[[0,0],[r[1],r[0]]]:[[0,0],[r[0],r[1]]];const d=ju().extent(h).links(u).nodes(c).nodeAlign(Zu[i]||yu).nodeId(t=>t.id).nodeWidth(a).iterations(l);d.nodePaddingRatio&&d.nodePaddingRatio(s),d();{let t=1/0,e=-1/0,n=1/0,o=-1/0;for(const r of c)t>r.x0&&(t=r.x0),r.x1>e&&(e=r.x1),n>r.y0&&(n=r.y0),r.y1>o&&(o=r.y1);for(const r of u){if(!r.circular||!r.circularPathData)continue;const i=r.circularPathData,a=(r._circularWidth??r.width??0)/2;t>i.leftFullExtent-a&&(t=i.leftFullExtent-a),i.rightFullExtent+a>e&&(e=i.rightFullExtent+a),n>i.verticalFullExtent-a&&(n=i.verticalFullExtent-a),i.verticalFullExtent+a>o&&(o=i.verticalFullExtent+a)}const i=e-t,a=o-n,s=r[0],l=r[1];if(i>0&&a>0&&(0>t||0>n||e>s||o>l)){const e=Math.min(s/i,l/a),r=-t*e+(s-i*e)/2,o=-n*e+(l-a*e)/2;for(const t of c)t.x0=t.x0*e+r,t.x1=t.x1*e+r,t.y0=t.y0*e+o,t.y1=t.y1*e+o;for(const t of u)if(t.y0=t.y0*e+o,t.y1=t.y1*e+o,t.width=(t.width??0)*e,t._circularWidth&&(t._circularWidth*=e),t.circular&&t.circularPathData){const n=t.circularPathData;n.sourceX=n.sourceX*e+r,n.targetX=n.targetX*e+r,n.sourceY=n.sourceY*e+o,n.targetY=n.targetY*e+o,n.rightFullExtent=n.rightFullExtent*e+r,n.leftFullExtent=n.leftFullExtent*e+r,n.verticalFullExtent=n.verticalFullExtent*e+o,n.rightInnerExtent=n.rightInnerExtent*e+r,n.leftInnerExtent=n.leftInnerExtent*e+r,n.verticalRightInnerExtent=n.verticalRightInnerExtent*e+o,n.verticalLeftInnerExtent=n.verticalLeftInnerExtent*e+o,n.rightSmallArcRadius*=e,n.rightLargeArcRadius*=e,n.leftSmallArcRadius*=e,n.leftLargeArcRadius*=e,n.sourceWidth*=e,n.rightNodeBuffer*=e,n.leftNodeBuffer*=e,n.arcRadius*=e}}}const f=new Map;for(const e of t)f.set(e.id,e);for(const t of c){const e=f.get(t.id);e&&(e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.value=t.value,e.depth=t.depth,e.sourceLinks=t.sourceLinks,e.targetLinks=t.targetLinks,e.width=t.x1-t.x0,e.height=t.y1-t.y0,e.x=t.x0+(t.x1-t.x0)/2,e.y=t.y0+(t.y1-t.y0)/2)}const y=new Map;for(const t of e)y.set(t._edgeKey?t._edgeKey:`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,t);for(const t of u){const e=Ku(t.source),n=Ku(t.target),r=y.get(t._edgeKey?t._edgeKey:`${e}\0${n}`);if(r){r.y0=t.y0,r.y1=t.y1,r.sankeyWidth=t.width??0,r.circular=!!t.circular,r.circularPathData=t.circularPathData,r._circularWidth=t._circularWidth,r._circularStub=t._circularStub,r.path=t.path,r.circularLinkType=t.circularLinkType,r.direction=o;const i=f.get(e),a=f.get(n);i&&(r.source=i),a&&(r.target=a)}}},buildScene(t,e,n,r){const o="vertical"===n.orientation?"down":"right",i=n.nodeStyle,a=n.edgeStyle,s=n.edgeOpacity??.5,l=n.edgeColorBy||"source",c=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:F,u=new Map;t.forEach((t,e)=>{u.set(t.id,c[e%c.length])});const h=[],d=[],f=[],y=new Map;for(const e of t){const t=e.x1-e.x0,n=e.y1-e.y0;if(0>=t||0>=n)continue;const r=i?i(X(e,"nodeStyle")):{},a={fill:r.fill||u.get(e.id)||"#4d430c",stroke:r.stroke,strokeWidth:r.strokeWidth,opacity:r.opacity};y.set(e.id,("string"==typeof a.fill?a.fill:null)||u.get(e.id)||"#4d430c"),h.push("down"===o?{type:"rect",x:e.y0,y:e.x0,w:n,h:t,style:a,datum:e,id:e.id,label:e.id}:{type:"rect",x:e.x0,y:e.y0,w:t,h:n,style:a,datum:e,id:e.id,label:e.id})}const p=[...e].sort((t,e)=>(e.sankeyWidth||0)-(t.sankeyWidth||0));for(const t of p){if(!t.sankeyWidth||0>=t.sankeyWidth)continue;const e="object"==typeof t.source?t.source:null,r="object"==typeof t.target?t.target:null;if(!e||!r)continue;let o=n.themeSemantic?.border||n.themeSemantic?.secondary||"#999";o="function"==typeof l?l(t)||o:"target"===l?y.get(r.id)||u.get(r.id)||o:y.get(e.id)||u.get(e.id)||o;const i=a?a(X(t,"edgeStyle")):{};if(t._circularStub&&t.circular&&t.circularPathData){const e=t.circularPathData,n=t.sankeyWidth/2,r=Math.max(15,Math.min(40,.33*(e.rightFullExtent-e.sourceX))),a=Math.max(15,Math.min(40,.33*(e.targetX-e.leftFullExtent))),l=i.fill||o;d.push({type:"bezier",pathD:`M${e.sourceX},${e.sourceY-n}L${e.sourceX+r},${e.sourceY-n}L${e.sourceX+r},${e.sourceY+n}L${e.sourceX},${e.sourceY+n}Z`,style:{fill:l,fillOpacity:i.fillOpacity??s,stroke:"none",opacity:i.opacity},datum:t,_gradient:{direction:"right",from:1,to:0,x0:e.sourceX,x1:e.sourceX+r}}),d.push({type:"bezier",pathD:`M${e.targetX},${e.targetY-n}L${e.targetX-a},${e.targetY-n}L${e.targetX-a},${e.targetY+n}L${e.targetX},${e.targetY+n}Z`,style:{fill:l,fillOpacity:i.fillOpacity??s,stroke:"none",opacity:i.opacity},datum:t,_gradient:{direction:"left",from:0,to:1,x0:e.targetX-a,x1:e.targetX}});continue}let c;(c=t.circular&&t.circularPathData?Uu(t):qu(t),c)&&d.push({type:"bezier",pathD:c,bezierCache:t.bezier,style:{fill:i.fill||o,fillOpacity:i.fillOpacity??s,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity},datum:t})}if(!1!==n.showLabels){const e=(g=n.nodeLabel)?"function"==typeof g?g:t=>t[g]||t.id:null;for(const n of t){const t=n.x1-n.x0,i=n.y1-n.y0;if(0>=t||0>=i)continue;const a=e?e(n):n.id;if(!a)continue;let s,l,c;"down"===o?(s=n.y0+(n.y1-n.y0)/2,l=n.x1+14,c="start"):(r[0]/2>n.x0+t/2?(s=n.x0-6,c="end"):(s=n.x1+6,c="start"),l=n.y0+i/2),f.push({x:s,y:l,text:a+"",anchor:"down"===o?"middle":c,baseline:"middle",fontSize:11})}}var g;return{sceneNodes:h,sceneEdges:d,labels:f}}};import{chord as Qu,ribbon as th}from"d3-chord";import{arc as eh}from"d3-shape";var nh=F,rh={supportsStreaming:!1,hierarchical:!1,computeLayout(t,e,n,r){if(0===t.length)return;const{padAngle:o=.01,groupWidth:i=20,sortGroups:a}=n,s=Math.min(r[0],r[1])/2,l=s-i,c=r[0]/2,u=r[1]/2,h=(d=n.valueAccessor)?"function"==typeof d?d:t=>t[d]??1:t=>t.value??1;var d;const f=new Map;for(let e=0;t.length>e;e++)f.set(t[e].id,e);const y=t.length,p=Array.from({length:y},()=>Array.from({length:y},()=>0));for(const t of e){const e="string"==typeof t.target?t.target:t.target.id,n=f.get("string"==typeof t.source?t.source:t.source.id),r=f.get(e);if(void 0===n||void 0===r)continue;const o=h(t);p[n][r]=o}const g=Qu().padAngle(o);a&&g.sortGroups(a);const m=g(p),x=m.groups,b=eh().innerRadius(l).outerRadius(s);for(const e of x){const n=t[e.index],r=b.centroid({innerRadius:l,outerRadius:s,startAngle:e.startAngle,endAngle:e.endAngle});n.x=r[0]+c,n.y=r[1]+u,n.__arcData={startAngle:e.startAngle,endAngle:e.endAngle}}const v=new Map;for(const e of t)v.set(e.id,e);for(const t of e){const e="string"==typeof t.target?t.target:t.target.id,n=v.get("string"==typeof t.source?t.source:t.source.id),r=v.get(e);n&&(t.source=n),r&&(t.target=r)}const k=new Map;for(const t of e)k.set(`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}`,t);for(const e of m){const n=t[e.source.index].id,r=t[e.target.index].id,o=k.get(`${n}\0${r}`)||k.get(`${r}\0${n}`);o&&(o.__chordData=e)}},buildScene(t,e,n,r){const{groupWidth:o=20,edgeOpacity:i=.5}=n,a=Math.min(r[0],r[1])/2,s=a-o,l=r[0]/2,c=r[1]/2,u=n.nodeStyle,h=n.edgeStyle,d=n.edgeColorBy||"source",f=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:nh,y=new Map;t.forEach((t,e)=>{y.set(t.id,f[e%f.length])});const p=th().radius(s),g=[],m=[],x=[];for(let e=0;t.length>e;e++){const n=t[e],r=n.__arcData;if(!r)continue;let o;o=u?u(X(n,"nodeStyle")).fill||y.get(n.id)||f[e%f.length]:y.get(n.id)||f[e%f.length];const i=u?u(X(n,"nodeStyle")):{};g.push({type:"arc",cx:l,cy:c,innerR:s,outerR:a,startAngle:r.startAngle-Math.PI/2,endAngle:r.endAngle-Math.PI/2,style:{fill:o,stroke:i.stroke||"black",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:n,id:n.id,label:n.id})}for(const t of e){const e=t.__chordData;if(!e)continue;const r=p(e);if(!r)continue;const o=oh(r,l,c);let a=n.themeSemantic?.border||n.themeSemantic?.secondary||"#999";if(h)a=h(X(t,"edgeStyle")).fill||a;else{const e="object"==typeof t.source?t.source:null,n="object"==typeof t.target?t.target:null;"target"===d&&n?a=y.get(n.id)||a:e&&(a=y.get(e.id)||a)}const s=h?h(X(t,"edgeStyle")):{};m.push({type:"ribbon",pathD:o,style:{fill:a,fillOpacity:s.fillOpacity??i,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,opacity:s.opacity},datum:t})}if(!1!==n.showLabels){const e=(b=n.nodeLabel)?"function"==typeof b?b:t=>t[b]||t.id:null,r=a+12;for(const n of t){const t=n.__arcData;if(!t)continue;const o=e?e(n):n.id;if(!o)continue;const i=(t.startAngle+t.endAngle)/2,a=i-Math.PI/2;x.push({x:l+Math.cos(a)*r,y:c+Math.sin(a)*r,text:o+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}var b;return{sceneNodes:g,sceneEdges:m,labels:x}}};function oh(t,e,n){const r=t.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!r)return t;const o=[];let i=0;for(;r.length>i;){const t=r[i];if("M"===t||"L"===t)for(o.push(t),i++;r.length>i&&!isNaN(Number(r[i]));)o.push(Number(r[i])+e+""),i++,r.length>i&&!isNaN(Number(r[i]))&&(o.push(Number(r[i])+n+""),i++);else if("C"===t)for(o.push(t),i++;r.length>i&&!isNaN(Number(r[i]));)for(let t=0;3>t&&r.length>i&&!isNaN(Number(r[i]));t++)o.push(Number(r[i])+e+""),i++,r.length>i&&!isNaN(Number(r[i]))&&(o.push(Number(r[i])+n+""),i++);else if("Q"===t)for(o.push(t),i++;r.length>i&&!isNaN(Number(r[i]));)for(let t=0;2>t&&r.length>i&&!isNaN(Number(r[i]));t++)o.push(Number(r[i])+e+""),i++,r.length>i&&!isNaN(Number(r[i]))&&(o.push(Number(r[i])+n+""),i++);else if("A"===t)for(o.push(t),i++;r.length>i&&!isNaN(Number(r[i]));)o.push(r[i++]),r.length>i&&o.push(r[i++]),r.length>i&&o.push(r[i++]),r.length>i&&o.push(r[i++]),r.length>i&&o.push(r[i++]),r.length>i&&(o.push(Number(r[i])+e+""),i++),r.length>i&&(o.push(Number(r[i])+n+""),i++);else"Z"===t||"z"===t?(o.push(t),i++):(o.push(r[i]),i++)}return o.join(" ")}import{hierarchy as ih,tree as ah,cluster as sh,treemap as lh,pack as ch,partition as uh,treemapBinary as hh}from"d3-hierarchy";var dh=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function fh(t){const[e,n,r]=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*n+.114*r>150?"#222":"#fff"}function yh(t,e,n){const r=e.nodeIDAccessor;return"function"==typeof r?r(t.data)+"":"string"==typeof r&&void 0!==t.data[r]?t.data[r]+"":void 0!==t.data.name?t.data.name+"":void 0!==t.data.id?t.data.id+"":"node-"+n}function ph(t){if(!t)return null;if("function"==typeof t){const e=t;return t=>e(t.data??t)}return e=>e.data?.[t]||e[t]||e.id}function gh(t){return Array.isArray(t.colorScheme)?t.colorScheme:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical:dh}function mh(t){return Array.isArray(t.colorScheme)&&t.colorScheme.length>0?t.colorScheme[0]:t.themeSemantic?.primary?t.themeSemantic.primary:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical[0]:"#4d430c"}function xh(t,e,n,r,o){if("horizontal"===o){const o=(t+n)/2;return`M ${t},${e} C ${o},${e} ${o},${r} ${n},${r}`}if("radial"===o){const o=(t+n)/2;return`M ${t},${e} Q ${o},${e} ${o},${(e+r)/2} T ${n},${r}`}{const o=(e+r)/2;return`M ${t},${e} C ${t},${o} ${n},${o} ${n},${r}`}}var bh={supportsStreaming:!1,hierarchical:!0,computeLayout(t,e,n,r){const o=n.__hierarchyRoot;if(!o)return;const i=n.chartType,a=function(t){if(t)return"function"==typeof t?t:e=>e[t]}(n.childrenAccessor),s=n.hierarchySum,l="function"==typeof s?s:"string"==typeof s?t=>Number(t[s])||0:t=>Number(t.value)||0,c=ih(o,a);c.sum(l),c.sort((t,e)=>(e.value??0)-(t.value??0));const[u,h]=r;switch(i){case"tree":!function(t,e,n,r){const o=e.treeOrientation||"vertical",i=ah();i.size("horizontal"===o?[r,n]:"radial"===o?[2*Math.PI,Math.min(n,r)/2*.8]:[n,r]),i(t)}(c,n,u,h);break;case"cluster":!function(t,e,n,r){const o=e.treeOrientation||"vertical",i=sh();i.size("horizontal"===o?[r,n]:"radial"===o?[2*Math.PI,Math.min(n,r)/2*.8]:[n,r]),i(t)}(c,n,u,h);break;case"treemap":!function(t,e,n,r){const o=e.padding??4,i=e.paddingTop??0,a=lh().size([n,r]).tile(hh).padding(o);i>0&&a.paddingTop(i),a(t)}(c,n,u,h);break;case"circlepack":!function(t,e,n,r){const o=e.padding??4;ch().size([n,r]).padding(o)(t)}(c,n,u,h);break;case"partition":!function(t,e,n,r){uh().size([n,r]).padding(e.padding??1)(t)}(c,n,u,h)}const d=c.descendants();t.length=0,e.length=0;const f=new Map;for(let e=0;d.length>e;e++){const r=d[e],o={id:yh(r,n,e),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:r.value??0,depth:r.depth,data:r.data,createdByFrame:!0};"tree"===i||"cluster"===i?vh(o,r,n):"treemap"===i||"partition"===i?kh(o,r):"circlepack"===i&&wh(o,r),o.__hierarchyNode=r,t.push(o),f.set(r,o)}if("tree"===i||"cluster"===i)for(const t of d)if(t.parent){const n=f.get(t.parent),r=f.get(t);n&&r&&e.push({source:n,target:r,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:t.depth}})}},buildScene(t,e,n,r){const o=n.nodeStyle||(()=>({})),i=n.edgeStyle||(()=>({}));switch(n.chartType){case"tree":case"cluster":return function(t,e,n,r,o,i){const a=[],s=[],l=[],c=n.treeOrientation||"vertical",u="radial"===c,h=r[0]/2,d=r[1]/2,f="number"==typeof(y=n.nodeSize)?y:5;var y;for(const e of t){let t=e.x,r=e.y;u&&(t+=h,r+=d);const i=o(X(e,"nodeStyle"));let s=i.fill||mh(n);if(n.colorByDepth&&void 0!==e.depth){const t=gh(n);s=t[e.depth%t.length]}a.push({type:"circle",cx:t,cy:r,r:f,style:{fill:s,stroke:i.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:e,id:e.id,label:e.id,depth:e.depth})}const p=n.edgeOpacity??.5;for(const t of e){const e="object"==typeof t.source?t.source:null,r="object"==typeof t.target?t.target:null;if(!e||!r)continue;let o=e.x,a=e.y,l=r.x,f=r.y;u&&(o+=h,a+=d,l+=h,f+=d);const y=xh(o,a,l,f,c),g=i(X(t,"edgeStyle"));s.push({type:"curved",pathD:y,style:{fill:"none",stroke:g.stroke||n.themeSemantic?.border||n.themeSemantic?.secondary||"#999",strokeWidth:g.strokeWidth??1.5,opacity:g.opacity??p},datum:t})}if(!1!==n.showLabels){const e=ph(n.nodeLabel);for(const n of t){const t=e?e(n):n.id;if(!t)continue;let r,o,i,a=n.x,s=n.y;if(u&&(a+=h,s+=d),u){const t=a-h,e=s-d,n=Math.sqrt(t*t+e*e);n>0?(r=a+t/n*10,o=s+e/n*10,i=0>t?"end":"start"):(r=a,o=s-12,i="middle")}else"horizontal"===c?(n.data?.children&&0!==n.data.children.length?(r=a-f-6,i="end"):(r=a+f+6,i="start"),o=s):(r=a,o=s+f+14,i="middle");l.push({x:r,y:o,text:t+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:a,sceneEdges:s,labels:l}}(t,e,n,r,o,i);case"treemap":case"partition":return function(t,e,n,r){const o=[],i=[];for(const n of t){const t=n.x1-n.x0,i=n.y1-n.y0;if(0>=t||0>=i)continue;const a=r(X(n,"nodeStyle"));let s=a.fill||mh(e);if(e.colorByDepth&&void 0!==n.depth){const t=gh(e);s=t[n.depth%t.length]}o.push({type:"rect",x:n.x0,y:n.y0,w:t,h:i,style:{fill:s,stroke:a.stroke||e.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??1,opacity:a.opacity},datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==e.showLabels){const n=ph(e.nodeLabel),o=e.labelMode||"leaf",a="partition"===e.chartType;for(const s of t){const t=s.x1-s.x0,l=s.y1-s.y0;if(0>=t||0>=l)continue;const c=!(s.data?.children&&s.data.children.length>0);if(!a){if("leaf"===o&&!c)continue;if("parent"===o&&c)continue}const u=n?n(s):s.id;if(!u)continue;if((c?30:40)>t||(c?16:14)>l)continue;let h=r(X(s,"nodeStyle")).fill||mh(e);if(e.colorByDepth&&void 0!==s.depth){const t=gh(e);h=t[s.depth%t.length]}const d="string"==typeof h?fh(h):e.themeSemantic?.text??"#000";i.push(c?{x:s.x0+t/2,y:s.y0+l/2,text:u+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(t,l)/6)),fill:d}:{x:s.x0+4,y:s.y0+12,text:u+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:d})}}return{sceneNodes:o,sceneEdges:[],labels:i}}(t,n,0,o);case"circlepack":return function(t,e,n,r){const o=[],i=[];for(const n of t){const t=n.__radius??5;if(0>=t)continue;const i=r(X(n,"nodeStyle"));let a=i.fill||mh(e);if(e.colorByDepth&&void 0!==n.depth){const t=gh(e);a=t[n.depth%t.length]}o.push({type:"circle",cx:n.x,cy:n.y,r:t,style:{fill:a,stroke:i.stroke||e.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity??.7},datum:n,id:n.id,label:n.id,depth:n.depth})}if(!1!==e.showLabels){const n=ph(e.nodeLabel);for(const o of t){const t=o.__radius??5,a=n?n(o):o.id;if(!a)continue;if(15>t)continue;const s=!(o.data?.children&&o.data.children.length>0);let l=r(X(o,"nodeStyle")).fill||mh(e);if(e.colorByDepth&&void 0!==o.depth){const t=gh(e);l=t[o.depth%t.length]}if(s){const n="string"==typeof l?fh(l):e.themeSemantic?.text??"#000";i.push({x:o.x,y:o.y,text:a+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,t/3)),fill:n})}else i.push({x:o.x,y:o.y-t+14,text:a+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,t/3)),fill:e.themeSemantic?.text||"#000",stroke:e.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:o,sceneEdges:[],labels:i}}(t,n,0,o);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function vh(t,e,n){const r=n.treeOrientation||"vertical";if("radial"===r){const n=e.x,r=e.y;t.x=r*Math.cos(n-Math.PI/2),t.y=r*Math.sin(n-Math.PI/2)}else"horizontal"===r?(t.x=e.y,t.y=e.x):(t.x=e.x,t.y=e.y);t.x0=t.x-5,t.x1=t.x+5,t.y0=t.y-5,t.y1=t.y+5,t.width=10,t.height=10}function kh(t,e){t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.x=(e.x0+e.x1)/2,t.y=(e.y0+e.y1)/2,t.width=e.x1-e.x0,t.height=e.y1-e.y0}function wh(t,e){const n=e.r??0;t.x=e.x,t.y=e.y,t.x0=e.x-n,t.x1=e.x+n,t.y0=e.y-n,t.y1=e.y+n,t.width=2*n,t.height=2*n,t.__radius=n}import{pie as Ah}from"d3-shape";function Mh(t){let e=t.__orbitState;return e||(e={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},t.__orbitState=e),e}var Sh={sankey:Ju,force:L,chord:rh,tree:bh,cluster:bh,treemap:bh,circlepack:bh,partition:bh,orbit:{supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(t,e,n,r){const o=n.__hierarchyRoot;o&&function(t,e,n,r,o){const i=function(t){if("function"==typeof t)return t;const e=t||"children";return t=>t[e]||null}(n.childrenAccessor),a=function(t){if("function"==typeof t)return t;const e=t||"name";return t=>(t[e]??"")+""}(n.nodeIDAccessor),s=function(t){if(Array.isArray(t))return t;switch(t){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(n.orbitMode),l=n.orbitSize??2.95,c=n.orbitEccentricity??1,u="number"==typeof l?()=>l:l,h="number"==typeof c?()=>c:c,d=Mh(n);d.metaMap.clear(),r.length=0,o.length=0;const f=new Map;function y(t){const e=f.get(t)??0;return f.set(t,e+1),0===e?t:`${t}__${e}`}const p=e[0]/2,g=e[1]/2,m=Math.min(e[0],e[1])/2*.85,x=y(a(t));r.push({id:x,x:p,y:g,x0:p,x1:p,y0:g,y1:g,width:0,height:0,value:0,depth:0,data:t}),d.metaMap.set(x,{ring:m,angle:0,depth:0,parentId:null,eccentricity:1}),function t(e,n,l,c,f,p,g){const m=i(e);if(!m?.length)return;const x=m.length;let b=0,v=0,k=0;for(;x>v;)v+=s[Math.min(k,s.length-1)],k++,b++;let w=0;for(let x=0;b>x;x++){const v=s[Math.min(x,s.length-1)],k=m.slice(w,w+v);if(!k.length)break;const A=(x+1)/b,M={id:n,depth:p,data:e,parentId:n},S=g?f/u(M)*A:f*A,$=Ah().value(t=>{const e=i(t)?.length;return e?4:1}).sort(null)(k),P=h(M);for(let e=0;k.length>e;e++){const i=($[e].startAngle+$[e].endAngle)/2,s=k[e],u=y(a(s)),h=l+S*Math.sin(i),f=c+S*Math.cos(i)*P;r.push({id:u,x:h,y:f,x0:h,x1:h,y0:f,y1:f,width:0,height:0,value:0,depth:p,data:s}),d.metaMap.set(u,{ring:S,angle:i,depth:p,parentId:n,eccentricity:P}),o.push({source:n,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:n,target:u}}),t(s,u,h,f,S,p+1,!0)}w+=v}}(t,x,p,g,m,1,!1)}(o,r,n,t,e)},buildScene(t,e,n,r){const o=n.nodeStyle,i=n.nodeSize,a="number"==typeof i?()=>i:"function"==typeof i?i:()=>6,s=[],l=[],c=[];if(!1!==n.orbitShowRings){const e=Mh(n),r=new Map;for(const e of t)r.set(e.id,e);const o=new Map;for(const[,t]of e.metaMap){if(!t.parentId)continue;const e=r.get(t.parentId);if(!e)continue;const n=`${t.parentId}:${t.ring}`;o.has(n)||o.set(n,{parentX:e.x,parentY:e.y,ring:t.ring,ecc:t.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:t,parentY:e,ring:n,ecc:r}]of o)for(let o=0;i>o;o++){const s=o/i*Math.PI*2,c=(o+1)/i*Math.PI*2;l.push({type:"line",x1:t+n*Math.sin(s),y1:e+n*Math.cos(s)*r,x2:t+n*Math.sin(c),y2:e+n*Math.cos(c)*r,style:a,datum:null})}}for(const e of t){if(null==e.x||null==e.y)continue;const t=a(X(e,"nodeSize")),r=o?o(X(e,"nodeStyle")):{};s.push({type:"circle",cx:e.x,cy:e.y,r:t,style:{fill:r.fill||n.themeSemantic?.primary||"#6366f1",stroke:r.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:r.strokeWidth??1,opacity:r.opacity??(0===(e.depth??0)?1:.85)},datum:e,id:e.id,label:e.id,depth:e.depth})}const u=new Map;for(const e of t)u.set(e.id,e);for(const t of e){const e="object"==typeof t.source?t.source:u.get(t.source),n="object"==typeof t.target?t.target:u.get(t.target);e&&n&&(null!=e.x&&null!=n.x&&l.push({type:"line",x1:e.x,y1:e.y,x2:n.x,y2:n.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:t}))}if(n.showLabels){const e=n.nodeLabel;for(const n of t){const t=a(X(n,"nodeSize"));if(4>=t)continue;const r="function"==typeof e?e(n):e?n.data?.[e]??n.id:n.id;c.push({x:n.x,y:n.y+t+12,text:r+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:s,sceneEdges:l,labels:c}},tick:(t,e,n,r,o)=>!1!==n.orbitAnimated&&(function(t,e){const n=Mh(e),r=e.orbitSpeed??.25,o=e.orbitRevolution??function(t){switch(t){case"decay":return t=>Math.pow(.6,t.depth??0);case"alternate":return t=>{const e=t.depth??0;return(e%2==0?1:-1)/(e+1)};default:return t=>1/((t.depth??0)+1)}}(e.orbitRevolutionStyle),i=(("undefined"!=typeof performance?performance.now():Date.now())-n.startTime)/1e3,a=r*(Math.PI/6),s=new Map;for(const e of t)s.set(e.id,e);for(const e of t){const t=n.metaMap.get(e.id);if(!t||!t.parentId)continue;const r=s.get(t.parentId);if(!r)continue;const l=t.angle+i*a*o({id:e.id,depth:t.depth,data:e.data,parentId:t.parentId});e.x=r.x+t.ring*Math.sin(l),e.y=r.y+t.ring*Math.cos(l)*t.eccentricity,e.x0=e.x,e.x1=e.x,e.y0=e.y,e.y1=e.y}}(t,n),!0)}};function $h(t){return Sh[t]}function Ph(t,e,n){return Wt(t,e,n)}function Ch(t,e){const n=e&&"object"==typeof e&&!Array.isArray(e)?e:void 0;return 0===t.length?t=>n&&Ft(n,t)||"#4e79a7":e=>{if(n){const t=Ft(n,e);if(t)return t}let r=0;for(let t=0;e.length>t;t++)r=31*r+e.charCodeAt(t)|0;return t[Math.abs(r)%t.length]??"#4e79a7"}}export{Pt as filterSparseArray,Lt as toIdSet,Dt as DEFAULT_COLORS,Rt as DEFAULT_COLOR,Wt as resolveCategoricalPalette,Et as STREAMING_PALETTE,Nt as DEPTH_PALETTE_COLORS,Ot as getColor,Ft as resolveExplicitColor,zt as createColorScale,Yt as getSize,Bt as computeEasing,jt as computeRawProgress,Gt as lerp,Xt as now,at as resolveMotionAccessor,st as compileMotionEncoding,lt as opacityFromAge,ct as resolveMotionVector,ut as deriveMotionVector,Ht as computeDecayOpacity,Vt as buildDatumIndexMap,qt as computePulseIntensity,Ut as setPulseState,Zt as hasActivePulses,re as buildRectNode,ye as normalizeGradient,pe as normalizeColorGradient,ge as normalizeSemanticGradient,me as reverseGradient,we as warnCustomLayoutDiagnostics,Se as createCustomLayoutFailureDiagnostic,We as ensureRingBufferCapacity,Ee as createTimestampBufferForData,Ne as pushWithTimestamp,Ie as compactTimestampBufferForRemoval,Xe as attachUpdateResultStore,cn as PipelineStore,bn as useSceneRevisionDiagnostics,vn as runSceneBuild,kn as SceneRevisionDiagnosticsObserver,An as composeOverlays,$n as useConfigSync,Pn as useLayoutSelectionSync,Cn as findHitPointInQuadtree,Fn as resolveCanvasFill,cr as useStalenessCheck,hr as StalenessBadge,gr as composeLegendConfigs,mr as isLegendConfig,xr as isGradientLegendConfig,br as DEFAULT_LEGEND_ROW_HEIGHT,kr as resolveSideLegendWidth,wr as resolveLegendDistance,Ar as resolveLegendSideGutter,Mr as resolveAxisChromeGutter,$r as resolveSideLegendMargin,Pr as resolveLegendMetrics,Cr as layoutVerticalLegendGroups,Fr as renderLegendFromConfig,eo as SemioticAnnotation,xo as ANNOTATION_DISCLOSURE_REVEAL_CSS,$o as AnnotationLabel,_o as renderAnnotationPass,To as createDefaultAnnotationRules,jo as ticksForMode,Uo as TITLE_BASELINE,Zo as hasTextTitle,Jo as reserveTitleMargin,Si as networkSceneNodeToSVG,$i as networkSceneEdgeToSVG,Pi as networkLabelToSVG,Ti as geoSceneNodeToSVG,zi as ordinalSceneNodeToSVG,Gi as xySceneNodeToSVG,Xi as isServerEnvironment,Ji as useHydration,na as useWasHydratingFromSSR,oa as useStableShallow,ca as paintCanvasBackground,ua as needsDataCanvasPaint,va as AriaLiveTooltip,Ma as computeNetworkAriaLabel,Fa as NetworkAccessibleDataTable,za as ScreenReaderSummary,Ya as SkipToTableLink,Ga as FocusRing,Va as FlippingTooltip,as as useFrame,us as useFrameCanvasHost,hs as CanvasFrameBackground,fs as prepareCanvas,ys as getDevicePixelRatio,$s as renderRectPulse,Ps as renderCirclePulse,Fs as networkGlyphRenderer,Js as paintSceneWithBackend,Qs as renderSceneWithBackend,tl as renderSceneListWithBackend,rl as formatVal,ll as observationInputType,cl as isInteractiveKeyboardTarget,ul as emitHoverObservations,hl as emitClickObservations,pl as buildNavGraph,gl as resolvePosition,vl as extractNetworkNavPoints,kl as nextNetworkIndex,Ll as StreamXYFrame_default,Vu as buildRibbonGeometry,$h as getLayoutPlugin,Ph as resolveCustomLayoutPalette,Ch as buildResolveColor,Il as SafeRender,zl as renderEmptyState,Yl as renderLoadingState,Mc as useCategoryColors,Bl as normalizeLinkedBrush,Ql as useBrushSelection,nc as resolveMobileInteraction,oc as isChartMode,ic as resolveChartMode,_c as useChartLegendAndMargin,Tc as useLegendInteraction,Bc as useThemeCategorical,jc as resolveDefaultFill,Gc as useColorScale,Xc as useChartSelection,Hc as getCrosshairProps,Vc as useChartMode,qc as buildBaseMetadataProps,Uc as buildCustomBehaviorProps,Kc as resolveDownwardHistogramExtent};
|