semiotic 3.8.2 → 3.8.3
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 +1 -1
- package/README.md +34 -33
- package/ai/schema.json +1 -1
- package/ai/surface-manifest.json +1 -1
- package/ai/system-prompt.md +1 -1
- package/dist/{chunk-chunk-C6EJ4IOD.module.min.js → chunk-chunk-2CCFBTQC.module.min.js} +1 -1
- package/dist/chunk-chunk-2RXP3FS3.module.min.js +1 -0
- package/dist/chunk-chunk-4TMZXLCR.module.min.js +1 -0
- package/dist/{chunk-chunk-H4PPRW6N.module.min.js → chunk-chunk-5APBQXZA.module.min.js} +1 -1
- package/dist/{chunk-chunk-NO4MCQVD.module.min.js → chunk-chunk-5RKXZQ2P.module.min.js} +1 -1
- package/dist/chunk-chunk-6HSGDMTA.module.min.js +2 -0
- package/dist/{chunk-chunk-7LHMKRKE.module.min.js → chunk-chunk-7FW6EGLP.module.min.js} +1 -1
- package/dist/{chunk-chunk-RH5TSQPH.module.min.js → chunk-chunk-7OEOSCBP.module.min.js} +1 -1
- package/dist/{chunk-chunk-FAKO3RGQ.module.min.js → chunk-chunk-A63CTACR.module.min.js} +1 -1
- package/dist/chunk-chunk-ANYDWOZF.module.min.js +1 -0
- package/dist/{chunk-chunk-ZLKRTF5N.module.min.js → chunk-chunk-AZJUDQRM.module.min.js} +1 -1
- package/dist/{chunk-chunk-W3DB2MN4.module.min.js → chunk-chunk-B6V35LMY.module.min.js} +1 -1
- package/dist/chunk-chunk-BOSVL645.module.min.js +2 -0
- package/dist/chunk-chunk-EMO5NUGE.module.min.js +1 -0
- package/dist/chunk-chunk-F25UA5HT.module.min.js +1 -0
- package/dist/chunk-chunk-FRIO6MCV.module.min.js +1 -0
- package/dist/{chunk-chunk-T27ZEV6A.module.min.js → chunk-chunk-GWSWSPXN.module.min.js} +1 -1
- package/dist/chunk-chunk-I6C3KR5H.module.min.js +2 -0
- package/dist/chunk-chunk-IP2UE74X.module.min.js +1 -0
- package/dist/chunk-chunk-J5RL6GXU.module.min.js +2 -0
- package/dist/chunk-chunk-JNCHKRIR.module.min.js +2 -0
- package/dist/{chunk-chunk-Z5KXAVQD.module.min.js → chunk-chunk-L3H6DQCR.module.min.js} +1 -1
- package/dist/{chunk-chunk-5WEFWNUW.module.min.js → chunk-chunk-M7VYYHCE.module.min.js} +1 -1
- package/dist/chunk-chunk-MC35ILYP.module.min.js +2 -0
- package/dist/{chunk-chunk-2VUEY5TH.module.min.js → chunk-chunk-N72SWNBV.module.min.js} +1 -1
- package/dist/chunk-chunk-OBQRFTIL.module.min.js +2 -0
- package/dist/chunk-chunk-OQTLSTGI.module.min.js +2 -0
- package/dist/{chunk-chunk-2UN3ANRN.module.min.js → chunk-chunk-SA3D43RA.module.min.js} +1 -1
- package/dist/chunk-chunk-SANERMIZ.module.min.js +2 -0
- package/dist/{chunk-chunk-DNY43POY.module.min.js → chunk-chunk-UHSZEB74.module.min.js} +1 -1
- package/dist/{chunk-chunk-CYIML3AV.module.min.js → chunk-chunk-XQYVEKEJ.module.min.js} +1 -1
- package/dist/{chunk-chunk-27HVVXS6.module.min.js → chunk-chunk-Y6AXCRVO.module.min.js} +1 -1
- package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -6
- package/dist/components/charts/realtime/temporalHistogramConfig.d.ts +11 -0
- package/dist/components/charts/shared/areaSeriesData.d.ts +15 -0
- package/dist/components/charts/shared/chartMode.d.ts +67 -0
- package/dist/components/charts/shared/colorUtils.d.ts +8 -0
- package/dist/components/charts/shared/geoStyleDefaults.d.ts +3 -0
- package/dist/components/charts/shared/hooks.d.ts +13 -80
- package/dist/components/charts/shared/useChartSetup.d.ts +3 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +3 -0
- package/dist/components/charts/shared/useXYLineStyle.d.ts +3 -2
- package/dist/components/charts/shared/xyLineStyle.d.ts +21 -0
- package/dist/components/charts/xy/LineChart.d.ts +3 -0
- package/dist/components/legendLayout.d.ts +31 -0
- package/dist/components/server/serverChartConfigShared.d.ts +29 -0
- package/dist/components/server/serverChartConfigs.d.ts +2 -13
- package/dist/components/server/serverChartConfigsXY.d.ts +3 -0
- package/dist/components/server/serverGaugeOverlay.d.ts +28 -0
- package/dist/components/server/staticLegend.d.ts +7 -1
- package/dist/components/server/staticSVGChrome.d.ts +57 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +2 -0
- package/dist/components/stream/GeoSVGOverlay.d.ts +2 -0
- package/dist/components/stream/SceneToSVG.d.ts +8 -6
- package/dist/components/stream/SceneToSVGGeo.d.ts +10 -0
- package/dist/components/stream/SceneToSVGNetwork.d.ts +12 -0
- package/dist/components/stream/canvasBackground.d.ts +7 -0
- package/dist/components/stream/networkTypes.d.ts +2 -4
- package/dist/components/stream/renderBackend.d.ts +14 -0
- package/dist/components/stream/sceneToSVGShared.d.ts +51 -0
- package/dist/components/types/legendTypes.d.ts +16 -3
- 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/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.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core.module.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-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- 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 +1 -1
- package/dist/chunk-chunk-6F6GEAQU.module.min.js +0 -1
- package/dist/chunk-chunk-BHYTYMY2.module.min.js +0 -2
- package/dist/chunk-chunk-E7MIQX7D.module.min.js +0 -2
- package/dist/chunk-chunk-ES4DCG3L.module.min.js +0 -1
- package/dist/chunk-chunk-IFYPMWKY.module.min.js +0 -1
- package/dist/chunk-chunk-L6D3I3V7.module.min.js +0 -2
- package/dist/chunk-chunk-ODUZEEBH.module.min.js +0 -2
- package/dist/chunk-chunk-P6UBCMSQ.module.min.js +0 -2
- package/dist/chunk-chunk-STZFFTAN.module.min.js +0 -2
- package/dist/chunk-chunk-U3AGQ5EF.module.min.js +0 -2
- package/dist/chunk-chunk-WDIN4LRC.module.min.js +0 -1
- package/dist/chunk-chunk-XOYX77KF.module.min.js +0 -2
- package/dist/chunk-chunk-ZTNVDWAK.module.min.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{validateNetworkData as e,validateObjectData as t}from"./chunk-chunk-JCG72SGW.module.min.js";import{mergeShapeStyle as o,useCustomChartScaffold as n,useFrameImperativeHandle as i,useResolvedSelection as r}from"./chunk-chunk-I6C3KR5H.module.min.js";import{StreamNetworkFrame_default as s,buildRibbonGeometry as a}from"./chunk-chunk-SA3D43RA.module.min.js";import{buildBaseMetadataProps as l,buildCustomBehaviorProps as c}from"./chunk-chunk-A63CTACR.module.min.js";import{mulberry32 as d}from"./chunk-chunk-SIRIJ3DY.module.min.js";import{composeStyleRules as m,makeNodeRuleContext as h}from"./chunk-chunk-EMO5NUGE.module.min.js";import{COLOR_SCHEMES as g,DEFAULT_COLORS as u,DEFAULT_SELECTION_OPACITY as p,DEPTH_PALETTE_COLORS as f,filterSparseArray as b,getColor as y,normalizeTooltip as v,resolveCategoricalPalette as k,resolveDefaultFill as S,resolveMobileInteraction as w,useChartLegendAndMargin as C,useChartMode as T,useChartSelection as A,useColorScale as I,useLegendInteraction as M,useThemeCategorical as H}from"./chunk-chunk-6HSGDMTA.module.min.js";import{getMin as x}from"./chunk-chunk-JJ2OOIET.module.min.js";import{ChartError as B,SafeRender as N,renderEmptyState as D,renderLoadingState as O}from"./chunk-chunk-ZCNBUZPL.module.min.js";import{forwardRef as P,useMemo as L}from"react";import{jsx as E}from"react/jsx-runtime";var W=P(function(e,t){const{nodes:o,edges:i,layout:r,layoutConfig:a,onLayoutError:d,nodeIDAccessor:m="id",sourceAccessor:h="source",targetAccessor:g="target",margin:u,className:p,colorBy:f,colorScheme:y,selection:v,linkedHover:k,onObservation:S,onClick:C,chartId:T,annotations:I,autoPlaceAnnotations:M,frameProps:H={}}=e,{frameRef:x,resolved:B,normalizedMargin:P}=n({imperativeRef:t,imperativeVariant:"network",margin:u,width:e.width,height:e.height,enableHover:e.enableHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),W=L(()=>b(o),[o]),R=L(()=>b(i),[i]),z=L(()=>void 0===o&&void 0===i?void 0:[...W,...R],[i,o,R,W]),F=w(e.mobileInteraction,{mode:e.mode,width:B.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:j,customClickBehavior:$,activeSelectionHook:_}=A({selection:v,linkedHover:k,fallbackFields:"string"==typeof f?[f]:[],onObservation:S,onClick:C,chartType:"NetworkCustomChart",chartId:T,colorByField:"string"==typeof f?f:void 0,mobileInteraction:F}),G=L(()=>_?.isActive?{isActive:!0,predicate:_.predicate}:null,[_?.isActive,_?.predicate]),{width:q,height:J,enableHover:X,title:Z,description:K,summary:Y,accessibleTable:U}=B,Q=O(e.loading,q,J,e.loadingContent),V=Q?null:D(z,q,J,e.emptyContent);if(Q||V)return Q||V;const ee={chartType:"force",...null!=o&&{nodes:W},...null!=i&&{edges:R},customNetworkLayout:r,layoutConfig:a,onLayoutError:d,nodeIDAccessor:m,sourceAccessor:h,targetAccessor:g,colorBy:f,colorScheme:y,size:[q,J],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:P,enableHover:X,...l({title:Z,description:K,summary:Y,accessibleTable:U,className:p,animate:e.animate,autoPlaceAnnotations:M}),...c({linkedHover:k,selection:v,onObservation:S,onClick:C,mobileInteraction:F,customHoverBehavior:j,customClickBehavior:$,linkedHoverInClickPredicate:!1}),layoutSelection:G,...null!=I&&{annotations:I},...H};return E(N,{componentName:"NetworkCustomChart",width:q,height:J,children:E(s,{ref:x,...ee})})});W.displayName="NetworkCustomChart";import{useMemo as R,forwardRef as z,useRef as F}from"react";import{useMemo as j}from"react";function $(e,t){if(!e)return[];const o=[],n=e=>{o.push(e);const i="function"==typeof t?t(e):e[t];i&&Array.isArray(i)&&i.forEach(n)};return n(e),o}function _(e,t,o,n){if(e&&e.length>0)return e;const i=new Set;return t.forEach(e=>{const t="function"==typeof o?o(e):e[o],r="function"==typeof n?n(e):e[n];i.add(t),i.add(r)}),Array.from(i).map(e=>({id:e}))}function G(e){return"function"==typeof e?e:t=>t[e]||1}function q({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:n,edgeOpacity:i,baseStyle:r={}}){return s=>{const a={fillOpacity:i,...r};if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=y(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=y(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*i);return a}}function J(e){const{nodes:t,edges:o,inferNodes:n=!0,sourceAccessor:i="source",targetAccessor:r="target",colorBy:s,colorScheme:a,showLegend:l,legendPosition:c,legendInteraction:d,selection:m,linkedHover:h,onObservation:g,onClick:p,mobileInteraction:f,mobileSemantics:y,chartType:v,chartId:S,marginDefaults:T,userMargin:x,width:B,height:N,loading:P,loadingContent:L,emptyContent:E,emptyDataKey:W="edges"}=e,R=j(()=>b(o),[o]),z=j(()=>b(t),[t]),F=O(P,B,N,L),$=F?null:D("nodes"===W?void 0===t?void 0:z:void 0===o?void 0:R,B,N,E),G=j(()=>n?_(z,R,i,r):z,[n,z,R,i,r]),q=I(G,s,a),J=H(),X=j(()=>Array.isArray(a)&&a.length>0?a:[...k(a,J,u)],[a,J]),Z=j(()=>{if(!s)return[];const e=new Set;for(const t of G){const o="function"==typeof s?s(t):t[s];null!=o&&e.add(o+"")}return Array.from(e)},[G,s]),K=M(d,s,Z),{legend:Y,margin:U,legendPosition:Q}=C({data:G,colorBy:s,colorScale:q,showLegend:l,legendPosition:c,userMargin:x,defaults:T,categories:Z}),V=j(()=>w(f,{width:B,mobileSemantics:y}),[f,B,y]),ee=A({selection:m,linkedHover:h,fallbackFields:s?["string"==typeof s?s:""]:[],unwrapData:!0,onObservation:g,onClick:p,mobileInteraction:V,chartType:v,chartId:S}),{customHoverBehavior:te,customClickBehavior:oe,activeSelectionHook:ne,hoverSelectionHook:ie,crosshairSourceId:re}=ee;return{safeNodes:G,safeEdges:R,colorScale:q,effectivePalette:X,themeCategorical:J,allCategories:Z,legendState:K,legend:Y,margin:U,legendPosition:Q,mobileInteraction:V,customHoverBehavior:te,customClickBehavior:oe,activeSelectionHook:ne,hoverSelectionHook:ie,crosshairSourceId:re,loadingEl:F,emptyEl:$}}import{jsx as X}from"react/jsx-runtime";var Z=z(function(t,n){const r=F(null);i(n,{variant:"network",frameRef:r});const a=T(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules},{width:600,height:600}),{nodes:l,edges:d,margin:g,className:u,nodeIdAccessor:p,nodeIDAccessor:f,sourceAccessor:b="source",targetAccessor:k="target",nodeLabel:w,colorBy:C,colorScheme:A,styleRules:I,nodeSize:M=8,nodeSizeRange:H=[5,20],edgeWidth:x=1,edgeColor:D="#999",edgeOpacity:O=.6,iterations:P=300,forceStrength:L=.1,layoutExecution:E="auto",layoutLoadingContent:W,onLayoutStateChange:z,tooltip:j,frameProps:$={},onObservation:_,onClick:G,chartId:q,selection:Z,linkedHover:K,loading:Y,loadingContent:U,emptyContent:Q,legendInteraction:V,legendPosition:ee,stroke:te,strokeWidth:oe,opacity:ne}=t,ie=p??f??"id",{width:re,height:se,enableHover:ae,showLegend:le,showLabels:ce=!1,title:de,description:me,summary:he,accessibleTable:ge}=a,ue=J({nodes:l,edges:d,inferNodes:!1,nodeIdAccessor:ie,sourceAccessor:b,targetAccessor:k,colorBy:C,colorScheme:A,showLegend:le,legendPosition:ee,legendInteraction:V,selection:Z,linkedHover:K,onObservation:_,onClick:G,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"ForceDirectedGraph",chartId:q,marginDefaults:a.marginDefaults,userMargin:g,width:re,height:se,loading:Y,loadingContent:U,emptyContent:Q,emptyDataKey:"nodes"}),pe=R(()=>new Map,[]),fe=R(()=>e=>{const t={};return t.fill=C?y(e.data||e,C,ue.colorScale):S(void 0,ue.themeCategorical,A,void 0,pe),"number"==typeof M&&(t.r=M),t},[C,ue.colorScale,M,ue.themeCategorical,A,pe]),be=R(()=>h(C,"number"==typeof M?void 0:M),[C,M]),ye=R(()=>o(m(fe,I,be,e=>e.data||e),{stroke:te,strokeWidth:oe,opacity:ne}),[fe,I,be,te,oe,ne]),ve=R(()=>e=>{const t=e.data||e;let o;if("number"==typeof x)o=x;else if("function"==typeof x)o=x(t);else{const e=t[x],n="number"==typeof e?e:Number(e);o=Number.isFinite(n)&&n>0?n:1}return{stroke:D,strokeWidth:o,opacity:O}},[x,D,O]),ke=R(()=>o(ve,{stroke:te,strokeWidth:oe,opacity:ne}),[ve,te,oe,ne]),Se=R(()=>{if(ce&&w)return"function"==typeof w?w:e=>e.data?.[w]??e[w]??e.id},[ce,w]),we=e({componentName:"ForceDirectedGraph",nodes:l,edges:d,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:ie}});return we?X(B,{componentName:"ForceDirectedGraph",message:we,width:re,height:se}):ue.loadingEl?ue.loadingEl:ue.emptyEl?ue.emptyEl:X(N,{componentName:"ForceDirectedGraph",width:re,height:se,children:X(s,{ref:r,chartType:"force",...null!=l&&{nodes:ue.safeNodes},...null!=d&&{edges:ue.safeEdges},size:[re,se],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ue.margin,nodeIDAccessor:ie,sourceAccessor:b,targetAccessor:k,iterations:P,forceStrength:L,layoutExecution:E,layoutLoadingContent:W,onLayoutStateChange:z,nodeStyle:ye,edgeStyle:ke,colorBy:C,colorScheme:ue.effectivePalette,nodeSize:M,nodeSizeRange:H,nodeLabel:Se,showLabels:ce,enableHover:ae,tooltipContent:!1===j?()=>null:v(j)||void 0,...c({linkedHover:K,selection:Z,onObservation:_,onClick:G,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:ue.legend,legendPosition:ue.legendPosition,...V&&"none"!==V&&{legendHoverBehavior:ue.legendState.onLegendHover,legendClickBehavior:ue.legendState.onLegendClick,legendHighlightedCategory:ue.legendState.highlightedCategory,legendIsolatedCategories:ue.legendState.isolatedCategories},className:u,title:de,description:me,summary:he,accessibleTable:ge,...null!=t.animate&&{animate:t.animate},...$})})});Z.displayName="ForceDirectedGraph";import{useMemo as K,forwardRef as Y,useRef as U}from"react";import{jsx as Q}from"react/jsx-runtime";var V=Y(function(t,n){const r=U(null);i(n,{variant:"network",frameRef:r,overrides:{getData:()=>r.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const a=T(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules},{width:600,height:600}),{nodes:l,edges:d,margin:p,className:f,sourceAccessor:b="source",targetAccessor:k="target",valueAccessor:w="value",nodeIdAccessor:C="id",colorBy:A,colorScheme:I,styleRules:M,edgeColorBy:H="source",padAngle:x=.01,groupWidth:D=20,sortGroups:O,nodeLabel:P,edgeOpacity:L=.5,tooltip:E,frameProps:W={},onObservation:R,onClick:z,chartId:F,selection:j,linkedHover:$,loading:_,loadingContent:G,emptyContent:X,legendInteraction:Z,stroke:Y,strokeWidth:V,opacity:ee}=t,{width:te,height:oe,enableHover:ne,showLabels:ie=!0,title:re,description:se,summary:ae,accessibleTable:le}=a,ce=J({nodes:l,edges:d,inferNodes:!0,nodeIdAccessor:C,sourceAccessor:b,targetAccessor:k,colorBy:A,colorScheme:I,showLegend:!1,legendInteraction:Z,selection:j,linkedHover:$,onObservation:R,onClick:z,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"ChordDiagram",chartId:F,marginDefaults:a.marginDefaults,userMargin:p,width:te,height:oe,loading:_,loadingContent:G,emptyContent:X}),de=K(()=>new Map,[]),me=K(()=>new Map,[]),he=ce.safeNodes.length>0,ge=K(()=>{if(he)return(e,t)=>{const o={stroke:"black",strokeWidth:1};if(A)o.fill=y(e.data||e,A,ce.colorScale);else{const n=Array.isArray(I)?I:g[I]||u,i=Array.isArray(n)?n:u,r=(e.id??e.data?.[C]??"")+"";me.has(r)||me.set(r,me.size);const s=e.index??t??me.get(r);o.fill=i[s%i.length]}return o}},[he,A,ce.colorScale,I,C,me]),ue=K(()=>h(A),[A]),pe=K(()=>{if(ge||M&&M.length>0)return o(m(ge,M,ue,e=>e.data||e),{stroke:Y,strokeWidth:V,opacity:ee})},[ge,M,ue,Y,V,ee]),fe=K(()=>{if(he)return q({edgeColorBy:H,colorBy:A,colorScale:ce.colorScale,nodeStyleFn:pe||(e=>({fill:S(void 0,ce.themeCategorical,I,void 0,de)})),edgeOpacity:L,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:L}})},[he,H,A,ce.colorScale,pe,L,ce.themeCategorical,I,de]),be=K(()=>fe?o(fe,{stroke:Y,strokeWidth:V,opacity:ee}):void 0,[fe,Y,V,ee]),ye=K(()=>{if(!ie)return;const e=P||C;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[ie,P,C]),ve=e({componentName:"ChordDiagram",edges:d,edgesRequired:!0});return ve?Q(B,{componentName:"ChordDiagram",message:ve,width:te,height:oe}):ce.loadingEl?ce.loadingEl:ce.emptyEl?ce.emptyEl:Q(N,{componentName:"ChordDiagram",width:te,height:oe,children:Q(s,{ref:r,chartType:"chord",...ce.safeNodes.length>0&&{nodes:ce.safeNodes},...null!=d&&{edges:ce.safeEdges},size:[te,oe],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ce.margin,nodeIDAccessor:C,sourceAccessor:b,targetAccessor:k,valueAccessor:w,padAngle:x,groupWidth:D,sortGroups:O,nodeStyle:pe,edgeStyle:be,colorBy:A,colorScheme:ce.effectivePalette,edgeColorBy:H,edgeOpacity:L,nodeLabel:ye,showLabels:ie,enableHover:ne,tooltipContent:!1===E?()=>null:v(E)||void 0,...c({linkedHover:$,selection:j,onObservation:R,onClick:z,mobileInteraction:ce.mobileInteraction,customHoverBehavior:ce.customHoverBehavior,customClickBehavior:ce.customClickBehavior,linkedHoverInClickPredicate:!1}),...Z&&"none"!==Z&&{legendHoverBehavior:ce.legendState.onLegendHover,legendClickBehavior:ce.legendState.onLegendClick,legendHighlightedCategory:ce.legendState.highlightedCategory,legendIsolatedCategories:ce.legendState.isolatedCategories},className:f,title:re,description:se,summary:ae,accessibleTable:le,...null!=t.animate&&{animate:t.animate},...W})})});V.displayName="ChordDiagram";import{useMemo as ee,forwardRef as te,useRef as oe}from"react";import{jsx as ne}from"react/jsx-runtime";var ie=te(function(t,n){const r=oe(null);i(n,{variant:"network",frameRef:r,overrides:{getData:()=>r.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const a=T(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules},{width:800,height:600}),{nodes:l,edges:d,margin:g,className:u,sourceAccessor:p="source",targetAccessor:f="target",valueAccessor:b="value",nodeIdAccessor:k="id",colorBy:w,colorScheme:C,styleRules:A,edgeColorBy:I="source",orientation:M="horizontal",nodeAlign:H="justify",nodePaddingRatio:x=.05,nodeWidth:D=15,nodeLabel:O,edgeOpacity:P=.5,edgeSort:L,tooltip:E,frameProps:W={},onObservation:R,onClick:z,chartId:F,selection:j,linkedHover:$,loading:_,loadingContent:G,emptyContent:X,showLegend:Z,legendPosition:K,legendInteraction:Y,stroke:U,strokeWidth:Q,opacity:V}=t,{width:te,height:ie,enableHover:re,showLabels:se=!0,title:ae,description:le,summary:ce,accessibleTable:de}=a,me=J({nodes:l,edges:d,inferNodes:!0,nodeIdAccessor:k,sourceAccessor:p,targetAccessor:f,colorBy:w,colorScheme:C,showLegend:Z,legendPosition:K,legendInteraction:Y,selection:j,linkedHover:$,onObservation:R,onClick:z,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"SankeyDiagram",chartId:F,marginDefaults:a.marginDefaults,userMargin:g,width:te,height:ie,loading:_,loadingContent:G,emptyContent:X}),he=ee(()=>new Map,[]),ge=ee(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=w?y(e.data||e,w,me.colorScale):S(void 0,me.themeCategorical,C,void 0,he),t},[w,me.colorScale,me.themeCategorical,C,he]),ue=ee(()=>h(w,b),[w,b]),pe=ee(()=>o(m(ge,A,ue,e=>e.data||e),{stroke:U,strokeWidth:Q,opacity:V}),[ge,A,ue,U,Q,V]),fe=ee(()=>q({edgeColorBy:I,colorBy:w,colorScale:me.colorScale,nodeStyleFn:pe,edgeOpacity:P,baseStyle:{stroke:"none",strokeWidth:0}}),[I,w,me.colorScale,pe,P]),be=ee(()=>o(fe,{stroke:U,strokeWidth:Q,opacity:V}),[fe,U,Q,V]),ye=ee(()=>{if(!se)return;const e=O||k;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[se,O,k]),ve=e({componentName:"SankeyDiagram",edges:d,edgesRequired:!0});return ve?ne(B,{componentName:"SankeyDiagram",message:ve,width:te,height:ie}):me.loadingEl?me.loadingEl:me.emptyEl?me.emptyEl:ne(N,{componentName:"SankeyDiagram",width:te,height:ie,children:ne(s,{ref:r,chartType:"sankey",...me.safeNodes.length>0&&{nodes:me.safeNodes},...null!=d&&{edges:me.safeEdges},size:[te,ie],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:me.margin,nodeIDAccessor:k,sourceAccessor:p,targetAccessor:f,valueAccessor:b,orientation:M,nodeAlign:H,nodePaddingRatio:x,nodeWidth:D,nodeStyle:pe,edgeStyle:be,colorBy:w,colorScheme:me.effectivePalette,edgeColorBy:I,edgeOpacity:P,edgeSort:L,nodeLabel:ye,showLabels:se,enableHover:re,tooltipContent:!1===E?()=>null:v(E)||void 0,...c({linkedHover:$,selection:j,onObservation:R,onClick:z,mobileInteraction:me.mobileInteraction,customHoverBehavior:me.customHoverBehavior,customClickBehavior:me.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:me.legend,legendPosition:me.legendPosition,...Y&&"none"!==Y&&{legendHoverBehavior:me.legendState.onLegendHover,legendClickBehavior:me.legendState.onLegendClick,legendHighlightedCategory:me.legendState.highlightedCategory,legendIsolatedCategories:me.legendState.isolatedCategories},className:u,title:ae,description:le,summary:ce,accessibleTable:de,...null!=t.animate&&{animate:t.animate},...W})})});function re(e,t,o){const n=[],i=new Set(e.map(e=>e.id)),r=Array.isArray(o)&&2===o.length,s=r&&Number.isFinite(o[0])&&Number.isFinite(o[1]);r&&s&&s&&o[1]>=o[0]||n.push({kind:"invalid-domain"});for(const t of e)null!=t.xExtent&&(Array.isArray(t.xExtent)&&2===t.xExtent.length&&Number.isFinite(t.xExtent[0])&&Number.isFinite(t.xExtent[1])&&t.xExtent[1]>=t.xExtent[0]||n.push({kind:"invalid-node-time",id:t.id}));for(const e of t)i.has(e.source)||n.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),i.has(e.target)||n.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?(Number.isFinite(e.value)&&e.value>0||n.push({kind:"invalid-value",id:e.id}),e.endTime>e.startTime||n.push({kind:"backward-edge",id:e.id,source:e.source,target:e.target})):n.push({kind:"invalid-edge-time",id:e.id});return n}function se(e){return"invalid-node-time"===e.kind?`node ${e.id} has an invalid xExtent (must be [start, end] with start <= end)`:"invalid-edge-time"===e.kind?`edge ${e.id} has an invalid startTime or endTime`:"invalid-domain"===e.kind?"time domain must be a 2-tuple of finite times [start, end] with start <= end":"invalid-value"===e.kind?`edge ${e.id} must have a positive finite value`:"missing-node"===e.kind?`edge ${e.id} references missing ${e.endpoint} node "${e.nodeId}"`:"backward-edge"===e.kind?`edge ${e.id} (${e.source}->${e.target}) ends before it starts`:e.kind}function ae(e,t,o){const n=t.incoming[e.id],i=t.outgoing[e.id],r=[];for(const e of n)r.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:o.get(e.id).targetSide});for(const e of i)r.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:o.get(e.id).sourceSide});const s={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},a=()=>{r.sort((e,t)=>e.time-t.time||(s[e.kind]??99)-(s[t.kind]??99))},l=r.length?x(r.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,d=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,m=[...new Set(r.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;m.length>e;e++)h.set(m[e],m[e-1]);const g=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=d?d:e};a();const u=[];let p=0,f=0;for(const e of r)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?p:f);if(o>0){const t="top"===e.side?"bot":"top",n=Math.min(o,"top"===t?p:f);if(n>0){const i=g(e.time);u.push({time:i,delta:-n,kind:"transfer-out",side:t}),u.push({time:i,delta:+n,kind:"transfer-in",side:e.side}),"top"===t?p-=n:f-=n,"top"===e.side?p+=n:f+=n,o-=n}o>0&&null!==d&&(u.push({time:d,delta:+o,kind:"create",side:e.side}),"top"===e.side?p+=o:f+=o)}"top"===e.side?p-=t:f-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?p+=t:f+=t}r.push(...u),a();let b=0,y=0,v=0,k=0,S=0;const w=[],C=new Map;for(const e of r){if(w.push({t:e.time,topMass:b,botMass:y}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?b:y;C.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?b+=e.delta:y+=e.delta,b+y>v&&(v=b+y),b>k&&(k=b),y>S&&(S=y),w.push({t:e.time,topMass:b,botMass:y})}const T=[];let A=0;for(;w.length>A;){let e=A;for(;w.length>e+1&&w[e+1].t===w[A].t;)e++;T.push(w[A]);for(let t=A+1;e>=t;t++){const e=T[T.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||T.push(w[t])}A=e+1}const I=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let M=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===M||M>e.systemInTime)&&(M=e.systemInTime);let H=null;for(const e of n)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===H||e.systemOutTime>H)&&(H=e.systemOutTime);if(T.length>0){const e=T[T.length-1],t=Math.max(null!=I?I:-1/0,null!=H?H:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&T.push({t:t,topMass:e.topMass,botMass:e.botMass});const o=T[0],n=Math.min(null!=c?c:1/0,null!=M?M:1/0);Number.isFinite(n)&&o.t>n&&o.topMass+o.botMass>0&&T.unshift({t:n,topMass:o.topMass,botMass:o.botMass})}return{samples:T,peak:v,topPeak:k,botPeak:S,localAttachments:C}}function le(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function ce(e,t){return e.map(e=>({t:le(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function de(e,t,o){const n=e.value*o;if("out"===e.kind){const i=e.sideMassBefore*o;if("top"===e.side){const e=t-i;return[e,e+n]}const r=t+i;return[r-n,r]}const i=e.sideMassAfter*o;if("top"===e.side){const e=t-i;return[e,e+n]}const r=t+i;return[r-n,r]}function me(e,t){let o=0;for(let n=0;t.length>n;n++)for(let i=n+1;t.length>i;i++){const r=t[n],s=t[i];r.source!==s.source&&r.target!==s.target&&r.source!==s.target&&r.target!==s.source&&(Math.min(r.endTime,s.endTime)>Math.max(r.startTime,s.startTime)&&e[s.source]>e[r.source]!=e[s.target]>e[r.target]&&o++)}return o}function he(e,t){let o=0;for(const n of t)o+=Math.abs(e[n.source]-e[n.target])*(n.value||1);return o}function ge(e,t){return 1e3*me(e,t)+he(e,t)}function ue(e,t){return{slots:e.map(e=>({peak:{...e.peak},occupants:e.occupants.slice()})),map:{...t}}}function pe(e,t,o){e.length>8||o.length>40?(function(e,t,o,n=6){const i=e.length;if(1>=i)return;let r=ue(e,t),s=ge(t,o);for(let a=0;n>a;a++){const n=Array(i).fill(0),a=Array(i).fill(0);for(const e of o){const o=t[e.source],i=t[e.target];n[o]+=i*(e.value||1),a[o]+=e.value||1,n[i]+=o*(e.value||1),a[i]+=e.value||1}const l=Array.from({length:i},(e,t)=>t).sort((e,t)=>(a[e]>0?n[e]/a[e]:e)-(a[t]>0?n[t]/a[t]:t)),c=l.map(t=>e[t]),d=new Map;l.forEach((e,t)=>d.set(e,t));for(const e of Object.keys(t))t[e]=d.get(t[e]);e.length=0;for(const t of c)e.push(t);const m=ge(t,o);if(s>m)s=m,r=ue(e,t);else if(m===s)break}!function(e,t,o){e.length=0;for(const t of o.slots)e.push(t);for(const e of Object.keys(t))delete t[e];for(const e of Object.keys(o.map))t[e]=o.map[e]}(e,t,r)}(e,t,o,6),function(e,t,o,n=6){const i=e.length;if(1>=i)return;let r=ge(t,o);for(let s=0;n>s;s++){let n=!1;for(let s=0;i-1>s;s++){const i=e[s];e[s]=e[s+1],e[s+1]=i;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s);const a=ge(t,o);if(r>a)r=a,n=!0;else{const o=e[s];e[s]=e[s+1],e[s+1]=o;for(const e of Object.keys(t))t[e]===s?t[e]=s+1:t[e]===s+1&&(t[e]=s)}}if(!n)break}}(e,t,o,6)):function(e,t,o){const n=e.length;if(1>=n)return;const i={...t},r=Object.keys(i),s=Array.from({length:n},(e,t)=>t),a=s.slice(),l={...i};let c=s.slice(),d=1/0;const m=()=>{for(const e of r)l[e]=a[i[e]];const e=ge(l,o);d>e&&(d=e,c=s.slice())},h=(e,t)=>{const o=s[e],n=s[t];s[e]=n,s[t]=o,a[o]=t,a[n]=e};m();const g=Array(n).fill(0);let u=0;for(;n>u;)u>g[u]?(h(u%2==0?0:g[u],u),m(),g[u]++,u=0):(g[u]=0,u++);const p=c.map(t=>e[t]),f=new Map;c.forEach((e,t)=>f.set(e,t));for(const e of Object.keys(t))t[e]=f.get(t[e]);e.length=0;for(const t of p)e.push(t)}(e,t,o)}function fe(e,t,o,n,i){const{plotH:r,padding:s,valueScale:a,packing:l,laneOrder:c,lifetimeMode:d="full"}=i,m={},h={};for(const t of e)m[t.id]=o[t.id].topPeak||0,h[t.id]=o[t.id].botPeak||0;const g="half"===d,u={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,o=Array.isArray(t.xExtent)?t.xExtent[1]:null;let i=null!=e&&Number.isFinite(e)?e:1/0,r=null!=o&&Number.isFinite(o)?o:-1/0;for(const e of n.outgoing[t.id]){i>e.startTime&&(i=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&i>e.systemInTime&&(i=e.systemInTime);const t=g?(e.startTime+e.endTime)/2:e.endTime;t>r&&(r=t)}for(const e of n.incoming[t.id]){const t=g?(e.startTime+e.endTime)/2:e.startTime;i>t&&(i=t),e.endTime>r&&(r=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>r&&(r=e.systemOutTime)}u[t.id]={start:Number.isFinite(i)?i:null,end:Number.isFinite(r)?r:null}}const p={},f=[];if("reuse"===l){const o=new Map;for(const t of e)o.set(t.id,0);const i=new Map;for(const t of e)i.set(t.id,0);for(const e of t)i.set(e.target,(i.get(e.target)??0)+1);const r=[];for(const t of e)0===(i.get(t.id)??0)&&r.push(t.id);for(;r.length;){const e=r.shift();for(const t of n.outgoing[e]??[]){const n=(o.get(e)??0)+1;n>(o.get(t.target)??0)&&o.set(t.target,n),i.set(t.target,i.get(t.target)-1),0===i.get(t.target)&&r.push(t.target)}}const s=[...e].filter(e=>null!==u[e.id].start).sort((e,t)=>{const n=o.get(e.id)??0,i=o.get(t.id)??0;return n!==i?n-i:u[e.id].start-u[t.id].start}),a=e.filter(e=>null===u[e.id].start);for(const e of[...s,...a]){const t=u[e.id];let o=-1;for(let e=0;f.length>e;e++){const n=f[e].occupants[f[e].occupants.length-1];if(null===t.start||void 0===n||t.start>=n.end){o=e;break}}-1===o&&(f.push({occupants:[],peak:{topPeak:0,botPeak:0}}),o=f.length-1),f[o].occupants.push({id:e.id,end:t?.end??-1/0}),f[o].peak.topPeak=Math.max(f[o].peak.topPeak,m[e.id]),f[o].peak.botPeak=Math.max(f[o].peak.botPeak,h[e.id]),p[e.id]=o}}else e.forEach((e,t)=>{f.push({occupants:[{id:e.id,end:u[e.id]?.end??-1/0}],peak:{topPeak:m[e.id],botPeak:h[e.id]}}),p[e.id]=t});let b=null,y=null,v=null,k=null;const S=()=>{b=me(p,t),v=he(p,t)},w=()=>{y=me(p,t),k=he(p,t)};"crossing-min"===c?(S(),pe(f,p,t),w()):"inside-out"===c?(S(),function(e,t){const o=e.length;if(1>=o)return;const n=e=>e.peak.topPeak+e.peak.botPeak,i=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>n(t.slot)-n(e.slot)),r=Array(o),s=Math.floor((o-1)/2);r[s]=i[0].idx;let a=s-1,l=s+1;for(let e=1;i.length>e;e++)e%2==1&&o>l||0>a?r[l++]=i[e].idx:r[a--]=i[e].idx;const c=r.map(t=>e[t]),d=new Map;r.forEach((e,t)=>d.set(e,t));for(const e of Object.keys(t))t[e]=d.get(t[e]);e.length=0;for(const t of c)e.push(t)}(f,p),w()):"crossing-min+inside-out"===c&&(S(),pe(f,p,t),function(e,t,o){const n=e.length;if(1>=n)return;const i=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),r=Math.floor((n-1)/2);let s=ge(t,o);for(const{slot:a}of i){const i=e.indexOf(a);if(0>i)continue;const l=r;if(i===l)continue;const c=e[i];e.splice(i,1),e.splice(l,0,c);const d=new Map;for(let e=0;n>e;e++)d.set(e,e);if(l>i){for(let e=i+1;l>=e;e++)d.set(e,e-1);d.set(i,l)}else{for(let e=l;i>e;e++)d.set(e,e+1);d.set(i,l)}for(const e of Object.keys(t))t[e]=d.get(t[e]);const m=ge(t,o);if(m>s){const o=e[l];e.splice(l,1),e.splice(i,0,o);const r=new Map;for(let e=0;n>e;e++)r.set(e,e);if(i>l){for(let e=l+1;i>=e;e++)r.set(e,e-1);r.set(l,i)}else{for(let e=i;l>e;e++)r.set(e,e+1);r.set(l,i)}for(const e of Object.keys(t))t[e]=r.get(t[e])}else s=m}}(f,p,t),w());const C=f.map(e=>{const t=new Map;for(const n of e.occupants){const e=o[n.id];if(e)for(const o of e.samples){const e=t.get(o.t)||{top:0,bot:0};t.set(o.t,{top:Math.max(e.top,o.topMass),bot:Math.max(e.bot,o.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),T=(e,t)=>{let o={top:0,bot:0};for(const[n,i]of e){if(n>t)break;o=i}return o},A=[];for(let e=0;f.length-1>e;e++){const t=C[e],o=C[e+1],n=new Set([...t.map(e=>e[0]),...o.map(e=>e[0])]);let i=0;for(const e of n){const n=T(t,e),r=T(o,e);n.bot+r.top>i&&(i=n.bot+r.top)}A.push(i)}const I=[];let M=s+(f[0]?.peak.topPeak??0)*a;f.length>0&&I.push(M);for(let e=1;f.length>e;e++)M+=A[e-1]*a+s,I.push(M);if(f.length>0&&(M+=f[f.length-1].peak.botPeak*a+s),M>r){const e=r/M;for(let t=0;I.length>t;t++)I[t]*=e}const H=0===f.length?0:f[0].peak.topPeak+A.reduce((e,t)=>e+t,0)+f[f.length-1].peak.botPeak,x={};for(const t of e)x[t.id]=I[p[t.id]];return{effectiveSlotsHeight:H,centerlines:x,laneLifetime:u,slots:f,slotByNode:p,slotCenter:I,crossingsBefore:b,crossingsAfter:y,lengthBefore:v,lengthAfter:k}}ie.displayName="SankeyDiagram";import{useMemo as be,useState as ye,useRef as ve,useCallback as ke}from"react";import{scaleTime as Se}from"d3-scale";import{forwardRef as we}from"react";var Ce=e=>{const{bands:t=[],ribbons:o=[],showLabels:n=!0}=e.config,i=[];for(const e of o)i.push({type:"bezier",pathD:e.pathD,...e.bezier&&{bezierCache:e.bezier},style:{fill:e.fill,opacity:e.opacity,stroke:"none"},datum:{__kind:"ribbon",data:e.rawDatum,id:e.id}});for(const e of t)if(e.gradientStubs)for(let t=0;e.gradientStubs.length>t;t++){const o=e.gradientStubs[t];i.push({type:"bezier",pathD:o.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:.86,stroke:"none"},_gradient:{x0:o.x0,x1:o.x1,from:o.from,to:o.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${t}`}})}for(const e of t)i.push({type:"bezier",pathD:e.pathD,style:{...e.gradientStubs&&e.gradientStubs.length>0?{fill:"none"}:{fill:e.fill,fillOpacity:.86},stroke:e.stroke??e.fill,strokeWidth:e.strokeWidth??.5},datum:{__kind:"band",data:e.rawDatum,id:e.id}});const r=n?t.map(e=>({x:e.labelX,y:e.labelY,text:e.labelText,anchor:"end",baseline:"middle",fontSize:11,fontWeight:600})):[];return{sceneNodes:t.map(e=>({type:"circle",id:e.id,cx:-1e4,cy:-1e4,r:0,style:{fill:e.fill},datum:{__kind:"band",data:e.rawDatum,id:e.id}})),sceneEdges:i,labels:r}};function Te(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}import{Fragment as Ae,jsx as Ie,jsxs as Me}from"react/jsx-runtime";function He(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function xe(e,t){return"function"==typeof e?e(t):t[e]}var Be=we(function(e,t){const{nodes:o,edges:n,domain:r,axisTicks:l=[],nodeIdAccessor:c="id",sourceAccessor:d="source",targetAccessor:m="target",valueAccessor:h="value",startTimeAccessor:g="startTime",endTimeAccessor:u="endTime",systemInTimeAccessor:p,systemOutTimeAccessor:f,xExtentAccessor:k="xExtent",edgeIdAccessor:S="id",colorBy:w,colorScheme:C,showLegend:T,legendPosition:A="right",pairing:I="temporal",packing:M="reuse",laneOrder:H="crossing-min",ribbonLane:x="both",lifetimeMode:B="half",showLaneRails:N=!1,showQualityReadout:D=!1,showLabels:O=!0,width:P=600,height:L=400,margin:E,title:W,description:R,summary:z,accessibleTable:F,responsiveWidth:j,responsiveHeight:$,loading:G,loadingContent:q,emptyContent:X,edgeOpacity:Z=.35,timeFormat:K,valueFormat:Y,tooltip:U,enableHover:Q=!0,onObservation:V,onClick:ee,showParticles:te=!1,particleStyle:oe,chartId:ne,frameProps:ie={}}=e,[me,he]=ye([]),[ge,ue]=ye([]),pe=ve(me),we=ve(ge);pe.current=me,we.current=ge;const Be=ke(e=>{pe.current=e,he(e)},[]),Ne=ke(e=>{we.current=e,ue(e)},[]),De=void 0!==n,Oe=b(De?n:me),Pe=be(()=>{const e=b(o??[]),t=ge;if(0===e.length&&0===t.length)return _([],Oe,d,m);const n=new Set,i=[];for(const t of e){const e=xe(c,t)+"";n.has(e)||(n.add(e),i.push(t))}for(const e of t){const t=xe(c,e)+"";n.has(t)||(n.add(t),i.push(e))}const r=_([],Oe,d,m);for(const e of r)n.has(e.id)||(n.add(e.id),i.push(e));return i},[o,ge,Oe,c,d,m]),Le=ve(null),Ee=ke((e,t)=>{const o=xe(S,e);return null!=o?o+"":`${xe(d,e)}-${xe(m,e)}-${t}`},[S,d,m]),We=ke(e=>{if(null==e)return!1;const t=e;return null!=xe(d,t)&&null!=xe(m,t)},[d,m]);i(t,{variant:"network",frameRef:Le,overrides:{push(e){if(We(e)){if(De)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");Be([...pe.current,e])}else Ne([...we.current,e])},pushMany(e){const t=[],o=[];for(const n of e)We(n)?t.push(n):o.push(n);t.length>0&&(De?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):Be([...pe.current,...t])),o.length>0&&Ne([...we.current,...o])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),o=[];if(!De){const e=pe.current,n=[];for(let i=0;e.length>i;i++){const r=e[i];t.has(Ee(r,i))?o.push(r):n.push(r)}n.length!==e.length&&Be(n)}const n=we.current,i=[];for(const e of n){const n=xe(c,e)+"";t.has(n)?o.push(e):i.push(e)}return i.length!==n.length&&Ne(i),o},update(e,t){const o=new Set(Array.isArray(e)?e:[e]),n=[];if(!De){let e=!1;const i=pe.current.map((i,r)=>o.has(Ee(i,r))?(n.push(i),e=!0,t(i)):i);e&&Be(i)}let i=!1;const r=we.current.map(e=>{const r=xe(c,e)+"";return o.has(r)?(n.push(e),i=!0,t(e)):e});return i&&Ne(r),n},clear(){De||Be([]),Ne([]),Le.current?.clear()},getData:()=>Oe??[],getScales:()=>null}});const Re=Ee,ze=ke(e=>xe(c,e)+"",[c]),{nodes:Fe,edges:je,domain:$e,rawNodeById:_e,rawEdgeById:Ge}=be(()=>{const e=(Pe??[]).map(e=>{const t={id:ze(e),__raw:e},o=k?xe(k,e):null;if(Array.isArray(o)&&2===o.length){const e=He(o[0]),n=He(o[1]);Number.isFinite(e)&&Number.isFinite(n)&&(t.xExtent=[e,n])}return t}),t=(Oe??[]).map((e,t)=>{const o={id:Re(e,t),source:xe(d,e)+"",target:xe(m,e)+"",value:Number(xe(h,e)),startTime:He(xe(g,e)),endTime:He(xe(u,e)),__raw:e};if(p){const t=He(xe(p,e));Number.isFinite(t)&&(o.systemInTime=t)}if(f){const t=He(xe(f,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[He(r[0]),He(r[1])],n=new Map;for(const t of e)null!=t.__raw&&n.set(t.id,t.__raw);const i=new Map;for(const e of t)null!=e.__raw&&i.set(e.id,e.__raw);return{nodes:e,edges:t,domain:o,rawNodeById:n,rawEdgeById:i}},[Pe,Oe,r,ze,Re,k,d,m,h,g,u,p,f]),qe=J({nodes:Pe,edges:Oe,inferNodes:!1,nodeIdAccessor:c,sourceAccessor:d,targetAccessor:m,colorBy:w,colorScheme:C,showLegend:!1,legendPosition:A,selection:void 0,linkedHover:void 0,onObservation:V,onClick:ee,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:"ProcessSankey",chartId:ne,marginDefaults:{top:30,right:80,bottom:40,left:80},userMargin:E,width:P,height:L,loading:G,loadingContent:q,emptyContent:X}),Je=(T??!!w)&&!!w,Xe=ke(e=>null!=E&&("number"==typeof E||null!=E[e]),[E]),Ze=be(()=>{const e={...qe.margin};return Je&&("right"===A&&!Xe("right")&&140>e.right?e.right=140:"bottom"===A&&!Xe("bottom")&&80>e.bottom&&(e.bottom=80)),e},[qe.margin,Je,A,Xe]),Ke=P-Ze.left-Ze.right,Ye=L-Ze.top-Ze.bottom,Ue=be(()=>re(Fe,je,$e),[Fe,je,$e]),Qe=be(()=>Ue.length>0?null:function(e,t,o){const{plotH:n,pairing:i="temporal",packing:r="reuse",laneOrder:s="crossing-min",lifetimeMode:a="half"}=o,l=function(e,t){const o={},n={};for(const t of e)o[t.id]=[],n[t.id]=[];for(const e of t)n[e.source]&&n[e.source].push(e),o[e.target]&&o[e.target].push(e);return{incoming:o,outgoing:n}}(e,t),c=function(e,t,o,n="value"){const i="temporal"===n?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,r="temporal"===n?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,s=new Map;for(const e of t)s.set(e.id,{});const a=(e,t)=>{const o=new Map;for(const n of e){const e=n[t];o.has(e)||o.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const i=o.get(e);i.edges.push(n),i.total+=n.value,i.earliestStart=Math.min(i.earliestStart,n.startTime),i.latestEnd=Math.max(i.latestEnd,n.endTime)}const s=[...o.values()];s.sort("temporal"===n?(e,o)=>"target"===t?e.earliestStart-o.earliestStart:e.latestEnd-o.latestEnd:(e,t)=>t.total-e.total);for(const e of s)e.edges.sort("target"===t?r:i);return s};for(const t of e){const e=o.outgoing[t.id],n=o.incoming[t.id];if(0===n.length)a(e,"target").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).sourceSide=o});else if(0===e.length)a(n,"source").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).targetSide=o});else{const t=a(n,"source"),o=a(e,"target"),i=Math.max(t.length,o.length);for(let e=0;i>e;e++){const n=e%2==0?"top":"bot";if(t[e])for(const o of t[e].edges)s.get(o.id).targetSide=n;if(o[e])for(const t of o[e].edges)s.get(t.id).sourceSide=n}}}return s}(e,t,l,i);let d={};for(const t of e)d[t.id]=ae(t,l,c);const m=fe(e,t,d,l,{plotH:n,padding:12,valueScale:1,packing:r,laneOrder:s,lifetimeMode:a}),h=new Set;for(const e of t){const t=m.slotByNode[e.source],o=m.slotByNode[e.target];if(void 0===t||void 0===o)continue;const n=c.get(e.id);t!==o?t>o?(n.sourceSide="top",n.targetSide="bot"):(n.sourceSide="bot",n.targetSide="top"):(h.add(e.id),n.sourceSide="bot",n.targetSide="bot")}for(const t of e){const e=l.outgoing[t.id],o=l.incoming[t.id],n=new Set(e.map(e=>c.get(e.id).sourceSide)),i=new Set(o.map(e=>c.get(e.id).targetSide));if(1===n.size&&o.length>0){const e=[...n][0];for(const t of o)m.slotByNode[t.source]===m.slotByNode[t.target]&&(c.get(t.id).targetSide=e)}if(1===i.size&&e.length>0){const t=[...i][0];for(const o of e)m.slotByNode[o.source]===m.slotByNode[o.target]&&(c.get(o.id).sourceSide=t)}}for(const t of e){const e=l.incoming[t.id],o=l.outgoing[t.id];if(0===e.length||0===o.length)continue;const n=()=>{const t={inTop:0,inBot:0,outTop:0,outBot:0};for(const o of e)"top"===c.get(o.id).targetSide?t.inTop+=o.value:t.inBot+=o.value;for(const e of o)"top"===c.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},i=(e,t)=>{const i=n(),r="top"===e?i.outTop-i.inTop:i.outBot-i.inBot,s="top"===t?i.inTop-i.outTop:i.inBot-i.outBot;if(0>=r||0>=s)return!1;const a=Math.min(r,s),l=o.filter(t=>!h.has(t.id)&&c.get(t.id).sourceSide===e&&a>=t.value).sort((e,t)=>t.value-e.value);return 0!==l.length&&(c.get(l[0].id).sourceSide=t,!0)};let r=o.length+1;for(;r-- >0&&(i("top","bot")||i("bot","top")););}d={};for(const t of e)d[t.id]=ae(t,l,c);const g=fe(e,t,d,l,{plotH:n,padding:12,valueScale:1,packing:r,laneOrder:s,lifetimeMode:a}),u=g.effectiveSlotsHeight??g.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),p=Math.min(12,.35*n/Math.max(g.slots.length+1,1)),f=u>0?Math.max(0,(n-p*(g.slots.length+1))/u):1,b=fe(e,t,d,l,{plotH:n,padding:p,valueScale:f,packing:r,laneOrder:s,lifetimeMode:a});return{nodeData:d,sides:c,valueScale:f,padding:p,compressedPadding:12>p,centerlines:b.centerlines,laneLifetime:b.laneLifetime,slots:b.slots,slotByNode:b.slotByNode,crossingsBefore:b.crossingsBefore,crossingsAfter:b.crossingsAfter,lengthBefore:b.lengthBefore,lengthAfter:b.lengthAfter}}(Fe,je,{plotH:Ye,pairing:I,packing:M,laneOrder:H,lifetimeMode:B}),[Ue,Fe,je,Ye,I,M,H,B]),Ve=be(()=>Se().domain($e).range([0,Ke]),[$e,Ke]),et=ke((e,t)=>{if(w&&Pe){const t=_e.get(e);if(t)return y(t,w,qe.colorScale)}return qe.effectivePalette[t%qe.effectivePalette.length]||"#475569"},[w,Pe,_e,qe.colorScale,qe.effectivePalette]),tt=be(()=>{const e=new Map;return Fe.forEach((t,o)=>e.set(t.id,o)),e},[Fe]),ot=be(()=>{if(!Qe)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:o}=Qe,n=[],i=[];return Fe.forEach((i,r)=>{const s=t[i.id];if(!s||0===s.samples.length)return;const a=function(e,t,o,n,i){if(0===e.length)return null;const r=ce(e,i),s=e=>t-r[e].topMass*o,a=e=>t+r[e].botMass*o;let l=`M${n(r[0].t)},${s(0)}`;for(let e=1;r.length>e;e++)l+=` L${n(r[e].t)},${s(e)}`;l+=` L${n(r[r.length-1].t)},${a(r.length-1)}`;for(let e=r.length-2;e>=0;e--)l+=` L${n(r[e].t)},${a(e)}`;return l+" Z"}(s.samples,e[i.id],o,Ve,$e);if(!a)return;const l=ce(s.samples,$e),c=l.find(e=>e.topMass+e.botMass>0)||l[0],d=e[i.id]+(c.botMass-c.topMass)*o/2,m=et(i.id,r),h=_e.get(i.id)??i,g=function(e,t,o,n,i){const r=o.nodeData[e];if(!r||0===r.samples.length)return[];const s=o.valueScale,a=o.centerlines[e],l=ce(r.samples,i),c=l.find(e=>e.topMass+e.botMass>0)||l[0],d=[...l].reverse().find(e=>e.topMass+e.botMass>0)||l[l.length-1],m=n(c.t),h=n(d.t),g=e=>n(le(e,i)),u=[],p=(e,t,o,n)=>`M${e},${t} L${o},${t} L${o},${n} L${e},${n} Z`;for(const o of t){if(o.source===e&&null!=o.systemInTime&&Number.isFinite(o.systemInTime)){const e=r.localAttachments.get(o.id);if(e&&"out"===e.kind&&o.startTime>o.systemInTime){const t=g(o.systemInTime),n=g(o.startTime),i=t-20,r=Math.max(m,i);if(n>r){const[o,l]=de(e,a,s);u.push({pathD:p(r,o,n,l),x0:i,x1:t,from:0,to:1})}}}if(o.target===e&&null!=o.systemOutTime&&Number.isFinite(o.systemOutTime)){const e=r.localAttachments.get(o.id);if(e&&"in"===e.kind&&o.systemOutTime>o.endTime){const t=g(o.systemOutTime),n=g(o.endTime),i=t+20,r=Math.min(h,i);if(r>n){const[o,l]=de(e,a,s);u.push({pathD:p(n,o,r,l),x0:t,x1:i,from:1,to:0})}}}}return u}(i.id,je,Qe,Ve,$e);n.push({id:i.id,pathD:a,fill:m,stroke:m,strokeWidth:.5,...g.length>0&&{gradientStubs:g},rawDatum:h,labelX:Ve(c.t)-4,labelY:d,labelText:i.id})}),je.forEach(n=>{const r=t[n.source]?.localAttachments.get(n.id),s=t[n.target]?.localAttachments.get(n.id);if(!r||!s)return;const l=tt.get(n.source)??0,c=et(n.source,l),d=function(e,t,o,n,i,r,s,a){const l=i,c=e=>a?Math.max(a[0],Math.min(a[1],e)):e,d=r(c(e.time)),m=r(c(o.time)),h=e.value*l,g=o.value*l,u=e.sideMassBefore*l,p=o.sideMassAfter*l;let f,b,y,v;"top"===e.side?(f=t-u,b=f+h):(b=t+u,f=b-h),"top"===o.side?(y=n-p,v=y+g):(v=n+p,y=v-g);const k="source"===s?d+.85*(m-d):"target"===s?d+.15*(m-d):(d+m)/2;return{sx:d,sTop:f,sBot:b,tx:m,tTop:y,tBot:v,cp1X:k,cp2X:k}}(r,e[n.source],s,e[n.target],o,Ve,x,$e),{pathD:m,bezier:h}=a(d),g=Ge.get(n.id)??n;i.push({id:n.id,pathD:m,fill:c,opacity:Z,rawDatum:g,bezier:h})}),{bands:n,ribbons:i}},[Qe,Fe,je,Ve,$e,et,_e,Ge,x,Z,tt]),nt=be(()=>({bands:ot.bands,ribbons:ot.ribbons,showLabels:O}),[ot,O]),it=be(()=>{if(!Je||!w)return;const e=new Map;(Pe??[]).forEach((t,o)=>{const n=xe(w,t),i=null==n?"":n+"";i&&!e.has(i)&&e.set(i,{label:i,color:et(ze(t),o)})});const t=Array.from(e.values());return 0!==t.length?{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{const t=e.color||"#333";return{fill:t,stroke:t}}}]}:void 0},[Je,w,Pe,et,ze]),rt=be(()=>!1!==U&&Q?void 0===U||!0===U?null:v(U)||null:null,[U,Q]),st=ke(e=>K?K(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[K]),at=ke(e=>Y?Y(e):e+"",[Y]),lt=ke(e=>{if(!e||!e.data)return null;const t=e.data;if(!Te(t))return null;const o=t.data;if(rt)return rt(o);if("band"===t.__kind){const e=t.id,o=Qe?function(e){if(!e)return[];const t=new Set,o=[];for(const n of e.samples){const e=n.topMass+n.botMass,i=`${n.t}:${e}`;t.has(i)||(t.add(i),o.push({t:n.t,total:e}))}return o}(Qe.nodeData[e]):[],n=5,i=o.length>n?o.length:null,r=function(e,t=5){if(t>=e.length)return e.slice();const o=[...e].sort((e,t)=>e.total-t.total),n=o.length-1,i=[{...o[0],mark:"min"},{...o[Math.floor(.25*n)],mark:"q25"},{...o[Math.floor(.5*n)],mark:"median"},{...o[Math.floor(.75*n)],mark:"q75"},{...o[n],mark:"max"}],r=new Set,s=[];for(const e of i)r.has(e.t)||(r.add(e.t),s.push(e));return s.sort((e,t)=>e.t-t.t)}(o,n);return Me("div",{style:{minWidth:160},children:[Ie("div",{style:{fontWeight:600,marginBottom:4},children:e}),r.length>0&&Me("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[Ie("thead",{children:Me("tr",{style:{opacity:.6},children:[Ie("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),Ie("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=i&&Ie("th",{})]})}),Ie("tbody",{children:r.map((e,t)=>Me("tr",{children:[Ie("td",{style:{paddingRight:8},children:st(e.t)}),Ie("td",{style:{textAlign:"right"},children:at(e.total)}),null!=i&&Ie("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:e.mark})]},t))})]}),null!=i&&Me("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",r.length," of ",i," samples"]})]})}const n=o,i=xe(d,n),r=xe(m,n),s=xe(h,n),a=xe(g,n),l=xe(u,n);return Me("div",{style:{minWidth:160},children:[Me("div",{style:{fontWeight:600,marginBottom:4},children:[i+""," → ",r+""]}),Me("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=s&&Me(Ae,{children:[Ie("span",{style:{opacity:.6},children:"value"}),Ie("span",{style:{textAlign:"right"},children:at(Number(s))})]}),null!=a&&Me(Ae,{children:[Ie("span",{style:{opacity:.6},children:"start"}),Ie("span",{style:{textAlign:"right"},children:st(He(a))})]}),null!=l&&Me(Ae,{children:[Ie("span",{style:{opacity:.6},children:"end"}),Ie("span",{style:{textAlign:"right"},children:st(He(l))})]})]})]})},[Qe,rt,st,at,d,m,h,g,u]),ct=be(()=>{if(!Qe)return null;const{centerlines:e,laneLifetime:t,nodeData:o,valueScale:n,compressedPadding:i,crossingsBefore:r,crossingsAfter:s,lengthBefore:a,lengthAfter:c}=Qe;let d=null,m=null;for(const e of Fe){const o=t[e.id];if(!o||null===o.start||null===o.end)continue;const n=Ve(o.start),i=Ve(o.end);(null===d||d>n)&&(d=n),(null===m||i>m)&&(m=i)}const h=e=>Math.max(0,Math.min(Ke,e)),g=h(d??0),u=Math.max(g,h(m??Ke));return Me("g",{children:[D&&null!==(s??null)&&Me("text",{x:Ke,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",r," → ",s," ","edge length: ",Math.round(a)," → ",Math.round(c)]}),i&&Ie("text",{x:Ke,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),l.map((e,t)=>{const o=Ve(He(e.date));return g-.5>o||o>u+.5?null:Ie("line",{x1:o,y1:0,x2:o,y2:Ye,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+t)}),N&&Fe.map((i,r)=>{const s=t[i.id];if(!s||null===s.start)return null;const a=o[i.id],l=a?{topPeak:a.topPeak,botPeak:a.botPeak}:{topPeak:0,botPeak:0},c=e[i.id]+(l.botPeak-l.topPeak)*n/2,d=Ve(s.start),m=Ve(s.end),h=et(i.id,r);return Me("g",{children:[Ie("line",{x1:d,y1:c,x2:m,y2:c,stroke:h,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),Ie("line",{x1:d,y1:c-4,x2:d,y2:c+4,stroke:h,strokeOpacity:.5}),Ie("line",{x1:m,y1:c-4,x2:m,y2:c+4,stroke:h,strokeOpacity:.5})]},"lane-"+i.id)}),Ie("line",{x1:g,y1:Ye+4,x2:u,y2:Ye+4,stroke:"#94a3b8"}),l.map((e,t)=>{const o=He(e.date),n=Ve(o);if(g-.5>n||n>u+.5)return null;const i=null!=e.label?e.label:K?K(new Date(o)):"";return Me("g",{transform:`translate(${n},${Ye+4})`,children:[Ie("line",{y2:6,stroke:"#94a3b8"}),Ie("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:i})]},t)})]})},[Qe,l,Ve,Ke,Ye,N,Fe,et,D,K]),dt=be(()=>(Pe??[]).map(e=>({id:ze(e),data:e})),[Pe,ze]),mt=be(()=>{const e=new Map;for(const t of ot.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[ot]),ht=be(()=>(Oe??[]).map((e,t)=>{const o=Re(e,t),n=Number(xe(h,e));return{id:o,source:xe(d,e)+"",target:xe(m,e)+"",value:Number.isFinite(n)?n:0,bezier:mt.get(o),data:e}}),[Oe,Re,d,m,h,mt]),gt=qe.loadingEl,ut=qe.emptyEl;return Ue.length>0?Me("svg",{width:P,height:L,role:"img","aria-label":W??"Process Sankey validation failed",children:[Ie("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Ue.map((e,t)=>Ie("text",{x:20,y:56+18*t,fontSize:12,fill:"#64748b",children:"• "+se(e)},t))]}):gt||ut||Ie(s,{ref:Le,chartType:"force",nodes:dt,edges:ht,customNetworkLayout:Ce,layoutConfig:nt,size:[P,L],responsiveWidth:j,responsiveHeight:$,margin:Ze,title:W,description:R??"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:z,accessibleTable:F,enableHover:Q,tooltipContent:!1===U?()=>null:lt,backgroundGraphics:ct,showParticles:te,particleStyle:oe,legend:it,legendPosition:A,onObservation:V,...ee&&{customClickBehavior:e=>{if(!e||!e.data||!ee)return;const t=e.data;Te(t)&&ee(t.data,{x:e.x,y:e.y})}},chartId:ne,colorScheme:Array.isArray(C)?C:void 0,...ie})});Be.displayName="ProcessSankey";import{useMemo as Ne}from"react";import{jsx as De}from"react/jsx-runtime";function Oe(e){const n=T(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:i,margin:r,className:a,layout:l="tree",orientation:d="vertical",childrenAccessor:m="children",valueAccessor:h="value",nodeIdAccessor:g="name",colorBy:u,colorScheme:p,colorByDepth:b=!1,edgeStyle:k="curve",nodeLabel:w,nodeSize:C=5,tooltip:A,frameProps:I={},onObservation:M,onClick:H,chartId:x,selection:D,linkedHover:O,loading:P,loadingContent:L,legendInteraction:E,stroke:W,strokeWidth:R,opacity:z}=e,{width:F,height:j,enableHover:_,showLabels:q=!0,title:X,description:Z,summary:K,accessibleTable:Y}=n,U=J({nodes:Ne(()=>$(i??null,m),[i,m]),edges:void 0,inferNodes:!1,colorBy:b?void 0:u,colorScheme:p,showLegend:!1,legendInteraction:E,selection:D,linkedHover:O,onObservation:M,onClick:H,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"TreeDiagram",chartId:x,marginDefaults:n.marginDefaults,userMargin:r,width:F,height:j,loading:P,loadingContent:L}),Q=Ne(()=>new Map,[]),V=Ne(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=b?f[(e.depth||0)%f.length]:u?y(e.data||e,u,U.colorScale):S(void 0,U.themeCategorical,p,void 0,Q),t},[u,b,U.colorScale,U.themeCategorical,p,Q]),ee=Ne(()=>o(V,{stroke:W,strokeWidth:R,opacity:z}),[V,W,R,z]),te=Ne(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),oe=Ne(()=>o(te,{stroke:W,strokeWidth:R,opacity:z}),[te,W,R,z]),ne=Ne(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return G(h)},[l,h]),ie=t({componentName:"TreeDiagram",data:i});return ie?De(B,{componentName:"TreeDiagram",message:ie,width:F,height:j}):U.loadingEl?U.loadingEl:De(N,{componentName:"TreeDiagram",width:F,height:j,children:De(s,{chartType:l,...null!=i&&{data:i},size:[F,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,nodeIDAccessor:g,childrenAccessor:m,hierarchySum:ne,treeOrientation:d,edgeType:k,nodeStyle:ee,edgeStyle:oe,colorBy:u,colorScheme:U.effectivePalette,colorByDepth:b,nodeSize:C,nodeLabel:q?w||g:void 0,showLabels:q,enableHover:_,tooltipContent:!1===A?()=>null:v(A)||void 0,...c({linkedHover:O,selection:D,onObservation:M,onClick:H,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior,linkedHoverInClickPredicate:!1}),...E&&"none"!==E&&{legendHoverBehavior:U.legendState.onLegendHover,legendClickBehavior:U.legendState.onLegendClick,legendHighlightedCategory:U.legendState.highlightedCategory,legendIsolatedCategories:U.legendState.isolatedCategories},className:a,title:X,description:Z,summary:K,accessibleTable:Y,...null!=e.animate&&{animate:e.animate},...I})})}Oe.displayName="TreeDiagram";import{useMemo as Pe,useCallback as Le}from"react";import{jsx as Ee}from"react/jsx-runtime";function We(e){const n=T(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:i,margin:a,className:l,childrenAccessor:d="children",valueAccessor:m="value",nodeIdAccessor:h="name",colorBy:g,colorScheme:u,colorByDepth:b=!1,labelMode:k="leaf",nodeLabel:w,padding:C=4,paddingTop:A,nodeStyle:I,tooltip:M,frameProps:H={},selection:x,linkedHover:D,onObservation:O,onClick:P,chartId:L,loading:E,loadingContent:W,legendInteraction:R,stroke:z,strokeWidth:F,opacity:j}=e,{nodeStyle:_,...q}=H,{width:X,height:Z,enableHover:K,showLabels:Y=!0,title:U,description:Q,summary:V,accessibleTable:ee}=n,te=J({nodes:Pe(()=>$(i??null,d),[i,d]),edges:void 0,inferNodes:!1,colorBy:b?void 0:g,colorScheme:u,showLegend:!1,legendInteraction:R,selection:x,linkedHover:D,onObservation:O,onClick:P,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"Treemap",chartId:L,marginDefaults:n.marginDefaults,userMargin:a,width:X,height:Z,loading:E,loadingContent:W}),oe=r(x),ne=te.customHoverBehavior,ie=Le(e=>{if(!e)return ne(null);const t=e.data||e;ne({data:t?.data||t})},[ne]),re=Pe(()=>new Map,[]),se=Pe(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=b?f[(e.depth||0)%f.length]:g?y(e.data||e,g,te.colorScale):S(void 0,te.themeCategorical,u,void 0,re),t},[g,b,te.colorScale,te.themeCategorical,u,re]),ae=Pe(()=>I||_?e=>({...se(e),..._?_(e)??{}:{},...I?I(e)??{}:{}}):se,[se,I,_]),le=Pe(()=>o(ae,{stroke:z,strokeWidth:F,opacity:j}),[ae,z,F,j]),ce=Pe(()=>te.activeSelectionHook?e=>{const t={...le(e)};if(te.activeSelectionHook.isActive)if(te.activeSelectionHook.predicate(e.data||e))oe?.selectedStyle&&Object.assign(t,oe.selectedStyle);else{const e=oe?.unselectedOpacity??p;t.opacity=e,t.fillOpacity=e,t.strokeOpacity=e,oe?.unselectedStyle&&Object.assign(t,oe.unselectedStyle)}return t}:le,[le,te.activeSelectionHook,oe]),de=Pe(()=>G(m),[m]),me=void 0!==A?A:!Y||"parent"!==k&&"all"!==k?void 0:18,he=t({componentName:"Treemap",data:i});return he?Ee(B,{componentName:"Treemap",message:he,width:X,height:Z}):te.loadingEl?te.loadingEl:Ee(N,{componentName:"Treemap",width:X,height:Z,children:Ee(s,{chartType:"treemap",...null!=i&&{data:i},size:[X,Z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,nodeIDAccessor:h,childrenAccessor:d,hierarchySum:de,padding:C,paddingTop:me,nodeStyle:ce,colorBy:g,colorScheme:te.effectivePalette,colorByDepth:b,nodeLabel:Y?w||h:void 0,showLabels:Y,labelMode:k,enableHover:K,tooltipContent:!1===M?()=>null:v(M)||void 0,...c({linkedHover:D,selection:x,onObservation:O,onClick:P,mobileInteraction:te.mobileInteraction,customHoverBehavior:ie,customClickBehavior:te.customClickBehavior,linkedHoverInClickPredicate:!1}),...R&&"none"!==R&&{legendHoverBehavior:te.legendState.onLegendHover,legendClickBehavior:te.legendState.onLegendClick,legendHighlightedCategory:te.legendState.highlightedCategory,legendIsolatedCategories:te.legendState.isolatedCategories},className:l,title:U,description:Q,summary:V,accessibleTable:ee,...null!=e.animate&&{animate:e.animate},...q})})}We.displayName="Treemap";import{useMemo as Re}from"react";import{jsx as ze}from"react/jsx-runtime";function Fe(e){const n=T(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:i,margin:r,className:a,childrenAccessor:l="children",valueAccessor:d="value",nodeIdAccessor:m="name",colorBy:h,colorScheme:g,colorByDepth:u=!1,nodeLabel:p,circleOpacity:b=.7,padding:k=4,tooltip:w,frameProps:C={},onObservation:A,onClick:I,chartId:M,selection:H,linkedHover:x,loading:D,loadingContent:O,legendInteraction:P,stroke:L,strokeWidth:E,opacity:W}=e,{width:R,height:z,enableHover:F,showLabels:j=!0,title:_,description:q,summary:X,accessibleTable:Z}=n,K=J({nodes:Re(()=>$(i??null,l),[i,l]),edges:void 0,inferNodes:!1,colorBy:u?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:P,selection:H,linkedHover:x,onObservation:A,onClick:I,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"CirclePack",chartId:M,marginDefaults:n.marginDefaults,userMargin:r,width:R,height:z,loading:D,loadingContent:O}),Y=Re(()=>new Map,[]),U=Re(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:b};return t.fill=u?f[(e.depth||0)%f.length]:h?y(e.data||e,h,K.colorScale):S(void 0,K.themeCategorical,g,void 0,Y),t},[h,u,K.colorScale,b,K.themeCategorical,g,Y]),Q=Re(()=>o(U,{stroke:L,strokeWidth:E,opacity:W}),[U,L,E,W]),V=Re(()=>G(d),[d]),ee=t({componentName:"CirclePack",data:i});return ee?ze(B,{componentName:"CirclePack",message:ee,width:R,height:z}):K.loadingEl?K.loadingEl:ze(N,{componentName:"CirclePack",width:R,height:z,children:ze(s,{chartType:"circlepack",...null!=i&&{data:i},size:[R,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,nodeIDAccessor:m,childrenAccessor:l,hierarchySum:V,padding:k,nodeStyle:Q,colorBy:h,colorScheme:K.effectivePalette,colorByDepth:u,nodeLabel:j?p||m:void 0,showLabels:j,enableHover:F,tooltipContent:!1===w?()=>null:v(w)||void 0,...c({linkedHover:x,selection:H,onObservation:A,onClick:I,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior,linkedHoverInClickPredicate:!1}),...P&&"none"!==P&&{legendHoverBehavior:K.legendState.onLegendHover,legendClickBehavior:K.legendState.onLegendClick,legendHighlightedCategory:K.legendState.highlightedCategory,legendIsolatedCategories:K.legendState.isolatedCategories},className:a,title:_,description:q,summary:X,accessibleTable:Z,...null!=e.animate&&{animate:e.animate},...C})})}Fe.displayName="CirclePack";import{useMemo as je}from"react";import{jsx as $e}from"react/jsx-runtime";var _e=f;function Ge(e){const n=T(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:i,margin:r,className:a,childrenAccessor:l="children",nodeIdAccessor:d="name",colorBy:m,colorScheme:h,colorByDepth:p=!1,orbitMode:f="flat",orbitSize:b=2.95,speed:k=.25,revolution:w,revolutionStyle:C,eccentricity:A=1,showRings:I=!0,nodeRadius:M=6,showLabels:H=!1,animated:x=!0,tooltip:D,foregroundGraphics:O,annotations:P,frameProps:L={},onObservation:E,onClick:W,chartId:R,selection:z,linkedHover:F,loading:j,loadingContent:_,stroke:G,strokeWidth:q,opacity:X}=e,{width:Z,height:K,enableHover:Y,title:U,description:Q,summary:V,accessibleTable:ee}=n,te=J({nodes:je(()=>$(i,l),[i,l]),edges:void 0,inferNodes:!1,colorBy:p?void 0:m,colorScheme:h,showLegend:!1,legendInteraction:void 0,selection:z,linkedHover:F,onObservation:E,onClick:W,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"OrbitDiagram",chartId:R,marginDefaults:{top:10,right:10,bottom:10,left:10},userMargin:r,width:Z,height:K,loading:j,loadingContent:_}),oe=je(()=>new Map,[]),{colorScale:ne,customClickBehavior:ie,customHoverBehavior:re,themeCategorical:se}=te,ae=je(()=>{if(Array.isArray(h))return h;const e=g[h];return Array.isArray(e)?e:u},[h]),le=je(()=>e=>{const t={stroke:"#fff",strokeWidth:1},o=0===(e.depth??0);return t.fill=p?o?ae[0]:_e[(e.depth||0)%_e.length]:m?y(e.data||e,m,ne):S(void 0,se,h,void 0,oe),t.opacity=o?1:.85,t},[m,p,ne,ae,se,h,oe]),ce=je(()=>o(le,{stroke:G,strokeWidth:q,opacity:X}),[le,G,q,X]),de=je(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),me=je(()=>e=>{re(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[re]),he=je(()=>e=>{ie(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[ie]),ge=t({componentName:"OrbitDiagram",data:i});return ge?$e(B,{componentName:"OrbitDiagram",message:ge,width:Z,height:K}):te.loadingEl?te.loadingEl:$e(N,{componentName:"OrbitDiagram",width:Z,height:K,children:$e(s,{chartType:"orbit",...null!=i&&{data:i},size:[Z,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,nodeIDAccessor:d,childrenAccessor:l,nodeStyle:ce,edgeStyle:de,colorBy:m,colorScheme:te.effectivePalette,colorByDepth:p,nodeSize:M,nodeLabel:H?d:void 0,showLabels:H,enableHover:!x&&Y,tooltipContent:x?void 0:!1===D?()=>null:v(D)||void 0,...c({linkedHover:F,selection:z,onObservation:E,onClick:W,mobileInteraction:te.mobileInteraction,customHoverBehavior:me,customClickBehavior:he,linkedHoverInClickPredicate:!1}),foregroundGraphics:O,annotations:P,className:a,title:U,description:Q,summary:V,orbitMode:f,orbitSize:b,orbitSpeed:k,orbitRevolution:w,orbitRevolutionStyle:C,orbitEccentricity:A,orbitShowRings:I,orbitAnimated:x,accessibleTable:ee,...null!=e.animate&&{animate:e.animate},...L})})}Ge.displayName="OrbitDiagram";import{forceCenter as qe,forceCollide as Je,forceLink as Xe,forceManyBody as Ze,forceSimulation as Ke,forceX as Ye,forceY as Ue}from"d3-force";function Qe(e,t,o={}){const n=o.iterations??260,i=o.repulsion??5200,r=o.linkDistance??165,s=o.linkStrength??.045,a=o.centerStrength??.018,l=o.damping??.84,c=o.nodeRadius??12,m=o.nodePadding??3,h=o.inset??.06,g=d(o.seed??1),u=new Map;for(const t of e)u.set(t.id,0);for(const e of t)u.set(e.source,(u.get(e.source)??0)+1),u.set(e.target,(u.get(e.target)??0)+1);const p=500,f=e.map(e=>({id:e.id,data:e,x:200+600*g(),y:200+600*g()})),b=new Set(e.map(e=>e.id)),y=t.filter(e=>b.has(e.source)&&b.has(e.target)).map(e=>({source:e.source,target:e.target}));if(n>0){const e=Ke(f).randomSource(g).alphaDecay(1-Math.pow(.001,1/n)).velocityDecay(Math.max(0,Math.min(1,1-l))).force("charge",Ze().strength(e=>{const t=u.get(e.id)??0;return 2.5*-Math.sqrt(i)*Math.sqrt(t+1)})).force("collide",Je(e=>(e=>"function"==typeof c?c(e.data):c)(e)+m).strength(.9).iterations(2)).force("center",qe(p,p).strength(.8)).force("x",Ye(p).strength(a)).force("y",Ue(p).strength(a));y.length>0&&e.force("link",Xe(y).id(e=>e.id).distance(r).strength(e=>{const t="string"==typeof e.target?e.target:e.target.id,o=Math.max(1,Math.min(u.get("string"==typeof e.source?e.source:e.source.id)??1,u.get(t)??1));return s/.045/o})),e.stop();for(let t=0;n>t;t+=1)e.tick()}let v=1/0,k=1/0,S=-1/0,w=-1/0;for(const e of f){const t=e.x??p,o=e.y??p;v>t&&(v=t),k>o&&(k=o),t>S&&(S=t),o>w&&(w=o)}const C=S-v,T=w-k,A={};for(const e of f)A[e.id]={x:0===C?.5:h+((e.x??p)-v)/C*(1-2*h),y:0===T?.5:h+((e.y??p)-k)/T*(1-2*h)};return A}export{W as NetworkCustomChart,Z as ForceDirectedGraph,V as ChordDiagram,ie as SankeyDiagram,re as validateProcessSankey,se as formatProcessSankeyIssue,Be as ProcessSankey,Oe as TreeDiagram,We as Treemap,Fe as CirclePack,Ge as OrbitDiagram,Qe as forceLayout};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
function t(t){if(null==t)return()=>{};const n="function"==typeof t?t:n=>n[t];return t=>e(n(t))}function n(n,i){const e=t(n),o=t(i);return(t,n)=>{const i=o(t);return{value:i,x:e(t),y:i,category:n}}}function i(n,i){const e=t(i??"value"),o=null==n?void 0:"function"==typeof n?n:t=>t[n];return t=>{const n=o?o(t):void 0;return{value:e(t),category:null==n?void 0:n+""}}}function e(t){if("number"==typeof t)return Number.isFinite(t)?t:void 0;if("string"==typeof t&&""!==t.trim()){const n=Number(t);return Number.isFinite(n)?n:void 0}}function o(t,n,i){const o=null!=t.axis?i[t.axis]:null!=t.field?n[t.field]:i.value;if(void 0!==t.eq&&o!==t.eq)return!1;if(void 0!==t.ne&&o===t.ne)return!1;if(void 0!==t.in&&!t.in.includes(o))return!1;if(void 0===t.gt&&void 0===t.gte&&void 0===t.lt&&void 0===t.lte&&void 0===t.within&&void 0===t.outside)return!0;const r=e(o);if(void 0===r)return!1;if(void 0!==t.gt&&t.gt>=r)return!1;if(void 0!==t.gte&&t.gte>r)return!1;if(void 0!==t.lt&&r>=t.lt)return!1;if(void 0!==t.lte&&r>t.lte)return!1;if(void 0!==t.within){const[n,i]=t.within;if(n>r||r>i)return!1}if(void 0!==t.outside){const[n,i]=t.outside;if(r>=n&&i>=r)return!1}return!0}function r(t,n,i){const e=t.when;return void 0===e||!0===e||!1!==e&&("function"==typeof e?e(n,i):o(e,n,i))}function u(t,n,i){if(!n||0===n.length)return{};let e={};for(const o of n){if(!r(o,t,i))continue;const n="function"==typeof o.style?o.style(t,i):o.style;n&&(e={...e,...n})}return e}function f(t,n,i,e=t=>t){const o=t??(()=>({}));return n&&0!==n.length?(t,r)=>{const f=e(t),c={...o(t,r)};return Object.assign(c,u(f,n,i(f,r))),c}:o}function c(t,n,i){return t&&0!==t.length?(e,o)=>{const r=u(e,t,n(e,o)),f=i?i(e,o):void 0;return f?{...r,...f}:r}:i}function s(t,n,e,o){if(!t||0===t.length)return o;const r=i(n,e);return(n,i)=>{const e=n&&n.data||n,f=u(e,t,r(e)),c=o?o(n,i):void 0;return c?{...f,...c}:f}}function l(t,i,e,o){return c(t,n(i,e),o)}function d(n,i,e){const o=t(i);return c(n,(t,n)=>({value:o(t),category:n}),e)}export{t as makeRuleValueResolver,n as makeXYRuleContext,i as makeNodeRuleContext,o as matchesThreshold,r as ruleMatches,u as resolveStyleRules,f as composeStyleRules,c as makeStyleRuleStyleFn,s as styleRulesToNodeStyle,l as styleRulesToXYStyle,d as styleRulesToPieceStyle};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{hatchPatternDef as e,isHatchFill as t,resolveHatchCanvasPattern as n,resolveResponsiveRules as r,useObservationSelector as o}from"./chunk-chunk-2WVCH4PL.module.min.js";import{SEQUENTIAL_INTERPOLATORS as i,glyphFractionClipRect as s,glyphPlacement as l,resolveGlyphPaint as a,schemeCategory10 as c,schemeSet3 as d,schemeTableau10 as u,symbolPathString as h}from"./chunk-chunk-5RKXZQ2P.module.min.js";import{resolveCSSColor as f}from"./chunk-chunk-QRIBHZYW.module.min.js";import{createStore as y}from"./chunk-chunk-DSNGDNJY.module.min.js";var p=Object.freeze([]);function m(e){if(!e)return p;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var g=/^\d{4}-\d{1,2}$/;function x(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const n=g.test(t)?t+"-01":t;if(n===t&&10>t.length)return NaN;const r=Date.parse(n);return Number.isFinite(r)?r:NaN}function b(e){return e instanceof Date?e.getTime():"string"==typeof e?x(e):+e}function k(e,t){if(!e||!t)return{data:e,failed:!1};let n=!1,r=!1;const o=e.map(e=>{const o=e[t];if("string"!=typeof o)return e;const i=x(o);return n=!0,Number.isFinite(i)?{...e,[t]:i}:(r=!0,{...e,[t]:NaN})});return{data:n?o:e,failed:r}}var $=22;function v(e){return"string"==typeof e&&e.length>0}function w(e,t,n=!1){const r=n?t?58:34:t?36:0;return r>e.top?{...e,top:r}:e}function M(e,t){return w(e,v(t))}import*as A from"react";import{arc as S,area as W,line as L}from"d3-shape";import{curveMonotoneX as I,curveMonotoneY as C,curveCardinal as N,curveCatmullRom as P,curveStep as O,curveStepBefore as j,curveStepAfter as F,curveBasis as R,curveNatural as z}from"d3-shape";function T(e){switch(e){case"monotoneX":return I;case"monotoneY":return C;case"cardinal":return N;case"catmullRom":return P;case"step":return O;case"stepBefore":return j;case"stepAfter":return F;case"basis":return R;case"natural":return z;default:return null}}function G(e,r,o){if(null==r)return o;if(t(r)){return n(r,e)||r.background&&f(e,r.background)||o}return"string"!=typeof r?r:f(e,r)||o}function B(e,t){if(null==t)return;const n=G(e,t,"");return""===n?void 0:n}function D(e,t,n,r,o,i,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const l=e.createLinearGradient(r,o,i,s);for(const e of n)l.addColorStop(e.offset,e.color);return l}const{topOpacity:l,bottomOpacity:a}=t;if(!Number.isFinite(l)||!Number.isFinite(a))return null;const c=Math.max(0,Math.min(1,l)),d=Math.max(0,Math.min(1,a)),u=e.createLinearGradient(r,o,i,s),[h,f,y]=function(e,t){const n=e.fillStyle,r="#010203";try{e.fillStyle=r,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const o=e.fillStyle;if(e.fillStyle=n,"string"!=typeof o)return[78,121,167];if(o.toLowerCase()===r&&t.trim().toLowerCase()!==r)return[78,121,167];if(o.startsWith("#"))return[parseInt(o.slice(1,3),16),parseInt(o.slice(3,5),16),parseInt(o.slice(5,7),16)];const i=o.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}(e,n);return u.addColorStop(0,`rgba(${h},${f},${y},${c})`),u.addColorStop(1,`rgba(${h},${f},${y},${d})`),u}function E(e,t,n,r,o,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const l=e.createLinearGradient(n,r,o,i);for(const e of s)l.addColorStop(e.offset,e.color);return l}function H(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function q(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,r=e=>Math.max(0,Math.min(e??0,n));return{tl:r(t.tl),tr:r(t.tr),br:r(t.br),bl:r(t.bl)}}var _=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function Y(e){const{innerRadius:t,outerRadius:n,startAngle:r,endAngle:o}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=_(n,r),t=_(n,o);return`M0,0 L${e.x},${e.y} A${n},${n} 0 ${o-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=_(n,r),s=_(n,o),l=_(t,o),a=_(t,r),c=o-r>Math.PI?1:0;return`M${e.x},${e.y} A${n},${n} 0 ${c} 1 ${s.x},${s.y} L${l.x},${l.y} A${t},${t} 0 ${c} 0 ${a.x},${a.y} Z`}const s=Math.max(0,Math.min(e.cornerRadius??0,(n-t)/2));if(0===s)return Y({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const l=Math.asin(Math.min(1,s/Math.max(1e-9,n-s))),a=i?0:Math.asin(Math.min(1,s/Math.max(1e-9,t+s))),c=o-r,d=e.roundStart&&e.roundEnd?c/2:c,u=!!e.roundStart&&d>l,h=!!e.roundEnd&&d>l;if(!u&&!h)return Y({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=r+(u?l:0),y=o-(h?l:0),p=r+(u?a:0),m=o-(h?a:0),g=_(n,f),x=_(n,y),b=(n-s)*Math.cos(l),k=_(b,r),$=_(b,o),v=i?null:_(t,m),w=i?null:_(t,p),M=i?0:(t+s)*Math.cos(a),A=i?null:_(M,r),S=i?null:_(M,o),W=y-f>Math.PI?1:0,L=i?0:m-p>Math.PI?1:0;let I="";if(u)I+=`M${k.x},${k.y}`,I+=` A${s},${s} 0 0 1 ${g.x},${g.y}`;else{const e=_(n,r);I+=`M${e.x},${e.y}`}if(h)I+=` A${n},${n} 0 ${W} 1 ${x.x},${x.y}`,I+=` A${s},${s} 0 0 1 ${$.x},${$.y}`;else{const e=_(n,o);I+=` A${n},${n} 0 ${W} 1 ${e.x},${e.y}`}if(i)I+=" L0,0";else{if(h)I+=` L${S.x},${S.y}`,I+=` A${s},${s} 0 0 1 ${v.x},${v.y}`;else{const e=_(t,o);I+=` L${e.x},${e.y}`}if(u)I+=` A${t},${t} 0 ${L} 0 ${w.x},${w.y}`,I+=` A${s},${s} 0 0 1 ${A.x},${A.y}`;else{const e=_(t,r);I+=` A${t},${t} 0 ${L} 0 ${e.x},${e.y}`}}return I+=" Z",I}import{jsx as V,jsxs as Z}from"react/jsx-runtime";var U={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function X(e,n="#4e79a7"){return t(e)?e.background&&"transparent"!==e.background?e.background:n:e&&"string"==typeof e?e:n}function K(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}function Q(e,t,n,r){const o=e.glyph;if(!o?.parts?.length||0>=e.size)return null;const i=l(o,e.size);if(0>=i.scale)return null;const c=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,d=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),u=s(o,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),h=u?K(r+"-clip"):void 0,f=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),y=t=>o.parts.map((n,r)=>{const o=t?"none"===n.fill?void 0:t:a(n.fill,d,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:a(n.stroke??"none",d,e.accent);return o||i?V("path",{d:n.d,fill:o??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},r):null});return Z("g",{transform:c,opacity:1===f?void 0:f,children:[u&&h&&V("clipPath",{id:h,children:V("rect",{x:u.x,y:u.y,width:u.width,height:u.height})}),u&&e.ghostColor?V("g",{children:y(e.ghostColor)}):null,u&&h?V("g",{clipPath:`url(#${h})`,children:y()}):y()]},r)}import*as J from"react";import{arc as ee}from"d3-shape";import{jsx as te,jsxs as ne}from"react/jsx-runtime";function re(n,r){switch(n.type){case"circle":{const o=n,i=t(o.style.fill)?e(o.style.fill,`net-circle-${r}-hatch`):void 0;return ne(J.Fragment,{children:[i&&te("defs",{children:i}),te("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:i?`url(#net-circle-${r}-hatch)`:X(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-circle-"+r)}case"rect":{const o=n,i=t(o.style.fill)?e(o.style.fill,`net-rect-${r}-hatch`):void 0;return ne(J.Fragment,{children:[i&&te("defs",{children:i}),te("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:i?`url(#net-rect-${r}-hatch)`:X(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-rect-"+r)}case"arc":{const o=n,i=ee().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(U)||"",s=t(o.style.fill)?e(o.style.fill,`net-arc-${r}-hatch`):void 0;return ne(J.Fragment,{children:[s&&te("defs",{children:s}),te("path",{d:i,transform:`translate(${o.cx},${o.cy})`,fill:s?`url(#net-arc-${r}-hatch)`:X(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-arc-"+r)}case"symbol":{const e=n,t=h(e.symbolType,e.size,e.path);return te("path",{d:t,transform:e.rotation?`translate(${e.cx},${e.cy}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.cx},${e.cy})`,fill:e.style.fill?X(e.style.fill):"none",stroke:e.style.stroke,strokeWidth:e.style.strokeWidth,opacity:e.style.opacity},"net-symbol-"+r)}case"glyph":return Q(n,n.cx,n.cy,"net-glyph-"+(n.id??r));default:return null}}function oe(e,t){switch(e.type){case"line":return te("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+t);case"bezier":{const n=e;return te("path",{d:n.pathD,fill:X(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"ribbon":{const n=e;return te("path",{d:n.pathD,fill:X(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"curved":{const n=e;return te("path",{d:n.pathD,fill:X(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+t)}default:return null}}function ie(e,t){return te("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}import*as se from"react";import{jsx as le,jsxs as ae}from"react/jsx-runtime";function ce(n,r){switch(n.type){case"geoarea":{const o=n;if(!o.pathData)return null;const i=t(o.style.fill)?e(o.style.fill,`geoarea-${r}-hatch`):void 0;return ae(se.Fragment,{children:[i&&le("defs",{children:i}),le("path",{d:o.pathData,fill:i?`url(#geoarea-${r}-hatch)`:X(o.style.fill,"#e0e0e0"),fillOpacity:o.style.fillOpacity??1,stroke:o.style.stroke||"none",strokeWidth:o.style.strokeWidth||.5,strokeDasharray:o.style.strokeDasharray,opacity:o._decayOpacity??1})]},"geoarea-"+r)}case"point":{const o=n,i=t(o.style.fill)?e(o.style.fill,`geopoint-${r}-hatch`):void 0;return ae(se.Fragment,{children:[i&&le("defs",{children:i}),le("circle",{cx:o.x,cy:o.y,r:o.r,fill:i?`url(#geopoint-${r}-hatch)`:X(o.style.fill),fillOpacity:o.style.fillOpacity??.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o._decayOpacity??o.style.opacity??1})]},"point-"+r)}case"line":{const e=n;if(2>e.path.length)return null;const t="M"+e.path.map(e=>`${e[0]},${e[1]}`).join("L");return le("path",{d:t,fill:"none",stroke:e.style.stroke||"#4e79a7",strokeWidth:e.style.strokeWidth||1.5,strokeDasharray:e.style.strokeDasharray,opacity:e.style.opacity??1},"line-"+r)}case"glyph":return Q(n,n.x,n.y,"geo-glyph-"+(n.pointId??r));default:return null}}import{jsx as de,jsxs as ue}from"react/jsx-runtime";function he(e,t,n){const r=h(e.symbolType,e.size,e.path);return de("path",{d:r,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?X(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${n??""}symbol-${t}`)}function fe(e){const t=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));return 2>t.length?null:t.map((e,t)=>de("stop",{offset:e.offset,stopColor:e.color},t))}function ye(e,t,n){if(!e||2>t.length)return null;const r=fe(e.colorStops);return r?de("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:t[0][0],y1:0,x2:t[t.length-1][0],y2:0,children:r}):null}function pe(n,r,o){switch(n.type){case"line":{const e=n;if(0===e.path.length)return null;const t=T(e.curve),i=t?L().x(([e])=>e).y(([,e])=>e).curve(t)(e.path)??"":"M"+e.path.map(([e,t])=>`${e},${t}`).join("L"),s=K(`${o?o+"-":""}line-${r}-stroke-gradient`),l=ye(e.strokeGradient,e.path,s);return ue(A.Fragment,{children:[l&&de("defs",{children:l}),de("path",{d:i,fill:"none",stroke:l?`url(#${s})`:e.style.stroke||"#4e79a7",strokeWidth:e.style.strokeWidth||2,strokeDasharray:e.style.strokeDasharray,opacity:e.style.opacity})]},"line-"+r)}case"area":{const i=n;if(0===i.topPath.length)return null;const s=T(i.curve),l=!s||2>i.topPath.length||2>i.bottomPath.length?`M${i.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...i.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`:W().x(([e])=>e).y0((e,t)=>i.bottomPath[t][1]).y1(([,e])=>e).curve(s)(i.topPath)??"",a=`${o?o+"-":""}area-${r}-hatch`,c=t(i.style.fill)?e(i.style.fill,a):void 0,d=K(`${o?o+"-":""}area-${r}-gradient`),u=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let r=1/0;for(const[,t]of e.topPath)r=Math.min(r,t);let o=-1/0;for(const[,t]of e.bottomPath)o=Math.max(o,t);if(!Number.isFinite(r)||!Number.isFinite(o))return null;const i=[];if("colorStops"in n){const e=fe(n.colorStops);if(!e)return null;i.push(...e)}else{if(!Number.isFinite(n.topOpacity)||!Number.isFinite(n.bottomOpacity))return null;i.push(de("stop",{offset:0,stopColor:X(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.topOpacity))},"0")),i.push(de("stop",{offset:1,stopColor:X(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.bottomOpacity))},"1"))}return de("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:0,y1:r,x2:0,y2:o,children:i})}(i,d),h=u?`url(#${d})`:c?`url(#${a})`:X(i.style.fill),f=u?void 0:i.style.fillOpacity??i.style.opacity??.7,y=s?L().x(([e])=>e).y(([,e])=>e).curve(s)(i.topPath)??"":"M"+i.topPath.map(([e,t])=>`${e},${t}`).join("L"),p=K(`${o?o+"-":""}area-${r}-stroke-gradient`),m=ye(i.strokeGradient,i.topPath,p),g=i.style.stroke&&"none"!==i.style.stroke?de("path",{d:y,fill:"none",stroke:m?`url(#${p})`:X(i.style.stroke),strokeWidth:i.style.strokeWidth||2,opacity:i.style.opacity}):null;if(i.clipRect){const e=`${o?o+"-":""}area-clip-${r}`;return ue("g",{children:[ue("defs",{children:[u,!u&&c,m,de("clipPath",{id:e,children:de("rect",{x:i.clipRect.x,y:i.clipRect.y,width:i.clipRect.width,height:i.clipRect.height})})]}),ue("g",{clipPath:`url(#${e})`,children:[de("path",{d:l,fill:h,fillOpacity:f,opacity:u?i.style.opacity:void 0,stroke:"none"}),g]})]},"area-"+r)}return ue(A.Fragment,{children:[(u||c||m)&&ue("defs",{children:[u,!u&&c,m]}),de("path",{d:l,fill:h,fillOpacity:f,opacity:u?i.style.opacity:void 0,stroke:"none"}),g]},"area-"+r)}case"point":{const i=n,s=`${o?o+"-":""}point-${r}-hatch`,l=t(i.style.fill)?e(i.style.fill,s):void 0;return ue(A.Fragment,{children:[l&&de("defs",{children:l}),de("circle",{cx:i.x,cy:i.y,r:i.r,fill:l?`url(#${s})`:X(i.style.fill),opacity:i.style.opacity??i.style.fillOpacity??.8,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},"point-"+r)}case"symbol":return he(n,r);case"glyph":return Q(n,n.x,n.y,`${o??""}glyph-${n.pointId??r}`);case"rect":{const i=n,s=`${o?o+"-":""}xyrect-${r}-hatch`,l=t(i.style.fill)?e(i.style.fill,s):void 0;return ue(A.Fragment,{children:[l&&de("defs",{children:l}),de("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:l?`url(#${s})`:X(i.style.fill),opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},"rect-"+r)}case"heatcell":{const e=n;if(e.showValues&&null!=e.value&&e.w>=20&&e.h>=20){const t=e.valueFormat?e.valueFormat(e.value):Number.isInteger(e.value)?e.value+"":100>Math.abs(e.value)?1>Math.abs(e.value)?e.value.toPrecision(3):e.value.toFixed(1):e.value.toFixed(0),[n,o,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e.fill),s=.299*n+.587*o+.114*i>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(e.w,e.h)));return ue("g",{children:[de("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.fill}),de("text",{x:e.x+e.w/2,y:e.y+e.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:l+"px",children:t})]},"heatcell-"+r)}return de("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.fill},"heatcell-"+r)}case"candlestick":{const e=n,t=Math.min(e.openY,e.closeY),o=Math.max(Math.abs(e.openY-e.closeY),1),i=e.isUp?e.upColor:e.downColor;return ue("g",{children:[de("line",{x1:e.x,y1:e.highY,x2:e.x,y2:e.lowY,stroke:e.wickColor,strokeWidth:e.wickWidth}),de("rect",{x:e.x-e.bodyWidth/2,y:t,width:e.bodyWidth,height:o,fill:i,stroke:i,strokeWidth:1})]},"candle-"+r)}default:return null}}function me(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function ge(e,t){const n=e.datum;if(!n)return null;const r=[],o=n.__funnelStepLabel,i=Number(n.__funnelStepLabelX),s=Number(n.__funnelStepLabelY),l=Number(n.__funnelRowWidth);"string"!=typeof o||!Number.isFinite(i)||!Number.isFinite(s)||Number.isFinite(l)&&8.4*o.length+16>l||r.push(de("text",{x:i,y:s+3,textAnchor:"middle",dominantBaseline:"hanging",fontSize:14,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.6)",strokeWidth:3,paintOrder:"stroke",children:o},t+"-funnel-step"));const a=Number(n.__funnelValue),c=Number(n.__funnelValueLabelX),d=Number(n.__funnelValueLabelY),u=Number(n.__funnelBarW);if(Number.isFinite(a)&&0!==a&&Number.isFinite(c)&&Number.isFinite(d)&&u>=60){const e=Number(n.__funnelPercent);let o=!0!==n.__funnelIsFirstStep&&Number.isFinite(e)?`${me(a)} (${.05>Math.abs(e-Math.round(e))?Math.round(e):e.toFixed(1)}%)`:me(a);7.8*o.length+16>u&&(o=me(a)),7.8*o.length+16>u||r.push(de("text",{x:c,y:d+22,textAnchor:"middle",dominantBaseline:"hanging",fontSize:13,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.5)",strokeWidth:3,paintOrder:"stroke",children:o},t+"-funnel-value"))}return r.length?de("g",{children:r},t+"-funnel-labels"):null}function xe(n,r,o){const i=("category"in n?n.category:void 0)||("group"in n?n.group:void 0)||"",s=e=>`ord-${n.type}-${i}-${r}-${e}`,l=`ord-${n.type}-${i}-${r}`;switch(n.type){case"rect":{const r=n,o=K(l)+"-grad",i=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let r=e.x,o=e.y,i=e.x,s=e.y+e.h;"bottom"===e.roundedEdge?(o=e.y+e.h,s=e.y):"right"===e.roundedEdge?(r=e.x+e.w,o=e.y,i=e.x,s=e.y):"left"===e.roundedEdge&&(r=e.x,o=e.y,i=e.x+e.w,s=e.y);const l=[];if("colorStops"in n){const e=fe(n.colorStops);if(!e)return null;l.push(...e)}else{const t=X(e.style.fill);l.push(de("stop",{offset:0,stopColor:t,stopOpacity:n.topOpacity},"0")),l.push(de("stop",{offset:1,stopColor:t,stopOpacity:n.bottomOpacity},"1"))}return de("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:r,y1:o,x2:i,y2:s,children:l})}(r,o);let s,a;if(i)a=`url(#${o})`;else if(t(r.style.fill)){const t=K(l)+"-hatch";s=e(r.style.fill,t),a=`url(#${t})`}else a=X(r.style.fill);const c=i||s?ue("defs",{children:[i,s]}):null;if(r.cornerRadii&&H(r.cornerRadii)){const e=function(e){const{x:t,y:n,w:r,h:o}=e,{tl:i,tr:s,br:l,bl:a}=q(e);let c=`M${t+i},${n}`;return c+=` L${t+r-s},${n}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t+r},${n+s}`),c+=` L${t+r},${n+o-l}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t+r-l},${n+o}`),c+=` L${t+a},${n+o}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t},${n+o-a}`),c+=` L${t},${n+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${n}`),c+=" Z",c}(r);return ue(A.Fragment,{children:[c,de("path",{d:e,fill:a,opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},l)}if(r.roundedTop&&r.roundedTop>0){const e=Math.min(r.roundedTop,r.w/2,r.h/2),{x:t,y:n,w:o,h:i}=r;let s;switch(r.roundedEdge){case"right":s=`M${t},${n} L${t+o-e},${n} A${e},${e} 0 0 1 ${t+o},${n+e} L${t+o},${n+i-e} A${e},${e} 0 0 1 ${t+o-e},${n+i} L${t},${n+i} Z`;break;case"left":s=`M${t+o},${n} L${t+e},${n} A${e},${e} 0 0 0 ${t},${n+e} L${t},${n+i-e} A${e},${e} 0 0 0 ${t+e},${n+i} L${t+o},${n+i} Z`;break;case"bottom":s=`M${t},${n} L${t+o},${n} L${t+o},${n+i-e} A${e},${e} 0 0 1 ${t+o-e},${n+i} L${t+e},${n+i} A${e},${e} 0 0 1 ${t},${n+i-e} Z`;break;default:s=`M${t},${n+i} L${t},${n+e} A${e},${e} 0 0 1 ${t+e},${n} L${t+o-e},${n} A${e},${e} 0 0 1 ${t+o},${n+e} L${t+o},${n+i} Z`}return ue(A.Fragment,{children:[c,de("path",{d:s,fill:a,opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},l)}return ue(A.Fragment,{children:[c,de("rect",{x:r.x,y:r.y,width:r.w,height:r.h,fill:a,opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth}),ge(r,l)]},l)}case"point":{const e=n;return de("circle",{cx:e.x,cy:e.y,r:e.r,fill:X(e.style.fill),opacity:e.style.opacity??e.style.fillOpacity??.8,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},l)}case"symbol":return he(n,r,o);case"glyph":return Q(n,n.x,n.y,`${o??""}ord-glyph-${n.pointId??r}`);case"wedge":{const e=n;if(e._gradientBand&&e._gradientBand.colors.length>0){const t=K(`${o?o+"-":""}gauge-grad-${e.category||l}-${r}`),{clipPath:n,slices:i}=function(e){const t=Y({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],r=e.colors;if(r.length>0){const t=(e.endAngle-e.startAngle)/r.length;for(let o=0;r.length>o;o++)n.push({d:Y({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+o*t,endAngle:e.endAngle}),color:r[o]})}return{clipPath:t,slices:n}}({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundedEnds?.start??!0,roundEnd:e.roundedEnds?.end??!0,colors:e._gradientBand.colors});return ue("g",{transform:`translate(${e.cx},${e.cy})`,opacity:e.style.opacity,fillOpacity:e.style.fillOpacity,children:[de("defs",{children:de("clipPath",{id:t,children:de("path",{d:n})})}),de("g",{clipPath:`url(#${t})`,children:i.map((e,t)=>de("path",{d:e.d,fill:X(e.color)},t))}),e.style.stroke&&"none"!==e.style.stroke&&de("path",{d:n,fill:"none",stroke:e.style.stroke,strokeWidth:e.style.strokeWidth})]},l)}let t;if(e.roundedEnds)t=Y({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundedEnds.start,roundEnd:e.roundedEnds.end});else{const n=S().innerRadius(e.innerRadius).outerRadius(e.outerRadius).startAngle(e.startAngle+Math.PI/2).endAngle(e.endAngle+Math.PI/2);e.cornerRadius&&n.cornerRadius(e.cornerRadius),t=n(U)||""}return de("path",{d:t,transform:`translate(${e.cx},${e.cy})`,fill:X(e.style.fill),stroke:e.style.stroke,strokeWidth:e.style.strokeWidth,opacity:e.style.opacity},l)}case"boxplot":{const e=n,t=e.columnWidth/2;return ue("g","vertical"===e.projection?{children:[de("line",{x1:e.x,y1:e.minPos,x2:e.x,y2:e.maxPos,stroke:e.style.stroke||"#333",strokeWidth:1}),de("rect",{x:e.x-t,y:Math.min(e.q1Pos,e.q3Pos),width:e.columnWidth,height:Math.abs(e.q3Pos-e.q1Pos),fill:X(e.style.fill),fillOpacity:e.style.fillOpacity??.6,stroke:e.style.stroke||"#333",strokeWidth:1}),de("line",{x1:e.x-t,y1:e.medianPos,x2:e.x+t,y2:e.medianPos,stroke:e.style.stroke||"#333",strokeWidth:2}),de("line",{x1:e.x-.5*t,y1:e.minPos,x2:e.x+.5*t,y2:e.minPos,stroke:e.style.stroke||"#333",strokeWidth:1}),de("line",{x1:e.x-.5*t,y1:e.maxPos,x2:e.x+.5*t,y2:e.maxPos,stroke:e.style.stroke||"#333",strokeWidth:1})]}:{children:[de("line",{x1:e.minPos,y1:e.y,x2:e.maxPos,y2:e.y,stroke:e.style.stroke||"#333",strokeWidth:1}),de("rect",{x:Math.min(e.q1Pos,e.q3Pos),y:e.y-t,width:Math.abs(e.q3Pos-e.q1Pos),height:e.columnWidth,fill:X(e.style.fill),fillOpacity:e.style.fillOpacity??.6,stroke:e.style.stroke||"#333",strokeWidth:1}),de("line",{x1:e.medianPos,y1:e.y-t,x2:e.medianPos,y2:e.y+t,stroke:e.style.stroke||"#333",strokeWidth:2}),de("line",{x1:e.minPos,y1:e.y-.5*t,x2:e.minPos,y2:e.y+.5*t,stroke:e.style.stroke||"#333",strokeWidth:1}),de("line",{x1:e.maxPos,y1:e.y-.5*t,x2:e.maxPos,y2:e.y+.5*t,stroke:e.style.stroke||"#333",strokeWidth:1})]},l)}case"violin":{const e=n,t=[de("path",{d:e.pathString,transform:e.translateX||e.translateY?`translate(${e.translateX},${e.translateY})`:void 0,fill:X(e.style.fill),fillOpacity:e.style.fillOpacity??.6,stroke:e.style.stroke||"#333",strokeWidth:e.style.strokeWidth||1},s("path"))];if(e.iqrLine&&e.bounds){const n=e.bounds,r=n.x+n.width/2,o=n.y+n.height/2;e.iqrLine.isVertical?t.push(de("line",{x1:r,y1:e.iqrLine.q1Pos,x2:r,y2:e.iqrLine.q3Pos,stroke:e.style.stroke||"#333",strokeWidth:2},s("iqr")),de("circle",{cx:r,cy:e.iqrLine.medianPos,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},s("med"))):t.push(de("line",{x1:e.iqrLine.q1Pos,y1:o,x2:e.iqrLine.q3Pos,y2:o,stroke:e.style.stroke||"#333",strokeWidth:2},s("iqr")),de("circle",{cx:e.iqrLine.medianPos,cy:o,r:3,fill:"white",stroke:e.style.stroke||"#333",strokeWidth:1},s("med")))}return de("g",{children:t},l)}case"connector":return de("line",{x1:n.x1,y1:n.y1,x2:n.x2,y2:n.y2,stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity??.5},l);case"trapezoid":{const e=n,t=e.points.map(e=>`${e[0]},${e[1]}`).join(" ");return de("polygon",{points:t,fill:X(e.style.fill,"#999"),opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},l)}default:return null}}var be="undefined"==typeof window||"undefined"==typeof document;function ke(e){return"touch"===e?"touch":"pointer"}function $e(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function ve(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:l,timestamp:a=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:o,timestamp:a,chartType:i,chartId:s}),"focus"===l?.type&&t({type:"focus",datum:n,inputType:"touch"===l.inputType?"pointer":l.inputType,timestamp:a,chartType:i,chartId:s})):t({type:"hover-end",timestamp:a,chartType:i,chartId:s}))}function we(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:l,timestamp:a=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:o,timestamp:a,chartType:i,chartId:s}),"activate"===l?.type&&t({type:"activate",datum:n,inputType:l.inputType,timestamp:a,chartType:i,chartId:s})):t({type:"click-end",timestamp:a,chartType:i,chartId:s}))}import{useId as Me,useMemo as Ae,useCallback as Se}from"react";function We(e){const t=[];for(const[n,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[n]));else{const[e,o]=r.range;t.push(t=>{const r=t[n];return r>=e&&o>=r})}return e=>t.every(t=>t(e))}function Le(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function Ie(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[Ce,Ne]=y(e=>({selections:new Map,setClause(t,n){e(e=>{const r=e.selections.get(t),o=r?.clauses.get(n.clientId);if(o&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,r]of n){const n=t.fields[e];if(!n||!Ie(r,n))return!1}return!0}(o,n))return{};const i=new Map(e.selections),s=Le(i,t),l=new Map(s.clauses);return l.set(n.clientId,n),i.set(t,{...s,clauses:l}),{selections:i}})},clearClause(t,n){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(n))return{};const o=new Map(e.selections),i=new Map(r.clauses);return i.delete(n),o.set(t,{...r,clauses:i}),{selections:o}})},setResolution(t,n){e(e=>{const r=e.selections.get(t);if(r?.resolution===n)return{};const o=new Map(e.selections),i=Le(o,t);return o.set(t,{...i,resolution:n}),{selections:o}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...n,clauses:new Map}),{selections:r}})}}));import{useSyncExternalStore as Pe}from"react";var Oe={positions:new Map},je=new Set;function Fe(){for(const e of je)e()}function Re(e,t){const n=Oe.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const r=new Map(Oe.positions);r.delete(e),Oe={positions:r},Fe()}function ze(e,t){const n=Oe.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const r=new Map(Oe.positions);r.delete(e),Oe={positions:r},Fe()}function Te(){return Oe}function Ge(e){return je.add(e),()=>je.delete(e)}var Be={positions:new Map};function De(){return()=>{}}function Ee(){return Be}function He(e){const t=Pe(e?Ge:De,e?Te:Ee,e?Te:Ee);return e?t.positions.get(e)??null:null}function qe(e){const t=Me(),n=e.clientId||t,{name:r}=e,o=Ne(e=>e.selections.get(r)),i=Ne(e=>e.setClause),s=Ne(e=>e.clearClause),l=Ae(()=>!!o&&o.clauses.size>0,[o]);return{predicate:Ae(()=>o&&0!==o.clauses.size?function(e,t){const n=[];for(const[r,o]of e.clauses)"crossfilter"===e.resolution&&r===t||n.push(We(o));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(o,n):()=>!0,[o,n]),isActive:l,selectPoints:Se(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"point",values:new Set(r)},o=!0;o&&i(r,{clientId:n,type:"point",fields:t})},[n,r,i]),selectInterval:Se(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"interval",range:r},o=!0;o&&i(r,{clientId:n,type:"interval",fields:t})},[n,r,i]),clear:Se(()=>{s(r,n)},[s,r,n]),clientId:n}}function _e(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Ye(e){const{name:t,xField:n,yField:r}=e,{predicate:o,isActive:i,selectInterval:s,clear:l}=qe({name:t,fields:[n,r].filter(Boolean)}),a=n&&r?"xyBrush":n?"xBrush":"yBrush",c=Se(e=>{if(!e)return void l();const t={};"xyBrush"===a&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===a&&_e(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===a&&_e(e)&&r&&(t[r]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Ve(t)&&s(t)},[a,n,r,s,l]);return{brushInteraction:Ae(()=>({brush:a,during:c,end:c}),[a,c]),predicate:o,isActive:i,clear:l}}function Ve(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function Ze(e){return e?"string"==typeof e?{name:e}:e:null}var Ue={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Xe(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,o="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==r,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!o&&!i)return Ue;const l=s??{};return{enabled:!0,tapToSelect:l.tapToSelect??!0,tapToLockTooltip:l.tapToLockTooltip??!0,clearSelection:l.clearSelection??"backgroundTap",targetSize:l.targetSize??r??44,snap:l.snap??"nearestDatum",brushHandleSize:l.brushHandleSize??44,standardControls:l.standardControls??!1}}var Ke={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function Qe(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(Ke,e)}function Je(e,t,n){const o=Ke[e||"primary"],i=e&&"primary"!==e||!n?.width?o.width:n.width,s=e&&"primary"!==e||!n?.height?o.height:n.height,l={...t,mode:e},a=r(l,{width:t.width??i,height:t.height??s}).props,c=a.mode||e,d=Ke[c||"primary"],u="context"===c||"sparkline"===c,h=c&&"primary"!==c||!n?.width?d.width:n.width;return{width:a.width??h,height:a.height??(c&&"primary"!==c||!n?.height?d.height:n.height),showAxes:a.showAxes??d.showAxes,showGrid:a.showGrid??d.showGrid,enableHover:a.enableHover??(!!a.linkedHover||d.enableHover),showLegend:a.showLegend??d.showLegend,showLabels:a.showLabels??d.showLabels,title:u?void 0:a.title,description:a.description,summary:a.summary,accessibleTable:a.accessibleTable,xLabel:u?void 0:a.xLabel,yLabel:u?void 0:a.yLabel,categoryLabel:u?void 0:a.categoryLabel,valueLabel:u?void 0:a.valueLabel,marginDefaults:et(d.marginDefaults,a.showCategoryTicks,a.orientation),compactMode:u,mobileInteraction:Xe(a.mobileInteraction,{mode:c,width:a.width??h,mobileSemantics:a.mobileSemantics}),mobileSemantics:a.mobileSemantics}}function et(e,t,n){if(!1!==t)return e;const r={...e};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}import{useMemo as tt,useCallback as nt,useState as rt,useId as ot,useEffect as it,useRef as st}from"react";import{scaleOrdinal as lt}from"d3-scale";var at={category10:c,tableau10:u,set3:d,...i},ct=c,dt="#007bff";function ut(e,t,n=ct){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=at[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}var ht=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],ft=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function yt(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||ft.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):ct[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(r))%ct.length]}function pt(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function mt(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>pt(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),o=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return lt().domain(r).range(n).unknown("#999");const i=at[n]||at.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:ct;return lt().domain(r).range(e).unknown("#999")}}function gt(e,t,n=[3,20],r){let o;if(o="function"==typeof t?t(e):e?.[t],!r)return o;const[i,s]=r,[l,a]=n;if(s===i)return(l+a)/2;let c=(o-i)/(s-i);return 0>c?c=0:c>1&&(c=1),l+c*(a-l)}import{createContext as xt,useContext as bt,useEffect as kt,useId as $t,useLayoutEffect as vt,useMemo as wt,useRef as Mt,useState as At,useCallback as St}from"react";import*as Wt from"react";var Lt=22;function It(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}function Ct(e,t){let n=24;return e.map(({hasLabel:e,itemCount:r})=>{n+=5;const o=n;let i;n+=8,e&&(n+=16,i=n,n+=8);const s=n;return n+=r*t+8,{lineY:o,labelY:i,itemsY:s,endY:n}})}import{jsx as Nt,jsxs as Pt}from"react/jsx-runtime";var Ot={fill:(e,t)=>Nt("rect",{style:e,width:t,height:t}),line:(e,t)=>Nt("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function jt(e,t,n,r,o){let i;return i="function"==typeof n?n(e):(0,Ot[n])(r(e,t),o),i}function Ft({swatchSize:e}){return Nt("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Rt(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var zt=(e,t,n,r,o,i,s,l,a,c,d)=>{const{type:u="fill",styleFn:h,items:f}=e,y=[];let p=0;const m=!(!t&&!n),g="isolate"===c||void 0===c&&null!=o,{swatchSize:x,labelGap:b,rowHeight:k}=d;return f.forEach((e,c)=>{const d=jt(e,c,u,h,x),$=Rt(e,r,o),v=o&&o.size>0&&o.has(e.label);y.push(Pt("g",{transform:`translate(0,${p})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?l===i&&c===s?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&g?v||!1:void 0,"aria-current":m&&!g&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:m?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;a(l,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:m?t=>{a(l,c),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:$,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&Nt("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+b+2+7*e.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,v&&Nt(Ft,{swatchSize:x}),Nt("text",{y:x/2,x:x+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),p+=k}),y};function Tt({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:o,label:i,format:s}=e,l=s||(e=>Math.round(100*e)/100+""),a="grad-legend-"+Wt.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Nt("stop",{offset:100*t+"%",stopColor:r(o[0]+t*(o[1]-o[0]))},e))}return Pt("g",{"aria-label":i||"Gradient legend",children:[Nt("defs",{children:Nt("linearGradient",{id:a,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&Nt("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Nt("rect",{x:s,y:0,width:t,height:e,fill:`url(#${a})`,rx:2}),Nt("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[0])}),Nt("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(Nt("stop",{offset:100*t+"%",stopColor:r(o[1]-t*(o[1]-o[0]))},e))}return Pt("g",{"aria-label":i||"Gradient legend",children:[i&&Nt("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),Nt("defs",{children:Nt("linearGradient",{id:a,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),Nt("rect",{x:0,y:0,width:14,height:100,fill:`url(#${a})`,rx:2}),Nt("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[1])}),Nt("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[0])})]})}function Gt(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,legendInteraction:s,title:l="Legend",width:a=100,height:c=20,orientation:d="vertical",legendLayout:u}=e,h=It(u),[f,y]=Wt.useState(0),[p,m]=Wt.useState(0),g=Wt.useCallback((e,t)=>{y(e),m(t)},[]),x="vertical"===d?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:l,onFocusedIndexChange:a,legendInteraction:c,metrics:d})=>{const u=[],h=Ct(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),d.rowHeight);return e.forEach((e,f)=>{const y=h[f];u.push(Nt("line",{stroke:"gray",x1:0,y1:y.lineY,x2:t,y2:y.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=y.labelY&&u.push(Nt("text",{y:y.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),u.push(Nt("g",{className:"legend-item",transform:`translate(0,${y.itemsY})`,children:zt(e,n,r,o,i,s,l,f,a,c,d)},"legend-group-"+f))}),u})({legendGroups:t||[],width:a,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:g,legendInteraction:s,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:l,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:d,metrics:u})=>{let h=0;const f=[];e.forEach((e,t)=>{let y=0;e.label&&(y+=16);const p=((e,t,n,r,o,i,s,l,a,c,d,u)=>{const{type:h="fill",styleFn:f,items:y}=e,p=[],{swatchSize:m,labelGap:g,itemGap:x,rowHeight:b,align:k}=d,$=!(!t&&!n),v="isolate"===c||void 0===c&&null!=o,w=y.map(e=>m+g+7*e.label.length),M=[];let A=0,S=0;w.forEach((e,t)=>{const n=0===S?e:S+x+e;u&&u>0&&S>0&&n>u?(M.push({start:A,end:t,width:S}),A=t,S=e):S=n}),y.length>0&&M.push({start:A,end:y.length,width:S}),M.forEach((e,c)=>{let d="center"===k?Math.max(0,((u??e.width)-e.width)/2):"end"===k?Math.max(0,(u??e.width)-e.width):0;for(let u=e.start;e.end>u;u++){const e=y[u],k=jt(e,u,h,f,m),M=Rt(e,r,o),A=o&&o.size>0&&o.has(e.label);p.push(Pt("g",{transform:`translate(${d},${c*b})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:$?l===i&&u===s?0:-1:void 0,role:$?"option":void 0,"aria-selected":$&&v?A||!1:void 0,"aria-current":$&&!v&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:$?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(u+("ArrowRight"===n.key?1:-1)+y.length)%y.length;a(l,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:$?t=>{a(l,u),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:$?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:$?"pointer":"default",opacity:M,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[$&&Nt("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+g+2+7*e.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,A&&Nt(Ft,{swatchSize:m}),Nt("text",{y:m/2,x:m+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+u)),d+=w[u]+x}});const W=Math.max(0,...M.map(e=>e.width)),L=M.length;return{items:p,offset:W,totalRows:L,totalHeight:L*b}})(e,r,o,i,s,l,a,t,c,d,u,u.maxWidth??n);y+=p.offset+5,f.push({label:e.label,...p,offset:y,totalRows:p.totalRows,totalHeight:p.totalHeight}),h+=y+12});const y=u.maxWidth??n;let p=h>y?0:"center"===u.align?Math.max(0,(y-h)/2):"end"===u.align?Math.max(0,y-h):0;const m=[];return f.forEach((n,r)=>{const o=e[r];o.label&&(m.push(Nt("text",{transform:`translate(${p},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label},"legend-text-"+r)),p+=16),m.push(Nt("g",{className:"legend-item",transform:`translate(${p},0)`,children:n.items},"legend-group-"+r)),p+=n.offset+5,e[r+1]&&m.push(Nt("line",{stroke:"gray",x1:p,y1:-8,x2:p,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),p+=12}),Nt("g",{children:m})})({legendGroups:t||[],title:l,height:c,width:a,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:p,onFocusedIndexChange:g,legendInteraction:s,metrics:h}),b=!(!n&&!r);return Pt("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&Nt("text",{className:"legend-title",y:16,x:a/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),x]})}import{useRef as Bt,useState as Dt,useEffect as Et}from"react";function Ht(e,t,n){const r=Bt(null),[o,i]=Dt(null);return Et(()=>{if(!t&&!n)return;const e=r.current;if(!e)return;const o=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return o.observe(e),()=>o.disconnect()},[t,n]),[r,[t&&o?o.w:e[0],n&&o?o.h:e[1]]]}import{jsx as qt,jsxs as _t}from"react/jsx-runtime";var Yt=xt(!1);xt(!1);var Vt=xt(null),Zt="undefined"==typeof window?kt:vt;function Ut(...e){let t;for(const n of e)n&&(t=Xt(t)&&Xt(n)?{legendGroups:[...t.legendGroups,...n.legendGroups]}:n);return t}function Xt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}function Kt(e){return"object"==typeof e&&null!==e&&"gradient"in e}function Qt(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const o=Number(r);return Number.isFinite(o)?o:null}function Jt(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}var en=[];function tn(e,t,n,r,o){if(e)return e;if(n&&"object"==typeof n&&!Array.isArray(n)){const e=pt(n,r);if(e)return e}let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=at[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=r?(o.has(r)||o.set(r,o.size),i[o.get(r)%i.length]):i[0]:dt}function nn({selection:e,linkedHover:t,fallbackFields:n=en,unwrapData:r=!1,onObservation:i,chartType:s,chartId:l,onClick:a,hoverHighlight:c,colorByField:d,mobileInteraction:u}){const h=ot(),f=tt(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),[t,n]),y=tt(()=>"series"===f?.mode?[f.seriesField||d||n[0]].filter(e=>!!e):f?.fields||n,[f,d,n]),p=qe({name:e?.name||"__unused__",fields:y}),m=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:r,isActive:o,selectPoints:i,clear:s}=qe({name:t,fields:n});return{onHover:Se(e=>{if(!e)return void s();const t={};for(const r of n){const n=e[r];void 0!==n&&(t[r]=[n])}Ve(t)&&i(t)},[n,i,s]),predicate:r,isActive:o}}({name:f?.name||"hover",fields:y}),g=o(e=>e.pushObservation),x=nt(e=>{i?.(e),g?.(e)},[i,g]),b=e?{isActive:p.isActive,predicate:p.predicate}:null,[k,$]=rt(null),v=st(!1),w=d||n[0],M=tt(()=>{if(!c||null==k||!w)return null;const e=k,t=w;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[c,k,w]),A=nt((e,n)=>{const r=!e&&v.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===f?.mode&&f.xField){const n=Qt(e,t,f.xField);null!=n&&function(e,t,n){const r=Oe.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===n||(Oe={positions:new Map(Oe.positions).set(e,{xValue:t,sourceId:n})},Fe())}(f.name||"hover",n,h)}"x-position"!==f?.mode&&m.onHover(t)}else"x-position"!==f?.mode||r||Re(f.name||"hover",h),"x-position"===f?.mode||r||m.onHover(null);if(c&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[w];$(null!=n?n+"":null)}else r||$(null);(i||g)&&ve({onObservation:x,datum:e?Jt(e):null,x:e?.x,y:e?.y,chartType:s||"unknown",chartId:l,context:n})},[t,m,f,h,i,s,l,g,x,c,w,u]),S=nt((n=!0)=>{v.current=!1,t&&"x-position"!==f?.mode&&m.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&c&&$(null),"x-position"===f?.mode&&(ze(f.name||"hover",h),Re(f.name||"hover",h))},[t,f,m,e,u,p,c,h]),W=nt((n,r)=>{const o=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),d=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===f?.mode&&f.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=Qt(n,e,f.xField);null!=t&&function(e,t,n){const r=Oe.positions.get(e);if(r?.locked){const t=new Map(Oe.positions);return t.delete(e),Oe={positions:t},Fe(),!1}Oe={positions:new Map(Oe.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Fe()}(f.name||"hover",t,h)}if(o)if(n){v.current=!0;const r=Jt(n);if(t&&"x-position"!==f?.mode&&m.onHover(r),e&&u?.tapToSelect&&y.length>0){const e={};for(const t of y){const n=r[t];void 0!==n&&(e[t]=[n])}(function(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1})(e)&&p.selectPoints(e)}if(c&&w){const e=r?.[w];$(null!=e?e+"":null)}}else d&&S();if(n||d){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(i||g)&&we({onObservation:x,datum:n?Jt(n):null,x:n?.x,y:n?.y,chartType:s||"unknown",chartId:l,context:r})}},[a,i,g,x,s,l,f,h,u,t,m,e,p,y,c,w,S]);return it(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&v.current&&S()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,S]),it(()=>()=>{v.current&&S(!1)},[S]),it(()=>{if("x-position"!==f?.mode)return;const e=f.name||"hover";return()=>{ze(e,h),Re(e,h)}},[f?.mode,f?.name,h]),{activeSelectionHook:b,hoverSelectionHook:M,customHoverBehavior:A,customClickBehavior:W,crosshairSourceId:h}}function rn({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:o="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:l,additionalLegend:a}){const c=bt(Yt),d=null!==bt(Vt),u=void 0!==r?r:!c&&!!t,h=!!t&&(u||d),f=tt(()=>{if(!h)return[];if(void 0!==l)return l;const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(e+"")}return Array.from(n)},[l,t,e,h]);!function(e){const t=bt(Vt),n=$t(),r=function(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}(e),o=Mt([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(o.current,r)||(o.current=r);const i=o.current;Zt(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Zt(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(d&&t?f:[]);const y=tt(()=>{if(!u||!t)return;const r=function({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:o,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==o&&(n.stroke=o),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const s=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),l=s?r(s,t,n):n?n(o):ht[i%ht.length];return{label:o+"",color:l}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:yt,categories:f});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[u,t,e,n,f]),p=tt(()=>Ut(y,a),[y,a]),m=tt(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];return p&&("right"===o&&!r("right")&&110>n.right?n.right=110:"left"===o&&!r("left")&&110>n.left?n.left=110:"top"===o&&!r("top")&&50>n.top?n.top=50:"bottom"===o&&!r("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,p,o]);return{legend:p,margin:m,legendPosition:o}}function on(e,t,n){return Je(e,t,n)}function sn(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function ln(e,t){return Math.min((e-t.startTime)/t.duration,1)}function an(e,t,n){return e+(t-e)*n}function cn(){return"undefined"!=typeof performance?performance.now():Date.now()}function dn(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}import{jsx as un}from"react/jsx-runtime";var hn={secondary:0,primary:3},fn=".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}";function yn(e){return!0===e?._annotationDeferred}function pn(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function mn(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function gn(e){return Math.max(.72,.95-.06*e)}function xn(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:mn(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>yn(e.annotation)),o=e.some(e=>null!=pn(e.annotation)),i=e.some(e=>"layer"===pn(e.annotation));if(!n&&!r&&!o)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=hn[e.emphasis]);const l=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:o}=e,i=yn(t.annotation);let s=t.node;if("primary"===r||"secondary"===r||null!=o){const e=null==r&&null!=o;s=un("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:gn(o),"data-annotation-reading-order":o}:{},children:t.node},"annotation-emphasis-"+n)}const l=pn(t.annotation);return l&&(s=un("g",{className:"annotation-cohesion--"+l,children:s},"annotation-cohesion-"+n)),i&&(s=un("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return r&&l.unshift(un("style",{children:fn},"annotation-disclosure-style")),i&&l.unshift(un("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),l}function bn(e,t,n){return ut(e,t,n)}function kn(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&pt(n,e)||"#4e79a7":t=>{if(n){const e=pt(n,t);if(e)return e}let r=0;for(let e=0;t.length>e;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}import{jsx as $n,jsxs as vn}from"react/jsx-runtime";function wn(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),o=e.split(/\s+/),i=[];let s="";for(const e of o)s&&s.length+1+e.length>r?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Mn(e,t,n,r){return"curly"===e?r?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:r?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function An(e,t,n,r){if(!e)return $n("g",{className:"annotation-note"});const{label:o,title:i,orientation:s,align:l,wrap:a=120,noWrap:c}=e;if(!o&&!i)return $n("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let u=l;u&&"dynamic"!==u||(u="topBottom"===d?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===d?"right"===u?h="end":"middle"===u&&(h="middle"):h=0>t?"end":"start";const f=16,y=i?c?[i]:wn(i,a):[],p=o?c?[o]:wn(o,a):[],m="leftRight"===d?"end"===h?-4:4:0;let g=0;const x=[],b=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?x.push($n("foreignObject",{className:"annotation-note-html",x:"end"===h?m-a:"middle"===h?m-a/2:m,y:-16,width:a,height:Math.max(f,(y.length+p.length)*f+(i&&o?2:0))+f,style:{overflow:"visible"},children:vn("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:b,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&$n("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&$n("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(y.length>0&&(x.push($n("text",{className:"annotation-note-title",fill:b,textAnchor:h,fontWeight:"bold",children:y.map((e,t)=>$n("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=y.length*f),p.length>0&&x.push($n("text",{className:"annotation-note-label",fill:b,textAnchor:h,y:g,children:p.map((e,t)=>$n("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let k=null;if((i||o)&&(0!==t||0!==n))if("topBottom"===d){const e=Math.min(a,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),k=$n("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+p.length)*f+(p.length>0?f:0);let t=0,n=e;"bottom"===u?(t=-e,n=0):"middle"===u&&(t=-e/2,n=e/2),k=$n("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const $=Math.max(0,y.length+p.length-1)*f;let v=0;return"topBottom"===d?v=0>n?-($+2):18:"leftRight"===d&&(v="middle"===u?-($+f+(p.length>0&&y.length>0?2:0))/2+8:"bottom"===u||0>n?-($+2):18),vn("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[$n("g",{className:"annotation-note-content",transform:0!==v?`translate(0,${v})`:void 0,children:x}),k]})}function Sn(e,t,n,r,o){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push($n("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&i.push($n("rect",{width:e,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,s=o||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push($n("line",{x1:r,y1:(t.y1||0)-s,x2:r,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-s;i.push($n("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push($n("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push($n("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&i.push($n("path",{d:Mn(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return $n("g",{className:"annotation-subject",children:i})}function Wn(e,t,n,r,o,i){const s=[];let l=0,a=0;if("callout-circle"!==o&&"label"!==o||!i?.radius){if("callout-rect"===o&&i){const n=i.width||0,r=i.height||0;if(n>0||r>0){const o=n/2,i=r/2,s=e-o,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),d=n/2,u=r/2,h=e*u>t*d?d/e:u/t;l=o+s*h,a=i+c*h}}}else if("bracket"===o&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(l=e/2,a=n):void 0!==t&&(l=n,a=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);l=Math.cos(r)*n,a=Math.sin(r)*n}}const c=Math.sqrt((e-l)**2+(t-a)**2);if(c>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let d=Math.atan2(t-a,e-l);if(i){const r=(l+e)/2,i=(a+t)/2,u=-(t-a)/c,h=(e-l)/c,f=(n?.curve??.25)*c,y=r+u*f,p=i+h*f;s.push($n("path",{className:"connector-curve",d:`M${l},${a}Q${y},${p} ${e},${t}`,fill:"none",stroke:o},"connector-line")),d=Math.atan2(p-a,y-l)}else s.push($n("line",{x1:l,y1:a,x2:e,y2:t,stroke:o},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push($n("path",{d:`M${l},${a}L${l+e*Math.cos(d+t)},${a+e*Math.sin(d+t)}L${l+e*Math.cos(d-t)},${a+e*Math.sin(d-t)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return $n("g",{className:"annotation-connector",children:s})}function Ln(e){const{x:t=0,y:n=0,dx:r,dy:o,nx:i,ny:s,note:l,connector:a,subject:c,type:d,color:u,className:h,disable:f,opacity:y,strokeDasharray:p,events:m={},"data-testid":g}=e,x=Array.isArray(t)?t[0]??0:t,b=Array.isArray(n)?n[0]??0:n,k=new Set(Array.isArray(f)?f:[]);let $=r||0,v=o||0;null!=i&&($=i-x),null!=s&&(v=s-b);const w="string"==typeof d?d:"label";if("bracket"===w&&c&&0===$&&0===v)if(void 0!==c.width){$=c.width/2;const e=c.depth||30;v=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;$=e+(0>e?-5:5),v=c.height/2}return vn("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${x},${b})`,"data-testid":g,...null!=y&&{opacity:y},...p&&{strokeDasharray:p},...m,children:[!k.has("connector")&&Wn($,v,a,u,w,c),!k.has("subject")&&Sn(w,c,u,x,b),!k.has("note")&&An(l,$,v,u)]})}function In(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",o=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),o=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:o});return $n(Ln,{"data-testid":"semiotic-annotation",...s,type:r},"multi-annotation-"+i)});return $n("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return $n(Ln,{"data-testid":"semiotic-annotation",events:o,...t,type:r},s)}import{jsx as Cn,jsxs as Nn}from"react/jsx-runtime";var Pn="var(--semiotic-bg, #ffffff)";function On(e){const{x:t,y:n,text:r,fill:o,fontSize:i=12,fontWeight:s,fontFamily:l,textAnchor:a="start",dominantBaseline:c,background:d,className:u}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(d),f=e=>Cn("text",{x:t,y:n,textAnchor:a,dominantBaseline:c,fill:o,fontSize:i,fontWeight:s,fontFamily:l,className:u,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??Pn,strokeWidth:h.haloWidth??3});const y=h.padding??{x:6,y:3},p="number"==typeof y?y:y.x,m="number"==typeof y?y:y.y,g=function(e,t){return(e+"").length*t*.6}(r,i),x=i+2*m;let b,k;return b="middle"===a?t-g/2-p:"end"===a?t-g-p:t-p,k="middle"===c||"central"===c?n-x/2:"hanging"===c||"text-before-edge"===c?n-m:n-.8*i-m,Nn("g",{className:u,children:[Cn("rect",{x:b,y:k,width:g+2*p,height:x,rx:h.radius??3,ry:h.radius??3,fill:h.fill??Pn,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}export{m as filterSparseArray,x as parseDateLikeString,b as coerceDateLikeValue,k as coerceTemporalStringRows,ct as DEFAULT_COLORS,dt as DEFAULT_COLOR,ut as resolveCategoricalPalette,ht as STREAMING_PALETTE,yt as getColor,pt as resolveExplicitColor,mt as createColorScale,gt as getSize,sn as computeEasing,ln as computeRawProgress,an as lerp,cn as now,dn as resolveAnimateConfig,T as resolveCurveFactory,G as resolveCanvasFill,B as coerceCanvasFill,D as buildLinearFillGradient,E as buildColorStopGradient,Lt as DEFAULT_LEGEND_ROW_HEIGHT,It as resolveLegendMetrics,Ct as layoutVerticalLegendGroups,Tt as GradientLegend,Gt as Legend,Ut as composeLegendConfigs,Xt as isLegendConfig,Kt as isGradientLegendConfig,In as SemioticAnnotation,fn as ANNOTATION_DISCLOSURE_REVEAL_CSS,xn as applyAnnotationEmphasis,On as AnnotationLabel,ze as unlockCrosshair,He as useCrosshairPosition,$ as TITLE_BASELINE,v as hasTextTitle,w as reserveFrameChromeMargin,M as reserveTitleMargin,H as hasAnyCornerRadius,q as clampCornerRadii,re as networkSceneNodeToSVG,oe as networkSceneEdgeToSVG,ie as networkLabelToSVG,ce as geoSceneNodeToSVG,pe as xySceneNodeToSVG,xe as ordinalSceneNodeToSVG,be as isServerEnvironment,Ht as useResponsiveSize,ke as observationInputType,$e as isInteractiveKeyboardTarget,ve as emitHoverObservations,we as emitClickObservations,bn as resolveCustomLayoutPalette,kn as buildResolveColor,Ye as useBrushSelection,Ze as normalizeLinkedBrush,Qe as isChartMode,Je as resolveChartMode,tn as resolveDefaultFill,nn as useChartSelection,rn as useChartLegendAndMargin,on as useChartMode};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{annotationActivationProps as e,defaultTooltipStyle as t,extractAllRows as n}from"./chunk-chunk-255KDHW5.module.min.js";import{AnnotationLabel as r,GradientLegend as o,Legend as i,SemioticAnnotation as a,applyAnnotationEmphasis as l,isGradientLegendConfig as s,isLegendConfig as c,reserveFrameChromeMargin as u,resolveAnimateConfig as d,useResponsiveSize as h}from"./chunk-chunk-F25UA5HT.module.min.js";import{useReducedMotion as f}from"./chunk-chunk-XEVJDUTH.module.min.js";import{resolveSvgFill as m}from"./chunk-chunk-2WVCH4PL.module.min.js";import{FrameRuntime as p,isInBounds as y,resolveAnchoredPosition as g,resolveX as b,resolveY as x}from"./chunk-chunk-5RKXZQ2P.module.min.js";import{getMinMax as v}from"./chunk-chunk-JJ2OOIET.module.min.js";import{clearCSSColorCache as w}from"./chunk-chunk-QRIBHZYW.module.min.js";import{useThemeSelector as k}from"./chunk-chunk-DSNGDNJY.module.min.js";import{memo as M,useEffect as j,useRef as R}from"react";var S={sceneGeometry:0,layout:0,domain:0};function $(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function D(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var C="production"!==process.env.NODE_ENV,z={revisions:S,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},A=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=S,this.lastObserved=S,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){C&&(this.lastObserved=D(this.lastObserved,$(e)))}beforeCompute(e,t){if(!C)return z;const n=D($(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),o=!((i=n).sceneGeometry===(a=this.lastConsumed).sceneGeometry&&i.layout===a.layout&&i.domain===a.domain);var i,a;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:o,warnUnconsumed:!t&&o&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(C){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}};function N(e){return R(new A(e))}function W(e,t,n,r=!1,o=!1){const i=e.beforeCompute(t.getLastUpdateResult(),r);n(),e.afterCompute(i,!0,o)}var F=M(function({store:e,diagnostics:t}){return j(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null});import{useEffect as O,useLayoutEffect as I,useRef as B,useState as E,useSyncExternalStore as T}from"react";var H="undefined"!=typeof window?I:O;function U(){const[e,t]=E(!1);return H(()=>{t(!0)},[]),e}var P=()=>()=>{},L=()=>!1,q=()=>!0;function G(){const e=T(P,L,q);return B(e).current}import{jsx as V}from"react/jsx-runtime";var X={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Y({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return V("div",{"aria-live":"polite","aria-atomic":"true",style:X,children:t})}import*as J from"react";import*as Z from"react";import{jsx as K}from"react/jsx-runtime";var Q=Z.createContext(null);function _(){return Z.useContext(Q)}import{jsx as ee,jsxs as te}from"react/jsx-runtime";function ne(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const r=[],o={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),r=i.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of a)r.push(`${n[e]} ${o[e]||e}`);return`${t}, ${r.join(", ")}`}function re(e,t,n){const r=[];return e>0&&r.push(e+" nodes"),t>0&&r.push(t+" edges"),0===r.length?n+", empty":`${n}, ${r.join(", ")}`}var oe=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},ie="semiotic-accessible-data-table",ae=ie+" semiotic-accessible-data-table-hidden",le=ie+" semiotic-accessible-data-table-visible",se=le+" semiotic-accessible-data-table-network",ce={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},ue={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},de={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},he={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},fe={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},me={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},pe={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},ye={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function ge({scene:e,chartType:t,tableId:r,chartTitle:o}){const[i,a]=J.useState(!1),[l,s]=J.useState(5),c=_(),u=c?.visible??!1,d=i||u,h=J.useRef(null),f=o?"Data summary for "+o:r?`Data summary for ${t} ${r}`:"Data summary for "+t;J.useEffect(()=>{d||s(5)},[d]);const m=J.useCallback(e=>{e.target===e.currentTarget&&(i||u||a(!0))},[i,u]),p=J.useCallback(e=>{u||h.current?.contains(e.relatedTarget)||a(!1)},[u]);if(!e||0===e.length)return r?ee("span",{id:r,tabIndex:-1,style:X}):null;if(!d)return ee("div",{id:r,className:ae,tabIndex:-1,onFocus:m,style:X,role:"region","aria-label":f,children:te("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",e.length," elements)"]})});const y=n(e),g=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const r of t){const t=[],o=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[r];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&o.add(e+""))}if(t.length>0){let e=t[0],o=t[0],i=0;for(const n of t)e>n&&(e=n),n>o&&(o=n),i+=n;n.push({name:r,count:t.length,numeric:!0,min:e,max:o,mean:i/t.length})}else if(o.size>0){const e=Array.from(o);n.push({name:r,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${oe(e.min)} to ${oe(e.max)}, mean ${oe(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${r}.`)}return n.join(" ")}(y.length,g),x=Math.min(l,y.length),v=y.slice(0,x),w=y.length-x,k=new Set;for(const e of v)for(const t of Object.keys(e.values))k.add(t);const M=Array.from(k);return te("div",{ref:h,id:r,className:le,tabIndex:-1,onBlur:p,style:ce,role:"region","aria-label":f,children:[ee("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:de,children:"×"}),ee("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:ue,children:b}),te("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:he,children:[ee("caption",{className:"semiotic-accessible-data-table-caption",style:pe,children:w>0?`First ${x} of ${y.length} data points`:`All ${y.length} data points`}),ee("thead",{children:te("tr",{children:[ee("th",{style:fe,children:"type"}),M.map(e=>ee("th",{style:fe,children:e},e))]})}),ee("tbody",{children:v.map((e,t)=>te("tr",{children:[ee("td",{style:me,children:e.label}),M.map(t=>{return ee("td",{style:me,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":oe(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),w>0&&te("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:ye,children:["Show ",Math.min(25,w)," more"," ",1===w?"row":"rows"," (",w," remaining)"]})]})}function be({nodes:e,edges:t,chartType:n,tableId:r,chartTitle:o}){const[i,a]=J.useState(!1),[l,s]=J.useState(5),c=_(),u=c?.visible??!1,d=i||u,h=o?"Data summary for "+o:r?`Data summary for ${n} ${r}`:"Data summary for "+n,f=J.useRef(null);J.useEffect(()=>{d||s(5)},[d]);const m=J.useCallback(e=>{e.target===e.currentTarget&&(i||u||a(!0))},[i,u]),p=J.useCallback(e=>{u||f.current?.contains(e.relatedTarget)||a(!1)},[u]);if(!e||0===e.length)return r?ee("span",{id:r,tabIndex:-1,style:X}):null;if(!d)return ee("div",{id:r,className:ae,tabIndex:-1,onFocus:m,style:X,role:"region","aria-label":h,children:te("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const y=Array.isArray(e)?e:[],g=Array.isArray(t)?t:[],b=new Map,x=new Map,v=new Map,w=new Map;for(const e of g){if(!e||"object"!=typeof e)continue;const t=e.datum??{source:e.source,target:e.target},n="object"==typeof t.source?t.source?.id:t.source,r="object"==typeof t.target?t.target?.id:t.target,o="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";x.set(e,(x.get(e)??0)+1),w.set(e,(w.get(e)??0)+o)}if(null!=r&&""!==r){const e=r+"";b.set(e,(b.get(e)??0)+1),v.set(e,(v.get(e)??0)+o)}}const k=[];for(let e=0;y.length>e;e++){const t=y[e];if(!t||"object"!=typeof t)continue;const n=t.datum?.id??t.id,r=null!=n?n+"":"node-"+e,o=b.get(r)??0,i=x.get(r)??0,a=v.get(r)??0,l=w.get(r)??0;k.push({id:r,degree:o+i,inDeg:o,outDeg:i,wDegree:a+l,wInDeg:a,wOutDeg:l})}k.sort((e,t)=>t.degree-e.degree);let M=0,j=0;if(k.length>0){let e=0;for(const t of k)e+=t.degree,t.degree>j&&(j=t.degree);M=e/k.length}const R=g.some(e=>{const t=e?.datum??{source:e?.source,target:e?.target};return"number"==typeof t?.value&&Number.isFinite(t.value)}),S=[`${k.length} nodes, ${g.length} edges.`];k.length>0&&S.push(`Mean degree: ${oe(M)}, max degree: ${j}.`);const $=Math.min(l,k.length),D=k.slice(0,$),C=k.length-$;return te("div",{ref:f,id:r,className:se,tabIndex:-1,onBlur:p,style:ce,role:"region","aria-label":h,children:[ee("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{u&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:de,children:"×"}),ee("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:ue,children:S.join(" ")}),te("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:he,children:[ee("caption",{className:"semiotic-accessible-data-table-caption",style:pe,children:C>0?`Top ${$} of ${k.length} nodes by degree`:`All ${k.length} nodes by degree`}),ee("thead",{children:te("tr",{children:[ee("th",{style:fe,children:"id"}),ee("th",{style:fe,children:"degree"}),ee("th",{style:fe,children:"in"}),ee("th",{style:fe,children:"out"}),R&&ee("th",{style:fe,children:"w. degree"}),R&&ee("th",{style:fe,children:"w. in"}),R&&ee("th",{style:fe,children:"w. out"})]})}),ee("tbody",{children:D.map((e,t)=>te("tr",{children:[ee("td",{style:me,children:e.id}),ee("td",{style:me,children:e.degree}),ee("td",{style:me,children:e.inDeg}),ee("td",{style:me,children:e.outDeg}),R&&ee("td",{style:me,children:oe(e.wDegree)}),R&&ee("td",{style:me,children:oe(e.wInDeg)}),R&&ee("td",{style:me,children:oe(e.wOutDeg)})]},t))})]}),C>0&&te("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:ye,children:["Show ",Math.min(25,C)," more"," ",1===C?"node":"nodes"," (",C," remaining)"]})]})}function xe({summary:e}){return e?ee("div",{role:"note",style:X,children:e}):null}function ve({tableId:e}){return ee("a",{href:"#"+e,style:X,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,X)},children:"Skip to data table"})}import{jsx as we}from"react/jsx-runtime";var ke="var(--semiotic-focus, #005fcc)";function Me({active:e,hoverPoint:t,margin:n,size:r,shape:o="circle",width:i,height:a,pathData:l}){if(!e||!t)return null;const s=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==o&&"path"!==o||!l)if("rect"===o&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);u=we("rect",{x:s-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:ke,strokeWidth:2,strokeDasharray:"4,2"})}else u=we("circle","wedge"===o?{cx:s,cy:c,r:12,fill:"none",stroke:ke,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:s,cy:c,r:8,fill:"none",stroke:ke,strokeWidth:2,strokeDasharray:"4,2"});else u=we("g",{transform:`translate(${n.left},${n.top})`,children:we("path",{d:l,fill:"none",stroke:ke,strokeWidth:2.5,strokeDasharray:"6,3"})});return we("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}import*as je from"react";import{jsx as Re}from"react/jsx-runtime";function Se({x:e,y:n,containerWidth:r,containerHeight:o,margin:i,children:a,className:l="stream-frame-tooltip",zIndex:s=1}){const c=Number.isFinite(e)&&Number.isFinite(n),u=je.useRef(null),[d,h]=je.useState(null);je.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&h(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[l,r,o,c]);let f;f=d?`translate(${d.width+12>r-e?"calc(-100% - 12px)":"12px"}, ${d.height+12>o-n?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*r?"calc(-100% - 12px)":"12px"}, ${.3*o>n?"4px":"calc(-100% - 4px)"})`;const m=function(e){if(!je.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(a),p=m?null:t;return c?Re("div",{ref:u,className:m?l:(l+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:i.left+e,top:i.top+n,transform:f,pointerEvents:"none",zIndex:s,width:"max-content"},children:a}):null}import*as $e from"react";import{useCallback as De,useEffect as Ce,useLayoutEffect as ze,useMemo as Ae,useRef as Ne}from"react";var We="undefined"==typeof window?Ce:ze,Fe={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function Oe(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Ie(e){const t=f(),n=Ne(t);n.current=t;const[r,o]=h(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,a=!!e.legend&&"top"===e.legendPosition,l=Ae(()=>u({...e.marginDefault,...e.userMargin},i,a),[e.marginDefault,e.userMargin,i,a]),s=o[0]-l.left-l.right,c=o[1]-l.top-l.bottom,m=Oe(e.foregroundGraphics,o,l),y=Oe(e.backgroundGraphics,o,l),g=k(e=>e.theme),{transition:b,introEnabled:x}=d(e.animate,e.transitionProp),v="semiotic-table-"+$e.useId(),M=Ne(null);if(!M.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;M.current=new p({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const j=M.current;j.configure({clock:e.clock,random:e.random,seed:e.seed});const R=Ne(null),S=Ne(e.frameScheduler??Fe);S.current=e.frameScheduler??Fe;const $=Ne(null),D=Ne(!1),C=Ne(()=>{}),z=De(()=>{if(null!==R.current||D.current)return;const e=S.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(D.current=!0),R.current=null,$.current=null;try{C.current()}finally{e&&(D.current=!1)}});n=!0,t||(R.current=r,$.current=e)},[]),A=De(()=>{null!==R.current&&(($.current??S.current).cancelAnimationFrame(R.current),R.current=null,$.current=null)},[]);We(()=>{j.setPaused(!0===e.paused)},[j,e.paused]),Ce(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void j.setVisible(!0);const t=()=>j.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[j,e.suspendWhenHidden]),Ce(()=>()=>{A()},[A]);const N=Ne(()=>{}),W=Ne(()=>{}),F=Ne(null),O=Ne(null),I=Ne(null),B=De(()=>{const e=F.current;F.current=null,e&&N.current(e)},[]),E=De(e=>{if(F.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===O.current){const e=S.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,O.current=null,I.current=null,B()});t||(O.current=n,I.current=e)}},[B]),T=De(()=>{F.current=null,null!==O.current&&((I.current??S.current).cancelAnimationFrame(O.current),O.current=null,I.current=null),W.current()},[]);Ce(()=>()=>{F.current=null,null!==O.current&&((I.current??S.current).cancelAnimationFrame(O.current),O.current=null,I.current=null)},[]);const H=e.themeDirtyRef;return We(()=>{H&&(w(),H.current=!0,z())},[g,z,H]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:r,size:o,margin:l,adjustedWidth:s,adjustedHeight:c,resolvedForeground:m,resolvedBackground:y,currentTheme:g,transition:b,introEnabled:x,tableId:v,frameRuntime:j,rafRef:R,renderFnRef:C,scheduleRender:z,cancelRender:A,hoverHandlerRef:N,hoverLeaveRef:W,onPointerMove:E,onPointerLeave:T}}import{useEffect as Be,useRef as Ee}from"react";import{jsx as Te}from"react/jsx-runtime";function He(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:o,scheduleRender:i}=e,a=Ee(null),l=Ee(null),s=Ee(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:o,renderFnRef:i,cancelRender:a,cleanup:l}=e;H(()=>{t&&n&&r.current?.cancelIntroAnimation?.(),o.current=!0,a?.(),i.current()},[t,n]);const s=B(l);s.current=l,O(()=>()=>s.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),Be(()=>{if(!1!==o)return r.subscribe(()=>{r.isActive?(n.current=!0,i()):t()})},[t,n,r,o,i]),Be(()=>{!s.current&&(s.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:a,interactionCanvasRef:l}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}function Ue({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?Te("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:Te("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function Pe(e,t,n,r){const o=e.getContext("2d");if(!o)return null;const i=Math.round(t[0]*r),a=Math.round(t[1]*r),l=i/t[0],s=a/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===a||(e.width=i,e.height=a),o.setTransform(l,0,0,s,0,0),o.translate(n.left,n.top),o}function Le(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}import*as qe from"react";import{jsx as Ge,jsxs as Ve}from"react/jsx-runtime";function Xe({componentName:e,message:t,diagnosticHint:n,width:r,height:o}){return Ge("div",{role:"alert",style:{width:r,height:Math.max(o,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:Ve("div",{style:{textAlign:"center",maxWidth:400},children:[Ge("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),Ge("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&Ge("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}import{jsx as Ye}from"react/jsx-runtime";var Je=class extends qe.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:Ye(Xe,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as Ze}from"react/jsx-runtime";function Ke({componentName:e,width:t,height:n,children:r}){return Ze(Je,{fallback:r=>Ze(Xe,{componentName:e,message:r.message,width:t,height:n}),children:r})}"undefined"!=typeof process&&process;var Qe={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},_e={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function et(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?Ze("div",{style:{...Qe,width:t,height:n},children:r||"No data available"}):null}function tt(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return Ze("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),a=Math.max(6,Math.floor(n/(2.5*o))),l=Math.floor((n-(o*(i+a)-a))/2);return Ze("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:o},(e,n)=>Ze("div",{className:"semiotic-loading-bar",style:{..._e,position:"absolute",top:l+n*(i+a),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}import{jsx as nt}from"react/jsx-runtime";function rt(e){const{legend:t,totalWidth:n,totalHeight:r,margin:a,legendPosition:l="right",legendLayout:u,title:d,legendHoverBehavior:h,legendClickBehavior:f,legendHighlightedCategory:m,legendIsolatedCategories:p,legendInteraction:y}=e;if(!t)return null;const g="top"===l||"bottom"===l,b=!!d,x=Math.max(0,n-a.left-a.right),v=Math.max(1,g?u?.maxWidth??x:100);let w,k;return"left"===l?(w=Math.max(4,a.left-v-10),k=a.top):"top"===l?(w=a.left,k=b?32:8):"bottom"===l?(w=a.left,k=r-a.bottom+38):(w=n-a.right+10,k=a.top),nt("g",{transform:`translate(${w}, ${k})`,children:s(t)?nt(o,{config:t.gradient,orientation:g?"horizontal":"vertical",width:v}):c(t)?nt(i,{legendGroups:t.legendGroups,title:"",width:v,orientation:g?"horizontal":"vertical",legendLayout:u,customHoverBehavior:h,customClickBehavior:f,highlightedCategory:m,isolatedCategories:p,legendInteraction:y}):t})}import*as ot from"react";import{packEnclose as it}from"d3-hierarchy";import{area as at,curveLinear as lt,curveMonotoneX as st,curveMonotoneY as ct,curveStep as ut,curveStepAfter as dt,curveStepBefore as ht,curveBasis as ft,curveCardinal as mt,curveCatmullRom as pt}from"d3-shape";function yt(e){return Math.round(100*e)/100}function gt(e,t=2){const n=[],r=[],o=t+1;for(let t=0;o>t;t++){let i=0;for(const[n,r]of e)null!==r&&(i+=n**t*r);n.push(i);const a=[];for(let n=0;o>n;n++){let r=0;for(const[o,i]of e)null!==i&&(r+=o**(t+n));a.push(r)}r.push(a)}r.push(n);const i=function(e,t){const n=e,r=e.length-1,o=[t];for(let e=0;r>e;e++){let t=e;for(let o=e+1;r>o;o++)Math.abs(n[e][o])>Math.abs(n[e][t])&&(t=o);for(let o=e;r+1>o;o++){const r=n[o][e];n[o][e]=n[o][t],n[o][t]=r}for(let t=e+1;r>t;t++)for(let o=r;o>=e;o--)n[o][t]-=n[o][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let i=e+1;r>i;i++)t+=n[i][e]*o[i];o[e]=(n[r][e]-t)/n[e][e]}return o}(r,o).map(yt);return{points:e.map(([e])=>[yt(e),yt(i.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...i].reverse()}}import{jsx as bt,jsxs as xt}from"react/jsx-runtime";var vt={linear:lt,monotoneX:st,monotoneY:ct,step:ut,stepAfter:dt,stepBefore:ht,basis:ft,cardinal:mt,catmullRom:pt};function wt(e,t,n,r){const o=[];return e.forEach((e,i)=>{let a;if(n){const o=n(e,i,r);a=null!=o?o:t(e,i,r)}else a=t(e,i,r);a&&o.push({node:a,annotation:e})}),l(o)}function kt(t,n={}){return function(t,o,i){switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const e=g(t,o,i);if(!e)return null;const{x:n,y:r}=e;if(!y(n,r,i))return null;const l="callout"===t.type?"callout-circle":t.type,s="callout-circle"===l?{radius:t.radius??12,radiusPadding:t.radiusPadding}:"callout-rect"===l?{width:t.width,height:t.height}:void 0;return bt(a,{noteData:{x:n,y:r,dx:t.dx??30,dy:t.dy??-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:l,...s?{subject:s}:{},connector:t.connector||{end:"arrow"},color:t.color,disable:t.disable,opacity:t.opacity,strokeDasharray:t.strokeDasharray,className:t.className}},"ann-"+o)}case"x-threshold":{const e=b(null!=t.value?{...t,x:t.value}:t,i);if(null==e)return null;const n=t.color||"#f97316",a=t.labelPosition||"top";let l;l="bottom"===a?(i.height||0)-4:"center"===a?(i.height||0)/2:16;const s=e>.6*(i.width||0),c=s?e-4:e+4,u=s?"end":"start";return xt("g",{opacity:t.opacity,children:[bt("line",{x1:e,y1:0,x2:e,y2:i.height||0,stroke:n,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&bt(r,{x:c,y:l,text:t.label,textAnchor:u,fill:n,fontSize:12,fontWeight:"bold",background:t.labelBackground??"halo"})]},"ann-"+o)}case"y-threshold":{const e=x(null!=t.value?{...t,y:t.value}:t,i);if(null==e)return null;const n=t.color||"#f97316",a=t.labelPosition||"right";let l,s;"left"===a?(l=4,s="start"):"center"===a?(l=(i.width||0)/2,s="middle"):(l=(i.width||0)-4,s="end");const u=20>(c=e)?Math.min((i.height||0)-4,c+16):c-4;return xt("g",{opacity:t.opacity,children:[bt("line",{x1:0,y1:e,x2:i.width||0,y2:e,stroke:n,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&bt(r,{x:l,y:u,text:t.label,textAnchor:s,fill:n,fontSize:12,fontWeight:"bold",background:t.labelBackground??"halo"})]},"ann-"+o)}case"enclose":{const e=(t.coordinates||[]).map(e=>({x:b({...e,type:"point"},i),y:x({...e,type:"point"},i),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>e.length)return null;const n=it(e),a=t.padding||10;return xt("g",{children:[bt("circle",{cx:n.x,cy:n.y,r:n.r+a,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&bt(r,{x:n.x,y:n.y-n.r-a-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:t.label,background:t.labelBackground??"none"})]},"ann-"+o)}case"rect-enclose":{const e=(t.coordinates||[]).map(e=>({x:b({...e,type:"point"},i),y:x({...e,type:"point"},i)})).filter(e=>null!=e.x&&null!=e.y);if(2>e.length)return null;const n=t.padding||10,a=e.map(e=>e.x),l=e.map(e=>e.y),[s,c]=v(a),[u,d]=v(l),h=s-n,f=c+n,m=u-n;return xt("g",{children:[bt("rect",{x:h,y:m,width:f-h,height:d+n-m,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&bt(r,{x:(h+f)/2,y:m-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:t.label,background:t.labelBackground??"none"})]},"ann-"+o)}case"highlight":{const e=i.data||[],n="function"==typeof t.filter?e.filter(t.filter):t.field&&null!=t.value?e.filter(e=>e[t.field]===t.value):[],r={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return bt("g",{children:n.map((e,n)=>{const o=b(e,i),a=x(e,i);if(null==o||null==a)return null;const l="function"==typeof t.r?t.r(e):t.r||6,s="function"==typeof t.style?t.style(e):t.style||r;return bt("circle",{cx:o,cy:a,r:l,...s},"hl-"+n)})},"ann-"+o)}case"bracket":{const e=b(t,i),n=x(t,i);return bt(a,{noteData:{x:e??0,y:n??0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+o)}case"trend":{const e=i.data||[];if(2>e.length)return null;const n=i.xAccessor||"x",r=i.yAccessor||"y",a="ordinal"===i.frameType,l="horizontal"===i.projection,s=a?n:null,c=a?r:null;let u;const d=[],h=new Map;if(a&&s&&c){for(const t of e){const e=t[s];if(null==e)continue;const n=e+"";h.has(n)||(h.set(n,d.length),d.push(n))}u=e.map(e=>{const t=e[s],n=e[c];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else u=e.map(e=>[e[n],e[r]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=i.scales?.x??i.scales?.time,m=i.scales?.y??i.scales?.value;if(!f||!m)return null;const p=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(d.length-1,n+1),o=t-n,i=e(d[n]);return i+(e(d[r])-i)*o},y=f,g=m;let b;if(a)if(l){const e=p(g);b=(t,n)=>[y(n),e(t)]}else{const e=p(y);b=(t,n)=>[e(t),g(n)]}else b=(e,t)=>[y(e),g(t)];const x=t.method||"linear";let v;if("loess"===x)v=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),o=r.map(e=>e[0]),i=r.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),l=[];for(let e=0;n>e;e++){const t=o[e],r=o.map(e=>Math.abs(e-t)),s=r.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===s?0:r[e]/s;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,m=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*o[e],h+=t*i[e],f+=t*o[e]*o[e],m+=t*o[e]*i[e])}if(0===u){l.push([t,i[e]]);continue}const p=u*f-d*d;if(1e-12>Math.abs(p))l.push([t,h/u]);else{const e=(u*m-d*h)/p;l.push([t,(h-e*d)/u+e*t])}}return l}(u,t.bandwidth??.3);else{const e="polynomial"===x?gt(u,t.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,o]of e)null!==o&&(n++,t[0]+=r,t[1]+=o,t[2]+=r*r,t[3]+=r*o);const r=n*t[2]-t[0]*t[0],o=0===r?0:yt((n*t[3]-t[0]*t[1])/r),i=yt(t[1]/n-o*t[0]/n);return{points:e.map(([e])=>[yt(e),yt(o*e+i)]),equation:[o,i]}}(u);v=e.points}const w=v.map(([e,t])=>{const[n,r]=b(e,t);return`${n},${r}`}).join(" "),k=t.color||"#6366f1",M=v[v.length-1],[j,R]=b(M[0],M[1]);return xt("g",{children:[bt("polyline",{points:w,fill:"none",stroke:k,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&bt("text",{x:j+4,y:R-4,fill:k,fontSize:11,children:t.label})]},"ann-"+o)}case"band":{const e=i.scales?.y??i.scales?.value,n=e?.(t.y0)??0,a=e?.(t.y1)??(i.height||0),c=m(t.fill,"ann-"+o,"var(--semiotic-primary, #6366f1)");return xt("g",{opacity:t.opacity,children:[c.def&&bt("defs",{children:c.def}),bt("rect",{x:0,y:Math.min(n,a),width:i.width||0,height:Math.abs(a-n),fill:c.fill,fillOpacity:t.fillOpacity||.1}),t.label&&bt(r,{x:(i.width||0)-4,y:(l=n,s=a,Math.max(Math.min(l,s),0)+16),textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:t.label,background:t.labelBackground??"halo"})]},"ann-"+o)}case"x-band":{const e=i.scales?.x??i.scales?.time,n=null!=t.x0&&e?e(t.x0):null,a=null!=t.x1&&e?e(t.x1):null;if(null==n||null==a)return null;const l=m(t.fill||t.color,"ann-"+o,"var(--semiotic-primary, #6366f1)");return xt("g",{opacity:t.opacity,children:[l.def&&bt("defs",{children:l.def}),bt("rect",{x:Math.min(n,a),y:0,width:Math.abs(a-n),height:i.height||0,fill:l.fill,fillOpacity:t.fillOpacity??.1}),t.label&&bt(r,{x:Math.min(n,a)+4,y:16,textAnchor:"start",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:t.label,background:t.labelBackground??"halo"})]},"ann-"+o)}case"envelope":{const e=i.data||[];if(2>e.length)return null;const n=i.xAccessor||"x",r=i.scales?.x??i.scales?.time,a=i.scales?.y??i.scales?.value;if(!r||!a)return null;const l=t.upperAccessor||"upperBounds",s=t.lowerAccessor||"lowerBounds",c=t.filter,u=e.filter(e=>null!=e[l]&&null!=e[s]&&!(c&&!c(e))).sort((e,t)=>e[n]-t[n]);if(2>u.length)return null;const d=vt[i.curve||"linear"]||lt,h=at().x(e=>r(e[n])).y0(e=>a(e[s])).y1(e=>a(e[l])).curve(d)(u);if(!h)return null;const f=t.fill||"#6366f1";return xt("g",{children:[bt("path",{d:h,fill:f,fillOpacity:t.fillOpacity??.15,stroke:"none"}),t.label&&u.length>0&&bt("text",{x:r(u[u.length-1][n])+4,y:a(u[u.length-1][l])-4,fill:f,fontSize:11,children:t.label})]},"ann-"+o)}case"anomaly-band":{const e=i.data||[];if(2>e.length)return null;const n=i.yAccessor||"y",r=i.scales?.x??i.scales?.time,a=i.scales?.y??i.scales?.value;if(!r||!a)return null;const l=e.map(e=>e[n]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const s=l.reduce((e,t)=>e+t,0)/l.length,c=l.reduce((e,t)=>e+(t-s)**2,0)/l.length,u=Math.sqrt(c),d=t.threshold??2,h=s-d*u,f=!1!==t.showBand,m=t.fill||"#6366f1",p=t.fillOpacity??.1,y=t.anomalyColor||"#ef4444",g=t.anomalyRadius??6,v=a(s+d*u),w=a(h),k=e.filter(e=>{const t=e[n];return null!=t&&Math.abs(t-s)>d*u});return xt("g",{children:[f&&bt("rect",{x:0,y:Math.min(v,w),width:i.width||0,height:Math.abs(w-v),fill:m,fillOpacity:p}),k.map((e,t)=>{const n=b(e,i),r=x(e,i);return null==n||null==r?null:bt("circle",{cx:n,cy:r,r:g,fill:y,fillOpacity:.7,stroke:y,strokeWidth:1.5},"anomaly-"+t)}),t.label&&bt("text",{x:(i.width||0)-4,y:Math.min(v,w)-4,textAnchor:"end",fill:m,fontSize:11,children:t.label})]},"ann-"+o)}case"forecast":{const e=i.data||[];if(3>e.length)return null;const n=i.xAccessor||"x",r=i.yAccessor||"y",a=i.scales?.x??i.scales?.time,l=i.scales?.y??i.scales?.value;if(!a||!l)return null;const s=e.map(e=>[e[n],e[r]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>s.length)return null;let c;if("polynomial"===(t.method||"linear")){const e=gt(s,t.order||2).equation;c=t=>e.reduce((e,n,r)=>e+n*Math.pow(t,r),0)}else{const e=s.length;let t=0,n=0,r=0,o=0;for(const[e,i]of s)t+=e,n+=i,r+=e*e,o+=e*i;const i=e*r-t*t;if(1e-12>Math.abs(i))return null;const a=(e*o-t*n)/i,l=(n-a*t)/e;c=e=>l+a*e}const u=s.length,d=s.map(([e,t])=>t-c(e)),h=d.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(u-2,1)),m=s.reduce((e,t)=>e+t[0],0)/u,p=s.reduce((e,t)=>e+(t[0]-m)**2,0),y=t.confidence??.95,g=.99>y?.95>y?.9>y?1:1.645:1.96:2.576,b=t.steps??5,x=s[u-1][0],v=(x-s[0][0])/Math.max(u-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*v);const k=[];for(const e of w){const t=c(e),n=f*Math.sqrt(1+1/u+(p>0?(e-m)**2/p:0))*g;k.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const M=`M${k.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${k.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,j=k.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),R=`${a(x)},${l(c(x))}`,S=t.strokeColor||"#6366f1";return xt("g",{children:[bt("path",{d:M,fill:t.fill||"#6366f1",fillOpacity:t.fillOpacity??.15,stroke:"none"}),bt("polyline",{points:`${R} ${j}`,fill:"none",stroke:S,strokeWidth:t.strokeWidth??2,strokeDasharray:t.strokeDasharray??"6,3"}),t.label&&k.length>0&&bt("text",{x:a(k[k.length-1].x)+4,y:l(k[k.length-1].yCenter)-4,fill:S,fontSize:11,children:t.label})]},"ann-"+o)}case"widget":{let r,a;if(null!=t.px&&null!=t.py)r=t.px,a=t.py;else{const e=g(t,o,i);if(!e)return null;r=e.x,a=e.y}if(!y(r,a,i))return null;const l=t.dx??0,s=t.dy??0,c=t.width??32,u=t.height??32,d=t.content??bt("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return bt("foreignObject",{x:r+l-c/2,y:a+s-u/2,width:c,height:u,style:{overflow:"visible",pointerEvents:"auto"},children:bt("div",{...e(t,n),style:{width:c,height:u,display:"flex",alignItems:"center",justifyContent:"center"},children:d})},"ann-"+o)}case"text":{const e=g(t,o,i);if(!e)return null;const{x:n,y:r}=e,a=n+(t.dx||0),l=r+(t.dy||0),s=t.color||"var(--semiotic-text, #333)",c=bt("text",{x:a,y:l,fill:s,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?ot.cloneElement(c,{key:"ann-text-"+o}):xt("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[bt("line",{x1:n,y1:r,x2:a,y2:l,stroke:s,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),ot.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+o)}case"category-highlight":{const e=t.category;if(null==e)return null;const n=e=>"function"==typeof e&&"function"==typeof e.bandwidth,a=i.scales?.o,l=i.scales?.x,s=i.scales?.y,c=n(a)?a:n(l)?l:n(s)?s:null;if(!c)return null;const u=c(e+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",f=t.opacity??.15,m=t.label;return xt("g",(i.projection?"vertical"===i.projection:c===l)?{children:[bt("rect",{x:u,y:0,width:d,height:i.height||0,fill:h,fillOpacity:f}),m&&bt(r,{x:u+d/2,y:16,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",text:m,background:t.labelBackground??"none"})]}:{children:[bt("rect",{x:0,y:u,width:i.width||0,height:d,fill:h,fillOpacity:f}),m&&bt(r,{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",text:m,background:t.labelBackground??"none"})]},"ann-"+o)}default:return null}var l,s,c}}export{N as useSceneRevisionDiagnostics,W as runSceneBuild,F as SceneRevisionDiagnosticsObserver,rt as renderLegendFromConfig,wt as renderAnnotationPass,kt as createDefaultAnnotationRules,U as useHydration,G as useWasHydratingFromSSR,_ as useDataSummary,Y as AriaLiveTooltip,ne as computeCanvasAriaLabel,re as computeNetworkAriaLabel,ge as AccessibleDataTable,be as NetworkAccessibleDataTable,xe as ScreenReaderSummary,ve as SkipToTableLink,Me as FocusRing,Se as FlippingTooltip,Ie as useFrame,He as useFrameCanvasHost,Ue as CanvasFrameBackground,Pe as prepareCanvas,Le as getDevicePixelRatio,Ke as SafeRender,et as renderEmptyState,tt as renderLoadingState};
|