@loradb/lora-graph-canvas 0.10.1 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react/jsx-runtime"),A=require("react"),K=require("three"),Js=require("three/examples/jsm/controls/DragControls.js"),el=require("three/webgpu"),tl=require("three/examples/jsm/controls/TrackballControls.js"),nl=require("three/examples/jsm/controls/OrbitControls.js"),rl=require("three/examples/jsm/controls/FlyControls.js"),il=require("three/examples/jsm/postprocessing/EffectComposer.js"),ol=require("three/examples/jsm/postprocessing/RenderPass.js"),Ui=new Map,al=Math.floor(Math.random()*1e3);function Et(e="n"){const t=(Ui.get(e)??al)+1;return Ui.set(e,t),`${e}_${t.toString(36)}`}const sl={nodes:[],links:[]};function ll(e){const t=e.controlled!==void 0,n=A.useCallback(b=>{for(const m of b.links)m.id===void 0&&(m.id=Et("l"));return b},[]),[r,i]=A.useState(()=>{const b=e.defaultData??e.controlled??sl;return n(b)});A.useEffect(()=>{t&&e.controlled&&i(n(e.controlled))},[t,e.controlled,n]);const o=A.useRef(r);o.current=r;const a=A.useRef(e.onChange);a.current=e.onChange;const s=A.useCallback(b=>{o.current=b,t||i(b),a.current?.(b)},[t]),l=A.useCallback(b=>s(n(b)),[s,n]),c=A.useCallback((b,m)=>{const x=b?.id??Et("n"),w={...b??{},id:x,...m?.at??{}},_={nodes:[...o.current.nodes,w],links:o.current.links};return s(_),w},[s]),f=A.useCallback(b=>{const m=b.map(w=>({...w,id:w.id??Et("n")})),x={nodes:[...o.current.nodes,...m],links:o.current.links};return s(x),m},[s]),u=A.useCallback((b,m)=>{const x=o.current.nodes.map(w=>w.id===b?{...w,...m}:w);s({nodes:x,links:o.current.links})},[s]),g=A.useCallback(b=>{const m=o.current,x=m.nodes.filter(_=>_.id!==b),w=m.links.filter(_=>{const k=typeof _.source=="object"?_.source?.id:_.source,C=typeof _.target=="object"?_.target?.id:_.target;return k!==b&&C!==b});s({nodes:x,links:w})},[s]),h=A.useCallback(b=>{const m=new Set(b),x=o.current,w=x.nodes.filter(k=>!m.has(k.id)),_=x.links.filter(k=>{const C=typeof k.source=="object"?k.source?.id:k.source,P=typeof k.target=="object"?k.target?.id:k.target;return C!==void 0&&P!==void 0&&!m.has(C)&&!m.has(P)});s({nodes:w,links:_})},[s]),p=A.useCallback(b=>{const m={id:Et("l"),...b};return s({nodes:o.current.nodes,links:[...o.current.links,m]}),m},[s]),v=A.useCallback(b=>{const m=b.map(x=>({id:Et("l"),...x}));return s({nodes:o.current.nodes,links:[...o.current.links,...m]}),m},[s]),y=A.useCallback(b=>{const m=o.current.links.filter(x=>!b(x));s({nodes:o.current.nodes,links:m})},[s]),d=A.useCallback(()=>{s({nodes:[],links:[]})},[s]);return{data:r,setData:l,addNode:c,addNodes:f,updateNode:u,removeNode:g,removeNodes:h,addLink:p,addLinks:v,removeLink:y,clear:d}}function cl(e,t,n){var r,i=1;e==null&&(e=0),t==null&&(t=0),n==null&&(n=0);function o(){var a,s=r.length,l,c=0,f=0,u=0;for(a=0;a<s;++a)l=r[a],c+=l.x||0,f+=l.y||0,u+=l.z||0;for(c=(c/s-e)*i,f=(f/s-t)*i,u=(u/s-n)*i,a=0;a<s;++a)l=r[a],c&&(l.x-=c),f&&(l.y-=f),u&&(l.z-=u)}return o.initialize=function(a){r=a},o.x=function(a){return arguments.length?(e=+a,o):e},o.y=function(a){return arguments.length?(t=+a,o):t},o.z=function(a){return arguments.length?(n=+a,o):n},o.strength=function(a){return arguments.length?(i=+a,o):i},o}function ul(e){const t=+this._x.call(null,e);return Ko(this.cover(t),t,e)}function Ko(e,t,n){if(isNaN(t))return e;var r,i=e._root,o={data:n},a=e._x0,s=e._x1,l,c,f,u,g;if(!i)return e._root=o,e;for(;i.length;)if((f=t>=(l=(a+s)/2))?a=l:s=l,r=i,!(i=i[u=+f]))return r[u]=o,e;if(c=+e._x.call(null,i.data),t===c)return o.next=i,r?r[u]=o:e._root=o,e;do r=r?r[u]=new Array(2):e._root=new Array(2),(f=t>=(l=(a+s)/2))?a=l:s=l;while((u=+f)==(g=+(c>=l)));return r[g]=i,r[u]=o,e}function fl(e){Array.isArray(e)||(e=Array.from(e));const t=e.length,n=new Float64Array(t);let r=1/0,i=-1/0;for(let o=0,a;o<t;++o)isNaN(a=+this._x.call(null,e[o]))||(n[o]=a,a<r&&(r=a),a>i&&(i=a));if(r>i)return this;this.cover(r).cover(i);for(let o=0;o<t;++o)Ko(this,n[o],e[o]);return this}function dl(e){if(isNaN(e=+e))return this;var t=this._x0,n=this._x1;if(isNaN(t))n=(t=Math.floor(e))+1;else{for(var r=n-t||1,i=this._root,o,a;t>e||e>=n;)switch(a=+(e<t),o=new Array(2),o[a]=i,i=o,r*=2,a){case 0:n=t+r;break;case 1:t=n-r;break}this._root&&this._root.length&&(this._root=i)}return this._x0=t,this._x1=n,this}function hl(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function pl(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function at(e,t,n){this.node=e,this.x0=t,this.x1=n}function gl(e,t){var n,r=this._x0,i,o,a=this._x1,s=[],l=this._root,c,f;for(l&&s.push(new at(l,r,a)),t==null?t=1/0:(r=e-t,a=e+t);c=s.pop();)if(!(!(l=c.node)||(i=c.x0)>a||(o=c.x1)<r))if(l.length){var u=(i+o)/2;s.push(new at(l[1],u,o),new at(l[0],i,u)),(f=+(e>=u))&&(c=s[s.length-1],s[s.length-1]=s[s.length-1-f],s[s.length-1-f]=c)}else{var g=Math.abs(e-+this._x.call(null,l.data));g<t&&(t=g,r=e-g,a=e+g,n=l.data)}return n}function vl(e){if(isNaN(l=+this._x.call(null,e)))return this;var t,n=this._root,r,i,o,a=this._x0,s=this._x1,l,c,f,u,g;if(!n)return this;if(n.length)for(;;){if((f=l>=(c=(a+s)/2))?a=c:s=c,t=n,!(n=n[u=+f]))return this;if(!n.length)break;t[u+1&1]&&(r=t,g=u)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):t?(o?t[u]=o:delete t[u],(n=t[0]||t[1])&&n===(t[1]||t[0])&&!n.length&&(r?r[g]=n:this._root=n),this):(this._root=o,this)}function yl(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function ml(){return this._root}function bl(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function _l(e){var t=[],n,r=this._root,i,o,a;for(r&&t.push(new at(r,this._x0,this._x1));n=t.pop();)if(!e(r=n.node,o=n.x0,a=n.x1)&&r.length){var s=(o+a)/2;(i=r[1])&&t.push(new at(i,s,a)),(i=r[0])&&t.push(new at(i,o,s))}return this}function xl(e){var t=[],n=[],r;for(this._root&&t.push(new at(this._root,this._x0,this._x1));r=t.pop();){var i=r.node;if(i.length){var o,a=r.x0,s=r.x1,l=(a+s)/2;(o=i[0])&&t.push(new at(o,a,l)),(o=i[1])&&t.push(new at(o,l,s))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.x1);return this}function wl(e){return e[0]}function kl(e){return arguments.length?(this._x=e,this):this._x}function qr(e,t){var n=new Vr(t??wl,NaN,NaN);return e==null?n:n.addAll(e)}function Vr(e,t,n){this._x=e,this._x0=t,this._x1=n,this._root=void 0}function qi(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Ne=qr.prototype=Vr.prototype;Ne.copy=function(){var e=new Vr(this._x,this._x0,this._x1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=qi(t),e;for(n=[{source:t,target:e._root=new Array(2)}];t=n.pop();)for(var i=0;i<2;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=new Array(2)}):t.target[i]=qi(r));return e};Ne.add=ul;Ne.addAll=fl;Ne.cover=dl;Ne.data=hl;Ne.extent=pl;Ne.find=gl;Ne.remove=vl;Ne.removeAll=yl;Ne.root=ml;Ne.size=bl;Ne.visit=_l;Ne.visitAfter=xl;Ne.x=kl;function Cl(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return Qo(this.cover(t,n),t,n,e)}function Qo(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,o=e._root,a={data:r},s=e._x0,l=e._y0,c=e._x1,f=e._y1,u,g,h,p,v,y,d,b;if(!o)return e._root=a,e;for(;o.length;)if((v=t>=(u=(s+c)/2))?s=u:c=u,(y=n>=(g=(l+f)/2))?l=g:f=g,i=o,!(o=o[d=y<<1|v]))return i[d]=a,e;if(h=+e._x.call(null,o.data),p=+e._y.call(null,o.data),t===h&&n===p)return a.next=o,i?i[d]=a:e._root=a,e;do i=i?i[d]=new Array(4):e._root=new Array(4),(v=t>=(u=(s+c)/2))?s=u:c=u,(y=n>=(g=(l+f)/2))?l=g:f=g;while((d=y<<1|v)===(b=(p>=g)<<1|h>=u));return i[b]=o,i[d]=a,e}function Sl(e){var t,n,r=e.length,i,o,a=new Array(r),s=new Array(r),l=1/0,c=1/0,f=-1/0,u=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(o=+this._y.call(null,t))||(a[n]=i,s[n]=o,i<l&&(l=i),i>f&&(f=i),o<c&&(c=o),o>u&&(u=o));if(l>f||c>u)return this;for(this.cover(l,c).cover(f,u),n=0;n<r;++n)Qo(this,a[n],s[n],e[n]);return this}function Ml(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,o=(r=Math.floor(t))+1;else{for(var a=i-n||1,s=this._root,l,c;n>e||e>=i||r>t||t>=o;)switch(c=(t<r)<<1|e<n,l=new Array(4),l[c]=s,s=l,a*=2,c){case 0:i=n+a,o=r+a;break;case 1:n=i-a,o=r+a;break;case 2:i=n+a,r=o-a;break;case 3:n=i-a,r=o-a;break}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this}function Pl(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Ol(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 Ae(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function Al(e,t,n){var r,i=this._x0,o=this._y0,a,s,l,c,f=this._x1,u=this._y1,g=[],h=this._root,p,v;for(h&&g.push(new Ae(h,i,o,f,u)),n==null?n=1/0:(i=e-n,o=t-n,f=e+n,u=t+n,n*=n);p=g.pop();)if(!(!(h=p.node)||(a=p.x0)>f||(s=p.y0)>u||(l=p.x1)<i||(c=p.y1)<o))if(h.length){var y=(a+l)/2,d=(s+c)/2;g.push(new Ae(h[3],y,d,l,c),new Ae(h[2],a,d,y,c),new Ae(h[1],y,s,l,d),new Ae(h[0],a,s,y,d)),(v=(t>=d)<<1|e>=y)&&(p=g[g.length-1],g[g.length-1]=g[g.length-1-v],g[g.length-1-v]=p)}else{var b=e-+this._x.call(null,h.data),m=t-+this._y.call(null,h.data),x=b*b+m*m;if(x<n){var w=Math.sqrt(n=x);i=e-w,o=t-w,f=e+w,u=t+w,r=h.data}}return r}function jl(e){if(isNaN(f=+this._x.call(null,e))||isNaN(u=+this._y.call(null,e)))return this;var t,n=this._root,r,i,o,a=this._x0,s=this._y0,l=this._x1,c=this._y1,f,u,g,h,p,v,y,d;if(!n)return this;if(n.length)for(;;){if((p=f>=(g=(a+l)/2))?a=g:l=g,(v=u>=(h=(s+c)/2))?s=h:c=h,t=n,!(n=n[y=v<<1|p]))return this;if(!n.length)break;(t[y+1&3]||t[y+2&3]||t[y+3&3])&&(r=t,d=y)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):t?(o?t[y]=o:delete t[y],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[d]=n:this._root=n),this):(this._root=o,this)}function Tl(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function El(){return this._root}function Ll(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function Nl(e){var t=[],n,r=this._root,i,o,a,s,l;for(r&&t.push(new Ae(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,o=n.x0,a=n.y0,s=n.x1,l=n.y1)&&r.length){var c=(o+s)/2,f=(a+l)/2;(i=r[3])&&t.push(new Ae(i,c,f,s,l)),(i=r[2])&&t.push(new Ae(i,o,f,c,l)),(i=r[1])&&t.push(new Ae(i,c,a,s,f)),(i=r[0])&&t.push(new Ae(i,o,a,c,f))}return this}function Rl(e){var t=[],n=[],r;for(this._root&&t.push(new Ae(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var o,a=r.x0,s=r.y0,l=r.x1,c=r.y1,f=(a+l)/2,u=(s+c)/2;(o=i[0])&&t.push(new Ae(o,a,s,f,u)),(o=i[1])&&t.push(new Ae(o,f,s,l,u)),(o=i[2])&&t.push(new Ae(o,a,u,f,c)),(o=i[3])&&t.push(new Ae(o,f,u,l,c))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function Il(e){return e[0]}function Dl(e){return arguments.length?(this._x=e,this):this._x}function zl(e){return e[1]}function Fl(e){return arguments.length?(this._y=e,this):this._y}function Gr(e,t,n){var r=new Wr(t??Il,n??zl,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function Wr(e,t,n,r,i,o){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Vi(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var je=Gr.prototype=Wr.prototype;je.copy=function(){var e=new Wr(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=Vi(t),e;for(n=[{source:t,target:e._root=new Array(4)}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=new Array(4)}):t.target[i]=Vi(r));return e};je.add=Cl;je.addAll=Sl;je.cover=Ml;je.data=Pl;je.extent=Ol;je.find=Al;je.remove=jl;je.removeAll=Tl;je.root=El;je.size=Ll;je.visit=Nl;je.visitAfter=Rl;je.x=Dl;je.y=Fl;function Bl(e){const t=+this._x.call(null,e),n=+this._y.call(null,e),r=+this._z.call(null,e);return Zo(this.cover(t,n,r),t,n,r,e)}function Zo(e,t,n,r,i){if(isNaN(t)||isNaN(n)||isNaN(r))return e;var o,a=e._root,s={data:i},l=e._x0,c=e._y0,f=e._z0,u=e._x1,g=e._y1,h=e._z1,p,v,y,d,b,m,x,w,_,k,C;if(!a)return e._root=s,e;for(;a.length;)if((x=t>=(p=(l+u)/2))?l=p:u=p,(w=n>=(v=(c+g)/2))?c=v:g=v,(_=r>=(y=(f+h)/2))?f=y:h=y,o=a,!(a=a[k=_<<2|w<<1|x]))return o[k]=s,e;if(d=+e._x.call(null,a.data),b=+e._y.call(null,a.data),m=+e._z.call(null,a.data),t===d&&n===b&&r===m)return s.next=a,o?o[k]=s:e._root=s,e;do o=o?o[k]=new Array(8):e._root=new Array(8),(x=t>=(p=(l+u)/2))?l=p:u=p,(w=n>=(v=(c+g)/2))?c=v:g=v,(_=r>=(y=(f+h)/2))?f=y:h=y;while((k=_<<2|w<<1|x)===(C=(m>=y)<<2|(b>=v)<<1|d>=p));return o[C]=a,o[k]=s,e}function $l(e){Array.isArray(e)||(e=Array.from(e));const t=e.length,n=new Float64Array(t),r=new Float64Array(t),i=new Float64Array(t);let o=1/0,a=1/0,s=1/0,l=-1/0,c=-1/0,f=-1/0;for(let u=0,g,h,p,v;u<t;++u)isNaN(h=+this._x.call(null,g=e[u]))||isNaN(p=+this._y.call(null,g))||isNaN(v=+this._z.call(null,g))||(n[u]=h,r[u]=p,i[u]=v,h<o&&(o=h),h>l&&(l=h),p<a&&(a=p),p>c&&(c=p),v<s&&(s=v),v>f&&(f=v));if(o>l||a>c||s>f)return this;this.cover(o,a,s).cover(l,c,f);for(let u=0;u<t;++u)Zo(this,n[u],r[u],i[u],e[u]);return this}function Hl(e,t,n){if(isNaN(e=+e)||isNaN(t=+t)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,o=this._z0,a=this._x1,s=this._y1,l=this._z1;if(isNaN(r))a=(r=Math.floor(e))+1,s=(i=Math.floor(t))+1,l=(o=Math.floor(n))+1;else{for(var c=a-r||1,f=this._root,u,g;r>e||e>=a||i>t||t>=s||o>n||n>=l;)switch(g=(n<o)<<2|(t<i)<<1|e<r,u=new Array(8),u[g]=f,f=u,c*=2,g){case 0:a=r+c,s=i+c,l=o+c;break;case 1:r=a-c,s=i+c,l=o+c;break;case 2:a=r+c,i=s-c,l=o+c;break;case 3:r=a-c,i=s-c,l=o+c;break;case 4:a=r+c,s=i+c,o=l-c;break;case 5:r=a-c,s=i+c,o=l-c;break;case 6:a=r+c,i=s-c,o=l-c;break;case 7:r=a-c,i=s-c,o=l-c;break}this._root&&this._root.length&&(this._root=f)}return this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=l,this}function Ul(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function ql(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ue(e,t,n,r,i,o,a){this.node=e,this.x0=t,this.y0=n,this.z0=r,this.x1=i,this.y1=o,this.z1=a}function Vl(e,t,n,r){var i,o=this._x0,a=this._y0,s=this._z0,l,c,f,u,g,h,p=this._x1,v=this._y1,y=this._z1,d=[],b=this._root,m,x;for(b&&d.push(new ue(b,o,a,s,p,v,y)),r==null?r=1/0:(o=e-r,a=t-r,s=n-r,p=e+r,v=t+r,y=n+r,r*=r);m=d.pop();)if(!(!(b=m.node)||(l=m.x0)>p||(c=m.y0)>v||(f=m.z0)>y||(u=m.x1)<o||(g=m.y1)<a||(h=m.z1)<s))if(b.length){var w=(l+u)/2,_=(c+g)/2,k=(f+h)/2;d.push(new ue(b[7],w,_,k,u,g,h),new ue(b[6],l,_,k,w,g,h),new ue(b[5],w,c,k,u,_,h),new ue(b[4],l,c,k,w,_,h),new ue(b[3],w,_,f,u,g,k),new ue(b[2],l,_,f,w,g,k),new ue(b[1],w,c,f,u,_,k),new ue(b[0],l,c,f,w,_,k)),(x=(n>=k)<<2|(t>=_)<<1|e>=w)&&(m=d[d.length-1],d[d.length-1]=d[d.length-1-x],d[d.length-1-x]=m)}else{var C=e-+this._x.call(null,b.data),P=t-+this._y.call(null,b.data),M=n-+this._z.call(null,b.data),N=C*C+P*P+M*M;if(N<r){var E=Math.sqrt(r=N);o=e-E,a=t-E,s=n-E,p=e+E,v=t+E,y=n+E,i=b.data}}return i}const Gl=(e,t,n,r,i,o)=>Math.sqrt((e-r)**2+(t-i)**2+(n-o)**2);function Wl(e,t,n,r){const i=[],o=e-r,a=t-r,s=n-r,l=e+r,c=t+r,f=n+r;return this.visit((u,g,h,p,v,y,d)=>{if(!u.length)do{const b=u.data;Gl(e,t,n,this._x(b),this._y(b),this._z(b))<=r&&i.push(b)}while(u=u.next);return g>l||h>c||p>f||v<o||y<a||d<s}),i}function Xl(e){if(isNaN(g=+this._x.call(null,e))||isNaN(h=+this._y.call(null,e))||isNaN(p=+this._z.call(null,e)))return this;var t,n=this._root,r,i,o,a=this._x0,s=this._y0,l=this._z0,c=this._x1,f=this._y1,u=this._z1,g,h,p,v,y,d,b,m,x,w,_;if(!n)return this;if(n.length)for(;;){if((b=g>=(v=(a+c)/2))?a=v:c=v,(m=h>=(y=(s+f)/2))?s=y:f=y,(x=p>=(d=(l+u)/2))?l=d:u=d,t=n,!(n=n[w=x<<2|m<<1|b]))return this;if(!n.length)break;(t[w+1&7]||t[w+2&7]||t[w+3&7]||t[w+4&7]||t[w+5&7]||t[w+6&7]||t[w+7&7])&&(r=t,_=w)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):t?(o?t[w]=o:delete t[w],(n=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&n===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=o,this)}function Yl(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Kl(){return this._root}function Ql(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function Zl(e){var t=[],n,r=this._root,i,o,a,s,l,c,f;for(r&&t.push(new ue(r,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();)if(!e(r=n.node,o=n.x0,a=n.y0,s=n.z0,l=n.x1,c=n.y1,f=n.z1)&&r.length){var u=(o+l)/2,g=(a+c)/2,h=(s+f)/2;(i=r[7])&&t.push(new ue(i,u,g,h,l,c,f)),(i=r[6])&&t.push(new ue(i,o,g,h,u,c,f)),(i=r[5])&&t.push(new ue(i,u,a,h,l,g,f)),(i=r[4])&&t.push(new ue(i,o,a,h,u,g,f)),(i=r[3])&&t.push(new ue(i,u,g,s,l,c,h)),(i=r[2])&&t.push(new ue(i,o,g,s,u,c,h)),(i=r[1])&&t.push(new ue(i,u,a,s,l,g,h)),(i=r[0])&&t.push(new ue(i,o,a,s,u,g,h))}return this}function Jl(e){var t=[],n=[],r;for(this._root&&t.push(new ue(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=t.pop();){var i=r.node;if(i.length){var o,a=r.x0,s=r.y0,l=r.z0,c=r.x1,f=r.y1,u=r.z1,g=(a+c)/2,h=(s+f)/2,p=(l+u)/2;(o=i[0])&&t.push(new ue(o,a,s,l,g,h,p)),(o=i[1])&&t.push(new ue(o,g,s,l,c,h,p)),(o=i[2])&&t.push(new ue(o,a,h,l,g,f,p)),(o=i[3])&&t.push(new ue(o,g,h,l,c,f,p)),(o=i[4])&&t.push(new ue(o,a,s,p,g,h,u)),(o=i[5])&&t.push(new ue(o,g,s,p,c,h,u)),(o=i[6])&&t.push(new ue(o,a,h,p,g,f,u)),(o=i[7])&&t.push(new ue(o,g,h,p,c,f,u))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.z0,r.x1,r.y1,r.z1);return this}function ec(e){return e[0]}function tc(e){return arguments.length?(this._x=e,this):this._x}function nc(e){return e[1]}function rc(e){return arguments.length?(this._y=e,this):this._y}function ic(e){return e[2]}function oc(e){return arguments.length?(this._z=e,this):this._z}function Xr(e,t,n,r){var i=new Yr(t??ec,n??nc,r??ic,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function Yr(e,t,n,r,i,o,a,s,l){this._x=e,this._y=t,this._z=n,this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=l,this._root=void 0}function Gi(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var ke=Xr.prototype=Yr.prototype;ke.copy=function(){var e=new Yr(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=Gi(t),e;for(n=[{source:t,target:e._root=new Array(8)}];t=n.pop();)for(var i=0;i<8;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=new Array(8)}):t.target[i]=Gi(r));return e};ke.add=Bl;ke.addAll=$l;ke.cover=Hl;ke.data=Ul;ke.extent=ql;ke.find=Vl;ke.findAllWithinRadius=Wl;ke.remove=Xl;ke.removeAll=Yl;ke.root=Kl;ke.size=Ql;ke.visit=Zl;ke.visitAfter=Jl;ke.x=tc;ke.y=rc;ke.z=oc;function _e(e){return function(){return e}}function qe(e){return(e()-.5)*1e-6}function ar(e){return e.x+e.vx}function Wi(e){return e.y+e.vy}function ac(e){return e.z+e.vz}function Xi(e){var t,n,r,i,o=1,a=1;typeof e!="function"&&(e=_e(e==null?1:+e));function s(){for(var f,u=t.length,g,h,p,v,y,d,b,m=0;m<a;++m)for(g=(n===1?qr(t,ar):n===2?Gr(t,ar,Wi):n===3?Xr(t,ar,Wi,ac):null).visitAfter(l),f=0;f<u;++f)h=t[f],d=r[h.index],b=d*d,p=h.x+h.vx,n>1&&(v=h.y+h.vy),n>2&&(y=h.z+h.vz),g.visit(x);function x(w,_,k,C,P,M,N){var E=[_,k,C,P,M,N],B=E[0],S=E[1],O=E[2],L=E[n],U=E[n+1],ne=E[n+2],J=w.data,se=w.r,D=d+se;if(J){if(J.index>h.index){var $=p-J.x-J.vx,G=n>1?v-J.y-J.vy:0,Z=n>2?y-J.z-J.vz:0,I=$*$+G*G+Z*Z;I<D*D&&($===0&&($=qe(i),I+=$*$),n>1&&G===0&&(G=qe(i),I+=G*G),n>2&&Z===0&&(Z=qe(i),I+=Z*Z),I=(D-(I=Math.sqrt(I)))/I*o,h.vx+=($*=I)*(D=(se*=se)/(b+se)),n>1&&(h.vy+=(G*=I)*D),n>2&&(h.vz+=(Z*=I)*D),J.vx-=$*(D=1-D),n>1&&(J.vy-=G*D),n>2&&(J.vz-=Z*D))}return}return B>p+D||L<p-D||n>1&&(S>v+D||U<v-D)||n>2&&(O>y+D||ne<y-D)}}function l(f){if(f.data)return f.r=r[f.data.index];for(var u=f.r=0;u<Math.pow(2,n);++u)f[u]&&f[u].r>f.r&&(f.r=f[u].r)}function c(){if(t){var f,u=t.length,g;for(r=new Array(u),f=0;f<u;++f)g=t[f],r[g.index]=+e(g,f,t)}}return s.initialize=function(f,...u){t=f,i=u.find(g=>typeof g=="function")||Math.random,n=u.find(g=>[1,2,3].includes(g))||2,c()},s.iterations=function(f){return arguments.length?(a=+f,s):a},s.strength=function(f){return arguments.length?(o=+f,s):o},s.radius=function(f){return arguments.length?(e=typeof f=="function"?f:_e(+f),c(),s):e},s}function sc(e){return e.index}function Yi(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}function lc(e){var t=sc,n=g,r,i=_e(30),o,a,s,l,c,f,u=1;e==null&&(e=[]);function g(d){return 1/Math.min(l[d.source.index],l[d.target.index])}function h(d){for(var b=0,m=e.length;b<u;++b)for(var x=0,w,_,k,C=0,P=0,M=0,N,E;x<m;++x)w=e[x],_=w.source,k=w.target,C=k.x+k.vx-_.x-_.vx||qe(f),s>1&&(P=k.y+k.vy-_.y-_.vy||qe(f)),s>2&&(M=k.z+k.vz-_.z-_.vz||qe(f)),N=Math.sqrt(C*C+P*P+M*M),N=(N-o[x])/N*d*r[x],C*=N,P*=N,M*=N,k.vx-=C*(E=c[x]),s>1&&(k.vy-=P*E),s>2&&(k.vz-=M*E),_.vx+=C*(E=1-E),s>1&&(_.vy+=P*E),s>2&&(_.vz+=M*E)}function p(){if(a){var d,b=a.length,m=e.length,x=new Map(a.map((_,k)=>[t(_,k,a),_])),w;for(d=0,l=new Array(b);d<m;++d)w=e[d],w.index=d,typeof w.source!="object"&&(w.source=Yi(x,w.source)),typeof w.target!="object"&&(w.target=Yi(x,w.target)),l[w.source.index]=(l[w.source.index]||0)+1,l[w.target.index]=(l[w.target.index]||0)+1;for(d=0,c=new Array(m);d<m;++d)w=e[d],c[d]=l[w.source.index]/(l[w.source.index]+l[w.target.index]);r=new Array(m),v(),o=new Array(m),y()}}function v(){if(a)for(var d=0,b=e.length;d<b;++d)r[d]=+n(e[d],d,e)}function y(){if(a)for(var d=0,b=e.length;d<b;++d)o[d]=+i(e[d],d,e)}return h.initialize=function(d,...b){a=d,f=b.find(m=>typeof m=="function")||Math.random,s=b.find(m=>[1,2,3].includes(m))||2,p()},h.links=function(d){return arguments.length?(e=d,p(),h):e},h.id=function(d){return arguments.length?(t=d,h):t},h.iterations=function(d){return arguments.length?(u=+d,h):u},h.strength=function(d){return arguments.length?(n=typeof d=="function"?d:_e(+d),v(),h):n},h.distance=function(d){return arguments.length?(i=typeof d=="function"?d:_e(+d),y(),h):i},h}var cc={value:()=>{}};function Jo(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Mn(n)}function Mn(e){this._=e}function uc(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Mn.prototype=Jo.prototype={constructor:Mn,on:function(e,t){var n=this._,r=uc(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o<a;)if((i=(e=r[o]).type)&&(i=fc(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<a;)if(i=(e=r[o]).type)n[i]=Ki(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Ki(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 Mn(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function fc(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Ki(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=cc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Lt=0,Jt=0,Vt=0,ea=1e3,An,en,jn=0,_t=0,$n=0,sn=typeof performance=="object"&&performance.now?performance:Date,ta=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function na(){return _t||(ta(dc),_t=sn.now()+$n)}function dc(){_t=0}function kr(){this._call=this._time=this._next=null}kr.prototype=ra.prototype={constructor:kr,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?na():+n)+(t==null?0:+t),!this._next&&en!==this&&(en?en._next=this:An=this,en=this),this._call=e,this._time=n,Cr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Cr())}};function ra(e,t,n){var r=new kr;return r.restart(e,t,n),r}function hc(){na(),++Lt;for(var e=An,t;e;)(t=_t-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Lt}function Qi(){_t=(jn=sn.now())+$n,Lt=Jt=0;try{hc()}finally{Lt=0,gc(),_t=0}}function pc(){var e=sn.now(),t=e-jn;t>ea&&($n-=t,jn=e)}function gc(){for(var e,t=An,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:An=n);en=e,Cr(r)}function Cr(e){if(!Lt){Jt&&(Jt=clearTimeout(Jt));var t=e-_t;t>24?(e<1/0&&(Jt=setTimeout(Qi,e-sn.now()-$n)),Vt&&(Vt=clearInterval(Vt))):(Vt||(jn=sn.now(),Vt=setInterval(pc,ea)),Lt=1,ta(Qi))}}const vc=1664525,yc=1013904223,Zi=4294967296;function mc(){let e=1;return()=>(e=(vc*e+yc)%Zi)/Zi}var Ji=3;function sr(e){return e.x}function eo(e){return e.y}function bc(e){return e.z}var _c=10,xc=Math.PI*(3-Math.sqrt(5)),wc=Math.PI*20/(9+Math.sqrt(221));function kc(e,t){t=t||2;var n=Math.min(Ji,Math.max(1,Math.round(t))),r,i=1,o=.001,a=1-Math.pow(o,1/300),s=0,l=.6,c=new Map,f=ra(h),u=Jo("tick","end"),g=mc();e==null&&(e=[]);function h(){p(),u.call("tick",r),i<o&&(f.stop(),u.call("end",r))}function p(d){var b,m=e.length,x;d===void 0&&(d=1);for(var w=0;w<d;++w)for(i+=(s-i)*a,c.forEach(function(_){_(i)}),b=0;b<m;++b)x=e[b],x.fx==null?x.x+=x.vx*=l:(x.x=x.fx,x.vx=0),n>1&&(x.fy==null?x.y+=x.vy*=l:(x.y=x.fy,x.vy=0)),n>2&&(x.fz==null?x.z+=x.vz*=l:(x.z=x.fz,x.vz=0));return r}function v(){for(var d=0,b=e.length,m;d<b;++d){if(m=e[d],m.index=d,m.fx!=null&&(m.x=m.fx),m.fy!=null&&(m.y=m.fy),m.fz!=null&&(m.z=m.fz),isNaN(m.x)||n>1&&isNaN(m.y)||n>2&&isNaN(m.z)){var x=_c*(n>2?Math.cbrt(.5+d):n>1?Math.sqrt(.5+d):d),w=d*xc,_=d*wc;n===1?m.x=x:n===2?(m.x=x*Math.cos(w),m.y=x*Math.sin(w)):(m.x=x*Math.sin(w)*Math.cos(_),m.y=x*Math.cos(w),m.z=x*Math.sin(w)*Math.sin(_))}(isNaN(m.vx)||n>1&&isNaN(m.vy)||n>2&&isNaN(m.vz))&&(m.vx=0,n>1&&(m.vy=0),n>2&&(m.vz=0))}}function y(d){return d.initialize&&d.initialize(e,g,n),d}return v(),r={tick:p,restart:function(){return f.restart(h),r},stop:function(){return f.stop(),r},numDimensions:function(d){return arguments.length?(n=Math.min(Ji,Math.max(1,Math.round(d))),c.forEach(y),r):n},nodes:function(d){return arguments.length?(e=d,v(),c.forEach(y),r):e},alpha:function(d){return arguments.length?(i=+d,r):i},alphaMin:function(d){return arguments.length?(o=+d,r):o},alphaDecay:function(d){return arguments.length?(a=+d,r):+a},alphaTarget:function(d){return arguments.length?(s=+d,r):s},velocityDecay:function(d){return arguments.length?(l=1-d,r):1-l},randomSource:function(d){return arguments.length?(g=d,c.forEach(y),r):g},force:function(d,b){return arguments.length>1?(b==null?c.delete(d):c.set(d,y(b)),r):c.get(d)},find:function(){var d=Array.prototype.slice.call(arguments),b=d.shift()||0,m=(n>1?d.shift():null)||0,x=(n>2?d.shift():null)||0,w=d.shift()||1/0,_=0,k=e.length,C,P,M,N,E,B;for(w*=w,_=0;_<k;++_)E=e[_],C=b-E.x,P=m-(E.y||0),M=x-(E.z||0),N=C*C+P*P+M*M,N<w&&(B=E,w=N);return B},on:function(d,b){return arguments.length>1?(u.on(d,b),r):u.on(d)}}}function Cc(){var e,t,n,r,i,o=_e(-30),a,s=1,l=1/0,c=.81;function f(p){var v,y=e.length,d=(t===1?qr(e,sr):t===2?Gr(e,sr,eo):t===3?Xr(e,sr,eo,bc):null).visitAfter(g);for(i=p,v=0;v<y;++v)n=e[v],d.visit(h)}function u(){if(e){var p,v=e.length,y;for(a=new Array(v),p=0;p<v;++p)y=e[p],a[y.index]=+o(y,p,e)}}function g(p){var v=0,y,d,b=0,m,x,w,_,k=p.length;if(k){for(m=x=w=_=0;_<k;++_)(y=p[_])&&(d=Math.abs(y.value))&&(v+=y.value,b+=d,m+=d*(y.x||0),x+=d*(y.y||0),w+=d*(y.z||0));v*=Math.sqrt(4/k),p.x=m/b,t>1&&(p.y=x/b),t>2&&(p.z=w/b)}else{y=p,y.x=y.data.x,t>1&&(y.y=y.data.y),t>2&&(y.z=y.data.z);do v+=a[y.data.index];while(y=y.next)}p.value=v}function h(p,v,y,d,b){if(!p.value)return!0;var m=[y,d,b][t-1],x=p.x-n.x,w=t>1?p.y-n.y:0,_=t>2?p.z-n.z:0,k=m-v,C=x*x+w*w+_*_;if(k*k/c<C)return C<l&&(x===0&&(x=qe(r),C+=x*x),t>1&&w===0&&(w=qe(r),C+=w*w),t>2&&_===0&&(_=qe(r),C+=_*_),C<s&&(C=Math.sqrt(s*C)),n.vx+=x*p.value*i/C,t>1&&(n.vy+=w*p.value*i/C),t>2&&(n.vz+=_*p.value*i/C)),!0;if(p.length||C>=l)return;(p.data!==n||p.next)&&(x===0&&(x=qe(r),C+=x*x),t>1&&w===0&&(w=qe(r),C+=w*w),t>2&&_===0&&(_=qe(r),C+=_*_),C<s&&(C=Math.sqrt(s*C)));do p.data!==n&&(k=a[p.data.index]*i/C,n.vx+=x*k,t>1&&(n.vy+=w*k),t>2&&(n.vz+=_*k));while(p=p.next)}return f.initialize=function(p,...v){e=p,r=v.find(y=>typeof y=="function")||Math.random,t=v.find(y=>[1,2,3].includes(y))||2,u()},f.strength=function(p){return arguments.length?(o=typeof p=="function"?p:_e(+p),u(),f):o},f.distanceMin=function(p){return arguments.length?(s=p*p,f):Math.sqrt(s)},f.distanceMax=function(p){return arguments.length?(l=p*p,f):Math.sqrt(l)},f.theta=function(p){return arguments.length?(c=p*p,f):Math.sqrt(c)},f}function Sc(e,t,n,r){var i,o,a=_e(.1),s,l;typeof e!="function"&&(e=_e(+e)),t==null&&(t=0),n==null&&(n=0),r==null&&(r=0);function c(u){for(var g=0,h=i.length;g<h;++g){var p=i[g],v=p.x-t||1e-6,y=(p.y||0)-n||1e-6,d=(p.z||0)-r||1e-6,b=Math.sqrt(v*v+y*y+d*d),m=(l[g]-b)*s[g]*u/b;p.vx+=v*m,o>1&&(p.vy+=y*m),o>2&&(p.vz+=d*m)}}function f(){if(i){var u,g=i.length;for(s=new Array(g),l=new Array(g),u=0;u<g;++u)l[u]=+e(i[u],u,i),s[u]=isNaN(l[u])?0:+a(i[u],u,i)}}return c.initialize=function(u,...g){i=u,o=g.find(h=>[1,2,3].includes(h))||2,f()},c.strength=function(u){return arguments.length?(a=typeof u=="function"?u:_e(+u),f(),c):a},c.radius=function(u){return arguments.length?(e=typeof u=="function"?u:_e(+u),f(),c):e},c.x=function(u){return arguments.length?(t=+u,c):t},c.y=function(u){return arguments.length?(n=+u,c):n},c.z=function(u){return arguments.length?(r=+u,c):r},c}function to(e){var t=_e(.1),n,r,i;typeof e!="function"&&(e=_e(e==null?0:+e));function o(s){for(var l=0,c=n.length,f;l<c;++l)f=n[l],f.vx+=(i[l]-f.x)*r[l]*s}function a(){if(n){var s,l=n.length;for(r=new Array(l),i=new Array(l),s=0;s<l;++s)r[s]=isNaN(i[s]=+e(n[s],s,n))?0:+t(n[s],s,n)}}return o.initialize=function(s){n=s,a()},o.strength=function(s){return arguments.length?(t=typeof s=="function"?s:_e(+s),a(),o):t},o.x=function(s){return arguments.length?(e=typeof s=="function"?s:_e(+s),a(),o):e},o}function no(e){var t=_e(.1),n,r,i;typeof e!="function"&&(e=_e(e==null?0:+e));function o(s){for(var l=0,c=n.length,f;l<c;++l)f=n[l],f.vy+=(i[l]-f.y)*r[l]*s}function a(){if(n){var s,l=n.length;for(r=new Array(l),i=new Array(l),s=0;s<l;++s)r[s]=isNaN(i[s]=+e(n[s],s,n))?0:+t(n[s],s,n)}}return o.initialize=function(s){n=s,a()},o.strength=function(s){return arguments.length?(t=typeof s=="function"?s:_e(+s),a(),o):t},o.y=function(s){return arguments.length?(e=typeof s=="function"?s:_e(+s),a(),o):e},o}function ia(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Mc(e){Oc(e);const t=Pc(e);return e.on=t.on,e.off=t.off,e.fire=t.fire,e}function Pc(e){let t=Object.create(null);return{on:function(n,r,i){if(typeof r!="function")throw new Error("callback is expected to be a function");let o=t[n];return o||(o=t[n]=[]),o.push({callback:r,ctx:i}),e},off:function(n,r){if(typeof n>"u")return t=Object.create(null),e;if(t[n])if(typeof r!="function")delete t[n];else{const i=t[n];for(let o=0;o<i.length;++o)i[o].callback===r&&i.splice(o,1)}return e},fire:function(n){const r=t[n];if(!r)return e;let i;arguments.length>1&&(i=Array.prototype.slice.call(arguments,1));for(let o=0;o<r.length;++o){const a=r[o];a.callback.apply(a.ctx,i)}return e}}}function Oc(e){if(!e)throw new Error("Eventify cannot use falsy object as events subject");const t=["on","fire","off"];for(let n=0;n<t.length;++n)if(e.hasOwnProperty(t[n]))throw new Error("Subject cannot be eventified, since it already has property '"+t[n]+"'")}var Kr=Mc;const Ac=ia(Kr);function jc(e){if(e=e||{},"uniqueLinkId"in e&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react/jsx-runtime"),A=require("react"),re=require("three"),bl=require("three/examples/jsm/controls/DragControls.js"),_l=require("three/webgpu"),xl=require("three/examples/jsm/controls/TrackballControls.js"),wl=require("three/examples/jsm/controls/OrbitControls.js"),kl=require("three/examples/jsm/controls/FlyControls.js"),Cl=require("three/examples/jsm/postprocessing/EffectComposer.js"),Sl=require("three/examples/jsm/postprocessing/RenderPass.js"),ii=new Map,Ml=Math.floor(Math.random()*1e3);function It(e="n"){const t=(ii.get(e)??Ml)+1;return ii.set(e,t),`${e}_${t.toString(36)}`}const Pl={nodes:[],links:[]},Al=["x","y","z","vx","vy","vz","index","_neighbors","_links"];function ai(e){let t=!1;const n=e.nodes.map(o=>{const i=o;if(i.vx===void 0&&i.vy===void 0&&i.vz===void 0&&i.index===void 0)return o;t=!0;const a={};for(const l in i)Al.includes(l)||(a[l]=i[l]);return a}),r=e.links.map(o=>{const i=o.source,a=o.target,l=i!==null&&typeof i=="object",s=a!==null&&typeof a=="object";return!l&&!s?o:(t=!0,{...o,source:l?i.id:i,target:s?a.id:a})});return t?{nodes:n,links:r}:e}function Ol(e){const t=e.controlled!==void 0,n=A.useCallback(_=>{for(const x of _.links)x.id===void 0&&(x.id=It("l"));return _},[]),r=A.useCallback(_=>{let x=!1;const w=_.links.map(b=>b.id!==void 0?b:(x=!0,{...b,id:It("l")}));return x?{nodes:_.nodes,links:w}:_},[]),[o,i]=A.useState(()=>e.defaultData!==void 0?n(ai(e.defaultData)):e.controlled!==void 0?r(ai(e.controlled)):Pl);A.useEffect(()=>{t&&e.controlled&&i(r(e.controlled))},[t,e.controlled,r]);const a=A.useRef(o);a.current=o;const l=A.useRef(e.onChange);l.current=e.onChange;const s=A.useCallback(_=>{a.current=_,t||i(_),l.current?.(_)},[t]),u=A.useCallback(_=>s(t?r(_):n(_)),[s,n,r,t]),f=A.useCallback((_,x)=>{const w=_?.id??It("n"),b={..._??{},id:w,...x?.at??{}},M={nodes:[...a.current.nodes,b],links:a.current.links};return s(M),b},[s]),c=A.useCallback(_=>{const x=_.map(b=>({...b,id:b.id??It("n")})),w={nodes:[...a.current.nodes,...x],links:a.current.links};return s(w),x},[s]),p=A.useCallback((_,x)=>{const w=a.current.nodes.map(b=>b.id===_?{...b,...x}:b);s({nodes:w,links:a.current.links})},[s]),h=A.useCallback(_=>{const x=a.current,w=x.nodes.filter(M=>M.id!==_),b=x.links.filter(M=>{const P=typeof M.source=="object"?M.source?.id:M.source,N=typeof M.target=="object"?M.target?.id:M.target;return P!==_&&N!==_});s({nodes:w,links:b})},[s]),d=A.useCallback(_=>{const x=new Set(_),w=a.current,b=w.nodes.filter(P=>!x.has(P.id)),M=w.links.filter(P=>{const N=typeof P.source=="object"?P.source?.id:P.source,j=typeof P.target=="object"?P.target?.id:P.target;return N!==void 0&&j!==void 0&&!x.has(N)&&!x.has(j)});s({nodes:b,links:M})},[s]),m=A.useCallback(_=>{const x={id:It("l"),..._};return s({nodes:a.current.nodes,links:[...a.current.links,x]}),x},[s]),v=A.useCallback(_=>{const x=_.map(w=>({id:It("l"),...w}));return s({nodes:a.current.nodes,links:[...a.current.links,...x]}),x},[s]),g=A.useCallback(_=>{const x=a.current.links.filter(w=>!_(w));s({nodes:a.current.nodes,links:x})},[s]),S=A.useCallback(()=>{s({nodes:[],links:[]})},[s]);return A.useMemo(()=>({data:o,setData:u,addNode:f,addNodes:c,updateNode:p,removeNode:h,removeNodes:d,addLink:m,addLinks:v,removeLink:g,clear:S}),[o,u,f,c,p,h,d,m,v,g,S])}function jl(e,t,n){var r,o=1;e==null&&(e=0),t==null&&(t=0),n==null&&(n=0);function i(){var a,l=r.length,s,u=0,f=0,c=0;for(a=0;a<l;++a)s=r[a],u+=s.x||0,f+=s.y||0,c+=s.z||0;for(u=(u/l-e)*o,f=(f/l-t)*o,c=(c/l-n)*o,a=0;a<l;++a)s=r[a],u&&(s.x-=u),f&&(s.y-=f),c&&(s.z-=c)}return i.initialize=function(a){r=a},i.x=function(a){return arguments.length?(e=+a,i):e},i.y=function(a){return arguments.length?(t=+a,i):t},i.z=function(a){return arguments.length?(n=+a,i):n},i.strength=function(a){return arguments.length?(o=+a,i):o},i}function zl(e){const t=+this._x.call(null,e);return ga(this.cover(t),t,e)}function ga(e,t,n){if(isNaN(t))return e;var r,o=e._root,i={data:n},a=e._x0,l=e._x1,s,u,f,c,p;if(!o)return e._root=i,e;for(;o.length;)if((f=t>=(s=(a+l)/2))?a=s:l=s,r=o,!(o=o[c=+f]))return r[c]=i,e;if(u=+e._x.call(null,o.data),t===u)return i.next=o,r?r[c]=i:e._root=i,e;do r=r?r[c]=new Array(2):e._root=new Array(2),(f=t>=(s=(a+l)/2))?a=s:l=s;while((c=+f)==(p=+(u>=s)));return r[p]=o,r[c]=i,e}function Tl(e){Array.isArray(e)||(e=Array.from(e));const t=e.length,n=new Float64Array(t);let r=1/0,o=-1/0;for(let i=0,a;i<t;++i)isNaN(a=+this._x.call(null,e[i]))||(n[i]=a,a<r&&(r=a),a>o&&(o=a));if(r>o)return this;this.cover(r).cover(o);for(let i=0;i<t;++i)ga(this,n[i],e[i]);return this}function El(e){if(isNaN(e=+e))return this;var t=this._x0,n=this._x1;if(isNaN(t))n=(t=Math.floor(e))+1;else{for(var r=n-t||1,o=this._root,i,a;t>e||e>=n;)switch(a=+(e<t),i=new Array(2),i[a]=o,o=i,r*=2,a){case 0:n=t+r;break;case 1:t=n-r;break}this._root&&this._root.length&&(this._root=o)}return this._x0=t,this._x1=n,this}function Ll(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Nl(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function kt(e,t,n){this.node=e,this.x0=t,this.x1=n}function Rl(e,t){var n,r=this._x0,o,i,a=this._x1,l=[],s=this._root,u,f;for(s&&l.push(new kt(s,r,a)),t==null?t=1/0:(r=e-t,a=e+t);u=l.pop();)if(!(!(s=u.node)||(o=u.x0)>a||(i=u.x1)<r))if(s.length){var c=(o+i)/2;l.push(new kt(s[1],c,i),new kt(s[0],o,c)),(f=+(e>=c))&&(u=l[l.length-1],l[l.length-1]=l[l.length-1-f],l[l.length-1-f]=u)}else{var p=Math.abs(e-+this._x.call(null,s.data));p<t&&(t=p,r=e-p,a=e+p,n=s.data)}return n}function Dl(e){if(isNaN(s=+this._x.call(null,e)))return this;var t,n=this._root,r,o,i,a=this._x0,l=this._x1,s,u,f,c,p;if(!n)return this;if(n.length)for(;;){if((f=s>=(u=(a+l)/2))?a=u:l=u,t=n,!(n=n[c=+f]))return this;if(!n.length)break;t[c+1&1]&&(r=t,p=c)}for(;n.data!==e;)if(o=n,!(n=n.next))return this;return(i=n.next)&&delete n.next,o?(i?o.next=i:delete o.next,this):t?(i?t[c]=i:delete t[c],(n=t[0]||t[1])&&n===(t[1]||t[0])&&!n.length&&(r?r[p]=n:this._root=n),this):(this._root=i,this)}function Il(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Fl(){return this._root}function Bl(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function $l(e){var t=[],n,r=this._root,o,i,a;for(r&&t.push(new kt(r,this._x0,this._x1));n=t.pop();)if(!e(r=n.node,i=n.x0,a=n.x1)&&r.length){var l=(i+a)/2;(o=r[1])&&t.push(new kt(o,l,a)),(o=r[0])&&t.push(new kt(o,i,l))}return this}function Hl(e){var t=[],n=[],r;for(this._root&&t.push(new kt(this._root,this._x0,this._x1));r=t.pop();){var o=r.node;if(o.length){var i,a=r.x0,l=r.x1,s=(a+l)/2;(i=o[0])&&t.push(new kt(i,a,s)),(i=o[1])&&t.push(new kt(i,s,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.x1);return this}function ql(e){return e[0]}function Ul(e){return arguments.length?(this._x=e,this):this._x}function ao(e,t){var n=new so(t??ql,NaN,NaN);return e==null?n:n.addAll(e)}function so(e,t,n){this._x=e,this._x0=t,this._x1=n,this._root=void 0}function si(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Ve=ao.prototype=so.prototype;Ve.copy=function(){var e=new so(this._x,this._x0,this._x1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=si(t),e;for(n=[{source:t,target:e._root=new Array(2)}];t=n.pop();)for(var o=0;o<2;++o)(r=t.source[o])&&(r.length?n.push({source:r,target:t.target[o]=new Array(2)}):t.target[o]=si(r));return e};Ve.add=zl;Ve.addAll=Tl;Ve.cover=El;Ve.data=Ll;Ve.extent=Nl;Ve.find=Rl;Ve.remove=Dl;Ve.removeAll=Il;Ve.root=Fl;Ve.size=Bl;Ve.visit=$l;Ve.visitAfter=Hl;Ve.x=Ul;function Gl(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return va(this.cover(t,n),t,n,e)}function va(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var o,i=e._root,a={data:r},l=e._x0,s=e._y0,u=e._x1,f=e._y1,c,p,h,d,m,v,g,S;if(!i)return e._root=a,e;for(;i.length;)if((m=t>=(c=(l+u)/2))?l=c:u=c,(v=n>=(p=(s+f)/2))?s=p:f=p,o=i,!(i=i[g=v<<1|m]))return o[g]=a,e;if(h=+e._x.call(null,i.data),d=+e._y.call(null,i.data),t===h&&n===d)return a.next=i,o?o[g]=a:e._root=a,e;do o=o?o[g]=new Array(4):e._root=new Array(4),(m=t>=(c=(l+u)/2))?l=c:u=c,(v=n>=(p=(s+f)/2))?s=p:f=p;while((g=v<<1|m)===(S=(d>=p)<<1|h>=c));return o[S]=i,o[g]=a,e}function Vl(e){var t,n,r=e.length,o,i,a=new Array(r),l=new Array(r),s=1/0,u=1/0,f=-1/0,c=-1/0;for(n=0;n<r;++n)isNaN(o=+this._x.call(null,t=e[n]))||isNaN(i=+this._y.call(null,t))||(a[n]=o,l[n]=i,o<s&&(s=o),o>f&&(f=o),i<u&&(u=i),i>c&&(c=i));if(s>f||u>c)return this;for(this.cover(s,u).cover(f,c),n=0;n<r;++n)va(this,a[n],l[n],e[n]);return this}function Wl(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,o=this._x1,i=this._y1;if(isNaN(n))o=(n=Math.floor(e))+1,i=(r=Math.floor(t))+1;else{for(var a=o-n||1,l=this._root,s,u;n>e||e>=o||r>t||t>=i;)switch(u=(t<r)<<1|e<n,s=new Array(4),s[u]=l,l=s,a*=2,u){case 0:o=n+a,i=r+a;break;case 1:n=o-a,i=r+a;break;case 2:o=n+a,r=i-a;break;case 3:n=o-a,r=i-a;break}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=r,this._x1=o,this._y1=i,this}function Yl(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Xl(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 Be(e,t,n,r,o){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=o}function Kl(e,t,n){var r,o=this._x0,i=this._y0,a,l,s,u,f=this._x1,c=this._y1,p=[],h=this._root,d,m;for(h&&p.push(new Be(h,o,i,f,c)),n==null?n=1/0:(o=e-n,i=t-n,f=e+n,c=t+n,n*=n);d=p.pop();)if(!(!(h=d.node)||(a=d.x0)>f||(l=d.y0)>c||(s=d.x1)<o||(u=d.y1)<i))if(h.length){var v=(a+s)/2,g=(l+u)/2;p.push(new Be(h[3],v,g,s,u),new Be(h[2],a,g,v,u),new Be(h[1],v,l,s,g),new Be(h[0],a,l,v,g)),(m=(t>=g)<<1|e>=v)&&(d=p[p.length-1],p[p.length-1]=p[p.length-1-m],p[p.length-1-m]=d)}else{var S=e-+this._x.call(null,h.data),_=t-+this._y.call(null,h.data),x=S*S+_*_;if(x<n){var w=Math.sqrt(n=x);o=e-w,i=t-w,f=e+w,c=t+w,r=h.data}}return r}function Zl(e){if(isNaN(f=+this._x.call(null,e))||isNaN(c=+this._y.call(null,e)))return this;var t,n=this._root,r,o,i,a=this._x0,l=this._y0,s=this._x1,u=this._y1,f,c,p,h,d,m,v,g;if(!n)return this;if(n.length)for(;;){if((d=f>=(p=(a+s)/2))?a=p:s=p,(m=c>=(h=(l+u)/2))?l=h:u=h,t=n,!(n=n[v=m<<1|d]))return this;if(!n.length)break;(t[v+1&3]||t[v+2&3]||t[v+3&3])&&(r=t,g=v)}for(;n.data!==e;)if(o=n,!(n=n.next))return this;return(i=n.next)&&delete n.next,o?(i?o.next=i:delete o.next,this):t?(i?t[v]=i:delete t[v],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[g]=n:this._root=n),this):(this._root=i,this)}function Ql(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Jl(){return this._root}function ec(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function tc(e){var t=[],n,r=this._root,o,i,a,l,s;for(r&&t.push(new Be(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,i=n.x0,a=n.y0,l=n.x1,s=n.y1)&&r.length){var u=(i+l)/2,f=(a+s)/2;(o=r[3])&&t.push(new Be(o,u,f,l,s)),(o=r[2])&&t.push(new Be(o,i,f,u,s)),(o=r[1])&&t.push(new Be(o,u,a,l,f)),(o=r[0])&&t.push(new Be(o,i,a,u,f))}return this}function nc(e){var t=[],n=[],r;for(this._root&&t.push(new Be(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var o=r.node;if(o.length){var i,a=r.x0,l=r.y0,s=r.x1,u=r.y1,f=(a+s)/2,c=(l+u)/2;(i=o[0])&&t.push(new Be(i,a,l,f,c)),(i=o[1])&&t.push(new Be(i,f,l,s,c)),(i=o[2])&&t.push(new Be(i,a,c,f,u)),(i=o[3])&&t.push(new Be(i,f,c,s,u))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function rc(e){return e[0]}function oc(e){return arguments.length?(this._x=e,this):this._x}function ic(e){return e[1]}function ac(e){return arguments.length?(this._y=e,this):this._y}function lo(e,t,n){var r=new co(t??rc,n??ic,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function co(e,t,n,r,o,i){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=o,this._y1=i,this._root=void 0}function li(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var $e=lo.prototype=co.prototype;$e.copy=function(){var e=new co(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=li(t),e;for(n=[{source:t,target:e._root=new Array(4)}];t=n.pop();)for(var o=0;o<4;++o)(r=t.source[o])&&(r.length?n.push({source:r,target:t.target[o]=new Array(4)}):t.target[o]=li(r));return e};$e.add=Gl;$e.addAll=Vl;$e.cover=Wl;$e.data=Yl;$e.extent=Xl;$e.find=Kl;$e.remove=Zl;$e.removeAll=Ql;$e.root=Jl;$e.size=ec;$e.visit=tc;$e.visitAfter=nc;$e.x=oc;$e.y=ac;function sc(e){const t=+this._x.call(null,e),n=+this._y.call(null,e),r=+this._z.call(null,e);return ya(this.cover(t,n,r),t,n,r,e)}function ya(e,t,n,r,o){if(isNaN(t)||isNaN(n)||isNaN(r))return e;var i,a=e._root,l={data:o},s=e._x0,u=e._y0,f=e._z0,c=e._x1,p=e._y1,h=e._z1,d,m,v,g,S,_,x,w,b,M,P;if(!a)return e._root=l,e;for(;a.length;)if((x=t>=(d=(s+c)/2))?s=d:c=d,(w=n>=(m=(u+p)/2))?u=m:p=m,(b=r>=(v=(f+h)/2))?f=v:h=v,i=a,!(a=a[M=b<<2|w<<1|x]))return i[M]=l,e;if(g=+e._x.call(null,a.data),S=+e._y.call(null,a.data),_=+e._z.call(null,a.data),t===g&&n===S&&r===_)return l.next=a,i?i[M]=l:e._root=l,e;do i=i?i[M]=new Array(8):e._root=new Array(8),(x=t>=(d=(s+c)/2))?s=d:c=d,(w=n>=(m=(u+p)/2))?u=m:p=m,(b=r>=(v=(f+h)/2))?f=v:h=v;while((M=b<<2|w<<1|x)===(P=(_>=v)<<2|(S>=m)<<1|g>=d));return i[P]=a,i[M]=l,e}function lc(e){Array.isArray(e)||(e=Array.from(e));const t=e.length,n=new Float64Array(t),r=new Float64Array(t),o=new Float64Array(t);let i=1/0,a=1/0,l=1/0,s=-1/0,u=-1/0,f=-1/0;for(let c=0,p,h,d,m;c<t;++c)isNaN(h=+this._x.call(null,p=e[c]))||isNaN(d=+this._y.call(null,p))||isNaN(m=+this._z.call(null,p))||(n[c]=h,r[c]=d,o[c]=m,h<i&&(i=h),h>s&&(s=h),d<a&&(a=d),d>u&&(u=d),m<l&&(l=m),m>f&&(f=m));if(i>s||a>u||l>f)return this;this.cover(i,a,l).cover(s,u,f);for(let c=0;c<t;++c)ya(this,n[c],r[c],o[c],e[c]);return this}function cc(e,t,n){if(isNaN(e=+e)||isNaN(t=+t)||isNaN(n=+n))return this;var r=this._x0,o=this._y0,i=this._z0,a=this._x1,l=this._y1,s=this._z1;if(isNaN(r))a=(r=Math.floor(e))+1,l=(o=Math.floor(t))+1,s=(i=Math.floor(n))+1;else{for(var u=a-r||1,f=this._root,c,p;r>e||e>=a||o>t||t>=l||i>n||n>=s;)switch(p=(n<i)<<2|(t<o)<<1|e<r,c=new Array(8),c[p]=f,f=c,u*=2,p){case 0:a=r+u,l=o+u,s=i+u;break;case 1:r=a-u,l=o+u,s=i+u;break;case 2:a=r+u,o=l-u,s=i+u;break;case 3:r=a-u,o=l-u,s=i+u;break;case 4:a=r+u,l=o+u,i=s-u;break;case 5:r=a-u,l=o+u,i=s-u;break;case 6:a=r+u,o=l-u,i=s-u;break;case 7:r=a-u,o=l-u,i=s-u;break}this._root&&this._root.length&&(this._root=f)}return this._x0=r,this._y0=o,this._z0=i,this._x1=a,this._y1=l,this._z1=s,this}function uc(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function fc(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function me(e,t,n,r,o,i,a){this.node=e,this.x0=t,this.y0=n,this.z0=r,this.x1=o,this.y1=i,this.z1=a}function dc(e,t,n,r){var o,i=this._x0,a=this._y0,l=this._z0,s,u,f,c,p,h,d=this._x1,m=this._y1,v=this._z1,g=[],S=this._root,_,x;for(S&&g.push(new me(S,i,a,l,d,m,v)),r==null?r=1/0:(i=e-r,a=t-r,l=n-r,d=e+r,m=t+r,v=n+r,r*=r);_=g.pop();)if(!(!(S=_.node)||(s=_.x0)>d||(u=_.y0)>m||(f=_.z0)>v||(c=_.x1)<i||(p=_.y1)<a||(h=_.z1)<l))if(S.length){var w=(s+c)/2,b=(u+p)/2,M=(f+h)/2;g.push(new me(S[7],w,b,M,c,p,h),new me(S[6],s,b,M,w,p,h),new me(S[5],w,u,M,c,b,h),new me(S[4],s,u,M,w,b,h),new me(S[3],w,b,f,c,p,M),new me(S[2],s,b,f,w,p,M),new me(S[1],w,u,f,c,b,M),new me(S[0],s,u,f,w,b,M)),(x=(n>=M)<<2|(t>=b)<<1|e>=w)&&(_=g[g.length-1],g[g.length-1]=g[g.length-1-x],g[g.length-1-x]=_)}else{var P=e-+this._x.call(null,S.data),N=t-+this._y.call(null,S.data),j=n-+this._z.call(null,S.data),F=P*P+N*N+j*j;if(F<r){var I=Math.sqrt(r=F);i=e-I,a=t-I,l=n-I,d=e+I,m=t+I,v=n+I,o=S.data}}return o}const hc=(e,t,n,r,o,i)=>Math.sqrt((e-r)**2+(t-o)**2+(n-i)**2);function pc(e,t,n,r){const o=[],i=e-r,a=t-r,l=n-r,s=e+r,u=t+r,f=n+r;return this.visit((c,p,h,d,m,v,g)=>{if(!c.length)do{const S=c.data;hc(e,t,n,this._x(S),this._y(S),this._z(S))<=r&&o.push(S)}while(c=c.next);return p>s||h>u||d>f||m<i||v<a||g<l}),o}function gc(e){if(isNaN(p=+this._x.call(null,e))||isNaN(h=+this._y.call(null,e))||isNaN(d=+this._z.call(null,e)))return this;var t,n=this._root,r,o,i,a=this._x0,l=this._y0,s=this._z0,u=this._x1,f=this._y1,c=this._z1,p,h,d,m,v,g,S,_,x,w,b;if(!n)return this;if(n.length)for(;;){if((S=p>=(m=(a+u)/2))?a=m:u=m,(_=h>=(v=(l+f)/2))?l=v:f=v,(x=d>=(g=(s+c)/2))?s=g:c=g,t=n,!(n=n[w=x<<2|_<<1|S]))return this;if(!n.length)break;(t[w+1&7]||t[w+2&7]||t[w+3&7]||t[w+4&7]||t[w+5&7]||t[w+6&7]||t[w+7&7])&&(r=t,b=w)}for(;n.data!==e;)if(o=n,!(n=n.next))return this;return(i=n.next)&&delete n.next,o?(i?o.next=i:delete o.next,this):t?(i?t[w]=i:delete t[w],(n=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&n===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[b]=n:this._root=n),this):(this._root=i,this)}function vc(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function yc(){return this._root}function mc(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function bc(e){var t=[],n,r=this._root,o,i,a,l,s,u,f;for(r&&t.push(new me(r,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();)if(!e(r=n.node,i=n.x0,a=n.y0,l=n.z0,s=n.x1,u=n.y1,f=n.z1)&&r.length){var c=(i+s)/2,p=(a+u)/2,h=(l+f)/2;(o=r[7])&&t.push(new me(o,c,p,h,s,u,f)),(o=r[6])&&t.push(new me(o,i,p,h,c,u,f)),(o=r[5])&&t.push(new me(o,c,a,h,s,p,f)),(o=r[4])&&t.push(new me(o,i,a,h,c,p,f)),(o=r[3])&&t.push(new me(o,c,p,l,s,u,h)),(o=r[2])&&t.push(new me(o,i,p,l,c,u,h)),(o=r[1])&&t.push(new me(o,c,a,l,s,p,h)),(o=r[0])&&t.push(new me(o,i,a,l,c,p,h))}return this}function _c(e){var t=[],n=[],r;for(this._root&&t.push(new me(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=t.pop();){var o=r.node;if(o.length){var i,a=r.x0,l=r.y0,s=r.z0,u=r.x1,f=r.y1,c=r.z1,p=(a+u)/2,h=(l+f)/2,d=(s+c)/2;(i=o[0])&&t.push(new me(i,a,l,s,p,h,d)),(i=o[1])&&t.push(new me(i,p,l,s,u,h,d)),(i=o[2])&&t.push(new me(i,a,h,s,p,f,d)),(i=o[3])&&t.push(new me(i,p,h,s,u,f,d)),(i=o[4])&&t.push(new me(i,a,l,d,p,h,c)),(i=o[5])&&t.push(new me(i,p,l,d,u,h,c)),(i=o[6])&&t.push(new me(i,a,h,d,p,f,c)),(i=o[7])&&t.push(new me(i,p,h,d,u,f,c))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.z0,r.x1,r.y1,r.z1);return this}function xc(e){return e[0]}function wc(e){return arguments.length?(this._x=e,this):this._x}function kc(e){return e[1]}function Cc(e){return arguments.length?(this._y=e,this):this._y}function Sc(e){return e[2]}function Mc(e){return arguments.length?(this._z=e,this):this._z}function uo(e,t,n,r){var o=new fo(t??xc,n??kc,r??Sc,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function fo(e,t,n,r,o,i,a,l,s){this._x=e,this._y=t,this._z=n,this._x0=r,this._y0=o,this._z0=i,this._x1=a,this._y1=l,this._z1=s,this._root=void 0}function ci(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Ee=uo.prototype=fo.prototype;Ee.copy=function(){var e=new fo(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=ci(t),e;for(n=[{source:t,target:e._root=new Array(8)}];t=n.pop();)for(var o=0;o<8;++o)(r=t.source[o])&&(r.length?n.push({source:r,target:t.target[o]=new Array(8)}):t.target[o]=ci(r));return e};Ee.add=sc;Ee.addAll=lc;Ee.cover=cc;Ee.data=uc;Ee.extent=fc;Ee.find=dc;Ee.findAllWithinRadius=pc;Ee.remove=gc;Ee.removeAll=vc;Ee.root=yc;Ee.size=mc;Ee.visit=bc;Ee.visitAfter=_c;Ee.x=wc;Ee.y=Cc;Ee.z=Mc;function Oe(e){return function(){return e}}function nt(e){return(e()-.5)*1e-6}function _r(e){return e.x+e.vx}function ui(e){return e.y+e.vy}function Pc(e){return e.z+e.vz}function fi(e){var t,n,r,o,i=1,a=1;typeof e!="function"&&(e=Oe(e==null?1:+e));function l(){for(var f,c=t.length,p,h,d,m,v,g,S,_=0;_<a;++_)for(p=(n===1?ao(t,_r):n===2?lo(t,_r,ui):n===3?uo(t,_r,ui,Pc):null).visitAfter(s),f=0;f<c;++f)h=t[f],g=r[h.index],S=g*g,d=h.x+h.vx,n>1&&(m=h.y+h.vy),n>2&&(v=h.z+h.vz),p.visit(x);function x(w,b,M,P,N,j,F){var I=[b,M,P,N,j,F],K=I[0],O=I[1],y=I[2],k=I[n],C=I[n+1],$=I[n+2],B=w.data,X=w.r,L=g+X;if(B){if(B.index>h.index){var D=d-B.x-B.vx,q=n>1?m-B.y-B.vy:0,Y=n>2?v-B.z-B.vz:0,E=D*D+q*q+Y*Y;E<L*L&&(D===0&&(D=nt(o),E+=D*D),n>1&&q===0&&(q=nt(o),E+=q*q),n>2&&Y===0&&(Y=nt(o),E+=Y*Y),E=(L-(E=Math.sqrt(E)))/E*i,h.vx+=(D*=E)*(L=(X*=X)/(S+X)),n>1&&(h.vy+=(q*=E)*L),n>2&&(h.vz+=(Y*=E)*L),B.vx-=D*(L=1-L),n>1&&(B.vy-=q*L),n>2&&(B.vz-=Y*L))}return}return K>d+L||k<d-L||n>1&&(O>m+L||C<m-L)||n>2&&(y>v+L||$<v-L)}}function s(f){if(f.data)return f.r=r[f.data.index];for(var c=f.r=0;c<Math.pow(2,n);++c)f[c]&&f[c].r>f.r&&(f.r=f[c].r)}function u(){if(t){var f,c=t.length,p;for(r=new Array(c),f=0;f<c;++f)p=t[f],r[p.index]=+e(p,f,t)}}return l.initialize=function(f,...c){t=f,o=c.find(p=>typeof p=="function")||Math.random,n=c.find(p=>[1,2,3].includes(p))||2,u()},l.iterations=function(f){return arguments.length?(a=+f,l):a},l.strength=function(f){return arguments.length?(i=+f,l):i},l.radius=function(f){return arguments.length?(e=typeof f=="function"?f:Oe(+f),u(),l):e},l}function Ac(e){return e.index}function di(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}function Oc(e){var t=Ac,n=p,r,o=Oe(30),i,a,l,s,u,f,c=1;e==null&&(e=[]);function p(g){return 1/Math.min(s[g.source.index],s[g.target.index])}function h(g){for(var S=0,_=e.length;S<c;++S)for(var x=0,w,b,M,P=0,N=0,j=0,F,I;x<_;++x)w=e[x],b=w.source,M=w.target,P=M.x+M.vx-b.x-b.vx||nt(f),l>1&&(N=M.y+M.vy-b.y-b.vy||nt(f)),l>2&&(j=M.z+M.vz-b.z-b.vz||nt(f)),F=Math.sqrt(P*P+N*N+j*j),F=(F-i[x])/F*g*r[x],P*=F,N*=F,j*=F,M.vx-=P*(I=u[x]),l>1&&(M.vy-=N*I),l>2&&(M.vz-=j*I),b.vx+=P*(I=1-I),l>1&&(b.vy+=N*I),l>2&&(b.vz+=j*I)}function d(){if(a){var g,S=a.length,_=e.length,x=new Map(a.map((b,M)=>[t(b,M,a),b])),w;for(g=0,s=new Array(S);g<_;++g)w=e[g],w.index=g,typeof w.source!="object"&&(w.source=di(x,w.source)),typeof w.target!="object"&&(w.target=di(x,w.target)),s[w.source.index]=(s[w.source.index]||0)+1,s[w.target.index]=(s[w.target.index]||0)+1;for(g=0,u=new Array(_);g<_;++g)w=e[g],u[g]=s[w.source.index]/(s[w.source.index]+s[w.target.index]);r=new Array(_),m(),i=new Array(_),v()}}function m(){if(a)for(var g=0,S=e.length;g<S;++g)r[g]=+n(e[g],g,e)}function v(){if(a)for(var g=0,S=e.length;g<S;++g)i[g]=+o(e[g],g,e)}return h.initialize=function(g,...S){a=g,f=S.find(_=>typeof _=="function")||Math.random,l=S.find(_=>[1,2,3].includes(_))||2,d()},h.links=function(g){return arguments.length?(e=g,d(),h):e},h.id=function(g){return arguments.length?(t=g,h):t},h.iterations=function(g){return arguments.length?(c=+g,h):c},h.strength=function(g){return arguments.length?(n=typeof g=="function"?g:Oe(+g),m(),h):n},h.distance=function(g){return arguments.length?(o=typeof g=="function"?g:Oe(+g),v(),h):o},h}var jc={value:()=>{}};function ma(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Un(n)}function Un(e){this._=e}function zc(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Un.prototype=ma.prototype={constructor:Un,on:function(e,t){var n=this._,r=zc(e+"",n),o,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((o=(e=r[i]).type)&&(o=Tc(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<a;)if(o=(e=r[i]).type)n[o]=hi(n[o],e.name,t);else if(t==null)for(o in n)n[o]=hi(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Un(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function Tc(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function hi(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=jc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Jt=0,mn=0,un=0,ba=1e3,Wn,bn,Yn=0,$t=0,ir=0,Sn=typeof performance=="object"&&performance.now?performance:Date,_a=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function xa(){return $t||(_a(Ec),$t=Sn.now()+ir)}function Ec(){$t=0}function Fr(){this._call=this._time=this._next=null}Fr.prototype=wa.prototype={constructor:Fr,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?xa():+n)+(t==null?0:+t),!this._next&&bn!==this&&(bn?bn._next=this:Wn=this,bn=this),this._call=e,this._time=n,Br()},stop:function(){this._call&&(this._call=null,this._time=1/0,Br())}};function wa(e,t,n){var r=new Fr;return r.restart(e,t,n),r}function Lc(){xa(),++Jt;for(var e=Wn,t;e;)(t=$t-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Jt}function pi(){$t=(Yn=Sn.now())+ir,Jt=mn=0;try{Lc()}finally{Jt=0,Rc(),$t=0}}function Nc(){var e=Sn.now(),t=e-Yn;t>ba&&(ir-=t,Yn=e)}function Rc(){for(var e,t=Wn,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:Wn=n);bn=e,Br(r)}function Br(e){if(!Jt){mn&&(mn=clearTimeout(mn));var t=e-$t;t>24?(e<1/0&&(mn=setTimeout(pi,e-Sn.now()-ir)),un&&(un=clearInterval(un))):(un||(Yn=Sn.now(),un=setInterval(Nc,ba)),Jt=1,_a(pi))}}const Dc=1664525,Ic=1013904223,gi=4294967296;function Fc(){let e=1;return()=>(e=(Dc*e+Ic)%gi)/gi}var vi=3;function xr(e){return e.x}function yi(e){return e.y}function Bc(e){return e.z}var $c=10,Hc=Math.PI*(3-Math.sqrt(5)),qc=Math.PI*20/(9+Math.sqrt(221));function Uc(e,t){t=t||2;var n=Math.min(vi,Math.max(1,Math.round(t))),r,o=1,i=.001,a=1-Math.pow(i,1/300),l=0,s=.6,u=new Map,f=wa(h),c=ma("tick","end"),p=Fc();e==null&&(e=[]);function h(){d(),c.call("tick",r),o<i&&(f.stop(),c.call("end",r))}function d(g){var S,_=e.length,x;g===void 0&&(g=1);for(var w=0;w<g;++w)for(o+=(l-o)*a,u.forEach(function(b){b(o)}),S=0;S<_;++S)x=e[S],x.fx==null?x.x+=x.vx*=s:(x.x=x.fx,x.vx=0),n>1&&(x.fy==null?x.y+=x.vy*=s:(x.y=x.fy,x.vy=0)),n>2&&(x.fz==null?x.z+=x.vz*=s:(x.z=x.fz,x.vz=0));return r}function m(){for(var g=0,S=e.length,_;g<S;++g){if(_=e[g],_.index=g,_.fx!=null&&(_.x=_.fx),_.fy!=null&&(_.y=_.fy),_.fz!=null&&(_.z=_.fz),isNaN(_.x)||n>1&&isNaN(_.y)||n>2&&isNaN(_.z)){var x=$c*(n>2?Math.cbrt(.5+g):n>1?Math.sqrt(.5+g):g),w=g*Hc,b=g*qc;n===1?_.x=x:n===2?(_.x=x*Math.cos(w),_.y=x*Math.sin(w)):(_.x=x*Math.sin(w)*Math.cos(b),_.y=x*Math.cos(w),_.z=x*Math.sin(w)*Math.sin(b))}(isNaN(_.vx)||n>1&&isNaN(_.vy)||n>2&&isNaN(_.vz))&&(_.vx=0,n>1&&(_.vy=0),n>2&&(_.vz=0))}}function v(g){return g.initialize&&g.initialize(e,p,n),g}return m(),r={tick:d,restart:function(){return f.restart(h),r},stop:function(){return f.stop(),r},numDimensions:function(g){return arguments.length?(n=Math.min(vi,Math.max(1,Math.round(g))),u.forEach(v),r):n},nodes:function(g){return arguments.length?(e=g,m(),u.forEach(v),r):e},alpha:function(g){return arguments.length?(o=+g,r):o},alphaMin:function(g){return arguments.length?(i=+g,r):i},alphaDecay:function(g){return arguments.length?(a=+g,r):+a},alphaTarget:function(g){return arguments.length?(l=+g,r):l},velocityDecay:function(g){return arguments.length?(s=1-g,r):1-s},randomSource:function(g){return arguments.length?(p=g,u.forEach(v),r):p},force:function(g,S){return arguments.length>1?(S==null?u.delete(g):u.set(g,v(S)),r):u.get(g)},find:function(){var g=Array.prototype.slice.call(arguments),S=g.shift()||0,_=(n>1?g.shift():null)||0,x=(n>2?g.shift():null)||0,w=g.shift()||1/0,b=0,M=e.length,P,N,j,F,I,K;for(w*=w,b=0;b<M;++b)I=e[b],P=S-I.x,N=_-(I.y||0),j=x-(I.z||0),F=P*P+N*N+j*j,F<w&&(K=I,w=F);return K},on:function(g,S){return arguments.length>1?(c.on(g,S),r):c.on(g)}}}function Gc(){var e,t,n,r,o,i=Oe(-30),a,l=1,s=1/0,u=.81;function f(d){var m,v=e.length,g=(t===1?ao(e,xr):t===2?lo(e,xr,yi):t===3?uo(e,xr,yi,Bc):null).visitAfter(p);for(o=d,m=0;m<v;++m)n=e[m],g.visit(h)}function c(){if(e){var d,m=e.length,v;for(a=new Array(m),d=0;d<m;++d)v=e[d],a[v.index]=+i(v,d,e)}}function p(d){var m=0,v,g,S=0,_,x,w,b,M=d.length;if(M){for(_=x=w=b=0;b<M;++b)(v=d[b])&&(g=Math.abs(v.value))&&(m+=v.value,S+=g,_+=g*(v.x||0),x+=g*(v.y||0),w+=g*(v.z||0));m*=Math.sqrt(4/M),d.x=_/S,t>1&&(d.y=x/S),t>2&&(d.z=w/S)}else{v=d,v.x=v.data.x,t>1&&(v.y=v.data.y),t>2&&(v.z=v.data.z);do m+=a[v.data.index];while(v=v.next)}d.value=m}function h(d,m,v,g,S){if(!d.value)return!0;var _=[v,g,S][t-1],x=d.x-n.x,w=t>1?d.y-n.y:0,b=t>2?d.z-n.z:0,M=_-m,P=x*x+w*w+b*b;if(M*M/u<P)return P<s&&(x===0&&(x=nt(r),P+=x*x),t>1&&w===0&&(w=nt(r),P+=w*w),t>2&&b===0&&(b=nt(r),P+=b*b),P<l&&(P=Math.sqrt(l*P)),n.vx+=x*d.value*o/P,t>1&&(n.vy+=w*d.value*o/P),t>2&&(n.vz+=b*d.value*o/P)),!0;if(d.length||P>=s)return;(d.data!==n||d.next)&&(x===0&&(x=nt(r),P+=x*x),t>1&&w===0&&(w=nt(r),P+=w*w),t>2&&b===0&&(b=nt(r),P+=b*b),P<l&&(P=Math.sqrt(l*P)));do d.data!==n&&(M=a[d.data.index]*o/P,n.vx+=x*M,t>1&&(n.vy+=w*M),t>2&&(n.vz+=b*M));while(d=d.next)}return f.initialize=function(d,...m){e=d,r=m.find(v=>typeof v=="function")||Math.random,t=m.find(v=>[1,2,3].includes(v))||2,c()},f.strength=function(d){return arguments.length?(i=typeof d=="function"?d:Oe(+d),c(),f):i},f.distanceMin=function(d){return arguments.length?(l=d*d,f):Math.sqrt(l)},f.distanceMax=function(d){return arguments.length?(s=d*d,f):Math.sqrt(s)},f.theta=function(d){return arguments.length?(u=d*d,f):Math.sqrt(u)},f}function Vc(e,t,n,r){var o,i,a=Oe(.1),l,s;typeof e!="function"&&(e=Oe(+e)),t==null&&(t=0),n==null&&(n=0),r==null&&(r=0);function u(c){for(var p=0,h=o.length;p<h;++p){var d=o[p],m=d.x-t||1e-6,v=(d.y||0)-n||1e-6,g=(d.z||0)-r||1e-6,S=Math.sqrt(m*m+v*v+g*g),_=(s[p]-S)*l[p]*c/S;d.vx+=m*_,i>1&&(d.vy+=v*_),i>2&&(d.vz+=g*_)}}function f(){if(o){var c,p=o.length;for(l=new Array(p),s=new Array(p),c=0;c<p;++c)s[c]=+e(o[c],c,o),l[c]=isNaN(s[c])?0:+a(o[c],c,o)}}return u.initialize=function(c,...p){o=c,i=p.find(h=>[1,2,3].includes(h))||2,f()},u.strength=function(c){return arguments.length?(a=typeof c=="function"?c:Oe(+c),f(),u):a},u.radius=function(c){return arguments.length?(e=typeof c=="function"?c:Oe(+c),f(),u):e},u.x=function(c){return arguments.length?(t=+c,u):t},u.y=function(c){return arguments.length?(n=+c,u):n},u.z=function(c){return arguments.length?(r=+c,u):r},u}function mi(e){var t=Oe(.1),n,r,o;typeof e!="function"&&(e=Oe(e==null?0:+e));function i(l){for(var s=0,u=n.length,f;s<u;++s)f=n[s],f.vx+=(o[s]-f.x)*r[s]*l}function a(){if(n){var l,s=n.length;for(r=new Array(s),o=new Array(s),l=0;l<s;++l)r[l]=isNaN(o[l]=+e(n[l],l,n))?0:+t(n[l],l,n)}}return i.initialize=function(l){n=l,a()},i.strength=function(l){return arguments.length?(t=typeof l=="function"?l:Oe(+l),a(),i):t},i.x=function(l){return arguments.length?(e=typeof l=="function"?l:Oe(+l),a(),i):e},i}function bi(e){var t=Oe(.1),n,r,o;typeof e!="function"&&(e=Oe(e==null?0:+e));function i(l){for(var s=0,u=n.length,f;s<u;++s)f=n[s],f.vy+=(o[s]-f.y)*r[s]*l}function a(){if(n){var l,s=n.length;for(r=new Array(s),o=new Array(s),l=0;l<s;++l)r[l]=isNaN(o[l]=+e(n[l],l,n))?0:+t(n[l],l,n)}}return i.initialize=function(l){n=l,a()},i.strength=function(l){return arguments.length?(t=typeof l=="function"?l:Oe(+l),a(),i):t},i.y=function(l){return arguments.length?(e=typeof l=="function"?l:Oe(+l),a(),i):e},i}function ka(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Wc(e){Xc(e);const t=Yc(e);return e.on=t.on,e.off=t.off,e.fire=t.fire,e}function Yc(e){let t=Object.create(null);return{on:function(n,r,o){if(typeof r!="function")throw new Error("callback is expected to be a function");let i=t[n];return i||(i=t[n]=[]),i.push({callback:r,ctx:o}),e},off:function(n,r){if(typeof n>"u")return t=Object.create(null),e;if(t[n])if(typeof r!="function")delete t[n];else{const o=t[n];for(let i=0;i<o.length;++i)o[i].callback===r&&o.splice(i,1)}return e},fire:function(n){const r=t[n];if(!r)return e;let o;arguments.length>1&&(o=Array.prototype.slice.call(arguments,1));for(let i=0;i<r.length;++i){const a=r[i];a.callback.apply(a.ctx,o)}return e}}}function Xc(e){if(!e)throw new Error("Eventify cannot use falsy object as events subject");const t=["on","fire","off"];for(let n=0;n<t.length;++n)if(e.hasOwnProperty(t[n]))throw new Error("Subject cannot be eventified, since it already has property '"+t[n]+"'")}var ho=Wc;const Kc=ka(ho);function Zc(e){if(e=e||{},"uniqueLinkId"in e&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
2
2
  `,`Note: there is also change in default behavior: From now on each graph
3
- is considered to be not a multigraph by default (each edge is unique).`),e.multigraph=e.uniqueLinkId),e.multigraph===void 0&&(e.multigraph=!1),typeof Map!="function")throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var t=new Map,n=new Map,r={},i=0,o=e.multigraph?x:m,a=[],s=U,l=U,c=U,f=U,u={version:20,addNode:v,addLink:b,removeLink:C,removeNode:d,getNode:y,getNodeCount:w,getLinkCount:_,getEdgeCount:_,getLinksCount:_,getNodesCount:w,getLinks:k,forEachNode:se,forEachLinkedNode:S,forEachLink:B,beginUpdate:c,endUpdate:f,clear:E,hasLink:M,hasNode:y,getLink:M,getLinkById:N};return Ac(u),g(),u;function g(){var D=u.on;u.on=$;function $(){return u.beginUpdate=c=ne,u.endUpdate=f=J,s=h,l=p,u.on=D,D.apply(u,arguments)}}function h(D,$){a.push({link:D,changeType:$})}function p(D,$){a.push({node:D,changeType:$})}function v(D,$){if(D===void 0)throw new Error("Invalid node identifier");c();var G=y(D);return G?(G.data=$,l(G,"update")):(G=new Tc(D,$),l(G,"add")),t.set(D,G),f(),G}function y(D){return t.get(D)}function d(D){var $=y(D);if(!$)return!1;c();var G=$.links;return G&&(G.forEach(P),$.links=null),t.delete(D),l($,"remove"),f(),!0}function b(D,$,G){c();var Z=y(D)||v(D),I=y($)||v($),H=o(D,$,G),z=n.has(H.id);return n.set(H.id,H),ro(Z,H),D!==$&&ro(I,H),s(H,z?"update":"add"),f(),H}function m(D,$,G){var Z=xn(D,$),I=n.get(Z);return I?(I.data=G,I):new io(D,$,G,Z)}function x(D,$,G){var Z=xn(D,$),I=r.hasOwnProperty(Z);if(I||M(D,$)){I||(r[Z]=0);var H="@"+ ++r[Z];Z=xn(D+H,$+H)}return new io(D,$,G,Z)}function w(){return t.size}function _(){return n.size}function k(D){var $=y(D);return $?$.links:null}function C(D,$){return $!==void 0&&(D=M(D,$)),P(D)}function P(D){if(!D||!n.get(D.id))return!1;c(),n.delete(D.id);var $=y(D.fromId),G=y(D.toId);return $&&$.links.delete(D),G&&G.links.delete(D),s(D,"remove"),f(),!0}function M(D,$){if(!(D===void 0||$===void 0))return n.get(xn(D,$))}function N(D){if(D!==void 0)return n.get(D)}function E(){c(),se(function(D){d(D.id)}),f()}function B(D){if(typeof D=="function")for(var $=n.values(),G=$.next();!G.done;){if(D(G.value))return!0;G=$.next()}}function S(D,$,G){var Z=y(D);if(Z&&Z.links&&typeof $=="function")return G?L(Z.links,D,$):O(Z.links,D,$)}function O(D,$,G){for(var Z,I=D.values(),H=I.next();!H.done;){var z=H.value,F=z.fromId===$?z.toId:z.fromId;if(Z=G(t.get(F),z),Z)return!0;H=I.next()}}function L(D,$,G){for(var Z,I=D.values(),H=I.next();!H.done;){var z=H.value;if(z.fromId===$&&(Z=G(t.get(z.toId),z),Z))return!0;H=I.next()}}function U(){}function ne(){i+=1}function J(){i-=1,i===0&&a.length>0&&(u.fire("changed",a),a.length=0)}function se(D){if(typeof D!="function")throw new Error("Function is expected to iterate over graph nodes. You passed "+D);for(var $=t.values(),G=$.next();!G.done;){if(D(G.value))return!0;G=$.next()}}}function Tc(e,t){this.id=e,this.links=null,this.data=t}function ro(e,t){e.links?e.links.add(t):e.links=new Set([t])}function io(e,t,n,r){this.fromId=e,this.toId=t,this.data=n,this.id=r}function xn(e,t){return e.toString()+"👉 "+t.toString()}var Qr={exports:{}},cn={exports:{}},oa=function(t){return t===0?"x":t===1?"y":t===2?"z":"c"+(t+1)};const Ec=oa;var zt=function(t){return n;function n(r,i){let o=i&&i.indent||0,a=i&&i.join!==void 0?i.join:`
4
- `,s=Array(o+1).join(" "),l=[];for(let c=0;c<t;++c){let f=Ec(c),u=c===0?"":s;l.push(u+r.replace(/{var}/g,f))}return l.join(a)}};const aa=zt;cn.exports=Lc;cn.exports.generateCreateBodyFunctionBody=sa;cn.exports.getVectorCode=ca;cn.exports.getBodyCode=la;function Lc(e,t){let n=sa(e,t),{Body:r}=new Function(n)();return r}function sa(e,t){return`
5
- ${ca(e,t)}
6
- ${la(e)}
3
+ is considered to be not a multigraph by default (each edge is unique).`),e.multigraph=e.uniqueLinkId),e.multigraph===void 0&&(e.multigraph=!1),typeof Map!="function")throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var t=new Map,n=new Map,r={},o=0,i=e.multigraph?x:_,a=[],l=C,s=C,u=C,f=C,c={version:20,addNode:m,addLink:S,removeLink:P,removeNode:g,getNode:v,getNodeCount:w,getLinkCount:b,getEdgeCount:b,getLinksCount:b,getNodesCount:w,getLinks:M,forEachNode:X,forEachLinkedNode:O,forEachLink:K,beginUpdate:u,endUpdate:f,clear:I,hasLink:j,hasNode:v,getLink:j,getLinkById:F};return Kc(c),p(),c;function p(){var L=c.on;c.on=D;function D(){return c.beginUpdate=u=$,c.endUpdate=f=B,l=h,s=d,c.on=L,L.apply(c,arguments)}}function h(L,D){a.push({link:L,changeType:D})}function d(L,D){a.push({node:L,changeType:D})}function m(L,D){if(L===void 0)throw new Error("Invalid node identifier");u();var q=v(L);return q?(q.data=D,s(q,"update")):(q=new Qc(L,D),s(q,"add")),t.set(L,q),f(),q}function v(L){return t.get(L)}function g(L){var D=v(L);if(!D)return!1;u();var q=D.links;return q&&(q.forEach(N),D.links=null),t.delete(L),s(D,"remove"),f(),!0}function S(L,D,q){u();var Y=v(L)||m(L),E=v(D)||m(D),H=i(L,D,q),T=n.has(H.id);return n.set(H.id,H),_i(Y,H),L!==D&&_i(E,H),l(H,T?"update":"add"),f(),H}function _(L,D,q){var Y=Fn(L,D),E=n.get(Y);return E?(E.data=q,E):new xi(L,D,q,Y)}function x(L,D,q){var Y=Fn(L,D),E=r.hasOwnProperty(Y);if(E||j(L,D)){E||(r[Y]=0);var H="@"+ ++r[Y];Y=Fn(L+H,D+H)}return new xi(L,D,q,Y)}function w(){return t.size}function b(){return n.size}function M(L){var D=v(L);return D?D.links:null}function P(L,D){return D!==void 0&&(L=j(L,D)),N(L)}function N(L){if(!L||!n.get(L.id))return!1;u(),n.delete(L.id);var D=v(L.fromId),q=v(L.toId);return D&&D.links.delete(L),q&&q.links.delete(L),l(L,"remove"),f(),!0}function j(L,D){if(!(L===void 0||D===void 0))return n.get(Fn(L,D))}function F(L){if(L!==void 0)return n.get(L)}function I(){u(),X(function(L){g(L.id)}),f()}function K(L){if(typeof L=="function")for(var D=n.values(),q=D.next();!q.done;){if(L(q.value))return!0;q=D.next()}}function O(L,D,q){var Y=v(L);if(Y&&Y.links&&typeof D=="function")return q?k(Y.links,L,D):y(Y.links,L,D)}function y(L,D,q){for(var Y,E=L.values(),H=E.next();!H.done;){var T=H.value,W=T.fromId===D?T.toId:T.fromId;if(Y=q(t.get(W),T),Y)return!0;H=E.next()}}function k(L,D,q){for(var Y,E=L.values(),H=E.next();!H.done;){var T=H.value;if(T.fromId===D&&(Y=q(t.get(T.toId),T),Y))return!0;H=E.next()}}function C(){}function $(){o+=1}function B(){o-=1,o===0&&a.length>0&&(c.fire("changed",a),a.length=0)}function X(L){if(typeof L!="function")throw new Error("Function is expected to iterate over graph nodes. You passed "+L);for(var D=t.values(),q=D.next();!q.done;){if(L(q.value))return!0;q=D.next()}}}function Qc(e,t){this.id=e,this.links=null,this.data=t}function _i(e,t){e.links?e.links.add(t):e.links=new Set([t])}function xi(e,t,n,r){this.fromId=e,this.toId=t,this.data=n,this.id=r}function Fn(e,t){return e.toString()+"👉 "+t.toString()}var po={exports:{}},Pn={exports:{}},Ca=function(t){return t===0?"x":t===1?"y":t===2?"z":"c"+(t+1)};const Jc=Ca;var on=function(t){return n;function n(r,o){let i=o&&o.indent||0,a=o&&o.join!==void 0?o.join:`
4
+ `,l=Array(i+1).join(" "),s=[];for(let u=0;u<t;++u){let f=Jc(u),c=u===0?"":l;s.push(c+r.replace(/{var}/g,f))}return s.join(a)}};const Sa=on;Pn.exports=eu;Pn.exports.generateCreateBodyFunctionBody=Ma;Pn.exports.getVectorCode=Aa;Pn.exports.getBodyCode=Pa;function eu(e,t){let n=Ma(e,t),{Body:r}=new Function(n)();return r}function Ma(e,t){return`
5
+ ${Aa(e,t)}
6
+ ${Pa(e)}
7
7
  return {Body: Body, Vector: Vector};
8
- `}function la(e){let t=aa(e),n=t("{var}",{join:", "});return`
8
+ `}function Pa(e){let t=Sa(e),n=t("{var}",{join:", "});return`
9
9
  function Body(${n}) {
10
10
  this.isPinned = false;
11
11
  this.pos = new Vector(${n});
@@ -25,7 +25,7 @@ Body.prototype.reset = function() {
25
25
 
26
26
  Body.prototype.setPosition = function (${n}) {
27
27
  ${t("this.pos.{var} = {var} || 0;",{indent:2})}
28
- };`}function ca(e,t){let n=aa(e),r="";return t&&(r=`${n(`
28
+ };`}function Aa(e,t){let n=Sa(e),r="";return t&&(r=`${n(`
29
29
  var v{var};
30
30
  Object.defineProperty(this, '{var}', {
31
31
  set: function(v) {
@@ -47,12 +47,12 @@ Object.defineProperty(this, '{var}', {
47
47
 
48
48
  Vector.prototype.reset = function () {
49
49
  ${n("this.{var} = ",{join:""})}0;
50
- };`}var Nc=cn.exports,ft={exports:{}};const Zr=zt,st=oa;ft.exports=Rc;ft.exports.generateQuadTreeFunctionBody=ua;ft.exports.getInsertStackCode=ga;ft.exports.getQuadNodeCode=pa;ft.exports.isSamePosition=fa;ft.exports.getChildBodyCode=ha;ft.exports.setChildBodyCode=da;function Rc(e){let t=ua(e);return new Function(t)()}function ua(e){let t=Zr(e),n=Math.pow(2,e);return`
51
- ${ga()}
52
- ${pa(e)}
53
- ${fa(e)}
54
- ${ha(e)}
55
- ${da(e)}
50
+ };`}var tu=Pn.exports,Ot={exports:{}};const go=on,St=Ca;Ot.exports=nu;Ot.exports.generateQuadTreeFunctionBody=Oa;Ot.exports.getInsertStackCode=La;Ot.exports.getQuadNodeCode=Ea;Ot.exports.isSamePosition=ja;Ot.exports.getChildBodyCode=Ta;Ot.exports.setChildBodyCode=za;function nu(e){let t=Oa(e);return new Function(t)()}function Oa(e){let t=go(e),n=Math.pow(2,e);return`
51
+ ${La()}
52
+ ${Ea(e)}
53
+ ${ja(e)}
54
+ ${Ta(e)}
55
+ ${za(e)}
56
56
 
57
57
  function createQuadTree(options, random) {
58
58
  options = options || {};
@@ -167,7 +167,7 @@ ${a(" node.")}
167
167
  }
168
168
  // If s / r < θ, treat this internal node as a single body, and calculate the
169
169
  // force it exerts on sourceBody, and add this amount to sourceBody's net force.
170
- if ((node.max_${st(0)} - node.min_${st(0)}) / r < theta) {
170
+ if ((node.max_${St(0)} - node.min_${St(0)}) / r < theta) {
171
171
  // in the if statement above we consider node's width only
172
172
  // because the region was made into square during tree creation.
173
173
  // Thus there is no difference between using width or height.
@@ -177,7 +177,7 @@ ${a(" node.")}
177
177
  // Otherwise, run the procedure recursively on each of the current node's children.
178
178
 
179
179
  // I intentionally unfolded this loop, to save several CPU cycles.
180
- ${o()}
180
+ ${i()}
181
181
  }
182
182
  }
183
183
  }
@@ -236,7 +236,7 @@ ${o()}
236
236
  ${t("var min_{var} = node.min_{var};",{indent:8})}
237
237
  ${t("var max_{var} = (min_{var} + node.max_{var}) / 2;",{indent:8})}
238
238
 
239
- ${i(8)}
239
+ ${o(8)}
240
240
 
241
241
  var child = getChild(node, quadIdx);
242
242
 
@@ -290,24 +290,24 @@ ${i(8)}
290
290
  }
291
291
  return createQuadTree;
292
292
 
293
- `;function i(s){let l=[],c=Array(s+1).join(" ");for(let f=0;f<e;++f)l.push(c+`if (${st(f)} > max_${st(f)}) {`),l.push(c+` quadIdx = quadIdx + ${Math.pow(2,f)};`),l.push(c+` min_${st(f)} = max_${st(f)};`),l.push(c+` max_${st(f)} = node.max_${st(f)};`),l.push(c+"}");return l.join(`
294
- `)}function o(){let s=Array(11).join(" "),l=[];for(let c=0;c<n;++c)l.push(s+`if (node.quad${c}) {`),l.push(s+` queue[pushIdx] = node.quad${c};`),l.push(s+" queueLength += 1;"),l.push(s+" pushIdx += 1;"),l.push(s+"}");return l.join(`
295
- `)}function a(s){let l=[];for(let c=0;c<n;++c)l.push(`${s}quad${c} = null;`);return l.join(`
296
- `)}}function fa(e){let t=Zr(e);return`
293
+ `;function o(l){let s=[],u=Array(l+1).join(" ");for(let f=0;f<e;++f)s.push(u+`if (${St(f)} > max_${St(f)}) {`),s.push(u+` quadIdx = quadIdx + ${Math.pow(2,f)};`),s.push(u+` min_${St(f)} = max_${St(f)};`),s.push(u+` max_${St(f)} = node.max_${St(f)};`),s.push(u+"}");return s.join(`
294
+ `)}function i(){let l=Array(11).join(" "),s=[];for(let u=0;u<n;++u)s.push(l+`if (node.quad${u}) {`),s.push(l+` queue[pushIdx] = node.quad${u};`),s.push(l+" queueLength += 1;"),s.push(l+" pushIdx += 1;"),s.push(l+"}");return s.join(`
295
+ `)}function a(l){let s=[];for(let u=0;u<n;++u)s.push(`${l}quad${u} = null;`);return s.join(`
296
+ `)}}function ja(e){let t=go(e);return`
297
297
  function isSamePosition(point1, point2) {
298
298
  ${t("var d{var} = Math.abs(point1.{var} - point2.{var});",{indent:2})}
299
299
 
300
300
  return ${t("d{var} < 1e-8",{join:" && "})};
301
301
  }
302
- `}function da(e){var t=Math.pow(2,e);return`
302
+ `}function za(e){var t=Math.pow(2,e);return`
303
303
  function setChild(node, idx, child) {
304
304
  ${n()}
305
- }`;function n(){let r=[];for(let i=0;i<t;++i){let o=i===0?" ":" else ";r.push(`${o}if (idx === ${i}) node.quad${i} = child;`)}return r.join(`
306
- `)}}function ha(e){return`function getChild(node, idx) {
305
+ }`;function n(){let r=[];for(let o=0;o<t;++o){let i=o===0?" ":" else ";r.push(`${i}if (idx === ${o}) node.quad${o} = child;`)}return r.join(`
306
+ `)}}function Ta(e){return`function getChild(node, idx) {
307
307
  ${t()}
308
308
  return null;
309
- }`;function t(){let n=[],r=Math.pow(2,e);for(let i=0;i<r;++i)n.push(` if (idx === ${i}) return node.quad${i};`);return n.join(`
310
- `)}}function pa(e){let t=Zr(e),n=Math.pow(2,e);var r=`
309
+ }`;function t(){let n=[],r=Math.pow(2,e);for(let o=0;o<r;++o)n.push(` if (idx === ${o}) return node.quad${o};`);return n.join(`
310
+ `)}}function Ea(e){let t=go(e),n=Math.pow(2,e);var r=`
311
311
  function QuadNode() {
312
312
  // body stored inside this node. In quad tree only leaf nodes (by construction)
313
313
  // contain bodies:
@@ -317,7 +317,7 @@ function QuadNode() {
317
317
  // 0 | 1
318
318
  // -----
319
319
  // 2 | 3
320
- ${i(" this.")}
320
+ ${o(" this.")}
321
321
 
322
322
  // Total mass of current node
323
323
  this.mass = 0;
@@ -329,8 +329,8 @@ ${i(" this.")}
329
329
  ${t("this.min_{var} = 0;",{indent:2})}
330
330
  ${t("this.max_{var} = 0;",{indent:2})}
331
331
  }
332
- `;return r;function i(o){let a=[];for(let s=0;s<n;++s)a.push(`${o}quad${s} = null;`);return a.join(`
333
- `)}}function ga(){return`
332
+ `;return r;function o(i){let a=[];for(let l=0;l<n;++l)a.push(`${i}quad${l} = null;`);return a.join(`
333
+ `)}}function La(){return`
334
334
  /**
335
335
  * Our implementation of QuadTree is non-recursive to avoid GC hit
336
336
  * This data structure represent stack of elements
@@ -371,7 +371,7 @@ function InsertStackElement(node, body) {
371
371
  this.node = node; // QuadTree node
372
372
  this.body = body; // physical body which needs to be inserted to node
373
373
  }
374
- `}var Ic=ft.exports,Jr={exports:{}};Jr.exports=zc;Jr.exports.generateFunctionBody=va;const Dc=zt;function zc(e){let t=va(e);return new Function("bodies","settings","random",t)}function va(e){let t=Dc(e);return`
374
+ `}var ru=Ot.exports,vo={exports:{}};vo.exports=iu;vo.exports.generateFunctionBody=Na;const ou=on;function iu(e){let t=Na(e);return new Function("bodies","settings","random",t)}function Na(e){let t=ou(e);return`
375
375
  var boundingBox = {
376
376
  ${t("min_{var}: 0, max_{var}: 0,",{indent:4})}
377
377
  };
@@ -425,15 +425,15 @@ function InsertStackElement(node, body) {
425
425
  function resetBoundingBox() {
426
426
  ${t("boundingBox.min_{var} = boundingBox.max_{var} = 0;",{indent:4})}
427
427
  }
428
- `}var Fc=Jr.exports,ei={exports:{}};const Bc=zt;ei.exports=$c;ei.exports.generateCreateDragForceFunctionBody=ya;function $c(e){let t=ya(e);return new Function("options",t)}function ya(e){return`
428
+ `}var au=vo.exports,yo={exports:{}};const su=on;yo.exports=lu;yo.exports.generateCreateDragForceFunctionBody=Ra;function lu(e){let t=Ra(e);return new Function("options",t)}function Ra(e){return`
429
429
  if (!Number.isFinite(options.dragCoefficient)) throw new Error('dragCoefficient is not a finite number');
430
430
 
431
431
  return {
432
432
  update: function(body) {
433
- ${Bc(e)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}
433
+ ${su(e)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}
434
434
  }
435
435
  };
436
- `}var Hc=ei.exports,ti={exports:{}};const Uc=zt;ti.exports=qc;ti.exports.generateCreateSpringForceFunctionBody=ma;function qc(e){let t=ma(e);return new Function("options","random",t)}function ma(e){let t=Uc(e);return`
436
+ `}var cu=yo.exports,mo={exports:{}};const uu=on;mo.exports=fu;mo.exports.generateCreateSpringForceFunctionBody=Da;function fu(e){let t=Da(e);return new Function("options","random",t)}function Da(e){let t=uu(e);return`
437
437
  if (!Number.isFinite(options.springCoefficient)) throw new Error('Spring coefficient is not a number');
438
438
  if (!Number.isFinite(options.springLength)) throw new Error('Spring length is not a number');
439
439
 
@@ -465,7 +465,7 @@ function InsertStackElement(node, body) {
465
465
  body2.springLength += r;
466
466
  }
467
467
  };
468
- `}var Vc=ti.exports,ni={exports:{}};const Gc=zt;ni.exports=Wc;ni.exports.generateIntegratorFunctionBody=ba;function Wc(e){let t=ba(e);return new Function("bodies","timeStep","adaptiveTimeStepWeight",t)}function ba(e){let t=Gc(e);return`
468
+ `}var du=mo.exports,bo={exports:{}};const hu=on;bo.exports=pu;bo.exports.generateIntegratorFunctionBody=Ia;function pu(e){let t=Ia(e);return new Function("bodies","timeStep","adaptiveTimeStepWeight",t)}function Ia(e){let t=hu(e);return`
469
469
  var length = bodies.length;
470
470
  if (length === 0) return 0;
471
471
 
@@ -499,12 +499,12 @@ function InsertStackElement(node, body) {
499
499
  }
500
500
 
501
501
  return (${t("t{var} * t{var}",{join:" + "})})/length;
502
- `}var Xc=ni.exports,lr,oo;function Yc(){if(oo)return lr;oo=1,lr=e;function e(t,n,r,i){this.from=t,this.to=n,this.length=r,this.coefficient=i}return lr}var cr,ao;function Kc(){if(ao)return cr;ao=1,cr=e;function e(t,n){var r;if(t||(t={}),n){for(r in n)if(n.hasOwnProperty(r)){var i=t.hasOwnProperty(r),o=typeof n[r],a=!i||typeof t[r]!==o;a?t[r]=n[r]:o==="object"&&(t[r]=e(t[r],n[r]))}}return t}return cr}var Gt={exports:{}},so;function Qc(){if(so)return Gt.exports;so=1,Gt.exports=e,Gt.exports.random=e,Gt.exports.randomIterator=s;function e(l){var c=typeof l=="number"?l:+new Date;return new t(c)}function t(l){this.seed=l}t.prototype.next=a,t.prototype.nextDouble=o,t.prototype.uniform=o,t.prototype.gaussian=n,t.prototype.random=o;function n(){var l,c,f;do c=this.nextDouble()*2-1,f=this.nextDouble()*2-1,l=c*c+f*f;while(l>=1||l===0);return c*Math.sqrt(-2*Math.log(l)/l)}t.prototype.levy=r;function r(){var l=1.5,c=Math.pow(i(1+l)*Math.sin(Math.PI*l/2)/(i((1+l)/2)*l*Math.pow(2,(l-1)/2)),1/l);return this.gaussian()*c/Math.pow(Math.abs(this.gaussian()),1/l)}function i(l){return Math.sqrt(2*Math.PI/l)*Math.pow(1/Math.E*(l+1/(12*l-1/(10*l))),l)}function o(){var l=this.seed;return l=l+2127912214+(l<<12)&4294967295,l=(l^3345072700^l>>>19)&4294967295,l=l+374761393+(l<<5)&4294967295,l=(l+3550635116^l<<9)&4294967295,l=l+4251993797+(l<<3)&4294967295,l=(l^3042594569^l>>>16)&4294967295,this.seed=l,(l&268435455)/268435456}function a(l){return Math.floor(this.nextDouble()*l)}function s(l,c){var f=c||e();if(typeof f.next!="function")throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:g,shuffle:u};function u(){var h,p,v;for(h=l.length-1;h>0;--h)p=f.next(h+1),v=l[p],l[p]=l[h],l[h]=v;return l}function g(h){var p,v,y;for(p=l.length-1;p>0;--p)v=f.next(p+1),y=l[v],l[v]=l[p],l[p]=y,h(y);l.length&&h(l[0])}}return Gt.exports}var _a=iu,Zc=Nc,Jc=Ic,eu=Fc,tu=Hc,nu=Vc,ru=Xc,lo={};function iu(e){var t=Yc(),n=Kc(),r=Kr;if(e){if(e.springCoeff!==void 0)throw new Error("springCoeff was renamed to springCoefficient");if(e.dragCoeff!==void 0)throw new Error("dragCoeff was renamed to dragCoefficient")}e=n(e,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var i=lo[e.dimensions];if(!i){var o=e.dimensions;i={Body:Zc(o,e.debug),createQuadTree:Jc(o),createBounds:eu(o),createDragForce:tu(o),createSpringForce:nu(o),integrate:ru(o)},lo[o]=i}var a=i.Body,s=i.createQuadTree,l=i.createBounds,c=i.createDragForce,f=i.createSpringForce,u=i.integrate,g=O=>new a(O),h=Qc().random(42),p=[],v=[],y=s(e,h),d=l(p,e,h),b=f(e,h),m=c(e),x=0,w=[],_=new Map,k=0;M("nbody",B),M("spring",S);var C={bodies:p,quadTree:y,springs:v,settings:e,addForce:M,removeForce:N,getForces:E,step:function(){for(var O=0;O<w.length;++O)w[O](k);var L=u(p,e.timeStep,e.adaptiveTimeStepWeight);return k+=1,L},addBody:function(O){if(!O)throw new Error("Body is required");return p.push(O),O},addBodyAt:function(O){if(!O)throw new Error("Body position is required");var L=g(O);return p.push(L),L},removeBody:function(O){if(O){var L=p.indexOf(O);if(!(L<0))return p.splice(L,1),p.length===0&&d.reset(),!0}},addSpring:function(O,L,U,ne){if(!O||!L)throw new Error("Cannot add null spring to force simulator");typeof U!="number"&&(U=-1);var J=new t(O,L,U,ne>=0?ne:-1);return v.push(J),J},getTotalMovement:function(){return x},removeSpring:function(O){if(O){var L=v.indexOf(O);if(L>-1)return v.splice(L,1),!0}},getBestNewBodyPosition:function(O){return d.getBestNewPosition(O)},getBBox:P,getBoundingBox:P,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(O){return O!==void 0?(e.gravity=O,y.options({gravity:O}),this):e.gravity},theta:function(O){return O!==void 0?(e.theta=O,y.options({theta:O}),this):e.theta},random:h};return ou(e,C),r(C),C;function P(){return d.update(),d.box}function M(O,L){if(_.has(O))throw new Error("Force "+O+" is already added");_.set(O,L),w.push(L)}function N(O){var L=w.indexOf(_.get(O));L<0||(w.splice(L,1),_.delete(O))}function E(){return _}function B(){if(p.length!==0){y.insertBodies(p);for(var O=p.length;O--;){var L=p[O];L.isPinned||(L.reset(),y.updateBodyForce(L),m.update(L))}}}function S(){for(var O=v.length;O--;)b.update(v[O])}}function ou(e,t){for(var n in e)au(e,t,n)}function au(e,t,n){if(e.hasOwnProperty(n)&&typeof t[n]!="function"){var r=Number.isFinite(e[n]);r?t[n]=function(i){if(i!==void 0){if(!Number.isFinite(i))throw new Error("Value of "+n+" should be a valid number.");return e[n]=i,t}return e[n]}:t[n]=function(i){return i!==void 0?(e[n]=i,t):e[n]}}}Qr.exports=lu;Qr.exports.simulator=_a;var su=Kr;function lu(e,t){if(!e)throw new Error("Graph structure cannot be undefined");var n=t&&t.createSimulator||_a,r=n(t);if(Array.isArray(t))throw new Error("Physics settings is expected to be an object");var i=e.version>19?B:E;t&&typeof t.nodeMass=="function"&&(i=t.nodeMass);var o=new Map,a={},s=0,l=r.settings.springTransform||cu;m(),y();var c=!1,f={step:function(){if(s===0)return u(!0),!0;var S=r.step();f.lastMove=S,f.fire("step");var O=S/s,L=O<=.01;return u(L),L},getNodePosition:function(S){return N(S).pos},setNodePosition:function(S){var O=N(S);O.setPosition.apply(O,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(S){var O=a[S];if(O)return{from:O.from.pos,to:O.to.pos}},getGraphRect:function(){return r.getBBox()},forEachBody:g,pinNode:function(S,O){var L=N(S.id);L.isPinned=!!O},isNodePinned:function(S){return N(S.id).isPinned},dispose:function(){e.off("changed",b),f.fire("disposed")},getBody:v,getSpring:p,getForceVectorLength:h,simulator:r,graph:e,lastMove:0};return su(f),f;function u(S){c!==S&&(c=S,d(S))}function g(S){o.forEach(S)}function h(){var S=0,O=0;return g(function(L){S+=Math.abs(L.force.x),O+=Math.abs(L.force.y)}),Math.sqrt(S*S+O*O)}function p(S,O){var L;if(O===void 0)typeof S!="object"?L=S:L=S.id;else{var U=e.hasLink(S,O);if(!U)return;L=U.id}return a[L]}function v(S){return o.get(S)}function y(){e.on("changed",b)}function d(S){f.fire("stable",S)}function b(S){for(var O=0;O<S.length;++O){var L=S[O];L.changeType==="add"?(L.node&&x(L.node.id),L.link&&_(L.link)):L.changeType==="remove"&&(L.node&&w(L.node),L.link&&k(L.link))}s=e.getNodesCount()}function m(){s=0,e.forEachNode(function(S){x(S.id),s+=1}),e.forEachLink(_)}function x(S){var O=o.get(S);if(!O){var L=e.getNode(S);if(!L)throw new Error("initBody() was called with unknown node id");var U=L.position;if(!U){var ne=C(L);U=r.getBestNewBodyPosition(ne)}O=r.addBodyAt(U),O.id=S,o.set(S,O),P(S),M(L)&&(O.isPinned=!0)}}function w(S){var O=S.id,L=o.get(O);L&&(o.delete(O),r.removeBody(L))}function _(S){P(S.fromId),P(S.toId);var O=o.get(S.fromId),L=o.get(S.toId),U=r.addSpring(O,L,S.length);l(S,U),a[S.id]=U}function k(S){var O=a[S.id];if(O){var L=e.getNode(S.fromId),U=e.getNode(S.toId);L&&P(L.id),U&&P(U.id),delete a[S.id],r.removeSpring(O)}}function C(S){var O=[];if(!S.links)return O;for(var L=Math.min(S.links.length,2),U=0;U<L;++U){var ne=S.links[U],J=ne.fromId!==S.id?o.get(ne.fromId):o.get(ne.toId);J&&J.pos&&O.push(J)}return O}function P(S){var O=o.get(S);if(O.mass=i(S),Number.isNaN(O.mass))throw new Error("Node mass should be a number")}function M(S){return S&&(S.isPinned||S.data&&S.data.isPinned)}function N(S){var O=o.get(S);return O||(x(S),O=o.get(S)),O}function E(S){var O=e.getLinks(S);return O?1+O.length/3:1}function B(S){var O=e.getLinks(S);return O?1+O.size/3:1}}function cu(){}var uu=Qr.exports;const fu=ia(uu);function Sr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var du=typeof global=="object"&&global&&global.Object===Object&&global,hu=typeof self=="object"&&self&&self.Object===Object&&self,xa=du||hu||Function("return this")(),ur=function(){return xa.Date.now()},pu=/\s/;function gu(e){for(var t=e.length;t--&&pu.test(e.charAt(t)););return t}var vu=/^\s+/;function yu(e){return e&&e.slice(0,gu(e)+1).replace(vu,"")}var Tn=xa.Symbol,wa=Object.prototype,mu=wa.hasOwnProperty,bu=wa.toString,Wt=Tn?Tn.toStringTag:void 0;function _u(e){var t=mu.call(e,Wt),n=e[Wt];try{e[Wt]=void 0;var r=!0}catch{}var i=bu.call(e);return r&&(t?e[Wt]=n:delete e[Wt]),i}var xu=Object.prototype,wu=xu.toString;function ku(e){return wu.call(e)}var Cu="[object Null]",Su="[object Undefined]",co=Tn?Tn.toStringTag:void 0;function Mu(e){return e==null?e===void 0?Su:Cu:co&&co in Object(e)?_u(e):ku(e)}function Pu(e){return e!=null&&typeof e=="object"}var Ou="[object Symbol]";function Au(e){return typeof e=="symbol"||Pu(e)&&Mu(e)==Ou}var uo=NaN,ju=/^[-+]0x[0-9a-f]+$/i,Tu=/^0b[01]+$/i,Eu=/^0o[0-7]+$/i,Lu=parseInt;function fo(e){if(typeof e=="number")return e;if(Au(e))return uo;if(Sr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Sr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=yu(e);var n=Tu.test(e);return n||Eu.test(e)?Lu(e.slice(2),n?2:8):ju.test(e)?uo:+e}var Nu="Expected a function",Ru=Math.max,Iu=Math.min;function Du(e,t,n){var r,i,o,a,s,l,c=0,f=!1,u=!1,g=!0;if(typeof e!="function")throw new TypeError(Nu);t=fo(t)||0,Sr(n)&&(f=!!n.leading,u="maxWait"in n,o=u?Ru(fo(n.maxWait)||0,t):o,g="trailing"in n?!!n.trailing:g);function h(_){var k=r,C=i;return r=i=void 0,c=_,a=e.apply(C,k),a}function p(_){return c=_,s=setTimeout(d,t),f?h(_):a}function v(_){var k=_-l,C=_-c,P=t-k;return u?Iu(P,o-C):P}function y(_){var k=_-l,C=_-c;return l===void 0||k>=t||k<0||u&&C>=o}function d(){var _=ur();if(y(_))return b(_);s=setTimeout(d,v(_))}function b(_){return s=void 0,g&&r?h(_):(r=i=void 0,a)}function m(){s!==void 0&&clearTimeout(s),c=0,r=l=i=s=void 0}function x(){return s===void 0?a:b(ur())}function w(){var _=ur(),k=y(_);if(r=arguments,i=this,l=_,k){if(s===void 0)return p(l);if(u)return clearTimeout(s),s=setTimeout(d,t),h(l)}return s===void 0&&(s=setTimeout(d,t)),a}return w.cancel=m,w.flush=x,w}function ho(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zu(e){if(Array.isArray(e))return e}function Fu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bu(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}function $u(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}function Hu(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
503
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uu(e,t){return zu(e)||$u(e,t)||qu(e,t)||Hu()}function qu(e,t){if(e){if(typeof e=="string")return ho(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ho(e,t):void 0}}var Vu=Bu(function e(t,n){var r=n.default,i=r===void 0?null:r,o=n.triggerUpdate,a=o===void 0?!0:o,s=n.onChange,l=s===void 0?function(c,f){}:s;Fu(this,e),this.name=t,this.defaultVal=i,this.triggerUpdate=a,this.onChange=l});function ri(e){var t=e.stateInit,n=t===void 0?function(){return{}}:t,r=e.props,i=r===void 0?{}:r,o=e.methods,a=o===void 0?{}:o,s=e.aliases,l=s===void 0?{}:s,c=e.init,f=c===void 0?function(){}:c,u=e.update,g=u===void 0?function(){}:u,h=Object.keys(i).map(function(p){return new Vu(p,i[p])});return function p(){for(var v=arguments.length,y=new Array(v),d=0;d<v;d++)y[d]=arguments[d];var b=!!(this instanceof p&&this.constructor),m=b?y.shift():void 0,x=y[0],w=x===void 0?{}:x,_=Object.assign({},n instanceof Function?n(w):n,{initialised:!1}),k={};function C(N){return P(N,w),M(),C}var P=function(E,B){f.call(C,E,_,B),_.initialised=!0},M=Du(function(){_.initialised&&(g.call(C,_,k),k={})},1);return h.forEach(function(N){C[N.name]=E(N);function E(B){var S=B.name,O=B.triggerUpdate,L=O===void 0?!1:O,U=B.onChange,ne=U===void 0?function(D,$){}:U,J=B.defaultVal,se=J===void 0?null:J;return function(D){var $=_[S];if(!arguments.length)return $;var G=D===void 0?se:D;return _[S]=G,ne.call(C,G,_,$),!k.hasOwnProperty(S)&&(k[S]=$),L&&M(),C}}}),Object.keys(a).forEach(function(N){C[N]=function(){for(var E,B=arguments.length,S=new Array(B),O=0;O<B;O++)S[O]=arguments[O];return(E=a[N]).call.apply(E,[C,_].concat(S))}}),Object.entries(l).forEach(function(N){var E=Uu(N,2),B=E[0],S=E[1];return C[B]=C[S]}),C.resetProps=function(){return h.forEach(function(N){C[N.name](N.defaultVal)}),C},C.resetProps(),_._rerender=M,b&&m&&C(m),C}}var ie=function(e){return typeof e=="function"?e:typeof e=="string"?function(t){return t[e]}:function(t){return e}};class po extends Map{constructor(t,n=Xu){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(go(this,t))}has(t){return super.has(go(this,t))}set(t,n){return super.set(Gu(this,t),n)}delete(t){return super.delete(Wu(this,t))}}function go({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Gu({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Wu({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Xu(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Yu(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function Ku(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function Mr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Qu(e){if(Array.isArray(e))return e}function Zu(e){if(Array.isArray(e))return Mr(e)}function ka(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function Ju(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ef(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ce(e,t){return e.get(ka(e,t))}function Pt(e,t,n){Ju(e,t),t.set(e,n)}function wn(e,t,n){return e.set(ka(e,t),n),n}function tf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ff(r.key),r)}}function nf(e,t,n){return t&&tf(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function rf(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function of(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}function af(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
504
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sf(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
505
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lf(e,t){return Qu(e)||of(e,t)||Ca(e,t)||af()}function cf(e){return Zu(e)||rf(e)||Ca(e)||sf()}function uf(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function ff(e){var t=uf(e,"string");return typeof t=="symbol"?t:t+""}function Ca(e,t){if(e){if(typeof e=="string")return Mr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mr(e,t):void 0}}var Ot=new WeakMap,Xt=new WeakMap,At=new WeakMap,fr=new WeakMap,dr=new WeakMap,hr=new WeakMap,df=function(){function e(){ef(this,e),Pt(this,Ot,new Map),Pt(this,Xt,new Map),Pt(this,At,function(t){return t}),Pt(this,fr,function(){return{}}),Pt(this,dr,function(){}),Pt(this,hr,function(){})}return nf(e,[{key:"getObj",value:function(n){return Ce(Ot,this).get(Ce(At,this).call(this,n))}},{key:"getData",value:function(n){return Ce(Xt,this).get(n)}},{key:"entries",value:function(){return cf(Ce(Xt,this).entries()).map(function(n){var r=lf(n,2),i=r[0],o=r[1];return[o,i]})}},{key:"id",value:function(n){return wn(At,this,ie(n)),this}},{key:"onCreateObj",value:function(n){return wn(fr,this,n),this}},{key:"onUpdateObj",value:function(n){return wn(dr,this,n),this}},{key:"onRemoveObj",value:function(n){return wn(hr,this,n),this}},{key:"digest",value:function(n){var r=this;n.filter(function(o){return!Ce(Ot,r).has(Ce(At,r).call(r,o))}).forEach(function(o){var a=Ce(fr,r).call(r,o);Ce(Ot,r).set(Ce(At,r).call(r,o),a),Ce(Xt,r).set(a,o)});var i=new Map(n.map(function(o){return[Ce(At,r).call(r,o),o]}));return Ce(Ot,this).forEach(function(o,a){i.has(a)?Ce(dr,r).call(r,o,i.get(a)):(Ce(hr,r).call(r,o,a),Ce(Ot,r).delete(a),Ce(Xt,r).delete(o))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])}();function hf(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const vo=Symbol("implicit");function Sa(){var e=new po,t=[],n=[],r=vo;function i(o){let a=e.get(o);if(a===void 0){if(r!==vo)return r;e.set(o,a=t.push(o)-1)}return n[a%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new po;for(const a of o)e.has(a)||e.set(a,t.push(a)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return Sa(t,n).unknown(r)},hf.apply(i,arguments),i}function pf(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}const gf=pf("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function En(e){"@babel/helpers - typeof";return En=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},En(e)}var vf=/^\s+/,yf=/\s+$/;function X(e,t){if(e=e||"",t=t||{},e instanceof X)return e;if(!(this instanceof X))return new X(e,t);var n=mf(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}X.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),n,r,i,o,a,s;return n=t.r/255,r=t.g/255,i=t.b/255,n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),i<=.03928?s=i/12.92:s=Math.pow((i+.055)/1.055,2.4),.2126*o+.7152*a+.0722*s},setAlpha:function(t){return this._a=Ma(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=mo(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=mo(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),i=Math.round(t.v*100);return this._a==1?"hsv("+n+", "+r+"%, "+i+"%)":"hsva("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=yo(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=yo(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),i=Math.round(t.l*100);return this._a==1?"hsl("+n+", "+r+"%, "+i+"%)":"hsla("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return bo(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return wf(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(pe(this._r,255)*100)+"%",g:Math.round(pe(this._g,255)*100)+"%",b:Math.round(pe(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(pe(this._r,255)*100)+"%, "+Math.round(pe(this._g,255)*100)+"%, "+Math.round(pe(this._b,255)*100)+"%)":"rgba("+Math.round(pe(this._r,255)*100)+"%, "+Math.round(pe(this._g,255)*100)+"%, "+Math.round(pe(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Nf[bo(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+_o(this._r,this._g,this._b,this._a),r=n,i=this._gradientType?"GradientType = 1, ":"";if(t){var o=X(t);r="#"+_o(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+n+",endColorstr="+r+")"},toString:function(t){var n=!!t;t=t||this._format;var r=!1,i=this._a<1&&this._a>=0,o=!n&&i&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return o?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return X(this.toString())},_applyModification:function(t,n){var r=t.apply(null,[this].concat([].slice.call(n)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(Mf,arguments)},brighten:function(){return this._applyModification(Pf,arguments)},darken:function(){return this._applyModification(Of,arguments)},desaturate:function(){return this._applyModification(kf,arguments)},saturate:function(){return this._applyModification(Cf,arguments)},greyscale:function(){return this._applyModification(Sf,arguments)},spin:function(){return this._applyModification(Af,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(Ef,arguments)},complement:function(){return this._applyCombination(jf,arguments)},monochromatic:function(){return this._applyCombination(Lf,arguments)},splitcomplement:function(){return this._applyCombination(Tf,arguments)},triad:function(){return this._applyCombination(xo,[3])},tetrad:function(){return this._applyCombination(xo,[4])}};X.fromRatio=function(e,t){if(En(e)=="object"){var n={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?n[r]=e[r]:n[r]=tn(e[r]));e=n}return X(e,t)};function mf(e){var t={r:0,g:0,b:0},n=1,r=null,i=null,o=null,a=!1,s=!1;return typeof e=="string"&&(e=zf(e)),En(e)=="object"&&(it(e.r)&&it(e.g)&&it(e.b)?(t=bf(e.r,e.g,e.b),a=!0,s=String(e.r).substr(-1)==="%"?"prgb":"rgb"):it(e.h)&&it(e.s)&&it(e.v)?(r=tn(e.s),i=tn(e.v),t=xf(e.h,r,i),a=!0,s="hsv"):it(e.h)&&it(e.s)&&it(e.l)&&(r=tn(e.s),o=tn(e.l),t=_f(e.h,r,o),a=!0,s="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=Ma(n),{ok:a,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function bf(e,t,n){return{r:pe(e,255)*255,g:pe(t,255)*255,b:pe(n,255)*255}}function yo(e,t,n){e=pe(e,255),t=pe(t,255),n=pe(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),o,a,s=(r+i)/2;if(r==i)o=a=0;else{var l=r-i;switch(a=s>.5?l/(2-r-i):l/(r+i),r){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4;break}o/=6}return{h:o,s:a,l:s}}function _f(e,t,n){var r,i,o;e=pe(e,360),t=pe(t,100),n=pe(n,100);function a(c,f,u){return u<0&&(u+=1),u>1&&(u-=1),u<1/6?c+(f-c)*6*u:u<1/2?f:u<2/3?c+(f-c)*(2/3-u)*6:c}if(t===0)r=i=o=n;else{var s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;r=a(l,s,e+1/3),i=a(l,s,e),o=a(l,s,e-1/3)}return{r:r*255,g:i*255,b:o*255}}function mo(e,t,n){e=pe(e,255),t=pe(t,255),n=pe(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),o,a,s=r,l=r-i;if(a=r===0?0:l/r,r==i)o=0;else{switch(r){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4;break}o/=6}return{h:o,s:a,v:s}}function xf(e,t,n){e=pe(e,360)*6,t=pe(t,100),n=pe(n,100);var r=Math.floor(e),i=e-r,o=n*(1-t),a=n*(1-i*t),s=n*(1-(1-i)*t),l=r%6,c=[n,a,o,o,s,n][l],f=[s,n,n,a,o,o][l],u=[o,o,s,n,n,a][l];return{r:c*255,g:f*255,b:u*255}}function bo(e,t,n,r){var i=[Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function wf(e,t,n,r,i){var o=[Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16)),Ye(Pa(r))];return i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}function _o(e,t,n,r){var i=[Ye(Pa(r)),Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16))];return i.join("")}X.equals=function(e,t){return!e||!t?!1:X(e).toRgbString()==X(t).toRgbString()};X.random=function(){return X.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function kf(e,t){t=t===0?0:t||10;var n=X(e).toHsl();return n.s-=t/100,n.s=Hn(n.s),X(n)}function Cf(e,t){t=t===0?0:t||10;var n=X(e).toHsl();return n.s+=t/100,n.s=Hn(n.s),X(n)}function Sf(e){return X(e).desaturate(100)}function Mf(e,t){t=t===0?0:t||10;var n=X(e).toHsl();return n.l+=t/100,n.l=Hn(n.l),X(n)}function Pf(e,t){t=t===0?0:t||10;var n=X(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),X(n)}function Of(e,t){t=t===0?0:t||10;var n=X(e).toHsl();return n.l-=t/100,n.l=Hn(n.l),X(n)}function Af(e,t){var n=X(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,X(n)}function jf(e){var t=X(e).toHsl();return t.h=(t.h+180)%360,X(t)}function xo(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=X(e).toHsl(),r=[X(e)],i=360/t,o=1;o<t;o++)r.push(X({h:(n.h+o*i)%360,s:n.s,l:n.l}));return r}function Tf(e){var t=X(e).toHsl(),n=t.h;return[X(e),X({h:(n+72)%360,s:t.s,l:t.l}),X({h:(n+216)%360,s:t.s,l:t.l})]}function Ef(e,t,n){t=t||6,n=n||30;var r=X(e).toHsl(),i=360/n,o=[X(e)];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,o.push(X(r));return o}function Lf(e,t){t=t||6;for(var n=X(e).toHsv(),r=n.h,i=n.s,o=n.v,a=[],s=1/t;t--;)a.push(X({h:r,s:i,v:o})),o=(o+s)%1;return a}X.mix=function(e,t,n){n=n===0?0:n||50;var r=X(e).toRgb(),i=X(t).toRgb(),o=n/100,a={r:(i.r-r.r)*o+r.r,g:(i.g-r.g)*o+r.g,b:(i.b-r.b)*o+r.b,a:(i.a-r.a)*o+r.a};return X(a)};X.readability=function(e,t){var n=X(e),r=X(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)};X.isReadable=function(e,t,n){var r=X.readability(e,t),i,o;switch(o=!1,i=Ff(n),i.level+i.size){case"AAsmall":case"AAAlarge":o=r>=4.5;break;case"AAlarge":o=r>=3;break;case"AAAsmall":o=r>=7;break}return o};X.mostReadable=function(e,t,n){var r=null,i=0,o,a,s,l;n=n||{},a=n.includeFallbackColors,s=n.level,l=n.size;for(var c=0;c<t.length;c++)o=X.readability(e,t[c]),o>i&&(i=o,r=X(t[c]));return X.isReadable(e,r,{level:s,size:l})||!a?r:(n.includeFallbackColors=!1,X.mostReadable(e,["#fff","#000"],n))};var Pr=X.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Nf=X.hexNames=Rf(Pr);function Rf(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function Ma(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function pe(e,t){If(e)&&(e="100%");var n=Df(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function Hn(e){return Math.min(1,Math.max(0,e))}function Ie(e){return parseInt(e,16)}function If(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function Df(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Ye(e){return e.length==1?"0"+e:""+e}function tn(e){return e<=1&&(e=e*100+"%"),e}function Pa(e){return Math.round(parseFloat(e)*255).toString(16)}function wo(e){return Ie(e)/255}var We=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function it(e){return!!We.CSS_UNIT.exec(e)}function zf(e){e=e.replace(vf,"").replace(yf,"").toLowerCase();var t=!1;if(Pr[e])e=Pr[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=We.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=We.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=We.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=We.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=We.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=We.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=We.hex8.exec(e))?{r:Ie(n[1]),g:Ie(n[2]),b:Ie(n[3]),a:wo(n[4]),format:t?"name":"hex8"}:(n=We.hex6.exec(e))?{r:Ie(n[1]),g:Ie(n[2]),b:Ie(n[3]),format:t?"name":"hex"}:(n=We.hex4.exec(e))?{r:Ie(n[1]+""+n[1]),g:Ie(n[2]+""+n[2]),b:Ie(n[3]+""+n[3]),a:wo(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=We.hex3.exec(e))?{r:Ie(n[1]+""+n[1]),g:Ie(n[2]+""+n[2]),b:Ie(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function Ff(e){var t,n;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:t,size:n}}function Or(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Bf(e){if(Array.isArray(e))return e}function $f(e){if(Array.isArray(e))return Or(e)}function Oa(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function Hf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Aa(e,t,n){return t=Nt(t),Kf(e,ii()?Reflect.construct(t,n||[],Nt(e).constructor):t.apply(e,n))}function Uf(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ja(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pr(e,t){return e.get(Oa(e,t))}function ko(e,t,n){Uf(e,t),t.set(e,n)}function Co(e,t,n){return e.set(Oa(e,t),n),n}function Ta(e,t,n){if(ii())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return i}function qf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Na(r.key),r)}}function Ea(e,t,n){return t&&qf(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Un(e,t,n){return(t=Na(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ar(){return Ar=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Qf(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Ar.apply(null,arguments)}function Nt(e){return Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nt(e)}function La(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jr(e,t)}function ii(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ii=function(){return!!e})()}function Vf(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Gf(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}function Wf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
506
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xf(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
507
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function So(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Yf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?So(Object(n),!0).forEach(function(r){Un(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):So(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Kf(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hf(e)}function jr(e,t){return jr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},jr(e,t)}function rn(e,t){return Bf(e)||Gf(e,t)||Ra(e,t)||Wf()}function Qf(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Nt(e))!==null;);return e}function gr(e,t,n,r){var i=Ar(Nt(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function Xe(e){return $f(e)||Vf(e)||Ra(e)||Xf()}function Zf(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Na(e){var t=Zf(e,"string");return typeof t=="symbol"?t:t+""}function Tr(e){"@babel/helpers - typeof";return Tr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tr(e)}function Ra(e,t){if(e){if(typeof e=="string")return Or(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Or(e,t):void 0}}var Ia=function(t){t instanceof Array?t.forEach(Ia):(t.map&&t.map.dispose(),t.dispose())},oi=function(t){t.geometry&&t.geometry.dispose(),t.material&&Ia(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(oi)},Mo=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),oi(n)}},vr=new WeakMap,kn=new WeakMap,Yt=function(e){function t(n){var r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.dataBindAttr,a=o===void 0?"__data":o,s=i.objBindAttr,l=s===void 0?"__threeObj":s;return ja(this,t),r=Aa(this,t),Un(r,"scene",void 0),ko(r,vr,void 0),ko(r,kn,void 0),r.scene=n,Co(vr,r,a),Co(kn,r,l),r.onRemoveObj(function(){}),r}return La(t,e),Ea(t,[{key:"onCreateObj",value:function(r){var i=this;return gr(t,"onCreateObj",this)([function(o){var a=r(o);return o[pr(kn,i)]=a,a[pr(vr,i)]=o,i.scene.add(a),a}]),this}},{key:"onRemoveObj",value:function(r){var i=this;return gr(t,"onRemoveObj",this)([function(o,a){var s=gr(t,"getData",i)([o]);r(o,a),i.scene.remove(o),oi(o),delete s[pr(kn,i)]}]),this}}])}(df),Kt=function(t){return isNaN(t)?parseInt(X(t).toHex(),16):t},yr=function(t){return isNaN(t)?X(t).getAlpha():1},Jf=Sa(gf);function Po(e,t,n){!t||typeof n!="string"||e.filter(function(r){return!r[n]}).forEach(function(r){r[n]=Jf(t(r))})}function ed(e,t){var n=e.nodes,r=e.links,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=i.nodeFilter,a=o===void 0?function(){return!0}:o,s=i.onLoopError,l=s===void 0?function(h){throw"Invalid DAG structure! Found cycle in node path: ".concat(h.join(" -> "),".")}:s,c={};n.forEach(function(h){return c[t(h)]={data:h,out:[],depth:-1,skip:!a(h)}}),r.forEach(function(h){var p=h.source,v=h.target,y=x(p),d=x(v);if(!c.hasOwnProperty(y))throw"Missing source node with id: ".concat(y);if(!c.hasOwnProperty(d))throw"Missing target node with id: ".concat(d);var b=c[y],m=c[d];b.out.push(m);function x(w){return Tr(w)==="object"?t(w):w}});var f=[];g(Object.values(c));var u=Object.assign.apply(Object,[{}].concat(Xe(Object.entries(c).filter(function(h){var p=rn(h,2),v=p[1];return!v.skip}).map(function(h){var p=rn(h,2),v=p[0],y=p[1];return Un({},v,y.depth)}))));return u;function g(h){for(var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,y=function(){var x=h[d];if(p.indexOf(x)!==-1){var w=[].concat(Xe(p.slice(p.indexOf(x))),[x]).map(function(_){return t(_.data)});return f.some(function(_){return _.length===w.length&&_.every(function(k,C){return k===w[C]})})||(f.push(w),l(w)),1}v>x.depth&&(x.depth=v,g(x.out,[].concat(Xe(p),[x]),v+(x.skip?0:1)))},d=0,b=h.length;d<b;d++)y()}}var Q=window.THREE?window.THREE:{Group:K.Group,Mesh:K.Mesh,MeshLambertMaterial:K.MeshLambertMaterial,Color:K.Color,BufferGeometry:K.BufferGeometry,BufferAttribute:K.BufferAttribute,Matrix4:K.Matrix4,Vector3:K.Vector3,SphereGeometry:K.SphereGeometry,CylinderGeometry:K.CylinderGeometry,TubeGeometry:K.TubeGeometry,ConeGeometry:K.ConeGeometry,Line:K.Line,LineBasicMaterial:K.LineBasicMaterial,QuadraticBezierCurve3:K.QuadraticBezierCurve3,CubicBezierCurve3:K.CubicBezierCurve3,Box3:K.Box3},Oo={graph:jc,forcelayout:fu},td=2,mr=new Q.BufferGeometry().setAttribute?"setAttribute":"addAttribute",Cn=new Q.BufferGeometry().applyMatrix4?"applyMatrix4":"applyMatrix",nd=ri({props:{jsonUrl:{onChange:function(t,n){var r=this;t&&!n.fetchingJson&&(n.fetchingJson=!0,n.onLoading(),fetch(t).then(function(i){return i.json()}).then(function(i){n.fetchingJson=!1,n.onFinishLoading(i),r.graphData(i)}))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(t,n){n.engineRunning=!1}},numDimensions:{default:3,onChange:function(t,n){var r=n.d3ForceLayout.force("charge");r&&r.strength(t>2?-60:-30),t<3&&i(n.graphData.nodes,"z"),t<2&&i(n.graphData.nodes,"y");function i(o,a){o.forEach(function(s){delete s[a],delete s["v".concat(a)]})}}},dagMode:{onChange:function(t,n){!t&&n.forceEngine==="d3"&&(n.graphData.nodes||[]).forEach(function(r){return r.fx=r.fy=r.fz=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(t){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},nodePositionUpdate:{triggerUpdate:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},linkDirectionalParticleThreeObject:{},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaDecay(t)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaTarget(t)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.velocityDecay(t)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(t){return t._flushObjects=!0,t._rerender(),this},d3Force:function(t,n,r){return r===void 0?t.d3ForceLayout.force(n):(t.d3ForceLayout.force(n,r),this)},d3ReheatSimulation:function(t){return t.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(t){return t.cntTicks=0,t.startTickTime=new Date,t.engineRunning=!0,this},tickFrame:function(t){var n=t.forceEngine!=="ngraph";return t.engineRunning&&r(),i(),o(),this;function r(){++t.cntTicks>t.cooldownTicks||new Date-t.startTickTime>t.cooldownTime||n&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin?(t.engineRunning=!1,t.onEngineStop()):(t.layout[n?"tick":"step"](),t.onEngineTick());var a=ie(t.nodeThreeObjectExtend);t.nodeDataMapper.entries().forEach(function(g){var h=rn(g,2),p=h[0],v=h[1];if(v){var y=n?p:t.layout.getNodePosition(p[t.nodeId]),d=a(p);(!t.nodePositionUpdate||!t.nodePositionUpdate(d?v.children[0]:v,{x:y.x,y:y.y,z:y.z},p)||d)&&(v.position.x=y.x,v.position.y=y.y||0,v.position.z=y.z||0)}});var s=ie(t.linkWidth),l=ie(t.linkCurvature),c=ie(t.linkCurveRotation),f=ie(t.linkThreeObjectExtend);t.linkDataMapper.entries().forEach(function(g){var h=rn(g,2),p=h[0],v=h[1];if(v){var y=n?p:t.layout.getLinkPosition(t.layout.graph.getLink(p.source,p.target).id),d=y[n?"source":"from"],b=y[n?"target":"to"];if(!(!d||!b||!d.hasOwnProperty("x")||!b.hasOwnProperty("x"))){u(p);var m=f(p);if(!(t.linkPositionUpdate&&t.linkPositionUpdate(m?v.children[1]:v,{start:{x:d.x,y:d.y,z:d.z},end:{x:b.x,y:b.y,z:b.z}},p)&&!m)){var x=30,w=p.__curve,_=v.children.length?v.children[0]:v;if(_.type==="Line"){if(w){var C=w.getPoints(x);_.geometry.getAttribute("position").array.length!==C.length*3&&_.geometry[mr]("position",new Q.BufferAttribute(new Float32Array(C.length*3),3)),_.geometry.setFromPoints(C)}else{var k=_.geometry.getAttribute("position");(!k||!k.array||k.array.length!==6)&&_.geometry[mr]("position",k=new Q.BufferAttribute(new Float32Array(2*3),3)),k.array[0]=d.x,k.array[1]=d.y||0,k.array[2]=d.z||0,k.array[3]=b.x,k.array[4]=b.y||0,k.array[5]=b.z||0,k.needsUpdate=!0}_.geometry.computeBoundingSphere()}else if(_.type==="Mesh")if(w){_.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(_.position.set(0,0,0),_.rotation.set(0,0,0),_.scale.set(1,1,1));var O=Math.ceil(s(p)*10)/10,L=O/2,U=new Q.TubeGeometry(w,x,L,t.linkResolution,!1);_.geometry.dispose(),_.geometry=U}else{if(!_.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var P=Math.ceil(s(p)*10)/10,M=P/2,N=new Q.CylinderGeometry(M,M,1,t.linkResolution,1,!1);N[Cn](new Q.Matrix4().makeTranslation(0,1/2,0)),N[Cn](new Q.Matrix4().makeRotationX(Math.PI/2)),_.geometry.dispose(),_.geometry=N}var E=new Q.Vector3(d.x,d.y||0,d.z||0),B=new Q.Vector3(b.x,b.y||0,b.z||0),S=E.distanceTo(B);_.position.x=E.x,_.position.y=E.y,_.position.z=E.z,_.scale.z=S,_.parent.localToWorld(B),_.lookAt(B)}}}}});function u(g){var h=n?g:t.layout.getLinkPosition(t.layout.graph.getLink(g.source,g.target).id),p=h[n?"source":"from"],v=h[n?"target":"to"];if(!(!p||!v||!p.hasOwnProperty("x")||!v.hasOwnProperty("x"))){var y=l(g);if(!y)g.__curve=null;else{var d=new Q.Vector3(p.x,p.y||0,p.z||0),b=new Q.Vector3(v.x,v.y||0,v.z||0),m=d.distanceTo(b),x,w=c(g);if(m>0){var _=v.x-p.x,k=v.y-p.y||0,C=new Q.Vector3().subVectors(b,d),P=C.clone().multiplyScalar(y).cross(_!==0||k!==0?new Q.Vector3(0,0,1):new Q.Vector3(0,1,0)).applyAxisAngle(C.normalize(),w).add(new Q.Vector3().addVectors(d,b).divideScalar(2));x=new Q.QuadraticBezierCurve3(d,P,b)}else{var M=y*70,N=-w,E=N+Math.PI/2;x=new Q.CubicBezierCurve3(d,new Q.Vector3(M*Math.cos(E),M*Math.sin(E),0).add(d),new Q.Vector3(M*Math.cos(N),M*Math.sin(N),0).add(d),b)}g.__curve=x}}}}function i(){var a=ie(t.linkDirectionalArrowRelPos),s=ie(t.linkDirectionalArrowLength),l=ie(t.nodeVal);t.arrowDataMapper.entries().forEach(function(c){var f=rn(c,2),u=f[0],g=f[1];if(g){var h=n?u:t.layout.getLinkPosition(t.layout.graph.getLink(u.source,u.target).id),p=h[n?"source":"from"],v=h[n?"target":"to"];if(!(!p||!v||!p.hasOwnProperty("x")||!v.hasOwnProperty("x"))){var y=Math.cbrt(Math.max(0,l(p)||1))*t.nodeRelSize,d=Math.cbrt(Math.max(0,l(v)||1))*t.nodeRelSize,b=s(u),m=a(u),x=u.__curve?function(M){return u.__curve.getPoint(M)}:function(M){var N=function(B,S,O,L){return S[B]+(O[B]-S[B])*L||0};return{x:N("x",p,v,M),y:N("y",p,v,M),z:N("z",p,v,M)}},w=u.__curve?u.__curve.getLength():Math.sqrt(["x","y","z"].map(function(M){return Math.pow((v[M]||0)-(p[M]||0),2)}).reduce(function(M,N){return M+N},0)),_=y+b+(w-y-d-b)*m,k=x(_/w),C=x((_-b)/w);["x","y","z"].forEach(function(M){return g.position[M]=C[M]});var P=Ta(Q.Vector3,Xe(["x","y","z"].map(function(M){return k[M]})));g.parent.localToWorld(P),g.lookAt(P)}}})}function o(){var a=ie(t.linkDirectionalParticleSpeed),s=ie(t.linkDirectionalParticleOffset);t.graphData.links.forEach(function(l){var c=t.particlesDataMapper.getObj(l),f=c&&c.children,u=l.__singleHopPhotonsObj&&l.__singleHopPhotonsObj.children;if(!((!u||!u.length)&&(!f||!f.length))){var g=n?l:t.layout.getLinkPosition(t.layout.graph.getLink(l.source,l.target).id),h=g[n?"source":"from"],p=g[n?"target":"to"];if(!(!h||!p||!h.hasOwnProperty("x")||!p.hasOwnProperty("x"))){var v=a(l),y=Math.abs(s(l)),d=l.__curve?function(m){return l.__curve.getPoint(m)}:function(m){var x=function(_,k,C,P){return k[_]+(C[_]-k[_])*P||0};return{x:x("x",h,p,m),y:x("y",h,p,m),z:x("z",h,p,m)}},b=[].concat(Xe(f||[]),Xe(u||[]));b.forEach(function(m,x){var w=m.parent.__linkThreeObjType==="singleHopPhotons";if(m.hasOwnProperty("__progressRatio")||(m.__progressRatio=w?v<0?1:0:(x+y)/f.length),m.__progressRatio+=v,m.__progressRatio>=1||m.__progressRatio<0)if(!w)m.__progressRatio=m.__progressRatio%1,m.__progressRatio<0&&m.__progressRatio++;else{m.parent.remove(m),Mo(m);return}var _=m.__progressRatio,k=d(_);m.geometry.type!=="SphereGeometry"&&m.lookAt(k.x,k.y,k.z),["x","y","z"].forEach(function(C){return m.position[C]=k[C]})})}}})}},emitParticle:function(t,n){if(n&&t.graphData.links.includes(n)){if(!n.__singleHopPhotonsObj){var r=new Q.Group;r.__linkThreeObjType="singleHopPhotons",n.__singleHopPhotonsObj=r,t.graphScene.add(r)}var i=ie(t.linkDirectionalParticleThreeObject)(n);if(i&&t.linkDirectionalParticleThreeObject===i&&(i=i.clone()),!i){var o=ie(t.linkDirectionalParticleWidth),a=Math.ceil(o(n)*10)/10/2,s=t.linkDirectionalParticleResolution,l=new Q.SphereGeometry(a,s,s),c=ie(t.linkColor),f=ie(t.linkDirectionalParticleColor),u=f(n)||c(n)||"#f0f0f0",g=new Q.Color(Kt(u)),h=t.linkOpacity*3,p=new Q.MeshLambertMaterial({color:g,transparent:!0,opacity:h});i=new Q.Mesh(l,p)}n.__singleHopPhotonsObj.add(i)}return this},getGraphBbox:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0};if(!t.initialised)return null;var r=function i(o){var a=[];if(o.geometry){o.geometry.computeBoundingBox();var s=new Q.Box3;s.copy(o.geometry.boundingBox).applyMatrix4(o.matrixWorld),a.push(s)}return a.concat.apply(a,Xe((o.children||[]).filter(function(l){return!l.hasOwnProperty("__graphObjType")||l.__graphObjType==="node"&&n(l.__data)}).map(i)))}(t.graphScene);return r.length?Object.assign.apply(Object,Xe(["x","y","z"].map(function(i){return Un({},i,[Ku(r,function(o){return o.min[i]}),Yu(r,function(o){return o.max[i]})])}))):null}},stateInit:function(){return{d3ForceLayout:kc().force("link",lc()).force("charge",Cc()).force("center",cl()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(t,n){n.graphScene=t,n.nodeDataMapper=new Yt(t,{objBindAttr:"__threeObj"}),n.linkDataMapper=new Yt(t,{objBindAttr:"__lineObj"}),n.arrowDataMapper=new Yt(t,{objBindAttr:"__arrowObj"}),n.particlesDataMapper=new Yt(t,{objBindAttr:"__photonsObj"})},update:function(t,n){var r=function(H){return H.some(function(z){return n.hasOwnProperty(z)})};if(t.engineRunning=!1,typeof t.onUpdate=="function"&&t.onUpdate(),t.nodeAutoColorBy!==null&&r(["nodeAutoColorBy","graphData","nodeColor"])&&Po(t.graphData.nodes,ie(t.nodeAutoColorBy),t.nodeColor),t.linkAutoColorBy!==null&&r(["linkAutoColorBy","graphData","linkColor"])&&Po(t.graphData.links,ie(t.linkAutoColorBy),t.linkColor),t._flushObjects||r(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var i=ie(t.nodeThreeObject),o=ie(t.nodeThreeObjectExtend),a=ie(t.nodeVal),s=ie(t.nodeColor),l=ie(t.nodeVisibility),c={},f={};(t._flushObjects||r(["nodeThreeObject","nodeThreeObjectExtend"]))&&t.nodeDataMapper.clear(),t.nodeDataMapper.onCreateObj(function(I){var H=i(I),z=o(I);H&&t.nodeThreeObject===H&&(H=H.clone());var F;return H&&!z?F=H:(F=new Q.Mesh,F.__graphDefaultObj=!0,H&&z&&F.add(H)),F.__graphObjType="node",F}).onUpdateObj(function(I,H){if(I.__graphDefaultObj){var z=a(H)||1,F=Math.cbrt(z)*t.nodeRelSize,R=t.nodeResolution;(!I.geometry.type.match(/^Sphere(Buffer)?Geometry$/)||I.geometry.parameters.radius!==F||I.geometry.parameters.widthSegments!==R)&&(c.hasOwnProperty(z)||(c[z]=new Q.SphereGeometry(F,R,R)),I.geometry.dispose(),I.geometry=c[z]);var q=s(H),V=new Q.Color(Kt(q||"#ffffaa")),re=t.nodeOpacity*yr(q);(I.material.type!=="MeshLambertMaterial"||!I.material.color.equals(V)||I.material.opacity!==re)&&(f.hasOwnProperty(q)||(f[q]=new Q.MeshLambertMaterial({color:V,transparent:!0,opacity:re})),I.material.dispose(),I.material=f[q])}}).digest(t.graphData.nodes.filter(l))}if(t._flushObjects||r(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject"])){var u=ie(t.linkThreeObject),g=ie(t.linkThreeObjectExtend),h=ie(t.linkMaterial),p=ie(t.linkVisibility),v=ie(t.linkColor),y=ie(t.linkWidth),d={},b={},m={},x=t.graphData.links.filter(p);if((t._flushObjects||r(["linkThreeObject","linkThreeObjectExtend","linkWidth"]))&&t.linkDataMapper.clear(),t.linkDataMapper.onRemoveObj(function(I){var H=I.__data&&I.__data.__singleHopPhotonsObj;H&&(H.parent.remove(H),Mo(H),delete I.__data.__singleHopPhotonsObj)}).onCreateObj(function(I){var H=u(I),z=g(I);H&&t.linkThreeObject===H&&(H=H.clone());var F;if(!H||z){var R=!!y(I);if(R)F=new Q.Mesh;else{var q=new Q.BufferGeometry;q[mr]("position",new Q.BufferAttribute(new Float32Array(2*3),3)),F=new Q.Line(q)}}var V;return H?z?(V=new Q.Group,V.__graphDefaultObj=!0,V.add(F),V.add(H)):V=H:(V=F,V.__graphDefaultObj=!0),V.renderOrder=10,V.__graphObjType="link",V}).onUpdateObj(function(I,H){if(I.__graphDefaultObj){var z=I.children.length?I.children[0]:I,F=Math.ceil(y(H)*10)/10,R=!!F;if(R){var q=F/2,V=t.linkResolution;if(!z.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||z.geometry.parameters.radiusTop!==q||z.geometry.parameters.radialSegments!==V){if(!d.hasOwnProperty(F)){var re=new Q.CylinderGeometry(q,q,1,V,1,!1);re[Cn](new Q.Matrix4().makeTranslation(0,1/2,0)),re[Cn](new Q.Matrix4().makeRotationX(Math.PI/2)),d[F]=re}z.geometry.dispose(),z.geometry=d[F]}}var le=h(H);if(le)z.material=le;else{var ce=v(H),Se=new Q.Color(Kt(ce||"#f0f0f0")),me=t.linkOpacity*yr(ce),Te=R?"MeshLambertMaterial":"LineBasicMaterial";if(z.material.type!==Te||!z.material.color.equals(Se)||z.material.opacity!==me){var ze=R?b:m;ze.hasOwnProperty(ce)||(ze[ce]=new Q[Te]({color:Se,transparent:me<1,opacity:me,depthWrite:me>=1})),z.material.dispose(),z.material=ze[ce]}}}}).digest(x),t.linkDirectionalArrowLength||n.hasOwnProperty("linkDirectionalArrowLength")){var w=ie(t.linkDirectionalArrowLength),_=ie(t.linkDirectionalArrowColor);t.arrowDataMapper.onCreateObj(function(){var I=new Q.Mesh(void 0,new Q.MeshLambertMaterial({transparent:!0}));return I.__linkThreeObjType="arrow",I}).onUpdateObj(function(I,H){var z=w(H),F=t.linkDirectionalArrowResolution;if(!I.geometry.type.match(/^Cone(Buffer)?Geometry$/)||I.geometry.parameters.height!==z||I.geometry.parameters.radialSegments!==F){var R=new Q.ConeGeometry(z*.25,z,F);R.translate(0,z/2,0),R.rotateX(Math.PI/2),I.geometry.dispose(),I.geometry=R}var q=_(H)||v(H)||"#f0f0f0";I.material.color=new Q.Color(Kt(q)),I.material.opacity=t.linkOpacity*3*yr(q)}).digest(x.filter(w))}if(t.linkDirectionalParticles||n.hasOwnProperty("linkDirectionalParticles")){var k=ie(t.linkDirectionalParticles),C=ie(t.linkDirectionalParticleWidth),P=ie(t.linkDirectionalParticleColor),M=ie(t.linkDirectionalParticleThreeObject),N={},E={};t.particlesDataMapper.onCreateObj(function(){var I=new Q.Group;return I.__linkThreeObjType="photons",I.__photonDataMapper=new Yt(I),I}).onUpdateObj(function(I,H){var z=!!I.children.length&&I.children[0],F=M(H),R,q;if(F)R=F.geometry,q=F.material;else{var V=Math.ceil(C(H)*10)/10/2,re=t.linkDirectionalParticleResolution;z&&z.geometry.parameters.radius===V&&z.geometry.parameters.widthSegments===re?R=z.geometry:(E.hasOwnProperty(V)||(E[V]=new Q.SphereGeometry(V,re,re)),R=E[V]);var le=P(H)||v(H)||"#f0f0f0",ce=new Q.Color(Kt(le)),Se=t.linkOpacity*3;z&&z.material.color.equals(ce)&&z.material.opacity===Se?q=z.material:(N.hasOwnProperty(le)||(N[le]=new Q.MeshLambertMaterial({color:ce,transparent:!0,opacity:Se})),q=N[le])}z&&(z.geometry!==R&&z.geometry.dispose(),z.material!==q&&z.material.dispose());var me=Math.round(Math.abs(k(H)));I.__photonDataMapper.id(function(Te){return Te.idx}).onCreateObj(function(){return new Q.Mesh(R,q)}).onUpdateObj(function(Te){Te.geometry=R,Te.material=q}).digest(Xe(new Array(me)).map(function(Te,ze){return{idx:ze}}))}).digest(x.filter(k))}}if(t._flushObjects=!1,r(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach(function(I){I.source=I[t.linkSource],I.target=I[t.linkTarget]});var B=t.forceEngine!=="ngraph",S;if(B){(S=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var O=t.d3ForceLayout.force("link");O&&O.id(function(I){return I[t.nodeId]}).links(t.graphData.links);var L=t.dagMode&&ed(t.graphData,function(I){return I[t.nodeId]},{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),U=Math.max.apply(Math,Xe(Object.values(L||[]))),ne=t.dagLevelDistance||t.graphData.nodes.length/(U||1)*td*(["radialin","radialout"].indexOf(t.dagMode)!==-1?.7:1);if(["lr","rl","td","bu","zin","zout"].includes(n.dagMode)){var J=["lr","rl"].includes(n.dagMode)?"fx":["td","bu"].includes(n.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(I){return delete I[J]})}if(["lr","rl","td","bu","zin","zout"].includes(t.dagMode)){var se=["rl","td","zout"].includes(t.dagMode),D=function(H){return(L[H[t.nodeId]]-U/2)*ne*(se?-1:1)},$=["lr","rl"].includes(t.dagMode)?"fx":["td","bu"].includes(t.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(I){return I[$]=D(I)})}t.d3ForceLayout.force("dagRadial",["radialin","radialout"].indexOf(t.dagMode)!==-1?Sc(function(I){var H=L[I[t.nodeId]]||-1;return(t.dagMode==="radialin"?U-H:H)*ne}).strength(function(I){return t.dagNodeFilter(I)?1:0}):null)}else{var G=Oo.graph();t.graphData.nodes.forEach(function(I){G.addNode(I[t.nodeId])}),t.graphData.links.forEach(function(I){G.addLink(I.source,I.target)}),S=Oo.forcelayout(G,Yf({dimensions:t.numDimensions},t.ngraphPhysics)),S.graph=G}for(var Z=0;Z<t.warmupTicks&&!(B&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);Z++)S[B?"tick":"step"]();t.layout=S,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}});function rd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=function(i){function o(){var a;ja(this,o);for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return a=Aa(this,o,[].concat(l)),a.__kapsuleInstance=Ta(e,[].concat(Xe(n?[a]:[]),l)),a}return La(o,i),Ea(o)}(t);return Object.keys(e()).forEach(function(i){return r.prototype[i]=function(){var o,a=(o=this.__kapsuleInstance)[i].apply(o,arguments);return a===this.__kapsuleInstance?this:a}}),r}var id=window.THREE?window.THREE:{Group:K.Group},Da=rd(nd,id.Group,!0);function Le(){return Le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Le.apply(null,arguments)}function od(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ln(e,t){return ln=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ln(e,t)}function ad(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ln(e,t)}function Er(e){return Er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Er(e)}function sd(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function za(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(za=function(){return!!e})()}function ld(e,t,n){if(za())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&ln(i,n.prototype),i}function Lr(e){var t=typeof Map=="function"?new Map:void 0;return Lr=function(r){if(r===null||!sd(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(r))return t.get(r);t.set(r,i)}function i(){return ld(r,arguments,Er(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ln(i,r)},Lr(e)}var cd={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
502
+ `}var gu=bo.exports,wr,wi;function vu(){if(wi)return wr;wi=1,wr=e;function e(t,n,r,o){this.from=t,this.to=n,this.length=r,this.coefficient=o}return wr}var kr,ki;function yu(){if(ki)return kr;ki=1,kr=e;function e(t,n){var r;if(t||(t={}),n){for(r in n)if(n.hasOwnProperty(r)){var o=t.hasOwnProperty(r),i=typeof n[r],a=!o||typeof t[r]!==i;a?t[r]=n[r]:i==="object"&&(t[r]=e(t[r],n[r]))}}return t}return kr}var fn={exports:{}},Ci;function mu(){if(Ci)return fn.exports;Ci=1,fn.exports=e,fn.exports.random=e,fn.exports.randomIterator=l;function e(s){var u=typeof s=="number"?s:+new Date;return new t(u)}function t(s){this.seed=s}t.prototype.next=a,t.prototype.nextDouble=i,t.prototype.uniform=i,t.prototype.gaussian=n,t.prototype.random=i;function n(){var s,u,f;do u=this.nextDouble()*2-1,f=this.nextDouble()*2-1,s=u*u+f*f;while(s>=1||s===0);return u*Math.sqrt(-2*Math.log(s)/s)}t.prototype.levy=r;function r(){var s=1.5,u=Math.pow(o(1+s)*Math.sin(Math.PI*s/2)/(o((1+s)/2)*s*Math.pow(2,(s-1)/2)),1/s);return this.gaussian()*u/Math.pow(Math.abs(this.gaussian()),1/s)}function o(s){return Math.sqrt(2*Math.PI/s)*Math.pow(1/Math.E*(s+1/(12*s-1/(10*s))),s)}function i(){var s=this.seed;return s=s+2127912214+(s<<12)&4294967295,s=(s^3345072700^s>>>19)&4294967295,s=s+374761393+(s<<5)&4294967295,s=(s+3550635116^s<<9)&4294967295,s=s+4251993797+(s<<3)&4294967295,s=(s^3042594569^s>>>16)&4294967295,this.seed=s,(s&268435455)/268435456}function a(s){return Math.floor(this.nextDouble()*s)}function l(s,u){var f=u||e();if(typeof f.next!="function")throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:p,shuffle:c};function c(){var h,d,m;for(h=s.length-1;h>0;--h)d=f.next(h+1),m=s[d],s[d]=s[h],s[h]=m;return s}function p(h){var d,m,v;for(d=s.length-1;d>0;--d)m=f.next(d+1),v=s[m],s[m]=s[d],s[d]=v,h(v);s.length&&h(s[0])}}return fn.exports}var Fa=Su,bu=tu,_u=ru,xu=au,wu=cu,ku=du,Cu=gu,Si={};function Su(e){var t=vu(),n=yu(),r=ho;if(e){if(e.springCoeff!==void 0)throw new Error("springCoeff was renamed to springCoefficient");if(e.dragCoeff!==void 0)throw new Error("dragCoeff was renamed to dragCoefficient")}e=n(e,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var o=Si[e.dimensions];if(!o){var i=e.dimensions;o={Body:bu(i,e.debug),createQuadTree:_u(i),createBounds:xu(i),createDragForce:wu(i),createSpringForce:ku(i),integrate:Cu(i)},Si[i]=o}var a=o.Body,l=o.createQuadTree,s=o.createBounds,u=o.createDragForce,f=o.createSpringForce,c=o.integrate,p=y=>new a(y),h=mu().random(42),d=[],m=[],v=l(e,h),g=s(d,e,h),S=f(e,h),_=u(e),x=0,w=[],b=new Map,M=0;j("nbody",K),j("spring",O);var P={bodies:d,quadTree:v,springs:m,settings:e,addForce:j,removeForce:F,getForces:I,step:function(){for(var y=0;y<w.length;++y)w[y](M);var k=c(d,e.timeStep,e.adaptiveTimeStepWeight);return M+=1,k},addBody:function(y){if(!y)throw new Error("Body is required");return d.push(y),y},addBodyAt:function(y){if(!y)throw new Error("Body position is required");var k=p(y);return d.push(k),k},removeBody:function(y){if(y){var k=d.indexOf(y);if(!(k<0))return d.splice(k,1),d.length===0&&g.reset(),!0}},addSpring:function(y,k,C,$){if(!y||!k)throw new Error("Cannot add null spring to force simulator");typeof C!="number"&&(C=-1);var B=new t(y,k,C,$>=0?$:-1);return m.push(B),B},getTotalMovement:function(){return x},removeSpring:function(y){if(y){var k=m.indexOf(y);if(k>-1)return m.splice(k,1),!0}},getBestNewBodyPosition:function(y){return g.getBestNewPosition(y)},getBBox:N,getBoundingBox:N,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(y){return y!==void 0?(e.gravity=y,v.options({gravity:y}),this):e.gravity},theta:function(y){return y!==void 0?(e.theta=y,v.options({theta:y}),this):e.theta},random:h};return Mu(e,P),r(P),P;function N(){return g.update(),g.box}function j(y,k){if(b.has(y))throw new Error("Force "+y+" is already added");b.set(y,k),w.push(k)}function F(y){var k=w.indexOf(b.get(y));k<0||(w.splice(k,1),b.delete(y))}function I(){return b}function K(){if(d.length!==0){v.insertBodies(d);for(var y=d.length;y--;){var k=d[y];k.isPinned||(k.reset(),v.updateBodyForce(k),_.update(k))}}}function O(){for(var y=m.length;y--;)S.update(m[y])}}function Mu(e,t){for(var n in e)Pu(e,t,n)}function Pu(e,t,n){if(e.hasOwnProperty(n)&&typeof t[n]!="function"){var r=Number.isFinite(e[n]);r?t[n]=function(o){if(o!==void 0){if(!Number.isFinite(o))throw new Error("Value of "+n+" should be a valid number.");return e[n]=o,t}return e[n]}:t[n]=function(o){return o!==void 0?(e[n]=o,t):e[n]}}}po.exports=Ou;po.exports.simulator=Fa;var Au=ho;function Ou(e,t){if(!e)throw new Error("Graph structure cannot be undefined");var n=t&&t.createSimulator||Fa,r=n(t);if(Array.isArray(t))throw new Error("Physics settings is expected to be an object");var o=e.version>19?K:I;t&&typeof t.nodeMass=="function"&&(o=t.nodeMass);var i=new Map,a={},l=0,s=r.settings.springTransform||ju;_(),v();var u=!1,f={step:function(){if(l===0)return c(!0),!0;var O=r.step();f.lastMove=O,f.fire("step");var y=O/l,k=y<=.01;return c(k),k},getNodePosition:function(O){return F(O).pos},setNodePosition:function(O){var y=F(O);y.setPosition.apply(y,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(O){var y=a[O];if(y)return{from:y.from.pos,to:y.to.pos}},getGraphRect:function(){return r.getBBox()},forEachBody:p,pinNode:function(O,y){var k=F(O.id);k.isPinned=!!y},isNodePinned:function(O){return F(O.id).isPinned},dispose:function(){e.off("changed",S),f.fire("disposed")},getBody:m,getSpring:d,getForceVectorLength:h,simulator:r,graph:e,lastMove:0};return Au(f),f;function c(O){u!==O&&(u=O,g(O))}function p(O){i.forEach(O)}function h(){var O=0,y=0;return p(function(k){O+=Math.abs(k.force.x),y+=Math.abs(k.force.y)}),Math.sqrt(O*O+y*y)}function d(O,y){var k;if(y===void 0)typeof O!="object"?k=O:k=O.id;else{var C=e.hasLink(O,y);if(!C)return;k=C.id}return a[k]}function m(O){return i.get(O)}function v(){e.on("changed",S)}function g(O){f.fire("stable",O)}function S(O){for(var y=0;y<O.length;++y){var k=O[y];k.changeType==="add"?(k.node&&x(k.node.id),k.link&&b(k.link)):k.changeType==="remove"&&(k.node&&w(k.node),k.link&&M(k.link))}l=e.getNodesCount()}function _(){l=0,e.forEachNode(function(O){x(O.id),l+=1}),e.forEachLink(b)}function x(O){var y=i.get(O);if(!y){var k=e.getNode(O);if(!k)throw new Error("initBody() was called with unknown node id");var C=k.position;if(!C){var $=P(k);C=r.getBestNewBodyPosition($)}y=r.addBodyAt(C),y.id=O,i.set(O,y),N(O),j(k)&&(y.isPinned=!0)}}function w(O){var y=O.id,k=i.get(y);k&&(i.delete(y),r.removeBody(k))}function b(O){N(O.fromId),N(O.toId);var y=i.get(O.fromId),k=i.get(O.toId),C=r.addSpring(y,k,O.length);s(O,C),a[O.id]=C}function M(O){var y=a[O.id];if(y){var k=e.getNode(O.fromId),C=e.getNode(O.toId);k&&N(k.id),C&&N(C.id),delete a[O.id],r.removeSpring(y)}}function P(O){var y=[];if(!O.links)return y;for(var k=Math.min(O.links.length,2),C=0;C<k;++C){var $=O.links[C],B=$.fromId!==O.id?i.get($.fromId):i.get($.toId);B&&B.pos&&y.push(B)}return y}function N(O){var y=i.get(O);if(y.mass=o(O),Number.isNaN(y.mass))throw new Error("Node mass should be a number")}function j(O){return O&&(O.isPinned||O.data&&O.data.isPinned)}function F(O){var y=i.get(O);return y||(x(O),y=i.get(O)),y}function I(O){var y=e.getLinks(O);return y?1+y.length/3:1}function K(O){var y=e.getLinks(O);return y?1+y.size/3:1}}function ju(){}var zu=po.exports;const Tu=ka(zu);function $r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Eu=typeof global=="object"&&global&&global.Object===Object&&global,Lu=typeof self=="object"&&self&&self.Object===Object&&self,Ba=Eu||Lu||Function("return this")(),Cr=function(){return Ba.Date.now()},Nu=/\s/;function Ru(e){for(var t=e.length;t--&&Nu.test(e.charAt(t)););return t}var Du=/^\s+/;function Iu(e){return e&&e.slice(0,Ru(e)+1).replace(Du,"")}var Xn=Ba.Symbol,$a=Object.prototype,Fu=$a.hasOwnProperty,Bu=$a.toString,dn=Xn?Xn.toStringTag:void 0;function $u(e){var t=Fu.call(e,dn),n=e[dn];try{e[dn]=void 0;var r=!0}catch{}var o=Bu.call(e);return r&&(t?e[dn]=n:delete e[dn]),o}var Hu=Object.prototype,qu=Hu.toString;function Uu(e){return qu.call(e)}var Gu="[object Null]",Vu="[object Undefined]",Mi=Xn?Xn.toStringTag:void 0;function Wu(e){return e==null?e===void 0?Vu:Gu:Mi&&Mi in Object(e)?$u(e):Uu(e)}function Yu(e){return e!=null&&typeof e=="object"}var Xu="[object Symbol]";function Ku(e){return typeof e=="symbol"||Yu(e)&&Wu(e)==Xu}var Pi=NaN,Zu=/^[-+]0x[0-9a-f]+$/i,Qu=/^0b[01]+$/i,Ju=/^0o[0-7]+$/i,ef=parseInt;function Ai(e){if(typeof e=="number")return e;if(Ku(e))return Pi;if($r(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=$r(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Iu(e);var n=Qu.test(e);return n||Ju.test(e)?ef(e.slice(2),n?2:8):Zu.test(e)?Pi:+e}var tf="Expected a function",nf=Math.max,rf=Math.min;function of(e,t,n){var r,o,i,a,l,s,u=0,f=!1,c=!1,p=!0;if(typeof e!="function")throw new TypeError(tf);t=Ai(t)||0,$r(n)&&(f=!!n.leading,c="maxWait"in n,i=c?nf(Ai(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function h(b){var M=r,P=o;return r=o=void 0,u=b,a=e.apply(P,M),a}function d(b){return u=b,l=setTimeout(g,t),f?h(b):a}function m(b){var M=b-s,P=b-u,N=t-M;return c?rf(N,i-P):N}function v(b){var M=b-s,P=b-u;return s===void 0||M>=t||M<0||c&&P>=i}function g(){var b=Cr();if(v(b))return S(b);l=setTimeout(g,m(b))}function S(b){return l=void 0,p&&r?h(b):(r=o=void 0,a)}function _(){l!==void 0&&clearTimeout(l),u=0,r=s=o=l=void 0}function x(){return l===void 0?a:S(Cr())}function w(){var b=Cr(),M=v(b);if(r=arguments,o=this,s=b,M){if(l===void 0)return d(s);if(c)return clearTimeout(l),l=setTimeout(g,t),h(s)}return l===void 0&&(l=setTimeout(g,t)),a}return w.cancel=_,w.flush=x,w}function Oi(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function af(e){if(Array.isArray(e))return e}function sf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lf(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}function cf(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,l=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(f){u=!0,o=f}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function uf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
503
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ff(e,t){return af(e)||cf(e,t)||df(e,t)||uf()}function df(e,t){if(e){if(typeof e=="string")return Oi(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Oi(e,t):void 0}}var hf=lf(function e(t,n){var r=n.default,o=r===void 0?null:r,i=n.triggerUpdate,a=i===void 0?!0:i,l=n.onChange,s=l===void 0?function(u,f){}:l;sf(this,e),this.name=t,this.defaultVal=o,this.triggerUpdate=a,this.onChange=s});function _o(e){var t=e.stateInit,n=t===void 0?function(){return{}}:t,r=e.props,o=r===void 0?{}:r,i=e.methods,a=i===void 0?{}:i,l=e.aliases,s=l===void 0?{}:l,u=e.init,f=u===void 0?function(){}:u,c=e.update,p=c===void 0?function(){}:c,h=Object.keys(o).map(function(d){return new hf(d,o[d])});return function d(){for(var m=arguments.length,v=new Array(m),g=0;g<m;g++)v[g]=arguments[g];var S=!!(this instanceof d&&this.constructor),_=S?v.shift():void 0,x=v[0],w=x===void 0?{}:x,b=Object.assign({},n instanceof Function?n(w):n,{initialised:!1}),M={};function P(F){return N(F,w),j(),P}var N=function(I,K){f.call(P,I,b,K),b.initialised=!0},j=of(function(){b.initialised&&(p.call(P,b,M),M={})},1);return h.forEach(function(F){P[F.name]=I(F);function I(K){var O=K.name,y=K.triggerUpdate,k=y===void 0?!1:y,C=K.onChange,$=C===void 0?function(L,D){}:C,B=K.defaultVal,X=B===void 0?null:B;return function(L){var D=b[O];if(!arguments.length)return D;var q=L===void 0?X:L;return b[O]=q,$.call(P,q,b,D),!M.hasOwnProperty(O)&&(M[O]=D),k&&j(),P}}}),Object.keys(a).forEach(function(F){P[F]=function(){for(var I,K=arguments.length,O=new Array(K),y=0;y<K;y++)O[y]=arguments[y];return(I=a[F]).call.apply(I,[P,b].concat(O))}}),Object.entries(s).forEach(function(F){var I=ff(F,2),K=I[0],O=I[1];return P[K]=P[O]}),P.resetProps=function(){return h.forEach(function(F){P[F.name](F.defaultVal)}),P},P.resetProps(),b._rerender=j,S&&_&&P(_),P}}var de=function(e){return typeof e=="function"?e:typeof e=="string"?function(t){return t[e]}:function(t){return e}};class ji extends Map{constructor(t,n=vf){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,o]of t)this.set(r,o)}get(t){return super.get(zi(this,t))}has(t){return super.has(zi(this,t))}set(t,n){return super.set(pf(this,t),n)}delete(t){return super.delete(gf(this,t))}}function zi({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function pf({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function gf({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function vf(e){return e!==null&&typeof e=="object"?e.valueOf():e}function yf(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of e)(o=t(o,++r,e))!=null&&(n<o||n===void 0&&o>=o)&&(n=o)}return n}function mf(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of e)(o=t(o,++r,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function Hr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bf(e){if(Array.isArray(e))return e}function _f(e){if(Array.isArray(e))return Hr(e)}function Ha(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function xf(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function wf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function De(e,t){return e.get(Ha(e,t))}function Vt(e,t,n){xf(e,t),t.set(e,n)}function Bn(e,t,n){return e.set(Ha(e,t),n),n}function kf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Tf(r.key),r)}}function Cf(e,t,n){return t&&kf(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Sf(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Mf(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,l=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(f){u=!0,o=f}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function Pf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
504
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Af(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
505
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Of(e,t){return bf(e)||Mf(e,t)||qa(e,t)||Pf()}function jf(e){return _f(e)||Sf(e)||qa(e)||Af()}function zf(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Tf(e){var t=zf(e,"string");return typeof t=="symbol"?t:t+""}function qa(e,t){if(e){if(typeof e=="string")return Hr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hr(e,t):void 0}}var Wt=new WeakMap,hn=new WeakMap,Yt=new WeakMap,Sr=new WeakMap,Mr=new WeakMap,Pr=new WeakMap,Ef=function(){function e(){wf(this,e),Vt(this,Wt,new Map),Vt(this,hn,new Map),Vt(this,Yt,function(t){return t}),Vt(this,Sr,function(){return{}}),Vt(this,Mr,function(){}),Vt(this,Pr,function(){})}return Cf(e,[{key:"getObj",value:function(n){return De(Wt,this).get(De(Yt,this).call(this,n))}},{key:"getData",value:function(n){return De(hn,this).get(n)}},{key:"entries",value:function(){return jf(De(hn,this).entries()).map(function(n){var r=Of(n,2),o=r[0],i=r[1];return[i,o]})}},{key:"id",value:function(n){return Bn(Yt,this,de(n)),this}},{key:"onCreateObj",value:function(n){return Bn(Sr,this,n),this}},{key:"onUpdateObj",value:function(n){return Bn(Mr,this,n),this}},{key:"onRemoveObj",value:function(n){return Bn(Pr,this,n),this}},{key:"digest",value:function(n){var r=this;n.filter(function(i){return!De(Wt,r).has(De(Yt,r).call(r,i))}).forEach(function(i){var a=De(Sr,r).call(r,i);De(Wt,r).set(De(Yt,r).call(r,i),a),De(hn,r).set(a,i)});var o=new Map(n.map(function(i){return[De(Yt,r).call(r,i),i]}));return De(Wt,this).forEach(function(i,a){o.has(a)?De(Mr,r).call(r,i,o.get(a)):(De(Pr,r).call(r,i,a),De(Wt,r).delete(a),De(hn,r).delete(i))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])}();function Lf(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const Ti=Symbol("implicit");function Ua(){var e=new ji,t=[],n=[],r=Ti;function o(i){let a=e.get(i);if(a===void 0){if(r!==Ti)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return o.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new ji;for(const a of i)e.has(a)||e.set(a,t.push(a)-1);return o},o.range=function(i){return arguments.length?(n=Array.from(i),o):n.slice()},o.unknown=function(i){return arguments.length?(r=i,o):r},o.copy=function(){return Ua(t,n).unknown(r)},Lf.apply(o,arguments),o}function Nf(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}const Rf=Nf("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function Kn(e){"@babel/helpers - typeof";return Kn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kn(e)}var Df=/^\s+/,If=/\s+$/;function J(e,t){if(e=e||"",t=t||{},e instanceof J)return e;if(!(this instanceof J))return new J(e,t);var n=Ff(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}J.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),n,r,o,i,a,l;return n=t.r/255,r=t.g/255,o=t.b/255,n<=.03928?i=n/12.92:i=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),o<=.03928?l=o/12.92:l=Math.pow((o+.055)/1.055,2.4),.2126*i+.7152*a+.0722*l},setAlpha:function(t){return this._a=Ga(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=Li(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=Li(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),o=Math.round(t.v*100);return this._a==1?"hsv("+n+", "+r+"%, "+o+"%)":"hsva("+n+", "+r+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var t=Ei(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=Ei(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),o=Math.round(t.l*100);return this._a==1?"hsl("+n+", "+r+"%, "+o+"%)":"hsla("+n+", "+r+"%, "+o+"%, "+this._roundA+")"},toHex:function(t){return Ni(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return qf(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(we(this._r,255)*100)+"%",g:Math.round(we(this._g,255)*100)+"%",b:Math.round(we(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(we(this._r,255)*100)+"%, "+Math.round(we(this._g,255)*100)+"%, "+Math.round(we(this._b,255)*100)+"%)":"rgba("+Math.round(we(this._r,255)*100)+"%, "+Math.round(we(this._g,255)*100)+"%, "+Math.round(we(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:td[Ni(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+Ri(this._r,this._g,this._b,this._a),r=n,o=this._gradientType?"GradientType = 1, ":"";if(t){var i=J(t);r="#"+Ri(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+n+",endColorstr="+r+")"},toString:function(t){var n=!!t;t=t||this._format;var r=!1,o=this._a<1&&this._a>=0,i=!n&&o&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return i?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return J(this.toString())},_applyModification:function(t,n){var r=t.apply(null,[this].concat([].slice.call(n)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(Wf,arguments)},brighten:function(){return this._applyModification(Yf,arguments)},darken:function(){return this._applyModification(Xf,arguments)},desaturate:function(){return this._applyModification(Uf,arguments)},saturate:function(){return this._applyModification(Gf,arguments)},greyscale:function(){return this._applyModification(Vf,arguments)},spin:function(){return this._applyModification(Kf,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(Jf,arguments)},complement:function(){return this._applyCombination(Zf,arguments)},monochromatic:function(){return this._applyCombination(ed,arguments)},splitcomplement:function(){return this._applyCombination(Qf,arguments)},triad:function(){return this._applyCombination(Di,[3])},tetrad:function(){return this._applyCombination(Di,[4])}};J.fromRatio=function(e,t){if(Kn(e)=="object"){var n={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?n[r]=e[r]:n[r]=_n(e[r]));e=n}return J(e,t)};function Ff(e){var t={r:0,g:0,b:0},n=1,r=null,o=null,i=null,a=!1,l=!1;return typeof e=="string"&&(e=id(e)),Kn(e)=="object"&&(xt(e.r)&&xt(e.g)&&xt(e.b)?(t=Bf(e.r,e.g,e.b),a=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):xt(e.h)&&xt(e.s)&&xt(e.v)?(r=_n(e.s),o=_n(e.v),t=Hf(e.h,r,o),a=!0,l="hsv"):xt(e.h)&&xt(e.s)&&xt(e.l)&&(r=_n(e.s),i=_n(e.l),t=$f(e.h,r,i),a=!0,l="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=Ga(n),{ok:a,format:e.format||l,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function Bf(e,t,n){return{r:we(e,255)*255,g:we(t,255)*255,b:we(n,255)*255}}function Ei(e,t,n){e=we(e,255),t=we(t,255),n=we(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),i,a,l=(r+o)/2;if(r==o)i=a=0;else{var s=r-o;switch(a=l>.5?s/(2-r-o):s/(r+o),r){case e:i=(t-n)/s+(t<n?6:0);break;case t:i=(n-e)/s+2;break;case n:i=(e-t)/s+4;break}i/=6}return{h:i,s:a,l}}function $f(e,t,n){var r,o,i;e=we(e,360),t=we(t,100),n=we(n,100);function a(u,f,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?u+(f-u)*6*c:c<1/2?f:c<2/3?u+(f-u)*(2/3-c)*6:u}if(t===0)r=o=i=n;else{var l=n<.5?n*(1+t):n+t-n*t,s=2*n-l;r=a(s,l,e+1/3),o=a(s,l,e),i=a(s,l,e-1/3)}return{r:r*255,g:o*255,b:i*255}}function Li(e,t,n){e=we(e,255),t=we(t,255),n=we(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),i,a,l=r,s=r-o;if(a=r===0?0:s/r,r==o)i=0;else{switch(r){case e:i=(t-n)/s+(t<n?6:0);break;case t:i=(n-e)/s+2;break;case n:i=(e-t)/s+4;break}i/=6}return{h:i,s:a,v:l}}function Hf(e,t,n){e=we(e,360)*6,t=we(t,100),n=we(n,100);var r=Math.floor(e),o=e-r,i=n*(1-t),a=n*(1-o*t),l=n*(1-(1-o)*t),s=r%6,u=[n,a,i,i,l,n][s],f=[l,n,n,a,i,i][s],c=[i,i,l,n,n,a][s];return{r:u*255,g:f*255,b:c*255}}function Ni(e,t,n,r){var o=[ut(Math.round(e).toString(16)),ut(Math.round(t).toString(16)),ut(Math.round(n).toString(16))];return r&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function qf(e,t,n,r,o){var i=[ut(Math.round(e).toString(16)),ut(Math.round(t).toString(16)),ut(Math.round(n).toString(16)),ut(Va(r))];return o&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}function Ri(e,t,n,r){var o=[ut(Va(r)),ut(Math.round(e).toString(16)),ut(Math.round(t).toString(16)),ut(Math.round(n).toString(16))];return o.join("")}J.equals=function(e,t){return!e||!t?!1:J(e).toRgbString()==J(t).toRgbString()};J.random=function(){return J.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Uf(e,t){t=t===0?0:t||10;var n=J(e).toHsl();return n.s-=t/100,n.s=ar(n.s),J(n)}function Gf(e,t){t=t===0?0:t||10;var n=J(e).toHsl();return n.s+=t/100,n.s=ar(n.s),J(n)}function Vf(e){return J(e).desaturate(100)}function Wf(e,t){t=t===0?0:t||10;var n=J(e).toHsl();return n.l+=t/100,n.l=ar(n.l),J(n)}function Yf(e,t){t=t===0?0:t||10;var n=J(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),J(n)}function Xf(e,t){t=t===0?0:t||10;var n=J(e).toHsl();return n.l-=t/100,n.l=ar(n.l),J(n)}function Kf(e,t){var n=J(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,J(n)}function Zf(e){var t=J(e).toHsl();return t.h=(t.h+180)%360,J(t)}function Di(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=J(e).toHsl(),r=[J(e)],o=360/t,i=1;i<t;i++)r.push(J({h:(n.h+i*o)%360,s:n.s,l:n.l}));return r}function Qf(e){var t=J(e).toHsl(),n=t.h;return[J(e),J({h:(n+72)%360,s:t.s,l:t.l}),J({h:(n+216)%360,s:t.s,l:t.l})]}function Jf(e,t,n){t=t||6,n=n||30;var r=J(e).toHsl(),o=360/n,i=[J(e)];for(r.h=(r.h-(o*t>>1)+720)%360;--t;)r.h=(r.h+o)%360,i.push(J(r));return i}function ed(e,t){t=t||6;for(var n=J(e).toHsv(),r=n.h,o=n.s,i=n.v,a=[],l=1/t;t--;)a.push(J({h:r,s:o,v:i})),i=(i+l)%1;return a}J.mix=function(e,t,n){n=n===0?0:n||50;var r=J(e).toRgb(),o=J(t).toRgb(),i=n/100,a={r:(o.r-r.r)*i+r.r,g:(o.g-r.g)*i+r.g,b:(o.b-r.b)*i+r.b,a:(o.a-r.a)*i+r.a};return J(a)};J.readability=function(e,t){var n=J(e),r=J(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)};J.isReadable=function(e,t,n){var r=J.readability(e,t),o,i;switch(i=!1,o=ad(n),o.level+o.size){case"AAsmall":case"AAAlarge":i=r>=4.5;break;case"AAlarge":i=r>=3;break;case"AAAsmall":i=r>=7;break}return i};J.mostReadable=function(e,t,n){var r=null,o=0,i,a,l,s;n=n||{},a=n.includeFallbackColors,l=n.level,s=n.size;for(var u=0;u<t.length;u++)i=J.readability(e,t[u]),i>o&&(o=i,r=J(t[u]));return J.isReadable(e,r,{level:l,size:s})||!a?r:(n.includeFallbackColors=!1,J.mostReadable(e,["#fff","#000"],n))};var qr=J.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},td=J.hexNames=nd(qr);function nd(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function Ga(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function we(e,t){rd(e)&&(e="100%");var n=od(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function ar(e){return Math.min(1,Math.max(0,e))}function Ke(e){return parseInt(e,16)}function rd(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function od(e){return typeof e=="string"&&e.indexOf("%")!=-1}function ut(e){return e.length==1?"0"+e:""+e}function _n(e){return e<=1&&(e=e*100+"%"),e}function Va(e){return Math.round(parseFloat(e)*255).toString(16)}function Ii(e){return Ke(e)/255}var lt=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",o="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+o),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+o),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function xt(e){return!!lt.CSS_UNIT.exec(e)}function id(e){e=e.replace(Df,"").replace(If,"").toLowerCase();var t=!1;if(qr[e])e=qr[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=lt.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=lt.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=lt.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=lt.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=lt.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=lt.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=lt.hex8.exec(e))?{r:Ke(n[1]),g:Ke(n[2]),b:Ke(n[3]),a:Ii(n[4]),format:t?"name":"hex8"}:(n=lt.hex6.exec(e))?{r:Ke(n[1]),g:Ke(n[2]),b:Ke(n[3]),format:t?"name":"hex"}:(n=lt.hex4.exec(e))?{r:Ke(n[1]+""+n[1]),g:Ke(n[2]+""+n[2]),b:Ke(n[3]+""+n[3]),a:Ii(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=lt.hex3.exec(e))?{r:Ke(n[1]+""+n[1]),g:Ke(n[2]+""+n[2]),b:Ke(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function ad(e){var t,n;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:t,size:n}}function Ur(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function sd(e){if(Array.isArray(e))return e}function ld(e){if(Array.isArray(e))return Ur(e)}function Wa(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function cd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ya(e,t,n){return t=en(t),yd(e,xo()?Reflect.construct(t,n||[],en(e).constructor):t.apply(e,n))}function ud(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Xa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ar(e,t){return e.get(Wa(e,t))}function Fi(e,t,n){ud(e,t),t.set(e,n)}function Bi(e,t,n){return e.set(Wa(e,t),n),n}function Ka(e,t,n){if(xo())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return o}function fd(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ja(r.key),r)}}function Za(e,t,n){return t&&fd(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function sr(e,t,n){return(t=Ja(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gr(){return Gr=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=md(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},Gr.apply(null,arguments)}function en(e){return en=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},en(e)}function Qa(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Vr(e,t)}function xo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xo=function(){return!!e})()}function dd(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function hd(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,l=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(f){u=!0,o=f}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function pd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
506
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gd(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
507
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function vd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$i(Object(n),!0).forEach(function(r){sr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$i(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yd(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cd(e)}function Vr(e,t){return Vr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Vr(e,t)}function wn(e,t){return sd(e)||hd(e,t)||es(e,t)||pd()}function md(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=en(e))!==null;);return e}function Or(e,t,n,r){var o=Gr(en(e.prototype),t,n);return typeof o=="function"?function(i){return o.apply(n,i)}:o}function ct(e){return ld(e)||dd(e)||es(e)||gd()}function bd(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ja(e){var t=bd(e,"string");return typeof t=="symbol"?t:t+""}function Wr(e){"@babel/helpers - typeof";return Wr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wr(e)}function es(e,t){if(e){if(typeof e=="string")return Ur(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ur(e,t):void 0}}var ts=function(t){t instanceof Array?t.forEach(ts):(t.map&&t.map.dispose(),t.dispose())},wo=function(t){t.geometry&&t.geometry.dispose(),t.material&&ts(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(wo)},Hi=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),wo(n)}},jr=new WeakMap,$n=new WeakMap,pn=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=o.dataBindAttr,a=i===void 0?"__data":i,l=o.objBindAttr,s=l===void 0?"__threeObj":l;return Xa(this,t),r=Ya(this,t),sr(r,"scene",void 0),Fi(r,jr,void 0),Fi(r,$n,void 0),r.scene=n,Bi(jr,r,a),Bi($n,r,s),r.onRemoveObj(function(){}),r}return Qa(t,e),Za(t,[{key:"onCreateObj",value:function(r){var o=this;return Or(t,"onCreateObj",this)([function(i){var a=r(i);return i[Ar($n,o)]=a,a[Ar(jr,o)]=i,o.scene.add(a),a}]),this}},{key:"onRemoveObj",value:function(r){var o=this;return Or(t,"onRemoveObj",this)([function(i,a){var l=Or(t,"getData",o)([i]);r(i,a),o.scene.remove(i),wo(i),delete l[Ar($n,o)]}]),this}}])}(Ef),gn=function(t){return isNaN(t)?parseInt(J(t).toHex(),16):t},zr=function(t){return isNaN(t)?J(t).getAlpha():1},_d=Ua(Rf);function qi(e,t,n){!t||typeof n!="string"||e.filter(function(r){return!r[n]}).forEach(function(r){r[n]=_d(t(r))})}function xd(e,t){var n=e.nodes,r=e.links,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.nodeFilter,a=i===void 0?function(){return!0}:i,l=o.onLoopError,s=l===void 0?function(h){throw"Invalid DAG structure! Found cycle in node path: ".concat(h.join(" -> "),".")}:l,u={};n.forEach(function(h){return u[t(h)]={data:h,out:[],depth:-1,skip:!a(h)}}),r.forEach(function(h){var d=h.source,m=h.target,v=x(d),g=x(m);if(!u.hasOwnProperty(v))throw"Missing source node with id: ".concat(v);if(!u.hasOwnProperty(g))throw"Missing target node with id: ".concat(g);var S=u[v],_=u[g];S.out.push(_);function x(w){return Wr(w)==="object"?t(w):w}});var f=[];p(Object.values(u));var c=Object.assign.apply(Object,[{}].concat(ct(Object.entries(u).filter(function(h){var d=wn(h,2),m=d[1];return!m.skip}).map(function(h){var d=wn(h,2),m=d[0],v=d[1];return sr({},m,v.depth)}))));return c;function p(h){for(var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,v=function(){var x=h[g];if(d.indexOf(x)!==-1){var w=[].concat(ct(d.slice(d.indexOf(x))),[x]).map(function(b){return t(b.data)});return f.some(function(b){return b.length===w.length&&b.every(function(M,P){return M===w[P]})})||(f.push(w),s(w)),1}m>x.depth&&(x.depth=m,p(x.out,[].concat(ct(d),[x]),m+(x.skip?0:1)))},g=0,S=h.length;g<S;g++)v()}}var oe=window.THREE?window.THREE:{Group:re.Group,Mesh:re.Mesh,MeshLambertMaterial:re.MeshLambertMaterial,Color:re.Color,BufferGeometry:re.BufferGeometry,BufferAttribute:re.BufferAttribute,Matrix4:re.Matrix4,Vector3:re.Vector3,SphereGeometry:re.SphereGeometry,CylinderGeometry:re.CylinderGeometry,TubeGeometry:re.TubeGeometry,ConeGeometry:re.ConeGeometry,Line:re.Line,LineBasicMaterial:re.LineBasicMaterial,QuadraticBezierCurve3:re.QuadraticBezierCurve3,CubicBezierCurve3:re.CubicBezierCurve3,Box3:re.Box3},Ui={graph:Zc,forcelayout:Tu},wd=2,Tr=new oe.BufferGeometry().setAttribute?"setAttribute":"addAttribute",Hn=new oe.BufferGeometry().applyMatrix4?"applyMatrix4":"applyMatrix",kd=_o({props:{jsonUrl:{onChange:function(t,n){var r=this;t&&!n.fetchingJson&&(n.fetchingJson=!0,n.onLoading(),fetch(t).then(function(o){return o.json()}).then(function(o){n.fetchingJson=!1,n.onFinishLoading(o),r.graphData(o)}))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(t,n){n.engineRunning=!1}},numDimensions:{default:3,onChange:function(t,n){var r=n.d3ForceLayout.force("charge");r&&r.strength(t>2?-60:-30),t<3&&o(n.graphData.nodes,"z"),t<2&&o(n.graphData.nodes,"y");function o(i,a){i.forEach(function(l){delete l[a],delete l["v".concat(a)]})}}},dagMode:{onChange:function(t,n){!t&&n.forceEngine==="d3"&&(n.graphData.nodes||[]).forEach(function(r){return r.fx=r.fy=r.fz=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(t){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},nodePositionUpdate:{triggerUpdate:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},linkDirectionalParticleThreeObject:{},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaDecay(t)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaTarget(t)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.velocityDecay(t)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(t){return t._flushObjects=!0,t._rerender(),this},d3Force:function(t,n,r){return r===void 0?t.d3ForceLayout.force(n):(t.d3ForceLayout.force(n,r),this)},d3ReheatSimulation:function(t){return t.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(t){return t.cntTicks=0,t.startTickTime=new Date,t.engineRunning=!0,this},tickFrame:function(t){var n=t.forceEngine!=="ngraph";return t.engineRunning&&r(),o(),i(),this;function r(){++t.cntTicks>t.cooldownTicks||new Date-t.startTickTime>t.cooldownTime||n&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin?(t.engineRunning=!1,t.onEngineStop()):(t.layout[n?"tick":"step"](),t.onEngineTick());var a=de(t.nodeThreeObjectExtend);t.nodeDataMapper.entries().forEach(function(p){var h=wn(p,2),d=h[0],m=h[1];if(m){var v=n?d:t.layout.getNodePosition(d[t.nodeId]),g=a(d);(!t.nodePositionUpdate||!t.nodePositionUpdate(g?m.children[0]:m,{x:v.x,y:v.y,z:v.z},d)||g)&&(m.position.x=v.x,m.position.y=v.y||0,m.position.z=v.z||0)}});var l=de(t.linkWidth),s=de(t.linkCurvature),u=de(t.linkCurveRotation),f=de(t.linkThreeObjectExtend);t.linkDataMapper.entries().forEach(function(p){var h=wn(p,2),d=h[0],m=h[1];if(m){var v=n?d:t.layout.getLinkPosition(t.layout.graph.getLink(d.source,d.target).id),g=v[n?"source":"from"],S=v[n?"target":"to"];if(!(!g||!S||!g.hasOwnProperty("x")||!S.hasOwnProperty("x"))){c(d);var _=f(d);if(!(t.linkPositionUpdate&&t.linkPositionUpdate(_?m.children[1]:m,{start:{x:g.x,y:g.y,z:g.z},end:{x:S.x,y:S.y,z:S.z}},d)&&!_)){var x=30,w=d.__curve,b=m.children.length?m.children[0]:m;if(b.type==="Line"){if(w){var P=w.getPoints(x);b.geometry.getAttribute("position").array.length!==P.length*3&&b.geometry[Tr]("position",new oe.BufferAttribute(new Float32Array(P.length*3),3)),b.geometry.setFromPoints(P)}else{var M=b.geometry.getAttribute("position");(!M||!M.array||M.array.length!==6)&&b.geometry[Tr]("position",M=new oe.BufferAttribute(new Float32Array(2*3),3)),M.array[0]=g.x,M.array[1]=g.y||0,M.array[2]=g.z||0,M.array[3]=S.x,M.array[4]=S.y||0,M.array[5]=S.z||0,M.needsUpdate=!0}b.geometry.computeBoundingSphere()}else if(b.type==="Mesh")if(w){b.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(b.position.set(0,0,0),b.rotation.set(0,0,0),b.scale.set(1,1,1));var y=Math.ceil(l(d)*10)/10,k=y/2,C=new oe.TubeGeometry(w,x,k,t.linkResolution,!1);b.geometry.dispose(),b.geometry=C}else{if(!b.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var N=Math.ceil(l(d)*10)/10,j=N/2,F=new oe.CylinderGeometry(j,j,1,t.linkResolution,1,!1);F[Hn](new oe.Matrix4().makeTranslation(0,1/2,0)),F[Hn](new oe.Matrix4().makeRotationX(Math.PI/2)),b.geometry.dispose(),b.geometry=F}var I=new oe.Vector3(g.x,g.y||0,g.z||0),K=new oe.Vector3(S.x,S.y||0,S.z||0),O=I.distanceTo(K);b.position.x=I.x,b.position.y=I.y,b.position.z=I.z,b.scale.z=O,b.parent.localToWorld(K),b.lookAt(K)}}}}});function c(p){var h=n?p:t.layout.getLinkPosition(t.layout.graph.getLink(p.source,p.target).id),d=h[n?"source":"from"],m=h[n?"target":"to"];if(!(!d||!m||!d.hasOwnProperty("x")||!m.hasOwnProperty("x"))){var v=s(p);if(!v)p.__curve=null;else{var g=new oe.Vector3(d.x,d.y||0,d.z||0),S=new oe.Vector3(m.x,m.y||0,m.z||0),_=g.distanceTo(S),x,w=u(p);if(_>0){var b=m.x-d.x,M=m.y-d.y||0,P=new oe.Vector3().subVectors(S,g),N=P.clone().multiplyScalar(v).cross(b!==0||M!==0?new oe.Vector3(0,0,1):new oe.Vector3(0,1,0)).applyAxisAngle(P.normalize(),w).add(new oe.Vector3().addVectors(g,S).divideScalar(2));x=new oe.QuadraticBezierCurve3(g,N,S)}else{var j=v*70,F=-w,I=F+Math.PI/2;x=new oe.CubicBezierCurve3(g,new oe.Vector3(j*Math.cos(I),j*Math.sin(I),0).add(g),new oe.Vector3(j*Math.cos(F),j*Math.sin(F),0).add(g),S)}p.__curve=x}}}}function o(){var a=de(t.linkDirectionalArrowRelPos),l=de(t.linkDirectionalArrowLength),s=de(t.nodeVal);t.arrowDataMapper.entries().forEach(function(u){var f=wn(u,2),c=f[0],p=f[1];if(p){var h=n?c:t.layout.getLinkPosition(t.layout.graph.getLink(c.source,c.target).id),d=h[n?"source":"from"],m=h[n?"target":"to"];if(!(!d||!m||!d.hasOwnProperty("x")||!m.hasOwnProperty("x"))){var v=Math.cbrt(Math.max(0,s(d)||1))*t.nodeRelSize,g=Math.cbrt(Math.max(0,s(m)||1))*t.nodeRelSize,S=l(c),_=a(c),x=c.__curve?function(j){return c.__curve.getPoint(j)}:function(j){var F=function(K,O,y,k){return O[K]+(y[K]-O[K])*k||0};return{x:F("x",d,m,j),y:F("y",d,m,j),z:F("z",d,m,j)}},w=c.__curve?c.__curve.getLength():Math.sqrt(["x","y","z"].map(function(j){return Math.pow((m[j]||0)-(d[j]||0),2)}).reduce(function(j,F){return j+F},0)),b=v+S+(w-v-g-S)*_,M=x(b/w),P=x((b-S)/w);["x","y","z"].forEach(function(j){return p.position[j]=P[j]});var N=Ka(oe.Vector3,ct(["x","y","z"].map(function(j){return M[j]})));p.parent.localToWorld(N),p.lookAt(N)}}})}function i(){var a=de(t.linkDirectionalParticleSpeed),l=de(t.linkDirectionalParticleOffset);t.graphData.links.forEach(function(s){var u=t.particlesDataMapper.getObj(s),f=u&&u.children,c=s.__singleHopPhotonsObj&&s.__singleHopPhotonsObj.children;if(!((!c||!c.length)&&(!f||!f.length))){var p=n?s:t.layout.getLinkPosition(t.layout.graph.getLink(s.source,s.target).id),h=p[n?"source":"from"],d=p[n?"target":"to"];if(!(!h||!d||!h.hasOwnProperty("x")||!d.hasOwnProperty("x"))){var m=a(s),v=Math.abs(l(s)),g=s.__curve?function(_){return s.__curve.getPoint(_)}:function(_){var x=function(b,M,P,N){return M[b]+(P[b]-M[b])*N||0};return{x:x("x",h,d,_),y:x("y",h,d,_),z:x("z",h,d,_)}},S=[].concat(ct(f||[]),ct(c||[]));S.forEach(function(_,x){var w=_.parent.__linkThreeObjType==="singleHopPhotons";if(_.hasOwnProperty("__progressRatio")||(_.__progressRatio=w?m<0?1:0:(x+v)/f.length),_.__progressRatio+=m,_.__progressRatio>=1||_.__progressRatio<0)if(!w)_.__progressRatio=_.__progressRatio%1,_.__progressRatio<0&&_.__progressRatio++;else{_.parent.remove(_),Hi(_);return}var b=_.__progressRatio,M=g(b);_.geometry.type!=="SphereGeometry"&&_.lookAt(M.x,M.y,M.z),["x","y","z"].forEach(function(P){return _.position[P]=M[P]})})}}})}},emitParticle:function(t,n){if(n&&t.graphData.links.includes(n)){if(!n.__singleHopPhotonsObj){var r=new oe.Group;r.__linkThreeObjType="singleHopPhotons",n.__singleHopPhotonsObj=r,t.graphScene.add(r)}var o=de(t.linkDirectionalParticleThreeObject)(n);if(o&&t.linkDirectionalParticleThreeObject===o&&(o=o.clone()),!o){var i=de(t.linkDirectionalParticleWidth),a=Math.ceil(i(n)*10)/10/2,l=t.linkDirectionalParticleResolution,s=new oe.SphereGeometry(a,l,l),u=de(t.linkColor),f=de(t.linkDirectionalParticleColor),c=f(n)||u(n)||"#f0f0f0",p=new oe.Color(gn(c)),h=t.linkOpacity*3,d=new oe.MeshLambertMaterial({color:p,transparent:!0,opacity:h});o=new oe.Mesh(s,d)}n.__singleHopPhotonsObj.add(o)}return this},getGraphBbox:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0};if(!t.initialised)return null;var r=function o(i){var a=[];if(i.geometry){i.geometry.computeBoundingBox();var l=new oe.Box3;l.copy(i.geometry.boundingBox).applyMatrix4(i.matrixWorld),a.push(l)}return a.concat.apply(a,ct((i.children||[]).filter(function(s){return!s.hasOwnProperty("__graphObjType")||s.__graphObjType==="node"&&n(s.__data)}).map(o)))}(t.graphScene);return r.length?Object.assign.apply(Object,ct(["x","y","z"].map(function(o){return sr({},o,[mf(r,function(i){return i.min[o]}),yf(r,function(i){return i.max[o]})])}))):null}},stateInit:function(){return{d3ForceLayout:Uc().force("link",Oc()).force("charge",Gc()).force("center",jl()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(t,n){n.graphScene=t,n.nodeDataMapper=new pn(t,{objBindAttr:"__threeObj"}),n.linkDataMapper=new pn(t,{objBindAttr:"__lineObj"}),n.arrowDataMapper=new pn(t,{objBindAttr:"__arrowObj"}),n.particlesDataMapper=new pn(t,{objBindAttr:"__photonsObj"})},update:function(t,n){var r=function(H){return H.some(function(T){return n.hasOwnProperty(T)})};if(t.engineRunning=!1,typeof t.onUpdate=="function"&&t.onUpdate(),t.nodeAutoColorBy!==null&&r(["nodeAutoColorBy","graphData","nodeColor"])&&qi(t.graphData.nodes,de(t.nodeAutoColorBy),t.nodeColor),t.linkAutoColorBy!==null&&r(["linkAutoColorBy","graphData","linkColor"])&&qi(t.graphData.links,de(t.linkAutoColorBy),t.linkColor),t._flushObjects||r(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var o=de(t.nodeThreeObject),i=de(t.nodeThreeObjectExtend),a=de(t.nodeVal),l=de(t.nodeColor),s=de(t.nodeVisibility),u={},f={};(t._flushObjects||r(["nodeThreeObject","nodeThreeObjectExtend"]))&&t.nodeDataMapper.clear(),t.nodeDataMapper.onCreateObj(function(E){var H=o(E),T=i(E);H&&t.nodeThreeObject===H&&(H=H.clone());var W;return H&&!T?W=H:(W=new oe.Mesh,W.__graphDefaultObj=!0,H&&T&&W.add(H)),W.__graphObjType="node",W}).onUpdateObj(function(E,H){if(E.__graphDefaultObj){var T=a(H)||1,W=Math.cbrt(T)*t.nodeRelSize,V=t.nodeResolution;(!E.geometry.type.match(/^Sphere(Buffer)?Geometry$/)||E.geometry.parameters.radius!==W||E.geometry.parameters.widthSegments!==V)&&(u.hasOwnProperty(T)||(u[T]=new oe.SphereGeometry(W,V,V)),E.geometry.dispose(),E.geometry=u[T]);var G=l(H),U=new oe.Color(gn(G||"#ffffaa")),ee=t.nodeOpacity*zr(G);(E.material.type!=="MeshLambertMaterial"||!E.material.color.equals(U)||E.material.opacity!==ee)&&(f.hasOwnProperty(G)||(f[G]=new oe.MeshLambertMaterial({color:U,transparent:!0,opacity:ee})),E.material.dispose(),E.material=f[G])}}).digest(t.graphData.nodes.filter(s))}if(t._flushObjects||r(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject"])){var c=de(t.linkThreeObject),p=de(t.linkThreeObjectExtend),h=de(t.linkMaterial),d=de(t.linkVisibility),m=de(t.linkColor),v=de(t.linkWidth),g={},S={},_={},x=t.graphData.links.filter(d);if((t._flushObjects||r(["linkThreeObject","linkThreeObjectExtend","linkWidth"]))&&t.linkDataMapper.clear(),t.linkDataMapper.onRemoveObj(function(E){var H=E.__data&&E.__data.__singleHopPhotonsObj;H&&(H.parent.remove(H),Hi(H),delete E.__data.__singleHopPhotonsObj)}).onCreateObj(function(E){var H=c(E),T=p(E);H&&t.linkThreeObject===H&&(H=H.clone());var W;if(!H||T){var V=!!v(E);if(V)W=new oe.Mesh;else{var G=new oe.BufferGeometry;G[Tr]("position",new oe.BufferAttribute(new Float32Array(2*3),3)),W=new oe.Line(G)}}var U;return H?T?(U=new oe.Group,U.__graphDefaultObj=!0,U.add(W),U.add(H)):U=H:(U=W,U.__graphDefaultObj=!0),U.renderOrder=10,U.__graphObjType="link",U}).onUpdateObj(function(E,H){if(E.__graphDefaultObj){var T=E.children.length?E.children[0]:E,W=Math.ceil(v(H)*10)/10,V=!!W;if(V){var G=W/2,U=t.linkResolution;if(!T.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||T.geometry.parameters.radiusTop!==G||T.geometry.parameters.radialSegments!==U){if(!g.hasOwnProperty(W)){var ee=new oe.CylinderGeometry(G,G,1,U,1,!1);ee[Hn](new oe.Matrix4().makeTranslation(0,1/2,0)),ee[Hn](new oe.Matrix4().makeRotationX(Math.PI/2)),g[W]=ee}T.geometry.dispose(),T.geometry=g[W]}}var ne=h(H);if(ne)T.material=ne;else{var ie=m(H),le=new oe.Color(gn(ie||"#f0f0f0")),ae=t.linkOpacity*zr(ie),ce=V?"MeshLambertMaterial":"LineBasicMaterial";if(T.material.type!==ce||!T.material.color.equals(le)||T.material.opacity!==ae){var be=V?S:_;be.hasOwnProperty(ie)||(be[ie]=new oe[ce]({color:le,transparent:ae<1,opacity:ae,depthWrite:ae>=1})),T.material.dispose(),T.material=be[ie]}}}}).digest(x),t.linkDirectionalArrowLength||n.hasOwnProperty("linkDirectionalArrowLength")){var w=de(t.linkDirectionalArrowLength),b=de(t.linkDirectionalArrowColor);t.arrowDataMapper.onCreateObj(function(){var E=new oe.Mesh(void 0,new oe.MeshLambertMaterial({transparent:!0}));return E.__linkThreeObjType="arrow",E}).onUpdateObj(function(E,H){var T=w(H),W=t.linkDirectionalArrowResolution;if(!E.geometry.type.match(/^Cone(Buffer)?Geometry$/)||E.geometry.parameters.height!==T||E.geometry.parameters.radialSegments!==W){var V=new oe.ConeGeometry(T*.25,T,W);V.translate(0,T/2,0),V.rotateX(Math.PI/2),E.geometry.dispose(),E.geometry=V}var G=b(H)||m(H)||"#f0f0f0";E.material.color=new oe.Color(gn(G)),E.material.opacity=t.linkOpacity*3*zr(G)}).digest(x.filter(w))}if(t.linkDirectionalParticles||n.hasOwnProperty("linkDirectionalParticles")){var M=de(t.linkDirectionalParticles),P=de(t.linkDirectionalParticleWidth),N=de(t.linkDirectionalParticleColor),j=de(t.linkDirectionalParticleThreeObject),F={},I={};t.particlesDataMapper.onCreateObj(function(){var E=new oe.Group;return E.__linkThreeObjType="photons",E.__photonDataMapper=new pn(E),E}).onUpdateObj(function(E,H){var T=!!E.children.length&&E.children[0],W=j(H),V,G;if(W)V=W.geometry,G=W.material;else{var U=Math.ceil(P(H)*10)/10/2,ee=t.linkDirectionalParticleResolution;T&&T.geometry.parameters.radius===U&&T.geometry.parameters.widthSegments===ee?V=T.geometry:(I.hasOwnProperty(U)||(I[U]=new oe.SphereGeometry(U,ee,ee)),V=I[U]);var ne=N(H)||m(H)||"#f0f0f0",ie=new oe.Color(gn(ne)),le=t.linkOpacity*3;T&&T.material.color.equals(ie)&&T.material.opacity===le?G=T.material:(F.hasOwnProperty(ne)||(F[ne]=new oe.MeshLambertMaterial({color:ie,transparent:!0,opacity:le})),G=F[ne])}T&&(T.geometry!==V&&T.geometry.dispose(),T.material!==G&&T.material.dispose());var ae=Math.round(Math.abs(M(H)));E.__photonDataMapper.id(function(ce){return ce.idx}).onCreateObj(function(){return new oe.Mesh(V,G)}).onUpdateObj(function(ce){ce.geometry=V,ce.material=G}).digest(ct(new Array(ae)).map(function(ce,be){return{idx:be}}))}).digest(x.filter(M))}}if(t._flushObjects=!1,r(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach(function(E){E.source=E[t.linkSource],E.target=E[t.linkTarget]});var K=t.forceEngine!=="ngraph",O;if(K){(O=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var y=t.d3ForceLayout.force("link");y&&y.id(function(E){return E[t.nodeId]}).links(t.graphData.links);var k=t.dagMode&&xd(t.graphData,function(E){return E[t.nodeId]},{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),C=Math.max.apply(Math,ct(Object.values(k||[]))),$=t.dagLevelDistance||t.graphData.nodes.length/(C||1)*wd*(["radialin","radialout"].indexOf(t.dagMode)!==-1?.7:1);if(["lr","rl","td","bu","zin","zout"].includes(n.dagMode)){var B=["lr","rl"].includes(n.dagMode)?"fx":["td","bu"].includes(n.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(E){return delete E[B]})}if(["lr","rl","td","bu","zin","zout"].includes(t.dagMode)){var X=["rl","td","zout"].includes(t.dagMode),L=function(H){return(k[H[t.nodeId]]-C/2)*$*(X?-1:1)},D=["lr","rl"].includes(t.dagMode)?"fx":["td","bu"].includes(t.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(E){return E[D]=L(E)})}t.d3ForceLayout.force("dagRadial",["radialin","radialout"].indexOf(t.dagMode)!==-1?Vc(function(E){var H=k[E[t.nodeId]]||-1;return(t.dagMode==="radialin"?C-H:H)*$}).strength(function(E){return t.dagNodeFilter(E)?1:0}):null)}else{var q=Ui.graph();t.graphData.nodes.forEach(function(E){q.addNode(E[t.nodeId])}),t.graphData.links.forEach(function(E){q.addLink(E.source,E.target)}),O=Ui.forcelayout(q,vd({dimensions:t.numDimensions},t.ngraphPhysics)),O.graph=q}for(var Y=0;Y<t.warmupTicks&&!(K&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);Y++)O[K?"tick":"step"]();t.layout=O,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}});function Cd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=function(o){function i(){var a;Xa(this,i);for(var l=arguments.length,s=new Array(l),u=0;u<l;u++)s[u]=arguments[u];return a=Ya(this,i,[].concat(s)),a.__kapsuleInstance=Ka(e,[].concat(ct(n?[a]:[]),s)),a}return Qa(i,o),Za(i)}(t);return Object.keys(e()).forEach(function(o){return r.prototype[o]=function(){var i,a=(i=this.__kapsuleInstance)[o].apply(i,arguments);return a===this.__kapsuleInstance?this:a}}),r}var Sd=window.THREE?window.THREE:{Group:re.Group},ns=Cd(kd,Sd.Group,!0);function Ge(){return Ge=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ge.apply(null,arguments)}function Md(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mn(e,t){return Mn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Mn(e,t)}function Pd(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Mn(e,t)}function Yr(e){return Yr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yr(e)}function Ad(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function rs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rs=function(){return!!e})()}function Od(e,t,n){if(rs())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&Mn(o,n.prototype),o}function Xr(e){var t=typeof Map=="function"?new Map:void 0;return Xr=function(r){if(r===null||!Ad(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(r))return t.get(r);t.set(r,o)}function o(){return Od(r,arguments,Yr(this).constructor)}return o.prototype=Object.create(r.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Mn(o,r)},Xr(e)}var jd={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
508
508
 
509
509
  `,2:`Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).
510
510
 
@@ -652,8 +652,8 @@ To pass a single animation please supply them in simple values, e.g. animation('
652
652
  `,77:`remToPx expects a value in "rem" but you provided it in "%s".
653
653
 
654
654
  `,78:`base must be set in "px" or "%" but you set it in "%s".
655
- `};function ud(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t[0],i=[],o;for(o=1;o<t.length;o+=1)i.push(t[o]);return i.forEach(function(a){r=r.replace(/%[a-z]/,a)}),r}var Qe=function(e){ad(t,e);function t(n){var r;if(process.env.NODE_ENV==="production")r=e.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+n+" for more information.")||this;else{for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];r=e.call(this,ud.apply(void 0,[cd[n]].concat(o)))||this}return od(r)}return t}(Lr(Error));function br(e){return Math.round(e*255)}function fd(e,t,n){return br(e)+","+br(t)+","+br(n)}function Ln(e,t,n,r){if(r===void 0&&(r=fd),t===0)return r(n,n,n);var i=(e%360+360)%360/60,o=(1-Math.abs(2*n-1))*t,a=o*(1-Math.abs(i%2-1)),s=0,l=0,c=0;i>=0&&i<1?(s=o,l=a):i>=1&&i<2?(s=a,l=o):i>=2&&i<3?(l=o,c=a):i>=3&&i<4?(l=a,c=o):i>=4&&i<5?(s=a,c=o):i>=5&&i<6&&(s=o,c=a);var f=n-o/2,u=s+f,g=l+f,h=c+f;return r(u,g,h)}var Ao={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function dd(e){if(typeof e!="string")return e;var t=e.toLowerCase();return Ao[t]?"#"+Ao[t]:e}var hd=/^#[a-fA-F0-9]{6}$/,pd=/^#[a-fA-F0-9]{8}$/,gd=/^#[a-fA-F0-9]{3}$/,vd=/^#[a-fA-F0-9]{4}$/,_r=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,yd=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,md=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,bd=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function Rt(e){if(typeof e!="string")throw new Qe(3);var t=dd(e);if(t.match(hd))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(pd)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(gd))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(vd)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var i=_r.exec(t);if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10)};var o=yd.exec(t.substring(0,50));if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10),alpha:parseFloat(""+o[4])>1?parseFloat(""+o[4])/100:parseFloat(""+o[4])};var a=md.exec(t);if(a){var s=parseInt(""+a[1],10),l=parseInt(""+a[2],10)/100,c=parseInt(""+a[3],10)/100,f="rgb("+Ln(s,l,c)+")",u=_r.exec(f);if(!u)throw new Qe(4,t,f);return{red:parseInt(""+u[1],10),green:parseInt(""+u[2],10),blue:parseInt(""+u[3],10)}}var g=bd.exec(t.substring(0,50));if(g){var h=parseInt(""+g[1],10),p=parseInt(""+g[2],10)/100,v=parseInt(""+g[3],10)/100,y="rgb("+Ln(h,p,v)+")",d=_r.exec(y);if(!d)throw new Qe(4,t,y);return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10),alpha:parseFloat(""+g[4])>1?parseFloat(""+g[4])/100:parseFloat(""+g[4])}}throw new Qe(5)}function _d(e){var t=e.red/255,n=e.green/255,r=e.blue/255,i=Math.max(t,n,r),o=Math.min(t,n,r),a=(i+o)/2;if(i===o)return e.alpha!==void 0?{hue:0,saturation:0,lightness:a,alpha:e.alpha}:{hue:0,saturation:0,lightness:a};var s,l=i-o,c=a>.5?l/(2-i-o):l/(i+o);switch(i){case t:s=(n-r)/l+(n<r?6:0);break;case n:s=(r-t)/l+2;break;default:s=(t-n)/l+4;break}return s*=60,e.alpha!==void 0?{hue:s,saturation:c,lightness:a,alpha:e.alpha}:{hue:s,saturation:c,lightness:a}}function dt(e){return _d(Rt(e))}var xd=function(t){return t.length===7&&t[1]===t[2]&&t[3]===t[4]&&t[5]===t[6]?"#"+t[1]+t[3]+t[5]:t},Nr=xd;function mt(e){var t=e.toString(16);return t.length===1?"0"+t:t}function xr(e){return mt(Math.round(e*255))}function wd(e,t,n){return Nr("#"+xr(e)+xr(t)+xr(n))}function Fa(e,t,n){return Ln(e,t,n,wd)}function kd(e,t,n){if(typeof e=="object"&&t===void 0&&n===void 0)return Fa(e.hue,e.saturation,e.lightness);throw new Qe(1)}function Cd(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?Fa(e.hue,e.saturation,e.lightness):"rgba("+Ln(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new Qe(2)}function Ba(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return Nr("#"+mt(e)+mt(t)+mt(n));if(typeof e=="object"&&t===void 0&&n===void 0)return Nr("#"+mt(e.red)+mt(e.green)+mt(e.blue));throw new Qe(6)}function qn(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?Ba(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new Qe(7)}var Sd=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Md=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&typeof t.alpha=="number"},Pd=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Od=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&typeof t.alpha=="number"};function ht(e){if(typeof e!="object")throw new Qe(8);if(Md(e))return qn(e);if(Sd(e))return Ba(e);if(Od(e))return Cd(e);if(Pd(e))return kd(e);throw new Qe(8)}function $a(e,t,n){return function(){var i=n.concat(Array.prototype.slice.call(arguments));return i.length>=t?e.apply(this,i):$a(e,t,i)}}function De(e){return $a(e,e.length,[])}function Ad(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{hue:n.hue+parseFloat(e)}))}De(Ad);function Ft(e,t,n){return Math.max(e,Math.min(t,n))}function jd(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{lightness:Ft(0,1,n.lightness-parseFloat(e))}))}De(jd);function Td(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{saturation:Ft(0,1,n.saturation-parseFloat(e))}))}De(Td);function Ed(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{lightness:Ft(0,1,n.lightness+parseFloat(e))}))}De(Ed);function Ld(e,t,n){if(t==="transparent")return n;if(n==="transparent")return t;if(e===0)return n;var r=Rt(t),i=Le({},r,{alpha:typeof r.alpha=="number"?r.alpha:1}),o=Rt(n),a=Le({},o,{alpha:typeof o.alpha=="number"?o.alpha:1}),s=i.alpha-a.alpha,l=parseFloat(e)*2-1,c=l*s===-1?l:l+s,f=1+l*s,u=(c/f+1)/2,g=1-u,h={red:Math.floor(i.red*u+a.red*g),green:Math.floor(i.green*u+a.green*g),blue:Math.floor(i.blue*u+a.blue*g),alpha:i.alpha*parseFloat(e)+a.alpha*(1-parseFloat(e))};return qn(h)}var Nd=De(Ld),Ha=Nd;function Rd(e,t){if(t==="transparent")return t;var n=Rt(t),r=typeof n.alpha=="number"?n.alpha:1,i=Le({},n,{alpha:Ft(0,1,(r*100+parseFloat(e)*100)/100)});return qn(i)}var Id=De(Rd),Dd=Id;function zd(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{saturation:Ft(0,1,n.saturation+parseFloat(e))}))}De(zd);function Fd(e,t){return t==="transparent"?t:ht(Le({},dt(t),{hue:parseFloat(e)}))}De(Fd);function Bd(e,t){return t==="transparent"?t:ht(Le({},dt(t),{lightness:parseFloat(e)}))}De(Bd);function $d(e,t){return t==="transparent"?t:ht(Le({},dt(t),{saturation:parseFloat(e)}))}De($d);function Hd(e,t){return t==="transparent"?t:Ha(parseFloat(e),"rgb(0, 0, 0)",t)}De(Hd);function Ud(e,t){return t==="transparent"?t:Ha(parseFloat(e),"rgb(255, 255, 255)",t)}De(Ud);function qd(e,t){if(t==="transparent")return t;var n=Rt(t),r=typeof n.alpha=="number"?n.alpha:1,i=Le({},n,{alpha:Ft(0,1,+(r*100-parseFloat(e)*100).toFixed(2)/100)});return qn(i)}De(qd);var bt=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-bt.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?bt.Bounce.In(e*2)*.5:bt.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),nn=function(){return performance.now()},Ua=function(){function e(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(n){return t._tweens[n]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i=0,o=n;i<o.length;i++){var a=o[i];(t=a._group)===null||t===void 0||t.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},e.prototype.remove=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,i=t;r<i.length;r++){var o=i[r];o._group=void 0,delete this._tweens[o.getId()],delete this._tweensAddedDuringUpdate[o.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},e.prototype.update=function(t,n){t===void 0&&(t=nn()),n===void 0&&(n=!0);var r=Object.keys(this._tweens);if(r.length!==0)for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<r.length;i++){var o=this._tweens[r[i]],a=!n;o&&o.update(t,a)===!1&&!n&&this.remove(o)}r=Object.keys(this._tweensAddedDuringUpdate)}},e}(),Rr={Linear:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),o=Rr.Utils.Linear;return t<0?o(e[0],e[1],r):t>1?o(e[n],e[n-1],n-r):o(e[i],e[i+1>n?n:i+1],r-i)},Utils:{Linear:function(e,t,n){return(t-e)*n+e}}},qa=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Ir=new Ua,jo=function(){function e(t,n){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=bt.Linear.None,this._interpolationFunction=Rr.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=qa.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof n=="object"?(this._group=n,n.add(this)):n===!0&&(this._group=Ir,Ir.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,n){if(n===void 0&&(n=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=n<0?0:n,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,n){if(t===void 0&&(t=nn()),n===void 0&&(n=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||n){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var o in this._valuesEnd)i[o]=this._valuesEnd[o];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,n)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,n,r,i,o){for(var a in r){var s=t[a],l=Array.isArray(s),c=l?"array":typeof s,f=!l&&Array.isArray(r[a]);if(!(c==="undefined"||c==="function")){if(f){var u=r[a];if(u.length===0)continue;for(var g=[s],h=0,p=u.length;h<p;h+=1){var v=this._handleRelativeValue(s,u[h]);if(isNaN(v)){f=!1,console.warn("Found invalid interpolation list. Skipping.");break}g.push(v)}f&&(r[a]=g)}if((c==="object"||l)&&s&&!f){n[a]=l?[]:{};var y=s;for(var d in y)n[a][d]=y[d];i[a]=l?[]:{};var u=r[a];if(!this._isDynamic){var b={};for(var d in u)b[d]=u[d];r[a]=u=b}this._setupProperties(y,n[a],u,i[a],o)}else(typeof n[a]>"u"||o)&&(n[a]=s),l||(n[a]*=1),f?i[a]=r[a].slice().reverse():i[a]=n[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(t){return t===void 0&&(t=nn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=nn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,n=this._chainedTweens.length;t<n;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},e.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},e.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},e.prototype.easing=function(t){return t===void 0&&(t=bt.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=Rr.Linear),this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,n){var r=this,i;if(t===void 0&&(t=nn()),n===void 0&&(n=e.autoStartOnUpdate),this._isPaused)return!0;var o;if(!this._goToEnd&&!this._isPlaying)if(n)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=t-this._startTime,s=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),l=this._duration+this._repeat*s,c=function(){if(r._duration===0||a>l)return 1;var v=Math.trunc(a/s),y=a-v*s,d=Math.min(y/r._duration,1);return d===0&&a===r._duration?1:d},f=c(),u=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,u),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||a>=this._duration)if(this._repeat>0){var g=Math.min(Math.trunc((a-this._duration)/s)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=g);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=s*g,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var h=0,p=this._chainedTweens.length;h<p;h++)this._chainedTweens[h].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,n,r,i){for(var o in r)if(n[o]!==void 0){var a=n[o]||0,s=r[o],l=Array.isArray(t[o]),c=Array.isArray(s),f=!l&&c;f?t[o]=this._interpolationFunction(s,i):typeof s=="object"&&s?this._updateProperties(t[o],a,s,i):(s=this._handleRelativeValue(a,s),typeof s=="number"&&(t[o]=a+(s-a)*i))}},e.prototype._handleRelativeValue=function(t,n){return typeof n!="string"?n:n.charAt(0)==="+"||n.charAt(0)==="-"?t+parseFloat(n):parseFloat(n)},e.prototype._swapEndStartRepeatValues=function(t){var n=this._valuesStartRepeat[t],r=this._valuesEnd[t];typeof r=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(r):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=n},e.autoStartOnUpdate=!1,e}();qa.nextId;var Je=Ir;Je.getAll.bind(Je);Je.removeAll.bind(Je);Je.add.bind(Je);Je.remove.bind(Je);Je.update.bind(Je);var Dr="http://www.w3.org/1999/xhtml";const To={svg:"http://www.w3.org/2000/svg",xhtml:Dr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Va(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),To.hasOwnProperty(t)?{space:To[t],local:e}:e}function Vd(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Dr&&t.documentElement.namespaceURI===Dr?t.createElement(e):t.createElementNS(n,e)}}function Gd(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ga(e){var t=Va(e);return(t.local?Gd:Vd)(t)}function Wd(){}function Wa(e){return e==null?Wd:function(){return this.querySelector(e)}}function Xd(e){typeof e!="function"&&(e=Wa(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=new Array(a),l,c,f=0;f<a;++f)(l=o[f])&&(c=e.call(l,l.__data__,f,o))&&("__data__"in l&&(c.__data__=l.__data__),s[f]=c);return new Ve(r,this._parents)}function Yd(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Kd(){return[]}function Qd(e){return e==null?Kd:function(){return this.querySelectorAll(e)}}function Zd(e){return function(){return Yd(e.apply(this,arguments))}}function Jd(e){typeof e=="function"?e=Zd(e):e=Qd(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var a=t[o],s=a.length,l,c=0;c<s;++c)(l=a[c])&&(r.push(e.call(l,l.__data__,c,a)),i.push(l));return new Ve(r,i)}function eh(e){return function(){return this.matches(e)}}function Xa(e){return function(t){return t.matches(e)}}var th=Array.prototype.find;function nh(e){return function(){return th.call(this.children,e)}}function rh(){return this.firstElementChild}function ih(e){return this.select(e==null?rh:nh(typeof e=="function"?e:Xa(e)))}var oh=Array.prototype.filter;function ah(){return Array.from(this.children)}function sh(e){return function(){return oh.call(this.children,e)}}function lh(e){return this.selectAll(e==null?ah:sh(typeof e=="function"?e:Xa(e)))}function ch(e){typeof e!="function"&&(e=eh(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],l,c=0;c<a;++c)(l=o[c])&&e.call(l,l.__data__,c,o)&&s.push(l);return new Ve(r,this._parents)}function Ya(e){return new Array(e.length)}function uh(){return new Ve(this._enter||this._groups.map(Ya),this._parents)}function Nn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Nn.prototype={constructor:Nn,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 fh(e){return function(){return e}}function dh(e,t,n,r,i,o){for(var a=0,s,l=t.length,c=o.length;a<c;++a)(s=t[a])?(s.__data__=o[a],r[a]=s):n[a]=new Nn(e,o[a]);for(;a<l;++a)(s=t[a])&&(i[a]=s)}function hh(e,t,n,r,i,o,a){var s,l,c=new Map,f=t.length,u=o.length,g=new Array(f),h;for(s=0;s<f;++s)(l=t[s])&&(g[s]=h=a.call(l,l.__data__,s,t)+"",c.has(h)?i[s]=l:c.set(h,l));for(s=0;s<u;++s)h=a.call(e,o[s],s,o)+"",(l=c.get(h))?(r[s]=l,l.__data__=o[s],c.delete(h)):n[s]=new Nn(e,o[s]);for(s=0;s<f;++s)(l=t[s])&&c.get(g[s])===l&&(i[s]=l)}function ph(e){return e.__data__}function gh(e,t){if(!arguments.length)return Array.from(this,ph);var n=t?hh:dh,r=this._parents,i=this._groups;typeof e!="function"&&(e=fh(e));for(var o=i.length,a=new Array(o),s=new Array(o),l=new Array(o),c=0;c<o;++c){var f=r[c],u=i[c],g=u.length,h=vh(e.call(f,f&&f.__data__,c,r)),p=h.length,v=s[c]=new Array(p),y=a[c]=new Array(p),d=l[c]=new Array(g);n(f,u,v,y,d,h,t);for(var b=0,m=0,x,w;b<p;++b)if(x=v[b]){for(b>=m&&(m=b+1);!(w=y[m])&&++m<p;);x._next=w||null}}return a=new Ve(a,r),a._enter=s,a._exit=l,a}function vh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yh(){return new Ve(this._exit||this._groups.map(Ya),this._parents)}function mh(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function bh(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),l=0;l<a;++l)for(var c=n[l],f=r[l],u=c.length,g=s[l]=new Array(u),h,p=0;p<u;++p)(h=c[p]||f[p])&&(g[p]=h);for(;l<i;++l)s[l]=n[l];return new Ve(s,this._parents)}function _h(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],a;--i>=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function xh(e){e||(e=wh);function t(u,g){return u&&g?e(u.__data__,g.__data__):!u-!g}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a=n[o],s=a.length,l=i[o]=new Array(s),c,f=0;f<s;++f)(c=a[f])&&(l[f]=c);l.sort(t)}return new Ve(i,this._parents).order()}function wh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function kh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ch(){return Array.from(this)}function Sh(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null}function Mh(){let e=0;for(const t of this)++e;return e}function Ph(){return!this.node()}function Oh(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,a=i.length,s;o<a;++o)(s=i[o])&&e.call(s,s.__data__,o,i);return this}function Ah(e){return function(){this.removeAttribute(e)}}function jh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Th(e,t){return function(){this.setAttribute(e,t)}}function Eh(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Lh(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Nh(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 Rh(e,t){var n=Va(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?jh:Ah:typeof t=="function"?n.local?Nh:Lh:n.local?Eh:Th)(n,t))}function Ka(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ih(e){return function(){this.style.removeProperty(e)}}function Dh(e,t,n){return function(){this.style.setProperty(e,t,n)}}function zh(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Fh(e,t,n){return arguments.length>1?this.each((t==null?Ih:typeof t=="function"?zh:Dh)(e,t,n??"")):Bh(this.node(),e)}function Bh(e,t){return e.style.getPropertyValue(t)||Ka(e).getComputedStyle(e,null).getPropertyValue(t)}function $h(e){return function(){delete this[e]}}function Hh(e,t){return function(){this[e]=t}}function Uh(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function qh(e,t){return arguments.length>1?this.each((t==null?$h:typeof t=="function"?Uh:Hh)(e,t)):this.node()[e]}function Qa(e){return e.trim().split(/^|\s+/)}function ai(e){return e.classList||new Za(e)}function Za(e){this._node=e,this._names=Qa(e.getAttribute("class")||"")}Za.prototype={add:function(e){var t=this._names.indexOf(e);t<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 Ja(e,t){for(var n=ai(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function es(e,t){for(var n=ai(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Vh(e){return function(){Ja(this,e)}}function Gh(e){return function(){es(this,e)}}function Wh(e,t){return function(){(t.apply(this,arguments)?Ja:es)(this,e)}}function Xh(e,t){var n=Qa(e+"");if(arguments.length<2){for(var r=ai(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Wh:t?Vh:Gh)(n,t))}function Yh(){this.textContent=""}function Kh(e){return function(){this.textContent=e}}function Qh(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Zh(e){return arguments.length?this.each(e==null?Yh:(typeof e=="function"?Qh:Kh)(e)):this.node().textContent}function Jh(){this.innerHTML=""}function ep(e){return function(){this.innerHTML=e}}function tp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function np(e){return arguments.length?this.each(e==null?Jh:(typeof e=="function"?tp:ep)(e)):this.node().innerHTML}function rp(){this.nextSibling&&this.parentNode.appendChild(this)}function ip(){return this.each(rp)}function op(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ap(){return this.each(op)}function sp(e){var t=typeof e=="function"?e:Ga(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function lp(){return null}function cp(e,t){var n=typeof e=="function"?e:Ga(e),r=t==null?lp:typeof t=="function"?t:Wa(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function up(){var e=this.parentNode;e&&e.removeChild(this)}function fp(){return this.each(up)}function dp(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pp(e){return this.select(e?hp:dp)}function gp(e){return arguments.length?this.property("__data__",e):this.node().__data__}function vp(e){return function(t){e.call(this,t,this.__data__)}}function yp(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function mp(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function bp(e,t,n){return function(){var r=this.__on,i,o=vp(t);if(r){for(var a=0,s=r.length;a<s;++a)if((i=r[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function _p(e,t,n){var r=yp(e+""),i,o=r.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,c=s.length,f;l<c;++l)for(i=0,f=s[l];i<o;++i)if((a=r[i]).type===f.type&&a.name===f.name)return f.value}return}for(s=t?bp:mp,i=0;i<o;++i)this.each(s(r[i],t,n));return this}function ts(e,t,n){var r=Ka(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 xp(e,t){return function(){return ts(this,e,t)}}function wp(e,t){return function(){return ts(this,e,t.apply(this,arguments))}}function kp(e,t){return this.each((typeof t=="function"?wp:xp)(e,t))}function*Cp(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,a;i<o;++i)(a=r[i])&&(yield a)}var Sp=[null];function Ve(e,t){this._groups=e,this._parents=t}function Mp(){return this}Ve.prototype={constructor:Ve,select:Xd,selectAll:Jd,selectChild:ih,selectChildren:lh,filter:ch,data:gh,enter:uh,exit:yh,join:mh,merge:bh,selection:Mp,order:_h,sort:xh,call:kh,nodes:Ch,node:Sh,size:Mh,empty:Ph,each:Oh,attr:Rh,style:Fh,property:qh,classed:Xh,text:Zh,html:np,raise:ip,lower:ap,append:sp,insert:cp,remove:fp,clone:pp,datum:gp,on:_p,dispatch:kp,[Symbol.iterator]:Cp};function Pp(e){return typeof e=="string"?new Ve([[document.querySelector(e)]],[document.documentElement]):new Ve([[e]],Sp)}function Op(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ap(e,t){if(e=Op(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 un,ge,ns,rs,ut,Eo,is,os,wr,Pn,on,as,si,zr,Fr,Rn={},In=[],jp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Vn=Array.isArray;function Ze(e,t){for(var n in t)e[n]=t[n];return e}function li(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Tp(e,t,n){var r,i,o,a={};for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?un.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return an(e,a,r,i,null)}function an(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++ns,__i:-1,__u:0};return i==null&&ge.vnode!=null&&ge.vnode(o),o}function Gn(e){return e.children}function On(e,t){this.props=e,this.context=t}function It(e,t){if(t==null)return e.__?It(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?It(e):null}function Ep(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=Ze({},t);o.__v=t.__v+1,ge.vnode&&ge.vnode(o),ci(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??It(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,us(r,o,i),t.__e=t.__=null,o.__e!=n&&ss(o)}}function ss(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),ss(e)}function Lo(e){(!e.__d&&(e.__d=!0)&&ut.push(e)&&!Dn.__r++||Eo!=ge.debounceRendering)&&((Eo=ge.debounceRendering)||is)(Dn)}function Dn(){try{for(var e,t=1;ut.length;)ut.length>t&&ut.sort(os),e=ut.shift(),t=ut.length,Ep(e)}finally{ut.length=Dn.__r=0}}function ls(e,t,n,r,i,o,a,s,l,c,f){var u,g,h,p,v,y,d,b=r&&r.__k||In,m=t.length;for(l=Lp(n,t,b,l,m),u=0;u<m;u++)(h=n.__k[u])!=null&&(g=h.__i!=-1&&b[h.__i]||Rn,h.__i=u,y=ci(e,h,g,i,o,a,s,l,c,f),p=h.__e,h.ref&&g.ref!=h.ref&&(g.ref&&ui(g.ref,null,h),f.push(h.ref,h.__c||p,h)),v==null&&p!=null&&(v=p),(d=!!(4&h.__u))||g.__k===h.__k?(l=cs(h,l,e,d),d&&g.__e&&(g.__e=null)):typeof h.type=="function"&&y!==void 0?l=y:p&&(l=p.nextSibling),h.__u&=-7);return n.__e=v,l}function Lp(e,t,n,r,i){var o,a,s,l,c,f=n.length,u=f,g=0;for(e.__k=new Array(i),o=0;o<i;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=an(null,a,null,null,null):Vn(a)?a=e.__k[o]=an(Gn,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=an(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,l=o+g,a.__=e,a.__b=e.__b+1,s=null,(c=a.__i=Np(a,n,l,u))!=-1&&(u--,(s=n[c])&&(s.__u|=2)),s==null||s.__v==null?(c==-1&&(i>f?g--:i<f&&g++),typeof a.type!="function"&&(a.__u|=4)):c!=l&&(c==l-1?g--:c==l+1?g++:(c>l?g--:g++,a.__u|=4))):e.__k[o]=null;if(u)for(o=0;o<f;o++)(s=n[o])!=null&&!(2&s.__u)&&(s.__e==r&&(r=It(s)),ds(s,s));return r}function cs(e,t,n,r){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=cs(i[o],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=It(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Np(e,t,n,r){var i,o,a,s=e.key,l=e.type,c=t[n],f=c!=null&&(2&c.__u)==0;if(c===null&&s==null||f&&s==c.key&&l==c.type)return n;if(r>(f?1:0)){for(i=n-1,o=n+1;i>=0||o<t.length;)if((c=t[a=i>=0?i--:o++])!=null&&!(2&c.__u)&&s==c.key&&l==c.type)return a}return-1}function No(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||jp.test(t)?n:n+"px"}function Sn(e,t,n,r,i){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||No(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||No(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(as,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[on]=r[on]:(n[on]=si,e.addEventListener(t,o?Fr:zr,o)):e.removeEventListener(t,o?Fr:zr,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Ro(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Pn]==null)t[Pn]=si++;else if(t[Pn]<n[on])return;return n(ge.event?ge.event(t):t)}}}function ci(e,t,n,r,i,o,a,s,l,c){var f,u,g,h,p,v,y,d,b,m,x,w,_,k,C,P=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),o=[s=t.__e=n.__e]),(f=ge.__b)&&f(t);e:if(typeof P=="function")try{if(d=t.props,b=P.prototype&&P.prototype.render,m=(f=P.contextType)&&r[f.__c],x=f?m?m.props.value:f.__:r,n.__c?y=(u=t.__c=n.__c).__=u.__E:(b?t.__c=u=new P(d,x):(t.__c=u=new On(d,x),u.constructor=P,u.render=Ip),m&&m.sub(u),u.state||(u.state={}),u.__n=r,g=u.__d=!0,u.__h=[],u._sb=[]),b&&u.__s==null&&(u.__s=u.state),b&&P.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=Ze({},u.__s)),Ze(u.__s,P.getDerivedStateFromProps(d,u.__s))),h=u.props,p=u.state,u.__v=t,g)b&&P.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),b&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(b&&P.getDerivedStateFromProps==null&&d!==h&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(d,x),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(d,u.__s,x)===!1){t.__v!=n.__v&&(u.props=d,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(M){M&&(M.__=t)}),In.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&a.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(d,u.__s,x),b&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(h,p,v)})}if(u.context=x,u.props=d,u.__P=e,u.__e=!1,w=ge.__r,_=0,b)u.state=u.__s,u.__d=!1,w&&w(t),f=u.render(u.props,u.state,u.context),In.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,w&&w(t),f=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++_<25);u.state=u.__s,u.getChildContext!=null&&(r=Ze(Ze({},r),u.getChildContext())),b&&!g&&u.getSnapshotBeforeUpdate!=null&&(v=u.getSnapshotBeforeUpdate(h,p)),k=f!=null&&f.type===Gn&&f.key==null?fs(f.props.children):f,s=ls(e,Vn(k)?k:[k],t,n,r,i,o,a,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),y&&(u.__E=u.__=null)}catch(M){if(t.__v=null,l||o!=null)if(M.then){for(t.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o[o.indexOf(s)]=null,t.__e=s}else{for(C=o.length;C--;)li(o[C]);Br(t)}else t.__e=n.__e,t.__k=n.__k,M.then||Br(t);ge.__e(M,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Rp(n.__e,t,n,r,i,o,a,l,c);return(f=ge.diffed)&&f(t),128&t.__u?void 0:s}function Br(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Br))}function us(e,t,n){for(var r=0;r<n.length;r++)ui(n[r],n[++r],n[++r]);ge.__c&&ge.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){ge.__e(o,i.__v)}})}function fs(e){return typeof e!="object"||e==null||e.__b>0?e:Vn(e)?e.map(fs):Ze({},e)}function Rp(e,t,n,r,i,o,a,s,l){var c,f,u,g,h,p,v,y=n.props||Rn,d=t.props,b=t.type;if(b=="svg"?i="http://www.w3.org/2000/svg":b=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((h=o[c])&&"setAttribute"in h==!!b&&(b?h.localName==b:h.nodeType==3)){e=h,o[c]=null;break}}if(e==null){if(b==null)return document.createTextNode(d);e=document.createElementNS(i,b,d.is&&d),s&&(ge.__m&&ge.__m(t,o),s=!1),o=null}if(b==null)y===d||s&&e.data==d||(e.data=d);else{if(o=o&&un.call(e.childNodes),!s&&o!=null)for(y={},c=0;c<e.attributes.length;c++)y[(h=e.attributes[c]).name]=h.value;for(c in y)h=y[c],c=="dangerouslySetInnerHTML"?u=h:c=="children"||c in d||c=="value"&&"defaultValue"in d||c=="checked"&&"defaultChecked"in d||Sn(e,c,null,h,i);for(c in d)h=d[c],c=="children"?g=h:c=="dangerouslySetInnerHTML"?f=h:c=="value"?p=h:c=="checked"?v=h:s&&typeof h!="function"||y[c]===h||Sn(e,c,h,y[c],i);if(f)s||u&&(f.__html==u.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(u&&(e.innerHTML=""),ls(t.type=="template"?e.content:e,Vn(g)?g:[g],t,n,r,b=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:n.__k&&It(n,0),s,l),o!=null)for(c=o.length;c--;)li(o[c]);s||(c="value",b=="progress"&&p==null?e.removeAttribute("value"):p!=null&&(p!==e[c]||b=="progress"&&!p||b=="option"&&p!=y[c])&&Sn(e,c,p,y[c],i),c="checked",v!=null&&v!=e[c]&&Sn(e,c,v,y[c],i))}return e}function ui(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(i){ge.__e(i,n)}}function ds(e,t,n){var r,i;if(ge.unmount&&ge.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ui(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){ge.__e(o,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&ds(r[i],t,n||typeof e.type!="function");n||li(e.__e),e.__c=e.__=e.__e=void 0}function Ip(e,t,n){return this.constructor(e,n)}function Dp(e,t,n){var r,i,o,a;t==document&&(t=document.documentElement),ge.__&&ge.__(e,t),i=(r=!1)?null:t.__k,o=[],a=[],ci(t,e=t.__k=Tp(Gn,null,[e]),i||Rn,Rn,t.namespaceURI,i?null:t.firstChild?un.call(t.childNodes):null,o,i?i.__e:t.firstChild,r,a),us(o,e,a)}function hs(e,t,n){var r,i,o,a,s=Ze({},e.props);for(o in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)o=="key"?r=t[o]:o=="ref"?i=t[o]:s[o]=t[o]===void 0&&a!=null?a[o]:t[o];return arguments.length>2&&(s.children=arguments.length>3?un.call(arguments,2):n),an(e.type,s,r||e.key,i||e.ref,null)}un=In.slice,ge={__e:function(e,t,n,r){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(s){e=s}throw e}},ns=0,rs=function(e){return e!=null&&e.constructor===void 0},On.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ze({},this.state),typeof e=="function"&&(e=e(Ze({},n),this.props)),e&&Ze(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Lo(this))},On.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Lo(this))},On.prototype.render=Gn,ut=[],is=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,os=function(e,t){return e.__v.__b-t.__v.__b},Dn.__r=0,wr=Math.random().toString(8),Pn="__d"+wr,on="__a"+wr,as=/(PointerCapture)$|Capture$/i,si=0,zr=Ro(!1),Fr=Ro(!0);function Io(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zp(e){if(Array.isArray(e))return e}function Fp(e,t,n){return(t=Vp(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bp(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}function $p(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
656
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Do(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Hp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Do(Object(n),!0).forEach(function(r){Fp(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Do(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Up(e,t){return zp(e)||Bp(e,t)||Gp(e,t)||$p()}function qp(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vp(e){var t=qp(e,"string");return typeof t=="symbol"?t:t+""}function zn(e){"@babel/helpers - typeof";return zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zn(e)}function Gp(e,t){if(e){if(typeof e=="string")return Io(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Io(e,t):void 0}}var $r=function(t){if(zn(t)!=="object")return t;var n=hs(t);if(n.props){var r;n.props=Hp({},n.props),n!=null&&(r=n.props)!==null&&r!==void 0&&r.children&&(n.props.children=Array.isArray(n.props.children)?n.props.children.map($r):$r(n.props.children))}return n},Wp=function(t){return rs(hs(t))},Xp=function(t,n){delete n.__k,Dp($r(t),n)};function Yp(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",n==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var Kp=`.float-tooltip-kap {
655
+ `};function zd(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t[0],o=[],i;for(i=1;i<t.length;i+=1)o.push(t[i]);return o.forEach(function(a){r=r.replace(/%[a-z]/,a)}),r}var gt=function(e){Pd(t,e);function t(n){var r;if(process.env.NODE_ENV==="production")r=e.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+n+" for more information.")||this;else{for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];r=e.call(this,zd.apply(void 0,[jd[n]].concat(i)))||this}return Md(r)}return t}(Xr(Error));function Er(e){return Math.round(e*255)}function Td(e,t,n){return Er(e)+","+Er(t)+","+Er(n)}function Zn(e,t,n,r){if(r===void 0&&(r=Td),t===0)return r(n,n,n);var o=(e%360+360)%360/60,i=(1-Math.abs(2*n-1))*t,a=i*(1-Math.abs(o%2-1)),l=0,s=0,u=0;o>=0&&o<1?(l=i,s=a):o>=1&&o<2?(l=a,s=i):o>=2&&o<3?(s=i,u=a):o>=3&&o<4?(s=a,u=i):o>=4&&o<5?(l=a,u=i):o>=5&&o<6&&(l=i,u=a);var f=n-i/2,c=l+f,p=s+f,h=u+f;return r(c,p,h)}var Gi={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function Ed(e){if(typeof e!="string")return e;var t=e.toLowerCase();return Gi[t]?"#"+Gi[t]:e}var Ld=/^#[a-fA-F0-9]{6}$/,Nd=/^#[a-fA-F0-9]{8}$/,Rd=/^#[a-fA-F0-9]{3}$/,Dd=/^#[a-fA-F0-9]{4}$/,Lr=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,Id=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,Fd=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,Bd=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function tn(e){if(typeof e!="string")throw new gt(3);var t=Ed(e);if(t.match(Ld))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(Nd)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(Rd))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(Dd)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var o=Lr.exec(t);if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10)};var i=Id.exec(t.substring(0,50));if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10),alpha:parseFloat(""+i[4])>1?parseFloat(""+i[4])/100:parseFloat(""+i[4])};var a=Fd.exec(t);if(a){var l=parseInt(""+a[1],10),s=parseInt(""+a[2],10)/100,u=parseInt(""+a[3],10)/100,f="rgb("+Zn(l,s,u)+")",c=Lr.exec(f);if(!c)throw new gt(4,t,f);return{red:parseInt(""+c[1],10),green:parseInt(""+c[2],10),blue:parseInt(""+c[3],10)}}var p=Bd.exec(t.substring(0,50));if(p){var h=parseInt(""+p[1],10),d=parseInt(""+p[2],10)/100,m=parseInt(""+p[3],10)/100,v="rgb("+Zn(h,d,m)+")",g=Lr.exec(v);if(!g)throw new gt(4,t,v);return{red:parseInt(""+g[1],10),green:parseInt(""+g[2],10),blue:parseInt(""+g[3],10),alpha:parseFloat(""+p[4])>1?parseFloat(""+p[4])/100:parseFloat(""+p[4])}}throw new gt(5)}function $d(e){var t=e.red/255,n=e.green/255,r=e.blue/255,o=Math.max(t,n,r),i=Math.min(t,n,r),a=(o+i)/2;if(o===i)return e.alpha!==void 0?{hue:0,saturation:0,lightness:a,alpha:e.alpha}:{hue:0,saturation:0,lightness:a};var l,s=o-i,u=a>.5?s/(2-o-i):s/(o+i);switch(o){case t:l=(n-r)/s+(n<r?6:0);break;case n:l=(r-t)/s+2;break;default:l=(t-n)/s+4;break}return l*=60,e.alpha!==void 0?{hue:l,saturation:u,lightness:a,alpha:e.alpha}:{hue:l,saturation:u,lightness:a}}function jt(e){return $d(tn(e))}var Hd=function(t){return t.length===7&&t[1]===t[2]&&t[3]===t[4]&&t[5]===t[6]?"#"+t[1]+t[3]+t[5]:t},Kr=Hd;function Ft(e){var t=e.toString(16);return t.length===1?"0"+t:t}function Nr(e){return Ft(Math.round(e*255))}function qd(e,t,n){return Kr("#"+Nr(e)+Nr(t)+Nr(n))}function os(e,t,n){return Zn(e,t,n,qd)}function Ud(e,t,n){if(typeof e=="object"&&t===void 0&&n===void 0)return os(e.hue,e.saturation,e.lightness);throw new gt(1)}function Gd(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?os(e.hue,e.saturation,e.lightness):"rgba("+Zn(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new gt(2)}function is(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return Kr("#"+Ft(e)+Ft(t)+Ft(n));if(typeof e=="object"&&t===void 0&&n===void 0)return Kr("#"+Ft(e.red)+Ft(e.green)+Ft(e.blue));throw new gt(6)}function lr(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?is(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new gt(7)}var Vd=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Wd=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&typeof t.alpha=="number"},Yd=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Xd=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&typeof t.alpha=="number"};function zt(e){if(typeof e!="object")throw new gt(8);if(Wd(e))return lr(e);if(Vd(e))return is(e);if(Xd(e))return Gd(e);if(Yd(e))return Ud(e);throw new gt(8)}function as(e,t,n){return function(){var o=n.concat(Array.prototype.slice.call(arguments));return o.length>=t?e.apply(this,o):as(e,t,o)}}function Ze(e){return as(e,e.length,[])}function Kd(e,t){if(t==="transparent")return t;var n=jt(t);return zt(Ge({},n,{hue:n.hue+parseFloat(e)}))}Ze(Kd);function an(e,t,n){return Math.max(e,Math.min(t,n))}function Zd(e,t){if(t==="transparent")return t;var n=jt(t);return zt(Ge({},n,{lightness:an(0,1,n.lightness-parseFloat(e))}))}Ze(Zd);function Qd(e,t){if(t==="transparent")return t;var n=jt(t);return zt(Ge({},n,{saturation:an(0,1,n.saturation-parseFloat(e))}))}Ze(Qd);function Jd(e,t){if(t==="transparent")return t;var n=jt(t);return zt(Ge({},n,{lightness:an(0,1,n.lightness+parseFloat(e))}))}Ze(Jd);function eh(e,t,n){if(t==="transparent")return n;if(n==="transparent")return t;if(e===0)return n;var r=tn(t),o=Ge({},r,{alpha:typeof r.alpha=="number"?r.alpha:1}),i=tn(n),a=Ge({},i,{alpha:typeof i.alpha=="number"?i.alpha:1}),l=o.alpha-a.alpha,s=parseFloat(e)*2-1,u=s*l===-1?s:s+l,f=1+s*l,c=(u/f+1)/2,p=1-c,h={red:Math.floor(o.red*c+a.red*p),green:Math.floor(o.green*c+a.green*p),blue:Math.floor(o.blue*c+a.blue*p),alpha:o.alpha*parseFloat(e)+a.alpha*(1-parseFloat(e))};return lr(h)}var th=Ze(eh),ss=th;function nh(e,t){if(t==="transparent")return t;var n=tn(t),r=typeof n.alpha=="number"?n.alpha:1,o=Ge({},n,{alpha:an(0,1,(r*100+parseFloat(e)*100)/100)});return lr(o)}var rh=Ze(nh),oh=rh;function ih(e,t){if(t==="transparent")return t;var n=jt(t);return zt(Ge({},n,{saturation:an(0,1,n.saturation+parseFloat(e))}))}Ze(ih);function ah(e,t){return t==="transparent"?t:zt(Ge({},jt(t),{hue:parseFloat(e)}))}Ze(ah);function sh(e,t){return t==="transparent"?t:zt(Ge({},jt(t),{lightness:parseFloat(e)}))}Ze(sh);function lh(e,t){return t==="transparent"?t:zt(Ge({},jt(t),{saturation:parseFloat(e)}))}Ze(lh);function ch(e,t){return t==="transparent"?t:ss(parseFloat(e),"rgb(0, 0, 0)",t)}Ze(ch);function uh(e,t){return t==="transparent"?t:ss(parseFloat(e),"rgb(255, 255, 255)",t)}Ze(uh);function fh(e,t){if(t==="transparent")return t;var n=tn(t),r=typeof n.alpha=="number"?n.alpha:1,o=Ge({},n,{alpha:an(0,1,+(r*100-parseFloat(e)*100).toFixed(2)/100)});return lr(o)}Ze(fh);var Bt=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Bt.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?Bt.Bounce.In(e*2)*.5:Bt.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),xn=function(){return performance.now()},ls=function(){function e(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(n){return t._tweens[n]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var o=0,i=n;o<i.length;o++){var a=i[o];(t=a._group)===null||t===void 0||t.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},e.prototype.remove=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,o=t;r<o.length;r++){var i=o[r];i._group=void 0,delete this._tweens[i.getId()],delete this._tweensAddedDuringUpdate[i.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},e.prototype.update=function(t,n){t===void 0&&(t=xn()),n===void 0&&(n=!0);var r=Object.keys(this._tweens);if(r.length!==0)for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<r.length;o++){var i=this._tweens[r[o]],a=!n;i&&i.update(t,a)===!1&&!n&&this.remove(i)}r=Object.keys(this._tweensAddedDuringUpdate)}},e}(),Zr={Linear:function(e,t){var n=e.length-1,r=n*t,o=Math.floor(r),i=Zr.Utils.Linear;return t<0?i(e[0],e[1],r):t>1?i(e[n],e[n-1],n-r):i(e[o],e[o+1>n?n:o+1],r-o)},Utils:{Linear:function(e,t,n){return(t-e)*n+e}}},cs=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Qr=new ls,Vi=function(){function e(t,n){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Bt.Linear.None,this._interpolationFunction=Zr.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=cs.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof n=="object"?(this._group=n,n.add(this)):n===!0&&(this._group=Qr,Qr.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,n){if(n===void 0&&(n=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=n<0?0:n,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,n){if(t===void 0&&(t=xn()),n===void 0&&(n=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||n){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var i in this._valuesEnd)o[i]=this._valuesEnd[i];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,n)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,n,r,o,i){for(var a in r){var l=t[a],s=Array.isArray(l),u=s?"array":typeof l,f=!s&&Array.isArray(r[a]);if(!(u==="undefined"||u==="function")){if(f){var c=r[a];if(c.length===0)continue;for(var p=[l],h=0,d=c.length;h<d;h+=1){var m=this._handleRelativeValue(l,c[h]);if(isNaN(m)){f=!1,console.warn("Found invalid interpolation list. Skipping.");break}p.push(m)}f&&(r[a]=p)}if((u==="object"||s)&&l&&!f){n[a]=s?[]:{};var v=l;for(var g in v)n[a][g]=v[g];o[a]=s?[]:{};var c=r[a];if(!this._isDynamic){var S={};for(var g in c)S[g]=c[g];r[a]=c=S}this._setupProperties(v,n[a],c,o[a],i)}else(typeof n[a]>"u"||i)&&(n[a]=l),s||(n[a]*=1),f?o[a]=r[a].slice().reverse():o[a]=n[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(t){return t===void 0&&(t=xn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=xn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,n=this._chainedTweens.length;t<n;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},e.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},e.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},e.prototype.easing=function(t){return t===void 0&&(t=Bt.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=Zr.Linear),this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,n){var r=this,o;if(t===void 0&&(t=xn()),n===void 0&&(n=e.autoStartOnUpdate),this._isPaused)return!0;var i;if(!this._goToEnd&&!this._isPlaying)if(n)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=t-this._startTime,l=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),s=this._duration+this._repeat*l,u=function(){if(r._duration===0||a>s)return 1;var m=Math.trunc(a/l),v=a-m*l,g=Math.min(v/r._duration,1);return g===0&&a===r._duration?1:g},f=u(),c=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,c),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||a>=this._duration)if(this._repeat>0){var p=Math.min(Math.trunc((a-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);for(i in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[i]=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var h=0,d=this._chainedTweens.length;h<d;h++)this._chainedTweens[h].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,n,r,o){for(var i in r)if(n[i]!==void 0){var a=n[i]||0,l=r[i],s=Array.isArray(t[i]),u=Array.isArray(l),f=!s&&u;f?t[i]=this._interpolationFunction(l,o):typeof l=="object"&&l?this._updateProperties(t[i],a,l,o):(l=this._handleRelativeValue(a,l),typeof l=="number"&&(t[i]=a+(l-a)*o))}},e.prototype._handleRelativeValue=function(t,n){return typeof n!="string"?n:n.charAt(0)==="+"||n.charAt(0)==="-"?t+parseFloat(n):parseFloat(n)},e.prototype._swapEndStartRepeatValues=function(t){var n=this._valuesStartRepeat[t],r=this._valuesEnd[t];typeof r=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(r):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=n},e.autoStartOnUpdate=!1,e}();cs.nextId;var yt=Qr;yt.getAll.bind(yt);yt.removeAll.bind(yt);yt.add.bind(yt);yt.remove.bind(yt);yt.update.bind(yt);var Jr="http://www.w3.org/1999/xhtml";const Wi={svg:"http://www.w3.org/2000/svg",xhtml:Jr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function us(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Wi.hasOwnProperty(t)?{space:Wi[t],local:e}:e}function dh(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Jr&&t.documentElement.namespaceURI===Jr?t.createElement(e):t.createElementNS(n,e)}}function hh(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fs(e){var t=us(e);return(t.local?hh:dh)(t)}function ph(){}function ds(e){return e==null?ph:function(){return this.querySelector(e)}}function gh(e){typeof e!="function"&&(e=ds(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],a=i.length,l=r[o]=new Array(a),s,u,f=0;f<a;++f)(s=i[f])&&(u=e.call(s,s.__data__,f,i))&&("__data__"in s&&(u.__data__=s.__data__),l[f]=u);return new rt(r,this._parents)}function vh(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function yh(){return[]}function mh(e){return e==null?yh:function(){return this.querySelectorAll(e)}}function bh(e){return function(){return vh(e.apply(this,arguments))}}function _h(e){typeof e=="function"?e=bh(e):e=mh(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var a=t[i],l=a.length,s,u=0;u<l;++u)(s=a[u])&&(r.push(e.call(s,s.__data__,u,a)),o.push(s));return new rt(r,o)}function xh(e){return function(){return this.matches(e)}}function hs(e){return function(t){return t.matches(e)}}var wh=Array.prototype.find;function kh(e){return function(){return wh.call(this.children,e)}}function Ch(){return this.firstElementChild}function Sh(e){return this.select(e==null?Ch:kh(typeof e=="function"?e:hs(e)))}var Mh=Array.prototype.filter;function Ph(){return Array.from(this.children)}function Ah(e){return function(){return Mh.call(this.children,e)}}function Oh(e){return this.selectAll(e==null?Ph:Ah(typeof e=="function"?e:hs(e)))}function jh(e){typeof e!="function"&&(e=xh(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],a=i.length,l=r[o]=[],s,u=0;u<a;++u)(s=i[u])&&e.call(s,s.__data__,u,i)&&l.push(s);return new rt(r,this._parents)}function ps(e){return new Array(e.length)}function zh(){return new rt(this._enter||this._groups.map(ps),this._parents)}function Qn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Qn.prototype={constructor:Qn,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 Th(e){return function(){return e}}function Eh(e,t,n,r,o,i){for(var a=0,l,s=t.length,u=i.length;a<u;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new Qn(e,i[a]);for(;a<s;++a)(l=t[a])&&(o[a]=l)}function Lh(e,t,n,r,o,i,a){var l,s,u=new Map,f=t.length,c=i.length,p=new Array(f),h;for(l=0;l<f;++l)(s=t[l])&&(p[l]=h=a.call(s,s.__data__,l,t)+"",u.has(h)?o[l]=s:u.set(h,s));for(l=0;l<c;++l)h=a.call(e,i[l],l,i)+"",(s=u.get(h))?(r[l]=s,s.__data__=i[l],u.delete(h)):n[l]=new Qn(e,i[l]);for(l=0;l<f;++l)(s=t[l])&&u.get(p[l])===s&&(o[l]=s)}function Nh(e){return e.__data__}function Rh(e,t){if(!arguments.length)return Array.from(this,Nh);var n=t?Lh:Eh,r=this._parents,o=this._groups;typeof e!="function"&&(e=Th(e));for(var i=o.length,a=new Array(i),l=new Array(i),s=new Array(i),u=0;u<i;++u){var f=r[u],c=o[u],p=c.length,h=Dh(e.call(f,f&&f.__data__,u,r)),d=h.length,m=l[u]=new Array(d),v=a[u]=new Array(d),g=s[u]=new Array(p);n(f,c,m,v,g,h,t);for(var S=0,_=0,x,w;S<d;++S)if(x=m[S]){for(S>=_&&(_=S+1);!(w=v[_])&&++_<d;);x._next=w||null}}return a=new rt(a,r),a._enter=l,a._exit=s,a}function Dh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ih(){return new rt(this._exit||this._groups.map(ps),this._parents)}function Fh(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Bh(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,a=Math.min(o,i),l=new Array(o),s=0;s<a;++s)for(var u=n[s],f=r[s],c=u.length,p=l[s]=new Array(c),h,d=0;d<c;++d)(h=u[d]||f[d])&&(p[d]=h);for(;s<o;++s)l[s]=n[s];return new rt(l,this._parents)}function $h(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],a;--o>=0;)(a=r[o])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function Hh(e){e||(e=qh);function t(c,p){return c&&p?e(c.__data__,p.__data__):!c-!p}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var a=n[i],l=a.length,s=o[i]=new Array(l),u,f=0;f<l;++f)(u=a[f])&&(s[f]=u);s.sort(t)}return new rt(o,this._parents).order()}function qh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Uh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Gh(){return Array.from(this)}function Vh(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null}function Wh(){let e=0;for(const t of this)++e;return e}function Yh(){return!this.node()}function Xh(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,a=o.length,l;i<a;++i)(l=o[i])&&e.call(l,l.__data__,i,o);return this}function Kh(e){return function(){this.removeAttribute(e)}}function Zh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Qh(e,t){return function(){this.setAttribute(e,t)}}function Jh(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ep(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function tp(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 np(e,t){var n=us(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?Zh:Kh:typeof t=="function"?n.local?tp:ep:n.local?Jh:Qh)(n,t))}function gs(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function rp(e){return function(){this.style.removeProperty(e)}}function op(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ip(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function ap(e,t,n){return arguments.length>1?this.each((t==null?rp:typeof t=="function"?ip:op)(e,t,n??"")):sp(this.node(),e)}function sp(e,t){return e.style.getPropertyValue(t)||gs(e).getComputedStyle(e,null).getPropertyValue(t)}function lp(e){return function(){delete this[e]}}function cp(e,t){return function(){this[e]=t}}function up(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function fp(e,t){return arguments.length>1?this.each((t==null?lp:typeof t=="function"?up:cp)(e,t)):this.node()[e]}function vs(e){return e.trim().split(/^|\s+/)}function ko(e){return e.classList||new ys(e)}function ys(e){this._node=e,this._names=vs(e.getAttribute("class")||"")}ys.prototype={add:function(e){var t=this._names.indexOf(e);t<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 ms(e,t){for(var n=ko(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function bs(e,t){for(var n=ko(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function dp(e){return function(){ms(this,e)}}function hp(e){return function(){bs(this,e)}}function pp(e,t){return function(){(t.apply(this,arguments)?ms:bs)(this,e)}}function gp(e,t){var n=vs(e+"");if(arguments.length<2){for(var r=ko(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?pp:t?dp:hp)(n,t))}function vp(){this.textContent=""}function yp(e){return function(){this.textContent=e}}function mp(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function bp(e){return arguments.length?this.each(e==null?vp:(typeof e=="function"?mp:yp)(e)):this.node().textContent}function _p(){this.innerHTML=""}function xp(e){return function(){this.innerHTML=e}}function wp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function kp(e){return arguments.length?this.each(e==null?_p:(typeof e=="function"?wp:xp)(e)):this.node().innerHTML}function Cp(){this.nextSibling&&this.parentNode.appendChild(this)}function Sp(){return this.each(Cp)}function Mp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pp(){return this.each(Mp)}function Ap(e){var t=typeof e=="function"?e:fs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Op(){return null}function jp(e,t){var n=typeof e=="function"?e:fs(e),r=t==null?Op:typeof t=="function"?t:ds(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function zp(){var e=this.parentNode;e&&e.removeChild(this)}function Tp(){return this.each(zp)}function Ep(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Lp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Np(e){return this.select(e?Lp:Ep)}function Rp(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Dp(e){return function(t){e.call(this,t,this.__data__)}}function Ip(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Fp(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function Bp(e,t,n){return function(){var r=this.__on,o,i=Dp(t);if(r){for(var a=0,l=r.length;a<l;++a)if((o=r[a]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function $p(e,t,n){var r=Ip(e+""),o,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var s=0,u=l.length,f;s<u;++s)for(o=0,f=l[s];o<i;++o)if((a=r[o]).type===f.type&&a.name===f.name)return f.value}return}for(l=t?Bp:Fp,o=0;o<i;++o)this.each(l(r[o],t,n));return this}function _s(e,t,n){var r=gs(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Hp(e,t){return function(){return _s(this,e,t)}}function qp(e,t){return function(){return _s(this,e,t.apply(this,arguments))}}function Up(e,t){return this.each((typeof t=="function"?qp:Hp)(e,t))}function*Gp(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,a;o<i;++o)(a=r[o])&&(yield a)}var Vp=[null];function rt(e,t){this._groups=e,this._parents=t}function Wp(){return this}rt.prototype={constructor:rt,select:gh,selectAll:_h,selectChild:Sh,selectChildren:Oh,filter:jh,data:Rh,enter:zh,exit:Ih,join:Fh,merge:Bh,selection:Wp,order:$h,sort:Hh,call:Uh,nodes:Gh,node:Vh,size:Wh,empty:Yh,each:Xh,attr:np,style:ap,property:fp,classed:gp,text:bp,html:kp,raise:Sp,lower:Pp,append:Ap,insert:jp,remove:Tp,clone:Np,datum:Rp,on:$p,dispatch:Up,[Symbol.iterator]:Gp};function Yp(e){return typeof e=="string"?new rt([[document.querySelector(e)]],[document.documentElement]):new rt([[e]],Vp)}function Xp(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Kp(e,t){if(e=Xp(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 o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}var An,ke,xs,ws,At,Yi,ks,Cs,Rr,Gn,kn,Ss,Co,eo,to,Jn={},er=[],Zp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,cr=Array.isArray;function vt(e,t){for(var n in t)e[n]=t[n];return e}function So(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Qp(e,t,n){var r,o,i,a={};for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?An.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return Cn(e,a,r,o,null)}function Cn(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++xs,__i:-1,__u:0};return o==null&&ke.vnode!=null&&ke.vnode(i),i}function ur(e){return e.children}function Vn(e,t){this.props=e,this.context=t}function nn(e,t){if(t==null)return e.__?nn(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?nn(e):null}function Jp(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],o=[],i=vt({},t);i.__v=t.__v+1,ke.vnode&&ke.vnode(i),Mo(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??nn(t),!!(32&t.__u),o),i.__v=t.__v,i.__.__k[i.__i]=i,Os(r,i,o),t.__e=t.__=null,i.__e!=n&&Ms(i)}}function Ms(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Ms(e)}function Xi(e){(!e.__d&&(e.__d=!0)&&At.push(e)&&!tr.__r++||Yi!=ke.debounceRendering)&&((Yi=ke.debounceRendering)||ks)(tr)}function tr(){try{for(var e,t=1;At.length;)At.length>t&&At.sort(Cs),e=At.shift(),t=At.length,Jp(e)}finally{At.length=tr.__r=0}}function Ps(e,t,n,r,o,i,a,l,s,u,f){var c,p,h,d,m,v,g,S=r&&r.__k||er,_=t.length;for(s=eg(n,t,S,s,_),c=0;c<_;c++)(h=n.__k[c])!=null&&(p=h.__i!=-1&&S[h.__i]||Jn,h.__i=c,v=Mo(e,h,p,o,i,a,l,s,u,f),d=h.__e,h.ref&&p.ref!=h.ref&&(p.ref&&Po(p.ref,null,h),f.push(h.ref,h.__c||d,h)),m==null&&d!=null&&(m=d),(g=!!(4&h.__u))||p.__k===h.__k?(s=As(h,s,e,g),g&&p.__e&&(p.__e=null)):typeof h.type=="function"&&v!==void 0?s=v:d&&(s=d.nextSibling),h.__u&=-7);return n.__e=m,s}function eg(e,t,n,r,o){var i,a,l,s,u,f=n.length,c=f,p=0;for(e.__k=new Array(o),i=0;i<o;i++)(a=t[i])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[i]=Cn(null,a,null,null,null):cr(a)?a=e.__k[i]=Cn(ur,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[i]=Cn(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,s=i+p,a.__=e,a.__b=e.__b+1,l=null,(u=a.__i=tg(a,n,s,c))!=-1&&(c--,(l=n[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(o>f?p--:o<f&&p++),typeof a.type!="function"&&(a.__u|=4)):u!=s&&(u==s-1?p--:u==s+1?p++:(u>s?p--:p++,a.__u|=4))):e.__k[i]=null;if(c)for(i=0;i<f;i++)(l=n[i])!=null&&!(2&l.__u)&&(l.__e==r&&(r=nn(l)),zs(l,l));return r}function As(e,t,n,r){var o,i;if(typeof e.type=="function"){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,t=As(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=nn(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function tg(e,t,n,r){var o,i,a,l=e.key,s=e.type,u=t[n],f=u!=null&&(2&u.__u)==0;if(u===null&&l==null||f&&l==u.key&&s==u.type)return n;if(r>(f?1:0)){for(o=n-1,i=n+1;o>=0||i<t.length;)if((u=t[a=o>=0?o--:i++])!=null&&!(2&u.__u)&&l==u.key&&s==u.type)return a}return-1}function Ki(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Zp.test(t)?n:n+"px"}function qn(e,t,n,r,o){var i,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Ki(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Ki(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(Ss,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n[kn]=r[kn]:(n[kn]=Co,e.addEventListener(t,i?to:eo,i)):e.removeEventListener(t,i?to:eo,i);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Zi(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Gn]==null)t[Gn]=Co++;else if(t[Gn]<n[kn])return;return n(ke.event?ke.event(t):t)}}}function Mo(e,t,n,r,o,i,a,l,s,u){var f,c,p,h,d,m,v,g,S,_,x,w,b,M,P,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(s=!!(32&n.__u),i=[l=t.__e=n.__e]),(f=ke.__b)&&f(t);e:if(typeof N=="function")try{if(g=t.props,S=N.prototype&&N.prototype.render,_=(f=N.contextType)&&r[f.__c],x=f?_?_.props.value:f.__:r,n.__c?v=(c=t.__c=n.__c).__=c.__E:(S?t.__c=c=new N(g,x):(t.__c=c=new Vn(g,x),c.constructor=N,c.render=rg),_&&_.sub(c),c.state||(c.state={}),c.__n=r,p=c.__d=!0,c.__h=[],c._sb=[]),S&&c.__s==null&&(c.__s=c.state),S&&N.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=vt({},c.__s)),vt(c.__s,N.getDerivedStateFromProps(g,c.__s))),h=c.props,d=c.state,c.__v=t,p)S&&N.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),S&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(S&&N.getDerivedStateFromProps==null&&g!==h&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(g,x),t.__v==n.__v||!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(g,c.__s,x)===!1){t.__v!=n.__v&&(c.props=g,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(j){j&&(j.__=t)}),er.push.apply(c.__h,c._sb),c._sb=[],c.__h.length&&a.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(g,c.__s,x),S&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(h,d,m)})}if(c.context=x,c.props=g,c.__P=e,c.__e=!1,w=ke.__r,b=0,S)c.state=c.__s,c.__d=!1,w&&w(t),f=c.render(c.props,c.state,c.context),er.push.apply(c.__h,c._sb),c._sb=[];else do c.__d=!1,w&&w(t),f=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++b<25);c.state=c.__s,c.getChildContext!=null&&(r=vt(vt({},r),c.getChildContext())),S&&!p&&c.getSnapshotBeforeUpdate!=null&&(m=c.getSnapshotBeforeUpdate(h,d)),M=f!=null&&f.type===ur&&f.key==null?js(f.props.children):f,l=Ps(e,cr(M)?M:[M],t,n,r,o,i,a,l,s,u),c.base=t.__e,t.__u&=-161,c.__h.length&&a.push(c),v&&(c.__E=c.__=null)}catch(j){if(t.__v=null,s||i!=null)if(j.then){for(t.__u|=s?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;i[i.indexOf(l)]=null,t.__e=l}else{for(P=i.length;P--;)So(i[P]);no(t)}else t.__e=n.__e,t.__k=n.__k,j.then||no(t);ke.__e(j,t,n)}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=ng(n.__e,t,n,r,o,i,a,s,u);return(f=ke.diffed)&&f(t),128&t.__u?void 0:l}function no(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(no))}function Os(e,t,n){for(var r=0;r<n.length;r++)Po(n[r],n[++r],n[++r]);ke.__c&&ke.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){ke.__e(i,o.__v)}})}function js(e){return typeof e!="object"||e==null||e.__b>0?e:cr(e)?e.map(js):vt({},e)}function ng(e,t,n,r,o,i,a,l,s){var u,f,c,p,h,d,m,v=n.props||Jn,g=t.props,S=t.type;if(S=="svg"?o="http://www.w3.org/2000/svg":S=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(u=0;u<i.length;u++)if((h=i[u])&&"setAttribute"in h==!!S&&(S?h.localName==S:h.nodeType==3)){e=h,i[u]=null;break}}if(e==null){if(S==null)return document.createTextNode(g);e=document.createElementNS(o,S,g.is&&g),l&&(ke.__m&&ke.__m(t,i),l=!1),i=null}if(S==null)v===g||l&&e.data==g||(e.data=g);else{if(i=i&&An.call(e.childNodes),!l&&i!=null)for(v={},u=0;u<e.attributes.length;u++)v[(h=e.attributes[u]).name]=h.value;for(u in v)h=v[u],u=="dangerouslySetInnerHTML"?c=h:u=="children"||u in g||u=="value"&&"defaultValue"in g||u=="checked"&&"defaultChecked"in g||qn(e,u,null,h,o);for(u in g)h=g[u],u=="children"?p=h:u=="dangerouslySetInnerHTML"?f=h:u=="value"?d=h:u=="checked"?m=h:l&&typeof h!="function"||v[u]===h||qn(e,u,h,v[u],o);if(f)l||c&&(f.__html==c.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(c&&(e.innerHTML=""),Ps(t.type=="template"?e.content:e,cr(p)?p:[p],t,n,r,S=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,a,i?i[0]:n.__k&&nn(n,0),l,s),i!=null)for(u=i.length;u--;)So(i[u]);l||(u="value",S=="progress"&&d==null?e.removeAttribute("value"):d!=null&&(d!==e[u]||S=="progress"&&!d||S=="option"&&d!=v[u])&&qn(e,u,d,v[u],o),u="checked",m!=null&&m!=e[u]&&qn(e,u,m,v[u],o))}return e}function Po(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(o){ke.__e(o,n)}}function zs(e,t,n){var r,o;if(ke.unmount&&ke.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Po(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){ke.__e(i,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&zs(r[o],t,n||typeof e.type!="function");n||So(e.__e),e.__c=e.__=e.__e=void 0}function rg(e,t,n){return this.constructor(e,n)}function og(e,t,n){var r,o,i,a;t==document&&(t=document.documentElement),ke.__&&ke.__(e,t),o=(r=!1)?null:t.__k,i=[],a=[],Mo(t,e=t.__k=Qp(ur,null,[e]),o||Jn,Jn,t.namespaceURI,o?null:t.firstChild?An.call(t.childNodes):null,i,o?o.__e:t.firstChild,r,a),Os(i,e,a)}function Ts(e,t,n){var r,o,i,a,l=vt({},e.props);for(i in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)i=="key"?r=t[i]:i=="ref"?o=t[i]:l[i]=t[i]===void 0&&a!=null?a[i]:t[i];return arguments.length>2&&(l.children=arguments.length>3?An.call(arguments,2):n),Cn(e.type,l,r||e.key,o||e.ref,null)}An=er.slice,ke={__e:function(e,t,n,r){for(var o,i,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),a=o.__d),a)return o.__E=o}catch(l){e=l}throw e}},xs=0,ws=function(e){return e!=null&&e.constructor===void 0},Vn.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=vt({},this.state),typeof e=="function"&&(e=e(vt({},n),this.props)),e&&vt(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Xi(this))},Vn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Xi(this))},Vn.prototype.render=ur,At=[],ks=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Cs=function(e,t){return e.__v.__b-t.__v.__b},tr.__r=0,Rr=Math.random().toString(8),Gn="__d"+Rr,kn="__a"+Rr,Ss=/(PointerCapture)$|Capture$/i,Co=0,eo=Zi(!1),to=Zi(!0);function Qi(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ig(e){if(Array.isArray(e))return e}function ag(e,t,n){return(t=dg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sg(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,l=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(f){u=!0,o=f}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function lg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
656
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ji(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function cg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ji(Object(n),!0).forEach(function(r){ag(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ji(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ug(e,t){return ig(e)||sg(e,t)||hg(e,t)||lg()}function fg(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dg(e){var t=fg(e,"string");return typeof t=="symbol"?t:t+""}function nr(e){"@babel/helpers - typeof";return nr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nr(e)}function hg(e,t){if(e){if(typeof e=="string")return Qi(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qi(e,t):void 0}}var ro=function(t){if(nr(t)!=="object")return t;var n=Ts(t);if(n.props){var r;n.props=cg({},n.props),n!=null&&(r=n.props)!==null&&r!==void 0&&r.children&&(n.props.children=Array.isArray(n.props.children)?n.props.children.map(ro):ro(n.props.children))}return n},pg=function(t){return ws(Ts(t))},gg=function(t,n){delete n.__k,og(ro(t),n)};function vg(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var yg=`.float-tooltip-kap {
657
657
  position: absolute;
658
658
  width: max-content; /* prevent shrinking near right edge */
659
659
  max-width: max(50%, 150px);
@@ -664,7 +664,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
664
664
  background: rgba(0,0,0,0.6);
665
665
  pointer-events: none;
666
666
  }
667
- `;Yp(Kp);var Qp=ri({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.style,o=i===void 0?{}:i,a=!!t&&zn(t)==="object"&&!!t.node&&typeof t.node=="function",s=Pp(a?t.node():t);s.style("position")==="static"&&s.style("position","relative"),n.tooltipEl=s.append("div").attr("class","float-tooltip-kap"),Object.entries(o).forEach(function(c){var f=Up(c,2),u=f[0],g=f[1];return n.tooltipEl.style(u,g)}),n.tooltipEl.style("left","-10000px").style("display","none");var l="tooltip-".concat(Math.round(Math.random()*1e12));n.mouseInside=!1,s.on("mousemove.".concat(l),function(c){n.mouseInside=!0;var f=Ap(c),u=s.node(),g=u.offsetWidth,h=u.offsetHeight,p=[n.offsetX===null||n.offsetX===void 0?"-".concat(f[0]/g*100,"%"):typeof n.offsetX=="number"?"calc(-50% + ".concat(n.offsetX,"px)"):n.offsetX,n.offsetY===null||n.offsetY===void 0?h>130&&h-f[1]<100?"calc(-100% - 6px)":"21px":typeof n.offsetY=="number"?n.offsetY<0?"calc(-100% - ".concat(Math.abs(n.offsetY),"px)"):"".concat(n.offsetY,"px"):n.offsetY];n.tooltipEl.style("left",f[0]+"px").style("top",f[1]+"px").style("transform","translate(".concat(p.join(","),")")),n.content&&n.tooltipEl.style("display","inline")}),s.on("mouseover.".concat(l),function(){n.mouseInside=!0,n.content&&n.tooltipEl.style("display","inline")}),s.on("mouseout.".concat(l),function(){n.mouseInside=!1,n.tooltipEl.style("display","none")})},update:function(t){t.tooltipEl.style("display",t.content&&t.mouseInside?"inline":"none"),t.content?t.content instanceof HTMLElement?(t.tooltipEl.text(""),t.tooltipEl.append(function(){return t.content})):typeof t.content=="string"?t.tooltipEl.html(t.content):Wp(t.content)?(t.tooltipEl.text(""),Xp(t.content,t.tooltipEl.node())):(t.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",t.content,t.content.toString())):t.tooltipEl.text("")}});function Zp(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",n==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var Jp=`.scene-nav-info {
667
+ `;vg(yg);var mg=_o({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=r.style,i=o===void 0?{}:o,a=!!t&&nr(t)==="object"&&!!t.node&&typeof t.node=="function",l=Yp(a?t.node():t);l.style("position")==="static"&&l.style("position","relative"),n.tooltipEl=l.append("div").attr("class","float-tooltip-kap"),Object.entries(i).forEach(function(u){var f=ug(u,2),c=f[0],p=f[1];return n.tooltipEl.style(c,p)}),n.tooltipEl.style("left","-10000px").style("display","none");var s="tooltip-".concat(Math.round(Math.random()*1e12));n.mouseInside=!1,l.on("mousemove.".concat(s),function(u){n.mouseInside=!0;var f=Kp(u),c=l.node(),p=c.offsetWidth,h=c.offsetHeight,d=[n.offsetX===null||n.offsetX===void 0?"-".concat(f[0]/p*100,"%"):typeof n.offsetX=="number"?"calc(-50% + ".concat(n.offsetX,"px)"):n.offsetX,n.offsetY===null||n.offsetY===void 0?h>130&&h-f[1]<100?"calc(-100% - 6px)":"21px":typeof n.offsetY=="number"?n.offsetY<0?"calc(-100% - ".concat(Math.abs(n.offsetY),"px)"):"".concat(n.offsetY,"px"):n.offsetY];n.tooltipEl.style("left",f[0]+"px").style("top",f[1]+"px").style("transform","translate(".concat(d.join(","),")")),n.content&&n.tooltipEl.style("display","inline")}),l.on("mouseover.".concat(s),function(){n.mouseInside=!0,n.content&&n.tooltipEl.style("display","inline")}),l.on("mouseout.".concat(s),function(){n.mouseInside=!1,n.tooltipEl.style("display","none")})},update:function(t){t.tooltipEl.style("display",t.content&&t.mouseInside?"inline":"none"),t.content?t.content instanceof HTMLElement?(t.tooltipEl.text(""),t.tooltipEl.append(function(){return t.content})):typeof t.content=="string"?t.tooltipEl.html(t.content):pg(t.content)?(t.tooltipEl.text(""),gg(t.content,t.tooltipEl.node())):(t.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",t.content,t.content.toString())):t.tooltipEl.text("")}});function bg(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var _g=`.scene-nav-info {
668
668
  position: absolute;
669
669
  bottom: 5px;
670
670
  width: 100%;
@@ -679,7 +679,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
679
679
 
680
680
  .scene-container canvas:focus {
681
681
  outline: none;
682
- }`;Zp(Jp);function Hr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function eg(e){if(Array.isArray(e))return e}function tg(e){if(Array.isArray(e))return Hr(e)}function ng(e,t,n){return(t=cg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rg(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ig(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}function og(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
683
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ag(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
684
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sg(e,t){return eg(e)||ig(e,t)||ps(e,t)||og()}function vt(e){return tg(e)||rg(e)||ps(e)||ag()}function lg(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cg(e){var t=lg(e,"string");return typeof t=="symbol"?t:t+""}function ps(e,t){if(e){if(typeof e=="string")return Hr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hr(e,t):void 0}}var gs=function(t){t instanceof Array?t.forEach(gs):(t.map&&t.map.dispose(),t.dispose())},vs=function(t){t.geometry&&t.geometry.dispose(),t.material&&gs(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(vs)},ug=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),vs(n)}},he=window.THREE?window.THREE:{WebGLRenderer:K.WebGLRenderer,Scene:K.Scene,PerspectiveCamera:K.PerspectiveCamera,Raycaster:K.Raycaster,SRGBColorSpace:K.SRGBColorSpace,TextureLoader:K.TextureLoader,Vector2:K.Vector2,Vector3:K.Vector3,Box3:K.Box3,Color:K.Color,Mesh:K.Mesh,SphereGeometry:K.SphereGeometry,MeshBasicMaterial:K.MeshBasicMaterial,BackSide:K.BackSide,Timer:K.Timer},ys=ri({props:{width:{default:window.innerWidth,onChange:function(t,n,r){isNaN(t)&&(n.width=r)}},height:{default:window.innerHeight,onChange:function(t,n,r){isNaN(t)&&(n.height=r)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(t,n){n.hoverObj=null,n.tooltip&&n.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(t){if(t.initialised){t.controls.enabled&&t.controls.update&&t.controls.update(Math.min(1,t.timer.update().getDelta())),t.postProcessingComposer?t.postProcessingComposer.render():t.renderer.render(t.scene,t.camera),t.extraRenderers.forEach(function(a){return a.render(t.scene,t.camera)});var n=+new Date;if(t.enablePointerInteraction&&n-t.lastRaycasterCheck>=t.pointerRaycasterThrottleMs){t.lastRaycasterCheck=n;var r=null;if(t.hoverDuringDrag||!t.isPointerDragging){var i=this.intersectingObjects(t.pointerPos.x,t.pointerPos.y);t.hoverOrderComparator&&i.sort(function(a,s){return t.hoverOrderComparator(a.object,s.object)});var o=i.find(function(a){return t.hoverFilter(a.object)})||null;r=o?o.object:null,t.intersection=o||null}r!==t.hoverObj&&(t.onHover(r,t.hoverObj,t.intersection),t.tooltip.content(r&&ie(t.tooltipContent)(r,t.intersection)||null),t.hoverObj=r)}t.tweenGroup.update()}return this},getPointerPos:function(t){var n=t.pointerPos,r=n.x,i=n.y;return{x:r,y:i}},cameraPosition:function(t,n,r,i){var o=t.camera;if(n&&t.initialised){var a=n,s=r||{x:0,y:0,z:0};if(!i)f(a),u(s);else{var l=Object.assign({},o.position),c=g();t.tweenGroup.add(new jo(l).to(a,i).easing(bt.Quadratic.Out).onUpdate(f).onComplete(function(){t.tweenGroup.remove(this)}).start()),t.tweenGroup.add(new jo(c).to(s,i/3).easing(bt.Quadratic.Out).onUpdate(u).onComplete(function(){t.tweenGroup.remove(this)}).start())}return this}return Object.assign({},o.position,{lookAt:g()});function f(h){var p=h.x,v=h.y,y=h.z;p!==void 0&&(o.position.x=p),v!==void 0&&(o.position.y=v),y!==void 0&&(o.position.z=y)}function u(h){var p=new he.Vector3(h.x,h.y,h.z);t.controls.enabled&&t.controls.target?t.controls.target=p:o.lookAt(p)}function g(){return Object.assign(new he.Vector3(0,0,-1e3).applyQuaternion(o.quaternion).add(o.position))}},zoomToFit:function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return this.fitToBbox(this.getBbox.apply(this,o),n,r)},fitToBbox:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,o=t.camera;if(n){var a=new he.Vector3(0,0,0),s=Math.max.apply(Math,vt(Object.entries(n).map(function(h){var p=sg(h,2),v=p[0],y=p[1];return Math.max.apply(Math,vt(y.map(function(d){return Math.abs(a[v]-d)})))})))*2,l=(1-i*2/t.height)*o.fov,c=s/Math.atan(l*Math.PI/180),f=c/o.aspect,u=Math.max(c,f);if(u>0){var g=a.clone().sub(o.position).normalize().multiplyScalar(-u);this.cameraPosition(g,a,r)}}return this},getBbox:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},r=new he.Box3(new he.Vector3(0,0,0),new he.Vector3(0,0,0)),i=t.objects.filter(n);return i.length?(i.forEach(function(o){return r.expandByObject(o)}),Object.assign.apply(Object,vt(["x","y","z"].map(function(o){return ng({},o,[r.min[o],r.max[o]])})))):null},getScreenCoords:function(t,n,r,i){var o=new he.Vector3(n,r,i);return o.project(this.camera()),{x:(o.x+1)*t.width/2,y:-(o.y-1)*t.height/2}},getSceneCoords:function(t,n,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=new he.Vector2(n/t.width*2-1,-(r/t.height)*2+1),a=new he.Raycaster;return a.setFromCamera(o,t.camera),Object.assign({},a.ray.at(i,new he.Vector3))},intersectingObjects:function(t,n,r){var i=new he.Vector2(n/t.width*2-1,-(r/t.height)*2+1),o=new he.Raycaster;return o.params.Line.threshold=t.lineHoverPrecision,o.params.Points.threshold=t.pointsHoverPrecision,o.setFromCamera(i,t.camera),o.intersectObjects(t.objects,!0)},renderer:function(t){return t.renderer},scene:function(t){return t.scene},camera:function(t){return t.camera},postProcessingComposer:function(t){return t.postProcessingComposer},controls:function(t){return t.controls},tbControls:function(t){return t.controls},_destructor:function(t){var n,r,i;ug(t.scene),(n=t.controls)===null||n===void 0||n.dispose(),(r=t.renderer)===null||r===void 0||r.dispose(),(i=t.postProcessingComposer)===null||i===void 0||i.dispose()}},stateInit:function(){return{scene:new he.Scene,camera:new he.PerspectiveCamera,timer:new he.Timer,tweenGroup:new Ua,lastRaycasterCheck:0}},init:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.controlType,o=i===void 0?"trackball":i,a=r.useWebGPU,s=a===void 0?!1:a,l=r.rendererConfig,c=l===void 0?{}:l,f=r.extraRenderers,u=f===void 0?[]:f,g=r.waitForLoadComplete,h=g===void 0?!0:g;t.innerHTML="",t.appendChild(n.container=document.createElement("div")),n.container.className="scene-container",n.container.style.position="relative",n.container.appendChild(n.navInfo=document.createElement("div")),n.navInfo.className="scene-nav-info",n.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[o]||"",n.navInfo.style.display=n.showNavInfo?null:"none",n.tooltip=new Qp(n.container),n.pointerPos=new he.Vector2,n.pointerPos.x=-2,n.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(p){return n.container.addEventListener(p,function(v){if(p==="pointerdown"&&(n.isPointerPressed=!0),!n.isPointerDragging&&v.type==="pointermove"&&(v.pressure>0||n.isPointerPressed)&&(v.pointerType==="mouse"||v.movementX===void 0||[v.movementX,v.movementY].some(function(b){return Math.abs(b)>1}))&&(n.isPointerDragging=!0),n.enablePointerInteraction){var y=d(n.container);n.pointerPos.x=v.pageX-y.left,n.pointerPos.y=v.pageY-y.top}function d(b){var m=b.getBoundingClientRect(),x=window.pageXOffset||document.documentElement.scrollLeft,w=window.pageYOffset||document.documentElement.scrollTop;return{top:m.top+w,left:m.left+x}}},{passive:!0})}),n.container.addEventListener("pointerup",function(p){n.isPointerPressed&&(n.isPointerPressed=!1,!(n.isPointerDragging&&(n.isPointerDragging=!1,!n.clickAfterDrag))&&requestAnimationFrame(function(){p.button===0&&n.onClick(n.hoverObj||null,p,n.intersection),p.button===2&&n.onRightClick&&n.onRightClick(n.hoverObj||null,p,n.intersection)}))},{passive:!0,capture:!0}),n.container.addEventListener("contextmenu",function(p){n.onRightClick&&p.preventDefault()}),n.renderer=new(s?el.WebGPURenderer:he.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),n.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),n.container.appendChild(n.renderer.domElement),n.extraRenderers=u,n.extraRenderers.forEach(function(p){p.domElement.style.position="absolute",p.domElement.style.top="0px",p.domElement.style.pointerEvents="none",n.container.appendChild(p.domElement)}),n.postProcessingComposer=new il.EffectComposer(n.renderer),n.postProcessingComposer.addPass(new ol.RenderPass(n.scene,n.camera)),n.controls=new{trackball:tl.TrackballControls,orbit:nl.OrbitControls,fly:rl.FlyControls}[o](n.camera,n.renderer.domElement),o==="fly"&&(n.controls.movementSpeed=300,n.controls.rollSpeed=Math.PI/6,n.controls.dragToLook=!0),(o==="trackball"||o==="orbit")&&(n.controls.minDistance=.1,n.controls.maxDistance=n.skyRadius,n.controls.addEventListener("start",function(){n.controlsEngaged=!0}),n.controls.addEventListener("change",function(){n.controlsEngaged&&(n.controlsDragging=!0)}),n.controls.addEventListener("end",function(){n.controlsEngaged=!1,n.controlsDragging=!1})),[n.renderer,n.postProcessingComposer].concat(vt(n.extraRenderers)).forEach(function(p){return p.setSize(n.width,n.height)}),n.camera.aspect=n.width/n.height,n.camera.updateProjectionMatrix(),n.camera.position.z=1e3,n.scene.add(n.skysphere=new he.Mesh),n.skysphere.visible=!1,n.loadComplete=n.scene.visible=!h,window.scene=n.scene},update:function(t,n){if(t.width&&t.height&&(n.hasOwnProperty("width")||n.hasOwnProperty("height"))){var r,i=t.width,o=t.height;t.container.style.width="".concat(i,"px"),t.container.style.height="".concat(o,"px"),[t.renderer,t.postProcessingComposer].concat(vt(t.extraRenderers)).forEach(function(h){return h.setSize(i,o)}),t.camera.aspect=i/o;var a=t.viewOffset.slice(0,2);a.some(function(h){return h})&&(r=t.camera).setViewOffset.apply(r,[i,o].concat(vt(a),[i,o])),t.camera.updateProjectionMatrix()}if(n.hasOwnProperty("viewOffset")){var s,l=t.width,c=t.height,f=t.viewOffset.slice(0,2);f.some(function(h){return h})?(s=t.camera).setViewOffset.apply(s,[l,c].concat(vt(f),[l,c])):t.camera.clearViewOffset()}if(n.hasOwnProperty("skyRadius")&&t.skyRadius&&(t.controls.hasOwnProperty("maxDistance")&&n.skyRadius&&(t.controls.maxDistance=Math.min(t.controls.maxDistance,t.skyRadius)),t.camera.far=t.skyRadius*2.5,t.camera.updateProjectionMatrix(),t.skysphere.geometry=new he.SphereGeometry(t.skyRadius)),n.hasOwnProperty("backgroundColor")){var u=Rt(t.backgroundColor).alpha;u===void 0&&(u=1),t.renderer.setClearColor(new he.Color(Dd(1,t.backgroundColor)),u)}n.hasOwnProperty("backgroundImageUrl")&&(t.backgroundImageUrl?new he.TextureLoader().load(t.backgroundImageUrl,function(h){h.colorSpace=he.SRGBColorSpace,t.skysphere.material=new he.MeshBasicMaterial({map:h,side:he.BackSide}),t.skysphere.visible=!0,t.onBackgroundImageLoaded&&setTimeout(t.onBackgroundImageLoaded),!t.loadComplete&&g()}):(t.skysphere.visible=!1,t.skysphere.material.map=null,!t.loadComplete&&g())),n.hasOwnProperty("showNavInfo")&&(t.navInfo.style.display=t.showNavInfo?null:"none"),n.hasOwnProperty("lights")&&((n.lights||[]).forEach(function(h){return t.scene.remove(h)}),t.lights.forEach(function(h){return t.scene.add(h)})),n.hasOwnProperty("objects")&&((n.objects||[]).forEach(function(h){return t.scene.remove(h)}),t.objects.forEach(function(h){return t.scene.add(h)}));function g(){t.loadComplete=t.scene.visible=!0}}});function fg(e,t){let n=null,r=null;const i=(...o)=>{r=o,n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null;const a=r;r=null,e(...a)},t)};return i.cancel=()=>{n!==null&&(clearTimeout(n),n=null),r=null},i}class dg{name;defaultVal;triggerUpdate;onChange;constructor(t,n){this.name=t,this.defaultVal=n.default??null,this.triggerUpdate=n.triggerUpdate??!0,this.onChange=n.onChange??(()=>{})}}function hg(e={}){const{stateInit:t=()=>({}),props:n={},methods:r={},aliases:i={},init:o=()=>{},update:a=()=>{}}=e,s=Object.keys(n).map(c=>new dg(c,n[c]));function l(...c){const f=this instanceof l,u=c.slice(),g=f?u.shift():void 0,h=u[0]??{},p=typeof t=="function"?t(h):t,v=Object.assign({},p,{initialised:!1,_rerender:()=>{}});let y={};const d=x=>(b(x,h),m(),d);function b(x,w){o.call(d,x,v,w),v.initialised=!0}const m=fg(()=>{v.initialised&&(a.call(d,v,y),y={})},1);for(const x of s){const{name:w,triggerUpdate:_,onChange:k,defaultVal:C}=x;d[w]=function(){const M=v[w];if(arguments.length===0)return M;const N=arguments[0],E=N===void 0?C:N;return v[w]=E,k.call(d,E,v,M),Object.prototype.hasOwnProperty.call(y,w)||(y[w]=M),_&&m(),d}}for(const x of Object.keys(r))d[x]=function(...w){return r[x].call(d,v,...w)};for(const[x,w]of Object.entries(i))d[x]=d[w];return d.resetProps=function(){for(const x of s)d[x.name](x.defaultVal);return d},d.resetProps(),v._rerender=m,f&&g!==void 0&&d(g),d}return l}function zo(e){if(typeof e=="function")return e;if(typeof e=="string"){const n=e;return r=>r?.[n]}const t=e;return()=>t}function ms(e,t){const n=e instanceof Array?e:[e],r=new t;return r._destructor?.(),{linkProp(i){return{default:r[i](),onChange(o,a){n.forEach(s=>{a[s][i].call(a[s],o)})},triggerUpdate:!1}},linkMethod(i){return function(o,...a){const s=[];return n.forEach(l=>{const c=o[l],f=c[i].apply(c,a);f!==c&&s.push(f)}),s.length?s[0]:this}}}}const Fo=globalThis,Bo=Fo.THREE?Fo.THREE:{AmbientLight:K.AmbientLight,DirectionalLight:K.DirectionalLight},pg=170,bs=ms("forceGraph",Da),gg=["jsonUrl","graphData","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeColor","nodeAutoColorBy","nodeOpacity","nodeVisibility","nodeThreeObject","nodeThreeObjectExtend","nodePositionUpdate","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject","forceEngine","d3AlphaDecay","d3VelocityDecay","d3AlphaMin","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"],vg=["refresh","getGraphBbox","d3Force","d3ReheatSimulation","emitParticle"],Wn=ms("renderObjs",ys),yg=["width","height","backgroundColor","showNavInfo","enablePointerInteraction"],mg=["lights","cameraPosition","postProcessingComposer"],fi={};for(const e of gg)fi[e]=bs.linkProp(e);for(const e of yg)fi[e]=Wn.linkProp(e);const fn={};for(const e of vg)fn[e]=bs.linkMethod(e);for(const e of mg)fn[e]=Wn.linkMethod(e);fn.graph2ScreenCoords=Wn.linkMethod("getScreenCoords");fn.screen2GraphCoords=Wn.linkMethod("getSceneCoords");const He=e=>e;function ot(e){let t=e??null;for(;t&&!Object.prototype.hasOwnProperty.call(t,"__graphObjType");)t=t.parent;return t}const bg=hg({props:{nodeLabel:{default:"name",triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:1,onChange(e,t){He(t).renderObjs.lineHoverPrecision(e)},triggerUpdate:!1},enableNavigationControls:{default:!0,onChange(e,t){const r=He(t).renderObjs.controls();r&&(r.enabled=!!e,e&&r.domElement&&r.domElement.dispatchEvent(new PointerEvent("pointerup")))},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},onNodeDrag:{default:()=>{},triggerUpdate:!1},onNodeDragEnd:{default:()=>{},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},...fi},methods:{zoomToFit(e,t,n,...r){return He(e).renderObjs.fitToBbox(this.getGraphBbox(...r),t,n),this},pauseAnimation(e){const t=He(e);return t.animationFrameRequestId!=null&&(cancelAnimationFrame(t.animationFrameRequestId),t.animationFrameRequestId=null),this},resumeAnimation(e){return He(e).animationFrameRequestId==null&&this._animationCycle(),this},_animationCycle(e){const t=He(e);t.enablePointerInteraction&&(this.renderer().domElement.style.cursor=""),t.forceGraph.tickFrame(),t.renderObjs.tick(),t.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},scene(e){return He(e).renderObjs.scene()},camera(e){return He(e).renderObjs.camera()},renderer(e){return He(e).renderObjs.renderer()},controls(e){return He(e).renderObjs.controls()},_destructor(e){const t=He(e);this.pauseAnimation(),this.graphData({nodes:[],links:[]}),t.forceGraph._destructor?.(),t.renderObjs._destructor()},...fn},stateInit:e=>{const t=e??{},n=new Da,r=ys({...t.controlType?{controlType:t.controlType}:{},...t.rendererConfig?{rendererConfig:t.rendererConfig}:{},...t.extraRenderers?{extraRenderers:t.extraRenderers}:{}});return r.objects([n]),r.lights([new Bo.AmbientLight(13421772,Math.PI),new Bo.DirectionalLight(16777215,.6*Math.PI)]),{forceGraph:n,renderObjs:r}},init(e,t){const n=He(t);e.innerHTML="",n.container=document.createElement("div"),n.container.style.position="relative",e.appendChild(n.container);const r=document.createElement("div");n.container.appendChild(r),n.renderObjs(r);const i=n.renderObjs.camera(),o=n.renderObjs.renderer(),a=n.renderObjs.controls();a&&(a.enabled=!!n.enableNavigationControls),n.lastSetCameraZ=i.position.z;const s=document.createElement("div");s.className="graph-info-msg",s.textContent="",n.container.appendChild(s);const l=n.forceGraph;l.onLoading(()=>{s.textContent="Loading..."}),l.onFinishLoading(()=>{s.textContent=""}),l.onUpdate(()=>{if(n.graphData=l.graphData(),i.position.x===0&&i.position.y===0&&i.position.z===n.lastSetCameraZ&&n.graphData.nodes.length){i.lookAt(l.position??{x:0,y:0,z:0});const f=Math.cbrt(n.graphData.nodes.length)*pg;i.position.z=f,n.lastSetCameraZ=f}}),l.onFinishUpdate(()=>{if(n._dragControls){const f=n.graphData.nodes.find(u=>u.__initialFixedPos&&!u.__disposeControlsAfterDrag);f?f.__disposeControlsAfterDrag=!0:n._dragControls.dispose(),n._dragControls=void 0}if(n.enableNodeDrag&&n.enablePointerInteraction&&n.forceEngine==="d3"){const f=n.graphData.nodes.map(h=>h.__threeObj).filter(h=>!!h),u=new Js.DragControls(f,i,o.domElement);n._dragControls=u,u.addEventListener("dragstart",h=>{const p=h,v=ot(p.object);if(!v)return;a&&(a.enabled=!1),p.object.__initialPos=p.object.position.clone(),p.object.__prevPos=p.object.position.clone();const y=v.__data;y.__initialFixedPos||(y.__initialFixedPos={fx:y.fx,fy:y.fy,fz:y.fz}),y.__initialPos||(y.__initialPos={x:y.x,y:y.y,z:y.z});for(const d of["x","y","z"])y[`f${d}`]=y[d];o.domElement.classList.add("grabbable")});const g=4;u.addEventListener("drag",h=>{const p=h,v=ot(p.object);if(!v)return;if(!Object.prototype.hasOwnProperty.call(p.object,"__graphObjType")){const m=p.object.__initialPos,x=p.object.__prevPos,w=p.object.position,_=w.clone().sub(x);v.position.add(_),x.copy(w),w.copy(m)}const y=v.__data,d=v.position;if(!y.__dragCommitted){const m=y.__initialPos,x=m?.x??d.x,w=m?.y??d.y,_=m?.z??d.z,k=d.x-x,C=d.y-w,P=d.z-_;if(k*k+C*C+P*P<g)return;y.__dragCommitted=!0}const b={x:d.x-(y.x??0),y:d.y-(y.y??0),z:d.z-(y.z??0)};for(const m of["x","y","z"])y[`f${m}`]=d[m],y[m]=d[m];n.forceGraph.d3AlphaTarget(.3).resetCountdown(),y.__dragged=!0,n.onNodeDrag?.(y,b)}),u.addEventListener("dragend",h=>{const p=h,v=ot(p.object);if(!v)return;delete p.object.__initialPos,delete p.object.__prevPos;const y=v.__data;y.__disposeControlsAfterDrag&&(u.dispose(),delete y.__disposeControlsAfterDrag);const d=y.__initialFixedPos,b=y.__initialPos,m=b?{x:b.x-y.x,y:b.y-y.y,z:b.z-y.z}:{x:0,y:0,z:0};if(d){for(const x of["x","y","z"]){const w=`f${x}`;d[w]===void 0&&delete y[w]}delete y.__initialFixedPos,delete y.__initialPos,delete y.__dragCommitted,y.__dragged&&(delete y.__dragged,n.onNodeDragEnd?.(y,m))}n.forceGraph.d3AlphaTarget(0).resetCountdown(),n.enableNavigationControls&&a&&(a.enabled=!0,a._status&&a._onPointerCancel?.(),a.domElement?.ownerDocument?.dispatchEvent(new PointerEvent("pointerup",{pointerType:"touch"}))),o.domElement.classList.remove("grabbable")})}}),parseInt(K.REVISION,10)<155&&(o.useLegacyLights=!1),n.renderObjs.hoverOrderComparator((f,u)=>{const g=ot(f);if(!g)return 1;const h=ot(u);if(!h)return-1;const p=v=>v.__graphObjType==="node"?1:0;return p(h)-p(g)}).tooltipContent(f=>{const u=ot(f);if(!u)return"";const g=n[`${u.__graphObjType}Label`];return zo(g)(u.__data)||""}).hoverDuringDrag(!1).onHover(f=>{const u=ot(f);if(u===n.hoverObj)return;const g=n.hoverObj??null,h=g?g.__graphObjType:null,p=g?g.__data:null,v=u?u.__graphObjType:null,y=u?u.__data:null;if(h&&h!==v){const m=n[`on${h==="node"?"Node":"Link"}Hover`];m?.(null,p)}if(v){const m=n[`on${v==="node"?"Node":"Link"}Hover`];m?.(y,h===v?p:null)}const b=!!(u?n[`on${v==="node"?"Node":"Link"}Click`]:n.onBackgroundClick)&&zo(n.showPointerCursor)(y);o.domElement.classList[b?"add":"remove"]("clickable"),n.hoverObj=u}).clickAfterDrag(!1).onClick((f,u)=>{const g=ot(f);if(g){const h=n[`on${g.__graphObjType==="node"?"Node":"Link"}Click`];h?.(g.__data,u)}else n.onBackgroundClick&&n.onBackgroundClick(u)}).onRightClick((f,u)=>{const g=ot(f);if(g){const h=n[`on${g.__graphObjType==="node"?"Node":"Link"}RightClick`];h?.(g.__data,u)}else n.onBackgroundRightClick&&n.onBackgroundRightClick(u)}),this._animationCycle()},update(){}});function jt(e,t,n){if(typeof requestAnimationFrame!="function")return t(1),()=>{};const r=performance.now();let i=null,o=!1;const a=s=>{if(o)return;const l=s-r,c=Math.min(1,l/Math.max(e,1));t(_g(c)),c<1?i=requestAnimationFrame(a):i=null};return i=requestAnimationFrame(a),()=>{o=!0,i!==null&&cancelAnimationFrame(i),i=null}}function _g(e){return 1-(1-e)*(1-e)}function ae(e,t,n){return e+(t-e)*n}const te=()=>!0,Ue=e=>e==="2d",ye=e=>e==="3d",xg=[{key:"nodeId",setter:"nodeId",supports:te},{key:"linkSource",setter:"linkSource",supports:te},{key:"linkTarget",setter:"linkTarget",supports:te},{key:"backgroundColor",setter:"backgroundColor",supports:te},{key:"nodeColor",setter:"nodeColor",supports:te},{key:"nodeLabel",setter:"nodeLabel",supports:te},{key:"nodeVal",setter:"nodeVal",supports:te},{key:"nodeAutoColorBy",setter:"nodeAutoColorBy",supports:te},{key:"nodeRelSize",setter:"nodeRelSize",supports:te},{key:"nodeVisibility",setter:"nodeVisibility",supports:te},{key:"linkColor",setter:"linkColor",supports:te},{key:"linkLabel",setter:"linkLabel",supports:te},{key:"linkWidth",setter:"linkWidth",supports:te},{key:"linkCurvature",setter:"linkCurvature",supports:te},{key:"linkAutoColorBy",setter:"linkAutoColorBy",supports:te},{key:"linkVisibility",setter:"linkVisibility",supports:te},{key:"linkDirectionalArrowLength",setter:"linkDirectionalArrowLength",supports:te},{key:"linkDirectionalArrowColor",setter:"linkDirectionalArrowColor",supports:te},{key:"linkDirectionalArrowRelPos",setter:"linkDirectionalArrowRelPos",supports:te},{key:"linkDirectionalParticles",setter:"linkDirectionalParticles",supports:te},{key:"linkDirectionalParticleSpeed",setter:"linkDirectionalParticleSpeed",supports:te},{key:"linkDirectionalParticleWidth",setter:"linkDirectionalParticleWidth",supports:te},{key:"linkDirectionalParticleOffset",setter:"linkDirectionalParticleOffset",supports:te},{key:"linkDirectionalParticleColor",setter:"linkDirectionalParticleColor",supports:te},{key:"cooldownTicks",setter:"cooldownTicks",supports:te},{key:"cooldownTime",setter:"cooldownTime",supports:te},{key:"warmupTicks",setter:"warmupTicks",supports:te},{key:"d3AlphaDecay",setter:"d3AlphaDecay",supports:te},{key:"d3VelocityDecay",setter:"d3VelocityDecay",supports:te},{key:"d3AlphaMin",setter:"d3AlphaMin",supports:te},{key:"d3AlphaTarget",setter:"d3AlphaTarget",supports:te},{key:"dagMode",setter:"dagMode",supports:te},{key:"dagLevelDistance",setter:"dagLevelDistance",supports:te},{key:"dagNodeFilter",setter:"dagNodeFilter",supports:te},{key:"onDagError",setter:"onDagError",supports:te},{key:"enableNodeDrag",setter:"enableNodeDrag",supports:te},{key:"enablePointerInteraction",setter:"enablePointerInteraction",supports:te},{key:"linkHoverPrecision",setter:"linkHoverPrecision",supports:te},{key:"showPointerCursor",setter:"showPointerCursor",supports:te},{key:"enableZoom",setter:"enableZoomInteraction",supports:Ue},{key:"enablePan",setter:"enablePanInteraction",supports:Ue},{key:"minZoom",setter:"minZoom",supports:Ue},{key:"maxZoom",setter:"maxZoom",supports:Ue},{key:"autoPauseRedraw",setter:"autoPauseRedraw",supports:Ue},{key:"linkLineDash",setter:"linkLineDash",supports:Ue},{key:"nodeCanvasObject",setter:"nodeCanvasObject",supports:Ue},{key:"nodeCanvasObjectMode",setter:"nodeCanvasObjectMode",supports:Ue},{key:"nodePointerAreaPaint",setter:"nodePointerAreaPaint",supports:Ue},{key:"linkCanvasObject",setter:"linkCanvasObject",supports:Ue},{key:"linkCanvasObjectMode",setter:"linkCanvasObjectMode",supports:Ue},{key:"linkPointerAreaPaint",setter:"linkPointerAreaPaint",supports:Ue},{key:"showNavInfo",setter:"showNavInfo",supports:ye},{key:"enableNavigationControls",setter:"enableNavigationControls",supports:ye},{key:"nodeOpacity",setter:"nodeOpacity",supports:ye},{key:"nodeResolution",setter:"nodeResolution",supports:ye},{key:"linkOpacity",setter:"linkOpacity",supports:ye},{key:"linkResolution",setter:"linkResolution",supports:ye},{key:"linkCurveRotation",setter:"linkCurveRotation",supports:ye},{key:"linkMaterial",setter:"linkMaterial",supports:ye},{key:"nodeThreeObject",setter:"nodeThreeObject",supports:ye},{key:"nodeThreeObjectExtend",setter:"nodeThreeObjectExtend",supports:ye},{key:"linkThreeObject",setter:"linkThreeObject",supports:ye},{key:"linkThreeObjectExtend",setter:"linkThreeObjectExtend",supports:ye},{key:"nodePositionUpdate",setter:"nodePositionUpdate",supports:ye},{key:"linkPositionUpdate",setter:"linkPositionUpdate",supports:ye},{key:"linkDirectionalArrowResolution",setter:"linkDirectionalArrowResolution",supports:ye},{key:"linkDirectionalParticleResolution",setter:"linkDirectionalParticleResolution",supports:ye},{key:"numDimensions",setter:"numDimensions",supports:ye},{key:"forceEngine",setter:"forceEngine",supports:ye},{key:"ngraphPhysics",setter:"ngraphPhysics",supports:ye},{key:"pointerRaycasterThrottleMs",setter:"pointerRaycasterThrottleMs",supports:ye}];function $o(e,t,n,r){if(t!==n)for(const i of xg){if(!i.supports(r))continue;const o=t[i.key],a=n[i.key];if(Object.is(o,a))continue;const s=e[i.setter];typeof s=="function"&&s.call(e,o)}}const wg=["onNodeClick","onNodeRightClick","onNodeHover","onNodeDrag","onNodeDragEnd","onLinkClick","onLinkRightClick","onLinkHover","onBackgroundClick","onBackgroundRightClick","onEngineTick","onEngineStop"],yt=1200,Qt=300;function kg(e,t,n){const r=new bg(e,{controlType:"orbit"});r.width(t.width),r.height(t.height);for(const v of wg){const y=r[v];typeof y=="function"&&y.call(r,(...d)=>{const b=n.current[v];typeof b=="function"&&b(...d)})}$o(r,t.initialProps,{},"3d"),r.graphData(t.initialData);let i=t.initialMode,o=i==="2d"?yt:Qt,a=null,s=null;const l=v=>{const y=r.controls?.();if(!y)return;const d=y;v==="2d"?(d.noRotate=!0,d.enableRotate=!1,d.zoomToCursor=!0,d.screenSpacePanning=!0,d.zoomSpeed=1.6,d.panSpeed=1.2,d.mouseButtons&&(d.mouseButtons.LEFT=K.MOUSE.PAN)):(d.noRotate=!1,d.enableRotate=!0,d.zoomToCursor=!1,d.screenSpacePanning=!1,d.zoomSpeed=1,d.panSpeed=1,d.mouseButtons&&(d.mouseButtons.LEFT=K.MOUSE.ROTATE))},c=()=>{const v=r.graphData();for(const y of v.nodes)y.fz=0},f=()=>{const v=r.graphData();for(const y of v.nodes)delete y.fz},u=()=>{const v=r.graphData(),y=new Map;let d=0;for(const m of v.nodes){const x=m.x??0,w=m.y??0,_=Math.hypot(x,w);_>d&&(d=_)}const b=Math.max(40,d*.6);for(const m of v.nodes)y.set(m,(Math.random()-.5)*2*b);return y};i==="2d"?(c(),l("2d"),r.cameraPosition?.({x:0,y:0,z:yt},{x:0,y:0,z:0},0)):l("3d");const g=()=>r.cameraPosition?.();return{get mode(){return i},setGraphData(v){r.graphData(v),i==="2d"&&c()},getGraphData(){return r.graphData()},fit(v,y){r.zoomToFit?.(v??400,y??40)},centerAt(v,y,d,b){if(i==="2d"){r.cameraPosition?.({x:v,y,z:yt},{x:v,y,z:0},b??0);return}const m=g();r.cameraPosition?.({x:v,y,z:d??o},m?.lookAt,b??0)},zoom(v,y){const d=g();if(!d)return;const b=Math.hypot(d.x,d.y,d.z);o=b/Math.max(v,.001);const m=b===0?{x:0,y:0,z:1}:{x:d.x/b,y:d.y/b,z:d.z/b};r.cameraPosition?.({x:m.x*o,y:m.y*o,z:m.z*o},d.lookAt,y??0)},getZoom(){const v=g();if(!v)return 1;const y=Math.hypot(v.x,v.y,v.z);return y===0?1:o/y},screen2Graph(v,y,d){return r.screen2GraphCoords?.(v,y,d??0)??{x:v,y,z:0}},graph2Screen(v,y,d){return r.graph2ScreenCoords?.(v,y,d??0)??{x:v,y,z:d??0}},getGraphBbox(){return r.getGraphBbox?.()??{x:[0,0],y:[0,0],z:[0,0]}},pause(){r.pauseAnimation?.()},resume(){r.resumeAnimation?.()},reheat(){r.d3ReheatSimulation?.()},resize(v,y){r.width(v),r.height(y)},d3Force(v,y){const d=r.d3Force;if(typeof d=="function")return y===void 0?d.call(r,v):d.call(r,v,y)},emitParticle(v){r.emitParticle?.(v)},stopAnimation(){s?.(),s=null},focusOn(v,y){s?.();const d=g();if(!d)return;const b=v.z??0,m=y?.durationMs??1e3;if(i==="2d"){const B=y?.zoom!==void 0?o/Math.max(y.zoom,.001):yt;s=jt(m,S=>{const O=ae(d.x,v.x,S),L=ae(d.y,v.y,S),U=ae(d.z,B,S);r.cameraPosition?.({x:O,y:L,z:U},{x:O,y:L,z:0},0)});return}const x=d.x-v.x,w=d.y-v.y,_=d.z-b,k=Math.hypot(x,w,_),C=y?.distance??120,P=k===0?{x:0,y:0,z:1}:{x:x/k,y:w/k,z:_/k},M={x:v.x+P.x*C,y:v.y+P.y*C,z:b+P.z*C},N={x:v.x,y:v.y,z:b},E=d.lookAt??{x:0,y:0,z:0};s=jt(m,B=>{r.cameraPosition?.({x:ae(d.x,M.x,B),y:ae(d.y,M.y,B),z:ae(d.z,M.z,B)},{x:ae(E.x,N.x,B),y:ae(E.y,N.y,B),z:ae(E.z,N.z,B)},0)})},getCameraState(){const v=g()??{x:0,y:0,z:Qt};if(i==="2d"){const y=v.lookAt??{x:0,y:0},d=o/Math.max(Math.hypot(v.x,v.y,v.z),1);return{mode:"2d",x:y.x,y:y.y,k:d}}return{mode:"3d",x:v.x,y:v.y,z:v.z,lookAt:v.lookAt??{x:0,y:0,z:0}}},setCameraState(v,y){s?.();const d=y??0,b=g()??{x:0,y:0,z:Qt};if(v.mode==="2d"){const x=p(v.k)??yt;if(d<=0){r.cameraPosition?.({x:v.x,y:v.y,z:x},{x:v.x,y:v.y,z:0},0);return}const w=b.lookAt??{x:0,y:0};s=jt(d,_=>{const k=ae(b.x,v.x,_),C=ae(b.y,v.y,_),P=ae(b.z,x,_);r.cameraPosition?.({x:k,y:C,z:P},{x:ae(w.x,v.x,_),y:ae(w.y,v.y,_),z:0},0)});return}if(d<=0){r.cameraPosition?.({x:v.x,y:v.y,z:v.z},v.lookAt,0);return}const m=b.lookAt??v.lookAt;s=jt(d,x=>{r.cameraPosition?.({x:ae(b.x,v.x,x),y:ae(b.y,v.y,x),z:ae(b.z,v.z,x)},{x:ae(m.x,v.lookAt.x,x),y:ae(m.y,v.lookAt.y,x),z:ae(m.z,v.lookAt.z,x)},0)})},applyProps(v,y){$o(r,v,y,"3d")},getCanvasElement(){return e.querySelector("canvas")},destroy(){s?.(),s=null,r._destructor()},setMode(v,y=800){if(v===i)return;i=v,s?.();const d=g()??{x:0,y:0,z:Qt};if(v==="2d"){a={x:d.x,y:d.y,z:d.z,lookAt:d.lookAt??{x:0,y:0,z:0}};const k=r.graphData(),C=new Map;for(const E of k.nodes){const B=E.z;C.set(E,typeof B=="number"?B:0)}const P=d.lookAt??{x:0,y:0,z:0},M={x:P.x,y:P.y,z:0},N={x:P.x,y:P.y,z:yt};s=jt(y,E=>{for(const[B,S]of C)B.z=ae(S,0,E);r.cameraPosition?.({x:ae(d.x,N.x,E),y:ae(d.y,N.y,E),z:ae(d.z,N.z,E)},{x:ae(P.x,M.x,E),y:ae(P.y,M.y,E),z:ae(P.z,M.z,E)},0),E>=1&&(c(),l("2d"),o=yt)});return}f(),l("3d");const b=u(),m=new Map;for(const[k]of b){const C=k.z;m.set(k,typeof C=="number"?C:0)}const x=a??{x:0,y:0,z:Qt,lookAt:{x:0,y:0,z:0}},w=x.lookAt??{x:0,y:0,z:0},_=d.lookAt??{x:0,y:0,z:0};s=jt(y,k=>{for(const[C,P]of b){const M=m.get(C)??0;C.z=ae(M,P,k)}r.cameraPosition?.({x:ae(d.x,x.x,k),y:ae(d.y,x.y,k),z:ae(d.z,x.z,k)},{x:ae(_.x,w.x,k),y:ae(_.y,w.y,k),z:ae(_.z,w.z,k)},0),k>=1&&(r.d3ReheatSimulation?.(),o=Math.hypot(x.x,x.y,x.z))})}};function p(v){return!Number.isFinite(v)||v===0?null:o/v}}function Cg(e){const{mount:t,mode:n,width:r,height:i,data:o,props:a,paused:s,modeTransitionMs:l=800}=e,[c,f]=A.useState(null),u=A.useRef(a);u.current=a;const g=A.useRef(a),h=A.useRef(n);return A.useEffect(()=>{if(!t)return;const p=kg(t,{initialProps:a,initialData:o,width:r,height:i,initialMode:h.current},u);return g.current=a,f(p),()=>{p.destroy(),f(null)}},[t]),A.useEffect(()=>{c&&c.mode!==n&&c.setMode(n,l)},[c,n,l]),A.useEffect(()=>{c&&(s?c.pause():c.resume())},[c,s]),A.useEffect(()=>{c&&c.resize(r,i)},[c,r,i]),A.useEffect(()=>{c&&c.setGraphData(o)},[c,o]),A.useEffect(()=>{c&&(c.applyProps(a,g.current),g.current=a)},[c,a]),c}function Sg(e){const[t,n]=A.useState(null);return A.useEffect(()=>{const r=e.current;if(!r)return;const i=new ResizeObserver(o=>{const a=o[0];if(!a)return;const s=a.contentRect;n({width:s.width,height:s.height})});return i.observe(r),()=>i.disconnect()},[e]),t}function Mg(e){const t=e.mode??"single",[n,r]=A.useState([]),i=A.useRef(e.onChange);i.current=e.onChange;const o=A.useRef(!0);A.useEffect(()=>{if(o.current){o.current=!1;return}i.current?.(n)},[n]);const a=A.useCallback((f,u)=>{t!=="none"&&r(g=>{const h=g.includes(f);return t==="single"||!u?.additive?h&&g.length===1?[]:[f]:h?g.filter(p=>p!==f):[...g,f]})},[t]),s=A.useCallback(f=>{t!=="none"&&r(t==="single"?f.slice(0,1):f)},[t]),l=A.useCallback(()=>r([]),[]),c=A.useCallback(f=>n.includes(f),[n]);return{selected:n,toggle:a,set:s,clear:l,isSelected:c}}function Pg(){const[e,t]=A.useState(!1);return A.useEffect(()=>{const n=o=>{o.key==="Shift"&&t(!0)},r=o=>{o.key==="Shift"&&t(!1)},i=()=>t(!1);return window.addEventListener("keydown",n),window.addEventListener("keyup",r),window.addEventListener("blur",i),()=>{window.removeEventListener("keydown",n),window.removeEventListener("keyup",r),window.removeEventListener("blur",i)}},[]),e}function Og(e,t){A.useEffect(()=>{if(!e)return;const n=new Map;for(const r of t.nodes)n.set(r.id,r),r._neighbors=[],r._links=[];for(const r of t.links){const i=typeof r.source=="object"?r.source.id:r.source,o=typeof r.target=="object"?r.target.id:r.target,a=n.get(i),s=n.get(o);!a||!s||(a._neighbors.push(s),s._neighbors.push(a),a._links.push(r),s._links.push(r))}},[e,t])}function Ag(e){const{mount:t,engineRef:n,selection:r,nodes:i,links:o,setSelectedLinkIds:a,liveHoverNodeIdRef:s}=e,l=A.useRef({selection:r,nodes:i,links:o,setSelectedLinkIds:a,liveHoverNodeIdRef:s});l.current.selection=r,l.current.nodes=i,l.current.links=o,l.current.setSelectedLinkIds=a,l.current.liveHoverNodeIdRef=s;const[c,f]=A.useState(null),u=A.useRef(null),g=A.useRef({x:0,y:0}).current;return A.useEffect(()=>{if(!t)return;let h=t.getBoundingClientRect();const p=()=>{h=t.getBoundingClientRect()},v=new ResizeObserver(p);v.observe(t),window.addEventListener("scroll",p,{passive:!0,capture:!0});const y=x=>{g.x=x.clientX-h.left,g.y=x.clientY-h.top,u.current=g};t.addEventListener("mousemove",y);const d=x=>{if(n.current?.stopAnimation(),x.button!==0||!x.shiftKey||l.current.liveHoverNodeIdRef.current!==null)return;const w=x.clientX-h.left,_=x.clientY-h.top;x.stopPropagation(),x.preventDefault(),f({x0:w,y0:_,x1:w,y1:_,additive:x.shiftKey});const k=P=>{const M=P.clientX-h.left,N=P.clientY-h.top;f(E=>E&&{...E,x1:M,y1:N})},C=P=>{window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",C,!0);const M=P.clientX-h.left,N=P.clientY-h.top;f(null);const E=n.current;if(!E)return;const B=Math.min(w,M),S=Math.min(_,N),O=Math.max(w,M),L=Math.max(_,N);if(O-B<3&&L-S<3)return;const U=l.current,ne=U.nodes,J=U.links,se=U.selection,D=U.setSelectedLinkIds,$=[],G=(F,R)=>F>=B&&F<=O&&R>=S&&R<=L,Z=new Map;for(const F of ne){if(Z.set(F.id,F),F.x===void 0||F.y===void 0)continue;const R=E.graph2Screen(F.x,F.y,F.z);G(R.x,R.y)&&$.push(F.id)}const I=[],H=F=>{if(F&&typeof F=="object"){const R=F;if(R.x!==void 0&&R.y!==void 0)return R.z!==void 0?{x:R.x,y:R.y,z:R.z}:{x:R.x,y:R.y}}if(typeof F=="string"||typeof F=="number"){const R=Z.get(F);if(R&&R.x!==void 0&&R.y!==void 0)return R.z!==void 0?{x:R.x,y:R.y,z:R.z}:{x:R.x,y:R.y}}return null};for(const F of J){if(F.id===void 0)continue;const R=H(F.source),q=H(F.target);if(!R||!q)continue;const V=E.graph2Screen((R.x+q.x)/2,(R.y+q.y)/2,R.z!==void 0&&q.z!==void 0?(R.z+q.z)/2:void 0),re=E.graph2Screen(R.x,R.y,R.z),le=E.graph2Screen(q.x,q.y,q.z);(G(V.x,V.y)||G(re.x,re.y)&&G(le.x,le.y))&&I.push(F.id)}if(P.shiftKey||P.metaKey||P.ctrlKey){const F=se.selected,R=F.slice(),q=new Set(F);for(const V of $)q.has(V)||(q.add(V),R.push(V));se.set(R),D(V=>{const re=V.slice(),le=new Set(V);for(const ce of I)le.has(ce)||(le.add(ce),re.push(ce));return re})}else se.set($),D(I)};window.addEventListener("mousemove",k),window.addEventListener("mouseup",C,!0)};t.addEventListener("mousedown",d,!0);const b=()=>n.current?.stopAnimation(),m=()=>n.current?.stopAnimation();return t.addEventListener("wheel",b,{passive:!0,capture:!0}),t.addEventListener("touchstart",m,{passive:!0,capture:!0}),()=>{t.removeEventListener("mousemove",y),t.removeEventListener("mousedown",d,!0),t.removeEventListener("wheel",b,{capture:!0}),t.removeEventListener("touchstart",m,{capture:!0}),window.removeEventListener("scroll",p,{capture:!0}),v.disconnect()}},[t,n]),{marquee:c,lastCursorRef:u}}const jg=60;function Tg(e,t={}){const n=typeof t=="number"?{tolerancePx:t}:t,r=n.tolerancePx??12,i=n.pressGraceMs??jg;A.useEffect(()=>{if(!e)return;const o=r*r;let a=!1,s=!1,l=0,c=0,f=0;const u=p=>{e.contains(p.target)&&(a=!0,s=!1,l=p.clientX,c=p.clientY,f=performance.now())},g=p=>{if(!a||s)return;if(performance.now()-f<i){p.stopPropagation();return}const v=p.clientX-l,y=p.clientY-c;v*v+y*y<o?p.stopPropagation():s=!0},h=()=>{a=!1,s=!1};return window.addEventListener("pointerdown",u,!0),window.addEventListener("pointermove",g,!0),window.addEventListener("mousemove",g,!0),window.addEventListener("pointerup",h,!0),window.addEventListener("pointercancel",h,!0),window.addEventListener("mouseup",h,!0),()=>{window.removeEventListener("pointerdown",u,!0),window.removeEventListener("pointermove",g,!0),window.removeEventListener("mousemove",g,!0),window.removeEventListener("pointerup",h,!0),window.removeEventListener("pointercancel",h,!0),window.removeEventListener("mouseup",h,!0)}},[e,r,i])}function Eg(e){const{enableClipboard:t,dataApi:n,selection:r,setSelectedLinkIds:i,engineRef:o,lastCursorRef:a,onCopy:s,onCut:l,onPaste:c}=e,f=A.useRef([]),u=A.useCallback(()=>{const m=new Set(r.selected),x=[];for(const w of n.data.nodes){if(!m.has(w.id))continue;const{id:_,x:k,y:C,z:P,vx:M,vy:N,vz:E,fx:B,fy:S,fz:O,...L}=w;x.push(L)}return x},[n.data.nodes,r.selected]),g=A.useCallback(()=>{if(!t)return[];const m=new Set(r.selected),x=n.data.nodes.filter(w=>m.has(w.id));return f.current=u(),s?.(x),x},[t,n.data.nodes,r.selected,u,s]),h=A.useCallback(()=>{if(!t)return[];const m=new Set(r.selected),x=n.data.nodes.filter(w=>m.has(w.id));return f.current=u(),l?.(x),r.selected.length>0&&(n.removeNodes(r.selected),r.clear()),x},[t,n,r,u,l]),p=A.useCallback(m=>{if(!t)return[];const x=f.current;if(x.length===0)return[];const w=m||(()=>{const k=a.current;if(!(!k||!o.current))return o.current.screen2Graph(k.x,k.y)})(),_=n.addNodes(x.map((k,C)=>{const P=C%3*24,M=Math.floor(C/3)*24;return{...k,...w?{x:w.x+P,y:w.y+M,...w.z!==void 0?{z:w.z+M}:{}}:{}}}));return r.set(_.map(k=>k.id)),i([]),c?.(_),_},[t,n,r,i,c,o,a]),v=A.useCallback(()=>{const m=new Set(r.selected),x=[];let w=0;for(const k of n.data.nodes){if(!m.has(k.id))continue;const{id:C,vx:P,vy:M,vz:N,fx:E,fy:B,fz:S,...O}=k,L=w%3*24,U=Math.floor(w/3)*24;x.push({...O,...k.x!==void 0?{x:k.x+L}:{},...k.y!==void 0?{y:k.y+U}:{},...k.z!==void 0?{z:k.z}:{}}),w++}if(x.length===0)return[];const _=n.addNodes(x);return r.set(_.map(k=>k.id)),i([]),_},[n,r,i]),y=A.useCallback(m=>{const x=r.selected;if(x.length===0)return null;const w=n.data.nodes.filter(P=>x.includes(P.id));if(w.length===0)return null;let _=m?.at;if(!_){let P=0,M=0,N=0,E=!1;for(const B of w)P+=B.x??0,M+=B.y??0,N+=B.z??0,(B.x!==void 0||B.y!==void 0)&&(E=!0);E&&(_={x:P/w.length+30,y:M/w.length+30,z:N/w.length})}const k=m?.label!==void 0?{label:m.label}:{},C=n.addNode(k,_?{at:_}:void 0);for(const P of w)n.addLink({source:P.id,target:C.id});return r.set([C.id]),i([]),C},[n,r,i]),d=A.useCallback(m=>{const x=n.data.nodes.find(w=>w.id===m);x&&(x.fx!==void 0?n.updateNode(m,{fx:void 0,fy:void 0,fz:void 0}):n.updateNode(m,{fx:x.x,fy:x.y,...x.z!==void 0?{fz:x.z}:{}}))},[n]),b=A.useCallback(()=>f.current.length>0,[]);return A.useMemo(()=>({hasClipboard:b,copy:g,cut:h,paste:p,duplicate:v,addConnectedNode:y,togglePin:d}),[b,g,h,p,v,y,d])}function Lg(e){const t=A.useRef(e);t.current=e,A.useEffect(()=>{const n=r=>{const i=r.target;if(i&&(i.tagName==="INPUT"||i.tagName==="TEXTAREA"||i.isContentEditable))return;const a=t.current;switch(r.key){case"v":case"V":a.enableClipboard&&(r.metaKey||r.ctrlKey)?(a.paste(),r.preventDefault()):a.setActiveTool("select");break;case"h":case"H":a.setActiveTool("pan");break;case"n":case"N":a.setActiveTool("add-node");break;case"l":case"L":a.setActiveTool("add-link");break;case"f":case"F":a.engine?.fit(400,40);break;case"3":a.setMode(a.mode==="2d"?"3d":"2d");break;case"Backspace":case"Delete":if(a.selection.selected.length>0&&(a.dataApi.removeNodes(a.selection.selected),a.selection.clear(),r.preventDefault()),a.selectedLinkIds.length>0){const s=new Set(a.selectedLinkIds);a.dataApi.removeLink(l=>l.id!==void 0&&s.has(l.id)),a.setSelectedLinkIds([]),r.preventDefault()}break;case"a":case"A":(r.metaKey||r.ctrlKey)&&(a.selection.set(a.dataApi.data.nodes.map(s=>s.id)),a.setSelectedLinkIds(a.dataApi.data.links.map(s=>s.id).filter(s=>s!==void 0)),r.preventDefault());break;case"c":case"C":a.enableClipboard&&(r.metaKey||r.ctrlKey)&&a.copy();break;case"x":case"X":a.enableClipboard&&(r.metaKey||r.ctrlKey)&&(a.cut(),r.preventDefault());break;case"d":case"D":(r.metaKey||r.ctrlKey)&&(a.duplicate(),r.preventDefault());break;case"p":case"P":for(const s of a.selection.selected)a.togglePin(s);break;case"Enter":a.selection.selected.length>0&&(a.addConnectedNode(),r.preventDefault());break;case"Escape":a.selection.clear(),a.setSelectedLinkIds([]),a.setLinkSourceId(null);break}};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[])}function Ng(e){const{engine:t,collideNodes:n,beeswarm:r,nodeRelSize:i}=e;A.useEffect(()=>{if(!t||r)return;if(!n){t.d3Force("collide",null);return}const o=typeof n=="number"?n:(i??4)+2;return t.d3Force("collide",Xi(o)),t.reheat(),()=>{t.d3Force("collide",null)}},[t,n,i,r]),A.useEffect(()=>{if(!t)return;if(!r){t.d3Force("x",null),t.d3Force("y",null);return}const o=r===!0?{}:r,a=o.axis??"x",s=o.strength??.2,l=o.value,c=g=>{const h=String(g);let p=0;for(let v=0;v<h.length;v++)p=p*31+h.charCodeAt(v)|0;return(p%600+600)%600-300},f=g=>{const h=g;if(typeof l=="function")return l(h);if(typeof l=="string"){const p=h[l];if(typeof p=="number")return p;if(typeof p=="string")return Number(p)||0}return c(h.id)};t.d3Force("center",null),t.d3Force("charge",null),a==="x"?(t.d3Force("x",to(f)),t.d3Force("y",no(0).strength(s))):(t.d3Force("y",no(f)),t.d3Force("x",to(0).strength(s)));const u=(i??4)+2;t.d3Force("collide",Xi(u)),t.reheat()},[t,r,i])}function Dt(e,t){return typeof e=="function"?e(t):typeof e=="string"?t[e]:e}function Ho(e,t){const n=Dt(e,t);return typeof n=="string"?n:typeof HTMLElement<"u"&&n instanceof HTMLElement?n.textContent??"":n!=null?String(n):typeof t.label=="string"&&t.label.length>0?t.label:t.id!==void 0?String(t.id):""}function Uo(e,t){const n=Dt(e,t);if(typeof n=="string")return n;if(typeof HTMLElement<"u"&&n instanceof HTMLElement)return n.textContent??"";if(n!=null)return String(n);if(typeof t.label=="string"&&t.label.length>0)return t.label;const r=t.source,i=t.target,o=typeof r=="object"&&r!==null?r.id:r,a=typeof i=="object"&&i!==null?i.id:i;return o===void 0&&a===void 0?"":`${o??""} → ${a??""}`}function Zt(e,t){if(e.startsWith("#")){const i=e.slice(1),o=i.length===3?i.split("").map(a=>a+a).join(""):i;if(o.length===6){const a=parseInt(o.slice(0,2),16),s=parseInt(o.slice(2,4),16),l=parseInt(o.slice(4,6),16);return`rgba(${a}, ${s}, ${l}, ${t})`}}const n=e.match(/^rgb\(([^)]+)\)$/);if(n)return`rgba(${n[1]}, ${t})`;const r=e.match(/^rgba\(([^,]+),([^,]+),([^,]+),[^)]+\)$/);return r?`rgba(${r[1]},${r[2]},${r[3]},${t})`:e}const Tt=new Set;function Rg(e){const{mode:t,accentColor:n,nodeColor:r,linkColor:i,linkWidth:o,nodeVal:a,nodeRelSize:s,nodePointerAreaPaint:l,nodeAutoColorBy:c,nodeVisibility:f,selectedNodeSet:u,selectedLinkSet:g,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:v,hoverNodeId:y,hoverLinkId:d,hiddenGroups:b}=e,m=A.useRef({mode:t,accentColor:n,selectedNodeSet:u,selectedLinkSet:g,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:v,hoverNodeId:y,hoverLinkId:d,hiddenGroups:b});m.current={mode:t,accentColor:n,selectedNodeSet:u,selectedLinkSet:g,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:v,hoverNodeId:y,hoverLinkId:d,hiddenGroups:b};const x=u.size>0||g.size>0||h&&p.size>0,w=A.useMemo(()=>{const z=r;return F=>{const R=m.current;if(F.id!==void 0&&R.selectedNodeSet.has(F.id))return R.accentColor;if(R.highlightNeighborsOnHover&&R.highlightedNodeIds.size>0&&F.id!==void 0&&R.highlightedNodeIds.has(F.id))return R.hoverNodeId===F.id?R.accentColor:Zt(R.accentColor,.7);let V;return typeof z=="function"?V=z(F):typeof z=="string"?V=z:V=F.color??"#888",(R.selectedNodeSet.size>0||R.selectedLinkSet.size>0)&&R.mode!=="3d"?Zt(V,.25):V}},[r,u,g,y,p]),_=x?w:r,k=c!==void 0&&b.size>0,C=u.size>0||g.size>0||d!==null||h&&v.size>0||k,P="rgba(96, 102, 110, 0.55)",M="rgba(180, 188, 198, 0.55)",N=A.useMemo(()=>{const z=i,F=c;return R=>{const q=m.current,V=R.id,re=typeof R.source=="object"?R.source:null,le=typeof R.target=="object"?R.target:null;if(q.hiddenGroups.size>0&&F!==void 0){const xt=Be=>{if(!Be)return null;const ve=typeof F=="function"?F(Be):Be[F];return ve==null?null:String(ve)},dn=xt(re),hn=xt(le);if(dn!==null&&q.hiddenGroups.has(dn)||hn!==null&&q.hiddenGroups.has(hn)){let Be;return typeof z=="function"?Be=z(R):typeof z=="string"?Be=z:Be=R.color??P,Zt(Be,.05)}}if(V!==void 0&&q.selectedLinkSet.has(V))return q.accentColor;const ce=re?.id??R.source,Se=le?.id??R.target,me=q.selectedNodeSet.size>0;if(me&&(ce!==void 0&&q.selectedNodeSet.has(ce)||Se!==void 0&&q.selectedNodeSet.has(Se)))return Zt(q.accentColor,.85);const ze=V!==void 0&&q.hoverLinkId===V,Ke=q.highlightNeighborsOnHover&&V!==void 0&&q.highlightedLinkIds.has(V);if(ze||Ke)return M;let Fe;return typeof z=="function"?Fe=z(R):typeof z=="string"?Fe=z:Fe=R.color??P,me||q.selectedLinkSet.size>0?Zt(Fe,q.mode==="3d"?.45:.18):Fe}},[i,c,g,u,d,v,b]),E=C?N:i,B=u.size>0||g.size>0||d!==null||h&&v.size>0,S=.6,O=1.5,L=.4,U=1,ne=.5,J=1.2,se=A.useMemo(()=>{const z=o;return F=>{const R=m.current,q=F.id,V=q!==void 0&&R.selectedLinkSet.has(q),re=typeof F.source=="object"?F.source.id:F.source,le=typeof F.target=="object"?F.target.id:F.target,Se=R.selectedNodeSet.size>0&&(re!==void 0&&R.selectedNodeSet.has(re)||le!==void 0&&R.selectedNodeSet.has(le)),me=q!==void 0&&R.hoverLinkId===q,Te=R.highlightNeighborsOnHover&&q!==void 0&&R.highlightedLinkIds.has(q),ze=me||Te,Ke=typeof z=="function"?z(F):typeof z=="number"?z:F.width??1,Fe=R.mode==="3d";return V?Ke+(Fe?ne:J):ze?Ke+(Fe?S:O):Se?Ke+(Fe?L:U):Ke}},[o]),D=B?se:o,$=u.size>0||h&&p.size>0,G=A.useMemo(()=>{const z=a;return F=>{const R=m.current,q=F.id,V=typeof z=="function"?z(F):typeof z=="number"?z:F.val??1;return q!==void 0&&R.selectedNodeSet.has(q)?V*2.25:R.highlightNeighborsOnHover&&R.highlightedNodeIds.size>0&&q!==void 0&&R.highlightedNodeIds.has(q)?R.hoverNodeId===q?V*1.8:V*1.4:V}},[a]),Z=$?G:a,I=A.useMemo(()=>{if(t!=="2d"||l)return l;const z=a,F=s??4;return(R,q,V,re)=>{const le=typeof z=="function"?z(R):typeof z=="number"?z:R.val??1,ce=Math.sqrt(Math.max(0,le))*F+1/Math.max(re,1e-6);V.fillStyle=q,V.beginPath(),V.arc(R.x??0,R.y??0,ce,0,2*Math.PI,!1),V.fill()}},[t,a,s,l]),H=A.useMemo(()=>{const z=c&&b.size>0;if(!z&&f===void 0)return;const F=c,R=f;return q=>{if(z&&F){const V=typeof F=="function"?F(q):q[F];if(V!=null&&b.has(String(V)))return!1}return typeof R=="function"?!!R(q):typeof R=="boolean"?R:typeof R=="string"?!!q[R]:!0}},[c,f,b]);return A.useMemo(()=>({nodeColor:_,linkColor:E,linkWidth:D,nodeVal:Z,nodePointerAreaPaint:I,nodeVisibility:H}),[_,E,D,Z,I,H])}const qo=250;function Vo(e){return e==null?null:typeof e=="string"||typeof HTMLElement<"u"&&e instanceof HTMLElement?e:String(e)}function Ig(e){const{highlightNeighborsOnHover:t,nodeLabel:n,linkLabel:r,onNodeHover:i,onLinkHover:o}=e,[a,s]=A.useState(null),[l,c]=A.useState(null),[f,u]=A.useState(Tt),[g,h]=A.useState(Tt),[p,v]=A.useState(null),y=A.useRef(null),d=A.useRef(null),b=A.useRef(null),m=A.useRef(null),x=A.useRef(null);A.useEffect(()=>()=>{m.current!==null&&(clearTimeout(m.current),m.current=null),x.current!==null&&(clearTimeout(x.current),x.current=null)},[]);const w=A.useCallback((M,N)=>{if(i?.(M,N),y.current=M?.id??null,!M&&b.current!==null)return;if(m.current!==null&&(clearTimeout(m.current),m.current=null),!M){m.current=setTimeout(()=>{m.current=null,s(null),t&&(u(Tt),h(Tt)),d.current===null&&v(null)},qo);return}if(t){const B=new Set([M.id]),S=new Set,O=M._neighbors??[];for(const U of O)U.id!==void 0&&B.add(U.id);const L=M._links??[];for(const U of L)U.id!==void 0&&S.add(U.id);s(M.id),u(B),h(S)}else s(M.id);const E=Dt(n,M);v(Vo(E))},[i,n,t]),_=A.useCallback((M,N)=>{if(o?.(M,N),d.current=M?.id??null,x.current!==null&&(clearTimeout(x.current),x.current=null),!M){x.current=setTimeout(()=>{x.current=null,c(null),y.current===null&&v(null)},qo);return}c(M.id??null);const E=Dt(r,M);v(Vo(E))},[o,r]),k=A.useMemo(()=>a===null?Tt:t?f:new Set([a]),[a,t,f]),C=A.useMemo(()=>{if(l!==null){if(t&&a!==null){const M=new Set(g);return M.add(l),M}return new Set([l])}return a!==null&&t?g:Tt},[l,a,t,g]),P=A.useCallback(M=>{if(b.current=M?.id??null,M){w(M,null);return}w(null,null)},[w]);return{hoverNodeId:a,hoverLinkId:l,liveHoverNodeIdRef:y,liveHoverLinkIdRef:d,highlightedNodeIds:f,highlightedLinkIds:g,hoveredNodeSet:k,hoveredLinkSet:C,tooltipContent:p,handleNodeHover:w,handleLinkHover:_,pinHover:P}}const lt={frameId:-1,fov:-1,tanHalfFov:0,canvasHeightPx:1},Go=new K.Vector2;function Dg(e,t){const n=e.info?.render?.frame??-1;return n===lt.frameId&&t===lt.fov||(e.getSize(Go),lt.frameId=n,lt.fov=t,lt.tanHalfFov=Math.tan(t*Math.PI/180/2),lt.canvasHeightPx=Go.y||1),lt}function Fn(e){const t=e.material,n=e.userData;n.normalTexture&&n.normalTexture.dispose(),n.selectedTexture&&n.selectedTexture.dispose(),t.dispose(),e.parent&&e.parent.remove(e)}function Bn(e){const{text:t,fontSize:n=32,fontFamily:r="system-ui, sans-serif",color:i="#ffffff",backgroundColor:o="rgba(28, 31, 35, 0.85)",padding:a=8,worldHeight:s=4}=e,c=document.createElement("canvas").getContext("2d");if(!c)return new K.Sprite(new K.SpriteMaterial);c.font=`${n}px ${r}`;const f=Math.ceil(c.measureText(t).width),u=Math.ceil(n*1.2),g=f+a*2,h=u+a*2,p=(_,k,C)=>{_.width=g,_.height=h;const P=_.getContext("2d");if(P.font=`${n}px ${r}`,C){P.fillStyle=C;const M=Math.min(_.height/2,8),N=P;P.beginPath(),typeof N.roundRect=="function"?N.roundRect(0,0,_.width,_.height,M):P.rect(0,0,_.width,_.height),P.fill()}P.fillStyle=k,P.textAlign="center",P.textBaseline="middle",P.fillText(t,_.width/2,_.height/2)},v=document.createElement("canvas");p(v,i,o);const y=new K.CanvasTexture(v);y.minFilter=K.LinearFilter,y.magFilter=K.LinearFilter,y.needsUpdate=!0;let d;if(e.selectedColor!==void 0&&e.selectedBackgroundColor!==void 0){const _=document.createElement("canvas");p(_,e.selectedColor,e.selectedBackgroundColor),d=new K.CanvasTexture(_),d.minFilter=K.LinearFilter,d.magFilter=K.LinearFilter,d.needsUpdate=!0}const b=new K.SpriteMaterial({map:y,transparent:!0,depthWrite:!1}),m=new K.Sprite(b),x=m.userData;x.normalTexture=y,d&&(x.selectedTexture=d);const w=g/h;if(m.scale.set(s*w,s,1),e.pixelHeight!==void 0&&e.pixelHeight>0){const _=e.pixelHeight,k=new K.Vector3;let C=-1;m.onBeforeRender=(P,M,N)=>{const E=N;if(!E.isPerspectiveCamera||typeof E.fov!="number")return;m.getWorldPosition(k);const B=E.position.distanceTo(k);if(B<=0)return;const S=Dg(P,E.fov),O=2*S.tanHalfFov*B*_/S.canvasHeightPx;C>0&&Math.abs(O-C)<C*.005||(C=O,m.scale.set(O*w,O,1))}}return m}function zg(e){const{mode:t,showLabels:n,selectedNodeSet:r,hoveredNodeSet:i,accentColor:o,hostNodeCanvasObject:a,hostNodeThreeObject:s,nodeLabel:l,nodeVal:c,nodeRelSize:f,theme:u}=e,g=u?.tooltipBackground??"rgba(28, 31, 35, 0.9)",h=u?.tooltipForeground??"#ffffff",p=A.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:i,accentColor:o,tooltipBg:g,tooltipFg:h});p.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:i,accentColor:o,tooltipBg:g,tooltipFg:h};const v=A.useMemo(()=>{if(t!=="2d"||a)return;const _=u?.fontFamily??"system-ui, sans-serif";return(k,C,P)=>{const M=p.current,N=k.id!==void 0&&M.selectedNodeSet.has(k.id),E=k.id!==void 0&&M.hoveredNodeSet?.has(k.id)===!0;if(!M.showLabels&&!N&&!E)return;const B=Ho(l,k);if(!B)return;const S=Dt(c,k)??1,O=f??4,L=Math.max(.5,Math.sqrt(Math.max(S,0))*O),U=14/P,ne=6/P,J=4/P;C.font=`${U}px ${_}`;const D=C.measureText(B).width+ne*2,$=U+J*2,G=k.x??0,Z=(k.y??0)-L*2-4/P-$;C.fillStyle=N?M.accentColor:M.tooltipBg;const I=Math.min($/2,6/P),H=C;C.beginPath(),typeof H.roundRect=="function"?H.roundRect(G-D/2,Z,D,$,I):C.rect(G-D/2,Z,D,$),C.fill(),C.textAlign="center",C.textBaseline="top",C.fillStyle=N?"#ffffff":M.tooltipFg,C.fillText(B,G,Z+J)}},[t,a,l,c,f,u?.fontFamily]),y=i?.size??0,b=n||r.size>0||y>0?v:void 0,m=A.useRef(new Map),x=A.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:i});x.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:i},A.useEffect(()=>{const _=m.current;return()=>{for(const k of _.values())k.sprite&&Fn(k.sprite);_.clear()}},[]);const w=A.useMemo(()=>{if(s)return;const _=m.current,k=u?.fontFamily??"system-ui, sans-serif";return C=>{const P=C.id,M=Ho(l,C),N=Dt(c,C)??1,E=f??4,S=Math.cbrt(Math.max(N,0))*E*2+4,O=new K.Group;if(P!==void 0&&M){const L={group:O,sprite:null,text:M,yOffset:S};_.set(P,L);const U=x.current,ne=U.selectedNodeSet.has(P),J=U.hoveredNodeSet?.has(P)===!0;if(U.showLabels||ne||J){const se=Bn({text:M,fontFamily:k,fontSize:48,color:h,backgroundColor:g,selectedColor:"#ffffff",selectedBackgroundColor:o,pixelHeight:28});if(se.material.depthTest=!1,se.renderOrder=1e3,se.position.set(0,S,0),ne){const D=se.userData;if(D.selectedTexture){const $=se.material;$.map=D.selectedTexture,$.needsUpdate=!0}}O.add(se),L.sprite=se}}return O}},[s,l,c,f,u?.fontFamily,g,h,o]);return A.useEffect(()=>{const _=m.current,k=u?.fontFamily??"system-ui, sans-serif";for(const[C,P]of _){if(P.group.parent===null){P.sprite&&Fn(P.sprite),_.delete(C);continue}const M=r.has(C),N=i?.has(C)===!0,E=n||M||N;if(E&&P.sprite===null){const S=Bn({text:P.text,fontFamily:k,fontSize:48,color:h,backgroundColor:g,selectedColor:"#ffffff",selectedBackgroundColor:o,pixelHeight:28});S.material.depthTest=!1,S.renderOrder=1e3,S.position.set(0,P.yOffset,0),P.group.add(S),P.sprite=S}const B=P.sprite;if(B){B.visible=E;const S=B.userData,O=M&&S.selectedTexture?S.selectedTexture:S.normalTexture,L=B.material;O&&L.map!==O&&(L.map=O,L.needsUpdate=!0)}}},[n,r,i,o,g,h,u?.fontFamily]),{canvasObject:b,threeObject:w,renderFramePost:void 0}}function Fg(e){const{mode:t,showLabels:n,selectedLinkSet:r,hoveredLinkSet:i,accentColor:o,hostLinkCanvasObject:a,hostLinkThreeObject:s,hostLinkPositionUpdate:l,linkLabel:c,theme:f}=e,u=f?.tooltipBackground??"rgba(255, 255, 255, 0.94)",g=f?.tooltipForeground??"#1c1f23",h=A.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:i,accentColor:o,tooltipBg:u,tooltipFg:g});h.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:i,accentColor:o,tooltipBg:u,tooltipFg:g};const p=A.useMemo(()=>{if(t!=="2d"||a)return;const _=f?.fontFamily??"system-ui, sans-serif",k=4,C=6;return(P,M)=>{const N=h.current,E=P.id!==void 0&&N.selectedLinkSet.has(P.id),B=P.id!==void 0&&N.hoveredLinkSet?.has(P.id)===!0;if(!N.showLabels&&!E&&!B)return;const S=P.source,O=P.target;if(typeof S!="object"||typeof O!="object")return;const L=Uo(c,P);if(!L||L===" → ")return;const U=S.x,ne=S.y,J=O.x,se=O.y;if(U===void 0||ne===void 0||J===void 0||se===void 0)return;const D=J-U,$=se-ne,Z=Math.sqrt(D*D+$*$)-C*2;if(Z<=0)return;M.font=`1px ${_}`;const I=M.measureText(L).width||1,H=Math.min(k,Z/I);M.font=`${H}px ${_}`;let z=Math.atan2($,D);z>Math.PI/2&&(z=-(Math.PI-z)),z<-Math.PI/2&&(z=-(-Math.PI-z));const F=(U+J)/2,R=(ne+se)/2,q=M.measureText(L).width,V=H*.6,re=H*.35,le=q+V,ce=H+re,Se=Math.min(ce/2,H*.35);M.save(),M.translate(F,R),M.rotate(z),M.fillStyle=E?N.accentColor:N.tooltipBg;const me=M;M.beginPath(),typeof me.roundRect=="function"?me.roundRect(-le/2,-ce/2,le,ce,Se):M.rect(-le/2,-ce/2,le,ce),M.fill(),M.textAlign="center",M.textBaseline="middle",M.fillStyle=E?"#ffffff":N.tooltipFg,M.fillText(L,0,0),M.restore()}},[t,a,c,f?.fontFamily]),v=i?.size??0,d=n||r.size>0||v>0?p:void 0,b=A.useRef(new Map),m=A.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:i});m.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:i},A.useEffect(()=>{const _=b.current;return()=>{for(const k of _.values())k.sprite&&Fn(k.sprite);_.clear()}},[]);const x=A.useMemo(()=>{if(s)return;const _=b.current,k=f?.fontFamily??"system-ui, sans-serif";return C=>{const P=Uo(c,C),M=new K.Group,N=C.id;if(N!==void 0&&P&&P!==" → "){const E={group:M,sprite:null,text:P};_.set(N,E);const B=m.current,S=B.selectedLinkSet.has(N),O=B.hoveredLinkSet?.has(N)===!0;if(B.showLabels||S||O){const L=Bn({text:P,fontFamily:k,fontSize:48,color:g,backgroundColor:u,selectedColor:"#ffffff",selectedBackgroundColor:o,pixelHeight:22});if(L.material.depthTest=!1,L.renderOrder=500,S){const U=L.userData;if(U.selectedTexture){const ne=L.material;ne.map=U.selectedTexture,ne.needsUpdate=!0}}M.add(L),E.sprite=L}}return M}},[s,c,f?.fontFamily,u,g,o]);A.useEffect(()=>{const _=b.current,k=f?.fontFamily??"system-ui, sans-serif";for(const[C,P]of _){if(P.group.parent===null){P.sprite&&Fn(P.sprite),_.delete(C);continue}const M=r.has(C),N=i?.has(C)===!0,E=n||M||N;if(E&&P.sprite===null){const S=Bn({text:P.text,fontFamily:k,fontSize:48,color:g,backgroundColor:u,selectedColor:"#ffffff",selectedBackgroundColor:o,pixelHeight:22});S.material.depthTest=!1,S.renderOrder=500,P.group.add(S),P.sprite=S}const B=P.sprite;if(B){B.visible=E;const S=B.userData,O=M&&S.selectedTexture?S.selectedTexture:S.normalTexture,L=B.material;O&&L.map!==O&&(L.map=O,L.needsUpdate=!0)}}},[n,r,i,o,u,g,f?.fontFamily]);const w=A.useMemo(()=>{if(l!=null)return;const _=t==="2d";return(k,C)=>{if(k instanceof K.Group){const P=(C.start.x+C.end.x)/2,M=(C.start.y+C.end.y)/2,N=(C.start.z+C.end.z)/2;k.position.set(P,M,N);const E=k.parent;if(E&&!E.userData.lgcOrderApplied){E.userData.lgcOrderApplied=!0,E.renderOrder=-1;for(const S of E.children)S!==k&&(S.renderOrder=-1)}const B=k.children[0];if(B instanceof K.Sprite){const S=B.material;if(_){const O=C.end.x-C.start.x,L=C.end.y-C.start.y;let U=Math.atan2(L,O);U>Math.PI/2?U-=Math.PI:U<-Math.PI/2&&(U+=Math.PI),Math.abs(S.rotation-U)>.001&&(S.rotation=U)}else S.rotation!==0&&(S.rotation=0)}}return!0}},[t,l]);return{canvasObject:d,threeObject:x,positionUpdate:w}}function Bg({nodeCount:e,linkCount:t}){const n=e+t*.5;return n>=5e4?"huge":n>=1e4?"xlarge":n>=2e3?"large":"default"}function $g(e,t){if(e==="default")return{};const n={cooldownTicks:e==="large"?100:e==="xlarge"?60:30,d3AlphaDecay:e==="large"?.04:e==="xlarge"?.08:.15,d3VelocityDecay:e==="huge"?.6:.4,linkHoverPrecision:e==="large"?4:2,warmupTicks:0,linkDirectionalParticles:0,linkDirectionalArrowLength:0};return n.forceEngine="ngraph",n.nodeResolution=e==="large"?8:e==="xlarge"?4:3,n.linkResolution=e==="large"?4:0,n.nodeOpacity=1,n.linkOpacity=1,n.pointerRaycasterThrottleMs=e==="large"?32:e==="xlarge"?100:200,n}function Hg(e){const{profile:t="auto",nodeCount:n,linkCount:r,mode:i}=e;return A.useMemo(()=>{if(t==="off")return{};const o=t==="auto"?Bg({nodeCount:n,linkCount:r}):t;return $g(o)},[t,n,r,i])}function Ug(e){const{ref:t,dataApi:n,selection:r,engine:i,mode:o,setMode:a,setPaused:s,clipboard:l,exportJSON:c,importJSON:f,downloadJSON:u}=e;A.useImperativeHandle(t,()=>({getData:()=>n.data,setData:n.setData,addNode:n.addNode,addNodes:n.addNodes,updateNode:n.updateNode,removeNode:n.removeNode,removeNodes:n.removeNodes,addLink:n.addLink,addLinks:n.addLinks,removeLink:n.removeLink,clear:n.clear,getSelection:()=>r.selected,setSelection:r.set,selectAll:()=>r.set(n.data.nodes.map(g=>g.id)),clearSelection:r.clear,getMode:()=>o,setMode:a,fit:(g,h)=>i?.fit(g,h),centerAt:(g,h,p,v)=>i?.centerAt(g,h,p,v),zoom:(g,h)=>i?.zoom(g,h),zoomIn:(g=1.2)=>{i&&i.zoom((i.getZoom?.()??1)*g,200)},zoomOut:(g=1.2)=>{i&&i.zoom((i.getZoom?.()??1)/g,200)},pause:()=>{i?.pause(),s(!0)},resume:()=>{i?.resume(),s(!1)},reheat:()=>i?.reheat(),screenshot:async()=>{const g=i?.getCanvasElement();return g?new Promise(h=>g.toBlob(p=>h(p))):null},copy:l.copy,cut:l.cut,paste:g=>l.paste(g?.at),duplicate:l.duplicate,addConnectedNode:l.addConnectedNode,togglePin:l.togglePin,exportJSON:c,importJSON:f,downloadJSON:u,d3Force:(g,h)=>i?.d3Force(g,h),emitParticle:g=>i?.emitParticle(g),stopAnimation:()=>i?.stopAnimation(),engine2D:()=>i?.mode==="2d"?i:null,engine3D:()=>i?.mode==="3d"?i:null}),[t,n,i,o,a,s,r,l,c,f,u])}const we={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},qg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M3 2.5l4 10 1.4-3.6 3.6-1.4z"})}),Vg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M8 3v10M3 8h10M5 5l6 6M11 5L5 11"})}),Gg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"6",cy:"8",r:"3"}),T.jsx("path",{d:"M12 5v6M9 8h6"})]}),Wg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"4",cy:"4",r:"2"}),T.jsx("circle",{cx:"12",cy:"12",r:"2"}),T.jsx("path",{d:"M5.5 5.5l5 5"})]}),_s=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M3 5h10M6 5V3h4v2M5 5l1 8h4l1-8"})}),Xg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M3 6V3h3M13 6V3h-3M3 10v3h3M13 10v3h-3"})}),Yg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"7",cy:"7",r:"4"}),T.jsx("path",{d:"M5 7h4M7 5v4M10 10l3 3"})]}),Kg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"7",cy:"7",r:"4"}),T.jsx("path",{d:"M5 7h4M10 10l3 3"})]}),Qg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M6 3v10M10 3v10"})}),Zg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M5 3l8 5-8 5z"})}),Jg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("path",{d:"M3 5h2l1-2h4l1 2h2v8H3z"}),T.jsx("circle",{cx:"8",cy:"9",r:"2.5"})]}),xs=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("path",{d:"M8 2l5 3v6l-5 3-5-3V5z"}),T.jsx("path",{d:"M8 8v7M8 8L3 5M8 8l5-3"})]}),ev=e=>T.jsx("svg",{...we,...e,children:T.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),ws=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),T.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"})]}),tv=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",strokeDasharray:"2 2"}),T.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor"}),T.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"currentColor"}),T.jsx("circle",{cx:"6",cy:"10",r:"1",fill:"currentColor"}),T.jsx("circle",{cx:"10",cy:"10",r:"1",fill:"currentColor"})]}),nv=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("path",{d:"M8 2v8M5 5l3-3 3 3"}),T.jsx("path",{d:"M3 12h10v2H3z"})]}),rv=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("path",{d:"M8 10V2M5 7l3 3 3-3"}),T.jsx("path",{d:"M3 12h10v2H3z"})]}),iv=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"4",cy:"8",r:"2"}),T.jsx("path",{d:"M6 8h2.5"}),T.jsx("circle",{cx:"11",cy:"8",r:"2"}),T.jsx("path",{d:"M11 6.5v3M9.5 8h3"})]}),ks={select:{id:"select",label:"Select",hint:"Select / multi-select nodes",icon:qg,toggleable:!0,shortcut:"V"},pan:{id:"pan",label:"Pan",hint:"Pan the canvas",icon:Vg,toggleable:!0,shortcut:"H"},"add-node":{id:"add-node",label:"Add node",hint:"Click on the canvas to add a node",icon:Gg,toggleable:!0,shortcut:"N"},"add-link":{id:"add-link",label:"Add link",hint:"Click two nodes to connect them",icon:Wg,toggleable:!0,shortcut:"L"},delete:{id:"delete",label:"Delete",hint:"Delete selected node(s)",icon:_s,shortcut:"⌫"},fit:{id:"fit",label:"Fit",hint:"Fit graph to viewport",icon:Xg,shortcut:"F"},"zoom-in":{id:"zoom-in",label:"Zoom in",hint:"Zoom in",icon:Yg,shortcut:"+"},"zoom-out":{id:"zoom-out",label:"Zoom out",hint:"Zoom out",icon:Kg,shortcut:"-"},pause:{id:"pause",label:"Pause",hint:"Pause simulation",icon:Qg},resume:{id:"resume",label:"Resume",hint:"Resume simulation",icon:Zg},screenshot:{id:"screenshot",label:"Screenshot",hint:"Download a PNG of the canvas",icon:Jg},"toggle-mode":{id:"toggle-mode",label:"2D / 3D",hint:"Toggle between 2D and 3D",icon:xs,shortcut:"3"},duplicate:{id:"duplicate",label:"Duplicate",hint:"Duplicate the current selection",icon:ws,shortcut:"⌘D"},"select-all":{id:"select-all",label:"Select all",hint:"Select every node",icon:tv,shortcut:"⌘A"},"export-json":{id:"export-json",label:"Export",hint:"Download the graph as JSON",icon:nv},"import-json":{id:"import-json",label:"Import",hint:"Load a JSON graph from disk",icon:rv}},Ur=["select","pan","add-node","add-link","select-all","fit","zoom-in","zoom-out","pause","resume","screenshot","export-json","import-json"];function Cs(e){return e==="2d"?xs:ev}function ov(e,t){if(e===!1)return[];let n;if(e===!0)n=Ur;else if(Array.isArray(e))n=e;else{const r=e.include??Ur,i=new Set(e.exclude??[]);n=r.filter(o=>!i.has(o))}return n.filter(r=>r==="pause"?!t:r==="resume"?t:!0)}function av(e){return e&&typeof e=="object"&&!Array.isArray(e)?e.position??"top-right":"top-right"}function sv(e){const{config:t,activeTool:n,paused:r,mode:i,isDisabled:o,onSelect:a}=e,s=ov(t,r);if(s.length===0)return null;const l=av(t);return T.jsx("div",{className:`lgc-toolbar lgc-toolbar--${l}`,role:"toolbar",children:s.map(c=>{const f=ks[c],u=c==="toggle-mode"?Cs(i):f.icon,g=f.toggleable&&n===c,h=o?.(c)??!1,p=[f.hint,f.shortcut?`(${f.shortcut})`:""];return T.jsx("button",{type:"button",className:["lgc-tool",g?"lgc-tool--active":"",h?"lgc-tool--disabled":""].join(" ").trim(),"aria-label":f.label,"aria-pressed":g?"true":void 0,disabled:h,title:p.filter(Boolean).join(" "),onClick:()=>a(c),children:T.jsx(u,{})},c)})})}function lv({x:e,y:t,items:n,onClose:r}){const i=A.useRef(null);return A.useEffect(()=>{const o=a=>{a instanceof KeyboardEvent&&a.key!=="Escape"||a instanceof MouseEvent&&i.current&&i.current.contains(a.target)||r()};return window.addEventListener("mousedown",o),window.addEventListener("keydown",o),()=>{window.removeEventListener("mousedown",o),window.removeEventListener("keydown",o)}},[r]),T.jsx("div",{ref:i,className:"lgc-menu",role:"menu",style:{left:e,top:t},children:n.map((o,a)=>"separator"in o?T.jsx("div",{className:"lgc-menu-separator"},`sep-${a}`):T.jsxs("div",{role:"menuitem",className:"lgc-menu-item","aria-disabled":o.disabled?"true":void 0,onClick:()=>{o.disabled||(o.onSelect(),r())},children:[T.jsx("span",{children:o.label}),o.shortcut?T.jsx("span",{style:{marginLeft:"auto",opacity:.6},children:o.shortcut}):null]},o.id))})}function cv({content:e,hostRef:t}){const[n,r]=A.useState(null),i=A.useRef(null);if(A.useEffect(()=>{if(e===null){r(null),i.current=null;return}const s=t.current;if(!s)return;i.current=s.getBoundingClientRect();const l=f=>{const u=i.current??s.getBoundingClientRect();r({x:f.clientX-u.left,y:f.clientY-u.top})},c=()=>{i.current=s.getBoundingClientRect()};return s.addEventListener("mousemove",l),window.addEventListener("resize",c),()=>{s.removeEventListener("mousemove",l),window.removeEventListener("resize",c)}},[t,e]),e===null||n===null)return null;const o=n.x+14,a=n.y+14;return T.jsx("div",{className:"lgc-tooltip",role:"tooltip",style:{left:o,top:a,pointerEvents:"none"},children:typeof e=="string"?e:T.jsx("span",{ref:s=>s?.appendChild(e)})})}function uv({rect:e}){if(!e)return null;const t=Math.min(e.x0,e.x1),n=Math.min(e.y0,e.y1),r=Math.abs(e.x1-e.x0),i=Math.abs(e.y1-e.y0);return T.jsx("div",{className:"lgc-marquee",style:{left:t,top:n,width:r,height:i,pointerEvents:"none"}})}function fv(e){return T.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[T.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),T.jsx("path",{d:"M6 5h7v7"})]})}function dv(e){return T.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[T.jsx("circle",{cx:"5",cy:"11",r:"2"}),T.jsx("circle",{cx:"11",cy:"11",r:"2"}),T.jsx("path",{d:"M6.5 9.5L13 3M5 8L9.5 9.5"})]})}function Wo(e){return T.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[T.jsx("rect",{x:"3",y:"4",width:"10",height:"10",rx:"1"}),T.jsx("rect",{x:"5",y:"2",width:"6",height:"3",rx:"1"})]})}function ct({label:e,shortcut:t,disabled:n,onClick:r,children:i}){return T.jsx("button",{type:"button",className:"lgc-selpanel-btn","aria-label":e,title:t?`${e} (${t})`:e,disabled:n,onClick:r,children:i})}function hv({nodeCount:e,linkCount:t,hasClipboard:n,enableClipboard:r,onDelete:i,onDuplicate:o,onAddConnected:a,onCopy:s,onCut:l,onPaste:c,onClear:f}){if(e===0&&t===0)return!r||!n?null:T.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[T.jsx("span",{className:"lgc-selpanel-label",children:"Clipboard ready"}),T.jsx(ct,{label:"Paste",shortcut:"⌘V",onClick:c,children:T.jsx(Wo,{})})]});const u=[];e>0&&u.push(`${e} ${e===1?"node":"nodes"}`),t>0&&u.push(`${t} ${t===1?"link":"links"}`);const g=u.join(", ");return T.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[T.jsx("span",{className:"lgc-selpanel-label",children:g}),T.jsx("div",{className:"lgc-selpanel-divider"}),T.jsx(ct,{label:"Delete",shortcut:"⌫",onClick:i,children:T.jsx(_s,{width:14,height:14})}),T.jsx(ct,{label:"Duplicate",shortcut:"⌘D",onClick:o,children:T.jsx(ws,{width:14,height:14})}),T.jsx(ct,{label:"Connect to new node",shortcut:"↵",disabled:e===0,onClick:a,children:T.jsx(iv,{})}),r?T.jsxs(T.Fragment,{children:[T.jsx(ct,{label:"Copy",shortcut:"⌘C",disabled:e===0,onClick:s,children:T.jsx(fv,{})}),T.jsx(ct,{label:"Cut",shortcut:"⌘X",disabled:e===0,onClick:l,children:T.jsx(dv,{})}),T.jsx(ct,{label:"Paste",shortcut:"⌘V",disabled:!n,onClick:c,children:T.jsx(Wo,{})})]}):null,T.jsx("div",{className:"lgc-selpanel-divider"}),T.jsx(ct,{label:"Clear selection",shortcut:"Esc",onClick:f,children:"✕"})]})}const Xo=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];function pv(e,t){let n=0;for(let r=0;r<e.length;r++)n=n*31+e.charCodeAt(r)|0;return Math.abs(n)%t}function gv(e){return Xo[pv(e,Xo.length)]}function vv({nodes:e,groupBy:t,hidden:n,onToggle:r}){const i=A.useMemo(()=>{if(!t)return[];const o=new Set;for(const a of e){const s=typeof t=="function"?t(a):a[t];s!=null&&o.add(String(s))}return Array.from(o).sort()},[e,t]);return i.length===0?null:T.jsx("div",{className:"lgc-legend",role:"region","aria-label":"Groups",children:i.map(o=>{const a=n.has(o);return T.jsxs("button",{type:"button",className:["lgc-legend-item",a?"lgc-legend-item--hidden":""].join(" ").trim(),onClick:()=>r(o),"aria-pressed":a?"false":"true",title:`Toggle ${o}`,children:[T.jsx("span",{className:"lgc-legend-swatch",style:{background:gv(o)}}),T.jsx("span",{children:o})]},o)})})}function yv({mode:e,onToggle:t}){const n=Cs(e),r=e==="2d"?"3D":"2D";return T.jsxs("button",{type:"button",className:"lgc-mode-toggle",onClick:t,"aria-label":`Switch to ${r}`,title:`Switch to ${r} (3)`,children:[T.jsx(n,{width:14,height:14}),T.jsx("span",{className:"lgc-mode-toggle-label",children:e.toUpperCase()})]})}function mv(e){return T.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[T.jsx("circle",{cx:"8",cy:"8",r:"2.4"}),T.jsx("path",{d:"M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.4 1.4M11.55 11.55l1.4 1.4M3.05 12.95l1.4-1.4M11.55 4.45l1.4-1.4"})]})}function bv({items:e}){const[t,n]=A.useState(!1),r=A.useRef(null);return A.useEffect(()=>{if(!t)return;const i=a=>{r.current&&!r.current.contains(a.target)&&n(!1)},o=a=>{a.key==="Escape"&&n(!1)};return window.addEventListener("mousedown",i),window.addEventListener("keydown",o),()=>{window.removeEventListener("mousedown",i),window.removeEventListener("keydown",o)}},[t]),e.length===0?null:T.jsxs("div",{ref:r,className:"lgc-options-menu",children:[T.jsx("button",{type:"button",className:"lgc-options-trigger","aria-label":"Options","aria-expanded":t,title:"Options",onClick:()=>n(i=>!i),children:T.jsx(mv,{})}),t?T.jsx("div",{className:"lgc-options-panel",role:"menu",children:e.map(i=>i.kind==="select"?T.jsxs("div",{className:"lgc-options-item",children:[T.jsxs("span",{className:"lgc-options-item-text",children:[T.jsx("span",{className:"lgc-options-item-label",children:i.label}),i.hint?T.jsx("span",{className:"lgc-options-item-hint",children:i.hint}):null]}),T.jsx("select",{className:"lgc-options-select",value:i.value,onChange:o=>i.onChange(o.target.value),children:i.options.map(o=>T.jsx("option",{value:o.value,children:o.label??o.value},o.value))})]},i.id):T.jsxs("label",{className:"lgc-options-item",children:[T.jsx("input",{type:"checkbox",checked:i.checked,onChange:o=>i.onChange(o.target.checked)}),T.jsxs("span",{className:"lgc-options-item-text",children:[T.jsx("span",{className:"lgc-options-item-label",children:i.label}),i.hint?T.jsx("span",{className:"lgc-options-item-hint",children:i.hint}):null]})]},i.id))}):null]})}function _v(e,t,n={}){const r=n.spacing??50,i=n.color??"rgba(0,0,0,0.06)",o=e.canvas,s=e.getTransform().inverse(),l=s.transformPoint({x:0,y:0}),c=s.transformPoint({x:o.width,y:o.height}),f=Math.floor(l.x/r)*r,u=Math.ceil(c.x/r)*r,g=Math.floor(l.y/r)*r,h=Math.ceil(c.y/r)*r;e.save(),e.strokeStyle=i,e.lineWidth=1/t,e.beginPath();for(let p=f;p<=u;p+=r)e.moveTo(p,g),e.lineTo(p,h);for(let p=g;p<=h;p+=r)e.moveTo(f,p),e.lineTo(u,p);e.stroke(),e.restore()}const Yo=15,xv={background:"--lgc-bg",foreground:"--lgc-fg",border:"--lgc-border",accent:"--lgc-accent",toolbarBackground:"--lgc-toolbar-bg",toolbarForeground:"--lgc-toolbar-fg",toolbarBorder:"--lgc-toolbar-border",toolActiveBackground:"--lgc-tool-active-bg",toolHoverBackground:"--lgc-tool-hover-bg",tooltipBackground:"--lgc-tooltip-bg",tooltipForeground:"--lgc-tooltip-fg",menuBackground:"--lgc-menu-bg",menuForeground:"--lgc-menu-fg",menuHoverBackground:"--lgc-menu-hover-bg",fontFamily:"--lgc-font",fontSize:"--lgc-font-size"};function wv(e){if(!e)return{};const t={};for(const[n,r]of Object.entries(e)){if(r===void 0)continue;const i=xv[n];i&&(t[i]=String(r))}return t}function Ss(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function kv(e){e&&e.toBlob(t=>{t&&Ss(t,`lora-graph-${Date.now()}.png`)})}function Cv(e,t){const{data:n,defaultData:r,onDataChange:i,mode:o,defaultMode:a,onModeChange:s,width:l,height:c,className:f,style:u,theme:g,tools:h=!0,selection:p="multi",showContextMenu:v=!0,showLegend:y=!1,showGrid:d=!1,showLabels:b=!1,enableClipboard:m=!0,enableTooltip:x=!1,introZoom:w=!0,focusOnClick:_=!1,highlightNeighborsOnHover:k=!0,autoIndexNeighbors:C=k,collideNodes:P=!1,fixOnDrop:M=!0,beeswarm:N=!1,onSelectionChange:E,onNodeClick:B,onNodeRightClick:S,onLinkClick:O,onLinkRightClick:L,onBackgroundClick:U,onBackgroundRightClick:ne,onNodeDrag:J,onNodeDragEnd:se,onNodeHover:D,onLinkHover:$,onNodeDoubleClick:G,onCopy:Z,onCut:I,onPaste:H,onRenderFramePre:z,nodeColor:F,nodeLabel:R,nodeVal:q,nodeAutoColorBy:V,nodeRelSize:re,nodeVisibility:le,nodeCanvasObject:ce,linkColor:Se,linkLabel:me,linkWidth:Te,linkHoverPrecision:ze,backgroundColor:Ke,enableNavigationControls:Fe,performanceProfile:di,dagMode:xt}=e,[dn,hn]=A.useState(o??a??"2d"),Be=o!==void 0,ve=Be?o:dn,hi=A.useRef(null),pt=A.useCallback(j=>{j!==ve&&(hi.current?.(),Be||hn(j),s?.(j))},[ve,Be,s]),ee=ll({...n!==void 0?{controlled:n}:{},...r!==void 0?{defaultData:r}:{},...i?{onChange:i}:{}});Og(C,ee.data);const fe=Mg({mode:p,...E?{onChange:E}:{}}),[Ge,Xn]=A.useState("select"),[pi,Yn]=A.useState(!1),Ps=Ig({highlightNeighborsOnHover:k,...R!==void 0?{nodeLabel:R}:{},...me!==void 0?{linkLabel:me}:{},...D?{onNodeHover:D}:{},...$?{onLinkHover:$}:{}}),{hoverNodeId:Os,hoverLinkId:As,liveHoverNodeIdRef:js,highlightedNodeIds:Ts,highlightedLinkIds:Es,hoveredNodeSet:Ls,hoveredLinkSet:Ns,tooltipContent:Rs,handleNodeHover:gi,handleLinkHover:vi,pinHover:pn}=Ps,[yi,Is]=A.useState(()=>new Set),[wt,mi]=A.useState(!!_),[gn,bi]=A.useState(!!b),[vn,_i]=A.useState(xt??null);A.useEffect(()=>{mi(!!_)},[_]),A.useEffect(()=>{bi(!!b)},[b]),A.useEffect(()=>{_i(xt??null)},[xt]);const et=A.useRef(null),[Bt,yn]=A.useState(null),[$t,mn]=A.useState(null),[bn,gt]=A.useState(null),[tt,$e]=A.useState([]),[_n,kt]=A.useState(null),Ds=Pg(),Ct=A.useRef(null),Kn=A.useRef(null),[Qn,zs]=A.useState(null),Fs=A.useCallback(j=>{Kn.current=j,zs(j)},[]),xi=Sg(Ct),Zn=l??xi?.width??600,Jn=c??xi?.height??400,Ee=A.useRef(null),{marquee:wi,lastCursorRef:Bs}=Ag({mount:Qn,engineRef:Ee,selection:fe,nodes:ee.data.nodes,links:ee.data.links,setSelectedLinkIds:$e,liveHoverNodeIdRef:js});Tg(Qn);const Me=Eg({enableClipboard:m,dataApi:ee,selection:fe,setSelectedLinkIds:$e,engineRef:Ee,lastCursorRef:Bs,...Z?{onCopy:Z}:{},...I?{onCut:I}:{},...H?{onPaste:H}:{}}),ki=A.useRef(null),Ci=A.useCallback((j,W)=>{B?.(j,W);const Y=performance.now(),be=ki.current,de=be&&be.id===j.id&&Y-be.at<280;if(ki.current={id:j.id,at:Y},de){G?.(j,W);return}if(Ge==="add-link"&&j.id!==void 0){bn===null?gt(j.id):(bn!==j.id&&ee.addLink({source:bn,target:j.id}),gt(null));return}if(p!=="none"&&j.id!==void 0){const oe=W.shiftKey||W.ctrlKey||W.metaKey;fe.toggle(j.id,{additive:oe}),oe||$e([])}if(wt&&j.id!==void 0&&Ee.current){const oe=Ee.current;Bt===j.id?(et.current&&oe.setCameraState(et.current,800),yn(null),et.current=null):(Bt===null&&$t===null&&(et.current=oe.getCameraState()),oe.focusOn({x:j.x??0,y:j.y??0,z:j.z??0},{distance:120,zoom:8,durationMs:1e3}),yn(j.id),mn(null))}},[B,G,fe,p,Ge,bn,ee,wt,Bt,$t]),Si=A.useCallback(j=>{if(U?.(j),Ee.current?.stopAnimation(),Ge==="add-node"){const Y=Kn.current?.getBoundingClientRect(),be=Y?j.clientX-Y.left:j.clientX,de=Y?j.clientY-Y.top:j.clientY,oe=Ee.current?.screen2Graph(be,de)??{x:be,y:de};ee.addNode(void 0,{at:{x:oe.x,y:oe.y,...oe.z!==void 0?{z:oe.z}:{}}});return}Ge==="add-link"&&gt(null),j.shiftKey||j.ctrlKey||j.metaKey||(fe.clear(),$e([])),kt(null)},[U,Ge,ee,fe]),Mi=A.useCallback((j,W)=>{if(S?.(j,W),!v)return;const Y=Ct.current?.getBoundingClientRect(),be=Y?W.clientX-Y.left:W.clientX,de=Y?W.clientY-Y.top:W.clientY,oe=j.id;kt({x:be,y:de,items:[{id:"pin",label:j.fx!==void 0?"Unpin":"Pin",onSelect:()=>{ee.updateNode(oe,j.fx!==void 0?{fx:void 0,fy:void 0,fz:void 0}:{fx:j.x,fy:j.y,fz:j.z})}},{id:"connect",label:"Connect from here…",onSelect:()=>{Xn("add-link"),gt(oe)}},{separator:!0},{id:"delete",label:"Delete",shortcut:"⌫",onSelect:()=>{ee.removeNode(oe),fe.clear()}}]})},[S,v,ee,fe]),Pi=A.useCallback((j,W)=>{O?.(j,W);const Y=j.id;if(Y===void 0)return;const be=W.shiftKey||W.ctrlKey||W.metaKey;if($e(de=>{const oe=de.includes(Y);return!be||p!=="multi"?oe&&de.length===1?[]:[Y]:oe?de.filter(Oe=>Oe!==Y):[...de,Y]}),be||fe.clear(),wt&&Ee.current){const de=Ee.current;if($t===Y)et.current&&de.setCameraState(et.current,800),mn(null),et.current=null;else{const oe=typeof j.source=="object"?j.source:null,Oe=typeof j.target=="object"?j.target:null;if(oe&&Oe&&oe.x!==void 0&&Oe.x!==void 0){Bt===null&&$t===null&&(et.current=de.getCameraState());const Re=oe.x??0,Mt=oe.y??0,rt=Oe.x??0,Ht=Oe.y??0,Ut=oe.z??0,qt=Oe.z??0,Vs={x:(Re+rt)/2,y:(Mt+Ht)/2,z:(Ut+qt)/2},or=1.5,$i=rt-Re,Hi=Ht-Mt,Gs=qt-Ut,Ws=Math.max(Math.abs($i),1),Xs=Math.max(Math.abs(Hi),1),Ys=Math.min(Zn/(Ws*or),Jn/(Xs*or)),Ks=Math.min(16,Math.max(.5,Ys)),Qs=Math.hypot($i,Hi,Gs)/2/.466*or,Zs=Math.max(60,Qs);de.focusOn(Vs,{distance:Zs,zoom:Ks,durationMs:1e3}),mn(Y),yn(null)}}}},[O,fe,p,wt,$t,Bt,Zn,Jn]),Oi=A.useCallback((j,W)=>{if(L?.(j,W),!v)return;const Y=Ct.current?.getBoundingClientRect(),be=Y?W.clientX-Y.left:W.clientX,de=Y?W.clientY-Y.top:W.clientY;kt({x:be,y:de,items:[{id:"delete",label:"Delete link",shortcut:"⌫",onSelect:()=>{ee.removeLink(oe=>oe===j),$e([])}},{id:"reverse",label:"Reverse direction",onSelect:()=>{ee.removeLink(oe=>oe===j),ee.addLink({...j,source:typeof j.target=="object"?j.target.id:j.target,target:typeof j.source=="object"?j.source.id:j.source})}}]})},[L,v,ee]),er=A.useRef(null),Ai=A.useRef(ee.data.nodes);Ai.current=ee.data.nodes;const ji=A.useCallback((j,W)=>{if(J?.(j,W),Ee.current?.stopAnimation(),pn(j),Ge==="add-link"){const Y=Ai.current,be=j.x??0,de=j.y??0,oe=Yo*Yo;let Oe=null,Re=1/0;for(let Mt=0;Mt<Y.length;Mt++){const rt=Y[Mt];if(!rt||rt===j||rt.id===j.id)continue;const Ht=(rt.x??0)-be,Ut=(rt.y??0)-de,qt=Ht*Ht+Ut*Ut;qt<Re&&(Re=qt,Oe=rt)}er.current=Oe&&Re<oe?Oe:null}},[J,Ge,pn]),Ti=A.useCallback((j,W)=>{if(se?.(j,W),pn(null),Ge==="add-link"){const Y=er.current;if(er.current=null,!Y||Y.id===void 0||j.id===void 0)return;ee.addLink({source:j.id,target:Y.id});return}if(M){const Y=j;j.x!==void 0&&(Y.fx=j.x),j.y!==void 0&&(Y.fy=j.y),j.z!==void 0&&(Y.fz=j.z)}},[se,Ge,ee,M,pn]),Ei=A.useCallback(j=>{if(ne?.(j),!v)return;const W=Ct.current?.getBoundingClientRect(),Y=W?j.clientX-W.left:j.clientX,be=W?j.clientY-W.top:j.clientY,de=Kn.current?.getBoundingClientRect(),oe=de?j.clientX-de.left:j.clientX,Oe=de?j.clientY-de.top:j.clientY,Re=Ee.current?.screen2Graph(oe,Oe)??{x:oe,y:Oe};kt({x:Y,y:be,items:[{id:"add-node-here",label:"Add node here",onSelect:()=>{ee.addNode(void 0,{at:{x:Re.x,y:Re.y,...Re.z!==void 0?{z:Re.z}:{}}})}},{id:"fit",label:"Fit to view",shortcut:"F",onSelect:()=>Ee.current?.fit(400,40)},{id:"toggle-mode",label:ve==="2d"?"Switch to 3D":"Switch to 2D",shortcut:"3",onSelect:()=>pt(ve==="2d"?"3d":"2d")}]})},[ne,v,ee,ve,pt]),tr=g?.accent??"#4f8ef7",Li=A.useMemo(()=>new Set(fe.selected),[fe.selected]),Ni=A.useMemo(()=>new Set(tt),[tt]),xe=Rg({mode:ve,accentColor:tr,...F!==void 0?{nodeColor:F}:{},...Se!==void 0?{linkColor:Se}:{},...Te!==void 0?{linkWidth:Te}:{},...q!==void 0?{nodeVal:q}:{},...re!==void 0?{nodeRelSize:re}:{},...e.nodePointerAreaPaint!==void 0?{nodePointerAreaPaint:e.nodePointerAreaPaint}:{},...V!==void 0?{nodeAutoColorBy:V}:{},...le!==void 0?{nodeVisibility:le}:{},selectedNodeSet:Li,selectedLinkSet:Ni,highlightNeighborsOnHover:k,highlightedNodeIds:Ts,highlightedLinkIds:Es,hoverNodeId:Os,hoverLinkId:As,hiddenGroups:yi}),St=zg({mode:ve,showLabels:gn,selectedNodeSet:Li,hoveredNodeSet:Ls,accentColor:tr,...ce?{hostNodeCanvasObject:ce}:{},...e.nodeThreeObject?{hostNodeThreeObject:e.nodeThreeObject}:{},...R!==void 0?{nodeLabel:R}:{},...q!==void 0?{nodeVal:q}:{},...re!==void 0?{nodeRelSize:re}:{},...g?{theme:g}:{}}),nt=Fg({mode:ve,showLabels:gn,selectedLinkSet:Ni,hoveredLinkSet:Ns,accentColor:tr,...e.linkCanvasObject?{hostLinkCanvasObject:e.linkCanvasObject}:{},...e.linkThreeObject?{hostLinkThreeObject:e.linkThreeObject}:{},...e.linkPositionUpdate!==void 0?{hostLinkPositionUpdate:e.linkPositionUpdate}:{},...me!==void 0?{linkLabel:me}:{},...g?{theme:g}:{}}),Ri=Hg({profile:di,nodeCount:ee.data.nodes.length,linkCount:ee.data.links.length,mode:ve}),Ii=ve==="3d"&&(Ds||wi!==null),Di=A.useMemo(()=>Ke!==void 0?Ke:g?.background&&g.background!=="transparent"?g.background:"#ffffff",[Ke,g?.background]),$s=A.useMemo(()=>{const j={...Ri,...e,dagMode:vn};return j.backgroundColor===void 0&&(j.backgroundColor=Di),j.linkColor===void 0&&(j.linkColor="rgba(96, 102, 110, 0.55)"),j.linkOpacity===void 0&&(j.linkOpacity=1),j.nodeOpacity===void 0&&(j.nodeOpacity=1),xe.nodeColor!==void 0&&(j.nodeColor=xe.nodeColor),xe.linkColor!==void 0&&(j.linkColor=xe.linkColor),xe.linkWidth!==void 0&&(j.linkWidth=xe.linkWidth),xe.nodeVal!==void 0&&(j.nodeVal=xe.nodeVal),xe.nodePointerAreaPaint!==void 0&&(j.nodePointerAreaPaint=xe.nodePointerAreaPaint),St.canvasObject&&(j.nodeCanvasObject=St.canvasObject,j.nodeCanvasObjectMode=()=>"after"),nt.canvasObject&&(j.linkCanvasObject=nt.canvasObject,j.linkCanvasObjectMode=()=>"after"),St.threeObject&&(j.nodeThreeObject=St.threeObject,j.nodeThreeObjectExtend=!0),nt.threeObject&&(j.linkThreeObject=nt.threeObject,j.linkThreeObjectExtend=!0,nt.positionUpdate&&(j.linkPositionUpdate=nt.positionUpdate)),j.linkHoverPrecision=ze??8,j.enableNavigationControls=Ii?!1:Fe??!0,j.onNodeClick=Ci,j.onNodeRightClick=Mi,j.onLinkClick=Pi,j.onLinkRightClick=Oi,j.onBackgroundClick=Si,j.onBackgroundRightClick=Ei,j.onNodeDrag=ji,j.onNodeDragEnd=Ti,j.nodeLabel=()=>"",j.linkLabel=()=>"",j.onNodeHover=gi,j.onLinkHover=vi,d&&(j.onRenderFramePre=(W,Y)=>{_v(W,Y,typeof d=="object"?d:{}),z?.(W,Y)}),xe.nodeVisibility&&(j.nodeVisibility=xe.nodeVisibility),j},[e,vn,Di,xe.nodeColor,xe.linkColor,xe.linkWidth,xe.nodeVal,xe.nodePointerAreaPaint,xe.nodeVisibility,Ri,Ii,ze,Fe,Ci,Mi,Pi,Oi,Si,Ei,ji,Ti,gi,vi,d,z,St.canvasObject,St.threeObject,nt.canvasObject,nt.threeObject,nt.positionUpdate]),Pe=Cg({mount:Qn,mode:ve,width:Zn,height:Jn,data:ee.data,props:$s,paused:pi});Ee.current=Pe,hi.current=()=>{yn(null),mn(null),et.current=null,gt(null),kt(null)};const zi=A.useRef(!1),nr=ee.data.nodes.length;A.useEffect(()=>{if(!w||!Pe||zi.current||nr===0)return;zi.current=!0;const j=2.3+Math.log10(Math.max(nr,1)),W=setTimeout(()=>{const Y=Ee.current;Y&&(Y.zoom(1/j,0),requestAnimationFrame(()=>Ee.current?.fit(1e3,40)))},80);return()=>clearTimeout(W)},[Pe,w,nr]),Ng({engine:Pe,collideNodes:P,beeswarm:N,...re!==void 0?{nodeRelSize:re}:{}});const Fi=A.useRef(null),rr=A.useCallback(()=>JSON.stringify({nodes:ee.data.nodes.map(j=>{const{vx:W,vy:Y,vz:be,index:de,_neighbors:oe,_links:Oe,...Re}=j;return Re}),links:ee.data.links},null,2),[ee.data]),Bi=A.useCallback(j=>{const W=JSON.parse(j);if(!W||!Array.isArray(W.nodes)||!Array.isArray(W.links))throw new Error("invalid graph JSON");ee.setData(W),fe.clear(),$e([])},[ee,fe]),ir=A.useCallback((j=`graph-${Date.now()}.json`)=>{const W=new Blob([rr()],{type:"application/json"});Ss(W,j)},[rr]),Hs=A.useCallback(j=>{switch(j){case"select":case"pan":case"add-node":case"add-link":Xn(j);break;case"delete":if(fe.selected.length>0&&(ee.removeNodes(fe.selected),fe.clear()),tt.length>0){const W=new Set(tt);ee.removeLink(Y=>Y.id!==void 0&&W.has(Y.id)),$e([])}break;case"duplicate":Me.duplicate();break;case"select-all":fe.set(ee.data.nodes.map(W=>W.id)),$e(ee.data.links.map(W=>W.id).filter(W=>W!==void 0));break;case"fit":Pe?.fit(400,40);break;case"zoom-in":Pe&&Pe.zoom((Pe.getZoom?.()??1)*1.2,200);break;case"zoom-out":Pe&&Pe.zoom((Pe.getZoom?.()??1)/1.2,200);break;case"pause":Yn(!0);break;case"resume":Yn(!1);break;case"screenshot":kv(Pe?.getCanvasElement());break;case"export-json":ir();break;case"import-json":Fi.current?.click();break;case"toggle-mode":pt(ve==="2d"?"3d":"2d");break}},[Pe,ee,fe,ve,pt,tt,Me,ir]);Lg({engine:Pe,dataApi:ee,selection:fe,mode:ve,setMode:pt,selectedLinkIds:tt,setSelectedLinkIds:$e,setLinkSourceId:gt,setActiveTool:Xn,enableClipboard:m,copy:Me.copy,cut:Me.cut,paste:Me.paste,duplicate:Me.duplicate,addConnectedNode:Me.addConnectedNode,togglePin:Me.togglePin}),Ug({ref:t,dataApi:ee,selection:fe,engine:Pe,mode:ve,setMode:pt,setPaused:Yn,clipboard:Me,exportJSON:rr,importJSON:Bi,downloadJSON:ir});const Us=A.useMemo(()=>({position:"relative",width:l??"100%",height:c??"100%",...wv(g),...u}),[l,c,g,u]),qs=A.useMemo(()=>[{id:"focus-on-click",kind:"toggle",label:"Click to focus",hint:"Animate the camera to a clicked node; click again to restore.",checked:wt,onChange:mi},{id:"show-labels",kind:"toggle",label:"Always show labels",hint:"Draw every node + link label on the canvas, not just the selected ones. 2D only.",checked:gn,onChange:bi},{kind:"select",id:"dag-mode",label:"DAG orientation",hint:"Force a hierarchical / radial layout.",value:vn??"null",options:[{value:"null",label:"off"},{value:"td",label:"td (top-down)"},{value:"bu",label:"bu (bottom-up)"},{value:"lr",label:"lr (left-right)"},{value:"rl",label:"rl (right-left)"},{value:"radialout"},{value:"radialin"}],onChange:j=>_i(j==="null"?null:j)}],[wt,gn,vn]);return T.jsxs("div",{ref:Ct,className:["lora-graph-canvas",f??""].join(" ").trim(),style:Us,"data-mode":ve,"data-tool":Ge,children:[T.jsx("div",{ref:Fs,className:"lgc-engine-mount"}),T.jsx(sv,{config:h,activeTool:Ge,paused:pi,mode:ve,onSelect:Hs}),h!==!1?T.jsxs(T.Fragment,{children:[T.jsx(bv,{items:qs}),T.jsx(yv,{mode:ve,onToggle:()=>pt(ve==="2d"?"3d":"2d")})]}):null,_n?T.jsx(lv,{x:_n.x,y:_n.y,items:_n.items,onClose:()=>kt(null)}):null,x?T.jsx(cv,{content:Rs,hostRef:Ct}):null,T.jsx(uv,{rect:wi}),y&&V?T.jsx(vv,{nodes:ee.data.nodes,groupBy:V,hidden:yi,onToggle:j=>Is(W=>{const Y=new Set(W);return Y.has(j)?Y.delete(j):Y.add(j),Y})}):null,T.jsx(hv,{nodeCount:fe.selected.length,linkCount:tt.length,hasClipboard:Me.hasClipboard(),enableClipboard:m,onDelete:()=>{if(fe.selected.length>0&&(ee.removeNodes(fe.selected),fe.clear()),tt.length>0){const j=new Set(tt);ee.removeLink(W=>W.id!==void 0&&j.has(W.id)),$e([])}},onDuplicate:()=>Me.duplicate(),onAddConnected:()=>Me.addConnectedNode(),onCopy:()=>Me.copy(),onCut:()=>Me.cut(),onPaste:()=>Me.paste(),onClear:()=>{fe.clear(),$e([])}}),T.jsx("input",{ref:Fi,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:j=>{const W=j.target.files?.[0];W&&(W.text().then(Bi).catch(Y=>{console.error("[lora-graph-canvas] import failed:",Y)}),j.target.value="")}})]})}const Ms=A.forwardRef(Cv);Ms.displayName="LoraGraphCanvas";const Sv={background:"#ffffff",foreground:"#1c1f23",border:"#d8dde3",accent:"#4f8ef7",toolbarBackground:"rgba(255, 255, 255, 0.92)",toolbarForeground:"#1c1f23",toolbarBorder:"#d8dde3",toolActiveBackground:"rgba(79, 142, 247, 0.18)",toolHoverBackground:"rgba(0, 0, 0, 0.05)",tooltipBackground:"rgba(28, 31, 35, 0.9)",tooltipForeground:"#ffffff",menuBackground:"#ffffff",menuForeground:"#1c1f23",menuHoverBackground:"rgba(0, 0, 0, 0.06)"},Mv={background:"#101216",foreground:"#e6e9ee",border:"#2a2f37",accent:"#6aa3ff",toolbarBackground:"rgba(20, 23, 28, 0.92)",toolbarForeground:"#e6e9ee",toolbarBorder:"#2a2f37",toolActiveBackground:"rgba(106, 163, 255, 0.25)",toolHoverBackground:"rgba(255, 255, 255, 0.08)",tooltipBackground:"rgba(240, 240, 240, 0.92)",tooltipForeground:"#101216",menuBackground:"#161a20",menuForeground:"#e6e9ee",menuHoverBackground:"rgba(255, 255, 255, 0.08)"};exports.DEFAULT_TOOL_ORDER=Ur;exports.LoraGraphCanvas=Ms;exports.TOOL_DESCRIPTORS=ks;exports.createId=Et;exports.darkTheme=Mv;exports.lightTheme=Sv;
682
+ }`;bg(_g);function oo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function xg(e){if(Array.isArray(e))return e}function wg(e){if(Array.isArray(e))return oo(e)}function kg(e,t,n){return(t=jg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cg(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Sg(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,l=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(f){u=!0,o=f}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function Mg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
683
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pg(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
684
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ag(e,t){return xg(e)||Sg(e,t)||Es(e,t)||Mg()}function Rt(e){return wg(e)||Cg(e)||Es(e)||Pg()}function Og(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jg(e){var t=Og(e,"string");return typeof t=="symbol"?t:t+""}function Es(e,t){if(e){if(typeof e=="string")return oo(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oo(e,t):void 0}}var Ls=function(t){t instanceof Array?t.forEach(Ls):(t.map&&t.map.dispose(),t.dispose())},Ns=function(t){t.geometry&&t.geometry.dispose(),t.material&&Ls(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(Ns)},zg=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),Ns(n)}},xe=window.THREE?window.THREE:{WebGLRenderer:re.WebGLRenderer,Scene:re.Scene,PerspectiveCamera:re.PerspectiveCamera,Raycaster:re.Raycaster,SRGBColorSpace:re.SRGBColorSpace,TextureLoader:re.TextureLoader,Vector2:re.Vector2,Vector3:re.Vector3,Box3:re.Box3,Color:re.Color,Mesh:re.Mesh,SphereGeometry:re.SphereGeometry,MeshBasicMaterial:re.MeshBasicMaterial,BackSide:re.BackSide,Timer:re.Timer},Rs=_o({props:{width:{default:window.innerWidth,onChange:function(t,n,r){isNaN(t)&&(n.width=r)}},height:{default:window.innerHeight,onChange:function(t,n,r){isNaN(t)&&(n.height=r)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(t,n){n.hoverObj=null,n.tooltip&&n.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(t){if(t.initialised){t.controls.enabled&&t.controls.update&&t.controls.update(Math.min(1,t.timer.update().getDelta())),t.postProcessingComposer?t.postProcessingComposer.render():t.renderer.render(t.scene,t.camera),t.extraRenderers.forEach(function(a){return a.render(t.scene,t.camera)});var n=+new Date;if(t.enablePointerInteraction&&n-t.lastRaycasterCheck>=t.pointerRaycasterThrottleMs){t.lastRaycasterCheck=n;var r=null;if(t.hoverDuringDrag||!t.isPointerDragging){var o=this.intersectingObjects(t.pointerPos.x,t.pointerPos.y);t.hoverOrderComparator&&o.sort(function(a,l){return t.hoverOrderComparator(a.object,l.object)});var i=o.find(function(a){return t.hoverFilter(a.object)})||null;r=i?i.object:null,t.intersection=i||null}r!==t.hoverObj&&(t.onHover(r,t.hoverObj,t.intersection),t.tooltip.content(r&&de(t.tooltipContent)(r,t.intersection)||null),t.hoverObj=r)}t.tweenGroup.update()}return this},getPointerPos:function(t){var n=t.pointerPos,r=n.x,o=n.y;return{x:r,y:o}},cameraPosition:function(t,n,r,o){var i=t.camera;if(n&&t.initialised){var a=n,l=r||{x:0,y:0,z:0};if(!o)f(a),c(l);else{var s=Object.assign({},i.position),u=p();t.tweenGroup.add(new Vi(s).to(a,o).easing(Bt.Quadratic.Out).onUpdate(f).onComplete(function(){t.tweenGroup.remove(this)}).start()),t.tweenGroup.add(new Vi(u).to(l,o/3).easing(Bt.Quadratic.Out).onUpdate(c).onComplete(function(){t.tweenGroup.remove(this)}).start())}return this}return Object.assign({},i.position,{lookAt:p()});function f(h){var d=h.x,m=h.y,v=h.z;d!==void 0&&(i.position.x=d),m!==void 0&&(i.position.y=m),v!==void 0&&(i.position.z=v)}function c(h){var d=new xe.Vector3(h.x,h.y,h.z);t.controls.enabled&&t.controls.target?t.controls.target=d:i.lookAt(d)}function p(){return Object.assign(new xe.Vector3(0,0,-1e3).applyQuaternion(i.quaternion).add(i.position))}},zoomToFit:function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return this.fitToBbox(this.getBbox.apply(this,i),n,r)},fitToBbox:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,i=t.camera;if(n){var a=new xe.Vector3(0,0,0),l=Math.max.apply(Math,Rt(Object.entries(n).map(function(h){var d=Ag(h,2),m=d[0],v=d[1];return Math.max.apply(Math,Rt(v.map(function(g){return Math.abs(a[m]-g)})))})))*2,s=(1-o*2/t.height)*i.fov,u=l/Math.atan(s*Math.PI/180),f=u/i.aspect,c=Math.max(u,f);if(c>0){var p=a.clone().sub(i.position).normalize().multiplyScalar(-c);this.cameraPosition(p,a,r)}}return this},getBbox:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},r=new xe.Box3(new xe.Vector3(0,0,0),new xe.Vector3(0,0,0)),o=t.objects.filter(n);return o.length?(o.forEach(function(i){return r.expandByObject(i)}),Object.assign.apply(Object,Rt(["x","y","z"].map(function(i){return kg({},i,[r.min[i],r.max[i]])})))):null},getScreenCoords:function(t,n,r,o){var i=new xe.Vector3(n,r,o);return i.project(this.camera()),{x:(i.x+1)*t.width/2,y:-(i.y-1)*t.height/2}},getSceneCoords:function(t,n,r){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=new xe.Vector2(n/t.width*2-1,-(r/t.height)*2+1),a=new xe.Raycaster;return a.setFromCamera(i,t.camera),Object.assign({},a.ray.at(o,new xe.Vector3))},intersectingObjects:function(t,n,r){var o=new xe.Vector2(n/t.width*2-1,-(r/t.height)*2+1),i=new xe.Raycaster;return i.params.Line.threshold=t.lineHoverPrecision,i.params.Points.threshold=t.pointsHoverPrecision,i.setFromCamera(o,t.camera),i.intersectObjects(t.objects,!0)},renderer:function(t){return t.renderer},scene:function(t){return t.scene},camera:function(t){return t.camera},postProcessingComposer:function(t){return t.postProcessingComposer},controls:function(t){return t.controls},tbControls:function(t){return t.controls},_destructor:function(t){var n,r,o;zg(t.scene),(n=t.controls)===null||n===void 0||n.dispose(),(r=t.renderer)===null||r===void 0||r.dispose(),(o=t.postProcessingComposer)===null||o===void 0||o.dispose()}},stateInit:function(){return{scene:new xe.Scene,camera:new xe.PerspectiveCamera,timer:new xe.Timer,tweenGroup:new ls,lastRaycasterCheck:0}},init:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=r.controlType,i=o===void 0?"trackball":o,a=r.useWebGPU,l=a===void 0?!1:a,s=r.rendererConfig,u=s===void 0?{}:s,f=r.extraRenderers,c=f===void 0?[]:f,p=r.waitForLoadComplete,h=p===void 0?!0:p;t.innerHTML="",t.appendChild(n.container=document.createElement("div")),n.container.className="scene-container",n.container.style.position="relative",n.container.appendChild(n.navInfo=document.createElement("div")),n.navInfo.className="scene-nav-info",n.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[i]||"",n.navInfo.style.display=n.showNavInfo?null:"none",n.tooltip=new mg(n.container),n.pointerPos=new xe.Vector2,n.pointerPos.x=-2,n.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(d){return n.container.addEventListener(d,function(m){if(d==="pointerdown"&&(n.isPointerPressed=!0),!n.isPointerDragging&&m.type==="pointermove"&&(m.pressure>0||n.isPointerPressed)&&(m.pointerType==="mouse"||m.movementX===void 0||[m.movementX,m.movementY].some(function(S){return Math.abs(S)>1}))&&(n.isPointerDragging=!0),n.enablePointerInteraction){var v=g(n.container);n.pointerPos.x=m.pageX-v.left,n.pointerPos.y=m.pageY-v.top}function g(S){var _=S.getBoundingClientRect(),x=window.pageXOffset||document.documentElement.scrollLeft,w=window.pageYOffset||document.documentElement.scrollTop;return{top:_.top+w,left:_.left+x}}},{passive:!0})}),n.container.addEventListener("pointerup",function(d){n.isPointerPressed&&(n.isPointerPressed=!1,!(n.isPointerDragging&&(n.isPointerDragging=!1,!n.clickAfterDrag))&&requestAnimationFrame(function(){d.button===0&&n.onClick(n.hoverObj||null,d,n.intersection),d.button===2&&n.onRightClick&&n.onRightClick(n.hoverObj||null,d,n.intersection)}))},{passive:!0,capture:!0}),n.container.addEventListener("contextmenu",function(d){n.onRightClick&&d.preventDefault()}),n.renderer=new(l?_l.WebGPURenderer:xe.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},u)),n.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),n.container.appendChild(n.renderer.domElement),n.extraRenderers=c,n.extraRenderers.forEach(function(d){d.domElement.style.position="absolute",d.domElement.style.top="0px",d.domElement.style.pointerEvents="none",n.container.appendChild(d.domElement)}),n.postProcessingComposer=new Cl.EffectComposer(n.renderer),n.postProcessingComposer.addPass(new Sl.RenderPass(n.scene,n.camera)),n.controls=new{trackball:xl.TrackballControls,orbit:wl.OrbitControls,fly:kl.FlyControls}[i](n.camera,n.renderer.domElement),i==="fly"&&(n.controls.movementSpeed=300,n.controls.rollSpeed=Math.PI/6,n.controls.dragToLook=!0),(i==="trackball"||i==="orbit")&&(n.controls.minDistance=.1,n.controls.maxDistance=n.skyRadius,n.controls.addEventListener("start",function(){n.controlsEngaged=!0}),n.controls.addEventListener("change",function(){n.controlsEngaged&&(n.controlsDragging=!0)}),n.controls.addEventListener("end",function(){n.controlsEngaged=!1,n.controlsDragging=!1})),[n.renderer,n.postProcessingComposer].concat(Rt(n.extraRenderers)).forEach(function(d){return d.setSize(n.width,n.height)}),n.camera.aspect=n.width/n.height,n.camera.updateProjectionMatrix(),n.camera.position.z=1e3,n.scene.add(n.skysphere=new xe.Mesh),n.skysphere.visible=!1,n.loadComplete=n.scene.visible=!h,window.scene=n.scene},update:function(t,n){if(t.width&&t.height&&(n.hasOwnProperty("width")||n.hasOwnProperty("height"))){var r,o=t.width,i=t.height;t.container.style.width="".concat(o,"px"),t.container.style.height="".concat(i,"px"),[t.renderer,t.postProcessingComposer].concat(Rt(t.extraRenderers)).forEach(function(h){return h.setSize(o,i)}),t.camera.aspect=o/i;var a=t.viewOffset.slice(0,2);a.some(function(h){return h})&&(r=t.camera).setViewOffset.apply(r,[o,i].concat(Rt(a),[o,i])),t.camera.updateProjectionMatrix()}if(n.hasOwnProperty("viewOffset")){var l,s=t.width,u=t.height,f=t.viewOffset.slice(0,2);f.some(function(h){return h})?(l=t.camera).setViewOffset.apply(l,[s,u].concat(Rt(f),[s,u])):t.camera.clearViewOffset()}if(n.hasOwnProperty("skyRadius")&&t.skyRadius&&(t.controls.hasOwnProperty("maxDistance")&&n.skyRadius&&(t.controls.maxDistance=Math.min(t.controls.maxDistance,t.skyRadius)),t.camera.far=t.skyRadius*2.5,t.camera.updateProjectionMatrix(),t.skysphere.geometry=new xe.SphereGeometry(t.skyRadius)),n.hasOwnProperty("backgroundColor")){var c=tn(t.backgroundColor).alpha;c===void 0&&(c=1),t.renderer.setClearColor(new xe.Color(oh(1,t.backgroundColor)),c)}n.hasOwnProperty("backgroundImageUrl")&&(t.backgroundImageUrl?new xe.TextureLoader().load(t.backgroundImageUrl,function(h){h.colorSpace=xe.SRGBColorSpace,t.skysphere.material=new xe.MeshBasicMaterial({map:h,side:xe.BackSide}),t.skysphere.visible=!0,t.onBackgroundImageLoaded&&setTimeout(t.onBackgroundImageLoaded),!t.loadComplete&&p()}):(t.skysphere.visible=!1,t.skysphere.material.map=null,!t.loadComplete&&p())),n.hasOwnProperty("showNavInfo")&&(t.navInfo.style.display=t.showNavInfo?null:"none"),n.hasOwnProperty("lights")&&((n.lights||[]).forEach(function(h){return t.scene.remove(h)}),t.lights.forEach(function(h){return t.scene.add(h)})),n.hasOwnProperty("objects")&&((n.objects||[]).forEach(function(h){return t.scene.remove(h)}),t.objects.forEach(function(h){return t.scene.add(h)}));function p(){t.loadComplete=t.scene.visible=!0}}});function Tg(e,t){let n=null,r=null;const o=(...i)=>{r=i,n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null;const a=r;r=null,e(...a)},t)};return o.cancel=()=>{n!==null&&(clearTimeout(n),n=null),r=null},o}class Eg{name;defaultVal;triggerUpdate;onChange;constructor(t,n){this.name=t,this.defaultVal=n.default??null,this.triggerUpdate=n.triggerUpdate??!0,this.onChange=n.onChange??(()=>{})}}function Lg(e={}){const{stateInit:t=()=>({}),props:n={},methods:r={},aliases:o={},init:i=()=>{},update:a=()=>{}}=e,l=Object.keys(n).map(u=>new Eg(u,n[u]));function s(...u){const f=this instanceof s,c=u.slice(),p=f?c.shift():void 0,h=c[0]??{},d=typeof t=="function"?t(h):t,m=Object.assign({},d,{initialised:!1,_rerender:()=>{}});let v={};const g=x=>(S(x,h),_(),g);function S(x,w){i.call(g,x,m,w),m.initialised=!0}const _=Tg(()=>{m.initialised&&(a.call(g,m,v),v={})},1);for(const x of l){const{name:w,triggerUpdate:b,onChange:M,defaultVal:P}=x;g[w]=function(){const j=m[w];if(arguments.length===0)return j;const F=arguments[0],I=F===void 0?P:F;return m[w]=I,M.call(g,I,m,j),Object.prototype.hasOwnProperty.call(v,w)||(v[w]=j),b&&_(),g}}for(const x of Object.keys(r))g[x]=function(...w){return r[x].call(g,m,...w)};for(const[x,w]of Object.entries(o))g[x]=g[w];return g.resetProps=function(){for(const x of l)g[x.name](x.defaultVal);return g},g.resetProps(),m._rerender=_,f&&p!==void 0&&g(p),g}return s}function ea(e){if(typeof e=="function")return e;if(typeof e=="string"){const n=e;return r=>r?.[n]}const t=e;return()=>t}function Ds(e,t){const n=e instanceof Array?e:[e],r=new t;return r._destructor?.(),{linkProp(o){return{default:r[o](),onChange(i,a){n.forEach(l=>{a[l][o].call(a[l],i)})},triggerUpdate:!1}},linkMethod(o){return function(i,...a){const l=[];return n.forEach(s=>{const u=i[s],f=u[o].apply(u,a);f!==u&&l.push(f)}),l.length?l[0]:this}}}}const ta=globalThis,na=ta.THREE?ta.THREE:{AmbientLight:re.AmbientLight,DirectionalLight:re.DirectionalLight},Ng=170,Is=Ds("forceGraph",ns),Rg=["jsonUrl","graphData","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeColor","nodeAutoColorBy","nodeOpacity","nodeVisibility","nodeThreeObject","nodeThreeObjectExtend","nodePositionUpdate","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject","forceEngine","d3AlphaDecay","d3VelocityDecay","d3AlphaMin","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"],Dg=["refresh","getGraphBbox","d3Force","d3ReheatSimulation","emitParticle"],fr=Ds("renderObjs",Rs),Ig=["width","height","backgroundColor","showNavInfo","enablePointerInteraction"],Fg=["lights","cameraPosition","postProcessingComposer"],Ao={};for(const e of Rg)Ao[e]=Is.linkProp(e);for(const e of Ig)Ao[e]=fr.linkProp(e);const On={};for(const e of Dg)On[e]=Is.linkMethod(e);for(const e of Fg)On[e]=fr.linkMethod(e);On.graph2ScreenCoords=fr.linkMethod("getScreenCoords");On.screen2GraphCoords=fr.linkMethod("getSceneCoords");const et=e=>e;function wt(e){let t=e??null;for(;t&&!Object.prototype.hasOwnProperty.call(t,"__graphObjType");)t=t.parent;return t}const Bg=Lg({props:{nodeLabel:{default:"name",triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:1,onChange(e,t){et(t).renderObjs.lineHoverPrecision(e)},triggerUpdate:!1},enableNavigationControls:{default:!0,onChange(e,t){const r=et(t).renderObjs.controls();r&&(r.enabled=!!e,e&&r.domElement&&r.domElement.dispatchEvent(new PointerEvent("pointerup")))},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},onNodeDrag:{default:()=>{},triggerUpdate:!1},onNodeDragEnd:{default:()=>{},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},...Ao},methods:{zoomToFit(e,t,n,...r){return et(e).renderObjs.fitToBbox(this.getGraphBbox(...r),t,n),this},pauseAnimation(e){const t=et(e);return t.animationFrameRequestId!=null&&(cancelAnimationFrame(t.animationFrameRequestId),t.animationFrameRequestId=null),this},resumeAnimation(e){return et(e).animationFrameRequestId==null&&this._animationCycle(),this},_animationCycle(e){const t=et(e);t.enablePointerInteraction&&(this.renderer().domElement.style.cursor=""),t.forceGraph.tickFrame(),t.renderObjs.tick(),t.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},scene(e){return et(e).renderObjs.scene()},camera(e){return et(e).renderObjs.camera()},renderer(e){return et(e).renderObjs.renderer()},controls(e){return et(e).renderObjs.controls()},_destructor(e){const t=et(e);this.pauseAnimation(),this.graphData({nodes:[],links:[]}),t.forceGraph._destructor?.(),t.renderObjs._destructor()},...On},stateInit:e=>{const t=e??{},n=new ns,r=Rs({...t.controlType?{controlType:t.controlType}:{},...t.rendererConfig?{rendererConfig:t.rendererConfig}:{},...t.extraRenderers?{extraRenderers:t.extraRenderers}:{}});return r.objects([n]),r.lights([new na.AmbientLight(13421772,Math.PI),new na.DirectionalLight(16777215,.6*Math.PI)]),{forceGraph:n,renderObjs:r}},init(e,t){const n=et(t);e.innerHTML="",n.container=document.createElement("div"),n.container.style.position="relative",e.appendChild(n.container);const r=document.createElement("div");n.container.appendChild(r),n.renderObjs(r);const o=n.renderObjs.camera(),i=n.renderObjs.renderer(),a=n.renderObjs.controls();a&&(a.enabled=!!n.enableNavigationControls),n.lastSetCameraZ=o.position.z;const l=document.createElement("div");l.className="graph-info-msg",l.textContent="",n.container.appendChild(l);const s=n.forceGraph;s.onLoading(()=>{l.textContent="Loading..."}),s.onFinishLoading(()=>{l.textContent=""}),s.onUpdate(()=>{if(n.graphData=s.graphData(),o.position.x===0&&o.position.y===0&&o.position.z===n.lastSetCameraZ&&n.graphData.nodes.length){o.lookAt(s.position??{x:0,y:0,z:0});const f=Math.cbrt(n.graphData.nodes.length)*Ng;o.position.z=f,n.lastSetCameraZ=f}}),s.onFinishUpdate(()=>{if(n._dragControls){const f=n.graphData.nodes.find(c=>c.__initialFixedPos&&!c.__disposeControlsAfterDrag);f?f.__disposeControlsAfterDrag=!0:n._dragControls.dispose(),n._dragControls=void 0}if(n.enableNodeDrag&&n.enablePointerInteraction&&n.forceEngine==="d3"){const f=n.graphData.nodes.map(h=>h.__threeObj).filter(h=>!!h),c=new bl.DragControls(f,o,i.domElement);n._dragControls=c,c.addEventListener("dragstart",h=>{const d=h,m=wt(d.object);if(!m)return;a&&(a.enabled=!1),d.object.__initialPos=d.object.position.clone(),d.object.__prevPos=d.object.position.clone();const v=m.__data;v.__initialFixedPos||(v.__initialFixedPos={fx:v.fx,fy:v.fy,fz:v.fz}),v.__initialPos||(v.__initialPos={x:v.x,y:v.y,z:v.z});for(const g of["x","y","z"])v[`f${g}`]=v[g];i.domElement.classList.add("grabbable")});const p=4;c.addEventListener("drag",h=>{const d=h,m=wt(d.object);if(!m)return;if(!Object.prototype.hasOwnProperty.call(d.object,"__graphObjType")){const _=d.object.__initialPos,x=d.object.__prevPos,w=d.object.position,b=w.clone().sub(x);m.position.add(b),x.copy(w),w.copy(_)}const v=m.__data,g=m.position;if(!v.__dragCommitted){const _=v.__initialPos,x=_?.x??g.x,w=_?.y??g.y,b=_?.z??g.z,M=g.x-x,P=g.y-w,N=g.z-b;if(M*M+P*P+N*N<p)return;v.__dragCommitted=!0}const S={x:g.x-(v.x??0),y:g.y-(v.y??0),z:g.z-(v.z??0)};for(const _ of["x","y","z"])v[`f${_}`]=g[_],v[_]=g[_];n.forceGraph.d3AlphaTarget(.3).resetCountdown(),v.__dragged=!0,n.onNodeDrag?.(v,S)}),c.addEventListener("dragend",h=>{const d=h,m=wt(d.object);if(!m)return;delete d.object.__initialPos,delete d.object.__prevPos;const v=m.__data;v.__disposeControlsAfterDrag&&(c.dispose(),delete v.__disposeControlsAfterDrag);const g=v.__initialFixedPos,S=v.__initialPos,_=S?{x:S.x-v.x,y:S.y-v.y,z:S.z-v.z}:{x:0,y:0,z:0};if(g){for(const x of["x","y","z"]){const w=`f${x}`;g[w]===void 0&&delete v[w]}delete v.__initialFixedPos,delete v.__initialPos,delete v.__dragCommitted,v.__dragged&&(delete v.__dragged,n.onNodeDragEnd?.(v,_))}n.forceGraph.d3AlphaTarget(0).resetCountdown(),n.enableNavigationControls&&a&&(a.enabled=!0,a._status!==void 0&&(a._onPointerCancel?.(),a.domElement?.ownerDocument?.dispatchEvent(new PointerEvent("pointerup",{pointerType:"touch"})))),i.domElement.classList.remove("grabbable")})}}),parseInt(re.REVISION,10)<155&&(i.useLegacyLights=!1),n.renderObjs.hoverOrderComparator((f,c)=>{const p=wt(f);if(!p)return 1;const h=wt(c);if(!h)return-1;const d=m=>m.__graphObjType==="node"?1:0;return d(h)-d(p)}).tooltipContent(f=>{const c=wt(f);if(!c)return"";const p=n[`${c.__graphObjType}Label`];return ea(p)(c.__data)||""}).hoverDuringDrag(!1).onHover(f=>{const c=wt(f);if(c===n.hoverObj)return;const p=n.hoverObj??null,h=p?p.__graphObjType:null,d=p?p.__data:null,m=c?c.__graphObjType:null,v=c?c.__data:null;if(h&&h!==m){const _=n[`on${h==="node"?"Node":"Link"}Hover`];_?.(null,d)}if(m){const _=n[`on${m==="node"?"Node":"Link"}Hover`];_?.(v,h===m?d:null)}const S=!!(c?n[`on${m==="node"?"Node":"Link"}Click`]:n.onBackgroundClick)&&ea(n.showPointerCursor)(v);i.domElement.classList[S?"add":"remove"]("clickable"),n.hoverObj=c}).clickAfterDrag(!1).onClick((f,c)=>{const p=wt(f);if(p){const h=n[`on${p.__graphObjType==="node"?"Node":"Link"}Click`];h?.(p.__data,c)}else n.onBackgroundClick&&n.onBackgroundClick(c)}).onRightClick((f,c)=>{const p=wt(f);if(p){const h=n[`on${p.__graphObjType==="node"?"Node":"Link"}RightClick`];h?.(p.__data,c)}else n.onBackgroundRightClick&&n.onBackgroundRightClick(c)}),this._animationCycle()},update(){}});function pt(e,t,n,r=Hg){if(typeof requestAnimationFrame!="function")return t(1),()=>{};const o=performance.now();let i=null,a=!1;const l=s=>{if(a)return;const u=s-o,f=Math.min(1,u/Math.max(e,1));t(r(f)),f<1?i=requestAnimationFrame(l):i=null};return i=requestAnimationFrame(l),()=>{a=!0,i!==null&&cancelAnimationFrame(i),i=null}}function $g(e){if(typeof requestAnimationFrame!="function")return e(0),()=>{};let t=null,n=!1,r=performance.now();const o=i=>{if(n)return;const a=Math.min(.033,(i-r)/1e3);if(r=i,e(a)===!0){t=null;return}t=requestAnimationFrame(o)};return t=requestAnimationFrame(o),()=>{n=!0,t!==null&&cancelAnimationFrame(t),t=null}}function Hg(e){return 1-(1-e)*(1-e)}function ra(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Q(e,t,n){return e+(t-e)*n}const fe=()=>!0,tt=e=>e==="2d",Me=e=>e==="3d",qg=[{key:"nodeId",setter:"nodeId",supports:fe},{key:"linkSource",setter:"linkSource",supports:fe},{key:"linkTarget",setter:"linkTarget",supports:fe},{key:"backgroundColor",setter:"backgroundColor",supports:fe},{key:"nodeColor",setter:"nodeColor",supports:fe},{key:"nodeLabel",setter:"nodeLabel",supports:fe},{key:"nodeVal",setter:"nodeVal",supports:fe},{key:"nodeAutoColorBy",setter:"nodeAutoColorBy",supports:fe},{key:"nodeRelSize",setter:"nodeRelSize",supports:fe},{key:"nodeVisibility",setter:"nodeVisibility",supports:fe},{key:"linkColor",setter:"linkColor",supports:fe},{key:"linkLabel",setter:"linkLabel",supports:fe},{key:"linkWidth",setter:"linkWidth",supports:fe},{key:"linkCurvature",setter:"linkCurvature",supports:fe},{key:"linkAutoColorBy",setter:"linkAutoColorBy",supports:fe},{key:"linkVisibility",setter:"linkVisibility",supports:fe},{key:"linkDirectionalArrowLength",setter:"linkDirectionalArrowLength",supports:fe},{key:"linkDirectionalArrowColor",setter:"linkDirectionalArrowColor",supports:fe},{key:"linkDirectionalArrowRelPos",setter:"linkDirectionalArrowRelPos",supports:fe},{key:"linkDirectionalParticles",setter:"linkDirectionalParticles",supports:fe},{key:"linkDirectionalParticleSpeed",setter:"linkDirectionalParticleSpeed",supports:fe},{key:"linkDirectionalParticleWidth",setter:"linkDirectionalParticleWidth",supports:fe},{key:"linkDirectionalParticleOffset",setter:"linkDirectionalParticleOffset",supports:fe},{key:"linkDirectionalParticleColor",setter:"linkDirectionalParticleColor",supports:fe},{key:"cooldownTicks",setter:"cooldownTicks",supports:fe},{key:"cooldownTime",setter:"cooldownTime",supports:fe},{key:"warmupTicks",setter:"warmupTicks",supports:fe},{key:"d3AlphaDecay",setter:"d3AlphaDecay",supports:fe},{key:"d3VelocityDecay",setter:"d3VelocityDecay",supports:fe},{key:"d3AlphaMin",setter:"d3AlphaMin",supports:fe},{key:"d3AlphaTarget",setter:"d3AlphaTarget",supports:fe},{key:"dagMode",setter:"dagMode",supports:fe},{key:"dagLevelDistance",setter:"dagLevelDistance",supports:fe},{key:"dagNodeFilter",setter:"dagNodeFilter",supports:fe},{key:"onDagError",setter:"onDagError",supports:fe},{key:"enableNodeDrag",setter:"enableNodeDrag",supports:fe},{key:"enablePointerInteraction",setter:"enablePointerInteraction",supports:fe},{key:"linkHoverPrecision",setter:"linkHoverPrecision",supports:fe},{key:"showPointerCursor",setter:"showPointerCursor",supports:fe},{key:"enableZoom",setter:"enableZoomInteraction",supports:tt},{key:"enablePan",setter:"enablePanInteraction",supports:tt},{key:"minZoom",setter:"minZoom",supports:tt},{key:"maxZoom",setter:"maxZoom",supports:tt},{key:"autoPauseRedraw",setter:"autoPauseRedraw",supports:tt},{key:"linkLineDash",setter:"linkLineDash",supports:tt},{key:"nodeCanvasObject",setter:"nodeCanvasObject",supports:tt},{key:"nodeCanvasObjectMode",setter:"nodeCanvasObjectMode",supports:tt},{key:"nodePointerAreaPaint",setter:"nodePointerAreaPaint",supports:tt},{key:"linkCanvasObject",setter:"linkCanvasObject",supports:tt},{key:"linkCanvasObjectMode",setter:"linkCanvasObjectMode",supports:tt},{key:"linkPointerAreaPaint",setter:"linkPointerAreaPaint",supports:tt},{key:"showNavInfo",setter:"showNavInfo",supports:Me},{key:"enableNavigationControls",setter:"enableNavigationControls",supports:Me},{key:"nodeOpacity",setter:"nodeOpacity",supports:Me},{key:"nodeResolution",setter:"nodeResolution",supports:Me},{key:"linkOpacity",setter:"linkOpacity",supports:Me},{key:"linkResolution",setter:"linkResolution",supports:Me},{key:"linkCurveRotation",setter:"linkCurveRotation",supports:Me},{key:"linkMaterial",setter:"linkMaterial",supports:Me},{key:"nodeThreeObject",setter:"nodeThreeObject",supports:Me},{key:"nodeThreeObjectExtend",setter:"nodeThreeObjectExtend",supports:Me},{key:"linkThreeObject",setter:"linkThreeObject",supports:Me},{key:"linkThreeObjectExtend",setter:"linkThreeObjectExtend",supports:Me},{key:"nodePositionUpdate",setter:"nodePositionUpdate",supports:Me},{key:"linkPositionUpdate",setter:"linkPositionUpdate",supports:Me},{key:"linkDirectionalArrowResolution",setter:"linkDirectionalArrowResolution",supports:Me},{key:"linkDirectionalParticleResolution",setter:"linkDirectionalParticleResolution",supports:Me},{key:"numDimensions",setter:"numDimensions",supports:Me},{key:"forceEngine",setter:"forceEngine",supports:Me},{key:"ngraphPhysics",setter:"ngraphPhysics",supports:Me},{key:"pointerRaycasterThrottleMs",setter:"pointerRaycasterThrottleMs",supports:Me}];function oa(e,t,n,r){if(t!==n)for(const o of qg){if(!o.supports(r))continue;const i=t[o.key],a=n[o.key];if(Object.is(i,a))continue;const l=e[o.setter];typeof l=="function"&&l.call(e,i)}}const Ug=["onNodeClick","onNodeRightClick","onNodeHover","onNodeDrag","onNodeDragEnd","onLinkClick","onLinkRightClick","onLinkHover","onBackgroundClick","onBackgroundRightClick","onEngineTick","onEngineStop"],Xt=1200,Dt=300,vn=Object.freeze({x:0,y:0,z:0});function Gg(e,t,n){const r=new Bg(e,{controlType:"orbit"});r.width(t.width),r.height(t.height);const o=new Set;for(const y of Ug){const k=r[y];if(typeof k=="function"){if(y==="onEngineStop"){k.call(r,(...C)=>{for(const B of[...o])try{B()}catch{}const $=n.current.onEngineStop;typeof $=="function"&&$(...C)});continue}k.call(r,(...C)=>{const $=n.current[y];typeof $=="function"&&$(...C)})}}oa(r,t.initialProps,{},"3d"),r.graphData(t.initialData);let i=t.initialMode,a=i==="2d"?Xt:Dt,l=null,s=null;const u=new WeakMap,f=new WeakMap,c=new WeakMap,p=new WeakMap;let h=!1,d=t.initialData;const m=(y,k)=>{if(y.nodes.length===0||k.nodes.length===0)return!1;const C=new Set;for(const B of y.nodes)C.add(B.id);let $=0;for(const B of k.nodes)C.has(B.id)&&$++;return $*2>=y.nodes.length},v=()=>{const y=r.graphData();for(const k of y.nodes){const C=k;C.fx===void 0&&typeof C.x=="number"&&(C.fx=C.x,u.set(k,C.x)),C.fy===void 0&&typeof C.y=="number"&&(C.fy=C.y,f.set(k,C.y)),C.fz===void 0&&typeof C.z=="number"&&(C.fz=C.z,c.set(k,C.z))}},g=()=>{h=!1,o.delete(g);const y=r.graphData();for(const k of y.nodes){const C=k,$=u.get(k);$!==void 0&&C.fx===$&&delete C.fx,u.delete(k);const B=f.get(k);B!==void 0&&C.fy===B&&delete C.fy,f.delete(k);const X=c.get(k);X!==void 0&&i==="3d"&&C.fz===X&&delete C.fz,c.delete(k)}},S=()=>{h||(h=!0,o.add(g))},_=y=>{const k=r.controls?.();if(!k)return;const C=k;y==="2d"?(C.noRotate=!0,C.enableRotate=!1,C.zoomToCursor=!0,C.screenSpacePanning=!0,C.zoomSpeed=1.6,C.panSpeed=1.2,C.mouseButtons&&(C.mouseButtons.LEFT=re.MOUSE.PAN)):(C.noRotate=!1,C.enableRotate=!0,C.zoomToCursor=!1,C.screenSpacePanning=!0,C.zoomSpeed=1,C.panSpeed=1,C.mouseButtons&&(C.mouseButtons.LEFT=re.MOUSE.ROTATE))},x=()=>{const y=r.graphData();for(const k of y.nodes)k.fz=0},w=()=>{const y=r.graphData();for(const k of y.nodes)delete k.fz},b=()=>{const y=r.graphData(),k=new Map;let C=0;for(const B of y.nodes){const X=B.x??0,L=B.y??0,D=Math.hypot(X,L);D>C&&(C=D)}const $=Math.max(40,C*.6);for(const B of y.nodes){const X=p.get(B);typeof X=="number"&&Number.isFinite(X)?k.set(B,X):k.set(B,(Math.random()-.5)*2*$)}return k};i==="2d"?(x(),_("2d"),r.cameraPosition?.({x:0,y:0,z:Xt},{x:0,y:0,z:0},0)):(_("3d"),r.cameraPosition?.({x:0,y:0,z:Dt},{x:0,y:0,z:0},0));const M=()=>r.cameraPosition?.(),P=()=>{const k=r.controls?.()?.target;return k?{x:k.x,y:k.y,z:k.z}:null},N=()=>{const y=r.getGraphBbox?.();if(!y)return null;const k=(y.x[0]+y.x[1])/2,C=(y.y[0]+y.y[1])/2,$=(y.z[0]+y.z[1])/2;return!Number.isFinite(k)||!Number.isFinite(C)||!Number.isFinite($)?null:{x:k,y:C,z:$}},j=60,F=y=>{const k=r.camera?.()??{},C=k.fov??50,$=r.width?.()??t.width,B=r.height?.()??t.height;if($<=0||B<=0)return null;const X=Math.max(1,$-2*y),L=Math.max(1,B-2*y),D=k.aspect??$/B,q=C*Math.PI/180/2,Y=Math.tan(q),E=Math.sin(q),H=Math.sin(Math.atan(Y*D));return{fov:C,aspect:D,w:$,h:B,effW:X,effH:L,halfFovV:q,tanHalfV:Y,sinHalfV:E,sinHalfH:H}},I=(y,k,C)=>{const $=r.getGraphBbox?.();if(!$)return null;const B=C??F(y);if(!B)return null;const X=($.x[0]+$.x[1])/2,L=($.y[0]+$.y[1])/2,D=($.z[0]+$.z[1])/2,q=Math.max(($.x[1]-$.x[0])/2,1),Y=Math.max(($.y[1]-$.y[0])/2,1),E=Math.max(($.z[1]-$.z[0])/2,0),H=M();if(!H)return null;k.endLookAt.x=X,k.endLookAt.y=L,k.endLookAt.z=D;let T;if(i==="2d"){const W=Y*B.h/B.effH/B.tanHalfV,V=q*B.h/B.effW/B.tanHalfV;T=W>V?W:V,T<j&&(T=j),k.endPos.x=X,k.endPos.y=L,k.endPos.z=D+T}else{const W=Math.sqrt(q*q+Y*Y+E*E),V=W*B.h/(B.effH*B.sinHalfV),G=W*B.w/(B.effW*B.sinHalfH);T=V>G?V:G,T<j&&(T=j);const U=H.lookAt??vn,ee=H.x-U.x,ne=H.y-U.y,ie=H.z-U.z,le=Math.sqrt(ee*ee+ne*ne+ie*ie),ae=le===0?0:ee/le,ce=le===0?0:ne/le,be=le===0?1:ie/le;k.endPos.x=X+ae*T,k.endPos.y=L+ce*T,k.endPos.z=D+be*T}return k.dist=T,a=T,k},K={get mode(){return i},setGraphData(y){if(y===d)return;const k=r.graphData();d=y;const C=m(k,y);C&&v(),r.graphData(y),i==="2d"&&x(),C&&S()},getGraphData(){return r.graphData()},fit(y,k){s?.();const C=y??400,B=I(k??40,{endPos:{x:0,y:0,z:0},endLookAt:{x:0,y:0,z:0},dist:0});if(!B)return;const X=M();if(!X)return;if(C<=0){r.cameraPosition?.(B.endPos,B.endLookAt,0);return}const L=X.lookAt??vn,D=B.endPos,q=B.endLookAt;s=pt(C,Y=>{r.cameraPosition?.({x:Q(X.x,D.x,Y),y:Q(X.y,D.y,Y),z:Q(X.z,D.z,Y)},{x:Q(L.x,q.x,Y),y:Q(L.y,q.y,Y),z:Q(L.z,q.z,Y)},0)})},centerAt(y,k,C,$){if(i==="2d"){r.cameraPosition?.({x:y,y:k,z:Xt},{x:y,y:k,z:0},$??0);return}const B=M();r.cameraPosition?.({x:y,y:k,z:C??a},B?.lookAt,$??0)},zoom(y,k){const C=M();if(!C)return;const $=Math.hypot(C.x,C.y,C.z);a=$/Math.max(y,.001);const B=$===0?{x:0,y:0,z:1}:{x:C.x/$,y:C.y/$,z:C.z/$};r.cameraPosition?.({x:B.x*a,y:B.y*a,z:B.z*a},C.lookAt,k??0)},getZoom(){const y=M();if(!y)return 1;const k=Math.hypot(y.x,y.y,y.z);return k===0?1:a/k},screen2Graph(y,k,C){return r.screen2GraphCoords?.(y,k,C??0)??{x:y,y:k,z:0}},graph2Screen(y,k,C){return r.graph2ScreenCoords?.(y,k,C??0)??{x:y,y:k,z:C??0}},getGraphBbox(){return r.getGraphBbox?.()??{x:[0,0],y:[0,0],z:[0,0]}},pause(){r.pauseAnimation?.()},resume(){r.resumeAnimation?.()},reheat(){r.d3ReheatSimulation?.()},resize(y,k){r.width(y),r.height(k)},d3Force(y,k){const C=r.d3Force;if(typeof C=="function")return k===void 0?C.call(r,y):C.call(r,y,k)},emitParticle(y){r.emitParticle?.(y)},stopAnimation(){s?.(),s=null},focusOn(y,k){s?.();const C=M();if(!C)return;const $=y.z??0,B=k?.durationMs??1e3;if(i==="2d"){const V=k?.zoom!==void 0?a/Math.max(k.zoom,.001):Xt;s=pt(B,G=>{const U=Q(C.x,y.x,G),ee=Q(C.y,y.y,G),ne=Q(C.z,V,G);r.cameraPosition?.({x:U,y:ee,z:ne},{x:U,y:ee,z:0},0)});return}const X=C.x-y.x,L=C.y-y.y,D=C.z-$,q=Math.hypot(X,L,D),Y=k?.distance??120,E=q===0?{x:0,y:0,z:1}:{x:X/q,y:L/q,z:D/q},H={x:y.x+E.x*Y,y:y.y+E.y*Y,z:$+E.z*Y},T={x:y.x,y:y.y,z:$},W=C.lookAt??{x:0,y:0,z:0};s=pt(B,V=>{r.cameraPosition?.({x:Q(C.x,H.x,V),y:Q(C.y,H.y,V),z:Q(C.z,H.z,V)},{x:Q(W.x,T.x,V),y:Q(W.y,T.y,V),z:Q(W.z,T.z,V)},0)})},panBy(y,k){const C=y.x??0,$=y.y??0,B=i==="2d"?0:y.z??0;if(C===0&&$===0&&B===0)return;s?.();const X=M();if(!X)return;const L=X.lookAt??{x:0,y:0,z:0},D=k??0,q={x:X.x+C,y:X.y+$,z:X.z+B},Y={x:L.x+C,y:L.y+$,z:L.z+B};if(D<=0){r.cameraPosition?.(q,Y,0);return}s=pt(D,E=>{r.cameraPosition?.({x:Q(X.x,q.x,E),y:Q(X.y,q.y,E),z:Q(X.z,q.z,E)},{x:Q(L.x,Y.x,E),y:Q(L.y,Y.y,E),z:Q(L.z,Y.z,E)},0)})},goTo(y,k){s?.();const C=M();if(!C)return;const $=y.z??0,B=k?.durationMs??600,X=C.lookAt??{x:0,y:0,z:0},L=y.x-X.x,D=y.y-X.y,q=i==="2d"?0:$-X.z,Y={x:C.x+L,y:C.y+D,z:C.z+q},E={x:y.x,y:y.y,z:i==="2d"?0:$};if(B<=0){r.cameraPosition?.(Y,E,0);return}s=pt(B,H=>{r.cameraPosition?.({x:Q(C.x,Y.x,H),y:Q(C.y,Y.y,H),z:Q(C.z,Y.z,H)},{x:Q(X.x,E.x,H),y:Q(X.y,E.y,H),z:Q(X.z,E.z,H)},0)})},fitToNodes(y,k,C){const $=y;if($.length===0){K.fit(k,C);return}const B=new Set($),X=r.graphData();let L=1/0,D=-1/0,q=1/0,Y=-1/0,E=1/0,H=-1/0,T=0;for(const Ce of X.nodes){if(!B.has(Ce.id))continue;const Ie=Ce,Le=Ie.x??0,ve=Ie.y??0,Qe=Ie.z??0;Le<L&&(L=Le),Le>D&&(D=Le),ve<q&&(q=ve),ve>Y&&(Y=ve),Qe<E&&(E=Qe),Qe>H&&(H=Qe),T++}if(T===0){K.fit(k,C);return}const W=k??400,V=C??40,G=r.camera?.()??{},U=G.fov??50,ee=r.width?.()??t.width,ne=r.height?.()??t.height;if(ee<=0||ne<=0)return;const ie=Math.max(1,ee-2*V),le=Math.max(1,ne-2*V),ae=G.aspect??ee/ne,ce={x:(L+D)/2,y:(q+Y)/2,z:(E+H)/2},be=Math.max((D-L)/2,1),We=Math.max((Y-q)/2,1),Pe=Math.max((H-E)/2,0),Ye=U*Math.PI/180/2,Xe=Math.tan(Ye),ot=60,Ae=M();if(!Ae)return;let _e;const Se={x:ce.x,y:ce.y,z:ce.z};if(i==="2d"){const Ce=We*ne/le/Xe,Ie=be*ne/ie/Xe,Le=Math.max(Ce,Ie,ot);_e={x:ce.x,y:ce.y,z:ce.z+Le},a=Le}else{const Ce=Math.hypot(be,We,Pe),Ie=Math.atan(Xe*ae),Le=Ce*ne/(le*Math.sin(Ye)),ve=Ce*ee/(ie*Math.sin(Ie)),Qe=Math.max(Le,ve,ot),it=Ae.lookAt??{x:0,y:0,z:0},se=Ae.x-it.x,ye=Ae.y-it.y,qe=Ae.z-it.z,Ct=Math.hypot(se,ye,qe),Tt=Ct===0?{x:0,y:0,z:1}:{x:se/Ct,y:ye/Ct,z:qe/Ct};_e={x:ce.x+Tt.x*Qe,y:ce.y+Tt.y*Qe,z:ce.z+Tt.z*Qe},a=Qe}if(s?.(),W<=0){r.cameraPosition?.(_e,Se,0);return}const He=Ae.lookAt??{x:0,y:0,z:0};s=pt(W,Ce=>{r.cameraPosition?.({x:Q(Ae.x,_e.x,Ce),y:Q(Ae.y,_e.y,Ce),z:Q(Ae.z,_e.z,Ce)},{x:Q(He.x,Se.x,Ce),y:Q(He.y,Se.y,Ce),z:Q(He.z,Se.z,Ce)},0)})},getCameraState(){const y=M()??{x:0,y:0,z:Dt};if(i==="2d"){const k=y.lookAt??{x:0,y:0},C=a/Math.max(Math.hypot(y.x,y.y,y.z),1);return{mode:"2d",x:k.x,y:k.y,k:C}}return{mode:"3d",x:y.x,y:y.y,z:y.z,lookAt:y.lookAt??{x:0,y:0,z:0}}},setCameraState(y,k){s?.();const C=k??0,$=M()??{x:0,y:0,z:Dt};if(y.mode==="2d"){const X=O(y.k)??Xt;if(C<=0){r.cameraPosition?.({x:y.x,y:y.y,z:X},{x:y.x,y:y.y,z:0},0);return}const L=$.lookAt??{x:0,y:0};s=pt(C,D=>{const q=Q($.x,y.x,D),Y=Q($.y,y.y,D),E=Q($.z,X,D);r.cameraPosition?.({x:q,y:Y,z:E},{x:Q(L.x,y.x,D),y:Q(L.y,y.y,D),z:0},0)});return}if(C<=0){r.cameraPosition?.({x:y.x,y:y.y,z:y.z},y.lookAt,0);return}const B=$.lookAt??y.lookAt;s=pt(C,X=>{r.cameraPosition?.({x:Q($.x,y.x,X),y:Q($.y,y.y,X),z:Q($.z,y.z,X)},{x:Q(B.x,y.lookAt.x,X),y:Q(B.y,y.lookAt.y,X),z:Q(B.z,y.lookAt.z,X)},0)})},applyProps(y,k){oa(r,y,k,"3d")},getCanvasElement(){return e.querySelector("canvas")},destroy(){s?.(),s=null,r._destructor()},setMode(y,k=800){if(y===i)return;i=y,s?.();const C=M()??{x:0,y:0,z:Dt};if(y==="2d"){const T=P()??C.lookAt??vn,V=N()??{x:T.x,y:T.y};l={x:C.x,y:C.y,z:C.z,lookAt:{x:T.x,y:T.y,z:T.z}};const G=r.graphData(),U=new Map;for(const ae of G.nodes){const ce=ae.z,be=typeof ce=="number"?ce:0;U.set(ae,be),p.set(ae,be)}const ee={x:T.x,y:T.y,z:T.z},ne={x:V.x,y:V.y,z:0},ie=Math.hypot(C.x-T.x,C.y-T.y,C.z-T.z)||Xt,le={x:V.x,y:V.y,z:ie};s=pt(k,ae=>{for(const[ce,be]of U)ce.z=Q(be,0,ae);r.cameraPosition?.({x:Q(C.x,le.x,ae),y:Q(C.y,le.y,ae),z:Q(C.z,le.z,ae)},{x:Q(ee.x,ne.x,ae),y:Q(ee.y,ne.y,ae),z:Q(ee.z,ne.z,ae)},0),ae>=1&&(x(),_("2d"),a=ie)},void 0,ra);return}w(),_("3d");const $=b(),B=new Map;for(const[T]of $){const W=T.z;B.set(T,typeof W=="number"?W:0)}const X=P()??C.lookAt??vn,L={x:X.x,y:X.y,z:0},D=N(),q=D?{x:D.x,y:D.y,z:0}:{...L},Y=Math.abs(C.z)||Dt,E=Math.PI/6;let H;if(l){const T=l.lookAt??vn;H={x:q.x+(l.x-T.x),y:q.y+(l.y-T.y),z:q.z+(l.z-T.z)}}else H={x:q.x,y:q.y-Y*Math.sin(E),z:q.z+Y*Math.cos(E)};s=pt(k,T=>{for(const[W,V]of $){const G=B.get(W)??0;W.z=Q(G,V,T)}r.cameraPosition?.({x:Q(C.x,H.x,T),y:Q(C.y,H.y,T),z:Q(C.z,H.z,T)},{x:Q(L.x,q.x,T),y:Q(L.y,q.y,T),z:Q(L.z,q.z,T)},0),T>=1&&(r.d3ReheatSimulation?.(),a=Math.hypot(H.x-q.x,H.y-q.y,H.z-q.z))},void 0,ra)},introFollow(y){const k=y?.padding??40,C=y?.maxDurationMs??4e3,B=r.graphData().nodes?.length??0;if(B===0)return;const X=y?.tauSeconds??.18+.09*Math.log10(Math.max(1,B)),L=B<200?2:B<2e3?4:6;s?.();const D=r.cameraPosition,q=D?D.bind(r):null,Y={endPos:{x:0,y:0,z:0},endLookAt:{x:0,y:0,z:0},dist:0},E={x:0,y:0,z:0},H={x:0,y:0,z:0};let T=F(k);const W=I(k,Y,T);W&&q&&q(W.endPos,W.endLookAt,0);let V=W?.endPos.x??0,G=W?.endPos.y??0,U=W?.endPos.z??Dt,ee=W?.endLookAt.x??0,ne=W?.endLookAt.y??0,ie=W?.endLookAt.z??0,le=0,ae=0,ce=W!==null,be=!1;const Pe=r.renderer?.()?.domElement,Ye=()=>{be=!0};Pe?.addEventListener("pointerdown",Ye,{passive:!0}),Pe?.addEventListener("wheel",Ye,{passive:!0});const Xe=()=>{o.delete(Ae),Pe?.removeEventListener("pointerdown",Ye),Pe?.removeEventListener("wheel",Ye)},ot=()=>{!ce||!q||q(Y.endPos,Y.endLookAt,0)},Ae=()=>{if(ce){const _e=Y.endPos,Se=V-_e.x,He=G-_e.y,Ce=U-_e.z,Ie=Se*Se+He*He+Ce*Ce,Le=Math.max(.5,a*.001);Ie>Le*Le&&ot()}Xe(),s=null};o.add(Ae),s=$g(_e=>{if(be)return Xe(),s=null,!0;if(le+=_e*1e3,le>=C)return ot(),Xe(),s=null,!0;if(!(ae&31)){const Ie=F(k);Ie&&(T=Ie)}if(ae%L===0&&I(k,Y,T)&&(ce=!0),ae++,!ce||!q)return!1;const Se=1-Math.exp(-_e/X),He=Y.endPos,Ce=Y.endLookAt;V+=(He.x-V)*Se,G+=(He.y-G)*Se,U+=(He.z-U)*Se,ee+=(Ce.x-ee)*Se,ne+=(Ce.y-ne)*Se,ie+=(Ce.z-ie)*Se,E.x=V,E.y=G,E.z=U,H.x=ee,H.y=ne,H.z=ie,q(E,H,0)})}};return K;function O(y){return!Number.isFinite(y)||y===0?null:a/y}}function Vg(e){const{mount:t,mode:n,width:r,height:o,data:i,props:a,paused:l,modeTransitionMs:s=800}=e,[u,f]=A.useState(null),c=A.useRef(a);c.current=a;const p=A.useRef(a),h=A.useRef(null),d=A.useRef(n);return A.useEffect(()=>{if(!t)return;const m=Gg(t,{initialProps:a,initialData:i,width:r,height:o,initialMode:d.current},c);return p.current=a,h.current=i,f(m),()=>{m.destroy(),f(null),h.current=null}},[t]),A.useEffect(()=>{u&&u.mode!==n&&u.setMode(n,s)},[u,n,s]),A.useEffect(()=>{u&&(l?u.pause():u.resume())},[u,l]),A.useEffect(()=>{u&&u.resize(r,o)},[u,r,o]),A.useEffect(()=>{u&&h.current!==i&&(u.setGraphData(i),h.current=i)},[u,i]),A.useEffect(()=>{u&&(u.applyProps(a,p.current),p.current=a)},[u,a]),u}function Wg(e){const[t,n]=A.useState(null);return A.useEffect(()=>{const r=e.current;if(!r)return;const o=new ResizeObserver(i=>{const a=i[0];if(!a)return;const l=a.contentRect;n({width:l.width,height:l.height})});return o.observe(r),()=>o.disconnect()},[e]),t}const Fs=new Set,Bs=Object.freeze([]);function Dr(e){const t=new Set(e);return t.size===0?{set:Fs,arr:Bs}:{set:t,arr:Object.freeze([...t])}}const Ir={set:Fs,arr:Bs};function Yg(e){const t=e.mode??"single",[n,r]=A.useState(Ir),o=A.useRef(e.onChange);o.current=e.onChange;const i=A.useRef(!0);A.useEffect(()=>{if(i.current){i.current=!1;return}o.current?.([...n.arr])},[n]);const a=A.useCallback((c,p)=>{t!=="none"&&r(h=>{const d=h.set.has(c);if(t==="single"||!p?.additive)return d&&h.set.size===1?Ir:Dr([c]);const m=new Set(h.set);return d?m.delete(c):m.add(c),Dr(m)})},[t]),l=A.useCallback(c=>{t!=="none"&&r(()=>{const p=t==="single"?(()=>{for(const h of c)return[h];return[]})():c;return Dr(p)})},[t]),s=A.useCallback(()=>r(Ir),[]),u=A.useRef(n);u.current=n;const f=A.useCallback(c=>u.current.set.has(c),[]);return A.useMemo(()=>({selected:n.arr,selectedSet:n.set,toggle:a,set:l,clear:s,isSelected:f}),[n,a,l,s,f])}function Xg(){const[e,t]=A.useState(!1);return A.useEffect(()=>{const n=i=>{i.key==="Shift"&&t(!0)},r=i=>{i.key==="Shift"&&t(!1)},o=()=>t(!1);return window.addEventListener("keydown",n),window.addEventListener("keyup",r),window.addEventListener("blur",o),()=>{window.removeEventListener("keydown",n),window.removeEventListener("keyup",r),window.removeEventListener("blur",o)}},[]),e}function Kg(e,t){const n=A.useRef(!1);A.useEffect(()=>{if(!e)return;!n.current&&t.nodes.length>0&&Object.isFrozen(t.nodes[0])&&(n.current=!0,console.warn("[lora-graph-canvas] autoIndexNeighbors is enabled but node objects appear to be frozen. The hover-highlight index needs to mutate nodes to attach `_neighbors`/`_links`. Either pass `autoIndexNeighbors={false}` (and `highlightNeighborsOnHover={false}`) or supply mutable node objects."));const r=new Map;for(const o of t.nodes)r.set(o.id,o),o._neighbors=[],o._links=[];for(const o of t.links){const i=typeof o.source=="object"?o.source.id:o.source,a=typeof o.target=="object"?o.target.id:o.target,l=r.get(i),s=r.get(a);!l||!s||(l._neighbors.push(s),s._neighbors.push(l),l._links.push(o),s._links.push(o))}},[e,t])}function Zg(e){const{mount:t,engineRef:n,selection:r,nodes:o,links:i,setSelectedLinkIds:a,liveHoverNodeIdRef:l}=e,s=A.useRef({selection:r,nodes:o,links:i,setSelectedLinkIds:a,liveHoverNodeIdRef:l});s.current.selection=r,s.current.nodes=o,s.current.links=i,s.current.setSelectedLinkIds=a,s.current.liveHoverNodeIdRef=l;const[u,f]=A.useState(null),c=A.useRef(null),p=A.useRef({x:0,y:0}).current;return A.useEffect(()=>{if(!t)return;let h=t.getBoundingClientRect();const d=()=>{h=t.getBoundingClientRect()},m=new ResizeObserver(d);m.observe(t),window.addEventListener("scroll",d,{passive:!0,capture:!0});const v=x=>{p.x=x.clientX-h.left,p.y=x.clientY-h.top,c.current=p};t.addEventListener("mousemove",v);const g=x=>{if(n.current?.stopAnimation(),x.button!==0||!x.shiftKey||s.current.liveHoverNodeIdRef.current!==null)return;const w=x.clientX-h.left,b=x.clientY-h.top;x.stopPropagation(),x.preventDefault(),f({x0:w,y0:b,x1:w,y1:b,additive:x.shiftKey});let M=null;const P=()=>{M===null&&(M=requestAnimationFrame(()=>{M=null;const F=n.current;F&&f(I=>{if(!I)return I;const K=Math.min(I.x0,I.x1),O=Math.min(I.y0,I.y1),y=Math.max(I.x0,I.x1),k=Math.max(I.y0,I.y1);if(y-K<4&&k-O<4){if(I.count===void 0)return I;const{count:$,...B}=I;return B}let C=0;for(const $ of s.current.nodes){if($.x===void 0||$.y===void 0)continue;const B=F.graph2Screen($.x,$.y,$.z);B.x>=K&&B.x<=y&&B.y>=O&&B.y<=k&&C++}return I.count===C?I:{...I,count:C}})}))},N=F=>{const I=F.clientX-h.left,K=F.clientY-h.top;f(O=>O&&{...O,x1:I,y1:K}),P()},j=F=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",j,!0),M!==null&&(cancelAnimationFrame(M),M=null);const I=F.clientX-h.left,K=F.clientY-h.top;f(null);const O=n.current;if(!O)return;const y=Math.min(w,I),k=Math.min(b,K),C=Math.max(w,I),$=Math.max(b,K);if(C-y<3&&$-k<3)return;const B=s.current,X=B.nodes,L=B.links,D=B.selection,q=B.setSelectedLinkIds,Y=[],E=(G,U)=>G>=y&&G<=C&&U>=k&&U<=$,H=new Map;for(const G of X){if(H.set(G.id,G),G.x===void 0||G.y===void 0)continue;const U=O.graph2Screen(G.x,G.y,G.z);E(U.x,U.y)&&Y.push(G.id)}const T=[],W=G=>{if(G&&typeof G=="object"){const U=G;if(U.x!==void 0&&U.y!==void 0)return U.z!==void 0?{x:U.x,y:U.y,z:U.z}:{x:U.x,y:U.y}}if(typeof G=="string"||typeof G=="number"){const U=H.get(G);if(U&&U.x!==void 0&&U.y!==void 0)return U.z!==void 0?{x:U.x,y:U.y,z:U.z}:{x:U.x,y:U.y}}return null};for(const G of L){if(G.id===void 0)continue;const U=W(G.source),ee=W(G.target);if(!U||!ee)continue;const ne=O.graph2Screen((U.x+ee.x)/2,(U.y+ee.y)/2,U.z!==void 0&&ee.z!==void 0?(U.z+ee.z)/2:void 0),ie=O.graph2Screen(U.x,U.y,U.z),le=O.graph2Screen(ee.x,ee.y,ee.z);(E(ne.x,ne.y)||E(ie.x,ie.y)&&E(le.x,le.y))&&T.push(G.id)}if(F.shiftKey||F.metaKey||F.ctrlKey){const G=D.selected,U=G.slice(),ee=new Set(G);for(const ne of Y)ee.has(ne)||(ee.add(ne),U.push(ne));D.set(U),q(ne=>{const ie=ne.slice(),le=new Set(ne);for(const ae of T)le.has(ae)||(le.add(ae),ie.push(ae));return ie})}else D.set(Y),q(T)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",j,!0)};t.addEventListener("mousedown",g,!0);const S=()=>n.current?.stopAnimation(),_=()=>n.current?.stopAnimation();return t.addEventListener("wheel",S,{passive:!0,capture:!0}),t.addEventListener("touchstart",_,{passive:!0,capture:!0}),()=>{t.removeEventListener("mousemove",v),t.removeEventListener("mousedown",g,!0),t.removeEventListener("wheel",S,{capture:!0}),t.removeEventListener("touchstart",_,{capture:!0}),window.removeEventListener("scroll",d,{capture:!0}),m.disconnect()}},[t,n]),{marquee:u,lastCursorRef:c}}const Qg=60;function Jg(e,t={}){const n=typeof t=="number"?{tolerancePx:t}:t,r=n.tolerancePx??12,o=n.pressGraceMs??Qg;A.useEffect(()=>{if(!e)return;const i=r*r;let a=!1,l=!1,s=0,u=0,f=0;const c=d=>{e.contains(d.target)&&(a=!0,l=!1,s=d.clientX,u=d.clientY,f=performance.now())},p=d=>{if(!a||l)return;if(performance.now()-f<o){d.stopPropagation();return}const m=d.clientX-s,v=d.clientY-u;m*m+v*v<i?d.stopPropagation():l=!0},h=()=>{a=!1,l=!1};return window.addEventListener("pointerdown",c,!0),window.addEventListener("pointermove",p,!0),window.addEventListener("mousemove",p,!0),window.addEventListener("pointerup",h,!0),window.addEventListener("pointercancel",h,!0),window.addEventListener("mouseup",h,!0),()=>{window.removeEventListener("pointerdown",c,!0),window.removeEventListener("pointermove",p,!0),window.removeEventListener("mousemove",p,!0),window.removeEventListener("pointerup",h,!0),window.removeEventListener("pointercancel",h,!0),window.removeEventListener("mouseup",h,!0)}},[e,r,o])}function ev(e){const{enableClipboard:t,dataApi:n,deleteGate:r,selection:o,setSelectedLinkIds:i,engineRef:a,lastCursorRef:l,onCopy:s,onCut:u,onPaste:f}=e,c=A.useRef([]),p=A.useCallback(()=>{const x=new Set(o.selected),w=[];for(const b of n.data.nodes){if(!x.has(b.id))continue;const{id:M,x:P,y:N,z:j,vx:F,vy:I,vz:K,fx:O,fy:y,fz:k,...C}=b;w.push(C)}return w},[n.data.nodes,o.selected]),h=A.useCallback(()=>{if(!t)return[];const x=new Set(o.selected),w=n.data.nodes.filter(b=>x.has(b.id));return c.current=p(),s?.(w),w},[t,n.data.nodes,o.selected,p,s]),d=A.useCallback(async()=>{if(!t)return[];const x=new Set(o.selected),w=n.data.nodes.filter(M=>x.has(M.id));return w.length===0?[]:await r.requestNodeDelete(o.selected,"cut")?(c.current=p(),u?.(w),w):[]},[t,n,r,o,p,u]),m=A.useCallback(x=>{if(!t)return[];const w=c.current;if(w.length===0)return[];const b=x||(()=>{const P=l.current;if(!(!P||!a.current))return a.current.screen2Graph(P.x,P.y)})(),M=n.addNodes(w.map((P,N)=>{const j=N%3*24,F=Math.floor(N/3)*24;return{...P,...b?{x:b.x+j,y:b.y+F,...b.z!==void 0?{z:b.z+F}:{}}:{}}}));return o.set(M.map(P=>P.id)),i([]),f?.(M),M},[t,n,o,i,f,a,l]),v=A.useCallback(()=>{const x=new Set(o.selected),w=[];let b=0;for(const P of n.data.nodes){if(!x.has(P.id))continue;const{id:N,vx:j,vy:F,vz:I,fx:K,fy:O,fz:y,...k}=P,C=b%3*24,$=Math.floor(b/3)*24;w.push({...k,...P.x!==void 0?{x:P.x+C}:{},...P.y!==void 0?{y:P.y+$}:{},...P.z!==void 0?{z:P.z}:{}}),b++}if(w.length===0)return[];const M=n.addNodes(w);return o.set(M.map(P=>P.id)),i([]),M},[n,o,i]),g=A.useCallback(x=>{const w=o.selected;if(w.length===0)return null;const b=n.data.nodes.filter(j=>w.includes(j.id));if(b.length===0)return null;let M=x?.at;if(!M){let j=0,F=0,I=0,K=!1;for(const O of b)j+=O.x??0,F+=O.y??0,I+=O.z??0,(O.x!==void 0||O.y!==void 0)&&(K=!0);K&&(M={x:j/b.length+30,y:F/b.length+30,z:I/b.length})}const P=x?.label!==void 0?{label:x.label}:{},N=n.addNode(P,M?{at:M}:void 0);for(const j of b)n.addLink({source:j.id,target:N.id});return o.set([N.id]),i([]),N},[n,o,i]),S=A.useCallback(x=>{const w=n.data.nodes.find(b=>b.id===x);w&&(w.fx!==void 0?n.updateNode(x,{fx:void 0,fy:void 0,fz:void 0}):n.updateNode(x,{fx:w.x,fy:w.y,...w.z!==void 0?{fz:w.z}:{}}))},[n]),_=A.useCallback(()=>c.current.length>0,[]);return A.useMemo(()=>({hasClipboard:_,copy:h,cut:d,paste:m,duplicate:v,addConnectedNode:g,togglePin:S}),[_,h,d,m,v,g,S])}async function ia(e,t,n){if(t.length===0||!e)return!0;try{return await e(t,{source:n})}catch{return!1}}function tv(e){const{dataApi:t,beforeNode:n,beforeLink:r,onNodeDeleted:o,onLinkDeleted:i,afterNodeDelete:a,afterLinkDelete:l}=e,s=A.useCallback((c,p)=>{if(c.length===0)return Promise.resolve(!1);const h=new Set(c),d=t.data.nodes.filter(v=>h.has(v.id));if(d.length===0)return Promise.resolve(!1);const m=()=>(t.removeNodes(c),o?.(d,{source:p}),a?.(c),!0);return n?Promise.resolve(ia(n,d,p)).then(v=>v?m():!1):Promise.resolve(m())},[t,n,o,a]),u=A.useCallback((c,p)=>{const h=typeof c=="function"?c:(()=>{const v=new Set(c);return g=>g.id!==void 0&&v.has(g.id)})(),d=t.data.links.filter(h);if(d.length===0)return Promise.resolve(!1);const m=()=>{t.removeLink(h),i?.(d,{source:p});const v=d.map(g=>g.id).filter(g=>g!==void 0);return l?.(v),!0};return r?Promise.resolve(ia(r,d,p)).then(v=>v?m():!1):Promise.resolve(m())},[t,r,i,l]),f=A.useCallback(async(c,p,h)=>{const[d,m]=await Promise.all([c.length>0?s(c,h):Promise.resolve(!1),p.length>0?u(p,h):Promise.resolve(!1)]);return d||m},[s,u]);return A.useMemo(()=>({requestNodeDelete:s,requestLinkDelete:u,requestMixedDelete:f}),[s,u,f])}const aa=40;function nv(e){const t=A.useRef(e);t.current=e,A.useEffect(()=>{let n=-1;const r=o=>{const i=t.current,a=i.hostRef.current,l=document.activeElement;if(a&&l&&l!==document.body&&!a.contains(l))return;const s=o.target;if(!(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.isContentEditable)))switch(o.key){case"v":case"V":i.enableClipboard&&(o.metaKey||o.ctrlKey)?(i.paste(),o.preventDefault()):i.setActiveTool("select");break;case"h":case"H":i.setActiveTool("pan");break;case"n":case"N":i.setActiveTool("add-node");break;case"l":case"L":i.setActiveTool("add-link");break;case"f":case"F":case"0":if(o.shiftKey&&(o.key==="f"||o.key==="F")){[...i.selection.selected,...i.selectedLinkIds];const f=new Set(i.selection.selected);if(i.selectedLinkIds.length>0){const c=new Set(i.selectedLinkIds);for(const p of i.dataApi.data.links){const h=p.id;if(h===void 0||!c.has(h))continue;const d=typeof p.source=="object"?p.source.id:p.source,m=typeof p.target=="object"?p.target.id:p.target;d!==void 0&&f.add(d),m!==void 0&&f.add(m)}}f.size>0&&i.engine?.fitToNodes?i.engine.fitToNodes([...f],400,60):i.engine?.fit(400,40),o.preventDefault();break}i.engine?.fit(400,40),o.preventDefault();break;case"+":case"=":i.engine&&(i.engine.zoom((i.engine.getZoom?.()??1)*1.2,200),o.preventDefault());break;case"-":i.engine&&(i.engine.zoom((i.engine.getZoom?.()??1)/1.2,200),o.preventDefault());break;case"3":i.setMode(i.mode==="2d"?"3d":"2d");break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":{const f=i.engine;if(!f)return;const c=f.getZoom?.()??1,p=aa/Math.max(c,.1);let h=0,d=0,m=0;if(o.key==="ArrowLeft"?h=-p:o.key==="ArrowRight"?h=p:o.key==="ArrowUp"?d=-p:d=p,o.shiftKey&&(o.key==="ArrowUp"||o.key==="ArrowDown")&&i.mode==="3d"&&(m=o.key==="ArrowUp"?p:-p,d=0),f.panBy)f.panBy({x:h,y:d,z:m},120);else{const v=f.getGraphBbox(),g=(v.x[0]+v.x[1])/2,S=(v.y[0]+v.y[1])/2;f.centerAt(g+h,S+d,void 0,120)}o.preventDefault();break}case"PageUp":case"PageDown":case"q":case"Q":case"e":case"E":{const f=i.engine;if(!f)break;if(i.mode!=="3d"){if(o.key==="PageUp"||o.key==="PageDown")break;break}const c=f.getZoom?.()??1,p=aa/Math.max(c,.1),h=o.key==="PageUp"||o.key==="q"||o.key==="Q";f.panBy&&f.panBy({z:h?p:-p},120),o.preventDefault();break}case"Tab":{const f=i.engine,c=i.dataApi.data.nodes;if(!f||c.length===0)return;n=o.shiftKey?(n-1+c.length)%c.length:(n+1)%c.length;const p=c[n];if(!p||p.x===void 0||p.y===void 0)return;i.selection.set([p.id]),f.focusOn({x:p.x,y:p.y,...p.z!==void 0?{z:p.z}:{}},{distance:120,zoom:4,durationMs:400}),o.preventDefault();break}case"Backspace":case"Delete":(i.selection.selected.length>0||i.selectedLinkIds.length>0)&&(i.deleteGate.requestMixedDelete(i.selection.selected,i.selectedLinkIds,"keyboard"),o.preventDefault());break;case"a":case"A":(o.metaKey||o.ctrlKey)&&(i.selection.set(i.dataApi.data.nodes.map(f=>f.id)),i.setSelectedLinkIds(i.dataApi.data.links.map(f=>f.id).filter(f=>f!==void 0)),o.preventDefault());break;case"c":case"C":i.enableClipboard&&(o.metaKey||o.ctrlKey)&&i.copy();break;case"x":case"X":i.enableClipboard&&(o.metaKey||o.ctrlKey)&&(i.cut(),o.preventDefault());break;case"d":case"D":(o.metaKey||o.ctrlKey)&&(i.duplicate(),o.preventDefault());break;case"p":case"P":for(const f of i.selection.selected)i.togglePin(f);break;case"Enter":i.selection.selected.length>0&&(i.addConnectedNode(),o.preventDefault());break;case"Escape":i.selection.clear(),i.setSelectedLinkIds([]),i.setLinkSourceId(null);break}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[])}function rv(e){const{engine:t,collideNodes:n,beeswarm:r,nodeRelSize:o}=e;A.useEffect(()=>{if(!t||r)return;if(!n){t.d3Force("collide",null);return}const i=typeof n=="number"?n:(o??4)+2;return t.d3Force("collide",fi(i)),t.reheat(),()=>{t.d3Force("collide",null)}},[t,n,o,r]),A.useEffect(()=>{if(!t)return;if(!r){t.d3Force("x",null),t.d3Force("y",null);return}const i=r===!0?{}:r,a=i.axis??"x",l=i.strength??.2,s=i.value,u=p=>{const h=String(p);let d=0;for(let m=0;m<h.length;m++)d=d*31+h.charCodeAt(m)|0;return(d%600+600)%600-300},f=p=>{const h=p;if(typeof s=="function")return s(h);if(typeof s=="string"){const d=h[s];if(typeof d=="number")return d;if(typeof d=="string")return Number(d)||0}return u(h.id)};t.d3Force("center",null),t.d3Force("charge",null),a==="x"?(t.d3Force("x",mi(f)),t.d3Force("y",bi(0).strength(l))):(t.d3Force("y",bi(f)),t.d3Force("x",mi(0).strength(l)));const c=(o??4)+2;t.d3Force("collide",fi(c)),t.reheat()},[t,r,o])}function rn(e,t){return typeof e=="function"?e(t):typeof e=="string"?t[e]:e}function sa(e,t){const n=rn(e,t);return typeof n=="string"?n:typeof HTMLElement<"u"&&n instanceof HTMLElement?n.textContent??"":n!=null?String(n):typeof t.label=="string"&&t.label.length>0?t.label:t.id!==void 0?String(t.id):""}function la(e,t){const n=rn(e,t);if(typeof n=="string")return n;if(typeof HTMLElement<"u"&&n instanceof HTMLElement)return n.textContent??"";if(n!=null)return String(n);if(typeof t.label=="string"&&t.label.length>0)return t.label;const r=t.source,o=t.target,i=typeof r=="object"&&r!==null?r.id:r,a=typeof o=="object"&&o!==null?o.id:o;return i===void 0&&a===void 0?"":`${i??""} → ${a??""}`}function yn(e,t){if(e.startsWith("#")){const o=e.slice(1),i=o.length===3?o.split("").map(a=>a+a).join(""):o;if(i.length===6){const a=parseInt(i.slice(0,2),16),l=parseInt(i.slice(2,4),16),s=parseInt(i.slice(4,6),16);return`rgba(${a}, ${l}, ${s}, ${t})`}}const n=e.match(/^rgb\(([^)]+)\)$/);if(n)return`rgba(${n[1]}, ${t})`;const r=e.match(/^rgba\(([^,]+),([^,]+),([^,]+),[^)]+\)$/);return r?`rgba(${r[1]},${r[2]},${r[3]},${t})`:e}const Kt=new Set;function ov(e){const{mode:t,accentColor:n,nodeColor:r,linkColor:o,linkWidth:i,nodeVal:a,nodeRelSize:l,nodePointerAreaPaint:s,nodeAutoColorBy:u,nodeVisibility:f,selectedNodeSet:c,selectedLinkSet:p,highlightNeighborsOnHover:h,highlightedNodeIds:d,highlightedLinkIds:m,hoverNodeId:v,hoverLinkId:g,hiddenGroups:S}=e,_=A.useRef({mode:t,accentColor:n,selectedNodeSet:c,selectedLinkSet:p,highlightNeighborsOnHover:h,highlightedNodeIds:d,highlightedLinkIds:m,hoverNodeId:v,hoverLinkId:g,hiddenGroups:S});_.current={mode:t,accentColor:n,selectedNodeSet:c,selectedLinkSet:p,highlightNeighborsOnHover:h,highlightedNodeIds:d,highlightedLinkIds:m,hoverNodeId:v,hoverLinkId:g,hiddenGroups:S};const x=c.size>0||p.size>0||h&&d.size>0,w=A.useMemo(()=>{const T=r;return W=>{const V=_.current;if(W.id!==void 0&&V.selectedNodeSet.has(W.id))return V.accentColor;if(V.highlightNeighborsOnHover&&V.highlightedNodeIds.size>0&&W.id!==void 0&&V.highlightedNodeIds.has(W.id))return V.hoverNodeId===W.id?V.accentColor:yn(V.accentColor,.7);let U;return typeof T=="function"?U=T(W):typeof T=="string"?U=T:U=W.color??"#888",(V.selectedNodeSet.size>0||V.selectedLinkSet.size>0)&&V.mode!=="3d"?yn(U,.25):U}},[r,c,p,v,d]),b=x?w:r,M=u!==void 0&&S.size>0,P=c.size>0||p.size>0||g!==null||h&&m.size>0||M,N="rgba(96, 102, 110, 0.55)",j="rgba(180, 188, 198, 0.55)",F=A.useMemo(()=>{const T=o,W=u;return V=>{const G=_.current,U=V.id,ee=typeof V.source=="object"?V.source:null,ne=typeof V.target=="object"?V.target:null;if(G.hiddenGroups.size>0&&W!==void 0){const Xe=_e=>{if(!_e)return null;const Se=typeof W=="function"?W(_e):_e[W];return Se==null?null:String(Se)},ot=Xe(ee),Ae=Xe(ne);if(ot!==null&&G.hiddenGroups.has(ot)||Ae!==null&&G.hiddenGroups.has(Ae)){let _e;return typeof T=="function"?_e=T(V):typeof T=="string"?_e=T:_e=V.color??N,yn(_e,.05)}}if(U!==void 0&&G.selectedLinkSet.has(U))return G.accentColor;const ie=ee?.id??V.source,le=ne?.id??V.target,ae=G.selectedNodeSet.size>0;if(ae&&(ie!==void 0&&G.selectedNodeSet.has(ie)||le!==void 0&&G.selectedNodeSet.has(le)))return yn(G.accentColor,.85);const be=U!==void 0&&G.hoverLinkId===U,We=G.highlightNeighborsOnHover&&U!==void 0&&G.highlightedLinkIds.has(U);if(be||We)return j;let Pe;return typeof T=="function"?Pe=T(V):typeof T=="string"?Pe=T:Pe=V.color??N,ae||G.selectedLinkSet.size>0?yn(Pe,G.mode==="3d"?.45:.18):Pe}},[o,u,p,c,g,m,S]),I=P?F:o,K=c.size>0||p.size>0||g!==null||h&&m.size>0,O=.6,y=1.5,k=.4,C=1,$=.5,B=1.2,X=A.useMemo(()=>{const T=i;return W=>{const V=_.current,G=W.id,U=G!==void 0&&V.selectedLinkSet.has(G),ee=typeof W.source=="object"?W.source.id:W.source,ne=typeof W.target=="object"?W.target.id:W.target,le=V.selectedNodeSet.size>0&&(ee!==void 0&&V.selectedNodeSet.has(ee)||ne!==void 0&&V.selectedNodeSet.has(ne)),ae=G!==void 0&&V.hoverLinkId===G,ce=V.highlightNeighborsOnHover&&G!==void 0&&V.highlightedLinkIds.has(G),be=ae||ce,We=typeof T=="function"?T(W):typeof T=="number"?T:W.width??1,Pe=V.mode==="3d";return U?We+(Pe?$:B):be?We+(Pe?O:y):le?We+(Pe?k:C):We}},[i]),L=K?X:i,D=c.size>0||h&&d.size>0,q=A.useMemo(()=>{const T=a;return W=>{const V=_.current,G=W.id,U=typeof T=="function"?T(W):typeof T=="number"?T:W.val??1;return G!==void 0&&V.selectedNodeSet.has(G)?U*2.25:V.highlightNeighborsOnHover&&V.highlightedNodeIds.size>0&&G!==void 0&&V.highlightedNodeIds.has(G)?V.hoverNodeId===G?U*1.8:U*1.4:U}},[a]),Y=D?q:a,E=A.useMemo(()=>{if(t!=="2d"||s)return s;const T=a,W=l??4;return(V,G,U,ee)=>{const ne=typeof T=="function"?T(V):typeof T=="number"?T:V.val??1,ie=Math.sqrt(Math.max(0,ne))*W+1/Math.max(ee,1e-6);U.fillStyle=G,U.beginPath(),U.arc(V.x??0,V.y??0,ie,0,2*Math.PI,!1),U.fill()}},[t,a,l,s]),H=A.useMemo(()=>{const T=u&&S.size>0;if(!T&&f===void 0)return;const W=u,V=f;return G=>{if(T&&W){const U=typeof W=="function"?W(G):G[W];if(U!=null&&S.has(String(U)))return!1}return typeof V=="function"?!!V(G):typeof V=="boolean"?V:typeof V=="string"?!!G[V]:!0}},[u,f,S]);return A.useMemo(()=>({nodeColor:b,linkColor:I,linkWidth:L,nodeVal:Y,nodePointerAreaPaint:E,nodeVisibility:H}),[b,I,L,Y,E,H])}const ca=250;function ua(e){return e==null?null:typeof e=="string"||typeof HTMLElement<"u"&&e instanceof HTMLElement?e:String(e)}function iv(e){const{highlightNeighborsOnHover:t,nodeLabel:n,linkLabel:r,onNodeHover:o,onLinkHover:i}=e,[a,l]=A.useState(null),[s,u]=A.useState(null),[f,c]=A.useState(Kt),[p,h]=A.useState(Kt),[d,m]=A.useState(null),v=A.useRef(null),g=A.useRef(null),S=A.useRef(null),_=A.useRef(null),x=A.useRef(null);A.useEffect(()=>()=>{_.current!==null&&(clearTimeout(_.current),_.current=null),x.current!==null&&(clearTimeout(x.current),x.current=null)},[]);const w=A.useCallback((j,F)=>{if(o?.(j,F),v.current=j?.id??null,!j&&S.current!==null)return;if(_.current!==null&&(clearTimeout(_.current),_.current=null),!j){_.current=setTimeout(()=>{_.current=null,l(null),t&&(c(Kt),h(Kt)),g.current===null&&m(null)},ca);return}if(t){const K=new Set([j.id]),O=new Set,y=j._neighbors??[];for(const C of y)C.id!==void 0&&K.add(C.id);const k=j._links??[];for(const C of k)C.id!==void 0&&O.add(C.id);l(j.id),c(K),h(O)}else l(j.id);const I=rn(n,j);m(ua(I))},[o,n,t]),b=A.useCallback((j,F)=>{if(i?.(j,F),g.current=j?.id??null,x.current!==null&&(clearTimeout(x.current),x.current=null),!j){x.current=setTimeout(()=>{x.current=null,u(null),v.current===null&&m(null)},ca);return}u(j.id??null);const I=rn(r,j);m(ua(I))},[i,r]),M=A.useMemo(()=>a===null?Kt:t?f:new Set([a]),[a,t,f]),P=A.useMemo(()=>{if(s!==null){if(t&&a!==null){const j=new Set(p);return j.add(s),j}return new Set([s])}return a!==null&&t?p:Kt},[s,a,t,p]),N=A.useCallback(j=>{if(S.current=j?.id??null,j){w(j,null);return}w(null,null)},[w]);return{hoverNodeId:a,hoverLinkId:s,liveHoverNodeIdRef:v,liveHoverLinkIdRef:g,highlightedNodeIds:f,highlightedLinkIds:p,hoveredNodeSet:M,hoveredLinkSet:P,tooltipContent:d,handleNodeHover:w,handleLinkHover:b,pinHover:N}}const Mt={frameId:-1,fov:-1,tanHalfFov:0,canvasHeightPx:1},fa=new re.Vector2;function av(e,t){const n=e.info?.render?.frame??-1;return n===Mt.frameId&&t===Mt.fov||(e.getSize(fa),Mt.frameId=n,Mt.fov=t,Mt.tanHalfFov=Math.tan(t*Math.PI/180/2),Mt.canvasHeightPx=fa.y||1),Mt}function rr(e){const t=e.material,n=e.userData;n.normalTexture&&n.normalTexture.dispose(),n.selectedTexture&&n.selectedTexture.dispose(),t.dispose(),e.parent&&e.parent.remove(e)}function or(e){const{text:t,fontSize:n=32,fontFamily:r="system-ui, sans-serif",color:o="#ffffff",backgroundColor:i="rgba(28, 31, 35, 0.85)",padding:a=8,worldHeight:l=4}=e,u=document.createElement("canvas").getContext("2d");if(!u)return new re.Sprite(new re.SpriteMaterial);u.font=`${n}px ${r}`;const f=Math.ceil(u.measureText(t).width),c=Math.ceil(n*1.2),p=f+a*2,h=c+a*2,d=(b,M,P)=>{b.width=p,b.height=h;const N=b.getContext("2d");if(N.font=`${n}px ${r}`,P){N.fillStyle=P;const j=Math.min(b.height/2,8),F=N;N.beginPath(),typeof F.roundRect=="function"?F.roundRect(0,0,b.width,b.height,j):N.rect(0,0,b.width,b.height),N.fill()}N.fillStyle=M,N.textAlign="center",N.textBaseline="middle",N.fillText(t,b.width/2,b.height/2)},m=document.createElement("canvas");d(m,o,i);const v=new re.CanvasTexture(m);v.minFilter=re.LinearFilter,v.magFilter=re.LinearFilter,v.needsUpdate=!0;let g;if(e.selectedColor!==void 0&&e.selectedBackgroundColor!==void 0){const b=document.createElement("canvas");d(b,e.selectedColor,e.selectedBackgroundColor),g=new re.CanvasTexture(b),g.minFilter=re.LinearFilter,g.magFilter=re.LinearFilter,g.needsUpdate=!0}const S=new re.SpriteMaterial({map:v,transparent:!0,depthWrite:!1}),_=new re.Sprite(S),x=_.userData;x.normalTexture=v,g&&(x.selectedTexture=g);const w=p/h;if(_.scale.set(l*w,l,1),e.pixelHeight!==void 0&&e.pixelHeight>0){const b=e.pixelHeight,M=new re.Vector3;let P=-1;_.onBeforeRender=(N,j,F)=>{const I=F;if(!I.isPerspectiveCamera||typeof I.fov!="number")return;_.getWorldPosition(M);const K=I.position.distanceTo(M);if(K<=0)return;const O=av(N,I.fov),y=2*O.tanHalfFov*K*b/O.canvasHeightPx;P>0&&Math.abs(y-P)<P*.005||(P=y,_.scale.set(y*w,y,1))}}return _}function sv(e){const{mode:t,showLabels:n,selectedNodeSet:r,hoveredNodeSet:o,accentColor:i,hostNodeCanvasObject:a,hostNodeThreeObject:l,nodeLabel:s,nodeVal:u,nodeRelSize:f,theme:c}=e,p=c?.tooltipBackground??"rgba(28, 31, 35, 0.9)",h=c?.tooltipForeground??"#ffffff",d=A.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:o,accentColor:i,tooltipBg:p,tooltipFg:h});d.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:o,accentColor:i,tooltipBg:p,tooltipFg:h};const m=A.useMemo(()=>{if(t!=="2d"||a)return;const b=c?.fontFamily??"system-ui, sans-serif";return(M,P,N)=>{const j=d.current,F=M.id!==void 0&&j.selectedNodeSet.has(M.id),I=M.id!==void 0&&j.hoveredNodeSet?.has(M.id)===!0;if(!j.showLabels&&!F&&!I)return;const K=sa(s,M);if(!K)return;const O=rn(u,M)??1,y=f??4,k=Math.max(.5,Math.sqrt(Math.max(O,0))*y),C=14/N,$=6/N,B=4/N;P.font=`${C}px ${b}`;const L=P.measureText(K).width+$*2,D=C+B*2,q=M.x??0,Y=(M.y??0)-k*2-4/N-D;P.fillStyle=F?j.accentColor:j.tooltipBg;const E=Math.min(D/2,6/N),H=P;P.beginPath(),typeof H.roundRect=="function"?H.roundRect(q-L/2,Y,L,D,E):P.rect(q-L/2,Y,L,D),P.fill(),P.textAlign="center",P.textBaseline="top",P.fillStyle=F?"#ffffff":j.tooltipFg,P.fillText(K,q,Y+B)}},[t,a,s,u,f,c?.fontFamily]),v=o?.size??0,S=n||r.size>0||v>0?m:void 0,_=A.useRef(new Map),x=A.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:o});x.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:o},A.useEffect(()=>{const b=_.current;return()=>{for(const M of b.values())M.sprite&&rr(M.sprite);b.clear()}},[]);const w=A.useMemo(()=>{if(l)return;const b=_.current,M=c?.fontFamily??"system-ui, sans-serif";return P=>{const N=P.id,j=sa(s,P),F=rn(u,P)??1,I=f??4,O=Math.cbrt(Math.max(F,0))*I*2+4,y=new re.Group;if(N!==void 0&&j){const k={group:y,sprite:null,text:j,yOffset:O};b.set(N,k);const C=x.current,$=C.selectedNodeSet.has(N),B=C.hoveredNodeSet?.has(N)===!0;if(C.showLabels||$||B){const X=or({text:j,fontFamily:M,fontSize:48,color:h,backgroundColor:p,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:28});if(X.material.depthTest=!1,X.renderOrder=1e3,X.position.set(0,O,0),$){const L=X.userData;if(L.selectedTexture){const D=X.material;D.map=L.selectedTexture,D.needsUpdate=!0}}y.add(X),k.sprite=X}}return y}},[l,s,u,f,c?.fontFamily,p,h,i]);return A.useEffect(()=>{const b=_.current,M=c?.fontFamily??"system-ui, sans-serif";for(const[P,N]of b){if(N.group.parent===null){N.sprite&&rr(N.sprite),b.delete(P);continue}const j=r.has(P),F=o?.has(P)===!0,I=n||j||F;if(I&&N.sprite===null){const O=or({text:N.text,fontFamily:M,fontSize:48,color:h,backgroundColor:p,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:28});O.material.depthTest=!1,O.renderOrder=1e3,O.position.set(0,N.yOffset,0),N.group.add(O),N.sprite=O}const K=N.sprite;if(K){K.visible=I;const O=K.userData,y=j&&O.selectedTexture?O.selectedTexture:O.normalTexture,k=K.material;y&&k.map!==y&&(k.map=y,k.needsUpdate=!0)}}},[n,r,o,i,p,h,c?.fontFamily]),{canvasObject:S,threeObject:w,renderFramePost:void 0}}function lv(e){const{mode:t,showLabels:n,selectedLinkSet:r,hoveredLinkSet:o,accentColor:i,hostLinkCanvasObject:a,hostLinkThreeObject:l,hostLinkPositionUpdate:s,linkLabel:u,theme:f}=e,c=f?.tooltipBackground??"rgba(255, 255, 255, 0.94)",p=f?.tooltipForeground??"#1c1f23",h=A.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:o,accentColor:i,tooltipBg:c,tooltipFg:p});h.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:o,accentColor:i,tooltipBg:c,tooltipFg:p};const d=A.useMemo(()=>{if(t!=="2d"||a)return;const b=f?.fontFamily??"system-ui, sans-serif",M=4,P=6;return(N,j)=>{const F=h.current,I=N.id!==void 0&&F.selectedLinkSet.has(N.id),K=N.id!==void 0&&F.hoveredLinkSet?.has(N.id)===!0;if(!F.showLabels&&!I&&!K)return;const O=N.source,y=N.target;if(typeof O!="object"||typeof y!="object")return;const k=la(u,N);if(!k||k===" → ")return;const C=O.x,$=O.y,B=y.x,X=y.y;if(C===void 0||$===void 0||B===void 0||X===void 0)return;const L=B-C,D=X-$,Y=Math.sqrt(L*L+D*D)-P*2;if(Y<=0)return;j.font=`1px ${b}`;const E=j.measureText(k).width||1,H=Math.min(M,Y/E);j.font=`${H}px ${b}`;let T=Math.atan2(D,L);T>Math.PI/2&&(T=-(Math.PI-T)),T<-Math.PI/2&&(T=-(-Math.PI-T));const W=(C+B)/2,V=($+X)/2,G=j.measureText(k).width,U=H*.6,ee=H*.35,ne=G+U,ie=H+ee,le=Math.min(ie/2,H*.35);j.save(),j.translate(W,V),j.rotate(T),j.fillStyle=I?F.accentColor:F.tooltipBg;const ae=j;j.beginPath(),typeof ae.roundRect=="function"?ae.roundRect(-ne/2,-ie/2,ne,ie,le):j.rect(-ne/2,-ie/2,ne,ie),j.fill(),j.textAlign="center",j.textBaseline="middle",j.fillStyle=I?"#ffffff":F.tooltipFg,j.fillText(k,0,0),j.restore()}},[t,a,u,f?.fontFamily]),m=o?.size??0,g=n||r.size>0||m>0?d:void 0,S=A.useRef(new Map),_=A.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:o});_.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:o},A.useEffect(()=>{const b=S.current;return()=>{for(const M of b.values())M.sprite&&rr(M.sprite);b.clear()}},[]);const x=A.useMemo(()=>{if(l)return;const b=S.current,M=f?.fontFamily??"system-ui, sans-serif";return P=>{const N=la(u,P),j=new re.Group,F=P.id;if(F!==void 0&&N&&N!==" → "){const I={group:j,sprite:null,text:N};b.set(F,I);const K=_.current,O=K.selectedLinkSet.has(F),y=K.hoveredLinkSet?.has(F)===!0;if(K.showLabels||O||y){const k=or({text:N,fontFamily:M,fontSize:48,color:p,backgroundColor:c,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:22});if(k.material.depthTest=!1,k.renderOrder=500,O){const C=k.userData;if(C.selectedTexture){const $=k.material;$.map=C.selectedTexture,$.needsUpdate=!0}}j.add(k),I.sprite=k}}return j}},[l,u,f?.fontFamily,c,p,i]);A.useEffect(()=>{const b=S.current,M=f?.fontFamily??"system-ui, sans-serif";for(const[P,N]of b){if(N.group.parent===null){N.sprite&&rr(N.sprite),b.delete(P);continue}const j=r.has(P),F=o?.has(P)===!0,I=n||j||F;if(I&&N.sprite===null){const O=or({text:N.text,fontFamily:M,fontSize:48,color:p,backgroundColor:c,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:22});O.material.depthTest=!1,O.renderOrder=500,N.group.add(O),N.sprite=O}const K=N.sprite;if(K){K.visible=I;const O=K.userData,y=j&&O.selectedTexture?O.selectedTexture:O.normalTexture,k=K.material;y&&k.map!==y&&(k.map=y,k.needsUpdate=!0)}}},[n,r,o,i,c,p,f?.fontFamily]);const w=A.useMemo(()=>{if(s!=null)return;const b=t==="2d";return(M,P)=>{if(M instanceof re.Group){const N=(P.start.x+P.end.x)/2,j=(P.start.y+P.end.y)/2,F=(P.start.z+P.end.z)/2;M.position.set(N,j,F);const I=M.parent;if(I&&!I.userData.lgcOrderApplied){I.userData.lgcOrderApplied=!0,I.renderOrder=-1;for(const O of I.children)O!==M&&(O.renderOrder=-1)}const K=M.children[0];if(K instanceof re.Sprite){const O=K.material;if(b){const y=P.end.x-P.start.x,k=P.end.y-P.start.y;let C=Math.atan2(k,y);C>Math.PI/2?C-=Math.PI:C<-Math.PI/2&&(C+=Math.PI),Math.abs(O.rotation-C)>.001&&(O.rotation=C)}else O.rotation!==0&&(O.rotation=0)}}return!0}},[t,s]);return{canvasObject:g,threeObject:x,positionUpdate:w}}function cv({nodeCount:e,linkCount:t}){const n=e+t*.5;return n>=5e4?"huge":n>=1e4?"xlarge":n>=2e3?"large":"default"}function uv(e,t){if(e==="default")return{};const n={cooldownTicks:e==="large"?100:e==="xlarge"?60:30,d3AlphaDecay:e==="large"?.04:e==="xlarge"?.08:.15,d3VelocityDecay:e==="huge"?.6:.4,linkHoverPrecision:e==="large"?4:2,warmupTicks:0,linkDirectionalParticles:0,linkDirectionalArrowLength:0};return n.forceEngine="ngraph",n.nodeResolution=e==="large"?8:e==="xlarge"?4:3,n.linkResolution=e==="large"?4:0,n.nodeOpacity=1,n.linkOpacity=1,n.pointerRaycasterThrottleMs=e==="large"?16:e==="xlarge"?32:64,n}function fv(e){const{profile:t="auto",nodeCount:n,linkCount:r,mode:o}=e;return A.useMemo(()=>{if(t==="off")return{};const i=t==="auto"?cv({nodeCount:n,linkCount:r}):t;return uv(i)},[t,n,r,o])}function dv(e){const{ref:t}=e,n=A.useRef(e);n.current=e,A.useImperativeHandle(t,()=>({getData:()=>n.current.dataApi.data,setData:r=>n.current.dataApi.setData(r),addNode:(r,o)=>n.current.dataApi.addNode(r,o),addNodes:r=>n.current.dataApi.addNodes(r),updateNode:(r,o)=>n.current.dataApi.updateNode(r,o),removeNode:r=>n.current.deleteGate.requestNodeDelete([r],"imperative"),removeNodes:r=>n.current.deleteGate.requestNodeDelete(r,"imperative"),addLink:r=>n.current.dataApi.addLink(r),addLinks:r=>n.current.dataApi.addLinks(r),removeLink:r=>n.current.deleteGate.requestLinkDelete(r,"imperative"),clear:()=>n.current.dataApi.clear(),getSelection:()=>[...n.current.selection.selected],setSelection:r=>n.current.selection.set(r),selectAll:()=>n.current.selection.set(n.current.dataApi.data.nodes.map(r=>r.id)),clearSelection:()=>n.current.selection.clear(),getMode:()=>n.current.mode,setMode:r=>n.current.setMode(r),fit:(r,o)=>n.current.engine?.fit(r,o),centerAt:(r,o,i,a)=>n.current.engine?.centerAt(r,o,i,a),zoom:(r,o)=>n.current.engine?.zoom(r,o),zoomIn:(r=1.2)=>{const o=n.current.engine;o&&o.zoom((o.getZoom?.()??1)*r,200)},zoomOut:(r=1.2)=>{const o=n.current.engine;o&&o.zoom((o.getZoom?.()??1)/r,200)},panBy:(r,o)=>n.current.engine?.panBy?.(r,o),goTo:(r,o)=>n.current.engine?.goTo?.(r,o),fitToNodes:(r,o,i)=>n.current.engine?.fitToNodes?.(r,o,i),fitToSelection:(r,o)=>{const i=n.current;if(!i.engine)return;const a=new Set(i.selection.selected);if(i.selectedLinkIds.length>0){const l=new Set(i.selectedLinkIds);for(const s of i.dataApi.data.links){const u=s.id;if(u===void 0||!l.has(u))continue;const f=typeof s.source=="object"?s.source.id:s.source,c=typeof s.target=="object"?s.target.id:s.target;f!==void 0&&a.add(f),c!==void 0&&a.add(c)}}a.size!==0&&i.engine.fitToNodes?.([...a],r??400,o??60)},pause:()=>{n.current.engine?.pause(),n.current.setPaused(!0)},resume:()=>{n.current.engine?.resume(),n.current.setPaused(!1)},reheat:()=>n.current.engine?.reheat(),screenshot:async()=>{const r=n.current.engine?.getCanvasElement();return r?new Promise(o=>r.toBlob(i=>o(i))):null},copy:()=>n.current.clipboard.copy(),cut:()=>n.current.clipboard.cut(),paste:r=>n.current.clipboard.paste(r?.at),duplicate:()=>n.current.clipboard.duplicate(),addConnectedNode:r=>n.current.clipboard.addConnectedNode(r),togglePin:r=>n.current.clipboard.togglePin(r),exportJSON:()=>n.current.exportJSON(),importJSON:r=>n.current.importJSON(r),downloadJSON:r=>n.current.downloadJSON(r),d3Force:(r,o)=>n.current.engine?.d3Force(r,o),emitParticle:r=>n.current.engine?.emitParticle(r),stopAnimation:()=>n.current.engine?.stopAnimation(),engine2D:()=>n.current.engine?.mode==="2d"?n.current.engine:null,engine3D:()=>n.current.engine?.mode==="3d"?n.current.engine:null}),[])}function hv(){const[e,t]=A.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return A.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia("(prefers-reduced-motion: reduce)"),r=()=>t(n.matches);return typeof n.addEventListener=="function"?(n.addEventListener("change",r),()=>n.removeEventListener("change",r)):(n.addListener(r),()=>n.removeListener(r))},[]),e}const ze={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},pv=e=>R.jsx("svg",{...ze,...e,children:R.jsx("path",{d:"M3 2.5l4 10 1.4-3.6 3.6-1.4z"})}),gv=e=>R.jsx("svg",{...ze,...e,children:R.jsx("path",{d:"M8 3v10M3 8h10M5 5l6 6M11 5L5 11"})}),vv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("circle",{cx:"6",cy:"8",r:"3"}),R.jsx("path",{d:"M12 5v6M9 8h6"})]}),yv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("circle",{cx:"4",cy:"4",r:"2"}),R.jsx("circle",{cx:"12",cy:"12",r:"2"}),R.jsx("path",{d:"M5.5 5.5l5 5"})]}),$s=e=>R.jsx("svg",{...ze,...e,children:R.jsx("path",{d:"M3 5h10M6 5V3h4v2M5 5l1 8h4l1-8"})}),mv=e=>R.jsx("svg",{...ze,...e,children:R.jsx("path",{d:"M3 6V3h3M13 6V3h-3M3 10v3h3M13 10v3h-3"})}),bv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("circle",{cx:"7",cy:"7",r:"4"}),R.jsx("path",{d:"M5 7h4M7 5v4M10 10l3 3"})]}),_v=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("circle",{cx:"7",cy:"7",r:"4"}),R.jsx("path",{d:"M5 7h4M10 10l3 3"})]}),xv=e=>R.jsx("svg",{...ze,...e,children:R.jsx("path",{d:"M6 3v10M10 3v10"})}),wv=e=>R.jsx("svg",{...ze,...e,children:R.jsx("path",{d:"M5 3l8 5-8 5z"})}),kv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("path",{d:"M3 5h2l1-2h4l1 2h2v8H3z"}),R.jsx("circle",{cx:"8",cy:"9",r:"2.5"})]}),Hs=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("path",{d:"M8 2l5 3v6l-5 3-5-3V5z"}),R.jsx("path",{d:"M8 8v7M8 8L3 5M8 8l5-3"})]}),Cv=e=>R.jsx("svg",{...ze,...e,children:R.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),qs=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),R.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"})]}),Sv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",strokeDasharray:"2 2"}),R.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor"}),R.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"currentColor"}),R.jsx("circle",{cx:"6",cy:"10",r:"1",fill:"currentColor"}),R.jsx("circle",{cx:"10",cy:"10",r:"1",fill:"currentColor"})]}),Mv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("path",{d:"M8 2v8M5 5l3-3 3 3"}),R.jsx("path",{d:"M3 12h10v2H3z"})]}),Pv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("path",{d:"M8 10V2M5 7l3 3 3-3"}),R.jsx("path",{d:"M3 12h10v2H3z"})]}),Av=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("circle",{cx:"4",cy:"8",r:"2"}),R.jsx("path",{d:"M6 8h2.5"}),R.jsx("circle",{cx:"11",cy:"8",r:"2"}),R.jsx("path",{d:"M11 6.5v3M9.5 8h3"})]}),Us={select:{id:"select",label:"Select",hint:"Select / multi-select nodes",icon:pv,toggleable:!0,shortcut:"V"},pan:{id:"pan",label:"Pan",hint:"Pan the canvas",icon:gv,toggleable:!0,shortcut:"H"},"add-node":{id:"add-node",label:"Add node",hint:"Click on the canvas to add a node",icon:vv,toggleable:!0,shortcut:"N"},"add-link":{id:"add-link",label:"Add link",hint:"Click two nodes to connect them",icon:yv,toggleable:!0,shortcut:"L"},delete:{id:"delete",label:"Delete",hint:"Delete selected node(s)",icon:$s,shortcut:"⌫"},fit:{id:"fit",label:"Fit",hint:"Fit graph to viewport",icon:mv,shortcut:"F"},"zoom-in":{id:"zoom-in",label:"Zoom in",hint:"Zoom in",icon:bv,shortcut:"+"},"zoom-out":{id:"zoom-out",label:"Zoom out",hint:"Zoom out",icon:_v,shortcut:"-"},pause:{id:"pause",label:"Pause",hint:"Pause simulation",icon:xv},resume:{id:"resume",label:"Resume",hint:"Resume simulation",icon:wv},screenshot:{id:"screenshot",label:"Screenshot",hint:"Download a PNG of the canvas",icon:kv},"toggle-mode":{id:"toggle-mode",label:"2D / 3D",hint:"Toggle between 2D and 3D",icon:Hs,shortcut:"3"},duplicate:{id:"duplicate",label:"Duplicate",hint:"Duplicate the current selection",icon:qs,shortcut:"⌘D"},"select-all":{id:"select-all",label:"Select all",hint:"Select every node",icon:Sv,shortcut:"⌘A"},"export-json":{id:"export-json",label:"Export",hint:"Download the graph as JSON",icon:Mv},"import-json":{id:"import-json",label:"Import",hint:"Load a JSON graph from disk",icon:Pv}},io=["select","pan","add-node","add-link","select-all","fit","zoom-in","zoom-out","pause","resume","screenshot","export-json","import-json"];function Gs(e){return e==="2d"?Hs:Cv}function Ov(e,t){if(e===!1)return[];let n;if(e===!0)n=io;else if(Array.isArray(e))n=e;else{const r=e.include??io,o=new Set(e.exclude??[]);n=r.filter(i=>!o.has(i))}return n.filter(r=>r==="pause"?!t:r==="resume"?t:!0)}function jv(e){return e&&typeof e=="object"&&!Array.isArray(e)?e.position??"top-right":"top-right"}function zv(e){const{config:t,activeTool:n,paused:r,mode:o,isDisabled:i,onSelect:a}=e,l=Ov(t,r),[s,u]=A.useState(0),f=A.useRef([]),c=A.useRef(!1);if(A.useEffect(()=>{if(!c.current)return;const m=Math.min(s,Math.max(0,l.length-1));f.current[m]?.focus()},[s,l.length]),l.length===0)return null;const p=jv(t),h=Math.min(s,Math.max(0,l.length-1)),d=m=>{c.current=!0,u(v=>(v+m+l.length)%l.length)};return R.jsx("div",{className:`lgc-toolbar lgc-toolbar--${p}`,role:"toolbar",children:l.map((m,v)=>{const g=Us[m],S=m==="toggle-mode"?Gs(o):g.icon,_=g.toggleable&&n===m,x=i?.(m)??!1,w=[g.hint,g.shortcut?`(${g.shortcut})`:""],b=v===h;return R.jsx("button",{ref:M=>{f.current[v]=M},type:"button",className:["lgc-tool",_?"lgc-tool--active":"",x?"lgc-tool--disabled":""].join(" ").trim(),"aria-label":g.label,"aria-pressed":_?"true":void 0,disabled:x,tabIndex:b?0:-1,title:w.filter(Boolean).join(" "),onFocus:()=>u(v),onClick:()=>a(m),onKeyDown:M=>{M.key==="ArrowRight"?(M.preventDefault(),d(1)):M.key==="ArrowLeft"?(M.preventDefault(),d(-1)):M.key==="Home"?(M.preventDefault(),c.current=!0,u(0)):M.key==="End"&&(M.preventDefault(),c.current=!0,u(l.length-1))},children:R.jsx(S,{})},m)})})}const Zt=8;function Tv({x:e,y:t,items:n,onClose:r}){const o=A.useRef(null),[i,a]=A.useState({left:e,top:t});return A.useEffect(()=>{const l=s=>{s instanceof KeyboardEvent&&s.key!=="Escape"||s instanceof MouseEvent&&o.current&&o.current.contains(s.target)||r()};return window.addEventListener("mousedown",l),window.addEventListener("keydown",l),()=>{window.removeEventListener("mousedown",l),window.removeEventListener("keydown",l)}},[r]),A.useLayoutEffect(()=>{const l=o.current;if(!l)return;const s=l.parentElement;if(!s)return;const u=s.getBoundingClientRect(),f=l.offsetWidth,c=l.offsetHeight,p=Math.max(Zt,u.width-f-Zt),h=Math.max(Zt,u.height-c-Zt),d=Math.min(Math.max(e,Zt),p),m=Math.min(Math.max(t,Zt),h);(d!==i.left||m!==i.top)&&a({left:d,top:m})},[e,t,n,i.left,i.top]),R.jsx("div",{ref:o,className:"lgc-menu",role:"menu",style:{left:i.left,top:i.top},children:n.map((l,s)=>"separator"in l?R.jsx("div",{className:"lgc-menu-separator"},`sep-${s}`):R.jsxs("div",{role:"menuitem",className:"lgc-menu-item","aria-disabled":l.disabled?"true":void 0,onClick:()=>{l.disabled||(l.onSelect(),r())},children:[R.jsx("span",{children:l.label}),l.shortcut?R.jsx("span",{style:{marginLeft:"auto",opacity:.6},children:l.shortcut}):null]},l.id))})}const Ev=120,Qt=14;function Lv({content:e,hostRef:t}){const[n,r]=A.useState(null),[o,i]=A.useState(!1),a=A.useRef(null),l=A.useRef(null);A.useEffect(()=>{if(e===null){r(null),i(!1),a.current=null;return}const v=t.current;if(!v)return;a.current=v.getBoundingClientRect();const g=window.setTimeout(()=>i(!0),Ev),S=x=>{const w=a.current??v.getBoundingClientRect();r({x:x.clientX-w.left,y:x.clientY-w.top})},_=()=>{a.current=v.getBoundingClientRect()};return v.addEventListener("mousemove",S),window.addEventListener("resize",_),()=>{window.clearTimeout(g),v.removeEventListener("mousemove",S),window.removeEventListener("resize",_)}},[t,e]);const[s,u]=A.useState(!1),[f,c]=A.useState(!1);if(A.useLayoutEffect(()=>{if(!o||!n)return;const v=t.current,g=l.current;if(!v||!g)return;const S=a.current??v.getBoundingClientRect(),_=g.offsetWidth,x=g.offsetHeight;u(n.x+Qt+_>S.width),c(n.y+Qt+x>S.height)},[o,n,e,t]),e===null||n===null||!o)return null;const p=l.current?.offsetWidth??0,h=l.current?.offsetHeight??0,d=s?n.x-Qt-p:n.x+Qt,m=f?n.y-Qt-h:n.y+Qt;return R.jsx("div",{ref:l,className:"lgc-tooltip",role:"tooltip",style:{left:d,top:m,pointerEvents:"none"},children:typeof e=="string"?e:R.jsx("span",{ref:v=>v?.appendChild(e)})})}function Nv({rect:e,count:t}){if(!e)return null;const n=Math.min(e.x0,e.x1),r=Math.min(e.y0,e.y1),o=Math.abs(e.x1-e.x0),i=Math.abs(e.y1-e.y0);return R.jsx("div",{className:"lgc-marquee",style:{left:n,top:r,width:o,height:i,pointerEvents:"none"},children:t&&t>0?R.jsx("span",{className:"lgc-marquee-count",children:t}):null})}function Rv(e){return R.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[R.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),R.jsx("path",{d:"M6 5h7v7"})]})}function Dv(e){return R.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[R.jsx("circle",{cx:"5",cy:"11",r:"2"}),R.jsx("circle",{cx:"11",cy:"11",r:"2"}),R.jsx("path",{d:"M6.5 9.5L13 3M5 8L9.5 9.5"})]})}function da(e){return R.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[R.jsx("rect",{x:"3",y:"4",width:"10",height:"10",rx:"1"}),R.jsx("rect",{x:"5",y:"2",width:"6",height:"3",rx:"1"})]})}function Pt({label:e,shortcut:t,disabled:n,onClick:r,children:o}){return R.jsx("button",{type:"button",className:"lgc-selpanel-btn","aria-label":e,title:t?`${e} (${t})`:e,disabled:n,onClick:r,children:o})}function Iv({nodeCount:e,linkCount:t,hasClipboard:n,enableClipboard:r,onDelete:o,onDuplicate:i,onAddConnected:a,onCopy:l,onCut:s,onPaste:u,onClear:f}){if(e===0&&t===0)return!r||!n?null:R.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[R.jsx("span",{className:"lgc-selpanel-label",children:"Clipboard ready"}),R.jsx(Pt,{label:"Paste",shortcut:"⌘V",onClick:u,children:R.jsx(da,{})})]});const c=[];e>0&&c.push(`${e} ${e===1?"node":"nodes"}`),t>0&&c.push(`${t} ${t===1?"link":"links"}`);const p=c.join(", ");return R.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[R.jsx("span",{className:"lgc-selpanel-label",children:p}),R.jsx("div",{className:"lgc-selpanel-divider"}),R.jsx(Pt,{label:"Delete",shortcut:"⌫",onClick:o,children:R.jsx($s,{width:14,height:14})}),R.jsx(Pt,{label:"Duplicate",shortcut:"⌘D",onClick:i,children:R.jsx(qs,{width:14,height:14})}),R.jsx(Pt,{label:"Connect to new node",shortcut:"↵",disabled:e===0,onClick:a,children:R.jsx(Av,{})}),r?R.jsxs(R.Fragment,{children:[R.jsx(Pt,{label:"Copy",shortcut:"⌘C",disabled:e===0,onClick:l,children:R.jsx(Rv,{})}),R.jsx(Pt,{label:"Cut",shortcut:"⌘X",disabled:e===0,onClick:s,children:R.jsx(Dv,{})}),R.jsx(Pt,{label:"Paste",shortcut:"⌘V",disabled:!n,onClick:u,children:R.jsx(da,{})})]}):null,R.jsx("div",{className:"lgc-selpanel-divider"}),R.jsx(Pt,{label:"Clear selection",shortcut:"Esc",onClick:f,children:"✕"})]})}const ha=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];function Fv(e,t){let n=0;for(let r=0;r<e.length;r++)n=n*31+e.charCodeAt(r)|0;return Math.abs(n)%t}function Bv(e){return ha[Fv(e,ha.length)]}function $v({nodes:e,groupBy:t,hidden:n,onToggle:r}){const o=A.useMemo(()=>{if(!t)return[];const i=new Set;for(const a of e){const l=typeof t=="function"?t(a):a[t];l!=null&&i.add(String(l))}return Array.from(i).sort()},[e,t]);return o.length===0?null:R.jsx("div",{className:"lgc-legend",role:"region","aria-label":"Groups",children:o.map(i=>{const a=n.has(i);return R.jsxs("button",{type:"button",className:["lgc-legend-item",a?"lgc-legend-item--hidden":""].join(" ").trim(),onClick:()=>r(i),"aria-pressed":a?"false":"true",title:`Toggle ${i}`,children:[R.jsx("span",{className:"lgc-legend-swatch",style:{background:Bv(i)}}),R.jsx("span",{children:i})]},i)})})}function Hv({mode:e,onToggle:t}){const n=Gs(e),r=e==="2d"?"3D":"2D";return R.jsxs("button",{type:"button",className:"lgc-mode-toggle",onClick:t,"aria-label":`Switch to ${r}`,title:`Switch to ${r} (3)`,children:[R.jsx(n,{width:14,height:14}),R.jsx("span",{className:"lgc-mode-toggle-label",children:e.toUpperCase()})]})}function qv(e){return R.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[R.jsx("circle",{cx:"8",cy:"8",r:"2.4"}),R.jsx("path",{d:"M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.4 1.4M11.55 11.55l1.4 1.4M3.05 12.95l1.4-1.4M11.55 4.45l1.4-1.4"})]})}function Uv({items:e}){const[t,n]=A.useState(!1),r=A.useRef(null);return A.useEffect(()=>{if(!t)return;const o=a=>{r.current&&!r.current.contains(a.target)&&n(!1)},i=a=>{a.key==="Escape"&&n(!1)};return window.addEventListener("mousedown",o),window.addEventListener("keydown",i),()=>{window.removeEventListener("mousedown",o),window.removeEventListener("keydown",i)}},[t]),e.length===0?null:R.jsxs("div",{ref:r,className:"lgc-options-menu",children:[R.jsx("button",{type:"button",className:"lgc-options-trigger","aria-label":"Options","aria-expanded":t,title:"Options",onClick:()=>n(o=>!o),children:R.jsx(qv,{})}),t?R.jsx("div",{className:"lgc-options-panel",role:"menu",children:e.map(o=>o.kind==="select"?R.jsxs("div",{className:"lgc-options-item",children:[R.jsxs("span",{className:"lgc-options-item-text",children:[R.jsx("span",{className:"lgc-options-item-label",children:o.label}),o.hint?R.jsx("span",{className:"lgc-options-item-hint",children:o.hint}):null]}),R.jsx("select",{className:"lgc-options-select",value:o.value,onChange:i=>o.onChange(i.target.value),children:o.options.map(i=>R.jsx("option",{value:i.value,children:i.label??i.value},i.value))})]},o.id):R.jsxs("label",{className:"lgc-options-item",children:[R.jsx("input",{type:"checkbox",checked:o.checked,onChange:i=>o.onChange(i.target.checked)}),R.jsxs("span",{className:"lgc-options-item-text",children:[R.jsx("span",{className:"lgc-options-item-label",children:o.label}),o.hint?R.jsx("span",{className:"lgc-options-item-hint",children:o.hint}):null]})]},o.id))}):null]})}function Gv(e,t,n={}){const r=n.spacing??50,o=n.color??"rgba(0,0,0,0.06)",i=e.canvas,l=e.getTransform().inverse(),s=l.transformPoint({x:0,y:0}),u=l.transformPoint({x:i.width,y:i.height}),f=Math.floor(s.x/r)*r,c=Math.ceil(u.x/r)*r,p=Math.floor(s.y/r)*r,h=Math.ceil(u.y/r)*r;e.save(),e.strokeStyle=o,e.lineWidth=1/t,e.beginPath();for(let d=f;d<=c;d+=r)e.moveTo(d,p),e.lineTo(d,h);for(let d=p;d<=h;d+=r)e.moveTo(f,d),e.lineTo(c,d);e.stroke(),e.restore()}const pa=15,Vv={background:"--lgc-bg",foreground:"--lgc-fg",border:"--lgc-border",accent:"--lgc-accent",toolbarBackground:"--lgc-toolbar-bg",toolbarForeground:"--lgc-toolbar-fg",toolbarBorder:"--lgc-toolbar-border",toolActiveBackground:"--lgc-tool-active-bg",toolHoverBackground:"--lgc-tool-hover-bg",tooltipBackground:"--lgc-tooltip-bg",tooltipForeground:"--lgc-tooltip-fg",menuBackground:"--lgc-menu-bg",menuForeground:"--lgc-menu-fg",menuHoverBackground:"--lgc-menu-hover-bg",fontFamily:"--lgc-font",fontSize:"--lgc-font-size"};function Wv(e){if(!e)return{};const t={};for(const[n,r]of Object.entries(e)){if(r===void 0)continue;const o=Vv[n];o&&(t[o]=String(r))}return t}function Vs(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function Yv(e){e&&e.toBlob(t=>{t&&Vs(t,`lora-graph-${Date.now()}.png`)})}function Xv(e,t){const{data:n,defaultData:r,onDataChange:o,mode:i,defaultMode:a,onModeChange:l,width:s,height:u,className:f,style:c,theme:p,tools:h=!0,selection:d="multi",showContextMenu:m=!0,showLegend:v=!1,showGrid:g=!1,showLabels:S=!1,enableClipboard:_=!0,enableTooltip:x=!0,introZoom:w=!0,focusOnClick:b=!1,highlightNeighborsOnHover:M=!0,autoIndexNeighbors:P=M,collideNodes:N=!1,fixOnDrop:j=!0,fitOnSelect:F=!1,beeswarm:I=!1,onSelectionChange:K,onNodeClick:O,onNodeRightClick:y,onLinkClick:k,onLinkRightClick:C,onBackgroundClick:$,onBackgroundRightClick:B,onNodeDrag:X,onNodeDragEnd:L,onNodeHover:D,onLinkHover:q,onNodeDoubleClick:Y,onCopy:E,onCut:H,onPaste:T,onBeforeNodeDelete:W,onBeforeLinkDelete:V,onNodeDeleted:G,onLinkDeleted:U,onRenderFramePre:ee,nodeColor:ne,nodeLabel:ie,nodeVal:le,nodeAutoColorBy:ae,nodeRelSize:ce,nodeVisibility:be,nodeCanvasObject:We,linkColor:Pe,linkLabel:Ye,linkWidth:Xe,linkHoverPrecision:ot,backgroundColor:Ae,enableNavigationControls:_e,performanceProfile:Se,dagMode:He}=e,[Ce,Ie]=A.useState(i??a??"2d"),Le=i!==void 0,ve=Le?i:Ce,Qe=A.useRef(null),it=A.useCallback(z=>{z!==ve&&(Qe.current?.(),Le||Ie(z),l?.(z))},[ve,Le,l]),se=Ol({...n!==void 0?{controlled:n}:{},...r!==void 0?{defaultData:r}:{},...o?{onChange:o}:{}});Kg(P,se.data);const ye=Yg({mode:d,...K?{onChange:K}:{}}),[qe,Ct]=A.useState("select"),[Tt,dr]=A.useState(!1),Ys=iv({highlightNeighborsOnHover:M,...ie!==void 0?{nodeLabel:ie}:{},...Ye!==void 0?{linkLabel:Ye}:{},...D?{onNodeHover:D}:{},...q?{onLinkHover:q}:{}}),{hoverNodeId:Xs,hoverLinkId:Ks,liveHoverNodeIdRef:Zs,highlightedNodeIds:Qs,highlightedLinkIds:Js,hoveredNodeSet:el,hoveredLinkSet:tl,tooltipContent:nl,handleNodeHover:Oo,handleLinkHover:jo,pinHover:jn}=Ys,[zo,rl]=A.useState(()=>new Set),[Ht,To]=A.useState(!!b),[zn,Eo]=A.useState(!!S),[Tn,Lo]=A.useState(!!F),[En,No]=A.useState(He??null);A.useEffect(()=>{To(!!b)},[b]),A.useEffect(()=>{Eo(!!S)},[S]),A.useEffect(()=>{Lo(!!F)},[F]),A.useEffect(()=>{No(He??null)},[He]);const mt=A.useRef(null),[sn,Ln]=A.useState(null),[ln,Nn]=A.useState(null),[Rn,Et]=A.useState(null),[at,ft]=A.useState([]),[Dn,qt]=A.useState(null),ol=Xg(),bt=hv(),Lt=A.useRef(null),hr=A.useRef(null),[Nt,il]=A.useState(null),al=A.useCallback(z=>{hr.current=z,il(z)},[]),Ro=Wg(Lt),pr=s??Ro?.width??600,gr=u??Ro?.height??400,Ne=A.useRef(null),{marquee:In,lastCursorRef:sl}=Zg({mount:Nt,engineRef:Ne,selection:ye,nodes:se.data.nodes,links:se.data.links,setSelectedLinkIds:ft,liveHoverNodeIdRef:Zs});Jg(Nt);const st=tv({dataApi:se,...W?{beforeNode:W}:{},...V?{beforeLink:V}:{},...G?{onNodeDeleted:G}:{},...U?{onLinkDeleted:U}:{},afterNodeDelete:()=>ye.clear(),afterLinkDelete:()=>ft([])}),Te=ev({enableClipboard:_,dataApi:se,deleteGate:st,selection:ye,setSelectedLinkIds:ft,engineRef:Ne,lastCursorRef:sl,...E?{onCopy:E}:{},...H?{onCut:H}:{},...T?{onPaste:T}:{}}),Do=A.useRef(null),Io=A.useCallback((z,Z)=>{O?.(z,Z);const te=performance.now(),he=Do.current,pe=he&&he.id===z.id&&te-he.at<280;if(Do.current={id:z.id,at:te},pe){Y?.(z,Z);return}if(qe==="add-link"&&z.id!==void 0){Rn===null?Et(z.id):(Rn!==z.id&&se.addLink({source:Rn,target:z.id}),Et(null));return}if(d!=="none"&&z.id!==void 0){const ue=Z.shiftKey||Z.ctrlKey||Z.metaKey;ye.toggle(z.id,{additive:ue}),ue||ft([])}if(Ht&&z.id!==void 0&&Ne.current){const ue=Ne.current;sn===z.id?(mt.current&&ue.setCameraState(mt.current,800),Ln(null),mt.current=null):(sn===null&&ln===null&&(mt.current=ue.getCameraState()),ue.focusOn({x:z.x??0,y:z.y??0,z:z.z??0},{distance:120,zoom:8,durationMs:bt?0:1e3}),Ln(z.id),Nn(null))}},[O,Y,ye,d,qe,Rn,se,Ht,sn,ln,bt]),Fo=A.useCallback(z=>{if($?.(z),Ne.current?.stopAnimation(),qe==="add-node"){const te=hr.current?.getBoundingClientRect(),he=te?z.clientX-te.left:z.clientX,pe=te?z.clientY-te.top:z.clientY,ue=Ne.current?.screen2Graph(he,pe)??{x:he,y:pe};se.addNode(void 0,{at:{x:ue.x,y:ue.y,...ue.z!==void 0?{z:ue.z}:{}}});return}qe==="add-link"&&Et(null),z.shiftKey||z.ctrlKey||z.metaKey||(ye.clear(),ft([])),qt(null)},[$,qe,se,ye]),Bo=A.useCallback((z,Z)=>{if(y?.(z,Z),!m)return;const te=Lt.current?.getBoundingClientRect(),he=te?Z.clientX-te.left:Z.clientX,pe=te?Z.clientY-te.top:Z.clientY,ue=z.id,ge=ye.selected,dt=ge.length>1&&ge.includes(ue)?[{id:"pin-all",label:`Pin ${ge.length} nodes`,onSelect:()=>{for(const Re of ge){const Je=se.data.nodes.find(ht=>ht.id===Re);Je&&se.updateNode(Re,{fx:Je.x,fy:Je.y,fz:Je.z})}}},{id:"unpin-all",label:`Unpin ${ge.length} nodes`,onSelect:()=>{for(const Re of ge)se.updateNode(Re,{fx:void 0,fy:void 0,fz:void 0})}},{separator:!0},{id:"duplicate",label:`Duplicate ${ge.length} nodes`,shortcut:"⌘D",onSelect:()=>Te.duplicate()},{id:"delete-all",label:`Delete ${ge.length} nodes`,shortcut:"⌫",onSelect:()=>{st.requestNodeDelete(ge,"contextMenu")}}]:[{id:"pin",label:z.fx!==void 0?"Unpin":"Pin",onSelect:()=>{se.updateNode(ue,z.fx!==void 0?{fx:void 0,fy:void 0,fz:void 0}:{fx:z.x,fy:z.y,fz:z.z})}},{id:"connect",label:"Connect from here…",onSelect:()=>{Ct("add-link"),Et(ue)}},{separator:!0},{id:"delete",label:"Delete",shortcut:"⌫",onSelect:()=>{st.requestNodeDelete([ue],"contextMenu")}}];qt({x:he,y:pe,items:dt})},[y,m,se,ye,Te,st]),$o=A.useCallback((z,Z)=>{k?.(z,Z);const te=z.id;if(te===void 0)return;const he=Z.shiftKey||Z.ctrlKey||Z.metaKey;if(ft(pe=>{const ue=pe.includes(te);return!he||d!=="multi"?ue&&pe.length===1?[]:[te]:ue?pe.filter(ge=>ge!==te):[...pe,te]}),he||ye.clear(),Ht&&Ne.current){const pe=Ne.current;if(ln===te)mt.current&&pe.setCameraState(mt.current,800),Nn(null),mt.current=null;else{const ue=typeof z.source=="object"?z.source:null,ge=typeof z.target=="object"?z.target:null;if(ue&&ge&&ue.x!==void 0&&ge.x!==void 0){sn===null&&ln===null&&(mt.current=pe.getCameraState());const Ue=ue.x??0,dt=ue.y??0,Re=ge.x??0,Je=ge.y??0,ht=ue.z??0,Gt=ge.z??0,ni={x:(Ue+Re)/2,y:(dt+Je)/2,z:(ht+Gt)/2},cn=1.5,ri=Re-Ue,oi=Je-dt,dl=Gt-ht,hl=Math.max(Math.abs(ri),1),pl=Math.max(Math.abs(oi),1),gl=Math.min(pr/(hl*cn),gr/(pl*cn)),vl=Math.min(16,Math.max(.5,gl)),yl=Math.hypot(ri,oi,dl)/2/.466*cn,ml=Math.max(60,yl);pe.focusOn(ni,{distance:ml,zoom:vl,durationMs:bt?0:1e3}),Nn(te),Ln(null)}}}},[k,ye,d,Ht,ln,sn,pr,gr,bt]),Ho=A.useCallback((z,Z)=>{if(C?.(z,Z),!m)return;const te=Lt.current?.getBoundingClientRect(),he=te?Z.clientX-te.left:Z.clientX,pe=te?Z.clientY-te.top:Z.clientY;qt({x:he,y:pe,items:[{id:"delete",label:"Delete link",shortcut:"⌫",onSelect:()=>{st.requestLinkDelete(ue=>ue===z,"contextMenu")}},{id:"reverse",label:"Reverse direction",onSelect:()=>{se.removeLink(ue=>ue===z),se.addLink({...z,source:typeof z.target=="object"?z.target.id:z.target,target:typeof z.source=="object"?z.source.id:z.source})}}]})},[C,m,se,st]),vr=A.useRef(null),qo=A.useRef(se.data.nodes);qo.current=se.data.nodes;const Uo=A.useCallback((z,Z)=>{if(X?.(z,Z),Ne.current?.stopAnimation(),jn(z),qe==="add-link"){const te=qo.current,he=z.x??0,pe=z.y??0,ue=pa*pa;let ge=null,Ue=1/0;for(let dt=0;dt<te.length;dt++){const Re=te[dt];if(!Re||Re===z||Re.id===z.id)continue;const Je=(Re.x??0)-he,ht=(Re.y??0)-pe,Gt=Je*Je+ht*ht;Gt<Ue&&(Ue=Gt,ge=Re)}vr.current=ge&&Ue<ue?ge:null}},[X,qe,jn]),Go=A.useCallback((z,Z)=>{if(L?.(z,Z),jn(null),qe==="add-link"){const te=vr.current;if(vr.current=null,!te||te.id===void 0||z.id===void 0)return;se.addLink({source:z.id,target:te.id});return}if(j){const te=z;z.x!==void 0&&(te.fx=z.x),z.y!==void 0&&(te.fy=z.y),z.z!==void 0&&(te.fz=z.z)}},[L,qe,se,j,jn]),Vo=A.useCallback(z=>{if(B?.(z),!m)return;const Z=Lt.current?.getBoundingClientRect(),te=Z?z.clientX-Z.left:z.clientX,he=Z?z.clientY-Z.top:z.clientY,pe=hr.current?.getBoundingClientRect(),ue=pe?z.clientX-pe.left:z.clientX,ge=pe?z.clientY-pe.top:z.clientY,Ue=Ne.current?.screen2Graph(ue,ge)??{x:ue,y:ge};qt({x:te,y:he,items:[{id:"add-node-here",label:"Add node here",onSelect:()=>{se.addNode(void 0,{at:{x:Ue.x,y:Ue.y,...Ue.z!==void 0?{z:Ue.z}:{}}})}},{id:"fit",label:"Fit to view",shortcut:"F",onSelect:()=>Ne.current?.fit(400,40)},{id:"toggle-mode",label:ve==="2d"?"Switch to 3D":"Switch to 2D",shortcut:"3",onSelect:()=>it(ve==="2d"?"3d":"2d")}]})},[B,m,se,ve,it]),yr=p?.accent??"#4f8ef7",Wo=ye.selectedSet,Yo=A.useMemo(()=>new Set(at),[at]),je=ov({mode:ve,accentColor:yr,...ne!==void 0?{nodeColor:ne}:{},...Pe!==void 0?{linkColor:Pe}:{},...Xe!==void 0?{linkWidth:Xe}:{},...le!==void 0?{nodeVal:le}:{},...ce!==void 0?{nodeRelSize:ce}:{},...e.nodePointerAreaPaint!==void 0?{nodePointerAreaPaint:e.nodePointerAreaPaint}:{},...ae!==void 0?{nodeAutoColorBy:ae}:{},...be!==void 0?{nodeVisibility:be}:{},selectedNodeSet:Wo,selectedLinkSet:Yo,highlightNeighborsOnHover:M,highlightedNodeIds:Qs,highlightedLinkIds:Js,hoverNodeId:Xs,hoverLinkId:Ks,hiddenGroups:zo}),Ut=sv({mode:ve,showLabels:zn,selectedNodeSet:Wo,hoveredNodeSet:el,accentColor:yr,...We?{hostNodeCanvasObject:We}:{},...e.nodeThreeObject?{hostNodeThreeObject:e.nodeThreeObject}:{},...ie!==void 0?{nodeLabel:ie}:{},...le!==void 0?{nodeVal:le}:{},...ce!==void 0?{nodeRelSize:ce}:{},...p?{theme:p}:{}}),_t=lv({mode:ve,showLabels:zn,selectedLinkSet:Yo,hoveredLinkSet:tl,accentColor:yr,...e.linkCanvasObject?{hostLinkCanvasObject:e.linkCanvasObject}:{},...e.linkThreeObject?{hostLinkThreeObject:e.linkThreeObject}:{},...e.linkPositionUpdate!==void 0?{hostLinkPositionUpdate:e.linkPositionUpdate}:{},...Ye!==void 0?{linkLabel:Ye}:{},...p?{theme:p}:{}}),Xo=fv({profile:Se,nodeCount:se.data.nodes.length,linkCount:se.data.links.length,mode:ve}),Ko=ve==="3d"&&(ol||In!==null),Zo=A.useMemo(()=>Ae!==void 0?Ae:p?.background&&p.background!=="transparent"?p.background:"#ffffff",[Ae,p?.background]),ll=A.useMemo(()=>{const z={...Xo,...e,dagMode:En};return z.backgroundColor===void 0&&(z.backgroundColor=Zo),z.linkColor===void 0&&(z.linkColor="rgba(96, 102, 110, 0.55)"),z.linkOpacity===void 0&&(z.linkOpacity=1),z.nodeOpacity===void 0&&(z.nodeOpacity=1),je.nodeColor!==void 0&&(z.nodeColor=je.nodeColor),je.linkColor!==void 0&&(z.linkColor=je.linkColor),je.linkWidth!==void 0&&(z.linkWidth=je.linkWidth),je.nodeVal!==void 0&&(z.nodeVal=je.nodeVal),je.nodePointerAreaPaint!==void 0&&(z.nodePointerAreaPaint=je.nodePointerAreaPaint),Ut.canvasObject&&(z.nodeCanvasObject=Ut.canvasObject,z.nodeCanvasObjectMode=()=>"after"),_t.canvasObject&&(z.linkCanvasObject=_t.canvasObject,z.linkCanvasObjectMode=()=>"after"),Ut.threeObject&&(z.nodeThreeObject=Ut.threeObject,z.nodeThreeObjectExtend=!0),_t.threeObject&&(z.linkThreeObject=_t.threeObject,z.linkThreeObjectExtend=!0,_t.positionUpdate&&(z.linkPositionUpdate=_t.positionUpdate)),z.linkHoverPrecision=ot??8,z.enableNavigationControls=Ko?!1:_e??!0,z.onNodeClick=Io,z.onNodeRightClick=Bo,z.onLinkClick=$o,z.onLinkRightClick=Ho,z.onBackgroundClick=Fo,z.onBackgroundRightClick=Vo,z.onNodeDrag=Uo,z.onNodeDragEnd=Go,z.nodeLabel=()=>"",z.linkLabel=()=>"",z.onNodeHover=Oo,z.onLinkHover=jo,g&&(z.onRenderFramePre=(Z,te)=>{Gv(Z,te,typeof g=="object"?g:{}),ee?.(Z,te)}),je.nodeVisibility&&(z.nodeVisibility=je.nodeVisibility),z},[e,En,Zo,je.nodeColor,je.linkColor,je.linkWidth,je.nodeVal,je.nodePointerAreaPaint,je.nodeVisibility,Xo,Ko,ot,_e,Io,Bo,$o,Ho,Fo,Vo,Uo,Go,Oo,jo,g,ee,Ut.canvasObject,Ut.threeObject,_t.canvasObject,_t.threeObject,_t.positionUpdate]),Fe=Vg({mount:Nt,mode:ve,width:pr,height:gr,data:se.data,props:ll,paused:Tt,...bt?{modeTransitionMs:0}:{}});Ne.current=Fe,Qe.current=()=>{Ln(null),Nn(null),mt.current=null,Et(null),qt(null)};const Qo=A.useRef(!1),Jo=se.data.nodes.length;A.useEffect(()=>{if(w&&Fe&&!Qo.current&&Jo!==0){if(Qo.current=!0,bt){const z=setTimeout(()=>Ne.current?.fit(0,40),150);return()=>clearTimeout(z)}Ne.current?.introFollow({padding:40})}},[Fe,w,Jo,bt]),rv({engine:Fe,collideNodes:N,beeswarm:I,...ce!==void 0?{nodeRelSize:ce}:{}}),A.useEffect(()=>{if(!Tn)return;const z=Ne.current;if(!z?.fitToNodes)return;const Z=new Set(ye.selected);if(at.length>0){const te=new Set(at);for(const he of se.data.links){const pe=he.id;if(pe===void 0||!te.has(pe))continue;const ue=typeof he.source=="object"?he.source.id:he.source,ge=typeof he.target=="object"?he.target.id:he.target;ue!==void 0&&Z.add(ue),ge!==void 0&&Z.add(ge)}}Z.size!==0&&z.fitToNodes([...Z],bt?0:400,60)},[Tn,ye.selected,at,se.data.links,bt]),A.useEffect(()=>{if(!Nt)return;const z=Z=>{if(!Z.shiftKey||ve!=="3d")return;const te=Ne.current;if(!te?.panBy)return;Z.preventDefault(),Z.stopPropagation();const he=te.getZoom?.()??1,pe=-Z.deltaY/4/Math.max(he,.1);te.panBy({z:pe},0)};return Nt.addEventListener("wheel",z,{capture:!0,passive:!1}),()=>{Nt.removeEventListener("wheel",z,{capture:!0})}},[Nt,ve]);const ei=A.useRef(null),mr=A.useCallback(()=>JSON.stringify({nodes:se.data.nodes.map(z=>{const{vx:Z,vy:te,vz:he,index:pe,_neighbors:ue,_links:ge,__threeObj:Ue,__indexColor:dt,__initialFixedPos:Re,__initialPos:Je,__disposeControlsAfterDrag:ht,__dragCommitted:Gt,__dragged:ni,...cn}=z;return cn}),links:se.data.links.map(z=>{const Z=z,te=typeof Z.source=="object"&&Z.source!==null?Z.source.id:Z.source,he=typeof Z.target=="object"&&Z.target!==null?Z.target.id:Z.target,{source:pe,target:ue,__lineObj:ge,__arrowObj:Ue,__photonObjs:dt,__indexColor:Re,index:Je,...ht}=Z;return{...ht,source:te,target:he}})},null,2),[se.data]),ti=A.useCallback(z=>{const Z=JSON.parse(z);if(!Z||!Array.isArray(Z.nodes)||!Array.isArray(Z.links))throw new Error("invalid graph JSON");se.setData(Z),ye.clear(),ft([])},[se,ye]),br=A.useCallback((z=`graph-${Date.now()}.json`)=>{const Z=new Blob([mr()],{type:"application/json"});Vs(Z,z)},[mr]),cl=A.useCallback(z=>{switch(z){case"select":case"pan":case"add-node":case"add-link":Ct(z);break;case"delete":st.requestMixedDelete(ye.selected,at,"toolbar");break;case"duplicate":Te.duplicate();break;case"select-all":ye.set(se.data.nodes.map(Z=>Z.id)),ft(se.data.links.map(Z=>Z.id).filter(Z=>Z!==void 0));break;case"fit":Fe?.fit(400,40);break;case"zoom-in":Fe&&Fe.zoom((Fe.getZoom?.()??1)*1.2,200);break;case"zoom-out":Fe&&Fe.zoom((Fe.getZoom?.()??1)/1.2,200);break;case"pause":dr(!0);break;case"resume":dr(!1);break;case"screenshot":Yv(Fe?.getCanvasElement());break;case"export-json":br();break;case"import-json":ei.current?.click();break;case"toggle-mode":it(ve==="2d"?"3d":"2d");break}},[Fe,se,ye,ve,it,at,Te,br,st]);nv({engine:Fe,dataApi:se,deleteGate:st,selection:ye,mode:ve,setMode:it,selectedLinkIds:at,setSelectedLinkIds:ft,setLinkSourceId:Et,setActiveTool:Ct,enableClipboard:_,copy:Te.copy,cut:Te.cut,paste:Te.paste,duplicate:Te.duplicate,addConnectedNode:Te.addConnectedNode,togglePin:Te.togglePin,hostRef:Lt}),dv({ref:t,dataApi:se,deleteGate:st,selection:ye,engine:Fe,mode:ve,setMode:it,setPaused:dr,clipboard:Te,exportJSON:mr,importJSON:ti,downloadJSON:br,selectedLinkIds:at});const ul=A.useMemo(()=>({position:"relative",width:s??"100%",height:u??"100%",...Wv(p),...c}),[s,u,p,c]),fl=A.useMemo(()=>[{id:"focus-on-click",kind:"toggle",label:"Click to focus",hint:"Animate the camera to a clicked node; click again to restore.",checked:Ht,onChange:To},{id:"show-labels",kind:"toggle",label:"Always show labels",hint:"Draw every node + link label on the canvas, not just the selected ones. 2D only.",checked:zn,onChange:Eo},{id:"fit-on-select",kind:"toggle",label:"Fit to selection",hint:"Animate the camera to frame the current selection whenever it changes.",checked:Tn,onChange:Lo},{kind:"select",id:"dag-mode",label:"DAG orientation",hint:"Force a hierarchical / radial layout.",value:En??"null",options:[{value:"null",label:"off"},{value:"td",label:"td (top-down)"},{value:"bu",label:"bu (bottom-up)"},{value:"lr",label:"lr (left-right)"},{value:"rl",label:"rl (right-left)"},{value:"radialout"},{value:"radialin"}],onChange:z=>No(z==="null"?null:z)}],[Ht,zn,Tn,En]);return R.jsxs("div",{ref:Lt,className:["lora-graph-canvas",f??""].join(" ").trim(),style:ul,"data-mode":ve,"data-tool":qe,"data-paused":Tt?"true":void 0,tabIndex:0,role:"application","aria-label":"Graph canvas",children:[R.jsx("div",{ref:al,className:"lgc-engine-mount"}),R.jsx(zv,{config:h,activeTool:qe,paused:Tt,mode:ve,onSelect:cl}),h!==!1?R.jsxs(R.Fragment,{children:[R.jsx(Uv,{items:fl}),R.jsx(Hv,{mode:ve,onToggle:()=>it(ve==="2d"?"3d":"2d")})]}):null,Dn?R.jsx(Tv,{x:Dn.x,y:Dn.y,items:Dn.items,onClose:()=>qt(null)}):null,x?R.jsx(Lv,{content:nl,hostRef:Lt}):null,R.jsx(Nv,{rect:In,...In?.count!==void 0?{count:In.count}:{}}),v&&ae?R.jsx($v,{nodes:se.data.nodes,groupBy:ae,hidden:zo,onToggle:z=>rl(Z=>{const te=new Set(Z);return te.has(z)?te.delete(z):te.add(z),te})}):null,R.jsx(Iv,{nodeCount:ye.selected.length,linkCount:at.length,hasClipboard:Te.hasClipboard(),enableClipboard:_,onDelete:()=>{st.requestMixedDelete(ye.selected,at,"selectionPanel")},onDuplicate:()=>Te.duplicate(),onAddConnected:()=>Te.addConnectedNode(),onCopy:()=>Te.copy(),onCut:()=>Te.cut(),onPaste:()=>Te.paste(),onClear:()=>{ye.clear(),ft([])}}),R.jsx("input",{ref:ei,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:z=>{const Z=z.target.files?.[0];Z&&(Z.text().then(ti).catch(te=>{console.error("[lora-graph-canvas] import failed:",te)}),z.target.value="")}})]})}const Ws=A.forwardRef(Xv);Ws.displayName="LoraGraphCanvas";const Kv={background:"#ffffff",foreground:"#1c1f23",border:"#d8dde3",accent:"#4f8ef7",toolbarBackground:"rgba(255, 255, 255, 0.92)",toolbarForeground:"#1c1f23",toolbarBorder:"#d8dde3",toolActiveBackground:"rgba(79, 142, 247, 0.18)",toolHoverBackground:"rgba(0, 0, 0, 0.05)",tooltipBackground:"rgba(28, 31, 35, 0.9)",tooltipForeground:"#ffffff",menuBackground:"#ffffff",menuForeground:"#1c1f23",menuHoverBackground:"rgba(0, 0, 0, 0.06)"},Zv={background:"#101216",foreground:"#e6e9ee",border:"#2a2f37",accent:"#6aa3ff",toolbarBackground:"rgba(20, 23, 28, 0.92)",toolbarForeground:"#e6e9ee",toolbarBorder:"#2a2f37",toolActiveBackground:"rgba(106, 163, 255, 0.25)",toolHoverBackground:"rgba(255, 255, 255, 0.08)",tooltipBackground:"rgba(240, 240, 240, 0.92)",tooltipForeground:"#101216",menuBackground:"#161a20",menuForeground:"#e6e9ee",menuHoverBackground:"rgba(255, 255, 255, 0.08)"};exports.DEFAULT_TOOL_ORDER=io;exports.LoraGraphCanvas=Ws;exports.TOOL_DESCRIPTORS=Us;exports.createId=It;exports.darkTheme=Zv;exports.lightTheme=Kv;
685
685
  //# sourceMappingURL=index.cjs.map