semiotic 3.12.0 → 3.12.1
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/README.md +50 -46
- package/ai/artifact-surface-inventory.json +1 -1
- package/ai/behaviorContracts.cjs +1 -1
- package/ai/dist/diagnose-operation.js +3 -3
- package/ai/dist/mcp-server.js +1 -1
- package/ai/reference.md +15 -3
- package/ai/schema.json +908 -96
- package/ai/surface-manifest.json +1 -1
- package/ai/task-packets/compare-category-totals.json +5 -5
- package/ai/task-packets/compare-category-totals.md +2 -2
- package/ai/task-packets/correct-published-chart.json +5 -5
- package/ai/task-packets/correct-published-chart.md +2 -2
- package/ai/task-packets/index.json +6 -6
- package/ai/task-packets/update-live-chart.json +5 -5
- package/ai/task-packets/update-live-chart.md +2 -2
- package/dist/c-27DCB5T6.min.js +7 -7
- package/dist/c-2CKIGFD2.min.js +1 -1
- package/dist/c-3FATLOH4.min.js +1 -0
- package/dist/{c-STVM6CBI.min.js → c-4SCJKAWZ.min.js} +200 -200
- package/dist/c-5FUOKMH6.min.js +7 -0
- package/dist/c-AAIPWVQ5.min.js +6 -6
- package/dist/{c-2RG4WOVX.min.js → c-ALLF3Y77.min.js} +1 -1
- package/dist/{c-QMKQVCCZ.min.js → c-C5GXUHUO.min.js} +6 -6
- package/dist/c-C67QDKTU.min.js +34 -0
- package/dist/c-F76M77YC.min.js +1 -0
- package/dist/c-FEVXPKQH.min.js +1 -1
- package/dist/c-G42WVQO2.min.js +1 -0
- package/dist/c-G5A3YWTN.min.js +66 -0
- package/dist/c-H4HVKBU3.min.js +1 -0
- package/dist/c-HU3ASFKT.min.js +1 -0
- package/dist/c-I4FYCVJB.min.js +391 -0
- package/dist/{c-5L7JGWQW.min.js → c-IATPZOL7.min.js} +28 -28
- package/dist/c-IE5EBBP6.min.js +110 -0
- package/dist/c-IGONIKZL.min.js +1 -0
- package/dist/c-IKPM53JH.min.js +1 -0
- package/dist/c-IU4QZ7Y5.min.js +1 -1
- package/dist/{c-2ACLVPKF.min.js → c-K5VE57OI.min.js} +1 -1
- package/dist/c-KWJIBJ4R.min.js +1 -0
- package/dist/c-LIMFU6RD.min.js +1 -0
- package/dist/c-M4T43G76.min.js +1 -0
- package/dist/c-M7QUZZCE.min.js +1 -1
- package/dist/c-NVSINXE5.min.js +1 -0
- package/dist/{c-FAF6EV4E.min.js → c-NWRYV6ZF.min.js} +1 -1
- package/dist/c-O5GU2R5W.min.js +1 -0
- package/dist/c-OC7GNXGZ.min.js +1 -0
- package/dist/c-OV5F3DQP.min.js +1 -0
- package/dist/{c-5TAXHW7I.min.js → c-PJ5CAYAW.min.js} +1 -1
- package/dist/c-Q5LZRQGD.min.js +1 -0
- package/dist/c-QP3PXK3N.min.js +1 -0
- package/dist/c-SGZ7ZD2I.min.js +51 -0
- package/dist/c-SSKV5JPW.min.js +1 -1
- package/dist/c-THWTHWXU.min.js +37 -0
- package/dist/c-TRMNDRC4.min.js +41 -0
- package/dist/c-UP656CST.min.js +1 -1
- package/dist/c-USYOK5OX.min.js +1 -0
- package/dist/c-VI753KBO.min.js +1 -0
- package/dist/{c-TT4CTEBR.min.js → c-VLAAAFST.min.js} +1 -1
- package/dist/c-VSOQPII4.min.js +5 -5
- package/dist/c-WGDM4ZRP.min.js +26 -0
- package/dist/c-XCV7VUU3.min.js +87 -0
- package/dist/c-XGDZPYBI.min.js +1 -0
- package/dist/c-XI6CLZII.min.js +1 -0
- package/dist/{c-L4Q2YMXO.min.js → c-XLC7PKM7.min.js} +1 -1
- package/dist/{c-3YAGKCPU.min.js → c-YEB6Z35F.min.js} +1 -1
- package/dist/c-YWZBFG63.min.js +1 -0
- package/dist/c-ZMYO3NZU.min.js +2 -0
- package/dist/c-ZO36H5VH.min.js +48 -0
- package/dist/components/LinkedCharts.d.ts +6 -1
- package/dist/components/Tooltip/Tooltip.d.ts +11 -1
- package/dist/components/Tooltip/tooltipChrome.d.ts +8 -2
- package/dist/components/bundling/semioticVite.d.ts +24 -0
- package/dist/components/charts/physics/cruciblePhysics.d.ts +2 -2
- package/dist/components/charts/physics/gauntletPhysics.d.ts +2 -6
- package/dist/components/charts/physics/physicsHocUtils.d.ts +8 -1
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +2 -0
- package/dist/components/charts/shared/chartSize.d.ts +58 -0
- package/dist/components/charts/shared/chartSizeDefaults.d.ts +189 -0
- package/dist/components/charts/shared/chartSizeDefaultsAtlas.d.ts +9 -0
- package/dist/components/charts/shared/chartSizeDefaultsNetwork.d.ts +29 -0
- package/dist/components/charts/shared/chartSizeDefaultsOrdinal.d.ts +13 -0
- package/dist/components/charts/shared/chartSizeDefaultsPhysics.d.ts +41 -0
- package/dist/components/charts/shared/chartSizeDefaultsValue.d.ts +19 -0
- package/dist/components/charts/shared/chartSizeDefaultsXY.d.ts +10 -0
- package/dist/components/charts/shared/networkPerspectiveWireSchema.d.ts +3 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +3 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +4 -0
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +2 -0
- package/dist/components/charts/shared/withChartWrapper.d.ts +6 -2
- package/dist/components/charts/value/BigNumber.d.ts +0 -8
- package/dist/components/charts/xy/minimapLayout.d.ts +10 -0
- package/dist/components/realtime/BinAccumulator.d.ts +5 -2
- package/dist/components/recipes/atlas/dependencyForestChartProps.d.ts +4 -4
- package/dist/components/recipes/atlas/flowCircuitChartProps.d.ts +177 -1
- package/dist/components/recipes/atlas/flowCircuitLayout.d.ts +3 -0
- package/dist/components/recipes/atlas/motifBraidChartProps.d.ts +2 -0
- package/dist/components/recipes/atlas/resolution/BoundaryLoomChart.d.ts +3 -0
- package/dist/components/recipes/atlas/resolution/ComponentCutaway.d.ts +16 -0
- package/dist/components/recipes/atlas/resolution/ResolutionAtlasChart.d.ts +3 -0
- package/dist/components/recipes/atlas/resolution/ResolutionGlyphs.d.ts +15 -0
- package/dist/components/recipes/atlas/resolution/ResolutionReader.d.ts +5 -0
- package/dist/components/recipes/atlas/resolution/appearance.d.ts +58 -0
- package/dist/components/recipes/atlas/resolution/boundaryLoomLayout.d.ts +4 -0
- package/dist/components/recipes/atlas/resolution/chartProps.d.ts +75 -0
- package/dist/components/recipes/atlas/resolution/componentCutawayLayout.d.ts +12 -0
- package/dist/components/recipes/atlas/resolution/cutawayContext.d.ts +23 -0
- package/dist/components/recipes/atlas/resolution/cutawayGraph.d.ts +4 -0
- package/dist/components/recipes/atlas/resolution/cycles.d.ts +7 -0
- package/dist/components/recipes/atlas/resolution/evidence.d.ts +43 -0
- package/dist/components/recipes/atlas/resolution/glyphs.d.ts +40 -0
- package/dist/components/recipes/atlas/resolution/identity.d.ts +4 -0
- package/dist/components/recipes/atlas/resolution/indexGraph.d.ts +32 -0
- package/dist/components/recipes/atlas/resolution/ownership.d.ts +25 -0
- package/dist/components/recipes/atlas/resolution/plan.d.ts +12 -0
- package/dist/components/recipes/atlas/resolution/ports.d.ts +44 -0
- package/dist/components/recipes/atlas/resolution/prepare.d.ts +4 -0
- package/dist/components/recipes/atlas/resolution/project.d.ts +70 -0
- package/dist/components/recipes/atlas/resolution/queries.d.ts +23 -0
- package/dist/components/recipes/atlas/resolution/resolutionAtlasLayout.d.ts +9 -0
- package/dist/components/recipes/atlas/resolution/rules.d.ts +14 -0
- package/dist/components/recipes/atlas/resolution/scene.d.ts +52 -0
- package/dist/components/recipes/atlas/resolution/selection.d.ts +3 -0
- package/dist/components/recipes/atlas/resolution/sets.d.ts +10 -0
- package/dist/components/recipes/atlas/resolution/types.d.ts +401 -0
- package/dist/components/recipes/atlas/resolution/validate.d.ts +4 -0
- package/dist/components/recipes/atlas/resolution/witnesses.d.ts +18 -0
- package/dist/components/recipes/atlas/resolution/worker.d.ts +34 -0
- package/dist/components/recipes/lineageDag.d.ts +4 -0
- package/dist/components/recipes/recipeUtils.d.ts +2 -0
- package/dist/components/recipes/transitDiagram.d.ts +2 -61
- package/dist/components/recipes/transitDiagramTypes.d.ts +65 -0
- package/dist/components/semiotic-ai.d.ts +2 -0
- package/dist/components/semiotic-experimental-network-resolution-react.d.ts +12 -0
- package/dist/components/semiotic-experimental-network-resolution.d.ts +13 -0
- package/dist/components/semiotic-geo.d.ts +1 -1
- package/dist/components/semiotic-network-perspective-core.d.ts +6 -0
- package/dist/components/semiotic-network.d.ts +1 -1
- package/dist/components/semiotic-ordinal.d.ts +1 -1
- package/dist/components/semiotic-physics.d.ts +1 -1
- package/dist/components/semiotic-realtime-core.d.ts +1 -1
- package/dist/components/semiotic-realtime-react.d.ts +2 -0
- package/dist/components/semiotic-utils-core.d.ts +3 -1
- package/dist/components/semiotic-vite.d.ts +2 -0
- package/dist/components/semiotic-xy.d.ts +3 -1
- package/dist/components/semiotic.d.ts +3 -1
- package/dist/components/server/renderToStaticSVG.d.ts +2 -1
- package/dist/components/server/serverChartConfigShared.d.ts +2 -0
- package/dist/components/store/LinkedCrosshairStore.d.ts +43 -11
- package/dist/components/store/themeCore.d.ts +2 -0
- package/dist/components/stream/frameKeyboardNavigation.d.ts +3 -1
- package/dist/components/stream/hoverUtils.d.ts +5 -0
- package/dist/components/stream/networkCustomLayout.d.ts +3 -0
- package/dist/components/stream/networkPerspective.d.ts +2 -0
- package/dist/components/stream/networkPerspectiveFit.d.ts +12 -1
- package/dist/components/stream/networkPerspectiveSolid.d.ts +1 -1
- package/dist/components/stream/networkSceneTypes.d.ts +4 -0
- package/dist/components/stream/networkTypes.d.ts +2 -0
- package/dist/components/stream/pipelineConfig.d.ts +2 -0
- package/dist/components/stream/pipelineDomainResolution.d.ts +4 -1
- package/dist/components/stream/types.d.ts +2 -0
- package/dist/components/stream/useFrame.d.ts +2 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +2 -0
- package/dist/controls.module.min.js +31 -31
- package/dist/geo.min.js +150 -150
- package/dist/geo.module.min.js +31 -31
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.module.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.d.ts +2 -0
- package/dist/semiotic-ai.module.min.js +13 -13
- package/dist/semiotic-artifact-react.module.min.js +4 -4
- package/dist/semiotic-artifact.min.js +1 -1
- package/dist/semiotic-artifact.module.min.js +1 -1
- package/dist/semiotic-atlas-selection.module.min.js +1 -1
- package/dist/semiotic-atlas.module.min.js +10 -12
- package/dist/semiotic-client-cjs-shared.min.js +1078 -925
- package/dist/semiotic-client-glyph.module.min.js +2 -2
- package/dist/semiotic-client-shared.module.min.js +1 -1
- package/dist/semiotic-experimental-auxiliary.module.min.js +8 -9
- package/dist/semiotic-experimental-network-resolution-react.d.ts +12 -0
- package/dist/semiotic-experimental-network-resolution-react.min.js +2 -0
- package/dist/semiotic-experimental-network-resolution-react.module.min.js +89 -0
- package/dist/semiotic-experimental-network-resolution.d.ts +13 -0
- package/dist/semiotic-experimental-network-resolution.min.js +2 -0
- package/dist/semiotic-experimental-network-resolution.module.min.js +2 -0
- package/dist/semiotic-experimental-node-auxiliary.module.min.js +9 -10
- package/dist/semiotic-geo.d.ts +1 -1
- package/dist/semiotic-line.module.min.js +1 -1
- package/dist/semiotic-network-perspective-core.d.ts +6 -0
- package/dist/semiotic-network-perspective-core.min.js +1 -0
- package/dist/semiotic-network-perspective-core.module.min.js +1 -0
- package/dist/semiotic-network-perspective.module.min.js +1 -1
- package/dist/semiotic-network-placement.min.js +4 -0
- package/dist/semiotic-network-placement.module.min.js +4 -0
- package/dist/semiotic-network-zoom.module.min.js +1 -1
- package/dist/semiotic-network.d.ts +1 -1
- package/dist/semiotic-ordinal.d.ts +1 -1
- package/dist/semiotic-physics.d.ts +1 -1
- package/dist/semiotic-realtime-core.d.ts +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-realtime-react.d.ts +2 -0
- package/dist/semiotic-realtime-react.module.min.js +1 -1
- package/dist/semiotic-recipes-core-cjs-base.min.js +101 -106
- package/dist/semiotic-recipes-core.module.min.js +75 -76
- package/dist/semiotic-server-edge-node.module.min.js +391 -392
- package/dist/semiotic-server-edge.min.js +387 -388
- package/dist/semiotic-server-edge.module.min.js +371 -371
- package/dist/semiotic-server-node.min.js +387 -388
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-utils-core.d.ts +3 -1
- package/dist/semiotic-utils-core.min.js +12 -11
- package/dist/semiotic-utils-core.module.min.js +12 -11
- package/dist/semiotic-value.module.min.js +4 -4
- package/dist/semiotic-vite.d.ts +2 -0
- package/dist/semiotic-vite.min.js +1 -0
- package/dist/semiotic-vite.module.min.js +1 -0
- package/dist/semiotic-xy.d.ts +3 -1
- package/dist/semiotic.d.ts +3 -1
- package/dist/semiotic.module.min.js +12 -12
- package/dist/server.min.js +387 -388
- package/dist/server.module.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +42 -13
- package/dist/c-2AB65V3L.min.js +0 -1
- package/dist/c-2U5JMOPN.min.js +0 -88
- package/dist/c-3DCTIRW4.min.js +0 -1
- package/dist/c-3OKFRTYM.min.js +0 -1
- package/dist/c-3VZHOPFW.min.js +0 -1
- package/dist/c-4ZSQIBC7.min.js +0 -1
- package/dist/c-5M4RUS7V.min.js +0 -34
- package/dist/c-6O5WWP7F.min.js +0 -1
- package/dist/c-73TOIYIW.min.js +0 -48
- package/dist/c-AE4M7BWH.min.js +0 -1
- package/dist/c-AEIK2NFW.min.js +0 -30
- package/dist/c-AFQSEIZ4.min.js +0 -4
- package/dist/c-BBX7DVVB.min.js +0 -51
- package/dist/c-CNYFCSG4.min.js +0 -5
- package/dist/c-E6QH2WYE.min.js +0 -1
- package/dist/c-GOMQWQJR.min.js +0 -1
- package/dist/c-GTYG4PDT.min.js +0 -1
- package/dist/c-H23GIKTK.min.js +0 -1
- package/dist/c-HQLUUSRJ.min.js +0 -1
- package/dist/c-HXUOFDSD.min.js +0 -64
- package/dist/c-L3LKYOLK.min.js +0 -1
- package/dist/c-MIKDFGKH.min.js +0 -1
- package/dist/c-OYSPTIAG.min.js +0 -1
- package/dist/c-PWPJNYQP.min.js +0 -1
- package/dist/c-QZ5SWKHC.min.js +0 -392
- package/dist/c-RXJH4IRX.min.js +0 -41
- package/dist/c-SN2D6QMH.min.js +0 -1
- package/dist/c-U5YGK6HL.min.js +0 -1
- package/dist/c-VIN5ASK2.min.js +0 -37
- package/dist/c-XZ3GASUJ.min.js +0 -1
- package/dist/c-ZLZZTH4I.min.js +0 -118
package/dist/c-RXJH4IRX.min.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
function e(e){let{nodes:t,edges:i,inferNodes:o=!0,sourceAccessor:n="source",targetAccessor:a="target",colorBy:r,colorScheme:l,showLegend:s,legendPosition:d,legendInteraction:c,frameLegend:u,selection:g,linkedHover:m,onObservation:h,onClick:f,mobileInteraction:p,mobileSemantics:b,chartType:y,chartId:v,marginDefaults:k,userMargin:S,width:w,height:x,hasTitle:M,loading:T,loadingContent:P,emptyContent:C,emptyDataKey:A="edges"}=e,I=Ii(()=>li(i),[i]),O=Ii(()=>li(t),[t]),N=void 0===t&&void 0===i,[H,L]=Oi([]),B=Ai(e=>{L(t=>t.length===e.length&&t.every((t,i)=>t===e[i])?t:e)},[]),D=ci(T,w,x,P),E=D?null:di("nodes"===A?void 0===t?void 0:O:void 0===i?void 0:I,w,x,C),F=Ii(()=>o?Pt(O,I,n,a):O,[o,O,I,n,a]),R=Zt(),z=Ii(()=>Array.isArray(l)&&l.length>0?l:[...vi(l,R,yi)],[l,R]),W=Ii(()=>pi(F,r),[F,r]),$=Ii(()=>N&&H.length>0?H:W,[N,H,W]),j=Ii(()=>N?$.map(e=>({[Ni]:e})):F,[N,$,F]),_=Jt(j,N&&r?Ni:r,l),Y=Kt(c,r,$),{legend:X,margin:G,legendPosition:q,legendMarginReserved:V}=Vt({data:F,colorBy:r,colorScale:_,showLegend:s,legendPosition:d,userMargin:S,defaults:k,categories:$,chartWidth:w,chartHeight:x,frameLegend:u,hasTitle:M}),K=Ii(()=>{let e={};return X&&V&&(e.__legendMarginReservedFor=X),N&&r&&(e.legendCategoryAccessor=r,e.onCategoriesChange=B),e},[X,V,N,r,B]),Q=Ii(()=>gi(p,{width:w,mobileSemantics:b}),[p,w,b]),U=ei({selection:g,linkedHover:m,fallbackFields:r?["string"==typeof r?r:""]:[],unwrapData:!0,onObservation:h,onClick:f,mobileInteraction:Q,chartType:y,chartId:v}),{customHoverBehavior:Z,customClickBehavior:J,activeSelectionHook:ee,hoverSelectionHook:te,crosshairSourceId:ie}=U,oe=Ii(()=>te||(Y.legendSelectionHook?Y.legendSelectionHook:ee),[te,Y.legendSelectionHook,ee]),ne=Et(g);return{safeNodes:F,safeEdges:I,colorScale:_,effectivePalette:z,themeCategorical:R,allCategories:$,legendState:Y,legend:X,margin:G,legendPosition:q,legendBehaviorProps:K,mobileInteraction:Q,customHoverBehavior:Z,customClickBehavior:J,activeSelectionHook:ee,hoverSelectionHook:te,effectiveSelectionHook:oe,resolvedSelection:ne,crosshairSourceId:ie,loadingEl:D,emptyEl:E}}function t(e="static"){return Yi[e]??Yi.static}function i(e){return"fatal"===e.severity||"warn"===e.severity?e.severity:Xi.has(e.kind)?"fatal":"warn"}function o(e){let t=[],o=[];for(let n of e)"fatal"===i(n)?t.push(n):o.push(n);return{fatal:t,warnings:o}}function n(e,i,o,n={}){let a=t(n.usageMode??"static"),r=[],l=/* @__PURE__ */new Set;for(let t of e)l.has(t.id)&&r.push({kind:"duplicate-node",id:t.id,severity:a.duplicateIds}),l.add(t.id);let s=/* @__PURE__ */new Set,d=Array.isArray(o)&&2===o.length,c=d&&Number.isFinite(o[0])&&Number.isFinite(o[1]),u=c&&o[0]<=o[1];(!d||!c||!u)&&r.push({kind:"invalid-domain"});for(let 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[0]<=t.xExtent[1]||r.push({kind:"invalid-node-time",id:t.id}));for(let e of i)s.has(e.id)&&r.push({kind:"duplicate-edge",id:e.id,severity:a.duplicateIds}),s.add(e.id),l.has(e.source)||r.push({kind:"missing-node",id:e.id,endpoint:"source",nodeId:e.source}),l.has(e.target)||r.push({kind:"missing-node",id:e.id,endpoint:"target",nodeId:e.target}),Number.isFinite(e.startTime)&&Number.isFinite(e.endTime)?((null!=e.systemInTime&&!Number.isFinite(e.systemInTime)||null!=e.systemOutTime&&!Number.isFinite(e.systemOutTime))&&r.push({kind:"invalid-system-time",id:e.id,severity:"warn"}),(!Number.isFinite(e.value)||e.value<=0)&&r.push({kind:"invalid-value",id:e.id}),e.endTime<e.startTime&&r.push({kind:"backward-edge",severity:"fatal",id:e.id,source:e.source,target:e.target})):r.push({kind:"invalid-edge-time",id:e.id});return r}function a(e,i,o="static"){if("strip"!==t(o).invalidSystemTime)return e;let n=new Set(i.filter(e=>"invalid-system-time"===e.kind).map(e=>e.id));return 0===n.size?e:e.map(e=>{if(!n.has(e.id))return e;let t={...e};return null!=t.systemInTime&&!Number.isFinite(t.systemInTime)&&delete t.systemInTime,null!=t.systemOutTime&&!Number.isFinite(t.systemOutTime)&&delete t.systemOutTime,t})}function r(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`:"duplicate-node"===e.kind?`node id "${e.id}" is duplicated`:"duplicate-edge"===e.kind?`edge id "${e.id}" is duplicated`:"invalid-system-time"===e.kind?`edge ${e.id} has an invalid systemInTime or systemOutTime`:e.kind}function l(e){if(!e?.layoutQuality)return[];let t=[],i=e.layoutQuality,o=e.layoutQualityBefore;e.compressedPadding&&t.push({severity:"warning",code:"PROCESS_SANKEY_COMPRESSED_PADDING",message:"Lane gaps were compressed to fit peaks into the plot height.",fix:'Increase height, lower maxValueScale, use packing="reuse", or reduce concurrent peaks.'}),i.transitOcclusion>=Gi&&t.push({severity:"warning",code:"PROCESS_SANKEY_HIGH_TRANSIT",message:`High transit occlusion (${i.transitOcclusion.toFixed(1)}) — ribbons cross dense intermediate lanes.`,fix:'Try laneOrder="crossing-min+inside-out", packing="reuse", or lanePlacement="hug" with a modest maxValueScale.'}),i.verticalUtilization>=qi&&t.push({severity:"warning",code:"PROCESS_SANKEY_HIGH_UTILIZATION",message:`Lane utilization is ${Math.round(100*i.verticalUtilization)}% of plot height.`,fix:"Increase chart height or cap band scale with maxValueScale."});let n=e.crossingsAfter??i.crossings;return null!=n&&n>=Vi&&t.push({severity:"warning",code:"PROCESS_SANKEY_RESIDUAL_CROSSINGS",message:`Ordering left ${n} edge-pair crossings`+(o?` (from ${o.crossings})`:"")+".",fix:'Prefer laneOrder="crossing-min" or "crossing-min+inside-out"; check for unavoidable fan-outs.'}),t}function s(e){if(!e?.layoutQuality)return null;let t=e.layoutQuality,i=e.layoutQualityBefore,o=e.crossingsAfter??t.crossings;return[`ProcessSankey layout uses ${e.slots?.length??"?"} packed lane(s).`,null!=o?`Edge-pair crossings ${i?`${i.crossings} → `:""}${o}.`:null,`Pixel path length ${i?`${Math.round(i.pixelLength)} → `:""}${Math.round(t.pixelLength)}.`,`Transit occlusion ${i?`${i.transitOcclusion.toFixed(1)} → `:""}${t.transitOcclusion.toFixed(1)}.`,`Lane utilization ${Math.round(100*t.verticalUtilization)}%.`,e.compressedPadding?"Lane gaps were compressed to fit the plot.":null].filter(Boolean).join(" ")}function d(e){let t=[],i=e.domain,o=Array.isArray(i)?Wt(i[0]):NaN,n=Array.isArray(i)?Wt(i[1]):NaN;null==i?t.push({severity:"error",code:"PROCESS_SANKEY_MISSING_DOMAIN",message:"ProcessSankey requires domain: [tStart, tEnd].",fix:"Pass domain={[start, end]} using numbers, Dates, numeric strings, or ISO date strings."}):(!Array.isArray(i)||2!==i.length||!Number.isFinite(o)||!Number.isFinite(n)||o>n)&&t.push({severity:"error",code:"PROCESS_SANKEY_BAD_DOMAIN",message:"domain must be a 2-tuple of finite times with start <= end.",fix:"Use domain={[t0, t1]} with t0 <= t1."});let a=e.edges;if(Array.isArray(a)&&a.length>0){let e=a[0];(null==e.startTime||null==e.endTime)&&t.push({severity:"warning",code:"PROCESS_SANKEY_EDGE_TIMES",message:"Edges should carry startTime and endTime for temporal layout.",fix:"Add startTime/endTime fields or set startTimeAccessor/endTimeAccessor."})}let r=e.nodes,l=Array.isArray(r)?r.length:0;return!0===e.showLabels&&l>=24&&t.push({severity:"warning",code:"PROCESS_SANKEY_LABEL_DENSITY",message:`showLabels={true} with ${l} nodes may overcrowd the plot.`,fix:'Use showLabels="auto" with optional labelPriorityAccessor / maxLabels.'}),(Array.isArray(a)?a.length:0)>=80&&null==e.layoutExecution&&"off"!==e.packing&&t.push({severity:"warning",code:"PROCESS_SANKEY_WORKER_HINT",message:"Dense ProcessSankey layouts benefit from worker packing/order.",fix:'layoutExecution defaults to "auto"; set layoutExecution="worker" or raise layoutWorkerThreshold deliberately.'}),t}function c(e,t,i,o={}){let n=!1!==o.inferOpeningStock,a=[];for(let t of i){let i=Number(t.value);if(!Number.isFinite(i))continue;let o=Number(t.endTime);t.target===e&&Number.isFinite(o)&&a.push({time:o,delta:i});let n=Number(t.startTime);if(t.source===e&&Number.isFinite(n)&&a.push({time:n,delta:-i}),t.target===e&&null!=t.systemOutTime){let e=Number(t.systemOutTime);Number.isFinite(e)&&a.push({time:e,delta:-i})}}a.sort((e,t)=>e.time-t.time||t.delta-e.delta);let r=0,l=0,s=0;for(let e of a)r+=e.delta,l=Math.min(l,r),e.time<=t&&(s+=e.delta);return n?s-l:s}function u(e){return Wt(e)}function g(e){return $t(e)}function m(e,t){if(!Number.isFinite(e))return"";if(!t)return String(e);let i=new Date(e);if(!Number.isFinite(i.getTime()))return"";let o=i.toISOString();return o.endsWith("T00:00:00.000Z")?o.slice(0,-14):o.replace(/\.000Z$/,"Z")}function h(e,t){let i=0,o=e.length-1,n=-1;for(;i<=o;){let a=i+o>>>1;e[a].at<=t?(n=a,i=a+1):o=a-1}return n<0?{at:t,before:0,after:0}:e[n]}function f(e,t=0){if(0===e.length)return{adjacentClearance:[],positions:[]};let i=[],o=[0];for(let n=0;n<e.length-1;n++){let a=e[n],r=e[n+1],l=[.../* @__PURE__ */new Set([...a.map(e=>e.at),...r.map(e=>e.at)])].sort((e,t)=>e-t),s=0;for(let e of l){let t=h(a,e),i=h(r,e);s=Math.max(s,t.after+i.before)}i.push(s),o.push(o[o.length-1]+s+t)}return{adjacentClearance:i,positions:o}}function p(e,t,i,o={}){let n=[...e];if(n.length<=1)return n;let a=[...n],r=i(n),l=1,s=Math.max(0,o.passes??6),d=Math.max(1,o.maxEvaluations??1/0);for(let e=0;e<s&&l<d;e++){let e=new Map(n.map((e,t)=>[e,t])),s=/* @__PURE__ */new Map,d=/* @__PURE__ */new Map;for(let i of t){let t=e.get(i.source),o=e.get(i.target);if(null==t||null==o)continue;let n=Number.isFinite(i.weight)&&i.weight>0?i.weight:1;s.set(i.source,(s.get(i.source)??0)+o*n),d.set(i.source,(d.get(i.source)??0)+n),s.set(i.target,(s.get(i.target)??0)+t*n),d.set(i.target,(d.get(i.target)??0)+n)}n=n.map((e,t)=>({item:e,index:t,barycenter:(s.get(e)??t)/(d.get(e)??1)})).sort((e,t)=>e.barycenter-t.barycenter||(o.compare?.(e.item,t.item)??e.index-t.index)).map(e=>e.item);let c=i(n);if(l++,c<r)r=c,a=[...n];else if(c===r)break}return a}function b(e,t,i={}){let o=[...e];if(o.length<=1)return o;let n=t(o),a=1,r=Math.max(0,i.passes??6),l=Math.max(1,i.maxEvaluations??1/0);for(let e=0;e<r&&a<l;e++){let e=!1;for(let i=0;i<o.length-1&&a<l;i++){[o[i],o[i+1]]=[o[i+1],o[i]];let r=t(o);a++,r<n?(n=r,e=!0):[o[i],o[i+1]]=[o[i+1],o[i]]}if(!e)break}return o}function y(e,t,i={}){let o=[...e],n=o.length;if(n<=1||n>(i.maxItems??8))return o;let a=Math.max(1,i.maxEvaluations??1/0),r=0,l=[...o],s=1/0,d=()=>{if(r>=a)return;let e=t(o);r++,e<s&&(s=e,l=[...o])};d();let c=new Array(n).fill(0),u=0;for(;u<n&&r<a;)if(c[u]<u){let e=u%2==0?0:c[u];[o[e],o[u]]=[o[u],o[e]],d(),c[u]++,u=0}else c[u]=0,u++;return l}function v(){/* @__PURE__ */
|
|
2
|
-
return Object.create(null)}function k(e,t){return e<t?-1:e>t?1:0}function S(e){return e.occupants.map(e=>e.id).sort(k).join("\0")}function w(e,t,i=0){return e.slice(0,-1).map((o,n)=>{let a=e[n+1];return null!=o.group&&o.group===a.group?i:t})}function x(e,t){return e.map(e=>{let i=/* @__PURE__ */new Map;for(let o of e.occupants){let e=t[o.id];if(e)for(let t of e.samples){let e=i.get(t.t)??{before:0,after:0},o=t.boundaryOffset??0;i.set(t.t,{before:Math.max(e.before,t.topMass-o),after:Math.max(e.after,t.botMass+o)})}}return[...i].sort((e,t)=>e[0]-t[0]).map(([e,t])=>({at:e,...t}))})}function M(e,t,i){return f(x([e,t],i)).adjacentClearance[0]??0}function T(e,t,i){if(0===e.length)return[];let{padding:o,plotH:n,valueScale:a}=i,r=i.stackValueScale??a,l=w(e,o,i.groupPadding??0),s=[o+e[0].peak.topPeak*r];for(let i=1;i<e.length;i++)s.push(s[i-1]+t[i-1]*r+l[i-1]);let d=s[s.length-1]+e[e.length-1].peak.botPeak*r+o;if(d>n&&d>0){let e=n/d;for(let t=0;t<s.length;t++)s[t]*=e}return s}function P(e,t){let i=(e.boundaryOffset??0)*t,o=e.value*t;if("out"===e.kind){let n=e.sideMassBefore*t;return i+("top"===e.side?o/2-n:n-o/2)}let n=e.sideMassAfter*t;return i+("top"===e.side?o/2-n:n-o/2)}function C(e,t,i,o,n,a,r){let l=e.length;if(0===l)return[];let{padding:s,plotH:d,valueScale:c}=r,u=w(e,s,r.groupPadding??0),g=n.map((e,t)=>e*c+u[t]),m=s+e[0].peak.topPeak*c,h=d-s-e[l-1].peak.botPeak*c;if(h-m<=g.reduce((e,t)=>e+t,0)+1e-6)return T(e,n,r);let f=1===l?[(m+h)/2]:[...a];for(let e=0;e<12;e++){let e=new Array(l).fill(0),n=new Array(l).fill(0);for(let a of i){let i=t[a.source],r=t[a.target];if(null==i||null==r||i===r)continue;let l=o[a.source]?.localAttachments.get(a.id),s=o[a.target]?.localAttachments.get(a.id);if(!l||!s)continue;let d=a.value>0&&Number.isFinite(a.value)?a.value:1,u=P(l,c),g=P(s,c);e[i]+=(f[r]+g-u)*d,n[i]+=d,e[r]+=(f[i]+u-g)*d,n[r]+=d}let a=f.map((t,i)=>0===n[i]?t:.45*t+e[i]/n[i]*.55),r=jt({desired:a,minGaps:g,weights:n.map(e=>Math.max(1,e)),min:m,max:h}),s=0;for(let e=0;e<l;e++)s=Math.max(s,Math.abs(r[e]-f[e]));if(f=r,s<.01)break}return f}function A(e,t,i,o,n,a){let r=a.adjacentClearance?[...a.adjacentClearance]:f(x(o,i)).adjacentClearance,l=T(o,r,a),s="hug"===a.lanePlacement?C(o,n,t,i,r,l,a):[...l];if("hug"===a.lanePlacement){let i=t=>{let i=v();for(let o of e)i[o.id]=t[n[o.id]];return i};I(i(s),t)>I(i(l),t)+1e-6&&(s=[...l])}let d=v();for(let t of e)d[t.id]=s[n[t.id]];let c=1/0,u=-1/0;for(let t of e){let e=d[t.id],o=i[t.id];!Number.isFinite(e)||!o||(c=Math.min(c,e-o.topPeak*a.valueScale),u=Math.max(u,e+o.botPeak*a.valueScale))}return{adjacentClearance:r,centerlines:d,slotCenter:s,stackCenter:l,verticalUtilization:Number.isFinite(c)&&Number.isFinite(u)&&a.plotH>0?Math.max(0,Math.min(1,(u-c)/a.plotH)):0}}function I(e,t){let i=0;for(let o of t){let t=e[o.source],n=e[o.target];Number.isFinite(t)&&Number.isFinite(n)&&(i+=Math.abs(t-n)*(o.value>0?o.value:1))}return i}function O(e,t){let i=e?.samples;if(!i||0===i.length||t<i[0].t)return{top:0,bot:0};let o=0,n=i.length-1,a=0;for(;o<=n;){let e=o+n>>>1;i[e].t<=t?(a=e,o=e+1):n=e-1}let r=i[a].boundaryOffset??0;return{top:i[a].topMass-r,bot:i[a].botMass+r}}function N(e,t,i,o,n){let a=1-n;return a*a*a*e+3*a*a*n*t+3*a*n*n*i+n*n*n*o}function H(e,t){let i=0,o=1;for(let n=0;n<28;n++){let n=(i+o)/2;N(0,t,t,1,n)<e?i=n:o=n}return(i+o)/2}function L(e,t,i){let o=t+P(e,i),n=e.value*i/2;return[o-n,o+n]}function B(e,t,i,o){return Math.max(0,Math.min(t,o)-Math.max(e,i))/Math.max(1e-9,t-e)}function D(e,t,i,o,n,a,r){let{valueScale:l,domain:s,mode:d="quality"}=r,c="source"===r.ribbonLane?.85:"target"===r.ribbonLane?.15:.5,u=0;for(let r of e){let e=o[r.source],g=o[r.target];if(null==e||null==g||Math.abs(e-g)<2)continue;let m=t[r.source]?.localAttachments.get(r.id),h=t[r.target]?.localAttachments.get(r.id);if(!m||!h)continue;let f=Math.max(r.startTime,s?.[0]??-1/0),p=Math.min(r.endTime,s?.[1]??1/0);if(!(p>f))continue;let[b,y]=L(m,n[r.source],l),[v,k]=L(h,n[r.target],l),S=Math.min(e,g)+1,w=Math.max(e,g)-1;for(let e=S;e<=w;e++){let o=i[e];if(!o)continue;let s=[f,p];if("quality"===d)for(let e of o.occupants)for(let i of t[e.id]?.samples??[])i.t>f&&i.t<p&&s.push(i.t);let g=e=>{let i=H((e-f)/(p-f),c),s=N(b,b,v,v,i),d=N(y,y,k,k,i),u=0;for(let i of o.occupants){if(i.id===r.source||i.id===r.target)continue;let o=a[i.id];if(null!=o?.start&&e<o.start||null!=o?.end&&e>o.end)continue;let c=O(t[i.id],e),g=n[i.id];u=Math.max(u,B(s,d,g-c.top*l,g+c.bot*l))}return u},m=[...new Set(s)].sort((e,t)=>e-t),h=0;for(let e=0;e<m.length-1;e++){let t=m[e],i=m[e+1]-t;h+=(g(t+.25*i)+g(t+.5*i)+g(t+.75*i))/3*i}u+=h/(p-f)*(r.value>0?r.value:1)}}return u}function E(e,t,i,o,n,a,r,l,s,d,c="both",u){return{crossings:e,weightedLength:t,pixelLength:I(r,i),transitOcclusion:D(i,o,n,a,r,l,{valueScale:s,ribbonLane:c,domain:u,mode:"quality"}),verticalUtilization:d}}function F(e,t){return t?Math.max(t[0],Math.min(t[1],e)):e}function R(e,t){return e.map(e=>({t:F(e.t,t),topMass:e.topMass,botMass:e.botMass,...null!=e.boundaryOffset&&{boundaryOffset:e.boundaryOffset}}))}function z(e,t,i){let o=t+(e.boundaryOffset??0)*i,n=e.value*i;if("out"===e.kind){let t=e.sideMassBefore*i;if("top"===e.side){let e=o-t;return[e,e+n]}let a=o+t;return[a-n,a]}let a=e.sideMassAfter*i;if("top"===e.side){let e=o-a;return[e,e+n]}let r=o+a;return[r-n,r]}function W(e,t,i,o,n){if(0===e.length)return null;let a=R(e,n),r=e=>t+(a[e].boundaryOffset??0)*i,l=e=>r(e)-a[e].topMass*i,s=e=>r(e)+a[e].botMass*i,d=`M${o(a[0].t)},${l(0)}`;for(let e=1;e<a.length;e++)d+=` L${o(a[e].t)},${l(e)}`;d+=` L${o(a[a.length-1].t)},${s(a.length-1)}`;for(let e=a.length-2;e>=0;e--)d+=` L${o(a[e].t)},${s(e)}`;return d+" Z"}function $(e,t,i,o,n,a){let r=i.nodeData[e];if(!r||0===r.samples.length)return[];let l=i.valueScale,s=i.centerlines[e],d=R(r.samples,n),c=d.find(e=>e.topMass+e.botMass>0)||d[0],u=[...d].reverse().find(e=>e.topMass+e.botMass>0)||d[d.length-1],g=o(c.t),m=o(u.t),h=e=>o(F(e,n)),f=[],p=(e,t,i,o)=>`M${e},${t} L${i},${t} L${i},${o} L${e},${o} Z`;for(let i of t){if(i.source===e&&null!=i.systemInTime&&Number.isFinite(i.systemInTime)){let e=r.localAttachments.get(i.id),t=a?.get(i.id)??i.startTime;if(e&&"out"===e.kind&&i.systemInTime<t){let o=h(i.systemInTime),a=h(t),r=null!=n&&i.systemInTime<n[0],d=r?o:o-20,c=r?Math.min(a,o+20):o,u=Math.max(g,d);if(a>u){let[t,i]=z(e,s,l);f.push({pathD:p(u,t,a,i),x0:d,x1:c,from:0,to:1})}}}if(i.target===e&&null!=i.systemOutTime&&Number.isFinite(i.systemOutTime)){let e=r.localAttachments.get(i.id);if(e&&"in"===e.kind&&i.systemOutTime>i.endTime){let t=h(i.systemOutTime),o=h(i.endTime),n=t+20,a=Math.min(m,n);if(a>o){let[i,r]=z(e,s,l);f.push({pathD:p(o,i,a,r),x0:t,x1:n,from:1,to:0})}}}}return f}function j(e,t){let i=v(),o=v();for(let t of e)i[t.id]=[],o[t.id]=[];for(let e of t)o[e.source]&&o[e.source].push(e),i[e.target]&&i[e.target].push(e);return{incoming:i,outgoing:o}}function _(e,t,i,o="temporal"){let n="temporal"===o?(e,t)=>e.endTime-t.endTime||k(e.id,t.id):(e,t)=>t.value-e.value||k(e.id,t.id),a="temporal"===o?(e,t)=>e.startTime-t.startTime||k(e.id,t.id):(e,t)=>t.value-e.value||k(e.id,t.id),r=/* @__PURE__ */new Map;for(let e of t)r.set(e.id,{});let l=(e,t)=>{let i=/* @__PURE__ */new Map;for(let o of e){let e=o[t];i.has(e)||i.set(e,{partner:e,edges:[],total:0,earliestStart:1/0,latestEnd:-1/0});let n=i.get(e);n.edges.push(o),n.total+=o.value,n.earliestStart=Math.min(n.earliestStart,o.startTime),n.latestEnd=Math.max(n.latestEnd,o.endTime)}let r=[...i.values()];"temporal"===o?r.sort((e,i)=>"target"===t?e.earliestStart-i.earliestStart||k(e.partner,i.partner):e.latestEnd-i.latestEnd||k(e.partner,i.partner)):r.sort((e,t)=>t.total-e.total||k(e.partner,t.partner));for(let e of r)e.edges.sort("target"===t?a:n);return r};for(let t of e){let e=i.outgoing[t.id],o=i.incoming[t.id];if(0===o.length)l(e,"target").forEach((e,t)=>{let i=t%2==0?"top":"bot";for(let t of e.edges)r.get(t.id).sourceSide=i});else if(0===e.length)l(o,"source").forEach((e,t)=>{let i=t%2==0?"top":"bot";for(let t of e.edges)r.get(t.id).targetSide=i});else{let t=l(o,"source"),i=l(e,"target"),n=Math.max(t.length,i.length);for(let e=0;e<n;e++){let o=e%2==0?"top":"bot";if(t[e])for(let i of t[e].edges)r.get(i.id).targetSide=o;if(i[e])for(let t of i[e].edges)r.get(t.id).sourceSide=o}}}return r}function Y(e,t,i,o,n="temporal"){let a=t.incoming[e.id],r=t.outgoing[e.id],l=[];for(let e of a)l.push({time:e.endTime,delta:+e.value,edge:e,kind:"in",side:i.get(e.id).targetSide});for(let e of r)l.push({time:e.startTime,delta:-e.value,edge:e,kind:"out",side:i.get(e.id).sourceSide});let s={create:0,in:1,"transfer-out":2,"transfer-in":3,out:4},d=(e,t)=>{if(!o||!e.edge||!t.edge||e.kind!==t.kind||e.side!==t.side)return 0;if("out"===e.kind){if(e.edge.target===t.edge.target&&e.edge.endTime===t.edge.endTime)return 0;let i=o.get(e.edge.id)?.target,n=o.get(t.edge.id)?.target;return"number"==typeof i&&Number.isFinite(i)&&"number"==typeof n&&Number.isFinite(n)&&i!==n?"top"===e.side?i-n:n-i:0}if("in"===e.kind){if(e.edge.source===t.edge.source&&e.edge.startTime===t.edge.startTime)return 0;let i=o.get(e.edge.id)?.source,n=o.get(t.edge.id)?.source;return"number"==typeof i&&Number.isFinite(i)&&"number"==typeof n&&Number.isFinite(n)&&i!==n?"top"===e.side?n-i:i-n:0}return 0},c=()=>{l.sort((e,t)=>e.time-t.time||(e.phase??0)-(t.phase??0)||(e.sequence??0)-(t.sequence??0)||(s[e.kind]??99)-(s[t.kind]??99)||d(e,t)||k(e.edge?.id??"",t.edge?.id??"")||k(e.side,t.side)||e.delta-t.delta)},u=l.length?Mi(l.map(e=>e.time)):null,g=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[0])?e.xExtent[0]:null,m=null!=g?g-1:null!=u&&Number.isFinite(u)?u-1:null;c();let h=null,f=0;for(let e of l)e.time!==h&&(h=e.time,f=0),e.sequence=f++;let p=e=>({time:e.time,phase:0,sequence:e.sequence??0}),b=[],y=0,v=0;for(let e of l)if("out"===e.kind){let t=Math.abs(e.delta),i=t-("top"===e.side?y:v);if(i>0){let t="top"===e.side?"bot":"top",o=Math.min(i,"top"===t?y:v);if(o>0){let n=p(e);b.push({...n,delta:-o,kind:"transfer-out",side:t}),b.push({...n,delta:+o,kind:"transfer-in",side:e.side}),"top"===t?y-=o:v-=o,"top"===e.side?y+=o:v+=o,i-=o}i>0&&null!==m&&(b.push({time:m,delta:+i,kind:"create",side:e.side}),"top"===e.side?y+=i:v+=i)}"top"===e.side?y-=t:v-=t}else if("in"===e.kind){let t=Math.abs(e.delta);"top"===e.side?y+=t:v+=t}l.push(...b),c();let S=0,w=0,x=0,M=0,T=0,P=0,C=[],A=/* @__PURE__ */new Map,I=e=>{C.push({t:e,topMass:S,botMass:w,...Math.abs(x)>1e-12&&{boundaryOffset:x}})},O=()=>{M=Math.max(M,S+w),T=Math.max(T,S-x),P=Math.max(P,w+x)};for(let e of l){if("transfer-out"!==e.kind&&"transfer-in"!==e.kind&&I(e.time),("in"===e.kind||"out"===e.kind)&&e.edge){let t="top"===e.side?S:w,i=t+e.delta;A.set(e.edge.id,{side:e.side,time:e.time,sideMassBefore:t,sideMassAfter:i,kind:e.kind,value:Math.abs(e.delta),...Math.abs(x)>1e-12&&{boundaryOffset:x}})}"top"===e.side?S+=e.delta:w+=e.delta,"transfer-in"===e.kind?(x+="top"===e.side?e.delta:-e.delta,O(),I(e.time)):"transfer-out"!==e.kind&&(O(),"out"===e.kind&&S+w<=1e-12&&(x=0),I(e.time))}let N=[],H=0;for(;H<C.length;){let e=H;for(;e+1<C.length&&C[e+1].t===C[H].t;)e++;N.push(C[H]);for(let t=H+1;t<=e;t++){let e=N[N.length-1];(C[t].topMass!==e.topMass||C[t].botMass!==e.botMass||(C[t].boundaryOffset??0)!==(e.boundaryOffset??0))&&N.push(C[t])}H=e+1}let L=Array.isArray(e.xExtent)&&Number.isFinite(e.xExtent[1])?e.xExtent[1]:null,B=null;for(let e of r)null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.systemInTime<e.startTime&&(null===B||e.systemInTime<B)&&(B=e.systemInTime);let D=null;for(let e of a)null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>e.endTime&&(null===D||e.systemOutTime>D)&&(D=e.systemOutTime);if(N.length>0){let e=N[N.length-1],t=Math.max(L??-1/0,D??-1/0);Number.isFinite(t)&&t>e.t&&e.topMass+e.botMass>0&&N.push({t:t,topMass:e.topMass,botMass:e.botMass,...null!=e.boundaryOffset&&{boundaryOffset:e.boundaryOffset}});let i,o=N[0],n=N.find(e=>e.topMass+e.botMass>0),a=1/0;null!=g&&Number.isFinite(g)&&g<o.t&&o.topMass+o.botMass>0&&(a=g,i=o),n&&null!=B&&Number.isFinite(B)&&B<n.t&&B<a&&(a=B,i=n),i&&Number.isFinite(a)&&N.unshift({t:a,topMass:i.topMass,botMass:i.botMass,...null!=i.boundaryOffset&&{boundaryOffset:i.boundaryOffset}})}let E=N;if("max"===n&&null!=g&&null!=L&&L>g){let e,t=0;for(let i of N){let o=i.topMass+i.botMass;o>t&&(t=o,e=i)}if(e){let t={topMass:e.topMass,botMass:e.botMass,...null!=e.boundaryOffset&&{boundaryOffset:e.boundaryOffset}};E=[...N.filter(e=>e.t<g),{t:g,...t},{t:L,...t},...N.filter(e=>e.t>L)]}}return{samples:E,peak:M,topPeak:T,botPeak:P,localAttachments:A}}function X(e,t,i,o){let n=/* @__PURE__ */new Map;for(let a of e){let e=t[a.source]?.localAttachments.get(a.id),r=t[a.target]?.localAttachments.get(a.id),l=i[a.source],s=i[a.target];if(!(e&&r&&Number.isFinite(l)&&Number.isFinite(s)))continue;let d=z(e,l,o),c=z(r,s,o);n.set(a.id,{source:(d[0]+d[1])/2,target:(c[0]+c[1])/2})}return n}function G(e,t){let i=(e,i)=>{for(let o of e){let e=/* @__PURE__ */new Map;for(let n of o){let o=`${("out"===i?t.get(n.id)?.sourceSide:t.get(n.id)?.targetSide)??""}\0${"out"===i?n.startTime:n.endTime}`,a="out"===i?`${n.target}\0${n.endTime}`:`${n.source}\0${n.startTime}`,r=e.get(o);if(null!=r&&r!==a)return!0;e.set(o,a)}}return!1};return i(Object.values(e.outgoing),"out")||i(Object.values(e.incoming),"in")}function q(e,t,i){let o=/* @__PURE__ */new Map,n=[];for(let t of e)n.push({time:t.startTime,kind:"out",edge:t}),n.push({time:t.endTime,kind:"in",edge:t});n.sort((e,t)=>e.time-t.time||(e.kind===t.kind?0:"in"===e.kind?-1:1)||("out"===e.kind?t.edge.value-e.edge.value:0)||k(e.edge.id,t.edge.id));let a=e=>{let t=o.get(e);return t||(t={top:0,bot:0},o.set(e,t)),t},r=(e,t,i)=>{let o="top"===t?"bot":"top",n=Math.min(i,e[t]);e[t]-=n;let a=i-n;a>0&&(e[o]=Math.max(0,e[o]-a))};for(let e of n){let{edge:o}=e;if("in"===e.kind){let e=t.get(o.id)?.targetSide??"bot";a(o.target)[e]+=o.value;continue}let n=a(o.source),l=t.get(o.id),s=l.sourceSide??"bot";if(i[o.source]===i[o.target]){let e=n.top>=o.value,t=n.bot>=o.value;e!==t?s=e?"top":"bot":!e&&!t&&n.top!==n.bot&&(s=n.top>n.bot?"top":"bot"),l.sourceSide=s,l.targetSide=s}r(n,s,o.value)}}function V(e,t,i,o){for(let n of e){let e=t.incoming[n.id],a=t.outgoing[n.id];if(0===e.length||0===a.length)continue;let r=()=>{let t={inTop:0,inBot:0,outTop:0,outBot:0};for(let o of e)"top"===i.get(o.id).targetSide?t.inTop+=o.value:t.inBot+=o.value;for(let e of a)"top"===i.get(e.id).sourceSide?t.outTop+=e.value:t.outBot+=e.value;return t},l=(e,t)=>{let n=r(),l="top"===e?n.outTop-n.inTop:n.outBot-n.inBot,s="top"===t?n.inTop-n.outTop:n.inBot-n.outBot;if(l<=0||s<=0)return!1;let d=Math.min(l,s),c=a.filter(t=>!o.has(t.id)&&i.get(t.id).sourceSide===e&&t.value<=d).sort((e,t)=>t.value-e.value||k(e.id,t.id));return 0!==c.length&&(i.get(c[0].id).sourceSide=t,!0)},s=a.length+1;for(;s-- >0&&(l("top","bot")||l("bot","top")););}}function K(e,t){return e.source!==t.source&&e.target!==t.target&&e.source!==t.target&&e.target!==t.source&&Math.max(e.startTime,t.startTime)<Math.min(e.endTime,t.endTime)}function Q(e){let t=v();return e.forEach((e,i)=>{for(let o of e.occupants)t[o.id]=i}),t}function U(e,t,i){e.splice(0,e.length,...i);let o=Q(i);for(let e of Object.keys(t))delete t[e];Object.assign(t,o)}function Z(e){let t=/* @__PURE__ */new Map,i=[];e.forEach((e,o)=>{if(!e.group)return void i.push({anchor:o,stableId:S(e),slots:[e]});let n=t.get(e.group)??{indexes:[],slots:[]};n.indexes.push(o),n.slots.push(e),t.set(e.group,n)});for(let[e,o]of t)i.push({anchor:o.indexes.reduce((e,t)=>e+t,0)/o.indexes.length,stableId:`${e}\0${o.slots.map(S).join("\0")}`,slots:o.slots});return i.sort((e,t)=>e.anchor-t.anchor||k(e.stableId,t.stableId))}function J(e){return e.some(e=>e.group)?Z(e).flatMap(e=>e.slots):[...e]}function ee(e){let t=/* @__PURE__ */new Set;for(let i of e)if(i.group){if(t.has(i.group))return!0;t.add(i.group)}return!1}function te(e){return e.flatMap(e=>e.slots)}function ie(e,t){let i=/* @__PURE__ */new Map;for(let t of e)for(let e of t.slots)i.set(e,t);let o=/* @__PURE__ */new Map;for(let e of t){let t=i.get(e.source),n=i.get(e.target);if(!t||!n||t===n)continue;let a=Number.isFinite(e.weight)&&e.weight>0?e.weight:1,r=t.stableId<n.stableId?`${t.stableId}\0${n.stableId}`:`${n.stableId}\0${t.stableId}`,l=o.get(r);l?l.weight=(l.weight??0)+a:o.set(r,{source:t,target:n,weight:a})}return[...o.values()]}function oe(e,t,i){let o=/* @__PURE__ */new Map;return e.forEach((e,t)=>{for(let i of e.slots)o.set(i,t)}),e.map((e,n)=>{if(e.slots.length<=1)return e;let a=/* @__PURE__ */new Map;for(let t of e.slots)a.set(t,0);for(let e of t){let t=o.get(e.source),i=o.get(e.target);if(null==t||null==i)continue;let r=Number.isFinite(e.weight)&&e.weight>0?e.weight:1;if(t===n&&i!==n){let t=i>n?1:-1;a.set(e.source,(a.get(e.source)??0)+r*t)}else if(i===n&&t!==n){let i=t>n?1:-1;a.set(e.target,(a.get(e.target)??0)+r*i)}}let r=[...e.slots].sort((e,t)=>(a.get(e)??0)-(a.get(t)??0)||i(e,t));return{...e,slots:r}})}function ne(e,t){e.some(e=>e.group)&&U(e,t,J(e))}function ae(e,t,i=0){return e.crossings<t.crossings||e.crossings===t.crossings&&e.cost<=t.cost+i}function re({order:e,after:t,nodes:i,edges:o,outgoingPartners:n,incomingPartners:a,slotForNode:r,averageGap:l,evaluate:s}){let d=(i,n)=>{let a=[...new Set(n.map(t=>e.indexOf(t)))].sort((e,t)=>e-t),r=e.indexOf(i),d=a[0],c=a[a.length-1];if(a.length<3||!a.includes(r)||c-d+1!==a.length||Math.abs(2*r-d-c)<=1)return;let u=[...e];u.splice(r,1),u.splice(d+c>>1,0,i);let g=J(u),m=s(g),h=new Set(i.occupants.map(e=>e.id)),f=new Set(n.flatMap(e=>e.occupants.map(e=>e.id))),p=o.reduce((e,t)=>h.has(t.source)&&f.has(t.target)||h.has(t.target)&&f.has(t.source)?e+(t.value>0?t.value:1):e,0),b=Math.abs(2*r-d-c)*l*Math.max(1,p);ae(m,t,b)&&(e=g,t=m)};for(let[e,t]of n)!a.has(e)&&t.size>=3&&d(r.get(e),[...t].map(e=>r.get(e)));for(let e of i){let t=r.get(e.id);!e.group&&t.group&&(a.get(e.id)?.size??0)>=3&&d(t,[...a.get(e.id)??[]].map(e=>r.get(e)).filter(e=>e===t||e.group===t.group).filter((e,t,i)=>i.indexOf(e)===t))}return{order:e,after:t}}function le(e,t){let i=[...new Set(Object.values(e))].sort((e,t)=>e-t),o=new Map(i.map((e,t)=>[e,t])),n=new Map(Object.entries(e).map(([e,t])=>[e,o.get(t)]));return new Ui(t,n,i.length).count(i.map((e,t)=>t))}function se(e,t){let i=0;for(let o of t){let t=e[o.source],n=e[o.target];null==t||null==n||(i+=Math.abs(t-n)*(o.value>0?o.value:1))}return i}function de(e){let t=new Array(e.length),i=Math.floor((e.length-1)/2),o=i-1,n=i+1;e.length>0&&(t[i]=e[0]);for(let i=1;i<e.length;i++)i%2==1&&n<e.length?t[n++]=e[i]:o>=0?t[o--]=e[i]:t[n++]=e[i];return t}function ce(e,t,i){let o=i(e),n=o,a=[...e],r=Math.floor((e.length-1)/2);for(let l of t){let t=e.indexOf(l);if(t===r)continue;e.splice(t,1),e.splice(r,0,l);let s=i(e);s<=o?(o=s,s<n&&(a=[...e],n=s)):(e.splice(r,1),e.splice(t,0,l))}return a}function ue(e,t,i,o,n,a,r){let l=[...n],s=new Map(n.map(e=>[e,S(e)])),d=/* @__PURE__ */new Map;for(let e of n)for(let t of e.occupants)d.set(t.id,e);let c=/* @__PURE__ */new Map,u=[];for(let e of t){let t=d.get(e.source),i=d.get(e.target);!t||!i||(c.set(e,[t,i]),t!==i&&u.push({source:t,target:i,weight:e.value}))}let g=t.reduce((e,t)=>e+(t.value>0?t.value:1),0),m=r.plotH/Math.max(1,n.length),h=n.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),f=Math.max(1,g)*(Math.max(1,r.plotH)+m*Math.max(h,n.length)+1e-6*Math.max(1,n.length-1))+1,v=4*m,w={fullCrossing:0,localCrossing:0},x=/* @__PURE__ */new Map,T=(e,t)=>{let o=x.get(e);o||(o=/* @__PURE__ */new Map,x.set(e,o));let n=o.get(t);if(null!=n)return n;let a=M(e,t,i);return o.set(t,a),a},P=new Map(n.map((e,t)=>[e,t])),C=new Ui(t,new Map([...d].map(([e,t])=>[e,P.get(t)])),n.length),O=e=>{let t=new Int32Array(n.length);for(let i=0;i<e.length;i++)t[P.get(e[i])]=i;return t},N=new Map([...c].map(([e,[t,i]])=>[e,{source:P.get(t),target:P.get(i),weight:e.value>0?e.value:1}])),H=[...N.values()],L=/* @__PURE__ */new Map,B=/* @__PURE__ */new Map,E=/* @__PURE__ */new Map,F=(e,t,i)=>{e.has(t)||e.set(t,/* @__PURE__ */new Set),e.get(t).add(i)};for(let e of t)F(L,e.source,e.target),F(B,e.target,e.source),F(E,e.source,e.target),F(E,e.target,e.source);let R=e=>1===L.get(e.source)?.size&&L.get(e.source).has(e.target)||1===E.get(e.source)?.size||1===E.get(e.target)?.size,z=t.flatMap(e=>{if(!R(e))return[];let t=N.get(e);return t&&t.source!==t.target?[t]:[]}),W=e=>{let t=0;for(let i of z)t+=Math.max(0,Math.abs(e[i.source]-e[i.target])-1)*i.weight;return t*v},$=e=>W(O(e)),j=new Int32Array(n.length),_=new Float64Array(n.length),Y=new Float64Array(n.length+1),X=e=>{for(let t=0;t<e.length;t++)j[P.get(e[t])]=t;let t=C.count(j);if(e.length>0){let t=P.get(e[0]);_[t]=r.padding+e[0].peak.topPeak*r.valueScale;for(let t=1;t<e.length;t++){let i=P.get(e[t-1]),o=P.get(e[t]);_[o]=_[i]+T(e[t-1],e[t])*r.valueScale+r.padding}let i=P.get(e[e.length-1]),o=_[i]+e[e.length-1].peak.botPeak*r.valueScale+r.padding;if(o>r.plotH&&o>0){let e=r.plotH/o;for(let t=0;t<_.length;t++)_[t]*=e}}Y[0]=0;for(let t=0;t<e.length;t++)Y[t+1]=Y[t]+e[t].peak.topPeak+e[t].peak.botPeak;let i=0,o=0,n=0;for(let e of H){let t=j[e.source],a=j[e.target];if(i+=Math.abs(t-a)*e.weight,o+=Math.abs(_[e.source]-_[e.target])*e.weight,Math.abs(t-a)>=2){let i=Math.min(t,a)+1,o=Math.max(t,a);n+=(Y[o]-Y[i])*e.weight}}return t*f+o+n*m+W(j)+1e-6*i},G=(e,i)=>{let o=new Array(e.length+1).fill(0);for(let t=0;t<e.length;t++)o[t+1]=o[t]+e[t].peak.topPeak+e[t].peak.botPeak;let n=0;for(let e of t){let t=i[e.source],a=i[e.target];if(null==t||null==a||Math.abs(t-a)<2)continue;let r=Math.min(t,a)+1;n+=(o[Math.max(t,a)]-o[r])*(e.value>0?e.value:1)}return n},q=o=>{let n=Q(o),a=o.slice(0,-1).map((e,t)=>T(e,o[t+1])),l=A(e,t,i,o,n,{plotH:r.plotH,padding:r.padding,valueScale:r.valueScale,lanePlacement:r.lanePlacement??"stack",groupPadding:r.groupPadding,adjacentClearance:a});return{map:n,geometry:l,weightedLength:se(n,t),pixelLength:I(l.centerlines,t)}},V=(e,n,a)=>{let l=n;null==l&&(l=C.count(O(e)),w.fullCrossing++);let{map:s,geometry:d,weightedLength:c,pixelLength:u}=q(e),g=a?D(t,i,e,s,d.centerlines,o,{valueScale:r.valueScale,ribbonLane:r.ribbonLane,domain:r.domain,mode:a}):G(e,s);return{crossings:l,weightedLength:c,pixelLength:u,transitOcclusion:g,cost:l*f+u+g*m+$(e)+1e-6*c}},K=(e,t,i="quality")=>V(e,t,i),ne=[...l],ae=(e,t)=>k(s.get(e),s.get(t)),le=ee(ne),ue=(e,t,i,o=eo)=>{let n=t(e);for(let a=0;a<i&&o>0;a++){let i=!1,r=Array.from({length:e.length-1},(e,t)=>t);a%2==1&&r.reverse();for(let a of r){if(o--<=0)break;let r=e[a],l=e[a+1],s=C.swapDelta(P.get(r),P.get(l),O(e));[e[a],e[a+1]]=[l,r],w.localCrossing+=s.evaluations;let d=t(e,n.crossings+s.delta);d.cost<n.cost?(n=d,i=!0):[e[a],e[a+1]]=[r,l]}if(!i)break}return e},ge=e=>{let t=p(e,u,e=>V(e).cost,{passes:6,compare:ae,maxEvaluations:eo});return ue(t,V,6)},me=e=>{let t=ge(e);if((e.length<=8?Zi(e.length)*(e.length+H.length+C.work):1/0)>Ji)return t;let i=y(e,X,{maxItems:8,maxEvaluations:5e4}),o=K(i),n=K(t);return o.crossings!==n.crossings&&o.crossings<n.crossings?i:t},he=e=>e.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),fe=(e,t)=>he(t)-he(e)||k(e.stableId,t.stableId),pe=(e,t)=>t.peak.topPeak+t.peak.botPeak-(e.peak.topPeak+e.peak.botPeak)||ae(e,t),be="geometry-refine"===r.mode;if(be||"crossing-min"!==r.laneOrder&&"crossing-min+inside-out"!==r.laneOrder?be||"inside-out"!==r.laneOrder||(ne=le?te(de([...Z(ne)].sort(fe))):de([...ne].sort(pe))):ne=le?(e=>{let t=Z(e);if(t.length<=1)return te(t);let i=e=>V(te(e)).cost;if(t=Z(me(e)),t=oe(t,u,ae),t=p(t,ie(t,u),i,{passes:6,compare:(e,t)=>k(e.stableId,t.stableId),maxEvaluations:eo}),t=b(t,i,{passes:8,maxEvaluations:eo}),(t.length<=8?Zi(t.length)*(t.length+H.length+C.work):1/0)<=Ji){let e=y(t,e=>X(te(e)),{maxItems:8,maxEvaluations:5e4}),i=te(e),o=te(t),n=K(i),a=K(o);n.crossings!==a.crossings?t=n.crossings<a.crossings?e:t:n.cost<a.cost&&(t=e)}return t=oe(t,u,ae),te(t)})(ne):me(ne),!be&&"crossing-min+inside-out"===r.laneOrder&&ne.length>1)if(le){let e=Z(ne);ne=te(ce(e,[...e].sort(fe),e=>V(te(e)).cost))}else ne=ce(ne,[...ne].sort(pe),e=>V(e).cost);if((be||"crossing-min"===r.laneOrder||"crossing-min+inside-out"===r.laneOrder)&&ne.length>1)if(le){let e=b(Z(ne),e=>K(te(e),void 0,"score").cost,{passes:6});e=oe(e,u,ae),ne=te(e)}else ue(ne,(e,t)=>K(e,t,"score"),1,1/0);let ye=J(l);ne=J(ne);let ve=K(ne),ke=K(ye);if(be){let e=$(ye),t=$(ne);(ve.crossings>ke.crossings||ve.crossings===ke.crossings&&t>e+1e-9||ve.cost>ke.cost)&&(ne=ye,ve=ke)}else ve.cost>ke.cost&&(ne=ye,ve=ke);let Se=re({order:ne,after:ve,nodes:e,edges:t,outgoingPartners:L,incomingPartners:B,slotForNode:d,averageGap:m,evaluate:K});return ne=Se.order,ve=Se.after,U(n,a,ne),{before:ke,after:ve,initialOrder:l.map(e=>s.get(e)),evaluations:w}}function ge(e,t,i){let o=new Map(i.map((e,t)=>[e,t]));U(e,t,[...e].sort((e,t)=>(o.get(S(e))??1/0)-(o.get(S(t))??1/0)||k(S(e),S(t))))}function me(e,t,i){let o=e.map(e=>{let o=e.occupants.map(e=>({id:e.id,end:i[e.id]?.end??e.end})),n=0,a=0;for(let e of o){let i=t[e.id];n=Math.max(n,i?.topPeak||0),a=Math.max(a,i?.botPeak||0)}return{occupants:o,peak:{topPeak:n,botPeak:a},...null!=e.group?{group:e.group}:{}}}),n=v();return o.forEach((e,t)=>{for(let i of e.occupants)n[i.id]=t}),{slots:o,slotByNode:n}}function he(e,t,i,o){return`${e.map(e=>{let t=i[e.id],n=o[e.id];return[e.id,e.group??"",e.xExtent?.[0]??"",e.xExtent?.[1]??"",t?.topPeak??0,t?.botPeak??0,n?.start??"",n?.end??""].join(":")}).join("|")}#${t.map(e=>[e.id,e.source,e.target,e.value,e.startTime,e.endTime].join(":")).join("|")}`}function fe(e){return to.get(e)}function pe(e,t){for(to.has(e)&&to.delete(e),to.set(e,{slots:t.slots.map(e=>({occupants:e.occupants.map(e=>({...e})),peak:{...e.peak},...null!=e.group?{group:e.group}:{}})),slotByNode:Object.assign(v(),t.slotByNode)});to.size>12;){let e=to.keys().next().value;if(null==e)break;to.delete(e)}}function be(e,t){return null!=e.start&&null!=e.end&&null!=t.start&&null!=t.end&&!(e.end<=t.start||t.end<=e.start)}function ye(e,t){return k(e,t)<=0?`${e}\0${t}`:`${t}\0${e}`}function ve(e){let t=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map;for(let o of e)i.has(o.source)||i.set(o.source,/* @__PURE__ */new Set),t.has(o.target)||t.set(o.target,/* @__PURE__ */new Set),i.get(o.source).add(o.target),t.get(o.target).add(o.source);return{incoming:new Map([...t].map(([e,t])=>[e,t.size])),outgoing:new Map([...i].map(([e,t])=>[e,t.size]))}}function ke(e){let t=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map,o=(e,t,i,o)=>{let n=e.get(t);n||(n=/* @__PURE__ */new Map,e.set(t,n)),n.set(i,(n.get(i)??0)+o)};for(let n of e){let e=n.value>0&&Number.isFinite(n.value)?n.value:1;o(t,n.source,n.target,e),o(i,n.target,n.source,e)}let n=/* @__PURE__ */new Map,a=e=>{if(n.has(e))return;let o=t.get(e),a=i.get(e),r=/* @__PURE__ */new Map;for(let[e,t]of o??[])r.set(e,(r.get(e)??0)+t);for(let[e,t]of a??[])r.set(e,(r.get(e)??0)+t);if(1===r.size){let[t,i]=[...r][0];n.set(e,{partner:t,weight:i})}};for(let t of e)a(t.source),a(t.target);return n}function Se(e,t,i){let o=i.get(e),n=i.get(t);return!o||!n||o.partner===n.partner||o.partner===t||n.partner===e}function we(e,t,i){return!!i.has(e)&&t.some(t=>!Se(e,t,i))}function xe(e,t){return(e.value>0&&Number.isFinite(e.value)?e.value:1)*(1+(1===t.outgoing.get(e.source)?1:0)+(1===t.incoming.get(e.target)?1:0))}function Me(e,t,i,o,n,a){let r=/* @__PURE__ */new Set,l=new Map(e.map(e=>[e,/* @__PURE__ */new Set])),s=new Map(e.map(e=>[e,/* @__PURE__ */new Set]));for(let e of o)r.add(ye(e.source,e.target)),l.get(e.target)?.add(e.source),s.get(e.source)?.add(e.target);let d=/* @__PURE__ */new Map,c=/* @__PURE__ */new Set,u=(e,t)=>{for(let i=0;i<e.length;i++)for(let o=i+1;o<e.length;o++){let n=ye(e[i],e[o]);t instanceof Map?t.set(n,[e[i],e[o]]):t.add(n)}};for(let e of s.values())u([...e],d);for(let e of l.values())u([...e],c);let g=/* @__PURE__ */new Set;for(let[e,[o,n]]of d)c.has(e)&&(be(t[o],t[n])||be(i[o],i[n])&&(g.add(o),g.add(n)));return{conflicts:(e,i)=>{let o=n.get(e),l=n.get(i);return!((null==o||null==l||o===l)&&(null!=o==(null!=l)||r.has(ye(e,i))||a.has(e)&&a.has(i)&&Se(e,i,a))&&!be(t[e],t[i])&&(!g.has(e)&&!g.has(i)||r.has(ye(e,i))))}}}function Te(e,t){return e.filter(e=>null!=t[e.id].start).sort((e,i)=>t[e.id].start-t[i.id].start||t[e.id].end-t[i.id].end||k(e.id,i.id)).map(e=>e.id)}function Pe(e,t,i=/* @__PURE__ */new Map){let o=[],n=[];for(let a of e){let e=o.findIndex(e=>e.every(e=>!t.conflicts(a,e))&&!we(a,e,i));-1===e&&!i.has(a)&&(e=o.findIndex(e=>e.every(e=>!t.conflicts(a,e)))),-1===e&&(e=o.length,o.push([])),o[e].push(a),n.push(e)}return{assignment:n,slotCount:o.length}}function Ce(e,t,i,o){if(e.length<=12||o.slotCount<=1)return o.assignment;let n=new Map(e.map((e,t)=>[e,t])),a=Array.from({length:e.length},()=>/* @__PURE__ */new Map),r=ve(i);for(let e of i){let t=n.get(e.source),i=n.get(e.target);if(null==t||null==i||t===i)continue;let o=xe(e,r);a[t].set(i,(a[t].get(i)??0)+o),a[i].set(t,(a[i].get(t)??0)+o)}let l=ke(i),s=e.map(e=>l.get(e)?.weight??0),d=Array.from({length:e.length},()=>/* @__PURE__ */new Map),c=0;for(let i=0;i<e.length-1&&c<5e4;i++)if(l.has(e[i]))for(let o=i+1;o<e.length;o++){if(!l.has(e[o])||t.conflicts(e[i],e[o]))continue;c++;let n=Math.min(s[i],s[o])||Math.max(s[i],s[o]),a=Se(e[i],e[o],l)?n:-n;if(!(Math.abs(a)<=oo)&&(d[i].set(o,a),d[o].set(i,a),c>=5e4))break}let u=[...o.assignment],g=Array.from({length:o.slotCount},()=>[]);u.forEach((e,t)=>g[e].push(t));let m=(e,t,i)=>{let o=u[t],n=u[i],a=0,r=/* @__PURE__ */new Set;for(let l of[t,i])for(let[s,d]of e[l]){let e=l<s?`${l}:${s}`:`${s}:${l}`;if(r.has(e))continue;r.add(e);let c=u[l]===u[s],g=(l===t?n:o)===(s===t?n:s===i?o:u[s]);c!==g&&(a+=g?d:-d)}return a},h=(e,t,i)=>{let o=0;for(let[n,a]of e[t]){let e=u[t]===u[n],r=i===u[n];e!==r&&(o+=r?a:-a)}return o},f=(e,t)=>e>oo||Math.abs(e)<=oo&&t>oo,p=(e,t,i,o)=>e>i+oo||Math.abs(e-i)<=oo&&t>o+oo,b=0;for(let i=0;i<32&&b<io;i++){let i=null,o=-1,n=-1,r=-1,l=-1/0,s=-1/0;for(let c=0;c<e.length;c++){for(let m=0;m<g.length&&!(b++>=io);m++){if(m===u[c]||!g[m].every(i=>!t.conflicts(e[c],e[i])))continue;let b=h(a,c,m),y=h(d,c,m);f(b,y)&&p(b,y,l,s)&&(i="move",o=c,n=-1,r=m,l=b,s=y)}if(b>=io)break}for(let c=0;c<e.length-1;c++){for(let h=c+1;h<e.length&&!(b++>=io);h++){let b=u[c],y=u[h];if(b===y||!g[y].every(i=>i===h||!t.conflicts(e[c],e[i]))||!g[b].every(i=>i===c||!t.conflicts(e[h],e[i])))continue;let v=m(a,c,h),k=m(d,c,h);f(v,k)&&p(v,k,l,s)&&(i="swap",o=c,n=h,r=-1,l=v,s=k)}if(b>=io)break}if(null==i||-1===o)break;if("move"===i){let e=u[o];g[e].splice(g[e].indexOf(o),1),g[r].push(o),u[o]=r;continue}let c=u[o],y=u[n];g[c].splice(g[c].indexOf(o),1,n),g[y].splice(g[y].indexOf(n),1,o),u[o]=y,u[n]=c}return u}function Ae(e,t){for(let i=0;i<Math.min(e.length,t.length);i++)if(e[i]!==t[i])return e[i]<t[i];return e.length<t.length}function Ie(e,t,i,o){if(0===e.length||e.length>12||o.slotCount<=1)return o.assignment;let n=new Map(e.map((e,t)=>[e,t])),a=Array.from({length:e.length},()=>new Float64Array(e.length)),r=Array.from({length:e.length},()=>/* @__PURE__ */new Map),l=Array.from({length:e.length},()=>/* @__PURE__ */new Map),s=ve(i);for(let e of i){let t=n.get(e.source),i=n.get(e.target);if(null==t||null==i||t===i)continue;let o=xe(e,s);a[t][i]+=o,a[i][t]+=o,l[t].set(i,(l[t].get(i)??0)+o),r[i].set(t,(r[i].get(t)??0)+o)}let d=ke(i),c=e.map(e=>d.get(e)?.weight??0),u=Array.from({length:e.length},()=>new Float64Array(e.length));for(let t=0;t<e.length;t++)for(let i=t+1;i<e.length;i++){for(let[e,o]of r[t])u[t][i]+=Math.min(o,r[i].get(e)??0);for(let[e,o]of l[t])u[t][i]+=Math.min(o,l[i].get(e)??0);if(d.has(e[t])&&d.has(e[i])){let o=Math.min(c[t],c[i])||Math.max(c[t],c[i]);u[t][i]+=Se(e[t],e[i],d)?o:-o}u[i][t]=u[t][i]}let g=[...o.assignment],m=(t=>{let i=0,o=0;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++)t[n]===t[r]&&(i+=a[n][r],o+=u[n][r]);return{flow:i,affinity:o}})(g),h=0,f=new Array(e.length).fill(-1),p=Array.from({length:o.slotCount},()=>[]),b=(i,n,r,l)=>{if(h>=75e3)return;if(i===e.length)return h++,void((r>m.flow||r===m.flow&&l>m.affinity||r===m.flow&&l===m.affinity&&Ae(f,g))&&(g=[...f],m={flow:r,affinity:l}));let s=Math.min(n+1,o.slotCount-1);for(let o=0;o<=s;o++){if(p[o].some(o=>t.conflicts(e[i],e[o])))continue;let s=0,d=0;for(let e of p[o])s+=a[i][e],d+=u[i][e];if(f[i]=o,p[o].push(i),b(i+1,Math.max(n,o),r+s,l+d),p[o].pop(),f[i]=-1,h>=75e3)return}};return f[0]=0,p[0].push(0),b(1,0,0,0),g}function Oe(e,t){let i=1/0,o=-1/0;for(let t of e?.samples??[])t.topMass+t.botMass<=1e-9||(i=Math.min(i,t.t),o=Math.max(o,t.t));return Number.isFinite(i)&&Number.isFinite(o)?(null!=t.start&&(i=Math.max(i,t.start)),null!=t.end&&(o=Math.min(o,t.end)),o>=i?{start:i,end:o}:{start:null,end:null}):{start:null,end:null}}function Ne(e,t,i,o){let n=he(e,t,i,o),a=fe(n);if(a)return me(a.slots,i,o);let r=v();for(let t of e)r[t.id]=Oe(i[t.id],o[t.id]);let l=Te(e,r),s=new Map(e.map(e=>[e.id,e])),d=new Map(e.map(e=>[e.id,e.group||void 0])),c=ke(t),u=Me(l,r,o,t,d,c),g=Pe(l,u,c),m=Ie(l,u,t,{...g,assignment:Ce(l,u,t,g)}),h=/* @__PURE__ */new Map,f=m.map(e=>(h.has(e)||h.set(e,h.size),h.get(e))),p=Array.from({length:h.size||(e.length>0?1:0)},()=>({occupants:[],peak:{topPeak:0,botPeak:0}})),b=v();l.forEach((e,t)=>{let i=f[t],o=p[i];o.occupants.push({id:e,end:r[e].end??-1/0});let n=s.get(e)?.group;n&&(o.group=n),b[e]=i});for(let t of[...e].sort((e,t)=>k(e.id,t.id)))null==b[t.id]&&(p[0].occupants.push({id:t.id,end:-1/0}),b[t.id]=0);for(let e of p){e.occupants.sort((e,t)=>(r[e.id].start??1/0)-(r[t.id].start??1/0)||k(e.id,t.id));for(let t of e.occupants){let o=i[t.id];e.peak.topPeak=Math.max(e.peak.topPeak,o?.topPeak||0),e.peak.botPeak=Math.max(e.peak.botPeak,o?.botPeak||0)}}let y={slots:p,slotByNode:b};return pe(n,y),y}function He(e){return e.topMass+e.botMass}function Le(e){let t=/* @__PURE__ */new Map;for(let i of e.samples){if(Number.isNaN(i.t))continue;let e=t.get(i.t);e||(e=[],t.set(i.t,e)),e.push(i)}let i=0,o=-1/0;return n=>{n>=o||(i=0),o=n;let a=t.get(n);if(a){let e=a.reduce((e,t)=>He(t)>=He(e)?t:e,a[0]);return{exact:a,sample:e}}for(;i<e.samples.length&&!(e.samples[i].t>n);)i++;return{exact:a,sample:e.samples[i-1]??null}}}function Be(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{...t,samples:t.samples.map(e=>({...e})),localAttachments:new Map([...t.localAttachments].map(([e,t])=>[e,{...t}]))}]))}function De(e,t,i,o,n,a,r=0){let l=/* @__PURE__ */new Map;for(let i of e){if(!i.group||!t[i.id])continue;let e=l.get(i.group)??[];e.push(i),l.set(i.group,e)}if(0===l.size||!(a>0))return t;let s=Be(t);for(let[e,d]of l){let l=i.map((e,t)=>({slot:e,index:t})).filter(({slot:t})=>t.group===e);if(0===l.length)continue;let c=l[0].slot,u=l.at(-1).slot,g=n[c.occupants[0]?.id],m=n[u.occupants[0]?.id];if(!Number.isFinite(g)||!Number.isFinite(m))continue;let h=(g-c.peak.topPeak*a+(m+u.peak.botPeak*a))/2,f=[...new Set(d.flatMap(e=>t[e.id].samples.map(e=>e.t)))].sort((e,t)=>e-t),p=/* @__PURE__ */new Map;for(let e of d)p.set(e.id,/* @__PURE__ */new Map);let b=new Map(d.map(e=>[e.id,Le(t[e.id])]));for(let e of f){let t=/* @__PURE__ */new Map;for(let i of d){let{sample:n}=b.get(i.id)(e);if(!n||He(n)<=1e-9)continue;let a=o[i.id];if(null==a)continue;let r=t.get(a)??[];r.push({node:i,sample:n}),t.set(a,r)}let i=[...t].sort((e,t)=>e[0]-t[0]).map(([e,t])=>({slot:e,active:t,mass:Math.max(...t.map(({sample:e})=>He(e)))}));if(0===i.length)continue;let l=h-(i.reduce((e,t)=>e+t.mass,0)*a+Math.max(0,r)*Math.max(0,i.length-1))/2;for(let t of i){for(let{node:i,sample:o}of t.active){let t=(l-n[i.id])/a+o.topMass-(o.boundaryOffset??0);p.get(i.id).set(e,t)}l+=t.mass*a+Math.max(0,r)}}for(let e of d){let i=t[e.id],o=s[e.id],n=p.get(e.id),a=b.get(e.id),r=[];for(let e of f){let t=n.get(e),{exact:i,sample:o}=a(e);i?r.push(...i.map(e=>({...e,...null!=t?{boundaryOffset:(e.boundaryOffset??0)+t}:{}}))):null==t||!o||He(o)<=1e-9||r.push({...o,t:e,boundaryOffset:(o.boundaryOffset??0)+t})}o.samples=r,o.localAttachments=new Map([...i.localAttachments].map(([e,t])=>{let i=n.get(t.time);return[e,{...t,...null!=i?{boundaryOffset:(t.boundaryOffset??0)+i}:{}}]}))}}return s}function Ee(e,t,i,o,n){let{plotH:a,padding:r,valueScale:l,packing:s,laneOrder:d,lifetimeMode:c="half",lanePlacement:u="stack",groupPadding:g=0,ribbonLane:m="both",domain:h}=n,f=v(),p=v();for(let t of e)f[t.id]=i[t.id].topPeak||0,p[t.id]=i[t.id].botPeak||0;let b="half"===c,y=v();for(let t of e){let e=Array.isArray(t.xExtent)?t.xExtent[0]:null,i=Array.isArray(t.xExtent)?t.xExtent[1]:null,n=null!=e&&Number.isFinite(e)?e:1/0,a=null!=i&&Number.isFinite(i)?i:-1/0;for(let e of o.outgoing[t.id]){e.startTime<n&&(n=e.startTime),null!=e.systemInTime&&Number.isFinite(e.systemInTime)&&e.systemInTime<n&&(n=e.systemInTime);let t=b?(e.startTime+e.endTime)/2:e.endTime;t>a&&(a=t)}for(let e of o.incoming[t.id]){let t=b?(e.startTime+e.endTime)/2:e.startTime;t<n&&(n=t),e.endTime>a&&(a=e.endTime),null!=e.systemOutTime&&Number.isFinite(e.systemOutTime)&&e.systemOutTime>a&&(a=e.systemOutTime)}y[t.id]={start:Number.isFinite(n)?n:null,end:Number.isFinite(a)?a:null}}let k=v(),w=[],x=[];if(n.frozenSlots){let e=me(n.frozenSlots,i,y);w=e.slots,k=e.slotByNode,x=w.map(S)}else if("reuse"===s){let o=Ne(e,t,i,y);w=o.slots,k=o.slotByNode}else e.forEach((e,t)=>{w.push({occupants:[{id:e.id,end:y[e.id]?.end??-1/0}],peak:{topPeak:f[e.id],botPeak:p[e.id]},...e.group?{group:e.group}:{}}),k[e.id]=t});ne(w,k),0===x.length&&(x=w.map(S));let M=null;n.frozenSlots||(n.fixedSlotOrder?ge(w,k,n.fixedSlotOrder):n.runOrdering&&d&&"insertion"!==d&&(M=ue(e,t,i,y,w,k,{plotH:a,padding:r,valueScale:l,groupPadding:g,laneOrder:d,ribbonLane:m,domain:h}))),ne(w,k);let T=A(e,t,i,w,k,{plotH:a,padding:r,valueScale:l,stackValueScale:n.stackValueScale,lanePlacement:u,groupPadding:g}),P=0===w.length?0:w[0].peak.topPeak+T.adjacentClearance.reduce((e,t)=>e+t,0)+w[w.length-1].peak.botPeak,C=M?.before.crossings??null,I=M?.after.crossings??null,O=M?.before.weightedLength??null,N=M?.after.weightedLength??null;return{effectiveSlotsHeight:P,centerlines:T.centerlines,laneLifetime:y,slots:w,slotByNode:k,slotCenter:T.slotCenter,stackCenter:T.stackCenter,verticalUtilization:T.verticalUtilization,selectedSlotOrder:w.map(S),initialSlotOrder:x,ordering:M,crossingsBefore:C,crossingsAfter:I,lengthBefore:O,lengthAfter:N}}function Fe(e,t,i){let{plotH:o,pairing:n="temporal",packing:a="reuse",laneOrder:r="crossing-min",lifetimeMode:l="half",maxValueScale:s,lanePlacement:d="stack",nodeSizing:c="temporal",groupPadding:u=0,ribbonLane:g="both",domain:m}=i,h=Number.isFinite(u)?Math.max(0,u):0,f=j(e,t),p=_(e,t,f,n),b=v();for(let t of e)b[t.id]=Y(t,f,p,void 0,c);let y=Ee(e,t,b,f,{plotH:o,padding:12,valueScale:1,packing:a,laneOrder:r,lifetimeMode:l,runOrdering:!0,lanePlacement:"stack",groupPadding:h,ribbonLane:g,domain:m}),x=y.slots.map(e=>({occupants:e.occupants.map(e=>({...e})),peak:{...e.peak},...null!=e.group?{group:e.group}:{}})),M=/* @__PURE__ */new Set;for(let e of t){let t=y.slotByNode[e.source],i=y.slotByNode[e.target];if(void 0===t||void 0===i)continue;let o=p.get(e.id);t!==i?i<t?(o.sourceSide="top",o.targetSide="bot"):(o.sourceSide="bot",o.targetSide="top"):(M.add(e.id),o.sourceSide="bot",o.targetSide="bot")}for(let t of e){let e=f.outgoing[t.id],i=f.incoming[t.id],o=new Set(e.map(e=>p.get(e.id).sourceSide)),n=new Set(i.map(e=>p.get(e.id).targetSide));if(1===o.size&&i.length>0){let e=[...o][0];for(let t of i)y.slotByNode[t.source]===y.slotByNode[t.target]&&(p.get(t.id).targetSide=e)}if(1===n.size&&e.length>0){let t=[...n][0];for(let i of e)y.slotByNode[i.source]===y.slotByNode[i.target]&&(p.get(i.id).sourceSide=t)}}q(t,p,y.slotByNode),V(e,f,p,M),b=v();for(let t of e)b[t.id]=Y(t,f,p,void 0,c);let T=Ee(e,t,b,f,{plotH:o,padding:12,valueScale:1,packing:a,laneOrder:r,lifetimeMode:l,frozenSlots:x,lanePlacement:"stack",groupPadding:h,ribbonLane:g,domain:m}),P=T.effectiveSlotsHeight??T.slots.reduce((e,t)=>e+t.peak.topPeak+t.peak.botPeak,0),C=T.slots.slice(0,-1).reduce((e,t,i)=>e+(null!=t.group&&t.group===T.slots[i+1].group?1:0),0),I=Math.max(1,T.slots.length+1-C),O=Math.min(12,Math.max(0,.35*o-C*h)/I),N=2*O+w(T.slots,O,h).reduce((e,t)=>e+t,0),H=P>0?Math.max(0,(o-N)/P):1,L=Number.isFinite(s)&&s>0?Math.min(H,s):H,B=Ee(e,t,b,f,{plotH:o,padding:O,valueScale:L,packing:a,laneOrder:r,lifetimeMode:l,frozenSlots:x,lanePlacement:d,groupPadding:h,ribbonLane:g,domain:m,stackValueScale:H}),D=Number.isFinite(s)&&s>0&&s+1e-12<H;if("insertion"!==r&&("hug"===d||D)&&B.slots.length>1&&(ue(e,t,b,B.laneLifetime,B.slots,B.slotByNode,{plotH:o,padding:O,valueScale:L,groupPadding:h,laneOrder:r,ribbonLane:g,domain:m,lanePlacement:d,mode:"geometry-refine"}),B=Ee(e,t,b,f,{plotH:o,padding:O,valueScale:L,packing:a,laneOrder:r,lifetimeMode:l,frozenSlots:B.slots,fixedSlotOrder:B.slots.map(S),lanePlacement:d,groupPadding:h,ribbonLane:g,domain:m,stackValueScale:H})),G(f,p)){let i=X(t,b,B.centerlines,L);b=v();for(let t of e)b[t.id]=Y(t,f,p,i,c);B=Ee(e,t,b,f,{plotH:o,padding:O,valueScale:L,packing:a,laneOrder:r,lifetimeMode:l,frozenSlots:B.slots,fixedSlotOrder:B.slots.map(S),lanePlacement:d,groupPadding:h,ribbonLane:g,domain:m,stackValueScale:H})}let F=new Map(y.initialSlotOrder.map((e,t)=>[e,t])),R=[...B.slots].sort((e,t)=>(F.get(S(e))??1/0)-(F.get(S(t))??1/0)||k(S(e),S(t))),z=v();R.forEach((e,t)=>{for(let i of e.occupants)z[i.id]=t});let W=A(e,t,b,R,z,{plotH:o,padding:O,valueScale:L,stackValueScale:H,lanePlacement:"stack",groupPadding:h}),$=De(e,b,R,z,W.centerlines,L,h),K=E(le(z,t),se(z,t),t,$,R,z,W.centerlines,B.laneLifetime,L,W.verticalUtilization,g,m);b=De(e,b,B.slots,B.slotByNode,B.centerlines,L,h);let Q=E(le(B.slotByNode,t),se(B.slotByNode,t),t,b,B.slots,B.slotByNode,B.centerlines,B.laneLifetime,L,B.verticalUtilization,g,m);return{nodeData:b,sides:p,valueScale:L,padding:O,compressedPadding:O<12,centerlines:B.centerlines,laneLifetime:B.laneLifetime,slots:B.slots,slotByNode:B.slotByNode,crossingsBefore:"insertion"===r?null:K.crossings,crossingsAfter:"insertion"===r?null:Q.crossings,lengthBefore:"insertion"===r?null:K.weightedLength,lengthAfter:"insertion"===r?null:Q.weightedLength,layoutQualityBefore:K,layoutQuality:Q}}function Re(e,t,i,o="horizontal"){return"vertical"===o?{top:e?38:t?28:16,right:24,bottom:24,left:i?72:24}:{top:e?30:t?24:8,right:80,bottom:i?28:8,left:80}}function ze(e){let t=e.layout,i=e.nodes,o=e.orientation,n=e.plotW,a=e.plotH,r=e.timelineExtent,l=e.showQualityReadout??!1,s=e.showLaneRails??!1,d=(e.warnings??[]).slice(0,3),c=e.timeFormat,u=e.colorOf,m=e.toTime,h=e.xScale,f=g(e.domain),{centerlines:p,laneLifetime:b,nodeData:y,valueScale:v,compressedPadding:k,crossingsBefore:S,crossingsAfter:w,layoutQualityBefore:x,layoutQuality:M}=t,T=null,P=null,C=1/0,A=-1/0;for(let e of i){let t=b[e.id];if(!t||null===t.start||null===t.end)continue;let i=h(t.start),o=h(t.end);C=Math.min(C,t.start),A=Math.max(A,t.end),(null===T||i<T)&&(T=i),(null===P||o>P)&&(P=o)}let I=e=>Math.max(0,Math.min(r,e)),O=I(T??0),N=Math.max(O,I(P??r)),H=[Math.max(m(e.domain[0]),C),Math.min(m(e.domain[1]),A)],L=Math.max(2,Math.min(8,Math.floor(r/90))),B=uo().domain(H),D=e.axisTicks??(Number.isFinite(H[0])&&Number.isFinite(H[1])?(f?B.ticks(L):co().domain(H).ticks(L)).map(e=>({date:e})):[]),E=e=>{if(null!=e.label)return e.label;let t=m(e.date),i=f?new Date(t):t;return c?c(i):f?B.tickFormat()(i):String(t)},F=D.map((e,t)=>({tick:e,index:t,coordinate:h(m(e.date))})).filter(({coordinate:e})=>e>=O-.5&&e<=N+.5),R=null!==(w??null)&&null!=x&&null!=M,z=l&&(R||d.length>0)?/* @__PURE__ */ho("g",{fill:bo,fontSize:10,textAnchor:"end",children:[R&&/* @__PURE__ */ho(go,{children:[
|
|
3
|
-
/* @__PURE__ */ho("text",{x:n,y:-14,children:["crossings: ",S," → ",w," ","pixel length: ",Math.round(x.pixelLength)," → ",Math.round(M.pixelLength)]}),
|
|
4
|
-
/* @__PURE__ */ho("text",{x:n,y:-3,children:["transit: ",x.transitOcclusion.toFixed(1)," → ",M.transitOcclusion.toFixed(1)," ","lane use: ",Math.round(100*M.verticalUtilization),"%"]})]}),d.map((e,t)=>/* @__PURE__ */ho("text",{x:n,y:R?10+11*t:11*t-3,fill:"var(--semiotic-warning, #b45309)",children:["warn: ",e]},`warn-${t}`))]}):null,W=k?/* @__PURE__ */mo("text",{x:n,y:"vertical"===o?-3:2,fontSize:10,fill:bo,textAnchor:"end",children:"dense layout: lane gaps compressed"}):null,$=(e,t)=>u?u(e,t):fo;/* @__PURE__ */
|
|
5
|
-
return ho("g","vertical"===o?{children:[z,W,F.map(({index:e,coordinate:t})=>/* @__PURE__ */mo("line",{x1:0,y1:t,x2:n,y2:t,stroke:fo,strokeOpacity:.15,strokeDasharray:"2 4"},`grid-${e}`)),s&&i.map((e,t)=>{let i=b[e.id];if(!i||null===i.start)return null;let o=p[e.id],n=y[e.id],a=n?{topPeak:n.topPeak,botPeak:n.botPeak}:{topPeak:0,botPeak:0},r=o+(a.botPeak-a.topPeak)*v/2,l=h(i.start),s=h(i.end),d=$(e.id,t);/* @__PURE__ */
|
|
6
|
-
return ho("g",{children:[
|
|
7
|
-
/* @__PURE__ */mo("line",{x1:r,y1:l,x2:r,y2:s,stroke:d,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),
|
|
8
|
-
/* @__PURE__ */mo("line",{x1:r-4,y1:l,x2:r+4,y2:l,stroke:d,strokeOpacity:.5}),
|
|
9
|
-
/* @__PURE__ */mo("line",{x1:r-4,y1:s,x2:r+4,y2:s,stroke:d,strokeOpacity:.5})]},`lane-${e.id}`)}),
|
|
10
|
-
/* @__PURE__ */mo("line",{x1:-4,y1:O,x2:-4,y2:N,stroke:fo}),F.map(({tick:e,index:t,coordinate:i})=>{let o=E(e);/* @__PURE__ */
|
|
11
|
-
return ho("g",{transform:`translate(-4,${i})`,children:[
|
|
12
|
-
/* @__PURE__ */mo("line",{x2:-6,stroke:fo}),
|
|
13
|
-
/* @__PURE__ */mo("text",{x:-10,y:4,textAnchor:"end",fontSize:11,fill:po,children:o})]},t)})]}:{children:[z,W,F.map(({index:e,coordinate:t})=>/* @__PURE__ */mo("line",{x1:t,y1:0,x2:t,y2:a,stroke:fo,strokeOpacity:.15,strokeDasharray:"2 4"},`grid-${e}`)),s&&i.map((e,t)=>{let i=b[e.id];if(!i||null===i.start)return null;let o=p[e.id],n=y[e.id],a=n?{topPeak:n.topPeak,botPeak:n.botPeak}:{topPeak:0,botPeak:0},r=o+(a.botPeak-a.topPeak)*v/2,l=h(i.start),s=h(i.end),d=$(e.id,t);/* @__PURE__ */
|
|
14
|
-
return ho("g",{children:[
|
|
15
|
-
/* @__PURE__ */mo("line",{x1:l,y1:r,x2:s,y2:r,stroke:d,strokeOpacity:.35,strokeWidth:1,strokeDasharray:"3 3"}),
|
|
16
|
-
/* @__PURE__ */mo("line",{x1:l,y1:r-4,x2:l,y2:r+4,stroke:d,strokeOpacity:.5}),
|
|
17
|
-
/* @__PURE__ */mo("line",{x1:s,y1:r-4,x2:s,y2:r+4,stroke:d,strokeOpacity:.5})]},`lane-${e.id}`)}),
|
|
18
|
-
/* @__PURE__ */mo("line",{x1:O,y1:a+4,x2:N,y2:a+4,stroke:fo}),F.map(({tick:e,index:t,coordinate:i})=>{let o=E(e);/* @__PURE__ */
|
|
19
|
-
return ho("g",{transform:`translate(${i},${a+4})`,children:[
|
|
20
|
-
/* @__PURE__ */mo("line",{y2:6,stroke:fo}),
|
|
21
|
-
/* @__PURE__ */mo("text",{y:20,textAnchor:"middle",fontSize:11,fill:po,children:o})]},t)})]})}function We(e,t,i,o,n,a,r,l,s={}){let d,c,u,g,m=n,h=e=>l?Math.max(l[0],Math.min(l[1],e)):e,f=a(h(e.time)),p=a(h(i.time)),b=e.value*m,y=i.value*m,v=t+(e.boundaryOffset??0)*m,k=o+(i.boundaryOffset??0)*m,S=e.sideMassBefore*m,w=i.sideMassAfter*m;"top"===e.side?(d=v-S,c=d+b):(c=v+S,d=c-b),"top"===i.side?(u=k-w,g=u+y):(g=k+w,u=g-y);let x=s.sourceRunwayStart,M=s.minRun,T=(d+c)/2,P=(u+g)/2,C=Math.abs(P-T),A=p-f,I="number"==typeof x&&Number.isFinite(x),O="number"==typeof M&&Number.isFinite(M)&&M>0;if(I&&C>1e-9&&A>0&&("auto"===M||O)){let t="source"===r?.85:"target"===r?.15:.5,i=1.5*Math.min(t*t,(1-t)*(1-t)),o="auto"===M?Math.min(144,Math.sqrt(8*C/i)):M;if(o>A){let t=a(h(Math.min(x,e.time)));if(Number.isFinite(t)){let e=Math.min(f,t);f=Math.min(f,Math.max(e,p-o))}}}let N="source"===r?f+.85*(p-f):"target"===r?f+.15*(p-f):(f+p)/2;return{sx:f,sTop:d,sBot:c,tx:p,tTop:u,tBot:g,cp1X:N,cp2X:N}}function $e(e,t,i,o,n,a){let r=new Map(t),l=/* @__PURE__ */new Map;for(let t of e){let e=a?.get(t.source),i=null==e?`node:${t.source}`:`group:${e}`,o=l.get(i)??/* @__PURE__ */new Map,n=o.get(t.startTime)??[];n.push(t),o.set(t.startTime,n),l.set(i,o)}for(let e of l.values())for(let[a,l]of e){if(!l.some(e=>i.has(e.id)))continue;let e=l.map(e=>t.get(e.id));if(e.some(e=>null==e))continue;let s=o(a),d=Math.min(...e.map(e=>e.sx));if(!(d<s-1e-9))continue;let c=Math.max(...l.map(e=>{let t=i.get(e.id);return null==t?s:Math.min(s,o(t))})),u=Math.min(s,Math.max(d,c));for(let e of l){let i=t.get(e.id),o="source"===n?.85:"target"===n?.15:.5,a=u+(i.tx-u)*o;r.set(e.id,{...i,sx:u,cp1X:a,cp2X:a})}}return r}function je(e,t,i){let o=new Set(t.map(e=>e.target)),n=new Map(e.map(e=>[e.id,e])),a=/* @__PURE__ */new Map;for(let e of t){if(o.has(e.source))continue;let t=a.get(e.source)??[];t.push(e),a.set(e.source,t)}let r=/* @__PURE__ */new Map;for(let t of e){if(!t.group)continue;let e=r.get(t.group)??[];e.push(t),r.set(t.group,e)}let l=/* @__PURE__ */new Set;for(let[e,t]of r){let i=t.flatMap(e=>a.get(e.id)??[]),n=new Set(i.map(e=>e.startTime));i.length>0&&1===n.size&&t.every(e=>{let t=e.xExtent?.[0],n=i[0].startTime;return!o.has(e.id)&&(a.get(e.id)?.length??0)>0&&Number.isFinite(t)&&t<n})&&l.add(e)}let s=/* @__PURE__ */new Map;for(let[e,t]of a){let o=n.get(e);if(o?.group&&!l.has(o.group))continue;let a=o?.xExtent?.[0],r=[...t].sort((e,t)=>e.startTime-t.startTime||e.id.localeCompare(t.id)),d=r[0]?.startTime-1,c=null;for(let e=0;e<r.length;){let t=r[e].startTime,o=e+1;for(;o<r.length&&r[o].startTime===t;)o++;for(let t=e;t<o;t++){let e=r[t],o=Number.isFinite(a)&&a<e.startTime,n=Number.isFinite(e.systemInTime)&&e.systemInTime<e.startTime;if(!o&&!n)continue;let l=i[0];o&&(l=Math.max(l,a)),n&&(l=Math.max(l,e.systemInTime)),!o&&n&&Number.isFinite(d)&&(l=Math.max(l,d)),null!=c&&(l=Math.max(l,c)),l<e.startTime&&s.set(e.id,l)}c=t,e=o}}for(let[e,t]of r){if(!l.has(e))continue;let i=t.flatMap(e=>a.get(e.id)??[]);if(!i.every(e=>s.has(e.id))){for(let e of i)s.delete(e.id);continue}let o=Math.max(...i.map(e=>s.get(e.id)));for(let e of i)s.set(e.id,o)}return s}function _e(e,t,i,o,n){let a=/* @__PURE__ */new Map;for(let r of e){if(!i.has(r.id))continue;let e=t.get(r.id);if(!(e&&e.sx<o(r.startTime)-1e-9))continue;let l=n(e.sx);Number.isFinite(l)&&l<r.startTime&&a.set(r.id,l)}return a}function Ye(e,t,i){let o=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map;for(let[e,t]of i??[]){let i=n.get(t)??[];i.push(e),n.set(t,i)}for(let a of e){let e=t.get(a.id);if(!(null!=e&&Number.isFinite(e)&&e<a.startTime))continue;let r=i?.get(a.source),l=null==r?[a.source]:n.get(r)??[a.source];for(let t of l){let i=o.get(t)??/* @__PURE__ */new Map,n=i.get(a.startTime);i.set(a.startTime,null==n?e:Math.min(n,e)),o.set(t,i)}}return o}function Xe(e,t){return t&&0!==t.size?e.map(e=>{let i=t.get(e.t);return null==i?e:{...e,t:i}}):e}function Ge(e){return Math.max(18,11*e.length*.58)}function qe(e){let t=1.22*Ge(e.labelText)+4;return"start"===e.labelAnchor?[e.labelX,e.labelX+t]:"middle"===e.labelAnchor?[e.labelX-t/2,e.labelX+t/2]:[e.labelX-t,e.labelX]}function Ve(e,t){let i=e.labelX-Ge(e.labelText),o=t.labelX-Ge(t.labelText);return i<=t.labelX+3&&o<=e.labelX+3}function Ke(e,t){let i=[...e].sort((e,t)=>e.labelY-t.labelY||e.labelX-t.labelX||e.id.localeCompare(t.id));for(let e=0;e<3;e+=1){for(let e=0;e<i.length;e+=1){let t=8;for(let o=0;o<e;o+=1)Ve(i[e],i[o])&&(t=Math.max(t,i[o].labelY+16));i[e].labelY=Math.max(i[e].labelY,t)}for(let e=i.length-1;e>=0;e-=1){let o=t-8;for(let t=e+1;t<i.length;t+=1)Ve(i[e],i[t])&&(o=Math.min(o,i[t].labelY-16));i[e].labelY=Math.min(i[e].labelY,o)}}}function Qe(e,t,i){let o=e.map(e=>({...e})),n=/* @__PURE__ */new Map;for(let e of o){let i=t[e.id];if(null==i)continue;let o=n.get(i)??[];o.push(e),n.set(i,o)}let a=e=>{if(e.length<2)return;let t=e.reduce((e,t)=>e+t.labelY,0)/e.length,o=(e.length-1)/2;e.forEach((e,n)=>{e.labelY=Math.max(8,Math.min(i-8,t+16*(n-o)))})};for(let e of n.values()){e.sort((e,t)=>e.labelX-t.labelX||e.id.localeCompare(t.id));let t=[],i=-1/0;for(let o of e){let e=o.labelX-Ge(o.labelText);t.length>0&&e>i+3&&(a(t),t=[],i=-1/0),t.push(o),i=Math.max(i,o.labelX)}a(t)}return Ke(o,i),o}function Ue(e,t,i){let o=e.map(e=>({...e}));for(let e of o){let i=1.22*Ge(e.labelText)+4;e.labelX=i>=t-4?t/2:Math.max(i/2+2,Math.min(t-i/2-2,e.labelX))}let n=[],a=[...o].sort((e,t)=>e.labelY-t.labelY||e.labelX-t.labelX);for(let e of a){let t=n[n.length-1];!t||Math.abs(t[0].labelY-e.labelY)>14?n.push([e]):t.push(e)}for(let e of n){e.sort((e,t)=>e.labelX-t.labelX||e.id.localeCompare(t.id));let t=[],o=/* @__PURE__ */new Map;for(let i of e){let[e,n]=qe(i),a=t.findIndex(t=>e>t+8);-1===a&&(a=t.length),t[a]=n,o.set(i,a)}let n=e.reduce((e,t)=>e+t.labelY,0)/e.length,a=n<14*t.length+8;for(let t of e){let e=o.get(t)??0;t.labelY=a?Math.min(i-8,12+14*e):Math.max(8,n-14*e)}}return o}function Ze(e,t,i,o,n={}){if(!1===o)return e.map(e=>({...e,labelText:"",labelDeferred:!1,labelFullText:void 0}));if(!0===o)return e.map(e=>({...e,labelDeferred:!1,labelFullText:void 0}));let a=Math.max(1,t*i),r=Math.max(4,Math.min(e.length,Math.floor(a/14e3)));Number.isFinite(n.maxLabels)&&n.maxLabels>=0&&(r=Math.min(r,Math.floor(n.maxLabels)));let l=e.map((e,t)=>{let i=n.priorityById?.get(e.id),o=Math.abs(e.labelY);return{band:e,index:t,score:null!=i&&Number.isFinite(i)?1e6*i+Ge(e.labelText):Ge(e.labelText)+.01*o}}).filter(e=>e.band.labelText.trim().length>0).sort((e,t)=>t.score-e.score||e.index-t.index||e.band.id.localeCompare(t.band.id)),s=new Set(l.slice(0,r).map(e=>e.band.id));return e.map(e=>s.has(e.id)||0===e.labelText.trim().length?{...e,labelDeferred:!1,labelFullText:void 0}:{...e,labelFullText:e.labelText,labelText:"",labelDeferred:!0})}function Je(e){return e.replace(Mo,(e,t,i)=>`${i},${t}`)}function et(e){if(!e)return;let t=e=>({x:e.y,y:e.x});return{...e,...e.points&&{points:e.points.map(t)},...e.segments&&{segments:e.segments.map(e=>e.map(t))}}}function tt(e){return{...e,pathD:Je(e.pathD),y0:e.x0,y1:e.x1,x0:0,x1:0}}function it(e,t){return"horizontal"===t?e:{...e,pathD:Je(e.pathD),gradientStubs:e.gradientStubs?.map(tt),labelX:e.labelY,labelY:e.labelX,labelAnchor:"middle",labelBaseline:"auto"}}function ot(e,t){return"horizontal"===t?e:{...e,pathD:Je(e.pathD),bezier:et(e.bezier)}}function nt(e){let{nodes:t,edges:i,domain:r,usageMode:l="static"}=e,s=n(t,i,r,{usageMode:l}),{fatal:d,warnings:c}=o(s),u=a(i,s,l);return{layout:d.length?null:Fe(t,u,{plotH:"vertical"===e.orientation?e.plotW:e.plotH,...e.layoutOpts,ribbonLane:e.ribbonLane,domain:r}),issues:d,warnings:c}}function at(e,t=nt(e)){let{nodes:i,edges:o,domain:n,plotW:r,plotH:l,ribbonLane:s,ribbonMinRun:d=0,edgeOpacity:c,colorOf:u,orientation:g="horizontal",showLabels:m=!0,labelPriorityAccessor:h,maxLabels:f,selectionDatum:p="raw",styleRules:b,colorBy:y,valueAccessor:v,usageMode:k="static"}=e,S="vertical"===g?l:r,w="vertical"===g?r:l,{layout:x,issues:M,warnings:T}=t,P=a(o,[...M,...T],k),C=xo().domain(n).range([0,S]);if(!x)return{layout:null,layoutConfig:{bands:[],ribbons:[],showLabels:!1!==m},issues:M,warnings:T,xScale:C};let{centerlines:A,nodeData:I,valueScale:O}=x,N=ii(y,v),H=[],L=[],B=0===d?/* @__PURE__ */new Map:je(i,P,n),D=new Map(i.filter(e=>e.group).map(e=>[e.id,e.group])),E=/* @__PURE__ */new Map;for(let e of P){let t=I[e.source]?.localAttachments.get(e.id),i=I[e.target]?.localAttachments.get(e.id);!t||!i||E.set(e.id,We(t,A[e.source],i,A[e.target],O,C,s,n,{minRun:d,sourceRunwayStart:B.get(e.id)}))}let F=$e(P,E,B,C,s,D),z=_e(P,F,B,C,e=>n[0]+e/S*(n[1]-n[0])),j=Ye(P,z,D);i.forEach((e,t)=>{let i=I[e.id];if(!i||0===i.samples.length)return;let o=Xe(i.samples,j.get(e.id)),a=W(o,A[e.id],O,C,n);if(!a)return;let r,l,s=R(o,n),d=s.find(e=>e.topMass+e.botMass>0)||s[0],c=(d.botMass-d.topMass+2*(d.boundaryOffset??0))*O/2,m=A[e.id]+c,h=u(e.id,t),f=h,p=.5,y=e.__raw??e;if(b&&b.length>0){let e=oi(y,b,N(y));"string"==typeof e.fill?h=e.fill:null!=e.fill&&xi(e.fill)&&(l=e.fill,h=e.fill.background&&"transparent"!==e.fill.background?e.fill.background:h),"string"==typeof e.stroke&&(f=e.stroke),"number"==typeof e.strokeWidth&&(p=e.strokeWidth),"number"==typeof e.fillOpacity&&(r=e.fillOpacity),"number"==typeof e.opacity&&null==r&&(r=e.opacity)}let v=$(e.id,P,x,C,n,z);H.push({id:e.id,pathD:a,fill:h,stroke:f,strokeWidth:p,...null!=r&&{fillOpacity:r},...l&&{hatchFill:l},...v.length>0&&{gradientStubs:v},rawDatum:y,labelX:C("vertical"===g&&e.xExtent?e.xExtent[0]:d.t)-4,labelY:m,labelText:e.label??e.id})});let _=/* @__PURE__ */new Map;i.forEach((e,t)=>_.set(e.id,t)),P.forEach(e=>{let t=F.get(e.id);if(!t)return;let i=_.get(e.source)??0,o=u(e.source,i),{pathD:n,bezier:a}=yt(t),r=e.__raw??e,l="function"==typeof c?Number(c(r)):c,s=Number.isFinite(l)?Math.max(0,Math.min(1,l)):.35;L.push({id:e.id,pathD:n,fill:o,opacity:s,rawDatum:r,bezier:a})});let Y=Qe(H,x.slotByNode,w).map(e=>it(e,g)),X="vertical"===g?Ue(Y,r,l):Y,G=/* @__PURE__ */new Map;if(null!=h)for(let e of i){let t=e.__raw??e,i="function"==typeof h?h(t):Number(t[h]);Number.isFinite(i)&&G.set(e.id,i)}let q=Ze(X,r,l,m,{...G.size>0&&{priorityById:G},...null!=f&&{maxLabels:f}});return{layout:x,layoutConfig:{bands:q,ribbons:L.map(e=>ot(e,g)),showLabels:!1!==m,selectionDatum:p},issues:[],warnings:T,xScale:C}}function rt(e){return e?{nodes:e.nodes.map(({id:e,group:t,xExtent:i})=>({id:e,group:t,xExtent:i})),edges:e.edges.map(({id:e,source:t,target:i,value:o,startTime:n,endTime:a,systemInTime:r,systemOutTime:l})=>({id:e,source:t,target:i,value:o,startTime:n,endTime:a,systemInTime:r,systemOutTime:l})),domain:e.domain,plotW:1,plotH:"vertical"===e.orientation?e.plotW:e.plotH,ribbonLane:e.ribbonLane,usageMode:e.usageMode,layoutOpts:e.layoutOpts,colorOf:()=>"#475569",edgeOpacity:.35,showLabels:!1}:null}function lt(e,t){let{execution:i="auto",workerThreshold:o}=t,n=rt(e),a=JSON.stringify(n,(e,t)=>"number"!=typeof t||Number.isFinite(t)?t:String(t)),r=ui(),l=ko(r?a:null),s=vo(()=>n,[a]),d=!!s&&l.current!==a&&typeof window<"u"&&Nt()&&Ot(i,s.nodes.length,s.edges.length,s.layoutOpts.packing??"reuse",s.layoutOpts.laneOrder??"crossing-min",o),[c,u]=So(null),g=ko(null),m=c?.key===a?c:null,h=vo(()=>s&&!d?m?.prepared??nt(s):null,[s,d,m?.prepared])??m?.prepared??(g.current?.key===a?g.current.prepared:null),f=vo(()=>e&&h?at(e,h):null,[e,h]);return yo(()=>{f&&h&&(g.current={key:a,prepared:h,scene:f}),e||(g.current=null)},[a,f,h,e]),yo(()=>{if(!s||!d||g.current?.key===a)return;let e=new AbortController,t={...s,colorOf:void 0};return import("./c-O4OMJLE7.min.js").catch(e=>{throw It.failed=!0,e}).then(({runProcessSankeyLayoutWorker:i})=>e.signal.aborted?null:i({input:t,colorById:{},fallbackPalette:["#475569"]},e.signal)).then(t=>{t&&!e.signal.aborted&&u({key:a,prepared:{layout:t.layout,issues:t.issues,warnings:t.warnings},error:null})}).catch(t=>{if(!e.signal.aborted&&"AbortError"!==t.name)try{u({key:a,prepared:nt(s),error:null})}catch(e){u({key:a,prepared:null,error:e})}}),()=>e.abort()},[a,s,d,i,o]),e?{...f??g.current?.scene??To(e.domain,"vertical"===e.orientation?e.plotH:e.plotW),status:h?"ready":m?.error?"error":"pending",error:m?.error??null}:{...To([0,1],1),status:"ready",error:null}}function st(e,t){return"function"==typeof e?e(t):t[e]}function dt(e){let{ref:t,rawNodesProp:i,rawEdgesProp:o,nodeIdAccessor:n,edgeIdAccessor:a,sourceAccessor:r,targetAccessor:l,scalesRef:s,layoutSnapshotRef:d}=e,[c,u]=Io([]),[g,m]=Io([]),h=Ao(c),f=Ao(g);h.current=c,f.current=g;let p=Po(e=>{h.current=e,u(e)},[]),b=Po(e=>{f.current=e,m(e)},[]),y=void 0!==o,v=li(y?o:c),k=Co(()=>{let e=li(i??[]),t=g;if(0===e.length&&0===t.length)return Pt([],v,r,l);let o=/* @__PURE__ */new Set,a=[];for(let t of e){let e=String(st(n,t));o.has(e)||(o.add(e),a.push(t))}for(let e of t){let t=String(st(n,e));o.has(t)||(o.add(t),a.push(e))}let s=Pt([],v,r,l);for(let e of s)o.has(e.id)||(o.add(e.id),a.push(e));return a},[i,g,v,n,r,l]),S=Ao(null),w=Po((e,t)=>{let i=st(a,e);return null!=i?String(i):`${st(r,e)}-${st(l,e)}-${t}`},[a,r,l]),x=Po(e=>{if(null==e)return!1;let t=e;return null!=st(r,t)&&null!=st(l,t)},[r,l]),M=Po(e=>String(st(n,e)),[n]);return Ft(t,{variant:"network",frameRef:S,overrides:{push(e){if(x(e)){if(y)return void console.warn("ProcessSankey.push: edge ignored — `edges` prop is controlled.");p([...h.current,e])}else b([...f.current,e])},pushMany(e){let t=[],i=[];for(let o of e)x(o)?t.push(o):i.push(o);t.length>0&&(y?console.warn("ProcessSankey.pushMany: edges ignored — `edges` prop is controlled."):p([...h.current,...t])),i.length>0&&b([...f.current,...i])},remove(e){let t=new Set(Array.isArray(e)?e:[e]),i=[];if(!y){let e=h.current,o=[];for(let n=0;n<e.length;n++){let a=e[n];t.has(w(a,n))?i.push(a):o.push(a)}o.length!==e.length&&p(o)}let o=f.current,a=[];for(let e of o){let o=String(st(n,e));t.has(o)?i.push(e):a.push(e)}return a.length!==o.length&&b(a),i},update(e,t){let i=new Set(Array.isArray(e)?e:[e]),o=[];if(!y){let e=h.current,n=!1,a=e.map((e,a)=>i.has(w(e,a))?(o.push(e),n=!0,t(e)):e);n&&p(a)}let a=f.current,r=!1,l=a.map(e=>{let a=String(st(n,e));return i.has(a)?(o.push(e),r=!0,t(e)):e});return r&&b(l),o},clear(){y||p([]),b([]),S.current?.clear()},getData:()=>v??[],getScales:()=>s.current,getCustomLayout:()=>d.current}}),{rawNodes:k,rawEdges:v,frameRef:S,getNodeId:M,getEdgeId:w,isControlled:y}}function ct(e){if(!e)return[];let t=/* @__PURE__ */new Set,i=[];for(let o of e.samples){let e=o.topMass+o.botMass,n=`${o.t}:${e}`;t.has(n)||(t.add(n),i.push({t:o.t,total:e}))}return i}function ut(e,t=5){if(e.length<=t)return e.slice();let i=[...e].sort((e,t)=>e.total-t.total),o=i.length-1,n=[{...i[0],mark:"min"},{...i[Math.floor(.25*o)],mark:"q25"},{...i[Math.floor(.5*o)],mark:"median"},{...i[Math.floor(.75*o)],mark:"q75"},{...i[o],mark:"max"}],a=/* @__PURE__ */new Set,r=[];for(let e of n)a.has(e.t)||(a.add(e.t),r.push(e));return r.sort((e,t)=>e.t-t.t)}function gt(e,t){return"scene"===t?e:e.data}function mt(e,t,i){return!t?.isActive||t.predicate(gt(e,i))}function ht(e){return"object"==typeof e&&null!==e&&"__kind"in e&&("band"===e.__kind||"ribbon"===e.__kind)}function ft(e){let{tooltip:t,enableHover:i,layout:o,dateDomain:n,nodeLabel:a,timeFormat:r,valueFormat:l,sourceAccessor:s,targetAccessor:d,valueAccessor:c,startTimeAccessor:g,endTimeAccessor:h}=e,f=No(()=>!1!==t&&i&&void 0!==t&&!0!==t&&ai(t)||null,[t,i]),p=Oo(e=>Number.isFinite(e)?r?r(n?new Date(e):e):m(e,n):"",[r,n]),b=Oo(e=>l?l(e):String(e),[l]),y=Oo(e=>{if(!e||!e.data)return null;let t=e.data;if(!ht(t))return null;let i=t.data;if(f)return f(i);if("band"===t.__kind){let e=t.id,n=a?st(a,i):e,r=o?ct(o.nodeData[e]):[],l=5,s=r.length>l?r.length:null,d=ut(r,l);/* @__PURE__ */
|
|
22
|
-
return Do("div",{style:{minWidth:160},children:[
|
|
23
|
-
/* @__PURE__ */Bo("div",{style:{fontWeight:600,marginBottom:4},children:null==n?e:String(n)}),d.length>0&&/* @__PURE__ */Do("table",{style:{borderCollapse:"collapse",fontSize:11,width:"100%"},children:[
|
|
24
|
-
/* @__PURE__ */Bo("thead",{children:/* @__PURE__ */Do("tr",{style:{opacity:.6},children:[
|
|
25
|
-
/* @__PURE__ */Bo("th",{style:{textAlign:"left",fontWeight:500,paddingRight:8},children:"Time"}),
|
|
26
|
-
/* @__PURE__ */Bo("th",{style:{textAlign:"right",fontWeight:500},children:"Mass"}),null!=s&&/* @__PURE__ */Bo("th",{})]})}),
|
|
27
|
-
/* @__PURE__ */Bo("tbody",{children:d.map((e,t)=>/* @__PURE__ */Do("tr",{children:[
|
|
28
|
-
/* @__PURE__ */Bo("td",{style:{paddingRight:8},children:p(e.t)}),
|
|
29
|
-
/* @__PURE__ */Bo("td",{style:{textAlign:"right"},children:b(e.total)}),null!=s&&/* @__PURE__ */Bo("td",{style:{textAlign:"right",paddingLeft:8,opacity:.55},children:e.mark})]},t))})]}),null!=s&&/* @__PURE__ */Do("div",{style:{marginTop:4,fontSize:10,opacity:.55},children:["showing ",d.length," of ",s," samples"]})]})}let n=i,r=st(s,n),l=st(d,n),m=st(c,n),y=st(g,n),v=st(h,n);/* @__PURE__ */
|
|
30
|
-
return Do("div",{style:{minWidth:160},children:[
|
|
31
|
-
/* @__PURE__ */Do("div",{style:{fontWeight:600,marginBottom:4},children:[String(r)," → ",String(l)]}),
|
|
32
|
-
/* @__PURE__ */Do("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:8,fontSize:11},children:[null!=m&&/* @__PURE__ */Do(Lo,{children:[
|
|
33
|
-
/* @__PURE__ */Bo("span",{style:{opacity:.6},children:"value"}),
|
|
34
|
-
/* @__PURE__ */Bo("span",{style:{textAlign:"right"},children:b(Number(m))})]}),null!=y&&/* @__PURE__ */Do(Lo,{children:[
|
|
35
|
-
/* @__PURE__ */Bo("span",{style:{opacity:.6},children:"start"}),
|
|
36
|
-
/* @__PURE__ */Bo("span",{style:{textAlign:"right"},children:p(u(y))})]}),null!=v&&/* @__PURE__ */Do(Lo,{children:[
|
|
37
|
-
/* @__PURE__ */Bo("span",{style:{opacity:.6},children:"end"}),
|
|
38
|
-
/* @__PURE__ */Bo("span",{style:{textAlign:"right"},children:p(u(v))})]})]})]})},[o,a,f,p,b,s,d,c,g,h]);return Ut(f)?Qt(y):y}function pt(e,t,i,o,n,a){let r=/* @__PURE__ */new Map;return l=>({...e,fill:i?ki[(l.depth||0)%ki.length]:t?Si(l.data||l,t,o):wi(void 0,n,a,void 0,r)})}function bt(e,t,i={}){let o=i.seed??1,n=i.iterations??260,a=i.repulsion??5200,r=i.linkDistance??165,l=i.linkStrength??.045,s=i.centerStrength??.018,d=i.damping??.84,c=i.nodeRadius??12,u=i.nodePadding??3,g=i.inset??.06,m=Gt(o),h=/* @__PURE__ */new Map;for(let t of e)h.set(t.id,0);for(let e of t)h.set(e.source,(h.get(e.source)??0)+1),h.set(e.target,(h.get(e.target)??0)+1);let f=500,p=e.map(e=>({id:e.id,data:e,x:200+600*m(),y:200+600*m()})),b=e=>"function"==typeof c?c(e.data):c,y=new Set(e.map(e=>e.id)),v=t.filter(e=>y.has(e.source)&&y.has(e.target)).map(e=>({source:e.source,target:e.target}));if(n>0){let e=dn(p).randomSource(m).alphaDecay(1-Math.pow(.001,1/n)).velocityDecay(Math.max(0,Math.min(1,1-d))).force("charge",sn().strength(e=>{let t=h.get(e.id)??0;return 2.5*-Math.sqrt(a)*Math.sqrt(t+1)})).force("collide",rn(e=>b(e)+u).strength(.9).iterations(2)).force("center",an(f,f).strength(.8)).force("x",cn(f).strength(s)).force("y",un(f).strength(s));v.length>0&&e.force("link",ln(v).id(e=>e.id).distance(r).strength(e=>{let t="string"==typeof e.source?e.source:e.source.id,i="string"==typeof e.target?e.target:e.target.id,o=Math.max(1,Math.min(h.get(t)??1,h.get(i)??1));return l/.045/o})),e.stop();for(let t=0;t<n;t+=1)e.tick()}let k=1/0,S=1/0,w=-1/0,x=-1/0;for(let e of p){let t=e.x??f,i=e.y??f;t<k&&(k=t),i<S&&(S=i),t>w&&(w=t),i>x&&(x=i)}let M=w-k,T=x-S,P={};for(let e of p){let t={x:0===M?.5:g+((e.x??f)-k)/M*(1-2*g),y:0===T?.5:g+((e.y??f)-S)/T*(1-2*g)};Object.defineProperty(P,e.id,{value:t,enumerable:!0,configurable:!0,writable:!0})}return P}import{a as yt,b as vt,c as kt,d as St,e as wt,f as xt,g as Mt,h as Tt,i as Pt,j as Ct,k as At}from"./c-Q7V5REA5.min.js";import{a as It,b as Ot,c as Nt}from"./c-WWHRV7KG.min.js";import{a as Ht}from"./c-5TAXHW7I.min.js";import{b as Lt}from"./c-L3LKYOLK.min.js";import{d as Bt,e as Dt}from"./c-CZI7G7G2.min.js";import{a as Et,c as Ft}from"./c-6O5WWP7F.min.js";import{b as Rt}from"./c-73TOIYIW.min.js";import{a as zt}from"./c-6B5EZDHP.min.js";import{c as Wt,d as $t}from"./c-W3OOPUWV.min.js";import{a as jt}from"./c-TIDKVMMZ.min.js";import{V as _t,W as Yt,Y as Xt}from"./c-QMKQVCCZ.min.js";import{a as Gt}from"./c-RHDOOQ4X.min.js";import{$a as qt,Ab as Vt,Bb as Kt,Ca as Qt,Da as Ut,Db as Zt,Gb as Jt,Ib as ei,Kb as ti,Nb as ii,Qb as oi,Rb as ni,Wa as ai,ab as ri,b as li,cb as si,db as di,eb as ci,ja as ui,qb as gi,rb as mi,s as hi,y as fi,zb as pi}from"./c-2U5JMOPN.min.js";import{l as bi,m as yi,o as vi,q as ki,r as Si,v as wi}from"./c-ZOE7TAR3.min.js";import{i as xi}from"./c-SSKV5JPW.min.js";import{b as Mi}from"./c-3PFVJFBK.min.js";import{useMemo as Ti,forwardRef as Pi,useRef as Ci}from"react";import{useCallback as Ai,useMemo as Ii,useState as Oi}from"react";var Ni="__streamNetworkCategory";import{jsx as Hi}from"react/jsx-runtime";var Li=/* @__PURE__ */qt(/* @__PURE__ */Pi(function(t,i){zt("force",kt),Ht();let o=Ci(null);Ft(i,{variant:"network",frameRef:o});let n=ti(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:a,edges:r,margin:l,className:s,nodeIdAccessor:d,nodeIDAccessor:c,sourceAccessor:u="source",targetAccessor:g="target",nodeLabel:m,colorBy:h,colorScheme:f,styleRules:p,nodeSize:b=8,nodeSizeRange:y=[5,20],nodeStroke:v,nodeStrokeWidth:k,edgeWidth:S,edgeColor:w,edgeOpacity:x,iterations:M=300,forceStrength:T=.1,layoutExecution:P="auto",layoutLoadingContent:C,onLayoutStateChange:A,tooltip:I,frameProps:O={},onObservation:N,onClick:H,chartId:L,selection:B,linkedHover:D,loading:E,loadingContent:F,emptyContent:R,legendInteraction:z,legendPosition:W,stroke:$,strokeWidth:j,opacity:_}=t,Y=d??c??"id",{width:X,height:G,enableHover:q,showLegend:V,showLabels:K=!1,title:Q,description:U,summary:Z,accessibleTable:J}=n,ee=e({nodes:a,edges:r,inferNodes:!1,nodeIdAccessor:Y,sourceAccessor:u,targetAccessor:g,colorBy:h,colorScheme:f,showLegend:V,legendPosition:W,legendInteraction:z,frameLegend:O,selection:B,linkedHover:D,onObservation:N,onClick:H,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ForceDirectedGraph",chartId:L,marginDefaults:n.marginDefaults,userMargin:l,width:X,height:G,hasTitle:!!Q,loading:E,loadingContent:F,emptyContent:R,emptyDataKey:"nodes"}),te=Ti(()=>/* @__PURE__ */new Map,[]),ie=Ti(()=>e=>{let t={};return t.fill=h?Si(e.data||e,h,ee.colorScale):wi(void 0,ee.themeCategorical,f,void 0,te),"number"==typeof b&&(t.r=b),t},[h,ee.colorScale,b,ee.themeCategorical,f,te]),oe=Ti(()=>ii(h,"number"==typeof b?void 0:b),[h,b]),ne=Ti(()=>Xt(ni(ie,p,oe,e=>e.data||e),{stroke:v??$,strokeWidth:k??j,opacity:_}),[ie,p,oe,v,$,k,j,_]),ae=Ti(()=>xt(ne,ee.effectiveSelectionHook,ee.resolvedSelection),[ne,ee.effectiveSelectionHook,ee.resolvedSelection]),re=w??$??"#999",le=x??_??.6,se=j??1,de=Ti(()=>e=>{let t,i=e.data||e;if(void 0===S)t=se;else if("number"==typeof S)t=S;else if("function"==typeof S)t=S(i);else{let e=i[S],o="number"==typeof e?e:Number(e);t=Number.isFinite(o)&&o>0?o:se}return{stroke:re,strokeWidth:t,opacity:le}},[S,re,le,se]),ce=Ti(()=>Mt(de,ee.effectiveSelectionHook,ee.resolvedSelection),[de,ee.effectiveSelectionHook,ee.resolvedSelection]),ue=Ti(()=>{if(K&&m)return"function"==typeof m?m:e=>e.data?.[m]??e[m]??e.id},[K,m]),ge=Dt({componentName:"ForceDirectedGraph",nodes:a,edges:r,nodesRequired:!0,edgesRequired:!0,accessors:{nodeIDAccessor:Y}});return ge?/* @__PURE__ */Hi(ri,{componentName:"ForceDirectedGraph",message:ge,width:X,height:G}):ee.loadingEl?ee.loadingEl:ee.emptyEl?ee.emptyEl:/* @__PURE__ */Hi(si,{componentName:"ForceDirectedGraph",width:X,height:G,children:/* @__PURE__ */Hi(Rt,{ref:o,chartType:"force",...null!=a&&{nodes:ee.safeNodes},...null!=r&&{edges:ee.safeEdges},size:[X,G],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:ee.margin,...ee.legendBehaviorProps,nodeIDAccessor:Y,sourceAccessor:u,targetAccessor:g,iterations:M,forceStrength:T,layoutExecution:P,layoutLoadingContent:C,onLayoutStateChange:A,nodeStyle:ae,edgeStyle:ce,colorBy:h,colorScheme:ee.effectivePalette,nodeSize:b,nodeSizeRange:y,nodeLabel:ue,showLabels:K,enableHover:q,tooltipContent:!1===I?()=>null:ai(I)||void 0,...Yt({linkedHover:D,selection:B,onObservation:N,onClick:H,mobileInteraction:ee.mobileInteraction,customHoverBehavior:ee.customHoverBehavior,customClickBehavior:ee.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:ee.legend,legendPosition:ee.legendPosition,...z&&"none"!==z&&{legendHoverBehavior:ee.legendState.onLegendHover,legendClickBehavior:ee.legendState.onLegendClick,legendHighlightedCategory:ee.legendState.highlightedCategory,legendIsolatedCategories:ee.legendState.isolatedCategories},className:s,title:Q,description:U,summary:Z,accessibleTable:J,...null!=t.animate&&{animate:t.animate},perspective:t.perspective,...O})})}),"ForceDirectedGraph");import{useMemo as Bi,forwardRef as Di,useRef as Ei}from"react";import{jsx as Fi}from"react/jsx-runtime";var Ri=/* @__PURE__ */qt(/* @__PURE__ */Di(function(t,i){zt("chord",St),Ht();let o=Ei(null);Ft(i,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});let n=ti(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:a,edges:r,margin:l,className:s,sourceAccessor:d="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:g="id",colorBy:m,colorScheme:h,styleRules:f,edgeColorBy:p="source",padAngle:b=.01,groupWidth:y=20,sortGroups:v,nodeLabel:k,edgeOpacity:S=.5,tooltip:w,frameProps:x={},onObservation:M,onClick:T,chartId:P,selection:C,linkedHover:A,loading:I,loadingContent:O,emptyContent:N,legendPosition:H,legendInteraction:L,stroke:B,strokeWidth:D,opacity:E}=t,{width:F,height:R,enableHover:z,showLegend:W,showLabels:$=!0,title:j,description:_,summary:Y,accessibleTable:X}=n,G=e({nodes:a,edges:r,inferNodes:!0,nodeIdAccessor:g,sourceAccessor:d,targetAccessor:c,colorBy:m,colorScheme:h,showLegend:W,legendPosition:H,legendInteraction:L,frameLegend:x,selection:C,linkedHover:A,onObservation:M,onClick:T,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"ChordDiagram",chartId:P,marginDefaults:n.marginDefaults,userMargin:l,width:F,height:R,hasTitle:!!j,loading:I,loadingContent:O,emptyContent:N}),q=Bi(()=>/* @__PURE__ */new Map,[]),V=Bi(()=>/* @__PURE__ */new Map,[]),K=G.safeNodes.length>0||G.allCategories.length>0,Q=Bi(()=>{if(K)return(e,t)=>{let i={stroke:"black",strokeWidth:1};if(m)i.fill=Si(e.data||e,m,G.colorScale);else{let o=Array.isArray(h)?h:bi[h]||yi,n=Array.isArray(o)?o:yi,a=String(e.id??e.data?.[g]??"");V.has(a)||V.set(a,V.size);let r=e.index??t??V.get(a);i.fill=n[r%n.length]}return i}},[K,m,G.colorScale,h,g,V]),U=Bi(()=>ii(m),[m]),Z=Bi(()=>{if(Q||f&&f.length>0)return Xt(ni(Q,f,U,e=>e.data||e),{stroke:B,strokeWidth:D,opacity:E})},[Q,f,U,B,D,E]),J=Bi(()=>xt(Z,G.effectiveSelectionHook,G.resolvedSelection),[Z,G.effectiveSelectionHook,G.resolvedSelection]),ee=Bi(()=>{if(K)return Ct({edgeColorBy:p,colorBy:m,colorScale:G.colorScale,nodeStyleFn:J||(e=>({fill:wi(void 0,G.themeCategorical,h,void 0,q)})),edgeOpacity:S,baseStyle:{stroke:"black",strokeWidth:.5,strokeOpacity:S}})},[K,p,m,G.colorScale,J,S,G.themeCategorical,h,q]),te=Bi(()=>ee?Xt(ee,{stroke:B,strokeWidth:D,opacity:E}):void 0,[ee,B,D,E]),ie=Bi(()=>Mt(te,G.effectiveSelectionHook,G.resolvedSelection),[te,G.effectiveSelectionHook,G.resolvedSelection]),oe=Bi(()=>{if(!$)return;let e=k||g;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[$,k,g]),ne=Dt({componentName:"ChordDiagram",edges:r,edgesRequired:!0});return ne?/* @__PURE__ */Fi(ri,{componentName:"ChordDiagram",message:ne,width:F,height:R}):G.loadingEl?G.loadingEl:G.emptyEl?G.emptyEl:/* @__PURE__ */Fi(si,{componentName:"ChordDiagram",width:F,height:R,children:/* @__PURE__ */Fi(Rt,{ref:o,chartType:"chord",...G.safeNodes.length>0&&{nodes:G.safeNodes},...null!=r&&{edges:G.safeEdges},size:[F,R],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:G.margin,...G.legendBehaviorProps,nodeIDAccessor:g,sourceAccessor:d,targetAccessor:c,valueAccessor:u,padAngle:b,groupWidth:y,sortGroups:v,nodeStyle:J,edgeStyle:ie,colorBy:m,colorScheme:G.effectivePalette,edgeColorBy:p,edgeOpacity:S,nodeLabel:oe,showLabels:$,enableHover:z,tooltipContent:!1===w?()=>null:ai(w)||void 0,...Yt({linkedHover:A,selection:C,onObservation:M,onClick:T,mobileInteraction:G.mobileInteraction,customHoverBehavior:G.customHoverBehavior,customClickBehavior:G.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:G.legend,legendPosition:G.legendPosition,...L&&"none"!==L&&{legendHoverBehavior:G.legendState.onLegendHover,legendClickBehavior:G.legendState.onLegendClick,legendHighlightedCategory:G.legendState.highlightedCategory,legendIsolatedCategories:G.legendState.isolatedCategories},className:s,title:j,description:_,summary:Y,accessibleTable:X,...null!=t.animate&&{animate:t.animate},perspective:t.perspective,...x})})}),"ChordDiagram");import{useMemo as zi,forwardRef as Wi,useRef as $i}from"react";import{jsx as ji}from"react/jsx-runtime";var _i=/* @__PURE__ */qt(/* @__PURE__ */Wi(function(t,i){zt("sankey",vt),Ht();let o=$i(null);Ft(i,{variant:"network",frameRef:o,overrides:{getData:()=>o.current?.getTopology()?.edges?.map(e=>e.data)??[]}});let n=ti(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:a,edges:r,margin:l,className:s,sourceAccessor:d="source",targetAccessor:c="target",valueAccessor:u="value",nodeIdAccessor:g="id",colorBy:m,colorScheme:h,styleRules:f,edgeColorBy:p="source",orientation:b="horizontal",nodeAlign:y="justify",nodePaddingRatio:v=.05,nodeWidth:k=15,nodeLabel:S,edgeOpacity:w=.5,edgeSort:x,tooltip:M,frameProps:T={},onObservation:P,onClick:C,chartId:A,selection:I,linkedHover:O,loading:N,loadingContent:H,emptyContent:L,showLegend:B,legendPosition:D,legendInteraction:E,stroke:F,strokeWidth:R,opacity:z}=t,{width:W,height:$,enableHover:j,showLabels:_=!0,title:Y,description:X,summary:G,accessibleTable:q}=n,V=e({nodes:a,edges:r,inferNodes:!0,nodeIdAccessor:g,sourceAccessor:d,targetAccessor:c,colorBy:m,colorScheme:h,showLegend:B,legendPosition:D,legendInteraction:E,frameLegend:T,selection:I,linkedHover:O,onObservation:P,onClick:C,mobileInteraction:n.mobileInteraction,mobileSemantics:n.mobileSemantics,chartType:"SankeyDiagram",chartId:A,marginDefaults:n.marginDefaults,userMargin:l,width:W,height:$,hasTitle:!!Y,loading:N,loadingContent:H,emptyContent:L}),K=zi(()=>/* @__PURE__ */new Map,[]),Q=zi(()=>e=>{let t={stroke:"black",strokeWidth:1};return t.fill=m?Si(e.data||e,m,V.colorScale):wi(void 0,V.themeCategorical,h,void 0,K),t},[m,V.colorScale,V.themeCategorical,h,K]),U=zi(()=>ii(m,u),[m,u]),Z=zi(()=>Xt(ni(Q,f,U,e=>e.data||e),{stroke:F,strokeWidth:R,opacity:z}),[Q,f,U,F,R,z]),J=zi(()=>xt(Z,V.effectiveSelectionHook,V.resolvedSelection),[Z,V.effectiveSelectionHook,V.resolvedSelection]),ee=zi(()=>Ct({edgeColorBy:p,colorBy:m,colorScale:V.colorScale,nodeStyleFn:J,edgeOpacity:w,baseStyle:{stroke:"none",strokeWidth:0}}),[p,m,V.colorScale,J,w]),te=zi(()=>Xt(ee,{stroke:F,strokeWidth:R,opacity:z}),[ee,F,R,z]),ie=zi(()=>Mt(te,V.effectiveSelectionHook,V.resolvedSelection),[te,V.effectiveSelectionHook,V.resolvedSelection]),oe=zi(()=>{if(!_)return;let e=S||g;return"function"==typeof e?e:t=>t.data?.[e]??t[e]??t.id},[_,S,g]),ne=Dt({componentName:"SankeyDiagram",edges:r,edgesRequired:!0});return ne?/* @__PURE__ */ji(ri,{componentName:"SankeyDiagram",message:ne,width:W,height:$}):V.loadingEl?V.loadingEl:V.emptyEl?V.emptyEl:/* @__PURE__ */ji(si,{componentName:"SankeyDiagram",width:W,height:$,children:/* @__PURE__ */ji(Rt,{ref:o,chartType:"sankey",...V.safeNodes.length>0&&{nodes:V.safeNodes},...null!=r&&{edges:V.safeEdges},size:[W,$],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:V.margin,...V.legendBehaviorProps,nodeIDAccessor:g,sourceAccessor:d,targetAccessor:c,valueAccessor:u,orientation:b,nodeAlign:y,nodePaddingRatio:v,nodeWidth:k,nodeStyle:J,edgeStyle:ie,colorBy:m,colorScheme:V.effectivePalette,edgeColorBy:p,edgeOpacity:w,edgeSort:x,nodeLabel:oe,showLabels:_,enableHover:j,tooltipContent:!1===M?()=>null:ai(M)||void 0,...Yt({linkedHover:O,selection:I,onObservation:P,onClick:C,mobileInteraction:V.mobileInteraction,customHoverBehavior:V.customHoverBehavior,customClickBehavior:V.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:V.legend,legendPosition:V.legendPosition,...E&&"none"!==E&&{legendHoverBehavior:V.legendState.onLegendHover,legendClickBehavior:V.legendState.onLegendClick,legendHighlightedCategory:V.legendState.highlightedCategory,legendIsolatedCategories:V.legendState.isolatedCategories},className:s,title:Y,description:X,summary:G,accessibleTable:q,...null!=t.animate&&{animate:t.animate},perspective:t.perspective,...T})})}),"SankeyDiagram"),Yi={static:{duplicateIds:"fatal",invalidSystemTime:"warn"},mcp:{duplicateIds:"fatal",invalidSystemTime:"warn"},push:{duplicateIds:"warn",invalidSystemTime:"strip"}},Xi=/* @__PURE__ */new Set(["invalid-domain","missing-node","backward-edge","invalid-edge-time","invalid-value","invalid-node-time"]),Gi=8,qi=.92,Vi=3,Ki=(e,t)=>{let i=0,o=e.length;for(;i<o;){let n=i+o>>>1;e[n]<t?i=n+1:o=n}return i},Qi=class{constructor(e){this.coordinates=[...new Set(e)].sort((e,t)=>e-t),this.tree=new Int32Array(this.coordinates.length+1)}add(e,t){for(let i=Ki(this.coordinates,e)+1;i<this.tree.length;i+=i&-i)this.tree[i]+=t}below(e){let t=0;for(let i=Ki(this.coordinates,e);i>0;i-=i&-i)t+=this.tree[i];return t}},Ui=class{constructor(e,t,i){this.size=i,this.routes=[],this.outgoing=Array.from({length:i},()=>[]),this.incoming=Array.from({length:i},()=>[]);let o=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map;for(let e of t.keys())n.set(e,n.size);this.nodeCount=n.size;for(let i of e){let e=t.get(i.source),a=t.get(i.target);if(void 0===e||void 0===a||!(i.startTime<i.endTime))continue;let r=n.get(i.source),l=n.get(i.target),s=`${r}:${l}`;o.has(s)||o.set(s,o.size);let d=this.routes.length;this.routes.push({edge:i,source:e,target:a,sourceNode:r,targetNode:l,pair:o.get(s),reverse:-1}),this.outgoing[e].push(d),this.incoming[a].push(d)}for(let e of this.routes)e.reverse=o.get(`${e.targetNode}:${e.sourceNode}`)??-1;if(this.events=this.routes.flatMap((e,t)=>[{time:e.edge.startTime,route:t,delta:1},{time:e.edge.endTime,route:t,delta:-1}]).sort((e,t)=>e.time-t.time||e.delta-t.delta||e.route-t.route),this.smallPairs=this.routes.length<=80?[]:null,this.smallPairs)for(let e=0;e<this.routes.length;e++)for(let t=e+1;t<this.routes.length;t++)K(this.routes[e].edge,this.routes[t].edge)&&this.smallPairs.push([e,t]);this.work=this.smallPairs?.length??1/0}crossing(e,t,i){return(i[e.source]-i[t.source])*(i[e.target]-i[t.target])<0?1:0}count(e){if(this.smallPairs){let t=0;for(let[i,o]of this.smallPairs)t+=this.crossing(this.routes[i],this.routes[o],e);return t}let t=Array.from({length:this.size+1},()=>[]);for(let i of this.routes){let o=e[i.source],n=e[i.target];for(let e=o+1;e<=this.size;e+=e&-e)t[e].push(n)}let i=t.map(e=>new Qi(e)),o=new Int32Array(4*this.nodeCount),n=new Int32Array(this.routes.length),a=(e,t)=>{let o=0;for(let n=e;n>0;n-=n&-n)o+=i[n].below(t);return o},r=0;for(let t of this.events){let l=this.routes[t.route],s=e[l.source],d=e[l.target];1===t.delta&&(r+=a(s,this.size)-a(s,d+1)+a(this.size,d)-a(s+1,d),s!==d&&(r-=o[4*l.sourceNode+(s<d?1:0)],r-=o[4*l.targetNode+(s<d?2:3)],l.reverse>=0&&(r+=n[l.reverse])));for(let e=s+1;e<=this.size;e+=e&-e)i[e].add(d,t.delta);s!==d&&(o[4*l.sourceNode+(s<d?3:2)]+=t.delta,o[4*l.targetNode+(s<d?0:1)]+=t.delta),n[l.pair]+=t.delta}return r}swapDelta(e,t,i){let o=0,n=0,a=o=>i[o===e?t:o===t?e:o],r=(e,t)=>{let r=this.routes[e],l=this.routes[t];if(!K(r.edge,l.edge))return;n++;let s=(a(r.source)-a(l.source))*(a(r.target)-a(l.target))<0?1:0;o+=s-this.crossing(r,l,i)};for(let i of this.outgoing[e])for(let e of this.outgoing[t])r(i,e);for(let i of this.incoming[e])for(let o of this.incoming[t]){let n=this.routes[i],a=this.routes[o];n.source===e&&a.source===t||n.source===t&&a.source===e||r(i,o)}return{delta:o,evaluations:n}}},Zi=e=>{let t=1;for(let i=2;i<=e;i++)t*=i;return t},Ji=/* @__PURE__ */828*Zi(8),eo=3e3,to=/* @__PURE__ */new Map,io=1e5,oo=1e-9;import{forwardRef as no,useMemo as ao,useRef as ro,useCallback as lo,useEffect as so}from"react";import{scaleLinear as co,scaleUtc as uo}from"d3-scale";import{Fragment as go,jsx as mo,jsxs as ho}from"react/jsx-runtime";var fo="var(--semiotic-grid, #94a3b8)",po="var(--semiotic-text-secondary, #475569)",bo="var(--semiotic-text-secondary, #94a3b8)";import{useEffect as yo,useMemo as vo,useRef as ko,useState as So}from"react";import{scaleTime as wo}from"d3-scale";import{scaleTime as xo}from"d3-scale";var Mo=/(-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?),(-?(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)/gi,To=(e,t)=>({layout:null,layoutConfig:{bands:[],ribbons:[],showLabels:!0},issues:[],warnings:[],xScale:wo().domain(e).range([0,t])});import{useCallback as Po,useMemo as Co,useRef as Ao,useState as Io}from"react";import{useCallback as Oo,useMemo as No}from"react";var Ho=e=>{let{bands:t=[],ribbons:i=[],showLabels:o=!0,selectionDatum:n="raw"}=e.config,a=e.selection??null,r=[];for(let e of i){let t={__kind:"ribbon",data:e.rawDatum,id:e.id},i=!mt(t,a,n);r.push({type:"bezier",pathD:e.pathD,...e.bezier&&{bezierCache:e.bezier},style:{fill:e.fill,opacity:i?Math.min(e.opacity,.22):e.opacity,stroke:"none"},datum:t})}for(let e of t){if(!e.gradientStubs)continue;let t=!mt({__kind:"band",data:e.rawDatum,id:e.id},a,n);for(let i=0;i<e.gradientStubs.length;i++){let o=e.gradientStubs[i];r.push({type:"bezier",pathD:o.pathD,interactive:!1,style:{fill:e.fill,fillOpacity:t?.22:e.fillOpacity??.86,stroke:"none"},_gradient:{x0:o.x0,x1:o.x1,...null!=o.y0&&{y0:o.y0},...null!=o.y1&&{y1:o.y1},from:o.from,to:o.to},datum:{__kind:"band",data:e.rawDatum,id:`${e.id}__stub${i}`}})}}for(let e of t){let t=!!(e.gradientStubs&&e.gradientStubs.length>0),i={__kind:"band",data:e.rawDatum,id:e.id},o=!mt(i,a,n),l=e.fillOpacity??.86,s=e.hatchFill??e.fill;r.push({type:"bezier",pathD:e.pathD,style:{...t?{fill:"none"}:{fill:s,fillOpacity:o?.22:l},stroke:e.stroke??("string"==typeof e.fill?e.fill:"#666"),strokeWidth:e.strokeWidth??.5,...o&&t?{opacity:.22}:{}},datum:i})}let l=o?t.flatMap(e=>{let t=e.labelDeferred&&e.labelFullText?.trim(),i=e.labelText.trim().length>0,o=t&&a?.isActive&&mt({__kind:"band",data:e.rawDatum,id:e.id},a,n),r=i?e.labelText:o?e.labelFullText:"";return r.trim()?[{x:e.labelX,y:e.labelY,text:r,anchor:e.labelAnchor??"end",baseline:e.labelBaseline??"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:r,labels:l}};import{Fragment as Lo,jsx as Bo,jsxs as Do}from"react/jsx-runtime";import{jsx as Eo,jsxs as Fo}from"react/jsx-runtime";var Ro=/* @__PURE__ */qt(/* @__PURE__ */no(function(t,i){Ht();let{nodes:o,edges:n,domain:a,axisTicks:l,nodeIdAccessor:s="id",nodeLabel:d,sourceAccessor:c="source",targetAccessor:m="target",valueAccessor:h="value",startTimeAccessor:f="startTime",endTimeAccessor:p="endTime",systemInTimeAccessor:b,systemOutTimeAccessor:y,xExtentAccessor:v="xExtent",groupBy:k,edgeIdAccessor:S="id",colorBy:w,colorScheme:x,showLegend:M,legendPosition:T="right",orientation:P="horizontal",pairing:C="temporal",packing:A="reuse",laneOrder:I="crossing-min",maxValueScale:O,lanePlacement:N="stack",nodeSizing:H="temporal",groupPadding:L=0,ribbonLane:B="both",ribbonMinRun:D=0,lifetimeMode:E="half",showLaneRails:F=!1,showQualityReadout:R=!1,showLabels:z=!0,labelPriorityAccessor:W,maxLabels:$,selectionDatum:j="raw",styleRules:_,layoutExecution:Y="auto",layoutWorkerThreshold:X,layoutLoadingContent:G,onLayoutStateChange:q,width:V=600,height:K=400,margin:Q,title:U,description:Z,summary:J,accessibleTable:ee,responsiveWidth:te,responsiveHeight:ie,loading:oe,loadingContent:ne,emptyContent:ae,edgeOpacity:re=.35,timeFormat:le,valueFormat:se,tooltip:de,enableHover:ce=!0,onObservation:ue,onClick:ge,selection:me,linkedHover:he,showParticles:fe=!1,particleStyle:pe,chartId:be,frameProps:ye={}}=t,ve=ro(null),ke=ro(null),{rawNodes:Se,rawEdges:we,frameRef:xe,getNodeId:Me,getEdgeId:Te}=dt({ref:i,rawNodesProp:o,rawEdgesProp:n,nodeIdAccessor:s,edgeIdAccessor:S,sourceAccessor:c,targetAccessor:m,scalesRef:ve,layoutSnapshotRef:ke}),{nodes:Pe,edges:Ce,domain:Ae,rawNodeById:Ie}=ao(()=>{let e=(Se??[]).map(e=>{let t=Me(e),i=d?st(d,e):t,o={id:t,label:null==i?t:String(i),__raw:e},n=k?st(k,e):null;null!=n&&""!==String(n)&&(o.group=String(n));let a=v?st(v,e):null;if(Array.isArray(a)&&2===a.length){let e=u(a[0]),t=u(a[1]);Number.isFinite(e)&&Number.isFinite(t)&&(o.xExtent=[e,t])}return o}),t=(we??[]).map((e,t)=>{let i={id:Te(e,t),source:String(st(c,e)),target:String(st(m,e)),value:Number(st(h,e)),startTime:u(st(f,e)),endTime:u(st(p,e)),__raw:e};if(b){let t=u(st(b,e));Number.isFinite(t)&&(i.systemInTime=t)}if(y){let t=u(st(y,e));Number.isFinite(t)&&(i.systemOutTime=t)}return i}),i=[u(a[0]),u(a[1])],o=/* @__PURE__ */new Map;for(let t of e)null!=t.__raw&&o.set(t.id,t.__raw);return{nodes:e,edges:t,domain:i,rawNodeById:o}},[Se,we,a,Me,Te,d,v,k,c,m,h,f,p,b,y]),Oe=e({nodes:Se,edges:we,inferNodes:!1,nodeIdAccessor:s,sourceAccessor:c,targetAccessor:m,colorBy:w,colorScheme:x,showLegend:!1,legendPosition:T,frameLegend:ye,selection:me,linkedHover:he,onObservation:ue,onClick:ge?(e,t)=>{ht(e)?ge(e.data,t):ge(e,t)}:void 0,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,chartType:"ProcessSankey",chartId:be,marginDefaults:Re(!!U,R,void 0===l||l.length>0,P),userMargin:Q,width:V,height:K,hasTitle:!!U,loading:oe,loadingContent:ne,emptyContent:ae}),Ne=Object.hasOwn(ye,"legend"),He=!Ne&&(M??!!w)&&!!w,Le=lo((e,t)=>{if(w&&Se){let t=Ie.get(e);if(t)return Si(t,w,Oe.colorScale)}return Oe.effectivePalette[t%Oe.effectivePalette.length]||"#475569"},[w,Se,Ie,Oe.colorScale,Oe.effectivePalette]),Be=ao(()=>{if(!He||!w)return;let e=/* @__PURE__ */new Map;(Se??[]).forEach((t,i)=>{let o=st(w,t),n=null==o?"":String(o);!n||e.has(n)||e.set(n,{label:n,color:Le(Me(t),i)})});let t=Array.from(e.values());return 0===t.length?void 0:{legendGroups:[{type:"fill",label:"",items:t,styleFn:e=>{let t=e.color||"#333";return{fill:t,stroke:t}}}]}},[He,w,Se,Le,Me]),De=Ne?ye.legend:Be,Ee=ao(()=>{let e={...Oe.margin};if(De){let t={...e},i="right"===Oe.legendPosition||"left"===Oe.legendPosition?140:"top"===Oe.legendPosition?50:80;fi(e,{legend:De,position:Oe.legendPosition,size:[V,K],hasTitle:!!U,legendLayout:ye.legendLayout,minimumMargin:i}),hi(e,t,[V,K],Oe.legendPosition)}return e},[Oe.margin,Oe.legendPosition,De,V,K,U,ye.legendLayout]),Fe=V-Ee.left-Ee.right,We=K-Ee.top-Ee.bottom,$e="vertical"===P?We:Fe,je=lt(ao(()=>Fe<=0||We<=0?null:{nodes:Pe,edges:Ce,domain:Ae,plotW:Fe,plotH:We,orientation:P,ribbonLane:B,ribbonMinRun:D,edgeOpacity:"function"==typeof re?e=>re(e):re,colorOf:Le,showLabels:z,labelPriorityAccessor:W,maxLabels:$,selectionDatum:j,styleRules:_,usageMode:"push",colorBy:w,valueAccessor:h,layoutOpts:{pairing:C,packing:A,laneOrder:I,lifetimeMode:E,maxValueScale:O,lanePlacement:N,nodeSizing:H,groupPadding:L}},[Pe,Ce,Ae,Fe,We,P,B,D,re,Le,z,W,$,j,_,w,h,C,A,I,E,O,N,H,L]),{execution:Y,workerThreshold:X}),{issues:_e,warnings:Ye,layout:Xe,xScale:Ge}=je,qe=je.layoutConfig,Ve=je.status;ve.current=Xe?{time:Ge,centerlines:Xe.centerlines}:{time:Ge},ke.current=Xe?{layout:Xe,nodes:Pe,edges:Ce,bands:qe.bands,ribbons:qe.ribbons,warnings:Ye,status:Ve}:null;let Ke=ro(q);Ke.current=q,so(()=>{Ke.current?.(Ve)},[Ve]),so(()=>{0!==Ye.length&&console.warn("ProcessSankey warnings:",Ye.map(r).join("; "))},[Ye]);let Qe=void 0!==De&&!Object.hasOwn(ye,"margin"),Ue=ft({tooltip:de,enableHover:ce,layout:Xe,dateDomain:g(a),nodeLabel:d,timeFormat:le,valueFormat:se,sourceAccessor:c,targetAccessor:m,valueAccessor:h,startTimeAccessor:f,endTimeAccessor:p}),Ze=ao(()=>{if(!Xe)return null;let e=Ye.map(e=>r(e));return ze({layout:Xe,nodes:Pe,orientation:P,plotW:Fe,plotH:We,timelineExtent:$e,domain:a,axisTicks:l,showQualityReadout:R,showLaneRails:F,warnings:e,timeFormat:le?e=>le(e):void 0,colorOf:Le,toTime:u,xScale:e=>Number(Ge(e))})},[Xe,Pe,P,Fe,We,$e,a,l,R,F,Ye,le,Le,Ge]),Je=ao(()=>(Se??[]).map(e=>({id:Me(e),data:e})),[Se,Me]),et=ao(()=>{let e=/* @__PURE__ */new Map;for(let t of qe.ribbons)t.bezier&&e.set(t.id,t.bezier);return e},[qe]),tt=ao(()=>(we??[]).map((e,t)=>{let i=Te(e,t),o=Number(st(h,e));return{id:i,source:String(st(c,e)),target:String(st(m,e)),value:Number.isFinite(o)?o:0,bezier:et.get(i),data:e}}),[we,Te,c,m,h,et]);return _e.length>0?/* @__PURE__ */Fo("svg",{width:V,height:K,role:"img","aria-label":U??"Process Sankey validation failed",children:[
|
|
39
|
-
/* @__PURE__ */Eo("text",{x:20,y:30,fontSize:13,fontWeight:600,fill:"var(--semiotic-danger, #dc2626)",children:"ProcessSankey: data invalid"}),_e.map((e,t)=>/* @__PURE__ */Eo("text",{x:20,y:56+18*t,fontSize:12,fill:"#64748b",children:`• ${r(e)}`},t))]}):Oe.loadingEl?Oe.loadingEl:Oe.emptyEl?Oe.emptyEl:/* @__PURE__ */Fo("div",{style:{position:"relative",width:V,height:K},children:["pending"===Ve&&!1!==G&&!Xe&&/* @__PURE__ */Eo("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:ci(!0,V,K,G)}),
|
|
40
|
-
/* @__PURE__ */Eo(Rt,{ref:xe,chartType:"force",nodes:Je,edges:tt,customNetworkLayout:Ho,layoutConfig:qe,size:[V,K],responsiveWidth:te,responsiveHeight:ie,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:Ee,title:U,description:Z??"Temporal process flow with lifetime-bounded node lanes, mass bands, and value-scaled ribbons.",summary:J,accessibleTable:ee,enableHover:ce,tooltipContent:!1===de?()=>null:Ue,backgroundGraphics:Ze,showParticles:fe,particleStyle:pe,legend:De,legendPosition:Oe.legendPosition,...Qe&&{__legendMarginReservedFor:De},...Yt({linkedHover:he,selection:me,onObservation:ue,onClick:ge,mobileInteraction:Oe.mobileInteraction,customHoverBehavior:Oe.customHoverBehavior,customClickBehavior:Oe.customClickBehavior,linkedHoverInClickPredicate:!1}),chartId:be,colorScheme:Array.isArray(x)?x:void 0,layoutSelection:Oe.effectiveSelectionHook,perspective:t.perspective,...ye})]})}),"ProcessSankey");import{useMemo as zo}from"react";import{jsx as Wo}from"react/jsx-runtime";var $o=()=>({stroke:"#999",strokeWidth:1,fill:"none"}),jo=/* @__PURE__ */qt(function(t){zt("tree",wt),zt("cluster",wt),zt("treemap",wt),zt("circlepack",wt),zt("partition",wt),Ht();let i=ti(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}),{data:o,margin:n,className:a,layout:r="tree",orientation:l="vertical",childrenAccessor:s="children",valueAccessor:d="value",nodeIdAccessor:c="name",colorBy:u,colorScheme:g,colorByDepth:m=!1,styleRules:h,edgeStyle:f="curve",nodeLabel:p,nodeSize:b=5,tooltip:y,frameProps:v={},onObservation:k,onClick:S,chartId:w,selection:x,linkedHover:M,loading:T,loadingContent:P,legendInteraction:C,legendPosition:A,stroke:I,strokeWidth:O,opacity:N}=t,{width:H,height:L,enableHover:B,showLegend:D,showLabels:E=!0,title:F,description:R,summary:z,accessibleTable:W}=i,$=e({nodes:zo(()=>Tt(o??null,s),[o,s]),edges:void 0,inferNodes:!1,colorBy:m?void 0:u,colorScheme:g,showLegend:D,legendPosition:A,legendInteraction:C,frameLegend:v,selection:x,linkedHover:M,onObservation:k,onClick:S,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"TreeDiagram",chartId:w,marginDefaults:i.marginDefaults,userMargin:n,width:H,height:L,hasTitle:!!F,loading:T,loadingContent:P}),j=zo(()=>pt({stroke:"black",strokeWidth:1},u,m,$.colorScale,$.themeCategorical,g),[u,m,$.colorScale,$.themeCategorical,g]),_=zo(()=>ii(u,d),[u,d]),Y=zo(()=>ni(j,h,_,e=>e.data||e),[j,h,_]),X=zo(()=>Xt(Y,{stroke:I,strokeWidth:O,opacity:N}),[Y,I,O,N]),G=zo(()=>xt(X,$.effectiveSelectionHook,$.resolvedSelection),[X,$.effectiveSelectionHook,$.resolvedSelection]),q=zo(()=>Xt($o,{stroke:I,strokeWidth:O,opacity:N}),[I,O,N]),V=zo(()=>Mt(q,$.effectiveSelectionHook,$.resolvedSelection),[q,$.effectiveSelectionHook,$.resolvedSelection]),K=Bt({componentName:"TreeDiagram",data:o});return K?/* @__PURE__ */Wo(ri,{componentName:"TreeDiagram",message:K,width:H,height:L}):$.loadingEl?$.loadingEl:/* @__PURE__ */Wo(si,{componentName:"TreeDiagram",width:H,height:L,children:/* @__PURE__ */Wo(Rt,{chartType:r,...null!=o&&{data:o},size:[H,L],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:$.margin,...$.legendBehaviorProps,nodeIDAccessor:c,childrenAccessor:s,hierarchySum:d,treeOrientation:l,edgeType:f,nodeStyle:G,edgeStyle:V,colorBy:u,colorScheme:$.effectivePalette,colorByDepth:m,nodeSize:b,nodeLabel:E?p||c:void 0,showLabels:E,enableHover:B,tooltipContent:!1===y?()=>null:ai(y)||void 0,...Yt({linkedHover:M,selection:x,onObservation:k,onClick:S,mobileInteraction:$.mobileInteraction,customHoverBehavior:$.customHoverBehavior,customClickBehavior:$.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:$.legend,legendPosition:$.legendPosition,...C&&"none"!==C&&{legendHoverBehavior:$.legendState.onLegendHover,legendClickBehavior:$.legendState.onLegendClick,legendHighlightedCategory:$.legendState.highlightedCategory,legendIsolatedCategories:$.legendState.isolatedCategories},className:a,title:F,description:R,summary:z,accessibleTable:W,...null!=t.animate&&{animate:t.animate},perspective:t.perspective,...v})})},"TreeDiagram");import{useMemo as _o,useCallback as Yo}from"react";import{jsx as Xo}from"react/jsx-runtime";var Go=/* @__PURE__ */qt(function(t){Ht(),zt("treemap",wt);let i=ti(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,linkedHover:t.linkedHover,mobileInteraction:t.mobileInteraction,mobileSemantics:t.mobileSemantics,responsiveRules:t.responsiveRules},{width:600,height:600}),{data:o,margin:n,className:a,childrenAccessor:r="children",valueAccessor:l="value",nodeIdAccessor:s="name",colorBy:d,colorScheme:c,colorByDepth:u=!1,styleRules:g,labelMode:m="leaf",nodeLabel:h,padding:f=4,paddingTop:p,nodeStyle:b,tooltip:y,frameProps:v={},selection:k,linkedHover:S,onObservation:w,onClick:x,chartId:M,loading:T,loadingContent:P,legendInteraction:C,legendPosition:A,stroke:I,strokeWidth:O,opacity:N}=t,{nodeStyle:H,...L}=v,{width:B,height:D,enableHover:E,showLegend:F,showLabels:R=!0,title:z,description:W,summary:$,accessibleTable:j}=i,_=e({nodes:_o(()=>Tt(o??null,r),[o,r]),edges:void 0,inferNodes:!1,colorBy:u?void 0:d,colorScheme:c,showLegend:F,legendPosition:A,legendInteraction:C,frameLegend:L,selection:k,linkedHover:S,onObservation:w,onClick:x,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"Treemap",chartId:M,marginDefaults:i.marginDefaults,userMargin:n,width:B,height:D,hasTitle:!!z,loading:T,loadingContent:P}),Y=_.customHoverBehavior,X=Yo(e=>{if(!e)return Y(null);let t=e.data||e;Y({data:t?.data||t})},[Y]),G=_o(()=>pt({stroke:"var(--semiotic-cell-border, var(--semiotic-border, #fff))",strokeWidth:1,strokeOpacity:.8},d,u,_.colorScale,_.themeCategorical,c),[d,u,_.colorScale,_.themeCategorical,c]),q=_o(()=>ii(d,l),[d,l]),V=_o(()=>ni(G,g,q,e=>e.data||e),[G,g,q]),K=_o(()=>b||H?e=>({...V(e),...H?H(e)??{}:{},...b?b(e)??{}:{}}):V,[V,b,H]),Q=_o(()=>Xt(K,{stroke:I,strokeWidth:O,opacity:N}),[K,I,O,N]),U=_o(()=>xt(Q,_.effectiveSelectionHook,_.resolvedSelection),[Q,_.effectiveSelectionHook,_.resolvedSelection]),Z=void 0!==p?p:!R||"parent"!==m&&"all"!==m?void 0:18,J=Bt({componentName:"Treemap",data:o});return J?/* @__PURE__ */Xo(ri,{componentName:"Treemap",message:J,width:B,height:D}):_.loadingEl?_.loadingEl:/* @__PURE__ */Xo(si,{componentName:"Treemap",width:B,height:D,children:/* @__PURE__ */Xo(Rt,{chartType:"treemap",...null!=o&&{data:o},size:[B,D],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:_.margin,..._.legendBehaviorProps,nodeIDAccessor:s,childrenAccessor:r,hierarchySum:l,padding:f,paddingTop:Z,nodeStyle:U,colorBy:d,colorScheme:_.effectivePalette,colorByDepth:u,nodeLabel:R?h||s:void 0,showLabels:R,labelMode:m,enableHover:E,tooltipContent:!1===y?()=>null:ai(y)||void 0,...Yt({linkedHover:S,selection:k,onObservation:w,onClick:x,mobileInteraction:_.mobileInteraction,customHoverBehavior:X,customClickBehavior:_.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:_.legend,legendPosition:_.legendPosition,...C&&"none"!==C&&{legendHoverBehavior:_.legendState.onLegendHover,legendClickBehavior:_.legendState.onLegendClick,legendHighlightedCategory:_.legendState.highlightedCategory,legendIsolatedCategories:_.legendState.isolatedCategories},className:a,title:z,description:W,summary:$,accessibleTable:j,...null!=t.animate&&{animate:t.animate},perspective:t.perspective,...L})})},"Treemap");import{useMemo as qo}from"react";import{jsx as Vo}from"react/jsx-runtime";var Ko=/* @__PURE__ */qt(function(t){zt("circlepack",wt),Ht();let i=ti(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}),{data:o,margin:n,className:a,childrenAccessor:r="children",valueAccessor:l="value",nodeIdAccessor:s="name",colorBy:d,colorScheme:c,colorByDepth:u=!1,styleRules:g,nodeLabel:m,circleOpacity:h=.7,padding:f=4,tooltip:p,frameProps:b={},onObservation:y,onClick:v,chartId:k,selection:S,linkedHover:w,loading:x,loadingContent:M,legendInteraction:T,legendPosition:P,stroke:C,strokeWidth:A,opacity:I}=t,{width:O,height:N,enableHover:H,showLegend:L,showLabels:B=!0,title:D,description:E,summary:F,accessibleTable:R}=i,z=e({nodes:qo(()=>Tt(o??null,r),[o,r]),edges:void 0,inferNodes:!1,colorBy:u?void 0:d,colorScheme:c,showLegend:L,legendPosition:P,legendInteraction:T,frameLegend:b,selection:S,linkedHover:w,onObservation:y,onClick:v,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"CirclePack",chartId:k,marginDefaults:i.marginDefaults,userMargin:n,width:O,height:N,hasTitle:!!D,loading:x,loadingContent:M}),W=qo(()=>pt({stroke:"currentColor",strokeWidth:1,strokeOpacity:.3,fillOpacity:h},d,u,z.colorScale,z.themeCategorical,c),[d,u,z.colorScale,h,z.themeCategorical,c]),$=qo(()=>ii(d,l),[d,l]),j=qo(()=>ni(W,g,$,e=>e.data||e),[W,g,$]),_=qo(()=>Xt(j,{stroke:C,strokeWidth:A,opacity:I}),[j,C,A,I]),Y=qo(()=>xt(_,z.effectiveSelectionHook,z.resolvedSelection),[_,z.effectiveSelectionHook,z.resolvedSelection]),X=Bt({componentName:"CirclePack",data:o});return X?/* @__PURE__ */Vo(ri,{componentName:"CirclePack",message:X,width:O,height:N}):z.loadingEl?z.loadingEl:/* @__PURE__ */Vo(si,{componentName:"CirclePack",width:O,height:N,children:/* @__PURE__ */Vo(Rt,{chartType:"circlepack",...null!=o&&{data:o},size:[O,N],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:z.margin,...z.legendBehaviorProps,nodeIDAccessor:s,childrenAccessor:r,hierarchySum:l,padding:f,nodeStyle:Y,colorBy:d,colorScheme:z.effectivePalette,colorByDepth:u,nodeLabel:B?m||s:void 0,showLabels:B,enableHover:H,tooltipContent:!1===p?()=>null:ai(p)||void 0,...Yt({linkedHover:w,selection:S,onObservation:y,onClick:v,mobileInteraction:z.mobileInteraction,customHoverBehavior:z.customHoverBehavior,customClickBehavior:z.customClickBehavior,linkedHoverInClickPredicate:!1}),legend:z.legend,legendPosition:z.legendPosition,...T&&"none"!==T&&{legendHoverBehavior:z.legendState.onLegendHover,legendClickBehavior:z.legendState.onLegendClick,legendHighlightedCategory:z.legendState.highlightedCategory,legendIsolatedCategories:z.legendState.isolatedCategories},className:a,title:D,description:E,summary:F,accessibleTable:R,...null!=t.animate&&{animate:t.animate},perspective:t.perspective,...b})})},"CirclePack");import{useMemo as Qo}from"react";import{jsx as Uo}from"react/jsx-runtime";var Zo=ki,Jo=/* @__PURE__ */qt(function(t){zt("orbit",At),Ht();let i=ti(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}),{data:o,margin:n,className:a,childrenAccessor:r="children",nodeIdAccessor:l="name",colorBy:s,colorScheme:d,colorByDepth:c=!1,styleRules:u,orbitMode:g="flat",orbitSize:m=2.95,speed:h=.25,revolution:f,revolutionStyle:p,eccentricity:b=1,showRings:y=!0,nodeRadius:v=6,showLabels:k=!1,animated:S=!0,tooltip:w,foregroundGraphics:x,annotations:M,frameProps:T={},onObservation:P,onClick:C,chartId:A,selection:I,linkedHover:O,loading:N,loadingContent:H,legendPosition:L,legendInteraction:B,stroke:D,strokeWidth:E,opacity:F}=t,{width:R,height:z,enableHover:W,showLegend:$,title:j,description:_,summary:Y,accessibleTable:X}=i,G=e({nodes:Qo(()=>Tt(o,r),[o,r]),edges:void 0,inferNodes:!1,colorBy:c?void 0:s,colorScheme:d,showLegend:$,legendPosition:L,legendInteraction:B,frameLegend:T,selection:I,linkedHover:O,onObservation:P,onClick:C,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"OrbitDiagram",chartId:A,marginDefaults:mi(i),userMargin:n,width:R,height:z,hasTitle:!!j,loading:N,loadingContent:H}),q=Qo(()=>/* @__PURE__ */new Map,[]),{colorScale:V,customClickBehavior:K,customHoverBehavior:Q,themeCategorical:U}=G,Z=Qo(()=>{if(Array.isArray(d))return d;let e=bi[d];return Array.isArray(e)?e:yi},[d]),J=Qo(()=>e=>{let t={stroke:"#fff",strokeWidth:1},i=0===(e.depth??0);return t.fill=c?i?Z[0]:Zo[(e.depth||0)%Zo.length]:s?Si(e.data||e,s,V):wi(void 0,U,d,void 0,q),t.opacity=i?1:.85,t},[s,c,V,Z,U,d,q]),ee=Qo(()=>ii(s,"value"),[s]),te=Qo(()=>ni(J,u,ee,e=>e.data||e),[J,u,ee]),ie=Qo(()=>Xt(te,{stroke:D,strokeWidth:E,opacity:F}),[te,D,E,F]),oe=Qo(()=>xt(ie,G.effectiveSelectionHook,G.resolvedSelection),[ie,G.effectiveSelectionHook,G.resolvedSelection]),ne=Qo(()=>()=>({stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1}),[]),ae=Qo(()=>e=>{e&&e.data&&void 0!==e.data.data?Q({...e,data:e.data.data}):Q(e)},[Q]),re=Qo(()=>e=>{e&&e.data&&void 0!==e.data.data?K({...e,data:e.data.data}):K(e)},[K]),le=Bt({componentName:"OrbitDiagram",data:o});return le?/* @__PURE__ */Uo(ri,{componentName:"OrbitDiagram",message:le,width:R,height:z}):G.loadingEl?G.loadingEl:/* @__PURE__ */Uo(si,{componentName:"OrbitDiagram",width:R,height:z,children:/* @__PURE__ */Uo(Rt,{chartType:"orbit",...null!=o&&{data:o},size:[R,z],responsiveWidth:t.responsiveWidth,responsiveHeight:t.responsiveHeight,maxDevicePixelRatio:t.maxDevicePixelRatio,margin:G.margin,...G.legendBehaviorProps,nodeIDAccessor:l,childrenAccessor:r,nodeStyle:oe,edgeStyle:ne,colorBy:s,colorScheme:G.effectivePalette,colorByDepth:c,nodeSize:v,nodeLabel:k?l:void 0,showLabels:k,enableHover:!S&&W,tooltipContent:S?void 0:!1===w?()=>null:ai(w)||void 0,...Yt({linkedHover:O,selection:I,onObservation:P,onClick:C,mobileInteraction:G.mobileInteraction,customHoverBehavior:ae,customClickBehavior:re,linkedHoverInClickPredicate:!1}),legend:G.legend,legendPosition:G.legendPosition,...B&&"none"!==B&&{legendHoverBehavior:G.legendState.onLegendHover,legendClickBehavior:G.legendState.onLegendClick,legendHighlightedCategory:G.legendState.highlightedCategory,legendIsolatedCategories:G.legendState.isolatedCategories},foregroundGraphics:x,annotations:M,className:a,title:j,description:_,summary:Y,orbitMode:g,orbitSize:m,orbitSpeed:h,orbitRevolution:f,orbitRevolutionStyle:p,orbitEccentricity:b,orbitShowRings:y,orbitAnimated:S,accessibleTable:X,...null!=t.animate&&{animate:t.animate},perspective:t.perspective,...T})})},"OrbitDiagram");import{forwardRef as en,useMemo as tn}from"react";import{jsx as on}from"react/jsx-runtime";var nn=/* @__PURE__ */qt(/* @__PURE__ */en(function(e,t){Ht();let{nodes:i,edges:o,layout:n,layoutConfig:a,onLayoutError:r,nodeIDAccessor:l="id",sourceAccessor:s="source",targetAccessor:d="target",margin:c,className:u,colorBy:g,colorScheme:m,tooltip:h,selection:f,linkedHover:p,onObservation:b,onClick:y,chartId:v,annotations:k,autoPlaceAnnotations:S,frameProps:w={}}=e,{frameRef:x,resolved:M,normalizedMargin:T}=Lt({imperativeRef:t,imperativeVariant:"network",margin:c,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}),P=tn(()=>li(i),[i]),C=tn(()=>li(o),[o]),A=tn(()=>void 0===i&&void 0===o?void 0:[...P,...C],[o,i,C,P]),I=gi(e.mobileInteraction,{mode:e.mode,width:M.width,mobileSemantics:e.mobileSemantics}),{customHoverBehavior:O,customClickBehavior:N,activeSelectionHook:H}=ei({selection:f,linkedHover:p,fallbackFields:"string"==typeof g?[g]:[],onObservation:b,onClick:y,chartType:"NetworkCustomChart",chartId:v,colorByField:"string"==typeof g?g:void 0,mobileInteraction:I}),L=tn(()=>H?.isActive?{isActive:!0,predicate:H.predicate}:null,[H?.isActive,H?.predicate]),{width:B,height:D,enableHover:E,title:F,description:R,summary:z,accessibleTable:W}=M,$=tn(()=>ai(h),[h]),j=ci(e.loading,B,D,e.loadingContent),_=j?null:di(A,B,D,e.emptyContent);if(j||_)return j||_;let Y={chartType:"force",...null!=i&&{nodes:P},...null!=o&&{edges:C},customNetworkLayout:n,layoutConfig:a,onLayoutError:r,nodeIDAccessor:l,sourceAccessor:s,targetAccessor:d,colorBy:g,colorScheme:m,size:[B,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:T,enableHover:E,..._t({title:F,description:R,summary:z,accessibleTable:W,className:u,animate:e.animate,maxDevicePixelRatio:e.maxDevicePixelRatio,autoPlaceAnnotations:S}),...!1===h?{tooltipContent:()=>null}:$?{tooltipContent:$}:{},...Yt({forceHoverBehavior:null!=v,forceClickBehavior:null!=v,linkedHover:p,selection:f,onObservation:b,onClick:y,mobileInteraction:I,customHoverBehavior:O,customClickBehavior:N,linkedHoverInClickPredicate:!1}),layoutSelection:L,perspective:e.perspective,...null!=k&&{annotations:k},...w};/* @__PURE__ */
|
|
41
|
-
return on(si,{componentName:"NetworkCustomChart",width:B,height:D,children:/* @__PURE__ */on(Rt,{ref:x,...Y})})}),"NetworkCustomChart");import{forceCenter as an,forceCollide as rn,forceLink as ln,forceManyBody as sn,forceSimulation as dn,forceX as cn,forceY as un}from"d3-force";export{Li as a,Ri as b,_i as c,n as d,r as e,l as f,s as g,d as h,c as i,u as j,Ro as k,jo as l,Go as m,Ko as n,Jo as o,nn as p,bt as q};
|
package/dist/c-SN2D6QMH.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as t,c as e,h as r}from"./c-JY4ZN6AO.min.js";var l=Math.PI/180,i={isometric:{rotation:45,tilt:/* @__PURE__ */Math.asin(/* @__PURE__ */Math.tan(30*l))/l},pixel:{rotation:45,tilt:30},dimetric:{rotation:45,tilt:20},military:{rotation:45,tilt:90,verticalScale:1},cabinet:{rotation:45,tilt:90,verticalScale:1}},n=(t,e)=>"number"==typeof t&&Number.isFinite(t)?t:e,a=/* @__PURE__ */new Set;function o(t){if(!t)return null;let e="string"==typeof t?{type:t}:t,r=e.type??"isometric";if("flat"===r)return null;if(!Object.prototype.hasOwnProperty.call(i,r))return"production"!==process.env.NODE_ENV&&!a.has(String(r))&&(a.add(String(r)),console.warn(`[Semiotic] Unknown perspective "${String(r)}"; drawing flat. Use "isometric", "pixel", "dimetric", "military", "cabinet" or "flat".`)),null;let o,s,h=i[r],c=n(e.rotation,h.rotation)*l;if("cabinet"===r)o=[1,0,-.5*Math.cos(c),.5*Math.sin(c)],s=n(e.verticalScale,1);else{let t=Math.min(90,Math.max(1,n(e.tilt,h.tilt)))*l,r=Math.sin(t),i=Math.cos(c),a=Math.sin(c);o=[i,r*a,-a,r*i],s=n(e.verticalScale,null==e.tilt&&null!=h.verticalScale?h.verticalScale:Math.cos(t))}let u=e.origin;return{type:r,linear:o,verticalScale:Math.max(0,s),origin:[n(u?.[0],.5),n(u?.[1],.5)],fit:"none"===e.fit?"none":"contain",fitPadding:Math.max(0,n(e.fitPadding,12)),config:e}}var s=t=>Math.round(1e3*t)/1e3;function h(t,e,r,l=1,i=null){let[n,a,o,h,c,u]=e,f=n*h-a*o,p=(t,e,l=0)=>[n*t+o*e+c,a*t+h*e+u-r*l];return{type:t,matrix:e,lift:r,scale:l,bounds:i,project:p,unproject(t,e,l=0){let i=t-c,s=e+r*l-u;return Math.abs(f)<1e-12?[i,s]:[(h*i-o*s)/f,(n*s-a*i)/f]},depth:(t,e,r=0)=>a*t+h*e+u+.001*r,groundTransform:`matrix(${e.map(s).join(" ")})`,billboardTransform(t,e,r=0){let[l,i]=p(t,e,r);return`translate(${s(l)},${s(i)})`}}}var c=/* @__PURE__ */h("flat",[1,0,0,1,0,0],0);function u(t,e,r){if(r>=1)return e;if(r<=0)return t;let l=t.matrix.map((t,l)=>t+(e.matrix[l]-t)*r);return h(e.type,l,t.lift+(e.lift-t.lift)*r,t.scale+(e.scale-t.scale)*r,e.bounds)}var f=/[MmLlHhVvCcSsQqTtAaZz]/,p=/[MmLlHhVvCcSsQqTtAaZz]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g,y={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};function d(t,e,r,l,i,n,a,o,s){if(0===r||0===l||t===o&&e===s)return[[t,e,o,s,o,s]];r=Math.abs(r),l=Math.abs(l);let h=i*Math.PI/180,c=Math.cos(h),u=Math.sin(h),f=(t-o)/2,p=(e-s)/2,y=c*f+u*p,d=-u*f+c*p,m=y*y/(r*r)+d*d/(l*l);if(m>1){let t=Math.sqrt(m);r*=t,l*=t}let g=r*r*l*l-r*r*d*d-l*l*y*y,x=r*r*d*d+l*l*y*y,b=Math.sqrt(Math.max(0,g/x));n===a&&(b=-b);let M=b*r*d/l,k=-b*l*y/r,v=c*M-u*k+(t+o)/2,w=u*M+c*k+(e+s)/2,$=(t,e,r,l)=>Math.atan2(t*l-e*r,t*r+e*l),z=$(1,0,(y-M)/r,(d-k)/l),N=$((y-M)/r,(d-k)/l,(-y-M)/r,(-d-k)/l);!a&&N>0?N-=2*Math.PI:a&&N<0&&(N+=2*Math.PI);let S=Math.max(1,Math.ceil(Math.abs(N)/(Math.PI/2)-1e-9)),P=N/S,D=4/3*Math.tan(P/4),j=t=>[v+r*Math.cos(t)*c-l*Math.sin(t)*u,w+r*Math.cos(t)*u+l*Math.sin(t)*c],F=t=>[-r*Math.sin(t)*c-l*Math.cos(t)*u,-r*Math.sin(t)*u+l*Math.cos(t)*c],L=[],A=z;for(let t=0;t<S;t++){let e=A+P,[r,l]=j(A),[i,n]=t===S-1?[o,s]:j(e),[a,h]=F(A),[c,u]=F(e);L.push([r+D*a,l+D*h,i-D*c,n-D*u,i,n]),A=e}return L}function m(t){let e=t.match(p);if(!e)return[];let r=[],l=0,i="",n=0,a=0,o=0,s=0,h=null,c=null;for(;l<e.length;){if(f.test(e[l]))i=e[l++];else if(!i)return r;let t=i.toUpperCase(),u=i!==t,p=y[t];if("Z"===t){r.push({c:"Z",p:[]}),n=o,a=s,h=c=null,i="";continue}if(l+p>e.length)break;let m=e.slice(l,l+p).map(Number);if(l+=p,m.some(t=>!Number.isFinite(t)))break;let g=u?n:0,x=u?a:0,b=null,M=null;switch(t){case"M":n=m[0]+g,a=m[1]+x,o=n,s=a,r.push({c:"M",p:[n,a]}),i=u?"l":"L";break;case"L":n=m[0]+g,a=m[1]+x,r.push({c:"L",p:[n,a]});break;case"H":n=m[0]+g,r.push({c:"L",p:[n,a]});break;case"V":a=m[0]+(u?a:0),r.push({c:"L",p:[n,a]});break;case"C":{let t=[m[0]+g,m[1]+x,m[2]+g,m[3]+x,m[4]+g,m[5]+x];r.push({c:"C",p:t}),b=[t[2],t[3]],n=t[4],a=t[5];break}case"S":{let t=[h?2*n-h[0]:n,h?2*a-h[1]:a,m[0]+g,m[1]+x,m[2]+g,m[3]+x];r.push({c:"C",p:t}),b=[t[2],t[3]],n=t[4],a=t[5];break}case"Q":{let t=[m[0]+g,m[1]+x,m[2]+g,m[3]+x];r.push({c:"Q",p:t}),M=[t[0],t[1]],n=t[2],a=t[3];break}case"T":{let t=c?2*n-c[0]:n,e=c?2*a-c[1]:a,l=[t,e,m[0]+g,m[1]+x];r.push({c:"Q",p:l}),M=[t,e],n=l[2],a=l[3];break}case"A":{let t=m[5]+g,e=m[6]+x;for(let l of d(n,a,m[0],m[1],m[2],m[3],m[4],t,e))r.push({c:"C",p:l}),b=[l[2],l[3]];n=t,a=e;break}}h=b,c=M}return r}var g=t=>{let e=Math.round(100*t)/100;return Object.is(e,-0)?"0":String(e)};function x(t,e){let r="";for(let l of t){r+=l.c;for(let t=0;t<l.p.length;t+=2){let[i,n]=e?e(l.p[t],l.p[t+1]):[l.p[t],l.p[t+1]];r+=(t?" ":"")+g(i)+" "+g(n)}}return r}function b(t,e){for(let r of t)for(let t=0;t<r.p.length;t+=2)e(r.p[t],r.p[t+1])}function M(t){let e="";return t.forEach(([t,r],l)=>{e+=(l?"L":"M")+g(t)+" "+g(r)}),e+"Z"}function k(t,e=8){let r=[],l=0,i=0;for(let n of t){let t=n.p;if("M"===n.c){if(r.length)break;l=t[0],i=t[1],r.push([l,i])}else if("L"===n.c)l=t[0],i=t[1],r.push([l,i]);else if("Q"===n.c||"C"===n.c){for(let a=1;a<=e;a++){let o=a/e,s=1-o;r.push("Q"===n.c?[s*s*l+2*s*o*t[0]+o*o*t[2],s*s*i+2*s*o*t[1]+o*o*t[3]]:[s*s*s*l+3*s*s*o*t[0]+3*s*o*o*t[2]+o*o*o*t[4],s*s*s*i+3*s*s*o*t[1]+3*s*o*o*t[3]+o*o*o*t[5]])}l=t[t.length-2],i=t[t.length-1]}else if("Z"===n.c)break}let[n,a]=r[0]??[0,0],[o,s]=r[r.length-1]??[0,0];return r.length>1&&Math.abs(n-o)<1e-9&&Math.abs(a-s)<1e-9&&r.pop(),r}function v(t,e){let r=t.length;if(r<3||!(e>.05))return[];let l=0;for(let e=0;e<r;e++){let[i,n]=t[e],[a,o]=t[(e+1)%r];l+=i*o-a*n}let i=l>=0?1:-1,n=t.map((e,l)=>{let n=t[(l+1)%r],a=n[0]-e[0],o=n[1]-e[1],s=Math.hypot(a,o);if(s<1e-9)return null;let h=i*o/s;return-i*a/s<=.02?null:.04*Math.round(-6.5-4*h+1e-9)}),a=n.findIndex((t,e)=>t!==n[(e+r-1)%r]);a<0&&(a=0);let o=[],s=(l,i,n)=>{let a=[];for(let e of l)a.push(t[e]);a.push(t[(l[l.length-1]+1)%r]);let s=a.map(([t,r])=>[t,r+e]).reverse();o.push({pathD:M([...a,...s]),shade:i,depth:n??a.reduce((t,e)=>t+e[1],0)/a.length})},h=[],c=[],u=()=>{h.length&&s(h,n[h[0]]),h=[]},f=()=>{u();let t=new Set(c.map(t=>n[t]));t.size>1&&s(c,Math.min(...t),-1/0),c=[]};for(let t=0;t<r;t++){let e=(a+t)%r,l=n[e];null!=l?(h.length&&n[h[0]]!==l&&u(),h.push(e),c.push(e)):f()}return f(),o.sort((t,e)=>t.depth-e.depth).map(({pathD:t,shade:e})=>({pathD:t,shade:Math.round(100*e)/100}))}var w=class{constructor(t){this.resolved=t,this.sx=[],this.sy=[],this.left=[],this.right=[],this.top=[],this.bottom=[]}add(t,e,r=0,l=0,i=l,n=l,a=n){let[o,s,h,c]=this.resolved.linear,u=o*t+h*e,f=s*t+c*e-this.resolved.verticalScale*r;!Number.isFinite(u)||!Number.isFinite(f)||(this.sx.push(u),this.sy.push(f),this.left.push(l),this.right.push(i),this.top.push(n),this.bottom.push(a))}get size(){return this.sx.length}};function $(t,e,r,l){let i=1/0,n=-1/0;for(let a=0;a<t.length;a++){let o=l*t[a];o-e[a]<i&&(i=o-e[a]),o+r[a]>n&&(n=o+r[a])}return[i,n]}function z(t,e,r){let[l,i]=e,[n,a,o,s]=t.linear,c=t.verticalScale;if("none"===t.fit||0===r.size){let e=t.origin[0]*l,u=t.origin[1]*i,f=h(t.type,[n,a,o,s,e-n*e-o*u,u-a*e-s*u],c);return 0===r.size?f:h(t.type,f.matrix,c,1,N(f,r,1))}let u=t.fitPadding,f=Math.max(1,l-2*u),p=Math.max(1,i-2*u),y=t=>{let[e,l]=$(r.sx,r.left,r.right,t),[i,n]=$(r.sy,r.top,r.bottom,t);return l-e<=f&&n-i<=p},d=1;if(!y(1)){let t=0,e=1;for(let r=0;r<32;r++){let r=(t+e)/2;y(r)?t=r:e=r}d=Math.max(t,.001)}let[m,g]=$(r.sx,r.left,r.right,d),[x,b]=$(r.sy,r.top,r.bottom,d),M=l/2-(m+g)/2,k=i/2-(x+b)/2;return h(t.type,[n*d,a*d,o*d,s*d,M,k],c*d,d,{x:m+M,y:x+k,width:g-m,height:b-x})}function N(t,e,r){let[l,i]=$(e.sx,e.left,e.right,r),[n,a]=$(e.sy,e.top,e.bottom,r);return{x:l+t.matrix[4],y:n+t.matrix[5],width:i-l,height:a-n}}function S(t){if(!t||"object"!=typeof t)return null;let e=t.data;return e&&"object"==typeof e?e:t}function P(t,e){if(null==t)return NaN;if("number"==typeof t)return t;let r,l=S(e);if(!l)return NaN;"function"==typeof t?r=t(l):(r=l[t],null==r&&e&&"object"==typeof e&&(r=e[t]));let i="number"==typeof r?r:Number(r);return Number.isFinite(i)?i:NaN}var D=null,j=null;function F(t){}function L(t){D=t}function A(){return D}function C(t){let e=t.edges?.route;return!!(t.ground?.grid||t.ground?.plate||t.regions?.length||e&&"layout"!==e||"extrude"===t.marks||"function"==typeof t.marks)}function R(){return D?Promise.resolve():(j??(j=import("./c-PWPJNYQP.min.js").then(t=>{D=t.networkPerspectiveExtras}).catch(t=>{throw j=null,t})),j)}function I(t,e,r){let l=.5522847498*r;return[{c:"M",p:[t+r,e]},{c:"C",p:[t+r,e+l,t+l,e+r,t,e+r]},{c:"C",p:[t-l,e+r,t-r,e+l,t-r,e]},{c:"C",p:[t-r,e-l,t-l,e-r,t,e-r]},{c:"C",p:[t+l,e-r,t+r,e-l,t+r,e]},{c:"Z",p:[]}]}function Z(t){let e=Math.min(t.startAngle,t.endAngle),r=Math.min(2*Math.PI-1e-6,Math.abs(t.endAngle-t.startAngle)),l=(e,r)=>`${t.cx+e*Math.cos(r)} ${t.cy+e*Math.sin(r)}`,i=r>Math.PI?1:0,n=e+r,a=t.innerR>0?`L${l(t.innerR,n)}A${t.innerR} ${t.innerR} 0 ${i} 0 ${l(t.innerR,e)}`:`L${t.cx} ${t.cy}`;return m(`M${l(t.outerR,e)}A${t.outerR} ${t.outerR} 0 ${i} 1 ${l(t.outerR,n)}${a}Z`)}function E(t){return[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]]]}function O(t){let e=t.datum;return[t.id,e?.id,e?.data?.id].filter(t=>null!=t&&""!==t).map(String)}function Q(t){if("rect"===t.type)return[t.x,t.y,t.x+t.w,t.y+t.h];let r="circle"===t.type?t.r:"arc"===t.type?t.outerR:"symbol"===t.type?e(t.size):t.size/2;return[t.cx-r,t.cy-r,t.cx+r,t.cy+r]}function T(t,e,r){if("arc"===t.type)return"ground";if("glyph"===t.type)return"billboard";if("symbol"===t.type)return"billboard"===e?"billboard":"token";if("circle"===t.type)return"billboard"===e||"ground"===e?e:e||"circlepack"!==r?"token":"ground";if(!e||"token"===e)return"ground";if("extrude"===e){let e=t.datum;if(e?.children?.length||e?.data?.children?.length)return"ground"}return e}function _(t){let e=t.thickness;return"number"==typeof e&&Number.isFinite(e)?Math.max(0,e):6}var W=/* @__PURE__ */new Set(["treemap","circlepack"]);function q(t,e,r,l,i){let n=t.map(t=>i(t)?null==e?l:P(e,t.node.datum):NaN);if(null==e||"number"==typeof e)return n.map(t=>Number.isFinite(t)?t:0);let a=n.reduce((t,e)=>Number.isFinite(e)?Math.max(t,Math.abs(e)):t,0),o="number"==typeof r&&Number.isFinite(r)?r:a>0?48/a:0;return n.map(t=>Number.isFinite(t)?t*o:0)}function V(t,e){let r=Math.atan2(e,t);return r>Math.PI/2?r-Math.PI:r<=-Math.PI/2?r+Math.PI:r}function H(t){let e=t.fontSize??11,r=String(t.text??"").length*e*.56,l="end"===t.anchor?r:"start"===t.anchor?0:r/2;return[l,r-l,.7*e,.7*e]}function Y(t){if(null==t)return null;if("object"!=typeof t)return String(t);let e=t.id;return null==e?null:String(e)}function U(l){let{perspective:i,size:n,chartType:a,theme:o={}}=l,s=i.config,h=A(),c="feet"===s.anchor,u=s.glyph,f=_(s),p=l.sceneNodes.map((t,e)=>{let r=T(t,"function"==typeof s.marks?s.marks(t):s.marks,a);"extrude"===r&&!h&&(r="ground");let l=Q(t),i="billboard"!==r&&"token"!==r||!u||"circle"!==t.type&&"symbol"!==t.type?void 0:("function"==typeof u?u(S(t.datum)??{}):u)??void 0;return i&&(r="billboard"),{node:t,mode:r,z:0,lift:0,h:0,t:0,gx:"rect"===t.type?t.x+t.w/2:t.cx,gy:"rect"===t.type?t.y+t.h/2:t.cy,box:l,index:e,glyph:i}}),y=q(p,s.elevation,s.elevationScale,0,()=>!0),d=q(p,s.extrude,s.extrudeScale,24,t=>"extrude"===t.mode),g=W.has(a??"");p.forEach((t,e)=>{t.z=t.lift=y[e],t.t="billboard"===t.mode?0:f,t.h="extrude"===t.mode?Math.max(f,d[e]):0,g&&"billboard"!==t.mode&&(t.z+=(t.node.depth??0)*f)});let $=h?.plan(p,s,n,o)??null,N=t=>t.z+("extrude"===t.mode?t.h:t.t),P=t=>s.glyphSize??Math.max(16,2.8*("circle"===t.node.type?t.node.r:e(t.node.size))),D=new w(i),j=(t,e,r,l,i,n,a)=>D.add(t,e,r,l,i,n,a),[F,L,C,R]=i.linear;for(let t of p){let{node:e,mode:l,z:i}=t,n=N(t);if("billboard"===l){if(t.glyph||"glyph"===e.type){let l=r(t.glyph??e.glyph,t.glyph?P(t):e.size);j(t.gx,t.gy,i,-l.offsetX,l.offsetX+l.width,-l.offsetY,l.offsetY+l.height)}else if("rect"===e.type)j(t.gx,t.gy,i,e.w/2,e.w/2,e.h/2,e.h/2);else{let e=(t.box[2]-t.box[0])/2;j(t.gx,t.gy,i,e,e,c?2*e:e,c?0:e)}t.lift>0&&j(t.gx,t.gy,i-t.lift)}else if("token"===l){let e=(t.box[2]-t.box[0])/2;j(t.gx,t.gy,n,e,e,e,e),j(t.gx,t.gy,i,e,e,e,e),t.lift>0&&j(t.gx,t.gy,i-t.lift)}else if("circle"===e.type)for(let t of[Math.atan2(C,F),Math.atan2(R,L)]){let r=e.r*Math.cos(t),l=e.r*Math.sin(t);for(let t of[i,n])j(e.cx+r,e.cy+l,t),j(e.cx-r,e.cy-l,t)}else if("arc"===e.type)for(let t=0;t<=12;t++){let r=e.startAngle+(e.endAngle-e.startAngle)*t/12;j(e.cx+e.outerR*Math.cos(r),e.cy+e.outerR*Math.sin(r),i),j(e.cx+e.outerR*Math.cos(r),e.cy+e.outerR*Math.sin(r),n)}else for(let[e,r]of E(t.box))j(e,r,i),j(e,r,n)}let U=s.edges?.elevation??"surface",J=/* @__PURE__ */new Map,X=/* @__PURE__ */new Map,G=/* @__PURE__ */new Map;for(let t of p){let e=`${t.gx}|${t.gy}`;J.has(e)||J.set(e,t),G.set(e,t);for(let e of O(t.node))X.has(e)||X.set(e,t)}let B=(t,e,r)=>{let l=Y(t),i=(null!=l?X.get(l):void 0)??(null!=e&&null!=r?G.get(`${e}|${r}`):void 0);return i?i.z-("nodes"===U?0:i.lift):0},K=t=>{if("number"==typeof U)return Number.isFinite(U)?[U,U]:[0,0];if("ground"===U||!J.size)return[0,0];let e=t.datum;return"line"===t.type?[B(e?.source,t.x1,t.y1),B(e?.target,t.x2,t.y2)]:[B(e?.source),B(e?.target)]},tt=/* @__PURE__ */new Map,et=[],rt=/* @__PURE__ */new Map,lt=([t,e],r)=>t+(e-t)*r;for(let t of l.sceneEdges){let[e,r]=K(t),l=[e,r];et.push(l);let i=(e+r)/2;if(rt.set(t.datum,"line"===t.type?l:[i,i]),"line"===t.type)for(let l of[0,f])j(t.x1,t.y1,e+l),j(t.x2,t.y2,r+l);else if(t.pathD){let l=m(t.pathD);tt.set(t,l),b(l,(t,l)=>{j(t,l,(e+r)/2),j(t,l,(e+r)/2+f)})}}$?.add(j);let it=p.filter(t=>"ground"===t.mode||"extrude"===t.mode),nt=l.labels.map(t=>{let[e,r,l,i]=H(t),n=t.anchorPoint;if(n){let a=J.get(`${n[0]}|${n[1]}`),o=t.x-n[0],s=t.y-n[1];return j(n[0],n[1],a?N(a):0,Math.max(0,e-o),Math.max(0,r+o),Math.max(0,l-s),Math.max(0,i+s)),{label:t,item:a,z:a?N(a):0,ox:o,oy:s}}let a=f,o=1/0;for(let e of it){let[r,l,i,n]=e.box,s=(i-r)*(n-l);t.x>=r&&t.x<=i&&t.y>=l&&t.y<=n&&s<o&&(o=s,a=N(e))}return j(t.x,t.y,a,e,r,l,i),{label:t,item:void 0,z:a,ox:0,oy:0}}),at=(l.htmlMarks??[]).map(t=>{let e=t.x+t.width/2,r=t.y+t.height/2,l=X.get(t.id)??J.get(`${e}|${r}`),i=l?e-l.gx:0,n=l?r-l.gy:0;return j(l?.gx??e,l?.gy??r,l?N(l):f,Math.max(0,t.width/2-i),Math.max(0,t.width/2+i),Math.max(0,t.height/2-n),Math.max(0,t.height/2+n)),{mark:t,item:l}});for(let t of l.bounds??[]){if(!t||!Number.isFinite(t.x)||!Number.isFinite(t.y))continue;let e=(t,e)=>"top"===t?f:Number.isFinite(t)?Number(t):e;if("extent"in t){let[r,l,i,n]=t.extent;j(t.x,t.y,e(t.z,f),r,l,i,n)}else if(Number.isFinite(t.width)&&Number.isFinite(t.height)){let r=e(t.z,0);for(let[e,l]of E([t.x,t.y,t.x+t.width,t.y+t.height]))j(e,l,r)}}let ot=z(i,n,D);return{frame:ot,emit:(e=ot)=>{let r=e.project,[i,n,a,u]=e.matrix,y=[],d=[],g=/* @__PURE__ */new Map,b=/* @__PURE__ */new Map,w=Math.hypot(i,a)||1,z=(t,e)=>[(i*t+a*e)/w,(n*t+u*e)/w],S=(t,l,i)=>{let n=(t,e)=>r(t,e,l+i),a=k(t).map(([t,e])=>n(t,e)),o=v(a,i*e.lift),s=i*e.lift,h=a.map(t=>t[0]),c=a.map(t=>t[1]),u=Math.min(...h),f=Math.min(...c);return{pathD:x(t,n),faces:o.length?o:void 0,bounds:[u,f,Math.max(...h)-u,Math.max(...c)+s-f]}};for(let l of p){let i,{node:n,mode:a,z:o}=l;if("extrude"===a&&h)i=h.extrude(l,e);else if("billboard"===a){let[t,e]=r(l.gx,l.gy,o);if(l.glyph&&"rect"!==n.type&&"arc"!==n.type)i={type:"glyph",cx:t,cy:e,size:P(l),glyph:l.glyph,color:"string"==typeof n.style.fill?n.style.fill:void 0,style:n.style,datum:n.datum,accessibleDatum:n.accessibleDatum,accessibility:n.accessibility,id:n.id,label:n.label,depth:n.depth};else if("rect"===n.type)i={...n,x:t-n.w/2,y:e-n.h/2,_hitPath:void 0};else{let r=c&&"glyph"!==n.type?(l.box[2]-l.box[0])/2:0;i={...n,cx:t,cy:e-r}}}else if("token"!==a||"circle"!==n.type&&"symbol"!==n.type)if("rect"===n.type){let t=n._hitPath,e=S(m(t?x(m(t.pathD),(e,r)=>[t.transform[0]+e*t.transform[2],t.transform[1]+r*t.transform[3]]):M(E(l.box))),o,l.t),[r,a,s,h]=e.bounds,c=e.pathD+(e.faces??[]).map(t=>t.pathD).join("");i={...n,x:r,y:a,w:Math.max(.001,s),h:Math.max(.001,h),pathD:e.pathD,faces:e.faces,_hitPath:{pathD:c,transform:[0,0,1,1],fill:!0,strokeWidth:t?.strokeWidth??0}}}else{let[t,e]=r(l.gx,l.gy,o+l.t),a=S("circle"===n.type?I(n.cx,n.cy,n.r):Z(n),o,l.t);i={...n,cx:t,cy:e,pathD:a.pathD,faces:a.faces}}else{let[a,s]=r(l.gx,l.gy,o+l.t),h="symbol"===n.type?n.rotation??0:0,c=Math.cos(h),u=Math.sin(h),f=(t,e)=>z(t*c-e*u,t*u+e*c),p="circle"===n.type?I(0,0,n.r):m(t(n.symbolType,n.size,n.path)),y=v(k(p,6).map(([t,e])=>{let[r,l]=f(t,e);return[a+r,s+l]}),l.t*e.lift);i="circle"===n.type?{...n,cx:a,cy:s,pathD:x(p,(t,e)=>{let[r,l]=f(t,e);return[a+r,s+l]}),faces:y.length?y:void 0,_perspectiveToken:!0}:{...n,cx:a,cy:s,rotation:0,path:x(p,f),faces:y.length?y:void 0}}g.set(l,i);let s="rect"===i.type?i.x+i.w/2:i.cx,u="rect"===i.type?i.y+i.h/2:i.cy;b.set(l,[s-l.gx,u-l.gy]),"ground"===a?y.push(i):d.push(l)}let D=!1===s.depthSort?d:d.some(t=>"extrude"===t.mode)&&h?h.sort(d,e):[...d].sort((t,r)=>e.depth(t.gx,t.gy,t.z)-e.depth(r.gx,r.gy,r.z)||t.index-r.index),j=y.concat(D.map(t=>g.get(t))),F=s.edges?.route,L=s.edgeShadow??!0,A=f>0&&!1!==L,C=[],R=/* @__PURE__ */new Map,O=t=>"string"==typeof t?""!==t&&"none"!==t&&"transparent"!==t:null!=t,Q=(t,e)=>{if(!A||(t.style.opacity??1)<=0)return;let r=t.style,l="bezier"===t.type||"ribbon"===t.type,i=r.strokeWidth??(l?.5:1),n=r.fillOpacity??("curved"===t.type?.1:r.opacity??.5);if("line"!==t.type&&O(r.fill)&&n>0)C.push(e);else if(O(r.stroke||(l?void 0:"#999"))&&(r.opacity??1)*(r.strokeOpacity??1)>0&&i>0){let t=R.get(i)??[];t.push(e),R.set(i,t)}},T=l.sceneEdges.map((t,e)=>{let l=et[e],[i,n]=l;if("line"===t.type){if(F&&"layout"!==F&&h){let e="orthogonal-rounded"===F,i=t=>(e,i,n)=>r(e,i,lt(l,n)+t),n=h.route(t,e,i(f));return A&&Q(t,h.route(t,e,i(0)).pathD),n}let[e,a]=r(t.x1,t.y1,i+f),[o,s]=r(t.x2,t.y2,n+f);if(A){let[e,l]=r(t.x1,t.y1,i),[a,o]=r(t.x2,t.y2,n);Q(t,`M${e} ${l}L${a} ${o}`)}return{...t,x1:e,y1:a,x2:o,y2:s}}let a=tt.get(t);if(!a)return t;let o=(i+n)/2;A&&Q(t,x(a,(t,e)=>r(t,e,o)));let s={...t,pathD:x(a,(t,e)=>r(t,e,o+f)),_cachedPath2D:void 0,_cachedPath2DSource:void 0};if("bezier"===s.type){s.bezierCache=void 0;let t=s._gradient;if(t){let[e,l]=r(t.x0,t.y0??0,o+f),[i,n]=r(t.x1,t.y1??0,o+f);s._gradient={...t,x0:e,y0:l,x1:i,y1:n}}}return s}),_="ground"===s.labels?.mode?"y"===s.labels.axis?V(a,u):V(i,n):void 0,W=nt.map(({label:t,item:e,z:l,ox:i,oy:n})=>{let a,o;if(e){let r=b.get(e);a=t.x+r[0],o=t.y+r[1]}else if(t.anchorPoint){let[e,s]=r(t.anchorPoint[0],t.anchorPoint[1],l);a=e+i,o=s+n}else[a,o]=r(t.x,t.y,l);return null==_?{...t,x:a,y:o}:{...t,x:a,y:o,rotate:_}}),q=at.map(({mark:t,item:e})=>{let l=e?.gx??t.x+t.width/2,i=e?.gy??t.y+t.height/2,n="billboard"===e?.mode?b.get(e):void 0;if(!n){let[t,a]=r(l,i,e?N(e):f);n=[t-l,a-i]}let[a,o]=n;return{...t,x:t.x+a,y:t.y+o}}),H=$?.underlay(e)??{edges:[],labels:[]},Y=H.edges.slice(),U=(t,e)=>Y.push({type:"curved",pathD:t,style:e,datum:null,interactive:!1}),J="object"==typeof L?L:{},X=J.color??"#000",G=J.opacity??.16;C.length&&U(C.join(""),{fill:X,fillOpacity:.75*G,stroke:"none"});for(let[t,e]of R)U(e.join(""),{fill:"none",stroke:X,strokeWidth:t+2,opacity:G,strokeLinecap:"round"});let B=s.elevationGuides??!0;if(B){let t="object"==typeof B?B:{},l=[],i=[];for(let n of p){if("billboard"!==n.mode&&"token"!==n.mode||n.lift<=0)continue;let a=g.get(n),o=n.z-n.lift,[s,h]=r(n.gx,n.gy,o),c=n.glyph?P(n)/3:(n.box[2]-n.box[0])/2;!1!==t.shadow&&l.push(x(I(n.gx,n.gy,c),(t,e)=>r(t,e,o)));let u="rect"===a.type?a.x+a.w/2:a.cx,f="rect"===a.type?a.y+a.h:a.cy+n.t*e.lift;Math.abs(f-h)>1&&i.push(`M${s} ${h}L${u} ${f}`)}l.length&&U(l.join(""),{fill:X,fillOpacity:.14,stroke:"none"}),i.length&&U(i.join(""),{stroke:t.stroke??o.textSecondary??"rgba(128,128,128,0.8)",strokeWidth:1,strokeDasharray:t.strokeDasharray??"3 3",fill:"none"})}return{sceneNodes:j,sceneEdges:T,labels:H.labels.length?H.labels.concat(W):W,htmlMarks:q,underlay:Y,frame:{...e,thickness:f},edgeLift:f,projectParticle:(t,e,l,i)=>{let n=rt.get(l),a=n?lt(n,i):0;return r(t,e,f+a)}}}}}function J(t){return U(t).emit()}export{o as a,c as b,u as c,x as d,M as e,v as f,E as g,O as h,_ as i,V as j,U as k,J as l,F as m,L as n,A as o,C as p,R as q};
|
package/dist/c-U5YGK6HL.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var t=Math.PI/180,e={isometric:{rotation:45,tilt:/* @__PURE__ */Math.asin(/* @__PURE__ */Math.tan(30*t))/t},pixel:{rotation:45,tilt:30},dimetric:{rotation:45,tilt:20},military:{rotation:45,tilt:90,verticalScale:1},cabinet:{rotation:45,tilt:90,verticalScale:1}},r=(t,e)=>"number"==typeof t&&Number.isFinite(t)?t:e,i=/* @__PURE__ */new Set;function l(l){if(!l)return null;let n="string"==typeof l?{type:l}:l,a=n.type??"isometric";if("flat"===a)return null;if(!Object.prototype.hasOwnProperty.call(e,a))return"production"!==process.env.NODE_ENV&&!i.has(String(a))&&(i.add(String(a)),console.warn(`[Semiotic] Unknown perspective "${String(a)}"; drawing flat. Use "isometric", "pixel", "dimetric", "military", "cabinet" or "flat".`)),null;let o,s,h=e[a],c=r(n.rotation,h.rotation)*t;if("cabinet"===a)o=[1,0,-.5*Math.cos(c),.5*Math.sin(c)],s=r(n.verticalScale,1);else{let e=Math.min(90,Math.max(1,r(n.tilt,h.tilt)))*t,i=Math.sin(e),l=Math.cos(c),a=Math.sin(c);o=[l,i*a,-a,i*l],s=r(n.verticalScale,null==n.tilt&&null!=h.verticalScale?h.verticalScale:Math.cos(e))}let u=n.origin;return{type:a,linear:o,verticalScale:Math.max(0,s),origin:[r(u?.[0],.5),r(u?.[1],.5)],fit:"none"===n.fit?"none":"contain",fitPadding:Math.max(0,r(n.fitPadding,12)),config:n}}var n=t=>Math.round(1e3*t)/1e3;function a(t,e,r,i=1,l=null){let[a,o,s,h,c,u]=e,f=a*h-o*s,p=(t,e,i=0)=>[a*t+s*e+c,o*t+h*e+u-r*i];return{type:t,matrix:e,lift:r,scale:i,bounds:l,project:p,unproject(t,e,i=0){let l=t-c,n=e+r*i-u;return Math.abs(f)<1e-12?[l,n]:[(h*l-s*n)/f,(a*n-o*l)/f]},depth:(t,e,r=0)=>o*t+h*e+u+.001*r,groundTransform:`matrix(${e.map(n).join(" ")})`,billboardTransform(t,e,r=0){let[i,l]=p(t,e,r);return`translate(${n(i)},${n(l)})`}}}var o=/* @__PURE__ */a("flat",[1,0,0,1,0,0],0);function s(t,e,r){if(r>=1)return e;if(r<=0)return t;let i=t.matrix.map((t,i)=>t+(e.matrix[i]-t)*r);return a(e.type,i,t.lift+(e.lift-t.lift)*r,t.scale+(e.scale-t.scale)*r,e.bounds)}var h=/[MmLlHhVvCcSsQqTtAaZz]/,c=/[MmLlHhVvCcSsQqTtAaZz]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g,u={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};function f(t,e,r,i,l,n,a,o,s){if(0===r||0===i||t===o&&e===s)return[[t,e,o,s,o,s]];r=Math.abs(r),i=Math.abs(i);let h=l*Math.PI/180,c=Math.cos(h),u=Math.sin(h),f=(t-o)/2,p=(e-s)/2,y=c*f+u*p,d=-u*f+c*p,m=y*y/(r*r)+d*d/(i*i);if(m>1){let t=Math.sqrt(m);r*=t,i*=t}let g=r*r*i*i-r*r*d*d-i*i*y*y,x=r*r*d*d+i*i*y*y,b=Math.sqrt(Math.max(0,g/x));n===a&&(b=-b);let M=b*r*d/i,v=-b*i*y/r,w=c*M-u*v+(t+o)/2,k=u*M+c*v+(e+s)/2,$=(t,e,r,i)=>Math.atan2(t*i-e*r,t*r+e*i),S=$(1,0,(y-M)/r,(d-v)/i),z=$((y-M)/r,(d-v)/i,(-y-M)/r,(-d-v)/i);!a&&z>0?z-=2*Math.PI:a&&z<0&&(z+=2*Math.PI);let N=Math.max(1,Math.ceil(Math.abs(z)/(Math.PI/2)-1e-9)),P=z/N,D=4/3*Math.tan(P/4),j=t=>[w+r*Math.cos(t)*c-i*Math.sin(t)*u,k+r*Math.cos(t)*u+i*Math.sin(t)*c],F=t=>[-r*Math.sin(t)*c-i*Math.cos(t)*u,-r*Math.sin(t)*u+i*Math.cos(t)*c],L=[],C=S;for(let t=0;t<N;t++){let e=C+P,[r,i]=j(C),[l,n]=t===N-1?[o,s]:j(e),[a,h]=F(C),[c,u]=F(e);L.push([r+D*a,i+D*h,l-D*c,n-D*u,l,n]),C=e}return L}function p(t){let e=t.match(c);if(!e)return[];let r=[],i=0,l="",n=0,a=0,o=0,s=0,p=null,y=null;for(;i<e.length;){if(h.test(e[i]))l=e[i++];else if(!l)return r;let t=l.toUpperCase(),c=l!==t,d=u[t];if("Z"===t){r.push({c:"Z",p:[]}),n=o,a=s,p=y=null,l="";continue}if(i+d>e.length)break;let m=e.slice(i,i+d).map(Number);if(i+=d,m.some(t=>!Number.isFinite(t)))break;let g=c?n:0,x=c?a:0,b=null,M=null;switch(t){case"M":n=m[0]+g,a=m[1]+x,o=n,s=a,r.push({c:"M",p:[n,a]}),l=c?"l":"L";break;case"L":n=m[0]+g,a=m[1]+x,r.push({c:"L",p:[n,a]});break;case"H":n=m[0]+g,r.push({c:"L",p:[n,a]});break;case"V":a=m[0]+(c?a:0),r.push({c:"L",p:[n,a]});break;case"C":{let t=[m[0]+g,m[1]+x,m[2]+g,m[3]+x,m[4]+g,m[5]+x];r.push({c:"C",p:t}),b=[t[2],t[3]],n=t[4],a=t[5];break}case"S":{let t=[p?2*n-p[0]:n,p?2*a-p[1]:a,m[0]+g,m[1]+x,m[2]+g,m[3]+x];r.push({c:"C",p:t}),b=[t[2],t[3]],n=t[4],a=t[5];break}case"Q":{let t=[m[0]+g,m[1]+x,m[2]+g,m[3]+x];r.push({c:"Q",p:t}),M=[t[0],t[1]],n=t[2],a=t[3];break}case"T":{let t=y?2*n-y[0]:n,e=y?2*a-y[1]:a,i=[t,e,m[0]+g,m[1]+x];r.push({c:"Q",p:i}),M=[t,e],n=i[2],a=i[3];break}case"A":{let t=m[5]+g,e=m[6]+x;for(let i of f(n,a,m[0],m[1],m[2],m[3],m[4],t,e))r.push({c:"C",p:i}),b=[i[2],i[3]];n=t,a=e;break}}p=b,y=M}return r}var y=t=>{let e=Math.round(100*t)/100;return Object.is(e,-0)?"0":String(e)};function d(t,e){let r="";for(let i of t){r+=i.c;for(let t=0;t<i.p.length;t+=2){let[l,n]=e?e(i.p[t],i.p[t+1]):[i.p[t],i.p[t+1]];r+=(t?" ":"")+y(l)+" "+y(n)}}return r}function m(t,e){for(let r of t)for(let t=0;t<r.p.length;t+=2)e(r.p[t],r.p[t+1])}function g(t){let e="";return t.forEach(([t,r],i)=>{e+=(i?"L":"M")+y(t)+" "+y(r)}),e+"Z"}function x(t,e=8){let r=[],i=0,l=0;for(let n of t){let t=n.p;if("M"===n.c){if(r.length)break;i=t[0],l=t[1],r.push([i,l])}else if("L"===n.c)i=t[0],l=t[1],r.push([i,l]);else if("Q"===n.c||"C"===n.c){for(let a=1;a<=e;a++){let o=a/e,s=1-o;r.push("Q"===n.c?[s*s*i+2*s*o*t[0]+o*o*t[2],s*s*l+2*s*o*t[1]+o*o*t[3]]:[s*s*s*i+3*s*s*o*t[0]+3*s*o*o*t[2]+o*o*o*t[4],s*s*s*l+3*s*s*o*t[1]+3*s*o*o*t[3]+o*o*o*t[5]])}i=t[t.length-2],l=t[t.length-1]}else if("Z"===n.c)break}let[n,a]=r[0]??[0,0],[o,s]=r[r.length-1]??[0,0];return r.length>1&&Math.abs(n-o)<1e-9&&Math.abs(a-s)<1e-9&&r.pop(),r}function b(t,e){let r=t.length;if(r<3||!(e>.05))return[];let i=0;for(let e=0;e<r;e++){let[l,n]=t[e],[a,o]=t[(e+1)%r];i+=l*o-a*n}let l=i>=0?1:-1,n=t.map((e,i)=>{let n=t[(i+1)%r],a=n[0]-e[0],o=n[1]-e[1],s=Math.hypot(a,o);if(s<1e-9)return null;let h=l*o/s;return-l*a/s<=.02?null:.04*Math.round(-6.5-4*h+1e-9)}),a=n.findIndex((t,e)=>t!==n[(e+r-1)%r]);a<0&&(a=0);let o=[],s=(i,l,n)=>{let a=[];for(let e of i)a.push(t[e]);a.push(t[(i[i.length-1]+1)%r]);let s=a.map(([t,r])=>[t,r+e]).reverse();o.push({pathD:g([...a,...s]),shade:l,depth:n??a.reduce((t,e)=>t+e[1],0)/a.length})},h=[],c=[],u=()=>{h.length&&s(h,n[h[0]]),h=[]},f=()=>{u();let t=new Set(c.map(t=>n[t]));t.size>1&&s(c,Math.min(...t),-1/0),c=[]};for(let t=0;t<r;t++){let e=(a+t)%r,i=n[e];null!=i?(h.length&&n[h[0]]!==i&&u(),h.push(e),c.push(e)):f()}return f(),o.sort((t,e)=>t.depth-e.depth).map(({pathD:t,shade:e})=>({pathD:t,shade:Math.round(100*e)/100}))}var M=class{constructor(t){this.resolved=t,this.sx=[],this.sy=[],this.left=[],this.right=[],this.top=[],this.bottom=[]}add(t,e,r=0,i=0,l=i,n=i,a=n){let[o,s,h,c]=this.resolved.linear,u=o*t+h*e,f=s*t+c*e-this.resolved.verticalScale*r;!Number.isFinite(u)||!Number.isFinite(f)||(this.sx.push(u),this.sy.push(f),this.left.push(i),this.right.push(l),this.top.push(n),this.bottom.push(a))}get size(){return this.sx.length}};function v(t,e,r,i){let l=1/0,n=-1/0;for(let a=0;a<t.length;a++){let o=i*t[a];o-e[a]<l&&(l=o-e[a]),o+r[a]>n&&(n=o+r[a])}return[l,n]}function w(t,e,r){let[i,l]=e,[n,o,s,h]=t.linear,c=t.verticalScale;if("none"===t.fit||0===r.size){let e=t.origin[0]*i,u=t.origin[1]*l,f=a(t.type,[n,o,s,h,e-n*e-s*u,u-o*e-h*u],c);return 0===r.size?f:a(t.type,f.matrix,c,1,k(f,r,1))}let u=t.fitPadding,f=Math.max(1,i-2*u),p=Math.max(1,l-2*u),y=t=>{let[e,i]=v(r.sx,r.left,r.right,t),[l,n]=v(r.sy,r.top,r.bottom,t);return i-e<=f&&n-l<=p},d=1;if(!y(1)){let t=0,e=1;for(let r=0;r<32;r++){let r=(t+e)/2;y(r)?t=r:e=r}d=Math.max(t,.001)}let[m,g]=v(r.sx,r.left,r.right,d),[x,b]=v(r.sy,r.top,r.bottom,d),M=i/2-(m+g)/2,w=l/2-(x+b)/2;return a(t.type,[n*d,o*d,s*d,h*d,M,w],c*d,d,{x:m+M,y:x+w,width:g-m,height:b-x})}function k(t,e,r){let[i,l]=v(e.sx,e.left,e.right,r),[n,a]=v(e.sy,e.top,e.bottom,r);return{x:i+t.matrix[4],y:n+t.matrix[5],width:l-i,height:a-n}}function $(t){if(!t||"object"!=typeof t)return null;let e=t.data;return e&&"object"==typeof e?e:t}function S(t,e){if(null==t)return NaN;if("number"==typeof t)return t;let r,i=$(e);if(!i)return NaN;"function"==typeof t?r=t(i):(r=i[t],null==r&&e&&"object"==typeof e&&(r=e[t]));let l="number"==typeof r?r:Number(r);return Number.isFinite(l)?l:NaN}import{symbol as z,symbolCircle as N,symbolCross as P,symbolDiamond as D,symbolSquare as j,symbolStar as F,symbolTriangle as L,symbolWye as C}from"d3-shape";var I={circle:N,square:j,triangle:L,diamond:D,star:F,cross:P,wye:C},R=/* @__PURE__ */new Set(["circle","square","triangle","diamond","star","cross","wye","chevron"]),A=["circle","triangle","diamond","star","square","chevron","cross","wye"];function O(t,e,r){if(r)return r;let i=t??"circle";if("chevron"===i)return Z(e);let l=Object.prototype.hasOwnProperty.call(I,i)?I[i]:N;return z(l,Math.max(1,e))()??""}function q(t){return Math.sqrt(Math.max(1,t)/Math.PI)}function T(t,e){let r=/* @__PURE__ */new Map,i=0;return l=>{let n=String(t(l)),a=e&&Object.prototype.hasOwnProperty.call(e,n)?e[n]:void 0;if(a&&R.has(a))return a;let o=r.get(n);return o||(o=A[i%A.length],i++,r.set(n,o)),o}}function Z(t){let e=1.5*q(t),r=.92*e;return`M0,${-e}L${r},${(.78*e).toFixed(3)}L0,${(.28*e).toFixed(3)}L${-r},${(.78*e).toFixed(3)}Z`}var E=[40,40],_=[.5,.5];function Q(t,e){let[r,i]=t.viewBox??E,[l,n]=t.anchor??_,a=i>0?i:1,o=Math.max(0,e)/a,s=(r>0?r:a)*o,h=a*o;return{width:s,height:h,scale:o,offsetX:-l*s,offsetY:-n*h}}function W(t,e,r,i){if("none"!==t)return"color"===t||null==t?e??i:"accent"===t?r:t}function H(t,e,r=0,i="horizontal"){let[l,n]=t.viewBox??E,a=Math.min(1,Math.max(0,r)),o=Math.min(1,Math.max(0,e));return o<=a?{x:0,y:0,width:0,height:0}:a<=0&&o>=1?null:"vertical"===i?{x:0,y:n*(1-o),width:l,height:n*(o-a)}:{x:l*a,y:0,width:l*(o-a),height:n}}function V(t,e){let r=Q(t,e);return{centerDx:r.offsetX+r.width/2,centerDy:r.offsetY+r.height/2,halfWidth:r.width/2,halfHeight:r.height/2,radius:Math.hypot(r.width,r.height)/2}}var X=null,Y=null;function U(t){}function B(t){X=t}function G(){return X}function K(t){let e=t.edges?.route;return!!(t.ground?.grid||t.ground?.plate||t.regions?.length||e&&"layout"!==e||"extrude"===t.marks||"function"==typeof t.marks)}function J(){return X?Promise.resolve():(Y??(Y=import("./c-MIKDFGKH.min.js").then(t=>{X=t.networkPerspectiveExtras}).catch(t=>{throw Y=null,t})),Y)}function tt(t,e,r){let i=.5522847498*r;return[{c:"M",p:[t+r,e]},{c:"C",p:[t+r,e+i,t+i,e+r,t,e+r]},{c:"C",p:[t-i,e+r,t-r,e+i,t-r,e]},{c:"C",p:[t-r,e-i,t-i,e-r,t,e-r]},{c:"C",p:[t+i,e-r,t+r,e-i,t+r,e]},{c:"Z",p:[]}]}function et(t){let e=Math.min(t.startAngle,t.endAngle),r=Math.min(2*Math.PI-1e-6,Math.abs(t.endAngle-t.startAngle)),i=(e,r)=>`${t.cx+e*Math.cos(r)} ${t.cy+e*Math.sin(r)}`,l=r>Math.PI?1:0,n=e+r,a=t.innerR>0?`L${i(t.innerR,n)}A${t.innerR} ${t.innerR} 0 ${l} 0 ${i(t.innerR,e)}`:`L${t.cx} ${t.cy}`;return p(`M${i(t.outerR,e)}A${t.outerR} ${t.outerR} 0 ${l} 1 ${i(t.outerR,n)}${a}Z`)}function rt(t){return[[t[0],t[1]],[t[2],t[1]],[t[2],t[3]],[t[0],t[3]]]}function it(t){let e=t.datum;return[t.id,e?.id,e?.data?.id].filter(t=>null!=t&&""!==t).map(String)}function lt(t){if("rect"===t.type)return[t.x,t.y,t.x+t.w,t.y+t.h];let e="circle"===t.type?t.r:"arc"===t.type?t.outerR:"symbol"===t.type?q(t.size):t.size/2;return[t.cx-e,t.cy-e,t.cx+e,t.cy+e]}function nt(t,e,r){if("arc"===t.type)return"ground";if("glyph"===t.type)return"billboard";if("symbol"===t.type)return"billboard"===e?"billboard":"token";if("circle"===t.type)return"billboard"===e||"ground"===e?e:e||"circlepack"!==r?"token":"ground";if(!e||"token"===e)return"ground";if("extrude"===e){let e=t.datum;if(e?.children?.length||e?.data?.children?.length)return"ground"}return e}function at(t){let e=t.thickness;return"number"==typeof e&&Number.isFinite(e)?Math.max(0,e):6}var ot=/* @__PURE__ */new Set(["treemap","circlepack"]);function st(t,e,r,i,l){let n=t.map(t=>l(t)?null==e?i:S(e,t.node.datum):NaN);if(null==e||"number"==typeof e)return n.map(t=>Number.isFinite(t)?t:0);let a=n.reduce((t,e)=>Number.isFinite(e)?Math.max(t,Math.abs(e)):t,0),o="number"==typeof r&&Number.isFinite(r)?r:a>0?48/a:0;return n.map(t=>Number.isFinite(t)?t*o:0)}function ht(t,e){let r=Math.atan2(e,t);return r>Math.PI/2?r-Math.PI:r<=-Math.PI/2?r+Math.PI:r}function ct(t){let e=t.fontSize??11,r=String(t.text??"").length*e*.56,i="end"===t.anchor?r:"start"===t.anchor?0:r/2;return[i,r-i,.7*e,.7*e]}function ut(t){if(null==t)return null;if("object"!=typeof t)return String(t);let e=t.id;return null==e?null:String(e)}function ft(t){let{perspective:e,size:r,chartType:i,theme:l={}}=t,n=e.config,a=G(),o="feet"===n.anchor,s=n.glyph,h=at(n),c=t.sceneNodes.map((t,e)=>{let r=nt(t,"function"==typeof n.marks?n.marks(t):n.marks,i);"extrude"===r&&!a&&(r="ground");let l=lt(t),o="billboard"!==r&&"token"!==r||!s||"circle"!==t.type&&"symbol"!==t.type?void 0:("function"==typeof s?s($(t.datum)??{}):s)??void 0;return o&&(r="billboard"),{node:t,mode:r,z:0,lift:0,h:0,t:0,gx:"rect"===t.type?t.x+t.w/2:t.cx,gy:"rect"===t.type?t.y+t.h/2:t.cy,box:l,index:e,glyph:o}}),u=st(c,n.elevation,n.elevationScale,0,()=>!0),f=st(c,n.extrude,n.extrudeScale,24,t=>"extrude"===t.mode),y=ot.has(i??"");c.forEach((t,e)=>{t.z=t.lift=u[e],t.t="billboard"===t.mode?0:h,t.h="extrude"===t.mode?Math.max(h,f[e]):0,y&&"billboard"!==t.mode&&(t.z+=(t.node.depth??0)*h)});let v=a?.plan(c,n,r,l)??null,k=t=>t.z+("extrude"===t.mode?t.h:t.t),S=t=>n.glyphSize??Math.max(16,2.8*("circle"===t.node.type?t.node.r:q(t.node.size))),z=new M(e),N=(t,e,r,i,l,n,a)=>z.add(t,e,r,i,l,n,a),[P,D,j,F]=e.linear;for(let t of c){let{node:e,mode:r,z:i}=t,l=k(t);if("billboard"===r){if(t.glyph||"glyph"===e.type){let r=Q(t.glyph??e.glyph,t.glyph?S(t):e.size);N(t.gx,t.gy,i,-r.offsetX,r.offsetX+r.width,-r.offsetY,r.offsetY+r.height)}else if("rect"===e.type)N(t.gx,t.gy,i,e.w/2,e.w/2,e.h/2,e.h/2);else{let e=(t.box[2]-t.box[0])/2;N(t.gx,t.gy,i,e,e,o?2*e:e,o?0:e)}t.lift>0&&N(t.gx,t.gy,i-t.lift)}else if("token"===r){let e=(t.box[2]-t.box[0])/2;N(t.gx,t.gy,l,e,e,e,e),N(t.gx,t.gy,i,e,e,e,e),t.lift>0&&N(t.gx,t.gy,i-t.lift)}else if("circle"===e.type)for(let t of[Math.atan2(j,P),Math.atan2(F,D)]){let r=e.r*Math.cos(t),n=e.r*Math.sin(t);for(let t of[i,l])N(e.cx+r,e.cy+n,t),N(e.cx-r,e.cy-n,t)}else if("arc"===e.type)for(let t=0;t<=12;t++){let r=e.startAngle+(e.endAngle-e.startAngle)*t/12;N(e.cx+e.outerR*Math.cos(r),e.cy+e.outerR*Math.sin(r),i),N(e.cx+e.outerR*Math.cos(r),e.cy+e.outerR*Math.sin(r),l)}else for(let[e,r]of rt(t.box))N(e,r,i),N(e,r,l)}let L=n.edges?.elevation??"surface",C=/* @__PURE__ */new Map,I=/* @__PURE__ */new Map,R=/* @__PURE__ */new Map;for(let t of c){let e=`${t.gx}|${t.gy}`;C.has(e)||C.set(e,t),R.set(e,t);for(let e of it(t.node))I.has(e)||I.set(e,t)}let A=(t,e,r)=>{let i=ut(t),l=(null!=i?I.get(i):void 0)??(null!=e&&null!=r?R.get(`${e}|${r}`):void 0);return l?l.z-("nodes"===L?0:l.lift):0},T=t=>{if("number"==typeof L)return Number.isFinite(L)?[L,L]:[0,0];if("ground"===L||!C.size)return[0,0];let e=t.datum;return"line"===t.type?[A(e?.source,t.x1,t.y1),A(e?.target,t.x2,t.y2)]:[A(e?.source),A(e?.target)]},Z=/* @__PURE__ */new Map,E=[],_=/* @__PURE__ */new Map,W=([t,e],r)=>t+(e-t)*r;for(let e of t.sceneEdges){let[t,r]=T(e),i=[t,r];E.push(i);let l=(t+r)/2;if(_.set(e.datum,"line"===e.type?i:[l,l]),"line"===e.type)for(let i of[0,h])N(e.x1,e.y1,t+i),N(e.x2,e.y2,r+i);else if(e.pathD){let i=p(e.pathD);Z.set(e,i),m(i,(e,i)=>{N(e,i,(t+r)/2),N(e,i,(t+r)/2+h)})}}v?.add(N);let H=c.filter(t=>"ground"===t.mode||"extrude"===t.mode),V=t.labels.map(t=>{let[e,r,i,l]=ct(t),n=t.anchorPoint;if(n){let a=C.get(`${n[0]}|${n[1]}`),o=t.x-n[0],s=t.y-n[1];return N(n[0],n[1],a?k(a):0,Math.max(0,e-o),Math.max(0,r+o),Math.max(0,i-s),Math.max(0,l+s)),{label:t,item:a,z:a?k(a):0,ox:o,oy:s}}let a=h,o=1/0;for(let e of H){let[r,i,l,n]=e.box,s=(l-r)*(n-i);t.x>=r&&t.x<=l&&t.y>=i&&t.y<=n&&s<o&&(o=s,a=k(e))}return N(t.x,t.y,a,e,r,i,l),{label:t,item:void 0,z:a,ox:0,oy:0}}),X=(t.htmlMarks??[]).map(t=>{let e=t.x+t.width/2,r=t.y+t.height/2,i=I.get(t.id)??C.get(`${e}|${r}`),l=i?e-i.gx:0,n=i?r-i.gy:0;return N(i?.gx??e,i?.gy??r,i?k(i):h,Math.max(0,t.width/2-l),Math.max(0,t.width/2+l),Math.max(0,t.height/2-n),Math.max(0,t.height/2+n)),{mark:t,item:i}});for(let e of t.bounds??[]){if(!e||!Number.isFinite(e.x)||!Number.isFinite(e.y))continue;let t=(t,e)=>"top"===t?h:Number.isFinite(t)?Number(t):e;if("extent"in e){let[r,i,l,n]=e.extent;N(e.x,e.y,t(e.z,h),r,i,l,n)}else if(Number.isFinite(e.width)&&Number.isFinite(e.height)){let r=t(e.z,0);for(let[t,i]of rt([e.x,e.y,e.x+e.width,e.y+e.height]))N(t,i,r)}}let Y=w(e,r,z);return{frame:Y,emit:(e=Y)=>{let r=e.project,[i,s,u,f]=e.matrix,y=[],m=[],M=/* @__PURE__ */new Map,w=/* @__PURE__ */new Map,$=Math.hypot(i,u)||1,z=(t,e)=>[(i*t+u*e)/$,(s*t+f*e)/$],N=(t,i,l)=>{let n=(t,e)=>r(t,e,i+l),a=x(t).map(([t,e])=>n(t,e)),o=b(a,l*e.lift),s=l*e.lift,h=a.map(t=>t[0]),c=a.map(t=>t[1]),u=Math.min(...h),f=Math.min(...c);return{pathD:d(t,n),faces:o.length?o:void 0,bounds:[u,f,Math.max(...h)-u,Math.max(...c)+s-f]}};for(let t of c){let i,{node:l,mode:n,z:s}=t;if("extrude"===n&&a)i=a.extrude(t,e);else if("billboard"===n){let[e,n]=r(t.gx,t.gy,s);if(t.glyph&&"rect"!==l.type&&"arc"!==l.type)i={type:"glyph",cx:e,cy:n,size:S(t),glyph:t.glyph,color:"string"==typeof l.style.fill?l.style.fill:void 0,style:l.style,datum:l.datum,accessibleDatum:l.accessibleDatum,accessibility:l.accessibility,id:l.id,label:l.label,depth:l.depth};else if("rect"===l.type)i={...l,x:e-l.w/2,y:n-l.h/2,_hitPath:void 0};else{let r=o&&"glyph"!==l.type?(t.box[2]-t.box[0])/2:0;i={...l,cx:e,cy:n-r}}}else if("token"!==n||"circle"!==l.type&&"symbol"!==l.type)if("rect"===l.type){let e=l._hitPath,r=N(p(e?d(p(e.pathD),(t,r)=>[e.transform[0]+t*e.transform[2],e.transform[1]+r*e.transform[3]]):g(rt(t.box))),s,t.t),[n,a,o,h]=r.bounds,c=r.pathD+(r.faces??[]).map(t=>t.pathD).join("");i={...l,x:n,y:a,w:Math.max(.001,o),h:Math.max(.001,h),pathD:r.pathD,faces:r.faces,_hitPath:{pathD:c,transform:[0,0,1,1],fill:!0,strokeWidth:e?.strokeWidth??0}}}else{let[e,n]=r(t.gx,t.gy,s+t.t),a=N("circle"===l.type?tt(l.cx,l.cy,l.r):et(l),s,t.t);i={...l,cx:e,cy:n,pathD:a.pathD,faces:a.faces}}else{let[n,a]=r(t.gx,t.gy,s+t.t),o="symbol"===l.type?l.rotation??0:0,h=Math.cos(o),c=Math.sin(o),u=(t,e)=>z(t*h-e*c,t*c+e*h),f="circle"===l.type?tt(0,0,l.r):p(O(l.symbolType,l.size,l.path)),y=b(x(f,6).map(([t,e])=>{let[r,i]=u(t,e);return[n+r,a+i]}),t.t*e.lift);i="circle"===l.type?{...l,cx:n,cy:a,pathD:d(f,(t,e)=>{let[r,i]=u(t,e);return[n+r,a+i]}),faces:y.length?y:void 0,_perspectiveToken:!0}:{...l,cx:n,cy:a,rotation:0,path:d(f,u),faces:y.length?y:void 0}}M.set(t,i);let h="rect"===i.type?i.x+i.w/2:i.cx,c="rect"===i.type?i.y+i.h/2:i.cy;w.set(t,[h-t.gx,c-t.gy]),"ground"===n?y.push(i):m.push(t)}let P=!1===n.depthSort?m:m.some(t=>"extrude"===t.mode)&&a?a.sort(m,e):[...m].sort((t,r)=>e.depth(t.gx,t.gy,t.z)-e.depth(r.gx,r.gy,r.z)||t.index-r.index),D=y.concat(P.map(t=>M.get(t))),j=n.edges?.route,F=n.edgeShadow??!0,L=h>0&&!1!==F,C=[],I=/* @__PURE__ */new Map,R=t=>"string"==typeof t?""!==t&&"none"!==t&&"transparent"!==t:null!=t,A=(t,e)=>{if(!L||(t.style.opacity??1)<=0)return;let r=t.style,i="bezier"===t.type||"ribbon"===t.type,l=r.strokeWidth??(i?.5:1),n=r.fillOpacity??("curved"===t.type?.1:r.opacity??.5);if("line"!==t.type&&R(r.fill)&&n>0)C.push(e);else if(R(r.stroke||(i?void 0:"#999"))&&(r.opacity??1)*(r.strokeOpacity??1)>0&&l>0){let t=I.get(l)??[];t.push(e),I.set(l,t)}},q=t.sceneEdges.map((t,e)=>{let i=E[e],[l,n]=i;if("line"===t.type){if(j&&"layout"!==j&&a){let e="orthogonal-rounded"===j,l=t=>(e,l,n)=>r(e,l,W(i,n)+t),n=a.route(t,e,l(h));return L&&A(t,a.route(t,e,l(0)).pathD),n}let[e,o]=r(t.x1,t.y1,l+h),[s,c]=r(t.x2,t.y2,n+h);if(L){let[e,i]=r(t.x1,t.y1,l),[a,o]=r(t.x2,t.y2,n);A(t,`M${e} ${i}L${a} ${o}`)}return{...t,x1:e,y1:o,x2:s,y2:c}}let o=Z.get(t);if(!o)return t;let s=(l+n)/2;L&&A(t,d(o,(t,e)=>r(t,e,s)));let c={...t,pathD:d(o,(t,e)=>r(t,e,s+h)),_cachedPath2D:void 0,_cachedPath2DSource:void 0};if("bezier"===c.type){c.bezierCache=void 0;let t=c._gradient;if(t){let[e,i]=r(t.x0,t.y0??0,s+h),[l,n]=r(t.x1,t.y1??0,s+h);c._gradient={...t,x0:e,y0:i,x1:l,y1:n}}}return c}),T="ground"===n.labels?.mode?"y"===n.labels.axis?ht(u,f):ht(i,s):void 0,Q=V.map(({label:t,item:e,z:i,ox:l,oy:n})=>{let a,o;if(e){let r=w.get(e);a=t.x+r[0],o=t.y+r[1]}else if(t.anchorPoint){let[e,s]=r(t.anchorPoint[0],t.anchorPoint[1],i);a=e+l,o=s+n}else[a,o]=r(t.x,t.y,i);return null==T?{...t,x:a,y:o}:{...t,x:a,y:o,rotate:T}}),H=X.map(({mark:t,item:e})=>{let i=e?.gx??t.x+t.width/2,l=e?.gy??t.y+t.height/2,n="billboard"===e?.mode?w.get(e):void 0;if(!n){let[t,a]=r(i,l,e?k(e):h);n=[t-i,a-l]}let[a,o]=n;return{...t,x:t.x+a,y:t.y+o}}),U=v?.underlay(e)??{edges:[],labels:[]},B=U.edges.slice(),G=(t,e)=>B.push({type:"curved",pathD:t,style:e,datum:null,interactive:!1}),K="object"==typeof F?F:{},J=K.color??"#000",it=K.opacity??.16;C.length&&G(C.join(""),{fill:J,fillOpacity:.75*it,stroke:"none"});for(let[t,e]of I)G(e.join(""),{fill:"none",stroke:J,strokeWidth:t+2,opacity:it,strokeLinecap:"round"});let lt=n.elevationGuides??!0;if(lt){let t="object"==typeof lt?lt:{},i=[],n=[];for(let l of c){if("billboard"!==l.mode&&"token"!==l.mode||l.lift<=0)continue;let a=M.get(l),o=l.z-l.lift,[s,h]=r(l.gx,l.gy,o),c=l.glyph?S(l)/3:(l.box[2]-l.box[0])/2;!1!==t.shadow&&i.push(d(tt(l.gx,l.gy,c),(t,e)=>r(t,e,o)));let u="rect"===a.type?a.x+a.w/2:a.cx,f="rect"===a.type?a.y+a.h:a.cy+l.t*e.lift;Math.abs(f-h)>1&&n.push(`M${s} ${h}L${u} ${f}`)}i.length&&G(i.join(""),{fill:J,fillOpacity:.14,stroke:"none"}),n.length&&G(n.join(""),{stroke:t.stroke??l.textSecondary??"rgba(128,128,128,0.8)",strokeWidth:1,strokeDasharray:t.strokeDasharray??"3 3",fill:"none"})}return{sceneNodes:D,sceneEdges:q,labels:U.labels.length?U.labels.concat(Q):Q,htmlMarks:H,underlay:B,frame:{...e,thickness:h},edgeLift:h,projectParticle:(t,e,i,l)=>{let n=_.get(i),a=n?W(n,l):0;return r(t,e,h+a)}}}}}function pt(t){return ft(t).emit()}export{O as a,q as b,T as c,Q as d,W as e,H as f,V as g,l as h,o as i,s as j,d as k,g as l,b as m,rt as n,it as o,at as p,ht as q,ft as r,pt as s,U as t,B as u,G as v,K as w,J as x};
|
package/dist/c-VIN5ASK2.min.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
function e(e){let t=we(e);return t^=t>>>16,t=Math.imul(t,2146121005),t^=t>>>15,t=Math.imul(t,2221713035),t^=t>>>16,t>>>0}function t(e){let t=Math.round(1e3*e)/10;return`p${String(t).replace(".","_")}`}function i(e,t,i){let n=e.length;for(e.push(t);n>0;){let s=n-1>>>1;if(i(e[s],t)<=0)break;e[n]=e[s],n=s}e[n]=t}function n(e,t){let i=e[0],n=e.pop();if(e.length>0){let i=0;for(;2*i+1<e.length;){let s=2*i+1;if(s+1<e.length&&t(e[s+1],e[s])<0&&s++,t(n,e[s])<=0)break;e[i]=e[s],i=s}e[i]=n}return i}function s(e,t){switch(t){case"distinct":return e.distinct??0;case"p50":case"p95":case"p99":return e.percentiles?.[t]??Number.NaN;default:return e[t]??e.mean}}function o(e,t,i,n=1){if("none"===t)return null;if("minmax"===t)return[e.min,e.max];let o=s(e,i),r=e.stddev*n;return[o-r,o+r]}function r(e){if("number"==typeof e)return Number.isFinite(e)&&e>0?e:null;if("string"!=typeof e)return null;let t=e.trim();if(""===t)return null;Te.lastIndex=0;let i,n=0,s=0;for(;null!==(i=Te.exec(t));){let e=parseFloat(i[1]),t=Me[i[2]];if(null==t||!Number.isFinite(e))return null;n+=e*t,s+=i[0].length}return s!==t.length?null:n>0?n:null}function a(e,t){return e.time-t.time||e.order-t.order}function l(e,t){let i=[new Date(e),new Date(t)],n=Math.max(...i.map(e=>e.getUTCMilliseconds()?23:e.getUTCSeconds()?19:16)),[s,o]=i.map(e=>e.toISOString()),r=s.slice(0,10)===o.slice(0,10)?"":`${F(t)} `;return`${F(e)} ${s.slice(11,n)}–${r}${o.slice(11,n)}`}function c(e,t,i){return i?`${i(e)}–${i(t)}`:e>=1e11&&t<=864e13?l(e,t):`${h(e)}–${h(t)}`}function u(e,t,i){return null==e?void 0:"function"==typeof t?t(e):e["string"==typeof t?t:i]}function h(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?String(e):e.toFixed(2):e instanceof Date?e.toLocaleString():String(e)}function m(e={}){let{timeAccessor:t,valueAccessor:i,xLabel:n="x",yLabel:s="y"}=e;return e=>{let o=e?.data??null,r=u(o,t,"time"),a=u(o,i,"value");/* @__PURE__ */
|
|
2
|
-
return Le("div",{className:"semiotic-tooltip",style:Ee,children:[
|
|
3
|
-
/* @__PURE__ */Le("div",{children:[
|
|
4
|
-
/* @__PURE__ */Le("span",{style:je,children:[n,":"]}),h(r)]}),
|
|
5
|
-
/* @__PURE__ */Le("div",{children:[
|
|
6
|
-
/* @__PURE__ */Le("span",{style:je,children:[s,":"]}),h(a)]})]})}}function d(e={}){let t=p(e);return i=>{let n=i?.allSeries,s=i?.data??null;return n?.length&&null!=s?.binStart&&null!=s.binEnd?/* @__PURE__ */Le("div",{className:"semiotic-tooltip",style:Ee,children:[
|
|
7
|
-
/* @__PURE__ */Le("div",{children:[
|
|
8
|
-
/* @__PURE__ */Oe("span",{style:je,children:"range:"}),c(s.binStart,s.binEnd,e.formatTime)]}),n.map((e,t)=>""!==e.group&&/* @__PURE__ */Le("div",{children:[
|
|
9
|
-
/* @__PURE__ */Oe("span",{style:{...We,backgroundColor:e.color}}),
|
|
10
|
-
/* @__PURE__ */Le("span",{style:je,children:[e.group,":"]}),h(e.value)]},t)),null!=s.total&&/* @__PURE__ */Le("div",{children:[
|
|
11
|
-
/* @__PURE__ */Oe("span",{style:je,children:"count:"}),h(s.total)]})]}):t(i)}}function g(e={}){let{timeAccessor:t,valueAccessor:i}=e;return e=>{let n=e?.data??null,s=u(n,t,"time"),o=n?.delta??u(n,i,"value"),r=n?.cumEnd,a="number"==typeof o&&o>=0?`+${h(o)}`:h(o);/* @__PURE__ */
|
|
12
|
-
return Le("div",{className:"semiotic-tooltip",style:Ee,children:[
|
|
13
|
-
/* @__PURE__ */Le("div",{children:[
|
|
14
|
-
/* @__PURE__ */Oe("span",{style:je,children:"x:"}),h(s)]}),
|
|
15
|
-
/* @__PURE__ */Le("div",{children:[
|
|
16
|
-
/* @__PURE__ */Oe("span",{style:je,children:"Δ:"}),a]}),null!=r&&/* @__PURE__ */Le("div",{children:[
|
|
17
|
-
/* @__PURE__ */Oe("span",{style:je,children:"total:"}),h(r)]})]})}}function p(e={}){let{timeAccessor:t,valueAccessor:i,formatTime:n}=e;return e=>{let s=e?.data??null;if(null==s?.binStart||null==s?.binEnd){let e=u(s,t,"time"),n=u(s,i,"value");/* @__PURE__ */
|
|
18
|
-
return Le("div",{className:"semiotic-tooltip",style:Ee,children:[
|
|
19
|
-
/* @__PURE__ */Le("div",{children:[
|
|
20
|
-
/* @__PURE__ */Oe("span",{style:je,children:"x:"}),h(e)]}),
|
|
21
|
-
/* @__PURE__ */Le("div",{children:[
|
|
22
|
-
/* @__PURE__ */Oe("span",{style:je,children:"y:"}),h(n)]})]})}/* @__PURE__ */
|
|
23
|
-
return Le("div",{className:"semiotic-tooltip",style:Ee,children:[
|
|
24
|
-
/* @__PURE__ */Le("div",{children:[
|
|
25
|
-
/* @__PURE__ */Oe("span",{style:je,children:"range:"}),c(s.binStart,s.binEnd,n)]}),null!=s.total&&/* @__PURE__ */Le("div",{children:[
|
|
26
|
-
/* @__PURE__ */Oe("span",{style:je,children:"count:"}),h(s.total)]}),null!=s.category&&/* @__PURE__ */Le("div",{children:[
|
|
27
|
-
/* @__PURE__ */Oe("span",{style:je,children:"category:"}),h(s.category)]}),null!=s.category&&null!=s.categoryValue&&/* @__PURE__ */Le("div",{children:[
|
|
28
|
-
/* @__PURE__ */Oe("span",{style:je,children:"category count:"}),h(s.categoryValue)]})]})}}function f(e={}){let{timeAccessor:t,valueAccessor:i,xLabel:n="x",yLabel:s="y"}=e;return e=>{let o=e?.data??null,r=o?.xCenter??u(o,t,"time"),a=o?.yCenter??u(o,i,"value"),l=o?.count,c=o?.sum,m=o?.value,d=o?.agg??"count";/* @__PURE__ */
|
|
29
|
-
return Le("div",{className:"semiotic-tooltip",style:Ee,children:[
|
|
30
|
-
/* @__PURE__ */Le("div",{children:[
|
|
31
|
-
/* @__PURE__ */Le("span",{style:je,children:[n,":"]}),h(r)]}),
|
|
32
|
-
/* @__PURE__ */Le("div",{children:[
|
|
33
|
-
/* @__PURE__ */Le("span",{style:je,children:[s,":"]}),h(a)]}),null!=l&&/* @__PURE__ */Le("div",{children:[
|
|
34
|
-
/* @__PURE__ */Oe("span",{style:je,children:"count:"}),h(l)]}),"sum"===d&&null!=c&&/* @__PURE__ */Le("div",{children:[
|
|
35
|
-
/* @__PURE__ */Oe("span",{style:je,children:"sum:"}),h(c)]}),"mean"===d&&null!=m&&/* @__PURE__ */Le("div",{children:[
|
|
36
|
-
/* @__PURE__ */Oe("span",{style:je,children:"mean:"}),h(m)]})]})}}function v(e,t,i){return e??i??Math.max(t?.length??0,200)}function w(e){let t=e.window??"tumbling",i=r("session"===t?e.gap??e.size:e.size);if(null==i)return null;let n=null!=e.hop?r(e.hop):void 0,s=null!=e.gap?r(e.gap):void 0;return new He({window:t,size:i,hop:n??void 0,gap:s??void 0,retain:e.retain,percentiles:e.percentiles,distinct:e.distinct})}function y(e,t){let i=t.stat??"mean",n=t.band??"none",r=t.sigma??1;return e.emit().map(e=>{let t={[Ve]:(e.start+e.end)/2,[$e]:s(e,i),[qe]:e.count,[Ge]:e.partial,[Xe]:e.start,[Ye]:e.end},a=o(e,n,i,r);return a&&(t[Ue]=a[0],t[Ke]=a[1]),t})}function b(e,t,i){let n="function"==typeof t?t(e):e[String(t??i)];if(null==n||"string"==typeof n&&""===n.trim())return null;let s=Number(n);return Number.isFinite(s)?s:null}function x(e){if(null==e||"string"==typeof e&&""===e.trim())return NaN;if(e instanceof Date)return e.getTime();if("string"==typeof e){let t=V(e);if(Number.isFinite(t))return t}return Number(e)}function A(e,t,i){let n="function"==typeof t?t(e):e[String(t??i)];if(null==n||"string"==typeof n&&""===n.trim())return null;if(n instanceof Date)return Number.isFinite(n.getTime())?n:null;if("string"==typeof n){let e=V(n);if(Number.isFinite(e))return new Date(e)}let s=Number(n);return Number.isFinite(s)?s:null}function k(e,t){let i=r(e.lateness);return null==i?null:new Pe({lateness:i,getTime:t,latePolicy:e.latePolicy??"drop"})}function S(e){return{...Q(e.mode,{width:e.size?.[0]??e.width,height:e.size?.[1]??e.height,showAxes:e.showAxes,showGrid:e.showGrid,showLegend:e.showLegend,enableHover:null==e.enableHover?void 0:!!e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight}}function C(e,t){Qe.useImperativeHandle(e,()=>({push:e=>t.current?.push(e),pushMany:e=>t.current?.pushMany(e),remove:e=>t.current?.remove(e)??[],update:(e,i)=>t.current?.update(e,e=>i(e))??[],clear:()=>t.current?.clear(),getData:()=>t.current?.getData()??[],getScales:()=>t.current?.getScales()??null}),[t])}function _(e,t,i,n){let s=t.find(Boolean)??null;return Qe.useMemo(()=>s?de(e??et,s,i,n):e,[s,e,i,n])}function H(e,t,i){return{responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,legendHoverBehavior:t.onLegendHover,legendClickBehavior:t.onLegendClick,legendHighlightedCategory:t.highlightedCategory,legendIsolatedCategories:"isolate"===i?t.isolatedCategories:void 0}}function M(e){return t=>"number"!=typeof t.binStart||"number"!=typeof t.binEnd?t:xe(ye({...t},be(t)),{ranges:{[e]:[t.binStart,t.binEnd]},toNumber:x})}function T(e){if(!e.axes)return[{orient:"bottom",visible:!1!==e.showTimeAxis},{orient:"left",visible:!1!==e.showValueAxis}];let t=(...t)=>e.axes.some(e=>t.includes(e.orient)),i=!1===e.showTimeAxis&&!t("bottom","top"),n=!1===e.showValueAxis&&!t("left","right");return i||n?[...e.axes,...i?[{orient:"bottom",visible:!1}]:[],...n?[{orient:"left",visible:!1}]:[]]:e.axes}function P(e,t,i,n=!1){let s=ue({axes:t,showAxes:i});return{...me(e,t,n),...!s.hasAxis&&{bottom:0},...!s.leftAxis?.hasAxis&&{left:0}}}function N({enabled:e,categories:t,colors:i,fallbackColor:n,order:s="discovery",domainKey:o}){let r=ae(!0),a=le(),l=he(),c=Z(),u="function"==typeof o?ht:o,h=ut(null),m=ct(()=>{let e=h.current,n=e&&Object.is(e.domainKey,u)?new Map(e.indexes):/* @__PURE__ */new Map,o=new Set(t),r="explicit-then-alpha"===s?[...Object.keys(i??{}).filter(e=>o.has(e)),...t.filter(e=>!Object.prototype.hasOwnProperty.call(i??{},e)).sort()]:t;for(let e of r)ce(n,e);return{domainKey:u,indexes:n}},[t,i,s,u]);mt(()=>{h.current=m},[m]);let d=m.indexes,g=ct(()=>{if(!e)return;let t=c&&c.length>0?c:l?pe:fe;return e=>{let s=ce(d,e);return(r?ve(r,e):void 0)||(i?ve(i,e):void 0)||n||(a?ve(a,e):void 0)||t[s%t.length]}},[d,i,e,n,l,a,r,c]),p=ct(()=>{if(!e||!g)return i;let n=Object.keys(i??{}),o=new Set(n),r=t.filter(e=>!o.has(e));"explicit-then-alpha"===s&&r.sort();let a=[...n,...r];if(0===a.length)return;let l=new Set(t),c=[];for(let e of a){if(l.has(e)){c.push([e,g(e)]);continue}let t=i?ve(i,e):void 0;t&&c.push([e,t])}return c.length>0?Object.fromEntries(c):void 0},[t,g,i,e,s]);return{colorScale:g,colorMap:p}}import{a as I}from"./c-2RG4WOVX.min.js";import{d as R,e as B,f as z,g as D}from"./c-AE4M7BWH.min.js";import{c as F,f as O,g as L}from"./c-HXUOFDSD.min.js";import{a as E,h as j}from"./c-TT4CTEBR.min.js";import{a as W}from"./c-3DCTIRW4.min.js";import{a as V}from"./c-W3OOPUWV.min.js";import{A as $,W as U,Y as K}from"./c-QMKQVCCZ.min.js";import{$a as G,Ab as q,Bb as X,Cb as Y,Db as Z,Ib as J,Kb as Q,Mb as ee,Rb as te,Ta as ie,Ua as ne,Va as se,db as oe,eb as re,gb as ae,ib as le,sb as ce,u as ue,ub as he,z as me}from"./c-2U5JMOPN.min.js";import{f as de}from"./c-2OZMC2MZ.min.js";import{d as ge,m as pe,p as fe,s as ve}from"./c-ZOE7TAR3.min.js";import{g as we}from"./c-SSKV5JPW.min.js";import{a as ye,b as be,g as xe}from"./c-ODSUDNB4.min.js";var Ae=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;let t=e-this._mean;this._mean+=t/this._count;let i=e-this._mean;this._m2+=t*i,e<this._min&&(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);let t=this._count+e._count,i=e._mean-this._mean;this._mean+=i*e._count/t,this._m2+=e._m2+i*i*this._count*e._count/t,this._count=t,e._min<this._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(){let t=new e;return t.merge(this),t}get count(){return this._count}get mean(){return this._mean}get sum(){return this._mean*this._count}get variance(){return this._count<2?0:this._m2/this._count}get stddev(){return Math.sqrt(this.variance)}get sampleVariance(){return this._count<2?0:this._m2/(this._count-1)}get sampleStddev(){return Math.sqrt(this.sampleVariance)}get min(){return this._min}get max(){return this._max}},ke=class t{constructor(e=10){let t=Math.max(4,Math.min(16,Math.floor(e)));this.p=t,this.m=1<<t,this.registers=new Uint8Array(this.m),this.alpha=.7213/(1+1.079/this.m),this.harmonicSum=this.m,this.zeros=this.m}add(t){let i=e(String(t)),n=i>>>32-this.p,s=Math.min(Math.clz32(i<<this.p),32-this.p)+1;this.updateRegister(n,s)}updateRegister(e,t){let i=this.registers[e];t<=i||(this.registers[e]=t,this.harmonicSum+=2**-t-2**-i,0===i&&this.zeros--)}merge(e){if(e.m===this.m)for(let t=0;t<this.m;t++)this.updateRegister(t,e.registers[t])}clone(){let e=new t(this.p);return e.registers.set(this.registers),e.harmonicSum=this.harmonicSum,e.zeros=this.zeros,e}count(){let e=this.alpha*this.m*this.m/this.harmonicSum;return e<=2.5*this.m&&this.zeros>0?Math.round(this.m*Math.log(this.m/this.zeros)):Math.round(e)}},Se=class e{constructor(e=100){this.centroids=[],this.total=0,this.pending=0,this.compression=Math.max(20,e)}push(e){Number.isFinite(e)&&(this.centroids.push({mean:e,weight:1}),this.total+=1,this.pending++,this.pending>=2*this.compression&&this.compress())}merge(e){if(0===e.total)return;let t=0===this.total,i=e.centroids.length;for(let t=0;t<i;t++)this.centroids.push({...e.centroids[t]});this.total+=e.total,this.pending=t&&this.compression===e.compression?e.pending:this.pending+i,t||this.compress()}clone(){let t=new e(this.compression);return t.merge(this),t}quantile(e){if(0===this.total||Number.isNaN(e))return Number.NaN;let t=Math.min(1,Math.max(0,e));this.compress();let i=t*this.total,n=this.centroids[0].weight/2;if(i<=n)return this.centroids[0].mean;for(let e=1;e<this.centroids.length;e++){let t=this.centroids[e-1],s=this.centroids[e],o=(t.weight+s.weight)/2,r=n+o;if(i<=r){let e=(i-n)/o;return t.mean+(s.mean-t.mean)*e}n=r}return this.centroids[this.centroids.length-1].mean}get count(){return this.total}compress(){if(0===this.pending||(this.pending=0,this.centroids.length<=1))return;this.centroids.sort((e,t)=>e.mean-t.mean);let e=0,t=0,i=this.total,n=this.compression;for(let s=1;s<this.centroids.length;s++){let o=this.centroids[e],r=this.centroids[s],a=(t+o.weight/2)/i,l=4*i*a*(1-a)/n;if(o.weight+r.weight<=Math.max(1,l)){let e=o.weight+r.weight;o.mean=(o.mean*o.weight+r.mean*r.weight)/e,o.weight=e}else t+=o.weight,this.centroids[++e]=r}this.centroids.length=e+1}},Ce=(e,t)=>e-t,_e=class{constructor(e,t){this.stats=new Ae,this.digest=e?new Se:null,this.hll=t?new ke:null}push(e,t){this.stats.push(e),this.digest?.push(e),this.hll&&this.hll.add(t??e)}merge(e){this.stats.merge(e.stats),this.digest?.merge(e.digest),this.hll?.merge(e.hll)}},He=class{constructor(e){this.windows=/* @__PURE__ */new Map,this.starts=[],this.sessions=[],this.latest=-1/0,this.type=e.window??"tumbling",this.size=e.size;let t=e.hop??e.size;this.hop=t>0&&t<=e.size?t:e.size,this.gap=e.gap??e.size,this.retain=null!=e.retain&&e.retain>0?e.retain:1/0,this.percentiles=e.percentiles??[],this.wantDistinct=!0===e.distinct}newBucket(){return new _e(this.percentiles.length>0,this.wantDistinct)}push(e,t,i){!Number.isFinite(e)||!Number.isFinite(t)||(e>this.latest&&(this.latest=e),"session"===this.type?this.pushSession(e,t,i):this.pushFixed(e,t,i),this.prune())}pushFixed(e,t,i){if("tumbling"===this.type||this.hop>=this.size){let n=Math.floor(e/this.size)*this.size;return void this.bump(n,t,i)}let n=this.hop,s=Math.floor(e/n);for(let o=Math.floor((e-this.size)/n)+1;o<=s;o++)this.bump(o*n,t,i)}bump(e,t,n){let s=this.windows.get(e);if(!s){if(this.windows.size>=this.retain&&e<this.starts[0])return;s=this.newBucket(),this.windows.set(e,s),this.retain!==1/0&&i(this.starts,e,Ce)}s.push(t,n)}pushSession(e,t,i){let n=e-this.gap,s=e+this.gap,o=0,r=this.sessions.length,a=this.sessions[r-1];if(!a||e>=a.end)o=r,a&&a.end>=n&&a.start<=s&&o--;else for(;o<r;){let e=o+r>>>1;this.sessions[e].end<n?o=e+1:r=e}let l=this.sessions[o];if(!l||l.start>s){let n=this.newBucket();return n.push(t,i),void this.sessions.splice(o,0,{start:e,end:e,bucket:n})}l.bucket.push(t,i),l.start=Math.min(l.start,e),l.end=Math.max(l.end,e);let c=o+1;for(;c<this.sessions.length&&this.sessions[c].start<=s;){let e=this.sessions[c++];l.bucket.merge(e.bucket),l.end=Math.max(l.end,e.end)}c>o+1&&this.sessions.splice(o+1,c-o-1)}prune(){if(this.retain!==1/0){if("session"===this.type)return void(this.sessions.length>this.retain&&this.sessions.splice(0,this.sessions.length-this.retain));for(;this.windows.size>this.retain;)this.windows.delete(n(this.starts,Ce))}}emit(){if("session"===this.type)return this.sessions.map(e=>{let t=this.latest-e.end<this.gap;return this.row(e.start,e.end,e.bucket,t)});let e=[];for(let[t,i]of this.windows){let n=t+this.size;e.push(this.row(t,n,i,this.latest<n))}return e.sort((e,t)=>e.start-t.start),e}row(e,i,n,s){let o=n.stats,r={start:e,end:i,count:o.count,mean:o.mean,sum:o.sum,min:o.min,max:o.max,stddev:o.stddev,partial:s};if(n.digest){let e={};for(let i of this.percentiles)e[t(i)]=n.digest.quantile(i);r.percentiles=e}return n.hll&&(r.distinct=n.hll.count()),r}get windowCount(){return"session"===this.type?this.sessions.length:this.windows.size}get watermark(){return this.latest}clear(){this.windows.clear(),this.starts=[],this.sessions=[],this.latest=-1/0}},Me={ms:1,s:1e3,m:6e4,h:36e5,d:864e5},Te=/(\d+(?:\.\d+)?)(ms|s|m|h|d)/g,Pe=class{constructor(e){this.held=[],this.nextOrder=0,this._watermark=-1/0,this._releasedThrough=-1/0,this._lateCount=0,this.lateness=e.lateness>0?e.lateness:0,this.getTime=e.getTime,this.latePolicy=e.latePolicy??"drop"}push(e){let t=this.getTime(e);if(!Number.isFinite(t))return{released:[e],late:[]};let n=[],s=Math.max(this._watermark-this.lateness,this._releasedThrough);return this._watermark!==-1/0&&t<s?(this._lateCount+=1,n.push(e),"drop"===this.latePolicy?{released:[],late:n}:{released:[e],late:n}):(t>this._watermark&&(this._watermark=t),i(this.held,{item:e,time:t,order:this.nextOrder++},a),{released:this.drain(this._watermark-this.lateness),late:n})}drain(e){let t=[],i=this.held[0];for(;i&&i.time<=e;)n(this.held,a),t.push(i.item),this._releasedThrough=Math.max(this._releasedThrough,i.time),i=this.held[0];return t}flush(){return this.drain(1/0)}clear(){this.held=[],this.nextOrder=0,this._watermark=-1/0,this._releasedThrough=-1/0,this._lateCount=0}get watermark(){return this._watermark}get lateCount(){return this._lateCount}get heldCount(){return this.held.length}};import{useRef as Ne,useImperativeHandle as Ie,forwardRef as Re,useCallback as Be,useState as ze,useEffect as De,useMemo as Fe}from"react";import{jsx as Oe,jsxs as Le}from"react/jsx-runtime";var Ee={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"},je={opacity:.7,marginRight:4},We={display:"inline-block",width:8,height:8,borderRadius:"50%",marginRight:6},Ve="time",$e="value",Ue="__aggLower",Ke="__aggUpper",Ge="__aggPartial",qe="count",Xe="__aggStart",Ye="__aggEnd",Ze="__aggSeries",Je=class{constructor(e,t){this.config=e,this.seriesAccessor=t,this.groups=/* @__PURE__ */new Map}push(e,t,i){let n=A(e,t,"time"),s=b(e,i,"value");if(null==n||null==s)return;let o=null==this.seriesAccessor?"":String("function"==typeof this.seriesAccessor?this.seriesAccessor(e):e[this.seriesAccessor]),r=this.groups.get(o);if(!r){if(r=w(this.config),!r)return;this.groups.set(o,r)}r.push(+n,s)}emit(e){let t=[];for(let[i,n]of this.groups)for(let s of y(n,e))t.push(null==this.seriesAccessor?s:{...s,[Ze]:i});return t}clear(){this.groups.clear()}};import*as Qe from"react";var et=()=>({});import{jsx as tt}from"react/jsx-runtime";var it=/* @__PURE__ */G(/* @__PURE__ */Re(function(e,t){E(j);let i=S(e),{size:n,margin:s,className:o,arrowOfTime:r="right",windowMode:a,capacityMode:l,windowSize:c,capacity:u,seriesAccessor:h,data:d,timeAccessor:g,valueAccessor:p,timeExtent:f,valueExtent:w,extentPadding:y,stroke:b,strokeWidth:x,strokeDasharray:C,opacity:M,cursor:T,styleRules:P,background:N,tooltipContent:I,tooltip:R,onHover:B,annotations:z,autoPlaceAnnotations:D,svgAnnotationRules:F,tickFormatTime:L,tickFormatValue:W,decay:V,pulse:$,staleness:G,transition:Y,linkedHover:Z,selection:Q,onObservation:ne,chartId:ae,loading:le,loadingContent:ce,emptyContent:ue,emphasis:he,legendPosition:me,aggregate:de,eventTime:ge}=e,pe=i.showAxes,fe=i.enableHover,ve=n??[i.width,i.height],we=b??"#007bff",ye=x??2,be="string"==typeof p?p:"Value",xe=Fe(()=>{if(i.showLegend)return{legendGroups:[{label:"Series",type:"line",items:[{label:be,color:we}],styleFn:e=>({stroke:e.color||"var(--semiotic-primary, #007bff)",strokeWidth:ye??2})}]}},[i.showLegend,be,we,ye]),Ae=X(e.legendInteraction,()=>be,[be]),{legend:ke,margin:Se,legendPosition:Ce}=q({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:me,userMargin:s,defaults:i.marginDefaults,additionalLegend:xe,chartWidth:ve[0],chartHeight:ve[1],axisChrome:{hasAxis:!1!==i.showAxes}}),_e=m({timeAccessor:g,valueAccessor:p}),He=se(),Me=ie({tooltip:R,defaultTooltipContent:_e,customFunctionContext:"hover",multiDefaultContent:e=>He({...e,allSeries:Array.isArray(e.allSeries)?e.allSeries.map(e=>({...e,group:e.group||("string"==typeof p?p:"value")})):e.allSeries})}),Te=I??Me.tooltipContent,Pe=Ne(null),{activeSelectionHook:Re,customHoverBehavior:Oe,customClickBehavior:Le}=J({selection:Q,linkedHover:Z,unwrapData:!0,onObservation:ne,chartType:"RealtimeLineChart",chartId:ae,mobileInteraction:i.mobileInteraction}),Ee=Be(e=>{B&&B(e),Oe(e)},[B,Oe]),je=null!=de,[We,Ge]=ze([]),qe=Ne(null),Xe=Ne(de);Xe.current=de;let Ye=Ne(je);Ye.current=je;let Qe=Ne(We),et=Be(e=>{Qe.current=e,Ge(e)},[]),it=Ne({timeAccessor:g,valueAccessor:p});it.current={timeAccessor:g,valueAccessor:p};let nt=je?[de.window??"tumbling",de.size,de.hop??"",de.gap??"",de.retain??"",(de.percentiles??[]).join(","),!0===de.distinct?"1":"0"].join("|"):"";De(()=>{if(!je)return void(qe.current=null);let e=Xe.current,t=new Je(e,h);if(qe.current=t,d){let{timeAccessor:e,valueAccessor:i}=it.current;for(let n of d)t.push(n,e,i)}et(t.emit(e))},[nt,je,d,g,p,h,et]),De(()=>{je&&qe.current&&et(qe.current.emit(Xe.current))},[de?.stat,de?.band,de?.sigma]);let st=Be(e=>{let t=qe.current,i=Xe.current;if(!t||!i)return;let{timeAccessor:n,valueAccessor:s}=it.current;for(let i of e)t.push(i,n,s);et(t.emit(i))},[et]),ot=null!=ge,rt=Ne(null),at=Ne(ge);at.current=ge;let lt=Ne(ot);lt.current=ot;let ct=Ne(ne);ct.current=ne;let ut=Ne(ae);ut.current=ae;let ht=ot?`${ge.lateness}|${ge.latePolicy??"drop"}`:"",mt=Be(e=>{0!==e.length&&(Ye.current?st(e):Pe.current?.pushMany(e))},[st]);De(()=>{let e=rt.current;if(e&&mt(e.flush()),!ot)return void(rt.current=null);let t=g;rt.current=k(at.current,e=>Number(A(e,t,"time")??NaN))},[ht,ot,mt,g]);let dt=Be(e=>{let t=rt.current;if(!lt.current||!t)return void mt(e);let i=[];for(let n of e){let e=t.push(n);for(let t of e.released)i.push(t);if(e.late.length){let i=ct.current;if(i){let{timeAccessor:n}=it.current,s=at.current?.latePolicy??"drop";for(let o of e.late)i({type:"late-data",datum:o,eventTime:Number(A(o,n,"time")??NaN),watermark:t.watermark,policy:s,lateCount:t.lateCount,timestamp:Date.now(),chartType:"RealtimeLineChart",chartId:ut.current})}}}mt(i)},[mt]),gt=Be(()=>{let e=rt.current;!lt.current||!e||mt(e.flush())},[mt]);Ie(t,()=>({push:e=>dt([e]),pushMany:e=>dt(e),flush:gt,remove:e=>Ye.current?[]:Pe.current?.remove(e)??[],update:(e,t)=>Ye.current?[]:Pe.current?.update(e,t)??[],clear:()=>{rt.current?.clear(),Ye.current?(qe.current?.clear(),et([])):Pe.current?.clear()},getData:()=>Ye.current?Qe.current:Pe.current?.getData()??[],getScales:()=>Pe.current?.getScales()??null}),[gt,dt,et]);let pt=re(le,ve[0],ve[1],ce),ft=pt?null:oe(je?void 0:d,ve[0],ve[1],ue),vt=Fe(()=>()=>({stroke:"#007bff",strokeWidth:2}),[]),wt=Fe(()=>ee(je?Ve:g??"time",je?$e:p??"value"),[je,g,p]),yt=Fe(()=>te(vt,P,wt),[vt,P,wt]),bt=Fe(()=>{let e=K(yt,{stroke:b,strokeWidth:x,opacity:M});return t=>({...e(t),...null!=C&&{strokeDasharray:C},...null!=T&&{cursor:T}})},[yt,b,x,M,C,T]),xt=_(bt,[Re],Q),At=a??l??"sliding",kt=v(c,d,u),St=he?`${o||""} semiotic-emphasis-${he}`.trim():o,Ct=je?We:d,_t=je?Ve:g,Ht=je?$e:p,Mt=je?"growing":At,Tt=de?.retain??Math.max(We.length,600),Pt=je?Math.max(1,Tt):kt,Nt=je&&de&&"none"!==(de.band??"none")?{y0Accessor:Ue,y1Accessor:Ke,perSeries:null!=h}:void 0;return pt||ft||/* @__PURE__ */tt(O,{ref:Pe,chartType:"line",runtimeMode:"streaming",size:ve,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:Se,className:St,...H(i,Ae,e.legendInteraction),arrowOfTime:r,windowMode:Mt,windowSize:Pt,data:Ct,timeAccessor:_t,valueAccessor:Ht,groupAccessor:je&&null!=h?Ze:h,xExtent:f,yExtent:w,extentPadding:y,band:Nt,lineStyle:xt??bt,showAxes:pe,background:N,hoverAnnotation:fe,tooltipContent:Te,tooltipMode:Me.tooltipMode,...U({linkedHover:Z,selection:Q,onObservation:ne,forceHoverBehavior:!0,mobileInteraction:i.mobileInteraction,customHoverBehavior:Ee,customClickBehavior:Le}),annotations:z,legend:ke,legendPosition:Ce,autoPlaceAnnotations:D,svgAnnotationRules:F,tickFormatTime:L,tickFormatValue:W,decay:V,pulse:$,staleness:G,transition:Y,pointIdAccessor:e.pointIdAccessor})}),"RealtimeLineChart");import{useRef as nt,forwardRef as st,useCallback as ot,useMemo as rt}from"react";import{useEffect as at,useLayoutEffect as lt,useMemo as ct,useRef as ut}from"react";var ht=/* @__PURE__ */Symbol("realtime-function-category-domain"),mt=typeof window>"u"?at:lt;import{jsx as dt}from"react/jsx-runtime";var gt=[],pt=/* @__PURE__ */G(/* @__PURE__ */st(function(e,t){E(B);let i=S(e),{binSize:n,size:s,margin:o,className:r,arrowOfTime:a="right",windowMode:l,capacityMode:c,windowSize:u,capacity:h,data:m,timeAccessor:g,valueAccessor:f,direction:w="up",timeExtent:y,valueExtent:x,extentPadding:k,categoryAccessor:I,colors:R,fill:z,stroke:D,strokeWidth:F,opacity:j,cursor:V,styleRules:K,valueBands:G,gap:Y,background:Z,tooltipContent:Q,tooltip:ee,onHover:ne,annotations:se,autoPlaceAnnotations:ae,svgAnnotationRules:le,tickFormatTime:ce,tickFormatValue:he,linkedHover:me,selection:de,decay:ge,pulse:pe,staleness:fe,transition:ve,onObservation:we,chartId:ye,loading:be,loadingContent:xe,emptyContent:Ae,emphasis:ke,legendPosition:Se,legend:Ce,brush:_e,onBrush:He,linkedBrush:Me}=e,Te=i.showAxes,Pe=rt(()=>T({axes:e.axes,showTimeAxis:e.showTimeAxis,showValueAxis:e.showValueAxis}),[e.axes,e.showTimeAxis,e.showValueAxis]),Ne=ue({showAxes:Te,axes:Pe}),Ie=P(i.marginDefaults,Pe,Te,!!i.title),Re=i.enableHover,Be=!1!==i.showLegend,ze=s??[i.width,i.height],De=W({isPushMode:void 0===m,colorBy:I,colorScheme:R,showLegend:!1,legendPosition:Se,trackCategoryDomain:Be,registerLinkedCategories:!1}),Fe=rt(()=>$(m??[],I),[m,I]),Oe=void 0===m?De.categories:Fe,{colorScale:Le,colorMap:Ee}=N({enabled:!!I,categories:Oe,colors:R,fallbackColor:z,order:"explicit-then-alpha",domainKey:I}),je=rt(()=>{if(!Ee)return Oe;let e=new Set(Oe);return Object.keys(Ee).filter(t=>e.has(t))},[Oe,Ee]),We=ot(e=>{if(null!=e.category)return String(e.category);let t="function"==typeof I?I(e):I?e[I]:"";return String(t)},[I]),{legend:Ve,margin:$e,legendPosition:Ue,hasAutomaticLegend:Ke}=q({data:gt,colorBy:I,colorScale:Le,showLegend:i.showLegend,legendPosition:Se,userMargin:o,defaults:Ie,categories:je,additionalLegend:Ce,chartWidth:ze[0],chartHeight:ze[1],axisChrome:Ne}),Ge=X(e.legendInteraction,I?We:void 0,je,Ke,!0),qe=ie({tooltip:ee,defaultTooltipContent:p({timeAccessor:g,valueAccessor:f,formatTime:ce}),multiDefaultContent:d({timeAccessor:g,valueAccessor:f,formatTime:ce}),customFunctionContext:"hover"}),Xe=Q??qe.tooltipContent,Ye=nt(null),{activeSelectionHook:Ze,hoverSelectionHook:Je,customHoverBehavior:Qe,customClickBehavior:et}=J({selection:de,linkedHover:me,hoverHighlight:e.hoverHighlight,hoverHighlightField:"binStart",unwrapData:!0,onObservation:we,chartType:"RealtimeHistogram",chartId:ye,mobileInteraction:i.mobileInteraction}),tt=ot(e=>{ne&&ne(e),Qe(e)},[ne,Qe]),it=!0===_e?{dimension:"x",snap:"bin"}:"x"===_e?{dimension:"x"}:"object"==typeof _e?_e:void 0,st=ot(e=>{He&&He(e),we&&we(e?{type:"brush",extent:e,timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:ye}:{type:"brush-end",timestamp:Date.now(),chartType:"RealtimeHistogram",chartId:ye})},[He,we,ye]),{brushStreamProps:at}=L({linkedBrush:Me,xAccessor:"string"==typeof g?g:"time",defaultDimension:"x",onBrush:st});C(t,Ye);let lt=re(be,ze[0],ze[1],xe),ct=lt?null:oe(m,ze[0],ze[1],Ae),ut={};null!=z&&(ut.fill=z),null!=D&&(ut.stroke=D),null!=F&&(ut.strokeWidth=F),null!=j&&(ut.opacity=j),null!=V&&(ut.cursor=V),null!=Y&&(ut.gap=Y),null!=G&&(ut.valueBands=G);let ht=rt(()=>{if(I&&Le)return e=>null==e.category?{}:{fill:Le(String(e.category))}},[I,Le]),mt=rt(()=>e=>{let t=e.categoryValue??e.total,i="number"==typeof t&&Number.isFinite(t)?t:void 0,n=Number(e.binStart),s=Number(e.binEnd);return{value:i,x:Number.isFinite(n)&&Number.isFinite(s)?(n+s)/2:void 0,y:i,category:null==e.category?void 0:String(e.category)}},[]),pt=rt(()=>te(ht,K,mt),[ht,K,mt]),ft=rt(()=>e=>({...pt(e),...!I&&null!=z&&{fill:z},...null!=D&&{stroke:D},...null!=F&&{strokeWidth:F},...null!=j&&{opacity:j},...null!=V&&{cursor:V}}),[pt,I,z,D,F,j,V]),vt=Je||Ge.legendSelectionHook||Ze,wt="string"==typeof g?g:"time",yt=_(ft,[vt],de,rt(()=>M(wt),[wt])),bt=ke?`${r||""} semiotic-emphasis-${ke}`.trim():r,xt=ot(e=>A(e,g,"time")??NaN,[g]),At=ot(e=>b(e,f,"value")??NaN,[f]),kt=l??c??"sliding",St=v(u,m,h);return lt||ct||/* @__PURE__ */dt(O,{ref:Ye,chartType:"bar",runtimeMode:"streaming",size:ze,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:$e,className:bt,...H(i,Ge,e.legendInteraction),arrowOfTime:a,windowMode:kt,windowSize:St,data:m,timeAccessor:xt,valueAccessor:At,xExtent:y,yExtent:x,invertY:"down"===w,extentPadding:k,binSize:n,categoryAccessor:I,barColors:Ee,barStyle:ut,areaStyle:yt,showAxes:Te,showGrid:i.showGrid,axes:Pe,background:Z,hoverAnnotation:Re,tooltipContent:Xe,tooltipMode:qe.tooltipMode,...U({linkedHover:me,selection:de,hoverHighlight:e.hoverHighlight,onObservation:we,forceHoverBehavior:!0,mobileInteraction:i.mobileInteraction,customHoverBehavior:tt,customClickBehavior:et}),annotations:se,autoPlaceAnnotations:ae,svgAnnotationRules:le,tickFormatTime:ce,tickFormatValue:he,decay:ge,pulse:pe,staleness:fe,transition:ve,pointIdAccessor:e.pointIdAccessor,legend:Ve,legendPosition:Ue,...De.categoryDomainProps,brush:it||(Me?at.brush:void 0),onBrush:it||Me?at.onBrush:void 0})}),"RealtimeHistogram"),ft=/* @__PURE__ */G(function(e){/* @__PURE__ */
|
|
37
|
-
return dt(pt,{...e,windowMode:"growing"})},"TemporalHistogram"),vt=pt;import{useRef as wt,forwardRef as yt,useCallback as bt,useMemo as xt}from"react";import{jsx as At}from"react/jsx-runtime";var kt=[],St=/* @__PURE__ */G(/* @__PURE__ */yt(function(e,t){E(z);let i=S(e),{size:n,margin:s,className:o,arrowOfTime:r="right",windowMode:a,capacityMode:l,windowSize:c,capacity:u,data:h,timeAccessor:d,valueAccessor:g,timeExtent:p,valueExtent:f,yScaleType:w,extentPadding:y,decay:b,pulse:x,staleness:A,transition:k,categoryAccessor:M,colors:T,radius:P,fill:I,opacity:R,stroke:B,strokeWidth:D,cursor:F,pointStyle:L,styleRules:j,background:V,tooltipContent:K,tooltip:G,onHover:Y,annotations:Z,autoPlaceAnnotations:Q,svgAnnotationRules:ie,tickFormatTime:se,tickFormatValue:ae,linkedHover:le,selection:ce,onObservation:ue,chartId:he,loading:me,loadingContent:de,emptyContent:ge,emphasis:pe,legendPosition:fe}=e,ve=i.showAxes,we=i.enableHover,ye=!0===i.showLegend,be=n??[i.width,i.height],xe=W({isPushMode:void 0===h,colorBy:M,colorScheme:T,showLegend:!1,legendPosition:fe,trackCategoryDomain:ye,registerLinkedCategories:!1}),Ae=xt(()=>$(h??[],M),[h,M]),ke=void 0===h?xe.categories:Ae,{colorScale:Se}=N({enabled:!!M,categories:ke,colors:T,fallbackColor:I,domainKey:M}),{legend:Ce,margin:_e,legendPosition:He,hasAutomaticLegend:Me}=q({data:kt,colorBy:M,colorScale:Se,showLegend:ye,legendPosition:fe,userMargin:s,defaults:i.marginDefaults,categories:ke,chartWidth:be[0],chartHeight:be[1],axisChrome:{hasAxis:!1!==i.showAxes}}),Te=X(e.legendInteraction,M,ke,Me,!0),Pe=K??ne({tooltip:G,defaultTooltipContent:m({timeAccessor:d,valueAccessor:g}),customFunctionContext:"hover"}).tooltipContent,Ne=wt(null),{activeSelectionHook:Ie,hoverSelectionHook:Re,customHoverBehavior:Be,customClickBehavior:ze}=J({selection:ce,linkedHover:le,unwrapData:!0,onObservation:ue,chartType:"RealtimeSwarmChart",chartId:he,mobileInteraction:i.mobileInteraction}),De=bt(e=>{Y&&Y(e),Be(e)},[Y,Be]);C(t,Ne);let Fe=re(me,be[0],be[1],de),Oe=Fe?null:oe(h,be[0],be[1],ge),Le={};null!=P&&(Le.radius=P),null!=I&&(Le.fill=I),null!=R&&(Le.opacity=R),null!=B&&(Le.stroke=B),null!=D&&(Le.strokeWidth=D),null!=F&&(Le.cursor=F);let Ee=L,je=xt(()=>{if(M)return e=>{let t="function"==typeof M?M(e):M?e[M]:void 0;return{...M&&Se?{fill:Se(String(t))}:void 0}}},[M,Se]),We=xt(()=>{let e=ee(d??"time",g??"value");return t=>{let i="function"==typeof M?M(t):M?t[M]:void 0;return e(t,null==i?void 0:String(i))}},[d,g,M]),Ve=xt(()=>te(je,j,We),[je,j,We]),$e=_(xt(()=>e=>({...Ve(e),...Ee?.(e)}),[Ve,Ee]),[Re||Te.legendSelectionHook||Ie],ce),Ue=pe?`${o||""} semiotic-emphasis-${pe}`.trim():o,Ke=a??l??"sliding",Ge=v(c,h,u);return Fe||Oe||/* @__PURE__ */At(O,{ref:Ne,chartType:"swarm",runtimeMode:"streaming",size:be,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:_e,className:Ue,...H(i,Te,e.legendInteraction),arrowOfTime:r,windowMode:Ke,windowSize:Ge,data:h,timeAccessor:d,valueAccessor:g,xExtent:p,yExtent:f,yScaleType:w,extentPadding:y,decay:b,pulse:x,staleness:A,transition:k,categoryAccessor:M,swarmStyle:Le,pointStyle:$e,showAxes:ve,background:V,hoverAnnotation:we,tooltipContent:Pe,...U({linkedHover:le,selection:ce,onObservation:ue,forceHoverBehavior:!0,mobileInteraction:i.mobileInteraction,customHoverBehavior:De,customClickBehavior:ze}),annotations:Z,autoPlaceAnnotations:Q,svgAnnotationRules:ie,tickFormatTime:se,tickFormatValue:ae,legend:Ce,legendPosition:He,...xe.categoryDomainProps,pointIdAccessor:e.pointIdAccessor})}),"RealtimeSwarmChart");import{useRef as Ct,forwardRef as _t,useCallback as Ht,useMemo as Mt}from"react";import{jsx as Tt}from"react/jsx-runtime";var Pt=/* @__PURE__ */G(/* @__PURE__ */_t(function(e,t){E(D);let i=S(e),{size:n,margin:s,className:o,arrowOfTime:r="right",windowMode:a,capacityMode:l,windowSize:c,capacity:u,data:h,timeAccessor:m,valueAccessor:d,timeExtent:p,valueExtent:f,extentPadding:w,decay:y,pulse:b,staleness:x,transition:A,positiveColor:k,negativeColor:M,connectorStroke:T,connectorWidth:P,gap:N,stroke:I,strokeWidth:R,opacity:B,cursor:z,styleRules:F,background:L,tooltipContent:j,tooltip:W,onHover:V,annotations:$,autoPlaceAnnotations:K,svgAnnotationRules:G,tickFormatTime:Y,tickFormatValue:Z,linkedHover:Q,selection:ie,onObservation:se,chartId:ae,loading:le,loadingContent:ce,emptyContent:ue,emphasis:he,legendPosition:me}=e,de=i.showAxes,ge=i.enableHover,pe=n??[i.width,i.height],fe=Mt(()=>{if(i.showLegend)return{legendGroups:[{label:"Change",type:"fill",items:[{label:"Positive",color:k},{label:"Negative",color:M}],styleFn:e=>({fill:e.color||("Positive"===e.label?"var(--semiotic-success, #28a745)":"var(--semiotic-danger, #dc3545)")})}]}},[M,k,i.showLegend]),ve=Ht(e=>{let t=e.delta??("function"==typeof d?d(e):e[d??"value"]);return Number(t)>=0?"Positive":"Negative"},[d]),we=X(e.legendInteraction,ve,["Positive","Negative"]),{legend:ye,margin:be,legendPosition:xe}=q({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:me,userMargin:s,defaults:i.marginDefaults,additionalLegend:fe,chartWidth:pe[0],chartHeight:pe[1],axisChrome:{hasAxis:!1!==i.showAxes}}),Ae=j??ne({tooltip:W,defaultTooltipContent:g({timeAccessor:m,valueAccessor:d}),customFunctionContext:"hover"}).tooltipContent,ke=Ct(null),{activeSelectionHook:Se,hoverSelectionHook:Ce,customHoverBehavior:_e,customClickBehavior:He}=J({selection:ie,linkedHover:Q,unwrapData:!0,onObservation:se,chartType:"RealtimeWaterfallChart",chartId:ae,mobileInteraction:i.mobileInteraction}),Me=Ht(e=>{V&&V(e),_e(e)},[V,_e]);C(t,ke);let Te=re(le,pe[0],pe[1],ce),Pe=Te?null:oe(h,pe[0],pe[1],ue),Ne={};null!=k&&(Ne.positiveColor=k),null!=M&&(Ne.negativeColor=M),null!=T&&(Ne.connectorStroke=T),null!=P&&(Ne.connectorWidth=P),null!=N&&(Ne.gap=N),null!=I&&(Ne.stroke=I),null!=R&&(Ne.strokeWidth=R),null!=B&&(Ne.opacity=B),null!=z&&(Ne.cursor=z);let Ie=Ce||we.legendSelectionHook||Se,Re=Mt(()=>ee(m??"time",d??"value"),[m,d]),Be=Mt(()=>te(void 0,F,Re),[F,Re]),ze=_(Mt(()=>e=>({...Be(e),...null!=I&&{stroke:I},...null!=R&&{strokeWidth:R},...null!=B&&{opacity:B},...null!=z&&{cursor:z}}),[Be,I,R,B,z]),[Ie],ie),De=he?`${o||""} semiotic-emphasis-${he}`.trim():o,Fe=a??l??"sliding",Oe=v(c,h,u);return Te||Pe||/* @__PURE__ */Tt(O,{ref:ke,chartType:"waterfall",runtimeMode:"streaming",size:pe,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:be,className:De,...H(i,we,e.legendInteraction),arrowOfTime:r,windowMode:Fe,windowSize:Oe,data:h,timeAccessor:m,valueAccessor:d,xExtent:p,yExtent:f,extentPadding:w,decay:y,pulse:b,staleness:x,transition:A,waterfallStyle:Ne,areaStyle:ze,showAxes:de,background:L,hoverAnnotation:ge,tooltipContent:Ae,...U({linkedHover:Q,selection:ie,onObservation:se,forceHoverBehavior:!0,mobileInteraction:i.mobileInteraction,customHoverBehavior:Me,customClickBehavior:He}),annotations:$,autoPlaceAnnotations:K,svgAnnotationRules:G,tickFormatTime:Y,tickFormatValue:Z,legend:ye,legendPosition:xe,pointIdAccessor:e.pointIdAccessor})}),"RealtimeWaterfallChart");import{useRef as Nt,forwardRef as It,useCallback as Rt,useMemo as Bt,useState as zt}from"react";import{jsx as Dt}from"react/jsx-runtime";var Ft=/* @__PURE__ */G(/* @__PURE__ */It(function(e,t){E(R);let i=S(e),{size:n,margin:s,className:o,arrowOfTime:r="right",windowMode:a,capacityMode:l,windowSize:c,capacity:u,data:h,timeAccessor:m,valueAccessor:d,categoryAccessor:g,timeExtent:p,valueExtent:w,extentPadding:y,heatmapXBins:b=20,heatmapYBins:x=20,aggregation:A="count",colorScheme:k,customColorScale:M,cursor:T,styleRules:P,background:N,tooltipContent:B,tooltip:z,onHover:D,annotations:F,autoPlaceAnnotations:L,svgAnnotationRules:j,tickFormatTime:W,tickFormatValue:V,decay:$,pulse:K,staleness:G,linkedHover:X,selection:Z,onObservation:Q,chartId:ee,loading:ie,loadingContent:se,emptyContent:ae,emphasis:le,legendPosition:ce}=e,ue=i.showAxes,he=i.enableHover,me=n??[i.width,i.height],[de,pe]=zt(null),fe=Bt(()=>de??[0,1],[de]),ve=Bt(()=>{if("custom"===k&&M)return M;let e=ge(k||"blues");return t=>{let i=fe[1]-fe[0]||1;return e(Math.max(0,Math.min(1,(t-fe[0])/i)))}},[k,M,fe]),we=Y(e.legendInteraction,e=>Number(e.value),fe),ye=Bt(()=>i.showLegend?{gradient:{colorFn:ve,domain:fe,label:A}}:void 0,[A,ve,i.showLegend,fe]),{legend:be,margin:xe,legendPosition:Ae}=q({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:ce,userMargin:s,defaults:i.marginDefaults,additionalLegend:ye,chartWidth:me[0],chartHeight:me[1],axisChrome:{hasAxis:!1!==i.showAxes}}),ke=B??ne({tooltip:z,defaultTooltipContent:f({timeAccessor:m,valueAccessor:d}),customFunctionContext:"hover"}).tooltipContent,Se=Nt(null),{activeSelectionHook:Ce,hoverSelectionHook:_e,customHoverBehavior:He,customClickBehavior:Me}=J({selection:Z,linkedHover:X,unwrapData:!0,onObservation:Q,chartType:"RealtimeHeatmap",chartId:ee,mobileInteraction:i.mobileInteraction}),Te=Rt(e=>{D&&D(e),He(e)},[D,He]);C(t,Se);let Pe=re(ie,me[0],me[1],se),Ne=Pe?null:oe(h,me[0],me[1],ae),Ie=le?`${o||""} semiotic-emphasis-${le}`.trim():o,Re=a??l??"sliding",Be=v(c,h,u),ze=Bt(()=>{if(null==T)return;let e={cursor:T};return()=>e},[T]),De=Bt(()=>I(m??"time",d??"value",d??"value"),[m,d]),Fe=_(Bt(()=>te(ze,P,De),[ze,P,De]),[_e,we.legendSelectionHook,Ce],Z);return Pe||Ne||/* @__PURE__ */Dt(O,{ref:Se,chartType:"heatmap",runtimeMode:"streaming",size:me,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:xe,className:Ie,...H(i,we,e.legendInteraction),arrowOfTime:r,windowMode:Re,windowSize:Be,data:h,timeAccessor:m,valueAccessor:d,categoryAccessor:g,xExtent:p,yExtent:w,extentPadding:y,heatmapXBins:b,heatmapYBins:x,heatmapAggregation:A,colorScheme:"custom"!==k?k:void 0,heatmapColorScale:"custom"===k&&"function"==typeof M?M:void 0,onColorDomainChange:pe,areaStyle:Fe,showAxes:ue,background:N,hoverAnnotation:he,tooltipContent:ke,...U({linkedHover:X,selection:Z,onObservation:Q,forceHoverBehavior:!0,mobileInteraction:i.mobileInteraction,customHoverBehavior:Te,customClickBehavior:Me}),annotations:F,autoPlaceAnnotations:L,svgAnnotationRules:j,tickFormatTime:W,tickFormatValue:V,decay:$,pulse:K,staleness:G,legend:be,legendPosition:Ae,pointIdAccessor:e.pointIdAccessor})}),"RealtimeHeatmap");export{Ae as a,ke as b,Se as c,He as d,s as e,o as f,r as g,Pe as h,it as i,M as j,pt as k,ft as l,vt as m,St as n,Pt as o,Ft as p};
|