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.
- package/CLAUDE.md +9 -9
- package/README.md +42 -40
- package/ai/examples.md +1 -1
- package/ai/schema.json +2726 -300
- package/ai/surface-manifest.json +1 -1
- package/ai/system-prompt.md +1 -1
- package/dist/chunk-chunk-2JGJ5GUG.module.min.js +0 -1
- package/dist/chunk-chunk-3ILKBVVQ.module.min.js +1 -0
- package/dist/{chunk-chunk-NO4MCQVD.module.min.js → chunk-chunk-5RKXZQ2P.module.min.js} +1 -1
- package/dist/{chunk-chunk-CYIML3AV.module.min.js → chunk-chunk-6TPGFL7M.module.min.js} +1 -1
- package/dist/{chunk-chunk-VVCA3DB7.module.min.js → chunk-chunk-7ALTGHK6.module.min.js} +1 -1
- package/dist/chunk-chunk-7KZJUTKP.module.min.js +2 -0
- package/dist/chunk-chunk-7RYBCTK5.module.min.js +1 -0
- package/dist/chunk-chunk-ACLDBMRH.module.min.js +2 -0
- package/dist/chunk-chunk-ANYDWOZF.module.min.js +1 -0
- package/dist/{chunk-chunk-ZLKRTF5N.module.min.js → chunk-chunk-AQPQN2HH.module.min.js} +1 -1
- package/dist/chunk-chunk-ASKSE5F5.module.min.js +1 -0
- package/dist/chunk-chunk-AVBI6GDT.module.min.js +1 -0
- package/dist/chunk-chunk-B3DRZPBK.module.min.js +2 -0
- package/dist/chunk-chunk-BFHUYEOS.module.min.js +2 -0
- package/dist/chunk-chunk-C4YA6TDR.module.min.js +1 -0
- package/dist/chunk-chunk-C57LR3YG.module.min.js +1 -0
- package/dist/chunk-chunk-EMO5NUGE.module.min.js +1 -0
- package/dist/chunk-chunk-F5V4UIE6.module.min.js +2 -0
- package/dist/chunk-chunk-F7WFPD4O.module.min.js +2 -0
- package/dist/chunk-chunk-FBGHXL72.module.min.js +2 -0
- package/dist/chunk-chunk-FP44FHFO.module.min.js +2 -0
- package/dist/chunk-chunk-HKXUAEPJ.module.min.js +2 -0
- package/dist/chunk-chunk-ICEXPNDC.module.min.js +2 -0
- package/dist/chunk-chunk-IY7RYD4S.module.min.js +1 -0
- package/dist/{chunk-chunk-7LHMKRKE.module.min.js → chunk-chunk-JDXT6ORT.module.min.js} +1 -1
- package/dist/chunk-chunk-JMVEIZXP.module.min.js +1 -0
- package/dist/chunk-chunk-KHCOJMGK.module.min.js +1 -0
- package/dist/chunk-chunk-KQ546MKE.module.min.js +2 -0
- package/dist/chunk-chunk-LQBSXO7K.module.min.js +2 -0
- package/dist/chunk-chunk-LRIFN2HK.module.min.js +1 -0
- package/dist/chunk-chunk-MFHF4J2Z.module.min.js +1 -0
- package/dist/chunk-chunk-N6VKKF3A.module.min.js +2 -0
- package/dist/chunk-chunk-NEVE562N.module.min.js +1 -0
- package/dist/chunk-chunk-NKZ75IM5.module.min.js +2 -0
- package/dist/chunk-chunk-PLIDPQNG.module.min.js +2 -0
- package/dist/{chunk-chunk-FYY2ACNJ.module.min.js → chunk-chunk-PRDGLMJT.module.min.js} +1 -1
- package/dist/chunk-chunk-QGZGZI4X.module.min.js +1 -0
- package/dist/chunk-chunk-RP7WTID5.module.min.js +1 -0
- package/dist/chunk-chunk-S7KLNUO6.module.min.js +1 -0
- package/dist/chunk-chunk-SR4ZXOWR.module.min.js +2 -0
- package/dist/chunk-chunk-ZOAQDIJO.module.min.js +1 -0
- package/dist/chunk-minimapBrushOverlay-JU57U7NM.module.min.js +2 -0
- package/dist/chunk-scatterplotMatrixBrushOverlay-SDIZSN66.module.min.js +2 -0
- package/dist/chunk-statisticalOverlays-QGDLRUHX.module.min.js +1 -0
- package/dist/chunk-statisticalOverlays-T77OKLDY.module.min.js +1 -0
- package/dist/components/ChartContainer.d.ts +2 -2
- package/dist/components/ai/chartCapabilityTypes.d.ts +5 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +3 -0
- package/dist/components/charts/geo/ChoroplethMap.d.ts +2 -0
- package/dist/components/charts/geo/DistanceCartogram.d.ts +7 -3
- package/dist/components/charts/geo/FlowMap.d.ts +4 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +3 -1
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +6 -1
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +6 -1
- package/dist/components/charts/physics/gauntletChartProps.d.ts +7 -1
- package/dist/components/charts/physics/gauntletChrome.d.ts +2 -1
- package/dist/components/charts/physics/gauntletPhysics.d.ts +19 -4
- package/dist/components/charts/physics/gauntletRuntime.d.ts +3 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +12 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -6
- package/dist/components/charts/realtime/temporalHistogramConfig.d.ts +11 -0
- package/dist/components/charts/shared/areaSeriesData.d.ts +15 -0
- package/dist/components/charts/shared/chartMode.d.ts +75 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +2 -2
- package/dist/components/charts/shared/colorUtils.d.ts +8 -0
- package/dist/components/charts/shared/geoStyleDefaults.d.ts +3 -0
- package/dist/components/charts/shared/hatchPattern.d.ts +8 -3
- package/dist/components/charts/shared/hooks.d.ts +13 -80
- package/dist/components/charts/shared/lineSeriesSsr.d.ts +55 -0
- package/dist/components/charts/shared/types.d.ts +2 -2
- package/dist/components/charts/shared/useChartSetup.d.ts +3 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +3 -0
- package/dist/components/charts/shared/useXYLineStyle.d.ts +3 -2
- package/dist/components/charts/shared/validateProps.d.ts +1 -1
- package/dist/components/charts/shared/xyLineStyle.d.ts +21 -0
- package/dist/components/charts/xy/AreaChart.d.ts +10 -0
- package/dist/components/charts/xy/LineChart.d.ts +3 -0
- package/dist/components/charts/xy/minimapBrushOverlay.d.ts +17 -0
- package/dist/components/charts/xy/minimapBrushOverlayLazy.d.ts +4 -0
- package/dist/components/charts/xy/scatterplotMatrixBrushOverlay.d.ts +8 -0
- package/dist/components/charts/xy/scatterplotMatrixBrushOverlayLazy.d.ts +3 -0
- package/dist/components/legendLayout.d.ts +31 -0
- package/dist/components/realtime/types.d.ts +5 -0
- package/dist/components/recipes/gridObservatory.d.ts +176 -0
- package/dist/components/recipes/recipeChrome.d.ts +24 -0
- package/dist/components/recipes/sequenceLayout.d.ts +139 -0
- package/dist/components/semiotic-recipes-core.d.ts +6 -2
- package/dist/components/server/serverChartConfigShared.d.ts +29 -0
- package/dist/components/server/serverChartConfigs.d.ts +2 -13
- package/dist/components/server/serverChartConfigsXY.d.ts +3 -0
- package/dist/components/server/serverGaugeOverlay.d.ts +28 -0
- package/dist/components/server/staticAnnotations.d.ts +3 -1
- package/dist/components/server/staticLegend.d.ts +7 -1
- package/dist/components/server/staticSVGChrome.d.ts +57 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +2 -0
- package/dist/components/stream/GeoSVGOverlay.d.ts +2 -0
- package/dist/components/stream/SceneToSVG.d.ts +10 -8
- package/dist/components/stream/SceneToSVGGeo.d.ts +10 -0
- package/dist/components/stream/SceneToSVGNetwork.d.ts +12 -0
- package/dist/components/stream/SceneToSVGOrdinal.d.ts +12 -0
- package/dist/components/stream/canvasBackground.d.ts +7 -0
- package/dist/components/stream/networkFramePaint.d.ts +2 -0
- package/dist/components/stream/networkTypes.d.ts +2 -4
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +18 -2
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +7 -0
- package/dist/components/stream/physics/physicsPipelineEviction.d.ts +15 -0
- package/dist/components/stream/physics/physicsPipelineObservations.d.ts +1 -1
- package/dist/components/stream/physics/physicsPipelineQuiescence.d.ts +20 -0
- package/dist/components/stream/renderBackend.d.ts +14 -0
- package/dist/components/stream/sceneToSVGShared.d.ts +80 -0
- package/dist/components/stream/types.d.ts +4 -0
- package/dist/components/stream/useHydration.d.ts +7 -1
- package/dist/components/stream/xySceneBuilders/candlestickScene.d.ts +1 -1
- package/dist/components/types/legendTypes.d.ts +16 -3
- package/dist/forceLayoutWorker.js +1 -1
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/physicsWorker.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/rough.min.js +1 -1
- package/dist/rough.module.min.js +1 -1
- package/dist/semiotic-ai-core.min.js +1 -1
- package/dist/semiotic-ai-core.module.min.js +1 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +6 -2
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +3 -2
- package/dist/chunk-chunk-255KDHW5.module.min.js +0 -1
- package/dist/chunk-chunk-27HVVXS6.module.min.js +0 -1
- package/dist/chunk-chunk-2UN3ANRN.module.min.js +0 -2
- package/dist/chunk-chunk-2VUEY5TH.module.min.js +0 -1
- package/dist/chunk-chunk-2WVCH4PL.module.min.js +0 -1
- package/dist/chunk-chunk-5WEFWNUW.module.min.js +0 -2
- package/dist/chunk-chunk-6F6GEAQU.module.min.js +0 -1
- package/dist/chunk-chunk-BHYTYMY2.module.min.js +0 -2
- package/dist/chunk-chunk-C6EJ4IOD.module.min.js +0 -2
- package/dist/chunk-chunk-CP3EN6KZ.module.min.js +0 -1
- package/dist/chunk-chunk-DNY43POY.module.min.js +0 -1
- package/dist/chunk-chunk-E7MIQX7D.module.min.js +0 -2
- package/dist/chunk-chunk-ES4DCG3L.module.min.js +0 -1
- package/dist/chunk-chunk-FAKO3RGQ.module.min.js +0 -2
- package/dist/chunk-chunk-H4PPRW6N.module.min.js +0 -1
- package/dist/chunk-chunk-IFYPMWKY.module.min.js +0 -1
- package/dist/chunk-chunk-J3ELI22J.module.min.js +0 -1
- package/dist/chunk-chunk-L6D3I3V7.module.min.js +0 -2
- package/dist/chunk-chunk-M337NY6L.module.min.js +0 -1
- package/dist/chunk-chunk-ODUZEEBH.module.min.js +0 -2
- package/dist/chunk-chunk-P6UBCMSQ.module.min.js +0 -2
- package/dist/chunk-chunk-QRIBHZYW.module.min.js +0 -1
- package/dist/chunk-chunk-RH5TSQPH.module.min.js +0 -1
- package/dist/chunk-chunk-STZFFTAN.module.min.js +0 -2
- package/dist/chunk-chunk-T27ZEV6A.module.min.js +0 -1
- package/dist/chunk-chunk-U3AGQ5EF.module.min.js +0 -2
- package/dist/chunk-chunk-W3DB2MN4.module.min.js +0 -2
- package/dist/chunk-chunk-WDIN4LRC.module.min.js +0 -1
- package/dist/chunk-chunk-XOYX77KF.module.min.js +0 -2
- package/dist/chunk-chunk-Z5KXAVQD.module.min.js +0 -2
- package/dist/chunk-chunk-ZCNBUZPL.module.min.js +0 -2
- package/dist/chunk-chunk-ZTNVDWAK.module.min.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useReducedMotion as e,useTheme as t}from"./chunk-chunk-XEVJDUTH.module.min.js";import{annotationActivationProps as n,defaultTooltipStyle as r,extractAllRows as o,hatchPatternDef as i,isHatchFill as a,resolveHatchCanvasPattern as l,resolveResponsiveRules as s,resolveSvgFill as c,useObservationSelector as d}from"./chunk-chunk-JMVEIZXP.module.min.js";import{FrameRuntime as u,SEQUENTIAL_INTERPOLATORS as h,glyphFractionClipRect as f,glyphPlacement as y,isInBounds as m,resolveAnchoredPosition as p,resolveGlyphPaint as g,resolveX as b,resolveY as x,schemeCategory10 as v,schemeSet3 as k,schemeTableau10 as w,symbolPathString as $}from"./chunk-chunk-5RKXZQ2P.module.min.js";import{getMinMax as M}from"./chunk-chunk-JJ2OOIET.module.min.js";import{clearCSSColorCache as S,resolveCSSColor as A}from"./chunk-chunk-IY7RYD4S.module.min.js";import{createStore as W,useThemeSelector as j}from"./chunk-chunk-DSNGDNJY.module.min.js";var C=Object.freeze([]);function R(e){if(!e)return C;let t=!1;for(let n=0;e.length>n;n++){const r=e[n];if(null==r||"object"!=typeof r){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var N=/^\d{4}-\d{1,2}$/;function L(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const n=N.test(t)?t+"-01":t;if(n===t&&10>t.length)return NaN;const r=Date.parse(n);return Number.isFinite(r)?r:NaN}function O(e){return e instanceof Date?e.getTime():"string"==typeof e?L(e):+e}function I(e,t){if(!e||!t)return{data:e,failed:!1};let n=!1,r=!1;const o=e.map(e=>{const o=e[t];if("string"!=typeof o)return e;const i=L(o);return n=!0,Number.isFinite(i)?{...e,[t]:i}:(r=!0,{...e,[t]:NaN})});return{data:n?o:e,failed:r}}import{memo as z,useEffect as F,useRef as D}from"react";var P={sceneGeometry:0,layout:0,domain:0};function T(e){const{domain:t,layout:n,sceneGeometry:r}=e.revisions;return{domain:t,layout:n,sceneGeometry:r}}function B(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var E="production"!==process.env.NODE_ENV,H={revisions:P,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},G=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=P,this.lastObserved=P,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){E&&(this.lastObserved=B(this.lastObserved,T(e)))}beforeCompute(e,t){if(!E)return H;const n=B(T(e),this.lastObserved),r=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),o=!((i=n).sceneGeometry===(a=this.lastConsumed).sceneGeometry&&i.layout===a.layout&&i.domain===a.domain);var i,a;return{revisions:n,signature:r,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:o,warnUnconsumed:!t&&o&&this.lastUnconsumedWarning!==r}}afterCompute(e,t,n){if(E){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}};function q(e){return D(new G(e))}function _(e,t,n,r=!1,o=!1){const i=e.beforeCompute(t.getLastUpdateResult(),r);n(),e.afterCompute(i,!0,o)}var Y=z(function({store:e,diagnostics:t}){return F(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),V=22;function U(e){return"string"==typeof e&&e.length>0}function Z(e,t,n=!1){const r=n?t?58:34:t?36:0;return r>e.top?{...e,top:r}:e}function X(e,t){return Z(e,U(t))}import*as J from"react";import{arc as K}from"d3-shape";function Q(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}function ee(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,r=e=>Math.max(0,Math.min(e??0,n));return{tl:r(t.tl),tr:r(t.tr),br:r(t.br),bl:r(t.bl)}}var te=(e,t)=>({x:e*Math.cos(t),y:e*Math.sin(t)});function ne(e){const{innerRadius:t,outerRadius:n,startAngle:r,endAngle:o}=e,i=0>=t;if(0>=(e.cornerRadius??0)||!e.roundStart&&!e.roundEnd){if(i){const e=te(n,r),t=te(n,o);return`M0,0 L${e.x},${e.y} A${n},${n} 0 ${o-r>Math.PI?1:0} 1 ${t.x},${t.y} Z`}const e=te(n,r),a=te(n,o),l=te(t,o),s=te(t,r),c=o-r>Math.PI?1:0;return`M${e.x},${e.y} A${n},${n} 0 ${c} 1 ${a.x},${a.y} L${l.x},${l.y} A${t},${t} 0 ${c} 0 ${s.x},${s.y} Z`}const a=Math.max(0,Math.min(e.cornerRadius??0,(n-t)/2));if(0===a)return ne({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const l=Math.asin(Math.min(1,a/Math.max(1e-9,n-a))),s=i?0:Math.asin(Math.min(1,a/Math.max(1e-9,t+a))),c=o-r,d=e.roundStart&&e.roundEnd?c/2:c,u=!!e.roundStart&&d>l,h=!!e.roundEnd&&d>l;if(!u&&!h)return ne({...e,cornerRadius:0,roundStart:!1,roundEnd:!1});const f=r+(u?l:0),y=o-(h?l:0),m=r+(u?s:0),p=o-(h?s:0),g=te(n,f),b=te(n,y),x=(n-a)*Math.cos(l),v=te(x,r),k=te(x,o),w=i?null:te(t,p),$=i?null:te(t,m),M=i?0:(t+a)*Math.cos(s),S=i?null:te(M,r),A=i?null:te(M,o),W=y-f>Math.PI?1:0,j=i?0:p-m>Math.PI?1:0;let C="";if(u)C+=`M${v.x},${v.y}`,C+=` A${a},${a} 0 0 1 ${g.x},${g.y}`;else{const e=te(n,r);C+=`M${e.x},${e.y}`}if(h)C+=` A${n},${n} 0 ${W} 1 ${b.x},${b.y}`,C+=` A${a},${a} 0 0 1 ${k.x},${k.y}`;else{const e=te(n,o);C+=` A${n},${n} 0 ${W} 1 ${e.x},${e.y}`}if(i)C+=" L0,0";else{if(h)C+=` L${A.x},${A.y}`,C+=` A${a},${a} 0 0 1 ${w.x},${w.y}`;else{const e=te(t,o);C+=` L${e.x},${e.y}`}if(u)C+=` A${t},${t} 0 ${j} 0 ${$.x},${$.y}`,C+=` A${a},${a} 0 0 1 ${S.x},${S.y}`;else{const e=te(t,r);C+=` A${t},${t} 0 ${j} 0 ${e.x},${e.y}`}}return C+=" Z",C}import{jsx as re,jsxs as oe}from"react/jsx-runtime";var ie={innerRadius:0,outerRadius:0,startAngle:0,endAngle:0};function ae(e,t="#4e79a7"){return a(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}function le(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}function se(e,t,n,r){const o=e.glyph;if(!o?.parts?.length||0>=e.size)return null;const i=y(o,e.size);if(0>=i.scale)return null;const a=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,l=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),s=f(o,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=s?le(r+"-clip"):void 0,d=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),u=t=>o.parts.map((n,r)=>{const o=t?"none"===n.fill?void 0:t:g(n.fill,l,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:g(n.stroke??"none",l,e.accent);return o||i?re("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 oe("g",{transform:a,opacity:1===d?void 0:d,children:[s&&c&&re("clipPath",{id:c,children:re("rect",{x:s.x,y:s.y,width:s.width,height:s.height})}),s&&e.ghostColor?re("g",{children:u(e.ghostColor)}):null,s&&c?re("g",{clipPath:`url(#${c})`,children:u()}):u()]},r)}function ce(e){const t=e.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));return 2>t.length?null:t.map((e,t)=>re("stop",{offset:e.offset,stopColor:e.color},t))}function de(e,t,n){const r=$(e.symbolType,e.size,e.path);return re("path",{d:r,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?ae(e.style.fill):"none",fillOpacity:e.style.fillOpacity,opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},`${n??""}symbol-${t}`)}import{jsx as ue,jsxs as he}from"react/jsx-runtime";function fe(e){return 1e6>e?1e4>e?1e3>e?e+"":(e/1e3).toFixed(1)+"K":(e/1e3).toFixed(0)+"K":(e/1e6).toFixed(1)+"M"}function ye(e,t){const n=e.datum;if(!n)return null;const r=[],o=n.__funnelStepLabel,i=Number(n.__funnelStepLabelX),a=Number(n.__funnelStepLabelY),l=Number(n.__funnelRowWidth);"string"!=typeof o||!Number.isFinite(i)||!Number.isFinite(a)||Number.isFinite(l)&&8.4*o.length+16>l||r.push(ue("text",{x:i,y:a+3,textAnchor:"middle",dominantBaseline:"hanging",fontSize:14,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.6)",strokeWidth:3,paintOrder:"stroke",children:o},t+"-funnel-step"));const s=Number(n.__funnelValue),c=Number(n.__funnelValueLabelX),d=Number(n.__funnelValueLabelY),u=Number(n.__funnelBarW);if(Number.isFinite(s)&&0!==s&&Number.isFinite(c)&&Number.isFinite(d)&&u>=60){const e=Number(n.__funnelPercent);let o=!0!==n.__funnelIsFirstStep&&Number.isFinite(e)?`${fe(s)} (${.05>Math.abs(e-Math.round(e))?Math.round(e):e.toFixed(1)}%)`:fe(s);7.8*o.length+16>u&&(o=fe(s)),7.8*o.length+16>u||r.push(ue("text",{x:c,y:d+22,textAnchor:"middle",dominantBaseline:"hanging",fontSize:13,fontWeight:"bold",fill:"#fff",stroke:"rgba(0,0,0,0.5)",strokeWidth:3,paintOrder:"stroke",children:o},t+"-funnel-value"))}return r.length?ue("g",{children:r},t+"-funnel-labels"):null}function me(e,t,n){const r=("category"in e?e.category:void 0)||("group"in e?e.group:void 0)||"",o=n=>`ord-${e.type}-${r}-${t}-${n}`,l=`ord-${e.type}-${r}-${t}`;switch(e.type){case"rect":{const t=e,n=le(l)+"-grad",r=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let r=e.x,o=e.y,i=e.x,a=e.y+e.h;"bottom"===e.roundedEdge?(o=e.y+e.h,a=e.y):"right"===e.roundedEdge?(r=e.x+e.w,o=e.y,i=e.x,a=e.y):"left"===e.roundedEdge&&(r=e.x,o=e.y,i=e.x+e.w,a=e.y);const l=[];if("colorStops"in n){const e=ce(n.colorStops);if(!e)return null;l.push(...e)}else{const t=ae(e.style.fill);l.push(re("stop",{offset:0,stopColor:t,stopOpacity:n.topOpacity},"0")),l.push(re("stop",{offset:1,stopColor:t,stopOpacity:n.bottomOpacity},"1"))}return re("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:r,y1:o,x2:i,y2:a,children:l})}(t,n);let o,s;if(r)s=`url(#${n})`;else if(a(t.style.fill)){const e=le(l)+"-hatch";o=i(t.style.fill,e),s=`url(#${e})`}else s=ae(t.style.fill);const c=r||o?he("defs",{children:[r,o]}):null;if(t.cornerRadii&&Q(t.cornerRadii)){const e=function(e){const{x:t,y:n,w:r,h:o}=e,{tl:i,tr:a,br:l,bl:s}=ee(e);let c=`M${t+i},${n}`;return c+=` L${t+r-a},${n}`,a>0&&(c+=` A${a},${a} 0 0 1 ${t+r},${n+a}`),c+=` L${t+r},${n+o-l}`,l>0&&(c+=` A${l},${l} 0 0 1 ${t+r-l},${n+o}`),c+=` L${t+s},${n+o}`,s>0&&(c+=` A${s},${s} 0 0 1 ${t},${n+o-s}`),c+=` L${t},${n+i}`,i>0&&(c+=` A${i},${i} 0 0 1 ${t+i},${n}`),c+=" Z",c}(t);return he(J.Fragment,{children:[c,ue("path",{d:e,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},l)}if(t.roundedTop&&t.roundedTop>0){const e=Math.min(t.roundedTop,t.w/2,t.h/2),{x:n,y:r,w:o,h:i}=t;let a;switch(t.roundedEdge){case"right":a=`M${n},${r} L${n+o-e},${r} A${e},${e} 0 0 1 ${n+o},${r+e} L${n+o},${r+i-e} A${e},${e} 0 0 1 ${n+o-e},${r+i} L${n},${r+i} Z`;break;case"left":a=`M${n+o},${r} L${n+e},${r} A${e},${e} 0 0 0 ${n},${r+e} L${n},${r+i-e} A${e},${e} 0 0 0 ${n+e},${r+i} L${n+o},${r+i} Z`;break;case"bottom":a=`M${n},${r} L${n+o},${r} L${n+o},${r+i-e} A${e},${e} 0 0 1 ${n+o-e},${r+i} L${n+e},${r+i} A${e},${e} 0 0 1 ${n},${r+i-e} Z`;break;default:a=`M${n},${r+i} L${n},${r+e} A${e},${e} 0 0 1 ${n+e},${r} L${n+o-e},${r} A${e},${e} 0 0 1 ${n+o},${r+e} L${n+o},${r+i} Z`}return he(J.Fragment,{children:[c,ue("path",{d:a,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth})]},l)}return he(J.Fragment,{children:[c,ue("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:s,opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth}),ye(t,l)]},l)}case"point":{const t=e;return ue("circle",{cx:t.x,cy:t.y,r:t.r,fill:ae(t.style.fill),opacity:t.style.opacity??t.style.fillOpacity??.8,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},l)}case"symbol":return de(e,t,n);case"glyph":return se(e,e.x,e.y,`${n??""}ord-glyph-${e.pointId??t}`);case"wedge":{const r=e;if(r._gradientBand&&r._gradientBand.colors.length>0){const e=le(`${n?n+"-":""}gauge-grad-${r.category||l}-${t}`),{clipPath:o,slices:i}=function(e){const t=ne({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,cornerRadius:e.cornerRadius,roundStart:e.roundStart,roundEnd:e.roundEnd}),n=[],r=e.colors;if(r.length>0){const t=(e.endAngle-e.startAngle)/r.length;for(let o=0;r.length>o;o++)n.push({d:ne({innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle+o*t,endAngle:e.endAngle}),color:r[o]})}return{clipPath:t,slices:n}}({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds?.start??!0,roundEnd:r.roundedEnds?.end??!0,colors:r._gradientBand.colors});return he("g",{transform:`translate(${r.cx},${r.cy})`,opacity:r.style.opacity,fillOpacity:r.style.fillOpacity,children:[ue("defs",{children:ue("clipPath",{id:e,children:ue("path",{d:o})})}),ue("g",{clipPath:`url(#${e})`,children:i.map((e,t)=>ue("path",{d:e.d,fill:ae(e.color)},t))}),r.style.stroke&&"none"!==r.style.stroke&&ue("path",{d:o,fill:"none",stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},l)}let o;if(r.roundedEnds)o=ne({innerRadius:r.innerRadius,outerRadius:r.outerRadius,startAngle:r.startAngle,endAngle:r.endAngle,cornerRadius:r.cornerRadius,roundStart:r.roundedEnds.start,roundEnd:r.roundedEnds.end});else{const e=K().innerRadius(r.innerRadius).outerRadius(r.outerRadius).startAngle(r.startAngle+Math.PI/2).endAngle(r.endAngle+Math.PI/2);r.cornerRadius&&e.cornerRadius(r.cornerRadius),o=e(ie)||""}return ue("path",{d:o,transform:`translate(${r.cx},${r.cy})`,fill:ae(r.style.fill),stroke:r.style.stroke,strokeWidth:r.style.strokeWidth,opacity:r.style.opacity},l)}case"boxplot":{const t=e,n=t.columnWidth/2;return he("g","vertical"===t.projection?{children:[ue("line",{x1:t.x,y1:t.minPos,x2:t.x,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1}),ue("rect",{x:t.x-n,y:Math.min(t.q1Pos,t.q3Pos),width:t.columnWidth,height:Math.abs(t.q3Pos-t.q1Pos),fill:ae(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),ue("line",{x1:t.x-n,y1:t.medianPos,x2:t.x+n,y2:t.medianPos,stroke:t.style.stroke||"#333",strokeWidth:2}),ue("line",{x1:t.x-.5*n,y1:t.minPos,x2:t.x+.5*n,y2:t.minPos,stroke:t.style.stroke||"#333",strokeWidth:1}),ue("line",{x1:t.x-.5*n,y1:t.maxPos,x2:t.x+.5*n,y2:t.maxPos,stroke:t.style.stroke||"#333",strokeWidth:1})]}:{children:[ue("line",{x1:t.minPos,y1:t.y,x2:t.maxPos,y2:t.y,stroke:t.style.stroke||"#333",strokeWidth:1}),ue("rect",{x:Math.min(t.q1Pos,t.q3Pos),y:t.y-n,width:Math.abs(t.q3Pos-t.q1Pos),height:t.columnWidth,fill:ae(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:1}),ue("line",{x1:t.medianPos,y1:t.y-n,x2:t.medianPos,y2:t.y+n,stroke:t.style.stroke||"#333",strokeWidth:2}),ue("line",{x1:t.minPos,y1:t.y-.5*n,x2:t.minPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1}),ue("line",{x1:t.maxPos,y1:t.y-.5*n,x2:t.maxPos,y2:t.y+.5*n,stroke:t.style.stroke||"#333",strokeWidth:1})]},l)}case"violin":{const t=e,n=[ue("path",{d:t.pathString,transform:t.translateX||t.translateY?`translate(${t.translateX},${t.translateY})`:void 0,fill:ae(t.style.fill),fillOpacity:t.style.fillOpacity??.6,stroke:t.style.stroke||"#333",strokeWidth:t.style.strokeWidth||1},o("path"))];if(t.iqrLine&&t.bounds){const e=t.bounds,r=e.x+e.width/2,i=e.y+e.height/2;t.iqrLine.isVertical?n.push(ue("line",{x1:r,y1:t.iqrLine.q1Pos,x2:r,y2:t.iqrLine.q3Pos,stroke:t.style.stroke||"#333",strokeWidth:2},o("iqr")),ue("circle",{cx:r,cy:t.iqrLine.medianPos,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},o("med"))):n.push(ue("line",{x1:t.iqrLine.q1Pos,y1:i,x2:t.iqrLine.q3Pos,y2:i,stroke:t.style.stroke||"#333",strokeWidth:2},o("iqr")),ue("circle",{cx:t.iqrLine.medianPos,cy:i,r:3,fill:"white",stroke:t.style.stroke||"#333",strokeWidth:1},o("med")))}return ue("g",{children:n},l)}case"connector":return ue("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity??.5},l);case"trapezoid":{const t=e,n=t.points.map(e=>`${e[0]},${e[1]}`).join(" ");return ue("polygon",{points:n,fill:ae(t.style.fill,"#999"),opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},l)}default:return null}}import*as pe from"react";import{area as ge,line as be}from"d3-shape";import{curveMonotoneX as xe,curveMonotoneY as ve,curveCardinal as ke,curveCatmullRom as we,curveStep as $e,curveStepBefore as Me,curveStepAfter as Se,curveBasis as Ae,curveNatural as We}from"d3-shape";function je(e){switch(e){case"monotoneX":return xe;case"monotoneY":return ve;case"cardinal":return ke;case"catmullRom":return we;case"step":return $e;case"stepBefore":return Me;case"stepAfter":return Se;case"basis":return Ae;case"natural":return We;default:return null}}function Ce(e,t,n){if(null==t)return n;if(a(t)){return l(t,e)||t.background&&A(e,t.background)||n}return"string"!=typeof t?t:A(e,t)||n}function Re(e,t){if(null==t)return;const n=Ce(e,t,"");return""===n?void 0:n}function Ne(e,t,n,r,o,i,a){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const l=e.createLinearGradient(r,o,i,a);for(const e of n)l.addColorStop(e.offset,e.color);return l}const{topOpacity:l,bottomOpacity:s}=t;if(!Number.isFinite(l)||!Number.isFinite(s))return null;const c=Math.max(0,Math.min(1,l)),d=Math.max(0,Math.min(1,s)),u=e.createLinearGradient(r,o,i,a),[h,f,y]=function(e,t){const n=e.fillStyle,r="#010203";try{e.fillStyle=r,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const o=e.fillStyle;if(e.fillStyle=n,"string"!=typeof o)return[78,121,167];if(o.toLowerCase()===r&&t.trim().toLowerCase()!==r)return[78,121,167];if(o.startsWith("#"))return[parseInt(o.slice(1,3),16),parseInt(o.slice(3,5),16),parseInt(o.slice(5,7),16)];const i=o.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}(e,n);return u.addColorStop(0,`rgba(${h},${f},${y},${c})`),u.addColorStop(1,`rgba(${h},${f},${y},${d})`),u}function Le(e,t,n,r,o,i){const a=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>a.length)return null;const l=e.createLinearGradient(n,r,o,i);for(const e of a)l.addColorStop(e.offset,e.color);return l}import*as Oe from"react";import{arc as Ie}from"d3-shape";import{jsx as ze,jsxs as Fe}from"react/jsx-runtime";function De(e,t){switch(e.type){case"circle":{const n=e,r=a(n.style.fill)?i(n.style.fill,`net-circle-${t}-hatch`):void 0;return Fe(Oe.Fragment,{children:[r&&ze("defs",{children:r}),ze("circle",{cx:n.cx,cy:n.cy,r:n.r,fill:r?`url(#net-circle-${t}-hatch)`:ae(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-circle-"+t)}case"rect":{const n=e,r=a(n.style.fill)?i(n.style.fill,`net-rect-${t}-hatch`):void 0;return Fe(Oe.Fragment,{children:[r&&ze("defs",{children:r}),ze("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:r?`url(#net-rect-${t}-hatch)`:ae(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-rect-"+t)}case"arc":{const n=e,r=Ie().innerRadius(n.innerR).outerRadius(n.outerR).startAngle(n.startAngle+Math.PI/2).endAngle(n.endAngle+Math.PI/2)(ie)||"",o=a(n.style.fill)?i(n.style.fill,`net-arc-${t}-hatch`):void 0;return Fe(Oe.Fragment,{children:[o&&ze("defs",{children:o}),ze("path",{d:r,transform:`translate(${n.cx},${n.cy})`,fill:o?`url(#net-arc-${t}-hatch)`:ae(n.style.fill),stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity})]},"net-arc-"+t)}case"symbol":{const n=e,r=$(n.symbolType,n.size,n.path);return ze("path",{d:r,transform:n.rotation?`translate(${n.cx},${n.cy}) rotate(${180*n.rotation/Math.PI})`:`translate(${n.cx},${n.cy})`,fill:n.style.fill?ae(n.style.fill):"none",stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-symbol-"+t)}case"glyph":return se(e,e.cx,e.cy,"net-glyph-"+(e.id??t));default:return null}}function Pe(e,t){switch(e.type){case"line":return ze("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.style.stroke||"#999",strokeWidth:e.style.strokeWidth||1,opacity:e.style.opacity},"net-edge-"+t);case"bezier":{const n=e;return ze("path",{d:n.pathD,fill:ae(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"ribbon":{const n=e;return ze("path",{d:n.pathD,fill:ae(n.style.fill,"#999"),fillOpacity:n.style.fillOpacity,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth,opacity:n.style.opacity},"net-edge-"+t)}case"curved":{const n=e;return ze("path",{d:n.pathD,fill:ae(n.style.fill,"none"),stroke:n.style.stroke||"#999",strokeWidth:n.style.strokeWidth||1,opacity:n.style.opacity},"net-edge-"+t)}default:return null}}function Te(e,t){return ze("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}import*as Be from"react";import{jsx as Ee,jsxs as He}from"react/jsx-runtime";function Ge(e,t){switch(e.type){case"geoarea":{const n=e;if(!n.pathData)return null;const r=a(n.style.fill)?i(n.style.fill,`geoarea-${t}-hatch`):void 0;return He(Be.Fragment,{children:[r&&Ee("defs",{children:r}),Ee("path",{d:n.pathData,fill:r?`url(#geoarea-${t}-hatch)`:ae(n.style.fill,"#e0e0e0"),fillOpacity:n.style.fillOpacity??1,stroke:n.style.stroke||"none",strokeWidth:n.style.strokeWidth||.5,strokeDasharray:n.style.strokeDasharray,opacity:n._decayOpacity??1})]},"geoarea-"+t)}case"point":{const n=e,r=a(n.style.fill)?i(n.style.fill,`geopoint-${t}-hatch`):void 0;return He(Be.Fragment,{children:[r&&Ee("defs",{children:r}),Ee("circle",{cx:n.x,cy:n.y,r:n.r,fill:r?`url(#geopoint-${t}-hatch)`:ae(n.style.fill),fillOpacity:n.style.fillOpacity??.8,stroke:n.style.stroke,strokeWidth:n.style.strokeWidth,opacity:n._decayOpacity??n.style.opacity??1})]},"point-"+t)}case"line":{const n=e;if(2>n.path.length)return null;const r="M"+n.path.map(e=>`${e[0]},${e[1]}`).join("L");return Ee("path",{d:r,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||1.5,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity??1},"line-"+t)}case"glyph":return se(e,e.x,e.y,"geo-glyph-"+(e.pointId??t));default:return null}}import{jsx as qe,jsxs as _e}from"react/jsx-runtime";function Ye(e,t,n){if(!e||2>t.length)return null;const r=ce(e.colorStops);return r?qe("linearGradient",{id:n,gradientUnits:"userSpaceOnUse",x1:t[0][0],y1:0,x2:t[t.length-1][0],y2:0,children:r}):null}function Ve(e,t,n){switch(e.type){case"line":{const r=e;if(0===r.path.length)return null;const o=je(r.curve),i=o?be().x(([e])=>e).y(([,e])=>e).curve(o)(r.path)??"":"M"+r.path.map(([e,t])=>`${e},${t}`).join("L"),a=le(`${n?n+"-":""}line-${t}-stroke-gradient`),l=Ye(r.strokeGradient,r.path,a);return _e(pe.Fragment,{children:[l&&qe("defs",{children:l}),qe("path",{d:i,fill:"none",stroke:l?`url(#${a})`:r.style.stroke||"#4e79a7",strokeWidth:r.style.strokeWidth||2,strokeDasharray:r.style.strokeDasharray,opacity:r.style.opacity})]},"line-"+t)}case"area":{const r=e;if(0===r.topPath.length)return null;const o=je(r.curve),l=!o||2>r.topPath.length||2>r.bottomPath.length?`M${r.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...r.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`:ge().x(([e])=>e).y0((e,t)=>r.bottomPath[t][1]).y1(([,e])=>e).curve(o)(r.topPath)??"",s=`${n?n+"-":""}area-${t}-hatch`,c=a(r.style.fill)?i(r.style.fill,s):void 0,d=le(`${n?n+"-":""}area-${t}-gradient`),u=function(e,t){const n=e.fillGradient;if(!n||"object"!=typeof n)return null;let r=1/0;for(const[,t]of e.topPath)r=Math.min(r,t);let o=-1/0;for(const[,t]of e.bottomPath)o=Math.max(o,t);if(!Number.isFinite(r)||!Number.isFinite(o))return null;const i=[];if("colorStops"in n){const e=ce(n.colorStops);if(!e)return null;i.push(...e)}else{if(!Number.isFinite(n.topOpacity)||!Number.isFinite(n.bottomOpacity))return null;i.push(qe("stop",{offset:0,stopColor:ae(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.topOpacity))},"0")),i.push(qe("stop",{offset:1,stopColor:ae(e.style.fill),stopOpacity:Math.max(0,Math.min(1,n.bottomOpacity))},"1"))}return qe("linearGradient",{id:t,gradientUnits:"userSpaceOnUse",x1:0,y1:r,x2:0,y2:o,children:i})}(r,d),h=u?`url(#${d})`:c?`url(#${s})`:ae(r.style.fill),f=u?void 0:r.style.fillOpacity??r.style.opacity??.7,y=o?be().x(([e])=>e).y(([,e])=>e).curve(o)(r.topPath)??"":"M"+r.topPath.map(([e,t])=>`${e},${t}`).join("L"),m=le(`${n?n+"-":""}area-${t}-stroke-gradient`),p=Ye(r.strokeGradient,r.topPath,m),g=r.style.stroke&&"none"!==r.style.stroke?qe("path",{d:y,fill:"none",stroke:p?`url(#${m})`:ae(r.style.stroke),strokeWidth:r.style.strokeWidth||2,opacity:r.style.opacity}):null;if(r.clipRect){const e=`${n?n+"-":""}area-clip-${t}`;return _e("g",{children:[_e("defs",{children:[u,!u&&c,p,qe("clipPath",{id:e,children:qe("rect",{x:r.clipRect.x,y:r.clipRect.y,width:r.clipRect.width,height:r.clipRect.height})})]}),_e("g",{clipPath:`url(#${e})`,children:[qe("path",{d:l,fill:h,fillOpacity:f,opacity:u?r.style.opacity:void 0,stroke:"none"}),g]})]},"area-"+t)}return _e(pe.Fragment,{children:[(u||c||p)&&_e("defs",{children:[u,!u&&c,p]}),qe("path",{d:l,fill:h,fillOpacity:f,opacity:u?r.style.opacity:void 0,stroke:"none"}),g]},"area-"+t)}case"point":{const r=e,o=`${n?n+"-":""}point-${t}-hatch`,l=a(r.style.fill)?i(r.style.fill,o):void 0;return _e(pe.Fragment,{children:[l&&qe("defs",{children:l}),qe("circle",{cx:r.x,cy:r.y,r:r.r,fill:l?`url(#${o})`:ae(r.style.fill),opacity:r.style.opacity??r.style.fillOpacity??.8,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"point-"+t)}case"symbol":return de(e,t);case"glyph":return se(e,e.x,e.y,`${n??""}glyph-${e.pointId??t}`);case"rect":{const r=e,o=`${n?n+"-":""}xyrect-${t}-hatch`,l=a(r.style.fill)?i(r.style.fill,o):void 0;return _e(pe.Fragment,{children:[l&&qe("defs",{children:l}),qe("rect",{x:r.x,y:r.y,width:r.w,height:r.h,fill:l?`url(#${o})`:ae(r.style.fill),opacity:r.style.opacity,stroke:r.style.stroke,strokeWidth:r.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const n=e;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const e=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[r,o,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),a=.299*r+.587*o+.114*i>128?"#000":"#fff",l=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return _e("g",{children:[qe("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth}),qe("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:a,fontSize:l+"px",children:e})]},"heatcell-"+t)}return qe("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill,stroke:n.style?.stroke,strokeWidth:n.style?.strokeWidth},"heatcell-"+t)}case"candlestick":{const n=e;if(n.isRange){const e=n.dotRadius??Math.max(2,n.bodyWidth/2);return _e("g",{children:[qe("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),qe("circle",{cx:n.x,cy:n.highY,r:e,fill:n.wickColor}),qe("circle",{cx:n.x,cy:n.lowY,r:e,fill:n.wickColor})]},"candle-"+t)}const r=Math.min(n.openY,n.closeY),o=Math.max(Math.abs(n.openY-n.closeY),1),i=n.isUp?n.upColor:n.downColor;return _e("g",{children:[qe("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),qe("rect",{x:n.x-n.bodyWidth/2,y:r,width:n.bodyWidth,height:o,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}var Ue="undefined"==typeof window||"undefined"==typeof document;import{useEffect as Ze,useLayoutEffect as Xe,useRef as Je,useState as Ke,useSyncExternalStore as Qe}from"react";var et="undefined"!=typeof window?Xe:Ze;function tt(){const[e,t]=Ke(!1);return et(()=>{t(!0)},[]),e}var nt=()=>()=>{},rt=()=>!1,ot=()=>!0;function it(){const e=Qe(nt,rt,ot);return Je(e).current}import{jsx as at}from"react/jsx-runtime";var lt={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function st({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return at("div",{"aria-live":"polite","aria-atomic":"true",style:lt,children:t})}import*as ct from"react";import*as dt from"react";import{jsx as ut}from"react/jsx-runtime";var ht=dt.createContext(null);function ft(){return dt.useContext(ht)}import{jsx as yt,jsxs as mt}from"react/jsx-runtime";function pt(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const r=[],o={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],a=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),r=i.indexOf(t);return(-1===n?999:n)-(-1===r?999:r)});for(const e of a)r.push(`${n[e]} ${o[e]||e}`);return`${t}, ${r.join(", ")}`}function gt(e,t,n){const r=[];return e>0&&r.push(e+" nodes"),t>0&&r.push(t+" edges"),0===r.length?n+", empty":`${n}, ${r.join(", ")}`}var bt=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},xt="semiotic-accessible-data-table",vt=xt+" semiotic-accessible-data-table-hidden",kt=xt+" semiotic-accessible-data-table-visible",wt=kt+" semiotic-accessible-data-table-network",$t={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Mt={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},St={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},At={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Wt={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},jt={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Ct={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},Rt={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function Nt({scene:e,chartType:t,tableId:n,chartTitle:r}){const[i,a]=ct.useState(!1),[l,s]=ct.useState(5),c=ft(),d=c?.visible??!1,u=i||d,h=ct.useRef(null),f=r?"Data summary for "+r:n?`Data summary for ${t} ${n}`:"Data summary for "+t;ct.useEffect(()=>{u||s(5)},[u]);const y=ct.useCallback(e=>{e.target===e.currentTarget&&(i||d||a(!0))},[i,d]),m=ct.useCallback(e=>{d||h.current?.contains(e.relatedTarget)||a(!1)},[d]);if(!e||0===e.length)return n?yt("span",{id:n,tabIndex:-1,style:lt}):null;if(!u)return yt("div",{id:n,className:vt,tabIndex:-1,onFocus:y,style:lt,role:"region","aria-label":f,children:mt("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",e.length," elements)"]})});const p=o(e),g=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const r of t){const t=[],o=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[r];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&o.add(e+""))}if(t.length>0){let e=t[0],o=t[0],i=0;for(const n of t)e>n&&(e=n),n>o&&(o=n),i+=n;n.push({name:r,count:t.length,numeric:!0,min:e,max:o,mean:i/t.length})}else if(o.size>0){const e=Array.from(o);n.push({name:r,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(p),b=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${bt(e.min)} to ${bt(e.max)}, mean ${bt(e.mean)}.`);else{const t=e.uniqueValues,r=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${r}.`)}return n.join(" ")}(p.length,g),x=Math.min(l,p.length),v=p.slice(0,x),k=p.length-x,w=new Set;for(const e of v)for(const t of Object.keys(e.values))w.add(t);const $=Array.from(w);return mt("div",{ref:h,id:n,className:kt,tabIndex:-1,onBlur:m,style:$t,role:"region","aria-label":f,children:[yt("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:St,children:"×"}),yt("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Mt,children:b}),mt("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:At,children:[yt("caption",{className:"semiotic-accessible-data-table-caption",style:Ct,children:k>0?`First ${x} of ${p.length} data points`:`All ${p.length} data points`}),yt("thead",{children:mt("tr",{children:[yt("th",{style:Wt,children:"type"}),$.map(e=>yt("th",{style:Wt,children:e},e))]})}),yt("tbody",{children:v.map((e,t)=>mt("tr",{children:[yt("td",{style:jt,children:e.label}),$.map(t=>{return yt("td",{style:jt,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":bt(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),k>0&&mt("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:Rt,children:["Show ",Math.min(25,k)," more"," ",1===k?"row":"rows"," (",k," remaining)"]})]})}function Lt({nodes:e,edges:t,chartType:n,tableId:r,chartTitle:o}){const[i,a]=ct.useState(!1),[l,s]=ct.useState(5),c=ft(),d=c?.visible??!1,u=i||d,h=o?"Data summary for "+o:r?`Data summary for ${n} ${r}`:"Data summary for "+n,f=ct.useRef(null);ct.useEffect(()=>{u||s(5)},[u]);const y=ct.useCallback(e=>{e.target===e.currentTarget&&(i||d||a(!0))},[i,d]),m=ct.useCallback(e=>{d||f.current?.contains(e.relatedTarget)||a(!1)},[d]);if(!e||0===e.length)return r?yt("span",{id:r,tabIndex:-1,style:lt}):null;if(!u)return yt("div",{id:r,className:vt,tabIndex:-1,onFocus:y,style:lt,role:"region","aria-label":h,children:mt("button",{type:"button",onClick:()=>a(!0),children:["View data summary (",e.length," nodes, ",t.length," edges)"]})});const p=Array.isArray(e)?e:[],g=Array.isArray(t)?t:[],b=new Map,x=new Map,v=new Map,k=new Map;for(const e of g){if(!e||"object"!=typeof e)continue;const t=e.datum??{source:e.source,target:e.target},n="object"==typeof t.source?t.source?.id:t.source,r="object"==typeof t.target?t.target?.id:t.target,o="number"==typeof t.value&&Number.isFinite(t.value)?t.value:0;if(null!=n&&""!==n){const e=n+"";x.set(e,(x.get(e)??0)+1),k.set(e,(k.get(e)??0)+o)}if(null!=r&&""!==r){const e=r+"";b.set(e,(b.get(e)??0)+1),v.set(e,(v.get(e)??0)+o)}}const w=[];for(let e=0;p.length>e;e++){const t=p[e];if(!t||"object"!=typeof t)continue;const n=t.datum?.id??t.id,r=null!=n?n+"":"node-"+e,o=b.get(r)??0,i=x.get(r)??0,a=v.get(r)??0,l=k.get(r)??0;w.push({id:r,degree:o+i,inDeg:o,outDeg:i,wDegree:a+l,wInDeg:a,wOutDeg:l})}w.sort((e,t)=>t.degree-e.degree);let $=0,M=0;if(w.length>0){let e=0;for(const t of w)e+=t.degree,t.degree>M&&(M=t.degree);$=e/w.length}const S=g.some(e=>{const t=e?.datum??{source:e?.source,target:e?.target};return"number"==typeof t?.value&&Number.isFinite(t.value)}),A=[`${w.length} nodes, ${g.length} edges.`];w.length>0&&A.push(`Mean degree: ${bt($)}, max degree: ${M}.`);const W=Math.min(l,w.length),j=w.slice(0,W),C=w.length-W;return mt("div",{ref:f,id:r,className:wt,tabIndex:-1,onBlur:m,style:$t,role:"region","aria-label":h,children:[yt("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&c&&c.setVisible(!1),a(!1)},"aria-label":"Close data summary",style:St,children:"×"}),yt("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Mt,children:A.join(" ")}),mt("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Node degree summary for "+n,style:At,children:[yt("caption",{className:"semiotic-accessible-data-table-caption",style:Ct,children:C>0?`Top ${W} of ${w.length} nodes by degree`:`All ${w.length} nodes by degree`}),yt("thead",{children:mt("tr",{children:[yt("th",{style:Wt,children:"id"}),yt("th",{style:Wt,children:"degree"}),yt("th",{style:Wt,children:"in"}),yt("th",{style:Wt,children:"out"}),S&&yt("th",{style:Wt,children:"w. degree"}),S&&yt("th",{style:Wt,children:"w. in"}),S&&yt("th",{style:Wt,children:"w. out"})]})}),yt("tbody",{children:j.map((e,t)=>mt("tr",{children:[yt("td",{style:jt,children:e.id}),yt("td",{style:jt,children:e.degree}),yt("td",{style:jt,children:e.inDeg}),yt("td",{style:jt,children:e.outDeg}),S&&yt("td",{style:jt,children:bt(e.wDegree)}),S&&yt("td",{style:jt,children:bt(e.wInDeg)}),S&&yt("td",{style:jt,children:bt(e.wOutDeg)})]},t))})]}),C>0&&mt("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>s(e=>e+25),style:Rt,children:["Show ",Math.min(25,C)," more"," ",1===C?"node":"nodes"," (",C," remaining)"]})]})}function Ot({summary:e}){return e?yt("div",{role:"note",style:lt,children:e}):null}function It({tableId:e}){return yt("a",{href:"#"+e,style:lt,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,lt)},children:"Skip to data table"})}import{jsx as zt}from"react/jsx-runtime";var Ft="var(--semiotic-focus, #005fcc)";function Dt({active:e,hoverPoint:t,margin:n,size:r,shape:o="circle",width:i,height:a,pathData:l}){if(!e||!t)return null;const s=t.x+n.left,c=t.y+n.top;let d;if("geoarea"!==o&&"path"!==o||!l)if("rect"===o&&null!=i&&null!=a){const e=Math.max(i,4),t=Math.max(a,4);d=zt("rect",{x:s-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Ft,strokeWidth:2,strokeDasharray:"4,2"})}else d=zt("circle","wedge"===o?{cx:s,cy:c,r:12,fill:"none",stroke:Ft,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:s,cy:c,r:8,fill:"none",stroke:Ft,strokeWidth:2,strokeDasharray:"4,2"});else d=zt("g",{transform:`translate(${n.left},${n.top})`,children:zt("path",{d:l,fill:"none",stroke:Ft,strokeWidth:2.5,strokeDasharray:"6,3"})});return zt("svg",{style:{position:"absolute",left:0,top:0,width:r[0],height:r[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:d})}import*as Pt from"react";import{jsx as Tt}from"react/jsx-runtime";function Bt({x:e,y:t,containerWidth:n,containerHeight:o,margin:i,children:a,className:l="stream-frame-tooltip",zIndex:s=1}){const c=Number.isFinite(e)&&Number.isFinite(t),d=Pt.useRef(null),[u,h]=Pt.useState(null);Pt.useLayoutEffect(()=>{const e=d.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&h(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[l,n,o,c]);let f;f=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`;const y=function(e){if(!Pt.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const r=n.style;if(r&&"object"==typeof r){if(null!=r.background&&""!==r.background&&"transparent"!==r.background)return!0;if(null!=r.backgroundColor&&""!==r.backgroundColor&&"transparent"!==r.backgroundColor)return!0}return!1}(a),m=y?null:r;return c?Tt("div",{ref:d,className:y?l:(l+" semiotic-tooltip").trim(),style:{...m||{},position:"absolute",left:i.left+e,top:i.top+t,transform:f,pointerEvents:"none",zIndex:s,width:"max-content"},children:a}):null}import*as Et from"react";import{useCallback as Ht,useEffect as Gt,useLayoutEffect as qt,useMemo as _t,useRef as Yt}from"react";import{useRef as Vt,useState as Ut,useEffect as Zt}from"react";function Xt(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}function Jt(e,t){return Math.min((e-t.startTime)/t.duration,1)}function Kt(e,t,n){return e+(t-e)*n}function Qt(){return"undefined"!=typeof performance?performance.now():Date.now()}var en="undefined"==typeof window?Gt:qt,tn={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function nn(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function rn(t){const n=e(),r=Yt(n);r.current=n;const[o,i]=function(e,t,n){const r=Vt(null),[o,i]=Ut(null);return Zt(()=>{if(!t&&!n)return;const e=r.current;if(!e)return;const o=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return o.observe(e),()=>o.disconnect()},[t,n]),[r,[t&&o?o.w:e[0],n&&o?o.h:e[1]]]}(t.sizeProp,t.responsiveWidth,t.responsiveHeight),a=!!t.title,l=!!t.legend&&"top"===t.legendPosition,s=_t(()=>Z({...t.marginDefault,...t.userMargin},a,l),[t.marginDefault,t.userMargin,a,l]),c=i[0]-s.left-s.right,d=i[1]-s.top-s.bottom,h=nn(t.foregroundGraphics,i,s),f=nn(t.backgroundGraphics,i,s),y=j(e=>e.theme),{transition:m,introEnabled:p}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(t.animate,t.transitionProp),g="semiotic-table-"+Et.useId(),b=Yt(null);if(!b.current){const e=!t.suspendWhenHidden||"undefined"==typeof document||!document.hidden;b.current=new u({clock:t.clock,random:t.random,seed:t.seed,paused:t.paused,visible:e})}const x=b.current;x.configure({clock:t.clock,random:t.random,seed:t.seed});const v=Yt(null),k=Yt(t.frameScheduler??tn);k.current=t.frameScheduler??tn;const w=Yt(null),$=Yt(!1),M=Yt(()=>{}),A=Ht(()=>{if(null!==v.current||$.current)return;const e=k.current;let t=!1,n=!1;const r=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&($.current=!0),v.current=null,w.current=null;try{M.current()}finally{e&&($.current=!1)}});n=!0,t||(v.current=r,w.current=e)},[]),W=Ht(()=>{null!==v.current&&((w.current??k.current).cancelAnimationFrame(v.current),v.current=null,w.current=null)},[]);en(()=>{x.setPaused(!0===t.paused)},[x,t.paused]),Gt(()=>{if(!t.suspendWhenHidden||"undefined"==typeof document)return void x.setVisible(!0);const e=()=>x.setVisible(!document.hidden);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[x,t.suspendWhenHidden]),Gt(()=>()=>{W()},[W]);const C=Yt(()=>{}),R=Yt(()=>{}),N=Yt(null),L=Yt(null),O=Yt(null),I=Ht(()=>{const e=N.current;N.current=null,e&&C.current(e)},[]),z=Ht(e=>{if(N.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===L.current){const e=k.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,L.current=null,O.current=null,I()});t||(L.current=n,O.current=e)}},[I]),F=Ht(()=>{N.current=null,null!==L.current&&((O.current??k.current).cancelAnimationFrame(L.current),L.current=null,O.current=null),R.current()},[]);Gt(()=>()=>{N.current=null,null!==L.current&&((O.current??k.current).cancelAnimationFrame(L.current),L.current=null,O.current=null)},[]);const D=t.themeDirtyRef;return en(()=>{D&&(S(),D.current=!0,A())},[y,A,D]),{reducedMotion:n,reducedMotionRef:r,responsiveRef:o,size:i,margin:s,adjustedWidth:c,adjustedHeight:d,resolvedForeground:h,resolvedBackground:f,currentTheme:y,transition:m,introEnabled:p,tableId:g,frameRuntime:x,rafRef:v,renderFnRef:M,scheduleRender:A,cancelRender:W,hoverHandlerRef:C,hoverLeaveRef:R,onPointerMove:z,onPointerLeave:F}}import{useEffect as on,useRef as an}from"react";import{jsx as ln}from"react/jsx-runtime";function sn(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:r,manageFrameRuntime:o,scheduleRender:i}=e,a=an(null),l=an(null),s=an(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:r,dirtyRef:o,renderFnRef:i,cancelRender:a,cleanup:l}=e;et(()=>{const e=r.current;t&&n&&e?.cancelIntroAnimation?.(),!n&&e?.sceneNodes&&e.sceneNodes.length>0&&e?.markStylePaintPending?e.markStylePaintPending():o.current=!0,a?.(),i.current()},[t,n]);const s=Je(l);s.current=l,Ze(()=>()=>s.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),on(()=>{if(!1!==o)return r.subscribe(()=>{r.isActive?(n.current=!0,i()):t()})},[t,n,r,o,i]),on(()=>{!s.current&&(s.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:a,interactionCanvasRef:l}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}function cn({children:e,size:t,margin:n,overflowVisible:r=!1}){return e?ln("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:r?"visible":void 0},children:ln("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function dn(e,t,n,r){const o=e.getContext("2d");if(!o)return null;const i=Math.round(t[0]*r),a=Math.round(t[1]*r),l=i/t[0],s=a/t[1],c=t[0]+"px",d=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==d&&(e.style.height=d),e.width===i&&e.height===a||(e.width=i,e.height=a),o.setTransform(l,0,0,s,0,0),o.translate(n.left,n.top),o}function un(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}function hn(e){return"touch"===e?"touch":"pointer"}function fn(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}function yn(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:l,timestamp:s=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:r,y:o,timestamp:s,chartType:i,chartId:a}),"focus"===l?.type&&t({type:"focus",datum:n,inputType:"touch"===l.inputType?"pointer":l.inputType,timestamp:s,chartType:i,chartId:a})):t({type:"hover-end",timestamp:s,chartType:i,chartId:a}))}function mn(e){const{onObservation:t,datum:n,x:r=0,y:o=0,chartType:i,chartId:a,context:l,timestamp:s=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:r,y:o,timestamp:s,chartType:i,chartId:a}),"activate"===l?.type&&t({type:"activate",datum:n,inputType:l.inputType,timestamp:s,chartType:i,chartId:a})):t({type:"click-end",timestamp:s,chartType:i,chartId:a}))}import*as pn from"react";import{jsx as gn,jsxs as bn}from"react/jsx-runtime";function xn({componentName:e,message:t,diagnosticHint:n,width:r,height:o}){return gn("div",{role:"alert",style:{width:r,height:Math.max(o,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:bn("div",{style:{textAlign:"center",maxWidth:400},children:[gn("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),gn("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&gn("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}import{jsx as vn}from"react/jsx-runtime";var kn=class extends pn.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:vn(xn,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}};import{jsx as wn}from"react/jsx-runtime";var $n="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Mn({componentName:e,width:t,height:n,children:r}){return wn(kn,{fallback:r=>wn(xn,{componentName:e,message:r.message,width:t,height:n}),children:r})}var Sn={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},An={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function Wn(e,t,n,r){return!1===r||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?wn("div",{style:{...Sn,width:t,height:n},children:r||"No data available"}):null}function jn(e,t,n,r){if(!e)return null;if(!1===r)return null;if(null!=r)return wn("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:r});const o=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*o))),a=Math.max(6,Math.floor(n/(2.5*o))),l=Math.floor((n-(o*(i+a)-a))/2);return wn("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:o},(e,n)=>wn("div",{className:"semiotic-loading-bar",style:{...An,position:"absolute",top:l+n*(i+a),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function Cn(e,t,n,r){if(!$n)return;if(!t||0===t.length)return;if("string"!=typeof r)return;const o=t[0];if(!o||"object"!=typeof o)return;if(r in o)return;const i=Object.keys(o).join(", ");console.warn(`[semiotic] ${e}: ${n} "${r}" not found in data. Available keys: ${i}`)}import{useId as Rn,useMemo as Nn,useCallback as Ln}from"react";function On(e){const t=[];for(const[n,r]of Object.entries(e.fields))if("point"===r.type)t.push(e=>r.values.has(e[n]));else{const[e,o]=r.range;t.push(t=>{const r=t[n];return r>=e&&o>=r})}return e=>t.every(t=>t(e))}function In(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function zn(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[Fn,Dn]=W(e=>({selections:new Map,setClause(t,n){e(e=>{const r=e.selections.get(t),o=r?.clauses.get(n.clientId);if(o&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,r]of n){const n=t.fields[e];if(!n||!zn(r,n))return!1}return!0}(o,n))return{};const i=new Map(e.selections),a=In(i,t),l=new Map(a.clauses);return l.set(n.clientId,n),i.set(t,{...a,clauses:l}),{selections:i}})},clearClause(t,n){e(e=>{const r=e.selections.get(t);if(!r||!r.clauses.has(n))return{};const o=new Map(e.selections),i=new Map(r.clauses);return i.delete(n),o.set(t,{...r,clauses:i}),{selections:o}})},setResolution(t,n){e(e=>{const r=e.selections.get(t);if(r?.resolution===n)return{};const o=new Map(e.selections),i=In(o,t);return o.set(t,{...i,resolution:n}),{selections:o}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const r=new Map(e.selections);return r.set(t,{...n,clauses:new Map}),{selections:r}})}}));import{useSyncExternalStore as Pn}from"react";var Tn={positions:new Map},Bn=new Set;function En(){for(const e of Bn)e()}function Hn(e,t){const n=Tn.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const r=new Map(Tn.positions);r.delete(e),Tn={positions:r},En()}function Gn(e,t){const n=Tn.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const r=new Map(Tn.positions);r.delete(e),Tn={positions:r},En()}function qn(){return Tn}function _n(e){return Bn.add(e),()=>Bn.delete(e)}var Yn={positions:new Map};function Vn(){return()=>{}}function Un(){return Yn}function Zn(e){const t=Pn(e?_n:Vn,e?qn:Un,e?qn:Un);return e?t.positions.get(e)??null:null}function Xn(e){const t=Rn(),n=e.clientId||t,{name:r}=e,o=Dn(e=>e.selections.get(r)),i=Dn(e=>e.setClause),a=Dn(e=>e.clearClause),l=Nn(()=>!!o&&o.clauses.size>0,[o]);return{predicate:Nn(()=>o&&0!==o.clauses.size?function(e,t){const n=[];for(const[r,o]of e.clauses)"crossfilter"===e.resolution&&r===t||n.push(On(o));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(o,n):()=>!0,[o,n]),isActive:l,selectPoints:Ln(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"point",values:new Set(r)},o=!0;o&&i(r,{clientId:n,type:"point",fields:t})},[n,r,i]),selectInterval:Ln(e=>{const t={};let o=!1;for(const[n,r]of Object.entries(e))t[n]={type:"interval",range:r},o=!0;o&&i(r,{clientId:n,type:"interval",fields:t})},[n,r,i]),clear:Ln(()=>{a(r,n)},[a,r,n]),clientId:n}}function Jn(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Kn(e){const{name:t,xField:n,yField:r}=e,{predicate:o,isActive:i,selectInterval:a,clear:l}=Xn({name:t,fields:[n,r].filter(Boolean)}),s=n&&r?"xyBrush":n?"xBrush":"yBrush",c=Ln(e=>{if(!e)return void l();const t={};"xyBrush"===s&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),r&&(t[r]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===s&&Jn(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===s&&Jn(e)&&r&&(t[r]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Qn(t)&&a(t)},[s,n,r,a,l]);return{brushInteraction:Nn(()=>({brush:s,during:c,end:c}),[s,c]),predicate:o,isActive:i,clear:l}}function Qn(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function er(e){return e?"string"==typeof e?{name:e}:e:null}function tr(e,t,n){return t?(r,...o)=>{const i={...e(r,...o)};if(t.isActive)if(t.predicate(r))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??.5;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var nr={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:44,snap:"nearestDatum",brushHandleSize:44,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function rr(e,t={}){const n=t.mobileSemantics?.interaction,r="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,o="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==r,a=e&&"object"==typeof e?e:void 0;if(!1===e||!1===a?.enabled||void 0===e&&!o&&!i)return nr;const l=a??{};return{enabled:!0,tapToSelect:l.tapToSelect??!0,tapToLockTooltip:l.tapToLockTooltip??!0,clearSelection:l.clearSelection??"backgroundTap",targetSize:l.targetSize??r??44,snap:l.snap??"nearestDatum",brushHandleSize:l.brushHandleSize??44,standardControls:l.standardControls??!1}}var or={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 ir(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(or,e)}function ar(e,t,n){const r=or[e||"primary"],o=e&&"primary"!==e||!n?.width?r.width:n.width,i=e&&"primary"!==e||!n?.height?r.height:n.height,a={...t,mode:e},l=s(a,{width:t.width??o,height:t.height??i}).props,c=l.mode||e||"primary",d=or[c],u="context"===c||"sparkline"===c,h="primary"===c&&n?.width?n.width:d.width;return{mode:c,width:l.width??h,height:l.height??("primary"===c&&n?.height?n.height:d.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:lr(d.marginDefaults,l.showCategoryTicks,l.orientation),compactMode:u,mobileInteraction:rr(l.mobileInteraction,{mode:c,width:l.width??h,mobileSemantics:l.mobileSemantics}),mobileSemantics:l.mobileSemantics}}function lr(e,t,n){if(!1!==t)return e;const r={...e};return"horizontal"===n?r.left=Math.min(r.left,15):r.bottom=Math.min(r.bottom,15),r}import{useMemo as sr,useCallback as cr,useState as dr,useId as ur,useEffect as hr,useRef as fr}from"react";import{createContext as yr,useContext as mr,useMemo as pr}from"react";import{scaleOrdinal as gr}from"d3-scale";var br={category10:v,tableau10:w,set3:k,...h},xr=v,vr="#007bff";function kr(e,t,n=xr){if(e&&"object"==typeof e&&!Array.isArray(e)){const t=Object.values(e).filter(e=>"string"==typeof e&&e.length>0);if(t.length>0)return t}if(Array.isArray(e)&&e.length>0)return e;if("string"==typeof e){const t=br[e];if(Array.isArray(t)&&t.length>0)return t}return t&&t.length>0?t:n}var wr=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],$r=["#f0f0f0","#b5d4ea","#f4c2a1","#b8dab2","#d4b5e0","#f9e0a2","#a8d8d8"],Mr=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 Sr(e,t,n){if("function"==typeof t){const r=t(e);return n&&r&&"string"==typeof r&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Mr.has(t)}(r)?n(r):r}const r=e?.[t]+"";return n?n(r):xr[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(r))%xr.length]}function Ar(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function Wr(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>Ar(e,t)??"#999"}const r=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),o=r.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return gr().domain(r).range(n).unknown("#999");const i=br[n]||br.category10;if(o&&"function"==typeof i){let e=-1/0;for(const t of r){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:xr;return gr().domain(r).range(e).unknown("#999")}}function jr(e,t,n=[3,20],r){let o;if(o="function"==typeof t?t(e):e?.[t],!r)return o;const[i,a]=r,[l,s]=n;if(a===i)return(l+s)/2;let c=(o-i)/(a-i);return 0>c?c=0:c>1&&(c=1),l+c*(s-l)}import{jsx as Cr}from"react/jsx-runtime";var Rr=yr(null);function Nr(){return mr(Rr)}import{createContext as Lr,useContext as Or,useEffect as Ir,useId as zr,useLayoutEffect as Fr,useMemo as Dr,useRef as Pr,useState as Tr,useCallback as Br}from"react";import*as Er from"react";var Hr=22;function Gr(e){const t=Math.max(1,e?.swatchSize??16),n=Math.max(t,e?.rowHeight??22);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??6),itemGap:Math.max(0,e?.itemGap??10),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}function qr(e,t){let n=24;return e.map(({hasLabel:e,itemCount:r})=>{n+=5;const o=n;let i;n+=8,e&&(n+=16,i=n,n+=8);const a=n;return n+=r*t+8,{lineY:o,labelY:i,itemsY:a,endY:n}})}import{jsx as _r,jsxs as Yr}from"react/jsx-runtime";var Vr={fill:(e,t)=>_r("rect",{style:e,width:t,height:t}),line:(e,t)=>_r("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function Ur(e,t,n,r,o){let i;return i="function"==typeof n?n(e):(0,Vr[n])(r(e,t),o),i}function Zr({swatchSize:e}){return _r("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Xr(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var Jr=(e,t,n,r,o,i,a,l,s,c,d)=>{const{type:u="fill",styleFn:h,items:f}=e,y=[];let m=0;const p=!(!t&&!n),g="isolate"===c||void 0===c&&null!=o,{swatchSize:b,labelGap:x,rowHeight:v}=d;return f.forEach((e,c)=>{const d=Ur(e,c,u,h,b),k=Xr(e,r,o),w=o&&o.size>0&&o.has(e.label);y.push(Yr("g",{transform:`translate(0,${m})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:p?l===i&&c===a?0:-1:void 0,role:p?"option":void 0,"aria-selected":p&&g?w||!1:void 0,"aria-current":p&&!g&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:p?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;s(l,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:p?t=>{s(l,c),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:p?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:p?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[p&&_r("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*e.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,w&&_r(Zr,{swatchSize:b}),_r("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),m+=v}),y};function Kr({config:e,orientation:t="vertical",width:n=100}){const{colorFn:r,domain:o,label:i,format:a}=e,l=a||(e=>Math.round(100*e)/100+""),s="grad-legend-"+Er.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),a=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(_r("stop",{offset:100*t+"%",stopColor:r(o[0]+t*(o[1]-o[0]))},e))}return Yr("g",{"aria-label":i||"Gradient legend",children:[_r("defs",{children:_r("linearGradient",{id:s,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&_r("text",{x:a+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),_r("rect",{x:a,y:0,width:t,height:e,fill:`url(#${s})`,rx:2}),_r("text",{x:a,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[0])}),_r("text",{x:a+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push(_r("stop",{offset:100*t+"%",stopColor:r(o[1]-t*(o[1]-o[0]))},e))}return Yr("g",{"aria-label":i||"Gradient legend",children:[i&&_r("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),_r("defs",{children:_r("linearGradient",{id:s,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),_r("rect",{x:0,y:0,width:14,height:100,fill:`url(#${s})`,rx:2}),_r("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[1])}),_r("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:l(o[0])})]})}function Qr(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,legendInteraction:a,title:l="Legend",width:s=100,height:c=20,orientation:d="vertical",legendLayout:u}=e,h=Gr(u),[f,y]=Er.useState(0),[m,p]=Er.useState(0),g=Er.useCallback((e,t)=>{y(e),p(t)},[]),b="vertical"===d?(({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:s,legendInteraction:c,metrics:d})=>{const u=[],h=qr(e.map(e=>({hasLabel:!!e.label,itemCount:e.items.length})),d.rowHeight);return e.forEach((e,f)=>{const y=h[f];u.push(_r("line",{stroke:"gray",x1:0,y1:y.lineY,x2:t,y2:y.lineY},"legend-top-line legend-symbol-"+f)),e.label&&null!=y.labelY&&u.push(_r("text",{y:y.labelY,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),u.push(_r("g",{className:"legend-item",transform:`translate(0,${y.itemsY})`,children:Jr(e,n,r,o,i,a,l,f,s,c,d)},"legend-group-"+f))}),u})({legendGroups:t||[],width:s,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:a,metrics:h}):(({legendGroups:e,height:t,width:n,customClickBehavior:r,customHoverBehavior:o,highlightedCategory:i,isolatedCategories:a,focusedGroupIndex:l,focusedItemIndex:s,onFocusedIndexChange:c,legendInteraction:d,metrics:u})=>{let h=0;const f=[];e.forEach((e,t)=>{let y=0;e.label&&(y+=16);const m=((e,t,n,r,o,i,a,l,s,c,d,u)=>{const{type:h="fill",styleFn:f,items:y}=e,m=[],{swatchSize:p,labelGap:g,itemGap:b,rowHeight:x,align:v}=d,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=o,$=y.map(e=>p+g+7*e.label.length),M=[];let S=0,A=0;$.forEach((e,t)=>{const n=0===A?e:A+b+e;u&&u>0&&A>0&&n>u?(M.push({start:S,end:t,width:A}),S=t,A=e):A=n}),y.length>0&&M.push({start:S,end:y.length,width:A}),M.forEach((e,c)=>{let d="center"===v?Math.max(0,((u??e.width)-e.width)/2):"end"===v?Math.max(0,(u??e.width)-e.width):0;for(let u=e.start;e.end>u;u++){const e=y[u],v=Ur(e,u,h,f,p),M=Xr(e,r,o),S=o&&o.size>0&&o.has(e.label);m.push(Yr("g",{transform:`translate(${d},${c*x})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?l===i&&u===a?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?S||!1:void 0,"aria-current":k&&!w&&null!=r&&e.label===r||void 0,"aria-label":e.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(u+("ArrowRight"===n.key?1:-1)+y.length)%y.length;s(l,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{s(l,u),n&&n(e);const r=t.currentTarget.querySelector(".semiotic-legend-focus-ring");r&&r.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:M,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&_r("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:p+g+2+7*e.label.length,height:p+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,S&&_r(Zr,{swatchSize:p}),_r("text",{y:p/2,x:p+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+u)),d+=$[u]+b}});const W=Math.max(0,...M.map(e=>e.width)),j=M.length;return{items:m,offset:W,totalRows:j,totalHeight:j*x}})(e,r,o,i,a,l,s,t,c,d,u,u.maxWidth??n);y+=m.offset+5,f.push({label:e.label,...m,offset:y,totalRows:m.totalRows,totalHeight:m.totalHeight}),h+=y+12});const y=u.maxWidth??n;let m=h>y?0:"center"===u.align?Math.max(0,(y-h)/2):"end"===u.align?Math.max(0,y-h):0;const p=[];return f.forEach((n,r)=>{const o=e[r];o.label&&(p.push(_r("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:o.label},"legend-text-"+r)),m+=16),p.push(_r("g",{className:"legend-item",transform:`translate(${m},0)`,children:n.items},"legend-group-"+r)),m+=n.offset+5,e[r+1]&&p.push(_r("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+r)),m+=12}),_r("g",{children:p})})({legendGroups:t||[],title:l,height:c,width:s,customClickBehavior:n,customHoverBehavior:r,highlightedCategory:o,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:m,onFocusedIndexChange:g,legendInteraction:a,metrics:h}),x=!(!n&&!r);return Yr("g",{role:x?"listbox":void 0,"aria-multiselectable":!(!x||"isolate"!==a&&(void 0!==a||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==l&&""!==l&&"vertical"===d&&_r("text",{className:"legend-title",y:16,x:s/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:l}),b]})}import{jsx as eo,jsxs as to}from"react/jsx-runtime";var no=Lr(!1);Lr(!1);var ro=Lr(null),oo="undefined"==typeof window?Ir:Fr;function io(...e){let t;for(const n of e)n&&(t=ao(t)&&ao(n)?{legendGroups:[...t.legendGroups,...n.legendGroups]}:n);return t}function ao(e){return"object"==typeof e&&null!==e&&"legendGroups"in e&&Array.isArray(e.legendGroups)}function lo(e){return"object"==typeof e&&null!==e&&"gradient"in e}function so(e,t,n){const r=e.xValue??t?.[n];if(null==r)return null;const o=Number(r);return Number.isFinite(o)?o:null}function co(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}function uo(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var ho=[];function fo(){const e=t(),n=e?.colors?.categorical;return n&&n.length>0?n:void 0}function yo(e,t,n,r,o){if(e)return e;if(n&&"object"==typeof n&&!Array.isArray(n)){const e=Ar(n,r);if(e)return e}let i;if(Array.isArray(n))i=n;else if(t&&t.length>0)i=t;else if("string"==typeof n){const e=br[n];Array.isArray(e)&&(i=e)}return i&&0!==i.length?null!=r?(o.has(r)||o.set(r,o.size),i[o.get(r)%i.length]):i[0]:vr}function mo(e,t,n){const r=Nr(),o=fo();return sr(()=>{if(!t)return;const i=r??void 0,a=n??(o&&o.length>0?o:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&uo(i)){const e=Wr(n.map(e=>({_cat:e})),"_cat",a);return t=>i[t]||e(t)}return Wr(n.map(e=>({_cat:e})),"_cat",a)}if(i&&uo(i)){const n=Wr(e,t,a);return e=>i[e]||n(e)}return Wr(e,t,a)}if(i&&uo(i)){const e=Wr([{_:"a"}],"_",a);return t=>i[t]||e(t)}},[e,t,n,r,o])}function po({selection:e,linkedHover:t,fallbackFields:n=ho,unwrapData:r=!1,onObservation:o,chartType:i,chartId:a,onClick:l,hoverHighlight:s,colorByField:c,mobileInteraction:u}){const h=ur(),f=sr(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),[t,n]),y=sr(()=>"series"===f?.mode?[f.seriesField||c||n[0]].filter(e=>!!e):f?.fields||n,[f,c,n]),m=Xn({name:e?.name||"__unused__",fields:y}),p=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:r,isActive:o,selectPoints:i,clear:a}=Xn({name:t,fields:n});return{onHover:Ln(e=>{if(!e)return void a();const t={};for(const r of n){const n=e[r];void 0!==n&&(t[r]=[n])}Qn(t)&&i(t)},[n,i,a]),predicate:r,isActive:o}}({name:f?.name||"hover",fields:y}),g=d(e=>e.pushObservation),b=cr(e=>{o?.(e),g?.(e)},[o,g]),x=e?{isActive:m.isActive,predicate:m.predicate}:null,[v,k]=dr(null),w=fr(!1),$=c||n[0],M=sr(()=>{if(!s||null==v||!$)return null;const e=v,t=$;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[s,v,$]),S=cr((e,n)=>{const r=!e&&w.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===f?.mode&&f.xField){const n=so(e,t,f.xField);null!=n&&function(e,t,n){const r=Tn.positions.get(e);r?.locked||r&&r.xValue===t&&r.sourceId===n||(Tn={positions:new Map(Tn.positions).set(e,{xValue:t,sourceId:n})},En())}(f.name||"hover",n,h)}"x-position"!==f?.mode&&p.onHover(t)}else"x-position"!==f?.mode||r||Hn(f.name||"hover",h),"x-position"===f?.mode||r||p.onHover(null);if(s&&$)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[$];k(null!=n?n+"":null)}else r||k(null);(o||g)&&yn({onObservation:b,datum:e?co(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:a,context:n})},[t,p,f,h,o,i,a,g,b,s,$,u]),A=cr((n=!0)=>{w.current=!1,t&&"x-position"!==f?.mode&&p.onHover(null),e&&u?.tapToSelect&&m.clear(),n&&s&&k(null),"x-position"===f?.mode&&(Gn(f.name||"hover",h),Hn(f.name||"hover",h))},[t,f,p,e,u,m,s,h]),W=cr((n,r)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),d=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===f?.mode&&f.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=so(n,e,f.xField);null!=t&&function(e,t,n){const r=Tn.positions.get(e);if(r?.locked){const t=new Map(Tn.positions);return t.delete(e),Tn={positions:t},En(),!1}Tn={positions:new Map(Tn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},En()}(f.name||"hover",t,h)}if(c)if(n){w.current=!0;const r=co(n);if(t&&"x-position"!==f?.mode&&p.onHover(r),e&&u?.tapToSelect&&y.length>0){const e={};for(const t of y){const n=r[t];void 0!==n&&(e[t]=[n])}uo(e)&&m.selectPoints(e)}if(s&&$){const e=r?.[$];k(null!=e?e+"":null)}}else d&&A();if(n||d){if(n&&l){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),l(e,{x:n.x??0,y:n.y??0})}(o||g)&&mn({onObservation:b,datum:n?co(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:a,context:r})}},[l,o,g,b,i,a,f,h,u,t,p,e,m,y,s,$,A]);return hr(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&w.current&&A()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,A]),hr(()=>()=>{w.current&&A(!1)},[A]),hr(()=>{if("x-position"!==f?.mode)return;const e=f.name||"hover";return()=>{Gn(e,h),Hn(e,h)}},[f?.mode,f?.name,h]),{activeSelectionHook:x,hoverSelectionHook:M,customHoverBehavior:S,customClickBehavior:W,crosshairSourceId:h}}function go(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function bo({data:e,colorBy:t,colorScale:n,showLegend:r,legendPosition:o="right",userMargin:i,defaults:a={top:50,bottom:60,left:70,right:40},categories:l,additionalLegend:s}){const c=Or(no),d=null!==Or(ro),u=void 0!==r?r:!c&&!!t,h=!!t&&(u||d),f=sr(()=>{if(!h)return[];if(void 0!==l)return l;const n=new Set;for(const r of e){const e="function"==typeof t?t(r):r[t];null!=e&&n.add(e+"")}return Array.from(n)},[l,t,e,h]);!function(e){const t=Or(ro),n=zr(),r=function(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}(e),o=Pr([]);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(o.current,r)||(o.current=r);const i=o.current;oo(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),oo(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(d&&t?f:[]);const y=sr(()=>{if(!u||!t)return;const r=function({data:e,colorBy:t,colorScale:n,getColor:r,strokeColor:o,strokeWidth:i,categories:a}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==o&&(n.stroke=o),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(a&&a.length>0?a:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((o,i)=>{const a=e.find("function"==typeof t?e=>t(e)===o:e=>e[t]===o),l=a?r(a,t,n):n?n(o):wr[i%wr.length];return{label:o+"",color:l}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Sr,categories:f});return 0!==r.legendGroups.reduce((e,t)=>e+t.items.length,0)?r:void 0},[u,t,e,n,f]),m=sr(()=>io(y,s),[y,s]),p=sr(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:a[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},r=t=>"number"==typeof e[t];return m&&("right"===o&&!r("right")&&110>n.right?n.right=110:"left"===o&&!r("left")&&110>n.left?n.left=110:"top"===o&&!r("top")&&50>n.top?n.top=50:"bottom"===o&&!r("bottom")&&80>n.bottom&&(n.bottom=80)),n},[a,i,m,o]);return{legend:m,margin:p,legendPosition:o}}function xo(e,t,n){const[r,o]=dr(null),[i,a]=dr(new Set),l=sr(()=>new Set,[]),s=cr(t=>{"highlight"===e&&o(t?t.label:null)},[e]),c=cr(t=>{"isolate"===e&&a(e=>{const r=new Set(e);return r.has(t.label)?r.delete(t.label):r.add(t.label),r.size===n.length?new Set:r})},[e,n.length]),d=sr(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=r?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===r}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const r=n?e[n]:"function"==typeof t?t(e):null;return i.has(r)}}:null},[e,t,r,i]);return{highlightedCategory:"highlight"===e?r:null,isolatedCategories:"isolate"===e?i:l,onLegendHover:s,onLegendClick:c,legendSelectionHook:d}}function vo(e,t,n){return ar(e,t,n)}import{jsx as ko}from"react/jsx-runtime";function wo(e){const{legend:t,totalWidth:n,totalHeight:r,margin:o,legendPosition:i="right",legendLayout:a,title:l,legendHoverBehavior:s,legendClickBehavior:c,legendHighlightedCategory:d,legendIsolatedCategories:u,legendInteraction:h}=e;if(!t)return null;const f="top"===i||"bottom"===i,y=!!l,m=Math.max(0,n-o.left-o.right),p=Math.max(1,f?a?.maxWidth??m:100);let g,b;return"left"===i?(g=Math.max(4,o.left-p-10),b=o.top):"top"===i?(g=o.left,b=y?32:8):"bottom"===i?(g=o.left,b=r-o.bottom+38):(g=n-o.right+10,b=o.top),ko("g",{transform:`translate(${g}, ${b})`,children:lo(t)?ko(Kr,{config:t.gradient,orientation:f?"horizontal":"vertical",width:p}):ao(t)?ko(Qr,{legendGroups:t.legendGroups,title:"",width:p,orientation:f?"horizontal":"vertical",legendLayout:a,customHoverBehavior:s,customClickBehavior:c,highlightedCategory:d,isolatedCategories:u,legendInteraction:h}):t})}import{jsx as $o}from"react/jsx-runtime";var Mo={secondary:0,primary:3},So=".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 Ao(e){return!0===e?._annotationDeferred}function Wo(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function jo(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function Co(e){return Math.max(.72,.95-.06*e)}function Ro(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:jo(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),r=e.some(e=>Ao(e.annotation)),o=e.some(e=>null!=Wo(e.annotation)),i=e.some(e=>"layer"===Wo(e.annotation));if(!n&&!r&&!o)return e.map(e=>e.node);const a=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);a.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,a.length)});for(const e of t)e.emphasis&&(e.rank=Mo[e.emphasis]);const l=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:r,readingOrder:o}=e,i=Ao(t.annotation);let a=t.node;if("primary"===r||"secondary"===r||null!=o){const e=null==r&&null!=o;a=$o("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+r,..."secondary"===r?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:Co(o),"data-annotation-reading-order":o}:{},children:t.node},"annotation-emphasis-"+n)}const l=Wo(t.annotation);return l&&(a=$o("g",{className:"annotation-cohesion--"+l,children:a},"annotation-cohesion-"+n)),i&&(a=$o("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:a},"annotation-deferred-"+n)),a});return r&&l.unshift($o("style",{children:So},"annotation-disclosure-style")),i&&l.unshift($o("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),l}import*as No from"react";import{jsx as Lo,jsxs as Oo}from"react/jsx-runtime";function Io(e,t=120,n=8){if(!e)return[];const r=Math.max(1,Math.floor(t/n)),o=e.split(/\s+/),i=[];let a="";for(const e of o)a&&a.length+1+e.length>r?(i.push(a),a=e):a=a?`${a} ${e}`:e;return a&&i.push(a),i}function zo(e,t,n,r){return"curly"===e?r?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:r?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Fo(e,t,n,r){if(!e)return Lo("g",{className:"annotation-note"});const{label:o,title:i,orientation:a,align:l,wrap:s=120,noWrap:c}=e;if(!o&&!i)return Lo("g",{className:"annotation-note"});let d=a;d||(d=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let u=l;u&&"dynamic"!==u||(u="topBottom"===d?0>t?"right":"left":0>n?"bottom":"top");let h="start";"topBottom"===d?"right"===u?h="end":"middle"===u&&(h="middle"):h=0>t?"end":"start";const f=16,y=i?c?[i]:Io(i,s):[],m=o?c?[o]:Io(o,s):[],p="leftRight"===d?"end"===h?-4:4:0;let g=0;const b=[],x=r||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?b.push(Lo("foreignObject",{className:"annotation-note-html",x:"end"===h?p-s:"middle"===h?p-s/2:p,y:-16,width:s,height:Math.max(f,(y.length+m.length)*f+(i&&o?2:0))+f,style:{overflow:"visible"},children:Oo("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:x,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===h?"right":"middle"===h?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&Lo("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),o&&Lo("div",{className:"annotation-note-label",children:o})]})},"annotation-note-html")):(y.length>0&&(b.push(Lo("text",{className:"annotation-note-title",fill:x,textAnchor:h,fontWeight:"bold",children:y.map((e,t)=>Lo("tspan",{x:p,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=y.length*f),m.length>0&&b.push(Lo("text",{className:"annotation-note-label",fill:x,textAnchor:h,y:g,children:m.map((e,t)=>Lo("tspan",{x:p,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let v=null;if((i||o)&&(0!==t||0!==n))if("topBottom"===d){const e=Math.min(s,120);let t=0,n=e;"end"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),v=Lo("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(y.length+m.length)*f+(m.length>0?f:0);let t=0,n=e;"bottom"===u?(t=-e,n=0):"middle"===u&&(t=-e/2,n=e/2),v=Lo("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:r||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,y.length+m.length-1)*f;let w=0;return"topBottom"===d?w=0>n?-(k+2):18:"leftRight"===d&&(w="middle"===u?-(k+f+(m.length>0&&y.length>0?2:0))/2+8:"bottom"===u||0>n?-(k+2):18),Oo("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[Lo("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:b}),v]})}function Do(e,t,n,r,o){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push(Lo("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,r=t?.height||0;(e>0||r>0)&&i.push(Lo("rect",{width:e,height:r,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=r||0,a=o||0;if(void 0!==t?.x){const r=(t.x||0)-e;i.push(Lo("line",{x1:r,y1:(t.y1||0)-a,x2:r,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const r=(t.y||0)-a;i.push(Lo("line",{x1:(t.x1||0)-e,y1:r,x2:(t.x2||0)-e,y2:r,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push(Lo("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push(Lo("line",{x1:0,y1:(t.y1||0)-a,x2:0,y2:(t.y2||0)-a,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",r=t?.width??t?.height;void 0!==r&&i.push(Lo("path",{d:zo(e,r,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return Lo("g",{className:"annotation-subject",children:i})}function Po(e,t,n,r,o,i){const a=[];let l=0,s=0;if("callout-circle"!==o&&"label"!==o||!i?.radius){if("callout-rect"===o&&i){const n=i.width||0,r=i.height||0;if(n>0||r>0){const o=n/2,i=r/2,a=e-o,c=t-i;if(0!==a||0!==c){const e=Math.abs(a),t=Math.abs(c),d=n/2,u=r/2,h=e*u>t*d?d/e:u/t;l=o+a*h,s=i+c*h}}}else if("bracket"===o&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(l=e/2,s=n):void 0!==t&&(l=n,s=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const r=Math.atan2(t,e);l=Math.cos(r)*n,s=Math.sin(r)*n}}const c=Math.sqrt((e-l)**2+(t-s)**2);if(c>.5){const o=r||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let d=Math.atan2(t-s,e-l);if(i){const r=(l+e)/2,i=(s+t)/2,u=-(t-s)/c,h=(e-l)/c,f=(n?.curve??.25)*c,y=r+u*f,m=i+h*f;a.push(Lo("path",{className:"connector-curve",d:`M${l},${s}Q${y},${m} ${e},${t}`,fill:"none",stroke:o},"connector-line")),d=Math.atan2(m-s,y-l)}else a.push(Lo("line",{x1:l,y1:s,x2:e,y2:t,stroke:o},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;a.push(Lo("path",{d:`M${l},${s}L${l+e*Math.cos(d+t)},${s+e*Math.sin(d+t)}L${l+e*Math.cos(d-t)},${s+e*Math.sin(d-t)}Z`,fill:o,stroke:"none"},"connector-arrow"))}}return Lo("g",{className:"annotation-connector",children:a})}function To(e){const{x:t=0,y:n=0,dx:r,dy:o,nx:i,ny:a,note:l,connector:s,subject:c,type:d,color:u,className:h,disable:f,opacity:y,strokeDasharray:m,events:p={},"data-testid":g}=e,b=Array.isArray(t)?t[0]??0:t,x=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=r||0,w=o||0;null!=i&&(k=i-b),null!=a&&(w=a-x);const $="string"==typeof d?d:"label";if("bracket"===$&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return Oo("g",{className:("annotation "+(h||"")).trim(),transform:`translate(${b},${x})`,"data-testid":g,...null!=y&&{opacity:y},...m&&{strokeDasharray:m},...p,children:[!v.has("connector")&&Po(k,w,s,u,$,c),!v.has("subject")&&Do($,c,u,b,x),!v.has("note")&&Fo(l,k,w,u)]})}function Bo(e){const{noteData:t}=e,{screenCoordinates:n}=t,r="string"==typeof t.type?t.type:"label",o=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),o=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const a=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:o});return Lo(To,{"data-testid":"semiotic-annotation",...a,type:r},"multi-annotation-"+i)});return Lo("g",{children:i})}const i=t.note||{title:"none",label:t.label},a=`${i.label}-${i.title}-${t.i}`;return Lo(To,{"data-testid":"semiotic-annotation",events:o,...t,type:r},a)}import{packEnclose as Eo}from"d3-hierarchy";import{area as Ho,curveLinear as Go,curveMonotoneX as qo,curveMonotoneY as _o,curveStep as Yo,curveStepAfter as Vo,curveStepBefore as Uo,curveBasis as Zo,curveCardinal as Xo,curveCatmullRom as Jo}from"d3-shape";function Ko(e){return Math.round(100*e)/100}function Qo(e,t=2){const n=[],r=[],o=t+1;for(let t=0;o>t;t++){let i=0;for(const[n,r]of e)null!==r&&(i+=n**t*r);n.push(i);const a=[];for(let n=0;o>n;n++){let r=0;for(const[o,i]of e)null!==i&&(r+=o**(t+n));a.push(r)}r.push(a)}r.push(n);const i=function(e,t){const n=e,r=e.length-1,o=[t];for(let e=0;r>e;e++){let t=e;for(let o=e+1;r>o;o++)Math.abs(n[e][o])>Math.abs(n[e][t])&&(t=o);for(let o=e;r+1>o;o++){const r=n[o][e];n[o][e]=n[o][t],n[o][t]=r}for(let t=e+1;r>t;t++)for(let o=r;o>=e;o--)n[o][t]-=n[o][e]*n[e][t]/n[e][e]}for(let e=r-1;e>=0;e--){let t=0;for(let i=e+1;r>i;i++)t+=n[i][e]*o[i];o[e]=(n[r][e]-t)/n[e][e]}return o}(r,o).map(Ko);return{points:e.map(([e])=>[Ko(e),Ko(i.reduce((t,n,r)=>t+n*e**r,0))]),equation:[...i].reverse()}}import{jsx as ei,jsxs as ti}from"react/jsx-runtime";var ni="var(--semiotic-bg, #ffffff)";function ri(e){const{x:t,y:n,text:r,fill:o,fontSize:i=12,fontWeight:a,fontFamily:l,textAnchor:s="start",dominantBaseline:c,background:d,className:u}=e,h=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(d),f=e=>ei("text",{x:t,y:n,textAnchor:s,dominantBaseline:c,fill:o,fontSize:i,fontWeight:a,fontFamily:l,className:u,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:r});if(!h)return f();if("halo"===h.type)return f({stroke:h.fill??ni,strokeWidth:h.haloWidth??3});const y=h.padding??{x:6,y:3},m="number"==typeof y?y:y.x,p="number"==typeof y?y:y.y,g=function(e,t){return(e+"").length*t*.6}(r,i),b=i+2*p;let x,v;return x="middle"===s?t-g/2-m:"end"===s?t-g-m:t-m,v="middle"===c||"central"===c?n-b/2:"hanging"===c||"text-before-edge"===c?n-p:n-.8*i-p,ti("g",{className:u,children:[ei("rect",{x:x,y:v,width:g+2*m,height:b,rx:h.radius??3,ry:h.radius??3,fill:h.fill??ni,fillOpacity:h.opacity??.85,stroke:h.stroke,strokeWidth:h.strokeWidth}),f()]})}import{jsx as oi,jsxs as ii}from"react/jsx-runtime";var ai={linear:Go,monotoneX:qo,monotoneY:_o,step:Yo,stepAfter:Vo,stepBefore:Uo,basis:Zo,cardinal:Xo,catmullRom:Jo};function li(e,t,n,r){const o=[];return e.forEach((e,i)=>{let a;if(n){const o=n(e,i,r);a=null!=o?o:t(e,i,r)}else a=t(e,i,r);a&&o.push({node:a,annotation:e})}),Ro(o)}function si(e,t={}){return function(e,r,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=p(e,r,o);if(!t)return null;const{x:n,y:i}=t;if(!m(n,i,o))return null;const a="callout"===e.type?"callout-circle":e.type,l="callout-circle"===a?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===a?{width:e.width,height:e.height}:void 0;return oi(Bo,{noteData:{x:n,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:a,...l?{subject:l}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+r)}case"x-threshold":{const t=b(null!=e.value?{...e,x:e.value}:e,o);if(null==t)return null;const n=e.color||"#f97316",i=e.labelPosition||"top";let a;a="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const l=t>.6*(o.width||0),s=l?t-4:t+4,c=l?"end":"start";return ii("g",{opacity:e.opacity,children:[oi("line",{x1:t,y1:0,x2:t,y2:o.height||0,stroke:n,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&oi(ri,{x:s,y:a,text:e.label,textAnchor:c,fill:n,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+r)}case"y-threshold":{const t=x(null!=e.value?{...e,y:e.value}:e,o);if(null==t)return null;const n=e.color||"#f97316",i=e.labelPosition||"right";let a,s;"left"===i?(a=4,s="start"):"center"===i?(a=(o.width||0)/2,s="middle"):(a=(o.width||0)-4,s="end");const c=20>(l=t)?Math.min((o.height||0)-4,l+16):l-4;return ii("g",{opacity:e.opacity,children:[oi("line",{x1:0,y1:t,x2:o.width||0,y2:t,stroke:n,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&oi(ri,{x:a,y:c,text:e.label,textAnchor:s,fill:n,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+r)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:b({...e,type:"point"},o),y:x({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const n=Eo(t),i=e.padding||10;return ii("g",{children:[oi("circle",{cx:n.x,cy:n.y,r:n.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&oi(ri,{x:n.x,y:n.y-n.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+r)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:b({...e,type:"point"},o),y:x({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const n=e.padding||10,i=t.map(e=>e.x),a=t.map(e=>e.y),[l,s]=M(i),[c,d]=M(a),u=l-n,h=s+n,f=c-n;return ii("g",{children:[oi("rect",{x:u,y:f,width:h-u,height:d+n-f,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&oi(ri,{x:(u+h)/2,y:f-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+r)}case"highlight":{const t=o.data||[],n="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return oi("g",{children:n.map((t,n)=>{const r=b(t,o),a=x(t,o);if(null==r||null==a)return null;const l="function"==typeof e.r?e.r(t):e.r||6,s="function"==typeof e.style?e.style(t):e.style||i;return oi("circle",{cx:r,cy:a,r:l,...s},"hl-"+n)})},"ann-"+r)}case"bracket":{const t=b(e,o),n=x(e,o);return oi(Bo,{noteData:{x:t??0,y:n??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+r)}case"trend":{const t=o.data||[];if(2>t.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",a="ordinal"===o.frameType,l="horizontal"===o.projection,s=a?n:null,c=a?i:null;let d;const u=[],h=new Map;if(a&&s&&c){for(const e of t){const t=e[s];if(null==t)continue;const n=t+"";h.has(n)||(h.set(n,u.length),u.push(n))}d=t.map(e=>{const t=e[s],n=e[c];if(null==t||null==n)return null;const r=h.get(t+"");return null!=r?[r,+n]:null}).filter(e=>null!==e)}else d=t.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>d.length)return null;const f=o.scales?.x??o.scales?.time,y=o.scales?.y??o.scales?.value;if(!f||!y)return null;const m=e=>t=>{const n=Math.max(0,Math.floor(t)),r=Math.min(u.length-1,n+1),o=t-n,i=e(u[n]);return i+(e(u[r])-i)*o},p=f,g=y;let b;if(a)if(l){const e=m(g);b=(t,n)=>[p(n),e(t)]}else{const e=m(p);b=(t,n)=>[e(t),g(n)]}else b=(e,t)=>[p(e),g(t)];const x=e.method||"linear";let v;if("loess"===x)v=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const r=e.slice().sort((e,t)=>e[0]-t[0]),o=r.map(e=>e[0]),i=r.map(e=>e[1]),a=Math.max(2,Math.ceil(t*n)),l=[];for(let e=0;n>e;e++){const t=o[e],r=o.map(e=>Math.abs(e-t)),s=r.slice().sort((e,t)=>e-t)[Math.min(a-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===s?0:r[e]/s;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let d=0,u=0,h=0,f=0,y=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(d+=t,u+=t*o[e],h+=t*i[e],f+=t*o[e]*o[e],y+=t*o[e]*i[e])}if(0===d){l.push([t,i[e]]);continue}const m=d*f-u*u;if(1e-12>Math.abs(m))l.push([t,h/d]);else{const e=(d*y-u*h)/m;l.push([t,(h-e*u)/d+e*t])}}return l}(d,e.bandwidth??.3);else{const t="polynomial"===x?Qo(d,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[r,o]of e)null!==o&&(n++,t[0]+=r,t[1]+=o,t[2]+=r*r,t[3]+=r*o);const r=n*t[2]-t[0]*t[0],o=0===r?0:Ko((n*t[3]-t[0]*t[1])/r),i=Ko(t[1]/n-o*t[0]/n);return{points:e.map(([e])=>[Ko(e),Ko(o*e+i)]),equation:[o,i]}}(d);v=t.points}const k=v.map(([e,t])=>{const[n,r]=b(e,t);return`${n},${r}`}).join(" "),w=e.color||"#6366f1",$=v[v.length-1],[M,S]=b($[0],$[1]);return ii("g",{children:[oi("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&oi("text",{x:M+4,y:S-4,fill:w,fontSize:11,children:e.label})]},"ann-"+r)}case"band":{const t=o.scales?.y??o.scales?.value,n=t?.domain?.(),l=e.y0??n?.[0],s=e.y1??n?.[1],d=null!=l&&t?t(l):0,u=null!=s&&t?t(s):o.height||0,h=c(e.fill,"ann-"+r,"var(--semiotic-primary, #6366f1)");return ii("g",{opacity:e.opacity,children:[h.def&&oi("defs",{children:h.def}),oi("rect",{x:0,y:Math.min(d,u),width:o.width||0,height:Math.abs(u-d),fill:h.fill,fillOpacity:e.fillOpacity||.1}),e.label&&oi(ri,{x:(o.width||0)-4,y:(i=d,a=u,Math.max(Math.min(i,a),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+r)}case"x-band":{const t=o.scales?.x??o.scales?.time,n=t?.domain?.(),i=e.x0??n?.[0],a=e.x1??n?.[1],l=null!=i&&t?t(i):null,s=null!=a&&t?t(a):null;if(null==l||null==s)return null;const d=c(e.fill||e.color,"ann-"+r,"var(--semiotic-primary, #6366f1)");return ii("g",{opacity:e.opacity,children:[d.def&&oi("defs",{children:d.def}),oi("rect",{x:Math.min(l,s),y:0,width:Math.abs(s-l),height:o.height||0,fill:d.fill,fillOpacity:e.fillOpacity??.1}),e.label&&oi(ri,{x:Math.min(l,s)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+r)}case"envelope":{const t=o.data||[];if(2>t.length)return null;const n=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const l=e.upperAccessor||"upperBounds",s=e.lowerAccessor||"lowerBounds",c=e.filter,d=t.filter(e=>null!=e[l]&&null!=e[s]&&!(c&&!c(e))).sort((e,t)=>e[n]-t[n]);if(2>d.length)return null;const u=ai[o.curve||"linear"]||Go,h=Ho().x(e=>i(e[n])).y0(e=>a(e[s])).y1(e=>a(e[l])).curve(u)(d);if(!h)return null;const f=e.fill||"#6366f1";return ii("g",{children:[oi("path",{d:h,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&d.length>0&&oi("text",{x:i(d[d.length-1][n])+4,y:a(d[d.length-1][l])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+r)}case"anomaly-band":{const t=o.data||[];if(2>t.length)return null;const n=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!i||!a)return null;const l=t.map(e=>e[n]).filter(e=>null!=e&&isFinite(e));if(2>l.length)return null;const s=l.reduce((e,t)=>e+t,0)/l.length,c=l.reduce((e,t)=>e+(t-s)**2,0)/l.length,d=Math.sqrt(c),u=e.threshold??2,h=s-u*d,f=!1!==e.showBand,y=e.fill||"#6366f1",m=e.fillOpacity??.1,p=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,v=a(s+u*d),k=a(h),w=t.filter(e=>{const t=e[n];return null!=t&&Math.abs(t-s)>u*d});return ii("g",{children:[f&&oi("rect",{x:0,y:Math.min(v,k),width:o.width||0,height:Math.abs(k-v),fill:y,fillOpacity:m}),w.map((e,t)=>{const n=b(e,o),r=x(e,o);return null==n||null==r?null:oi("circle",{cx:n,cy:r,r:g,fill:p,fillOpacity:.7,stroke:p,strokeWidth:1.5},"anomaly-"+t)}),e.label&&oi("text",{x:(o.width||0)-4,y:Math.min(v,k)-4,textAnchor:"end",fill:y,fontSize:11,children:e.label})]},"ann-"+r)}case"forecast":{const t=o.data||[];if(3>t.length)return null;const n=o.xAccessor||"x",i=o.yAccessor||"y",a=o.scales?.x??o.scales?.time,l=o.scales?.y??o.scales?.value;if(!a||!l)return null;const s=t.map(e=>[e[n],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>s.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=Qo(s,e.order||2).equation;c=e=>t.reduce((t,n,r)=>t+n*Math.pow(e,r),0)}else{const e=s.length;let t=0,n=0,r=0,o=0;for(const[e,i]of s)t+=e,n+=i,r+=e*e,o+=e*i;const i=e*r-t*t;if(1e-12>Math.abs(i))return null;const a=(e*o-t*n)/i,l=(n-a*t)/e;c=e=>l+a*e}const d=s.length,u=s.map(([e,t])=>t-c(e)),h=u.reduce((e,t)=>e+t*t,0),f=Math.sqrt(h/Math.max(d-2,1)),y=s.reduce((e,t)=>e+t[0],0)/d,m=s.reduce((e,t)=>e+(t[0]-y)**2,0),p=e.confidence??.95,g=.99>p?.95>p?.9>p?1:1.645:1.96:2.576,b=e.steps??5,x=s[d-1][0],v=(x-s[0][0])/Math.max(d-1,1),k=[];for(let e=1;b>=e;e++)k.push(x+e*v);const w=[];for(const e of k){const t=c(e),n=f*Math.sqrt(1+1/d+(m>0?(e-y)**2/m:0))*g;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const $=`M${w.map(e=>`${a(e.x)},${l(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${a(e.x)},${l(e.yLower)}`).join(" L")} Z`,M=w.map(e=>`${a(e.x)},${l(e.yCenter)}`).join(" "),S=`${a(x)},${l(c(x))}`,A=e.strokeColor||"#6366f1";return ii("g",{children:[oi("path",{d:$,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),oi("polyline",{points:`${S} ${M}`,fill:"none",stroke:A,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&oi("text",{x:a(w[w.length-1].x)+4,y:l(w[w.length-1].yCenter)-4,fill:A,fontSize:11,children:e.label})]},"ann-"+r)}case"widget":{let i,a;if(null!=e.px&&null!=e.py)i=e.px,a=e.py;else{const t=p(e,r,o);if(!t)return null;i=t.x,a=t.y}if(!m(i,a,o))return null;const l=e.dx??0,s=e.dy??0,c=e.width??32,d=e.height??32,u=e.content??oi("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return oi("foreignObject",{x:i+l-c/2,y:a+s-d/2,width:c,height:d,style:{overflow:"visible",pointerEvents:"auto"},children:oi("div",{...n(e,t),style:{width:c,height:d,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+r)}case"text":{const t=p(e,r,o);if(!t)return null;const{x:n,y:i}=t,a=n+(e.dx||0),l=i+(e.dy||0),s=e.color||"var(--semiotic-text, #333)",c=oi("text",{x:a,y:l,fill:s,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?No.cloneElement(c,{key:"ann-text-"+r}):ii("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[oi("line",{x1:n,y1:i,x2:a,y2:l,stroke:s,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),No.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+r)}case"category-highlight":{const t=e.category;if(null==t)return null;const n=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,a=o.scales?.x,l=o.scales?.y,s=n(i)?i:n(a)?a:n(l)?l:null;if(!s)return null;const c=s(t+"");if(null==c)return null;const d=s.bandwidth(),u=e.color||"var(--semiotic-primary, #4589ff)",h=e.opacity??.15,f=e.label;return ii("g",(o.projection?"vertical"===o.projection:s===a)?{children:[oi("rect",{x:c,y:0,width:d,height:o.height||0,fill:u,fillOpacity:h}),f&&oi(ri,{x:c+d/2,y:16,textAnchor:"middle",fill:u,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[oi("rect",{x:0,y:c,width:o.width||0,height:d,fill:u,fillOpacity:h}),f&&oi(ri,{x:12,y:c+d/2,dominantBaseline:"middle",fill:u,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+r)}default:return null}var i,a,l}}function ci(e,t,n){return kr(e,t,n)}function di(e,t){const n=t&&"object"==typeof t&&!Array.isArray(t)?t:void 0;return 0===e.length?e=>n&&Ar(n,e)||"#4e79a7":t=>{if(n){const e=Ar(n,t);if(e)return e}let r=0;for(let e=0;t.length>e;e++)r=31*r+t.charCodeAt(e)|0;return e[Math.abs(r)%e.length]??"#4e79a7"}}export{R as filterSparseArray,L as parseDateLikeString,O as coerceDateLikeValue,I as coerceTemporalStringRows,xr as DEFAULT_COLORS,vr as DEFAULT_COLOR,kr as resolveCategoricalPalette,wr as STREAMING_PALETTE,$r as DEPTH_PALETTE_COLORS,Sr as getColor,Ar as resolveExplicitColor,Wr as createColorScale,jr as getSize,Xt as computeEasing,Jt as computeRawProgress,Kt as lerp,Qt as now,q as useSceneRevisionDiagnostics,_ as runSceneBuild,Y as SceneRevisionDiagnosticsObserver,je as resolveCurveFactory,Ce as resolveCanvasFill,Re as coerceCanvasFill,Ne as buildLinearFillGradient,Le as buildColorStopGradient,Hr as DEFAULT_LEGEND_ROW_HEIGHT,Gr as resolveLegendMetrics,qr as layoutVerticalLegendGroups,io as composeLegendConfigs,ao as isLegendConfig,lo as isGradientLegendConfig,wo as renderLegendFromConfig,Bo as SemioticAnnotation,So as ANNOTATION_DISCLOSURE_REVEAL_CSS,Ro as applyAnnotationEmphasis,ri as AnnotationLabel,li as renderAnnotationPass,si as createDefaultAnnotationRules,Gn as unlockCrosshair,Zn as useCrosshairPosition,V as TITLE_BASELINE,U as hasTextTitle,X as reserveTitleMargin,Q as hasAnyCornerRadius,ee as clampCornerRadii,De as networkSceneNodeToSVG,Pe as networkSceneEdgeToSVG,Te as networkLabelToSVG,Ge as geoSceneNodeToSVG,me as ordinalSceneNodeToSVG,Ve as xySceneNodeToSVG,Ue as isServerEnvironment,tt as useHydration,it as useWasHydratingFromSSR,ft as useDataSummary,st as AriaLiveTooltip,pt as computeCanvasAriaLabel,gt as computeNetworkAriaLabel,Nt as AccessibleDataTable,Lt as NetworkAccessibleDataTable,Ot as ScreenReaderSummary,It as SkipToTableLink,Dt as FocusRing,Bt as FlippingTooltip,rn as useFrame,sn as useFrameCanvasHost,cn as CanvasFrameBackground,dn as prepareCanvas,un as getDevicePixelRatio,hn as observationInputType,fn as isInteractiveKeyboardTarget,yn as emitHoverObservations,mn as emitClickObservations,ci as resolveCustomLayoutPalette,di as buildResolveColor,xn as ChartError,Mn as SafeRender,Wn as renderEmptyState,jn as renderLoadingState,Cn as warnMissingField,Nr as useCategoryColors,Kn as useBrushSelection,er as normalizeLinkedBrush,tr as wrapStyleWithSelection,rr as resolveMobileInteraction,ir as isChartMode,ar as resolveChartMode,fo as useThemeCategorical,yo as resolveDefaultFill,mo as useColorScale,po as useChartSelection,go as getCrosshairProps,bo as useChartLegendAndMargin,xo as useLegendInteraction,vo as useChartMode};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{StreamXYFrame_default as e}from"./chunk-chunk-B3DRZPBK.module.min.js";import{buildCustomBehaviorProps as t}from"./chunk-chunk-F7WFPD4O.module.min.js";import{normalizeLinkedBrush as n,useBrushSelection as i,useChartLegendAndMargin as s,useChartMode as o,useChartSelection as r}from"./chunk-chunk-BFHUYEOS.module.min.js";import{renderEmptyState as a,renderLoadingState as l}from"./chunk-chunk-ACLDBMRH.module.min.js";var c=class e{constructor(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}push(e){if(!Number.isFinite(e))return;this._count+=1;const t=e-this._mean;this._mean+=t/this._count,this._m2+=t*(e-this._mean),this._min>e&&(this._min=e),e>this._max&&(this._max=e)}merge(e){if(0===e._count)return;if(0===this._count)return this._count=e._count,this._mean=e._mean,this._m2=e._m2,this._min=e._min,void(this._max=e._max);const t=this._count+e._count,n=e._mean-this._mean;this._mean+=n*e._count/t,this._m2+=e._m2+n*n*this._count*e._count/t,this._count=t,this._min>e._min&&(this._min=e._min),e._max>this._max&&(this._max=e._max)}clear(){this._count=0,this._mean=0,this._m2=0,this._min=1/0,this._max=-1/0}clone(){const t=new e;return t._count=this._count,t._mean=this._mean,t._m2=this._m2,t._min=this._min,t._max=this._max,t}get count(){return this._count}get mean(){return 0===this._count?0:this._mean}get sum(){return 0===this._count?0:this._mean*this._count}get variance(){return 2>this._count?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return 2>this._count?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},u=class{constructor(e){this.windows=new Map,this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;const t=e.hop??e.size;this.hop=t>0&&e.size>=t?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0}push(e,t){Number.isFinite(e)&&Number.isFinite(t)&&(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t):this.pushFixed(e,t),this.prune())}pushFixed(e,t){if("tumbling"===this.type||this.hop>=this.size)return void this.bump(Math.floor(e/this.size)*this.size,t);const n=this.hop,i=Math.floor(e/n);for(let s=Math.floor((e-this.size)/n)+1;i>=s;s++)this.bump(s*n,t)}bump(e,t){let n=this.windows.get(e);n||(n=new c,this.windows.set(e,n)),n.push(t)}pushSession(e,t){const n=this.gap,i=new c;i.push(t);let s=e,o=e;const r=[],a={start:s,end:o,stats:i};for(const t of this.sessions)e-n>t.end||t.start>e+n?r.push(t):(a.stats.merge(t.stats),s>t.start&&(s=t.start),t.end>o&&(o=t.end));a.start=s,a.end=o,r.push(a),r.sort((e,t)=>e.start-t.start),this.sessions=r}prune(){if(this.retain===1/0)return;if("session"===this.type)return void(this.sessions.length>this.retain&&(this.sessions=this.sessions.slice(this.sessions.length-this.retain)));if(this.retain>=this.windows.size)return;const e=[...this.windows.keys()].sort((e,t)=>e-t),t=e.length-this.retain;for(let n=0;t>n;n++)this.windows.delete(e[n])}emit(){return"session"===this.type?this.emitSessions():this.emitFixed()}emitFixed(){const e=[];for(const[t,n]of this.windows){const i=t+this.size;e.push(this.row(t,i,n,i>this.latest))}return e.sort((e,t)=>e.start-t.start),e}emitSessions(){return this.sessions.map(e=>this.row(e.start,e.end,e.stats,this.gap>this.latest-e.end))}row(e,t,n,i){return{start:e,end:t,count:n.count,mean:n.mean,sum:n.sum,min:n.min,max:n.max,stddev:n.stddev,partial:i}}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.sessions=[],this.latest=-1/0}};function m(e,t){switch(t){case"sum":return e.sum;case"min":return e.min;case"max":return e.max;case"count":return e.count;default:return e.mean}}function h(e,t,n,i=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];const s=m(e,n),o=e.stddev*i;return[s-o,s+o]}var d={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},p=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g;function g(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;const t=e.trim();if(""===t)return null;p.lastIndex=0;let n,i=0,s=0;for(;null!==(n=p.exec(t));){const e=parseFloat(n[1]),t=d[n[2]];if(null==t||!Number.isFinite(e))return null;i+=e*t,s+=n[0].length}return s!==t.length?null:i>0?i:null}var v=class{constructor(e){this.held=[],this._watermark=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){const t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};const n=[];return this._watermark!==-1/0&&this._watermark-this.lateness>t?(this._lateCount+=1,n.push(e),"drop"===this.latePolicy?{released:[],late:n}:{released:[e],late:n}):(t>this._watermark&&(this._watermark=t),this.held.push(e),{released:this.drain(),late:n})}drain(){const e=this._watermark-this.lateness;if(0===this.held.length)return[];const t=[],n=[];for(const i of this.held)this.getTime(i)>e?n.push(i):t.push(i);return this.held=n,t.sort((e,t)=>this.getTime(e)-this.getTime(t)),t}flush(){const e=this.held;return this.held=[],e.sort((e,t)=>this.getTime(e)-this.getTime(t)),e}clear(){this.held=[],this._watermark=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}};import{useRef as f,useImperativeHandle as w,forwardRef as y,useCallback as b,useState as x,useEffect as A}from"react";import{jsx as _,jsxs as k}from"react/jsx-runtime";var H={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, #f3f4f6)",padding:"6px 10px",borderRadius:"var(--semiotic-tooltip-radius, 4px)",fontSize:"var(--semiotic-tooltip-font-size, 12px)",fontFamily:"var(--semiotic-tick-font-family, var(--semiotic-font-family, sans-serif))",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.25))",lineHeight:1.4,pointerEvents:"none",whiteSpace:"nowrap"},S={opacity:.7,marginRight:4};function z(e,t,n){if(null!=e)return"function"==typeof t?t(e):e["string"==typeof t?t:n]}function I(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function C(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:i="x",yLabel:s="y"}=e;return e=>{const o=e?.data??null,r=z(o,t,"time"),a=z(o,n,"value");return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[k("span",{style:S,children:[i,":"]}),I(r)]}),k("div",{children:[k("span",{style:S,children:[s,":"]}),I(a)]})]})}}function T(e,t){return null!=e?e:Math.max(t?.length??0,200)}var R="time",P="value",F="__aggLower",M="__aggUpper",N="__aggPartial",D="count",B="__aggStart",E="__aggEnd";function O(e,t){const n=t.stat??"mean",i=t.band??"none",s=t.sigma??1;return e.emit().map(e=>{const t={[R]:(e.start+e.end)/2,[P]:m(e,n),[D]:e.count,[N]:e.partial,[B]:e.start,[E]:e.end},o=h(e,i,n,s);return o&&(t[F]=o[0],t[M]=o[1]),t})}import{jsx as j}from"react/jsx-runtime";function L(e,t,n){const i="function"==typeof t?t(e):e[t??n];if(null==i)return null;if(i instanceof Date)return i.getTime();const s=Number(i);return Number.isFinite(s)?s:null}var W=y(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:m,className:h,arrowOfTime:d="right",windowMode:p="sliding",windowSize:y,data:_,timeAccessor:k,valueAccessor:H,timeExtent:S,valueExtent:z,extentPadding:I,stroke:N="#007bff",strokeWidth:D=2,strokeDasharray:B,opacity:E,background:W,tooltipContent:V,tooltip:$,onHover:Y,annotations:q,autoPlaceAnnotations:U,svgAnnotationRules:X,tickFormatTime:K,tickFormatValue:Z,decay:G,pulse:J,staleness:Q,transition:ee,linkedHover:te,selection:ne,onObservation:ie,chartId:se,loading:oe,loadingContent:re,emptyContent:ae,emphasis:le,legendPosition:ce,aggregate:ue,eventTime:me}=n,he=s.showAxes,de=s.enableHover,pe=m??s.marginDefaults,ge=c??[s.width,s.height],ve=V??$??C({timeAccessor:k,valueAccessor:H}),fe=f(null),{customHoverBehavior:we}=r({selection:ne,linkedHover:te,unwrapData:!0,onObservation:ie,chartType:"RealtimeLineChart",chartId:se}),ye=b(e=>{Y&&Y(e),we(e)},[Y,we]),be=null!=ue,[xe,Ae]=x([]),_e=f(null),ke=f(ue);ke.current=ue;const He=f(be);He.current=be;const Se=f(xe);Se.current=xe;const ze=f({timeAccessor:k,valueAccessor:H});ze.current={timeAccessor:k,valueAccessor:H},A(()=>{if(!be)return void(_e.current=null);const e=ke.current,t=function(e){const t=e.window??"tumbling",n=g("session"===t?e.gap??e.size:e.size);if(null==n)return null;const i=null!=e.hop?g(e.hop):void 0,s=null!=e.gap?g(e.gap):void 0;return new u({window:t,size:n,hop:i??void 0,gap:s??void 0,retain:e.retain})}(e);if(_e.current=t,t&&_){const{timeAccessor:e,valueAccessor:n}=ze.current;for(const i of _){const s=L(i,e,"time"),o=L(i,n,"value");null!=s&&null!=o&&t.push(s,o)}}Ae(t?O(t,e):[])},[be?[ue.window??"tumbling",ue.size,ue.hop??"",ue.gap??"",ue.retain??""].join("|"):"",be,_]),A(()=>{be&&_e.current&&Ae(O(_e.current,ke.current))},[ue?.stat,ue?.band,ue?.sigma]);const Ie=b(e=>{const t=_e.current,n=ke.current;if(!t||!n)return;const{timeAccessor:i,valueAccessor:s}=ze.current;for(const n of e){const e=L(n,i,"time"),o=L(n,s,"value");null!=e&&null!=o&&t.push(e,o)}Ae(O(t,n))},[]),Ce=null!=me,Te=f(null),Re=f(me);Re.current=me;const Pe=f(Ce);Pe.current=Ce;const Fe=f(ie);Fe.current=ie;const Me=f(se);Me.current=se,A(()=>{Te.current=Ce?function(e){const t=g(e.lateness);return null==t?null:new v({lateness:t,getTime:e=>L(e,ze.current.timeAccessor,"time")??NaN,latePolicy:e.latePolicy??"drop"})}(Re.current):null},[Ce?`${me.lateness}|${me.latePolicy??"drop"}`:"",Ce]);const Ne=b(e=>{0!==e.length&&(He.current?Ie(e):fe.current?.pushMany(e))},[Ie]),De=b(e=>{const t=Te.current;if(!Pe.current||!t)return void Ne(e);const n=[];for(const i of e){const e=t.push(i);if(e.released.length&&n.push(...e.released),e.late.length){const n=Fe.current;if(n){const{timeAccessor:i}=ze.current,s=Re.current?.latePolicy??"drop";for(const o of e.late)n({type:"late-data",datum:o,eventTime:L(o,i,"time")??NaN,watermark:t.watermark,policy:s,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:Me.current})}}}Ne(n)},[Ne]);w(i,()=>({push:e=>De([e]),pushMany:e=>De(e),remove:e=>He.current?[]:fe.current?.remove(e)??[],update:(e,t)=>He.current?[]:fe.current?.update(e,t)??[],clear:()=>{Te.current?.clear(),He.current?(_e.current?.clear(),Ae([])):fe.current?.clear()},getData:()=>He.current?Se.current:fe.current?.getData()??[],getScales:()=>fe.current?.getScales()??null}),[De]);const Be=l(oe,ge[0],ge[1],re),Ee=Be?null:a(be?void 0:_,ge[0],ge[1],ae),Oe={stroke:N,strokeWidth:D,strokeDasharray:B};null!=E&&(Oe.opacity=E);const je=T(y,_),Le=be?xe:_,We=be?R:k,Ve=be?P:H,$e=be&&ue&&"none"!==(ue.band??"none")?{y0Accessor:F,y1Accessor:M,perSeries:!1}:void 0;return Be||Ee||j(e,{ref:fe,chartType:"line",runtimeMode:"streaming",size:ge,margin:pe,className:le?`${h||""} semiotic-emphasis-${le}`.trim():h,arrowOfTime:d,windowMode:be?"growing":p,windowSize:be?Math.max(1,ue?.retain??Math.max(xe.length,600)):je,data:Le,timeAccessor:We,valueAccessor:Ve,xExtent:S,yExtent:z,extentPadding:I,band:$e,lineStyle:Oe,showAxes:he,background:W,hoverAnnotation:de,tooltipContent:ve,...t({linkedHover:te,selection:ne,onObservation:ie,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:ye}),annotations:q,autoPlaceAnnotations:U,svgAnnotationRules:X,tickFormatTime:K,tickFormatValue:Z,decay:G,pulse:J,staleness:Q,transition:ee,pointIdAccessor:n.pointIdAccessor,legendPosition:ce})});W.displayName="RealtimeLineChart";import{useRef as V,useImperativeHandle as $,forwardRef as Y,useCallback as q,useMemo as U}from"react";function X(e,t,n){const i="function"==typeof t?t(e):e[t??n];if(null==i)return null;if(i instanceof Date)return i.getTime();if("string"==typeof i&&""===i.trim())return null;const s=Number(i);return Number.isFinite(s)?s:null}import{jsx as K}from"react/jsx-runtime";var Z=Y(function(c,u){const m=o(c.mode,{width:c.size?.[0]??c.width,height:c.size?.[1]??c.height,showAxes:c.showAxes,showLegend:c.showLegend,enableHover:null!=c.enableHover?!!c.enableHover:void 0,linkedHover:c.linkedHover,mobileInteraction:c.mobileInteraction,mobileSemantics:c.mobileSemantics,responsiveRules:c.responsiveRules}),{binSize:h,size:d,margin:p,className:g,arrowOfTime:v="right",windowMode:f="sliding",windowSize:w,data:y,timeAccessor:b,valueAccessor:x,direction:A="up",timeExtent:C,valueExtent:R,extentPadding:P,categoryAccessor:F,colors:M,fill:N,stroke:D,strokeWidth:B,opacity:E,gap:O,background:j,tooltipContent:L,tooltip:W,onHover:Y,annotations:Z,autoPlaceAnnotations:G,svgAnnotationRules:J,tickFormatTime:Q,tickFormatValue:ee,linkedHover:te,selection:ne,decay:ie,pulse:se,staleness:oe,transition:re,onObservation:ae,chartId:le,loading:ce,loadingContent:ue,emptyContent:me,emphasis:he,legendPosition:de,legend:pe,brush:ge,onBrush:ve,linkedBrush:fe}=c,we=m.showAxes,ye=m.enableHover,be=d??[m.width,m.height],xe=U(()=>M?e=>M[e]??N??"#999":void 0,[M,N]),{legend:Ae,margin:_e,legendPosition:ke}=s({data:y??[],colorBy:F,colorScale:xe,showLegend:m.showLegend,legendPosition:de,userMargin:p,defaults:m.marginDefaults,additionalLegend:pe}),He=L??W??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const i=e?.data??null;if(null==i?.binStart||null==i?.binEnd){const e=z(i,t,"time"),s=z(i,n,"value");return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"x:"}),I(e)]}),k("div",{children:[_("span",{style:S,children:"y:"}),I(s)]})]})}return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"range:"}),I(i.binStart),"–",I(i.binEnd)]}),null!=i.total&&k("div",{children:[_("span",{style:S,children:"count:"}),I(i.total)]}),null!=i.category&&k("div",{children:[_("span",{style:S,children:"category:"}),I(i.category)]})]})}}({timeAccessor:b,valueAccessor:x}),Se=V(null),{customHoverBehavior:ze}=r({selection:ne,linkedHover:te,unwrapData:!0,onObservation:ae,chartType:"RealtimeHistogram",chartId:le}),Ie=q(e=>{Y&&Y(e),ze(e)},[Y,ze]),Ce=!0===ge?{dimension:"x",snap:"bin"}:"x"===ge?{dimension:"x"}:"object"==typeof ge?ge:void 0,Te=n(fe),Re="string"==typeof b?b:"time",Pe=i({name:Te?.name||"__unused_hist_brush__",xField:Te?.xField||Re,...Te?.yField?{yField:Te.yField}:{}}),Fe=V(Pe.brushInteraction);Fe.current=Pe.brushInteraction;const Me=q(e=>{if(ve&&ve(e),ae&&ae(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:le}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:le}),Te){const t=Fe.current;t.end(e?"xBrush"===t.brush?e.x:"yBrush"===t.brush?e.y:[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:null)}},[ve,ae,le,Te]);$(u,()=>({push:e=>Se.current?.push(e),pushMany:e=>Se.current?.pushMany(e),remove:e=>Se.current?.remove(e)??[],update:(e,t)=>Se.current?.update(e,t)??[],clear:()=>Se.current?.clear(),getData:()=>Se.current?.getData()??[],getScales:()=>Se.current?.getScales()??null}),[]);const Ne=l(ce,be[0],be[1],ue),De=Ne?null:a(y,be[0],be[1],me),Be={};null!=N&&(Be.fill=N),null!=D&&(Be.stroke=D),null!=B&&(Be.strokeWidth=B),null!=E&&(Be.opacity=E),null!=O&&(Be.gap=O);const Ee=he?`${g||""} semiotic-emphasis-${he}`.trim():g,Oe=T(w,y),je=U(()=>"down"!==A?R:function({data:e,valueAccessor:t,timeAccessor:n,binSize:i,valueExtent:s,extentPadding:o}){if(s)return[s[1],s[0]];if(!e||0===e.length)return;const r=new Map;for(const s of e){const e=X(s,n,"time"),o=X(s,t,"value");if(null==e||null==o)continue;const a=Math.floor(e/i)*i;r.set(a,(r.get(a)??0)+o)}let a=0;for(const e of r.values())a=Math.max(a,e);return[a>0?a+a*(o??.1):1,0]}({data:y,valueAccessor:x,timeAccessor:b,binSize:h,valueExtent:R,extentPadding:P}),[A,y,x,b,h,R,P]);return Ne||De||K(e,{ref:Se,chartType:"bar",runtimeMode:"streaming",size:be,margin:_e,className:Ee,arrowOfTime:v,windowMode:f,windowSize:Oe,data:y,timeAccessor:b,valueAccessor:x,xExtent:C,yExtent:je,extentPadding:P,binSize:h,categoryAccessor:F,barColors:M,barStyle:Be,showAxes:we,background:j,hoverAnnotation:ye,tooltipContent:He,...t({linkedHover:te,selection:ne,onObservation:ae,forceHoverBehavior:!0,mobileInteraction:m.mobileInteraction,customHoverBehavior:Ie}),annotations:Z,autoPlaceAnnotations:G,svgAnnotationRules:J,tickFormatTime:Q,tickFormatValue:ee,decay:ie,pulse:se,staleness:oe,transition:re,pointIdAccessor:c.pointIdAccessor,legend:Ae,legendPosition:ke,brush:Ce||(fe?{dimension:"x"}:void 0),onBrush:Ce||fe?Me:void 0})});function G(e){return K(Z,{...e,windowMode:"growing"})}Z.displayName="RealtimeHistogram",G.displayName="TemporalHistogram";var J=Z;import{useRef as Q,useImperativeHandle as ee,forwardRef as te,useCallback as ne}from"react";import{jsx as ie}from"react/jsx-runtime";var se=te(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,timeExtent:w,valueExtent:y,yScaleType:b,extentPadding:x,categoryAccessor:A,colors:_,radius:k,fill:H,opacity:S,stroke:z,strokeWidth:I,pointStyle:R,background:P,tooltipContent:F,tooltip:M,onHover:N,annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:O,tickFormatValue:j,linkedHover:L,selection:W,onObservation:V,chartId:$,loading:Y,loadingContent:q,emptyContent:U,emphasis:X,legendPosition:K}=n,Z=s.showAxes,G=s.enableHover,J=u??s.marginDefaults,te=c??[s.width,s.height],se=F??M??C({timeAccessor:v,valueAccessor:f}),oe=Q(null),{customHoverBehavior:re}=r({selection:W,linkedHover:L,unwrapData:!0,onObservation:V,chartType:"RealtimeSwarmChart",chartId:$}),ae=ne(e=>{N&&N(e),re(e)},[N,re]);ee(i,()=>({push:e=>oe.current?.push(e),pushMany:e=>oe.current?.pushMany(e),remove:e=>oe.current?.remove(e)??[],update:(e,t)=>oe.current?.update(e,t)??[],clear:()=>oe.current?.clear(),getData:()=>oe.current?.getData()??[],getScales:()=>oe.current?.getScales()??null}),[]);const le=l(Y,te[0],te[1],q),ce=le?null:a(g,te[0],te[1],U),ue={};null!=k&&(ue.radius=k),null!=H&&(ue.fill=H),null!=S&&(ue.opacity=S),null!=z&&(ue.stroke=z),null!=I&&(ue.strokeWidth=I);const me=R,he=X?`${m||""} semiotic-emphasis-${X}`.trim():m,de=T(p,g);return le||ce||ie(e,{ref:oe,chartType:"swarm",runtimeMode:"streaming",size:te,margin:J,className:he,arrowOfTime:h,windowMode:d,windowSize:de,data:g,timeAccessor:v,valueAccessor:f,xExtent:w,yExtent:y,yScaleType:b,extentPadding:x,categoryAccessor:A,barColors:_,swarmStyle:ue,pointStyle:me,showAxes:Z,background:P,hoverAnnotation:G,tooltipContent:se,...t({linkedHover:L,selection:W,onObservation:V,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:ae}),annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:O,tickFormatValue:j,legendPosition:K,pointIdAccessor:n.pointIdAccessor})});se.displayName="RealtimeSwarmChart";import{useRef as oe,useImperativeHandle as re,forwardRef as ae,useCallback as le}from"react";import{jsx as ce}from"react/jsx-runtime";var ue=ae(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,timeExtent:w,valueExtent:y,extentPadding:b,positiveColor:x,negativeColor:A,connectorStroke:C,connectorWidth:R,gap:P,stroke:F,strokeWidth:M,opacity:N,background:D,tooltipContent:B,tooltip:E,onHover:O,annotations:j,autoPlaceAnnotations:L,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,linkedHover:Y,selection:q,onObservation:U,chartId:X,loading:K,loadingContent:Z,emptyContent:G,emphasis:J,legendPosition:Q}=n,ee=s.showAxes,te=s.enableHover,ne=u??s.marginDefaults,ie=c??[s.width,s.height],se=B??E??function(e={}){const{timeAccessor:t,valueAccessor:n}=e;return e=>{const i=e?.data??null,s=z(i,t,"time"),o=i?.delta??z(i,n,"value"),r=i?.cumEnd,a="number"==typeof o?0>o?I(o):"+"+I(o):I(o);return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[_("span",{style:S,children:"x:"}),I(s)]}),k("div",{children:[_("span",{style:S,children:"Δ:"}),a]}),null!=r&&k("div",{children:[_("span",{style:S,children:"total:"}),I(r)]})]})}}({timeAccessor:v,valueAccessor:f}),ae=oe(null),{customHoverBehavior:ue}=r({selection:q,linkedHover:Y,unwrapData:!0,onObservation:U,chartType:"RealtimeWaterfallChart",chartId:X}),me=le(e=>{O&&O(e),ue(e)},[O,ue]);re(i,()=>({push:e=>ae.current?.push(e),pushMany:e=>ae.current?.pushMany(e),remove:e=>ae.current?.remove(e)??[],update:(e,t)=>ae.current?.update(e,t)??[],clear:()=>ae.current?.clear(),getData:()=>ae.current?.getData()??[],getScales:()=>ae.current?.getScales()??null}),[]);const he=l(K,ie[0],ie[1],Z),de=he?null:a(g,ie[0],ie[1],G),pe={};null!=x&&(pe.positiveColor=x),null!=A&&(pe.negativeColor=A),null!=C&&(pe.connectorStroke=C),null!=R&&(pe.connectorWidth=R),null!=P&&(pe.gap=P),null!=F&&(pe.stroke=F),null!=M&&(pe.strokeWidth=M),null!=N&&(pe.opacity=N);const ge=J?`${m||""} semiotic-emphasis-${J}`.trim():m,ve=T(p,g);return he||de||ce(e,{ref:ae,chartType:"waterfall",runtimeMode:"streaming",size:ie,margin:ne,className:ge,arrowOfTime:h,windowMode:d,windowSize:ve,data:g,timeAccessor:v,valueAccessor:f,xExtent:w,yExtent:y,extentPadding:b,waterfallStyle:pe,showAxes:ee,background:D,hoverAnnotation:te,tooltipContent:se,...t({linkedHover:Y,selection:q,onObservation:U,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:me}),annotations:j,autoPlaceAnnotations:L,svgAnnotationRules:W,tickFormatTime:V,tickFormatValue:$,legendPosition:Q,pointIdAccessor:n.pointIdAccessor})});ue.displayName="RealtimeWaterfallChart";import{useRef as me,useImperativeHandle as he,forwardRef as de,useCallback as pe}from"react";import{jsx as ge}from"react/jsx-runtime";var ve=de(function(n,i){const s=o(n.mode,{width:n.size?.[0]??n.width,height:n.size?.[1]??n.height,enableHover:null!=n.enableHover?!!n.enableHover:void 0,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,responsiveRules:n.responsiveRules}),{size:c,margin:u,className:m,arrowOfTime:h="right",windowMode:d="sliding",windowSize:p,data:g,timeAccessor:v,valueAccessor:f,categoryAccessor:w,timeExtent:y,valueExtent:b,extentPadding:x,heatmapXBins:A=20,heatmapYBins:C=20,aggregation:R="count",background:P,tooltipContent:F,tooltip:M,onHover:N,annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:O,tickFormatValue:j,decay:L,pulse:W,staleness:V,linkedHover:$,selection:Y,onObservation:q,chartId:U,loading:X,loadingContent:K,emptyContent:Z,emphasis:G,legendPosition:J}=n,Q=s.showAxes,ee=s.enableHover,te=u??s.marginDefaults,ne=c??[s.width,s.height],ie=F??M??function(e={}){const{timeAccessor:t,valueAccessor:n,xLabel:i="x",yLabel:s="y"}=e;return e=>{const o=e?.data??null,r=o?.xCenter??z(o,t,"time"),a=o?.yCenter??z(o,n,"value"),l=o?.count,c=o?.sum,u=o?.value,m=o?.agg??"count";return k("div",{className:"semiotic-tooltip",style:H,children:[k("div",{children:[k("span",{style:S,children:[i,":"]}),I(r)]}),k("div",{children:[k("span",{style:S,children:[s,":"]}),I(a)]}),null!=l&&k("div",{children:[_("span",{style:S,children:"count:"}),I(l)]}),"sum"===m&&null!=c&&k("div",{children:[_("span",{style:S,children:"sum:"}),I(c)]}),"mean"===m&&null!=u&&k("div",{children:[_("span",{style:S,children:"mean:"}),I(u)]})]})}}({timeAccessor:v,valueAccessor:f}),se=me(null),{customHoverBehavior:oe}=r({selection:Y,linkedHover:$,unwrapData:!0,onObservation:q,chartType:"RealtimeHeatmap",chartId:U}),re=pe(e=>{N&&N(e),oe(e)},[N,oe]);he(i,()=>({push:e=>se.current?.push(e),pushMany:e=>se.current?.pushMany(e),remove:e=>se.current?.remove(e)??[],update:(e,t)=>se.current?.update(e,t)??[],clear:()=>se.current?.clear(),getData:()=>se.current?.getData()??[],getScales:()=>se.current?.getScales()??null}),[]);const ae=l(X,ne[0],ne[1],K),le=ae?null:a(g,ne[0],ne[1],Z),ce=G?`${m||""} semiotic-emphasis-${G}`.trim():m,ue=T(p,g);return ae||le||ge(e,{ref:se,chartType:"heatmap",runtimeMode:"streaming",size:ne,margin:te,className:ce,arrowOfTime:h,windowMode:d,windowSize:ue,data:g,timeAccessor:v,valueAccessor:f,categoryAccessor:w,xExtent:y,yExtent:b,extentPadding:x,heatmapXBins:A,heatmapYBins:C,heatmapAggregation:R,showAxes:Q,background:P,hoverAnnotation:ee,tooltipContent:ie,...t({linkedHover:$,selection:Y,onObservation:q,forceHoverBehavior:!0,mobileInteraction:s.mobileInteraction,customHoverBehavior:re}),annotations:D,autoPlaceAnnotations:B,svgAnnotationRules:E,tickFormatTime:O,tickFormatValue:j,decay:L,pulse:W,staleness:V,legendPosition:J,pointIdAccessor:n.pointIdAccessor})});ve.displayName="RealtimeHeatmap";export{c as RunningStats,u as WindowAccumulator,m as statValue,h as bandBounds,g as parseWindowDuration,v as ReorderBuffer,W as RealtimeLineChart,Z as RealtimeHistogram,G as TemporalHistogram,J as RealtimeTemporalHistogram,se as RealtimeSwarmChart,ue as RealtimeWaterfallChart,ve as RealtimeHeatmap};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t){if(null==t)return()=>{};const n="function"==typeof t?t:n=>n[t];return t=>r(n(t))}function n(n,e){const r=t(n),o=t(e);return(t,n)=>{const e=o(t);return{value:e,x:r(t),y:e,category:n}}}function e(n,e){const r=t(e??"value"),o=null==n?void 0:"function"==typeof n?n:t=>t[n];return t=>{const n=o?o(t):void 0;return{value:r(t),category:null==n?void 0:n+""}}}function r(t){if("number"==typeof t)return Number.isFinite(t)?t:void 0;if("string"==typeof t&&""!==t.trim()){const n=Number(t);return Number.isFinite(n)?n:void 0}}function o(t,n,e){const o=null!=t.axis?e[t.axis]:null!=t.field?n[t.field]:e.value;if(void 0!==t.eq&&o!==t.eq)return!1;if(void 0!==t.ne&&o===t.ne)return!1;if(void 0!==t.in&&!t.in.includes(o))return!1;if(void 0===t.gt&&void 0===t.gte&&void 0===t.lt&&void 0===t.lte&&void 0===t.within&&void 0===t.outside)return!0;const i=r(o);if(void 0===i)return!1;if(void 0!==t.gt&&t.gt>=i)return!1;if(void 0!==t.gte&&t.gte>i)return!1;if(void 0!==t.lt&&i>=t.lt)return!1;if(void 0!==t.lte&&i>t.lte)return!1;if(void 0!==t.within){const[n,e]=t.within;if(n>i||i>e)return!1}if(void 0!==t.outside){const[n,e]=t.outside;if(i>=n&&e>=i)return!1}return!0}function i(t,n,e){const r=t.when;return void 0===r||!0===r||!1!==r&&("function"==typeof r?r(n,e):o(r,n,e))}function u(t,n,e){if(!n||0===n.length)return{};let r={};for(const o of n){if(!i(o,t,e))continue;const n="function"==typeof o.style?o.style(t,e):o.style;n&&(r={...r,...n})}return r}function a(t,n,e,r=t=>t){const o=t??(()=>({}));return n&&0!==n.length?(t,i)=>{const a=r(t),s={...o(t,i)};return Object.assign(s,u(a,n,e(a,i))),s}:o}function s(t,n,e){return t&&0!==t.length?(r,o)=>{const i=u(r,t,n(r,o)),a=e?e(r,o):void 0;return a?{...i,...a}:i}:e}function f(t,n,r,o){if(!t||0===t.length)return o;const i=e(n,r);return(n,e)=>{const r=n&&n.data||n,a=u(r,t,i(r)),s=o?o(n,e):void 0;return s?{...a,...s}:a}}function c(t,e,r,o){return s(t,n(e,r),o)}function l(t,n){const e=t.length,r=n.length,o=Array(r+1);for(let t=0;r>=t;t++)o[t]=t;for(let i=1;e>=i;i++){let e=o[0];o[0]=i;for(let u=1;r>=u;u++){const r=o[u];o[u]=t[i-1]===n[u-1]?e:1+Math.min(e,o[u],o[u-1]),e=r}}return o[r]}function d(t,n,e=3){let r,o=e+1;for(const e of n){const n=l(t.toLowerCase(),e.toLowerCase());o>n&&(o=n,r=e)}return o>e?void 0:r}function y(t){return t.length>3?[t[0],t[Math.floor(t.length/2)],t[t.length-1]]:[...t]}function v(t,n){if(0===n.length)return null;const e=t.toLowerCase();return n.find(t=>t.toLowerCase().includes(e)||e.includes(t.toLowerCase()))||(d(t,n,3)??null)}function h({componentName:t,data:n,accessors:e,requiredProps:r}){if(r)for(const[n,e]of Object.entries(r))if(null==e)return`${t}: ${n} is required. Provide a field name or function.`;if(null==n)return null;if(!Array.isArray(n)&&"object"==typeof n)return t+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(n)||0===n.length)return t+": No data provided. Pass a non-empty array to the data prop.";if(e){const r=y(n).find(t=>t&&"object"==typeof t);if(r){const n=Object.keys(r);for(const[o,i]of Object.entries(e))if(i&&"string"==typeof i&&!(i in r)){const e=v(i,n),r=e?` Try ${o}="${e}".`:"";return`${t}: ${o} "${i}" not found in data. Available fields: ${n.join(", ")}.${r}`}}}return null}function g({componentName:t,data:n,dataLabel:e="data"}){return null==n?`${t}: No ${e} provided. Pass a hierarchical object with children: { name: "root", children: [...] }.`:Array.isArray(n)?`${t}: ${e} should be a single root object, not an array. Expected: { name: "root", children: [...] }. If you have flat data, use LineChart, BarChart, or Scatterplot instead.`:null}function p({componentName:t,nodes:n,edges:e,nodesRequired:r=!1,edgesRequired:o=!0,accessors:i}){if(null==n&&null==e)return null;if(o&&(!e||!Array.isArray(e)||0===e.length))return t+': No edges provided. Pass a non-empty array: edges={[{ source: "A", target: "B", value: 10 }, ...]}.';if(r&&(!n||!Array.isArray(n)||0===n.length))return t+': No nodes provided. Pass a non-empty array: nodes={[{ id: "A" }, { id: "B" }, ...]}.';if(i&&n&&n.length>0){const e=y(n).find(t=>t&&"object"==typeof t);if(e){const n=Object.keys(e);for(const[r,o]of Object.entries(i))if(o&&"string"==typeof o&&!(o in e)){const e=v(o,n),i=e?` Try ${r}="${e}".`:"";return`${t}: ${r} "${o}" not found in node data. Available fields: ${n.join(", ")}.${i}`}}}return null}export{t as makeRuleValueResolver,n as makeXYRuleContext,e as makeNodeRuleContext,o as matchesThreshold,i as ruleMatches,u as resolveStyleRules,a as composeStyleRules,s as makeStyleRuleStyleFn,f as styleRulesToNodeStyle,c as styleRulesToXYStyle,d as closestMatch,h as validateArrayData,g as validateObjectData,p as validateNetworkData};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{validateNetworkData as e,validateObjectData as t}from"./chunk-chunk-JCG72SGW.module.min.js";import{mergeShapeStyle as o,useCustomChartScaffold as n,useFrameImperativeHandle as i,useResolvedSelection as r}from"./chunk-chunk-PLIDPQNG.module.min.js";import{StreamNetworkFrame_default as s,buildRibbonGeometry as a}from"./chunk-chunk-LQBSXO7K.module.min.js";import{buildBaseMetadataProps as l,buildCustomBehaviorProps as c}from"./chunk-chunk-F7WFPD4O.module.min.js";import{mulberry32 as d}from"./chunk-chunk-SIRIJ3DY.module.min.js";import{composeStyleRules as m,makeNodeRuleContext as h}from"./chunk-chunk-EMO5NUGE.module.min.js";import{COLOR_SCHEMES as g,DEFAULT_COLORS as u,DEFAULT_SELECTION_OPACITY as p,DEPTH_PALETTE_COLORS as f,filterSparseArray as b,getColor as y,normalizeTooltip as v,resolveAxisFreeMarginDefaults as k,resolveCategoricalPalette as S,resolveDefaultFill as w,resolveMobileInteraction as C,useChartLegendAndMargin as T,useChartMode as I,useChartSelection as A,useColorScale as M,useLegendInteraction as H,useThemeCategorical as x}from"./chunk-chunk-BFHUYEOS.module.min.js";import{getMin as B}from"./chunk-chunk-JJ2OOIET.module.min.js";import{ChartError as N,SafeRender as O,renderEmptyState as D,renderLoadingState as P}from"./chunk-chunk-ACLDBMRH.module.min.js";import{forwardRef as L,useMemo as E}from"react";import{jsx as W}from"react/jsx-runtime";var R=L(function(e,t){const{nodes:o,edges:i,layout:r,layoutConfig:a,onLayoutError:d,nodeIDAccessor:m="id",sourceAccessor:h="source",targetAccessor:g="target",margin:u,className:p,colorBy:f,colorScheme:y,selection:v,linkedHover:k,onObservation:S,onClick:w,chartId:T,annotations:I,autoPlaceAnnotations:M,frameProps:H={}}=e,{frameRef:x,resolved:B,normalizedMargin:N}=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}),L=E(()=>b(o),[o]),R=E(()=>b(i),[i]),F=E(()=>void 0===o&&void 0===i?void 0:[...L,...R],[i,o,R,L]),z=C(e.mobileInteraction,{mode:e.mode,width:B.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:j,customClickBehavior:$,activeSelectionHook:_}=A({selection:v,linkedHover:k,fallbackFields:"string"==typeof f?[f]:[],onObservation:S,onClick:w,chartType:"NetworkCustomChart",chartId:T,colorByField:"string"==typeof f?f:void 0,mobileInteraction:z}),G=E(()=>_?.isActive?{isActive:!0,predicate:_.predicate}:null,[_?.isActive,_?.predicate]),{width:q,height:X,enableHover:J,title:Y,description:K,summary:Q,accessibleTable:U}=B,Z=P(e.loading,q,X,e.loadingContent),V=Z?null:D(F,q,X,e.emptyContent);if(Z||V)return Z||V;const ee={chartType:"force",...null!=o&&{nodes:L},...null!=i&&{edges:R},customNetworkLayout:r,layoutConfig:a,onLayoutError:d,nodeIDAccessor:m,sourceAccessor:h,targetAccessor:g,colorBy:f,colorScheme:y,size:[q,X],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:N,enableHover:J,...l({title:Y,description:K,summary:Q,accessibleTable:U,className:p,animate:e.animate,autoPlaceAnnotations:M}),...c({linkedHover:k,selection:v,onObservation:S,onClick:w,mobileInteraction:z,customHoverBehavior:j,customClickBehavior:$,linkedHoverInClickPredicate:!1}),layoutSelection:G,...null!=I&&{annotations:I},...H};return W(O,{componentName:"NetworkCustomChart",width:q,height:X,children:W(s,{ref:x,...ee})})});R.displayName="NetworkCustomChart";import{useMemo as F,forwardRef as z,useRef as j}from"react";import{useMemo as $}from"react";function _(e,t){if(!e)return[];const o=[],n=e=>{o.push(e);const i="function"==typeof t?t(e):e[t];i&&Array.isArray(i)&&i.forEach(n)};return n(e),o}function G(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 q(e){return"function"==typeof e?e:t=>t[e]||1}function X({edgeColorBy:e,colorBy:t,colorScale:o,nodeStyleFn:n,edgeOpacity:i,baseStyle:r={}}){return s=>{const a={fillOpacity:i,...r};if("function"==typeof e)a.fill=e(s);else if("source"===e){const e="object"==typeof s.source?s.source:null;t&&e?a.fill=y(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else if("target"===e){const e="object"==typeof s.target?s.target:null;t&&e?a.fill=y(e.data||e,t,o):e&&(a.fill=n(e,e.index).fill)}else"gradient"===e&&(a.fill="#999",a.fillOpacity=.7*i);return a}}function J(e){const{nodes:t,edges:o,inferNodes:n=!0,sourceAccessor:i="source",targetAccessor:r="target",colorBy:s,colorScheme:a,showLegend:l,legendPosition:c,legendInteraction:d,selection:m,linkedHover:h,onObservation:g,onClick:p,mobileInteraction:f,mobileSemantics:y,chartType:v,chartId:k,marginDefaults:w,userMargin:I,width:B,height:N,loading:O,loadingContent:L,emptyContent:E,emptyDataKey:W="edges"}=e,R=$(()=>b(o),[o]),F=$(()=>b(t),[t]),z=P(O,B,N,L),j=z?null:D("nodes"===W?void 0===t?void 0:F:void 0===o?void 0:R,B,N,E),_=$(()=>n?G(F,R,i,r):F,[n,F,R,i,r]),q=M(_,s,a),X=x(),J=$(()=>Array.isArray(a)&&a.length>0?a:[...S(a,X,u)],[a,X]),Y=$(()=>{if(!s)return[];const e=new Set;for(const t of _){const o="function"==typeof s?s(t):t[s];null!=o&&e.add(o+"")}return Array.from(e)},[_,s]),K=H(d,s,Y),{legend:Q,margin:U,legendPosition:Z}=T({data:_,colorBy:s,colorScale:q,showLegend:l,legendPosition:c,userMargin:I,defaults:w,categories:Y}),V=$(()=>C(f,{width:B,mobileSemantics:y}),[f,B,y]),ee=A({selection:m,linkedHover:h,fallbackFields:s?["string"==typeof s?s:""]:[],unwrapData:!0,onObservation:g,onClick:p,mobileInteraction:V,chartType:v,chartId:k}),{customHoverBehavior:te,customClickBehavior:oe,activeSelectionHook:ne,hoverSelectionHook:ie,crosshairSourceId:re}=ee;return{safeNodes:_,safeEdges:R,colorScale:q,effectivePalette:J,themeCategorical:X,allCategories:Y,legendState:K,legend:Q,margin:U,legendPosition:Z,mobileInteraction:V,customHoverBehavior:te,customClickBehavior:oe,activeSelectionHook:ne,hoverSelectionHook:ie,crosshairSourceId:re,loadingEl:z,emptyEl:j}}import{jsx as Y}from"react/jsx-runtime";var K=z(function(t,n){const r=j(null);i(n,{variant:"network",frameRef:r});const a=I(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLegend:t.showLegend,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules},{width:600,height:600}),{nodes:l,edges:d,margin:g,className:u,nodeIdAccessor:p,nodeIDAccessor:f,sourceAccessor:b="source",targetAccessor:k="target",nodeLabel:S,colorBy:C,colorScheme:T,styleRules:A,nodeSize:M=8,nodeSizeRange:H=[5,20],edgeWidth:x=1,edgeColor:B="#999",edgeOpacity:D=.6,iterations:P=300,forceStrength:L=.1,layoutExecution:E="auto",layoutLoadingContent:W,onLayoutStateChange:R,tooltip:z,frameProps:$={},onObservation:_,onClick:G,chartId:q,selection:X,linkedHover:K,loading:Q,loadingContent:U,emptyContent:Z,legendInteraction:V,legendPosition:ee,stroke:te,strokeWidth:oe,opacity:ne}=t,ie=p??f??"id",{width:re,height:se,enableHover:ae,showLegend:le,showLabels:ce=!1,title:de,description:me,summary:he,accessibleTable:ge}=a,ue=J({nodes:l,edges:d,inferNodes:!1,nodeIdAccessor:ie,sourceAccessor:b,targetAccessor:k,colorBy:C,colorScheme:T,showLegend:le,legendPosition:ee,legendInteraction:V,selection:X,linkedHover:K,onObservation:_,onClick:G,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"ForceDirectedGraph",chartId:q,marginDefaults:a.marginDefaults,userMargin:g,width:re,height:se,loading:Q,loadingContent:U,emptyContent:Z,emptyDataKey:"nodes"}),pe=F(()=>new Map,[]),fe=F(()=>e=>{const t={};return t.fill=C?y(e.data||e,C,ue.colorScale):w(void 0,ue.themeCategorical,T,void 0,pe),"number"==typeof M&&(t.r=M),t},[C,ue.colorScale,M,ue.themeCategorical,T,pe]),be=F(()=>h(C,"number"==typeof M?void 0:M),[C,M]),ye=F(()=>o(m(fe,A,be,e=>e.data||e),{stroke:te,strokeWidth:oe,opacity:ne}),[fe,A,be,te,oe,ne]),ve=F(()=>e=>{const t=e.data||e;let o;if("number"==typeof x)o=x;else if("function"==typeof x)o=x(t);else{const e=t[x],n="number"==typeof e?e:Number(e);o=Number.isFinite(n)&&n>0?n:1}return{stroke:B,strokeWidth:o,opacity:D}},[x,B,D]),ke=F(()=>o(ve,{stroke:te,strokeWidth:oe,opacity:ne}),[ve,te,oe,ne]),Se=F(()=>{if(ce&&S)return"function"==typeof S?S:e=>e.data?.[S]??e[S]??e.id},[ce,S]),we=e({componentName:"ForceDirectedGraph",nodes:l,edges:d,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:ie}});return we?Y(N,{componentName:"ForceDirectedGraph",message:we,width:re,height:se}):ue.loadingEl?ue.loadingEl:ue.emptyEl?ue.emptyEl:Y(O,{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:k,iterations:P,forceStrength:L,layoutExecution:E,layoutLoadingContent:W,onLayoutStateChange:R,nodeStyle:ye,edgeStyle:ke,colorBy:C,colorScheme:ue.effectivePalette,nodeSize:M,nodeSizeRange:H,nodeLabel:Se,showLabels:ce,enableHover:ae,tooltipContent:!1===z?()=>null:v(z)||void 0,...c({linkedHover:K,selection:X,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},...$})})});K.displayName="ForceDirectedGraph";import{useMemo as Q,forwardRef as U,useRef as Z}from"react";import{jsx as V}from"react/jsx-runtime";var ee=U(function(t,n){const r=Z(null);i(n,{variant:"network",frameRef:r,overrides:{getData:()=>r.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const a=I(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules},{width:600,height:600}),{nodes:l,edges:d,margin:p,className:f,sourceAccessor:b="source",targetAccessor:k="target",valueAccessor:S="value",nodeIdAccessor:C="id",colorBy:T,colorScheme:A,styleRules:M,edgeColorBy:H="source",padAngle:x=.01,groupWidth:B=20,sortGroups:D,nodeLabel:P,edgeOpacity:L=.5,tooltip:E,frameProps:W={},onObservation:R,onClick:F,chartId:z,selection:j,linkedHover:$,loading:_,loadingContent:G,emptyContent:q,legendInteraction:Y,stroke:K,strokeWidth:U,opacity:ee}=t,{width:te,height:oe,enableHover:ne,showLabels:ie=!0,title:re,description:se,summary:ae,accessibleTable:le}=a,ce=J({nodes:l,edges:d,inferNodes:!0,nodeIdAccessor:C,sourceAccessor:b,targetAccessor:k,colorBy:T,colorScheme:A,showLegend:!1,legendInteraction:Y,selection:j,linkedHover:$,onObservation:R,onClick:F,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"ChordDiagram",chartId:z,marginDefaults:a.marginDefaults,userMargin:p,width:te,height:oe,loading:_,loadingContent:G,emptyContent:q}),de=Q(()=>new Map,[]),me=Q(()=>new Map,[]),he=ce.safeNodes.length>0,ge=Q(()=>{if(he)return(e,t)=>{const o={stroke:"black",strokeWidth:1};if(T)o.fill=y(e.data||e,T,ce.colorScale);else{const n=Array.isArray(A)?A:g[A]||u,i=Array.isArray(n)?n:u,r=(e.id??e.data?.[C]??"")+"";me.has(r)||me.set(r,me.size);const s=e.index??t??me.get(r);o.fill=i[s%i.length]}return o}},[he,T,ce.colorScale,A,C,me]),ue=Q(()=>h(T),[T]),pe=Q(()=>{if(ge||M&&M.length>0)return o(m(ge,M,ue,e=>e.data||e),{stroke:K,strokeWidth:U,opacity:ee})},[ge,M,ue,K,U,ee]),fe=Q(()=>{if(he)return X({edgeColorBy:H,colorBy:T,colorScale:ce.colorScale,nodeStyleFn:pe||(e=>({fill:w(void 0,ce.themeCategorical,A,void 0,de)})),edgeOpacity:L,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:L}})},[he,H,T,ce.colorScale,pe,L,ce.themeCategorical,A,de]),be=Q(()=>fe?o(fe,{stroke:K,strokeWidth:U,opacity:ee}):void 0,[fe,K,U,ee]),ye=Q(()=>{if(!ie)return;const e=P||C;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[ie,P,C]),ve=e({componentName:"ChordDiagram",edges:d,edgesRequired:!0});return ve?V(N,{componentName:"ChordDiagram",message:ve,width:te,height:oe}):ce.loadingEl?ce.loadingEl:ce.emptyEl?ce.emptyEl:V(O,{componentName:"ChordDiagram",width:te,height:oe,children:V(s,{ref:r,chartType:"chord",...ce.safeNodes.length>0&&{nodes:ce.safeNodes},...null!=d&&{edges:ce.safeEdges},size:[te,oe],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:ce.margin,nodeIDAccessor:C,sourceAccessor:b,targetAccessor:k,valueAccessor:S,padAngle:x,groupWidth:B,sortGroups:D,nodeStyle:pe,edgeStyle:be,colorBy:T,colorScheme:ce.effectivePalette,edgeColorBy:H,edgeOpacity:L,nodeLabel:ye,showLabels:ie,enableHover:ne,tooltipContent:!1===E?()=>null:v(E)||void 0,...c({linkedHover:$,selection:j,onObservation:R,onClick:F,mobileInteraction:ce.mobileInteraction,customHoverBehavior:ce.customHoverBehavior,customClickBehavior:ce.customClickBehavior,linkedHoverInClickPredicate:!1}),...Y&&"none"!==Y&&{legendHoverBehavior:ce.legendState.onLegendHover,legendClickBehavior:ce.legendState.onLegendClick,legendHighlightedCategory:ce.legendState.highlightedCategory,legendIsolatedCategories:ce.legendState.isolatedCategories},className:f,title:re,description:se,summary:ae,accessibleTable:le,...null!=t.animate&&{animate:t.animate},...W})})});ee.displayName="ChordDiagram";import{useMemo as te,forwardRef as oe,useRef as ne}from"react";import{jsx as ie}from"react/jsx-runtime";var re=oe(function(t,n){const r=ne(null);i(n,{variant:"network",frameRef:r,overrides:{getData:()=>r.current?.getTopology()?.edges?.map(e=>e.data)??[]}});const a=I(t.mode,{width:t.width,height:t.height,enableHover:t.enableHover,showLabels:t.showLabels,title:t.title,description:t.description,accessibleTable:t.accessibleTable,summary:t.summary,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules},{width:800,height:600}),{nodes:l,edges:d,margin:g,className:u,sourceAccessor:p="source",targetAccessor:f="target",valueAccessor:b="value",nodeIdAccessor:k="id",colorBy:S,colorScheme:C,styleRules:T,edgeColorBy:A="source",orientation:M="horizontal",nodeAlign:H="justify",nodePaddingRatio:x=.05,nodeWidth:B=15,nodeLabel:D,edgeOpacity:P=.5,edgeSort:L,tooltip:E,frameProps:W={},onObservation:R,onClick:F,chartId:z,selection:j,linkedHover:$,loading:_,loadingContent:G,emptyContent:q,showLegend:Y,legendPosition:K,legendInteraction:Q,stroke:U,strokeWidth:Z,opacity:V}=t,{width:ee,height:oe,enableHover:re,showLabels:se=!0,title:ae,description:le,summary:ce,accessibleTable:de}=a,me=J({nodes:l,edges:d,inferNodes:!0,nodeIdAccessor:k,sourceAccessor:p,targetAccessor:f,colorBy:S,colorScheme:C,showLegend:Y,legendPosition:K,legendInteraction:Q,selection:j,linkedHover:$,onObservation:R,onClick:F,mobileInteraction:a.mobileInteraction,mobileSemantics:a.mobileSemantics,chartType:"SankeyDiagram",chartId:z,marginDefaults:a.marginDefaults,userMargin:g,width:ee,height:oe,loading:_,loadingContent:G,emptyContent:q}),he=te(()=>new Map,[]),ge=te(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=S?y(e.data||e,S,me.colorScale):w(void 0,me.themeCategorical,C,void 0,he),t},[S,me.colorScale,me.themeCategorical,C,he]),ue=te(()=>h(S,b),[S,b]),pe=te(()=>o(m(ge,T,ue,e=>e.data||e),{stroke:U,strokeWidth:Z,opacity:V}),[ge,T,ue,U,Z,V]),fe=te(()=>X({edgeColorBy:A,colorBy:S,colorScale:me.colorScale,nodeStyleFn:pe,edgeOpacity:P,baseStyle:{stroke:"none",strokeWidth:0}}),[A,S,me.colorScale,pe,P]),be=te(()=>o(fe,{stroke:U,strokeWidth:Z,opacity:V}),[fe,U,Z,V]),ye=te(()=>{if(!se)return;const e=D||k;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[se,D,k]),ve=e({componentName:"SankeyDiagram",edges:d,edgesRequired:!0});return ve?ie(N,{componentName:"SankeyDiagram",message:ve,width:ee,height:oe}):me.loadingEl?me.loadingEl:me.emptyEl?me.emptyEl:ie(O,{componentName:"SankeyDiagram",width:ee,height:oe,children:ie(s,{ref:r,chartType:"sankey",...me.safeNodes.length>0&&{nodes:me.safeNodes},...null!=d&&{edges:me.safeEdges},size:[ee,oe],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,margin:me.margin,nodeIDAccessor:k,sourceAccessor:p,targetAccessor:f,valueAccessor:b,orientation:M,nodeAlign:H,nodePaddingRatio:x,nodeWidth:B,nodeStyle:pe,edgeStyle:be,colorBy:S,colorScheme:me.effectivePalette,edgeColorBy:A,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:F,mobileInteraction:me.mobileInteraction,customHoverBehavior:me.customHoverBehavior,customClickBehavior:me.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:me.legend,legendPosition:me.legendPosition,...Q&&"none"!==Q&&{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 se(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 ae(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 le(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?B(r.map(e=>e.time)):null,c=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,d=null!=c?c-1:null!=l&&Number.isFinite(l)?l-1:null,m=[...new Set(r.map(e=>e.time))].sort((e,t)=>e-t),h=new Map;for(let e=1;m.length>e;e++)h.set(m[e],m[e-1]);const g=e=>{const t=h.get(e);return null!=t?(t+e)/2:null!=d?d:e};a();const u=[];let p=0,f=0;for(const e of r)if("out"===e.kind){const t=Math.abs(e.delta);let o=t-("top"===e.side?p:f);if(o>0){const t="top"===e.side?"bot":"top",n=Math.min(o,"top"===t?p:f);if(n>0){const i=g(e.time);u.push({time:i,delta:-n,kind:"transfer-out",side:t}),u.push({time:i,delta:+n,kind:"transfer-in",side:e.side}),"top"===t?p-=n:f-=n,"top"===e.side?p+=n:f+=n,o-=n}o>0&&null!==d&&(u.push({time:d,delta:+o,kind:"create",side:e.side}),"top"===e.side?p+=o:f+=o)}"top"===e.side?p-=t:f-=t}else if("in"===e.kind){const t=Math.abs(e.delta);"top"===e.side?p+=t:f+=t}r.push(...u),a();let b=0,y=0,v=0,k=0,S=0;const w=[],C=new Map;for(const e of r){if(w.push({t:e.time,topMass:b,botMass:y}),("in"===e.kind||"out"===e.kind)&&e.edge){const t="top"===e.side?b:y;C.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:t+e.delta,kind:e.kind,value:Math.abs(e.delta)})}"top"===e.side?b+=e.delta:y+=e.delta,b+y>v&&(v=b+y),b>k&&(k=b),y>S&&(S=y),w.push({t:e.time,topMass:b,botMass:y})}const T=[];let I=0;for(;w.length>I;){let e=I;for(;w.length>e+1&&w[e+1].t===w[I].t;)e++;T.push(w[I]);for(let t=I+1;e>=t;t++){const e=T[T.length-1];w[t].topMass===e.topMass&&w[t].botMass===e.botMass||T.push(w[t])}I=e+1}const A=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null;let M=null;for(const e of i)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.startTime>e.systemInTime&&(null===M||M>e.systemInTime)&&(M=e.systemInTime);let H=null;for(const e of n)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===H||e.systemOutTime>H)&&(H=e.systemOutTime);if(T.length>0){const e=T[T.length-1],t=Math.max(null!=A?A:-1/0,null!=H?H:-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&T.push({t:t,topMass:e.topMass,botMass:e.botMass});const o=T[0],n=Math.min(null!=c?c:1/0,null!=M?M:1/0);Number.isFinite(n)&&o.t>n&&o.topMass+o.botMass>0&&T.unshift({t:n,topMass:o.topMass,botMass:o.botMass})}return{samples:T,peak:v,topPeak:k,botPeak:S,localAttachments:C}}function ce(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function de(e,t){return e.map(e=>({t:ce(e.t,t),topMass:e.topMass,botMass:e.botMass}))}function me(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 he(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 ge(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 ue(e,t){return 1e3*he(e,t)+ge(e,t)}function pe(e,t){return{slots:e.map(e=>({peak:{...e.peak},occupants:e.occupants.slice()})),map:{...t}}}function fe(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=pe(e,t),s=ue(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=ue(t,o);if(s>m)s=m,r=pe(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=ue(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=ue(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=ue(l,o);d>e&&(d=e,c=s.slice())},h=(e,t)=>{const o=s[e],n=s[t];s[e]=n,s[t]=o,a[o]=t,a[n]=e};m();const g=Array(n).fill(0);let u=0;for(;n>u;)u>g[u]?(h(u%2==0?0:g[u],u),m(),g[u]++,u=0):(g[u]=0,u++);const p=c.map(t=>e[t]),f=new Map;c.forEach((e,t)=>f.set(e,t));for(const e of Object.keys(t))t[e]=f.get(t[e]);e.length=0;for(const t of p)e.push(t)}(e,t,o)}function be(e,t,o,n,i){const{plotH:r,padding:s,valueScale:a,packing:l,laneOrder:c,lifetimeMode:d="full"}=i,m={},h={};for(const t of e)m[t.id]=o[t.id].topPeak||0,h[t.id]=o[t.id].botPeak||0;const g="half"===d,u={};for(const t of e){const e=Array.isArray(t.xExtent)?t.xExtent[0]:null,o=Array.isArray(t.xExtent)?t.xExtent[1]:null;let i=null!=e&&Number.isFinite(e)?e:1/0,r=null!=o&&Number.isFinite(o)?o:-1/0;for(const e of n.outgoing[t.id]){i>e.startTime&&(i=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&i>e.systemInTime&&(i=e.systemInTime);const t=g?(e.startTime+e.endTime)/2:e.endTime;t>r&&(r=t)}for(const e of n.incoming[t.id]){const t=g?(e.startTime+e.endTime)/2:e.startTime;i>t&&(i=t),e.endTime>r&&(r=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>r&&(r=e.systemOutTime)}u[t.id]={start:Number.isFinite(i)?i:null,end:Number.isFinite(r)?r:null}}const p={},f=[];if("reuse"===l){const o=new Map;for(const t of e)o.set(t.id,0);const i=new Map;for(const t of e)i.set(t.id,0);for(const e of t)i.set(e.target,(i.get(e.target)??0)+1);const r=[];for(const t of e)0===(i.get(t.id)??0)&&r.push(t.id);for(;r.length;){const e=r.shift();for(const t of n.outgoing[e]??[]){const n=(o.get(e)??0)+1;n>(o.get(t.target)??0)&&o.set(t.target,n),i.set(t.target,i.get(t.target)-1),0===i.get(t.target)&&r.push(t.target)}}const s=[...e].filter(e=>null!==u[e.id].start).sort((e,t)=>{const n=o.get(e.id)??0,i=o.get(t.id)??0;return n!==i?n-i:u[e.id].start-u[t.id].start}),a=e.filter(e=>null===u[e.id].start);for(const e of[...s,...a]){const t=u[e.id];let o=-1;for(let e=0;f.length>e;e++){const n=f[e].occupants[f[e].occupants.length-1];if(null===t.start||void 0===n||t.start>=n.end){o=e;break}}-1===o&&(f.push({occupants:[],peak:{topPeak:0,botPeak:0}}),o=f.length-1),f[o].occupants.push({id:e.id,end:t?.end??-1/0}),f[o].peak.topPeak=Math.max(f[o].peak.topPeak,m[e.id]),f[o].peak.botPeak=Math.max(f[o].peak.botPeak,h[e.id]),p[e.id]=o}}else e.forEach((e,t)=>{f.push({occupants:[{id:e.id,end:u[e.id]?.end??-1/0}],peak:{topPeak:m[e.id],botPeak:h[e.id]}}),p[e.id]=t});let b=null,y=null,v=null,k=null;const S=()=>{b=he(p,t),v=ge(p,t)},w=()=>{y=he(p,t),k=ge(p,t)};"crossing-min"===c?(S(),fe(f,p,t),w()):"inside-out"===c?(S(),function(e,t){const o=e.length;if(1>=o)return;const n=e=>e.peak.topPeak+e.peak.botPeak,i=e.map((e,t)=>({slot:e,idx:t})).sort((e,t)=>n(t.slot)-n(e.slot)),r=Array(o),s=Math.floor((o-1)/2);r[s]=i[0].idx;let a=s-1,l=s+1;for(let e=1;i.length>e;e++)e%2==1&&o>l||0>a?r[l++]=i[e].idx:r[a--]=i[e].idx;const c=r.map(t=>e[t]),d=new Map;r.forEach((e,t)=>d.set(e,t));for(const e of Object.keys(t))t[e]=d.get(t[e]);e.length=0;for(const t of c)e.push(t)}(f,p),w()):"crossing-min+inside-out"===c&&(S(),fe(f,p,t),function(e,t,o){const n=e.length;if(1>=n)return;const i=e.map(e=>{return{slot:e,size:(t=e,t.peak.topPeak+t.peak.botPeak)};var t}).sort((e,t)=>t.size-e.size),r=Math.floor((n-1)/2);let s=ue(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=ue(t,o);if(m>s){const o=e[l];e.splice(l,1),e.splice(i,0,o);const r=new Map;for(let e=0;n>e;e++)r.set(e,e);if(i>l){for(let e=l+1;i>=e;e++)r.set(e,e-1);r.set(l,i)}else{for(let e=i;l>e;e++)r.set(e,e+1);r.set(l,i)}for(const e of Object.keys(t))t[e]=r.get(t[e])}else s=m}}(f,p,t),w());const C=f.map(e=>{const t=new Map;for(const n of e.occupants){const e=o[n.id];if(e)for(const o of e.samples){const e=t.get(o.t)||{top:0,bot:0};t.set(o.t,{top:Math.max(e.top,o.topMass),bot:Math.max(e.bot,o.botMass)})}}return[...t.entries()].sort((e,t)=>e[0]-t[0])}),T=(e,t)=>{let o={top:0,bot:0};for(const[n,i]of e){if(n>t)break;o=i}return o},I=[];for(let e=0;f.length-1>e;e++){const t=C[e],o=C[e+1],n=new Set([...t.map(e=>e[0]),...o.map(e=>e[0])]);let i=0;for(const e of n){const n=T(t,e),r=T(o,e);n.bot+r.top>i&&(i=n.bot+r.top)}I.push(i)}const A=[];let M=s+(f[0]?.peak.topPeak??0)*a;f.length>0&&A.push(M);for(let e=1;f.length>e;e++)M+=I[e-1]*a+s,A.push(M);if(f.length>0&&(M+=f[f.length-1].peak.botPeak*a+s),M>r){const e=r/M;for(let t=0;A.length>t;t++)A[t]*=e}const H=0===f.length?0:f[0].peak.topPeak+I.reduce((e,t)=>e+t,0)+f[f.length-1].peak.botPeak,x={};for(const t of e)x[t.id]=A[p[t.id]];return{effectiveSlotsHeight:H,centerlines:x,laneLifetime:u,slots:f,slotByNode:p,slotCenter:A,crossingsBefore:b,crossingsAfter:y,lengthBefore:v,lengthAfter:k}}re.displayName="SankeyDiagram";import{useMemo as ye,useState as ve,useRef as ke,useCallback as Se}from"react";import{scaleTime as we}from"d3-scale";import{forwardRef as Ce}from"react";var Te=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 Ie(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}import{Fragment as Ae,jsx as Me,jsxs as He}from"react/jsx-runtime";function xe(e){return null==e?NaN:e instanceof Date?e.getTime():"number"==typeof e?e:new Date(e).getTime()}function Be(e,t){return"function"==typeof e?e(t):t[e]}var Ne=Ce(function(e,t){const{nodes:o,edges:n,domain:r,axisTicks:l=[],nodeIdAccessor:c="id",sourceAccessor:d="source",targetAccessor:m="target",valueAccessor:h="value",startTimeAccessor:g="startTime",endTimeAccessor:u="endTime",systemInTimeAccessor:p,systemOutTimeAccessor:f,xExtentAccessor:k="xExtent",edgeIdAccessor:S="id",colorBy:w,colorScheme:C,showLegend:T,legendPosition:I="right",pairing:A="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:F,accessibleTable:z,responsiveWidth:j,responsiveHeight:$,loading:_,loadingContent:q,emptyContent:X,edgeOpacity:Y=.35,timeFormat:K,valueFormat:Q,tooltip:U,enableHover:Z=!0,onObservation:V,onClick:ee,showParticles:te=!1,particleStyle:oe,chartId:ne,frameProps:ie={}}=e,[re,he]=ve([]),[ge,ue]=ve([]),pe=ke(re),fe=ke(ge);pe.current=re,fe.current=ge;const Ce=Se(e=>{pe.current=e,he(e)},[]),Ne=Se(e=>{fe.current=e,ue(e)},[]),Oe=void 0!==n,De=b(Oe?n:re),Pe=ye(()=>{const e=b(o??[]),t=ge;if(0===e.length&&0===t.length)return G([],De,d,m);const n=new Set,i=[];for(const t of e){const e=Be(c,t)+"";n.has(e)||(n.add(e),i.push(t))}for(const e of t){const t=Be(c,e)+"";n.has(t)||(n.add(t),i.push(e))}const r=G([],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=ke(null),Ee=Se((e,t)=>{const o=Be(S,e);return null!=o?o+"":`${Be(d,e)}-${Be(m,e)}-${t}`},[S,d,m]),We=Se(e=>{if(null==e)return!1;const t=e;return null!=Be(d,t)&&null!=Be(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.");Ce([...pe.current,e])}else Ne([...fe.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."):Ce([...pe.current,...t])),o.length>0&&Ne([...fe.current,...o])},remove(e){const t=new Set(Array.isArray(e)?e:[e]),o=[];if(!Oe){const e=pe.current,n=[];for(let i=0;e.length>i;i++){const r=e[i];t.has(Ee(r,i))?o.push(r):n.push(r)}n.length!==e.length&&Ce(n)}const n=fe.current,i=[];for(const e of n){const n=Be(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=pe.current.map((i,r)=>o.has(Ee(i,r))?(n.push(i),e=!0,t(i)):i);e&&Ce(i)}let i=!1;const r=fe.current.map(e=>{const r=Be(c,e)+"";return o.has(r)?(n.push(e),i=!0,t(e)):e});return i&&Ne(r),n},clear(){Oe||Ce([]),Ne([]),Le.current?.clear()},getData:()=>De??[],getScales:()=>null}});const Re=Ee,Fe=Se(e=>Be(c,e)+"",[c]),{nodes:ze,edges:je,domain:$e,rawNodeById:_e,rawEdgeById:Ge}=ye(()=>{const e=(Pe??[]).map(e=>{const t={id:Fe(e),__raw:e},o=k?Be(k,e):null;if(Array.isArray(o)&&2===o.length){const e=xe(o[0]),n=xe(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:Be(d,e)+"",target:Be(m,e)+"",value:Number(Be(h,e)),startTime:xe(Be(g,e)),endTime:xe(Be(u,e)),__raw:e};if(p){const t=xe(Be(p,e));Number.isFinite(t)&&(o.systemInTime=t)}if(f){const t=xe(Be(f,e));Number.isFinite(t)&&(o.systemOutTime=t)}return o}),o=[xe(r[0]),xe(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,Fe,Re,k,d,m,h,g,u,p,f]),qe=J({nodes:Pe,edges:De,inferNodes:!1,nodeIdAccessor:c,sourceAccessor:d,targetAccessor:m,colorBy:w,colorScheme:C,showLegend:!1,legendPosition:I,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:_,loadingContent:q,emptyContent:X}),Xe=(T??!!w)&&!!w,Je=Se(e=>null!=E&&("number"==typeof E||null!=E[e]),[E]),Ye=ye(()=>{const e={...qe.margin};return Xe&&("right"===I&&!Je("right")&&140>e.right?e.right=140:"bottom"===I&&!Je("bottom")&&80>e.bottom&&(e.bottom=80)),e},[qe.margin,Xe,I,Je]),Ke=P-Ye.left-Ye.right,Qe=L-Ye.top-Ye.bottom,Ue=ye(()=>se(ze,je,$e),[ze,je,$e]),Ze=ye(()=>Ue.length>0?null:function(e,t,o){const{plotH:n,pairing:i="temporal",packing:r="reuse",laneOrder:s="crossing-min",lifetimeMode:a="half"}=o,l=function(e,t){const o={},n={};for(const t of e)o[t.id]=[],n[t.id]=[];for(const e of t)n[e.source]&&n[e.source].push(e),o[e.target]&&o[e.target].push(e);return{incoming:o,outgoing:n}}(e,t),c=function(e,t,o,n="value"){const i="temporal"===n?(e,t)=>e.endTime-t.endTime:(e,t)=>t.value-e.value,r="temporal"===n?(e,t)=>e.startTime-t.startTime:(e,t)=>t.value-e.value,s=new Map;for(const e of t)s.set(e.id,{});const a=(e,t)=>{const o=new Map;for(const n of e){const e=n[t];o.has(e)||o.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});const i=o.get(e);i.edges.push(n),i.total+=n.value,i.earliestStart=Math.min(i.earliestStart,n.startTime),i.latestEnd=Math.max(i.latestEnd,n.endTime)}const s=[...o.values()];s.sort("temporal"===n?(e,o)=>"target"===t?e.earliestStart-o.earliestStart:e.latestEnd-o.latestEnd:(e,t)=>t.total-e.total);for(const e of s)e.edges.sort("target"===t?r:i);return s};for(const t of e){const e=o.outgoing[t.id],n=o.incoming[t.id];if(0===n.length)a(e,"target").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).sourceSide=o});else if(0===e.length)a(n,"source").forEach((e,t)=>{const o=t%2==0?"top":"bot";for(const t of e.edges)s.get(t.id).targetSide=o});else{const t=a(n,"source"),o=a(e,"target"),i=Math.max(t.length,o.length);for(let e=0;i>e;e++){const n=e%2==0?"top":"bot";if(t[e])for(const o of t[e].edges)s.get(o.id).targetSide=n;if(o[e])for(const t of o[e].edges)s.get(t.id).sourceSide=n}}}return s}(e,t,l,i);let d={};for(const t of e)d[t.id]=le(t,l,c);const m=be(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]=le(t,l,c);const g=be(e,t,d,l,{plotH:n,padding:12,valueScale:1,packing:r,laneOrder:s,lifetimeMode:a}),u=g.effectiveSlotsHeight??g.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),p=Math.min(12,.35*n/Math.max(g.slots.length+1,1)),f=u>0?Math.max(0,(n-p*(g.slots.length+1))/u):1,b=be(e,t,d,l,{plotH:n,padding:p,valueScale:f,packing:r,laneOrder:s,lifetimeMode:a});return{nodeData:d,sides:c,valueScale:f,padding:p,compressedPadding:12>p,centerlines:b.centerlines,laneLifetime:b.laneLifetime,slots:b.slots,slotByNode:b.slotByNode,crossingsBefore:b.crossingsBefore,crossingsAfter:b.crossingsAfter,lengthBefore:b.lengthBefore,lengthAfter:b.lengthAfter}}(ze,je,{plotH:Qe,pairing:A,packing:M,laneOrder:H,lifetimeMode:B}),[Ue,ze,je,Qe,A,M,H,B]),Ve=ye(()=>we().domain($e).range([0,Ke]),[$e,Ke]),et=Se((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=ye(()=>{const e=new Map;return ze.forEach((t,o)=>e.set(t.id,o)),e},[ze]),ot=ye(()=>{if(!Ze)return{bands:[],ribbons:[]};const{centerlines:e,nodeData:t,valueScale:o}=Ze,n=[],i=[];return ze.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=de(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=de(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=de(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(ce(e,i)),u=[],p=(e,t,o,n)=>`M${e},${t} L${o},${t} L${o},${n} L${e},${n} Z`;for(const o of t){if(o.source===e&&null!=o.systemInTime&&Number.isFinite(o.systemInTime)){const e=r.localAttachments.get(o.id);if(e&&"out"===e.kind&&o.startTime>o.systemInTime){const t=g(o.systemInTime),n=g(o.startTime),i=t-20,r=Math.max(m,i);if(n>r){const[o,l]=me(e,a,s);u.push({pathD:p(r,o,n,l),x0:i,x1:t,from:0,to:1})}}}if(o.target===e&&null!=o.systemOutTime&&Number.isFinite(o.systemOutTime)){const e=r.localAttachments.get(o.id);if(e&&"in"===e.kind&&o.systemOutTime>o.endTime){const t=g(o.systemOutTime),n=g(o.endTime),i=t+20,r=Math.min(h,i);if(r>n){const[o,l]=me(e,a,s);u.push({pathD:p(n,o,r,l),x0:t,x1:i,from:1,to:0})}}}}return u}(i.id,je,Ze,Ve,$e);n.push({id:i.id,pathD:a,fill:m,stroke:m,strokeWidth:.5,...g.length>0&&{gradientStubs:g},rawDatum:h,labelX:Ve(c.t)-4,labelY:d,labelText:i.id})}),je.forEach(n=>{const r=t[n.source]?.localAttachments.get(n.id),s=t[n.target]?.localAttachments.get(n.id);if(!r||!s)return;const l=tt.get(n.source)??0,c=et(n.source,l),d=function(e,t,o,n,i,r,s,a){const l=i,c=e=>a?Math.max(a[0],Math.min(a[1],e)):e,d=r(c(e.time)),m=r(c(o.time)),h=e.value*l,g=o.value*l,u=e.sideMassBefore*l,p=o.sideMassAfter*l;let f,b,y,v;"top"===e.side?(f=t-u,b=f+h):(b=t+u,f=b-h),"top"===o.side?(y=n-p,v=y+g):(v=n+p,y=v-g);const k="source"===s?d+.85*(m-d):"target"===s?d+.15*(m-d):(d+m)/2;return{sx:d,sTop:f,sBot:b,tx:m,tTop:y,tBot:v,cp1X:k,cp2X:k}}(r,e[n.source],s,e[n.target],o,Ve,x,$e),{pathD:m,bezier:h}=a(d),g=Ge.get(n.id)??n;i.push({id:n.id,pathD:m,fill:c,opacity:Y,rawDatum:g,bezier:h})}),{bands:n,ribbons:i}},[Ze,ze,je,Ve,$e,et,_e,Ge,x,Y,tt]),nt=ye(()=>({bands:ot.bands,ribbons:ot.ribbons,showLabels:D}),[ot,D]),it=ye(()=>{if(!Xe||!w)return;const e=new Map;(Pe??[]).forEach((t,o)=>{const n=Be(w,t),i=null==n?"":n+"";i&&!e.has(i)&&e.set(i,{label:i,color:et(Fe(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},[Xe,w,Pe,et,Fe]),rt=ye(()=>!1!==U&&Z?void 0===U||!0===U?null:v(U)||null:null,[U,Z]),st=Se(e=>K?K(new Date(e)):Number.isFinite(e)?1e10>Math.abs(e)?Number.isInteger(e)?e+"":e.toFixed(2):new Date(e).toISOString().slice(0,10):"",[K]),at=Se(e=>Q?Q(e):e+"",[Q]),lt=Se(e=>{if(!e||!e.data)return null;const t=e.data;if(!Ie(t))return null;const o=t.data;if(rt)return rt(o);if("band"===t.__kind){const e=t.id,o=Ze?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}(Ze.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 He("div",{style:{minWidth:160},children:[Me("div",{style:{fontWeight:600,marginBottom:4},children:e}),r.length>0&&He("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[Me("thead",{children:He("tr",{style:{opacity:.6},children:[Me("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),Me("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=i&&Me("th",{})]})}),Me("tbody",{children:r.map((e,t)=>He("tr",{children:[Me("td",{style:{paddingRight:8},children:st(e.t)}),Me("td",{style:{textAlign:"right"},children:at(e.total)}),null!=i&&Me("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:e.mark})]},t))})]}),null!=i&&He("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",r.length," of ",i," samples"]})]})}const n=o,i=Be(d,n),r=Be(m,n),s=Be(h,n),a=Be(g,n),l=Be(u,n);return He("div",{style:{minWidth:160},children:[He("div",{style:{fontWeight:600,marginBottom:4},children:[i+""," → ",r+""]}),He("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=s&&He(Ae,{children:[Me("span",{style:{opacity:.6},children:"value"}),Me("span",{style:{textAlign:"right"},children:at(Number(s))})]}),null!=a&&He(Ae,{children:[Me("span",{style:{opacity:.6},children:"start"}),Me("span",{style:{textAlign:"right"},children:st(xe(a))})]}),null!=l&&He(Ae,{children:[Me("span",{style:{opacity:.6},children:"end"}),Me("span",{style:{textAlign:"right"},children:st(xe(l))})]})]})]})},[Ze,rt,st,at,d,m,h,g,u]),ct=ye(()=>{if(!Ze)return null;const{centerlines:e,laneLifetime:t,nodeData:o,valueScale:n,compressedPadding:i,crossingsBefore:r,crossingsAfter:s,lengthBefore:a,lengthAfter:c}=Ze;let d=null,m=null;for(const e of ze){const o=t[e.id];if(!o||null===o.start||null===o.end)continue;const n=Ve(o.start),i=Ve(o.end);(null===d||d>n)&&(d=n),(null===m||i>m)&&(m=i)}const h=e=>Math.max(0,Math.min(Ke,e)),g=h(d??0),u=Math.max(g,h(m??Ke));return He("g",{children:[O&&null!==(s??null)&&He("text",{x:Ke,y:-12,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:["crossings: ",r," → ",s," ","edge length: ",Math.round(a)," → ",Math.round(c)]}),i&&Me("text",{x:Ke,y:2,fontSize:10,fill:"#94a3b8",textAnchor:"end",children:"dense layout: lane gaps compressed"}),l.map((e,t)=>{const o=Ve(xe(e.date));return g-.5>o||o>u+.5?null:Me("line",{x1:o,y1:0,x2:o,y2:Qe,stroke:"#94a3b8",strokeOpacity:.15,strokeDasharray:"2 4"},"grid-"+t)}),N&&ze.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 He("g",{children:[Me("line",{x1:d,y1:c,x2:m,y2:c,stroke:h,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),Me("line",{x1:d,y1:c-4,x2:d,y2:c+4,stroke:h,strokeOpacity:.5}),Me("line",{x1:m,y1:c-4,x2:m,y2:c+4,stroke:h,strokeOpacity:.5})]},"lane-"+i.id)}),Me("line",{x1:g,y1:Qe+4,x2:u,y2:Qe+4,stroke:"#94a3b8"}),l.map((e,t)=>{const o=xe(e.date),n=Ve(o);if(g-.5>n||n>u+.5)return null;const i=null!=e.label?e.label:K?K(new Date(o)):"";return He("g",{transform:`translate(${n},${Qe+4})`,children:[Me("line",{y2:6,stroke:"#94a3b8"}),Me("text",{y:20,textAnchor:"middle",fontSize:11,fill:"#475569",children:i})]},t)})]})},[Ze,l,Ve,Ke,Qe,N,ze,et,O,K]),dt=ye(()=>(Pe??[]).map(e=>({id:Fe(e),data:e})),[Pe,Fe]),mt=ye(()=>{const e=new Map;for(const t of ot.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[ot]),ht=ye(()=>(De??[]).map((e,t)=>{const o=Re(e,t),n=Number(Be(h,e));return{id:o,source:Be(d,e)+"",target:Be(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 Ue.length>0?He("svg",{width:P,height:L,role:"img","aria-label":W??"Process Sankey validation failed",children:[Me("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),Ue.map((e,t)=>Me("text",{x:20,y:56+18*t,fontSize:12,fill:"#64748b",children:"• "+ae(e)},t))]}):gt||ut||Me(s,{ref:Le,chartType:"force",nodes:dt,edges:ht,customNetworkLayout:Te,layoutConfig:nt,size:[P,L],responsiveWidth:j,responsiveHeight:$,margin:Ye,title:W,description:R??"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:F,accessibleTable:z,enableHover:Z,tooltipContent:!1===U?()=>null:lt,backgroundGraphics:ct,showParticles:te,particleStyle:oe,legend:it,legendPosition:I,onObservation:V,...ee&&{customClickBehavior:e=>{if(!e||!e.data||!ee)return;const t=e.data;Ie(t)&&ee(t.data,{x:e.x,y:e.y})}},chartId:ne,colorScheme:Array.isArray(C)?C:void 0,...ie})});Ne.displayName="ProcessSankey";import{useMemo as Oe}from"react";import{jsx as De}from"react/jsx-runtime";function Pe(e){const n=I(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:i,margin:r,className:a,layout:l="tree",orientation:d="vertical",childrenAccessor:m="children",valueAccessor:h="value",nodeIdAccessor:g="name",colorBy:u,colorScheme:p,colorByDepth:b=!1,edgeStyle:k="curve",nodeLabel:S,nodeSize:C=5,tooltip:T,frameProps:A={},onObservation:M,onClick:H,chartId:x,selection:B,linkedHover:D,loading:P,loadingContent:L,legendInteraction:E,stroke:W,strokeWidth:R,opacity:F}=e,{width:z,height:j,enableHover:$,showLabels:G=!0,title:X,description:Y,summary:K,accessibleTable:Q}=n,U=J({nodes:Oe(()=>_(i??null,m),[i,m]),edges:void 0,inferNodes:!1,colorBy:b?void 0:u,colorScheme:p,showLegend:!1,legendInteraction:E,selection:B,linkedHover:D,onObservation:M,onClick:H,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"TreeDiagram",chartId:x,marginDefaults:n.marginDefaults,userMargin:r,width:z,height:j,loading:P,loadingContent:L}),Z=Oe(()=>new Map,[]),V=Oe(()=>e=>{const t={stroke:"black",strokeWidth:1};return t.fill=b?f[(e.depth||0)%f.length]:u?y(e.data||e,u,U.colorScale):w(void 0,U.themeCategorical,p,void 0,Z),t},[u,b,U.colorScale,U.themeCategorical,p,Z]),ee=Oe(()=>o(V,{stroke:W,strokeWidth:R,opacity:F}),[V,W,R,F]),te=Oe(()=>()=>({stroke:"#999",strokeWidth:1,fill:"none"}),[]),oe=Oe(()=>o(te,{stroke:W,strokeWidth:R,opacity:F}),[te,W,R,F]),ne=Oe(()=>{if("treemap"===l||"circlepack"===l||"partition"===l)return q(h)},[l,h]),ie=t({componentName:"TreeDiagram",data:i});return ie?De(N,{componentName:"TreeDiagram",message:ie,width:z,height:j}):U.loadingEl?U.loadingEl:De(O,{componentName:"TreeDiagram",width:z,height:j,children:De(s,{chartType:l,...null!=i&&{data:i},size:[z,j],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,nodeIDAccessor:g,childrenAccessor:m,hierarchySum:ne,treeOrientation:d,edgeType:k,nodeStyle:ee,edgeStyle:oe,colorBy:u,colorScheme:U.effectivePalette,colorByDepth:b,nodeSize:C,nodeLabel:G?S||g:void 0,showLabels:G,enableHover:$,tooltipContent:!1===T?()=>null:v(T)||void 0,...c({linkedHover:D,selection:B,onObservation:M,onClick:H,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior,linkedHoverInClickPredicate:!1}),...E&&"none"!==E&&{legendHoverBehavior:U.legendState.onLegendHover,legendClickBehavior:U.legendState.onLegendClick,legendHighlightedCategory:U.legendState.highlightedCategory,legendIsolatedCategories:U.legendState.isolatedCategories},className:a,title:X,description:Y,summary:K,accessibleTable:Q,...null!=e.animate&&{animate:e.animate},...A})})}Pe.displayName="TreeDiagram";import{useMemo as Le,useCallback as Ee}from"react";import{jsx as We}from"react/jsx-runtime";function Re(e){const n=I(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,linkedHover:e.linkedHover,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:i,margin:a,className:l,childrenAccessor:d="children",valueAccessor:m="value",nodeIdAccessor:h="name",colorBy:g,colorScheme:u,colorByDepth:b=!1,labelMode:k="leaf",nodeLabel:S,padding:C=4,paddingTop:T,nodeStyle:A,tooltip:M,frameProps:H={},selection:x,linkedHover:B,onObservation:D,onClick:P,chartId:L,loading:E,loadingContent:W,legendInteraction:R,stroke:F,strokeWidth:z,opacity:j}=e,{nodeStyle:$,...G}=H,{width:X,height:Y,enableHover:K,showLabels:Q=!0,title:U,description:Z,summary:V,accessibleTable:ee}=n,te=J({nodes:Le(()=>_(i??null,d),[i,d]),edges:void 0,inferNodes:!1,colorBy:b?void 0:g,colorScheme:u,showLegend:!1,legendInteraction:R,selection:x,linkedHover:B,onObservation:D,onClick:P,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"Treemap",chartId:L,marginDefaults:n.marginDefaults,userMargin:a,width:X,height:Y,loading:E,loadingContent:W}),oe=r(x),ne=te.customHoverBehavior,ie=Ee(e=>{if(!e)return ne(null);const t=e.data||e;ne({data:t?.data||t})},[ne]),re=Le(()=>new Map,[]),se=Le(()=>e=>{const t={stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8};return t.fill=b?f[(e.depth||0)%f.length]:g?y(e.data||e,g,te.colorScale):w(void 0,te.themeCategorical,u,void 0,re),t},[g,b,te.colorScale,te.themeCategorical,u,re]),ae=Le(()=>A||$?e=>({...se(e),...$?$(e)??{}:{},...A?A(e)??{}:{}}):se,[se,A,$]),le=Le(()=>o(ae,{stroke:F,strokeWidth:z,opacity:j}),[ae,F,z,j]),ce=Le(()=>te.activeSelectionHook?e=>{const t={...le(e)};if(te.activeSelectionHook.isActive)if(te.activeSelectionHook.predicate(e.data||e))oe?.selectedStyle&&Object.assign(t,oe.selectedStyle);else{const e=oe?.unselectedOpacity??p;t.opacity=e,t.fillOpacity=e,t.strokeOpacity=e,oe?.unselectedStyle&&Object.assign(t,oe.unselectedStyle)}return t}:le,[le,te.activeSelectionHook,oe]),de=Le(()=>q(m),[m]),me=void 0!==T?T:!Q||"parent"!==k&&"all"!==k?void 0:18,he=t({componentName:"Treemap",data:i});return he?We(N,{componentName:"Treemap",message:he,width:X,height:Y}):te.loadingEl?te.loadingEl:We(O,{componentName:"Treemap",width:X,height:Y,children:We(s,{chartType:"treemap",...null!=i&&{data:i},size:[X,Y],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,nodeIDAccessor:h,childrenAccessor:d,hierarchySum:de,padding:C,paddingTop:me,nodeStyle:ce,colorBy:g,colorScheme:te.effectivePalette,colorByDepth:b,nodeLabel:Q?S||h:void 0,showLabels:Q,labelMode:k,enableHover:K,tooltipContent:!1===M?()=>null:v(M)||void 0,...c({linkedHover:B,selection:x,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:U,description:Z,summary:V,accessibleTable:ee,...null!=e.animate&&{animate:e.animate},...G})})}Re.displayName="Treemap";import{useMemo as Fe}from"react";import{jsx as ze}from"react/jsx-runtime";function je(e){const n=I(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:i,margin:r,className:a,childrenAccessor:l="children",valueAccessor:d="value",nodeIdAccessor:m="name",colorBy:h,colorScheme:g,colorByDepth:u=!1,nodeLabel:p,circleOpacity:b=.7,padding:k=4,tooltip:S,frameProps:C={},onObservation:T,onClick:A,chartId:M,selection:H,linkedHover:x,loading:B,loadingContent:D,legendInteraction:P,stroke:L,strokeWidth:E,opacity:W}=e,{width:R,height:F,enableHover:z,showLabels:j=!0,title:$,description:G,summary:X,accessibleTable:Y}=n,K=J({nodes:Fe(()=>_(i??null,l),[i,l]),edges:void 0,inferNodes:!1,colorBy:u?void 0:h,colorScheme:g,showLegend:!1,legendInteraction:P,selection:H,linkedHover:x,onObservation:T,onClick:A,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"CirclePack",chartId:M,marginDefaults:n.marginDefaults,userMargin:r,width:R,height:F,loading:B,loadingContent:D}),Q=Fe(()=>new Map,[]),U=Fe(()=>e=>{const t={stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:b};return t.fill=u?f[(e.depth||0)%f.length]:h?y(e.data||e,h,K.colorScale):w(void 0,K.themeCategorical,g,void 0,Q),t},[h,u,K.colorScale,b,K.themeCategorical,g,Q]),Z=Fe(()=>o(U,{stroke:L,strokeWidth:E,opacity:W}),[U,L,E,W]),V=Fe(()=>q(d),[d]),ee=t({componentName:"CirclePack",data:i});return ee?ze(N,{componentName:"CirclePack",message:ee,width:R,height:F}):K.loadingEl?K.loadingEl:ze(O,{componentName:"CirclePack",width:R,height:F,children:ze(s,{chartType:"circlepack",...null!=i&&{data:i},size:[R,F],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:K.margin,nodeIDAccessor:m,childrenAccessor:l,hierarchySum:V,padding:k,nodeStyle:Z,colorBy:h,colorScheme:K.effectivePalette,colorByDepth:u,nodeLabel:j?p||m:void 0,showLabels:j,enableHover:z,tooltipContent:!1===S?()=>null:v(S)||void 0,...c({linkedHover:x,selection:H,onObservation:T,onClick:A,mobileInteraction:K.mobileInteraction,customHoverBehavior:K.customHoverBehavior,customClickBehavior:K.customClickBehavior,linkedHoverInClickPredicate:!1}),...P&&"none"!==P&&{legendHoverBehavior:K.legendState.onLegendHover,legendClickBehavior:K.legendState.onLegendClick,legendHighlightedCategory:K.legendState.highlightedCategory,legendIsolatedCategories:K.legendState.isolatedCategories},className:a,title:$,description:G,summary:X,accessibleTable:Y,...null!=e.animate&&{animate:e.animate},...C})})}je.displayName="CirclePack";import{useMemo as $e}from"react";import{jsx as _e}from"react/jsx-runtime";var Ge=f;function qe(e){const n=I(e.mode,{width:e.width,height:e.height,enableHover:e.enableHover,showLabels:e.showLabels,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:600,height:600}),{data:i,margin:r,className:a,childrenAccessor:l="children",nodeIdAccessor:d="name",colorBy:m,colorScheme:h,colorByDepth:p=!1,orbitMode:f="flat",orbitSize:b=2.95,speed:S=.25,revolution:C,revolutionStyle:T,eccentricity:A=1,showRings:M=!0,nodeRadius:H=6,showLabels:x=!1,animated:B=!0,tooltip:D,foregroundGraphics:P,annotations:L,frameProps:E={},onObservation:W,onClick:R,chartId:F,selection:z,linkedHover:j,loading:$,loadingContent:G,stroke:q,strokeWidth:X,opacity:Y}=e,{width:K,height:Q,enableHover:U,title:Z,description:V,summary:ee,accessibleTable:te}=n,oe=J({nodes:$e(()=>_(i,l),[i,l]),edges:void 0,inferNodes:!1,colorBy:p?void 0:m,colorScheme:h,showLegend:!1,legendInteraction:void 0,selection:z,linkedHover:j,onObservation:W,onClick:R,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"OrbitDiagram",chartId:F,marginDefaults:k(n),userMargin:r,width:K,height:Q,loading:$,loadingContent:G}),ne=$e(()=>new Map,[]),{colorScale:ie,customClickBehavior:re,customHoverBehavior:se,themeCategorical:ae}=oe,le=$e(()=>{if(Array.isArray(h))return h;const e=g[h];return Array.isArray(e)?e:u},[h]),ce=$e(()=>e=>{const t={stroke:"#fff",strokeWidth:1},o=0===(e.depth??0);return t.fill=p?o?le[0]:Ge[(e.depth||0)%Ge.length]:m?y(e.data||e,m,ie):w(void 0,ae,h,void 0,ne),t.opacity=o?1:.85,t},[m,p,ie,le,ae,h,ne]),de=$e(()=>o(ce,{stroke:q,strokeWidth:X,opacity:Y}),[ce,q,X,Y]),me=$e(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),he=$e(()=>e=>{se(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[se]),ge=$e(()=>e=>{re(e&&e.data&&void 0!==e.data.data?{...e,data:e.data.data}:e)},[re]),ue=t({componentName:"OrbitDiagram",data:i});return ue?_e(N,{componentName:"OrbitDiagram",message:ue,width:K,height:Q}):oe.loadingEl?oe.loadingEl:_e(O,{componentName:"OrbitDiagram",width:K,height:Q,children:_e(s,{chartType:"orbit",...null!=i&&{data:i},size:[K,Q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,nodeIDAccessor:d,childrenAccessor:l,nodeStyle:de,edgeStyle:me,colorBy:m,colorScheme:oe.effectivePalette,colorByDepth:p,nodeSize:H,nodeLabel:x?d:void 0,showLabels:x,enableHover:!B&&U,tooltipContent:B?void 0:!1===D?()=>null:v(D)||void 0,...c({linkedHover:j,selection:z,onObservation:W,onClick:R,mobileInteraction:oe.mobileInteraction,customHoverBehavior:he,customClickBehavior:ge,linkedHoverInClickPredicate:!1}),foregroundGraphics:P,annotations:L,className:a,title:Z,description:V,summary:ee,orbitMode:f,orbitSize:b,orbitSpeed:S,orbitRevolution:C,orbitRevolutionStyle:T,orbitEccentricity:A,orbitShowRings:M,orbitAnimated:B,accessibleTable:te,...null!=e.animate&&{animate:e.animate},...E})})}qe.displayName="OrbitDiagram";import{forceCenter as Xe,forceCollide as Je,forceLink as Ye,forceManyBody as Ke,forceSimulation as Qe,forceX as Ue,forceY as Ze}from"d3-force";function Ve(e,t,o={}){const n=o.iterations??260,i=o.repulsion??5200,r=o.linkDistance??165,s=o.linkStrength??.045,a=o.centerStrength??.018,l=o.damping??.84,c=o.nodeRadius??12,m=o.nodePadding??3,h=o.inset??.06,g=d(o.seed??1),u=new Map;for(const t of e)u.set(t.id,0);for(const e of t)u.set(e.source,(u.get(e.source)??0)+1),u.set(e.target,(u.get(e.target)??0)+1);const p=500,f=e.map(e=>({id:e.id,data:e,x:200+600*g(),y:200+600*g()})),b=new Set(e.map(e=>e.id)),y=t.filter(e=>b.has(e.source)&&b.has(e.target)).map(e=>({source:e.source,target:e.target}));if(n>0){const e=Qe(f).randomSource(g).alphaDecay(1-Math.pow(.001,1/n)).velocityDecay(Math.max(0,Math.min(1,1-l))).force("charge",Ke().strength(e=>{const t=u.get(e.id)??0;return 2.5*-Math.sqrt(i)*Math.sqrt(t+1)})).force("collide",Je(e=>(e=>"function"==typeof c?c(e.data):c)(e)+m).strength(.9).iterations(2)).force("center",Xe(p,p).strength(.8)).force("x",Ue(p).strength(a)).force("y",Ze(p).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 f){const t=e.x??p,o=e.y??p;v>t&&(v=t),k>o&&(k=o),t>S&&(S=t),o>w&&(w=o)}const C=S-v,T=w-k,I={};for(const e of f)I[e.id]={x:0===C?.5:h+((e.x??p)-v)/C*(1-2*h),y:0===T?.5:h+((e.y??p)-k)/T*(1-2*h)};return I}export{R as NetworkCustomChart,K as ForceDirectedGraph,ee as ChordDiagram,re as SankeyDiagram,se as validateProcessSankey,ae as formatProcessSankeyIssue,Ne as ProcessSankey,Pe as TreeDiagram,Re as Treemap,je as CirclePack,qe as OrbitDiagram,Ve as forceLayout};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{STREAMING_PALETTE as e,createColorScale as t,filterSparseArray as r,getCrosshairProps as o,resolveMobileInteraction as n,useCategoryColors as a,useChartLegendAndMargin as i,useChartMode as l,useChartSelection as c,useColorScale as u,useLegendInteraction as s,useThemeCategorical as g}from"./chunk-chunk-BFHUYEOS.module.min.js";import{useThemeSelector as d}from"./chunk-chunk-WCX6U47H.module.min.js";import{renderEmptyState as m,renderLoadingState as h}from"./chunk-chunk-ACLDBMRH.module.min.js";import{useMemo as p}from"react";function y(e){const t=d(e=>e.theme.colors.selectionOpacity);return p(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}import{useCallback as f,useMemo as v,useState as b}from"react";function L(l){const{data:d,rawData:p,colorBy:L,colorScheme:k,legendInteraction:C,legendPosition:S,selection:H,linkedHover:w,fallbackFields:B,unwrapData:D=!1,onObservation:M,chartType:I,chartId:F,showLegend:R,legend:A,userMargin:P,marginDefaults:O,onClick:T,hoverHighlight:x,mobileInteraction:W,mobileSemantics:j,loading:z,loadingContent:G,emptyContent:N,width:U,height:_}=l,E=void 0===p,V=v(()=>r(d),[d]),[X,Y]=b([]),q=f(e=>{Y(t=>t.length===e.length&&t.every((t,r)=>t===e[r])?t:e)},[]),J="string"==typeof l.colorBy?l.colorBy:void 0,K=v(()=>n(W,{width:U,mobileSemantics:j}),[W,U,j]),{activeSelectionHook:Q,hoverSelectionHook:Z,customHoverBehavior:$,customClickBehavior:ee,crosshairSourceId:te}=c({selection:H,linkedHover:w,fallbackFields:B,unwrapData:D,onObservation:M,chartType:I,chartId:F,onClick:T,hoverHighlight:x,colorByField:J,mobileInteraction:K}),re=o(w,te),oe=u(V,L,k),ne=v(()=>{if(!L)return[];const e=new Set;for(const t of V){const r="function"==typeof L?L(t):t[L];null!=r&&e.add(r+"")}return Array.from(e)},[V,L]),ae=v(()=>E&&X.length>0?X:ne,[E,X,ne]),ie=s(C,L,ae),le=v(()=>Z||(ie.legendSelectionHook?ie.legendSelectionHook:Q),[Z,ie.legendSelectionHook,Q]),ce=y(H),ue=g(),se=a(),ge=v(()=>{if(oe)return oe;if(!L||0===ae.length)return;const r=Array.isArray(k)&&k.length>0||"string"==typeof k&&k.length>0?k:ue&&ue.length>0?ue:e,o="__streamCat",n=ae.map(e=>({[o]:e})),a=t(n,o,r);return e=>se?.[e]||a(e)||"#999"},[oe,L,ae,k,ue,se]),{legend:de,margin:me,legendPosition:he}=i({data:V,colorBy:L,colorScale:ge,showLegend:R,legendPosition:S,userMargin:P,defaults:O,categories:ae,additionalLegend:A}),pe=v(()=>{const e={};return de&&(e.legend=de,e.legendPosition=he),C&&"none"!==C&&(e.legendHoverBehavior=ie.onLegendHover,e.legendClickBehavior=ie.onLegendClick,e.legendHighlightedCategory=ie.highlightedCategory,e.legendIsolatedCategories=ie.isolatedCategories),E&&L&&(e.legendCategoryAccessor=L,e.onCategoriesChange=q),e},[de,he,C,ie.onLegendHover,ie.onLegendClick,ie.highlightedCategory,ie.isolatedCategories,E,L,q]),ye=Array.isArray(p)?r(p):p,fe=h(z,U,_,G),ve=fe?null:m(ye,U,_,N);return{data:V,colorScale:oe,allCategories:ae,legendState:ie,effectiveSelectionHook:le,activeSelectionHook:Q,customHoverBehavior:$,customClickBehavior:ee,mobileInteraction:K,legend:de,margin:me,legendPosition:he,earlyReturn:fe||ve||null,legendBehaviorProps:pe,crosshairProps:re,resolvedSelection:ce}}import{useImperativeHandle as k,useRef as C}from"react";function S(e,t){const{variant:r,frameRef:o,overrides:n}=t,a=C(n);a.current=n,k(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,r)=>e.current?.update(t,r)??[],replace:t=>e.current?.replace?.(t),clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const r=Array.isArray(t)?t:[t],o=e.current?.getTopology()?.nodes??[],n=[];for(const t of r){const r=o.find(e=>e.id===t);r&&n.push({...r.data??{},id:t}),e.current?.removeNode(t)}return n},update:(t,r)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const o=e.current?.updateNode(t,r);return o?[{...o,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,r)=>{const o=e.current?.removePoint(t)??[];for(const t of o)e.current?.push(r(t));return o},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const r=t;return{push:e=>r.current?.pushLine(e),pushMany:e=>r.current?.pushManyLines(e),remove:e=>r.current?.removeLine(e)??[],update:(e,t)=>{const o=r.current?.removeLine(e)??[];for(const e of o)r.current?.pushLine(t(e));return o},clear:()=>r.current?.clear(),getData:()=>r.current?.getLines()??[],getCustomLayout:()=>r.current?.getCustomLayout?.()??null,getLayoutFailure:()=>r.current?.getLayoutFailure?.()??null}}(r,o);return new Proxy(e,{get(e,t,r){if("string"==typeof t){const e=a.current?.[t];if("function"==typeof e)return e}return Reflect.get(e,t,r)},has:(e,t)=>!("string"!=typeof t||!a.current||!(t in a.current))||Reflect.has(e,t)})},[])}function H(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const r={};return void 0!==t.stroke&&(r.stroke=t.stroke),void 0!==t.strokeWidth&&(r.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(r.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...r}):(...e)=>({...r})}function w(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}import{useMemo as B,useRef as D}from"react";function M(e){const t=D(null);return S(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:l(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:B(()=>w(e.margin),[e.margin])}}function I(e){const t=M(e),{resolved:r,normalizedMargin:o}=t,n=L({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:r.showLegend,legend:e.legend,userMargin:o,marginDefaults:r.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:r.width,height:r.height});return{...t,safeData:n.data,setup:n,earlyReturn:n.earlyReturn}}export{y as useResolvedSelection,L as useChartSetup,S as useFrameImperativeHandle,H as mergeShapeStyle,w as normalizePartialMargin,M as useCustomChartScaffold,I as useCustomChartSetup};
|