semiotic 3.10.2 → 3.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +21 -26
  2. package/ai/artifact-surface-inventory.json +1 -1
  3. package/ai/behaviorContracts.cjs +15 -5
  4. package/ai/behaviorContracts.d.cts +3 -0
  5. package/ai/cli.js +17 -166
  6. package/ai/componentMetadata.cjs +68 -15
  7. package/ai/componentMetadata.d.cts +3 -0
  8. package/ai/dist/diagnose-operation.js +3 -0
  9. package/ai/dist/mcp-server.js +59 -59
  10. package/ai/reference.md +6 -6
  11. package/ai/schema.json +1 -1
  12. package/ai/surface-manifest.json +1 -1
  13. package/ai/system-prompt.md +2 -2
  14. package/ai/task-packets/compare-category-totals.json +7 -7
  15. package/ai/task-packets/compare-category-totals.md +3 -3
  16. package/ai/task-packets/correct-published-chart.json +7 -7
  17. package/ai/task-packets/correct-published-chart.md +3 -3
  18. package/ai/task-packets/index.json +6 -6
  19. package/ai/task-packets/update-live-chart.json +7 -7
  20. package/ai/task-packets/update-live-chart.md +3 -3
  21. package/dist/c-2MHSD3TN.min.js +209 -0
  22. package/dist/{c-PZ3NEGNG.min.js → c-6XGGN5OS.min.js} +1 -1
  23. package/dist/{c-FDUQDCBC.min.js → c-CO4NDAD6.min.js} +23 -23
  24. package/dist/c-EK6XI2U7.min.js +26 -0
  25. package/dist/c-FMCUQ6JX.min.js +1 -0
  26. package/dist/{c-C4KIXUWU.min.js → c-GK263BF4.min.js} +1 -1
  27. package/dist/{c-TTKWXGAI.min.js → c-HNHKIMIV.min.js} +3 -3
  28. package/dist/c-IJCZGUG6.min.js +31 -0
  29. package/dist/{c-4XLHPQTP.min.js → c-JBWPJNTJ.min.js} +1 -1
  30. package/dist/{c-4MD53L2J.min.js → c-JC76YAHB.min.js} +28 -28
  31. package/dist/{c-VXIYF7V2.min.js → c-JOPGDP6N.min.js} +1 -1
  32. package/dist/c-KWP4QTCM.min.js +4 -0
  33. package/dist/c-LRV7PO45.min.js +393 -0
  34. package/dist/c-LVHJJUOF.min.js +1 -0
  35. package/dist/c-M43PK7K4.min.js +1 -0
  36. package/dist/c-NUBZ63VU.min.js +1 -0
  37. package/dist/{c-7ASK4WBF.min.js → c-PITYSOPK.min.js} +1 -1
  38. package/dist/{c-2TW5H5PD.min.js → c-QPO24R7Q.min.js} +1 -1
  39. package/dist/{c-SG2Y7EBY.min.js → c-RWHLEUX6.min.js} +1 -1
  40. package/dist/{c-4JKDJUYD.min.js → c-S746GRV4.min.js} +1 -1
  41. package/dist/{c-KGROWFT2.min.js → c-SAP5KY6R.min.js} +2 -2
  42. package/dist/c-UMGHCBH5.min.js +114 -0
  43. package/dist/c-UQBWSYKI.min.js +41 -0
  44. package/dist/{c-6ZU3QVLB.min.js → c-VEMCBQZZ.min.js} +33 -33
  45. package/dist/{c-IPYGNVN6.min.js → c-WD2RL76M.min.js} +45 -45
  46. package/dist/{c-PQOZPM4G.min.js → c-YL7HJL5J.min.js} +1 -1
  47. package/dist/c-Z6GRGS53.min.js +1 -0
  48. package/dist/components/CategoryColors.d.ts +7 -0
  49. package/dist/components/LinkedCharts.d.ts +2 -1
  50. package/dist/components/ai/chartClinic.d.ts +1 -1
  51. package/dist/components/ai/chartClinicMetadata.generated.d.ts +2 -2
  52. package/dist/components/charts/shared/{chartDefinitionPilot.d.ts → chartDefinition.d.ts} +30 -34
  53. package/dist/components/charts/shared/chartDefinitions.d.ts +10 -0
  54. package/dist/components/charts/shared/chartDefinitionsNetwork.d.ts +17 -0
  55. package/dist/components/charts/shared/chartDefinitionsOrdinal.d.ts +23 -0
  56. package/dist/components/charts/shared/chartDefinitionsPhysics.d.ts +17 -0
  57. package/dist/components/charts/shared/chartDefinitionsRealtime.d.ts +12 -0
  58. package/dist/components/charts/shared/chartDefinitionsXY.d.ts +26 -0
  59. package/dist/components/charts/shared/useChartSetup.d.ts +1 -1
  60. package/dist/components/charts/shared/useNetworkChartSetup.d.ts +1 -1
  61. package/dist/components/data/transforms.d.ts +1 -0
  62. package/dist/components/server/serverChartConfigs.d.ts +36 -36
  63. package/dist/components/server/serverChartConfigsNetwork.generated.d.ts +17 -0
  64. package/dist/components/server/serverChartConfigsOrdinal.generated.d.ts +23 -0
  65. package/dist/components/server/serverChartConfigsPhysics.generated.d.ts +17 -0
  66. package/dist/components/server/serverChartConfigsRealtime.generated.d.ts +13 -0
  67. package/dist/components/server/serverChartConfigsXY.generated.d.ts +22 -0
  68. package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +5 -0
  69. package/dist/geo.min.js +3 -3
  70. package/dist/geo.module.min.js +10 -10
  71. package/dist/network.module.min.js +1 -1
  72. package/dist/ordinal.module.min.js +1 -1
  73. package/dist/physics-matter.min.js +4 -1
  74. package/dist/physics-matter.module.min.js +1 -1
  75. package/dist/physics-rapier.min.js +4 -1
  76. package/dist/physics-rapier.module.min.js +1 -1
  77. package/dist/physics.module.min.js +1 -1
  78. package/dist/physicsWorker.js +1 -1
  79. package/dist/semiotic-ai-core.min.js +3 -3
  80. package/dist/semiotic-ai-core.module.min.js +3 -3
  81. package/dist/semiotic-ai.module.min.js +7 -7
  82. package/dist/semiotic-artifact.min.js +1 -1
  83. package/dist/semiotic-artifact.module.min.js +1 -1
  84. package/dist/semiotic-atlas-selection.module.min.js +1 -1
  85. package/dist/semiotic-client-cjs-shared.min.js +903 -902
  86. package/dist/semiotic-data.min.js +1 -1
  87. package/dist/semiotic-data.module.min.js +1 -1
  88. package/dist/semiotic-experimental-auxiliary.module.min.js +3 -3
  89. package/dist/semiotic-experimental-node-auxiliary.module.min.js +3 -3
  90. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  91. package/dist/semiotic-line.module.min.js +1 -1
  92. package/dist/semiotic-realtime-core.module.min.js +1 -1
  93. package/dist/semiotic-recipes-core-cjs-base.min.js +1 -1
  94. package/dist/semiotic-recipes-core.module.min.js +13 -13
  95. package/dist/semiotic-server-edge-node.module.min.js +393 -391
  96. package/dist/semiotic-server-edge.min.js +393 -391
  97. package/dist/semiotic-server-edge.module.min.js +374 -372
  98. package/dist/semiotic-server-node.min.js +393 -391
  99. package/dist/semiotic-server-node.module.min.js +1 -1
  100. package/dist/semiotic-utils-core.min.js +1 -1
  101. package/dist/semiotic-utils-core.module.min.js +1 -1
  102. package/dist/semiotic.module.min.js +10 -10
  103. package/dist/server.min.js +393 -391
  104. package/dist/server.module.min.js +1 -1
  105. package/dist/xy.module.min.js +1 -1
  106. package/package.json +12 -8
  107. package/dist/c-3OFVBWQY.min.js +0 -1
  108. package/dist/c-6IVBV5NO.min.js +0 -1
  109. package/dist/c-72CBVNYX.min.js +0 -209
  110. package/dist/c-7LY46QUI.min.js +0 -41
  111. package/dist/c-AKLBQMQF.min.js +0 -391
  112. package/dist/c-F2GGJB2S.min.js +0 -31
  113. package/dist/c-G53AVC42.min.js +0 -113
  114. package/dist/c-HQ27AHMC.min.js +0 -1
  115. package/dist/c-IHWZ2C6D.min.js +0 -26
  116. package/dist/c-MOP2NGLH.min.js +0 -1
  117. package/dist/c-PKY4JFY5.min.js +0 -1
  118. package/dist/c-UBHICVSC.min.js +0 -1
@@ -0,0 +1 @@
1
+ function o(o){throw Error("Cannot resolve module worker asset: "+o)}export{o as a};
@@ -0,0 +1 @@
1
+ function e(e){let[t,a]=e,n=160>t||116>a,r=n?Math.min(12,Math.max(2,.08*t)):32,i=n?Math.min(8,Math.max(2,.12*a)):24,l=n?i:34;return{width:t,height:a,plot:{x:r,y:i,width:Math.max(1,t-2*r),height:Math.max(1,a-i-l)}}}function t(e){let t=(e??"")+"";if(!t)return"#4e79a7";let a=["#4e79a7","#59a14f","#e15759","#f28e2b","#76b7b2","#edc948","#b07aa1","#ff9da7"],n=0;for(let e=0;t.length>e;e+=1)n=31*n+t.charCodeAt(e)>>>0;return a[n%a.length]}function a(e,t){return t?(a,n)=>({..."function"==typeof e?e(a,n):e,..."function"==typeof t?t(a,n):t}):e}function n(e,a="#4e79a7",n){let r=n?.styleRules,i=!!r&&r.length>0,l=i?b(n?.valueAccessor):void 0;return n=>{let o=n.datum,u=o&&e?"function"==typeof e?e(o,0):o[e]:void 0,s={fill:null==u?a:t(u),stroke:"#111827",strokeWidth:1,opacity:.9};return i&&o&&Object.assign(s,v(o,r,{value:l?l(o):void 0,category:null==u?void 0:u+""})),s}}function r(e,t,a,n){return{fixedDt:1/120,maxSubsteps:8,colliders:t,observation:{chartType:a},kernel:{seed:e,gravity:{x:0,y:760},cellSize:36,collisionIterations:6,velocityDamping:.995,restitution:.08,friction:.4,sleepSpeed:8,sleepAfter:.6,...n}}}function i(t,a,n){if(!t.length)return[];let r=e(a),i=r.plot.width/Math.max(1,t.length),l=t.reduce((e,t)=>Math.max(e,t.value),1),o=.62*r.plot.height,u=r.plot.y+r.plot.height;return t.map((e,t)=>{let a=Math.max(8,e.value/l*o),s=`${n} ${e.label}: ${e.value}${null==e.secondary?"":`, ${e.secondary} secondary`}`;return{id:`${n}-${e.label}`,label:s,description:s,datum:e,x:r.plot.x+(t+.5)*i,y:u-a/2,shape:"rect",width:Math.max(12,.58*i),height:a,group:n}})}function l(e,t,a){return"function"==typeof a?a(e,t):e[a]}function o(e){if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)?t:null}let t="number"==typeof e?e:"string"==typeof e&&e.trim()?Number(e):NaN;return Number.isFinite(t)?t:null}function u(e,t,a){return Math.max(t,Math.min(a,e))}function s(e,t){let a=o(e);return null!=a&&a>0?a:t}function c(e){if(!e)return;let t=o(e[0]),a=o(e[1]);return null!=t&&null!=a?t>a?[a,t]:[t,a]:void 0}function h(e){return((e??"unknown")+"").trim().replace(/[^A-Za-z0-9_-]+/g,"_")||"unknown"}function f(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}function m(e,t,a=0){let n=new Set(e.filter(e=>null!=e.id).map(e=>e.id+"")),r=/* @__PURE__ */new Map;for(let i of e){let e=null==i.id?`${t}-${a++}`:i.id+"";for(;null==i.id&&n.has(e);)e=`${t}-${a++}`;n.add(e),r.set(e,null==i.id?{...i,id:e}:i)}return{seed:e,rows:Array.from(r.values()),nextId:a}}function d(e={}){let t=(e.categories?.length?e.categories:["Intake","Review","Build","Ship"]).map(e=>(e+"").trim()).filter(Boolean),a=t.length?t:["Intake"],n=Math.max(a.length,Math.round(e.count??Math.max(48,12*a.length))),r=s(e.unitValue,1),i=f(e.seed??1),l=e.idPrefix??"mechanical-pile",o=a.map(()=>.65+.9*i()),u=o.reduce((e,t)=>e+t,0)||1,c=n-a.length,h=o.map(e=>e/u*c),m=h.map(e=>1+Math.floor(e)),d=n-m.reduce((e,t)=>e+t,0),p=h.map((e,t)=>({index:t,fraction:e-Math.floor(e)})).sort((e,t)=>t.fraction-e.fraction);for(let e=0;d>0;e=(e+1)%p.length)m[p[e].index]+=1,d-=1;return a.map((e,t)=>({id:`${l}-${t}`,category:e,value:m[t]*r,mechanical:!0,unitCount:m[t],unitValue:r,share:m[t]/n}))}function p(e,t){let a=e/t,n=Math.round(a);return Math.ceil(n>0&&Number.EPSILON*a*4>=Math.abs(a-n)?n:a)}function g(e){let t=Math.max(2,Math.round(e.bins)),a=Math.max(1,Math.round(e.pegRows??t-1)),n=Math.max(1,Math.round(e.count??Math.max(64,4*t))),r=u(Number.isFinite(e.branchProbability)?e.branchProbability??.5:.5,0,1),i=f(e.seed??1),l=e.idPrefix??"mechanical";return Array.from({length:n},(e,t)=>{let n=0;for(let e=0;a>e;e+=1)i()<r&&(n+=1);let o=a/2;return{id:`${l}-${t}`,value:n,mechanical:!0,pegRows:a,branchProbability:r,pathRights:n,side:o>n?"left":n>o?"right":"center"}})}function M(e){let{windowSize:t,watermark:a,watermarkAtArrivalAccessor:n}=e;if(!Number.isFinite(t)||0>=t)throw new RangeError("EventDrop windows.size must be a finite positive number");let{rows:r}=m(e.data,"event"),i=r.flatMap((t,a)=>{let n=o(l(t,a,e.timeAccessor));return null==n?[]:[{datum:t,index:a,eventTime:n,arrivalTime:o(l(t,a,e.arrivalAccessor))??n,watermarkAtArrival:0,late:!1}]}),u="function"==typeof a?null:o(a?.value),s="function"==typeof a?t:o(a?.delay)??t,c=-1/0,h=-1/0;for(let e of i.slice().sort((e,t)=>e.arrivalTime-t.arrivalTime||e.index-t.index)){c=Math.max(c,e.eventTime);let r="function"==typeof a?o(a(c)):c-s;h=u??Math.max(h,r??c-t);let i=n?o(l(e.datum,e.index,n)):null;e.watermarkAtArrival=i??h,e.late=e.watermarkAtArrival>=(Math.floor(e.eventTime/t)+1)*t}return{events:i,watermarkValue:i.length?h:u??-s}}import{Ob as b,Tb as v}from"./c-UMGHCBH5.min.js";export{e as a,a as b,n as c,r as d,i as e,l as f,o as g,u as h,s as i,c as j,h as k,f as l,m,d as n,p as o,g as p,M as q};
@@ -0,0 +1 @@
1
+ function e(){return"string"==typeof import.meta.url&&import.meta.url?new Worker(new URL("./forceLayoutWorker.js",import.meta.url),{type:"module",name:"semiotic-force-layout"}):new Worker(m("forceLayoutWorker.js"),{type:"module",name:"semiotic-force-layout"})}function r(){c.resetForTest()}function t(e,r){return n()?c.get().request(e,r):Promise.reject(Error("Web Workers are unavailable"))}import{a as s,b as o,c as a,d as i}from"./c-HLGTD5SJ.min.js";import{d as n}from"./c-YMFUIO54.min.js";import{a as m}from"./c-LVHJJUOF.min.js";var u=class{constructor(r=e()){this.session=new a({name:"Force layout",createWorker:()=>r,terminateOnAbort:!0,parseMessage:e=>{let r=e,{requestId:t,error:a}=o(r);return a?{requestId:t,ok:!1,error:s(a)}:{requestId:t,ok:!0,payload:{positions:r.positions??{}}}}})}get isDead(){return this.session.isDead}request(e,r){return this.session.request(e,r)}terminate(){this.session.terminate()}},c=i(()=>new u);export{e as a,u as b,r as c,t as d};
@@ -1 +1 @@
1
- function e(){d(h),d(g),d(v)}function t(e){let{colorBy:t,colorScale:o,color:r,pointRadius:a=5,radiusFn:i,fillOpacity:n=1,fallbackFill:s,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:f,effectiveSelectionHook:p,resolvedSelection:m,colorDatumAccessor:y,selectionDatumAccessor:d,styleRules:h,ruleContext:g}=e,v=$(()=>e=>{let c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=n),void 0===u.fill)if(t){if(o){let r=y?y(e):e;u.fill=T(r,t,o)}}else u.fill=s?s(e):r||G;return void 0===u.r&&(u.r=i?i(e):a),h&&h.length>0&&Object.assign(u,B(e,h,g?g(e):{value:void 0})),u},[t,o,r,a,i,n,s,l,y,h,g]),b=$(()=>L(v,{stroke:c,strokeWidth:u,opacity:f}),[v,c,u,f]);return $(()=>F(b,p??null,m,d),[b,p,m,d])}function o(e){let{lineWidth:t=2,colorBy:o,colorScale:r,color:a,resolveStroke:i,fillArea:n,areaOpacity:s=.3,styleRules:l,ruleContext:c}=e;return(e,u)=>{let f,p={strokeWidth:t},m=!0===n||Array.isArray(n)&&null!=u&&n.includes(u);return i?f=i(e,u):o?r&&(f=T(e,o,r)):f=a||G,void 0!==f&&(p.stroke=f,m&&(p.fill=f,p.fillOpacity=s)),l?.length&&Object.assign(p,B(e,l,c?c(e,u):{value:void 0,category:u})),p}}function r(e){let{lineWidth:t=2,colorBy:r,colorScale:a,color:i,resolveStroke:n,fillArea:s,areaOpacity:l=.3,stroke:c,strokeWidth:u,opacity:f,effectiveSelectionHook:p,resolvedSelection:m,styleRules:y,ruleContext:d}=e,h=X(()=>o({lineWidth:t,colorBy:r,colorScale:a,color:i,resolveStroke:n,fillArea:s,areaOpacity:l,styleRules:y,ruleContext:d}),[t,r,a,i,n,s,l,y,d]),g=X(()=>L(h,{stroke:c,strokeWidth:u,opacity:f}),[h,c,u,f]);return X(()=>F(g,p??null,m),[g,p,m])}async function a(){return U||(U=await(import("./c-JJKRER47.min.js"))),U}async function i(...e){return(await a()).buildForecast(...e)}async function n(...e){return(await a()).buildAnomalyAnnotations(...e)}async function s(...e){return(await a()).createSegmentLineStyle(...e)}function l(e){let{data:t,xAccessor:o,yAccessor:r,forecast:a,anomaly:s,groupBy:l}=e,c="string"==typeof o?o:ee,u="string"==typeof r?r:te,f=q(()=>{if(!a&&!s)return t;let e="function"==typeof o,i="function"==typeof r;return e||i?t.map(t=>{let a={...t};return e&&(a[ee]=o(t)),i&&(a[te]=r(t)),a}):t},[t,a,s,o,r]),[p,m]=Z(null),[y,d]=Z([]),h=Q(a),g=Q(s);return V(()=>{if(!a&&!s)return void((h.current||g.current)&&(m(null),d([]),h.current=a,g.current=s));let e=!1,t=a!==h.current||s!==g.current;if(h.current=a,g.current=s,t&&(m(null),d([])),a){let t=l&&"string"==typeof l&&"object"==typeof a?{...a,_groupBy:l}:a;i(f,c,u,t,s).then(t=>{e||(m(t),d(t.annotations))}).catch(()=>{e||(m(null),d([]))})}else s&&n(s).then(t=>{e||(m(null),d(t))}).catch(()=>{e||d([])});return()=>{e=!0}},[f,a,s,c,u,l]),{effectiveData:p?p.processedData:t,statisticalAnnotations:y,hasForecast:!!p,xAccessorKey:c,yAccessorKey:u}}import{b as c}from"./c-IBRLFKWA.min.js";import{b as u,c as f}from"./c-HQ27AHMC.min.js";import{a as p,d as m,e as y}from"./c-TTKWXGAI.min.js";import{a as d,h,j as g,k as v}from"./c-MTX2AO5S.min.js";import{k as b}from"./c-HK4OSLZA.min.js";import{H as A,J as x,K as S,Y as k,_ as L}from"./c-KGROWFT2.min.js";import{Mb as C,Ob as w,Sa as R,Sb as B,Ua as _,_a as H,ab as D,b as j,db as O,jb as F,v as P,z as W}from"./c-G53AVC42.min.js";import{n as G,r as T}from"./c-Y342FJ6K.min.js";import{c as I}from"./c-U6NLVFN4.min.js";import{useMemo as N,useCallback as M,useState as E,useEffect as K,forwardRef as z,useRef as J}from"react";import{useMemo as $}from"react";import{useMemo as X}from"react";var Y="__forecastSegment",U=null;import{useEffect as V,useMemo as q,useRef as Q,useState as Z}from"react";var ee="__semiotic_resolvedX",te="__semiotic_resolvedY";import{jsx as oe}from"react/jsx-runtime";e();var re="__lineObjectSeries",ae=e=>e.parentLine||e,ie=z(function(e,o){let a=J(null);f(o,{variant:"xy",frameRef:a});let i=C(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:d,className:h,xFormat:g,yFormat:v,axisExtent:L,xAccessor:B="x",yAccessor:F="y",lineBy:T,lineDataAccessor:z="coordinates",colorBy:$,colorScheme:X,styleRules:U,curve:V="linear",showPoints:q=!1,pointRadius:Q=3,fillArea:Z=!1,areaOpacity:ee=.3,lineWidth:te=2,lineGradient:ie,tooltip:ne,pointIdAccessor:se,annotations:le,directLabel:ce,gapStrategy:ue="break",anomaly:fe,forecast:pe,band:me,xExtent:ye,yExtent:de,frameProps:he={},selection:ge,linkedHover:ve,linkedBrush:be,brush:Ae,onBrush:xe,onObservation:Se,onClick:ke,hoverHighlight:Le,hoverRadius:Ce,chartId:we,loading:Re,loadingContent:Be,emptyContent:_e,legendInteraction:He,legendPosition:De,legend:je,xScaleType:Oe,yScaleType:Fe,color:Pe,stroke:We,strokeWidth:Ge,opacity:Te}=e,{legend:Ie,...Ne}=he,Me=N(()=>P(Ie,je),[Ie,je]),{width:Ee,height:Ke,enableHover:ze,showGrid:Je,showLegend:$e,title:Xe,description:Ye,summary:Ue,accessibleTable:Ve,xLabel:qe,yLabel:Qe}=i,Ze=N(()=>j(n),[n]),et=Array.isArray(Ze[0]?.[z])?Ze[0][z]:Ze;O("LineChart",et,"xAccessor",B),O("LineChart",et,"yAccessor",F);let{effectiveData:tt,statisticalAnnotations:ot}=l({data:Ze,xAccessor:B,yAccessor:F,forecast:pe,anomaly:fe,groupBy:T}),rt="__compoundGroup",at=!(!pe||!T),it=at?rt:pe?Y:T,nt=N(()=>{if(!at)return tt;let e="function"==typeof T?T:e=>e[T];return tt.map(t=>{let o={...t};return o[rt]=`${e(t)}__${t[Y]||"observed"}`,o})},[tt,at,T]),st=at?nt:tt,lt=$||T,ct=N(()=>{if(!pe)return;let e=pe.upperBounds,t=pe.lowerBounds;if(!e&&!t)return;let o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,r="function"==typeof t?t:"string"==typeof t?e=>e[t]:null,a=1/0,i=-1/0,n=tt;for(let e of n){let t="function"==typeof F?F(e):+e[F];if(isFinite(t)&&(a>t&&(a=t),t>i&&(i=t)),o){let t=o(e);null!=t&&isFinite(t)&&(t>i&&(i=t),a>t&&(a=t))}if(r){let t=r(e);null!=t&&isFinite(t)&&(a>t&&(a=t),t>i&&(i=t))}}return isFinite(a)&&isFinite(i)?[a,i]:void 0},[pe,tt,F]),ut=M(e=>{let t="function"==typeof B?B(e):e[B],o="function"==typeof F?F(e):e[F];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[B,F]),ft=void 0!==st[0]?.[z],pt=ft?re:it,mt=N(()=>{if(ft)return st.map((e,t)=>{let o="function"==typeof T?T(e):"string"==typeof T?e[T]:void 0,r=null==o?"line-"+t:o+"",a=Array.isArray(e[z])?e[z]:[];return{...e,[re]:r,[z]:a.map(t=>({...t,[re]:r,parentLine:e,..."string"==typeof T&&void 0!==e[T]?{[T]:e[T]}:{}}))}});if(it){let e=st.reduce((e,t)=>{let o="function"==typeof it?it(t):t[it];if(!e[o]){let r={[z]:[]};"string"==typeof it&&(r[it]=o),at&&(r[Y]=t[Y],"string"==typeof T&&(r[T]=t[T])),e[o]=r}return e[o][z].push(t),e},{});return Object.values(e)}return[{[z]:st}]},[ft,it,z,st,T,at]),{gapProcessedLineData:yt,hasGaps:dt}=N(()=>{if("interpolate"===ue){let e=!1,t=[];for(let o of mt){let r=(o[z]||[]).filter(t=>!ut(t)||(e=!0,!1));r.length>0&&t.push({...o,[z]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===ue){let e=!1,t=[];for(let o of mt){let r=o[z]||[],a=[],i=0,n=pt&&"string"==typeof pt?o[pt]:void 0;for(let s of r)if(ut(s))e=!0,a.length>0&&(t.push({...o,[z]:a}),a=[],i++);else{let e=null!=n?`${n}__seg${i}`:"__seg"+i;a.push({...s,_gapSegment:e})}a.length>0&&t.push({...o,[z]:a})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===ue){let e=!1,t="string"==typeof F?F:"y",o=[];for(let r of mt){let a=r[z]||[],i=[];for(let o of a)ut(o)?(e=!0,i.push({...o,[t]:0})):i.push(o);o.push({...r,[z]:i})}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:mt,hasGaps:!1}},[mt,ue,z,ut,pt,F]),ht="object"==typeof ce?ce:{},gt=ht.position||"end",vt=ht.fontSize||11,bt=u({data:tt,rawData:n,colorBy:lt,colorScheme:X,legendInteraction:He,legendPosition:De,frameLegend:Ne,selection:ge,linkedHover:ve,fallbackFields:lt?["string"==typeof lt?lt:""]:[],unwrapData:!1,onObservation:Se,onClick:ke,hoverHighlight:Le,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"LineChart",chartId:we,showLegend:(!ce||void 0!==$e)&&$e,legend:Me,userMargin:d,marginDefaults:i.marginDefaults,loading:Re,loadingContent:Be,emptyContent:_e,width:Ee,height:Ke,hasTitle:!!Xe,axisChrome:W(he,{showAxes:i.showAxes,xLabel:qe,yLabel:Qe})}),At=bt.categoryColorScale,xt=bt.effectiveSelectionHook,St=bt.resolvedSelection,kt=bt.customHoverBehavior,Lt=bt.customClickBehavior,Ct=bt.crosshairProps,wt=N(()=>{if(lt)return ft?e=>{let t=e.parentLine||e;return"function"==typeof lt?lt(t):t[lt]}:lt},[lt,ft]),Rt=N(()=>w(B,F),[B,F]),Bt=r({lineWidth:te,colorBy:wt,colorScale:At,color:Pe,fillArea:Z,areaOpacity:ee,stroke:We,strokeWidth:Ge,opacity:Te,effectiveSelectionHook:xt,resolvedSelection:St,styleRules:U,ruleContext:Rt}),[_t,Ht]=E(null);K(()=>{if(!pe)return void Ht(null);let e=!1;return s(Bt,pe).then(t=>{e||Ht(()=>t)}).catch(()=>{e||Ht(null)}),()=>{e=!0}},[Bt,pe]);let Dt=_t||Bt,jt=t({colorBy:lt,colorScale:At,color:Pe,pointRadius:Q,colorDatumAccessor:ae,selectionDatumAccessor:I,effectiveSelectionHook:xt,resolvedSelection:St}),Ot=Array.isArray(Z)?"mixed":Z?"area":"line",Ft=N(()=>{if(!ce||!lt)return[];let e={position:gt,fontSize:vt,colorBy:lt,color:e=>At?.(e)??G};return void 0===n?[{type:"text",_directLabelRequest:e}]:p(yt.flatMap(e=>(e[z]||[]).map(t=>({...t,parentLine:t.parentLine||e}))),e,B,F)},[n,ce,lt,At,yt,z,B,F,gt,vt]),Pt=N(()=>{if(!ce)return bt.margin;let e="end"===gt?"right":"left";if("number"==typeof d||"number"==typeof d?.[e])return bt.margin;let t=(void 0===n?bt.allCategories:Ft.map(e=>e.label+"")).reduce((e,t)=>Math.max(e,Array.from(t).length*vt*.65),0);return{...bt.margin,[e]:Math.max(bt.margin[e],t+10)}},[n,ce,Ft,gt,vt,d,bt.margin,bt.allCategories]),Wt=T||$,Gt=N(()=>S([{label:qe||A(B),accessor:B,role:"x",format:g},{label:Qe||A(F),accessor:F,role:"y",format:v},...Wt?[{label:A(Wt),accessor:Wt,role:"group"}]:[],...x(me,v)]),[B,F,qe,Qe,Wt,g,v,me]),Tt=c({componentName:"LineChart",data:ft?tt[0]?.[z]||[]:n,accessors:{xAccessor:B,yAccessor:F}}),{brushStreamProps:It}=y({brush:Ae,onBrush:xe,linkedBrush:be,xAccessor:B,yAccessor:F,defaultDimension:"x"}),Nt=N(()=>ft||pt||dt?yt.flatMap(e=>{let t=e[z]||[];return pt&&"string"==typeof pt?t.map(t=>({...t,[pt]:t[pt]??e[pt]})):t}):st,[yt,z,ft,pt,st,dt]),Mt=b(ie),Et={chartType:Ot,...Array.isArray(Z)&&{areaGroups:Z},...Mt&&{lineGradient:Mt},...null!=n&&{data:Nt},xAccessor:B,yAccessor:F,xScaleType:Oe,yScaleType:Fe,...ye&&{xExtent:ye},...!de||null==de[0]&&null==de[1]?ct?{yExtent:ct}:{}:{yExtent:de},groupAccessor:"break"===ue&&dt?"_gapSegment":pt||void 0,...me&&{band:me},curve:V,lineStyle:Dt,...q&&{pointStyle:jt},size:[Ee,Ke],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,...void 0!==e.maxDevicePixelRatio&&{maxDevicePixelRatio:e.maxDevicePixelRatio},margin:Pt,showAxes:i.showAxes,xLabel:qe,yLabel:Qe,xFormat:g,yFormat:v,...void 0!==L&&{axisExtent:L},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:ze,showGrid:Je,...bt.legendBehaviorProps,...Xe&&{title:Xe},...Ye&&{description:Ye},...Ue&&{summary:Ue},...void 0!==Ve&&{accessibleTable:Ve},...h&&{className:h},...null!=e.animate&&{animate:e.animate},...R({tooltip:ne,defaultTooltipContent:Gt,multiDefaultContent:_()}),...k({linkedHover:ve,selection:ge,onObservation:Se,onClick:ke,hoverRadius:Ce,hoverHighlight:Le,mobileInteraction:bt.mobileInteraction,customHoverBehavior:kt,customClickBehavior:Lt}),...se&&{pointIdAccessor:se},...(le?.length||ot.length||Ft.length)&&{annotations:[...le||[],...ot,...Ft]},...Ct,...It,...Ne};return bt.earlyReturn?bt.earlyReturn:Tt?/* @__PURE__ */oe(H,{componentName:"LineChart",message:Tt,width:Ee,height:Ke}):/* @__PURE__ */oe(D,{componentName:"LineChart",width:Ee,height:Ke,children:/* @__PURE__ */oe(m,{ref:a,...Et})})});ie.displayName="LineChart";export{t as a,l as b,e as c,r as d,ie as e};
1
+ function e(){d(h),d(g),d(v)}function t(e){let{colorBy:t,colorScale:o,color:r,pointRadius:a=5,radiusFn:i,fillOpacity:n=1,fallbackFill:s,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:f,effectiveSelectionHook:p,resolvedSelection:m,colorDatumAccessor:y,selectionDatumAccessor:d,styleRules:h,ruleContext:g}=e,v=U(()=>e=>{let c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=n),void 0===u.fill)if(t){if(o){let r=y?y(e):e;u.fill=W(r,t,o)}}else u.fill=s?s(e):r||I;return void 0===u.r&&(u.r=i?i(e):a),h&&h.length>0&&Object.assign(u,B(e,h,g?g(e):{value:void 0})),u},[t,o,r,a,i,n,s,l,y,h,g]),b=U(()=>L(v,{stroke:c,strokeWidth:u,opacity:f}),[v,c,u,f]);return U(()=>F(b,p??null,m,d),[b,p,m,d])}function o(e){let{lineWidth:t=2,colorBy:o,colorScale:r,color:a,resolveStroke:i,fillArea:n,areaOpacity:s=.3,styleRules:l,ruleContext:c}=e;return(e,u)=>{let f,p={strokeWidth:t},m=!0===n||Array.isArray(n)&&null!=u&&n.includes(u);return i?f=i(e,u):o?r&&(f=W(e,o,r)):f=a||I,void 0!==f&&(p.stroke=f,m&&(p.fill=f,p.fillOpacity=s)),l?.length&&Object.assign(p,B(e,l,c?c(e,u):{value:void 0,category:u})),p}}function r(e){let{lineWidth:t=2,colorBy:r,colorScale:a,color:i,resolveStroke:n,fillArea:s,areaOpacity:l=.3,stroke:c,strokeWidth:u,opacity:f,effectiveSelectionHook:p,resolvedSelection:m,styleRules:y,ruleContext:d}=e,h=Y(()=>o({lineWidth:t,colorBy:r,colorScale:a,color:i,resolveStroke:n,fillArea:s,areaOpacity:l,styleRules:y,ruleContext:d}),[t,r,a,i,n,s,l,y,d]),g=Y(()=>L(h,{stroke:c,strokeWidth:u,opacity:f}),[h,c,u,f]);return Y(()=>F(g,p??null,m),[g,p,m])}async function a(){return X||(X=await(import("./c-JJKRER47.min.js"))),X}async function i(...e){return(await a()).buildForecast(...e)}async function n(...e){return(await a()).buildAnomalyAnnotations(...e)}async function s(...e){return(await a()).createSegmentLineStyle(...e)}function l(e){let{data:t,xAccessor:o,yAccessor:r,forecast:a,anomaly:s,groupBy:l}=e,c="string"==typeof o?o:ee,u="string"==typeof r?r:te,f=q(()=>{if(!a&&!s)return t;let e="function"==typeof o,i="function"==typeof r;return e||i?t.map(t=>{let a={...t};return e&&(a[ee]=o(t)),i&&(a[te]=r(t)),a}):t},[t,a,s,o,r]),[p,m]=Z(null),[y,d]=Z([]),h=Q(a),g=Q(s);return V(()=>{if(!a&&!s)return void((h.current||g.current)&&(m(null),d([]),h.current=a,g.current=s));let e=!1,t=a!==h.current||s!==g.current;if(h.current=a,g.current=s,t&&(m(null),d([])),a){let t=l&&"string"==typeof l&&"object"==typeof a?{...a,_groupBy:l}:a;i(f,c,u,t,s).then(t=>{e||(m(t),d(t.annotations))}).catch(()=>{e||(m(null),d([]))})}else s&&n(s).then(t=>{e||(m(null),d(t))}).catch(()=>{e||d([])});return()=>{e=!0}},[f,a,s,c,u,l]),{effectiveData:p?p.processedData:t,statisticalAnnotations:y,hasForecast:!!p,xAccessorKey:c,yAccessorKey:u}}import{b as c}from"./c-IBRLFKWA.min.js";import{b as u,c as f}from"./c-FMCUQ6JX.min.js";import{a as p,d as m,e as y}from"./c-HNHKIMIV.min.js";import{a as d,h,j as g,k as v}from"./c-MTX2AO5S.min.js";import{k as b}from"./c-HK4OSLZA.min.js";import{H as x,J as A,K as S,Y as k,_ as L}from"./c-SAP5KY6R.min.js";import{Nb as C,Pb as w,Sa as R,Tb as B,Ua as H,_a as _,ab as D,b as P,db as j,kb as F,v as O,z as N}from"./c-UMGHCBH5.min.js";import{n as I,r as W}from"./c-Y342FJ6K.min.js";import{c as G}from"./c-U6NLVFN4.min.js";import{useMemo as T,useCallback as M,useState as E,useEffect as K,forwardRef as z,useRef as J}from"react";import{useMemo as U}from"react";import{useMemo as Y}from"react";var $="__forecastSegment",X=null;import{useEffect as V,useMemo as q,useRef as Q,useState as Z}from"react";var ee="__semiotic_resolvedX",te="__semiotic_resolvedY";import{jsx as oe}from"react/jsx-runtime";e();var re="__lineObjectSeries",ae=e=>e.parentLine||e,ie=z(function(e,o){let a=J(null);f(o,{variant:"xy",frameRef:a});let i=C(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:n,margin:d,className:h,xFormat:g,yFormat:v,axisExtent:L,xAccessor:B="x",yAccessor:F="y",lineBy:W,lineDataAccessor:z="coordinates",colorBy:U,colorScheme:Y,styleRules:X,curve:V="linear",showPoints:q=!1,pointRadius:Q=3,fillArea:Z=!1,areaOpacity:ee=.3,lineWidth:te=2,lineGradient:ie,tooltip:ne,pointIdAccessor:se,annotations:le,directLabel:ce,gapStrategy:ue="break",anomaly:fe,forecast:pe,band:me,xExtent:ye,yExtent:de,frameProps:he={},selection:ge,linkedHover:ve,linkedBrush:be,brush:xe,onBrush:Ae,onObservation:Se,onClick:ke,hoverHighlight:Le,hoverRadius:Ce,chartId:we,loading:Re,loadingContent:Be,emptyContent:He,legendInteraction:_e,legendPosition:De,legend:Pe,xScaleType:je,yScaleType:Fe,color:Oe,stroke:Ne,strokeWidth:Ie,opacity:We}=e,{legend:Ge,...Te}=he,Me=T(()=>O(Ge,Pe),[Ge,Pe]),{width:Ee,height:Ke,enableHover:ze,showGrid:Je,showLegend:Ue,title:Ye,description:$e,summary:Xe,accessibleTable:Ve,xLabel:qe,yLabel:Qe}=i,Ze=T(()=>P(n),[n]),et=Array.isArray(Ze[0]?.[z])?Ze[0][z]:Ze;j("LineChart",et,"xAccessor",B),j("LineChart",et,"yAccessor",F);let{effectiveData:tt,statisticalAnnotations:ot}=l({data:Ze,xAccessor:B,yAccessor:F,forecast:pe,anomaly:fe,groupBy:W}),rt="__compoundGroup",at=!(!pe||!W),it=at?rt:pe?$:W,nt=T(()=>{if(!at)return tt;let e="function"==typeof W?W:e=>e[W];return tt.map(t=>{let o={...t};return o[rt]=`${e(t)}__${t[$]||"observed"}`,o})},[tt,at,W]),st=at?nt:tt,lt=U||W,ct=T(()=>{if(!pe)return;let e=pe.upperBounds,t=pe.lowerBounds;if(!e&&!t)return;let o="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,r="function"==typeof t?t:"string"==typeof t?e=>e[t]:null,a=1/0,i=-1/0,n=tt;for(let e of n){let t="function"==typeof F?F(e):+e[F];if(isFinite(t)&&(a>t&&(a=t),t>i&&(i=t)),o){let t=o(e);null!=t&&isFinite(t)&&(t>i&&(i=t),a>t&&(a=t))}if(r){let t=r(e);null!=t&&isFinite(t)&&(a>t&&(a=t),t>i&&(i=t))}}return isFinite(a)&&isFinite(i)?[a,i]:void 0},[pe,tt,F]),ut=M(e=>{let t="function"==typeof B?B(e):e[B],o="function"==typeof F?F(e):e[F];return null==t||null==o||Number.isNaN(t)||Number.isNaN(o)},[B,F]),ft=void 0!==st[0]?.[z],pt=ft?re:it,mt=T(()=>{if(ft)return st.map((e,t)=>{let o="function"==typeof W?W(e):"string"==typeof W?e[W]:void 0,r=null==o?"line-"+t:o+"",a=Array.isArray(e[z])?e[z]:[];return{...e,[re]:r,[z]:a.map(t=>({...t,[re]:r,parentLine:e,..."string"==typeof W&&void 0!==e[W]?{[W]:e[W]}:{}}))}});if(it){let e=st.reduce((e,t)=>{let o="function"==typeof it?it(t):t[it];if(!e[o]){let r={[z]:[]};"string"==typeof it&&(r[it]=o),at&&(r[$]=t[$],"string"==typeof W&&(r[W]=t[W])),e[o]=r}return e[o][z].push(t),e},{});return Object.values(e)}return[{[z]:st}]},[ft,it,z,st,W,at]),{gapProcessedLineData:yt,hasGaps:dt}=T(()=>{if("interpolate"===ue){let e=!1,t=[];for(let o of mt){let r=(o[z]||[]).filter(t=>!ut(t)||(e=!0,!1));r.length>0&&t.push({...o,[z]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===ue){let e=!1,t=[];for(let o of mt){let r=o[z]||[],a=[],i=0,n=pt&&"string"==typeof pt?o[pt]:void 0;for(let s of r)if(ut(s))e=!0,a.length>0&&(t.push({...o,[z]:a}),a=[],i++);else{let e=null!=n?`${n}__seg${i}`:"__seg"+i;a.push({...s,_gapSegment:e})}a.length>0&&t.push({...o,[z]:a})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===ue){let e=!1,t="string"==typeof F?F:"y",o=[];for(let r of mt){let a=r[z]||[],i=[];for(let o of a)ut(o)?(e=!0,i.push({...o,[t]:0})):i.push(o);o.push({...r,[z]:i})}return{gapProcessedLineData:o,hasGaps:e}}return{gapProcessedLineData:mt,hasGaps:!1}},[mt,ue,z,ut,pt,F]),ht="object"==typeof ce?ce:{},gt=ht.position||"end",vt=ht.fontSize||11,bt=u({data:tt,rawData:n,colorBy:lt,colorScheme:Y,legendInteraction:_e,legendPosition:De,frameLegend:Te,selection:ge,linkedHover:ve,fallbackFields:lt?["string"==typeof lt?lt:""]:[],unwrapData:!1,onObservation:Se,onClick:ke,hoverHighlight:Le,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"LineChart",chartId:we,showLegend:(!ce||void 0!==Ue)&&Ue,legend:Me,userMargin:d,marginDefaults:i.marginDefaults,loading:Re,loadingContent:Be,emptyContent:He,width:Ee,height:Ke,hasTitle:!!Ye,axisChrome:N(he,{showAxes:i.showAxes,xLabel:qe,yLabel:Qe})}),xt=bt.categoryColorScale,At=bt.effectiveSelectionHook,St=bt.resolvedSelection,kt=bt.customHoverBehavior,Lt=bt.customClickBehavior,Ct=bt.crosshairProps,wt=T(()=>{if(lt)return ft?e=>{let t=e.parentLine||e;return"function"==typeof lt?lt(t):t[lt]}:lt},[lt,ft]),Rt=T(()=>w(B,F),[B,F]),Bt=r({lineWidth:te,colorBy:wt,colorScale:xt,color:Oe,fillArea:Z,areaOpacity:ee,stroke:Ne,strokeWidth:Ie,opacity:We,effectiveSelectionHook:At,resolvedSelection:St,styleRules:X,ruleContext:Rt}),[Ht,_t]=E(null);K(()=>{if(!pe)return void _t(null);let e=!1;return s(Bt,pe).then(t=>{e||_t(()=>t)}).catch(()=>{e||_t(null)}),()=>{e=!0}},[Bt,pe]);let Dt=Ht||Bt,Pt=t({colorBy:lt,colorScale:xt,color:Oe,pointRadius:Q,colorDatumAccessor:ae,selectionDatumAccessor:G,effectiveSelectionHook:At,resolvedSelection:St}),jt=Array.isArray(Z)?"mixed":Z?"area":"line",Ft=T(()=>{if(!ce||!lt)return[];let e={position:gt,fontSize:vt,colorBy:lt,color:e=>xt?.(e)??I};return void 0===n?[{type:"text",_directLabelRequest:e}]:p(yt.flatMap(e=>(e[z]||[]).map(t=>({...t,parentLine:t.parentLine||e}))),e,B,F)},[n,ce,lt,xt,yt,z,B,F,gt,vt]),Ot=T(()=>{if(!ce)return bt.margin;let e="end"===gt?"right":"left";if("number"==typeof d||"number"==typeof d?.[e])return bt.margin;let t=(void 0===n?bt.allCategories:Ft.map(e=>e.label+"")).reduce((e,t)=>Math.max(e,Array.from(t).length*vt*.65),0);return{...bt.margin,[e]:Math.max(bt.margin[e],t+10)}},[n,ce,Ft,gt,vt,d,bt.margin,bt.allCategories]),Nt=W||U,It=T(()=>S([{label:qe||x(B),accessor:B,role:"x",format:g},{label:Qe||x(F),accessor:F,role:"y",format:v},...Nt?[{label:x(Nt),accessor:Nt,role:"group"}]:[],...A(me,v)]),[B,F,qe,Qe,Nt,g,v,me]),Wt=c({componentName:"LineChart",data:ft?tt[0]?.[z]||[]:n,accessors:{xAccessor:B,yAccessor:F}}),{brushStreamProps:Gt}=y({brush:xe,onBrush:Ae,linkedBrush:be,xAccessor:B,yAccessor:F,defaultDimension:"x"}),Tt=T(()=>ft||pt||dt?yt.flatMap(e=>{let t=e[z]||[];return pt&&"string"==typeof pt?t.map(t=>({...t,[pt]:t[pt]??e[pt]})):t}):st,[yt,z,ft,pt,st,dt]),Mt=b(ie),Et={chartType:jt,...Array.isArray(Z)&&{areaGroups:Z},...Mt&&{lineGradient:Mt},...null!=n&&{data:Tt},xAccessor:B,yAccessor:F,xScaleType:je,yScaleType:Fe,...ye&&{xExtent:ye},...!de||null==de[0]&&null==de[1]?ct?{yExtent:ct}:{}:{yExtent:de},groupAccessor:"break"===ue&&dt?"_gapSegment":pt||void 0,...me&&{band:me},curve:V,lineStyle:Dt,...q&&{pointStyle:Pt},size:[Ee,Ke],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,...void 0!==e.maxDevicePixelRatio&&{maxDevicePixelRatio:e.maxDevicePixelRatio},margin:Ot,showAxes:i.showAxes,xLabel:qe,yLabel:Qe,xFormat:g,yFormat:v,...void 0!==L&&{axisExtent:L},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:ze,showGrid:Je,...bt.legendBehaviorProps,...Ye&&{title:Ye},...$e&&{description:$e},...Xe&&{summary:Xe},...void 0!==Ve&&{accessibleTable:Ve},...h&&{className:h},...null!=e.animate&&{animate:e.animate},...R({tooltip:ne,defaultTooltipContent:It,multiDefaultContent:H()}),...k({linkedHover:ve,selection:ge,onObservation:Se,onClick:ke,hoverRadius:Ce,hoverHighlight:Le,mobileInteraction:bt.mobileInteraction,customHoverBehavior:kt,customClickBehavior:Lt}),...se&&{pointIdAccessor:se},...(le?.length||ot.length||Ft.length)&&{annotations:[...le||[],...ot,...Ft]},...Ct,...Gt,...Te};return bt.earlyReturn?bt.earlyReturn:Wt?/* @__PURE__ */oe(_,{componentName:"LineChart",message:Wt,width:Ee,height:Ke}):/* @__PURE__ */oe(D,{componentName:"LineChart",width:Ee,height:Ke,children:/* @__PURE__ */oe(m,{ref:a,...Et})})});ie.displayName="LineChart";export{t as a,l as b,e as c,r as d,ie as e};
@@ -1 +1 @@
1
- function t(t){return t===1/0?1/0:Number.isFinite(t)?Math.max(0,Math.floor(t)):5e3}function e(t){return t===1/0?1/0:Number.isFinite(t)?Math.max(1,Math.floor(t)):5e3}function i(t,e,i,a){return"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:i,fn:t}:"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:a,fn:e}:{key:void 0,fn:null}}function a(t,e,i){return a=>{if(!a||!i||!t.fn&&!e.fn)return a;let r=!1,n=a.map(i=>{let a=t.fn&&t.key&&!(t.key in i),n=e.fn&&e.key&&!(e.key in i);if(!a&&!n)return i;r=!0;let h={...i};return a&&(h[t.key]=t.fn(i)),n&&(h[e.key]=e.fn(i)),h});return r?n:a}}function r(t,e){return t.__legendMarginReservedFor===e}function n(t,e){return{legendLayout:t.legendLayout,axisChrome:_({showAxes:t.showAxes,xLabel:t.xLabel,yLabel:t.yLabel,yLabelRight:t.yLabelRight,axes:t.axes}),legendMarginReserved:r(t,e)}}function h(t,e){return{legendLayout:t.legendLayout,axisChrome:g({showAxes:t.showAxes,projection:t.projection,hasCategoryLabel:!!(t.categoryLabel??t.oLabel),hasValueLabel:!!(t.valueLabel??t.rLabel)}),legendMarginReserved:r(t,e)}}function s(t){return new Set(Array.isArray(t)?t:[t])}function l(t){for(let e of t){if(void 0!==e._targetOpacity){let t=e._targetOpacity;e.style={...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0);else if("glyph"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0);else if("rect"===e.type||"heatcell"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0);else if("candlestick"===e.type)void 0!==e._targetX&&(e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0);else if("line"===e.type||"area"===e.type){if(e._introClipFraction=void 0,"line"===e.type&&e._targetPath){for(let t=0;e.path.length>t;t++)e.path[t]=e._targetPath[t];e._prevPath=void 0,e._targetPath=void 0}if("area"===e.type){if(e._targetTopPath)for(let t=0;e.topPath.length>t;t++)e.topPath[t]=e._targetTopPath[t];if(e._targetBottomPath)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=e._targetBottomPath[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0}}}}function u(t){for(let e of t){if(void 0!==e._targetOpacity){let t=e._targetOpacity;e.style={...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}"point"===e.type?void 0!==e._targetX?(e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0):void 0!==e._targetR&&(e.r=e._targetR,e._targetR=void 0):"rect"===e.type?void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0):"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0)}}function o(t,e){let i=t.domain(),a=i[0],r=i[i.length-1],n=a instanceof Date,h=a instanceof Date?a.getTime():a,s=r instanceof Date?r.getTime():r;if(2>e||h===s)return n?[new Date(h),new Date(s)]:[h,s];let l=(s-h)/(e-1),u=Array(e);for(let t=0;e>t;t++){let i=t===e-1?s:h+t*l;u[t]=n?new Date(i):i}return u}function d(t,e,i){return"exact"===i?o(t,e):t.ticks(e)}import{A as g,b as c,y as _}from"./c-G53AVC42.min.js";var f=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(let i of t){let t=e?e(i):i;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}},m=class{constructor(i,a){this.lastBoundedData=null,this.chunkTimer=null,this.pushBuffer=[],this.flushScheduled=!1,this.callback=i,this.chunkThreshold=t(a?.chunkThreshold),this.chunkSize=e(a?.chunkSize)}updateChunkOptions(i){this.chunkThreshold=t(i.chunkThreshold),this.chunkSize=e(i.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,null!==this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=null)}setBoundedData(t){if(t=c(t),this.lastBoundedData===t)return;if(this.lastBoundedData=t,null!==this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=null),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,i=()=>{if(e>=t.length)return void(this.chunkTimer=null);if(t!==this.lastBoundedData)return void(this.chunkTimer=null);let a=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,a),bounded:!1}),e=a,this.chunkTimer=t.length>e?requestAnimationFrame(i):null};this.chunkTimer=t.length>e?requestAnimationFrame(i):null}setReplacementData(t){if(t=c(t),this.lastBoundedData=t,null!==this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=null),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,i=()=>{if(e>=t.length)return void(this.chunkTimer=null);if(t!==this.lastBoundedData)return void(this.chunkTimer=null);let a=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,a),bounded:!1}),e=a,this.chunkTimer=t.length>e?requestAnimationFrame(i):null};this.chunkTimer=t.length>e?requestAnimationFrame(i):null}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;let 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 i=0;t.length>i;i++){let a=t[i];null==a||"object"!=typeof a||(this.pushBuffer.push(a),e++)}0!==e&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){null!==this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=null),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}};export{m as a,f as b,s as c,l as d,u as e,d as f,i as g,a as h,n as i,h as j};
1
+ function t(t){return t===1/0?1/0:Number.isFinite(t)?Math.max(0,Math.floor(t)):5e3}function e(t){return t===1/0?1/0:Number.isFinite(t)?Math.max(1,Math.floor(t)):5e3}function i(t,e,i,a){return"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:i,fn:t}:"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:a,fn:e}:{key:void 0,fn:null}}function a(t,e,i){return a=>{if(!a||!i||!t.fn&&!e.fn)return a;let r=!1,n=a.map(i=>{let a=t.fn&&t.key&&!(t.key in i),n=e.fn&&e.key&&!(e.key in i);if(!a&&!n)return i;r=!0;let h={...i};return a&&(h[t.key]=t.fn(i)),n&&(h[e.key]=e.fn(i)),h});return r?n:a}}function r(t,e){return t.__legendMarginReservedFor===e}function n(t,e){return{legendLayout:t.legendLayout,axisChrome:_({showAxes:t.showAxes,xLabel:t.xLabel,yLabel:t.yLabel,yLabelRight:t.yLabelRight,axes:t.axes}),legendMarginReserved:r(t,e)}}function h(t,e){return{legendLayout:t.legendLayout,axisChrome:g({showAxes:t.showAxes,projection:t.projection,hasCategoryLabel:!!(t.categoryLabel??t.oLabel),hasValueLabel:!!(t.valueLabel??t.rLabel)}),legendMarginReserved:r(t,e)}}function s(t){return new Set(Array.isArray(t)?t:[t])}function l(t){for(let e of t){if(void 0!==e._targetOpacity){let t=e._targetOpacity;e.style={...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0);else if("glyph"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0);else if("rect"===e.type||"heatcell"===e.type)void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0);else if("candlestick"===e.type)void 0!==e._targetX&&(e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0);else if("line"===e.type||"area"===e.type){if(e._introClipFraction=void 0,"line"===e.type&&e._targetPath){for(let t=0;e.path.length>t;t++)e.path[t]=e._targetPath[t];e._prevPath=void 0,e._targetPath=void 0}if("area"===e.type){if(e._targetTopPath)for(let t=0;e.topPath.length>t;t++)e.topPath[t]=e._targetTopPath[t];if(e._targetBottomPath)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=e._targetBottomPath[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0}}}}function u(t){for(let e of t){if(void 0!==e._targetOpacity){let t=e._targetOpacity;e.style={...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}"point"===e.type?void 0!==e._targetX?(e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0):void 0!==e._targetR&&(e.r=e._targetR,e._targetR=void 0):"rect"===e.type?void 0!==e._targetX&&(e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0):"wedge"===e.type&&void 0!==e._targetStartAngle&&(e.startAngle=e._targetStartAngle,e.endAngle=e._targetEndAngle,e._targetStartAngle=void 0,e._targetEndAngle=void 0)}}function o(t,e){let i=t.domain(),a=i[0],r=i[i.length-1],n=a instanceof Date,h=a instanceof Date?a.getTime():a,s=r instanceof Date?r.getTime():r;if(2>e||h===s)return n?[new Date(h),new Date(s)]:[h,s];let l=(s-h)/(e-1),u=Array(e);for(let t=0;e>t;t++){let i=t===e-1?s:h+t*l;u[t]=n?new Date(i):i}return u}function d(t,e,i){return"exact"===i?o(t,e):t.ticks(e)}import{A as g,b as c,y as _}from"./c-UMGHCBH5.min.js";var f=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(let i of t){let t=e?e(i):i;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}},m=class{constructor(i,a){this.lastBoundedData=null,this.chunkTimer=null,this.pushBuffer=[],this.flushScheduled=!1,this.callback=i,this.chunkThreshold=t(a?.chunkThreshold),this.chunkSize=e(a?.chunkSize)}updateChunkOptions(i){this.chunkThreshold=t(i.chunkThreshold),this.chunkSize=e(i.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,null!==this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=null)}setBoundedData(t){if(t=c(t),this.lastBoundedData===t)return;if(this.lastBoundedData=t,null!==this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=null),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,i=()=>{if(e>=t.length)return void(this.chunkTimer=null);if(t!==this.lastBoundedData)return void(this.chunkTimer=null);let a=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,a),bounded:!1}),e=a,this.chunkTimer=t.length>e?requestAnimationFrame(i):null};this.chunkTimer=t.length>e?requestAnimationFrame(i):null}setReplacementData(t){if(t=c(t),this.lastBoundedData=t,null!==this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=null),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,i=()=>{if(e>=t.length)return void(this.chunkTimer=null);if(t!==this.lastBoundedData)return void(this.chunkTimer=null);let a=Math.min(e+this.chunkSize,t.length);this.callback({inserts:t.slice(e,a),bounded:!1}),e=a,this.chunkTimer=t.length>e?requestAnimationFrame(i):null};this.chunkTimer=t.length>e?requestAnimationFrame(i):null}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;let 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 i=0;t.length>i;i++){let a=t[i];null==a||"object"!=typeof a||(this.pushBuffer.push(a),e++)}0!==e&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){null!==this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=null),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}};export{m as a,f as b,s as c,l as d,u as e,d as f,i as g,a as h,n as i,h as j};
@@ -31,7 +31,7 @@ return us("div",{ref:r,className:"stream-network-frame"+(g?" "+g:""),role:"img",
31
31
  return ys("div",{className:"semiotic-tooltip",style:or,children:[
32
32
  /* @__PURE__ */hs("div",{children:e.map((e,t)=>/* @__PURE__ */ys("span",{children:[t>0&&/* @__PURE__ */hs("span",{style:{margin:"0 3px",opacity:.5},children:" → "}),t===i?/* @__PURE__ */hs("strong",{children:e}):/* @__PURE__ */hs("span",{style:{opacity:.7},children:e})]},t))}),null!=t.value&&t.value>0&&/* @__PURE__ */hs("div",{style:{marginTop:4,opacity:.8},children:"number"==typeof t.value?t.value.toLocaleString():t.value+""})]})}let s=(t.sourceLinks?.length||0)+(t.targetLinks?.length||0),i=(t.sourceLinks||[]).reduce((e,t)=>e+(t.value||0),0)+(t.targetLinks||[]).reduce((e,t)=>e+(t.value||0),0),o=wt(t.data??t),n=null!=o.title?o.title+"":t.id,a=o.entries.some(e=>gs.test(e.key));/* @__PURE__ */
33
33
  return ys("div",{className:"semiotic-tooltip",style:or,children:[
34
- /* @__PURE__ */hs("div",{style:{fontWeight:600},children:n}),o.entries.map(e=>/* @__PURE__ */ys("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",Pe(e.value)]},e.key)),!a&&null!=t.value&&t.value>0&&/* @__PURE__ */ys("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),s>0&&/* @__PURE__ */ys("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",s,i!==s&&` (weighted: ${i.toLocaleString()})`]})]})}function Y(e){let{currentTheme:t,...r}=e;return{...r,themeCategorical:t?.colors?.categorical,themeSemantic:mr(t)}}function z(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function j(e,t){for(let r of t)switch(r.type){case"bezier":X(e,r);break;case"line":H(e,r);break;case"ribbon":$(e,r);break;case"curved":V(e,r)}}function X(e,t){if(!t.pathD)return;e.save();let r=z(t);if(t.style.fill&&"none"!==t.style.fill){let s=t._gradient;if(s){let r=e.createLinearGradient(s.x0,s.y0??0,s.x1,s.y1??0),i=t.style.fillOpacity??t.style.opacity??.5,o="string"==typeof t.style.fill?t.style.fill:"#999",n=yr(e,o)||o;r.addColorStop(0,1===s.from?n:"transparent"),r.addColorStop(1,1===s.to?n:"transparent"),e.fillStyle=r,e.globalAlpha=i}else e.fillStyle=fr(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(r)}t.style.stroke&&"none"!==t.style.stroke&&(t.style.strokeWidth??.5)>0&&(e.strokeStyle=yr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.5*(t.style.opacity??1),e.stroke(r)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(r)),e.restore()}function H(e,t){if("none"===t.style.stroke||0>=(t.style.strokeWidth??1))return;e.save();let r=t.style.stroke||"#999";e.strokeStyle=yr(e,r)||r,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(t.style.strokeWidth??1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function $(e,t){if(!t.pathD)return;e.save();let r=z(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=fr(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(t.style.strokeWidth??.5)>0&&(e.strokeStyle=yr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.3*(t.style.opacity??1),e.stroke(r)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(r)),e.restore()}function V(e,t){if(!t.pathD)return;e.save();let r=z(t);if("none"!==t.style.stroke&&(t.style.strokeWidth??1)>0){let s=t.style.stroke||"#999";e.strokeStyle=yr(e,s)||s,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r)}t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=fr(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(r)),e.restore()}function G(e,t){for(let r of t){if("rect"!==r.type)continue;let t=r;0>=t.w||0>=t.h||(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),lr(e,t.style,"#007bff",()=>e.fillRect(t.x,t.y,t.w,t.h)),dr(e,t.style,()=>e.strokeRect(t.x,t.y,t.w,t.h)),st(e,t),e.restore())}}function Q(e,t){for(let r of t){if("circle"!==r.type)continue;let t=r;0>=t.r||(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),lr(e,t.style,"#007bff",()=>e.fill()),dr(e,t.style,()=>e.stroke()),it(e,t),e.restore())}}function K(e,t){for(let r of t){if("arc"!==r.type)continue;let t=r;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),lr(e,t.style,"#007bff",()=>e.fill()),dr(e,t.style,()=>e.stroke()),e.restore()}}function q(e,t,r,s,i){let o=s.radius??3;e.globalAlpha=s.opacity??.7;for(let n=0;t.particles.length>n;n++){let a=t.particles[n];if(!a.active)continue;let l,d=r[a.edgeIndex];d&&(l="string"==typeof s.color&&"inherit"!==s.color?s.color:i(d),e.fillStyle=yr(e,l)||l,e.beginPath(),e.arc(a.x,a.y,o,0,2*Math.PI),e.fill())}e.globalAlpha=1}function U(e,t,r,s,i=Math.random){let o=s.spawnRate??.1,n=s.maxPerEdge??50;for(let s=0;t.length>s;s++){let a=t[s];if(!a.bezier||e.countForEdge(s)>=n)continue;let l=a.value*o*r*(a.bezier.circular?.3:1),d=Math.floor(l),c=l-d,u=d;i()<c&&u++;for(let t=0;u>t&&e.countForEdge(s)<n;t++)e.spawn(s,i)}}function J(e){let{canvas:t,store:r,sceneRevisionDiagnostics:s,size:i,margin:o,adjustedWidth:n,adjustedHeight:a,background:l,themeBackground:d,maxDevicePixelRatio:c,renderMode:u,hasBackgroundGraphics:h=!1,dirtyRef:y,resolutionDirtyRef:g,lastFrameTimeRef:p,now:f,random:m,reducedMotion:v,showParticles:k,isContinuous:b,animate:_,decay:x,pulse:w,thresholds:S,staleness:A,particleStyle:C,getParticleColor:N,pendingAnnotationFrameRef:R,lastAnnotationFrameTimeRef:E,setAnnotationFrame:T,scheduleNextFrame:P,syncColorMap:D,onSceneOrStyleChange:W}=e,I=t.getContext("2d");if(!I)return;let L=p.current?Math.min((f-p.current)/1e3,.1):.016;p.current=f;let M=null!=r.transition,B=r.advanceTransition(v?f+1e6:f),O=!v&&B,F=M&&!B,Y=!v&&r.tickAnimation([n,a],L),z=y.current,X=s?.beforeCompute(r.getLastUpdateResult(),O),H=M||z||Y;H&&(r.buildScene([n,a]),z&&D?.()),X&&s?.afterCompute(X,H,!0);let $=k&&!v&&!!r.particlePool,V=!!x||!!w||!!S||!1!==_&&r.hasActiveTopologyDiff||r.hasActivePulses||r.hasActiveThresholds,J=r.consumeStylePaintPending();(H||J)&&W?.({inventoryChanged:z||J,geometryChanged:H});let Z=we({dirtyOrRebuilt:H,transitioning:O,animationTicked:Y,continuous:$||b,liveEncoding:V,forced:J||!0===g?.current});g&&(g.current=!1);let ee=!!A&&r.lastIngestTime>0&&f-r.lastIngestTime>(A?.threshold??5e3);if(Z){let e=pt(c,i);if(!yt(t,i,o,e))return;if(I.clearRect(-o.left,-o.top,i[0],i[1]),rt(I,{background:l,themeBackground:d,hasBackgroundGraphics:h,x:-o.left,y:-o.top,width:i[0],height:i[1]}),x&&r.applyDecay(),w&&r.applyPulse(f),S&&r.applyThresholds(f),!1!==_&&r.applyTopologyDiff(f),ee&&(I.globalAlpha=A?.dimOpacity??.5),Ee({context:I,nodes:r.sceneEdges,renderMode:u,pixelRatio:e,paintBuiltIn:e=>j(I,e)}),Ee({context:I,nodes:r.sceneNodes,renderMode:u,pixelRatio:e,paintBuiltIn:e=>{let t=e;G(I,t),Q(I,t),K(I,t),Se(I,t),Ae(I,t)}}),$&&!ee){let e=r.edgesArray;if(e.length>0){U(r.particlePool,e,L,C,m);let t,s=.5*(C.speedMultiplier??1);if(C.proportionalSpeed){let r=e.reduce((e,t)=>Math.max(e,t.value||1),1);t=e.map(e=>.3+(e.value||1)/r*1.7)}r.particlePool.step(L,s,e,t),q(I,r.particlePool,e,C,N)}}ee&&(I.globalAlpha=1)}y.current=!1,H&&t.setAttribute("aria-label",er(r.sceneNodes?.length??0,r.sceneEdges?.length??0,"Network chart"));let te=H||R.current;!te||!F&&33>f-E.current?R.current=!!te:(T(e=>e+1),E.current=f,R.current=!1),(b||O||null!=r.transition||Y||r.hasActivePulses||r.hasActiveThresholds||!1!==_&&r.hasActiveTopologyDiff||R.current)&&P()}function Z(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}function ee(e){let{node:t,colorBy:r,colorScheme:s,nodeColorMap:i,colorIndexRef:o}=e;if("function"==typeof r)return r(t)+"";if("string"==typeof r&&t.data){let e=t.data[r];if(void 0!==e){if(!i.has(e+"")){let t=Array.isArray(s)?s:ar;i.set(e+"",t[o.current++%t.length])}return i.get(e+"")}}if(i.has(t.id))return i.get(t.id);let n=Array.isArray(s)?s:ar,a=r?n[o.current++%n.length]:n[0];return i.set(t.id,a),a}function te(e){let{edge:t,edgeColorBy:r,getNodeColor:s,resolveEndpoint:i,fallback:o}=e;if("function"==typeof r)return r(t);let n=i(t.source),a=i(t.target);return"target"===r&&a?s(a):n?s(n):o}function re(e){let{edge:t,particleStyleColor:r,particleColorBy:s,hasExplicitParticleColorBy:i,getEdgeColor:o,getNodeColor:n,resolveEndpoint:a,fallback:l}=e;if("function"==typeof r){let e=a(t.source);return e?r(t,e):l}if(!i)return o(t);let d=s,c=a(t.source),u=a(t.target);return"target"===d&&u?n(u):c?n(c):l}function se(e){let{sceneNodes:t,nodes:r,nodeColorMap:s,colorScheme:i}=e;for(let e of t)e.id&&"string"==typeof e.style?.fill&&s.set(e.id,e.style.fill);let o=Array.isArray(i)?i:ar,n=Array.from(r);for(let e=0;n.length>e;e++){let t=n[e];s.has(t.id)||s.set(t.id,o[e%o.length])}return n.length}function ie(e,t,r,s,i=30,o,n=0,a=!0){let l=null,d=1/0,c=1/0;if(o){let e=Ge(o,r,s,i,n,e=>e.cx,e=>e.cy,e=>e.r);e&&(l={mark:e.node,type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},d=e.distance)}for(let t of e){if(o&&"circle"===t.type)continue;let e=oe(t,r,s,i);if(e)if(e.mark=t,"rect"===t.type){let r=t.w*t.h;c>r&&(l=e,c=r)}else d>e.distance&&(l=e,d=e.distance)}if(l)return l;if(!a)return null;for(let e of t){if(!1===e.interactive)continue;let t=he(e,r,s);t&&(t.mark=e),t&&d>t.distance&&(l=t,d=t.distance)}return l}function oe(e,t,r,s=30){if(!e.datum)return null;switch(e.type){case"circle":return le(e,t,r,s);case"rect":return de(e,t,r);case"arc":return ce(e,t,r);case"symbol":return ae(e,t,r,s);case"glyph":return ne(e,t,r,s);default:return null}}function ne(e,t,r,s=30){let i=hr(e.glyph,e.size),o=e.cx+i.centerDx,n=e.cy+i.centerDy,a=t-o,l=r-n,d=Math.sqrt(a*a+l*l);return d>$e(i.radius,s)?null:{type:"node",datum:e.datum,x:o,y:n,distance:d}}function ae(e,t,r,s=30){let i=t-e.cx,o=r-e.cy,n=Math.sqrt(i*i+o*o);return n>$e(ur(e.size),s)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:n}}function le(e,t,r,s=30){let i=t-e.cx,o=r-e.cy,n=Math.sqrt(i*i+o*o);return n>$e(e.r,s)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:n}}function de(e,t,r){let s=He(t,r,e);return s.hit?{type:"node",datum:e.datum,x:s.cx,y:s.cy,distance:0}:null}function ce(e,t,r){let s=t-e.cx,i=r-e.cy,o=Math.sqrt(s*s+i*i);if(e.innerR-2>o||o>e.outerR+2)return null;let n=Ve(Math.atan2(i,s)),a=Ve(e.startAngle),l=Ve(e.endAngle);if(a>l?n>=a||l>=n:n>=a&&l>=n){let t=(e.startAngle+e.endAngle)/2,r=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+r*Math.cos(t),y:e.cy+r*Math.sin(t),distance:0}}return null}function ue(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch{return null}}function he(e,t,r){switch(e.type){case"bezier":case"ribbon":case"curved":return ge(e,t,r);case"line":return ye(e,t,r);default:return null}}function ye(e,t,r){let s=e.x2-e.x1,i=e.y2-e.y1,o=s*s+i*i;if(0===o)return null;let n=((t-e.x1)*s+(r-e.y1)*i)/o;n=Math.max(0,Math.min(1,n));let a=e.x1+n*s,l=e.y1+n*i,d=Math.sqrt((t-a)**2+(r-l)**2);return d>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:d}}function ge(e,t,r){if(!e.pathD)return null;let s=ue(e),i=(fs||((ps=document.createElement("canvas")).width=1,ps.height=1,fs=ps.getContext("2d")),fs);if(!s||!i)return null;try{if(i.isPointInPath(s,t,r))return{type:"edge",datum:e.datum,x:t,y:r,distance:0};let o=i.lineWidth;i.lineWidth=10;let n=i.isPointInStroke(s,t,r);if(i.lineWidth=o,n)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch{}return null}function pe(e){let{clientX:t,clientY:r,canvasRect:s,margin:i,adjustedWidth:o,adjustedHeight:n,sceneNodes:a,sceneEdges:l,nodeQuadtree:d,maxNodeRadius:c,hitRadius:u=30,includeEdges:h=!0}=e,y=t-s.left-i.left,g=r-s.top-i.top;if(0>y||y>o||0>g||g>n)return{kind:"miss-outside"};let p=ie(a,l,y,g,u,d,c,h);return p?{kind:"hit",hover:xt(p.datum||{},p.x,p.y,{nodeOrEdge:p.type}),mark:p.mark}:{kind:"miss"}}function fe({customHoverBehavior:e,customClickBehavior:t,onObservation:r,chartId:s}){return{customHoverBehavior:ms((t,i)=>{e?.(t,i),Pt({onObservation:r,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:vs,chartId:s,context:i})},[e,r,s]),customClickBehavior:ms((e,i)=>{t?.(e,i),Dt({onObservation:r,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:vs,chartId:s,context:i})},[t,r,s])}}function me(e,t,r,s,i){return("sankey"===e||t)&&r||s||i}function ve(e,t,r){return e.nodes=Ot(t),e.edges=Ot(r),e.nodes||e.edges}function ke(e){jt(e.canvas,e.pointer,t=>{let r=pe({clientX:t.clientX,clientY:t.clientY,canvasRect:e.canvas.getBoundingClientRect(),margin:e.margin,adjustedWidth:e.width,adjustedHeight:e.height,sceneNodes:e.store.sceneNodes,sceneEdges:e.store.sceneEdges,nodeQuadtree:e.geometryMoved?null:e.store.nodeQuadtree,maxNodeRadius:e.geometryMoved?0:e.store.maxNodeRadius,includeEdges:e.cursorInventory.edges});return"hit"===r.kind?Lt(r.mark):void 0})}import{c as be,d as _e,e as xe}from"./c-YMFUIO54.min.js";import{a as we}from"./c-BYJJ7EMG.min.js";import{b as Se}from"./c-TIMGODBG.min.js";import{b as Ae}from"./c-3AGX252H.min.js";import{b as Ce}from"./c-QXLDCATV.min.js";import{B as Ne,D as Re,E as Ee,F as Te,I as Pe,M as De,N as We,R as Ie,S as Le,W as Me,a as Be,d as Oe,e as Fe,f as Ye,g as ze,h as je,i as Xe,k as He,l as $e,n as Ve,o as Ge,q as Qe,r as Ke,s as qe,t as Ue,u as Je,v as Ze,w as et,x as tt,z as rt}from"./c-KGROWFT2.min.js";import{b as st,c as it}from"./c-V5KFJWQQ.min.js";import{a as ot,c as nt}from"./c-CLLCX3PT.min.js";import{a as at,b as lt}from"./c-N5WT7TXG.min.js";import{Ca as dt,D as ct,Fa as ut,H as ht,Ha as yt,I as gt,Ia as pt,J as ft,Ja as mt,K as vt,Ka as kt,L as bt,M as _t,Ma as xt,Na as wt,R as St,U as At,V as Ct,W as Nt,Wa as Rt,Xa as Et,Y as Tt,Ya as Pt,Za as Dt,b as Wt,c as It,ca as Lt,cb as Mt,d as Bt,da as Ot,e as Ft,ea as Yt,f as zt,ga as jt,ha as Xt,ia as Ht,ja as $t,ka as Vt,o as Gt,oa as Qt,p as Kt,q as qt,qa as Ut,r as Jt,s as Zt,sa as er,ua as tr,va as rr,wa as sr,xa as ir,ya as or}from"./c-G53AVC42.min.js";import{a as nr,m as ar}from"./c-Y342FJ6K.min.js";import{B as lr,C as dr,a as cr,b as ur,i as hr,m as yr,r as gr,t as pr,x as fr}from"./c-3BYZXCX3.min.js";import{e as mr}from"./c-5NYONM6V.min.js";import*as vr from"react";import{useRef as kr,useState as br,useEffect as _r,useMemo as xr,useCallback as wr,useImperativeHandle as Sr,forwardRef as Ar,memo as Cr}from"react";var Nr={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Rr={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},Er=class{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e,t=Math.random){let r=this._freeIndices.pop();if(void 0===r)return null;let s=this.particles[r];return s.active=!0,s.t=0,s.offset=t()-.5,s.edgeIndex=e,s.x=0,s.y=0,s}step(t,r,s,i){for(let o=0;this.capacity>o;o++){let n=this.particles[o];if(!n.active)continue;let a=s[n.edgeIndex];a&&a.bezier?(n.t+=t*r*(i?i[n.edgeIndex]??1:1)*(a.bezier.circular?.3:1),1>n.t?e(a.bezier,n.t,n.offset,n):(n.active=!1,this._freeIndices.push(o))):(n.active=!1,this._freeIndices.push(o))}}countForEdge(e){let t=0;for(let r=0;this.capacity>r;r++)this.particles[r].active&&this.particles[r].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;let t=this.particles;this.particles=Array(e);for(let r=0;e>r;r++)t.length>r?this.particles[r]=t[r]:(this.particles[r]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(r));this.capacity=e}},Tr=/* @__PURE__ */Object.create(null),Pr=!1;import{quadtree as Dr}from"d3-quadtree";import{interpolateNumber as Wr}from"d3-interpolate";var Ir=.5,Lr="rgba(34, 197, 94, 0.7)",Mr=2e3,Br=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Or=["scene-style","data-paint","accessibility","evidence"],Fr=(e,t)=>({retainedData:e,invalidations:t}),Yr=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],zr=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],jr=["scene-geometry","data-paint","overlay","accessibility","evidence"],Xr=["scene-style","data-paint","accessibility","evidence"],Hr=["scene-geometry","data-paint","overlay","accessibility","evidence"],$r=[],Vr={chartType:Fr("rebuild",Yr),nodeIDAccessor:Fr("rebuild",Yr),sourceAccessor:Fr("rebuild",Yr),targetAccessor:Fr("rebuild",Yr),valueAccessor:Fr("rebuild",Yr),edgeIdAccessor:Fr("rebuild",Yr),childrenAccessor:Fr("rebuild",Yr),hierarchySum:Fr("rebuild",Yr),orientation:Fr("preserve",zr),nodeAlign:Fr("preserve",zr),nodePaddingRatio:Fr("preserve",zr),nodeWidth:Fr("preserve",zr),edgeSort:Fr("preserve",zr),iterations:Fr("preserve",zr),forceStrength:Fr("preserve",zr),padAngle:Fr("preserve",zr),groupWidth:Fr("preserve",zr),sortGroups:Fr("preserve",zr),treeOrientation:Fr("preserve",zr),edgeType:Fr("preserve",zr),padding:Fr("preserve",zr),paddingTop:Fr("preserve",zr),orbitMode:Fr("preserve",zr),orbitSize:Fr("preserve",zr),orbitSpeed:Fr("preserve",zr),orbitRevolution:Fr("preserve",zr),orbitRevolutionStyle:Fr("preserve",zr),orbitEccentricity:Fr("preserve",zr),orbitShowRings:Fr("preserve",zr),orbitAnimated:Fr("preserve",zr),customNetworkLayout:Fr("preserve",zr),layoutConfig:Fr("preserve",zr),nodeSize:Fr("preserve",jr),nodeSizeRange:Fr("preserve",jr),colorByDepth:Fr("preserve",jr),nodeLabel:Fr("preserve",Hr),showLabels:Fr("preserve",Hr),labelMode:Fr("preserve",Hr),nodeStyle:Fr("preserve",Xr),edgeStyle:Fr("preserve",Xr),colorBy:Fr("preserve",Xr),colorScheme:Fr("preserve",Xr),themeCategorical:Fr("preserve",Xr),themeSemantic:Fr("preserve",Xr),edgeColorBy:Fr("preserve",Xr),edgeOpacity:Fr("preserve",Xr),showParticles:Fr("preserve",Xr),particleStyle:Fr("preserve",Xr),decay:Fr("preserve",Xr),pulse:Fr("preserve",Xr),thresholds:Fr("preserve",Xr),staleness:Fr("preserve",Xr),layoutSelection:Fr("preserve",Xr),clock:Fr("preserve",$r),random:Fr("preserve",$r),seed:Fr("preserve",$r),tensionConfig:Fr("preserve",$r),transition:Fr("preserve",$r),introAnimation:Fr("preserve",$r),onLayoutError:Fr("preserve",$r),__skipForceSimulation:Fr("preserve",$r),__hierarchyRoot:Fr("preserve",$r),__orbitState:Fr("preserve",$r),__previousPositions:Fr("preserve",$r)},Gr=Fr("preserve",zr),Qr=class{constructor(){this.tracker=new Kt}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},Br)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Or):this.recordNoop("restyle")}recordConfig(e){let t=k(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},Kr=class{constructor(e){this.restyle=e,this.key=null,this.pending=null}reuse(e,t,r,s,i){let o=_(e,t,r,s),n=null!==this.key&&et(this.key.selection,o.selection);return this.key&&et(this.key.geometry,o.geometry)&&et(this.key.colors,o.colors)&&(i||n)?(n||this.restyle(e.layoutSelection??null),this.key=o,!0):(this.key=null,this.pending=o,!1)}commit(){this.key=this.pending,this.pending=null}clear(){this.key=null,this.pending=null}},qr=class e{constructor(e){this.nodes=/* @__PURE__ */new Map,this.edges=/* @__PURE__ */new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutBackgrounds=null,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this.customLayoutHtmlMarks=[],this._customLayoutDiagnosticsWarned=/* @__PURE__ */new Set,this._customLayoutCache=new Kr(e=>this.restyleScene(e)),this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,this.particlePool=null,this.updateResults=new Qr,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=/* @__PURE__ */new Map,this.edgeTimestamps=/* @__PURE__ */new Map,this._decaySortedNodes=null,this._decayAgeMap=null,this.addedNodes=/* @__PURE__ */new Set,this.removedNodes=/* @__PURE__ */new Set,this.addedEdges=/* @__PURE__ */new Set,this.removedEdges=/* @__PURE__ */new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=/* @__PURE__ */new Set,this.previousEdgeKeys=/* @__PURE__ */new Set,this._networkDecayCache=null,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig={...Nr,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Er(2e3))}currentTime(){return this.config.clock?.()??zt()}updateConfig(e){let t=this.config,r={...t,...e};t.__orbitState&&(r.__orbitState=t.__orbitState),t.__hierarchyRoot&&(r.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(r.layoutSelection=t.layoutSelection);let s=[.../* @__PURE__ */new Set([...Object.keys(t),...Object.keys(r)])].filter(e=>t[e]!==r[e]);this.config=r,this.tensionConfig={...Nr,...r.tensionConfig},r.showParticles&&("sankey"===r.chartType||r.customNetworkLayout)&&!this.particlePool&&(this.particlePool=new Er(2e3)),this.updateResults.recordConfig(s)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}ingestHierarchy(e,t){this._boundedPrevSnapshot=/* @__PURE__ */new Map;for(let[e,t]of this.nodes)(0!==t.x0||0!==t.x1||0!==t.y0||0!==t.y1)&&this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null,this.updateResults.recordData("replace",1)}ingestBounded(e,t,r,s){let{nodeIDAccessor:i="id",sourceAccessor:o="source",targetAccessor:l="target",valueAccessor:d="value"}=this.config,c="function"==typeof i?i:e=>e[i],u="function"==typeof o?o:e=>e[o],h="function"==typeof l?l:e=>e[l],y="function"==typeof d?d:e=>e[d]??1;this._boundedPrevSnapshot=/* @__PURE__ */new Map;for(let[e,t]of this.nodes)(0!==t.x0||0!==t.x1||0!==t.y0||0!==t.y1)&&this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=/* @__PURE__ */new Map;for(let[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(let t of e){let e=c(t)+"";this.nodes.set(e,{...n(e),data:t})}for(let e=0;t.length>e;e++){let r=t[e],s=u(r)+"",i=h(r)+"",o=y(r),l=null==o?NaN:Number(o),d=Number.isFinite(l)?l:1;this.nodes.has(s)||this.nodes.set(s,{...n(s),data:r}),this.nodes.has(i)||this.nodes.set(i,{...n(i),data:r});let c=`${s}\0${i}\0${e}`,g={source:s,target:i,value:d,y0:0,y1:0,sankeyWidth:0,data:r,_edgeKey:c};r&&"object"==typeof r&&a(r.bezier)&&(g.bezier=r.bezier),this.edges.set(c,g)}s?.deferLayout||this.runLayout(r),this.updateResults.recordData("replace",e.length+t.length)}ingestBoundedWithResult(e,t,r,s){return this.ingestBounded(e,t,r,s),this.updateResults.last}applyForceLayoutPositions(e,t){for(let[t,r]of Object.entries(e)){let e=this.nodes.get(t);e&&(e.x=r.x,e.y=r.y)}this.config.__skipForceSimulation=!0;try{this.runLayout(t)}finally{this.config.__skipForceSimulation=void 0}}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){let{source:t,target:r,value:s}=e,i=0===this.nodes.size,o=!1,a=this.currentTime();this.lastIngestTime=a,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,n(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,o=!0),this.nodes.has(r)||(this.nodes.set(r,n(r)),this.nodeTimestamps.set(r,a),this.tension+=this.tensionConfig.newNode,o=!0);let l=this.edgeKey(t,r),d=this.edges.get(l),c=!1;d?(d.value+=s,this.edgeTimestamps.set(l,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(l,{source:t,target:r,value:s,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(l,a),this.tension+=this.tensionConfig.newEdge,o=!0);let u=i||o||c||this.tension>=this.tensionConfig.threshold;return this.updateResults.recordData("ingest",1),u}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;let t=i(this.config.chartType);if(!t)return void o(this.config.chartType);let r=Array.from(this.nodes.values()),s=Array.from(this.edges.values());if(0===r.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.supportsStreaming&&!t.hierarchical){let e=/* @__PURE__ */new Map;for(let t of r)void 0!==t._prevX0?e.set(t.id,{x:(t._prevX0??0)+((t._prevX1??0)-(t._prevX0??0))/2,y:(t._prevY0??0)+((t._prevY1??0)-(t._prevY0??0))/2}):(0!==t.x||0!==t.y)&&e.set(t.id,{x:t.x,y:t.y});if(this._lastPositionSnapshot)for(let[t,r]of this._lastPositionSnapshot)e.has(t)||e.set(t,r);this.config.__previousPositions=e.size>0?e:void 0}if(t.computeLayout(r,s,this.config,e),this.config.__previousPositions=void 0,t.hierarchical&&r.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(let e of r)this.nodes.set(e.id,e);for(let e=0;s.length>e;e++){let t=s[e],r=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=r,this.edges.set(r,t)}let e=this._boundedPrevSnapshot;if(e&&e.size>0)for(let t of this.nodes.values()){let r=e.get(t.id);r&&(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,r=Array.from(this.nodes.values())}this.finalizeLayout();let n=/* @__PURE__ */new Map;for(let e of this.nodes.values())(0!==e.x||0!==e.y)&&n.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=n,this.saveTargetPositions();let a=r.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),l=this.config.transition?.duration??this.tensionConfig.transitionDuration,d=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&d&&r.length>0&&l>0){let t=e[0]/2,r=e[1]/2;for(let e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=r,e._prevY1=r;for(let e of this.edges.values())e._prevY0=r,e._prevY1=r,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:l}}else a&&l>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:l});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){let e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=/* @__PURE__ */new Set,this.removedNodes=/* @__PURE__ */new Set,this.addedEdges=/* @__PURE__ */new Set,this.removedEdges=/* @__PURE__ */new Set;for(let t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(let t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(let e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(let e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime=this.currentTime()),this.previousNodeIds=e,this.previousEdgeKeys=t}restyleScene(e){let t=A({nodes:this.sceneNodes,edges:this.sceneEdges,restyle:this._customRestyle,restyleEdge:this._customRestyleEdge,baseStyles:this._baseStyles,selection:e});this.markStylePaintPending(),this.updateResults.recordRestyle(t)}buildScene(e){if(this.config.customNetworkLayout){if(this._customLayoutCache.reuse(this.config,e,this.getUpdateSnapshot().revisions.data,this.layoutVersion,this.hasCustomRestyle))return;let t=b({config:this.config,customLayout:this.config.customNetworkLayout,size:e,nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values()),previousResult:this.lastCustomLayoutResult,revision:this.layoutVersion});if("failure"===t.kind)return this.lastCustomLayoutFailure=t.diagnostic,void(t.preservedLastGoodScene||(this.sceneNodes=[],this.sceneEdges=[],this.labels=[],w(this),this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this._sceneNodesRevision++));let r=t.result;return this._customLayoutCache.commit(),this.sceneNodes=r.sceneNodes??[],this.sceneEdges=r.sceneEdges??[],this.labels=r.labels??[],x(this,r),this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=r.restyle,this._customRestyleEdge=r.restyleEdge,this.hasCustomRestyle=!(!r.restyle&&!r.restyleEdge),this.hasCustomRestyle&&(this._baseStyles=S(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null)),void Oe({label:"customNetworkLayout",nodes:this.sceneNodes,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned})}this._customLayoutCache.clear(),this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,w(this),this.lastCustomLayoutFailure=null;let t=i(this.config.chartType);if(!t)return o(this.config.chartType),void this._sceneNodesRevision++;let r=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,s=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:n,sceneEdges:a,labels:l}=t.buildScene(r,s,this.config,e);this.sceneNodes=n,this.sceneEdges=a,this.labels=l,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,r=0;for(let e of this.sceneNodes)"circle"===e.type&&e.datum&&(t++,e.r>r&&(r=e.r));if(this._maxNodeRadius=r,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);let s=[];for(let e of this.sceneNodes)"circle"===e.type&&e.datum&&s.push(e);this._nodeQuadtree=Dr().x(e=>e.cx).y(e=>e.cy).addAll(s)}get nodeQuadtree(){return this._nodeQuadtreeRevision!==this._sceneNodesRevision&&(this.rebuildNodeQuadtree(),this._nodeQuadtreeRevision=this._sceneNodesRevision),this._nodeQuadtree}get maxNodeRadius(){return this._maxNodeRadius}_ensureArrays(){this._arrCacheVersion===this.layoutVersion&&this._nodesArrCache&&this._edgesArrCache||(this._nodesArrCache=Array.from(this.nodes.values()),this._edgesArrCache=Array.from(this.edges.values()),this._arrCacheVersion=this.layoutVersion)}get nodesArray(){return this._ensureArrays(),this._nodesArrCache}get edgesArray(){return this._ensureArrays(),this._edgesArrCache}get isAnimating(){return!(!i(this.config.chartType)?.supportsAnimation||!1===this.config.orbitAnimated)}tickAnimation(e,t){let r=i(this.config.chartType);if(!r?.tick)return!1;let s=r.hierarchical?Array.from(this.nodes.values()):this.nodesArray,o=r.hierarchical?Array.from(this.edges.values()):this.edgesArray;return r.tick(s,o,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(let e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(let e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;let t=Bt(e,this.transition),r=It(t);for(let e of this.nodes.values())void 0!==e._targetX0&&void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1)&&(e.x0=Ft(e._prevX0,e._targetX0,r),e.x1=Ft(e._prevX1,e._targetX1,r),e.y0=Ft(e._prevY0,e._targetY0,r),e.y1=Ft(e._prevY1,e._targetY1,r));for(let e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=Ft(e._prevY0,e._targetY0,r),e.y1=Ft(e._prevY1,e._targetY1,r),e.sankeyWidth=Ft(e._prevSankeyWidth,e._targetSankeyWidth,r));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){let e=this._boundedPrevSnapshot;for(let t of this.nodes.values()){let r=e?.get(t.id);r&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}let t=this._boundedEdgeSnapshot;for(let e of this.edges.values()){if(t&&0===e.sankeyWidth){let r=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(r){e._prevY0=r.y0,e._prevY1=r.y1,e._prevSankeyWidth=r.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){let e="vertical"===this.config.orientation?"down":"right";for(let e of this.nodes.values())0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1?(e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2):(e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10);for(let t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(let e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(let e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(let e of this.nodes.values())void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1)&&(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(let e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(let e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(let e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){u(e,this.nodes,Ir)}rebuildAllBeziers(){for(let e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(let e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){h({sceneNodes:this.sceneNodes,sceneEdges:this.sceneEdges,nodeTimestamps:this.nodeTimestamps,edgeTimestamps:this.edgeTimestamps,pulse:this.config.pulse,now:e})}applyDecay(){this._networkDecayCache||(this._networkDecayCache={sortedNodes:null,ageMap:null}),this._decaySortedNodes||(this._networkDecayCache.sortedNodes=null,this._networkDecayCache.ageMap=null),y({sceneNodes:this.sceneNodes,nodeTimestamps:this.nodeTimestamps,decay:this.config.decay,cache:this._networkDecayCache}),this._decaySortedNodes=this._networkDecayCache.sortedNodes,this._decayAgeMap=this._networkDecayCache.ageMap}applyTopologyDiff(e){g({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return p(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){f({sceneNodes:this.sceneNodes,nodes:this.nodes,thresholds:this.config.thresholds,now:e})}get hasActiveThresholds(){return m(this.nodes.values(),this.config.thresholds)}get hasActivePulses(){return v({pulse:this.config.pulse,lastIngestTime:this.lastIngestTime})}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){let r=this.nodes.get(e);if(!r)return this.updateResults.recordNoop("update"),null;let s=r.data?{...r.data}:{};return r.data=t(r.data??{}),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",1),s}updateEdge(e,t,r){let s=this.config.valueAccessor,i="function"==typeof s?s:s?e=>e[s]:e=>e.value,o=[];for(let[,s]of this.edges)if(("string"==typeof s.source?s.source:s.source.id)===e&&("string"==typeof s.target?s.target:s.target.id)===t){o.push(s.data?{...s.data}:{}),s.data=r(s.data??{});let e=i(s.data);null!=e&&(s.value=Number(e))}return o.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",o.length)):this.updateResults.recordNoop("update"),o}removeNode(e){if(!this.nodes.has(e))return this.updateResults.recordNoop("remove"),!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(let[t,r]of this.edges)(("string"==typeof r.source?r.source:r.source.id)===e||("string"==typeof r.target?r.target:r.target.id)===e)&&(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",1),!0}removeEdge(e,t){let r=[];if(void 0===t){let t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");let s="function"==typeof t?t:e=>e?.[t];for(let[t,i]of this.edges)i.data&&s(i.data)===e&&r.push(t)}else for(let[s,i]of this.edges)("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t&&r.push(s);for(let e of r)this.edges.delete(e),this.edgeTimestamps.delete(e);return r.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length)):this.updateResults.recordNoop("remove"),r.length>0}clear(){this._customLayoutCache.clear(),this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],w(this),this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.previousNodeIds=/* @__PURE__ */new Set,this.previousEdgeKeys=/* @__PURE__ */new Set,this.addedNodes=/* @__PURE__ */new Set,this.removedNodes=/* @__PURE__ */new Set,this.addedEdges=/* @__PURE__ */new Set,this.removedEdges=/* @__PURE__ */new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear(),this.updateResults.recordData("clear")}};qr.QUADTREE_THRESHOLD=500;var Ur=qr;Ye(Ur);import*as Jr from"react";import{useId as Zr}from"react";import{Fragment as es,jsx as ts,jsxs as rs}from"react/jsx-runtime";E.displayName="NetworkSVGOverlay";import*as ss from"react";import{jsx as is}from"react/jsx-runtime";var os={position:"absolute",top:0,left:0,pointerEvents:"none"};import*as ns from"react";import{arc as as}from"d3-shape";import{jsx as ls,jsxs as ds}from"react/jsx-runtime";import{jsx as cs,jsxs as us}from"react/jsx-runtime";import{jsx as hs,jsxs as ys}from"react/jsx-runtime";var gs=/^(value|amount|total|count|weight|score)$/i;F.ownsChrome=!0;var ps=null,fs=null;import{useCallback as ms}from"react";var vs="StreamNetworkFrame";import{jsx as ks,jsxs as bs}from"react/jsx-runtime";var _s=[800,600],xs=Cr(Ar(function(e,t){let{chartType:r,nodes:s,edges:i,data:o,initialEdges:n,nodeIDAccessor:a="id",sourceAccessor:l="source",targetAccessor:d="target",valueAccessor:c="value",edgeIdAccessor:u,childrenAccessor:h,hierarchySum:y,orientation:g="horizontal",nodeAlign:p="justify",nodePaddingRatio:f=.05,nodeWidth:m=15,iterations:v=300,forceStrength:k=.1,layoutExecution:b="auto",layoutLoadingContent:_,onLayoutStateChange:x,padAngle:w=.01,groupWidth:S=20,sortGroups:A,edgeSort:C,treeOrientation:N="vertical",edgeType:R="curve",padding:T,paddingTop:P,tensionConfig:W,showParticles:I=!1,particleStyle:L,renderMode:M,nodeStyle:B,edgeStyle:z,colorBy:j,colorScheme:X="category10",edgeColorBy:H="source",edgeOpacity:$=.5,colorByDepth:V=!1,nodeSize:G=8,nodeSizeRange:Q=[5,20],nodeLabel:K,showLabels:q=!0,labelMode:U,size:ie=_s,responsiveWidth:oe,responsiveHeight:ne,margin:ae,className:le,background:de,maxDevicePixelRatio:ce,enableHover:ue=!0,tooltipContent:he,customHoverBehavior:ye,customClickBehavior:ge,onObservation:we,annotationObservationCallback:Se,chartId:Ae,onTopologyChange:Ee,annotations:Te,onAnnotationActivate:Pe,autoPlaceAnnotations:Be,svgAnnotationRules:Oe,legend:Fe,legendPosition:Ye,legendLayout:He,legendHoverBehavior:$e,legendClickBehavior:Ve,legendHighlightedCategory:Ge,legendIsolatedCategories:qe,legendCategoryAccessor:Ue,onCategoriesChange:Je,title:Ze,foregroundGraphics:et,backgroundGraphics:rt,decay:st,pulse:it,transition:ot,animate:at,staleness:lt,frameScheduler:ct,clock:ht,random:yt,seed:gt,paused:pt=!1,suspendWhenHidden:vt=!0,thresholds:bt,accessibleTable:_t=!0,description:wt,summary:St,orbitMode:At,orbitSize:Ct,orbitSpeed:Nt,orbitRevolution:Tt,orbitRevolutionStyle:Pt,orbitEccentricity:Dt,orbitShowRings:It,orbitAnimated:Bt,customNetworkLayout:Ot,onLayoutError:Ft,layoutConfig:zt,layoutSelection:jt}=e,Ht=Ce(r),Kt=kr(!0),or=ut({sizeProp:ie,responsiveWidth:oe,responsiveHeight:ne,userMargin:ae,marginDefault:Ht,title:Ze,legend:Fe,legendPosition:Ye,legendLayout:He,legendMarginReserved:e.__legendMarginReservedFor===Fe,animate:at,transitionProp:ot,frameScheduler:ct,clock:ht,random:yt,seed:gt,paused:pt,suspendWhenHidden:vt,themeDirtyRef:Kt}),{reducedMotionRef:nr,responsiveRef:ar,size:lr,margin:dr,adjustedWidth:cr,adjustedHeight:ur,transition:hr,introEnabled:yr,tableId:gr,rafRef:pr,renderFnRef:fr,scheduleRender:mr,frameRuntime:Ar,currentTheme:Cr}=or,{resolvedForeground:Er,resolvedBackground:Tr,themeBackground:Pr,surfaceBackground:Dr}=Ne({foregroundGraphics:et,backgroundGraphics:rt,size:lr,margin:dr,scales:null,background:de,themeBackgroundColor:Cr.colors.background}),Wr=$t(),Ir=Vt(),Lr=xr(()=>Wt(s),[s]),Mr=xr(()=>Array.isArray(i)?Wt(i):i,[i]),Br=!1===at,Or=xr(()=>({...Nr,...W,...Br?{transitionDuration:0}:{}}),[W,Br]),Fr=xr(()=>({...Rr,...L}),[L]),Yr=xr(()=>Y({chartType:r,clock:Ar.now,random:yt,seed:gt,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:d,valueAccessor:c,edgeIdAccessor:u,childrenAccessor:h,hierarchySum:y,orientation:g,nodeAlign:p,nodePaddingRatio:f,nodeWidth:m,iterations:v,forceStrength:k,padAngle:w,groupWidth:S,sortGroups:A,edgeSort:C,treeOrientation:N,edgeType:R,padding:T,paddingTop:P,tensionConfig:Or,showParticles:I,particleStyle:Fr,nodeStyle:B,edgeStyle:z,nodeLabel:K,showLabels:q,labelMode:U,colorBy:j,colorScheme:X,edgeColorBy:H,edgeOpacity:$,colorByDepth:V,nodeSize:G,nodeSizeRange:Q,decay:st,pulse:it,transition:hr,introAnimation:yr,staleness:lt,thresholds:bt,orbitMode:At,orbitSize:Ct,orbitSpeed:Nt,orbitRevolution:Tt,orbitRevolutionStyle:Pt,orbitEccentricity:Dt,orbitShowRings:It,orbitAnimated:Bt,customNetworkLayout:Ot,onLayoutError:Ft,layoutConfig:zt,currentTheme:Cr}),[r,Ar.now,yt,gt,a,l,d,c,u,h,y,g,p,f,m,v,k,w,S,A,C,N,R,T,P,Or,I,Fr,B,z,K,q,U,j,X,H,$,V,G,Q,st,it,hr,yr,lt,bt,At,Ct,Nt,Tt,Pt,Dt,It,Bt,Ot,Ft,zt,Cr]),zr=tt(Yr),jr=tt({chartType:r,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:d,valueAccessor:c,edgeIdAccessor:u,childrenAccessor:h,hierarchySum:y,orientation:g,nodeAlign:p,nodePaddingRatio:f,nodeWidth:m,iterations:v,forceStrength:k,padAngle:w,groupWidth:S,sortGroups:A,edgeSort:C,treeOrientation:N,edgeType:R,padding:T,paddingTop:P,random:yt,seed:gt,tensionConfig:Or,customNetworkLayout:Ot,orbitMode:At,orbitSize:Ct,orbitEccentricity:Dt}),Xr=kr(0),Hr=kr(0),$r=kr(!1),Vr=kr(null);Vr.current||(Vr.current=new Ur(zr));let Gr=Re(Vr,Ue,Je,e=>Array.from(e.nodes.values()).map(e=>e.data?{id:e.id,...e.data}:e)),Qr=qt("StreamNetworkFrame"),Kr=wr((e,t,r=!1)=>Jt(Qr.current,e,()=>e.buildScene(t),r),[Qr]),[qr,Jr]=br(null),[Zr,es]=br(0),[ts,rs]=br(0),[ss,is]=br(!1),[os,ns]=br(!1),as=kr(0),ls=kr(null),ds=kr(!1),cs=kr(x);cs.current=x;let us=kr(zr);us.current=zr;let hs=kr(null),ys=kr({nodes:!1,edges:!1}),gs=kr(/* @__PURE__ */new Map),ps=kr(0),fs=kr(X);fs.current=X;let ms=wr(e=>ee({node:e,colorBy:j,colorScheme:X,nodeColorMap:gs.current,colorIndexRef:ps}),[j,X]),vs=wr(e=>{ps.current=se({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:gs.current,colorScheme:fs.current})},[]),xs=kr(null),ws=wr((e,t)=>{Kr(e,t),xs.current=t,Gr(),vs(e),ve(ys.current,e.sceneNodes,e.sceneEdges),Kt.current=!1,e.markStylePaintPending()},[Kr,Gr,vs]),Ss=wr(()=>{Vr.current?.markStylePaintPending()},[]),{canvasRef:As,resolutionDirtyRef:Cs}=mt(or,{hydrated:Wr,wasHydratingFromSSR:Ir,storeRef:Vr,dirtyRef:Kt,skipInitialCanvasPaintInvalidation:!0,canvasPaintInvalidator:Ss,maxDevicePixelRatio:ce,canvasPaintDependencies:[r,cr,ur,de,rt,M,mr]}),Ns=(Ds=Cr,Ds?.colors?.border||Ds?.colors?.secondary||Ds?.colors?.primary||"#999"),Rs=wr(e=>Z(e,Vr.current?.nodes),[]),Es=wr(e=>te({edge:e,edgeColorBy:H,getNodeColor:ms,resolveEndpoint:Rs,fallback:Ns}),[H,ms,Ns,Rs]),Ts=wr(e=>re({edge:e,particleStyleColor:Fr.color,particleColorBy:Fr.colorBy,hasExplicitParticleColorBy:!!L?.colorBy,getEdgeColor:Es,getNodeColor:ms,resolveEndpoint:Rs,fallback:Ns}),[L?.colorBy,Fr.color,Fr.colorBy,ms,Es,Ns,Rs]),Ps=me(r,!!Ot,I,!!it,Vr.current?.isAnimating??!1);var Ds;je(Vr,zr,Kt,mr),Xe(Vr,jt,Kt,mr);let Ws=wr(()=>{let e=Vr.current;if(e&&(e.runLayout([cr,ur]),ws(e,[cr,ur]),es(e.layoutVersion),Ee)){let{nodes:t,edges:r}=e.getLayoutData();Ee(t,r)}},[cr,ur,ws,Ee]),Is=kr(!1),Ls=wr((e=!1)=>!(!e&&!Is.current||(Is.current=!1,Ws(),0)),[Ws]),Ms=wr(()=>Ls(!1),[Ls]),Bs=wr(e=>{let t=Vr.current;if(!t)return!1;let r=!1,s=Is.current;for(let i of e)null==i||"object"!=typeof i||(r=!0,t.ingestEdge(i)&&(s=!0));let i=Ls(s);return r||i},[Ls]),Os=wr(e=>{if(null==e||"object"!=typeof e)return;let t=Vr.current;if(t){if(t.ingestEdge(e)&&(Is.current=!0),!Ar.isActive)return void Ms();mr()}},[Ms,Ar,mr]),Fs=wr(e=>{Bs(e)&&mr()},[Bs,mr]);_r(()=>Ar.subscribe(()=>{Ar.isActive||Ms()}),[Ms,Ar]);let Ys=wr(()=>{Is.current=!1,Vr.current?.clear(),Gr(),gs.current.clear(),ps.current=0,es(Vr.current?.layoutVersion??0),Jr(null),hs.current=null,Kt.current=!0,mr()},[Gr,mr]),zs=wr(()=>{let e=Vr.current;e&&(e.tension+=999,Ls(!0),mr())},[Ls,mr]);Sr(t,()=>({push:Os,pushMany:Fs,removeNode:e=>{let t=Vr.current?.removeNode(e)??!1;if(t){let t=hs.current?.data?"function"==typeof a?a(hs.current.data):hs.current.data[a]:void 0;hs.current&&"node"===hs.current.nodeOrEdge&&t===e&&(hs.current=null,Jr(null)),gs.current.delete(e)}return Ls(t)&&mr(),t},removeEdge:(e,t)=>{let r=Vr.current?.removeEdge(e,t)??!1;if(r&&hs.current&&"edge"===hs.current.nodeOrEdge){let r,s=hs.current.data;r=void 0!==t?("object"==typeof s?.source?s.source.id:s?.source)===e&&("object"==typeof s?.target?s.target.id:s?.target)===t:!u||!s||("function"==typeof u?u:e=>e?.[u])(s)===e,r&&(hs.current=null,Jr(null))}return Ls(r)&&mr(),r},updateNode:(e,t)=>{let r=Vr.current?.updateNode(e,t)??null;return Ls(null!==r)&&mr(),r},updateEdge:(e,t,r)=>{let s=Vr.current?.updateEdge(e,t,r)??[];return Ls(s.length>0)&&mr(),s},clear:Ys,getTopology:()=>(Ms(),Vr.current?.getLayoutData()??{nodes:[],edges:[]}),getCustomLayout:()=>(Ms(),Vr.current?.lastCustomLayoutResult??null),getLayoutFailure:()=>(Ms(),Vr.current?.lastCustomLayoutFailure??null),getTopologyDiff:()=>{Ms();let e=Vr.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:zs,getTension:()=>(Ms(),Vr.current?.tension??0)}),[Os,Fs,Ys,zs,Ms,Ls,a,mr,u]);let js=["tree","cluster","treemap","circlepack","partition","orbit"].includes(r),Xs=js?o||(Array.isArray(i)?void 0:i):void 0;_r(()=>{let e=Vr.current;if(!e)return;let t=++as.current;if(ls.current?.abort(),ls.current=null,js&&Xs)Is.current=!1,e.ingestHierarchy(Xs,[cr,ur]),ws(e,[cr,ur]),es(e.layoutVersion),ns(!1),cs.current?.("ready"),mr();else{let o=Lr,n=Array.isArray(Mr)?Mr:[];if((null!=s||null!=i)&&(Is.current=!1),0===o.length&&0===n.length)return(null!=s||null!=i)&&(e.nodes.size>0||e.edges.size>0)&&Ys(),ns(!1),void cs.current?.("ready");let a=[cr,ur],l="force"===r&&!Ot&&_e()&&!yt&&be(b,o.length,n.length,v);if(l&&Ir&&!ds.current&&e.sceneNodes.length>0)return ds.current=!0,ns(!1),cs.current?.("ready"),Kt.current=!0,void mr();if(l){let r=new AbortController;ls.current=r;let s=e._lastPositionSnapshot;e.ingestBounded(o,n,a,{deferLayout:!0});let i=e.getLayoutData(),l=xe(i.nodes,i.edges,us.current,a,s);return ns(!0),cs.current?.("pending"),import("./c-4JKDJUYD.min.js").then(({runForceLayoutWorker:e})=>e(l,r.signal)).then(({positions:r})=>{t===as.current&&(ls.current=null,e.applyForceLayoutPositions(r,a),ws(e,a),ns(!1),cs.current?.("ready"),es(e.layoutVersion),mr())}).catch(r=>{"AbortError"!==r.name&&t===as.current&&(ls.current=null,e.runLayout(a),ws(e,a),ns(!1),cs.current?.("error"),es(e.layoutVersion),mr())}),()=>r.abort()}e.ingestBounded(o,n,a),ws(e,a),es(e.layoutVersion),ns(!1),cs.current?.("ready"),mr()}},[Lr,Mr,s,i,o,Xs,js,cr,ur,jr,b,v,Ir,r,Ot,yt,mr,Ys,ws]);let Hs=vr.useRef(!1);_r(()=>{Hs.current||n&&n.length>0&&(Hs.current=!0,Fs(n))},[n,Fs]),_r(()=>{let e=Vr.current;if(!e||ls.current)return;let t=xs.current,r=null!==t&&(t[0]!==cr||t[1]!==ur);!Kt.current&&!r||(r&&e.runLayout([cr,ur]),ws(e,[cr,ur]),es(e=>e+1),mr())},[Cr,cr,ur,ws,mr]);let{customHoverBehavior:$s,customClickBehavior:Vs}=fe({customHoverBehavior:ye,customClickBehavior:ge,onObservation:we,chartId:Ae}),{hoverHandlerRef:Gs,hoverLeaveRef:Qs,onPointerMove:Ks,onPointerLeave:qs,pointerStateRef:Us}=or,Js=()=>!Ot||(Vr.current?.hasCustomRestyle??!1);Gs.current=e=>{let t=Js(),r=As.current;if(!r)return;let s=Vr.current;if(!s)return void Yt(r);let i=pe({clientX:e.clientX,clientY:e.clientY,canvasRect:r.getBoundingClientRect(),margin:dr,adjustedWidth:cr,adjustedHeight:ur,sceneNodes:s.sceneNodes,sceneEdges:s.sceneEdges,nodeQuadtree:s.nodeQuadtree,maxNodeRadius:s.maxNodeRadius,includeEdges:ue||ys.current.edges});if(Yt(r,"hit"===i.kind?Lt(i.mark):void 0),ue){if("hit"!==i.kind)return void(hs.current&&(hs.current=null,Jr(null),$s?.(null),t&&mr()));hs.current=i.hover,Jr(i.hover),$s?.(i.hover),t&&mr()}},Qs.current=()=>{if(Yt(As.current),hs.current){let e=Js();hs.current=null,Jr(null),$s?.(null),e&&mr()}};let Zs=kr(()=>{});Zs.current=e=>{if(ft(e.target)||!ge&&!we)return;let t=As.current;if(!t)return;let r=Vr.current;if(!r)return;let s=pe({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:dr,adjustedWidth:cr,adjustedHeight:ur,sceneNodes:r.sceneNodes,sceneEdges:r.sceneEdges,nodeQuadtree:r.nodeQuadtree,maxNodeRadius:r.maxNodeRadius});"hit"===s.kind?Vs(s.hover,{type:"activate",inputType:Rt(e.nativeEvent.pointerType)}):"miss"===s.kind&&Vs(null)};let ei=wr(e=>Zs.current(e),[]),ti=kr(-1),ri=kr(null),si=kr(-1),ii=wr(e=>{if(Et(e))return;let t=Vr.current;if(!t)return;let r=()=>{ti.current=-1,ri.current=null,si.current=-1,hs.current=null,Jr(null),$s?.(null),mr()},s=Ie(t.sceneNodes);if(0===s.length)return void(ti.current>=0&&r());let i=De(s),o=ti.current;if(o>=i.flat.length&&(r(),o=-1)," "===e.key&&o>=0){e.preventDefault();let t=i.flat[o];return void Vs?.(xt(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>o){if("Escape"===e.key||!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),ti.current=0,si.current=-1;let t=i.flat[0];ri.current={shape:t.shape,w:t.w,h:t.h};let r=xt(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return hs.current=r,Jr(r),$s?.(r,{type:"focus",inputType:"keyboard"}),void mr()}let n=We(i,o),a=Le(e.key,n,i,t.sceneEdges??[],si);if(null===a)return;if(e.preventDefault(),0>a)return void r();ti.current=a;let l=i.flat[a];ri.current={shape:l.shape,w:l.w,h:l.h};let d={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};hs.current=d,Jr(d),$s?.(d,{type:"focus",inputType:"keyboard"}),mr()},[Vs,$s,mr]),oi=wr(e=>{Me(Us,e,ue,ys.current.nodes||ys.current.edges,As.current,"mouse")&&(ti.current=-1,ri.current=null,Ks(e))},[As,ue,Ks,Us]);fr.current=()=>{if(pr.current=null,Ms(),!Ar.isActive||ls.current)return;let e=As.current;if(!e)return;let t=Vr.current;t&&J({canvas:e,store:t,sceneRevisionDiagnostics:Qr.current,size:lr,margin:dr,adjustedWidth:cr,adjustedHeight:ur,background:de,themeBackground:Pr,maxDevicePixelRatio:ce,renderMode:M,hasBackgroundGraphics:!(!rt&&!t.customLayoutBackgrounds),dirtyRef:Kt,resolutionDirtyRef:Cs,lastFrameTimeRef:Xr,now:Ar.now(),random:Ar.random,reducedMotion:!!nr.current,showParticles:I,isContinuous:Ps,animate:at,decay:st,pulse:it,thresholds:bt,staleness:lt,particleStyle:Fr,getParticleColor:Ts,pendingAnnotationFrameRef:$r,lastAnnotationFrameTimeRef:Hr,setAnnotationFrame:rs,scheduleNextFrame:()=>{mr()},syncColorMap:()=>vs(t),onSceneOrStyleChange:({inventoryChanged:r,geometryChanged:s})=>{r&&(ve(ys.current,t.sceneNodes,t.sceneEdges)||Yt(e)),(ys.current.nodes||ys.current.edges)&&(r||s)&&ke({canvas:e,pointer:Us.current,store:t,margin:dr,width:cr,height:ur,geometryMoved:s,cursorInventory:ys.current})}})},Xt(As),Qe(lt,Vr,Kt,mr,Ar.now,ss,is);let ni=ue&&qr?/* @__PURE__ */ks(dt,{x:qr.x,y:qr.y,containerWidth:cr,containerHeight:ur,margin:dr,className:"stream-network-tooltip",zIndex:2,children:he?he(qr):/* @__PURE__ */ks(F,{data:qr})}):null;if(Gt||!Wr&&Ir)/* @__PURE__ */
34
+ /* @__PURE__ */hs("div",{style:{fontWeight:600},children:n}),o.entries.map(e=>/* @__PURE__ */ys("div",{style:{marginTop:4,opacity:.8},children:[e.key,": ",Pe(e.value)]},e.key)),!a&&null!=t.value&&t.value>0&&/* @__PURE__ */ys("div",{style:{marginTop:4,opacity:.8},children:["Total:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]}),s>0&&/* @__PURE__ */ys("div",{style:{marginTop:4,opacity:.8},children:["Connections: ",s,i!==s&&` (weighted: ${i.toLocaleString()})`]})]})}function Y(e){let{currentTheme:t,...r}=e;return{...r,themeCategorical:t?.colors?.categorical,themeSemantic:mr(t)}}function z(e){return e._cachedPath2D&&e._cachedPath2DSource===e.pathD||(e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD),e._cachedPath2D}function j(e,t){for(let r of t)switch(r.type){case"bezier":X(e,r);break;case"line":H(e,r);break;case"ribbon":$(e,r);break;case"curved":V(e,r)}}function X(e,t){if(!t.pathD)return;e.save();let r=z(t);if(t.style.fill&&"none"!==t.style.fill){let s=t._gradient;if(s){let r=e.createLinearGradient(s.x0,s.y0??0,s.x1,s.y1??0),i=t.style.fillOpacity??t.style.opacity??.5,o="string"==typeof t.style.fill?t.style.fill:"#999",n=yr(e,o)||o;r.addColorStop(0,1===s.from?n:"transparent"),r.addColorStop(1,1===s.to?n:"transparent"),e.fillStyle=r,e.globalAlpha=i}else e.fillStyle=fr(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5;e.fill(r)}t.style.stroke&&"none"!==t.style.stroke&&(t.style.strokeWidth??.5)>0&&(e.strokeStyle=yr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.5*(t.style.opacity??1),e.stroke(r)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.2*t._pulseIntensity,e.fill(r)),e.restore()}function H(e,t){if("none"===t.style.stroke||0>=(t.style.strokeWidth??1))return;e.save();let r=t.style.stroke||"#999";e.strokeStyle=yr(e,r)||r,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.strokeDasharray&&e.setLineDash(t.style.strokeDasharray.split(/[\s,]+/).map(Number)),e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke(),t._pulseIntensity&&t._pulseIntensity>0&&(e.setLineDash([]),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=(t.style.strokeWidth??1)+3*t._pulseIntensity,e.globalAlpha=.4*t._pulseIntensity,e.beginPath(),e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.stroke()),e.restore()}function $(e,t){if(!t.pathD)return;e.save();let r=z(t);t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=fr(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??t.style.opacity??.5,e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(t.style.strokeWidth??.5)>0&&(e.strokeStyle=yr(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth??.5,e.globalAlpha=.3*(t.style.opacity??1),e.stroke(r)),t._pulseIntensity&&t._pulseIntensity>0&&(e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.globalAlpha=.25*t._pulseIntensity,e.fill(r)),e.restore()}function V(e,t){if(!t.pathD)return;e.save();let r=z(t);if("none"!==t.style.stroke&&(t.style.strokeWidth??1)>0){let s=t.style.stroke||"#999";e.strokeStyle=yr(e,s)||s,e.lineWidth=t.style.strokeWidth??1,void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.stroke(r)}t.style.fill&&"none"!==t.style.fill&&(e.fillStyle=fr(e,t.style.fill,"#007bff"),e.globalAlpha=t.style.fillOpacity??.1,e.fill(r)),e.restore()}function G(e,t){for(let r of t){if("rect"!==r.type)continue;let t=r;0>=t.w||0>=t.h||(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),lr(e,t.style,"#007bff",()=>e.fillRect(t.x,t.y,t.w,t.h)),dr(e,t.style,()=>e.strokeRect(t.x,t.y,t.w,t.h)),st(e,t),e.restore())}}function Q(e,t){for(let r of t){if("circle"!==r.type)continue;let t=r;0>=t.r||(e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.r,0,2*Math.PI),lr(e,t.style,"#007bff",()=>e.fill()),dr(e,t.style,()=>e.stroke()),it(e,t),e.restore())}}function K(e,t){for(let r of t){if("arc"!==r.type)continue;let t=r;e.save(),void 0!==t.style.opacity&&(e.globalAlpha=t.style.opacity),e.beginPath(),e.arc(t.cx,t.cy,t.outerR,t.startAngle,t.endAngle),e.arc(t.cx,t.cy,t.innerR,t.endAngle,t.startAngle,!0),e.closePath(),lr(e,t.style,"#007bff",()=>e.fill()),dr(e,t.style,()=>e.stroke()),e.restore()}}function q(e,t,r,s,i){let o=s.radius??3;e.globalAlpha=s.opacity??.7;for(let n=0;t.particles.length>n;n++){let a=t.particles[n];if(!a.active)continue;let l,d=r[a.edgeIndex];d&&(l="string"==typeof s.color&&"inherit"!==s.color?s.color:i(d),e.fillStyle=yr(e,l)||l,e.beginPath(),e.arc(a.x,a.y,o,0,2*Math.PI),e.fill())}e.globalAlpha=1}function U(e,t,r,s,i=Math.random){let o=s.spawnRate??.1,n=s.maxPerEdge??50;for(let s=0;t.length>s;s++){let a=t[s];if(!a.bezier||e.countForEdge(s)>=n)continue;let l=a.value*o*r*(a.bezier.circular?.3:1),d=Math.floor(l),c=l-d,u=d;i()<c&&u++;for(let t=0;u>t&&e.countForEdge(s)<n;t++)e.spawn(s,i)}}function J(e){let{canvas:t,store:r,sceneRevisionDiagnostics:s,size:i,margin:o,adjustedWidth:n,adjustedHeight:a,background:l,themeBackground:d,maxDevicePixelRatio:c,renderMode:u,hasBackgroundGraphics:h=!1,dirtyRef:y,resolutionDirtyRef:g,lastFrameTimeRef:p,now:f,random:m,reducedMotion:v,showParticles:k,isContinuous:b,animate:_,decay:x,pulse:w,thresholds:S,staleness:A,particleStyle:C,getParticleColor:N,pendingAnnotationFrameRef:R,lastAnnotationFrameTimeRef:E,setAnnotationFrame:T,scheduleNextFrame:P,syncColorMap:D,onSceneOrStyleChange:W}=e,I=t.getContext("2d");if(!I)return;let L=p.current?Math.min((f-p.current)/1e3,.1):.016;p.current=f;let M=null!=r.transition,B=r.advanceTransition(v?f+1e6:f),O=!v&&B,F=M&&!B,Y=!v&&r.tickAnimation([n,a],L),z=y.current,X=s?.beforeCompute(r.getLastUpdateResult(),O),H=M||z||Y;H&&(r.buildScene([n,a]),z&&D?.()),X&&s?.afterCompute(X,H,!0);let $=k&&!v&&!!r.particlePool,V=!!x||!!w||!!S||!1!==_&&r.hasActiveTopologyDiff||r.hasActivePulses||r.hasActiveThresholds,J=r.consumeStylePaintPending();(H||J)&&W?.({inventoryChanged:z||J,geometryChanged:H});let Z=we({dirtyOrRebuilt:H,transitioning:O,animationTicked:Y,continuous:$||b,liveEncoding:V,forced:J||!0===g?.current});g&&(g.current=!1);let ee=!!A&&r.lastIngestTime>0&&f-r.lastIngestTime>(A?.threshold??5e3);if(Z){let e=pt(c,i);if(!yt(t,i,o,e))return;if(I.clearRect(-o.left,-o.top,i[0],i[1]),rt(I,{background:l,themeBackground:d,hasBackgroundGraphics:h,x:-o.left,y:-o.top,width:i[0],height:i[1]}),x&&r.applyDecay(),w&&r.applyPulse(f),S&&r.applyThresholds(f),!1!==_&&r.applyTopologyDiff(f),ee&&(I.globalAlpha=A?.dimOpacity??.5),Ee({context:I,nodes:r.sceneEdges,renderMode:u,pixelRatio:e,paintBuiltIn:e=>j(I,e)}),Ee({context:I,nodes:r.sceneNodes,renderMode:u,pixelRatio:e,paintBuiltIn:e=>{let t=e;G(I,t),Q(I,t),K(I,t),Se(I,t),Ae(I,t)}}),$&&!ee){let e=r.edgesArray;if(e.length>0){U(r.particlePool,e,L,C,m);let t,s=.5*(C.speedMultiplier??1);if(C.proportionalSpeed){let r=e.reduce((e,t)=>Math.max(e,t.value||1),1);t=e.map(e=>.3+(e.value||1)/r*1.7)}r.particlePool.step(L,s,e,t),q(I,r.particlePool,e,C,N)}}ee&&(I.globalAlpha=1)}y.current=!1,H&&t.setAttribute("aria-label",er(r.sceneNodes?.length??0,r.sceneEdges?.length??0,"Network chart"));let te=H||R.current;!te||!F&&33>f-E.current?R.current=!!te:(T(e=>e+1),E.current=f,R.current=!1),(b||O||null!=r.transition||Y||r.hasActivePulses||r.hasActiveThresholds||!1!==_&&r.hasActiveTopologyDiff||R.current)&&P()}function Z(e,t){return e?"object"==typeof e?e:t?.get(e)??null:null}function ee(e){let{node:t,colorBy:r,colorScheme:s,nodeColorMap:i,colorIndexRef:o}=e;if("function"==typeof r)return r(t)+"";if("string"==typeof r&&t.data){let e=t.data[r];if(void 0!==e){if(!i.has(e+"")){let t=Array.isArray(s)?s:ar;i.set(e+"",t[o.current++%t.length])}return i.get(e+"")}}if(i.has(t.id))return i.get(t.id);let n=Array.isArray(s)?s:ar,a=r?n[o.current++%n.length]:n[0];return i.set(t.id,a),a}function te(e){let{edge:t,edgeColorBy:r,getNodeColor:s,resolveEndpoint:i,fallback:o}=e;if("function"==typeof r)return r(t);let n=i(t.source),a=i(t.target);return"target"===r&&a?s(a):n?s(n):o}function re(e){let{edge:t,particleStyleColor:r,particleColorBy:s,hasExplicitParticleColorBy:i,getEdgeColor:o,getNodeColor:n,resolveEndpoint:a,fallback:l}=e;if("function"==typeof r){let e=a(t.source);return e?r(t,e):l}if(!i)return o(t);let d=s,c=a(t.source),u=a(t.target);return"target"===d&&u?n(u):c?n(c):l}function se(e){let{sceneNodes:t,nodes:r,nodeColorMap:s,colorScheme:i}=e;for(let e of t)e.id&&"string"==typeof e.style?.fill&&s.set(e.id,e.style.fill);let o=Array.isArray(i)?i:ar,n=Array.from(r);for(let e=0;n.length>e;e++){let t=n[e];s.has(t.id)||s.set(t.id,o[e%o.length])}return n.length}function ie(e,t,r,s,i=30,o,n=0,a=!0){let l=null,d=1/0,c=1/0;if(o){let e=Ge(o,r,s,i,n,e=>e.cx,e=>e.cy,e=>e.r);e&&(l={mark:e.node,type:"node",datum:e.node.datum,x:e.node.cx,y:e.node.cy,distance:e.distance},d=e.distance)}for(let t of e){if(o&&"circle"===t.type)continue;let e=oe(t,r,s,i);if(e)if(e.mark=t,"rect"===t.type){let r=t.w*t.h;c>r&&(l=e,c=r)}else d>e.distance&&(l=e,d=e.distance)}if(l)return l;if(!a)return null;for(let e of t){if(!1===e.interactive)continue;let t=he(e,r,s);t&&(t.mark=e),t&&d>t.distance&&(l=t,d=t.distance)}return l}function oe(e,t,r,s=30){if(!e.datum)return null;switch(e.type){case"circle":return le(e,t,r,s);case"rect":return de(e,t,r);case"arc":return ce(e,t,r);case"symbol":return ae(e,t,r,s);case"glyph":return ne(e,t,r,s);default:return null}}function ne(e,t,r,s=30){let i=hr(e.glyph,e.size),o=e.cx+i.centerDx,n=e.cy+i.centerDy,a=t-o,l=r-n,d=Math.sqrt(a*a+l*l);return d>$e(i.radius,s)?null:{type:"node",datum:e.datum,x:o,y:n,distance:d}}function ae(e,t,r,s=30){let i=t-e.cx,o=r-e.cy,n=Math.sqrt(i*i+o*o);return n>$e(ur(e.size),s)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:n}}function le(e,t,r,s=30){let i=t-e.cx,o=r-e.cy,n=Math.sqrt(i*i+o*o);return n>$e(e.r,s)?null:{type:"node",datum:e.datum,x:e.cx,y:e.cy,distance:n}}function de(e,t,r){let s=He(t,r,e);return s.hit?{type:"node",datum:e.datum,x:s.cx,y:s.cy,distance:0}:null}function ce(e,t,r){let s=t-e.cx,i=r-e.cy,o=Math.sqrt(s*s+i*i);if(e.innerR-2>o||o>e.outerR+2)return null;let n=Ve(Math.atan2(i,s)),a=Ve(e.startAngle),l=Ve(e.endAngle);if(a>l?n>=a||l>=n:n>=a&&l>=n){let t=(e.startAngle+e.endAngle)/2,r=(e.innerR+e.outerR)/2;return{type:"node",datum:e.datum,x:e.cx+r*Math.cos(t),y:e.cy+r*Math.sin(t),distance:0}}return null}function ue(e){if(e._cachedPath2D&&e._cachedPath2DSource===e.pathD)return e._cachedPath2D;try{return e._cachedPath2D=new Path2D(e.pathD),e._cachedPath2DSource=e.pathD,e._cachedPath2D}catch{return null}}function he(e,t,r){switch(e.type){case"bezier":case"ribbon":case"curved":return ge(e,t,r);case"line":return ye(e,t,r);default:return null}}function ye(e,t,r){let s=e.x2-e.x1,i=e.y2-e.y1,o=s*s+i*i;if(0===o)return null;let n=((t-e.x1)*s+(r-e.y1)*i)/o;n=Math.max(0,Math.min(1,n));let a=e.x1+n*s,l=e.y1+n*i,d=Math.sqrt((t-a)**2+(r-l)**2);return d>5?null:{type:"edge",datum:e.datum,x:a,y:l,distance:d}}function ge(e,t,r){if(!e.pathD)return null;let s=ue(e),i=(fs||((ps=document.createElement("canvas")).width=1,ps.height=1,fs=ps.getContext("2d")),fs);if(!s||!i)return null;try{if(i.isPointInPath(s,t,r))return{type:"edge",datum:e.datum,x:t,y:r,distance:0};let o=i.lineWidth;i.lineWidth=10;let n=i.isPointInStroke(s,t,r);if(i.lineWidth=o,n)return{type:"edge",datum:e.datum,x:t,y:r,distance:4}}catch{}return null}function pe(e){let{clientX:t,clientY:r,canvasRect:s,margin:i,adjustedWidth:o,adjustedHeight:n,sceneNodes:a,sceneEdges:l,nodeQuadtree:d,maxNodeRadius:c,hitRadius:u=30,includeEdges:h=!0}=e,y=t-s.left-i.left,g=r-s.top-i.top;if(0>y||y>o||0>g||g>n)return{kind:"miss-outside"};let p=ie(a,l,y,g,u,d,c,h);return p?{kind:"hit",hover:xt(p.datum||{},p.x,p.y,{nodeOrEdge:p.type}),mark:p.mark}:{kind:"miss"}}function fe({customHoverBehavior:e,customClickBehavior:t,onObservation:r,chartId:s}){return{customHoverBehavior:ms((t,i)=>{e?.(t,i),Pt({onObservation:r,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:vs,chartId:s,context:i})},[e,r,s]),customClickBehavior:ms((e,i)=>{t?.(e,i),Dt({onObservation:r,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:vs,chartId:s,context:i})},[t,r,s])}}function me(e,t,r,s,i){return("sankey"===e||t)&&r||s||i}function ve(e,t,r){return e.nodes=Ot(t),e.edges=Ot(r),e.nodes||e.edges}function ke(e){jt(e.canvas,e.pointer,t=>{let r=pe({clientX:t.clientX,clientY:t.clientY,canvasRect:e.canvas.getBoundingClientRect(),margin:e.margin,adjustedWidth:e.width,adjustedHeight:e.height,sceneNodes:e.store.sceneNodes,sceneEdges:e.store.sceneEdges,nodeQuadtree:e.geometryMoved?null:e.store.nodeQuadtree,maxNodeRadius:e.geometryMoved?0:e.store.maxNodeRadius,includeEdges:e.cursorInventory.edges});return"hit"===r.kind?Lt(r.mark):void 0})}import{c as be,d as _e,e as xe}from"./c-YMFUIO54.min.js";import{a as we}from"./c-BYJJ7EMG.min.js";import{b as Se}from"./c-TIMGODBG.min.js";import{b as Ae}from"./c-3AGX252H.min.js";import{b as Ce}from"./c-QXLDCATV.min.js";import{B as Ne,D as Re,E as Ee,F as Te,I as Pe,M as De,N as We,R as Ie,S as Le,W as Me,a as Be,d as Oe,e as Fe,f as Ye,g as ze,h as je,i as Xe,k as He,l as $e,n as Ve,o as Ge,q as Qe,r as Ke,s as qe,t as Ue,u as Je,v as Ze,w as et,x as tt,z as rt}from"./c-SAP5KY6R.min.js";import{b as st,c as it}from"./c-V5KFJWQQ.min.js";import{a as ot,c as nt}from"./c-CLLCX3PT.min.js";import{a as at,b as lt}from"./c-N5WT7TXG.min.js";import{Ca as dt,D as ct,Fa as ut,H as ht,Ha as yt,I as gt,Ia as pt,J as ft,Ja as mt,K as vt,Ka as kt,L as bt,M as _t,Ma as xt,Na as wt,R as St,U as At,V as Ct,W as Nt,Wa as Rt,Xa as Et,Y as Tt,Ya as Pt,Za as Dt,b as Wt,c as It,ca as Lt,cb as Mt,d as Bt,da as Ot,e as Ft,ea as Yt,f as zt,ga as jt,ha as Xt,ia as Ht,ja as $t,ka as Vt,o as Gt,oa as Qt,p as Kt,q as qt,qa as Ut,r as Jt,s as Zt,sa as er,ua as tr,va as rr,wa as sr,xa as ir,ya as or}from"./c-UMGHCBH5.min.js";import{a as nr,m as ar}from"./c-Y342FJ6K.min.js";import{B as lr,C as dr,a as cr,b as ur,i as hr,m as yr,r as gr,t as pr,x as fr}from"./c-3BYZXCX3.min.js";import{e as mr}from"./c-5NYONM6V.min.js";import*as vr from"react";import{useRef as kr,useState as br,useEffect as _r,useMemo as xr,useCallback as wr,useImperativeHandle as Sr,forwardRef as Ar,memo as Cr}from"react";var Nr={weightChange:.1,newEdge:.5,newNode:1,threshold:3,transitionDuration:500},Rr={radius:3,opacity:.7,speedMultiplier:1,maxPerEdge:50,spawnRate:.1},Er=class{constructor(e){this.capacity=e,this.particles=Array(e),this._freeIndices=Array(e);for(let t=0;e>t;t++)this.particles[t]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices[t]=e-1-t}spawn(e,t=Math.random){let r=this._freeIndices.pop();if(void 0===r)return null;let s=this.particles[r];return s.active=!0,s.t=0,s.offset=t()-.5,s.edgeIndex=e,s.x=0,s.y=0,s}step(t,r,s,i){for(let o=0;this.capacity>o;o++){let n=this.particles[o];if(!n.active)continue;let a=s[n.edgeIndex];a&&a.bezier?(n.t+=t*r*(i?i[n.edgeIndex]??1:1)*(a.bezier.circular?.3:1),1>n.t?e(a.bezier,n.t,n.offset,n):(n.active=!1,this._freeIndices.push(o))):(n.active=!1,this._freeIndices.push(o))}}countForEdge(e){let t=0;for(let r=0;this.capacity>r;r++)this.particles[r].active&&this.particles[r].edgeIndex===e&&t++;return t}clear(){for(let e=0;this.capacity>e;e++)this.particles[e].active=!1;this._freeIndices.length=0;for(let e=this.capacity-1;e>=0;e--)this._freeIndices.push(e)}resize(e){if(this.capacity>=e)return;let t=this.particles;this.particles=Array(e);for(let r=0;e>r;r++)t.length>r?this.particles[r]=t[r]:(this.particles[r]={t:0,offset:0,edgeIndex:0,active:!1,x:0,y:0},this._freeIndices.push(r));this.capacity=e}},Tr=/* @__PURE__ */Object.create(null),Pr=!1;import{quadtree as Dr}from"d3-quadtree";import{interpolateNumber as Wr}from"d3-interpolate";var Ir=.5,Lr="rgba(34, 197, 94, 0.7)",Mr=2e3,Br=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Or=["scene-style","data-paint","accessibility","evidence"],Fr=(e,t)=>({retainedData:e,invalidations:t}),Yr=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],zr=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],jr=["scene-geometry","data-paint","overlay","accessibility","evidence"],Xr=["scene-style","data-paint","accessibility","evidence"],Hr=["scene-geometry","data-paint","overlay","accessibility","evidence"],$r=[],Vr={chartType:Fr("rebuild",Yr),nodeIDAccessor:Fr("rebuild",Yr),sourceAccessor:Fr("rebuild",Yr),targetAccessor:Fr("rebuild",Yr),valueAccessor:Fr("rebuild",Yr),edgeIdAccessor:Fr("rebuild",Yr),childrenAccessor:Fr("rebuild",Yr),hierarchySum:Fr("rebuild",Yr),orientation:Fr("preserve",zr),nodeAlign:Fr("preserve",zr),nodePaddingRatio:Fr("preserve",zr),nodeWidth:Fr("preserve",zr),edgeSort:Fr("preserve",zr),iterations:Fr("preserve",zr),forceStrength:Fr("preserve",zr),padAngle:Fr("preserve",zr),groupWidth:Fr("preserve",zr),sortGroups:Fr("preserve",zr),treeOrientation:Fr("preserve",zr),edgeType:Fr("preserve",zr),padding:Fr("preserve",zr),paddingTop:Fr("preserve",zr),orbitMode:Fr("preserve",zr),orbitSize:Fr("preserve",zr),orbitSpeed:Fr("preserve",zr),orbitRevolution:Fr("preserve",zr),orbitRevolutionStyle:Fr("preserve",zr),orbitEccentricity:Fr("preserve",zr),orbitShowRings:Fr("preserve",zr),orbitAnimated:Fr("preserve",zr),customNetworkLayout:Fr("preserve",zr),layoutConfig:Fr("preserve",zr),nodeSize:Fr("preserve",jr),nodeSizeRange:Fr("preserve",jr),colorByDepth:Fr("preserve",jr),nodeLabel:Fr("preserve",Hr),showLabels:Fr("preserve",Hr),labelMode:Fr("preserve",Hr),nodeStyle:Fr("preserve",Xr),edgeStyle:Fr("preserve",Xr),colorBy:Fr("preserve",Xr),colorScheme:Fr("preserve",Xr),themeCategorical:Fr("preserve",Xr),themeSemantic:Fr("preserve",Xr),edgeColorBy:Fr("preserve",Xr),edgeOpacity:Fr("preserve",Xr),showParticles:Fr("preserve",Xr),particleStyle:Fr("preserve",Xr),decay:Fr("preserve",Xr),pulse:Fr("preserve",Xr),thresholds:Fr("preserve",Xr),staleness:Fr("preserve",Xr),layoutSelection:Fr("preserve",Xr),clock:Fr("preserve",$r),random:Fr("preserve",$r),seed:Fr("preserve",$r),tensionConfig:Fr("preserve",$r),transition:Fr("preserve",$r),introAnimation:Fr("preserve",$r),onLayoutError:Fr("preserve",$r),__skipForceSimulation:Fr("preserve",$r),__hierarchyRoot:Fr("preserve",$r),__orbitState:Fr("preserve",$r),__previousPositions:Fr("preserve",$r)},Gr=Fr("preserve",zr),Qr=class{constructor(){this.tracker=new Kt}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},Br)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},Or):this.recordNoop("restyle")}recordConfig(e){let t=k(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},Kr=class{constructor(e){this.restyle=e,this.key=null,this.pending=null}reuse(e,t,r,s,i){let o=_(e,t,r,s),n=null!==this.key&&et(this.key.selection,o.selection);return this.key&&et(this.key.geometry,o.geometry)&&et(this.key.colors,o.colors)&&(i||n)?(n||this.restyle(e.layoutSelection??null),this.key=o,!0):(this.key=null,this.pending=o,!1)}commit(){this.key=this.pending,this.pending=null}clear(){this.key=null,this.pending=null}},qr=class e{constructor(e){this.nodes=/* @__PURE__ */new Map,this.edges=/* @__PURE__ */new Map,this.tension=0,this.layoutVersion=0,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],this.customLayoutBackgrounds=null,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this.customLayoutHtmlMarks=[],this._customLayoutDiagnosticsWarned=/* @__PURE__ */new Set,this._customLayoutCache=new Kr(e=>this.restyleScene(e)),this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this._nodeQuadtree=null,this._maxNodeRadius=0,this._sceneNodesRevision=0,this._nodeQuadtreeRevision=-1,this._nodesArrCache=null,this._edgesArrCache=null,this._arrCacheVersion=-1,this.particlePool=null,this.updateResults=new Qr,this.transition=null,this._hasRenderedOnce=!1,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.lastIngestTime=0,this.nodeTimestamps=/* @__PURE__ */new Map,this.edgeTimestamps=/* @__PURE__ */new Map,this._decaySortedNodes=null,this._decayAgeMap=null,this.addedNodes=/* @__PURE__ */new Set,this.removedNodes=/* @__PURE__ */new Set,this.addedEdges=/* @__PURE__ */new Set,this.removedEdges=/* @__PURE__ */new Set,this.lastTopologyChangeTime=0,this.previousNodeIds=/* @__PURE__ */new Set,this.previousEdgeKeys=/* @__PURE__ */new Set,this._networkDecayCache=null,this._lastPositionSnapshot=null,this.config=e,this.tensionConfig={...Nr,...e.tensionConfig},e.showParticles&&("sankey"===e.chartType||e.customNetworkLayout)&&(this.particlePool=new Er(2e3))}currentTime(){return this.config.clock?.()??zt()}updateConfig(e){let t=this.config,r={...t,...e};t.__orbitState&&(r.__orbitState=t.__orbitState),t.__hierarchyRoot&&(r.__hierarchyRoot=t.__hierarchyRoot),void 0===e.layoutSelection&&null!=t.layoutSelection&&(r.layoutSelection=t.layoutSelection);let s=[.../* @__PURE__ */new Set([...Object.keys(t),...Object.keys(r)])].filter(e=>t[e]!==r[e]);this.config=r,this.tensionConfig={...Nr,...r.tensionConfig},r.showParticles&&("sankey"===r.chartType||r.customNetworkLayout)&&!this.particlePool&&(this.particlePool=new Er(2e3)),this.updateResults.recordConfig(s)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}ingestHierarchy(e,t){this._boundedPrevSnapshot=/* @__PURE__ */new Map;for(let[e,t]of this.nodes)(0!==t.x0||0!==t.x1||0!==t.y0||0!==t.y1)&&this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this.config.__hierarchyRoot=e,this.runLayout(t),this._boundedPrevSnapshot=null,this.updateResults.recordData("replace",1)}ingestBounded(e,t,r,s){let{nodeIDAccessor:i="id",sourceAccessor:o="source",targetAccessor:l="target",valueAccessor:d="value"}=this.config,c="function"==typeof i?i:e=>e[i],u="function"==typeof o?o:e=>e[o],h="function"==typeof l?l:e=>e[l],y="function"==typeof d?d:e=>e[d]??1;this._boundedPrevSnapshot=/* @__PURE__ */new Map;for(let[e,t]of this.nodes)(0!==t.x0||0!==t.x1||0!==t.y0||0!==t.y1)&&this._boundedPrevSnapshot.set(e,{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});this._boundedEdgeSnapshot=/* @__PURE__ */new Map;for(let[,e]of this.edges)e.sankeyWidth>0&&this._boundedEdgeSnapshot.set(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`,{y0:e.y0,y1:e.y1,sankeyWidth:e.sankeyWidth});this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(let t of e){let e=c(t)+"";this.nodes.set(e,{...n(e),data:t})}for(let e=0;t.length>e;e++){let r=t[e],s=u(r)+"",i=h(r)+"",o=y(r),l=null==o?NaN:Number(o),d=Number.isFinite(l)?l:1;this.nodes.has(s)||this.nodes.set(s,{...n(s),data:r}),this.nodes.has(i)||this.nodes.set(i,{...n(i),data:r});let c=`${s}\0${i}\0${e}`,g={source:s,target:i,value:d,y0:0,y1:0,sankeyWidth:0,data:r,_edgeKey:c};r&&"object"==typeof r&&a(r.bezier)&&(g.bezier=r.bezier),this.edges.set(c,g)}s?.deferLayout||this.runLayout(r),this.updateResults.recordData("replace",e.length+t.length)}ingestBoundedWithResult(e,t,r,s){return this.ingestBounded(e,t,r,s),this.updateResults.last}applyForceLayoutPositions(e,t){for(let[t,r]of Object.entries(e)){let e=this.nodes.get(t);e&&(e.x=r.x,e.y=r.y)}this.config.__skipForceSimulation=!0;try{this.runLayout(t)}finally{this.config.__skipForceSimulation=void 0}}edgeKey(e,t){return`${e}\0${t}`}ingestEdge(e){let{source:t,target:r,value:s}=e,i=0===this.nodes.size,o=!1,a=this.currentTime();this.lastIngestTime=a,this._decaySortedNodes=null,this._networkDecayCache=null,this.nodes.has(t)||(this.nodes.set(t,n(t)),this.nodeTimestamps.set(t,a),this.tension+=this.tensionConfig.newNode,o=!0),this.nodes.has(r)||(this.nodes.set(r,n(r)),this.nodeTimestamps.set(r,a),this.tension+=this.tensionConfig.newNode,o=!0);let l=this.edgeKey(t,r),d=this.edges.get(l),c=!1;d?(d.value+=s,this.edgeTimestamps.set(l,a),this.tension+=this.tensionConfig.weightChange,c=!0):(this.edges.set(l,{source:t,target:r,value:s,y0:0,y1:0,sankeyWidth:0}),this.edgeTimestamps.set(l,a),this.tension+=this.tensionConfig.newEdge,o=!0);let u=i||o||c||this.tension>=this.tensionConfig.threshold;return this.updateResults.recordData("ingest",1),u}ingestEdgeWithResult(e){return this.ingestEdge(e),this.updateResults.last}runLayout(e){if(this.config.customNetworkLayout)return this.recordTopologyDiff(),void this.layoutVersion++;let t=i(this.config.chartType);if(!t)return void o(this.config.chartType);let r=Array.from(this.nodes.values()),s=Array.from(this.edges.values());if(0===r.length&&!t.hierarchical)return;if(this.prepareForRelayout(),t.supportsStreaming&&!t.hierarchical){let e=/* @__PURE__ */new Map;for(let t of r)void 0!==t._prevX0?e.set(t.id,{x:(t._prevX0??0)+((t._prevX1??0)-(t._prevX0??0))/2,y:(t._prevY0??0)+((t._prevY1??0)-(t._prevY0??0))/2}):(0!==t.x||0!==t.y)&&e.set(t.id,{x:t.x,y:t.y});if(this._lastPositionSnapshot)for(let[t,r]of this._lastPositionSnapshot)e.has(t)||e.set(t,r);this.config.__previousPositions=e.size>0?e:void 0}if(t.computeLayout(r,s,this.config,e),this.config.__previousPositions=void 0,t.hierarchical&&r.length>0){this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null;for(let e of r)this.nodes.set(e.id,e);for(let e=0;s.length>e;e++){let t=s[e],r=t._edgeKey||`${"string"==typeof t.source?t.source:t.source.id}\0${"string"==typeof t.target?t.target:t.target.id}\0${e}`;t._edgeKey=r,this.edges.set(r,t)}let e=this._boundedPrevSnapshot;if(e&&e.size>0)for(let t of this.nodes.values()){let r=e.get(t.id);r&&(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.y1)}this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,r=Array.from(this.nodes.values())}this.finalizeLayout();let n=/* @__PURE__ */new Map;for(let e of this.nodes.values())(0!==e.x||0!==e.y)&&n.set(e.id,{x:e.x,y:e.y});this._lastPositionSnapshot=n,this.saveTargetPositions();let a=r.some(e=>void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1||0!==e._prevY0||0!==e._prevY1)),l=this.config.transition?.duration??this.tensionConfig.transitionDuration,d=["sankey","tree","treemap","circlepack","partition"].includes(this.config.chartType);if(!this._hasRenderedOnce&&this.config.introAnimation&&d&&r.length>0&&l>0){let t=e[0]/2,r=e[1]/2;for(let e of this.nodes.values())e._prevX0=t,e._prevX1=t,e._prevY0=r,e._prevY1=r;for(let e of this.edges.values())e._prevY0=r,e._prevY1=r,e._prevSankeyWidth=0,e._introFromZero=!0;this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:l}}else a&&l>0&&(this.restorePreviousPositions(),this.transition={startTime:this.currentTime(),duration:l});this._hasRenderedOnce=!0,this.recordTopologyDiff(),this.layoutVersion++}recordTopologyDiff(){let e=new Set(this.nodes.keys()),t=new Set(this.edges.keys());this.addedNodes=/* @__PURE__ */new Set,this.removedNodes=/* @__PURE__ */new Set,this.addedEdges=/* @__PURE__ */new Set,this.removedEdges=/* @__PURE__ */new Set;for(let t of e)this.previousNodeIds.has(t)||this.addedNodes.add(t);for(let t of this.previousNodeIds)e.has(t)||this.removedNodes.add(t);for(let e of t)this.previousEdgeKeys.has(e)||this.addedEdges.add(e);for(let e of this.previousEdgeKeys)t.has(e)||this.removedEdges.add(e);(this.addedNodes.size>0||this.removedNodes.size>0||this.addedEdges.size>0||this.removedEdges.size>0)&&(this.lastTopologyChangeTime=this.currentTime()),this.previousNodeIds=e,this.previousEdgeKeys=t}restyleScene(e){let t=A({nodes:this.sceneNodes,edges:this.sceneEdges,restyle:this._customRestyle,restyleEdge:this._customRestyleEdge,baseStyles:this._baseStyles,selection:e});this.markStylePaintPending(),this.updateResults.recordRestyle(t)}buildScene(e){if(this.config.customNetworkLayout){if(this._customLayoutCache.reuse(this.config,e,this.getUpdateSnapshot().revisions.data,this.layoutVersion,this.hasCustomRestyle))return;let t=b({config:this.config,customLayout:this.config.customNetworkLayout,size:e,nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values()),previousResult:this.lastCustomLayoutResult,revision:this.layoutVersion});if("failure"===t.kind)return this.lastCustomLayoutFailure=t.diagnostic,void(t.preservedLastGoodScene||(this.sceneNodes=[],this.sceneEdges=[],this.labels=[],w(this),this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this._sceneNodesRevision++));let r=t.result;return this._customLayoutCache.commit(),this.sceneNodes=r.sceneNodes??[],this.sceneEdges=r.sceneEdges??[],this.labels=r.labels??[],x(this,r),this.lastCustomLayoutFailure=null,this._sceneNodesRevision++,this._customRestyle=r.restyle,this._customRestyleEdge=r.restyleEdge,this.hasCustomRestyle=!(!r.restyle&&!r.restyleEdge),this.hasCustomRestyle&&(this._baseStyles=S(this.sceneNodes,this.sceneEdges),this.restyleScene(this.config.layoutSelection??null)),void Oe({label:"customNetworkLayout",nodes:this.sceneNodes,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned})}this._customLayoutCache.clear(),this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,w(this),this.lastCustomLayoutFailure=null;let t=i(this.config.chartType);if(!t)return o(this.config.chartType),void this._sceneNodesRevision++;let r=t.hierarchical?Array.from(this.nodes.values()):this.nodesArray,s=t.hierarchical?Array.from(this.edges.values()):this.edgesArray,{sceneNodes:n,sceneEdges:a,labels:l}=t.buildScene(r,s,this.config,e);this.sceneNodes=n,this.sceneEdges=a,this.labels=l,this._sceneNodesRevision++}rebuildNodeQuadtree(){let t=0,r=0;for(let e of this.sceneNodes)"circle"===e.type&&e.datum&&(t++,e.r>r&&(r=e.r));if(this._maxNodeRadius=r,e.QUADTREE_THRESHOLD>=t)return void(this._nodeQuadtree=null);let s=[];for(let e of this.sceneNodes)"circle"===e.type&&e.datum&&s.push(e);this._nodeQuadtree=Dr().x(e=>e.cx).y(e=>e.cy).addAll(s)}get nodeQuadtree(){return this._nodeQuadtreeRevision!==this._sceneNodesRevision&&(this.rebuildNodeQuadtree(),this._nodeQuadtreeRevision=this._sceneNodesRevision),this._nodeQuadtree}get maxNodeRadius(){return this._maxNodeRadius}_ensureArrays(){this._arrCacheVersion===this.layoutVersion&&this._nodesArrCache&&this._edgesArrCache||(this._nodesArrCache=Array.from(this.nodes.values()),this._edgesArrCache=Array.from(this.edges.values()),this._arrCacheVersion=this.layoutVersion)}get nodesArray(){return this._ensureArrays(),this._nodesArrCache}get edgesArray(){return this._ensureArrays(),this._edgesArrCache}get isAnimating(){return!(!i(this.config.chartType)?.supportsAnimation||!1===this.config.orbitAnimated)}tickAnimation(e,t){let r=i(this.config.chartType);if(!r?.tick)return!1;let s=r.hierarchical?Array.from(this.nodes.values()):this.nodesArray,o=r.hierarchical?Array.from(this.edges.values()):this.edgesArray;return r.tick(s,o,this.config,e,t)}cancelIntroAnimation(){this.transition=null;for(let e of this.nodes.values())e._prevX0=void 0,e._prevX1=void 0,e._prevY0=void 0,e._prevY1=void 0;for(let e of this.edges.values())e._prevY0=void 0,e._prevY1=void 0,e._prevSankeyWidth=void 0,e._introFromZero=!1}advanceTransition(e){if(!this.transition)return!1;let t=Bt(e,this.transition),r=It(t);for(let e of this.nodes.values())void 0!==e._targetX0&&void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1)&&(e.x0=Ft(e._prevX0,e._targetX0,r),e.x1=Ft(e._prevX1,e._targetX1,r),e.y0=Ft(e._prevY0,e._targetY0,r),e.y1=Ft(e._prevY1,e._targetY1,r));for(let e of this.edges.values())void 0!==e._targetY0&&void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&(e._prevSankeyWidth>0||e._introFromZero)&&(e.y0=Ft(e._prevY0,e._targetY0,r),e.y1=Ft(e._prevY1,e._targetY1,r),e.sankeyWidth=Ft(e._prevSankeyWidth,e._targetSankeyWidth,r));return this.rebuildAllBeziers(),1>t||(this.snapToTargets(),this.transition=null,!1)}prepareForRelayout(){let e=this._boundedPrevSnapshot;for(let t of this.nodes.values()){let r=e?.get(t.id);r&&0===t.x0&&0===t.x1&&0===t.y0&&0===t.y1?(t._prevX0=r.x0,t._prevX1=r.x1,t._prevY0=r.y0,t._prevY1=r.y1):(t._prevX0=t.x0,t._prevX1=t.x1,t._prevY0=t.y0,t._prevY1=t.y1)}let t=this._boundedEdgeSnapshot;for(let e of this.edges.values()){if(t&&0===e.sankeyWidth){let r=t.get(`${"string"==typeof e.source?e.source:e.source.id}\0${"string"==typeof e.target?e.target:e.target.id}`);if(r){e._prevY0=r.y0,e._prevY1=r.y1,e._prevSankeyWidth=r.sankeyWidth;continue}}e._prevY0=e.y0,e._prevY1=e.y1,e._prevSankeyWidth=e.sankeyWidth}this.nodes.size>0&&(this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null)}finalizeLayout(){let e="vertical"===this.config.orientation?"down":"right";for(let e of this.nodes.values())0!==e.x0||0!==e.x1||0!==e.y0||0!==e.y1?(e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2):(e.x0=e.x-5,e.x1=e.x+5,e.y0=e.y-5,e.y1=e.y+5,e.width=10,e.height=10);for(let t of this.edges.values())t.direction=e,this.updateEdgeBezier(t);this.tension=0}saveTargetPositions(){for(let e of this.nodes.values())e._targetX0=e.x0,e._targetX1=e.x1,e._targetY0=e.y0,e._targetY1=e.y1;for(let e of this.edges.values())e._targetY0=e.y0,e._targetY1=e.y1,e._targetSankeyWidth=e.sankeyWidth}restorePreviousPositions(){for(let e of this.nodes.values())void 0!==e._prevX0&&(0!==e._prevX0||0!==e._prevX1)&&(e.x0=e._prevX0,e.x1=e._prevX1,e.y0=e._prevY0,e.y1=e._prevY1);for(let e of this.edges.values())void 0!==e._prevY0&&void 0!==e._prevSankeyWidth&&e._prevSankeyWidth>0&&(e.y0=e._prevY0,e.y1=e._prevY1,e.sankeyWidth=e._prevSankeyWidth);this.rebuildAllBeziers()}snapToTargets(){for(let e of this.nodes.values())void 0!==e._targetX0&&(e.x0=e._targetX0,e.x1=e._targetX1,e.y0=e._targetY0,e.y1=e._targetY1);for(let e of this.edges.values())void 0!==e._targetY0&&(e.y0=e._targetY0,e.y1=e._targetY1,e.sankeyWidth=e._targetSankeyWidth),e._introFromZero=void 0;this.rebuildAllBeziers()}updateEdgeBezier(e){u(e,this.nodes,Ir)}rebuildAllBeziers(){for(let e of this.nodes.values())e.width=e.x1-e.x0,e.height=e.y1-e.y0,e.x=e.x0+e.width/2,e.y=e.y0+e.height/2;for(let e of this.edges.values())this.updateEdgeBezier(e)}applyPulse(e){h({sceneNodes:this.sceneNodes,sceneEdges:this.sceneEdges,nodeTimestamps:this.nodeTimestamps,edgeTimestamps:this.edgeTimestamps,pulse:this.config.pulse,now:e})}applyDecay(){this._networkDecayCache||(this._networkDecayCache={sortedNodes:null,ageMap:null}),this._decaySortedNodes||(this._networkDecayCache.sortedNodes=null,this._networkDecayCache.ageMap=null),y({sceneNodes:this.sceneNodes,nodeTimestamps:this.nodeTimestamps,decay:this.config.decay,cache:this._networkDecayCache}),this._decaySortedNodes=this._networkDecayCache.sortedNodes,this._decayAgeMap=this._networkDecayCache.ageMap}applyTopologyDiff(e){g({sceneNodes:this.sceneNodes,addedNodes:this.addedNodes,lastTopologyChangeTime:this.lastTopologyChangeTime,now:e})}get hasActiveTopologyDiff(){return p(this.addedNodes,this.lastTopologyChangeTime)}applyThresholds(e){f({sceneNodes:this.sceneNodes,nodes:this.nodes,thresholds:this.config.thresholds,now:e})}get hasActiveThresholds(){return m(this.nodes.values(),this.config.thresholds)}get hasActivePulses(){return v({pulse:this.config.pulse,lastIngestTime:this.lastIngestTime})}getLayoutData(){return{nodes:Array.from(this.nodes.values()),edges:Array.from(this.edges.values())}}updateNode(e,t){let r=this.nodes.get(e);if(!r)return this.updateResults.recordNoop("update"),null;let s=r.data?{...r.data}:{};return r.data=t(r.data??{}),this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",1),s}updateEdge(e,t,r){let s=this.config.valueAccessor,i="function"==typeof s?s:s?e=>e[s]:e=>e.value,o=[];for(let[,s]of this.edges)if(("string"==typeof s.source?s.source:s.source.id)===e&&("string"==typeof s.target?s.target:s.target.id)===t){o.push(s.data?{...s.data}:{}),s.data=r(s.data??{});let e=i(s.data);null!=e&&(s.value=Number(e))}return o.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",o.length)):this.updateResults.recordNoop("update"),o}removeNode(e){if(!this.nodes.has(e))return this.updateResults.recordNoop("remove"),!1;this.nodes.delete(e),this.nodeTimestamps.delete(e);for(let[t,r]of this.edges)(("string"==typeof r.source?r.source:r.source.id)===e||("string"==typeof r.target?r.target:r.target.id)===e)&&(this.edges.delete(t),this.edgeTimestamps.delete(t));return this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",1),!0}removeEdge(e,t){let r=[];if(void 0===t){let t=this.config.edgeIdAccessor;if(!t)throw Error("removeEdge(edgeId) requires edgeIdAccessor to be configured. Use removeEdge(sourceId, targetId) instead.");let s="function"==typeof t?t:e=>e?.[t];for(let[t,i]of this.edges)i.data&&s(i.data)===e&&r.push(t)}else for(let[s,i]of this.edges)("string"==typeof i.source?i.source:i.source.id)===e&&("string"==typeof i.target?i.target:i.target.id)===t&&r.push(s);for(let e of r)this.edges.delete(e),this.edgeTimestamps.delete(e);return r.length>0?(this.layoutVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length)):this.updateResults.recordNoop("remove"),r.length>0}clear(){this._customLayoutCache.clear(),this.nodes.clear(),this.edges.clear(),this._decaySortedNodes=null,this._networkDecayCache=null,this._decayAgeMap=null,this._nodeQuadtree=null,this._nodesArrCache=null,this._edgesArrCache=null,this._sceneNodesRevision++,this.tension=0,this.layoutVersion++,this.sceneNodes=[],this.sceneEdges=[],this.labels=[],w(this),this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this._customRestyleEdge=void 0,this.hasCustomRestyle=!1,this._baseStyles=/* @__PURE__ */new WeakMap,this.transition=null,this._hasRenderedOnce=!1,this.lastIngestTime=0,this._lastPositionSnapshot=null,this.nodeTimestamps.clear(),this.edgeTimestamps.clear(),this.previousNodeIds=/* @__PURE__ */new Set,this.previousEdgeKeys=/* @__PURE__ */new Set,this.addedNodes=/* @__PURE__ */new Set,this.removedNodes=/* @__PURE__ */new Set,this.addedEdges=/* @__PURE__ */new Set,this.removedEdges=/* @__PURE__ */new Set,this.lastTopologyChangeTime=0,this._boundedPrevSnapshot=null,this._boundedEdgeSnapshot=null,this.particlePool&&this.particlePool.clear(),this.updateResults.recordData("clear")}};qr.QUADTREE_THRESHOLD=500;var Ur=qr;Ye(Ur);import*as Jr from"react";import{useId as Zr}from"react";import{Fragment as es,jsx as ts,jsxs as rs}from"react/jsx-runtime";E.displayName="NetworkSVGOverlay";import*as ss from"react";import{jsx as is}from"react/jsx-runtime";var os={position:"absolute",top:0,left:0,pointerEvents:"none"};import*as ns from"react";import{arc as as}from"d3-shape";import{jsx as ls,jsxs as ds}from"react/jsx-runtime";import{jsx as cs,jsxs as us}from"react/jsx-runtime";import{jsx as hs,jsxs as ys}from"react/jsx-runtime";var gs=/^(value|amount|total|count|weight|score)$/i;F.ownsChrome=!0;var ps=null,fs=null;import{useCallback as ms}from"react";var vs="StreamNetworkFrame";import{jsx as ks,jsxs as bs}from"react/jsx-runtime";var _s=[800,600],xs=Cr(Ar(function(e,t){let{chartType:r,nodes:s,edges:i,data:o,initialEdges:n,nodeIDAccessor:a="id",sourceAccessor:l="source",targetAccessor:d="target",valueAccessor:c="value",edgeIdAccessor:u,childrenAccessor:h,hierarchySum:y,orientation:g="horizontal",nodeAlign:p="justify",nodePaddingRatio:f=.05,nodeWidth:m=15,iterations:v=300,forceStrength:k=.1,layoutExecution:b="auto",layoutLoadingContent:_,onLayoutStateChange:x,padAngle:w=.01,groupWidth:S=20,sortGroups:A,edgeSort:C,treeOrientation:N="vertical",edgeType:R="curve",padding:T,paddingTop:P,tensionConfig:W,showParticles:I=!1,particleStyle:L,renderMode:M,nodeStyle:B,edgeStyle:z,colorBy:j,colorScheme:X="category10",edgeColorBy:H="source",edgeOpacity:$=.5,colorByDepth:V=!1,nodeSize:G=8,nodeSizeRange:Q=[5,20],nodeLabel:K,showLabels:q=!0,labelMode:U,size:ie=_s,responsiveWidth:oe,responsiveHeight:ne,margin:ae,className:le,background:de,maxDevicePixelRatio:ce,enableHover:ue=!0,tooltipContent:he,customHoverBehavior:ye,customClickBehavior:ge,onObservation:we,annotationObservationCallback:Se,chartId:Ae,onTopologyChange:Ee,annotations:Te,onAnnotationActivate:Pe,autoPlaceAnnotations:Be,svgAnnotationRules:Oe,legend:Fe,legendPosition:Ye,legendLayout:He,legendHoverBehavior:$e,legendClickBehavior:Ve,legendHighlightedCategory:Ge,legendIsolatedCategories:qe,legendCategoryAccessor:Ue,onCategoriesChange:Je,title:Ze,foregroundGraphics:et,backgroundGraphics:rt,decay:st,pulse:it,transition:ot,animate:at,staleness:lt,frameScheduler:ct,clock:ht,random:yt,seed:gt,paused:pt=!1,suspendWhenHidden:vt=!0,thresholds:bt,accessibleTable:_t=!0,description:wt,summary:St,orbitMode:At,orbitSize:Ct,orbitSpeed:Nt,orbitRevolution:Tt,orbitRevolutionStyle:Pt,orbitEccentricity:Dt,orbitShowRings:It,orbitAnimated:Bt,customNetworkLayout:Ot,onLayoutError:Ft,layoutConfig:zt,layoutSelection:jt}=e,Ht=Ce(r),Kt=kr(!0),or=ut({sizeProp:ie,responsiveWidth:oe,responsiveHeight:ne,userMargin:ae,marginDefault:Ht,title:Ze,legend:Fe,legendPosition:Ye,legendLayout:He,legendMarginReserved:e.__legendMarginReservedFor===Fe,animate:at,transitionProp:ot,frameScheduler:ct,clock:ht,random:yt,seed:gt,paused:pt,suspendWhenHidden:vt,themeDirtyRef:Kt}),{reducedMotionRef:nr,responsiveRef:ar,size:lr,margin:dr,adjustedWidth:cr,adjustedHeight:ur,transition:hr,introEnabled:yr,tableId:gr,rafRef:pr,renderFnRef:fr,scheduleRender:mr,frameRuntime:Ar,currentTheme:Cr}=or,{resolvedForeground:Er,resolvedBackground:Tr,themeBackground:Pr,surfaceBackground:Dr}=Ne({foregroundGraphics:et,backgroundGraphics:rt,size:lr,margin:dr,scales:null,background:de,themeBackgroundColor:Cr.colors.background}),Wr=$t(),Ir=Vt(),Lr=xr(()=>Wt(s),[s]),Mr=xr(()=>Array.isArray(i)?Wt(i):i,[i]),Br=!1===at,Or=xr(()=>({...Nr,...W,...Br?{transitionDuration:0}:{}}),[W,Br]),Fr=xr(()=>({...Rr,...L}),[L]),Yr=xr(()=>Y({chartType:r,clock:Ar.now,random:yt,seed:gt,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:d,valueAccessor:c,edgeIdAccessor:u,childrenAccessor:h,hierarchySum:y,orientation:g,nodeAlign:p,nodePaddingRatio:f,nodeWidth:m,iterations:v,forceStrength:k,padAngle:w,groupWidth:S,sortGroups:A,edgeSort:C,treeOrientation:N,edgeType:R,padding:T,paddingTop:P,tensionConfig:Or,showParticles:I,particleStyle:Fr,nodeStyle:B,edgeStyle:z,nodeLabel:K,showLabels:q,labelMode:U,colorBy:j,colorScheme:X,edgeColorBy:H,edgeOpacity:$,colorByDepth:V,nodeSize:G,nodeSizeRange:Q,decay:st,pulse:it,transition:hr,introAnimation:yr,staleness:lt,thresholds:bt,orbitMode:At,orbitSize:Ct,orbitSpeed:Nt,orbitRevolution:Tt,orbitRevolutionStyle:Pt,orbitEccentricity:Dt,orbitShowRings:It,orbitAnimated:Bt,customNetworkLayout:Ot,onLayoutError:Ft,layoutConfig:zt,currentTheme:Cr}),[r,Ar.now,yt,gt,a,l,d,c,u,h,y,g,p,f,m,v,k,w,S,A,C,N,R,T,P,Or,I,Fr,B,z,K,q,U,j,X,H,$,V,G,Q,st,it,hr,yr,lt,bt,At,Ct,Nt,Tt,Pt,Dt,It,Bt,Ot,Ft,zt,Cr]),zr=tt(Yr),jr=tt({chartType:r,nodeIDAccessor:a,sourceAccessor:l,targetAccessor:d,valueAccessor:c,edgeIdAccessor:u,childrenAccessor:h,hierarchySum:y,orientation:g,nodeAlign:p,nodePaddingRatio:f,nodeWidth:m,iterations:v,forceStrength:k,padAngle:w,groupWidth:S,sortGroups:A,edgeSort:C,treeOrientation:N,edgeType:R,padding:T,paddingTop:P,random:yt,seed:gt,tensionConfig:Or,customNetworkLayout:Ot,orbitMode:At,orbitSize:Ct,orbitEccentricity:Dt}),Xr=kr(0),Hr=kr(0),$r=kr(!1),Vr=kr(null);Vr.current||(Vr.current=new Ur(zr));let Gr=Re(Vr,Ue,Je,e=>Array.from(e.nodes.values()).map(e=>e.data?{id:e.id,...e.data}:e)),Qr=qt("StreamNetworkFrame"),Kr=wr((e,t,r=!1)=>Jt(Qr.current,e,()=>e.buildScene(t),r),[Qr]),[qr,Jr]=br(null),[Zr,es]=br(0),[ts,rs]=br(0),[ss,is]=br(!1),[os,ns]=br(!1),as=kr(0),ls=kr(null),ds=kr(!1),cs=kr(x);cs.current=x;let us=kr(zr);us.current=zr;let hs=kr(null),ys=kr({nodes:!1,edges:!1}),gs=kr(/* @__PURE__ */new Map),ps=kr(0),fs=kr(X);fs.current=X;let ms=wr(e=>ee({node:e,colorBy:j,colorScheme:X,nodeColorMap:gs.current,colorIndexRef:ps}),[j,X]),vs=wr(e=>{ps.current=se({sceneNodes:e.sceneNodes,nodes:e.nodes.values(),nodeColorMap:gs.current,colorScheme:fs.current})},[]),xs=kr(null),ws=wr((e,t)=>{Kr(e,t),xs.current=t,Gr(),vs(e),ve(ys.current,e.sceneNodes,e.sceneEdges),Kt.current=!1,e.markStylePaintPending()},[Kr,Gr,vs]),Ss=wr(()=>{Vr.current?.markStylePaintPending()},[]),{canvasRef:As,resolutionDirtyRef:Cs}=mt(or,{hydrated:Wr,wasHydratingFromSSR:Ir,storeRef:Vr,dirtyRef:Kt,skipInitialCanvasPaintInvalidation:!0,canvasPaintInvalidator:Ss,maxDevicePixelRatio:ce,canvasPaintDependencies:[r,cr,ur,de,rt,M,mr]}),Ns=(Ds=Cr,Ds?.colors?.border||Ds?.colors?.secondary||Ds?.colors?.primary||"#999"),Rs=wr(e=>Z(e,Vr.current?.nodes),[]),Es=wr(e=>te({edge:e,edgeColorBy:H,getNodeColor:ms,resolveEndpoint:Rs,fallback:Ns}),[H,ms,Ns,Rs]),Ts=wr(e=>re({edge:e,particleStyleColor:Fr.color,particleColorBy:Fr.colorBy,hasExplicitParticleColorBy:!!L?.colorBy,getEdgeColor:Es,getNodeColor:ms,resolveEndpoint:Rs,fallback:Ns}),[L?.colorBy,Fr.color,Fr.colorBy,ms,Es,Ns,Rs]),Ps=me(r,!!Ot,I,!!it,Vr.current?.isAnimating??!1);var Ds;je(Vr,zr,Kt,mr),Xe(Vr,jt,Kt,mr);let Ws=wr(()=>{let e=Vr.current;if(e&&(e.runLayout([cr,ur]),ws(e,[cr,ur]),es(e.layoutVersion),Ee)){let{nodes:t,edges:r}=e.getLayoutData();Ee(t,r)}},[cr,ur,ws,Ee]),Is=kr(!1),Ls=wr((e=!1)=>!(!e&&!Is.current||(Is.current=!1,Ws(),0)),[Ws]),Ms=wr(()=>Ls(!1),[Ls]),Bs=wr(e=>{let t=Vr.current;if(!t)return!1;let r=!1,s=Is.current;for(let i of e)null==i||"object"!=typeof i||(r=!0,t.ingestEdge(i)&&(s=!0));let i=Ls(s);return r||i},[Ls]),Os=wr(e=>{if(null==e||"object"!=typeof e)return;let t=Vr.current;if(t){if(t.ingestEdge(e)&&(Is.current=!0),!Ar.isActive)return void Ms();mr()}},[Ms,Ar,mr]),Fs=wr(e=>{Bs(e)&&mr()},[Bs,mr]);_r(()=>Ar.subscribe(()=>{Ar.isActive||Ms()}),[Ms,Ar]);let Ys=wr(()=>{Is.current=!1,Vr.current?.clear(),Gr(),gs.current.clear(),ps.current=0,es(Vr.current?.layoutVersion??0),Jr(null),hs.current=null,Kt.current=!0,mr()},[Gr,mr]),zs=wr(()=>{let e=Vr.current;e&&(e.tension+=999,Ls(!0),mr())},[Ls,mr]);Sr(t,()=>({push:Os,pushMany:Fs,removeNode:e=>{let t=Vr.current?.removeNode(e)??!1;if(t){let t=hs.current?.data?"function"==typeof a?a(hs.current.data):hs.current.data[a]:void 0;hs.current&&"node"===hs.current.nodeOrEdge&&t===e&&(hs.current=null,Jr(null)),gs.current.delete(e)}return Ls(t)&&mr(),t},removeEdge:(e,t)=>{let r=Vr.current?.removeEdge(e,t)??!1;if(r&&hs.current&&"edge"===hs.current.nodeOrEdge){let r,s=hs.current.data;r=void 0!==t?("object"==typeof s?.source?s.source.id:s?.source)===e&&("object"==typeof s?.target?s.target.id:s?.target)===t:!u||!s||("function"==typeof u?u:e=>e?.[u])(s)===e,r&&(hs.current=null,Jr(null))}return Ls(r)&&mr(),r},updateNode:(e,t)=>{let r=Vr.current?.updateNode(e,t)??null;return Ls(null!==r)&&mr(),r},updateEdge:(e,t,r)=>{let s=Vr.current?.updateEdge(e,t,r)??[];return Ls(s.length>0)&&mr(),s},clear:Ys,getTopology:()=>(Ms(),Vr.current?.getLayoutData()??{nodes:[],edges:[]}),getCustomLayout:()=>(Ms(),Vr.current?.lastCustomLayoutResult??null),getLayoutFailure:()=>(Ms(),Vr.current?.lastCustomLayoutFailure??null),getTopologyDiff:()=>{Ms();let e=Vr.current;return e?{addedNodes:Array.from(e.addedNodes),removedNodes:Array.from(e.removedNodes),addedEdges:Array.from(e.addedEdges),removedEdges:Array.from(e.removedEdges)}:{addedNodes:[],removedNodes:[],addedEdges:[],removedEdges:[]}},relayout:zs,getTension:()=>(Ms(),Vr.current?.tension??0)}),[Os,Fs,Ys,zs,Ms,Ls,a,mr,u]);let js=["tree","cluster","treemap","circlepack","partition","orbit"].includes(r),Xs=js?o||(Array.isArray(i)?void 0:i):void 0;_r(()=>{let e=Vr.current;if(!e)return;let t=++as.current;if(ls.current?.abort(),ls.current=null,js&&Xs)Is.current=!1,e.ingestHierarchy(Xs,[cr,ur]),ws(e,[cr,ur]),es(e.layoutVersion),ns(!1),cs.current?.("ready"),mr();else{let o=Lr,n=Array.isArray(Mr)?Mr:[];if((null!=s||null!=i)&&(Is.current=!1),0===o.length&&0===n.length)return(null!=s||null!=i)&&(e.nodes.size>0||e.edges.size>0)&&Ys(),ns(!1),void cs.current?.("ready");let a=[cr,ur],l="force"===r&&!Ot&&_e()&&!yt&&be(b,o.length,n.length,v);if(l&&Ir&&!ds.current&&e.sceneNodes.length>0)return ds.current=!0,ns(!1),cs.current?.("ready"),Kt.current=!0,void mr();if(l){let r=new AbortController;ls.current=r;let s=e._lastPositionSnapshot;e.ingestBounded(o,n,a,{deferLayout:!0});let i=e.getLayoutData(),l=xe(i.nodes,i.edges,us.current,a,s);return ns(!0),cs.current?.("pending"),import("./c-S746GRV4.min.js").then(({runForceLayoutWorker:e})=>e(l,r.signal)).then(({positions:r})=>{t===as.current&&(ls.current=null,e.applyForceLayoutPositions(r,a),ws(e,a),ns(!1),cs.current?.("ready"),es(e.layoutVersion),mr())}).catch(r=>{"AbortError"!==r.name&&t===as.current&&(ls.current=null,e.runLayout(a),ws(e,a),ns(!1),cs.current?.("error"),es(e.layoutVersion),mr())}),()=>r.abort()}e.ingestBounded(o,n,a),ws(e,a),es(e.layoutVersion),ns(!1),cs.current?.("ready"),mr()}},[Lr,Mr,s,i,o,Xs,js,cr,ur,jr,b,v,Ir,r,Ot,yt,mr,Ys,ws]);let Hs=vr.useRef(!1);_r(()=>{Hs.current||n&&n.length>0&&(Hs.current=!0,Fs(n))},[n,Fs]),_r(()=>{let e=Vr.current;if(!e||ls.current)return;let t=xs.current,r=null!==t&&(t[0]!==cr||t[1]!==ur);!Kt.current&&!r||(r&&e.runLayout([cr,ur]),ws(e,[cr,ur]),es(e=>e+1),mr())},[Cr,cr,ur,ws,mr]);let{customHoverBehavior:$s,customClickBehavior:Vs}=fe({customHoverBehavior:ye,customClickBehavior:ge,onObservation:we,chartId:Ae}),{hoverHandlerRef:Gs,hoverLeaveRef:Qs,onPointerMove:Ks,onPointerLeave:qs,pointerStateRef:Us}=or,Js=()=>!Ot||(Vr.current?.hasCustomRestyle??!1);Gs.current=e=>{let t=Js(),r=As.current;if(!r)return;let s=Vr.current;if(!s)return void Yt(r);let i=pe({clientX:e.clientX,clientY:e.clientY,canvasRect:r.getBoundingClientRect(),margin:dr,adjustedWidth:cr,adjustedHeight:ur,sceneNodes:s.sceneNodes,sceneEdges:s.sceneEdges,nodeQuadtree:s.nodeQuadtree,maxNodeRadius:s.maxNodeRadius,includeEdges:ue||ys.current.edges});if(Yt(r,"hit"===i.kind?Lt(i.mark):void 0),ue){if("hit"!==i.kind)return void(hs.current&&(hs.current=null,Jr(null),$s?.(null),t&&mr()));hs.current=i.hover,Jr(i.hover),$s?.(i.hover),t&&mr()}},Qs.current=()=>{if(Yt(As.current),hs.current){let e=Js();hs.current=null,Jr(null),$s?.(null),e&&mr()}};let Zs=kr(()=>{});Zs.current=e=>{if(ft(e.target)||!ge&&!we)return;let t=As.current;if(!t)return;let r=Vr.current;if(!r)return;let s=pe({clientX:e.clientX,clientY:e.clientY,canvasRect:t.getBoundingClientRect(),margin:dr,adjustedWidth:cr,adjustedHeight:ur,sceneNodes:r.sceneNodes,sceneEdges:r.sceneEdges,nodeQuadtree:r.nodeQuadtree,maxNodeRadius:r.maxNodeRadius});"hit"===s.kind?Vs(s.hover,{type:"activate",inputType:Rt(e.nativeEvent.pointerType)}):"miss"===s.kind&&Vs(null)};let ei=wr(e=>Zs.current(e),[]),ti=kr(-1),ri=kr(null),si=kr(-1),ii=wr(e=>{if(Et(e))return;let t=Vr.current;if(!t)return;let r=()=>{ti.current=-1,ri.current=null,si.current=-1,hs.current=null,Jr(null),$s?.(null),mr()},s=Ie(t.sceneNodes);if(0===s.length)return void(ti.current>=0&&r());let i=De(s),o=ti.current;if(o>=i.flat.length&&(r(),o=-1)," "===e.key&&o>=0){e.preventDefault();let t=i.flat[o];return void Vs?.(xt(t.datum||{},t.x,t.y,{nodeOrEdge:"node"}),{type:"activate",inputType:"keyboard"})}if(0>o){if("Escape"===e.key||!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown","Enter"].includes(e.key))return;e.preventDefault(),ti.current=0,si.current=-1;let t=i.flat[0];ri.current={shape:t.shape,w:t.w,h:t.h};let r=xt(t.datum||{},t.x,t.y,{nodeOrEdge:"node"});return hs.current=r,Jr(r),$s?.(r,{type:"focus",inputType:"keyboard"}),void mr()}let n=We(i,o),a=Le(e.key,n,i,t.sceneEdges??[],si);if(null===a)return;if(e.preventDefault(),0>a)return void r();ti.current=a;let l=i.flat[a];ri.current={shape:l.shape,w:l.w,h:l.h};let d={data:l.datum||{},x:l.x,y:l.y,__semioticHoverData:!0,nodeOrEdge:"node"};hs.current=d,Jr(d),$s?.(d,{type:"focus",inputType:"keyboard"}),mr()},[Vs,$s,mr]),oi=wr(e=>{Me(Us,e,ue,ys.current.nodes||ys.current.edges,As.current,"mouse")&&(ti.current=-1,ri.current=null,Ks(e))},[As,ue,Ks,Us]);fr.current=()=>{if(pr.current=null,Ms(),!Ar.isActive||ls.current)return;let e=As.current;if(!e)return;let t=Vr.current;t&&J({canvas:e,store:t,sceneRevisionDiagnostics:Qr.current,size:lr,margin:dr,adjustedWidth:cr,adjustedHeight:ur,background:de,themeBackground:Pr,maxDevicePixelRatio:ce,renderMode:M,hasBackgroundGraphics:!(!rt&&!t.customLayoutBackgrounds),dirtyRef:Kt,resolutionDirtyRef:Cs,lastFrameTimeRef:Xr,now:Ar.now(),random:Ar.random,reducedMotion:!!nr.current,showParticles:I,isContinuous:Ps,animate:at,decay:st,pulse:it,thresholds:bt,staleness:lt,particleStyle:Fr,getParticleColor:Ts,pendingAnnotationFrameRef:$r,lastAnnotationFrameTimeRef:Hr,setAnnotationFrame:rs,scheduleNextFrame:()=>{mr()},syncColorMap:()=>vs(t),onSceneOrStyleChange:({inventoryChanged:r,geometryChanged:s})=>{r&&(ve(ys.current,t.sceneNodes,t.sceneEdges)||Yt(e)),(ys.current.nodes||ys.current.edges)&&(r||s)&&ke({canvas:e,pointer:Us.current,store:t,margin:dr,width:cr,height:ur,geometryMoved:s,cursorInventory:ys.current})}})},Xt(As),Qe(lt,Vr,Kt,mr,Ar.now,ss,is);let ni=ue&&qr?/* @__PURE__ */ks(dt,{x:qr.x,y:qr.y,containerWidth:cr,containerHeight:ur,margin:dr,className:"stream-network-tooltip",zIndex:2,children:he?he(qr):/* @__PURE__ */ks(F,{data:qr})}):null;if(Gt||!Wr&&Ir)/* @__PURE__ */
35
35
  return ks(O,{props:e,store:Vr.current,responsiveRef:ar,size:lr,margin:dr,adjustedWidth:cr,adjustedHeight:ur,surfaceBackground:Dr,resolvedBackground:Tr,resolvedForeground:Er});let ai=Vr.current;/* @__PURE__ */
36
36
  return bs("div",{ref:ar,className:"stream-network-frame"+(le?" "+le:""),role:"group","aria-label":wt||("string"==typeof Ze?Ze:"Network chart"),tabIndex:0,"aria-busy":os||void 0,style:{position:"relative",fontFamily:"var(--semiotic-font-family, sans-serif)",width:oe?"100%":lr[0],height:ne?"100%":lr[1],overflow:"visible"},onKeyDown:ii,children:["production"!==process.env.NODE_ENV&&Vr.current&&/* @__PURE__ */ks(Zt,{store:Vr.current,diagnostics:Qr.current}),_t&&/* @__PURE__ */bs(Ut,{accessibleTable:_t,children:[
37
37
  /* @__PURE__ */ks(sr,{tableId:gr}),
@@ -1 +1 @@
1
- import{a as r,b as s,c as e,d as o}from"./c-6IVBV5NO.min.js";import"./c-HLGTD5SJ.min.js";import{b as a,c,d as t,e as F}from"./c-YMFUIO54.min.js";import"./c-UBHICVSC.min.js";import"./c-3PFVJFBK.min.js";export{a as DEFAULT_FORCE_WORKER_THRESHOLD,s as ForceLayoutWorkerSession,e as _resetSharedForceLayoutSessionForTest,t as canUseForceWorker,r as createForceLayoutWorker,F as createFrameForceWorkerRequest,o as runForceLayoutWorker,c as shouldUseForceWorker};
1
+ import{a as r,b as s,c as e,d as o}from"./c-NUBZ63VU.min.js";import"./c-HLGTD5SJ.min.js";import{b as a,c,d as t,e as F}from"./c-YMFUIO54.min.js";import"./c-LVHJJUOF.min.js";import"./c-3PFVJFBK.min.js";export{a as DEFAULT_FORCE_WORKER_THRESHOLD,s as ForceLayoutWorkerSession,e as _resetSharedForceLayoutSessionForTest,t as canUseForceWorker,r as createForceLayoutWorker,F as createFrameForceWorkerRequest,o as runForceLayoutWorker,c as shouldUseForceWorker};
@@ -5,5 +5,5 @@ return Ge("div",{style:t>0?{marginTop:2}:void 0,children:[
5
5
  /* @__PURE__ */Le("span",{children:r})]},t)})]})}}function i({categoryAccessor:e,valueAccessor:l,groupAccessor:o,groupLabel:i,pieData:u=!1,valueFormat:s}){return c=>{let f=u?c.data?.[0]||c.data||c:c.data||c,d=a(f,e),h=a(f,l),p=o?a(f,o):void 0;/* @__PURE__ */
6
6
  return Ge("div",{className:"semiotic-tooltip",style:je,children:[
7
7
  /* @__PURE__ */Le("div",{style:{fontWeight:"bold"},children:r(d)}),
8
- /* @__PURE__ */Le("div",{style:{marginTop:4},children:n(h,s)}),null!=p&&/* @__PURE__ */Ge("div",{style:{marginTop:2,opacity:.8},children:[i||t(o),": ",r(p)]})]})}}function u(...e){let t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Te.createElement(Te.Fragment,null,...t)}function s(e,t,r,n){ze(()=>{e.current?.updateConfig(t),r.current=!0,n()},[t,n,e,r])}function c(e,t,r,n){let a=$e(null);ze(()=>{let l=e.current;if(!l)return;let o=t??null;a.current!==o&&(a.current=o,l.setLayoutSelection(o),l.hasCustomRestyle?l.restyleScene(o):r.current=!0,n())},[t,n,e,r])}function f(e,t){let r=e?.state??(e?.settling?"settling":void 0);if("live"===r)return Ne;if("stopped"===r||"failed"===r||"stale"===r)return{alpha:e?.dimOpacity??.5,band:"stale",isStale:!0};if("settling"===r)return{alpha:.85,band:"aging",isStale:!1};if(!e||0>=t)return Ne;let n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,a=e.graded;if(a){let e="object"==typeof a?a:{},r=Re(t,n,e.thresholds);return{alpha:{...He,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Ne}function d(e,t,r,n,a,l,o){let i=Ue("fresh");We(()=>{if(!e)return void(i.current="fresh");let u=setInterval(()=>{let u=t.current;if(!u||0===u.lastIngestTime)return;let s=f(e,a()-u.lastIngestTime);(s.band!==i.current||s.isStale!==l)&&(i.current=s.band,s.isStale!==l&&o(s.isStale),r.current=!0,n())},1e3);return()=>clearInterval(u)},[e,l,n,a,t,o,r])}function h(e,t,r){return t||(r?"settling":e?"stale":"live")}function p({isStale:e,position:t,state:r,settling:n}){let a=h(e,r,n),l=Ye[a]??Ye.live,o=Object.hasOwn(Ye,a)?a.toUpperCase():"LIVE";/* @__PURE__ */
9
- return Ve("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:l,color:"white"},children:o})}function y(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return m(e,t);if(!x(e)||!x(t))return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;let r=e[n],a=t[n];if(!Object.is(r,a)){if(Array.isArray(r)&&Array.isArray(a)){if(!m(r,a))return!1;continue}if(!x(r)||!x(a)||!g(r,a))return!1}}return!0}function g(e,t){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(!Object.prototype.hasOwnProperty.call(t,n)||!Object.is(e[n],t[n]))return!1;return!0}function m(e,t){if(e.length!==t.length)return!1;for(let r=0;e.length>r;r++)if(!Object.is(e[r],t[r]))return!1;return!0}function x(e){if(null===e||"object"!=typeof e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function b(e){let t=Fe(e);return y(t.current,e)||(t.current=e),t.current}function v(e){let{background:t,hasBackgroundGraphics:r=!1,themeBackground:n=""}=e;return"transparent"===t?null:r?t||null:t||(n&&"transparent"!==n?n:"")||null}function w(e){let{background:t,hasBackgroundGraphics:r=!1,themeBackground:n=""}=e;return"transparent"===t||r?null:t||(n&&"transparent"!==n?n:"")||null}function k(e,t){let{background:r,hasBackgroundGraphics:n=!1,themeBackground:a="",x:l=0,y:o=0,width:i,height:u}=t,s=w({background:r,hasBackgroundGraphics:n,themeBackground:a});if(!s)return!1;let c=Pe(e,s);return!(!c||"transparent"===c.trim().toLowerCase()||(e.fillStyle=c,e.fillRect(l,o,i,u),0))}function A(e,t,r,n){return"function"==typeof e?e({size:t,margin:r,scales:n}):e}function M({foregroundGraphics:e,backgroundGraphics:t,size:r,margin:n,scales:a,background:l,themeBackgroundColor:o,resolveScaleAwareGraphics:i=!0}){let u=`var(--semiotic-bg, ${o})`;return{resolvedForeground:i||"function"!=typeof e?A(e,r,n,a):null,resolvedBackground:i||"function"!=typeof t?A(t,r,n,a):null,themeBackground:u,surfaceBackground:v({background:l,hasBackgroundGraphics:!!t,themeBackground:u})}}function _(e,t){if(!t)return[];let r=/* @__PURE__ */new Set,n=[];for(let a of e){if(!a||"object"!=typeof a)continue;let e=("function"==typeof t?t(a):a[t])+"";r.has(e)||(r.add(e),n.push(e))}return n}function I(e,t){if(e.length!==t.length)return!1;for(let r=0;e.length>r;r++)if(e[r]!==t[r])return!1;return!0}function O(e,t,r,n){let a=Ze({accessor:t,onChange:r,readData:n}),l=Ze([]);a.current={accessor:t,onChange:r,readData:n};let o=Xe(()=>{let{accessor:t,onChange:r,readData:n}=a.current;if(!r||!t)return;let o=_(e.current?n(e.current):[],t);I(o,l.current)||(l.current=o,r(o))},[e]);return qe(()=>{l.current=[],o()},[t,o,r]),o}function S(e){return!(!e||"object"!=typeof e)&&"string"==typeof e.id&&"function"==typeof e.cacheKey&&"function"==typeof e.drawCanvas&&"function"==typeof e.renderStaticSVG}function E(e,t){let r="function"==typeof e?e(t.datum??null,t):e;return S(r)?r:void 0}function R(e,t){if("u">typeof process&&"production"===process.env?.NODE_ENV)return;let r=`${e}:${t}`;Ke.has(r)||(Ke.add(r),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function D(e){let{context:t,nodes:r,renderMode:n,pixelRatio:a,paintBuiltIn:l}=e;if(!n||"sketchy"===n)return void l(r);let o=[],i=()=>{o.length&&(l(o),o=[])};for(let e of r){let r,u=E(n,e);if(u){i(),t.save();try{r=u.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:a})}finally{t.restore()}r||(R(u.id,e.type??"unknown"),l([e]))}else o.push(e)}i()}function B(e){let{node:t,index:r,renderMode:n,fallback:a}=e,l=E(n,t);if(!l)return{element:a(),renderedByBackend:!1};let o=l.renderStaticSVG({node:t,style:t.style??{},key:`${l.id}-${r}`});return null!=o?{element:De(o,t,`${l.id}-${r}-cursor`),renderedByBackend:!0}:(R(l.id,t.type??"unknown"),{element:a(),renderedByBackend:!1})}function j(e){return B(e).element}function C(e){let t=[];return e.nodes.forEach((r,n)=>{let a=B({node:r,index:n,renderMode:e.renderMode,fallback:()=>e.fallback(r,n)});null!=a.element&&!1!==a.element&&t.push({node:r,index:n,...a})}),t}function P(e){let t=/* @__PURE__ */new Map;for(let r of e){let e=r.group??"_default",n=t.get(e);n||(n=[],t.set(e,n)),n.push(r)}for(let e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}let r=Array.from(t.keys()).sort((e,r)=>{let n=t.get(e),a=t.get(r);return(n.length>0?n[0].y:0)-(a.length>0?a[0].y:0)}),n=Array.from(t.values()).flat();n.sort((e,t)=>e.x-t.x||e.y-t.y);let a=/* @__PURE__ */new Map;for(let e=0;n.length>e;e++){n[e]._flatIndex=e;let t=n[e].datum?.id;null!=t&&a.set(t+"",e)}return{flat:n,groups:r,byGroup:t,idToIdx:a}}function L(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};let r=Math.max(0,Math.min(t,e.flat.length-1)),n=e.flat[r];return{flatIndex:r,group:n.group??"_default",indexInGroup:n._groupIndex??0}}function G(e,t,r){let{group:n,indexInGroup:a}=t,l=r.byGroup.get(n);switch(e){case"ArrowRight":return l.length-1>a?l[a+1]._flatIndex:t.flatIndex;case"ArrowLeft":return a>0?l[a-1]._flatIndex:t.flatIndex;case"ArrowDown":{let e=r.groups.indexOf(n);return r.groups.length-1>e?T(r,r.groups[e+1],l[a]):t.flatIndex}case"ArrowUp":{let e=r.groups.indexOf(n);return e>0?T(r,r.groups[e-1],l[a]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*r.flat.length)),r.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*r.flat.length)),0);case"Home":return 0;case"End":return r.flat.length-1;case"Escape":return-1;default:return null}}function T(e,t,r){let n=e.byGroup.get(t),a=0,l=Math.abs(n[0].x-r.x);for(let e=1;n.length>e;e++){let t=Math.abs(n[e].x-r.x);l>t&&(l=t,a=e)}return n[a]._flatIndex}function z(e){let t=[];for(let r of e)switch(r.type){case"point":if(!1===r.interactive)break;t.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=r.size)break;t.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=r.size||null==r.datum)break;let e=Ce(r.glyph,r.size);t.push({x:r.x+e.centerDx,y:r.y+e.centerDy,datum:r.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"});break}case"line":{let e=r,n=Array.isArray(e.datum)?e.datum:[],a=e.group??"_default";for(let r=0;e.path.length>r&&n.length>r;r++)t.push({x:e.path[r][0],y:e.path[r][1],datum:n[r],shape:"circle",group:a});break}case"area":{if(!1===r.interactive)break;let e=r,n=Array.isArray(e.datum)?e.datum:[],a=e.group??"_default";for(let r=0;e.topPath.length>r&&n.length>r;r++)t.push({x:e.topPath[r][0],y:e.topPath[r][1],datum:n[r],shape:"circle",group:a});break}case"rect":t.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:r.group??"_default"});break;case"heatcell":t.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function $(e){let t=[];for(let r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;t.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:r.group??r.datum?.category??""})}else if("point"===r.type){if(!1===r.interactive)continue;t.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"})}else if("symbol"===r.type){if(0>=r.size)continue;t.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"})}else if("glyph"===r.type){if(0>=r.size||null==r.datum)continue;let e=Ce(r.glyph,r.size);t.push({x:r.x+e.centerDx,y:r.y+e.centerDy,datum:r.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"})}else if("wedge"===r.type&&null!=r.cx){if(null===r.datum)continue;let e=((r.startAngle||0)+(r.endAngle||0))/2,n=((r.innerRadius||0)+(r.outerRadius||50))/2;t.push({x:r.cx+Math.cos(e)*n,y:r.cy+Math.sin(e)*n,datum:r.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function H(e){let t=[];for(let r of e)if(r.datum)if("circle"===r.type&&null!=r.cx){if(0>=r.r)continue;t.push({x:r.cx,y:r.cy,datum:r.datum,shape:"circle",group:r.datum.id??"_default"})}else if("rect"===r.type&&null!=r.x){if(0>=r.w||0>=r.h)continue;t.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:r.datum.id??"_default"})}else if("arc"===r.type&&null!=r.cx)t.push({x:r.cx,y:r.cy,datum:r.datum,shape:"circle",group:r.datum.id??"_default"});else if("symbol"===r.type&&null!=r.cx){if(0>=r.size)continue;t.push({x:r.cx,y:r.cy,datum:r.datum,shape:"circle",group:r.datum.id??"_default"})}else if("glyph"===r.type&&null!=r.cx){if(0>=r.size)continue;let e=Ce(r.glyph,r.size);t.push({x:r.cx+e.centerDx,y:r.cy+e.centerDy,datum:r.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:r.datum.id??"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function N(e,t,r,n,a){let l=r.flat[t.flatIndex];if(!l)return G(e,t,r);let o=l.datum?.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{let n=W(r,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up")??t.flatIndex;return n!==t.flatIndex&&(a.current=-1),n}case"Enter":{if(null==o)return t.flatIndex;let e=V(o,n);if(0===e.length)return t.flatIndex;let l=r.idToIdx.get(e[(a.current+1)%e.length])??-1;return 0>l?t.flatIndex:(a.current=-1,l)}default:{let n=G(e,t,r);return null!==n&&n!==t.flatIndex&&(a.current=-1),n}}}function W(e,t,r){let n=null,a=1/0;for(let l=0;e.flat.length>l;l++){let o=e.flat[l];if(o===t)continue;let i=o.x-t.x,u=o.y-t.y,s=!1;switch(r){case"right":s=i>0&&Math.abs(i)>=Math.abs(u);break;case"left":s=0>i&&Math.abs(i)>=Math.abs(u);break;case"down":s=u>0&&Math.abs(u)>=Math.abs(i);break;case"up":s=0>u&&Math.abs(u)>=Math.abs(i)}if(!s)continue;let c=i*i+u*u;a>c&&(a=c,n=l)}return n}function U(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function V(e,t){let r=e+"",n=[];for(let e of t){let t=e.datum??e,a=U(t.source),l=U(t.target),o=null!=a,i=null!=l;o&&a+""===r&&i?n.push(l+""):i&&l+""===r&&o&&n.push(a+"")}return n}function Y(e){let t=[];for(let r of e)if("point"===r.type&&null!=r.x&&!1!==r.interactive)t.push({x:r.x,y:r.y,datum:r.datum,shape:"circle"});else if("glyph"===r.type){if(0>=r.size||null==r.datum)continue;let e=Ce(r.glyph,r.size);t.push({x:r.x+e.centerDx,y:r.y+e.centerDy,datum:r.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight})}else"geoarea"===r.type&&r.centroid&&!1!==r.interactive&&t.push({x:r.centroid[0],y:r.centroid[1],datum:r.datum,shape:"geoarea",pathData:r.pathData});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function F(e,t,r){switch(e){case"ArrowRight":case"ArrowDown":return r-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*r)),r-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*r)),0);case"Home":return 0;case"End":return r-1;case"Escape":return-1;default:return null}}function X(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function q(e,t,r){let n=e.current;n.inside=!0,n.clientX=t.clientX,n.clientY=t.clientY,n.pointerType=t.pointerType??r}function Z(e,t,r,n,a,l){return q(e,t,l),!(!r&&!n||!r&&"touch"===e.current.pointerType&&(Ee(a),1))}function K(e){let{title:t,description:r,summary:n,accessibleTable:a,className:l,animate:o,maxDevicePixelRatio:i,axisExtent:u,autoPlaceAnnotations:s}=e,c={};return t&&(c.title=t),r&&(c.description=r),n&&(c.summary=n),void 0!==a&&(c.accessibleTable=a),l&&(c.className=l),null!=o&&(c.animate=o),void 0!==i&&(c.maxDevicePixelRatio=i),void 0!==u&&(c.axisExtent=u),void 0!==s&&(c.autoPlaceAnnotations=s),c}function J(e){let{linkedHover:t,selection:r,onObservation:n,onClick:a,hoverRadius:l,hoverHighlight:o,forceHoverBehavior:i,forceClickBehavior:u,mobileInteraction:s,customHoverBehavior:c,customClickBehavior:f,linkedHoverInClickPredicate:d=!0}=e,h={};n&&(h.annotationObservationCallback=n);let p=s?.enabled?Math.max(l??30,Math.ceil((s.targetSize||44)/2),24):l;return(i||t||n||a||o)&&(h.customHoverBehavior=c),f&&(u||(d?n||a||t:n||a)||s?.enabled&&(s.tapToSelect||s.tapToLockTooltip)&&(t||o||r))&&(h.customClickBehavior=f),null!=p&&(h.hoverRadius=p),h}function Q(e){let{tooltip:t,defaultTooltipContent:r}=e;return{tooltipContent:!1===t?()=>null:Se(t)||r}}function ee(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}function te(e,t){if(!ee(t))return e??((...e)=>({}));let r={};return void 0!==t.stroke&&(r.stroke=t.stroke),void 0!==t.strokeWidth&&(r.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(r.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...r}):(...e)=>({...r})}function re(e,t,r){if(1>=r)return 1;let n=r-1;return Be({age:n-t,extent:n,type:e.type,halfLife:e.halfLife??r/2,threshold:e.stepThreshold??.5*r,minOpacity:e.minOpacity??.1})}function ne(e){let t=/* @__PURE__ */new Map;for(let r=0;e.length>r;r++)t.set(e[r],r);return t}function ae(e,t,r,n=ne(r)){let a=r.length;if(a>1)for(let r of t){if("line"===r.type){let t=Array.isArray(r.datum)?r.datum:[];if(2>t.length)continue;let l=Array(t.length),o=!1;for(let r=0;t.length>r;r++){let i=n.get(t[r]);null!=i?(l[r]=re(e,i,a),1>l[r]&&(o=!0)):l[r]=1}o&&(r._decayOpacities=l);continue}if("area"===r.type){let t=Array.isArray(r.datum)?r.datum:[],l=r.topPath?r.topPath.length:t.length;if(2>l)continue;if(t.length===l){let o=Array(l),i=!1;for(let r=0;t.length>r;r++){let l=n.get(t[r]);null!=l?(o[r]=re(e,l,a),1>o[r]&&(i=!0)):o[r]=1}i&&(r._decayOpacities=o)}else{let o=1;for(let r of t){let t=n.get(r);if(null!=t){let r=re(e,t,a);o>r&&(o=r)}}if(1>o){let e=Array(l);e.fill(o),r._decayOpacities=e}}continue}let t=n.get(r.datum);if(null==t)continue;let l=re(e,t,a);"candlestick"===r.type?r._decayOpacity=l:r.style={...r.style,opacity:(r.style?.opacity??1)*l}}}function le(e){if("production"===process.env.NODE_ENV)return;let{label:t,nodes:r,overlays:n,warned:a}=e;oe(n)&&0===r.length&&ie(a,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),r.length>0&&r.every(e=>null==e.datum)&&ie(a,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function oe(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(oe))}function ie(e,t,r){e.has(t)||(e.add(t),console.warn(r))}function ue(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}function se(e,t,r,n){let a=ue(t),l="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:l,message:`Semiotic ${e} ${l} failed: ${a.message}`,error:a,recovery:r?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:r,affectedRevision:n}}function ce(e){try{return{kind:"success",result:e.run()}}catch(t){let r=e.hasPreviousResult,n=se(e.family,t,r,e.revision);"production"!==process.env.NODE_ENV&&console.error(`[semiotic] ${e.logLabel} threw:`,t);try{e.onLayoutError?.(n)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return{kind:"failure",diagnostic:n,preservedLastGoodScene:r}}}function fe(){return this.updateResults.last}function de(){return this.updateResults.last}function he(e){return this.updateResults.subscribe(e)}function pe(e){this.config.layoutSelection=e}function ye(){Je.set(this,!0)}function ge(){let e=!0===Je.get(this);return Je.delete(this),e}function me(e){Object.assign(e.prototype,{getLastUpdateResult:fe,getUpdateSnapshot:de,subscribeUpdateResult:he,setLayoutSelection:pe,markStylePaintPending:ye,consumeStylePaintPending:ge})}function xe(e,t,r,n,a,l){let o=a-r,i=l-n,u=o*o+i*i;if(0===u)return Math.sqrt((e-r)**2+(t-n)**2);let s=((e-r)*o+(t-n)*i)/u;return s=Math.max(0,Math.min(1,s)),Math.sqrt((e-(r+s*o))**2+(t-(n+s*i))**2)}function be(e,t,r){return r.x>e||e>r.x+r.w||r.y>t||t>r.y+r.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:r.x+r.w/2,cy:r.y+r.h/2}}function ve(e,t=30){return Math.max((e??4)+5,12,t)}function we(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function ke(e,t){let r=we(e);if(!r)return!1;let n=we(t);return!n||r.getFullYear()!==n.getFullYear()||r.getMonth()!==n.getMonth()}function Ae(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Me(e,t,r,n,a,l=e=>e.x,o=e=>e.y,i=e=>e.r){let u=Math.max(n,a+5,12),s=t-u,c=t+u,f=r-u,d=r+u,h=null,p=1/0;return e.visit((e,a,u,y,g)=>{if(a>c||s>y||u>d||f>g)return!0;if(!e.length){let a=e;do{let e=a.data,u=l(e)-t,s=o(e)-r,c=Math.sqrt(u*u+s*s);ve(i(e),n)>=c&&p>c&&(h=e,p=c),a=a.next}while(a)}return!1}),h?{node:h,distance:p}:null}function _e(e,t){return"string"==typeof e&&e.length>0?e:t}function Ie(e,t,r){return"string"==typeof t&&t.length>0?t:"string"==typeof e&&e.length>0?`${e} (${r.familyPhrase})`:r.fallback}function Oe(e){let t=(e+"").replace(/[^a-zA-Z0-9_-]/g,"_"),r=/^[A-Za-z_]/.test(t)?t:"c"+t,n=r+"-semiotic-title",a=r+"-semiotic-desc";return{titleId:n,descId:a,labelledBy:`${n} ${a}`}}import{Va as Se,ea as Ee,h as Re,ia as De,l as Be,ya as je}from"./c-G53AVC42.min.js";import{i as Ce,m as Pe}from"./c-3BYZXCX3.min.js";import{jsx as Le,jsxs as Ge}from"react/jsx-runtime";import*as Te from"react";import{useEffect as ze,useRef as $e}from"react";var He={fresh:1,aging:.7,stale:.45,expired:.25},Ne={alpha:1,band:"fresh",isStale:!1};import{useEffect as We,useRef as Ue}from"react";import{jsx as Ve}from"react/jsx-runtime";var Ye={live:"#28a745",stale:"#dc3545",stopped:"#6c757d",failed:"#842029",settling:"#fd7e14"};import{useRef as Fe}from"react";import{useCallback as Xe,useEffect as qe,useRef as Ze}from"react";var Ke=/* @__PURE__ */new Set,Je=/* @__PURE__ */new WeakMap;export{re as a,ne as b,ae as c,le as d,ce as e,me as f,u as g,s as h,c as i,xe as j,be as k,ve as l,ke as m,Ae as n,Me as o,f as p,d as q,p as r,e as s,_e as t,Ie as u,Oe as v,y as w,b as x,w as y,k as z,A,M as B,_ as C,O as D,D as E,j as F,C as G,t as H,r as I,l as J,o as K,i as L,P as M,L as N,G as O,z as P,$ as Q,H as R,N as S,Y as T,F as U,X as V,Z as W,K as X,J as Y,Q as Z,te as _};
8
+ /* @__PURE__ */Le("div",{style:{marginTop:4},children:n(h,s)}),null!=p&&/* @__PURE__ */Ge("div",{style:{marginTop:2,opacity:.8},children:[i||t(o),": ",r(p)]})]})}}function u(...e){let t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Te.createElement(Te.Fragment,null,...t)}function s(e,t,r,n){ze(()=>{e.current?.updateConfig(t),r.current=!0,n()},[t,n,e,r])}function c(e,t,r,n){let a=$e(null);ze(()=>{let l=e.current;if(!l)return;let o=t??null;a.current!==o&&(a.current=o,l.setLayoutSelection(o),l.hasCustomRestyle?l.restyleScene(o):r.current=!0,n())},[t,n,e,r])}function f(e,t){let r=e?.state??(e?.settling?"settling":void 0);if("live"===r)return Ne;if("stopped"===r||"failed"===r||"stale"===r)return{alpha:e?.dimOpacity??.5,band:"stale",isStale:!0};if("settling"===r)return{alpha:.85,band:"aging",isStale:!1};if(!e||0>=t)return Ne;let n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,a=e.graded;if(a){let e="object"==typeof a?a:{},r=Re(t,n,e.thresholds);return{alpha:{...He,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:Ne}function d(e,t,r,n,a,l,o){let i=We("fresh");Ue(()=>{if(!e)return void(i.current="fresh");let u=setInterval(()=>{let u=t.current;if(!u||0===u.lastIngestTime)return;let s=f(e,a()-u.lastIngestTime);(s.band!==i.current||s.isStale!==l)&&(i.current=s.band,s.isStale!==l&&o(s.isStale),r.current=!0,n())},1e3);return()=>clearInterval(u)},[e,l,n,a,t,o,r])}function h(e,t,r){return t||(r?"settling":e?"stale":"live")}function p({isStale:e,position:t,state:r,settling:n}){let a=h(e,r,n),l=Ye[a]??Ye.live,o=Object.hasOwn(Ye,a)?a.toUpperCase():"LIVE";/* @__PURE__ */
9
+ return Ve("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:l,color:"white"},children:o})}function y(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return m(e,t);if(!x(e)||!x(t))return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r){if(!Object.prototype.hasOwnProperty.call(t,n))return!1;let r=e[n],a=t[n];if(!Object.is(r,a)){if(Array.isArray(r)&&Array.isArray(a)){if(!m(r,a))return!1;continue}if(!x(r)||!x(a)||!g(r,a))return!1}}return!0}function g(e,t){let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(!Object.prototype.hasOwnProperty.call(t,n)||!Object.is(e[n],t[n]))return!1;return!0}function m(e,t){if(e.length!==t.length)return!1;for(let r=0;e.length>r;r++)if(!Object.is(e[r],t[r]))return!1;return!0}function x(e){if(null===e||"object"!=typeof e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function b(e){let t=Fe(e);return y(t.current,e)||(t.current=e),t.current}function v(e){let{background:t,hasBackgroundGraphics:r=!1,themeBackground:n=""}=e;return"transparent"===t?null:r?t||null:t||(n&&"transparent"!==n?n:"")||null}function w(e){let{background:t,hasBackgroundGraphics:r=!1,themeBackground:n=""}=e;return"transparent"===t||r?null:t||(n&&"transparent"!==n?n:"")||null}function k(e,t){let{background:r,hasBackgroundGraphics:n=!1,themeBackground:a="",x:l=0,y:o=0,width:i,height:u}=t,s=w({background:r,hasBackgroundGraphics:n,themeBackground:a});if(!s)return!1;let c=Pe(e,s);return!(!c||"transparent"===c.trim().toLowerCase()||(e.fillStyle=c,e.fillRect(l,o,i,u),0))}function A(e,t,r,n){return"function"==typeof e?e({size:t,margin:r,scales:n}):e}function M({foregroundGraphics:e,backgroundGraphics:t,size:r,margin:n,scales:a,background:l,themeBackgroundColor:o,resolveScaleAwareGraphics:i=!0}){let u=`var(--semiotic-bg, ${o})`;return{resolvedForeground:i||"function"!=typeof e?A(e,r,n,a):null,resolvedBackground:i||"function"!=typeof t?A(t,r,n,a):null,themeBackground:u,surfaceBackground:v({background:l,hasBackgroundGraphics:!!t,themeBackground:u})}}function _(e,t){if(!t)return[];let r=/* @__PURE__ */new Set,n=[];for(let a of e){if(!a||"object"!=typeof a)continue;let e=("function"==typeof t?t(a):a[t])+"";r.has(e)||(r.add(e),n.push(e))}return n}function I(e,t){if(e.length!==t.length)return!1;for(let r=0;e.length>r;r++)if(e[r]!==t[r])return!1;return!0}function O(e,t,r,n){let a=Ze({accessor:t,onChange:r,readData:n}),l=Ze([]);a.current={accessor:t,onChange:r,readData:n};let o=Xe(()=>{let{accessor:t,onChange:r,readData:n}=a.current;if(!r||!t)return;let o=_(e.current?n(e.current):[],t);I(o,l.current)||(l.current=o,r(o))},[e]);return qe(()=>{l.current=[],o()},[t,o,r]),o}function S(e){return!(!e||"object"!=typeof e)&&"string"==typeof e.id&&"function"==typeof e.cacheKey&&"function"==typeof e.drawCanvas&&"function"==typeof e.renderStaticSVG}function E(e,t){let r="function"==typeof e?e(t.datum??null,t):e;return S(r)?r:void 0}function R(e,t){if("u">typeof process&&"production"===process.env?.NODE_ENV)return;let r=`${e}:${t}`;Ke.has(r)||(Ke.add(r),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}function B(e){let{context:t,nodes:r,renderMode:n,pixelRatio:a,paintBuiltIn:l}=e;if(!n||"sketchy"===n)return void l(r);let o=[],i=()=>{o.length&&(l(o),o=[])};for(let e of r){let r,u=E(n,e);if(u){i(),t.save();try{r=u.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:a})}finally{t.restore()}r||(R(u.id,e.type??"unknown"),l([e]))}else o.push(e)}i()}function D(e){let{node:t,index:r,renderMode:n,fallback:a}=e,l=E(n,t);if(!l)return{element:a(),renderedByBackend:!1};let o=l.renderStaticSVG({node:t,style:t.style??{},key:`${l.id}-${r}`});return null!=o?{element:Be(o,t,`${l.id}-${r}-cursor`),renderedByBackend:!0}:(R(l.id,t.type??"unknown"),{element:a(),renderedByBackend:!1})}function j(e){return D(e).element}function C(e){let t=[];return e.nodes.forEach((r,n)=>{let a=D({node:r,index:n,renderMode:e.renderMode,fallback:()=>e.fallback(r,n)});null!=a.element&&!1!==a.element&&t.push({node:r,index:n,...a})}),t}function P(e){let t=/* @__PURE__ */new Map;for(let r of e){let e=r.group??"_default",n=t.get(e);n||(n=[],t.set(e,n)),n.push(r)}for(let e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}let r=Array.from(t.keys()).sort((e,r)=>{let n=t.get(e),a=t.get(r);return(n.length>0?n[0].y:0)-(a.length>0?a[0].y:0)}),n=Array.from(t.values()).flat();n.sort((e,t)=>e.x-t.x||e.y-t.y);let a=/* @__PURE__ */new Map;for(let e=0;n.length>e;e++){n[e]._flatIndex=e;let t=n[e].datum?.id;null!=t&&a.set(t+"",e)}return{flat:n,groups:r,byGroup:t,idToIdx:a}}function L(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};let r=Math.max(0,Math.min(t,e.flat.length-1)),n=e.flat[r];return{flatIndex:r,group:n.group??"_default",indexInGroup:n._groupIndex??0}}function G(e,t,r){let{group:n,indexInGroup:a}=t,l=r.byGroup.get(n);switch(e){case"ArrowRight":return l.length-1>a?l[a+1]._flatIndex:t.flatIndex;case"ArrowLeft":return a>0?l[a-1]._flatIndex:t.flatIndex;case"ArrowDown":{let e=r.groups.indexOf(n);return r.groups.length-1>e?T(r,r.groups[e+1],l[a]):t.flatIndex}case"ArrowUp":{let e=r.groups.indexOf(n);return e>0?T(r,r.groups[e-1],l[a]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*r.flat.length)),r.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*r.flat.length)),0);case"Home":return 0;case"End":return r.flat.length-1;case"Escape":return-1;default:return null}}function T(e,t,r){let n=e.byGroup.get(t),a=0,l=Math.abs(n[0].x-r.x);for(let e=1;n.length>e;e++){let t=Math.abs(n[e].x-r.x);l>t&&(l=t,a=e)}return n[a]._flatIndex}function z(e){let t=[];for(let r of e)switch(r.type){case"point":if(!1===r.interactive)break;t.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=r.size)break;t.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=r.size||null==r.datum)break;let e=Ce(r.glyph,r.size);t.push({x:r.x+e.centerDx,y:r.y+e.centerDy,datum:r.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"});break}case"line":{let e=r,n=Array.isArray(e.datum)?e.datum:[],a=e.group??"_default";for(let r=0;e.path.length>r&&n.length>r;r++)t.push({x:e.path[r][0],y:e.path[r][1],datum:n[r],shape:"circle",group:a});break}case"area":{if(!1===r.interactive)break;let e=r,n=Array.isArray(e.datum)?e.datum:[],a=e.group??"_default";for(let r=0;e.topPath.length>r&&n.length>r;r++)t.push({x:e.topPath[r][0],y:e.topPath[r][1],datum:n[r],shape:"circle",group:a});break}case"rect":t.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:r.group??"_default"});break;case"heatcell":t.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function $(e){let t=[];for(let r of e)if("rect"===r.type&&null!=r.x){if(null==r.datum)continue;t.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:r.group??r.datum?.category??""})}else if("point"===r.type){if(!1===r.interactive)continue;t.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"})}else if("symbol"===r.type){if(0>=r.size)continue;t.push({x:r.x,y:r.y,datum:r.datum,shape:"circle",group:"_default"})}else if("glyph"===r.type){if(0>=r.size||null==r.datum)continue;let e=Ce(r.glyph,r.size);t.push({x:r.x+e.centerDx,y:r.y+e.centerDy,datum:r.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"})}else if("wedge"===r.type&&null!=r.cx){if(null===r.datum)continue;let e=((r.startAngle||0)+(r.endAngle||0))/2,n=((r.innerRadius||0)+(r.outerRadius||50))/2;t.push({x:r.cx+Math.cos(e)*n,y:r.cy+Math.sin(e)*n,datum:r.datum,shape:"wedge",group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function H(e){let t=[];for(let r of e)if(r.datum)if("circle"===r.type&&null!=r.cx){if(0>=r.r)continue;t.push({x:r.cx,y:r.cy,datum:r.datum,shape:"circle",group:r.datum.id??"_default"})}else if("rect"===r.type&&null!=r.x){if(0>=r.w||0>=r.h)continue;t.push({x:r.x+r.w/2,y:r.y+r.h/2,datum:r.datum,shape:"rect",w:r.w,h:r.h,group:r.datum.id??"_default"})}else if("arc"===r.type&&null!=r.cx)t.push({x:r.cx,y:r.cy,datum:r.datum,shape:"circle",group:r.datum.id??"_default"});else if("symbol"===r.type&&null!=r.cx){if(0>=r.size)continue;t.push({x:r.cx,y:r.cy,datum:r.datum,shape:"circle",group:r.datum.id??"_default"})}else if("glyph"===r.type&&null!=r.cx){if(0>=r.size)continue;let e=Ce(r.glyph,r.size);t.push({x:r.cx+e.centerDx,y:r.cy+e.centerDy,datum:r.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:r.datum.id??"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function N(e,t,r,n,a){let l=r.flat[t.flatIndex];if(!l)return G(e,t,r);let o=l.datum?.id;switch(e){case"ArrowRight":case"ArrowLeft":case"ArrowDown":case"ArrowUp":{let n=U(r,l,"ArrowRight"===e?"right":"ArrowLeft"===e?"left":"ArrowDown"===e?"down":"up")??t.flatIndex;return n!==t.flatIndex&&(a.current=-1),n}case"Enter":{if(null==o)return t.flatIndex;let e=V(o,n);if(0===e.length)return t.flatIndex;let l=r.idToIdx.get(e[(a.current+1)%e.length])??-1;return 0>l?t.flatIndex:(a.current=-1,l)}default:{let n=G(e,t,r);return null!==n&&n!==t.flatIndex&&(a.current=-1),n}}}function U(e,t,r){let n=null,a=1/0;for(let l=0;e.flat.length>l;l++){let o=e.flat[l];if(o===t)continue;let i=o.x-t.x,u=o.y-t.y,s=!1;switch(r){case"right":s=i>0&&Math.abs(i)>=Math.abs(u);break;case"left":s=0>i&&Math.abs(i)>=Math.abs(u);break;case"down":s=u>0&&Math.abs(u)>=Math.abs(i);break;case"up":s=0>u&&Math.abs(u)>=Math.abs(i)}if(!s)continue;let c=i*i+u*u;a>c&&(a=c,n=l)}return n}function W(e){return"object"==typeof e&&null!==e&&"id"in e?e.id:e}function V(e,t){let r=e+"",n=[];for(let e of t){let t=e.datum??e,a=W(t.source),l=W(t.target),o=null!=a,i=null!=l;o&&a+""===r&&i?n.push(l+""):i&&l+""===r&&o&&n.push(a+"")}return n}function Y(e){let t=[];for(let r of e)if("point"===r.type&&null!=r.x&&!1!==r.interactive)t.push({x:r.x,y:r.y,datum:r.datum,shape:"circle"});else if("glyph"===r.type){if(0>=r.size||null==r.datum)continue;let e=Ce(r.glyph,r.size);t.push({x:r.x+e.centerDx,y:r.y+e.centerDy,datum:r.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight})}else"geoarea"===r.type&&r.centroid&&!1!==r.interactive&&t.push({x:r.centroid[0],y:r.centroid[1],datum:r.datum,shape:"geoarea",pathData:r.pathData});return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}function F(e,t,r){switch(e){case"ArrowRight":case"ArrowDown":return r-1>t?t+1:t;case"ArrowLeft":case"ArrowUp":return t>0?t-1:t;case"PageDown":return Math.min(t+Math.max(1,Math.floor(.1*r)),r-1);case"PageUp":return Math.max(t-Math.max(1,Math.floor(.1*r)),0);case"Home":return 0;case"End":return r-1;case"Escape":return-1;default:return null}}function X(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}function q(e,t,r){let n=e.current;n.inside=!0,n.clientX=t.clientX,n.clientY=t.clientY,n.pointerType=t.pointerType??r}function Z(e,t,r,n,a,l){return q(e,t,l),!(!r&&!n||!r&&"touch"===e.current.pointerType&&(Ee(a),1))}function K(e){let{title:t,description:r,summary:n,accessibleTable:a,className:l,animate:o,maxDevicePixelRatio:i,axisExtent:u,autoPlaceAnnotations:s}=e,c={};return t&&(c.title=t),r&&(c.description=r),n&&(c.summary=n),void 0!==a&&(c.accessibleTable=a),l&&(c.className=l),null!=o&&(c.animate=o),void 0!==i&&(c.maxDevicePixelRatio=i),void 0!==u&&(c.axisExtent=u),void 0!==s&&(c.autoPlaceAnnotations=s),c}function J(e){let{linkedHover:t,selection:r,onObservation:n,onClick:a,hoverRadius:l,hoverHighlight:o,forceHoverBehavior:i,forceClickBehavior:u,mobileInteraction:s,customHoverBehavior:c,customClickBehavior:f,linkedHoverInClickPredicate:d=!0}=e,h={};n&&(h.annotationObservationCallback=n);let p=s?.enabled?Math.max(l??30,Math.ceil((s.targetSize||44)/2),24):l;return(i||t||n||a||o)&&(h.customHoverBehavior=c),f&&(u||(d?n||a||t:n||a)||s?.enabled&&(s.tapToSelect||s.tapToLockTooltip)&&(t||o||r))&&(h.customClickBehavior=f),null!=p&&(h.hoverRadius=p),h}function Q(e){let{tooltip:t,defaultTooltipContent:r}=e;return{tooltipContent:!1===t?()=>null:Se(t)||r}}function ee(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}function te(e,t){if(!ee(t))return e??((...e)=>({}));let r={};return void 0!==t.stroke&&(r.stroke=t.stroke),void 0!==t.strokeWidth&&(r.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(r.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...r}):(...e)=>({...r})}function re(e,t,r){if(1>=r)return 1;let n=r-1;return De({age:n-t,extent:n,type:e.type,halfLife:e.halfLife??r/2,threshold:e.stepThreshold??.5*r,minOpacity:e.minOpacity??.1})}function ne(e){let t=/* @__PURE__ */new Map;for(let r=0;e.length>r;r++)t.set(e[r],r);return t}function ae(e,t,r,n=ne(r)){let a=r.length;if(a>1)for(let r of t){if("line"===r.type){let t=Array.isArray(r.datum)?r.datum:[];if(2>t.length)continue;let l=Array(t.length),o=!1;for(let r=0;t.length>r;r++){let i=n.get(t[r]);null!=i?(l[r]=re(e,i,a),1>l[r]&&(o=!0)):l[r]=1}o&&(r._decayOpacities=l);continue}if("area"===r.type){let t=Array.isArray(r.datum)?r.datum:[],l=r.topPath?r.topPath.length:t.length;if(2>l)continue;if(t.length===l){let o=Array(l),i=!1;for(let r=0;t.length>r;r++){let l=n.get(t[r]);null!=l?(o[r]=re(e,l,a),1>o[r]&&(i=!0)):o[r]=1}i&&(r._decayOpacities=o)}else{let o=1;for(let r of t){let t=n.get(r);if(null!=t){let r=re(e,t,a);o>r&&(o=r)}}if(1>o){let e=Array(l);e.fill(o),r._decayOpacities=e}}continue}let t=n.get(r.datum);if(null==t)continue;let l=re(e,t,a);"candlestick"===r.type?r._decayOpacity=l:r.style={...r.style,opacity:(r.style?.opacity??1)*l}}}function le(e){if("production"===process.env.NODE_ENV)return;let{label:t,nodes:r,overlays:n,warned:a}=e;oe(n)&&0===r.length&&ie(a,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),r.length>0&&r.every(e=>null==e.datum)&&ie(a,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}function oe(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(oe))}function ie(e,t,r){e.has(t)||(e.add(t),console.warn(r))}function ue(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}function se(e,t,r,n){let a=ue(t),l="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:l,message:`Semiotic ${e} ${l} failed: ${a.message}`,error:a,recovery:r?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:r,affectedRevision:n}}function ce(e){try{return{kind:"success",result:e.run()}}catch(t){let r=e.hasPreviousResult,n=se(e.family,t,r,e.revision);"production"!==process.env.NODE_ENV&&console.error(`[semiotic] ${e.logLabel} threw:`,t);try{e.onLayoutError?.(n)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return{kind:"failure",diagnostic:n,preservedLastGoodScene:r}}}function fe(){return this.updateResults.last}function de(){return this.updateResults.last}function he(e){return this.updateResults.subscribe(e)}function pe(e){this.config.layoutSelection=e}function ye(){Je.set(this,!0)}function ge(){let e=!0===Je.get(this);return Je.delete(this),e}function me(e){Object.assign(e.prototype,{getLastUpdateResult:fe,getUpdateSnapshot:de,subscribeUpdateResult:he,setLayoutSelection:pe,markStylePaintPending:ye,consumeStylePaintPending:ge})}function xe(e,t,r,n,a,l){let o=a-r,i=l-n,u=o*o+i*i;if(0===u)return Math.sqrt((e-r)**2+(t-n)**2);let s=((e-r)*o+(t-n)*i)/u;return s=Math.max(0,Math.min(1,s)),Math.sqrt((e-(r+s*o))**2+(t-(n+s*i))**2)}function be(e,t,r){return r.x>e||e>r.x+r.w||r.y>t||t>r.y+r.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:r.x+r.w/2,cy:r.y+r.h/2}}function ve(e,t=30){return Math.max((e??4)+5,12,t)}function we(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function ke(e,t){let r=we(e);if(!r)return!1;let n=we(t);return!n||r.getFullYear()!==n.getFullYear()||r.getMonth()!==n.getMonth()}function Ae(e){let t=e%(2*Math.PI);return 0>t&&(t+=2*Math.PI),t}function Me(e,t,r,n,a,l=e=>e.x,o=e=>e.y,i=e=>e.r){let u=Math.max(n,a+5,12),s=t-u,c=t+u,f=r-u,d=r+u,h=null,p=1/0;return e.visit((e,a,u,y,g)=>{if(a>c||s>y||u>d||f>g)return!0;if(!e.length){let a=e;do{let e=a.data,u=l(e)-t,s=o(e)-r,c=Math.sqrt(u*u+s*s);ve(i(e),n)>=c&&p>c&&(h=e,p=c),a=a.next}while(a)}return!1}),h?{node:h,distance:p}:null}function _e(e,t){return"string"==typeof e&&e.length>0?e:t}function Ie(e,t,r){return"string"==typeof t&&t.length>0?t:"string"==typeof e&&e.length>0?`${e} (${r.familyPhrase})`:r.fallback}function Oe(e){let t=(e+"").replace(/[^a-zA-Z0-9_-]/g,"_"),r=/^[A-Za-z_]/.test(t)?t:"c"+t,n=r+"-semiotic-title",a=r+"-semiotic-desc";return{titleId:n,descId:a,labelledBy:`${n} ${a}`}}import{Va as Se,ea as Ee,h as Re,ia as Be,l as De,ya as je}from"./c-UMGHCBH5.min.js";import{i as Ce,m as Pe}from"./c-3BYZXCX3.min.js";import{jsx as Le,jsxs as Ge}from"react/jsx-runtime";import*as Te from"react";import{useEffect as ze,useRef as $e}from"react";var He={fresh:1,aging:.7,stale:.45,expired:.25},Ne={alpha:1,band:"fresh",isStale:!1};import{useEffect as Ue,useRef as We}from"react";import{jsx as Ve}from"react/jsx-runtime";var Ye={live:"#28a745",stale:"#dc3545",stopped:"#6c757d",failed:"#842029",settling:"#fd7e14"};import{useRef as Fe}from"react";import{useCallback as Xe,useEffect as qe,useRef as Ze}from"react";var Ke=/* @__PURE__ */new Set,Je=/* @__PURE__ */new WeakMap;export{re as a,ne as b,ae as c,le as d,ce as e,me as f,u as g,s as h,c as i,xe as j,be as k,ve as l,ke as m,Ae as n,Me as o,f as p,d as q,p as r,e as s,_e as t,Ie as u,Oe as v,y as w,b as x,w as y,k as z,A,M as B,_ as C,O as D,B as E,j as F,C as G,t as H,r as I,l as J,o as K,i as L,P as M,L as N,G as O,z as P,$ as Q,H as R,N as S,Y as T,F as U,X as V,Z as W,K as X,J as Y,Q as Z,te as _};