@loradb/lora-graph-canvas 0.11.4 → 0.14.0
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/hooks/useAccessorOverrides.d.ts +9 -0
- package/dist/index.cjs +34 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3248 -3186
- package/dist/index.js.map +1 -1
- package/dist/theme/palette.d.ts +26 -0
- package/dist/tools/GroupLegend.d.ts +5 -2
- package/dist/types.d.ts +12 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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",`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("react/jsx-runtime"),A=require("react"),ae=require("three"),wl=require("three/examples/jsm/controls/DragControls.js"),kl=require("three/webgpu"),Cl=require("three/examples/jsm/controls/TrackballControls.js"),Sl=require("three/examples/jsm/controls/OrbitControls.js"),Ml=require("three/examples/jsm/controls/FlyControls.js"),Pl=require("three/examples/jsm/postprocessing/EffectComposer.js"),Al=require("three/examples/jsm/postprocessing/RenderPass.js"),ci=new Map,Ol=Math.floor(Math.random()*1e3);function It(e="n"){const t=(ci.get(e)??Ol)+1;return ci.set(e,t),`${e}_${t.toString(36)}`}const jl={nodes:[],links:[]},Tl=["x","y","z","vx","vy","vz","index","_neighbors","_links"];function ui(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)Tl.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 zl(e){const t=e.controlled!==void 0,n=A.useCallback(x=>{for(const _ of x.links)_.id===void 0&&(_.id=It("l"));return x},[]),r=A.useCallback(x=>{let _=!1;const w=x.links.map(b=>b.id!==void 0?b:(_=!0,{...b,id:It("l")}));return _?{nodes:x.nodes,links:w}:x},[]),[o,i]=A.useState(()=>e.defaultData!==void 0?n(ui(e.defaultData)):e.controlled!==void 0?r(ui(e.controlled)):jl);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(x=>{a.current=x,t||i(x),l.current?.(x)},[t]),u=A.useCallback(x=>s(t?r(x):n(x)),[s,n,r,t]),f=A.useCallback((x,_)=>{const w=x?.id??It("n"),b={...x??{},id:w,..._?.at??{}},M={nodes:[...a.current.nodes,b],links:a.current.links};return s(M),b},[s]),c=A.useCallback(x=>{const _=x.map(b=>({...b,id:b.id??It("n")})),w={nodes:[...a.current.nodes,..._],links:a.current.links};return s(w),_},[s]),p=A.useCallback((x,_)=>{const w=a.current.nodes.map(b=>b.id===x?{...b,..._}:b);s({nodes:w,links:a.current.links})},[s]),h=A.useCallback(x=>{const _=a.current,w=_.nodes.filter(M=>M.id!==x),b=_.links.filter(M=>{const P=typeof M.source=="object"?M.source?.id:M.source,L=typeof M.target=="object"?M.target?.id:M.target;return P!==x&&L!==x});s({nodes:w,links:b})},[s]),d=A.useCallback(x=>{const _=new Set(x),w=a.current,b=w.nodes.filter(P=>!_.has(P.id)),M=w.links.filter(P=>{const L=typeof P.source=="object"?P.source?.id:P.source,j=typeof P.target=="object"?P.target?.id:P.target;return L!==void 0&&j!==void 0&&!_.has(L)&&!_.has(j)});s({nodes:b,links:M})},[s]),m=A.useCallback(x=>{const _={id:It("l"),...x};return s({nodes:a.current.nodes,links:[...a.current.links,_]}),_},[s]),v=A.useCallback(x=>{const _=x.map(w=>({id:It("l"),...w}));return s({nodes:a.current.nodes,links:[...a.current.links,..._]}),_},[s]),g=A.useCallback(x=>{const _=a.current.links.filter(w=>!x(w));s({nodes:a.current.nodes,links:_})},[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 El(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 Ll(e){const t=+this._x.call(null,e);return ma(this.cover(t),t,e)}function ma(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 Dl(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)ma(this,n[i],e[i]);return this}function Nl(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 Rl(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Il(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 Fl(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 Bl(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 $l(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Hl(){return this._root}function Ul(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function ql(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 Vl(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 Gl(e){return e[0]}function Wl(e){return arguments.length?(this._x=e,this):this._x}function co(e,t){var n=new uo(t??Gl,NaN,NaN);return e==null?n:n.addAll(e)}function uo(e,t,n){this._x=e,this._x0=t,this._x1=n,this._root=void 0}function fi(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var We=co.prototype=uo.prototype;We.copy=function(){var e=new uo(this._x,this._x0,this._x1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=fi(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]=fi(r));return e};We.add=Ll;We.addAll=Dl;We.cover=Nl;We.data=Rl;We.extent=Il;We.find=Fl;We.remove=Bl;We.removeAll=$l;We.root=Hl;We.size=Ul;We.visit=ql;We.visitAfter=Vl;We.x=Wl;function Yl(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return ba(this.cover(t,n),t,n,e)}function ba(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 Xl(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)ba(this,a[n],l[n],e[n]);return this}function Kl(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 Zl(){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]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function $e(e,t,n,r,o){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=o}function Jl(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 $e(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 $e(h[3],v,g,s,u),new $e(h[2],a,g,v,u),new $e(h[1],v,l,s,g),new $e(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),x=t-+this._y.call(null,h.data),_=S*S+x*x;if(_<n){var w=Math.sqrt(n=_);o=e-w,i=t-w,f=e+w,c=t+w,r=h.data}}return r}function ec(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 tc(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function nc(){return this._root}function rc(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function oc(e){var t=[],n,r=this._root,o,i,a,l,s;for(r&&t.push(new $e(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 $e(o,u,f,l,s)),(o=r[2])&&t.push(new $e(o,i,f,u,s)),(o=r[1])&&t.push(new $e(o,u,a,l,f)),(o=r[0])&&t.push(new $e(o,i,a,u,f))}return this}function ic(e){var t=[],n=[],r;for(this._root&&t.push(new $e(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 $e(i,a,l,f,c)),(i=o[1])&&t.push(new $e(i,f,l,s,c)),(i=o[2])&&t.push(new $e(i,a,c,f,u)),(i=o[3])&&t.push(new $e(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 ac(e){return e[0]}function sc(e){return arguments.length?(this._x=e,this):this._x}function lc(e){return e[1]}function cc(e){return arguments.length?(this._y=e,this):this._y}function fo(e,t,n){var r=new ho(t??ac,n??lc,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function ho(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 di(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var He=fo.prototype=ho.prototype;He.copy=function(){var e=new ho(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=di(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]=di(r));return e};He.add=Yl;He.addAll=Xl;He.cover=Kl;He.data=Zl;He.extent=Ql;He.find=Jl;He.remove=ec;He.removeAll=tc;He.root=nc;He.size=rc;He.visit=oc;He.visitAfter=ic;He.x=sc;He.y=cc;function uc(e){const t=+this._x.call(null,e),n=+this._y.call(null,e),r=+this._z.call(null,e);return _a(this.cover(t,n,r),t,n,r,e)}function _a(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((_=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|_]))return i[M]=l,e;if(g=+e._x.call(null,a.data),S=+e._y.call(null,a.data),x=+e._z.call(null,a.data),t===g&&n===S&&r===x)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),(_=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|_)===(P=(x>=v)<<2|(S>=m)<<1|g>=d));return i[P]=a,i[M]=l,e}function fc(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)_a(this,n[c],r[c],o[c],e[c]);return this}function dc(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 hc(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function pc(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 be(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 gc(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 be(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);x=g.pop();)if(!(!(S=x.node)||(s=x.x0)>d||(u=x.y0)>m||(f=x.z0)>v||(c=x.x1)<i||(p=x.y1)<a||(h=x.z1)<l))if(S.length){var w=(s+c)/2,b=(u+p)/2,M=(f+h)/2;g.push(new be(S[7],w,b,M,c,p,h),new be(S[6],s,b,M,w,p,h),new be(S[5],w,u,M,c,b,h),new be(S[4],s,u,M,w,b,h),new be(S[3],w,b,f,c,p,M),new be(S[2],s,b,f,w,p,M),new be(S[1],w,u,f,c,b,M),new be(S[0],s,u,f,w,b,M)),(_=(n>=M)<<2|(t>=b)<<1|e>=w)&&(x=g[g.length-1],g[g.length-1]=g[g.length-1-_],g[g.length-1-_]=x)}else{var P=e-+this._x.call(null,S.data),L=t-+this._y.call(null,S.data),j=n-+this._z.call(null,S.data),I=P*P+L*L+j*j;if(I<r){var R=Math.sqrt(r=I);i=e-R,a=t-R,l=n-R,d=e+R,m=t+R,v=n+R,o=S.data}}return o}const vc=(e,t,n,r,o,i)=>Math.sqrt((e-r)**2+(t-o)**2+(n-i)**2);function yc(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;vc(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 mc(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,(x=h>=(v=(l+f)/2))?l=v:f=v,(_=d>=(g=(s+c)/2))?s=g:c=g,t=n,!(n=n[w=_<<2|x<<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 bc(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function _c(){return this._root}function xc(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function wc(e){var t=[],n,r=this._root,o,i,a,l,s,u,f;for(r&&t.push(new be(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 be(o,c,p,h,s,u,f)),(o=r[6])&&t.push(new be(o,i,p,h,c,u,f)),(o=r[5])&&t.push(new be(o,c,a,h,s,p,f)),(o=r[4])&&t.push(new be(o,i,a,h,c,p,f)),(o=r[3])&&t.push(new be(o,c,p,l,s,u,h)),(o=r[2])&&t.push(new be(o,i,p,l,c,u,h)),(o=r[1])&&t.push(new be(o,c,a,l,s,p,h)),(o=r[0])&&t.push(new be(o,i,a,l,c,p,h))}return this}function kc(e){var t=[],n=[],r;for(this._root&&t.push(new be(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 be(i,a,l,s,p,h,d)),(i=o[1])&&t.push(new be(i,p,l,s,u,h,d)),(i=o[2])&&t.push(new be(i,a,h,s,p,f,d)),(i=o[3])&&t.push(new be(i,p,h,s,u,f,d)),(i=o[4])&&t.push(new be(i,a,l,d,p,h,c)),(i=o[5])&&t.push(new be(i,p,l,d,u,h,c)),(i=o[6])&&t.push(new be(i,a,h,d,p,f,c)),(i=o[7])&&t.push(new be(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 Cc(e){return e[0]}function Sc(e){return arguments.length?(this._x=e,this):this._x}function Mc(e){return e[1]}function Pc(e){return arguments.length?(this._y=e,this):this._y}function Ac(e){return e[2]}function Oc(e){return arguments.length?(this._z=e,this):this._z}function po(e,t,n,r){var o=new go(t??Cc,n??Mc,r??Ac,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function go(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 hi(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Ne=po.prototype=go.prototype;Ne.copy=function(){var e=new go(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=hi(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]=hi(r));return e};Ne.add=uc;Ne.addAll=fc;Ne.cover=dc;Ne.data=hc;Ne.extent=pc;Ne.find=gc;Ne.findAllWithinRadius=yc;Ne.remove=mc;Ne.removeAll=bc;Ne.root=_c;Ne.size=xc;Ne.visit=wc;Ne.visitAfter=kc;Ne.x=Sc;Ne.y=Pc;Ne.z=Oc;function Ae(e){return function(){return e}}function rt(e){return(e()-.5)*1e-6}function kr(e){return e.x+e.vx}function pi(e){return e.y+e.vy}function jc(e){return e.z+e.vz}function gi(e){var t,n,r,o,i=1,a=1;typeof e!="function"&&(e=Ae(e==null?1:+e));function l(){for(var f,c=t.length,p,h,d,m,v,g,S,x=0;x<a;++x)for(p=(n===1?co(t,kr):n===2?fo(t,kr,pi):n===3?po(t,kr,pi,jc):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(_);function _(w,b,M,P,L,j,I){var R=[b,M,P,L,j,I],W=R[0],O=R[1],y=R[2],k=R[n],C=R[n+1],$=R[n+2],B=w.data,G=w.r,E=g+G;if(B){if(B.index>h.index){var N=d-B.x-B.vx,U=n>1?m-B.y-B.vy:0,q=n>2?v-B.z-B.vz:0,z=N*N+U*U+q*q;z<E*E&&(N===0&&(N=rt(o),z+=N*N),n>1&&U===0&&(U=rt(o),z+=U*U),n>2&&q===0&&(q=rt(o),z+=q*q),z=(E-(z=Math.sqrt(z)))/z*i,h.vx+=(N*=z)*(E=(G*=G)/(S+G)),n>1&&(h.vy+=(U*=z)*E),n>2&&(h.vz+=(q*=z)*E),B.vx-=N*(E=1-E),n>1&&(B.vy-=U*E),n>2&&(B.vz-=q*E))}return}return W>d+E||k<d-E||n>1&&(O>m+E||C<m-E)||n>2&&(y>v+E||$<v-E)}}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:Ae(+f),u(),l):e},l}function Tc(e){return e.index}function vi(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}function zc(e){var t=Tc,n=p,r,o=Ae(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,x=e.length;S<c;++S)for(var _=0,w,b,M,P=0,L=0,j=0,I,R;_<x;++_)w=e[_],b=w.source,M=w.target,P=M.x+M.vx-b.x-b.vx||rt(f),l>1&&(L=M.y+M.vy-b.y-b.vy||rt(f)),l>2&&(j=M.z+M.vz-b.z-b.vz||rt(f)),I=Math.sqrt(P*P+L*L+j*j),I=(I-i[_])/I*g*r[_],P*=I,L*=I,j*=I,M.vx-=P*(R=u[_]),l>1&&(M.vy-=L*R),l>2&&(M.vz-=j*R),b.vx+=P*(R=1-R),l>1&&(b.vy+=L*R),l>2&&(b.vz+=j*R)}function d(){if(a){var g,S=a.length,x=e.length,_=new Map(a.map((b,M)=>[t(b,M,a),b])),w;for(g=0,s=new Array(S);g<x;++g)w=e[g],w.index=g,typeof w.source!="object"&&(w.source=vi(_,w.source)),typeof w.target!="object"&&(w.target=vi(_,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(x);g<x;++g)w=e[g],u[g]=s[w.source.index]/(s[w.source.index]+s[w.target.index]);r=new Array(x),m(),i=new Array(x),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(x=>typeof x=="function")||Math.random,l=S.find(x=>[1,2,3].includes(x))||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:Ae(+g),m(),h):n},h.distance=function(g){return arguments.length?(o=typeof g=="function"?g:Ae(+g),v(),h):o},h}var Ec={value:()=>{}};function xa(){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 Gn(n)}function Gn(e){this._=e}function Lc(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}})}Gn.prototype=xa.prototype={constructor:Gn,on:function(e,t){var n=this._,r=Lc(e+"",n),o,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((o=(e=r[i]).type)&&(o=Dc(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]=yi(n[o],e.name,t);else if(t==null)for(o in n)n[o]=yi(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 Gn(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 Dc(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function yi(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=Ec,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,wa=1e3,Xn,bn,Kn=0,$t=0,sr=0,Sn=typeof performance=="object"&&performance.now?performance:Date,ka=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Ca(){return $t||(ka(Nc),$t=Sn.now()+sr)}function Nc(){$t=0}function Hr(){this._call=this._time=this._next=null}Hr.prototype=Sa.prototype={constructor:Hr,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Ca():+n)+(t==null?0:+t),!this._next&&bn!==this&&(bn?bn._next=this:Xn=this,bn=this),this._call=e,this._time=n,Ur()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ur())}};function Sa(e,t,n){var r=new Hr;return r.restart(e,t,n),r}function Rc(){Ca(),++Jt;for(var e=Xn,t;e;)(t=$t-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Jt}function mi(){$t=(Kn=Sn.now())+sr,Jt=mn=0;try{Rc()}finally{Jt=0,Fc(),$t=0}}function Ic(){var e=Sn.now(),t=e-Kn;t>wa&&(sr-=t,Kn=e)}function Fc(){for(var e,t=Xn,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:Xn=n);bn=e,Ur(r)}function Ur(e){if(!Jt){mn&&(mn=clearTimeout(mn));var t=e-$t;t>24?(e<1/0&&(mn=setTimeout(mi,e-Sn.now()-sr)),un&&(un=clearInterval(un))):(un||(Kn=Sn.now(),un=setInterval(Ic,wa)),Jt=1,ka(mi))}}const Bc=1664525,$c=1013904223,bi=4294967296;function Hc(){let e=1;return()=>(e=(Bc*e+$c)%bi)/bi}var _i=3;function Cr(e){return e.x}function xi(e){return e.y}function Uc(e){return e.z}var qc=10,Vc=Math.PI*(3-Math.sqrt(5)),Gc=Math.PI*20/(9+Math.sqrt(221));function Wc(e,t){t=t||2;var n=Math.min(_i,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=Sa(h),c=xa("tick","end"),p=Hc();e==null&&(e=[]);function h(){d(),c.call("tick",r),o<i&&(f.stop(),c.call("end",r))}function d(g){var S,x=e.length,_;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<x;++S)_=e[S],_.fx==null?_.x+=_.vx*=s:(_.x=_.fx,_.vx=0),n>1&&(_.fy==null?_.y+=_.vy*=s:(_.y=_.fy,_.vy=0)),n>2&&(_.fz==null?_.z+=_.vz*=s:(_.z=_.fz,_.vz=0));return r}function m(){for(var g=0,S=e.length,x;g<S;++g){if(x=e[g],x.index=g,x.fx!=null&&(x.x=x.fx),x.fy!=null&&(x.y=x.fy),x.fz!=null&&(x.z=x.fz),isNaN(x.x)||n>1&&isNaN(x.y)||n>2&&isNaN(x.z)){var _=qc*(n>2?Math.cbrt(.5+g):n>1?Math.sqrt(.5+g):g),w=g*Vc,b=g*Gc;n===1?x.x=_:n===2?(x.x=_*Math.cos(w),x.y=_*Math.sin(w)):(x.x=_*Math.sin(w)*Math.cos(b),x.y=_*Math.cos(w),x.z=_*Math.sin(w)*Math.sin(b))}(isNaN(x.vx)||n>1&&isNaN(x.vy)||n>2&&isNaN(x.vz))&&(x.vx=0,n>1&&(x.vy=0),n>2&&(x.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(_i,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,x=(n>1?g.shift():null)||0,_=(n>2?g.shift():null)||0,w=g.shift()||1/0,b=0,M=e.length,P,L,j,I,R,W;for(w*=w,b=0;b<M;++b)R=e[b],P=S-R.x,L=x-(R.y||0),j=_-(R.z||0),I=P*P+L*L+j*j,I<w&&(W=R,w=I);return W},on:function(g,S){return arguments.length>1?(c.on(g,S),r):c.on(g)}}}function Yc(){var e,t,n,r,o,i=Ae(-30),a,l=1,s=1/0,u=.81;function f(d){var m,v=e.length,g=(t===1?co(e,Cr):t===2?fo(e,Cr,xi):t===3?po(e,Cr,xi,Uc):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,x+=g*(v.x||0),_+=g*(v.y||0),w+=g*(v.z||0));m*=Math.sqrt(4/M),d.x=x/S,t>1&&(d.y=_/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 x=[v,g,S][t-1],_=d.x-n.x,w=t>1?d.y-n.y:0,b=t>2?d.z-n.z:0,M=x-m,P=_*_+w*w+b*b;if(M*M/u<P)return P<s&&(_===0&&(_=rt(r),P+=_*_),t>1&&w===0&&(w=rt(r),P+=w*w),t>2&&b===0&&(b=rt(r),P+=b*b),P<l&&(P=Math.sqrt(l*P)),n.vx+=_*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)&&(_===0&&(_=rt(r),P+=_*_),t>1&&w===0&&(w=rt(r),P+=w*w),t>2&&b===0&&(b=rt(r),P+=b*b),P<l&&(P=Math.sqrt(l*P)));do d.data!==n&&(M=a[d.data.index]*o/P,n.vx+=_*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:Ae(+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 Xc(e,t,n,r){var o,i,a=Ae(.1),l,s;typeof e!="function"&&(e=Ae(+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),x=(s[p]-S)*l[p]*c/S;d.vx+=m*x,i>1&&(d.vy+=v*x),i>2&&(d.vz+=g*x)}}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:Ae(+c),f(),u):a},u.radius=function(c){return arguments.length?(e=typeof c=="function"?c:Ae(+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 wi(e){var t=Ae(.1),n,r,o;typeof e!="function"&&(e=Ae(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:Ae(+l),a(),i):t},i.x=function(l){return arguments.length?(e=typeof l=="function"?l:Ae(+l),a(),i):e},i}function ki(e){var t=Ae(.1),n,r,o;typeof e!="function"&&(e=Ae(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:Ae(+l),a(),i):t},i.y=function(l){return arguments.length?(e=typeof l=="function"?l:Ae(+l),a(),i):e},i}function Ma(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Kc(e){Qc(e);const t=Zc(e);return e.on=t.on,e.off=t.off,e.fire=t.fire,e}function Zc(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 Qc(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 vo=Kc;const Jc=Ma(vo);function eu(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={},o=0,i=e.multigraph?x
|
|
4
|
-
`,l=Array(i+1).join(" "),s=[];for(let u=0;u<t;++u){let f=
|
|
5
|
-
${
|
|
6
|
-
${
|
|
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:G,forEachLinkedNode:O,forEachLink:W,beginUpdate:u,endUpdate:f,clear:R,hasLink:j,hasNode:v,getLink:j,getLinkById:I};return Jc(c),p(),c;function p(){var E=c.on;c.on=N;function N(){return c.beginUpdate=u=$,c.endUpdate=f=B,l=h,s=d,c.on=E,E.apply(c,arguments)}}function h(E,N){a.push({link:E,changeType:N})}function d(E,N){a.push({node:E,changeType:N})}function m(E,N){if(E===void 0)throw new Error("Invalid node identifier");u();var U=v(E);return U?(U.data=N,s(U,"update")):(U=new tu(E,N),s(U,"add")),t.set(E,U),f(),U}function v(E){return t.get(E)}function g(E){var N=v(E);if(!N)return!1;u();var U=N.links;return U&&(U.forEach(L),N.links=null),t.delete(E),s(N,"remove"),f(),!0}function S(E,N,U){u();var q=v(E)||m(E),z=v(N)||m(N),H=i(E,N,U),F=n.has(H.id);return n.set(H.id,H),Ci(q,H),E!==N&&Ci(z,H),l(H,F?"update":"add"),f(),H}function x(E,N,U){var q=$n(E,N),z=n.get(q);return z?(z.data=U,z):new Si(E,N,U,q)}function _(E,N,U){var q=$n(E,N),z=r.hasOwnProperty(q);if(z||j(E,N)){z||(r[q]=0);var H="@"+ ++r[q];q=$n(E+H,N+H)}return new Si(E,N,U,q)}function w(){return t.size}function b(){return n.size}function M(E){var N=v(E);return N?N.links:null}function P(E,N){return N!==void 0&&(E=j(E,N)),L(E)}function L(E){if(!E||!n.get(E.id))return!1;u(),n.delete(E.id);var N=v(E.fromId),U=v(E.toId);return N&&N.links.delete(E),U&&U.links.delete(E),l(E,"remove"),f(),!0}function j(E,N){if(!(E===void 0||N===void 0))return n.get($n(E,N))}function I(E){if(E!==void 0)return n.get(E)}function R(){u(),G(function(E){g(E.id)}),f()}function W(E){if(typeof E=="function")for(var N=n.values(),U=N.next();!U.done;){if(E(U.value))return!0;U=N.next()}}function O(E,N,U){var q=v(E);if(q&&q.links&&typeof N=="function")return U?k(q.links,E,N):y(q.links,E,N)}function y(E,N,U){for(var q,z=E.values(),H=z.next();!H.done;){var F=H.value,ee=F.fromId===N?F.toId:F.fromId;if(q=U(t.get(ee),F),q)return!0;H=z.next()}}function k(E,N,U){for(var q,z=E.values(),H=z.next();!H.done;){var F=H.value;if(F.fromId===N&&(q=U(t.get(F.toId),F),q))return!0;H=z.next()}}function C(){}function $(){o+=1}function B(){o-=1,o===0&&a.length>0&&(c.fire("changed",a),a.length=0)}function G(E){if(typeof E!="function")throw new Error("Function is expected to iterate over graph nodes. You passed "+E);for(var N=t.values(),U=N.next();!U.done;){if(E(U.value))return!0;U=N.next()}}}function tu(e,t){this.id=e,this.links=null,this.data=t}function Ci(e,t){e.links?e.links.add(t):e.links=new Set([t])}function Si(e,t,n,r){this.fromId=e,this.toId=t,this.data=n,this.id=r}function $n(e,t){return e.toString()+"👉 "+t.toString()}var yo={exports:{}},An={exports:{}},Pa=function(t){return t===0?"x":t===1?"y":t===2?"z":"c"+(t+1)};const nu=Pa;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=nu(u),c=u===0?"":l;s.push(c+r.replace(/{var}/g,f))}return s.join(a)}};const Aa=on;An.exports=ru;An.exports.generateCreateBodyFunctionBody=Oa;An.exports.getVectorCode=Ta;An.exports.getBodyCode=ja;function ru(e,t){let n=Oa(e,t),{Body:r}=new Function(n)();return r}function Oa(e,t){return`
|
|
5
|
+
${Ta(e,t)}
|
|
6
|
+
${ja(e)}
|
|
7
7
|
return {Body: Body, Vector: Vector};
|
|
8
|
-
`}function
|
|
8
|
+
`}function ja(e){let t=Aa(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
|
|
28
|
+
};`}function Ta(e,t){let n=Aa(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
|
|
51
|
-
${
|
|
50
|
+
};`}var ou=An.exports,Ot={exports:{}};const mo=on,St=Pa;Ot.exports=iu;Ot.exports.generateQuadTreeFunctionBody=za;Ot.exports.getInsertStackCode=Ra;Ot.exports.getQuadNodeCode=Na;Ot.exports.isSamePosition=Ea;Ot.exports.getChildBodyCode=Da;Ot.exports.setChildBodyCode=La;function iu(e){let t=za(e);return new Function(t)()}function za(e){let t=mo(e),n=Math.pow(2,e);return`
|
|
51
|
+
${Ra()}
|
|
52
|
+
${Na(e)}
|
|
52
53
|
${Ea(e)}
|
|
53
|
-
${
|
|
54
|
-
${
|
|
55
|
-
${za(e)}
|
|
54
|
+
${Da(e)}
|
|
55
|
+
${La(e)}
|
|
56
56
|
|
|
57
57
|
function createQuadTree(options, random) {
|
|
58
58
|
options = options || {};
|
|
@@ -293,21 +293,21 @@ return createQuadTree;
|
|
|
293
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
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
295
|
`)}function a(l){let s=[];for(let u=0;u<n;++u)s.push(`${l}quad${u} = null;`);return s.join(`
|
|
296
|
-
`)}}function
|
|
296
|
+
`)}}function Ea(e){let t=mo(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
|
|
302
|
+
`}function La(e){var t=Math.pow(2,e);return`
|
|
303
303
|
function setChild(node, idx, child) {
|
|
304
304
|
${n()}
|
|
305
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
|
|
306
|
+
`)}}function Da(e){return`function getChild(node, idx) {
|
|
307
307
|
${t()}
|
|
308
308
|
return null;
|
|
309
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
|
|
310
|
+
`)}}function Na(e){let t=mo(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:
|
|
@@ -330,7 +330,7 @@ ${o(" this.")}
|
|
|
330
330
|
${t("this.max_{var} = 0;",{indent:2})}
|
|
331
331
|
}
|
|
332
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
|
|
333
|
+
`)}}function Ra(){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
|
|
374
|
+
`}var au=Ot.exports,bo={exports:{}};bo.exports=lu;bo.exports.generateFunctionBody=Ia;const su=on;function lu(e){let t=Ia(e);return new Function("bodies","settings","random",t)}function Ia(e){let t=su(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
|
|
428
|
+
`}var cu=bo.exports,_o={exports:{}};const uu=on;_o.exports=fu;_o.exports.generateCreateDragForceFunctionBody=Fa;function fu(e){let t=Fa(e);return new Function("options",t)}function Fa(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
|
-
${
|
|
433
|
+
${uu(e)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}
|
|
434
434
|
}
|
|
435
435
|
};
|
|
436
|
-
`}var
|
|
436
|
+
`}var du=_o.exports,xo={exports:{}};const hu=on;xo.exports=pu;xo.exports.generateCreateSpringForceFunctionBody=Ba;function pu(e){let t=Ba(e);return new Function("options","random",t)}function Ba(e){let t=hu(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
|
|
468
|
+
`}var gu=xo.exports,wo={exports:{}};const vu=on;wo.exports=yu;wo.exports.generateIntegratorFunctionBody=$a;function yu(e){let t=$a(e);return new Function("bodies","timeStep","adaptiveTimeStepWeight",t)}function $a(e){let t=vu(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 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
|
|
504
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
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
|
|
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 }).
|
|
502
|
+
`}var mu=wo.exports,Sr,Mi;function bu(){if(Mi)return Sr;Mi=1,Sr=e;function e(t,n,r,o){this.from=t,this.to=n,this.length=r,this.coefficient=o}return Sr}var Mr,Pi;function _u(){if(Pi)return Mr;Pi=1,Mr=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 Mr}var fn={exports:{}},Ai;function xu(){if(Ai)return fn.exports;Ai=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 Ha=Au,wu=ou,ku=au,Cu=cu,Su=du,Mu=gu,Pu=mu,Oi={};function Au(e){var t=bu(),n=_u(),r=vo;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=Oi[e.dimensions];if(!o){var i=e.dimensions;o={Body:wu(i,e.debug),createQuadTree:ku(i),createBounds:Cu(i),createDragForce:Su(i),createSpringForce:Mu(i),integrate:Pu(i)},Oi[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=xu().random(42),d=[],m=[],v=l(e,h),g=s(d,e,h),S=f(e,h),x=u(e),_=0,w=[],b=new Map,M=0;j("nbody",W),j("spring",O);var P={bodies:d,quadTree:v,springs:m,settings:e,addForce:j,removeForce:I,getForces:R,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 _},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:L,getBoundingBox:L,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 Ou(e,P),r(P),P;function L(){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 I(y){var k=w.indexOf(b.get(y));k<0||(w.splice(k,1),b.delete(y))}function R(){return b}function W(){if(d.length!==0){v.insertBodies(d);for(var y=d.length;y--;){var k=d[y];k.isPinned||(k.reset(),v.updateBodyForce(k),x.update(k))}}}function O(){for(var y=m.length;y--;)S.update(m[y])}}function Ou(e,t){for(var n in e)ju(e,t,n)}function ju(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]}}}yo.exports=zu;yo.exports.simulator=Ha;var Tu=vo;function zu(e,t){if(!e)throw new Error("Graph structure cannot be undefined");var n=t&&t.createSimulator||Ha,r=n(t);if(Array.isArray(t))throw new Error("Physics settings is expected to be an object");var o=e.version>19?W:R;t&&typeof t.nodeMass=="function"&&(o=t.nodeMass);var i=new Map,a={},l=0,s=r.settings.springTransform||Eu;x(),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 I(O).pos},setNodePosition:function(O){var y=I(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=I(O.id);k.isPinned=!!y},isNodePinned:function(O){return I(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 Tu(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&&_(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 x(){l=0,e.forEachNode(function(O){_(O.id),l+=1}),e.forEachLink(b)}function _(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),L(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){L(O.fromId),L(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&&L(k.id),C&&L(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 L(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 I(O){var y=i.get(O);return y||(_(O),y=i.get(O)),y}function R(O){var y=e.getLinks(O);return y?1+y.length/3:1}function W(O){var y=e.getLinks(O);return y?1+y.size/3:1}}function Eu(){}var Lu=yo.exports;const Du=Ma(Lu);function qr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Nu=typeof global=="object"&&global&&global.Object===Object&&global,Ru=typeof self=="object"&&self&&self.Object===Object&&self,Ua=Nu||Ru||Function("return this")(),Pr=function(){return Ua.Date.now()},Iu=/\s/;function Fu(e){for(var t=e.length;t--&&Iu.test(e.charAt(t)););return t}var Bu=/^\s+/;function $u(e){return e&&e.slice(0,Fu(e)+1).replace(Bu,"")}var Zn=Ua.Symbol,qa=Object.prototype,Hu=qa.hasOwnProperty,Uu=qa.toString,dn=Zn?Zn.toStringTag:void 0;function qu(e){var t=Hu.call(e,dn),n=e[dn];try{e[dn]=void 0;var r=!0}catch{}var o=Uu.call(e);return r&&(t?e[dn]=n:delete e[dn]),o}var Vu=Object.prototype,Gu=Vu.toString;function Wu(e){return Gu.call(e)}var Yu="[object Null]",Xu="[object Undefined]",ji=Zn?Zn.toStringTag:void 0;function Ku(e){return e==null?e===void 0?Xu:Yu:ji&&ji in Object(e)?qu(e):Wu(e)}function Zu(e){return e!=null&&typeof e=="object"}var Qu="[object Symbol]";function Ju(e){return typeof e=="symbol"||Zu(e)&&Ku(e)==Qu}var Ti=NaN,ef=/^[-+]0x[0-9a-f]+$/i,tf=/^0b[01]+$/i,nf=/^0o[0-7]+$/i,rf=parseInt;function zi(e){if(typeof e=="number")return e;if(Ju(e))return Ti;if(qr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=qr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=$u(e);var n=tf.test(e);return n||nf.test(e)?rf(e.slice(2),n?2:8):ef.test(e)?Ti:+e}var of="Expected a function",af=Math.max,sf=Math.min;function lf(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(of);t=zi(t)||0,qr(n)&&(f=!!n.leading,c="maxWait"in n,i=c?af(zi(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,L=t-M;return c?sf(L,i-P):L}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=Pr();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 x(){l!==void 0&&clearTimeout(l),u=0,r=s=o=l=void 0}function _(){return l===void 0?a:S(Pr())}function w(){var b=Pr(),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=x,w.flush=_,w}function Ei(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 cf(e){if(Array.isArray(e))return e}function uf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ff(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}function df(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 hf(){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 pf(e,t){return cf(e)||df(e,t)||gf(e,t)||hf()}function gf(e,t){if(e){if(typeof e=="string")return Ei(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)?Ei(e,t):void 0}}var vf=ff(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;uf(this,e),this.name=t,this.defaultVal=o,this.triggerUpdate=a,this.onChange=s});function ko(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 vf(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),x=S?v.shift():void 0,_=v[0],w=_===void 0?{}:_,b=Object.assign({},n instanceof Function?n(w):n,{initialised:!1}),M={};function P(I){return L(I,w),j(),P}var L=function(R,W){f.call(P,R,b,W),b.initialised=!0},j=lf(function(){b.initialised&&(p.call(P,b,M),M={})},1);return h.forEach(function(I){P[I.name]=R(I);function R(W){var O=W.name,y=W.triggerUpdate,k=y===void 0?!1:y,C=W.onChange,$=C===void 0?function(E,N){}:C,B=W.defaultVal,G=B===void 0?null:B;return function(E){var N=b[O];if(!arguments.length)return N;var U=E===void 0?G:E;return b[O]=U,$.call(P,U,b,N),!M.hasOwnProperty(O)&&(M[O]=N),k&&j(),P}}}),Object.keys(a).forEach(function(I){P[I]=function(){for(var R,W=arguments.length,O=new Array(W),y=0;y<W;y++)O[y]=arguments[y];return(R=a[I]).call.apply(R,[P,b].concat(O))}}),Object.entries(s).forEach(function(I){var R=pf(I,2),W=R[0],O=R[1];return P[W]=P[O]}),P.resetProps=function(){return h.forEach(function(I){P[I.name](I.defaultVal)}),P},P.resetProps(),b._rerender=j,S&&x&&P(x),P}}var de=function(e){return typeof e=="function"?e:typeof e=="string"?function(t){return t[e]}:function(t){return e}};class Li extends Map{constructor(t,n=bf){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(Di(this,t))}has(t){return super.has(Di(this,t))}set(t,n){return super.set(yf(this,t),n)}delete(t){return super.delete(mf(this,t))}}function Di({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function yf({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function mf({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function bf(e){return e!==null&&typeof e=="object"?e.valueOf():e}function _f(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 xf(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 Vr(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 wf(e){if(Array.isArray(e))return e}function kf(e){if(Array.isArray(e))return Vr(e)}function Va(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 Cf(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Sf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fe(e,t){return e.get(Va(e,t))}function Gt(e,t,n){Cf(e,t),t.set(e,n)}function Hn(e,t,n){return e.set(Va(e,t),n),n}function Mf(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,Df(r.key),r)}}function Pf(e,t,n){return t&&Mf(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Af(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,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 jf(){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 Tf(){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 zf(e,t){return wf(e)||Of(e,t)||Ga(e,t)||jf()}function Ef(e){return kf(e)||Af(e)||Ga(e)||Tf()}function Lf(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 Df(e){var t=Lf(e,"string");return typeof t=="symbol"?t:t+""}function Ga(e,t){if(e){if(typeof e=="string")return Vr(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)?Vr(e,t):void 0}}var Wt=new WeakMap,hn=new WeakMap,Yt=new WeakMap,Ar=new WeakMap,Or=new WeakMap,jr=new WeakMap,Nf=function(){function e(){Sf(this,e),Gt(this,Wt,new Map),Gt(this,hn,new Map),Gt(this,Yt,function(t){return t}),Gt(this,Ar,function(){return{}}),Gt(this,Or,function(){}),Gt(this,jr,function(){})}return Pf(e,[{key:"getObj",value:function(n){return Fe(Wt,this).get(Fe(Yt,this).call(this,n))}},{key:"getData",value:function(n){return Fe(hn,this).get(n)}},{key:"entries",value:function(){return Ef(Fe(hn,this).entries()).map(function(n){var r=zf(n,2),o=r[0],i=r[1];return[i,o]})}},{key:"id",value:function(n){return Hn(Yt,this,de(n)),this}},{key:"onCreateObj",value:function(n){return Hn(Ar,this,n),this}},{key:"onUpdateObj",value:function(n){return Hn(Or,this,n),this}},{key:"onRemoveObj",value:function(n){return Hn(jr,this,n),this}},{key:"digest",value:function(n){var r=this;n.filter(function(i){return!Fe(Wt,r).has(Fe(Yt,r).call(r,i))}).forEach(function(i){var a=Fe(Ar,r).call(r,i);Fe(Wt,r).set(Fe(Yt,r).call(r,i),a),Fe(hn,r).set(a,i)});var o=new Map(n.map(function(i){return[Fe(Yt,r).call(r,i),i]}));return Fe(Wt,this).forEach(function(i,a){o.has(a)?Fe(Or,r).call(r,i,o.get(a)):(Fe(jr,r).call(r,i,a),Fe(Wt,r).delete(a),Fe(hn,r).delete(i))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])}();function Rf(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const Ni=Symbol("implicit");function Wa(){var e=new Li,t=[],n=[],r=Ni;function o(i){let a=e.get(i);if(a===void 0){if(r!==Ni)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 Li;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 Wa(t,n).unknown(r)},Rf.apply(o,arguments),o}function If(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 Ff=If("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function Qn(e){"@babel/helpers - typeof";return Qn=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},Qn(e)}var Bf=/^\s+/,$f=/\s+$/;function oe(e,t){if(e=e||"",t=t||{},e instanceof oe)return e;if(!(this instanceof oe))return new oe(e,t);var n=Hf(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}oe.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=Ya(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=Ii(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=Ii(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=Ri(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=Ri(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 Fi(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return Gf(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(Ce(this._r,255)*100)+"%",g:Math.round(Ce(this._g,255)*100)+"%",b:Math.round(Ce(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Ce(this._r,255)*100)+"%, "+Math.round(Ce(this._g,255)*100)+"%, "+Math.round(Ce(this._b,255)*100)+"%)":"rgba("+Math.round(Ce(this._r,255)*100)+"%, "+Math.round(Ce(this._g,255)*100)+"%, "+Math.round(Ce(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:od[Fi(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+Bi(this._r,this._g,this._b,this._a),r=n,o=this._gradientType?"GradientType = 1, ":"";if(t){var i=oe(t);r="#"+Bi(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 oe(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(Kf,arguments)},brighten:function(){return this._applyModification(Zf,arguments)},darken:function(){return this._applyModification(Qf,arguments)},desaturate:function(){return this._applyModification(Wf,arguments)},saturate:function(){return this._applyModification(Yf,arguments)},greyscale:function(){return this._applyModification(Xf,arguments)},spin:function(){return this._applyModification(Jf,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(nd,arguments)},complement:function(){return this._applyCombination(ed,arguments)},monochromatic:function(){return this._applyCombination(rd,arguments)},splitcomplement:function(){return this._applyCombination(td,arguments)},triad:function(){return this._applyCombination($i,[3])},tetrad:function(){return this._applyCombination($i,[4])}};oe.fromRatio=function(e,t){if(Qn(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 oe(e,t)};function Hf(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=ld(e)),Qn(e)=="object"&&(xt(e.r)&&xt(e.g)&&xt(e.b)?(t=Uf(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=Vf(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=qf(e.h,r,i),a=!0,l="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=Ya(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 Uf(e,t,n){return{r:Ce(e,255)*255,g:Ce(t,255)*255,b:Ce(n,255)*255}}function Ri(e,t,n){e=Ce(e,255),t=Ce(t,255),n=Ce(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 qf(e,t,n){var r,o,i;e=Ce(e,360),t=Ce(t,100),n=Ce(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 Ii(e,t,n){e=Ce(e,255),t=Ce(t,255),n=Ce(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 Vf(e,t,n){e=Ce(e,360)*6,t=Ce(t,100),n=Ce(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 Fi(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 Gf(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(Xa(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 Bi(e,t,n,r){var o=[ut(Xa(r)),ut(Math.round(e).toString(16)),ut(Math.round(t).toString(16)),ut(Math.round(n).toString(16))];return o.join("")}oe.equals=function(e,t){return!e||!t?!1:oe(e).toRgbString()==oe(t).toRgbString()};oe.random=function(){return oe.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Wf(e,t){t=t===0?0:t||10;var n=oe(e).toHsl();return n.s-=t/100,n.s=lr(n.s),oe(n)}function Yf(e,t){t=t===0?0:t||10;var n=oe(e).toHsl();return n.s+=t/100,n.s=lr(n.s),oe(n)}function Xf(e){return oe(e).desaturate(100)}function Kf(e,t){t=t===0?0:t||10;var n=oe(e).toHsl();return n.l+=t/100,n.l=lr(n.l),oe(n)}function Zf(e,t){t=t===0?0:t||10;var n=oe(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)))),oe(n)}function Qf(e,t){t=t===0?0:t||10;var n=oe(e).toHsl();return n.l-=t/100,n.l=lr(n.l),oe(n)}function Jf(e,t){var n=oe(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,oe(n)}function ed(e){var t=oe(e).toHsl();return t.h=(t.h+180)%360,oe(t)}function $i(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=oe(e).toHsl(),r=[oe(e)],o=360/t,i=1;i<t;i++)r.push(oe({h:(n.h+i*o)%360,s:n.s,l:n.l}));return r}function td(e){var t=oe(e).toHsl(),n=t.h;return[oe(e),oe({h:(n+72)%360,s:t.s,l:t.l}),oe({h:(n+216)%360,s:t.s,l:t.l})]}function nd(e,t,n){t=t||6,n=n||30;var r=oe(e).toHsl(),o=360/n,i=[oe(e)];for(r.h=(r.h-(o*t>>1)+720)%360;--t;)r.h=(r.h+o)%360,i.push(oe(r));return i}function rd(e,t){t=t||6;for(var n=oe(e).toHsv(),r=n.h,o=n.s,i=n.v,a=[],l=1/t;t--;)a.push(oe({h:r,s:o,v:i})),i=(i+l)%1;return a}oe.mix=function(e,t,n){n=n===0?0:n||50;var r=oe(e).toRgb(),o=oe(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 oe(a)};oe.readability=function(e,t){var n=oe(e),r=oe(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)};oe.isReadable=function(e,t,n){var r=oe.readability(e,t),o,i;switch(i=!1,o=cd(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};oe.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=oe.readability(e,t[u]),i>o&&(o=i,r=oe(t[u]));return oe.isReadable(e,r,{level:l,size:s})||!a?r:(n.includeFallbackColors=!1,oe.mostReadable(e,["#fff","#000"],n))};var Gr=oe.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"},od=oe.hexNames=id(Gr);function id(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function Ya(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function Ce(e,t){ad(e)&&(e="100%");var n=sd(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 lr(e){return Math.min(1,Math.max(0,e))}function Xe(e){return parseInt(e,16)}function ad(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function sd(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 Xa(e){return Math.round(parseFloat(e)*255).toString(16)}function Hi(e){return Xe(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 ld(e){e=e.replace(Bf,"").replace($f,"").toLowerCase();var t=!1;if(Gr[e])e=Gr[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:Xe(n[1]),g:Xe(n[2]),b:Xe(n[3]),a:Hi(n[4]),format:t?"name":"hex8"}:(n=lt.hex6.exec(e))?{r:Xe(n[1]),g:Xe(n[2]),b:Xe(n[3]),format:t?"name":"hex"}:(n=lt.hex4.exec(e))?{r:Xe(n[1]+""+n[1]),g:Xe(n[2]+""+n[2]),b:Xe(n[3]+""+n[3]),a:Hi(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=lt.hex3.exec(e))?{r:Xe(n[1]+""+n[1]),g:Xe(n[2]+""+n[2]),b:Xe(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function cd(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 Wr(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 ud(e){if(Array.isArray(e))return e}function fd(e){if(Array.isArray(e))return Wr(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 dd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Za(e,t,n){return t=en(t),_d(e,Co()?Reflect.construct(t,n||[],en(e).constructor):t.apply(e,n))}function hd(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Qa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Tr(e,t){return e.get(Ka(e,t))}function Ui(e,t,n){hd(e,t),t.set(e,n)}function qi(e,t,n){return e.set(Ka(e,t),n),n}function Ja(e,t,n){if(Co())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 pd(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,ns(r.key),r)}}function es(e,t,n){return t&&pd(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function cr(e,t,n){return(t=ns(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Yr(){return Yr=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=xd(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},Yr.apply(null,arguments)}function en(e){return en=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},en(e)}function ts(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&&Xr(e,t)}function Co(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Co=function(){return!!e})()}function gd(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function vd(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 yd(){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 md(){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 Vi(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 bd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Vi(Object(n),!0).forEach(function(r){cr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vi(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function _d(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 dd(e)}function Xr(e,t){return Xr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Xr(e,t)}function wn(e,t){return ud(e)||vd(e,t)||rs(e,t)||yd()}function xd(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=en(e))!==null;);return e}function zr(e,t,n,r){var o=Yr(en(e.prototype),t,n);return typeof o=="function"?function(i){return o.apply(n,i)}:o}function ct(e){return fd(e)||gd(e)||rs(e)||md()}function wd(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 ns(e){var t=wd(e,"string");return typeof t=="symbol"?t:t+""}function Kr(e){"@babel/helpers - typeof";return Kr=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},Kr(e)}function rs(e,t){if(e){if(typeof e=="string")return Wr(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)?Wr(e,t):void 0}}var os=function(t){t instanceof Array?t.forEach(os):(t.map&&t.map.dispose(),t.dispose())},So=function(t){t.geometry&&t.geometry.dispose(),t.material&&os(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(So)},Gi=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),So(n)}},Er=new WeakMap,Un=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 Qa(this,t),r=Za(this,t),cr(r,"scene",void 0),Ui(r,Er,void 0),Ui(r,Un,void 0),r.scene=n,qi(Er,r,a),qi(Un,r,s),r.onRemoveObj(function(){}),r}return ts(t,e),es(t,[{key:"onCreateObj",value:function(r){var o=this;return zr(t,"onCreateObj",this)([function(i){var a=r(i);return i[Tr(Un,o)]=a,a[Tr(Er,o)]=i,o.scene.add(a),a}]),this}},{key:"onRemoveObj",value:function(r){var o=this;return zr(t,"onRemoveObj",this)([function(i,a){var l=zr(t,"getData",o)([i]);r(i,a),o.scene.remove(i),So(i),delete l[Tr(Un,o)]}]),this}}])}(Nf),gn=function(t){return isNaN(t)?parseInt(oe(t).toHex(),16):t},Lr=function(t){return isNaN(t)?oe(t).getAlpha():1},kd=Wa(Ff);function Wi(e,t,n){!t||typeof n!="string"||e.filter(function(r){return!r[n]}).forEach(function(r){r[n]=kd(t(r))})}function Cd(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=_(d),g=_(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],x=u[g];S.out.push(x);function _(w){return Kr(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 cr({},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 _=h[g];if(d.indexOf(_)!==-1){var w=[].concat(ct(d.slice(d.indexOf(_))),[_]).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>_.depth&&(_.depth=m,p(_.out,[].concat(ct(d),[_]),m+(_.skip?0:1)))},g=0,S=h.length;g<S;g++)v()}}var se=window.THREE?window.THREE:{Group:ae.Group,Mesh:ae.Mesh,MeshLambertMaterial:ae.MeshLambertMaterial,Color:ae.Color,BufferGeometry:ae.BufferGeometry,BufferAttribute:ae.BufferAttribute,Matrix4:ae.Matrix4,Vector3:ae.Vector3,SphereGeometry:ae.SphereGeometry,CylinderGeometry:ae.CylinderGeometry,TubeGeometry:ae.TubeGeometry,ConeGeometry:ae.ConeGeometry,Line:ae.Line,LineBasicMaterial:ae.LineBasicMaterial,QuadraticBezierCurve3:ae.QuadraticBezierCurve3,CubicBezierCurve3:ae.CubicBezierCurve3,Box3:ae.Box3},Yi={graph:eu,forcelayout:Du},Sd=2,Dr=new se.BufferGeometry().setAttribute?"setAttribute":"addAttribute",qn=new se.BufferGeometry().applyMatrix4?"applyMatrix4":"applyMatrix",Md=ko({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 x=f(d);if(!(t.linkPositionUpdate&&t.linkPositionUpdate(x?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)&&!x)){var _=30,w=d.__curve,b=m.children.length?m.children[0]:m;if(b.type==="Line"){if(w){var P=w.getPoints(_);b.geometry.getAttribute("position").array.length!==P.length*3&&b.geometry[Dr]("position",new se.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[Dr]("position",M=new se.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 se.TubeGeometry(w,_,k,t.linkResolution,!1);b.geometry.dispose(),b.geometry=C}else{if(!b.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var L=Math.ceil(l(d)*10)/10,j=L/2,I=new se.CylinderGeometry(j,j,1,t.linkResolution,1,!1);I[qn](new se.Matrix4().makeTranslation(0,1/2,0)),I[qn](new se.Matrix4().makeRotationX(Math.PI/2)),b.geometry.dispose(),b.geometry=I}var R=new se.Vector3(g.x,g.y||0,g.z||0),W=new se.Vector3(S.x,S.y||0,S.z||0),O=R.distanceTo(W);b.position.x=R.x,b.position.y=R.y,b.position.z=R.z,b.scale.z=O,b.parent.localToWorld(W),b.lookAt(W)}}}}});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 se.Vector3(d.x,d.y||0,d.z||0),S=new se.Vector3(m.x,m.y||0,m.z||0),x=g.distanceTo(S),_,w=u(p);if(x>0){var b=m.x-d.x,M=m.y-d.y||0,P=new se.Vector3().subVectors(S,g),L=P.clone().multiplyScalar(v).cross(b!==0||M!==0?new se.Vector3(0,0,1):new se.Vector3(0,1,0)).applyAxisAngle(P.normalize(),w).add(new se.Vector3().addVectors(g,S).divideScalar(2));_=new se.QuadraticBezierCurve3(g,L,S)}else{var j=v*70,I=-w,R=I+Math.PI/2;_=new se.CubicBezierCurve3(g,new se.Vector3(j*Math.cos(R),j*Math.sin(R),0).add(g),new se.Vector3(j*Math.cos(I),j*Math.sin(I),0).add(g),S)}p.__curve=_}}}}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),x=a(c),_=c.__curve?function(j){return c.__curve.getPoint(j)}:function(j){var I=function(W,O,y,k){return O[W]+(y[W]-O[W])*k||0};return{x:I("x",d,m,j),y:I("y",d,m,j),z:I("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,I){return j+I},0)),b=v+S+(w-v-g-S)*x,M=_(b/w),P=_((b-S)/w);["x","y","z"].forEach(function(j){return p.position[j]=P[j]});var L=Ja(se.Vector3,ct(["x","y","z"].map(function(j){return M[j]})));p.parent.localToWorld(L),p.lookAt(L)}}})}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(x){return s.__curve.getPoint(x)}:function(x){var _=function(b,M,P,L){return M[b]+(P[b]-M[b])*L||0};return{x:_("x",h,d,x),y:_("y",h,d,x),z:_("z",h,d,x)}},S=[].concat(ct(f||[]),ct(c||[]));S.forEach(function(x,_){var w=x.parent.__linkThreeObjType==="singleHopPhotons";if(x.hasOwnProperty("__progressRatio")||(x.__progressRatio=w?m<0?1:0:(_+v)/f.length),x.__progressRatio+=m,x.__progressRatio>=1||x.__progressRatio<0)if(!w)x.__progressRatio=x.__progressRatio%1,x.__progressRatio<0&&x.__progressRatio++;else{x.parent.remove(x),Gi(x);return}var b=x.__progressRatio,M=g(b);x.geometry.type!=="SphereGeometry"&&x.lookAt(M.x,M.y,M.z),["x","y","z"].forEach(function(P){return x.position[P]=M[P]})})}}})}},emitParticle:function(t,n){if(n&&t.graphData.links.includes(n)){if(!n.__singleHopPhotonsObj){var r=new se.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 se.SphereGeometry(a,l,l),u=de(t.linkColor),f=de(t.linkDirectionalParticleColor),c=f(n)||u(n)||"#f0f0f0",p=new se.Color(gn(c)),h=t.linkOpacity*3,d=new se.MeshLambertMaterial({color:p,transparent:!0,opacity:h});o=new se.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 se.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 cr({},o,[xf(r,function(i){return i.min[o]}),_f(r,function(i){return i.max[o]})])}))):null}},stateInit:function(){return{d3ForceLayout:Wc().force("link",zc()).force("charge",Yc()).force("center",El()).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(F){return n.hasOwnProperty(F)})};if(t.engineRunning=!1,typeof t.onUpdate=="function"&&t.onUpdate(),t.nodeAutoColorBy!==null&&r(["nodeAutoColorBy","graphData","nodeColor"])&&Wi(t.graphData.nodes,de(t.nodeAutoColorBy),t.nodeColor),t.linkAutoColorBy!==null&&r(["linkAutoColorBy","graphData","linkColor"])&&Wi(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(z){var H=o(z),F=i(z);H&&t.nodeThreeObject===H&&(H=H.clone());var ee;return H&&!F?ee=H:(ee=new se.Mesh,ee.__graphDefaultObj=!0,H&&F&&ee.add(H)),ee.__graphObjType="node",ee}).onUpdateObj(function(z,H){if(z.__graphDefaultObj){var F=a(H)||1,ee=Math.cbrt(F)*t.nodeRelSize,ne=t.nodeResolution;(!z.geometry.type.match(/^Sphere(Buffer)?Geometry$/)||z.geometry.parameters.radius!==ee||z.geometry.parameters.widthSegments!==ne)&&(u.hasOwnProperty(F)||(u[F]=new se.SphereGeometry(ee,ne,ne)),z.geometry.dispose(),z.geometry=u[F]);var Z=l(H),Y=new se.Color(gn(Z||"#ffffaa")),K=t.nodeOpacity*Lr(Z);(z.material.type!=="MeshLambertMaterial"||!z.material.color.equals(Y)||z.material.opacity!==K)&&(f.hasOwnProperty(Z)||(f[Z]=new se.MeshLambertMaterial({color:Y,transparent:!0,opacity:K})),z.material.dispose(),z.material=f[Z])}}).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(z){var H=z.__data&&z.__data.__singleHopPhotonsObj;H&&(H.parent.remove(H),Gi(H),delete z.__data.__singleHopPhotonsObj)}).onCreateObj(function(z){var H=c(z),F=p(z);H&&t.linkThreeObject===H&&(H=H.clone());var ee;if(!H||F){var ne=!!v(z);if(ne)ee=new se.Mesh;else{var Z=new se.BufferGeometry;Z[Dr]("position",new se.BufferAttribute(new Float32Array(2*3),3)),ee=new se.Line(Z)}}var Y;return H?F?(Y=new se.Group,Y.__graphDefaultObj=!0,Y.add(ee),Y.add(H)):Y=H:(Y=ee,Y.__graphDefaultObj=!0),Y.renderOrder=10,Y.__graphObjType="link",Y}).onUpdateObj(function(z,H){if(z.__graphDefaultObj){var F=z.children.length?z.children[0]:z,ee=Math.ceil(v(H)*10)/10,ne=!!ee;if(ne){var Z=ee/2,Y=t.linkResolution;if(!F.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||F.geometry.parameters.radiusTop!==Z||F.geometry.parameters.radialSegments!==Y){if(!g.hasOwnProperty(ee)){var K=new se.CylinderGeometry(Z,Z,1,Y,1,!1);K[qn](new se.Matrix4().makeTranslation(0,1/2,0)),K[qn](new se.Matrix4().makeRotationX(Math.PI/2)),g[ee]=K}F.geometry.dispose(),F.geometry=g[ee]}}var X=h(H);if(X)F.material=X;else{var V=m(H),J=new se.Color(gn(V||"#f0f0f0")),te=t.linkOpacity*Lr(V),le=ne?"MeshLambertMaterial":"LineBasicMaterial";if(F.material.type!==le||!F.material.color.equals(J)||F.material.opacity!==te){var ve=ne?S:x;ve.hasOwnProperty(V)||(ve[V]=new se[le]({color:J,transparent:te<1,opacity:te,depthWrite:te>=1})),F.material.dispose(),F.material=ve[V]}}}}).digest(_),t.linkDirectionalArrowLength||n.hasOwnProperty("linkDirectionalArrowLength")){var w=de(t.linkDirectionalArrowLength),b=de(t.linkDirectionalArrowColor);t.arrowDataMapper.onCreateObj(function(){var z=new se.Mesh(void 0,new se.MeshLambertMaterial({transparent:!0}));return z.__linkThreeObjType="arrow",z}).onUpdateObj(function(z,H){var F=w(H),ee=t.linkDirectionalArrowResolution;if(!z.geometry.type.match(/^Cone(Buffer)?Geometry$/)||z.geometry.parameters.height!==F||z.geometry.parameters.radialSegments!==ee){var ne=new se.ConeGeometry(F*.25,F,ee);ne.translate(0,F/2,0),ne.rotateX(Math.PI/2),z.geometry.dispose(),z.geometry=ne}var Z=b(H)||m(H)||"#f0f0f0";z.material.color=new se.Color(gn(Z)),z.material.opacity=t.linkOpacity*3*Lr(Z)}).digest(_.filter(w))}if(t.linkDirectionalParticles||n.hasOwnProperty("linkDirectionalParticles")){var M=de(t.linkDirectionalParticles),P=de(t.linkDirectionalParticleWidth),L=de(t.linkDirectionalParticleColor),j=de(t.linkDirectionalParticleThreeObject),I={},R={};t.particlesDataMapper.onCreateObj(function(){var z=new se.Group;return z.__linkThreeObjType="photons",z.__photonDataMapper=new pn(z),z}).onUpdateObj(function(z,H){var F=!!z.children.length&&z.children[0],ee=j(H),ne,Z;if(ee)ne=ee.geometry,Z=ee.material;else{var Y=Math.ceil(P(H)*10)/10/2,K=t.linkDirectionalParticleResolution;F&&F.geometry.parameters.radius===Y&&F.geometry.parameters.widthSegments===K?ne=F.geometry:(R.hasOwnProperty(Y)||(R[Y]=new se.SphereGeometry(Y,K,K)),ne=R[Y]);var X=L(H)||m(H)||"#f0f0f0",V=new se.Color(gn(X)),J=t.linkOpacity*3;F&&F.material.color.equals(V)&&F.material.opacity===J?Z=F.material:(I.hasOwnProperty(X)||(I[X]=new se.MeshLambertMaterial({color:V,transparent:!0,opacity:J})),Z=I[X])}F&&(F.geometry!==ne&&F.geometry.dispose(),F.material!==Z&&F.material.dispose());var te=Math.round(Math.abs(M(H)));z.__photonDataMapper.id(function(le){return le.idx}).onCreateObj(function(){return new se.Mesh(ne,Z)}).onUpdateObj(function(le){le.geometry=ne,le.material=Z}).digest(ct(new Array(te)).map(function(le,ve){return{idx:ve}}))}).digest(_.filter(M))}}if(t._flushObjects=!1,r(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach(function(z){z.source=z[t.linkSource],z.target=z[t.linkTarget]});var W=t.forceEngine!=="ngraph",O;if(W){(O=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var y=t.d3ForceLayout.force("link");y&&y.id(function(z){return z[t.nodeId]}).links(t.graphData.links);var k=t.dagMode&&Cd(t.graphData,function(z){return z[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)*Sd*(["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(z){return delete z[B]})}if(["lr","rl","td","bu","zin","zout"].includes(t.dagMode)){var G=["rl","td","zout"].includes(t.dagMode),E=function(H){return(k[H[t.nodeId]]-C/2)*$*(G?-1:1)},N=["lr","rl"].includes(t.dagMode)?"fx":["td","bu"].includes(t.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(z){return z[N]=E(z)})}t.d3ForceLayout.force("dagRadial",["radialin","radialout"].indexOf(t.dagMode)!==-1?Xc(function(z){var H=k[z[t.nodeId]]||-1;return(t.dagMode==="radialin"?C-H:H)*$}).strength(function(z){return t.dagNodeFilter(z)?1:0}):null)}else{var U=Yi.graph();t.graphData.nodes.forEach(function(z){U.addNode(z[t.nodeId])}),t.graphData.links.forEach(function(z){U.addLink(z.source,z.target)}),O=Yi.forcelayout(U,bd({dimensions:t.numDimensions},t.ngraphPhysics)),O.graph=U}for(var q=0;q<t.warmupTicks&&!(W&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);q++)O[W?"tick":"step"]();t.layout=O,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}});function Pd(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;Qa(this,i);for(var l=arguments.length,s=new Array(l),u=0;u<l;u++)s[u]=arguments[u];return a=Za(this,i,[].concat(s)),a.__kapsuleInstance=Ja(e,[].concat(ct(n?[a]:[]),s)),a}return ts(i,o),es(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 Ad=window.THREE?window.THREE:{Group:ae.Group},is=Pd(Md,Ad.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 Od(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 jd(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Mn(e,t)}function Zr(e){return Zr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Zr(e)}function Td(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function as(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(as=function(){return!!e})()}function zd(e,t,n){if(as())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 Qr(e){var t=typeof Map=="function"?new Map:void 0;return Qr=function(r){if(r===null||!Td(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 zd(r,arguments,Zr(this).constructor)}return o.prototype=Object.create(r.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Mn(o,r)},Qr(e)}var Ed={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 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
|
|
655
|
+
`};function Ld(){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){jd(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,Ld.apply(void 0,[Ed[n]].concat(i)))||this}return Od(r)}return t}(Qr(Error));function Nr(e){return Math.round(e*255)}function Dd(e,t,n){return Nr(e)+","+Nr(t)+","+Nr(n)}function Jn(e,t,n,r){if(r===void 0&&(r=Dd),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 Xi={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 Nd(e){if(typeof e!="string")return e;var t=e.toLowerCase();return Xi[t]?"#"+Xi[t]:e}var Rd=/^#[a-fA-F0-9]{6}$/,Id=/^#[a-fA-F0-9]{8}$/,Fd=/^#[a-fA-F0-9]{3}$/,Bd=/^#[a-fA-F0-9]{4}$/,Rr=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,$d=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,Hd=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,Ud=/^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=Nd(e);if(t.match(Rd))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(Id)){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(Fd))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(Bd)){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=Rr.exec(t);if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10)};var i=$d.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=Hd.exec(t);if(a){var l=parseInt(""+a[1],10),s=parseInt(""+a[2],10)/100,u=parseInt(""+a[3],10)/100,f="rgb("+Jn(l,s,u)+")",c=Rr.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=Ud.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("+Jn(h,d,m)+")",g=Rr.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 qd(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 qd(tn(e))}var Vd=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},Jr=Vd;function Ft(e){var t=e.toString(16);return t.length===1?"0"+t:t}function Ir(e){return Ft(Math.round(e*255))}function Gd(e,t,n){return Jr("#"+Ir(e)+Ir(t)+Ir(n))}function ss(e,t,n){return Jn(e,t,n,Gd)}function Wd(e,t,n){if(typeof e=="object"&&t===void 0&&n===void 0)return ss(e.hue,e.saturation,e.lightness);throw new gt(1)}function Yd(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?ss(e.hue,e.saturation,e.lightness):"rgba("+Jn(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new gt(2)}function ls(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return Jr("#"+Ft(e)+Ft(t)+Ft(n));if(typeof e=="object"&&t===void 0&&n===void 0)return Jr("#"+Ft(e.red)+Ft(e.green)+Ft(e.blue));throw new gt(6)}function ur(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?ls(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new gt(7)}var Xd=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Kd=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&typeof t.alpha=="number"},Zd=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Qd=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&typeof t.alpha=="number"};function Tt(e){if(typeof e!="object")throw new gt(8);if(Kd(e))return ur(e);if(Xd(e))return ls(e);if(Qd(e))return Yd(e);if(Zd(e))return Wd(e);throw new gt(8)}function cs(e,t,n){return function(){var o=n.concat(Array.prototype.slice.call(arguments));return o.length>=t?e.apply(this,o):cs(e,t,o)}}function Ke(e){return cs(e,e.length,[])}function Jd(e,t){if(t==="transparent")return t;var n=jt(t);return Tt(Ge({},n,{hue:n.hue+parseFloat(e)}))}Ke(Jd);function an(e,t,n){return Math.max(e,Math.min(t,n))}function eh(e,t){if(t==="transparent")return t;var n=jt(t);return Tt(Ge({},n,{lightness:an(0,1,n.lightness-parseFloat(e))}))}Ke(eh);function th(e,t){if(t==="transparent")return t;var n=jt(t);return Tt(Ge({},n,{saturation:an(0,1,n.saturation-parseFloat(e))}))}Ke(th);function nh(e,t){if(t==="transparent")return t;var n=jt(t);return Tt(Ge({},n,{lightness:an(0,1,n.lightness+parseFloat(e))}))}Ke(nh);function rh(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 ur(h)}var oh=Ke(rh),us=oh;function ih(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 ur(o)}var ah=Ke(ih),sh=ah;function lh(e,t){if(t==="transparent")return t;var n=jt(t);return Tt(Ge({},n,{saturation:an(0,1,n.saturation+parseFloat(e))}))}Ke(lh);function ch(e,t){return t==="transparent"?t:Tt(Ge({},jt(t),{hue:parseFloat(e)}))}Ke(ch);function uh(e,t){return t==="transparent"?t:Tt(Ge({},jt(t),{lightness:parseFloat(e)}))}Ke(uh);function fh(e,t){return t==="transparent"?t:Tt(Ge({},jt(t),{saturation:parseFloat(e)}))}Ke(fh);function dh(e,t){return t==="transparent"?t:us(parseFloat(e),"rgb(0, 0, 0)",t)}Ke(dh);function hh(e,t){return t==="transparent"?t:us(parseFloat(e),"rgb(255, 255, 255)",t)}Ke(hh);function ph(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 ur(o)}Ke(ph);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()},fs=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}(),eo={Linear:function(e,t){var n=e.length-1,r=n*t,o=Math.floor(r),i=eo.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}}},ds=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),to=new fs,Ki=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=eo.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=ds.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=to,to.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=eo.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}();ds.nextId;var yt=to;yt.getAll.bind(yt);yt.removeAll.bind(yt);yt.add.bind(yt);yt.remove.bind(yt);yt.update.bind(yt);var no="http://www.w3.org/1999/xhtml";const Zi={svg:"http://www.w3.org/2000/svg",xhtml:no,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function hs(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Zi.hasOwnProperty(t)?{space:Zi[t],local:e}:e}function gh(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===no&&t.documentElement.namespaceURI===no?t.createElement(e):t.createElementNS(n,e)}}function vh(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ps(e){var t=hs(e);return(t.local?vh:gh)(t)}function yh(){}function gs(e){return e==null?yh:function(){return this.querySelector(e)}}function mh(e){typeof e!="function"&&(e=gs(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 ot(r,this._parents)}function bh(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function _h(){return[]}function xh(e){return e==null?_h:function(){return this.querySelectorAll(e)}}function wh(e){return function(){return bh(e.apply(this,arguments))}}function kh(e){typeof e=="function"?e=wh(e):e=xh(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 ot(r,o)}function Ch(e){return function(){return this.matches(e)}}function vs(e){return function(t){return t.matches(e)}}var Sh=Array.prototype.find;function Mh(e){return function(){return Sh.call(this.children,e)}}function Ph(){return this.firstElementChild}function Ah(e){return this.select(e==null?Ph:Mh(typeof e=="function"?e:vs(e)))}var Oh=Array.prototype.filter;function jh(){return Array.from(this.children)}function Th(e){return function(){return Oh.call(this.children,e)}}function zh(e){return this.selectAll(e==null?jh:Th(typeof e=="function"?e:vs(e)))}function Eh(e){typeof e!="function"&&(e=Ch(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 ot(r,this._parents)}function ys(e){return new Array(e.length)}function Lh(){return new ot(this._enter||this._groups.map(ys),this._parents)}function er(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}er.prototype={constructor:er,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 Dh(e){return function(){return e}}function Nh(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 er(e,i[a]);for(;a<s;++a)(l=t[a])&&(o[a]=l)}function Rh(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 er(e,i[l]);for(l=0;l<f;++l)(s=t[l])&&u.get(p[l])===s&&(o[l]=s)}function Ih(e){return e.__data__}function Fh(e,t){if(!arguments.length)return Array.from(this,Ih);var n=t?Rh:Nh,r=this._parents,o=this._groups;typeof e!="function"&&(e=Dh(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=Bh(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,x=0,_,w;S<d;++S)if(_=m[S]){for(S>=x&&(x=S+1);!(w=v[x])&&++x<d;);_._next=w||null}}return a=new ot(a,r),a._enter=l,a._exit=s,a}function Bh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $h(){return new ot(this._exit||this._groups.map(ys),this._parents)}function Hh(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 Uh(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 ot(l,this._parents)}function qh(){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 Vh(e){e||(e=Gh);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 ot(o,this._parents).order()}function Gh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Wh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Yh(){return Array.from(this)}function Xh(){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 Kh(){let e=0;for(const t of this)++e;return e}function Zh(){return!this.node()}function Qh(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 Jh(e){return function(){this.removeAttribute(e)}}function ep(e){return function(){this.removeAttributeNS(e.space,e.local)}}function tp(e,t){return function(){this.setAttribute(e,t)}}function np(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function rp(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function op(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 ip(e,t){var n=hs(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?ep:Jh:typeof t=="function"?n.local?op:rp:n.local?np:tp)(n,t))}function ms(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ap(e){return function(){this.style.removeProperty(e)}}function sp(e,t,n){return function(){this.style.setProperty(e,t,n)}}function lp(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function cp(e,t,n){return arguments.length>1?this.each((t==null?ap:typeof t=="function"?lp:sp)(e,t,n??"")):up(this.node(),e)}function up(e,t){return e.style.getPropertyValue(t)||ms(e).getComputedStyle(e,null).getPropertyValue(t)}function fp(e){return function(){delete this[e]}}function dp(e,t){return function(){this[e]=t}}function hp(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function pp(e,t){return arguments.length>1?this.each((t==null?fp:typeof t=="function"?hp:dp)(e,t)):this.node()[e]}function bs(e){return e.trim().split(/^|\s+/)}function Mo(e){return e.classList||new _s(e)}function _s(e){this._node=e,this._names=bs(e.getAttribute("class")||"")}_s.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 xs(e,t){for(var n=Mo(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function ws(e,t){for(var n=Mo(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function gp(e){return function(){xs(this,e)}}function vp(e){return function(){ws(this,e)}}function yp(e,t){return function(){(t.apply(this,arguments)?xs:ws)(this,e)}}function mp(e,t){var n=bs(e+"");if(arguments.length<2){for(var r=Mo(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?yp:t?gp:vp)(n,t))}function bp(){this.textContent=""}function _p(e){return function(){this.textContent=e}}function xp(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function wp(e){return arguments.length?this.each(e==null?bp:(typeof e=="function"?xp:_p)(e)):this.node().textContent}function kp(){this.innerHTML=""}function Cp(e){return function(){this.innerHTML=e}}function Sp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Mp(e){return arguments.length?this.each(e==null?kp:(typeof e=="function"?Sp:Cp)(e)):this.node().innerHTML}function Pp(){this.nextSibling&&this.parentNode.appendChild(this)}function Ap(){return this.each(Pp)}function Op(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function jp(){return this.each(Op)}function Tp(e){var t=typeof e=="function"?e:ps(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function zp(){return null}function Ep(e,t){var n=typeof e=="function"?e:ps(e),r=t==null?zp:typeof t=="function"?t:gs(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Lp(){var e=this.parentNode;e&&e.removeChild(this)}function Dp(){return this.each(Lp)}function Np(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Rp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ip(e){return this.select(e?Rp:Np)}function Fp(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Bp(e){return function(t){e.call(this,t,this.__data__)}}function $p(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 Hp(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 Up(e,t,n){return function(){var r=this.__on,o,i=Bp(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 qp(e,t,n){var r=$p(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?Up:Hp,o=0;o<i;++o)this.each(l(r[o],t,n));return this}function ks(e,t,n){var r=ms(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 Vp(e,t){return function(){return ks(this,e,t)}}function Gp(e,t){return function(){return ks(this,e,t.apply(this,arguments))}}function Wp(e,t){return this.each((typeof t=="function"?Gp:Vp)(e,t))}function*Yp(){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 Xp=[null];function ot(e,t){this._groups=e,this._parents=t}function Kp(){return this}ot.prototype={constructor:ot,select:mh,selectAll:kh,selectChild:Ah,selectChildren:zh,filter:Eh,data:Fh,enter:Lh,exit:$h,join:Hh,merge:Uh,selection:Kp,order:qh,sort:Vh,call:Wh,nodes:Yh,node:Xh,size:Kh,empty:Zh,each:Qh,attr:ip,style:cp,property:pp,classed:mp,text:wp,html:Mp,raise:Ap,lower:jp,append:Tp,insert:Ep,remove:Dp,clone:Ip,datum:Fp,on:qp,dispatch:Wp,[Symbol.iterator]:Yp};function Zp(e){return typeof e=="string"?new ot([[document.querySelector(e)]],[document.documentElement]):new ot([[e]],Xp)}function Qp(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Jp(e,t){if(e=Qp(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 On,Se,Cs,Ss,At,Qi,Ms,Ps,Fr,Wn,kn,As,Po,ro,oo,tr={},nr=[],eg=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,fr=Array.isArray;function vt(e,t){for(var n in t)e[n]=t[n];return e}function Ao(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function tg(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?On.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??++Cs,__i:-1,__u:0};return o==null&&Se.vnode!=null&&Se.vnode(i),i}function dr(e){return e.children}function Yn(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 ng(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],o=[],i=vt({},t);i.__v=t.__v+1,Se.vnode&&Se.vnode(i),Oo(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,zs(r,i,o),t.__e=t.__=null,i.__e!=n&&Os(i)}}function Os(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}),Os(e)}function Ji(e){(!e.__d&&(e.__d=!0)&&At.push(e)&&!rr.__r++||Qi!=Se.debounceRendering)&&((Qi=Se.debounceRendering)||Ms)(rr)}function rr(){try{for(var e,t=1;At.length;)At.length>t&&At.sort(Ps),e=At.shift(),t=At.length,ng(e)}finally{At.length=rr.__r=0}}function js(e,t,n,r,o,i,a,l,s,u,f){var c,p,h,d,m,v,g,S=r&&r.__k||nr,x=t.length;for(s=rg(n,t,S,s,x),c=0;c<x;c++)(h=n.__k[c])!=null&&(p=h.__i!=-1&&S[h.__i]||tr,h.__i=c,v=Oo(e,h,p,o,i,a,l,s,u,f),d=h.__e,h.ref&&p.ref!=h.ref&&(p.ref&&jo(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=Ts(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 rg(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):fr(a)?a=e.__k[i]=Cn(dr,{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=og(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)),Ls(l,l));return r}function Ts(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=Ts(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 og(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 ea(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||eg.test(t)?n:n+"px"}function Vn(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||ea(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||ea(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=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+i]=n,n?r?n[kn]=r[kn]:(n[kn]=Po,e.addEventListener(t,i?oo:ro,i)):e.removeEventListener(t,i?oo:ro,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 ta(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Wn]==null)t[Wn]=Po++;else if(t[Wn]<n[kn])return;return n(Se.event?Se.event(t):t)}}}function Oo(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,L=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(s=!!(32&n.__u),i=[l=t.__e=n.__e]),(f=Se.__b)&&f(t);e:if(typeof L=="function")try{if(g=t.props,S=L.prototype&&L.prototype.render,x=(f=L.contextType)&&r[f.__c],_=f?x?x.props.value:f.__:r,n.__c?v=(c=t.__c=n.__c).__=c.__E:(S?t.__c=c=new L(g,_):(t.__c=c=new Yn(g,_),c.constructor=L,c.render=ag),x&&x.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&&L.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=vt({},c.__s)),vt(c.__s,L.getDerivedStateFromProps(g,c.__s))),h=c.props,d=c.state,c.__v=t,p)S&&L.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),S&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(S&&L.getDerivedStateFromProps==null&&g!==h&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(g,_),t.__v==n.__v||!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(g,c.__s,_)===!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)}),nr.push.apply(c.__h,c._sb),c._sb=[],c.__h.length&&a.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(g,c.__s,_),S&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(h,d,m)})}if(c.context=_,c.props=g,c.__P=e,c.__e=!1,w=Se.__r,b=0,S)c.state=c.__s,c.__d=!1,w&&w(t),f=c.render(c.props,c.state,c.context),nr.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===dr&&f.key==null?Es(f.props.children):f,l=js(e,fr(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--;)Ao(i[P]);io(t)}else t.__e=n.__e,t.__k=n.__k,j.then||io(t);Se.__e(j,t,n)}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=ig(n.__e,t,n,r,o,i,a,s,u);return(f=Se.diffed)&&f(t),128&t.__u?void 0:l}function io(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(io))}function zs(e,t,n){for(var r=0;r<n.length;r++)jo(n[r],n[++r],n[++r]);Se.__c&&Se.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){Se.__e(i,o.__v)}})}function Es(e){return typeof e!="object"||e==null||e.__b>0?e:fr(e)?e.map(Es):vt({},e)}function ig(e,t,n,r,o,i,a,l,s){var u,f,c,p,h,d,m,v=n.props||tr,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&&(Se.__m&&Se.__m(t,i),l=!1),i=null}if(S==null)v===g||l&&e.data==g||(e.data=g);else{if(i=i&&On.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||Vn(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||Vn(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=""),js(t.type=="template"?e.content:e,fr(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--;)Ao(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])&&Vn(e,u,d,v[u],o),u="checked",m!=null&&m!=e[u]&&Vn(e,u,m,v[u],o))}return e}function jo(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){Se.__e(o,n)}}function Ls(e,t,n){var r,o;if(Se.unmount&&Se.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||jo(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){Se.__e(i,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&Ls(r[o],t,n||typeof e.type!="function");n||Ao(e.__e),e.__c=e.__=e.__e=void 0}function ag(e,t,n){return this.constructor(e,n)}function sg(e,t,n){var r,o,i,a;t==document&&(t=document.documentElement),Se.__&&Se.__(e,t),o=(r=!1)?null:t.__k,i=[],a=[],Oo(t,e=t.__k=tg(dr,null,[e]),o||tr,tr,t.namespaceURI,o?null:t.firstChild?On.call(t.childNodes):null,i,o?o.__e:t.firstChild,r,a),zs(i,e,a)}function Ds(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?On.call(arguments,2):n),Cn(e.type,l,r||e.key,o||e.ref,null)}On=nr.slice,Se={__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}},Cs=0,Ss=function(e){return e!=null&&e.constructor===void 0},Yn.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),Ji(this))},Yn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ji(this))},Yn.prototype.render=dr,At=[],Ms=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ps=function(e,t){return e.__v.__b-t.__v.__b},rr.__r=0,Fr=Math.random().toString(8),Wn="__d"+Fr,kn="__a"+Fr,As=/(PointerCapture)$|Capture$/i,Po=0,ro=ta(!1),oo=ta(!0);function na(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 lg(e){if(Array.isArray(e))return e}function cg(e,t,n){return(t=gg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ug(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 fg(){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 ra(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 dg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ra(Object(n),!0).forEach(function(r){cg(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ra(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function hg(e,t){return lg(e)||ug(e,t)||vg(e,t)||fg()}function pg(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 gg(e){var t=pg(e,"string");return typeof t=="symbol"?t:t+""}function or(e){"@babel/helpers - typeof";return or=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},or(e)}function vg(e,t){if(e){if(typeof e=="string")return na(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)?na(e,t):void 0}}var ao=function(t){if(or(t)!=="object")return t;var n=Ds(t);if(n.props){var r;n.props=dg({},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(ao):ao(n.props.children))}return n},yg=function(t){return Ss(Ds(t))},mg=function(t,n){delete n.__k,sg(ao(t),n)};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=`.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
|
-
`;
|
|
667
|
+
`;bg(_g);var xg=ko({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&&or(t)==="object"&&!!t.node&&typeof t.node=="function",l=Zp(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=hg(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=Jp(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):yg(t.content)?(t.tooltipEl.text(""),mg(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 wg(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 kg=`.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
|
-
}`;
|
|
683
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
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;
|
|
682
|
+
}`;wg(kg);function so(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 Cg(e){if(Array.isArray(e))return e}function Sg(e){if(Array.isArray(e))return so(e)}function Mg(e,t,n){return(t=Eg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pg(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Ag(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 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 jg(){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 Tg(e,t){return Cg(e)||Ag(e,t)||Ns(e,t)||Og()}function Nt(e){return Sg(e)||Pg(e)||Ns(e)||jg()}function zg(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 Eg(e){var t=zg(e,"string");return typeof t=="symbol"?t:t+""}function Ns(e,t){if(e){if(typeof e=="string")return so(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)?so(e,t):void 0}}var Rs=function(t){t instanceof Array?t.forEach(Rs):(t.map&&t.map.dispose(),t.dispose())},Is=function(t){t.geometry&&t.geometry.dispose(),t.material&&Rs(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(Is)},Lg=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),Is(n)}},ke=window.THREE?window.THREE:{WebGLRenderer:ae.WebGLRenderer,Scene:ae.Scene,PerspectiveCamera:ae.PerspectiveCamera,Raycaster:ae.Raycaster,SRGBColorSpace:ae.SRGBColorSpace,TextureLoader:ae.TextureLoader,Vector2:ae.Vector2,Vector3:ae.Vector3,Box3:ae.Box3,Color:ae.Color,Mesh:ae.Mesh,SphereGeometry:ae.SphereGeometry,MeshBasicMaterial:ae.MeshBasicMaterial,BackSide:ae.BackSide,Timer:ae.Timer},Fs=ko({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 Ki(s).to(a,o).easing(Bt.Quadratic.Out).onUpdate(f).onComplete(function(){t.tweenGroup.remove(this)}).start()),t.tweenGroup.add(new Ki(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 ke.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 ke.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 ke.Vector3(0,0,0),l=Math.max.apply(Math,Nt(Object.entries(n).map(function(h){var d=Tg(h,2),m=d[0],v=d[1];return Math.max.apply(Math,Nt(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 ke.Box3(new ke.Vector3(0,0,0),new ke.Vector3(0,0,0)),o=t.objects.filter(n);return o.length?(o.forEach(function(i){return r.expandByObject(i)}),Object.assign.apply(Object,Nt(["x","y","z"].map(function(i){return Mg({},i,[r.min[i],r.max[i]])})))):null},getScreenCoords:function(t,n,r,o){var i=new ke.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 ke.Vector2(n/t.width*2-1,-(r/t.height)*2+1),a=new ke.Raycaster;return a.setFromCamera(i,t.camera),Object.assign({},a.ray.at(o,new ke.Vector3))},intersectingObjects:function(t,n,r){var o=new ke.Vector2(n/t.width*2-1,-(r/t.height)*2+1),i=new ke.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;Lg(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 ke.Scene,camera:new ke.PerspectiveCamera,timer:new ke.Timer,tweenGroup:new fs,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 xg(n.container),n.pointerPos=new ke.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 x=S.getBoundingClientRect(),_=window.pageXOffset||document.documentElement.scrollLeft,w=window.pageYOffset||document.documentElement.scrollTop;return{top:x.top+w,left:x.left+_}}},{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?kl.WebGPURenderer:ke.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 Pl.EffectComposer(n.renderer),n.postProcessingComposer.addPass(new Al.RenderPass(n.scene,n.camera)),n.controls=new{trackball:Cl.TrackballControls,orbit:Sl.OrbitControls,fly:Ml.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(Nt(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 ke.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(Nt(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(Nt(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(Nt(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 ke.SphereGeometry(t.skyRadius)),n.hasOwnProperty("backgroundColor")){var c=tn(t.backgroundColor).alpha;c===void 0&&(c=1),t.renderer.setClearColor(new ke.Color(sh(1,t.backgroundColor)),c)}n.hasOwnProperty("backgroundImageUrl")&&(t.backgroundImageUrl?new ke.TextureLoader().load(t.backgroundImageUrl,function(h){h.colorSpace=ke.SRGBColorSpace,t.skysphere.material=new ke.MeshBasicMaterial({map:h,side:ke.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 Dg(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 Ng{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 Rg(e={}){const{stateInit:t=()=>({}),props:n={},methods:r={},aliases:o={},init:i=()=>{},update:a=()=>{}}=e,l=Object.keys(n).map(u=>new Ng(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=_=>(S(_,h),x(),g);function S(_,w){i.call(g,_,m,w),m.initialised=!0}const x=Dg(()=>{m.initialised&&(a.call(g,m,v),v={})},1);for(const _ of l){const{name:w,triggerUpdate:b,onChange:M,defaultVal:P}=_;g[w]=function(){const j=m[w];if(arguments.length===0)return j;const I=arguments[0],R=I===void 0?P:I;return m[w]=R,M.call(g,R,m,j),Object.prototype.hasOwnProperty.call(v,w)||(v[w]=j),b&&x(),g}}for(const _ of Object.keys(r))g[_]=function(...w){return r[_].call(g,m,...w)};for(const[_,w]of Object.entries(o))g[_]=g[w];return g.resetProps=function(){for(const _ of l)g[_.name](_.defaultVal);return g},g.resetProps(),m._rerender=x,f&&p!==void 0&&g(p),g}return s}function oa(e){if(typeof e=="function")return e;if(typeof e=="string"){const n=e;return r=>r?.[n]}const t=e;return()=>t}function Bs(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 ia=globalThis,aa=ia.THREE?ia.THREE:{AmbientLight:ae.AmbientLight,DirectionalLight:ae.DirectionalLight},Ig=170,$s=Bs("forceGraph",is),Fg=["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"],Bg=["refresh","getGraphBbox","d3Force","d3ReheatSimulation","emitParticle"],hr=Bs("renderObjs",Fs),$g=["width","height","backgroundColor","showNavInfo","enablePointerInteraction"],Hg=["lights","cameraPosition","postProcessingComposer"],To={};for(const e of Fg)To[e]=$s.linkProp(e);for(const e of $g)To[e]=hr.linkProp(e);const jn={};for(const e of Bg)jn[e]=$s.linkMethod(e);for(const e of Hg)jn[e]=hr.linkMethod(e);jn.graph2ScreenCoords=hr.linkMethod("getScreenCoords");jn.screen2GraphCoords=hr.linkMethod("getSceneCoords");const tt=e=>e;function wt(e){let t=e??null;for(;t&&!Object.prototype.hasOwnProperty.call(t,"__graphObjType");)t=t.parent;return t}const Ug=Rg({props:{nodeLabel:{default:"name",triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:1,onChange(e,t){tt(t).renderObjs.lineHoverPrecision(e)},triggerUpdate:!1},enableNavigationControls:{default:!0,onChange(e,t){const r=tt(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},...To},methods:{zoomToFit(e,t,n,...r){return tt(e).renderObjs.fitToBbox(this.getGraphBbox(...r),t,n),this},pauseAnimation(e){const t=tt(e);return t.animationFrameRequestId!=null&&(cancelAnimationFrame(t.animationFrameRequestId),t.animationFrameRequestId=null),this},resumeAnimation(e){return tt(e).animationFrameRequestId==null&&this._animationCycle(),this},_animationCycle(e){const t=tt(e);t.enablePointerInteraction&&(this.renderer().domElement.style.cursor=""),t.forceGraph.tickFrame(),t.renderObjs.tick(),t.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},scene(e){return tt(e).renderObjs.scene()},camera(e){return tt(e).renderObjs.camera()},renderer(e){return tt(e).renderObjs.renderer()},controls(e){return tt(e).renderObjs.controls()},_destructor(e){const t=tt(e);this.pauseAnimation(),this.graphData({nodes:[],links:[]}),t.forceGraph._destructor?.(),t.renderObjs._destructor()},...jn},stateInit:e=>{const t=e??{},n=new is,r=Fs({...t.controlType?{controlType:t.controlType}:{},...t.rendererConfig?{rendererConfig:t.rendererConfig}:{},...t.extraRenderers?{extraRenderers:t.extraRenderers}:{}});return r.objects([n]),r.lights([new aa.AmbientLight(13421772,Math.PI),new aa.DirectionalLight(16777215,.6*Math.PI)]),{forceGraph:n,renderObjs:r}},init(e,t){const n=tt(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)*Ig;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 wl.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 x=d.object.__initialPos,_=d.object.__prevPos,w=d.object.position,b=w.clone().sub(_);m.position.add(b),_.copy(w),w.copy(x)}const v=m.__data,g=m.position;if(!v.__dragCommitted){const x=v.__initialPos,_=x?.x??g.x,w=x?.y??g.y,b=x?.z??g.z,M=g.x-_,P=g.y-w,L=g.z-b;if(M*M+P*P+L*L<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 x of["x","y","z"])v[`f${x}`]=g[x],v[x]=g[x];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,x=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 _ of["x","y","z"]){const w=`f${_}`;g[w]===void 0&&delete v[w]}delete v.__initialFixedPos,delete v.__initialPos,delete v.__dragCommitted,v.__dragged&&(delete v.__dragged,n.onNodeDragEnd?.(v,x))}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(ae.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 oa(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 x=n[`on${h==="node"?"Node":"Link"}Hover`];x?.(null,d)}if(m){const x=n[`on${m==="node"?"Node":"Link"}Hover`];x?.(v,h===m?d:null)}const S=!!(c?n[`on${m==="node"?"Node":"Link"}Click`]:n.onBackgroundClick)&&oa(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=Vg){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 qg(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 Vg(e){return 1-(1-e)*(1-e)}function sa(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function re(e,t,n){return e+(t-e)*n}const fe=()=>!0,nt=e=>e==="2d",Pe=e=>e==="3d",Gg=[{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:nt},{key:"enablePan",setter:"enablePanInteraction",supports:nt},{key:"minZoom",setter:"minZoom",supports:nt},{key:"maxZoom",setter:"maxZoom",supports:nt},{key:"autoPauseRedraw",setter:"autoPauseRedraw",supports:nt},{key:"linkLineDash",setter:"linkLineDash",supports:nt},{key:"nodeCanvasObject",setter:"nodeCanvasObject",supports:nt},{key:"nodeCanvasObjectMode",setter:"nodeCanvasObjectMode",supports:nt},{key:"nodePointerAreaPaint",setter:"nodePointerAreaPaint",supports:nt},{key:"linkCanvasObject",setter:"linkCanvasObject",supports:nt},{key:"linkCanvasObjectMode",setter:"linkCanvasObjectMode",supports:nt},{key:"linkPointerAreaPaint",setter:"linkPointerAreaPaint",supports:nt},{key:"showNavInfo",setter:"showNavInfo",supports:Pe},{key:"enableNavigationControls",setter:"enableNavigationControls",supports:Pe},{key:"nodeOpacity",setter:"nodeOpacity",supports:Pe},{key:"nodeResolution",setter:"nodeResolution",supports:Pe},{key:"linkOpacity",setter:"linkOpacity",supports:Pe},{key:"linkResolution",setter:"linkResolution",supports:Pe},{key:"linkCurveRotation",setter:"linkCurveRotation",supports:Pe},{key:"linkMaterial",setter:"linkMaterial",supports:Pe},{key:"nodeThreeObject",setter:"nodeThreeObject",supports:Pe},{key:"nodeThreeObjectExtend",setter:"nodeThreeObjectExtend",supports:Pe},{key:"linkThreeObject",setter:"linkThreeObject",supports:Pe},{key:"linkThreeObjectExtend",setter:"linkThreeObjectExtend",supports:Pe},{key:"nodePositionUpdate",setter:"nodePositionUpdate",supports:Pe},{key:"linkPositionUpdate",setter:"linkPositionUpdate",supports:Pe},{key:"linkDirectionalArrowResolution",setter:"linkDirectionalArrowResolution",supports:Pe},{key:"linkDirectionalParticleResolution",setter:"linkDirectionalParticleResolution",supports:Pe},{key:"numDimensions",setter:"numDimensions",supports:Pe},{key:"forceEngine",setter:"forceEngine",supports:Pe},{key:"ngraphPhysics",setter:"ngraphPhysics",supports:Pe},{key:"pointerRaycasterThrottleMs",setter:"pointerRaycasterThrottleMs",supports:Pe}];function la(e,t,n,r){if(t!==n)for(const o of Gg){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 Wg=["onNodeClick","onNodeRightClick","onNodeHover","onNodeDrag","onNodeDragEnd","onLinkClick","onLinkRightClick","onLinkHover","onBackgroundClick","onBackgroundRightClick","onEngineTick","onEngineStop"],Xt=1200,Rt=300,vn=Object.freeze({x:0,y:0,z:0});function Yg(e,t,n){const r=new Ug(e,{controlType:"orbit"});r.width(t.width),r.height(t.height);const o=new Set;for(const y of Wg){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)})}}la(r,t.initialProps,{},"3d"),r.graphData(t.initialData);let i=t.initialMode,a=i==="2d"?Xt:Rt,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 G=c.get(k);G!==void 0&&i==="3d"&&C.fz===G&&delete C.fz,c.delete(k)}},S=()=>{h||(h=!0,o.add(g))},x=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=ae.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=ae.MOUSE.ROTATE))},_=()=>{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 G=B.x??0,E=B.y??0,N=Math.hypot(G,E);N>C&&(C=N)}const $=Math.max(40,C*.6);for(const B of y.nodes){const G=p.get(B);typeof G=="number"&&Number.isFinite(G)?k.set(B,G):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)):(x("3d"),r.cameraPosition?.({x:0,y:0,z:Rt},{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},L=()=>{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,I=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 G=Math.max(1,$-2*y),E=Math.max(1,B-2*y),N=k.aspect??$/B,U=C*Math.PI/180/2,q=Math.tan(U),z=Math.sin(U),H=Math.sin(Math.atan(q*N));return{fov:C,aspect:N,w:$,h:B,effW:G,effH:E,halfFovV:U,tanHalfV:q,sinHalfV:z,sinHalfH:H}},R=(y,k,C)=>{const $=r.getGraphBbox?.();if(!$)return null;const B=C??I(y);if(!B)return null;const G=($.x[0]+$.x[1])/2,E=($.y[0]+$.y[1])/2,N=($.z[0]+$.z[1])/2,U=Math.max(($.x[1]-$.x[0])/2,1),q=Math.max(($.y[1]-$.y[0])/2,1),z=Math.max(($.z[1]-$.z[0])/2,0),H=M();if(!H)return null;k.endLookAt.x=G,k.endLookAt.y=E,k.endLookAt.z=N;let F;if(i==="2d"){const ee=q*B.h/B.effH/B.tanHalfV,ne=U*B.h/B.effW/B.tanHalfV;F=ee>ne?ee:ne,F<j&&(F=j),k.endPos.x=G,k.endPos.y=E,k.endPos.z=N+F}else{const ee=Math.sqrt(U*U+q*q+z*z),ne=ee*B.h/(B.effH*B.sinHalfV),Z=ee*B.w/(B.effW*B.sinHalfH);F=ne>Z?ne:Z,F<j&&(F=j);const Y=H.lookAt??vn,K=H.x-Y.x,X=H.y-Y.y,V=H.z-Y.z,J=Math.sqrt(K*K+X*X+V*V),te=J===0?0:K/J,le=J===0?0:X/J,ve=J===0?1:V/J;k.endPos.x=G+te*F,k.endPos.y=E+le*F,k.endPos.z=N+ve*F}return k.dist=F,a=F,k},W={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"&&_(),C&&S()},getGraphData(){return r.graphData()},fit(y,k){s?.();const C=y??400,B=R(k??40,{endPos:{x:0,y:0,z:0},endLookAt:{x:0,y:0,z:0},dist:0});if(!B)return;const G=M();if(!G)return;if(C<=0){r.cameraPosition?.(B.endPos,B.endLookAt,0);return}const E=G.lookAt??vn,N=B.endPos,U=B.endLookAt;s=pt(C,q=>{r.cameraPosition?.({x:re(G.x,N.x,q),y:re(G.y,N.y,q),z:re(G.z,N.z,q)},{x:re(E.x,U.x,q),y:re(E.y,U.y,q),z:re(E.z,U.z,q)},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 ne=k?.zoom!==void 0?a/Math.max(k.zoom,.001):Xt;s=pt(B,Z=>{const Y=re(C.x,y.x,Z),K=re(C.y,y.y,Z),X=re(C.z,ne,Z);r.cameraPosition?.({x:Y,y:K,z:X},{x:Y,y:K,z:0},0)});return}const G=C.x-y.x,E=C.y-y.y,N=C.z-$,U=Math.hypot(G,E,N),q=k?.distance??120,z=U===0?{x:0,y:0,z:1}:{x:G/U,y:E/U,z:N/U},H={x:y.x+z.x*q,y:y.y+z.y*q,z:$+z.z*q},F={x:y.x,y:y.y,z:$},ee=C.lookAt??{x:0,y:0,z:0};s=pt(B,ne=>{r.cameraPosition?.({x:re(C.x,H.x,ne),y:re(C.y,H.y,ne),z:re(C.z,H.z,ne)},{x:re(ee.x,F.x,ne),y:re(ee.y,F.y,ne),z:re(ee.z,F.z,ne)},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 G=M();if(!G)return;const E=G.lookAt??{x:0,y:0,z:0},N=k??0,U={x:G.x+C,y:G.y+$,z:G.z+B},q={x:E.x+C,y:E.y+$,z:E.z+B};if(N<=0){r.cameraPosition?.(U,q,0);return}s=pt(N,z=>{r.cameraPosition?.({x:re(G.x,U.x,z),y:re(G.y,U.y,z),z:re(G.z,U.z,z)},{x:re(E.x,q.x,z),y:re(E.y,q.y,z),z:re(E.z,q.z,z)},0)})},goTo(y,k){s?.();const C=M();if(!C)return;const $=y.z??0,B=k?.durationMs??600,G=C.lookAt??{x:0,y:0,z:0},E=y.x-G.x,N=y.y-G.y,U=i==="2d"?0:$-G.z,q={x:C.x+E,y:C.y+N,z:C.z+U},z={x:y.x,y:y.y,z:i==="2d"?0:$};if(B<=0){r.cameraPosition?.(q,z,0);return}s=pt(B,H=>{r.cameraPosition?.({x:re(C.x,q.x,H),y:re(C.y,q.y,H),z:re(C.z,q.z,H)},{x:re(G.x,z.x,H),y:re(G.y,z.y,H),z:re(G.z,z.z,H)},0)})},fitToNodes(y,k,C){const $=y;if($.length===0){W.fit(k,C);return}const B=new Set($),G=r.graphData();let E=1/0,N=-1/0,U=1/0,q=-1/0,z=1/0,H=-1/0,F=0;for(const xe of G.nodes){if(!B.has(xe.id))continue;const Oe=xe,we=Oe.x??0,he=Oe.y??0,Je=Oe.z??0;we<E&&(E=we),we>N&&(N=we),he<U&&(U=he),he>q&&(q=he),Je<z&&(z=Je),Je>H&&(H=Je),F++}if(F===0){W.fit(k,C);return}const ee=k??400,ne=C??40,Z=r.camera?.()??{},Y=Z.fov??50,K=r.width?.()??t.width,X=r.height?.()??t.height;if(K<=0||X<=0)return;const V=Math.max(1,K-2*ne),J=Math.max(1,X-2*ne),te=Z.aspect??K/X,le={x:(E+N)/2,y:(U+q)/2,z:(z+H)/2},ve=Math.max((N-E)/2,1),Ze=Math.max((q-U)/2,1),Ue=Math.max((H-z)/2,0),ze=Y*Math.PI/180/2,Ye=Math.tan(ze),Qe=60,Me=M();if(!Me)return;let _e;const Ee={x:le.x,y:le.y,z:le.z};if(i==="2d"){const xe=Ze*X/J/Ye,Oe=ve*X/V/Ye,we=Math.max(xe,Oe,Qe);_e={x:le.x,y:le.y,z:le.z+we},a=we}else{const xe=Math.hypot(ve,Ze,Ue),Oe=Math.atan(Ye*te),we=xe*X/(J*Math.sin(ze)),he=xe*K/(V*Math.sin(Oe)),Je=Math.max(we,he,Qe),it=Me.lookAt??{x:0,y:0,z:0},ce=Me.x-it.x,me=Me.y-it.y,qe=Me.z-it.z,Ct=Math.hypot(ce,me,qe),zt=Ct===0?{x:0,y:0,z:1}:{x:ce/Ct,y:me/Ct,z:qe/Ct};_e={x:le.x+zt.x*Je,y:le.y+zt.y*Je,z:le.z+zt.z*Je},a=Je}if(s?.(),ee<=0){r.cameraPosition?.(_e,Ee,0);return}const Le=Me.lookAt??{x:0,y:0,z:0};s=pt(ee,xe=>{r.cameraPosition?.({x:re(Me.x,_e.x,xe),y:re(Me.y,_e.y,xe),z:re(Me.z,_e.z,xe)},{x:re(Le.x,Ee.x,xe),y:re(Le.y,Ee.y,xe),z:re(Le.z,Ee.z,xe)},0)})},getCameraState(){const y=M()??{x:0,y:0,z:Rt};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:Rt};if(y.mode==="2d"){const G=O(y.k)??Xt;if(C<=0){r.cameraPosition?.({x:y.x,y:y.y,z:G},{x:y.x,y:y.y,z:0},0);return}const E=$.lookAt??{x:0,y:0};s=pt(C,N=>{const U=re($.x,y.x,N),q=re($.y,y.y,N),z=re($.z,G,N);r.cameraPosition?.({x:U,y:q,z},{x:re(E.x,y.x,N),y:re(E.y,y.y,N),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,G=>{r.cameraPosition?.({x:re($.x,y.x,G),y:re($.y,y.y,G),z:re($.z,y.z,G)},{x:re(B.x,y.lookAt.x,G),y:re(B.y,y.lookAt.y,G),z:re(B.z,y.lookAt.z,G)},0)})},applyProps(y,k){la(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:Rt};if(y==="2d"){const F=P()??C.lookAt??vn,ne=L()??{x:F.x,y:F.y};l={x:C.x,y:C.y,z:C.z,lookAt:{x:F.x,y:F.y,z:F.z}};const Z=r.graphData(),Y=new Map;for(const te of Z.nodes){const le=te.z,ve=typeof le=="number"?le:0;Y.set(te,ve),p.set(te,ve)}const K={x:F.x,y:F.y,z:F.z},X={x:ne.x,y:ne.y,z:0},V=Math.hypot(C.x-F.x,C.y-F.y,C.z-F.z)||Xt,J={x:ne.x,y:ne.y,z:V};s=pt(k,te=>{for(const[le,ve]of Y)le.z=re(ve,0,te);r.cameraPosition?.({x:re(C.x,J.x,te),y:re(C.y,J.y,te),z:re(C.z,J.z,te)},{x:re(K.x,X.x,te),y:re(K.y,X.y,te),z:re(K.z,X.z,te)},0),te>=1&&(_(),x("2d"),a=V)},void 0,sa);return}w(),x("3d");const $=b(),B=new Map;for(const[F]of $){const ee=F.z;B.set(F,typeof ee=="number"?ee:0)}const G=P()??C.lookAt??vn,E={x:G.x,y:G.y,z:0},N=L(),U=N?{x:N.x,y:N.y,z:0}:{...E},q=Math.abs(C.z)||Rt,z=Math.PI/6;let H;if(l){const F=l.lookAt??vn;H={x:U.x+(l.x-F.x),y:U.y+(l.y-F.y),z:U.z+(l.z-F.z)}}else H={x:U.x,y:U.y-q*Math.sin(z),z:U.z+q*Math.cos(z)};s=pt(k,F=>{for(const[ee,ne]of $){const Z=B.get(ee)??0;ee.z=re(Z,ne,F)}r.cameraPosition?.({x:re(C.x,H.x,F),y:re(C.y,H.y,F),z:re(C.z,H.z,F)},{x:re(E.x,U.x,F),y:re(E.y,U.y,F),z:re(E.z,U.z,F)},0),F>=1&&(r.d3ReheatSimulation?.(),a=Math.hypot(H.x-U.x,H.y-U.y,H.z-U.z))},void 0,sa)},introFollow(y){const k=y?.padding??40,C=y?.maxDurationMs??4e3,B=r.graphData().nodes?.length??0;if(B===0)return;const G=y?.tauSeconds??.18+.09*Math.log10(Math.max(1,B)),E=B<200?2:B<2e3?4:6;s?.();const N=r.cameraPosition,U=N?N.bind(r):null,q={endPos:{x:0,y:0,z:0},endLookAt:{x:0,y:0,z:0},dist:0},z={x:0,y:0,z:0},H={x:0,y:0,z:0};let F=I(k);const ee=R(k,q,F);ee&&U&&U(ee.endPos,ee.endLookAt,0);let ne=ee?.endPos.x??0,Z=ee?.endPos.y??0,Y=ee?.endPos.z??Rt,K=ee?.endLookAt.x??0,X=ee?.endLookAt.y??0,V=ee?.endLookAt.z??0,J=0,te=0,le=ee!==null,ve=!1;const Ue=r.renderer?.()?.domElement,ze=()=>{ve=!0};Ue?.addEventListener("pointerdown",ze,{passive:!0}),Ue?.addEventListener("wheel",ze,{passive:!0});const Ye=()=>{o.delete(Me),Ue?.removeEventListener("pointerdown",ze),Ue?.removeEventListener("wheel",ze)},Qe=()=>{!le||!U||U(q.endPos,q.endLookAt,0)},Me=()=>{if(le){const _e=q.endPos,Ee=ne-_e.x,Le=Z-_e.y,xe=Y-_e.z,Oe=Ee*Ee+Le*Le+xe*xe,we=Math.max(.5,a*.001);Oe>we*we&&Qe()}Ye(),s=null};o.add(Me),s=qg(_e=>{if(ve)return Ye(),s=null,!0;if(J+=_e*1e3,J>=C)return Qe(),Ye(),s=null,!0;if(!(te&31)){const Oe=I(k);Oe&&(F=Oe)}if(te%E===0&&R(k,q,F)&&(le=!0),te++,!le||!U)return!1;const Ee=1-Math.exp(-_e/G),Le=q.endPos,xe=q.endLookAt;ne+=(Le.x-ne)*Ee,Z+=(Le.y-Z)*Ee,Y+=(Le.z-Y)*Ee,K+=(xe.x-K)*Ee,X+=(xe.y-X)*Ee,V+=(xe.z-V)*Ee,z.x=ne,z.y=Z,z.z=Y,H.x=K,H.y=X,H.z=V,U(z,H,0)})}};return W;function O(y){return!Number.isFinite(y)||y===0?null:a/y}}function Xg(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=Yg(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 Kg(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 Hs=new Set,Us=Object.freeze([]);function Br(e){const t=new Set(e);return t.size===0?{set:Hs,arr:Us}:{set:t,arr:Object.freeze([...t])}}const $r={set:Hs,arr:Us};function Zg(e){const t=e.mode??"single",[n,r]=A.useState($r),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?$r:Br([c]);const m=new Set(h.set);return d?m.delete(c):m.add(c),Br(m)})},[t]),l=A.useCallback(c=>{t!=="none"&&r(()=>{const p=t==="single"?(()=>{for(const h of c)return[h];return[]})():c;return Br(p)})},[t]),s=A.useCallback(()=>r($r),[]),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 Qg(){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 Jg(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 ev(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=_=>{p.x=_.clientX-h.left,p.y=_.clientY-h.top,c.current=p};t.addEventListener("mousemove",v);const g=_=>{if(n.current?.stopAnimation(),_.button!==0||!_.shiftKey||s.current.liveHoverNodeIdRef.current!==null)return;const w=_.clientX-h.left,b=_.clientY-h.top;_.stopPropagation(),_.preventDefault(),f({x0:w,y0:b,x1:w,y1:b,additive:_.shiftKey});let M=null;const P=()=>{M===null&&(M=requestAnimationFrame(()=>{M=null;const I=n.current;I&&f(R=>{if(!R)return R;const W=Math.min(R.x0,R.x1),O=Math.min(R.y0,R.y1),y=Math.max(R.x0,R.x1),k=Math.max(R.y0,R.y1);if(y-W<4&&k-O<4){if(R.count===void 0)return R;const{count:$,...B}=R;return B}let C=0;for(const $ of s.current.nodes){if($.x===void 0||$.y===void 0)continue;const B=I.graph2Screen($.x,$.y,$.z);B.x>=W&&B.x<=y&&B.y>=O&&B.y<=k&&C++}return R.count===C?R:{...R,count:C}})}))},L=I=>{const R=I.clientX-h.left,W=I.clientY-h.top;f(O=>O&&{...O,x1:R,y1:W}),P()},j=I=>{window.removeEventListener("mousemove",L),window.removeEventListener("mouseup",j,!0),M!==null&&(cancelAnimationFrame(M),M=null);const R=I.clientX-h.left,W=I.clientY-h.top;f(null);const O=n.current;if(!O)return;const y=Math.min(w,R),k=Math.min(b,W),C=Math.max(w,R),$=Math.max(b,W);if(C-y<3&&$-k<3)return;const B=s.current,G=B.nodes,E=B.links,N=B.selection,U=B.setSelectedLinkIds,q=[],z=(Z,Y)=>Z>=y&&Z<=C&&Y>=k&&Y<=$,H=new Map;for(const Z of G){if(H.set(Z.id,Z),Z.x===void 0||Z.y===void 0)continue;const Y=O.graph2Screen(Z.x,Z.y,Z.z);z(Y.x,Y.y)&&q.push(Z.id)}const F=[],ee=Z=>{if(Z&&typeof Z=="object"){const Y=Z;if(Y.x!==void 0&&Y.y!==void 0)return Y.z!==void 0?{x:Y.x,y:Y.y,z:Y.z}:{x:Y.x,y:Y.y}}if(typeof Z=="string"||typeof Z=="number"){const Y=H.get(Z);if(Y&&Y.x!==void 0&&Y.y!==void 0)return Y.z!==void 0?{x:Y.x,y:Y.y,z:Y.z}:{x:Y.x,y:Y.y}}return null};for(const Z of E){if(Z.id===void 0)continue;const Y=ee(Z.source),K=ee(Z.target);if(!Y||!K)continue;const X=O.graph2Screen((Y.x+K.x)/2,(Y.y+K.y)/2,Y.z!==void 0&&K.z!==void 0?(Y.z+K.z)/2:void 0),V=O.graph2Screen(Y.x,Y.y,Y.z),J=O.graph2Screen(K.x,K.y,K.z);(z(X.x,X.y)||z(V.x,V.y)&&z(J.x,J.y))&&F.push(Z.id)}if(I.shiftKey||I.metaKey||I.ctrlKey){const Z=N.selected,Y=Z.slice(),K=new Set(Z);for(const X of q)K.has(X)||(K.add(X),Y.push(X));N.set(Y),U(X=>{const V=X.slice(),J=new Set(X);for(const te of F)J.has(te)||(J.add(te),V.push(te));return V})}else N.set(q),U(F)};window.addEventListener("mousemove",L),window.addEventListener("mouseup",j,!0)};t.addEventListener("mousedown",g,!0);const S=()=>n.current?.stopAnimation(),x=()=>n.current?.stopAnimation();return t.addEventListener("wheel",S,{passive:!0,capture:!0}),t.addEventListener("touchstart",x,{passive:!0,capture:!0}),()=>{t.removeEventListener("mousemove",v),t.removeEventListener("mousedown",g,!0),t.removeEventListener("wheel",S,{capture:!0}),t.removeEventListener("touchstart",x,{capture:!0}),window.removeEventListener("scroll",d,{capture:!0}),m.disconnect()}},[t,n]),{marquee:u,lastCursorRef:c}}const tv=60;function nv(e,t={}){const n=typeof t=="number"?{tolerancePx:t}:t,r=n.tolerancePx??12,o=n.pressGraceMs??tv;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 rv(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 _=new Set(o.selected),w=[];for(const b of n.data.nodes){if(!_.has(b.id))continue;const{id:M,x:P,y:L,z:j,vx:I,vy:R,vz:W,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 _=new Set(o.selected),w=n.data.nodes.filter(b=>_.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 _=new Set(o.selected),w=n.data.nodes.filter(M=>_.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(_=>{if(!t)return[];const w=c.current;if(w.length===0)return[];const b=_||(()=>{const P=l.current;if(!(!P||!a.current))return a.current.screen2Graph(P.x,P.y)})(),M=n.addNodes(w.map((P,L)=>{const j=L%3*24,I=Math.floor(L/3)*24;return{...P,...b?{x:b.x+j,y:b.y+I,...b.z!==void 0?{z:b.z+I}:{}}:{}}}));return o.set(M.map(P=>P.id)),i([]),f?.(M),M},[t,n,o,i,f,a,l]),v=A.useCallback(()=>{const _=new Set(o.selected),w=[];let b=0;for(const P of n.data.nodes){if(!_.has(P.id))continue;const{id:L,vx:j,vy:I,vz:R,fx:W,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(_=>{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=_?.at;if(!M){let j=0,I=0,R=0,W=!1;for(const O of b)j+=O.x??0,I+=O.y??0,R+=O.z??0,(O.x!==void 0||O.y!==void 0)&&(W=!0);W&&(M={x:j/b.length+30,y:I/b.length+30,z:R/b.length})}const P=_?.label!==void 0?{label:_.label}:{},L=n.addNode(P,M?{at:M}:void 0);for(const j of b)n.addLink({source:j.id,target:L.id});return o.set([L.id]),i([]),L},[n,o,i]),S=A.useCallback(_=>{const w=n.data.nodes.find(b=>b.id===_);w&&(w.fx!==void 0?n.updateNode(_,{fx:void 0,fy:void 0,fz:void 0}):n.updateNode(_,{fx:w.x,fy:w.y,...w.z!==void 0?{fz:w.z}:{}}))},[n]),x=A.useCallback(()=>c.current.length>0,[]);return A.useMemo(()=>({hasClipboard:x,copy:h,cut:d,paste:m,duplicate:v,addConnectedNode:g,togglePin:S}),[x,h,d,m,v,g,S])}async function ca(e,t,n){if(t.length===0||!e)return!0;try{return await e(t,{source:n})}catch{return!1}}function ov(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(ca(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(ca(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 ua=40;function iv(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=ua/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=ua/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 av(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",gi(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",wi(f)),t.d3Force("y",ki(0).strength(l))):(t.d3Force("y",ki(f)),t.d3Force("x",wi(0).strength(l)));const c=(o??4)+2;t.d3Force("collide",gi(c)),t.reheat()},[t,r,o])}function rn(e,t){return typeof e=="function"?e(t):typeof e=="string"?t[e]:e}function fa(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 da(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,Pn=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Tn="rgba(96, 102, 110, 0.55)",pr="rgba(180, 188, 198, 0.55)";function sv(e,t){if(t<=0)return 0;let n=0;for(let r=0;r<e.length;r++)n=n*31+e.charCodeAt(r)|0;return Math.abs(n)%t}function zo(e,t=Pn){return t.length===0?Pn[0]:t[sv(e,t.length)]}function lv(e){const{mode:t,accentColor:n,nodeColor:r,linkColor:o,linkWidth:i,nodeVal:a,nodeRelSize:l,nodePointerAreaPaint:s,nodeAutoColorBy:u,nodeVisibility:f,nodePalette:c,linkDefaultColor:p,linkHoverColor:h,selectedNodeSet:d,selectedLinkSet:m,highlightNeighborsOnHover:v,highlightedNodeIds:g,highlightedLinkIds:S,hoverNodeId:x,hoverLinkId:_,hiddenGroups:w}=e,b=A.useRef({mode:t,accentColor:n,selectedNodeSet:d,selectedLinkSet:m,highlightNeighborsOnHover:v,highlightedNodeIds:g,highlightedLinkIds:S,hoverNodeId:x,hoverLinkId:_,hiddenGroups:w});b.current={mode:t,accentColor:n,selectedNodeSet:d,selectedLinkSet:m,highlightNeighborsOnHover:v,highlightedNodeIds:g,highlightedLinkIds:S,hoverNodeId:x,hoverLinkId:_,hiddenGroups:w};const M=A.useMemo(()=>{if(r!==void 0||u===void 0)return;const K=u;return X=>{const V=typeof K=="function"?K(X):X[K];return V==null?X.color??"#888":zo(String(V),c)}},[r,u,c]),P=r??M,L=d.size>0||m.size>0||v&&g.size>0,j=A.useMemo(()=>{const K=P;return X=>{const V=b.current;if(X.id!==void 0&&V.selectedNodeSet.has(X.id))return V.accentColor;if(V.highlightNeighborsOnHover&&V.highlightedNodeIds.size>0&&X.id!==void 0&&V.highlightedNodeIds.has(X.id))return V.hoverNodeId===X.id?V.accentColor:yn(V.accentColor,.7);let te;return typeof K=="function"?te=K(X):typeof K=="string"?te=K:te=X.color??"#888",(V.selectedNodeSet.size>0||V.selectedLinkSet.size>0)&&V.mode!=="3d"?yn(te,.25):te}},[P,d,m,x,g]),I=L?j:P,R=u!==void 0&&w.size>0,W=d.size>0||m.size>0||_!==null||v&&S.size>0||R,O=p??Tn,y=h??pr,k=A.useMemo(()=>{const K=o,X=u;return V=>{const J=b.current,te=V.id,le=typeof V.source=="object"?V.source:null,ve=typeof V.target=="object"?V.target:null;if(J.hiddenGroups.size>0&&X!==void 0){const Le=we=>{if(!we)return null;const he=typeof X=="function"?X(we):we[X];return he==null?null:String(he)},xe=Le(le),Oe=Le(ve);if(xe!==null&&J.hiddenGroups.has(xe)||Oe!==null&&J.hiddenGroups.has(Oe)){let we;return typeof K=="function"?we=K(V):typeof K=="string"?we=K:we=V.color??O,yn(we,.05)}}if(te!==void 0&&J.selectedLinkSet.has(te))return J.accentColor;const Ze=le?.id??V.source,Ue=ve?.id??V.target,ze=J.selectedNodeSet.size>0;if(ze&&(Ze!==void 0&&J.selectedNodeSet.has(Ze)||Ue!==void 0&&J.selectedNodeSet.has(Ue)))return yn(J.accentColor,.85);const Qe=te!==void 0&&J.hoverLinkId===te,Me=J.highlightNeighborsOnHover&&te!==void 0&&J.highlightedLinkIds.has(te);if(Qe||Me)return y;let _e;return typeof K=="function"?_e=K(V):typeof K=="string"?_e=K:_e=V.color??O,ze||J.selectedLinkSet.size>0?yn(_e,J.mode==="3d"?.45:.18):_e}},[o,u,m,d,_,S,w,p,h]),C=W?k:o,$=d.size>0||m.size>0||_!==null||v&&S.size>0,B=.6,G=1.5,E=.4,N=1,U=.5,q=1.2,z=A.useMemo(()=>{const K=i;return X=>{const V=b.current,J=X.id,te=J!==void 0&&V.selectedLinkSet.has(J),le=typeof X.source=="object"?X.source.id:X.source,ve=typeof X.target=="object"?X.target.id:X.target,Ue=V.selectedNodeSet.size>0&&(le!==void 0&&V.selectedNodeSet.has(le)||ve!==void 0&&V.selectedNodeSet.has(ve)),ze=J!==void 0&&V.hoverLinkId===J,Ye=V.highlightNeighborsOnHover&&J!==void 0&&V.highlightedLinkIds.has(J),Qe=ze||Ye,Me=typeof K=="function"?K(X):typeof K=="number"?K:X.width??1,_e=V.mode==="3d";return te?Me+(_e?U:q):Qe?Me+(_e?B:G):Ue?Me+(_e?E:N):Me}},[i]),H=$?z:i,F=d.size>0||v&&g.size>0,ee=A.useMemo(()=>{const K=a;return X=>{const V=b.current,J=X.id,te=typeof K=="function"?K(X):typeof K=="number"?K:X.val??1;return J!==void 0&&V.selectedNodeSet.has(J)?te*2.25:V.highlightNeighborsOnHover&&V.highlightedNodeIds.size>0&&J!==void 0&&V.highlightedNodeIds.has(J)?V.hoverNodeId===J?te*1.8:te*1.4:te}},[a]),ne=F?ee:a,Z=A.useMemo(()=>{if(t!=="2d"||s)return s;const K=a,X=l??4;return(V,J,te,le)=>{const ve=typeof K=="function"?K(V):typeof K=="number"?K:V.val??1,Ze=Math.sqrt(Math.max(0,ve))*X+1/Math.max(le,1e-6);te.fillStyle=J,te.beginPath(),te.arc(V.x??0,V.y??0,Ze,0,2*Math.PI,!1),te.fill()}},[t,a,l,s]),Y=A.useMemo(()=>{const K=u&&w.size>0;if(!K&&f===void 0)return;const X=u,V=f;return J=>{if(K&&X){const te=typeof X=="function"?X(J):J[X];if(te!=null&&w.has(String(te)))return!1}return typeof V=="function"?!!V(J):typeof V=="boolean"?V:typeof V=="string"?!!J[V]:!0}},[u,f,w]);return A.useMemo(()=>({nodeColor:I,linkColor:C,linkWidth:H,nodeVal:ne,nodePointerAreaPaint:Z,nodeVisibility:Y}),[I,C,H,ne,Z,Y])}const ha=250;function pa(e){return e==null?null:typeof e=="string"||typeof HTMLElement<"u"&&e instanceof HTMLElement?e:String(e)}function cv(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),x=A.useRef(null),_=A.useRef(null);A.useEffect(()=>()=>{x.current!==null&&(clearTimeout(x.current),x.current=null),_.current!==null&&(clearTimeout(_.current),_.current=null)},[]);const w=A.useCallback((j,I)=>{if(o?.(j,I),v.current=j?.id??null,!j&&S.current!==null)return;if(x.current!==null&&(clearTimeout(x.current),x.current=null),!j){x.current=setTimeout(()=>{x.current=null,l(null),t&&(c(Kt),h(Kt)),g.current===null&&m(null)},ha);return}if(t){const W=new Set([j.id]),O=new Set,y=j._neighbors??[];for(const C of y)C.id!==void 0&&W.add(C.id);const k=j._links??[];for(const C of k)C.id!==void 0&&O.add(C.id);l(j.id),c(W),h(O)}else l(j.id);const R=rn(n,j);m(pa(R))},[o,n,t]),b=A.useCallback((j,I)=>{if(i?.(j,I),g.current=j?.id??null,_.current!==null&&(clearTimeout(_.current),_.current=null),!j){_.current=setTimeout(()=>{_.current=null,u(null),v.current===null&&m(null)},ha);return}u(j.id??null);const R=rn(r,j);m(pa(R))},[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]),L=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:L}}const Mt={frameId:-1,fov:-1,tanHalfFov:0,canvasHeightPx:1},ga=new ae.Vector2;function uv(e,t){const n=e.info?.render?.frame??-1;return n===Mt.frameId&&t===Mt.fov||(e.getSize(ga),Mt.frameId=n,Mt.fov=t,Mt.tanHalfFov=Math.tan(t*Math.PI/180/2),Mt.canvasHeightPx=ga.y||1),Mt}function ir(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 ar(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 ae.Sprite(new ae.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 L=b.getContext("2d");if(L.font=`${n}px ${r}`,P){L.fillStyle=P;const j=Math.min(b.height/2,8),I=L;L.beginPath(),typeof I.roundRect=="function"?I.roundRect(0,0,b.width,b.height,j):L.rect(0,0,b.width,b.height),L.fill()}L.fillStyle=M,L.textAlign="center",L.textBaseline="middle",L.fillText(t,b.width/2,b.height/2)},m=document.createElement("canvas");d(m,o,i);const v=new ae.CanvasTexture(m);v.minFilter=ae.LinearFilter,v.magFilter=ae.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 ae.CanvasTexture(b),g.minFilter=ae.LinearFilter,g.magFilter=ae.LinearFilter,g.needsUpdate=!0}const S=new ae.SpriteMaterial({map:v,transparent:!0,depthWrite:!1}),x=new ae.Sprite(S),_=x.userData;_.normalTexture=v,g&&(_.selectedTexture=g);const w=p/h;if(x.scale.set(l*w,l,1),e.pixelHeight!==void 0&&e.pixelHeight>0){const b=e.pixelHeight,M=new ae.Vector3;let P=-1;x.onBeforeRender=(L,j,I)=>{const R=I;if(!R.isPerspectiveCamera||typeof R.fov!="number")return;x.getWorldPosition(M);const W=R.position.distanceTo(M);if(W<=0)return;const O=uv(L,R.fov),y=2*O.tanHalfFov*W*b/O.canvasHeightPx;P>0&&Math.abs(y-P)<P*.005||(P=y,x.scale.set(y*w,y,1))}}return x}function fv(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,L)=>{const j=d.current,I=M.id!==void 0&&j.selectedNodeSet.has(M.id),R=M.id!==void 0&&j.hoveredNodeSet?.has(M.id)===!0;if(!j.showLabels&&!I&&!R)return;const W=fa(s,M);if(!W)return;const O=rn(u,M)??1,y=f??4,k=Math.max(.5,Math.sqrt(Math.max(O,0))*y),C=14/L,$=6/L,B=4/L;P.font=`${C}px ${b}`;const E=P.measureText(W).width+$*2,N=C+B*2,U=M.x??0,q=(M.y??0)-k*2-4/L-N;P.fillStyle=I?j.accentColor:j.tooltipBg;const z=Math.min(N/2,6/L),H=P;P.beginPath(),typeof H.roundRect=="function"?H.roundRect(U-E/2,q,E,N,z):P.rect(U-E/2,q,E,N),P.fill(),P.textAlign="center",P.textBaseline="top",P.fillStyle=I?"#ffffff":j.tooltipFg,P.fillText(W,U,q+B)}},[t,a,s,u,f,c?.fontFamily]),v=o?.size??0,S=n||r.size>0||v>0?m:void 0,x=A.useRef(new Map),_=A.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:o});_.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:o},A.useEffect(()=>{const b=x.current;return()=>{for(const M of b.values())M.sprite&&ir(M.sprite);b.clear()}},[]);const w=A.useMemo(()=>{if(l)return;const b=x.current,M=c?.fontFamily??"system-ui, sans-serif";return P=>{const L=P.id,j=fa(s,P),I=rn(u,P)??1,R=f??4,O=Math.cbrt(Math.max(I,0))*R*2+4,y=new ae.Group;if(L!==void 0&&j){const k={group:y,sprite:null,text:j,yOffset:O};b.set(L,k);const C=_.current,$=C.selectedNodeSet.has(L),B=C.hoveredNodeSet?.has(L)===!0;if(C.showLabels||$||B){const G=ar({text:j,fontFamily:M,fontSize:48,color:h,backgroundColor:p,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:28});if(G.material.depthTest=!1,G.renderOrder=1e3,G.position.set(0,O,0),$){const E=G.userData;if(E.selectedTexture){const N=G.material;N.map=E.selectedTexture,N.needsUpdate=!0}}y.add(G),k.sprite=G}}return y}},[l,s,u,f,c?.fontFamily,p,h,i]);return A.useEffect(()=>{const b=x.current,M=c?.fontFamily??"system-ui, sans-serif";for(const[P,L]of b){if(L.group.parent===null){L.sprite&&ir(L.sprite),b.delete(P);continue}const j=r.has(P),I=o?.has(P)===!0,R=n||j||I;if(R&&L.sprite===null){const O=ar({text:L.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,L.yOffset,0),L.group.add(O),L.sprite=O}const W=L.sprite;if(W){W.visible=R;const O=W.userData,y=j&&O.selectedTexture?O.selectedTexture:O.normalTexture,k=W.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 dv(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(L,j)=>{const I=h.current,R=L.id!==void 0&&I.selectedLinkSet.has(L.id),W=L.id!==void 0&&I.hoveredLinkSet?.has(L.id)===!0;if(!I.showLabels&&!R&&!W)return;const O=L.source,y=L.target;if(typeof O!="object"||typeof y!="object")return;const k=da(u,L);if(!k||k===" → ")return;const C=O.x,$=O.y,B=y.x,G=y.y;if(C===void 0||$===void 0||B===void 0||G===void 0)return;const E=B-C,N=G-$,q=Math.sqrt(E*E+N*N)-P*2;if(q<=0)return;j.font=`1px ${b}`;const z=j.measureText(k).width||1,H=Math.min(M,q/z);j.font=`${H}px ${b}`;let F=Math.atan2(N,E);F>Math.PI/2&&(F=-(Math.PI-F)),F<-Math.PI/2&&(F=-(-Math.PI-F));const ee=(C+B)/2,ne=($+G)/2,Z=j.measureText(k).width,Y=H*.6,K=H*.35,X=Z+Y,V=H+K,J=Math.min(V/2,H*.35);j.save(),j.translate(ee,ne),j.rotate(F),j.fillStyle=R?I.accentColor:I.tooltipBg;const te=j;j.beginPath(),typeof te.roundRect=="function"?te.roundRect(-X/2,-V/2,X,V,J):j.rect(-X/2,-V/2,X,V),j.fill(),j.textAlign="center",j.textBaseline="middle",j.fillStyle=R?"#ffffff":I.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),x=A.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:o});x.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:o},A.useEffect(()=>{const b=S.current;return()=>{for(const M of b.values())M.sprite&&ir(M.sprite);b.clear()}},[]);const _=A.useMemo(()=>{if(l)return;const b=S.current,M=f?.fontFamily??"system-ui, sans-serif";return P=>{const L=da(u,P),j=new ae.Group,I=P.id;if(I!==void 0&&L&&L!==" → "){const R={group:j,sprite:null,text:L};b.set(I,R);const W=x.current,O=W.selectedLinkSet.has(I),y=W.hoveredLinkSet?.has(I)===!0;if(W.showLabels||O||y){const k=ar({text:L,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),R.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,L]of b){if(L.group.parent===null){L.sprite&&ir(L.sprite),b.delete(P);continue}const j=r.has(P),I=o?.has(P)===!0,R=n||j||I;if(R&&L.sprite===null){const O=ar({text:L.text,fontFamily:M,fontSize:48,color:p,backgroundColor:c,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:22});O.material.depthTest=!1,O.renderOrder=500,L.group.add(O),L.sprite=O}const W=L.sprite;if(W){W.visible=R;const O=W.userData,y=j&&O.selectedTexture?O.selectedTexture:O.normalTexture,k=W.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 ae.Group){const L=(P.start.x+P.end.x)/2,j=(P.start.y+P.end.y)/2,I=(P.start.z+P.end.z)/2;M.position.set(L,j,I);const R=M.parent;if(R&&!R.userData.lgcOrderApplied){R.userData.lgcOrderApplied=!0,R.renderOrder=-1;for(const O of R.children)O!==M&&(O.renderOrder=-1)}const W=M.children[0];if(W instanceof ae.Sprite){const O=W.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:_,positionUpdate:w}}function hv({nodeCount:e,linkCount:t}){const n=e+t*.5;return n>=5e4?"huge":n>=1e4?"xlarge":n>=2e3?"large":"default"}function pv(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 gv(e){const{profile:t="auto",nodeCount:n,linkCount:r,mode:o}=e;return A.useMemo(()=>{if(t==="off")return{};const i=t==="auto"?hv({nodeCount:n,linkCount:r}):t;return pv(i)},[t,n,r,o])}function vv(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 yv(){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 Te={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},mv=e=>D.jsx("svg",{...Te,...e,children:D.jsx("path",{d:"M3 2.5l4 10 1.4-3.6 3.6-1.4z"})}),bv=e=>D.jsx("svg",{...Te,...e,children:D.jsx("path",{d:"M8 3v10M3 8h10M5 5l6 6M11 5L5 11"})}),_v=e=>D.jsxs("svg",{...Te,...e,children:[D.jsx("circle",{cx:"6",cy:"8",r:"3"}),D.jsx("path",{d:"M12 5v6M9 8h6"})]}),xv=e=>D.jsxs("svg",{...Te,...e,children:[D.jsx("circle",{cx:"4",cy:"4",r:"2"}),D.jsx("circle",{cx:"12",cy:"12",r:"2"}),D.jsx("path",{d:"M5.5 5.5l5 5"})]}),qs=e=>D.jsx("svg",{...Te,...e,children:D.jsx("path",{d:"M3 5h10M6 5V3h4v2M5 5l1 8h4l1-8"})}),wv=e=>D.jsx("svg",{...Te,...e,children:D.jsx("path",{d:"M3 6V3h3M13 6V3h-3M3 10v3h3M13 10v3h-3"})}),kv=e=>D.jsxs("svg",{...Te,...e,children:[D.jsx("circle",{cx:"7",cy:"7",r:"4"}),D.jsx("path",{d:"M5 7h4M7 5v4M10 10l3 3"})]}),Cv=e=>D.jsxs("svg",{...Te,...e,children:[D.jsx("circle",{cx:"7",cy:"7",r:"4"}),D.jsx("path",{d:"M5 7h4M10 10l3 3"})]}),Sv=e=>D.jsx("svg",{...Te,...e,children:D.jsx("path",{d:"M6 3v10M10 3v10"})}),Mv=e=>D.jsx("svg",{...Te,...e,children:D.jsx("path",{d:"M5 3l8 5-8 5z"})}),Pv=e=>D.jsxs("svg",{...Te,...e,children:[D.jsx("path",{d:"M3 5h2l1-2h4l1 2h2v8H3z"}),D.jsx("circle",{cx:"8",cy:"9",r:"2.5"})]}),Vs=e=>D.jsxs("svg",{...Te,...e,children:[D.jsx("path",{d:"M8 2l5 3v6l-5 3-5-3V5z"}),D.jsx("path",{d:"M8 8v7M8 8L3 5M8 8l5-3"})]}),Av=e=>D.jsx("svg",{...Te,...e,children:D.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),Gs=e=>D.jsxs("svg",{...Te,...e,children:[D.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),D.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"})]}),Ov=e=>D.jsxs("svg",{...Te,...e,children:[D.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",strokeDasharray:"2 2"}),D.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor"}),D.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"currentColor"}),D.jsx("circle",{cx:"6",cy:"10",r:"1",fill:"currentColor"}),D.jsx("circle",{cx:"10",cy:"10",r:"1",fill:"currentColor"})]}),jv=e=>D.jsxs("svg",{...Te,...e,children:[D.jsx("path",{d:"M8 2v8M5 5l3-3 3 3"}),D.jsx("path",{d:"M3 12h10v2H3z"})]}),Tv=e=>D.jsxs("svg",{...Te,...e,children:[D.jsx("path",{d:"M8 10V2M5 7l3 3 3-3"}),D.jsx("path",{d:"M3 12h10v2H3z"})]}),zv=e=>D.jsxs("svg",{...Te,...e,children:[D.jsx("circle",{cx:"4",cy:"8",r:"2"}),D.jsx("path",{d:"M6 8h2.5"}),D.jsx("circle",{cx:"11",cy:"8",r:"2"}),D.jsx("path",{d:"M11 6.5v3M9.5 8h3"})]}),Ws={select:{id:"select",label:"Select",hint:"Select / multi-select nodes",icon:mv,toggleable:!0,shortcut:"V"},pan:{id:"pan",label:"Pan",hint:"Pan the canvas",icon:bv,toggleable:!0,shortcut:"H"},"add-node":{id:"add-node",label:"Add node",hint:"Click on the canvas to add a node",icon:_v,toggleable:!0,shortcut:"N"},"add-link":{id:"add-link",label:"Add link",hint:"Click two nodes to connect them",icon:xv,toggleable:!0,shortcut:"L"},delete:{id:"delete",label:"Delete",hint:"Delete selected node(s)",icon:qs,shortcut:"⌫"},fit:{id:"fit",label:"Fit",hint:"Fit graph to viewport",icon:wv,shortcut:"F"},"zoom-in":{id:"zoom-in",label:"Zoom in",hint:"Zoom in",icon:kv,shortcut:"+"},"zoom-out":{id:"zoom-out",label:"Zoom out",hint:"Zoom out",icon:Cv,shortcut:"-"},pause:{id:"pause",label:"Pause",hint:"Pause simulation",icon:Sv},resume:{id:"resume",label:"Resume",hint:"Resume simulation",icon:Mv},screenshot:{id:"screenshot",label:"Screenshot",hint:"Download a PNG of the canvas",icon:Pv},"toggle-mode":{id:"toggle-mode",label:"2D / 3D",hint:"Toggle between 2D and 3D",icon:Vs,shortcut:"3"},duplicate:{id:"duplicate",label:"Duplicate",hint:"Duplicate the current selection",icon:Gs,shortcut:"⌘D"},"select-all":{id:"select-all",label:"Select all",hint:"Select every node",icon:Ov,shortcut:"⌘A"},"export-json":{id:"export-json",label:"Export",hint:"Download the graph as JSON",icon:jv},"import-json":{id:"import-json",label:"Import",hint:"Load a JSON graph from disk",icon:Tv}},lo=["select","pan","add-node","add-link","select-all","fit","zoom-in","zoom-out","pause","resume","screenshot","export-json","import-json"];function Ys(e){return e==="2d"?Vs:Av}function Ev(e,t){if(e===!1)return[];let n;if(e===!0)n=lo;else if(Array.isArray(e))n=e;else{const r=e.include??lo,o=new Set(e.exclude??[]);n=r.filter(i=>!o.has(i))}return n.filter(r=>r==="pause"?!t:r==="resume"?t:!0)}function Lv(e){return e&&typeof e=="object"&&!Array.isArray(e)?e.position??"top-right":"top-right"}function Dv(e){const{config:t,activeTool:n,paused:r,mode:o,isDisabled:i,onSelect:a}=e,l=Ev(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=Lv(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 D.jsx("div",{className:`lgc-toolbar lgc-toolbar--${p}`,role:"toolbar",children:l.map((m,v)=>{const g=Ws[m],S=m==="toggle-mode"?Ys(o):g.icon,x=g.toggleable&&n===m,_=i?.(m)??!1,w=[g.hint,g.shortcut?`(${g.shortcut})`:""],b=v===h;return D.jsx("button",{ref:M=>{f.current[v]=M},type:"button",className:["lgc-tool",x?"lgc-tool--active":"",_?"lgc-tool--disabled":""].join(" ").trim(),"aria-label":g.label,"aria-pressed":x?"true":void 0,disabled:_,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:D.jsx(S,{})},m)})})}const Zt=8;function Nv({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]),D.jsx("div",{ref:o,className:"lgc-menu",role:"menu",style:{left:i.left,top:i.top},children:n.map((l,s)=>"separator"in l?D.jsx("div",{className:"lgc-menu-separator"},`sep-${s}`):D.jsxs("div",{role:"menuitem",className:"lgc-menu-item","aria-disabled":l.disabled?"true":void 0,onClick:()=>{l.disabled||(l.onSelect(),r())},children:[D.jsx("span",{children:l.label}),l.shortcut?D.jsx("span",{style:{marginLeft:"auto",opacity:.6},children:l.shortcut}):null]},l.id))})}const Rv=120,Qt=14;function Iv({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),Rv),S=_=>{const w=a.current??v.getBoundingClientRect();r({x:_.clientX-w.left,y:_.clientY-w.top})},x=()=>{a.current=v.getBoundingClientRect()};return v.addEventListener("mousemove",S),window.addEventListener("resize",x),()=>{window.clearTimeout(g),v.removeEventListener("mousemove",S),window.removeEventListener("resize",x)}},[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(),x=g.offsetWidth,_=g.offsetHeight;u(n.x+Qt+x>S.width),c(n.y+Qt+_>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 D.jsx("div",{ref:l,className:"lgc-tooltip",role:"tooltip",style:{left:d,top:m,pointerEvents:"none"},children:typeof e=="string"?e:D.jsx("span",{ref:v=>v?.appendChild(e)})})}function Fv({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 D.jsx("div",{className:"lgc-marquee",style:{left:n,top:r,width:o,height:i,pointerEvents:"none"},children:t&&t>0?D.jsx("span",{className:"lgc-marquee-count",children:t}):null})}function Bv(e){return D.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:[D.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),D.jsx("path",{d:"M6 5h7v7"})]})}function $v(e){return D.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:[D.jsx("circle",{cx:"5",cy:"11",r:"2"}),D.jsx("circle",{cx:"11",cy:"11",r:"2"}),D.jsx("path",{d:"M6.5 9.5L13 3M5 8L9.5 9.5"})]})}function va(e){return D.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:[D.jsx("rect",{x:"3",y:"4",width:"10",height:"10",rx:"1"}),D.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 D.jsx("button",{type:"button",className:"lgc-selpanel-btn","aria-label":e,title:t?`${e} (${t})`:e,disabled:n,onClick:r,children:o})}function Hv({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:D.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[D.jsx("span",{className:"lgc-selpanel-label",children:"Clipboard ready"}),D.jsx(Pt,{label:"Paste",shortcut:"⌘V",onClick:u,children:D.jsx(va,{})})]});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 D.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[D.jsx("span",{className:"lgc-selpanel-label",children:p}),D.jsx("div",{className:"lgc-selpanel-divider"}),D.jsx(Pt,{label:"Delete",shortcut:"⌫",onClick:o,children:D.jsx(qs,{width:14,height:14})}),D.jsx(Pt,{label:"Duplicate",shortcut:"⌘D",onClick:i,children:D.jsx(Gs,{width:14,height:14})}),D.jsx(Pt,{label:"Connect to new node",shortcut:"↵",disabled:e===0,onClick:a,children:D.jsx(zv,{})}),r?D.jsxs(D.Fragment,{children:[D.jsx(Pt,{label:"Copy",shortcut:"⌘C",disabled:e===0,onClick:l,children:D.jsx(Bv,{})}),D.jsx(Pt,{label:"Cut",shortcut:"⌘X",disabled:e===0,onClick:s,children:D.jsx($v,{})}),D.jsx(Pt,{label:"Paste",shortcut:"⌘V",disabled:!n,onClick:u,children:D.jsx(va,{})})]}):null,D.jsx("div",{className:"lgc-selpanel-divider"}),D.jsx(Pt,{label:"Clear selection",shortcut:"Esc",onClick:f,children:"✕"})]})}function Uv({nodes:e,groupBy:t,hidden:n,onToggle:r,palette:o}){const i=A.useMemo(()=>{if(!t)return[];const a=new Set;for(const l of e){const s=typeof t=="function"?t(l):l[t];s!=null&&a.add(String(s))}return Array.from(a).sort()},[e,t]);return i.length===0?null:D.jsx("div",{className:"lgc-legend",role:"region","aria-label":"Groups",children:i.map(a=>{const l=n.has(a);return D.jsxs("button",{type:"button",className:["lgc-legend-item",l?"lgc-legend-item--hidden":""].join(" ").trim(),onClick:()=>r(a),"aria-pressed":l?"false":"true",title:`Toggle ${a}`,children:[D.jsx("span",{className:"lgc-legend-swatch",style:{background:zo(a,o)}}),D.jsx("span",{children:a})]},a)})})}function qv({mode:e,onToggle:t}){const n=Ys(e),r=e==="2d"?"3D":"2D";return D.jsxs("button",{type:"button",className:"lgc-mode-toggle",onClick:t,"aria-label":`Switch to ${r}`,title:`Switch to ${r} (3)`,children:[D.jsx(n,{width:14,height:14}),D.jsx("span",{className:"lgc-mode-toggle-label",children:e.toUpperCase()})]})}function Vv(e){return D.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:[D.jsx("circle",{cx:"8",cy:"8",r:"2.4"}),D.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 Gv({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:D.jsxs("div",{ref:r,className:"lgc-options-menu",children:[D.jsx("button",{type:"button",className:"lgc-options-trigger","aria-label":"Options","aria-expanded":t,title:"Options",onClick:()=>n(o=>!o),children:D.jsx(Vv,{})}),t?D.jsx("div",{className:"lgc-options-panel",role:"menu",children:e.map(o=>o.kind==="select"?D.jsxs("div",{className:"lgc-options-item",children:[D.jsxs("span",{className:"lgc-options-item-text",children:[D.jsx("span",{className:"lgc-options-item-label",children:o.label}),o.hint?D.jsx("span",{className:"lgc-options-item-hint",children:o.hint}):null]}),D.jsx("select",{className:"lgc-options-select",value:o.value,onChange:i=>o.onChange(i.target.value),children:o.options.map(i=>D.jsx("option",{value:i.value,children:i.label??i.value},i.value))})]},o.id):D.jsxs("label",{className:"lgc-options-item",children:[D.jsx("input",{type:"checkbox",checked:o.checked,onChange:i=>o.onChange(i.target.checked)}),D.jsxs("span",{className:"lgc-options-item-text",children:[D.jsx("span",{className:"lgc-options-item-label",children:o.label}),o.hint?D.jsx("span",{className:"lgc-options-item-hint",children:o.hint}):null]})]},o.id))}):null]})}function Wv(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 ya=15,Yv={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 Xv(e){if(!e)return{};const t={};for(const[n,r]of Object.entries(e)){if(r===void 0)continue;const o=Yv[n];o&&(t[o]=String(r))}return t}function Xs(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&&Xs(t,`lora-graph-${Date.now()}.png`)})}function Zv(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:x=!0,enableTooltip:_=!0,introZoom:w=!0,focusOnClick:b=!1,highlightNeighborsOnHover:M=!0,autoIndexNeighbors:P=M,collideNodes:L=!1,fixOnDrop:j=!0,fitOnSelect:I=!1,beeswarm:R=!1,onSelectionChange:W,onNodeClick:O,onNodeRightClick:y,onLinkClick:k,onLinkRightClick:C,onBackgroundClick:$,onBackgroundRightClick:B,onNodeDrag:G,onNodeDragEnd:E,onNodeHover:N,onLinkHover:U,onNodeDoubleClick:q,onCopy:z,onCut:H,onPaste:F,onBeforeNodeDelete:ee,onBeforeLinkDelete:ne,onNodeDeleted:Z,onLinkDeleted:Y,onRenderFramePre:K,nodeColor:X,nodeLabel:V,nodeVal:J,nodeAutoColorBy:te,nodeRelSize:le,nodeVisibility:ve,nodeCanvasObject:Ze,linkColor:Ue,linkLabel:ze,linkWidth:Ye,linkHoverPrecision:Qe,backgroundColor:Me,enableNavigationControls:_e,performanceProfile:Ee,dagMode:Le}=e,[xe,Oe]=A.useState(i??a??"2d"),we=i!==void 0,he=we?i:xe,Je=A.useRef(null),it=A.useCallback(T=>{T!==he&&(Je.current?.(),we||Oe(T),l?.(T))},[he,we,l]),ce=zl({...n!==void 0?{controlled:n}:{},...r!==void 0?{defaultData:r}:{},...o?{onChange:o}:{}});Jg(P,ce.data);const me=Zg({mode:d,...W?{onChange:W}:{}}),[qe,Ct]=A.useState("select"),[zt,gr]=A.useState(!1),Zs=cv({highlightNeighborsOnHover:M,...V!==void 0?{nodeLabel:V}:{},...ze!==void 0?{linkLabel:ze}:{},...N?{onNodeHover:N}:{},...U?{onLinkHover:U}:{}}),{hoverNodeId:Qs,hoverLinkId:Js,liveHoverNodeIdRef:el,highlightedNodeIds:tl,highlightedLinkIds:nl,hoveredNodeSet:rl,hoveredLinkSet:ol,tooltipContent:il,handleNodeHover:Eo,handleLinkHover:Lo,pinHover:zn}=Zs,[Do,al]=A.useState(()=>new Set),[Ht,No]=A.useState(!!b),[En,Ro]=A.useState(!!S),[Ln,Io]=A.useState(!!I),[Dn,Fo]=A.useState(Le??null);A.useEffect(()=>{No(!!b)},[b]),A.useEffect(()=>{Ro(!!S)},[S]),A.useEffect(()=>{Io(!!I)},[I]),A.useEffect(()=>{Fo(Le??null)},[Le]);const mt=A.useRef(null),[sn,Nn]=A.useState(null),[ln,Rn]=A.useState(null),[In,Et]=A.useState(null),[at,ft]=A.useState([]),[Fn,Ut]=A.useState(null),sl=Qg(),bt=yv(),Lt=A.useRef(null),vr=A.useRef(null),[Dt,ll]=A.useState(null),cl=A.useCallback(T=>{vr.current=T,ll(T)},[]),Bo=Kg(Lt),yr=s??Bo?.width??600,mr=u??Bo?.height??400,Re=A.useRef(null),{marquee:Bn,lastCursorRef:ul}=ev({mount:Dt,engineRef:Re,selection:me,nodes:ce.data.nodes,links:ce.data.links,setSelectedLinkIds:ft,liveHoverNodeIdRef:el});nv(Dt);const st=ov({dataApi:ce,...ee?{beforeNode:ee}:{},...ne?{beforeLink:ne}:{},...Z?{onNodeDeleted:Z}:{},...Y?{onLinkDeleted:Y}:{},afterNodeDelete:()=>me.clear(),afterLinkDelete:()=>ft([])}),De=rv({enableClipboard:x,dataApi:ce,deleteGate:st,selection:me,setSelectedLinkIds:ft,engineRef:Re,lastCursorRef:ul,...z?{onCopy:z}:{},...H?{onCut:H}:{},...F?{onPaste:F}:{}}),$o=A.useRef(null),Ho=A.useCallback((T,Q)=>{O?.(T,Q);const ie=performance.now(),pe=$o.current,ge=pe&&pe.id===T.id&&ie-pe.at<280;if($o.current={id:T.id,at:ie},ge){q?.(T,Q);return}if(qe==="add-link"&&T.id!==void 0){In===null?Et(T.id):(In!==T.id&&ce.addLink({source:In,target:T.id}),Et(null));return}if(d!=="none"&&T.id!==void 0){const ue=Q.shiftKey||Q.ctrlKey||Q.metaKey;me.toggle(T.id,{additive:ue}),ue||ft([])}if(Ht&&T.id!==void 0&&Re.current){const ue=Re.current;sn===T.id?(mt.current&&ue.setCameraState(mt.current,800),Nn(null),mt.current=null):(sn===null&&ln===null&&(mt.current=ue.getCameraState()),ue.focusOn({x:T.x??0,y:T.y??0,z:T.z??0},{distance:120,zoom:8,durationMs:bt?0:1e3}),Nn(T.id),Rn(null))}},[O,q,me,d,qe,In,ce,Ht,sn,ln,bt]),Uo=A.useCallback(T=>{if($?.(T),Re.current?.stopAnimation(),qe==="add-node"){const ie=vr.current?.getBoundingClientRect(),pe=ie?T.clientX-ie.left:T.clientX,ge=ie?T.clientY-ie.top:T.clientY,ue=Re.current?.screen2Graph(pe,ge)??{x:pe,y:ge};ce.addNode(void 0,{at:{x:ue.x,y:ue.y,...ue.z!==void 0?{z:ue.z}:{}}});return}qe==="add-link"&&Et(null),T.shiftKey||T.ctrlKey||T.metaKey||(me.clear(),ft([])),Ut(null)},[$,qe,ce,me]),qo=A.useCallback((T,Q)=>{if(y?.(T,Q),!m)return;const ie=Lt.current?.getBoundingClientRect(),pe=ie?Q.clientX-ie.left:Q.clientX,ge=ie?Q.clientY-ie.top:Q.clientY,ue=T.id,ye=me.selected,dt=ye.length>1&&ye.includes(ue)?[{id:"pin-all",label:`Pin ${ye.length} nodes`,onSelect:()=>{for(const Ie of ye){const et=ce.data.nodes.find(ht=>ht.id===Ie);et&&ce.updateNode(Ie,{fx:et.x,fy:et.y,fz:et.z})}}},{id:"unpin-all",label:`Unpin ${ye.length} nodes`,onSelect:()=>{for(const Ie of ye)ce.updateNode(Ie,{fx:void 0,fy:void 0,fz:void 0})}},{separator:!0},{id:"duplicate",label:`Duplicate ${ye.length} nodes`,shortcut:"⌘D",onSelect:()=>De.duplicate()},{id:"delete-all",label:`Delete ${ye.length} nodes`,shortcut:"⌫",onSelect:()=>{st.requestNodeDelete(ye,"contextMenu")}}]:[{id:"pin",label:T.fx!==void 0?"Unpin":"Pin",onSelect:()=>{ce.updateNode(ue,T.fx!==void 0?{fx:void 0,fy:void 0,fz:void 0}:{fx:T.x,fy:T.y,fz:T.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")}}];Ut({x:pe,y:ge,items:dt})},[y,m,ce,me,De,st]),Vo=A.useCallback((T,Q)=>{k?.(T,Q);const ie=T.id;if(ie===void 0)return;const pe=Q.shiftKey||Q.ctrlKey||Q.metaKey;if(ft(ge=>{const ue=ge.includes(ie);return!pe||d!=="multi"?ue&&ge.length===1?[]:[ie]:ue?ge.filter(ye=>ye!==ie):[...ge,ie]}),pe||me.clear(),Ht&&Re.current){const ge=Re.current;if(ln===ie)mt.current&&ge.setCameraState(mt.current,800),Rn(null),mt.current=null;else{const ue=typeof T.source=="object"?T.source:null,ye=typeof T.target=="object"?T.target:null;if(ue&&ye&&ue.x!==void 0&&ye.x!==void 0){sn===null&&ln===null&&(mt.current=ge.getCameraState());const Ve=ue.x??0,dt=ue.y??0,Ie=ye.x??0,et=ye.y??0,ht=ue.z??0,Vt=ye.z??0,ai={x:(Ve+Ie)/2,y:(dt+et)/2,z:(ht+Vt)/2},cn=1.5,si=Ie-Ve,li=et-dt,gl=Vt-ht,vl=Math.max(Math.abs(si),1),yl=Math.max(Math.abs(li),1),ml=Math.min(yr/(vl*cn),mr/(yl*cn)),bl=Math.min(16,Math.max(.5,ml)),_l=Math.hypot(si,li,gl)/2/.466*cn,xl=Math.max(60,_l);ge.focusOn(ai,{distance:xl,zoom:bl,durationMs:bt?0:1e3}),Rn(ie),Nn(null)}}}},[k,me,d,Ht,ln,sn,yr,mr,bt]),Go=A.useCallback((T,Q)=>{if(C?.(T,Q),!m)return;const ie=Lt.current?.getBoundingClientRect(),pe=ie?Q.clientX-ie.left:Q.clientX,ge=ie?Q.clientY-ie.top:Q.clientY;Ut({x:pe,y:ge,items:[{id:"delete",label:"Delete link",shortcut:"⌫",onSelect:()=>{st.requestLinkDelete(ue=>ue===T,"contextMenu")}},{id:"reverse",label:"Reverse direction",onSelect:()=>{ce.removeLink(ue=>ue===T),ce.addLink({...T,source:typeof T.target=="object"?T.target.id:T.target,target:typeof T.source=="object"?T.source.id:T.source})}}]})},[C,m,ce,st]),br=A.useRef(null),Wo=A.useRef(ce.data.nodes);Wo.current=ce.data.nodes;const Yo=A.useCallback((T,Q)=>{if(G?.(T,Q),Re.current?.stopAnimation(),zn(T),qe==="add-link"){const ie=Wo.current,pe=T.x??0,ge=T.y??0,ue=ya*ya;let ye=null,Ve=1/0;for(let dt=0;dt<ie.length;dt++){const Ie=ie[dt];if(!Ie||Ie===T||Ie.id===T.id)continue;const et=(Ie.x??0)-pe,ht=(Ie.y??0)-ge,Vt=et*et+ht*ht;Vt<Ve&&(Ve=Vt,ye=Ie)}br.current=ye&&Ve<ue?ye:null}},[G,qe,zn]),Xo=A.useCallback((T,Q)=>{if(E?.(T,Q),zn(null),qe==="add-link"){const ie=br.current;if(br.current=null,!ie||ie.id===void 0||T.id===void 0)return;ce.addLink({source:T.id,target:ie.id});return}if(j){const ie=T;T.x!==void 0&&(ie.fx=T.x),T.y!==void 0&&(ie.fy=T.y),T.z!==void 0&&(ie.fz=T.z)}},[E,qe,ce,j,zn]),Ko=A.useCallback(T=>{if(B?.(T),!m)return;const Q=Lt.current?.getBoundingClientRect(),ie=Q?T.clientX-Q.left:T.clientX,pe=Q?T.clientY-Q.top:T.clientY,ge=vr.current?.getBoundingClientRect(),ue=ge?T.clientX-ge.left:T.clientX,ye=ge?T.clientY-ge.top:T.clientY,Ve=Re.current?.screen2Graph(ue,ye)??{x:ue,y:ye};Ut({x:ie,y:pe,items:[{id:"add-node-here",label:"Add node here",onSelect:()=>{ce.addNode(void 0,{at:{x:Ve.x,y:Ve.y,...Ve.z!==void 0?{z:Ve.z}:{}}})}},{id:"fit",label:"Fit to view",shortcut:"F",onSelect:()=>Re.current?.fit(400,40)},{id:"toggle-mode",label:he==="2d"?"Switch to 3D":"Switch to 2D",shortcut:"3",onSelect:()=>it(he==="2d"?"3d":"2d")}]})},[B,m,ce,he,it]),_r=p?.accent??"#4f8ef7",Zo=me.selectedSet,Qo=A.useMemo(()=>new Set(at),[at]),je=lv({mode:he,accentColor:_r,...X!==void 0?{nodeColor:X}:{},...Ue!==void 0?{linkColor:Ue}:{},...Ye!==void 0?{linkWidth:Ye}:{},...J!==void 0?{nodeVal:J}:{},...le!==void 0?{nodeRelSize:le}:{},...e.nodePointerAreaPaint!==void 0?{nodePointerAreaPaint:e.nodePointerAreaPaint}:{},...te!==void 0?{nodeAutoColorBy:te}:{},...ve!==void 0?{nodeVisibility:ve}:{},...p?.nodePalette!==void 0?{nodePalette:p.nodePalette}:{},...p?.linkDefault!==void 0?{linkDefaultColor:p.linkDefault}:{},...p?.linkHover!==void 0?{linkHoverColor:p.linkHover}:{},selectedNodeSet:Zo,selectedLinkSet:Qo,highlightNeighborsOnHover:M,highlightedNodeIds:tl,highlightedLinkIds:nl,hoverNodeId:Qs,hoverLinkId:Js,hiddenGroups:Do}),qt=fv({mode:he,showLabels:En,selectedNodeSet:Zo,hoveredNodeSet:rl,accentColor:_r,...Ze?{hostNodeCanvasObject:Ze}:{},...e.nodeThreeObject?{hostNodeThreeObject:e.nodeThreeObject}:{},...V!==void 0?{nodeLabel:V}:{},...J!==void 0?{nodeVal:J}:{},...le!==void 0?{nodeRelSize:le}:{},...p?{theme:p}:{}}),_t=dv({mode:he,showLabels:En,selectedLinkSet:Qo,hoveredLinkSet:ol,accentColor:_r,...e.linkCanvasObject?{hostLinkCanvasObject:e.linkCanvasObject}:{},...e.linkThreeObject?{hostLinkThreeObject:e.linkThreeObject}:{},...e.linkPositionUpdate!==void 0?{hostLinkPositionUpdate:e.linkPositionUpdate}:{},...ze!==void 0?{linkLabel:ze}:{},...p?{theme:p}:{}}),Jo=gv({profile:Ee,nodeCount:ce.data.nodes.length,linkCount:ce.data.links.length,mode:he}),ei=he==="3d"&&(sl||Bn!==null),ti=A.useMemo(()=>Me!==void 0?Me:p?.background&&p.background!=="transparent"?p.background:"#ffffff",[Me,p?.background]),fl=A.useMemo(()=>{const T={...Jo,...e,dagMode:Dn};return T.backgroundColor===void 0&&(T.backgroundColor=ti),T.linkColor===void 0&&(T.linkColor=p?.linkDefault??Tn),T.linkOpacity===void 0&&(T.linkOpacity=1),T.nodeOpacity===void 0&&(T.nodeOpacity=1),je.nodeColor!==void 0&&(T.nodeColor=je.nodeColor),je.linkColor!==void 0&&(T.linkColor=je.linkColor),je.linkWidth!==void 0&&(T.linkWidth=je.linkWidth),je.nodeVal!==void 0&&(T.nodeVal=je.nodeVal),je.nodePointerAreaPaint!==void 0&&(T.nodePointerAreaPaint=je.nodePointerAreaPaint),qt.canvasObject&&(T.nodeCanvasObject=qt.canvasObject,T.nodeCanvasObjectMode=()=>"after"),_t.canvasObject&&(T.linkCanvasObject=_t.canvasObject,T.linkCanvasObjectMode=()=>"after"),qt.threeObject&&(T.nodeThreeObject=qt.threeObject,T.nodeThreeObjectExtend=!0),_t.threeObject&&(T.linkThreeObject=_t.threeObject,T.linkThreeObjectExtend=!0,_t.positionUpdate&&(T.linkPositionUpdate=_t.positionUpdate)),T.linkHoverPrecision=Qe??8,T.enableNavigationControls=ei?!1:_e??!0,T.onNodeClick=Ho,T.onNodeRightClick=qo,T.onLinkClick=Vo,T.onLinkRightClick=Go,T.onBackgroundClick=Uo,T.onBackgroundRightClick=Ko,T.onNodeDrag=Yo,T.onNodeDragEnd=Xo,T.nodeLabel=()=>"",T.linkLabel=()=>"",T.onNodeHover=Eo,T.onLinkHover=Lo,g&&(T.onRenderFramePre=(Q,ie)=>{Wv(Q,ie,typeof g=="object"?g:{}),K?.(Q,ie)}),je.nodeVisibility&&(T.nodeVisibility=je.nodeVisibility),T},[e,Dn,ti,je.nodeColor,je.linkColor,je.linkWidth,je.nodeVal,je.nodePointerAreaPaint,je.nodeVisibility,Jo,ei,Qe,_e,Ho,qo,Vo,Go,Uo,Ko,Yo,Xo,Eo,Lo,g,K,qt.canvasObject,qt.threeObject,_t.canvasObject,_t.threeObject,_t.positionUpdate,p?.linkDefault]),Be=Xg({mount:Dt,mode:he,width:yr,height:mr,data:ce.data,props:fl,paused:zt,...bt?{modeTransitionMs:0}:{}});Re.current=Be,Je.current=()=>{Nn(null),Rn(null),mt.current=null,Et(null),Ut(null)};const ni=A.useRef(!1),ri=ce.data.nodes.length;A.useEffect(()=>{if(w&&Be&&!ni.current&&ri!==0){if(ni.current=!0,bt){const T=setTimeout(()=>Re.current?.fit(0,40),150);return()=>clearTimeout(T)}Re.current?.introFollow({padding:40})}},[Be,w,ri,bt]),av({engine:Be,collideNodes:L,beeswarm:R,...le!==void 0?{nodeRelSize:le}:{}}),A.useEffect(()=>{if(!Ln)return;const T=Re.current;if(!T?.fitToNodes)return;const Q=new Set(me.selected);if(at.length>0){const ie=new Set(at);for(const pe of ce.data.links){const ge=pe.id;if(ge===void 0||!ie.has(ge))continue;const ue=typeof pe.source=="object"?pe.source.id:pe.source,ye=typeof pe.target=="object"?pe.target.id:pe.target;ue!==void 0&&Q.add(ue),ye!==void 0&&Q.add(ye)}}Q.size!==0&&T.fitToNodes([...Q],bt?0:400,60)},[Ln,me.selected,at,ce.data.links,bt]),A.useEffect(()=>{if(!Dt)return;const T=Q=>{if(!Q.shiftKey||he!=="3d")return;const ie=Re.current;if(!ie?.panBy)return;Q.preventDefault(),Q.stopPropagation();const pe=ie.getZoom?.()??1,ge=-Q.deltaY/4/Math.max(pe,.1);ie.panBy({z:ge},0)};return Dt.addEventListener("wheel",T,{capture:!0,passive:!1}),()=>{Dt.removeEventListener("wheel",T,{capture:!0})}},[Dt,he]);const oi=A.useRef(null),xr=A.useCallback(()=>JSON.stringify({nodes:ce.data.nodes.map(T=>{const{vx:Q,vy:ie,vz:pe,index:ge,_neighbors:ue,_links:ye,__threeObj:Ve,__indexColor:dt,__initialFixedPos:Ie,__initialPos:et,__disposeControlsAfterDrag:ht,__dragCommitted:Vt,__dragged:ai,...cn}=T;return cn}),links:ce.data.links.map(T=>{const Q=T,ie=typeof Q.source=="object"&&Q.source!==null?Q.source.id:Q.source,pe=typeof Q.target=="object"&&Q.target!==null?Q.target.id:Q.target,{source:ge,target:ue,__lineObj:ye,__arrowObj:Ve,__photonObjs:dt,__indexColor:Ie,index:et,...ht}=Q;return{...ht,source:ie,target:pe}})},null,2),[ce.data]),ii=A.useCallback(T=>{const Q=JSON.parse(T);if(!Q||!Array.isArray(Q.nodes)||!Array.isArray(Q.links))throw new Error("invalid graph JSON");ce.setData(Q),me.clear(),ft([])},[ce,me]),wr=A.useCallback((T=`graph-${Date.now()}.json`)=>{const Q=new Blob([xr()],{type:"application/json"});Xs(Q,T)},[xr]),dl=A.useCallback(T=>{switch(T){case"select":case"pan":case"add-node":case"add-link":Ct(T);break;case"delete":st.requestMixedDelete(me.selected,at,"toolbar");break;case"duplicate":De.duplicate();break;case"select-all":me.set(ce.data.nodes.map(Q=>Q.id)),ft(ce.data.links.map(Q=>Q.id).filter(Q=>Q!==void 0));break;case"fit":Be?.fit(400,40);break;case"zoom-in":Be&&Be.zoom((Be.getZoom?.()??1)*1.2,200);break;case"zoom-out":Be&&Be.zoom((Be.getZoom?.()??1)/1.2,200);break;case"pause":gr(!0);break;case"resume":gr(!1);break;case"screenshot":Kv(Be?.getCanvasElement());break;case"export-json":wr();break;case"import-json":oi.current?.click();break;case"toggle-mode":it(he==="2d"?"3d":"2d");break}},[Be,ce,me,he,it,at,De,wr,st]);iv({engine:Be,dataApi:ce,deleteGate:st,selection:me,mode:he,setMode:it,selectedLinkIds:at,setSelectedLinkIds:ft,setLinkSourceId:Et,setActiveTool:Ct,enableClipboard:x,copy:De.copy,cut:De.cut,paste:De.paste,duplicate:De.duplicate,addConnectedNode:De.addConnectedNode,togglePin:De.togglePin,hostRef:Lt}),vv({ref:t,dataApi:ce,deleteGate:st,selection:me,engine:Be,mode:he,setMode:it,setPaused:gr,clipboard:De,exportJSON:xr,importJSON:ii,downloadJSON:wr,selectedLinkIds:at});const hl=A.useMemo(()=>({position:"relative",width:s??"100%",height:u??"100%",...Xv(p),...c}),[s,u,p,c]),pl=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:No},{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:En,onChange:Ro},{id:"fit-on-select",kind:"toggle",label:"Fit to selection",hint:"Animate the camera to frame the current selection whenever it changes.",checked:Ln,onChange:Io},{kind:"select",id:"dag-mode",label:"DAG orientation",hint:"Force a hierarchical / radial layout.",value:Dn??"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:T=>Fo(T==="null"?null:T)}],[Ht,En,Ln,Dn]);return D.jsxs("div",{ref:Lt,className:["lora-graph-canvas",f??""].join(" ").trim(),style:hl,"data-mode":he,"data-tool":qe,"data-paused":zt?"true":void 0,tabIndex:0,role:"application","aria-label":"Graph canvas",children:[D.jsx("div",{ref:cl,className:"lgc-engine-mount"}),D.jsx(Dv,{config:h,activeTool:qe,paused:zt,mode:he,onSelect:dl}),h!==!1?D.jsxs(D.Fragment,{children:[D.jsx(Gv,{items:pl}),D.jsx(qv,{mode:he,onToggle:()=>it(he==="2d"?"3d":"2d")})]}):null,Fn?D.jsx(Nv,{x:Fn.x,y:Fn.y,items:Fn.items,onClose:()=>Ut(null)}):null,_?D.jsx(Iv,{content:il,hostRef:Lt}):null,D.jsx(Fv,{rect:Bn,...Bn?.count!==void 0?{count:Bn.count}:{}}),v&&te?D.jsx(Uv,{nodes:ce.data.nodes,groupBy:te,hidden:Do,onToggle:T=>al(Q=>{const ie=new Set(Q);return ie.has(T)?ie.delete(T):ie.add(T),ie}),...p?.nodePalette!==void 0?{palette:p.nodePalette}:{}}):null,D.jsx(Hv,{nodeCount:me.selected.length,linkCount:at.length,hasClipboard:De.hasClipboard(),enableClipboard:x,onDelete:()=>{st.requestMixedDelete(me.selected,at,"selectionPanel")},onDuplicate:()=>De.duplicate(),onAddConnected:()=>De.addConnectedNode(),onCopy:()=>De.copy(),onCut:()=>De.cut(),onPaste:()=>De.paste(),onClear:()=>{me.clear(),ft([])}}),D.jsx("input",{ref:oi,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:T=>{const Q=T.target.files?.[0];Q&&(Q.text().then(ii).catch(ie=>{console.error("[lora-graph-canvas] import failed:",ie)}),T.target.value="")}})]})}const Ks=A.forwardRef(Zv);Ks.displayName="LoraGraphCanvas";const Qv={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)",nodePalette:Pn,linkDefault:Tn,linkHover:pr},Jv={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)",nodePalette:Pn,linkDefault:Tn,linkHover:pr};exports.DEFAULT_LINK_COLOR=Tn;exports.DEFAULT_LINK_HOVER_COLOR=pr;exports.DEFAULT_NODE_PALETTE=Pn;exports.DEFAULT_TOOL_ORDER=lo;exports.LoraGraphCanvas=Ks;exports.TOOL_DESCRIPTORS=Ws;exports.colorForGroup=zo;exports.createId=It;exports.darkTheme=Jv;exports.lightTheme=Qv;
|
|
685
685
|
//# sourceMappingURL=index.cjs.map
|