semiotic 3.8.4 → 3.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +6 -3
- package/README.md +44 -38
- package/ai/componentMetadata.cjs +1 -1
- package/ai/dist/mcp-server.js +4 -2
- package/ai/examples.md +167 -0
- package/ai/schema.json +1004 -1
- package/ai/surface-manifest.json +6 -4
- package/ai/system-prompt.md +1 -1
- package/dist/chunk-chartContainerDataAudit-74TLKIP6.module.min.js +2 -0
- package/dist/{chunk-chunk-LQBSXO7K.module.min.js → chunk-chunk-4AANPFOX.module.min.js} +1 -1
- package/dist/{chunk-chunk-N6VKKF3A.module.min.js → chunk-chunk-5I3UZV4Q.module.min.js} +1 -1
- package/dist/chunk-chunk-74CCPVXB.module.min.js +1 -0
- package/dist/{chunk-chunk-6TPGFL7M.module.min.js → chunk-chunk-BANTPINB.module.min.js} +1 -1
- package/dist/chunk-chunk-CKMD5NV3.module.min.js +2 -0
- package/dist/chunk-chunk-CO5KQMGH.module.min.js +1 -0
- package/dist/{chunk-chunk-BFHUYEOS.module.min.js → chunk-chunk-CWQ5YIHX.module.min.js} +1 -1
- package/dist/chunk-chunk-E6TXX6MI.module.min.js +1 -0
- package/dist/{chunk-chunk-JDXT6ORT.module.min.js → chunk-chunk-I36PJ4OC.module.min.js} +1 -1
- package/dist/chunk-chunk-K3DMEW22.module.min.js +1 -0
- package/dist/chunk-chunk-KT2VAZMZ.module.min.js +1 -0
- package/dist/{chunk-chunk-AQPQN2HH.module.min.js → chunk-chunk-L6EA5V3G.module.min.js} +1 -1
- package/dist/{chunk-chunk-FBGHXL72.module.min.js → chunk-chunk-LJLS6DY7.module.min.js} +1 -1
- package/dist/chunk-chunk-LJPCLYSC.module.min.js +2 -0
- package/dist/{chunk-chunk-7RYBCTK5.module.min.js → chunk-chunk-N5DDKCCF.module.min.js} +1 -1
- package/dist/chunk-chunk-NLO44TOS.module.min.js +2 -0
- package/dist/{chunk-chunk-F5V4UIE6.module.min.js → chunk-chunk-PZJ2SBLL.module.min.js} +1 -1
- package/dist/chunk-chunk-QUJ6TTLY.module.min.js +1 -0
- package/dist/chunk-chunk-RBIDBUT4.module.min.js +2 -0
- package/dist/chunk-chunk-RFLAG356.module.min.js +1 -0
- package/dist/{chunk-chunk-7KZJUTKP.module.min.js → chunk-chunk-RPU4IZAV.module.min.js} +1 -1
- package/dist/{chunk-chunk-PLIDPQNG.module.min.js → chunk-chunk-SKMBCFIL.module.min.js} +1 -1
- package/dist/{chunk-chunk-SR4ZXOWR.module.min.js → chunk-chunk-TAE7W424.module.min.js} +1 -1
- package/dist/{chunk-chunk-KQ546MKE.module.min.js → chunk-chunk-TMWIZL3K.module.min.js} +1 -1
- package/dist/chunk-chunk-TUBMTZMU.module.min.js +2 -0
- package/dist/chunk-chunk-UFFEXJQY.module.min.js +1 -0
- package/dist/chunk-chunk-XSCHTS4D.module.min.js +2 -0
- package/dist/{chunk-chunk-F7WFPD4O.module.min.js → chunk-chunk-XXWSHGPL.module.min.js} +1 -1
- package/dist/chunk-chunk-ZXIXAPRE.module.min.js +2 -0
- package/dist/components/ChartContainer.d.ts +10 -0
- package/dist/components/ai/chartCapabilities.d.ts +2 -1
- package/dist/components/ai/chartCapabilityTypes.d.ts +14 -0
- package/dist/components/chartContainerDataAudit.d.ts +10 -0
- package/dist/components/charts/geo/DistanceCartogram.d.ts +29 -3
- package/dist/components/charts/index.d.ts +1 -0
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +36 -1
- package/dist/components/charts/physics/CrucibleChart.capability.d.ts +8 -0
- package/dist/components/charts/physics/CrucibleChart.d.ts +63 -0
- package/dist/components/charts/physics/crucibleBodyRenderers.d.ts +27 -0
- package/dist/components/charts/physics/crucibleChartProps.d.ts +90 -0
- package/dist/components/charts/physics/crucibleChrome.d.ts +47 -0
- package/dist/components/charts/physics/crucibleController.d.ts +59 -0
- package/dist/components/charts/physics/crucibleEffects.d.ts +30 -0
- package/dist/components/charts/physics/cruciblePhysics.d.ts +54 -0
- package/dist/components/charts/physics/crucibleProgram.d.ts +38 -0
- package/dist/components/charts/physics/crucibleTypes.d.ts +415 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +8 -0
- package/dist/components/charts/shared/crucibleWireSchema.d.ts +5 -0
- package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
- package/dist/components/charts/shared/knownChartComponents.d.ts +1 -1
- package/dist/components/data/auditData.d.ts +51 -0
- package/dist/components/data/dataAuditPresentation.d.ts +18 -0
- package/dist/components/data/dataAuditSources.d.ts +9 -0
- package/dist/components/data/numericContracts.d.ts +59 -0
- package/dist/components/data/numericFieldProfiler.d.ts +23 -0
- package/dist/components/recipes/netEnsembleLayout.d.ts +167 -0
- package/dist/components/recipes/netEnsembleOverlays.d.ts +20 -0
- package/dist/components/recipes/wordTrails.d.ts +156 -0
- package/dist/components/recipes/wordTrailsProgressiveReveal.d.ts +42 -0
- package/dist/components/semiotic-ai-core.d.ts +3 -0
- package/dist/components/semiotic-ai-data-audit.d.ts +4 -0
- package/dist/components/semiotic-ai.d.ts +7 -5
- package/dist/components/semiotic-physics.d.ts +1 -0
- package/dist/components/semiotic-recipes-core.d.ts +4 -0
- package/dist/components/semiotic-utils-core.d.ts +3 -0
- package/dist/components/semiotic.d.ts +1 -1
- package/dist/components/server/renderEvidence.d.ts +27 -0
- package/dist/components/server/serverChartConfigs.d.ts +1 -0
- package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
- package/dist/components/server/staticAnnotations.d.ts +12 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +1 -0
- package/dist/components/stream/GeoSVGOverlay.d.ts +7 -0
- package/dist/components/stream/geoCartogram.d.ts +7 -0
- package/dist/components/stream/geoTypes.d.ts +17 -2
- package/dist/components/stream/networkFrameHandleTypes.d.ts +4 -0
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +8 -0
- package/dist/components/useChartContainerDataAudit.d.ts +7 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics.min.js +1 -1
- package/dist/physics.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai-core.d.ts +3 -0
- 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 +7 -5
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-physics.d.ts +1 -0
- package/dist/semiotic-realtime-core.min.js +1 -1
- package/dist/semiotic-realtime-core.module.min.js +1 -1
- package/dist/semiotic-recipes-core.d.ts +4 -0
- package/dist/semiotic-recipes-core.min.js +1 -1
- package/dist/semiotic-recipes-core.module.min.js +1 -1
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-server-edge.min.js +1 -1
- package/dist/semiotic-server-edge.module.min.js +1 -1
- package/dist/semiotic-server-node.min.js +1 -1
- package/dist/semiotic-server-node.module.min.js +1 -1
- package/dist/semiotic-utils-core.d.ts +3 -0
- package/dist/semiotic-utils-core.min.js +1 -1
- package/dist/semiotic-utils-core.module.min.js +1 -1
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic.d.ts +1 -1
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-chunk-3ILKBVVQ.module.min.js +0 -1
- package/dist/chunk-chunk-ASKSE5F5.module.min.js +0 -1
- package/dist/chunk-chunk-B3DRZPBK.module.min.js +0 -2
- package/dist/chunk-chunk-FP44FHFO.module.min.js +0 -2
- package/dist/chunk-chunk-HKXUAEPJ.module.min.js +0 -2
- package/dist/chunk-chunk-ICEXPNDC.module.min.js +0 -2
- package/dist/chunk-chunk-JMVEIZXP.module.min.js +0 -1
- package/dist/chunk-chunk-KHCOJMGK.module.min.js +0 -1
- package/dist/chunk-chunk-MFHF4J2Z.module.min.js +0 -1
- package/dist/chunk-chunk-NKZ75IM5.module.min.js +0 -2
- package/dist/chunk-chunk-QGZGZI4X.module.min.js +0 -1
- package/dist/chunk-chunk-RP7WTID5.module.min.js +0 -1
- package/dist/chunk-chunk-S7KLNUO6.module.min.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LayoutCache as t,clamp as e,createSafeDatum as n,datumFromFields as o,dimFor as r,forceLayout as i,generateTokens as a,groupBy as s,layoutTokenGrid as c,makeShade as l,normalizeTokenEncoding as u,readField as d,resolveAccessor as h,signatureKey as f,stableGlyphId as m,unwrapDatum as p}from"./chunk-chunk-2CXCXRB4.module.min.js";import{canUseForceWorker as g,runForceLayoutWorker as y,shouldUseForceWorker as x}from"./chunk-chunk-ZOAQDIJO.module.min.js";import{collidersFromPlotBounds as b,collidersFromXScaleBins as w,sedimentHeightfield as M}from"./chunk-chunk-LRIFN2HK.module.min.js";import{mulberry32 as v}from"./chunk-chunk-SIRIJ3DY.module.min.js";import{useCustomLayoutSelection as k}from"./chunk-chunk-C4YA6TDR.module.min.js";import{SYMBOL_SEQUENCE as $,symbolExtent as A,symbolPathString as S}from"./chunk-chunk-5RKXZQ2P.module.min.js";import{isNoteAnnotation as C}from"./chunk-chunk-U66USBWU.module.min.js";var z=t=>{const e=t.config,o=e.rows??10,r=e.columns??10,i=e.gutter??2,a=o*r;if(0>=o||0>=r||0>=a)return{nodes:[]};const{plot:s}=t.dimensions;if(0>=s.width||0>=s.height)return{nodes:[]};const c=(s.width-i*(r-1))/r,l=(s.height-i*(o-1))/o;if(0>=c||0>=l)return{nodes:[]};const u=(null==(d=e.categoryAccessor)?null:"function"==typeof d?d:t=>t[d])??(()=>"_default");var d;const h=function(t){return null==t?null:"function"==typeof t?t:e=>Number(e[t])}(e.valueAccessor)??(()=>1),f=new Map,m=[];for(const e of t.data){const t=u(e)+"",n=Number(h(e)),o=Number.isFinite(n)?Math.max(0,n):0;f.has(t)||m.push(t),f.set(t,(f.get(t)??0)+o)}const p=Array.from(f.values()).reduce((t,e)=>t+e,0);if(0>=p)return{nodes:[]};let g;if(e.categoryOrder&&e.categoryOrder.length>0){const t=new Set,n=[];for(const o of e.categoryOrder)f.has(o)&&!t.has(o)&&(t.add(o),n.push(o));g=[...n,...m.filter(e=>!t.has(e))]}else g=m;if(0===g.length)return{nodes:[]};const y=g.map(t=>({cat:t,exact:(f.get(t)??0)/p*a})).map(t=>({...t,count:Math.floor(t.exact)})),x=y.reduce((t,e)=>t+e.count,0),b=y.map((t,e)=>({i:e,rem:t.exact-t.count})).sort((t,e)=>e.rem-t.rem);for(let t=0;a-x>t;t++)y[b[t%b.length].i].count+=1;const w="string"==typeof e.categoryAccessor?e.categoryAccessor:"category",M="string"==typeof e.valueAccessor?e.valueAccessor:"value",v=(t,e,o)=>n(n=>{n("category",t),n("value",f.get(t)??0),n("share",(f.get(t)??0)/p),"category"!==w&&n(w,t),"value"!==M&&n(M,f.get(t)??0),n("cells",o),n("_waffleCategory",t),n("_waffleIndex",e)}),k=[];let $=0;for(const e of y){const n=t.resolveColor(e.cat);for(let t=0;e.count>t;t++)k.push({type:"rect",x:s.x+$%r*(c+i),y:s.y+(o-1-Math.floor($/r))*(l+i),w:c,h:l,style:{fill:n,stroke:"none"},datum:v(e.cat,$,e.count),group:e.cat,_transitionKey:`waffle-${e.cat}-${t}`}),$++}return{nodes:k}};function N(t,e,n){const o=Math.max(0,Math.floor(n?.minPerCategory??0)),r=t.reduce((t,e)=>t+Math.max(0,e.weight),0);if(0>=e||0>=r)return t.map(t=>({...t,exact:0,cells:0,remainder:0}));const i=t.map(t=>{const n=Math.max(0,t.weight)/r*e;return{...t,exact:n,cells:Math.max(o,Math.floor(n)),remainder:n-Math.floor(n)}});let a=i.reduce((t,e)=>t+e.cells,0);for(;a>e;){const t=i.filter(t=>t.cells>o).sort((t,e)=>e.cells-t.cells||t.remainder-e.remainder||t.key.localeCompare(e.key))[0];if(!t)break;t.cells--,a--}const s=[...i].sort((t,e)=>e.remainder-t.remainder||e.weight-t.weight||t.key.localeCompare(e.key));for(let t=0;e>a;t++)s[t%s.length].cells++,a++;return i}var L="#334155",I="#f8fafc",F="#cbd5e1",W={viewBox:[40,40],anchor:[.5,1],parts:[{d:"M8 3h24v34H8z",fill:"color"},{d:"M12 9h16v5H12zM12 18h16v5H12zM12 27h16v5H12z",fill:"accent"},{d:"M23.8 11.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0M23.8 20.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0M23.8 29.5a1.2 1.2 0 1 0 2.4 0a1.2 1.2 0 1 0-2.4 0",fill:"color"}]},T={viewBox:[40,40],anchor:[.5,.5],parts:[{d:"M10 8h20a2 2 0 0 1 2 2v20a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2V10a2 2 0 0 1 2-2z",fill:"color"},{d:"M15 15h10v10H15z",fill:"accent"},{d:"M7 2v6M14 2v6M21 2v6M28 2v6M7 32v6M14 32v6M21 32v6M28 32v6M2 7h6M2 14h6M2 21h6M2 28h6M32 7h6M32 14h6M32 21h6M32 28h6",fill:"none",stroke:"color",strokeWidth:3}]},E={viewBox:[40,40],anchor:[.5,.5],parts:[{d:"M23 1L7 23h10l-3 16 19-25H22z",fill:"color"}]},j={viewBox:[48,40],anchor:[.5,.78],parts:[{d:"M7 12c0-4 3-7 7-7h20c4 0 7 3 7 7v15H7z",fill:"color"},{d:"M11 15h26v8H11z",fill:"accent",opacity:.9},{d:"M12 27h7v4h-7zM29 27h7v4h-7z",fill:"accent",opacity:.95},{d:"M12 31a4 4 0 1 0 8 0a4 4 0 1 0-8 0M28 31a4 4 0 1 0 8 0a4 4 0 1 0-8 0",fill:"color",stroke:"accent",strokeWidth:1.8},{d:"M5 13h4v8H5zM39 13h4v8h-4z",fill:"color"}]},R="M 9.12,3.34 C 8.28,3.29 7.44,3.40 6.64,3.69 4.17,3.63 1.97,5.37 0.91,7.51 -1.32,11.80 2.55,17.76 8.19,16.55 11.62,16.13 15.55,14.04 16.17,10.33 16.38,6.53 12.77,3.52 9.12,3.34 Z M 9.35,19.86 C 8.89,19.84 8.41,19.92 7.92,20.11 5.12,21.55 3.72,24.68 2.79,27.54 2.32,29.86 0.87,32.04 1.36,34.49 1.63,37.60 8.04,38.95 8.04,38.95 8.04,38.95 14.67,39.65 16.50,36.33 17.16,31.95 16.34,27.23 14.01,23.42 13.07,21.69 11.36,19.92 9.35,19.86 Z",O={viewBox:[18,40],anchor:[.5,1],parts:[{d:R,fill:"color",stroke:"color",strokeWidth:1.4}]},P={server:W,chip:T,bolt:E,bus:j,person:O},D="var(--semiotic-primary, #4e79a7)",B="var(--semiotic-border, #d1d5db)";function H(t){return"object"==typeof t&&null!==t&&"tokens"in t&&"encoding"in t}function Y(t,e,n){return"function"==typeof t?t(e)??n:t??n}function G(t,e){return"function"==typeof t?t(e):t}function q(t){return t.sample??t.value??t.index}var X=new Set($);function V(t,e){return void 0!==e.datum?Y(e.datum,t,null):t.datum??null}function _(t,e){return{fill:!1!==t.highlighted?"scenario"===t.range?Y(e.rangeColor,t,"var(--semiotic-secondary, #9ca3af)"):Y(e.color,t,D):Y(e.inactiveColor,t,B),stroke:"none",...G(e.style,t)??{}}}function K(t,e){const n=G(e.pointId,t)??(e.idPrefix?`${e.idPrefix}-${"scenario"===t.range?"range-":""}${t.index}`:void 0);return{datum:V(t,e),accessibleDatum:G(e.accessibleDatum,t),accessibility:G(e.accessibility,t),pointId:n,_transitionKey:n}}function U({input:t,encoding:e,options:n={}}){if(!H(t)&&!e)throw Error("tokenLayer requires an encoding when input is not a TokenSet.");const o=H(t)?{...t,encoding:u(t.encoding)}:a(t,e),r=function(t,e){const n=e.includeRange&&t.rangeTokens?[...t.tokens,...t.rangeTokens]:t.tokens;if(e.positionToken)return function(t,e){const n=e.positionToken;return n?t.map((e,o)=>{const r=n(e,o,t);return{...e,x:r.x,y:r.y,row:r.row??o,column:r.column??0}}):[]}(n,e);const o=e.layout??t.encoding.layout??"grid";if("quantile-strip"===o)return function(t,e){if(0===t.length)return[];const n=e.x??0,o=e.y??0,r=e.cellHeight??("number"==typeof e.tokenSize?e.tokenSize:12),i=e.gutter??2,a=Math.max(1,Math.floor(e.rows??1)),s=t.map(q),c=Math.min(...s),l=Math.max(...s)-c||1;return t.map((s,u)=>{const d=q(s),h=u%a,f=e.valueToX?e.valueToX(d,s):n+(d-c)/l*(e.width??12*Math.max(1,t.length-1)),m=e.valueToY?e.valueToY(d,s):o+h*(r+i);return{...s,x:f,y:m,row:h,column:u}})}(n,e);if("dotplot"===o)return function(t,e){if(0===t.length)return[];const n=e.x??0,o=e.y??0,r="number"==typeof e.tokenSize?e.tokenSize:12,i=e.gutter??2,a=e.cellWidth??r+i,s=e.cellHeight??r+i,c=t.map(q),l=Math.min(...c),u=Math.max(...c)-l||1,d=new Map;return t.map(r=>{const i=q(r),c=e.valueToX?e.valueToX(i,r):n+(i-l)/u*(e.width??Math.max(1,t.length-1)*a),h=Math.round((c-n)/Math.max(1,a)),f=d.get(h)??0;d.set(h,f+1);const m=e.valueToY?e.valueToY(i,r):o+f*s;return{...r,x:n+h*a,y:m,row:f,column:h}})}(n,e);if("bar-segment"===o){if(!e.valueToX)throw Error('tokenLayer layout "bar-segment" requires valueToX and optionally valueToY.');return function(t,e){if(!e.valueToX)return[];const n=e.y??0,o=e.cellHeight??("number"==typeof e.tokenSize?e.tokenSize:12),r=e.anchor??[.5,.5];return t.map((t,i)=>{const a=Number.isFinite(t.start)?t.start:q(t),s=(a+(Number.isFinite(t.end)?t.end:a+t.value))/2,c=e.valueToY?e.valueToY(s,t):n+r[1]*o;return{...t,x:e.valueToX(s,t),y:c,row:0,column:i}})}(n,e)}if("beeswarm"===o||"small-multiple"===o)throw Error(`tokenLayer layout "${o}" is not implemented yet; use row, column, stack, grid, waffle, dotplot, quantile-strip, bar-segment with valueToX, or positionToken.`);const r="number"==typeof e.tokenSize?e.tokenSize:void 0,i=e.cellWidth??r??12,a=e.cellHeight??r??i,s="row"===o?Math.max(1,n.length):"column"===o||"stack"===o?1:"waffle"===o&&"fixed-denominator"===t.encoding.countStrategy&&100===t.denominator?10:function(t,e,n){if(e.columns)return e.columns;if(e.width&&n>0){const t=e.gutter??2;return Math.max(1,Math.floor((e.width+t)/(n+t)))}return t.length>0?Math.ceil(Math.sqrt(t.length)):1}(n,e,i);return c(n,{...e,columns:s,cellWidth:i,cellHeight:a})}(o,n).filter(t=>!n.include||n.include(t));return{tokenSet:o,positionedTokens:r,nodes:r.map(t=>function(t,e,n){if("dot"===n.tokenType)return function(t,e){const n=Y(e.tokenSize,t,12);return{type:"point",x:t.x,y:t.y,r:Y(e.radius,t,n/2),style:_(t,e),...K(t,e)}}(t,e);const o=G(e.glyph,t)??function(t){if(t)return P[t]}(n.icon);if(o)return function(t,e,n){const o=_(t,n),r=Y(n.tokenSize,t,12);return{type:"glyph",x:t.x,y:t.y,size:r,glyph:e,color:(o.fill??D)+"",accent:Y(n.accent,t,"var(--semiotic-bg, #ffffff)"),fraction:1>t.fraction?t.fraction:void 0,fractionStart:t.startFraction>0?t.startFraction:void 0,fractionDirection:Y(n.fractionDirection,t,"horizontal"),ghostColor:1>t.fraction?G(n.ghostColor,t)??B:void 0,rotation:G(n.rotation,t),style:o,...K(t,n)}}(t,o,e);const r=(i=n.icon)&&X.has(i)?i:void 0;var i;return function(t,e){const n=Y(e.tokenSize,t,12);return{type:"symbol",x:t.x,y:t.y,size:Math.PI*Math.max(1,n/2)**2,symbolType:Y(e.symbolType,t,"circle"),path:G(e.symbolPath,t),rotation:G(e.rotation,t),style:_(t,e),...K(t,e)}}(t,r&&null==e.symbolType?{...e,symbolType:r}:e)}(t,n,o.encoding))}}import{interpolateRgb as Z}from"d3-interpolate";var Q=864e5,J=t=>{const e=t.config,{plot:n}=t.dimensions;if(0>=n.width||0>=n.height)return{nodes:[]};const o=t=>{const n="function"==typeof e.dateAccessor?e.dateAccessor(t):t[e.dateAccessor];return n instanceof Date?n:new Date(n)},r=t=>{const n="function"==typeof e.valueAccessor?e.valueAccessor(t):t[e.valueAccessor];return Number(n)},i=new Map;let a=null;for(const e of t.data){const t=o(e);if(!isFinite(t.getTime()))continue;null==a&&(a=t.getUTCFullYear());const n=tt(t),s=r(e);i.set(n,(i.get(n)??0)+(Number.isFinite(s)?s:0))}const s=e.year??a??(new Date).getUTCFullYear();let c=1/0,l=-1/0;for(const t of i.values())c>t&&(c=t),t>l&&(l=t);c===1/0&&(c=0,l=0);const[u,d]=e.colorRamp??[t.theme.semantic.surface??"#ebedf0",t.theme.semantic.primary??"#216e39"],h=t=>{if(l===c)return u;const e=(t-c)/(l-c);return Z(u,d)(e)},f=e.gutter??2,m=e.labelInset??0,p=Math.min((n.width-m-53*f)/54,(n.height-6*f)/7);if(0>=p)return{nodes:[]};const g=new Date(Date.UTC(s,0,1)),y=g.getUTCDay(),x=new Date(g.getTime()-y*Q),b=[];for(let t=0;54>t;t++)for(let e=0;7>e;e++){const o=new Date(x.getTime()+(7*t+e)*Q);if(o.getUTCFullYear()!==s)continue;const r=tt(o),a=i.get(r),c=null==a?u:h(a);b.push({type:"rect",x:n.x+m+t*(p+f),y:n.y+e*(p+f),w:p,h:p,style:{fill:c,stroke:"none"},datum:{date:o,value:a??0}})}return{nodes:b}};function tt(t){return`${t.getUTCFullYear()}-${et(t.getUTCMonth()+1)}-${et(t.getUTCDate())}`}function et(t){return 10>t?"0"+t:t+""}import{jsx as nt,jsxs as ot}from"react/jsx-runtime";var rt={resource:32,city:64},it=["#739b58","#83a964","#668d52","#8baa68"],at={land:"#78985c",ocean:"#4d8192",forest:"#4f7c4b",grassland:"#8eaa68",cropland:"#a6a568",wetland:"#668f79",urban:"#8d8a72",scrub:"#9b9665",bare:"#aa906a",snow:"#d8ddcf"},st={land:"Open land",ocean:"Open ocean",forest:"Forest",grassland:"Grassland",cropland:"Cropland",wetland:"Wetland",urban:"Urban district",scrub:"Scrubland",bare:"Bare ground",snow:"Snow cover"},ct=new Set(["city","culture","monument","faith","nature","knowledge","defense","arena","transport"]);function lt(t,e){if("function"==typeof t)return t;const n=t??e;return t=>t[n]}function ut(t,e,n){return[111.32*(t-n.lon)*Math.cos((e+n.lat)/2*(Math.PI/180)),110.574*(e-n.lat)]}function dt(t){const e=Math.max(3,Math.round(t??5));return e%2==0?e+1:e}function ht(t){return ct.has(t)?t:"monument"}function ft(t,e){const n=dt(e.gridSize),o=Math.max(1,e.gridRadiusKm??75),r=2*o/n,i=Math.floor(n/2),a=lt(e.idAccessor,"id"),s=lt(e.nameAccessor,"name"),c=lt(e.longitudeAccessor,"lon"),l=lt(e.latitudeAccessor,"lat"),u=lt(e.kindAccessor,"kind"),d=e.candidatePriorityAccessor?lt(e.candidatePriorityAccessor,"priority"):()=>0,h=new Map;let f=null;for(const m of t){const t=Number(c(m)),p=Number(l(m));if(!Number.isFinite(t)||!Number.isFinite(p))continue;const g=(a(m)??`${t},${p}`)+"",y=(s(m)??g)+"",x=ht(u(m)),[b,w]=ut(t,p,e.center);if(Math.abs(b)>o||Math.abs(w)>o)continue;const M=Math.min(n-1,Math.max(0,Math.floor((b+o)/r))),v=Math.min(n-1,Math.max(0,Math.floor((o-w)/r))),k=(M+.5)*r-o,$=o-(v+.5)*r,A={...m,id:g,name:y,kind:x,lon:t,lat:p,distanceKm:Math.sqrt(b*b+w*w),row:v,column:M,cellDistanceSq:(b-k)**2+(w-$)**2,candidatePriority:Number(d(m))||0};(null!=e.centerId&&g===e.centerId||!f&&"city"===x||!f&&v===i&&M===i)&&(f=A);const S=`${v}:${M}`,C=h.get(S)??[];C.push(A),h.set(S,C)}const m=new Map;f&&m.set("city",1);const p=[];for(let t=0;n>t;t++)for(let e=0;n>e;e++){const n=`tile-${t}-${e}`,a=(e+.5)*r-o,s=o-(t+.5)*r;let c,l;if(t===i&&e===i&&f){c=f;const n=(h.get(`${t}:${e}`)??[]).filter(t=>t.id!==f?.id).sort((t,e)=>t.candidatePriority-e.candidatePriority||t.cellDistanceSq-e.cellDistanceSq||t.name.localeCompare(e.name));l=[f,...n]}else{const n=(h.get(`${t}:${e}`)??[]).filter(t=>t.id!==f?.id);n.sort((t,e)=>{const n=t.candidatePriority-e.candidatePriority;if(0!==n)return n;const o=m.get(t.kind)??0,i=m.get(e.kind)??0,a=r*r*.35;return t.cellDistanceSq+o*a-(e.cellDistanceSq+i*a)||t.name.localeCompare(e.name)}),c=n[0]??null,l=n}c&&m.set(c.kind,(m.get(c.kind)??0)+1),p.push({id:n,row:t,column:e,centerXKm:a,centerYKm:s,terrainIndex:Math.abs((17*t+31*e)%it.length),landmark:c,landmarks:l})}return p}var mt=t=>{const e=dt(t.config.gridSize),n=Math.max(20,t.config.tileWidth??80),o=Math.max(10,t.config.tileHeight??40),r=t.config.terrainColors?.length?t.config.terrainColors:it,i=t.dimensions.width/2,a=(t.dimensions.height-e*o)/2+o/2,s=ft(t.points,t.config).map(t=>({...t,x:i+n/2*(t.column-t.row),y:a+(t.column+t.row)*(o/2)}));return{nodes:s.map(e=>{const i=t.config.terrainByCell?.[e.id],a="string"==typeof i?{kind:i}:i,s="city"===e.landmark?.kind?"urban":a?.kind??"land",c=a?.fill??t.config.terrainPalette?.[s]??at[s],l=e.landmark?{...e.landmark,gridRow:e.row,gridColumn:e.column,cellId:e.id,terrainKind:s,terrainCoverage:a?.coverage,features:e.landmarks,featureCount:e.landmarks.length}:{id:e.id,name:st[s],kind:"terrain",terrainKind:s,terrainCoverage:a?.coverage,gridRow:e.row,gridColumn:e.column,cellId:e.id,features:[],featureCount:0};return{type:"geoarea",pathData:(u=e.x,d=e.y,h=n,f=o,`M${u},${d-f/2}L${u+h/2},${d}L${u},${d+f/2}L${u-h/2},${d}Z`),centroid:[e.x,e.y],bounds:[[e.x-n/2,e.y-o/2],[e.x+n/2,e.y+o/2]],screenArea:n*o/2,style:{fill:a||"urban"===s?c:r[e.terrainIndex%r.length],stroke:"ocean"===s?"#315d6c":t.config.tileStroke??"#314934",strokeWidth:1},datum:l,group:e.landmark?.kind??s,interactive:!0};var u,d,h,f}),overlays:nt(pt,{tiles:s,tileWidth:n,tileHeight:o,sprites:t.config.sprites,resourceSize:t.config.resourceSpriteSize??32,citySize:t.config.citySpriteSize??64,showCityLabel:!1!==t.config.showCityLabel}),restyle:(t,e)=>e?.isActive&&t.datum&&"terrain"!==t.datum.kind?{fillOpacity:e.predicate(t.datum)?1:.28}:{fillOpacity:1}}};function pt({tiles:t,tileWidth:e,tileHeight:n,sprites:o,resourceSize:r,citySize:i,showCityLabel:a}){const s=k(),c=t.filter(t=>t.landmark).sort((t,e)=>t.y-e.y||t.x-e.x);return ot("g",{"aria-hidden":"true",pointerEvents:"none",children:[c.map(t=>{const a=t.landmark,c="city"===a.kind?i:r,l=t.y+n/2,u=s.isActive&&!s.predicate(a)?.28:1;return ot("g",{opacity:u,children:[nt("ellipse",{cx:t.x,cy:t.y+.15*n,rx:.28*c,ry:.1*c,fill:"#17251d",opacity:.32}),nt(bt,{kind:a.kind,href:o?.[a.kind],x:t.x-c/2,y:l-c,size:c}),t.landmarks.length>1&&nt(gt,{x:t.x+.3*e,y:t.y-.19*n,count:t.landmarks.length-1,tileHeight:n})]},a.id)}),a&&c.filter(t=>"city"===t.landmark?.kind).map(t=>{const e=t.landmark.name.toUpperCase(),o=Math.max(56,6.4*e.length+14);return ot("g",{transform:`translate(${t.x},${t.y+.72*n})`,children:[nt("rect",{x:-o/2,y:-7,width:o,height:14,rx:1,fill:"#17251d",opacity:.92}),nt("text",{textAnchor:"middle",dominantBaseline:"central",fill:"#f5edcf",fontFamily:"monospace",fontSize:9,fontWeight:700,letterSpacing:.8,children:e})]},t.landmark.id+"-label")})]})}function gt({x:t,y:e,count:n,tileHeight:o}){const r=Math.max(10,Math.min(15,.34*o)),i="+"+n,a=Math.max(r,i.length*r*.58);return ot("g",{transform:`translate(${t},${e})`,children:[nt("rect",{x:-a/2,y:-r/2,width:a,height:r,rx:1,fill:"#17251d",stroke:"#f0d36d",strokeWidth:1}),nt("text",{textAnchor:"middle",dominantBaseline:"central",fill:"#f5edcf",fontFamily:"monospace",fontSize:Math.max(7,.62*r),fontWeight:700,children:i})]})}var yt={city:["..1111..","..1221..",".111111.",".133331.","11111111","13311331","14411441","11111111"],culture:["..1111..",".122221.","11111111",".133331.",".133331.",".133331.","11111111",".444444."],monument:["...11...","..1221..","..1221..","..1331..",".113311.",".133331.","11111111",".444444."],faith:["...11...","...11...","..1111..","...11...","..1221..",".133331.","11111111",".444444."],nature:["...11...","..1221..",".122221.","12222221",".133331.","...11...","..1441..",".144441."],knowledge:[".111111.","12211221","12211221","13311331","13311331","13311331","11111111",".444444."],defense:["11.11.11","11111111","12222221","12211221","13311331","13333331","11111111",".444444."],arena:["..1111..",".122221.","12333321","12344321","12344321","12333321",".122221.","..1111.."],transport:["...11...","..1221..",".122221.","11111111","..1331..","..1331..",".114411.","11444411"]},xt={city:{1:"#29364a",2:"#d8b45b",3:"#b7693c",4:"#6d9fc5"},culture:{1:"#29364a",2:"#d5c9a3",3:"#9c6fb2",4:"#ece3c4"},monument:{1:"#29364a",2:"#d8cba8",3:"#9c8f79",4:"#ece3c4"},faith:{1:"#29364a",2:"#d9c36d",3:"#a877a5",4:"#ece3c4"},nature:{1:"#29364a",2:"#4f8a4e",3:"#79aa56",4:"#79583a"},knowledge:{1:"#29364a",2:"#d5c9a3",3:"#4f7da0",4:"#ece3c4"},defense:{1:"#29364a",2:"#a6a298",3:"#777b7f",4:"#d5c9a3"},arena:{1:"#29364a",2:"#cb8056",3:"#d8cba8",4:"#6d9fc5"},transport:{1:"#29364a",2:"#d8b45b",3:"#6d9fc5",4:"#ece3c4"}};function bt({kind:t,href:e,x:n,y:o,size:r}){if(e)return nt("image",{href:e,x:n,y:o,width:r,height:r,preserveAspectRatio:"xMidYMax meet",style:{imageRendering:"pixelated"}});const i=xt[t];return nt("svg",{x:n,y:o,width:r,height:r,viewBox:"0 0 8 8",shapeRendering:"crispEdges",children:yt[t].flatMap((t,e)=>[...t].map((t,n)=>"."===t?null:nt("rect",{x:n,y:e,width:1,height:1,fill:i[t]},`${e}-${n}`)))})}var wt=t=>{const e=t.config,n=e.nodeWidth??80,o=e.nodeHeight??30,r=e.orientation??"vertical",i=e.edgeCurve??"curved",a=!1!==e.showLabels,s=e.labelAccessor??"id",c="function"==typeof s?s:t=>d(t,s,t.id??"")+"",l=new Map,u=[],h=[],f=t=>{const e=t.data??{};return{x:"number"==typeof e.x?e.x:t.x,y:"number"==typeof e.y?e.y:t.y,w:("number"==typeof e.width?e.width:t.width)??n,h:("number"==typeof e.height?e.height:t.height)??o}};for(const n of t.nodes){const{x:o,y:r,w:i,h:s}=f(n);null!=o&&null!=r&&(l.set(n.id,{x:o,y:r,w:i,h:s}),u.push({type:"rect",x:o-i/2,y:r-s/2,w:i,h:s,style:{fill:e.nodeFill??t.resolveColor(n.id),stroke:`var(--semiotic-surface, ${t.theme.semantic.surface??"#fff"})`,strokeWidth:1.5},datum:n,id:n.id,label:c(n)+""}),a&&h.push({x:o,y:r,text:c(n)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const m=[];for(const e of t.edges){const n="string"==typeof e.target?e.target:e.target.id,o=l.get("string"==typeof e.source?e.source:e.source.id),a=l.get(n);if(!o||!a)continue;const s="vertical"===r?{x:o.x,y:o.y+o.h/2}:{x:o.x+o.w/2,y:o.y},c="vertical"===r?{x:a.x,y:a.y-a.h/2}:{x:a.x-a.w/2,y:a.y};if("line"===i)m.push({type:"line",x1:s.x,y1:s.y,x2:c.x,y2:c.y,style:{stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#999"})`,strokeWidth:1},datum:e});else{const n=(s.y+c.y)/2,o=(s.x+c.x)/2;m.push({type:"curved",pathD:"vertical"===r?`M${s.x},${s.y} C${s.x},${n} ${c.x},${n} ${c.x},${c.y}`:`M${s.x},${s.y} C${o},${s.y} ${o},${c.y} ${c.x},${c.y}`,style:{stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#999"})`,strokeWidth:1,fill:"none"},datum:e})}}return{sceneNodes:u,sceneEdges:m,labels:h}},Mt=t=>{const e=t.config,n=e.nodeWidth??100,o=e.nodeHeight??36,r=e.edgeStyle??"polyline",i=!1!==e.showLabels,a=e.labelAccessor??"label",s="function"==typeof a?a:t=>d(t,a,t.id??"")+"",c=new Map,l=[],u=[],h=t=>{const e=t.data??{};return{x:"number"==typeof e.x?e.x:t.x,y:"number"==typeof e.y?e.y:t.y,w:("number"==typeof e.width?e.width:t.width)??n,h:("number"==typeof e.height?e.height:t.height)??o}};for(const n of t.nodes){const{x:o,y:r,w:a,h:d}=h(n);null!=o&&null!=r&&(c.set(n.id,{x:o,y:r,w:a,h:d}),l.push({type:"rect",x:o-a/2,y:r-d/2,w:a,h:d,style:{fill:e.nodeFill??t.resolveColor(n.id),stroke:`var(--semiotic-border, ${t.theme.semantic.border??"#888"})`,strokeWidth:1.5},datum:n,id:n.id,label:s(n)+""}),i&&u.push({x:o,y:r,text:s(n)+"",anchor:"middle",baseline:"middle",fontSize:11}))}const f=e.edgeStroke??`var(--semiotic-border, ${t.theme.semantic.border??"#666"})`,m=[];for(const e of t.edges){const t="string"==typeof e.target?e.target:e.target.id,n=c.get("string"==typeof e.source?e.source:e.source.id),o=c.get(t);if(!n||!o)continue;const i=e.data??{},a=Array.isArray(i.points)?i.points:e.points;if(a&&a.length>=2)if("smooth"!==r||3>a.length){const t="M"+a.map(t=>`${t.x},${t.y}`).join(" L ");m.push({type:"curved",pathD:t,style:{stroke:f,strokeWidth:1,fill:"none"},datum:e})}else{let t=`M${a[0].x},${a[0].y}`;for(let e=1;a.length-1>e;e++)t+=` Q${a[e].x},${a[e].y} ${(a[e].x+a[e+1].x)/2},${(a[e].y+a[e+1].y)/2}`;const n=a[a.length-1];t+=` T${n.x},${n.y}`,m.push({type:"curved",pathD:t,style:{stroke:f,strokeWidth:1,fill:"none"},datum:e})}else m.push({type:"line",x1:n.x,y1:n.y,x2:o.x,y2:o.y,style:{stroke:f,strokeWidth:1},datum:e})}return{sceneNodes:l,sceneEdges:m,labels:u}};import{jsx as vt,jsxs as kt}from"react/jsx-runtime";var $t={"topic-source":"#1f7a8c","topic-sink":"#b4451f","topic-bridge":"#4b5a82",processor:"#34344a",unknown:"#5a5a6a"},At={internal:"var(--semiotic-border, #6b6b7d)","cross-subtopology":"var(--semiotic-info, #6a8caf)","topic-bridge":"var(--semiotic-secondary, #8b78c4)",back:"var(--semiotic-danger, #e0556b)"};function St(t){return Array.isArray(t)?t.map((t,e)=>"string"==typeof t?{storeName:t,slotIndex:e}:{storeName:(t.storeName??"")+"",slotIndex:t.slotIndex??e}):[]}var Ct=t=>{const e=t.config||{},n=t.dimensions.plot,o=e.layerAccessor??"x",r=e.rowAccessor??"y",i=e.partitionAccessor??"partition",a=e.semanticAccessor??"semantic",s=e.labelAccessor??"label",c=e.storesAccessor??"stores",l=e.backEdgeAccessor??"isBackEdge",u=e.edgeTypeAccessor??"edgeType",h={...$t,...e.partitionColors},f={...At,...e.edgeColors},m=e.accentColor??"var(--semiotic-focus, #ffcc33)",p=e.borderColor??"var(--semiotic-border, #555)",g=e.dimOpacity??.14,y=e.edgeOpacity??.5,x=e.edgeWidth??1.25,b=e.backEdgeWidth??e.edgeWidth??1.5,w=!1!==e.showStoreChips,M=e.storeChipColor??"var(--semiotic-info, #6a8caf)";let v=e.layerCount,k=e.maxLayerSize;if(null==v||null==k){let e=0;const n=new Map;for(const r of t.nodes){const t=Math.round(Number(d(r,o,0)));e=Math.max(e,t),n.set(t,(n.get(t)??0)+1)}v=v??e+1,k=k??Math.max(1,...n.values())}const $=n.width/Math.max(1,v),A=n.height/Math.max(1,k);let S=Math.min(e.nodeWidth??172,Math.max(8,$-(e.minGapX??26))),C=Math.min(e.nodeHeight??54,Math.max(8,A-(e.minGapY??18)));const z=e.lod&&"auto"!==e.lod?e.lod:16>S?"dot":48>S?"icon":108>S?"compact":"full";if("dot"===z){const t=Math.min(S,C,11);S=t,C=t}const N=Math.max(1,n.width-S),L=Math.max(1,n.height-C),I=Math.max(1,k-1),F=t=>n.x+S/2+(v>1?t/(v-1):.5)*N,W=t=>n.y+C/2+(t+I/2)/I*L,T=e.reachableIds?new Set(e.reachableIds):null,E=e.selectedId??null,j=t.selection,R=new Map,O=new Map,P=[],D=[];for(const e of t.nodes){const t=e.id,n=Number(d(e,o,0)),l=Number(d(e,r,0)),u=d(e,i,"processor")+"",f=d(e,a,"processor")+"",y=d(e,s,t)+"",x=St(d(e,c,[])),b=e.data??e,w=F(n),M=W(l);R.set(t,{cx:w,cy:M});const v=T?T.has(t):null,k=j?.isActive?j.predicate(b):null,$=null!==v?!v:null!==k&&!k;O.set(t,$);const A=null!=E&&t===E,N=$&&!A?g:1,L=h[u]??h.unknown;"dot"===z?P.push({type:"circle",cx:w,cy:M,r:S/2,style:{fill:L,opacity:N,stroke:A?m:"transparent",strokeWidth:A?2:0},datum:e,id:t,label:y}):(P.push({type:"rect",x:w-S/2,y:M-C/2,w:S,h:C,style:{fill:L,opacity:N,stroke:A?m:p,strokeWidth:A?3:1},datum:e,id:t,label:y}),D.push({id:t,cx:w,cy:M,partition:u,semantic:f,label:y,stores:x,opacity:N,selected:A,node:b}))}const B=[];for(const e of t.edges){const t="string"==typeof e.source?e.source:e.source.id,n="string"==typeof e.target?e.target:e.target.id,o=R.get(t),r=R.get(n);if(!o||!r)continue;const i=!!d(e,l,!1),a=d(e,u,"internal")+"",s=O.get(t)||O.get(n)?Math.min(y,1.4*g):y,c=i?f.back:f[a]??f.internal;let h;if(i){const t=o.cx,e=o.cy+C/2,n=r.cx,i=r.cy+C/2,a=Math.max(48,.28*Math.abs(t-n))+C;h=`M${t},${e} C${t},${e+a} ${n},${i+a} ${n},${i}`}else{const t=o.cx+S/2,e=o.cy,n=r.cx-S/2,i=r.cy,a=(t+n)/2;h=`M${t},${e} C${a},${e} ${a},${i} ${n},${i}`}const m={type:"curved",pathD:h,style:{stroke:c,strokeWidth:i?b:x,fill:"none",opacity:s,...i?{strokeDasharray:"5 4",strokeLinecap:"round"}:{}},datum:e};B.push(m)}const H=0===D.length?null:vt("g",{className:"lineage-dag-glyphs",children:D.map(t=>function(t,e){const{w:n,h:o,lod:r}=e,i="icon"===r?Math.min(n,o):Math.min(o-14,26),a="icon"===r?0:8+i+8,s=null!=e.renderIcon?e.renderIcon({semantic:t.semantic,partition:t.partition,size:i,color:e.partColors[t.partition]??e.partColors.unknown??"#5a5a6a",node:t.node}):function(t,e,n){const o=e.startsWith("topic")?"T":{source:"SR",sink:"SK",filter:"FL",map:"MP",aggregate:"AG",reduce:"RD","join-this":"JN","join-other":"JN",merge:"MG",suppress:"SP",select:"SE",tostream:"TS"}[t]??"PR";return kt("g",{children:[vt("rect",{width:n,height:n,rx:4,fill:"rgba(255,255,255,0.08)",stroke:"rgba(255,255,255,0.18)"}),vt("text",{x:n/2,y:n/2+.5,textAnchor:"middle",dominantBaseline:"middle",fontSize:.42*n,fontWeight:700,fill:"var(--semiotic-text, #fff)",children:o})]})}(t.semantic,t.partition,i),c="full"===r,l="icon"!==r,u="full"===r&&e.showChips&&t.stores.length>0;return kt("g",{transform:`translate(${t.cx-n/2}, ${t.cy-o/2})`,opacity:t.opacity,style:{pointerEvents:"none"},children:[vt("g",{transform:`translate(${"icon"===r?(n-i)/2:8}, ${(o-i)/2})`,children:s}),l&&vt("foreignObject",{x:a,y:c?o/2-12:o/2-9,width:Math.max(8,n-a-8),height:18,style:{pointerEvents:"none"},children:vt("div",{title:t.label,style:{pointerEvents:"none",fontFamily:"var(--semiotic-font-family, inherit)",fontSize:"full"===r?12.5:11.5,fontWeight:600,color:"var(--semiotic-text, #f4f4f8)",lineHeight:"18px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t.label})}),c&&vt("text",{x:a,y:o/2-16,dominantBaseline:"middle",fontSize:9.5,fontWeight:500,fill:"var(--semiotic-text-secondary, #b9b9c8)",style:{textTransform:"uppercase",letterSpacing:"0.04em"},children:e.typeLabel?e.typeLabel({semantic:t.semantic,partition:t.partition,node:t.node}):t.partition.startsWith("topic")?"topic":t.semantic}),u&&t.stores.map((t,n)=>vt("rect",{x:a+15*n,y:o-10,width:12,height:5,rx:1.5,fill:e.chipColor,children:vt("title",{children:t.storeName})},t.storeName+n))]},t.id)}(t,{w:S,h:C,lod:z,partColors:h,chipColor:M,showChips:w,renderIcon:e.renderIcon,typeLabel:e.typeLabel}))});return{sceneNodes:P,sceneEdges:B,overlays:H}};import{jsx as zt,jsxs as Nt}from"react/jsx-runtime";function Lt(t,e){return t.length>e?t.slice(0,Math.max(1,e-1))+"…":t}var It={rect:"process",round:"process",stadium:"terminal",subroutine:"subprocess",cylinder:"database",circle:"connector",diamond:"decision",hexagon:"preparation",flag:"process"};function Ft(t,e,n,o,r,i,a,s){const c=e-o/2,l=n-r/2,u={fill:i,stroke:a,strokeWidth:s};switch(t){case"diamond":return zt("polygon",{points:`${e},${l} ${e+o/2},${n} ${e},${n+r/2} ${c},${n}`,...u});case"circle":return zt("circle",{cx:e,cy:n,r:Math.min(o,r)/2,...u});case"stadium":case"round":return zt("rect",{x:c,y:l,width:o,height:r,rx:"stadium"===t?r/2:8,ry:"stadium"===t?r/2:8,...u});case"hexagon":{const t=Math.min(.18*o,16);return zt("polygon",{points:`${c+t},${l} ${e+o/2-t},${l} ${e+o/2},${n} ${e+o/2-t},${n+r/2} ${c+t},${n+r/2} ${c},${n}`,...u})}case"cylinder":{const t=Math.min(.16*r,8),e=`M${c},${l+t} a${o/2},${t} 0 0 1 ${o},0`;return Nt("g",{children:[zt("path",{d:`M${c},${l+t} a${o/2},${t} 0 0 0 ${o},0 v${r-2*t} a${o/2},${t} 0 0 1 ${-o},0 z`,...u}),zt("path",{d:e,fill:"none",stroke:a,strokeWidth:s})]})}case"subroutine":{const t=Math.min(8,.08*o);return Nt("g",{children:[zt("rect",{x:c,y:l,width:o,height:r,rx:3,...u}),zt("line",{x1:c+t,y1:l,x2:c+t,y2:l+r,stroke:a,strokeWidth:s}),zt("line",{x1:c+o-t,y1:l,x2:c+o-t,y2:l+r,stroke:a,strokeWidth:s})]})}default:return zt("rect",{x:c,y:l,width:o,height:r,rx:4,...u})}}var Wt=t=>{const e=t.config||{},n=t.dimensions.plot,o=e.direction??"TD",r="LR"===o||"RL"===o,i="BT"===o||"RL"===o,a=e.layerAccessor??"layer",s=e.rowAccessor??"row",c=e.labelAccessor??"label",l=e.shapeAccessor??"shape",u=e.edgeLabelAccessor??"label",h=e.nodeFill??"var(--semiotic-surface, #20242d)",f=e.nodeStroke??"var(--semiotic-border, #5a6573)",m=e.textColor??"var(--semiotic-text, #e6e6e6)",p=e.edgeColor??"var(--semiotic-text-secondary, #9aa0a6)",g=e.accentColor??"var(--semiotic-warning, #d49a00)";if(0===t.nodes.length)return{sceneNodes:[],overlays:null};const y=new Map;let x=0;for(const e of t.nodes){const t=Math.round(Number(d(e,a,0)));x=Math.max(x,t);const n=y.get(t)||[];n.push(e),y.set(t,n)}const b=x+1;let w=1;for(const t of y.values())t.sort((t,e)=>Number(d(t,s,0))-Number(d(e,s,0))),w=Math.max(w,t.length);const M=r?n.width:n.height,v=r?n.height:n.width,k=M/b,$=v/(w+1),A=Math.max(44,Math.min(e.nodeWidth??150,r?k-36:.92*$)),S=Math.max(26,Math.min(e.nodeHeight??46,r?.7*$:.5*k)),C=(r?A:S)/2+6,z=Math.max(1,M-2*C),N=t=>(r?n.x:n.y)+C+(b>1?(i?b-1-t:t)/(b-1)*z:z/2),L=new Map,I=[],F=[];for(const[t,e]of y)e.forEach((o,i)=>{const a=N(t),s=(r?n.y:n.x)+(i+1)/(e.length+1)*v,u=r?a:s,p=r?s:a,y=d(o,l,"rect")+"",x=d(o,c,o.id)+"";L.set(o.id,{cx:u,cy:p,shape:y}),I.push({type:"rect",x:u-A/2,y:p-S/2,w:A,h:S,style:{fill:"transparent",stroke:"transparent"},datum:{id:o.id,name:x,type:It[y]??"process",shape:y},id:o.id,label:x}),F.push(Nt("g",{children:[Ft(y,u,p,A,S,h,"diamond"===y?g:f,1.5),zt("text",{x:u,y:p,textAnchor:"middle",dominantBaseline:"central",fontSize:13,fill:m,style:{pointerEvents:"none"},children:Lt(x,Math.max(4,Math.floor((A-12)/7)))})]},"n-"+o.id))});const W=[];return t.edges.forEach((t,e)=>{const n="string"==typeof t.target?t.target:t.target.id,o=L.get("string"==typeof t.source?t.source:t.source.id),i=L.get(n);if(!o||!i)return;const a=r?o.cx+A/2:o.cx,s=r?o.cy:o.cy+S/2,c=r?i.cx-A/2:i.cx,l=r?i.cy:i.cy-S/2,h=r?`M${a},${s} C${(a+c)/2},${s} ${(a+c)/2},${l} ${c},${l}`:`M${a},${s} C${a},${(s+l)/2} ${c},${(s+l)/2} ${c},${l}`,g=Math.atan2(l-s,c-a),y=c-9*Math.cos(g),x=l-9*Math.sin(g),b=4.5*-Math.sin(g),w=4.5*Math.cos(g),M=`${c},${l} ${y+b},${x+w} ${y-b},${x-w}`,v=d(t,u,void 0),k=(a+c)/2,$=(s+l)/2;W.push(Nt("g",{children:[zt("path",{d:h,fill:"none",stroke:p,strokeWidth:1.4}),zt("polygon",{points:M,fill:p}),"string"==typeof v&&v.length>0&&Nt("g",{children:[zt("rect",{x:k-6.5*v.length/2-4,y:$-9,width:6.5*v.length+8,height:18,rx:3,fill:"var(--semiotic-bg, #11151c)",stroke:f,strokeWidth:.75}),zt("text",{x:k,y:$,textAnchor:"middle",dominantBaseline:"central",fontSize:11,fill:m,style:{pointerEvents:"none"},children:v})]})]},"e-"+e))}),{sceneNodes:I,overlays:Nt("g",{className:"mermaid-dag",children:[W,F]})}};import{jsx as Tt,jsxs as Et}from"react/jsx-runtime";function jt(t){return Tt("rect",{className:t.className,x:t.x,y:t.y,width:Math.max(0,t.width),height:Math.max(0,t.height),rx:t.radius??10,ry:t.radius??10,fill:t.fill??"none",stroke:t.stroke,strokeWidth:t.strokeWidth??1.5,strokeDasharray:t.strokeDasharray,opacity:t.opacity??.6,style:{pointerEvents:"none"}},t.keyId)}function Rt(t,e=0){let n=1/0,o=1/0,r=-1/0,i=-1/0;for(const e of t){const t=e.r??0;n>e.x-t&&(n=e.x-t),e.x+t>r&&(r=e.x+t),o>e.y-t&&(o=e.y-t),e.y+t>i&&(i=e.y+t)}return Number.isFinite(n)?{x:n-e,y:o-e,width:r-n+2*e,height:i-o+2*e}:null}function Ot(t,e=0){if(!t.length)return null;const n="number"==typeof e?e:e.x??0,o="number"==typeof e?e:e.y??0;let r=1/0,i=1/0,a=-1/0,s=-1/0;for(const e of t){if(!Number.isFinite(e.x)||!Number.isFinite(e.y))continue;if(!Number.isFinite(e.width)||!Number.isFinite(e.height))continue;const t=Math.max(0,e.width),n=Math.max(0,e.height);r>e.x&&(r=e.x),i>e.y&&(i=e.y),e.x+t>a&&(a=e.x+t),e.y+n>s&&(s=e.y+n)}return Number.isFinite(r)?{x:r-n,y:i-o,width:a-r+2*n,height:s-i+2*o}:null}function Pt(t){const e=t.fontSize??12;return null!=t.maxWidth&&t.text.length*e*.56>t.maxWidth?null:Tt("text",{className:t.className,x:t.x,y:t.y,textAnchor:t.anchor??"middle",dominantBaseline:t.baseline??"middle",fontSize:e,fontWeight:t.fontWeight,fill:t.color,style:{pointerEvents:"none"},children:t.text},t.keyId)}function Dt(t){const e=t.spacing??8;return{def:Tt("pattern",{id:t.id,width:e,height:e,patternUnits:"userSpaceOnUse",patternTransform:`rotate(${t.angle??45})`,children:Tt("line",{x1:0,y1:0,x2:0,y2:e,stroke:t.color??"currentColor",strokeWidth:t.strokeWidth??1,opacity:t.opacity??.5})},t.id),fill:`url(#${t.id})`}}function Bt(t){const e=t.orient??"bottom",n="bottom"===e||"top"===e,o=t.offset??0,r=t.tickLength??6,i=t.gridLength??0,a=t.labelGap??4,s=t.fontSize??11,c=t.color??"var(--semiotic-text-secondary, #888)",l=t.gridColor??c,u=t.format??(t=>t+""),d="top"===e||"left"===e?-1:1,h=t.ticks.length-1,f=t.ticks.map((f,m)=>{const p=t.scale(f),g=o+d*r,y=o-d*i,x=g+d*a;let b;b=t.labelAnchor?t.labelAnchor:n?t.edgeAnchor&&0===m?"start":t.edgeAnchor&&m===h?"end":"middle":"left"===e?"end":"start";const w=n?"top"===e?"auto":"hanging":"middle",M=n?{x:p,y:x}:{x:x,y:p};return Et("g",{children:[(r>0||i>0)&&Tt("line",{...n?{x1:p,x2:p,y1:g,y2:y}:{x1:g,x2:y,y1:p,y2:p},stroke:i>0?l:c,strokeWidth:1,strokeDasharray:i>0?t.gridDasharray:void 0,opacity:i>0?.7:1}),Tt("text",{x:M.x,y:M.y,textAnchor:b,dominantBaseline:w,fontSize:s,fontWeight:t.fontWeight,fill:c,children:u(f)})]},`tick-${f}-${m}`)});return Tt("g",{className:t.className,style:{pointerEvents:"none"},children:f},t.keyId)}function Ht(t){const e=t.stroke??"var(--semiotic-text, #f4f4f8)",n=t.strokeWidth??1,o=t.markRadius??0,r=t.labelX-t.markX,i=t.labelY-t.markY,a=Math.hypot(r,i)||1,s=t.markX+r/a*o,c=t.markY+i/a*o;let l;return l="elbow"===t.connector?`M${s},${c} L${s},${t.labelY} L${t.labelX},${t.labelY}`:"curve"===t.connector?`M${s},${c} Q${(s+t.labelX)/2},${c} ${t.labelX},${t.labelY}`:`M${s},${c} L${t.labelX},${t.labelY}`,Et("g",{className:t.className,style:{pointerEvents:"none"},children:[o>0&&Tt("circle",{cx:t.markX,cy:t.markY,r:o,fill:"none",stroke:e,strokeWidth:n}),Tt("path",{d:l,fill:"none",stroke:e,strokeWidth:n}),Tt("text",{x:t.labelX,y:t.labelY,textAnchor:t.labelAnchor??"middle",dominantBaseline:t.labelBaseline??"hanging",fontSize:t.fontSize??11,fontWeight:t.fontWeight,fill:t.color??e,children:t.label})]},t.keyId)}import{jsx as Yt,jsxs as Gt}from"react/jsx-runtime";function qt(t,e,n={}){const o=n.fingerprintRounds??3,r=[],i=new Set;for(const e of t)null==e.id||i.has(e.id)||(i.add(e.id),r.push(e.id));const{outAdj:a,inAdj:s,undirected:c}=Zt(r,e),l=Qt(r,a,s,c,o).map(t=>({ids:t.ids,nodeCount:t.nodeCount,edgeCount:t.edgeCount,sinkCount:t.sinkCount,sourceCount:t.sourceCount,directed:t.directed,motif:t.motif,descriptor:Ut(t)})),u=new Map;for(const t of l){const e=u.get(t.motif);e?e.count+=1:u.set(t.motif,{motif:t.motif,descriptor:t.descriptor,count:1,directed:t.directed})}return{components:l,motifs:[...u.values()].sort((t,e)=>e.count-t.count),directedCount:l.filter(t=>t.directed).length,branchingCount:l.filter(t=>!t.directed).length}}function Xt(t){let e=2166136261;for(let n=0;t.length>n;n+=1)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(36)}function Vt(t){return"string"==typeof t?t:t?.id}function _t(t,e,n,o,r){const i=new Set(t);let a=new Map;for(const o of t){let t=0,r=0;for(const t of e.get(o)??[])i.has(t)&&(r+=1);for(const e of n.get(o)??[])i.has(e)&&(t+=1);a.set(o,`${t}:${r}`)}for(let o=0;r>o;o+=1){const o=new Map;for(const r of t){const t=[];for(const n of e.get(r)??[])i.has(n)&&t.push(a.get(n));const s=[];for(const t of n.get(r)??[])i.has(t)&&s.push(a.get(t));t.sort(),s.sort(),o.set(r,Xt(`${a.get(r)}>${t.join(",")}<${s.join(",")}`))}a=o}const s=t.map(t=>a.get(t)).sort();return Xt(`${t.length}#${o}#${s.join(";")}`)}function Kt(t,n,r,i,a,s,c){const{layer:l,layerCount:u}=function(t,e){const n=new Set(t),o=new Map,r=new Set,i=t=>{const a=o.get(t);if(void 0!==a)return a;if(r.has(t))return 0;r.add(t);let s=0;for(const o of e.get(t)??[])n.has(o)&&(s=Math.max(s,1+i(o)));return r.delete(t),o.set(t,s),s};let a=0;for(const e of t)a=Math.max(a,i(e));const s=new Map;for(const e of t)s.set(e,a-o.get(e));return{layer:s,layerCount:a+1}}(t.ids,i),d=Array.from({length:u},()=>[]);for(const e of t.ids)d[l.get(e)].push(e);const h=.14*Math.min(s.width,s.height),f=Math.max(1,s.width-2*h),m=Math.max(1,s.height-2*h),p=new Map,g=new Set(t.ids);for(let t=0;u>t;t+=1){let e=d[t];t>0&&(e=[...e].sort((t,e)=>y(t)-y(e)));const n=e.length,o=s.y+h+(1===u?.5:t/(u-1))*m;e.forEach((t,e)=>{p.set(t,{x:s.x+h+(1===n?.5:e/(n-1))*f,y:o})})}function y(t){let e=0,n=0;for(const o of a.get(t)??[]){const t=p.get(o);g.has(o)&&t&&(e+=t.x,n+=1)}return n>0?e/n:s.x+f/2}const x=d.reduce((t,e)=>Math.max(t,e.length),1),b=e(Math.min(c,f/(2.4*x),m/(2.4*u)),1.4,c),w=t.ids.map(t=>{const e=p.get(t);return{id:t,cx:e.x,cy:e.y,r:b,datum:n.get(t)??o({id:t}),category:r.get(t)??""}}),M=[];for(const e of t.ids){const t=p.get(e);for(const n of i.get(e)??[]){if(!g.has(n))continue;const e=p.get(n);M.push({x1:t.x,y1:t.y,x2:e.x,y2:e.y})}}return{nodes:w,edges:M}}function Ut(t){const{nodeCount:e,edgeCount:n,sinkCount:o,sourceCount:r}=t;return 1===e?"isolate":2===e&&1===n?"pair":1===r&&1===o&&n===e-1?"chain of "+e:t.directed&&1===r&&n>e-1?"diamond / mesh":t.directed?`converging (${e})`:"branching → "+o}function Zt(t,e){const n=new Set(t),o=new Map,r=new Map,i=new Map;for(const e of t)o.set(e,new Set),r.set(e,new Set),i.set(e,new Set);for(const t of e){const e=t.source,a=t.target;n.has(e)&&n.has(a)&&e!==a&&(o.get(e).has(a)||(o.get(e).add(a),r.get(a).add(e),i.get(e).add(a),i.get(a).add(e)))}return{outAdj:o,inAdj:r,undirected:i}}function Qt(t,e,n,o,r){const i=new Set,a=[];for(const s of t){if(i.has(s))continue;const t=[s];i.add(s);const c=[];for(;t.length;){const e=t.pop();c.push(e);for(const n of o.get(e)??[])i.has(n)||(i.add(n),t.push(n))}const l=new Set(c);let u=0,d=0,h=0;for(const t of c){let o=0,r=0;for(const n of e.get(t)??[])l.has(n)&&(o+=1);for(const e of n.get(t)??[])l.has(e)&&(r+=1);h+=o,0===o&&(u+=1),0===r&&(d+=1)}a.push({ids:c,nodeCount:c.length,edgeCount:h,sinkCount:u,sourceCount:d,directed:1===u,motif:_t(c,e,n,h,r)})}return a}var Jt=new t(8),te=t=>{const e=t.config||{},n=t.dimensions.plot;if(!t.nodes.length)return{sceneNodes:[]};const i=e.sourceAccessor??"source",a=e.targetAccessor??"target",s=e.labelAccessor??"label",c=e.categoryAccessor??"category",l=e.nodeRadius??4,u=e.cellGap??16,h=e.bandGap??22,m=e.headerHeight??34,p=e.minCellForFull??38,g=e.maxCellSize??120,y=e.minCellSize??12,x=e.fingerprintRounds??3,b=!1!==e.groupByMotif,w=e.sort??"frequency",M=new Map,v=new Map,k=[];for(const e of t.nodes){const t=e.id;null==t||M.has(t)||(k.push(t),M.set(t,e.data??e),v.set(t,d(e,c,"")+""))}const $=[];for(const e of t.edges){const t=Vt(e.source??d(e,i,void 0)),n=Vt(e.target??d(e,a,void 0));null!=t&&null!=n&&$.push({source:t,target:n})}const{outAdj:A,inAdj:S,undirected:C}=Zt(k,$),z=Qt(k,A,S,C,x),N=new Map;if(b)for(const t of z){const e=N.get(t.motif);e?e.push(t):N.set(t.motif,[t])}else N.set("all",[...z].sort((t,e)=>e.nodeCount-t.nodeCount));const L=[...N.entries()];L.sort((t,e)=>"size"===w?e[1][0].nodeCount-t[1][0].nodeCount:"directedness"===w?Number(e[1][0].directed)-Number(t[1][0].directed):e[1].length-t[1].length);const I=Xt(k.join(",")+"|"+[...A.entries()].map(([t,e])=>t+">"+[...e].sort().join(".")).join(";")),F=f([Math.round(n.x),Math.round(n.y),Math.round(n.width),Math.round(n.height),u,h,m,p,g,y,x,b,w,l,L.map(([t,e])=>t+":"+e.length).join(","),I]),W=Jt.getOrCompute(F,()=>function(t,e){const{plot:n}=e,o=Math.max(40,n.width),{cell:r,cols:i}=(()=>{for(let r=e.maxCellSize;r>=e.minCellSize;r-=2){const i=Math.max(1,Math.floor((o+e.cellGap)/(r+e.cellGap)));let a=0;for(const[,n]of t)a+=e.headerHeight+Math.ceil(n.length/i)*(r+e.cellGap)+e.bandGap;if(n.height>=a)return{cell:r,cols:i}}return{cell:e.minCellSize,cols:Math.max(1,Math.floor((o+e.cellGap)/(e.minCellSize+e.cellGap)))}})(),a=[],s=[];let c=n.y;for(const[l,u]of t){const t=Math.ceil(u.length/i),d=c,h=d+e.headerHeight,f=r>=e.minCellForFull;u.forEach((t,o)=>{const s=n.x+o%i*(r+e.cellGap),c=h+Math.floor(o/i)*(r+e.cellGap);if(f){const n=Kt(t,e.nodeDatum,e.nodeCategory,e.outAdj,e.inAdj,{x:s,y:c,width:r,height:r},e.nodeRadius);a.push({component:t,lod:"full",cx:s+r/2,cy:c+r/2,glyphR:0,nodes:n.nodes,edges:n.edges})}else a.push({component:t,lod:"glyph",cx:s+r/2,cy:c+r/2,glyphR:Math.max(2.5,.36*r),nodes:[],edges:[]})});const m=ee(u[0],e,{x:n.x,y:d+2,width:Math.min(e.headerHeight-6,40),height:e.headerHeight-6});s.push({motif:l,descriptor:Ut(u[0]),count:u.length,directed:u[0].directed,x:n.x,y:d,width:o,height:e.headerHeight+t*(r+e.cellGap),exemplar:m}),c=h+t*(r+e.cellGap)+e.bandGap}return{cells:a,bands:s}}(L,{plot:n,cellGap:u,bandGap:h,headerHeight:m,minCellForFull:p,maxCellSize:g,minCellSize:y,nodeRadius:l,nodeDatum:M,nodeCategory:v,outAdj:A,inAdj:S})),T=t.theme.semantic||{},E=e.convergeColor??T.info??"#4c78a8",j=e.branchColor??T.warning??"#e8853a",R=e.edgeColor??T.border??"#9aa0aa",O=e.colorMode??"directedness",P={predicate:t.selection?.isActive?t.selection.predicate:null,highlight:e.highlight??null,dimOpacity:.14},D=e=>"motif"===O?t.resolveColor(e.motif):"category"===O||e.directed?E:j,B=[],H=[];for(const e of W.cells){const n=e.component,i=D(n);if("full"===e.lod){for(const t of e.edges)H.push({type:"line",x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,style:{stroke:R,strokeWidth:1,opacity:.5},datum:null});for(const n of e.nodes){const e="category"===O&&n.category?t.resolveColor(n.category):i,o={type:"symbol",cx:n.cx,cy:n.cy,size:Math.PI*n.r*n.r,symbolType:"circle",style:{fill:e,opacity:r(n.datum,P)},datum:n.datum,id:n.id,label:d(n.datum,s,n.id)+""};B.push(o)}}else{const t=o({id:`motif-${n.motif}-${e.cx.toFixed(0)}-${e.cy.toFixed(0)}`,motif:n.motif,shape:Ut(n),nodes:n.nodeCount,edges:n.edgeCount,sinks:n.sinkCount,sources:n.sourceCount,directedness:n.directed?"converging":"branching"}),a={type:"symbol",cx:e.cx,cy:e.cy,size:Math.PI*e.glyphR*e.glyphR,symbolType:n.directed?"circle":"diamond",style:{fill:i,opacity:r(t,P),stroke:R,strokeWidth:.75},datum:t,id:t.id+"",label:Ut(n)};B.push(a)}}return{sceneNodes:B,sceneEdges:H,overlays:function(t,e){const n=[];for(const o of t){const t=o.directed?e.convergeColor:e.branchColor;if(n.push(jt({keyId:"band-"+o.motif,x:o.x-6,y:o.y-4,width:o.width+12,height:o.height+4,radius:8,stroke:t,strokeWidth:1,opacity:.28})),e.showExemplars&&o.exemplar){const r=o.exemplar;n.push(Gt("g",{style:{pointerEvents:"none"},children:[r.edges.map((t,n)=>Yt("line",{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:e.edgeColor,strokeWidth:.75,opacity:.55},"exe-"+n)),r.nodes.map(e=>Yt("circle",{cx:e.cx,cy:e.cy,r:Math.max(1.6,e.r),fill:t},"exn-"+e.id))]},"ex-"+o.motif))}if(e.showBandLabels){const t=o.x+(e.showExemplars?48:4);n.push(Yt("text",{x:t,y:o.y+12,fontSize:13,fontWeight:600,fill:e.textColor,style:{pointerEvents:"none"},children:o.descriptor},"bl-"+o.motif)),n.push(Yt("text",{x:t,y:o.y+27,fontSize:11,fill:e.subText,style:{pointerEvents:"none"},children:`×${o.count} · ${o.directed?"converges to 1 sink":"branches to ≥2 sinks"}`},"bc-"+o.motif))}}if(e.showLegend){const t=e.plot.x+e.plot.width-168,i=e.plot.y-2;n.push(Gt("g",{style:{pointerEvents:"none"},children:[Yt("circle",{cx:t,cy:i,r:5,fill:e.convergeColor}),Yt("text",{x:t+10,y:i+4,fontSize:11,fill:e.subText,children:"converges (1 sink)"}),Yt("path",{d:(o=t,r=i+18,`M${o},${r-5} L${o+5},${r} L${o},${r+5} L${o-5},${r} Z`),fill:e.branchColor}),Yt("text",{x:t+10,y:i+22,fontSize:11,fill:e.subText,children:"branches (≥2 sinks)"})]},"net-legend"))}var o,r;return Yt("g",{className:"net-ensemble-overlays",children:n})}(W.bands,{convergeColor:E,branchColor:j,edgeColor:R,plot:n,showBandLabels:!1!==e.showBandLabels,showExemplars:!1!==e.showExemplars,showLegend:!1!==e.showLegend&&"directedness"===O,textColor:T.text??"var(--semiotic-text, #1a1a1a)",subText:T.textSecondary??"var(--semiotic-text-secondary, #888)"})}};function ee(t,e,n){return t?Kt(t,e.nodeDatum,e.nodeCategory,e.outAdj,e.inAdj,n,3):null}import{jsx as ne,jsxs as oe}from"react/jsx-runtime";var re=new t(12);function ie(t){if(null==t)return NaN;if("number"==typeof t)return t;if(t instanceof Date)return t.getTime();const e=t+"",n=Number(e);if(!Number.isNaN(n)&&""!==e.trim())return n;const o=Date.parse(e);return Number.isNaN(o)?NaN:o}function ae(t,e,n){return e>t?e:t>n?n:t}var se=t=>{const e=t.config||{},n=t.dimensions.plot,o=e.columnAccessor??"column",i=e.rowAccessor??"row",a=e.sizeAccessor,c=e.colorAccessor,u=e.symbolAccessor,h=e.shadeAccessor,m=e.markerAccessor,p=e.iconAccessor,g=e.defaultSymbol??"circle",[y,x]=e.sizeRange??[2,8],b=e.shadeStrength??.72,w=e.shadeReverse??!1,M=e.rowMode??"banded",v=e.cellSizing??"proportional",k=e.proportionExponent??1,C=e.columnGap??16,z=e.rowGap??12,N=e.packPadding??1,L=e.iterations??12,I=!1!==e.showEnclosures,F=!1!==e.showColumnHeaders,W=!1!==e.showRowLabels,T=F?e.headerHeight??26:0,E=W?e.labelWidth??66:0,j=e.callouts&&e.callouts.length>0?e.footerHeight??30:0,R=n.x+E,O=n.y+T,P=Math.max(1,n.width-E),D=Math.max(1,n.height-T-j),B=[];for(const e of t.nodes){const t=e.data??e;B.push({id:e.id,col:d(e,o,"—")+"",row:d(e,i,"—")+"",sizeVal:a?Number(d(e,a,1)):1,colorKey:c?d(e,c,"")+"":"",symVal:u?d(e,u,"")+"":"",shadeVal:h?ie(d(e,h,null)):NaN,marker:!!m&&!!d(e,m,!1),iconVal:p?d(e,p,"")+"":"",datum:t,size:0,packR:0,baseShape:"circle",iconShape:null})}if(0===B.length)return{sceneNodes:[]};let H=1/0,Y=-1/0;if(a)for(const t of B)Number.isFinite(t.sizeVal)&&(H>t.sizeVal&&(H=t.sizeVal),t.sizeVal>Y&&(Y=t.sizeVal));e.sizeDomain&&([H,Y]=e.sizeDomain),Number.isFinite(H)&&Number.isFinite(Y)||(H=0,Y=1);const G=t=>{if(H>=Y)return(y+x)/2;const e=Math.sqrt(ae((t-H)/(Y-H),0,1));return y+e*(x-y)};let q=1/0,X=-1/0;if(h)for(const t of B)Number.isFinite(t.shadeVal)&&(q>t.shadeVal&&(q=t.shadeVal),t.shadeVal>X&&(X=t.shadeVal));e.shadeDomain&&([q,X]=e.shadeDomain);const V=t=>{if(!h||!Number.isFinite(t)||q>=X)return.5;const e=ae((t-q)/(X-q),0,1);return w?1-e:e},_=e.colorMap,K=new Map,U=(e,n)=>{let o=K.get(e);if(!o){const n=_&&_[e]||t.resolveColor(e);o=l(n,b),K.set(e,o)}return o(n)},Z=new Map;if(e.symbolMap)for(const[t,n]of Object.entries(e.symbolMap))Z.set(t,n);let Q=0;const J=e.iconMap,tt=t=>p&&J&&J[t]?J[t]:null,et=t=>p?"circle":(t=>{if(!u)return g;let e=Z.get(t);return e||(e=$[Q%$.length],Q++,Z.set(t,e)),e})(t.symVal),nt=e.maxAreaFraction??.4;let ot=0;const rt=Array(B.length),it=Array(B.length);for(let t=0;B.length>t;t++){const e=B[t],n=G(e.sizeVal);rt[t]=n,e.baseShape=et(e),e.iconShape=tt(e.iconVal);const o=A(e.baseShape,Math.PI*n*n);it[t]=o,ot+=Math.PI*o*o}const at=nt*P*D,st=ot>at?Math.sqrt(at/ot):1;for(let t=0;B.length>t;t++){const e=B[t],n=rt[t]*st;e.size=Math.PI*n*n,e.packR=it[t]*st}const ct=new Map,lt=new Map;for(const t of B)ct.set(t.col,(ct.get(t.col)??0)+1),lt.set(t.row,(lt.get(t.row)??0)+1);const ut=e.columnOrder?.filter(t=>ct.has(t))??[...ct.keys()].sort((t,e)=>(ct.get(e)??0)-(ct.get(t)??0)),dt=e.rowOrder?.filter(t=>lt.has(t))??[...lt.keys()].sort((t,e)=>(lt.get(e)??0)-(lt.get(t)??0)),ht=f([Math.round(n.x),Math.round(n.y),Math.round(n.width),Math.round(n.height),T,E,j,M,v,k,C,z,N,L,y,x,H,Y,nt,ut.join(","),dt.join(","),B.length,le(B)]),ft=re.getOrCompute(ht,()=>function(t,e){const n=new Map;for(const e of t){let t=n.get(e.col);t||(t=[],n.set(e.col,t)),t.push(e)}const o=e.columnOrder.filter(t=>n.has(t)),r=Math.max(1,e.innerW-e.columnGap*Math.max(0,o.length-1)),i=e.proportionExponent,a=o.map(t=>Math.pow(n.get(t).length,i)),c=a.reduce((t,e)=>t+e,0)||1,l=t=>"uniform"===e.cellSizing?r/o.length:a[t]/c*r,u=new Map,d=[];let h=e.innerX;for(let t=0;o.length>t;t++)d.push({col:o[t],x:h,w:l(t)}),h+=l(t)+e.columnGap;let f=1;const m=new Map,p=[],g=(t,e,n,o)=>{let r=m.get(t);r||(r={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},m.set(t,r)),r.minX>e-o&&(r.minX=e-o),e+o>r.maxX&&(r.maxX=e+o),r.minY>n-o&&(r.minY=n-o),n+o>r.maxY&&(r.maxY=n+o)},y=(t,n,o,r,i,a)=>{const s=t.map(t=>({id:t.id,r:t.packR})),c=function(t,e,n,o,r,i,a,s){const c=e+o/2,l=n+r/2,u=new Map,d=t.length;if(0===d)return u;if(1===d)return u.set(t[0].id,{px:c,py:l}),u;const h=function(t){let e=t>>>0||1;return()=>(e=Math.imul(e,1664525)+1013904223>>>0,e/4294967296)}(s),f=new Float64Array(d);let m=0;for(let e=0;d>e;e++)f[e]=t[e].r+i,f[e]>m&&(m=f[e]);const p=Math.max(1,Math.round(Math.sqrt(d*o/Math.max(1,r)))),g=new Float64Array(d),y=new Float64Array(d),x=o/p,b=r/Math.ceil(d/p);for(let t=0;d>t;t++){const o=t%p,r=Math.floor(t/p);g[t]=e+(o+.3+.4*h())*x,y[t]=n+(r+.3+.4*h())*b}const w=Math.max(0,Math.min(a,14)),M=Math.max(1,2*m),v=new Map,k=Math.max(1,Math.ceil(o/M)+3),$=(t,e)=>(e+1)*k+(t+1);for(let t=0;w>t;t++){v.clear();for(let t=0;d>t;t++){const o=$(Math.floor((g[t]-e)/M),Math.floor((y[t]-n)/M)),r=v.get(o);r?r.push(t):v.set(o,[t])}for(let t=0;d>t;t++){const o=Math.floor((g[t]-e)/M),r=Math.floor((y[t]-n)/M);for(let e=-1;1>=e;e++)for(let n=-1;1>=n;n++){const i=v.get($(o+e,r+n));if(i)for(let e=0;i.length>e;e++){const n=i[e];if(t>=n)continue;let o=g[n]-g[t],r=y[n]-y[t];const a=f[t]+f[n],s=o*o+r*r;if(a*a>s)if(s>1e-9){const e=Math.sqrt(s),i=(a-e)/2;o/=e,r/=e,g[t]-=o*i,y[t]-=r*i,g[n]+=o*i,y[n]+=r*i}else{const e=2.39996323*t;g[t]+=Math.cos(e)*f[t],y[t]+=Math.sin(e)*f[t]}}}}for(let t=0;d>t;t++){const i=f[t],a=e+i,s=e+o-i,u=n+i,d=n+r-i;g[t]=s>a?ae(g[t],a,s):c,y[t]=d>u?ae(y[t],u,d):l}}for(let e=0;d>e;e++)u.set(t[e].id,{px:g[e],py:y[e]});return u}(s,n,o,r,i,e.packPadding,e.iterations,f++);let l=1/0,d=1/0,h=-1/0,m=-1/0;for(const t of s){const e=c.get(t.id);u.set(t.id,{px:e.px,py:e.py}),g(a,e.px,e.py,t.r),l>e.px-t.r&&(l=e.px-t.r),e.px+t.r>h&&(h=e.px+t.r),d>e.py-t.r&&(d=e.py-t.r),e.py+t.r>m&&(m=e.py+t.r)}return Number.isFinite(l)?{x:l-ce,y:d-ce,w:h-l+2*ce,h:m-d+2*ce}:null};if("banded"===e.rowMode){const r=new Map;for(const e of t)r.set(e.row,(r.get(e.row)??0)+1);const a=e.rowOrder.filter(t=>r.has(t)),c=Math.max(1,e.innerH-e.rowGap*Math.max(0,a.length-1)),l=a.map(t=>Math.pow(r.get(t),i)),h=l.reduce((t,e)=>t+e,0)||1,f=new Map;let p=e.innerY+e.innerH;for(let t=0;a.length>t;t++){const n="uniform"===e.cellSizing?c/a.length:l[t]/h*c,o=p-n;f.set(a[t],{y:o,h:n}),p=o-e.rowGap}o.forEach((t,e)=>{const o=s(n.get(t),t=>t.row);for(const t of a){const n=o.get(t),r=f.get(t);n&&r&&y(n,d[e].x,r.y,d[e].w,r.h,t)}});const g=[],x=new Map;for(const t of a){const e=f.get(t);x.set(t,e.y+e.h/2);const n=m.get(t);n&&Number.isFinite(n.minX)&&g.push({x:n.minX-ce,y:n.minY-ce,w:n.maxX-n.minX+2*ce,h:n.maxY-n.minY+2*ce})}return{positions:u,enclosures:g,colBands:d,rowLabelY:x}}const x=new Map;o.forEach((t,o)=>{const r=s(n.get(t),t=>t.row),a=e.rowOrder.filter(t=>r.has(t)),c=Math.max(1,e.innerH-e.rowGap*Math.max(0,a.length-1)),l=a.map(t=>Math.pow(r.get(t).length,i)),u=l.reduce((t,e)=>t+e,0)||1;let h=e.innerY+e.innerH;a.forEach((t,n)=>{const i="uniform"===e.cellSizing?c/a.length:l[n]/u*c,s=h-i,f=y(r.get(t),d[o].x,s,d[o].w,i,t);if(f){p.push(f);const e=x.get(t)??{sum:0,n:0};e.sum+=f.y+f.h/2,e.n+=1,x.set(t,e)}h=s-e.rowGap})});const b=new Map;for(const[t,e]of x)b.set(t,e.sum/e.n);return{positions:u,enclosures:p,colBands:d,rowLabelY:b}}(B,{columnOrder:ut,rowOrder:dt,innerX:R,innerY:O,innerW:P,innerH:D,rowMode:M,cellSizing:v,proportionExponent:k,columnGap:C,rowGap:z,packPadding:N,iterations:L})),mt=t.selection,pt=mt?.isActive?mt.predicate:null,gt=e.highlight??null,yt=e.dimOpacity??.16,xt=e.markStroke,bt=e.markStrokeWidth??0,wt=e.markerColor??"#ffffff",Mt=e.iconColor??"rgba(255,255,255,0.92)",vt=e.iconStrokeWidth??1,kt=e.iconScale??.72,$t=[],At=[],St=[];for(const t of B){const e=ft.positions.get(t.id);if(!e)continue;const n=r(t.datum,{highlight:gt,predicate:pt,dimOpacity:yt}),o={type:"symbol",cx:e.px,cy:e.py,size:t.size,symbolType:t.baseShape,style:{fill:U(t.colorKey,V(t.shadeVal)),opacity:n,...xt?{stroke:xt,strokeWidth:bt}:{}},datum:t.datum,id:t.id,label:t.id+""};if($t.push(o),t.iconShape){const o=Math.sqrt(t.size/Math.PI)*kt,r=A(t.iconShape,100);St.push({x:e.px,y:e.py,size:r>0?o/r*100*(o/r):Math.PI*o*o,shape:t.iconShape,opacity:n})}t.marker&&n>yt+.001&&At.push({x:e.px,y:e.py,r:Math.max(1,.4*Math.sqrt(t.size/Math.PI))})}const Ct=[];if(e.callouts&&e.callouts.length>0){const t=e.calloutColor??"var(--semiotic-text, #f4f4f8)",o=n.y+n.height-(j>0?.45*j:9),r=[];for(let t=0;e.callouts.length>t;t++){const n=e.callouts[t],o=B.find(t=>t.datum[n.field]+""==n.value+"");if(!o)continue;const i=ft.positions.get(o.id);i&&r.push({c:n,ci:t,px:i.px,py:i.py,markR:Math.sqrt(o.size/Math.PI)})}const i=r.filter(t=>null==t.c.at).sort((t,e)=>t.px-e.px),a=new Map;i.forEach((t,e)=>{a.set(t.ci,R+(e+.5)/i.length*P)});for(const e of r){const r=e.c;let i=a.get(e.ci)??e.px,s=o;const c=r.connector??(a.has(e.ci)?"elbow":"straight");"object"==typeof r.at&&r.at?(i=r.at.x,s=r.at.y):"number"==typeof r.at&&(s=n.y+r.at*n.height),Ct.push({keyId:"callout-"+e.ci,markX:e.px,markY:e.py,labelX:i,labelY:s,label:r.label,connector:c,markRadius:Math.max(e.markR+3,7),stroke:t,color:t,fontSize:11,labelAnchor:"middle",labelBaseline:"auto"})}}const zt=function(t,e){const n=e.columnLabel??(t=>t),o=e.rowLabel??(t=>t);return oe("g",{className:"packed-cluster-matrix-chrome",style:{pointerEvents:"none"},children:[e.showEnclosures&&t.enclosures.map((t,n)=>jt({keyId:"enc-"+n,x:t.x,y:t.y,width:t.w,height:t.h,radius:e.enclosureRadius,stroke:e.enclosureColor,strokeWidth:e.enclosureWidth,opacity:e.enclosureOpacity})),e.iconMarks.length>0&&ne("g",{className:"packed-cluster-matrix-icons",children:e.iconMarks.map((t,n)=>ne("path",{d:S(t.shape,t.size),transform:`translate(${t.x},${t.y})`,fill:"none",stroke:e.iconColor,strokeWidth:e.iconStrokeWidth,opacity:t.opacity},"ic-"+n))}),e.markerDots.length>0&&ne("g",{className:"packed-cluster-matrix-markers",children:e.markerDots.map((t,n)=>ne("circle",{cx:t.x,cy:t.y,r:t.r,fill:e.markerColor},"mk-"+n))}),e.showColumnHeaders&&t.colBands.map((t,o)=>Pt({keyId:"col-"+o,text:n(t.col),x:t.x+t.w/2,y:e.headerY,anchor:"middle",fontSize:e.headerFontSize,fontWeight:700,color:e.headerColor})),e.showRowLabels&&[...t.rowLabelY].map(([t,n])=>Pt({keyId:"row-"+t,text:o(t),x:e.labelX,y:n,anchor:"end",fontSize:e.labelFontSize,fontWeight:600,color:e.labelColor})),e.callouts.map(t=>Ht(t))]})}(ft,{markerDots:At,markerColor:wt,iconMarks:St,iconColor:Mt,iconStrokeWidth:vt,callouts:Ct,plot:n,showEnclosures:I,showColumnHeaders:F,showRowLabels:W,enclosureColor:e.enclosureColor??"var(--semiotic-text, #f4f4f8)",enclosureRadius:e.enclosureRadius??9,enclosureOpacity:e.enclosureOpacity??.5,enclosureWidth:e.enclosureWidth??1.5,headerColor:e.headerColor??"var(--semiotic-text, #f4f4f8)",labelColor:e.labelColor??"var(--semiotic-text-secondary, #b9b9c8)",headerFontSize:e.headerFontSize??13,labelFontSize:e.labelFontSize??11,headerY:n.y+.62*T,labelX:n.x+E-10,columnLabel:e.columnLabel,rowLabel:e.rowLabel});return{sceneNodes:$t,overlays:zt}},ce=4;function le(t){let e=2166136261;const n=t=>{for(let n=0;t.length>n;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619)};for(const o of t)n(o.id),n(o.col),n(o.row),e^=Math.round(8*o.packR),e=Math.imul(e,16777619);return(e>>>0).toString(36)}import*as ue from"react";var de=t=>{const e=t.config,{plot:o}=t.dimensions;if(0>=o.width||0>=o.height)return{nodes:[]};const r=h(e.categoryAccessor),i=h(e.stackBy),a=t=>{const n="function"==typeof e.valueAccessor?e.valueAccessor(t):t[e.valueAccessor],o=Number(n);return Number.isFinite(o)&&o>0?o:0},s=e.gutter??2,c="string"==typeof e.categoryAccessor?e.categoryAccessor:"category",l="string"==typeof e.stackBy?e.stackBy:"stack",u="string"==typeof e.valueAccessor?e.valueAccessor:"value",d=(t,e,o)=>n(n=>{n("category",t),n("stack",e),n("value",o),"category"!==c&&n(c,t),"stack"!==l&&n(l,e),"value"!==u&&n(u,o)}),f=!1!==e.showCategoryLabels,m=Math.max(0,o.height-(e.labelPadding??(f?22:0))),p=[],g=new Map,y=[],x=new Set,b=new Map;for(const e of t.data){const t=r(e)+"",n=i(e)+"",o=a(e);g.has(t)||(p.push(t),g.set(t,0),b.set(t,new Map)),x.has(n)||(x.add(n),y.push(n)),g.set(t,(g.get(t)??0)+o);const s=b.get(t);s.set(n,(s.get(n)??0)+o)}const w=e.categoryOrder?he(e.categoryOrder,p,t=>g.has(t)):p,M=e.stackOrder?he(e.stackOrder,y,()=>!0):y,v=w.reduce((t,e)=>t+(g.get(e)??0),0);if(0>=v)return{nodes:[]};const k=Math.max(0,o.width-s*Math.max(0,w.length-1)),$=[],A=[];let S=o.x;for(const e of w){const n=g.get(e)??0,r=n/v*k;if(0>=r)continue;A.push({cat:e,x:S,w:r});const i=b.get(e);let a=o.y;for(const o of M){const s=i.get(o)??0;if(0>=s)continue;const c=s/n*m;$.push({type:"rect",x:S,y:a,w:r,h:c,style:{fill:t.resolveColor(o),stroke:"none"},datum:d(e,o,s),group:o}),a+=c}S+=r+s}return{nodes:$,overlays:f&&A.length>0?function(t,e,n){const o=t.map((t,o)=>Pt({keyId:"marimekko-label-"+o,text:t.cat,x:t.x+t.w/2,y:e+12,anchor:"middle",baseline:"auto",maxWidth:t.w-4,fontSize:12,color:n}));return ue.createElement(ue.Fragment,null,...o)}(A,o.y+m+4,`var(--semiotic-text, ${t.theme.semantic.text??"currentColor"})`):null}};function he(t,e,n){const o=new Set,r=[];for(const e of t)n(e)&&!o.has(e)&&(o.add(e),r.push(e));for(const t of e)o.has(t)||r.push(t);return r}import*as fe from"react";var me=t=>{const e=t.config,{plot:o}=t.dimensions;if(0>=o.width||0>=o.height||0===t.data.length)return{nodes:[]};const r=e.rowHeight??28,i=e.rowGap??12,a=!1!==e.showLabels,s=a?e.labelWidth??120:0,c=!1!==e.showTicks,l=c?14:0,u=e.tickFormat??(t=>t.toLocaleString()),d=o.x+s,f=Math.max(0,o.width-s);if(0>=f)return{nodes:[]};const m=h(e.categoryAccessor),p=t=>{const e=Number(t);return Number.isFinite(e)&&e>0?e:0},g=t=>p("function"==typeof e.valueAccessor?e.valueAccessor(t):t[e.valueAccessor]),y=t=>p("function"==typeof e.targetAccessor?e.targetAccessor(t):t[e.targetAccessor]),x=t=>{const n="function"==typeof e.rangesAccessor?e.rangesAccessor(t):t[e.rangesAccessor];return Array.isArray(n)?n.map(p).sort((t,e)=>t-e):[]},b="string"==typeof e.categoryAccessor?e.categoryAccessor:"metric",w="string"==typeof e.valueAccessor?e.valueAccessor:"value",M="string"==typeof e.targetAccessor?e.targetAccessor:"target",v=e.actualColor??t.theme.semantic.primary??"#3b6cb1",k=t.theme.semantic.text??"currentColor",$=e.targetColor??`var(--semiotic-text, ${k})`,A=[`var(--semiotic-surface, ${t.theme.semantic.surface??"#e8eaed"})`,`var(--semiotic-grid, ${t.theme.semantic.grid??"#cdd1d6"})`,`var(--semiotic-border, ${t.theme.semantic.border??"#a3a8af"})`],S=`var(--semiotic-text, ${k})`,C=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,z=[],N=[];for(let e=0;t.data.length>e;e++){const a=t.data[e],s=x(a),c=g(a),u=y(a),h=Math.max(c,u,...s.length?s:[0]);if(0>=h)continue;const p=o.y+e*(r+i+l);if(p+r+l>o.y+o.height)break;N.push({yTop:p,label:m(a),actual:c,target:u,maxVal:h});const k=t=>d+t/h*f,S=m(a),C=t=>n(e=>{e("metric",S),"metric"!==b&&e(b,S),t(e)});let L=d;for(let t=0;s.length>t;t++){const e=k(s[t]),n=e-L;n>0&&z.push({type:"rect",x:L,y:p,w:n,h:r,style:{fill:A[Math.min(t,A.length-1)],stroke:"none"},datum:C(e=>{e("range",t),e("rangeValue",s[t]),e("kind","range")}),group:"range-"+t}),L=e}const I=Math.max(6,Math.floor(.45*r));z.push({type:"rect",x:d,y:p+(r-I)/2,w:k(c)-d,h:I,style:{fill:v,stroke:"none"},datum:C(t=>{t("value",c),t("kind","actual"),"value"!==w&&t(w,c)}),group:"actual"});const F=3,W=Math.floor(.8*r);z.push({type:"rect",x:k(u)-F/2,y:p+(r-W)/2,w:F,h:W,style:{fill:$,stroke:"none"},datum:C(t=>{t("target",u),t("kind","target"),"target"!==M&&t(M,u)}),group:"target"})}const L=[];for(let t=0;N.length>t;t++){const e=N[t];if(a&&L.push(Pt({keyId:"bullet-label-"+t,text:e.label,x:o.x+s-8,y:e.yTop+r/2,anchor:"end",baseline:"middle",fontSize:13,fontWeight:500,color:S})),c){const n=5,o=e.yTop+r+2;for(let r=0;n>r;r++){const i=e.maxVal*r/(n-1),a=d+i/e.maxVal*f;L.push(fe.createElement("line",{key:`bullet-tick-${t}-${r}`,x1:a,x2:a,y1:o,y2:o+3,stroke:C,strokeWidth:1}),Pt({keyId:`bullet-ticktext-${t}-${r}`,text:u(i),x:a,y:o+12,anchor:0===r?"start":r===n-1?"end":"middle",baseline:"auto",fontSize:10,color:C}))}}}return{nodes:z,overlays:L.length>0?fe.createElement(fe.Fragment,null,...L):null}};import*as pe from"react";import{scaleLinear as ge}from"d3-scale";var ye=t=>{const e=t.config,{plot:n}=t.dimensions,o=e.fields??[];if(2>o.length||0>=n.width||0>=n.height)return{nodes:[]};if(0===t.data.length)return{nodes:[]};const i={};for(const n of o){if(e.domains?.[n]){i[n]=e.domains[n];continue}let o=1/0,r=-1/0;for(const e of t.data){const t=Number(e[n]);Number.isFinite(t)&&(o>t&&(o=t),t>r&&(r=t))}i[n]=Number.isFinite(o)&&Number.isFinite(r)&&o!==r?[o,r]:[0,1]}const a=!1!==e.showAxes,s=a?e.axisLabelPadding??24:8,c=a?18:8,l=o.map(t=>ge().domain(i[t]).range([n.y+n.height-c,n.y+s])),u=o.map((t,e)=>1===o.length?n.x+n.width/2:n.x+e/(o.length-1)*n.width),d=e.colorBy?"function"==typeof e.colorBy?e.colorBy:t=>(t[e.colorBy]??"")+"":null,h=e.opacity??.45,f=e.strokeWidth??1.25,m=t.theme.semantic.primary??"#3b6cb1",p=e.dimmedOpacity??.08,g=e.highlightFn,y=[],x=[];for(const n of t.data){const i=d?t.resolveColor(d(n)+""):m,a=!g||g(n),s=r(n,{predicate:g,baseOpacity:h,dimOpacity:p,brighten:.4}),c=a?x:y;for(let t=0;o.length-1>t;t++){const e=Number(n[o[t]]),r=Number(n[o[t+1]]);if(!Number.isFinite(e)||!Number.isFinite(r))continue;const d={type:"connector",x1:u[t],y1:l[t](e),x2:u[t+1],y2:l[t+1](r),style:{stroke:i,strokeWidth:g&&a?f+.75:f,opacity:s,fill:"none"},datum:n};c.push(d)}if(e.showPoints)for(let t=0;o.length>t;t++){const e=Number(n[o[t]]);if(!Number.isFinite(e))continue;const r={type:"point",x:u[t],y:l[t](e),r:2.5,style:{fill:i,stroke:"none",opacity:Math.min(1,s+.3)},datum:n};c.push(r)}}let b=null;if(a){const r=`var(--semiotic-border, ${t.theme.semantic.border??"#aaa"})`,a=`var(--semiotic-text, ${t.theme.semantic.text??"currentColor"})`,d=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,h=n.y+s,f=n.y+n.height-c,m=[];for(let t=0;o.length>t;t++){const c=o[t],p=u[t],g=e.tickFormat?.[c]??(t=>t.toLocaleString());m.push(pe.createElement("line",{key:"pc-axis-line-"+t,x1:p,x2:p,y1:h,y2:f,stroke:r,strokeWidth:1})),m.push(Pt({keyId:"pc-axis-label-"+t,text:c,x:p,y:n.y+s-8,anchor:"middle",baseline:"auto",fontSize:12,fontWeight:600,color:a}));const[y,x]=i[c],b=5;for(let e=0;b>e;e++){const n=y+(x-y)*e/(b-1),o=l[t](n);m.push(pe.createElement("line",{key:`pc-tick-${t}-${e}`,x1:p-3,x2:p+3,y1:o,y2:o,stroke:r,strokeWidth:1}),Pt({keyId:`pc-ticktext-${t}-${e}`,text:g(n),x:p+6,y:o+3,anchor:"start",baseline:"auto",fontSize:10,color:d}))}}b=pe.createElement(pe.Fragment,null,...m)}return{nodes:y.concat(x),overlays:b}};import{jsx as xe,jsxs as be}from"react/jsx-runtime";var we=1.75,Me="#222222";function ve(t,e){return t.topRadius+(e-t.height)/t.height*(t.topRadius-t.bottomRadius)}function ke(t,e){return function(t,e,n){return Math.PI*n/3*(t*t+t*e+e*e)}(ve(t,e),t.bottomRadius,e)}function $e(t,e){const n=(t.topRadius+t.bottomRadius)/2,o=Math.PI*n*n;let r=e/o,i=e-ke(t,r),a=0;for(;100>a&&Math.abs(i)>1e-4;)r+=i/o,i=e-ke(t,r),a++;return r}function Ae(t,e){const n=43758.5453*Math.sin(12.9898*t+78.233);return 2*(n-Math.floor(n)-.5)*e}function Se(t,e){if(e>t||2*e>t)return[{x:0,y:0}];const n=[],o=t=>{let r=Math.floor(2*Math.PI*t/(2*e));1>r&&(r=1);const i=0*t,a=Math.hypot(1*t-t*Math.cos(2*Math.PI/r),i-t*Math.sin(2*Math.PI/r));2*e>a&&r>1&&r--;for(let e=0;r>e;e++)n.push({x:t*Math.cos(2*e*Math.PI/r),y:t*Math.sin(2*e*Math.PI/r)});const s=t-2*e;e>s?t>2*e&&n.push({x:0,y:0}):o(s)};return o(t-e),n}function Ce(t,e,n){const o=[];let r=n,i=0;for(;r>0&&60>i;){const n=e*(1+2*i),a=Se(ve(t,n),e),s=a.length-r,c=s>1?a.slice(Math.floor(s/2),Math.floor(s/2)+r):a,l=t.height-n;if(c.forEach((t,e)=>{o.push({x:t.x+Ae(97*i+e,.15),z:l+Ae(31*i+e,.05)})}),r-=c.length,i++,0===c.length)break}return{pearls:o,layers:i}}function ze(t,e,n,o){if(0>=o)return[];const r=function(t,e,n){let o=n,r=0;for(;o>0&&60>r;){const n=ve(t,e+.875*(1+2*r));o-=Math.max(1,Math.floor(2*n/we)),r++}return r}(t,e,o),i=Math.max(e,n-r*we)+.875,a=[];let s=0;for(let e=0;r>e&&o>s;e++){const n=i+we*e,r=ve(t,n),c=Math.max(1,Math.floor(2*r/we)),l=(2*r-c*we)/(c+1),u=-r+l,d=t.height-n-.875-.1;for(let t=0;c>t&&o>s;t++)a.push({cx:u+(l+we)*t+.875,cy:d+.875,rotation:Ae(53*e+t,10)}),s++}return a}function Ne(t,e){const n=Number(t);return Number.isFinite(n)?n:e}var Le=t=>{const e=t.config,{plot:n}=t.dimensions;if(0>=n.width||0>=n.height)return{nodes:[]};const r=h(e.categoryAccessor??"name"),i=h(e.teaVolumeAccessor??"teaVolume"),a=h(e.bobaVolumeAccessor??"bobaVolume"),s=h(e.iceVolumeAccessor??"iceVolume"),c=h(e.cupHeightAccessor??"cupHeight"),l=h(e.cupTopRadiusAccessor??"cupTopRadius"),u=h(e.cupBottomRadiusAccessor??"cupBottomRadius"),d=h(e.bobaRadiusAccessor??"bobaRadius"),f=e.cupWidthRatio??.82,p=t.scales.o,g=p.bandwidth(),y=Math.max(1,n.height-26-8),x=n.y+8,b=[],w=[];for(const e of t.data){const n=r(e)+"",h=p(n);if(null==h)continue;const M={height:Ne(c(e),15.5),topRadius:Ne(l(e),4.75),bottomRadius:Ne(u(e),3.75)},v=Ne(d(e),.6),k=Math.max(0,Ne(i(e),450)),$=Math.max(0,Ne(a(e),110)),A=Math.max(0,Ne(s(e),135)),S=Math.PI*v*v,C=Math.floor($/S),z=C*S,N=Math.floor(A/5.359375),L=N*we*we*we,I=k+z+L,F=$e(M,I),W=Math.min(M.height,Math.max(0,F)),T=ve(M,W),{pearls:E,layers:j}=Ce(M,v,C),R=W,O=ze(M,j*v*2,R,N),P=M.height-20.32,D=Math.min(0,P),B=Math.min(g*f/(2*(M.topRadius+1)),y/(M.height-D)),H=h+g/2,Y=t=>H+t*B,G=t=>x+(t-D)*B,q=Y(-(M.topRadius+1)),X=Y(M.topRadius+1),V=G(D),_=G(M.height),K=o({name:n,teaVolume:k,bobaVolume:Math.round(z),iceVolume:Math.round(L),totalVolume:Math.round(I),numBobas:C,numIce:N,kind:"boba cup"});b.push({type:"rect",x:q,y:V,w:Math.max(1,X-q),h:Math.max(1,_-V),style:{fill:"rgba(0,0,0,0)",stroke:"none"},datum:K,group:n,_transitionKey:"boba-"+m(n)});const U=M.height-R,Z=m(n),Q=t.resolveColor(n);w.push(be("g",{children:[k>0?xe("path",{d:`M${Y(-T)},${G(U)} L${Y(-M.bottomRadius)},${G(M.height)} L${Y(M.bottomRadius)},${G(M.height)} L${Y(T)},${G(U)} z`,fill:"#D2B799"}):null,E.map((t,e)=>xe("circle",{cx:Y(t.x),cy:G(t.z),r:v*B,fill:"#222222",opacity:.5},"p-"+e)),O.map((t,e)=>xe("rect",{x:Y(t.cx)-.95*we*B/2,y:G(t.cy)-.95*we*B/2,width:.95*we*B,height:.95*we*B,rx:2,fill:"#a5f2f3",opacity:.85,transform:`rotate(${t.rotation} ${Y(t.cx)} ${G(t.cy)})`},"i-"+e)),xe("path",{d:`M${Y(-M.topRadius)},${G(0)} L${Y(-M.bottomRadius)},${G(M.height)} L${Y(M.bottomRadius)},${G(M.height)} L${Y(M.topRadius)},${G(0)}`,fill:"none",stroke:Me,strokeWidth:2.5}),xe("line",{x1:Y(-(M.topRadius+1)),y1:G(0),x2:Y(M.topRadius+1),y2:G(0),stroke:Me,strokeWidth:3,strokeLinecap:"round"}),k>0?xe("path",{d:`M${Y(-.635)},${G(P)} L${Y(-.635)},${G(M.height-.4)} L${Y(.635)},${G(M.height-1.27-.4)} L${Y(.635)},${G(P)} z`,fill:"#4F91CB",stroke:Me,strokeWidth:1,opacity:.78}):null,xe("text",{x:H,y:_+16,textAnchor:"middle",fontSize:12,fontWeight:600,fill:"var(--semiotic-text, #333)",children:n}),xe("text",{x:H,y:_+30,textAnchor:"middle",fontSize:10,fill:Q,children:`${C} pearls · ${Math.round(I)} cm³`})]},"boba-"+Z))}return{nodes:b,overlays:xe("g",{className:"semiotic-boba",style:{pointerEvents:"none"},children:w})}},Ie=["naturalGas","coal","nuclear","hydro","wind","solar","other"],Fe={naturalGas:"Natural gas",coal:"Coal",nuclear:"Nuclear",hydro:"Hydro",wind:"Wind",solar:"Solar",other:"Other"},We={tight:5,watch:12,comfortable:20};function Te(t,e=0){return"number"==typeof t&&Number.isFinite(t)?t:e}function Ee(t,e={}){const n=e.fuels??Ie,o=!0===e.includeZero,r=[];for(const e of t)if(e&&"number"==typeof e.t)for(const t of n){const n=Te(e.fuels?.[t]);(o||n>0)&&r.push({t:e.t,fuel:t,fuelLabel:Fe[t],mw:n,ba:e.ba})}return r}function je(t){const e=[];for(const n of t){if(!n||"number"!=typeof n.t)continue;const t=Te(n.demandMw),o=n.forecastMw;"number"==typeof o&&Number.isFinite(o)&&e.push({t:n.t,a:t,b:o,demandMw:t,forecastMw:o,errorMw:t-o,ba:n.ba})}return e}function Re(t){const e=Te(t.demand);if(0>=e)return 0;const n=Te(t.capacityOrNetGen),o=Te(t.interchange);return(n+(0>o?-o:0)-e)/e*100}function Oe(t){return t.filter(t=>t&&"number"==typeof t.t).map(t=>{const e=Te(t.demandMw),n=Te(t.netGenMw),o=Re({demand:e,capacityOrNetGen:n,interchange:t.interchangeMw});return{t:t.t,ba:t.ba,reserveMarginPct:o,netLoadMw:e,demandMw:e,netGenMw:n}})}function Pe(t={},e={}){const{watch:n,comfortable:o}={...We,...t},r=e.field,i=r?{field:r}:{},a=e.tightHatch??{type:"hatch",background:"var(--semiotic-danger, #c2410c)",stroke:"rgba(255, 240, 200, 0.55)",spacing:5,angle:-35,lineWidth:1.25,lineOpacity:.9};return[{id:"reserve-comfortable",label:`Comfortable (≥ ${o}%)`,when:{...i,gte:o},style:{fill:e.comfortableFill??"var(--semiotic-success, #16a34a)",fillOpacity:.85}},{id:"reserve-watch",label:`Watch (< ${o}%, ≥ ${n}%)`,when:{...i,lt:o,gte:n},style:{fill:e.watchFill??"var(--semiotic-warning, #d97706)",fillOpacity:.9}},{id:"reserve-tight",label:`Tight (< ${n}%)`,when:{...i,lt:n},style:{fill:a,stroke:e.tightFill??"var(--semiotic-danger, #c2410c)",strokeWidth:1,fillOpacity:1}}]}function De(t={}){const{tight:e,watch:n,comfortable:o}={...We,...t};return[{type:"band",y0:-50,y1:e,label:"Tight",color:"var(--semiotic-danger, #c2410c)",fillOpacity:.12,emphasis:"secondary"},{type:"band",y0:e,y1:n,label:"Watch",color:"var(--semiotic-warning, #d97706)",fillOpacity:.1,emphasis:"secondary"},{type:"band",y0:n,y1:Math.max(o+30,40),label:"Headroom",color:"var(--semiotic-success, #16a34a)",fillOpacity:.06,emphasis:"secondary"}]}function Be(t,e){if(!t.length)return null;const n=[...t].filter(t=>t&&"number"==typeof t.t).sort((t,e)=>t.t-e.t);if(!n.length)return null;let o=n[n.length-1];if("number"==typeof e&&Number.isFinite(e)){const t=n.filter(t=>e>=t.t);o=t.length?t[t.length-1]:n[0]}const r=Te(o.demandMw),i=Te(o.netGenMw),a="number"==typeof o.forecastMw&&Number.isFinite(o.forecastMw)?o.forecastMw:null,s=Re({demand:r,capacityOrNetGen:i,interchange:o.interchangeMw}),c={};let l=null,u=0,d=0;for(const t of Ie){const e=Te(o.fuels?.[t]);e>0&&(d+=e,c[t]=e,e>u&&(u=e,l=t))}if(d>0)for(const t of Object.keys(c))c[t]=c[t]/d;return{t:o.t,ba:o.ba,demandMw:r,forecastMw:a,forecastErrorMw:null==a?null:r-a,netGenMw:i,reserveMarginPct:s,topFuel:l,topFuelShare:d>0?u/d:0,topFuelMw:u,fuelShares:c}}function He(t,e={}){const n=e.now??Date.now(),o=e.author??"system",r=e.source??"authored-scenario";return t.map(t=>{const e=(t.start+t.end)/2,i=new Date(t.start).toISOString();return{type:"x-band",x0:t.start,x1:t.end,label:t.label,color:"outage"===t.kind?"var(--semiotic-danger)":"var(--semiotic-warning)",fillOpacity:.12,emphasis:"secondary",x:e,y:t.y??t.value,note:t.note,provenance:{author:o,authorKind:"system",source:r,basis:"rule",confidence:.85,createdAt:i,stableId:t.id,dataVersion:t.start+""},lifecycle:{status:"accepted",ttlHint:t.ttlHint??"P14D",anchor:"fixed"},_eventKind:t.kind,_createdAtMs:t.start,_nowMs:n}})}function Ye(t,e=12){return[...t].filter(t=>Number.isFinite(t.reserveMarginPct)).sort((t,e)=>t.reserveMarginPct-e.reserveMarginPct).slice(0,Math.max(0,e))}function Ge(t,e=0){return Number.isFinite(t)?t.toLocaleString(void 0,{maximumFractionDigits:e,minimumFractionDigits:e})+" MW":"—"}function qe(t,e=1){return Number.isFinite(t)?`${t>0?"+":""}${t.toFixed(e)}%`:"—"}import*as Xe from"react";function Ve(t,e){if("function"==typeof t)return t;const n=t??e;return t=>Number(t[n])}function _e(t,e={}){const n=Ve(e.start,"start"),o=Ve(e.end,"end"),r=!1===e.sort?t.slice():t.slice().sort((t,e)=>n(t)-n(e)||o(e)-o(t)),i=[];return{packed:r.map(t=>{const e=n(t);let r=i.findIndex(t=>e>=t);return-1===r&&(r=i.length),i[r]=o(t),{item:t,track:r}}),trackCount:Math.max(1,i.length)}}function Ke(t,e){const n=Ve(e.start,"start"),o=Ve(e.end,"end"),[r,i]=e.domain,a=e.step??1,s="half-open"===e.bounds,c=[];for(let e=r;i>=e;e+=a){let r=0;for(const i of t){const t=n(i),a=o(i);t>e||(s?e>=a:e>a)||r++}c.push({value:e,count:r})}return c}function Ue(t){return"function"==typeof t?t:e=>e[t]}var Ze=t=>{const e=t.config,{plot:n}=t.dimensions;if(0>=n.width||0>=n.height||0===t.data.length||!e?.domain)return{nodes:[]};const o=Ue(e.laneAccessor),r=Ue(e.startAccessor),i=Ue(e.endAccessor),a=e.idAccessor?Ue(e.idAccessor):null,s=e.unit??0,c=e.barGap??1.5,l=Math.max(0,e.minBarWidth??2),u=e.minBarHeight??3.5,d=e.maxBarHeight??10,h=e.lanePadding??7,f=e.cornerRadius??2,m=e.bottomInset??0,p=e.color??((e,n)=>t.resolveColor(n)),[g,y]=e.domain,x=y-g||1,b=t=>n.x+(t-g)/x*n.width,w=t.scales?.o?.domain?.()??[],M=e.lanes??(w.length>0?w:[...new Set(t.data.map(o))]),v=Math.max(0,n.height-m)/Math.max(1,M.length),k=t=>b(r(t)),$=t=>Math.max(k(t)+l,b(i(t)+s)),A=[];M.forEach((e,r)=>{const i=n.y+r*v,s=t.data.filter(t=>o(t)===e);if(0===s.length)return;const{packed:l,trackCount:m}=_e(s,{start:k,end:$}),g=new Map,y=new Map;for(const{item:t,track:e}of l){const n=y.get(e);n?n.push(t):y.set(e,[t])}for(const t of y.values()){t.sort((t,e)=>k(t)-k(e));for(let e=0;t.length-1>e;e++)g.set(t[e],k(t[e+1]))}const x=(v-2*h)/m,b=Math.min(d,Math.max(Math.min(u,x),x-c));for(const{item:t,track:n}of l){const o=k(t),r=g.get(t),s=$(t)-o;A.push({type:"rect",x:o,y:i+h+n*x,w:void 0!==r&&o+s>r-1?Math.max(1,r-1-o):s,h:b,cornerRadii:f>0?{tl:f,tr:f,br:f,bl:f}:void 0,style:{fill:p(t,e),stroke:"none"},datum:t,group:e,_transitionKey:a?a(t)+"":void 0})}});const S=`var(--semiotic-text, ${t.theme.semantic.text??"#1a1a1a"})`,C=`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,z=`var(--semiotic-border, ${t.theme.semantic.border??"#94a3b8"})`,N=[];(e.periods??[]).forEach((t,e)=>{const o=b(t.start),r=Math.max(1,b(t.end+s)-o);N.push(Xe.createElement("rect",{key:"period-"+e,x:o,y:n.y,width:r,height:n.height,fill:z,opacity:e%2==0?.06:.025,pointerEvents:"none"})),t.name&&N.push(Pt({keyId:"period-label-"+e,text:t.name,x:o+4,y:n.y+12,anchor:"start",baseline:"hanging",fontSize:13,fontWeight:700,color:C}))});const L=!1!==e.showLaneLabels,I=e.laneLabelGap??12;if(M.forEach((t,e)=>{const o=n.y+e*v;N.push(Xe.createElement("line",{key:"lane-sep-"+e,x1:n.x,x2:n.x+n.width,y1:o,y2:o,stroke:z,opacity:.45})),L&&N.push(Pt({keyId:"lane-label-"+e,text:t,x:n.x-I,y:o+v/2,anchor:"end",baseline:"middle",fontSize:12,fontWeight:600,color:S}))}),!1!==e.showAxis){const t=e.axisTicks??Array.from({length:8},(t,e)=>Math.round(g+e/7*x));N.push(Bt({keyId:"interval-axis",scale:b,ticks:t,orient:"top",offset:n.y,tickLength:0,gridLength:n.height,gridDasharray:"3 5",edgeAnchor:!0,format:e.tickFormat,color:C}))}return{nodes:A,overlays:Xe.createElement(Xe.Fragment,null,...N)}};function Qe(t,e,n){const o=n?.orientation??"vertical",r=n?.bend??0,i=n?.minAlong??18,a=(t,e)=>(t+e)/2;if("vertical"===o){if(i>Math.abs(e.y-t.y)){const n=t.x>e.x?-1:1,o=a(t.x,e.x)+n*(22+Math.abs(r));return`M${t.x},${t.y} Q${o},${a(t.y,e.y)} ${e.x},${e.y}`}const n=a(t.y,e.y)+r;return`M${t.x},${t.y} C${t.x},${n} ${e.x},${n} ${e.x},${e.y}`}if(i>Math.abs(e.x-t.x)){const n=t.y>e.y?-1:1,o=a(t.y,e.y)+n*(22+Math.abs(r));return`M${t.x},${t.y} Q${a(t.x,e.x)},${o} ${e.x},${e.y}`}const s=a(t.x,e.x)+r;return`M${t.x},${t.y} C${s},${t.y} ${s},${e.y} ${e.x},${e.y}`}function Je(t,e,n){if("vertical"===(n?.orientation??"vertical")){const n=(t.y+e.y)/2;return`M${t.x},${t.y} L${t.x},${n} L${e.x},${n} L${e.x},${e.y}`}const o=(t.x+e.x)/2;return`M${t.x},${t.y} L${o},${t.y} L${o},${e.y} L${e.x},${e.y}`}function tn(t,e,n){if("vertical"===(n?.orientation??"vertical")){const n=e.cy>=t.cy;return{from:{x:t.cx,y:t.cy+(n?t.height/2:-t.height/2)},to:{x:e.cx,y:e.cy+(n?-e.height/2:e.height/2)}}}const o=e.cx>=t.cx;return{from:{x:t.cx+(o?t.width/2:-t.width/2),y:t.cy},to:{x:e.cx+(o?-e.width/2:e.width/2),y:e.cy}}}function en(t,e){const n=e?.spread??5;return e?.modulo&&e.modulo>0?(t%e.modulo-(e.modulo-1)/2)*n:(t-((e?.count??1)-1)/2)*n}function nn(t,e){const n=1-e,o=n*n*n,r=3*n*n*e,i=3*n*e*e,a=e*e*e;return{x:o*t.p0.x+r*t.p1.x+i*t.p2.x+a*t.p3.x,y:o*t.p0.y+r*t.p1.y+i*t.p2.y+a*t.p3.y}}function on(t,e){const n=1-e,o=3*n*n,r=6*n*e,i=3*e*e;return{x:o*(t.p1.x-t.p0.x)+r*(t.p2.x-t.p1.x)+i*(t.p3.x-t.p2.x),y:o*(t.p1.y-t.p0.y)+r*(t.p2.y-t.p1.y)+i*(t.p3.y-t.p2.y)}}function rn(t){return`M${t.p0.x},${t.p0.y} C${t.p1.x},${t.p1.y} ${t.p2.x},${t.p2.y} ${t.p3.x},${t.p3.y}`}function an(t,e){const n=e?.axis??"x",o=e?.padding??0,r=e?.strength??.5,i="x"===n?"y":"x",a="x"===n?"width":"height",s="x"===n?"height":"width",c=new Map;for(const e of t)c.set(e.id,0);for(let e=0;t.length>e;e++)for(let l=e+1;t.length>l;l++){const u=t[e],d=t[l];if(Math.abs(u[i]-d[i])>(u[s]+d[s])/2+o)continue;const h=d[n]-u[n]||(d.id>u.id?-.5:.5),f=(u[a]+d[a])/2+o-Math.abs(h);if(0>=f)continue;const m=f*r*Math.sign(h);c.set(u.id,(c.get(u.id)??0)-m),c.set(d.id,(c.get(d.id)??0)+m)}return c}var sn={width:60,height:34};function cn(t,e){if("function"==typeof t)return t;const n=t??e;return t=>d(t,n,void 0)}function ln(t,e,n,o){const r=o.fixedAxis??"y",i=t=>cn(o.sourceAccessor,"source")(t)+"",a=t=>cn(o.targetAccessor,"target")(t)+"",s=o.size??(()=>sn),c=o.iterations??180,l=o.attraction??.012,u=o.anchorStrength??.003,d=o.collisionStrength??.12,h=o.collisionPadding??15,f=o.edgePadding??42,m=o.fixedPadding??16,g=o.damping??.72,y=o.spread??1,[x,b]=o.fixedDomain,w=b-x||1,M=("y"===r?n.y:n.x)+m,v=("y"===r?n.y+n.height:n.x+n.width)-m,k=("y"===r?n.x:n.y)+f,$=("y"===r?n.x+n.width:n.y+n.height)-f,A=Math.max(1,$-k),S=t.map(t=>{const e=p(t)??t,n=(r=t,cn(o.idAccessor,"id")(r)+"");var r;const{width:i,height:a}=s(e),c=(t=>Number(cn(o.fixedAccessor,"fixed")(t)))(t),l=k+function(t){let e=2166136261;for(let n=0;t.length>n;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0)/4294967295}(n)*A;return{data:e,id:n,width:i,height:a,fixedValue:c,fixed:(u=c,M+(u-x)/w*(v-M)),free:l,anchor:l};var u}),C=new Map(S.map(t=>[t.id,t])),z=t=>"y"===r?t.width:t.height;for(let t=0;c>t;t++){const t=new Map;for(const e of S)t.set(e.id,0);for(const n of e){const e=C.get(i(n)),o=C.get(a(n));if(!e||!o)continue;const r=(o.free-e.free)*l;t.set(e.id,(t.get(e.id)??0)+r),t.set(o.id,(t.get(o.id)??0)-r)}for(const e of S)t.set(e.id,(t.get(e.id)??0)+(e.anchor-e.free)*u);const n=an(S.map(t=>({id:t.id,x:"y"===r?t.free:t.fixed,y:"y"===r?t.fixed:t.free,width:t.width,height:t.height})),{axis:"y"===r?"x":"y",padding:h,strength:d});for(const e of S)t.set(e.id,(t.get(e.id)??0)+(n.get(e.id)??0));for(const e of S){e.free+=(t.get(e.id)??0)*g;const n=z(e)/2;e.free=Math.max(k+n,Math.min($-n,e.free))}}if(1!==y){const t=(k+$)/2;for(const e of S){const n=z(e)/2;e.free=Math.max(k+n,Math.min($-n,t+(e.free-t)*y))}}const N=S.map(t=>({data:t.data,id:t.id,x:"y"===r?t.free:t.fixed,y:"y"===r?t.fixed:t.free,width:t.width,height:t.height,fixedValue:t.fixedValue}));return{positioned:N,byId:new Map(N.map(t=>[t.id,t]))}}var un=t=>{const{plot:e}=t.dimensions;if(0>=e.width||0>=e.height||0===t.nodes.length||!t.config?.fixedDomain)return{sceneNodes:[]};const n=t.config.fixedAxis??"y",{positioned:o,byId:r}=ln(t.nodes,t.edges,e,t.config),i=o.map(e=>({type:"rect",x:e.x-e.width/2,y:e.y-e.height/2,w:e.width,h:e.height,style:{fill:t.resolveColor(e.id),stroke:"none"},datum:e.data,id:e.id,label:e.id})),a=[];t.edges.forEach((e,o)=>{const i=r.get((s=e,("function"==typeof t.config.sourceAccessor?t.config.sourceAccessor(s):d(s,t.config.sourceAccessor??"source",void 0))+""));var s;const c=r.get((e=>("function"==typeof t.config.targetAccessor?t.config.targetAccessor(e):d(e,t.config.targetAccessor??"target",void 0))+"")(e));if(!i||!c)return;const{from:l,to:u}=tn({cx:i.x,cy:i.y,width:i.width,height:i.height},{cx:c.x,cy:c.y,width:c.width,height:c.height},{orientation:"y"===n?"vertical":"horizontal"});a.push({type:"curved",pathD:Qe(l,u,{orientation:"y"===n?"vertical":"horizontal",bend:en(o,{modulo:5,spread:5})}),style:{stroke:"var(--semiotic-border, #888)",fill:"none",strokeWidth:1.4},datum:p(e)??e})});const s=o.map(t=>({x:t.x,y:t.y,text:t.id}));return{sceneNodes:i,sceneEdges:a,labels:s}};function dn(t){const n=Number(t.segmentDomain?.[0]),o=Number(t.segmentDomain?.[1]),r=Number.isFinite(n)?n:0,i=Number.isFinite(o)?o:r,a=r>i?-1:1,s=Math.abs(i-r),c=Number(t.currentSegment),l=Number.isFinite(c)?e((c-r)*a,0,s):0,u=(t,n)=>{const o=Number(t);return Number.isFinite(o)?e(o,0,1):n},d=u(t.oldestOpacity,.25),h=u(t.currentOpacity,1),f=u(t.futureOpacity,0);return{weightOpacity:!0===t.combineWeightOpacity,wordOpacity:({segment:t})=>{const n=Number(t);if(!Number.isFinite(n))return f;const o=(n-r)*a;if(o>l)return f;if(0===l)return h;const i=e(o/l,0,1);return d+(h-d)*i}}}import{jsx as hn,jsxs as fn}from"react/jsx-runtime";function mn(t){let e=2166136261;for(let n=0;t.length>n;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0)/4294967295}var pn=1.15,gn={a:.556,b:.556,c:.5,d:.556,e:.556,f:.278,g:.556,h:.556,i:.222,j:.222,k:.5,l:.222,m:.833,n:.556,o:.556,p:.556,q:.556,r:.333,s:.5,t:.278,u:.556,v:.5,w:.722,x:.5,y:.5,z:.5,"'":.191,"-":.333,".":.278," ":.278};function yn(t){let e=0;for(const n of t)e+=gn[n]??.6;return e}function xn(t,e){return Math.max(8,yn(t)*e*1.05+1)}function bn(t,e,n){for(const o of e)if((t.w+o.w)/2+n>Math.abs(t.x-o.x)&&(t.h+o.h)/2+n>Math.abs(t.y-o.y))return!0;return!1}var wn=t=>{const o=t.config,{plot:r}=t.dimensions;if(0>=r.width||0>=r.height||0===t.data.length)return{nodes:[]};const i=h(o.textAccessor),a=t=>{const e=Number(h(o.weightAccessor)(t));return Number.isFinite(e)&&e>0?e:0},s=h(o.columnAccessor),c=t=>Number(h(o.segmentAccessor)(t)),l=o.minFontSize??11,u=o.maxFontSize??42,d=o.columnGutter??18,f=o.collisionPadding??2,m=!1!==o.showColumnLabels,p=!1!==o.showSegmentAxis,g=o.segmentTickCount??6,y=o.segmentTickFormat??(t=>Math.round(t)+""),x=o.rotate??0,b=!0===o.repeatWords,w=!1!==o.scaleToFit,M=o.packingDensity??.6,v="string"==typeof o.textAccessor?o.textAccessor:"word",k="string"==typeof o.weightAccessor?o.weightAccessor:"weight",$="string"==typeof o.columnAccessor?o.columnAccessor:"column",A="string"==typeof o.segmentAccessor?o.segmentAccessor:"segment",S=[],C=new Map;let z=1/0,N=-1/0;for(let e=0;t.data.length>e;e++){const n=t.data[e],o=s(n)+"",r=i(n)+"",l=a(n),u=c(n);r&&Number.isFinite(u)&&(C.has(o)||(S.push(o),C.set(o,[])),C.get(o).push({col:o,text:r,weight:l,segment:u,datum:n,dataIndex:e}),z>u&&(z=u),u>N&&(N=u))}if(0===S.length)return{nodes:[]};if(!b)for(const[t,e]of C){const n=new Map;for(const t of e){const e=n.get(t.text);e&&e.weight>=t.weight||n.set(t.text,t)}C.set(t,[...n.values()])}let L=1/0,I=-1/0;for(const t of C.values())for(const e of t)L>e.weight&&(L=e.weight),e.weight>I&&(I=e.weight);if(!Number.isFinite(L))return{nodes:[]};const F=o.columnOrder?[...o.columnOrder.filter(t=>C.has(t)),...S.filter(t=>!o.columnOrder.includes(t))]:S,W=new Map(F.map(e=>[e,o.columnColor?.(e)||t.resolveColor(e)])),[T,E]=o.segmentDomain??[z,N],j=E-T||1,R=I-L||1,O=m?22:0,P=p?52:0,D=r.x+P,B=r.y+O,H=Math.max(0,r.width-P),Y=Math.max(0,r.height-O),G=F.length,q=G>0?Math.max(0,H-d*Math.max(0,G-1))/G:0,X=B+14,V=B+Y-14,_=t=>X+(t-T)/j*(V-X),K=q*Y;let U=1/0,Z=1/0;const Q=F.map((t,n)=>{const r=W.get(t),i=(C.get(t)??[]).map(t=>{const i={word:t.text,column:t.col,weight:t.weight,segment:t.segment,datum:t.datum,dataIndex:t.dataIndex,columnIndex:n,resolvedColumnColor:r},a=o.wordOpacity?Number(o.wordOpacity(i)):1,s=o.wordColor?.(i);return{text:t.text,weight:t.weight,segment:t.segment,baseFont:(c=t.weight,l+Math.sqrt((c-L)/R)*(u-l)),opacity:Number.isFinite(a)?e(a,0,1):0,color:s||r,info:i};var c});if(0===i.length)return null;let a=0;for(const t of i){const e=1.05*yn(t.text);a+=e*pn*t.baseFont*t.baseFont,Z=Math.min(Z,(q-8-1)/(e*t.baseFont))}return a>0&&(U=Math.min(U,Math.sqrt(M*K/a))),{col:t,colLeft:D+n*(q+d),center:D+n*(q+d)+q/2,rows:i}}).filter(t=>null!==t),J=t=>{const o=[];let r=0;for(const i of Q){if(0>=q)continue;const a=i.colLeft+4,s=i.colLeft+q-4,c=i.rows.map((e,n)=>{const o=Math.max(5,t*e.baseFont),r=`${i.col}::${e.text}::${n}`;return{id:r,text:e.text,weight:e.weight,segment:e.segment,font:o,w:xn(e.text,o),h:o*pn+2,anchorY:_(e.segment),seed:(mn(r)-.5)*Math.min(.5*q,80),opacity:e.opacity,color:e.color,info:e.info}}).sort((t,e)=>e.font-t.font||(e.id>t.id?-1:1)),l=[];for(const t of c){const c=t.w/2,u=t.h/2,d=e(i.center+t.seed,a+c,s-c),h=t.anchorY;let m=d,p=e(h,X+u,V-u),g=!1;for(let n=0;2600>n;n++){const o=3.2*Math.sqrt(n),r=2.399963229728653*n,i={x:e(d+o*Math.cos(r),a+c,s-c),y:e(h+o*Math.sin(r),X+u,V-u),w:t.w,h:t.h};if(!bn(i,l,f)){m=i.x,p=i.y,g=!0;break}}g||r++,l.push({x:m,y:p,w:t.w,h:t.h});const y=Math.sqrt((t.weight-L)/R),b=x>0?2*(mn(t.id+"r")-.5)*x:0;o.push({id:t.id,text:t.text,x:m,y:p,fontSize:t.font,rotation:b,color:t.color,opacity:t.opacity,datum:n(e=>{for(const n of Object.keys(t.info.datum))e(n,t.info.datum[n]);e("word",t.text),e("weight",t.weight),e("column",i.col),e("segment",t.segment),"word"!==v&&e(v,t.text),"weight"!==k&&e(k,t.weight),"column"!==$&&e($,i.col),"segment"!==A&&e(A,t.segment),e("__strength",.5+.5*y)})})}}return{placed:o,unplaced:r}};let tt=w?Math.min(1,U,Z):Math.min(1,Z),et=J(tt);if(w)for(let t=0;6>t&&et.unplaced>0&&tt>.1;t++)tt*=.88,et=J(tt);const nt=et.placed.filter(t=>t.opacity>0);return{nodes:nt.map(t=>{const e=xn(t.text,t.fontSize)/2,n=t.fontSize*pn/2;return{type:"rect",x:t.x-e,y:t.y-n,w:2*e,h:2*n,style:{fill:"rgba(0,0,0,0)",stroke:"none"},datum:t.datum,group:t.datum.column+"",_transitionKey:t.id}}),overlays:fn("g",{className:"semiotic-word-trails",children:[p&&Mn({x:r.x+P-10,yTop:X,yBot:V,segLo:T,segHi:E,segToY:_,tickCount:g,tickFormat:y,color:`var(--semiotic-text-secondary, ${t.theme.semantic.textSecondary??"#888"})`,label:o.segmentAxisLabel,labelX:r.x}),m&&F.map((t,e)=>q>0?hn("text",{x:D+e*(q+d)+q/2,y:r.y+14,textAnchor:"middle",fontSize:13,fontWeight:600,fill:W.get(t),style:{pointerEvents:"none"},children:t},"wt-col-"+e):null),nt.map(t=>hn("text",{x:t.x,y:t.y,textAnchor:"middle",dominantBaseline:"central",fontSize:t.fontSize,fontWeight:600,fill:t.color,opacity:(!1===o.weightOpacity?1:Number(t.datum.__strength))*t.opacity,transform:t.rotation?`rotate(${t.rotation} ${t.x} ${t.y})`:void 0,style:{pointerEvents:"none"},children:t.text},"wt-"+t.id))]})}};function Mn(t){const e=[],n=t.segHi-t.segLo||1;for(let o=0;t.tickCount>o;o++)e.push(t.segLo+n*o/Math.max(1,t.tickCount-1));return fn("g",{className:"semiotic-word-trails-axis",style:{pointerEvents:"none"},children:[hn("line",{x1:t.x,y1:t.yTop,x2:t.x,y2:t.yBot,stroke:t.color,strokeWidth:1,opacity:.5}),e.map((e,n)=>{const o=t.segToY(e);return fn("g",{children:[hn("line",{x1:t.x-4,y1:o,x2:t.x,y2:o,stroke:t.color,strokeWidth:1,opacity:.6}),hn("text",{x:t.x-7,y:o,textAnchor:"end",dominantBaseline:"central",fontSize:11,fill:t.color,children:t.tickFormat(e)})]},"wt-tick-"+n)}),t.label&&hn("text",{transform:`rotate(-90 ${t.labelX+10} ${(t.yTop+t.yBot)/2})`,x:t.labelX+10,y:(t.yTop+t.yBot)/2,textAnchor:"middle",fontSize:11,fontWeight:600,fill:t.color,children:t.label})]})}var vn={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},kn=8;function $n(t){return null==t?void 0:t+""}function An(t){const e=$n(t.id);return{type:"point",x:t.x,y:t.y,r:t.r??8,style:{...vn},datum:t.datum,pointId:e,_transitionKey:e}}function Sn(t){return An(t)}function Cn(t){const[[e,n],[o,r]]=t.bounds;return{type:"geoarea",pathData:t.pathData,centroid:t.centroid,bounds:t.bounds,screenArea:t.screenArea??Math.abs((o-e)*(r-n)),style:{...vn},datum:t.datum,group:t.group,interactive:!0}}function zn(t){return{type:"rect",x:t.x,y:t.y,w:t.width,h:t.height,style:{...vn},datum:t.datum,group:t.group,_transitionKey:$n(t.id)}}function Nn(t){const e=$n(t.id);return"width"in t&&"height"in t?{type:"rect",x:t.x,y:t.y,w:t.width,h:t.height,style:{...vn},datum:t.datum,id:e,label:t.label}:{type:"circle",cx:t.x,cy:t.y,r:t.r??8,style:{...vn},datum:t.datum,id:e,label:t.label}}function Ln(t,e,n={}){const{coord:o,step:r=1,equals:i=Object.is,truthyOnly:a=!1}=n,s=[],c=e=>o?o(t[e],e):e,l=(t,e,n)=>{t.endIndex=e,t.count=e-t.startIndex+1,t.end=o?null==n||c(n)-c(e)>r?c(e)+r:c(n):e+1,s.push(t)};let u=null;for(let n=0;t.length>n;n++){const s=e(t[n],n);if(a&&!s){u&&(l(u,u.endIndex,n),u=null);continue}const d=!o||0>=n||c(n)-c(n-1)<=r;u&&d&&i(u.value,s)?u.endIndex=n:(u&&l(u,u.endIndex,n),u={value:s,start:c(n),end:c(n),count:1,startIndex:n,endIndex:n})}return u&&l(u,u.endIndex,null),s}var In=Ln;function Fn(t,e,n=0){return e>0?((t-n)%e+e)%e+n:t}function Wn(t,e,n){if(0>=n)return e-t;let o=(e-t)%n;return o>n/2?o-=n:-n/2>o&&(o+=n),o}function Tn(t,e,n){return e>n?t>=e||n>=t:t>=e&&n>=t}function En(t,e,n,o){return n>o?[...t.filter(t=>e(t)>=n),...t.filter(t=>e(t)<=o)]:t.filter(t=>Tn(e(t),n,o))}function jn(t,e){const n=Math.max(0,e.width),o=e.y,r=Math.min(74,Math.max(34,.08*n)),i=e.paddingLeft??r,a=t.length>1?Math.max(0,n-i-(e.paddingRight??r))/(t.length-1):0,s=new Map;return t.forEach((t,e)=>{s.set(t.id,{id:t.id,x:i+a*e,y:o,index:e})}),s}function Rn(t,e){const n=Math.max(0,e.width),o=e.y,r=Math.min(74,Math.max(34,.08*n)),i=e.paddingLeft??r,a=e.paddingRight??r,s=e.gap??8,c=!1!==e.distribute,l=e.estimateWidth??(t=>On(t.label??t.id)),u=t.map((t,e)=>Math.max(1,l(t,e))),d=u.reduce((t,e)=>t+e,0)+s*Math.max(0,t.length-1),h=Math.max(0,n-i-a),f=c&&t.length>1?Math.max(0,h-d)/(t.length-1):0,m=new Map;let p=i;return c||1!==t.length||(p=i+Math.max(0,(h-u[0])/2)),t.forEach((t,e)=>{const n=u[e];m.set(t.id,{id:t.id,x:p+n/2,y:o,index:e,width:n}),p+=n+s+f}),m}function On(t,e=38,n=7.4,o=20){return Math.max(e,((t??"")+"").length*n+o)}function Pn(t){const e=t.map(t=>{const e=Math.min(t.a,t.b),n=Math.max(t.a,t.b);return{span:t,a:e,b:n,width:n-e}}).sort((t,e)=>t.width-e.width||t.a-e.a),n=[],o=e.map(t=>{let e=n.findIndex(e=>t.a>=e);return 0>e?(e=n.length,n.push(t.b)):n[e]=t.b,{span:t.span,level:e}}),r=o.reduce((t,e)=>Math.max(t,e.level),0);return{packed:o,maxLevel:r,levelCount:o.length?r+1:1}}function Dn(t){const e=t.labelRoom??18,n=Math.max(48,t.baselineY-t.ceilingY-28),o=Math.max(1,t.levelCount),r=Math.min(42,Math.max(26,.18*n)),i=Math.max(24,n-r-e);return{arcLift:r,levelStep:Math.min(72,Math.max(28,o>1?i/Math.max(1,o-1):i))}}function Bn(t,e,n,o,r={}){const i=n-(r.footLift??26);return`M${t} ${i}Q${(t+e)/2} ${o} ${e} ${i}`}function Hn(t,e,n){return t-n.arcLift-e*n.levelStep}function Yn(t,e=Gn){if(!t.length)return{shared:[],exclusive:[]};if(1===t.length)return{shared:[...t[0]],exclusive:[[]]};const n=t.map(t=>new Set(t.map(t=>e(t)))),o=new Set;for(const t of n[0])n.every(e=>e.has(t))&&o.add(t);const r=[],i=new Set;for(const n of t[0]){const t=e(n);o.has(t)&&!i.has(t)&&(r.push(n),i.add(t))}return{shared:r,exclusive:t.map(t=>t.filter(t=>!o.has(e(t))))}}function Gn(t){return null==t||"object"!=typeof t?t+"":null!=t.id?t.id+"":`${(t.sourceTokenId??t.source)+""}|${(t.targetTokenId??t.target)+""}|${(t.relation??t.label??"")+""}`}var qn=2*Math.PI;function Xn(t,e,n){const o=n?.center?.x??0,r=n?.center?.y??0;return{x:o+Math.sin(t)*e,y:r-Math.cos(t)*e}}function Vn(t,e,n){return(Math.atan2(t-(n?.center?.x??0),-(e-(n?.center?.y??0)))+qn)%qn}function _n(t,e){const[n,o]=t,r=o-n||1,i=e?.startAngle??0,a=e?.endAngle??qn;return t=>i+(t-n)/r*(a-i)}function Kn(t,e){const[n,o]=t,[r,i]=e,a=o-n||1;return t=>r+(t-n)/a*(i-r)}function Un(t,e,n,o,r){const i=r?.center,a=(t,e)=>{const{x:n,y:o}=Xn(t,e,{center:i});return`${Zn(n)},${Zn(o)}`},s=Math.max(0,n),c=Math.max(s,o),l=Math.abs(e-t),u=t>e?0:1;if(l>=qn-1e-6){const t=i?.x??0,e=i?.y??0,n=`${Zn(t)},${Zn(e-c)}`,o=`${Zn(t)},${Zn(e+c)}`;let r=`M${n} A${Zn(c)},${Zn(c)} 0 1 1 ${o} A${Zn(c)},${Zn(c)} 0 1 1 ${n} Z`;if(s>0){const n=`${Zn(t)},${Zn(e-s)}`,o=`${Zn(t)},${Zn(e+s)}`;r+=` M${n} A${Zn(s)},${Zn(s)} 0 1 0 ${o} A${Zn(s)},${Zn(s)} 0 1 0 ${n} Z`}return r}const d=l>Math.PI?1:0,h=a(t,c),f=a(e,c);if(0>=s){const t=i?.x??0,e=i?.y??0;return`M${Zn(t)},${Zn(e)} L${h} A${Zn(c)},${Zn(c)} 0 ${d} ${u} ${f} Z`}const m=a(e,s),p=a(t,s);return`M${h} A${Zn(c)},${Zn(c)} 0 ${d} ${u} ${f} L${m} A${Zn(s)},${Zn(s)} 0 ${d} ${1===u?0:1} ${p} Z`}function Zn(t){return Math.round(1e3*t)/1e3}function Qn(t,e){return{x:t.x+e.x,y:t.y+e.y}}function Jn(t,e){return{x:t.x-e.x,y:t.y-e.y}}function to(t,e){return{x:t.x*e,y:t.y*e}}function eo(t){return Math.hypot(t.x,t.y)}function no(t){const e=eo(t)||1;return{x:t.x/e,y:t.y/e}}import{jsx as oo,jsxs as ro}from"react/jsx-runtime";var io="var(--semiotic-text, currentColor)";function ao(t,e){const n=A(t,100);return n>0?e/n*100*(e/n):Math.PI*e*e}function so(t){const e=[],n=t.colorMap?Object.entries(t.colorMap):t.keys?t.keys.map(e=>[e,t.color?t.color(e):void 0]):[];if(n.length>0){const o=t.colorType??"fill",r=n.map(([t,e])=>({label:t,color:e}));e.push({type:o,label:t.colorLabel??"",items:r,styleFn:"line"===o?t=>({stroke:t.color??io,strokeWidth:2,fill:"none"}):t=>({fill:t.color??io,stroke:t.color??io})})}if(t.symbolMap&&Object.keys(t.symbolMap).length>0){const n=t.symbolColor??io,o=Object.entries(t.symbolMap).map(([t,e])=>({label:t,shape:e,color:n}));e.push({label:t.symbolLabel??"",items:o,styleFn:()=>({}),type:t=>{const e=t.shape;return oo("path",{d:S(e,ao(e,7)),transform:"translate(8,8)",fill:t.color??n})}})}if(t.sizeStops&&t.sizeStops.length>0&&t.sizeRadius){const n=t.sizeRadius,o=t.sizeFormat??(t=>t+""),r=t.sizeColor??io,i=t.sizeStops.map(t=>({label:o(t),r:Math.max(.5,n(t)),color:r}));e.push({label:t.sizeLabel??"",items:i,styleFn:()=>({}),type:t=>oo("circle",{cx:8,cy:8,r:t.r,fill:t.color??r})})}return e}function co(t){const e=t.orientation??"vertical",n=t.swatchSize??14,o=t.gap??8,r=t.labelGap??6,i=t.fontSize??12,a=t.color??"var(--semiotic-text-secondary, #888)",s=n+o;let c=0;const l=[];return t.entries.forEach((t,u)=>{l.push(ro("g",{transform:`translate(${"vertical"===e?0:c},${"vertical"===e?c:0})`,children:[lo(t,n,t.color??t.line??a,a),oo("text",{x:n+r,y:n/2,dominantBaseline:"middle",fontSize:i,fill:a,children:t.label})]},"legend-"+u)),c+="vertical"===e?s:n+r+t.label.length*i*.58+o+8}),oo("g",{className:t.className,transform:`translate(${t.x},${t.y})`,style:{pointerEvents:"none"},children:l},t.keyId)}function lo(t,e,n,o){if(t.shape){const o=ao(t.shape,e/2-1);return oo("path",{d:S(t.shape,o),transform:`translate(${e/2},${e/2})`,fill:n})}if(t.hatch){const n=t.color??o;return ro("g",{children:[oo("svg",{width:e,height:e,style:{overflow:"hidden"},children:[-e,-e/2,0,e/2].map((t,o)=>oo("line",{x1:t,y1:e,x2:t+e,y2:0,stroke:n,strokeWidth:1,opacity:.7},o))}),oo("rect",{width:e,height:e,fill:"none",stroke:n,strokeWidth:1,opacity:.5,rx:2})]})}return oo("rect",t.line?{y:e/2-1.5,width:e,height:3,rx:1.5,fill:t.line}:{width:e,height:e,rx:2,fill:n})}var uo=new Set(["rows"]);function ho(t){const e=t,n=[go(e,["datum","data"]),go(e,["datum"]),go(e,["data","data"]),go(e,["data"]),go(e,["node","datum","data"]),go(e,["node","datum"]),t];for(const t of n){if(!yo(t))continue;const e={};for(const[n,o]of Object.entries(t))n.startsWith("_")||"function"==typeof o||(e[n]=o);if(Object.keys(e).length>0)return e}return null}function fo(t,e={}){const n=ho(t);if(!n)return[];const o=new Set(uo);if(e.excludeKeys)for(const t of e.excludeKeys)o.add(t);const r=[];for(const[t,i]of Object.entries(n))if((e.includeInternal||!t.startsWith("_"))&&!o.has(t)&&(e.includeEmpty||null!=i&&""!==i)&&"function"!=typeof i&&(r.push({key:t,label:po(t,e.labels),value:i,formatted:e.valueFormat?e.valueFormat(i,t,n):mo(i)}),r.length>=(e.maxEntries??8)))break;return r}function mo(t){if(null==t)return"";if(t instanceof Date)return t.toISOString();if("number"==typeof t)return Number.isInteger(t)?t+"":t.toLocaleString(void 0,{maximumFractionDigits:2});if("boolean"==typeof t)return t?"true":"false";if(Array.isArray(t))return t.length+" items";if("object"==typeof t)try{return JSON.stringify(t)}catch{return t+""}return t+""}function po(t,e){return"function"==typeof e?e(t):e&&e[t]?e[t]:t}function go(t,e){let n=t;for(const t of e){if(!yo(n))return;n=n[t]}return n}function yo(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function xo(t,e){const n=new Map;for(const e of t)n.set(e.id,new Set);for(const t of e)n.has(t.source)||n.set(t.source,new Set),n.has(t.target)||n.set(t.target,new Set),n.get(t.source).add(t.target),n.get(t.target).add(t.source);return n}function bo(t,e){const n={};for(const e of t)n[e.id]=0;for(const t of e)n[t.source]=(n[t.source]||0)+1,n[t.target]=(n[t.target]||0)+1;return n}function wo(t,e){const n={[e]:0},o=[e];let r=0;for(;o.length>r;){const e=o[r];r+=1;for(const r of t.get(e)||[])void 0===n[r]&&(n[r]=n[e]+1,o.push(r))}return n}function Mo(t,e,n,o){if(n===o)return n?[n]:[];const r=xo(t,e),i={[n]:null},a=[n];let s=0;for(;a.length>s;){const t=a[s];if(s+=1,t===o)break;for(const e of r.get(t)||[])void 0===i[e]&&(i[e]=t,a.push(e))}if(void 0===i[o])return[];const c=[];let l=o;for(;null!=l;)c.unshift(l),l=i[l];return c}function vo(t,e,n,o=1){const r=xo(t,e);if(!r.has(n))return new Set;const i=wo(r,n),a=new Set;for(const t in i)i[t]>o||a.add(t);return a}function ko(t,e){const n=xo(t,e),o={};for(const e of t)o[e.id]=0;for(const e of t.map(t=>t.id)){const r=[],i={},a={},s={};for(const e of t)i[e.id]=[],a[e.id]=0,s[e.id]=-1;a[e]=1,s[e]=0;const c=[e];let l=0;for(;c.length>l;){const t=c[l];l+=1,r.push(t);for(const e of n.get(t)||[])0>s[e]&&(s[e]=s[t]+1,c.push(e)),s[e]===s[t]+1&&(a[e]+=a[t],i[e].push(t))}const u={};for(const e of t)u[e.id]=0;for(;r.length;){const t=r.pop();for(const e of i[t])u[e]+=a[e]/a[t]*(1+u[t]);t!==e&&(o[t]+=u[t])}}for(const t in o)o[t]/=2;return o}function $o(t,e){const n=xo(t,e),o={};for(const e of t){const t=wo(n,e.id);let r=0,i=0;for(const e in t)r+=t[e],i+=1;o[e.id]=r>0?(i-1)/r:0}return o}function Ao(t,e){const n=xo(t,e),o={};for(const e of t){const t=[...n.get(e.id)||[]],r=t.length;if(2>r){o[e.id]=0;continue}let i=0;for(let e=0;t.length>e;e+=1)for(let o=e+1;t.length>o;o+=1)n.get(t[e])?.has(t[o])&&(i+=1);o[e.id]=2*i/(r*(r-1))}return o}function So(t){let e=0;for(const n in t)t[n]>e&&(e=t[n]);const n={};for(const o in t)n[o]=e>0?t[o]/e:0;return n}function Co(t,e,n,o={}){const r=xo(t,e),i={};for(const e of t)i[e.id]=wo(r,e.id);let a=o.minHops??4,s=o.startThreshold??.08;const c=o.maxThreshold??.2,l=new Set;let u=0;for(;0===l.size&&40>u;){for(let e=0;t.length>e;e+=1)for(let o=e+1;t.length>o;o+=1){const r=t[e].id,c=t[o].id,u=n[r],d=n[c];if(!u||!d)continue;const h=u.x-d.x,f=u.y-d.y;(void 0===i[r][c]?1/0:i[r][c])>=a&&s>Math.sqrt(h*h+f*f)&&(l.add(r),l.add(c))}0===l.size&&(s+=.02,s>c&&(s=o.startThreshold??.08,a=Math.max(2,a-1))),u+=1}return{problemIds:l,threshold:s,minHops:a}}async function zo(t,e,n={}){const{execution:o="auto",signal:r,workerThreshold:a,nodeRadius:s,...c}=n,l=c.iterations??260;if(!g()||!x(o,t.length,e.length,l,a))return i(t,e,{...c,nodeRadius:s});const u={kind:"normalized",nodes:t.map(t=>({...t})),edges:e.map(t=>({...t})),options:c,nodeRadii:"function"==typeof s?Object.fromEntries(t.map(t=>[t.id,s(t)])):null==s?void 0:Object.fromEntries(t.map(t=>[t.id,s]))};try{return(await y(u,r)).positions}catch(n){if("AbortError"===n?.name)throw n;return i(t,e,{...c,nodeRadius:s})}}var No=[.1,.5,.9],Lo=1e6;function Io(t){const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:null}function Fo(t,e,n,o,r){return"function"==typeof o?o(t,e,n):function(t,e){let n=t;for(const t of e.split(".")){if(null==n||"object"!=typeof n)return;n=n[t]}return n}(t,o??r)}function Wo(t){const e=Number(t.toFixed(12));return Object.is(e,-0)?0:e}function To(t,e,n,o){const r=t.flatMap((t,r)=>{const i=Io(Fo(t,r,e,n,"time")),a=Io(Fo(t,r,e,o,"value"));return null==i||null==a?[]:[{time:Wo(i),value:a,index:r}]});r.sort((t,e)=>t.time-e.time||t.index-e.index);const i=[];for(const t of r){const e=i[i.length-1];e?.time===t.time?e.value=t.value:i.push({time:t.time,value:t.value})}return i}function Eo(t,e,n,o){if(!t.length)return null;const r=t[0],i=t[t.length-1];if(r.time>e)return"clamp"===o?r.value:null;if(e>i.time)return"clamp"===o?i.value:null;const a=function(t,e){let n=0,o=t.length;for(;o>n;){const r=n+o>>>1;e>t[r].time?n=r+1:o=r}return n}(t,e),s=t[a];if(s?.time===e)return s.value;const c=t[Math.max(0,a-1)];return"step"!==n&&s&&s.time!==c.time?c.value+(e-c.time)/(s.time-c.time)*(s.value-c.value):c.value}function jo(t,e){if(1===t.length)return t[0];const n=(t.length-1)*e,o=Math.floor(n),r=Math.ceil(n);return o===r?t[o]:t[o]+(t[r]-t[o])*(n-o)}function Ro(t){const e=t.interpolation??"step",n=t.outsideDomain??"omit",o=function(t){const e=(t??No).map(t=>{const e=Io(t);if(null==e||0>e||e>1)throw new RangeError("physicsReferenceEnvelope quantiles must be finite values from 0 to 1; received "+t);return Wo(e)});return Array.from(new Set(e)).sort((t,e)=>t-e)}(t.quantiles),r=function(t){if(Array.isArray(t)){if(t.length>Lo)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(t.map(Io).filter(t=>null!=t).map(Wo))).sort((t,e)=>t-e)}const e=t,n=Io(e.start),o=Io(e.end),r=Io(e.step);if(null==n||null==o||null==r||0>=r||n>o)throw new RangeError("physicsReferenceEnvelope sampleAt requires finite start/end values with end >= start and step > 0");const i=Math.floor((o-n)/r)+1;if(i>Lo)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");const a=[],s=1e-10*Math.max(1,Math.abs(o),Math.abs(n));for(let t=0;i>t;t+=1){const e=n+t*r;if(e>o+s)break;a.push(Wo(Math.min(e,o)))}if(a.length&&s>=Math.abs(a[a.length-1]-o)||a.push(Wo(o)),a.length>Lo)throw new RangeError("physicsReferenceEnvelope sampleAt exceeds 1000000 points");return Array.from(new Set(a)).sort((t,e)=>t-e)}(t.sampleAt),i=t.runs.map(e=>To(e.samples,e.id,t.timeAccessor,t.valueAccessor));return{points:r.map(t=>{const r=i.map(o=>Eo(o,t,e,n)).filter(t=>null!=t).sort((t,e)=>t-e),a={};for(const t of o)a[t]=r.length?jo(r,t):null;return{time:t,count:r.length,min:r.length?r[0]:null,max:r.length?r[r.length-1]:null,median:r.length?jo(r,.5):null,quantiles:a}}),quantiles:o,interpolation:e,outsideDomain:n,runCount:t.runs.length}}function Oo(t,e){return t.quantiles.length?"lower"===e?t.quantiles[0]:t.quantiles[t.quantiles.length-1]:"lower"===e?"min":"max"}function Po(t,e){if("min"===e||"median"===e||"max"===e)return t[e];const n=Io(e);if(null==n||0>n||n>1)throw new RangeError("comparePhysicsTrace quantile selectors must be from 0 to 1; received "+e);const o=Wo(n);if(!Object.prototype.hasOwnProperty.call(t.quantiles,o))throw Error(`comparePhysicsTrace could not find quantile ${o} in the reference envelope`);return t.quantiles[o]??null}function Do(t,e,n){return e>t?"below":t>n?"above":"inside"}function Bo(t,e){const n=Math.max(0,e.time-t.time);if(0>=n||null==t.value||null==t.lower||null==t.upper||null==e.value||null==e.lower||null==e.upper)return{below:0,inside:0,above:0,observed:0};const o=t.value-t.lower,r=e.value-e.lower,i=t.value-t.upper,a=e.value-e.upper,s=[0,1];for(const[t,e]of[[o,r],[i,a]])(0>t&&e>0||t>0&&0>e)&&s.push(-t/(e-t));s.sort((t,e)=>t-e);let c=0,l=0,u=0;for(let o=0;s.length-1>o;o+=1){const r=s[o],i=s[o+1];if(r>=i)continue;const a=(r+i)/2,d=(i-r)*n,h=Do(t.value+(e.value-t.value)*a,t.lower+(e.lower-t.lower)*a,t.upper+(e.upper-t.upper)*a);"below"===h?c+=d:"above"===h?u+=d:l+=d}return{below:c,inside:l,above:u,observed:n}}function Ho(t,e,n={}){const o=n.interpolation??e.interpolation,r=n.outsideDomain??e.outsideDomain,i=To(t,n.traceId??"trace",n.timeAccessor,n.valueAccessor),a=n.lower??Oo(e,"lower"),s=n.upper??Oo(e,"upper"),c=e.points.map(t=>{const e=Eo(i,t.time,o,r),n=Po(t,a),c=Po(t,s);if(null!=n&&null!=c&&n>c)throw new RangeError("comparePhysicsTrace lower band exceeds upper band at time "+t.time);return{time:t.time,value:e,lower:n,upper:c,status:null==e||null==n||null==c?"unobserved":Do(e,n,c)}});let l=0,u=0,d=0,h=0,f=null,m=0,p=null;for(const t of c){if("below"===t.status?l+=1:"inside"===t.status?u+=1:"above"===t.status&&(d+=1),null==t.value||null==t.lower||null==t.upper)continue;const e=Math.max(0,t.value-t.upper),n=Math.max(0,t.lower-t.value);e>h&&(h=e,f=t.time),n>m&&(m=n,p=t.time)}let g=0,y=0,x=0,b=0;for(let t=0;c.length-1>t;t+=1){const e=c[t],n=c[t+1],r=Math.max(0,n.time-e.time);if(r>0){if("linear"===o){const t=Bo(e,n);g+=t.below,y+=t.inside,x+=t.above,b+=t.observed;continue}"unobserved"!==e.status&&(b+=r,"below"===e.status?g+=r:"above"===e.status?x+=r:y+=r)}}const w=c[0]?.time,M=c[c.length-1]?.time,v=null==w||null==M?0:Math.max(0,M-w);return{points:c,sampleCount:c.length,observedSamples:l+u+d,belowSamples:l,insideSamples:u,aboveSamples:d,totalDuration:v,observedDuration:b,unobservedDuration:Math.max(0,v-b),belowDuration:g,insideDuration:y,aboveDuration:x,peakExcess:h,peakExcessAt:f,peakDeficit:m,peakDeficitAt:p}}function Yo(t){return{id:t,furthestStageIndex:-1,visitedStageIds:[],visitsByStage:{},firstEnteredAt:{},lastEnteredAt:{},regressionCount:0}}function Go(t){const e=Array.from(new Set(t.bodyIds??[]));return{stages:t.stages.map(t=>({...t})),bodyIds:e,entities:Object.fromEntries(e.map(t=>[t,Yo(t)]))}}function qo(t,e,n={}){if("region-enter"!==e.type)return t;const o=function(t,e){const n=e.stageId?.(t);if(n)return n;const o=t.region.metadata;if(o&&"object"==typeof o){const t=o.stageId;if("string"==typeof t)return t}return t.region.id}(e,n),r=t.stages.findIndex(t=>t.id===o);if(0>r)return t;const i=n.entityId?.(e)??e.bodyId;if(!i)return t;const a=t.entities[i]??Yo(i),s=a.currentStageId?t.stages.findIndex(t=>t.id===a.currentStageId):-1,c=!a.visitedStageIds.includes(o),l=Number(e.observation.timestamp),u=Number.isFinite(l)?l:0,d={...a,currentStageId:o,furthestStageId:r>a.furthestStageIndex?o:a.furthestStageId,furthestStageIndex:Math.max(a.furthestStageIndex,r),visitedStageIds:c?[...a.visitedStageIds,o]:a.visitedStageIds,visitsByStage:{...a.visitsByStage,[o]:(a.visitsByStage[o]??0)+1},firstEnteredAt:c?{...a.firstEnteredAt,[o]:u}:a.firstEnteredAt,lastEnteredAt:{...a.lastEnteredAt,[o]:u},regressionCount:s>=0&&s>r?a.regressionCount+1:a.regressionCount};return{...t,bodyIds:t.bodyIds.includes(i)?t.bodyIds:[...t.bodyIds,i],entities:{...t.entities,[i]:d}}}function Xo(t){const e=t.bodyIds.map(e=>t.entities[e]??Yo(e)),n=e.length;let o=n;return t.stages.map((t,r)=>{const i=e.filter(t=>t.furthestStageIndex>=r).length,a=e.filter(e=>e.visitedStageIds.includes(t.id)).length,s=e.reduce((e,n)=>e+(n.visitsByStage[t.id]??0),0),c={id:t.id,label:t.label??t.id,reached:i,entered:a,total:n,conversion:n>0?i/n:0,fromPrevious:o>0?i/o:0,dropoff:Math.max(0,o-i),visits:s,repeatVisits:Math.max(0,s-a)};return o=i,c})}import{Fragment as Vo,jsx as _o,jsxs as Ko}from"react/jsx-runtime";var Uo={flow:{fill:"rgba(59, 130, 246, 0.14)",stroke:"rgba(96, 165, 250, 0.7)",accent:"#60a5fa"},capacity:{fill:"rgba(251, 146, 60, 0.18)",stroke:"rgba(251, 146, 60, 0.85)",accent:"#fb923c"},portal:{fill:"rgba(244, 114, 182, 0.14)",stroke:"rgba(244, 114, 182, 0.7)",accent:"#f472b6"},absorb:{fill:"rgba(52, 211, 153, 0.18)",stroke:"rgba(52, 211, 153, 0.8)",accent:"#34d399"}};function Zo(t,e,n){return Math.max(e,Math.min(n,t))}function Qo(t){return 6.2*t.length}function Jo(t,e){const n=t.trim();if(e>=n.length)return n;if(1>=e)return n.slice(0,1);const o=n.split(/\s+/).filter(Boolean).map(t=>t[0]).join("").toUpperCase();return o.length>1&&e>=o.length?o:e>3?n.slice(0,Math.max(1,e-2))+"..":n.slice(0,e).toUpperCase()}function tr(t,e,n="auto"){const o=Math.max(1,Math.floor(e/6.2)),r="compact"===n?Jo(t,o):"full"===n?t:Qo(t)>e?Jo(t,o):t;return{text:r,textLength:Qo(r)>e?Math.max(4,e):void 0}}function er(t,e={}){const{showFlowSpine:n=!0,showStageCounts:o=!0,showCapacityBadges:r=!0,showGroupSockets:i=!0,stageLabelMode:a="auto",outlineStages:s=!1,testId:c="process-flow-chrome"}=e,{width:l,height:u,left:d,right:h,topY:f,bottomY:m,midY:p,stages:g,groups:y=[]}=t,x=m-f;return Ko("svg",{"aria-hidden":"true","data-testid":c,"data-outline-stages":s?"true":void 0,width:l,height:u,viewBox:`0 0 ${l} ${u}`,style:{position:"absolute",inset:0,pointerEvents:"none"},className:["semiotic-process-chrome",s?"semiotic-process-chrome--outline-stages":null].filter(Boolean).join(" "),children:[_o("defs",{children:Ko("linearGradient",{id:"semiotic-process-floor",x1:"0",x2:"0",y1:"0",y2:"1",children:[_o("stop",{offset:"0%",stopColor:"var(--semiotic-process-floor, var(--semiotic-bg, #0f172a))",stopOpacity:"0.2"}),_o("stop",{offset:"100%",stopColor:"var(--semiotic-process-lane, var(--semiotic-surface, #1e293b))",stopOpacity:"0.55"})]})}),_o("rect",{x:0,y:0,width:l,height:u,fill:"url(#semiotic-process-floor)"}),_o("rect",{x:d-6,y:f-8,width:h-d+12,height:x+16,rx:14,fill:"var(--semiotic-process-lane, var(--semiotic-surface, #111827))",fillOpacity:.45,stroke:"var(--semiotic-process-border, var(--semiotic-border, #334155))",strokeOpacity:.95}),n?_o("line",{x1:d+8,x2:h-8,y1:p,y2:p,stroke:"var(--semiotic-process-border, var(--semiotic-border, #475569))",strokeWidth:2,strokeDasharray:"6 8",opacity:.55}):null,g.map((t,e)=>{const n=function(t){return t.absorb?"absorb":t.portalTarget?"portal":null!=t.capacity?"capacity":"flow"}(t),i=Uo[n],c=Math.max(12,t.width-8),l=Zo(c-8,22,88),d=tr(t.label,Math.max(8,l-10),a),h="none"!==a&&c-8>=22,y=function(t){if(null!=t.capacity){const e=null!=t.queueDepth?" · q "+t.queueDepth:"";return t.capacityLabel?`${t.capacityLabel}${e}`:`cap ${Number.isInteger(t.capacity)?t.capacity+"":t.capacity.toFixed(1)}${e}`}return t.absorb?"absorb":t.portalTarget?"portal":"flow"}(t),b=tr(y,Math.max(16,c-10),"auto"),w=r&&!1!==t.showBadge&&c>=32,M=null!=t.count?`n=${t.count}${null!=t.processed?" done "+t.processed:""}`:"",v=tr(M,Math.max(16,c-8),"auto"),k=Math.max(30,f-15),$=k-13;return Ko("g",{"data-stage":t.id,"data-role":n,children:[_o("rect",{className:"semiotic-process-chrome__stage-bay",x:t.x0+4,y:f+6,width:c,height:x-12,rx:10,fill:s?"none":i.fill,stroke:i.stroke,strokeWidth:s?1.85:"flow"===n?1:1.6}),g.length-1>e?_o("polygon",{points:`${t.x1-2},${p-7} ${t.x1+8},${p} ${t.x1-2},${p+7}`,fill:i.accent,opacity:.85}):null,h?Ko(Vo,{children:[_o("rect",{className:"semiotic-process-chrome__stage-label-bg",x:t.x-l/2,y:$,width:l,height:18,rx:9,fill:"var(--semiotic-bg, #0f172a)",fillOpacity:.75,stroke:i.stroke}),Ko("text",{x:t.x,y:k,textAnchor:"middle",fill:i.accent,fontSize:10,fontWeight:800,className:"semiotic-process-chrome__stage-label",textLength:d.textLength,lengthAdjust:d.textLength?"spacingAndGlyphs":void 0,children:[_o("title",{children:t.label}),d.text]})]}):null,w?Ko("text",{x:t.x,y:f+22,textAnchor:"middle",fill:"var(--semiotic-process-muted, var(--semiotic-text-secondary, #94a3b8))",fontSize:9,fontWeight:700,textLength:b.textLength,lengthAdjust:b.textLength?"spacingAndGlyphs":void 0,children:[_o("title",{children:y}),b.text]}):null,o&&null!=t.count?Ko("text",{x:t.x,y:Math.min(u-8,m+16),textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #e2e8f0))",fontSize:11,fontWeight:800,textLength:v.textLength,lengthAdjust:v.textLength?"spacingAndGlyphs":void 0,children:[_o("title",{children:M}),v.text]}):null]},t.id)}),i?y.map((t,e)=>{const n=t.total??0,o=t.absorbed??0,r=t.complete??(n>0&&o>=n),i=!r&&n>0&&o/n>=.75,a=r?"rgba(52, 211, 153, 0.35)":i?"rgba(251, 191, 36, 0.28)":"rgba(15, 23, 42, 0.75)",s=r?"#34d399":i?"#fbbf24":"var(--semiotic-border, #64748b)",c=n>0?`${o}/${n}${r?" shipped":i?" almost":""}`:"feature "+(e+1),l=Zo(Math.max(54,Qo(t.label)+18,Qo(c)+16),54,104),u=tr(t.label,l-12,"auto"),d=tr(c,l-12,"auto");return Ko("g",{"data-group":t.id,children:[_o("rect",{x:t.x-l/2,y:t.y-22,width:l,height:44,rx:10,fill:a,stroke:s,strokeWidth:1.5}),Ko("text",{x:t.x,y:t.y-4,textAnchor:"middle",fill:"var(--semiotic-process-text, var(--semiotic-text, #f8fafc))",fontSize:10,fontWeight:800,textLength:u.textLength,lengthAdjust:u.textLength?"spacingAndGlyphs":void 0,children:[_o("title",{children:t.label}),u.text]}),Ko("text",{x:t.x,y:t.y+12,textAnchor:"middle",fill:s,fontSize:9,fontWeight:700,textLength:d.textLength,lengthAdjust:d.textLength?"spacingAndGlyphs":void 0,children:[_o("title",{children:c}),d.text]})]},t.id)}):null]})}function nr(t){const e="number"==typeof t?t:"string"==typeof t&&t.trim()?Number(t):NaN;return Number.isFinite(e)?e:null}function or(t,e,n,o){const r="function"==typeof t?t(e,n):t;return Number.isFinite(r)?Number(r):o}function rr(t,e,n){return nr(t[e])??n}function ir(t,e){return"number"==typeof t?t:t?.[e]??0}function ar(t){const{band:e,idPrefix:n,plot:o,projection:r}=t,{includeBoundaryWalls:i=!0,includeInteriorWalls:a=!0,wallThickness:s=4}=e,c=function(t){const e=t.bandwidth??t.scale.bandwidth?.()??0,n=new Set;for(const o of t.values){const r=t.scale(o);Number.isFinite(r)&&(n.add(Number(r)),n.add(Number(r)+e))}return Array.from(n).sort((t,e)=>t-e)}(e);if(2>c.length)return[];const l=i?c.length-1:c.length-2,u=[];for(let t=i?0:1;l>=t;t+=1){if(!a&&t>0&&c.length-1>t)continue;const e=c[t];u.push({id:`${n}-wall-${t}`,shape:"x"===r?{type:"aabb",x:e,y:o.y+o.height/2,width:s,height:o.height}:{type:"aabb",x:o.x+o.width/2,y:e,width:o.width,height:s}})}return u}function sr(t){const{plot:e,idPrefix:n="physics-scale",bounds:o={},xBins:r,xBands:i,yBands:a}=t,s=[];if(!1!==o&&s.push(...b(e,{idPrefix:n,...o})),r){const{idPrefix:t,yTop:o,yBottom:i,...a}=r;s.push(...w({...a,idPrefix:t??n+"-xbin",yTop:o??e.y,yBottom:i??e.y+e.height}))}return i&&s.push(...ar({band:i,idPrefix:i.idPrefix??n+"-xband",plot:e,projection:"x"})),a&&s.push(...ar({band:a,idPrefix:a.idPrefix??n+"-yband",plot:e,projection:"y"})),s}function cr(t){const{plot:e,rows:n,columns:o=n+1,pegRadius:r=3,idPrefix:i="galton-peg",yStart:a=e.y+.18*e.height,yEnd:s=e.y+.58*e.height,stagger:c=!0,restitution:l=.2,friction:u=.04}=t,d=Math.max(0,Math.floor(n)),h=Math.max(1,Math.floor(o));if(0===d)return[];const f=d>1?(s-a)/(d-1):0,m=e.width/h,p=[];for(let t=0;d>t;t+=1){const n=c&&t%2==1?m/2:0;for(let o=0;h>o;o+=1){const s=e.x+m*(o+.5)+n;e.x+r>s||s>e.x+e.width-r||p.push({id:`${i}-${t}-${o}`,shape:{type:"aabb",x:s,y:a+t*f,width:2*r,height:2*r},restitution:l,friction:u})}}return p}function lr(t,e={}){const{idPrefix:n="physics-token",radius:o=5,shape:r,mass:i,vx:a,vy:s,spawnAt:c,seed:l=1,jitter:u,datum:d}=e,h=v(l),f=ir(u,"x"),m=ir(u,"y");return t.map((t,l)=>{const u=or(e.x,t,l,rr(t,"x",0)),p=or(e.y,t,l,rr(t,"y",0)),g=or(o,t,l,5),y="function"==typeof r?r(t,l):r??{type:"circle",radius:g};return{id:`${n}-${t.index??l}`,x:u+(h()-.5)*f,y:p+(h()-.5)*m,vx:or(a,t,l,0),vy:or(s,t,l,0),mass:or(i,t,l,1),spawnAt:or(c,t,l,void 0),shape:y,datum:d?d(t,l):t.datum??t}}).map(t=>{if(Number.isFinite(t.spawnAt))return t;const{spawnAt:e,...n}=t;return n})}function ur(t,e={}){const{idPrefix:n="sediment",collider:o=!0,colliderThickness:r=1,restitution:i=.05,friction:a=.2,...s}=e,c=M(t,s),l=o?c.filter(t=>t.height>0).map(t=>({id:`${n}-${t.binId}`,shape:{type:"aabb",x:t.x+t.width/2,y:t.y+r/2,width:t.width,height:r},restitution:i,friction:a})):[];return{columns:c,colliders:l}}function dr(t,e={}){const{timeAccessor:n="arrivalTime",timeScale:o=1,startAt:r=0,rebase:i=!0,sort:a=!0}=e,s=t.map((t,e)=>({spawn:t,time:function(t,e,n){return nr("function"==typeof n?n(t,e):t[n]??t.datum?.[n])}(t,e,n)??t.spawnAt??e})),c=s.length?Math.min(...s.map(t=>t.time)):0;return{initialSpawns:s.map(({spawn:t,time:e})=>({...t,spawnAt:r+(i?e-c:e)})).sort((t,e)=>a?(t.spawnAt??0)-(e.spawnAt??0):0),initialSpawnPacing:{pacing:"arrival",startAt:r,timeAccessor:"spawnAt",timeScale:o}}}function hr(t,e,n="group"){const o=bo(t,e),r=t=>"function"==typeof n?n(t):t[n]??0;return t.slice().sort((t,e)=>{const n=r(t),i=r(e);return i>n?-1:n>i?1:(o[e.id]||0)-(o[t.id]||0)}).map(t=>t.id)}function fr(t,e={}){const n=e.baseline??.62,o=e.inset??.06,r={},i=t.length;return t.forEach((t,e)=>{r[t]={x:i>1?o+e/(i-1)*(1-2*o):.5,y:n}}),r}function mr(t,e,n=.55){return`M${t.x},${t.y} Q${(t.x+e.x)/2},${t.y-Math.abs(e.x-t.x)*n} ${e.x},${e.y}`}function pr(t,e={}){const n=e.radius??.42,o=e.center?.x??.5,r=e.center?.y??.5,i=e.startAngle??0,a={},s=t.length;return t.forEach((t,e)=>{const c=i+e/s*Math.PI*2-Math.PI/2;a[t]={x:o+Math.cos(c)*n,y:r+Math.sin(c)*n}}),a}function gr(t,e,n={}){const o=(n.order??hr(t,e,n.groupAccessor??"group")).slice(),r=new Map(o.map((t,e)=>[t,e])),i=new Map;for(const t of e){if(!r.has(t.source)||!r.has(t.target)||t.source===t.target)continue;const e=t.target>t.source?`${t.source}\0${t.target}`:`${t.target}\0${t.source}`;i.set(e,(i.get(e)||0)+(t.value??1))}const a=[];let s=0;for(const[t,e]of i){const[n,o]=t.split("\0"),i=r.get(n),c=r.get(o);e>s&&(s=e),a.push({row:i,col:c,source:n,target:o,value:e}),a.push({row:c,col:i,source:o,target:n,value:e})}return{order:o,cells:a,size:o.length,maxValue:s}}function yr(t){return!!t&&"object"==typeof t&&!Array.isArray(t)}function xr(t){if("string"!=typeof t)return;const e=t.trim();return e.length?e:void 0}function br(t,e){const n=yr(t.note)?t.note:void 0;return e?xr(t.mobileText)||xr(t.shortText)||xr(t.label)||xr(n?.mobileText)||xr(n?.shortText)||xr(n?.label)||xr(n?.title):xr(t.label)||xr(t.mobileText)||xr(t.shortText)||xr(n?.label)||xr(n?.title)}function wr(t,e,n){const o=function(t,e,n){if(!n)return;const o="function"==typeof n?n(t,e):t[n];return"number"==typeof o&&Number.isFinite(o)?o:void 0}(t,e,n.priorityAccessor);if(void 0!==o)return o;let r=1e3-e;const i=((t.emphasis??"")+"").toLowerCase();"primary"!==i&&"critical"!==i||(r+=1e4),"secondary"===i&&(r-=1e3),"high"===t.priority&&(r+=5e3),"low"===t.priority&&(r-=1500),"number"==typeof t.priority&&(r+=100*t.priority);const a=yr(t.provenance)?t.provenance:void 0;"number"==typeof a?.confidence&&(r+=100*a.confidence);const s=yr(t.lifecycle)?t.lifecycle:void 0,c=((s?.freshness??"")+"").toLowerCase();return"expired"!==c&&"stale"!==c||(r-=3e3),r}function Mr(t,e){if(!e)return t;const n=br(t,!0);return n&&"string"==typeof t.label?{...t,label:n}:t}function vr(t,e={}){const n=Array.isArray(t)?t.filter(yr):[],o=e.active??(null==e.width||(e.breakpoint??480)>=e.width),r=e.strategy??"hybrid",i=!1!==e.preferShortText,a=!1!==e.preservePrimary,s=Math.max(0,e.maxPlotAnnotations??e.maxAnnotations??("callout-list"===r?1:2)),c=Math.max(0,e.minPlotAnnotations??e.minVisible??1);if(!o||"plot"===r)return{active:o,strategy:r,budget:n.length,visible:i?n.map(t=>Mr(t,i)):n,deferred:[],calloutList:[],hidden:[]};const l=[],u=n.map((t,n)=>({annotation:t,index:n,priority:wr(t,n,e)})).filter(t=>!!C(t.annotation)||(l.push(t.annotation),!1)).sort((t,e)=>e.priority-t.priority),d=a?u.filter(t=>"primary"===((t.annotation.emphasis??"")+"").toLowerCase()):[],h=new Set(d.map(t=>t.index)),f=u.filter(t=>!h.has(t.index)),m=[...d,...f].slice(0,Math.max(s,c)),p=new Set(m.map(t=>t.index)),g=u.filter(t=>!p.has(t.index)),y=[...l,...m.sort((t,e)=>t.index-e.index).map(t=>Mr(t.annotation,i))],x=g.sort((t,e)=>t.index-e.index).map(t=>t.annotation),b=Math.max(0,e.maxCalloutItems??6),w=g.filter(t=>!e.calloutFilter||e.calloutFilter(t.annotation,t.index)).map(t=>function(t,e,n,o){const r=br(t,o);if(!r)return null;const i=xr(t.id)||xr(t.key)||xr(t.pointId)||"annotation-"+(e+1),a=yr(t.provenance)?xr(t.provenance.source)||xr(t.provenance.authorKind):void 0;return{id:i,label:r,shortLabel:xr(t.shortText),pointId:t.pointId,emphasis:"string"==typeof t.emphasis?t.emphasis:void 0,source:a,priority:n,annotation:t}}(t.annotation,t.index,t.priority,i)).filter(t=>!!t).slice(0,b),M=new Set(w.map(t=>t.annotation)),v=x.filter(t=>!M.has(t));return{active:o,strategy:r,budget:s,visible:y,deferred:x,calloutList:w,hidden:v}}function kr(t){return"dense"===t.density?.75:"compact"===t.density?.9:1}function $r(t,e){const n=!1!==e.keepAxes,o=!1===e.directLabel?12:28;return"ordinal"===t?{top:12,right:o,bottom:n?44:12,left:n?48:12}:"geo"===t||"network"===t?{top:12,right:12,bottom:12,left:12}:{top:12,right:o,bottom:n?42:14,left:n?44:14}}function Ar(t,e,n,o={}){const r={...n},i={mode:!1===e.mode?void 0:"mobile",...r,margin:$r(t,e),...o},a=Object.fromEntries(Object.entries(r).filter(([,t])=>void 0!==t)),s=Object.fromEntries(Object.entries(i).filter(([,t])=>void 0!==t)),c=function(t,e){const n=e.targetSize??44,o=[],r=e.standardControls,i=t=>!0===r||"all"===r||r===t||Array.isArray(r)&&r.includes(t);return i("brush")&&o.push("range-inputs","clear-brush"),i("zoom")&&o.push("zoom-buttons","reset-view"),i("legend")&&o.push("legend-chips","show-all-series"),{strategy:`${t}-${e.transformProfile??"overview"}-mobile-recipe`,supportsResponsiveLayout:!0,breakpoints:[320,360,390,430,e.breakpoint??480,768],maxAnnotations:e.maxAnnotations??2,minimumHitTarget:n,summary:e.summary??!0,interaction:{primary:"tap",hoverFallback:"tap-to-lock",targetSize:n,...o.length>0&&{alternatives:o}},labels:{strategy:!1===e.directLabel?"compact":"direct",minFontSize:12}}}(t,e),l=function(t){return{tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:t.targetSize??44,snap:t.snap??"nearestDatum",brushHandleSize:t.targetSize??44,standardControls:t.standardControls??!1}}(e);return{family:t,props:a,responsiveRules:[{id:t+"-mobile",description:`Apply Semiotic's mobile ${t} recipe at phone width.`,when:{maxWidth:e.breakpoint??480},transform:{...s,mobileInteraction:l,mobileSemantics:c}}],mobileInteraction:l,mobileSemantics:c}}function Sr(t={}){const e=kr(t);return Ar("line",t,{showLegend:t.showLegend??!1,directLabel:t.directLabel??!0,lineWidth:"inspect"===t.transformProfile?3:Math.max(1.5,2.5*e),showPoints:"inspect"===t.transformProfile,autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??2,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function Cr(t={}){const e=kr(t);return Ar("area",t,{showLegend:t.showLegend??!1,showPoints:!1,areaOpacity:"compare"===t.transformProfile?.55:.42,lineWidth:Math.max(1.25,2*e),autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??2,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function zr(t={}){return Ar("ordinal",t,{showLegend:t.showLegend??!1,showCategoryTicks:t.keepAxes??!0,sort:"compare"===t.transformProfile?"desc":void 0},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function Nr(t={}){const e=kr(t);return Ar("scatter",t,{showLegend:t.showLegend??!1,pointRadius:Math.max(4,Math.round((t.targetSize??44)/8*e)),hoverRadius:Math.ceil((t.targetSize??44)/2),pointOpacity:"dense"===t.density?.42:.68,autoPlaceAnnotations:{mobile:{strategy:"callout-list",maxAnnotations:t.maxAnnotations??1,maxCalloutItems:t.maxCalloutItems??4,progressiveDisclosure:!0,preferShortText:!0}}},{showAxes:t.keepAxes??!0,axisExtent:"exact"})}function Lr(t={}){const e=kr(t);return Ar("network",t,{showLegend:t.showLegend??!1,nodeSizeRange:[Math.max(4,Math.round(6*e)),Math.max(12,Math.round((t.targetSize??44)/2*e))],showLabels:"inspect"===t.transformProfile,edgeOpacity:"dense"===t.density?.28:.44})}function Ir(t={}){return Ar("geo",t,{showLegend:t.showLegend??!1})}function Fr(t={}){return Ar("small-multiple",t,{mobileColumns:t.mobileColumns??1,tabletColumns:t.tabletColumns??2,chartHeight:t.chartHeight??180,sharedExtent:!0})}function Wr(t,e={}){switch(t){case"line":return Sr(e);case"area":return Cr(e);case"ordinal":return zr(e);case"scatter":return Nr(e);case"network":return Lr(e);case"geo":return Ir(e);case"small-multiple":return Fr(e)}}function Tr(t={}){const e=t.controls??["range-inputs","chip-filter","clear"];return{mobileInteraction:{enabled:!0,targetSize:t.targetSize??44,tapToSelect:!0,tapToLockTooltip:!0,standardControls:"brush"},mobileSemantics:{interaction:{primary:"filter",alternatives:e,summary:t.summary??"Expose brushable ranges through touch-sized controls in addition to drag gestures."}},controls:e}}export{z as waffleLayout,N as allocateCells,L as isotypeInk,I as isotypePaper,F as isotypeGhost,W as isotypeServerGlyph,T as isotypeChipGlyph,E as isotypeBoltGlyph,j as isotypeBusGlyph,R as isotypePersonPath,O as isotypePersonGlyph,P as isotypeNetworkGlyphs,U as tokenLayer,J as calendarLayout,rt as DEFAULT_ISOMETRIC_SPRITE_SIZES,ft as selectIsometricLandmarks,mt as isometricLandmarkLayout,wt as flextreeLayout,Mt as dagreLayout,Ct as lineageDagLayout,Wt as mermaidDagLayout,jt as roundedEnclosure,Rt as boundsOf,Ot as hullFromBoxes,Pt as bandLabel,Dt as hatchFill,Bt as linearAxis,Ht as markCallout,qt as analyzeNetEnsemble,te as netEnsembleLayout,se as packedClusterMatrix,de as marimekkoLayout,me as bulletLayout,ye as parallelCoordinatesLayout,Le as bobaLayout,Ie as GRID_FUEL_KEYS,Fe as GRID_FUEL_LABELS,Ee as stackFuelSeries,je as demandForecastRows,Re as reserveMarginPct,Oe as reserveSeries,Pe as thresholdBandsForReserve,De as reserveAnnotationBands,Be as summarizeOperatingPoint,He as gridEventAnnotations,Ye as tightestHours,Ge as formatMw,qe as formatReservePct,_e as packIntervals,Ke as activeCountOverDomain,Ze as intervalLanesLayout,Qe as curvedEdgePath,Je as orthogonalEdgePath,tn as boxEdgeAnchors,en as fanOutBend,nn as cubicPoint,on as cubicTangent,rn as cubicPath,an as rectCollide,ln as axisFixedForcePositions,un as axisFixedForceLayout,dn as wordTrailsProgressiveReveal,wn as wordTrailsLayout,kn as DEFAULT_HIT_RADIUS,An as hitTargetPoint,Sn as geoHitTarget,Cn as geoAreaHitTarget,zn as hitTargetRect,Nn as networkHitTarget,Ln as runs,In as runLengthEncode,Fn as wrapValue,Wn as shortestArcDelta,Tn as cyclicRangeContains,En as selectCyclicRange,jn as layoutSequence,Rn as layoutChipStrip,On as estimateLabelWidth,Pn as packSpanLevels,Dn as scaleArcBand,Bn as spanArcPath,Hn as spanArcPeakY,Yn as partitionSharedEdges,qn as TAU,Xn as polarToXY,Vn as xyToAngle,_n as angleScale,Kn as radiusScale,Un as ringArcPath,Qn as addPoints,Jn as subtractPoints,to as scalePoint,eo as pointMagnitude,no as normalizePoint,so as legendGroupsFrom,co as legendSwatches,ho as extractTooltipDatum,fo as buildTooltipEntries,mo as formatTooltipValue,xo as buildAdjacency,bo as degree,wo as bfsDistances,Mo as shortestPath,vo as egoNetwork,ko as betweenness,$o as closeness,Ao as clustering,So as normalizeScores,Co as proximityProblem,zo as forceLayoutAsync,Ro as physicsReferenceEnvelope,Ho as comparePhysicsTrace,Go as createProcessJourneyLedger,qo as updateProcessJourney,Xo as processJourneyRows,er as processChrome,sr as collidersFromScales,cr as galtonPegs,lr as spawnFromTokens,ur as sedimentBake,dr as arrivalReplay,hr as orderByGroupDegree,fr as arcLayout,mr as arcPath,pr as circularLayout,gr as adjacencyMatrix,vr as mobileAnnotationStrategy,Sr as mobileLineChartRecipe,Cr as mobileAreaChartRecipe,zr as mobileOrdinalChartRecipe,Nr as mobileScatterplotRecipe,Lr as mobileNetworkChartRecipe,Ir as mobileGeoChartRecipe,Fr as mobileSmallMultipleRecipe,Wr as mobileChartFamilyRecipe,Tr as mobileBrushAlternatives};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{renderRectPulse as t}from"./chunk-chunk-F7WFPD4O.module.min.js";import{buildLinearFillGradient as e,clampCornerRadii as n,filterSparseArray as s,hasAnyCornerRadius as i,resolveCSSColor as o,resolveCanvasFill as r,symbolPathString as l}from"./chunk-chunk-BFHUYEOS.module.min.js";var h=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(t){Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}evict(t){t!==this._min&&t!==this._max||(this._dirty=!0)}recalculate(t,e){this._min=1/0,this._max=-1/0;for(const n of t){const t=e?e(n):n;Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}},u=class{constructor(t,e){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=t,this.chunkThreshold=e?.chunkThreshold??5e3,this.chunkSize=e?.chunkSize??5e3}updateChunkOptions(t){null!=t.chunkThreshold&&(this.chunkThreshold=t.chunkThreshold),null!=t.chunkSize&&(this.chunkSize=t.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(t){if(t=s(t),this.lastBoundedData===t)return;if(this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const s=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,s),bounded:!1}),e=s,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(t){if(t=s(t),this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const s=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,s),bounded:!1}),e=s,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const t=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:t,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(t){null!=t&&"object"==typeof t&&(this.pushBuffer.push(t),this.scheduleFlush())}pushMany(t){if(0===t.length)return;let e=0;for(let n=0;t.length>n;n++){const s=t[n];null!=s&&"object"==typeof s&&(this.pushBuffer.push(s),e++)}0!==e&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}};function c(t,e){return t===e}function a(t,e){if("function"==typeof t)return e=>+t(e);const n=t||e;return t=>+t[n]}function f(t,e){if("function"==typeof t)return t;const n=t||e;return t=>t[n]}function y(t,e){return"function"==typeof t?t:t?e=>e[t]+"":e?t=>t[e]+"":void 0}function d(t,e,n,s){return"function"==typeof t?t({size:e,margin:n,scales:s}):t}function m(t,e,n,s){return"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:s,fn:e}:{key:void 0,fn:null}}function p(t,e,n){return s=>{if(!s||!n||!t.fn&&!e.fn)return s;let i=!1;const o=s.map(n=>{const s=t.fn&&t.key&&!(t.key in n),o=e.fn&&e.key&&!(e.key in n);if(!s&&!o)return n;i=!0;const r={...n};return s&&(r[t.key]=t.fn(n)),o&&(r[e.key]=e.fn(n)),r});return i?o:s}}function k(t){return new Set(Array.isArray(t)?t:[t])}function g(t,e,n){return"exact"===n?function(t,e){const n=t.domain(),s=n[0],i=n[n.length-1],o=s instanceof Date,r=s instanceof Date?s.getTime():s,l=i instanceof Date?i.getTime():i;if(2>e||r===l)return o?[new Date(r),new Date(l)]:[r,l];const h=(l-r)/(e-1),u=Array(e);for(let t=0;e>t;t++){const n=t===e-1?l:r+t*h;u[t]=o?new Date(n):n}return u}(t,e):t.ticks(e)}var T=new Map;function x(t){try{if(t.path)return new Path2D(t.path);const e=`${t.symbolType??"circle"}:${Math.round(t.size)}`;let n=T.get(e);return n||(n=new Path2D(l(t.symbolType,t.size)),T.size>256&&T.clear(),T.set(e,n)),n}catch{return null}}var b=(t,e)=>{const n=t.globalAlpha;for(const s of e){if("symbol"!==s.type)continue;const e=s;if(0>=e.size)continue;const i=x(e);if(!i)continue;t.save(),t.translate(e.x,e.y),e.rotation&&t.rotate(e.rotation);const o=(e.style.opacity??1)*(e._decayOpacity??1);e.style.fill&&(t.globalAlpha=n*o*(e.style.fillOpacity??1),t.fillStyle=r(t,e.style.fill,"#4e79a7"),t.fill(i)),e.style.stroke&&"none"!==e.style.stroke&&(t.globalAlpha=n*o,t.strokeStyle=r(t,e.style.stroke,e.style.stroke),t.lineWidth=e.style.strokeWidth??1,t.stroke(i)),t.restore()}t.globalAlpha=n};function w(t,e){const{x:s,y:i,w:o,h:r}=e,{tl:l,tr:h,br:u,bl:c}=n(e);t.beginPath(),t.moveTo(s+l,i),t.lineTo(s+o-h,i),h>0&&t.arcTo(s+o,i,s+o,i+h,h),t.lineTo(s+o,i+r-u),u>0&&t.arcTo(s+o,i+r,s+o-u,i+r,u),t.lineTo(s+c,i+r),c>0&&t.arcTo(s,i+r,s,i+r-c,c),t.lineTo(s,i+l),l>0&&t.arcTo(s,i,s+l,i,l),t.closePath()}function v(t){switch(t.roundedEdge){case"bottom":return{x0:t.x,y0:t.y+t.h,x1:t.x,y1:t.y};case"right":return{x0:t.x+t.w,y0:t.y,x1:t.x,y1:t.y};case"left":return{x0:t.x,y0:t.y,x1:t.x+t.w,y1:t.y};default:return{x0:t.x,y0:t.y,x1:t.x,y1:t.y+t.h}}}var F=(n,s,l,h)=>{const u=s.filter(t=>"rect"===t.type);for(const s of u){if(null!=s.style.opacity&&(n.globalAlpha=s.style.opacity),s.style.icon)S(n,s);else if(s.cornerRadii&&i(s.cornerRadii)){const t=r(n,s.style.fill,o(n,"var(--semiotic-primary, #007bff)")),i=v(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,i.x0,i.y0,i.x1,i.y1):null;n.fillStyle=l||t,w(n,s),n.fill(),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=o(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.stroke())}else if(s.roundedTop&&s.roundedTop>0){const t=r(n,s.style.fill,o(n,"var(--semiotic-primary, #007bff)")),i=v(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,i.x0,i.y0,i.x1,i.y1):null;n.fillStyle=l||t;const h=Math.min(s.roundedTop,s.w/2,s.h/2);n.beginPath();const{x:u,y:c,w:a,h:f}=s;switch(s.roundedEdge){case"right":n.moveTo(u,c),n.lineTo(u+a-h,c),n.arcTo(u+a,c,u+a,c+h,h),n.lineTo(u+a,c+f-h),n.arcTo(u+a,c+f,u+a-h,c+f,h),n.lineTo(u,c+f);break;case"left":n.moveTo(u+a,c),n.lineTo(u+h,c),n.arcTo(u,c,u,c+h,h),n.lineTo(u,c+f-h),n.arcTo(u,c+f,u+h,c+f,h),n.lineTo(u+a,c+f);break;case"bottom":n.moveTo(u,c),n.lineTo(u+a,c),n.lineTo(u+a,c+f-h),n.arcTo(u+a,c+f,u+a-h,c+f,h),n.lineTo(u+h,c+f),n.arcTo(u,c+f,u,c+f-h,h);break;default:n.moveTo(u,c+f),n.lineTo(u,c+h),n.arcTo(u,c,u+h,c,h),n.lineTo(u+a-h,c),n.arcTo(u+a,c,u+a,c+h,h),n.lineTo(u+a,c+f)}n.closePath(),n.fill(),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=o(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.stroke())}else{const t=r(n,s.style.fill,o(n,"var(--semiotic-primary, #007bff)")),i=v(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,i.x0,i.y0,i.x1,i.y1):null;n.fillStyle=l||t,n.fillRect(s.x,s.y,s.w,s.h),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=o(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.strokeRect(s.x,s.y,s.w,s.h))}t(n,s),n.globalAlpha=1}};function S(t,e){const n=e.style.icon,s=e.style.iconPadding||2,i=Math.min(e.w,e.h)-s;if(0>=i)return;const o=e.h>e.w;if(t.save(),t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip(),o){const o=i+s,r=e.x+(e.w-i)/2;for(let s=e.y+e.h-i;s>=e.y-i;s-=o)t.drawImage(n,r,s,i,i)}else{const o=i+s,r=e.y+(e.h-i)/2;for(let s=e.x;e.x+e.w>s;s+=o)t.drawImage(n,s,r,i,i)}t.restore()}function _(t,e,n,s,i,o){const r=[];for(const i of t){const t=n(i),o=s(i);Number.isFinite(t)&&Number.isFinite(o)&&r.push({px:e.x(t),py:e.y(o),rawY:o,d:i})}r.sort((t,e)=>t.px-e.px);const l=Array(r.length),h=Array(r.length),u=Array(r.length);for(let t=0;r.length>t;t++){const e=r[t];l[t]=[e.px,e.py],h[t]=e.rawY,u[t]=e.d}return{type:"line",path:l,rawValues:h,style:i,datum:u,group:o}}function A(t,e,n,s,i,o,r,l){const h=[];for(const o of t){const t=n(o),r=s(o);if(!Number.isFinite(t)||!Number.isFinite(r))continue;const u=e.x(t),c=l?l(o):i;h.push({px:u,topY:e.y(r),botY:e.y(c)})}h.sort((t,e)=>t.px-e.px);const u=Array(h.length),c=Array(h.length);for(let t=0;h.length>t;t++){const e=h[t];u[t]=[e.px,e.topY],c[t]=[e.px,e.botY]}return{type:"area",topPath:u,bottomPath:c,style:o,datum:t,group:r}}function B(t,e,n,s){const i=new Map;if("silhouette"===s)for(const s of t){let t=0;for(const i of e)t+=n(i,s)||0;i.set(s,-t/2)}else if("wiggle"===s){t.length>0&&i.set(t[0],0);for(let s=1;t.length>s;s++){const o=t[s-1],r=t[s];let l=0,h=0,u=0;for(const t of e){const e=n(t,r)||0;l+=(2*u+e)*(e-(n(t,o)||0)),h+=e,u+=e}const c=i.get(o)??0;i.set(r,c-(h>0?l/(2*h):0))}if(t.length>0){let s=0;for(const o of t){let t=0;for(const s of e)t+=n(s,o)||0;s+=(i.get(o)??0)+t/2}const o=s/t.length;for(const e of t)i.set(e,(i.get(e)??0)-o)}}else for(const e of t)i.set(e,0);return i}function z(t,e,n){let s=0,i=0;for(const o of t){let t=0,r=0;for(const s of e){const e=n(s,o)||0;0>e?r+=e:t+=e}s>r&&(s=r),t>i&&(i=t)}return[s,i]}function D(t,e,n,s,i,o,r,l="zero"){const h=new Set;for(const e of t)for(const t of e.data){const e=n(t);Number.isFinite(e)&&h.add(e)}const u=Array.from(h).sort((t,e)=>t-e),c=new Map;for(const e of t){const t=new Map;for(const i of e.data){const e=n(i),o=s(i);Number.isFinite(e)&&Number.isFinite(o)&&t.set(e,(t.get(e)||0)+o)}c.set(e.key,t)}let a;if(o){a=new Map;for(const e of u){let n=0;for(const s of t)n+=c.get(s.key)?.get(e)||0;a.set(e,n||1)}}const f=B(u,t.map(t=>t.key),(t,e)=>c.get(t)?.get(e)||0,l),y="diverging"===l&&!o,d=[],m=new Map,p=new Map,k=new Map,g=new Map;for(const t of u)p.set(t,f.get(t)??0),k.set(t,0),g.set(t,0);for(const n of t){const t=c.get(n.key),s=new Map;let l=[],h=[];const f=()=>{if(l.length>=2){const t={type:"area",topPath:l,bottomPath:h,style:i(n.key,n.data[0]),datum:n.data,group:n.key};r&&(t.curve=r),d.push(t)}l=[],h=[]};for(const n of u){const i=t.has(n);let r,u,c=i?t.get(n):0;if(o&&i&&(c/=a.get(n)),!i||!Number.isFinite(c)||0===c){f();continue}y?c>0?(r=k.get(n),u=r+c,k.set(n,u)):(r=g.get(n),u=r+c,g.set(n,u)):(r=p.get(n),u=r+c,p.set(n,u));const d=e.x(n);h.push([d,e.y(r)]),l.push([d,e.y(u)]),s.set(n,u)}f(),m.set(n.key,s)}return{nodes:d,stackedTops:m}}function M(t,e,n,s,i,o,r){const l=n(t),h=s(t);if(!Number.isFinite(l)||!Number.isFinite(h))return null;const u={type:"point",x:e.x(l),y:e.y(h),r:i,style:o,datum:t};return void 0!==r&&(u.pointId=r),u}function P(t,e,n,s,i,o,r,l){const h=n(t),u=s(t);if(!Number.isFinite(h)||!Number.isFinite(u))return null;const c={type:"symbol",x:e.x(h),y:e.y(u),size:i,symbolType:o,style:r,datum:t};return void 0!==l&&(c.pointId=l),c}function N(t,e,n,s,i,o,r){return{type:"rect",x:t,y:e,w:n,h:s,style:i,datum:o,group:r}}function W(t,e,n,s,i,o,r){const l={type:"heatcell",x:t,y:e,w:n,h:s,fill:i,datum:o};return r?.showValues&&(l.showValues=!0,l.value=r.value,r.valueFormat&&(l.valueFormat=r.valueFormat)),l}export{u as DataSourceAdapter,h as IncrementalExtent,c as accessorsEquivalent,a as resolveAccessor,f as resolveRawAccessor,y as resolveStringAccessor,k as toIdSet,_ as buildLineNode,A as buildAreaNode,B as computeStackOffsets,z as computeDivergingStackExtent,D as buildStackedAreaNodes,M as buildPointNode,P as buildSymbolNode,N as buildRectNode,W as buildHeatcellNode,g as ticksForMode,d as resolveFrameGraphics,m as resolveAnnotationAccessor,p as buildEnrichAnnotationData,b as symbolCanvasRenderer,F as barCanvasRenderer};
|
|
2
|
+
import{renderRectPulse as t}from"./chunk-chunk-XXWSHGPL.module.min.js";import{buildLinearFillGradient as e,clampCornerRadii as n,filterSparseArray as s,hasAnyCornerRadius as i,resolveCSSColor as o,resolveCanvasFill as r,symbolPathString as l}from"./chunk-chunk-CWQ5YIHX.module.min.js";var h=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(t){Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}evict(t){t!==this._min&&t!==this._max||(this._dirty=!0)}recalculate(t,e){this._min=1/0,this._max=-1/0;for(const n of t){const t=e?e(n):n;Number.isFinite(t)&&(this._min>t&&(this._min=t),t>this._max&&(this._max=t))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}},u=class{constructor(t,e){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=t,this.chunkThreshold=e?.chunkThreshold??5e3,this.chunkSize=e?.chunkSize??5e3}updateChunkOptions(t){null!=t.chunkThreshold&&(this.chunkThreshold=t.chunkThreshold),null!=t.chunkSize&&(this.chunkSize=t.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(t){if(t=s(t),this.lastBoundedData===t)return;if(this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const s=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,s),bounded:!1}),e=s,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(t){if(t=s(t),this.lastBoundedData=t,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=t.length)return void this.callback({inserts:t,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:t.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:t.length});let e=this.chunkSize;const n=()=>{if(e>=t.length)return void(this.chunkTimer=0);if(t!==this.lastBoundedData)return void(this.chunkTimer=0);const s=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,s),bounded:!1}),e=s,this.chunkTimer=t.length>e?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const t=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:t,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(t){null!=t&&"object"==typeof t&&(this.pushBuffer.push(t),this.scheduleFlush())}pushMany(t){if(0===t.length)return;let e=0;for(let n=0;t.length>n;n++){const s=t[n];null!=s&&"object"==typeof s&&(this.pushBuffer.push(s),e++)}0!==e&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}};function c(t,e){return t===e}function a(t,e){if("function"==typeof t)return e=>+t(e);const n=t||e;return t=>+t[n]}function f(t,e){if("function"==typeof t)return t;const n=t||e;return t=>t[n]}function y(t,e){return"function"==typeof t?t:t?e=>e[t]+"":e?t=>t[e]+"":void 0}function d(t,e,n,s){return"function"==typeof t?t({size:e,margin:n,scales:s}):t}function m(t,e,n,s){return"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:n,fn:t}:"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:s,fn:e}:{key:void 0,fn:null}}function p(t,e,n){return s=>{if(!s||!n||!t.fn&&!e.fn)return s;let i=!1;const o=s.map(n=>{const s=t.fn&&t.key&&!(t.key in n),o=e.fn&&e.key&&!(e.key in n);if(!s&&!o)return n;i=!0;const r={...n};return s&&(r[t.key]=t.fn(n)),o&&(r[e.key]=e.fn(n)),r});return i?o:s}}function k(t){return new Set(Array.isArray(t)?t:[t])}function g(t,e,n){return"exact"===n?function(t,e){const n=t.domain(),s=n[0],i=n[n.length-1],o=s instanceof Date,r=s instanceof Date?s.getTime():s,l=i instanceof Date?i.getTime():i;if(2>e||r===l)return o?[new Date(r),new Date(l)]:[r,l];const h=(l-r)/(e-1),u=Array(e);for(let t=0;e>t;t++){const n=t===e-1?l:r+t*h;u[t]=o?new Date(n):n}return u}(t,e):t.ticks(e)}var T=new Map;function x(t){try{if(t.path)return new Path2D(t.path);const e=`${t.symbolType??"circle"}:${Math.round(t.size)}`;let n=T.get(e);return n||(n=new Path2D(l(t.symbolType,t.size)),T.size>256&&T.clear(),T.set(e,n)),n}catch{return null}}var b=(t,e)=>{const n=t.globalAlpha;for(const s of e){if("symbol"!==s.type)continue;const e=s;if(0>=e.size)continue;const i=x(e);if(!i)continue;t.save(),t.translate(e.x,e.y),e.rotation&&t.rotate(e.rotation);const o=(e.style.opacity??1)*(e._decayOpacity??1);e.style.fill&&(t.globalAlpha=n*o*(e.style.fillOpacity??1),t.fillStyle=r(t,e.style.fill,"#4e79a7"),t.fill(i)),e.style.stroke&&"none"!==e.style.stroke&&(t.globalAlpha=n*o,t.strokeStyle=r(t,e.style.stroke,e.style.stroke),t.lineWidth=e.style.strokeWidth??1,t.stroke(i)),t.restore()}t.globalAlpha=n};function w(t,e){const{x:s,y:i,w:o,h:r}=e,{tl:l,tr:h,br:u,bl:c}=n(e);t.beginPath(),t.moveTo(s+l,i),t.lineTo(s+o-h,i),h>0&&t.arcTo(s+o,i,s+o,i+h,h),t.lineTo(s+o,i+r-u),u>0&&t.arcTo(s+o,i+r,s+o-u,i+r,u),t.lineTo(s+c,i+r),c>0&&t.arcTo(s,i+r,s,i+r-c,c),t.lineTo(s,i+l),l>0&&t.arcTo(s,i,s+l,i,l),t.closePath()}function v(t){switch(t.roundedEdge){case"bottom":return{x0:t.x,y0:t.y+t.h,x1:t.x,y1:t.y};case"right":return{x0:t.x+t.w,y0:t.y,x1:t.x,y1:t.y};case"left":return{x0:t.x,y0:t.y,x1:t.x+t.w,y1:t.y};default:return{x0:t.x,y0:t.y,x1:t.x,y1:t.y+t.h}}}var S=(n,s,l,h)=>{const u=s.filter(t=>"rect"===t.type);for(const s of u){if(null!=s.style.opacity&&(n.globalAlpha=s.style.opacity),s.style.icon)F(n,s);else if(s.cornerRadii&&i(s.cornerRadii)){const t=r(n,s.style.fill,o(n,"var(--semiotic-primary, #007bff)")),i=v(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,i.x0,i.y0,i.x1,i.y1):null;n.fillStyle=l||t,w(n,s),n.fill(),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=o(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.stroke())}else if(s.roundedTop&&s.roundedTop>0){const t=r(n,s.style.fill,o(n,"var(--semiotic-primary, #007bff)")),i=v(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,i.x0,i.y0,i.x1,i.y1):null;n.fillStyle=l||t;const h=Math.min(s.roundedTop,s.w/2,s.h/2);n.beginPath();const{x:u,y:c,w:a,h:f}=s;switch(s.roundedEdge){case"right":n.moveTo(u,c),n.lineTo(u+a-h,c),n.arcTo(u+a,c,u+a,c+h,h),n.lineTo(u+a,c+f-h),n.arcTo(u+a,c+f,u+a-h,c+f,h),n.lineTo(u,c+f);break;case"left":n.moveTo(u+a,c),n.lineTo(u+h,c),n.arcTo(u,c,u,c+h,h),n.lineTo(u,c+f-h),n.arcTo(u,c+f,u+h,c+f,h),n.lineTo(u+a,c+f);break;case"bottom":n.moveTo(u,c),n.lineTo(u+a,c),n.lineTo(u+a,c+f-h),n.arcTo(u+a,c+f,u+a-h,c+f,h),n.lineTo(u+h,c+f),n.arcTo(u,c+f,u,c+f-h,h);break;default:n.moveTo(u,c+f),n.lineTo(u,c+h),n.arcTo(u,c,u+h,c,h),n.lineTo(u+a-h,c),n.arcTo(u+a,c,u+a,c+h,h),n.lineTo(u+a,c+f)}n.closePath(),n.fill(),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=o(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.stroke())}else{const t=r(n,s.style.fill,o(n,"var(--semiotic-primary, #007bff)")),i=v(s),l=s.fillGradient&&"string"==typeof t?e(n,s.fillGradient,t,i.x0,i.y0,i.x1,i.y1):null;n.fillStyle=l||t,n.fillRect(s.x,s.y,s.w,s.h),s.style.stroke&&"none"!==s.style.stroke&&(n.strokeStyle=o(n,s.style.stroke)||s.style.stroke,n.lineWidth=s.style.strokeWidth||1,n.strokeRect(s.x,s.y,s.w,s.h))}t(n,s),n.globalAlpha=1}};function F(t,e){const n=e.style.icon,s=e.style.iconPadding||2,i=Math.min(e.w,e.h)-s;if(0>=i)return;const o=e.h>e.w;if(t.save(),t.beginPath(),t.rect(e.x,e.y,e.w,e.h),t.clip(),o){const o=i+s,r=e.x+(e.w-i)/2;for(let s=e.y+e.h-i;s>=e.y-i;s-=o)t.drawImage(n,r,s,i,i)}else{const o=i+s,r=e.y+(e.h-i)/2;for(let s=e.x;e.x+e.w>s;s+=o)t.drawImage(n,s,r,i,i)}t.restore()}function _(t,e,n,s,i,o){const r=[];for(const i of t){const t=n(i),o=s(i);Number.isFinite(t)&&Number.isFinite(o)&&r.push({px:e.x(t),py:e.y(o),rawY:o,d:i})}r.sort((t,e)=>t.px-e.px);const l=Array(r.length),h=Array(r.length),u=Array(r.length);for(let t=0;r.length>t;t++){const e=r[t];l[t]=[e.px,e.py],h[t]=e.rawY,u[t]=e.d}return{type:"line",path:l,rawValues:h,style:i,datum:u,group:o}}function A(t,e,n,s,i,o,r,l){const h=[];for(const o of t){const t=n(o),r=s(o);if(!Number.isFinite(t)||!Number.isFinite(r))continue;const u=e.x(t),c=l?l(o):i;h.push({px:u,topY:e.y(r),botY:e.y(c)})}h.sort((t,e)=>t.px-e.px);const u=Array(h.length),c=Array(h.length);for(let t=0;h.length>t;t++){const e=h[t];u[t]=[e.px,e.topY],c[t]=[e.px,e.botY]}return{type:"area",topPath:u,bottomPath:c,style:o,datum:t,group:r}}function B(t,e,n,s){const i=new Map;if("silhouette"===s)for(const s of t){let t=0;for(const i of e)t+=n(i,s)||0;i.set(s,-t/2)}else if("wiggle"===s){t.length>0&&i.set(t[0],0);for(let s=1;t.length>s;s++){const o=t[s-1],r=t[s];let l=0,h=0,u=0;for(const t of e){const e=n(t,r)||0;l+=(2*u+e)*(e-(n(t,o)||0)),h+=e,u+=e}const c=i.get(o)??0;i.set(r,c-(h>0?l/(2*h):0))}if(t.length>0){let s=0;for(const o of t){let t=0;for(const s of e)t+=n(s,o)||0;s+=(i.get(o)??0)+t/2}const o=s/t.length;for(const e of t)i.set(e,(i.get(e)??0)-o)}}else for(const e of t)i.set(e,0);return i}function z(t,e,n){let s=0,i=0;for(const o of t){let t=0,r=0;for(const s of e){const e=n(s,o)||0;0>e?r+=e:t+=e}s>r&&(s=r),t>i&&(i=t)}return[s,i]}function D(t,e,n,s,i,o,r,l="zero"){const h=new Set;for(const e of t)for(const t of e.data){const e=n(t);Number.isFinite(e)&&h.add(e)}const u=Array.from(h).sort((t,e)=>t-e),c=new Map;for(const e of t){const t=new Map;for(const i of e.data){const e=n(i),o=s(i);Number.isFinite(e)&&Number.isFinite(o)&&t.set(e,(t.get(e)||0)+o)}c.set(e.key,t)}let a;if(o){a=new Map;for(const e of u){let n=0;for(const s of t)n+=c.get(s.key)?.get(e)||0;a.set(e,n||1)}}const f=B(u,t.map(t=>t.key),(t,e)=>c.get(t)?.get(e)||0,l),y="diverging"===l&&!o,d=[],m=new Map,p=new Map,k=new Map,g=new Map;for(const t of u)p.set(t,f.get(t)??0),k.set(t,0),g.set(t,0);for(const n of t){const t=c.get(n.key),s=new Map;let l=[],h=[];const f=()=>{if(l.length>=2){const t={type:"area",topPath:l,bottomPath:h,style:i(n.key,n.data[0]),datum:n.data,group:n.key};r&&(t.curve=r),d.push(t)}l=[],h=[]};for(const n of u){const i=t.has(n);let r,u,c=i?t.get(n):0;if(o&&i&&(c/=a.get(n)),!i||!Number.isFinite(c)||0===c){f();continue}y?c>0?(r=k.get(n),u=r+c,k.set(n,u)):(r=g.get(n),u=r+c,g.set(n,u)):(r=p.get(n),u=r+c,p.set(n,u));const d=e.x(n);h.push([d,e.y(r)]),l.push([d,e.y(u)]),s.set(n,u)}f(),m.set(n.key,s)}return{nodes:d,stackedTops:m}}function M(t,e,n,s,i,o,r){const l=n(t),h=s(t);if(!Number.isFinite(l)||!Number.isFinite(h))return null;const u={type:"point",x:e.x(l),y:e.y(h),r:i,style:o,datum:t};return void 0!==r&&(u.pointId=r),u}function P(t,e,n,s,i,o,r,l){const h=n(t),u=s(t);if(!Number.isFinite(h)||!Number.isFinite(u))return null;const c={type:"symbol",x:e.x(h),y:e.y(u),size:i,symbolType:o,style:r,datum:t};return void 0!==l&&(c.pointId=l),c}function N(t,e,n,s,i,o,r){return{type:"rect",x:t,y:e,w:n,h:s,style:i,datum:o,group:r}}function W(t,e,n,s,i,o,r){const l={type:"heatcell",x:t,y:e,w:n,h:s,fill:i,datum:o};return r?.showValues&&(l.showValues=!0,l.value=r.value,r.valueFormat&&(l.valueFormat=r.valueFormat)),l}export{u as DataSourceAdapter,h as IncrementalExtent,c as accessorsEquivalent,a as resolveAccessor,f as resolveRawAccessor,y as resolveStringAccessor,k as toIdSet,_ as buildLineNode,A as buildAreaNode,B as computeStackOffsets,z as computeDivergingStackExtent,D as buildStackedAreaNodes,M as buildPointNode,P as buildSymbolNode,N as buildRectNode,W as buildHeatcellNode,g as ticksForMode,d as resolveFrameGraphics,m as resolveAnnotationAccessor,p as buildEnrichAnnotationData,b as symbolCanvasRenderer,S as barCanvasRenderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{resolveCategoricalPalette as t,resolveExplicitColor as r}from"./chunk-chunk-
|
|
2
|
+
import{resolveCategoricalPalette as t,resolveExplicitColor as r}from"./chunk-chunk-CWQ5YIHX.module.min.js";function e(r,e,n){return t(r,e,n)}function n(t,e){const n=e&&"object"==typeof e&&!Array.isArray(e)?e:void 0;return 0===t.length?t=>n&&r(n,t)||"#4e79a7":e=>{if(n){const t=r(n,e);if(t)return t}let o=0;for(let t=0;e.length>t;t++)o=31*o+e.charCodeAt(t)|0;return t[Math.abs(o)%t.length]??"#4e79a7"}}export{e as resolveCustomLayoutPalette,n as buildResolveColor};
|