vite-plugin-vue-devtools 9.0.0-beta.1 → 9.0.0-rc.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 (37) hide show
  1. package/client/assets/{Checkbox-3-BZG_RU.js → Checkbox-Df0MfFZd.js} +1 -1
  2. package/client/assets/{InspectorState-DucXtGYl.js → InspectorState-BTXZM1WH.js} +1 -1
  3. package/client/assets/{InspectorTree-C4e-JJiX.js → InspectorTree-HaWX0rBG.js} +1 -1
  4. package/client/assets/RecycleScroller.vue_vue_type_script_setup_true_lang-C7mZBLYi-D7DaT_pj.js +1 -0
  5. package/client/assets/_plugin-vue_export-helper-CVBmTk-L.js +5 -0
  6. package/client/assets/browser-agent-rpc-BXhoSh1z-DrvKG05N.js +1 -0
  7. package/client/assets/{components-DNv7Rrwe.js → components-CA_f0zn5.js} +1 -1
  8. package/client/assets/{custom-inspector-Da_34cDJ.js → custom-inspector-ChrPOy08.js} +1 -1
  9. package/client/assets/{graph-C1luIbSW.js → graph-DjbM7QDq.js} +1 -1
  10. package/client/assets/{index-DN6AzVF_.css → index-DeVPR5Sm.css} +1 -1
  11. package/client/assets/{index-C7PEBwPL.js → index-gOL3pdjp.js} +3 -3
  12. package/client/assets/nanoid-Cya-tyvy.js +1 -0
  13. package/client/assets/overview-DlhcQzcv.js +1 -0
  14. package/client/assets/{pages-CGMfqD7Z.js → pages-CFl2Pj99.js} +1 -1
  15. package/client/assets/{plugins-CiKZQpE4.js → plugins-JeK_HZgb.js} +1 -1
  16. package/client/assets/{settings-Ce4aDLyW.js → settings-D4iX_P4F.js} +1 -1
  17. package/client/assets/{splitpanes.esm-Cwf-Yw0X.js → splitpanes.esm-DyLKHMh-.js} +1 -1
  18. package/client/assets/timeline-JU58z8qA.css +1 -0
  19. package/client/assets/timeline-eZr84BKr.js +1 -0
  20. package/client/index.html +4 -4
  21. package/dist/client.mjs +1 -1
  22. package/dist/index.mjs +1 -1
  23. package/package.json +14 -22
  24. package/client/assets/RecycleScroller.vue_vue_type_script_setup_true_lang-C7mZBLYi-Qu6vm2Hq.js +0 -1
  25. package/client/assets/_plugin-vue_export-helper-Bi7R8aHR.js +0 -4
  26. package/client/assets/browser-agent-Pu-FLk6I-Dsjmnbas.js +0 -1
  27. package/client/assets/browser-agent-rpc-BXhoSh1z-D8UCXOqP.js +0 -1
  28. package/client/assets/overview-DoJqxsjr.js +0 -1
  29. package/client/assets/timeline-B8YJRZK8.css +0 -1
  30. package/client/assets/timeline-D2Qq6Gi0.js +0 -1
  31. package/dist/client.cjs +0 -1
  32. package/dist/client.d.cts +0 -11
  33. package/dist/constants-BRtZjlMX.cjs +0 -1
  34. package/dist/dirs.cjs +0 -1
  35. package/dist/dirs.d.cts +0 -3
  36. package/dist/index.cjs +0 -10
  37. package/dist/index.d.cts +0 -23
@@ -1 +1 @@
1
- import{A as e,D as t,Dt as n,Et as r,I as i,J as a,K as o,M as s,T as c,W as l,Y as u,b as d,d as f,et as p,f as m,h,i as g,j as _,l as v,m as y,nt as b,ot as x,p as S,rt as ee,v as te,wt as C,y as w,z as ne}from"./_plugin-vue_export-helper-Bi7R8aHR.js";import{d as T,f as re,i as E,p as D}from"./index-C7PEBwPL.js";import{n as O}from"./RecycleScroller.vue_vue_type_script_setup_true_lang-C7mZBLYi-Qu6vm2Hq.js";import{t as k}from"./InspectorTree-C4e-JJiX.js";import{n as A,t as j}from"./splitpanes.esm-Cwf-Yw0X.js";import{t as M}from"./component-tree-C3C12cZe.js";var N=8,P=16,F=7.2,I=172,L=76;function ie(e,t,n){let r=new Set(e.nodes.map(e=>e.id)),i=new Map(e.nodes.map(e=>[e.id,e.id])),a=new Map(e.nodes.map(e=>[e.id,0])),o=new Map(e.nodes.map(e=>[e.id,0]));function s(e){let t=i.get(e)??e;if(t===e)return t;let n=s(t);return i.set(e,n),n}function c(e,t){let n=s(e),r=s(t);n!==r&&i.set(r,n)}for(let t of e.relationships)r.has(t.from)&&r.has(t.to)&&(c(t.from,t.to),o.set(t.from,(o.get(t.from)??0)+1),a.set(t.to,(a.get(t.to)??0)+1));let l=new Map,u=[];for(let t of e.nodes){let e=s(t.id);if(l.has(e))continue;let n=l.size;l.set(e,n),u.push({id:n,nodeCount:0,relationshipCount:0})}let d=ae(u,t,n),f=e.nodes.map(e=>{let r=l.get(s(e.id))??0,i=(a.get(e.id)??0)+(o.get(e.id)??0),c=Math.min(P,N+Math.sqrt(i+1)*3),f=d.get(r)??{x:t/2,y:n/2},p=V(e.id)%360*(Math.PI/180),m=18+V(`${e.id}:distance`)%54,h=u[r];return h&&(h.nodeCount+=1),{id:e.id,type:e.type,label:e.label,group:r,incoming:a.get(e.id)??0,labelWidth:R(z(e)),outgoing:o.get(e.id)??0,radius:c,x:f.x+Math.cos(p)*m,y:f.y+Math.sin(p)*m}});return{groups:u,links:e.relationships.map(e=>{if(!r.has(e.from)||!r.has(e.to))return;let t=l.get(s(e.from))??0,n=u[t];return n&&(n.relationshipCount+=1),{...e,group:t,source:e.from,target:e.to,value:1}}).filter(e=>e!==void 0),nodes:f}}function ae(e,t,n){let r=new Map;if(!e.length)return r;let i=Math.ceil(Math.sqrt(e.length)),a=Math.ceil(e.length/i),o=Math.min(170,Math.max(78,t*.12)),s=Math.min(128,Math.max(76,n*.16)),c=Math.max(1,t-o*2),l=Math.max(1,n-s*2);return e.forEach((e,t)=>{let n=t%i,u=Math.floor(t/i);r.set(e.id,{x:o+c*(n+.5)/i,y:s+l*(u+.5)/a})}),r}function oe(e){return e.length<=22?e:`${e.slice(0,12)}...${e.slice(-7)}`}function R(e){return Math.min(I,Math.max(L,oe(e).length*F+22))}function z(e){let t=B(e.type);return new Set([e.type,t,`component render`,`reactive.property`,`render/effect`,`watch callback`]).has(e.label)?t:e.label}function B(e){switch(e){case`ref`:return`Anonymous Ref`;case`computed`:return`Anonymous Computed`;case`reactive`:return`Reactive Property`;case`watch`:return`Anonymous Watch`;case`render`:return`Anonymous Render`;case`effect`:return`Anonymous Effect`;default:return`Unknown`}}function V(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n);return Math.abs(t)}var se=[`ref`,`reactive`,`computed`,`watch`,`effect`,`render`,`unknown`];function ce(e){switch(e){case`ref`:return`#21a67a`;case`computed`:return`#3b82d6`;case`reactive`:return`#d79822`;case`render`:return`#f97316`;case`watch`:return`#0f766e`;case`effect`:return`#d84f45`;default:return`#94a3b8`}}function H(e){switch(e){case`ref`:return`Ref`;case`computed`:return`Computed`;case`reactive`:return`Reactive`;case`render`:return`Render Effect`;case`watch`:return`Watch`;case`effect`:return`Effect`;default:return`Unknown`}}function le(e){return e.trim().toLowerCase()}function ue(e,t){return!t||[e.id,e.label,H(e.type),de(e),...Object.values(e.data).map(e=>String(e))].some(e=>e.toLowerCase().includes(t))}function de(e){if(!e)return``;let t=e.data;if(!t)return``;let n=t.value??t.cb??t.instanceName;if(n==null)return``;if(typeof n==`string`)return n;try{return JSON.stringify(n)}catch{return String(n)}}function fe(){return{nodeIds:new Set,orderedNodeIds:[],orderedRelationshipIds:[],relationshipIds:new Set}}function pe(e){let t=new Map;for(let n of e){let e=t.get(n.from)??[];e.push(n),t.set(n.from,e)}return t}function me(e,t){let n=new Set(t.map(e=>e.to));return new Set(e.filter(e=>!n.has(e.id)).map(e=>e.id))}function he(e,t){let n=new Set([e]),r=[e];for(let e of r)for(let i of t.get(e)??[])n.has(i.to)||(n.add(i.to),r.push(i.to));return n.delete(e),n}function ge(e,t,n){if(!e||!t)return fe();let r=new Map,i=new Set([e]),a=[e];for(let e of a){if(i.has(t))break;for(let o of n.get(e)??[])if(!i.has(o.to)&&(i.add(o.to),r.set(o.to,o),a.push(o.to),o.to===t))break}let o=[t],s=[];if(i.has(t)){let n=t;for(;n!==e;){let e=r.get(n);s.push(e.id),o.push(e.from),n=e.from}}else o.push(e);return o.reverse(),s.reverse(),{nodeIds:new Set(o),orderedNodeIds:o,relationshipIds:new Set(s),orderedRelationshipIds:s}}var _e={class:`shrink-0 bg-base px-2`},ve={class:`min-w-0 flex items-center gap-2 py-2`},ye={key:0,class:`group relative min-w-0 flex flex-1 items-center justify-between gap-2 overflow-hidden rounded-1 border border-primary-100 px-3 py-0.75 color-base dark:border-gray-700`},be={key:1,class:`min-w-0 flex flex-1 items-center gap-2`},xe={class:`relative min-w-0 flex-1`},Se={key:0,class:`min-w-0 w-full overflow-hidden rounded-1 border border-base px-2 py-1 color-base flex items-center gap-1.5`},Ce={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},we=[`value`],Te={key:2,class:`absolute left-0 right-0 top-[calc(100%+4px)] z-50 max-h-58 overflow-auto rounded-1 border border-base bg-base p-1 shadow`},Ee=[`onMousedown`],De={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Oe={class:`shrink-0 color-muted text-3`},ke={key:0,class:`px-2 py-2 color-muted text-3 italic`},Ae={class:`relative min-w-0 flex-1`},je={key:0,class:`min-w-0 w-full overflow-hidden rounded-1 border border-base px-2 py-1 color-base flex items-center gap-1.5`},Me={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Ne=[`value`],Pe={key:2,class:`absolute left-0 right-0 top-[calc(100%+4px)] z-50 max-h-58 overflow-auto rounded-1 border border-base bg-base p-1 shadow`},Fe=[`onMousedown`],Ie={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Le={class:`shrink-0 color-muted text-3`},Re={key:0,class:`px-2 py-2 color-muted text-3 italic`},ze=[`aria-pressed`],Be=[`aria-expanded`],Ve={class:`mb-1 flex items-center justify-between gap-2`},He={class:`w-14 shrink-0 text-right color-muted font-state-field text-3`},Ue=[`title`],We=[`checked`,`onChange`],Ge={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Ke={class:`w-10 shrink-0 text-right color-muted text-3`},qe=220,Je=d({__name:`ReactivityGraphToolbar`,props:c({graph:{},filteredGraph:{}},{search:{required:!0},searchModifiers:{},activeTypes:{required:!0},activeTypesModifiers:{},pathSelectorOpen:{type:Boolean,required:!0},pathSelectorOpenModifiers:{},pathStartId:{required:!0},pathStartIdModifiers:{},pathEndId:{required:!0},pathEndIdModifiers:{},selectedNodeId:{},selectedNodeIdModifiers:{}}),emits:[`update:search`,`update:activeTypes`,`update:pathSelectorOpen`,`update:pathStartId`,`update:pathEndId`,`update:selectedNodeId`],setup(e){let t=e,a=ee(t,`filteredGraph`),c=l(e,`search`),d=l(e,`activeTypes`),g=l(e,`pathSelectorOpen`),b=l(e,`pathStartId`),S=l(e,`pathEndId`),te=l(e,`selectedNodeId`),O=p(),k=p(``),A=p(``),j=p(!1),M,N=f(()=>{let e=new Map;for(let t of se)e.set(t,0);for(let n of t.graph.nodes)e.set(n.type,(e.get(n.type)??0)+1);return e}),P=f(()=>new Map(t.graph.nodes.map(e=>[e.id,e]))),F=f(()=>[...a.value.nodes].sort((e,t)=>tt(e.id).localeCompare(tt(t.id)))),I=f(()=>me(a.value.nodes,a.value.relationships)),L=f(()=>pe(a.value.relationships)),ie=f(()=>et(k.value,S.value,I.value)),ae=f(()=>b.value?he(b.value,L.value):new Set),oe=f(()=>et(A.value,b.value,ae.value)),R=f(()=>!!b.value&&!!S.value);function B(e){return e.target instanceof HTMLInputElement?e.target.value:``}function V(e){return d.value.has(e)}function de(e){let t=new Set(d.value);t.has(e)?t.delete(e):t.add(e),d.value=t,W()}function fe(){d.value=new Set(se),W()}function ge(){d.value=new Set,W()}function Je(){M&&=(clearTimeout(M),void 0)}function Ye(){Je(),j.value=!0}function U(e){if(e instanceof FocusEvent){let t=e.currentTarget,n=e.relatedTarget;if(t instanceof Node&&n instanceof Node&&t.contains(n))return}Je(),M=setTimeout(()=>{j.value=!1,M=void 0},qe)}function Xe(){c.value=``,g.value=!0,O.value=`start`}function W(){g.value=!1,O.value=void 0,b.value=``,S.value=``,k.value=``,A.value=``}function Ze(e,t){e===`start`?(k.value=t,(!t||t!==tt(b.value))&&(G(),k.value=t)):(A.value=t,(!t||t!==tt(S.value))&&($e(),A.value=t))}function Qe(e,t){e===`start`?(b.value!==t&&$e(),b.value=t,k.value=tt(t),O.value=S.value?void 0:`end`):(S.value=t,A.value=tt(t),O.value=b.value?void 0:`start`),b.value&&S.value&&(te.value=void 0)}function G(){b.value=``,k.value=``,$e(),O.value=`start`}function $e(){S.value=``,A.value=``,O.value=`end`}function et(e,t,n){let r=le(e);return F.value.filter(e=>e.id===t||n&&!n.has(e.id)?!1:ue(e,r)).slice(0,8)}function tt(e){let t=P.value.get(e);return t?`${z(t)} (${H(t.type)})`:``}function nt(e){let t=P.value.get(e);return t?z(t):``}function rt(e){let t=P.value.get(e);return ce(t?t.type:`unknown`)}return o(g,e=>{e||W()}),_(Je),(e,o)=>{let l=ne(`tooltip`);return s(),h(`div`,_e,[m(`div`,ve,[g.value?(s(),h(`div`,be,[m(`div`,xe,[b.value?(s(),h(`div`,Se,[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:rt(b.value)})},null,4),m(`span`,Ce,n(nt(b.value)),1),u((s(),h(`button`,{class:`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center op70 hover:bg-active hover:color-base hover:op100`,type:`button`,"aria-label":`Clear path start`,onClick:G},[w(E,{icon:`i-carbon-clean`,class:`text-5.5`})])),[[l,`Clear start`,void 0,{top:!0}]])])):(s(),h(`input`,{key:1,class:`min-w-0 w-full rounded-1 border border-base bg-transparent px-3 py-1 outline-none font-state-field text-3.5 color-base placeholder-color-gray-500 dark:placeholder-gray-300`,placeholder:`Start`,type:`search`,value:k.value,onFocus:o[2]||=e=>O.value=`start`,onInput:o[3]||=e=>Ze(`start`,B(e)),onKeydown:re(W,[`esc`])},null,40,we)),!b.value&&O.value===`start`?(s(),h(`div`,Te,[(s(!0),h(v,null,i(ie.value,e=>(s(),h(`button`,{key:e.id,class:`min-w-0 w-full rounded-1 border-0 bg-transparent px-2 py-1.5 text-left color-base flex items-center gap-1.5 hover:bg-active`,type:`button`,onMousedown:D(t=>Qe(`start`,e.id),[`prevent`])},[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(ce)(e.type)})},null,4),m(`span`,De,n(x(z)(e)),1),m(`span`,Oe,n(x(H)(e.type)),1)],40,Ee))),128)),ie.value.length?y(``,!0):(s(),h(`div`,ke,` No matching nodes `))])):y(``,!0)]),w(E,{icon:`i-carbon-arrow-right`,class:`shrink-0 color-muted text-5`}),m(`div`,Ae,[S.value?(s(),h(`div`,je,[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:rt(S.value)})},null,4),m(`span`,Me,n(nt(S.value)),1),u((s(),h(`button`,{class:`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center op70 hover:bg-active hover:color-base hover:op100`,type:`button`,"aria-label":`Clear path end`,onClick:$e},[w(E,{icon:`i-carbon-clean`,class:`text-5.5`})])),[[l,`Clear end`,void 0,{top:!0}]])])):(s(),h(`input`,{key:1,class:`min-w-0 w-full rounded-1 border border-base bg-transparent px-3 py-1 outline-none font-state-field text-3.5 color-base placeholder-color-gray-500 dark:placeholder-gray-300`,placeholder:`End`,type:`search`,value:A.value,onFocus:o[4]||=e=>O.value=`end`,onInput:o[5]||=e=>Ze(`end`,B(e)),onKeydown:re(W,[`esc`])},null,40,Ne)),!S.value&&O.value===`end`?(s(),h(`div`,Pe,[(s(!0),h(v,null,i(oe.value,e=>(s(),h(`button`,{key:e.id,class:`min-w-0 w-full rounded-1 border-0 bg-transparent px-2 py-1.5 text-left color-base flex items-center gap-1.5 hover:bg-active`,type:`button`,onMousedown:D(t=>Qe(`end`,e.id),[`prevent`])},[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(ce)(e.type)})},null,4),m(`span`,Ie,n(x(z)(e)),1),m(`span`,Le,n(x(H)(e.type)),1)],40,Fe))),128)),oe.value.length?y(``,!0):(s(),h(`div`,Re,n(b.value?`No matching nodes`:`Select a start node to get end nodes`),1))])):y(``,!0)])])):(s(),h(`label`,ye,[w(E,{icon:`i-carbon-search`,class:`shrink-0 color-muted text-4`}),u(m(`input`,{"onUpdate:modelValue":o[0]||=e=>c.value=e,class:`min-w-0 w-full border-0 bg-transparent p-0 outline-none text-3.5 color-inherit placeholder-color-gray-500 dark:placeholder-gray-300`,placeholder:`Search graph...`,type:`search`},null,512),[[T,c.value]]),c.value?u((s(),h(`button`,{key:0,class:`h-6 w-6 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Clear search`,onClick:o[1]||=e=>c.value=``},[w(E,{icon:`i-carbon-close`,class:`text-3.5`})])),[[l,`Clear search`,void 0,{top:!0}]]):y(``,!0)])),g.value?u((s(),h(`button`,{key:3,class:`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Close path selector`,onClick:W},[w(E,{icon:`i-carbon-close`,class:`text-5`})])),[[l,`Close path selector`,void 0,{top:!0}]]):u((s(),h(`button`,{key:2,class:C([`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,g.value||R.value?`bg-active color-active`:``]),type:`button`,"aria-label":`Graph path selector`,"aria-pressed":g.value||R.value,onClick:o[6]||=e=>g.value?W():Xe()},[w(E,{icon:`i-ri-route-line`,class:`text-5.5`})],10,ze)),[[l,g.value?`Clear path selector`:`Graph path selector`,void 0,{top:!0}]]),m(`div`,{class:`relative shrink-0`,onFocusin:Ye,onFocusout:U,onMouseenter:Ye,onMouseleave:U},[u((s(),h(`button`,{class:C([`h-7 w-7 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,j.value?`bg-active color-base`:``]),type:`button`,"aria-label":`Filter reactivity types`,"aria-haspopup":`menu`,"aria-expanded":j.value},[w(E,{icon:`i-carbon-filter`,class:`text-4`})],10,Be)),[[l,`Filter reactivity types`,void 0,{top:!0}]]),m(`div`,{class:C([`absolute right-0 top-[calc(100%+4px)] z-50 w-62 rounded-1 border border-base bg-base p-2 shadow transition-opacity`,j.value?`pointer-events-auto op-100`:`pointer-events-none op-0`]),role:`menu`},[m(`div`,Ve,[o[7]||=m(`span`,{class:`color-muted text-3`},`Filter type`,-1),m(`span`,He,n(a.value.nodes.length)+` / `+n(t.graph.nodes.length),1)]),(s(!0),h(v,null,i(x(se),e=>(s(),h(`label`,{key:e,class:C([`h-7 rounded-1 px-2 color-base flex items-center gap-1.5 select-none hover:bg-active`,V(e)?``:`op45 grayscale`]),title:x(H)(e)},[m(`input`,{class:`h-3.5 w-3.5 accent-emerald-600`,type:`checkbox`,checked:V(e),onChange:t=>de(e)},null,40,We),m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(ce)(e)})},null,4),m(`span`,Ge,n(x(H)(e)),1),m(`span`,Ke,n(N.value.get(e)??0),1)],10,Ue))),128)),m(`div`,{class:`mt-1 flex items-center gap-1 border-t border-base pt-1`},[m(`button`,{class:`h-7 flex-1 rounded-1 border border-base bg-transparent px-2 color-muted text-3 hover:bg-active hover:color-base`,type:`button`,onClick:fe},` Select all `),m(`button`,{class:`h-7 flex-1 rounded-1 border border-base bg-transparent px-2 color-muted text-3 hover:bg-active hover:color-base`,type:`button`,onClick:ge},` Clear `)])],2)],32)])])}}});function Ye(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return U(this.cover(t,n),t,n,e)}function U(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function Xe(e){var t,n,r=e.length,i,a,o=Array(r),s=Array(r),c=1/0,l=1/0,u=-1/0,d=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(a=+this._y.call(null,t))||(o[n]=i,s[n]=a,i<c&&(c=i),i>u&&(u=i),a<l&&(l=a),a>d&&(d=a));if(c>u||l>d)return this;for(this.cover(c,l).cover(u,d),n=0;n<r;++n)U(this,o[n],s[n],e[n]);return this}function W(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t<r)<<1|e<n,c=[,,,,],c[l]=s,s=c,o*=2,l){case 0:i=n+o,a=r+o;break;case 1:n=i-o,a=r+o;break;case 2:i=n+o,r=a-o;break;case 3:n=i-o,r=a-o}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function Ze(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Qe(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function G(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function $e(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,u=this._x1,d=this._y1,f=[],p=this._root,m,h;for(p&&f.push(new G(p,i,a,u,d)),n==null?n=1/0:(i=e-n,a=t-n,u=e+n,d=t+n,n*=n);m=f.pop();)if(!(!(p=m.node)||(o=m.x0)>u||(s=m.y0)>d||(c=m.x1)<i||(l=m.y1)<a)){if(p.length){var g=(o+c)/2,_=(s+l)/2;f.push(new G(p[3],g,_,c,l),new G(p[2],o,_,g,l),new G(p[1],g,s,c,_),new G(p[0],o,s,g,_)),(h=(t>=_)<<1|e>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=m)}else{var v=e-+this._x.call(null,p.data),y=t-+this._y.call(null,p.data),b=v*v+y*y;if(b<n){var x=Math.sqrt(n=b);i=e-x,a=t-x,u=e+x,d=t+x,r=p.data}}}return r}function et(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function tt(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function nt(){return this._root}function rt(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function it(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new G(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,u=(o+c)/2;(i=r[3])&&t.push(new G(i,l,u,s,c)),(i=r[2])&&t.push(new G(i,a,u,l,c)),(i=r[1])&&t.push(new G(i,l,o,s,u)),(i=r[0])&&t.push(new G(i,a,o,l,u))}return this}function at(e){var t=[],n=[],r;for(this._root&&t.push(new G(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,u=(o+c)/2,d=(s+l)/2;(a=i[0])&&t.push(new G(a,o,s,u,d)),(a=i[1])&&t.push(new G(a,u,s,c,d)),(a=i[2])&&t.push(new G(a,o,d,u,l)),(a=i[3])&&t.push(new G(a,u,d,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function ot(e){return e[0]}function st(e){return arguments.length?(this._x=e,this):this._x}function ct(e){return e[1]}function lt(e){return arguments.length?(this._y=e,this):this._y}function ut(e,t,n){var r=new dt(t??ot,n??ct,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function dt(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function ft(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var K=ut.prototype=dt.prototype;K.copy=function(){var e=new dt(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=ft(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=ft(r));return e},K.add=Ye,K.addAll=Xe,K.cover=W,K.data=Ze,K.extent=Qe,K.find=$e,K.remove=et,K.removeAll=tt,K.root=nt,K.size=rt,K.visit=it,K.visitAfter=at,K.x=st,K.y=lt;function q(e){return function(){return e}}function pt(e){return(e()-.5)*1e-6}function mt(e){return e.x+e.vx}function ht(e){return e.y+e.vy}function gt(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=q(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;m<a;++m)for(c=ut(t,mt,ht).visitAfter(s),e=0;e<o;++e)l=t[e],f=n[l.index],p=f*f,u=l.x+l.vx,d=l.y+l.vy,c.visit(h);function h(e,t,n,a,o){var s=e.data,c=e.r,m=f+c;if(s){if(s.index>l.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_<m*m&&(h===0&&(h=pt(r),_+=h*h),g===0&&(g=pt(r),_+=g*g),_=(m-(_=Math.sqrt(_)))/_*i,l.vx+=(h*=_)*(m=(c*=c)/(p+c)),l.vy+=(g*=_)*m,s.vx-=h*(m=1-m),s.vy-=g*m)}return}return t>u+m||a<u-m||n>d+m||o<d-m}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r<i;++r)a=t[r],n[a.index]=+e(a,r,t)}}return o.initialize=function(e,n){t=e,r=n,c()},o.iterations=function(e){return arguments.length?(a=+e,o):a},o.strength=function(e){return arguments.length?(i=+e,o):i},o.radius=function(t){return arguments.length?(e=typeof t==`function`?t:q(+t),c(),o):e},o}function _t(e){return e.index}function vt(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function yt(e){var t=_t,n=d,r,i=q(30),a,o,s,c,l,u=1;e??=[];function d(e){return 1/Math.min(s[e.source.index],s[e.target.index])}function f(t){for(var n=0,i=e.length;n<u;++n)for(var o=0,s,d,f,p,m,h,g;o<i;++o)s=e[o],d=s.source,f=s.target,p=f.x+f.vx-d.x-d.vx||pt(l),m=f.y+f.vy-d.y-d.vy||pt(l),h=Math.sqrt(p*p+m*m),h=(h-a[o])/h*t*r[o],p*=h,m*=h,f.vx-=p*(g=c[o]),f.vy-=m*g,d.vx+=p*(g=1-g),d.vy+=m*g}function p(){if(o){var n,i=o.length,l=e.length,u=new Map(o.map((e,n)=>[t(e,n,o),e])),d;for(n=0,s=Array(i);n<l;++n)d=e[n],d.index=n,typeof d.source!=`object`&&(d.source=vt(u,d.source)),typeof d.target!=`object`&&(d.target=vt(u,d.target)),s[d.source.index]=(s[d.source.index]||0)+1,s[d.target.index]=(s[d.target.index]||0)+1;for(n=0,c=Array(l);n<l;++n)d=e[n],c[n]=s[d.source.index]/(s[d.source.index]+s[d.target.index]);r=Array(l),m(),a=Array(l),h()}}function m(){if(o)for(var t=0,i=e.length;t<i;++t)r[t]=+n(e[t],t,e)}function h(){if(o)for(var t=0,n=e.length;t<n;++t)a[t]=+i(e[t],t,e)}return f.initialize=function(e,t){o=e,l=t,p()},f.links=function(t){return arguments.length?(e=t,p(),f):e},f.id=function(e){return arguments.length?(t=e,f):t},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.strength=function(e){return arguments.length?(n=typeof e==`function`?e:q(+e),m(),f):n},f.distance=function(e){return arguments.length?(i=typeof e==`function`?e:q(+e),h(),f):i},f}var bt={value:()=>{}};function xt(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new St(n)}function St(e){this._=e}function Ct(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}St.prototype=xt.prototype={constructor:St,on:function(e,t){var n=this._,r=Ct(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=wt(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=Tt(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Tt(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new St(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function wt(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Tt(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=bt,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Et=0,Dt=0,Ot=0,kt=1e3,At,jt,Mt=0,Nt=0,Pt=0,Ft=typeof performance==`object`&&performance.now?performance:Date,It=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Lt(){return Nt||=(It(Rt),Ft.now()+Pt)}function Rt(){Nt=0}function zt(){this._call=this._time=this._next=null}zt.prototype=Bt.prototype={constructor:zt,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?Lt():+n)+(t==null?0:+t),!this._next&&jt!==this&&(jt?jt._next=this:At=this,jt=this),this._call=e,this._time=n,Gt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gt())}};function Bt(e,t,n){var r=new zt;return r.restart(e,t,n),r}function Vt(){Lt(),++Et;for(var e=At,t;e;)(t=Nt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Et}function Ht(){Nt=(Mt=Ft.now())+Pt,Et=Dt=0;try{Vt()}finally{Et=0,Wt(),Nt=0}}function Ut(){var e=Ft.now(),t=e-Mt;t>kt&&(Pt-=t,Mt=e)}function Wt(){for(var e,t=At,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:At=n);jt=e,Gt(r)}function Gt(e){Et||(Dt&&=clearTimeout(Dt),e-Nt>24?(e<1/0&&(Dt=setTimeout(Ht,e-Ft.now()-Pt)),Ot&&=clearInterval(Ot)):(Ot||=(Mt=Ft.now(),setInterval(Ut,kt)),Et=1,It(Ht)))}function Kt(e,t,n){var r=new zt;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var qt=1664525,Jt=1013904223,Yt=4294967296;function Xt(){let e=1;return()=>(e=(qt*e+Jt)%Yt)/Yt}function Zt(e){return e.x}function Qt(e){return e.y}var $t=10,en=Math.PI*(3-Math.sqrt(5));function tn(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=Bt(d),l=xt(`tick`,`end`),u=Xt();e??=[];function d(){f(),l.call(`tick`,t),n<r&&(c.stop(),l.call(`end`,t))}function f(r){var c,l=e.length,u;r===void 0&&(r=1);for(var d=0;d<r;++d)for(n+=(a-n)*i,s.forEach(function(e){e(n)}),c=0;c<l;++c)u=e[c],u.fx==null?u.x+=u.vx*=o:(u.x=u.fx,u.vx=0),u.fy==null?u.y+=u.vy*=o:(u.y=u.fy,u.vy=0);return t}function p(){for(var t=0,n=e.length,r;t<n;++t){if(r=e[t],r.index=t,r.fx!=null&&(r.x=r.fx),r.fy!=null&&(r.y=r.fy),isNaN(r.x)||isNaN(r.y)){var i=$t*Math.sqrt(.5+t),a=t*en;r.x=i*Math.cos(a),r.y=i*Math.sin(a)}(isNaN(r.vx)||isNaN(r.vy))&&(r.vx=r.vy=0)}}function m(t){return t.initialize&&t.initialize(e,u),t}return p(),t={tick:f,restart:function(){return c.restart(d),t},stop:function(){return c.stop(),t},nodes:function(n){return arguments.length?(e=n,p(),s.forEach(m),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(r=+e,t):r},alphaDecay:function(e){return arguments.length?(i=+e,t):+i},alphaTarget:function(e){return arguments.length?(a=+e,t):a},velocityDecay:function(e){return arguments.length?(o=1-e,t):1-o},randomSource:function(e){return arguments.length?(u=e,s.forEach(m),t):u},force:function(e,n){return arguments.length>1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i<a;++i)l=e[i],o=t-l.x,s=n-l.y,c=o*o+s*s,c<r&&(u=l,r=c);return u},on:function(e,n){return arguments.length>1?(l.on(e,n),t):l.on(e)}}}function nn(){var e,t,n,r,i=q(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=ut(e,Zt,Qt).visitAfter(d);for(r=n,i=0;i<a;++i)t=e[i],o.visit(f)}function u(){if(e){var t,n=e.length,r;for(a=Array(n),t=0;t<n;++t)r=e[t],a[r.index]=+i(r,t,e)}}function d(e){var t=0,n,r,i=0,o,s,c;if(e.length){for(o=s=c=0;c<4;++c)(n=e[c])&&(r=Math.abs(n.value))&&(t+=n.value,i+=r,o+=r*n.x,s+=r*n.y);e.x=o/i,e.y=s/i}else{n=e,n.x=n.data.x,n.y=n.data.y;do t+=a[n.data.index];while(n=n.next)}e.value=t}function f(e,i,l,u){if(!e.value)return!0;var d=e.x-t.x,f=e.y-t.y,p=u-i,m=d*d+f*f;if(p*p/c<m)return m<s&&(d===0&&(d=pt(n),m+=d*d),f===0&&(f=pt(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)),t.vx+=d*e.value*r/m,t.vy+=f*e.value*r/m),!0;if(!(e.length||m>=s)){(e.data!==t||e.next)&&(d===0&&(d=pt(n),m+=d*d),f===0&&(f=pt(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)));do e.data!==t&&(p=a[e.data.index]*r/m,t.vx+=d*p,t.vy+=f*p);while(e=e.next)}}return l.initialize=function(t,r){e=t,n=r,u()},l.strength=function(e){return arguments.length?(i=typeof e==`function`?e:q(+e),u(),l):i},l.distanceMin=function(e){return arguments.length?(o=e*e,l):Math.sqrt(o)},l.distanceMax=function(e){return arguments.length?(s=e*e,l):Math.sqrt(s)},l.theta=function(e){return arguments.length?(c=e*e,l):Math.sqrt(c)},l}function rn(e){var t=q(.1),n,r,i;typeof e!=`function`&&(e=q(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vx+=(i[t]-o.x)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:q(+e),o(),a):t},a.x=function(t){return arguments.length?(e=typeof t==`function`?t:q(+t),o(),a):e},a}function an(e){var t=q(.1),n,r,i;typeof e!=`function`&&(e=q(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vy+=(i[t]-o.y)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:q(+e),o(),a):t},a.y=function(t){return arguments.length?(e=typeof t==`function`?t:q(+t),o(),a):e},a}var on={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function sn(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),on.hasOwnProperty(t)?{space:on[t],local:e}:e}function cn(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function ln(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function un(e){var t=sn(e);return(t.local?ln:cn)(t)}function dn(){}function fn(e){return e==null?dn:function(){return this.querySelector(e)}}function pn(e){typeof e!=`function`&&(e=fn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new J(r,this._parents)}function mn(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function hn(){return[]}function gn(e){return e==null?hn:function(){return this.querySelectorAll(e)}}function _n(e){return function(){return mn(e.apply(this,arguments))}}function vn(e){e=typeof e==`function`?_n(e):gn(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new J(r,i)}function yn(e){return function(){return this.matches(e)}}function bn(e){return function(t){return t.matches(e)}}var xn=Array.prototype.find;function Sn(e){return function(){return xn.call(this.children,e)}}function Cn(){return this.firstElementChild}function wn(e){return this.select(e==null?Cn:Sn(typeof e==`function`?e:bn(e)))}var Tn=Array.prototype.filter;function En(){return Array.from(this.children)}function Dn(e){return function(){return Tn.call(this.children,e)}}function On(e){return this.selectAll(e==null?En:Dn(typeof e==`function`?e:bn(e)))}function kn(e){typeof e!=`function`&&(e=yn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new J(r,this._parents)}function An(e){return Array(e.length)}function jn(){return new J(this._enter||this._groups.map(An),this._parents)}function Mn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Mn.prototype={constructor:Mn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Nn(e){return function(){return e}}function Pn(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Mn(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Fn(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Mn(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function In(e){return e.__data__}function Ln(e,t){if(!arguments.length)return Array.from(this,In);var n=t?Fn:Pn,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Nn(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Rn(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new J(o,r),o._enter=s,o._exit=c,o}function Rn(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function zn(){return new J(this._exit||this._groups.map(An),this._parents)}function Bn(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Vn(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new J(s,this._parents)}function Hn(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Un(e){e||=Wn;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new J(i,this._parents).order()}function Wn(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Gn(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Kn(){return Array.from(this)}function qn(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function Jn(){let e=0;for(let t of this)++e;return e}function Yn(){return!this.node()}function Xn(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function Zn(e){return function(){this.removeAttribute(e)}}function Qn(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $n(e,t){return function(){this.setAttribute(e,t)}}function er(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function tr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function nr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function rr(e,t){var n=sn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Qn:Zn:typeof t==`function`?n.local?nr:tr:n.local?er:$n)(n,t))}function ir(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ar(e){return function(){this.style.removeProperty(e)}}function or(e,t,n){return function(){this.style.setProperty(e,t,n)}}function sr(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function cr(e,t,n){return arguments.length>1?this.each((t==null?ar:typeof t==`function`?sr:or)(e,t,n??``)):lr(this.node(),e)}function lr(e,t){return e.style.getPropertyValue(t)||ir(e).getComputedStyle(e,null).getPropertyValue(t)}function ur(e){return function(){delete this[e]}}function dr(e,t){return function(){this[e]=t}}function fr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function pr(e,t){return arguments.length>1?this.each((t==null?ur:typeof t==`function`?fr:dr)(e,t)):this.node()[e]}function mr(e){return e.trim().split(/^|\s+/)}function hr(e){return e.classList||new gr(e)}function gr(e){this._node=e,this._names=mr(e.getAttribute(`class`)||``)}gr.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function _r(e,t){for(var n=hr(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function vr(e,t){for(var n=hr(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function yr(e){return function(){_r(this,e)}}function br(e){return function(){vr(this,e)}}function xr(e,t){return function(){(t.apply(this,arguments)?_r:vr)(this,e)}}function Sr(e,t){var n=mr(e+``);if(arguments.length<2){for(var r=hr(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?xr:t?yr:br)(n,t))}function Cr(){this.textContent=``}function wr(e){return function(){this.textContent=e}}function Tr(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Er(e){return arguments.length?this.each(e==null?Cr:(typeof e==`function`?Tr:wr)(e)):this.node().textContent}function Dr(){this.innerHTML=``}function Or(e){return function(){this.innerHTML=e}}function kr(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Ar(e){return arguments.length?this.each(e==null?Dr:(typeof e==`function`?kr:Or)(e)):this.node().innerHTML}function jr(){this.nextSibling&&this.parentNode.appendChild(this)}function Mr(){return this.each(jr)}function Nr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pr(){return this.each(Nr)}function Fr(e){var t=typeof e==`function`?e:un(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ir(){return null}function Lr(e,t){var n=typeof e==`function`?e:un(e),r=t==null?Ir:typeof t==`function`?t:fn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Rr(){var e=this.parentNode;e&&e.removeChild(this)}function zr(){return this.each(Rr)}function Br(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vr(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hr(e){return this.select(e?Vr:Br)}function Ur(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Wr(e){return function(t){e.call(this,t,this.__data__)}}function Gr(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Kr(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function qr(e,t,n){return function(){var r=this.__on,i,a=Wr(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Jr(e,t,n){var r=Gr(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?qr:Kr,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function Yr(e,t,n){var r=ir(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Xr(e,t){return function(){return Yr(this,e,t)}}function Zr(e,t){return function(){return Yr(this,e,t.apply(this,arguments))}}function Qr(e,t){return this.each((typeof t==`function`?Zr:Xr)(e,t))}function*$r(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var ei=[null];function J(e,t){this._groups=e,this._parents=t}function ti(){return new J([[document.documentElement]],ei)}function ni(){return this}J.prototype=ti.prototype={constructor:J,select:pn,selectAll:vn,selectChild:wn,selectChildren:On,filter:kn,data:Ln,enter:jn,exit:zn,join:Bn,merge:Vn,selection:ni,order:Hn,sort:Un,call:Gn,nodes:Kn,node:qn,size:Jn,empty:Yn,each:Xn,attr:rr,style:cr,property:pr,classed:Sr,text:Er,html:Ar,raise:Mr,lower:Pr,append:Fr,insert:Lr,remove:zr,clone:Hr,datum:Ur,on:Jr,dispatch:Qr,[Symbol.iterator]:$r};function Y(e){return typeof e==`string`?new J([[document.querySelector(e)]],[document.documentElement]):new J([[e]],ei)}function ri(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ii(e,t){if(e=ri(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var ai={capture:!0,passive:!1};function oi(e){e.preventDefault(),e.stopImmediatePropagation()}function si(e){var t=e.document.documentElement,n=Y(e).on(`dragstart.drag`,oi,ai);`onselectstart`in t?n.on(`selectstart.drag`,oi,ai):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function ci(e,t){var n=e.document.documentElement,r=Y(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,oi,ai),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function li(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ui(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function di(){}var fi=.7,pi=1/fi,mi=`\\s*([+-]?\\d+)\\s*`,hi=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,X=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,gi=/^#([0-9a-f]{3,8})$/,_i=RegExp(`^rgb\\(${mi},${mi},${mi}\\)$`),vi=RegExp(`^rgb\\(${X},${X},${X}\\)$`),yi=RegExp(`^rgba\\(${mi},${mi},${mi},${hi}\\)$`),bi=RegExp(`^rgba\\(${X},${X},${X},${hi}\\)$`),xi=RegExp(`^hsl\\(${hi},${X},${X}\\)$`),Si=RegExp(`^hsla\\(${hi},${X},${X},${hi}\\)$`),Ci={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};li(di,Oi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:wi,formatHex:wi,formatHex8:Ti,formatHsl:Ei,formatRgb:Di,toString:Di});function wi(){return this.rgb().formatHex()}function Ti(){return this.rgb().formatHex8()}function Ei(){return Bi(this).formatHsl()}function Di(){return this.rgb().formatRgb()}function Oi(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=gi.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ki(t):n===3?new Z(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ai(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ai(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=_i.exec(e))?new Z(t[1],t[2],t[3],1):(t=vi.exec(e))?new Z(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=yi.exec(e))?Ai(t[1],t[2],t[3],t[4]):(t=bi.exec(e))?Ai(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=xi.exec(e))?zi(t[1],t[2]/100,t[3]/100,1):(t=Si.exec(e))?zi(t[1],t[2]/100,t[3]/100,t[4]):Ci.hasOwnProperty(e)?ki(Ci[e]):e===`transparent`?new Z(NaN,NaN,NaN,0):null}function ki(e){return new Z(e>>16&255,e>>8&255,e&255,1)}function Ai(e,t,n,r){return r<=0&&(e=t=n=NaN),new Z(e,t,n,r)}function ji(e){return e instanceof di||(e=Oi(e)),e?(e=e.rgb(),new Z(e.r,e.g,e.b,e.opacity)):new Z}function Mi(e,t,n,r){return arguments.length===1?ji(e):new Z(e,t,n,r??1)}function Z(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}li(Z,Mi,ui(di,{brighter(e){return e=e==null?pi:pi**+e,new Z(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?fi:fi**+e,new Z(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Z(Li(this.r),Li(this.g),Li(this.b),Ii(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ni,formatHex:Ni,formatHex8:Pi,formatRgb:Fi,toString:Fi}));function Ni(){return`#${Ri(this.r)}${Ri(this.g)}${Ri(this.b)}`}function Pi(){return`#${Ri(this.r)}${Ri(this.g)}${Ri(this.b)}${Ri((isNaN(this.opacity)?1:this.opacity)*255)}`}function Fi(){let e=Ii(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Li(this.r)}, ${Li(this.g)}, ${Li(this.b)}${e===1?`)`:`, ${e})`}`}function Ii(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Li(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ri(e){return e=Li(e),(e<16?`0`:``)+e.toString(16)}function zi(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Q(e,t,n,r)}function Bi(e){if(e instanceof Q)return new Q(e.h,e.s,e.l,e.opacity);if(e instanceof di||(e=Oi(e)),!e)return new Q;if(e instanceof Q)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new Q(o,s,c,e.opacity)}function Vi(e,t,n,r){return arguments.length===1?Bi(e):new Q(e,t,n,r??1)}function Q(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}li(Q,Vi,ui(di,{brighter(e){return e=e==null?pi:pi**+e,new Q(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?fi:fi**+e,new Q(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Z(Wi(e>=240?e-240:e+120,i,r),Wi(e,i,r),Wi(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Q(Hi(this.h),Ui(this.s),Ui(this.l),Ii(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Ii(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Hi(this.h)}, ${Ui(this.s)*100}%, ${Ui(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Hi(e){return e=(e||0)%360,e<0?e+360:e}function Ui(e){return Math.max(0,Math.min(1,e||0))}function Wi(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Gi=e=>()=>e;function Ki(e,t){return function(n){return e+n*t}}function qi(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Ji(e){return(e=+e)==1?Yi:function(t,n){return n-t?qi(t,n,e):Gi(isNaN(t)?n:t)}}function Yi(e,t){var n=t-e;return n?Ki(e,n):Gi(isNaN(e)?t:e)}var Xi=(function e(t){var n=Ji(t);function r(e,t){var r=n((e=Mi(e)).r,(t=Mi(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Yi(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Zi(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Qi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$i=new RegExp(Qi.source,`g`);function ea(e){return function(){return e}}function ta(e){return function(t){return e(t)+``}}function na(e,t){var n=Qi.lastIndex=$i.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Qi.exec(e))&&(i=$i.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Zi(r,i)})),n=$i.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?ta(c[0].x):ea(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}var ra=180/Math.PI,ia={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function aa(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*ra,skewX:Math.atan(c)*ra,scaleX:o,scaleY:s}}var oa;function sa(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?ia:aa(t.a,t.b,t.c,t.d,t.e,t.f)}function ca(e){return e==null||(oa||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),oa.setAttribute(`transform`,e),!(e=oa.transform.baseVal.consolidate()))?ia:(e=e.matrix,aa(e.a,e.b,e.c,e.d,e.e,e.f))}function la(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:Zi(e,i)},{i:c-2,x:Zi(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Zi(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Zi(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Zi(e,n)},{i:s-2,x:Zi(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var ua=la(sa,`px, `,`px)`,`deg)`),da=la(ca,`, `,`)`,`)`),fa=1e-12;function pa(e){return((e=Math.exp(e))+1/e)/2}function ma(e){return((e=Math.exp(e))-1/e)/2}function ha(e){return((e=Math.exp(2*e))-1)/(e+1)}var ga=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<fa)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=pa(y),c=s/(n*g)*(i*ha(t*r+y)-ma(y));return[a+c*d,o+c*f,s*i/pa(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),_a=xt(`start`,`end`,`cancel`,`interrupt`),va=[];function ya(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Sa(e,n,{name:t,index:r,group:i,on:_a,tween:va,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function ba(e,t){var n=$(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function xa(e,t){var n=$(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function $(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Sa(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Bt(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return Kt(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(Kt(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Ca(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function wa(e){return this.each(function(){Ca(this,e)})}function Ta(e,t){var n,r;return function(){var i=xa(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Ea(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=xa(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Da(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=$(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?Ta:Ea)(n,e,t))}function Oa(e,t,n){var r=e._id;return e.each(function(){var e=xa(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return $(e,r).value[t]}}function ka(e,t){var n;return(typeof t==`number`?Zi:t instanceof Oi?Xi:(n=Oi(t))?(t=n,Xi):na)(e,t)}function Aa(e){return function(){this.removeAttribute(e)}}function ja(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ma(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Na(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Pa(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Fa(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Ia(e,t){var n=sn(e),r=n===`transform`?da:ka;return this.attrTween(e,typeof t==`function`?(n.local?Fa:Pa)(n,r,Oa(this,`attr.`+e,t)):t==null?(n.local?ja:Aa)(n):(n.local?Na:Ma)(n,r,t))}function La(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ra(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function za(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ra(e,i)),n}return i._value=t,i}function Ba(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&La(e,i)),n}return i._value=t,i}function Va(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=sn(e);return this.tween(n,(r.local?za:Ba)(r,t))}function Ha(e,t){return function(){ba(this,e).delay=+t.apply(this,arguments)}}function Ua(e,t){return t=+t,function(){ba(this,e).delay=t}}function Wa(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ha:Ua)(t,e)):$(this.node(),t).delay}function Ga(e,t){return function(){xa(this,e).duration=+t.apply(this,arguments)}}function Ka(e,t){return t=+t,function(){xa(this,e).duration=t}}function qa(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ga:Ka)(t,e)):$(this.node(),t).duration}function Ja(e,t){if(typeof t!=`function`)throw Error();return function(){xa(this,e).ease=t}}function Ya(e){var t=this._id;return arguments.length?this.each(Ja(t,e)):$(this.node(),t).ease}function Xa(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();xa(this,e).ease=n}}function Za(e){if(typeof e!=`function`)throw Error();return this.each(Xa(this._id,e))}function Qa(e){typeof e!=`function`&&(e=yn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Oo(r,this._parents,this._name,this._id)}function $a(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new Oo(o,this._parents,this._name,this._id)}function eo(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function to(e,t,n){var r,i,a=eo(t)?ba:xa;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function no(e,t){var n=this._id;return arguments.length<2?$(this.node(),n).on.on(e):this.each(to(n,e,t))}function ro(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function io(){return this.on(`end.remove`,ro(this._id))}function ao(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=fn(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,ya(l[f],t,n,f,l,$(u,n)));return new Oo(a,this._parents,t,n)}function oo(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=gn(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=$(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&ya(p,t,n,h,f,m);a.push(f),o.push(u)}return new Oo(a,o,t,n)}var so=ti.prototype.constructor;function co(){return new so(this._groups,this._parents)}function lo(e,t){var n,r,i;return function(){var a=lr(this,e),o=(this.style.removeProperty(e),lr(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function uo(e){return function(){this.style.removeProperty(e)}}function fo(e,t,n){var r,i=n+``,a;return function(){var o=lr(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function po(e,t,n){var r,i,a;return function(){var o=lr(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),lr(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function mo(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=xa(this,e),l=c.on,u=c.value[a]==null?s||=uo(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function ho(e,t,n){var r=(e+=``)==`transform`?ua:ka;return t==null?this.styleTween(e,lo(e,r)).on(`end.style.`+e,uo(e)):typeof t==`function`?this.styleTween(e,po(e,r,Oa(this,`style.`+e,t))).each(mo(this._id,e)):this.styleTween(e,fo(e,r,t),n).on(`end.style.`+e,null)}function go(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function _o(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&go(e,a,n)),r}return a._value=t,a}function vo(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,_o(e,t,n??``))}function yo(e){return function(){this.textContent=e}}function bo(e){return function(){var t=e(this);this.textContent=t??``}}function xo(e){return this.tween(`text`,typeof e==`function`?bo(Oa(this,`text`,e)):yo(e==null?``:e+``))}function So(e){return function(t){this.textContent=e.call(this,t)}}function Co(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&So(r)),t}return r._value=e,r}function wo(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,Co(e))}function To(){for(var e=this._name,t=this._id,n=ko(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=$(c,t);ya(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Oo(r,this._parents,e,n)}function Eo(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=xa(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Do=0;function Oo(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function ko(){return++Do}var Ao=ti.prototype;Oo.prototype={constructor:Oo,select:ao,selectAll:oo,selectChild:Ao.selectChild,selectChildren:Ao.selectChildren,filter:Qa,merge:$a,selection:co,transition:To,call:Ao.call,nodes:Ao.nodes,node:Ao.node,size:Ao.size,empty:Ao.empty,each:Ao.each,on:no,attr:Ia,attrTween:Va,style:ho,styleTween:vo,text:xo,textTween:wo,remove:io,tween:Da,delay:Wa,duration:qa,ease:Ya,easeVarying:Za,end:Eo,[Symbol.iterator]:Ao[Symbol.iterator]};function jo(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Mo={time:null,delay:0,duration:250,ease:jo};function No(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Po(e){var t,n;e instanceof Oo?(t=e._id,e=e._name):(t=ko(),(n=Mo).time=Lt(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&ya(c,e,t,l,o,n||No(c,t));return new Oo(r,this._parents,e,t)}ti.prototype.interrupt=wa,ti.prototype.transition=Po;var Fo=e=>()=>e;function Io(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Lo(e,t,n){this.k=e,this.x=t,this.y=n}Lo.prototype={constructor:Lo,scale:function(e){return e===1?this:new Lo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Lo(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var Ro=new Lo(1,0,0);zo.prototype=Lo.prototype;function zo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ro;return e.__zoom}function Bo(e){e.stopImmediatePropagation()}function Vo(e){e.preventDefault(),e.stopImmediatePropagation()}function Ho(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Uo(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Wo(){return this.__zoom||Ro}function Go(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ko(){return navigator.maxTouchPoints||`ontouchstart`in this}function qo(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Jo(){var e=Ho,t=Uo,n=qo,r=Go,i=Ko,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ga,l=xt(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Wo).on(`wheel.zoom`,te,{passive:!1}).on(`mousedown.zoom`,C).on(`dblclick.zoom`,w).filter(i).on(`touchstart.zoom`,ne).on(`touchmove.zoom`,T).on(`touchend.zoom touchcancel.zoom`,re).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Wo),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Ro.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new Lo(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Lo(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new Lo(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new ee(e,t)}function ee(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}ee.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Y(this.that).datum();l.call(e,this.that,new Io(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function te(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=ii(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Ca(this),s.start();Vo(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function C(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Y(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=ii(t,i),l=t.clientX,u=t.clientY;si(t.view),Bo(t),a.mouse=[c,this.__zoom.invert(c)],Ca(this),a.start();function d(e){if(Vo(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=ii(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),ci(e.view,a.moved),Vo(e),a.event(e).end()}}function w(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=ii(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Vo(r),s>0?Y(this).transition().duration(s).call(x,d,c,r):Y(this).call(_.transform,d,c,r)}}function ne(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(Bo(t),s=0;s<i;++s)c=r[s],l=ii(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),Ca(this),a.start())}}function T(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(Vo(e),s=0;s<a;++s)c=i[s],l=ii(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function re(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(Bo(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=ii(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=Y(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Fo(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Fo(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Fo(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Fo([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var Yo=[`height`,`viewBox`,`width`],Xo=[`id`],Zo=[`fill`],Qo=[`transform`],$o=[`cx`,`cy`,`fill`,`fill-opacity`,`r`,`stroke`,`stroke-opacity`],es=[`stroke`,`stroke-opacity`,`stroke-width`,`marker-end`,`x1`,`x2`,`y1`,`y2`],ts=[`stroke`,`marker-end`,`x1`,`x2`,`y1`,`y2`],ns=[`opacity`,`aria-label`,`transform`,`onClick`,`onKeydown`,`onPointercancel`,`onPointerdown`,`onPointermove`,`onPointerup`],rs=[`fill`,`r`,`stroke`,`stroke-opacity`,`stroke-width`],is={key:0,class:`pointer-events-none`},as=[`fill`,`fill-opacity`,`stroke`,`stroke-opacity`,`width`,`x`],os=[`fill`,`text-anchor`,`x`],ss=[`fill`,`text-anchor`,`x`],cs={class:`absolute bottom-3 left-3 z-30 grid grid-cols-2 gap-x-3 gap-y-1.5 border border-base bg-glass px-3 py-2 shadow`},ls={class:`truncate`},us={class:`absolute bottom-3 right-3 z-30 flex flex-col items-end gap-2`},ds={class:`w-28 flex items-center justify-between gap-0.5 rounded-full border border-base bg-glass p-1 shadow`},fs=[`disabled`],ps={class:`font-state-field h-8 w-8 rounded-full bg-active color-muted flex items-center justify-center text-3.5`},ms=[`disabled`],hs={class:`w-28 flex items-center justify-between gap-0.5 rounded-full border border-base bg-glass p-1 shadow`},gs=680,_s=460,vs=34,ys=1,bs=6,xs=d({__name:`ReactivityGraphCanvas`,props:c({graph:{},path:{},pathSelectorOpen:{type:Boolean}},{selectedNodeId:{},selectedNodeIdModifiers:{},dependencyDepth:{required:!0},dependencyDepthModifiers:{}}),emits:c([`select`],[`update:selectedNodeId`,`update:dependencyDepth`]),setup(a,{emit:c}){let d=a,g=l(a,`selectedNodeId`),S=l(a,`dependencyDepth`),T=c,O=ee(d,`graph`),k=ee(d,`pathSelectorOpen`),A=f(()=>!!d.path),j=f(()=>d.path??fe());function M(e){T(`select`,e)}let N=[`#13966f`,`#3b82d6`,`#c58119`,`#d84f45`,`#0891b2`,`#db2777`,`#7c3aed`,`#64748b`],P=p(),F=p(),I=p(960),L=p(640),R=p({x:0,y:0,k:1}),B=p(0),V=b([]),le=b([]),ue=f(()=>new Map(V.value.map(e=>[e.id,e]))),de=b([]),pe,me,he,ge,_e=f(()=>[O.value.nodes.map(e=>`${e.id}:${e.type}:${e.label}`).join(`|`),O.value.relationships.map(e=>`${e.id}:${e.from}:${e.to}`).join(`|`)].join(`::`)),ve=f(()=>({links:le.value,nodes:V.value,version:B.value})),ye=f(()=>{if(!A.value)return[];let e=j.value.relationshipIds;return ve.value.links.filter(t=>e.has(t.id))}),be=f(()=>{let e=ae(de.value,I.value,L.value);return de.value.map(t=>{let n=e.get(t.id)??{x:I.value/2,y:L.value/2};return{...t,color:it(t.id),radius:Math.max(86,Math.min(210,56+Math.sqrt(t.nodeCount)*34)),x:n.x,y:n.y}})}),xe=f(()=>`translate(${R.value.x} ${R.value.y}) scale(${R.value.k})`),Se=f(()=>`${Math.round(R.value.k*100)}%`),Ce=f(()=>V.value.find(e=>e.id===g.value)),we=f(()=>Ce.value?de.value.find(e=>e.id===Ce.value?.group):void 0),Te=f(()=>{if(!g.value)return Oe();let e=ke(g.value,`dependencies`,S.value),t=ke(g.value,`subscribers`,S.value),n=new Set([g.value,...e.nodeIds,...t.nodeIds]);return{dependencyNodeIds:e.nodeIds,nodeIds:n,relationshipIds:new Set([...e.relationshipIds,...t.relationshipIds]),subscriberNodeIds:t.nodeIds}}),Ee=f(()=>A.value?j.value.relationshipIds:Te.value.relationshipIds),De=f(()=>A.value?j.value.nodeIds:Te.value.nodeIds);function Oe(){return{dependencyNodeIds:new Set,nodeIds:new Set,relationshipIds:new Set,subscriberNodeIds:new Set}}function ke(e,t,n){let r=new Set,i=new Set,a=new Set([e]),o=new Set([e]);for(let e=0;e<n&&o.size;e+=1){let e=new Set;for(let n of le.value){let s=t===`dependencies`?n.from:n.to,c=t===`dependencies`?n.to:n.from;o.has(c)&&(i.add(n.id),r.add(s),a.has(s)||(a.add(s),e.add(s)))}o=e}return{nodeIds:r,relationshipIds:i}}function Ae(e){S.value=Math.min(bs,Math.max(ys,e))}function je(e){Ae(S.value+e)}function Me(){me?.stop();let e=ie(O.value,I.value,L.value);if(V.value=e.nodes,le.value=e.links,de.value=e.groups,B.value+=1,g.value&&!e.nodes.some(e=>e.id===g.value)&&(g.value=void 0),!g.value&&!k.value&&!A.value&&(g.value=nt(e.nodes)?.id),!e.nodes.length){me=void 0;return}let t=ae(e.groups,I.value,L.value);me=tn(e.nodes).force(`link`,yt(e.links).id(e=>e.id).distance(e=>e.group===we.value?.id?92:112).strength(.58)).force(`charge`,nn().strength(e=>-260-e.radius*14)).force(`collide`,gt().radius(e=>e.radius+Qe(e))).force(`x`,rn(e=>t.get(e.group)?.x??I.value/2).strength(.085)).force(`y`,an(e=>t.get(e.group)?.y??L.value/2).strength(.085)).alpha(.95).alphaDecay(.022).on(`tick`,()=>{B.value+=1})}function Ne(){me&&me.force(`collide`,gt().radius(e=>e.radius+Qe(e))).alpha(.32).restart()}function Pe(){F.value&&(he=Jo().scaleExtent([.32,2.6]).filter(e=>{let t=e.target;return e.type===`mousedown`&&t?.closest(`[data-graph-node]`)?!1:(!e.ctrlKey||e.type===`wheel`)&&!e.button}).on(`zoom`,e=>{R.value={k:e.transform.k,x:e.transform.x,y:e.transform.y}}),Y(F.value).call(he),t(Fe))}function Fe(){if(!F.value||!he)return;let e=Le();if(!e){Y(F.value).call(he.transform,Ro);return}let t=Math.max(1,e.maxX-e.minX),n=Math.max(1,e.maxY-e.minY),r=Math.min(1.45,Math.max(.42,Math.min((I.value-96)/t,(L.value-96)/n))),i=(e.minX+e.maxX)/2,a=(e.minY+e.maxY)/2,o=Ro.translate(I.value/2,L.value/2).scale(r).translate(-i,-a);Y(F.value).call(he.transform,o)}function Ie(e){F.value&&he&&Y(F.value).call(he.scaleBy,e)}function Le(){let e=V.value;if(!e.length)return;let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e){let e=a.x??I.value/2,o=a.y??L.value/2;t=Math.min(t,e-a.radius-72),n=Math.min(n,o-a.radius-32),r=Math.max(r,e+a.radius+142),i=Math.max(i,o+a.radius+32)}return{minX:t,minY:n,maxX:r,maxY:i}}function Re(e,t){e.stopPropagation(),M(t.id),ge=t.id,t.fx=t.x,t.fy=t.y,me?.alphaTarget(.28).restart(),e.currentTarget.setPointerCapture(e.pointerId)}function ze(e,t){if(ge!==t.id)return;let n=Ve(e);t.fx=n.x,t.fy=n.y,B.value+=1}function Be(e,t){ge===t.id&&(ge=void 0,t.fx=null,t.fy=null,me?.alphaTarget(0),e.currentTarget.releasePointerCapture(e.pointerId))}function Ve(e){if(!F.value)return{x:e.offsetX,y:e.offsetY};let t=F.value.createSVGPoint();t.x=e.clientX,t.y=e.clientY;let n=F.value.getScreenCTM(),r=n?t.matrixTransform(n.inverse()):t;return{x:(r.x-R.value.x)/R.value.k,y:(r.y-R.value.y)/R.value.k}}function He(e){return We(e.source)}function Ue(e){return We(e.target)}function We(e){if(typeof e==`object`)return e;if(e!=null)return ue.value.get(String(e))}function Ge(e){return Ye(e,`source`).x}function Ke(e){return Ye(e,`source`).y}function qe(e){return Ye(e,`target`).x}function Je(e){return Ye(e,`target`).y}function Ye(e,t){let n=He(e),r=Ue(e);if(!n||!r)return{x:I.value/2,y:L.value/2};let i=n.x??I.value/2,a=n.y??L.value/2,o=r.x??I.value/2,s=r.y??L.value/2,c=o-i,l=s-a,u=Math.hypot(c,l)||1,d=c/u,f=l/u;if(t===`source`){let e=n.radius+2;return{x:i+d*e,y:a+f*e}}let p=r.radius+6;return{x:o-d*p,y:s-f*p}}function U(e){return A.value?Ee.value.has(e.id):!g.value||Ee.value.has(e.id)}function Xe(e){return A.value?De.value.has(e.id):!g.value||De.value.has(e.id)}function W(e){return A.value&&De.value.has(e.id)}function Ze(e){return A.value?De.value.has(e.id):g.value?e.id===g.value||De.value.has(e.id):rt(e)>=4}function Qe(e){return Ze(e)?44+e.labelWidth*.16:20}function G(e){let t=I.value/2;return(e.x??t)>t?`left`:`right`}function $e(e){let t=e.radius+8;return G(e)===`left`?-e.labelWidth-t:t}function et(e){return G(e)===`left`?$e(e)+e.labelWidth-10:$e(e)+10}function tt(e){return G(e)===`left`?`end`:`start`}function nt(e){return[...e].sort((e,t)=>rt(t)-rt(e)).at(0)}function rt(e){let t=Math.min(e.incoming,e.outgoing)*2,n=e.type===`computed`?2:+(e.type===`watch`||e.type===`effect`);return e.incoming+e.outgoing+t+n}function it(e){return N[e%N.length]}function at(e){return A.value||g.value?U(e)?it(e.group):`#888888`:it(e.group)}function ot(e){return A.value?U(e)?.9:.08:g.value?U(e)?.72:.12:.42}function st(e){return A.value?U(e)?2.8:1:U(e)?1.8:1.1}function ct(e){return`url(#${(g.value||A.value)&&!U(e)?`reactivity-arrow-muted`:`reactivity-arrow-${e.group%N.length}`})`}function lt(e){return A.value?Xe(e)?1:.18:g.value?Xe(e)?1:.28:1}function ut(e){return e.id===g.value||W(e)?`#111827`:`#ffffff`}function dt(e){return e.id===g.value||W(e)?.72:.92}function ft(e){return e.id===g.value||W(e)?3:1.5}return e(()=>{P.value&&(pe=new ResizeObserver(([e])=>{I.value=Math.max(gs,e.contentRect.width),L.value=Math.max(_s,e.contentRect.height)}),pe.observe(P.value)),Pe()}),o([_e,I,L],()=>{Me(),t(Fe)},{immediate:!0}),o([g,S,()=>d.path],Ne),_(()=>{pe?.disconnect(),me?.stop()}),(e,t)=>{let a=ne(`tooltip`);return s(),h(`div`,{ref_key:`container`,ref:P,class:`relative h-full min-w-0 overflow-hidden bg-subtle bg-dots select-none`},[(s(),h(`svg`,{ref_key:`svg`,ref:F,class:`h-full w-full touch-none`,role:`img`,"aria-label":`Vue reactivity dependency graph`,height:L.value,viewBox:`0 0 ${I.value} ${L.value}`,width:I.value},[m(`defs`,null,[t[4]||=m(`marker`,{id:`reactivity-arrow-muted`,markerHeight:`10`,markerUnits:`userSpaceOnUse`,markerWidth:`10`,orient:`auto`,refX:`8`,refY:`0`,viewBox:`0 -5 10 10`},[m(`path`,{d:`M 0 -4 L 9 0 L 0 4 z`,fill:`#888888`,opacity:`0.42`})],-1),(s(),h(v,null,i(N,(e,t)=>m(`marker`,{id:`reactivity-arrow-${t}`,key:`arrow-${t}`,markerHeight:`10`,markerUnits:`userSpaceOnUse`,markerWidth:`10`,orient:`auto`,refX:`8`,refY:`0`,viewBox:`0 -5 10 10`},[m(`path`,{d:`M 0 -4 L 9 0 L 0 4 z`,fill:it(t),opacity:`0.82`},null,8,Zo)],8,Xo)),64))]),m(`g`,{transform:xe.value},[(s(!0),h(v,null,i(be.value,e=>(s(),h(`circle`,{key:`group-${e.id}`,cx:e.x,cy:e.y,fill:e.color,"fill-opacity":we.value&&we.value.id!==e.id?.025:.07,r:e.radius,stroke:e.color,"stroke-opacity":we.value&&we.value.id!==e.id?.08:.18,"stroke-dasharray":`5 6`,"stroke-width":`1`},null,8,$o))),128)),(s(!0),h(v,null,i(ve.value.links,e=>(s(),h(`line`,{key:e.id,stroke:at(e),"stroke-linecap":`round`,"stroke-opacity":ot(e),"stroke-width":st(e),"marker-end":ct(e),x1:Ge(e),x2:qe(e),y1:Ke(e),y2:Je(e)},null,8,es))),128)),(s(!0),h(v,null,i(ye.value,e=>(s(),h(`line`,{key:`path-${e.id}`,class:`pointer-events-none`,stroke:at(e),"stroke-linecap":`round`,"stroke-opacity":`0.96`,"stroke-width":`3.4`,"marker-end":ct(e),x1:Ge(e),x2:qe(e),y1:Ke(e),y2:Je(e)},null,8,ts))),128)),(s(!0),h(v,null,i(ve.value.nodes,e=>(s(),h(`g`,{key:e.id,"data-graph-node":``,class:`cursor-grab outline-none active:cursor-grabbing`,opacity:lt(e),role:`button`,tabindex:`0`,"aria-label":`Select ${x(z)(e)} graph node`,transform:`translate(${e.x??I.value/2} ${e.y??L.value/2})`,onClick:D(t=>M(e.id),[`stop`]),onKeydown:re(D(t=>M(e.id),[`prevent`]),[`enter`]),onPointercancel:t=>Be(t,e),onPointerdown:t=>Re(t,e),onPointermove:t=>ze(t,e),onPointerup:t=>Be(t,e)},[m(`circle`,{fill:x(ce)(e.type),r:e.radius,stroke:ut(e),"stroke-opacity":dt(e),"stroke-width":ft(e),class:`dark:stroke-#f8fafc`},null,8,rs),Ze(e)?(s(),h(`g`,is,[m(`rect`,{fill:e.id===g.value?`#f8fafc`:`#111827`,"fill-opacity":e.id===g.value?.96:.9,height:vs,rx:`5`,stroke:it(e.group),"stroke-opacity":e.id===g.value?.82:.34,"stroke-width":`1`,width:e.labelWidth,x:$e(e),y:`-17`},null,8,as),m(`text`,{class:`font-state-field text-3 font-700`,"dominant-baseline":`middle`,fill:e.id===g.value?`#111827`:`#f8fafc`,"text-anchor":tt(e),x:et(e),y:`-5`},n(x(oe)(x(z)(e))),9,os),m(`text`,{class:`text-2.25 font-800`,"dominant-baseline":`middle`,fill:e.id===g.value?`#475569`:`#94a3b8`,"text-anchor":tt(e),x:et(e),y:`9`},n(x(H)(e.type)),9,ss)])):y(``,!0),m(`title`,null,n(x(z)(e))+` - `+n(x(H)(e.type)),1)],40,ns))),128))],8,Qo)],8,Yo)),m(`div`,cs,[(s(!0),h(v,null,i(x(se),e=>(s(),h(`div`,{key:e,class:`font-state-field min-w-23 flex items-center gap-1.5 color-base text-3.5`},[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(ce)(e)})},null,4),m(`span`,ls,n(x(H)(e)),1)]))),128))]),m(`div`,us,[u((s(),h(`div`,ds,[u((s(),h(`button`,{class:C([`h-8 w-8 rounded-full border-0 bg-transparent color-base flex items-center justify-center hover:bg-active`,S.value<=ys?`op35`:``]),type:`button`,"aria-label":`Decrease relationship depth`,disabled:S.value<=ys,onClick:t[0]||=D(e=>je(-1),[`stop`])},[w(E,{icon:`i-carbon-subtract`,class:`text-4`})],10,fs)),[[a,`Decrease relationship depth`,void 0,{top:!0}]]),m(`span`,ps,n(S.value),1),u((s(),h(`button`,{class:C([`h-8 w-8 rounded-full border-0 bg-transparent color-base flex items-center justify-center hover:bg-active`,S.value>=bs?`op35`:``]),type:`button`,"aria-label":`Increase relationship depth`,disabled:S.value>=bs,onClick:t[1]||=D(e=>je(1),[`stop`])},[w(E,{icon:`i-carbon-add`,class:`text-4`})],10,ms)),[[a,`Increase relationship depth`,void 0,{top:!0}]])])),[[a,`Relationship depth`,void 0,{top:!0}]]),m(`div`,hs,[u((s(),h(`button`,{class:`h-8 w-8 rounded-full border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Zoom out`,onClick:t[2]||=D(e=>Ie(.82),[`stop`])},[w(E,{icon:`i-carbon-zoom-out`,class:`text-4`})])),[[a,`Zoom out`,void 0,{top:!0}]]),u((s(),h(`button`,{class:`h-8 min-w-10 rounded-full border-0 bg-transparent px-1.5 color-muted text-3 hover:bg-active hover:color-base`,type:`button`,"aria-label":`Fit graph`,onClick:D(Fe,[`stop`])},[te(n(Se.value),1)])),[[a,`Fit graph`,void 0,{top:!0}]]),u((s(),h(`button`,{class:`h-8 w-8 rounded-full border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Zoom in`,onClick:t[3]||=D(e=>Ie(1.18),[`stop`])},[w(E,{icon:`i-carbon-zoom-in`,class:`text-4`})])),[[a,`Zoom in`,void 0,{top:!0}]])])])],512)}}}),Ss={class:`h-full min-w-0 overflow-auto p-3`},Cs={key:0},ws={key:0,class:`grid gap-0.5`},Ts=[`onClick`],Es={class:`w-4 shrink-0 text-right color-muted font-state-field text-3`},Ds={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Os={key:0,class:`color-muted`},ks={class:`shrink-0 color-muted text-3`},As={key:0,class:`h-7 color-muted flex items-center justify-center`},js={key:1,class:`h-28 flex items-center justify-center color-muted text-3.5 italic`},Ms={class:`pb-4`},Ns={class:`grid gap-0.5`},Ps={class:`state-key shrink-0 overflow-hidden text-ellipsis whitespace-nowrap op70`},Fs={class:`border-t border-base pt-4`},Is={class:`overflow-x-auto pb-2`},Ls=[`height`,`width`],Rs=[`d`],zs=[`onClick`],Bs={class:`min-w-0 flex items-center gap-1.5`},Vs={class:`truncate font-state-field text-3.5`},Hs={key:1,class:`h-28 flex items-center justify-center color-muted text-3.5 italic`},Us={key:2,class:`m-0 color-muted text-3 leading-5`},Ws=20,Gs=d({__name:`ReactivityGraphDetails`,props:{graph:{},filteredGraph:{},selectedNodeId:{},dependencyDepth:{},path:{}},emits:[`select`],setup(e,{emit:t}){let a=e,o=t,c=ee(a,`selectedNodeId`),l=ee(a,`dependencyDepth`),d=ee(a,`filteredGraph`),p=f(()=>a.filteredGraph.nodes),g=f(()=>a.filteredGraph.relationships),_=f(()=>!!a.path),b=f(()=>a.path??fe());function S(e){o(`select`,e)}let T={width:180,height:30,padding:4,columnGap:52,canvasPadding:16,dot:16},re=f(()=>new Map(a.graph.nodes.map(e=>[e.id,e]))),D=f(()=>b.value.orderedNodeIds.map(e=>re.value.get(e)).filter(e=>e!==void 0)),O=f(()=>{let e=new Map(d.value.relationships.map(e=>[e.id,e]));return b.value.orderedRelationshipIds.map(t=>e.get(t)).filter(e=>e!==void 0)}),k=f(()=>new Map(p.value.map(e=>[e.id,e]))),A=f(()=>p.value.find(e=>e.id===c.value)),j=f(()=>c.value&&re.value.has(c.value)?R(re.value.get(c.value)):[]),M=f(()=>I(`dependency`)),N=f(()=>I(`subscriber`)),P=f(()=>L());function F(e){return e?T.height*e+T.padding*(e+1):0}function I(e){let t=[],n=new Map,r=c.value;if(!r)return{depthById:n,layers:t};let i=new Set([r]),a=new Set([r]),o=0;for(let r=1;r<=l.value&&a.size;r+=1){let s=[],c=new Set;for(let t of g.value){let n=e===`dependency`?t.from:t.to,r=e===`dependency`?t.to:t.from;if(a.has(r)&&!(i.has(n)||c.has(n))&&k.value.has(n)&&(s.push(n),c.add(n),o+s.length>=Ws))break}let l=s.slice(0,Ws-o).map(e=>k.value.get(e)).filter(e=>e!==void 0);if(!l.length)break;for(let e of l)i.add(e.id),n.set(e.id,r);if(t.push(l),o+=l.length,a=new Set(l.map(e=>e.id)),o>=Ws)break}return{depthById:n,layers:t}}function L(){let e=c.value;if(!e)return{centerX:T.canvasPadding+T.dot/2,centerY:T.dot/2,height:T.dot,links:[],nodes:[],width:T.canvasPadding*2+T.dot};let t=M.value.layers,n=M.value.depthById,r=N.value.layers,i=N.value.depthById,a=T.width+T.columnGap,o=T.canvasPadding+r.length*a+T.dot/2,s=T.canvasPadding*2+r.length*a+T.dot+t.length*a,l=Math.max(T.dot,...r.map(e=>F(e.length)),...t.map(e=>F(e.length))),u=l/2,d=[],f=[],p=new Map;r.forEach((e,t)=>{let n=t+1,r=F(e.length),i=(l-r)/2+T.padding,s=o-T.dot/2-T.columnGap-T.width-t*a;e.forEach((e,r)=>{let a=i+r*(T.height+T.padding)+T.height/2,o={depth:n,node:e,side:`subscriber`,x:s,y:a};d.push(o),t===0&&f.push(a),p.set(e.id,{node:o,x:s,y:a})})}),t.forEach((e,t)=>{let n=t+1,r=F(e.length),i=(l-r)/2+T.padding,s=o+T.dot/2+T.columnGap+t*a;e.forEach((e,r)=>{let a=i+r*(T.height+T.padding)+T.height/2,o={depth:n,node:e,side:`dependency`,x:s,y:a};d.push(o),t===0&&f.push(a),p.set(e.id,{node:o,x:s,y:a})})}),f.length&&(u=(Math.min(...f)+Math.max(...f))/2),p.set(e,{x:o,y:u});let m=[];for(let t of g.value){let r=n.get(t.from),a=t.to===e?0:n.get(t.to);if(r!==void 0&&a!==void 0&&r===a+1){let e=p.get(t.to),n=p.get(t.from);e&&n&&m.push({id:`dependency:${t.id}`,path:oe(ae(e),e.y,n.x,n.y)})}let o=i.get(t.to),s=t.from===e?0:i.get(t.from);if(o!==void 0&&s!==void 0&&o===s+1){let e=p.get(t.to),n=p.get(t.from);e&&n&&m.push({id:`subscriber:${t.id}`,path:oe(ae(e),e.y,ie(n),n.y)})}}return{centerX:o,centerY:u,height:l,links:m,nodes:d,width:s}}function ie(e){return e.node?e.x:e.x-T.dot/2}function ae(e){return e.node?e.x+T.width:e.x+T.dot/2}function oe(e,t,n,r){let i=(e+n)/2;return`M ${e} ${t} C ${i} ${t} ${i} ${r} ${n} ${r}`}function R(e){let t=de(e);return[{key:`key`,value:B(z(e)),valueClass:`string-state-type`},{key:`type`,value:B(H(e.type)),valueClass:`string-state-type`},{key:`value`,value:t||`undefined`,valueClass:t?V(t):`null-state-type`}]}function B(e){return JSON.stringify(e)}function V(e){return e===`null`||e===`undefined`?`null-state-type`:e===`true`||e===`false`?`boolean-state-type`:e.startsWith(`"`)?`string-state-type`:/^-?\d/.test(e)||e.startsWith(`Symbol(`)?`literal-state-type`:`state-value`}function se(e){let t=de(e);return t?t.length>28?`${t.slice(0,27)}...`:t:``}return(e,t)=>{let a=ne(`tooltip`);return s(),h(`aside`,Ss,[_.value?(s(),h(`section`,Cs,[D.value.length?(s(),h(`div`,ws,[(s(!0),h(v,null,i(D.value,(e,t)=>(s(),h(v,{key:e.id},[m(`button`,{class:`min-w-0 rounded-1 border border-base bg-base px-2 py-1.5 text-left color-base flex items-center gap-2 hover:bg-active`,type:`button`,onClick:t=>S(e.id)},[m(`span`,Es,n(t+1),1),m(`span`,{class:`h-2.5 w-2.5 shrink-0 rounded-full`,style:r({background:x(ce)(e.type)})},null,4),u((s(),h(`span`,Ds,[m(`span`,null,n(x(z)(e)),1),se(e)?(s(),h(`span`,Os,` (`+n(se(e))+`) `,1)):y(``,!0)])),[[a,x(de)(e),void 0,{top:!0}]]),m(`span`,ks,n(x(H)(e.type)),1)],8,Ts),t<O.value.length?(s(),h(`div`,As,[w(E,{icon:`i-carbon-arrow-down`,class:`text-4`})])):y(``,!0)],64))),128))])):(s(),h(`div`,js,` No relationship path found `))])):A.value?(s(),h(v,{key:1},[m(`section`,Ms,[t[1]||=m(`h2`,{class:`mb-2 color-muted font-state-field text-3.5`},`Info`,-1),m(`div`,Ns,[(s(!0),h(v,null,i(j.value,e=>(s(),h(`div`,{key:e.key,class:`font-state-field min-w-0 flex items-center text-3.5`},[m(`span`,Ps,n(e.key),1),t[0]||=m(`span`,{class:`colon mx-1 shrink-0`},`:`,-1),u((s(),h(`span`,{class:C([`min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap`,e.valueClass])},[te(n(e.value),1)],2)),[[a,e.value,void 0,{top:!0}]])]))),128))])]),m(`section`,Fs,[t[2]||=m(`h2`,{class:`mb-2 color-muted font-state-field text-3.5`},`Relationships`,-1),m(`div`,Is,[P.value.nodes.length?(s(),h(`div`,{key:0,class:`relative select-none`,style:r({width:`${P.value.width}px`,height:`${P.value.height}px`})},[(s(),h(`svg`,{"pointer-events-none":``,class:`absolute left-0 top-0 z-10`,height:P.value.height,width:P.value.width},[m(`g`,null,[(s(!0),h(v,null,i(P.value.links,e=>(s(),h(`path`,{key:e.id,d:e.path,fill:`none`,stroke:`#888888`,"stroke-opacity":`0.34`},null,8,Rs))),128))])],8,Ls)),m(`div`,{class:`absolute z-20 box-border rounded-full bg-base`,style:r({top:`${P.value.centerY-T.dot/2}px`,left:`${P.value.centerX-T.dot/2}px`,width:`${T.dot}px`,height:`${T.dot}px`,border:`3px solid ${A.value?x(ce)(A.value.type):x(ce)(`unknown`)}`})},null,4),(s(!0),h(v,null,i(P.value.nodes,e=>u((s(),h(`button`,{key:`${e.side}:${e.depth}:${e.node.id}`,class:`absolute z-20 min-w-0 block rounded-1 border border-base bg-base px-2 py-1 text-left color-base hover:bg-active`,type:`button`,style:r({left:`${e.x}px`,top:`${e.y-T.height/2}px`,width:`${T.width}px`,height:`${T.height}px`,overflow:`hidden`}),onClick:t=>S(e.node.id)},[m(`span`,Bs,[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(ce)(e.node.type)})},null,4),m(`span`,Vs,n(x(z)(e.node)),1)])],12,zs)),[[a,`${x(z)(e.node)} - ${x(H)(e.node.type)}`,void 0,{top:!0}]])),128))],4)):(s(),h(`div`,Hs,` No data `))])])],64)):(s(),h(`p`,Us,` Select a node to inspect its dependencies and subscribers. `))])}}}),Ks={class:`h-full min-h-0 flex flex-col bg-base`},qs=d({__name:`ReactivityGraph`,props:{graph:{}},setup(e){let t=e,n=p(),r=p(1),i=p(``),o=p(new Set(se)),c=p(!1),l=p(``),u=p(``),d=f(()=>{let e=le(i.value),n=o.value,r=t.graph.nodes.filter(t=>n.has(t.type)&&ue(t,e)),a=new Set(r.map(e=>e.id));return{nodes:r,relationships:t.graph.relationships.filter(e=>a.has(e.from)&&a.has(e.to))}}),m=f(()=>pe(d.value.relationships)),g=f(()=>!!l.value&&!!u.value),_=f(()=>g.value?ge(l.value,u.value,m.value):fe());function v(e){c.value=!1,l.value=``,u.value=``,n.value=e}return(t,f)=>(s(),h(`div`,Ks,[w(Je,{search:i.value,"onUpdate:search":f[0]||=e=>i.value=e,"active-types":o.value,"onUpdate:activeTypes":f[1]||=e=>o.value=e,"path-selector-open":c.value,"onUpdate:pathSelectorOpen":f[2]||=e=>c.value=e,"path-start-id":l.value,"onUpdate:pathStartId":f[3]||=e=>l.value=e,"path-end-id":u.value,"onUpdate:pathEndId":f[4]||=e=>u.value=e,"selected-node-id":n.value,"onUpdate:selectedNodeId":f[5]||=e=>n.value=e,graph:e.graph,"filtered-graph":d.value},null,8,[`search`,`active-types`,`path-selector-open`,`path-start-id`,`path-end-id`,`selected-node-id`,`graph`,`filtered-graph`]),w(x(A),{class:`min-h-0 flex-1 overflow-hidden`},{default:a(()=>[w(x(j),{class:`h-full min-h-0`,"min-size":`30`,size:`53.333`},{default:a(()=>[w(xs,{"selected-node-id":n.value,"onUpdate:selectedNodeId":f[6]||=e=>n.value=e,"dependency-depth":r.value,"onUpdate:dependencyDepth":f[7]||=e=>r.value=e,graph:d.value,path:g.value?_.value:void 0,"path-selector-open":c.value,onSelect:v},null,8,[`selected-node-id`,`dependency-depth`,`graph`,`path`,`path-selector-open`])]),_:1}),w(x(j),{class:`h-full min-h-0`,"min-size":`24`,size:`46.667`},{default:a(()=>[w(Gs,{graph:e.graph,"filtered-graph":d.value,"selected-node-id":n.value,"dependency-depth":r.value,path:g.value?_.value:void 0,onSelect:v},null,8,[`graph`,`filtered-graph`,`selected-node-id`,`dependency-depth`,`path`])]),_:1})]),_:1})]))}}),Js={class:`h-full min-h-0 flex flex-col`},Ys={key:0,class:`max-h-38 shrink-0 border-b border-base`},Xs={class:`min-h-0 flex-1`},Zs={key:1,class:`h-full min-h-0 flex items-center justify-center bg-subtle p-6`},Qs={class:`m-0 max-w-78 text-center color-muted text-3.5 leading-5`},$s=d({__name:`graph`,setup(r){let{apps:i,cancelComponentInspection:o,componentInspecting:c,components:l,componentState:u,componentStateLoading:d,error:v,highlightComponent:b,inspectComponentInPage:ee,reactivityGraphEnabled:te,selectComponent:C,selectedComponent:ne,selectedComponentId:T,unhighlightComponent:re}=g(),E=p(),D=p(!1),N=p(``),P,F=f(()=>M(l.value,N.value)),I=f(()=>u.value?.reactivityGraph),L=f(()=>te.value?ne.value?d.value?`Loading reactivity graph...`:`No data`:`Select a component to inspect its reactivity graph.`:`Reactivity Graph requires Vue 3.6 or later.`),ie=f(()=>[{icon:`i-carbon-select-window`,tooltip:c.value?`Cancel selecting component`:`Select component in the page`,ariaLabel:`Select component in the page`,active:c.value,pressed:c.value,rounded:`full`,run:oe}]);async function ae(e){C(e),await t()}async function oe(){if(c.value){await o();return}let e=await ee();e&&(N.value=``,C(e.componentId),await t())}function R(e){ie.value[e]?.run()}function z(e){if(!B(e.target)){if(e.key.toLowerCase()===`s`&&(e.ctrlKey||e.metaKey)){e.preventDefault(),oe();return}e.key===`Escape`&&c.value&&(e.preventDefault(),o())}}function B(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable}return e(()=>{P=new ResizeObserver(([e])=>{D.value=e.contentRect.width<760}),E.value&&P.observe(E.value),window.addEventListener(`keydown`,z)}),_(()=>{P?.disconnect(),window.removeEventListener(`keydown`,z),c.value&&o(),re()}),(e,t)=>(s(),h(`section`,{ref_key:`container`,ref:E,class:`h-full min-h-0`},[w(x(A),{class:`h-full min-h-0 overflow-hidden`,horizontal:D.value},{default:a(()=>[w(x(j),{class:`h-full min-h-0`,"min-size":`16`,size:D.value?34:18},{default:a(()=>[m(`div`,Js,[x(i).length>1?(s(),h(`div`,Ys,[w(O)])):y(``,!0),m(`div`,Xs,[w(k,{filter:N.value,"onUpdate:filter":t[0]||=e=>N.value=e,actions:ie.value,"component-labels":``,"default-expand-depth":99,"empty-text":x(v)??`No components`,nodes:F.value,"no-matching-text":`No matching components`,placeholder:`Find components...`,"selected-node-id":x(T),"state-key":`reactivity-graph-components`,"refresh-visible":!1,onAction:R,onHover:t[1]||=e=>void x(b)(e),onLeave:t[2]||=()=>void x(re)(),onSelect:t[3]||=e=>void ae(e)},null,8,[`filter`,`actions`,`empty-text`,`nodes`,`selected-node-id`])])])]),_:1},8,[`size`]),w(x(j),{class:`h-full min-h-0`,"min-size":`32`},{default:a(()=>[x(te)&&I.value?.nodes.length?(s(),S(qs,{key:0,graph:I.value},null,8,[`graph`])):(s(),h(`div`,Zs,[m(`p`,Qs,n(L.value),1)]))]),_:1})]),_:1},8,[`horizontal`])],512))}});export{$s as default};
1
+ import{A as e,D as t,Dt as n,Et as r,I as i,J as a,K as o,M as s,T as c,W as l,Y as u,b as d,d as f,et as p,f as m,h,i as g,j as _,l as v,m as y,nt as b,ot as x,p as S,rt as ee,v as te,wt as C,y as w,z as ne}from"./_plugin-vue_export-helper-CVBmTk-L.js";import{d as T,f as re,i as E,p as D}from"./index-gOL3pdjp.js";import{n as O}from"./RecycleScroller.vue_vue_type_script_setup_true_lang-C7mZBLYi-D7DaT_pj.js";import{t as k}from"./InspectorTree-HaWX0rBG.js";import{n as A,t as j}from"./splitpanes.esm-DyLKHMh-.js";import{t as M}from"./component-tree-C3C12cZe.js";var N=8,P=16,F=7.2,I=172,L=76;function ie(e,t,n){let r=new Set(e.nodes.map(e=>e.id)),i=new Map(e.nodes.map(e=>[e.id,e.id])),a=new Map(e.nodes.map(e=>[e.id,0])),o=new Map(e.nodes.map(e=>[e.id,0]));function s(e){let t=i.get(e)??e;if(t===e)return t;let n=s(t);return i.set(e,n),n}function c(e,t){let n=s(e),r=s(t);n!==r&&i.set(r,n)}for(let t of e.relationships)r.has(t.from)&&r.has(t.to)&&(c(t.from,t.to),o.set(t.from,(o.get(t.from)??0)+1),a.set(t.to,(a.get(t.to)??0)+1));let l=new Map,u=[];for(let t of e.nodes){let e=s(t.id);if(l.has(e))continue;let n=l.size;l.set(e,n),u.push({id:n,nodeCount:0,relationshipCount:0})}let d=ae(u,t,n),f=e.nodes.map(e=>{let r=l.get(s(e.id))??0,i=(a.get(e.id)??0)+(o.get(e.id)??0),c=Math.min(P,N+Math.sqrt(i+1)*3),f=d.get(r)??{x:t/2,y:n/2},p=V(e.id)%360*(Math.PI/180),m=18+V(`${e.id}:distance`)%54,h=u[r];return h&&(h.nodeCount+=1),{id:e.id,type:e.type,label:e.label,group:r,incoming:a.get(e.id)??0,labelWidth:R(z(e)),outgoing:o.get(e.id)??0,radius:c,x:f.x+Math.cos(p)*m,y:f.y+Math.sin(p)*m}});return{groups:u,links:e.relationships.map(e=>{if(!r.has(e.from)||!r.has(e.to))return;let t=l.get(s(e.from))??0,n=u[t];return n&&(n.relationshipCount+=1),{...e,group:t,source:e.from,target:e.to,value:1}}).filter(e=>e!==void 0),nodes:f}}function ae(e,t,n){let r=new Map;if(!e.length)return r;let i=Math.ceil(Math.sqrt(e.length)),a=Math.ceil(e.length/i),o=Math.min(170,Math.max(78,t*.12)),s=Math.min(128,Math.max(76,n*.16)),c=Math.max(1,t-o*2),l=Math.max(1,n-s*2);return e.forEach((e,t)=>{let n=t%i,u=Math.floor(t/i);r.set(e.id,{x:o+c*(n+.5)/i,y:s+l*(u+.5)/a})}),r}function oe(e){return e.length<=22?e:`${e.slice(0,12)}...${e.slice(-7)}`}function R(e){return Math.min(I,Math.max(L,oe(e).length*F+22))}function z(e){let t=B(e.type);return new Set([e.type,t,`component render`,`reactive.property`,`render/effect`,`watch callback`]).has(e.label)?t:e.label}function B(e){switch(e){case`ref`:return`Anonymous Ref`;case`computed`:return`Anonymous Computed`;case`reactive`:return`Reactive Property`;case`watch`:return`Anonymous Watch`;case`render`:return`Anonymous Render`;case`effect`:return`Anonymous Effect`;default:return`Unknown`}}function V(e){let t=0;for(let n=0;n<e.length;n+=1)t=Math.imul(31,t)+e.charCodeAt(n);return Math.abs(t)}var se=[`ref`,`reactive`,`computed`,`watch`,`effect`,`render`,`unknown`];function ce(e){switch(e){case`ref`:return`#21a67a`;case`computed`:return`#3b82d6`;case`reactive`:return`#d79822`;case`render`:return`#f97316`;case`watch`:return`#0f766e`;case`effect`:return`#d84f45`;default:return`#94a3b8`}}function H(e){switch(e){case`ref`:return`Ref`;case`computed`:return`Computed`;case`reactive`:return`Reactive`;case`render`:return`Render Effect`;case`watch`:return`Watch`;case`effect`:return`Effect`;default:return`Unknown`}}function le(e){return e.trim().toLowerCase()}function ue(e,t){return!t||[e.id,e.label,H(e.type),de(e),...Object.values(e.data).map(e=>String(e))].some(e=>e.toLowerCase().includes(t))}function de(e){if(!e)return``;let t=e.data;if(!t)return``;let n=t.value??t.cb??t.instanceName;if(n==null)return``;if(typeof n==`string`)return n;try{return JSON.stringify(n)}catch{return String(n)}}function fe(){return{nodeIds:new Set,orderedNodeIds:[],orderedRelationshipIds:[],relationshipIds:new Set}}function pe(e){let t=new Map;for(let n of e){let e=t.get(n.from)??[];e.push(n),t.set(n.from,e)}return t}function me(e,t){let n=new Set(t.map(e=>e.to));return new Set(e.filter(e=>!n.has(e.id)).map(e=>e.id))}function he(e,t){let n=new Set([e]),r=[e];for(let e of r)for(let i of t.get(e)??[])n.has(i.to)||(n.add(i.to),r.push(i.to));return n.delete(e),n}function ge(e,t,n){if(!e||!t)return fe();let r=new Map,i=new Set([e]),a=[e];for(let e of a){if(i.has(t))break;for(let o of n.get(e)??[])if(!i.has(o.to)&&(i.add(o.to),r.set(o.to,o),a.push(o.to),o.to===t))break}let o=[t],s=[];if(i.has(t)){let n=t;for(;n!==e;){let e=r.get(n);s.push(e.id),o.push(e.from),n=e.from}}else o.push(e);return o.reverse(),s.reverse(),{nodeIds:new Set(o),orderedNodeIds:o,relationshipIds:new Set(s),orderedRelationshipIds:s}}var _e={class:`shrink-0 bg-base px-2`},ve={class:`min-w-0 flex items-center gap-2 py-2`},ye={key:0,class:`group relative min-w-0 flex flex-1 items-center justify-between gap-2 overflow-hidden rounded-1 border border-primary-100 px-3 py-0.75 color-base dark:border-gray-700`},be={key:1,class:`min-w-0 flex flex-1 items-center gap-2`},xe={class:`relative min-w-0 flex-1`},Se={key:0,class:`min-w-0 w-full overflow-hidden rounded-1 border border-base px-2 py-1 color-base flex items-center gap-1.5`},Ce={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},we=[`value`],Te={key:2,class:`absolute left-0 right-0 top-[calc(100%+4px)] z-50 max-h-58 overflow-auto rounded-1 border border-base bg-base p-1 shadow`},Ee=[`onMousedown`],De={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Oe={class:`shrink-0 color-muted text-3`},ke={key:0,class:`px-2 py-2 color-muted text-3 italic`},Ae={class:`relative min-w-0 flex-1`},je={key:0,class:`min-w-0 w-full overflow-hidden rounded-1 border border-base px-2 py-1 color-base flex items-center gap-1.5`},Me={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Ne=[`value`],Pe={key:2,class:`absolute left-0 right-0 top-[calc(100%+4px)] z-50 max-h-58 overflow-auto rounded-1 border border-base bg-base p-1 shadow`},Fe=[`onMousedown`],Ie={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Le={class:`shrink-0 color-muted text-3`},Re={key:0,class:`px-2 py-2 color-muted text-3 italic`},ze=[`aria-pressed`],Be=[`aria-expanded`],Ve={class:`mb-1 flex items-center justify-between gap-2`},He={class:`w-14 shrink-0 text-right color-muted font-state-field text-3`},Ue=[`title`],We=[`checked`,`onChange`],Ge={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Ke={class:`w-10 shrink-0 text-right color-muted text-3`},qe=220,Je=d({__name:`ReactivityGraphToolbar`,props:c({graph:{},filteredGraph:{}},{search:{required:!0},searchModifiers:{},activeTypes:{required:!0},activeTypesModifiers:{},pathSelectorOpen:{type:Boolean,required:!0},pathSelectorOpenModifiers:{},pathStartId:{required:!0},pathStartIdModifiers:{},pathEndId:{required:!0},pathEndIdModifiers:{},selectedNodeId:{},selectedNodeIdModifiers:{}}),emits:[`update:search`,`update:activeTypes`,`update:pathSelectorOpen`,`update:pathStartId`,`update:pathEndId`,`update:selectedNodeId`],setup(e){let t=e,a=ee(t,`filteredGraph`),c=l(e,`search`),d=l(e,`activeTypes`),g=l(e,`pathSelectorOpen`),b=l(e,`pathStartId`),S=l(e,`pathEndId`),te=l(e,`selectedNodeId`),O=p(),k=p(``),A=p(``),j=p(!1),M,N=f(()=>{let e=new Map;for(let t of se)e.set(t,0);for(let n of t.graph.nodes)e.set(n.type,(e.get(n.type)??0)+1);return e}),P=f(()=>new Map(t.graph.nodes.map(e=>[e.id,e]))),F=f(()=>[...a.value.nodes].sort((e,t)=>tt(e.id).localeCompare(tt(t.id)))),I=f(()=>me(a.value.nodes,a.value.relationships)),L=f(()=>pe(a.value.relationships)),ie=f(()=>et(k.value,S.value,I.value)),ae=f(()=>b.value?he(b.value,L.value):new Set),oe=f(()=>et(A.value,b.value,ae.value)),R=f(()=>!!b.value&&!!S.value);function B(e){return e.target instanceof HTMLInputElement?e.target.value:``}function V(e){return d.value.has(e)}function de(e){let t=new Set(d.value);t.has(e)?t.delete(e):t.add(e),d.value=t,W()}function fe(){d.value=new Set(se),W()}function ge(){d.value=new Set,W()}function Je(){M&&=(clearTimeout(M),void 0)}function Ye(){Je(),j.value=!0}function U(e){if(e instanceof FocusEvent){let t=e.currentTarget,n=e.relatedTarget;if(t instanceof Node&&n instanceof Node&&t.contains(n))return}Je(),M=setTimeout(()=>{j.value=!1,M=void 0},qe)}function Xe(){c.value=``,g.value=!0,O.value=`start`}function W(){g.value=!1,O.value=void 0,b.value=``,S.value=``,k.value=``,A.value=``}function Ze(e,t){e===`start`?(k.value=t,(!t||t!==tt(b.value))&&(G(),k.value=t)):(A.value=t,(!t||t!==tt(S.value))&&($e(),A.value=t))}function Qe(e,t){e===`start`?(b.value!==t&&$e(),b.value=t,k.value=tt(t),O.value=S.value?void 0:`end`):(S.value=t,A.value=tt(t),O.value=b.value?void 0:`start`),b.value&&S.value&&(te.value=void 0)}function G(){b.value=``,k.value=``,$e(),O.value=`start`}function $e(){S.value=``,A.value=``,O.value=`end`}function et(e,t,n){let r=le(e);return F.value.filter(e=>e.id===t||n&&!n.has(e.id)?!1:ue(e,r)).slice(0,8)}function tt(e){let t=P.value.get(e);return t?`${z(t)} (${H(t.type)})`:``}function nt(e){let t=P.value.get(e);return t?z(t):``}function rt(e){let t=P.value.get(e);return ce(t?t.type:`unknown`)}return o(g,e=>{e||W()}),_(Je),(e,o)=>{let l=ne(`tooltip`);return s(),h(`div`,_e,[m(`div`,ve,[g.value?(s(),h(`div`,be,[m(`div`,xe,[b.value?(s(),h(`div`,Se,[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:rt(b.value)})},null,4),m(`span`,Ce,n(nt(b.value)),1),u((s(),h(`button`,{class:`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center op70 hover:bg-active hover:color-base hover:op100`,type:`button`,"aria-label":`Clear path start`,onClick:G},[w(E,{icon:`i-carbon-clean`,class:`text-5.5`})])),[[l,`Clear start`,void 0,{top:!0}]])])):(s(),h(`input`,{key:1,class:`min-w-0 w-full rounded-1 border border-base bg-transparent px-3 py-1 outline-none font-state-field text-3.5 color-base placeholder-color-gray-500 dark:placeholder-gray-300`,placeholder:`Start`,type:`search`,value:k.value,onFocus:o[2]||=e=>O.value=`start`,onInput:o[3]||=e=>Ze(`start`,B(e)),onKeydown:re(W,[`esc`])},null,40,we)),!b.value&&O.value===`start`?(s(),h(`div`,Te,[(s(!0),h(v,null,i(ie.value,e=>(s(),h(`button`,{key:e.id,class:`min-w-0 w-full rounded-1 border-0 bg-transparent px-2 py-1.5 text-left color-base flex items-center gap-1.5 hover:bg-active`,type:`button`,onMousedown:D(t=>Qe(`start`,e.id),[`prevent`])},[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(ce)(e.type)})},null,4),m(`span`,De,n(x(z)(e)),1),m(`span`,Oe,n(x(H)(e.type)),1)],40,Ee))),128)),ie.value.length?y(``,!0):(s(),h(`div`,ke,` No matching nodes `))])):y(``,!0)]),w(E,{icon:`i-carbon-arrow-right`,class:`shrink-0 color-muted text-5`}),m(`div`,Ae,[S.value?(s(),h(`div`,je,[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:rt(S.value)})},null,4),m(`span`,Me,n(nt(S.value)),1),u((s(),h(`button`,{class:`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center op70 hover:bg-active hover:color-base hover:op100`,type:`button`,"aria-label":`Clear path end`,onClick:$e},[w(E,{icon:`i-carbon-clean`,class:`text-5.5`})])),[[l,`Clear end`,void 0,{top:!0}]])])):(s(),h(`input`,{key:1,class:`min-w-0 w-full rounded-1 border border-base bg-transparent px-3 py-1 outline-none font-state-field text-3.5 color-base placeholder-color-gray-500 dark:placeholder-gray-300`,placeholder:`End`,type:`search`,value:A.value,onFocus:o[4]||=e=>O.value=`end`,onInput:o[5]||=e=>Ze(`end`,B(e)),onKeydown:re(W,[`esc`])},null,40,Ne)),!S.value&&O.value===`end`?(s(),h(`div`,Pe,[(s(!0),h(v,null,i(oe.value,e=>(s(),h(`button`,{key:e.id,class:`min-w-0 w-full rounded-1 border-0 bg-transparent px-2 py-1.5 text-left color-base flex items-center gap-1.5 hover:bg-active`,type:`button`,onMousedown:D(t=>Qe(`end`,e.id),[`prevent`])},[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(ce)(e.type)})},null,4),m(`span`,Ie,n(x(z)(e)),1),m(`span`,Le,n(x(H)(e.type)),1)],40,Fe))),128)),oe.value.length?y(``,!0):(s(),h(`div`,Re,n(b.value?`No matching nodes`:`Select a start node to get end nodes`),1))])):y(``,!0)])])):(s(),h(`label`,ye,[w(E,{icon:`i-carbon-search`,class:`shrink-0 color-muted text-4`}),u(m(`input`,{"onUpdate:modelValue":o[0]||=e=>c.value=e,class:`min-w-0 w-full border-0 bg-transparent p-0 outline-none text-3.5 color-inherit placeholder-color-gray-500 dark:placeholder-gray-300`,placeholder:`Search graph...`,type:`search`},null,512),[[T,c.value]]),c.value?u((s(),h(`button`,{key:0,class:`h-6 w-6 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Clear search`,onClick:o[1]||=e=>c.value=``},[w(E,{icon:`i-carbon-close`,class:`text-3.5`})])),[[l,`Clear search`,void 0,{top:!0}]]):y(``,!0)])),g.value?u((s(),h(`button`,{key:3,class:`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Close path selector`,onClick:W},[w(E,{icon:`i-carbon-close`,class:`text-5`})])),[[l,`Close path selector`,void 0,{top:!0}]]):u((s(),h(`button`,{key:2,class:C([`h-7 w-7 shrink-0 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,g.value||R.value?`bg-active color-active`:``]),type:`button`,"aria-label":`Graph path selector`,"aria-pressed":g.value||R.value,onClick:o[6]||=e=>g.value?W():Xe()},[w(E,{icon:`i-ri-route-line`,class:`text-5.5`})],10,ze)),[[l,g.value?`Clear path selector`:`Graph path selector`,void 0,{top:!0}]]),m(`div`,{class:`relative shrink-0`,onFocusin:Ye,onFocusout:U,onMouseenter:Ye,onMouseleave:U},[u((s(),h(`button`,{class:C([`h-7 w-7 rounded-1 border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,j.value?`bg-active color-base`:``]),type:`button`,"aria-label":`Filter reactivity types`,"aria-haspopup":`menu`,"aria-expanded":j.value},[w(E,{icon:`i-carbon-filter`,class:`text-4`})],10,Be)),[[l,`Filter reactivity types`,void 0,{top:!0}]]),m(`div`,{class:C([`absolute right-0 top-[calc(100%+4px)] z-50 w-62 rounded-1 border border-base bg-base p-2 shadow transition-opacity`,j.value?`pointer-events-auto op-100`:`pointer-events-none op-0`]),role:`menu`},[m(`div`,Ve,[o[7]||=m(`span`,{class:`color-muted text-3`},`Filter type`,-1),m(`span`,He,n(a.value.nodes.length)+` / `+n(t.graph.nodes.length),1)]),(s(!0),h(v,null,i(x(se),e=>(s(),h(`label`,{key:e,class:C([`h-7 rounded-1 px-2 color-base flex items-center gap-1.5 select-none hover:bg-active`,V(e)?``:`op45 grayscale`]),title:x(H)(e)},[m(`input`,{class:`h-3.5 w-3.5 accent-emerald-600`,type:`checkbox`,checked:V(e),onChange:t=>de(e)},null,40,We),m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(ce)(e)})},null,4),m(`span`,Ge,n(x(H)(e)),1),m(`span`,Ke,n(N.value.get(e)??0),1)],10,Ue))),128)),m(`div`,{class:`mt-1 flex items-center gap-1 border-t border-base pt-1`},[m(`button`,{class:`h-7 flex-1 rounded-1 border border-base bg-transparent px-2 color-muted text-3 hover:bg-active hover:color-base`,type:`button`,onClick:fe},` Select all `),m(`button`,{class:`h-7 flex-1 rounded-1 border border-base bg-transparent px-2 color-muted text-3 hover:bg-active hover:color-base`,type:`button`,onClick:ge},` Clear `)])],2)],32)])])}}});function Ye(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return U(this.cover(t,n),t,n,e)}function U(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function Xe(e){var t,n,r=e.length,i,a,o=Array(r),s=Array(r),c=1/0,l=1/0,u=-1/0,d=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(a=+this._y.call(null,t))||(o[n]=i,s[n]=a,i<c&&(c=i),i>u&&(u=i),a<l&&(l=a),a>d&&(d=a));if(c>u||l>d)return this;for(this.cover(c,l).cover(u,d),n=0;n<r;++n)U(this,o[n],s[n],e[n]);return this}function W(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t<r)<<1|e<n,c=[,,,,],c[l]=s,s=c,o*=2,l){case 0:i=n+o,a=r+o;break;case 1:n=i-o,a=r+o;break;case 2:i=n+o,r=a-o;break;case 3:n=i-o,r=a-o}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function Ze(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Qe(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function G(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function $e(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,u=this._x1,d=this._y1,f=[],p=this._root,m,h;for(p&&f.push(new G(p,i,a,u,d)),n==null?n=1/0:(i=e-n,a=t-n,u=e+n,d=t+n,n*=n);m=f.pop();)if(!(!(p=m.node)||(o=m.x0)>u||(s=m.y0)>d||(c=m.x1)<i||(l=m.y1)<a)){if(p.length){var g=(o+c)/2,_=(s+l)/2;f.push(new G(p[3],g,_,c,l),new G(p[2],o,_,g,l),new G(p[1],g,s,c,_),new G(p[0],o,s,g,_)),(h=(t>=_)<<1|e>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-h],f[f.length-1-h]=m)}else{var v=e-+this._x.call(null,p.data),y=t-+this._y.call(null,p.data),b=v*v+y*y;if(b<n){var x=Math.sqrt(n=b);i=e-x,a=t-x,u=e+x,d=t+x,r=p.data}}}return r}function et(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function tt(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function nt(){return this._root}function rt(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function it(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new G(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,u=(o+c)/2;(i=r[3])&&t.push(new G(i,l,u,s,c)),(i=r[2])&&t.push(new G(i,a,u,l,c)),(i=r[1])&&t.push(new G(i,l,o,s,u)),(i=r[0])&&t.push(new G(i,a,o,l,u))}return this}function at(e){var t=[],n=[],r;for(this._root&&t.push(new G(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,u=(o+c)/2,d=(s+l)/2;(a=i[0])&&t.push(new G(a,o,s,u,d)),(a=i[1])&&t.push(new G(a,u,s,c,d)),(a=i[2])&&t.push(new G(a,o,d,u,l)),(a=i[3])&&t.push(new G(a,u,d,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function ot(e){return e[0]}function st(e){return arguments.length?(this._x=e,this):this._x}function ct(e){return e[1]}function lt(e){return arguments.length?(this._y=e,this):this._y}function ut(e,t,n){var r=new dt(t??ot,n??ct,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function dt(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function ft(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var K=ut.prototype=dt.prototype;K.copy=function(){var e=new dt(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=ft(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=ft(r));return e},K.add=Ye,K.addAll=Xe,K.cover=W,K.data=Ze,K.extent=Qe,K.find=$e,K.remove=et,K.removeAll=tt,K.root=nt,K.size=rt,K.visit=it,K.visitAfter=at,K.x=st,K.y=lt;function q(e){return function(){return e}}function pt(e){return(e()-.5)*1e-6}function mt(e){return e.x+e.vx}function ht(e){return e.y+e.vy}function gt(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=q(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;m<a;++m)for(c=ut(t,mt,ht).visitAfter(s),e=0;e<o;++e)l=t[e],f=n[l.index],p=f*f,u=l.x+l.vx,d=l.y+l.vy,c.visit(h);function h(e,t,n,a,o){var s=e.data,c=e.r,m=f+c;if(s){if(s.index>l.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_<m*m&&(h===0&&(h=pt(r),_+=h*h),g===0&&(g=pt(r),_+=g*g),_=(m-(_=Math.sqrt(_)))/_*i,l.vx+=(h*=_)*(m=(c*=c)/(p+c)),l.vy+=(g*=_)*m,s.vx-=h*(m=1-m),s.vy-=g*m)}return}return t>u+m||a<u-m||n>d+m||o<d-m}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r<i;++r)a=t[r],n[a.index]=+e(a,r,t)}}return o.initialize=function(e,n){t=e,r=n,c()},o.iterations=function(e){return arguments.length?(a=+e,o):a},o.strength=function(e){return arguments.length?(i=+e,o):i},o.radius=function(t){return arguments.length?(e=typeof t==`function`?t:q(+t),c(),o):e},o}function _t(e){return e.index}function vt(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function yt(e){var t=_t,n=d,r,i=q(30),a,o,s,c,l,u=1;e??=[];function d(e){return 1/Math.min(s[e.source.index],s[e.target.index])}function f(t){for(var n=0,i=e.length;n<u;++n)for(var o=0,s,d,f,p,m,h,g;o<i;++o)s=e[o],d=s.source,f=s.target,p=f.x+f.vx-d.x-d.vx||pt(l),m=f.y+f.vy-d.y-d.vy||pt(l),h=Math.sqrt(p*p+m*m),h=(h-a[o])/h*t*r[o],p*=h,m*=h,f.vx-=p*(g=c[o]),f.vy-=m*g,d.vx+=p*(g=1-g),d.vy+=m*g}function p(){if(o){var n,i=o.length,l=e.length,u=new Map(o.map((e,n)=>[t(e,n,o),e])),d;for(n=0,s=Array(i);n<l;++n)d=e[n],d.index=n,typeof d.source!=`object`&&(d.source=vt(u,d.source)),typeof d.target!=`object`&&(d.target=vt(u,d.target)),s[d.source.index]=(s[d.source.index]||0)+1,s[d.target.index]=(s[d.target.index]||0)+1;for(n=0,c=Array(l);n<l;++n)d=e[n],c[n]=s[d.source.index]/(s[d.source.index]+s[d.target.index]);r=Array(l),m(),a=Array(l),h()}}function m(){if(o)for(var t=0,i=e.length;t<i;++t)r[t]=+n(e[t],t,e)}function h(){if(o)for(var t=0,n=e.length;t<n;++t)a[t]=+i(e[t],t,e)}return f.initialize=function(e,t){o=e,l=t,p()},f.links=function(t){return arguments.length?(e=t,p(),f):e},f.id=function(e){return arguments.length?(t=e,f):t},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.strength=function(e){return arguments.length?(n=typeof e==`function`?e:q(+e),m(),f):n},f.distance=function(e){return arguments.length?(i=typeof e==`function`?e:q(+e),h(),f):i},f}var bt={value:()=>{}};function xt(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new St(n)}function St(e){this._=e}function Ct(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}St.prototype=xt.prototype={constructor:St,on:function(e,t){var n=this._,r=Ct(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=wt(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=Tt(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Tt(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new St(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function wt(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Tt(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=bt,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Et=0,Dt=0,Ot=0,kt=1e3,At,jt,Mt=0,Nt=0,Pt=0,Ft=typeof performance==`object`&&performance.now?performance:Date,It=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Lt(){return Nt||=(It(Rt),Ft.now()+Pt)}function Rt(){Nt=0}function zt(){this._call=this._time=this._next=null}zt.prototype=Bt.prototype={constructor:zt,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?Lt():+n)+(t==null?0:+t),!this._next&&jt!==this&&(jt?jt._next=this:At=this,jt=this),this._call=e,this._time=n,Gt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gt())}};function Bt(e,t,n){var r=new zt;return r.restart(e,t,n),r}function Vt(){Lt(),++Et;for(var e=At,t;e;)(t=Nt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Et}function Ht(){Nt=(Mt=Ft.now())+Pt,Et=Dt=0;try{Vt()}finally{Et=0,Wt(),Nt=0}}function Ut(){var e=Ft.now(),t=e-Mt;t>kt&&(Pt-=t,Mt=e)}function Wt(){for(var e,t=At,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:At=n);jt=e,Gt(r)}function Gt(e){Et||(Dt&&=clearTimeout(Dt),e-Nt>24?(e<1/0&&(Dt=setTimeout(Ht,e-Ft.now()-Pt)),Ot&&=clearInterval(Ot)):(Ot||=(Mt=Ft.now(),setInterval(Ut,kt)),Et=1,It(Ht)))}function Kt(e,t,n){var r=new zt;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var qt=1664525,Jt=1013904223,Yt=4294967296;function Xt(){let e=1;return()=>(e=(qt*e+Jt)%Yt)/Yt}function Zt(e){return e.x}function Qt(e){return e.y}var $t=10,en=Math.PI*(3-Math.sqrt(5));function tn(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=Bt(d),l=xt(`tick`,`end`),u=Xt();e??=[];function d(){f(),l.call(`tick`,t),n<r&&(c.stop(),l.call(`end`,t))}function f(r){var c,l=e.length,u;r===void 0&&(r=1);for(var d=0;d<r;++d)for(n+=(a-n)*i,s.forEach(function(e){e(n)}),c=0;c<l;++c)u=e[c],u.fx==null?u.x+=u.vx*=o:(u.x=u.fx,u.vx=0),u.fy==null?u.y+=u.vy*=o:(u.y=u.fy,u.vy=0);return t}function p(){for(var t=0,n=e.length,r;t<n;++t){if(r=e[t],r.index=t,r.fx!=null&&(r.x=r.fx),r.fy!=null&&(r.y=r.fy),isNaN(r.x)||isNaN(r.y)){var i=$t*Math.sqrt(.5+t),a=t*en;r.x=i*Math.cos(a),r.y=i*Math.sin(a)}(isNaN(r.vx)||isNaN(r.vy))&&(r.vx=r.vy=0)}}function m(t){return t.initialize&&t.initialize(e,u),t}return p(),t={tick:f,restart:function(){return c.restart(d),t},stop:function(){return c.stop(),t},nodes:function(n){return arguments.length?(e=n,p(),s.forEach(m),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(r=+e,t):r},alphaDecay:function(e){return arguments.length?(i=+e,t):+i},alphaTarget:function(e){return arguments.length?(a=+e,t):a},velocityDecay:function(e){return arguments.length?(o=1-e,t):1-o},randomSource:function(e){return arguments.length?(u=e,s.forEach(m),t):u},force:function(e,n){return arguments.length>1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i<a;++i)l=e[i],o=t-l.x,s=n-l.y,c=o*o+s*s,c<r&&(u=l,r=c);return u},on:function(e,n){return arguments.length>1?(l.on(e,n),t):l.on(e)}}}function nn(){var e,t,n,r,i=q(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=ut(e,Zt,Qt).visitAfter(d);for(r=n,i=0;i<a;++i)t=e[i],o.visit(f)}function u(){if(e){var t,n=e.length,r;for(a=Array(n),t=0;t<n;++t)r=e[t],a[r.index]=+i(r,t,e)}}function d(e){var t=0,n,r,i=0,o,s,c;if(e.length){for(o=s=c=0;c<4;++c)(n=e[c])&&(r=Math.abs(n.value))&&(t+=n.value,i+=r,o+=r*n.x,s+=r*n.y);e.x=o/i,e.y=s/i}else{n=e,n.x=n.data.x,n.y=n.data.y;do t+=a[n.data.index];while(n=n.next)}e.value=t}function f(e,i,l,u){if(!e.value)return!0;var d=e.x-t.x,f=e.y-t.y,p=u-i,m=d*d+f*f;if(p*p/c<m)return m<s&&(d===0&&(d=pt(n),m+=d*d),f===0&&(f=pt(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)),t.vx+=d*e.value*r/m,t.vy+=f*e.value*r/m),!0;if(!(e.length||m>=s)){(e.data!==t||e.next)&&(d===0&&(d=pt(n),m+=d*d),f===0&&(f=pt(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)));do e.data!==t&&(p=a[e.data.index]*r/m,t.vx+=d*p,t.vy+=f*p);while(e=e.next)}}return l.initialize=function(t,r){e=t,n=r,u()},l.strength=function(e){return arguments.length?(i=typeof e==`function`?e:q(+e),u(),l):i},l.distanceMin=function(e){return arguments.length?(o=e*e,l):Math.sqrt(o)},l.distanceMax=function(e){return arguments.length?(s=e*e,l):Math.sqrt(s)},l.theta=function(e){return arguments.length?(c=e*e,l):Math.sqrt(c)},l}function rn(e){var t=q(.1),n,r,i;typeof e!=`function`&&(e=q(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vx+=(i[t]-o.x)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:q(+e),o(),a):t},a.x=function(t){return arguments.length?(e=typeof t==`function`?t:q(+t),o(),a):e},a}function an(e){var t=q(.1),n,r,i;typeof e!=`function`&&(e=q(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vy+=(i[t]-o.y)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:q(+e),o(),a):t},a.y=function(t){return arguments.length?(e=typeof t==`function`?t:q(+t),o(),a):e},a}var on={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function sn(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),on.hasOwnProperty(t)?{space:on[t],local:e}:e}function cn(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function ln(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function un(e){var t=sn(e);return(t.local?ln:cn)(t)}function dn(){}function fn(e){return e==null?dn:function(){return this.querySelector(e)}}function pn(e){typeof e!=`function`&&(e=fn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new J(r,this._parents)}function mn(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function hn(){return[]}function gn(e){return e==null?hn:function(){return this.querySelectorAll(e)}}function _n(e){return function(){return mn(e.apply(this,arguments))}}function vn(e){e=typeof e==`function`?_n(e):gn(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new J(r,i)}function yn(e){return function(){return this.matches(e)}}function bn(e){return function(t){return t.matches(e)}}var xn=Array.prototype.find;function Sn(e){return function(){return xn.call(this.children,e)}}function Cn(){return this.firstElementChild}function wn(e){return this.select(e==null?Cn:Sn(typeof e==`function`?e:bn(e)))}var Tn=Array.prototype.filter;function En(){return Array.from(this.children)}function Dn(e){return function(){return Tn.call(this.children,e)}}function On(e){return this.selectAll(e==null?En:Dn(typeof e==`function`?e:bn(e)))}function kn(e){typeof e!=`function`&&(e=yn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new J(r,this._parents)}function An(e){return Array(e.length)}function jn(){return new J(this._enter||this._groups.map(An),this._parents)}function Mn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Mn.prototype={constructor:Mn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Nn(e){return function(){return e}}function Pn(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new Mn(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function Fn(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new Mn(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function In(e){return e.__data__}function Ln(e,t){if(!arguments.length)return Array.from(this,In);var n=t?Fn:Pn,r=this._parents,i=this._groups;typeof e!=`function`&&(e=Nn(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=Rn(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new J(o,r),o._enter=s,o._exit=c,o}function Rn(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function zn(){return new J(this._exit||this._groups.map(An),this._parents)}function Bn(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function Vn(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new J(s,this._parents)}function Hn(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Un(e){e||=Wn;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new J(i,this._parents).order()}function Wn(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Gn(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Kn(){return Array.from(this)}function qn(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function Jn(){let e=0;for(let t of this)++e;return e}function Yn(){return!this.node()}function Xn(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function Zn(e){return function(){this.removeAttribute(e)}}function Qn(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $n(e,t){return function(){this.setAttribute(e,t)}}function er(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function tr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function nr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function rr(e,t){var n=sn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Qn:Zn:typeof t==`function`?n.local?nr:tr:n.local?er:$n)(n,t))}function ir(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ar(e){return function(){this.style.removeProperty(e)}}function or(e,t,n){return function(){this.style.setProperty(e,t,n)}}function sr(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function cr(e,t,n){return arguments.length>1?this.each((t==null?ar:typeof t==`function`?sr:or)(e,t,n??``)):lr(this.node(),e)}function lr(e,t){return e.style.getPropertyValue(t)||ir(e).getComputedStyle(e,null).getPropertyValue(t)}function ur(e){return function(){delete this[e]}}function dr(e,t){return function(){this[e]=t}}function fr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function pr(e,t){return arguments.length>1?this.each((t==null?ur:typeof t==`function`?fr:dr)(e,t)):this.node()[e]}function mr(e){return e.trim().split(/^|\s+/)}function hr(e){return e.classList||new gr(e)}function gr(e){this._node=e,this._names=mr(e.getAttribute(`class`)||``)}gr.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function _r(e,t){for(var n=hr(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function vr(e,t){for(var n=hr(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function yr(e){return function(){_r(this,e)}}function br(e){return function(){vr(this,e)}}function xr(e,t){return function(){(t.apply(this,arguments)?_r:vr)(this,e)}}function Sr(e,t){var n=mr(e+``);if(arguments.length<2){for(var r=hr(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?xr:t?yr:br)(n,t))}function Cr(){this.textContent=``}function wr(e){return function(){this.textContent=e}}function Tr(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function Er(e){return arguments.length?this.each(e==null?Cr:(typeof e==`function`?Tr:wr)(e)):this.node().textContent}function Dr(){this.innerHTML=``}function Or(e){return function(){this.innerHTML=e}}function kr(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function Ar(e){return arguments.length?this.each(e==null?Dr:(typeof e==`function`?kr:Or)(e)):this.node().innerHTML}function jr(){this.nextSibling&&this.parentNode.appendChild(this)}function Mr(){return this.each(jr)}function Nr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pr(){return this.each(Nr)}function Fr(e){var t=typeof e==`function`?e:un(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ir(){return null}function Lr(e,t){var n=typeof e==`function`?e:un(e),r=t==null?Ir:typeof t==`function`?t:fn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Rr(){var e=this.parentNode;e&&e.removeChild(this)}function zr(){return this.each(Rr)}function Br(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vr(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Hr(e){return this.select(e?Vr:Br)}function Ur(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function Wr(e){return function(t){e.call(this,t,this.__data__)}}function Gr(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function Kr(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function qr(e,t,n){return function(){var r=this.__on,i,a=Wr(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function Jr(e,t,n){var r=Gr(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?qr:Kr,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function Yr(e,t,n){var r=ir(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Xr(e,t){return function(){return Yr(this,e,t)}}function Zr(e,t){return function(){return Yr(this,e,t.apply(this,arguments))}}function Qr(e,t){return this.each((typeof t==`function`?Zr:Xr)(e,t))}function*$r(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var ei=[null];function J(e,t){this._groups=e,this._parents=t}function ti(){return new J([[document.documentElement]],ei)}function ni(){return this}J.prototype=ti.prototype={constructor:J,select:pn,selectAll:vn,selectChild:wn,selectChildren:On,filter:kn,data:Ln,enter:jn,exit:zn,join:Bn,merge:Vn,selection:ni,order:Hn,sort:Un,call:Gn,nodes:Kn,node:qn,size:Jn,empty:Yn,each:Xn,attr:rr,style:cr,property:pr,classed:Sr,text:Er,html:Ar,raise:Mr,lower:Pr,append:Fr,insert:Lr,remove:zr,clone:Hr,datum:Ur,on:Jr,dispatch:Qr,[Symbol.iterator]:$r};function Y(e){return typeof e==`string`?new J([[document.querySelector(e)]],[document.documentElement]):new J([[e]],ei)}function ri(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ii(e,t){if(e=ri(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var ai={capture:!0,passive:!1};function oi(e){e.preventDefault(),e.stopImmediatePropagation()}function si(e){var t=e.document.documentElement,n=Y(e).on(`dragstart.drag`,oi,ai);`onselectstart`in t?n.on(`selectstart.drag`,oi,ai):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function ci(e,t){var n=e.document.documentElement,r=Y(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,oi,ai),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function li(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function ui(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function di(){}var fi=.7,pi=1/fi,mi=`\\s*([+-]?\\d+)\\s*`,hi=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,X=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,gi=/^#([0-9a-f]{3,8})$/,_i=RegExp(`^rgb\\(${mi},${mi},${mi}\\)$`),vi=RegExp(`^rgb\\(${X},${X},${X}\\)$`),yi=RegExp(`^rgba\\(${mi},${mi},${mi},${hi}\\)$`),bi=RegExp(`^rgba\\(${X},${X},${X},${hi}\\)$`),xi=RegExp(`^hsl\\(${hi},${X},${X}\\)$`),Si=RegExp(`^hsla\\(${hi},${X},${X},${hi}\\)$`),Ci={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};li(di,Oi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:wi,formatHex:wi,formatHex8:Ti,formatHsl:Ei,formatRgb:Di,toString:Di});function wi(){return this.rgb().formatHex()}function Ti(){return this.rgb().formatHex8()}function Ei(){return Bi(this).formatHsl()}function Di(){return this.rgb().formatRgb()}function Oi(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=gi.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ki(t):n===3?new Z(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ai(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ai(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=_i.exec(e))?new Z(t[1],t[2],t[3],1):(t=vi.exec(e))?new Z(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=yi.exec(e))?Ai(t[1],t[2],t[3],t[4]):(t=bi.exec(e))?Ai(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=xi.exec(e))?zi(t[1],t[2]/100,t[3]/100,1):(t=Si.exec(e))?zi(t[1],t[2]/100,t[3]/100,t[4]):Ci.hasOwnProperty(e)?ki(Ci[e]):e===`transparent`?new Z(NaN,NaN,NaN,0):null}function ki(e){return new Z(e>>16&255,e>>8&255,e&255,1)}function Ai(e,t,n,r){return r<=0&&(e=t=n=NaN),new Z(e,t,n,r)}function ji(e){return e instanceof di||(e=Oi(e)),e?(e=e.rgb(),new Z(e.r,e.g,e.b,e.opacity)):new Z}function Mi(e,t,n,r){return arguments.length===1?ji(e):new Z(e,t,n,r??1)}function Z(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}li(Z,Mi,ui(di,{brighter(e){return e=e==null?pi:pi**+e,new Z(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?fi:fi**+e,new Z(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Z(Li(this.r),Li(this.g),Li(this.b),Ii(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ni,formatHex:Ni,formatHex8:Pi,formatRgb:Fi,toString:Fi}));function Ni(){return`#${Ri(this.r)}${Ri(this.g)}${Ri(this.b)}`}function Pi(){return`#${Ri(this.r)}${Ri(this.g)}${Ri(this.b)}${Ri((isNaN(this.opacity)?1:this.opacity)*255)}`}function Fi(){let e=Ii(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Li(this.r)}, ${Li(this.g)}, ${Li(this.b)}${e===1?`)`:`, ${e})`}`}function Ii(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Li(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ri(e){return e=Li(e),(e<16?`0`:``)+e.toString(16)}function zi(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Q(e,t,n,r)}function Bi(e){if(e instanceof Q)return new Q(e.h,e.s,e.l,e.opacity);if(e instanceof di||(e=Oi(e)),!e)return new Q;if(e instanceof Q)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new Q(o,s,c,e.opacity)}function Vi(e,t,n,r){return arguments.length===1?Bi(e):new Q(e,t,n,r??1)}function Q(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}li(Q,Vi,ui(di,{brighter(e){return e=e==null?pi:pi**+e,new Q(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?fi:fi**+e,new Q(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Z(Wi(e>=240?e-240:e+120,i,r),Wi(e,i,r),Wi(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Q(Hi(this.h),Ui(this.s),Ui(this.l),Ii(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=Ii(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Hi(this.h)}, ${Ui(this.s)*100}%, ${Ui(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Hi(e){return e=(e||0)%360,e<0?e+360:e}function Ui(e){return Math.max(0,Math.min(1,e||0))}function Wi(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Gi=e=>()=>e;function Ki(e,t){return function(n){return e+n*t}}function qi(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function Ji(e){return(e=+e)==1?Yi:function(t,n){return n-t?qi(t,n,e):Gi(isNaN(t)?n:t)}}function Yi(e,t){var n=t-e;return n?Ki(e,n):Gi(isNaN(e)?t:e)}var Xi=(function e(t){var n=Ji(t);function r(e,t){var r=n((e=Mi(e)).r,(t=Mi(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=Yi(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function Zi(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Qi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$i=new RegExp(Qi.source,`g`);function ea(e){return function(){return e}}function ta(e){return function(t){return e(t)+``}}function na(e,t){var n=Qi.lastIndex=$i.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Qi.exec(e))&&(i=$i.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:Zi(r,i)})),n=$i.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?ta(c[0].x):ea(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}var ra=180/Math.PI,ia={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function aa(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*ra,skewX:Math.atan(c)*ra,scaleX:o,scaleY:s}}var oa;function sa(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?ia:aa(t.a,t.b,t.c,t.d,t.e,t.f)}function ca(e){return e==null||(oa||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),oa.setAttribute(`transform`,e),!(e=oa.transform.baseVal.consolidate()))?ia:(e=e.matrix,aa(e.a,e.b,e.c,e.d,e.e,e.f))}function la(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:Zi(e,i)},{i:c-2,x:Zi(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:Zi(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:Zi(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:Zi(e,n)},{i:s-2,x:Zi(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var ua=la(sa,`px, `,`px)`,`deg)`),da=la(ca,`, `,`)`,`)`),fa=1e-12;function pa(e){return((e=Math.exp(e))+1/e)/2}function ma(e){return((e=Math.exp(e))-1/e)/2}function ha(e){return((e=Math.exp(2*e))-1)/(e+1)}var ga=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<fa)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=pa(y),c=s/(n*g)*(i*ha(t*r+y)-ma(y));return[a+c*d,o+c*f,s*i/pa(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),_a=xt(`start`,`end`,`cancel`,`interrupt`),va=[];function ya(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;Sa(e,n,{name:t,index:r,group:i,on:_a,tween:va,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function ba(e,t){var n=$(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function xa(e,t){var n=$(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function $(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function Sa(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Bt(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return Kt(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(Kt(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function Ca(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function wa(e){return this.each(function(){Ca(this,e)})}function Ta(e,t){var n,r;return function(){var i=xa(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function Ea(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=xa(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function Da(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=$(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?Ta:Ea)(n,e,t))}function Oa(e,t,n){var r=e._id;return e.each(function(){var e=xa(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return $(e,r).value[t]}}function ka(e,t){var n;return(typeof t==`number`?Zi:t instanceof Oi?Xi:(n=Oi(t))?(t=n,Xi):na)(e,t)}function Aa(e){return function(){this.removeAttribute(e)}}function ja(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ma(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function Na(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function Pa(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Fa(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function Ia(e,t){var n=sn(e),r=n===`transform`?da:ka;return this.attrTween(e,typeof t==`function`?(n.local?Fa:Pa)(n,r,Oa(this,`attr.`+e,t)):t==null?(n.local?ja:Aa)(n):(n.local?Na:Ma)(n,r,t))}function La(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ra(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function za(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Ra(e,i)),n}return i._value=t,i}function Ba(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&La(e,i)),n}return i._value=t,i}function Va(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=sn(e);return this.tween(n,(r.local?za:Ba)(r,t))}function Ha(e,t){return function(){ba(this,e).delay=+t.apply(this,arguments)}}function Ua(e,t){return t=+t,function(){ba(this,e).delay=t}}function Wa(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ha:Ua)(t,e)):$(this.node(),t).delay}function Ga(e,t){return function(){xa(this,e).duration=+t.apply(this,arguments)}}function Ka(e,t){return t=+t,function(){xa(this,e).duration=t}}function qa(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?Ga:Ka)(t,e)):$(this.node(),t).duration}function Ja(e,t){if(typeof t!=`function`)throw Error();return function(){xa(this,e).ease=t}}function Ya(e){var t=this._id;return arguments.length?this.each(Ja(t,e)):$(this.node(),t).ease}function Xa(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();xa(this,e).ease=n}}function Za(e){if(typeof e!=`function`)throw Error();return this.each(Xa(this._id,e))}function Qa(e){typeof e!=`function`&&(e=yn(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new Oo(r,this._parents,this._name,this._id)}function $a(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new Oo(o,this._parents,this._name,this._id)}function eo(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function to(e,t,n){var r,i,a=eo(t)?ba:xa;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function no(e,t){var n=this._id;return arguments.length<2?$(this.node(),n).on.on(e):this.each(to(n,e,t))}function ro(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function io(){return this.on(`end.remove`,ro(this._id))}function ao(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=fn(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,ya(l[f],t,n,f,l,$(u,n)));return new Oo(a,this._parents,t,n)}function oo(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=gn(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=$(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&ya(p,t,n,h,f,m);a.push(f),o.push(u)}return new Oo(a,o,t,n)}var so=ti.prototype.constructor;function co(){return new so(this._groups,this._parents)}function lo(e,t){var n,r,i;return function(){var a=lr(this,e),o=(this.style.removeProperty(e),lr(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function uo(e){return function(){this.style.removeProperty(e)}}function fo(e,t,n){var r,i=n+``,a;return function(){var o=lr(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function po(e,t,n){var r,i,a;return function(){var o=lr(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),lr(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function mo(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=xa(this,e),l=c.on,u=c.value[a]==null?s||=uo(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function ho(e,t,n){var r=(e+=``)==`transform`?ua:ka;return t==null?this.styleTween(e,lo(e,r)).on(`end.style.`+e,uo(e)):typeof t==`function`?this.styleTween(e,po(e,r,Oa(this,`style.`+e,t))).each(mo(this._id,e)):this.styleTween(e,fo(e,r,t),n).on(`end.style.`+e,null)}function go(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function _o(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&go(e,a,n)),r}return a._value=t,a}function vo(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,_o(e,t,n??``))}function yo(e){return function(){this.textContent=e}}function bo(e){return function(){var t=e(this);this.textContent=t??``}}function xo(e){return this.tween(`text`,typeof e==`function`?bo(Oa(this,`text`,e)):yo(e==null?``:e+``))}function So(e){return function(t){this.textContent=e.call(this,t)}}function Co(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&So(r)),t}return r._value=e,r}function wo(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,Co(e))}function To(){for(var e=this._name,t=this._id,n=ko(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=$(c,t);ya(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Oo(r,this._parents,e,n)}function Eo(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=xa(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var Do=0;function Oo(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function ko(){return++Do}var Ao=ti.prototype;Oo.prototype={constructor:Oo,select:ao,selectAll:oo,selectChild:Ao.selectChild,selectChildren:Ao.selectChildren,filter:Qa,merge:$a,selection:co,transition:To,call:Ao.call,nodes:Ao.nodes,node:Ao.node,size:Ao.size,empty:Ao.empty,each:Ao.each,on:no,attr:Ia,attrTween:Va,style:ho,styleTween:vo,text:xo,textTween:wo,remove:io,tween:Da,delay:Wa,duration:qa,ease:Ya,easeVarying:Za,end:Eo,[Symbol.iterator]:Ao[Symbol.iterator]};function jo(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Mo={time:null,delay:0,duration:250,ease:jo};function No(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function Po(e){var t,n;e instanceof Oo?(t=e._id,e=e._name):(t=ko(),(n=Mo).time=Lt(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&ya(c,e,t,l,o,n||No(c,t));return new Oo(r,this._parents,e,t)}ti.prototype.interrupt=wa,ti.prototype.transition=Po;var Fo=e=>()=>e;function Io(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Lo(e,t,n){this.k=e,this.x=t,this.y=n}Lo.prototype={constructor:Lo,scale:function(e){return e===1?this:new Lo(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Lo(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var Ro=new Lo(1,0,0);zo.prototype=Lo.prototype;function zo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ro;return e.__zoom}function Bo(e){e.stopImmediatePropagation()}function Vo(e){e.preventDefault(),e.stopImmediatePropagation()}function Ho(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function Uo(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Wo(){return this.__zoom||Ro}function Go(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ko(){return navigator.maxTouchPoints||`ontouchstart`in this}function qo(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function Jo(){var e=Ho,t=Uo,n=qo,r=Go,i=Ko,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=ga,l=xt(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,Wo).on(`wheel.zoom`,te,{passive:!1}).on(`mousedown.zoom`,C).on(`dblclick.zoom`,w).filter(i).on(`touchstart.zoom`,ne).on(`touchmove.zoom`,T).on(`touchend.zoom touchcancel.zoom`,re).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,Wo),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(Ro.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new Lo(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new Lo(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new Lo(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new ee(e,t)}function ee(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}ee.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=Y(this.that).datum();l.call(e,this.that,new Io(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function te(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=ii(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],Ca(this),s.start();Vo(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function C(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=Y(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=ii(t,i),l=t.clientX,u=t.clientY;si(t.view),Bo(t),a.mouse=[c,this.__zoom.invert(c)],Ca(this),a.start();function d(e){if(Vo(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=ii(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),ci(e.view,a.moved),Vo(e),a.event(e).end()}}function w(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=ii(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);Vo(r),s>0?Y(this).transition().duration(s).call(x,d,c,r):Y(this).call(_.transform,d,c,r)}}function ne(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(Bo(t),s=0;s<i;++s)c=r[s],l=ii(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),Ca(this),a.start())}}function T(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(Vo(e),s=0;s<a;++s)c=i[s],l=ii(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function re(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(Bo(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=ii(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=Y(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:Fo(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:Fo(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:Fo(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:Fo([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var Yo=[`height`,`viewBox`,`width`],Xo=[`id`],Zo=[`fill`],Qo=[`transform`],$o=[`cx`,`cy`,`fill`,`fill-opacity`,`r`,`stroke`,`stroke-opacity`],es=[`stroke`,`stroke-opacity`,`stroke-width`,`marker-end`,`x1`,`x2`,`y1`,`y2`],ts=[`stroke`,`marker-end`,`x1`,`x2`,`y1`,`y2`],ns=[`opacity`,`aria-label`,`transform`,`onClick`,`onKeydown`,`onPointercancel`,`onPointerdown`,`onPointermove`,`onPointerup`],rs=[`fill`,`r`,`stroke`,`stroke-opacity`,`stroke-width`],is={key:0,class:`pointer-events-none`},as=[`fill`,`fill-opacity`,`stroke`,`stroke-opacity`,`width`,`x`],os=[`fill`,`text-anchor`,`x`],ss=[`fill`,`text-anchor`,`x`],cs={class:`absolute bottom-3 left-3 z-30 grid grid-cols-2 gap-x-3 gap-y-1.5 border border-base bg-glass px-3 py-2 shadow`},ls={class:`truncate`},us={class:`absolute bottom-3 right-3 z-30 flex flex-col items-end gap-2`},ds={class:`w-28 flex items-center justify-between gap-0.5 rounded-full border border-base bg-glass p-1 shadow`},fs=[`disabled`],ps={class:`font-state-field h-8 w-8 rounded-full bg-active color-muted flex items-center justify-center text-3.5`},ms=[`disabled`],hs={class:`w-28 flex items-center justify-between gap-0.5 rounded-full border border-base bg-glass p-1 shadow`},gs=680,_s=460,vs=34,ys=1,bs=6,xs=d({__name:`ReactivityGraphCanvas`,props:c({graph:{},path:{},pathSelectorOpen:{type:Boolean}},{selectedNodeId:{},selectedNodeIdModifiers:{},dependencyDepth:{required:!0},dependencyDepthModifiers:{}}),emits:c([`select`],[`update:selectedNodeId`,`update:dependencyDepth`]),setup(a,{emit:c}){let d=a,g=l(a,`selectedNodeId`),S=l(a,`dependencyDepth`),T=c,O=ee(d,`graph`),k=ee(d,`pathSelectorOpen`),A=f(()=>!!d.path),j=f(()=>d.path??fe());function M(e){T(`select`,e)}let N=[`#13966f`,`#3b82d6`,`#c58119`,`#d84f45`,`#0891b2`,`#db2777`,`#7c3aed`,`#64748b`],P=p(),F=p(),I=p(960),L=p(640),R=p({x:0,y:0,k:1}),B=p(0),V=b([]),le=b([]),ue=f(()=>new Map(V.value.map(e=>[e.id,e]))),de=b([]),pe,me,he,ge,_e=f(()=>[O.value.nodes.map(e=>`${e.id}:${e.type}:${e.label}`).join(`|`),O.value.relationships.map(e=>`${e.id}:${e.from}:${e.to}`).join(`|`)].join(`::`)),ve=f(()=>({links:le.value,nodes:V.value,version:B.value})),ye=f(()=>{if(!A.value)return[];let e=j.value.relationshipIds;return ve.value.links.filter(t=>e.has(t.id))}),be=f(()=>{let e=ae(de.value,I.value,L.value);return de.value.map(t=>{let n=e.get(t.id)??{x:I.value/2,y:L.value/2};return{...t,color:it(t.id),radius:Math.max(86,Math.min(210,56+Math.sqrt(t.nodeCount)*34)),x:n.x,y:n.y}})}),xe=f(()=>`translate(${R.value.x} ${R.value.y}) scale(${R.value.k})`),Se=f(()=>`${Math.round(R.value.k*100)}%`),Ce=f(()=>V.value.find(e=>e.id===g.value)),we=f(()=>Ce.value?de.value.find(e=>e.id===Ce.value?.group):void 0),Te=f(()=>{if(!g.value)return Oe();let e=ke(g.value,`dependencies`,S.value),t=ke(g.value,`subscribers`,S.value),n=new Set([g.value,...e.nodeIds,...t.nodeIds]);return{dependencyNodeIds:e.nodeIds,nodeIds:n,relationshipIds:new Set([...e.relationshipIds,...t.relationshipIds]),subscriberNodeIds:t.nodeIds}}),Ee=f(()=>A.value?j.value.relationshipIds:Te.value.relationshipIds),De=f(()=>A.value?j.value.nodeIds:Te.value.nodeIds);function Oe(){return{dependencyNodeIds:new Set,nodeIds:new Set,relationshipIds:new Set,subscriberNodeIds:new Set}}function ke(e,t,n){let r=new Set,i=new Set,a=new Set([e]),o=new Set([e]);for(let e=0;e<n&&o.size;e+=1){let e=new Set;for(let n of le.value){let s=t===`dependencies`?n.from:n.to,c=t===`dependencies`?n.to:n.from;o.has(c)&&(i.add(n.id),r.add(s),a.has(s)||(a.add(s),e.add(s)))}o=e}return{nodeIds:r,relationshipIds:i}}function Ae(e){S.value=Math.min(bs,Math.max(ys,e))}function je(e){Ae(S.value+e)}function Me(){me?.stop();let e=ie(O.value,I.value,L.value);if(V.value=e.nodes,le.value=e.links,de.value=e.groups,B.value+=1,g.value&&!e.nodes.some(e=>e.id===g.value)&&(g.value=void 0),!g.value&&!k.value&&!A.value&&(g.value=nt(e.nodes)?.id),!e.nodes.length){me=void 0;return}let t=ae(e.groups,I.value,L.value);me=tn(e.nodes).force(`link`,yt(e.links).id(e=>e.id).distance(e=>e.group===we.value?.id?92:112).strength(.58)).force(`charge`,nn().strength(e=>-260-e.radius*14)).force(`collide`,gt().radius(e=>e.radius+Qe(e))).force(`x`,rn(e=>t.get(e.group)?.x??I.value/2).strength(.085)).force(`y`,an(e=>t.get(e.group)?.y??L.value/2).strength(.085)).alpha(.95).alphaDecay(.022).on(`tick`,()=>{B.value+=1})}function Ne(){me&&me.force(`collide`,gt().radius(e=>e.radius+Qe(e))).alpha(.32).restart()}function Pe(){F.value&&(he=Jo().scaleExtent([.32,2.6]).filter(e=>{let t=e.target;return e.type===`mousedown`&&t?.closest(`[data-graph-node]`)?!1:(!e.ctrlKey||e.type===`wheel`)&&!e.button}).on(`zoom`,e=>{R.value={k:e.transform.k,x:e.transform.x,y:e.transform.y}}),Y(F.value).call(he),t(Fe))}function Fe(){if(!F.value||!he)return;let e=Le();if(!e){Y(F.value).call(he.transform,Ro);return}let t=Math.max(1,e.maxX-e.minX),n=Math.max(1,e.maxY-e.minY),r=Math.min(1.45,Math.max(.42,Math.min((I.value-96)/t,(L.value-96)/n))),i=(e.minX+e.maxX)/2,a=(e.minY+e.maxY)/2,o=Ro.translate(I.value/2,L.value/2).scale(r).translate(-i,-a);Y(F.value).call(he.transform,o)}function Ie(e){F.value&&he&&Y(F.value).call(he.scaleBy,e)}function Le(){let e=V.value;if(!e.length)return;let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e){let e=a.x??I.value/2,o=a.y??L.value/2;t=Math.min(t,e-a.radius-72),n=Math.min(n,o-a.radius-32),r=Math.max(r,e+a.radius+142),i=Math.max(i,o+a.radius+32)}return{minX:t,minY:n,maxX:r,maxY:i}}function Re(e,t){e.stopPropagation(),M(t.id),ge=t.id,t.fx=t.x,t.fy=t.y,me?.alphaTarget(.28).restart(),e.currentTarget.setPointerCapture(e.pointerId)}function ze(e,t){if(ge!==t.id)return;let n=Ve(e);t.fx=n.x,t.fy=n.y,B.value+=1}function Be(e,t){ge===t.id&&(ge=void 0,t.fx=null,t.fy=null,me?.alphaTarget(0),e.currentTarget.releasePointerCapture(e.pointerId))}function Ve(e){if(!F.value)return{x:e.offsetX,y:e.offsetY};let t=F.value.createSVGPoint();t.x=e.clientX,t.y=e.clientY;let n=F.value.getScreenCTM(),r=n?t.matrixTransform(n.inverse()):t;return{x:(r.x-R.value.x)/R.value.k,y:(r.y-R.value.y)/R.value.k}}function He(e){return We(e.source)}function Ue(e){return We(e.target)}function We(e){if(typeof e==`object`)return e;if(e!=null)return ue.value.get(String(e))}function Ge(e){return Ye(e,`source`).x}function Ke(e){return Ye(e,`source`).y}function qe(e){return Ye(e,`target`).x}function Je(e){return Ye(e,`target`).y}function Ye(e,t){let n=He(e),r=Ue(e);if(!n||!r)return{x:I.value/2,y:L.value/2};let i=n.x??I.value/2,a=n.y??L.value/2,o=r.x??I.value/2,s=r.y??L.value/2,c=o-i,l=s-a,u=Math.hypot(c,l)||1,d=c/u,f=l/u;if(t===`source`){let e=n.radius+2;return{x:i+d*e,y:a+f*e}}let p=r.radius+6;return{x:o-d*p,y:s-f*p}}function U(e){return A.value?Ee.value.has(e.id):!g.value||Ee.value.has(e.id)}function Xe(e){return A.value?De.value.has(e.id):!g.value||De.value.has(e.id)}function W(e){return A.value&&De.value.has(e.id)}function Ze(e){return A.value?De.value.has(e.id):g.value?e.id===g.value||De.value.has(e.id):rt(e)>=4}function Qe(e){return Ze(e)?44+e.labelWidth*.16:20}function G(e){let t=I.value/2;return(e.x??t)>t?`left`:`right`}function $e(e){let t=e.radius+8;return G(e)===`left`?-e.labelWidth-t:t}function et(e){return G(e)===`left`?$e(e)+e.labelWidth-10:$e(e)+10}function tt(e){return G(e)===`left`?`end`:`start`}function nt(e){return[...e].sort((e,t)=>rt(t)-rt(e)).at(0)}function rt(e){let t=Math.min(e.incoming,e.outgoing)*2,n=e.type===`computed`?2:+(e.type===`watch`||e.type===`effect`);return e.incoming+e.outgoing+t+n}function it(e){return N[e%N.length]}function at(e){return A.value||g.value?U(e)?it(e.group):`#888888`:it(e.group)}function ot(e){return A.value?U(e)?.9:.08:g.value?U(e)?.72:.12:.42}function st(e){return A.value?U(e)?2.8:1:U(e)?1.8:1.1}function ct(e){return`url(#${(g.value||A.value)&&!U(e)?`reactivity-arrow-muted`:`reactivity-arrow-${e.group%N.length}`})`}function lt(e){return A.value?Xe(e)?1:.18:g.value?Xe(e)?1:.28:1}function ut(e){return e.id===g.value||W(e)?`#111827`:`#ffffff`}function dt(e){return e.id===g.value||W(e)?.72:.92}function ft(e){return e.id===g.value||W(e)?3:1.5}return e(()=>{P.value&&(pe=new ResizeObserver(([e])=>{I.value=Math.max(gs,e.contentRect.width),L.value=Math.max(_s,e.contentRect.height)}),pe.observe(P.value)),Pe()}),o([_e,I,L],()=>{Me(),t(Fe)},{immediate:!0}),o([g,S,()=>d.path],Ne),_(()=>{pe?.disconnect(),me?.stop()}),(e,t)=>{let a=ne(`tooltip`);return s(),h(`div`,{ref_key:`container`,ref:P,class:`relative h-full min-w-0 overflow-hidden bg-subtle bg-dots select-none`},[(s(),h(`svg`,{ref_key:`svg`,ref:F,class:`h-full w-full touch-none`,role:`img`,"aria-label":`Vue reactivity dependency graph`,height:L.value,viewBox:`0 0 ${I.value} ${L.value}`,width:I.value},[m(`defs`,null,[t[4]||=m(`marker`,{id:`reactivity-arrow-muted`,markerHeight:`10`,markerUnits:`userSpaceOnUse`,markerWidth:`10`,orient:`auto`,refX:`8`,refY:`0`,viewBox:`0 -5 10 10`},[m(`path`,{d:`M 0 -4 L 9 0 L 0 4 z`,fill:`#888888`,opacity:`0.42`})],-1),(s(),h(v,null,i(N,(e,t)=>m(`marker`,{id:`reactivity-arrow-${t}`,key:`arrow-${t}`,markerHeight:`10`,markerUnits:`userSpaceOnUse`,markerWidth:`10`,orient:`auto`,refX:`8`,refY:`0`,viewBox:`0 -5 10 10`},[m(`path`,{d:`M 0 -4 L 9 0 L 0 4 z`,fill:it(t),opacity:`0.82`},null,8,Zo)],8,Xo)),64))]),m(`g`,{transform:xe.value},[(s(!0),h(v,null,i(be.value,e=>(s(),h(`circle`,{key:`group-${e.id}`,cx:e.x,cy:e.y,fill:e.color,"fill-opacity":we.value&&we.value.id!==e.id?.025:.07,r:e.radius,stroke:e.color,"stroke-opacity":we.value&&we.value.id!==e.id?.08:.18,"stroke-dasharray":`5 6`,"stroke-width":`1`},null,8,$o))),128)),(s(!0),h(v,null,i(ve.value.links,e=>(s(),h(`line`,{key:e.id,stroke:at(e),"stroke-linecap":`round`,"stroke-opacity":ot(e),"stroke-width":st(e),"marker-end":ct(e),x1:Ge(e),x2:qe(e),y1:Ke(e),y2:Je(e)},null,8,es))),128)),(s(!0),h(v,null,i(ye.value,e=>(s(),h(`line`,{key:`path-${e.id}`,class:`pointer-events-none`,stroke:at(e),"stroke-linecap":`round`,"stroke-opacity":`0.96`,"stroke-width":`3.4`,"marker-end":ct(e),x1:Ge(e),x2:qe(e),y1:Ke(e),y2:Je(e)},null,8,ts))),128)),(s(!0),h(v,null,i(ve.value.nodes,e=>(s(),h(`g`,{key:e.id,"data-graph-node":``,class:`cursor-grab outline-none active:cursor-grabbing`,opacity:lt(e),role:`button`,tabindex:`0`,"aria-label":`Select ${x(z)(e)} graph node`,transform:`translate(${e.x??I.value/2} ${e.y??L.value/2})`,onClick:D(t=>M(e.id),[`stop`]),onKeydown:re(D(t=>M(e.id),[`prevent`]),[`enter`]),onPointercancel:t=>Be(t,e),onPointerdown:t=>Re(t,e),onPointermove:t=>ze(t,e),onPointerup:t=>Be(t,e)},[m(`circle`,{fill:x(ce)(e.type),r:e.radius,stroke:ut(e),"stroke-opacity":dt(e),"stroke-width":ft(e),class:`dark:stroke-#f8fafc`},null,8,rs),Ze(e)?(s(),h(`g`,is,[m(`rect`,{fill:e.id===g.value?`#f8fafc`:`#111827`,"fill-opacity":e.id===g.value?.96:.9,height:vs,rx:`5`,stroke:it(e.group),"stroke-opacity":e.id===g.value?.82:.34,"stroke-width":`1`,width:e.labelWidth,x:$e(e),y:`-17`},null,8,as),m(`text`,{class:`font-state-field text-3 font-700`,"dominant-baseline":`middle`,fill:e.id===g.value?`#111827`:`#f8fafc`,"text-anchor":tt(e),x:et(e),y:`-5`},n(x(oe)(x(z)(e))),9,os),m(`text`,{class:`text-2.25 font-800`,"dominant-baseline":`middle`,fill:e.id===g.value?`#475569`:`#94a3b8`,"text-anchor":tt(e),x:et(e),y:`9`},n(x(H)(e.type)),9,ss)])):y(``,!0),m(`title`,null,n(x(z)(e))+` - `+n(x(H)(e.type)),1)],40,ns))),128))],8,Qo)],8,Yo)),m(`div`,cs,[(s(!0),h(v,null,i(x(se),e=>(s(),h(`div`,{key:e,class:`font-state-field min-w-23 flex items-center gap-1.5 color-base text-3.5`},[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(ce)(e)})},null,4),m(`span`,ls,n(x(H)(e)),1)]))),128))]),m(`div`,us,[u((s(),h(`div`,ds,[u((s(),h(`button`,{class:C([`h-8 w-8 rounded-full border-0 bg-transparent color-base flex items-center justify-center hover:bg-active`,S.value<=ys?`op35`:``]),type:`button`,"aria-label":`Decrease relationship depth`,disabled:S.value<=ys,onClick:t[0]||=D(e=>je(-1),[`stop`])},[w(E,{icon:`i-carbon-subtract`,class:`text-4`})],10,fs)),[[a,`Decrease relationship depth`,void 0,{top:!0}]]),m(`span`,ps,n(S.value),1),u((s(),h(`button`,{class:C([`h-8 w-8 rounded-full border-0 bg-transparent color-base flex items-center justify-center hover:bg-active`,S.value>=bs?`op35`:``]),type:`button`,"aria-label":`Increase relationship depth`,disabled:S.value>=bs,onClick:t[1]||=D(e=>je(1),[`stop`])},[w(E,{icon:`i-carbon-add`,class:`text-4`})],10,ms)),[[a,`Increase relationship depth`,void 0,{top:!0}]])])),[[a,`Relationship depth`,void 0,{top:!0}]]),m(`div`,hs,[u((s(),h(`button`,{class:`h-8 w-8 rounded-full border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Zoom out`,onClick:t[2]||=D(e=>Ie(.82),[`stop`])},[w(E,{icon:`i-carbon-zoom-out`,class:`text-4`})])),[[a,`Zoom out`,void 0,{top:!0}]]),u((s(),h(`button`,{class:`h-8 min-w-10 rounded-full border-0 bg-transparent px-1.5 color-muted text-3 hover:bg-active hover:color-base`,type:`button`,"aria-label":`Fit graph`,onClick:D(Fe,[`stop`])},[te(n(Se.value),1)])),[[a,`Fit graph`,void 0,{top:!0}]]),u((s(),h(`button`,{class:`h-8 w-8 rounded-full border-0 bg-transparent color-muted flex items-center justify-center hover:bg-active hover:color-base`,type:`button`,"aria-label":`Zoom in`,onClick:t[3]||=D(e=>Ie(1.18),[`stop`])},[w(E,{icon:`i-carbon-zoom-in`,class:`text-4`})])),[[a,`Zoom in`,void 0,{top:!0}]])])])],512)}}}),Ss={class:`h-full min-w-0 overflow-auto p-3`},Cs={key:0},ws={key:0,class:`grid gap-0.5`},Ts=[`onClick`],Es={class:`w-4 shrink-0 text-right color-muted font-state-field text-3`},Ds={class:`min-w-0 flex-1 truncate font-state-field text-3.5`},Os={key:0,class:`color-muted`},ks={class:`shrink-0 color-muted text-3`},As={key:0,class:`h-7 color-muted flex items-center justify-center`},js={key:1,class:`h-28 flex items-center justify-center color-muted text-3.5 italic`},Ms={class:`pb-4`},Ns={class:`grid gap-0.5`},Ps={class:`state-key shrink-0 overflow-hidden text-ellipsis whitespace-nowrap op70`},Fs={class:`border-t border-base pt-4`},Is={class:`overflow-x-auto pb-2`},Ls=[`height`,`width`],Rs=[`d`],zs=[`onClick`],Bs={class:`min-w-0 flex items-center gap-1.5`},Vs={class:`truncate font-state-field text-3.5`},Hs={key:1,class:`h-28 flex items-center justify-center color-muted text-3.5 italic`},Us={key:2,class:`m-0 color-muted text-3 leading-5`},Ws=20,Gs=d({__name:`ReactivityGraphDetails`,props:{graph:{},filteredGraph:{},selectedNodeId:{},dependencyDepth:{},path:{}},emits:[`select`],setup(e,{emit:t}){let a=e,o=t,c=ee(a,`selectedNodeId`),l=ee(a,`dependencyDepth`),d=ee(a,`filteredGraph`),p=f(()=>a.filteredGraph.nodes),g=f(()=>a.filteredGraph.relationships),_=f(()=>!!a.path),b=f(()=>a.path??fe());function S(e){o(`select`,e)}let T={width:180,height:30,padding:4,columnGap:52,canvasPadding:16,dot:16},re=f(()=>new Map(a.graph.nodes.map(e=>[e.id,e]))),D=f(()=>b.value.orderedNodeIds.map(e=>re.value.get(e)).filter(e=>e!==void 0)),O=f(()=>{let e=new Map(d.value.relationships.map(e=>[e.id,e]));return b.value.orderedRelationshipIds.map(t=>e.get(t)).filter(e=>e!==void 0)}),k=f(()=>new Map(p.value.map(e=>[e.id,e]))),A=f(()=>p.value.find(e=>e.id===c.value)),j=f(()=>c.value&&re.value.has(c.value)?R(re.value.get(c.value)):[]),M=f(()=>I(`dependency`)),N=f(()=>I(`subscriber`)),P=f(()=>L());function F(e){return e?T.height*e+T.padding*(e+1):0}function I(e){let t=[],n=new Map,r=c.value;if(!r)return{depthById:n,layers:t};let i=new Set([r]),a=new Set([r]),o=0;for(let r=1;r<=l.value&&a.size;r+=1){let s=[],c=new Set;for(let t of g.value){let n=e===`dependency`?t.from:t.to,r=e===`dependency`?t.to:t.from;if(a.has(r)&&!(i.has(n)||c.has(n))&&k.value.has(n)&&(s.push(n),c.add(n),o+s.length>=Ws))break}let l=s.slice(0,Ws-o).map(e=>k.value.get(e)).filter(e=>e!==void 0);if(!l.length)break;for(let e of l)i.add(e.id),n.set(e.id,r);if(t.push(l),o+=l.length,a=new Set(l.map(e=>e.id)),o>=Ws)break}return{depthById:n,layers:t}}function L(){let e=c.value;if(!e)return{centerX:T.canvasPadding+T.dot/2,centerY:T.dot/2,height:T.dot,links:[],nodes:[],width:T.canvasPadding*2+T.dot};let t=M.value.layers,n=M.value.depthById,r=N.value.layers,i=N.value.depthById,a=T.width+T.columnGap,o=T.canvasPadding+r.length*a+T.dot/2,s=T.canvasPadding*2+r.length*a+T.dot+t.length*a,l=Math.max(T.dot,...r.map(e=>F(e.length)),...t.map(e=>F(e.length))),u=l/2,d=[],f=[],p=new Map;r.forEach((e,t)=>{let n=t+1,r=F(e.length),i=(l-r)/2+T.padding,s=o-T.dot/2-T.columnGap-T.width-t*a;e.forEach((e,r)=>{let a=i+r*(T.height+T.padding)+T.height/2,o={depth:n,node:e,side:`subscriber`,x:s,y:a};d.push(o),t===0&&f.push(a),p.set(e.id,{node:o,x:s,y:a})})}),t.forEach((e,t)=>{let n=t+1,r=F(e.length),i=(l-r)/2+T.padding,s=o+T.dot/2+T.columnGap+t*a;e.forEach((e,r)=>{let a=i+r*(T.height+T.padding)+T.height/2,o={depth:n,node:e,side:`dependency`,x:s,y:a};d.push(o),t===0&&f.push(a),p.set(e.id,{node:o,x:s,y:a})})}),f.length&&(u=(Math.min(...f)+Math.max(...f))/2),p.set(e,{x:o,y:u});let m=[];for(let t of g.value){let r=n.get(t.from),a=t.to===e?0:n.get(t.to);if(r!==void 0&&a!==void 0&&r===a+1){let e=p.get(t.to),n=p.get(t.from);e&&n&&m.push({id:`dependency:${t.id}`,path:oe(ae(e),e.y,n.x,n.y)})}let o=i.get(t.to),s=t.from===e?0:i.get(t.from);if(o!==void 0&&s!==void 0&&o===s+1){let e=p.get(t.to),n=p.get(t.from);e&&n&&m.push({id:`subscriber:${t.id}`,path:oe(ae(e),e.y,ie(n),n.y)})}}return{centerX:o,centerY:u,height:l,links:m,nodes:d,width:s}}function ie(e){return e.node?e.x:e.x-T.dot/2}function ae(e){return e.node?e.x+T.width:e.x+T.dot/2}function oe(e,t,n,r){let i=(e+n)/2;return`M ${e} ${t} C ${i} ${t} ${i} ${r} ${n} ${r}`}function R(e){let t=de(e);return[{key:`key`,value:B(z(e)),valueClass:`string-state-type`},{key:`type`,value:B(H(e.type)),valueClass:`string-state-type`},{key:`value`,value:t||`undefined`,valueClass:t?V(t):`null-state-type`}]}function B(e){return JSON.stringify(e)}function V(e){return e===`null`||e===`undefined`?`null-state-type`:e===`true`||e===`false`?`boolean-state-type`:e.startsWith(`"`)?`string-state-type`:/^-?\d/.test(e)||e.startsWith(`Symbol(`)?`literal-state-type`:`state-value`}function se(e){let t=de(e);return t?t.length>28?`${t.slice(0,27)}...`:t:``}return(e,t)=>{let a=ne(`tooltip`);return s(),h(`aside`,Ss,[_.value?(s(),h(`section`,Cs,[D.value.length?(s(),h(`div`,ws,[(s(!0),h(v,null,i(D.value,(e,t)=>(s(),h(v,{key:e.id},[m(`button`,{class:`min-w-0 rounded-1 border border-base bg-base px-2 py-1.5 text-left color-base flex items-center gap-2 hover:bg-active`,type:`button`,onClick:t=>S(e.id)},[m(`span`,Es,n(t+1),1),m(`span`,{class:`h-2.5 w-2.5 shrink-0 rounded-full`,style:r({background:x(ce)(e.type)})},null,4),u((s(),h(`span`,Ds,[m(`span`,null,n(x(z)(e)),1),se(e)?(s(),h(`span`,Os,` (`+n(se(e))+`) `,1)):y(``,!0)])),[[a,x(de)(e),void 0,{top:!0}]]),m(`span`,ks,n(x(H)(e.type)),1)],8,Ts),t<O.value.length?(s(),h(`div`,As,[w(E,{icon:`i-carbon-arrow-down`,class:`text-4`})])):y(``,!0)],64))),128))])):(s(),h(`div`,js,` No relationship path found `))])):A.value?(s(),h(v,{key:1},[m(`section`,Ms,[t[1]||=m(`h2`,{class:`mb-2 color-muted font-state-field text-3.5`},`Info`,-1),m(`div`,Ns,[(s(!0),h(v,null,i(j.value,e=>(s(),h(`div`,{key:e.key,class:`font-state-field min-w-0 flex items-center text-3.5`},[m(`span`,Ps,n(e.key),1),t[0]||=m(`span`,{class:`colon mx-1 shrink-0`},`:`,-1),u((s(),h(`span`,{class:C([`min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap`,e.valueClass])},[te(n(e.value),1)],2)),[[a,e.value,void 0,{top:!0}]])]))),128))])]),m(`section`,Fs,[t[2]||=m(`h2`,{class:`mb-2 color-muted font-state-field text-3.5`},`Relationships`,-1),m(`div`,Is,[P.value.nodes.length?(s(),h(`div`,{key:0,class:`relative select-none`,style:r({width:`${P.value.width}px`,height:`${P.value.height}px`})},[(s(),h(`svg`,{"pointer-events-none":``,class:`absolute left-0 top-0 z-10`,height:P.value.height,width:P.value.width},[m(`g`,null,[(s(!0),h(v,null,i(P.value.links,e=>(s(),h(`path`,{key:e.id,d:e.path,fill:`none`,stroke:`#888888`,"stroke-opacity":`0.34`},null,8,Rs))),128))])],8,Ls)),m(`div`,{class:`absolute z-20 box-border rounded-full bg-base`,style:r({top:`${P.value.centerY-T.dot/2}px`,left:`${P.value.centerX-T.dot/2}px`,width:`${T.dot}px`,height:`${T.dot}px`,border:`3px solid ${A.value?x(ce)(A.value.type):x(ce)(`unknown`)}`})},null,4),(s(!0),h(v,null,i(P.value.nodes,e=>u((s(),h(`button`,{key:`${e.side}:${e.depth}:${e.node.id}`,class:`absolute z-20 min-w-0 block rounded-1 border border-base bg-base px-2 py-1 text-left color-base hover:bg-active`,type:`button`,style:r({left:`${e.x}px`,top:`${e.y-T.height/2}px`,width:`${T.width}px`,height:`${T.height}px`,overflow:`hidden`}),onClick:t=>S(e.node.id)},[m(`span`,Bs,[m(`span`,{class:`h-2.3 w-2.3 shrink-0 rounded-full`,style:r({background:x(ce)(e.node.type)})},null,4),m(`span`,Vs,n(x(z)(e.node)),1)])],12,zs)),[[a,`${x(z)(e.node)} - ${x(H)(e.node.type)}`,void 0,{top:!0}]])),128))],4)):(s(),h(`div`,Hs,` No data `))])])],64)):(s(),h(`p`,Us,` Select a node to inspect its dependencies and subscribers. `))])}}}),Ks={class:`h-full min-h-0 flex flex-col bg-base`},qs=d({__name:`ReactivityGraph`,props:{graph:{}},setup(e){let t=e,n=p(),r=p(1),i=p(``),o=p(new Set(se)),c=p(!1),l=p(``),u=p(``),d=f(()=>{let e=le(i.value),n=o.value,r=t.graph.nodes.filter(t=>n.has(t.type)&&ue(t,e)),a=new Set(r.map(e=>e.id));return{nodes:r,relationships:t.graph.relationships.filter(e=>a.has(e.from)&&a.has(e.to))}}),m=f(()=>pe(d.value.relationships)),g=f(()=>!!l.value&&!!u.value),_=f(()=>g.value?ge(l.value,u.value,m.value):fe());function v(e){c.value=!1,l.value=``,u.value=``,n.value=e}return(t,f)=>(s(),h(`div`,Ks,[w(Je,{search:i.value,"onUpdate:search":f[0]||=e=>i.value=e,"active-types":o.value,"onUpdate:activeTypes":f[1]||=e=>o.value=e,"path-selector-open":c.value,"onUpdate:pathSelectorOpen":f[2]||=e=>c.value=e,"path-start-id":l.value,"onUpdate:pathStartId":f[3]||=e=>l.value=e,"path-end-id":u.value,"onUpdate:pathEndId":f[4]||=e=>u.value=e,"selected-node-id":n.value,"onUpdate:selectedNodeId":f[5]||=e=>n.value=e,graph:e.graph,"filtered-graph":d.value},null,8,[`search`,`active-types`,`path-selector-open`,`path-start-id`,`path-end-id`,`selected-node-id`,`graph`,`filtered-graph`]),w(x(A),{class:`min-h-0 flex-1 overflow-hidden`},{default:a(()=>[w(x(j),{class:`h-full min-h-0`,"min-size":`30`,size:`53.333`},{default:a(()=>[w(xs,{"selected-node-id":n.value,"onUpdate:selectedNodeId":f[6]||=e=>n.value=e,"dependency-depth":r.value,"onUpdate:dependencyDepth":f[7]||=e=>r.value=e,graph:d.value,path:g.value?_.value:void 0,"path-selector-open":c.value,onSelect:v},null,8,[`selected-node-id`,`dependency-depth`,`graph`,`path`,`path-selector-open`])]),_:1}),w(x(j),{class:`h-full min-h-0`,"min-size":`24`,size:`46.667`},{default:a(()=>[w(Gs,{graph:e.graph,"filtered-graph":d.value,"selected-node-id":n.value,"dependency-depth":r.value,path:g.value?_.value:void 0,onSelect:v},null,8,[`graph`,`filtered-graph`,`selected-node-id`,`dependency-depth`,`path`])]),_:1})]),_:1})]))}}),Js={class:`h-full min-h-0 flex flex-col`},Ys={key:0,class:`max-h-38 shrink-0 border-b border-base`},Xs={class:`min-h-0 flex-1`},Zs={key:1,class:`h-full min-h-0 flex items-center justify-center bg-subtle p-6`},Qs={class:`m-0 max-w-78 text-center color-muted text-3.5 leading-5`},$s=d({__name:`graph`,setup(r){let{apps:i,cancelComponentInspection:o,componentInspecting:c,components:l,componentState:u,componentStateLoading:d,error:v,highlightComponent:b,inspectComponentInPage:ee,reactivityGraphEnabled:te,selectComponent:C,selectedComponent:ne,selectedComponentId:T,unhighlightComponent:re}=g(),E=p(),D=p(!1),N=p(``),P,F=f(()=>M(l.value,N.value)),I=f(()=>u.value?.reactivityGraph),L=f(()=>te.value?ne.value?d.value?`Loading reactivity graph...`:`No data`:`Select a component to inspect its reactivity graph.`:`Reactivity Graph requires Vue 3.6 or later.`),ie=f(()=>[{icon:`i-carbon-select-window`,tooltip:c.value?`Cancel selecting component`:`Select component in the page`,ariaLabel:`Select component in the page`,active:c.value,pressed:c.value,rounded:`full`,run:oe}]);async function ae(e){C(e),await t()}async function oe(){if(c.value){await o();return}let e=await ee();e&&(N.value=``,C(e.componentId),await t())}function R(e){ie.value[e]?.run()}function z(e){if(!B(e.target)){if(e.key.toLowerCase()===`s`&&(e.ctrlKey||e.metaKey)){e.preventDefault(),oe();return}e.key===`Escape`&&c.value&&(e.preventDefault(),o())}}function B(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName.toLowerCase();return t===`input`||t===`textarea`||e.isContentEditable}return e(()=>{P=new ResizeObserver(([e])=>{D.value=e.contentRect.width<760}),E.value&&P.observe(E.value),window.addEventListener(`keydown`,z)}),_(()=>{P?.disconnect(),window.removeEventListener(`keydown`,z),c.value&&o(),re()}),(e,t)=>(s(),h(`section`,{ref_key:`container`,ref:E,class:`h-full min-h-0`},[w(x(A),{class:`h-full min-h-0 overflow-hidden`,horizontal:D.value},{default:a(()=>[w(x(j),{class:`h-full min-h-0`,"min-size":`16`,size:D.value?34:18},{default:a(()=>[m(`div`,Js,[x(i).length>1?(s(),h(`div`,Ys,[w(O)])):y(``,!0),m(`div`,Xs,[w(k,{filter:N.value,"onUpdate:filter":t[0]||=e=>N.value=e,actions:ie.value,"component-labels":``,"default-expand-depth":99,"empty-text":x(v)??`No components`,nodes:F.value,"no-matching-text":`No matching components`,placeholder:`Find components...`,"selected-node-id":x(T),"state-key":`reactivity-graph-components`,"refresh-visible":!1,onAction:R,onHover:t[1]||=e=>void x(b)(e),onLeave:t[2]||=()=>void x(re)(),onSelect:t[3]||=e=>void ae(e)},null,8,[`filter`,`actions`,`empty-text`,`nodes`,`selected-node-id`])])])]),_:1},8,[`size`]),w(x(j),{class:`h-full min-h-0`,"min-size":`32`},{default:a(()=>[x(te)&&I.value?.nodes.length?(s(),S(qs,{key:0,graph:I.value},null,8,[`graph`])):(s(),h(`div`,Zs,[m(`p`,Qs,n(L.value),1)]))]),_:1})]),_:1},8,[`horizontal`])],512))}});export{$s as default};