semiotic 3.8.6 → 3.8.8
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 +34 -8
- package/README.md +93 -56
- package/ai/behaviorContracts.cjs +86 -1
- package/ai/componentMetadata.cjs +4 -9
- package/ai/dist/mcp-server.js +125 -12
- package/ai/examples.md +154 -7
- package/ai/schema.json +1742 -156
- package/ai/surface-manifest.json +12 -10
- package/ai/system-prompt.md +9 -3
- package/dist/{chunk-chartContainerDataAudit-FEOD5GTQ.module.min.js → chunk-chartContainerDataAudit-IQ3NBN3Q.module.min.js} +1 -1
- package/dist/chunk-chunk-2B3AIKUZ.module.min.js +2 -0
- package/dist/chunk-chunk-2NVFEB7P.module.min.js +2 -0
- package/dist/chunk-chunk-3GCILWPB.module.min.js +2 -0
- package/dist/chunk-chunk-46KRGJQP.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-4MLLQUGW.module.min.js +2 -0
- package/dist/chunk-chunk-57RBPDBQ.module.min.js +2 -0
- package/dist/chunk-chunk-5VVNW5AZ.module.min.js +1 -0
- package/dist/chunk-chunk-66PCWJUG.module.min.js +1 -0
- package/dist/chunk-chunk-6V5VQVCT.module.min.js +2 -0
- package/dist/chunk-chunk-7LE56WAE.module.min.js +2 -0
- package/dist/chunk-chunk-7T25U75Z.module.min.js +2 -0
- package/dist/chunk-chunk-AF53TBSN.module.min.js +2 -0
- package/dist/chunk-chunk-BTZYH2IE.module.min.js +1 -0
- package/dist/chunk-chunk-BWV55BZK.module.min.js +2 -0
- package/dist/chunk-chunk-BZNOAHJV.module.min.js +2 -0
- package/dist/chunk-chunk-CD6PVVS3.module.min.js +2 -0
- package/dist/chunk-chunk-DTSNLGRK.module.min.js +2 -0
- package/dist/chunk-chunk-FC3NZWYR.module.min.js +2 -0
- package/dist/chunk-chunk-FEPXDKJP.module.min.js +1 -0
- package/dist/chunk-chunk-FJ76HWQZ.module.min.js +1 -0
- package/dist/chunk-chunk-FQPKOAIH.module.min.js +2 -0
- package/dist/chunk-chunk-FRGBMTZR.module.min.js +1 -0
- package/dist/chunk-chunk-G75OPF5N.module.min.js +2 -0
- package/dist/chunk-chunk-H5IFO6CU.module.min.js +2 -0
- package/dist/chunk-chunk-HADHLMY5.module.min.js +1 -0
- package/dist/chunk-chunk-HBFA4NN6.module.min.js +1 -0
- package/dist/chunk-chunk-HCNDE26Q.module.min.js +2 -0
- package/dist/chunk-chunk-J5QD4RAM.module.min.js +2 -0
- package/dist/chunk-chunk-JJ4BSUYL.module.min.js +2 -0
- package/dist/chunk-chunk-JRHXQGEV.module.min.js +2 -0
- package/dist/chunk-chunk-L6FFYGYS.module.min.js +1 -0
- package/dist/chunk-chunk-LJDH3WV3.module.min.js +2 -0
- package/dist/chunk-chunk-LSJUXBMF.module.min.js +1 -0
- package/dist/chunk-chunk-N3Q33XCB.module.min.js +2 -0
- package/dist/chunk-chunk-NWIGA3UK.module.min.js +1 -0
- package/dist/chunk-chunk-OG3TTJGJ.module.min.js +2 -0
- package/dist/{chunk-chunk-XEVJDUTH.module.min.js → chunk-chunk-OZK46A5U.module.min.js} +1 -1
- package/dist/chunk-chunk-PMR47KRY.module.min.js +2 -0
- package/dist/chunk-chunk-QQJNG23C.module.min.js +2 -0
- package/dist/chunk-chunk-RGJ6TKAH.module.min.js +2 -0
- package/dist/{chunk-chunk-RA7JCG7D.module.min.js → chunk-chunk-SFLUSZ73.module.min.js} +1 -1
- package/dist/chunk-chunk-SV4XAZ3Q.module.min.js +1 -0
- package/dist/chunk-chunk-TCMHJWFJ.module.min.js +1 -0
- package/dist/chunk-chunk-TSCFL235.module.min.js +1 -0
- package/dist/{chunk-chunk-XP3OHHFX.module.min.js → chunk-chunk-UEZ6SHW5.module.min.js} +1 -1
- package/dist/chunk-chunk-UOQRPGPK.module.min.js +2 -0
- package/dist/chunk-chunk-VUWYT7DY.module.min.js +2 -0
- package/dist/{chunk-chunk-GFTVACTO.module.min.js → chunk-chunk-W5HWGQMD.module.min.js} +1 -1
- package/dist/chunk-chunk-WFHZHWT7.module.min.js +1 -0
- package/dist/chunk-chunk-WGROBM3I.module.min.js +2 -0
- package/dist/chunk-chunk-WSDJFBKX.module.min.js +2 -0
- package/dist/chunk-statisticalOverlays-HMYYSGPE.module.min.js +2 -0
- package/dist/components/ai/SemioticVACPBridge.d.ts +22 -0
- package/dist/components/ai/chartCapabilities.d.ts +4 -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/index.d.ts +6 -6
- package/dist/components/charts/network/ProcessSankey.d.ts +105 -74
- package/dist/components/charts/network/processSankey/accessors.d.ts +7 -0
- package/dist/components/charts/network/processSankey/algorithm.d.ts +14 -193
- package/dist/components/charts/network/processSankey/axisChrome.d.ts +31 -0
- package/dist/components/charts/network/processSankey/bandPaths.d.ts +45 -0
- package/dist/components/charts/network/processSankey/buildScenes.d.ts +41 -3
- package/dist/components/charts/network/processSankey/fixtures.d.ts +17 -0
- package/dist/components/charts/network/processSankey/frameMargins.d.ts +11 -0
- package/dist/components/charts/network/processSankey/groupBonding.d.ts +13 -0
- package/dist/components/charts/network/processSankey/inventoryAtTime.d.ts +41 -0
- package/dist/components/charts/network/processSankey/labelPlacement.d.ts +34 -0
- package/dist/components/charts/network/processSankey/layoutGeometry.d.ts +47 -0
- package/dist/components/charts/network/processSankey/layoutOrchestrator.d.ts +44 -0
- package/dist/components/charts/network/processSankey/layoutQualityProduct.d.ts +27 -0
- package/dist/components/charts/network/processSankey/massSimulation.d.ts +16 -0
- package/dist/components/charts/network/processSankey/ordering.d.ts +55 -0
- package/dist/components/charts/network/processSankey/orderingBond.d.ts +33 -0
- package/dist/components/charts/network/processSankey/orientation.d.ts +5 -0
- package/dist/components/charts/network/processSankey/packing.d.ts +8 -0
- package/dist/components/charts/network/processSankey/packingCache.d.ts +23 -0
- package/dist/components/charts/network/processSankey/processSankeyLayoutAsync.d.ts +27 -0
- package/dist/components/charts/network/processSankey/processSankeyLayoutWorkerClient.d.ts +72 -0
- package/dist/components/charts/network/processSankey/processSankeyTooltip.d.ts +26 -0
- package/dist/components/charts/network/processSankey/processSankeyTypes.d.ts +163 -0
- package/dist/components/charts/network/processSankey/ribbonInputs.d.ts +26 -2
- package/dist/components/charts/network/processSankey/ribbonRunway.d.ts +45 -0
- package/dist/components/charts/network/processSankey/streamingLayout.d.ts +23 -0
- package/dist/components/charts/network/processSankey/time.d.ts +11 -0
- package/dist/components/charts/network/processSankey/useProcessSankeyPush.d.ts +29 -0
- package/dist/components/charts/network/processSankey/useProcessSankeyScenes.d.ts +26 -0
- package/dist/components/charts/network/processSankey/validation.d.ts +33 -0
- 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/chartFamilySets.d.ts +1 -0
- package/dist/components/charts/shared/formatUtils.d.ts +12 -1
- package/dist/components/charts/shared/hatchFill.d.ts +2 -0
- package/dist/components/charts/shared/hooks.d.ts +1 -1
- package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
- package/dist/components/charts/shared/leastSquaresRegression.d.ts +31 -0
- package/dist/components/charts/shared/styleRules.d.ts +5 -1
- package/dist/components/charts/shared/useChartLegend.d.ts +14 -1
- package/dist/components/charts/shared/useChartSetup.d.ts +8 -1
- package/dist/components/charts/shared/validateProps.d.ts +2 -2
- package/dist/components/charts/shared/withChartWrapper.d.ts +0 -6
- package/dist/components/data/numericFieldProfiler.d.ts +2 -0
- package/dist/components/data/portability/capabilityBinding.d.ts +41 -0
- package/dist/components/data/portability/index.d.ts +2 -0
- package/dist/components/legendLayout.d.ts +56 -0
- package/dist/components/recipes/geographicDotGrid.d.ts +82 -0
- package/dist/components/recipes/geographicGrid.d.ts +100 -0
- package/dist/components/recipes/layout1d.d.ts +68 -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 +4 -3
- 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 +4 -0
- package/dist/components/semiotic-network.d.ts +2 -2
- package/dist/components/semiotic-physics.d.ts +9 -6
- package/dist/components/semiotic-recipes-core.d.ts +8 -1
- package/dist/components/semiotic.d.ts +2 -0
- 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 +2 -2
- package/dist/components/server/serverChartConfigsPhysics.d.ts +2 -2
- package/dist/components/server/serverChartConfigsXY.d.ts +0 -1
- package/dist/components/server/staticLegend.d.ts +6 -0
- package/dist/components/server/staticSVGChrome.d.ts +12 -3
- package/dist/components/server/staticValue.d.ts +8 -0
- package/dist/components/store/createStore.d.ts +2 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +3 -0
- package/dist/components/stream/PipelineStore.d.ts +5 -0
- package/dist/components/stream/accessorUtils.d.ts +21 -0
- package/dist/components/stream/frameKeyboardNavigation.d.ts +3 -2
- package/dist/components/stream/geoPipelineConfig.d.ts +10 -0
- package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +3 -8
- package/dist/components/stream/layouts/index.d.ts +1 -1
- package/dist/components/stream/legendRenderer.d.ts +8 -0
- package/dist/components/stream/moduleWorkerSession.d.ts +67 -0
- package/dist/components/stream/networkTypes.d.ts +2 -0
- package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +2 -1
- package/dist/components/stream/physics/PhysicsEvidence.d.ts +37 -0
- package/dist/components/stream/physics/PhysicsKernel.d.ts +9 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +9 -0
- package/dist/components/stream/physics/PhysicsSettledScene.d.ts +5 -0
- 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/pipelineIntroCancellation.d.ts +6 -0
- package/dist/components/stream/pipelineTransitions.d.ts +15 -1
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +16 -4
- package/dist/components/stream/renderers/symbolCanvasRenderer.d.ts +4 -0
- package/dist/components/stream/symbolPath.d.ts +8 -0
- package/dist/components/stream/types.d.ts +4 -0
- package/dist/components/stream/useCanvasFrameHost.d.ts +6 -0
- package/dist/components/stream/useSemanticFrameInteractions.d.ts +12 -3
- package/dist/components/stream/xyFrameAxisTypes.d.ts +4 -0
- package/dist/components/types/legendTypes.d.ts +17 -1
- package/dist/controls.min.js +1 -1
- package/dist/controls.module.min.js +1 -1
- package/dist/forceLayoutWorker.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/processSankeyLayoutWorker.js +1 -0
- 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 +4 -3
- 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 +4 -0
- package/dist/semiotic-network.d.ts +2 -2
- package/dist/semiotic-physics.d.ts +9 -6
- 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 +8 -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.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-themes-core.module.min.js +1 -1
- package/dist/semiotic-themes-react.module.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +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-react.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-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic.d.ts +2 -0
- 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 +21 -4
- 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-2CHN2TA3.module.min.js +0 -1
- package/dist/chunk-chunk-3NGIKFD6.module.min.js +0 -1
- package/dist/chunk-chunk-3SHB24AG.module.min.js +0 -1
- package/dist/chunk-chunk-4MMOOYTX.module.min.js +0 -2
- package/dist/chunk-chunk-5RKXZQ2P.module.min.js +0 -1
- package/dist/chunk-chunk-75OTQSXS.module.min.js +0 -1
- package/dist/chunk-chunk-7ALTGHK6.module.min.js +0 -1
- package/dist/chunk-chunk-A5GRQUOF.module.min.js +0 -1
- package/dist/chunk-chunk-AAF5LZAU.module.min.js +0 -2
- package/dist/chunk-chunk-ARZGA4LJ.module.min.js +0 -2
- package/dist/chunk-chunk-C4YA6TDR.module.min.js +0 -1
- package/dist/chunk-chunk-CAFLML4L.module.min.js +0 -2
- package/dist/chunk-chunk-CO5KQMGH.module.min.js +0 -1
- package/dist/chunk-chunk-DSNGDNJY.module.min.js +0 -1
- package/dist/chunk-chunk-FHBN7OEB.module.min.js +0 -2
- package/dist/chunk-chunk-GMQ5AYTD.module.min.js +0 -1
- package/dist/chunk-chunk-IP2UE74X.module.min.js +0 -1
- package/dist/chunk-chunk-ITDWLZXV.module.min.js +0 -2
- package/dist/chunk-chunk-JCG72SGW.module.min.js +0 -2
- package/dist/chunk-chunk-LPSPATPC.module.min.js +0 -1
- package/dist/chunk-chunk-OM6NWS4H.module.min.js +0 -2
- package/dist/chunk-chunk-PRDGLMJT.module.min.js +0 -2
- package/dist/chunk-chunk-PX5YQGDP.module.min.js +0 -2
- package/dist/chunk-chunk-Q2BS46W2.module.min.js +0 -2
- package/dist/chunk-chunk-QSQVBIJA.module.min.js +0 -1
- package/dist/chunk-chunk-RCF52Z42.module.min.js +0 -2
- package/dist/chunk-chunk-RNUHEXZA.module.min.js +0 -2
- package/dist/chunk-chunk-ROZWKEUG.module.min.js +0 -1
- package/dist/chunk-chunk-SMVD3EQJ.module.min.js +0 -2
- package/dist/chunk-chunk-T2FKJD4O.module.min.js +0 -2
- package/dist/chunk-chunk-UDREYOLV.module.min.js +0 -1
- package/dist/chunk-chunk-VOWE3SAP.module.min.js +0 -2
- package/dist/chunk-chunk-VQPNBUSW.module.min.js +0 -2
- package/dist/chunk-chunk-WAWCIHFJ.module.min.js +0 -1
- package/dist/chunk-chunk-WCX6U47H.module.min.js +0 -2
- package/dist/chunk-chunk-WYARAXHR.module.min.js +0 -2
- package/dist/chunk-chunk-XV3KGYTR.module.min.js +0 -2
- package/dist/chunk-chunk-YC2IVEPX.module.min.js +0 -1
- package/dist/chunk-chunk-ZOAQDIJO.module.min.js +0 -1
- package/dist/chunk-chunk-ZXIXAPRE.module.min.js +0 -2
- package/dist/chunk-statisticalOverlays-6MVAK5RW.module.min.js +0 -2
- package/dist/components/stream/renderers/networkSymbolRenderer.d.ts +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{createControlObservationAdapter as e}from"./chunk-chunk-
|
|
2
|
+
import{createControlObservationAdapter as e}from"./chunk-chunk-FQPKOAIH.module.min.js";import{useRef as t}from"react";var r=2*Math.PI;function n(e,t,r){const n=r?.center?.x??0,a=r?.center?.y??0;return{x:n+Math.sin(e)*t,y:a-Math.cos(e)*t}}function a(e,t,a,i,l){const c=l?.center,s=(e,t)=>{const{x:r,y:a}=n(e,t,{center:c});return`${o(r)},${o(a)}`},u=Math.max(0,a),d=Math.max(u,i),p=Math.abs(t-e),m=e>t?0:1;if(p>=r-1e-6){const e=c?.x??0,t=c?.y??0,r=`${o(e)},${o(t-d)}`,n=`${o(e)},${o(t+d)}`;let a=`M${r} A${o(d)},${o(d)} 0 1 1 ${n} A${o(d)},${o(d)} 0 1 1 ${r} Z`;if(u>0){const r=`${o(e)},${o(t-u)}`,n=`${o(e)},${o(t+u)}`;a+=` M${r} A${o(u)},${o(u)} 0 1 0 ${n} A${o(u)},${o(u)} 0 1 0 ${r} Z`}return a}const h=p>Math.PI?1:0,f=s(e,d),$=s(t,d);if(0>=u){const e=c?.x??0,t=c?.y??0;return`M${o(e)},${o(t)} L${f} A${o(d)},${o(d)} 0 ${h} ${m} ${$} Z`}const y=s(t,u),x=s(e,u);return`M${f} A${o(d)},${o(d)} 0 ${h} ${m} ${$} L${y} A${o(u)},${o(u)} 0 ${h} ${1===m?0:1} ${x} Z`}function o(e){return Math.round(1e3*e)/1e3}function i(e,t,r=0){return t>0?((e-r)%t+t)%t+r:e}import{jsx as l,jsxs as c}from"react/jsx-runtime";function s({value:e,onChange:o,period:s=365,radius:u=180,innerRadius:d=14,width:p,height:m,step:h=1,largeStep:f=7,label:$="Range",formatValue:y,arcFill:x="var(--semiotic-primary, #4e79a7)",stroke:g="var(--semiotic-bg, #ffffff)",className:v,style:b}){const w=p??2*u+40,k=m??2*u+40,P=w/2,M=k/2,I=function(e){const[t,n]=e,a=n-t||1,o=r;return e=>0+(e-t)/a*(o-0)}([0,s]),A=t(null),C=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget,n=t.getBoundingClientRect(),a=t.viewBox?.baseVal;return Math.round((Math.atan2((a?.width||w)/(n.width||1)*(e.clientX-n.left)-P-0,-((a?.height||k)/(n.height||1)*(e.clientY-n.top)-M-0))+r)%r/r*s)%s},D=(e,t)=>{e.preventDefault(),e.stopPropagation();const r=e.currentTarget.ownerSVGElement;r?.setPointerCapture?.(e.pointerId),A.current={mode:t,lastValue:C(e)}},T=e=>{const t=e.currentTarget.ownerSVGElement??e.currentTarget;t?.hasPointerCapture?.(e.pointerId)&&t.releasePointerCapture(e.pointerId),A.current=null},N=(e,t)=>{o("range"===e?e=>({start:i(e.start+t,s),end:i(e.end+t,s)}):r=>({...r,[e]:i(r[e]+t,s)}))},V=e=>t=>{const r=t.shiftKey?f:h;"ArrowRight"===t.key||"ArrowUp"===t.key?(t.preventDefault(),N(e,r)):"ArrowLeft"!==t.key&&"ArrowDown"!==t.key||(t.preventDefault(),N(e,-r))},j=e.start>e.end?[[e.start,s],[0,e.end]]:[[e.start,e.end]],E=e=>y?y(e):e+"";return l("svg",{viewBox:`0 0 ${w} ${k}`,width:w,height:k,className:v,onPointerMove:e=>{const t=A.current;if(!t)return;const r=C(e);if("range"===t.mode){const e=function(e,t,r){if(0>=r)return t-e;let n=(t-e)%r;return n>r/2?n-=r:-r/2>n&&(n+=r),n}(t.lastValue,r,s);if(0===e)return;return t.lastValue=r,void o(t=>({start:i(t.start+e,s),end:i(t.end+e,s)}))}o(e=>({...e,[t.mode]:r}))},onPointerUp:T,onPointerCancel:T,onLostPointerCapture:T,style:{touchAction:"none",...b},"aria-label":$+" brush",children:c("g",{transform:`translate(${P},${M})`,children:[l("g",{role:"slider",tabIndex:0,"aria-label":$+" (move both ends)","aria-valuemin":0,"aria-valuemax":s-1,"aria-valuenow":e.start,"aria-valuetext":`${E(e.start)} to ${E(e.end)}`,onPointerDown:e=>D(e,"range"),onKeyDown:V("range"),style:{cursor:"grab"},children:j.map(([e,t],r)=>l("path",{d:a(I(e),I(t),d,u),fill:x,fillOpacity:.35,stroke:g,strokeWidth:1},r))}),["start","end"].map(t=>{const r=e[t],a=(e=>n(I(e),d))(r),o=(e=>n(I(e),u+8))(r);return c("g",{role:"slider",tabIndex:0,"aria-label":`${$} ${t}`,"aria-valuemin":0,"aria-valuemax":s-1,"aria-valuenow":r,"aria-valuetext":E(r),onPointerDown:e=>D(e,t),onKeyDown:V(t),style:{cursor:"grab"},children:[l("line",{x1:a.x,y1:a.y,x2:o.x,y2:o.y,stroke:"transparent",strokeWidth:20}),l("line",{x1:a.x,y1:a.y,x2:o.x,y2:o.y,stroke:g,strokeWidth:1.5}),l("circle",{cx:o.x,cy:o.y,r:4.5,fill:g,stroke:x,strokeWidth:1})]},t)})]})})}import*as u from"react";import{useRef as d}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";function h(e,t,r,n){return Math.min(r,Math.max(t,Number((t+Math.round((Math.min(r,Math.max(t,e))-t)/n)*n).toFixed(12))))}function f({value:t,onChange:r,pointerToValue:n,min:a,max:o,step:i=1,largeStep:l=5*i,x:c,y:s,controlType:f="value",controlId:$,label:y,valueText:x,radius:g=12,fill:v="var(--semiotic-bg, #ffffff)",stroke:b="var(--semiotic-primary, #4e79a7)",strokeWidth:w=4,labelText:k,labelDx:P=16,labelDy:M=-16,labelClassName:I,className:A,disabled:C=!1,onChangeStart:D,onChangeEnd:T,onObservation:N,chartId:V,chartType:j}){const E=d(null),K=d(t);K.current=t;const L=u.useMemo(()=>e({controlType:f,controlId:$,chartId:V,chartType:j,onObservation:N}),[V,j,$,f,N]),R=e=>{if(C)return;const t=n(e);if(null==t||!Number.isFinite(t))return;const l=h(t,a,o,i);K.current=l,r(l),L("control-change",l,"pointer")},S=e=>{e.stopPropagation(),E.current===e.pointerId&&(e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture?.(e.pointerId),E.current=null,T?.(K.current),L("control-end",K.current,"pointer"))},W=["semiotic-direct-manipulation-control",A].filter(Boolean).join(" ");return m("g",{className:W,role:"slider",tabIndex:C?-1:0,"aria-disabled":C||void 0,"aria-label":y,"aria-valuemin":a,"aria-valuemax":o,"aria-valuenow":t,"aria-valuetext":x??`${y}: ${t}`,"aria-roledescription":"visualization control","data-viz-control":f,"data-viz-control-id":$,"data-viz-control-state":"controlled",pointerEvents:"all",onPointerDown:e=>{C||(e.preventDefault(),e.stopPropagation(),e.currentTarget.setPointerCapture?.(e.pointerId),E.current=e.pointerId,D?.(K.current),L("control-start",K.current,"pointer"),R(e))},onPointerMove:e=>{e.stopPropagation(),E.current===e.pointerId&&R(e)},onPointerUp:S,onPointerCancel:S,onLostPointerCapture:S,onKeyDown:e=>{if(C)return;const t=e.shiftKey?l:i,n=K.current;let c=null;if("ArrowLeft"!==e.key&&"ArrowDown"!==e.key||(c=n-t),"ArrowRight"!==e.key&&"ArrowUp"!==e.key||(c=n+t),"Home"===e.key&&(c=a),"End"===e.key&&(c=o),null===c)return;e.preventDefault();const s=h(c,a,o,i);K.current=s,r(s),L("control-change",s,"keyboard")},style:{cursor:C?"default":"grab",touchAction:"none"},children:[p("circle",{className:"semiotic-direct-manipulation-control__hit",cx:c,cy:s,r:g+10,fill:"transparent"}),p("circle",{className:"semiotic-direct-manipulation-control__handle",cx:c,cy:s,r:g,fill:v,stroke:b,strokeWidth:w}),k?p("text",{className:I,x:c+P,y:s+M,fill:b,children:k}):null]})}export{s as CircularBrush,f as DirectManipulationControl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{bandFromAge as e}from"./chunk-chunk-HCNDE26Q.module.min.js";function t(e,t,i){if(null!=e)return"function"==typeof e?e(t,i):"object"==typeof e&&null!==e&&"constant"in e?e.constant:t[e]}function i(e){const{data:i,encoding:n}=e,o=[],c=new Map;return i.forEach((e,i)=>{const r=t(n.id,e,i);if(null==r||""===r)throw Error(`[semiotic] Motion encoding row ${i} resolved an empty id.`);const s=r+"";if(c.has(s))throw Error(`[semiotic] Duplicate motion encoding id "${s}".`);const a=t(n.process?.group,e,i),l=t(n.process?.stage,e,i),u=t(n.accessible?.group,e,i)??(null!=a?a+"":null!=l?l+"":void 0),m={};for(const o of Object.keys(n.evidence??{}))m[o]=t(n.evidence?.[o],e,i);const p={id:s,datum:e,time:{arrival:t(n.time?.arrival,e,i),basis:n.time?.basis,unit:n.time?.unit},placement:{x:t(n.placement?.x,e,i),y:t(n.placement?.y,e,i),lane:t(n.placement?.lane,e,i),space:n.placement?.space},kinematics:{velocityX:t(n.kinematics?.velocityX,e,i),velocityY:t(n.kinematics?.velocityY,e,i),space:n.kinematics?.space},process:{group:a,stage:l,target:t(n.process?.target,e,i),work:t(n.process?.work,e,i)},evidence:m,accessible:{description:t(n.accessible?.description,e,i),group:u,label:t(n.accessible?.label,e,i)??s}};o.push(p),c.set(s,p)}),{rows:o,byId:c}}function n(t){const i=t.now-t.arrival;return{age:i,progress:Number.isFinite(i)&&Number.isFinite(t.ttl)&&t.ttl>0?Math.max(0,i)/t.ttl:i===1/0&&Number.isFinite(t.ttl)&&t.ttl>0?1/0:0,lifecycle:e(i,t.ttl,t.thresholds)}}function o(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const i=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>i?1:t;if("exponential"===e.type){const n=e.halfLife??e.extent/2;return t+Math.pow(.5,i/(n>0?n:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-i/e.extent))*(1-t)}function c(e,t){const i=Number.isFinite(e)?e:0,n=Number.isFinite(t)?t:0;return{velocityX:i,velocityY:n,speed:Math.hypot(i,n),direction:Math.atan2(n,i)}}function r(e,t,i){return Number.isFinite(i)&&i>0?c((t.x-e.x)/i,(t.y-e.y)/i):c(0,0)}export{t as resolveMotionAccessor,i as compileMotionEncoding,n as resolveMotionAge,o as opacityFromAge,c as resolveMotionVector,r as deriveMotionVector};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{renderRectPulse as t}from"./chunk-chunk-H5IFO6CU.module.min.js";import{buildLinearFillGradient as e,clampCornerRadii as o,filterSparseArray as i,hasAnyCornerRadius as n,resolveCSSColor as r,resolveCanvasFill as s}from"./chunk-chunk-HCNDE26Q.module.min.js";var a=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(t){Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}evict(t){t!==this._min&&t!==this._max||(this._dirty=!0)}recalculate(t,e){this._min=1/0,this._max=-1/0;for(const o of t){const t=e?e(o):o;Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}},h=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=i(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 o=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const i=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,i),bounded:!1}),e=i,this.chunkTimer=t.length>e?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}setReplacementData(t){if(t=i(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 o=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const i=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,i),bounded:!1}),e=i,this.chunkTimer=t.length>e?requestAnimationFrame(o):0};this.chunkTimer=requestAnimationFrame(o)}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 o=0;t.length>o;o++){const i=t[o];null!=i&&"object"==typeof i&&(this.pushBuffer.push(i),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}},l={stops:[{offset:0,opacity:.8},{offset:1,opacity:.05}]};function c(t,e=l){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 u(t){return t?c(t):void 0}function f(t){if(t)return Array.isArray(t)?{stops:t.map(({at:t,color:e,opacity:o})=>({offset:t/100,color:e,...null!=o&&{opacity:o}}))}:Array.isArray(t.stops)?t:void 0}function d(t){return{stops:t.stops.map(t=>({...t,offset:1-t.offset})).sort((t,e)=>t.offset-e.offset)}}function g(t,e,o,i){return"function"==typeof t?t({size:e,margin:o,scales:i}):t}function y(t,e,o,i){return"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:i,fn:e}:{key:void 0,fn:null}}function p(t,e,o){return i=>{if(!i||!o||!t.fn&&!e.fn)return i;let n=!1;const r=i.map(o=>{const i=t.fn&&t.key&&!(t.key in o),r=e.fn&&e.key&&!(e.key in o);if(!i&&!r)return o;n=!0;const s={...o};return i&&(s[t.key]=t.fn(o)),r&&(s[e.key]=e.fn(o)),s});return n?r:i}}function m(t){return new Set(Array.isArray(t)?t:[t])}function _(t){for(const e of t){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style={...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0);else if("glyph"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0);else if("rect"===e.type||"heatcell"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0);else if("candlestick"===e.type)void 0!==e._targetX&&(e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0);else if("line"===e.type||"area"===e.type){if(e._introClipFraction=void 0,"line"===e.type&&e._targetPath){for(let t=0;e.path.length>t;t++)e.path[t]=e._targetPath[t];e._prevPath=void 0,e._targetPath=void 0}if("area"===e.type){if(e._targetTopPath)for(let t=0;e.topPath.length>t;t++)e.topPath[t]=e._targetTopPath[t];if(e._targetBottomPath)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=e._targetBottomPath[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0}}}}function k(t){for(const e of t){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style={...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}"point"===e.type?void 0!==e._targetX?(e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0):void 0!==e._targetR&&(e.r=e._targetR,e._targetR=void 0):"rect"===e.type?void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0):"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0)}}function v(t,e,o){return"exact"===o?function(t,e){const o=t.domain(),i=o[0],n=o[o.length-1],r=i instanceof Date,s=i instanceof Date?i.getTime():i,a=n instanceof Date?n.getTime():n;if(2>e||s===a)return r?[new Date(s),new Date(a)]:[s,a];const h=(a-s)/(e-1),l=Array(e);for(let t=0;e>t;t++){const o=t===e-1?a:s+t*h;l[t]=r?new Date(o):o}return l}(t,e):t.ticks(e)}function T(t,e){const{x:i,y:n,w:r,h:s}=e,{tl:a,tr:h,br:l,bl:c}=o(e);t.beginPath(),t.moveTo(i+a,n),t.lineTo(i+r-h,n),h>0&&t.arcTo(i+r,n,i+r,n+h,h),t.lineTo(i+r,n+s-l),l>0&&t.arcTo(i+r,n+s,i+r-l,n+s,l),t.lineTo(i+c,n+s),c>0&&t.arcTo(i,n+s,i,n+s-c,c),t.lineTo(i,n+a),a>0&&t.arcTo(i,n,i+a,n,a),t.closePath()}function x(t,o){const i=s(t,o.style.fill,r(t,"var(--semiotic-primary, #007bff)")),n=function(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}}}(o);return(o.fillGradient&&"string"==typeof i?e(t,o.fillGradient,i,n.x0,n.y0,n.x1,n.y1):null)||i}function b(t,e){return!(!e.style.stroke||"none"===e.style.stroke||(t.strokeStyle=r(t,e.style.stroke)||e.style.stroke,t.lineWidth=e.style.strokeWidth||1,0))}var w=(e,o,i,r)=>{const s=o.filter(t=>"rect"===t.type);for(const o of s){if(null!=o.style.opacity&&(e.globalAlpha=o.style.opacity),o.style.icon)A(e,o);else if(o.cornerRadii&&n(o.cornerRadii))e.fillStyle=x(e,o),T(e,o),e.fill(),b(e,o)&&e.stroke();else if(o.roundedTop&&o.roundedTop>0){e.fillStyle=x(e,o);const t=Math.min(o.roundedTop,o.w/2,o.h/2);e.beginPath();const{x:i,y:n,w:r,h:s}=o;switch(o.roundedEdge){case"right":e.moveTo(i,n),e.lineTo(i+r-t,n),e.arcTo(i+r,n,i+r,n+t,t),e.lineTo(i+r,n+s-t),e.arcTo(i+r,n+s,i+r-t,n+s,t),e.lineTo(i,n+s);break;case"left":e.moveTo(i+r,n),e.lineTo(i+t,n),e.arcTo(i,n,i,n+t,t),e.lineTo(i,n+s-t),e.arcTo(i,n+s,i+t,n+s,t),e.lineTo(i+r,n+s);break;case"bottom":e.moveTo(i,n),e.lineTo(i+r,n),e.lineTo(i+r,n+s-t),e.arcTo(i+r,n+s,i+r-t,n+s,t),e.lineTo(i+t,n+s),e.arcTo(i,n+s,i,n+s-t,t);break;default:e.moveTo(i,n+s),e.lineTo(i,n+t),e.arcTo(i,n,i+t,n,t),e.lineTo(i+r-t,n),e.arcTo(i+r,n,i+r,n+t,t),e.lineTo(i+r,n+s)}e.closePath(),e.fill(),b(e,o)&&e.stroke()}else e.fillStyle=x(e,o),e.fillRect(o.x,o.y,o.w,o.h),b(e,o)&&e.strokeRect(o.x,o.y,o.w,o.h);t(e,o),e.globalAlpha=1}};function A(t,e){const o=e.style.icon,i=e.style.iconPadding||2,n=Math.min(e.w,e.h)-i;if(0>=n)return;const r=e.h>e.w;if(t.save(),t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip(),r){const r=n+i,s=e.x+(e.w-n)/2;for(let i=e.y+e.h-n;i>=e.y-n;i-=r)t.drawImage(o,s,i,n,n)}else{const r=n+i,s=e.y+(e.h-n)/2;for(let i=e.x;e.x+e.w>i;i+=r)t.drawImage(o,i,s,n,n)}t.restore()}function Y(t,e,o,i,n,r){const s=[];for(const n of t){const t=o(n),r=i(n);Number.isFinite(t)&&Number.isFinite(r)&&s.push({px:e.x(t),py:e.y(r),rawY:r,d:n})}s.sort((t,e)=>t.px-e.px);const a=Array(s.length),h=Array(s.length),l=Array(s.length);for(let t=0;s.length>t;t++){const e=s[t];a[t]=[e.px,e.py],h[t]=e.rawY,l[t]=e.d}return{type:"line",path:a,rawValues:h,style:n,datum:l,group:r}}function S(t,e,o,i,n,r,s,a){const h=[];for(const r of t){const t=o(r),s=i(r);if(!Number.isFinite(t)||!Number.isFinite(s))continue;const l=e.x(t),c=a?a(r):n;h.push({px:l,topY:e.y(s),botY:e.y(c),rawY:s})}h.sort((t,e)=>t.px-e.px);const l=Array(h.length),c=Array(h.length),u=Array(h.length);for(let t=0;h.length>t;t++){const e=h[t];l[t]=[e.px,e.topY],c[t]=[e.px,e.botY],u[t]=e.rawY}return{type:"area",topPath:l,bottomPath:c,rawValues:u,style:r,datum:t,group:s}}function F(t,e,o,i){const n=new Map;if("silhouette"===i)for(const i of t){let t=0;for(const n of e)t+=o(n,i)||0;n.set(i,-t/2)}else if("wiggle"===i){t.length>0&&n.set(t[0],0);for(let i=1;t.length>i;i++){const r=t[i-1],s=t[i];let a=0,h=0,l=0;for(const t of e){const e=o(t,s)||0;a+=(2*l+e)*(e-(o(t,r)||0)),h+=e,l+=e}const c=n.get(r)??0;n.set(s,c-(h>0?a/(2*h):0))}if(t.length>0){let i=0;for(const r of t){let t=0;for(const i of e)t+=o(i,r)||0;i+=(n.get(r)??0)+t/2}const r=i/t.length;for(const e of t)n.set(e,(n.get(e)??0)-r)}}else for(const e of t)n.set(e,0);return n}function P(t,e,o){let i=0,n=0;for(const r of t){let t=0,s=0;for(const i of e){const e=o(i,r)||0;0>e?s+=e:t+=e}i>s&&(i=s),t>n&&(n=t)}return[i,n]}function B(t,e,o,i,n,r,s,a="zero"){const h=new Set;for(const e of t)for(const t of e.data){const e=o(t);Number.isFinite(e)&&h.add(e)}const l=Array.from(h).sort((t,e)=>t-e),c=new Map;for(const e of t){const t=new Map;for(const n of e.data){const e=o(n),r=i(n);Number.isFinite(e)&&Number.isFinite(r)&&t.set(e,(t.get(e)||0)+r)}c.set(e.key,t)}let u;if(r){u=new Map;for(const e of l){let o=0;for(const i of t)o+=c.get(i.key)?.get(e)||0;u.set(e,o||1)}}const f=F(l,t.map(t=>t.key),(t,e)=>c.get(t)?.get(e)||0,a),d="diverging"===a&&!r,g=[],y=new Map,p=new Map,m=new Map,_=new Map;for(const t of l)p.set(t,f.get(t)??0),m.set(t,0),_.set(t,0);for(const o of t){const t=c.get(o.key),i=new Map;let a=[],h=[];const f=()=>{if(a.length>=2){const t={type:"area",topPath:a,bottomPath:h,style:n(o.key,o.data[0]),datum:o.data,group:o.key};s&&(t.curve=s),g.push(t)}a=[],h=[]};for(const o of l){const n=t.has(o);let s,l,c=n?t.get(o):0;if(r&&n&&(c/=u.get(o)),!n||!Number.isFinite(c)||0===c){f();continue}d?c>0?(s=m.get(o),l=s+c,m.set(o,l)):(s=_.get(o),l=s+c,_.set(o,l)):(s=p.get(o),l=s+c,p.set(o,l));const g=e.x(o);h.push([g,e.y(s)]),a.push([g,e.y(l)]),i.set(o,l)}f(),y.set(o.key,i)}return{nodes:g,stackedTops:y}}function D(t,e,o,i,n,r,s){const a=o(t),h=i(t);if(!Number.isFinite(a)||!Number.isFinite(h))return null;const l={type:"point",x:e.x(a),y:e.y(h),r:n,style:r,datum:t};return void 0!==s&&(l.pointId=s),l}function X(t,e,o,i,n,r,s,a){const h=o(t),l=i(t);if(!Number.isFinite(h)||!Number.isFinite(l))return null;const c={type:"symbol",x:e.x(h),y:e.y(l),size:n,symbolType:r,style:s,datum:t};return void 0!==a&&(c.pointId=a),c}function z(t,e,o,i,n,r,s){return{type:"rect",x:t,y:e,w:o,h:i,style:n,datum:r,group:s}}function R(t,e,o,i,n,r,s){const a={type:"heatcell",x:t,y:e,w:o,h:i,fill:n,datum:r};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}export{h as DataSourceAdapter,a as IncrementalExtent,m as toIdSet,Y as buildLineNode,S as buildAreaNode,F as computeStackOffsets,P as computeDivergingStackExtent,B as buildStackedAreaNodes,D as buildPointNode,X as buildSymbolNode,z as buildRectNode,R as buildHeatcellNode,c as normalizeGradient,u as normalizeColorGradient,f as normalizeSemanticGradient,d as reverseGradient,_ as snapXYIntroTargets,k as snapOrdinalIntroTargets,v as ticksForMode,g as resolveFrameGraphics,y as resolveAnnotationAccessor,p as buildEnrichAnnotationData,w as barCanvasRenderer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={fresh:1,aging:1.5,stale:3};function t(e,t,r={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(r.fresh??1)>e?"fresh":t*(r.aging??1.5)>e?"aging":t*(r.stale??3)>e?"stale":"expired":"fresh"}function r(e,t={}){const r=!0===t.showRetractedAnnotations,s=!0===t.showSupersededAnnotations,n=new Set;for(const t of e){const e=t?.lifecycle?.supersedes;e&&"retracted"!==t?.lifecycle?.status&&n.add(e)}return e.filter(e=>{if("retracted"===e?.lifecycle?.status&&!r)return!1;const t=e?.provenance?.stableId;return!(t&&n.has(t)&&!s)})}export{e as DEFAULT_LIFECYCLE_THRESHOLDS,t as bandFromAge,r as filterAnnotationsByStatus};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function e(e,n,r=e.responsiveRules){if(!Array.isArray(r)||0===r.length)return{props:e,matches:[]};const o=r.map((t,e)=>({rule:t,index:e})).filter(t=>function(t,e){const{when:n}=t,r=e.width,o=e.height,i=function(t){if("number"==typeof t.height&&t.height>0)return t.width/t.height}(e),a=function(t){if("number"==typeof t.height&&t.height>0)return t.height>t.width?"portrait":"landscape"}(e);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof o||n.minHeight>o)||"number"==typeof n.maxHeight&&("number"!=typeof o||o>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&a!==n.orientation)}(t.rule,n)).sort((t,e)=>("number"==typeof t.rule.priority?t.rule.priority:t.index)-("number"==typeof e.rule.priority?e.rule.priority:e.index));return{props:o.reduce((e,n)=>function(e,n){const r={...e,...n};for(const o of["margin","frameProps","mobileSemantics","style"])t(e[o])&&t(n[o])&&(r[o]={...e[o],...n[o]});return"string"==typeof e.className&&"string"==typeof n.className&&(r.className=`${e.className} ${n.className}`),r}(e,n.rule.transform),e),matches:o}}function n(t,e){return t===e}function r(t,e){if("function"==typeof t)return e=>+t(e);const n=t||e;return t=>+t[n]}function o(t,e){if("function"==typeof t)return t;const n=t||e;return t=>t[n]}function i(t,e){return"function"==typeof t?t:t?e=>e[t]+"":e?t=>t[e]+"":void 0}function a(t){return t?"function"==typeof t?t:e=>e[t]||e.id:null}function s(t){return"string"==typeof t?t:t.id}var u=/^\d{4}-\d{1,2}$/;function c(t){const e=t.trim();if(!e||!Number.isNaN(Number(e)))return NaN;const n=u.test(e)?e+"-01":e;if(n===e&&10>e.length)return NaN;const r=Date.parse(n);return Number.isFinite(r)?r:NaN}function l(t){return t instanceof Date?t.getTime():"string"==typeof t?c(t):+t}var f=new Set(["label","callout","callout-circle","callout-rect","text","widget"]),m=new Set(["label","callout","callout-circle","callout-rect"]);function h(t){return"string"==typeof t?.type?t.type:""}function d(t){return!!t&&"object"==typeof t&&f.has(h(t))}function p(t){return m.has(h(t))&&!function(t){return Array.isArray(t?.disable)&&t.disable.includes("connector")}(t)}function y(t,e,n={}){return Number.isFinite(e)&&e>0?Number.isNaN(t)?"fresh":t===1/0?"expired":0>t||e*(n.fresh??1)>t?"fresh":e*(n.aging??1.5)>t?"aging":e*(n.stale??3)>t?"stale":"expired":"fresh"}function b(t,e={}){const n=!0===e.showRetractedAnnotations,r=!0===e.showSupersededAnnotations,o=new Set;for(const e of t){const t=e?.lifecycle?.supersedes;t&&"retracted"!==e?.lifecycle?.status&&o.add(t)}return t.filter(t=>{if("retracted"===t?.lifecycle?.status&&!n)return!1;const e=t?.provenance?.stableId;return!(e&&o.has(e)&&!r)})}function g(t){const e=[],n=t.domain;null==n?e.push({severity:"error",code:"PROCESS_SANKEY_MISSING_DOMAIN",message:"ProcessSankey requires domain: [tStart, tEnd].",fix:"Pass domain={[start, end]} as numbers or Date-compatible values."}):Array.isArray(n)&&2===n.length&&Number.isFinite(Number(n[0]))&&Number.isFinite(Number(n[1]))||e.push({severity:"error",code:"PROCESS_SANKEY_BAD_DOMAIN",message:"domain must be a 2-tuple of finite times.",fix:"Use domain={[t0, t1]} with t0 <= t1."});const r=t.edges;if(Array.isArray(r)&&r.length>0){const t=r[0];null!=t.startTime&&null!=t.endTime||e.push({severity:"warning",code:"PROCESS_SANKEY_EDGE_TIMES",message:"Edges should carry startTime and endTime for temporal layout.",fix:"Add startTime/endTime fields or set startTimeAccessor/endTimeAccessor."})}const o=t.nodes,i=Array.isArray(o)?o.length:0;return!0!==t.showLabels||24>i||e.push({severity:"warning",code:"PROCESS_SANKEY_LABEL_DENSITY",message:`showLabels={true} with ${i} nodes may overcrowd the plot.`,fix:'Use showLabels="auto" with optional labelPriorityAccessor / maxLabels.'}),80>(Array.isArray(r)?r.length:0)||null!=t.layoutExecution||"off"===t.packing||e.push({severity:"warning",code:"PROCESS_SANKEY_WORKER_HINT",message:"Dense ProcessSankey layouts benefit from worker packing/order.",fix:'layoutExecution defaults to "auto"; set layoutExecution="worker" or raise layoutWorkerThreshold deliberately.'}),e}import{createContext as v,useCallback as x,useContext as A,useMemo as N,useRef as S,useSyncExternalStore as w}from"react";import{jsx as E}from"react/jsx-runtime";function O(t){let e=null;const n=()=>(e||(e=v(null)),e),r=M(t);return[function({children:e,initialState:r}){const o=S(r),i=N(()=>M(t,o.current),[]),a=n();return E(a.Provider,{value:i,children:e})},(t,e)=>{const o=n(),i=A(o)??r,a=S(t);a.current=t;const s=S({hasValue:!1,value:void 0}),u=x(()=>{const t=a.current(i.getState()),n=s.current;return n.hasValue&&e&&e(n.value,t)?n.value:(s.current={hasValue:!0,value:t},t)},[i,e]),c=x(()=>a.current(i.getState()),[i]);return w(i.subscribe,u,c)}]}function M(t,e){const n=new Set;let r={...t(function(t){const e=t(r);if(T(e)){r={...r,...e};for(const t of n)t()}}),...e??{}};return{getState:()=>r,subscribe:function(t){return n.add(t),()=>{n.delete(t)}}}}function T(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}import*as I from"react";var[P,_]=O(t=>({observations:[],maxObservations:100,version:0,pushObservation(e){t(t=>{const n=t.observations;return n.push(e),n.length>t.maxObservations&&n.shift(),{version:t.version+1}})},clearObservations(){t(()=>({observations:[],version:0}))}}));function k(t){const e=_(t=>t.pushObservation),n=I.useCallback(n=>{t.onObservation?.(n),e?.(n)},[t,e]);return I.useMemo(()=>({...t,onObservation:n}),[n,t])}function R(t){const e=t.provenance,n=t.id??t.stableId??e?.stableId;return null==n||""===n?void 0:n+""}function D(t,e={}){const n=R(t);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(r){const o=function(t){const e=t.nativeEvent;return"touch"===e.pointerType?"touch":0===e.detail?"keyboard":"pointer"}(r);e.onAnnotationActivate?.({annotation:t,annotationId:n,chartId:e.chartId,inputType:o}),n&&e.onObservation&&e.onObservation({type:"annotation-activate",annotationId:n,inputType:o,timestamp:Date.now(),chartType:e.chartType??"unknown",chartId:e.chartId})}}}function C(t){return t instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]")}function F(t){return"primary"===t?.emphasis||!0===t?.defensive}function K(t,e,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):t>0&&e>0?Math.max(1,Math.round(t*e/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function L(t){let e;const n=t?.emphasis;e="primary"===n?100:"secondary"===n?10:50;const r=t?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(e+=15*Math.max(0,Math.min(1,r))),t?.lifecycle?.freshness){case"fresh":e+=8;break;case"aging":e+=4;break;case"stale":e+=1;break;case"expired":e-=200}return e}function W(t){const{annotations:e,width:n,height:r}=t,o=Math.max(0,t.minVisible??1),i=K(n,r,t),a=e.map((t,e)=>{return{annotation:t,index:e,note:(n=t,d(n))};var n}),s=a.filter(t=>t.note);if(0===s.length||i>=s.length)return{visible:e.slice(),deferred:[],budget:i};const u=s.filter(t=>F(t.annotation)),c=s.filter(t=>!F(t.annotation)).sort((t,e)=>L(e.annotation)-L(t.annotation)||t.index-e.index),l=Math.min(c.length,Math.max(Math.max(0,i-u.length),Math.max(0,o-u.length))),f=new Set([...u.map(t=>t.index),...c.slice(0,l).map(t=>t.index)]),m=[],h=[];for(const{annotation:t,index:e,note:n}of a)!n||f.has(e)?m.push(t):h.push(t);return{visible:m,deferred:h,budget:i}}function Y(t){let e=t>>>0;return function(){e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}export{e as resolveResponsiveRules,O as createStore,T as hasOwnEnumerableKey,n as accessorsEquivalent,r as resolveAccessor,o as resolveRawAccessor,i as resolveStringAccessor,a as resolveLabelFn,s as resolveNodeRefId,c as parseDateLikeString,l as coerceDateLikeValue,y as bandFromAge,_ as useObservationSelector,k as useAnnotationActivationOptions,R as annotationStableId,D as annotationActivationProps,C as isAnnotationActivationTarget,h as annotationType,d as isNoteAnnotation,p as annotationDrawsConnector,K as annotationBudget,W as annotationDensity,b as filterAnnotationsByStatus,g as diagnoseProcessSankeyProps,Y as mulberry32};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var t=/^\d{4}-\d{1,2}$/;function e(e){const n=e.trim();if(!n||!Number.isNaN(Number(n)))return NaN;const r=t.test(n)?n+"-01":n;if(r===n&&10>n.length)return NaN;const i=Date.parse(r);return Number.isFinite(i)?i:NaN}function n(t){return t instanceof Date?t.getTime():"string"==typeof t?e(t):+t}function r(t,n){if(!t||!n)return{data:t,failed:!1};let r=!1,i=!1;const a=t.map(t=>{const a=t[n];if("string"!=typeof a)return t;const u=e(a);return r=!0,Number.isFinite(u)?{...t,[n]:u}:(i=!0,{...t,[n]:NaN})});return{data:r?a:t,failed:i}}export{e as parseDateLikeString,n as coerceDateLikeValue,r as coerceTemporalStringRows};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{needsDataCanvasPaint as e,paintCanvasBackground as t}from"./chunk-chunk-W5HWGQMD.module.min.js";import{networkSymbolRenderer as r}from"./chunk-chunk-CD6PVVS3.module.min.js";import{StalenessBadge as n,attachUpdateResultStore as o,buildNavGraph as i,composeOverlays as a,computeDecayOpacity as s,createCustomLayoutFailureDiagnostic as c,extractNetworkNavPoints as l,findHitPointInQuadtree as u,formatVal as d,getHitRadius as h,hitTestRect as f,networkGlyphRenderer as y,nextNetworkIndex as g,normalizeAngle as p,paintSceneWithBackend as m,renderCirclePulse as v,renderRectPulse as x,renderSceneWithBackend as k,resolvePosition as b,useConfigSync as _,useLayoutSelectionSync as S,useStableShallow as w,useStalenessCheck as A,warnCustomLayoutDiagnostics as L}from"./chunk-chunk-H5IFO6CU.module.min.js";import{CustomLayoutSelectionProvider as E,wrapWithCustomLayoutSelection as P}from"./chunk-chunk-5UKL5W76.module.min.js";import{resolveLabelFn as D,resolveNodeRefId as R}from"./chunk-chunk-NWIGA3UK.module.min.js";import{filterAnnotationsByStatus as M}from"./chunk-chunk-FC3NZWYR.module.min.js";import{commonJsWorkerModuleUrl as N}from"./chunk-chunk-SV4XAZ3Q.module.min.js";import{buildResolveColor as T,resolveCustomLayoutPalette as C}from"./chunk-chunk-SFLUSZ73.module.min.js";import{ANNOTATION_DISCLOSURE_REVEAL_CSS as I,AriaLiveTooltip as W,CanvasFrameBackground as $,DEFAULT_COLORS as z,FlippingTooltip as F,FocusRing as B,NetworkAccessibleDataTable as Y,SceneRevisionDiagnosticsObserver as O,ScreenReaderSummary as j,SkipToTableLink as X,TITLE_BASELINE as H,UpdateResultTracker as q,annotationActivationProps as V,annotationLayout as G,buildHoverData as Q,computeEasing as K,computeNetworkAriaLabel as Z,computeRawProgress as U,createDefaultAnnotationRules as J,createSeededFrameRandom as ee,defaultTooltipStyle as te,emitClickObservations as re,emitHoverObservations as ne,filterSparseArray as oe,getDevicePixelRatio as ie,isAnnotationActivationTarget as ae,isInteractiveKeyboardTarget as se,isServerEnvironment as ce,lerp as le,networkLabelToSVG as ue,networkSceneEdgeToSVG as de,networkSceneNodeToSVG as he,now as fe,observationInputType as ye,paintNetworkFill as ge,paintNetworkStroke as pe,prepareCanvas as me,renderAnnotationPass as ve,renderLegendFromConfig as xe,resolveCSSColor as ke,resolveCanvasFill as be,runSceneBuild as _e,schemeCategory10 as Se,smartTooltipEntries as we,symbolRadius as Ae,useAnnotationActivationOptions as Le,useFrame as Ee,useFrameCanvasHost as Pe,useSceneRevisionDiagnostics as De}from"./chunk-chunk-HCNDE26Q.module.min.js";import{getMinMax as Re}from"./chunk-chunk-2NVFEB7P.module.min.js";import{resolveThemeSemanticColors as Me}from"./chunk-chunk-PMR47KRY.module.min.js";import{glyphHitGeometry as Ne}from"./chunk-chunk-KTWEBFMX.module.min.js";import{renderLoadingState as Te,useHydration as Ce,useWasHydratingFromSSR as Ie}from"./chunk-chunk-ACLDBMRH.module.min.js";import*as We from"react";import{useRef as $e,useState as ze,useEffect as Fe,useMemo as Be,useCallback as Ye,useImperativeHandle as Oe,forwardRef as je,memo as Xe}from"react";var He={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},qe={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},Ve=class{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e,t=Math.random){const r=this._freeIndices.pop();if(void 0===r)return null;const n=this.particles[r];return n.active=!0,n.t=0,n.offset=t()-.5,n.edgeIndex=e,n.x=0,n.y=0,n}step(e,t,r,n){for(let o=0;this.capacity>o;o++){const i=this.particles[o];if(!i.active)continue;const a=r[i.edgeIndex];a&&a.bezier?(i.t+=e*t*(n?n[i.edgeIndex]??1:1)*(a.bezier.circular?.3:1),1>i.t?Ge(a.bezier,i.t,i.offset,i):(i.active=!1,this._freeIndices.push(o))):(i.active=!1,this._freeIndices.push(o))}}countForEdge(e){let t=0;for(let r=0;this.capacity>r;r++)this.particles[r].active&&this.particles[r].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;const t=this.particles;this.particles=Array(e);for(let r=0;e>r;r++)t.length>r?this.particles[r]=t[r]:(this.particles[r]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(r));this.capacity=e}};function Ge(e,t,r,n){if(e.circular&&e.segments)return void function(e,t,r,n,o){const i=e.length,a=t*i,s=Math.min(Math.floor(a),i-1),c=a-s,[l,u,d,h]=e[s];Qe(l,u,d,h,c,o);const f=h.x-l.x,y=h.y-l.y,g=Math.sqrt(f*f+y*y);if(g>.001){const e=f/g;o.x+=-y/g*r*n*2,o.y+=e*r*n*2}}(e.segments,t,r,e.halfWidth,n);if(!e.points)return n.x=0,void(n.y=0);const[o,i,a,s]=e.points;Qe(o,i,a,s,t,n);const c=s.x-o.x,l=s.y-o.y,u=Math.sqrt(c*c+l*l);if(u>.001){const t=c/u;n.x+=-l/u*r*e.halfWidth*2,n.y+=t*r*e.halfWidth*2}}function Qe(e,t,r,n,o,i){const a=1-o,s=a*a,c=s*a,l=o*o,u=l*o;i.x=c*e.x+3*s*o*t.x+3*a*l*r.x+u*n.x,i.y=c*e.y+3*s*o*t.y+3*a*l*r.y+u*n.y}function Ke(e,t){var r=e.get(t);if(!r)throw Error("missing: "+t);return r}function Ze(e,t){var r,n=[],o=[],i=[],a={},s=[];function c(e){i[e]=!1,a.hasOwnProperty(e)&&Object.keys(a[e]).forEach(function(t){delete a[e][t],i[t]&&c(t)})}function l(e){var t,n,d=!1;for(o.push(e),i[e]=!0,t=0;s[e].length>t;t++)(n=s[e][t])===r?(u(r,o),d=!0):i[n]||(d=l(n));if(d)c(e);else for(t=0;s[e].length>t;t++){var h=a[n=s[e][t]];h||(a[n]=h={}),h[n]=!0}return o.pop(),d}function u(e,r){var o=[].concat(r).concat(e);t?t(o):n.push(o)}function d(t){!function(t){for(var r=0;e.length>r;r++)r>=t&&e[r]||(e[r]=[]),e[r]=e[r].filter(function(e){return e>=t})}(t);for(var r,n=function(e){for(var t=e.length,r=Array(t),n=Array(t),o=Array(t),i=Array(t),a=Array(t),s=Array(t),c=0;t>c;++c)r[c]=-1,n[c]=0,o[c]=!1,i[c]=0,a[c]=-1,s[c]=[];var l,u=0,d=[],h=[];function f(t){var c=[t],l=[t];for(r[t]=n[t]=u,o[t]=!0,u+=1;l.length>0;){var f=e[t=l[l.length-1]];if(f.length>i[t]){for(var y=i[t];f.length>y;++y){var g=f[y];if(0>r[g]){r[g]=n[g]=u,o[g]=!0,u+=1,c.push(g),l.push(g);break}o[g]&&(n[t]=0|Math.min(n[t],n[g])),0>a[g]||s[t].push(a[g])}i[t]=y}else{if(n[t]===r[t]){var p=[],m=[],v=0;for(y=c.length-1;y>=0;--y){var x=c[y];if(o[x]=!1,p.push(x),m.push(s[x]),v+=s[x].length,a[x]=d.length,x===t){c.length=y;break}}d.push(p);var k=Array(v);for(y=0;m.length>y;y++)for(var b=0;m[y].length>b;b++)k[--v]=m[y][b];h.push(k)}l.pop()}}}for(c=0;t>c;++c)0>r[c]&&f(c);for(c=0;h.length>c;c++){var y=h[c];if(0!==y.length){y.sort(function(e,t){return e-t}),l=[y[0]];for(var g=1;y.length>g;g++)y[g]!==y[g-1]&&l.push(y[g]);h[c]=l}}return{components:d,adjacencyList:h}}(e),o=n.components.filter(function(e){return e.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],r=a);var c=o[r];return!!c&&{leastVertex:i,adjList:e.map(function(e,t){return-1===c.indexOf(t)?[]:e.filter(function(e){return-1!==c.indexOf(e)})})}}r=0;for(var h=e.length;h>r;){var f=d(r);if(r=f.leastVertex,s=f.adjList){for(var y=0;s.length>y;y++)for(var g=0;s[y].length>g;g++){var p=s[y][g];i[+p]=!1,a[p]={}}l(r),r+=1}else r=h}return t?void 0:n}function Ue(e){return e.y0-e.y1>0?"up":"down"}function Je(e,t){return t(e.source)==t(e.target)}function et(e){var t=0;e.source.sourceLinks.forEach(function(e){t=e.circular?t+1:t});var r=0;return e.target.targetLinks.forEach(function(e){r=e.circular?r+1:r}),1>=t&&1>=r}function tt(e){return e.target.x0-e.source.x1}function rt(e,t){var r=ot(e),n=tt(t)/Math.tan(r);return"up"==Ue(e)?e.y1-n:e.y1+n}function nt(e,t){var r=ot(e),n=tt(t)/Math.tan(r);return"up"==Ue(e)?e.y1+n:e.y1-n}function ot(e){var t=Math.abs(e.y1-e.y0);return Math.atan(Math.abs(e.target.x0-e.source.x1)/t)}function it(e,t){return t(e)}function at(e){return ct(e.source)}function st(e){return ct(e.target)}function ct(e){return(e.y0+e.y1)/2}function lt(e){return e.virtual?0:e.value}function ut(e,t){var r=0;e.sourceLinks.forEach(function(e){r=e.circular&&!Je(e,t)?r+1:r});var n=0;return e.targetLinks.forEach(function(e){n=e.circular&&!Je(e,t)?n+1:n}),r+n}function dt(e){return e.target.depth}function ht(e,t){return e.sourceLinks.length?e.depth:t-1}function ft(e,t){return e.y0-t.y0}function yt(e,t){return t.y0-e.y0}function gt(e,t){return e.y1-t.y1}function pt(e,t){return t.y1-e.y1}function mt(e,t){return xt(e.source,t.source)||e.index-t.index}function vt(e,t){return xt(e.target,t.target)||e.index-t.index}function xt(e,t){return e.partOfCycle===t.partOfCycle?e.y0-t.y0:"top"===e.circularLinkType||"bottom"===t.circularLinkType?-1:1}function kt(e,t){return bt(e)==bt(t)?"bottom"==e.circularLinkType?yt(e,t):ft(e,t):bt(t)-bt(e)}function bt(e){return e.target.column-e.source.column}function _t(e,t){return St(e)==St(t)}function St(e){return e.y0-e.y1>0?"up":"down"}import{min as wt}from"d3-array";function At(e,t,r,n,o){let i=e;var a=Math.max(8,.15*(i.y1-i.y0));i.links.forEach(function(e){e.circular&&(e._circularWidth=Math.min(e.width,a))});var s=wt(i.links,function(e){return e.source.y0});i.links.forEach(function(e){e.circular&&(e.circularPathData={})});var c=i.links.filter(function(e){return e.circular});return c.sort(function(e,t){return t.value-e.value}),c.forEach(function(e,t){e._circularStub=t>=4}),Lt(i.links.filter(function(e){return"top"==e.circularLinkType}),t,r),Lt(i.links.filter(function(e){return"bottom"==e.circularLinkType}),t,r),i.links.forEach(function(e){if(e.circular){if(e.circularPathData.arcRadius=e._circularWidth+n,e.circularPathData.rightNodeBuffer=5,e.circularPathData.leftNodeBuffer=5,e.circularPathData.sourceWidth=e.source.x1-e.source.x0,e.circularPathData.sourceX=e.source.x0+e.circularPathData.sourceWidth,e.circularPathData.targetX=e.target.x0,e.circularPathData.sourceY=e.y0,e.circularPathData.targetY=e.y1,Je(e,t)&&et(e))e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2,e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2,"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=e.source.y1+o+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=e.source.y0-o-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius);else{var a=e.source.column,c=e.circularLinkType,l=i.links.filter(function(e){return e.source.column==a&&e.circularLinkType==c});l.sort("bottom"==e.circularLinkType?yt:ft);var u=0;l.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.rightSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.rightLargeArcRadius=n+e._circularWidth/2+o*r+u),u+=t._circularWidth||t.width}),a=e.target.column,(l=i.links.filter(function(e){return e.target.column==a&&e.circularLinkType==c})).sort("bottom"==e.circularLinkType?pt:gt),u=0,l.forEach(function(t,o){t.circularLinkID==e.circularLinkID&&(e.circularPathData.leftSmallArcRadius=n+e._circularWidth/2+u,e.circularPathData.leftLargeArcRadius=n+e._circularWidth/2+o*r+u),u+=t._circularWidth||t.width}),"bottom"==e.circularLinkType?(e.circularPathData.verticalFullExtent=Math.max(i.y1,e.source.y1,e.target.y1)+o+e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent-e.circularPathData.leftLargeArcRadius):(e.circularPathData.verticalFullExtent=s-o-e.circularPathData.verticalBuffer,e.circularPathData.verticalRightInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.rightLargeArcRadius,e.circularPathData.verticalLeftInnerExtent=e.circularPathData.verticalFullExtent+e.circularPathData.leftLargeArcRadius)}e.circularPathData.rightInnerExtent=e.circularPathData.sourceX+e.circularPathData.rightNodeBuffer,e.circularPathData.leftInnerExtent=e.circularPathData.targetX-e.circularPathData.leftNodeBuffer,e.circularPathData.rightFullExtent=e.circularPathData.sourceX+e.circularPathData.rightLargeArcRadius+e.circularPathData.rightNodeBuffer,e.circularPathData.leftFullExtent=e.circularPathData.targetX-e.circularPathData.leftLargeArcRadius-e.circularPathData.leftNodeBuffer}e.path=e.circular?function(e){return"top"==e.circularLinkType?"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 0 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY-e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 0 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 0 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY-e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 0 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY:"M"+e.circularPathData.sourceX+" "+e.circularPathData.sourceY+" L"+e.circularPathData.rightInnerExtent+" "+e.circularPathData.sourceY+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightSmallArcRadius+" 0 0 1 "+e.circularPathData.rightFullExtent+" "+(e.circularPathData.sourceY+e.circularPathData.rightSmallArcRadius)+" L"+e.circularPathData.rightFullExtent+" "+e.circularPathData.verticalRightInnerExtent+" A"+e.circularPathData.rightLargeArcRadius+" "+e.circularPathData.rightLargeArcRadius+" 0 0 1 "+e.circularPathData.rightInnerExtent+" "+e.circularPathData.verticalFullExtent+" L"+e.circularPathData.leftInnerExtent+" "+e.circularPathData.verticalFullExtent+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftLargeArcRadius+" 0 0 1 "+e.circularPathData.leftFullExtent+" "+e.circularPathData.verticalLeftInnerExtent+" L"+e.circularPathData.leftFullExtent+" "+(e.circularPathData.targetY+e.circularPathData.leftSmallArcRadius)+" A"+e.circularPathData.leftLargeArcRadius+" "+e.circularPathData.leftSmallArcRadius+" 0 0 1 "+e.circularPathData.leftInnerExtent+" "+e.circularPathData.targetY+" L"+e.circularPathData.targetX+" "+e.circularPathData.targetY}(e):function(e){var t=e.source.x1,r=e.y0,n=e.target.x0,o=e.y1,i=(t+n)/2;return"M"+t+","+r+"C"+i+","+r+" "+i+","+o+" "+n+","+o}(e)}),i}function Lt(e,t,r){e.sort(kt);var n=e.filter(function(e){return!e._circularStub});return e.forEach(function(e,o){var i=0;if(e._circularStub)e.circularPathData.verticalBuffer=0;else if(Je(e,t)&&et(e))e.circularPathData.verticalBuffer=i+e._circularWidth/2;else{for(var a=0;n.length>a;a++){var s=n[a];if(s!==e&&s.circularPathData&&void 0!==s.circularPathData.verticalBuffer&&Et(e,s)){var c=s.circularPathData.verticalBuffer+(s._circularWidth||s.width)/2+r;i=c>i?c:i}}e.circularPathData.verticalBuffer=i+e._circularWidth/2}}),e}function Et(e,t){return e.source.column>=t.target.column&&t.source.column>=e.target.column}import{min as Pt,max as Dt,sum as Rt,mean as Mt,group as Nt,groups as Tt}from"d3-array";function Ct(e){return function(){return e}}function It(e){return e.index}function Wt(e){return e.nodes}function $t(e){return e.links}function zt(e,t,r){var n=Tt(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});n.forEach(function(o,i){var a=o.length;if(t)o.sort(t);else if(i>0){var s=new Map;o.forEach(function(e,t){var r,n,o,i=(n=0,o=0,(r=e).targetLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=ct(e.source)*t,n+=t}}),r.sourceLinks.forEach(function(e){if(!e.circular){var t=e.value||1;o+=ct(e.target)*t,n+=t}}),n>0?o/n:NaN);s.set(e,{bc:i,idx:t})}),o.sort(function(e,t){var r=s.get(e),n=s.get(t),o=r.bc,i=n.bc;if(e.circularLinkType!==t.circularLinkType){if("top"==e.circularLinkType&&"bottom"==t.circularLinkType)return-1;if("bottom"==e.circularLinkType&&"top"==t.circularLinkType)return 1;if("top"==e.circularLinkType)return-1;if("top"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return 1;if("bottom"==t.circularLinkType)return-1}return isNaN(o)||isNaN(i)?isNaN(o)?isNaN(i)?r.idx-n.idx:1:-1:o-i})}else o.sort(function(e,t){return e.circularLinkType==t.circularLinkType?ut(t,r)-ut(e,r):"top"==e.circularLinkType&&"bottom"==t.circularLinkType||"top"==e.circularLinkType&&0==t.partOfCycle||0==e.partOfCycle&&"bottom"==t.circularLinkType?-1:0});o.forEach(function(t,o){t.depth==n.length-1&&1==a||0==t.depth&&1==a?(t.y0=e.y1/2-t.value*e.ky,t.y1=t.y0+t.value*e.ky):t.partOfCycle?0==ut(t,r)?(t.y0=e.y1/2+o,t.y1=t.y0+t.value*e.ky):"top"==t.circularLinkType?(t.y0=e.y0+o,t.y1=t.y0+t.value*e.ky):(t.y0=e.y1-t.value*e.ky-o,t.y1=t.y0+t.value*e.ky):0==e.y0||0==e.y1?(t.y0=(e.y1-e.y0)/a*o,t.y1=t.y0+t.value*e.ky):(t.y0=(e.y1-e.y0)/2-a/2+o,t.y1=t.y0+t.value*e.ky)})})}function Ft(e,t,r,n,o,i){var a=Tt(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});u();for(var s=1,c=i;c>0;--c)l(s*=.99,r),u();function l(t,r){var n=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&&ut(o,r)>0){var c=Mt(o.sourceLinks,st),l=Mt(o.targetLinks,at),u=c&&l?(c+l)/2:c||l;if(u){var d=(u-ct(o))*t*.3;o.y0+=d,o.y1+=d}}else if(0==a&&1==i)o.y0=e.y1/2-(s=o.y1-o.y0)/2,o.y1=e.y1/2+s/2;else if(a==n-1&&1==i)o.y0=e.y1/2-(s=o.y1-o.y0)/2,o.y1=e.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 h=Mt(o.sourceLinks,st),f=Mt(o.targetLinks,at),y=((h&&f?(h+f)/2:h||f)-ct(o))*t;o.y0+=y,o.y1+=y}})})}function u(){a.forEach(function(r){var i,a,s,c=e.y0,l=r.length;for(r.sort(t||xt),s=0;l>s;++s)(a=c-(i=r[s]).y0)>0&&(i.y0+=a,i.y1+=a),c=i.y1+n;if((a=c-n-e.y1)>0)for(c=i.y0-=a,i.y1-=a,s=l-2;s>=0;--s)(a=(i=r[s]).y1+o-c)>0&&(i.y0-=a,i.y1-=a),c=i.y0})}}function Bt(e){e.nodes.forEach(function(e){e.sourceLinks.sort(vt),e.targetLinks.sort(mt)}),e.nodes.forEach(function(e){var t=e.y0,r=t,n=e.y1,o=n;e.sourceLinks.forEach(function(e){e.circular?(e.y0=n-e.width/2,n-=e.width):(e.y0=t+e.width/2,t+=e.width)}),e.targetLinks.forEach(function(e){e.circular?(e.y1=o-e.width/2,o-=e.width):(e.y1=r+e.width/2,r+=e.width)})})}function Yt(){var e=0,t=0,r=1,n=1,o=24,i=8,a=null,s=It,c=ht,l=void 0,u=32,d=2,h=Wt,f=$t;function y(){var y={nodes:h.apply(null,arguments),links:f.apply(null,arguments)};return function(h){h.x0=e,h.y0=t,h.x1=r,h.y1=n,h.py=0,function(e,t){e.nodes.forEach(function(e,t){e.index=t,e.sourceLinks=[],e.targetLinks=[]});var r=function(e,t){var r=new Map;return Nt(e,t).forEach(function(e,t){r.set(t,e[0])}),r}(e.nodes,t);e.links.forEach(function(e,t){e.index=t;var n=e.source,o=e.target;"object"!=typeof n&&(n=e.source=Ke(r,n)),"object"!=typeof o&&(o=e.target=Ke(r,o)),n.sourceLinks.push(e),o.targetLinks.push(e)})}(h,s),function(e,t){var r=0;if(null==t){for(var n=[],o=0;e.links.length>o;o++){var i=e.links[o],a=i.source.index,s=i.target.index;n[a]||(n[a]=[]),n[s]||(n[s]=[]),-1===n[a].indexOf(s)&&n[a].push(s)}var c=Ze(n);c.sort(function(e,t){return e.length-t.length});var l={};for(o=0;c.length>o;o++){var u=c[o].slice(-2);l[u[0]]||(l[u[0]]={}),l[u[0]][u[1]]=!0}e.links.forEach(function(e){var t=e.target.index,n=e.source.index;t===n||l[n]&&l[n][t]?(e.circular=!0,e.circularLinkID=r++):e.circular=!1})}else e.links.forEach(function(e){t(e.source)<t(e.target)?e.circular=!1:(e.circular=!0,e.circularLinkID=r++)})}(h,l),function(e,t){var r=0,n=0;e.links.forEach(function(o){o.circular&&(o.circularLinkType=o.source.circularLinkType||o.target.circularLinkType?o.source.circularLinkType?o.source.circularLinkType:o.target.circularLinkType:n>r?"top":"bottom","top"==o.circularLinkType?r++:n++,e.nodes.forEach(function(e){it(e,t)!=it(o.source,t)&&it(e,t)!=it(o.target,t)||(e.circularLinkType=o.circularLinkType)}))}),e.links.forEach(function(e){e.circular&&(e.source.circularLinkType==e.target.circularLinkType&&(e.circularLinkType=e.source.circularLinkType),Je(e,t)&&(e.circularLinkType=e.source.circularLinkType))})}(h,s),function(e){e.nodes.forEach(function(e){e.partOfCycle=!1,e.value=Math.max(Rt(e.sourceLinks,lt),Rt(e.targetLinks,lt)),e.sourceLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)}),e.targetLinks.forEach(function(t){t.circular&&(e.partOfCycle=!0,e.circularLinkType=t.circularLinkType)})})}(h),function(e,t,r){var n,o,i;if(null!=t){e.nodes.sort(function(e,r){return t(e)<t(r)?-1:1});var a=0,s=t(e.nodes[0]);e.nodes.forEach(function(e){a=t(e)==s?a:a+1,s=t(e)==s?s:t(e),e.column=a})}for(n=e.nodes,o=[],i=0;n.length;++i,n=o,o=[])n.forEach(function(e){e.depth=i,e.sourceLinks.forEach(function(e){0>o.indexOf(e.target)&&!e.circular&&o.push(e.target)})});for(n=e.nodes,o=[],i=0;n.length;++i,n=o,o=[])n.forEach(function(e){e.height=i,e.targetLinks.forEach(function(e){0>o.indexOf(e.source)&&!e.circular&&o.push(e.source)})});e.nodes.forEach(function(e){e.column=null==t?r(e,i):e.column})}(h,l,c);var f=i;if(null!==a){var y=Tt(h.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]}),g=Dt(y,function(e){return e.length});g>1&&(f=Math.max(1,(n-t)*a/(g-1)))}(function(e,t,r){var n=Tt(e.nodes,function(e){return e.column}).sort(function(e,t){return e[0]-t[0]}).map(function(e){return e[1]});e.py=t;var o=Pt(n,function(t){return(e.y1-e.y0-(t.length-1)*e.py)/Rt(t,function(e){return e.value})});e.ky=o,e.links.forEach(function(t){t.width=t.value*e.ky});var i=Dt(e.nodes,function(e){return e.column});e.nodes.forEach(i>0?function(t){t.x0=e.x0+t.column*((e.x1-e.x0-r)/i),t.x1=t.x0+r}:function(t){t.x0=e.x0,t.x1=t.x0+r})})(h,f,o),zt(h,l,s),Ft(h,l,s,f,f,u),Bt(h),At(h,s,d,10,8),zt(h,l,s),Ft(h,l,s,f,f,u),Bt(h),At(h,s,d,10,8),function(e,t){let r=e;r.nodes.forEach(function(e){e.y+(e.y1-e.y0)>r.y1&&(e.y=e.y-(e.y+(e.y1-e.y0)-r.y1));var n=r.links.filter(function(r){return it(r.source,t)==it(e,t)}),o=n.length;o>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.target.column==t.target.column)return e.y1-t.y1;if(!_t(e,t))return e.y1-t.y1;if(e.target.column>t.target.column){var r=rt(t,e);return e.y1-r}if(t.target.column>e.target.column)return rt(e,t)-t.y1}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.target.column===t.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.target.column===t.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y0=i+e.width/2,i+=e.width}),n.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,a=0;o>i;i++)a+=n[i].width;t.y0=e.y1-a-t.width/2}})})}(h,s),function(e,t){let r=e;r.nodes.forEach(function(e){var n=r.links.filter(function(r){return it(r.target,t)==it(e,t)}),o=n.length;o>1&&n.sort(function(e,t){if(!e.circular&&!t.circular){if(e.source.column==t.source.column)return e.y0-t.y0;if(!_t(e,t))return e.y0-t.y0;if(e.source.column>t.source.column){var r=nt(t,e);return e.y0-r}if(t.source.column>e.source.column)return nt(e,t)-t.y0}return e.circular&&!t.circular?"top"==e.circularLinkType?-1:1:t.circular&&!e.circular?"top"==t.circularLinkType?1:-1:e.circular&&t.circular?e.circularLinkType===t.circularLinkType&&"top"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:e.source.column-t.source.column:e.circularLinkType===t.circularLinkType&&"bottom"==e.circularLinkType?e.source.column===t.source.column?e.source.y1-t.source.y1:t.source.column-e.source.column:"top"==e.circularLinkType?-1:1:void 0});var i=e.y0;n.forEach(function(e){e.y1=i+e.width/2,i+=e.width}),n.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,a=0;o>i;i++)a+=n[i].width;t.y1=e.y1-a-t.width/2}})})}(h,s),function(e){var t=e.nodes,r=e.links,n=!1,o=!1;if(r.forEach(function(e){"top"==e.circularLinkType?n=!0:"bottom"==e.circularLinkType&&(o=!0)}),0==n||0==o){let n=function(t){return(t-i)/(a-i)*(e.y1-e.y0)+e.y0};var i=Pt(t,function(e){return e.y0}),a=Dt(t,function(e){return e.y1}),s=(e.y1-e.y0)/(a-i);1>s?(t.forEach(function(e){e.y0=n(e.y0),e.y1=n(e.y1)}),r.forEach(function(e){e.y0=n(e.y0),e.y1=n(e.y1),e.width=e.width*s})):t.forEach(function(e){var t=e.y1-e.y0,r=n(e.y0)-e.y0;e.y0=n(e.y0),e.y1=e.y0+t,e.sourceLinks.forEach(function(e){e.y0=e.y0+r}),e.targetLinks.forEach(function(e){e.y1=e.y1+r})})}}(h),At(h,s,d,10,8)}(y),y}return y.update=function(e){return Bt(e),At(e,s,d,10,8),e},y.nodeWidth=function(e){return arguments.length?(o=+e,y):o},y.nodePadding=function(e){return arguments.length?(i=+e,y):i},y.nodePaddingRatio=function(e){return arguments.length?(a=+e,y):a},y.nodes=function(e){return arguments.length?(h="function"==typeof e?e:Ct(e),y):h},y.links=function(e){return arguments.length?(f="function"==typeof e?e:Ct(e),y):f},y.nodeId=function(e){return arguments.length?(s="function"==typeof e?e:Ct(e),y):s},y.nodeAlign=function(e){return arguments.length?(c="function"==typeof e?e:Ct(e),y):c},y.nodeSort=function(e){return arguments.length?(l=e,y):l},y.iterations=function(e){return arguments.length?(u=+e,y):u},y.circularLinkGap=function(e){return arguments.length?(d=+e,y):d},y.extent=function(o){return arguments.length?(e=+o[0][0],t=+o[0][1],r=+o[1][0],n=+o[1][1],y):[[e,t],[r,n]]},y.size=function(o){return arguments.length?(e=t=0,r=+o[0],n=+o[1],y):[r-e,n-t]},y}import{interpolateNumber as Ot}from"d3-interpolate";import{line as jt,curveLinearClosed as Xt}from"d3-shape";function Ht(e){const{sx:t,sTop:r,sBot:n,tx:o,tTop:i,tBot:a,cp1X:s,cp2X:c}=e,l=(r+n)/2,u=(i+a)/2;return{pathD:[`M${t},${r}`,`C${s},${r} ${c},${i} ${o},${i}`,`L${o},${a}`,`C${c},${a} ${s},${n} ${t},${n}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:t,y:l},{x:s,y:l},{x:c,y:u},{x:o,y:u}],halfWidth:(n-r)/2}}}var qt=e=>{let t,r,n,o,i,a,s,c,l;if("down"===e.direction)return t=e.y0-e.sankeyWidth/2,r=e.y1-e.sankeyWidth/2,n=e.y1+e.sankeyWidth/2,o=e.y0+e.sankeyWidth/2,i=e.source.x1,a=e.target.x0,s=Ot(i,a),c=s(.5),l=s(.5),`M${t},${i}C${t},${c} ${r},${l} ${r},${a}L${n},${a}C${n},${l} ${o},${c} ${o},${i}Z`;const u=e.sankeyWidth/2,d=Ot(e.source.x1,e.target.x0),{pathD:h}=Ht({sx:e.source.x1,sTop:e.y0-u,sBot:e.y0+u,tx:e.target.x0,tTop:e.y1-u,tBot:e.y1+u,cp1X:d(.5),cp2X:d(.5)});return h};function Vt(e){const t=e.sankeyWidth/2,r=(e._circularWidth??e.sankeyWidth)/2,n=e.circularPathData;if(!n)return null;if("down"===e.direction)return null;if(e._circularStub){const r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY;if("object"!=typeof e.source||!e.source||"object"!=typeof e.target||!e.target)return null;const s=Math.max(15,Math.min(40,.33*(n.rightFullExtent-r))),c=Math.max(15,Math.min(40,.33*(i-n.leftFullExtent)));return`M${r},${o-t}L${r+s},${o-t}L${r+s},${o+t}L${r},${o+t}ZM${i},${a-t}L${i-c},${a-t}L${i-c},${a+t}L${i},${a+t}Z`}const o=n.sourceX,i=n.sourceY,a=n.targetX,s=n.targetY,c=n.rightFullExtent,l=n.leftFullExtent,u=n.verticalFullExtent,d="bottom"===e.circularLinkType?1:-1,h=Math.max(4,Math.min(r,15));return`M${o},${i-d*t}L${c},${i-d*t}L${c+r},${i-d*t+d*h}L${c+r},${u+d*r-d*h}L${c+r-h},${u+d*r}L${l-r+h},${u+d*r}L${l-r},${u+d*r-d*h}L${l-r},${s-d*t+d*h}L${l-r+h},${s-d*t}L${a},${s-d*t}L${a},${s+d*t}L${l+r},${s+d*t}L${l+r},${u-d*r}L${c-r},${u-d*r}L${c-r},${i+d*t}L${o},${i+d*t}Z`}var Gt=new Set,Qt=new WeakMap;function Kt(e,t){if("production"===process.env.NODE_ENV)return e;if(!e||!e.data||"object"!=typeof e.data)return e;let r=Qt.get(e);if(r){const e=r.get(t);if(e)return e}else r=new Map,Qt.set(e,r);const n=new Proxy(e,{get(e,r,n){if("string"==typeof r&&!(r in e)&&e.data&&r in e.data){const e=`${t}:${r}`;Gt.has(e)||(Gt.add(e),console.warn(`[Semiotic] "${t}" callback accessed "${r}" on the wrapper object, but it only exists on ".data". Use d.data.${r} (or d.data?.${r}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(e,r,n)}});return r.set(t,n),n}var Zt={left:function(e){return e.depth},right:function(e,t){return t-1-e.height},center:function(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Math.min.apply(Math,e.sourceLinks.map(dt))-1:0},justify:ht},Ut={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,n){if(0===e.length)return;const o="vertical"===r.orientation?"down":"right",i=r.nodeAlign||"justify",a=r.nodeWidth??15,s=r.nodePaddingRatio??.05,c=r.iterations??100,l=e.map(e=>({...e})),u=t.map(e=>({...e,source:R(e.source),target:R(e.target),value:Math.sqrt(Math.max(1,e.value||1))}));let d;d="down"===o?[[0,0],[n[1],n[0]]]:[[0,0],[n[0],n[1]]];const h=Yt().extent(d).links(u).nodes(l).nodeAlign(Zt[i]||ht).nodeId(e=>e.id).nodeWidth(a).iterations(c);h.nodePaddingRatio&&h.nodePaddingRatio(s),h();{let e=1/0,t=-1/0,r=1/0,o=-1/0;for(const n of l)e>n.x0&&(e=n.x0),n.x1>t&&(t=n.x1),r>n.y0&&(r=n.y0),n.y1>o&&(o=n.y1);for(const n of u){if(!n.circular||!n.circularPathData)continue;const i=n.circularPathData,a=(n._circularWidth??n.width??0)/2;e>i.leftFullExtent-a&&(e=i.leftFullExtent-a),i.rightFullExtent+a>t&&(t=i.rightFullExtent+a),r>i.verticalFullExtent-a&&(r=i.verticalFullExtent-a),i.verticalFullExtent+a>o&&(o=i.verticalFullExtent+a)}const i=t-e,a=o-r,s=n[0],c=n[1];if(i>0&&a>0&&(0>e||0>r||t>s||o>c)){const t=Math.min(s/i,c/a),n=-e*t+(s-i*t)/2,o=-r*t+(c-a*t)/2;for(const e of l)e.x0=e.x0*t+n,e.x1=e.x1*t+n,e.y0=e.y0*t+o,e.y1=e.y1*t+o;for(const e of u)if(e.y0=e.y0*t+o,e.y1=e.y1*t+o,e.width=(e.width??0)*t,e._circularWidth&&(e._circularWidth*=t),e.circular&&e.circularPathData){const r=e.circularPathData;r.sourceX=r.sourceX*t+n,r.targetX=r.targetX*t+n,r.sourceY=r.sourceY*t+o,r.targetY=r.targetY*t+o,r.rightFullExtent=r.rightFullExtent*t+n,r.leftFullExtent=r.leftFullExtent*t+n,r.verticalFullExtent=r.verticalFullExtent*t+o,r.rightInnerExtent=r.rightInnerExtent*t+n,r.leftInnerExtent=r.leftInnerExtent*t+n,r.verticalRightInnerExtent=r.verticalRightInnerExtent*t+o,r.verticalLeftInnerExtent=r.verticalLeftInnerExtent*t+o,r.rightSmallArcRadius*=t,r.rightLargeArcRadius*=t,r.leftSmallArcRadius*=t,r.leftLargeArcRadius*=t,r.sourceWidth*=t,r.rightNodeBuffer*=t,r.leftNodeBuffer*=t,r.arcRadius*=t}}}const f=new Map;for(const t of e)f.set(t.id,t);for(const e of l){const t=f.get(e.id);t&&(t.x0=e.x0,t.x1=e.x1,t.y0=e.y0,t.y1=e.y1,t.value=e.value,t.depth=e.depth,t.sourceLinks=e.sourceLinks,t.targetLinks=e.targetLinks,t.width=e.x1-e.x0,t.height=e.y1-e.y0,t.x=e.x0+(e.x1-e.x0)/2,t.y=e.y0+(e.y1-e.y0)/2)}const y=new Map;for(const e of t)if(e._edgeKey)y.set(e._edgeKey,e);else{const t=R(e.source),r=R(e.target);y.set(`${t}\0${r}`,e)}for(const e of u){const t=R(e.source),r=R(e.target),n=y.get(e._edgeKey?e._edgeKey:`${t}\0${r}`);if(n){n.y0=e.y0,n.y1=e.y1,n.sankeyWidth=e.width??0,n.circular=!!e.circular,n.circularPathData=e.circularPathData,n._circularWidth=e._circularWidth,n._circularStub=e._circularStub,n.path=e.path,n.circularLinkType=e.circularLinkType,n.direction=o;const i=f.get(t),a=f.get(r);i&&(n.source=i),a&&(n.target=a)}}},buildScene(e,t,r,n){const o="vertical"===r.orientation?"down":"right",i=r.nodeStyle,a=r.edgeStyle,s=r.edgeOpacity??.5,c=r.edgeColorBy||"source",l=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:Se,u=new Map;e.forEach((e,t)=>{u.set(e.id,l[t%l.length])});const d=[],h=[],f=[],y=new Map;for(const t of e){const e=t.x1-t.x0,r=t.y1-t.y0;if(0>=e||0>=r)continue;const n=i?i(Kt(t,"nodeStyle")):{},a={fill:n.fill||u.get(t.id)||"#4d430c",stroke:n.stroke,strokeWidth:n.strokeWidth,opacity:n.opacity};y.set(t.id,("string"==typeof a.fill?a.fill:null)||u.get(t.id)||"#4d430c"),d.push("down"===o?{type:"rect",x:t.y0,y:t.x0,w:r,h:e,style:a,datum:t,id:t.id,label:t.id}:{type:"rect",x:t.x0,y:t.y0,w:e,h:r,style:a,datum:t,id:t.id,label:t.id})}const g=[...t].sort((e,t)=>(t.sankeyWidth||0)-(e.sankeyWidth||0));for(const e of g){if(!e.sankeyWidth||0>=e.sankeyWidth)continue;const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=r.themeSemantic?.border||r.themeSemantic?.secondary||"#999";o="function"==typeof c?c(e)||o:"target"===c?y.get(n.id)||u.get(n.id)||o:y.get(t.id)||u.get(t.id)||o;const i=a?a(Kt(e,"edgeStyle")):{};if(e._circularStub&&e.circular&&e.circularPathData){const t=e.circularPathData,r=e.sankeyWidth/2,n=Math.max(15,Math.min(40,.33*(t.rightFullExtent-t.sourceX))),a=Math.max(15,Math.min(40,.33*(t.targetX-t.leftFullExtent))),c=i.fill||o;h.push({type:"bezier",pathD:`M${t.sourceX},${t.sourceY-r}L${t.sourceX+n},${t.sourceY-r}L${t.sourceX+n},${t.sourceY+r}L${t.sourceX},${t.sourceY+r}Z`,style:{fill:c,fillOpacity:i.fillOpacity??s,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"right",from:1,to:0,x0:t.sourceX,x1:t.sourceX+n}}),h.push({type:"bezier",pathD:`M${t.targetX},${t.targetY-r}L${t.targetX-a},${t.targetY-r}L${t.targetX-a},${t.targetY+r}L${t.targetX},${t.targetY+r}Z`,style:{fill:c,fillOpacity:i.fillOpacity??s,stroke:"none",opacity:i.opacity},datum:e,_gradient:{direction:"left",from:0,to:1,x0:t.targetX-a,x1:t.targetX}});continue}let l;(l=e.circular&&e.circularPathData?Vt(e):qt(e),l)&&h.push({type:"bezier",pathD:l,bezierCache:e.bezier,style:{fill:i.fill||o,fillOpacity:i.fillOpacity??s,stroke:i.stroke||"none",strokeWidth:i.strokeWidth,opacity:i.opacity},datum:e})}if(!1!==r.showLabels){const t=D(r.nodeLabel);for(const r of e){const e=r.x1-r.x0,i=r.y1-r.y0;if(0>=e||0>=i)continue;const a=t?t(r):r.id;if(!a)continue;let s,c,l;"down"===o?(s=r.y0+(r.y1-r.y0)/2,c=r.x1+14,l="start"):(n[0]/2>r.x0+e/2?(s=r.x0-6,l="end"):(s=r.x1+6,l="start"),c=r.y0+i/2),f.push({x:s,y:c,text:a+"",anchor:"down"===o?"middle":l,baseline:"middle",fontSize:11})}}return{sceneNodes:d,sceneEdges:h,labels:f}}};import{forceSimulation as Jt,forceCenter as er,forceX as tr,forceY as rr,forceLink as nr,forceManyBody as or,forceCollide as ir}from"d3-force";import{scaleLinear as ar}from"d3-scale";var sr={supportsStreaming:!0,hierarchical:!1,computeLayout(e,t,r,n){if(0===e.length)return;const o=r.forceStrength??.1,i=n[0]/2,a=n[1]/2,s=Math.max(.1,Math.min(1,Math.min(n[0],n[1])/200)),c=Math.min(.5,.06+1.8*(1-s)),l=r.__previousPositions;let u=0;const d=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),r=l?.get(t.id);e?u++:r?(t.x=r.x,t.y=r.y,u++):d.push(t)}const h=u>0&&.3>=(e.length>0?d.length/e.length:1);if(h){const r=new Map;for(const t of e)r.set(t.id,t);for(const e of d){const n=cr(e.id,t,r);if(n.length>0){let t=0,r=0;for(const e of n)t+=e.x,r+=e.y;const o=lr(e.id),i=o%360*(Math.PI/180),a=(10+o%20)*s;e.x=t/n.length+a*Math.cos(i),e.y=r/n.length+a*Math.sin(i)}else{const t=lr(e.id),r=t%360*(Math.PI/180),n=(15+t%30)*s;e.x=i+n*Math.cos(r),e.y=a+n*Math.sin(r)}}}else{const t=2.399963229728653;for(let r=0;e.length>r;r++){const n=e[r];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(r+.5)*s,o=r*t;n.x=i+e*Math.cos(o),n.y=a+e*Math.sin(o)}}}const f=r.__skipForceSimulation||0===r.iterations?0:h?40:r.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),y=ur(r.nodeSize,r.nodeSizeRange,e),g=e=>y(e);if(f>0){const l=new Map,u=new Map;for(const t of e)l.set(t.id,0),u.set(t.id,t);for(const e of t){const t=R(e.source),r=R(e.target);l.set(t,(l.get(t)??0)+1),l.set(r,(l.get(r)??0)+1)}const d=nr().strength(e=>{const t=e.weight,r=R(e.source),n=R(e.target),i=Math.max(1,Math.min(l.get(r)??1,l.get(n)??1));return Math.min(2.5,(t&&t>0?Math.sqrt(t):1)*o/(.1*i))}).distance(e=>{const t="string"==typeof e.source?u.get(e.source):e.source,r="string"==typeof e.target?u.get(e.target):e.target,n=(t?g(t):0)+(r?g(r):0)+Math.max(6,12*s);return Math.max(16,40*s,n)}).id(e=>e.id),y=Jt();if(void 0===r.random&&void 0===r.seed||y.randomSource(r.random??ee(r.seed)),y.force("charge",or().strength(e=>{const t=l.get(e.id)??0;return-15*s*g(e)*Math.sqrt(t+1)})).force("collide",ir(e=>g(e)+3*s).strength(.9).iterations(2)).force("center",er(i,a).strength(.8)).force("x",tr(i).strength(c)).force("y",rr(a).strength(c)).force("bounds",function(e,t,r=2,n=.6){let o=[];const i=i=>{const a=n*Math.max(i,.2);for(const n of o){const o=n.x??e[0]/2,i=n.y??e[1]/2,s=n.vx??0,c=n.vy??0,l=t(n)+r,u=Math.min(e[0]/2,l),d=Math.max(e[0]/2,e[0]-l),h=Math.min(e[1]/2,l),f=Math.max(e[1]/2,e[1]-l),y=o+s,g=i+c;u>y?n.vx=s+(u-y)*a:y>d&&(n.vx=s+(d-y)*a),h>g?n.vy=c+(h-g)*a:g>f&&(n.vy=c+(f-g)*a)}};return i.initialize=e=>{o=e},i}(n,g)),y.nodes(e),t.length>0){const e=t.map(e=>({...e,source:R(e.source),target:R(e.target)}));d.links(e),y.force("link",d)}h?y.alpha(.3):.1>y.alpha()&&y.alpha(1),y.stop();for(let e=0;f>e;++e)y.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=g(t),r=f>0?2:0,o=Math.min(n[0]/2,e+r),i=Math.min(n[1]/2,e+r);t.x=Math.max(o,Math.min(n[0]-o,t.x)),t.y=Math.max(i,Math.min(n[1]-i,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const p=new Map;for(const t of e)p.set(t.id,t);for(const e of t){if("string"==typeof e.source){const t=p.get(e.source);t&&(e.source=t)}if("string"==typeof e.target){const t=p.get(e.target);t&&(e.target=t)}}},buildScene(e,t,r,n){const o=r.nodeStyle,i=r.edgeStyle,a=ur(r.nodeSize,r.nodeSizeRange,e),s=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:Se,c=new Map;e.forEach((e,t)=>{c.set(e.id,s[t%s.length])});const l=[],u=[],d=[];for(const t of e){if(null==t.x||null==t.y)continue;const e=a(Kt(t,"nodeSize")),n=o?o(Kt(t,"nodeStyle")):{},i={fill:n.fill||c.get(t.id)||r.themeSemantic?.primary||"#007bff",stroke:n.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??2,opacity:n.opacity};l.push({type:"circle",cx:t.x,cy:t.y,r:e,style:i,datum:t,id:t.id,label:t.id})}const h=new Map;for(const t of e)h.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:h.get(e.source),n="object"==typeof e.target?e.target:h.get(e.target);if(!t||!n)continue;if(null==t.x||null==t.y)continue;if(null==n.x||null==n.y)continue;const o=i?i(Kt(e,"edgeStyle")):{};u.push({type:"line",x1:t.x,y1:t.y,x2:n.x,y2:n.y,style:{stroke:o.stroke||r.themeSemantic?.border||r.themeSemantic?.secondary||"#999",strokeWidth:o.strokeWidth??1,opacity:o.opacity??.6},datum:e})}if(!1!==r.showLabels){const t=D(r.nodeLabel);for(const r of e){if(null==r.x||null==r.y)continue;const e=t?t(r):r.id;if(!e)continue;const n=a(Kt(r,"nodeSize"));d.push({x:r.x,y:r.y-n-4,text:e+"",anchor:"middle",baseline:"auto",fontSize:11})}}return{sceneNodes:l,sceneEdges:u,labels:d}}};function cr(e,t,r){const n=[];for(const o of t){const t=R(o.source),i=R(o.target);let a=null;if(t===e?a=i:i===e&&(a=t),a){const e=r.get(a);!e||0===e.x&&0===e.y||n.push({x:e.x,y:e.y})}}return n}function lr(e){let t=0;for(let r=0;e.length>r;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return Math.abs(t)}function ur(e,t,r){if(r.some(e=>null!=e.__forceRadius))return e=>e.__forceRadius??8;if(null==e)return()=>8;if("number"==typeof e)return()=>e;if("function"==typeof e)return t=>e(t)||8;const n=t||[5,20],o=[];for(const t of r){const r=t.data?.[e];"number"==typeof r&&o.push(r)}if(0===o.length)return()=>n[0];const[i,a]=Re(o);if(i===a)return()=>(n[0]+n[1])/2;const s=ar().domain([i,a]).range(n).clamp(!0);return t=>{const r=t.data?.[e];return null==r||"number"!=typeof r?n[0]:s(r)}}import{chord as dr,ribbon as hr}from"d3-chord";import{arc as fr}from"d3-shape";var yr=Se,gr={supportsStreaming:!1,hierarchical:!1,computeLayout(e,t,r,n){if(0===e.length)return;const{padAngle:o=.01,groupWidth:i=20,sortGroups:a}=r,s=Math.min(n[0],n[1])/2,c=s-i,l=n[0]/2,u=n[1]/2,d=(h=r.valueAccessor)?"function"==typeof h?h:e=>e[h]??1:e=>e.value??1;var h;const f=new Map;for(let t=0;e.length>t;t++)f.set(e[t].id,t);const y=e.length,g=Array.from({length:y},()=>Array.from({length:y},()=>0));for(const e of t){const t=R(e.source),r=R(e.target),n=f.get(t),o=f.get(r);if(void 0===n||void 0===o)continue;const i=d(e);g[n][o]=i}const p=dr().padAngle(o);a&&p.sortGroups(a);const m=p(g),v=m.groups,x=fr().innerRadius(c).outerRadius(s);for(const t of v){const r=e[t.index],n=x.centroid({innerRadius:c,outerRadius:s,startAngle:t.startAngle,endAngle:t.endAngle});r.x=n[0]+l,r.y=n[1]+u,r.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}const k=new Map;for(const t of e)k.set(t.id,t);for(const e of t){const t=R(e.source),r=R(e.target),n=k.get(t),o=k.get(r);n&&(e.source=n),o&&(e.target=o)}const b=new Map;for(const e of t){const t=R(e.source),r=R(e.target);b.set(`${t}\0${r}`,e)}for(const t of m){const r=e[t.source.index].id,n=e[t.target.index].id,o=b.get(`${r}\0${n}`)||b.get(`${n}\0${r}`);o&&(o.__chordData=t)}},buildScene(e,t,r,n){const{groupWidth:o=20,edgeOpacity:i=.5}=r,a=Math.min(n[0],n[1])/2,s=a-o,c=n[0]/2,l=n[1]/2,u=r.nodeStyle,d=r.edgeStyle,h=r.edgeColorBy||"source",f=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:yr,y=new Map;e.forEach((e,t)=>{y.set(e.id,f[t%f.length])});const g=hr().radius(s),p=[],m=[],v=[];for(let t=0;e.length>t;t++){const r=e[t],n=r.__arcData;if(!n)continue;let o;o=u?u(Kt(r,"nodeStyle")).fill||y.get(r.id)||f[t%f.length]:y.get(r.id)||f[t%f.length];const i=u?u(Kt(r,"nodeStyle")):{};p.push({type:"arc",cx:c,cy:l,innerR:s,outerR:a,startAngle:n.startAngle-Math.PI/2,endAngle:n.endAngle-Math.PI/2,style:{fill:o,stroke:i.stroke||"black",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:r,id:r.id,label:r.id})}for(const e of t){const t=e.__chordData;if(!t)continue;const n=g(t);if(!n)continue;const o=pr(n,c,l);let a=r.themeSemantic?.border||r.themeSemantic?.secondary||"#999";if(d)a=d(Kt(e,"edgeStyle")).fill||a;else{const t="object"==typeof e.source?e.source:null,r="object"==typeof e.target?e.target:null;"target"===h&&r?a=y.get(r.id)||a:t&&(a=y.get(t.id)||a)}const s=d?d(Kt(e,"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:e})}if(!1!==r.showLabels){const t=D(r.nodeLabel),n=a+12;for(const r of e){const e=r.__arcData;if(!e)continue;const o=t?t(r):r.id;if(!o)continue;const i=(e.startAngle+e.endAngle)/2,a=i-Math.PI/2;v.push({x:c+Math.cos(a)*n,y:l+Math.sin(a)*n,text:o+"",anchor:i>Math.PI?"end":"start",baseline:"middle",fontSize:11})}}return{sceneNodes:p,sceneEdges:m,labels:v}}};function pr(e,t,r){const n=e.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!n)return e;const o=[];let i=0;for(;n.length>i;){const e=n[i];if("M"===e||"L"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("C"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;3>e&&n.length>i&&!isNaN(Number(n[i]));e++)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("Q"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)for(let e=0;2>e&&n.length>i&&!isNaN(Number(n[i]));e++)o.push(Number(n[i])+t+""),i++,n.length>i&&!isNaN(Number(n[i]))&&(o.push(Number(n[i])+r+""),i++);else if("A"===e)for(o.push(e),i++;n.length>i&&!isNaN(Number(n[i]));)o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&o.push(n[i++]),n.length>i&&(o.push(Number(n[i])+t+""),i++),n.length>i&&(o.push(Number(n[i])+r+""),i++);else"Z"===e||"z"===e?(o.push(e),i++):(o.push(n[i]),i++)}return o.join(" ")}import{hierarchy as mr,tree as vr,cluster as xr,treemap as kr,pack as br,partition as _r,treemapBinary as Sr}from"d3-hierarchy";var wr=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"];function Ar(e){const[t,r,n]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*r+.114*n>150?"#222":"#fff"}function Lr(e,t,r){const n=t.nodeIDAccessor;return"function"==typeof n?n(e.data)+"":"string"==typeof n&&void 0!==e.data[n]?e.data[n]+"":void 0!==e.data.name?e.data.name+"":void 0!==e.data.id?e.data.id+"":"node-"+r}function Er(e){if(!e)return null;if("function"==typeof e){const t=e;return e=>t(e.data??e)}return t=>t.data?.[e]||t[e]||t.id}function Pr(e){return Array.isArray(e.colorScheme)?e.colorScheme:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical:wr}function Dr(e){return Array.isArray(e.colorScheme)&&e.colorScheme.length>0?e.colorScheme[0]:e.themeSemantic?.primary?e.themeSemantic.primary:e.themeCategorical&&e.themeCategorical.length>0?e.themeCategorical[0]:"#4d430c"}function Rr(e,t,r,n,o){if("horizontal"===o){const o=(e+r)/2;return`M ${e},${t} C ${o},${t} ${o},${n} ${r},${n}`}if("radial"===o){const o=(e+r)/2;return`M ${e},${t} Q ${o},${t} ${o},${(t+n)/2} T ${r},${n}`}{const o=(t+n)/2;return`M ${e},${t} C ${e},${o} ${r},${o} ${r},${n}`}}var Mr={supportsStreaming:!1,hierarchical:!0,computeLayout(e,t,r,n){const o=r.__hierarchyRoot;if(!o)return;const i=r.chartType,a=function(e){if(e)return"function"==typeof e?e:t=>t[e]}(r.childrenAccessor),s=r.hierarchySum,c="function"==typeof s?s:"string"==typeof s?e=>Number(e[s])||0:e=>Number(e.value)||0,l=mr(o,a);l.sum(c),l.sort((e,t)=>(t.value??0)-(e.value??0));const[u,d]=n;switch(i){case"tree":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=vr();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(l,r,u,d);break;case"cluster":!function(e,t,r,n){const o=t.treeOrientation||"vertical",i=xr();i.size("horizontal"===o?[n,r]:"radial"===o?[2*Math.PI,Math.min(r,n)/2*.8]:[r,n]),i(e)}(l,r,u,d);break;case"treemap":!function(e,t,r,n){const o=t.padding??4,i=t.paddingTop??0,a=kr().size([r,n]).tile(Sr).padding(o);i>0&&a.paddingTop(i),a(e)}(l,r,u,d);break;case"circlepack":!function(e,t,r,n){const o=t.padding??4;br().size([r,n]).padding(o)(e)}(l,r,u,d);break;case"partition":!function(e,t,r,n){_r().size([r,n]).padding(t.padding??1)(e)}(l,r,u,d)}const h=l.descendants();e.length=0,t.length=0;const f=new Map;for(let t=0;h.length>t;t++){const n=h[t],o={id:Lr(n,r,t),x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:n.value??0,depth:n.depth,data:n.data,createdByFrame:!0};"tree"===i||"cluster"===i?Nr(o,n,r):"treemap"===i||"partition"===i?Tr(o,n):"circlepack"===i&&Cr(o,n),o.__hierarchyNode=n,e.push(o),f.set(n,o)}if("tree"===i||"cluster"===i)for(const e of h)if(e.parent){const r=f.get(e.parent),n=f.get(e);r&&n&&t.push({source:r,target:n,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:e.depth}})}},buildScene(e,t,r,n){const o=r.nodeStyle||(()=>({})),i=r.edgeStyle||(()=>({}));switch(r.chartType){case"tree":case"cluster":return function(e,t,r,n,o,i){const a=[],s=[],c=[],l=r.treeOrientation||"vertical",u="radial"===l,d=n[0]/2,h=n[1]/2,f="number"==typeof(y=r.nodeSize)?y:5;var y;for(const t of e){let e=t.x,n=t.y;u&&(e+=d,n+=h);const i=o(Kt(t,"nodeStyle"));let s=i.fill||Dr(r);if(r.colorByDepth&&void 0!==t.depth){const e=Pr(r);s=e[t.depth%e.length]}a.push({type:"circle",cx:e,cy:n,r:f,style:{fill:s,stroke:i.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity},datum:t,id:t.id,label:t.id,depth:t.depth})}const g=r.edgeOpacity??.5;for(const e of t){const t="object"==typeof e.source?e.source:null,n="object"==typeof e.target?e.target:null;if(!t||!n)continue;let o=t.x,a=t.y,c=n.x,f=n.y;u&&(o+=d,a+=h,c+=d,f+=h);const y=Rr(o,a,c,f,l),p=i(Kt(e,"edgeStyle"));s.push({type:"curved",pathD:y,style:{fill:"none",stroke:p.stroke||r.themeSemantic?.border||r.themeSemantic?.secondary||"#999",strokeWidth:p.strokeWidth??1.5,opacity:p.opacity??g},datum:e})}if(!1!==r.showLabels){const t=Er(r.nodeLabel);for(const r of e){const e=t?t(r):r.id;if(!e)continue;let n,o,i,a=r.x,s=r.y;if(u&&(a+=d,s+=h),u){const e=a-d,t=s-h,r=Math.sqrt(e*e+t*t);r>0?(n=a+e/r*10,o=s+t/r*10,i=0>e?"end":"start"):(n=a,o=s-12,i="middle")}else"horizontal"===l?(r.data?.children&&0!==r.data.children.length?(n=a-f-6,i="end"):(n=a+f+6,i="start"),o=s):(n=a,o=s+f+14,i="middle");c.push({x:n,y:o,text:e+"",anchor:i,baseline:"middle",fontSize:11})}}return{sceneNodes:a,sceneEdges:s,labels:c}}(e,t,r,n,o,i);case"treemap":case"partition":return function(e,t,r,n){const o=[],i=[];for(const r of e){const e=r.x1-r.x0,i=r.y1-r.y0;if(0>=e||0>=i)continue;const a=n(Kt(r,"nodeStyle"));let s=a.fill||Dr(t);if(t.colorByDepth&&void 0!==r.depth){const e=Pr(t);s=e[r.depth%e.length]}o.push({type:"rect",x:r.x0,y:r.y0,w:e,h:i,style:{fill:s,stroke:a.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??1,opacity:a.opacity,fillOpacity:a.fillOpacity,strokeOpacity:a.strokeOpacity},datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=Er(t.nodeLabel),o=t.labelMode||"leaf",a="partition"===t.chartType;for(const s of e){const e=s.x1-s.x0,c=s.y1-s.y0;if(0>=e||0>=c)continue;const l=!(s.data?.children&&s.data.children.length>0);if(!a){if("leaf"===o&&!l)continue;if("parent"===o&&l)continue}const u=r?r(s):s.id;if(!u)continue;if((l?30:40)>e||(l?16:14)>c)continue;let d=n(Kt(s,"nodeStyle")).fill||Dr(t);if(t.colorByDepth&&void 0!==s.depth){const e=Pr(t);d=e[s.depth%e.length]}const h="string"==typeof d?Ar(d):t.themeSemantic?.text??"#000";i.push(l?{x:s.x0+e/2,y:s.y0+c/2,text:u+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(e,c)/6)),fill:h}:{x:s.x0+4,y:s.y0+12,text:u+"",anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:h})}}return{sceneNodes:o,sceneEdges:[],labels:i}}(e,r,0,o);case"circlepack":return function(e,t,r,n){const o=[],i=[];for(const r of e){const e=r.__radius??5;if(0>=e)continue;const i=n(Kt(r,"nodeStyle"));let a=i.fill||Dr(t);if(t.colorByDepth&&void 0!==r.depth){const e=Pr(t);a=e[r.depth%e.length]}o.push({type:"circle",cx:r.x,cy:r.y,r:e,style:{fill:a,stroke:i.stroke||t.themeSemantic?.surface||"#fff",strokeWidth:i.strokeWidth??1,opacity:i.opacity??.7},datum:r,id:r.id,label:r.id,depth:r.depth})}if(!1!==t.showLabels){const r=Er(t.nodeLabel);for(const o of e){const e=o.__radius??5,a=r?r(o):o.id;if(!a)continue;if(15>e)continue;const s=!(o.data?.children&&o.data.children.length>0);let c=n(Kt(o,"nodeStyle")).fill||Dr(t);if(t.colorByDepth&&void 0!==o.depth){const e=Pr(t);c=e[o.depth%e.length]}if(s){const r="string"==typeof c?Ar(c):t.themeSemantic?.text??"#000";i.push({x:o.x,y:o.y,text:a+"",anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,e/3)),fill:r})}else i.push({x:o.x,y:o.y-e+14,text:a+"",anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,e/3)),fill:t.themeSemantic?.text||"#000",stroke:t.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:o,sceneEdges:[],labels:i}}(e,r,0,o);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}};function Nr(e,t,r){const n=r.treeOrientation||"vertical";if("radial"===n){const r=t.x,n=t.y;e.x=n*Math.cos(r-Math.PI/2),e.y=n*Math.sin(r-Math.PI/2)}else"horizontal"===n?(e.x=t.y,e.y=t.x):(e.x=t.x,e.y=t.y);e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10}function Tr(e,t){e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.x=(t.x0+t.x1)/2,e.y=(t.y0+t.y1)/2,e.width=t.x1-t.x0,e.height=t.y1-t.y0}function Cr(e,t){const r=t.r??0;e.x=t.x,e.y=t.y,e.x0=t.x-r,e.x1=t.x+r,e.y0=t.y-r,e.y1=t.y+r,e.width=2*r,e.height=2*r,e.__radius=r}import{pie as Ir}from"d3-shape";function Wr(e){let t=e.__orbitState;return t||(t={metaMap:new Map,startTime:"undefined"!=typeof performance?performance.now():Date.now()},e.__orbitState=t),t}var $r={sankey:Ut,force:sr,chord:gr,tree:Mr,cluster:Mr,treemap:Mr,circlepack:Mr,partition:Mr,orbit:{supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(e,t,r,n){const o=r.__hierarchyRoot;o&&function(e,t,r,n,o){const i=function(e){if("function"==typeof e)return e;const t=e||"children";return e=>e[t]||null}(r.childrenAccessor),a=function(e){if("function"==typeof e)return e;const t=e||"name";return e=>(e[t]??"")+""}(r.nodeIDAccessor),s=function(e){if(Array.isArray(e))return e;switch(e){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(r.orbitMode),c=r.orbitSize??2.95,l=r.orbitEccentricity??1,u="number"==typeof c?()=>c:c,d="number"==typeof l?()=>l:l,h=Wr(r);h.metaMap.clear(),n.length=0,o.length=0;const f=new Map;function y(e){const t=f.get(e)??0;return f.set(e,t+1),0===t?e:`${e}__${t}`}const g=t[0]/2,p=t[1]/2,m=Math.min(t[0],t[1])/2*.85,v=y(a(e));n.push({id:v,x:g,y:p,x0:g,x1:g,y0:p,y1:p,width:0,height:0,value:0,depth:0,data:e}),h.metaMap.set(v,{ring:m,angle:0,depth:0,parentId:null,eccentricity:1}),function e(t,r,c,l,f,g,p){const m=i(t);if(!m?.length)return;const v=m.length;let x=0,k=0,b=0;for(;v>k;)k+=s[Math.min(b,s.length-1)],b++,x++;let _=0;for(let v=0;x>v;v++){const k=s[Math.min(v,s.length-1)],b=m.slice(_,_+k);if(!b.length)break;const S=(v+1)/x,w={id:r,depth:g,data:t,parentId:r},A=p?f/u(w)*S:f*S,L=Ir().value(e=>{const t=i(e)?.length;return t?4:1}).sort(null)(b),E=d(w);for(let t=0;b.length>t;t++){const i=(L[t].startAngle+L[t].endAngle)/2,s=b[t],u=y(a(s)),d=c+A*Math.sin(i),f=l+A*Math.cos(i)*E;n.push({id:u,x:d,y:f,x0:d,x1:d,y0:f,y1:f,width:0,height:0,value:0,depth:g,data:s}),h.metaMap.set(u,{ring:A,angle:i,depth:g,parentId:r,eccentricity:E}),o.push({source:r,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:r,target:u}}),e(s,u,d,f,A,g+1,!0)}_+=k}}(e,v,g,p,m,1,!1)}(o,n,r,e,t)},buildScene(e,t,r,n){const o=r.nodeStyle,i=r.nodeSize,a="number"==typeof i?()=>i:"function"==typeof i?i:()=>6,s=[],c=[],l=[];if(!1!==r.orbitShowRings){const t=Wr(r),n=new Map;for(const t of e)n.set(t.id,t);const o=new Map;for(const[,e]of t.metaMap){if(!e.parentId)continue;const t=n.get(e.parentId);if(!t)continue;const r=`${e.parentId}:${e.ring}`;o.has(r)||o.set(r,{parentX:t.x,parentY:t.y,ring:e.ring,ecc:e.eccentricity})}const i=48,a={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(const[,{parentX:e,parentY:t,ring:r,ecc:n}]of o)for(let o=0;i>o;o++){const s=o/i*Math.PI*2,l=(o+1)/i*Math.PI*2;c.push({type:"line",x1:e+r*Math.sin(s),y1:t+r*Math.cos(s)*n,x2:e+r*Math.sin(l),y2:t+r*Math.cos(l)*n,style:a,datum:null})}}for(const t of e){if(null==t.x||null==t.y)continue;const e=a(Kt(t,"nodeSize")),n=o?o(Kt(t,"nodeStyle")):{};s.push({type:"circle",cx:t.x,cy:t.y,r:e,style:{fill:n.fill||r.themeSemantic?.primary||"#6366f1",stroke:n.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:n.strokeWidth??1,opacity:n.opacity??(0===(t.depth??0)?1:.85)},datum:t,id:t.id,label:t.id,depth:t.depth})}const u=new Map;for(const t of e)u.set(t.id,t);for(const e of t){const t="object"==typeof e.source?e.source:u.get(e.source),r="object"==typeof e.target?e.target:u.get(e.target);t&&r&&(null!=t.x&&null!=r.x&&c.push({type:"line",x1:t.x,y1:t.y,x2:r.x,y2:r.y,style:{stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1},datum:e}))}if(r.showLabels){const t=r.nodeLabel;for(const r of e){const e=a(Kt(r,"nodeSize"));if(4>=e)continue;const n="function"==typeof t?t(r):t?r.data?.[t]??r.id:r.id;l.push({x:r.x,y:r.y+e+12,text:n+"",anchor:"middle",fontSize:10,fill:"currentColor"})}}return{sceneNodes:s,sceneEdges:c,labels:l}},tick:(e,t,r,n,o)=>!1!==r.orbitAnimated&&(function(e,t){const r=Wr(t),n=t.orbitSpeed??.25,o=t.orbitRevolution??function(e){switch(e){case"decay":return e=>Math.pow(.6,e.depth??0);case"alternate":return e=>{const t=e.depth??0;return(t%2==0?1:-1)/(t+1)};default:return e=>1/((e.depth??0)+1)}}(t.orbitRevolutionStyle),i=(("undefined"!=typeof performance?performance.now():Date.now())-r.startTime)/1e3,a=n*(Math.PI/6),s=new Map;for(const t of e)s.set(t.id,t);for(const t of e){const e=r.metaMap.get(t.id);if(!e||!e.parentId)continue;const n=s.get(e.parentId);if(!n)continue;const c=e.angle+i*a*o({id:t.id,depth:e.depth,data:t.data,parentId:e.parentId});t.x=n.x+e.ring*Math.sin(c),t.y=n.y+e.ring*Math.cos(c)*e.eccentricity,t.x0=t.x,t.x1=t.x,t.y0=t.y,t.y1=t.y}}(e,r),!0)}};function zr(e){return $r[e]}import{quadtree as Fr}from"d3-quadtree";function Br(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function Yr(e){if(!e||"object"!=typeof e)return!1;const t=e;if("boolean"!=typeof t.circular)return!1;if("number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(const e of t.segments)if(!Or(e))return!1;return!0}return Or(t.points)}function Or(e){if(!Array.isArray(e)||4!==e.length)return!1;for(const t of e){if(!t||"object"!=typeof t)return!1;const e=t;if("number"!=typeof e.x||!Number.isFinite(e.x))return!1;if("number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}import{interpolateNumber as jr}from"d3-interpolate";var Xr="rgba(34, 197, 94, 0.7)",Hr=2e3,qr=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Vr=["scene-style","data-paint","accessibility","evidence"],Gr=(e,t)=>({retainedData:e,invalidations:t}),Qr=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Kr=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Zr=["scene-geometry","data-paint","overlay","accessibility","evidence"],Ur=["scene-style","data-paint","accessibility","evidence"],Jr=["scene-geometry","data-paint","overlay","accessibility","evidence"],en=[],tn={chartType:Gr("rebuild",Qr),nodeIDAccessor:Gr("rebuild",Qr),sourceAccessor:Gr("rebuild",Qr),targetAccessor:Gr("rebuild",Qr),valueAccessor:Gr("rebuild",Qr),edgeIdAccessor:Gr("rebuild",Qr),childrenAccessor:Gr("rebuild",Qr),hierarchySum:Gr("rebuild",Qr),orientation:Gr("preserve",Kr),nodeAlign:Gr("preserve",Kr),nodePaddingRatio:Gr("preserve",Kr),nodeWidth:Gr("preserve",Kr),edgeSort:Gr("preserve",Kr),iterations:Gr("preserve",Kr),forceStrength:Gr("preserve",Kr),padAngle:Gr("preserve",Kr),groupWidth:Gr("preserve",Kr),sortGroups:Gr("preserve",Kr),treeOrientation:Gr("preserve",Kr),edgeType:Gr("preserve",Kr),padding:Gr("preserve",Kr),paddingTop:Gr("preserve",Kr),orbitMode:Gr("preserve",Kr),orbitSize:Gr("preserve",Kr),orbitSpeed:Gr("preserve",Kr),orbitRevolution:Gr("preserve",Kr),orbitRevolutionStyle:Gr("preserve",Kr),orbitEccentricity:Gr("preserve",Kr),orbitShowRings:Gr("preserve",Kr),orbitAnimated:Gr("preserve",Kr),customNetworkLayout:Gr("preserve",Kr),layoutConfig:Gr("preserve",Kr),nodeSize:Gr("preserve",Zr),nodeSizeRange:Gr("preserve",Zr),colorByDepth:Gr("preserve",Zr),nodeLabel:Gr("preserve",Jr),showLabels:Gr("preserve",Jr),labelMode:Gr("preserve",Jr),nodeStyle:Gr("preserve",Ur),edgeStyle:Gr("preserve",Ur),colorBy:Gr("preserve",Ur),colorScheme:Gr("preserve",Ur),themeCategorical:Gr("preserve",Ur),themeSemantic:Gr("preserve",Ur),edgeColorBy:Gr("preserve",Ur),edgeOpacity:Gr("preserve",Ur),showParticles:Gr("preserve",Ur),particleStyle:Gr("preserve",Ur),decay:Gr("preserve",Ur),pulse:Gr("preserve",Ur),thresholds:Gr("preserve",Ur),staleness:Gr("preserve",Ur),layoutSelection:Gr("preserve",Ur),clock:Gr("preserve",en),random:Gr("preserve",en),seed:Gr("preserve",en),tensionConfig:Gr("preserve",en),transition:Gr("preserve",en),introAnimation:Gr("preserve",en),onLayoutError:Gr("preserve",en),__skipForceSimulation:Gr("preserve",en),__hierarchyRoot:Gr("preserve",en),__orbitState:Gr("preserve",en),__previousPositions:Gr("preserve",en)},rn=Gr("preserve",Kr),nn=class{constructor(){this.tracker=new q}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},qr)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Vr):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const r=new Set;for(const n of e){const e=tn[n]??rn;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)r.add(t)}return{retainedData:t,invalidations:r}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},on=class e{constructor(e){this.nodes=new Map,this.edges=new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this.customLayoutHtmlMarks=[],this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,this.particlePool=null,this.updateResults=new nn,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=new Map,this.edgeTimestamps=new Map,this._decaySortedNodes=null,this._decayAgeMap=null,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this._networkDecayCache=null,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig={...He,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Ve(2e3))}currentTime(){return this.config.clock?.()??fe()}updateConfig(e){const t=this.config,r={...t,...e};t.__orbitState&&(r.__orbitState=t.__orbitState),t.__hierarchyRoot&&(r.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(r.layoutSelection=t.layoutSelection);const n=[...new Set([...Object.keys(t),...Object.keys(r)])].filter(e=>t[e]!==r[e]);this.config=r,this.tensionConfig={...He,...r.tensionConfig},!r.showParticles||"sankey"!==r.chartType&&!r.customNetworkLayout||this.particlePool||(this.particlePool=new Ve(2e3)),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}ingestHierarchy(e,t){this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null,this.updateResults.recordData("replace",1)}ingestBounded(e,t,r,n){const{nodeIDAccessor:o="id",sourceAccessor:i="source",targetAccessor:a="target",valueAccessor:s="value"}=this.config,c="function"==typeof o?o:e=>e[o],l="function"==typeof i?i:e=>e[i],u="function"==typeof a?a:e=>e[a],d="function"==typeof s?s:e=>e[s]??1;this._boundedPrevSnapshot=new Map;for(const[e,t]of this.nodes)0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1||this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=new Map;for(const[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const t of e){const e=c(t)+"";this.nodes.set(e,{...Br(e),data:t})}for(let e=0;t.length>e;e++){const r=t[e],n=l(r)+"",o=u(r)+"",i=d(r),a=null==i?NaN:Number(i),s=Number.isFinite(a)?a:1;this.nodes.has(n)||this.nodes.set(n,{...Br(n),data:r}),this.nodes.has(o)||this.nodes.set(o,{...Br(o),data:r});const c=`${n}\0${o}\0${e}`,h={source:n,target:o,value:s,y0:0,y1:0,sankeyWidth:0,data:r,_edgeKey:c};r&&"object"==typeof r&&Yr(r.bezier)&&(h.bezier=r.bezier),this.edges.set(c,h)}n?.deferLayout||this.runLayout(r),this.updateResults.recordData("replace",e.length+t.length)}ingestBoundedWithResult(e,t,r,n){return this.ingestBounded(e,t,r,n),this.updateResults.last}applyForceLayoutPositions(e,t){for(const[t,r]of Object.entries(e)){const e=this.nodes.get(t);e&&(e.x=r.x,e.y=r.y)}this.config.__skipForceSimulation=!0;try{this.runLayout(t)}finally{this.config.__skipForceSimulation=void 0}}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){const{source:t,target:r,value:n}=e,o=0===this.nodes.size;let i=!1;const a=this.currentTime();this.lastIngestTime=a,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,Br(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,i=!0),this.nodes.has(r)||(this.nodes.set(r,Br(r)),this.nodeTimestamps.set(r,a),this.tension+=this.tensionConfig.newNode,i=!0);const s=this.edgeKey(t,r),c=this.edges.get(s);let l=!1;c?(c.value+=n,this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.weightChange,l=!0):(this.edges.set(s,{source:t,target:r,value:n,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(s,a),this.tension+=this.tensionConfig.newEdge,i=!0);const u=o||i||l||this.tension>=this.tensionConfig.threshold;return this.updateResults.recordData("ingest",1),u}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;const t=zr(this.config.chartType);if(!t)return;let r=Array.from(this.nodes.values());const n=Array.from(this.edges.values());if(0===r.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.supportsStreaming&&!t.hierarchical){const e=new Map;for(const t of r)void 0!==t._prevX0?e.set(t.id,{x:(t._prevX0??0)+((t._prevX1??0)-(t._prevX0??0))/2,y:(t._prevY0??0)+((t._prevY1??0)-(t._prevY0??0))/2}):0===t.x&&0===t.y||e.set(t.id,{x:t.x,y:t.y});if(this._lastPositionSnapshot)for(const[t,r]of this._lastPositionSnapshot)e.has(t)||e.set(t,r);this.config.__previousPositions=e.size>0?e:void 0}if(t.computeLayout(r,n,this.config,e),this.config.__previousPositions=void 0,t.hierarchical&&r.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(const e of r)this.nodes.set(e.id,e);for(let e=0;n.length>e;e++){const t=n[e],r=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=r,this.edges.set(r,t)}const e=this._boundedPrevSnapshot;if(e&&e.size>0)for(const t of this.nodes.values()){const r=e.get(t.id);r&&(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,r=Array.from(this.nodes.values())}this.finalizeLayout();const o=new Map;for(const e of this.nodes.values())0===e.x&&0===e.y||o.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=o,this.saveTargetPositions();const i=r.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),a=this.config.transition?.duration??this.tensionConfig.transitionDuration,s=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&s&&r.length>0&&a>0){const t=e[0]/2,r=e[1]/2;for(const e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=r,e._prevY1=r;for(const e of this.edges.values())e._prevY0=r,e._prevY1=r,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:a}}else i&&a>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:a});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){const e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set;for(const t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(const t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(const e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(const e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime=this.currentTime()),this.previousNodeIds=e,this.previousEdgeKeys=t}restyleScene(e){const t=function({nodes:e,edges:t,restyle:r,restyleEdge:n,baseStyles:o,selection:i}){const a=!(!r&&!n);if(r)for(const t of e){const e=o.get(t)??t.style,n=r(t,i);t.style=n?{...e,...n}:e}if(n)for(const e of t){const t=o.get(e)??e.style,r=n(e,i);e.style=r?{...t,...r}:t}return a}({nodes:this.sceneNodes,edges:this.sceneEdges,restyle:this._customRestyle,restyleEdge:this._customRestyleEdge,baseStyles:this._baseStyles,selection:e});this.markStylePaintPending(),this.updateResults.recordRestyle(t)}buildScene(e){if(this.config.customNetworkLayout){const t=function({config:e,customLayout:t,size:r,nodes:n,edges:o,previousResult:i,revision:a}){const s=C(e.colorScheme,e.themeCategorical,Se),l={nodes:n,edges:o,dimensions:{width:r[0],height:r[1],plot:{x:0,y:0,width:r[0],height:r[1]}},theme:{semantic:e.themeSemantic??{},categorical:[...s]},resolveColor:T(s,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};try{return{kind:"success",result:t(l)}}catch(t){const r=null!==i,n=c("network",t,r,a);"production"!==process.env.NODE_ENV&&console.error("[semiotic] customNetworkLayout threw:",t);try{e.onLayoutError?.(n)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return{kind:"failure",diagnostic:n,preservedLastGoodScene:r}}}({config:this.config,customLayout:this.config.customNetworkLayout,size:e,nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values()),previousResult:this.lastCustomLayoutResult,revision:this.layoutVersion});if("failure"===t.kind)return this.lastCustomLayoutFailure=t.diagnostic,void(t.preservedLastGoodScene||(this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this._sceneNodesRevision++));const r=t.result;return this.sceneNodes=r.sceneNodes??[],this.sceneEdges=r.sceneEdges??[],this.labels=r.labels??[],this.customLayoutOverlays=r.overlays??null,this.customLayoutHtmlMarks=r.htmlMarks??[],this.lastCustomLayoutResult=r,this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=r.restyle,this._customRestyleEdge=r.restyleEdge,this.hasCustomRestyle=!(!r.restyle&&!r.restyleEdge),this.hasCustomRestyle&&(this._baseStyles=function(e,t){const r=new WeakMap;for(const t of e)r.set(t,t.style);for(const e of t)r.set(e,e.style);return r}(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null)),void L({label:"customNetworkLayout",nodes:this.sceneNodes,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned})}this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null;const t=zr(this.config.chartType);if(!t)return void this._sceneNodesRevision++;const r=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,n=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:o,sceneEdges:i,labels:a}=t.buildScene(r,n,this.config,e);this.sceneNodes=o,this.sceneEdges=i,this.labels=a,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,r=0;for(const e of this.sceneNodes)"circle"===e.type&&(t++,e.r>r&&(r=e.r));if(this._maxNodeRadius=r,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);const n=Array(t);let o=0;for(const e of this.sceneNodes)"circle"===e.type&&(n[o++]=e);this._nodeQuadtree=Fr().x(e=>e.cx).y(e=>e.cy).addAll(n)}get nodeQuadtree(){return this._nodeQuadtreeRevision!==this._sceneNodesRevision&&(this.rebuildNodeQuadtree(),this._nodeQuadtreeRevision=this._sceneNodesRevision),this._nodeQuadtree}get maxNodeRadius(){return this._maxNodeRadius}_ensureArrays(){this._arrCacheVersion===this.layoutVersion&&this._nodesArrCache&&this._edgesArrCache||(this._nodesArrCache=Array.from(this.nodes.values()),this._edgesArrCache=Array.from(this.edges.values()),this._arrCacheVersion=this.layoutVersion)}get nodesArray(){return this._ensureArrays(),this._nodesArrCache}get edgesArray(){return this._ensureArrays(),this._edgesArrCache}get isAnimating(){const e=zr(this.config.chartType);return!!e?.supportsAnimation&&!1!==this.config.orbitAnimated}tickAnimation(e,t){const r=zr(this.config.chartType);if(!r?.tick)return!1;const n=r.hierarchical?Array.from(this.nodes.values()):this.nodesArray,o=r.hierarchical?Array.from(this.edges.values()):this.edgesArray;return r.tick(n,o,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(const e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(const e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;const t=U(e,this.transition),r=K(t);for(const e of this.nodes.values())void 0===e._targetX0||void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=le(e._prevX0,e._targetX0,r),e.x1=le(e._prevX1,e._targetX1,r),e.y0=le(e._prevY0,e._targetY0,r),e.y1=le(e._prevY1,e._targetY1,r));for(const e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=le(e._prevY0,e._targetY0,r),e.y1=le(e._prevY1,e._targetY1,r),e.sankeyWidth=le(e._prevSankeyWidth,e._targetSankeyWidth,r));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){const e=this._boundedPrevSnapshot;for(const t of this.nodes.values()){const r=e?.get(t.id);r&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}const t=this._boundedEdgeSnapshot;for(const e of this.edges.values()){if(t&&0===e.sankeyWidth){const r=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(r){e._prevY0=r.y0,e._prevY1=r.y1,e._prevSankeyWidth=r.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){const e="vertical"===this.config.orientation?"down":"right";for(const e of this.nodes.values())if(0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1)e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;else{const t=5;e.x0=e.x-t,e.x1=e.x+t,e.y0=e.y-t,e.y1=e.y+t,e.width=2*t,e.height=2*t}for(const t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(const e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(const e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(const e of this.nodes.values())void 0===e._prevX0||0===e._prevX0&&0===e._prevX1||(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(const e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(const e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(const e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){!function(e,t,r=.5){const n="string"==typeof e.source?t.get(e.source):e.source,o="string"==typeof e.target?t.get(e.target):e.target;!n||!o||(e.bezier=e.circular&&e.circularPathData?function(e){const t=(e._circularWidth||e.sankeyWidth||1)/2,r=e.circularPathData;if(!r)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){const e=Math.max(15,Math.min(40,.33*(r.rightFullExtent-r.sourceX))),n=Math.max(15,Math.min(40,.33*(r.targetX-r.leftFullExtent)));return{circular:!0,segments:[[{x:r.sourceX,y:r.sourceY},{x:r.sourceX+.33*e,y:r.sourceY},{x:r.sourceX+.66*e,y:r.sourceY},{x:r.sourceX+e,y:r.sourceY}],[{x:r.targetX-n,y:r.targetY},{x:r.targetX-.66*n,y:r.targetY},{x:r.targetX-.33*n,y:r.targetY},{x:r.targetX,y:r.targetY}]],halfWidth:t}}let n;n="down"===e.direction?[{x:r.sourceY,y:r.sourceX},{x:r.sourceY,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.rightFullExtent},{x:r.verticalFullExtent,y:r.leftFullExtent},{x:r.targetY,y:r.leftFullExtent},{x:r.targetY,y:r.targetX}]:[{x:r.sourceX,y:r.sourceY},{x:r.rightFullExtent,y:r.sourceY},{x:r.rightFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.verticalFullExtent},{x:r.leftFullExtent,y:r.targetY},{x:r.targetX,y:r.targetY}];const o=[];for(let e=0;n.length-1>e;e++){const t=n[e],r=n[e+1],i=r.x-t.x,a=r.y-t.y;o.push([t,{x:t.x+i/3,y:t.y+a/3},{x:t.x+2*i/3,y:t.y+2*a/3},r])}return{circular:!0,segments:o,halfWidth:t}}(e):function(e,t,r,n=.5){const o=(e.sankeyWidth||1)/2;if("down"===e.direction){const i=t.x1,a=r.x0,s=jr(i,a);return{circular:!1,points:[{x:e.y0,y:i},{x:e.y0,y:s(n)},{x:e.y1,y:s(1-n)},{x:e.y1,y:a}],halfWidth:o}}const i=t.x1,a=r.x0,s=jr(i,a);return{circular:!1,points:[{x:i,y:e.y0},{x:s(n),y:e.y0},{x:s(1-n),y:e.y1},{x:a,y:e.y1}],halfWidth:o}}(e,n,o,r))}(e,this.nodes,.5)}rebuildAllBeziers(){for(const e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(const e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){!function(e){const t=e.pulse;if(!t)return;const r=t.duration??500,n=t.color??"rgba(255,255,255,0.6)",o=t.glowRadius??4,{now:i}=e;for(const t of e.sceneNodes){const a=t.id;if(!a)continue;const s=e.nodeTimestamps.get(a);if(!s)continue;const c=i-s;r>c&&(t._pulseIntensity=1-c/r,t._pulseColor=n,t._pulseGlowRadius=o)}for(const t of e.sceneEdges){const o=t.datum;if(!o)continue;const a="object"==typeof o.source?o.source?.id:o.source,s="object"==typeof o.target?o.target?.id:o.target;if(!a||!s)continue;const c=e.edgeTimestamps.get(`${a}\0${s}`);if(!c)continue;const l=i-c;r>l&&(t._pulseIntensity=1-l/r,t._pulseColor=n)}}({sceneNodes:this.sceneNodes,sceneEdges:this.sceneEdges,nodeTimestamps:this.nodeTimestamps,edgeTimestamps:this.edgeTimestamps,pulse:this.config.pulse,now:e})}applyDecay(){this._networkDecayCache||(this._networkDecayCache={sortedNodes:null,ageMap:null}),this._decaySortedNodes||(this._networkDecayCache.sortedNodes=null,this._networkDecayCache.ageMap=null),function(e){const t=e.decay;if(!t)return;const r=e.nodeTimestamps.size;if(1>=r)return;if(!e.cache.sortedNodes){e.cache.sortedNodes=Array.from(e.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);const t=new Map;for(let r=0;e.cache.sortedNodes.length>r;r++)t.set(e.cache.sortedNodes[r][0],r);e.cache.ageMap=t}const n=e.cache.ageMap;for(const o of e.sceneNodes){const e=o.id;if(!e)continue;const i=n.get(e);if(void 0===i)continue;const a=s(t,i,r);o.style={...o.style,opacity:(o.style?.opacity??1)*a}}}({sceneNodes:this.sceneNodes,nodeTimestamps:this.nodeTimestamps,decay:this.config.decay,cache:this._networkDecayCache}),this._decaySortedNodes=this._networkDecayCache.sortedNodes,this._decayAgeMap=this._networkDecayCache.ageMap}applyTopologyDiff(e){!function(e){for(const t of e.sceneNodes)t._pulseColor===Xr&&(t._pulseIntensity=0,t._pulseColor=void 0,t._pulseGlowRadius=void 0);if(0===e.addedNodes.size)return;const t=e.now-e.lastTopologyChangeTime;if(t>=Hr)return;const r=1-t/Hr;for(const t of e.sceneNodes){const n=t.id;n&&e.addedNodes.has(n)&&(t._pulseIntensity=Math.max(t._pulseIntensity??0,r),t._pulseColor=Xr,t._pulseGlowRadius=8)}}({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return function(e,t,r=("undefined"!=typeof performance?performance.now():Date.now())){return 0!==e.size&&Hr>r-t}(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){!function(e){const t=e.thresholds;if(!t)return;const r=t.warningColor??"#f59e0b",n=t.criticalColor??"#ef4444",o=!1!==t.pulse;for(const i of e.sceneNodes){const a=i.id;if(!a)continue;const s=e.nodes.get(a);if(!s)continue;const c=t.metric(s);let l=null;void 0===t.critical||t.critical>c?void 0===t.warning||t.warning>c||(l=r):l=n,l&&(i.style={...i.style,fill:l},o&&(i._pulseIntensity=.6+.4*Math.sin(e.now/300),i._pulseColor=l,i._pulseGlowRadius=6))}}({sceneNodes:this.sceneNodes,nodes:this.nodes,thresholds:this.config.thresholds,now:e})}get hasActiveThresholds(){return function(e,t){if(!t)return!1;for(const r of e){const e=t.metric(r);if(void 0!==t.warning&&e>=t.warning||void 0!==t.critical&&e>=t.critical)return!0}return!1}(this.nodes.values(),this.config.thresholds)}get hasActivePulses(){return function(e){const t=e.pulse;if(!t||0===e.lastIngestTime)return!1;const r=e.now??("undefined"!=typeof performance?performance.now():Date.now());return(t.duration??500)>r-e.lastIngestTime}({pulse:this.config.pulse,lastIngestTime:this.lastIngestTime})}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){const r=this.nodes.get(e);if(!r)return this.updateResults.recordNoop("update"),null;const n=r.data?{...r.data}:{};return r.data=t(r.data??{}),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",1),n}updateEdge(e,t,r){const n=this.config.valueAccessor,o="function"==typeof n?n:n?e=>e[n]:e=>e.value,i=[];for(const[,n]of this.edges)if(("string"==typeof n.source?n.source:n.source.id)===e&&("string"==typeof n.target?n.target:n.target.id)===t){i.push(n.data?{...n.data}:{}),n.data=r(n.data??{});const e=o(n.data);null!=e&&(n.value=Number(e))}return i.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length)):this.updateResults.recordNoop("update"),i}removeNode(e){if(!this.nodes.has(e))return this.updateResults.recordNoop("remove"),!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(const[t,r]of this.edges)("string"==typeof r.source?r.source:r.source.id)!==e&&("string"==typeof r.target?r.target:r.target.id)!==e||(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",1),!0}removeEdge(e,t){const r=[];if(void 0===t){const t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");const n="function"==typeof t?t:e=>e?.[t];for(const[t,o]of this.edges)o.data&&n(o.data)===e&&r.push(t)}else for(const[n,o]of this.edges)("string"==typeof o.source?o.source:o.source.id)===e&&("string"==typeof o.target?o.target:o.target.id)===t&&r.push(n);for(const e of r)this.edges.delete(e),this.edgeTimestamps.delete(e);return r.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length)):this.updateResults.recordNoop("remove"),r.length>0}clear(){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutOverlays=null,this.customLayoutHtmlMarks=[],this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.previousNodeIds=new Set,this.previousEdgeKeys=new Set,this.addedNodes=new Set,this.removedNodes=new Set,this.addedEdges=new Set,this.removedEdges=new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear(),this.updateResults.recordData("clear")}};on.QUADTREE_THRESHOLD=500;var an=on;o(an);import*as sn from"react";import{Fragment as cn,jsx as ln,jsxs as un}from"react/jsx-runtime";function dn(e){const{width:t,height:r,totalWidth:n,totalHeight:o,margin:i,labels:a,title:s,legend:c,legendHoverBehavior:l,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h,legendPosition:f="right",legendLayout:y,foregroundGraphics:g,sceneNodes:p,annotations:m,onAnnotationActivate:v,onObservation:x,chartId:k,chartType:b,autoPlaceAnnotations:_,svgAnnotationRules:S}=e,w=Le({onAnnotationActivate:v,onObservation:x,chartId:k,chartType:b}),A=sn.useMemo(()=>{const e=(p||[]).flatMap(e=>{const t=function(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){const t=e.cx??e.x,r=e.cy??e.y;if("number"!=typeof t||"number"!=typeof r)return null;const n=Ne(e.glyph,e.size);return{x:t+n.centerDx,y:r+n.centerDy,r:Math.max(1,n.radius)}}const t=e.cx??(null!=e.x&&null!=e.w?e.x+e.w/2:e.x),r=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof r?null:{x:t,y:r,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,Ae(e.size)):Math.max(1,e.w??0,e.h??0)/2}}(e),r=function(e){const t=e.id??e.datum?.id??e.datum?.data?.id??e.datum?.data?.name;return null==t?void 0:t+""}(e);return t?[{pointId:r,...t}]:[]});return{scales:null,width:t,height:r,frameType:"network",pointNodes:e,sceneNodes:p}},[r,p,t]),L=sn.useMemo(()=>{if(!m)return m;const e=M(m);return _?G({annotations:e,context:A,..."object"==typeof _?_:{}}):e},[m,_,A]),E=sn.useMemo(()=>J("network"),[]),P=L?ve(L.filter(e=>"widget"!==e.type),E,S,A):null,D=!0===L?.some(e=>"widget"===e.type&&!0===e._annotationDeferred);return un(cn,{children:[D&&ln("style",{children:I},"annotation-widget-disclosure-style"),un("svg",{role:"img",width:n,height:o,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[ln("title",{children:"string"==typeof s?s:"Network Chart"}),ln("desc",{children:"string"==typeof s?s+" (network data visualization)":"Network data visualization"}),un("g",{transform:`translate(${i.left},${i.top})`,children:[a.map((e,t)=>ln("text",{x:e.x,y:e.y,textAnchor:e.anchor||"start",dominantBaseline:e.baseline||"middle",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,style:{pointerEvents:"none"},children:e.text},"label-"+t)),P,g]}),s&&"string"==typeof s?ln("text",{x:n/2,y:H,textAnchor:"middle",fontWeight:600,fill:"currentColor",fontSize:14,className:"semiotic-chart-title",style:{fontSize:"var(--semiotic-title-font-size, 14px)"},children:s}):s?ln("foreignObject",{x:0,y:0,width:n,height:i.top,children:s}):null,xe({legend:c,totalWidth:n,totalHeight:o,margin:i,legendPosition:f,title:s,legendLayout:y,legendHoverBehavior:l,legendClickBehavior:u,legendHighlightedCategory:d,legendIsolatedCategories:h})]}),L?.filter(e=>"widget"===e.type&&e.nodeId&&p).map((e,t)=>{const r=!0===e._annotationDeferred,n=p.find(t=>t.id===e.nodeId||t.datum?.id===e.nodeId||t.datum?.data?.id===e.nodeId||t.datum?.data?.name===e.nodeId);if(!n)return null;const o=i.left+(n.cx??(null!=n.x&&null!=n.w?n.x+n.w/2:n.x??0)),a=i.top+(n.cy??(null!=n.y&&null!=n.h?n.y+n.h/2:n.y??0)),s=e.dx??0,c=e.dy??-16,l=e.width??32,u=e.height??32,d=e.content??ln("span",{style:{fontSize:18,cursor:"default"},children:"ℹ️"});return ln("div",{...V(e,w),className:r?"annotation-deferred":void 0,"data-annotation-disclosure":r?"deferred":void 0,style:{position:"absolute",left:o+s-l/2,top:a+c-u/2,width:l,height:u,display:"flex",alignItems:"center",justifyContent:"center",zIndex:5},children:d},"widget-"+t)})]})}dn.displayName="NetworkSVGOverlay";import*as hn from"react";import{jsx as fn}from"react/jsx-runtime";var yn={position:"absolute",top:0,left:0,pointerEvents:"none"};function gn({marks:e,margin:t,selection:r=null,overscan:n=400}){const o=hn.useRef(null),i=function(e,t,r){const[n,o]=hn.useState(null);return hn.useLayoutEffect(()=>{const e=t.current,r=function(e){let t=e?.parentElement??null;for(;t;){const{overflow:e,overflowX:r,overflowY:n}=window.getComputedStyle(t);if(/(auto|scroll|overlay)/.test(`${e} ${n} ${r}`))return t;t=t.parentElement}return null}(e);if(!e||!r)return void o(null);let n=0;const i=()=>{n=0;const t=r.getBoundingClientRect(),i=e.getBoundingClientRect();o(0!==t.width&&0!==t.height?{scroll:{left:t.left,top:t.top,right:t.right,bottom:t.bottom},originX:i.left,originY:i.top}:null)},a=()=>{0===n&&(n=window.requestAnimationFrame(i))};i(),r.addEventListener("scroll",a,{passive:!0});const s=new ResizeObserver(a);return s.observe(r),()=>{0!==n&&window.cancelAnimationFrame(n),r.removeEventListener("scroll",a),s.disconnect()}},[t,e,r]),hn.useMemo(()=>{if(!e||!n)return e;const{scroll:t,originX:o,originY:i}=n,a=t.left-r,s=t.right+r,c=t.top-r,l=t.bottom+r;return e.filter(e=>{const t=o+e.x,r=i+e.y;return!(a>t+e.width||t>s||c>r+e.height||r>l)})},[e,n,r])}(e,o,n);if(!e||0===e.length)return null;const a=fn("div",{className:"semiotic-network-html-marks",ref:o,style:{...yn,transform:`translate(${t.left}px, ${t.top}px)`},children:(i??e).map(e=>fn("div",{className:"semiotic-network-html-mark","data-mark-id":e.id,style:{position:"absolute",transform:`translate(${e.x}px, ${e.y}px)`,width:e.width,height:e.height,pointerEvents:"none"},children:e.content},e.id))});return null!=r?fn(E,{value:r,children:a}):a}import{jsx as pn,jsxs as mn}from"react/jsx-runtime";function vn({props:e,store:t,responsiveRef:r,size:n,margin:o,adjustedWidth:i,adjustedHeight:s,resolvedBackground:c,resolvedForeground:l}){const{chartType:u,nodes:d,edges:h,data:f,className:y,description:g,title:p,responsiveWidth:m,responsiveHeight:v,summary:x,background:b,renderMode:_,legend:S,legendPosition:w,legendLayout:A,legendHoverBehavior:L,legendClickBehavior:E,legendHighlightedCategory:D,legendIsolatedCategories:R,layoutSelection:M,annotations:N,onAnnotationActivate:T,annotationObservationCallback:C,onObservation:I,chartId:W,autoPlaceAnnotations:$,svgAnnotationRules:z}=e;if(t){const e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(u),r=e?f||(Array.isArray(h)?void 0:h):void 0;if(e&&r)t.ingestHierarchy(r,[i,s]),t.buildScene([i,s]);else{const e=oe(d),r=Array.isArray(h)?oe(h):[];(e.length>0||r.length>0)&&(t.ingestBounded(e,r,[i,s]),t.buildScene([i,s]))}}const F=t?.sceneNodes??[],B=t?.sceneEdges??[],Y=t?.labels??[];return mn("div",{ref:r,className:"stream-network-frame"+(y?" "+y:""),role:"img","aria-label":g||("string"==typeof p?p:"Network chart"),style:{position:"relative",width:m?"100%":n[0],height:v?"100%":n[1]},children:[pn(j,{summary:x}),mn("svg",{xmlns:"http://www.w3.org/2000/svg",width:n[0],height:n[1],style:{position:"absolute",left:0,top:0},children:[c&&pn("g",{transform:`translate(${o.left},${o.top})`,children:c}),mn("g",{transform:`translate(${o.left},${o.top})`,children:[b&&pn("rect",{x:0,y:0,width:i,height:s,fill:b}),B.map((e,t)=>k({node:e,index:t,renderMode:_,fallback:()=>de(e,t)})).filter(Boolean),F.map((e,t)=>k({node:e,index:t,renderMode:_,fallback:()=>he(e,t)})).filter(Boolean),Y.map((e,t)=>ue(e,t)).filter(Boolean)]})]}),pn(dn,{width:i,height:s,totalWidth:n[0],totalHeight:n[1],margin:o,labels:Y,sceneNodes:F,title:p,legend:S,legendPosition:w,legendLayout:A,legendHoverBehavior:L,legendClickBehavior:E,legendHighlightedCategory:D,legendIsolatedCategories:R,foregroundGraphics:a(l,P(t?.customLayoutOverlays,M??null)),annotations:N,onAnnotationActivate:T,onObservation:C??I,chartId:W,chartType:"StreamNetworkFrame",autoPlaceAnnotations:$,svgAnnotationRules:z,annotationFrame:0}),pn(gn,{marks:t?.customLayoutHtmlMarks,margin:o,selection:M??null})]})}function xn(e){if("undefined"!=typeof DOMException)return new DOMException(e+" aborted","AbortError");const t=Error(e+" aborted");return t.name="AbortError",t}function kn(e){const t=Error(e.message);return t.name=e.name??"Error",e.stack&&(t.stack=e.stack),t}function bn(e){return e&&"object"==typeof e?{requestId:e.requestId,error:e.error}:{}}var _n=class{constructor(e){this.nextRequestId=1,this.pending=new Map,this.dead=!1,this.options=e,this.worker=e.createWorker(),this.worker.onmessage=e=>{const t=this.options.parseMessage(e.data),r=t.requestId,n=null!=r?this.pending.get(r):this.pending.values().next().value;if(n){if(null!=r)this.pending.delete(r);else{for(const e of this.pending.values())e!==n&&(e.cleanup(),e.reject(Error(this.options.name+" worker response missing requestId")));this.pending.clear()}n.cleanup(),t.ok?n.resolve(t.payload):n.reject(t.error)}},this.worker.onerror=e=>{this.rejectAll(Error(e.message||this.options.name+" worker failed")),this.terminate()}}get isDead(){return this.dead}request(e,t){if(this.dead)return Promise.reject(Error(this.options.name+" worker session is closed"));if(t?.aborted)return Promise.reject(xn(this.options.name));const r=this.nextRequestId;this.nextRequestId+=1;const n=this.options.encodeRequest?.(r,e)??{requestId:r,request:e};return new Promise((e,o)=>{const i=()=>{this.pending.delete(r),t?.removeEventListener("abort",i),o(xn(this.options.name))},a=()=>t?.removeEventListener("abort",i);this.pending.set(r,{cleanup:a,reject:o,resolve:e}),t?.addEventListener("abort",i,{once:!0});try{this.worker.postMessage(n)}catch(e){this.pending.delete(r),a(),o(e instanceof Error?e:Error(e+""))}})}terminate(){this.dead||(this.dead=!0,this.rejectAll(Error(this.options.name+" worker terminated")),this.worker.terminate())}rejectAll(e){for(const t of this.pending.values())t.cleanup(),t.reject(e);this.pending.clear()}};function Sn(e){let t=null;return{get:()=>(t&&!t.isDead||(t=e()),t),resetForTest:()=>{if(t){try{t.terminate()}catch{}t=null}}}}function wn(e,t,r,n,o=4e4){return"sync"!==e&&("worker"===e||n*(t+r)>=o)}function An(){return"undefined"!=typeof window&&"undefined"!=typeof Worker}var Ln=class{constructor(e=function(){const e="string"==typeof import.meta.url&&import.meta.url?new URL("./forceLayoutWorker.js",import.meta.url):N("forceLayoutWorker.js");return new Worker(e,{type:"module",name:"semiotic-force-layout"})}()){this.session=new _n({name:"Force layout",createWorker:()=>e,parseMessage:e=>{const t=e,{requestId:r,error:n}=bn(t);return n?{requestId:r,ok:!1,error:kn(n)}:{requestId:r,ok:!0,payload:{positions:t.positions??{}}}}})}get isDead(){return this.session.isDead}request(e,t){return this.session.request(e,t)}terminate(){this.session.terminate()}},En=Sn(()=>new Ln);function Pn(e,t){return An()?En.get().request(e,t):Promise.reject(Error("Web Workers are unavailable"))}import{jsx as Dn,jsxs as Rn}from"react/jsx-runtime";var Mn=/^(value|amount|total|count|weight|score)$/i;function Nn({data:e}){if("edge"===e.nodeOrEdge){const t=e.data;return t?Rn("div",{className:"semiotic-tooltip",style:te,children:[Rn("div",{style:{fontWeight:600},children:["object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target]}),null!=t.value&&Rn("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]})]}):null}const t=e.data;if(!t)return null;const r=t.__hierarchyNode;if(r){const e=[];let n=r;for(;n;){const r=n.data?.name??n.data?.id??t.id;null!=r&&e.unshift(r+""),n=n.parent}e.length>1&&e.shift();const o=e.length-1;return Rn("div",{className:"semiotic-tooltip",style:te,children:[Dn("div",{children:e.map((e,t)=>Rn("span",{children:[t>0&&Dn("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===o?Dn("strong",{children:e}):Dn("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&Dn("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof t.value?t.value.toLocaleString():t.value+""})]})}const n=(t.sourceLinks?.length||0)+(t.targetLinks?.length||0),o=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),i=we(t.data??t),a=null!=i.title?i.title+"":t.id,s=i.entries.some(e=>Mn.test(e.key));return Rn("div",{className:"semiotic-tooltip",style:te,children:[Dn("div",{style:{fontWeight:600},children:a}),i.entries.map(e=>Rn("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",d(e.value)]},e.key)),!s&&null!=t.value&&t.value>0&&Rn("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),n>0&&Rn("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",n,o!==n&&` (weighted: ${o.toLocaleString()})`]})]})}function Tn(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function Cn(e,t){if(!t.pathD)return;e.save();const r=Tn(t);if(t.style.fill&&"none"!==t.style.fill){const n=t._gradient;if(n){const r=e.createLinearGradient(n.x0,n.y0??0,n.x1,n.y1??0),o=t.style.fillOpacity??t.style.opacity??.5,i="string"==typeof t.style.fill?t.style.fill:"#999",a=ke(e,i)||i;r.addColorStop(0,1===n.from?a:"transparent"),r.addColorStop(1,1===n.to?a:"transparent"),e.fillStyle=r,e.globalAlpha=o}else e.fillStyle=be(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(r)}t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.5*(t.style.opacity??1),e.stroke(r)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(r)),e.restore()}function In(e,t){e.save();const r=t.style.stroke||"#999";e.strokeStyle=ke(e,r)||r,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(t.style.strokeWidth??1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function Wn(e,t){if(!t.pathD)return;e.save();const r=Tn(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=be(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=ke(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.3*(t.style.opacity??1),e.stroke(r)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(r)),e.restore()}function $n(e,t){if(!t.pathD)return;e.save();const r=Tn(t),n=t.style.stroke||"#999";e.strokeStyle=ke(e,n)||n,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r),t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=be(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(r)),e.restore()}function zn(e,t,r,n=30){switch(e.type){case"circle":return function(e,t,r,n=30){const o=t-e.cx,i=r-e.cy,a=Math.sqrt(o*o+i*i);return a>h(e.r,n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,r,n);case"rect":return function(e,t,r){const n=f(t,r,e);return n.hit?{type:"node",datum:e.datum,x:n.cx,y:n.cy,distance:0}:null}(e,t,r);case"arc":return function(e,t,r){const n=t-e.cx,o=r-e.cy,i=Math.sqrt(n*n+o*o);if(e.innerR-2>i||i>e.outerR+2)return null;const a=p(Math.atan2(o,n)),s=p(e.startAngle),c=p(e.endAngle);if(s>c?a>=s||c>=a:a>=s&&c>=a){const t=(e.startAngle+e.endAngle)/2,r=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+r*Math.cos(t),y:e.cy+r*Math.sin(t),distance:0}}return null}(e,t,r);case"symbol":return function(e,t,r,n=30){const o=t-e.cx,i=r-e.cy,a=Math.sqrt(o*o+i*i);return a>h(Ae(e.size),n)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:a}}(e,t,r,n);case"glyph":return function(e,t,r,n=30){if(null==e.datum)return null;const o=Ne(e.glyph,e.size),i=e.cx+o.centerDx,a=e.cy+o.centerDy,s=t-i,c=r-a,l=Math.sqrt(s*s+c*c);return l>h(o.radius,n)?null:{type:"node",datum:e.datum,x:i,y:a,distance:l}}(e,t,r,n);default:return null}}Nn.ownsChrome=!0;var Fn=null,Bn=null;function Yn(){return Bn||((Fn=document.createElement("canvas")).width=1,Fn.height=1,Bn=Fn.getContext("2d")),Bn}function On(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch{return null}}function jn(e,t,r){switch(e.type){case"bezier":return function(e,t,r){if(!e.pathD)return null;const n=On(e),o=Yn();if(!n||!o)return null;try{if(o.isPointInPath(n,t,r))return{type:"edge",datum:e.datum,x:t,y:r,distance:0};const i=o.lineWidth;o.lineWidth=10;const a=o.isPointInStroke(n,t,r);if(o.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch{}return null}(e,t,r);case"line":return function(e,t,r){const n=e.x2-e.x1,o=e.y2-e.y1,i=n*n+o*o;if(0===i)return null;let a=((t-e.x1)*n+(r-e.y1)*o)/i;a=Math.max(0,Math.min(1,a));const s=e.x1+a*n,c=e.y1+a*o,l=Math.sqrt((t-s)**2+(r-c)**2);return l>5?null:{type:"edge",datum:e.datum,x:s,y:c,distance:l}}(e,t,r);case"ribbon":case"curved":return function(e,t,r){if(!e.pathD)return null;const n=On(e),o=Yn();if(!n||!o)return null;try{if(o.isPointInPath(n,t,r))return{type:"edge",datum:e.datum,x:t,y:r,distance:0};const i=o.lineWidth;o.lineWidth=10;const a=o.isPointInStroke(n,t,r);if(o.lineWidth=i,a)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch{}return null}(e,t,r);default:return null}}function Xn(e){const{clientX:t,clientY:r,canvasRect:n,margin:o,adjustedWidth:i,adjustedHeight:a,sceneNodes:s,sceneEdges:c,nodeQuadtree:l,maxNodeRadius:d,hitRadius:h=30}=e,f=t-n.left-o.left,y=r-n.top-o.top;if(0>f||f>i||0>y||y>a)return{kind:"miss-outside"};const g=function(e,t,r,n,o=30,i,a=0){let s=null,c=o,l=1/0;if(i){const e=u(i,r,n,o,a,e=>e.cx,e=>e.cy,e=>e.r);e&&(s={type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},c=e.distance)}for(const t of e){if(i&&"circle"===t.type)continue;const e=zn(t,r,n,o);if(e)if("rect"===t.type){const r=t.w*t.h;l>r&&(s=e,l=r)}else c>e.distance&&(s=e,c=e.distance)}if(s)return s;for(const e of t){if(!1===e.interactive)continue;const t=jn(e,r,n);t&&c>t.distance&&(s=t,c=t.distance)}return s}(s,c,f,y,h,l,d);return g?{kind:"hit",hover:Q(g.datum||{},g.x,g.y,{nodeOrEdge:g.type})}:{kind:"miss"}}import{useCallback as Hn}from"react";var qn="StreamNetworkFrame";import{jsx as Vn,jsxs as Gn}from"react/jsx-runtime";var Qn={top:20,right:80,bottom:20,left:80},Kn={top:40,right:40,bottom:40,left:40},Zn=new Set(["chord","force","circlepack","orbit"]),Un=[800,600],Jn=Xe(je(function(o,s){const{chartType:c,nodes:u,edges:d,data:h,initialEdges:f,nodeIDAccessor:p="id",sourceAccessor:k="source",targetAccessor:L="target",valueAccessor:E="value",edgeIdAccessor:D,childrenAccessor:R,hierarchySum:M,orientation:N="horizontal",nodeAlign:T="justify",nodePaddingRatio:C=.05,nodeWidth:I=15,iterations:H=300,forceStrength:q=.1,layoutExecution:V="auto",layoutLoadingContent:G,onLayoutStateChange:K,padAngle:U=.01,groupWidth:J=20,sortGroups:ee,edgeSort:te,treeOrientation:le="vertical",edgeType:ue="curve",padding:de,paddingTop:he,tensionConfig:fe,showParticles:ve=!1,particleStyle:xe,renderMode:be,nodeStyle:Se,edgeStyle:we,colorBy:Ae,colorScheme:Le="category10",edgeColorBy:Re="source",edgeOpacity:Ne=.5,colorByDepth:je=!1,nodeSize:Xe=8,nodeSizeRange:Ve=[5,20],nodeLabel:Ge,showLabels:Qe=!0,labelMode:Ke,size:Ze=Un,responsiveWidth:Ue,responsiveHeight:Je,margin:et,className:tt,background:rt,enableHover:nt=!0,tooltipContent:ot,customHoverBehavior:it,customClickBehavior:at,onObservation:st,annotationObservationCallback:ct,chartId:lt,onTopologyChange:ut,annotations:dt,onAnnotationActivate:ht,autoPlaceAnnotations:ft,svgAnnotationRules:yt,legend:gt,legendPosition:pt,legendLayout:mt,legendHoverBehavior:vt,legendClickBehavior:xt,legendHighlightedCategory:kt,legendIsolatedCategories:bt,title:_t,foregroundGraphics:St,backgroundGraphics:wt,decay:At,pulse:Lt,transition:Et,animate:Pt,staleness:Dt,frameScheduler:Rt,clock:Mt,random:Nt,seed:Tt,paused:Ct=!1,suspendWhenHidden:It=!0,thresholds:Wt,accessibleTable:$t=!0,description:zt,summary:Ft,orbitMode:Bt,orbitSize:Yt,orbitSpeed:Ot,orbitRevolution:jt,orbitRevolutionStyle:Xt,orbitEccentricity:Ht,orbitShowRings:qt,orbitAnimated:Vt,customNetworkLayout:Gt,onLayoutError:Qt,layoutConfig:Kt,layoutSelection:Zt}=o,Ut=Zn.has(c)?Kn:Qn,Jt=$e(!0),er=Ee({sizeProp:Ze,responsiveWidth:Ue,responsiveHeight:Je,userMargin:et,marginDefault:Ut,title:_t,legend:gt,legendPosition:pt,foregroundGraphics:St,backgroundGraphics:wt,animate:Pt,transitionProp:Et,frameScheduler:Rt,clock:Mt,random:Nt,seed:Tt,paused:Ct,suspendWhenHidden:It,themeDirtyRef:Jt}),{reducedMotionRef:tr,responsiveRef:rr,size:nr,margin:or,adjustedWidth:ir,adjustedHeight:ar,resolvedForeground:sr,resolvedBackground:cr,transition:lr,introEnabled:dr,tableId:hr,rafRef:fr,renderFnRef:yr,scheduleRender:gr,frameRuntime:pr,currentTheme:mr}=er,vr=Ce(),xr=Ie(),kr=Be(()=>oe(u),[u]),br=Be(()=>Array.isArray(d)?oe(d):d,[d]),_r=Be(()=>({...He,...fe}),[fe]),Sr=Be(()=>({...qe,...xe}),[xe]),wr=Be(()=>{return{chartType:(e={chartType:c,clock:pr.now,random:Nt,seed:Tt,nodeIDAccessor:p,sourceAccessor:k,targetAccessor:L,valueAccessor:E,edgeIdAccessor:D,childrenAccessor:R,hierarchySum:M,orientation:N,nodeAlign:T,nodePaddingRatio:C,nodeWidth:I,iterations:H,forceStrength:q,padAngle:U,groupWidth:J,sortGroups:ee,edgeSort:te,treeOrientation:le,edgeType:ue,padding:de,paddingTop:he,tensionConfig:_r,showParticles:ve,particleStyle:Sr,nodeStyle:Se,edgeStyle:we,nodeLabel:Ge,showLabels:Qe,labelMode:Ke,colorBy:Ae,colorScheme:Le,edgeColorBy:Re,edgeOpacity:Ne,colorByDepth:je,nodeSize:Xe,nodeSizeRange:Ve,decay:At,pulse:Lt,transition:lr,introAnimation:dr,staleness:Dt,thresholds:Wt,orbitMode:Bt,orbitSize:Yt,orbitSpeed:Ot,orbitRevolution:jt,orbitRevolutionStyle:Xt,orbitEccentricity:Ht,orbitShowRings:qt,orbitAnimated:Vt,customNetworkLayout:Gt,onLayoutError:Qt,layoutConfig:Kt,currentTheme:mr}).chartType,clock:e.clock,random:e.random,seed:e.seed,nodeIDAccessor:e.nodeIDAccessor,sourceAccessor:e.sourceAccessor,targetAccessor:e.targetAccessor,valueAccessor:e.valueAccessor,edgeIdAccessor:e.edgeIdAccessor,childrenAccessor:e.childrenAccessor,hierarchySum:e.hierarchySum,orientation:e.orientation,nodeAlign:e.nodeAlign,nodePaddingRatio:e.nodePaddingRatio,nodeWidth:e.nodeWidth,iterations:e.iterations,forceStrength:e.forceStrength,padAngle:e.padAngle,groupWidth:e.groupWidth,sortGroups:e.sortGroups,edgeSort:e.edgeSort,treeOrientation:e.treeOrientation,edgeType:e.edgeType,padding:e.padding,paddingTop:e.paddingTop,tensionConfig:e.tensionConfig,showParticles:e.showParticles,particleStyle:e.particleStyle,nodeStyle:e.nodeStyle,edgeStyle:e.edgeStyle,nodeLabel:e.nodeLabel,showLabels:e.showLabels,labelMode:e.labelMode,colorBy:e.colorBy,colorScheme:e.colorScheme,themeCategorical:e.currentTheme?.colors?.categorical,themeSemantic:Me(e.currentTheme),edgeColorBy:e.edgeColorBy,edgeOpacity:e.edgeOpacity,colorByDepth:e.colorByDepth,nodeSize:e.nodeSize,nodeSizeRange:e.nodeSizeRange,decay:e.decay,pulse:e.pulse,transition:e.transition,introAnimation:e.introAnimation,staleness:e.staleness,thresholds:e.thresholds,orbitMode:e.orbitMode,orbitSize:e.orbitSize,orbitSpeed:e.orbitSpeed,orbitRevolution:e.orbitRevolution,orbitRevolutionStyle:e.orbitRevolutionStyle,orbitEccentricity:e.orbitEccentricity,orbitShowRings:e.orbitShowRings,orbitAnimated:e.orbitAnimated,customNetworkLayout:e.customNetworkLayout,onLayoutError:e.onLayoutError,layoutConfig:e.layoutConfig};var e},[c,pr.now,Nt,Tt,p,k,L,E,D,R,M,N,T,C,I,H,q,U,J,ee,te,le,ue,de,he,_r,ve,Sr,Se,we,Ge,Qe,Ke,Ae,Le,Re,Ne,je,Xe,Ve,At,Lt,lr,dr,Dt,Wt,Bt,Yt,Ot,jt,Xt,Ht,qt,Vt,Gt,Qt,Kt,mr]),Ar=w(wr),Lr=w({chartType:(Er={chartType:c,nodeIDAccessor:p,sourceAccessor:k,targetAccessor:L,valueAccessor:E,edgeIdAccessor:D,childrenAccessor:R,hierarchySum:M,orientation:N,nodeAlign:T,nodePaddingRatio:C,nodeWidth:I,iterations:H,forceStrength:q,padAngle:U,groupWidth:J,sortGroups:ee,edgeSort:te,treeOrientation:le,edgeType:ue,padding:de,paddingTop:he,random:Nt,seed:Tt,tensionConfig:_r,customNetworkLayout:Gt,orbitMode:Bt,orbitSize:Yt,orbitEccentricity:Ht}).chartType,nodeIDAccessor:Er.nodeIDAccessor,sourceAccessor:Er.sourceAccessor,targetAccessor:Er.targetAccessor,valueAccessor:Er.valueAccessor,edgeIdAccessor:Er.edgeIdAccessor,childrenAccessor:Er.childrenAccessor,hierarchySum:Er.hierarchySum,orientation:Er.orientation,nodeAlign:Er.nodeAlign,nodePaddingRatio:Er.nodePaddingRatio,nodeWidth:Er.nodeWidth,iterations:Er.iterations,forceStrength:Er.forceStrength,padAngle:Er.padAngle,groupWidth:Er.groupWidth,sortGroups:Er.sortGroups,edgeSort:Er.edgeSort,treeOrientation:Er.treeOrientation,edgeType:Er.edgeType,padding:Er.padding,paddingTop:Er.paddingTop,random:Er.random,seed:Er.seed,tensionConfig:Er.tensionConfig,customNetworkLayout:Er.customNetworkLayout,orbitMode:Er.orbitMode,orbitSize:Er.orbitSize,orbitEccentricity:Er.orbitEccentricity});var Er;const Pr=$e(0),Dr=$e(0),Rr=$e(!1),Mr=$e(null);Mr.current||(Mr.current=new an(Ar));const Nr=De("StreamNetworkFrame"),Tr=Ye((e,t,r=!1)=>_e(Nr.current,e,()=>e.buildScene(t),r),[Nr]),[Cr,Ir]=ze(null),[Wr,$r]=ze(0),[zr,Fr]=ze(0),[Br,Yr]=ze(!1),[Or,jr]=ze(!1),Xr=$e(0),Hr=$e(null),qr=$e(!1),Vr=$e(K);Vr.current=K;const Gr=$e(Ar);Gr.current=Ar;const Qr=$e(null),Kr=$e(new Map),Zr=$e(0),Ur=Ye(e=>function(e){const{node:t,colorBy:r,colorScheme:n,nodeColorMap:o,colorIndexRef:i}=e;if("function"==typeof r)return r(t)+"";if("string"==typeof r&&t.data){const e=t.data[r];if(void 0!==e){if(!o.has(e+"")){const t=Array.isArray(n)?n:z;o.set(e+"",t[i.current++%t.length])}return o.get(e+"")}}if(o.has(t.id))return o.get(t.id);const a=Array.isArray(n)?n:z,s=r?a[i.current++%a.length]:a[0];return o.set(t.id,s),s}({node:e,colorBy:Ae,colorScheme:Le,nodeColorMap:Kr.current,colorIndexRef:Zr}),[Ae,Le]),Jr=Ye(e=>{Zr.current=function(e){const{sceneNodes:t,nodes:r,nodeColorMap:n,colorScheme:o}=e;for(const e of t)e.id&&"string"==typeof e.style?.fill&&n.set(e.id,e.style.fill);const i=Array.isArray(o)?o:z,a=Array.from(r);for(let e=0;a.length>e;e++){const t=a[e];n.has(t.id)||n.set(t.id,i[e%i.length])}return a.length}({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:Kr.current,colorScheme:Le})},[Le]),en=Ye((e,t)=>{Tr(e,t),Jr(e),Jt.current=!1,e.markStylePaintPending()},[Tr,Jr]),tn=Ye(()=>{Mr.current?.markStylePaintPending()},[]),rn=(nn=mr,nn?.colors?.border||nn?.colors?.secondary||nn?.colors?.primary||"#999");var nn;const on=Ye(e=>function(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}(e,Mr.current?.nodes),[]),sn=Ye(e=>function(e){const{edge:t,edgeColorBy:r,getNodeColor:n,resolveEndpoint:o,fallback:i}=e;if("function"==typeof r)return r(t);const a=o(t.source),s=o(t.target);return"target"===r&&s?n(s):a?n(a):i}({edge:e,edgeColorBy:Re,getNodeColor:Ur,resolveEndpoint:on,fallback:rn}),[Re,Ur,rn,on]),cn=Ye(e=>function(e){const{edge:t,particleStyleColor:r,particleColorBy:n,hasExplicitParticleColorBy:o,getEdgeColor:i,getNodeColor:a,resolveEndpoint:s,fallback:c}=e;if("function"==typeof r){const e=s(t.source);return e?r(t,e):c}if(!o)return i(t);const l=n,u=s(t.source),d=s(t.target);return"target"===l&&d?a(d):u?a(u):c}({edge:e,particleStyleColor:Sr.color,particleColorBy:Sr.colorBy,hasExplicitParticleColorBy:!!xe?.colorBy,getEdgeColor:sn,getNodeColor:Ur,resolveEndpoint:on,fallback:rn}),[xe?.colorBy,Sr.color,Sr.colorBy,Ur,sn,rn,on]),ln=function(e,t,r,n,o){return("sankey"===e||t)&&r||n||o}(c,!!Gt,ve,!!Lt,Mr.current?.isAnimating??!1);_(Mr,Ar,Jt,gr),S(Mr,Zt,Jt,gr),Fe(()=>{const e=Mr.current;e&&(en(e,[ir,ar]),$r(e=>e+1),gr())},[mr,ir,ar,en,gr]);const un=Ye(()=>{const e=Mr.current;if(e&&(e.runLayout([ir,ar]),en(e,[ir,ar]),$r(e.layoutVersion),ut)){const{nodes:t,edges:r}=e.getLayoutData();ut(t,r)}},[ir,ar,en,ut]),hn=$e(!1),fn=Ye((e=!1)=>!(!e&&!hn.current||(hn.current=!1,un(),0)),[un]),yn=Ye(()=>fn(!1),[fn]),pn=Ye(e=>{const t=Mr.current;if(!t)return!1;let r=!1,n=hn.current;for(const o of e)null!=o&&"object"==typeof o&&(r=!0,t.ingestEdge(o)&&(n=!0));const o=fn(n);return r||o},[fn]),mn=Ye(e=>{if(null==e||"object"!=typeof e)return;const t=Mr.current;t&&(t.ingestEdge(e)&&(hn.current=!0),pr.isActive?gr():yn())},[yn,pr,gr]),xn=Ye(e=>{pn(e)&&gr()},[pn,gr]);Fe(()=>pr.subscribe(()=>{pr.isActive||yn()}),[yn,pr]);const kn=Ye(()=>{hn.current=!1,Mr.current?.clear(),Kr.current.clear(),Zr.current=0,$r(Mr.current?.layoutVersion??0),Ir(null),Qr.current=null,Jt.current=!0,gr()},[gr]),bn=Ye(()=>{const e=Mr.current;e&&(e.tension+=999,fn(!0),gr())},[fn,gr]);Oe(s,()=>({push:mn,pushMany:xn,removeNode:e=>{const t=Mr.current?.removeNode(e)??!1;if(t){const t=Qr.current?.data?"function"==typeof p?p(Qr.current.data):Qr.current.data[p]:void 0;Qr.current&&"node"===Qr.current.nodeOrEdge&&t===e&&(Qr.current=null,Ir(null)),Kr.current.delete(e)}return fn(t)&&(Jt.current=!0,gr()),t},removeEdge:(e,t)=>{const r=Mr.current?.removeEdge(e,t)??!1;if(r&&Qr.current&&"edge"===Qr.current.nodeOrEdge){const r=Qr.current.data;let n;n=void 0!==t?("object"==typeof r?.source?r.source.id:r?.source)===e&&("object"==typeof r?.target?r.target.id:r?.target)===t:!D||!r||("function"==typeof D?D:e=>e?.[D])(r)===e,n&&(Qr.current=null,Ir(null))}return fn(r)&&(Jt.current=!0,gr()),r},updateNode:(e,t)=>{const r=Mr.current?.updateNode(e,t)??null;return fn(null!==r)&&(Jt.current=!0,gr()),r},updateEdge:(e,t,r)=>{const n=Mr.current?.updateEdge(e,t,r)??[];return fn(n.length>0)&&(Jt.current=!0,gr()),n},clear:kn,getTopology:()=>(yn(),Mr.current?.getLayoutData()??{nodes:[],edges:[]}),getCustomLayout:()=>(yn(),Mr.current?.lastCustomLayoutResult??null),getLayoutFailure:()=>(yn(),Mr.current?.lastCustomLayoutFailure??null),getTopologyDiff:()=>{yn();const e=Mr.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:bn,getTension:()=>(yn(),Mr.current?.tension??0)}),[mn,xn,kn,bn,yn,fn,p,gr,D]);const _n=["tree","cluster","treemap","circlepack","partition","orbit"].includes(c),Sn=_n?h||(Array.isArray(d)?void 0:d):void 0;Fe(()=>{const e=Mr.current;if(!e)return;const t=++Xr.current;if(Hr.current?.abort(),Hr.current=null,_n&&Sn)hn.current=!1,e.ingestHierarchy(Sn,[ir,ar]),en(e,[ir,ar]),$r(e.layoutVersion),jr(!1),Vr.current?.("ready"),gr();else{const r=kr,n=Array.isArray(br)?br:[];if(null==u&&null==d||(hn.current=!1),0===r.length&&0===n.length)return null==u&&null==d||0>=e.nodes.size&&0>=e.edges.size||kn(),jr(!1),void Vr.current?.("ready");const o=[ir,ar],i="force"===c&&!Gt&&An()&&!Nt&&wn(V,r.length,n.length,H);if(i&&xr&&!qr.current&&e.sceneNodes.length>0)return qr.current=!0,jr(!1),Vr.current?.("ready"),Jt.current=!0,void gr();if(i){const i=new AbortController;Hr.current=i;const a=e._lastPositionSnapshot;e.ingestBounded(r,n,o,{deferLayout:!0});const s=e.getLayoutData(),c=function(e,t,r,n,o){const i=ur(r.nodeSize,r.nodeSizeRange,e);return{kind:"frame",nodes:e.map(e=>{const t=o?.get(e.id);return{id:e.id,x:0!==e.x||0!==e.y?e.x:t?.x??0,y:0!==e.x||0!==e.y?e.y:t?.y??0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:e.value,__forceRadius:i(e)}}),edges:t.map(e=>{const t="string"==typeof e.source?e.source:e.source.id,r="string"==typeof e.target?e.target:e.target.id,n=e.data?.weight,o="number"==typeof n&&Number.isFinite(n)?n:e.value;return{source:t,target:r,value:e.value,y0:0,y1:0,sankeyWidth:0,weight:o}}),config:{chartType:"force",iterations:r.iterations,forceStrength:r.forceStrength,seed:r.seed},size:n}}(s.nodes,s.edges,Gr.current,o,a);return jr(!0),Vr.current?.("pending"),Pn(c,i.signal).then(({positions:r})=>{t===Xr.current&&(e.applyForceLayoutPositions(r,o),en(e,o),jr(!1),Vr.current?.("ready"),$r(e.layoutVersion),gr())}).catch(r=>{"AbortError"!==r.name&&t===Xr.current&&(e.runLayout(o),en(e,o),jr(!1),Vr.current?.("error"),$r(e.layoutVersion),gr())}),()=>i.abort()}e.ingestBounded(r,n,o),en(e,o),$r(e.layoutVersion),jr(!1),Vr.current?.("ready"),gr()}},[kr,br,u,d,h,Sn,_n,ir,ar,Lr,V,H,xr,c,Gt,Nt,gr,kn,en]);const Ln=We.useRef(!1);Fe(()=>{Ln.current||f&&f.length>0&&(Ln.current=!0,xn(f))},[f,xn]);const{customHoverBehavior:En,customClickBehavior:Dn}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:r,chartId:n}){return{customHoverBehavior:Hn((t,o)=>{e?.(t,o),ne({onObservation:r,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:qn,chartId:n,context:o})},[e,r,n]),customClickBehavior:Hn((e,o)=>{t?.(e,o),re({onObservation:r,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:qn,chartId:n,context:o})},[t,r,n])}}({customHoverBehavior:it,customClickBehavior:at,onObservation:st,chartId:lt}),{hoverHandlerRef:Rn,hoverLeaveRef:Mn,onPointerMove:Tn,onPointerLeave:zn}=er,Fn=()=>!Gt||(Mr.current?.hasCustomRestyle??!1);Rn.current=e=>{if(!nt)return;const t=Fn(),r=ro.current;if(!r)return;const n=Mr.current;if(!n)return;const o=Xn({clientX:e.clientX,clientY:e.clientY,canvasRect:r.getBoundingClientRect(),margin:or,adjustedWidth:ir,adjustedHeight:ar,sceneNodes:n.sceneNodes,sceneEdges:n.sceneEdges,nodeQuadtree:n.nodeQuadtree,maxNodeRadius:n.maxNodeRadius});"hit"===o.kind?(Qr.current=o.hover,Ir(o.hover),En?.(o.hover),t&&gr()):Qr.current&&(Qr.current=null,Ir(null),En?.(null),t&&gr())},Mn.current=()=>{if(Qr.current){const e=Fn();Qr.current=null,Ir(null),En?.(null),e&&gr()}};const Bn=$e(()=>{});Bn.current=e=>{if(ae(e.target))return;if(!at&&!st)return;const t=ro.current;if(!t)return;const r=Mr.current;if(!r)return;const n=Xn({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:or,adjustedWidth:ir,adjustedHeight:ar,sceneNodes:r.sceneNodes,sceneEdges:r.sceneEdges,nodeQuadtree:r.nodeQuadtree,maxNodeRadius:r.maxNodeRadius});"hit"===n.kind?Dn(n.hover,{type:"activate",inputType:ye(e.nativeEvent.pointerType)}):"miss"===n.kind&&Dn(null)};const Yn=Ye(e=>Bn.current(e),[]),On=$e(-1),jn=$e(null),Jn=$e(-1),eo=Ye(e=>{if(se(e))return;const t=Mr.current;if(!t)return;const r=()=>{On.current=-1,jn.current=null,Jn.current=-1,Qr.current=null,Ir(null),En?.(null),gr()},n=l(t.sceneNodes);if(0===n.length)return void(0>On.current||r());const o=i(n);let a=On.current;if(o.flat.length>a||(r(),a=-1)," "===e.key&&a>=0){e.preventDefault();const t=o.flat[a];return void Dn?.(Q(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>a){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),On.current=0,Jn.current=-1;const t=o.flat[0];jn.current={shape:t.shape,w:t.w,h:t.h};const r=Q(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return Qr.current=r,Ir(r),En?.(r,{type:"focus",inputType:"keyboard"}),void gr()}const s=b(o,a),c=g(e.key,s,o,t.sceneEdges??[],Jn);if(null===c)return;if(e.preventDefault(),0>c)return void r();On.current=c;const u=o.flat[c];jn.current={shape:u.shape,w:u.w,h:u.h};const d={data:u.datum||{},x:u.x,y:u.y,__semioticHoverData:!0,nodeOrEdge:"node"};Qr.current=d,Ir(d),En?.(d,{type:"focus",inputType:"keyboard"}),gr()},[Dn,En,gr]),to=Ye(e=>{On.current=-1,jn.current=null,Tn(e)},[Tn]);yr.current=()=>{if(fr.current=null,yn(),!pr.isActive)return;const n=ro.current;if(!n)return;const o=Mr.current;o&&function(n){const{canvas:o,store:i,sceneRevisionDiagnostics:a,size:s,margin:c,adjustedWidth:l,adjustedHeight:u,background:d,renderMode:h,hasBackgroundGraphics:f=!1,dirtyRef:g,lastFrameTimeRef:p,now:k,random:b,reducedMotion:_,showParticles:S,isContinuous:w,animate:A,decay:L,pulse:E,thresholds:P,staleness:D,particleStyle:R,getParticleColor:M,pendingAnnotationFrameRef:N,lastAnnotationFrameTimeRef:T,setAnnotationFrame:C,scheduleNextFrame:I,syncColorMap:W}=n,$=o.getContext("2d");if(!$)return;const z=p.current?Math.min((k-p.current)/1e3,.1):.016;p.current=k;const F=i.advanceTransition(_?k+1e6:k),B=!_&&F,Y=!_&&i.tickAnimation([l,u],z),O=g.current,j=a?.beforeCompute(i.getLastUpdateResult(),B),X=F||O||Y;X&&(i.buildScene([l,u]),O&&W?.()),j&&a?.afterCompute(j,X,!1);const H=S&&!_&&!!i.particlePool,q=!!L||!!E||!!P||!1!==A&&i.hasActiveTopologyDiff||i.hasActivePulses||i.hasActiveThresholds,V=i.consumeStylePaintPending(),G=e({dirtyOrRebuilt:O,transitioning:B,animationTicked:Y,continuous:H||w,liveEncoding:q,forced:V}),Q=!!D&&i.lastIngestTime>0&&k-i.lastIngestTime>(D?.threshold??5e3);if(G){const e=ie();if(!me(o,s,c,e))return;if($.clearRect(-c.left,-c.top,s[0],s[1]),t($,{background:d,hasBackgroundGraphics:f,width:l,height:u}),L&&i.applyDecay(),E&&i.applyPulse(k),P&&i.applyThresholds(k),!1!==A&&i.applyTopologyDiff(k),Q&&($.globalAlpha=D?.dimOpacity??.5),m({context:$,nodes:i.sceneEdges,renderMode:h,pixelRatio:e,paintBuiltIn:e=>function(e,t){for(const r of t)switch(r.type){case"bezier":Cn(e,r);break;case"line":In(e,r);break;case"ribbon":Wn(e,r);break;case"curved":$n(e,r)}}($,e)}),m({context:$,nodes:i.sceneNodes,renderMode:h,pixelRatio:e,paintBuiltIn:e=>{const t=e;!function(e,t){for(const r of t){if("rect"!==r.type)continue;const t=r;t.w>0&&t.h>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),ge(e,t.style,"#007bff",()=>e.fillRect(t.x,t.y,t.w,t.h)),pe(e,t.style,()=>e.strokeRect(t.x,t.y,t.w,t.h)),x(e,t),e.restore())}}($,t),function(e,t){for(const r of t){if("circle"!==r.type)continue;const t=r;t.r>0&&(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),ge(e,t.style,"#007bff",()=>e.fill()),pe(e,t.style,()=>e.stroke()),v(e,t),e.restore())}}($,t),function(e,t){for(const r of t){if("arc"!==r.type)continue;const t=r;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),ge(e,t.style,"#007bff",()=>e.fill()),pe(e,t.style,()=>e.stroke()),e.restore()}}($,t),r($,t),y($,t)}}),H&&!Q){const e=i.edgesArray;if(e.length>0){!function(e,t,r,n,o=Math.random){const i=n.spawnRate??.1,a=n.maxPerEdge??50;for(let n=0;t.length>n;n++){const s=t[n];if(!s.bezier)continue;if(e.countForEdge(n)>=a)continue;const c=s.value*i*r*(s.bezier.circular?.3:1),l=Math.floor(c),u=c-l;let d=l;o()<u&&d++;for(let t=0;d>t&&e.countForEdge(n)<a;t++)e.spawn(n,o)}}(i.particlePool,e,z,R,b);const t=.5*(R.speedMultiplier??1);let r;if(R.proportionalSpeed){const t=e.reduce((e,t)=>Math.max(e,t.value||1),1);r=e.map(e=>.3+(e.value||1)/t*1.7)}i.particlePool.step(z,t,e,r),function(e,t,r,n,o){const i=n.radius??3;e.globalAlpha=n.opacity??.7;for(let a=0;t.particles.length>a;a++){const s=t.particles[a];if(!s.active)continue;const c=r[s.edgeIndex];if(!c)continue;let l;l="string"==typeof n.color&&"inherit"!==n.color?n.color:o(c),e.fillStyle=ke(e,l)||l,e.beginPath(),e.arc(s.x,s.y,i,0,2*Math.PI),e.fill()}e.globalAlpha=1}($,i.particlePool,e,R,M)}}Q&&($.globalAlpha=1)}g.current=!1,(O||B||Y)&&o.setAttribute("aria-label",Z(i.sceneNodes?.length??0,i.sceneEdges?.length??0,"Network chart"));const K=O||B||Y||N.current;K&&k-T.current>=33?(C(e=>e+1),T.current=k,N.current=!1):N.current=!!K,(w||B||null!=i.transition||Y||i.hasActivePulses||i.hasActiveThresholds||!1!==A&&i.hasActiveTopologyDiff||N.current)&&I()}({canvas:n,store:o,sceneRevisionDiagnostics:Nr.current,size:nr,margin:or,adjustedWidth:ir,adjustedHeight:ar,background:rt,renderMode:be,hasBackgroundGraphics:!!wt,dirtyRef:Jt,lastFrameTimeRef:Pr,now:pr.now(),random:pr.random,reducedMotion:!!tr.current,showParticles:ve,isContinuous:ln,animate:Pt,decay:At,pulse:Lt,thresholds:Wt,staleness:Dt,particleStyle:Sr,getParticleColor:cn,pendingAnnotationFrameRef:Rr,lastAnnotationFrameTimeRef:Dr,setAnnotationFrame:Fr,scheduleNextFrame:()=>{gr()},syncColorMap:()=>Jr(o)})};const{canvasRef:ro}=Pe(er,{hydrated:vr,wasHydratingFromSSR:xr,storeRef:Mr,dirtyRef:Jt,skipInitialCanvasPaintInvalidation:!0,canvasPaintInvalidator:tn,canvasPaintDependencies:[c,ir,ar,rt,wt,be,gr]});A(Dt,Mr,Jt,gr,Br,Yr);const no=nt&&Cr?Vn(F,{x:Cr.x,y:Cr.y,containerWidth:ir,containerHeight:ar,margin:or,className:"stream-network-tooltip",zIndex:2,children:ot?ot(Cr):Vn(Nn,{data:Cr})}):null;if(ce||!vr&&xr)return Vn(vn,{props:o,store:Mr.current,responsiveRef:rr,size:nr,margin:or,adjustedWidth:ir,adjustedHeight:ar,resolvedBackground:cr,resolvedForeground:sr});const oo=Mr.current;return Gn("div",{ref:rr,className:"stream-network-frame"+(tt?" "+tt:""),role:"group","aria-label":zt||("string"==typeof _t?_t:"Network chart"),tabIndex:0,"aria-busy":Or||void 0,style:{position:"relative",width:Ue?"100%":nr[0],height:Je?"100%":nr[1],overflow:"visible"},onKeyDown:eo,children:["production"!==process.env.NODE_ENV&&Mr.current&&Vn(O,{store:Mr.current,diagnostics:Nr.current}),$t&&Vn(X,{tableId:hr}),$t&&Vn(Y,{nodes:oo?.sceneNodes??[],edges:oo?.sceneEdges??[],chartType:"Network chart",tableId:hr,chartTitle:"string"==typeof _t?_t:void 0}),Vn(j,{summary:Ft}),Vn(W,{hoverPoint:Cr}),Gn("div",{role:"img","aria-label":zt||("string"==typeof _t?_t:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:nt?to:void 0,onMouseLeave:nt?zn:void 0,onClick:at||st?Yn:void 0,children:[Or&&!1!==G&&Vn("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:Te(!0,nr[0],nr[1],G)}),Vn($,{size:nr,margin:or,overflowVisible:!0,children:cr}),Vn("canvas",{ref:ro,"aria-label":Z(oo?.sceneNodes?.length??0,oo?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),Vn(dn,{width:ir,height:ar,totalWidth:nr[0],totalHeight:nr[1],margin:or,labels:oo?.labels||[],sceneNodes:oo?.sceneNodes,title:_t,legend:gt,legendPosition:pt,legendLayout:mt,legendHoverBehavior:vt,legendClickBehavior:xt,legendHighlightedCategory:kt,legendIsolatedCategories:bt,foregroundGraphics:a(sr,P(Mr.current?.customLayoutOverlays,Zt??null)),annotations:dt,onAnnotationActivate:ht,onObservation:ct??st,chartId:lt,chartType:"StreamNetworkFrame",autoPlaceAnnotations:ft,svgAnnotationRules:yt,annotationFrame:zr}),Vn(gn,{marks:oo?.customLayoutHtmlMarks,margin:or,selection:Zt??null}),Vn(B,{active:On.current>=0,hoverPoint:Cr,margin:or,size:nr,shape:jn.current?.shape,width:jn.current?.w,height:jn.current?.h}),no,Dt?.showBadge&&Vn(n,{isStale:Br,position:Dt.badgePosition})]})]})}));Jn.displayName="StreamNetworkFrame";var eo=Jn;export{Ht as buildRibbonGeometry,kn as errorFromPayload,bn as parseModuleWorkerErrorField,_n as ModuleWorkerSession,Sn as createSharedWorkerSessionHolder,wn as shouldUseForceWorker,An as canUseForceWorker,Pn as runForceLayoutWorker,eo as StreamNetworkFrame_default};
|