semiotic 3.8.2 → 3.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/CLAUDE.md +9 -9
  2. package/README.md +42 -40
  3. package/ai/examples.md +1 -1
  4. package/ai/schema.json +2726 -300
  5. package/ai/surface-manifest.json +1 -1
  6. package/ai/system-prompt.md +1 -1
  7. package/dist/chunk-chunk-2JGJ5GUG.module.min.js +0 -1
  8. package/dist/chunk-chunk-3ILKBVVQ.module.min.js +1 -0
  9. package/dist/{chunk-chunk-NO4MCQVD.module.min.js → chunk-chunk-5RKXZQ2P.module.min.js} +1 -1
  10. package/dist/{chunk-chunk-CYIML3AV.module.min.js → chunk-chunk-6TPGFL7M.module.min.js} +1 -1
  11. package/dist/{chunk-chunk-VVCA3DB7.module.min.js → chunk-chunk-7ALTGHK6.module.min.js} +1 -1
  12. package/dist/chunk-chunk-7KZJUTKP.module.min.js +2 -0
  13. package/dist/chunk-chunk-7RYBCTK5.module.min.js +1 -0
  14. package/dist/chunk-chunk-ACLDBMRH.module.min.js +2 -0
  15. package/dist/chunk-chunk-ANYDWOZF.module.min.js +1 -0
  16. package/dist/{chunk-chunk-ZLKRTF5N.module.min.js → chunk-chunk-AQPQN2HH.module.min.js} +1 -1
  17. package/dist/chunk-chunk-ASKSE5F5.module.min.js +1 -0
  18. package/dist/chunk-chunk-AVBI6GDT.module.min.js +1 -0
  19. package/dist/chunk-chunk-B3DRZPBK.module.min.js +2 -0
  20. package/dist/chunk-chunk-BFHUYEOS.module.min.js +2 -0
  21. package/dist/chunk-chunk-C4YA6TDR.module.min.js +1 -0
  22. package/dist/chunk-chunk-C57LR3YG.module.min.js +1 -0
  23. package/dist/chunk-chunk-EMO5NUGE.module.min.js +1 -0
  24. package/dist/chunk-chunk-F5V4UIE6.module.min.js +2 -0
  25. package/dist/chunk-chunk-F7WFPD4O.module.min.js +2 -0
  26. package/dist/chunk-chunk-FBGHXL72.module.min.js +2 -0
  27. package/dist/chunk-chunk-FP44FHFO.module.min.js +2 -0
  28. package/dist/chunk-chunk-HKXUAEPJ.module.min.js +2 -0
  29. package/dist/chunk-chunk-ICEXPNDC.module.min.js +2 -0
  30. package/dist/chunk-chunk-IY7RYD4S.module.min.js +1 -0
  31. package/dist/{chunk-chunk-7LHMKRKE.module.min.js → chunk-chunk-JDXT6ORT.module.min.js} +1 -1
  32. package/dist/chunk-chunk-JMVEIZXP.module.min.js +1 -0
  33. package/dist/chunk-chunk-KHCOJMGK.module.min.js +1 -0
  34. package/dist/chunk-chunk-KQ546MKE.module.min.js +2 -0
  35. package/dist/chunk-chunk-LQBSXO7K.module.min.js +2 -0
  36. package/dist/chunk-chunk-LRIFN2HK.module.min.js +1 -0
  37. package/dist/chunk-chunk-MFHF4J2Z.module.min.js +1 -0
  38. package/dist/chunk-chunk-N6VKKF3A.module.min.js +2 -0
  39. package/dist/chunk-chunk-NEVE562N.module.min.js +1 -0
  40. package/dist/chunk-chunk-NKZ75IM5.module.min.js +2 -0
  41. package/dist/chunk-chunk-PLIDPQNG.module.min.js +2 -0
  42. package/dist/{chunk-chunk-FYY2ACNJ.module.min.js → chunk-chunk-PRDGLMJT.module.min.js} +1 -1
  43. package/dist/chunk-chunk-QGZGZI4X.module.min.js +1 -0
  44. package/dist/chunk-chunk-RP7WTID5.module.min.js +1 -0
  45. package/dist/chunk-chunk-S7KLNUO6.module.min.js +1 -0
  46. package/dist/chunk-chunk-SR4ZXOWR.module.min.js +2 -0
  47. package/dist/chunk-chunk-ZOAQDIJO.module.min.js +1 -0
  48. package/dist/chunk-minimapBrushOverlay-JU57U7NM.module.min.js +2 -0
  49. package/dist/chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js +2 -0
  50. package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +1 -0
  51. package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +1 -0
  52. package/dist/components/ChartContainer.d.ts +2 -2
  53. package/dist/components/ai/chartCapabilityTypes.d.ts +5 -0
  54. package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
  55. package/dist/components/charts/geo/ChoroplethMap.d.ts +2 -0
  56. package/dist/components/charts/geo/DistanceCartogram.d.ts +7 -3
  57. package/dist/components/charts/geo/FlowMap.d.ts +4 -0
  58. package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +3 -1
  59. package/dist/components/charts/physics/CollisionSwarmChart.d.ts +6 -1
  60. package/dist/components/charts/physics/GaltonBoardChart.d.ts +6 -1
  61. package/dist/components/charts/physics/gauntletChartProps.d.ts +7 -1
  62. package/dist/components/charts/physics/gauntletChrome.d.ts +2 -1
  63. package/dist/components/charts/physics/gauntletPhysics.d.ts +19 -4
  64. package/dist/components/charts/physics/gauntletRuntime.d.ts +3 -0
  65. package/dist/components/charts/physics/physicsHocUtils.d.ts +12 -0
  66. package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -6
  67. package/dist/components/charts/realtime/temporalHistogramConfig.d.ts +11 -0
  68. package/dist/components/charts/shared/areaSeriesData.d.ts +15 -0
  69. package/dist/components/charts/shared/chartMode.d.ts +75 -0
  70. package/dist/components/charts/shared/chartSpecCore.d.ts +2 -2
  71. package/dist/components/charts/shared/colorUtils.d.ts +8 -0
  72. package/dist/components/charts/shared/geoStyleDefaults.d.ts +3 -0
  73. package/dist/components/charts/shared/hatchPattern.d.ts +8 -3
  74. package/dist/components/charts/shared/hooks.d.ts +13 -80
  75. package/dist/components/charts/shared/lineSeriesSsr.d.ts +55 -0
  76. package/dist/components/charts/shared/types.d.ts +2 -2
  77. package/dist/components/charts/shared/useChartSetup.d.ts +3 -0
  78. package/dist/components/charts/shared/useCustomChartSetup.d.ts +3 -0
  79. package/dist/components/charts/shared/useXYLineStyle.d.ts +3 -2
  80. package/dist/components/charts/shared/validateProps.d.ts +1 -1
  81. package/dist/components/charts/shared/xyLineStyle.d.ts +21 -0
  82. package/dist/components/charts/xy/AreaChart.d.ts +10 -0
  83. package/dist/components/charts/xy/LineChart.d.ts +3 -0
  84. package/dist/components/charts/xy/minimapBrushOverlay.d.ts +17 -0
  85. package/dist/components/charts/xy/minimapBrushOverlayLazy.d.ts +4 -0
  86. package/dist/components/charts/xy/scatterplotMatrixBrushOverlay.d.ts +8 -0
  87. package/dist/components/charts/xy/scatterplotMatrixBrushOverlayLazy.d.ts +3 -0
  88. package/dist/components/legendLayout.d.ts +31 -0
  89. package/dist/components/realtime/types.d.ts +5 -0
  90. package/dist/components/recipes/gridObservatory.d.ts +176 -0
  91. package/dist/components/recipes/recipeChrome.d.ts +24 -0
  92. package/dist/components/recipes/sequenceLayout.d.ts +139 -0
  93. package/dist/components/semiotic-recipes-core.d.ts +6 -2
  94. package/dist/components/server/serverChartConfigShared.d.ts +29 -0
  95. package/dist/components/server/serverChartConfigs.d.ts +2 -13
  96. package/dist/components/server/serverChartConfigsXY.d.ts +3 -0
  97. package/dist/components/server/serverGaugeOverlay.d.ts +28 -0
  98. package/dist/components/server/staticAnnotations.d.ts +3 -1
  99. package/dist/components/server/staticLegend.d.ts +7 -1
  100. package/dist/components/server/staticSVGChrome.d.ts +57 -0
  101. package/dist/components/stream/GeoPipelineStore.d.ts +2 -0
  102. package/dist/components/stream/GeoSVGOverlay.d.ts +2 -0
  103. package/dist/components/stream/SceneToSVG.d.ts +10 -8
  104. package/dist/components/stream/SceneToSVGGeo.d.ts +10 -0
  105. package/dist/components/stream/SceneToSVGNetwork.d.ts +12 -0
  106. package/dist/components/stream/SceneToSVGOrdinal.d.ts +12 -0
  107. package/dist/components/stream/canvasBackground.d.ts +7 -0
  108. package/dist/components/stream/networkFramePaint.d.ts +2 -0
  109. package/dist/components/stream/networkTypes.d.ts +2 -4
  110. package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +18 -2
  111. package/dist/components/stream/physics/physicsBodyCanvas.d.ts +7 -0
  112. package/dist/components/stream/physics/physicsPipelineEviction.d.ts +15 -0
  113. package/dist/components/stream/physics/physicsPipelineObservations.d.ts +1 -1
  114. package/dist/components/stream/physics/physicsPipelineQuiescence.d.ts +20 -0
  115. package/dist/components/stream/renderBackend.d.ts +14 -0
  116. package/dist/components/stream/sceneToSVGShared.d.ts +80 -0
  117. package/dist/components/stream/types.d.ts +4 -0
  118. package/dist/components/stream/useHydration.d.ts +7 -1
  119. package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +1 -1
  120. package/dist/components/types/legendTypes.d.ts +16 -3
  121. package/dist/forceLayoutWorker.js +1 -1
  122. package/dist/geo.min.js +1 -1
  123. package/dist/geo.module.min.js +1 -1
  124. package/dist/network.min.js +1 -1
  125. package/dist/network.module.min.js +1 -1
  126. package/dist/ordinal.min.js +1 -1
  127. package/dist/ordinal.module.min.js +1 -1
  128. package/dist/physics.min.js +1 -1
  129. package/dist/physics.module.min.js +1 -1
  130. package/dist/physicsWorker.js +1 -1
  131. package/dist/realtime.min.js +1 -1
  132. package/dist/realtime.module.min.js +1 -1
  133. package/dist/rough.min.js +1 -1
  134. package/dist/rough.module.min.js +1 -1
  135. package/dist/semiotic-ai-core.min.js +1 -1
  136. package/dist/semiotic-ai-core.module.min.js +1 -1
  137. package/dist/semiotic-ai.min.js +1 -1
  138. package/dist/semiotic-ai.module.min.js +1 -1
  139. package/dist/semiotic-experimental.min.js +1 -1
  140. package/dist/semiotic-experimental.module.min.js +1 -1
  141. package/dist/semiotic-realtime-core.min.js +1 -1
  142. package/dist/semiotic-realtime-core.module.min.js +1 -1
  143. package/dist/semiotic-recipes-core.d.ts +6 -2
  144. package/dist/semiotic-recipes-core.min.js +1 -1
  145. package/dist/semiotic-recipes-core.module.min.js +1 -1
  146. package/dist/semiotic-recipes.min.js +1 -1
  147. package/dist/semiotic-recipes.module.min.js +1 -1
  148. package/dist/semiotic-server-edge.min.js +1 -1
  149. package/dist/semiotic-server-edge.module.min.js +1 -1
  150. package/dist/semiotic-server-node.min.js +1 -1
  151. package/dist/semiotic-server-node.module.min.js +1 -1
  152. package/dist/semiotic-utils-core.min.js +1 -1
  153. package/dist/semiotic-utils-core.module.min.js +1 -1
  154. package/dist/semiotic-utils.min.js +1 -1
  155. package/dist/semiotic-utils.module.min.js +1 -1
  156. package/dist/semiotic-value.module.min.js +1 -1
  157. package/dist/semiotic.min.js +1 -1
  158. package/dist/semiotic.module.min.js +1 -1
  159. package/dist/server.min.js +1 -1
  160. package/dist/server.module.min.js +1 -1
  161. package/dist/xy.min.js +1 -1
  162. package/dist/xy.module.min.js +1 -1
  163. package/package.json +3 -2
  164. package/dist/chunk-chunk-255KDHW5.module.min.js +0 -1
  165. package/dist/chunk-chunk-27HVVXS6.module.min.js +0 -1
  166. package/dist/chunk-chunk-2UN3ANRN.module.min.js +0 -2
  167. package/dist/chunk-chunk-2VUEY5TH.module.min.js +0 -1
  168. package/dist/chunk-chunk-2WVCH4PL.module.min.js +0 -1
  169. package/dist/chunk-chunk-5WEFWNUW.module.min.js +0 -2
  170. package/dist/chunk-chunk-6F6GEAQU.module.min.js +0 -1
  171. package/dist/chunk-chunk-BHYTYMY2.module.min.js +0 -2
  172. package/dist/chunk-chunk-C6EJ4IOD.module.min.js +0 -2
  173. package/dist/chunk-chunk-CP3EN6KZ.module.min.js +0 -1
  174. package/dist/chunk-chunk-DNY43POY.module.min.js +0 -1
  175. package/dist/chunk-chunk-E7MIQX7D.module.min.js +0 -2
  176. package/dist/chunk-chunk-ES4DCG3L.module.min.js +0 -1
  177. package/dist/chunk-chunk-FAKO3RGQ.module.min.js +0 -2
  178. package/dist/chunk-chunk-H4PPRW6N.module.min.js +0 -1
  179. package/dist/chunk-chunk-IFYPMWKY.module.min.js +0 -1
  180. package/dist/chunk-chunk-J3ELI22J.module.min.js +0 -1
  181. package/dist/chunk-chunk-L6D3I3V7.module.min.js +0 -2
  182. package/dist/chunk-chunk-M337NY6L.module.min.js +0 -1
  183. package/dist/chunk-chunk-ODUZEEBH.module.min.js +0 -2
  184. package/dist/chunk-chunk-P6UBCMSQ.module.min.js +0 -2
  185. package/dist/chunk-chunk-QRIBHZYW.module.min.js +0 -1
  186. package/dist/chunk-chunk-RH5TSQPH.module.min.js +0 -1
  187. package/dist/chunk-chunk-STZFFTAN.module.min.js +0 -2
  188. package/dist/chunk-chunk-T27ZEV6A.module.min.js +0 -1
  189. package/dist/chunk-chunk-U3AGQ5EF.module.min.js +0 -2
  190. package/dist/chunk-chunk-W3DB2MN4.module.min.js +0 -2
  191. package/dist/chunk-chunk-WDIN4LRC.module.min.js +0 -1
  192. package/dist/chunk-chunk-XOYX77KF.module.min.js +0 -2
  193. package/dist/chunk-chunk-Z5KXAVQD.module.min.js +0 -2
  194. package/dist/chunk-chunk-ZCNBUZPL.module.min.js +0 -2
  195. package/dist/chunk-chunk-ZTNVDWAK.module.min.js +0 -2
@@ -1,2 +0,0 @@
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-BHYTYMY2.module.min.js";import{StreamNetworkFrame_default as s,buildRibbonGeometry as a}from"./chunk-chunk-2UN3ANRN.module.min.js";import{buildBaseMetadataProps as l,buildCustomBehaviorProps as c}from"./chunk-chunk-FAKO3RGQ.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 f,DEPTH_PALETTE_COLORS as p,filterSparseArray as b,getColor as y,normalizeTooltip as v,resolveDefaultFill as k,resolveMobileInteraction as S,useChartLegendAndMargin as w,useChartMode as C,useChartSelection as T,useColorScale as A,useLegendInteraction as I,useThemeCategorical as M}from"./chunk-chunk-ODUZEEBH.module.min.js";import{getMin as H}from"./chunk-chunk-JJ2OOIET.module.min.js";import{ChartError as x,SafeRender as B,renderEmptyState as N,renderLoadingState as O}from"./chunk-chunk-ZCNBUZPL.module.min.js";import{forwardRef as D,useMemo as P}from"react";import{jsx as L}from"react/jsx-runtime";var E=D(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:f,colorBy:p,colorScheme:y,selection:v,linkedHover:k,onObservation:w,onClick:C,chartId:A,annotations:I,autoPlaceAnnotations:M,frameProps:H={}}=e,{frameRef:x,resolved:D,normalizedMargin:E}=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=P(()=>b(o),[o]),R=P(()=>b(i),[i]),z=P(()=>void 0===o&&void 0===i?void 0:[...W,...R],[i,o,R,W]),F=S(e.mobileInteraction,{mode:e.mode,width:D.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:j,customClickBehavior:$,activeSelectionHook:_}=T({selection:v,linkedHover:k,fallbackFields:"string"==typeof p?[p]:[],onObservation:w,onClick:C,chartType:"NetworkCustomChart",chartId:A,colorByField:"string"==typeof p?p:void 0,mobileInteraction:F}),G=P(()=>_?.isActive?{isActive:!0,predicate:_.predicate}:null,[_?.isActive,_?.predicate]),{width:q,height:Y,enableHover:Z,title:J,description:U,summary:X,accessibleTable:K}=D,Q=O(e.loading,q,Y,e.loadingContent),V=Q?null:N(z,q,Y,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:p,colorScheme:y,size:[q,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:E,enableHover:Z,...l({title:J,description:U,summary:X,accessibleTable:K,className:f,animate:e.animate,autoPlaceAnnotations:M}),...c({linkedHover:k,selection:v,onObservation:w,onClick:C,mobileInteraction:F,customHoverBehavior:j,customClickBehavior:$,linkedHoverInClickPredicate:!1}),layoutSelection:G,...null!=I&&{annotations:I},...H};return L(B,{componentName:"NetworkCustomChart",width:q,height:Y,children:L(s,{ref:x,...ee})})});E.displayName="NetworkCustomChart";import{useMemo as W,forwardRef as R,useRef as z}from"react";import{useMemo as F}from"react";function j(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 _(e){return"function"==typeof e?e:t=>t[e]||1}function G({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 q(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:f,onClick:p,mobileInteraction:y,mobileSemantics:v,chartType:k,chartId:C,marginDefaults:H,userMargin:x,width:B,height:D,loading:P,loadingContent:L,emptyContent:E,emptyDataKey:W="edges"}=e,R=F(()=>b(o),[o]),z=F(()=>b(t),[t]),j=O(P,B,D,L),_=j?null:N("nodes"===W?void 0===t?void 0:z:void 0===o?void 0:R,B,D,E),G=F(()=>n?$(z,R,i,r):z,[n,z,R,i,r]),q=A(G,s,a),Y=M(),Z=F(()=>{if(Array.isArray(a))return a;if(Y&&Y.length>0)return Y;if("string"==typeof a){const e=g[a];if(Array.isArray(e)&&e.length>0)return e}return u},[a,Y]),J=F(()=>{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]),U=I(d,s,J),{legend:X,margin:K,legendPosition:Q}=w({data:G,colorBy:s,colorScale:q,showLegend:l,legendPosition:c,userMargin:x,defaults:H,categories:J}),V=F(()=>S(y,{width:B,mobileSemantics:v}),[y,B,v]),ee=T({selection:m,linkedHover:h,fallbackFields:s?["string"==typeof s?s:""]:[],unwrapData:!0,onObservation:f,onClick:p,mobileInteraction:V,chartType:k,chartId:C}),{customHoverBehavior:te,customClickBehavior:oe,activeSelectionHook:ne,hoverSelectionHook:ie,crosshairSourceId:re}=ee;return{safeNodes:G,safeEdges:R,colorScale:q,effectivePalette:Z,themeCategorical:Y,allCategories:J,legendState:U,legend:X,margin:K,legendPosition:Q,mobileInteraction:V,customHoverBehavior:te,customClickBehavior:oe,activeSelectionHook:ne,hoverSelectionHook:ie,crosshairSourceId:re,loadingEl:j,emptyEl:_}}import{jsx as Y}from"react/jsx-runtime";var Z=R(function(t,n){const r=z(null);i(n,{variant:"network",frameRef:r});const a=C(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:f,nodeIDAccessor:p,sourceAccessor:b="source",targetAccessor:S="target",nodeLabel:w,colorBy:T,colorScheme:A,styleRules:I,nodeSize:M=8,nodeSizeRange:H=[5,20],edgeWidth:N=1,edgeColor:O="#999",edgeOpacity:D=.6,iterations:P=300,forceStrength:L=.1,layoutExecution:E="auto",layoutLoadingContent:R,onLayoutStateChange:F,tooltip:j,frameProps:$={},onObservation:_,onClick:G,chartId:Z,selection:J,linkedHover:U,loading:X,loadingContent:K,emptyContent:Q,legendInteraction:V,legendPosition:ee,stroke:te,strokeWidth:oe,opacity:ne}=t,ie=f??p??"id",{width:re,height:se,enableHover:ae,showLegend:le,showLabels:ce=!1,title:de,description:me,summary:he,accessibleTable:ge}=a,ue=q({nodes:l,edges:d,inferNodes:!1,nodeIdAccessor:ie,sourceAccessor:b,targetAccessor:S,colorBy:T,colorScheme:A,showLegend:le,legendPosition:ee,legendInteraction:V,selection:J,linkedHover:U,onObservation:_,onClick:G,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"ForceDirectedGraph",chartId:Z,marginDefaults:a.marginDefaults,userMargin:g,width:re,height:se,loading:X,loadingContent:K,emptyContent:Q,emptyDataKey:"nodes"}),fe=W(()=>new Map,[]),pe=W(()=>e=>{const t={};return t.fill=T?y(e.data||e,T,ue.colorScale):k(void 0,ue.themeCategorical,A,void 0,fe),"number"==typeof M&&(t.r=M),t},[T,ue.colorScale,M,ue.themeCategorical,A,fe]),be=W(()=>h(T,"number"==typeof M?void 0:M),[T,M]),ye=W(()=>o(m(pe,I,be,e=>e.data||e),{stroke:te,strokeWidth:oe,opacity:ne}),[pe,I,be,te,oe,ne]),ve=W(()=>e=>{const t=e.data||e;let o;if("number"==typeof N)o=N;else if("function"==typeof N)o=N(t);else{const e=t[N],n="number"==typeof e?e:Number(e);o=Number.isFinite(n)&&n>0?n:1}return{stroke:O,strokeWidth:o,opacity:D}},[N,O,D]),ke=W(()=>o(ve,{stroke:te,strokeWidth:oe,opacity:ne}),[ve,te,oe,ne]),Se=W(()=>{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?Y(x,{componentName:"ForceDirectedGraph",message:we,width:re,height:se}):ue.loadingEl?ue.loadingEl:ue.emptyEl?ue.emptyEl:Y(B,{componentName:"ForceDirectedGraph",width:re,height:se,children:Y(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:S,iterations:P,forceStrength:L,layoutExecution:E,layoutLoadingContent:R,onLayoutStateChange:F,nodeStyle:ye,edgeStyle:ke,colorBy:T,colorScheme:ue.effectivePalette,nodeSize:M,nodeSizeRange:H,nodeLabel:Se,showLabels:ce,enableHover:ae,tooltipContent:!1===j?()=>null:v(j)||void 0,...c({linkedHover:U,selection:J,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 J,forwardRef as U,useRef as X}from"react";import{jsx as K}from"react/jsx-runtime";var Q=U(function(t,n){const r=X(null);i(n,{variant:"network",frameRef:r,overrides:{getData:()=>r.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const a=C(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:f,className:p,sourceAccessor:b="source",targetAccessor:S="target",valueAccessor:w="value",nodeIdAccessor:T="id",colorBy:A,colorScheme:I,styleRules:M,edgeColorBy:H="source",padAngle:N=.01,groupWidth:O=20,sortGroups:D,nodeLabel:P,edgeOpacity:L=.5,tooltip:E,frameProps:W={},onObservation:R,onClick:z,chartId:F,selection:j,linkedHover:$,loading:_,loadingContent:Y,emptyContent:Z,legendInteraction:U,stroke:Q,strokeWidth:V,opacity:ee}=t,{width:te,height:oe,enableHover:ne,showLabels:ie=!0,title:re,description:se,summary:ae,accessibleTable:le}=a,ce=q({nodes:l,edges:d,inferNodes:!0,nodeIdAccessor:T,sourceAccessor:b,targetAccessor:S,colorBy:A,colorScheme:I,showLegend:!1,legendInteraction:U,selection:j,linkedHover:$,onObservation:R,onClick:z,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"ChordDiagram",chartId:F,marginDefaults:a.marginDefaults,userMargin:f,width:te,height:oe,loading:_,loadingContent:Y,emptyContent:Z}),de=J(()=>new Map,[]),me=ce.safeNodes.length>0,he=J(()=>{if(me)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;o.fill=i[(e.index??t??0)%i.length]}return o}},[me,A,ce.colorScale,I]),ge=J(()=>h(A),[A]),ue=J(()=>{if(he||M&&M.length>0)return o(m(he,M,ge,e=>e.data||e),{stroke:Q,strokeWidth:V,opacity:ee})},[he,M,ge,Q,V,ee]),fe=J(()=>{if(me)return G({edgeColorBy:H,colorBy:A,colorScale:ce.colorScale,nodeStyleFn:ue||(e=>({fill:k(void 0,ce.themeCategorical,I,void 0,de)})),edgeOpacity:L,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:L}})},[me,H,A,ce.colorScale,ue,L,ce.themeCategorical,I,de]),pe=J(()=>fe?o(fe,{stroke:Q,strokeWidth:V,opacity:ee}):void 0,[fe,Q,V,ee]),be=J(()=>{if(!ie)return;const e=P||T;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[ie,P,T]),ye=e({componentName:"ChordDiagram",edges:d,edgesRequired:!0});return ye?K(x,{componentName:"ChordDiagram",message:ye,width:te,height:oe}):ce.loadingEl?ce.loadingEl:ce.emptyEl?ce.emptyEl:K(B,{componentName:"ChordDiagram",width:te,height:oe,children:K(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:T,sourceAccessor:b,targetAccessor:S,valueAccessor:w,padAngle:N,groupWidth:O,sortGroups:D,nodeStyle:ue,edgeStyle:pe,colorBy:A,colorScheme:ce.effectivePalette,edgeColorBy:H,edgeOpacity:L,nodeLabel:be,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}),...U&&"none"!==U&&{legendHoverBehavior:ce.legendState.onLegendHover,legendClickBehavior:ce.legendState.onLegendClick,legendHighlightedCategory:ce.legendState.highlightedCategory,legendIsolatedCategories:ce.legendState.isolatedCategories},className:p,title:re,description:se,summary:ae,accessibleTable:le,...null!=t.animate&&{animate:t.animate},...W})})});Q.displayName="ChordDiagram";import{useMemo as V,forwardRef as ee,useRef as te}from"react";import{jsx as oe}from"react/jsx-runtime";var ne=ee(function(t,n){const r=te(null);i(n,{variant:"network",frameRef:r,overrides:{getData:()=>r.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const a=C(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:f="source",targetAccessor:p="target",valueAccessor:b="value",nodeIdAccessor:S="id",colorBy:w,colorScheme:T,styleRules:A,edgeColorBy:I="source",orientation:M="horizontal",nodeAlign:H="justify",nodePaddingRatio:N=.05,nodeWidth:O=15,nodeLabel:D,edgeOpacity:P=.5,edgeSort:L,tooltip:E,frameProps:W={},onObservation:R,onClick:z,chartId:F,selection:j,linkedHover:$,loading:_,loadingContent:Y,emptyContent:Z,showLegend:J,legendPosition:U,legendInteraction:X,stroke:K,strokeWidth:Q,opacity:ee}=t,{width:ne,height:ie,enableHover:re,showLabels:se=!0,title:ae,description:le,summary:ce,accessibleTable:de}=a,me=q({nodes:l,edges:d,inferNodes:!0,nodeIdAccessor:S,sourceAccessor:f,targetAccessor:p,colorBy:w,colorScheme:T,showLegend:J,legendPosition:U,legendInteraction:X,selection:j,linkedHover:$,onObservation:R,onClick:z,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"SankeyDiagram",chartId:F,marginDefaults:a.marginDefaults,userMargin:g,width:ne,height:ie,loading:_,loadingContent:Y,emptyContent:Z}),he=V(()=>new Map,[]),ge=V(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=w?y(e.data||e,w,me.colorScale):k(void 0,me.themeCategorical,T,void 0,he),t},[w,me.colorScale,me.themeCategorical,T,he]),ue=V(()=>h(w,b),[w,b]),fe=V(()=>o(m(ge,A,ue,e=>e.data||e),{stroke:K,strokeWidth:Q,opacity:ee}),[ge,A,ue,K,Q,ee]),pe=V(()=>G({edgeColorBy:I,colorBy:w,colorScale:me.colorScale,nodeStyleFn:fe,edgeOpacity:P,baseStyle:{stroke:"none",strokeWidth:0}}),[I,w,me.colorScale,fe,P]),be=V(()=>o(pe,{stroke:K,strokeWidth:Q,opacity:ee}),[pe,K,Q,ee]),ye=V(()=>{if(!se)return;const e=D||S;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[se,D,S]),ve=e({componentName:"SankeyDiagram",edges:d,edgesRequired:!0});return ve?oe(x,{componentName:"SankeyDiagram",message:ve,width:ne,height:ie}):me.loadingEl?me.loadingEl:me.emptyEl?me.emptyEl:oe(B,{componentName:"SankeyDiagram",width:ne,height:ie,children:oe(s,{ref:r,chartType:"sankey",...me.safeNodes.length>0&&{nodes:me.safeNodes},...null!=d&&{edges:me.safeEdges},size:[ne,ie],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:me.margin,nodeIDAccessor:S,sourceAccessor:f,targetAccessor:p,valueAccessor:b,orientation:M,nodeAlign:H,nodePaddingRatio:N,nodeWidth:O,nodeStyle:fe,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,...X&&"none"!==X&&{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 ie(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 re(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 se(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?H(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 f=0,p=0;for(const e of r)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?f:p);if(o>0){const t="top"===e.side?"bot":"top",n=Math.min(o,"top"===t?f:p);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?f-=n:p-=n,"top"===e.side?f+=n:p+=n,o-=n}o>0&&null!==d&&(u.push({time:d,delta:+o,kind:"create",side:e.side}),"top"===e.side?f+=o:p+=o)}"top"===e.side?f-=t:p-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?f+=t:p+=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 x=null;for(const e of n)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===x||e.systemOutTime>x)&&(x=e.systemOutTime);if(T.length>0){const e=T[T.length-1],t=Math.max(null!=I?I:-1/0,null!=x?x:-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 ae(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function le(e,t){return e.map(e=>({t:ae(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function ce(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 de(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 me(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 he(e,t){return 1e3*de(e,t)+me(e,t)}function ge(e,t){return{slots:e.map(e=>({peak:{...e.peak},occupants:e.occupants.slice()})),map:{...t}}}function ue(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=ge(e,t),s=he(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=he(t,o);if(s>m)s=m,r=ge(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=he(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=he(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=he(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 f=c.map(t=>e[t]),p=new Map;c.forEach((e,t)=>p.set(e,t));for(const e of Object.keys(t))t[e]=p.get(t[e]);e.length=0;for(const t of f)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 f={},p=[];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;p.length>e;e++){const n=p[e].occupants[p[e].occupants.length-1];if(null===t.start||void 0===n||t.start>=n.end){o=e;break}}-1===o&&(p.push({occupants:[],peak:{topPeak:0,botPeak:0}}),o=p.length-1),p[o].occupants.push({id:e.id,end:t?.end??-1/0}),p[o].peak.topPeak=Math.max(p[o].peak.topPeak,m[e.id]),p[o].peak.botPeak=Math.max(p[o].peak.botPeak,h[e.id]),f[e.id]=o}}else e.forEach((e,t)=>{p.push({occupants:[{id:e.id,end:u[e.id]?.end??-1/0}],peak:{topPeak:m[e.id],botPeak:h[e.id]}}),f[e.id]=t});let b=null,y=null,v=null,k=null;const S=()=>{b=de(f,t),v=me(f,t)},w=()=>{y=de(f,t),k=me(f,t)};"crossing-min"===c?(S(),ue(p,f,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)}(p,f),w()):"crossing-min+inside-out"===c&&(S(),ue(p,f,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=he(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=he(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}}(p,f,t),w());const C=p.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;p.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+(p[0]?.peak.topPeak??0)*a;p.length>0&&I.push(M);for(let e=1;p.length>e;e++)M+=A[e-1]*a+s,I.push(M);if(p.length>0&&(M+=p[p.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===p.length?0:p[0].peak.topPeak+A.reduce((e,t)=>e+t,0)+p[p.length-1].peak.botPeak,x={};for(const t of e)x[t.id]=I[f[t.id]];return{effectiveSlotsHeight:H,centerlines:x,laneLifetime:u,slots:p,slotByNode:f,slotCenter:I,crossingsBefore:b,crossingsAfter:y,lengthBefore:v,lengthAfter:k}}ne.displayName="SankeyDiagram";import{useMemo as pe,useState as be,useRef as ye,useCallback as ve}from"react";import{scaleTime as ke}from"d3-scale";import{forwardRef as Se}from"react";var we=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 Ce(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}import{Fragment as Te,jsx as Ae,jsxs as Ie}from"react/jsx-runtime";function Me(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function He(e,t){return"function"==typeof e?e(t):t[e]}var xe=Se(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:f,systemOutTimeAccessor:p,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:O=!1,showLabels:D=!0,width:P=600,height:L=400,margin:E,title:W,description:R,summary:z,accessibleTable:F,responsiveWidth:j,responsiveHeight:_,loading:G,loadingContent:Y,emptyContent:Z,edgeOpacity:J=.35,timeFormat:U,valueFormat:X,tooltip:K,enableHover:Q=!0,onObservation:V,onClick:ee,showParticles:te=!1,particleStyle:oe,chartId:ne,frameProps:de={}}=e,[me,he]=be([]),[ge,ue]=be([]),Se=ye(me),xe=ye(ge);Se.current=me,xe.current=ge;const Be=ve(e=>{Se.current=e,he(e)},[]),Ne=ve(e=>{xe.current=e,ue(e)},[]),Oe=void 0!==n,De=b(Oe?n:me),Pe=pe(()=>{const e=b(o??[]),t=ge;if(0===e.length&&0===t.length)return $([],De,d,m);const n=new Set,i=[];for(const t of e){const e=He(c,t)+"";n.has(e)||(n.add(e),i.push(t))}for(const e of t){const t=He(c,e)+"";n.has(t)||(n.add(t),i.push(e))}const r=$([],De,d,m);for(const e of r)n.has(e.id)||(n.add(e.id),i.push(e));return i},[o,ge,De,c,d,m]),Le=ye(null),Ee=ve((e,t)=>{const o=He(S,e);return null!=o?o+"":`${He(d,e)}-${He(m,e)}-${t}`},[S,d,m]),We=ve(e=>{if(null==e)return!1;const t=e;return null!=He(d,t)&&null!=He(m,t)},[d,m]);i(t,{variant:"network",frameRef:Le,overrides:{push(e){if(We(e)){if(Oe)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");Be([...Se.current,e])}else Ne([...xe.current,e])},pushMany(e){const t=[],o=[];for(const n of e)We(n)?t.push(n):o.push(n);t.length>0&&(Oe?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):Be([...Se.current,...t])),o.length>0&&Ne([...xe.current,...o])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),o=[];if(!Oe){const e=Se.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=xe.current,i=[];for(const e of n){const n=He(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(!Oe){let e=!1;const i=Se.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=xe.current.map(e=>{const r=He(c,e)+"";return o.has(r)?(n.push(e),i=!0,t(e)):e});return i&&Ne(r),n},clear(){Oe||Be([]),Ne([]),Le.current?.clear()},getData:()=>De??[],getScales:()=>null}});const Re=Ee,ze=ve(e=>He(c,e)+"",[c]),{nodes:Fe,edges:je,domain:$e,rawNodeById:_e,rawEdgeById:Ge}=pe(()=>{const e=(Pe??[]).map(e=>{const t={id:ze(e),__raw:e},o=k?He(k,e):null;if(Array.isArray(o)&&2===o.length){const e=Me(o[0]),n=Me(o[1]);Number.isFinite(e)&&Number.isFinite(n)&&(t.xExtent=[e,n])}return t}),t=(De??[]).map((e,t)=>{const o={id:Re(e,t),source:He(d,e)+"",target:He(m,e)+"",value:Number(He(h,e)),startTime:Me(He(g,e)),endTime:Me(He(u,e)),__raw:e};if(f){const t=Me(He(f,e));Number.isFinite(t)&&(o.systemInTime=t)}if(p){const t=Me(He(p,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[Me(r[0]),Me(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,De,r,ze,Re,k,d,m,h,g,u,f,p]),qe=q({nodes:Pe,edges:De,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:Y,emptyContent:Z}),Ye=(T??!!w)&&!!w,Ze=ve(e=>null!=E&&("number"==typeof E||null!=E[e]),[E]),Je=pe(()=>{const e={...qe.margin};return Ye&&("right"===A&&!Ze("right")&&140>e.right?e.right=140:"bottom"===A&&!Ze("bottom")&&80>e.bottom&&(e.bottom=80)),e},[qe.margin,Ye,A,Ze]),Ue=P-Je.left-Je.right,Xe=L-Je.top-Je.bottom,Ke=pe(()=>ie(Fe,je,$e),[Fe,je,$e]),Qe=pe(()=>Ke.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]=se(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]=se(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),f=Math.min(12,.35*n/Math.max(g.slots.length+1,1)),p=u>0?Math.max(0,(n-f*(g.slots.length+1))/u):1,b=fe(e,t,d,l,{plotH:n,padding:f,valueScale:p,packing:r,laneOrder:s,lifetimeMode:a});return{nodeData:d,sides:c,valueScale:p,padding:f,compressedPadding:12>f,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:Xe,pairing:I,packing:M,laneOrder:H,lifetimeMode:B}),[Ke,Fe,je,Xe,I,M,H,B]),Ve=pe(()=>ke().domain($e).range([0,Ue]),[$e,Ue]),et=ve((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=pe(()=>{const e=new Map;return Fe.forEach((t,o)=>e.set(t.id,o)),e},[Fe]),ot=pe(()=>{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=le(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=le(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=le(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(ae(e,i)),u=[],f=(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]=ce(e,a,s);u.push({pathD:f(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]=ce(e,a,s);u.push({pathD:f(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,f=o.sideMassAfter*l;let p,b,y,v;"top"===e.side?(p=t-u,b=p+h):(b=t+u,p=b-h),"top"===o.side?(y=n-f,v=y+g):(v=n+f,y=v-g);const k="source"===s?d+.85*(m-d):"target"===s?d+.15*(m-d):(d+m)/2;return{sx:d,sTop:p,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:J,rawDatum:g,bezier:h})}),{bands:n,ribbons:i}},[Qe,Fe,je,Ve,$e,et,_e,Ge,x,J,tt]),nt=pe(()=>({bands:ot.bands,ribbons:ot.ribbons,showLabels:D}),[ot,D]),it=pe(()=>{if(!Ye||!w)return;const e=new Map;(Pe??[]).forEach((t,o)=>{const n=He(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},[Ye,w,Pe,et,ze]),rt=pe(()=>!1!==K&&Q?void 0===K||!0===K?null:v(K)||null:null,[K,Q]),st=ve(e=>U?U(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[U]),at=ve(e=>X?X(e):e+"",[X]),lt=ve(e=>{if(!e||!e.data)return null;const t=e.data;if(!Ce(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 Ie("div",{style:{minWidth:160},children:[Ae("div",{style:{fontWeight:600,marginBottom:4},children:e}),r.length>0&&Ie("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[Ae("thead",{children:Ie("tr",{style:{opacity:.6},children:[Ae("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),Ae("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=i&&Ae("th",{})]})}),Ae("tbody",{children:r.map((e,t)=>Ie("tr",{children:[Ae("td",{style:{paddingRight:8},children:st(e.t)}),Ae("td",{style:{textAlign:"right"},children:at(e.total)}),null!=i&&Ae("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:e.mark})]},t))})]}),null!=i&&Ie("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",r.length," of ",i," samples"]})]})}const n=o,i=He(d,n),r=He(m,n),s=He(h,n),a=He(g,n),l=He(u,n);return Ie("div",{style:{minWidth:160},children:[Ie("div",{style:{fontWeight:600,marginBottom:4},children:[i+""," → ",r+""]}),Ie("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=s&&Ie(Te,{children:[Ae("span",{style:{opacity:.6},children:"value"}),Ae("span",{style:{textAlign:"right"},children:at(Number(s))})]}),null!=a&&Ie(Te,{children:[Ae("span",{style:{opacity:.6},children:"start"}),Ae("span",{style:{textAlign:"right"},children:st(Me(a))})]}),null!=l&&Ie(Te,{children:[Ae("span",{style:{opacity:.6},children:"end"}),Ae("span",{style:{textAlign:"right"},children:st(Me(l))})]})]})]})},[Qe,rt,st,at,d,m,h,g,u]),ct=pe(()=>{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(Ue,e)),g=h(d??0),u=Math.max(g,h(m??Ue));return Ie("g",{children:[O&&null!==(s??null)&&Ie("text",{x:Ue,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",r," → ",s," ","edge length: ",Math.round(a)," → ",Math.round(c)]}),i&&Ae("text",{x:Ue,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),l.map((e,t)=>{const o=Ve(Me(e.date));return g-.5>o||o>u+.5?null:Ae("line",{x1:o,y1:0,x2:o,y2:Xe,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 Ie("g",{children:[Ae("line",{x1:d,y1:c,x2:m,y2:c,stroke:h,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),Ae("line",{x1:d,y1:c-4,x2:d,y2:c+4,stroke:h,strokeOpacity:.5}),Ae("line",{x1:m,y1:c-4,x2:m,y2:c+4,stroke:h,strokeOpacity:.5})]},"lane-"+i.id)}),Ae("line",{x1:g,y1:Xe+4,x2:u,y2:Xe+4,stroke:"#94a3b8"}),l.map((e,t)=>{const o=Me(e.date),n=Ve(o);if(g-.5>n||n>u+.5)return null;const i=null!=e.label?e.label:U?U(new Date(o)):"";return Ie("g",{transform:`translate(${n},${Xe+4})`,children:[Ae("line",{y2:6,stroke:"#94a3b8"}),Ae("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:i})]},t)})]})},[Qe,l,Ve,Ue,Xe,N,Fe,et,O,U]),dt=pe(()=>(Pe??[]).map(e=>({id:ze(e),data:e})),[Pe,ze]),mt=pe(()=>{const e=new Map;for(const t of ot.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[ot]),ht=pe(()=>(De??[]).map((e,t)=>{const o=Re(e,t),n=Number(He(h,e));return{id:o,source:He(d,e)+"",target:He(m,e)+"",value:Number.isFinite(n)?n:0,bezier:mt.get(o),data:e}}),[De,Re,d,m,h,mt]),gt=qe.loadingEl,ut=qe.emptyEl;return Ke.length>0?Ie("svg",{width:P,height:L,role:"img","aria-label":W??"Process Sankey validation failed",children:[Ae("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Ke.map((e,t)=>Ae("text",{x:20,y:56+18*t,fontSize:12,fill:"#64748b",children:"• "+re(e)},t))]}):gt||ut||Ae(s,{ref:Le,chartType:"force",nodes:dt,edges:ht,customNetworkLayout:we,layoutConfig:nt,size:[P,L],responsiveWidth:j,responsiveHeight:_,margin:Je,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===K?()=>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;Ce(t)&&ee(t.data,{x:e.x,y:e.y})}},chartId:ne,colorScheme:Array.isArray(C)?C:void 0,...de})});xe.displayName="ProcessSankey";import{useMemo as Be}from"react";import{jsx as Ne}from"react/jsx-runtime";function Oe(e){const n=C(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:f,colorByDepth:b=!1,edgeStyle:S="curve",nodeLabel:w,nodeSize:T=5,tooltip:A,frameProps:I={},onObservation:M,onClick:H,chartId:N,selection:O,linkedHover:D,loading:P,loadingContent:L,legendInteraction:E,stroke:W,strokeWidth:R,opacity:z}=e,{width:F,height:$,enableHover:G,showLabels:Y=!0,title:Z,description:J,summary:U,accessibleTable:X}=n,K=q({nodes:Be(()=>j(i??null,m),[i,m]),edges:void 0,inferNodes:!1,colorBy:b?void 0:u,colorScheme:f,showLegend:!1,legendInteraction:E,selection:O,linkedHover:D,onObservation:M,onClick:H,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"TreeDiagram",chartId:N,marginDefaults:n.marginDefaults,userMargin:r,width:F,height:$,loading:P,loadingContent:L}),Q=Be(()=>new Map,[]),V=Be(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=b?p[(e.depth||0)%p.length]:u?y(e.data||e,u,K.colorScale):k(void 0,K.themeCategorical,f,void 0,Q),t},[u,b,K.colorScale,K.themeCategorical,f,Q]),ee=Be(()=>o(V,{stroke:W,strokeWidth:R,opacity:z}),[V,W,R,z]),te=Be(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),oe=Be(()=>o(te,{stroke:W,strokeWidth:R,opacity:z}),[te,W,R,z]),ne=Be(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return _(h)},[l,h]),ie=t({componentName:"TreeDiagram",data:i});return ie?Ne(x,{componentName:"TreeDiagram",message:ie,width:F,height:$}):K.loadingEl?K.loadingEl:Ne(B,{componentName:"TreeDiagram",width:F,height:$,children:Ne(s,{chartType:l,...null!=i&&{data:i},size:[F,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,nodeIDAccessor:g,childrenAccessor:m,hierarchySum:ne,treeOrientation:d,edgeType:S,nodeStyle:ee,edgeStyle:oe,colorBy:u,colorScheme:K.effectivePalette,colorByDepth:b,nodeSize:T,nodeLabel:Y?w||g:void 0,showLabels:Y,enableHover:G,tooltipContent:!1===A?()=>null:v(A)||void 0,...c({linkedHover:D,selection:O,onObservation:M,onClick:H,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior,linkedHoverInClickPredicate:!1}),...E&&"none"!==E&&{legendHoverBehavior:K.legendState.onLegendHover,legendClickBehavior:K.legendState.onLegendClick,legendHighlightedCategory:K.legendState.highlightedCategory,legendIsolatedCategories:K.legendState.isolatedCategories},className:a,title:Z,description:J,summary:U,accessibleTable:X,...null!=e.animate&&{animate:e.animate},...I})})}Oe.displayName="TreeDiagram";import{useMemo as De,useCallback as Pe}from"react";import{jsx as Le}from"react/jsx-runtime";function Ee(e){const n=C(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:S="leaf",nodeLabel:w,padding:T=4,paddingTop:A,nodeStyle:I,tooltip:M,frameProps:H={},selection:N,linkedHover:O,onObservation:D,onClick:P,chartId:L,loading:E,loadingContent:W,legendInteraction:R,stroke:z,strokeWidth:F,opacity:$}=e,{nodeStyle:G,...Y}=H,{width:Z,height:J,enableHover:U,showLabels:X=!0,title:K,description:Q,summary:V,accessibleTable:ee}=n,te=q({nodes:De(()=>j(i??null,d),[i,d]),edges:void 0,inferNodes:!1,colorBy:b?void 0:g,colorScheme:u,showLegend:!1,legendInteraction:R,selection:N,linkedHover:O,onObservation:D,onClick:P,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"Treemap",chartId:L,marginDefaults:n.marginDefaults,userMargin:a,width:Z,height:J,loading:E,loadingContent:W}),oe=r(N),ne=te.customHoverBehavior,ie=Pe(e=>{if(!e)return ne(null);const t=e.data||e;ne({data:t?.data||t})},[ne]),re=De(()=>new Map,[]),se=De(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=b?p[(e.depth||0)%p.length]:g?y(e.data||e,g,te.colorScale):k(void 0,te.themeCategorical,u,void 0,re),t},[g,b,te.colorScale,te.themeCategorical,u,re]),ae=De(()=>I||G?e=>({...se(e),...G?G(e)??{}:{},...I?I(e)??{}:{}}):se,[se,I,G]),le=De(()=>o(ae,{stroke:z,strokeWidth:F,opacity:$}),[ae,z,F,$]),ce=De(()=>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??f;t.opacity=e,t.fillOpacity=e,t.strokeOpacity=e,oe?.unselectedStyle&&Object.assign(t,oe.unselectedStyle)}return t}:le,[le,te.activeSelectionHook,oe]),de=De(()=>_(m),[m]),me=void 0!==A?A:!X||"parent"!==S&&"all"!==S?void 0:18,he=t({componentName:"Treemap",data:i});return he?Le(x,{componentName:"Treemap",message:he,width:Z,height:J}):te.loadingEl?te.loadingEl:Le(B,{componentName:"Treemap",width:Z,height:J,children:Le(s,{chartType:"treemap",...null!=i&&{data:i},size:[Z,J],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,nodeIDAccessor:h,childrenAccessor:d,hierarchySum:de,padding:T,paddingTop:me,nodeStyle:ce,colorBy:g,colorScheme:te.effectivePalette,colorByDepth:b,nodeLabel:X?w||h:void 0,showLabels:X,labelMode:S,enableHover:U,tooltipContent:!1===M?()=>null:v(M)||void 0,...c({linkedHover:O,selection:N,onObservation:D,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:K,description:Q,summary:V,accessibleTable:ee,...null!=e.animate&&{animate:e.animate},...Y})})}Ee.displayName="Treemap";import{useMemo as We}from"react";import{jsx as Re}from"react/jsx-runtime";function ze(e){const n=C(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:f,circleOpacity:b=.7,padding:S=4,tooltip:w,frameProps:T={},onObservation:A,onClick:I,chartId:M,selection:H,linkedHover:N,loading:O,loadingContent:D,legendInteraction:P,stroke:L,strokeWidth:E,opacity:W}=e,{width:R,height:z,enableHover:F,showLabels:$=!0,title:G,description:Y,summary:Z,accessibleTable:J}=n,U=q({nodes:We(()=>j(i??null,l),[i,l]),edges:void 0,inferNodes:!1,colorBy:u?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:P,selection:H,linkedHover:N,onObservation:A,onClick:I,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"CirclePack",chartId:M,marginDefaults:n.marginDefaults,userMargin:r,width:R,height:z,loading:O,loadingContent:D}),X=We(()=>new Map,[]),K=We(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:b};return t.fill=u?p[(e.depth||0)%p.length]:h?y(e.data||e,h,U.colorScale):k(void 0,U.themeCategorical,g,void 0,X),t},[h,u,U.colorScale,b,U.themeCategorical,g,X]),Q=We(()=>o(K,{stroke:L,strokeWidth:E,opacity:W}),[K,L,E,W]),V=We(()=>_(d),[d]),ee=t({componentName:"CirclePack",data:i});return ee?Re(x,{componentName:"CirclePack",message:ee,width:R,height:z}):U.loadingEl?U.loadingEl:Re(B,{componentName:"CirclePack",width:R,height:z,children:Re(s,{chartType:"circlepack",...null!=i&&{data:i},size:[R,z],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,nodeIDAccessor:m,childrenAccessor:l,hierarchySum:V,padding:S,nodeStyle:Q,colorBy:h,colorScheme:U.effectivePalette,colorByDepth:u,nodeLabel:$?f||m:void 0,showLabels:$,enableHover:F,tooltipContent:!1===w?()=>null:v(w)||void 0,...c({linkedHover:N,selection:H,onObservation:A,onClick:I,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior,linkedHoverInClickPredicate:!1}),...P&&"none"!==P&&{legendHoverBehavior:U.legendState.onLegendHover,legendClickBehavior:U.legendState.onLegendClick,legendHighlightedCategory:U.legendState.highlightedCategory,legendIsolatedCategories:U.legendState.isolatedCategories},className:a,title:G,description:Y,summary:Z,accessibleTable:J,...null!=e.animate&&{animate:e.animate},...T})})}ze.displayName="CirclePack";import{useMemo as Fe}from"react";import{jsx as je}from"react/jsx-runtime";var $e=p;function _e(e){const n=C(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:f=!1,orbitMode:p="flat",orbitSize:b=2.95,speed:S=.25,revolution:w,revolutionStyle:T,eccentricity:A=1,showRings:I=!0,nodeRadius:M=6,showLabels:H=!1,animated:N=!0,tooltip:O,foregroundGraphics:D,annotations:P,frameProps:L={},onObservation:E,onClick:W,chartId:R,selection:z,linkedHover:F,loading:$,loadingContent:_,stroke:G,strokeWidth:Y,opacity:Z}=e,{width:J,height:U,enableHover:X,title:K,description:Q,summary:V,accessibleTable:ee}=n,te=q({nodes:Fe(()=>j(i,l),[i,l]),edges:void 0,inferNodes:!1,colorBy:f?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:J,height:U,loading:$,loadingContent:_}),oe=Fe(()=>new Map,[]),{colorScale:ne,customClickBehavior:ie,customHoverBehavior:re,themeCategorical:se}=te,ae=Fe(()=>{if(Array.isArray(h))return h;const e=g[h];return Array.isArray(e)?e:u},[h]),le=Fe(()=>e=>{const t={stroke:"#fff",strokeWidth:1},o=0===(e.depth??0);return t.fill=f?o?ae[0]:$e[(e.depth||0)%$e.length]:m?y(e.data||e,m,ne):k(void 0,se,h,void 0,oe),t.opacity=o?1:.85,t},[m,f,ne,ae,se,h,oe]),ce=Fe(()=>o(le,{stroke:G,strokeWidth:Y,opacity:Z}),[le,G,Y,Z]),de=Fe(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),me=Fe(()=>e=>{re(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[re]),he=Fe(()=>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?je(x,{componentName:"OrbitDiagram",message:ge,width:J,height:U}):te.loadingEl?te.loadingEl:je(B,{componentName:"OrbitDiagram",width:J,height:U,children:je(s,{chartType:"orbit",...null!=i&&{data:i},size:[J,U],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,nodeIDAccessor:d,childrenAccessor:l,nodeStyle:ce,edgeStyle:de,colorBy:m,colorScheme:te.effectivePalette,colorByDepth:f,nodeSize:M,nodeLabel:H?d:void 0,showLabels:H,enableHover:!N&&X,tooltipContent:N?void 0:!1===O?()=>null:v(O)||void 0,...c({linkedHover:F,selection:z,onObservation:E,onClick:W,mobileInteraction:te.mobileInteraction,customHoverBehavior:me,customClickBehavior:he,linkedHoverInClickPredicate:!1}),foregroundGraphics:D,annotations:P,className:a,title:K,description:Q,summary:V,orbitMode:p,orbitSize:b,orbitSpeed:S,orbitRevolution:w,orbitRevolutionStyle:T,orbitEccentricity:A,orbitShowRings:I,orbitAnimated:N,accessibleTable:ee,...null!=e.animate&&{animate:e.animate},...L})})}_e.displayName="OrbitDiagram";import{forceCenter as Ge,forceCollide as qe,forceLink as Ye,forceManyBody as Ze,forceSimulation as Je,forceX as Ue,forceY as Xe}from"d3-force";function Ke(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 f=500,p=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=Je(p).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",qe(e=>(e=>"function"==typeof c?c(e.data):c)(e)+m).strength(.9).iterations(2)).force("center",Ge(f,f).strength(.8)).force("x",Ue(f).strength(a)).force("y",Xe(f).strength(a));y.length>0&&e.force("link",Ye(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 p){const t=e.x??f,o=e.y??f;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 p)A[e.id]={x:0===C?.5:h+((e.x??f)-v)/C*(1-2*h),y:0===T?.5:h+((e.y??f)-k)/T*(1-2*h)};return A}export{E as NetworkCustomChart,Z as ForceDirectedGraph,Q as ChordDiagram,ne as SankeyDiagram,ie as validateProcessSankey,re as formatProcessSankeyIssue,xe as ProcessSankey,Oe as TreeDiagram,Ee as Treemap,ze as CirclePack,_e as OrbitDiagram,Ke as forceLayout};
@@ -1 +0,0 @@
1
- import{hatchPatternDef as t,isHatchFill as e,resolveResponsiveRules as n,useObservationSelector as r}from"./chunk-chunk-2WVCH4PL.module.min.js";import{SEQUENTIAL_INTERPOLATORS as o,glyphFractionClipRect as i,glyphPlacement as s,resolveGlyphPaint as a,schemeCategory10 as l,schemeSet3 as c,schemeTableau10 as d,symbolPathString as u}from"./chunk-chunk-NO4MCQVD.module.min.js";import{createStore as h}from"./chunk-chunk-DSNGDNJY.module.min.js";var y=Object.freeze([]);function f(t){if(!t)return y;let e=!1;for(let n=0;t.length>n;n++){const r=t[n];if(null==r||"object"!=typeof r){e=!0;break}}if(!e)return t;const n=[];for(const e of t)null!=e&&"object"==typeof e&&n.push(e);return n}var p=/^\d{4}-\d{1,2}$/;function m(t){const e=t.trim();if(!e||!Number.isNaN(Number(e)))return NaN;const n=p.test(e)?e+"-01":e;if(n===e&&10>e.length)return NaN;const r=Date.parse(n);return Number.isFinite(r)?r:NaN}function g(t){return t instanceof Date?t.getTime():"string"==typeof t?m(t):+t}function k(t,e){if(!t||!e)return{data:t,failed:!1};let n=!1,r=!1;const o=t.map(t=>{const o=t[e];if("string"!=typeof o)return t;const i=m(o);return n=!0,Number.isFinite(i)?{...t,[e]:i}:(r=!0,{...t,[e]:NaN})});return{data:n?o:t,failed:r}}var $=22;function x(t){return"string"==typeof t&&t.length>0}function b(t,e,n=!1){const r=n?e?58:34:e?36:0;return r>t.top?{...t,top:r}:t}function v(t,e){return b(t,x(e))}import*as w from"react";import{arc as M}from"d3-shape";function A(t){return(t.tl??0)>0||(t.tr??0)>0||(t.br??0)>0||(t.bl??0)>0}function W(t){const e=t.cornerRadii;if(!e)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(t.w,t.h)/2,r=t=>Math.max(0,Math.min(t??0,n));return{tl:r(e.tl),tr:r(e.tr),br:r(e.br),bl:r(e.bl)}}var L=(t,e)=>({x:t*Math.cos(e),y:t*Math.sin(e)});function P(t){const{innerRadius:e,outerRadius:n,startAngle:r,endAngle:o}=t,i=0>=e;if(0>=(t.cornerRadius??0)||!t.roundStart&&!t.roundEnd){if(i){const t=L(n,r),e=L(n,o);return`M0,0 L${t.x},${t.y} A${n},${n} 0 ${o-r>Math.PI?1:0} 1 ${e.x},${e.y} Z`}const t=L(n,r),s=L(n,o),a=L(e,o),l=L(e,r),c=o-r>Math.PI?1:0;return`M${t.x},${t.y} A${n},${n} 0 ${c} 1 ${s.x},${s.y} L${a.x},${a.y} A${e},${e} 0 ${c} 0 ${l.x},${l.y} Z`}const s=Math.max(0,Math.min(t.cornerRadius??0,(n-e)/2));if(0===s)return P({...t,cornerRadius:0,roundStart:!1,roundEnd:!1});const a=Math.asin(Math.min(1,s/Math.max(1e-9,n-s))),l=i?0:Math.asin(Math.min(1,s/Math.max(1e-9,e+s))),c=o-r,d=t.roundStart&&t.roundEnd?c/2:c,u=!!t.roundStart&&d>a,h=!!t.roundEnd&&d>a;if(!u&&!h)return P({...t,cornerRadius:0,roundStart:!1,roundEnd:!1});const y=r+(u?a:0),f=o-(h?a:0),p=r+(u?l:0),m=o-(h?l:0),g=L(n,y),k=L(n,f),$=(n-s)*Math.cos(a),x=L($,r),b=L($,o),v=i?null:L(e,m),w=i?null:L(e,p),M=i?0:(e+s)*Math.cos(l),A=i?null:L(M,r),W=i?null:L(M,o),S=f-y>Math.PI?1:0,O=i?0:m-p>Math.PI?1:0;let R="";if(u)R+=`M${x.x},${x.y}`,R+=` A${s},${s} 0 0 1 ${g.x},${g.y}`;else{const t=L(n,r);R+=`M${t.x},${t.y}`}if(h)R+=` A${n},${n} 0 ${S} 1 ${k.x},${k.y}`,R+=` A${s},${s} 0 0 1 ${b.x},${b.y}`;else{const t=L(n,o);R+=` A${n},${n} 0 ${S} 1 ${t.x},${t.y}`}if(i)R+=" L0,0";else{if(h)R+=` L${W.x},${W.y}`,R+=` A${s},${s} 0 0 1 ${v.x},${v.y}`;else{const t=L(e,o);R+=` L${t.x},${t.y}`}if(u)R+=` A${e},${e} 0 ${O} 0 ${w.x},${w.y}`,R+=` A${s},${s} 0 0 1 ${A.x},${A.y}`;else{const t=L(e,r);R+=` A${e},${e} 0 ${O} 0 ${t.x},${t.y}`}}return R+=" Z",R}import{jsx as S,jsxs as O}from"react/jsx-runtime";var R={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function T(t,n="#4e79a7"){return e(t)?t.background&&"transparent"!==t.background?t.background:n:t&&"string"==typeof t?t:n}function I(t,e,n){const r=u(t.symbolType,t.size,t.path);return S("path",{d:r,transform:t.rotation?`translate(${t.x},${t.y}) rotate(${180*t.rotation/Math.PI})`:`translate(${t.x},${t.y})`,fill:t.style.fill?T(t.style.fill):"none",opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},`${n??""}symbol-${e}`)}function N(t,e,n,r){const o=t.glyph;if(!o?.parts?.length||0>=t.size)return null;const l=s(o,t.size);if(0>=l.scale)return null;const c=`translate(${e},${n})${t.rotation?` rotate(${180*t.rotation/Math.PI})`:""} translate(${l.offsetX},${l.offsetY}) scale(${l.scale})`,d=t.color??("string"==typeof t.style.fill?t.style.fill:void 0),u=i(o,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal"),h=u?j(r+"-clip"):void 0,y=(t.style.opacity??1)*(t._decayOpacity??1)*(t.style.fillOpacity??1),f=e=>o.parts.map((n,r)=>{const o=e?"none"===n.fill?void 0:e:a(n.fill,d,t.accent),i=e?n.stroke&&"none"!==n.stroke?e:void 0:a(n.stroke??"none",d,t.accent);return o||i?S("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 O("g",{transform:c,opacity:1===y?void 0:y,children:[u&&h&&S("clipPath",{id:h,children:S("rect",{x:u.x,y:u.y,width:u.width,height:u.height})}),u&&t.ghostColor?S("g",{children:f(t.ghostColor)}):null,u&&h?S("g",{clipPath:`url(#${h})`,children:f()}):f()]},r)}function j(t){const e=t.replace(/[^A-Za-z0-9_-]/g,"_");return!e||/^\d/.test(e)?"s_"+e:e}function C(n,r,o){switch(n.type){case"line":{const t=n;if(0===t.path.length)return null;const e="M"+t.path.map(([t,e])=>`${t},${e}`).join("L");return S("path",{d:e,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||2,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity},"line-"+r)}case"area":{const i=n;if(0===i.topPath.length)return null;const s=`M${i.topPath.map(([t,e])=>`${t},${e}`).join("L")}L${[...i.bottomPath].reverse().map(([t,e])=>`${t},${e}`).join("L")}Z`,a=`${o?o+"-":""}area-${r}-hatch`,l=e(i.style.fill)?t(i.style.fill,a):void 0,c=l?`url(#${a})`:T(i.style.fill);if(i.clipRect){const t=`${o?o+"-":""}area-clip-${r}`;return O("g",{children:[O("defs",{children:[l,S("clipPath",{id:t,children:S("rect",{x:i.clipRect.x,y:i.clipRect.y,width:i.clipRect.width,height:i.clipRect.height})})]}),S("path",{d:s,fill:c,fillOpacity:i.style.fillOpacity??i.style.opacity??.7,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth,clipPath:`url(#${t})`})]},"area-"+r)}return O(w.Fragment,{children:[l&&S("defs",{children:l}),S("path",{d:s,fill:c,fillOpacity:i.style.fillOpacity??i.style.opacity??.7,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},"area-"+r)}case"point":{const i=n,s=`${o?o+"-":""}point-${r}-hatch`,a=e(i.style.fill)?t(i.style.fill,s):void 0;return O(w.Fragment,{children:[a&&S("defs",{children:a}),S("circle",{cx:i.x,cy:i.y,r:i.r,fill:a?`url(#${s})`:T(i.style.fill),opacity:i.style.opacity??.8,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},"point-"+r)}case"symbol":return I(n,r);case"glyph":return N(n,n.x,n.y,`${o??""}glyph-${n.pointId??r}`);case"rect":{const i=n,s=`${o?o+"-":""}xyrect-${r}-hatch`,a=e(i.style.fill)?t(i.style.fill,s):void 0;return O(w.Fragment,{children:[a&&S("defs",{children:a}),S("rect",{x:i.x,y:i.y,width:i.w,height:i.h,fill:a?`url(#${s})`:T(i.style.fill),opacity:i.style.opacity,stroke:i.style.stroke,strokeWidth:i.style.strokeWidth})]},"rect-"+r)}case"heatcell":{const t=n;if(t.showValues&&null!=t.value&&t.w>=20&&t.h>=20){const e=t.valueFormat?t.valueFormat(t.value):Number.isInteger(t.value)?t.value+"":100>Math.abs(t.value)?1>Math.abs(t.value)?t.value.toPrecision(3):t.value.toFixed(1):t.value.toFixed(0),[n,o,i]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16)]}const e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(t.fill),s=.299*n+.587*o+.114*i>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h)));return O("g",{children:[S("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.fill}),S("text",{x:t.x+t.w/2,y:t.y+t.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:a+"px",children:e})]},"heatcell-"+r)}return S("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.fill},"heatcell-"+r)}case"candlestick":{const t=n,e=Math.min(t.openY,t.closeY),o=Math.max(Math.abs(t.openY-t.closeY),1),i=t.isUp?t.upColor:t.downColor;return O("g",{children:[S("line",{x1:t.x,y1:t.highY,x2:t.x,y2:t.lowY,stroke:t.wickColor,strokeWidth:t.wickWidth}),S("rect",{x:t.x-t.bodyWidth/2,y:e,width:t.bodyWidth,height:o,fill:i,stroke:i,strokeWidth:1})]},"candle-"+r)}default:return null}}function D(n,r){switch(n.type){case"circle":{const o=n,i=e(o.style.fill)?t(o.style.fill,`net-circle-${r}-hatch`):void 0;return O(w.Fragment,{children:[i&&S("defs",{children:i}),S("circle",{cx:o.cx,cy:o.cy,r:o.r,fill:i?`url(#net-circle-${r}-hatch)`:T(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-circle-"+r)}case"rect":{const o=n,i=e(o.style.fill)?t(o.style.fill,`net-rect-${r}-hatch`):void 0;return O(w.Fragment,{children:[i&&S("defs",{children:i}),S("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:i?`url(#net-rect-${r}-hatch)`:T(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-rect-"+r)}case"arc":{const o=n,i=M().innerRadius(o.innerR).outerRadius(o.outerR).startAngle(o.startAngle+Math.PI/2).endAngle(o.endAngle+Math.PI/2)(R)||"",s=e(o.style.fill)?t(o.style.fill,`net-arc-${r}-hatch`):void 0;return O(w.Fragment,{children:[s&&S("defs",{children:s}),S("path",{d:i,transform:`translate(${o.cx},${o.cy})`,fill:s?`url(#net-arc-${r}-hatch)`:T(o.style.fill),stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,opacity:o.style.opacity})]},"net-arc-"+r)}case"symbol":{const t=n,e=u(t.symbolType,t.size,t.path);return S("path",{d:e,transform:t.rotation?`translate(${t.cx},${t.cy}) rotate(${180*t.rotation/Math.PI})`:`translate(${t.cx},${t.cy})`,fill:t.style.fill?T(t.style.fill):"none",stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity},"net-symbol-"+r)}case"glyph":return N(n,n.cx,n.cy,"net-glyph-"+(n.id??r));default:return null}}function F(t,e){switch(t.type){case"line":return S("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:t.style.stroke||"#999",strokeWidth:t.style.strokeWidth||1,opacity:t.style.opacity},"net-edge-"+e);case"bezier":{const n=t;return S("path",{d:n.pathD,fill:T(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+e)}case"ribbon":{const n=t;return S("path",{d:n.pathD,fill:T(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+e)}case"curved":{const n=t;return S("path",{d:n.pathD,fill:T(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+e)}default:return null}}function q(t,e){return S("text",{x:t.x,y:t.y,textAnchor:t.anchor||"middle",dominantBaseline:t.baseline||"auto",fontSize:t.fontSize||11,fontWeight:t.fontWeight,fill:t.fill||"var(--semiotic-text, #333)",stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:t.paintOrder,children:t.text},"net-label-"+e)}function z(n,r,o){const i=("category"in n?n.category:void 0)||("group"in n?n.group:void 0)||"",s=t=>`ord-${n.type}-${i}-${r}-${t}`,a=`ord-${n.type}-${i}-${r}`;switch(n.type){case"rect":{const r=n,o=j(a)+"-grad",i=function(t,e){const n=t.fillGradient;if(!n||"object"!=typeof n)return null;let r=t.x,o=t.y,i=t.x,s=t.y+t.h;"bottom"===t.roundedEdge?(o=t.y+t.h,s=t.y):"right"===t.roundedEdge?(r=t.x+t.w,o=t.y,i=t.x,s=t.y):"left"===t.roundedEdge&&(r=t.x,o=t.y,i=t.x+t.w,s=t.y);const a=[];if("colorStops"in n){const t=n.colorStops.filter(t=>Number.isFinite(t.offset)).map(t=>({offset:Math.max(0,Math.min(1,t.offset)),color:t.color}));if(2>t.length)return null;for(let e=0;t.length>e;e++)a.push(S("stop",{offset:t[e].offset,stopColor:t[e].color},e))}else{const e=T(t.style.fill);a.push(S("stop",{offset:0,stopColor:e,stopOpacity:n.topOpacity},"0")),a.push(S("stop",{offset:1,stopColor:e,stopOpacity:n.bottomOpacity},"1"))}return S("linearGradient",{id:e,gradientUnits:"userSpaceOnUse",x1:r,y1:o,x2:i,y2:s,children:a})}(r,o);let s,l;if(i)l=`url(#${o})`;else if(e(r.style.fill)){const e=j(a)+"-hatch";s=t(r.style.fill,e),l=`url(#${e})`}else l=T(r.style.fill);const c=i||s?O("defs",{children:[i,s]}):null;if(r.cornerRadii&&A(r.cornerRadii)){const t=function(t){const{x:e,y:n,w:r,h:o}=t,{tl:i,tr:s,br:a,bl:l}=W(t);let c=`M${e+i},${n}`;return c+=` L${e+r-s},${n}`,s>0&&(c+=` A${s},${s} 0 0 1 ${e+r},${n+s}`),c+=` L${e+r},${n+o-a}`,a>0&&(c+=` A${a},${a} 0 0 1 ${e+r-a},${n+o}`),c+=` L${e+l},${n+o}`,l>0&&(c+=` A${l},${l} 0 0 1 ${e},${n+o-l}`),c+=` L${e},${n+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${e+i},${n}`),c+=" Z",c}(r);return O(w.Fragment,{children:[c,S("path",{d:t,fill:l,opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},a)}if(r.roundedTop&&r.roundedTop>0){const t=Math.min(r.roundedTop,r.w/2,r.h/2),{x:e,y:n,w:o,h:i}=r;let s;switch(r.roundedEdge){case"right":s=`M${e},${n} L${e+o-t},${n} A${t},${t} 0 0 1 ${e+o},${n+t} L${e+o},${n+i-t} A${t},${t} 0 0 1 ${e+o-t},${n+i} L${e},${n+i} Z`;break;case"left":s=`M${e+o},${n} L${e+t},${n} A${t},${t} 0 0 0 ${e},${n+t} L${e},${n+i-t} A${t},${t} 0 0 0 ${e+t},${n+i} L${e+o},${n+i} Z`;break;case"bottom":s=`M${e},${n} L${e+o},${n} L${e+o},${n+i-t} A${t},${t} 0 0 1 ${e+o-t},${n+i} L${e+t},${n+i} A${t},${t} 0 0 1 ${e},${n+i-t} Z`;break;default:s=`M${e},${n+i} L${e},${n+t} A${t},${t} 0 0 1 ${e+t},${n} L${e+o-t},${n} A${t},${t} 0 0 1 ${e+o},${n+t} L${e+o},${n+i} Z`}return O(w.Fragment,{children:[c,S("path",{d:s,fill:l,opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},a)}return O(w.Fragment,{children:[c,S("rect",{x:r.x,y:r.y,width:r.w,height:r.h,fill:l,opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},a)}case"point":{const t=n;return S("circle",{cx:t.x,cy:t.y,r:t.r,fill:T(t.style.fill),opacity:t.style.opacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},a)}case"symbol":return I(n,r,o);case"glyph":return N(n,n.x,n.y,`${o??""}ord-glyph-${n.pointId??r}`);case"wedge":{const t=n;if(t._gradientBand&&t._gradientBand.colors.length>0){const e=j(`${o?o+"-":""}gauge-grad-${t.category||a}-${r}`),{clipPath:n,slices:i}=function(t){const e=P({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundStart,roundEnd:t.roundEnd}),n=[],r=t.colors;if(r.length>0){const e=(t.endAngle-t.startAngle)/r.length;for(let o=0;r.length>o;o++)n.push({d:P({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle+o*e,endAngle:t.endAngle}),color:r[o]})}return{clipPath:e,slices:n}}({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds?.start??!0,roundEnd:t.roundedEnds?.end??!0,colors:t._gradientBand.colors});return O("g",{transform:`translate(${t.cx},${t.cy})`,opacity:t.style.opacity,fillOpacity:t.style.fillOpacity,children:[S("defs",{children:S("clipPath",{id:e,children:S("path",{d:n})})}),S("g",{clipPath:`url(#${e})`,children:i.map((t,e)=>S("path",{d:t.d,fill:T(t.color)},e))}),t.style.stroke&&"none"!==t.style.stroke&&S("path",{d:n,fill:"none",stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},a)}let e;if(t.roundedEnds)e=P({innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,cornerRadius:t.cornerRadius,roundStart:t.roundedEnds.start,roundEnd:t.roundedEnds.end});else{const n=M().innerRadius(t.innerRadius).outerRadius(t.outerRadius).startAngle(t.startAngle+Math.PI/2).endAngle(t.endAngle+Math.PI/2);t.cornerRadius&&n.cornerRadius(t.cornerRadius),e=n(R)||""}return S("path",{d:e,transform:`translate(${t.cx},${t.cy})`,fill:T(t.style.fill),stroke:t.style.stroke,strokeWidth:t.style.strokeWidth,opacity:t.style.opacity},a)}case"boxplot":{const t=n,e=t.columnWidth/2;return O("g","vertical"===t.projection?{children:[S("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),S("rect",{x:t.x-e,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:T(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),S("line",{x1:t.x-e,y1:t.medianPos,x2:t.x+e,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),S("line",{x1:t.x-.5*e,y1:t.minPos,x2:t.x+.5*e,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),S("line",{x1:t.x-.5*e,y1:t.maxPos,x2:t.x+.5*e,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[S("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),S("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-e,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:T(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),S("line",{x1:t.medianPos,y1:t.y-e,x2:t.medianPos,y2:t.y+e,stroke:t.style.stroke||"#333",strokeWidth:2}),S("line",{x1:t.minPos,y1:t.y-.5*e,x2:t.minPos,y2:t.y+.5*e,stroke:t.style.stroke||"#333",strokeWidth:1}),S("line",{x1:t.maxPos,y1:t.y-.5*e,x2:t.maxPos,y2:t.y+.5*e,stroke:t.style.stroke||"#333",strokeWidth:1})]},a)}case"violin":{const t=n,e=[S("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:T(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},s("path"))];if(t.iqrLine&&t.bounds){const n=t.bounds,r=n.x+n.width/2,o=n.y+n.height/2;n.height>n.width?e.push(S("line",{x1:r,y1:t.iqrLine.q1Pos,x2:r,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},s("iqr")),S("circle",{cx:r,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},s("med"))):e.push(S("line",{x1:t.iqrLine.q1Pos,y1:o,x2:t.iqrLine.q3Pos,y2:o,stroke:t.style.stroke||"#333",strokeWidth:2},s("iqr")),S("circle",{cx:t.iqrLine.medianPos,cy:o,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},s("med")))}return S("g",{children:e},a)}case"connector":return S("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},a);case"trapezoid":{const t=n,e=t.points.map(t=>`${t[0]},${t[1]}`).join(" ");return S("polygon",{points:e,fill:T(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},a)}default:return null}}function H(n,r){switch(n.type){case"geoarea":{const o=n;if(!o.pathData)return null;const i=e(o.style.fill)?t(o.style.fill,`geoarea-${r}-hatch`):void 0;return O(w.Fragment,{children:[i&&S("defs",{children:i}),S("path",{d:o.pathData,fill:i?`url(#geoarea-${r}-hatch)`:T(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=e(o.style.fill)?t(o.style.fill,`geopoint-${r}-hatch`):void 0;return O(w.Fragment,{children:[i&&S("defs",{children:i}),S("circle",{cx:o.x,cy:o.y,r:o.r,fill:i?`url(#geopoint-${r}-hatch)`:T(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 t=n;if(2>t.path.length)return null;const e="M"+t.path.map(t=>`${t[0]},${t[1]}`).join("L");return S("path",{d:e,fill:"none",stroke:t.style.stroke||"#4e79a7",strokeWidth:t.style.strokeWidth||1.5,strokeDasharray:t.style.strokeDasharray,opacity:t.style.opacity??1},"line-"+r)}case"glyph":return N(n,n.x,n.y,"geo-glyph-"+(n.pointId??r));default:return null}}var E="undefined"==typeof window||"undefined"==typeof document;function B(t){return"touch"===t?"touch":"pointer"}function _(t){const e=t.target;return e instanceof Element&&e!==t.currentTarget&&null!=e.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function G(t){const{onObservation:e,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=t;e&&(n?(e({type:"hover",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&e({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):e({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function V(t){const{onObservation:e,datum:n,x:r=0,y:o=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=t;e&&(n?(e({type:"click",datum:n,x:r,y:o,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&e({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):e({type:"click-end",timestamp:l,chartType:i,chartId:s}))}import{useId as Z,useMemo as Y,useCallback as U}from"react";function X(t){const e=[];for(const[n,r]of Object.entries(t.fields))if("point"===r.type)e.push(t=>r.values.has(t[n]));else{const[t,o]=r.range;e.push(e=>{const r=e[n];return r>=t&&o>=r})}return t=>e.every(e=>e(t))}function Q(t,e){let n=t.get(e);return n||(n={name:e,resolution:"union",clauses:new Map},t.set(e,n)),n}function J(t,e){if(t.type!==e.type)return!1;if("interval"===t.type&&"interval"===e.type)return t.range[0]===e.range[0]&&t.range[1]===e.range[1];if("point"===t.type&&"point"===e.type){if(t.values.size!==e.values.size)return!1;for(const n of t.values)if(!e.values.has(n))return!1;return!0}return!1}var[K,tt]=h(t=>({selections:new Map,setClause(e,n){t(t=>{const r=t.selections.get(e),o=r?.clauses.get(n.clientId);if(o&&function(t,e){if(t.clientId!==e.clientId||t.type!==e.type)return!1;const n=Object.entries(t.fields);if(n.length!==function(t){let e=0;for(const n in t)e++;return e}(e.fields))return!1;for(const[t,r]of n){const n=e.fields[t];if(!n||!J(r,n))return!1}return!0}(o,n))return{};const i=new Map(t.selections),s=Q(i,e),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(e,{...s,clauses:a}),{selections:i}})},clearClause(e,n){t(t=>{const r=t.selections.get(e);if(!r||!r.clauses.has(n))return{};const o=new Map(t.selections),i=new Map(r.clauses);return i.delete(n),o.set(e,{...r,clauses:i}),{selections:o}})},setResolution(e,n){t(t=>{const r=t.selections.get(e);if(r?.resolution===n)return{};const o=new Map(t.selections),i=Q(o,e);return o.set(e,{...i,resolution:n}),{selections:o}})},clearSelection(e){t(t=>{const n=t.selections.get(e);if(!n||0===n.clauses.size)return{};const r=new Map(t.selections);return r.set(e,{...n,clauses:new Map}),{selections:r}})}}));import{useSyncExternalStore as et}from"react";var nt={positions:new Map},rt=new Set;function ot(){for(const t of rt)t()}function it(t,e){const n=nt.positions.get(t);if(n?.locked)return;if(!n||n.sourceId!==e)return;const r=new Map(nt.positions);r.delete(t),nt={positions:r},ot()}function st(t,e){const n=nt.positions.get(t);if(!n?.locked)return;if(e&&n.sourceId!==e)return;const r=new Map(nt.positions);r.delete(t),nt={positions:r},ot()}function at(){return nt}function lt(t){return rt.add(t),()=>rt.delete(t)}var ct={positions:new Map};function dt(){return()=>{}}function ut(){return ct}function ht(t){const e=et(t?lt:dt,t?at:ut,t?at:ut);return t?e.positions.get(t)??null:null}function yt(t){const e=Z(),n=t.clientId||e,{name:r}=t,o=tt(t=>t.selections.get(r)),i=tt(t=>t.setClause),s=tt(t=>t.clearClause),a=Y(()=>!!o&&o.clauses.size>0,[o]);return{predicate:Y(()=>o&&0!==o.clauses.size?function(t,e){const n=[];for(const[r,o]of t.clauses)"crossfilter"===t.resolution&&r===e||n.push(X(o));return 0===n.length?()=>!0:"intersect"===t.resolution?t=>n.every(e=>e(t)):t=>n.some(e=>e(t))}(o,n):()=>!0,[o,n]),isActive:a,selectPoints:U(t=>{const e={};let o=!1;for(const[n,r]of Object.entries(t))e[n]={type:"point",values:new Set(r)},o=!0;o&&i(r,{clientId:n,type:"point",fields:e})},[n,r,i]),selectInterval:U(t=>{const e={};let o=!1;for(const[n,r]of Object.entries(t))e[n]={type:"interval",range:r},o=!0;o&&i(r,{clientId:n,type:"interval",fields:e})},[n,r,i]),clear:U(()=>{s(r,n)},[s,r,n]),clientId:n}}function ft(t){return 2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]}function pt(t){const{name:e,xField:n,yField:r}=t,{predicate:o,isActive:i,selectInterval:s,clear:a}=yt({name:e,fields:[n,r].filter(Boolean)}),l=n&&r?"xyBrush":n?"xBrush":"yBrush",c=U(t=>{if(!t)return void a();const e={};"xyBrush"===l&&function(t){return 2===t.length&&Array.isArray(t[0])&&2===t[0].length&&Array.isArray(t[1])&&2===t[1].length}(t)?(n&&(e[n]=[Math.min(t[0][0],t[1][0]),Math.max(t[0][0],t[1][0])]),r&&(e[r]=[Math.min(t[0][1],t[1][1]),Math.max(t[0][1],t[1][1])])):"xBrush"===l&&ft(t)?n&&(e[n]=[Math.min(t[0],t[1]),Math.max(t[0],t[1])]):"yBrush"===l&&ft(t)&&r&&(e[r]=[Math.min(t[0],t[1]),Math.max(t[0],t[1])]),mt(e)&&s(e)},[l,n,r,s,a]);return{brushInteraction:Y(()=>({brush:l,during:c,end:c}),[l,c]),predicate:o,isActive:i,clear:a}}function mt(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}function gt(t){return t?"string"==typeof t?{name:t}:t:null}import{useMemo as kt,useCallback as $t,useState as xt,useId as bt,useEffect as vt,useRef as wt}from"react";import{scaleOrdinal as Mt}from"d3-scale";var At={category10:l,tableau10:d,set3:c,...o},Wt=l,Lt=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Pt=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 St(t,e,n){if("function"==typeof e){const r=e(t);return n&&r&&"string"==typeof r&&!function(t){const e=t.toLowerCase();return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")||Pt.has(e)}(r)?n(r):r}const r=t?.[e]+"";return n?n(r):Wt[Math.abs(function(t){let e=0;for(let n=0;t.length>n;n++)e=(e<<5)-e+t.charCodeAt(n),e&=e;return Math.abs(e)}(r))%Wt.length]}function Ot(t,e){if(null==e||!Object.prototype.hasOwnProperty.call(t,e))return;const n=t[e];return"string"==typeof n&&n.length>0?n:void 0}function Rt(t,e,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const t=n;return e=>Ot(t,e)??"#999"}const r=Array.from(new Set(t.map(t=>t?.[e]).filter(t=>null!=t).map(t=>t+""))),o=r.every(t=>!isNaN(Number(t)));if(Array.isArray(n))return Mt().domain(r).range(n).unknown("#999");const i=At[n]||At.category10;if(o&&"function"==typeof i){let t=-1/0;for(const e of r){const n=Number(e);n>t&&(t=n)}return e=>i(Number(e)/t)}{const t=Array.isArray(i)?i:Wt;return Mt().domain(r).range(t).unknown("#999")}}function Tt(t,e,n=[3,20],r){let o;if(o="function"==typeof e?e(t):t?.[e],!r)return o;const[i,s]=r,[a,l]=n;if(s===i)return(a+l)/2;let c=(o-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function It(t,e,n){const r=t.xValue??e?.[n];if(null==r)return null;const o=Number(r);return Number.isFinite(o)?o:null}function Nt(t){let e=t.data||t.datum||t;return Array.isArray(e)&&(e=e[0]),null!=t.xValue&&e&&"object"==typeof e&&!Array.isArray(e)&&null==e.xValue?{...e,xValue:t.xValue}:e||{}}var jt="#007bff",Ct=[],Dt={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function Ft(t,e={}){const n=e.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof e.mobileSemantics?.minimumHitTarget?e.mobileSemantics.minimumHitTarget:void 0,o="mobile"===e.mode||"number"==typeof e.width&&480>=e.width,i=!!n||void 0!==r,s=t&&"object"==typeof t?t:void 0;if(!1===t||!1===s?.enabled||void 0===t&&!o&&!i)return Dt;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??r??44,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??44,standardControls:a.standardControls??!1}}function qt({selection:t,linkedHover:e,fallbackFields:n=Ct,unwrapData:o=!1,onObservation:i,chartType:s,chartId:a,onClick:l,hoverHighlight:c,colorByField:d,mobileInteraction:u}){const h=bt(),y=kt(()=>function(t,e){return t?!0===t?{name:"hover",fields:e||[]}:"string"==typeof t?{name:t,fields:e||[]}:{name:t.name||"hover",fields:t.fields||e||[],mode:t.mode,xField:t.xField,seriesField:t.seriesField}:null}(e,n),[e,n]),f=kt(()=>"series"===y?.mode?[y.seriesField||d||n[0]].filter(t=>!!t):y?.fields||n,[y,d,n]),p=yt({name:t?.name||"__unused__",fields:f}),m=function(t){const e=t.name||"hover",{fields:n}=t,{predicate:r,isActive:o,selectPoints:i,clear:s}=yt({name:e,fields:n});return{onHover:U(t=>{if(!t)return void s();const e={};for(const r of n){const n=t[r];void 0!==n&&(e[r]=[n])}mt(e)&&i(e)},[n,i,s]),predicate:r,isActive:o}}({name:y?.name||"hover",fields:f}),g=r(t=>t.pushObservation),k=$t(t=>{i?.(t),g?.(t)},[i,g]),$=t?{isActive:p.isActive,predicate:p.predicate}:null,[x,b]=xt(null),v=wt(!1),w=d||n[0],M=kt(()=>{if(!c||null==x||!w)return null;const t=x,e=w;return{isActive:!0,predicate:n=>("string"==typeof n[e]?n[e]:(n[e]??"")+"")===t}},[c,x,w]),A=$t((t,n)=>{const r=!t&&v.current&&!!u?.enabled&&u.tapToLockTooltip;if(e)if(t){let e=t.data||t.datum||t;if(Array.isArray(e)&&(e=e[0]),"x-position"===y?.mode&&y.xField){const n=It(t,e,y.xField);null!=n&&function(t,e,n){const r=nt.positions.get(t);r?.locked||r&&r.xValue===e&&r.sourceId===n||(nt={positions:new Map(nt.positions).set(t,{xValue:e,sourceId:n})},ot())}(y.name||"hover",n,h)}"x-position"!==y?.mode&&m.onHover(e)}else"x-position"!==y?.mode||r||it(y.name||"hover",h),"x-position"===y?.mode||r||m.onHover(null);if(c&&w)if(t){let e=t.data||t.datum||t;Array.isArray(e)&&(e=e[0]);const n=e?.[w];b(null!=n?n+"":null)}else r||b(null);(i||g)&&G({onObservation:k,datum:t?Nt(t):null,x:t?.x,y:t?.y,chartType:s||"unknown",chartId:a,context:n})},[e,m,y,h,i,s,a,g,k,c,w,u]),W=$t((n=!0)=>{v.current=!1,e&&"x-position"!==y?.mode&&m.onHover(null),t&&u?.tapToSelect&&p.clear(),n&&c&&b(null),"x-position"===y?.mode&&(st(y.name||"hover",h),it(y.name||"hover",h))},[e,y,m,t,u,p,c,h]),L=$t((n,r)=>{const o=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),d=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===y?.mode&&y.xField&&n){let t=n.data||n.datum||n;Array.isArray(t)&&(t=t[0]);const e=It(n,t,y.xField);null!=e&&function(t,e,n){const r=nt.positions.get(t);if(r?.locked){const e=new Map(nt.positions);return e.delete(t),nt={positions:e},ot(),!1}nt={positions:new Map(nt.positions).set(t,{xValue:e,sourceId:n,locked:!0})},ot()}(y.name||"hover",e,h)}if(o)if(n){v.current=!0;const r=Nt(n);if(e&&"x-position"!==y?.mode&&m.onHover(r),t&&u?.tapToSelect&&f.length>0){const t={};for(const e of f){const n=r[e];void 0!==n&&(t[e]=[n])}(function(t){if(!t)return!1;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1})(t)&&p.selectPoints(t)}if(c&&w){const t=r?.[w];b(null!=t?t+"":null)}}else d&&W();if(n||d){if(n&&l){let t=n.data||n.datum||n;Array.isArray(t)&&(t=t[0]),l(t,{x:n.x??0,y:n.y??0})}(i||g)&&V({onObservation:k,datum:n?Nt(n):null,x:n?.x,y:n?.y,chartType:s||"unknown",chartId:a,context:r})}},[l,i,g,k,s,a,y,h,u,e,m,t,p,f,c,w,W]);return vt(()=>{if(!u?.enabled||"undefined"==typeof document)return;const t=t=>{"Escape"===t.key&&v.current&&W()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[u?.enabled,W]),vt(()=>()=>{v.current&&W(!1)},[W]),vt(()=>{if("x-position"!==y?.mode)return;const t=y.name||"hover";return()=>{st(t,h),it(t,h)}},[y?.mode,y?.name,h]),{activeSelectionHook:$,hoverSelectionHook:M,customHoverBehavior:A,customClickBehavior:L,crosshairSourceId:h}}var zt={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 Ht(t,e,r){const o=zt[t||"primary"],i=t&&"primary"!==t||!r?.width?o.width:r.width,s=t&&"primary"!==t||!r?.height?o.height:r.height,a={...e,mode:t},l=n(a,{width:e.width??i,height:e.height??s}).props,c=l.mode||t,d=zt[c||"primary"],u="context"===c||"sparkline"===c,h=c&&"primary"!==c||!r?.width?d.width:r.width;return{width:l.width??h,height:l.height??(c&&"primary"!==c||!r?.height?d.height:r.height),showAxes:l.showAxes??d.showAxes,showGrid:l.showGrid??d.showGrid,enableHover:l.enableHover??(!!l.linkedHover||d.enableHover),showLegend:l.showLegend??d.showLegend,showLabels:l.showLabels??d.showLabels,title:u?void 0:l.title,description:l.description,summary:l.summary,accessibleTable:l.accessibleTable,xLabel:u?void 0:l.xLabel,yLabel:u?void 0:l.yLabel,categoryLabel:u?void 0:l.categoryLabel,valueLabel:u?void 0:l.valueLabel,marginDefaults:Et(d.marginDefaults,l.showCategoryTicks,l.orientation),compactMode:u,mobileInteraction:Ft(l.mobileInteraction,{mode:c,width:l.width??h,mobileSemantics:l.mobileSemantics}),mobileSemantics:l.mobileSemantics}}function Et(t,e,n){if(!1!==e)return t;const r={...t};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}function Bt(t,e="ease-out-cubic"){return"linear"===e?t:1-Math.pow(1-t,3)}function _t(t,e){return Math.min((t-e.startTime)/e.duration,1)}function Gt(t,e,n){return t+(e-t)*n}function Vt(){return"undefined"!=typeof performance?performance.now():Date.now()}function Zt(t,e){if(!1===t)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:t?!0===t?{duration:300}:{duration:t.duration??300,easing:"linear"===t.easing?"linear":"ease-out"}:e,introEnabled:!(n||!t||!0!==t&&!1===t.intro)}}function Yt(t){return"object"==typeof t&&null!==t&&"legendGroups"in t}function Ut(t){return"object"==typeof t&&null!==t&&"gradient"in t}import{jsx as Xt}from"react/jsx-runtime";var Qt={secondary:0,primary:3},Jt=".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 Kt(t){return!0===t?._annotationDeferred}function te(t){return"blended"===t?.cohesion||"layer"===t?.cohesion?t.cohesion:null}function ee(t){const e=t?.provenance?.confidence;return"number"==typeof e&&Number.isFinite(e)?Math.max(0,Math.min(1,e)):null}function ne(t){return Math.max(.72,.95-.06*t)}function re(t){const e=t.map((t,e)=>{return{p:t,i:e,emphasis:(n=t.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:ee(t.annotation),readingOrder:null,rank:1};var n}),n=e.some(t=>null!=t.emphasis||null!=t.confidence),r=t.some(t=>Kt(t.annotation)),o=t.some(t=>null!=te(t.annotation)),i=t.some(t=>"layer"===te(t.annotation));if(!n&&!r&&!o)return t.map(t=>t.node);const s=e.filter(t=>null==t.emphasis&&null!=t.confidence).slice().sort((t,e)=>(e.confidence??0)-(t.confidence??0)||t.i-e.i);s.forEach((t,e)=>{t.readingOrder=e,t.rank=2-e/Math.max(1,s.length)});for(const t of e)t.emphasis&&(t.rank=Qt[t.emphasis]);const a=e.sort((t,e)=>t.rank-e.rank||t.i-e.i).map(t=>{const{p:e,i:n,emphasis:r,readingOrder:o}=t,i=Kt(e.annotation);let s=e.node;if("primary"===r||"secondary"===r||null!=o){const t=null==r&&null!=o;s=Xt("g",{className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...t?{opacity:ne(o),"data-annotation-reading-order":o}:{},children:e.node},"annotation-emphasis-"+n)}const a=te(e.annotation);return a&&(s=Xt("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=Xt("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return r&&a.unshift(Xt("style",{children:Jt},"annotation-disclosure-style")),i&&a.unshift(Xt("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")),a}function oe(t,e,n){if(t&&"object"==typeof t&&!Array.isArray(t)){const e=Object.values(t).filter(t=>"string"==typeof t&&t.length>0);if(e.length>0)return e}if(Array.isArray(t)&&t.length>0)return t;if("string"==typeof t){const e=At[t];if(Array.isArray(e)&&e.length>0)return e}return e&&e.length>0?e:n}function ie(t,e){const n=e&&"object"==typeof e&&!Array.isArray(e)?e:void 0;return 0===t.length?t=>n&&Ot(n,t)||"#4e79a7":e=>{if(n){const t=Ot(n,e);if(t)return t}let r=0;for(let t=0;e.length>t;t++)r=31*r+e.charCodeAt(t)|0;return t[Math.abs(r)%t.length]??"#4e79a7"}}import{jsx as se,jsxs as ae}from"react/jsx-runtime";function le(t,e=120,n=8){if(!t)return[];const r=Math.max(1,Math.floor(e/n)),o=t.split(/\s+/),i=[];let s="";for(const t of o)s&&s.length+1+t.length>r?(i.push(s),s=t):s=s?`${s} ${t}`:t;return s&&i.push(s),i}function ce(t,e,n,r){return"curly"===t?r?`M0,0 C${.6*n},0 ${.4*n},${e/2} ${n},${e/2} C${.4*n},${e/2} ${.6*n},${e} 0,${e}`:`M0,0 C0,${.6*n} ${e/2},${.4*n} ${e/2},${n} C${e/2},${.4*n} ${e},${.6*n} ${e},0`:r?`M0,0 L${n},0 L${n},${e} L0,${e}`:`M0,0 L0,${n} L${e},${n} L${e},0`}function de(t,e,n,r){if(!t)return se("g",{className:"annotation-note"});const{label:o,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=t;if(!o&&!i)return se("g",{className:"annotation-note"});let d=s;d||(d=Math.abs(e)>Math.abs(n)?"leftRight":"topBottom");let u=a;u&&"dynamic"!==u||(u="topBottom"===d?0>e?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===d?"right"===u?h="end":"middle"===u&&(h="middle"):h=0>e?"end":"start";const y=16,f=i?c?[i]:le(i,l):[],p=o?c?[o]:le(o,l):[],m="leftRight"===d?"end"===h?-4:4:0;let g=0;const k=[],$=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";t.useHTML||t.html?k.push(se("foreignObject",{className:"annotation-note-html",x:"end"===h?m-l:"middle"===h?m-l/2:m,y:-16,width:l,height:Math.max(y,(f.length+p.length)*y+(i&&o?2:0))+y,style:{overflow:"visible"},children:ae("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:$,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&se("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&se("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(f.length>0&&(k.push(se("text",{className:"annotation-note-title",fill:$,textAnchor:h,fontWeight:"bold",children:f.map((t,e)=>se("tspan",{x:m,dy:0===e?0:y,children:t},e))},"annotation-note-title")),g=f.length*y),p.length>0&&k.push(se("text",{className:"annotation-note-label",fill:$,textAnchor:h,y:g,children:p.map((t,e)=>se("tspan",{x:m,dy:0===e?0:y,children:t},e))},"annotation-note-label")));let x=null;if((i||o)&&(0!==e||0!==n))if("topBottom"===d){const t=Math.min(l,120);let e=0,n=t;"end"===h?(e=-t,n=0):"middle"===h&&(e=-t/2,n=t/2),x=se("line",{className:"note-line",x1:e,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(f.length+p.length)*y+(p.length>0?y:0);let e=0,n=t;"bottom"===u?(e=-t,n=0):"middle"===u&&(e=-t/2,n=t/2),x=se("line",{className:"note-line",x1:0,x2:0,y1:e,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const b=Math.max(0,f.length+p.length-1)*y;let v=0;return"topBottom"===d?v=0>n?-(b+2):18:"leftRight"===d&&(v="middle"===u?-(b+y+(p.length>0&&f.length>0?2:0))/2+8:"bottom"===u||0>n?-(b+2):18),ae("g",{className:"annotation-note",transform:`translate(${e},${n})`,children:[se("g",{className:"annotation-note-content",transform:0!==v?`translate(0,${v})`:void 0,children:k}),x]})}function ue(t,e,n,r,o){const i=[];switch(t){case"callout-circle":{const t=(e?.radius||0)+(e?.radiusPadding||0);t>0&&i.push(se("circle",{r:t,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=e?.width||0,r=e?.height||0;(t>0||r>0)&&i.push(se("rect",{width:t,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":e?.custom&&i.push(...Array.isArray(e.custom)?e.custom:[e.custom]);break;case"xy-threshold":{const t=r||0,s=o||0;if(void 0!==e?.x){const r=(e.x||0)-t;i.push(se("line",{x1:r,y1:(e.y1||0)-s,x2:r,y2:(e.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==e?.y){const r=(e.y||0)-s;i.push(se("line",{x1:(e.x1||0)-t,y1:r,x2:(e.x2||0)-t,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==e?.x1||void 0!==e?.x2?i.push(se("line",{x1:(e.x1||0)-t,y1:0,x2:(e.x2||0)-t,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===e?.y1&&void 0===e?.y2||i.push(se("line",{x1:0,y1:(e.y1||0)-s,x2:0,y2:(e.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=e?.type||"curly",r=e?.width??e?.height;void 0!==r&&i.push(se("path",{d:ce(t,r,e?.depth||30,void 0===e?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return se("g",{className:"annotation-subject",children:i})}function he(t,e,n,r,o,i){const s=[];let a=0,l=0;if("callout-circle"!==o&&"label"!==o||!i?.radius){if("callout-rect"===o&&i){const n=i.width||0,r=i.height||0;if(n>0||r>0){const o=n/2,i=r/2,s=t-o,c=e-i;if(0!==s||0!==c){const t=Math.abs(s),e=Math.abs(c),d=n/2,u=r/2,h=t*u>e*d?d/t:u/e;a=o+s*h,l=i+c*h}}}else if("bracket"===o&&i){const t=i.width,e=i.height,n=i.depth||30;void 0!==t?(a=t/2,l=n):void 0!==e&&(a=n,l=e/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==t||0!==e)){const r=Math.atan2(e,t);a=Math.cos(r)*n,l=Math.sin(r)*n}}const c=Math.sqrt((t-a)**2+(e-l)**2);if(c>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let d=Math.atan2(e-l,t-a);if(i){const r=(a+t)/2,i=(l+e)/2,u=-(e-l)/c,h=(t-a)/c,y=(n?.curve??.25)*c,f=r+u*y,p=i+h*y;s.push(se("path",{className:"connector-curve",d:`M${a},${l}Q${f},${p} ${t},${e}`,fill:"none",stroke:o},"connector-line")),d=Math.atan2(p-l,f-a)}else s.push(se("line",{x1:a,y1:l,x2:t,y2:e,stroke:o},"connector-line"));if("arrow"===n?.end){const t=10,e=16/180*Math.PI;s.push(se("path",{d:`M${a},${l}L${a+t*Math.cos(d+e)},${l+t*Math.sin(d+e)}L${a+t*Math.cos(d-e)},${l+t*Math.sin(d-e)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return se("g",{className:"annotation-connector",children:s})}function ye(t){const{x:e=0,y:n=0,dx:r,dy:o,nx:i,ny:s,note:a,connector:l,subject:c,type:d,color:u,className:h,disable:y,opacity:f,strokeDasharray:p,events:m={},"data-testid":g}=t,k=Array.isArray(e)?e[0]??0:e,$=Array.isArray(n)?n[0]??0:n,x=new Set(Array.isArray(y)?y:[]);let b=r||0,v=o||0;null!=i&&(b=i-k),null!=s&&(v=s-$);const w="string"==typeof d?d:"label";if("bracket"===w&&c&&0===b&&0===v)if(void 0!==c.width){b=c.width/2;const t=c.depth||30;v=t+(0>t?-5:5)}else if(void 0!==c.height){const t=c.depth||30;b=t+(0>t?-5:5),v=c.height/2}return ae("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${k},${$})`,"data-testid":g,...null!=f&&{opacity:f},...p&&{strokeDasharray:p},...m,children:[!x.has("connector")&&he(b,v,l,u,w,c),!x.has("subject")&&ue(w,c,u,k,$),!x.has("note")&&de(a,b,v,u)]})}function fe(t){const{noteData:e}=t,{screenCoordinates:n}=e,r="string"==typeof e.type?e.type:"label",o=e.eventListeners||e.events||{};if(e.coordinates&&n){const t=e.nx||n[0][0]+(e.dx??0),o=e.ny||n[0][1]+(e.dy??0),i=n.map((n,i)=>{const s=Object.assign({},e,{note:0===i?e.note:{label:""},x:n[0],y:n[1],nx:t,ny:o});return se(ye,{"data-testid":"semiotic-annotation",...s,type:r},"multi-annotation-"+i)});return se("g",{children:i})}const i=e.note||{title:"none",label:e.label},s=`${i.label}-${i.title}-${e.i}`;return se(ye,{"data-testid":"semiotic-annotation",events:o,...e,type:r},s)}import{jsx as pe,jsxs as me}from"react/jsx-runtime";var ge="var(--semiotic-bg, #ffffff)";function ke(t){const{x:e,y:n,text:r,fill:o,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:d,className:u}=t,h=function(t){return void 0===t||!0===t||"halo"===t?{type:"halo"}:!1===t||"none"===t?null:"box"===t?{type:"box"}:{type:t.type??"halo",...t}}(d),y=t=>pe("text",{x:e,y:n,textAnchor:l,dominantBaseline:c,fill:o,fontSize:i,fontWeight:s,fontFamily:a,className:u,...t?{stroke:t.stroke,strokeWidth:t.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!h)return y();if("halo"===h.type)return y({stroke:h.fill??ge,strokeWidth:h.haloWidth??3});const f=h.padding??{x:6,y:3},p="number"==typeof f?f:f.x,m="number"==typeof f?f:f.y,g=function(t,e){return(t+"").length*e*.6}(r,i),k=i+2*m;let $,x;return $="middle"===l?e-g/2-p:"end"===l?e-g-p:e-p,x="middle"===c||"central"===c?n-k/2:"hanging"===c||"text-before-edge"===c?n-m:n-.8*i-m,me("g",{className:u,children:[pe("rect",{x:$,y:x,width:g+2*p,height:k,rx:h.radius??3,ry:h.radius??3,fill:h.fill??ge,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),y()]})}export{f as filterSparseArray,m as parseDateLikeString,g as coerceDateLikeValue,k as coerceTemporalStringRows,Wt as DEFAULT_COLORS,Lt as STREAMING_PALETTE,St as getColor,Ot as resolveExplicitColor,Rt as createColorScale,Tt as getSize,Bt as computeEasing,_t as computeRawProgress,Gt as lerp,Vt as now,Zt as resolveAnimateConfig,Yt as isLegendConfig,Ut as isGradientLegendConfig,fe as SemioticAnnotation,Jt as ANNOTATION_DISCLOSURE_REVEAL_CSS,re as applyAnnotationEmphasis,ke as AnnotationLabel,st as unlockCrosshair,ht as useCrosshairPosition,$ as TITLE_BASELINE,x as hasTextTitle,b as reserveFrameChromeMargin,v as reserveTitleMargin,A as hasAnyCornerRadius,W as clampCornerRadii,C as xySceneNodeToSVG,D as networkSceneNodeToSVG,F as networkSceneEdgeToSVG,q as networkLabelToSVG,z as ordinalSceneNodeToSVG,H as geoSceneNodeToSVG,E as isServerEnvironment,B as observationInputType,_ as isInteractiveKeyboardTarget,G as emitHoverObservations,V as emitClickObservations,oe as resolveCustomLayoutPalette,ie as buildResolveColor,pt as useBrushSelection,gt as normalizeLinkedBrush,jt as DEFAULT_COLOR,qt as useChartSelection,Ht as useChartMode};
@@ -1,2 +0,0 @@
1
- "use client";
2
- import{bandFromAge as t,defaultTooltipStyle as e,normalizeTooltip as n,opacityFromAge as r,resolveCanvasFill as o}from"./chunk-chunk-ODUZEEBH.module.min.js";import{drawGlyphParts as a,glyphFractionClipRect as s,glyphHitGeometry as l,glyphPlacement as i}from"./chunk-chunk-KTWEBFMX.module.min.js";import{jsx as c,jsxs as u}from"react/jsx-runtime";function f(t){return"string"==typeof t?t:"value"}function h(t){return null==t?"–":"number"==typeof t?Math.abs(t)>9999?t.toLocaleString():t+"":t instanceof Date?t.toLocaleDateString():t+""}function d(t,e){if(!e)return h(t);try{const n=e(t);return null==n?h(t):n}catch{return h(t)}}function p(t,e){return"function"==typeof e?e(t):t[e]}function y(t,e){if(!t)return[];const n=[];return(Array.isArray(t)?t:[t]).forEach((t,r)=>{const o="string"==typeof t?.y0Accessor?t.y0Accessor:"low",a="string"==typeof t?.y1Accessor?t.y1Accessor:"high";n.push({label:o,accessor:t=>t.bands?.[r]?.y0??(0===r?t.band?.y0:void 0),format:e}),n.push({label:a,accessor:t=>t.bands?.[r]?.y1??(0===r?t.band?.y1:void 0),format:e})}),n}function g(t){const n=t.find(t=>"title"===t.role),r=t.filter(t=>"title"!==t.role);return t=>{const o=t.data;if(!o)return null;const a=n?d(p(o,n.accessor),n.format):null;return u("div",{className:"semiotic-tooltip",style:e,children:[null!=a&&c("div",{style:{fontWeight:"bold",marginBottom:r.length>0?4:0},children:a}),r.map((t,e)=>{const n=d(p(o,t.accessor),t.format);return u("div",{style:e>0?{marginTop:2}:void 0,children:[u("span",{style:{opacity:.7},children:[t.label,": "]}),c("span",{children:n})]},e)})]})}}function m({categoryAccessor:t,valueAccessor:n,groupAccessor:r,groupLabel:o,pieData:a=!1,valueFormat:s}){return l=>{const i=a?l.data?.[0]||l.data||l:l.data||l,y=p(i,t),g=p(i,n),m=r?p(i,r):void 0;return u("div",{className:"semiotic-tooltip",style:e,children:[c("div",{style:{fontWeight:"bold"},children:h(y)}),c("div",{style:{marginTop:4},children:d(g,s)}),null!=m&&u("div",{style:{marginTop:2,opacity:.8},children:[o||f(r),": ",h(m)]})]})}}import*as x from"react";function b(...t){const e=t.filter(t=>null!=t);return 0===e.length?null:1===e.length?e[0]:x.createElement(x.Fragment,null,...e)}import{useEffect as v,useRef as w}from"react";function A(t,e,n,r){v(()=>{t.current?.updateConfig(e),n.current=!0,r()},[e,r,t,n])}function _(t,e,n,r){const o=w(null);v(()=>{const a=t.current;if(!a)return;const s=e??null;o.current!==s&&(o.current=s,a.setLayoutSelection(s),a.hasCustomRestyle?a.restyleScene(s):n.current=!0,r())},[e,r,t,n])}var k={fresh:1,aging:.7,stale:.45,expired:.25},I={alpha:1,band:"fresh",isStale:!1};function M(e,n){if(!e||0>=n)return I;const r=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},a=t(n,r,e.thresholds);return{alpha:{...k,...e.opacities??{}}[a],band:a,isStale:"fresh"!==a}}return n>r?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:I}import{useEffect as O,useRef as S}from"react";function E(t,e,n,r,o,a){const s=S("fresh");O(()=>{if(!t)return;const l=setInterval(()=>{const l=e.current;if(!l||0===l.lastIngestTime)return;const i="undefined"!=typeof performance?performance.now():Date.now(),c=M(t,i-l.lastIngestTime);c.band===s.current&&c.isStale===o||(s.current=c.band,c.isStale!==o&&a(c.isStale),n.current=!0,r())},1e3);return()=>clearInterval(l)},[t,o,r,e,a,n])}import{jsx as D}from"react/jsx-runtime";function R({isStale:t,position:e}){return D("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===e?{top:4,left:4}:"bottom-left"===e?{bottom:4,left:4}:"bottom-right"===e?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"},children:t?"STALE":"LIVE"})}import{useRef as P}from"react";function j(t){const e=P(t);return function(t,e){if(Object.is(t,e))return!0;if(Array.isArray(t)&&Array.isArray(e))return L(t,e);if(!T(t)||!T(e))return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(e,r))return!1;const n=t[r],o=e[r];if(!Object.is(n,o))if(Array.isArray(n)&&Array.isArray(o)){if(!L(n,o))return!1}else{if(!T(n)||!T(o))return!1;if(!C(n,o))return!1}}return!0}(e.current,t)||(e.current=t),e.current}function C(t,e){const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const r of n){if(!Object.prototype.hasOwnProperty.call(e,r))return!1;if(!Object.is(t[r],e[r]))return!1}return!0}function L(t,e){if(t.length!==e.length)return!1;for(let n=0;t.length>n;n++)if(!Object.is(t[n],e[n]))return!1;return!0}function T(t){if(null===t||"object"!=typeof t)return!1;if(Array.isArray(t))return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||null===e}function z(t,e,n,r,l){if(0>=e.size)return;const c=e.glyph;if(!c||!c.parts?.length)return;const u=i(c,e.size);if(0>=u.scale)return;const f=(e.style.opacity??1)*(e._decayOpacity??1);if(0>=f)return;const h=e=>{const n=o(t,e,e);return"string"==typeof n?n:e},d=e.color??("string"==typeof e.style.fill?e.style.fill:void 0);t.save(),t.translate(n,r),e.rotation&&t.rotate(e.rotation),t.translate(u.offsetX,u.offsetY),t.scale(u.scale,u.scale),t.globalAlpha=l*f*(e.style.fillOpacity??1);const p=s(c,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal");p&&e.ghostColor&&a(t,c,d,e.accent,e.ghostColor,h),p&&(t.beginPath(),t.rect(p.x,p.y,p.width,p.height),t.clip()),a(t,c,d,e.accent,void 0,h),t.restore()}var H=(t,e)=>{const n=t.globalAlpha;for(const r of e)"glyph"===r.type&&z(t,r,r.x,r.y,n);t.globalAlpha=n};function U(t,e){const n=t.globalAlpha;for(const r of e)"glyph"===r.type&&z(t,r,r.cx,r.cy,n);t.globalAlpha=n}var $=new Set;function B(t,e){const n="function"==typeof t?t(e.datum??null,e):t;return(r=n)&&"object"==typeof r&&"string"==typeof r.id&&"function"==typeof r.cacheKey&&"function"==typeof r.drawCanvas&&"function"==typeof r.renderStaticSVG?n:void 0;var r}function G(t,e){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${t}:${e}`;$.has(n)||($.add(n),console.warn(`[Semiotic] Render backend "${t}" does not support scene node "${e}"; using the built-in renderer.`))}function N(t){const{context:e,nodes:n,renderMode:r,pixelRatio:o,paintBuiltIn:a}=t;if(!r||"sketchy"===r)return void a(n);let s=[];const l=()=>{s.length&&(a(s),s=[])};for(const t of n){const n=B(r,t);if(!n){s.push(t);continue}let i;l(),e.save();try{i=n.drawCanvas({context:e,node:t,style:t.style??{},pixelRatio:o})}finally{e.restore()}i||(G(n.id,t.type??"unknown"),a([t]))}l()}function W(t){const{node:e,index:n,renderMode:r,fallback:o}=t,a=B(r,e);if(!a)return o();const s=a.renderStaticSVG({node:e,style:e.style??{},key:`${a.id}-${n}`});return null!=s?s:(G(a.id,e.type??"unknown"),o())}function F(t){const e=new Map;for(const n of t){const t=n.group??"_default";let r=e.get(t);r||(r=[],e.set(t,r)),r.push(n)}for(const t of e.values()){t.sort((t,e)=>t.x-e.x||t.y-e.y);for(let e=0;t.length>e;e++)t[e]._groupIndex=e}const n=Array.from(e.keys()).sort((t,n)=>{const r=e.get(t),o=e.get(n);return(r.length>0?r[0].y:0)-(o.length>0?o[0].y:0)}),r=Array.from(e.values()).flat();r.sort((t,e)=>t.x-e.x||t.y-e.y);const o=new Map;for(let t=0;r.length>t;t++){r[t]._flatIndex=t;const e=r[t].datum?.id;null!=e&&o.set(e+"",t)}return{flat:r,groups:n,byGroup:e,idToIdx:o}}function V(t,e){if(0===t.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(e,t.flat.length-1)),r=t.flat[n];return{flatIndex:n,group:r.group??"_default",indexInGroup:r._groupIndex??0}}function Y(t,e,n){const{group:r,indexInGroup:o}=e,a=n.byGroup.get(r);switch(t){case"ArrowRight":return a.length-1>o?a[o+1]._flatIndex:e.flatIndex;case"ArrowLeft":return o>0?a[o-1]._flatIndex:e.flatIndex;case"ArrowDown":{const t=n.groups.indexOf(r);return n.groups.length-1>t?K(n,n.groups[t+1],a[o]):e.flatIndex}case"ArrowUp":{const t=n.groups.indexOf(r);return t>0?K(n,n.groups[t-1],a[o]):e.flatIndex}case"PageDown":return Math.min(e.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(e.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}function K(t,e,n){const r=t.byGroup.get(e);let o=0,a=Math.abs(r[0].x-n.x);for(let t=1;r.length>t;t++){const e=Math.abs(r[t].x-n.x);a>e&&(a=e,o=t)}return r[o]._flatIndex}function X(t){const e=[];for(const n of t)switch(n.type){case"point":e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const t=l(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:"_default"});break}case"line":{const t=n,r=Array.isArray(t.datum)?t.datum:[],o=t.group??"_default";for(let n=0;t.path.length>n&&r.length>n;n++)e.push({x:t.path[n][0],y:t.path[n][1],datum:r[n],shape:"circle",group:o});break}case"area":{const t=n,r=Array.isArray(t.datum)?t.datum:[],o=t.group??"_default";for(let n=0;t.topPath.length>n&&r.length>n;n++)e.push({x:t.topPath[n][0],y:t.topPath[n][1],datum:r[n],shape:"circle",group:o});break}case"rect":e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??"_default"});break;case"heatcell":e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function q(t){const e=[];for(const n of t)if("rect"===n.type&&null!=n.x){if(null==n.datum)continue;e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??n.datum?.category??""})}else if("point"===n.type)e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});else if("symbol"===n.type){if(0>=n.size)continue;e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"})}else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const t=l(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:"_default"})}else if("wedge"===n.type&&null!=n.cx){if(null===n.datum)continue;const t=((n.startAngle||0)+(n.endAngle||0))/2,r=((n.innerRadius||0)+(n.outerRadius||50))/2;e.push({x:n.cx+Math.cos(t)*r,y:n.cy+Math.sin(t)*r,datum:n.datum,shape:"wedge",group:"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function Z(t){const e=[];for(const n of t)if("circle"===n.type&&null!=n.cx){if(0>=n.r)continue;e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("rect"===n.type&&null!=n.x){if(0>=n.w||0>=n.h)continue;e.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.datum?.id??"_default"})}else if("arc"===n.type&&null!=n.cx)e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"});else if("symbol"===n.type&&null!=n.cx){if(0>=n.size)continue;e.push({x:n.cx,y:n.cy,datum:n.datum,shape:"circle",group:n.datum?.id??"_default"})}else if("glyph"===n.type&&null!=n.cx){if(0>=n.size||null==n.datum)continue;const t=l(n.glyph,n.size);e.push({x:n.cx+t.centerDx,y:n.cy+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight,group:n.datum?.id??"_default"})}return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function J(t,e,n,r,o){const a=n.flat[e.flatIndex];if(!a)return Y(t,e,n);const s=a.datum?.id;switch(t){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{const r=function(t,e,n){let r=null,o=1/0;for(let a=0;t.flat.length>a;a++){const s=t.flat[a];if(s===e)continue;const l=s.x-e.x,i=s.y-e.y;let c=!1;switch(n){case"right":c=l>0&&Math.abs(l)>=Math.abs(i);break;case"left":c=0>l&&Math.abs(l)>=Math.abs(i);break;case"down":c=i>0&&Math.abs(i)>=Math.abs(l);break;case"up":c=0>i&&Math.abs(i)>=Math.abs(l)}if(!c)continue;const u=l*l+i*i;o>u&&(o=u,r=a)}return r}(n,a,"ArrowRight"===t?"right":"ArrowLeft"===t?"left":"ArrowDown"===t?"down":"up")??e.flatIndex;return r!==e.flatIndex&&(o.current=-1),r}case"Enter":{if(null==s)return e.flatIndex;const t=function(t,e){const n=t+"",r=[];for(const t of e){const e=t.datum??t,o=Q(e.source),a=Q(e.target),s=null!=o,l=null!=a;s&&o+""===n&&l?r.push(a+""):l&&a+""===n&&s&&r.push(o+"")}return r}(s,r);if(0===t.length)return e.flatIndex;const a=n.idToIdx.get(t[(o.current+1)%t.length])??-1;return 0>a?e.flatIndex:(o.current=-1,a)}default:{const r=Y(t,e,n);return null!==r&&r!==e.flatIndex&&(o.current=-1),r}}}function Q(t){return"object"==typeof t&&null!==t&&"id"in t?t.id:t}function tt(t){const e=[];for(const n of t)if("point"===n.type&&null!=n.x)e.push({x:n.x,y:n.y,datum:n.datum,shape:"circle"});else if("glyph"===n.type){if(0>=n.size||null==n.datum)continue;const t=l(n.glyph,n.size);e.push({x:n.x+t.centerDx,y:n.y+t.centerDy,datum:n.datum,shape:"rect",w:2*t.halfWidth,h:2*t.halfHeight})}else"geoarea"===n.type&&n.centroid&&!1!==n.interactive&&e.push({x:n.centroid[0],y:n.centroid[1],datum:n.datum,shape:"geoarea",pathData:n.pathData});return e.sort((t,e)=>t.x-e.x||t.y-e.y),e}function et(t,e,n){switch(t){case"ArrowRight":case"ArrowDown":return n-1>e?e+1:e;case"ArrowLeft":case"ArrowUp":return e>0?e-1:e;case"PageDown":return Math.min(e+Math.max(1,Math.floor(.1*n)),n-1);case"PageUp":return Math.max(e-Math.max(1,Math.floor(.1*n)),0);case"Home":return 0;case"End":return n-1;case"Escape":return-1;default:return null}}function nt(t){return{data:t.datum||{},x:t.x,y:t.y,__semioticHoverData:!0}}function rt(t){const{title:e,description:n,summary:r,accessibleTable:o,className:a,animate:s,axisExtent:l,autoPlaceAnnotations:i}=t,c={};return e&&(c.title=e),n&&(c.description=n),r&&(c.summary=r),void 0!==o&&(c.accessibleTable=o),a&&(c.className=a),null!=s&&(c.animate=s),void 0!==l&&(c.axisExtent=l),void 0!==i&&(c.autoPlaceAnnotations=i),c}function ot(t){const{linkedHover:e,selection:n,onObservation:r,onClick:o,hoverRadius:a,hoverHighlight:s,forceHoverBehavior:l,forceClickBehavior:i,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:f,linkedHoverInClickPredicate:h=!0}=t,d={};r&&(d.annotationObservationCallback=r);const p=c?.enabled?Math.max(a??30,Math.ceil((c.targetSize||44)/2),24):a;return(l||e||r||o||s)&&(d.customHoverBehavior=u),f&&(i||(h?r||o||e:r||o)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(e||s||n))&&(d.customClickBehavior=f),null!=p&&(d.hoverRadius=p),d}function at(t){const{tooltip:e,defaultTooltipContent:r}=t;return{tooltipContent:!1===e?()=>null:n(e)||r}}function st(t,e,n){if(1>=n)return 1;const o=n-1;return r({age:o-e,extent:o,type:t.type,halfLife:t.halfLife??n/2,threshold:t.stepThreshold??.5*n,minOpacity:t.minOpacity??.1})}function lt(t){const e=new Map;for(let n=0;t.length>n;n++)e.set(t[n],n);return e}function it(t,e,n,r=lt(n)){const o=n.length;if(o>1)for(const n of e){if("line"===n.type){const e=Array.isArray(n.datum)?n.datum:[];if(2>e.length)continue;const a=Array(e.length);let s=!1;for(let n=0;e.length>n;n++){const l=r.get(e[n]);null!=l?(a[n]=st(t,l,o),1>a[n]&&(s=!0)):a[n]=1}s&&(n._decayOpacities=a);continue}if("area"===n.type){const e=Array.isArray(n.datum)?n.datum:[],a=n.topPath?n.topPath.length:e.length;if(2>a)continue;if(e.length===a){const s=Array(a);let l=!1;for(let n=0;e.length>n;n++){const a=r.get(e[n]);null!=a?(s[n]=st(t,a,o),1>s[n]&&(l=!0)):s[n]=1}l&&(n._decayOpacities=s)}else{let s=1;for(const n of e){const e=r.get(n);if(null!=e){const n=st(t,e,o);s>n&&(s=n)}}if(1>s){const t=Array(a);t.fill(s),n._decayOpacities=t}}continue}const e=r.get(n.datum);if(null==e)continue;const a=st(t,e,o);"heatcell"===n.type?n.style={opacity:a}:"candlestick"===n.type?n._decayOpacity=a:n.style={...n.style,opacity:(n.style?.opacity??1)*a}}}function ct(t){if("production"===process.env.NODE_ENV)return;const{label:e,nodes:n,overlays:r,warned:o}=t;ut(r)&&0===n.length&&ft(o,"overlay-only",`[semiotic] ${e} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(t=>null==t.datum)&&ft(o,"null-datums",`[semiotic] ${e} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function ut(t){return null!=t&&!1!==t&&""!==t&&(!Array.isArray(t)||t.some(ut))}function ft(t,e,n){t.has(e)||(t.add(e),console.warn(n))}function ht(t,e,n,r){const o=function(t){if(t instanceof Error)return{name:t.name||"Error",message:t.message||"Custom layout threw."};if("string"==typeof t)return{name:"Error",message:t};if(null==t)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:t+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(e),a="network"===t?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:t,source:a,message:`Semiotic ${t} ${a} failed: ${o.message}`,error:o,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:r}}var dt=new WeakMap;function pt(){return this.updateResults.last}function yt(){return this.updateResults.last}function gt(t){return this.updateResults.subscribe(t)}function mt(t){this.config.layoutSelection=t}function xt(){dt.set(this,!0)}function bt(){const t=!0===dt.get(this);return dt.delete(this),t}function vt(t){Object.assign(t.prototype,{getLastUpdateResult:pt,getUpdateSnapshot:yt,subscribeUpdateResult:gt,setLayoutSelection:mt,markStylePaintPending:xt,consumeStylePaintPending:bt})}function wt(t,e,n){return n.x>t||t>n.x+n.w||n.y>e||e>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function At(t,e=30){return Math.max((t??4)+5,12,e)}function _t(t){return t instanceof Date?t:"number"==typeof t&&t>1e9?new Date(t):null}function kt(t,e){const n=_t(t);if(!n)return!1;const r=_t(e);return!r||n.getFullYear()!==r.getFullYear()||n.getMonth()!==r.getMonth()}function It(t){let e=t%(2*Math.PI);return 0>e&&(e+=2*Math.PI),e}function Mt(t,e,n,r,o,a=t=>t.x,s=t=>t.y,l=t=>t.r){const i=Math.max(r,o+5,12),c=e-i,u=e+i,f=n-i,h=n+i;let d=null,p=1/0;return t.visit((t,o,i,y,g)=>{if(o>u||c>y||i>h||f>g)return!0;if(!t.length){let o=t;do{const t=o.data,i=a(t)-e,c=s(t)-n,u=Math.sqrt(i*i+c*c);At(l(t),r)>=u&&p>u&&(d=t,p=u),o=o.next}while(o)}return!1}),d?{node:d,distance:p}:null}function Ot(t){return!(!t._pulseIntensity||0>=t._pulseIntensity)}function St(t,e,n=.3){Ot(e)&&(t.globalAlpha=e._pulseIntensity*n,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.fillRect(e.x,e.y,e.w,e.h))}function Et(t,e,n=.6){if(!Ot(e))return;const r=e.r+(e._pulseGlowRadius??4)*e._pulseIntensity,o=e.cx??e.x??0,a=e.cy??e.y??0;t.beginPath(),t.arc(o,a,r,0,2*Math.PI),t.strokeStyle=e._pulseColor||"rgba(255,255,255,0.6)",t.lineWidth=2*e._pulseIntensity,t.globalAlpha=e._pulseIntensity*n,t.stroke()}function Dt(t,e,n,r=.35){Ot(e)&&(t.globalAlpha=e._pulseIntensity*r,t.fillStyle=e._pulseColor||"rgba(255,255,255,0.6)",n?t.fill(n):t.fill())}export{st as computeDecayOpacity,lt as buildDatumIndexMap,it as applyDecay,ct as warnCustomLayoutDiagnostics,ht as createCustomLayoutFailureDiagnostic,vt as attachUpdateResultStore,b as composeOverlays,A as useConfigSync,_ as useLayoutSelectionSync,wt as hitTestRect,At as getHitRadius,kt as isTimeLandmark,It as normalizeAngle,Mt as findHitPointInQuadtree,M as resolveStaleness,E as useStalenessCheck,R as StalenessBadge,j as useStableShallow,St as renderRectPulse,Et as renderCirclePulse,Dt as renderPathPulse,H as glyphCanvasRenderer,U as networkGlyphRenderer,N as paintSceneWithBackend,W as renderSceneWithBackend,f as accessorName,h as formatVal,y as bandTooltipFields,g as buildDefaultTooltip,m as buildOrdinalTooltip,F as buildNavGraph,V as resolvePosition,Y as nextGraphIndex,X as extractXYNavPoints,q as extractOrdinalNavPoints,Z as extractNetworkNavPoints,J as nextNetworkIndex,tt as extractGeoNavPoints,et as nextIndex,nt as navPointToHover,rt as buildBaseMetadataProps,ot as buildCustomBehaviorProps,at as buildTooltipProps};
@@ -1 +0,0 @@
1
- import{createSeededFrameRandom as t,schemeCategory10 as e}from"./chunk-chunk-NO4MCQVD.module.min.js";import{getMinMax as o}from"./chunk-chunk-JJ2OOIET.module.min.js";import{forceSimulation as n,forceCenter as r,forceX as s,forceY as c,forceLink as i,forceManyBody as a,forceCollide as f}from"d3-force";import{scaleLinear as l}from"d3-scale";var u=new Set,d=new WeakMap;function g(t,e){if("production"===process.env.NODE_ENV)return t;if(!t||!t.data||"object"!=typeof t.data)return t;let o=d.get(t);if(o){const t=o.get(e);if(t)return t}else o=new Map,d.set(t,o);const n=new Proxy(t,{get(t,o,n){if("string"==typeof o&&!(o in t)&&t.data&&o in t.data){const t=`${e}:${o}`;u.has(t)||(u.add(t),console.warn(`[Semiotic] "${e}" callback accessed "${o}" on the wrapper object, but it only exists on ".data". Use d.data.${o} (or d.data?.${o}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(t,o,n)}});return o.set(e,n),n}var h={supportsStreaming:!0,hierarchical:!1,computeLayout(e,o,l,u){if(0===e.length)return;const d=l.forceStrength??.1,g=u[0]/2,h=u[1]/2,x=l.__previousPositions;let M=0;const S=[];for(const t of e){const e=null!=t.x&&null!=t.y&&(0!==t.x||0!==t.y),o=x?.get(t.id);e?M++:o?(t.x=o.x,t.y=o.y,M++):S.push(t)}const b=M>0&&.3>=(e.length>0?S.length/e.length:1);if(b){const t=new Map;for(const o of e)t.set(o.id,o);for(const e of S){const n=y(e.id,o,t);if(n.length>0){let t=0,o=0;for(const e of n)t+=e.x,o+=e.y;const r=p(e.id),s=r%360*(Math.PI/180),c=10+r%20;e.x=t/n.length+c*Math.cos(s),e.y=o/n.length+c*Math.sin(s)}else{const t=p(e.id),o=t%360*(Math.PI/180),n=15+t%30;e.x=g+n*Math.cos(o),e.y=h+n*Math.sin(o)}}}else{const t=2.399963229728653;for(let o=0;e.length>o;o++){const n=e[o];if(null==n.x||null==n.y||0===n.x&&0===n.y){const e=10*Math.sqrt(o+.5),r=o*t;n.x=g+e*Math.cos(r),n.y=h+e*Math.sin(r)}}}const k=l.__skipForceSimulation||0===l.iterations?0:b?40:l.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(e.length-30)))),w=m(l.nodeSize,l.nodeSizeRange,e),_=t=>w(t);if(k>0){const u=new Map,y=new Map;for(const t of e)u.set(t.id,0),y.set(t.id,t);for(const t of o){const e="string"==typeof t.source?t.source:t.source.id,o="string"==typeof t.target?t.target:t.target.id;u.set(e,(u.get(e)??0)+1),u.set(o,(u.get(o)??0)+1)}const p=i().strength(t=>{const e=t.weight,o="string"==typeof t.target?t.target:t.target.id,n=Math.max(1,Math.min(u.get("string"==typeof t.source?t.source:t.source.id)??1,u.get(o)??1));return Math.min(2.5,(e&&e>0?Math.sqrt(e):1)*d/(.1*n))}).distance(t=>{const e="string"==typeof t.source?y.get(t.source):t.source,o="string"==typeof t.target?y.get(t.target):t.target,n=(e?_(e):0)+(o?_(o):0)+12;return Math.max(40,n)}).id(t=>t.id),m=n();if(void 0===l.random&&void 0===l.seed||m.randomSource(l.random??t(l.seed)),m.force("charge",a().strength(t=>{const e=u.get(t.id)??0;return-15*_(t)*Math.sqrt(e+1)})).force("collide",f(t=>_(t)+3).strength(.9).iterations(2)).force("center",r(g,h).strength(.8)).force("x",s(g).strength(.06)).force("y",c(h).strength(.06)),m.nodes(e),o.length>0){const t=o.map(t=>({...t,source:"string"==typeof t.source?t.source:t.source.id,target:"string"==typeof t.target?t.target:t.target.id}));p.links(t),m.force("link",p)}b?m.alpha(.3):.1>m.alpha()&&m.alpha(1),m.stop();for(let t=0;k>t;++t)m.tick()}for(const t of e){if(null==t.x||null==t.y)continue;const e=_(t);t.x=Math.max(e,Math.min(u[0]-e,t.x)),t.y=Math.max(e,Math.min(u[1]-e,t.y)),t.x0=0,t.x1=0,t.y0=0,t.y1=0}const v=new Map;for(const t of e)v.set(t.id,t);for(const t of o){if("string"==typeof t.source){const e=v.get(t.source);e&&(t.source=e)}if("string"==typeof t.target){const e=v.get(t.target);e&&(t.target=e)}}},buildScene(t,o,n,r){const s=n.nodeStyle,c=n.edgeStyle,i=m(n.nodeSize,n.nodeSizeRange,t),a=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical&&n.themeCategorical.length>0?n.themeCategorical:e,f=new Map;t.forEach((t,e)=>{f.set(t.id,a[e%a.length])});const l=[],u=[],d=[];for(const e of t){if(null==e.x||null==e.y)continue;const t=i(g(e,"nodeSize")),o=s?s(g(e,"nodeStyle")):{},r={fill:o.fill||f.get(e.id)||n.themeSemantic?.primary||"#007bff",stroke:o.stroke||n.themeSemantic?.surface||"#fff",strokeWidth:o.strokeWidth??2,opacity:o.opacity};l.push({type:"circle",cx:e.x,cy:e.y,r:t,style:r,datum:e,id:e.id,label:e.id})}const h=new Map;for(const e of t)h.set(e.id,e);for(const t of o){const e="object"==typeof t.source?t.source:h.get(t.source),o="object"==typeof t.target?t.target:h.get(t.target);if(!e||!o)continue;if(null==e.x||null==e.y)continue;if(null==o.x||null==o.y)continue;const r=c?c(g(t,"edgeStyle")):{};u.push({type:"line",x1:e.x,y1:e.y,x2:o.x,y2:o.y,style:{stroke:r.stroke||n.themeSemantic?.border||n.themeSemantic?.secondary||"#999",strokeWidth:r.strokeWidth??1,opacity:r.opacity??.6},datum:t})}if(!1!==n.showLabels){const e=(y=n.nodeLabel)?"function"==typeof y?y:t=>t[y]||t.id:null;for(const o of t){if(null==o.x||null==o.y)continue;const t=e?e(o):o.id;if(!t)continue;const n=i(g(o,"nodeSize"));d.push({x:o.x,y:o.y-n-4,text:t+"",anchor:"middle",baseline:"auto",fontSize:11})}}var y;return{sceneNodes:l,sceneEdges:u,labels:d}}};function y(t,e,o){const n=[];for(const r of e){const e="string"==typeof r.source?r.source:r.source.id,s="string"==typeof r.target?r.target:r.target.id;let c=null;if(e===t?c=s:s===t&&(c=e),c){const t=o.get(c);!t||0===t.x&&0===t.y||n.push({x:t.x,y:t.y})}}return n}function p(t){let e=0;for(let o=0;t.length>o;o++)e=(e<<5)-e+t.charCodeAt(o)|0;return Math.abs(e)}function m(t,e,n){if(n.some(t=>null!=t.__forceRadius))return t=>t.__forceRadius??8;if(null==t)return()=>8;if("number"==typeof t)return()=>t;if("function"==typeof t)return e=>t(e)||8;const r=e||[5,20],s=[];for(const e of n){const o=e.data?.[t];"number"==typeof o&&s.push(o)}if(0===s.length)return()=>r[0];const[c,i]=o(s);if(c===i)return()=>(r[0]+r[1])/2;const a=l().domain([c,i]).range(r).clamp(!0);return e=>{const o=e.data?.[t];return null==o||"number"!=typeof o?r[0]:a(o)}}export{g as wrapWithDataHint,h as forceLayoutPlugin,m as resolveNodeSizeFn};
@@ -1 +0,0 @@
1
- import{contrastRatio as e,fieldForRole as t,recipeConfig as i,recipeIntentId as a}from"./chunk-chunk-M337NY6L.module.min.js";import{extractAllRows as n}from"./chunk-chunk-255KDHW5.module.min.js";import{resolveResponsiveRules as r}from"./chunk-chunk-2WVCH4PL.module.min.js";import{getMinMax as s}from"./chunk-chunk-JJ2OOIET.module.min.js";import*as o from"react";function l(e){if(null==e)return"";if("number"!=typeof e)return e+"";if(!isFinite(e))return e+"";if(0===e)return"0";const t=parseFloat(e.toPrecision(12)),i=Math.abs(t);return 1e9>i?1e6>i?1e4>i?Number.isInteger(t)?t+"":parseFloat(t.toPrecision(6))+"":parseFloat((t/1e3).toPrecision(3))+"K":parseFloat((t/1e6).toPrecision(3))+"M":parseFloat((t/1e9).toPrecision(3))+"B"}var c=864e5;function u(e){return 10>e?"0"+e:e+""}var d=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function m(e){let t,i=e;return(a,n,r)=>{const s=a instanceof Date?a:new Date(a);e||!r||2>r.length||r===t||(t=r,i=function(e){if(2>e.length)return"days";const t=[];for(let i=1;e.length>i;i++)t.push(e[i]-e[i-1]);t.sort((e,t)=>e-t);const i=t[Math.floor(t.length/2)];return 12e4>i?"seconds":72e5>i?"minutes":2*c>i?"hours":60*c>i?"days":400*c>i?"months":"years"}(r));const o=i||"days";return null!=n&&0!==n&&r&&0!==r.length?function(e,t,i){const a=e.getUTCFullYear()!==t.getUTCFullYear(),n=a||e.getUTCMonth()!==t.getUTCMonth(),r=n||e.getUTCDate()!==t.getUTCDate(),s=r||e.getUTCHours()!==t.getUTCHours(),o=s||e.getUTCMinutes()!==t.getUTCMinutes(),l=d[e.getUTCMonth()],c=e.getUTCDate(),m=e.getUTCFullYear(),h=u(e.getUTCHours()),p=u(e.getUTCMinutes()),g=u(e.getUTCSeconds());switch(i){case"seconds":return a?`${l} ${c}, ${m} ${h}:${p}:${g}`:r?`${l} ${c} ${h}:${p}:${g}`:s?`${h}:${p}:${g}`:o?`${p}:${g}`:":"+g;case"minutes":return a?`${l} ${c}, ${m} ${h}:${p}`:r?`${l} ${c} ${h}:${p}`:s?`${h}:${p}`:":"+p;case"hours":return a?`${l} ${c}, ${m} ${h}:00`:n?`${l} ${c} ${h}:${p}`:r?`${l} ${c} ${h}:00`:h+":00";case"days":return a?`${l} ${c}, ${m}`:n?`${l} ${c}`:""+c;case"months":return a?`${l} ${m}`:""+l;case"years":return""+m}}(s,new Date(r[n-1]),o):function(e,t){const i=d[e.getUTCMonth()],a=e.getUTCDate(),n=e.getUTCFullYear(),r=u(e.getUTCHours()),s=u(e.getUTCMinutes()),o=u(e.getUTCSeconds());switch(t){case"seconds":return`${i} ${a}, ${n} ${r}:${s}:${o}`;case"minutes":case"hours":return`${i} ${a}, ${n} ${r}:${s}`;case"days":return`${i} ${a}, ${n}`;case"months":return`${i} ${n}`;case"years":return""+n}}(s,o)}}function h(e,t=.5){const i=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!i)return e;const a=Math.round(parseInt(i[1],16)*(1-t)),n=Math.round(parseInt(i[2],16)*(1-t)),r=Math.round(parseInt(i[3],16)*(1-t));return`#${a.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}function p(e,t=.5){const i=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!i)return e;const a=Math.round(parseInt(i[1],16)+(255-parseInt(i[1],16))*t),n=Math.round(parseInt(i[2],16)+(255-parseInt(i[2],16))*t),r=Math.round(parseInt(i[3],16)+(255-parseInt(i[3],16))*t);return`#${a.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}`}var g=new Set(["LineChart","AreaChart","DifferenceChart","StackedAreaChart","Scatterplot","ConnectedScatterplot","BubbleChart","QuadrantChart","MultiAxisLineChart","CandlestickChart","Heatmap","MinimapChart","RealtimeLineChart","RealtimeHeatmap"]),f=new Set(["BarChart","StackedBarChart","GroupedBarChart","SwarmPlot","BoxPlot","Histogram","ViolinPlot","DotPlot","RidgelinePlot","FunnelChart","LikertChart","SwimlaneChart"]),y={Scatterplot:["pointRadius","hoverRadius"],BubbleChart:["pointRadius","hoverRadius"],ConnectedScatterplot:["pointRadius","hoverRadius"],QuadrantChart:["pointRadius","hoverRadius"],SwarmPlot:["pointRadius","hoverRadius"],DotPlot:["dotRadius","hoverRadius"]};function b(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function v(e){return"string"==typeof e&&e.trim().length>0}function x(e){const t=b(e.capability)?e.capability:null,i=b(e.recipe)?e.recipe:null,a=[e.mobileSemantics,e.mobileVisualization,e.mobile,t?.mobile,i?.mobile];for(const e of a)if(b(e))return e;return null}function w(e){return Array.isArray(e)&&e.length>=2&&"number"==typeof e[0]&&"number"==typeof e[1]&&Number.isFinite(e[0])&&Number.isFinite(e[1])?[e[0],e[1]]:null}function k(e){return w(e.size)||w(b(e.frameProps)?e.frameProps.size:void 0)||("number"==typeof e.width&&"number"==typeof e.height?[e.width,e.height]:null)}function $(e,t){e.push({...t,status:"pass"})}function C(e,t){e.push({...t,status:"warn"})}function A(e,t){e.push({...t,status:"manual"})}function S(e,t={},i={}){const a=i.viewportWidth??390,n=i.targetSize??44,s=k(t),o=r(t,{width:a,height:s?.[1]}),l=[],c=k(t=o.props),u=x(t),d=function(e,t){return e.includes("CustomChart")||e.includes("Custom")||null!=t.recipeId||null!=t.mobileSemantics}(e,t),m=function(e){const t=x(e);return!0===e.responsive||!0===e.mobile||!0===t?.responsive||!0===t?.supportsResponsiveLayout||Array.isArray(t?.breakpoints)||"number"==typeof t?.minViewportWidth||"responsive"===t?.strategy||"small-multiples"===t?.strategy||"summary-cards"===t?.strategy||null!=e.mobileLayout||null!=e.responsiveRules||"mobile-readable"===e.density}(t),h=!0===i.inChartContainer,p=v(t.title)||v(t.summary)||v(t.description)||!0===u?.summary||v(u?.summary);if(o.matches.length>0&&$(l,{id:"layout.responsive-rule-applied",category:"layout",impact:"medium",message:`${o.matches.length} responsive rule(s) applied for the ${a}px mobile audit.`}),c){const[t,i]=c;t>a&&!m?C(l,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:`Chart size is ${t}px wide against a ${a}px mobile viewport with no responsive/mobile transform hint.`,fix:"Use responsive sizing, responsiveRules/mobileLayout, or an explicit mobile variant that preserves the task instead of clipping the desktop chart."}):$(l,{id:"layout.fixed-desktop-size",category:"layout",impact:"high",message:"No fixed desktop-width overflow risk is visible from the config."}),"number"==typeof u?.minViewportWidth&&u.minViewportWidth>a&&C(l,{id:"layout.mobile-min-width",category:"layout",impact:"high",message:`The declared mobile contract supports ${u.minViewportWidth}px minimum, wider than the audited ${a}px viewport.`,fix:"Add a narrower breakpoint, summary-card fallback, or explicit horizontal-scroll affordance with a non-visual equivalent."});const n=t/Math.max(1,i);430>=a&&n>2.4&&"BigNumber"!==e&&C(l,{id:"layout.wide-aspect-ratio",category:"layout",impact:"medium",message:`Chart aspect ratio is ${n.toFixed(1)}:1, which tends to compress phone charts vertically.`,fix:"Prefer stacked sections, small multiples, cards plus a sparkline, or a taller mobile-specific chart ratio."}),160>i&&"BigNumber"!==e&&C(l,{id:"layout.too-short-for-reading",category:"layout",impact:"medium",message:`Chart height is ${i}px; most phone charts need enough vertical room for marks plus readable labels.`,fix:"Reserve more vertical space, remove nonessential axes, or switch to a card/sparkline pattern with external labels."})}else A(l,{id:"layout.unknown-size",category:"layout",impact:"medium",message:"No explicit size is available to audit. This may be responsive, but static mobile overflow cannot be checked.",fix:"Audit rendered widths at 320, 360, 390, and 430px, or pass size/responsiveRules metadata into the config."});const w=function(e){const t=[e.data,e.points,e.lines,e.nodes,e.edges,e.areas,b(e.frameProps)?e.frameProps.data:void 0];let i=0;for(const e of t)Array.isArray(e)&&(i+=e.length);return i}(t);w>0&&(w>("number"==typeof u?.maxMarks?u.maxMarks:g.has(e)?1.25*a:f.has(e)?Math.max(8,Math.floor(a/34)):a)?C(l,{id:"density.mark-budget",category:"density",impact:g.has(e)?"medium":"high",message:`${w} data item(s) exceed the rough mobile density budget for ${e} at ${a}px.`,fix:"Aggregate, filter, facet into small multiples, switch to a summary-card plus detail view, or use progressive disclosure."}):$(l,{id:"density.mark-budget",category:"density",impact:"medium",message:w+" data item(s) are within the rough mobile density budget for this component."}));const S=function(e){const t=[e.tickValues,e.xTickValues,e.yTickValues,e.rTickValues,e.oTickValues];let i=0;for(const e of t)Array.isArray(e)&&(i+=e.length);return i>0?i:null}(t),M=!1!==t.showAxes&&!1!==t.axis;if(M&&null!=S){const e=Math.max(3,Math.floor(a/58));S>e&&C(l,{id:"density.explicit-tick-count",category:"density",impact:"medium",message:`${S} explicit tick(s) exceed a phone-friendly budget of about ${e} at ${a}px.`,fix:"Use adaptive ticks, fewer tickValues, direct labels, or move exact values into a tap-accessible detail panel."})}else M&&(g.has(e)||f.has(e))&&A(l,{id:"density.axis-label-collision",category:"density",impact:"medium",message:"Axes are enabled, but label collision depends on rendered tick text and cannot be checked statically.",fix:"Verify tick labels at phone widths or provide explicit mobile tick density."});!function(e){const t=b(e.frameProps)?e.frameProps:{};return(!0===e.enableHover||null!=e.tooltipContent||null!=e.tooltip||null!=t.tooltipContent||!0===t.enableHover)&&!function(e){const t=x(e),i=b(e.mobileInteraction)?e.mobileInteraction:null;return null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||null!=e.selection||null!=e.onClick||null!=e.onSelect||!0===e.mobileInteraction||!0===i?.tapToSelect||!0===i?.tapToLockTooltip||Array.isArray(t?.interaction?.alternatives)&&t.interaction.alternatives.length>0||"tap"===t?.interaction?.primary||"button"===t?.interaction?.primary||v(t?.interaction?.hoverFallback)}(e)}(t)?$(l,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"No hover-only detail path is visible from the config."}):C(l,{id:"interaction.hover-only-detail",category:"interaction",impact:"high",message:"The chart exposes tooltip/hover detail without an obvious tap, selection, or control alternative.",fix:"Enable tap-to-select, a persistent details panel, visible segment buttons, or another non-hover path for the same information."});const T=function(e,t){const i=y[e];if(!i)return null;let a=i.includes("hoverRadius")?30:null;for(const e of i){const i=t[e];"number"==typeof i&&Number.isFinite(i)&&i>0&&(a=null==a?i:Math.max(a,i))}return null==a?null:2*a}(e,t),R=b(t.mobileInteraction)?t.mobileInteraction:null,I=T??("number"==typeof R?.targetSize?R.targetSize:!0===t.mobileInteraction?44:"number"==typeof u?.minimumHitTarget?u.minimumHitTarget:"number"==typeof u?.interaction?.targetSize?u.interaction.targetSize:null);null!=I&&(24>I?C(l,{id:"interaction.target-size-minimum",category:"interaction",impact:"high",message:`Small interactive marks expose an estimated ${I}px pointer target, below WCAG's 24px minimum.`,fix:"Increase mark radius/hoverRadius, add tap snapping to nearest datum, or provide larger external controls."}):n>I?C(l,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${I}px, above 24px but below the ${n}px comfortable phone target.`,fix:"Use hoverRadius/tapRadius near 44px while keeping the visible mark small if needed."}):$(l,{id:"interaction.target-size-comfort",category:"interaction",impact:"medium",message:`Pointer target is about ${I}px, meeting the configured ${n}px target.`}));const z=[];null==t.brush&&null==t.onBrush||z.push("brush"),!0===t.zoomable&&z.push("pan/zoom"),"isolate"!==t.legendInteraction&&"highlight"!==t.legendInteraction||z.push("legend filtering"),z.length>0&&!function(e,t){const i=x(e),a=b(e.mobileInteraction)?e.mobileInteraction:null,n=a?.standardControls;return!!(null!=e.controls||null!=e.mobileControls||!0===e.alternativeControls||Array.isArray(i?.interaction?.alternatives)&&i.interaction.alternatives.length>0)||!0===n||"all"===n||t.every(e=>"brush"===e?Array.isArray(n)?n.includes("brush"):"brush"===n:"pan/zoom"===e?Array.isArray(n)?n.includes("zoom"):"zoom"===n:"legend filtering"===e&&(Array.isArray(n)?n.includes("legend"):"legend"===n))}(t,z)&&C(l,{id:"interaction.complex-gesture-alternative",category:"interaction",impact:"high",message:`Mobile-hostile complex interaction detected: ${z.join(", ")} without standard control alternatives.`,fix:"Pair gestures with buttons, range inputs, chips, or a details panel that works with touch and keyboard."}),!1===t.showLegend||!1===t.legend||!0!==t.showLegend&&!0!==t.legend&&null==t.colorBy&&null==t.groupBy&&null==t.lineBy&&null==t.areaBy&&null==t.stackBy||!0===t.directLabel||!0===t.showLabels||"direct"===t.labelStrategy||"direct-end"===t.labelStrategy||"direct"===u?.labels?.strategy||"inline"===u?.labels?.strategy||"external"===u?.labels?.strategy||a>430||C(l,{id:"semantics.legend-over-direct-labels",category:"semantics",impact:"medium",message:"The chart appears to rely on a legend instead of direct labels at phone width.",fix:"Prefer direct end labels, inline labels, or a compact chip selector so readers do not bounce between plot and legend."});const P=Array.isArray(t.annotations)?t.annotations.filter(e=>b(e)):[];if(P.length>("number"==typeof u?.maxAnnotations?u.maxAnnotations:3)&&430>=a&&C(l,{id:"annotation.mobile-density",category:"annotation",impact:"medium",message:P.length+" annotation(s) compete for phone plot space.",fix:"Assign annotation priority, collapse secondary notes into a callout list, or provide shorter mobileText."}),P.length>0){const e=P.filter(e=>!v(e.mobileText)&&!v(e.shortText)&&!v(e.label));e.length>0&&A(l,{id:"annotation.mobile-copy",category:"annotation",impact:"low",message:e.length+" annotation(s) lack explicit short/mobile copy.",fix:"Add mobileText or shortText for notes that need to survive narrow layouts."})}m||"BigNumber"===e||A(l,{id:"layout.no-responsive-transform",category:"layout",impact:"low",message:"No explicit responsive transformation hint is present.",fix:"Declare responsiveRules/mobileLayout or a density/label strategy so the mobile version is a designed transformation, not an accidental resize."}),d&&(u?($(l,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart/recipe provides a mobileSemantics/mobile contract, so the audit can inspect its authored phone behavior."}),!1===u.custom?.dataBearingSceneNodes?C(l,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"medium",message:"Custom mobile contract says emitted scene nodes are not data-bearing.",fix:"Preserve datum references, semantic roles, or accessible-table fields so intelligence, navigation, and tap details can recover the chart's meaning."}):!0!==u.custom?.dataBearingSceneNodes&&A(l,{id:"semantics.custom-data-bearing-scene",category:"semantics",impact:"low",message:"Custom chart mobile contract does not state whether scene nodes are data-bearing.",fix:"Set mobile.custom.dataBearingSceneNodes and mobile.custom.navigationGranularity for custom layouts and interoperability adapters."})):A(l,{id:"semantics.custom-mobile-contract",category:"semantics",impact:"medium",message:"Custom chart layout is opaque to static mobile analysis because no mobileSemantics/mobile contract is present.",fix:"Declare mobileSemantics with strategy, breakpoints, mark budgets, touch target size, interaction alternatives, and custom scene semantics."})),p||h||C(l,{id:"semantics.no-mobile-summary",category:"semantics",impact:"medium",message:"No title, summary, description, or ChartContainer context is visible from the config.",fix:"Add title/summary text or wrap in ChartContainer so the small-screen reader gets the task before the chart."});const U=l.filter(e=>"warn"===e.status),N={highRisk:U.filter(e=>"high"===e.impact).length,warnings:U.length,manual:l.filter(e=>"manual"===e.status).length,passes:l.filter(e=>"pass"===e.status).length};return{component:e,viewportWidth:a,ok:0===N.highRisk,summary:N,findings:l,reference:"Mobile visualization audit: informed by MobileVisFixer, mobile exploratory interaction research, small-multiple mobile studies, responsive visualization grammars, constraint-based breakpoints, and WCAG 2.2 input modalities."}}var M={pass:"PASS",warn:"WARN",manual:"MANUAL","not-applicable":"N/A"},T=["layout","density","interaction","annotation","semantics"];function R(e){const t=[],i=e.summary,a=e.ok?`no high-risk mobile blockers at ${e.viewportWidth}px`:`${i.highRisk} high-risk mobile issue(s) at ${e.viewportWidth}px`;t.push(`${e.ok?"PASS":"WARN"} ${e.component}: mobile visualization audit`),t.push(` ${a} - ${i.warnings} warning(s) - ${i.manual} manual check(s)`);for(const i of T){const a=e.findings.filter(e=>e.category===i&&"not-applicable"!==e.status);if(0!==a.length){t.push(""),t.push(" "+i.toUpperCase());for(const e of a)t.push(` ${M[e.status]} [${e.impact}] ${e.id}: ${e.message}`),!e.fix||"warn"!==e.status&&"manual"!==e.status||t.push(" -> "+e.fix)}}return t.push(""),t.push(" Ref: "+e.reference),t.join("\n")}function I(){return["Static audit only: rendered label collision, CSS-resolved type size, and actual touch behavior still require viewport testing.","Use multiple widths, usually 320, 360, 390, 430, and 768 CSS pixels.","A mobile pass means no high-risk static warnings, not that the chart is perceptually or ergonomically optimal."]}function z(e){const t={};for(const[i,a]of e){const e=[];for(const[,t]of a.clauses){const i={};for(const[e,a]of Object.entries(t.fields))i[e]="point"===a.type?{type:"point",values:Array.from(a.values)}:{type:"interval",range:a.range};e.push({clientId:t.clientId,type:t.type,fields:i})}t[i]={name:a.name,resolution:a.resolution,clauses:e}}return t}function P(e){const t=new Map;for(const[i,a]of Object.entries(e)){const e=new Map;for(const t of a.clauses){const i={};for(const[e,a]of Object.entries(t.fields))i[e]="point"===a.type?{type:"point",values:new Set(a.values)}:{type:"interval",range:a.range};e.set(t.clientId,{clientId:t.clientId,type:t.type,fields:i})}t.set(i,{name:a.name,resolution:a.resolution,clauses:e})}return t}async function U(e,t){const{format:i="png",filename:a="chart",scale:n=2,background:r="white"}=t||{},s=e.querySelector("svg");if(!s)throw Error("No SVG element found in the container");const o=s.cloneNode(!0),l=s.getBoundingClientRect();if(o.getAttribute("width")||o.setAttribute("width",l.width+""),o.getAttribute("height")||o.setAttribute("height",l.height+""),o.getAttribute("xmlns")||o.setAttribute("xmlns","http://www.w3.org/2000/svg"),N(s,o),"svg"===i){const e=(new XMLSerializer).serializeToString(o);F(new Blob([e],{type:"image/svg+xml;charset=utf-8"}),a+".svg")}else{const t=l.width*n,i=l.height*n,s=document.createElement("canvas");s.width=t,s.height=i;const c=s.getContext("2d");c.fillStyle=r,c.fillRect(0,0,t,i),c.scale(n,n);const u=e.querySelector("canvas");u&&c.drawImage(u,0,0,l.width,l.height);const d=(new XMLSerializer).serializeToString(o),m=new Blob([d],{type:"image/svg+xml;charset=utf-8"}),h=URL.createObjectURL(m),p=new Image;p.width=l.width,p.height=l.height,await new Promise((e,t)=>{p.onload=()=>{c.drawImage(p,0,0),s.toBlob(i=>{i?(F(i,a+".png"),e()):t(Error("Failed to create PNG blob"))},"image/png"),URL.revokeObjectURL(h)},p.onerror=()=>{URL.revokeObjectURL(h),t(Error("Failed to load SVG image"))},p.src=h})}}function N(e,t){const i=e.children,a=t.children,n=window.getComputedStyle(e),r=["fill","stroke","stroke-width","stroke-dasharray","opacity","fill-opacity","stroke-opacity","font-family","font-size","font-weight","text-anchor","dominant-baseline"];for(const e of r){const i=n.getPropertyValue(e);i&&"none"!==i&&""!==i&&t.style?.setProperty(e,i)}for(let e=0;Math.min(i.length,a.length)>e;e++)N(i[e],a[e])}function F(e,t){const i=URL.createObjectURL(e),a=document.createElement("a");a.href=i,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}function L(e){const t=e.pointId??e.id??e._transitionKey;return null==t||""===t?void 0:t+""}function D(e){return e.accessibility?.tableFields??e.accessibleDatum??e.datum??null}function B(e){return"number"==typeof e&&Number.isFinite(e)}function j(e){if(B(e.x)&&B(e.y)&&B(e.w)&&B(e.h))return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y+e.h};if(B(e.x)&&B(e.y)&&B(e.r))return{x0:e.x-e.r,y0:e.y-e.r,x1:e.x+e.r,y1:e.y+e.r};if(B(e.cx)&&B(e.cy)&&B(e.r))return{x0:e.cx-e.r,y0:e.cy-e.r,x1:e.cx+e.r,y1:e.cy+e.r};if(B(e.cx)&&B(e.cy)&&B(e.outerR))return{x0:e.cx-e.outerR,y0:e.cy-e.outerR,x1:e.cx+e.outerR,y1:e.cy+e.outerR};const t=[e.path,e.topPath,e.bottomPath].filter(Array.isArray).flat().filter(e=>Array.isArray(e)&&B(e[0])&&B(e[1]));return t.length>0?{x0:Math.min(...t.map(e=>e[0])),y0:Math.min(...t.map(e=>e[1])),x1:Math.max(...t.map(e=>e[0])),y1:Math.max(...t.map(e=>e[1]))}:null}function V(e,t){const i=Math.max(0,Math.min(e.x1,t.x1)-Math.max(e.x0,t.x0))*Math.max(0,Math.min(e.y1,t.y1)-Math.max(e.y0,t.y0)),a=Math.min(Math.max(0,e.x1-e.x0)*Math.max(0,e.y1-e.y0),Math.max(0,t.x1-t.x0)*Math.max(0,t.y1-t.y0));return a>0?i/a:0}function q(e,i,a,n,r){if(e===i)return!0;const s=a.dataRoles.map(e=>t(e,n,r)).filter(e=>!!e).filter(t=>null!=e[t]&&null!=i[t]);return s.length>0&&s.every(t=>e[t]+""==i[t]+"")}function W(e,t,i,a,n,r="warn",s){return{id:e,category:t,status:i?"pass":r,message:i?a:n,...s?{evidence:s}:{}}}function E(r){const{recipe:s}=r,o=function(e){return Array.isArray(e)?e:e&&"object"==typeof e?[...e.nodes??e.sceneNodes??[],...e.sceneEdges??[]]:[]}(r.scene),l=r.layoutConfig??i({layoutConfig:r.layoutConfig}),c=r.dimensions.plot??{x:0,y:0,width:r.dimensions.width,height:r.dimensions.height},u=c.x??0,d=c.y??0,m=[],h=o.filter(e=>null!=D(e)),p=o.filter(e=>!("string"!=typeof e.pathD||!/NaN|Infinity|undefined/.test(e.pathD))||function(e){return[...[e.x,e.y,e.w,e.h,e.r,e.cx,e.cy,e.innerR,e.outerR,e.x1,e.x2,e.y1,e.y2,e.openY,e.closeY,e.highY,e.lowY,e.bodyWidth].filter(e=>void 0!==e),...[e.path,e.topPath,e.bottomPath].filter(Array.isArray).flat(2)]}(e).some(e=>"number"!=typeof e||!Number.isFinite(e)));m.push(W("geometry.finite","geometry",0===p.length,"All emitted geometry is finite.",p.length+" marks contain non-finite geometry.","fail",{count:p.length}));const g=o.map(j),f=g.filter(e=>e&&(e.x0>=e.x1||e.y0>=e.y1)).length;m.push(W("geometry.nonzero-area","geometry",0===f,"All bounded marks have positive area.",f+" marks have zero or negative area.","warn",{count:f}));const y=g.filter(e=>e&&(u>e.x0||d>e.y0||e.x1>u+c.width||e.y1>d+c.height)).length;m.push(W("geometry.bounds","geometry",0===y,"All bounded marks stay inside the plot.",y+" marks extend outside the plot bounds.","warn",{count:y}));const b=s.audit?.minimumHitTargetSize??s.accessibility.minimumHitTarget??24,v=g.filter(e=>!!e&&(b>e.x1-e.x0||b>e.y1-e.y0)).length;m.push(W("interaction.target-size","interaction",0===v,`All bounded targets meet the declared ${b}px minimum.`,`${v} targets are smaller than ${b}px in at least one dimension.`,"warn",{count:v,minimumTarget:b}));const x=h.map(L),w=x.filter(e=>!e).length,k=new Set,$=x.filter(e=>!(!e||!k.has(e)&&(k.add(e),1)));m.push(W("identity.stable-ids","identity",0===w,"Every data-bearing mark exposes a stable id.",w+" data-bearing marks have no pointId, id, or transition key.",s.audit?.requireStableIds?"fail":"warn",{missing:w})),m.push(W("identity.unique-ids","identity",0===$.length,"Stable mark ids are unique.",$.length+" duplicate stable ids were observed.","fail",{duplicates:[...new Set($)].slice(0,10)}));const C=x.filter(e=>e&&/^(datum|mark|node|point|rect)-?\d+$/.test(e)).length;C>0&&m.push({id:"identity.index-pattern",category:"identity",status:"warn",message:C+" ids look index-derived and may change when data is reordered.",remediation:"Derive ids from a declared identifier role or stable domain key."});const A=new Set;let S=0;const M=r.inputData;for(const e of h){const t=D(e),i=Array.isArray(t)?t:[t];let a=!1;for(const e of i)if(e&&"object"==typeof e)for(let t=0;M.length>t;t+=1)q(e,M[t],s,l,M)&&(A.add(t),a=!0);a||(S+=1)}const T=Math.max(0,M.length-A.size);m.push(W("coverage.input-data","coverage",0===T,"Every input datum is represented by the observed scene.",T+" input data items have no matching scene mark.",s.audit?.requireDatumCoverage?"fail":"warn",{represented:A.size,input:M.length})),m.push(W("coverage.scene-data","coverage",0===S,"Every data-bearing scene mark maps back to input data.",S+" scene marks do not map back to an input datum.","warn",{count:S}));const R=s.encodings?.some(e=>"count"===e.channel);!R&&h.length>A.size&&A.size>0&&m.push({id:"coverage.duplicate-references",category:"coverage",status:"warn",message:"Input data is referenced by multiple marks, but multiplicity is not declared as an encoding.",remediation:"Declare count/repetition semantics or preserve a one-to-one datum-to-mark mapping."});const I=h.filter(e=>!1===e.interactive).length;m.push(W("interaction.hit-targets","interaction",0===I&&h.length>0,"Every observed data-bearing scene node participates in hit testing.",0===h.length?"No data-bearing scene nodes were emitted for interaction.":I+" data-bearing marks explicitly disable interaction.","fail"));const z=(r.annotations??[]).map(e=>e.pointId).filter(e=>null!=e).map(String),P=z.filter(e=>!k.has(e));m.push(W("coverage.annotation-anchors","coverage",0===P.length,z.length?"All pointId annotation anchors resolve to observed scene nodes.":"No pointId annotations require scene resolution.",P.length+" annotations point to missing scene ids.","fail",{unresolved:P}));const U=(r.chart?.selectedIds??[]).filter(e=>!k.has(e));r.chart?.selectedIds&&m.push(W("interaction.selection-reachability","interaction",0===U.length,"Selected/highlighted states resolve to observed marks.",U.length+" selected ids are not reachable in the scene.","fail",{missing:U}));const N=n(o),F=(s.accessibility.tableFields??s.accessibility.tableRoles?.map(e=>({role:e,label:e}))??[]).map(e=>{if(e.field)return e.field;const i=e.role?s.dataRoles.find(t=>t.role===e.role):void 0;return i?t(i,l,M):void 0}).filter(e=>!!e),B=new Set(N.flatMap(e=>Object.keys(e.values))),E=F.filter(e=>!B.has(e));m.push(W("accessibility.table-fields","accessibility",0===E.length,F.length?"The accessible table preserves all recipe-declared fields.":"The recipe declares no explicit accessible table field projection.",`The accessible table loses declared fields: ${E.join(", ")}.`,"fail",{expectedFields:F,observedFields:[...B]})),new Set(M.flatMap(e=>Object.entries(e).filter(([,e])=>["string","number","boolean"].includes(typeof e)).map(([e])=>e))).size>2&&2>=B.size&&[...B].every(e=>"category"===e||"value"===e)&&m.push({id:"accessibility.generic-table-loss",category:"accessibility",status:"warn",message:"The table exposes only generic category/value fields although richer input data exists.",remediation:"Emit accessibleDatum or accessibility.tableFields on scene nodes."});const H=(s.encodings?.filter(e=>"color"===e.channel)??[]).filter(e=>!e.redundantWith||0===e.redundantWith.length);m.push(W("accessibility.color-only","accessibility",0===H.length,"Every declared color encoding names a redundant cue.",H.length+" color encodings have no declared redundant cue.","warn"));const O=r.chart;if(O){for(const[e,t]of[["title",s.accessibility.requiresTitle],["summary",s.accessibility.requiresSummary],["description","required"===s.accessibility.description]])t&&m.push(W("accessibility."+e,"accessibility","string"==typeof O[e]&&O[e].trim().length>0,`A chart ${e} is present.`,`The recipe requires a chart ${e}, but none was supplied.`,"fail"));(s.accessibility.requiresAccessibleTable||"required"===s.accessibility.accessibleTable||s.accessibility.fallbackTable)&&m.push(W("accessibility.fallback-table","accessibility",!1!==O.accessibleTable,"The accessible fallback table is enabled.","The recipe requires a fallback table, but accessibleTable is disabled.","fail")),O.navigationTree&&m.push(W("accessibility.navigation-depth","accessibility",(O.navigationTree.children?.length??0)>0,"The navigation tree exposes structure below the root.","The navigation tree is root-only.","fail"))}const Y=r.theme?.background??"#ffffff",G=o.filter(t=>{const i=t.style?.fill??t.fill;if("string"!=typeof i||!i.startsWith("#")||!Y.startsWith("#"))return!1;const a=e(i,Y);return null!=a&&3>a}).length;m.push(W("visual.contrast","visual",0===G,"All statically checkable mark fills meet 3:1 contrast.",G+" marks have fill contrast below 3:1.","warn",{background:Y}));let J=0;const X=g.filter(e=>!!e).slice(0,500);for(let e=0;X.length>e;e+=1)for(let t=e+1;X.length>t;t+=1).8>V(X[e],X[t])||(J+=1);J>X.length&&m.push({id:"visual.overlap-density",category:"visual",status:"warn",message:J+" near-total mark overlaps suggest occlusion or excessive density.",remediation:"Aggregate, jitter, layer explicitly, or declare overlap as intentional."});const K=[["manual-at.screen-reader","Verify real screen-reader behavior with the target browser/AT combinations."],["manual-at.cognitive-load","Assess cognitive load and whether the custom metaphor is understood."],["manual-at.keyboard-order","Verify that keyboard order is meaningful, not merely mechanically available."],["manual-at.animation","Verify that animation is not distracting and reduced-motion behavior is sufficient."],["manual-at.reception","Test whether the memorable form is received as intended by the target audience."],["manual-at.overlay-occlusion","Inspect labels, overlays, annotations, and important marks for clipping or occlusion."],["manual-at.observation","Exercise hover, focus, selection, and observation emission in the rendered chart."]].map(([e,t])=>({id:e,category:"manual-at",status:"manual",message:t})),Q={dataRoles:s.dataRoles.map(e=>e.role),intents:s.intents.map(a).filter(e=>!!e),accessibilityExpectations:[...s.accessibility.requirements??[],...s.accessibility.tableFields?.map(e=>"table field: "+e.label)??[]],fallbackDeclared:!0===s.accessibility.fallbackTable||"required"===s.accessibility.accessibleTable||!0===s.accessibility.requiresAccessibleTable,designContractDeclared:!!s.designContract?.whyCustom},_=[...m,...K],Z=m.filter(e=>"fail"===e.status).length;return{recipeId:s.id,ok:0===Z,summary:{marks:o.length,passes:_.filter(e=>"pass"===e.status).length,warnings:_.filter(e=>"warn"===e.status).length,failures:Z,manual:_.filter(e=>"manual"===e.status).length},declaredSemantics:Q,observedSceneEvidence:m,manualATChecks:K}}function H(e=240){const t=360-e,i=180+t/2,a=i*Math.PI/180;return{sweepRad:e*Math.PI/180,gapDeg:t,startAngleDeg:i,startAngleRad:a,offsetRad:-Math.PI/2+a}}function O(e,t,i,a,n){const r=i-t||1;return n+(Math.max(t,Math.min(i,e))-t)/r*a}function Y(e=240){const{sweepRad:t,offsetRad:i}=H(e),a=[[Math.cos(i),Math.sin(i)],[Math.cos(i+t),Math.sin(i+t)],[0,0]];for(let e=0;2*Math.PI>e;e+=Math.PI/2)((e-i)%(2*Math.PI)+2*Math.PI)%(2*Math.PI)>t+.001||a.push([Math.cos(e),Math.sin(e)]);const n=a.map(e=>e[0]),r=a.map(e=>e[1]),[o,l]=s(n),[c,u]=s(r);return{minX:o,maxX:l,minY:c,maxY:u,width:l-o,height:u-c,cx:(o+l)/2,cy:(c+u)/2}}export{l as smartTickFormat,m as adaptiveTimeTicks,h as darkenColor,p as lightenColor,S as auditMobileVisualization,R as formatMobileVisualizationAudit,I as mobileVisualizationCaveats,z as serializeSelections,P as deserializeSelections,U as exportChart,E as auditObservedScene,H as sweepToAngles,O as valueToAngle,Y as computeArcBoundingBox};
@@ -1 +0,0 @@
1
- function t(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function e(e,n,r=e.responsiveRules){if(!Array.isArray(r)||0===r.length)return{props:e,matches:[]};const i=r.map((t,e)=>({rule:t,index:e})).filter(t=>function(t,e){const{when:n}=t,r=e.width,i=e.height,o=function(t){if("number"==typeof t.height&&t.height>0)return t.width/t.height}(e),a=function(t){if("number"==typeof t.height&&t.height>0)return t.height>t.width?"portrait":"landscape"}(e);return!("number"==typeof n.minWidth&&n.minWidth>r||"number"==typeof n.maxWidth&&r>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof i||n.minHeight>i)||"number"==typeof n.maxHeight&&("number"!=typeof i||i>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof o||n.minAspectRatio>o)||"number"==typeof n.maxAspectRatio&&("number"!=typeof o||o>n.maxAspectRatio)||n.orientation&&a!==n.orientation)}(t.rule,n)).sort((t,e)=>("number"==typeof t.rule.priority?t.rule.priority:t.index)-("number"==typeof e.rule.priority?e.rule.priority:e.index));return{props:i.reduce((e,n)=>function(e,n){const r={...e,...n};for(const i of["margin","frameProps","mobileSemantics","style"])t(e[i])&&t(n[i])&&(r[i]={...e[i],...n[i]});return"string"==typeof e.className&&"string"==typeof n.className&&(r.className=`${e.className} ${n.className}`),r}(e,n.rule.transform),e),matches:i}}function n(t,e){return t===e}function r(t,e){if("function"==typeof t)return e=>+t(e);const n=t||e;return t=>+t[n]}function i(t,e){if("function"==typeof t)return t;const n=t||e;return t=>t[n]}function o(t,e){return"function"==typeof t?t:t?e=>e[t]+"":e?t=>t[e]+"":void 0}var a=new Set(["label","callout","callout-circle","callout-rect","text","widget"]),u=new Set(["label","callout","callout-circle","callout-rect"]);function s(t){return"string"==typeof t?.type?t.type:""}function c(t){return!!t&&"object"==typeof t&&a.has(s(t))}function f(t){return u.has(s(t))&&!function(t){return Array.isArray(t?.disable)&&t.disable.includes("connector")}(t)}function m(t){let e=t>>>0;return function(){e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function l(t){return"primary"===t?.emphasis||!0===t?.defensive}function h(t,e,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):t>0&&e>0?Math.max(1,Math.round(t*e/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function p(t){let e;const n=t?.emphasis;e="primary"===n?100:"secondary"===n?10:50;const r=t?.provenance?.confidence;switch("number"==typeof r&&Number.isFinite(r)&&(e+=15*Math.max(0,Math.min(1,r))),t?.lifecycle?.freshness){case"fresh":e+=8;break;case"aging":e+=4;break;case"stale":e+=1;break;case"expired":e-=200}return e}function y(t){const{annotations:e,width:n,height:r}=t,i=Math.max(0,t.minVisible??1),o=h(n,r,t),a=e.map((t,e)=>{return{annotation:t,index:e,note:(n=t,c(n))};var n}),u=a.filter(t=>t.note);if(0===u.length||o>=u.length)return{visible:e.slice(),deferred:[],budget:o};const s=u.filter(t=>l(t.annotation)),f=u.filter(t=>!l(t.annotation)).sort((t,e)=>p(e.annotation)-p(t.annotation)||t.index-e.index),m=Math.min(f.length,Math.max(Math.max(0,o-s.length),Math.max(0,i-s.length))),y=new Set([...s.map(t=>t.index),...f.slice(0,m).map(t=>t.index)]),d=[],b=[];for(const{annotation:t,index:e,note:n}of a)!n||y.has(e)?d.push(t):b.push(t);return{visible:d,deferred:b,budget:o}}export{e as resolveResponsiveRules,m as mulberry32,n as accessorsEquivalent,r as resolveAccessor,i as resolveRawAccessor,o as resolveStringAccessor,s as annotationType,c as isNoteAnnotation,f as annotationDrawsConnector,h as annotationBudget,y as annotationDensity};