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/geo.module.min.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
function
|
|
3
|
-
return
|
|
4
|
-
/* @__PURE__ */
|
|
5
|
-
|
|
6
|
-
return
|
|
7
|
-
/* @__PURE__ */
|
|
8
|
-
|
|
9
|
-
/* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
return
|
|
2
|
+
import{a as e,b as t,c as i,d as o}from"./c-E3MKTERA.min.js";import{a as r,b as n}from"./c-C67QDKTU.min.js";import{a,b as l,c as s}from"./c-XI6CLZII.min.js";import{W as c,Y as u}from"./c-C5GXUHUO.min.js";import{b as d}from"./c-IU4QZ7Y5.min.js";import{$a as m,Bb as h,Fb as p,Hb as g,Ib as f,Kb as y,La as b,Lb as v,Ma as x,Mb as k,Nb as S,O as w,Ob as M,Sa as C,Xa as R,Ya as A,_a as N,a as j,ab as F,b as P,bb as H,hb as L,kb as I,lb as z,ob as W,xb as D,zb as O}from"./c-XCV7VUU3.min.js";import{c as T,f as B}from"./c-2OZMC2MZ.min.js";import{d as E,n as $,r as G,u as U}from"./c-ZOE7TAR3.min.js";import{i as K,j as Z,k as _,l as q}from"./c-SSKV5JPW.min.js";import{d as V,e as J}from"./c-RBWJFQDC.min.js";import{j as X,k as Y,o as Q,p as ee,q as te}from"./c-5FUOKMH6.min.js";import{a as ie}from"./c-3PFVJFBK.min.js";import{useMemo as oe}from"react";import{scaleSequential as re}from"d3-scale";import{useState as ne,useEffect as ae,useMemo as le}from"react";import{feature as se}from"topojson-client";var ce=/* @__PURE__ */new Map;function ue(e){return"default"in e?e.default:e}async function de(e){try{switch(e){case"world-110m":return{topology:ue(await(import("world-atlas/countries-110m.json"))),objectName:"countries"};case"world-50m":return{topology:ue(await(import("world-atlas/countries-50m.json"))),objectName:"countries"};case"land-110m":return{topology:ue(await(import("world-atlas/land-110m.json"))),objectName:"land"};case"land-50m":return{topology:ue(await(import("world-atlas/land-50m.json"))),objectName:"land"};default:throw new Error(`Unknown reference geography: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`)}}catch(t){let i=t instanceof Error?t.message:String(t);throw/Cannot find module|Failed to resolve|world-atlas/i.test(i)?new Error(`resolveReferenceGeography("${e}"): Install the optional peer dependency \`world-atlas\` (\`npm install world-atlas\`) to use built-in reference geographies, or pass GeoJSON Feature[] to \`areas\`.`,{cause:t}):t}}async function me(e){let t=ce.get(e);if(t)return t;let{topology:i,objectName:o}=await de(e);if(!i||!i.objects)throw new Error(`resolveReferenceGeography("${e}"): Failed to load topology. Got ${typeof i} with keys: ${i?Object.keys(i).join(", "):"none"}`);let r=se(i,i.objects[o]),n="features"in r?r.features:[r];return ce.set(e,n),n}function he(e){return"string"==typeof e&&["world-110m","world-50m","land-110m","land-50m"].includes(e)}function pe(e){let t=le(()=>Array.isArray(e)?e:void 0,[e]),[i,o]=ne(null);return ae(()=>{if(e&&!Array.isArray(e)){if(he(e)){let t=!1;return o(null),me(e).then(e=>{t||o(e)}),()=>{t=!0}}"production"!==process.env.NODE_ENV&&console.warn(`[semiotic] Unknown areas reference: "${e}". Supported: "world-110m", "world-50m", "land-110m", "land-50m".`),o(null)}else o(null)},[e]),void 0!==t?t:i}import{jsx as ge,jsxs as fe}from"react/jsx-runtime";function ye(e){return e.properties&&"object"==typeof e.properties?{...e.properties,...e}:e}var be=/* @__PURE__ */R(function(e){let t=g(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),i=h(),{areas:o,valueAccessor:n,styleRules:l,colorScheme:s,projection:d="equalEarth",graticule:f,fitPadding:y,zoomable:b,zoomExtent:v,onZoom:x,dragRotate:k,tileURL:S,tileAttribution:w,tileCacheSize:R,tooltip:j,areaOpacity:H=1,annotations:L,legendInteraction:I,legendPosition:z,margin:T,className:$,selection:G,linkedHover:U,onObservation:K,onClick:Z,chartId:_,loading:q,loadingContent:V,emptyContent:J,frameProps:X={},stroke:Y,strokeWidth:Q,opacity:ee}=e,te=b??!!S,ie=pe(o),ne=oe(()=>ie&&P(ie),[ie]),ae=oe(()=>"function"==typeof n?n:e=>e?.properties?.[n]??e?.[n],[n]),le=s??i??"blues",se=oe(()=>{if(!ne)return re(E(void 0)).domain([0,1]);let e=1/0,t=-1/0;for(let i of ne){let o=ae(i);null==o||!isFinite(o)||(o<e&&(e=o),o>t&&(t=o))}let i=E(le);return re(i).domain([Number.isFinite(e)?e:0,Number.isFinite(t)?t:1])},[ne,ae,le]),ce=oe(()=>{let e=se.domain();return[e[0]??0,e[1]??1]},[se]),ue=O(I,ae,ce),{activeSelectionHook:de,hoverSelectionHook:me,customHoverBehavior:he,customClickBehavior:be}=p({selection:G,linkedHover:U,onObservation:K,onClick:Z,chartType:"ChoroplethMap",chartId:_,mobileInteraction:t.mobileInteraction}),ve=a(G),xe=me||ue.legendSelectionHook||de,ke=oe(()=>{let e=M(e=>{let t=ae(e);return{fill:null!=t&&isFinite(t)?se(t):"#ccc",stroke:"#999",strokeWidth:.5,fillOpacity:H}},l,e=>({value:ae(e)}),e=>e&&"object"==typeof e&&e.properties?{...e.properties,...e}:e),t=u(e,{stroke:Y,strokeWidth:Q,opacity:ee});return xe?B(t,xe,ve,ye):t},[ae,se,xe,ve,H,Y,Q,ee,l]),Se=oe(()=>e=>{let t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||"Feature",i=ae(e);/* */
|
|
3
|
+
return fe("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[
|
|
4
|
+
/* @__PURE__ */ge("div",{style:{fontWeight:600},children:t}),null!=i&&/* @__PURE__ */ge("div",{style:{opacity:.7},children:(o=i,"number"==typeof o&&isFinite(o)?Number.isInteger(o)?o.toLocaleString():o.toLocaleString(void 0,{maximumFractionDigits:2}):String(o??""))})]});var o},[ae]),we=W(t),Me=oe(()=>!1===t.showLegend?void 0:{gradient:{colorFn:e=>se(e),domain:ce,label:"string"==typeof n?n:"value"}},[se,t.showLegend,n,ce]),{legend:Ce,margin:Re,legendPosition:Ae,legendMarginReserved:Ne}=D({data:[],colorBy:void 0,colorScale:void 0,showLegend:!1,legendPosition:z,userMargin:T,defaults:we,additionalLegend:Me,chartWidth:t.width,chartHeight:t.height,legendLayout:X.legendLayout,frameLegend:X,hasTitle:!!t.title,axisChrome:{hasAxis:!1}}),je=F(q,t.width,t.height,V,e)||(ne?null:F(!0,t.width,t.height,V,e)),Fe=je?null:m(ne,t.width,t.height,J,e);if(Array.isArray(ne)&&ne.length>0){let e=ne[0];if(!e||"object"!=typeof e||!e.geometry)/* */
|
|
5
|
+
return ge(A,{componentName:"ChoroplethMap",message:"ChoroplethMap: areas must be an array of GeoJSON Features with a geometry property.",width:t.width,height:t.height})}let Pe={projection:d,areas:ne,areaStyle:ke,size:[t.width,t.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:Re,enableHover:t.enableHover,...Ce&&{legend:Ce,legendPosition:Ae},...Ne&&{__legendMarginReservedFor:Ce},legendHoverBehavior:ue.onLegendHover,legendClickBehavior:ue.onLegendClick,legendHighlightedCategory:ue.highlightedCategory,legendIsolatedCategories:"isolate"===I?ue.isolatedCategories:void 0,tooltipContent:!1===j?()=>null:!0===j?Se:C(j)||Se,...null!=f&&{graticule:f},...null!=y&&{fitPadding:y},...te&&{zoomable:!0},...v&&{zoomExtent:v},...x&&{onZoom:x},...null!=k&&{dragRotate:k},...S&&{tileURL:S},...w&&{tileAttribution:w},...R&&{tileCacheSize:R},...c({linkedHover:U,selection:G,onObservation:K,onClick:Z,mobileInteraction:t.mobileInteraction,customHoverBehavior:he,customClickBehavior:be,linkedHoverInClickPredicate:!1}),...L&&L.length>0&&{annotations:L},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...t.title&&{title:t.title},...t.description&&{description:t.description},...t.summary&&{summary:t.summary},...void 0!==t.accessibleTable&&{accessibleTable:t.accessibleTable},...$&&{className:$},...null!=e.animate&&{animate:e.animate},...X};return je||Fe||/* @__PURE__ */ge(N,{componentName:"ChoroplethMap",width:t.width,height:t.height,children:/* @__PURE__ */ge(r,{...Pe})})},"ChoroplethMap");import{useMemo as ve,useRef as xe,forwardRef as ke}from"react";var Se={fill:"#f0f0f0",stroke:"#ccc",strokeWidth:.5};import{jsx as we,jsxs as Me}from"react/jsx-runtime";var Ce=[3,30],Re=[1,4],Ae=/* @__PURE__ */R(/* @__PURE__ */ke(function(e,t){let i=xe(null);s(t,{variant:"geo-points",frameRef:i});let o=g(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:n,xAccessor:a="lon",yAccessor:d="lat",sizeBy:m,sizeRange:h,colorBy:p,styleRules:f,colorScheme:b,projection:v="equalEarth",graticule:x,fitPadding:k,zoomable:S,zoomExtent:w,onZoom:R,dragRotate:A,tileURL:F,tileAttribution:P,tileCacheSize:L,areas:I,areaStyle:z=Se,tooltip:D,annotations:O,margin:T,className:E,selection:K,linkedHover:Z,onObservation:_,onClick:q,chartId:V,loading:J,loadingContent:X,emptyContent:Y,legendInteraction:Q,legendPosition:ee,frameProps:te={},stroke:oe,strokeWidth:re,opacity:ne}=e,ae=h??("sparkline"===o.mode?Re:Ce),le="sparkline"===o.mode?1.5:6,se=S??!!F,ce=pe(I),ue=l({responsive:e,data:n??j,rawData:n,colorBy:p,colorScheme:b,legendInteraction:Q,legendPosition:ee,frameLegend:te,selection:K,linkedHover:Z,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:_,onClick:q,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ProportionalSymbolMap",chartId:V,showLegend:o.showLegend,userMargin:T,marginDefaults:W(o),loading:J,loadingContent:X,emptyContent:Y,width:o.width,height:o.height,hasTitle:!!o.title}),de=ue.data,me=ve(()=>{if(!m)return;let e="function"==typeof m?m:e=>e?.[m],t=de.filter(Boolean).map(t=>e(t)).filter(e=>null!=e&&isFinite(e));return 0!==t.length?ie(t):void 0},[de,m]),he=ve(()=>{let e=M(e=>({fill:p?G(e,p,ue.colorScale):$,fillOpacity:.7,stroke:"#fff",strokeWidth:.5,r:m?U(e,m,ae,me):le}),f,y(p,m)),t=u(e,{stroke:oe,strokeWidth:re,opacity:ne});return ue.effectiveSelectionHook?B(t,ue.effectiveSelectionHook,ue.resolvedSelection):t},[p,ue.colorScale,ue.effectiveSelectionHook,ue.resolvedSelection,m,ae,me,le,oe,re,ne,f]),ge=ve(()=>e=>{let t=e?.name||e?.label||e?.NAME||e?.id,i="string"==typeof m?m:null,o=("function"==typeof m?m:e=>e[m])(e),r=e=>"number"==typeof e&&isFinite(e)?Number.isInteger(e)?e.toLocaleString():e.toLocaleString(void 0,{maximumFractionDigits:2}):String(e??""),n="string"==typeof p?p:null,a=n?e?.[n]:null;/* */
|
|
6
|
+
return Me("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[t&&/* @__PURE__ */we("div",{style:{fontWeight:600,marginBottom:2},children:t}),i&&null!=o&&/* @__PURE__ */Me("div",{children:[
|
|
7
|
+
/* @__PURE__ */Me("span",{style:{opacity:.7},children:[i,": "]}),r(o)]}),n&&null!=a&&/* @__PURE__ */Me("div",{children:[
|
|
8
|
+
/* @__PURE__ */Me("span",{style:{opacity:.7},children:[n,": "]}),String(a)]}),!t&&!i&&Object.entries(e).filter(([e])=>"data"!==e&&"x"!==e&&"y"!==e&&"time"!==e).slice(0,4).map(([e,t])=>/* @__PURE__ */Me("div",{children:[
|
|
9
|
+
/* @__PURE__ */Me("span",{style:{opacity:.7},children:[e,": "]}),r(t)]},e))]})},[m,p]);if(ue.earlyReturn)return ue.earlyReturn;H("ProportionalSymbolMap",de,"xAccessor",a),H("ProportionalSymbolMap",de,"yAccessor",d);let fe={projection:v,...null!=n&&{points:de},xAccessor:a,yAccessor:d,pointStyle:he,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{areas:ce,areaStyle:z},...null!=x&&{graticule:x},...null!=k&&{fitPadding:k},...se&&{zoomable:!0},...w&&{zoomExtent:w},...R&&{onZoom:R},...null!=A&&{dragRotate:A},...F&&{tileURL:F},...P&&{tileAttribution:P},...L&&{tileCacheSize:L},size:[o.width,o.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:ue.margin,enableHover:o.enableHover,tooltipContent:!1===D?()=>null:C(D)||ge,...ue.legendBehaviorProps,...c({linkedHover:Z,selection:K,onObservation:_,onClick:q,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior,linkedHoverInClickPredicate:!1}),...O&&O.length>0&&{annotations:O},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...o.title&&{title:o.title},...o.description&&{description:o.description},...o.summary&&{summary:o.summary},...void 0!==o.accessibleTable&&{accessibleTable:o.accessibleTable},...E&&{className:E},...null!=e.animate&&{animate:e.animate},...te};/* */
|
|
10
|
+
return we(N,{componentName:"ProportionalSymbolMap",width:o.width,height:o.height,children:/* @__PURE__ */we(r,{ref:i,...fe})})}),"ProportionalSymbolMap");import{useMemo as Ne,useCallback as je,useRef as Fe,forwardRef as Pe}from"react";function He(e,t,i){let[o,r]=i;if(!t)return o;let[n,a]=t,l=a>n?a-n:0,s=Number(e),c=Number.isFinite(s)?s:n,u=l>0?(c-n)/l:0;return o+Math.max(0,Math.min(1,u))*(r-o)}function Le(e){let{valueAccessor:t,valueDomain:i,edgeWidthRange:o,resolveStroke:r,edgeOpacity:n,edgeLinecap:a,styleRules:l}=e,s=f(t);return M(e=>({stroke:r(e),strokeWidth:He(e[t],i,o),strokeLinecap:a,opacity:n,fillOpacity:0}),l,e=>({value:s(e)}))}import{jsx as Ie,jsxs as ze}from"react/jsx-runtime";var We="__semiotic_x",De="__semiotic_y",Oe=/* @__PURE__ */R(/* @__PURE__ */Pe(function(e,t){let i=g(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{flows:o,nodes:n,nodeIdAccessor:a="id",xAccessor:d="lon",yAccessor:m="lat",valueAccessor:h="value",projection:p="equalEarth",graticule:f,fitPadding:y,zoomable:b,zoomExtent:v,onZoom:x,dragRotate:k,tileURL:S,tileAttribution:w,tileCacheSize:M,lineType:R="geo",flowStyle:A="basic",areas:F,areaStyle:H=Se,edgeColorBy:I,edgeOpacity:z=.6,edgeWidthRange:D=[1,8],pointRadius:O,edgeLinecap:E="round",colorScheme:U,styleRules:K,showParticles:Z,particleStyle:_,tooltip:q,annotations:V,margin:J,className:Y,selection:Q,linkedHover:ee,onObservation:te,onClick:oe,chartId:re,loading:ne,loadingContent:ae,emptyContent:le,frameProps:se={},legendInteraction:ce,legendPosition:ue,stroke:de,strokeWidth:me,opacity:he,lineIdAccessor:ge}=e,fe=b??!!S,ye=pe(F),be=Ne(()=>P(n),[n]),ve=l({responsive:e,data:o??j,rawData:o,colorBy:I,colorScheme:U,legendInteraction:ce,legendPosition:ue,frameLegend:se,selection:Q,linkedHover:ee,fallbackFields:I?["string"==typeof I?I:""]:[],unwrapData:!1,onObservation:te,onClick:oe,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"FlowMap",chartId:re,showLegend:i.showLegend,userMargin:J,marginDefaults:W(i),loading:ne,loadingContent:ae,emptyContent:le,width:i.width,height:i.height,hasTitle:!!i.title}),xe=ve.data,ke=T(ee),we=L({name:ke?.name||"hover",fields:ke?.fields||[]}),Me=X(e=>e.pushObservation),Ce=Ne(()=>{let e=/* @__PURE__ */new Map;for(let t of be)e.set(String(t[a]),t);return e},[be,a]),Re=Fe(null),Ae=Fe(Ce);Ae.current=Ce;let Pe=Fe(d);Pe.current=d;let He=Fe(m);He.current=m;let Oe=je(e=>{if(!e||"object"!=typeof e||null==e.source||null==e.target)return null;let t=Ae.current,i=t.get(String(e.source)),o=t.get(String(e.target));if(!i||!o)return null;let r="function"==typeof Pe.current?Pe.current:e=>e[Pe.current],n="function"==typeof He.current?He.current:e=>e[He.current];return{...e,coordinates:[{[We]:r(i),[De]:n(i)},{[We]:r(o),[De]:n(o)}]}},[]);s(t,{variant:"geo-lines",frameRef:Re,overrides:{push:e=>{let t=Oe(e);t&&Re.current?.pushLine(t)},pushMany:e=>{let t=[];for(let i of e){let e=Oe(i);e&&t.push(e)}t.length>0&&Re.current?.pushManyLines(t)}}});let Te=Ne(()=>{let e=/* @__PURE__ */new Map;for(let t of xe)!t||"object"!=typeof t||(null!=t.source&&!e.has(t.source)&&e.set(t.source,t),null!=t.target&&!e.has(t.target)&&e.set(t.target,t));return e},[xe]),Be=je(e=>{if(ee)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"point"===e.type){let e=String(t[a]),i=Te.get(e);i&&we.onHover(i)}else we.onHover(t)}else we.onHover(null);if(te||Me){let t={timestamp:Date.now(),chartType:"FlowMap",chartId:re};if(e){let i=e.data||e.datum||e;Array.isArray(i)&&(i=i[0]);let o={...t,type:"hover",datum:i||{},x:e.x??0,y:e.y??0};te&&te(o),Me&&Me(o)}else{let e={...t,type:"hover-end"};te&&te(e),Me&&Me(e)}}},[ee,we,a,Te,te,re,Me]),Ee=ve.customClickBehavior,$e=Ne(()=>{let e="function"==typeof d?d:e=>e[d],t="function"==typeof m?m:e=>e[m];return xe.map(i=>{if(!i||"object"!=typeof i||null==i.source||null==i.target)return null;let o=Ce.get(String(i.source)),r=Ce.get(String(i.target));return o&&r?{...i,coordinates:[{[We]:e(o),[De]:t(o)},{[We]:e(r),[De]:t(r)}]}:null}).filter(Boolean)},[xe,Ce,d,m]),Ge=Ne(()=>{let e="function"==typeof d?d:e=>e[d];return t=>null!=t&&"object"==typeof t&&We in t?t[We]:e(t)},[d]),Ue=Ne(()=>{let e="function"==typeof m?m:e=>e[m];return t=>null!=t&&"object"==typeof t&&De in t?t[De]:e(t)},[m]),Ke=Ne(()=>{let e=xe.filter(e=>e&&"object"==typeof e).map(e=>Number(e[h]??0)).filter(e=>Number.isFinite(e));if(0!==e.length)return ie(e)},[xe,h]),Ze=Ne(()=>Le({valueAccessor:h,valueDomain:Ke,edgeWidthRange:D,resolveStroke:e=>I?G(e,I,ve.colorScale):$,edgeOpacity:z,edgeLinecap:E,styleRules:K}),[h,Ke,D,I,ve.colorScale,z,E,K]),_e=Ne(()=>{let e=u(Ze,{stroke:de,strokeWidth:me,opacity:he});if(!ve.effectiveSelectionHook)return e;let t={...ve.resolvedSelection?.unselectedStyle||{},fillOpacity:0};return B(e,ve.effectiveSelectionHook,{...ve.resolvedSelection||{},unselectedStyle:t})},[Ze,ve.effectiveSelectionHook,ve.resolvedSelection,de,me,he]),qe=O??("sparkline"===i.mode?1.5:5),Ve=Ne(()=>u(()=>({fill:"#333",r:qe,fillOpacity:.8}),{stroke:de,strokeWidth:me,opacity:he}),[qe,de,me,he]),Je=Ne(()=>e=>{if(e?.geometry||e?.properties||e?.data?.geometry){let t=e?.properties?.name||e?.properties?.NAME||e?.name||e?.NAME||e?.data?.properties?.name||e?.data?.properties?.NAME;if(t)/* */
|
|
11
|
+
return Ie("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:/* @__PURE__ */Ie("div",{style:{fontWeight:600},children:t})})}if(null!=e?.source&&null!=e?.target){let t=e[h];/* */
|
|
12
|
+
return ze("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[
|
|
13
|
+
/* @__PURE__ */ze("div",{style:{fontWeight:600},children:[e.source," → ",e.target]}),null!=t&&/* @__PURE__ */Ie("div",{style:{opacity:.7},children:"number"==typeof t?t.toLocaleString():t})]})}let t=e?.name||e?.label||e?.[a];return null!=t?/* @__PURE__ */Ie("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:/* @__PURE__ */Ie("div",{style:{fontWeight:600},children:t})}):null},[h,a]);if(ve.earlyReturn)return ve.earlyReturn;let Xe={projection:p,...null!=o&&{lines:$e},points:be,xAccessor:Ge,yAccessor:Ue,lineDataAccessor:"coordinates",...null!=ge&&{lineIdAccessor:ge},lineType:R,flowStyle:A,lineStyle:_e,pointStyle:Ve,...ye&&{areas:ye,areaStyle:H},...null!=f&&{graticule:f},...null!=y&&{fitPadding:y},...fe&&{zoomable:!0},...v&&{zoomExtent:v},...x&&{onZoom:x},...null!=k&&{dragRotate:k},...Z&&{showParticles:Z},..._&&{particleStyle:_},...S&&{tileURL:S},...w&&{tileAttribution:w},...M&&{tileCacheSize:M},size:[i.width,i.height],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,maxDevicePixelRatio:e.maxDevicePixelRatio,margin:ve.margin,enableHover:i.enableHover,tooltipContent:!1===q?()=>null:C(q)||Je,...ve.legendBehaviorProps,...c({linkedHover:ee,selection:Q,onObservation:te,onClick:oe,mobileInteraction:ve.mobileInteraction,customHoverBehavior:Be,customClickBehavior:Ee,linkedHoverInClickPredicate:!1}),...V&&V.length>0&&{annotations:V},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...i.title&&{title:i.title},...i.description&&{description:i.description},...i.summary&&{summary:i.summary},...void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable},...Y&&{className:Y},...null!=e.animate&&{animate:e.animate},...se};/* */
|
|
14
|
+
return Ie(N,{componentName:"FlowMap",width:i.width,height:i.height,children:/* @__PURE__ */Ie(r,{ref:Re,...Xe})})}),"FlowMap");import{useMemo as Te,useRef as Be,useState as Ee,useEffect as $e,useCallback as Ge,forwardRef as Ue}from"react";import{jsx as Ke,jsxs as Ze}from"react/jsx-runtime";function _e({bottomMargin:e,costLabel:t,layout:{cx:i,cy:o,maxCost:r,availableRadius:n,layout:a},ringStyle:l,ringValues:s,showNorth:c,showRingLabels:u,showRings:d}){let m="strip"===a,h={stroke:m?"var(--semiotic-border, #999)":"#999",strokeWidth:m?1:.8,strokeDasharray:m?"none":"4,3",labelColor:"var(--semiotic-text-secondary, #777)",labelSize:m?8:10,...l};/* */
|
|
15
|
+
return Ze("g",m?{children:[
|
|
16
|
+
/* @__PURE__ */Ke("line",{x1:i,y1:o,x2:i+n,y2:o,stroke:h.stroke,strokeWidth:h.strokeWidth,strokeLinecap:"round",opacity:.85}),
|
|
17
|
+
/* @__PURE__ */Ke("line",{x1:i,y1:o-3.5,x2:i,y2:o+3.5,stroke:h.stroke,strokeWidth:h.strokeWidth,opacity:.9}),d&&s.map(a=>{let l=i+(r>0?a/r*n:0);/* */
|
|
18
|
+
return Ze("g",{children:[
|
|
19
|
+
/* @__PURE__ */Ke("line",{x1:l,y1:o-2.5,x2:l,y2:o+2.5,stroke:h.stroke,strokeWidth:.9,opacity:.65}),u&&/* @__PURE__ */Ze("text",{x:l,y:o+Math.min(10,(e??2)+8),textAnchor:"middle",fontSize:h.labelSize,fill:h.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[a,t?` ${t}`:""]})]},a)})]}:{children:[s.map(e=>{let a=e/r*n;/* */
|
|
20
|
+
return Ze("g",{children:[
|
|
21
|
+
/* @__PURE__ */Ke("circle",{cx:i,cy:o,r:a,fill:"none",stroke:h.stroke,strokeWidth:h.strokeWidth,strokeDasharray:h.strokeDasharray,opacity:.5}),u&&/* @__PURE__ */Ze("text",{x:i+a+3,y:o-2,fontSize:h.labelSize,fill:h.labelColor,fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:[e,t?` ${t}`:""]})]},e)}),c&&/* @__PURE__ */Ze("g",{transform:"translate(24, 24)",children:[
|
|
22
|
+
/* @__PURE__ */Ke("circle",{r:16,fill:"white",fillOpacity:.85,stroke:"#bbb",strokeWidth:.8}),
|
|
23
|
+
/* @__PURE__ */Ke("path",{d:"M0,-11 L3,-3 L1,-4 L1,7 L-1,7 L-1,-4 L-3,-3 Z",fill:"#555",stroke:"none"}),
|
|
24
|
+
/* @__PURE__ */Ke("text",{y:-12,textAnchor:"middle",fontSize:7,fontWeight:700,fill:"#555",fontFamily:"var(--semiotic-font-family, system-ui, sans-serif)",children:"N"}),
|
|
25
|
+
/* @__PURE__ */Ke("line",{x1:11,y1:0,x2:13,y2:0,stroke:"#bbb",strokeWidth:.8}),
|
|
26
|
+
/* @__PURE__ */Ke("line",{x1:-11,y1:0,x2:-13,y2:0,stroke:"#bbb",strokeWidth:.8}),
|
|
27
|
+
/* @__PURE__ */Ke("line",{x1:0,y1:11,x2:0,y2:13,stroke:"#bbb",strokeWidth:.8})]})]})}import{Fragment as qe,jsx as Ve,jsxs as Je}from"react/jsx-runtime";var Xe=/* @__PURE__ */R(/* @__PURE__ */Ue(function(e,t){let i=g(e.mode,{width:e.width,height:e.height,showLegend:e.showLegend,enableHover:e.enableHover,linkedHover:e.linkedHover,title:e.title,description:e.description,accessibleTable:e.accessibleTable,summary:e.summary,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{points:o,lines:n,xAccessor:a="lon",yAccessor:d="lat",nodeIdAccessor:m="id",center:h,costAccessor:p,strength:f=1,lineMode:b="straight",projection:v="mercator",graticule:x,fitPadding:k,zoomable:S,zoomExtent:w,onZoom:R,dragRotate:A,tileURL:j,tileAttribution:F,tileCacheSize:L,transition:I,colorBy:z,styleRules:D,colorScheme:O,pointRadius:T,tooltip:E,showRings:U,showRingLabels:K,ringStyle:Z,showNorth:_,costLabel:q,cartogramLayout:V,annotations:J,margin:X,className:Y,selection:Q,linkedHover:ee,onObservation:te,onClick:ie,chartId:oe,loading:re,loadingContent:ne,emptyContent:ae,legendPosition:le,frameProps:se={},stroke:ce,strokeWidth:ue,opacity:de}=e,me="sparkline"===i.mode,he=V??(me?"strip":"radial"),pe=T??(me?1.5:5),ge=U??!0,fe=K??("strip"!==he&&!i.compactMode),ye=_??("strip"!==he&&!me),be=S??!!j,ve=Te(()=>P(o),[o]),xe=l({responsive:e,data:ve,rawData:o,colorBy:z,colorScheme:O,legendInteraction:void 0,legendPosition:le,frameLegend:se,selection:Q,linkedHover:ee,fallbackFields:z?["string"==typeof z?z:""]:[],unwrapData:!1,onObservation:te,onClick:ie,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"DistanceCartogram",chartId:oe,showLegend:i.showLegend,userMargin:X,marginDefaults:W(i),loading:re,loadingContent:ne,emptyContent:ae,width:i.width,height:i.height,hasTitle:!!i.title}),ke=Te(()=>{let e=M(e=>{let t=e?.[m],i=null!=t&&String(t)===String(h);return{fill:z?G(e,z,xe.colorScale):$,fillOpacity:i?1:.8,stroke:i?"var(--semiotic-text, #222)":"#fff",strokeWidth:i?1.25:1,r:i?1.35*pe:pe}},D,y(z)),t=u(e,{stroke:ce,strokeWidth:ue,opacity:de});return xe.effectiveSelectionHook?B(t,xe.effectiveSelectionHook,xe.resolvedSelection):t},[z,xe.colorScale,xe.effectiveSelectionHook,xe.resolvedSelection,pe,ce,ue,de,D,h,m]),Se=Te(()=>({center:h,centerAccessor:m,costAccessor:p,strength:f,lineMode:b,layout:he}),[h,m,p,f,b,he]),we=Te(()=>{if(!n)return;let e="function"==typeof a?a:e=>e[a],t="function"==typeof d?d:e=>e[d],i=/* @__PURE__ */new Map;for(let e of ve)i.set(String(e[m]),e);return n.map(o=>{if(o.coordinates)return o;let r=i.get(String(o.source)),n=i.get(String(o.target));return r&&n?{...o,coordinates:[{[a]:e(r),[d]:t(r)},{[a]:e(n),[d]:t(n)}]}:null}).filter(Boolean)},[n,ve,a,d,m]),Me=Te(()=>e=>{let t=("function"==typeof p?p:e=>e[p])(e),i=e[m]||e.name||e.id||"Point";/* */
|
|
28
|
+
return Je("div",{style:{background:"rgba(0,0,0,0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12},children:[
|
|
29
|
+
/* @__PURE__ */Ve("div",{style:{fontWeight:600},children:i}),null!=t&&/* @__PURE__ */Je("div",{style:{opacity:.7},children:["Cost: ","number"==typeof t?t.toFixed(1):t]})]})},[p,m]),Ce=Be(null);s(t,{variant:"geo-points",frameRef:Ce});let[Re,Ae]=Ee(null),Ne=Ge(()=>{let e=Ce.current?.getCartogramLayout?.();e&&Ae(t=>t&&t.cx===e.cx&&t.cy===e.cy&&t.maxCost===e.maxCost&&t.availableRadius===e.availableRadius&&t.layout===(e.layout??"radial")?t:{cx:e.cx,cy:e.cy,maxCost:e.maxCost,availableRadius:e.availableRadius,layout:e.layout??"radial"})},[]);$e(()=>{let e=requestAnimationFrame(Ne);return()=>cancelAnimationFrame(e)},[Ne,f,h,i.width,i.height,ve,he]);let je=Te(()=>{if(!ge||!Re)return[];let{maxCost:e}=Re;if(e<=0)return[];if(Array.isArray(ge))return ge.filter(t=>t>0&&t<=e);let t="strip"===Re.layout?3:5,i="number"==typeof ge?ge:Math.min(t,Math.max(2,Math.ceil(e/5))),o=e/i,r=[];for(let e=1;e<=i;e++)r.push(Math.round(o*e*10)/10);return r},[ge,Re]),Fe=Te(()=>{if(!Re)return se.foregroundGraphics||null;let e=/* @__PURE__ */Ve(_e,{bottomMargin:xe.margin.bottom,costLabel:q,layout:Re,ringStyle:Z,ringValues:je,showNorth:ye,showRingLabels:fe,showRings:ge}),t=se.foregroundGraphics;return"function"==typeof t?i=>/* @__PURE__ */Je(qe,{children:[e,t(i)]}):/* @__PURE__ */Je(qe,{children:[e,t]})},[Re,je,ge,fe,ye,q,Z,xe.margin.bottom,se.foregroundGraphics]);if(xe.earlyReturn)return xe.earlyReturn;H("DistanceCartogram",ve,"xAccessor",a),H("DistanceCartogram",ve,"yAccessor",d);let Pe={projection:v,...null!=o&&{points:ve},...we&&{lines:we,lineDataAccessor:"coordinates"},xAccessor:a,yAccessor:d,pointIdAccessor:m,pointStyle:ke,projectionTransform:Se,...I&&{transition:{duration:I}},...null!=x&&{graticule:x},...null!=k&&{fitPadding:k},...be&&{zoomable:!0},...w&&{zoomExtent:w},...R&&{onZoom:R},...null!=A&&{dragRotate:A},...j&&{tileURL:j},...F&&{tileAttribution:F},...L&&{tileCacheSize:L},size:[i.width,i.height],maxDevicePixelRatio:e.maxDevicePixelRatio,margin:xe.margin,enableHover:i.enableHover,tooltipContent:!1===E?()=>null:C(E)||Me,...xe.legendBehaviorProps,...c({linkedHover:ee,selection:Q,onObservation:te,onClick:ie,mobileInteraction:xe.mobileInteraction,customHoverBehavior:xe.customHoverBehavior,customClickBehavior:xe.customClickBehavior,linkedHoverInClickPredicate:!1}),...J&&J.length>0&&{annotations:J},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...i.title&&{title:i.title},...i.description&&{description:i.description},...i.summary&&{summary:i.summary},...void 0!==i.accessibleTable&&{accessibleTable:i.accessibleTable},...Y&&{className:Y},...null!=e.animate&&{animate:e.animate},...se,foregroundGraphics:Fe};/* */
|
|
30
|
+
return Ve(N,{componentName:"DistanceCartogram",width:i.width,height:i.height,children:/* @__PURE__ */Ve(r,{ref:Ce,...Pe})})}),"DistanceCartogram");import{jsx as Ye}from"react/jsx-runtime";function Qe(e){if(Number.isFinite(e))return Math.max(1,Math.round(e))}function et(e){let t=1/0,i=-1/0;for(let o of e)Number.isFinite(o)&&(o<t&&(t=o),o>i&&(i=o));return t===1/0?[0,0]:[t,i]}function tt(e,t){let i=t[1]-t[0];return 0===i?.5:(e-t[0])/i}function it(e,t={}){let i=e.map((e,t)=>({...e,index:t})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));if(0===i.length)return[];let o=w(Number.isFinite(t.occupancy)?Number(t.occupancy):.72,.2,1),r=Number.isFinite(t.aspectRatio)&&Number(t.aspectRatio)>0?Number(t.aspectRatio):1.8,n=Qe(t.columns)??Math.max(1,Math.ceil(Math.sqrt(i.length*r/o))),a=Qe(t.rows)??Math.max(1,Math.ceil(i.length/(n*o)));n*a<i.length&&(null!=t.columns&&null==t.rows?a=Math.ceil(i.length/n):null!=t.rows&&null==t.columns?n=Math.ceil(i.length/a):a=Math.ceil(i.length/n));let l=et(i.map(e=>e.x)),s=et(i.map(e=>e.y)),c=i.map(e=>({...e,desiredColumn:tt(e.x,l)*Math.max(0,n-1),desiredRow:tt(e.y,s)*Math.max(0,a-1)})),u=(n-1)/2,d=(a-1)/2;c.sort((e,t)=>{let i=(e.desiredColumn-u)**2+(e.desiredRow-d)**2;return(t.desiredColumn-u)**2+(t.desiredRow-d)**2-i||e.desiredRow-t.desiredRow||e.desiredColumn-t.desiredColumn||e.index-t.index});let m=/* @__PURE__ */new Set;for(let e=0;e<a;e+=1)for(let t=0;t<n;t+=1)m.add(e*n+t);let h=[];for(let e of c){let t=-1,i=1/0;for(let o of m){let r=Math.floor(o/n),a=(o%n-e.desiredColumn)**2+(r-e.desiredRow)**2;(a<i||a===i&&o<t)&&(t=o,i=a)}t<0||(m.delete(t),h.push({datum:e.datum,x:e.x,y:e.y,row:Math.floor(t/n),column:t%n,index:e.index}))}return h.sort((e,t)=>e.index-t.index),h.map(({index:e,...t})=>t)}function ot(e,t,i=[]){if("function"==typeof t)return t(e);if("string"==typeof t)return e[t];for(let t of i)if(null!=e[t])return e[t]}function rt(e,t){let i=e.properties&&"object"==typeof e.properties?e.properties:{},o=e.id??i.id??i.name??`area-${t}`;return{...i,id:String(o)}}function nt(e){return`${e.map(([e,t],i)=>`${0===i?"M":"L"}${e},${t}`).join("")}Z`}function at(e,t,i){return nt([[e-i,t-i],[e+i,t-i],[e+i,t+i],[e-i,t+i]])}function lt(e,t,i){let o=[];for(let r=0;r<6;r+=1){let n=-Math.PI/2+r*(Math.PI/3);o.push([e+Math.cos(n)*i,t+Math.sin(n)*i])}return nt(o)}function st(e){return e.areas.map((t,i)=>{let o=rt(t,i),r=e.scales.geoPath.centroid(t),n=Number.isFinite(r[0])&&Number.isFinite(r[1])?e.scales.invertedPoint(r[0],r[1]):null;return{datum:{...o,gridLongitude:n?.[0],gridLatitude:n?.[1]},x:r[0],y:r[1]}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}function ct(e){return e.points.map(t=>{let i=Number(ot(t,e.config.longitudeAccessor,["lon","longitude"])),o=Number(ot(t,e.config.latitudeAccessor,["lat","latitude"])),r=Number.isFinite(i)&&Number.isFinite(o)?e.scales.projectedPoint(i,o):null;return{datum:t,x:r?.[0]??NaN,y:r?.[1]??NaN}}).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))}function ut(e,t){if(!t.rowAccessor||!t.columnAccessor)return null;let i=e.map(e=>({datum:e,x:Number(ot(e,t.columnAccessor)),y:Number(ot(e,t.rowAccessor))})).filter(e=>Number.isFinite(e.x)&&Number.isFinite(e.y));return i.length!==e.length?null:i.map(e=>({...e,row:e.y,column:e.x}))}var dt=e=>{let t=e.config,i=t.source??"auto",o="areas"===i||"auto"===i&&e.areas.length>0,r=(o?st(e):e.points.map((e,t)=>({datum:e,x:t,y:t}))).filter((e,i)=>!t.filter||t.filter(e.datum,i)),n=ut(r.map(e=>e.datum),t),a=o?r:ct({...e,points:r.map(e=>e.datum)}),l=n??it(a,{columns:t.columns,rows:t.rows,occupancy:t.occupancy,aspectRatio:e.dimensions.width/Math.max(1,e.dimensions.height)});if(0===l.length)return{nodes:[]};let s=et(l.map(e=>e.row)),c=et(l.map(e=>e.column)),u=Math.max(1,Math.round(s[1]-s[0])+1),d=Math.max(1,Math.round(c[1]-c[0])+1),m=Math.max(0,t.layoutPadding??8),h=Math.max(1,e.dimensions.width-2*m),p=Math.max(1,e.dimensions.height-2*m),g=h/d,f=p/u,y=g*d,b=f*u,v=(e.dimensions.width-y)/2,x=(e.dimensions.height-b)/2,k=w(t.cellPadding??.12,0,.8),S=Math.max(1,.5*Math.min(g,f)*(1-k)),M=t.sizeAccessor?l.map(e=>Number(ot(e.datum,t.sizeAccessor))):[],C=t.sizeDomain??et(M),R=t.sizeRange??[.36,1],A=w(Math.min(R[0],R[1]),.05,1),N=w(Math.max(R[0],R[1]),A,1),j=l.map((i,o)=>{let r={...i.datum,gridRow:i.row,gridColumn:i.column},n=String(ot(r,t.idAccessor,["id","key","name"])??`grid-${o}`),a=String(ot(r,t.labelAccessor,["abbr","code","label","name","id"])??n),l=Math.max(1,t.maxLabelLength??4),u=a.length>l?a.slice(0,l):a,d=ot(r,t.categoryAccessor),m=null==d?void 0:String(d),h=ot(r,t.fillAccessor),p=null!=h?String(h):m?e.resolveColor(m):e.theme.categorical[0]??"#4f86c6",y=t.sizeAccessor?Number(ot(r,t.sizeAccessor)):NaN,b=t.sizeAccessor&&Number.isFinite(y)?Math.sqrt(w(tt(y,C),0,1)):1,k=S*(A+b*(N-A)),M="function"==typeof t.markStyle?t.markStyle(r,o):t.markStyle;return{datum:r,id:n,label:u,category:m,row:i.row,column:i.column,x:v+(i.column-c[0]+.5)*g,y:x+(i.row-s[0]+.5)*f,radius:k,style:{fill:p,fillOpacity:.94,stroke:"rgba(255,255,255,0.9)",strokeWidth:1,...M}}}),F=t.shape??"circle";return{nodes:j.map(e=>"circle"===F?{type:"point",x:e.x,y:e.y,r:e.radius,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},pointId:e.id,_transitionKey:e.id}:{type:"geoarea",pathData:"hexagon"===F?lt(e.x,e.y,e.radius):at(e.x,e.y,e.radius),centroid:[e.x,e.y],bounds:[[e.x-e.radius,e.y-e.radius],[e.x+e.radius,e.y+e.radius]],screenArea:"hexagon"===F?3*Math.sqrt(3)*e.radius*e.radius/2:(2*e.radius)**2,style:e.style,datum:e.datum,accessibleDatum:e.datum,accessibility:{label:e.label,tableFields:{name:e.datum.name??e.label,label:e.label,row:e.row,column:e.column,...e.category?{category:e.category}:{}}},group:e.category,interactive:!0}),overlays:!1===t.showLabels?null:/* @__PURE__ */Ye(mt,{marks:j,color:t.labelColor??"#ffffff",fontSize:t.labelFontSize??w(.23*Math.min(g,f),7,14),fontFamily:t.labelFontFamily,fontWeight:t.labelFontWeight??700}),restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.18}:{opacity:1}}};function mt({marks:e,color:t,fontSize:i,fontFamily:o,fontWeight:r}){let n=d();/* */
|
|
31
|
+
return Ye("g",{"aria-hidden":"true",pointerEvents:"none",children:e.map(e=>{let a=!n.isActive||n.predicate(e.datum);/* */
|
|
32
|
+
return Ye("text",{x:e.x,y:e.y,fill:t,fontFamily:o,fontSize:i,fontWeight:r,opacity:a?1:.18,textAnchor:"middle",dominantBaseline:"central",children:e.label},e.id)})})}import{geoBounds as ht,geoContains as pt}from"d3-geo";import{jsx as gt}from"react/jsx-runtime";var ft=/* @__PURE__ */new WeakMap,yt=/* @__PURE__ */new WeakMap,bt=/* @__PURE__ */new WeakMap,vt=1;function xt(e){if(Number.isFinite(e)&&!(Number(e)<=0))return Number(e)}function kt(e,t){return"function"==typeof t?t(e,e.dotIndex):"string"==typeof t?e[t]:void 0}function St(e){return e.properties&&"object"==typeof e.properties?{...e.properties}:{}}function wt(e,t){let i=St(e);return String(e.id??i.id??i.name??`feature-${t}`)}function Mt(e,t){if(0===e.length)return null;let i={type:"FeatureCollection",features:e},o=t.bounds(i);return Number.isFinite(o[0][0])&&Number.isFinite(o[0][1])&&Number.isFinite(o[1][0])&&Number.isFinite(o[1][1])?o:null}function Ct(e,t,i,o){return[Math.ceil((e-i)/o-.5),Math.floor((t-i)/o-.5)]}function Rt(e){if(!e)return 0;let t=bt.get(e);if(t)return t;let i=vt;return vt+=1,bt.set(e,i),i}function At(e){return e.map((e,t)=>{if(yt.has(e))return{feature:e,index:t,bounds:yt.get(e)??null};try{let i=ht(e);return yt.set(e,i),{feature:e,index:t,bounds:i}}catch{return yt.set(e,null),{feature:e,index:t,bounds:null}}})}function Nt(e,t,i){return t<=i?e>=t&&e<=i:e>=t||e<=i}function jt(e,t){return!t||e[1]>=t[0][1]&&e[1]<=t[1][1]&&Nt(e[0],t[0][0],t[1][0])}function Ft(e,t){for(let i of e){let{feature:e,index:o}=i;if(e.geometry&&jt(t,i.bounds))try{if(pt(e,t))return{feature:e,index:o}}catch{}}return null}function Pt(e,t,i,o={}){let r=e.filter((e,t)=>e.geometry&&(!o.featureFilter||o.featureFilter(e,t))),n=Mt(r,t.geoPath);if(!n)return{dots:[],cellSize:10,features:r};let a=Math.max(0,o.layoutPadding??0),l=[[w(n[0][0],a,Math.max(a,i.width-a)),w(n[0][1],a,Math.max(a,i.height-a))],[w(n[1][0],a,Math.max(a,i.width-a)),w(n[1][1],a,Math.max(a,i.height-a))]],s=Math.max(0,l[1][0]-l[0][0]),c=Math.max(0,l[1][1]-l[0][1]);if(0===s||0===c)return{dots:[],cellSize:10,features:r};let u=xt(o.columns),d=Math.max(2,u?s/u:xt(o.cellSize)??10),m=Math.max(100,Math.round(xt(o.maxSamples)??25e3)),h=Math.ceil(s/d)*Math.ceil(c/d);h>m&&(d*=Math.sqrt(h/m));let p=o.gridOrigin?.[0]??0,g=o.gridOrigin?.[1]??0,[f,y]=Ct(l[0][0],l[1][0],p,d),[b,v]=Ct(l[0][1],l[1][1],g,d),x=[],k=At(r);for(let e=b;e<=v;e+=1){let i=g+(e+.5)*d;for(let r=f;r<=y;r+=1){let n=p+(r+.5)*d,a=t.invertedPoint(n,i);if(!a||!Number.isFinite(a[0])||!Number.isFinite(a[1]))continue;let l=Ft(k,a);if(!l)continue;let s={...St(l.feature),featureId:wt(l.feature,l.index),featureIndex:l.index,gridRow:e,gridColumn:r,longitude:a[0],latitude:a[1],dotIndex:x.length};o.dotFilter&&!o.dotFilter(s,x.length)||x.push(s)}}return{dots:x,cellSize:d,features:r}}function Ht(e){return Math.round(1e4*e)/1e4}function Lt(e){return Array.isArray(e)&&e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1])?`${Ht(Number(e[0]))},${Ht(Number(e[1]))}`:"null"}function It(e,t){let i=e[t];return"function"==typeof i?i.call(e):void 0}function zt(e){return"number"==typeof e&&Number.isFinite(e)?String(Ht(e)):null===e?"null":"unavailable"}function Wt(e){return Array.isArray(e)&&e.every(Number.isFinite)?e.map(e=>Ht(Number(e))).join(","):"unavailable"}function Dt(e){let t=e.scales.projection;return[zt(It(t,"scale")),Lt(It(t,"translate")),Lt(It(t,"center")),Wt(It(t,"rotate")),zt(It(t,"clipAngle")),zt(It(t,"precision")),...[[0,0],[-120,35],[45,45],[120,-30]].map(([t,i])=>Lt(e.scales.projectedPoint(t,i)))].join("|")}function Ot(e){let t=e.config;return[e.areas.length,e.dimensions.width,e.dimensions.height,t.cellSize??"",t.columns??"",t.layoutPadding??"",t.gridOrigin?.join(",")??"",t.maxSamples??"",Rt(t.featureFilter),Rt(t.dotFilter),Dt(e)].join("::")}function Tt(e){let t=ft.get(e.areas);t||(t=/* @__PURE__ */new Map,ft.set(e.areas,t));let i=Ot(e),o=t.get(i);if(o)return o;let r=Pt(e.areas,e.scales,e.dimensions,e.config);if(t.size>=12){let e=t.keys().next().value;void 0!==e&&t.delete(e)}return t.set(i,r),r}function Bt(e){return`${e.map(([e,t],i)=>`${0===i?"M":"L"}${e},${t}`).join("")}Z`}function Et(e,t,i){return Bt([[e-i,t-i],[e+i,t-i],[e+i,t+i],[e-i,t+i]])}function $t(e,t,i){return Bt(Array.from({length:6},(o,r)=>{let n=-Math.PI/2+r*(Math.PI/3);return[e+Math.cos(n)*i,t+Math.sin(n)*i]}))}var Gt=e=>{let t=Tt(e),i=e.config,o=i.shape??"circle",r=Math.max(.5,xt(i.dotRadius)??t.cellSize*w(i.radiusRatio??.24,.05,.5)),n=i.gridOrigin?.[0]??0,a=i.gridOrigin?.[1]??0;return{nodes:t.dots.map((l,s)=>{let c=n+(l.gridColumn+.5)*t.cellSize,u=a+(l.gridRow+.5)*t.cellSize,d=kt(l,i.categoryAccessor),m=kt(l,i.fillAccessor),h={fill:null!=m?String(m):null!=d?e.resolveColor(String(d)):e.theme.categorical[0]??"#4f86c6",fillOpacity:.92,strokeWidth:0,..."function"==typeof i.markStyle?i.markStyle(l,s):i.markStyle},p=`dot-${l.gridRow}-${l.gridColumn}`;return"circle"===o?{type:"point",x:c,y:u,r:r,style:h,datum:l,interactive:!1,pointId:p,_transitionKey:p}:{type:"geoarea",pathData:"hexagon"===o?$t(c,u,r):Et(c,u,r),centroid:[c,u],bounds:[[c-r,u-r],[c+r,u+r]],screenArea:"hexagon"===o?3*Math.sqrt(3)*r*r/2:(2*r)**2,style:h,datum:l,group:l.featureId,interactive:!1}}),overlays:i.showOutline?/* @__PURE__ */gt("g",{"aria-hidden":"true",pointerEvents:"none",children:t.features.map((t,o)=>{let r=e.scales.geoPath(t);return r?/* @__PURE__ */gt("path",{d:r,fill:"none",stroke:i.outlineStyle?.stroke??"currentColor",strokeOpacity:i.outlineStyle?.opacity??i.outlineStyle?.fillOpacity??.22,strokeWidth:i.outlineStyle?.strokeWidth??.7,strokeDasharray:i.outlineStyle?.strokeDasharray,strokeLinecap:i.outlineStyle?.strokeLinecap,vectorEffect:"non-scaling-stroke"},wt(t,o)):null})}):null,restyle:(e,t)=>t?.isActive&&e.datum?{opacity:t.predicate(e.datum)?1:.14}:{opacity:1}}};function Ut(e,t,i){let{featureKey:o,dataKey:r}=i,n=/* @__PURE__ */new Map;for(let e of t){let t=String(Object.prototype.hasOwnProperty.call(e,r)?e[r]:void 0);n.set(t,e)}let a=e=>{let t=o.split("."),i=e;for(let e of t)i=null!==i&&"object"==typeof i&&Object.prototype.hasOwnProperty.call(i,e)?i[e]:void 0;return String(i??"")};return e.map(e=>{let t=a(e),i=n.get(t);return i?{...e,properties:{...e.properties,...i}}:e})}export{be as ChoroplethMap,e as DEFAULT_HIT_RADIUS,Xe as DistanceCartogram,Oe as FlowMap,n as GeoCustomChart,x as MultiLineTooltip,Ae as ProportionalSymbolMap,r as StreamGeoFrame,b as Tooltip,Q as TooltipRoot,M as composeStyleRules,o as geoAreaHitTarget,i as geoHitTarget,Gt as geographicDotGridLayout,dt as geographicGridLayout,J as glyphExtent,V as glyphPlacement,it as gridifyGeographicPoints,te as hasOwnTooltipChrome,Y as hasTooltipContent,Z as hatchFillId,_ as hatchPatternDef,t as hitTargetPoint,K as isHatchFill,y as makeNodeRuleContext,f as makeRuleValueResolver,ee as markTooltipChrome,v as matchesThreshold,Ut as mergeData,me as resolveReferenceGeography,z as resolveResponsiveRules,S as resolveStyleRules,q as resolveSvgFill,I as responsiveRuleMatches,k as ruleMatches,Pt as sampleGeographicDotGrid};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as s}from"./c-UOAXCGLZ.min.js";import{a
|
|
2
|
+
import{a as s}from"./c-UOAXCGLZ.min.js";import{a}from"./c-OC7GNXGZ.min.js";import{a as e,f as i,g as o}from"./c-E3MKTERA.min.js";import{a as r,b as m,c as t,d as c,e as n,f as p,g as j,h as l,i as k,j as P,k as S,l as u,m as T,n as C,o as N,p as R}from"./c-TRMNDRC4.min.js";import{a as D,d as h,m as d}from"./c-M4T43G76.min.js";import{a as v,b as y}from"./c-ZO36H5VH.min.js";import{f as O}from"./c-YEB6Z35F.min.js";import{b as f}from"./c-IU4QZ7Y5.min.js";import{Ib as E,Kb as I,La as g,Lb as w,Ma as A,Mb as M,Nb as b,Ob as F,gb as K,kb as L,lb as G}from"./c-XCV7VUU3.min.js";import{i as H,j as U,k as Z,l as V}from"./c-SSKV5JPW.min.js";import{d as B,e as X}from"./c-RBWJFQDC.min.js";import{k as W,o as J,p as Q,q as Y}from"./c-5FUOKMH6.min.js";import{NetworkPerspectiveBillboard as x,NetworkPerspectiveGround as _}from"./semiotic-network-placement.module.min.js";export{m as ChordDiagram,C as CirclePack,e as DEFAULT_HIT_RADIUS,r as ForceDirectedGraph,A as MultiLineTooltip,R as NetworkCustomChart,x as NetworkPerspectiveBillboard,_ as NetworkPerspectiveGround,N as OrbitDiagram,S as ProcessSankey,t as SankeyDiagram,y as StreamNetworkFrame,g as Tooltip,J as TooltipRoot,u as TreeDiagram,T as Treemap,F as composeStyleRules,h as createNetworkPerspectiveFrame,p as diagnoseProcessSankeyLayout,l as diagnoseProcessSankeyProps,j as explainProcessSankeyLayout,n as formatProcessSankeyIssue,X as glyphExtent,B as glyphPlacement,Y as hasOwnTooltipChrome,W as hasTooltipContent,U as hatchFillId,Z as hatchPatternDef,k as inventoryAtTime,H as isHatchFill,I as makeNodeRuleContext,E as makeRuleValueResolver,Q as markTooltipChrome,w as matchesThreshold,o as networkEdgeHitTarget,i as networkHitTarget,O as preloadNetworkPerspectiveExtras,d as projectNetworkScene,s as registerBuiltInNetworkLayouts,D as resolveNetworkPerspective,G as resolveResponsiveRules,b as resolveStyleRules,V as resolveSvgFill,L as responsiveRuleMatches,M as ruleMatches,P as toProcessSankeyTime,f as useCustomLayoutSelection,a as useForceLayout,v as useNetworkPerspective,K as useSelectionActions,c as validateProcessSankey};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a,b as
|
|
2
|
+
import{a as s,b as a,e as t}from"./c-E3MKTERA.min.js";import{a as i,b as m,c as o,d as r,e,f as n,g as l,h as p,i as c,j,k as h,l as C,m as P,n as R,o as S,p as u,q as D,r as T}from"./c-IE5EBBP6.min.js";import{b as U}from"./c-IU4QZ7Y5.min.js";import{B as b,C as B,Ib as F,Jb as I,Kb as L,La as O,Lb as K,Ma as d,Mb as V,Nb as k,Ob as E,Pb as H,kb as M,lb as Z}from"./c-XCV7VUU3.min.js";import{h as f,i as g,j as N,k as X,l as A}from"./c-SSKV5JPW.min.js";import{d as G,e as v}from"./c-RBWJFQDC.min.js";import{k as y,o as J,p as W,q as Q}from"./c-5FUOKMH6.min.js";export{B as AnnotationLabel,m as BarChart,n as BoxPlot,s as DEFAULT_HIT_RADIUS,C as DonutChart,j as DotPlot,S as FunnelChart,P as GaugeChart,R as GroupedBarChart,l as Histogram,r as LikertChart,d as MultiLineTooltip,T as OrdinalCustomChart,h as PieChart,u as RadarChart,c as RidgelinePlot,o as StackedBarChart,i as StreamOrdinalFrame,e as SwarmPlot,D as SwimlaneChart,O as Tooltip,J as TooltipRoot,p as ViolinPlot,E as composeStyleRules,f as createHatchPattern,b as estimateLabelWidth,v as glyphExtent,G as glyphPlacement,Q as hasOwnTooltipChrome,y as hasTooltipContent,N as hatchFillId,X as hatchPatternDef,a as hitTargetPoint,t as hitTargetRect,g as isHatchFill,L as makeNodeRuleContext,F as makeRuleValueResolver,H as makeStyleRuleStyleFn,I as makeXYRuleContext,W as markTooltipChrome,K as matchesThreshold,Z as resolveResponsiveRules,k as resolveStyleRules,A as resolveSvgFill,M as responsiveRuleMatches,V as ruleMatches,U as useCustomLayoutSelection};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
function e(e){let{data:t,encoding:a,defaults:i={},scales:s}=e,n=aa({data:t,encoding:a}),r=[],o=/* @__PURE__ */new Map,l=[],u=[],c=/* @__PURE__ */new Map;return n.rows.forEach((e,t)=>{let{id:n,datum:d}=e,p=Math.max(0,ta(a.appearance?.size,d,t)??i.size??6),h=ta(a.appearance?.shape,d,t)??i.shape??{type:"circle",radius:p},m=e.placement.x??i.x??0,y=e.placement.y??i.y??0,f=s?.x?s.x(m):m,g=s?.y?s.y(y):y,b=ta(a.appearance?.color,d,t)??i.color,v=ta(a.appearance?.opacity,d,t)??i.opacity,w=ta(a.appearance?.stroke,d,t)??i.stroke,x=ta(a.appearance?.strokeWidth,d,t)??i.strokeWidth,S=ta(a.time?.spawnAt,d,t)??e.time.arrival,I=e.kinematics.velocityX,A=e.kinematics.velocityY,P=ta(a.dynamics?.mass,d,t)??i.mass??1,C=ta(a.dynamics?.friction,d,t),M=ta(a.dynamics?.restitution,d,t),R=ta(a.dynamics?.bodyCollisions,d,t),E={id:n,x:f,y:g,mass:P,shape:{...h},datum:d,...null!=S&&{spawnAt:S},...null!=I&&{vx:I},...null!=A&&{vy:A},...null!=C&&{friction:C},...null!=M&&{restitution:M},...null!=R&&{bodyCollisions:R}},B={...null!=b&&{fill:b},...null!=v&&{opacity:v},...null!=w&&{stroke:w},...null!=x&&{strokeWidth:x}},F={id:n,datum:d,appearance:{color:b,opacity:v,shape:h,size:p,stroke:w,strokeWidth:x},placement:{x:f,y:g,lane:e.placement.lane,space:a.placement?.space??"world"},time:{arrival:S,spawnAt:S,basis:a.time?.basis??"simulation",unit:a.time?.unit},kinematics:{velocityX:I,velocityY:A,space:a.kinematics?.space??"world"},dynamics:{bodyCollisions:R,friction:C,mass:P,restitution:M},process:e.process,evidence:e.evidence,accessible:e.accessible,spawn:E};r.push(F),o.set(n,F),l.push(E),c.set(n,B),u.push({id:n,bodyId:n,label:e.accessible.label,description:e.accessible.description,datum:d,x:f,y:g,group:e.accessible.group})}),{rows:r,byId:o,spawns:l,semanticItems:u,bodyStyle:e=>c.get(e.id)??{}}}function t(t){return a=>{let i=e({data:a.data,encoding:t.encoding,defaults:t.defaults,scales:a.scales}),s=t.extend?.(a,i)??{};return{...s,initialSpawns:i.spawns,bodyStyle:i.bodyStyle,semanticItems:[...i.semanticItems,...s.semanticItems??[]]}}}function a(e){return new Map(e.gates.map(e=>[e.id,e]))}function i(e,t){let{layout:i,positiveProperties:s,negativeProperties:n,viability:r,outcome:o}=t,l=a(i),u=[...("function"==typeof t.events?t.events(e,i):t.events)??[]].sort((e,t)=>e.time-t.time),c=e;for(let e of u){let t=e.gateId?l.get(e.gateId):void 0,a=e.effects??[],u={...ze(e,a),appliedAt:e.time},d=He(c,u);if(d!==c){c=d;for(let i of a){let a={event:e,gate:t,negativeProperties:n,positiveProperties:s,project:c};i.when&&!i.when(a)||(c=Ve(c,i,a))}c={...c,viability:r?.(c,{negativeProperties:n,positiveProperties:s})??qe(c,s,n)},e.final&&(c={...c,outcome:e.outcome??o?.(c,{layout:i,negativeProperties:n,positiveProperties:s})??(c.viability>20?"built":"approved_not_built")})}}return c}function s(e){return e.projects.map(t=>i(t,e))}function n(e){let t=e.resources.map(e=>({...e,bodyId:e.bodyId??e.id})),a=new Map(t.map(e=>[e.bodyId,e])),i=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map,n=e.assignmentForce??.45,r=e.returnForce??.35,o=e.caseAttraction??.08,l=e.assignmentOffset??{x:0,y:0},u=/* @__PURE__ */new Map,c=0,d=0;return{id:e.id??"service-resource-pool",continuous:!0,assign:e=>{let a=i.get(e);if(a)return a;let n=t.find(e=>!s.has(e.id));if(!n)return null;let r={resourceId:n.id,resourceBodyId:n.bodyId,caseBodyId:e,assignedAt:c};return i.set(e,r),s.set(n.id,r),d+=1,r},release:e=>{let t=i.get(e);return!!t&&(i.delete(e),s.delete(t.resourceId),d+=1,!0)},getAssignment:e=>i.get(e),tick:e=>{c=Math.max(c,e.elapsed),u=new Map(e.controls.readBodies().map(e=>[e.id,e]));for(let[e,t]of i)u.has(e)&&u.has(t.resourceBodyId)||(i.delete(e),s.delete(t.resourceId),d+=1)},getSnapshot:()=>({total:t.length,available:t.length-s.size,assigned:s.size,assignments:Array.from(i.values()),simulatedAt:c,metricRevision:d}),bodyForce:e=>{let t=a.get(e.body.id);if(t){let a=s.get(t.id),i=a?u.get(a.caseBodyId):void 0,o=i?i.x+(l.x??0):t.home.x,c=i?i.y+(l.y??0):t.home.y,d=a?n:r;return{x:(o-e.body.x)*d,y:(c-e.body.y)*d}}let c=i.get(e.body.id);if(!c||o<=0)return null;let d=u.get(c.resourceBodyId);return d?{x:(d.x-e.body.x)*o,y:(d.y-e.body.y)*o}:null}}}function r(e,t){let a="function"==typeof t.deadlineAccessor?t.deadlineAccessor(e):Ze(e.datum,t.deadlineAccessor)??Ze(e,t.deadlineAccessor);return Number.isFinite(Number(a))?Math.max(0,Number(a)):0}function o(e){function t(t){i.set(t.bodyId,t),n+=1,e.onStateChange?.({...t})}function a(e){let a=i.get(e);return!(!a||null!=a.completedAt||(t({...a,completedAt:s,state:"unhappy"===a.state?"resolved-unhappy":"resolved"}),0))}let i=/* @__PURE__ */new Map,s=0,n=0;return{id:e.id??"service-level",continuous:!0,protect:e=>{let a=i.get(e);return!(!a||null!=a.completedAt||"unhappy"===a.state||(t({...a,state:"protected",protectedAt:s}),0))},complete:a,getCase:e=>i.get(e),tick:n=>{s=Math.max(s,n.elapsed);for(let o of n.controls.readBodies()){if(!tt(o,e.bodyFilter))continue;if(!i.has(o.id)){let a=r(o,e);t({bodyId:o.id,openedAt:s,deadlineAt:s+a,state:"waiting"})}let l=i.get(o.id);l&&null==l.completedAt&&(e.completionRegionId&&n.getRegionState(o.id)?.activeRegionIds.includes(e.completionRegionId)?a(o.id):"waiting"===l.state&&s>=l.deadlineAt&&t({...l,state:"unhappy"}))}},getSnapshot:()=>{let e=Array.from(i.values()),t=t=>e.filter(e=>e.state===t).length;return{total:e.length,waiting:t("waiting"),protected:t("protected"),unhappy:t("unhappy"),resolved:t("resolved"),resolvedUnhappy:t("resolved-unhappy"),simulatedAt:s,metricRevision:n}}}}function l(e){function t(t){return e.isOpen?e.isOpen(t):null!=e.opensAt&&t>=e.opensAt}let a=/* @__PURE__ */new Set,i=0,s=0,n=0,r=!1;return{id:e.id??`dependency-gate:${e.regionId}`,continuous:!0,tick:o=>{i=Math.max(i,o.elapsed);let l=r;r=t(i);let u=o.controls.readBodies(),c=new Map(u.map(e=>[e.id,e]));for(let t of u)!o.getRegionState(t.id)?.activeRegionIds.includes(e.regionId)||!tt(t,e.bodyFilter)||!r&&!a.has(t.id)&&(a.add(t.id),n+=1,e.onHeld?.(t));if(r&&!l){for(let t of a){let a=c.get(t);a&&(o.controls.applyImpulse(t,e.releaseImpulse?.x??86,e.releaseImpulse?.y??0),s+=1,e.onReleased?.(a))}a.clear(),n+=1}for(let e of a)c.has(e)||(a.delete(e),n+=1)},getSnapshot:()=>({regionId:e.regionId,isOpen:r,blocked:a.size,released:s,simulatedAt:i,metricRevision:n}),bodyForce:t=>{if(r||!a.has(t.body.id))return null;let i=t.regions?.find(t=>t.id===e.regionId)?.shape;if(!i||"aabb"!==i.type)return{x:.8*-t.body.vx,y:.8*-t.body.vy};let s=e.holdForce??.4;return{x:(i.x-t.body.x)*s-.45*t.body.vx,y:(i.y-t.body.y)*s-.45*t.body.vy}}}}function u(e,t,a={}){let i=a.random??Math.random,s=e.stages.find(e=>e.id===t)??e.stages[e.stages.length-1],n=zt(a.along??.5,.05,.95),r=a.jitterX??0,o=a.padY??20,l=s.x0+(s.x1-s.x0)*n+(2*i()-1)*r,u=Math.min(1,s.width/2),c=zt(l,s.x0+u,s.x1-u),d=e.boundaryY(c,"top")+o,p=e.boundaryY(c,"bottom")-o;return{x:c,y:p<=d?e.midY:d+i()*Math.max(1,p-d)}}function c(e){return"bowtie"===e.shape?[{id:"incoming",role:"incoming",points:[[e.left,e.topY],[e.centerLeft,e.pinchTop],[e.centerLeft,e.pinchBottom],[e.left,e.bottomY]]},{id:"center",role:"center",points:[[e.centerLeft,e.pinchTop],[e.centerRight,e.pinchTop],[e.centerRight,e.pinchBottom],[e.centerLeft,e.pinchBottom]]},{id:"outgoing",role:"outgoing",points:[[e.centerRight,e.pinchTop],[e.right,e.topY],[e.right,e.bottomY],[e.centerRight,e.pinchBottom]]}]:[{id:"volume",role:"volume",points:[[e.left,e.topY],[e.right,"funnel"===e.shape?e.pinchTop:e.topY],[e.right,"funnel"===e.shape?e.pinchBottom:e.bottomY],[e.left,e.bottomY]]}]}function d(e){let t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:null}function p(e,t){let a=e;for(let e of t.split(".")){if(null==a||"object"!=typeof a||!Object.prototype.hasOwnProperty.call(a,e))return;a=a[e]}return a}function h(e,t,a,i,s){return"function"==typeof i?i(e,t,a):p(e,i??s)}function m(e){let t=Number(e.toFixed(12));return Object.is(t,-0)?0:t}function y(e){let t=(e??pa).map(e=>{let t=d(e);if(null==t||t<0||t>1)throw new RangeError(`physicsReferenceEnvelope quantiles must be finite values from 0 to 1; received ${String(e)}`);return m(t)});return Array.from(new Set(t)).sort((e,t)=>e-t)}function f(e){if(Array.isArray(e)){if(e.length>ha)throw new RangeError(`physicsReferenceEnvelope sampleAt exceeds ${ha} points`);return Array.from(new Set(e.map(d).filter(e=>null!=e).map(m))).sort((e,t)=>e-t)}let t=e,a=d(t.start),i=d(t.end),s=d(t.step);if(null==a||null==i||null==s||s<=0||i<a)throw new RangeError("physicsReferenceEnvelope sampleAt requires finite start/end values with end >= start and step > 0");let n=Math.floor((i-a)/s)+1;if(n>ha)throw new RangeError(`physicsReferenceEnvelope sampleAt exceeds ${ha} points`);let r=[],o=1e-10*Math.max(1,Math.abs(i),Math.abs(a));for(let e=0;e<n;e+=1){let t=a+e*s;if(t>i+o)break;r.push(m(Math.min(t,i)))}if((!r.length||Math.abs(r[r.length-1]-i)>o)&&r.push(m(i)),r.length>ha)throw new RangeError(`physicsReferenceEnvelope sampleAt exceeds ${ha} points`);return Array.from(new Set(r)).sort((e,t)=>e-t)}function g(e,t,a,i){let s=e.flatMap((e,s)=>{let n=d(h(e,s,t,a,"time")),r=d(h(e,s,t,i,"value"));return null==n||null==r?[]:[{time:m(n),value:r,index:s}]});s.sort((e,t)=>e.time-t.time||e.index-t.index);let n=[];for(let e of s){let t=n[n.length-1];t?.time===e.time?t.value=e.value:n.push({time:e.time,value:e.value})}return n}function b(e,t){let a=0,i=e.length;for(;a<i;){let s=a+i>>>1;e[s].time<t?a=s+1:i=s}return a}function v(e,t,a,i){if(!e.length)return null;let s=e[0],n=e[e.length-1];if(t<s.time)return"clamp"===i?s.value:null;if(t>n.time)return"clamp"===i?n.value:null;let r=b(e,t),o=e[r];if(o?.time===t)return o.value;let l=e[Math.max(0,r-1)];if("step"===a||!o||o.time===l.time)return l.value;let u=(t-l.time)/(o.time-l.time);return l.value+(o.value-l.value)*u}function w(e,t){if(1===e.length)return e[0];let a=(e.length-1)*t,i=Math.floor(a),s=Math.ceil(a);if(i===s)return e[i];let n=a-i;return e[i]+(e[s]-e[i])*n}function x(e){let t=e.interpolation??"step",a=e.outsideDomain??"omit",i=y(e.quantiles),s=f(e.sampleAt),n=e.runs.map(t=>g(t.samples,t.id,e.timeAccessor,e.valueAccessor));return{points:s.map(e=>{let s=n.map(i=>v(i,e,t,a)).filter(e=>null!=e).sort((e,t)=>e-t),r={};for(let e of i)r[e]=s.length?w(s,e):null;return{time:e,count:s.length,min:s.length?s[0]:null,max:s.length?s[s.length-1]:null,median:s.length?w(s,.5):null,quantiles:r}}),quantiles:i,interpolation:t,outsideDomain:a,runCount:e.runs.length}}function S(e,t){return e.quantiles.length?"lower"===t?e.quantiles[0]:e.quantiles[e.quantiles.length-1]:"lower"===t?"min":"max"}function I(e,t){if("min"===t||"median"===t||"max"===t)return e[t];let a=d(t);if(null==a||a<0||a>1)throw new RangeError(`comparePhysicsTrace quantile selectors must be from 0 to 1; received ${String(t)}`);let i=m(a);if(!Object.prototype.hasOwnProperty.call(e.quantiles,i))throw new Error(`comparePhysicsTrace could not find quantile ${i} in the reference envelope`);return e.quantiles[i]??null}function A(e,t,a){return e<t?"below":e>a?"above":"inside"}function P(e,t){let a=Math.max(0,t.time-e.time);if(!(a>0)||null==e.value||null==e.lower||null==e.upper||null==t.value||null==t.lower||null==t.upper)return{below:0,inside:0,above:0,observed:0};let i=e.value-e.lower,s=t.value-t.lower,n=e.value-e.upper,r=t.value-t.upper,o=[0,1];for(let[e,t]of[[i,s],[n,r]])(e<0&&t>0||e>0&&t<0)&&o.push(-e/(t-e));o.sort((e,t)=>e-t);let l=0,u=0,c=0;for(let i=0;i<o.length-1;i+=1){let s=o[i],n=o[i+1];if(!(n>s))continue;let r=(s+n)/2,d=(n-s)*a,p=A(e.value+(t.value-e.value)*r,e.lower+(t.lower-e.lower)*r,e.upper+(t.upper-e.upper)*r);"below"===p?l+=d:"above"===p?c+=d:u+=d}return{below:l,inside:u,above:c,observed:a}}function C(e,t,a={}){let i=a.interpolation??t.interpolation,s=a.outsideDomain??t.outsideDomain,n=g(e,a.traceId??"trace",a.timeAccessor,a.valueAccessor),r=a.lower??S(t,"lower"),o=a.upper??S(t,"upper"),l=t.points.map(e=>{let t=v(n,e.time,i,s),a=I(e,r),l=I(e,o);if(null!=a&&null!=l&&a>l)throw new RangeError(`comparePhysicsTrace lower band exceeds upper band at time ${e.time}`);return{time:e.time,value:t,lower:a,upper:l,status:null==t||null==a||null==l?"unobserved":A(t,a,l)}}),u=0,c=0,d=0,p=0,h=null,m=0,y=null;for(let e of l){if("below"===e.status?u+=1:"inside"===e.status?c+=1:"above"===e.status&&(d+=1),null==e.value||null==e.lower||null==e.upper)continue;let t=Math.max(0,e.value-e.upper),a=Math.max(0,e.lower-e.value);t>p&&(p=t,h=e.time),a>m&&(m=a,y=e.time)}let f=0,b=0,w=0,x=0;for(let e=0;e<l.length-1;e+=1){let t=l[e],a=l[e+1],s=Math.max(0,a.time-t.time);if(s>0){if("linear"===i){let e=P(t,a);f+=e.below,b+=e.inside,w+=e.above,x+=e.observed;continue}"unobserved"!==t.status&&(x+=s,"below"===t.status?f+=s:"above"===t.status?w+=s:b+=s)}}let C=l[0]?.time,M=l[l.length-1]?.time,R=null==C||null==M?0:Math.max(0,M-C),E=u+c+d;return{points:l,sampleCount:l.length,observedSamples:E,belowSamples:u,insideSamples:c,aboveSamples:d,totalDuration:R,observedDuration:x,unobservedDuration:Math.max(0,R-x),belowDuration:f,insideDuration:b,aboveDuration:w,peakExcess:p,peakExcessAt:h,peakDeficit:m,peakDeficitAt:y}}function M(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function R(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function E(e){return!!R(e)&&"string"==typeof e.id&&"number"==typeof e.furthestStageIndex&&Number.isFinite(e.furthestStageIndex)&&Array.isArray(e.visitedStageIds)&&e.visitedStageIds.every(e=>"string"==typeof e)&&R(e.visitsByStage)&&R(e.firstEnteredAt)&&R(e.lastEnteredAt)&&"number"==typeof e.regressionCount&&Number.isFinite(e.regressionCount)}function B(e){return{id:e,furthestStageIndex:-1,visitedStageIds:[],visitsByStage:{},firstEnteredAt:{},lastEnteredAt:{},regressionCount:0}}function F(e,t){let a=t.stageId?.(e);if(a)return a;let i=e.region.metadata;if(i&&"object"==typeof i&&Object.prototype.hasOwnProperty.call(i,"stageId")){let e=i.stageId;if("string"==typeof e)return e}return e.region.id}function j(e){let t=Array.from(new Set(e.bodyIds??[]));return{stages:e.stages.map(e=>({...e})),bodyIds:t,entities:Object.fromEntries(t.map(e=>[e,B(e)]))}}function T(e,t,a={}){if("region-enter"!==t.type)return e;let i=F(t,a),s=e.stages.findIndex(e=>e.id===i);if(s<0)return e;let n=a.entityId?.(t)??t.bodyId;if(!n)return e;let r=M(e.entities,n),o=E(r)?r:B(n),l=o.currentStageId?e.stages.findIndex(e=>e.id===o.currentStageId):-1,u=!o.visitedStageIds.includes(i),c=Number(t.observation.timestamp),d=Number.isFinite(c)?c:0,p=M(o.visitsByStage,i),h="number"==typeof p&&Number.isFinite(p)?p:0,m={...o,currentStageId:i,furthestStageId:s>o.furthestStageIndex?i:o.furthestStageId,furthestStageIndex:Math.max(o.furthestStageIndex,s),visitedStageIds:u?[...o.visitedStageIds,i]:o.visitedStageIds,visitsByStage:{...o.visitsByStage,[i]:h+1},firstEnteredAt:u?{...o.firstEnteredAt,[i]:d}:o.firstEnteredAt,lastEnteredAt:{...o.lastEnteredAt,[i]:d},regressionCount:l>=0&&s<l?o.regressionCount+1:o.regressionCount};return{...e,bodyIds:e.bodyIds.includes(n)?e.bodyIds:[...e.bodyIds,n],entities:{...e.entities,[n]:m}}}function k(e){let t=e.bodyIds.map(t=>{let a=M(e.entities,t);return E(a)?a:B(t)}),a=t.length,i=a;return e.stages.map((e,s)=>{let n=t.filter(e=>e.furthestStageIndex>=s).length,r=t.filter(t=>t.visitedStageIds.includes(e.id)).length,o=t.reduce((t,a)=>{let i=M(a.visitsByStage,e.id);return t+("number"==typeof i&&Number.isFinite(i)?i:0)},0),l={id:e.id,label:e.label??e.id,reached:n,entered:r,total:a,conversion:a>0?n/a:0,fromPrevious:i>0?n/i:0,dropoff:Math.max(0,i-n),visits:o,repeatVisits:Math.max(0,o-r)};return i=n,l})}function $(e){return null==e?{top:ya,right:ya,bottom:ya,left:ya}:"number"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function D(e){if("number"==typeof e){let t=Math.max(1,Math.round(e));return Array.from({length:t},(e,t)=>({id:`bin-${t}`,label:String(t)}))}return 0===e.length?[{id:"bin-0",label:"0"}]:e.map((e,t)=>({id:e.id,label:e.label??e.id??String(t)}))}function O(e){let[t,a]=e.size,i=e.flow??ma,s=$(e.padding),n=Math.max(.05,Math.min(1,e.channelRatio??va)),r={x:s.left,y:s.top,width:Math.max(1,t-s.left-s.right),height:Math.max(1,a-s.top-s.bottom)},o="down"===i?r.height:r.width,l=o*Math.max(0,e.chargeExtent??fa),u=o*Math.max(0,e.projectionExtent??ba),c=o*Math.max(0,e.destinationExtent??ga),d=Math.max(0,o-l-c-u),p=D(e.destinations),h=("down"===i?r.width:r.height)/p.length,m="down"===i?(e,t)=>({x:r.x,y:r.y+e,width:r.width,height:t}):(e,t)=>({x:r.x+e,y:r.y,width:t,height:r.height}),y=m(0,l),f=m(l,d),g=l+d,b=m(g,c),v=m(g+c,u),w=p.map((e,t)=>{let a=t*h,s=h*n,o=(h-s)/2;if("down"===i){let i=r.x+a+o;return{id:e.id,label:e.label,order:t,x:i,y:b.y,width:s,height:b.height,centerX:r.x+(t+.5)*h,centerY:b.y+b.height/2}}let l=r.y+a+o;return{id:e.id,label:e.label,order:t,x:b.x,y:l,width:b.width,height:s,centerX:b.x+b.width/2,centerY:r.y+(t+.5)*h}});return{width:t,height:a,flow:i,charge:y,apparatus:f,destinations:w,projection:v}}function N(e,t){return e.destinations.find(e=>e.id===t)}function L(e,t,a){let{charge:i,flow:s}=e,n=Math.max(1,a),r=(t%n+.5)/n;return"down"===s?{x:i.x+i.width*r,y:i.y+i.height/2}:{x:i.x+i.width/2,y:i.y+i.height*r}}function Y(e,t={}){let a=t.thickness??4,i=t.idPrefix??"stage",{destinations:s,flow:n,width:r,height:o}=e,l=[];if(s.length>0){let t=s[0];if("down"===n){let n=t.y+t.height;l.push({id:`${i}-floor`,shape:{type:"segment",x1:e.charge.x,y1:n,x2:e.charge.x+e.charge.width,y2:n,thickness:a}});for(let e=1;e<s.length;e+=1){let r=s[e].centerX-(s[e].centerX-s[e-1].centerX)/2;l.push({id:`${i}-divider-${e}`,shape:{type:"segment",x1:r,y1:t.y,x2:r,y2:n,thickness:a}})}}else{let n=t.x+t.width;l.push({id:`${i}-floor`,shape:{type:"segment",x1:n,y1:e.charge.y,x2:n,y2:e.charge.y+e.charge.height,thickness:a}});for(let e=1;e<s.length;e+=1){let r=s[e].centerY-(s[e].centerY-s[e-1].centerY)/2;l.push({id:`${i}-divider-${e}`,shape:{type:"segment",x1:t.x,y1:r,x2:n,y2:r,thickness:a}})}}}return!1!==t.walls&&l.push({id:`${i}-wall-left`,shape:{type:"segment",x1:1,y1:0,x2:1,y2:o,thickness:a}},{id:`${i}-wall-right`,shape:{type:"segment",x1:r-1,y1:0,x2:r-1,y2:o,thickness:a}}),l}function G(e,t={}){let a=t.charge??"bodies",i=t.apparatus??"the apparatus",s=t.destination??"destinations",n=e.destinations.length,r="down"===e.flow?"downward":"left to right";return`${a} enter at the ${"down"===e.flow?"top":"left"}, travel ${r} through ${i}, and come to rest in ${n} ${s}: ${e.destinations.map(e=>e.label).join(", ")}.`}function U(e){let t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:null}function q(e,t,a,i){let s="function"==typeof e?e(t,a):e;return Number.isFinite(s)?Number(s):i}function J(e,t,a){return U(e[t])??a}function W(e,t){return"number"==typeof e?e:e?.[t]??0}function V(e){let t=e.bandwidth??e.scale.bandwidth?.()??0,a=/* @__PURE__ */new Set;for(let i of e.values){let s=e.scale(i);Number.isFinite(s)&&(a.add(Number(s)),a.add(Number(s)+t))}return Array.from(a).sort((e,t)=>e-t)}function X(e){let{band:t,idPrefix:a,plot:i,projection:s}=e,{includeBoundaryWalls:n=!0,includeInteriorWalls:r=!0,wallThickness:o=4}=t,l=V(t);if(l.length<2)return[];let u=n?0:1,c=n?l.length-1:l.length-2,d=[];for(let e=u;e<=c;e+=1){if(!r&&e>0&&e<l.length-1)continue;let t=l[e];d.push({id:`${a}-wall-${e}`,shape:"x"===s?{type:"aabb",x:t,y:i.y+i.height/2,width:o,height:i.height}:{type:"aabb",x:i.x+i.width/2,y:t,width:i.width,height:o}})}return d}function z(e){let{plot:t,idPrefix:a="physics-scale",bounds:i={},xBins:s,xBands:n,yBands:r}=e,o=[];if(!1!==i&&o.push(...ht(t,{idPrefix:a,...i})),s){let{idPrefix:e,yTop:i,yBottom:n,...r}=s;o.push(...yt({...r,idPrefix:e??`${a}-xbin`,yTop:i??t.y,yBottom:n??t.y+t.height}))}return n&&o.push(...X({band:n,idPrefix:n.idPrefix??`${a}-xband`,plot:t,projection:"x"})),r&&o.push(...X({band:r,idPrefix:r.idPrefix??`${a}-yband`,plot:t,projection:"y"})),o}function _(e){let{plot:t,rows:a,columns:i=a+1,pegRadius:s=3,idPrefix:n="galton-peg",yStart:r=t.y+.18*t.height,yEnd:o=t.y+.58*t.height,stagger:l=!0,restitution:u=.2,friction:c=.04}=e,d=Math.max(0,Math.floor(a)),p=Math.max(1,Math.floor(i));if(0===d)return[];let h=d<=1?0:(o-r)/(d-1),m=t.width/p,y=[];for(let e=0;e<d;e+=1){let a=l&&e%2==1?m/2:0;for(let i=0;i<p;i+=1){let o=t.x+m*(i+.5)+a;o<t.x+s||o>t.x+t.width-s||y.push({id:`${n}-${e}-${i}`,shape:{type:"aabb",x:o,y:r+e*h,width:2*s,height:2*s},restitution:u,friction:c})}}return y}function H(e,t={}){let{idPrefix:a="physics-token",radius:i=5,shape:s,mass:n,vx:r,vy:o,spawnAt:l,seed:u=1,jitter:c,datum:d}=t,p=qt(u),h=W(c,"x"),m=W(c,"y");return e.map((e,u)=>{let c=q(t.x,e,u,J(e,"x",0)),y=q(t.y,e,u,J(e,"y",0)),f=q(i,e,u,5),g="function"==typeof s?s(e,u):s??{type:"circle",radius:f};return{id:`${a}-${e.index??u}`,x:c+(p()-.5)*h,y:y+(p()-.5)*m,vx:q(r,e,u,0),vy:q(o,e,u,0),mass:q(n,e,u,1),spawnAt:q(l,e,u,void 0),shape:g,datum:d?d(e,u):e.datum??e}}).map(e=>{if(Number.isFinite(e.spawnAt))return e;let{spawnAt:t,...a}=e;return a})}function Q(e,t={}){let{idPrefix:a="sediment",collider:i=!0,colliderThickness:s=1,restitution:n=.05,friction:r=.2,...o}=t,l=ut(e,o),u=i?l.filter(e=>e.height>0).map(e=>({id:`${a}-${e.binId}`,shape:{type:"aabb",x:e.x+e.width/2,y:e.y+s/2,width:e.width,height:s},restitution:n,friction:r})):[];return{columns:l,colliders:u}}function K(e,t,a){return U("function"==typeof a?a(e,t):e[a]??e.datum?.[a])}function Z(e,t={}){let{timeAccessor:a="arrivalTime",timeScale:i=1,startAt:s=0,rebase:n=!0,sort:r=!0}=t,o=e.map((e,t)=>({spawn:e,time:K(e,t,a)??e.spawnAt??t})),l=o.length?Math.min(...o.map(e=>e.time)):0;return{initialSpawns:o.map(({spawn:e,time:t})=>({...e,spawnAt:s+(n?t-l:t)})).sort((e,t)=>r?(e.spawnAt??0)-(t.spawnAt??0):0),initialSpawnPacing:{pacing:"arrival",startAt:s,timeAccessor:"spawnAt",timeScale:i}}}import{$ as ee,A as te,Aa as ae,B as ie,Ba as se,C as ne,Ca as re,D as oe,Da as le,E as ue,Ea as ce,F as de,Fa as pe,G as he,Ga as me,H as ye,Ha as fe,I as ge,Ia as be,J as ve,Ja as we,K as xe,Ka as Se,L as Ie,La as Ae,M as Pe,Ma as Ce,N as Me,Na as Re,O as Ee,Oa as Be,P as Fe,Pa as je,Q as Te,Qa as ke,R as $e,S as De,T as Oe,U as Ne,V as Le,W as Ye,X as Ge,Y as Ue,Z as qe,_ as Je,a as We,aa as Ve,b as Xe,ba as ze,c as _e,ca as He,d as Qe,da as Ke,e as Ze,ea as et,f as tt,fa as at,g as it,ga as st,h as nt,ha as rt,i as ot,ia as lt,j as ut,ja as ct,k as dt,ka as pt,l as ht,la as mt,m as yt,ma as ft,n as gt,na as bt,o as vt,oa as wt,p as xt,pa as St,q as It,qa as At,r as Pt,ra as Ct,s as Mt,sa as Rt,t as Et,ta as Bt,u as Ft,ua as jt,v as Tt,va as kt,w as $t,wa as Dt,x as Ot,xa as Nt,y as Lt,ya as Yt,z as Gt,za as Ut}from"./c-STVM6CBI.min.js";import{a as qt}from"./c-RHDOOQ4X.min.js";import{Ba as Jt,Ca as Wt,Da as Vt,Lb as Xt,O as zt,Ob as _t,Pa as Ht,Pb as Qt,Qa as Kt,Qb as Zt,Rb as ea,e as ta,f as aa,g as ia,h as sa,i as na,j as ra,za as oa}from"./c-2U5JMOPN.min.js";import{i as la,j as ua,k as ca,l as da}from"./c-SSKV5JPW.min.js";var pa=[.1,.5,.9],ha=1e6,ma="down",ya=24,fa=.12,ga=.55,ba=0,va=1,wa=Mt;export{it as BuiltInPhysicsEngineAdapter,ke as ChainReactionChart,Ne as CollisionSwarmChart,Se as CrucibleChart,Ct as DEFAULT_CRUCIBLE_HEIGHT,Bt as DEFAULT_CRUCIBLE_OUTLETS,Rt as DEFAULT_CRUCIBLE_SIZE,At as DEFAULT_CRUCIBLE_WIDTH,Te as EventDropChart,Fe as GaltonBoardChart,Ke as GauntletChart,et as GuantletChart,Kt as MultiLineTooltip,at as PacketFlowChart,st as PhysicalFlowChart,Oe as PhysicsCustomChart,De as PhysicsPileChart,gt as PhysicsPipelineStore,Qe as PhysicsSVGOverlay,ot as PhysicsSedimentAccumulator,lt as ProcessFlowChart,Pt as StreamPhysicsFrame,Ht as Tooltip,Jt as TooltipRoot,$e as UnitPileChart,xe as absorbRegion,Gt as aggregateRegionCounts,mt as applyCrucibleEvent,Z as arrivalReplay,We as bodiesToAnnotationAnchors,Pe as bodyGroupSpec,Ot as buildCollisionSwarmPhysics,St as buildCrucibleEvidence,se as buildCrucibleInitialSpawns,kt as buildCrucibleLayout,Nt as buildCruciblePhysicsConfig,we as buildCrucibleProductEvents,ft as buildCrucibleProjection,re as buildCrucibleStateSpawns,le as buildCrucibleTerminalSpawns,Ft as buildEventDropPhysics,Et as buildGaltonBoardPhysics,Lt as buildPhysicalFlowPhysics,Xe as buildPhysicsAnnotationContext,$t as buildPhysicsPile,Ee as buildProcessFlowPhysics,je as calculateBlockerAmplification,ge as capacitatedRegion,de as chargeGateRegion,ct as cloneCrucibleState,z as collidersFromScales,C as comparePhysicsTrace,be as compileCruciblePlan,Ae as compileDependencyMachine,aa as compileMotionEncoding,e as compilePhysicsEncoding,xt as composePhysicsControllers,ea as composeStyleRules,vt as createCapacityQueueController,nt as createDefaultPhysicsEngineAdapter,l as createDependencyGateController,jt as createInitialCrucibleState,Re as createLogicalJoin,t as createPhysicsEncodingLayout,It as createPortalController,j as createProcessJourneyLedger,o as createServiceLevelController,n as createServiceResourcePoolController,ae as crucibleBondId,Dt as crucibleBoundaryColliders,Yt as crucibleComponentBodyId,Ut as crucibleProductBodyId,bt as crucibleProjectionRows,ce as crucibleSemanticKey,wa as default,ra as deriveMotionVector,G as describePhysicsStageGeography,wt as evaluateCrucibleConservation,dt as evaluatePhysicsBodyBudget,Ie as forceFieldRegion,_ as galtonPegs,ie as groupCompletionRows,Vt as hasOwnTooltipChrome,oa as hasTooltipContent,ua as hatchFillId,ca as hatchPatternDef,la as isHatchFill,Xt as makeRuleValueResolver,Wt as markTooltipChrome,_t as matchesThreshold,ue as membraneRegion,_e as normalizePhysicsAnnotations,sa as opacityFromAge,L as physicsChargePoint,N as physicsDestination,Le as physicsProcessBoundaryColliders,Ue as physicsProcessGroupSemanticItems,Ye as physicsProcessRegionSemanticItem,Ge as physicsProcessStageSemanticItems,x as physicsReferenceEnvelope,Y as physicsStageColliders,O as physicsStageGeography,Je as planGauntletPropertyWork,ve as portalRegion,ye as pressureFieldRegion,rt as processChrome,k as processJourneyRows,Me as processLaneWalls,ne as processStageLayout,oe as processStageRegions,c as processVolumePolygons,Tt as readEventDropOccupancy,te as regionCountsToProjectionRows,ee as replaceGauntletNegative,fe as replayCruciblePlan,Be as replayStateTransitions,pt as resolveCrucibleSelector,me as resolveCrucibleSnapshotAt,pe as resolveCrucibleTime,i as resolveGauntletTerminalState,s as resolveGauntletTerminalStates,ta as resolveMotionAccessor,ia as resolveMotionAge,na as resolveMotionVector,Zt as resolveStyleRules,da as resolveSvgFill,Ce as routeDependencyTracks,he as routeSurfaceRegion,Qt as ruleMatches,Q as sedimentBake,ut as sedimentHeightfield,H as spawnFromTokens,u as stageTargetInVolume,T as updateProcessJourney};
|
|
2
|
+
import{$ as e,A as t,Aa as a,B as i,Ba as s,C as n,Ca as r,D as o,Da as l,E as u,Ea as c,F as d,Fa as p,G as h,Ga as m,H as y,Ha as f,I as g,Ia as b,J as v,Ja as w,K as x,Ka as S,L as I,La as A,M as P,Ma as C,N as M,Na as R,O as E,Oa as F,P as B,Pa as j,Q as k,Qa as T,R as $,S as D,T as N,U as O,V as L,W as Y,X as G,Y as U,Z as q,_ as J,a as V,aa as W,b as X,ba as H,c as K,ca as _,d as z,da as Z,e as Q,ea as ee,f as te,fa as ae,g as ie,ga as se,h as ne,ha as re,i as oe,ia as le,j as ue,ja as ce,k as de,ka as pe,l as he,la as me,m as ye,ma as fe,n as ge,na as be,o as ve,oa as we,p as xe,pa as Se,q as Ie,qa as Ae,r as Pe,ra as Ce,s as Me,sa as Re,t as Ee,ta as Fe,u as Be,ua as je,v as ke,va as Te,w as $e,wa as De,x as Ne,xa as Oe,y as Le,ya as Ye,z as Ge,za as Ue}from"./c-4SCJKAWZ.min.js";import{a as qe}from"./c-RHDOOQ4X.min.js";import{Ib as Je,La as Ve,Lb as We,Ma as Xe,Mb as He,Nb as Ke,O as _e,Ob as ze,e as Ze,f as Qe,g as et,h as tt,i as at,j as it}from"./c-XCV7VUU3.min.js";import{i as st,j as nt,k as rt,l as ot}from"./c-SSKV5JPW.min.js";import{k as lt,o as ut,p as ct,q as dt}from"./c-5FUOKMH6.min.js";function pt(e){let{data:t,encoding:a,defaults:i={},scales:s}=e,n=Qe({data:t,encoding:a}),r=[],o=/* @__PURE__ */new Map,l=[],u=[],c=/* @__PURE__ */new Map;return n.rows.forEach((e,t)=>{let{id:n,datum:d}=e,p=Math.max(0,Ze(a.appearance?.size,d,t)??i.size??6),h=Ze(a.appearance?.shape,d,t)??i.shape??{type:"circle",radius:p},m=e.placement.x??i.x??0,y=e.placement.y??i.y??0,f=s?.x?s.x(m):m,g=s?.y?s.y(y):y,b=Ze(a.appearance?.color,d,t)??i.color,v=Ze(a.appearance?.opacity,d,t)??i.opacity,w=Ze(a.appearance?.stroke,d,t)??i.stroke,x=Ze(a.appearance?.strokeWidth,d,t)??i.strokeWidth,S=Ze(a.time?.spawnAt,d,t)??e.time.arrival,I=e.kinematics.velocityX,A=e.kinematics.velocityY,P=Ze(a.dynamics?.mass,d,t)??i.mass??1,C=Ze(a.dynamics?.friction,d,t),M=Ze(a.dynamics?.restitution,d,t),R=Ze(a.dynamics?.bodyCollisions,d,t),E={id:n,x:f,y:g,mass:P,shape:{...h},datum:d,...null!=S&&{spawnAt:S},...null!=I&&{vx:I},...null!=A&&{vy:A},...null!=C&&{friction:C},...null!=M&&{restitution:M},...null!=R&&{bodyCollisions:R}},F={...null!=b&&{fill:b},...null!=v&&{opacity:v},...null!=w&&{stroke:w},...null!=x&&{strokeWidth:x}},B={id:n,datum:d,appearance:{color:b,opacity:v,shape:h,size:p,stroke:w,strokeWidth:x},placement:{x:f,y:g,lane:e.placement.lane,space:a.placement?.space??"world"},time:{arrival:S,spawnAt:S,basis:a.time?.basis??"simulation",unit:a.time?.unit},kinematics:{velocityX:I,velocityY:A,space:a.kinematics?.space??"world"},dynamics:{bodyCollisions:R,friction:C,mass:P,restitution:M},process:e.process,evidence:e.evidence,accessible:e.accessible,spawn:E};r.push(B),o.set(n,B),l.push(E),c.set(n,F),u.push({id:n,bodyId:n,label:e.accessible.label,description:e.accessible.description,datum:d,x:f,y:g,group:e.accessible.group})}),{rows:r,byId:o,spawns:l,semanticItems:u,bodyStyle:e=>c.get(e.id)??{}}}function ht(e){return t=>{let a=pt({data:t.data,encoding:e.encoding,defaults:e.defaults,scales:t.scales}),i=e.extend?.(t,a)??{};return{...i,initialSpawns:a.spawns,bodyStyle:a.bodyStyle,semanticItems:[...a.semanticItems,...i.semanticItems??[]]}}}function mt(e){return new Map(e.gates.map(e=>[e.id,e]))}function yt(e,t){let{layout:a,positiveProperties:i,negativeProperties:s,viability:n,outcome:r}=t,o=mt(a),l=[...("function"==typeof t.events?t.events(e,a):t.events)??[]].sort((e,t)=>e.time-t.time),u=e;for(let e of l){let t=e.gateId?o.get(e.gateId):void 0,l=e.effects??[],c={...H(e,l),appliedAt:e.time},d=_(u,c);if(d!==u){u=d;for(let a of l){let n={event:e,gate:t,negativeProperties:s,positiveProperties:i,project:u};a.when&&!a.when(n)||(u=W(u,a,n))}u={...u,viability:n?.(u,{negativeProperties:s,positiveProperties:i})??q(u,i,s)},e.final&&(u={...u,outcome:e.outcome??r?.(u,{layout:a,negativeProperties:s,positiveProperties:i})??(u.viability>20?"built":"approved_not_built")})}}return u}function ft(e){return e.projects.map(t=>yt(t,e))}function gt(e){let t=e.resources.map(e=>({...e,bodyId:e.bodyId??e.id})),a=new Map(t.map(e=>[e.bodyId,e])),i=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map,n=e.assignmentForce??.45,r=e.returnForce??.35,o=e.caseAttraction??.08,l=e.assignmentOffset??{x:0,y:0},u=/* @__PURE__ */new Map,c=0,d=0;return{id:e.id??"service-resource-pool",continuous:!0,assign:e=>{let a=i.get(e);if(a)return a;let n=t.find(e=>!s.has(e.id));if(!n)return null;let r={resourceId:n.id,resourceBodyId:n.bodyId,caseBodyId:e,assignedAt:c};return i.set(e,r),s.set(n.id,r),d+=1,r},release:e=>{let t=i.get(e);return!!t&&(i.delete(e),s.delete(t.resourceId),d+=1,!0)},getAssignment:e=>i.get(e),tick:e=>{c=Math.max(c,e.elapsed),u=new Map(e.controls.readBodies().map(e=>[e.id,e]));for(let[e,t]of i)u.has(e)&&u.has(t.resourceBodyId)||(i.delete(e),s.delete(t.resourceId),d+=1)},getSnapshot:()=>({total:t.length,available:t.length-s.size,assigned:s.size,assignments:Array.from(i.values()),simulatedAt:c,metricRevision:d}),bodyForce:e=>{let t=a.get(e.body.id);if(t){let a=s.get(t.id),i=a?u.get(a.caseBodyId):void 0,o=i?i.x+(l.x??0):t.home.x,c=i?i.y+(l.y??0):t.home.y,d=a?n:r;return{x:(o-e.body.x)*d,y:(c-e.body.y)*d}}let c=i.get(e.body.id);if(!c||o<=0)return null;let d=u.get(c.resourceBodyId);return d?{x:(d.x-e.body.x)*o,y:(d.y-e.body.y)*o}:null}}}function bt(e,t){let a="function"==typeof t.deadlineAccessor?t.deadlineAccessor(e):Q(e.datum,t.deadlineAccessor)??Q(e,t.deadlineAccessor);return Number.isFinite(Number(a))?Math.max(0,Number(a)):0}function vt(e){let t=/* @__PURE__ */new Map,a=0,i=0;function s(a){t.set(a.bodyId,a),i+=1,e.onStateChange?.({...a})}function n(e){let i=t.get(e);return!(!i||null!=i.completedAt||(s({...i,completedAt:a,state:"unhappy"===i.state?"resolved-unhappy":"resolved"}),0))}return{id:e.id??"service-level",continuous:!0,protect:e=>{let i=t.get(e);return!(!i||null!=i.completedAt||"unhappy"===i.state||(s({...i,state:"protected",protectedAt:a}),0))},complete:n,getCase:e=>t.get(e),tick:i=>{a=Math.max(a,i.elapsed);for(let r of i.controls.readBodies()){if(!te(r,e.bodyFilter))continue;if(!t.has(r.id)){let t=bt(r,e);s({bodyId:r.id,openedAt:a,deadlineAt:a+t,state:"waiting"})}let o=t.get(r.id);o&&null==o.completedAt&&(e.completionRegionId&&i.getRegionState(r.id)?.activeRegionIds.includes(e.completionRegionId)?n(r.id):"waiting"===o.state&&a>=o.deadlineAt&&s({...o,state:"unhappy"}))}},getSnapshot:()=>{let e=Array.from(t.values()),s=t=>e.filter(e=>e.state===t).length;return{total:e.length,waiting:s("waiting"),protected:s("protected"),unhappy:s("unhappy"),resolved:s("resolved"),resolvedUnhappy:s("resolved-unhappy"),simulatedAt:a,metricRevision:i}}}}function wt(e){let t=/* @__PURE__ */new Set,a=0,i=0,s=0,n=!1;function r(t){return e.isOpen?e.isOpen(t):null!=e.opensAt&&t>=e.opensAt}return{id:e.id??`dependency-gate:${e.regionId}`,continuous:!0,tick:o=>{a=Math.max(a,o.elapsed);let l=n;n=r(a);let u=o.controls.readBodies(),c=new Map(u.map(e=>[e.id,e]));for(let a of u)!o.getRegionState(a.id)?.activeRegionIds.includes(e.regionId)||!te(a,e.bodyFilter)||!n&&!t.has(a.id)&&(t.add(a.id),s+=1,e.onHeld?.(a));if(n&&!l){for(let a of t){let t=c.get(a);t&&(o.controls.applyImpulse(a,e.releaseImpulse?.x??86,e.releaseImpulse?.y??0),i+=1,e.onReleased?.(t))}t.clear(),s+=1}for(let e of t)c.has(e)||(t.delete(e),s+=1)},getSnapshot:()=>({regionId:e.regionId,isOpen:n,blocked:t.size,released:i,simulatedAt:a,metricRevision:s}),bodyForce:a=>{if(n||!t.has(a.body.id))return null;let i=a.regions?.find(t=>t.id===e.regionId)?.shape;if(!i||"aabb"!==i.type)return{x:.8*-a.body.vx,y:.8*-a.body.vy};let s=e.holdForce??.4;return{x:(i.x-a.body.x)*s-.45*a.body.vx,y:(i.y-a.body.y)*s-.45*a.body.vy}}}}function xt(e,t,a={}){let i=a.random??Math.random,s=e.stages.find(e=>e.id===t)??e.stages[e.stages.length-1],n=_e(a.along??.5,.05,.95),r=a.jitterX??0,o=a.padY??20,l=s.x0+(s.x1-s.x0)*n+(2*i()-1)*r,u=Math.min(1,s.width/2),c=_e(l,s.x0+u,s.x1-u),d=e.boundaryY(c,"top")+o,p=e.boundaryY(c,"bottom")-o;return{x:c,y:p<=d?e.midY:d+i()*Math.max(1,p-d)}}function St(e){return"bowtie"===e.shape?[{id:"incoming",role:"incoming",points:[[e.left,e.topY],[e.centerLeft,e.pinchTop],[e.centerLeft,e.pinchBottom],[e.left,e.bottomY]]},{id:"center",role:"center",points:[[e.centerLeft,e.pinchTop],[e.centerRight,e.pinchTop],[e.centerRight,e.pinchBottom],[e.centerLeft,e.pinchBottom]]},{id:"outgoing",role:"outgoing",points:[[e.centerRight,e.pinchTop],[e.right,e.topY],[e.right,e.bottomY],[e.centerRight,e.pinchBottom]]}]:[{id:"volume",role:"volume",points:[[e.left,e.topY],[e.right,"funnel"===e.shape?e.pinchTop:e.topY],[e.right,"funnel"===e.shape?e.pinchBottom:e.bottomY],[e.left,e.bottomY]]}]}var It=[.1,.5,.9],At=1e6;function Pt(e){let t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:null}function Ct(e,t){let a=e;for(let e of t.split(".")){if(null==a||"object"!=typeof a||!Object.prototype.hasOwnProperty.call(a,e))return;a=a[e]}return a}function Mt(e,t,a,i,s){return"function"==typeof i?i(e,t,a):Ct(e,i??s)}function Rt(e){let t=Number(e.toFixed(12));return Object.is(t,-0)?0:t}function Et(e){let t=(e??It).map(e=>{let t=Pt(e);if(null==t||t<0||t>1)throw new RangeError(`physicsReferenceEnvelope quantiles must be finite values from 0 to 1; received ${String(e)}`);return Rt(t)});return Array.from(new Set(t)).sort((e,t)=>e-t)}function Ft(e){if(Array.isArray(e)){if(e.length>At)throw new RangeError(`physicsReferenceEnvelope sampleAt exceeds ${At} points`);return Array.from(new Set(e.map(Pt).filter(e=>null!=e).map(Rt))).sort((e,t)=>e-t)}let t=e,a=Pt(t.start),i=Pt(t.end),s=Pt(t.step);if(null==a||null==i||null==s||s<=0||i<a)throw new RangeError("physicsReferenceEnvelope sampleAt requires finite start/end values with end >= start and step > 0");let n=Math.floor((i-a)/s)+1;if(n>At)throw new RangeError(`physicsReferenceEnvelope sampleAt exceeds ${At} points`);let r=[],o=1e-10*Math.max(1,Math.abs(i),Math.abs(a));for(let e=0;e<n;e+=1){let t=a+e*s;if(t>i+o)break;r.push(Rt(Math.min(t,i)))}if((!r.length||Math.abs(r[r.length-1]-i)>o)&&r.push(Rt(i)),r.length>At)throw new RangeError(`physicsReferenceEnvelope sampleAt exceeds ${At} points`);return Array.from(new Set(r)).sort((e,t)=>e-t)}function Bt(e,t,a,i){let s=e.flatMap((e,s)=>{let n=Pt(Mt(e,s,t,a,"time")),r=Pt(Mt(e,s,t,i,"value"));return null==n||null==r?[]:[{time:Rt(n),value:r,index:s}]});s.sort((e,t)=>e.time-t.time||e.index-t.index);let n=[];for(let e of s){let t=n[n.length-1];t?.time===e.time?t.value=e.value:n.push({time:e.time,value:e.value})}return n}function jt(e,t){let a=0,i=e.length;for(;a<i;){let s=a+i>>>1;e[s].time<t?a=s+1:i=s}return a}function kt(e,t,a,i){if(!e.length)return null;let s=e[0],n=e[e.length-1];if(t<s.time)return"clamp"===i?s.value:null;if(t>n.time)return"clamp"===i?n.value:null;let r=jt(e,t),o=e[r];if(o?.time===t)return o.value;let l=e[Math.max(0,r-1)];if("step"===a||!o||o.time===l.time)return l.value;let u=(t-l.time)/(o.time-l.time);return l.value+(o.value-l.value)*u}function Tt(e,t){if(1===e.length)return e[0];let a=(e.length-1)*t,i=Math.floor(a),s=Math.ceil(a);if(i===s)return e[i];let n=a-i;return e[i]+(e[s]-e[i])*n}function $t(e){let t=e.interpolation??"step",a=e.outsideDomain??"omit",i=Et(e.quantiles),s=Ft(e.sampleAt),n=e.runs.map(t=>Bt(t.samples,t.id,e.timeAccessor,e.valueAccessor));return{points:s.map(e=>{let s=n.map(i=>kt(i,e,t,a)).filter(e=>null!=e).sort((e,t)=>e-t),r={};for(let e of i)r[e]=s.length?Tt(s,e):null;return{time:e,count:s.length,min:s.length?s[0]:null,max:s.length?s[s.length-1]:null,median:s.length?Tt(s,.5):null,quantiles:r}}),quantiles:i,interpolation:t,outsideDomain:a,runCount:e.runs.length}}function Dt(e,t){return e.quantiles.length?"lower"===t?e.quantiles[0]:e.quantiles[e.quantiles.length-1]:"lower"===t?"min":"max"}function Nt(e,t){if("min"===t||"median"===t||"max"===t)return e[t];let a=Pt(t);if(null==a||a<0||a>1)throw new RangeError(`comparePhysicsTrace quantile selectors must be from 0 to 1; received ${String(t)}`);let i=Rt(a);if(!Object.prototype.hasOwnProperty.call(e.quantiles,i))throw new Error(`comparePhysicsTrace could not find quantile ${i} in the reference envelope`);return e.quantiles[i]??null}function Ot(e,t,a){return e<t?"below":e>a?"above":"inside"}function Lt(e,t){let a=Math.max(0,t.time-e.time);if(!(a>0)||null==e.value||null==e.lower||null==e.upper||null==t.value||null==t.lower||null==t.upper)return{below:0,inside:0,above:0,observed:0};let i=e.value-e.lower,s=t.value-t.lower,n=e.value-e.upper,r=t.value-t.upper,o=[0,1];for(let[e,t]of[[i,s],[n,r]])(e<0&&t>0||e>0&&t<0)&&o.push(-e/(t-e));o.sort((e,t)=>e-t);let l=0,u=0,c=0;for(let i=0;i<o.length-1;i+=1){let s=o[i],n=o[i+1];if(!(n>s))continue;let r=(s+n)/2,d=(n-s)*a,p=Ot(e.value+(t.value-e.value)*r,e.lower+(t.lower-e.lower)*r,e.upper+(t.upper-e.upper)*r);"below"===p?l+=d:"above"===p?c+=d:u+=d}return{below:l,inside:u,above:c,observed:a}}function Yt(e,t,a={}){let i=a.interpolation??t.interpolation,s=a.outsideDomain??t.outsideDomain,n=Bt(e,a.traceId??"trace",a.timeAccessor,a.valueAccessor),r=a.lower??Dt(t,"lower"),o=a.upper??Dt(t,"upper"),l=t.points.map(e=>{let t=kt(n,e.time,i,s),a=Nt(e,r),l=Nt(e,o);if(null!=a&&null!=l&&a>l)throw new RangeError(`comparePhysicsTrace lower band exceeds upper band at time ${e.time}`);return{time:e.time,value:t,lower:a,upper:l,status:null==t||null==a||null==l?"unobserved":Ot(t,a,l)}}),u=0,c=0,d=0,p=0,h=null,m=0,y=null;for(let e of l){if("below"===e.status?u+=1:"inside"===e.status?c+=1:"above"===e.status&&(d+=1),null==e.value||null==e.lower||null==e.upper)continue;let t=Math.max(0,e.value-e.upper),a=Math.max(0,e.lower-e.value);t>p&&(p=t,h=e.time),a>m&&(m=a,y=e.time)}let f=0,g=0,b=0,v=0;for(let e=0;e<l.length-1;e+=1){let t=l[e],a=l[e+1],s=Math.max(0,a.time-t.time);if(s>0){if("linear"===i){let e=Lt(t,a);f+=e.below,g+=e.inside,b+=e.above,v+=e.observed;continue}"unobserved"!==t.status&&(v+=s,"below"===t.status?f+=s:"above"===t.status?b+=s:g+=s)}}let w=l[0]?.time,x=l[l.length-1]?.time,S=null==w||null==x?0:Math.max(0,x-w),I=u+c+d;return{points:l,sampleCount:l.length,observedSamples:I,belowSamples:u,insideSamples:c,aboveSamples:d,totalDuration:S,observedDuration:v,unobservedDuration:Math.max(0,S-v),belowDuration:f,insideDuration:g,aboveDuration:b,peakExcess:p,peakExcessAt:h,peakDeficit:m,peakDeficitAt:y}}function Gt(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function Ut(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}function qt(e){return!!Ut(e)&&"string"==typeof e.id&&"number"==typeof e.furthestStageIndex&&Number.isFinite(e.furthestStageIndex)&&Array.isArray(e.visitedStageIds)&&e.visitedStageIds.every(e=>"string"==typeof e)&&Ut(e.visitsByStage)&&Ut(e.firstEnteredAt)&&Ut(e.lastEnteredAt)&&"number"==typeof e.regressionCount&&Number.isFinite(e.regressionCount)}function Jt(e){return{id:e,furthestStageIndex:-1,visitedStageIds:[],visitsByStage:{},firstEnteredAt:{},lastEnteredAt:{},regressionCount:0}}function Vt(e,t){let a=t.stageId?.(e);if(a)return a;let i=e.region.metadata;if(i&&"object"==typeof i&&Object.prototype.hasOwnProperty.call(i,"stageId")){let e=i.stageId;if("string"==typeof e)return e}return e.region.id}function Wt(e){let t=Array.from(new Set(e.bodyIds??[]));return{stages:e.stages.map(e=>({...e})),bodyIds:t,entities:Object.fromEntries(t.map(e=>[e,Jt(e)]))}}function Xt(e,t,a={}){if("region-enter"!==t.type)return e;let i=Vt(t,a),s=e.stages.findIndex(e=>e.id===i);if(s<0)return e;let n=a.entityId?.(t)??t.bodyId;if(!n)return e;let r=Gt(e.entities,n),o=qt(r)?r:Jt(n),l=o.currentStageId?e.stages.findIndex(e=>e.id===o.currentStageId):-1,u=!o.visitedStageIds.includes(i),c=Number(t.observation.timestamp),d=Number.isFinite(c)?c:0,p=Gt(o.visitsByStage,i),h="number"==typeof p&&Number.isFinite(p)?p:0,m={...o,currentStageId:i,furthestStageId:s>o.furthestStageIndex?i:o.furthestStageId,furthestStageIndex:Math.max(o.furthestStageIndex,s),visitedStageIds:u?[...o.visitedStageIds,i]:o.visitedStageIds,visitsByStage:{...o.visitsByStage,[i]:h+1},firstEnteredAt:u?{...o.firstEnteredAt,[i]:d}:o.firstEnteredAt,lastEnteredAt:{...o.lastEnteredAt,[i]:d},regressionCount:l>=0&&s<l?o.regressionCount+1:o.regressionCount};return{...e,bodyIds:e.bodyIds.includes(n)?e.bodyIds:[...e.bodyIds,n],entities:{...e.entities,[n]:m}}}function Ht(e){let t=e.bodyIds.map(t=>{let a=Gt(e.entities,t);return qt(a)?a:Jt(t)}),a=t.length,i=a;return e.stages.map((e,s)=>{let n=t.filter(e=>e.furthestStageIndex>=s).length,r=t.filter(t=>t.visitedStageIds.includes(e.id)).length,o=t.reduce((t,a)=>{let i=Gt(a.visitsByStage,e.id);return t+("number"==typeof i&&Number.isFinite(i)?i:0)},0),l={id:e.id,label:e.label??e.id,reached:n,entered:r,total:a,conversion:a>0?n/a:0,fromPrevious:i>0?n/i:0,dropoff:Math.max(0,i-n),visits:o,repeatVisits:Math.max(0,o-r)};return i=n,l})}function Kt(e){return null==e?{top:24,right:24,bottom:24,left:24}:"number"==typeof e?{top:e,right:e,bottom:e,left:e}:{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function _t(e){if("number"==typeof e){let t=Math.max(1,Math.round(e));return Array.from({length:t},(e,t)=>({id:`bin-${t}`,label:String(t)}))}return 0===e.length?[{id:"bin-0",label:"0"}]:e.map((e,t)=>({id:e.id,label:e.label??e.id??String(t)}))}function zt(e){let[t,a]=e.size,i=e.flow??"down",s=Kt(e.padding),n=Math.max(.05,Math.min(1,e.channelRatio??1)),r={x:s.left,y:s.top,width:Math.max(1,t-s.left-s.right),height:Math.max(1,a-s.top-s.bottom)},o="down"===i?r.height:r.width,l=o*Math.max(0,e.chargeExtent??.12),u=o*Math.max(0,e.projectionExtent??0),c=o*Math.max(0,e.destinationExtent??.55),d=Math.max(0,o-l-c-u),p=_t(e.destinations),h=("down"===i?r.width:r.height)/p.length,m="down"===i?(e,t)=>({x:r.x,y:r.y+e,width:r.width,height:t}):(e,t)=>({x:r.x+e,y:r.y,width:t,height:r.height}),y=m(0,l),f=m(l,d),g=l+d,b=m(g,c),v=m(g+c,u),w=p.map((e,t)=>{let a=t*h,s=h*n,o=(h-s)/2;if("down"===i){let i=r.x+a+o;return{id:e.id,label:e.label,order:t,x:i,y:b.y,width:s,height:b.height,centerX:r.x+(t+.5)*h,centerY:b.y+b.height/2}}let l=r.y+a+o;return{id:e.id,label:e.label,order:t,x:b.x,y:l,width:b.width,height:s,centerX:b.x+b.width/2,centerY:r.y+(t+.5)*h}});return{width:t,height:a,flow:i,charge:y,apparatus:f,destinations:w,projection:v}}function Zt(e,t){return e.destinations.find(e=>e.id===t)}function Qt(e,t,a){let{charge:i,flow:s}=e,n=Math.max(1,a),r=(t%n+.5)/n;return"down"===s?{x:i.x+i.width*r,y:i.y+i.height/2}:{x:i.x+i.width/2,y:i.y+i.height*r}}function ea(e,t={}){let a=t.thickness??4,i=t.idPrefix??"stage",{destinations:s,flow:n,width:r,height:o}=e,l=[];if(s.length>0){let t=s[0];if("down"===n){let n=t.y+t.height;l.push({id:`${i}-floor`,shape:{type:"segment",x1:e.charge.x,y1:n,x2:e.charge.x+e.charge.width,y2:n,thickness:a}});for(let e=1;e<s.length;e+=1){let r=s[e].centerX-(s[e].centerX-s[e-1].centerX)/2;l.push({id:`${i}-divider-${e}`,shape:{type:"segment",x1:r,y1:t.y,x2:r,y2:n,thickness:a}})}}else{let n=t.x+t.width;l.push({id:`${i}-floor`,shape:{type:"segment",x1:n,y1:e.charge.y,x2:n,y2:e.charge.y+e.charge.height,thickness:a}});for(let e=1;e<s.length;e+=1){let r=s[e].centerY-(s[e].centerY-s[e-1].centerY)/2;l.push({id:`${i}-divider-${e}`,shape:{type:"segment",x1:t.x,y1:r,x2:n,y2:r,thickness:a}})}}}return!1!==t.walls&&l.push({id:`${i}-wall-left`,shape:{type:"segment",x1:1,y1:0,x2:1,y2:o,thickness:a}},{id:`${i}-wall-right`,shape:{type:"segment",x1:r-1,y1:0,x2:r-1,y2:o,thickness:a}}),l}function ta(e,t={}){let a=t.charge??"bodies",i=t.apparatus??"the apparatus",s=t.destination??"destinations",n=e.destinations.length,r="down"===e.flow?"downward":"left to right";return`${a} enter at the ${"down"===e.flow?"top":"left"}, travel ${r} through ${i}, and come to rest in ${n} ${s}: ${e.destinations.map(e=>e.label).join(", ")}.`}function aa(e){let t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:null}function ia(e,t,a,i){let s="function"==typeof e?e(t,a):e;return Number.isFinite(s)?Number(s):i}function sa(e,t,a){return aa(e[t])??a}function na(e,t){return"number"==typeof e?e:e?.[t]??0}function ra(e){let t=e.bandwidth??e.scale.bandwidth?.()??0,a=/* @__PURE__ */new Set;for(let i of e.values){let s=e.scale(i);Number.isFinite(s)&&(a.add(Number(s)),a.add(Number(s)+t))}return Array.from(a).sort((e,t)=>e-t)}function oa(e){let{band:t,idPrefix:a,plot:i,projection:s}=e,{includeBoundaryWalls:n=!0,includeInteriorWalls:r=!0,wallThickness:o=4}=t,l=ra(t);if(l.length<2)return[];let u=n?0:1,c=n?l.length-1:l.length-2,d=[];for(let e=u;e<=c;e+=1){if(!r&&e>0&&e<l.length-1)continue;let t=l[e];d.push({id:`${a}-wall-${e}`,shape:"x"===s?{type:"aabb",x:t,y:i.y+i.height/2,width:o,height:i.height}:{type:"aabb",x:i.x+i.width/2,y:t,width:i.width,height:o}})}return d}function la(e){let{plot:t,idPrefix:a="physics-scale",bounds:i={},xBins:s,xBands:n,yBands:r}=e,o=[];if(!1!==i&&o.push(...he(t,{idPrefix:a,...i})),s){let{idPrefix:e,yTop:i,yBottom:n,...r}=s;o.push(...ye({...r,idPrefix:e??`${a}-xbin`,yTop:i??t.y,yBottom:n??t.y+t.height}))}return n&&o.push(...oa({band:n,idPrefix:n.idPrefix??`${a}-xband`,plot:t,projection:"x"})),r&&o.push(...oa({band:r,idPrefix:r.idPrefix??`${a}-yband`,plot:t,projection:"y"})),o}function ua(e){let{plot:t,rows:a,columns:i=a+1,pegRadius:s=3,idPrefix:n="galton-peg",yStart:r=t.y+.18*t.height,yEnd:o=t.y+.58*t.height,stagger:l=!0,restitution:u=.2,friction:c=.04}=e,d=Math.max(0,Math.floor(a)),p=Math.max(1,Math.floor(i));if(0===d)return[];let h=d<=1?0:(o-r)/(d-1),m=t.width/p,y=[];for(let e=0;e<d;e+=1){let a=l&&e%2==1?m/2:0;for(let i=0;i<p;i+=1){let o=t.x+m*(i+.5)+a;o<t.x+s||o>t.x+t.width-s||y.push({id:`${n}-${e}-${i}`,shape:{type:"aabb",x:o,y:r+e*h,width:2*s,height:2*s},restitution:u,friction:c})}}return y}function ca(e,t={}){let{idPrefix:a="physics-token",radius:i=5,shape:s,mass:n,vx:r,vy:o,spawnAt:l,seed:u=1,jitter:c,datum:d}=t,p=qe(u),h=na(c,"x"),m=na(c,"y");return e.map((e,u)=>{let c=ia(t.x,e,u,sa(e,"x",0)),y=ia(t.y,e,u,sa(e,"y",0)),f=ia(i,e,u,5),g="function"==typeof s?s(e,u):s??{type:"circle",radius:f};return{id:`${a}-${e.index??u}`,x:c+(p()-.5)*h,y:y+(p()-.5)*m,vx:ia(r,e,u,0),vy:ia(o,e,u,0),mass:ia(n,e,u,1),spawnAt:ia(l,e,u,void 0),shape:g,datum:d?d(e,u):e.datum??e}}).map(e=>{if(Number.isFinite(e.spawnAt))return e;let{spawnAt:t,...a}=e;return a})}function da(e,t={}){let{idPrefix:a="sediment",collider:i=!0,colliderThickness:s=1,restitution:n=.05,friction:r=.2,...o}=t,l=ue(e,o),u=i?l.filter(e=>e.height>0).map(e=>({id:`${a}-${e.binId}`,shape:{type:"aabb",x:e.x+e.width/2,y:e.y+s/2,width:e.width,height:s},restitution:n,friction:r})):[];return{columns:l,colliders:u}}function pa(e,t,a){return aa("function"==typeof a?a(e,t):e[a]??e.datum?.[a])}function ha(e,t={}){let{timeAccessor:a="arrivalTime",timeScale:i=1,startAt:s=0,rebase:n=!0,sort:r=!0}=t,o=e.map((e,t)=>({spawn:e,time:pa(e,t,a)??e.spawnAt??t})),l=o.length?Math.min(...o.map(e=>e.time)):0;return{initialSpawns:o.map(({spawn:e,time:t})=>({...e,spawnAt:s+(n?t-l:t)})).sort((e,t)=>r?(e.spawnAt??0)-(t.spawnAt??0):0),initialSpawnPacing:{pacing:"arrival",startAt:s,timeAccessor:"spawnAt",timeScale:i}}}var ma=Me;export{ie as BuiltInPhysicsEngineAdapter,T as ChainReactionChart,O as CollisionSwarmChart,S as CrucibleChart,Ce as DEFAULT_CRUCIBLE_HEIGHT,Fe as DEFAULT_CRUCIBLE_OUTLETS,Re as DEFAULT_CRUCIBLE_SIZE,Ae as DEFAULT_CRUCIBLE_WIDTH,k as EventDropChart,B as GaltonBoardChart,Z as GauntletChart,ee as GuantletChart,Xe as MultiLineTooltip,ae as PacketFlowChart,se as PhysicalFlowChart,N as PhysicsCustomChart,D as PhysicsPileChart,ge as PhysicsPipelineStore,z as PhysicsSVGOverlay,oe as PhysicsSedimentAccumulator,le as ProcessFlowChart,Pe as StreamPhysicsFrame,Ve as Tooltip,ut as TooltipRoot,$ as UnitPileChart,x as absorbRegion,Ge as aggregateRegionCounts,me as applyCrucibleEvent,ha as arrivalReplay,V as bodiesToAnnotationAnchors,P as bodyGroupSpec,Ne as buildCollisionSwarmPhysics,Se as buildCrucibleEvidence,s as buildCrucibleInitialSpawns,Te as buildCrucibleLayout,Oe as buildCruciblePhysicsConfig,w as buildCrucibleProductEvents,fe as buildCrucibleProjection,r as buildCrucibleStateSpawns,l as buildCrucibleTerminalSpawns,Be as buildEventDropPhysics,Ee as buildGaltonBoardPhysics,Le as buildPhysicalFlowPhysics,X as buildPhysicsAnnotationContext,$e as buildPhysicsPile,E as buildProcessFlowPhysics,j as calculateBlockerAmplification,g as capacitatedRegion,d as chargeGateRegion,ce as cloneCrucibleState,la as collidersFromScales,Yt as comparePhysicsTrace,b as compileCruciblePlan,A as compileDependencyMachine,Qe as compileMotionEncoding,pt as compilePhysicsEncoding,xe as composePhysicsControllers,ze as composeStyleRules,ve as createCapacityQueueController,ne as createDefaultPhysicsEngineAdapter,wt as createDependencyGateController,je as createInitialCrucibleState,R as createLogicalJoin,ht as createPhysicsEncodingLayout,Ie as createPortalController,Wt as createProcessJourneyLedger,vt as createServiceLevelController,gt as createServiceResourcePoolController,a as crucibleBondId,De as crucibleBoundaryColliders,Ye as crucibleComponentBodyId,Ue as crucibleProductBodyId,be as crucibleProjectionRows,c as crucibleSemanticKey,ma as default,it as deriveMotionVector,ta as describePhysicsStageGeography,we as evaluateCrucibleConservation,de as evaluatePhysicsBodyBudget,I as forceFieldRegion,ua as galtonPegs,i as groupCompletionRows,dt as hasOwnTooltipChrome,lt as hasTooltipContent,nt as hatchFillId,rt as hatchPatternDef,st as isHatchFill,Je as makeRuleValueResolver,ct as markTooltipChrome,We as matchesThreshold,u as membraneRegion,K as normalizePhysicsAnnotations,tt as opacityFromAge,Qt as physicsChargePoint,Zt as physicsDestination,L as physicsProcessBoundaryColliders,U as physicsProcessGroupSemanticItems,Y as physicsProcessRegionSemanticItem,G as physicsProcessStageSemanticItems,$t as physicsReferenceEnvelope,ea as physicsStageColliders,zt as physicsStageGeography,J as planGauntletPropertyWork,v as portalRegion,y as pressureFieldRegion,re as processChrome,Ht as processJourneyRows,M as processLaneWalls,n as processStageLayout,o as processStageRegions,St as processVolumePolygons,ke as readEventDropOccupancy,t as regionCountsToProjectionRows,e as replaceGauntletNegative,f as replayCruciblePlan,F as replayStateTransitions,pe as resolveCrucibleSelector,m as resolveCrucibleSnapshotAt,p as resolveCrucibleTime,yt as resolveGauntletTerminalState,ft as resolveGauntletTerminalStates,Ze as resolveMotionAccessor,et as resolveMotionAge,at as resolveMotionVector,Ke as resolveStyleRules,ot as resolveSvgFill,C as routeDependencyTracks,h as routeSurfaceRegion,He as ruleMatches,da as sedimentBake,ue as sedimentHeightfield,ca as spawnFromTokens,xt as stageTargetInVolume,Xt as updateProcessJourney};
|
package/dist/rough.module.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e}from"./c-3FOUMWLR.min.js";import{a as t}from"./c-CRTZRHCC.min.js";import r from"roughjs";import{jsx as i}from"react/jsx-runtime";var n=2147483647;function a(e){return"number"==typeof e&&Number.isFinite(e)}function l(e){if(!Array.isArray(e))return null;let t=[];for(let r of e){if(!Array.isArray(r)||!a(r[0])||!a(r[1]))return null;t.push([r[0],r[1]])}return t}function o(e){if(e.style?.icon||e.fillGradient||e.strokeGradient||e.colorThresholds||e.clipRect)return null;if(("rect"===e.type||"circle"===e.type||"arc"===e.type)&&"string"==typeof e.pathD&&e.pathD)return Array.isArray(e.faces)&&e.faces.length?null:{kind:"path",d:e.pathD};if("rect"===e.type&&a(e.x)&&a(e.y)&&a(e.w)&&a(e.h))return{kind:"rectangle",x:e.x,y:e.y,width:e.w,height:e.h};if("point"===e.type&&a(e.x)&&a(e.y)&&a(e.r))return{kind:"circle",x:e.x,y:e.y,diameter:2*e.r};if("circle"===e.type&&a(e.cx)&&a(e.cy)&&a(e.r))return{kind:"circle",x:e.cx,y:e.cy,diameter:2*e.r};if("line"===e.type){let t=l(e.path);if(t&&t.length>=2&&!e._decayOpacities)return{kind:"linearPath",points:t};if(a(e.x1)&&a(e.y1)&&a(e.x2)&&a(e.y2))return{kind:"line",x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}if("area"===e.type){let t=l(e.topPath),r=l(e.bottomPath);if(t&&r&&t.length>1&&r.length>1&&!e._decayOpacities)return{kind:"polygon",points:[...t,...r.slice().reverse()]}}if("geoarea"===e.type&&"string"==typeof e.pathData&&e.pathData)return{kind:"path",d:e.pathData};if(("bezier"===e.type||"ribbon"===e.type||"curved"===e.type)&&"string"==typeof e.pathD&&e.pathD)return{kind:"path",d:e.pathD};if("trapezoid"===e.type){let t=l(e.points);if(t&&t.length>=3)return{kind:"polygon",points:t}}if("connector"===e.type&&a(e.x1)&&a(e.y1)&&a(e.x2)&&a(e.y2))return{kind:"line",x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2};if("violin"===e.type&&"string"==typeof e.pathString&&a(e.translateX)&&a(e.translateY))return{kind:"path",d:e.pathString,transform:{x:e.translateX,y:e.translateY}};if("symbol"===e.type&&Array.isArray(e.faces)&&e.faces.length)return null;if("symbol"===e.type&&"string"==typeof e.path){let t=a(e.x)?e.x:e.cx,r=a(e.y)?e.y:e.cy;if(a(t)&&a(r))return{kind:"path",d:e.path,transform:{x:t,y:r,rotation:a(e.rotation)?e.rotation:void 0}}}return"arc"===e.type&&a(e.cx)&&a(e.cy)&&a(e.outerR)&&a(e.startAngle)&&a(e.endAngle)?{kind:"arc",x:e.cx,y:e.cy,width:2*e.outerR,height:2*e.outerR,start:e.startAngle,stop:e.endAngle,closed:!0}:null}function s(e,t=/* @__PURE__ */new WeakSet){if(null==e||"string"==typeof e||"boolean"==typeof e)return e;if("number"==typeof e)return Number.isFinite(e)?e:String(e);if("object"!=typeof e)return String(e);if(t.has(e))return"[Circular]";if(t.add(e),Array.isArray(e))return e.map(e=>s(e,t));let r=e;return Object.fromEntries(Object.keys(r).sort().map(e=>[e,s(r[e],t)]))}function f(e){return JSON.stringify(s(e))??String(e)}function c(e){let r="string"==typeof e?e:f(e);return t(r)%n+1}function p(e){return a(e)&&Math.trunc(Math.abs(e))%n||1}function y(e){let t=e.datum&&"object"==typeof e.datum?e.datum:void 0;return e._transitionKey??e.pointId??e.id??e.category??e.group??t?.id??t?.key??t?.name??null}function u(e){return{fill:"string"==typeof e.fill?e.fill:e.fill?"[CanvasPattern]":void 0,fillOpacity:e.fillOpacity,opacity:e.opacity,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.strokeDasharray,strokeLinecap:e.strokeLinecap}}function h(e){if(!e)return;let t=e.split(/[\s,]+/).map(Number).filter(Number.isFinite);return t.length?t:void 0}function d(e,t){if(t.fill&&"string"!=typeof t.fill||"string"==typeof t.fill&&t.fill.startsWith("url("))return null;let r="string"==typeof t.fill&&"none"!==t.fill?t.fill:void 0,i=t.stroke&&"none"!==t.stroke?t.stroke:void 0;switch(e.type){case"line":case"connector":case"curved":return{stroke:i??"#007bff"};case"bezier":case"ribbon":return{fill:r??"#999999",stroke:i??"none"};case"geoarea":return{fill:r??"#e0e0e0",stroke:i??"none"};case"point":case"circle":case"rect":case"area":case"trapezoid":case"violin":case"arc":return{fill:r??"#4e79a7",stroke:i??"none"};case"symbol":return{fill:r,stroke:i??(r?"none":"#4e79a7")};default:return{fill:r,stroke:i??"#007bff"}}}function g(e,t,r){switch(t.kind){case"rectangle":return e.rectangle(t.x,t.y,t.width,t.height,r);case"circle":return e.circle(t.x,t.y,t.diameter,r);case"line":return e.line(t.x1,t.y1,t.x2,t.y2,r);case"linearPath":return e.linearPath(t.points,r);case"polygon":return e.polygon(t.points,r);case"path":return e.path(t.d,r);case"arc":return e.arc(t.x,t.y,t.width,t.height,t.start,t.stop,t.closed,r)}}function k(e,t,r){e.beginPath();for(let i of t.ops){let t="number"==typeof r&&r>=0?i.data.map(e=>+e.toFixed(r)):i.data;"move"===i.op?e.moveTo(t[0],t[1]):"lineTo"===i.op?e.lineTo(t[0],t[1]):"bcurveTo"===i.op&&e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5])}}function m(e,t){let{drawable:r,geometry:i,style:n}=t,a=r.options,l=e.globalAlpha,o="path"===i.kind?i.transform:void 0;o&&(e.translate(o.x,o.y),o.rotation&&e.rotate(o.rotation));for(let t of r.sets){if(e.save(),"path"===t.type)e.strokeStyle="none"===a.stroke?"transparent":a.stroke,e.lineWidth=a.strokeWidth,e.globalAlpha=l*(n.opacity??1),a.strokeLineDash&&e.setLineDash(a.strokeLineDash),a.strokeLineDashOffset&&(e.lineDashOffset=a.strokeLineDashOffset),k(e,t,a.fixedDecimalPlaceDigits),e.stroke();else if("fillPath"===t.type)e.fillStyle=a.fill??"transparent",e.globalAlpha=l*(n.opacity??1)*(n.fillOpacity??1),k(e,t,a.fixedDecimalPlaceDigits),e.fill("curve"===r.shape||"polygon"===r.shape||"path"===r.shape?"evenodd":"nonzero");else{let r=a.fillWeight<0?a.strokeWidth/2:a.fillWeight;e.strokeStyle=a.fill??"transparent",e.lineWidth=r,e.globalAlpha=l*(n.opacity??1)*(n.fillOpacity??1),a.fillLineDash&&e.setLineDash(a.fillLineDash),a.fillLineDashOffset&&(e.lineDashOffset=a.fillLineDashOffset),k(e,t,a.fixedDecimalPlaceDigits),e.stroke()}e.restore()}}function x(t={}){let n=p(t.seed),l=a(t.cacheSize)?Math.max(1,Math.trunc(t.cacheSize)):1e3,s={roughness:t.roughness,bowing:t.bowing,maxRandomnessOffset:t.maxRandomnessOffset,curveFitting:t.curveFitting,curveTightness:t.curveTightness,curveStepCount:t.curveStepCount,fillStyle:t.fillStyle,fillWeight:t.fillWeight,hachureAngle:t.hachureAngle,hachureGap:t.hachureGap,dashOffset:t.dashOffset,dashGap:t.dashGap,zigzagOffset:t.zigzagOffset,disableMultiStroke:t.disableMultiStroke,disableMultiStrokeFill:t.disableMultiStrokeFill,preserveVertices:t.preserveVertices,simplification:t.simplification,fixedDecimalPlaceDigits:t.fixedDecimalPlaceDigits},k=Object.fromEntries(Object.entries(s).filter(([,e])=>void 0!==e)),x=f({...k,seed:n}),b=r.generator(),v=/* @__PURE__ */new Map;function D(e,t){let r=o(e);return f({backend:"roughjs",identity:y(e),type:e.type,geometry:r,style:u(t),options:x,seed:n})}function O(t,r,i){let a=o(t);if(!a)return null;let s=d(t,r);if(!s)return null;let p=i?{fill:s.fill?e(i,s.fill)||s.fill:void 0,stroke:e(i,s.stroke)||s.stroke}:s,u=`${D(t,r)}:${f(p)}`,m=v.get(u);if(m)return v.delete(u),v.set(u,m),m;let x=c(`${n}:${y(t)??f(a)}`),O={...k,seed:x,fill:p.fill,stroke:p.stroke,strokeWidth:r.strokeWidth??1,strokeLineDash:h(r.strokeDasharray)},S={drawable:g(b,a,O),geometry:a,style:r};for(v.set(u,S);v.size>l;){let e=v.keys().next().value;if(void 0===e)break;v.delete(e)}return S}return{id:"roughjs",seed:n,cacheKey:D,drawCanvas({context:e,node:t,style:r}){let i=O(t,r,e);return!!i&&(m(e,i),!0)},renderStaticSVG({node:e,style:t,key:r}){let n=O(e,t);if(!n)return null;let a="path"===n.geometry.kind?n.geometry.transform:void 0,l=b.toPaths(n.drawable).map((e,n)=>/* @__PURE__ */i("path",{d:e.d,fill:e.fill??"none",fillOpacity:e.fill&&"none"!==e.fill?t.fillOpacity:void 0,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:t.opacity,strokeLinecap:t.strokeLinecap,strokeDasharray:t.strokeDasharray},`${r}-path-${n}`)),o=a?`translate(${a.x} ${a.y})${a.rotation?` rotate(${180*a.rotation/Math.PI})`:""}`:void 0;/*
|
|
1
|
+
import{a as e}from"./c-3FOUMWLR.min.js";import{a as t}from"./c-CRTZRHCC.min.js";import r from"roughjs";import{jsx as i}from"react/jsx-runtime";var n=2147483647;function a(e){return"number"==typeof e&&Number.isFinite(e)}function l(e){if(!Array.isArray(e))return null;let t=[];for(let r of e){if(!Array.isArray(r)||!a(r[0])||!a(r[1]))return null;t.push([r[0],r[1]])}return t}function o(e){if(e.style?.icon||e.fillGradient||e.strokeGradient||e.colorThresholds||e.clipRect)return null;if(("rect"===e.type||"circle"===e.type||"arc"===e.type)&&"string"==typeof e.pathD&&e.pathD)return Array.isArray(e.faces)&&e.faces.length?null:{kind:"path",d:e.pathD};if("rect"===e.type&&a(e.x)&&a(e.y)&&a(e.w)&&a(e.h))return{kind:"rectangle",x:e.x,y:e.y,width:e.w,height:e.h};if("point"===e.type&&a(e.x)&&a(e.y)&&a(e.r))return{kind:"circle",x:e.x,y:e.y,diameter:2*e.r};if("circle"===e.type&&a(e.cx)&&a(e.cy)&&a(e.r))return{kind:"circle",x:e.cx,y:e.cy,diameter:2*e.r};if("line"===e.type){let t=l(e.path);if(t&&t.length>=2&&!e._decayOpacities)return{kind:"linearPath",points:t};if(a(e.x1)&&a(e.y1)&&a(e.x2)&&a(e.y2))return{kind:"line",x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}if("area"===e.type){let t=l(e.topPath),r=l(e.bottomPath);if(t&&r&&t.length>1&&r.length>1&&!e._decayOpacities)return{kind:"polygon",points:[...t,...r.slice().reverse()]}}if("geoarea"===e.type&&"string"==typeof e.pathData&&e.pathData)return{kind:"path",d:e.pathData};if(("bezier"===e.type||"ribbon"===e.type||"curved"===e.type)&&"string"==typeof e.pathD&&e.pathD)return{kind:"path",d:e.pathD};if("trapezoid"===e.type){let t=l(e.points);if(t&&t.length>=3)return{kind:"polygon",points:t}}if("connector"===e.type&&a(e.x1)&&a(e.y1)&&a(e.x2)&&a(e.y2))return{kind:"line",x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2};if("violin"===e.type&&"string"==typeof e.pathString&&a(e.translateX)&&a(e.translateY))return{kind:"path",d:e.pathString,transform:{x:e.translateX,y:e.translateY}};if("symbol"===e.type&&Array.isArray(e.faces)&&e.faces.length)return null;if("symbol"===e.type&&"string"==typeof e.path){let t=a(e.x)?e.x:e.cx,r=a(e.y)?e.y:e.cy;if(a(t)&&a(r))return{kind:"path",d:e.path,transform:{x:t,y:r,rotation:a(e.rotation)?e.rotation:void 0}}}return"arc"===e.type&&a(e.cx)&&a(e.cy)&&a(e.outerR)&&a(e.startAngle)&&a(e.endAngle)?{kind:"arc",x:e.cx,y:e.cy,width:2*e.outerR,height:2*e.outerR,start:e.startAngle,stop:e.endAngle,closed:!0}:null}function s(e,t=/* @__PURE__ */new WeakSet){if(null==e||"string"==typeof e||"boolean"==typeof e)return e;if("number"==typeof e)return Number.isFinite(e)?e:String(e);if("object"!=typeof e)return String(e);if(t.has(e))return"[Circular]";if(t.add(e),Array.isArray(e))return e.map(e=>s(e,t));let r=e;return Object.fromEntries(Object.keys(r).sort().map(e=>[e,s(r[e],t)]))}function f(e){return JSON.stringify(s(e))??String(e)}function c(e){let r="string"==typeof e?e:f(e);return t(r)%n+1}function p(e){return a(e)&&Math.trunc(Math.abs(e))%n||1}function y(e){let t=e.datum&&"object"==typeof e.datum?e.datum:void 0;return e._transitionKey??e.pointId??e.id??e.category??e.group??t?.id??t?.key??t?.name??null}function u(e){return{fill:"string"==typeof e.fill?e.fill:e.fill?"[CanvasPattern]":void 0,fillOpacity:e.fillOpacity,opacity:e.opacity,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.strokeDasharray,strokeLinecap:e.strokeLinecap}}function h(e){if(!e)return;let t=e.split(/[\s,]+/).map(Number).filter(Number.isFinite);return t.length?t:void 0}function d(e,t){if(t.fill&&"string"!=typeof t.fill||"string"==typeof t.fill&&t.fill.startsWith("url("))return null;let r="string"==typeof t.fill&&"none"!==t.fill?t.fill:void 0,i=t.stroke&&"none"!==t.stroke?t.stroke:void 0;switch(e.type){case"line":case"connector":case"curved":return{stroke:i??"#007bff"};case"bezier":case"ribbon":return{fill:r??"#999999",stroke:i??"none"};case"geoarea":return{fill:r??"#e0e0e0",stroke:i??"none"};case"point":case"circle":case"rect":case"area":case"trapezoid":case"violin":case"arc":return{fill:r??"#4e79a7",stroke:i??"none"};case"symbol":return{fill:r,stroke:i??(r?"none":"#4e79a7")};default:return{fill:r,stroke:i??"#007bff"}}}function g(e,t,r){switch(t.kind){case"rectangle":return e.rectangle(t.x,t.y,t.width,t.height,r);case"circle":return e.circle(t.x,t.y,t.diameter,r);case"line":return e.line(t.x1,t.y1,t.x2,t.y2,r);case"linearPath":return e.linearPath(t.points,r);case"polygon":return e.polygon(t.points,r);case"path":return e.path(t.d,r);case"arc":return e.arc(t.x,t.y,t.width,t.height,t.start,t.stop,t.closed,r)}}function k(e,t,r){e.beginPath();for(let i of t.ops){let t="number"==typeof r&&r>=0?i.data.map(e=>+e.toFixed(r)):i.data;"move"===i.op?e.moveTo(t[0],t[1]):"lineTo"===i.op?e.lineTo(t[0],t[1]):"bcurveTo"===i.op&&e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5])}}function m(e,t){let{drawable:r,geometry:i,style:n}=t,a=r.options,l=e.globalAlpha,o="path"===i.kind?i.transform:void 0;o&&(e.translate(o.x,o.y),o.rotation&&e.rotate(o.rotation));for(let t of r.sets){if(e.save(),"path"===t.type)e.strokeStyle="none"===a.stroke?"transparent":a.stroke,e.lineWidth=a.strokeWidth,e.globalAlpha=l*(n.opacity??1),a.strokeLineDash&&e.setLineDash(a.strokeLineDash),a.strokeLineDashOffset&&(e.lineDashOffset=a.strokeLineDashOffset),k(e,t,a.fixedDecimalPlaceDigits),e.stroke();else if("fillPath"===t.type)e.fillStyle=a.fill??"transparent",e.globalAlpha=l*(n.opacity??1)*(n.fillOpacity??1),k(e,t,a.fixedDecimalPlaceDigits),e.fill("curve"===r.shape||"polygon"===r.shape||"path"===r.shape?"evenodd":"nonzero");else{let r=a.fillWeight<0?a.strokeWidth/2:a.fillWeight;e.strokeStyle=a.fill??"transparent",e.lineWidth=r,e.globalAlpha=l*(n.opacity??1)*(n.fillOpacity??1),a.fillLineDash&&e.setLineDash(a.fillLineDash),a.fillLineDashOffset&&(e.lineDashOffset=a.fillLineDashOffset),k(e,t,a.fixedDecimalPlaceDigits),e.stroke()}e.restore()}}function x(t={}){let n=p(t.seed),l=a(t.cacheSize)?Math.max(1,Math.trunc(t.cacheSize)):1e3,s={roughness:t.roughness,bowing:t.bowing,maxRandomnessOffset:t.maxRandomnessOffset,curveFitting:t.curveFitting,curveTightness:t.curveTightness,curveStepCount:t.curveStepCount,fillStyle:t.fillStyle,fillWeight:t.fillWeight,hachureAngle:t.hachureAngle,hachureGap:t.hachureGap,dashOffset:t.dashOffset,dashGap:t.dashGap,zigzagOffset:t.zigzagOffset,disableMultiStroke:t.disableMultiStroke,disableMultiStrokeFill:t.disableMultiStrokeFill,preserveVertices:t.preserveVertices,simplification:t.simplification,fixedDecimalPlaceDigits:t.fixedDecimalPlaceDigits},k=Object.fromEntries(Object.entries(s).filter(([,e])=>void 0!==e)),x=f({...k,seed:n}),b=r.generator(),v=/* @__PURE__ */new Map;function D(e,t){let r=o(e);return f({backend:"roughjs",identity:y(e),type:e.type,geometry:r,style:u(t),options:x,seed:n})}function O(t,r,i){let a=o(t);if(!a)return null;let s=d(t,r);if(!s)return null;let p=i?{fill:s.fill?e(i,s.fill)||s.fill:void 0,stroke:e(i,s.stroke)||s.stroke}:s,u=`${D(t,r)}:${f(p)}`,m=v.get(u);if(m)return v.delete(u),v.set(u,m),m;let x=c(`${n}:${y(t)??f(a)}`),O={...k,seed:x,fill:p.fill,stroke:p.stroke,strokeWidth:r.strokeWidth??1,strokeLineDash:h(r.strokeDasharray)},S={drawable:g(b,a,O),geometry:a,style:r};for(v.set(u,S);v.size>l;){let e=v.keys().next().value;if(void 0===e)break;v.delete(e)}return S}return{id:"roughjs",seed:n,cacheKey:D,drawCanvas({context:e,node:t,style:r}){let i=O(t,r,e);return!!i&&(m(e,i),!0)},renderStaticSVG({node:e,style:t,key:r}){let n=O(e,t);if(!n)return null;let a="path"===n.geometry.kind?n.geometry.transform:void 0,l=b.toPaths(n.drawable).map((e,n)=>/* @__PURE__ */i("path",{d:e.d,fill:e.fill??"none",fillOpacity:e.fill&&"none"!==e.fill?t.fillOpacity:void 0,stroke:e.stroke,strokeWidth:e.strokeWidth,opacity:t.opacity,strokeLinecap:t.strokeLinecap,strokeDasharray:t.strokeDasharray},`${r}-path-${n}`)),o=a?`translate(${a.x} ${a.y})${a.rotation?` rotate(${180*a.rotation/Math.PI})`:""}`:void 0;/* */
|
|
2
2
|
return i("g",{"data-semiotic-render-backend":"roughjs",transform:o,children:l},r)},clearCache(){v.clear()},get cacheEntries(){return v.size}}}export{x as createRoughRenderMode,c as stableRoughSeed};
|