semiotic 3.10.3 → 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 (81) hide show
  1. package/README.md +17 -18
  2. package/ai/artifact-surface-inventory.json +1 -1
  3. package/ai/behaviorContracts.cjs +14 -4
  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 +3 -3
  11. package/ai/schema.json +1 -1
  12. package/ai/surface-manifest.json +1 -1
  13. package/ai/system-prompt.md +1 -1
  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-FHNY57SO.min.js → c-2MHSD3TN.min.js} +46 -46
  22. package/dist/{c-5PIKBUMF.min.js → c-6XGGN5OS.min.js} +1 -1
  23. package/dist/c-EK6XI2U7.min.js +26 -0
  24. package/dist/{c-4XLHPQTP.min.js → c-JBWPJNTJ.min.js} +1 -1
  25. package/dist/c-KWP4QTCM.min.js +4 -0
  26. package/dist/c-LRV7PO45.min.js +393 -0
  27. package/dist/c-LVHJJUOF.min.js +1 -0
  28. package/dist/c-NUBZ63VU.min.js +1 -0
  29. package/dist/{c-ZVOFLE2P.min.js → c-RWHLEUX6.min.js} +6 -6
  30. package/dist/{c-4JKDJUYD.min.js → c-S746GRV4.min.js} +1 -1
  31. package/dist/{c-ISA6IJ6V.min.js → c-UQBWSYKI.min.js} +5 -5
  32. package/dist/components/ai/chartClinic.d.ts +1 -1
  33. package/dist/components/ai/chartClinicMetadata.generated.d.ts +2 -2
  34. package/dist/components/charts/shared/{chartDefinitionPilot.d.ts → chartDefinition.d.ts} +30 -34
  35. package/dist/components/charts/shared/chartDefinitions.d.ts +10 -0
  36. package/dist/components/charts/shared/chartDefinitionsNetwork.d.ts +17 -0
  37. package/dist/components/charts/shared/chartDefinitionsOrdinal.d.ts +23 -0
  38. package/dist/components/charts/shared/chartDefinitionsPhysics.d.ts +17 -0
  39. package/dist/components/charts/shared/chartDefinitionsRealtime.d.ts +12 -0
  40. package/dist/components/charts/shared/chartDefinitionsXY.d.ts +26 -0
  41. package/dist/components/server/serverChartConfigs.d.ts +36 -36
  42. package/dist/components/server/serverChartConfigsNetwork.generated.d.ts +17 -0
  43. package/dist/components/server/serverChartConfigsOrdinal.generated.d.ts +23 -0
  44. package/dist/components/server/serverChartConfigsPhysics.generated.d.ts +17 -0
  45. package/dist/components/server/serverChartConfigsRealtime.generated.d.ts +13 -0
  46. package/dist/components/server/serverChartConfigsXY.generated.d.ts +22 -0
  47. package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +5 -0
  48. package/dist/network.module.min.js +1 -1
  49. package/dist/physics-matter.min.js +4 -1
  50. package/dist/physics-matter.module.min.js +1 -1
  51. package/dist/physics-rapier.min.js +4 -1
  52. package/dist/physics-rapier.module.min.js +1 -1
  53. package/dist/physics.module.min.js +1 -1
  54. package/dist/semiotic-ai-core.min.js +3 -3
  55. package/dist/semiotic-ai-core.module.min.js +3 -3
  56. package/dist/semiotic-ai.module.min.js +2 -2
  57. package/dist/semiotic-artifact.min.js +1 -1
  58. package/dist/semiotic-artifact.module.min.js +1 -1
  59. package/dist/semiotic-client-cjs-shared.min.js +4 -4
  60. package/dist/semiotic-experimental-auxiliary.module.min.js +1 -1
  61. package/dist/semiotic-experimental-node-auxiliary.module.min.js +1 -1
  62. package/dist/semiotic-experimental-vacp.module.min.js +1 -1
  63. package/dist/semiotic-realtime-core.module.min.js +1 -1
  64. package/dist/semiotic-recipes-core-cjs-base.min.js +1 -1
  65. package/dist/semiotic-recipes-core.module.min.js +13 -13
  66. package/dist/semiotic-server-edge-node.module.min.js +393 -391
  67. package/dist/semiotic-server-edge.min.js +393 -391
  68. package/dist/semiotic-server-edge.module.min.js +374 -372
  69. package/dist/semiotic-server-node.min.js +393 -391
  70. package/dist/semiotic-server-node.module.min.js +1 -1
  71. package/dist/semiotic-utils-core.min.js +1 -1
  72. package/dist/semiotic-utils-core.module.min.js +1 -1
  73. package/dist/semiotic.module.min.js +9 -9
  74. package/dist/server.min.js +393 -391
  75. package/dist/server.module.min.js +1 -1
  76. package/package.json +8 -4
  77. package/dist/c-3OFVBWQY.min.js +0 -1
  78. package/dist/c-43XNOQNQ.min.js +0 -391
  79. package/dist/c-6IVBV5NO.min.js +0 -1
  80. package/dist/c-KXH7LFIL.min.js +0 -26
  81. 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(){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,4 +1,4 @@
1
- function e(e,s,i,o){if(e.circular&&e.segments)return void t(e.segments,s,i,e.halfWidth,o);if(!e.points)return o.x=0,void(o.y=0);let[n,a,l,d]=e.points;r(n,a,l,d,s,o);let c=d.x-n.x,u=d.y-n.y,h=Math.sqrt(c*c+u*u);if(h>.001){let t=c/h;o.x+=-u/h*i*e.halfWidth*2,o.y+=t*i*e.halfWidth*2}}function t(e,t,s,i,o){let n=e.length,a=t*n,l=Math.min(Math.floor(a),n-1),d=a-l,[c,u,h,y]=e[l];r(c,u,h,y,d,o);let g=y.x-c.x,p=y.y-c.y,f=Math.sqrt(g*g+p*p);if(f>.001){let e=g/f;o.x+=-p/f*s*i*2,o.y+=e*s*i*2}}function r(e,t,r,s,i,o){let n=1-i,a=n*n,l=a*n,d=i*i,c=d*i;o.x=l*e.x+3*a*i*t.x+3*n*d*r.x+c*s.x,o.y=l*e.y+3*a*i*t.y+3*n*d*r.y+c*s.y}function s(e,t){Tr[e]=t}function i(e){return Tr[e]}function o(e){i(e)||"production"===process.env.NODE_ENV||Pr||(Pr=!0,console.warn(`[semiotic] StreamNetworkFrame: no layout plugin registered for "${e}". Import the matching chart HOC (which registers its plugin), or call registerBuiltInNetworkLayouts() from "semiotic/network".`))}function n(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function a(e){if(!e||"object"!=typeof e)return!1;let t=e;if("boolean"!=typeof t.circular||"number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(let e of t.segments)if(!l(e))return!1;return!0}return l(t.points)}function l(e){if(!Array.isArray(e)||4!==e.length)return!1;for(let t of e){if(!t||"object"!=typeof t)return!1;let e=t;if("number"!=typeof e.x||!Number.isFinite(e.x)||"number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}function d(e,t,r,s=Ir){let i=(e.sankeyWidth||1)/2;if("down"===e.direction){let o=t.x1,n=r.x0,a=Wr(o,n);return{circular:!1,points:[{x:e.y0,y:o},{x:e.y0,y:a(s)},{x:e.y1,y:a(1-s)},{x:e.y1,y:n}],halfWidth:i}}let o=t.x1,n=r.x0,a=Wr(o,n);return{circular:!1,points:[{x:o,y:e.y0},{x:a(s),y:e.y0},{x:a(1-s),y:e.y1},{x:n,y:e.y1}],halfWidth:i}}function c(e,t=Ir){let r,s=(e._circularWidth||e.sankeyWidth||1)/2,i=e.circularPathData;if(!i)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){let e=Math.max(15,Math.min(40,.33*(i.rightFullExtent-i.sourceX))),t=Math.max(15,Math.min(40,.33*(i.targetX-i.leftFullExtent)));return{circular:!0,segments:[[{x:i.sourceX,y:i.sourceY},{x:i.sourceX+.33*e,y:i.sourceY},{x:i.sourceX+.66*e,y:i.sourceY},{x:i.sourceX+e,y:i.sourceY}],[{x:i.targetX-t,y:i.targetY},{x:i.targetX-.66*t,y:i.targetY},{x:i.targetX-.33*t,y:i.targetY},{x:i.targetX,y:i.targetY}]],halfWidth:s}}r="down"===e.direction?[{x:i.sourceY,y:i.sourceX},{x:i.sourceY,y:i.rightFullExtent},{x:i.verticalFullExtent,y:i.rightFullExtent},{x:i.verticalFullExtent,y:i.leftFullExtent},{x:i.targetY,y:i.leftFullExtent},{x:i.targetY,y:i.targetX}]:[{x:i.sourceX,y:i.sourceY},{x:i.rightFullExtent,y:i.sourceY},{x:i.rightFullExtent,y:i.verticalFullExtent},{x:i.leftFullExtent,y:i.verticalFullExtent},{x:i.leftFullExtent,y:i.targetY},{x:i.targetX,y:i.targetY}];let o=[];for(let e=0;r.length-1>e;e++){let t=r[e],s=r[e+1],i=s.x-t.x,n=s.y-t.y;o.push([t,{x:t.x+i/3,y:t.y+n/3},{x:t.x+2*i/3,y:t.y+2*n/3},s])}return{circular:!0,segments:o,halfWidth:s}}function u(e,t,r=Ir){let s="string"==typeof e.source?t.get(e.source):e.source,i="string"==typeof e.target?t.get(e.target):e.target;return!(!s||!i||(e.bezier=e.circular&&e.circularPathData?c(e,r):d(e,s,i,r),0))}function h(e){let t=e.pulse;if(!t)return;let r=t.duration??500,s=t.color??"rgba(255,255,255,0.6)",i=t.glowRadius??4,{now:o}=e;for(let t of e.sceneNodes){let n=t.id;if(!n)continue;let a=e.nodeTimestamps.get(n);if(!a)continue;let l=o-a;r>l&&(t._pulseIntensity=1-l/r,t._pulseColor=s,t._pulseGlowRadius=i)}for(let t of e.sceneEdges){let i=t.datum;if(!i)continue;let n="object"==typeof i.source?i.source?.id:i.source,a="object"==typeof i.target?i.target?.id:i.target;if(!n||!a)continue;let l=e.edgeTimestamps.get(`${n}\0${a}`);if(!l)continue;let d=o-l;r>d&&(t._pulseIntensity=1-d/r,t._pulseColor=s)}}function y(e){let t=e.decay;if(!t)return;let r=e.nodeTimestamps.size;if(1>=r)return;if(!e.cache.sortedNodes){e.cache.sortedNodes=Array.from(e.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);let t=/* @__PURE__ */new Map;for(let r=0;e.cache.sortedNodes.length>r;r++)t.set(e.cache.sortedNodes[r][0],r);e.cache.ageMap=t}let s=e.cache.ageMap;for(let i of e.sceneNodes){let e=i.id;if(!e)continue;let o=s.get(e);if(void 0===o)continue;let n=Be(t,o,r);i.style={...i.style,opacity:(i.style?.opacity??1)*n}}}function g(e){for(let t of e.sceneNodes)t._pulseColor===Lr&&(t._pulseIntensity=0,t._pulseColor=void 0,t._pulseGlowRadius=void 0);if(0===e.addedNodes.size)return;let t=e.now-e.lastTopologyChangeTime;if(t>=Mr)return;let r=1-t/Mr;for(let t of e.sceneNodes){let s=t.id;!s||!e.addedNodes.has(s)||(t._pulseIntensity=Math.max(t._pulseIntensity??0,r),t._pulseColor=Lr,t._pulseGlowRadius=8)}}function p(e,t,r=("u">typeof performance?performance.now():Date.now())){return 0!==e.size&&Mr>r-t}function f(e){let t=e.thresholds;if(!t)return;let r=t.warningColor??"#f59e0b",s=t.criticalColor??"#ef4444",i=!1!==t.pulse;for(let o of e.sceneNodes){let n=o.id;if(!n)continue;let a=e.nodes.get(n);if(!a)continue;let l=t.metric(a),d=null;void 0===t.critical||t.critical>l?void 0!==t.warning&&l>=t.warning&&(d=r):d=s,d&&(o.style={...o.style,fill:d},i&&(o._pulseIntensity=.6+.4*Math.sin(e.now/300),o._pulseColor=d,o._pulseGlowRadius=6))}}function m(e,t){if(!t)return!1;for(let r of e){let e=t.metric(r);if(void 0!==t.warning&&e>=t.warning||void 0!==t.critical&&e>=t.critical)return!0}return!1}function v(e){let t=e.pulse;if(!t||0===e.lastIngestTime)return!1;let r=e.now??("u">typeof performance?performance.now():Date.now());return(t.duration??500)>r-e.lastIngestTime}function k(e){let t="preserve",r=/* @__PURE__ */new Set;for(let s of e){let e=Vr[s]??Gr;"rebuild"===e.retainedData&&(t="rebuild");for(let t of e.invalidations)r.add(t)}return{retainedData:t,invalidations:r}}function b({config:e,customLayout:t,size:r,nodes:s,edges:i,previousResult:o,revision:n}){let a=at(e.colorScheme,e.themeCategorical,nr),l={nodes:s,edges:i,dimensions:{width:r[0],height:r[1],plot:{x:0,y:0,width:r[0],height:r[1]}},theme:{semantic:e.themeSemantic??{},categorical:[...a]},resolveColor:lt(a,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};return Ye({family:"network",logLabel:"customNetworkLayout",revision:n,hasPreviousResult:null!==o,onLayoutError:e.onLayoutError,run:()=>t(l)})}function _(e,t,r,s){return{geometry:[r,s,...t,e.customNetworkLayout,e.layoutConfig],colors:{semantic:e.themeSemantic,categorical:e.themeCategorical,colorScheme:e.colorScheme},selection:[e.layoutSelection?.isActive??!1,e.layoutSelection?.predicate,null!=e.layoutSelection]}}function x(e,t){e.customLayoutBackgrounds=t.backgrounds??null,e.customLayoutOverlays=t.overlays??null,e.customLayoutHtmlMarks=t.htmlMarks??[],e.lastCustomLayoutResult=t}function w(e){e.customLayoutBackgrounds=null,e.customLayoutOverlays=null,e.customLayoutHtmlMarks=[],e.lastCustomLayoutResult=null}function S(e,t){let r=/* @__PURE__ */new WeakMap;for(let t of e)r.set(t,t.style);for(let e of t)r.set(e,e.style);return r}function A({nodes:e,edges:t,restyle:r,restyleEdge:s,baseStyles:i,selection:o}){let n=!(!r&&!s);if(r)for(let t of e){let e=i.get(t)??t.style,s=r(t,o);t.style=s?{...e,...s}:e}if(s)for(let e of t){let t=i.get(e)??e.style,r=s(e,o);e.style=r?{...t,...r}:t}return n}function C(e){let t=e.id??e.datum?.id??e.datum?.data?.id??e.datum?.data?.name;return null==t?void 0:t+""}function N(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){let t=e.cx??e.x,r=e.cy??e.y;if("number"!=typeof t||"number"!=typeof r)return null;let s=hr(e.glyph,e.size);return{x:t+s.centerDx,y:r+s.centerDy,r:Math.max(1,s.radius)}}let t=e.cx??(null!=e.x&&null!=e.w?e.x+e.w/2:e.x),r=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof r?null:{x:t,y:r,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,ur(e.size)):Math.max(1,e.w??0,e.h??0)/2}}function R(e){if(!e)return;let t=[];for(let r of e){let e=N(r);e&&t.push({pointId:C(r),...e})}return t}function E(e){let{width:t,height:r,totalWidth:s,totalHeight:i,margin:o,labels:n,title:a,description:l,idPrefix:d,legend:c,legendHoverBehavior:u,legendClickBehavior:h,legendHighlightedCategory:y,legendIsolatedCategories:g,legendPosition:p="right",legendLayout:f,foregroundGraphics:m,sceneNodes:v,annotations:k,onAnnotationActivate:b,onObservation:_,chartId:x,chartType:w,autoPlaceAnnotations:S,svgAnnotationRules:A}=e,C=ht({onAnnotationActivate:b,onObservation:_,chartId:x,chartType:w}),N=Jr.useMemo(()=>{let e=R(v)??[];return{scales:null,width:t,height:r,frameType:"network",pointNodes:e,sceneNodes:v}},[r,v,t]),E=Jr.useMemo(()=>{if(!k)return k;let e=qe(k);return S?St({annotations:e,context:N,..."object"==typeof S?S:{}}):e},[k,S,N]),T=Jr.useMemo(()=>_t("network"),[]),P=E?bt(E.filter(e=>"widget"!==e.type),T,A,N):null,D=!0===E?.some(e=>"widget"===e.type&&!0===e._annotationDeferred),W=Zr(),{titleId:I,descId:L,labelledBy:M}=Ze(d||x||W);/* @__PURE__ */
1
+ function e(e,s,i,o){if(e.circular&&e.segments)return void t(e.segments,s,i,e.halfWidth,o);if(!e.points)return o.x=0,void(o.y=0);let[n,a,l,d]=e.points;r(n,a,l,d,s,o);let c=d.x-n.x,u=d.y-n.y,h=Math.sqrt(c*c+u*u);if(h>.001){let t=c/h;o.x+=-u/h*i*e.halfWidth*2,o.y+=t*i*e.halfWidth*2}}function t(e,t,s,i,o){let n=e.length,a=t*n,l=Math.min(Math.floor(a),n-1),d=a-l,[c,u,h,y]=e[l];r(c,u,h,y,d,o);let g=y.x-c.x,p=y.y-c.y,f=Math.sqrt(g*g+p*p);if(f>.001){let e=g/f;o.x+=-p/f*s*i*2,o.y+=e*s*i*2}}function r(e,t,r,s,i,o){let n=1-i,a=n*n,l=a*n,d=i*i,c=d*i;o.x=l*e.x+3*a*i*t.x+3*n*d*r.x+c*s.x,o.y=l*e.y+3*a*i*t.y+3*n*d*r.y+c*s.y}function s(e,t){Tr[e]=t}function i(e){return Tr[e]}function o(e){i(e)||"production"===process.env.NODE_ENV||Pr||(Pr=!0,console.warn(`[semiotic] StreamNetworkFrame: no layout plugin registered for "${e}". Import the matching chart HOC (which registers its plugin), or call registerBuiltInNetworkLayouts() from "semiotic/network".`))}function n(e){return{id:e,x0:0,x1:0,y0:0,y1:0,x:0,y:0,width:0,height:0,value:0,createdByFrame:!0}}function a(e){if(!e||"object"!=typeof e)return!1;let t=e;if("boolean"!=typeof t.circular||"number"!=typeof t.halfWidth||!Number.isFinite(t.halfWidth))return!1;if(t.circular){if(!Array.isArray(t.segments)||0===t.segments.length)return!1;for(let e of t.segments)if(!l(e))return!1;return!0}return l(t.points)}function l(e){if(!Array.isArray(e)||4!==e.length)return!1;for(let t of e){if(!t||"object"!=typeof t)return!1;let e=t;if("number"!=typeof e.x||!Number.isFinite(e.x)||"number"!=typeof e.y||!Number.isFinite(e.y))return!1}return!0}function d(e,t,r,s=Ir){let i=(e.sankeyWidth||1)/2;if("down"===e.direction){let o=t.x1,n=r.x0,a=Wr(o,n);return{circular:!1,points:[{x:e.y0,y:o},{x:e.y0,y:a(s)},{x:e.y1,y:a(1-s)},{x:e.y1,y:n}],halfWidth:i}}let o=t.x1,n=r.x0,a=Wr(o,n);return{circular:!1,points:[{x:o,y:e.y0},{x:a(s),y:e.y0},{x:a(1-s),y:e.y1},{x:n,y:e.y1}],halfWidth:i}}function c(e,t=Ir){let r,s=(e._circularWidth||e.sankeyWidth||1)/2,i=e.circularPathData;if(!i)throw Error("buildCircularBezier requires circularPathData");if(e._circularStub){let e=Math.max(15,Math.min(40,.33*(i.rightFullExtent-i.sourceX))),t=Math.max(15,Math.min(40,.33*(i.targetX-i.leftFullExtent)));return{circular:!0,segments:[[{x:i.sourceX,y:i.sourceY},{x:i.sourceX+.33*e,y:i.sourceY},{x:i.sourceX+.66*e,y:i.sourceY},{x:i.sourceX+e,y:i.sourceY}],[{x:i.targetX-t,y:i.targetY},{x:i.targetX-.66*t,y:i.targetY},{x:i.targetX-.33*t,y:i.targetY},{x:i.targetX,y:i.targetY}]],halfWidth:s}}r="down"===e.direction?[{x:i.sourceY,y:i.sourceX},{x:i.sourceY,y:i.rightFullExtent},{x:i.verticalFullExtent,y:i.rightFullExtent},{x:i.verticalFullExtent,y:i.leftFullExtent},{x:i.targetY,y:i.leftFullExtent},{x:i.targetY,y:i.targetX}]:[{x:i.sourceX,y:i.sourceY},{x:i.rightFullExtent,y:i.sourceY},{x:i.rightFullExtent,y:i.verticalFullExtent},{x:i.leftFullExtent,y:i.verticalFullExtent},{x:i.leftFullExtent,y:i.targetY},{x:i.targetX,y:i.targetY}];let o=[];for(let e=0;r.length-1>e;e++){let t=r[e],s=r[e+1],i=s.x-t.x,n=s.y-t.y;o.push([t,{x:t.x+i/3,y:t.y+n/3},{x:t.x+2*i/3,y:t.y+2*n/3},s])}return{circular:!0,segments:o,halfWidth:s}}function u(e,t,r=Ir){let s="string"==typeof e.source?t.get(e.source):e.source,i="string"==typeof e.target?t.get(e.target):e.target;return!(!s||!i||(e.bezier=e.circular&&e.circularPathData?c(e,r):d(e,s,i,r),0))}function h(e){let t=e.pulse;if(!t)return;let r=t.duration??500,s=t.color??"rgba(255,255,255,0.6)",i=t.glowRadius??4,{now:o}=e;for(let t of e.sceneNodes){let n=t.id;if(!n)continue;let a=e.nodeTimestamps.get(n);if(!a)continue;let l=o-a;r>l&&(t._pulseIntensity=1-l/r,t._pulseColor=s,t._pulseGlowRadius=i)}for(let t of e.sceneEdges){let i=t.datum;if(!i)continue;let n="object"==typeof i.source?i.source?.id:i.source,a="object"==typeof i.target?i.target?.id:i.target;if(!n||!a)continue;let l=e.edgeTimestamps.get(`${n}\0${a}`);if(!l)continue;let d=o-l;r>d&&(t._pulseIntensity=1-d/r,t._pulseColor=s)}}function y(e){let t=e.decay;if(!t)return;let r=e.nodeTimestamps.size;if(1>=r)return;if(!e.cache.sortedNodes){e.cache.sortedNodes=Array.from(e.nodeTimestamps.entries()).sort((e,t)=>e[1]-t[1]);let t=/* @__PURE__ */new Map;for(let r=0;e.cache.sortedNodes.length>r;r++)t.set(e.cache.sortedNodes[r][0],r);e.cache.ageMap=t}let s=e.cache.ageMap;for(let i of e.sceneNodes){let e=i.id;if(!e)continue;let o=s.get(e);if(void 0===o)continue;let n=Be(t,o,r);i.style={...i.style,opacity:(i.style?.opacity??1)*n}}}function g(e){for(let t of e.sceneNodes)t._pulseColor===Lr&&(t._pulseIntensity=0,t._pulseColor=void 0,t._pulseGlowRadius=void 0);if(0===e.addedNodes.size)return;let t=e.now-e.lastTopologyChangeTime;if(t>=Mr)return;let r=1-t/Mr;for(let t of e.sceneNodes){let s=t.id;!s||!e.addedNodes.has(s)||(t._pulseIntensity=Math.max(t._pulseIntensity??0,r),t._pulseColor=Lr,t._pulseGlowRadius=8)}}function p(e,t,r=("u">typeof performance?performance.now():Date.now())){return 0!==e.size&&Mr>r-t}function f(e){let t=e.thresholds;if(!t)return;let r=t.warningColor??"#f59e0b",s=t.criticalColor??"#ef4444",i=!1!==t.pulse;for(let o of e.sceneNodes){let n=o.id;if(!n)continue;let a=e.nodes.get(n);if(!a)continue;let l=t.metric(a),d=null;void 0===t.critical||t.critical>l?void 0!==t.warning&&l>=t.warning&&(d=r):d=s,d&&(o.style={...o.style,fill:d},i&&(o._pulseIntensity=.6+.4*Math.sin(e.now/300),o._pulseColor=d,o._pulseGlowRadius=6))}}function m(e,t){if(!t)return!1;for(let r of e){let e=t.metric(r);if(void 0!==t.warning&&e>=t.warning||void 0!==t.critical&&e>=t.critical)return!0}return!1}function v(e){let t=e.pulse;if(!t||0===e.lastIngestTime)return!1;let r=e.now??("u">typeof performance?performance.now():Date.now());return(t.duration??500)>r-e.lastIngestTime}function k(e){let t="preserve",r=/* @__PURE__ */new Set;for(let s of e){let e=Vr[s]??Gr;"rebuild"===e.retainedData&&(t="rebuild");for(let t of e.invalidations)r.add(t)}return{retainedData:t,invalidations:r}}function b({config:e,customLayout:t,size:r,nodes:s,edges:i,previousResult:o,revision:n}){let a=at(e.colorScheme,e.themeCategorical,nr),l={nodes:s,edges:i,dimensions:{width:r[0],height:r[1],plot:{x:0,y:0,width:r[0],height:r[1]}},theme:{semantic:e.themeSemantic??{},categorical:[...a]},resolveColor:lt(a,e.colorScheme),config:e.layoutConfig??{},selection:e.layoutSelection??null};return Fe({family:"network",logLabel:"customNetworkLayout",revision:n,hasPreviousResult:null!==o,onLayoutError:e.onLayoutError,run:()=>t(l)})}function _(e,t,r,s){return{geometry:[r,s,...t,e.customNetworkLayout,e.layoutConfig],colors:{semantic:e.themeSemantic,categorical:e.themeCategorical,colorScheme:e.colorScheme},selection:[e.layoutSelection?.isActive??!1,e.layoutSelection?.predicate,null!=e.layoutSelection]}}function x(e,t){e.customLayoutBackgrounds=t.backgrounds??null,e.customLayoutOverlays=t.overlays??null,e.customLayoutHtmlMarks=t.htmlMarks??[],e.lastCustomLayoutResult=t}function w(e){e.customLayoutBackgrounds=null,e.customLayoutOverlays=null,e.customLayoutHtmlMarks=[],e.lastCustomLayoutResult=null}function S(e,t){let r=/* @__PURE__ */new WeakMap;for(let t of e)r.set(t,t.style);for(let e of t)r.set(e,e.style);return r}function A({nodes:e,edges:t,restyle:r,restyleEdge:s,baseStyles:i,selection:o}){let n=!(!r&&!s);if(r)for(let t of e){let e=i.get(t)??t.style,s=r(t,o);t.style=s?{...e,...s}:e}if(s)for(let e of t){let t=i.get(e)??e.style,r=s(e,o);e.style=r?{...t,...r}:t}return n}function C(e){let t=e.id??e.datum?.id??e.datum?.data?.id??e.datum?.data?.name;return null==t?void 0:t+""}function N(e){if("glyph"===e.type&&e.glyph&&"number"==typeof e.size){let t=e.cx??e.x,r=e.cy??e.y;if("number"!=typeof t||"number"!=typeof r)return null;let s=hr(e.glyph,e.size);return{x:t+s.centerDx,y:r+s.centerDy,r:Math.max(1,s.radius)}}let t=e.cx??(null!=e.x&&null!=e.w?e.x+e.w/2:e.x),r=e.cy??(null!=e.y&&null!=e.h?e.y+e.h/2:e.y);return"number"!=typeof t||"number"!=typeof r?null:{x:t,y:r,r:"number"==typeof e.r?Math.max(1,e.r):"number"==typeof e.outerR?Math.max(1,e.outerR):"number"==typeof e.size?Math.max(1,ur(e.size)):Math.max(1,e.w??0,e.h??0)/2}}function R(e){if(!e)return;let t=[];for(let r of e){let e=N(r);e&&t.push({pointId:C(r),...e})}return t}function E(e){let{width:t,height:r,totalWidth:s,totalHeight:i,margin:o,labels:n,title:a,description:l,idPrefix:d,legend:c,legendHoverBehavior:u,legendClickBehavior:h,legendHighlightedCategory:y,legendIsolatedCategories:g,legendPosition:p="right",legendLayout:f,foregroundGraphics:m,sceneNodes:v,annotations:k,onAnnotationActivate:b,onObservation:_,chartId:x,chartType:w,autoPlaceAnnotations:S,svgAnnotationRules:A}=e,C=ht({onAnnotationActivate:b,onObservation:_,chartId:x,chartType:w}),N=Jr.useMemo(()=>{let e=R(v)??[];return{scales:null,width:t,height:r,frameType:"network",pointNodes:e,sceneNodes:v}},[r,v,t]),E=Jr.useMemo(()=>{if(!k)return k;let e=qe(k);return S?St({annotations:e,context:N,..."object"==typeof S?S:{}}):e},[k,S,N]),T=Jr.useMemo(()=>_t("network"),[]),P=E?bt(E.filter(e=>"widget"!==e.type),T,A,N):null,D=!0===E?.some(e=>"widget"===e.type&&!0===e._annotationDeferred),W=Zr(),{titleId:I,descId:L,labelledBy:M}=Ze(d||x||W);/* @__PURE__ */
2
2
  return rs(es,{children:[D&&/* @__PURE__ */ts("style",{children:vt},"annotation-widget-disclosure-style"),
3
3
  /* @__PURE__ */rs("svg",{role:"img","aria-labelledby":M,width:s,height:i,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
4
4
  /* @__PURE__ */ts("title",{id:I,children:Ue(a,"Network Chart")}),
@@ -19,19 +19,19 @@ return ds(ns.Fragment,{children:[i&&/* @__PURE__ */ls("defs",{children:i}),
19
19
  return ds(ns.Fragment,{children:[i&&/* @__PURE__ */ls("defs",{children:i}),
20
20
  /* @__PURE__ */ls("path",{d:r.pathD,fill:i?`url(#${s})`:Nt(r.style.fill,"#999"),fillOpacity:r.style.fillOpacity,stroke:r.style.stroke||"none",strokeWidth:r.style.strokeWidth,opacity:r.style.opacity})]},"net-edge-"+t)}case"curved":{let r=e;/* @__PURE__ */
21
21
  return ls("path",{d:r.pathD,fill:Nt(r.style.fill,"none"),stroke:r.style.stroke||"#999",strokeWidth:r.style.strokeWidth??1,opacity:r.style.opacity},"net-edge-"+t)}default:return null}}function B(e,t){/* @__PURE__ */
22
- return ls("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}function O({props:e,store:t,responsiveRef:r,size:s,margin:i,adjustedWidth:o,adjustedHeight:n,surfaceBackground:a,resolvedBackground:l,resolvedForeground:d}){let{chartType:c,nodes:u,edges:h,data:y,className:g,description:p,title:f,responsiveWidth:m,responsiveHeight:v,summary:k,renderMode:b,legend:_,legendPosition:x,legendLayout:w,legendHoverBehavior:S,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:N,layoutSelection:R,annotations:T,onAnnotationActivate:P,annotationObservationCallback:I,onObservation:M,chartId:O,autoPlaceAnnotations:Y,svgAnnotationRules:F}=e;if(t){let e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(c),r=e?y||(Array.isArray(h)?void 0:h):void 0;if(e&&r)t.ingestHierarchy(r,[o,n]),t.buildScene([o,n]);else{let e=Wt(u),r=Array.isArray(h)?Wt(h):[];(e.length>0||r.length>0)&&(t.ingestBounded(e,r,[o,n]),t.buildScene([o,n]))}}let z=t?.sceneNodes??[],j=t?.sceneEdges??[],X=t?.labels??[];/* @__PURE__ */
22
+ return ls("text",{x:e.x,y:e.y,textAnchor:e.anchor||"middle",dominantBaseline:e.baseline||"auto",fontSize:e.fontSize||11,fontWeight:e.fontWeight,fill:e.fill||"var(--semiotic-text, #333)",stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:e.paintOrder,children:e.text},"net-label-"+t)}function O({props:e,store:t,responsiveRef:r,size:s,margin:i,adjustedWidth:o,adjustedHeight:n,surfaceBackground:a,resolvedBackground:l,resolvedForeground:d}){let{chartType:c,nodes:u,edges:h,data:y,className:g,description:p,title:f,responsiveWidth:m,responsiveHeight:v,summary:k,renderMode:b,legend:_,legendPosition:x,legendLayout:w,legendHoverBehavior:S,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:N,layoutSelection:R,annotations:T,onAnnotationActivate:P,annotationObservationCallback:I,onObservation:M,chartId:O,autoPlaceAnnotations:F,svgAnnotationRules:Y}=e;if(t){let e=["tree","cluster","treemap","circlepack","partition","orbit"].includes(c),r=e?y||(Array.isArray(h)?void 0:h):void 0;if(e&&r)t.ingestHierarchy(r,[o,n]),t.buildScene([o,n]);else{let e=Wt(u),r=Array.isArray(h)?Wt(h):[];(e.length>0||r.length>0)&&(t.ingestBounded(e,r,[o,n]),t.buildScene([o,n]))}}let z=t?.sceneNodes??[],j=t?.sceneEdges??[],X=t?.labels??[];/* @__PURE__ */
23
23
  return us("div",{ref:r,className:"stream-network-frame"+(g?" "+g:""),role:"img","aria-label":p||("string"==typeof f?f:"Network chart"),style:{position:"relative",fontFamily:"var(--semiotic-font-family, sans-serif)",width:m?"100%":s[0],height:v?"100%":s[1]},children:[
24
24
  /* @__PURE__ */cs(rr,{summary:k}),
25
25
  /* @__PURE__ */us("svg",{xmlns:"http://www.w3.org/2000/svg",width:s[0],height:s[1],style:{position:"absolute",left:0,top:0},children:[a?/* @__PURE__ */cs("rect",{className:"stream-frame-background__backdrop",x:0,y:0,width:s[0],height:s[1],fill:a}):null,
26
26
  /* @__PURE__ */cs("g",{transform:`translate(${i.left},${i.top})`,children:ze(l,t?.customLayoutBackgrounds)}),
27
27
  /* @__PURE__ */us("g",{transform:`translate(${i.left},${i.top})`,children:[j.map((e,t)=>Te({node:e,index:t,renderMode:b,fallback:()=>L(e,t)})).filter(Boolean),z.map((e,t)=>Te({node:e,index:t,renderMode:b,fallback:()=>W(e,t)})).filter(Boolean),X.map((e,t)=>B(e,t)).filter(Boolean)]})]}),
28
- /* @__PURE__ */cs(E,{width:o,height:n,totalWidth:s[0],totalHeight:s[1],margin:i,labels:X,sceneNodes:z,title:f,description:p,legend:_,legendPosition:x,legendLayout:w,legendHoverBehavior:S,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:N,foregroundGraphics:ze(d,nt(t?.customLayoutOverlays,R??null)),annotations:T,onAnnotationActivate:P,onObservation:I??M,chartId:O,chartType:"StreamNetworkFrame",autoPlaceAnnotations:Y,svgAnnotationRules:F,annotationFrame:0}),
29
- /* @__PURE__ */cs(D,{marks:t?.customLayoutHtmlMarks,margin:i,selection:R??null})]})}function Y({data:e}){if("edge"===e.nodeOrEdge){let t=e.data;return t?/* @__PURE__ */ys("div",{className:"semiotic-tooltip",style:or,children:[
28
+ /* @__PURE__ */cs(E,{width:o,height:n,totalWidth:s[0],totalHeight:s[1],margin:i,labels:X,sceneNodes:z,title:f,description:p,legend:_,legendPosition:x,legendLayout:w,legendHoverBehavior:S,legendClickBehavior:A,legendHighlightedCategory:C,legendIsolatedCategories:N,foregroundGraphics:ze(d,nt(t?.customLayoutOverlays,R??null)),annotations:T,onAnnotationActivate:P,onObservation:I??M,chartId:O,chartType:"StreamNetworkFrame",autoPlaceAnnotations:F,svgAnnotationRules:Y,annotationFrame:0}),
29
+ /* @__PURE__ */cs(D,{marks:t?.customLayoutHtmlMarks,margin:i,selection:R??null})]})}function F({data:e}){if("edge"===e.nodeOrEdge){let t=e.data;return t?/* @__PURE__ */ys("div",{className:"semiotic-tooltip",style:or,children:[
30
30
  /* @__PURE__ */ys("div",{style:{fontWeight:600},children:["object"==typeof t.source?t.source.id:t.source," → ","object"==typeof t.target?t.target.id:t.target]}),null!=t.value&&/* @__PURE__ */ys("div",{style:{marginTop:4,opacity:.8},children:["Value:"," ","number"==typeof t.value?t.value.toLocaleString():t.value+""]})]}):null}let t=e.data;if(!t)return null;let r=t.__hierarchyNode;if(r){let e=[],s=r;for(;s;){let r=s.data?.name??s.data?.id??t.id;null!=r&&e.unshift(r+""),s=s.parent}e.length>1&&e.shift();let i=e.length-1;/* @__PURE__ */
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 F(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,Y=M&&!B,F=!v&&r.tickAnimation([n,a],L),z=y.current,X=s?.beforeCompute(r.getLastUpdateResult(),O),H=M||z||F;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:F,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||!Y&&33>f-E.current?R.current=!!te:(T(e=>e+1),E.current=f,R.current=!1),(b||O||null!=r.transition||F||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 Ye,f as Fe,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 Yt,ea as Ft,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"],Yr=(e,t)=>({retainedData:e,invalidations:t}),Fr=["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:Yr("rebuild",Fr),nodeIDAccessor:Yr("rebuild",Fr),sourceAccessor:Yr("rebuild",Fr),targetAccessor:Yr("rebuild",Fr),valueAccessor:Yr("rebuild",Fr),edgeIdAccessor:Yr("rebuild",Fr),childrenAccessor:Yr("rebuild",Fr),hierarchySum:Yr("rebuild",Fr),orientation:Yr("preserve",zr),nodeAlign:Yr("preserve",zr),nodePaddingRatio:Yr("preserve",zr),nodeWidth:Yr("preserve",zr),edgeSort:Yr("preserve",zr),iterations:Yr("preserve",zr),forceStrength:Yr("preserve",zr),padAngle:Yr("preserve",zr),groupWidth:Yr("preserve",zr),sortGroups:Yr("preserve",zr),treeOrientation:Yr("preserve",zr),edgeType:Yr("preserve",zr),padding:Yr("preserve",zr),paddingTop:Yr("preserve",zr),orbitMode:Yr("preserve",zr),orbitSize:Yr("preserve",zr),orbitSpeed:Yr("preserve",zr),orbitRevolution:Yr("preserve",zr),orbitRevolutionStyle:Yr("preserve",zr),orbitEccentricity:Yr("preserve",zr),orbitShowRings:Yr("preserve",zr),orbitAnimated:Yr("preserve",zr),customNetworkLayout:Yr("preserve",zr),layoutConfig:Yr("preserve",zr),nodeSize:Yr("preserve",jr),nodeSizeRange:Yr("preserve",jr),colorByDepth:Yr("preserve",jr),nodeLabel:Yr("preserve",Hr),showLabels:Yr("preserve",Hr),labelMode:Yr("preserve",Hr),nodeStyle:Yr("preserve",Xr),edgeStyle:Yr("preserve",Xr),colorBy:Yr("preserve",Xr),colorScheme:Yr("preserve",Xr),themeCategorical:Yr("preserve",Xr),themeSemantic:Yr("preserve",Xr),edgeColorBy:Yr("preserve",Xr),edgeOpacity:Yr("preserve",Xr),showParticles:Yr("preserve",Xr),particleStyle:Yr("preserve",Xr),decay:Yr("preserve",Xr),pulse:Yr("preserve",Xr),thresholds:Yr("preserve",Xr),staleness:Yr("preserve",Xr),layoutSelection:Yr("preserve",Xr),clock:Yr("preserve",$r),random:Yr("preserve",$r),seed:Yr("preserve",$r),tensionConfig:Yr("preserve",$r),transition:Yr("preserve",$r),introAnimation:Yr("preserve",$r),onLayoutError:Yr("preserve",$r),__skipForceSimulation:Yr("preserve",$r),__hierarchyRoot:Yr("preserve",$r),__orbitState:Yr("preserve",$r),__previousPositions:Yr("preserve",$r)},Gr=Yr("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=Yt(e._prevX0,e._targetX0,r),e.x1=Yt(e._prevX1,e._targetX1,r),e.y0=Yt(e._prevY0,e._targetY0,r),e.y1=Yt(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=Yt(e._prevY0,e._targetY0,r),e.y1=Yt(e._prevY1,e._targetY1,r),e.sankeyWidth=Yt(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;Fe(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;Y.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:Ye,legendPosition:Fe,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:Yt,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:Ye,legendPosition:Fe,legendLayout:He,legendMarginReserved:e.__legendMarginReservedFor===Ye,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]),Yr=xr(()=>({...Rr,...L}),[L]),Fr=xr(()=>F({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:Yr,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:Yt,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,Yr,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,Yt,zt,Cr]),zr=tt(Fr),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:Yr.color,particleColorBy:Yr.colorBy,hasExplicitParticleColorBy:!!L?.colorBy,getEdgeColor:Es,getNodeColor:ms,resolveEndpoint:Rs,fallback:Ns}),[L?.colorBy,Yr.color,Yr.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]),Ys=wr(e=>{Bs(e)&&mr()},[Bs,mr]);_r(()=>Ar.subscribe(()=>{Ar.isActive||Ms()}),[Ms,Ar]);let Fs=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:Ys,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:Fs,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,Ys,Fs,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)&&Fs(),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,Fs,ws]);let Hs=vr.useRef(!1);_r(()=>{Hs.current||n&&n.length>0&&(Hs.current=!0,Ys(n))},[n,Ys]),_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 Ft(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(Ft(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(Ft(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:Yr,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)||Ft(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(Y,{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}),
@@ -41,6 +41,6 @@ return bs("div",{ref:ar,className:"stream-network-frame"+(le?" "+le:""),role:"gr
41
41
  /* @__PURE__ */bs("div",{role:"img","aria-label":wt||("string"==typeof Ze?Ze:"Network chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:oi,onMouseLeave:qs,onClick:ge||we?ei:void 0,children:[os&&!1!==_&&/* @__PURE__ */ks("div",{style:{position:"absolute",inset:0,zIndex:3,background:"var(--semiotic-bg, #fff)"},children:Mt(!0,lr[0],lr[1],_)}),
42
42
  /* @__PURE__ */ks(kt,{size:lr,margin:dr,backdropFill:Dr??void 0,overflowVisible:!0,children:ze(Tr,ai?.customLayoutBackgrounds)}),
43
43
  /* @__PURE__ */ks("canvas",{ref:As,"aria-label":er(ai?.sceneNodes?.length??0,ai?.sceneEdges?.length??0,"Network chart"),style:{position:"absolute",top:0,left:0}}),
44
- /* @__PURE__ */ks(E,{width:cr,height:ur,totalWidth:lr[0],totalHeight:lr[1],margin:dr,labels:ai?.labels||[],sceneNodes:ai?.sceneNodes,title:Ze,description:wt,legend:Ye,legendPosition:Fe,legendLayout:He,legendHoverBehavior:$e,legendClickBehavior:Ve,legendHighlightedCategory:Ge,legendIsolatedCategories:qe,foregroundGraphics:ze(Er,nt(Vr.current?.customLayoutOverlays,jt??null)),annotations:Te,onAnnotationActivate:Pe,onObservation:Se??we,chartId:Ae,chartType:"StreamNetworkFrame",autoPlaceAnnotations:Be,svgAnnotationRules:Oe,annotationFrame:ts}),
44
+ /* @__PURE__ */ks(E,{width:cr,height:ur,totalWidth:lr[0],totalHeight:lr[1],margin:dr,labels:ai?.labels||[],sceneNodes:ai?.sceneNodes,title:Ze,description:wt,legend:Fe,legendPosition:Ye,legendLayout:He,legendHoverBehavior:$e,legendClickBehavior:Ve,legendHighlightedCategory:Ge,legendIsolatedCategories:qe,foregroundGraphics:ze(Er,nt(Vr.current?.customLayoutOverlays,jt??null)),annotations:Te,onAnnotationActivate:Pe,onObservation:Se??we,chartId:Ae,chartType:"StreamNetworkFrame",autoPlaceAnnotations:Be,svgAnnotationRules:Oe,annotationFrame:ts}),
45
45
  /* @__PURE__ */ks(D,{marks:ai?.customLayoutHtmlMarks,margin:dr,selection:jt??null}),
46
46
  /* @__PURE__ */ks(ir,{active:ti.current>=0,hoverPoint:qr,margin:dr,size:lr,shape:ri.current?.shape,width:ri.current?.w,height:ri.current?.h}),ni,lt?.showBadge&&/* @__PURE__ */ks(Ke,{isStale:ss,position:lt.badgePosition,state:lt.state,settling:lt.settling})]})]})}));xs.displayName="StreamNetworkFrame";var ws=xs;export{s as a,ws as b};
@@ -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};