semiotic 3.13.1 → 3.13.2

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 (142) hide show
  1. package/README.md +20 -21
  2. package/ai/artifact-surface-inventory.json +1 -1
  3. package/ai/reference.md +1 -1
  4. package/ai/schema.json +1 -1
  5. package/ai/surface-manifest.json +1 -1
  6. package/ai/task-packets/compare-category-totals.json +5 -5
  7. package/ai/task-packets/compare-category-totals.md +2 -2
  8. package/ai/task-packets/correct-published-chart.json +5 -5
  9. package/ai/task-packets/correct-published-chart.md +2 -2
  10. package/ai/task-packets/index.json +6 -6
  11. package/ai/task-packets/update-live-chart.json +5 -5
  12. package/ai/task-packets/update-live-chart.md +2 -2
  13. package/dist/c-27SDQN3J.min.js +1 -0
  14. package/dist/{c-N2TVSOYL.min.js → c-4EUQNA7N.min.js} +2 -2
  15. package/dist/c-5EPR4KFB.min.js +1 -0
  16. package/dist/c-5HTUQRJT.min.js +1 -0
  17. package/dist/{c-XORVM6C5.min.js → c-5KZ3NO6X.min.js} +1 -1
  18. package/dist/c-5NAU4JAY.min.js +1 -0
  19. package/dist/c-73ORHEHO.min.js +1 -0
  20. package/dist/{c-ZWJDTDEV.min.js → c-AMQAAW7G.min.js} +1 -1
  21. package/dist/c-BQWX6NBX.min.js +1 -0
  22. package/dist/c-BR2TOCUN.min.js +1 -0
  23. package/dist/c-BRBTXINY.min.js +1 -0
  24. package/dist/c-C3Z7ZRAA.min.js +1 -0
  25. package/dist/c-C4WRRUZ5.min.js +1 -0
  26. package/dist/c-CXDAWBOW.min.js +1 -0
  27. package/dist/c-DHNROAXY.min.js +1 -0
  28. package/dist/{c-OSLNYZ3Q.min.js → c-DJ6DT5BL.min.js} +16 -16
  29. package/dist/c-DNBFFE3P.min.js +1 -0
  30. package/dist/{c-4P2EM44G.min.js → c-H5THWQI4.min.js} +3 -3
  31. package/dist/{c-XZJWL7UL.min.js → c-HOMJ3C6B.min.js} +1 -1
  32. package/dist/c-HR5AH3MA.min.js +1 -0
  33. package/dist/c-HTL37JCD.min.js +1 -0
  34. package/dist/{c-VZNIIKL6.min.js → c-JDI7HKEM.min.js} +1 -1
  35. package/dist/{c-RAIBDXDV.min.js → c-JDU4Y4IW.min.js} +1 -1
  36. package/dist/{c-ENRZPF5E.min.js → c-JS2D7A2P.min.js} +1 -1
  37. package/dist/c-L6OT4OVA.min.js +1 -0
  38. package/dist/c-LDGV6TDQ.min.js +1 -0
  39. package/dist/c-LW3GP7RY.min.js +1 -0
  40. package/dist/{c-I54V24WG.min.js → c-MSZ3ZDAP.min.js} +1 -1
  41. package/dist/{c-W5ATXREF.min.js → c-NB2UEX5C.min.js} +1 -1
  42. package/dist/{c-XOGN3524.min.js → c-NBBYSAQY.min.js} +2 -2
  43. package/dist/c-OMTJIC3P.min.js +1 -0
  44. package/dist/{c-HGWITEJI.min.js → c-OOR2LN4A.min.js} +1 -1
  45. package/dist/c-OU7A3IUL.min.js +1 -0
  46. package/dist/{c-2M2OPWVA.min.js → c-PNLTF6YG.min.js} +33 -33
  47. package/dist/c-QVKOXC3S.min.js +1 -0
  48. package/dist/{c-OIJL2WZH.min.js → c-TBMFC5CR.min.js} +1 -1
  49. package/dist/c-TFESQSWE.min.js +1 -0
  50. package/dist/c-TX53234M.min.js +1 -0
  51. package/dist/c-TZBEQ5UY.min.js +1 -0
  52. package/dist/c-UALVQIIJ.min.js +1 -0
  53. package/dist/{c-62JIVHK5.min.js → c-WFSEQ2XG.min.js} +1 -1
  54. package/dist/{c-4YPPVFZH.min.js → c-XF5ILLBG.min.js} +1 -1
  55. package/dist/c-YCBCZFOC.min.js +1 -0
  56. package/dist/c-YQHGEETR.min.js +2 -0
  57. package/dist/c-ZBSL4Y32.min.js +1 -0
  58. package/dist/c-ZMB3VTD4.min.js +1 -0
  59. package/dist/components/charts/shared/types.d.ts +1 -1
  60. package/dist/components/recipes/atlas/resolution/appearance.d.ts +1 -1
  61. package/dist/components/recipes/atlas/resolution/scene.d.ts +1 -1
  62. package/dist/components/semiotic-network-zoom.d.ts +1 -1
  63. package/dist/components/store/ThemeStore.d.ts +4 -1
  64. package/dist/components/store/themeCore.d.ts +2 -0
  65. package/dist/components/stream/mediaQuery.d.ts +2 -0
  66. package/dist/components/stream/networkEdgeHitIndex.d.ts +6 -2
  67. package/dist/components/stream/networkZoom/ZoomableNetworkCustomChart.d.ts +6 -4
  68. package/dist/components/stream/networkZoom/gestures.d.ts +5 -0
  69. package/dist/components/stream/networkZoom/types.d.ts +10 -0
  70. package/dist/components/stream/pipelineTransitionTypes.d.ts +3 -5
  71. package/dist/components/stream/pipelineTransitionUtils.d.ts +4 -0
  72. package/dist/components/stream/pipelineTransitions.d.ts +1 -13
  73. package/dist/components/stream/renderers/networkArcRenderer.d.ts +1 -3
  74. package/dist/components/stream/renderers/networkCircleRenderer.d.ts +1 -3
  75. package/dist/components/stream/renderers/networkPrimitiveRenderer.d.ts +5 -0
  76. package/dist/components/stream/renderers/networkRectRenderer.d.ts +1 -3
  77. package/dist/components/stream/renderers/renderPulse.d.ts +8 -14
  78. package/dist/components/stream/sceneToSVGShared.d.ts +9 -0
  79. package/dist/components/stream/shallowEqual.d.ts +2 -0
  80. package/dist/components/stream/useMediaPreferences.d.ts +1 -4
  81. package/dist/geo.min.js +152 -152
  82. package/dist/geo.module.min.js +1 -1
  83. package/dist/network.module.min.js +1 -1
  84. package/dist/ordinal.module.min.js +1 -1
  85. package/dist/physics.module.min.js +1 -1
  86. package/dist/semiotic-ai.module.min.js +2 -2
  87. package/dist/semiotic-atlas-selection.module.min.js +1 -1
  88. package/dist/semiotic-client-cjs-shared.min.js +1018 -1025
  89. package/dist/semiotic-client-shared.module.min.js +1 -1
  90. package/dist/semiotic-experimental-auxiliary.module.min.js +2 -2
  91. package/dist/semiotic-experimental-network-resolution-react.module.min.js +1 -1
  92. package/dist/semiotic-experimental-node-auxiliary.module.min.js +3 -3
  93. package/dist/semiotic-line.module.min.js +1 -1
  94. package/dist/semiotic-network-zoom.d.ts +1 -1
  95. package/dist/semiotic-network-zoom.min.js +7 -7
  96. package/dist/semiotic-network-zoom.module.min.js +1 -1
  97. package/dist/semiotic-realtime-core.module.min.js +1 -1
  98. package/dist/semiotic-server-edge-node.module.min.js +2 -2
  99. package/dist/semiotic-server-edge.min.js +394 -397
  100. package/dist/semiotic-server-edge.module.min.js +3 -3
  101. package/dist/semiotic-server-node.min.js +394 -397
  102. package/dist/semiotic-themes-core.min.js +2 -2
  103. package/dist/semiotic-themes-core.module.min.js +1 -1
  104. package/dist/semiotic-themes.min.js +2 -2
  105. package/dist/semiotic-themes.module.min.js +1 -1
  106. package/dist/semiotic-utils-core.min.js +11 -11
  107. package/dist/semiotic-utils-core.module.min.js +3 -3
  108. package/dist/semiotic-value.module.min.js +1 -1
  109. package/dist/semiotic.module.min.js +1 -1
  110. package/dist/server.min.js +394 -397
  111. package/dist/server.module.min.js +3 -3
  112. package/dist/xy.module.min.js +1 -1
  113. package/package.json +1 -1
  114. package/dist/c-3UXQGCQT.min.js +0 -1
  115. package/dist/c-4RVDKSMQ.min.js +0 -1
  116. package/dist/c-6WJKNYIG.min.js +0 -1
  117. package/dist/c-AQUX6L2O.min.js +0 -1
  118. package/dist/c-BR5QDUCR.min.js +0 -1
  119. package/dist/c-C3YQVUB6.min.js +0 -1
  120. package/dist/c-COP4OISO.min.js +0 -1
  121. package/dist/c-FAOZZE77.min.js +0 -1
  122. package/dist/c-HBLICBM6.min.js +0 -1
  123. package/dist/c-I4BEWAKT.min.js +0 -1
  124. package/dist/c-IDCFMBA4.min.js +0 -2
  125. package/dist/c-KLJDKRD5.min.js +0 -1
  126. package/dist/c-LEICSI5V.min.js +0 -1
  127. package/dist/c-MOK4RWNO.min.js +0 -1
  128. package/dist/c-NHZ2E3CI.min.js +0 -1
  129. package/dist/c-OWRVBUSL.min.js +0 -1
  130. package/dist/c-QIVKWHDL.min.js +0 -1
  131. package/dist/c-QUAEYF34.min.js +0 -1
  132. package/dist/c-RDFFLRKC.min.js +0 -1
  133. package/dist/c-RTU5425Z.min.js +0 -1
  134. package/dist/c-SU6Z75M2.min.js +0 -1
  135. package/dist/c-SWVXFUDL.min.js +0 -1
  136. package/dist/c-TC47SNSI.min.js +0 -1
  137. package/dist/c-VLWWXOM5.min.js +0 -1
  138. package/dist/c-VNFIRKU5.min.js +0 -1
  139. package/dist/c-WFX456JK.min.js +0 -5
  140. package/dist/c-WSWMQDFZ.min.js +0 -1
  141. package/dist/c-YGTMWEEF.min.js +0 -1
  142. package/dist/c-ZDCTFRA6.min.js +0 -1
@@ -1 +1 @@
1
- import{q as e}from"./c-OIJL2WZH.min.js";import{c as t,b as n}from"./c-6X7RO4GU.min.js";import{ak as r}from"./c-SU6Z75M2.min.js";import{useMemo as o,useRef as i,useState as s,useEffect as a}from"react";var u=/*#__PURE__*/new WeakMap;function l(e){let t=[];for(let n of Object.keys(e).sort()){let r=e[n];if(void 0!==r){if("function"==typeof r)return null;t.push(`${n}:${String(r)}`)}}return t.join("|")}function d(e,t,n){return null==n?null:u.get(e)?.get(t)?.get(n)??null}function p(e,t,n,r){if(null==n)return;let o=u.get(e);o||(o=new WeakMap,u.set(e,o));let i=o.get(t);if(i||(i=new Map,o.set(t,i)),!i.has(n)&&i.size>=16){let e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(n,r)}function c(u,c,f={}){let m=r(),{seed:g,iterations:h,repulsion:k,linkDistance:y,linkStrength:w,centerStrength:b,damping:j,nodeRadius:R,nodePadding:S,inset:v,execution:M,workerThreshold:x}=f,E=o(()=>({seed:g,iterations:h,repulsion:k,linkDistance:y,linkStrength:w,centerStrength:b,damping:j,nodeRadius:R,nodePadding:S,inset:v,execution:M,workerThreshold:x}),[g,h,k,y,w,b,j,R,S,v,M,x]),O=i(m),[T,W]=s(()=>{if(typeof window>"u"||m){let t=e(u,c,E);return p(u,c,l(E),t),{positions:t,status:"ready",error:null}}let t=d(u,c,l(E));return t?{positions:t,status:"ready",error:null}:{positions:null,status:"pending",error:null}});return a(()=>{if(O.current)return void(O.current=!1);let r=l(E),o=d(u,c,r);if(o)return void W(e=>"ready"===e.status&&e.positions===o?e:{positions:o,status:"ready",error:null});let i=new AbortController;return W(e=>({positions:e.positions,status:"pending",error:null})),async function(r,o,i={}){let{execution:s="auto",signal:a,workerThreshold:u,nodeRadius:l,...d}=i,p=d.iterations??260;if(!t()||!n(s,r.length,o.length,p,u))return e(r,o,{...d,nodeRadius:l});let c={kind:"normalized",nodes:r.map(e=>({...e})),edges:o.map(e=>({...e})),options:d,nodeRadii:"function"==typeof l?Object.fromEntries(r.map(e=>[e.id,l(e)])):null==l?void 0:Object.fromEntries(r.map(e=>[e.id,l]))};try{let{runForceLayoutWorker:e}=await(import("./c-G3SM44T7.min.js"));return(await e(c,a)).positions}catch(t){if("AbortError"===t?.name)throw t;return e(r,o,{...d,nodeRadius:l})}}(u,c,{...E,signal:i.signal}).then(e=>{p(u,c,r,e),W({positions:e,status:"ready",error:null})}).catch(e=>{"AbortError"!==e.name&&W(t=>({positions:t.positions,status:"error",error:e}))}),()=>i.abort()},[u,c,E]),T}export{c as a};
1
+ import{q as e}from"./c-TBMFC5CR.min.js";import{c as t,b as n}from"./c-6X7RO4GU.min.js";import{am as r}from"./c-L6OT4OVA.min.js";import{useMemo as o,useRef as i,useState as s,useEffect as a}from"react";var u=/*#__PURE__*/new WeakMap;function l(e){let t=[];for(let n of Object.keys(e).sort()){let r=e[n];if(void 0!==r){if("function"==typeof r)return null;t.push(`${n}:${String(r)}`)}}return t.join("|")}function d(e,t,n){return null==n?null:u.get(e)?.get(t)?.get(n)??null}function p(e,t,n,r){if(null==n)return;let o=u.get(e);o||(o=new WeakMap,u.set(e,o));let i=o.get(t);if(i||(i=new Map,o.set(t,i)),!i.has(n)&&i.size>=16){let e=i.keys().next().value;void 0!==e&&i.delete(e)}i.set(n,r)}function c(u,c,f={}){let m=r(),{seed:g,iterations:h,repulsion:k,linkDistance:y,linkStrength:w,centerStrength:R,damping:b,nodeRadius:j,nodePadding:v,inset:S,execution:M,workerThreshold:O}=f,T=o(()=>({seed:g,iterations:h,repulsion:k,linkDistance:y,linkStrength:w,centerStrength:R,damping:b,nodeRadius:j,nodePadding:v,inset:S,execution:M,workerThreshold:O}),[g,h,k,y,w,R,b,j,v,S,M,O]),x=i(m),[E,A]=s(()=>{if(typeof window>"u"||m){let t=e(u,c,T);return p(u,c,l(T),t),{positions:t,status:"ready",error:null}}let t=d(u,c,l(T));return t?{positions:t,status:"ready",error:null}:{positions:null,status:"pending",error:null}});return a(()=>{if(x.current)return void(x.current=!1);let r=l(T),o=d(u,c,r);if(o)return void A(e=>"ready"===e.status&&e.positions===o?e:{positions:o,status:"ready",error:null});let i=new AbortController;return A(e=>({positions:e.positions,status:"pending",error:null})),async function(r,o,i={}){let{execution:s="auto",signal:a,workerThreshold:u,nodeRadius:l,...d}=i,p=d.iterations??260;if(!t()||!n(s,r.length,o.length,p,u))return e(r,o,{...d,nodeRadius:l});let c={kind:"normalized",nodes:r.map(e=>({...e})),edges:o.map(e=>({...e})),options:d,nodeRadii:"function"==typeof l?Object.fromEntries(r.map(e=>[e.id,l(e)])):null==l?void 0:Object.fromEntries(r.map(e=>[e.id,l]))};try{let{runForceLayoutWorker:e}=await(import("./c-G3SM44T7.min.js"));return(await e(c,a)).positions}catch(t){if("AbortError"===t?.name)throw t;return e(r,o,{...d,nodeRadius:l})}}(u,c,{...T,signal:i.signal}).then(e=>{p(u,c,r,e),A({positions:e,status:"ready",error:null})}).catch(e=>{"AbortError"!==e.name&&A(t=>({positions:t.positions,status:"error",error:e}))}),()=>i.abort()},[u,c,T]),E}export{c as a};
@@ -0,0 +1 @@
1
+ function s(){t(e),t(j),t(a),t(p),t(m),t(o),t(i),t(r),t(A),t(c),t(f),t(n)}import{a,b as m,c as o,d as i,e as r,f as A,g as c,h as f}from"./c-JS2D7A2P.min.js";import{e as n}from"./c-5NAU4JAY.min.js";import{e as t,j as e,l as j,m as p}from"./c-AMQAAW7G.min.js";export{s as a};
@@ -0,0 +1 @@
1
+ function e(e,t="dark"===e.mode){let{colorBlindSafe:r,highContrast:n}=e.accessibility??{};return r||n?{...e,colors:{...e.colors,...r&&{categorical:W},...n&&{text:t?"#ffffff":"#000000",textSecondary:t?"#cccccc":"#333333",grid:t?"#666666":"#999999",border:t?"#888888":"#000000"}}}:e}function t(e){let t=e.replace(/^#/,"");/^[a-f\d]{3}$/i.test(t)&&(t=t.split("").map(e=>e+e).join(""));let r=t.match(/^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);if(!r)return null;let[n,o,i]=[parseInt(r[1],16)/255,parseInt(r[2],16)/255,parseInt(r[3],16)/255],s=e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4);return.2126*s(n)+.7152*s(o)+.0722*s(i)}function r(e,r){let n=t(e),o=t(r);return null===n||null===o?null:(Math.max(n,o)+.05)/(Math.min(n,o)+.05)}function n(e){return Array.isArray(e)?e.map(n):null!==e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,n(t)])):e}function o(e){if(!e?.colors)return;let t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function i(e,t){let r={...e,...t};for(let[n,o]of Object.entries(e))o&&"object"==typeof o&&!Array.isArray(o)&&(r[n]=i(o,t[n]??{}));return r}function s(t,o){return"light"===o?n(G):"dark"===o?n(K):"high-contrast"===o?n(Q):"string"==typeof o?(typeof console<"u"&&console.warn(`[ThemeStore] Unknown theme preset "${o}". Keeping current theme.`),t):n(function(t){return e(t,"dark"===t.mode||"auto"===t.mode&&(r(t.colors.background,"#ffffff")??1)>Math.sqrt(21))}(i(o.mode&&"auto"!==o.mode?"dark"===o.mode?K:G:t,o)))}function a(e){let t=null,r=()=>(t||(t=I(null)),t),n=l(e);return[function({children:t,initialState:n}){let o=L(n),i=P(()=>l(e,o.current),[]),s=r();return H(s.Provider,{value:i,children:t})},(e,t)=>{let o=r(),i=B(o)??n,s=L(e);s.current=e;let a=L({hasValue:!1,value:void 0}),l=D(()=>{let e=s.current(i.getState()),r=a.current;return r.hasValue&&t&&t(r.value,e)?r.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=D(()=>s.current(i.getState()),[i]);return q(i.subscribe,l,c)}]}function l(e,t){let r=new Set,n={...e(function(e){let t=e(n);if(c(t)){n={...n,...t};for(let e of r)e()}}),...t??{}};return{getState:()=>n,subscribe:function(e){return r.add(e),()=>{r.delete(e)}}}}function c(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function u(e){return typeof window>"u"?void 0:window.matchMedia?.(e)}function f(e,t){return"function"==typeof e?.addEventListener?(e.addEventListener("change",t),()=>e.removeEventListener("change",t)):(e?.addListener?.(t),()=>e?.removeListener?.(t))}function d(e){let[t,r]=$(()=>u(e)?.matches??!1);return V(()=>{let t=u(e);return r(t?.matches??!1),f(t,e=>r(e.matches))},[e]),t}function p(){return d("(prefers-reduced-motion: reduce)")}function m(){return d("(forced-colors: active)")}function g(e){return null!=e&&"boolean"!=typeof e&&("string"==typeof e?e.trim().length>0:Array.isArray(e)?e.some(g):!R.isValidElement(e)||e.type!==R.Fragment||g(e.props.children))}function y(){let e=globalThis;return e[Y]??(e[Y]=R.createContext(void 0))}function b(){return R.useContext(y())}function h(e){let t;for(let r of e.childNodes)if(1===r.nodeType){if(t)return!1;t=r}else if(3===r.nodeType&&r.textContent?.trim())return!1;let r=t?.getAttribute("data-semiotic-tooltip-chrome");return!t||null!=r&&"false"!==r}function v(e,t){let[r,n]=R.useState(!1);return(typeof window>"u"?R.useEffect:R.useLayoutEffect)(()=>{let o=t&&null!==e.current&&h(e.current);o!==r&&n(o)}),R.useEffect(()=>{let r=e.current;if(!t||!r)return;let o=new MutationObserver(()=>n(h(r)));return o.observe(r,{childList:!0,subtree:!0,characterData:!0,attributeFilter:["data-semiotic-tooltip-chrome"]}),()=>o.disconnect()},[t,e]),t&&r}function x(e){return e.ownsChrome=!0,e}function w(e){if("string"!=typeof e)return null!=e;let t=e.trim().toLowerCase();return!(!t||"transparent"===t||/^rgba\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(t)||/^hsla\([^)]*,\s*0(?:\.0+)?\s*\)$/.test(t))}function S(e){if("function"==typeof e)return!0===e.ownsChrome;if(!R.isValidElement(e))return!1;let t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;let r=e.props,n=r["data-semiotic-tooltip-chrome"];if(null!=n&&!1!==n&&"false"!==n)return!0;let o=r.style;return!(!o||"object"!=typeof o||!w(o.background)&&!w(o.backgroundColor))}function O(e,t,r){let n=0,o=e.length;for(;n<o;){let r=n+o>>>1;e[r]<t?n=r+1:o=r}return n<e.length&&e[n]<r}function j(e){let t=[];for(let[r,n]of Object.entries(e.fields))if("point"===n.type){let e;for(let t of n.values)t instanceof Date&&Number.isFinite(t.getTime())&&(e??(e=new Set),e.add(t.getTime()));let o=new Map,i=e=>{let t=o.get(e);if(!t){let r=[];for(let t of n.values){let n=e(t);Number.isFinite(n)&&r.push(n)}t=Float64Array.from(r).sort(),o.set(e,t)}return t};t.push((t,o)=>{if(o&&Object.prototype.hasOwnProperty.call(o.ranges,r)){let[e,t]=o.ranges[r];return O(i(o.toNumber??ee),e,t)}let s=t[r];return s instanceof Date?e?.has(s.getTime())??!1:n.values.has(s)})}else{let[e,o]=n.range;t.push(t=>{let n=t[r],i=n instanceof Date?n.getTime():n;return"number"==typeof i&&Number.isFinite(i)&&i>=e&&i<=o})}return(e,r)=>t.every(t=>t(e,r))}function k(e,t){let r=[];for(let[n,o]of e.clauses)"crossfilter"===e.resolution&&n===t||r.push(j(o));if(0===r.length)return()=>!0;let n="union"!==e.resolution?(e,t)=>r.every(r=>r(e,t)):(e,t)=>r.some(r=>r(e,t));return e=>{let t=T(e);return n(e,t)||(N(e)?.some(e=>n(e,t))??!1)}}function C(e,t){let r=e.get(t);return r||(r={name:t,resolution:"union",clauses:new Map},e.set(t,r)),r}function E(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(let r of e.values)if(!t.values.has(r))return!1;return!0}return!1}function M(){return oe(e=>e.theme)}function z(e,t){return A(e,t,2)}function A(e,t,r){if(Object.is(e,t))return!0;if(0===r)return!1;if(Array.isArray(e)&&Array.isArray(t))return function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Object.is(e[r],t[r]))return!1;return!0}(e,t);if(!F(e)||!F(t))return!1;let n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!A(e[o],t[o],r-1))return!1;return!0}function F(e){if(null===e||"object"!=typeof e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}import{h as T,b as N}from"./c-5PCO2P5Q.min.js";import*as R from"react";import{createContext as I,useRef as L,useMemo as P,useContext as B,useCallback as D,useSyncExternalStore as q,useState as $,useEffect as V}from"react";import{jsx as H}from"react/jsx-runtime";var W=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],G={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},K={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},Q={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:W,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"},[U,J]=/*#__PURE__*/a(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{let r=e.observations;return r.push(t),r.length>e.maxObservations&&r.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}})),X={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"},Y=/*#__PURE__*/Symbol.for("semiotic.tooltipChromeContext"),Z=/*#__PURE__*/x(function({chrome:e,children:t}){let r=y();return H(r.Provider,{value:e,children:t})}),_=/*#__PURE__*/x(function({chrome:e,className:t="",style:r,children:n,...o}){let i=b(),s="default"===(e??i??"default"),a=R.useRef(null);R.useImperativeHandle(o.ref,()=>a.current);let l=v(a,void 0===e&&s);return H("div",{...o,ref:a,"data-semiotic-tooltip-chrome":!0,className:l?t:`semiotic-tooltip ${t}`.trim(),style:s&&!l?{...X,...r}:r,children:n})}),ee=e=>e instanceof Date?e.getTime():"number"==typeof e?e:NaN,[te,re]=/*#__PURE__*/a(e=>({selections:new Map,setClause(t,r){e(e=>{let n=e.selections.get(t)?.clauses.get(r.clientId);if(n&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;let r=Object.entries(e.fields);if(r.length!==function(e){let t=0;for(let r in e)t++;return t}(t.fields))return!1;for(let[e,n]of r){let r=t.fields[e];if(!r||!E(n,r))return!1}return!0}(n,r))return{};let o=new Map(e.selections),i=C(o,t),s=new Map(i.clauses);return s.set(r.clientId,r),o.set(t,{...i,clauses:s}),{selections:o}})},clearClause(t,r){e(e=>{let n=e.selections.get(t);if(!n||!n.clauses.has(r))return{};let o=new Map(e.selections),i=new Map(n.clauses);return i.delete(r),o.set(t,{...n,clauses:i}),{selections:o}})},setResolution(t,r){e(e=>{if(e.selections.get(t)?.resolution===r)return{};let n=new Map(e.selections),o=C(n,t);return n.set(t,{...o,resolution:r}),{selections:n}})},clearSelection(t){e(e=>{let r=e.selections.get(t);if(!r||0===r.clauses.size)return{};let n=new Map(e.selections);return n.set(t,{...r,clauses:new Map}),{selections:n}})}})),[ne,oe]=/*#__PURE__*/a(e=>({theme:n(G),setTheme(t,r=!1){e(e=>{let o=r?n(t):s(e.theme,t);return e.equals?.(e.theme,o)?{}:{theme:o}})}}));export{_ as A,v as B,x as C,S as D,k as E,te as F,re as G,M as H,e as a,r as b,n as c,W as d,G as e,K as f,Q as g,o as h,i,s as j,a as k,c as l,ne as m,oe as n,U as o,J as p,z as q,A as r,u as s,f as t,p as u,m as v,g as w,X as x,b as y,Z as z};
@@ -1 +1 @@
1
- function t(t){let e=Number.isFinite(t)&&t>0?t:6;return{width:Math.max(8,e),height:e,lineY:e/2}}function e(t){return{type:"hatch",background:t.background,stroke:t.stroke,lineWidth:t.lineWidth,spacing:t.spacing,angle:t.angle,...1!==t.lineOpacity?{lineOpacity:t.lineOpacity}:{}}}function n(n={},r){let i,{background:a="transparent",stroke:l="#000",lineWidth:o=1.5,spacing:s=6,angle:u=45,lineOpacity:c=1}=n,f={background:a,stroke:l,lineWidth:o,spacing:s,angle:u,lineOpacity:c},d=t(s),p=function(){let t=typeof window<"u"&&window.devicePixelRatio||1;return Math.min(3,Math.max(1,t))}(),h=Math.max(1,Math.round(d.width*p)),m=Math.max(1,Math.round(d.height*p));try{y=h,g=m,i=typeof OffscreenCanvas<"u"?new OffscreenCanvas(y,g):(B||(B=document.createElement("canvas")),B.width=y,B.height=g,B)}catch{return e(f)}var y,g;let b=i.getContext("2d");if(!b)return e(f);!function(t,e,n,r){e&&"transparent"!==e&&"none"!==e?(t.fillStyle=e,t.fillRect(0,0,n,r)):t.clearRect(0,0,n,r)}(b,a,h,m);let v=m/d.height,k=Math.max(0,o)*v;b.save(),b.globalAlpha=Math.min(1,Math.max(0,c)),b.fillStyle=l,b.fillRect(0,d.lineY*v-k/2,h,k),b.restore();let w=(r||b).createPattern(i,"repeat");if(!w)return w;let M=u*Math.PI/180,x=Math.cos(M),O=Math.sin(M),S=d.width/h,W=d.height/m;return w.setTransform?.({a:x*S,b:O*S,c:-O*W,d:x*W,e:0,f:0}),w}function r(t,e=2166136261){let n=e;for(let e=0;e<t.length;e++)n^=t.charCodeAt(e),n=Math.imul(n,16777619);return n>>>0}function i(t){let e=typeof document>"u"?void 0:document.fonts;if(!e||"function"!=typeof e.addEventListener)return()=>{};let n=e=>{(function(t){return 0!==t.fontfaces?.length})(e)&&t()};return e.addEventListener("loadingdone",n),()=>e.removeEventListener("loadingdone",n)}function a(){if(G||typeof window>"u"||typeof document>"u")return;G=!0;let t=t=>{if(!t?.includes("--"))return"";let e=document.createElement("span").style;return e.cssText=t,Array.from(e).filter(t=>t.startsWith("--")).sort().map(t=>`${t}:${e.getPropertyValue(t)}!${e.getPropertyPriority(t)}`).join(";")},e=(e,n)=>{let r=e.target;if(!(r instanceof Element))return!1;if(r===n||r.contains(n))return!0;if(!n.contains(r))return!1;let i="CANVAS"===r.tagName;return!(!i&&!r.querySelector("canvas")||i&&"style"===e.attributeName&&t(e.oldValue)===t(r.getAttribute("style")))},n=t=>{let n=[];for(let r of J){let i=r.getElement();i&&(!t||t.some(t=>e(t,i)))&&n.push(r)}if(!t||0!==n.length){q++;for(let t of n)t.listener()}};if(typeof MutationObserver<"u"&&document.documentElement&&(U=new MutationObserver(t=>{n(t)})).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme","data-semiotic-theme-mode"],attributeOldValue:!0,subtree:!0}),"function"==typeof window.matchMedia)try{X=window.matchMedia("(prefers-color-scheme: dark)"),D=()=>n(),"function"==typeof X.addEventListener?X.addEventListener("change",D):"function"==typeof X.addListener&&X.addListener(D)}catch{}H=i(()=>n())}function l(t,e){a();let n={getElement:t,listener:e};return J.add(n),()=>{J.delete(n)&&0===J.size&&(U?.disconnect(),U=null,X&&D&&("function"==typeof X.removeEventListener?X.removeEventListener("change",D):"function"==typeof X.removeListener&&X.removeListener(D)),X=null,D=null,H?.(),H=null,G=!1)}}function o(t,e){if(!e)return e;let n=function(t){let e=t.trim();if(!e.startsWith("var(")||!e.endsWith(")"))return null;let n=e.slice(4,-1),r=n.indexOf(",");if(-1===r){let t=n.trim();return t.startsWith("--")?{name:t}:null}let i=n.slice(0,r).trim(),a=n.slice(r+1).trim();return i.startsWith("--")?{name:i,fallback:a||void 0}:null}(e);if(!n)return e;let r=()=>n.fallback?o(t,n.fallback):e,i=t.canvas;if(!i)return r();let a=T.get(i);(!a||a.version!==q)&&(a={version:q,map:new Map},T.set(i,a));let l=a.map.get(e);if(void 0!==l)return l;let s=getComputedStyle(i).getPropertyValue(n.name).trim()||r()||e;return a.map.set(e,s),s}function s(t){q++}function u(){return q}function c(t){return"object"==typeof t&&null!==t&&"hatch"===t.type}function f(t){return["hatch",t.background??"transparent",t.stroke??"#000",t.lineWidth??1.5,t.spacing??6,t.angle??45,t.lineOpacity??1].join("|")}function d(t,e){return`${t}-hatch-${r(f(e)).toString(36)}`}function p(e,n){let{background:r="transparent",stroke:i="#000",lineWidth:a=1.5,spacing:l=6,angle:o=45,lineOpacity:s=1}=e,u=t(l);return E("pattern",{id:n,width:u.width,height:u.height,patternUnits:"userSpaceOnUse",patternTransform:0!==o?`rotate(${o})`:void 0,children:[r&&"transparent"!==r&&"none"!==r&&C("rect",{width:u.width,height:u.height,fill:r}),C("line",{x1:0,y1:u.lineY,x2:u.width,y2:u.lineY,stroke:i,strokeWidth:a,...1!==s?{strokeOpacity:s}:{}})]},n)}function h(t,e,n="#4e79a7"){if(c(t)){let n=d(e,t);return{fill:`url(#${n})`,def:p(t,n)}}return t&&"string"==typeof t?{fill:t}:{fill:n}}function m(t,e,n){if(!t||"object"!=typeof t)return;let r=t;if(!Array.isArray(r.stops))return;let i=r.stops.flatMap(t=>{if(!t||"object"!=typeof t)return[];let{offset:e,color:r,opacity:i}=t;return"number"==typeof e&&Number.isFinite(e)?[{offset:Math.max(0,Math.min(1,e)),color:"string"==typeof r&&r?r:n,opacity:"number"==typeof i&&Number.isFinite(i)?Math.max(0,Math.min(1,i)):void 0}]:[]}).sort((t,e)=>t.offset-e.offset);return i.length?{direction:"horizontal"===r.direction?"horizontal":"vertical"===r.direction?"vertical":e,stops:i}:void 0}function y(t,e,n,r){let i=m(t,n,r);if(!i)return;let{direction:a,stops:l}=i,o=`${e}-gradient`;return{fill:`url(#${o})`,def:C("linearGradient",{id:o,x1:0,y1:0,x2:"horizontal"===a?"100%":0,y2:"vertical"===a?"100%":0,children:l.map((t,e)=>C("stop",{offset:100*t.offset+"%",stopColor:t.color,stopOpacity:t.opacity},`${t.offset}-${e}`))},o)}}function g(t,e){let n=t.fillStyle,r="#010203";try{t.fillStyle=r,t.fillStyle=e}catch{return t.fillStyle=n,[78,121,167]}let i=t.fillStyle;if(t.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===r&&e.trim().toLowerCase()!==r)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];let a=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return a?[+a[1],+a[2],+a[3]]:[78,121,167]}function b(t){switch(t){case"monotoneX":return I;case"monotoneY":return z;case"cardinal":return V;case"catmullRom":return Y;case"step":return F;case"stepBefore":return R;case"stepAfter":return P;case"basis":return N;case"natural":return j;default:return null}}function v(t){return"string"==typeof t&&"none"===t.trim().toLowerCase()}function k(t,e,r){return v(e)?Q:null==e?r:c(e)?function(t,e){let r=t.background??"transparent",i=t.stroke??"#000",a="transparent"===r||"none"===r?r:o(e,r)||r,l=o(e,i)||i||"#000",s=typeof window<"u"&&window.devicePixelRatio||1,u=`${f(t)}|${a}|${l}@${s}`,d=K.get(u);if(void 0!==d)return d;let p=n({background:a,stroke:l,lineWidth:t.lineWidth,spacing:t.spacing,angle:t.angle,lineOpacity:t.lineOpacity},e),h=c(p)?null:p;return K.set(u,h),h}(e,t)||e.background&&o(t,e.background)||r:"string"!=typeof e?e:o(t,e)||r}function w(t,e,n){let r=k(t,e,n);if("string"==typeof r&&r.trim().startsWith("var(")){let e=o(t,n);return e&&!e.trim().startsWith("var(")?e:n}return r}function M(t,e){if(null==e)return;let n=k(t,e,"");return""===n?void 0:n}function x(t,e,n,r,i,a,l){let o=e.stops.filter(t=>Number.isFinite(t.offset)&&(null==t.opacity||Number.isFinite(t.opacity)));if(o.length<2)return null;let s=t.createLinearGradient(r,i,a,l);for(let e of o)s.addColorStop(Math.max(0,Math.min(1,e.offset)),O(t,e,n));return s}function O(t,e,n){let r=e.color??n,i=o(t,r)||r;if(null==e.opacity)return i;let a=Math.max(0,Math.min(1,e.opacity)),[l,s,u]=g(t,i);return`rgba(${l},${s},${u},${a})`}function S(t,e=0){return!(e>0||0!==t.opacity&&(t.fill&&"transparent"!==t.fill||t.stroke&&"none"!==t.stroke&&"transparent"!==t.stroke))}function W(t,e,n,r){if(!e.fill||v(e.fill))return;let i=t.globalAlpha;t.fillStyle=k(t,e.fill,n),void 0!==e.fillOpacity&&(t.globalAlpha=(e.opacity??i)*e.fillOpacity),r(),t.globalAlpha=i}function $(t,e,n){if(!e.stroke||v(e.stroke))return;let r=t.globalAlpha;t.strokeStyle=o(t,e.stroke)||e.stroke,t.lineWidth=e.strokeWidth??1,t.globalAlpha=(e.opacity??r)*(e.strokeOpacity??1),n(),t.globalAlpha=r}function A(t){return(t.tl??0)>0||(t.tr??0)>0||(t.br??0)>0||(t.bl??0)>0}function L(t){let e=t.cornerRadii;if(!e)return{tl:0,tr:0,br:0,bl:0};let n=Math.min(t.w,t.h)/2,r=t=>Math.max(0,Math.min(t??0,n));return{tl:r(e.tl),tr:r(e.tr),br:r(e.br),bl:r(e.bl)}}import{jsxs as E,jsx as C}from"react/jsx-runtime";import{curveNatural as j,curveBasis as N,curveStepAfter as P,curveStepBefore as R,curveStep as F,curveCatmullRom as Y,curveCardinal as V,curveMonotoneY as z,curveMonotoneX as I}from"d3-shape";var B=null,T=/*#__PURE__*/new WeakMap,q=0,G=!1,U=null,X=null,D=null,H=null,J=/*#__PURE__*/new Set,K=/*#__PURE__*/new Map,Q="rgba(0,0,0,0)";export{i as a,l as b,o as c,s as d,u as e,g as f,r as g,n as h,c as i,d as j,p as k,h as l,m,y as n,b as o,v as p,k as q,w as r,M as s,x as t,S as u,W as v,$ as w,A as x,L as y};
1
+ function t(t){let e=Number.isFinite(t)&&t>0?t:6;return{width:Math.max(8,e),height:e,lineY:e/2}}function e(t){return{type:"hatch",background:t.background,stroke:t.stroke,lineWidth:t.lineWidth,spacing:t.spacing,angle:t.angle,...1!==t.lineOpacity?{lineOpacity:t.lineOpacity}:{}}}function n(n={},r){let i,{background:a="transparent",stroke:l="#000",lineWidth:o=1.5,spacing:s=6,angle:u=45,lineOpacity:c=1}=n,f={background:a,stroke:l,lineWidth:o,spacing:s,angle:u,lineOpacity:c},d=t(s),p=function(){let t=typeof window<"u"&&window.devicePixelRatio||1;return Math.min(3,Math.max(1,t))}(),h=Math.max(1,Math.round(d.width*p)),m=Math.max(1,Math.round(d.height*p));try{y=h,g=m,i=typeof OffscreenCanvas<"u"?new OffscreenCanvas(y,g):(B||(B=document.createElement("canvas")),B.width=y,B.height=g,B)}catch{return e(f)}var y,g;let b=i.getContext("2d");if(!b)return e(f);!function(t,e,n,r){e&&"transparent"!==e&&"none"!==e?(t.fillStyle=e,t.fillRect(0,0,n,r)):t.clearRect(0,0,n,r)}(b,a,h,m);let v=m/d.height,k=Math.max(0,o)*v;b.save(),b.globalAlpha=Math.min(1,Math.max(0,c)),b.fillStyle=l,b.fillRect(0,d.lineY*v-k/2,h,k),b.restore();let w=(r||b).createPattern(i,"repeat");if(!w)return w;let M=u*Math.PI/180,x=Math.cos(M),O=Math.sin(M),S=d.width/h,W=d.height/m;return w.setTransform?.({a:x*S,b:O*S,c:-O*W,d:x*W,e:0,f:0}),w}function r(t,e=2166136261){let n=e;for(let e=0;e<t.length;e++)n^=t.charCodeAt(e),n=Math.imul(n,16777619);return n>>>0}function i(t){let e=typeof document>"u"?void 0:document.fonts;if(!e||"function"!=typeof e.addEventListener)return()=>{};let n=e=>{(function(t){return 0!==t.fontfaces?.length})(e)&&t()};return e.addEventListener("loadingdone",n),()=>e.removeEventListener("loadingdone",n)}function a(){if(G||typeof window>"u"||typeof document>"u")return;G=!0;let t=t=>{if(!t?.includes("--"))return"";let e=document.createElement("span").style;return e.cssText=t,Array.from(e).filter(t=>t.startsWith("--")).sort().map(t=>`${t}:${e.getPropertyValue(t)}!${e.getPropertyPriority(t)}`).join(";")},e=(e,n)=>{let r=e.target;if(!(r instanceof Element))return!1;if(r===n||r.contains(n))return!0;if(!n.contains(r))return!1;let i="CANVAS"===r.tagName;return!(!i&&!r.querySelector("canvas")||i&&"style"===e.attributeName&&t(e.oldValue)===t(r.getAttribute("style")))},n=t=>{let n=[];for(let r of J){let i=r.getElement();i&&(!t||t.some(t=>e(t,i)))&&n.push(r)}if(!t||0!==n.length){q++;for(let t of n)t.listener()}};if(typeof MutationObserver<"u"&&document.documentElement&&(U=new MutationObserver(t=>{n(t)})).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme","data-semiotic-theme-mode"],attributeOldValue:!0,subtree:!0}),"function"==typeof window.matchMedia)try{X=window.matchMedia("(prefers-color-scheme: dark)"),D=()=>n(),"function"==typeof X.addEventListener?X.addEventListener("change",D):"function"==typeof X.addListener&&X.addListener(D)}catch{}H=i(()=>n())}function l(t,e){a();let n={getElement:t,listener:e};return J.add(n),()=>{J.delete(n)&&0===J.size&&(U?.disconnect(),U=null,X&&D&&("function"==typeof X.removeEventListener?X.removeEventListener("change",D):"function"==typeof X.removeListener&&X.removeListener(D)),X=null,D=null,H?.(),H=null,G=!1)}}function o(t,e){if(!e)return e;let n=function(t){let e=t.trim();if(!e.startsWith("var(")||!e.endsWith(")"))return null;let n=e.slice(4,-1),r=n.indexOf(",");if(-1===r){let t=n.trim();return t.startsWith("--")?{name:t}:null}let i=n.slice(0,r).trim(),a=n.slice(r+1).trim();return i.startsWith("--")?{name:i,fallback:a||void 0}:null}(e);if(!n)return e;let r=()=>n.fallback?o(t,n.fallback):e,i=t.canvas;if(!i)return r();let a=T.get(i);(!a||a.version!==q)&&(a={version:q,map:new Map},T.set(i,a));let l=a.map.get(e);if(void 0!==l)return l;let s=getComputedStyle(i).getPropertyValue(n.name).trim()||r()||e;return a.map.set(e,s),s}function s(t){q++}function u(){return q}function c(t){return"object"==typeof t&&null!==t&&"hatch"===t.type}function f(t){return["hatch",t.background??"transparent",t.stroke??"#000",t.lineWidth??1.5,t.spacing??6,t.angle??45,t.lineOpacity??1].join("|")}function d(t,e){return`${t}-hatch-${r(f(e)).toString(36)}`}function p(e,n){let{background:r="transparent",stroke:i="#000",lineWidth:a=1.5,spacing:l=6,angle:o=45,lineOpacity:s=1}=e,u=t(l);return E("pattern",{id:n,width:u.width,height:u.height,patternUnits:"userSpaceOnUse",patternTransform:0!==o?`rotate(${o})`:void 0,children:[r&&"transparent"!==r&&"none"!==r&&C("rect",{width:u.width,height:u.height,fill:r}),C("line",{x1:0,y1:u.lineY,x2:u.width,y2:u.lineY,stroke:i,strokeWidth:a,...1!==s?{strokeOpacity:s}:{}})]},n)}function h(t,e,n="#4e79a7"){if(c(t)){let n=d(e,t);return{fill:`url(#${n})`,def:p(t,n)}}return t&&"string"==typeof t?{fill:t}:{fill:n}}function m(t,e,n){if(!t||"object"!=typeof t)return;let r=t;if(!Array.isArray(r.stops))return;let i=r.stops.flatMap(t=>{if(!t||"object"!=typeof t)return[];let{offset:e,color:r,opacity:i}=t;return"number"==typeof e&&Number.isFinite(e)?[{offset:Math.max(0,Math.min(1,e)),color:"string"==typeof r&&r?r:n,opacity:"number"==typeof i&&Number.isFinite(i)?Math.max(0,Math.min(1,i)):void 0}]:[]}).sort((t,e)=>t.offset-e.offset);return i.length?{direction:"horizontal"===r.direction?"horizontal":"vertical"===r.direction?"vertical":e,stops:i}:void 0}function y(t,e,n,r){let i=m(t,n,r);if(!i)return;let{direction:a,stops:l}=i,o=`${e}-gradient`;return{fill:`url(#${o})`,def:C("linearGradient",{id:o,x1:0,y1:0,x2:"horizontal"===a?"100%":0,y2:"vertical"===a?"100%":0,children:l.map((t,e)=>C("stop",{offset:100*t.offset+"%",stopColor:t.color,stopOpacity:t.opacity},`${t.offset}-${e}`))},o)}}function g(t,e){let n=t.fillStyle,r="#010203";try{t.fillStyle=r,t.fillStyle=e}catch{return t.fillStyle=n,[78,121,167]}let i=t.fillStyle;if(t.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===r&&e.trim().toLowerCase()!==r)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];let a=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return a?[+a[1],+a[2],+a[3]]:[78,121,167]}function b(t){switch(t){case"monotoneX":return I;case"monotoneY":return z;case"cardinal":return V;case"catmullRom":return Y;case"step":return F;case"stepBefore":return R;case"stepAfter":return P;case"basis":return N;case"natural":return j;default:return null}}function v(t){return"string"==typeof t&&"none"===t.trim().toLowerCase()}function k(t,e,r){return v(e)?Q:null==e?r:c(e)?function(t,e){let r=t.background??"transparent",i=t.stroke??"#000",a="transparent"===r||"none"===r?r:o(e,r)||r,l=o(e,i)||i||"#000",s=typeof window<"u"&&window.devicePixelRatio||1,u=`${f(t)}|${a}|${l}@${s}`,d=K.get(u);if(void 0!==d)return d;let p=n({background:a,stroke:l,lineWidth:t.lineWidth,spacing:t.spacing,angle:t.angle,lineOpacity:t.lineOpacity},e),h=c(p)?null:p;return K.set(u,h),h}(e,t)||e.background&&o(t,e.background)||r:"string"!=typeof e?e:o(t,e)||r}function w(t,e,n){let r=k(t,e,n);if("string"==typeof r&&r.trim().startsWith("var(")){let e=o(t,n);return e&&!e.trim().startsWith("var(")?e:n}return r}function M(t,e){if(null==e)return;let n=k(t,e,"");return""===n?void 0:n}function x(t,e,n,r,i,a,l){let o=e.stops.filter(t=>Number.isFinite(t.offset)&&(null==t.opacity||Number.isFinite(t.opacity)));if(o.length<2)return null;let s=t.createLinearGradient(r,i,a,l);for(let e of o)s.addColorStop(Math.max(0,Math.min(1,e.offset)),O(t,e,n));return s}function O(t,e,n){let r=e.color??n,i=o(t,r)||r;if(null==e.opacity)return i;let a=Math.max(0,Math.min(1,e.opacity)),[l,s,u]=g(t,i);return`rgba(${l},${s},${u},${a})`}function S(t,e=0){return!(e>0||0!==t.opacity&&(t.fill&&"transparent"!==t.fill||t.stroke&&"none"!==t.stroke&&"transparent"!==t.stroke))}function W(t,e,n,r){if(!e.fill||v(e.fill))return;let i=t.globalAlpha;t.fillStyle=k(t,e.fill,n),t.globalAlpha=i*(e.opacity??1)*(e.fillOpacity??1),r(),t.globalAlpha=i}function $(t,e,n){if(!e.stroke||v(e.stroke))return;let r=t.globalAlpha;t.strokeStyle=o(t,e.stroke)||e.stroke,t.lineWidth=e.strokeWidth??1,t.globalAlpha=r*(e.opacity??1)*(e.strokeOpacity??1),n(),t.globalAlpha=r}function A(t){return(t.tl??0)>0||(t.tr??0)>0||(t.br??0)>0||(t.bl??0)>0}function L(t){let e=t.cornerRadii;if(!e)return{tl:0,tr:0,br:0,bl:0};let n=Math.min(t.w,t.h)/2,r=t=>Math.max(0,Math.min(t??0,n));return{tl:r(e.tl),tr:r(e.tr),br:r(e.br),bl:r(e.bl)}}import{jsxs as E,jsx as C}from"react/jsx-runtime";import{curveNatural as j,curveBasis as N,curveStepAfter as P,curveStepBefore as R,curveStep as F,curveCatmullRom as Y,curveCardinal as V,curveMonotoneY as z,curveMonotoneX as I}from"d3-shape";var B=null,T=/*#__PURE__*/new WeakMap,q=0,G=!1,U=null,X=null,D=null,H=null,J=/*#__PURE__*/new Set,K=/*#__PURE__*/new Map,Q="rgba(0,0,0,0)";export{i as a,l as b,o as c,s as d,u as e,g as f,r as g,n as h,c as i,d as j,p as k,h as l,m,y as n,b as o,v as p,k as q,w as r,M as s,x as t,S as u,W as v,$ as w,A as x,L as y};
@@ -1 +1 @@
1
- function t(t,e){var r=t.get(e);if(!r)throw new Error("missing: "+e);return r}function e(t){return t.y0-t.y1>0?"up":"down"}function r(t,e){return e(t.source)==e(t.target)}function a(t){return t.target.x0-t.source.x1}function i(t,r){var i=c(t),n=a(r)/Math.tan(i);return"up"==e(t)?t.y1-n:t.y1+n}function n(t,r){var i=c(t),n=a(r)/Math.tan(i);return"up"==e(t)?t.y1+n:t.y1-n}function c(t){var e=Math.abs(t.y1-t.y0),r=Math.abs(t.target.x0-t.source.x1);return Math.atan(r/e)}function l(t){return u(t.source)}function o(t){return u(t.target)}function u(t){return(t.y0+t.y1)/2}function s(t){return t.virtual?0:t.value}function f(t,e){var a=0;t.sourceLinks.forEach(function(t){a=t.circular&&!r(t,e)?a+1:a});var i=0;return t.targetLinks.forEach(function(t){i=t.circular&&!r(t,e)?i+1:i}),a+i}function h(t){return t.target.depth}function d(t,e){return t.sourceLinks.length?t.depth:e-1}function y(t,e){return t.y0-e.y0}function g(t,e){return e.y0-t.y0}function p(t,e){return t.y1-e.y1}function m(t,e){return e.y1-t.y1}function x(t,e){return L(t.source,e.source)||t.index-e.index}function k(t,e){return L(t.target,e.target)||t.index-e.index}function L(t,e){return t.partOfCycle===e.partOfCycle?t.y0-e.y0:"top"===t.circularLinkType||"bottom"===e.circularLinkType?-1:1}function v(t,e){return b(t)==b(e)?"bottom"==t.circularLinkType?g(t,e):y(t,e):b(e)-b(t)}function b(t){return t.target.column-t.source.column}function D(t,e){return P(t)==P(e)}function P(t){return t.y0-t.y1>0?"up":"down"}function E(t,e,a,i,n){let c=t;c.links.forEach(function(t){t.circular&&(t._circularWidth=t.width,t._circularStub=!1)});var l=yt(c.links,function(t){return t.source.y0});c.links.forEach(function(t){t.circular&&(t.circularPathData={})});var o=c.links.filter(function(t){return t.circular}),u=new Map,s=new Map;o.forEach(function(t){u.set(t.source,(u.get(t.source)||0)+1),s.set(t.target,(s.get(t.target)||0)+1)});var f=new Set(o.filter(function(t){return r(t,e)&&1===u.get(t.source)&&1===s.get(t.target)}));return["top","bottom"].forEach(function(t){var e=o.filter(function(e){return e.circularLinkType===t});(function(t,e,r){if(0!==t.length){t.sort(v);var a=Array.from(new Set(t.flatMap(function(t){return[t.source.column,t.target.column]}))).sort(function(t,e){return t-e}),i=new Map(a.map(function(t,e){return[t,e]})),n=new zt(a.length);t.forEach(function(t){var a=i.get(t.source.column),c=i.get(t.target.column),l=Math.min(a,c),o=Math.max(a,c),u=e.has(t)?0:n.query(l,o);t.circularPathData.verticalBuffer=u+t._circularWidth/2,n.reserve(l,o,u+t._circularWidth+r)})}})(e.slice(),f,a),["source","target"].forEach(function(r){var n=new Map;e.forEach(function(t){var e=t[r].column;n.has(e)||n.set(e,[]),n.get(e).push(t)}),n.forEach(function(e){e.sort("source"===r?"bottom"===t?g:y:"bottom"===t?m:p);var n=0,c="source"===r?"right":"left";e.forEach(function(t,e){t.circularPathData[c+"SmallArcRadius"]=i+t._circularWidth/2+n,t.circularPathData[c+"LargeArcRadius"]=i+t._circularWidth/2+e*a+n,n+=t._circularWidth})})})}),c.links.forEach(function(t){t.circular&&(t.circularPathData.arcRadius=t._circularWidth+i,t.circularPathData.rightNodeBuffer=5,t.circularPathData.leftNodeBuffer=5,t.circularPathData.sourceWidth=t.source.x1-t.source.x0,t.circularPathData.sourceX=t.source.x0+t.circularPathData.sourceWidth,t.circularPathData.targetX=t.target.x0,t.circularPathData.sourceY=t.y0,t.circularPathData.targetY=t.y1,f.has(t)?(t.circularPathData.rightSmallArcRadius=i+t._circularWidth/2,t.circularPathData.rightLargeArcRadius=i+t._circularWidth/2,t.circularPathData.leftSmallArcRadius=i+t._circularWidth/2,t.circularPathData.leftLargeArcRadius=i+t._circularWidth/2,"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=t.source.y1+n+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=t.source.y0-n-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius)):"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=Math.max(c.y1,t.source.y1,t.target.y1)+n+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=l-n-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius),t.circularPathData.rightInnerExtent=t.circularPathData.sourceX+t.circularPathData.rightNodeBuffer,t.circularPathData.leftInnerExtent=t.circularPathData.targetX-t.circularPathData.leftNodeBuffer,t.circularPathData.rightFullExtent=t.circularPathData.sourceX+t.circularPathData.rightLargeArcRadius+t.circularPathData.rightNodeBuffer,t.circularPathData.leftFullExtent=t.circularPathData.targetX-t.circularPathData.leftLargeArcRadius-t.circularPathData.leftNodeBuffer),t.circular?t.path=function(t){return"top"==t.circularLinkType?"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 0 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY-t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 0 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 0 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY-t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 0 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY:"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 1 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY+t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 1 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 1 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY+t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 1 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY}(t):t.path=function(t){var e=t.source.x1,r=t.y0,a=t.target.x0,i=t.y1,n=(e+a)/2;return"M"+e+","+r+"C"+n+","+r+" "+n+","+i+" "+a+","+i}(t)}),c}function M(t){return function(){return t}}function S(t){return t.index}function w(t){return t.nodes}function A(t){return t.links}function $(t,e,r){var a=mt(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});a.forEach(function(i,n){var c=i.length;if(e)i.sort(e);else if(n>0){var l=new Map;i.forEach(function(t,e){var r,a,i,n=(a=0,i=0,(r=t).targetLinks.forEach(function(t){if(!t.circular){var e=t.value||1;i+=u(t.source)*e,a+=e}}),r.sourceLinks.forEach(function(t){if(!t.circular){var e=t.value||1;i+=u(t.target)*e,a+=e}}),a>0?i/a:NaN);l.set(t,{bc:n,idx:e})}),i.sort(function(t,e){var r=l.get(t),a=l.get(e),i=r.bc,n=a.bc;if(t.circularLinkType!==e.circularLinkType){if("top"==t.circularLinkType&&"bottom"==e.circularLinkType)return-1;if("bottom"==t.circularLinkType&&"top"==e.circularLinkType)return 1;if("top"==t.circularLinkType)return-1;if("top"==e.circularLinkType||"bottom"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return-1}return isNaN(i)||isNaN(n)?isNaN(i)?isNaN(n)?r.idx-a.idx:1:-1:i-n})}else i.sort(function(t,e){return t.circularLinkType==e.circularLinkType?f(e,r)-f(t,r):"top"==t.circularLinkType&&"bottom"==e.circularLinkType||"top"==t.circularLinkType&&0==e.partOfCycle||0==t.partOfCycle&&"bottom"==e.circularLinkType?-1:0});i.forEach(function(e,i){e.depth==a.length-1&&1==c||0==e.depth&&1==c?(e.y0=t.y1/2-e.value*t.ky,e.y1=e.y0+e.value*t.ky):e.partOfCycle?0==f(e,r)?(e.y0=t.y1/2+i,e.y1=e.y0+e.value*t.ky):"top"==e.circularLinkType?(e.y0=t.y0+i,e.y1=e.y0+e.value*t.ky):(e.y0=t.y1-e.value*t.ky-i,e.y1=e.y0+e.value*t.ky):0==t.y0||0==t.y1?(e.y0=(t.y1-t.y0)/c*i,e.y1=e.y0+e.value*t.ky):(e.y0=(t.y1-t.y0)/2-c/2+i,e.y1=e.y0+e.value*t.ky)})})}function T(t,e,r,a,i,n){function c(e,r){var a=h.length;h.forEach(function(i){var n=i.length,c=i[0].depth;i.forEach(function(i){var s;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&f(i,r)>0){var h=kt(i.sourceLinks,o),d=kt(i.targetLinks,l),y=h&&d?(h+d)/2:h||d;if(y){var g=(y-u(i))*e*.3;i.y0+=g,i.y1+=g}}else if(0==c&&1==n)s=i.y1-i.y0,i.y0=t.y1/2-s/2,i.y1=t.y1/2+s/2;else if(c==a-1&&1==n)s=i.y1-i.y0,i.y0=t.y1/2-s/2,i.y1=t.y1/2+s/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)s=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+s;else{var p=kt(i.sourceLinks,o),m=kt(i.targetLinks,l),x=((p&&m?(p+m)/2:p||m)-u(i))*e;i.y0+=x,i.y1+=x}})})}function s(){h.forEach(function(r){var n,c,l,o=t.y0,u=r.length;for(e?r.sort(e):r.sort(L),l=0;l<u;++l)(c=o-(n=r[l]).y0)>0&&(n.y0+=c,n.y1+=c),o=n.y1+a;if((c=o-a-t.y1)>0)for(o=n.y0-=c,n.y1-=c,l=u-2;l>=0;--l)(c=(n=r[l]).y1+i-o)>0&&(n.y0-=c,n.y1-=c),o=n.y0})}var h=mt(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});s();for(var d=1,y=n;y>0;--y)c(d*=.99,r),s()}function R(t){t.nodes.forEach(function(t){t.sourceLinks.sort(k),t.targetLinks.sort(x)}),t.nodes.forEach(function(t){var e=t.y0,r=e,a=t.y1,i=a;t.sourceLinks.forEach(function(t){t.circular?(t.y0=a-t.width/2,a-=t.width):(t.y0=e+t.width/2,e+=t.width)}),t.targetLinks.forEach(function(t){t.circular?(t.y1=i-t.width/2,i-=t.width):(t.y1=r+t.width/2,r+=t.width)})})}function _(t){let{sx:e,sTop:r,sBot:a,tx:i,tTop:n,tBot:c,cp1X:l,cp2X:o}=t,u=(r+a)/2,s=(n+c)/2;return{pathD:[`M${e},${r}`,`C${l},${r} ${o},${n} ${i},${n}`,`L${i},${c}`,`C${o},${c} ${l},${a} ${e},${a}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:e,y:u},{x:l,y:u},{x:o,y:s},{x:i,y:s}],halfWidth:(a-r)/2}}}function I(t){let e=t.circularPathData;if(!e)return null;let r=t.sankeyWidth/2,a="bottom"===t.circularLinkType?1:-1,i=1===a?1:0,n="down"===t.direction,c=(t,e)=>n?`${e},${t}`:`${t},${e}`,l=(t,e,r,a,i)=>`A${n?e:t},${n?t:e} 0 0 ${n?1-r:r} ${c(a,i)}`,{sourceX:o,sourceY:u,targetX:s,targetY:f,rightInnerExtent:h,leftInnerExtent:d,rightFullExtent:y,leftFullExtent:g,verticalFullExtent:p,verticalRightInnerExtent:m,verticalLeftInnerExtent:x,rightLargeArcRadius:k,rightSmallArcRadius:L,leftLargeArcRadius:v,leftSmallArcRadius:b}=e;return`M${c(o,u-a*r)}L${c(h,u-a*r)}`+l(k+r,L+r,i,y+r,u+a*L)+`L${c(y+r,m)}`+l(k+r,k+r,i,h,p+a*r)+`L${c(d,p+a*r)}`+l(v+r,v+r,i,g-r,x)+`L${c(g-r,f+a*b)}`+l(v+r,b+r,i,d,f-a*r)+`L${c(s,f-a*r)}L${c(s,f+a*r)}L${c(d,f+a*r)}`+l(v-r,b-r,1-i,g+r,f+a*b)+`L${c(g+r,x)}`+l(v-r,v-r,1-i,d,p-a*r)+`L${c(h,p-a*r)}`+l(k-r,k-r,1-i,y-r,m)+`L${c(y-r,u+a*L)}`+l(k-r,L-r,1-i,h,u+a*r)+`L${c(o,u+a*r)}Z`}function W(t,e){if("production"===process.env.NODE_ENV||!t||!t.data||"object"!=typeof t.data)return t;let r=Bt.get(t);if(r){let t=r.get(e);if(t)return t}else r=new Map,Bt.set(t,r);let a=new Proxy(t,{get(t,r,a){if("string"==typeof r&&!(r in t)&&t.data&&r in t.data){let t=`${e}:${r}`;jt.has(t)||(jt.add(t),console.warn(`[Semiotic] "${e}" callback accessed "${r}" on the wrapper object, but it only exists on ".data". Use d.data.${r} (or d.data?.${r}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(t,r,a)}});return r.set(e,a),a}function F(t,e,r){let a=[];for(let i of e){let e=ut(i.source),n=ut(i.target),c=null;if(e===t?c=n:n===t&&(c=e),c){let t=r.get(c);t&&(0!==t.x||0!==t.y)&&a.push({x:t.x,y:t.y})}}return a}function N(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r)|0;return Math.abs(e)}function C(t,e,r){let a=t.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!a)return t;let i=[],n=0;for(;n<a.length;){let t=a[n];if("M"===t||"L"===t||"C"===t||"Q"===t)for(i.push(t),n++;n<a.length&&!isNaN(Number(a[n]));)i.push(String(Number(a[n])+e)),n++,n<a.length&&!isNaN(Number(a[n]))&&(i.push(String(Number(a[n])+r)),n++);else if("A"===t)for(i.push(t),n++;n<a.length&&!isNaN(Number(a[n]));)i.push(a[n++]),n<a.length&&i.push(a[n++]),n<a.length&&i.push(a[n++]),n<a.length&&i.push(a[n++]),n<a.length&&i.push(a[n++]),n<a.length&&(i.push(String(Number(a[n])+e)),n++),n<a.length&&(i.push(String(Number(a[n])+r)),n++);else"Z"===t||"z"===t?(i.push(t),n++):(i.push(a[n]),n++)}return i.join(" ")}function z(t){let[e,r,a]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[0,2,4].map(t=>parseInt(e.slice(t,t+2),16))}let e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(t);return.299*e+.587*r+.114*a>150?"#222":"#fff"}function O(t){if(t)return"function"==typeof t?t:e=>e[t]}function j(t){if(!t)return null;if("function"==typeof t){let e=t;return t=>e(t.data??t)}return e=>e.data?.[t]||e[t]||e.id}function B(t){let e=new Map(t.map(t=>[t,0]));return t.map(t=>{let r=e.get(t),a=t;for(;r>0&&e.has(a);)a=`${t}__${r++}`;return e.set(t,r||1),e.set(a,1),a})}function X(t,e,r){if(e.colorByDepth&&void 0!==t.depth){let r=function(t){return Array.isArray(t.colorScheme)?t.colorScheme:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical:Gt}(e);return r[t.depth%r.length]}return r||function(t){return Array.isArray(t.colorScheme)&&t.colorScheme.length>0?t.colorScheme[0]:t.themeSemantic?.primary?t.themeSemantic.primary:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical[0]:"#4d430c"}(e)}function Y(t,e,r){return{fill:X(t,e,r.fill),stroke:r.stroke||e.themeSemantic?.surface||"#fff",strokeWidth:r.strokeWidth??1,opacity:r.opacity,cursor:r.cursor}}function q(t){return!t.__hierarchyNode?.children?.length}function K(t,e,r,a,i){let n=(t+r)/2,c=(e+a)/2;return"horizontal"===i?`M ${t},${e} C ${n},${e} ${n},${a} ${r},${a}`:"radial"===i?`M ${t},${e} Q ${n},${e} ${n},${c} T ${r},${a}`:`M ${t},${e} C ${t},${c} ${r},${c} ${r},${a}`}function Z(t,e,r){let a=r.treeOrientation||"vertical";if("radial"===a){let r=e.x,a=e.y;t.x=a*Math.cos(r-Math.PI/2),t.y=a*Math.sin(r-Math.PI/2)}else"horizontal"===a?(t.x=e.y,t.y=e.x):(t.x=e.x,t.y=e.y);Q(t,5)}function G(t,e){t.x0=e.x0,t.y0=e.y0,t.x1=t.value?e.x1:e.x0,t.y1=t.value?e.y1:e.y0,t.x=(t.x0+t.x1)/2,t.y=(t.y0+t.y1)/2,t.width=t.x1-t.x0,t.height=t.y1-t.y0}function V(t,e){let r=e.r??0;t.x=e.x,t.y=e.y,Q(t,r),t.__radius=r}function Q(t,e){t.x0=t.x-e,t.x1=t.x+e,t.y0=t.y-e,t.y1=t.y+e,t.width=2*e,t.height=2*e}function H(t){return t.data&&"object"==typeof t.data?t.data:t}function J(t,e,r){if(e)return r?.selectedStyle&&Object.assign(t,r.selectedStyle),t;let a=r?.unselectedOpacity??ft;return t.opacity=a,t.fillOpacity=a,t.strokeOpacity=a,r?.unselectedStyle&&Object.assign(t,r.unselectedStyle),t}function U(t,e,r){if(t)return e?a=>{let i={...t(a)};return e.isActive?J(i,e.predicate(H(a)),r):i}:t}function tt(t,e,r){if(t)return e?a=>{let i={...t(a)};if(!e.isActive)return i;let n=H(a),c="object"==typeof a.source?H(a.source):null,l="object"==typeof a.target?H(a.target):null;return J(i,c||l?!!c&&e.predicate(c)||!!l&&e.predicate(l):e.predicate(n),r)}:t}function et(t,e){if(!t)return[];let r=[],a=t=>{r.push(t);let i="function"==typeof e?e(t):t[e];i&&Array.isArray(i)&&i.forEach(a)};return a(t),r}function rt(t,e,r,a){if(t&&t.length>0)return t;let i=new Set;return e.forEach(t=>{let e="function"==typeof r?r(t):t[r],n="function"==typeof a?a(t):t[a];i.add(e),i.add(n)}),Array.from(i).map(t=>({id:t}))}function at({edgeColorBy:t,colorBy:e,colorScale:r,nodeStyleFn:a,edgeOpacity:i,baseStyle:n={}}){return c=>{let l={fillOpacity:i,...n};if("function"==typeof t)l.fill=t(c);else if("source"===t){let t="object"==typeof c.source?c.source:null;e&&t?l.fill=dt(t.data||t,e,r):t&&(l.fill=a(t,t.index).fill)}else if("target"===t){let t="object"==typeof c.target?c.target:null;e&&t?l.fill=dt(t.data||t,e,r):t&&(l.fill=a(t,t.index).fill)}else"gradient"===t&&(l.fill="#999",l.fillOpacity=.7*i);return l}}function it(t){return nt(t,"orbit",()=>({metaMap:new Map,startTime:typeof performance<"u"?performance.now():Date.now()}))}import{a as nt}from"./c-DEWMXCOF.min.js";import{a as ct,b as lt}from"./c-LHVHGQRW.min.js";import{e as ot,f as ut}from"./c-YLZIV3VS.min.js";import{a as st,e as ft}from"./c-KLJDKRD5.min.js";import{a as ht,r as dt}from"./c-WPL6PGP3.min.js";import{min as yt,group as gt,sum as pt,groups as mt,max as xt,mean as kt}from"d3-array";import{interpolateNumber as Lt}from"d3-interpolate";import{forceLink as vt,forceSimulation as bt,forceManyBody as Dt,forceCollide as Pt,forceCenter as Et,forceX as Mt,forceY as St}from"d3-force";import{ribbon as wt,chord as At}from"d3-chord";import{arc as $t,pie as Tt}from"d3-shape";import{hierarchy as Rt,cluster as _t,tree as It,treemap as Wt,treemapBinary as Ft,partition as Nt,pack as Ct}from"d3-hierarchy";var zt=class{constructor(t){this.size=t,this.maximum=new Float64Array(4*t),this.floor=new Float64Array(4*t)}query(t,e){let r=(a,i,n)=>{if(t<=i&&n<=e)return this.maximum[a];let c=i+n>>>1;return Math.max(this.floor[a],t<=c?r(2*a,i,c):0,e>c?r(2*a+1,c+1,n):0)};return r(1,0,this.size-1)}reserve(t,e,r){let a=(i,n,c)=>{if(this.maximum[i]=Math.max(this.maximum[i],r),t<=n&&c<=e)return void(this.floor[i]=Math.max(this.floor[i],r));let l=n+c>>>1;t<=l&&a(2*i,n,l),e>l&&a(2*i+1,l+1,c)};a(1,0,this.size-1)}},Ot=t=>{let{source:e,target:r}=t;if("string"==typeof e||"string"==typeof r)return null;if("down"===t.direction){let a=t.y0-t.sankeyWidth/2,i=t.y1-t.sankeyWidth/2,n=t.y1+t.sankeyWidth/2,c=t.y0+t.sankeyWidth/2,l=e.x1,o=r.x0,u=Lt(l,o),s=u(.5),f=u(.5);return`M${a},${l}C${a},${s} ${i},${f} ${i},${o}L${n},${o}C${n},${f} ${c},${s} ${c},${l}Z`}let a=t.sankeyWidth/2,i=Lt(e.x1,r.x0),{pathD:n}=_({sx:e.x1,sTop:t.y0-a,sBot:t.y0+a,tx:r.x0,tTop:t.y1-a,tBot:t.y1+a,cp1X:i(.5),cp2X:i(.5)});return n},jt=/*#__PURE__*/new Set,Bt=/*#__PURE__*/new WeakMap,Xt={left:function(t){return t.depth},right:function(t,e){return e-1-t.height},center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?Math.min.apply(Math,t.sourceLinks.map(h))-1:0},justify:d},Yt={supportsStreaming:!0,hierarchical:!1,computeLayout(e,a,c,l){let o="vertical"===c.orientation?"down":"right",u=c.nodeAlign||"justify",f=c.nodeWidth??15,h=c.nodePaddingRatio??.05,y=c.iterations??300;for(let t of a)t.sankeyWidth=0,t.circular=!1,delete t.circularPathData,delete t._circularWidth,delete t._circularStub;for(let t of e)t.value=0,t.width=t.height=0,t.x0=t.x1=t.y0=t.y1=0,t.sourceLinks=[],t.targetLinks=[];let g=new Set(e.map(t=>t.id)),p=new Set,m=a.filter(t=>{let e=ut(t.source),r=ut(t.target);return!(!Number.isFinite(t.value)||t.value<=0||!g.has(e)||!g.has(r)||(p.add(e),p.add(r),0))}).map(t=>({...t,source:ut(t.source),target:ut(t.target)}));if(0===m.length)return;let x,k=e.filter(t=>p.has(t.id)).map(t=>({...t}));x="down"===o?[[0,0],[l[1],l[0]]]:[[0,0],[l[0],l[1]]];let L=function(){function e(){var e={nodes:k.apply(null,arguments),links:L.apply(null,arguments)};return function(e){e.x0=a,e.y0=c,e.x1=l,e.y1=o,e.py=0,function(e,r){e.nodes.forEach(function(t,e){t.index=e,t.sourceLinks=[],t.targetLinks=[]});var a=function(t,e){var r=new Map;return gt(t,e).forEach(function(t,e){r.set(e,t[0])}),r}(e.nodes,r);e.links.forEach(function(e,r){e.index=r;var i=e.source,n=e.target;"object"!=typeof i&&(i=e.source=t(a,i)),"object"!=typeof n&&(n=e.target=t(a,n)),i.sourceLinks.push(e),n.targetLinks.push(e)})}(e,y),function(t,e,r){var a=0,i=null==e?function(t,e,r){let a=t.length,i=Array.from({length:a},()=>[]),n=Array.from({length:a},()=>[]),c=new Int32Array(a),l=new Int32Array(a),o=new Float64Array(a),u=new Float64Array(e.length),s=new Int32Array(a),f=t.map(t=>{let e=r(t);return`${typeof e}:${String(e)}`}),h=0;for(let t of e)t.source.index!==t.target.index&&Number.isFinite(t.value)&&(h=Math.max(h,t.value));let d=(t,e)=>f[t]<f[e]?-1:f[t]>f[e]?1:0;e.map((t,e)=>e).sort((t,r)=>d(e[t].source.index,e[r].source.index)||d(e[t].target.index,e[r].target.index)||e[t].value-e[r].value).forEach(t=>{let r=e[t],a=r.source.index,s=r.target.index;if(a===s)return;let f=Number.isFinite(r.value)&&h>0?Math.max(0,r.value)/h:0;u[t]=f,n[a].push(t),i[s].push(t),l[a]++,c[s]++,o[a]+=f,o[s]-=f});let y=t.map(t=>t.index),g=Int32Array.from(y),p=t=>0===l[t]?2:0===c[t]?1:0,m=(t,e)=>{let r=p(t),a=p(e);return r!==a?r>a:0===r&&o[t]!==o[e]?o[t]>o[e]:f[t]<f[e]||f[t]===f[e]&&t<e},x=(t,e)=>{let r=y[t];y[t]=y[e],y[e]=r,g[y[t]]=t,g[r]=e},k=(t,e=!1)=>{let r=g[t];for(;!e&&r>0;){let e=r-1>>>1;if(!m(t,y[e]))break;x(r,e),r=e}for(;2*r+1<y.length;){let e=2*r+1;if(e+1<y.length&&m(y[e+1],y[e])&&e++,!m(y[e],t))break;x(r,e),r=e}};for(let t=(y.length>>>1)-1;t>=0;t--)k(y[t],!0);let L=0,v=a-1;for(;y.length;){let t=y[0];s[t]=0===l[t]?v--:L++;let r=y.pop();g[t]=-1,y.length&&(y[0]=r,g[r]=0,k(r));for(let r of n[t]){let t=e[r].target.index;g[t]<0||(c[t]--,o[t]+=u[r],k(t))}for(let r of i[t]){let t=e[r].source.index;g[t]<0||(l[t]--,o[t]-=u[r],k(t))}}return s}(t.nodes,t.links,r):null;t.nodes.forEach(function(t){delete t.circularLinkType}),t.links.forEach(function(t){delete t.circularLinkID,delete t.circularLinkType,delete t.circularPathData,delete t._circularWidth,delete t._circularStub,t.circular=i?i[t.source.index]>=i[t.target.index]:!(e(t.source)<e(t.target)),t.circular&&(t.circularLinkID=a++)})}(e,p,y),function(t,e){var a=0,i=0;t.links.forEach(function(t){t.circular&&(t.source.circularLinkType||t.target.circularLinkType?t.circularLinkType=t.source.circularLinkType?t.source.circularLinkType:t.target.circularLinkType:t.circularLinkType=a<i?"top":"bottom","top"==t.circularLinkType?a++:i++,t.source.circularLinkType=t.circularLinkType,t.target.circularLinkType=t.circularLinkType)}),t.links.forEach(function(t){t.circular&&(t.source.circularLinkType==t.target.circularLinkType&&(t.circularLinkType=t.source.circularLinkType),r(t,e)&&(t.circularLinkType=t.source.circularLinkType))})}(e,y),function(t){t.nodes.forEach(function(t){t.partOfCycle=!1,t.value=Math.max(pt(t.sourceLinks,s),pt(t.targetLinks,s)),t.sourceLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)}),t.targetLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)})})}(e),function(t,e,r){if(null!=e&&t.nodes.length){t.nodes.sort(function(t,r){return e(t)<e(r)?-1:1});var a=0,i=e(t.nodes[0]);t.nodes.forEach(function(t){a=e(t)==i?a:a+1,i=e(t)==i?i:e(t),t.column=a})}var n=new Int32Array(t.nodes.length),c=[],l=1;t.nodes.forEach(function(t){t.depth=t.height=0,t.targetLinks.forEach(function(e){e.circular||n[t.index]++}),0===n[t.index]&&c.push(t)});for(var o=0;o<c.length;o++){var u=c[o];l=Math.max(l,u.depth+1),u.sourceLinks.forEach(function(t){t.circular||(t.target.depth=Math.max(t.target.depth,u.depth+1),0===--n[t.target.index]&&c.push(t.target))})}for(o=c.length-1;o>=0;o--)(u=c[o]).sourceLinks.forEach(function(t){t.circular||(u.height=Math.max(u.height,t.target.height+1))});t.nodes.forEach(function(t){t.column=null==e?r(t,l):t.column})}(e,p,g);var d=f;if(null!==h){var k=mt(e.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]}),L=xt(k,function(t){return t.length});L>1&&(d=Math.max(1,(o-c)*h/(L-1)))}(function(t,e,r){var a=mt(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});t.py=e;var i=yt(a,function(e){return(t.y1-t.y0-(e.length-1)*t.py)/pt(e,function(t){return t.value})});t.ky=i,t.links.forEach(function(e){e.width=e.value*t.ky});var n=xt(t.nodes,function(t){return t.column});n>0?t.nodes.forEach(function(e){e.x0=t.x0+e.column*((t.x1-t.x0-r)/n),e.x1=e.x0+r}):t.nodes.forEach(function(e){e.x0=t.x0,e.x1=e.x0+r})})(e,d,u),$(e,p,y),T(e,p,y,d,d,m),R(e),$(e,p,y),T(e,p,y,d,d,m),R(e),function(t){let e=t;e.nodes.forEach(function(t){t.y+(t.y1-t.y0)>e.y1&&(t.y=t.y-(t.y+(t.y1-t.y0)-e.y1));var r=t.sourceLinks.slice().sort(function(t,e){return t.index-e.index});r.length>1&&r.sort(function(t,e){if(!t.circular&&!e.circular){if(t.target.column==e.target.column)return t.y1-e.y1;if(!D(t,e))return t.y1-e.y1;if(t.target.column>e.target.column){var r=i(e,t);return t.y1-r}if(e.target.column>t.target.column)return i(t,e)-e.y1}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.target.column===e.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===e.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:"top"==t.circularLinkType?-1:1:void 0});var a=t.y0;r.forEach(function(t){t.y0=a+t.width/2,a+=t.width});for(var n=0,c=r.length-1;c>=0;c--){var l=r[c];"bottom"==l.circularLinkType&&(l.y0=t.y1-n-l.width/2),n+=l.width}})}(e),e.nodes.forEach(function(t){var e=t.targetLinks.slice().sort(function(t,e){return t.index-e.index});e.length>1&&e.sort(function(t,e){if(!t.circular&&!e.circular){if(t.source.column==e.source.column)return t.y0-e.y0;if(!D(t,e))return t.y0-e.y0;if(e.source.column<t.source.column){var r=n(e,t);return t.y0-r}if(t.source.column<e.source.column)return n(t,e)-e.y0}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:t.source.column-e.source.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:e.source.column-t.source.column:"top"==t.circularLinkType?-1:1:void 0});var r=t.y0;e.forEach(function(t){t.y1=r+t.width/2,r+=t.width});for(var a=0,i=e.length-1;i>=0;i--){var c=e[i];"bottom"==c.circularLinkType&&(c.y1=t.y1-a-c.width/2),a+=c.width}}),function(t){var e=t.nodes,r=t.links,a=!1,i=!1;if(r.forEach(function(t){"top"==t.circularLinkType?a=!0:"bottom"==t.circularLinkType&&(i=!0)}),0==a||0==i){let a=function(e){return(e-n)/(c-n)*(t.y1-t.y0)+t.y0};var n=yt(e,function(t){return t.y0}),c=xt(e,function(t){return t.y1}),l=c-n,o=(t.y1-t.y0)/l;o<1?(e.forEach(function(t){t.y0=a(t.y0),t.y1=a(t.y1)}),r.forEach(function(t){t.y0=a(t.y0),t.y1=a(t.y1),t.width=t.width*o})):e.forEach(function(t){var e=t.y1-t.y0,r=a(t.y0)-t.y0;t.y0=a(t.y0),t.y1=t.y0+e,t.sourceLinks.forEach(function(t){t.y0=t.y0+r}),t.targetLinks.forEach(function(t){t.y1=t.y1+r})})}}(e),E(e,y,x,10,8)}(e),e}var a=0,c=0,l=1,o=1,u=24,f=8,h=null,y=S,g=d,p=void 0,m=32,x=2,k=w,L=A;return e.update=function(t){return R(t),E(t,y,x,10,8),t},e.nodeWidth=function(t){return arguments.length?(u=+t,e):u},e.nodePadding=function(t){return arguments.length?(f=+t,e):f},e.nodePaddingRatio=function(t){return arguments.length?(h=+t,e):h},e.nodes=function(t){return arguments.length?(k="function"==typeof t?t:M(t),e):k},e.links=function(t){return arguments.length?(L="function"==typeof t?t:M(t),e):L},e.nodeId=function(t){return arguments.length?(y="function"==typeof t?t:M(t),e):y},e.nodeAlign=function(t){return arguments.length?(g="function"==typeof t?t:M(t),e):g},e.nodeSort=function(t){return arguments.length?(p=t,e):p},e.iterations=function(t){return arguments.length?(m=+t,e):m},e.circularLinkGap=function(t){return arguments.length?(x=+t,e):x},e.extent=function(t){return arguments.length?(a=+t[0][0],c=+t[0][1],l=+t[1][0],o=+t[1][1],e):[[a,c],[l,o]]},e.size=function(t){return arguments.length?(a=c=0,l=+t[0],o=+t[1],e):[l-a,o-c]},e}().extent(x).links(m).nodes(k).nodeAlign(Xt[u]||d).nodeId(t=>t.id).nodeWidth(f).iterations(y);L.nodePaddingRatio&&L.nodePaddingRatio(h),L();{let t=1/0,e=-1/0,r=1/0,a=-1/0;for(let i of k)i.x0<t&&(t=i.x0),i.x1>e&&(e=i.x1),i.y0<r&&(r=i.y0),i.y1>a&&(a=i.y1);for(let i of m){if(!i.circular||!i.circularPathData)continue;let n=i.circularPathData,c=(i._circularWidth??i.width??0)/2;n.leftFullExtent-c<t&&(t=n.leftFullExtent-c),n.rightFullExtent+c>e&&(e=n.rightFullExtent+c),n.verticalFullExtent-c<r&&(r=n.verticalFullExtent-c),n.verticalFullExtent+c>a&&(a=n.verticalFullExtent+c)}let i=e-t,n=a-r,c=x[1][0],l=x[1][1];if(i>0&&n>0&&(t<0||r<0||e>c||a>l)){let e=c/i,a=l/n,o=Math.min(e,a),u=-t*o+(c-i*o)/2,s=-r*o+(l-n*o)/2;for(let t of k)t.x0=t.x0*o+u,t.x1=t.x1*o+u,t.y0=t.y0*o+s,t.y1=t.y1*o+s;for(let t of m)if(t.y0=t.y0*o+s,t.y1=t.y1*o+s,t.width=(t.width??0)*o,t._circularWidth&&(t._circularWidth*=o),t.circular&&t.circularPathData){let e=t.circularPathData;e.sourceX=e.sourceX*o+u,e.targetX=e.targetX*o+u,e.sourceY=e.sourceY*o+s,e.targetY=e.targetY*o+s,e.rightFullExtent=e.rightFullExtent*o+u,e.leftFullExtent=e.leftFullExtent*o+u,e.verticalFullExtent=e.verticalFullExtent*o+s,e.rightInnerExtent=e.rightInnerExtent*o+u,e.leftInnerExtent=e.leftInnerExtent*o+u,e.verticalRightInnerExtent=e.verticalRightInnerExtent*o+s,e.verticalLeftInnerExtent=e.verticalLeftInnerExtent*o+s,e.rightSmallArcRadius*=o,e.rightLargeArcRadius*=o,e.leftSmallArcRadius*=o,e.leftLargeArcRadius*=o,e.sourceWidth*=o,e.rightNodeBuffer*=o,e.leftNodeBuffer*=o,e.arcRadius*=o}}}let v=new Map;for(let t of e)v.set(t.id,t);for(let t of k){let e=v.get(t.id);e&&(e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.value=t.value,e.depth=t.depth,e.sourceLinks=t.sourceLinks,e.targetLinks=t.targetLinks,e.width=t.x1-t.x0,e.height=t.y1-t.y0,e.x=t.x0+(t.x1-t.x0)/2,e.y=t.y0+(t.y1-t.y0)/2)}let b=new Map;for(let t of a)if(t._edgeKey)b.set(t._edgeKey,t);else{let e=ut(t.source),r=ut(t.target);b.set(`${e}\0${r}`,t)}for(let t of m){let e=ut(t.source),r=ut(t.target),a=t._edgeKey?b.get(t._edgeKey):b.get(`${e}\0${r}`);if(a){a.y0=t.y0,a.y1=t.y1,a.sankeyWidth=t.width??0,a.circular=!!t.circular,a.circularPathData=t.circularPathData,a._circularWidth=t._circularWidth,a._circularStub=t._circularStub,a.path=t.path,a.circularLinkType=t.circularLinkType,a.direction=o;let i=v.get(e),n=v.get(r);i&&(a.source=i),n&&(a.target=n)}}},buildScene(t,e,r,a){let i="vertical"===r.orientation?"down":"right",n=r.nodeStyle,c=r.edgeStyle,l=r.edgeOpacity??.5,o=r.edgeColorBy||"source",u=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:ht,s=new Map;t.forEach((t,e)=>{s.set(t.id,u[e%u.length])});let f=[],h=[],d=[],y=new Map;for(let e of t){let t=e.x1-e.x0,r=e.y1-e.y0;if(e.value<=0||t<=0||r<=0)continue;let a=n?n(W(e,"nodeStyle")):{},c={fill:a.fill||s.get(e.id)||"#4d430c",stroke:a.stroke,strokeWidth:a.strokeWidth,opacity:a.opacity,cursor:a.cursor};y.set(e.id,("string"==typeof c.fill?c.fill:null)||s.get(e.id)||"#4d430c");let l={...e.data,value:e.data?.value??e.value};"down"===i?f.push({type:"rect",x:e.y0,y:e.x0,w:r,h:t,style:c,accessibleDatum:l,datum:e,id:e.id,label:e.id}):f.push({type:"rect",x:e.x0,y:e.y0,w:t,h:r,style:c,accessibleDatum:l,datum:e,id:e.id,label:e.id})}let g=[...e].sort((t,e)=>(e.sankeyWidth||0)-(t.sankeyWidth||0));for(let t of g){if(!(t.value>0)||!t.sankeyWidth||t.sankeyWidth<=0)continue;let e="object"==typeof t.source?t.source:null,a="object"==typeof t.target?t.target:null;if(!e||!a)continue;let i=r.themeSemantic?.border||r.themeSemantic?.secondary||"#999";i="function"==typeof o?o(t)||i:"target"===o?y.get(a.id)||s.get(a.id)||i:y.get(e.id)||s.get(e.id)||i;let n,u=c?c(W(t,"edgeStyle")):{};if(n=t.circular&&t.circularPathData?I(t):Ot(t),!n)continue;let f={fill:u.fill||i,fillOpacity:u.fillOpacity??l,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,strokeOpacity:u.strokeOpacity,opacity:u.opacity,cursor:u.cursor};h.push({type:"bezier",pathD:n,bezierCache:t.bezier,style:f,accessibleDatum:t.data,datum:t})}if(!1!==r.showLabels){let e=ot(r.nodeLabel);for(let r of t){let t=r.x1-r.x0,n=r.y1-r.y0;if(r.value<=0||t<=0||n<=0)continue;let c,l,o,u=e?e(r):r.id;if(u){if("down"===i)c=r.y0+(r.y1-r.y0)/2,l=r.x1+14,o="start";else{let e=a[0]/2;r.x0+t/2<e?(c=r.x0-6,o="end"):(c=r.x1+6,o="start"),l=r.y0+n/2}d.push({x:c,y:l,text:String(u),anchor:"down"===i?"middle":o,baseline:"middle",fontSize:11})}}}return{sceneNodes:f,sceneEdges:h,labels:d}}},qt={supportsStreaming:!0,hierarchical:!1,computeLayout(t,e,r,a){if(0===t.length)return;let i=r.forceStrength??.1,n=a[0]/2,c=a[1]/2,l=Math.max(.1,Math.min(1,Math.min(a[0],a[1])/200)),o=Math.min(.5,.06+1.8*(1-l)),u=r.__previousPositions,s=0,f=[];for(let e of t){let t=!1!==e.__hasPosition&&Number.isFinite(e.x)&&Number.isFinite(e.y),r=u?.get(e.id);t?s++:r?(e.x=r.x,e.y=r.y,s++):f.push(e)}let h=t.length>0?f.length/t.length:1,d=s>0&&h<=.3;if(d){let r=new Map;for(let e of t)r.set(e.id,e);for(let t of f){let a=F(t.id,e,r);if(a.length>0){let e=0,r=0;for(let t of a)e+=t.x,r+=t.y;let i=N(t.id),n=i%360*(Math.PI/180),c=(10+i%20)*l;t.x=e/a.length+c*Math.cos(n),t.y=r/a.length+c*Math.sin(n)}else{let e=N(t.id),r=e%360*(Math.PI/180),a=(15+e%30)*l;t.x=n+a*Math.cos(r),t.y=c+a*Math.sin(r)}}}else{let e=Math.PI*(3-Math.sqrt(5));for(let r=0;r<t.length;r++){let a=t[r];if(!1===a.__hasPosition||!Number.isFinite(a.x)||!Number.isFinite(a.y)){let t=10*Math.sqrt(r+.5)*l,i=r*e;a.x=n+t*Math.cos(i),a.y=c+t*Math.sin(i)}}}for(let e of t)e.__hasPosition=!0;let y=t.length,g=r.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(y-30)))),p=r.__skipForceSimulation||0===r.iterations?0:d?40:g,m=ct(r.nodeSize,r.nodeSizeRange,t);if(p>0){let u=new Map,s=new Map;for(let e of t)u.set(e.id,0),s.set(e.id,e);for(let t of e){let e=ut(t.source),r=ut(t.target);u.set(e,(u.get(e)??0)+1),u.set(r,(u.get(r)??0)+1)}let f=vt().strength(t=>{let e=lt(t),r=ut(t.source),a=ut(t.target),n=Math.max(1,Math.min(u.get(r)??1,u.get(a)??1)),c=e&&e>0?Math.sqrt(e):1;return Math.min(2.5,c*i/(.1*n))}).distance(t=>{let e="string"==typeof t.source?s.get(t.source):t.source,r="string"==typeof t.target?s.get(t.target):t.target,a=(e?m(e):0)+(r?m(r):0)+Math.max(6,12*l);return Math.max(16,40*l,a)}).id(t=>t.id),h=bt();if((void 0!==r.random||void 0!==r.seed)&&h.randomSource(r.random??st(r.seed)),h.force("charge",Dt().strength(t=>{let e=u.get(t.id)??0;return-15*l*m(t)*Math.sqrt(e+1)})).force("collide",Pt(t=>m(t)+3*l).strength(.9).iterations(2)).force("center",Et(n,c).strength(.8)).force("x",Mt(n).strength(o)).force("y",St(c).strength(o)).force("bounds",function(t,e,r=2,a=.6){let i=[],n=n=>{let c=a*Math.max(n,.2);for(let a of i){let i=a.x??t[0]/2,n=a.y??t[1]/2,l=a.vx??0,o=a.vy??0,u=e(a)+r,s=Math.min(t[0]/2,u),f=Math.max(t[0]/2,t[0]-u),h=Math.min(t[1]/2,u),d=Math.max(t[1]/2,t[1]-u),y=i+l,g=n+o;y<s?a.vx=l+(s-y)*c:y>f&&(a.vx=l+(f-y)*c),g<h?a.vy=o+(h-g)*c:g>d&&(a.vy=o+(d-g)*c)}};return n.initialize=t=>{i=t},n}(a,m)),h.nodes(t),e.length>0){let t=e.map(t=>({...t,source:ut(t.source),target:ut(t.target)}));f.links(t),h.force("link",f)}d?h.alpha(.3):h.alpha()<.1&&h.alpha(1),h.stop();for(let t=0;t<p;++t)h.tick()}for(let e of t){if(null==e.x||null==e.y)continue;let t=m(e),r=p>0?2:0,i=Math.min(a[0]/2,t+r),n=Math.min(a[1]/2,t+r);e.x=Math.max(i,Math.min(a[0]-i,e.x)),e.y=Math.max(n,Math.min(a[1]-n,e.y)),e.x0=0,e.x1=0,e.y0=0,e.y1=0}let x=new Map;for(let e of t)x.set(e.id,e);for(let t of e){if("string"==typeof t.source){let e=x.get(t.source);e&&(t.source=e)}if("string"==typeof t.target){let e=x.get(t.target);e&&(t.target=e)}}},buildScene(t,e,r,a){let i=r.nodeStyle,n=r.edgeStyle,c=ct(r.nodeSize,r.nodeSizeRange,t),l=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:ht,o=new Map;t.forEach((t,e)=>{o.set(t.id,l[e%l.length])});let u=[],s=[],f=[];for(let e of t){if(null==e.x||null==e.y)continue;let t=c(W(e,"nodeSize")),a=i?i(W(e,"nodeStyle")):{},n={fill:a.fill||o.get(e.id)||r.themeSemantic?.primary||"#007bff",stroke:a.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??2,opacity:a.opacity,cursor:a.cursor};u.push({type:"circle",cx:e.x,cy:e.y,r:t,style:n,accessibleDatum:e.data,datum:e,id:e.id,label:e.id})}let h=new Map;for(let e of t)h.set(e.id,e);for(let t of e){let e="object"==typeof t.source?t.source:h.get(t.source),a="object"==typeof t.target?t.target:h.get(t.target);if(!e||!a||null==e.x||null==e.y||null==a.x||null==a.y)continue;let i=n?n(W(t,"edgeStyle")):{},c={stroke:i.stroke||r.themeSemantic?.border||r.themeSemantic?.secondary||"#999",strokeWidth:i.strokeWidth??1,opacity:i.opacity??.6,cursor:i.cursor};s.push({type:"line",x1:e.x,y1:e.y,x2:a.x,y2:a.y,style:c,accessibleDatum:t.data,datum:t})}if(!1!==r.showLabels){let e=ot(r.nodeLabel);for(let r of t){if(null==r.x||null==r.y)continue;let t=e?e(r):r.id;if(!t)continue;let a=c(W(r,"nodeSize"));f.push({x:r.x,y:r.y-a-4,text:String(t),anchor:"middle",baseline:"auto",fontSize:11,anchorPoint:[r.x,r.y]})}}return{sceneNodes:u,sceneEdges:s,labels:f}}},Kt=ht,Zt={supportsStreaming:!1,hierarchical:!1,computeLayout(t,e,r,a){for(let e of t)delete e.__arcData;for(let t of e)delete t.__chordData,delete t.__chordEdges;if(0===t.length)return;let{padAngle:i=.01,groupWidth:n=20,sortGroups:c}=r,l=Math.min(a[0],a[1])/2,o=l-n,u=a[0]/2,s=a[1]/2,f=new Map(t.map(t=>[t.id,t])),h=new Set,d=e.filter(t=>{let e=ut(t.source),r=ut(t.target);return!(!Number.isFinite(t.value)||t.value<=0||!f.has(e)||!f.has(r)||(h.add(e),h.add(r),0))}),y=t.filter(t=>h.has(t.id)),g=y.length;if(0===g)return;let p=new Map(y.map((t,e)=>[t.id,e])),m=Array.from({length:g},()=>new Array(g).fill(0)),x=new Map;for(let t of d){let e=ut(t.source),r=ut(t.target),a=p.get(e),i=p.get(r);m[a][i]+=t.value;let n=a<=i?`${a}\0${i}`:`${i}\0${a}`,c=x.get(n);c?c.push(t):x.set(n,[t])}let k=Math.min(Number.isFinite(i)?Math.max(0,i):.01,Math.PI/g),L=At().padAngle(k);c&&L.sortGroups(c);let v=L(m),b=v.groups,D=$t().innerRadius(o).outerRadius(l);for(let t of b){let e=y[t.index],r={innerRadius:o,outerRadius:l,startAngle:t.startAngle,endAngle:t.endAngle},a=D.centroid(r);e.x=a[0]+u,e.y=a[1]+s,e.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}for(let t of e){let e=ut(t.source),r=ut(t.target),a=f.get(e),i=f.get(r);a&&(t.source=a),i&&(t.target=i)}for(let t of v){let e=t.source.index,r=t.target.index,a=e<=r?`${e}\0${r}`:`${r}\0${e}`,i=x.get(a);for(let e of i)e.__chordData=t,e.__chordEdges=i}},buildScene(t,e,r,a){let{groupWidth:i=20,edgeOpacity:n=.5}=r,c=Math.min(a[0],a[1])/2,l=c-i,o=a[0]/2,u=a[1]/2,s=r.nodeStyle,f=r.edgeStyle,h=r.edgeColorBy||"source",d=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:Kt,y=new Map;t.forEach((t,e)=>{y.set(t.id,d[e%d.length])});let g=wt().radius(l),p=[],m=[],x=[];for(let e=0;e<t.length;e++){let r=t[e],a=r.__arcData;if(!a)continue;let i=s?s(W(r,"nodeStyle")):{},n={fill:("string"==typeof i.fill?i.fill:void 0)||y.get(r.id)||d[e%d.length],stroke:i.stroke||"black",strokeWidth:i.strokeWidth??1,opacity:i.opacity,cursor:i.cursor};p.push({type:"arc",cx:o,cy:u,innerR:l,outerR:c,startAngle:a.startAngle-Math.PI/2,endAngle:a.endAngle-Math.PI/2,style:n,accessibleDatum:r.data,datum:r,id:r.id,label:r.id})}let k=new Set,L=t.filter(t=>t.__arcData);for(let t of e){let e=t.__chordData;if(!e||k.has(e))continue;k.add(e);let a=L[e.source.index].id;for(let e of t.__chordEdges||[])ut(e.source)===a&&(t=e);let i=g(e);if(!i)continue;let c=C(i,o,u),l=r.themeSemantic?.border||r.themeSemantic?.secondary||"#999",s=f?f(W(t,"edgeStyle")):{};if(f)l=("string"==typeof s.fill?s.fill:void 0)||l;else{let e="object"==typeof t.source?t.source:null,r="object"==typeof t.target?t.target:null;"target"===h&&r?l=y.get(r.id)||l:e&&(l=y.get(e.id)||l)}let d={fill:l,fillOpacity:s.fillOpacity??n,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,strokeOpacity:s.strokeOpacity,opacity:s.opacity,cursor:s.cursor};m.push({type:"ribbon",pathD:c,style:d,accessibleDatum:t.data,datum:t})}if(!1!==r.showLabels){let e=ot(r.nodeLabel),a=c+12;for(let r of t){let t=r.__arcData;if(!t)continue;let i=e?e(r):r.id;if(!i)continue;let n=(t.startAngle+t.endAngle)/2,c=n-Math.PI/2,l=o+Math.cos(c)*a,s=u+Math.sin(c)*a,f=n>Math.PI?"end":"start";x.push({x:l,y:s,text:String(i),anchor:f,baseline:"middle",fontSize:11})}}return{sceneNodes:p,sceneEdges:m,labels:x}}},Gt=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"],Vt={supportsStreaming:!1,hierarchical:!0,computeLayout(t,e,r,a){let i=r.__hierarchyRoot;if(!i)return;let n=r.chartType,c=O(r.childrenAccessor),l=Rt(i,c),o=[];l.eachBefore(t=>o.push(t));let u=B(o.map((t,e)=>function(t,e,r){let a=e.nodeIDAccessor,i=t.data;return String("function"==typeof a?a(i):"string"==typeof a&&void 0!==i[a]?i[a]:void 0!==i.name?i.name:void 0!==i.id?i.id:`node-${r}`)}(t,r,e)));l.sum(function(t="value"){let e="function"==typeof t?t:e=>e[t];return t=>{let r=e(t),a="string"==typeof r?Number(r):r;return Number.isFinite(a)&&a>0?a:0}}(r.hierarchySum)).sort((t,e)=>e.value-t.value);let[s,f]=a;switch(n){case"tree":case"cluster":!function(t,e,r,a){let i=e.treeOrientation||"vertical",n="cluster"===e.chartType?_t():It();if("horizontal"===i)n.size([a,r]);else if("radial"===i){let t=Math.min(r,a)/2;n.size([2*Math.PI,.8*t])}else n.size([r,a]);n(t)}(l,r,s,f);break;case"treemap":case"partition":!function(t,e,r,a){let i="treemap"===e.chartType,n=i?Wt().tile(Ft):Nt();n.size([r,a]).padding(e.padding??(i?4:1)),"paddingTop"in n&&e.paddingTop>0&&n.paddingTop(e.paddingTop),n(t)}(l,r,s,f);break;case"circlepack":!function(t,e,r,a){let i=e.padding??4,n=Ct().size([r,a]).padding(i);t.leaves().some(t=>t.value)||n.radius(()=>0).padding(0),n(t)}(l,r,s,f)}let h=l.descendants();t.length=0,e.length=0;let d=new Map(o.map((t,e)=>[t,{id:u[e],x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:t.value,depth:t.depth,data:t.data,createdByFrame:!0}]));for(let e of h){let a=d.get(e);"tree"===n||"cluster"===n?Z(a,e,r):"treemap"===n||"partition"===n?G(a,e):"circlepack"===n&&V(a,e),a.__hierarchyNode=e,t.push(a)}if("tree"===n||"cluster"===n)for(let t of h)if(t.parent){let r=d.get(t.parent),a=d.get(t);e.push({source:r,target:a,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:t.depth}})}},buildScene(t,e,r,a){let i=r.chartType,n=r.nodeStyle||(()=>({})),c=r.edgeStyle||(()=>({}));switch(i){case"tree":case"cluster":return function(t,e,r,a,i,n){let c=[],l=[],o=[],u=r.treeOrientation||"vertical",s="radial"===u,f=a[0]/2,h=a[1]/2,{nodeSize:d}=r,y="number"==typeof d?d:5;for(let e of t){let t=e.x,a=e.y;s&&(t+=f,a+=h);let n=Y(e,r,i(W(e,"nodeStyle")));c.push({type:"circle",cx:t,cy:a,r:y,style:n,accessibleDatum:{...e.data,value:e.data?.value??e.value},datum:e,id:e.id,label:e.id,depth:e.depth})}let g=r.edgeOpacity??.5;for(let t of e){let e="object"==typeof t.source?t.source:null,a="object"==typeof t.target?t.target:null;if(!e||!a)continue;let i=e.x,c=e.y,o=a.x,d=a.y;s&&(i+=f,c+=h,o+=f,d+=h);let y=K(i,c,o,d,u),p=n(W(t,"edgeStyle")),m={fill:"none",stroke:p.stroke||r.themeSemantic?.border||r.themeSemantic?.secondary||"#999",strokeWidth:p.strokeWidth??1.5,opacity:p.opacity??g,cursor:p.cursor};l.push({type:"curved",pathD:y,style:m,datum:t})}if(!1!==r.showLabels){let e=j(r.nodeLabel);for(let r of t){let t=e?e(r):r.id;if(!t)continue;let a,i,n,c=r.x,l=r.y;if(s&&(c+=f,l+=h),s){let t=c-f,e=l-h,r=Math.sqrt(t*t+e*e);r>0?(a=c+t/r*10,i=l+e/r*10,n=t>=0?"start":"end"):(a=c,i=l-12,n="middle")}else"horizontal"===u?(q(r)?(a=c+y+6,n="start"):(a=c-y-6,n="end"),i=l):(a=c,i=l+y+14,n="middle");o.push({x:a,y:i,text:String(t),anchor:n,baseline:"middle",fontSize:11,anchorPoint:[c,l]})}}return{sceneNodes:c,sceneEdges:l,labels:o}}(t,e,r,a,n,c);case"treemap":case"partition":return function(t,e,r){let a=[],i=[];for(let i of t){let t=i.x1-i.x0,n=i.y1-i.y0;if(t<=0||n<=0)continue;let c=r(W(i,"nodeStyle")),l=Y(i,e,c);l.fillOpacity=c.fillOpacity,l.strokeOpacity=c.strokeOpacity,a.push({type:"rect",x:i.x0,y:i.y0,w:t,h:n,style:l,accessibleDatum:{...i.data,value:i.data?.value??i.value},datum:i,id:i.id,label:i.id,depth:i.depth})}if(!1!==e.showLabels){let a=j(e.nodeLabel),n=e.labelMode||"leaf",c="partition"===e.chartType;for(let l of t){let t=l.x1-l.x0,o=l.y1-l.y0;if(t<=0||o<=0)continue;let u=q(l);if(!c&&("leaf"===n&&!u||"parent"===n&&u))continue;let s=a?a(l):l.id;if(!s)continue;if(t<(u?30:40)||o<(u?16:14))continue;let f=X(l,e,r(W(l,"nodeStyle")).fill),h="string"==typeof f?z(f):e.themeSemantic?.text??"#000";u?i.push({x:l.x0+t/2,y:l.y0+o/2,text:String(s),anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(t,o)/6)),fill:h}):i.push({x:l.x0+4,y:l.y0+12,text:String(s),anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:h})}}return{sceneNodes:a,sceneEdges:[],labels:i}}(t,r,n);case"circlepack":return function(t,e,r){let a=[],i=[];for(let i of t){let t=i.__radius??5;if(t<=0)continue;let n=Y(i,e,r(W(i,"nodeStyle")));n.opacity??(n.opacity=.7),a.push({type:"circle",cx:i.x,cy:i.y,r:t,style:n,accessibleDatum:{...i.data,value:i.data?.value??i.value},datum:i,id:i.id,label:i.id,depth:i.depth})}if(!1!==e.showLabels){let a=j(e.nodeLabel);for(let n of t){let t=n.__radius??5,c=a?a(n):n.id;if(!c||t<15)continue;let l=q(n),o=X(n,e,r(W(n,"nodeStyle")).fill);if(l){let r="string"==typeof o?z(o):e.themeSemantic?.text??"#000";i.push({x:n.x,y:n.y,text:String(c),anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,t/3)),fill:r})}else i.push({x:n.x,y:n.y-t+14,text:String(c),anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,t/3)),fill:e.themeSemantic?.text||"#000",stroke:e.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:a,sceneEdges:[],labels:i}}(t,r,n);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}},Qt={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(t,e,r,a){let i=r.__hierarchyRoot;i&&function(t,e,r,a,i){let n=O(r.childrenAccessor||"children"),c=function(t){if("function"==typeof t)return t;let e=t||"name";return t=>String(t[e]??"")}(r.nodeIDAccessor),l=function(t){if(Array.isArray(t))return t;switch(t){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(r.orbitMode),o=r.orbitSize??2.95,u=r.orbitEccentricity??1,s="number"==typeof o?()=>o:o,f="number"==typeof u?()=>u:u,h=it(r);h.metaMap.clear(),a.length=0,i.length=0;let d=B(et(t,n).map(t=>String(c(t)))),y=0,g=e[0]/2,p=e[1]/2,m=Math.min(e[0],e[1])/2*.85,x=d[y++],k={id:x,x:g,y:p,x0:g,x1:g,y0:p,y1:p,width:0,height:0,value:0,depth:0,data:t};a.push(k),h.metaMap.set(x,{ring:m,angle:0,depth:0,parentId:null,eccentricity:1}),function t(e,r,c,o,u,g,p){let m=n(e);if(!m?.length)return;let x=m.length,k=0,L=0,v=0;for(;L<x;)L+=l[Math.min(v,l.length-1)],v++,k++;let b=0;for(let x=0;x<k;x++){let L=l[Math.min(x,l.length-1)],v=m.slice(b,b+L);if(!v.length)break;let D=(x+1)/k,P={id:r,depth:g,data:e,parentId:r},E=p?u/s(P)*D:u*D,M=Tt().value(t=>n(t)?.length?4:1).sort(null)(v),S=f(P);for(let e=0;e<v.length;e++){let n=(M[e].startAngle+M[e].endAngle)/2,l=v[e],u=d[y++],s=c+E*Math.sin(n),f=o+E*Math.cos(n)*S,p={id:u,x:s,y:f,x0:s,x1:s,y0:f,y1:f,width:0,height:0,value:0,depth:g,data:l};a.push(p),h.metaMap.set(u,{ring:E,angle:n,depth:g,parentId:r,eccentricity:S}),i.push({source:r,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:r,target:u}}),t(l,u,s,f,E,g+1,!0)}b+=L}}(t,x,g,p,m,1,!1)}(i,a,r,t,e)},buildScene(t,e,r,a){let i=r.nodeStyle,n=r.edgeStyle,c=r.nodeSize,l="number"==typeof c?()=>c:"function"==typeof c?c:()=>6,o=[],u=[],s=[];if(!1!==r.orbitShowRings){let e=it(r),a=new Map;for(let e of t)a.set(e.id,e);let i=new Map;for(let[,t]of e.metaMap){if(!t.parentId)continue;let e=a.get(t.parentId);if(!e)continue;let r=`${t.parentId}:${t.ring}`;i.has(r)||i.set(r,{parentX:e.x,parentY:e.y,ring:t.ring,ecc:t.eccentricity})}let n=48,c={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(let[,{parentX:t,parentY:e,ring:r,ecc:a}]of i)for(let i=0;i<n;i++){let l=i/n*Math.PI*2,o=(i+1)/n*Math.PI*2;u.push({type:"line",x1:t+r*Math.sin(l),y1:e+r*Math.cos(l)*a,x2:t+r*Math.sin(o),y2:e+r*Math.cos(o)*a,style:c,interactive:!1,datum:null})}}for(let e of t){if(null==e.x||null==e.y)continue;let t=l(W(e,"nodeSize")),a=i?i(W(e,"nodeStyle")):{},n={fill:a.fill||r.themeSemantic?.primary||"#6366f1",stroke:a.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??1,opacity:a.opacity??(0===(e.depth??0)?1:.85),cursor:a.cursor};o.push({type:"circle",cx:e.x,cy:e.y,r:t,style:n,accessibleDatum:e.data,datum:e,id:e.id,label:e.id,depth:e.depth})}let f=new Map;for(let e of t)f.set(e.id,e);for(let t of e){let e="object"==typeof t.source?t.source:f.get(t.source),r="object"==typeof t.target?t.target:f.get(t.target);if(!e||!r||null==e.x||null==r.x)continue;let a=n?n(W(t,"edgeStyle")):{},i={stroke:a.stroke||"rgba(128,128,128,0.35)",strokeWidth:a.strokeWidth??.5,opacity:a.opacity??1,cursor:a.cursor};u.push({type:"line",x1:e.x,y1:e.y,x2:r.x,y2:r.y,style:i,datum:t})}if(r.showLabels){let e=r.nodeLabel;for(let r of t){let t=l(W(r,"nodeSize"));if(t<=4)continue;let a="function"==typeof e?e(r):e?r.data?.[e]??r.id:r.id;s.push({x:r.x,y:r.y+t+12,text:String(a),anchor:"middle",fontSize:10,fill:"currentColor",anchorPoint:[r.x,r.y]})}}return{sceneNodes:o,sceneEdges:u,labels:s}},tick:(t,e,r,a,i)=>!1!==r.orbitAnimated&&(function(t,e){let r=it(e),a=e.orbitSpeed??.25,i=e.orbitRevolution??function(t){switch(t){case"decay":return t=>Math.pow(.6,t.depth??0);case"alternate":return t=>{let e=t.depth??0;return(e%2==0?1:-1)/(e+1)};default:return t=>1/((t.depth??0)+1)}}(e.orbitRevolutionStyle),n=((typeof performance<"u"?performance.now():Date.now())-r.startTime)/1e3,c=a*(Math.PI/6),l=new Map;for(let e of t)l.set(e.id,e);for(let e of t){let t=r.metaMap.get(e.id);if(!t||!t.parentId)continue;let a=l.get(t.parentId);if(!a)continue;let o={id:e.id,depth:t.depth,data:e.data,parentId:t.parentId},u=t.angle+n*c*i(o);e.x=a.x+t.ring*Math.sin(u),e.y=a.y+t.ring*Math.cos(u)*t.eccentricity,e.x0=e.x,e.x1=e.x,e.y0=e.y,e.y1=e.y}}(t,r),!0)};export{_ as a,Yt as b,qt as c,Zt as d,Vt as e,U as f,tt as g,et as h,rt as i,at as j,Qt as k};
1
+ function t(t,e){var r=t.get(e);if(!r)throw new Error("missing: "+e);return r}function e(t){return t.y0-t.y1>0?"up":"down"}function r(t,e){return e(t.source)==e(t.target)}function a(t){return t.target.x0-t.source.x1}function i(t,r){var i=c(t),n=a(r)/Math.tan(i);return"up"==e(t)?t.y1-n:t.y1+n}function n(t,r){var i=c(t),n=a(r)/Math.tan(i);return"up"==e(t)?t.y1+n:t.y1-n}function c(t){var e=Math.abs(t.y1-t.y0),r=Math.abs(t.target.x0-t.source.x1);return Math.atan(r/e)}function l(t){return u(t.source)}function o(t){return u(t.target)}function u(t){return(t.y0+t.y1)/2}function s(t){return t.virtual?0:t.value}function f(t,e){var a=0;t.sourceLinks.forEach(function(t){a=t.circular&&!r(t,e)?a+1:a});var i=0;return t.targetLinks.forEach(function(t){i=t.circular&&!r(t,e)?i+1:i}),a+i}function h(t){return t.target.depth}function d(t,e){return t.sourceLinks.length?t.depth:e-1}function y(t,e){return t.y0-e.y0}function g(t,e){return e.y0-t.y0}function p(t,e){return t.y1-e.y1}function m(t,e){return e.y1-t.y1}function x(t,e){return L(t.source,e.source)||t.index-e.index}function k(t,e){return L(t.target,e.target)||t.index-e.index}function L(t,e){return t.partOfCycle===e.partOfCycle?t.y0-e.y0:"top"===t.circularLinkType||"bottom"===e.circularLinkType?-1:1}function v(t,e){return b(t)==b(e)?"bottom"==t.circularLinkType?g(t,e):y(t,e):b(e)-b(t)}function b(t){return t.target.column-t.source.column}function D(t,e){return P(t)==P(e)}function P(t){return t.y0-t.y1>0?"up":"down"}function E(t,e,a,i,n){let c=t;c.links.forEach(function(t){t.circular&&(t._circularWidth=t.width,t._circularStub=!1)});var l=yt(c.links,function(t){return t.source.y0});c.links.forEach(function(t){t.circular&&(t.circularPathData={})});var o=c.links.filter(function(t){return t.circular}),u=new Map,s=new Map;o.forEach(function(t){u.set(t.source,(u.get(t.source)||0)+1),s.set(t.target,(s.get(t.target)||0)+1)});var f=new Set(o.filter(function(t){return r(t,e)&&1===u.get(t.source)&&1===s.get(t.target)}));return["top","bottom"].forEach(function(t){var e=o.filter(function(e){return e.circularLinkType===t});(function(t,e,r){if(0!==t.length){t.sort(v);var a=Array.from(new Set(t.flatMap(function(t){return[t.source.column,t.target.column]}))).sort(function(t,e){return t-e}),i=new Map(a.map(function(t,e){return[t,e]})),n=new zt(a.length);t.forEach(function(t){var a=i.get(t.source.column),c=i.get(t.target.column),l=Math.min(a,c),o=Math.max(a,c),u=e.has(t)?0:n.query(l,o);t.circularPathData.verticalBuffer=u+t._circularWidth/2,n.reserve(l,o,u+t._circularWidth+r)})}})(e.slice(),f,a),["source","target"].forEach(function(r){var n=new Map;e.forEach(function(t){var e=t[r].column;n.has(e)||n.set(e,[]),n.get(e).push(t)}),n.forEach(function(e){e.sort("source"===r?"bottom"===t?g:y:"bottom"===t?m:p);var n=0,c="source"===r?"right":"left";e.forEach(function(t,e){t.circularPathData[c+"SmallArcRadius"]=i+t._circularWidth/2+n,t.circularPathData[c+"LargeArcRadius"]=i+t._circularWidth/2+e*a+n,n+=t._circularWidth})})})}),c.links.forEach(function(t){t.circular&&(t.circularPathData.arcRadius=t._circularWidth+i,t.circularPathData.rightNodeBuffer=5,t.circularPathData.leftNodeBuffer=5,t.circularPathData.sourceWidth=t.source.x1-t.source.x0,t.circularPathData.sourceX=t.source.x0+t.circularPathData.sourceWidth,t.circularPathData.targetX=t.target.x0,t.circularPathData.sourceY=t.y0,t.circularPathData.targetY=t.y1,f.has(t)?(t.circularPathData.rightSmallArcRadius=i+t._circularWidth/2,t.circularPathData.rightLargeArcRadius=i+t._circularWidth/2,t.circularPathData.leftSmallArcRadius=i+t._circularWidth/2,t.circularPathData.leftLargeArcRadius=i+t._circularWidth/2,"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=t.source.y1+n+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=t.source.y0-n-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius)):"bottom"==t.circularLinkType?(t.circularPathData.verticalFullExtent=Math.max(c.y1,t.source.y1,t.target.y1)+n+t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent-t.circularPathData.leftLargeArcRadius):(t.circularPathData.verticalFullExtent=l-n-t.circularPathData.verticalBuffer,t.circularPathData.verticalRightInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.rightLargeArcRadius,t.circularPathData.verticalLeftInnerExtent=t.circularPathData.verticalFullExtent+t.circularPathData.leftLargeArcRadius),t.circularPathData.rightInnerExtent=t.circularPathData.sourceX+t.circularPathData.rightNodeBuffer,t.circularPathData.leftInnerExtent=t.circularPathData.targetX-t.circularPathData.leftNodeBuffer,t.circularPathData.rightFullExtent=t.circularPathData.sourceX+t.circularPathData.rightLargeArcRadius+t.circularPathData.rightNodeBuffer,t.circularPathData.leftFullExtent=t.circularPathData.targetX-t.circularPathData.leftLargeArcRadius-t.circularPathData.leftNodeBuffer),t.circular?t.path=function(t){return"top"==t.circularLinkType?"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 0 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY-t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 0 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 0 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY-t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 0 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY:"M"+t.circularPathData.sourceX+" "+t.circularPathData.sourceY+" L"+t.circularPathData.rightInnerExtent+" "+t.circularPathData.sourceY+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightSmallArcRadius+" 0 0 1 "+t.circularPathData.rightFullExtent+" "+(t.circularPathData.sourceY+t.circularPathData.rightSmallArcRadius)+" L"+t.circularPathData.rightFullExtent+" "+t.circularPathData.verticalRightInnerExtent+" A"+t.circularPathData.rightLargeArcRadius+" "+t.circularPathData.rightLargeArcRadius+" 0 0 1 "+t.circularPathData.rightInnerExtent+" "+t.circularPathData.verticalFullExtent+" L"+t.circularPathData.leftInnerExtent+" "+t.circularPathData.verticalFullExtent+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftLargeArcRadius+" 0 0 1 "+t.circularPathData.leftFullExtent+" "+t.circularPathData.verticalLeftInnerExtent+" L"+t.circularPathData.leftFullExtent+" "+(t.circularPathData.targetY+t.circularPathData.leftSmallArcRadius)+" A"+t.circularPathData.leftLargeArcRadius+" "+t.circularPathData.leftSmallArcRadius+" 0 0 1 "+t.circularPathData.leftInnerExtent+" "+t.circularPathData.targetY+" L"+t.circularPathData.targetX+" "+t.circularPathData.targetY}(t):t.path=function(t){var e=t.source.x1,r=t.y0,a=t.target.x0,i=t.y1,n=(e+a)/2;return"M"+e+","+r+"C"+n+","+r+" "+n+","+i+" "+a+","+i}(t)}),c}function M(t){return function(){return t}}function S(t){return t.index}function w(t){return t.nodes}function A(t){return t.links}function $(t,e,r){var a=mt(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});a.forEach(function(i,n){var c=i.length;if(e)i.sort(e);else if(n>0){var l=new Map;i.forEach(function(t,e){var r,a,i,n=(a=0,i=0,(r=t).targetLinks.forEach(function(t){if(!t.circular){var e=t.value||1;i+=u(t.source)*e,a+=e}}),r.sourceLinks.forEach(function(t){if(!t.circular){var e=t.value||1;i+=u(t.target)*e,a+=e}}),a>0?i/a:NaN);l.set(t,{bc:n,idx:e})}),i.sort(function(t,e){var r=l.get(t),a=l.get(e),i=r.bc,n=a.bc;if(t.circularLinkType!==e.circularLinkType){if("top"==t.circularLinkType&&"bottom"==e.circularLinkType)return-1;if("bottom"==t.circularLinkType&&"top"==e.circularLinkType)return 1;if("top"==t.circularLinkType)return-1;if("top"==e.circularLinkType||"bottom"==t.circularLinkType)return 1;if("bottom"==e.circularLinkType)return-1}return isNaN(i)||isNaN(n)?isNaN(i)?isNaN(n)?r.idx-a.idx:1:-1:i-n})}else i.sort(function(t,e){return t.circularLinkType==e.circularLinkType?f(e,r)-f(t,r):"top"==t.circularLinkType&&"bottom"==e.circularLinkType||"top"==t.circularLinkType&&0==e.partOfCycle||0==t.partOfCycle&&"bottom"==e.circularLinkType?-1:0});i.forEach(function(e,i){e.depth==a.length-1&&1==c||0==e.depth&&1==c?(e.y0=t.y1/2-e.value*t.ky,e.y1=e.y0+e.value*t.ky):e.partOfCycle?0==f(e,r)?(e.y0=t.y1/2+i,e.y1=e.y0+e.value*t.ky):"top"==e.circularLinkType?(e.y0=t.y0+i,e.y1=e.y0+e.value*t.ky):(e.y0=t.y1-e.value*t.ky-i,e.y1=e.y0+e.value*t.ky):0==t.y0||0==t.y1?(e.y0=(t.y1-t.y0)/c*i,e.y1=e.y0+e.value*t.ky):(e.y0=(t.y1-t.y0)/2-c/2+i,e.y1=e.y0+e.value*t.ky)})})}function T(t,e,r,a,i,n){function c(e,r){var a=h.length;h.forEach(function(i){var n=i.length,c=i[0].depth;i.forEach(function(i){var s;if(i.sourceLinks.length||i.targetLinks.length)if(i.partOfCycle&&f(i,r)>0){var h=kt(i.sourceLinks,o),d=kt(i.targetLinks,l),y=h&&d?(h+d)/2:h||d;if(y){var g=(y-u(i))*e*.3;i.y0+=g,i.y1+=g}}else if(0==c&&1==n)s=i.y1-i.y0,i.y0=t.y1/2-s/2,i.y1=t.y1/2+s/2;else if(c==a-1&&1==n)s=i.y1-i.y0,i.y0=t.y1/2-s/2,i.y1=t.y1/2+s/2;else if(1==i.targetLinks.length&&1==i.targetLinks[0].source.sourceLinks.length)s=i.y1-i.y0,i.y0=i.targetLinks[0].source.y0,i.y1=i.y0+s;else{var p=kt(i.sourceLinks,o),m=kt(i.targetLinks,l),x=((p&&m?(p+m)/2:p||m)-u(i))*e;i.y0+=x,i.y1+=x}})})}function s(){h.forEach(function(r){var n,c,l,o=t.y0,u=r.length;for(e?r.sort(e):r.sort(L),l=0;l<u;++l)(c=o-(n=r[l]).y0)>0&&(n.y0+=c,n.y1+=c),o=n.y1+a;if((c=o-a-t.y1)>0)for(o=n.y0-=c,n.y1-=c,l=u-2;l>=0;--l)(c=(n=r[l]).y1+i-o)>0&&(n.y0-=c,n.y1-=c),o=n.y0})}var h=mt(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});s();for(var d=1,y=n;y>0;--y)c(d*=.99,r),s()}function R(t){t.nodes.forEach(function(t){t.sourceLinks.sort(k),t.targetLinks.sort(x)}),t.nodes.forEach(function(t){var e=t.y0,r=e,a=t.y1,i=a;t.sourceLinks.forEach(function(t){t.circular?(t.y0=a-t.width/2,a-=t.width):(t.y0=e+t.width/2,e+=t.width)}),t.targetLinks.forEach(function(t){t.circular?(t.y1=i-t.width/2,i-=t.width):(t.y1=r+t.width/2,r+=t.width)})})}function _(t){let{sx:e,sTop:r,sBot:a,tx:i,tTop:n,tBot:c,cp1X:l,cp2X:o}=t,u=(r+a)/2,s=(n+c)/2;return{pathD:[`M${e},${r}`,`C${l},${r} ${o},${n} ${i},${n}`,`L${i},${c}`,`C${o},${c} ${l},${a} ${e},${a}`,"Z"].join(" "),bezier:{circular:!1,points:[{x:e,y:u},{x:l,y:u},{x:o,y:s},{x:i,y:s}],halfWidth:(a-r)/2}}}function I(t){let e=t.circularPathData;if(!e)return null;let r=t.sankeyWidth/2,a="bottom"===t.circularLinkType?1:-1,i=1===a?1:0,n="down"===t.direction,c=(t,e)=>n?`${e},${t}`:`${t},${e}`,l=(t,e,r,a,i)=>`A${n?e:t},${n?t:e} 0 0 ${n?1-r:r} ${c(a,i)}`,{sourceX:o,sourceY:u,targetX:s,targetY:f,rightInnerExtent:h,leftInnerExtent:d,rightFullExtent:y,leftFullExtent:g,verticalFullExtent:p,verticalRightInnerExtent:m,verticalLeftInnerExtent:x,rightLargeArcRadius:k,rightSmallArcRadius:L,leftLargeArcRadius:v,leftSmallArcRadius:b}=e;return`M${c(o,u-a*r)}L${c(h,u-a*r)}`+l(k+r,L+r,i,y+r,u+a*L)+`L${c(y+r,m)}`+l(k+r,k+r,i,h,p+a*r)+`L${c(d,p+a*r)}`+l(v+r,v+r,i,g-r,x)+`L${c(g-r,f+a*b)}`+l(v+r,b+r,i,d,f-a*r)+`L${c(s,f-a*r)}L${c(s,f+a*r)}L${c(d,f+a*r)}`+l(v-r,b-r,1-i,g+r,f+a*b)+`L${c(g+r,x)}`+l(v-r,v-r,1-i,d,p-a*r)+`L${c(h,p-a*r)}`+l(k-r,k-r,1-i,y-r,m)+`L${c(y-r,u+a*L)}`+l(k-r,L-r,1-i,h,u+a*r)+`L${c(o,u+a*r)}Z`}function W(t,e){if("production"===process.env.NODE_ENV||!t||!t.data||"object"!=typeof t.data)return t;let r=Bt.get(t);if(r){let t=r.get(e);if(t)return t}else r=new Map,Bt.set(t,r);let a=new Proxy(t,{get(t,r,a){if("string"==typeof r&&!(r in t)&&t.data&&r in t.data){let t=`${e}:${r}`;jt.has(t)||(jt.add(t),console.warn(`[Semiotic] "${e}" callback accessed "${r}" on the wrapper object, but it only exists on ".data". Use d.data.${r} (or d.data?.${r}) instead. Frame callbacks receive RealtimeNode/RealtimeEdge wrappers, not your raw data.`))}return Reflect.get(t,r,a)}});return r.set(e,a),a}function F(t,e,r){let a=[];for(let i of e){let e=ut(i.source),n=ut(i.target),c=null;if(e===t?c=n:n===t&&(c=e),c){let t=r.get(c);t&&(0!==t.x||0!==t.y)&&a.push({x:t.x,y:t.y})}}return a}function N(t){let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r)|0;return Math.abs(e)}function C(t,e,r){let a=t.match(/[a-zA-Z]|[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/g);if(!a)return t;let i=[],n=0;for(;n<a.length;){let t=a[n];if("M"===t||"L"===t||"C"===t||"Q"===t)for(i.push(t),n++;n<a.length&&!isNaN(Number(a[n]));)i.push(String(Number(a[n])+e)),n++,n<a.length&&!isNaN(Number(a[n]))&&(i.push(String(Number(a[n])+r)),n++);else if("A"===t)for(i.push(t),n++;n<a.length&&!isNaN(Number(a[n]));)i.push(a[n++]),n<a.length&&i.push(a[n++]),n<a.length&&i.push(a[n++]),n<a.length&&i.push(a[n++]),n<a.length&&i.push(a[n++]),n<a.length&&(i.push(String(Number(a[n])+e)),n++),n<a.length&&(i.push(String(Number(a[n])+r)),n++);else"Z"===t||"z"===t?(i.push(t),n++):(i.push(a[n]),n++)}return i.join(" ")}function z(t){let[e,r,a]=function(t){if(t.startsWith("#")){let e=t.slice(1);if(3===e.length&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),6===e.length)return[0,2,4].map(t=>parseInt(e.slice(t,t+2),16))}let e=t.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return e?[+e[1],+e[2],+e[3]]:[128,128,128]}(t);return.299*e+.587*r+.114*a>150?"#222":"#fff"}function O(t){if(t)return"function"==typeof t?t:e=>e[t]}function j(t){if(!t)return null;if("function"==typeof t){let e=t;return t=>e(t.data??t)}return e=>e.data?.[t]||e[t]||e.id}function B(t){let e=new Map(t.map(t=>[t,0]));return t.map(t=>{let r=e.get(t),a=t;for(;r>0&&e.has(a);)a=`${t}__${r++}`;return e.set(t,r||1),e.set(a,1),a})}function X(t,e,r){if(e.colorByDepth&&void 0!==t.depth){let r=function(t){return Array.isArray(t.colorScheme)?t.colorScheme:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical:Kt}(e);return r[t.depth%r.length]}return r||function(t){return Array.isArray(t.colorScheme)&&t.colorScheme.length>0?t.colorScheme[0]:t.themeSemantic?.primary?t.themeSemantic.primary:t.themeCategorical&&t.themeCategorical.length>0?t.themeCategorical[0]:"#4d430c"}(e)}function Y(t,e,r){return{fill:X(t,e,r.fill),stroke:r.stroke||e.themeSemantic?.surface||"#fff",strokeWidth:r.strokeWidth??1,opacity:r.opacity,cursor:r.cursor}}function q(t){return!t.__hierarchyNode?.children?.length}function Z(t,e,r,a,i){let n=(t+r)/2,c=(e+a)/2;return"horizontal"===i?`M ${t},${e} C ${n},${e} ${n},${a} ${r},${a}`:"radial"===i?`M ${t},${e} Q ${n},${e} ${n},${c} T ${r},${a}`:`M ${t},${e} C ${t},${c} ${r},${c} ${r},${a}`}function G(t,e,r){let a=r.treeOrientation||"vertical";if("radial"===a){let r=e.x,a=e.y;t.x=a*Math.cos(r-Math.PI/2),t.y=a*Math.sin(r-Math.PI/2)}else"horizontal"===a?(t.x=e.y,t.y=e.x):(t.x=e.x,t.y=e.y);Q(t,5)}function K(t,e){t.x0=e.x0,t.y0=e.y0,t.x1=t.value?e.x1:e.x0,t.y1=t.value?e.y1:e.y0,t.x=(t.x0+t.x1)/2,t.y=(t.y0+t.y1)/2,t.width=t.x1-t.x0,t.height=t.y1-t.y0}function V(t,e){let r=e.r??0;t.x=e.x,t.y=e.y,Q(t,r),t.__radius=r}function Q(t,e){t.x0=t.x-e,t.x1=t.x+e,t.y0=t.y-e,t.y1=t.y+e,t.width=2*e,t.height=2*e}function U(t){return t.data&&"object"==typeof t.data?t.data:t}function H(t,e,r){if(e)return r?.selectedStyle&&Object.assign(t,r.selectedStyle),t;let a=r?.unselectedOpacity??ft;return t.opacity=a,t.fillOpacity=a,t.strokeOpacity=a,r?.unselectedStyle&&Object.assign(t,r.unselectedStyle),t}function J(t,e,r){if(t)return e?a=>{let i={...t(a)};return e.isActive?H(i,e.predicate(U(a)),r):i}:t}function tt(t,e,r){if(t)return e?a=>{let i={...t(a)};if(!e.isActive)return i;let n=U(a),c="object"==typeof a.source?U(a.source):null,l="object"==typeof a.target?U(a.target):null;return H(i,c||l?!!c&&e.predicate(c)||!!l&&e.predicate(l):e.predicate(n),r)}:t}function et(t,e){if(!t)return[];let r=[],a=t=>{r.push(t);let i="function"==typeof e?e(t):t[e];i&&Array.isArray(i)&&i.forEach(a)};return a(t),r}function rt(t,e,r,a){if(t&&t.length>0)return t;let i=new Set;return e.forEach(t=>{let e="function"==typeof r?r(t):t[r],n="function"==typeof a?a(t):t[a];i.add(e),i.add(n)}),Array.from(i).map(t=>({id:t}))}function at({edgeColorBy:t,colorBy:e,colorScale:r,nodeStyleFn:a,edgeOpacity:i,baseStyle:n={}}){return c=>{let l={fillOpacity:i,...n};if("function"==typeof t)l.fill=t(c);else if("source"===t){let t="object"==typeof c.source?c.source:null;e&&t?l.fill=dt(t.data||t,e,r):t&&(l.fill=a(t,t.index).fill)}else if("target"===t){let t="object"==typeof c.target?c.target:null;e&&t?l.fill=dt(t.data||t,e,r):t&&(l.fill=a(t,t.index).fill)}else"gradient"===t&&(l.fill="#999",l.fillOpacity=.7*i);return l}}function it(t){return nt(t,"orbit",()=>({metaMap:new Map,startTime:typeof performance<"u"?performance.now():Date.now()}))}import{a as nt}from"./c-DEWMXCOF.min.js";import{a as ct,b as lt}from"./c-LHVHGQRW.min.js";import{e as ot,f as ut}from"./c-YLZIV3VS.min.js";import{a as st,e as ft}from"./c-OU7A3IUL.min.js";import{a as ht,r as dt}from"./c-WPL6PGP3.min.js";import{min as yt,group as gt,sum as pt,groups as mt,max as xt,mean as kt}from"d3-array";import{interpolateNumber as Lt}from"d3-interpolate";import{forceLink as vt,forceSimulation as bt,forceManyBody as Dt,forceCollide as Pt,forceCenter as Et,forceX as Mt,forceY as St}from"d3-force";import{ribbon as wt,chord as At}from"d3-chord";import{arc as $t,pie as Tt}from"d3-shape";import{hierarchy as Rt,cluster as _t,tree as It,treemap as Wt,treemapBinary as Ft,partition as Nt,pack as Ct}from"d3-hierarchy";var zt=class{constructor(t){this.size=t,this.maximum=new Float64Array(4*t),this.floor=new Float64Array(4*t)}query(t,e){let r=(a,i,n)=>{if(t<=i&&n<=e)return this.maximum[a];let c=i+n>>>1;return Math.max(this.floor[a],t<=c?r(2*a,i,c):0,e>c?r(2*a+1,c+1,n):0)};return r(1,0,this.size-1)}reserve(t,e,r){let a=(i,n,c)=>{if(this.maximum[i]=Math.max(this.maximum[i],r),t<=n&&c<=e)return void(this.floor[i]=Math.max(this.floor[i],r));let l=n+c>>>1;t<=l&&a(2*i,n,l),e>l&&a(2*i+1,l+1,c)};a(1,0,this.size-1)}},Ot=t=>{let{source:e,target:r}=t;if("string"==typeof e||"string"==typeof r)return null;if("down"===t.direction){let a=t.y0-t.sankeyWidth/2,i=t.y1-t.sankeyWidth/2,n=t.y1+t.sankeyWidth/2,c=t.y0+t.sankeyWidth/2,l=e.x1,o=r.x0,u=Lt(l,o),s=u(.5),f=u(.5);return`M${a},${l}C${a},${s} ${i},${f} ${i},${o}L${n},${o}C${n},${f} ${c},${s} ${c},${l}Z`}let a=t.sankeyWidth/2,i=Lt(e.x1,r.x0),{pathD:n}=_({sx:e.x1,sTop:t.y0-a,sBot:t.y0+a,tx:r.x0,tTop:t.y1-a,tBot:t.y1+a,cp1X:i(.5),cp2X:i(.5)});return n},jt=/*#__PURE__*/new Set,Bt=/*#__PURE__*/new WeakMap,Xt={left:function(t){return t.depth},right:function(t,e){return e-1-t.height},center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?Math.min.apply(Math,t.sourceLinks.map(h))-1:0},justify:d},Yt={supportsStreaming:!0,hierarchical:!1,computeLayout(e,a,c,l){let o="vertical"===c.orientation?"down":"right",u=c.nodeAlign||"justify",f=c.nodeWidth??15,h=c.nodePaddingRatio??.05,y=c.iterations??300;for(let t of a)t.sankeyWidth=0,t.circular=!1,delete t.circularPathData,delete t._circularWidth,delete t._circularStub;for(let t of e)t.value=0,t.width=t.height=0,t.x0=t.x1=t.y0=t.y1=0,t.sourceLinks=[],t.targetLinks=[];let g=new Set(e.map(t=>t.id)),p=new Set,m=a.filter(t=>{let e=ut(t.source),r=ut(t.target);return!(!Number.isFinite(t.value)||t.value<=0||!g.has(e)||!g.has(r)||(p.add(e),p.add(r),0))}).map(t=>({...t,source:ut(t.source),target:ut(t.target)}));if(0===m.length)return;let x,k=e.filter(t=>p.has(t.id)).map(t=>({...t}));x="down"===o?[[0,0],[l[1],l[0]]]:[[0,0],[l[0],l[1]]];let L=function(){function e(){var e={nodes:k.apply(null,arguments),links:L.apply(null,arguments)};return function(e){e.x0=a,e.y0=c,e.x1=l,e.y1=o,e.py=0,function(e,r){e.nodes.forEach(function(t,e){t.index=e,t.sourceLinks=[],t.targetLinks=[]});var a=function(t,e){var r=new Map;return gt(t,e).forEach(function(t,e){r.set(e,t[0])}),r}(e.nodes,r);e.links.forEach(function(e,r){e.index=r;var i=e.source,n=e.target;"object"!=typeof i&&(i=e.source=t(a,i)),"object"!=typeof n&&(n=e.target=t(a,n)),i.sourceLinks.push(e),n.targetLinks.push(e)})}(e,y),function(t,e,r){var a=0,i=null==e?function(t,e,r){let a=t.length,i=Array.from({length:a},()=>[]),n=Array.from({length:a},()=>[]),c=new Int32Array(a),l=new Int32Array(a),o=new Float64Array(a),u=new Float64Array(e.length),s=new Int32Array(a),f=t.map(t=>{let e=r(t);return`${typeof e}:${String(e)}`}),h=0;for(let t of e)t.source.index!==t.target.index&&Number.isFinite(t.value)&&(h=Math.max(h,t.value));let d=(t,e)=>f[t]<f[e]?-1:f[t]>f[e]?1:0;e.map((t,e)=>e).sort((t,r)=>d(e[t].source.index,e[r].source.index)||d(e[t].target.index,e[r].target.index)||e[t].value-e[r].value).forEach(t=>{let r=e[t],a=r.source.index,s=r.target.index;if(a===s)return;let f=Number.isFinite(r.value)&&h>0?Math.max(0,r.value)/h:0;u[t]=f,n[a].push(t),i[s].push(t),l[a]++,c[s]++,o[a]+=f,o[s]-=f});let y=t.map(t=>t.index),g=Int32Array.from(y),p=t=>0===l[t]?2:0===c[t]?1:0,m=(t,e)=>{let r=p(t),a=p(e);return r!==a?r>a:0===r&&o[t]!==o[e]?o[t]>o[e]:f[t]<f[e]||f[t]===f[e]&&t<e},x=(t,e)=>{let r=y[t];y[t]=y[e],y[e]=r,g[y[t]]=t,g[r]=e},k=(t,e=!1)=>{let r=g[t];for(;!e&&r>0;){let e=r-1>>>1;if(!m(t,y[e]))break;x(r,e),r=e}for(;2*r+1<y.length;){let e=2*r+1;if(e+1<y.length&&m(y[e+1],y[e])&&e++,!m(y[e],t))break;x(r,e),r=e}};for(let t=(y.length>>>1)-1;t>=0;t--)k(y[t],!0);let L=0,v=a-1;for(;y.length;){let t=y[0];s[t]=0===l[t]?v--:L++;let r=y.pop();g[t]=-1,y.length&&(y[0]=r,g[r]=0,k(r));for(let r of n[t]){let t=e[r].target.index;g[t]<0||(c[t]--,o[t]+=u[r],k(t))}for(let r of i[t]){let t=e[r].source.index;g[t]<0||(l[t]--,o[t]-=u[r],k(t))}}return s}(t.nodes,t.links,r):null;t.nodes.forEach(function(t){delete t.circularLinkType}),t.links.forEach(function(t){delete t.circularLinkID,delete t.circularLinkType,delete t.circularPathData,delete t._circularWidth,delete t._circularStub,t.circular=i?i[t.source.index]>=i[t.target.index]:!(e(t.source)<e(t.target)),t.circular&&(t.circularLinkID=a++)})}(e,p,y),function(t,e){var a=0,i=0;t.links.forEach(function(t){t.circular&&(t.source.circularLinkType||t.target.circularLinkType?t.circularLinkType=t.source.circularLinkType?t.source.circularLinkType:t.target.circularLinkType:t.circularLinkType=a<i?"top":"bottom","top"==t.circularLinkType?a++:i++,t.source.circularLinkType=t.circularLinkType,t.target.circularLinkType=t.circularLinkType)}),t.links.forEach(function(t){t.circular&&(t.source.circularLinkType==t.target.circularLinkType&&(t.circularLinkType=t.source.circularLinkType),r(t,e)&&(t.circularLinkType=t.source.circularLinkType))})}(e,y),function(t){t.nodes.forEach(function(t){t.partOfCycle=!1,t.value=Math.max(pt(t.sourceLinks,s),pt(t.targetLinks,s)),t.sourceLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)}),t.targetLinks.forEach(function(e){e.circular&&(t.partOfCycle=!0,t.circularLinkType=e.circularLinkType)})})}(e),function(t,e,r){if(null!=e&&t.nodes.length){t.nodes.sort(function(t,r){return e(t)<e(r)?-1:1});var a=0,i=e(t.nodes[0]);t.nodes.forEach(function(t){a=e(t)==i?a:a+1,i=e(t)==i?i:e(t),t.column=a})}var n=new Int32Array(t.nodes.length),c=[],l=1;t.nodes.forEach(function(t){t.depth=t.height=0,t.targetLinks.forEach(function(e){e.circular||n[t.index]++}),0===n[t.index]&&c.push(t)});for(var o=0;o<c.length;o++){var u=c[o];l=Math.max(l,u.depth+1),u.sourceLinks.forEach(function(t){t.circular||(t.target.depth=Math.max(t.target.depth,u.depth+1),0===--n[t.target.index]&&c.push(t.target))})}for(o=c.length-1;o>=0;o--)(u=c[o]).sourceLinks.forEach(function(t){t.circular||(u.height=Math.max(u.height,t.target.height+1))});t.nodes.forEach(function(t){t.column=null==e?r(t,l):t.column})}(e,p,g);var d=f;if(null!==h){var k=mt(e.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]}),L=xt(k,function(t){return t.length});L>1&&(d=Math.max(1,(o-c)*h/(L-1)))}(function(t,e,r){var a=mt(t.nodes,function(t){return t.column}).sort(function(t,e){return t[0]-e[0]}).map(function(t){return t[1]});t.py=e;var i=yt(a,function(e){return(t.y1-t.y0-(e.length-1)*t.py)/pt(e,function(t){return t.value})});t.ky=i,t.links.forEach(function(e){e.width=e.value*t.ky});var n=xt(t.nodes,function(t){return t.column});n>0?t.nodes.forEach(function(e){e.x0=t.x0+e.column*((t.x1-t.x0-r)/n),e.x1=e.x0+r}):t.nodes.forEach(function(e){e.x0=t.x0,e.x1=e.x0+r})})(e,d,u),$(e,p,y),T(e,p,y,d,d,m),R(e),$(e,p,y),T(e,p,y,d,d,m),R(e),function(t){let e=t;e.nodes.forEach(function(t){t.y+(t.y1-t.y0)>e.y1&&(t.y=t.y-(t.y+(t.y1-t.y0)-e.y1));var r=t.sourceLinks.slice().sort(function(t,e){return t.index-e.index});r.length>1&&r.sort(function(t,e){if(!t.circular&&!e.circular){if(t.target.column==e.target.column)return t.y1-e.y1;if(!D(t,e))return t.y1-e.y1;if(t.target.column>e.target.column){var r=i(e,t);return t.y1-r}if(e.target.column>t.target.column)return i(t,e)-e.y1}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.target.column===e.target.column?t.target.y1-e.target.y1:e.target.column-t.target.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===e.target.column?e.target.y1-t.target.y1:t.target.column-e.target.column:"top"==t.circularLinkType?-1:1:void 0});var a=t.y0;r.forEach(function(t){t.y0=a+t.width/2,a+=t.width});for(var n=0,c=r.length-1;c>=0;c--){var l=r[c];"bottom"==l.circularLinkType&&(l.y0=t.y1-n-l.width/2),n+=l.width}})}(e),e.nodes.forEach(function(t){var e=t.targetLinks.slice().sort(function(t,e){return t.index-e.index});e.length>1&&e.sort(function(t,e){if(!t.circular&&!e.circular){if(t.source.column==e.source.column)return t.y0-e.y0;if(!D(t,e))return t.y0-e.y0;if(e.source.column<t.source.column){var r=n(e,t);return t.y0-r}if(t.source.column<e.source.column)return n(t,e)-e.y0}return t.circular&&!e.circular?"top"==t.circularLinkType?-1:1:e.circular&&!t.circular?"top"==e.circularLinkType?1:-1:t.circular&&e.circular?t.circularLinkType===e.circularLinkType&&"top"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:t.source.column-e.source.column:t.circularLinkType===e.circularLinkType&&"bottom"==t.circularLinkType?t.source.column===e.source.column?t.source.y1-e.source.y1:e.source.column-t.source.column:"top"==t.circularLinkType?-1:1:void 0});var r=t.y0;e.forEach(function(t){t.y1=r+t.width/2,r+=t.width});for(var a=0,i=e.length-1;i>=0;i--){var c=e[i];"bottom"==c.circularLinkType&&(c.y1=t.y1-a-c.width/2),a+=c.width}}),function(t){var e=t.nodes,r=t.links,a=!1,i=!1;if(r.forEach(function(t){"top"==t.circularLinkType?a=!0:"bottom"==t.circularLinkType&&(i=!0)}),0==a||0==i){let a=function(e){return(e-n)/(c-n)*(t.y1-t.y0)+t.y0};var n=yt(e,function(t){return t.y0}),c=xt(e,function(t){return t.y1}),l=c-n,o=(t.y1-t.y0)/l;o<1?(e.forEach(function(t){t.y0=a(t.y0),t.y1=a(t.y1)}),r.forEach(function(t){t.y0=a(t.y0),t.y1=a(t.y1),t.width=t.width*o})):e.forEach(function(t){var e=t.y1-t.y0,r=a(t.y0)-t.y0;t.y0=a(t.y0),t.y1=t.y0+e,t.sourceLinks.forEach(function(t){t.y0=t.y0+r}),t.targetLinks.forEach(function(t){t.y1=t.y1+r})})}}(e),E(e,y,x,10,8)}(e),e}var a=0,c=0,l=1,o=1,u=24,f=8,h=null,y=S,g=d,p=void 0,m=32,x=2,k=w,L=A;return e.update=function(t){return R(t),E(t,y,x,10,8),t},e.nodeWidth=function(t){return arguments.length?(u=+t,e):u},e.nodePadding=function(t){return arguments.length?(f=+t,e):f},e.nodePaddingRatio=function(t){return arguments.length?(h=+t,e):h},e.nodes=function(t){return arguments.length?(k="function"==typeof t?t:M(t),e):k},e.links=function(t){return arguments.length?(L="function"==typeof t?t:M(t),e):L},e.nodeId=function(t){return arguments.length?(y="function"==typeof t?t:M(t),e):y},e.nodeAlign=function(t){return arguments.length?(g="function"==typeof t?t:M(t),e):g},e.nodeSort=function(t){return arguments.length?(p=t,e):p},e.iterations=function(t){return arguments.length?(m=+t,e):m},e.circularLinkGap=function(t){return arguments.length?(x=+t,e):x},e.extent=function(t){return arguments.length?(a=+t[0][0],c=+t[0][1],l=+t[1][0],o=+t[1][1],e):[[a,c],[l,o]]},e.size=function(t){return arguments.length?(a=c=0,l=+t[0],o=+t[1],e):[l-a,o-c]},e}().extent(x).links(m).nodes(k).nodeAlign(Xt[u]||d).nodeId(t=>t.id).nodeWidth(f).iterations(y);L.nodePaddingRatio&&L.nodePaddingRatio(h),L();{let t=1/0,e=-1/0,r=1/0,a=-1/0;for(let i of k)i.x0<t&&(t=i.x0),i.x1>e&&(e=i.x1),i.y0<r&&(r=i.y0),i.y1>a&&(a=i.y1);for(let i of m){if(!i.circular||!i.circularPathData)continue;let n=i.circularPathData,c=(i._circularWidth??i.width??0)/2;n.leftFullExtent-c<t&&(t=n.leftFullExtent-c),n.rightFullExtent+c>e&&(e=n.rightFullExtent+c),n.verticalFullExtent-c<r&&(r=n.verticalFullExtent-c),n.verticalFullExtent+c>a&&(a=n.verticalFullExtent+c)}let i=e-t,n=a-r,c=x[1][0],l=x[1][1];if(i>0&&n>0&&(t<0||r<0||e>c||a>l)){let e=c/i,a=l/n,o=Math.min(e,a),u=-t*o+(c-i*o)/2,s=-r*o+(l-n*o)/2;for(let t of k)t.x0=t.x0*o+u,t.x1=t.x1*o+u,t.y0=t.y0*o+s,t.y1=t.y1*o+s;for(let t of m)if(t.y0=t.y0*o+s,t.y1=t.y1*o+s,t.width=(t.width??0)*o,t._circularWidth&&(t._circularWidth*=o),t.circular&&t.circularPathData){let e=t.circularPathData;e.sourceX=e.sourceX*o+u,e.targetX=e.targetX*o+u,e.sourceY=e.sourceY*o+s,e.targetY=e.targetY*o+s,e.rightFullExtent=e.rightFullExtent*o+u,e.leftFullExtent=e.leftFullExtent*o+u,e.verticalFullExtent=e.verticalFullExtent*o+s,e.rightInnerExtent=e.rightInnerExtent*o+u,e.leftInnerExtent=e.leftInnerExtent*o+u,e.verticalRightInnerExtent=e.verticalRightInnerExtent*o+s,e.verticalLeftInnerExtent=e.verticalLeftInnerExtent*o+s,e.rightSmallArcRadius*=o,e.rightLargeArcRadius*=o,e.leftSmallArcRadius*=o,e.leftLargeArcRadius*=o,e.sourceWidth*=o,e.rightNodeBuffer*=o,e.leftNodeBuffer*=o,e.arcRadius*=o}}}let v=new Map;for(let t of e)v.set(t.id,t);for(let t of k){let e=v.get(t.id);e&&(e.x0=t.x0,e.x1=t.x1,e.y0=t.y0,e.y1=t.y1,e.value=t.value,e.depth=t.depth,e.sourceLinks=t.sourceLinks,e.targetLinks=t.targetLinks,e.width=t.x1-t.x0,e.height=t.y1-t.y0,e.x=t.x0+(t.x1-t.x0)/2,e.y=t.y0+(t.y1-t.y0)/2)}let b=new Map;for(let t of a)if(t._edgeKey)b.set(t._edgeKey,t);else{let e=ut(t.source),r=ut(t.target);b.set(`${e}\0${r}`,t)}for(let t of m){let e=ut(t.source),r=ut(t.target),a=t._edgeKey?b.get(t._edgeKey):b.get(`${e}\0${r}`);if(a){a.y0=t.y0,a.y1=t.y1,a.sankeyWidth=t.width??0,a.circular=!!t.circular,a.circularPathData=t.circularPathData,a._circularWidth=t._circularWidth,a._circularStub=t._circularStub,a.path=t.path,a.circularLinkType=t.circularLinkType,a.direction=o;let i=v.get(e),n=v.get(r);i&&(a.source=i),n&&(a.target=n)}}},buildScene(t,e,r,a){let i="vertical"===r.orientation?"down":"right",n=r.nodeStyle,c=r.edgeStyle,l=r.edgeOpacity??.5,o=r.edgeColorBy||"source",u=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:ht,s=new Map;t.forEach((t,e)=>{s.set(t.id,u[e%u.length])});let f=[],h=[],d=[],y=new Map;for(let e of t){let t=e.x1-e.x0,r=e.y1-e.y0;if(e.value<=0||t<=0||r<=0)continue;let a=n?n(W(e,"nodeStyle")):{},c={fill:a.fill||s.get(e.id)||"#4d430c",stroke:a.stroke,strokeWidth:a.strokeWidth,opacity:a.opacity,cursor:a.cursor};y.set(e.id,("string"==typeof c.fill?c.fill:null)||s.get(e.id)||"#4d430c");let l={...e.data,value:e.data?.value??e.value};"down"===i?f.push({type:"rect",x:e.y0,y:e.x0,w:r,h:t,style:c,accessibleDatum:l,datum:e,id:e.id,label:e.id}):f.push({type:"rect",x:e.x0,y:e.y0,w:t,h:r,style:c,accessibleDatum:l,datum:e,id:e.id,label:e.id})}let g=[...e].sort((t,e)=>(e.sankeyWidth||0)-(t.sankeyWidth||0));for(let t of g){if(!(t.value>0)||!t.sankeyWidth||t.sankeyWidth<=0)continue;let e="object"==typeof t.source?t.source:null,a="object"==typeof t.target?t.target:null;if(!e||!a)continue;let i=r.themeSemantic?.border||r.themeSemantic?.secondary||"#999";i="function"==typeof o?o(t)||i:"target"===o?y.get(a.id)||s.get(a.id)||i:y.get(e.id)||s.get(e.id)||i;let n,u=c?c(W(t,"edgeStyle")):{};if(n=t.circular&&t.circularPathData?I(t):Ot(t),!n)continue;let f={fill:u.fill||i,fillOpacity:u.fillOpacity??l,stroke:u.stroke||"none",strokeWidth:u.strokeWidth,strokeOpacity:u.strokeOpacity,opacity:u.opacity,cursor:u.cursor};h.push({type:"bezier",pathD:n,bezierCache:t.bezier,style:f,accessibleDatum:t.data,datum:t})}if(!1!==r.showLabels){let e=ot(r.nodeLabel);for(let r of t){let t=r.x1-r.x0,n=r.y1-r.y0;if(r.value<=0||t<=0||n<=0)continue;let c,l,o,u=e?e(r):r.id;if(u){if("down"===i)c=r.y0+(r.y1-r.y0)/2,l=r.x1+14,o="start";else{let e=a[0]/2;r.x0+t/2<e?(c=r.x0-6,o="end"):(c=r.x1+6,o="start"),l=r.y0+n/2}d.push({x:c,y:l,text:String(u),anchor:"down"===i?"middle":o,baseline:"middle",fontSize:11})}}}return{sceneNodes:f,sceneEdges:h,labels:d}}},qt={supportsStreaming:!0,hierarchical:!1,computeLayout(t,e,r,a){if(0===t.length)return;let i=r.forceStrength??.1,n=a[0]/2,c=a[1]/2,l=Math.max(.1,Math.min(1,Math.min(a[0],a[1])/200)),o=Math.min(.5,.06+1.8*(1-l)),u=r.__previousPositions,s=0,f=[];for(let e of t){let t=!1!==e.__hasPosition&&Number.isFinite(e.x)&&Number.isFinite(e.y),r=u?.get(e.id);t?s++:r?(e.x=r.x,e.y=r.y,s++):f.push(e)}let h=t.length>0?f.length/t.length:1,d=s>0&&h<=.3;if(d){let r=new Map;for(let e of t)r.set(e.id,e);for(let t of f){let a=F(t.id,e,r);if(a.length>0){let e=0,r=0;for(let t of a)e+=t.x,r+=t.y;let i=N(t.id),n=i%360*(Math.PI/180),c=(10+i%20)*l;t.x=e/a.length+c*Math.cos(n),t.y=r/a.length+c*Math.sin(n)}else{let e=N(t.id),r=e%360*(Math.PI/180),a=(15+e%30)*l;t.x=n+a*Math.cos(r),t.y=c+a*Math.sin(r)}}}else{let e=Math.PI*(3-Math.sqrt(5));for(let r=0;r<t.length;r++){let a=t[r];if(!1===a.__hasPosition||!Number.isFinite(a.x)||!Number.isFinite(a.y)){let t=10*Math.sqrt(r+.5)*l,i=r*e;a.x=n+t*Math.cos(i),a.y=c+t*Math.sin(i)}}}for(let e of t)e.__hasPosition=!0;let y=t.length,g=r.iterations??Math.max(50,Math.min(300,Math.floor(300-2*(y-30)))),p=r.__skipForceSimulation||0===r.iterations?0:d?40:g,m=ct(r.nodeSize,r.nodeSizeRange,t);if(p>0){let u=new Map,s=new Map;for(let e of t)u.set(e.id,0),s.set(e.id,e);for(let t of e){let e=ut(t.source),r=ut(t.target);u.set(e,(u.get(e)??0)+1),u.set(r,(u.get(r)??0)+1)}let f=vt().strength(t=>{let e=lt(t),r=ut(t.source),a=ut(t.target),n=Math.max(1,Math.min(u.get(r)??1,u.get(a)??1)),c=e&&e>0?Math.sqrt(e):1;return Math.min(2.5,c*i/(.1*n))}).distance(t=>{let e="string"==typeof t.source?s.get(t.source):t.source,r="string"==typeof t.target?s.get(t.target):t.target,a=(e?m(e):0)+(r?m(r):0)+Math.max(6,12*l);return Math.max(16,40*l,a)}).id(t=>t.id),h=bt();if((void 0!==r.random||void 0!==r.seed)&&h.randomSource(r.random??st(r.seed)),h.force("charge",Dt().strength(t=>{let e=u.get(t.id)??0;return-15*l*m(t)*Math.sqrt(e+1)})).force("collide",Pt(t=>m(t)+3*l).strength(.9).iterations(2)).force("center",Et(n,c).strength(.8)).force("x",Mt(n).strength(o)).force("y",St(c).strength(o)).force("bounds",function(t,e,r=2,a=.6){let i=[],n=n=>{let c=a*Math.max(n,.2);for(let a of i){let i=a.x??t[0]/2,n=a.y??t[1]/2,l=a.vx??0,o=a.vy??0,u=e(a)+r,s=Math.min(t[0]/2,u),f=Math.max(t[0]/2,t[0]-u),h=Math.min(t[1]/2,u),d=Math.max(t[1]/2,t[1]-u),y=i+l,g=n+o;y<s?a.vx=l+(s-y)*c:y>f&&(a.vx=l+(f-y)*c),g<h?a.vy=o+(h-g)*c:g>d&&(a.vy=o+(d-g)*c)}};return n.initialize=t=>{i=t},n}(a,m)),h.nodes(t),e.length>0){let t=e.map(t=>({...t,source:ut(t.source),target:ut(t.target)}));f.links(t),h.force("link",f)}d?h.alpha(.3):h.alpha()<.1&&h.alpha(1),h.stop();for(let t=0;t<p;++t)h.tick()}for(let e of t){if(null==e.x||null==e.y)continue;let t=m(e),r=p>0?2:0,i=Math.min(a[0]/2,t+r),n=Math.min(a[1]/2,t+r);e.x=Math.max(i,Math.min(a[0]-i,e.x)),e.y=Math.max(n,Math.min(a[1]-n,e.y)),e.x0=0,e.x1=0,e.y0=0,e.y1=0}let x=new Map;for(let e of t)x.set(e.id,e);for(let t of e){if("string"==typeof t.source){let e=x.get(t.source);e&&(t.source=e)}if("string"==typeof t.target){let e=x.get(t.target);e&&(t.target=e)}}},buildScene(t,e,r,a){let i=r.nodeStyle,n=r.edgeStyle,c=ct(r.nodeSize,r.nodeSizeRange,t),l=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:ht,o=new Map;t.forEach((t,e)=>{o.set(t.id,l[e%l.length])});let u=[],s=[],f=[];for(let e of t){if(null==e.x||null==e.y)continue;let t=c(W(e,"nodeSize")),a=i?i(W(e,"nodeStyle")):{},n={fill:a.fill||o.get(e.id)||r.themeSemantic?.primary||"#007bff",stroke:a.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??2,opacity:a.opacity,cursor:a.cursor};u.push({type:"circle",cx:e.x,cy:e.y,r:t,style:n,accessibleDatum:e.data,datum:e,id:e.id,label:e.id})}let h=new Map;for(let e of t)h.set(e.id,e);for(let t of e){let e="object"==typeof t.source?t.source:h.get(t.source),a="object"==typeof t.target?t.target:h.get(t.target);if(!e||!a||null==e.x||null==e.y||null==a.x||null==a.y)continue;let i=n?n(W(t,"edgeStyle")):{},c={stroke:i.stroke||r.themeSemantic?.border||r.themeSemantic?.secondary||"#999",strokeWidth:i.strokeWidth??1,opacity:i.opacity??.6,cursor:i.cursor};s.push({type:"line",x1:e.x,y1:e.y,x2:a.x,y2:a.y,style:c,accessibleDatum:t.data,datum:t})}if(!1!==r.showLabels){let e=ot(r.nodeLabel);for(let r of t){if(null==r.x||null==r.y)continue;let t=e?e(r):r.id;if(!t)continue;let a=c(W(r,"nodeSize"));f.push({x:r.x,y:r.y-a-4,text:String(t),anchor:"middle",baseline:"auto",fontSize:11,anchorPoint:[r.x,r.y]})}}return{sceneNodes:u,sceneEdges:s,labels:f}}},Zt=ht,Gt={supportsStreaming:!1,hierarchical:!1,computeLayout(t,e,r,a){for(let e of t)delete e.__arcData;for(let t of e)delete t.__chordData,delete t.__chordEdges;if(0===t.length)return;let{padAngle:i=.01,groupWidth:n=20,sortGroups:c}=r,l=Math.min(a[0],a[1])/2,o=l-n,u=a[0]/2,s=a[1]/2,f=new Map(t.map(t=>[t.id,t])),h=new Set,d=e.filter(t=>{let e=ut(t.source),r=ut(t.target);return!(!Number.isFinite(t.value)||t.value<=0||!f.has(e)||!f.has(r)||(h.add(e),h.add(r),0))}),y=t.filter(t=>h.has(t.id)),g=y.length;if(0===g)return;let p=new Map(y.map((t,e)=>[t.id,e])),m=Array.from({length:g},()=>new Array(g).fill(0)),x=new Map;for(let t of d){let e=ut(t.source),r=ut(t.target),a=p.get(e),i=p.get(r);m[a][i]+=t.value;let n=a<=i?`${a}\0${i}`:`${i}\0${a}`,c=x.get(n);c?c.push(t):x.set(n,[t])}let k=Math.min(Number.isFinite(i)?Math.max(0,i):.01,Math.PI/g),L=At().padAngle(k);c&&L.sortGroups(c);let v=L(m),b=v.groups,D=$t().innerRadius(o).outerRadius(l);for(let t of b){let e=y[t.index],r={innerRadius:o,outerRadius:l,startAngle:t.startAngle,endAngle:t.endAngle},a=D.centroid(r);e.x=a[0]+u,e.y=a[1]+s,e.__arcData={startAngle:t.startAngle,endAngle:t.endAngle}}for(let t of e){let e=ut(t.source),r=ut(t.target),a=f.get(e),i=f.get(r);a&&(t.source=a),i&&(t.target=i)}for(let t of v){let e=t.source.index,r=t.target.index,a=e<=r?`${e}\0${r}`:`${r}\0${e}`,i=x.get(a);for(let e of i)e.__chordData=t,e.__chordEdges=i}},buildScene(t,e,r,a){let{groupWidth:i=20,edgeOpacity:n=.5}=r,c=Math.min(a[0],a[1])/2,l=c-i,o=a[0]/2,u=a[1]/2,s=r.nodeStyle,f=r.edgeStyle,h=r.edgeColorBy||"source",d=Array.isArray(r.colorScheme)?r.colorScheme:r.themeCategorical&&r.themeCategorical.length>0?r.themeCategorical:Zt,y=new Map;t.forEach((t,e)=>{y.set(t.id,d[e%d.length])});let g=wt().radius(l),p=[],m=[],x=[];for(let e=0;e<t.length;e++){let r=t[e],a=r.__arcData;if(!a)continue;let i=s?s(W(r,"nodeStyle")):{},n={fill:("string"==typeof i.fill?i.fill:void 0)||y.get(r.id)||d[e%d.length],stroke:i.stroke||"black",strokeWidth:i.strokeWidth??1,opacity:i.opacity,cursor:i.cursor};p.push({type:"arc",cx:o,cy:u,innerR:l,outerR:c,startAngle:a.startAngle-Math.PI/2,endAngle:a.endAngle-Math.PI/2,style:n,accessibleDatum:r.data,datum:r,id:r.id,label:r.id})}let k=new Set,L=t.filter(t=>t.__arcData);for(let t of e){let e=t.__chordData;if(!e||k.has(e))continue;k.add(e);let a=L[e.source.index].id;for(let e of t.__chordEdges||[])ut(e.source)===a&&(t=e);let i=g(e);if(!i)continue;let c=C(i,o,u),l=r.themeSemantic?.border||r.themeSemantic?.secondary||"#999",s=f?f(W(t,"edgeStyle")):{};if(f)l=("string"==typeof s.fill?s.fill:void 0)||l;else{let e="object"==typeof t.source?t.source:null,r="object"==typeof t.target?t.target:null;"target"===h&&r?l=y.get(r.id)||l:e&&(l=y.get(e.id)||l)}let d={fill:l,fillOpacity:s.fillOpacity??n,stroke:s.stroke||"none",strokeWidth:s.strokeWidth,strokeOpacity:s.strokeOpacity,opacity:s.opacity,cursor:s.cursor};m.push({type:"ribbon",pathD:c,style:d,accessibleDatum:t.data,datum:t})}if(!1!==r.showLabels){let e=ot(r.nodeLabel),a=c+12;for(let r of t){let t=r.__arcData;if(!t)continue;let i=e?e(r):r.id;if(!i)continue;let n=(t.startAngle+t.endAngle)/2,c=n-Math.PI/2,l=o+Math.cos(c)*a,s=u+Math.sin(c)*a,f=n>Math.PI?"end":"start";x.push({x:l,y:s,text:String(i),anchor:f,baseline:"middle",fontSize:11})}}return{sceneNodes:p,sceneEdges:m,labels:x}}},Kt=["#e8d5b7","#b8d4e3","#d4e3b8","#e3c4d4","#d4d4e3","#e3d4b8","#b8e3d4","#e3b8b8"],Vt={supportsStreaming:!1,hierarchical:!0,computeLayout(t,e,r,a){let i=r.__hierarchyRoot;if(!i)return;let n=r.chartType,c=O(r.childrenAccessor),l=Rt(i,c),o=[];l.eachBefore(t=>o.push(t));let u=B(o.map((t,e)=>function(t,e,r){let a=e.nodeIDAccessor,i=t.data;return String("function"==typeof a?a(i):"string"==typeof a&&void 0!==i[a]?i[a]:void 0!==i.name?i.name:void 0!==i.id?i.id:`node-${r}`)}(t,r,e)));l.sum(function(t="value"){let e="function"==typeof t?t:e=>e[t];return t=>{let r=e(t),a="string"==typeof r?Number(r):r;return Number.isFinite(a)&&a>0?a:0}}(r.hierarchySum)).sort((t,e)=>e.value-t.value);let[s,f]=a;switch(n){case"tree":case"cluster":!function(t,e,r,a){let i=e.treeOrientation||"vertical",n="cluster"===e.chartType?_t():It();if("horizontal"===i)n.size([a,r]);else if("radial"===i){let t=Math.min(r,a)/2;n.size([2*Math.PI,.8*t])}else n.size([r,a]);n(t)}(l,r,s,f);break;case"treemap":case"partition":!function(t,e,r,a){let i="treemap"===e.chartType,n=i?Wt().tile(Ft):Nt();n.size([r,a]).padding(e.padding??(i?4:1)),"paddingTop"in n&&e.paddingTop>0&&n.paddingTop(e.paddingTop),n(t)}(l,r,s,f);break;case"circlepack":!function(t,e,r,a){let i=e.padding??4,n=Ct().size([r,a]).padding(i);t.leaves().some(t=>t.value)||n.radius(()=>0).padding(0),n(t)}(l,r,s,f)}let h=l.descendants();t.length=0,e.length=0;let d=new Map(o.map((t,e)=>[t,{id:u[e],x:0,y:0,x0:0,x1:0,y0:0,y1:0,width:0,height:0,value:t.value,depth:t.depth,data:t.data,createdByFrame:!0}]));for(let e of h){let a=d.get(e);"tree"===n||"cluster"===n?G(a,e,r):"treemap"===n||"partition"===n?K(a,e):"circlepack"===n&&V(a,e),a.__hierarchyNode=e,t.push(a)}if("tree"===n||"cluster"===n)for(let t of h)if(t.parent){let r=d.get(t.parent),a=d.get(t);e.push({source:r,target:a,value:1,y0:0,y1:0,sankeyWidth:0,data:{depth:t.depth}})}},buildScene(t,e,r,a){let i=r.chartType,n=r.nodeStyle||(()=>({})),c=r.edgeStyle||(()=>({}));switch(i){case"tree":case"cluster":return function(t,e,r,a,i,n){let c=[],l=[],o=[],u=r.treeOrientation||"vertical",s="radial"===u,f=a[0]/2,h=a[1]/2,{nodeSize:d}=r,y="number"==typeof d?d:5;for(let e of t){let t=e.x,a=e.y;s&&(t+=f,a+=h);let n=Y(e,r,i(W(e,"nodeStyle")));c.push({type:"circle",cx:t,cy:a,r:y,style:n,accessibleDatum:{...e.data,value:e.data?.value??e.value},datum:e,id:e.id,label:e.id,depth:e.depth})}let g=r.edgeOpacity??.5;for(let t of e){let e="object"==typeof t.source?t.source:null,a="object"==typeof t.target?t.target:null;if(!e||!a)continue;let i=e.x,c=e.y,o=a.x,d=a.y;s&&(i+=f,c+=h,o+=f,d+=h);let y=Z(i,c,o,d,u),p=n(W(t,"edgeStyle")),m={fill:"none",stroke:p.stroke||r.themeSemantic?.border||r.themeSemantic?.secondary||"#999",strokeWidth:p.strokeWidth??1.5,opacity:p.opacity??g,cursor:p.cursor};l.push({type:"curved",pathD:y,style:m,datum:t})}if(!1!==r.showLabels){let e=j(r.nodeLabel);for(let r of t){let t=e?e(r):r.id;if(!t)continue;let a,i,n,c=r.x,l=r.y;if(s&&(c+=f,l+=h),s){let t=c-f,e=l-h,r=Math.sqrt(t*t+e*e);r>0?(a=c+t/r*10,i=l+e/r*10,n=t>=0?"start":"end"):(a=c,i=l-12,n="middle")}else"horizontal"===u?(q(r)?(a=c+y+6,n="start"):(a=c-y-6,n="end"),i=l):(a=c,i=l+y+14,n="middle");o.push({x:a,y:i,text:String(t),anchor:n,baseline:"middle",fontSize:11,anchorPoint:[c,l]})}}return{sceneNodes:c,sceneEdges:l,labels:o}}(t,e,r,a,n,c);case"treemap":case"partition":return function(t,e,r){let a=[],i=[];for(let i of t){let t=i.x1-i.x0,n=i.y1-i.y0;if(t<=0||n<=0)continue;let c=r(W(i,"nodeStyle")),l=Y(i,e,c);l.fillOpacity=c.fillOpacity,l.strokeOpacity=c.strokeOpacity,a.push({type:"rect",x:i.x0,y:i.y0,w:t,h:n,style:l,accessibleDatum:{...i.data,value:i.data?.value??i.value},datum:i,id:i.id,label:i.id,depth:i.depth})}if(!1!==e.showLabels){let a=j(e.nodeLabel),n=e.labelMode||"leaf",c="partition"===e.chartType;for(let l of t){let t=l.x1-l.x0,o=l.y1-l.y0;if(t<=0||o<=0)continue;let u=q(l);if(!c&&("leaf"===n&&!u||"parent"===n&&u))continue;let s=a?a(l):l.id;if(!s)continue;if(t<(u?30:40)||o<(u?16:14))continue;let f=X(l,e,r(W(l,"nodeStyle")).fill),h="string"==typeof f?z(f):e.themeSemantic?.text??"#000";u?i.push({x:l.x0+t/2,y:l.y0+o/2,text:String(s),anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,Math.min(t,o)/6)),fill:h}):i.push({x:l.x0+4,y:l.y0+12,text:String(s),anchor:"start",baseline:"auto",fontSize:11,fontWeight:600,fill:h})}}return{sceneNodes:a,sceneEdges:[],labels:i}}(t,r,n);case"circlepack":return function(t,e,r){let a=[],i=[];for(let i of t){let t=i.__radius??5;if(t<=0)continue;let n=Y(i,e,r(W(i,"nodeStyle")));n.opacity??(n.opacity=.7),a.push({type:"circle",cx:i.x,cy:i.y,r:t,style:n,accessibleDatum:{...i.data,value:i.data?.value??i.value},datum:i,id:i.id,label:i.id,depth:i.depth})}if(!1!==e.showLabels){let a=j(e.nodeLabel);for(let n of t){let t=n.__radius??5,c=a?a(n):n.id;if(!c||t<15)continue;let l=q(n),o=X(n,e,r(W(n,"nodeStyle")).fill);if(l){let r="string"==typeof o?z(o):e.themeSemantic?.text??"#000";i.push({x:n.x,y:n.y,text:String(c),anchor:"middle",baseline:"middle",fontSize:Math.min(11,Math.max(8,t/3)),fill:r})}else i.push({x:n.x,y:n.y-t+14,text:String(c),anchor:"middle",baseline:"hanging",fontSize:Math.min(11,Math.max(8,t/3)),fill:e.themeSemantic?.text||"#000",stroke:e.themeSemantic?.surface||"#fff",strokeWidth:3,paintOrder:"stroke"})}}return{sceneNodes:a,sceneEdges:[],labels:i}}(t,r,n);default:return{sceneNodes:[],sceneEdges:[],labels:[]}}}},Qt={supportsStreaming:!1,hierarchical:!0,supportsAnimation:!0,computeLayout(t,e,r,a){let i=r.__hierarchyRoot;i&&function(t,e,r,a,i){let n=O(r.childrenAccessor||"children"),c=function(t){if("function"==typeof t)return t;let e=t||"name";return t=>String(t[e]??"")}(r.nodeIDAccessor),l=function(t){if(Array.isArray(t))return t;switch(t){case"solar":return[1];case"atomic":return[2,8];default:return[9999]}}(r.orbitMode),o=r.orbitSize??2.95,u=r.orbitEccentricity??1,s="number"==typeof o?()=>o:o,f="number"==typeof u?()=>u:u,h=it(r);h.metaMap.clear(),a.length=0,i.length=0;let d=B(et(t,n).map(t=>String(c(t)))),y=0,g=e[0]/2,p=e[1]/2,m=Math.min(e[0],e[1])/2*.85,x=d[y++],k={id:x,x:g,y:p,x0:g,x1:g,y0:p,y1:p,width:0,height:0,value:0,depth:0,data:t};a.push(k),h.metaMap.set(x,{ring:m,angle:0,depth:0,parentId:null,eccentricity:1}),function t(e,r,c,o,u,g,p){let m=n(e);if(!m?.length)return;let x=m.length,k=0,L=0,v=0;for(;L<x;)L+=l[Math.min(v,l.length-1)],v++,k++;let b=0;for(let x=0;x<k;x++){let L=l[Math.min(x,l.length-1)],v=m.slice(b,b+L);if(!v.length)break;let D=(x+1)/k,P={id:r,depth:g,data:e,parentId:r},E=p?u/s(P)*D:u*D,M=Tt().value(t=>n(t)?.length?4:1).sort(null)(v),S=f(P);for(let e=0;e<v.length;e++){let n=(M[e].startAngle+M[e].endAngle)/2,l=v[e],u=d[y++],s=c+E*Math.sin(n),f=o+E*Math.cos(n)*S,p={id:u,x:s,y:f,x0:s,x1:s,y0:f,y1:f,width:0,height:0,value:0,depth:g,data:l};a.push(p),h.metaMap.set(u,{ring:E,angle:n,depth:g,parentId:r,eccentricity:S}),i.push({source:r,target:u,value:1,y0:0,y1:0,sankeyWidth:0,data:{source:r,target:u}}),t(l,u,s,f,E,g+1,!0)}b+=L}}(t,x,g,p,m,1,!1)}(i,a,r,t,e)},buildScene(t,e,r,a){let i=r.nodeStyle,n=r.edgeStyle,c=r.nodeSize,l="number"==typeof c?()=>c:"function"==typeof c?c:()=>6,o=[],u=[],s=[];if(!1!==r.orbitShowRings){let e=it(r),a=new Map;for(let e of t)a.set(e.id,e);let i=new Map;for(let[,t]of e.metaMap){if(!t.parentId)continue;let e=a.get(t.parentId);if(!e)continue;let r=`${t.parentId}:${t.ring}`;i.has(r)||i.set(r,{parentX:e.x,parentY:e.y,ring:t.ring,ecc:t.eccentricity})}let n=48,c={stroke:"rgba(128,128,128,0.35)",strokeWidth:.5,opacity:1};for(let[,{parentX:t,parentY:e,ring:r,ecc:a}]of i)for(let i=0;i<n;i++){let l=i/n*Math.PI*2,o=(i+1)/n*Math.PI*2;u.push({type:"line",x1:t+r*Math.sin(l),y1:e+r*Math.cos(l)*a,x2:t+r*Math.sin(o),y2:e+r*Math.cos(o)*a,style:c,interactive:!1,datum:null})}}for(let e of t){if(null==e.x||null==e.y)continue;let t=l(W(e,"nodeSize")),a=i?i(W(e,"nodeStyle")):{},n={fill:a.fill||r.themeSemantic?.primary||"#6366f1",stroke:a.stroke||r.themeSemantic?.surface||"#fff",strokeWidth:a.strokeWidth??1,opacity:a.opacity??(0===(e.depth??0)?1:.85),cursor:a.cursor};o.push({type:"circle",cx:e.x,cy:e.y,r:t,style:n,accessibleDatum:e.data,datum:e,id:e.id,label:e.id,depth:e.depth})}let f=new Map;for(let e of t)f.set(e.id,e);for(let t of e){let e="object"==typeof t.source?t.source:f.get(t.source),r="object"==typeof t.target?t.target:f.get(t.target);if(!e||!r||null==e.x||null==r.x)continue;let a=n?n(W(t,"edgeStyle")):{},i={stroke:a.stroke||"rgba(128,128,128,0.35)",strokeWidth:a.strokeWidth??.5,opacity:a.opacity??1,cursor:a.cursor};u.push({type:"line",x1:e.x,y1:e.y,x2:r.x,y2:r.y,style:i,datum:t})}if(r.showLabels){let e=r.nodeLabel;for(let r of t){let t=l(W(r,"nodeSize"));if(t<=4)continue;let a="function"==typeof e?e(r):e?r.data?.[e]??r.id:r.id;s.push({x:r.x,y:r.y+t+12,text:String(a),anchor:"middle",fontSize:10,fill:"currentColor",anchorPoint:[r.x,r.y]})}}return{sceneNodes:o,sceneEdges:u,labels:s}},tick:(t,e,r,a,i)=>!1!==r.orbitAnimated&&(function(t,e){let r=it(e),a=e.orbitSpeed??.25,i=e.orbitRevolution??function(t){switch(t){case"decay":return t=>Math.pow(.6,t.depth??0);case"alternate":return t=>{let e=t.depth??0;return(e%2==0?1:-1)/(e+1)};default:return t=>1/((t.depth??0)+1)}}(e.orbitRevolutionStyle),n=((typeof performance<"u"?performance.now():Date.now())-r.startTime)/1e3,c=a*(Math.PI/6),l=new Map;for(let e of t)l.set(e.id,e);for(let e of t){let t=r.metaMap.get(e.id);if(!t||!t.parentId)continue;let a=l.get(t.parentId);if(!a)continue;let o={id:e.id,depth:t.depth,data:e.data,parentId:t.parentId},u=t.angle+n*c*i(o);e.x=a.x+t.ring*Math.sin(u),e.y=a.y+t.ring*Math.cos(u)*t.eccentricity,e.x0=e.x,e.x1=e.x,e.y0=e.y,e.y1=e.y}}(t,r),!0)};export{_ as a,Yt as b,qt as c,Gt as d,Vt as e,J as f,tt as g,et as h,rt as i,at as j,Qt as k};
@@ -1 +1 @@
1
- import{a as e,c as t,d as i,b as o}from"./c-YGTMWEEF.min.js";import{k as l,b as r}from"./c-ZWJDTDEV.min.js";import{a}from"./c-NHZ2E3CI.min.js";import{a as n}from"./c-3UXQGCQT.min.js";import{f as s,e as c,h as f,g as u}from"./c-ZYMXDR42.min.js";import{a as g}from"./c-COP4OISO.min.js";import{a as m}from"./c-6WJKNYIG.min.js";import{b as h,c as y}from"./c-YLZIV3VS.min.js";import{d as p,c as d}from"./c-SIQVOV6A.min.js";import{c as b,d as v,s as S}from"./c-WPL6PGP3.min.js";import{c as k}from"./c-ELGOCAEY.min.js";import{f as w,a as x,b as M}from"./c-5PCO2P5Q.min.js";import{b as C,c as N}from"./c-7BVQDXFU.min.js";var T={chartType:"stackedarea",buildScene:(e,t)=>l(e,t),canvasRenderers:[a,g]};function A(e,t){let i=[],o="bubble"===e.config.chartType?10:5,l=e.config.sizeRange||[3,15],r=null;if(e.getSize&&!e.config.pointStyle){let i=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(i.length>0){let e=1/0,t=-1/0;for(let o of i)o<e&&(e=o),o>t&&(t=o);r=i=>e===t?(l[0]+l[1])/2:l[0]+(i-e)/(t-e)*(l[1]-l[0])}}let a=e.getColor?e.resolveColorMap(t):null,n=e.config.themeSemantic?.primary||"#4e79a7",f=e.getSymbol,u=f?k(f,e.config.symbolMap):null;for(let l of t){let t=e.config.pointStyle?e.config.pointStyle(l):{fill:n,opacity:.8},f=t.r||o;if(r&&e.getSize){let t=e.getSize(l);null!=t&&!Number.isNaN(t)&&(f=r(t))}if(a&&e.getColor&&!t.fill){let i=e.getColor(l);i&&a.has(i)&&(t={...t,fill:a.get(i)})}let g=e.getPointId?String(e.getPointId(l)):void 0;if(u){let o=u(l),r=s(l,e.scales,e.getX,e.getY,Math.PI*f*f,o,t,g);r&&i.push(r)}else{let o=c(l,e.scales,e.getX,e.getY,f,t,g);o&&i.push(o)}}return i}var F=[g,m],W={chartType:"scatter",buildScene:(e,t)=>A(e,t),canvasRenderers:F},j={chartType:"bubble",buildScene:(e,t)=>A(e,t),canvasRenderers:F},P=/*#__PURE__*/new Map;function Y(e,t,i){return t===i?Math.floor(128):Math.min(Math.floor(255*(e-t)/(i-t)+.5),255)}function R(e){let t=Object.prototype.hasOwnProperty.call(b,e)?e:"blues",i=P.get(t);if(i)return i;i=new Array(256);let o=v(t);for(let e=0;e<256;e++)i[e]=o(e/255);return P.set(t,i),i}function E(e){if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)?{key:t,label:e,numeric:!0,temporal:!0}:{key:"Invalid Date",label:"Invalid Date",numeric:!1,temporal:!1}}return"number"==typeof e&&Number.isFinite(e)?{key:e,label:e,numeric:!0,temporal:!1}:{key:String(e),label:String(e),numeric:!1,temporal:!1}}function V(e,t){let i=t.map((e,t)=>({label:e,previous:t})).sort((e,t)=>X(e.label)-X(t.label)),o=new Map;i.forEach((e,t)=>o.set(e.previous,t));let l=Array.from(e.keys());e.clear();for(let t=0;t<l.length;t++)e.set(l[t],o.get(t));t.length=i.length;for(let e=0;e<i.length;e++)t[e]=i[e].label}function X(e){return e instanceof Date?e.getTime():Number(e)}function z(e,t,i){let o=i.config.areaStyle?.(t);return o&&("string"==typeof o.fill&&(e.fill=o.fill),e.style=o),e}function I(e,t,i){let o=Math.max(1,Math.floor(e.config.heatmapXBins??20)),l=Math.max(1,Math.floor(e.config.heatmapYBins??20)),r=e.config.heatmapAggregation??"count",a=h(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];let[n,s]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),g=(s-n||1)/o,m=(u-c||1)/l,y=o*l;if(y>1e6)return[];let p=new Int32Array(y),d=new Float64Array(y),b=e.config.trackHoverRows||w(e.config.areaStyle)?new Map:void 0;for(let i=0;i<t.length;i++){let r=t[i],s=e.getX(r),f=e.getY(r);if(!isFinite(s)||!isFinite(f))continue;let u=Math.min(Math.floor((s-n)/g),o-1),h=Math.min(Math.floor((f-c)/m),l-1);if(u<0||h<0)continue;let y=h*o+u;p[y]++;let v=a(r);if(d[y]+=isFinite(v)?v:0,b){let e=b.get(y);e||(e=[],b.set(y,e)),e.push(r)}}let v=1/0,S=-1/0;for(let e=0;e<y;e++){if(0===p[e])continue;let t;switch(r){case"sum":t=d[e];break;case"mean":t=d[e]/p[e];break;default:t=p[e]}t<v&&(v=t),t>S&&(S=t)}if(!isFinite(v))return[];let k=e.config.heatmapColorScale,M="string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues",C=k?void 0:R(M),N=i.width/o,T=i.height/l,A=e.config.showValues,F=e.config.heatmapValueFormat,W=[];for(let t=0;t<l;t++){let i=t*o;for(let a=0;a<o;a++){let o,s=i+a;if(0===p[s])continue;switch(r){case"sum":o=d[s];break;case"mean":o=d[s]/p[s];break;default:o=p[s]}let u=Y(o,v,S),h=k?k(o):C[u],y=A?{value:o,showValues:!0,valueFormat:F}:{value:o},w=n+(a+.5)*g,M=c+(t+.5)*m,j=x({xi:a,yi:t,value:o,count:p[s],sum:d[s],xCenter:w,yCenter:M,agg:r},b?.get(s));W.push(z(f(a*N,(l-1-t)*T,N,T,h,j,y),j,e))}}return W}var O={chartType:"heatmap",buildScene:(e,t,i)=>function(e,t,i){if(e.config.heatmapAggregation)return I(e,t,i);if(0===t.length)return[];let o=h(e.config.valueAccessor,"value"),l=y(e.config.xAccessor,"x"),r=y(e.config.yAccessor,"y"),a=new Map,n=new Map,s=[],c=[],u=new Array(t.length),g=new Array(t.length),m=!0,p=!0,d=!0,b=!0;for(let e=0;e<t.length;e++){let i=t[e],o=E(l(i)),f=E(r(i));u[e]=o.key,g[e]=f.key,o.numeric?o.temporal&&(m=!1):(m=!1,d=!1),f.numeric?f.temporal&&(p=!1):(p=!1,b=!1),a.has(o.key)||(a.set(o.key,a.size),s.push(o.label)),n.has(f.key)||(n.set(f.key,n.size),c.push(f.label))}let v=a.size,S=n.size;if(0===v||0===S)return[];let k=4096;if(m&&p&&v*S>k&&t.length>k){let o=new Set;for(let l=0;l<t.length;l++){let r=a.get(u[l]),s=n.get(g[l]);if(void 0!==r&&void 0!==s&&(o.add(s*v+r),o.size>k))return I({...e,config:{...e.config,heatmapAggregation:e.config.valueAccessor?"mean":"count"}},t,i)}}d&&V(a,s),b&&V(n,c);let w=new Float64Array(t.length),x=new Float64Array(t.length),M=new Array(t.length),T=new Map,A=0;for(let e=0;e<t.length;e++){let i=t[e],l=a.get(u[e]),r=n.get(g[e]);if(void 0===l||void 0===r)continue;let s,c=o(i),f=r*v+l,m=T.get(f);void 0!==m?s=m:(s=A++,T.set(f,s)),w[s]=f,x[s]=c,M[s]=i}let F=1/0,W=-1/0;for(let e=0;e<A;e++){let t=x[e];isFinite(t)&&(t<F&&(F=t),t>W&&(W=t))}if(!isFinite(F)||!isFinite(W))return[];let j="string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues",P=e.config.heatmapColorScale,X=P?void 0:R(j),O=e.config.showValues,D=C(s,[0,i.width],N(s,e.config.xExtent)),B=N(c,e.config.yExtent),H=C(c,[i.height,0],e.config.invertY?[B[1],B[0]]:B),G=(e,t)=>{let i=e(t-.5),o=e(t+.5);return[Math.min(i,o),Math.abs(o-i)]},L=e.config.heatmapValueFormat,Q=[];for(let t=0;t<A;t++){let i=x[t];if(!isFinite(i))continue;let o=w[t],l=o%v,r=(o-l)/v,a=Y(i,F,W),n=P?P(i):X[a],s=O?{value:i,showValues:!0,valueFormat:L}:{value:i},c=M[t],[u,g]=G(D,l),[m,h]=G(H,r);Q.push(z(f(u,m,g,h,n,c,s),c,e))}return e.scales&&v>0&&S>0&&(e.scales.x=D,e.scales.y=H),Q}(e,t,i),canvasRenderers:[e]};function D(e,t,i,o){let l=Math.min(t,i),r=Math.max(t,i);if(!(r>l))return[];let a=[],n=-1/0;for(let t of e){let e=Math.max(n,l),i=Math.min(t.upTo,r);if(i>e&&a.push({from:e,to:i,fill:t.fill}),n=t.upTo,n>=r)break}return n<r&&a.push({from:Math.max(n,l),to:r,fill:o}),a}var B={chartType:"bar",buildScene:(e,t)=>function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};let i=r(t,e.getX,e.getY,e.config.binSize,e.getCategory,!!e.config.trackHoverRows||w(e.config.areaStyle),e.config.binAlign);if(0===i.size)return{nodes:[],binBoundaries:[]};let o=null;if(e.getCategory){let t=new Set;for(let e of i.values())for(let i of e.categories.keys())t.add(i);let l=e.config.barColors?Object.keys(e.config.barColors):[],r=new Set(l),a=Array.from(t).filter(e=>!r.has(e)).sort(),n=l.filter(e=>t.has(e)),s=n.join("\0")+""+a.join("\0");e.barCategoryCache&&e.barCategoryCache.key===s?o=e.barCategoryCache.order:(o=[...n,...a],e.barCategoryCache={key:s,order:o})}let l=[],a=e.scales,[n,s]=a.x.domain(),c=e.config.barStyle,f=e.config.themeSemantic?.primary,g=c?.gap,m="number"==typeof g&&g>=0?g:1,h={};c?.stroke&&(h.stroke=c.stroke),"number"==typeof c?.strokeWidth&&(h.strokeWidth=c.strokeWidth),"number"==typeof c?.opacity&&(h.opacity=c.opacity),c?.cursor&&(h.cursor=c.cursor);let y=function(e){if(!Array.isArray(e))return;let t=e.filter(e=>!!e&&("string"==typeof e.fill||"object"==typeof e.fill&&null!==e.fill)),i=t.filter(e=>"number"==typeof e.upTo&&Number.isFinite(e.upTo)).map(e=>({upTo:e.upTo,fill:e.fill})).sort((e,t)=>e.upTo-t.upTo),o=t.find(e=>"number"!=typeof e.upTo||!Number.isFinite(e.upTo)),l=o?[...i,{upTo:1/0,fill:o.fill}]:i;return l.length>0?l:void 0}(c?.valueBands);for(let t of i.values()){let i=Math.max(t.start,n),r=Math.min(t.end,s);if(i>=r)continue;let g=a.x(i),p=a.x(r),d=Math.abs(p-g),b=d>m+1?m:0,v=Math.min(g,p)+b/2,k=Math.max(d-b,1);if(!(k<=0))if(o&&t.categories.size>0){let i=x(o.flatMap(e=>{let i=t.categories.get(e)||0;return 0===i?[]:[x({category:e,value:i},t.categoryRows?.get(e))]}),t.rows),r=0;for(let{category:o,value:n}of i){let s=a.y(r),g=a.y(r+n),m=Math.min(s,g),y=Math.abs(s-g),p=(e.config.barColors?S(e.config.barColors,o):void 0)??c?.fill??f??"#4e79a7",d=x({binStart:t.start,binEnd:t.end,total:t.total,category:o,categoryValue:n,categories:i},t.categoryRows?.get(o)),b=e.config.areaStyle?.(d)??{};l.push(u(v,m,k,y,{fill:p,...h,...b},d,o)),r+=n}}else{let i=a.y(0),o=a.y(t.total),r=Math.min(i,o),n=Math.abs(i-o),s=c?.fill||f||"#007bff",g=x({binStart:t.start,binEnd:t.end,total:t.total},t.rows),m=e.config.areaStyle?.(g)??{},p=u(v,r,k,n,{fill:s,...h,...m},g);if(y){let e=p.style.fill,i="string"==typeof e||"object"==typeof e&&null!==e&&"hatch"===e.type?e:void 0,o=D(y,0,t.total,i);o.length>0&&(p.fillBands=o.map(e=>({y0:a.y(e.from),y1:a.y(e.to),fill:e.fill??s})))}l.push(p)}}let p=new Set;for(let e of i.values())p.add(e.start),p.add(e.end);let d=Array.from(p).sort((e,t)=>e-t);return{nodes:l,binBoundaries:d}}(e,t),canvasRenderers:[n],multiHover:(e,t,i,o)=>{let l=t.scales?.x.invert;if("function"!=typeof l)return e;let r=l(i),a=r instanceof Date?r.getTime():Number(r),n=Number.isFinite(a)?function(e,t){let i,o,l=[];for(let r of e){if("rect"!==r.type)continue;let e=r.datum;if("number"==typeof e?.binStart&&"number"==typeof e.binEnd&&!(t<e.binStart||t>=e.binEnd)){if(!o){i=r.x+r.w/2;let{binStart:t,binEnd:l,total:a,categories:n}=e;o=n?x({binStart:t,binEnd:l,total:a,categories:n},M(n)):e}l.push({datum:e,group:e.category??"",value:e.categoryValue??e.total,color:"string"==typeof r.style.fill?r.style.fill:void 0})}}return o&&void 0!==i?{series:l,datum:o,xPx:i}:null}(t.scene,a):null;if(!n)return e;let s=p(n.datum,l(n.xPx)),c=o.hasHit?{...e,xValue:s,xPx:n.xPx}:d(n.datum,e.x,e.y,{xValue:s,xPx:n.xPx});return c.allSeries=n.series.map(e=>({group:e.group,value:e.value,color:e.color||o.fallbackColor,datum:e.datum})),c}},H={chartType:"swarm",buildScene:(e,t)=>function(e,t){let i=[],o=e.config.swarmStyle||{},l=o.radius??3,r=o.fill??e.config.themeSemantic?.primary??"#007bff",a=o.opacity??.7,n=o.stroke,s=o.strokeWidth,c=o.cursor;for(let o of t){let t=e.getX(o),f=e.getY(o);if(null==f||Number.isNaN(f))continue;let u=e.scales.x(t),g=e.scales.y(f),m=r;if(e.getCategory){let t=String(e.getCategory(o));m=(e.config.barColors?S(e.config.barColors,t):void 0)??m}let{r:h,...y}=e.config.pointStyle?.(o)??{},p={type:"point",x:u,y:g,r:h??l,style:{fill:m,opacity:a,stroke:n,strokeWidth:s,cursor:c,...y},datum:o};e.getPointId&&(p.pointId=String(e.getPointId(o))),i.push(p)}return i}(e,t),canvasRenderers:[t]},G={chartType:"waterfall",buildScene:(e,t,i)=>function(e,t,i){let o=[],l=e.scales,r=e.config.waterfallStyle,a=t.filter(t=>{let i=e.getY(t),o=e.getX(t);return null!=i&&!Number.isNaN(i)&&null!=o&&isFinite(o)});if(0===a.length)return o;let n=r?.positiveColor??e.config.themeSemantic?.success??"#28a745",s=r?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=r?.gap??1,f=r?.stroke,g=r?.strokeWidth,m=r?.opacity,h=0;for(let t=0;t<a.length;t++){let y=a[t],p=e.getX(y),d=e.getY(y),b=h+d,v=l.x(p),S=t>0?l.x(e.getX(a[t-1])):void 0,k=t<a.length-1?l.x(e.getX(a[t+1])):void 0,w=null!=S?(S+v)/2:null!=k?v-(k-v)/2:v-i.width/20,x=null!=k?(v+k)/2:null!=S?v+(v-S)/2:v+i.width/20,M=Math.min(w,x)+c/2,C=Math.max(w,x)-c/2-M;if(C<=0){h=b;continue}let N=l.y(h),T=l.y(b),A=Math.min(N,T),F=Math.abs(N-T),W=d>=0?n:s,j={...y,baseline:h,cumEnd:b,delta:d,_connectorStroke:r?.connectorStroke,_connectorWidth:r?.connectorWidth},P={fill:W,stroke:f,strokeWidth:g,opacity:m,cursor:r?.cursor,...e.config.areaStyle?.(j)};o.push(u(M,A,C,F,P,j)),h=b}return o}(e,t,i),canvasRenderers:[i]},L={chartType:"candlestick",buildScene:(e,t,i)=>function(e,t,i){if(!e.getHigh||!e.getLow||!e.scales)return[];let o=e.config.candlestickRangeMode??!1;if(!(o||e.getOpen&&e.getClose))return[];let l=[],r=e.config.candlestickStyle||{},a=r.rangeColor||"#6366f1",n=o?a:r.upColor||"#28a745",s=o?a:r.downColor||"#dc3545",c=o?a:r.wickColor||"#333",f=r.wickWidth||(o?2:1),u=r.bodyWidth??0;if(null==r.bodyWidth){let i=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);if(i.length>1){let t=1/0,o=e.scales.x(i[0]);for(let l=1;l<i.length;l++){let r=e.scales.x(i[l]),a=Math.abs(r-o);a>0&&a<t&&(t=a),o=r}u=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else u=6}for(let a of t){let t=e.getX(a);if(null==t||Number.isNaN(t))continue;let g=e.getHigh(a),m=e.getLow(a);if(null==g||Number.isNaN(g)||null==m||Number.isNaN(m))continue;let h=o?g:e.getOpen(a),y=o?m:e.getClose(a);if(!o&&(null==h||Number.isNaN(h)||null==y||Number.isNaN(y)))continue;let p=y>=h,d=e.config.pointStyle?.(a)??{},b="string"==typeof d.fill?d.fill:void 0,v="string"==typeof d.stroke?d.stroke:void 0,S="number"==typeof d.strokeWidth?d.strokeWidth:void 0,k="number"==typeof d.opacity?d.opacity:"number"==typeof d.fillOpacity?d.fillOpacity:void 0,w={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(h),closeY:e.scales.y(y),highY:e.scales.y(g),lowY:e.scales.y(m),bodyWidth:u,upColor:b&&p?b:n,downColor:b&&!p?b:s,wickColor:v??(o&&b?b:c),wickWidth:S??f,isUp:p,style:{cursor:r.cursor,...d,...void 0!==k&&{opacity:k}},datum:a};o&&(w.isRange=!0,w.dotRadius=Math.max(2,Math.min(u/2,.12*i.height))),l.push(w)}return l}(e,t,i),canvasRenderers:[o]};export{T as a,W as b,j as c,O as d,B as e,H as f,G as g,L as h};
1
+ import{a as e,c as t,d as i,b as o}from"./c-5NAU4JAY.min.js";import{k as l,b as r}from"./c-AMQAAW7G.min.js";import{a}from"./c-UALVQIIJ.min.js";import{a as n}from"./c-5HTUQRJT.min.js";import{f as s,e as c,h as f,g as u}from"./c-ZYMXDR42.min.js";import{a as g}from"./c-TFESQSWE.min.js";import{a as m}from"./c-DHNROAXY.min.js";import{b as h,c as y}from"./c-YLZIV3VS.min.js";import{d as p,c as d}from"./c-SIQVOV6A.min.js";import{c as b,d as v,s as S}from"./c-WPL6PGP3.min.js";import{c as k}from"./c-ELGOCAEY.min.js";import{f as w,a as x,b as M}from"./c-5PCO2P5Q.min.js";import{b as C,c as N}from"./c-7BVQDXFU.min.js";var A={chartType:"stackedarea",buildScene:(e,t)=>l(e,t),canvasRenderers:[a,g]};function T(e,t){let i=[],o="bubble"===e.config.chartType?10:5,l=e.config.sizeRange||[3,15],r=null;if(e.getSize&&!e.config.pointStyle){let i=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(i.length>0){let e=1/0,t=-1/0;for(let o of i)o<e&&(e=o),o>t&&(t=o);r=i=>e===t?(l[0]+l[1])/2:l[0]+(i-e)/(t-e)*(l[1]-l[0])}}let a=e.getColor?e.resolveColorMap(t):null,n=e.config.themeSemantic?.primary||"#4e79a7",f=e.getSymbol,u=f?k(f,e.config.symbolMap):null;for(let l of t){let t=e.config.pointStyle?e.config.pointStyle(l):{fill:n,opacity:.8},f=t.r||o;if(r&&e.getSize){let t=e.getSize(l);null!=t&&!Number.isNaN(t)&&(f=r(t))}if(a&&e.getColor&&!t.fill){let i=e.getColor(l);i&&a.has(i)&&(t={...t,fill:a.get(i)})}let g=e.getPointId?String(e.getPointId(l)):void 0;if(u){let o=u(l),r=s(l,e.scales,e.getX,e.getY,Math.PI*f*f,o,t,g);r&&i.push(r)}else{let o=c(l,e.scales,e.getX,e.getY,f,t,g);o&&i.push(o)}}return i}var F=[g,m],j={chartType:"scatter",buildScene:(e,t)=>T(e,t),canvasRenderers:F},R={chartType:"bubble",buildScene:(e,t)=>T(e,t),canvasRenderers:F},W=/*#__PURE__*/new Map;function Y(e,t,i){return t===i?Math.floor(128):Math.min(Math.floor(255*(e-t)/(i-t)+.5),255)}function P(e){let t=Object.prototype.hasOwnProperty.call(b,e)?e:"blues",i=W.get(t);if(i)return i;i=new Array(256);let o=v(t);for(let e=0;e<256;e++)i[e]=o(e/255);return W.set(t,i),i}function V(e){if(e instanceof Date){let t=e.getTime();return Number.isFinite(t)?{key:t,label:e,numeric:!0,temporal:!0}:{key:"Invalid Date",label:"Invalid Date",numeric:!1,temporal:!1}}return"number"==typeof e&&Number.isFinite(e)?{key:e,label:e,numeric:!0,temporal:!1}:{key:String(e),label:String(e),numeric:!1,temporal:!1}}function X(e,t){let i=t.map((e,t)=>({label:e,previous:t})).sort((e,t)=>z(e.label)-z(t.label)),o=new Map;i.forEach((e,t)=>o.set(e.previous,t));let l=Array.from(e.keys());e.clear();for(let t=0;t<l.length;t++)e.set(l[t],o.get(t));t.length=i.length;for(let e=0;e<i.length;e++)t[e]=i[e].label}function z(e){return e instanceof Date?e.getTime():Number(e)}function E(e,t,i){let o=i.config.areaStyle?.(t);return o&&("string"==typeof o.fill&&(e.fill=o.fill),e.style=o),e}function I(e,t,i){let o=Math.max(1,Math.floor(e.config.heatmapXBins??20)),l=Math.max(1,Math.floor(e.config.heatmapYBins??20)),r=e.config.heatmapAggregation??"count",a=h(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];let[n,s]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),g=(s-n||1)/o,m=(u-c||1)/l,y=o*l;if(y>1e6)return[];let p=new Int32Array(y),d=new Float64Array(y),b=e.config.trackHoverRows||w(e.config.areaStyle)?new Map:void 0;for(let i=0;i<t.length;i++){let r=t[i],s=e.getX(r),f=e.getY(r);if(!isFinite(s)||!isFinite(f))continue;let u=Math.min(Math.floor((s-n)/g),o-1),h=Math.min(Math.floor((f-c)/m),l-1);if(u<0||h<0)continue;let y=h*o+u;p[y]++;let v=a(r);if(d[y]+=isFinite(v)?v:0,b){let e=b.get(y);e||(e=[],b.set(y,e)),e.push(r)}}let v=1/0,S=-1/0;for(let e=0;e<y;e++){if(0===p[e])continue;let t;switch(r){case"sum":t=d[e];break;case"mean":t=d[e]/p[e];break;default:t=p[e]}t<v&&(v=t),t>S&&(S=t)}if(!isFinite(v))return[];let k=e.config.heatmapColorScale,M="string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues",C=k?void 0:P(M),N=i.width/o,A=i.height/l,T=e.config.showValues,F=e.config.heatmapValueFormat,j=[];for(let t=0;t<l;t++){let i=t*o;for(let a=0;a<o;a++){let o,s=i+a;if(0===p[s])continue;switch(r){case"sum":o=d[s];break;case"mean":o=d[s]/p[s];break;default:o=p[s]}let u=Y(o,v,S),h=k?k(o):C[u],y=T?{value:o,showValues:!0,valueFormat:F}:{value:o},w=n+(a+.5)*g,M=c+(t+.5)*m,R=x({xi:a,yi:t,value:o,count:p[s],sum:d[s],xCenter:w,yCenter:M,agg:r},b?.get(s));j.push(E(f(a*N,(l-1-t)*A,N,A,h,R,y),R,e))}}return j}var O={chartType:"heatmap",buildScene:(e,t,i)=>function(e,t,i){if(e.config.heatmapAggregation)return I(e,t,i);if(0===t.length)return[];let o=h(e.config.valueAccessor,"value"),l=y(e.config.xAccessor,"x"),r=y(e.config.yAccessor,"y"),a=new Map,n=new Map,s=[],c=[],u=new Array(t.length),g=new Array(t.length),m=!0,p=!0,d=!0,b=!0;for(let e=0;e<t.length;e++){let i=t[e],o=V(l(i)),f=V(r(i));u[e]=o.key,g[e]=f.key,o.numeric?o.temporal&&(m=!1):(m=!1,d=!1),f.numeric?f.temporal&&(p=!1):(p=!1,b=!1),a.has(o.key)||(a.set(o.key,a.size),s.push(o.label)),n.has(f.key)||(n.set(f.key,n.size),c.push(f.label))}let v=a.size,S=n.size;if(0===v||0===S)return[];let k=4096;if(m&&p&&v*S>k&&t.length>k){let o=new Set;for(let l=0;l<t.length;l++){let r=a.get(u[l]),s=n.get(g[l]);if(void 0!==r&&void 0!==s&&(o.add(s*v+r),o.size>k))return I({...e,config:{...e.config,heatmapAggregation:e.config.valueAccessor?"mean":"count"}},t,i)}}d&&X(a,s),b&&X(n,c);let w=new Float64Array(t.length),x=new Float64Array(t.length),M=new Array(t.length),A=new Map,T=0;for(let e=0;e<t.length;e++){let i=t[e],l=a.get(u[e]),r=n.get(g[e]);if(void 0===l||void 0===r)continue;let s,c=o(i),f=r*v+l,m=A.get(f);void 0!==m?s=m:(s=T++,A.set(f,s)),w[s]=f,x[s]=c,M[s]=i}let F=1/0,j=-1/0;for(let e=0;e<T;e++){let t=x[e];isFinite(t)&&(t<F&&(F=t),t>j&&(j=t))}if(!isFinite(F)||!isFinite(j))return[];let R="string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues",W=e.config.heatmapColorScale,z=W?void 0:P(R),O=e.config.showValues,B=C(s,[0,i.width],N(s,e.config.xExtent)),D=N(c,e.config.yExtent),H=C(c,[i.height,0],e.config.invertY?[D[1],D[0]]:D),Q=(e,t)=>{let i=e(t-.5),o=e(t+.5);return[Math.min(i,o),Math.abs(o-i)]},L=e.config.heatmapValueFormat,U=[];for(let t=0;t<T;t++){let i=x[t];if(!isFinite(i))continue;let o=w[t],l=o%v,r=(o-l)/v,a=Y(i,F,j),n=W?W(i):z[a],s=O?{value:i,showValues:!0,valueFormat:L}:{value:i},c=M[t],[u,g]=Q(B,l),[m,h]=Q(H,r);U.push(E(f(u,m,g,h,n,c,s),c,e))}return e.scales&&v>0&&S>0&&(e.scales.x=B,e.scales.y=H),U}(e,t,i),canvasRenderers:[e]};function B(e,t,i,o){let l=Math.min(t,i),r=Math.max(t,i);if(!(r>l))return[];let a=[],n=-1/0;for(let t of e){let e=Math.max(n,l),i=Math.min(t.upTo,r);if(i>e&&a.push({from:e,to:i,fill:t.fill}),n=t.upTo,n>=r)break}return n<r&&a.push({from:Math.max(n,l),to:r,fill:o}),a}var D={chartType:"bar",buildScene:(e,t)=>function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};let i=r(t,e.getX,e.getY,e.config.binSize,e.getCategory,!!e.config.trackHoverRows||w(e.config.areaStyle),e.config.binAlign);if(0===i.size)return{nodes:[],binBoundaries:[]};let o=null;if(e.getCategory){let t=new Set;for(let e of i.values())for(let i of e.categories.keys())t.add(i);let l=e.config.barColors?Object.keys(e.config.barColors):[],r=new Set(l),a=Array.from(t).filter(e=>!r.has(e)).sort(),n=l.filter(e=>t.has(e)),s=n.join("\0")+""+a.join("\0");e.barCategoryCache&&e.barCategoryCache.key===s?o=e.barCategoryCache.order:(o=[...n,...a],e.barCategoryCache={key:s,order:o})}let l=[],a=e.scales,[n,s]=a.x.domain(),c=e.config.barStyle,f=e.config.themeSemantic?.primary,g=c?.gap,m="number"==typeof g&&g>=0?g:1,h={};c?.stroke&&(h.stroke=c.stroke),"number"==typeof c?.strokeWidth&&(h.strokeWidth=c.strokeWidth),"number"==typeof c?.opacity&&(h.opacity=c.opacity),c?.cursor&&(h.cursor=c.cursor);let y=function(e){if(!Array.isArray(e))return;let t=e.filter(e=>!!e&&("string"==typeof e.fill||"object"==typeof e.fill&&null!==e.fill)),i=t.filter(e=>"number"==typeof e.upTo&&Number.isFinite(e.upTo)).map(e=>({upTo:e.upTo,fill:e.fill})).sort((e,t)=>e.upTo-t.upTo),o=t.find(e=>"number"!=typeof e.upTo||!Number.isFinite(e.upTo)),l=o?[...i,{upTo:1/0,fill:o.fill}]:i;return l.length>0?l:void 0}(c?.valueBands);for(let t of i.values()){let i=Math.max(t.start,n),r=Math.min(t.end,s);if(i>=r)continue;let g=a.x(i),p=a.x(r),d=Math.abs(p-g),b=d>m+1?m:0,v=Math.min(g,p)+b/2,k=Math.max(d-b,1);if(!(k<=0))if(o&&t.categories.size>0){let i=x(o.flatMap(e=>{let i=t.categories.get(e)||0;return 0===i?[]:[x({category:e,value:i},t.categoryRows?.get(e))]}),t.rows),r=0;for(let{category:o,value:n}of i){let s=a.y(r),g=a.y(r+n),m=Math.min(s,g),y=Math.abs(s-g),p=(e.config.barColors?S(e.config.barColors,o):void 0)??c?.fill??f??"#4e79a7",d=x({binStart:t.start,binEnd:t.end,total:t.total,category:o,categoryValue:n,categories:i},t.categoryRows?.get(o)),b=e.config.areaStyle?.(d)??{};l.push(u(v,m,k,y,{fill:p,...h,...b},d,o)),r+=n}}else{let i=a.y(0),o=a.y(t.total),r=Math.min(i,o),n=Math.abs(i-o),s=c?.fill||f||"#007bff",g=x({binStart:t.start,binEnd:t.end,total:t.total},t.rows),m=e.config.areaStyle?.(g)??{},p=u(v,r,k,n,{fill:s,...h,...m},g);if(y){let e=p.style.fill,i="string"==typeof e||"object"==typeof e&&null!==e&&"hatch"===e.type?e:void 0,o=B(y,0,t.total,i);o.length>0&&(p.fillBands=o.map(e=>({y0:a.y(e.from),y1:a.y(e.to),fill:e.fill??s})))}l.push(p)}}let p=new Set;for(let e of i.values())p.add(e.start),p.add(e.end);let d=Array.from(p).sort((e,t)=>e-t);return{nodes:l,binBoundaries:d}}(e,t),canvasRenderers:[n],multiHover:(e,t,i,o)=>{let l=t.scales?.x.invert;if("function"!=typeof l)return e;let r=l(i),a=r instanceof Date?r.getTime():Number(r),n=Number.isFinite(a)?function(e,t){let i,o,l=[];for(let r of e){if("rect"!==r.type)continue;let e=r.datum;if("number"==typeof e?.binStart&&"number"==typeof e.binEnd&&!(t<e.binStart||t>=e.binEnd)){if(!o){i=r.x+r.w/2;let{binStart:t,binEnd:l,total:a,categories:n}=e;o=n?x({binStart:t,binEnd:l,total:a,categories:n},M(n)):e}l.push({datum:e,group:e.category??"",value:e.categoryValue??e.total,color:"string"==typeof r.style.fill?r.style.fill:void 0})}}return o&&void 0!==i?{series:l,datum:o,xPx:i}:null}(t.scene,a):null;if(!n)return e;let s=p(n.datum,l(n.xPx)),c=o.hasHit?{...e,xValue:s,xPx:n.xPx}:d(n.datum,e.x,e.y,{xValue:s,xPx:n.xPx});return c.allSeries=n.series.map(e=>({group:e.group,value:e.value,color:e.color||o.fallbackColor,datum:e.datum})),c}},H={chartType:"swarm",buildScene:(e,t)=>function(e,t){let i=[],o=e.config.swarmStyle||{},l=o.radius??3,r=o.fill??e.config.themeSemantic?.primary??"#007bff",a=o.opacity??.7,n=o.stroke,s=o.strokeWidth,c=o.cursor;for(let o of t){let t=e.getX(o),f=e.getY(o);if(null==f||Number.isNaN(f))continue;let u=e.scales.x(t),g=e.scales.y(f),m=r;if(e.getCategory){let t=String(e.getCategory(o));m=(e.config.barColors?S(e.config.barColors,t):void 0)??m}let{r:h,...y}=e.config.pointStyle?.(o)??{},p={type:"point",x:u,y:g,r:h??l,style:{fill:m,opacity:a,stroke:n,strokeWidth:s,cursor:c,...y},datum:o};e.getPointId&&(p.pointId=String(e.getPointId(o))),i.push(p)}return i}(e,t),canvasRenderers:[t]},Q={chartType:"waterfall",buildScene:(e,t,i)=>function(e,t,i){let o=[],l=e.scales,r=e.config.waterfallStyle,a=t.filter(t=>{let i=e.getY(t),o=e.getX(t);return null!=i&&!Number.isNaN(i)&&null!=o&&isFinite(o)});if(0===a.length)return o;let n=r?.positiveColor??e.config.themeSemantic?.success??"#28a745",s=r?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=r?.gap??1,f=r?.stroke,g=r?.strokeWidth,m=r?.opacity,h=0;for(let t=0;t<a.length;t++){let y=a[t],p=e.getX(y),d=e.getY(y),b=h+d,v=l.x(p),S=t>0?l.x(e.getX(a[t-1])):void 0,k=t<a.length-1?l.x(e.getX(a[t+1])):void 0,w=null!=S?(S+v)/2:null!=k?v-(k-v)/2:v-i.width/20,x=null!=k?(v+k)/2:null!=S?v+(v-S)/2:v+i.width/20,M=Math.min(w,x)+c/2,C=Math.max(w,x)-c/2-M;if(C<=0){h=b;continue}let N=l.y(h),A=l.y(b),T=Math.min(N,A),F=Math.abs(N-A),j=d>=0?n:s,R={...y,baseline:h,cumEnd:b,delta:d,_connectorStroke:r?.connectorStroke,_connectorWidth:r?.connectorWidth},W={fill:j,stroke:f,strokeWidth:g,opacity:m,cursor:r?.cursor,...e.config.areaStyle?.(R)};o.push(u(M,T,C,F,W,R)),h=b}return o}(e,t,i),canvasRenderers:[i]},L={chartType:"candlestick",buildScene:(e,t,i)=>function(e,t,i){if(!e.getHigh||!e.getLow||!e.scales)return[];let o=e.config.candlestickRangeMode??!1;if(!(o||e.getOpen&&e.getClose))return[];let l=[],r=e.config.candlestickStyle||{},a=r.rangeColor||"#6366f1",n=o?a:r.upColor||"#28a745",s=o?a:r.downColor||"#dc3545",c=o?a:r.wickColor||"#333",f=r.wickWidth||(o?2:1),u=r.bodyWidth??0;if(null==r.bodyWidth){let i=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);if(i.length>1){let t=1/0,o=e.scales.x(i[0]);for(let l=1;l<i.length;l++){let r=e.scales.x(i[l]),a=Math.abs(r-o);a>0&&a<t&&(t=a),o=r}u=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else u=6}for(let a of t){let t=e.getX(a);if(null==t||Number.isNaN(t))continue;let g=e.getHigh(a),m=e.getLow(a);if(null==g||Number.isNaN(g)||null==m||Number.isNaN(m))continue;let h=o?g:e.getOpen(a),y=o?m:e.getClose(a);if(!o&&(null==h||Number.isNaN(h)||null==y||Number.isNaN(y)))continue;let p=y>=h,d=e.config.pointStyle?.(a)??{},b="string"==typeof d.fill?d.fill:void 0,v="string"==typeof d.stroke?d.stroke:void 0,S="number"==typeof d.strokeWidth?d.strokeWidth:void 0,k="number"==typeof d.opacity?d.opacity:"number"==typeof d.fillOpacity?d.fillOpacity:void 0,w={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(h),closeY:e.scales.y(y),highY:e.scales.y(g),lowY:e.scales.y(m),bodyWidth:u,upColor:b&&p?b:n,downColor:b&&!p?b:s,wickColor:v??(o&&b?b:c),wickWidth:S??f,isUp:p,style:{cursor:r.cursor,...d,...void 0!==k&&{opacity:k}},datum:a};o&&(w.isRange=!0,w.dotRadius=Math.max(2,Math.min(u/2,.12*i.height))),l.push(w)}return l}(e,t,i),canvasRenderers:[o]};export{A as a,j as b,R as c,O as d,D as e,H as f,Q as g,L as h};