@loradb/lora-graph-canvas 0.10.0 → 0.11.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/README.md +31 -0
- package/dist/LoraGraphCanvas.stories.d.ts +1 -0
- package/dist/engines/rafAnim.d.ts +5 -1
- package/dist/hooks/useGraphClipboard.d.ts +7 -1
- package/dist/hooks/useGraphDeleteGate.d.ts +38 -0
- package/dist/hooks/useGraphKeybindings.d.ts +7 -0
- package/dist/hooks/useImperativeGraphHandle.d.ts +2 -0
- package/dist/hooks/useMarqueeAndCursor.d.ts +5 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +10 -0
- package/dist/index.cjs +44 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4811 -4453
- package/dist/index.js.map +1 -1
- package/dist/internal/runGuard.d.ts +7 -0
- package/dist/style.css +1 -1
- package/dist/tools/MarqueeOverlay.d.ts +8 -2
- package/dist/types.d.ts +41 -4
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react/jsx-runtime"),A=require("react"),K=require("three"),Js=require("three/examples/jsm/controls/DragControls.js"),el=require("three/webgpu"),tl=require("three/examples/jsm/controls/TrackballControls.js"),nl=require("three/examples/jsm/controls/OrbitControls.js"),rl=require("three/examples/jsm/controls/FlyControls.js"),il=require("three/examples/jsm/postprocessing/EffectComposer.js"),ol=require("three/examples/jsm/postprocessing/RenderPass.js"),Ui=new Map,al=Math.floor(Math.random()*1e3);function Et(e="n"){const t=(Ui.get(e)??al)+1;return Ui.set(e,t),`${e}_${t.toString(36)}`}const sl={nodes:[],links:[]};function ll(e){const t=e.controlled!==void 0,n=A.useCallback(b=>{for(const m of b.links)m.id===void 0&&(m.id=Et("l"));return b},[]),[r,i]=A.useState(()=>{const b=e.defaultData??e.controlled??sl;return n(b)});A.useEffect(()=>{t&&e.controlled&&i(n(e.controlled))},[t,e.controlled,n]);const o=A.useRef(r);o.current=r;const a=A.useRef(e.onChange);a.current=e.onChange;const s=A.useCallback(b=>{o.current=b,t||i(b),a.current?.(b)},[t]),l=A.useCallback(b=>s(n(b)),[s,n]),c=A.useCallback((b,m)=>{const x=b?.id??Et("n"),w={...b??{},id:x,...m?.at??{}},_={nodes:[...o.current.nodes,w],links:o.current.links};return s(_),w},[s]),f=A.useCallback(b=>{const m=b.map(w=>({...w,id:w.id??Et("n")})),x={nodes:[...o.current.nodes,...m],links:o.current.links};return s(x),m},[s]),u=A.useCallback((b,m)=>{const x=o.current.nodes.map(w=>w.id===b?{...w,...m}:w);s({nodes:x,links:o.current.links})},[s]),g=A.useCallback(b=>{const m=o.current,x=m.nodes.filter(_=>_.id!==b),w=m.links.filter(_=>{const k=typeof _.source=="object"?_.source?.id:_.source,C=typeof _.target=="object"?_.target?.id:_.target;return k!==b&&C!==b});s({nodes:x,links:w})},[s]),h=A.useCallback(b=>{const m=new Set(b),x=o.current,w=x.nodes.filter(k=>!m.has(k.id)),_=x.links.filter(k=>{const C=typeof k.source=="object"?k.source?.id:k.source,P=typeof k.target=="object"?k.target?.id:k.target;return C!==void 0&&P!==void 0&&!m.has(C)&&!m.has(P)});s({nodes:w,links:_})},[s]),p=A.useCallback(b=>{const m={id:Et("l"),...b};return s({nodes:o.current.nodes,links:[...o.current.links,m]}),m},[s]),v=A.useCallback(b=>{const m=b.map(x=>({id:Et("l"),...x}));return s({nodes:o.current.nodes,links:[...o.current.links,...m]}),m},[s]),y=A.useCallback(b=>{const m=o.current.links.filter(x=>!b(x));s({nodes:o.current.nodes,links:m})},[s]),d=A.useCallback(()=>{s({nodes:[],links:[]})},[s]);return{data:r,setData:l,addNode:c,addNodes:f,updateNode:u,removeNode:g,removeNodes:h,addLink:p,addLinks:v,removeLink:y,clear:d}}function cl(e,t,n){var r,i=1;e==null&&(e=0),t==null&&(t=0),n==null&&(n=0);function o(){var a,s=r.length,l,c=0,f=0,u=0;for(a=0;a<s;++a)l=r[a],c+=l.x||0,f+=l.y||0,u+=l.z||0;for(c=(c/s-e)*i,f=(f/s-t)*i,u=(u/s-n)*i,a=0;a<s;++a)l=r[a],c&&(l.x-=c),f&&(l.y-=f),u&&(l.z-=u)}return o.initialize=function(a){r=a},o.x=function(a){return arguments.length?(e=+a,o):e},o.y=function(a){return arguments.length?(t=+a,o):t},o.z=function(a){return arguments.length?(n=+a,o):n},o.strength=function(a){return arguments.length?(i=+a,o):i},o}function ul(e){const t=+this._x.call(null,e);return Ko(this.cover(t),t,e)}function Ko(e,t,n){if(isNaN(t))return e;var r,i=e._root,o={data:n},a=e._x0,s=e._x1,l,c,f,u,g;if(!i)return e._root=o,e;for(;i.length;)if((f=t>=(l=(a+s)/2))?a=l:s=l,r=i,!(i=i[u=+f]))return r[u]=o,e;if(c=+e._x.call(null,i.data),t===c)return o.next=i,r?r[u]=o:e._root=o,e;do r=r?r[u]=new Array(2):e._root=new Array(2),(f=t>=(l=(a+s)/2))?a=l:s=l;while((u=+f)==(g=+(c>=l)));return r[g]=i,r[u]=o,e}function fl(e){Array.isArray(e)||(e=Array.from(e));const t=e.length,n=new Float64Array(t);let r=1/0,i=-1/0;for(let o=0,a;o<t;++o)isNaN(a=+this._x.call(null,e[o]))||(n[o]=a,a<r&&(r=a),a>i&&(i=a));if(r>i)return this;this.cover(r).cover(i);for(let o=0;o<t;++o)Ko(this,n[o],e[o]);return this}function dl(e){if(isNaN(e=+e))return this;var t=this._x0,n=this._x1;if(isNaN(t))n=(t=Math.floor(e))+1;else{for(var r=n-t||1,i=this._root,o,a;t>e||e>=n;)switch(a=+(e<t),o=new Array(2),o[a]=i,i=o,r*=2,a){case 0:n=t+r;break;case 1:t=n-r;break}this._root&&this._root.length&&(this._root=i)}return this._x0=t,this._x1=n,this}function hl(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function pl(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function at(e,t,n){this.node=e,this.x0=t,this.x1=n}function gl(e,t){var n,r=this._x0,i,o,a=this._x1,s=[],l=this._root,c,f;for(l&&s.push(new at(l,r,a)),t==null?t=1/0:(r=e-t,a=e+t);c=s.pop();)if(!(!(l=c.node)||(i=c.x0)>a||(o=c.x1)<r))if(l.length){var u=(i+o)/2;s.push(new at(l[1],u,o),new at(l[0],i,u)),(f=+(e>=u))&&(c=s[s.length-1],s[s.length-1]=s[s.length-1-f],s[s.length-1-f]=c)}else{var g=Math.abs(e-+this._x.call(null,l.data));g<t&&(t=g,r=e-g,a=e+g,n=l.data)}return n}function vl(e){if(isNaN(l=+this._x.call(null,e)))return this;var t,n=this._root,r,i,o,a=this._x0,s=this._x1,l,c,f,u,g;if(!n)return this;if(n.length)for(;;){if((f=l>=(c=(a+s)/2))?a=c:s=c,t=n,!(n=n[u=+f]))return this;if(!n.length)break;t[u+1&1]&&(r=t,g=u)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):t?(o?t[u]=o:delete t[u],(n=t[0]||t[1])&&n===(t[1]||t[0])&&!n.length&&(r?r[g]=n:this._root=n),this):(this._root=o,this)}function yl(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function ml(){return this._root}function bl(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function _l(e){var t=[],n,r=this._root,i,o,a;for(r&&t.push(new at(r,this._x0,this._x1));n=t.pop();)if(!e(r=n.node,o=n.x0,a=n.x1)&&r.length){var s=(o+a)/2;(i=r[1])&&t.push(new at(i,s,a)),(i=r[0])&&t.push(new at(i,o,s))}return this}function xl(e){var t=[],n=[],r;for(this._root&&t.push(new at(this._root,this._x0,this._x1));r=t.pop();){var i=r.node;if(i.length){var o,a=r.x0,s=r.x1,l=(a+s)/2;(o=i[0])&&t.push(new at(o,a,l)),(o=i[1])&&t.push(new at(o,l,s))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.x1);return this}function wl(e){return e[0]}function kl(e){return arguments.length?(this._x=e,this):this._x}function qr(e,t){var n=new Vr(t??wl,NaN,NaN);return e==null?n:n.addAll(e)}function Vr(e,t,n){this._x=e,this._x0=t,this._x1=n,this._root=void 0}function qi(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Ne=qr.prototype=Vr.prototype;Ne.copy=function(){var e=new Vr(this._x,this._x0,this._x1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=qi(t),e;for(n=[{source:t,target:e._root=new Array(2)}];t=n.pop();)for(var i=0;i<2;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=new Array(2)}):t.target[i]=qi(r));return e};Ne.add=ul;Ne.addAll=fl;Ne.cover=dl;Ne.data=hl;Ne.extent=pl;Ne.find=gl;Ne.remove=vl;Ne.removeAll=yl;Ne.root=ml;Ne.size=bl;Ne.visit=_l;Ne.visitAfter=xl;Ne.x=kl;function Cl(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return Qo(this.cover(t,n),t,n,e)}function Qo(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,o=e._root,a={data:r},s=e._x0,l=e._y0,c=e._x1,f=e._y1,u,g,h,p,v,y,d,b;if(!o)return e._root=a,e;for(;o.length;)if((v=t>=(u=(s+c)/2))?s=u:c=u,(y=n>=(g=(l+f)/2))?l=g:f=g,i=o,!(o=o[d=y<<1|v]))return i[d]=a,e;if(h=+e._x.call(null,o.data),p=+e._y.call(null,o.data),t===h&&n===p)return a.next=o,i?i[d]=a:e._root=a,e;do i=i?i[d]=new Array(4):e._root=new Array(4),(v=t>=(u=(s+c)/2))?s=u:c=u,(y=n>=(g=(l+f)/2))?l=g:f=g;while((d=y<<1|v)===(b=(p>=g)<<1|h>=u));return i[b]=o,i[d]=a,e}function Sl(e){var t,n,r=e.length,i,o,a=new Array(r),s=new Array(r),l=1/0,c=1/0,f=-1/0,u=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(o=+this._y.call(null,t))||(a[n]=i,s[n]=o,i<l&&(l=i),i>f&&(f=i),o<c&&(c=o),o>u&&(u=o));if(l>f||c>u)return this;for(this.cover(l,c).cover(f,u),n=0;n<r;++n)Qo(this,a[n],s[n],e[n]);return this}function Ml(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,o=(r=Math.floor(t))+1;else{for(var a=i-n||1,s=this._root,l,c;n>e||e>=i||r>t||t>=o;)switch(c=(t<r)<<1|e<n,l=new Array(4),l[c]=s,s=l,a*=2,c){case 0:i=n+a,o=r+a;break;case 1:n=i-a,o=r+a;break;case 2:i=n+a,r=o-a;break;case 3:n=i-a,r=o-a;break}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this}function Pl(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Ol(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Ae(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function Al(e,t,n){var r,i=this._x0,o=this._y0,a,s,l,c,f=this._x1,u=this._y1,g=[],h=this._root,p,v;for(h&&g.push(new Ae(h,i,o,f,u)),n==null?n=1/0:(i=e-n,o=t-n,f=e+n,u=t+n,n*=n);p=g.pop();)if(!(!(h=p.node)||(a=p.x0)>f||(s=p.y0)>u||(l=p.x1)<i||(c=p.y1)<o))if(h.length){var y=(a+l)/2,d=(s+c)/2;g.push(new Ae(h[3],y,d,l,c),new Ae(h[2],a,d,y,c),new Ae(h[1],y,s,l,d),new Ae(h[0],a,s,y,d)),(v=(t>=d)<<1|e>=y)&&(p=g[g.length-1],g[g.length-1]=g[g.length-1-v],g[g.length-1-v]=p)}else{var b=e-+this._x.call(null,h.data),m=t-+this._y.call(null,h.data),x=b*b+m*m;if(x<n){var w=Math.sqrt(n=x);i=e-w,o=t-w,f=e+w,u=t+w,r=h.data}}return r}function jl(e){if(isNaN(f=+this._x.call(null,e))||isNaN(u=+this._y.call(null,e)))return this;var t,n=this._root,r,i,o,a=this._x0,s=this._y0,l=this._x1,c=this._y1,f,u,g,h,p,v,y,d;if(!n)return this;if(n.length)for(;;){if((p=f>=(g=(a+l)/2))?a=g:l=g,(v=u>=(h=(s+c)/2))?s=h:c=h,t=n,!(n=n[y=v<<1|p]))return this;if(!n.length)break;(t[y+1&3]||t[y+2&3]||t[y+3&3])&&(r=t,d=y)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):t?(o?t[y]=o:delete t[y],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[d]=n:this._root=n),this):(this._root=o,this)}function Tl(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function El(){return this._root}function Ll(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function Nl(e){var t=[],n,r=this._root,i,o,a,s,l;for(r&&t.push(new Ae(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,o=n.x0,a=n.y0,s=n.x1,l=n.y1)&&r.length){var c=(o+s)/2,f=(a+l)/2;(i=r[3])&&t.push(new Ae(i,c,f,s,l)),(i=r[2])&&t.push(new Ae(i,o,f,c,l)),(i=r[1])&&t.push(new Ae(i,c,a,s,f)),(i=r[0])&&t.push(new Ae(i,o,a,c,f))}return this}function Rl(e){var t=[],n=[],r;for(this._root&&t.push(new Ae(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var o,a=r.x0,s=r.y0,l=r.x1,c=r.y1,f=(a+l)/2,u=(s+c)/2;(o=i[0])&&t.push(new Ae(o,a,s,f,u)),(o=i[1])&&t.push(new Ae(o,f,s,l,u)),(o=i[2])&&t.push(new Ae(o,a,u,f,c)),(o=i[3])&&t.push(new Ae(o,f,u,l,c))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function Il(e){return e[0]}function Dl(e){return arguments.length?(this._x=e,this):this._x}function zl(e){return e[1]}function Fl(e){return arguments.length?(this._y=e,this):this._y}function Gr(e,t,n){var r=new Wr(t??Il,n??zl,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function Wr(e,t,n,r,i,o){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function Vi(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var je=Gr.prototype=Wr.prototype;je.copy=function(){var e=new Wr(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=Vi(t),e;for(n=[{source:t,target:e._root=new Array(4)}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=new Array(4)}):t.target[i]=Vi(r));return e};je.add=Cl;je.addAll=Sl;je.cover=Ml;je.data=Pl;je.extent=Ol;je.find=Al;je.remove=jl;je.removeAll=Tl;je.root=El;je.size=Ll;je.visit=Nl;je.visitAfter=Rl;je.x=Dl;je.y=Fl;function Bl(e){const t=+this._x.call(null,e),n=+this._y.call(null,e),r=+this._z.call(null,e);return Zo(this.cover(t,n,r),t,n,r,e)}function Zo(e,t,n,r,i){if(isNaN(t)||isNaN(n)||isNaN(r))return e;var o,a=e._root,s={data:i},l=e._x0,c=e._y0,f=e._z0,u=e._x1,g=e._y1,h=e._z1,p,v,y,d,b,m,x,w,_,k,C;if(!a)return e._root=s,e;for(;a.length;)if((x=t>=(p=(l+u)/2))?l=p:u=p,(w=n>=(v=(c+g)/2))?c=v:g=v,(_=r>=(y=(f+h)/2))?f=y:h=y,o=a,!(a=a[k=_<<2|w<<1|x]))return o[k]=s,e;if(d=+e._x.call(null,a.data),b=+e._y.call(null,a.data),m=+e._z.call(null,a.data),t===d&&n===b&&r===m)return s.next=a,o?o[k]=s:e._root=s,e;do o=o?o[k]=new Array(8):e._root=new Array(8),(x=t>=(p=(l+u)/2))?l=p:u=p,(w=n>=(v=(c+g)/2))?c=v:g=v,(_=r>=(y=(f+h)/2))?f=y:h=y;while((k=_<<2|w<<1|x)===(C=(m>=y)<<2|(b>=v)<<1|d>=p));return o[C]=a,o[k]=s,e}function $l(e){Array.isArray(e)||(e=Array.from(e));const t=e.length,n=new Float64Array(t),r=new Float64Array(t),i=new Float64Array(t);let o=1/0,a=1/0,s=1/0,l=-1/0,c=-1/0,f=-1/0;for(let u=0,g,h,p,v;u<t;++u)isNaN(h=+this._x.call(null,g=e[u]))||isNaN(p=+this._y.call(null,g))||isNaN(v=+this._z.call(null,g))||(n[u]=h,r[u]=p,i[u]=v,h<o&&(o=h),h>l&&(l=h),p<a&&(a=p),p>c&&(c=p),v<s&&(s=v),v>f&&(f=v));if(o>l||a>c||s>f)return this;this.cover(o,a,s).cover(l,c,f);for(let u=0;u<t;++u)Zo(this,n[u],r[u],i[u],e[u]);return this}function Hl(e,t,n){if(isNaN(e=+e)||isNaN(t=+t)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,o=this._z0,a=this._x1,s=this._y1,l=this._z1;if(isNaN(r))a=(r=Math.floor(e))+1,s=(i=Math.floor(t))+1,l=(o=Math.floor(n))+1;else{for(var c=a-r||1,f=this._root,u,g;r>e||e>=a||i>t||t>=s||o>n||n>=l;)switch(g=(n<o)<<2|(t<i)<<1|e<r,u=new Array(8),u[g]=f,f=u,c*=2,g){case 0:a=r+c,s=i+c,l=o+c;break;case 1:r=a-c,s=i+c,l=o+c;break;case 2:a=r+c,i=s-c,l=o+c;break;case 3:r=a-c,i=s-c,l=o+c;break;case 4:a=r+c,s=i+c,o=l-c;break;case 5:r=a-c,s=i+c,o=l-c;break;case 6:a=r+c,i=s-c,o=l-c;break;case 7:r=a-c,i=s-c,o=l-c;break}this._root&&this._root.length&&(this._root=f)}return this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=l,this}function Ul(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function ql(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ue(e,t,n,r,i,o,a){this.node=e,this.x0=t,this.y0=n,this.z0=r,this.x1=i,this.y1=o,this.z1=a}function Vl(e,t,n,r){var i,o=this._x0,a=this._y0,s=this._z0,l,c,f,u,g,h,p=this._x1,v=this._y1,y=this._z1,d=[],b=this._root,m,x;for(b&&d.push(new ue(b,o,a,s,p,v,y)),r==null?r=1/0:(o=e-r,a=t-r,s=n-r,p=e+r,v=t+r,y=n+r,r*=r);m=d.pop();)if(!(!(b=m.node)||(l=m.x0)>p||(c=m.y0)>v||(f=m.z0)>y||(u=m.x1)<o||(g=m.y1)<a||(h=m.z1)<s))if(b.length){var w=(l+u)/2,_=(c+g)/2,k=(f+h)/2;d.push(new ue(b[7],w,_,k,u,g,h),new ue(b[6],l,_,k,w,g,h),new ue(b[5],w,c,k,u,_,h),new ue(b[4],l,c,k,w,_,h),new ue(b[3],w,_,f,u,g,k),new ue(b[2],l,_,f,w,g,k),new ue(b[1],w,c,f,u,_,k),new ue(b[0],l,c,f,w,_,k)),(x=(n>=k)<<2|(t>=_)<<1|e>=w)&&(m=d[d.length-1],d[d.length-1]=d[d.length-1-x],d[d.length-1-x]=m)}else{var C=e-+this._x.call(null,b.data),P=t-+this._y.call(null,b.data),M=n-+this._z.call(null,b.data),N=C*C+P*P+M*M;if(N<r){var E=Math.sqrt(r=N);o=e-E,a=t-E,s=n-E,p=e+E,v=t+E,y=n+E,i=b.data}}return i}const Gl=(e,t,n,r,i,o)=>Math.sqrt((e-r)**2+(t-i)**2+(n-o)**2);function Wl(e,t,n,r){const i=[],o=e-r,a=t-r,s=n-r,l=e+r,c=t+r,f=n+r;return this.visit((u,g,h,p,v,y,d)=>{if(!u.length)do{const b=u.data;Gl(e,t,n,this._x(b),this._y(b),this._z(b))<=r&&i.push(b)}while(u=u.next);return g>l||h>c||p>f||v<o||y<a||d<s}),i}function Xl(e){if(isNaN(g=+this._x.call(null,e))||isNaN(h=+this._y.call(null,e))||isNaN(p=+this._z.call(null,e)))return this;var t,n=this._root,r,i,o,a=this._x0,s=this._y0,l=this._z0,c=this._x1,f=this._y1,u=this._z1,g,h,p,v,y,d,b,m,x,w,_;if(!n)return this;if(n.length)for(;;){if((b=g>=(v=(a+c)/2))?a=v:c=v,(m=h>=(y=(s+f)/2))?s=y:f=y,(x=p>=(d=(l+u)/2))?l=d:u=d,t=n,!(n=n[w=x<<2|m<<1|b]))return this;if(!n.length)break;(t[w+1&7]||t[w+2&7]||t[w+3&7]||t[w+4&7]||t[w+5&7]||t[w+6&7]||t[w+7&7])&&(r=t,_=w)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):t?(o?t[w]=o:delete t[w],(n=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&n===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=o,this)}function Yl(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Kl(){return this._root}function Ql(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function Zl(e){var t=[],n,r=this._root,i,o,a,s,l,c,f;for(r&&t.push(new ue(r,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();)if(!e(r=n.node,o=n.x0,a=n.y0,s=n.z0,l=n.x1,c=n.y1,f=n.z1)&&r.length){var u=(o+l)/2,g=(a+c)/2,h=(s+f)/2;(i=r[7])&&t.push(new ue(i,u,g,h,l,c,f)),(i=r[6])&&t.push(new ue(i,o,g,h,u,c,f)),(i=r[5])&&t.push(new ue(i,u,a,h,l,g,f)),(i=r[4])&&t.push(new ue(i,o,a,h,u,g,f)),(i=r[3])&&t.push(new ue(i,u,g,s,l,c,h)),(i=r[2])&&t.push(new ue(i,o,g,s,u,c,h)),(i=r[1])&&t.push(new ue(i,u,a,s,l,g,h)),(i=r[0])&&t.push(new ue(i,o,a,s,u,g,h))}return this}function Jl(e){var t=[],n=[],r;for(this._root&&t.push(new ue(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=t.pop();){var i=r.node;if(i.length){var o,a=r.x0,s=r.y0,l=r.z0,c=r.x1,f=r.y1,u=r.z1,g=(a+c)/2,h=(s+f)/2,p=(l+u)/2;(o=i[0])&&t.push(new ue(o,a,s,l,g,h,p)),(o=i[1])&&t.push(new ue(o,g,s,l,c,h,p)),(o=i[2])&&t.push(new ue(o,a,h,l,g,f,p)),(o=i[3])&&t.push(new ue(o,g,h,l,c,f,p)),(o=i[4])&&t.push(new ue(o,a,s,p,g,h,u)),(o=i[5])&&t.push(new ue(o,g,s,p,c,h,u)),(o=i[6])&&t.push(new ue(o,a,h,p,g,f,u)),(o=i[7])&&t.push(new ue(o,g,h,p,c,f,u))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.z0,r.x1,r.y1,r.z1);return this}function ec(e){return e[0]}function tc(e){return arguments.length?(this._x=e,this):this._x}function nc(e){return e[1]}function rc(e){return arguments.length?(this._y=e,this):this._y}function ic(e){return e[2]}function oc(e){return arguments.length?(this._z=e,this):this._z}function Xr(e,t,n,r){var i=new Yr(t??ec,n??nc,r??ic,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function Yr(e,t,n,r,i,o,a,s,l){this._x=e,this._y=t,this._z=n,this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=l,this._root=void 0}function Gi(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var ke=Xr.prototype=Yr.prototype;ke.copy=function(){var e=new Yr(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=Gi(t),e;for(n=[{source:t,target:e._root=new Array(8)}];t=n.pop();)for(var i=0;i<8;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=new Array(8)}):t.target[i]=Gi(r));return e};ke.add=Bl;ke.addAll=$l;ke.cover=Hl;ke.data=Ul;ke.extent=ql;ke.find=Vl;ke.findAllWithinRadius=Wl;ke.remove=Xl;ke.removeAll=Yl;ke.root=Kl;ke.size=Ql;ke.visit=Zl;ke.visitAfter=Jl;ke.x=tc;ke.y=rc;ke.z=oc;function _e(e){return function(){return e}}function qe(e){return(e()-.5)*1e-6}function ar(e){return e.x+e.vx}function Wi(e){return e.y+e.vy}function ac(e){return e.z+e.vz}function Xi(e){var t,n,r,i,o=1,a=1;typeof e!="function"&&(e=_e(e==null?1:+e));function s(){for(var f,u=t.length,g,h,p,v,y,d,b,m=0;m<a;++m)for(g=(n===1?qr(t,ar):n===2?Gr(t,ar,Wi):n===3?Xr(t,ar,Wi,ac):null).visitAfter(l),f=0;f<u;++f)h=t[f],d=r[h.index],b=d*d,p=h.x+h.vx,n>1&&(v=h.y+h.vy),n>2&&(y=h.z+h.vz),g.visit(x);function x(w,_,k,C,P,M,N){var E=[_,k,C,P,M,N],B=E[0],S=E[1],O=E[2],L=E[n],U=E[n+1],ne=E[n+2],J=w.data,se=w.r,D=d+se;if(J){if(J.index>h.index){var $=p-J.x-J.vx,G=n>1?v-J.y-J.vy:0,Z=n>2?y-J.z-J.vz:0,I=$*$+G*G+Z*Z;I<D*D&&($===0&&($=qe(i),I+=$*$),n>1&&G===0&&(G=qe(i),I+=G*G),n>2&&Z===0&&(Z=qe(i),I+=Z*Z),I=(D-(I=Math.sqrt(I)))/I*o,h.vx+=($*=I)*(D=(se*=se)/(b+se)),n>1&&(h.vy+=(G*=I)*D),n>2&&(h.vz+=(Z*=I)*D),J.vx-=$*(D=1-D),n>1&&(J.vy-=G*D),n>2&&(J.vz-=Z*D))}return}return B>p+D||L<p-D||n>1&&(S>v+D||U<v-D)||n>2&&(O>y+D||ne<y-D)}}function l(f){if(f.data)return f.r=r[f.data.index];for(var u=f.r=0;u<Math.pow(2,n);++u)f[u]&&f[u].r>f.r&&(f.r=f[u].r)}function c(){if(t){var f,u=t.length,g;for(r=new Array(u),f=0;f<u;++f)g=t[f],r[g.index]=+e(g,f,t)}}return s.initialize=function(f,...u){t=f,i=u.find(g=>typeof g=="function")||Math.random,n=u.find(g=>[1,2,3].includes(g))||2,c()},s.iterations=function(f){return arguments.length?(a=+f,s):a},s.strength=function(f){return arguments.length?(o=+f,s):o},s.radius=function(f){return arguments.length?(e=typeof f=="function"?f:_e(+f),c(),s):e},s}function sc(e){return e.index}function Yi(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}function lc(e){var t=sc,n=g,r,i=_e(30),o,a,s,l,c,f,u=1;e==null&&(e=[]);function g(d){return 1/Math.min(l[d.source.index],l[d.target.index])}function h(d){for(var b=0,m=e.length;b<u;++b)for(var x=0,w,_,k,C=0,P=0,M=0,N,E;x<m;++x)w=e[x],_=w.source,k=w.target,C=k.x+k.vx-_.x-_.vx||qe(f),s>1&&(P=k.y+k.vy-_.y-_.vy||qe(f)),s>2&&(M=k.z+k.vz-_.z-_.vz||qe(f)),N=Math.sqrt(C*C+P*P+M*M),N=(N-o[x])/N*d*r[x],C*=N,P*=N,M*=N,k.vx-=C*(E=c[x]),s>1&&(k.vy-=P*E),s>2&&(k.vz-=M*E),_.vx+=C*(E=1-E),s>1&&(_.vy+=P*E),s>2&&(_.vz+=M*E)}function p(){if(a){var d,b=a.length,m=e.length,x=new Map(a.map((_,k)=>[t(_,k,a),_])),w;for(d=0,l=new Array(b);d<m;++d)w=e[d],w.index=d,typeof w.source!="object"&&(w.source=Yi(x,w.source)),typeof w.target!="object"&&(w.target=Yi(x,w.target)),l[w.source.index]=(l[w.source.index]||0)+1,l[w.target.index]=(l[w.target.index]||0)+1;for(d=0,c=new Array(m);d<m;++d)w=e[d],c[d]=l[w.source.index]/(l[w.source.index]+l[w.target.index]);r=new Array(m),v(),o=new Array(m),y()}}function v(){if(a)for(var d=0,b=e.length;d<b;++d)r[d]=+n(e[d],d,e)}function y(){if(a)for(var d=0,b=e.length;d<b;++d)o[d]=+i(e[d],d,e)}return h.initialize=function(d,...b){a=d,f=b.find(m=>typeof m=="function")||Math.random,s=b.find(m=>[1,2,3].includes(m))||2,p()},h.links=function(d){return arguments.length?(e=d,p(),h):e},h.id=function(d){return arguments.length?(t=d,h):t},h.iterations=function(d){return arguments.length?(u=+d,h):u},h.strength=function(d){return arguments.length?(n=typeof d=="function"?d:_e(+d),v(),h):n},h.distance=function(d){return arguments.length?(i=typeof d=="function"?d:_e(+d),y(),h):i},h}var cc={value:()=>{}};function Jo(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Mn(n)}function Mn(e){this._=e}function uc(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Mn.prototype=Jo.prototype={constructor:Mn,on:function(e,t){var n=this._,r=uc(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o<a;)if((i=(e=r[o]).type)&&(i=fc(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<a;)if(i=(e=r[o]).type)n[i]=Ki(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Ki(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Mn(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function fc(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Ki(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=cc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Lt=0,Jt=0,Vt=0,ea=1e3,An,en,jn=0,_t=0,$n=0,sn=typeof performance=="object"&&performance.now?performance:Date,ta=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function na(){return _t||(ta(dc),_t=sn.now()+$n)}function dc(){_t=0}function kr(){this._call=this._time=this._next=null}kr.prototype=ra.prototype={constructor:kr,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?na():+n)+(t==null?0:+t),!this._next&&en!==this&&(en?en._next=this:An=this,en=this),this._call=e,this._time=n,Cr()},stop:function(){this._call&&(this._call=null,this._time=1/0,Cr())}};function ra(e,t,n){var r=new kr;return r.restart(e,t,n),r}function hc(){na(),++Lt;for(var e=An,t;e;)(t=_t-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Lt}function Qi(){_t=(jn=sn.now())+$n,Lt=Jt=0;try{hc()}finally{Lt=0,gc(),_t=0}}function pc(){var e=sn.now(),t=e-jn;t>ea&&($n-=t,jn=e)}function gc(){for(var e,t=An,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:An=n);en=e,Cr(r)}function Cr(e){if(!Lt){Jt&&(Jt=clearTimeout(Jt));var t=e-_t;t>24?(e<1/0&&(Jt=setTimeout(Qi,e-sn.now()-$n)),Vt&&(Vt=clearInterval(Vt))):(Vt||(jn=sn.now(),Vt=setInterval(pc,ea)),Lt=1,ta(Qi))}}const vc=1664525,yc=1013904223,Zi=4294967296;function mc(){let e=1;return()=>(e=(vc*e+yc)%Zi)/Zi}var Ji=3;function sr(e){return e.x}function eo(e){return e.y}function bc(e){return e.z}var _c=10,xc=Math.PI*(3-Math.sqrt(5)),wc=Math.PI*20/(9+Math.sqrt(221));function kc(e,t){t=t||2;var n=Math.min(Ji,Math.max(1,Math.round(t))),r,i=1,o=.001,a=1-Math.pow(o,1/300),s=0,l=.6,c=new Map,f=ra(h),u=Jo("tick","end"),g=mc();e==null&&(e=[]);function h(){p(),u.call("tick",r),i<o&&(f.stop(),u.call("end",r))}function p(d){var b,m=e.length,x;d===void 0&&(d=1);for(var w=0;w<d;++w)for(i+=(s-i)*a,c.forEach(function(_){_(i)}),b=0;b<m;++b)x=e[b],x.fx==null?x.x+=x.vx*=l:(x.x=x.fx,x.vx=0),n>1&&(x.fy==null?x.y+=x.vy*=l:(x.y=x.fy,x.vy=0)),n>2&&(x.fz==null?x.z+=x.vz*=l:(x.z=x.fz,x.vz=0));return r}function v(){for(var d=0,b=e.length,m;d<b;++d){if(m=e[d],m.index=d,m.fx!=null&&(m.x=m.fx),m.fy!=null&&(m.y=m.fy),m.fz!=null&&(m.z=m.fz),isNaN(m.x)||n>1&&isNaN(m.y)||n>2&&isNaN(m.z)){var x=_c*(n>2?Math.cbrt(.5+d):n>1?Math.sqrt(.5+d):d),w=d*xc,_=d*wc;n===1?m.x=x:n===2?(m.x=x*Math.cos(w),m.y=x*Math.sin(w)):(m.x=x*Math.sin(w)*Math.cos(_),m.y=x*Math.cos(w),m.z=x*Math.sin(w)*Math.sin(_))}(isNaN(m.vx)||n>1&&isNaN(m.vy)||n>2&&isNaN(m.vz))&&(m.vx=0,n>1&&(m.vy=0),n>2&&(m.vz=0))}}function y(d){return d.initialize&&d.initialize(e,g,n),d}return v(),r={tick:p,restart:function(){return f.restart(h),r},stop:function(){return f.stop(),r},numDimensions:function(d){return arguments.length?(n=Math.min(Ji,Math.max(1,Math.round(d))),c.forEach(y),r):n},nodes:function(d){return arguments.length?(e=d,v(),c.forEach(y),r):e},alpha:function(d){return arguments.length?(i=+d,r):i},alphaMin:function(d){return arguments.length?(o=+d,r):o},alphaDecay:function(d){return arguments.length?(a=+d,r):+a},alphaTarget:function(d){return arguments.length?(s=+d,r):s},velocityDecay:function(d){return arguments.length?(l=1-d,r):1-l},randomSource:function(d){return arguments.length?(g=d,c.forEach(y),r):g},force:function(d,b){return arguments.length>1?(b==null?c.delete(d):c.set(d,y(b)),r):c.get(d)},find:function(){var d=Array.prototype.slice.call(arguments),b=d.shift()||0,m=(n>1?d.shift():null)||0,x=(n>2?d.shift():null)||0,w=d.shift()||1/0,_=0,k=e.length,C,P,M,N,E,B;for(w*=w,_=0;_<k;++_)E=e[_],C=b-E.x,P=m-(E.y||0),M=x-(E.z||0),N=C*C+P*P+M*M,N<w&&(B=E,w=N);return B},on:function(d,b){return arguments.length>1?(u.on(d,b),r):u.on(d)}}}function Cc(){var e,t,n,r,i,o=_e(-30),a,s=1,l=1/0,c=.81;function f(p){var v,y=e.length,d=(t===1?qr(e,sr):t===2?Gr(e,sr,eo):t===3?Xr(e,sr,eo,bc):null).visitAfter(g);for(i=p,v=0;v<y;++v)n=e[v],d.visit(h)}function u(){if(e){var p,v=e.length,y;for(a=new Array(v),p=0;p<v;++p)y=e[p],a[y.index]=+o(y,p,e)}}function g(p){var v=0,y,d,b=0,m,x,w,_,k=p.length;if(k){for(m=x=w=_=0;_<k;++_)(y=p[_])&&(d=Math.abs(y.value))&&(v+=y.value,b+=d,m+=d*(y.x||0),x+=d*(y.y||0),w+=d*(y.z||0));v*=Math.sqrt(4/k),p.x=m/b,t>1&&(p.y=x/b),t>2&&(p.z=w/b)}else{y=p,y.x=y.data.x,t>1&&(y.y=y.data.y),t>2&&(y.z=y.data.z);do v+=a[y.data.index];while(y=y.next)}p.value=v}function h(p,v,y,d,b){if(!p.value)return!0;var m=[y,d,b][t-1],x=p.x-n.x,w=t>1?p.y-n.y:0,_=t>2?p.z-n.z:0,k=m-v,C=x*x+w*w+_*_;if(k*k/c<C)return C<l&&(x===0&&(x=qe(r),C+=x*x),t>1&&w===0&&(w=qe(r),C+=w*w),t>2&&_===0&&(_=qe(r),C+=_*_),C<s&&(C=Math.sqrt(s*C)),n.vx+=x*p.value*i/C,t>1&&(n.vy+=w*p.value*i/C),t>2&&(n.vz+=_*p.value*i/C)),!0;if(p.length||C>=l)return;(p.data!==n||p.next)&&(x===0&&(x=qe(r),C+=x*x),t>1&&w===0&&(w=qe(r),C+=w*w),t>2&&_===0&&(_=qe(r),C+=_*_),C<s&&(C=Math.sqrt(s*C)));do p.data!==n&&(k=a[p.data.index]*i/C,n.vx+=x*k,t>1&&(n.vy+=w*k),t>2&&(n.vz+=_*k));while(p=p.next)}return f.initialize=function(p,...v){e=p,r=v.find(y=>typeof y=="function")||Math.random,t=v.find(y=>[1,2,3].includes(y))||2,u()},f.strength=function(p){return arguments.length?(o=typeof p=="function"?p:_e(+p),u(),f):o},f.distanceMin=function(p){return arguments.length?(s=p*p,f):Math.sqrt(s)},f.distanceMax=function(p){return arguments.length?(l=p*p,f):Math.sqrt(l)},f.theta=function(p){return arguments.length?(c=p*p,f):Math.sqrt(c)},f}function Sc(e,t,n,r){var i,o,a=_e(.1),s,l;typeof e!="function"&&(e=_e(+e)),t==null&&(t=0),n==null&&(n=0),r==null&&(r=0);function c(u){for(var g=0,h=i.length;g<h;++g){var p=i[g],v=p.x-t||1e-6,y=(p.y||0)-n||1e-6,d=(p.z||0)-r||1e-6,b=Math.sqrt(v*v+y*y+d*d),m=(l[g]-b)*s[g]*u/b;p.vx+=v*m,o>1&&(p.vy+=y*m),o>2&&(p.vz+=d*m)}}function f(){if(i){var u,g=i.length;for(s=new Array(g),l=new Array(g),u=0;u<g;++u)l[u]=+e(i[u],u,i),s[u]=isNaN(l[u])?0:+a(i[u],u,i)}}return c.initialize=function(u,...g){i=u,o=g.find(h=>[1,2,3].includes(h))||2,f()},c.strength=function(u){return arguments.length?(a=typeof u=="function"?u:_e(+u),f(),c):a},c.radius=function(u){return arguments.length?(e=typeof u=="function"?u:_e(+u),f(),c):e},c.x=function(u){return arguments.length?(t=+u,c):t},c.y=function(u){return arguments.length?(n=+u,c):n},c.z=function(u){return arguments.length?(r=+u,c):r},c}function to(e){var t=_e(.1),n,r,i;typeof e!="function"&&(e=_e(e==null?0:+e));function o(s){for(var l=0,c=n.length,f;l<c;++l)f=n[l],f.vx+=(i[l]-f.x)*r[l]*s}function a(){if(n){var s,l=n.length;for(r=new Array(l),i=new Array(l),s=0;s<l;++s)r[s]=isNaN(i[s]=+e(n[s],s,n))?0:+t(n[s],s,n)}}return o.initialize=function(s){n=s,a()},o.strength=function(s){return arguments.length?(t=typeof s=="function"?s:_e(+s),a(),o):t},o.x=function(s){return arguments.length?(e=typeof s=="function"?s:_e(+s),a(),o):e},o}function no(e){var t=_e(.1),n,r,i;typeof e!="function"&&(e=_e(e==null?0:+e));function o(s){for(var l=0,c=n.length,f;l<c;++l)f=n[l],f.vy+=(i[l]-f.y)*r[l]*s}function a(){if(n){var s,l=n.length;for(r=new Array(l),i=new Array(l),s=0;s<l;++s)r[s]=isNaN(i[s]=+e(n[s],s,n))?0:+t(n[s],s,n)}}return o.initialize=function(s){n=s,a()},o.strength=function(s){return arguments.length?(t=typeof s=="function"?s:_e(+s),a(),o):t},o.y=function(s){return arguments.length?(e=typeof s=="function"?s:_e(+s),a(),o):e},o}function ia(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Mc(e){Oc(e);const t=Pc(e);return e.on=t.on,e.off=t.off,e.fire=t.fire,e}function Pc(e){let t=Object.create(null);return{on:function(n,r,i){if(typeof r!="function")throw new Error("callback is expected to be a function");let o=t[n];return o||(o=t[n]=[]),o.push({callback:r,ctx:i}),e},off:function(n,r){if(typeof n>"u")return t=Object.create(null),e;if(t[n])if(typeof r!="function")delete t[n];else{const i=t[n];for(let o=0;o<i.length;++o)i[o].callback===r&&i.splice(o,1)}return e},fire:function(n){const r=t[n];if(!r)return e;let i;arguments.length>1&&(i=Array.prototype.slice.call(arguments,1));for(let o=0;o<r.length;++o){const a=r[o];a.callback.apply(a.ctx,i)}return e}}}function Oc(e){if(!e)throw new Error("Eventify cannot use falsy object as events subject");const t=["on","fire","off"];for(let n=0;n<t.length;++n)if(e.hasOwnProperty(t[n]))throw new Error("Subject cannot be eventified, since it already has property '"+t[n]+"'")}var Kr=Mc;const Ac=ia(Kr);function jc(e){if(e=e||{},"uniqueLinkId"in e&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),M=require("react"),Z=require("three"),cl=require("three/examples/jsm/controls/DragControls.js"),ul=require("three/webgpu"),fl=require("three/examples/jsm/controls/TrackballControls.js"),dl=require("three/examples/jsm/controls/OrbitControls.js"),hl=require("three/examples/jsm/controls/FlyControls.js"),pl=require("three/examples/jsm/postprocessing/EffectComposer.js"),gl=require("three/examples/jsm/postprocessing/RenderPass.js"),Ko=new Map,vl=Math.floor(Math.random()*1e3);function Ft(e="n"){const t=(Ko.get(e)??vl)+1;return Ko.set(e,t),`${e}_${t.toString(36)}`}const yl={nodes:[],links:[]},ml=["x","y","z","vx","vy","vz","index","_neighbors","_links"];function bl(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 s in i)ml.includes(s)||(a[s]=i[s]);return a}),r=e.links.map(o=>{const i=o.source,a=o.target,s=i!==null&&typeof i=="object",l=a!==null&&typeof a=="object";return!s&&!l?o:(t=!0,{...o,source:s?i.id:i,target:l?a.id:a})});return t?{nodes:n,links:r}:e}function _l(e){const t=e.controlled!==void 0,n=M.useCallback(m=>{for(const b of m.links)b.id===void 0&&(b.id=Ft("l"));return m},[]),[r,o]=M.useState(()=>{const m=e.defaultData??e.controlled??yl;return n(bl(m))});M.useEffect(()=>{t&&e.controlled&&o(n(e.controlled))},[t,e.controlled,n]);const i=M.useRef(r);i.current=r;const a=M.useRef(e.onChange);a.current=e.onChange;const s=M.useCallback(m=>{i.current=m,t||o(m),a.current?.(m)},[t]),l=M.useCallback(m=>s(n(m)),[s,n]),c=M.useCallback((m,b)=>{const x=m?.id??Ft("n"),w={...m??{},id:x,...b?.at??{}},_={nodes:[...i.current.nodes,w],links:i.current.links};return s(_),w},[s]),f=M.useCallback(m=>{const b=m.map(w=>({...w,id:w.id??Ft("n")})),x={nodes:[...i.current.nodes,...b],links:i.current.links};return s(x),b},[s]),u=M.useCallback((m,b)=>{const x=i.current.nodes.map(w=>w.id===m?{...w,...b}:w);s({nodes:x,links:i.current.links})},[s]),v=M.useCallback(m=>{const b=i.current,x=b.nodes.filter(_=>_.id!==m),w=b.links.filter(_=>{const k=typeof _.source=="object"?_.source?.id:_.source,S=typeof _.target=="object"?_.target?.id:_.target;return k!==m&&S!==m});s({nodes:x,links:w})},[s]),h=M.useCallback(m=>{const b=new Set(m),x=i.current,w=x.nodes.filter(k=>!b.has(k.id)),_=x.links.filter(k=>{const S=typeof k.source=="object"?k.source?.id:k.source,A=typeof k.target=="object"?k.target?.id:k.target;return S!==void 0&&A!==void 0&&!b.has(S)&&!b.has(A)});s({nodes:w,links:_})},[s]),p=M.useCallback(m=>{const b={id:Ft("l"),...m};return s({nodes:i.current.nodes,links:[...i.current.links,b]}),b},[s]),g=M.useCallback(m=>{const b=m.map(x=>({id:Ft("l"),...x}));return s({nodes:i.current.nodes,links:[...i.current.links,...b]}),b},[s]),y=M.useCallback(m=>{const b=i.current.links.filter(x=>!m(x));s({nodes:i.current.nodes,links:b})},[s]),d=M.useCallback(()=>{s({nodes:[],links:[]})},[s]);return{data:r,setData:l,addNode:c,addNodes:f,updateNode:u,removeNode:v,removeNodes:h,addLink:p,addLinks:g,removeLink:y,clear:d}}function xl(e,t,n){var r,o=1;e==null&&(e=0),t==null&&(t=0),n==null&&(n=0);function i(){var a,s=r.length,l,c=0,f=0,u=0;for(a=0;a<s;++a)l=r[a],c+=l.x||0,f+=l.y||0,u+=l.z||0;for(c=(c/s-e)*o,f=(f/s-t)*o,u=(u/s-n)*o,a=0;a<s;++a)l=r[a],c&&(l.x-=c),f&&(l.y-=f),u&&(l.z-=u)}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 wl(e){const t=+this._x.call(null,e);return oa(this.cover(t),t,e)}function oa(e,t,n){if(isNaN(t))return e;var r,o=e._root,i={data:n},a=e._x0,s=e._x1,l,c,f,u,v;if(!o)return e._root=i,e;for(;o.length;)if((f=t>=(l=(a+s)/2))?a=l:s=l,r=o,!(o=o[u=+f]))return r[u]=i,e;if(c=+e._x.call(null,o.data),t===c)return i.next=o,r?r[u]=i:e._root=i,e;do r=r?r[u]=new Array(2):e._root=new Array(2),(f=t>=(l=(a+s)/2))?a=l:s=l;while((u=+f)==(v=+(c>=l)));return r[v]=o,r[u]=i,e}function kl(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)oa(this,n[i],e[i]);return this}function Cl(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 Sl(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Ml(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function st(e,t,n){this.node=e,this.x0=t,this.x1=n}function Pl(e,t){var n,r=this._x0,o,i,a=this._x1,s=[],l=this._root,c,f;for(l&&s.push(new st(l,r,a)),t==null?t=1/0:(r=e-t,a=e+t);c=s.pop();)if(!(!(l=c.node)||(o=c.x0)>a||(i=c.x1)<r))if(l.length){var u=(o+i)/2;s.push(new st(l[1],u,i),new st(l[0],o,u)),(f=+(e>=u))&&(c=s[s.length-1],s[s.length-1]=s[s.length-1-f],s[s.length-1-f]=c)}else{var v=Math.abs(e-+this._x.call(null,l.data));v<t&&(t=v,r=e-v,a=e+v,n=l.data)}return n}function Ol(e){if(isNaN(l=+this._x.call(null,e)))return this;var t,n=this._root,r,o,i,a=this._x0,s=this._x1,l,c,f,u,v;if(!n)return this;if(n.length)for(;;){if((f=l>=(c=(a+s)/2))?a=c:s=c,t=n,!(n=n[u=+f]))return this;if(!n.length)break;t[u+1&1]&&(r=t,v=u)}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[u]=i:delete t[u],(n=t[0]||t[1])&&n===(t[1]||t[0])&&!n.length&&(r?r[v]=n:this._root=n),this):(this._root=i,this)}function Al(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function jl(){return this._root}function Tl(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function El(e){var t=[],n,r=this._root,o,i,a;for(r&&t.push(new st(r,this._x0,this._x1));n=t.pop();)if(!e(r=n.node,i=n.x0,a=n.x1)&&r.length){var s=(i+a)/2;(o=r[1])&&t.push(new st(o,s,a)),(o=r[0])&&t.push(new st(o,i,s))}return this}function Ll(e){var t=[],n=[],r;for(this._root&&t.push(new st(this._root,this._x0,this._x1));r=t.pop();){var o=r.node;if(o.length){var i,a=r.x0,s=r.x1,l=(a+s)/2;(i=o[0])&&t.push(new st(i,a,l)),(i=o[1])&&t.push(new st(i,l,s))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.x1);return this}function Rl(e){return e[0]}function Nl(e){return arguments.length?(this._x=e,this):this._x}function Zr(e,t){var n=new Jr(t??Rl,NaN,NaN);return e==null?n:n.addAll(e)}function Jr(e,t,n){this._x=e,this._x0=t,this._x1=n,this._root=void 0}function Qo(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var De=Zr.prototype=Jr.prototype;De.copy=function(){var e=new Jr(this._x,this._x0,this._x1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=Qo(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]=Qo(r));return e};De.add=wl;De.addAll=kl;De.cover=Cl;De.data=Sl;De.extent=Ml;De.find=Pl;De.remove=Ol;De.removeAll=Al;De.root=jl;De.size=Tl;De.visit=El;De.visitAfter=Ll;De.x=Nl;function Dl(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return ia(this.cover(t,n),t,n,e)}function ia(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var o,i=e._root,a={data:r},s=e._x0,l=e._y0,c=e._x1,f=e._y1,u,v,h,p,g,y,d,m;if(!i)return e._root=a,e;for(;i.length;)if((g=t>=(u=(s+c)/2))?s=u:c=u,(y=n>=(v=(l+f)/2))?l=v:f=v,o=i,!(i=i[d=y<<1|g]))return o[d]=a,e;if(h=+e._x.call(null,i.data),p=+e._y.call(null,i.data),t===h&&n===p)return a.next=i,o?o[d]=a:e._root=a,e;do o=o?o[d]=new Array(4):e._root=new Array(4),(g=t>=(u=(s+c)/2))?s=u:c=u,(y=n>=(v=(l+f)/2))?l=v:f=v;while((d=y<<1|g)===(m=(p>=v)<<1|h>=u));return o[m]=i,o[d]=a,e}function zl(e){var t,n,r=e.length,o,i,a=new Array(r),s=new Array(r),l=1/0,c=1/0,f=-1/0,u=-1/0;for(n=0;n<r;++n)isNaN(o=+this._x.call(null,t=e[n]))||isNaN(i=+this._y.call(null,t))||(a[n]=o,s[n]=i,o<l&&(l=o),o>f&&(f=o),i<c&&(c=i),i>u&&(u=i));if(l>f||c>u)return this;for(this.cover(l,c).cover(f,u),n=0;n<r;++n)ia(this,a[n],s[n],e[n]);return this}function Il(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,s=this._root,l,c;n>e||e>=o||r>t||t>=i;)switch(c=(t<r)<<1|e<n,l=new Array(4),l[c]=s,s=l,a*=2,c){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=s)}return this._x0=n,this._y0=r,this._x1=o,this._y1=i,this}function Fl(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Bl(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Ae(e,t,n,r,o){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=o}function $l(e,t,n){var r,o=this._x0,i=this._y0,a,s,l,c,f=this._x1,u=this._y1,v=[],h=this._root,p,g;for(h&&v.push(new Ae(h,o,i,f,u)),n==null?n=1/0:(o=e-n,i=t-n,f=e+n,u=t+n,n*=n);p=v.pop();)if(!(!(h=p.node)||(a=p.x0)>f||(s=p.y0)>u||(l=p.x1)<o||(c=p.y1)<i))if(h.length){var y=(a+l)/2,d=(s+c)/2;v.push(new Ae(h[3],y,d,l,c),new Ae(h[2],a,d,y,c),new Ae(h[1],y,s,l,d),new Ae(h[0],a,s,y,d)),(g=(t>=d)<<1|e>=y)&&(p=v[v.length-1],v[v.length-1]=v[v.length-1-g],v[v.length-1-g]=p)}else{var m=e-+this._x.call(null,h.data),b=t-+this._y.call(null,h.data),x=m*m+b*b;if(x<n){var w=Math.sqrt(n=x);o=e-w,i=t-w,f=e+w,u=t+w,r=h.data}}return r}function Hl(e){if(isNaN(f=+this._x.call(null,e))||isNaN(u=+this._y.call(null,e)))return this;var t,n=this._root,r,o,i,a=this._x0,s=this._y0,l=this._x1,c=this._y1,f,u,v,h,p,g,y,d;if(!n)return this;if(n.length)for(;;){if((p=f>=(v=(a+l)/2))?a=v:l=v,(g=u>=(h=(s+c)/2))?s=h:c=h,t=n,!(n=n[y=g<<1|p]))return this;if(!n.length)break;(t[y+1&3]||t[y+2&3]||t[y+3&3])&&(r=t,d=y)}for(;n.data!==e;)if(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[y]=i:delete t[y],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[d]=n:this._root=n),this):(this._root=i,this)}function Ul(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function ql(){return this._root}function Gl(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function Vl(e){var t=[],n,r=this._root,o,i,a,s,l;for(r&&t.push(new Ae(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,i=n.x0,a=n.y0,s=n.x1,l=n.y1)&&r.length){var c=(i+s)/2,f=(a+l)/2;(o=r[3])&&t.push(new Ae(o,c,f,s,l)),(o=r[2])&&t.push(new Ae(o,i,f,c,l)),(o=r[1])&&t.push(new Ae(o,c,a,s,f)),(o=r[0])&&t.push(new Ae(o,i,a,c,f))}return this}function Wl(e){var t=[],n=[],r;for(this._root&&t.push(new Ae(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var o=r.node;if(o.length){var i,a=r.x0,s=r.y0,l=r.x1,c=r.y1,f=(a+l)/2,u=(s+c)/2;(i=o[0])&&t.push(new Ae(i,a,s,f,u)),(i=o[1])&&t.push(new Ae(i,f,s,l,u)),(i=o[2])&&t.push(new Ae(i,a,u,f,c)),(i=o[3])&&t.push(new Ae(i,f,u,l,c))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function Xl(e){return e[0]}function Yl(e){return arguments.length?(this._x=e,this):this._x}function Kl(e){return e[1]}function Ql(e){return arguments.length?(this._y=e,this):this._y}function eo(e,t,n){var r=new to(t??Xl,n??Kl,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function to(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 Zo(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var je=eo.prototype=to.prototype;je.copy=function(){var e=new to(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=Zo(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]=Zo(r));return e};je.add=Dl;je.addAll=zl;je.cover=Il;je.data=Fl;je.extent=Bl;je.find=$l;je.remove=Hl;je.removeAll=Ul;je.root=ql;je.size=Gl;je.visit=Vl;je.visitAfter=Wl;je.x=Yl;je.y=Ql;function Zl(e){const t=+this._x.call(null,e),n=+this._y.call(null,e),r=+this._z.call(null,e);return aa(this.cover(t,n,r),t,n,r,e)}function aa(e,t,n,r,o){if(isNaN(t)||isNaN(n)||isNaN(r))return e;var i,a=e._root,s={data:o},l=e._x0,c=e._y0,f=e._z0,u=e._x1,v=e._y1,h=e._z1,p,g,y,d,m,b,x,w,_,k,S;if(!a)return e._root=s,e;for(;a.length;)if((x=t>=(p=(l+u)/2))?l=p:u=p,(w=n>=(g=(c+v)/2))?c=g:v=g,(_=r>=(y=(f+h)/2))?f=y:h=y,i=a,!(a=a[k=_<<2|w<<1|x]))return i[k]=s,e;if(d=+e._x.call(null,a.data),m=+e._y.call(null,a.data),b=+e._z.call(null,a.data),t===d&&n===m&&r===b)return s.next=a,i?i[k]=s:e._root=s,e;do i=i?i[k]=new Array(8):e._root=new Array(8),(x=t>=(p=(l+u)/2))?l=p:u=p,(w=n>=(g=(c+v)/2))?c=g:v=g,(_=r>=(y=(f+h)/2))?f=y:h=y;while((k=_<<2|w<<1|x)===(S=(b>=y)<<2|(m>=g)<<1|d>=p));return i[S]=a,i[k]=s,e}function Jl(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,s=1/0,l=-1/0,c=-1/0,f=-1/0;for(let u=0,v,h,p,g;u<t;++u)isNaN(h=+this._x.call(null,v=e[u]))||isNaN(p=+this._y.call(null,v))||isNaN(g=+this._z.call(null,v))||(n[u]=h,r[u]=p,o[u]=g,h<i&&(i=h),h>l&&(l=h),p<a&&(a=p),p>c&&(c=p),g<s&&(s=g),g>f&&(f=g));if(i>l||a>c||s>f)return this;this.cover(i,a,s).cover(l,c,f);for(let u=0;u<t;++u)aa(this,n[u],r[u],o[u],e[u]);return this}function ec(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,s=this._y1,l=this._z1;if(isNaN(r))a=(r=Math.floor(e))+1,s=(o=Math.floor(t))+1,l=(i=Math.floor(n))+1;else{for(var c=a-r||1,f=this._root,u,v;r>e||e>=a||o>t||t>=s||i>n||n>=l;)switch(v=(n<i)<<2|(t<o)<<1|e<r,u=new Array(8),u[v]=f,f=u,c*=2,v){case 0:a=r+c,s=o+c,l=i+c;break;case 1:r=a-c,s=o+c,l=i+c;break;case 2:a=r+c,o=s-c,l=i+c;break;case 3:r=a-c,o=s-c,l=i+c;break;case 4:a=r+c,s=o+c,i=l-c;break;case 5:r=a-c,s=o+c,i=l-c;break;case 6:a=r+c,o=s-c,i=l-c;break;case 7:r=a-c,o=s-c,i=l-c;break}this._root&&this._root.length&&(this._root=f)}return this._x0=r,this._y0=o,this._z0=i,this._x1=a,this._y1=s,this._z1=l,this}function tc(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function nc(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ue(e,t,n,r,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 rc(e,t,n,r){var o,i=this._x0,a=this._y0,s=this._z0,l,c,f,u,v,h,p=this._x1,g=this._y1,y=this._z1,d=[],m=this._root,b,x;for(m&&d.push(new ue(m,i,a,s,p,g,y)),r==null?r=1/0:(i=e-r,a=t-r,s=n-r,p=e+r,g=t+r,y=n+r,r*=r);b=d.pop();)if(!(!(m=b.node)||(l=b.x0)>p||(c=b.y0)>g||(f=b.z0)>y||(u=b.x1)<i||(v=b.y1)<a||(h=b.z1)<s))if(m.length){var w=(l+u)/2,_=(c+v)/2,k=(f+h)/2;d.push(new ue(m[7],w,_,k,u,v,h),new ue(m[6],l,_,k,w,v,h),new ue(m[5],w,c,k,u,_,h),new ue(m[4],l,c,k,w,_,h),new ue(m[3],w,_,f,u,v,k),new ue(m[2],l,_,f,w,v,k),new ue(m[1],w,c,f,u,_,k),new ue(m[0],l,c,f,w,_,k)),(x=(n>=k)<<2|(t>=_)<<1|e>=w)&&(b=d[d.length-1],d[d.length-1]=d[d.length-1-x],d[d.length-1-x]=b)}else{var S=e-+this._x.call(null,m.data),A=t-+this._y.call(null,m.data),O=n-+this._z.call(null,m.data),E=S*S+A*A+O*O;if(E<r){var T=Math.sqrt(r=E);i=e-T,a=t-T,s=n-T,p=e+T,g=t+T,y=n+T,o=m.data}}return o}const oc=(e,t,n,r,o,i)=>Math.sqrt((e-r)**2+(t-o)**2+(n-i)**2);function ic(e,t,n,r){const o=[],i=e-r,a=t-r,s=n-r,l=e+r,c=t+r,f=n+r;return this.visit((u,v,h,p,g,y,d)=>{if(!u.length)do{const m=u.data;oc(e,t,n,this._x(m),this._y(m),this._z(m))<=r&&o.push(m)}while(u=u.next);return v>l||h>c||p>f||g<i||y<a||d<s}),o}function ac(e){if(isNaN(v=+this._x.call(null,e))||isNaN(h=+this._y.call(null,e))||isNaN(p=+this._z.call(null,e)))return this;var t,n=this._root,r,o,i,a=this._x0,s=this._y0,l=this._z0,c=this._x1,f=this._y1,u=this._z1,v,h,p,g,y,d,m,b,x,w,_;if(!n)return this;if(n.length)for(;;){if((m=v>=(g=(a+c)/2))?a=g:c=g,(b=h>=(y=(s+f)/2))?s=y:f=y,(x=p>=(d=(l+u)/2))?l=d:u=d,t=n,!(n=n[w=x<<2|b<<1|m]))return this;if(!n.length)break;(t[w+1&7]||t[w+2&7]||t[w+3&7]||t[w+4&7]||t[w+5&7]||t[w+6&7]||t[w+7&7])&&(r=t,_=w)}for(;n.data!==e;)if(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[_]=n:this._root=n),this):(this._root=i,this)}function sc(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function lc(){return this._root}function cc(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function uc(e){var t=[],n,r=this._root,o,i,a,s,l,c,f;for(r&&t.push(new ue(r,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();)if(!e(r=n.node,i=n.x0,a=n.y0,s=n.z0,l=n.x1,c=n.y1,f=n.z1)&&r.length){var u=(i+l)/2,v=(a+c)/2,h=(s+f)/2;(o=r[7])&&t.push(new ue(o,u,v,h,l,c,f)),(o=r[6])&&t.push(new ue(o,i,v,h,u,c,f)),(o=r[5])&&t.push(new ue(o,u,a,h,l,v,f)),(o=r[4])&&t.push(new ue(o,i,a,h,u,v,f)),(o=r[3])&&t.push(new ue(o,u,v,s,l,c,h)),(o=r[2])&&t.push(new ue(o,i,v,s,u,c,h)),(o=r[1])&&t.push(new ue(o,u,a,s,l,v,h)),(o=r[0])&&t.push(new ue(o,i,a,s,u,v,h))}return this}function fc(e){var t=[],n=[],r;for(this._root&&t.push(new ue(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=t.pop();){var o=r.node;if(o.length){var i,a=r.x0,s=r.y0,l=r.z0,c=r.x1,f=r.y1,u=r.z1,v=(a+c)/2,h=(s+f)/2,p=(l+u)/2;(i=o[0])&&t.push(new ue(i,a,s,l,v,h,p)),(i=o[1])&&t.push(new ue(i,v,s,l,c,h,p)),(i=o[2])&&t.push(new ue(i,a,h,l,v,f,p)),(i=o[3])&&t.push(new ue(i,v,h,l,c,f,p)),(i=o[4])&&t.push(new ue(i,a,s,p,v,h,u)),(i=o[5])&&t.push(new ue(i,v,s,p,c,h,u)),(i=o[6])&&t.push(new ue(i,a,h,p,v,f,u)),(i=o[7])&&t.push(new ue(i,v,h,p,c,f,u))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.z0,r.x1,r.y1,r.z1);return this}function dc(e){return e[0]}function hc(e){return arguments.length?(this._x=e,this):this._x}function pc(e){return e[1]}function gc(e){return arguments.length?(this._y=e,this):this._y}function vc(e){return e[2]}function yc(e){return arguments.length?(this._z=e,this):this._z}function no(e,t,n,r){var o=new ro(t??dc,n??pc,r??vc,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function ro(e,t,n,r,o,i,a,s,l){this._x=e,this._y=t,this._z=n,this._x0=r,this._y0=o,this._z0=i,this._x1=a,this._y1=s,this._z1=l,this._root=void 0}function Jo(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Me=no.prototype=ro.prototype;Me.copy=function(){var e=new ro(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=Jo(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]=Jo(r));return e};Me.add=Zl;Me.addAll=Jl;Me.cover=ec;Me.data=tc;Me.extent=nc;Me.find=rc;Me.findAllWithinRadius=ic;Me.remove=ac;Me.removeAll=sc;Me.root=lc;Me.size=cc;Me.visit=uc;Me.visitAfter=fc;Me.x=hc;Me.y=gc;Me.z=yc;function we(e){return function(){return e}}function Ue(e){return(e()-.5)*1e-6}function pr(e){return e.x+e.vx}function ei(e){return e.y+e.vy}function mc(e){return e.z+e.vz}function ti(e){var t,n,r,o,i=1,a=1;typeof e!="function"&&(e=we(e==null?1:+e));function s(){for(var f,u=t.length,v,h,p,g,y,d,m,b=0;b<a;++b)for(v=(n===1?Zr(t,pr):n===2?eo(t,pr,ei):n===3?no(t,pr,ei,mc):null).visitAfter(l),f=0;f<u;++f)h=t[f],d=r[h.index],m=d*d,p=h.x+h.vx,n>1&&(g=h.y+h.vy),n>2&&(y=h.z+h.vz),v.visit(x);function x(w,_,k,S,A,O,E){var T=[_,k,S,A,O,E],I=T[0],C=T[1],P=T[2],R=T[n],H=T[n+1],V=T[n+2],X=w.data,oe=w.r,D=d+oe;if(X){if(X.index>h.index){var F=p-X.x-X.vx,W=n>1?g-X.y-X.vy:0,Q=n>2?y-X.z-X.vz:0,N=F*F+W*W+Q*Q;N<D*D&&(F===0&&(F=Ue(o),N+=F*F),n>1&&W===0&&(W=Ue(o),N+=W*W),n>2&&Q===0&&(Q=Ue(o),N+=Q*Q),N=(D-(N=Math.sqrt(N)))/N*i,h.vx+=(F*=N)*(D=(oe*=oe)/(m+oe)),n>1&&(h.vy+=(W*=N)*D),n>2&&(h.vz+=(Q*=N)*D),X.vx-=F*(D=1-D),n>1&&(X.vy-=W*D),n>2&&(X.vz-=Q*D))}return}return I>p+D||R<p-D||n>1&&(C>g+D||H<g-D)||n>2&&(P>y+D||V<y-D)}}function l(f){if(f.data)return f.r=r[f.data.index];for(var u=f.r=0;u<Math.pow(2,n);++u)f[u]&&f[u].r>f.r&&(f.r=f[u].r)}function c(){if(t){var f,u=t.length,v;for(r=new Array(u),f=0;f<u;++f)v=t[f],r[v.index]=+e(v,f,t)}}return s.initialize=function(f,...u){t=f,o=u.find(v=>typeof v=="function")||Math.random,n=u.find(v=>[1,2,3].includes(v))||2,c()},s.iterations=function(f){return arguments.length?(a=+f,s):a},s.strength=function(f){return arguments.length?(i=+f,s):i},s.radius=function(f){return arguments.length?(e=typeof f=="function"?f:we(+f),c(),s):e},s}function bc(e){return e.index}function ni(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}function _c(e){var t=bc,n=v,r,o=we(30),i,a,s,l,c,f,u=1;e==null&&(e=[]);function v(d){return 1/Math.min(l[d.source.index],l[d.target.index])}function h(d){for(var m=0,b=e.length;m<u;++m)for(var x=0,w,_,k,S=0,A=0,O=0,E,T;x<b;++x)w=e[x],_=w.source,k=w.target,S=k.x+k.vx-_.x-_.vx||Ue(f),s>1&&(A=k.y+k.vy-_.y-_.vy||Ue(f)),s>2&&(O=k.z+k.vz-_.z-_.vz||Ue(f)),E=Math.sqrt(S*S+A*A+O*O),E=(E-i[x])/E*d*r[x],S*=E,A*=E,O*=E,k.vx-=S*(T=c[x]),s>1&&(k.vy-=A*T),s>2&&(k.vz-=O*T),_.vx+=S*(T=1-T),s>1&&(_.vy+=A*T),s>2&&(_.vz+=O*T)}function p(){if(a){var d,m=a.length,b=e.length,x=new Map(a.map((_,k)=>[t(_,k,a),_])),w;for(d=0,l=new Array(m);d<b;++d)w=e[d],w.index=d,typeof w.source!="object"&&(w.source=ni(x,w.source)),typeof w.target!="object"&&(w.target=ni(x,w.target)),l[w.source.index]=(l[w.source.index]||0)+1,l[w.target.index]=(l[w.target.index]||0)+1;for(d=0,c=new Array(b);d<b;++d)w=e[d],c[d]=l[w.source.index]/(l[w.source.index]+l[w.target.index]);r=new Array(b),g(),i=new Array(b),y()}}function g(){if(a)for(var d=0,m=e.length;d<m;++d)r[d]=+n(e[d],d,e)}function y(){if(a)for(var d=0,m=e.length;d<m;++d)i[d]=+o(e[d],d,e)}return h.initialize=function(d,...m){a=d,f=m.find(b=>typeof b=="function")||Math.random,s=m.find(b=>[1,2,3].includes(b))||2,p()},h.links=function(d){return arguments.length?(e=d,p(),h):e},h.id=function(d){return arguments.length?(t=d,h):t},h.iterations=function(d){return arguments.length?(u=+d,h):u},h.strength=function(d){return arguments.length?(n=typeof d=="function"?d:we(+d),g(),h):n},h.distance=function(d){return arguments.length?(o=typeof d=="function"?d:we(+d),y(),h):o},h}var xc={value:()=>{}};function sa(){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 En(n)}function En(e){this._=e}function wc(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}})}En.prototype=sa.prototype={constructor:En,on:function(e,t){var n=this._,r=wc(e+"",n),o,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((o=(e=r[i]).type)&&(o=kc(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]=ri(n[o],e.name,t);else if(t==null)for(o in n)n[o]=ri(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 En(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 kc(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function ri(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=xc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Bt=0,sn=0,Jt=0,la=1e3,Nn,ln,Dn=0,Mt=0,Wn=0,pn=typeof performance=="object"&&performance.now?performance:Date,ca=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ua(){return Mt||(ca(Cc),Mt=pn.now()+Wn)}function Cc(){Mt=0}function Tr(){this._call=this._time=this._next=null}Tr.prototype=fa.prototype={constructor:Tr,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?ua():+n)+(t==null?0:+t),!this._next&&ln!==this&&(ln?ln._next=this:Nn=this,ln=this),this._call=e,this._time=n,Er()},stop:function(){this._call&&(this._call=null,this._time=1/0,Er())}};function fa(e,t,n){var r=new Tr;return r.restart(e,t,n),r}function Sc(){ua(),++Bt;for(var e=Nn,t;e;)(t=Mt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Bt}function oi(){Mt=(Dn=pn.now())+Wn,Bt=sn=0;try{Sc()}finally{Bt=0,Pc(),Mt=0}}function Mc(){var e=pn.now(),t=e-Dn;t>la&&(Wn-=t,Dn=e)}function Pc(){for(var e,t=Nn,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:Nn=n);ln=e,Er(r)}function Er(e){if(!Bt){sn&&(sn=clearTimeout(sn));var t=e-Mt;t>24?(e<1/0&&(sn=setTimeout(oi,e-pn.now()-Wn)),Jt&&(Jt=clearInterval(Jt))):(Jt||(Dn=pn.now(),Jt=setInterval(Mc,la)),Bt=1,ca(oi))}}const Oc=1664525,Ac=1013904223,ii=4294967296;function jc(){let e=1;return()=>(e=(Oc*e+Ac)%ii)/ii}var ai=3;function gr(e){return e.x}function si(e){return e.y}function Tc(e){return e.z}var Ec=10,Lc=Math.PI*(3-Math.sqrt(5)),Rc=Math.PI*20/(9+Math.sqrt(221));function Nc(e,t){t=t||2;var n=Math.min(ai,Math.max(1,Math.round(t))),r,o=1,i=.001,a=1-Math.pow(i,1/300),s=0,l=.6,c=new Map,f=fa(h),u=sa("tick","end"),v=jc();e==null&&(e=[]);function h(){p(),u.call("tick",r),o<i&&(f.stop(),u.call("end",r))}function p(d){var m,b=e.length,x;d===void 0&&(d=1);for(var w=0;w<d;++w)for(o+=(s-o)*a,c.forEach(function(_){_(o)}),m=0;m<b;++m)x=e[m],x.fx==null?x.x+=x.vx*=l:(x.x=x.fx,x.vx=0),n>1&&(x.fy==null?x.y+=x.vy*=l:(x.y=x.fy,x.vy=0)),n>2&&(x.fz==null?x.z+=x.vz*=l:(x.z=x.fz,x.vz=0));return r}function g(){for(var d=0,m=e.length,b;d<m;++d){if(b=e[d],b.index=d,b.fx!=null&&(b.x=b.fx),b.fy!=null&&(b.y=b.fy),b.fz!=null&&(b.z=b.fz),isNaN(b.x)||n>1&&isNaN(b.y)||n>2&&isNaN(b.z)){var x=Ec*(n>2?Math.cbrt(.5+d):n>1?Math.sqrt(.5+d):d),w=d*Lc,_=d*Rc;n===1?b.x=x:n===2?(b.x=x*Math.cos(w),b.y=x*Math.sin(w)):(b.x=x*Math.sin(w)*Math.cos(_),b.y=x*Math.cos(w),b.z=x*Math.sin(w)*Math.sin(_))}(isNaN(b.vx)||n>1&&isNaN(b.vy)||n>2&&isNaN(b.vz))&&(b.vx=0,n>1&&(b.vy=0),n>2&&(b.vz=0))}}function y(d){return d.initialize&&d.initialize(e,v,n),d}return g(),r={tick:p,restart:function(){return f.restart(h),r},stop:function(){return f.stop(),r},numDimensions:function(d){return arguments.length?(n=Math.min(ai,Math.max(1,Math.round(d))),c.forEach(y),r):n},nodes:function(d){return arguments.length?(e=d,g(),c.forEach(y),r):e},alpha:function(d){return arguments.length?(o=+d,r):o},alphaMin:function(d){return arguments.length?(i=+d,r):i},alphaDecay:function(d){return arguments.length?(a=+d,r):+a},alphaTarget:function(d){return arguments.length?(s=+d,r):s},velocityDecay:function(d){return arguments.length?(l=1-d,r):1-l},randomSource:function(d){return arguments.length?(v=d,c.forEach(y),r):v},force:function(d,m){return arguments.length>1?(m==null?c.delete(d):c.set(d,y(m)),r):c.get(d)},find:function(){var d=Array.prototype.slice.call(arguments),m=d.shift()||0,b=(n>1?d.shift():null)||0,x=(n>2?d.shift():null)||0,w=d.shift()||1/0,_=0,k=e.length,S,A,O,E,T,I;for(w*=w,_=0;_<k;++_)T=e[_],S=m-T.x,A=b-(T.y||0),O=x-(T.z||0),E=S*S+A*A+O*O,E<w&&(I=T,w=E);return I},on:function(d,m){return arguments.length>1?(u.on(d,m),r):u.on(d)}}}function Dc(){var e,t,n,r,o,i=we(-30),a,s=1,l=1/0,c=.81;function f(p){var g,y=e.length,d=(t===1?Zr(e,gr):t===2?eo(e,gr,si):t===3?no(e,gr,si,Tc):null).visitAfter(v);for(o=p,g=0;g<y;++g)n=e[g],d.visit(h)}function u(){if(e){var p,g=e.length,y;for(a=new Array(g),p=0;p<g;++p)y=e[p],a[y.index]=+i(y,p,e)}}function v(p){var g=0,y,d,m=0,b,x,w,_,k=p.length;if(k){for(b=x=w=_=0;_<k;++_)(y=p[_])&&(d=Math.abs(y.value))&&(g+=y.value,m+=d,b+=d*(y.x||0),x+=d*(y.y||0),w+=d*(y.z||0));g*=Math.sqrt(4/k),p.x=b/m,t>1&&(p.y=x/m),t>2&&(p.z=w/m)}else{y=p,y.x=y.data.x,t>1&&(y.y=y.data.y),t>2&&(y.z=y.data.z);do g+=a[y.data.index];while(y=y.next)}p.value=g}function h(p,g,y,d,m){if(!p.value)return!0;var b=[y,d,m][t-1],x=p.x-n.x,w=t>1?p.y-n.y:0,_=t>2?p.z-n.z:0,k=b-g,S=x*x+w*w+_*_;if(k*k/c<S)return S<l&&(x===0&&(x=Ue(r),S+=x*x),t>1&&w===0&&(w=Ue(r),S+=w*w),t>2&&_===0&&(_=Ue(r),S+=_*_),S<s&&(S=Math.sqrt(s*S)),n.vx+=x*p.value*o/S,t>1&&(n.vy+=w*p.value*o/S),t>2&&(n.vz+=_*p.value*o/S)),!0;if(p.length||S>=l)return;(p.data!==n||p.next)&&(x===0&&(x=Ue(r),S+=x*x),t>1&&w===0&&(w=Ue(r),S+=w*w),t>2&&_===0&&(_=Ue(r),S+=_*_),S<s&&(S=Math.sqrt(s*S)));do p.data!==n&&(k=a[p.data.index]*o/S,n.vx+=x*k,t>1&&(n.vy+=w*k),t>2&&(n.vz+=_*k));while(p=p.next)}return f.initialize=function(p,...g){e=p,r=g.find(y=>typeof y=="function")||Math.random,t=g.find(y=>[1,2,3].includes(y))||2,u()},f.strength=function(p){return arguments.length?(i=typeof p=="function"?p:we(+p),u(),f):i},f.distanceMin=function(p){return arguments.length?(s=p*p,f):Math.sqrt(s)},f.distanceMax=function(p){return arguments.length?(l=p*p,f):Math.sqrt(l)},f.theta=function(p){return arguments.length?(c=p*p,f):Math.sqrt(c)},f}function zc(e,t,n,r){var o,i,a=we(.1),s,l;typeof e!="function"&&(e=we(+e)),t==null&&(t=0),n==null&&(n=0),r==null&&(r=0);function c(u){for(var v=0,h=o.length;v<h;++v){var p=o[v],g=p.x-t||1e-6,y=(p.y||0)-n||1e-6,d=(p.z||0)-r||1e-6,m=Math.sqrt(g*g+y*y+d*d),b=(l[v]-m)*s[v]*u/m;p.vx+=g*b,i>1&&(p.vy+=y*b),i>2&&(p.vz+=d*b)}}function f(){if(o){var u,v=o.length;for(s=new Array(v),l=new Array(v),u=0;u<v;++u)l[u]=+e(o[u],u,o),s[u]=isNaN(l[u])?0:+a(o[u],u,o)}}return c.initialize=function(u,...v){o=u,i=v.find(h=>[1,2,3].includes(h))||2,f()},c.strength=function(u){return arguments.length?(a=typeof u=="function"?u:we(+u),f(),c):a},c.radius=function(u){return arguments.length?(e=typeof u=="function"?u:we(+u),f(),c):e},c.x=function(u){return arguments.length?(t=+u,c):t},c.y=function(u){return arguments.length?(n=+u,c):n},c.z=function(u){return arguments.length?(r=+u,c):r},c}function li(e){var t=we(.1),n,r,o;typeof e!="function"&&(e=we(e==null?0:+e));function i(s){for(var l=0,c=n.length,f;l<c;++l)f=n[l],f.vx+=(o[l]-f.x)*r[l]*s}function a(){if(n){var s,l=n.length;for(r=new Array(l),o=new Array(l),s=0;s<l;++s)r[s]=isNaN(o[s]=+e(n[s],s,n))?0:+t(n[s],s,n)}}return i.initialize=function(s){n=s,a()},i.strength=function(s){return arguments.length?(t=typeof s=="function"?s:we(+s),a(),i):t},i.x=function(s){return arguments.length?(e=typeof s=="function"?s:we(+s),a(),i):e},i}function ci(e){var t=we(.1),n,r,o;typeof e!="function"&&(e=we(e==null?0:+e));function i(s){for(var l=0,c=n.length,f;l<c;++l)f=n[l],f.vy+=(o[l]-f.y)*r[l]*s}function a(){if(n){var s,l=n.length;for(r=new Array(l),o=new Array(l),s=0;s<l;++s)r[s]=isNaN(o[s]=+e(n[s],s,n))?0:+t(n[s],s,n)}}return i.initialize=function(s){n=s,a()},i.strength=function(s){return arguments.length?(t=typeof s=="function"?s:we(+s),a(),i):t},i.y=function(s){return arguments.length?(e=typeof s=="function"?s:we(+s),a(),i):e},i}function da(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ic(e){Bc(e);const t=Fc(e);return e.on=t.on,e.off=t.off,e.fire=t.fire,e}function Fc(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 Bc(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 oo=Ic;const $c=da(oo);function Hc(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={},
|
|
4
|
-
`,s=Array(
|
|
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:b,a=[],s=H,l=H,c=H,f=H,u={version:20,addNode:g,addLink:m,removeLink:S,removeNode:d,getNode:y,getNodeCount:w,getLinkCount:_,getEdgeCount:_,getLinksCount:_,getNodesCount:w,getLinks:k,forEachNode:oe,forEachLinkedNode:C,forEachLink:I,beginUpdate:c,endUpdate:f,clear:T,hasLink:O,hasNode:y,getLink:O,getLinkById:E};return $c(u),v(),u;function v(){var D=u.on;u.on=F;function F(){return u.beginUpdate=c=V,u.endUpdate=f=X,s=h,l=p,u.on=D,D.apply(u,arguments)}}function h(D,F){a.push({link:D,changeType:F})}function p(D,F){a.push({node:D,changeType:F})}function g(D,F){if(D===void 0)throw new Error("Invalid node identifier");c();var W=y(D);return W?(W.data=F,l(W,"update")):(W=new Uc(D,F),l(W,"add")),t.set(D,W),f(),W}function y(D){return t.get(D)}function d(D){var F=y(D);if(!F)return!1;c();var W=F.links;return W&&(W.forEach(A),F.links=null),t.delete(D),l(F,"remove"),f(),!0}function m(D,F,W){c();var Q=y(D)||g(D),N=y(F)||g(F),U=i(D,F,W),z=n.has(U.id);return n.set(U.id,U),ui(Q,U),D!==F&&ui(N,U),s(U,z?"update":"add"),f(),U}function b(D,F,W){var Q=Pn(D,F),N=n.get(Q);return N?(N.data=W,N):new fi(D,F,W,Q)}function x(D,F,W){var Q=Pn(D,F),N=r.hasOwnProperty(Q);if(N||O(D,F)){N||(r[Q]=0);var U="@"+ ++r[Q];Q=Pn(D+U,F+U)}return new fi(D,F,W,Q)}function w(){return t.size}function _(){return n.size}function k(D){var F=y(D);return F?F.links:null}function S(D,F){return F!==void 0&&(D=O(D,F)),A(D)}function A(D){if(!D||!n.get(D.id))return!1;c(),n.delete(D.id);var F=y(D.fromId),W=y(D.toId);return F&&F.links.delete(D),W&&W.links.delete(D),s(D,"remove"),f(),!0}function O(D,F){if(!(D===void 0||F===void 0))return n.get(Pn(D,F))}function E(D){if(D!==void 0)return n.get(D)}function T(){c(),oe(function(D){d(D.id)}),f()}function I(D){if(typeof D=="function")for(var F=n.values(),W=F.next();!W.done;){if(D(W.value))return!0;W=F.next()}}function C(D,F,W){var Q=y(D);if(Q&&Q.links&&typeof F=="function")return W?R(Q.links,D,F):P(Q.links,D,F)}function P(D,F,W){for(var Q,N=D.values(),U=N.next();!U.done;){var z=U.value,G=z.fromId===F?z.toId:z.fromId;if(Q=W(t.get(G),z),Q)return!0;U=N.next()}}function R(D,F,W){for(var Q,N=D.values(),U=N.next();!U.done;){var z=U.value;if(z.fromId===F&&(Q=W(t.get(z.toId),z),Q))return!0;U=N.next()}}function H(){}function V(){o+=1}function X(){o-=1,o===0&&a.length>0&&(u.fire("changed",a),a.length=0)}function oe(D){if(typeof D!="function")throw new Error("Function is expected to iterate over graph nodes. You passed "+D);for(var F=t.values(),W=F.next();!W.done;){if(D(W.value))return!0;W=F.next()}}}function Uc(e,t){this.id=e,this.links=null,this.data=t}function ui(e,t){e.links?e.links.add(t):e.links=new Set([t])}function fi(e,t,n,r){this.fromId=e,this.toId=t,this.data=n,this.id=r}function Pn(e,t){return e.toString()+"👉 "+t.toString()}var io={exports:{}},vn={exports:{}},ha=function(t){return t===0?"x":t===1?"y":t===2?"z":"c"+(t+1)};const qc=ha;var Gt=function(t){return n;function n(r,o){let i=o&&o.indent||0,a=o&&o.join!==void 0?o.join:`
|
|
4
|
+
`,s=Array(i+1).join(" "),l=[];for(let c=0;c<t;++c){let f=qc(c),u=c===0?"":s;l.push(u+r.replace(/{var}/g,f))}return l.join(a)}};const pa=Gt;vn.exports=Gc;vn.exports.generateCreateBodyFunctionBody=ga;vn.exports.getVectorCode=ya;vn.exports.getBodyCode=va;function Gc(e,t){let n=ga(e,t),{Body:r}=new Function(n)();return r}function ga(e,t){return`
|
|
5
|
+
${ya(e,t)}
|
|
6
|
+
${va(e)}
|
|
7
7
|
return {Body: Body, Vector: Vector};
|
|
8
|
-
`}function
|
|
8
|
+
`}function va(e){let t=pa(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 ya(e,t){let n=pa(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
|
-
${
|
|
52
|
-
${
|
|
53
|
-
${
|
|
54
|
-
${
|
|
55
|
-
${
|
|
50
|
+
};`}var Vc=vn.exports,ht={exports:{}};const ao=Gt,ct=ha;ht.exports=Wc;ht.exports.generateQuadTreeFunctionBody=ma;ht.exports.getInsertStackCode=ka;ht.exports.getQuadNodeCode=wa;ht.exports.isSamePosition=ba;ht.exports.getChildBodyCode=xa;ht.exports.setChildBodyCode=_a;function Wc(e){let t=ma(e);return new Function(t)()}function ma(e){let t=ao(e),n=Math.pow(2,e);return`
|
|
51
|
+
${ka()}
|
|
52
|
+
${wa(e)}
|
|
53
|
+
${ba(e)}
|
|
54
|
+
${xa(e)}
|
|
55
|
+
${_a(e)}
|
|
56
56
|
|
|
57
57
|
function createQuadTree(options, random) {
|
|
58
58
|
options = options || {};
|
|
@@ -167,7 +167,7 @@ ${a(" node.")}
|
|
|
167
167
|
}
|
|
168
168
|
// If s / r < θ, treat this internal node as a single body, and calculate the
|
|
169
169
|
// force it exerts on sourceBody, and add this amount to sourceBody's net force.
|
|
170
|
-
if ((node.max_${
|
|
170
|
+
if ((node.max_${ct(0)} - node.min_${ct(0)}) / r < theta) {
|
|
171
171
|
// in the if statement above we consider node's width only
|
|
172
172
|
// because the region was made into square during tree creation.
|
|
173
173
|
// Thus there is no difference between using width or height.
|
|
@@ -177,7 +177,7 @@ ${a(" node.")}
|
|
|
177
177
|
// Otherwise, run the procedure recursively on each of the current node's children.
|
|
178
178
|
|
|
179
179
|
// I intentionally unfolded this loop, to save several CPU cycles.
|
|
180
|
-
${
|
|
180
|
+
${i()}
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -236,7 +236,7 @@ ${o()}
|
|
|
236
236
|
${t("var min_{var} = node.min_{var};",{indent:8})}
|
|
237
237
|
${t("var max_{var} = (min_{var} + node.max_{var}) / 2;",{indent:8})}
|
|
238
238
|
|
|
239
|
-
${
|
|
239
|
+
${o(8)}
|
|
240
240
|
|
|
241
241
|
var child = getChild(node, quadIdx);
|
|
242
242
|
|
|
@@ -290,24 +290,24 @@ ${i(8)}
|
|
|
290
290
|
}
|
|
291
291
|
return createQuadTree;
|
|
292
292
|
|
|
293
|
-
`;function
|
|
294
|
-
`)}function
|
|
293
|
+
`;function o(s){let l=[],c=Array(s+1).join(" ");for(let f=0;f<e;++f)l.push(c+`if (${ct(f)} > max_${ct(f)}) {`),l.push(c+` quadIdx = quadIdx + ${Math.pow(2,f)};`),l.push(c+` min_${ct(f)} = max_${ct(f)};`),l.push(c+` max_${ct(f)} = node.max_${ct(f)};`),l.push(c+"}");return l.join(`
|
|
294
|
+
`)}function i(){let s=Array(11).join(" "),l=[];for(let c=0;c<n;++c)l.push(s+`if (node.quad${c}) {`),l.push(s+` queue[pushIdx] = node.quad${c};`),l.push(s+" queueLength += 1;"),l.push(s+" pushIdx += 1;"),l.push(s+"}");return l.join(`
|
|
295
295
|
`)}function a(s){let l=[];for(let c=0;c<n;++c)l.push(`${s}quad${c} = null;`);return l.join(`
|
|
296
|
-
`)}}function
|
|
296
|
+
`)}}function ba(e){let t=ao(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 _a(e){var t=Math.pow(2,e);return`
|
|
303
303
|
function setChild(node, idx, child) {
|
|
304
304
|
${n()}
|
|
305
|
-
}`;function n(){let r=[];for(let
|
|
306
|
-
`)}}function
|
|
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 xa(e){return`function getChild(node, idx) {
|
|
307
307
|
${t()}
|
|
308
308
|
return null;
|
|
309
|
-
}`;function t(){let n=[],r=Math.pow(2,e);for(let
|
|
310
|
-
`)}}function
|
|
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 wa(e){let t=ao(e),n=Math.pow(2,e);var r=`
|
|
311
311
|
function QuadNode() {
|
|
312
312
|
// body stored inside this node. In quad tree only leaf nodes (by construction)
|
|
313
313
|
// contain bodies:
|
|
@@ -317,7 +317,7 @@ function QuadNode() {
|
|
|
317
317
|
// 0 | 1
|
|
318
318
|
// -----
|
|
319
319
|
// 2 | 3
|
|
320
|
-
${
|
|
320
|
+
${o(" this.")}
|
|
321
321
|
|
|
322
322
|
// Total mass of current node
|
|
323
323
|
this.mass = 0;
|
|
@@ -329,8 +329,8 @@ ${i(" this.")}
|
|
|
329
329
|
${t("this.min_{var} = 0;",{indent:2})}
|
|
330
330
|
${t("this.max_{var} = 0;",{indent:2})}
|
|
331
331
|
}
|
|
332
|
-
`;return r;function i
|
|
333
|
-
`)}}function
|
|
332
|
+
`;return r;function o(i){let a=[];for(let s=0;s<n;++s)a.push(`${i}quad${s} = null;`);return a.join(`
|
|
333
|
+
`)}}function ka(){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 Xc=ht.exports,so={exports:{}};so.exports=Kc;so.exports.generateFunctionBody=Ca;const Yc=Gt;function Kc(e){let t=Ca(e);return new Function("bodies","settings","random",t)}function Ca(e){let t=Yc(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 Qc=so.exports,lo={exports:{}};const Zc=Gt;lo.exports=Jc;lo.exports.generateCreateDragForceFunctionBody=Sa;function Jc(e){let t=Sa(e);return new Function("options",t)}function Sa(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
|
+
${Zc(e)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}
|
|
434
434
|
}
|
|
435
435
|
};
|
|
436
|
-
`}var
|
|
436
|
+
`}var eu=lo.exports,co={exports:{}};const tu=Gt;co.exports=nu;co.exports.generateCreateSpringForceFunctionBody=Ma;function nu(e){let t=Ma(e);return new Function("options","random",t)}function Ma(e){let t=tu(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 ru=co.exports,uo={exports:{}};const ou=Gt;uo.exports=iu;uo.exports.generateIntegratorFunctionBody=Pa;function iu(e){let t=Pa(e);return new Function("bodies","timeStep","adaptiveTimeStepWeight",t)}function Pa(e){let t=ou(e);return`
|
|
469
469
|
var length = bodies.length;
|
|
470
470
|
if (length === 0) return 0;
|
|
471
471
|
|
|
@@ -499,12 +499,12 @@ function InsertStackElement(node, body) {
|
|
|
499
499
|
}
|
|
500
500
|
|
|
501
501
|
return (${t("t{var} * t{var}",{join:" + "})})/length;
|
|
502
|
-
`}var Xc=ni.exports,lr,oo;function Yc(){if(oo)return lr;oo=1,lr=e;function e(t,n,r,i){this.from=t,this.to=n,this.length=r,this.coefficient=i}return lr}var cr,ao;function Kc(){if(ao)return cr;ao=1,cr=e;function e(t,n){var r;if(t||(t={}),n){for(r in n)if(n.hasOwnProperty(r)){var i=t.hasOwnProperty(r),o=typeof n[r],a=!i||typeof t[r]!==o;a?t[r]=n[r]:o==="object"&&(t[r]=e(t[r],n[r]))}}return t}return cr}var Gt={exports:{}},so;function Qc(){if(so)return Gt.exports;so=1,Gt.exports=e,Gt.exports.random=e,Gt.exports.randomIterator=s;function e(l){var c=typeof l=="number"?l:+new Date;return new t(c)}function t(l){this.seed=l}t.prototype.next=a,t.prototype.nextDouble=o,t.prototype.uniform=o,t.prototype.gaussian=n,t.prototype.random=o;function n(){var l,c,f;do c=this.nextDouble()*2-1,f=this.nextDouble()*2-1,l=c*c+f*f;while(l>=1||l===0);return c*Math.sqrt(-2*Math.log(l)/l)}t.prototype.levy=r;function r(){var l=1.5,c=Math.pow(i(1+l)*Math.sin(Math.PI*l/2)/(i((1+l)/2)*l*Math.pow(2,(l-1)/2)),1/l);return this.gaussian()*c/Math.pow(Math.abs(this.gaussian()),1/l)}function i(l){return Math.sqrt(2*Math.PI/l)*Math.pow(1/Math.E*(l+1/(12*l-1/(10*l))),l)}function o(){var l=this.seed;return l=l+2127912214+(l<<12)&4294967295,l=(l^3345072700^l>>>19)&4294967295,l=l+374761393+(l<<5)&4294967295,l=(l+3550635116^l<<9)&4294967295,l=l+4251993797+(l<<3)&4294967295,l=(l^3042594569^l>>>16)&4294967295,this.seed=l,(l&268435455)/268435456}function a(l){return Math.floor(this.nextDouble()*l)}function s(l,c){var f=c||e();if(typeof f.next!="function")throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:g,shuffle:u};function u(){var h,p,v;for(h=l.length-1;h>0;--h)p=f.next(h+1),v=l[p],l[p]=l[h],l[h]=v;return l}function g(h){var p,v,y;for(p=l.length-1;p>0;--p)v=f.next(p+1),y=l[v],l[v]=l[p],l[p]=y,h(y);l.length&&h(l[0])}}return Gt.exports}var _a=iu,Zc=Nc,Jc=Ic,eu=Fc,tu=Hc,nu=Vc,ru=Xc,lo={};function iu(e){var t=Yc(),n=Kc(),r=Kr;if(e){if(e.springCoeff!==void 0)throw new Error("springCoeff was renamed to springCoefficient");if(e.dragCoeff!==void 0)throw new Error("dragCoeff was renamed to dragCoefficient")}e=n(e,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var i=lo[e.dimensions];if(!i){var o=e.dimensions;i={Body:Zc(o,e.debug),createQuadTree:Jc(o),createBounds:eu(o),createDragForce:tu(o),createSpringForce:nu(o),integrate:ru(o)},lo[o]=i}var a=i.Body,s=i.createQuadTree,l=i.createBounds,c=i.createDragForce,f=i.createSpringForce,u=i.integrate,g=O=>new a(O),h=Qc().random(42),p=[],v=[],y=s(e,h),d=l(p,e,h),b=f(e,h),m=c(e),x=0,w=[],_=new Map,k=0;M("nbody",B),M("spring",S);var C={bodies:p,quadTree:y,springs:v,settings:e,addForce:M,removeForce:N,getForces:E,step:function(){for(var O=0;O<w.length;++O)w[O](k);var L=u(p,e.timeStep,e.adaptiveTimeStepWeight);return k+=1,L},addBody:function(O){if(!O)throw new Error("Body is required");return p.push(O),O},addBodyAt:function(O){if(!O)throw new Error("Body position is required");var L=g(O);return p.push(L),L},removeBody:function(O){if(O){var L=p.indexOf(O);if(!(L<0))return p.splice(L,1),p.length===0&&d.reset(),!0}},addSpring:function(O,L,U,ne){if(!O||!L)throw new Error("Cannot add null spring to force simulator");typeof U!="number"&&(U=-1);var J=new t(O,L,U,ne>=0?ne:-1);return v.push(J),J},getTotalMovement:function(){return x},removeSpring:function(O){if(O){var L=v.indexOf(O);if(L>-1)return v.splice(L,1),!0}},getBestNewBodyPosition:function(O){return d.getBestNewPosition(O)},getBBox:P,getBoundingBox:P,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(O){return O!==void 0?(e.gravity=O,y.options({gravity:O}),this):e.gravity},theta:function(O){return O!==void 0?(e.theta=O,y.options({theta:O}),this):e.theta},random:h};return ou(e,C),r(C),C;function P(){return d.update(),d.box}function M(O,L){if(_.has(O))throw new Error("Force "+O+" is already added");_.set(O,L),w.push(L)}function N(O){var L=w.indexOf(_.get(O));L<0||(w.splice(L,1),_.delete(O))}function E(){return _}function B(){if(p.length!==0){y.insertBodies(p);for(var O=p.length;O--;){var L=p[O];L.isPinned||(L.reset(),y.updateBodyForce(L),m.update(L))}}}function S(){for(var O=v.length;O--;)b.update(v[O])}}function ou(e,t){for(var n in e)au(e,t,n)}function au(e,t,n){if(e.hasOwnProperty(n)&&typeof t[n]!="function"){var r=Number.isFinite(e[n]);r?t[n]=function(i){if(i!==void 0){if(!Number.isFinite(i))throw new Error("Value of "+n+" should be a valid number.");return e[n]=i,t}return e[n]}:t[n]=function(i){return i!==void 0?(e[n]=i,t):e[n]}}}Qr.exports=lu;Qr.exports.simulator=_a;var su=Kr;function lu(e,t){if(!e)throw new Error("Graph structure cannot be undefined");var n=t&&t.createSimulator||_a,r=n(t);if(Array.isArray(t))throw new Error("Physics settings is expected to be an object");var i=e.version>19?B:E;t&&typeof t.nodeMass=="function"&&(i=t.nodeMass);var o=new Map,a={},s=0,l=r.settings.springTransform||cu;m(),y();var c=!1,f={step:function(){if(s===0)return u(!0),!0;var S=r.step();f.lastMove=S,f.fire("step");var O=S/s,L=O<=.01;return u(L),L},getNodePosition:function(S){return N(S).pos},setNodePosition:function(S){var O=N(S);O.setPosition.apply(O,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(S){var O=a[S];if(O)return{from:O.from.pos,to:O.to.pos}},getGraphRect:function(){return r.getBBox()},forEachBody:g,pinNode:function(S,O){var L=N(S.id);L.isPinned=!!O},isNodePinned:function(S){return N(S.id).isPinned},dispose:function(){e.off("changed",b),f.fire("disposed")},getBody:v,getSpring:p,getForceVectorLength:h,simulator:r,graph:e,lastMove:0};return su(f),f;function u(S){c!==S&&(c=S,d(S))}function g(S){o.forEach(S)}function h(){var S=0,O=0;return g(function(L){S+=Math.abs(L.force.x),O+=Math.abs(L.force.y)}),Math.sqrt(S*S+O*O)}function p(S,O){var L;if(O===void 0)typeof S!="object"?L=S:L=S.id;else{var U=e.hasLink(S,O);if(!U)return;L=U.id}return a[L]}function v(S){return o.get(S)}function y(){e.on("changed",b)}function d(S){f.fire("stable",S)}function b(S){for(var O=0;O<S.length;++O){var L=S[O];L.changeType==="add"?(L.node&&x(L.node.id),L.link&&_(L.link)):L.changeType==="remove"&&(L.node&&w(L.node),L.link&&k(L.link))}s=e.getNodesCount()}function m(){s=0,e.forEachNode(function(S){x(S.id),s+=1}),e.forEachLink(_)}function x(S){var O=o.get(S);if(!O){var L=e.getNode(S);if(!L)throw new Error("initBody() was called with unknown node id");var U=L.position;if(!U){var ne=C(L);U=r.getBestNewBodyPosition(ne)}O=r.addBodyAt(U),O.id=S,o.set(S,O),P(S),M(L)&&(O.isPinned=!0)}}function w(S){var O=S.id,L=o.get(O);L&&(o.delete(O),r.removeBody(L))}function _(S){P(S.fromId),P(S.toId);var O=o.get(S.fromId),L=o.get(S.toId),U=r.addSpring(O,L,S.length);l(S,U),a[S.id]=U}function k(S){var O=a[S.id];if(O){var L=e.getNode(S.fromId),U=e.getNode(S.toId);L&&P(L.id),U&&P(U.id),delete a[S.id],r.removeSpring(O)}}function C(S){var O=[];if(!S.links)return O;for(var L=Math.min(S.links.length,2),U=0;U<L;++U){var ne=S.links[U],J=ne.fromId!==S.id?o.get(ne.fromId):o.get(ne.toId);J&&J.pos&&O.push(J)}return O}function P(S){var O=o.get(S);if(O.mass=i(S),Number.isNaN(O.mass))throw new Error("Node mass should be a number")}function M(S){return S&&(S.isPinned||S.data&&S.data.isPinned)}function N(S){var O=o.get(S);return O||(x(S),O=o.get(S)),O}function E(S){var O=e.getLinks(S);return O?1+O.length/3:1}function B(S){var O=e.getLinks(S);return O?1+O.size/3:1}}function cu(){}var uu=Qr.exports;const fu=ia(uu);function Sr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var du=typeof global=="object"&&global&&global.Object===Object&&global,hu=typeof self=="object"&&self&&self.Object===Object&&self,xa=du||hu||Function("return this")(),ur=function(){return xa.Date.now()},pu=/\s/;function gu(e){for(var t=e.length;t--&&pu.test(e.charAt(t)););return t}var vu=/^\s+/;function yu(e){return e&&e.slice(0,gu(e)+1).replace(vu,"")}var Tn=xa.Symbol,wa=Object.prototype,mu=wa.hasOwnProperty,bu=wa.toString,Wt=Tn?Tn.toStringTag:void 0;function _u(e){var t=mu.call(e,Wt),n=e[Wt];try{e[Wt]=void 0;var r=!0}catch{}var i=bu.call(e);return r&&(t?e[Wt]=n:delete e[Wt]),i}var xu=Object.prototype,wu=xu.toString;function ku(e){return wu.call(e)}var Cu="[object Null]",Su="[object Undefined]",co=Tn?Tn.toStringTag:void 0;function Mu(e){return e==null?e===void 0?Su:Cu:co&&co in Object(e)?_u(e):ku(e)}function Pu(e){return e!=null&&typeof e=="object"}var Ou="[object Symbol]";function Au(e){return typeof e=="symbol"||Pu(e)&&Mu(e)==Ou}var uo=NaN,ju=/^[-+]0x[0-9a-f]+$/i,Tu=/^0b[01]+$/i,Eu=/^0o[0-7]+$/i,Lu=parseInt;function fo(e){if(typeof e=="number")return e;if(Au(e))return uo;if(Sr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Sr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=yu(e);var n=Tu.test(e);return n||Eu.test(e)?Lu(e.slice(2),n?2:8):ju.test(e)?uo:+e}var Nu="Expected a function",Ru=Math.max,Iu=Math.min;function Du(e,t,n){var r,i,o,a,s,l,c=0,f=!1,u=!1,g=!0;if(typeof e!="function")throw new TypeError(Nu);t=fo(t)||0,Sr(n)&&(f=!!n.leading,u="maxWait"in n,o=u?Ru(fo(n.maxWait)||0,t):o,g="trailing"in n?!!n.trailing:g);function h(_){var k=r,C=i;return r=i=void 0,c=_,a=e.apply(C,k),a}function p(_){return c=_,s=setTimeout(d,t),f?h(_):a}function v(_){var k=_-l,C=_-c,P=t-k;return u?Iu(P,o-C):P}function y(_){var k=_-l,C=_-c;return l===void 0||k>=t||k<0||u&&C>=o}function d(){var _=ur();if(y(_))return b(_);s=setTimeout(d,v(_))}function b(_){return s=void 0,g&&r?h(_):(r=i=void 0,a)}function m(){s!==void 0&&clearTimeout(s),c=0,r=l=i=s=void 0}function x(){return s===void 0?a:b(ur())}function w(){var _=ur(),k=y(_);if(r=arguments,i=this,l=_,k){if(s===void 0)return p(l);if(u)return clearTimeout(s),s=setTimeout(d,t),h(l)}return s===void 0&&(s=setTimeout(d,t)),a}return w.cancel=m,w.flush=x,w}function ho(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zu(e){if(Array.isArray(e))return e}function Fu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bu(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}function $u(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}function Hu(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
503
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
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 lf(e,t){return Qu(e)||of(e,t)||Ca(e,t)||af()}function cf(e){return Zu(e)||rf(e)||Ca(e)||sf()}function uf(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function ff(e){var t=uf(e,"string");return typeof t=="symbol"?t:t+""}function Ca(e,t){if(e){if(typeof e=="string")return Mr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mr(e,t):void 0}}var Ot=new WeakMap,Xt=new WeakMap,At=new WeakMap,fr=new WeakMap,dr=new WeakMap,hr=new WeakMap,df=function(){function e(){ef(this,e),Pt(this,Ot,new Map),Pt(this,Xt,new Map),Pt(this,At,function(t){return t}),Pt(this,fr,function(){return{}}),Pt(this,dr,function(){}),Pt(this,hr,function(){})}return nf(e,[{key:"getObj",value:function(n){return Ce(Ot,this).get(Ce(At,this).call(this,n))}},{key:"getData",value:function(n){return Ce(Xt,this).get(n)}},{key:"entries",value:function(){return cf(Ce(Xt,this).entries()).map(function(n){var r=lf(n,2),i=r[0],o=r[1];return[o,i]})}},{key:"id",value:function(n){return wn(At,this,ie(n)),this}},{key:"onCreateObj",value:function(n){return wn(fr,this,n),this}},{key:"onUpdateObj",value:function(n){return wn(dr,this,n),this}},{key:"onRemoveObj",value:function(n){return wn(hr,this,n),this}},{key:"digest",value:function(n){var r=this;n.filter(function(o){return!Ce(Ot,r).has(Ce(At,r).call(r,o))}).forEach(function(o){var a=Ce(fr,r).call(r,o);Ce(Ot,r).set(Ce(At,r).call(r,o),a),Ce(Xt,r).set(a,o)});var i=new Map(n.map(function(o){return[Ce(At,r).call(r,o),o]}));return Ce(Ot,this).forEach(function(o,a){i.has(a)?Ce(dr,r).call(r,o,i.get(a)):(Ce(hr,r).call(r,o,a),Ce(Ot,r).delete(a),Ce(Xt,r).delete(o))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])}();function hf(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const vo=Symbol("implicit");function Sa(){var e=new po,t=[],n=[],r=vo;function i(o){let a=e.get(o);if(a===void 0){if(r!==vo)return r;e.set(o,a=t.push(o)-1)}return n[a%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new po;for(const a of o)e.has(a)||e.set(a,t.push(a)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return Sa(t,n).unknown(r)},hf.apply(i,arguments),i}function pf(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}const gf=pf("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function En(e){"@babel/helpers - typeof";return En=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},En(e)}var vf=/^\s+/,yf=/\s+$/;function X(e,t){if(e=e||"",t=t||{},e instanceof X)return e;if(!(this instanceof X))return new X(e,t);var n=mf(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}X.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),n,r,i,o,a,s;return n=t.r/255,r=t.g/255,i=t.b/255,n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),i<=.03928?s=i/12.92:s=Math.pow((i+.055)/1.055,2.4),.2126*o+.7152*a+.0722*s},setAlpha:function(t){return this._a=Ma(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=mo(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=mo(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),i=Math.round(t.v*100);return this._a==1?"hsv("+n+", "+r+"%, "+i+"%)":"hsva("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=yo(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=yo(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),i=Math.round(t.l*100);return this._a==1?"hsl("+n+", "+r+"%, "+i+"%)":"hsla("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return bo(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return wf(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(pe(this._r,255)*100)+"%",g:Math.round(pe(this._g,255)*100)+"%",b:Math.round(pe(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(pe(this._r,255)*100)+"%, "+Math.round(pe(this._g,255)*100)+"%, "+Math.round(pe(this._b,255)*100)+"%)":"rgba("+Math.round(pe(this._r,255)*100)+"%, "+Math.round(pe(this._g,255)*100)+"%, "+Math.round(pe(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Nf[bo(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+_o(this._r,this._g,this._b,this._a),r=n,i=this._gradientType?"GradientType = 1, ":"";if(t){var o=X(t);r="#"+_o(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+n+",endColorstr="+r+")"},toString:function(t){var n=!!t;t=t||this._format;var r=!1,i=this._a<1&&this._a>=0,o=!n&&i&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return o?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return X(this.toString())},_applyModification:function(t,n){var r=t.apply(null,[this].concat([].slice.call(n)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(Mf,arguments)},brighten:function(){return this._applyModification(Pf,arguments)},darken:function(){return this._applyModification(Of,arguments)},desaturate:function(){return this._applyModification(kf,arguments)},saturate:function(){return this._applyModification(Cf,arguments)},greyscale:function(){return this._applyModification(Sf,arguments)},spin:function(){return this._applyModification(Af,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(Ef,arguments)},complement:function(){return this._applyCombination(jf,arguments)},monochromatic:function(){return this._applyCombination(Lf,arguments)},splitcomplement:function(){return this._applyCombination(Tf,arguments)},triad:function(){return this._applyCombination(xo,[3])},tetrad:function(){return this._applyCombination(xo,[4])}};X.fromRatio=function(e,t){if(En(e)=="object"){var n={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?n[r]=e[r]:n[r]=tn(e[r]));e=n}return X(e,t)};function mf(e){var t={r:0,g:0,b:0},n=1,r=null,i=null,o=null,a=!1,s=!1;return typeof e=="string"&&(e=zf(e)),En(e)=="object"&&(it(e.r)&&it(e.g)&&it(e.b)?(t=bf(e.r,e.g,e.b),a=!0,s=String(e.r).substr(-1)==="%"?"prgb":"rgb"):it(e.h)&&it(e.s)&&it(e.v)?(r=tn(e.s),i=tn(e.v),t=xf(e.h,r,i),a=!0,s="hsv"):it(e.h)&&it(e.s)&&it(e.l)&&(r=tn(e.s),o=tn(e.l),t=_f(e.h,r,o),a=!0,s="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=Ma(n),{ok:a,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function bf(e,t,n){return{r:pe(e,255)*255,g:pe(t,255)*255,b:pe(n,255)*255}}function yo(e,t,n){e=pe(e,255),t=pe(t,255),n=pe(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),o,a,s=(r+i)/2;if(r==i)o=a=0;else{var l=r-i;switch(a=s>.5?l/(2-r-i):l/(r+i),r){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4;break}o/=6}return{h:o,s:a,l:s}}function _f(e,t,n){var r,i,o;e=pe(e,360),t=pe(t,100),n=pe(n,100);function a(c,f,u){return u<0&&(u+=1),u>1&&(u-=1),u<1/6?c+(f-c)*6*u:u<1/2?f:u<2/3?c+(f-c)*(2/3-u)*6:c}if(t===0)r=i=o=n;else{var s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;r=a(l,s,e+1/3),i=a(l,s,e),o=a(l,s,e-1/3)}return{r:r*255,g:i*255,b:o*255}}function mo(e,t,n){e=pe(e,255),t=pe(t,255),n=pe(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),o,a,s=r,l=r-i;if(a=r===0?0:l/r,r==i)o=0;else{switch(r){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4;break}o/=6}return{h:o,s:a,v:s}}function xf(e,t,n){e=pe(e,360)*6,t=pe(t,100),n=pe(n,100);var r=Math.floor(e),i=e-r,o=n*(1-t),a=n*(1-i*t),s=n*(1-(1-i)*t),l=r%6,c=[n,a,o,o,s,n][l],f=[s,n,n,a,o,o][l],u=[o,o,s,n,n,a][l];return{r:c*255,g:f*255,b:u*255}}function bo(e,t,n,r){var i=[Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function wf(e,t,n,r,i){var o=[Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16)),Ye(Pa(r))];return i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}function _o(e,t,n,r){var i=[Ye(Pa(r)),Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16))];return i.join("")}X.equals=function(e,t){return!e||!t?!1:X(e).toRgbString()==X(t).toRgbString()};X.random=function(){return X.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function kf(e,t){t=t===0?0:t||10;var n=X(e).toHsl();return n.s-=t/100,n.s=Hn(n.s),X(n)}function Cf(e,t){t=t===0?0:t||10;var n=X(e).toHsl();return n.s+=t/100,n.s=Hn(n.s),X(n)}function Sf(e){return X(e).desaturate(100)}function Mf(e,t){t=t===0?0:t||10;var n=X(e).toHsl();return n.l+=t/100,n.l=Hn(n.l),X(n)}function Pf(e,t){t=t===0?0:t||10;var n=X(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),X(n)}function Of(e,t){t=t===0?0:t||10;var n=X(e).toHsl();return n.l-=t/100,n.l=Hn(n.l),X(n)}function Af(e,t){var n=X(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,X(n)}function jf(e){var t=X(e).toHsl();return t.h=(t.h+180)%360,X(t)}function xo(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=X(e).toHsl(),r=[X(e)],i=360/t,o=1;o<t;o++)r.push(X({h:(n.h+o*i)%360,s:n.s,l:n.l}));return r}function Tf(e){var t=X(e).toHsl(),n=t.h;return[X(e),X({h:(n+72)%360,s:t.s,l:t.l}),X({h:(n+216)%360,s:t.s,l:t.l})]}function Ef(e,t,n){t=t||6,n=n||30;var r=X(e).toHsl(),i=360/n,o=[X(e)];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,o.push(X(r));return o}function Lf(e,t){t=t||6;for(var n=X(e).toHsv(),r=n.h,i=n.s,o=n.v,a=[],s=1/t;t--;)a.push(X({h:r,s:i,v:o})),o=(o+s)%1;return a}X.mix=function(e,t,n){n=n===0?0:n||50;var r=X(e).toRgb(),i=X(t).toRgb(),o=n/100,a={r:(i.r-r.r)*o+r.r,g:(i.g-r.g)*o+r.g,b:(i.b-r.b)*o+r.b,a:(i.a-r.a)*o+r.a};return X(a)};X.readability=function(e,t){var n=X(e),r=X(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)};X.isReadable=function(e,t,n){var r=X.readability(e,t),i,o;switch(o=!1,i=Ff(n),i.level+i.size){case"AAsmall":case"AAAlarge":o=r>=4.5;break;case"AAlarge":o=r>=3;break;case"AAAsmall":o=r>=7;break}return o};X.mostReadable=function(e,t,n){var r=null,i=0,o,a,s,l;n=n||{},a=n.includeFallbackColors,s=n.level,l=n.size;for(var c=0;c<t.length;c++)o=X.readability(e,t[c]),o>i&&(i=o,r=X(t[c]));return X.isReadable(e,r,{level:s,size:l})||!a?r:(n.includeFallbackColors=!1,X.mostReadable(e,["#fff","#000"],n))};var Pr=X.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Nf=X.hexNames=Rf(Pr);function Rf(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function Ma(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function pe(e,t){If(e)&&(e="100%");var n=Df(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function Hn(e){return Math.min(1,Math.max(0,e))}function Ie(e){return parseInt(e,16)}function If(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function Df(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Ye(e){return e.length==1?"0"+e:""+e}function tn(e){return e<=1&&(e=e*100+"%"),e}function Pa(e){return Math.round(parseFloat(e)*255).toString(16)}function wo(e){return Ie(e)/255}var We=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function it(e){return!!We.CSS_UNIT.exec(e)}function zf(e){e=e.replace(vf,"").replace(yf,"").toLowerCase();var t=!1;if(Pr[e])e=Pr[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=We.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=We.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=We.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=We.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=We.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=We.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=We.hex8.exec(e))?{r:Ie(n[1]),g:Ie(n[2]),b:Ie(n[3]),a:wo(n[4]),format:t?"name":"hex8"}:(n=We.hex6.exec(e))?{r:Ie(n[1]),g:Ie(n[2]),b:Ie(n[3]),format:t?"name":"hex"}:(n=We.hex4.exec(e))?{r:Ie(n[1]+""+n[1]),g:Ie(n[2]+""+n[2]),b:Ie(n[3]+""+n[3]),a:wo(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=We.hex3.exec(e))?{r:Ie(n[1]+""+n[1]),g:Ie(n[2]+""+n[2]),b:Ie(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function Ff(e){var t,n;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:t,size:n}}function Or(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Bf(e){if(Array.isArray(e))return e}function $f(e){if(Array.isArray(e))return Or(e)}function Oa(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function Hf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Aa(e,t,n){return t=Nt(t),Kf(e,ii()?Reflect.construct(t,n||[],Nt(e).constructor):t.apply(e,n))}function Uf(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ja(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pr(e,t){return e.get(Oa(e,t))}function ko(e,t,n){Uf(e,t),t.set(e,n)}function Co(e,t,n){return e.set(Oa(e,t),n),n}function Ta(e,t,n){if(ii())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return i}function qf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Na(r.key),r)}}function Ea(e,t,n){return t&&qf(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Un(e,t,n){return(t=Na(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ar(){return Ar=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Qf(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Ar.apply(null,arguments)}function Nt(e){return Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nt(e)}function La(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jr(e,t)}function ii(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ii=function(){return!!e})()}function Vf(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Gf(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}function Wf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
506
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
507
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function So(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Yf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?So(Object(n),!0).forEach(function(r){Un(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):So(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Kf(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hf(e)}function jr(e,t){return jr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},jr(e,t)}function rn(e,t){return Bf(e)||Gf(e,t)||Ra(e,t)||Wf()}function Qf(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Nt(e))!==null;);return e}function gr(e,t,n,r){var i=Ar(Nt(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function Xe(e){return $f(e)||Vf(e)||Ra(e)||Xf()}function Zf(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Na(e){var t=Zf(e,"string");return typeof t=="symbol"?t:t+""}function Tr(e){"@babel/helpers - typeof";return Tr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tr(e)}function Ra(e,t){if(e){if(typeof e=="string")return Or(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Or(e,t):void 0}}var Ia=function(t){t instanceof Array?t.forEach(Ia):(t.map&&t.map.dispose(),t.dispose())},oi=function(t){t.geometry&&t.geometry.dispose(),t.material&&Ia(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(oi)},Mo=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),oi(n)}},vr=new WeakMap,kn=new WeakMap,Yt=function(e){function t(n){var r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.dataBindAttr,a=o===void 0?"__data":o,s=i.objBindAttr,l=s===void 0?"__threeObj":s;return ja(this,t),r=Aa(this,t),Un(r,"scene",void 0),ko(r,vr,void 0),ko(r,kn,void 0),r.scene=n,Co(vr,r,a),Co(kn,r,l),r.onRemoveObj(function(){}),r}return La(t,e),Ea(t,[{key:"onCreateObj",value:function(r){var i=this;return gr(t,"onCreateObj",this)([function(o){var a=r(o);return o[pr(kn,i)]=a,a[pr(vr,i)]=o,i.scene.add(a),a}]),this}},{key:"onRemoveObj",value:function(r){var i=this;return gr(t,"onRemoveObj",this)([function(o,a){var s=gr(t,"getData",i)([o]);r(o,a),i.scene.remove(o),oi(o),delete s[pr(kn,i)]}]),this}}])}(df),Kt=function(t){return isNaN(t)?parseInt(X(t).toHex(),16):t},yr=function(t){return isNaN(t)?X(t).getAlpha():1},Jf=Sa(gf);function Po(e,t,n){!t||typeof n!="string"||e.filter(function(r){return!r[n]}).forEach(function(r){r[n]=Jf(t(r))})}function ed(e,t){var n=e.nodes,r=e.links,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=i.nodeFilter,a=o===void 0?function(){return!0}:o,s=i.onLoopError,l=s===void 0?function(h){throw"Invalid DAG structure! Found cycle in node path: ".concat(h.join(" -> "),".")}:s,c={};n.forEach(function(h){return c[t(h)]={data:h,out:[],depth:-1,skip:!a(h)}}),r.forEach(function(h){var p=h.source,v=h.target,y=x(p),d=x(v);if(!c.hasOwnProperty(y))throw"Missing source node with id: ".concat(y);if(!c.hasOwnProperty(d))throw"Missing target node with id: ".concat(d);var b=c[y],m=c[d];b.out.push(m);function x(w){return Tr(w)==="object"?t(w):w}});var f=[];g(Object.values(c));var u=Object.assign.apply(Object,[{}].concat(Xe(Object.entries(c).filter(function(h){var p=rn(h,2),v=p[1];return!v.skip}).map(function(h){var p=rn(h,2),v=p[0],y=p[1];return Un({},v,y.depth)}))));return u;function g(h){for(var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,y=function(){var x=h[d];if(p.indexOf(x)!==-1){var w=[].concat(Xe(p.slice(p.indexOf(x))),[x]).map(function(_){return t(_.data)});return f.some(function(_){return _.length===w.length&&_.every(function(k,C){return k===w[C]})})||(f.push(w),l(w)),1}v>x.depth&&(x.depth=v,g(x.out,[].concat(Xe(p),[x]),v+(x.skip?0:1)))},d=0,b=h.length;d<b;d++)y()}}var Q=window.THREE?window.THREE:{Group:K.Group,Mesh:K.Mesh,MeshLambertMaterial:K.MeshLambertMaterial,Color:K.Color,BufferGeometry:K.BufferGeometry,BufferAttribute:K.BufferAttribute,Matrix4:K.Matrix4,Vector3:K.Vector3,SphereGeometry:K.SphereGeometry,CylinderGeometry:K.CylinderGeometry,TubeGeometry:K.TubeGeometry,ConeGeometry:K.ConeGeometry,Line:K.Line,LineBasicMaterial:K.LineBasicMaterial,QuadraticBezierCurve3:K.QuadraticBezierCurve3,CubicBezierCurve3:K.CubicBezierCurve3,Box3:K.Box3},Oo={graph:jc,forcelayout:fu},td=2,mr=new Q.BufferGeometry().setAttribute?"setAttribute":"addAttribute",Cn=new Q.BufferGeometry().applyMatrix4?"applyMatrix4":"applyMatrix",nd=ri({props:{jsonUrl:{onChange:function(t,n){var r=this;t&&!n.fetchingJson&&(n.fetchingJson=!0,n.onLoading(),fetch(t).then(function(i){return i.json()}).then(function(i){n.fetchingJson=!1,n.onFinishLoading(i),r.graphData(i)}))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(t,n){n.engineRunning=!1}},numDimensions:{default:3,onChange:function(t,n){var r=n.d3ForceLayout.force("charge");r&&r.strength(t>2?-60:-30),t<3&&i(n.graphData.nodes,"z"),t<2&&i(n.graphData.nodes,"y");function i(o,a){o.forEach(function(s){delete s[a],delete s["v".concat(a)]})}}},dagMode:{onChange:function(t,n){!t&&n.forceEngine==="d3"&&(n.graphData.nodes||[]).forEach(function(r){return r.fx=r.fy=r.fz=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(t){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},nodePositionUpdate:{triggerUpdate:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},linkDirectionalParticleThreeObject:{},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaDecay(t)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaTarget(t)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.velocityDecay(t)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(t){return t._flushObjects=!0,t._rerender(),this},d3Force:function(t,n,r){return r===void 0?t.d3ForceLayout.force(n):(t.d3ForceLayout.force(n,r),this)},d3ReheatSimulation:function(t){return t.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(t){return t.cntTicks=0,t.startTickTime=new Date,t.engineRunning=!0,this},tickFrame:function(t){var n=t.forceEngine!=="ngraph";return t.engineRunning&&r(),i(),o(),this;function r(){++t.cntTicks>t.cooldownTicks||new Date-t.startTickTime>t.cooldownTime||n&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin?(t.engineRunning=!1,t.onEngineStop()):(t.layout[n?"tick":"step"](),t.onEngineTick());var a=ie(t.nodeThreeObjectExtend);t.nodeDataMapper.entries().forEach(function(g){var h=rn(g,2),p=h[0],v=h[1];if(v){var y=n?p:t.layout.getNodePosition(p[t.nodeId]),d=a(p);(!t.nodePositionUpdate||!t.nodePositionUpdate(d?v.children[0]:v,{x:y.x,y:y.y,z:y.z},p)||d)&&(v.position.x=y.x,v.position.y=y.y||0,v.position.z=y.z||0)}});var s=ie(t.linkWidth),l=ie(t.linkCurvature),c=ie(t.linkCurveRotation),f=ie(t.linkThreeObjectExtend);t.linkDataMapper.entries().forEach(function(g){var h=rn(g,2),p=h[0],v=h[1];if(v){var y=n?p:t.layout.getLinkPosition(t.layout.graph.getLink(p.source,p.target).id),d=y[n?"source":"from"],b=y[n?"target":"to"];if(!(!d||!b||!d.hasOwnProperty("x")||!b.hasOwnProperty("x"))){u(p);var m=f(p);if(!(t.linkPositionUpdate&&t.linkPositionUpdate(m?v.children[1]:v,{start:{x:d.x,y:d.y,z:d.z},end:{x:b.x,y:b.y,z:b.z}},p)&&!m)){var x=30,w=p.__curve,_=v.children.length?v.children[0]:v;if(_.type==="Line"){if(w){var C=w.getPoints(x);_.geometry.getAttribute("position").array.length!==C.length*3&&_.geometry[mr]("position",new Q.BufferAttribute(new Float32Array(C.length*3),3)),_.geometry.setFromPoints(C)}else{var k=_.geometry.getAttribute("position");(!k||!k.array||k.array.length!==6)&&_.geometry[mr]("position",k=new Q.BufferAttribute(new Float32Array(2*3),3)),k.array[0]=d.x,k.array[1]=d.y||0,k.array[2]=d.z||0,k.array[3]=b.x,k.array[4]=b.y||0,k.array[5]=b.z||0,k.needsUpdate=!0}_.geometry.computeBoundingSphere()}else if(_.type==="Mesh")if(w){_.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(_.position.set(0,0,0),_.rotation.set(0,0,0),_.scale.set(1,1,1));var O=Math.ceil(s(p)*10)/10,L=O/2,U=new Q.TubeGeometry(w,x,L,t.linkResolution,!1);_.geometry.dispose(),_.geometry=U}else{if(!_.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var P=Math.ceil(s(p)*10)/10,M=P/2,N=new Q.CylinderGeometry(M,M,1,t.linkResolution,1,!1);N[Cn](new Q.Matrix4().makeTranslation(0,1/2,0)),N[Cn](new Q.Matrix4().makeRotationX(Math.PI/2)),_.geometry.dispose(),_.geometry=N}var E=new Q.Vector3(d.x,d.y||0,d.z||0),B=new Q.Vector3(b.x,b.y||0,b.z||0),S=E.distanceTo(B);_.position.x=E.x,_.position.y=E.y,_.position.z=E.z,_.scale.z=S,_.parent.localToWorld(B),_.lookAt(B)}}}}});function u(g){var h=n?g:t.layout.getLinkPosition(t.layout.graph.getLink(g.source,g.target).id),p=h[n?"source":"from"],v=h[n?"target":"to"];if(!(!p||!v||!p.hasOwnProperty("x")||!v.hasOwnProperty("x"))){var y=l(g);if(!y)g.__curve=null;else{var d=new Q.Vector3(p.x,p.y||0,p.z||0),b=new Q.Vector3(v.x,v.y||0,v.z||0),m=d.distanceTo(b),x,w=c(g);if(m>0){var _=v.x-p.x,k=v.y-p.y||0,C=new Q.Vector3().subVectors(b,d),P=C.clone().multiplyScalar(y).cross(_!==0||k!==0?new Q.Vector3(0,0,1):new Q.Vector3(0,1,0)).applyAxisAngle(C.normalize(),w).add(new Q.Vector3().addVectors(d,b).divideScalar(2));x=new Q.QuadraticBezierCurve3(d,P,b)}else{var M=y*70,N=-w,E=N+Math.PI/2;x=new Q.CubicBezierCurve3(d,new Q.Vector3(M*Math.cos(E),M*Math.sin(E),0).add(d),new Q.Vector3(M*Math.cos(N),M*Math.sin(N),0).add(d),b)}g.__curve=x}}}}function i(){var a=ie(t.linkDirectionalArrowRelPos),s=ie(t.linkDirectionalArrowLength),l=ie(t.nodeVal);t.arrowDataMapper.entries().forEach(function(c){var f=rn(c,2),u=f[0],g=f[1];if(g){var h=n?u:t.layout.getLinkPosition(t.layout.graph.getLink(u.source,u.target).id),p=h[n?"source":"from"],v=h[n?"target":"to"];if(!(!p||!v||!p.hasOwnProperty("x")||!v.hasOwnProperty("x"))){var y=Math.cbrt(Math.max(0,l(p)||1))*t.nodeRelSize,d=Math.cbrt(Math.max(0,l(v)||1))*t.nodeRelSize,b=s(u),m=a(u),x=u.__curve?function(M){return u.__curve.getPoint(M)}:function(M){var N=function(B,S,O,L){return S[B]+(O[B]-S[B])*L||0};return{x:N("x",p,v,M),y:N("y",p,v,M),z:N("z",p,v,M)}},w=u.__curve?u.__curve.getLength():Math.sqrt(["x","y","z"].map(function(M){return Math.pow((v[M]||0)-(p[M]||0),2)}).reduce(function(M,N){return M+N},0)),_=y+b+(w-y-d-b)*m,k=x(_/w),C=x((_-b)/w);["x","y","z"].forEach(function(M){return g.position[M]=C[M]});var P=Ta(Q.Vector3,Xe(["x","y","z"].map(function(M){return k[M]})));g.parent.localToWorld(P),g.lookAt(P)}}})}function o(){var a=ie(t.linkDirectionalParticleSpeed),s=ie(t.linkDirectionalParticleOffset);t.graphData.links.forEach(function(l){var c=t.particlesDataMapper.getObj(l),f=c&&c.children,u=l.__singleHopPhotonsObj&&l.__singleHopPhotonsObj.children;if(!((!u||!u.length)&&(!f||!f.length))){var g=n?l:t.layout.getLinkPosition(t.layout.graph.getLink(l.source,l.target).id),h=g[n?"source":"from"],p=g[n?"target":"to"];if(!(!h||!p||!h.hasOwnProperty("x")||!p.hasOwnProperty("x"))){var v=a(l),y=Math.abs(s(l)),d=l.__curve?function(m){return l.__curve.getPoint(m)}:function(m){var x=function(_,k,C,P){return k[_]+(C[_]-k[_])*P||0};return{x:x("x",h,p,m),y:x("y",h,p,m),z:x("z",h,p,m)}},b=[].concat(Xe(f||[]),Xe(u||[]));b.forEach(function(m,x){var w=m.parent.__linkThreeObjType==="singleHopPhotons";if(m.hasOwnProperty("__progressRatio")||(m.__progressRatio=w?v<0?1:0:(x+y)/f.length),m.__progressRatio+=v,m.__progressRatio>=1||m.__progressRatio<0)if(!w)m.__progressRatio=m.__progressRatio%1,m.__progressRatio<0&&m.__progressRatio++;else{m.parent.remove(m),Mo(m);return}var _=m.__progressRatio,k=d(_);m.geometry.type!=="SphereGeometry"&&m.lookAt(k.x,k.y,k.z),["x","y","z"].forEach(function(C){return m.position[C]=k[C]})})}}})}},emitParticle:function(t,n){if(n&&t.graphData.links.includes(n)){if(!n.__singleHopPhotonsObj){var r=new Q.Group;r.__linkThreeObjType="singleHopPhotons",n.__singleHopPhotonsObj=r,t.graphScene.add(r)}var i=ie(t.linkDirectionalParticleThreeObject)(n);if(i&&t.linkDirectionalParticleThreeObject===i&&(i=i.clone()),!i){var o=ie(t.linkDirectionalParticleWidth),a=Math.ceil(o(n)*10)/10/2,s=t.linkDirectionalParticleResolution,l=new Q.SphereGeometry(a,s,s),c=ie(t.linkColor),f=ie(t.linkDirectionalParticleColor),u=f(n)||c(n)||"#f0f0f0",g=new Q.Color(Kt(u)),h=t.linkOpacity*3,p=new Q.MeshLambertMaterial({color:g,transparent:!0,opacity:h});i=new Q.Mesh(l,p)}n.__singleHopPhotonsObj.add(i)}return this},getGraphBbox:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0};if(!t.initialised)return null;var r=function i(o){var a=[];if(o.geometry){o.geometry.computeBoundingBox();var s=new Q.Box3;s.copy(o.geometry.boundingBox).applyMatrix4(o.matrixWorld),a.push(s)}return a.concat.apply(a,Xe((o.children||[]).filter(function(l){return!l.hasOwnProperty("__graphObjType")||l.__graphObjType==="node"&&n(l.__data)}).map(i)))}(t.graphScene);return r.length?Object.assign.apply(Object,Xe(["x","y","z"].map(function(i){return Un({},i,[Ku(r,function(o){return o.min[i]}),Yu(r,function(o){return o.max[i]})])}))):null}},stateInit:function(){return{d3ForceLayout:kc().force("link",lc()).force("charge",Cc()).force("center",cl()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(t,n){n.graphScene=t,n.nodeDataMapper=new Yt(t,{objBindAttr:"__threeObj"}),n.linkDataMapper=new Yt(t,{objBindAttr:"__lineObj"}),n.arrowDataMapper=new Yt(t,{objBindAttr:"__arrowObj"}),n.particlesDataMapper=new Yt(t,{objBindAttr:"__photonsObj"})},update:function(t,n){var r=function(H){return H.some(function(z){return n.hasOwnProperty(z)})};if(t.engineRunning=!1,typeof t.onUpdate=="function"&&t.onUpdate(),t.nodeAutoColorBy!==null&&r(["nodeAutoColorBy","graphData","nodeColor"])&&Po(t.graphData.nodes,ie(t.nodeAutoColorBy),t.nodeColor),t.linkAutoColorBy!==null&&r(["linkAutoColorBy","graphData","linkColor"])&&Po(t.graphData.links,ie(t.linkAutoColorBy),t.linkColor),t._flushObjects||r(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var i=ie(t.nodeThreeObject),o=ie(t.nodeThreeObjectExtend),a=ie(t.nodeVal),s=ie(t.nodeColor),l=ie(t.nodeVisibility),c={},f={};(t._flushObjects||r(["nodeThreeObject","nodeThreeObjectExtend"]))&&t.nodeDataMapper.clear(),t.nodeDataMapper.onCreateObj(function(I){var H=i(I),z=o(I);H&&t.nodeThreeObject===H&&(H=H.clone());var F;return H&&!z?F=H:(F=new Q.Mesh,F.__graphDefaultObj=!0,H&&z&&F.add(H)),F.__graphObjType="node",F}).onUpdateObj(function(I,H){if(I.__graphDefaultObj){var z=a(H)||1,F=Math.cbrt(z)*t.nodeRelSize,R=t.nodeResolution;(!I.geometry.type.match(/^Sphere(Buffer)?Geometry$/)||I.geometry.parameters.radius!==F||I.geometry.parameters.widthSegments!==R)&&(c.hasOwnProperty(z)||(c[z]=new Q.SphereGeometry(F,R,R)),I.geometry.dispose(),I.geometry=c[z]);var q=s(H),V=new Q.Color(Kt(q||"#ffffaa")),re=t.nodeOpacity*yr(q);(I.material.type!=="MeshLambertMaterial"||!I.material.color.equals(V)||I.material.opacity!==re)&&(f.hasOwnProperty(q)||(f[q]=new Q.MeshLambertMaterial({color:V,transparent:!0,opacity:re})),I.material.dispose(),I.material=f[q])}}).digest(t.graphData.nodes.filter(l))}if(t._flushObjects||r(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject"])){var u=ie(t.linkThreeObject),g=ie(t.linkThreeObjectExtend),h=ie(t.linkMaterial),p=ie(t.linkVisibility),v=ie(t.linkColor),y=ie(t.linkWidth),d={},b={},m={},x=t.graphData.links.filter(p);if((t._flushObjects||r(["linkThreeObject","linkThreeObjectExtend","linkWidth"]))&&t.linkDataMapper.clear(),t.linkDataMapper.onRemoveObj(function(I){var H=I.__data&&I.__data.__singleHopPhotonsObj;H&&(H.parent.remove(H),Mo(H),delete I.__data.__singleHopPhotonsObj)}).onCreateObj(function(I){var H=u(I),z=g(I);H&&t.linkThreeObject===H&&(H=H.clone());var F;if(!H||z){var R=!!y(I);if(R)F=new Q.Mesh;else{var q=new Q.BufferGeometry;q[mr]("position",new Q.BufferAttribute(new Float32Array(2*3),3)),F=new Q.Line(q)}}var V;return H?z?(V=new Q.Group,V.__graphDefaultObj=!0,V.add(F),V.add(H)):V=H:(V=F,V.__graphDefaultObj=!0),V.renderOrder=10,V.__graphObjType="link",V}).onUpdateObj(function(I,H){if(I.__graphDefaultObj){var z=I.children.length?I.children[0]:I,F=Math.ceil(y(H)*10)/10,R=!!F;if(R){var q=F/2,V=t.linkResolution;if(!z.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||z.geometry.parameters.radiusTop!==q||z.geometry.parameters.radialSegments!==V){if(!d.hasOwnProperty(F)){var re=new Q.CylinderGeometry(q,q,1,V,1,!1);re[Cn](new Q.Matrix4().makeTranslation(0,1/2,0)),re[Cn](new Q.Matrix4().makeRotationX(Math.PI/2)),d[F]=re}z.geometry.dispose(),z.geometry=d[F]}}var le=h(H);if(le)z.material=le;else{var ce=v(H),Se=new Q.Color(Kt(ce||"#f0f0f0")),me=t.linkOpacity*yr(ce),Te=R?"MeshLambertMaterial":"LineBasicMaterial";if(z.material.type!==Te||!z.material.color.equals(Se)||z.material.opacity!==me){var ze=R?b:m;ze.hasOwnProperty(ce)||(ze[ce]=new Q[Te]({color:Se,transparent:me<1,opacity:me,depthWrite:me>=1})),z.material.dispose(),z.material=ze[ce]}}}}).digest(x),t.linkDirectionalArrowLength||n.hasOwnProperty("linkDirectionalArrowLength")){var w=ie(t.linkDirectionalArrowLength),_=ie(t.linkDirectionalArrowColor);t.arrowDataMapper.onCreateObj(function(){var I=new Q.Mesh(void 0,new Q.MeshLambertMaterial({transparent:!0}));return I.__linkThreeObjType="arrow",I}).onUpdateObj(function(I,H){var z=w(H),F=t.linkDirectionalArrowResolution;if(!I.geometry.type.match(/^Cone(Buffer)?Geometry$/)||I.geometry.parameters.height!==z||I.geometry.parameters.radialSegments!==F){var R=new Q.ConeGeometry(z*.25,z,F);R.translate(0,z/2,0),R.rotateX(Math.PI/2),I.geometry.dispose(),I.geometry=R}var q=_(H)||v(H)||"#f0f0f0";I.material.color=new Q.Color(Kt(q)),I.material.opacity=t.linkOpacity*3*yr(q)}).digest(x.filter(w))}if(t.linkDirectionalParticles||n.hasOwnProperty("linkDirectionalParticles")){var k=ie(t.linkDirectionalParticles),C=ie(t.linkDirectionalParticleWidth),P=ie(t.linkDirectionalParticleColor),M=ie(t.linkDirectionalParticleThreeObject),N={},E={};t.particlesDataMapper.onCreateObj(function(){var I=new Q.Group;return I.__linkThreeObjType="photons",I.__photonDataMapper=new Yt(I),I}).onUpdateObj(function(I,H){var z=!!I.children.length&&I.children[0],F=M(H),R,q;if(F)R=F.geometry,q=F.material;else{var V=Math.ceil(C(H)*10)/10/2,re=t.linkDirectionalParticleResolution;z&&z.geometry.parameters.radius===V&&z.geometry.parameters.widthSegments===re?R=z.geometry:(E.hasOwnProperty(V)||(E[V]=new Q.SphereGeometry(V,re,re)),R=E[V]);var le=P(H)||v(H)||"#f0f0f0",ce=new Q.Color(Kt(le)),Se=t.linkOpacity*3;z&&z.material.color.equals(ce)&&z.material.opacity===Se?q=z.material:(N.hasOwnProperty(le)||(N[le]=new Q.MeshLambertMaterial({color:ce,transparent:!0,opacity:Se})),q=N[le])}z&&(z.geometry!==R&&z.geometry.dispose(),z.material!==q&&z.material.dispose());var me=Math.round(Math.abs(k(H)));I.__photonDataMapper.id(function(Te){return Te.idx}).onCreateObj(function(){return new Q.Mesh(R,q)}).onUpdateObj(function(Te){Te.geometry=R,Te.material=q}).digest(Xe(new Array(me)).map(function(Te,ze){return{idx:ze}}))}).digest(x.filter(k))}}if(t._flushObjects=!1,r(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach(function(I){I.source=I[t.linkSource],I.target=I[t.linkTarget]});var B=t.forceEngine!=="ngraph",S;if(B){(S=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var O=t.d3ForceLayout.force("link");O&&O.id(function(I){return I[t.nodeId]}).links(t.graphData.links);var L=t.dagMode&&ed(t.graphData,function(I){return I[t.nodeId]},{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),U=Math.max.apply(Math,Xe(Object.values(L||[]))),ne=t.dagLevelDistance||t.graphData.nodes.length/(U||1)*td*(["radialin","radialout"].indexOf(t.dagMode)!==-1?.7:1);if(["lr","rl","td","bu","zin","zout"].includes(n.dagMode)){var J=["lr","rl"].includes(n.dagMode)?"fx":["td","bu"].includes(n.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(I){return delete I[J]})}if(["lr","rl","td","bu","zin","zout"].includes(t.dagMode)){var se=["rl","td","zout"].includes(t.dagMode),D=function(H){return(L[H[t.nodeId]]-U/2)*ne*(se?-1:1)},$=["lr","rl"].includes(t.dagMode)?"fx":["td","bu"].includes(t.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(I){return I[$]=D(I)})}t.d3ForceLayout.force("dagRadial",["radialin","radialout"].indexOf(t.dagMode)!==-1?Sc(function(I){var H=L[I[t.nodeId]]||-1;return(t.dagMode==="radialin"?U-H:H)*ne}).strength(function(I){return t.dagNodeFilter(I)?1:0}):null)}else{var G=Oo.graph();t.graphData.nodes.forEach(function(I){G.addNode(I[t.nodeId])}),t.graphData.links.forEach(function(I){G.addLink(I.source,I.target)}),S=Oo.forcelayout(G,Yf({dimensions:t.numDimensions},t.ngraphPhysics)),S.graph=G}for(var Z=0;Z<t.warmupTicks&&!(B&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);Z++)S[B?"tick":"step"]();t.layout=S,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}});function rd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=function(i){function o(){var a;ja(this,o);for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return a=Aa(this,o,[].concat(l)),a.__kapsuleInstance=Ta(e,[].concat(Xe(n?[a]:[]),l)),a}return La(o,i),Ea(o)}(t);return Object.keys(e()).forEach(function(i){return r.prototype[i]=function(){var o,a=(o=this.__kapsuleInstance)[i].apply(o,arguments);return a===this.__kapsuleInstance?this:a}}),r}var id=window.THREE?window.THREE:{Group:K.Group},Da=rd(nd,id.Group,!0);function Le(){return Le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Le.apply(null,arguments)}function od(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ln(e,t){return ln=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ln(e,t)}function ad(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ln(e,t)}function Er(e){return Er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Er(e)}function sd(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function za(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(za=function(){return!!e})()}function ld(e,t,n){if(za())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&ln(i,n.prototype),i}function Lr(e){var t=typeof Map=="function"?new Map:void 0;return Lr=function(r){if(r===null||!sd(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(r))return t.get(r);t.set(r,i)}function i(){return ld(r,arguments,Er(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ln(i,r)},Lr(e)}var cd={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
|
|
502
|
+
`}var au=uo.exports,vr,di;function su(){if(di)return vr;di=1,vr=e;function e(t,n,r,o){this.from=t,this.to=n,this.length=r,this.coefficient=o}return vr}var yr,hi;function lu(){if(hi)return yr;hi=1,yr=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 yr}var en={exports:{}},pi;function cu(){if(pi)return en.exports;pi=1,en.exports=e,en.exports.random=e,en.exports.randomIterator=s;function e(l){var c=typeof l=="number"?l:+new Date;return new t(c)}function t(l){this.seed=l}t.prototype.next=a,t.prototype.nextDouble=i,t.prototype.uniform=i,t.prototype.gaussian=n,t.prototype.random=i;function n(){var l,c,f;do c=this.nextDouble()*2-1,f=this.nextDouble()*2-1,l=c*c+f*f;while(l>=1||l===0);return c*Math.sqrt(-2*Math.log(l)/l)}t.prototype.levy=r;function r(){var l=1.5,c=Math.pow(o(1+l)*Math.sin(Math.PI*l/2)/(o((1+l)/2)*l*Math.pow(2,(l-1)/2)),1/l);return this.gaussian()*c/Math.pow(Math.abs(this.gaussian()),1/l)}function o(l){return Math.sqrt(2*Math.PI/l)*Math.pow(1/Math.E*(l+1/(12*l-1/(10*l))),l)}function i(){var l=this.seed;return l=l+2127912214+(l<<12)&4294967295,l=(l^3345072700^l>>>19)&4294967295,l=l+374761393+(l<<5)&4294967295,l=(l+3550635116^l<<9)&4294967295,l=l+4251993797+(l<<3)&4294967295,l=(l^3042594569^l>>>16)&4294967295,this.seed=l,(l&268435455)/268435456}function a(l){return Math.floor(this.nextDouble()*l)}function s(l,c){var f=c||e();if(typeof f.next!="function")throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:v,shuffle:u};function u(){var h,p,g;for(h=l.length-1;h>0;--h)p=f.next(h+1),g=l[p],l[p]=l[h],l[h]=g;return l}function v(h){var p,g,y;for(p=l.length-1;p>0;--p)g=f.next(p+1),y=l[g],l[g]=l[p],l[p]=y,h(y);l.length&&h(l[0])}}return en.exports}var Oa=vu,uu=Vc,fu=Xc,du=Qc,hu=eu,pu=ru,gu=au,gi={};function vu(e){var t=su(),n=lu(),r=oo;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=gi[e.dimensions];if(!o){var i=e.dimensions;o={Body:uu(i,e.debug),createQuadTree:fu(i),createBounds:du(i),createDragForce:hu(i),createSpringForce:pu(i),integrate:gu(i)},gi[i]=o}var a=o.Body,s=o.createQuadTree,l=o.createBounds,c=o.createDragForce,f=o.createSpringForce,u=o.integrate,v=P=>new a(P),h=cu().random(42),p=[],g=[],y=s(e,h),d=l(p,e,h),m=f(e,h),b=c(e),x=0,w=[],_=new Map,k=0;O("nbody",I),O("spring",C);var S={bodies:p,quadTree:y,springs:g,settings:e,addForce:O,removeForce:E,getForces:T,step:function(){for(var P=0;P<w.length;++P)w[P](k);var R=u(p,e.timeStep,e.adaptiveTimeStepWeight);return k+=1,R},addBody:function(P){if(!P)throw new Error("Body is required");return p.push(P),P},addBodyAt:function(P){if(!P)throw new Error("Body position is required");var R=v(P);return p.push(R),R},removeBody:function(P){if(P){var R=p.indexOf(P);if(!(R<0))return p.splice(R,1),p.length===0&&d.reset(),!0}},addSpring:function(P,R,H,V){if(!P||!R)throw new Error("Cannot add null spring to force simulator");typeof H!="number"&&(H=-1);var X=new t(P,R,H,V>=0?V:-1);return g.push(X),X},getTotalMovement:function(){return x},removeSpring:function(P){if(P){var R=g.indexOf(P);if(R>-1)return g.splice(R,1),!0}},getBestNewBodyPosition:function(P){return d.getBestNewPosition(P)},getBBox:A,getBoundingBox:A,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(P){return P!==void 0?(e.gravity=P,y.options({gravity:P}),this):e.gravity},theta:function(P){return P!==void 0?(e.theta=P,y.options({theta:P}),this):e.theta},random:h};return yu(e,S),r(S),S;function A(){return d.update(),d.box}function O(P,R){if(_.has(P))throw new Error("Force "+P+" is already added");_.set(P,R),w.push(R)}function E(P){var R=w.indexOf(_.get(P));R<0||(w.splice(R,1),_.delete(P))}function T(){return _}function I(){if(p.length!==0){y.insertBodies(p);for(var P=p.length;P--;){var R=p[P];R.isPinned||(R.reset(),y.updateBodyForce(R),b.update(R))}}}function C(){for(var P=g.length;P--;)m.update(g[P])}}function yu(e,t){for(var n in e)mu(e,t,n)}function mu(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]}}}io.exports=_u;io.exports.simulator=Oa;var bu=oo;function _u(e,t){if(!e)throw new Error("Graph structure cannot be undefined");var n=t&&t.createSimulator||Oa,r=n(t);if(Array.isArray(t))throw new Error("Physics settings is expected to be an object");var o=e.version>19?I:T;t&&typeof t.nodeMass=="function"&&(o=t.nodeMass);var i=new Map,a={},s=0,l=r.settings.springTransform||xu;b(),y();var c=!1,f={step:function(){if(s===0)return u(!0),!0;var C=r.step();f.lastMove=C,f.fire("step");var P=C/s,R=P<=.01;return u(R),R},getNodePosition:function(C){return E(C).pos},setNodePosition:function(C){var P=E(C);P.setPosition.apply(P,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(C){var P=a[C];if(P)return{from:P.from.pos,to:P.to.pos}},getGraphRect:function(){return r.getBBox()},forEachBody:v,pinNode:function(C,P){var R=E(C.id);R.isPinned=!!P},isNodePinned:function(C){return E(C.id).isPinned},dispose:function(){e.off("changed",m),f.fire("disposed")},getBody:g,getSpring:p,getForceVectorLength:h,simulator:r,graph:e,lastMove:0};return bu(f),f;function u(C){c!==C&&(c=C,d(C))}function v(C){i.forEach(C)}function h(){var C=0,P=0;return v(function(R){C+=Math.abs(R.force.x),P+=Math.abs(R.force.y)}),Math.sqrt(C*C+P*P)}function p(C,P){var R;if(P===void 0)typeof C!="object"?R=C:R=C.id;else{var H=e.hasLink(C,P);if(!H)return;R=H.id}return a[R]}function g(C){return i.get(C)}function y(){e.on("changed",m)}function d(C){f.fire("stable",C)}function m(C){for(var P=0;P<C.length;++P){var R=C[P];R.changeType==="add"?(R.node&&x(R.node.id),R.link&&_(R.link)):R.changeType==="remove"&&(R.node&&w(R.node),R.link&&k(R.link))}s=e.getNodesCount()}function b(){s=0,e.forEachNode(function(C){x(C.id),s+=1}),e.forEachLink(_)}function x(C){var P=i.get(C);if(!P){var R=e.getNode(C);if(!R)throw new Error("initBody() was called with unknown node id");var H=R.position;if(!H){var V=S(R);H=r.getBestNewBodyPosition(V)}P=r.addBodyAt(H),P.id=C,i.set(C,P),A(C),O(R)&&(P.isPinned=!0)}}function w(C){var P=C.id,R=i.get(P);R&&(i.delete(P),r.removeBody(R))}function _(C){A(C.fromId),A(C.toId);var P=i.get(C.fromId),R=i.get(C.toId),H=r.addSpring(P,R,C.length);l(C,H),a[C.id]=H}function k(C){var P=a[C.id];if(P){var R=e.getNode(C.fromId),H=e.getNode(C.toId);R&&A(R.id),H&&A(H.id),delete a[C.id],r.removeSpring(P)}}function S(C){var P=[];if(!C.links)return P;for(var R=Math.min(C.links.length,2),H=0;H<R;++H){var V=C.links[H],X=V.fromId!==C.id?i.get(V.fromId):i.get(V.toId);X&&X.pos&&P.push(X)}return P}function A(C){var P=i.get(C);if(P.mass=o(C),Number.isNaN(P.mass))throw new Error("Node mass should be a number")}function O(C){return C&&(C.isPinned||C.data&&C.data.isPinned)}function E(C){var P=i.get(C);return P||(x(C),P=i.get(C)),P}function T(C){var P=e.getLinks(C);return P?1+P.length/3:1}function I(C){var P=e.getLinks(C);return P?1+P.size/3:1}}function xu(){}var wu=io.exports;const ku=da(wu);function Lr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Cu=typeof global=="object"&&global&&global.Object===Object&&global,Su=typeof self=="object"&&self&&self.Object===Object&&self,Aa=Cu||Su||Function("return this")(),mr=function(){return Aa.Date.now()},Mu=/\s/;function Pu(e){for(var t=e.length;t--&&Mu.test(e.charAt(t)););return t}var Ou=/^\s+/;function Au(e){return e&&e.slice(0,Pu(e)+1).replace(Ou,"")}var zn=Aa.Symbol,ja=Object.prototype,ju=ja.hasOwnProperty,Tu=ja.toString,tn=zn?zn.toStringTag:void 0;function Eu(e){var t=ju.call(e,tn),n=e[tn];try{e[tn]=void 0;var r=!0}catch{}var o=Tu.call(e);return r&&(t?e[tn]=n:delete e[tn]),o}var Lu=Object.prototype,Ru=Lu.toString;function Nu(e){return Ru.call(e)}var Du="[object Null]",zu="[object Undefined]",vi=zn?zn.toStringTag:void 0;function Iu(e){return e==null?e===void 0?zu:Du:vi&&vi in Object(e)?Eu(e):Nu(e)}function Fu(e){return e!=null&&typeof e=="object"}var Bu="[object Symbol]";function $u(e){return typeof e=="symbol"||Fu(e)&&Iu(e)==Bu}var yi=NaN,Hu=/^[-+]0x[0-9a-f]+$/i,Uu=/^0b[01]+$/i,qu=/^0o[0-7]+$/i,Gu=parseInt;function mi(e){if(typeof e=="number")return e;if($u(e))return yi;if(Lr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Lr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Au(e);var n=Uu.test(e);return n||qu.test(e)?Gu(e.slice(2),n?2:8):Hu.test(e)?yi:+e}var Vu="Expected a function",Wu=Math.max,Xu=Math.min;function Yu(e,t,n){var r,o,i,a,s,l,c=0,f=!1,u=!1,v=!0;if(typeof e!="function")throw new TypeError(Vu);t=mi(t)||0,Lr(n)&&(f=!!n.leading,u="maxWait"in n,i=u?Wu(mi(n.maxWait)||0,t):i,v="trailing"in n?!!n.trailing:v);function h(_){var k=r,S=o;return r=o=void 0,c=_,a=e.apply(S,k),a}function p(_){return c=_,s=setTimeout(d,t),f?h(_):a}function g(_){var k=_-l,S=_-c,A=t-k;return u?Xu(A,i-S):A}function y(_){var k=_-l,S=_-c;return l===void 0||k>=t||k<0||u&&S>=i}function d(){var _=mr();if(y(_))return m(_);s=setTimeout(d,g(_))}function m(_){return s=void 0,v&&r?h(_):(r=o=void 0,a)}function b(){s!==void 0&&clearTimeout(s),c=0,r=l=o=s=void 0}function x(){return s===void 0?a:m(mr())}function w(){var _=mr(),k=y(_);if(r=arguments,o=this,l=_,k){if(s===void 0)return p(l);if(u)return clearTimeout(s),s=setTimeout(d,t),h(l)}return s===void 0&&(s=setTimeout(d,t)),a}return w.cancel=b,w.flush=x,w}function bi(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 Ku(e){if(Array.isArray(e))return e}function Qu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zu(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}function Ju(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,o=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function ef(){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 tf(e,t){return Ku(e)||Ju(e,t)||nf(e,t)||ef()}function nf(e,t){if(e){if(typeof e=="string")return bi(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)?bi(e,t):void 0}}var rf=Zu(function e(t,n){var r=n.default,o=r===void 0?null:r,i=n.triggerUpdate,a=i===void 0?!0:i,s=n.onChange,l=s===void 0?function(c,f){}:s;Qu(this,e),this.name=t,this.defaultVal=o,this.triggerUpdate=a,this.onChange=l});function fo(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,s=e.aliases,l=s===void 0?{}:s,c=e.init,f=c===void 0?function(){}:c,u=e.update,v=u===void 0?function(){}:u,h=Object.keys(o).map(function(p){return new rf(p,o[p])});return function p(){for(var g=arguments.length,y=new Array(g),d=0;d<g;d++)y[d]=arguments[d];var m=!!(this instanceof p&&this.constructor),b=m?y.shift():void 0,x=y[0],w=x===void 0?{}:x,_=Object.assign({},n instanceof Function?n(w):n,{initialised:!1}),k={};function S(E){return A(E,w),O(),S}var A=function(T,I){f.call(S,T,_,I),_.initialised=!0},O=Yu(function(){_.initialised&&(v.call(S,_,k),k={})},1);return h.forEach(function(E){S[E.name]=T(E);function T(I){var C=I.name,P=I.triggerUpdate,R=P===void 0?!1:P,H=I.onChange,V=H===void 0?function(D,F){}:H,X=I.defaultVal,oe=X===void 0?null:X;return function(D){var F=_[C];if(!arguments.length)return F;var W=D===void 0?oe:D;return _[C]=W,V.call(S,W,_,F),!k.hasOwnProperty(C)&&(k[C]=F),R&&O(),S}}}),Object.keys(a).forEach(function(E){S[E]=function(){for(var T,I=arguments.length,C=new Array(I),P=0;P<I;P++)C[P]=arguments[P];return(T=a[E]).call.apply(T,[S,_].concat(C))}}),Object.entries(l).forEach(function(E){var T=tf(E,2),I=T[0],C=T[1];return S[I]=S[C]}),S.resetProps=function(){return h.forEach(function(E){S[E.name](E.defaultVal)}),S},S.resetProps(),_._rerender=O,m&&b&&S(b),S}}var le=function(e){return typeof e=="function"?e:typeof e=="string"?function(t){return t[e]}:function(t){return e}};class _i extends Map{constructor(t,n=sf){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(xi(this,t))}has(t){return super.has(xi(this,t))}set(t,n){return super.set(of(this,t),n)}delete(t){return super.delete(af(this,t))}}function xi({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function of({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function af({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function sf(e){return e!==null&&typeof e=="object"?e.valueOf():e}function lf(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 cf(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 Rr(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 uf(e){if(Array.isArray(e))return e}function ff(e){if(Array.isArray(e))return Rr(e)}function Ta(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 df(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function hf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pe(e,t){return e.get(Ta(e,t))}function Tt(e,t,n){df(e,t),t.set(e,n)}function On(e,t,n){return e.set(Ta(e,t),n),n}function pf(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,kf(r.key),r)}}function gf(e,t,n){return t&&pf(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function vf(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function yf(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,o=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function mf(){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 bf(){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 _f(e,t){return uf(e)||yf(e,t)||Ea(e,t)||mf()}function xf(e){return ff(e)||vf(e)||Ea(e)||bf()}function wf(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 kf(e){var t=wf(e,"string");return typeof t=="symbol"?t:t+""}function Ea(e,t){if(e){if(typeof e=="string")return Rr(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)?Rr(e,t):void 0}}var Et=new WeakMap,nn=new WeakMap,Lt=new WeakMap,br=new WeakMap,_r=new WeakMap,xr=new WeakMap,Cf=function(){function e(){hf(this,e),Tt(this,Et,new Map),Tt(this,nn,new Map),Tt(this,Lt,function(t){return t}),Tt(this,br,function(){return{}}),Tt(this,_r,function(){}),Tt(this,xr,function(){})}return gf(e,[{key:"getObj",value:function(n){return Pe(Et,this).get(Pe(Lt,this).call(this,n))}},{key:"getData",value:function(n){return Pe(nn,this).get(n)}},{key:"entries",value:function(){return xf(Pe(nn,this).entries()).map(function(n){var r=_f(n,2),o=r[0],i=r[1];return[i,o]})}},{key:"id",value:function(n){return On(Lt,this,le(n)),this}},{key:"onCreateObj",value:function(n){return On(br,this,n),this}},{key:"onUpdateObj",value:function(n){return On(_r,this,n),this}},{key:"onRemoveObj",value:function(n){return On(xr,this,n),this}},{key:"digest",value:function(n){var r=this;n.filter(function(i){return!Pe(Et,r).has(Pe(Lt,r).call(r,i))}).forEach(function(i){var a=Pe(br,r).call(r,i);Pe(Et,r).set(Pe(Lt,r).call(r,i),a),Pe(nn,r).set(a,i)});var o=new Map(n.map(function(i){return[Pe(Lt,r).call(r,i),i]}));return Pe(Et,this).forEach(function(i,a){o.has(a)?Pe(_r,r).call(r,i,o.get(a)):(Pe(xr,r).call(r,i,a),Pe(Et,r).delete(a),Pe(nn,r).delete(i))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])}();function Sf(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const wi=Symbol("implicit");function La(){var e=new _i,t=[],n=[],r=wi;function o(i){let a=e.get(i);if(a===void 0){if(r!==wi)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 _i;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 La(t,n).unknown(r)},Sf.apply(o,arguments),o}function Mf(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 Pf=Mf("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function In(e){"@babel/helpers - typeof";return In=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},In(e)}var Of=/^\s+/,Af=/\s+$/;function Y(e,t){if(e=e||"",t=t||{},e instanceof Y)return e;if(!(this instanceof Y))return new Y(e,t);var n=jf(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}Y.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,s;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?s=o/12.92:s=Math.pow((o+.055)/1.055,2.4),.2126*i+.7152*a+.0722*s},setAlpha:function(t){return this._a=Ra(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=Ci(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=Ci(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=ki(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=ki(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 Si(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return Rf(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(ge(this._r,255)*100)+"%",g:Math.round(ge(this._g,255)*100)+"%",b:Math.round(ge(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(ge(this._r,255)*100)+"%, "+Math.round(ge(this._g,255)*100)+"%, "+Math.round(ge(this._b,255)*100)+"%)":"rgba("+Math.round(ge(this._r,255)*100)+"%, "+Math.round(ge(this._g,255)*100)+"%, "+Math.round(ge(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Vf[Si(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+Mi(this._r,this._g,this._b,this._a),r=n,o=this._gradientType?"GradientType = 1, ":"";if(t){var i=Y(t);r="#"+Mi(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 Y(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(If,arguments)},brighten:function(){return this._applyModification(Ff,arguments)},darken:function(){return this._applyModification(Bf,arguments)},desaturate:function(){return this._applyModification(Nf,arguments)},saturate:function(){return this._applyModification(Df,arguments)},greyscale:function(){return this._applyModification(zf,arguments)},spin:function(){return this._applyModification($f,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(qf,arguments)},complement:function(){return this._applyCombination(Hf,arguments)},monochromatic:function(){return this._applyCombination(Gf,arguments)},splitcomplement:function(){return this._applyCombination(Uf,arguments)},triad:function(){return this._applyCombination(Pi,[3])},tetrad:function(){return this._applyCombination(Pi,[4])}};Y.fromRatio=function(e,t){if(In(e)=="object"){var n={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?n[r]=e[r]:n[r]=cn(e[r]));e=n}return Y(e,t)};function jf(e){var t={r:0,g:0,b:0},n=1,r=null,o=null,i=null,a=!1,s=!1;return typeof e=="string"&&(e=Kf(e)),In(e)=="object"&&(it(e.r)&&it(e.g)&&it(e.b)?(t=Tf(e.r,e.g,e.b),a=!0,s=String(e.r).substr(-1)==="%"?"prgb":"rgb"):it(e.h)&&it(e.s)&&it(e.v)?(r=cn(e.s),o=cn(e.v),t=Lf(e.h,r,o),a=!0,s="hsv"):it(e.h)&&it(e.s)&&it(e.l)&&(r=cn(e.s),i=cn(e.l),t=Ef(e.h,r,i),a=!0,s="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=Ra(n),{ok:a,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function Tf(e,t,n){return{r:ge(e,255)*255,g:ge(t,255)*255,b:ge(n,255)*255}}function ki(e,t,n){e=ge(e,255),t=ge(t,255),n=ge(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),i,a,s=(r+o)/2;if(r==o)i=a=0;else{var l=r-o;switch(a=s>.5?l/(2-r-o):l/(r+o),r){case e:i=(t-n)/l+(t<n?6:0);break;case t:i=(n-e)/l+2;break;case n:i=(e-t)/l+4;break}i/=6}return{h:i,s:a,l:s}}function Ef(e,t,n){var r,o,i;e=ge(e,360),t=ge(t,100),n=ge(n,100);function a(c,f,u){return u<0&&(u+=1),u>1&&(u-=1),u<1/6?c+(f-c)*6*u:u<1/2?f:u<2/3?c+(f-c)*(2/3-u)*6:c}if(t===0)r=o=i=n;else{var s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;r=a(l,s,e+1/3),o=a(l,s,e),i=a(l,s,e-1/3)}return{r:r*255,g:o*255,b:i*255}}function Ci(e,t,n){e=ge(e,255),t=ge(t,255),n=ge(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),i,a,s=r,l=r-o;if(a=r===0?0:l/r,r==o)i=0;else{switch(r){case e:i=(t-n)/l+(t<n?6:0);break;case t:i=(n-e)/l+2;break;case n:i=(e-t)/l+4;break}i/=6}return{h:i,s:a,v:s}}function Lf(e,t,n){e=ge(e,360)*6,t=ge(t,100),n=ge(n,100);var r=Math.floor(e),o=e-r,i=n*(1-t),a=n*(1-o*t),s=n*(1-(1-o)*t),l=r%6,c=[n,a,i,i,s,n][l],f=[s,n,n,a,i,i][l],u=[i,i,s,n,n,a][l];return{r:c*255,g:f*255,b:u*255}}function Si(e,t,n,r){var o=[Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(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 Rf(e,t,n,r,o){var i=[Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16)),Ye(Na(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 Mi(e,t,n,r){var o=[Ye(Na(r)),Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16))];return o.join("")}Y.equals=function(e,t){return!e||!t?!1:Y(e).toRgbString()==Y(t).toRgbString()};Y.random=function(){return Y.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Nf(e,t){t=t===0?0:t||10;var n=Y(e).toHsl();return n.s-=t/100,n.s=Xn(n.s),Y(n)}function Df(e,t){t=t===0?0:t||10;var n=Y(e).toHsl();return n.s+=t/100,n.s=Xn(n.s),Y(n)}function zf(e){return Y(e).desaturate(100)}function If(e,t){t=t===0?0:t||10;var n=Y(e).toHsl();return n.l+=t/100,n.l=Xn(n.l),Y(n)}function Ff(e,t){t=t===0?0:t||10;var n=Y(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)))),Y(n)}function Bf(e,t){t=t===0?0:t||10;var n=Y(e).toHsl();return n.l-=t/100,n.l=Xn(n.l),Y(n)}function $f(e,t){var n=Y(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,Y(n)}function Hf(e){var t=Y(e).toHsl();return t.h=(t.h+180)%360,Y(t)}function Pi(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=Y(e).toHsl(),r=[Y(e)],o=360/t,i=1;i<t;i++)r.push(Y({h:(n.h+i*o)%360,s:n.s,l:n.l}));return r}function Uf(e){var t=Y(e).toHsl(),n=t.h;return[Y(e),Y({h:(n+72)%360,s:t.s,l:t.l}),Y({h:(n+216)%360,s:t.s,l:t.l})]}function qf(e,t,n){t=t||6,n=n||30;var r=Y(e).toHsl(),o=360/n,i=[Y(e)];for(r.h=(r.h-(o*t>>1)+720)%360;--t;)r.h=(r.h+o)%360,i.push(Y(r));return i}function Gf(e,t){t=t||6;for(var n=Y(e).toHsv(),r=n.h,o=n.s,i=n.v,a=[],s=1/t;t--;)a.push(Y({h:r,s:o,v:i})),i=(i+s)%1;return a}Y.mix=function(e,t,n){n=n===0?0:n||50;var r=Y(e).toRgb(),o=Y(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 Y(a)};Y.readability=function(e,t){var n=Y(e),r=Y(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)};Y.isReadable=function(e,t,n){var r=Y.readability(e,t),o,i;switch(i=!1,o=Qf(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};Y.mostReadable=function(e,t,n){var r=null,o=0,i,a,s,l;n=n||{},a=n.includeFallbackColors,s=n.level,l=n.size;for(var c=0;c<t.length;c++)i=Y.readability(e,t[c]),i>o&&(o=i,r=Y(t[c]));return Y.isReadable(e,r,{level:s,size:l})||!a?r:(n.includeFallbackColors=!1,Y.mostReadable(e,["#fff","#000"],n))};var Nr=Y.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"},Vf=Y.hexNames=Wf(Nr);function Wf(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function Ra(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function ge(e,t){Xf(e)&&(e="100%");var n=Yf(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 Xn(e){return Math.min(1,Math.max(0,e))}function Ie(e){return parseInt(e,16)}function Xf(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function Yf(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Ye(e){return e.length==1?"0"+e:""+e}function cn(e){return e<=1&&(e=e*100+"%"),e}function Na(e){return Math.round(parseFloat(e)*255).toString(16)}function Oi(e){return Ie(e)/255}var We=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",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 it(e){return!!We.CSS_UNIT.exec(e)}function Kf(e){e=e.replace(Of,"").replace(Af,"").toLowerCase();var t=!1;if(Nr[e])e=Nr[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=We.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=We.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=We.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=We.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=We.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=We.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=We.hex8.exec(e))?{r:Ie(n[1]),g:Ie(n[2]),b:Ie(n[3]),a:Oi(n[4]),format:t?"name":"hex8"}:(n=We.hex6.exec(e))?{r:Ie(n[1]),g:Ie(n[2]),b:Ie(n[3]),format:t?"name":"hex"}:(n=We.hex4.exec(e))?{r:Ie(n[1]+""+n[1]),g:Ie(n[2]+""+n[2]),b:Ie(n[3]+""+n[3]),a:Oi(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=We.hex3.exec(e))?{r:Ie(n[1]+""+n[1]),g:Ie(n[2]+""+n[2]),b:Ie(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function Qf(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 Dr(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 Zf(e){if(Array.isArray(e))return e}function Jf(e){if(Array.isArray(e))return Dr(e)}function Da(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 ed(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=$t(t),ld(e,ho()?Reflect.construct(t,n||[],$t(e).constructor):t.apply(e,n))}function td(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ia(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wr(e,t){return e.get(Da(e,t))}function Ai(e,t,n){td(e,t),t.set(e,n)}function ji(e,t,n){return e.set(Da(e,t),n),n}function Fa(e,t,n){if(ho())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 nd(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,Ha(r.key),r)}}function Ba(e,t,n){return t&&nd(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yn(e,t,n){return(t=Ha(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zr(){return zr=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=cd(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},zr.apply(null,arguments)}function $t(e){return $t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$t(e)}function $a(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&&Ir(e,t)}function ho(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ho=function(){return!!e})()}function rd(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function od(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,o=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function id(){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 ad(){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 Ti(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 sd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ti(Object(n),!0).forEach(function(r){Yn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ti(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ld(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 ed(e)}function Ir(e,t){return Ir=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ir(e,t)}function fn(e,t){return Zf(e)||od(e,t)||Ua(e,t)||id()}function cd(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=$t(e))!==null;);return e}function kr(e,t,n,r){var o=zr($t(e.prototype),t,n);return typeof o=="function"?function(i){return o.apply(n,i)}:o}function Xe(e){return Jf(e)||rd(e)||Ua(e)||ad()}function ud(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 Ha(e){var t=ud(e,"string");return typeof t=="symbol"?t:t+""}function Fr(e){"@babel/helpers - typeof";return Fr=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},Fr(e)}function Ua(e,t){if(e){if(typeof e=="string")return Dr(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)?Dr(e,t):void 0}}var qa=function(t){t instanceof Array?t.forEach(qa):(t.map&&t.map.dispose(),t.dispose())},po=function(t){t.geometry&&t.geometry.dispose(),t.material&&qa(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(po)},Ei=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),po(n)}},Cr=new WeakMap,An=new WeakMap,rn=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,s=o.objBindAttr,l=s===void 0?"__threeObj":s;return Ia(this,t),r=za(this,t),Yn(r,"scene",void 0),Ai(r,Cr,void 0),Ai(r,An,void 0),r.scene=n,ji(Cr,r,a),ji(An,r,l),r.onRemoveObj(function(){}),r}return $a(t,e),Ba(t,[{key:"onCreateObj",value:function(r){var o=this;return kr(t,"onCreateObj",this)([function(i){var a=r(i);return i[wr(An,o)]=a,a[wr(Cr,o)]=i,o.scene.add(a),a}]),this}},{key:"onRemoveObj",value:function(r){var o=this;return kr(t,"onRemoveObj",this)([function(i,a){var s=kr(t,"getData",o)([i]);r(i,a),o.scene.remove(i),po(i),delete s[wr(An,o)]}]),this}}])}(Cf),on=function(t){return isNaN(t)?parseInt(Y(t).toHex(),16):t},Sr=function(t){return isNaN(t)?Y(t).getAlpha():1},fd=La(Pf);function Li(e,t,n){!t||typeof n!="string"||e.filter(function(r){return!r[n]}).forEach(function(r){r[n]=fd(t(r))})}function dd(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,s=o.onLoopError,l=s===void 0?function(h){throw"Invalid DAG structure! Found cycle in node path: ".concat(h.join(" -> "),".")}:s,c={};n.forEach(function(h){return c[t(h)]={data:h,out:[],depth:-1,skip:!a(h)}}),r.forEach(function(h){var p=h.source,g=h.target,y=x(p),d=x(g);if(!c.hasOwnProperty(y))throw"Missing source node with id: ".concat(y);if(!c.hasOwnProperty(d))throw"Missing target node with id: ".concat(d);var m=c[y],b=c[d];m.out.push(b);function x(w){return Fr(w)==="object"?t(w):w}});var f=[];v(Object.values(c));var u=Object.assign.apply(Object,[{}].concat(Xe(Object.entries(c).filter(function(h){var p=fn(h,2),g=p[1];return!g.skip}).map(function(h){var p=fn(h,2),g=p[0],y=p[1];return Yn({},g,y.depth)}))));return u;function v(h){for(var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,y=function(){var x=h[d];if(p.indexOf(x)!==-1){var w=[].concat(Xe(p.slice(p.indexOf(x))),[x]).map(function(_){return t(_.data)});return f.some(function(_){return _.length===w.length&&_.every(function(k,S){return k===w[S]})})||(f.push(w),l(w)),1}g>x.depth&&(x.depth=g,v(x.out,[].concat(Xe(p),[x]),g+(x.skip?0:1)))},d=0,m=h.length;d<m;d++)y()}}var J=window.THREE?window.THREE:{Group:Z.Group,Mesh:Z.Mesh,MeshLambertMaterial:Z.MeshLambertMaterial,Color:Z.Color,BufferGeometry:Z.BufferGeometry,BufferAttribute:Z.BufferAttribute,Matrix4:Z.Matrix4,Vector3:Z.Vector3,SphereGeometry:Z.SphereGeometry,CylinderGeometry:Z.CylinderGeometry,TubeGeometry:Z.TubeGeometry,ConeGeometry:Z.ConeGeometry,Line:Z.Line,LineBasicMaterial:Z.LineBasicMaterial,QuadraticBezierCurve3:Z.QuadraticBezierCurve3,CubicBezierCurve3:Z.CubicBezierCurve3,Box3:Z.Box3},Ri={graph:Hc,forcelayout:ku},hd=2,Mr=new J.BufferGeometry().setAttribute?"setAttribute":"addAttribute",jn=new J.BufferGeometry().applyMatrix4?"applyMatrix4":"applyMatrix",pd=fo({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(s){delete s[a],delete s["v".concat(a)]})}}},dagMode:{onChange:function(t,n){!t&&n.forceEngine==="d3"&&(n.graphData.nodes||[]).forEach(function(r){return r.fx=r.fy=r.fz=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(t){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},nodePositionUpdate:{triggerUpdate:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},linkDirectionalParticleThreeObject:{},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaDecay(t)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaTarget(t)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.velocityDecay(t)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(t){return t._flushObjects=!0,t._rerender(),this},d3Force:function(t,n,r){return r===void 0?t.d3ForceLayout.force(n):(t.d3ForceLayout.force(n,r),this)},d3ReheatSimulation:function(t){return t.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(t){return t.cntTicks=0,t.startTickTime=new Date,t.engineRunning=!0,this},tickFrame:function(t){var n=t.forceEngine!=="ngraph";return t.engineRunning&&r(),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=le(t.nodeThreeObjectExtend);t.nodeDataMapper.entries().forEach(function(v){var h=fn(v,2),p=h[0],g=h[1];if(g){var y=n?p:t.layout.getNodePosition(p[t.nodeId]),d=a(p);(!t.nodePositionUpdate||!t.nodePositionUpdate(d?g.children[0]:g,{x:y.x,y:y.y,z:y.z},p)||d)&&(g.position.x=y.x,g.position.y=y.y||0,g.position.z=y.z||0)}});var s=le(t.linkWidth),l=le(t.linkCurvature),c=le(t.linkCurveRotation),f=le(t.linkThreeObjectExtend);t.linkDataMapper.entries().forEach(function(v){var h=fn(v,2),p=h[0],g=h[1];if(g){var y=n?p:t.layout.getLinkPosition(t.layout.graph.getLink(p.source,p.target).id),d=y[n?"source":"from"],m=y[n?"target":"to"];if(!(!d||!m||!d.hasOwnProperty("x")||!m.hasOwnProperty("x"))){u(p);var b=f(p);if(!(t.linkPositionUpdate&&t.linkPositionUpdate(b?g.children[1]:g,{start:{x:d.x,y:d.y,z:d.z},end:{x:m.x,y:m.y,z:m.z}},p)&&!b)){var x=30,w=p.__curve,_=g.children.length?g.children[0]:g;if(_.type==="Line"){if(w){var S=w.getPoints(x);_.geometry.getAttribute("position").array.length!==S.length*3&&_.geometry[Mr]("position",new J.BufferAttribute(new Float32Array(S.length*3),3)),_.geometry.setFromPoints(S)}else{var k=_.geometry.getAttribute("position");(!k||!k.array||k.array.length!==6)&&_.geometry[Mr]("position",k=new J.BufferAttribute(new Float32Array(2*3),3)),k.array[0]=d.x,k.array[1]=d.y||0,k.array[2]=d.z||0,k.array[3]=m.x,k.array[4]=m.y||0,k.array[5]=m.z||0,k.needsUpdate=!0}_.geometry.computeBoundingSphere()}else if(_.type==="Mesh")if(w){_.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(_.position.set(0,0,0),_.rotation.set(0,0,0),_.scale.set(1,1,1));var P=Math.ceil(s(p)*10)/10,R=P/2,H=new J.TubeGeometry(w,x,R,t.linkResolution,!1);_.geometry.dispose(),_.geometry=H}else{if(!_.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var A=Math.ceil(s(p)*10)/10,O=A/2,E=new J.CylinderGeometry(O,O,1,t.linkResolution,1,!1);E[jn](new J.Matrix4().makeTranslation(0,1/2,0)),E[jn](new J.Matrix4().makeRotationX(Math.PI/2)),_.geometry.dispose(),_.geometry=E}var T=new J.Vector3(d.x,d.y||0,d.z||0),I=new J.Vector3(m.x,m.y||0,m.z||0),C=T.distanceTo(I);_.position.x=T.x,_.position.y=T.y,_.position.z=T.z,_.scale.z=C,_.parent.localToWorld(I),_.lookAt(I)}}}}});function u(v){var h=n?v:t.layout.getLinkPosition(t.layout.graph.getLink(v.source,v.target).id),p=h[n?"source":"from"],g=h[n?"target":"to"];if(!(!p||!g||!p.hasOwnProperty("x")||!g.hasOwnProperty("x"))){var y=l(v);if(!y)v.__curve=null;else{var d=new J.Vector3(p.x,p.y||0,p.z||0),m=new J.Vector3(g.x,g.y||0,g.z||0),b=d.distanceTo(m),x,w=c(v);if(b>0){var _=g.x-p.x,k=g.y-p.y||0,S=new J.Vector3().subVectors(m,d),A=S.clone().multiplyScalar(y).cross(_!==0||k!==0?new J.Vector3(0,0,1):new J.Vector3(0,1,0)).applyAxisAngle(S.normalize(),w).add(new J.Vector3().addVectors(d,m).divideScalar(2));x=new J.QuadraticBezierCurve3(d,A,m)}else{var O=y*70,E=-w,T=E+Math.PI/2;x=new J.CubicBezierCurve3(d,new J.Vector3(O*Math.cos(T),O*Math.sin(T),0).add(d),new J.Vector3(O*Math.cos(E),O*Math.sin(E),0).add(d),m)}v.__curve=x}}}}function o(){var a=le(t.linkDirectionalArrowRelPos),s=le(t.linkDirectionalArrowLength),l=le(t.nodeVal);t.arrowDataMapper.entries().forEach(function(c){var f=fn(c,2),u=f[0],v=f[1];if(v){var h=n?u:t.layout.getLinkPosition(t.layout.graph.getLink(u.source,u.target).id),p=h[n?"source":"from"],g=h[n?"target":"to"];if(!(!p||!g||!p.hasOwnProperty("x")||!g.hasOwnProperty("x"))){var y=Math.cbrt(Math.max(0,l(p)||1))*t.nodeRelSize,d=Math.cbrt(Math.max(0,l(g)||1))*t.nodeRelSize,m=s(u),b=a(u),x=u.__curve?function(O){return u.__curve.getPoint(O)}:function(O){var E=function(I,C,P,R){return C[I]+(P[I]-C[I])*R||0};return{x:E("x",p,g,O),y:E("y",p,g,O),z:E("z",p,g,O)}},w=u.__curve?u.__curve.getLength():Math.sqrt(["x","y","z"].map(function(O){return Math.pow((g[O]||0)-(p[O]||0),2)}).reduce(function(O,E){return O+E},0)),_=y+m+(w-y-d-m)*b,k=x(_/w),S=x((_-m)/w);["x","y","z"].forEach(function(O){return v.position[O]=S[O]});var A=Fa(J.Vector3,Xe(["x","y","z"].map(function(O){return k[O]})));v.parent.localToWorld(A),v.lookAt(A)}}})}function i(){var a=le(t.linkDirectionalParticleSpeed),s=le(t.linkDirectionalParticleOffset);t.graphData.links.forEach(function(l){var c=t.particlesDataMapper.getObj(l),f=c&&c.children,u=l.__singleHopPhotonsObj&&l.__singleHopPhotonsObj.children;if(!((!u||!u.length)&&(!f||!f.length))){var v=n?l:t.layout.getLinkPosition(t.layout.graph.getLink(l.source,l.target).id),h=v[n?"source":"from"],p=v[n?"target":"to"];if(!(!h||!p||!h.hasOwnProperty("x")||!p.hasOwnProperty("x"))){var g=a(l),y=Math.abs(s(l)),d=l.__curve?function(b){return l.__curve.getPoint(b)}:function(b){var x=function(_,k,S,A){return k[_]+(S[_]-k[_])*A||0};return{x:x("x",h,p,b),y:x("y",h,p,b),z:x("z",h,p,b)}},m=[].concat(Xe(f||[]),Xe(u||[]));m.forEach(function(b,x){var w=b.parent.__linkThreeObjType==="singleHopPhotons";if(b.hasOwnProperty("__progressRatio")||(b.__progressRatio=w?g<0?1:0:(x+y)/f.length),b.__progressRatio+=g,b.__progressRatio>=1||b.__progressRatio<0)if(!w)b.__progressRatio=b.__progressRatio%1,b.__progressRatio<0&&b.__progressRatio++;else{b.parent.remove(b),Ei(b);return}var _=b.__progressRatio,k=d(_);b.geometry.type!=="SphereGeometry"&&b.lookAt(k.x,k.y,k.z),["x","y","z"].forEach(function(S){return b.position[S]=k[S]})})}}})}},emitParticle:function(t,n){if(n&&t.graphData.links.includes(n)){if(!n.__singleHopPhotonsObj){var r=new J.Group;r.__linkThreeObjType="singleHopPhotons",n.__singleHopPhotonsObj=r,t.graphScene.add(r)}var o=le(t.linkDirectionalParticleThreeObject)(n);if(o&&t.linkDirectionalParticleThreeObject===o&&(o=o.clone()),!o){var i=le(t.linkDirectionalParticleWidth),a=Math.ceil(i(n)*10)/10/2,s=t.linkDirectionalParticleResolution,l=new J.SphereGeometry(a,s,s),c=le(t.linkColor),f=le(t.linkDirectionalParticleColor),u=f(n)||c(n)||"#f0f0f0",v=new J.Color(on(u)),h=t.linkOpacity*3,p=new J.MeshLambertMaterial({color:v,transparent:!0,opacity:h});o=new J.Mesh(l,p)}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 s=new J.Box3;s.copy(i.geometry.boundingBox).applyMatrix4(i.matrixWorld),a.push(s)}return a.concat.apply(a,Xe((i.children||[]).filter(function(l){return!l.hasOwnProperty("__graphObjType")||l.__graphObjType==="node"&&n(l.__data)}).map(o)))}(t.graphScene);return r.length?Object.assign.apply(Object,Xe(["x","y","z"].map(function(o){return Yn({},o,[cf(r,function(i){return i.min[o]}),lf(r,function(i){return i.max[o]})])}))):null}},stateInit:function(){return{d3ForceLayout:Nc().force("link",_c()).force("charge",Dc()).force("center",xl()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(t,n){n.graphScene=t,n.nodeDataMapper=new rn(t,{objBindAttr:"__threeObj"}),n.linkDataMapper=new rn(t,{objBindAttr:"__lineObj"}),n.arrowDataMapper=new rn(t,{objBindAttr:"__arrowObj"}),n.particlesDataMapper=new rn(t,{objBindAttr:"__photonsObj"})},update:function(t,n){var r=function(U){return U.some(function(z){return n.hasOwnProperty(z)})};if(t.engineRunning=!1,typeof t.onUpdate=="function"&&t.onUpdate(),t.nodeAutoColorBy!==null&&r(["nodeAutoColorBy","graphData","nodeColor"])&&Li(t.graphData.nodes,le(t.nodeAutoColorBy),t.nodeColor),t.linkAutoColorBy!==null&&r(["linkAutoColorBy","graphData","linkColor"])&&Li(t.graphData.links,le(t.linkAutoColorBy),t.linkColor),t._flushObjects||r(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var o=le(t.nodeThreeObject),i=le(t.nodeThreeObjectExtend),a=le(t.nodeVal),s=le(t.nodeColor),l=le(t.nodeVisibility),c={},f={};(t._flushObjects||r(["nodeThreeObject","nodeThreeObjectExtend"]))&&t.nodeDataMapper.clear(),t.nodeDataMapper.onCreateObj(function(N){var U=o(N),z=i(N);U&&t.nodeThreeObject===U&&(U=U.clone());var G;return U&&!z?G=U:(G=new J.Mesh,G.__graphDefaultObj=!0,U&&z&&G.add(U)),G.__graphObjType="node",G}).onUpdateObj(function(N,U){if(N.__graphDefaultObj){var z=a(U)||1,G=Math.cbrt(z)*t.nodeRelSize,q=t.nodeResolution;(!N.geometry.type.match(/^Sphere(Buffer)?Geometry$/)||N.geometry.parameters.radius!==G||N.geometry.parameters.widthSegments!==q)&&(c.hasOwnProperty(z)||(c[z]=new J.SphereGeometry(G,q,q)),N.geometry.dispose(),N.geometry=c[z]);var $=s(U),B=new J.Color(on($||"#ffffaa")),te=t.nodeOpacity*Sr($);(N.material.type!=="MeshLambertMaterial"||!N.material.color.equals(B)||N.material.opacity!==te)&&(f.hasOwnProperty($)||(f[$]=new J.MeshLambertMaterial({color:B,transparent:!0,opacity:te})),N.material.dispose(),N.material=f[$])}}).digest(t.graphData.nodes.filter(l))}if(t._flushObjects||r(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject"])){var u=le(t.linkThreeObject),v=le(t.linkThreeObjectExtend),h=le(t.linkMaterial),p=le(t.linkVisibility),g=le(t.linkColor),y=le(t.linkWidth),d={},m={},b={},x=t.graphData.links.filter(p);if((t._flushObjects||r(["linkThreeObject","linkThreeObjectExtend","linkWidth"]))&&t.linkDataMapper.clear(),t.linkDataMapper.onRemoveObj(function(N){var U=N.__data&&N.__data.__singleHopPhotonsObj;U&&(U.parent.remove(U),Ei(U),delete N.__data.__singleHopPhotonsObj)}).onCreateObj(function(N){var U=u(N),z=v(N);U&&t.linkThreeObject===U&&(U=U.clone());var G;if(!U||z){var q=!!y(N);if(q)G=new J.Mesh;else{var $=new J.BufferGeometry;$[Mr]("position",new J.BufferAttribute(new Float32Array(2*3),3)),G=new J.Line($)}}var B;return U?z?(B=new J.Group,B.__graphDefaultObj=!0,B.add(G),B.add(U)):B=U:(B=G,B.__graphDefaultObj=!0),B.renderOrder=10,B.__graphObjType="link",B}).onUpdateObj(function(N,U){if(N.__graphDefaultObj){var z=N.children.length?N.children[0]:N,G=Math.ceil(y(U)*10)/10,q=!!G;if(q){var $=G/2,B=t.linkResolution;if(!z.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||z.geometry.parameters.radiusTop!==$||z.geometry.parameters.radialSegments!==B){if(!d.hasOwnProperty(G)){var te=new J.CylinderGeometry($,$,1,B,1,!1);te[jn](new J.Matrix4().makeTranslation(0,1/2,0)),te[jn](new J.Matrix4().makeRotationX(Math.PI/2)),d[G]=te}z.geometry.dispose(),z.geometry=d[G]}}var ae=h(U);if(ae)z.material=ae;else{var ce=g(U),ye=new J.Color(on(ce||"#f0f0f0")),fe=t.linkOpacity*Sr(ce),Te=q?"MeshLambertMaterial":"LineBasicMaterial";if(z.material.type!==Te||!z.material.color.equals(ye)||z.material.opacity!==fe){var Be=q?m:b;Be.hasOwnProperty(ce)||(Be[ce]=new J[Te]({color:ye,transparent:fe<1,opacity:fe,depthWrite:fe>=1})),z.material.dispose(),z.material=Be[ce]}}}}).digest(x),t.linkDirectionalArrowLength||n.hasOwnProperty("linkDirectionalArrowLength")){var w=le(t.linkDirectionalArrowLength),_=le(t.linkDirectionalArrowColor);t.arrowDataMapper.onCreateObj(function(){var N=new J.Mesh(void 0,new J.MeshLambertMaterial({transparent:!0}));return N.__linkThreeObjType="arrow",N}).onUpdateObj(function(N,U){var z=w(U),G=t.linkDirectionalArrowResolution;if(!N.geometry.type.match(/^Cone(Buffer)?Geometry$/)||N.geometry.parameters.height!==z||N.geometry.parameters.radialSegments!==G){var q=new J.ConeGeometry(z*.25,z,G);q.translate(0,z/2,0),q.rotateX(Math.PI/2),N.geometry.dispose(),N.geometry=q}var $=_(U)||g(U)||"#f0f0f0";N.material.color=new J.Color(on($)),N.material.opacity=t.linkOpacity*3*Sr($)}).digest(x.filter(w))}if(t.linkDirectionalParticles||n.hasOwnProperty("linkDirectionalParticles")){var k=le(t.linkDirectionalParticles),S=le(t.linkDirectionalParticleWidth),A=le(t.linkDirectionalParticleColor),O=le(t.linkDirectionalParticleThreeObject),E={},T={};t.particlesDataMapper.onCreateObj(function(){var N=new J.Group;return N.__linkThreeObjType="photons",N.__photonDataMapper=new rn(N),N}).onUpdateObj(function(N,U){var z=!!N.children.length&&N.children[0],G=O(U),q,$;if(G)q=G.geometry,$=G.material;else{var B=Math.ceil(S(U)*10)/10/2,te=t.linkDirectionalParticleResolution;z&&z.geometry.parameters.radius===B&&z.geometry.parameters.widthSegments===te?q=z.geometry:(T.hasOwnProperty(B)||(T[B]=new J.SphereGeometry(B,te,te)),q=T[B]);var ae=A(U)||g(U)||"#f0f0f0",ce=new J.Color(on(ae)),ye=t.linkOpacity*3;z&&z.material.color.equals(ce)&&z.material.opacity===ye?$=z.material:(E.hasOwnProperty(ae)||(E[ae]=new J.MeshLambertMaterial({color:ce,transparent:!0,opacity:ye})),$=E[ae])}z&&(z.geometry!==q&&z.geometry.dispose(),z.material!==$&&z.material.dispose());var fe=Math.round(Math.abs(k(U)));N.__photonDataMapper.id(function(Te){return Te.idx}).onCreateObj(function(){return new J.Mesh(q,$)}).onUpdateObj(function(Te){Te.geometry=q,Te.material=$}).digest(Xe(new Array(fe)).map(function(Te,Be){return{idx:Be}}))}).digest(x.filter(k))}}if(t._flushObjects=!1,r(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach(function(N){N.source=N[t.linkSource],N.target=N[t.linkTarget]});var I=t.forceEngine!=="ngraph",C;if(I){(C=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var P=t.d3ForceLayout.force("link");P&&P.id(function(N){return N[t.nodeId]}).links(t.graphData.links);var R=t.dagMode&&dd(t.graphData,function(N){return N[t.nodeId]},{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),H=Math.max.apply(Math,Xe(Object.values(R||[]))),V=t.dagLevelDistance||t.graphData.nodes.length/(H||1)*hd*(["radialin","radialout"].indexOf(t.dagMode)!==-1?.7:1);if(["lr","rl","td","bu","zin","zout"].includes(n.dagMode)){var X=["lr","rl"].includes(n.dagMode)?"fx":["td","bu"].includes(n.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(N){return delete N[X]})}if(["lr","rl","td","bu","zin","zout"].includes(t.dagMode)){var oe=["rl","td","zout"].includes(t.dagMode),D=function(U){return(R[U[t.nodeId]]-H/2)*V*(oe?-1:1)},F=["lr","rl"].includes(t.dagMode)?"fx":["td","bu"].includes(t.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(N){return N[F]=D(N)})}t.d3ForceLayout.force("dagRadial",["radialin","radialout"].indexOf(t.dagMode)!==-1?zc(function(N){var U=R[N[t.nodeId]]||-1;return(t.dagMode==="radialin"?H-U:U)*V}).strength(function(N){return t.dagNodeFilter(N)?1:0}):null)}else{var W=Ri.graph();t.graphData.nodes.forEach(function(N){W.addNode(N[t.nodeId])}),t.graphData.links.forEach(function(N){W.addLink(N.source,N.target)}),C=Ri.forcelayout(W,sd({dimensions:t.numDimensions},t.ngraphPhysics)),C.graph=W}for(var Q=0;Q<t.warmupTicks&&!(I&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);Q++)C[I?"tick":"step"]();t.layout=C,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}});function gd(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;Ia(this,i);for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return a=za(this,i,[].concat(l)),a.__kapsuleInstance=Fa(e,[].concat(Xe(n?[a]:[]),l)),a}return $a(i,o),Ba(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 vd=window.THREE?window.THREE:{Group:Z.Group},Ga=gd(pd,vd.Group,!0);function Ne(){return Ne=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},Ne.apply(null,arguments)}function yd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gn(e,t){return gn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},gn(e,t)}function md(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,gn(e,t)}function Br(e){return Br=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Br(e)}function bd(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function Va(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Va=function(){return!!e})()}function _d(e,t,n){if(Va())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&gn(o,n.prototype),o}function $r(e){var t=typeof Map=="function"?new Map:void 0;return $r=function(r){if(r===null||!bd(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 _d(r,arguments,Br(this).constructor)}return o.prototype=Object.create(r.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),gn(o,r)},$r(e)}var xd={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
|
|
508
508
|
|
|
509
509
|
`,2:`Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).
|
|
510
510
|
|
|
@@ -652,8 +652,8 @@ To pass a single animation please supply them in simple values, e.g. animation('
|
|
|
652
652
|
`,77:`remToPx expects a value in "rem" but you provided it in "%s".
|
|
653
653
|
|
|
654
654
|
`,78:`base must be set in "px" or "%" but you set it in "%s".
|
|
655
|
-
`};function ud(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t[0],i=[],o;for(o=1;o<t.length;o+=1)i.push(t[o]);return i.forEach(function(a){r=r.replace(/%[a-z]/,a)}),r}var Qe=function(e){ad(t,e);function t(n){var r;if(process.env.NODE_ENV==="production")r=e.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+n+" for more information.")||this;else{for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];r=e.call(this,ud.apply(void 0,[cd[n]].concat(o)))||this}return od(r)}return t}(Lr(Error));function br(e){return Math.round(e*255)}function fd(e,t,n){return br(e)+","+br(t)+","+br(n)}function Ln(e,t,n,r){if(r===void 0&&(r=fd),t===0)return r(n,n,n);var i=(e%360+360)%360/60,o=(1-Math.abs(2*n-1))*t,a=o*(1-Math.abs(i%2-1)),s=0,l=0,c=0;i>=0&&i<1?(s=o,l=a):i>=1&&i<2?(s=a,l=o):i>=2&&i<3?(l=o,c=a):i>=3&&i<4?(l=a,c=o):i>=4&&i<5?(s=a,c=o):i>=5&&i<6&&(s=o,c=a);var f=n-o/2,u=s+f,g=l+f,h=c+f;return r(u,g,h)}var Ao={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function dd(e){if(typeof e!="string")return e;var t=e.toLowerCase();return Ao[t]?"#"+Ao[t]:e}var hd=/^#[a-fA-F0-9]{6}$/,pd=/^#[a-fA-F0-9]{8}$/,gd=/^#[a-fA-F0-9]{3}$/,vd=/^#[a-fA-F0-9]{4}$/,_r=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,yd=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,md=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,bd=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function Rt(e){if(typeof e!="string")throw new Qe(3);var t=dd(e);if(t.match(hd))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(pd)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(gd))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(vd)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var i=_r.exec(t);if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10)};var o=yd.exec(t.substring(0,50));if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10),alpha:parseFloat(""+o[4])>1?parseFloat(""+o[4])/100:parseFloat(""+o[4])};var a=md.exec(t);if(a){var s=parseInt(""+a[1],10),l=parseInt(""+a[2],10)/100,c=parseInt(""+a[3],10)/100,f="rgb("+Ln(s,l,c)+")",u=_r.exec(f);if(!u)throw new Qe(4,t,f);return{red:parseInt(""+u[1],10),green:parseInt(""+u[2],10),blue:parseInt(""+u[3],10)}}var g=bd.exec(t.substring(0,50));if(g){var h=parseInt(""+g[1],10),p=parseInt(""+g[2],10)/100,v=parseInt(""+g[3],10)/100,y="rgb("+Ln(h,p,v)+")",d=_r.exec(y);if(!d)throw new Qe(4,t,y);return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10),alpha:parseFloat(""+g[4])>1?parseFloat(""+g[4])/100:parseFloat(""+g[4])}}throw new Qe(5)}function _d(e){var t=e.red/255,n=e.green/255,r=e.blue/255,i=Math.max(t,n,r),o=Math.min(t,n,r),a=(i+o)/2;if(i===o)return e.alpha!==void 0?{hue:0,saturation:0,lightness:a,alpha:e.alpha}:{hue:0,saturation:0,lightness:a};var s,l=i-o,c=a>.5?l/(2-i-o):l/(i+o);switch(i){case t:s=(n-r)/l+(n<r?6:0);break;case n:s=(r-t)/l+2;break;default:s=(t-n)/l+4;break}return s*=60,e.alpha!==void 0?{hue:s,saturation:c,lightness:a,alpha:e.alpha}:{hue:s,saturation:c,lightness:a}}function dt(e){return _d(Rt(e))}var xd=function(t){return t.length===7&&t[1]===t[2]&&t[3]===t[4]&&t[5]===t[6]?"#"+t[1]+t[3]+t[5]:t},Nr=xd;function mt(e){var t=e.toString(16);return t.length===1?"0"+t:t}function xr(e){return mt(Math.round(e*255))}function wd(e,t,n){return Nr("#"+xr(e)+xr(t)+xr(n))}function Fa(e,t,n){return Ln(e,t,n,wd)}function kd(e,t,n){if(typeof e=="object"&&t===void 0&&n===void 0)return Fa(e.hue,e.saturation,e.lightness);throw new Qe(1)}function Cd(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?Fa(e.hue,e.saturation,e.lightness):"rgba("+Ln(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new Qe(2)}function Ba(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return Nr("#"+mt(e)+mt(t)+mt(n));if(typeof e=="object"&&t===void 0&&n===void 0)return Nr("#"+mt(e.red)+mt(e.green)+mt(e.blue));throw new Qe(6)}function qn(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?Ba(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new Qe(7)}var Sd=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Md=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&typeof t.alpha=="number"},Pd=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Od=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&typeof t.alpha=="number"};function ht(e){if(typeof e!="object")throw new Qe(8);if(Md(e))return qn(e);if(Sd(e))return Ba(e);if(Od(e))return Cd(e);if(Pd(e))return kd(e);throw new Qe(8)}function $a(e,t,n){return function(){var i=n.concat(Array.prototype.slice.call(arguments));return i.length>=t?e.apply(this,i):$a(e,t,i)}}function De(e){return $a(e,e.length,[])}function Ad(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{hue:n.hue+parseFloat(e)}))}De(Ad);function Ft(e,t,n){return Math.max(e,Math.min(t,n))}function jd(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{lightness:Ft(0,1,n.lightness-parseFloat(e))}))}De(jd);function Td(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{saturation:Ft(0,1,n.saturation-parseFloat(e))}))}De(Td);function Ed(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{lightness:Ft(0,1,n.lightness+parseFloat(e))}))}De(Ed);function Ld(e,t,n){if(t==="transparent")return n;if(n==="transparent")return t;if(e===0)return n;var r=Rt(t),i=Le({},r,{alpha:typeof r.alpha=="number"?r.alpha:1}),o=Rt(n),a=Le({},o,{alpha:typeof o.alpha=="number"?o.alpha:1}),s=i.alpha-a.alpha,l=parseFloat(e)*2-1,c=l*s===-1?l:l+s,f=1+l*s,u=(c/f+1)/2,g=1-u,h={red:Math.floor(i.red*u+a.red*g),green:Math.floor(i.green*u+a.green*g),blue:Math.floor(i.blue*u+a.blue*g),alpha:i.alpha*parseFloat(e)+a.alpha*(1-parseFloat(e))};return qn(h)}var Nd=De(Ld),Ha=Nd;function Rd(e,t){if(t==="transparent")return t;var n=Rt(t),r=typeof n.alpha=="number"?n.alpha:1,i=Le({},n,{alpha:Ft(0,1,(r*100+parseFloat(e)*100)/100)});return qn(i)}var Id=De(Rd),Dd=Id;function zd(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{saturation:Ft(0,1,n.saturation+parseFloat(e))}))}De(zd);function Fd(e,t){return t==="transparent"?t:ht(Le({},dt(t),{hue:parseFloat(e)}))}De(Fd);function Bd(e,t){return t==="transparent"?t:ht(Le({},dt(t),{lightness:parseFloat(e)}))}De(Bd);function $d(e,t){return t==="transparent"?t:ht(Le({},dt(t),{saturation:parseFloat(e)}))}De($d);function Hd(e,t){return t==="transparent"?t:Ha(parseFloat(e),"rgb(0, 0, 0)",t)}De(Hd);function Ud(e,t){return t==="transparent"?t:Ha(parseFloat(e),"rgb(255, 255, 255)",t)}De(Ud);function qd(e,t){if(t==="transparent")return t;var n=Rt(t),r=typeof n.alpha=="number"?n.alpha:1,i=Le({},n,{alpha:Ft(0,1,+(r*100-parseFloat(e)*100).toFixed(2)/100)});return qn(i)}De(qd);var bt=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-bt.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?bt.Bounce.In(e*2)*.5:bt.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),nn=function(){return performance.now()},Ua=function(){function e(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(n){return t._tweens[n]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i=0,o=n;i<o.length;i++){var a=o[i];(t=a._group)===null||t===void 0||t.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},e.prototype.remove=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,i=t;r<i.length;r++){var o=i[r];o._group=void 0,delete this._tweens[o.getId()],delete this._tweensAddedDuringUpdate[o.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},e.prototype.update=function(t,n){t===void 0&&(t=nn()),n===void 0&&(n=!0);var r=Object.keys(this._tweens);if(r.length!==0)for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<r.length;i++){var o=this._tweens[r[i]],a=!n;o&&o.update(t,a)===!1&&!n&&this.remove(o)}r=Object.keys(this._tweensAddedDuringUpdate)}},e}(),Rr={Linear:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),o=Rr.Utils.Linear;return t<0?o(e[0],e[1],r):t>1?o(e[n],e[n-1],n-r):o(e[i],e[i+1>n?n:i+1],r-i)},Utils:{Linear:function(e,t,n){return(t-e)*n+e}}},qa=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Ir=new Ua,jo=function(){function e(t,n){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=bt.Linear.None,this._interpolationFunction=Rr.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=qa.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof n=="object"?(this._group=n,n.add(this)):n===!0&&(this._group=Ir,Ir.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,n){if(n===void 0&&(n=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=n<0?0:n,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,n){if(t===void 0&&(t=nn()),n===void 0&&(n=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||n){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var o in this._valuesEnd)i[o]=this._valuesEnd[o];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,n)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,n,r,i,o){for(var a in r){var s=t[a],l=Array.isArray(s),c=l?"array":typeof s,f=!l&&Array.isArray(r[a]);if(!(c==="undefined"||c==="function")){if(f){var u=r[a];if(u.length===0)continue;for(var g=[s],h=0,p=u.length;h<p;h+=1){var v=this._handleRelativeValue(s,u[h]);if(isNaN(v)){f=!1,console.warn("Found invalid interpolation list. Skipping.");break}g.push(v)}f&&(r[a]=g)}if((c==="object"||l)&&s&&!f){n[a]=l?[]:{};var y=s;for(var d in y)n[a][d]=y[d];i[a]=l?[]:{};var u=r[a];if(!this._isDynamic){var b={};for(var d in u)b[d]=u[d];r[a]=u=b}this._setupProperties(y,n[a],u,i[a],o)}else(typeof n[a]>"u"||o)&&(n[a]=s),l||(n[a]*=1),f?i[a]=r[a].slice().reverse():i[a]=n[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(t){return t===void 0&&(t=nn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=nn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,n=this._chainedTweens.length;t<n;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},e.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},e.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},e.prototype.easing=function(t){return t===void 0&&(t=bt.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=Rr.Linear),this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,n){var r=this,i;if(t===void 0&&(t=nn()),n===void 0&&(n=e.autoStartOnUpdate),this._isPaused)return!0;var o;if(!this._goToEnd&&!this._isPlaying)if(n)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=t-this._startTime,s=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),l=this._duration+this._repeat*s,c=function(){if(r._duration===0||a>l)return 1;var v=Math.trunc(a/s),y=a-v*s,d=Math.min(y/r._duration,1);return d===0&&a===r._duration?1:d},f=c(),u=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,u),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||a>=this._duration)if(this._repeat>0){var g=Math.min(Math.trunc((a-this._duration)/s)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=g);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=s*g,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var h=0,p=this._chainedTweens.length;h<p;h++)this._chainedTweens[h].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,n,r,i){for(var o in r)if(n[o]!==void 0){var a=n[o]||0,s=r[o],l=Array.isArray(t[o]),c=Array.isArray(s),f=!l&&c;f?t[o]=this._interpolationFunction(s,i):typeof s=="object"&&s?this._updateProperties(t[o],a,s,i):(s=this._handleRelativeValue(a,s),typeof s=="number"&&(t[o]=a+(s-a)*i))}},e.prototype._handleRelativeValue=function(t,n){return typeof n!="string"?n:n.charAt(0)==="+"||n.charAt(0)==="-"?t+parseFloat(n):parseFloat(n)},e.prototype._swapEndStartRepeatValues=function(t){var n=this._valuesStartRepeat[t],r=this._valuesEnd[t];typeof r=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(r):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=n},e.autoStartOnUpdate=!1,e}();qa.nextId;var Je=Ir;Je.getAll.bind(Je);Je.removeAll.bind(Je);Je.add.bind(Je);Je.remove.bind(Je);Je.update.bind(Je);var Dr="http://www.w3.org/1999/xhtml";const To={svg:"http://www.w3.org/2000/svg",xhtml:Dr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Va(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),To.hasOwnProperty(t)?{space:To[t],local:e}:e}function Vd(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Dr&&t.documentElement.namespaceURI===Dr?t.createElement(e):t.createElementNS(n,e)}}function Gd(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ga(e){var t=Va(e);return(t.local?Gd:Vd)(t)}function Wd(){}function Wa(e){return e==null?Wd:function(){return this.querySelector(e)}}function Xd(e){typeof e!="function"&&(e=Wa(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=new Array(a),l,c,f=0;f<a;++f)(l=o[f])&&(c=e.call(l,l.__data__,f,o))&&("__data__"in l&&(c.__data__=l.__data__),s[f]=c);return new Ve(r,this._parents)}function Yd(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Kd(){return[]}function Qd(e){return e==null?Kd:function(){return this.querySelectorAll(e)}}function Zd(e){return function(){return Yd(e.apply(this,arguments))}}function Jd(e){typeof e=="function"?e=Zd(e):e=Qd(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var a=t[o],s=a.length,l,c=0;c<s;++c)(l=a[c])&&(r.push(e.call(l,l.__data__,c,a)),i.push(l));return new Ve(r,i)}function eh(e){return function(){return this.matches(e)}}function Xa(e){return function(t){return t.matches(e)}}var th=Array.prototype.find;function nh(e){return function(){return th.call(this.children,e)}}function rh(){return this.firstElementChild}function ih(e){return this.select(e==null?rh:nh(typeof e=="function"?e:Xa(e)))}var oh=Array.prototype.filter;function ah(){return Array.from(this.children)}function sh(e){return function(){return oh.call(this.children,e)}}function lh(e){return this.selectAll(e==null?ah:sh(typeof e=="function"?e:Xa(e)))}function ch(e){typeof e!="function"&&(e=eh(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],l,c=0;c<a;++c)(l=o[c])&&e.call(l,l.__data__,c,o)&&s.push(l);return new Ve(r,this._parents)}function Ya(e){return new Array(e.length)}function uh(){return new Ve(this._enter||this._groups.map(Ya),this._parents)}function Nn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Nn.prototype={constructor:Nn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function fh(e){return function(){return e}}function dh(e,t,n,r,i,o){for(var a=0,s,l=t.length,c=o.length;a<c;++a)(s=t[a])?(s.__data__=o[a],r[a]=s):n[a]=new Nn(e,o[a]);for(;a<l;++a)(s=t[a])&&(i[a]=s)}function hh(e,t,n,r,i,o,a){var s,l,c=new Map,f=t.length,u=o.length,g=new Array(f),h;for(s=0;s<f;++s)(l=t[s])&&(g[s]=h=a.call(l,l.__data__,s,t)+"",c.has(h)?i[s]=l:c.set(h,l));for(s=0;s<u;++s)h=a.call(e,o[s],s,o)+"",(l=c.get(h))?(r[s]=l,l.__data__=o[s],c.delete(h)):n[s]=new Nn(e,o[s]);for(s=0;s<f;++s)(l=t[s])&&c.get(g[s])===l&&(i[s]=l)}function ph(e){return e.__data__}function gh(e,t){if(!arguments.length)return Array.from(this,ph);var n=t?hh:dh,r=this._parents,i=this._groups;typeof e!="function"&&(e=fh(e));for(var o=i.length,a=new Array(o),s=new Array(o),l=new Array(o),c=0;c<o;++c){var f=r[c],u=i[c],g=u.length,h=vh(e.call(f,f&&f.__data__,c,r)),p=h.length,v=s[c]=new Array(p),y=a[c]=new Array(p),d=l[c]=new Array(g);n(f,u,v,y,d,h,t);for(var b=0,m=0,x,w;b<p;++b)if(x=v[b]){for(b>=m&&(m=b+1);!(w=y[m])&&++m<p;);x._next=w||null}}return a=new Ve(a,r),a._enter=s,a._exit=l,a}function vh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yh(){return new Ve(this._exit||this._groups.map(Ya),this._parents)}function mh(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function bh(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),l=0;l<a;++l)for(var c=n[l],f=r[l],u=c.length,g=s[l]=new Array(u),h,p=0;p<u;++p)(h=c[p]||f[p])&&(g[p]=h);for(;l<i;++l)s[l]=n[l];return new Ve(s,this._parents)}function _h(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],a;--i>=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function xh(e){e||(e=wh);function t(u,g){return u&&g?e(u.__data__,g.__data__):!u-!g}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a=n[o],s=a.length,l=i[o]=new Array(s),c,f=0;f<s;++f)(c=a[f])&&(l[f]=c);l.sort(t)}return new Ve(i,this._parents).order()}function wh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function kh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ch(){return Array.from(this)}function Sh(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null}function Mh(){let e=0;for(const t of this)++e;return e}function Ph(){return!this.node()}function Oh(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,a=i.length,s;o<a;++o)(s=i[o])&&e.call(s,s.__data__,o,i);return this}function Ah(e){return function(){this.removeAttribute(e)}}function jh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Th(e,t){return function(){this.setAttribute(e,t)}}function Eh(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Lh(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Nh(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Rh(e,t){var n=Va(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?jh:Ah:typeof t=="function"?n.local?Nh:Lh:n.local?Eh:Th)(n,t))}function Ka(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ih(e){return function(){this.style.removeProperty(e)}}function Dh(e,t,n){return function(){this.style.setProperty(e,t,n)}}function zh(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Fh(e,t,n){return arguments.length>1?this.each((t==null?Ih:typeof t=="function"?zh:Dh)(e,t,n??"")):Bh(this.node(),e)}function Bh(e,t){return e.style.getPropertyValue(t)||Ka(e).getComputedStyle(e,null).getPropertyValue(t)}function $h(e){return function(){delete this[e]}}function Hh(e,t){return function(){this[e]=t}}function Uh(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function qh(e,t){return arguments.length>1?this.each((t==null?$h:typeof t=="function"?Uh:Hh)(e,t)):this.node()[e]}function Qa(e){return e.trim().split(/^|\s+/)}function ai(e){return e.classList||new Za(e)}function Za(e){this._node=e,this._names=Qa(e.getAttribute("class")||"")}Za.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Ja(e,t){for(var n=ai(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function es(e,t){for(var n=ai(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Vh(e){return function(){Ja(this,e)}}function Gh(e){return function(){es(this,e)}}function Wh(e,t){return function(){(t.apply(this,arguments)?Ja:es)(this,e)}}function Xh(e,t){var n=Qa(e+"");if(arguments.length<2){for(var r=ai(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Wh:t?Vh:Gh)(n,t))}function Yh(){this.textContent=""}function Kh(e){return function(){this.textContent=e}}function Qh(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Zh(e){return arguments.length?this.each(e==null?Yh:(typeof e=="function"?Qh:Kh)(e)):this.node().textContent}function Jh(){this.innerHTML=""}function ep(e){return function(){this.innerHTML=e}}function tp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function np(e){return arguments.length?this.each(e==null?Jh:(typeof e=="function"?tp:ep)(e)):this.node().innerHTML}function rp(){this.nextSibling&&this.parentNode.appendChild(this)}function ip(){return this.each(rp)}function op(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ap(){return this.each(op)}function sp(e){var t=typeof e=="function"?e:Ga(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function lp(){return null}function cp(e,t){var n=typeof e=="function"?e:Ga(e),r=t==null?lp:typeof t=="function"?t:Wa(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function up(){var e=this.parentNode;e&&e.removeChild(this)}function fp(){return this.each(up)}function dp(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pp(e){return this.select(e?hp:dp)}function gp(e){return arguments.length?this.property("__data__",e):this.node().__data__}function vp(e){return function(t){e.call(this,t,this.__data__)}}function yp(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function mp(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function bp(e,t,n){return function(){var r=this.__on,i,o=vp(t);if(r){for(var a=0,s=r.length;a<s;++a)if((i=r[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function _p(e,t,n){var r=yp(e+""),i,o=r.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,c=s.length,f;l<c;++l)for(i=0,f=s[l];i<o;++i)if((a=r[i]).type===f.type&&a.name===f.name)return f.value}return}for(s=t?bp:mp,i=0;i<o;++i)this.each(s(r[i],t,n));return this}function ts(e,t,n){var r=Ka(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function xp(e,t){return function(){return ts(this,e,t)}}function wp(e,t){return function(){return ts(this,e,t.apply(this,arguments))}}function kp(e,t){return this.each((typeof t=="function"?wp:xp)(e,t))}function*Cp(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,a;i<o;++i)(a=r[i])&&(yield a)}var Sp=[null];function Ve(e,t){this._groups=e,this._parents=t}function Mp(){return this}Ve.prototype={constructor:Ve,select:Xd,selectAll:Jd,selectChild:ih,selectChildren:lh,filter:ch,data:gh,enter:uh,exit:yh,join:mh,merge:bh,selection:Mp,order:_h,sort:xh,call:kh,nodes:Ch,node:Sh,size:Mh,empty:Ph,each:Oh,attr:Rh,style:Fh,property:qh,classed:Xh,text:Zh,html:np,raise:ip,lower:ap,append:sp,insert:cp,remove:fp,clone:pp,datum:gp,on:_p,dispatch:kp,[Symbol.iterator]:Cp};function Pp(e){return typeof e=="string"?new Ve([[document.querySelector(e)]],[document.documentElement]):new Ve([[e]],Sp)}function Op(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ap(e,t){if(e=Op(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var un,ge,ns,rs,ut,Eo,is,os,wr,Pn,on,as,si,zr,Fr,Rn={},In=[],jp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Vn=Array.isArray;function Ze(e,t){for(var n in t)e[n]=t[n];return e}function li(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Tp(e,t,n){var r,i,o,a={};for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?un.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return an(e,a,r,i,null)}function an(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++ns,__i:-1,__u:0};return i==null&&ge.vnode!=null&&ge.vnode(o),o}function Gn(e){return e.children}function On(e,t){this.props=e,this.context=t}function It(e,t){if(t==null)return e.__?It(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?It(e):null}function Ep(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=Ze({},t);o.__v=t.__v+1,ge.vnode&&ge.vnode(o),ci(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??It(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,us(r,o,i),t.__e=t.__=null,o.__e!=n&&ss(o)}}function ss(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),ss(e)}function Lo(e){(!e.__d&&(e.__d=!0)&&ut.push(e)&&!Dn.__r++||Eo!=ge.debounceRendering)&&((Eo=ge.debounceRendering)||is)(Dn)}function Dn(){try{for(var e,t=1;ut.length;)ut.length>t&&ut.sort(os),e=ut.shift(),t=ut.length,Ep(e)}finally{ut.length=Dn.__r=0}}function ls(e,t,n,r,i,o,a,s,l,c,f){var u,g,h,p,v,y,d,b=r&&r.__k||In,m=t.length;for(l=Lp(n,t,b,l,m),u=0;u<m;u++)(h=n.__k[u])!=null&&(g=h.__i!=-1&&b[h.__i]||Rn,h.__i=u,y=ci(e,h,g,i,o,a,s,l,c,f),p=h.__e,h.ref&&g.ref!=h.ref&&(g.ref&&ui(g.ref,null,h),f.push(h.ref,h.__c||p,h)),v==null&&p!=null&&(v=p),(d=!!(4&h.__u))||g.__k===h.__k?(l=cs(h,l,e,d),d&&g.__e&&(g.__e=null)):typeof h.type=="function"&&y!==void 0?l=y:p&&(l=p.nextSibling),h.__u&=-7);return n.__e=v,l}function Lp(e,t,n,r,i){var o,a,s,l,c,f=n.length,u=f,g=0;for(e.__k=new Array(i),o=0;o<i;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=an(null,a,null,null,null):Vn(a)?a=e.__k[o]=an(Gn,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=an(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,l=o+g,a.__=e,a.__b=e.__b+1,s=null,(c=a.__i=Np(a,n,l,u))!=-1&&(u--,(s=n[c])&&(s.__u|=2)),s==null||s.__v==null?(c==-1&&(i>f?g--:i<f&&g++),typeof a.type!="function"&&(a.__u|=4)):c!=l&&(c==l-1?g--:c==l+1?g++:(c>l?g--:g++,a.__u|=4))):e.__k[o]=null;if(u)for(o=0;o<f;o++)(s=n[o])!=null&&!(2&s.__u)&&(s.__e==r&&(r=It(s)),ds(s,s));return r}function cs(e,t,n,r){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=cs(i[o],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=It(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Np(e,t,n,r){var i,o,a,s=e.key,l=e.type,c=t[n],f=c!=null&&(2&c.__u)==0;if(c===null&&s==null||f&&s==c.key&&l==c.type)return n;if(r>(f?1:0)){for(i=n-1,o=n+1;i>=0||o<t.length;)if((c=t[a=i>=0?i--:o++])!=null&&!(2&c.__u)&&s==c.key&&l==c.type)return a}return-1}function No(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||jp.test(t)?n:n+"px"}function Sn(e,t,n,r,i){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||No(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||No(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(as,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[on]=r[on]:(n[on]=si,e.addEventListener(t,o?Fr:zr,o)):e.removeEventListener(t,o?Fr:zr,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Ro(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Pn]==null)t[Pn]=si++;else if(t[Pn]<n[on])return;return n(ge.event?ge.event(t):t)}}}function ci(e,t,n,r,i,o,a,s,l,c){var f,u,g,h,p,v,y,d,b,m,x,w,_,k,C,P=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),o=[s=t.__e=n.__e]),(f=ge.__b)&&f(t);e:if(typeof P=="function")try{if(d=t.props,b=P.prototype&&P.prototype.render,m=(f=P.contextType)&&r[f.__c],x=f?m?m.props.value:f.__:r,n.__c?y=(u=t.__c=n.__c).__=u.__E:(b?t.__c=u=new P(d,x):(t.__c=u=new On(d,x),u.constructor=P,u.render=Ip),m&&m.sub(u),u.state||(u.state={}),u.__n=r,g=u.__d=!0,u.__h=[],u._sb=[]),b&&u.__s==null&&(u.__s=u.state),b&&P.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=Ze({},u.__s)),Ze(u.__s,P.getDerivedStateFromProps(d,u.__s))),h=u.props,p=u.state,u.__v=t,g)b&&P.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),b&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(b&&P.getDerivedStateFromProps==null&&d!==h&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(d,x),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(d,u.__s,x)===!1){t.__v!=n.__v&&(u.props=d,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(M){M&&(M.__=t)}),In.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&a.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(d,u.__s,x),b&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(h,p,v)})}if(u.context=x,u.props=d,u.__P=e,u.__e=!1,w=ge.__r,_=0,b)u.state=u.__s,u.__d=!1,w&&w(t),f=u.render(u.props,u.state,u.context),In.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,w&&w(t),f=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++_<25);u.state=u.__s,u.getChildContext!=null&&(r=Ze(Ze({},r),u.getChildContext())),b&&!g&&u.getSnapshotBeforeUpdate!=null&&(v=u.getSnapshotBeforeUpdate(h,p)),k=f!=null&&f.type===Gn&&f.key==null?fs(f.props.children):f,s=ls(e,Vn(k)?k:[k],t,n,r,i,o,a,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),y&&(u.__E=u.__=null)}catch(M){if(t.__v=null,l||o!=null)if(M.then){for(t.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o[o.indexOf(s)]=null,t.__e=s}else{for(C=o.length;C--;)li(o[C]);Br(t)}else t.__e=n.__e,t.__k=n.__k,M.then||Br(t);ge.__e(M,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Rp(n.__e,t,n,r,i,o,a,l,c);return(f=ge.diffed)&&f(t),128&t.__u?void 0:s}function Br(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Br))}function us(e,t,n){for(var r=0;r<n.length;r++)ui(n[r],n[++r],n[++r]);ge.__c&&ge.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){ge.__e(o,i.__v)}})}function fs(e){return typeof e!="object"||e==null||e.__b>0?e:Vn(e)?e.map(fs):Ze({},e)}function Rp(e,t,n,r,i,o,a,s,l){var c,f,u,g,h,p,v,y=n.props||Rn,d=t.props,b=t.type;if(b=="svg"?i="http://www.w3.org/2000/svg":b=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((h=o[c])&&"setAttribute"in h==!!b&&(b?h.localName==b:h.nodeType==3)){e=h,o[c]=null;break}}if(e==null){if(b==null)return document.createTextNode(d);e=document.createElementNS(i,b,d.is&&d),s&&(ge.__m&&ge.__m(t,o),s=!1),o=null}if(b==null)y===d||s&&e.data==d||(e.data=d);else{if(o=o&&un.call(e.childNodes),!s&&o!=null)for(y={},c=0;c<e.attributes.length;c++)y[(h=e.attributes[c]).name]=h.value;for(c in y)h=y[c],c=="dangerouslySetInnerHTML"?u=h:c=="children"||c in d||c=="value"&&"defaultValue"in d||c=="checked"&&"defaultChecked"in d||Sn(e,c,null,h,i);for(c in d)h=d[c],c=="children"?g=h:c=="dangerouslySetInnerHTML"?f=h:c=="value"?p=h:c=="checked"?v=h:s&&typeof h!="function"||y[c]===h||Sn(e,c,h,y[c],i);if(f)s||u&&(f.__html==u.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(u&&(e.innerHTML=""),ls(t.type=="template"?e.content:e,Vn(g)?g:[g],t,n,r,b=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:n.__k&&It(n,0),s,l),o!=null)for(c=o.length;c--;)li(o[c]);s||(c="value",b=="progress"&&p==null?e.removeAttribute("value"):p!=null&&(p!==e[c]||b=="progress"&&!p||b=="option"&&p!=y[c])&&Sn(e,c,p,y[c],i),c="checked",v!=null&&v!=e[c]&&Sn(e,c,v,y[c],i))}return e}function ui(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(i){ge.__e(i,n)}}function ds(e,t,n){var r,i;if(ge.unmount&&ge.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ui(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){ge.__e(o,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&ds(r[i],t,n||typeof e.type!="function");n||li(e.__e),e.__c=e.__=e.__e=void 0}function Ip(e,t,n){return this.constructor(e,n)}function Dp(e,t,n){var r,i,o,a;t==document&&(t=document.documentElement),ge.__&&ge.__(e,t),i=(r=!1)?null:t.__k,o=[],a=[],ci(t,e=t.__k=Tp(Gn,null,[e]),i||Rn,Rn,t.namespaceURI,i?null:t.firstChild?un.call(t.childNodes):null,o,i?i.__e:t.firstChild,r,a),us(o,e,a)}function hs(e,t,n){var r,i,o,a,s=Ze({},e.props);for(o in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)o=="key"?r=t[o]:o=="ref"?i=t[o]:s[o]=t[o]===void 0&&a!=null?a[o]:t[o];return arguments.length>2&&(s.children=arguments.length>3?un.call(arguments,2):n),an(e.type,s,r||e.key,i||e.ref,null)}un=In.slice,ge={__e:function(e,t,n,r){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(s){e=s}throw e}},ns=0,rs=function(e){return e!=null&&e.constructor===void 0},On.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ze({},this.state),typeof e=="function"&&(e=e(Ze({},n),this.props)),e&&Ze(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Lo(this))},On.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Lo(this))},On.prototype.render=Gn,ut=[],is=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,os=function(e,t){return e.__v.__b-t.__v.__b},Dn.__r=0,wr=Math.random().toString(8),Pn="__d"+wr,on="__a"+wr,as=/(PointerCapture)$|Capture$/i,si=0,zr=Ro(!1),Fr=Ro(!0);function Io(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zp(e){if(Array.isArray(e))return e}function Fp(e,t,n){return(t=Vp(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bp(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}function $p(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
656
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
655
|
+
`};function wd(){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 Je=function(e){md(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,wd.apply(void 0,[xd[n]].concat(i)))||this}return yd(r)}return t}($r(Error));function Pr(e){return Math.round(e*255)}function kd(e,t,n){return Pr(e)+","+Pr(t)+","+Pr(n)}function Fn(e,t,n,r){if(r===void 0&&(r=kd),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)),s=0,l=0,c=0;o>=0&&o<1?(s=i,l=a):o>=1&&o<2?(s=a,l=i):o>=2&&o<3?(l=i,c=a):o>=3&&o<4?(l=a,c=i):o>=4&&o<5?(s=a,c=i):o>=5&&o<6&&(s=i,c=a);var f=n-i/2,u=s+f,v=l+f,h=c+f;return r(u,v,h)}var Ni={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 Cd(e){if(typeof e!="string")return e;var t=e.toLowerCase();return Ni[t]?"#"+Ni[t]:e}var Sd=/^#[a-fA-F0-9]{6}$/,Md=/^#[a-fA-F0-9]{8}$/,Pd=/^#[a-fA-F0-9]{3}$/,Od=/^#[a-fA-F0-9]{4}$/,Or=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,Ad=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,jd=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,Td=/^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 Ht(e){if(typeof e!="string")throw new Je(3);var t=Cd(e);if(t.match(Sd))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(Md)){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(Pd))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(Od)){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=Or.exec(t);if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10)};var i=Ad.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=jd.exec(t);if(a){var s=parseInt(""+a[1],10),l=parseInt(""+a[2],10)/100,c=parseInt(""+a[3],10)/100,f="rgb("+Fn(s,l,c)+")",u=Or.exec(f);if(!u)throw new Je(4,t,f);return{red:parseInt(""+u[1],10),green:parseInt(""+u[2],10),blue:parseInt(""+u[3],10)}}var v=Td.exec(t.substring(0,50));if(v){var h=parseInt(""+v[1],10),p=parseInt(""+v[2],10)/100,g=parseInt(""+v[3],10)/100,y="rgb("+Fn(h,p,g)+")",d=Or.exec(y);if(!d)throw new Je(4,t,y);return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10),alpha:parseFloat(""+v[4])>1?parseFloat(""+v[4])/100:parseFloat(""+v[4])}}throw new Je(5)}function Ed(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 s,l=o-i,c=a>.5?l/(2-o-i):l/(o+i);switch(o){case t:s=(n-r)/l+(n<r?6:0);break;case n:s=(r-t)/l+2;break;default:s=(t-n)/l+4;break}return s*=60,e.alpha!==void 0?{hue:s,saturation:c,lightness:a,alpha:e.alpha}:{hue:s,saturation:c,lightness:a}}function pt(e){return Ed(Ht(e))}var Ld=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},Hr=Ld;function Ct(e){var t=e.toString(16);return t.length===1?"0"+t:t}function Ar(e){return Ct(Math.round(e*255))}function Rd(e,t,n){return Hr("#"+Ar(e)+Ar(t)+Ar(n))}function Wa(e,t,n){return Fn(e,t,n,Rd)}function Nd(e,t,n){if(typeof e=="object"&&t===void 0&&n===void 0)return Wa(e.hue,e.saturation,e.lightness);throw new Je(1)}function Dd(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?Wa(e.hue,e.saturation,e.lightness):"rgba("+Fn(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new Je(2)}function Xa(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return Hr("#"+Ct(e)+Ct(t)+Ct(n));if(typeof e=="object"&&t===void 0&&n===void 0)return Hr("#"+Ct(e.red)+Ct(e.green)+Ct(e.blue));throw new Je(6)}function Kn(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?Xa(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new Je(7)}var zd=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Id=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&typeof t.alpha=="number"},Fd=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Bd=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&typeof t.alpha=="number"};function gt(e){if(typeof e!="object")throw new Je(8);if(Id(e))return Kn(e);if(zd(e))return Xa(e);if(Bd(e))return Dd(e);if(Fd(e))return Nd(e);throw new Je(8)}function Ya(e,t,n){return function(){var o=n.concat(Array.prototype.slice.call(arguments));return o.length>=t?e.apply(this,o):Ya(e,t,o)}}function Fe(e){return Ya(e,e.length,[])}function $d(e,t){if(t==="transparent")return t;var n=pt(t);return gt(Ne({},n,{hue:n.hue+parseFloat(e)}))}Fe($d);function Vt(e,t,n){return Math.max(e,Math.min(t,n))}function Hd(e,t){if(t==="transparent")return t;var n=pt(t);return gt(Ne({},n,{lightness:Vt(0,1,n.lightness-parseFloat(e))}))}Fe(Hd);function Ud(e,t){if(t==="transparent")return t;var n=pt(t);return gt(Ne({},n,{saturation:Vt(0,1,n.saturation-parseFloat(e))}))}Fe(Ud);function qd(e,t){if(t==="transparent")return t;var n=pt(t);return gt(Ne({},n,{lightness:Vt(0,1,n.lightness+parseFloat(e))}))}Fe(qd);function Gd(e,t,n){if(t==="transparent")return n;if(n==="transparent")return t;if(e===0)return n;var r=Ht(t),o=Ne({},r,{alpha:typeof r.alpha=="number"?r.alpha:1}),i=Ht(n),a=Ne({},i,{alpha:typeof i.alpha=="number"?i.alpha:1}),s=o.alpha-a.alpha,l=parseFloat(e)*2-1,c=l*s===-1?l:l+s,f=1+l*s,u=(c/f+1)/2,v=1-u,h={red:Math.floor(o.red*u+a.red*v),green:Math.floor(o.green*u+a.green*v),blue:Math.floor(o.blue*u+a.blue*v),alpha:o.alpha*parseFloat(e)+a.alpha*(1-parseFloat(e))};return Kn(h)}var Vd=Fe(Gd),Ka=Vd;function Wd(e,t){if(t==="transparent")return t;var n=Ht(t),r=typeof n.alpha=="number"?n.alpha:1,o=Ne({},n,{alpha:Vt(0,1,(r*100+parseFloat(e)*100)/100)});return Kn(o)}var Xd=Fe(Wd),Yd=Xd;function Kd(e,t){if(t==="transparent")return t;var n=pt(t);return gt(Ne({},n,{saturation:Vt(0,1,n.saturation+parseFloat(e))}))}Fe(Kd);function Qd(e,t){return t==="transparent"?t:gt(Ne({},pt(t),{hue:parseFloat(e)}))}Fe(Qd);function Zd(e,t){return t==="transparent"?t:gt(Ne({},pt(t),{lightness:parseFloat(e)}))}Fe(Zd);function Jd(e,t){return t==="transparent"?t:gt(Ne({},pt(t),{saturation:parseFloat(e)}))}Fe(Jd);function eh(e,t){return t==="transparent"?t:Ka(parseFloat(e),"rgb(0, 0, 0)",t)}Fe(eh);function th(e,t){return t==="transparent"?t:Ka(parseFloat(e),"rgb(255, 255, 255)",t)}Fe(th);function nh(e,t){if(t==="transparent")return t;var n=Ht(t),r=typeof n.alpha=="number"?n.alpha:1,o=Ne({},n,{alpha:Vt(0,1,+(r*100-parseFloat(e)*100).toFixed(2)/100)});return Kn(o)}Fe(nh);var St=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-St.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?St.Bounce.In(e*2)*.5:St.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}}}}),un=function(){return performance.now()},Qa=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=un()),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}(),Ur={Linear:function(e,t){var n=e.length-1,r=n*t,o=Math.floor(r),i=Ur.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}}},Za=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),qr=new Qa,Di=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=St.Linear.None,this._interpolationFunction=Ur.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Za.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=un()),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 s=t[a],l=Array.isArray(s),c=l?"array":typeof s,f=!l&&Array.isArray(r[a]);if(!(c==="undefined"||c==="function")){if(f){var u=r[a];if(u.length===0)continue;for(var v=[s],h=0,p=u.length;h<p;h+=1){var g=this._handleRelativeValue(s,u[h]);if(isNaN(g)){f=!1,console.warn("Found invalid interpolation list. Skipping.");break}v.push(g)}f&&(r[a]=v)}if((c==="object"||l)&&s&&!f){n[a]=l?[]:{};var y=s;for(var d in y)n[a][d]=y[d];o[a]=l?[]:{};var u=r[a];if(!this._isDynamic){var m={};for(var d in u)m[d]=u[d];r[a]=u=m}this._setupProperties(y,n[a],u,o[a],i)}else(typeof n[a]>"u"||i)&&(n[a]=s),l||(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=un()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=un()),!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=St.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=Ur.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=un()),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,s=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),l=this._duration+this._repeat*s,c=function(){if(r._duration===0||a>l)return 1;var g=Math.trunc(a/s),y=a-g*s,d=Math.min(y/r._duration,1);return d===0&&a===r._duration?1:d},f=c(),u=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,u),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||a>=this._duration)if(this._repeat>0){var v=Math.min(Math.trunc((a-this._duration)/s)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=v);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+=s*v,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var h=0,p=this._chainedTweens.length;h<p;h++)this._chainedTweens[h].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,n,r,o){for(var i in r)if(n[i]!==void 0){var a=n[i]||0,s=r[i],l=Array.isArray(t[i]),c=Array.isArray(s),f=!l&&c;f?t[i]=this._interpolationFunction(s,o):typeof s=="object"&&s?this._updateProperties(t[i],a,s,o):(s=this._handleRelativeValue(a,s),typeof s=="number"&&(t[i]=a+(s-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}();Za.nextId;var tt=qr;tt.getAll.bind(tt);tt.removeAll.bind(tt);tt.add.bind(tt);tt.remove.bind(tt);tt.update.bind(tt);var Gr="http://www.w3.org/1999/xhtml";const zi={svg:"http://www.w3.org/2000/svg",xhtml:Gr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ja(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 rh(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Gr&&t.documentElement.namespaceURI===Gr?t.createElement(e):t.createElementNS(n,e)}}function oh(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function es(e){var t=Ja(e);return(t.local?oh:rh)(t)}function ih(){}function ts(e){return e==null?ih:function(){return this.querySelector(e)}}function ah(e){typeof e!="function"&&(e=ts(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,s=r[o]=new Array(a),l,c,f=0;f<a;++f)(l=i[f])&&(c=e.call(l,l.__data__,f,i))&&("__data__"in l&&(c.__data__=l.__data__),s[f]=c);return new qe(r,this._parents)}function sh(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function lh(){return[]}function ch(e){return e==null?lh:function(){return this.querySelectorAll(e)}}function uh(e){return function(){return sh(e.apply(this,arguments))}}function fh(e){typeof e=="function"?e=uh(e):e=ch(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var a=t[i],s=a.length,l,c=0;c<s;++c)(l=a[c])&&(r.push(e.call(l,l.__data__,c,a)),o.push(l));return new qe(r,o)}function dh(e){return function(){return this.matches(e)}}function ns(e){return function(t){return t.matches(e)}}var hh=Array.prototype.find;function ph(e){return function(){return hh.call(this.children,e)}}function gh(){return this.firstElementChild}function vh(e){return this.select(e==null?gh:ph(typeof e=="function"?e:ns(e)))}var yh=Array.prototype.filter;function mh(){return Array.from(this.children)}function bh(e){return function(){return yh.call(this.children,e)}}function _h(e){return this.selectAll(e==null?mh:bh(typeof e=="function"?e:ns(e)))}function xh(e){typeof e!="function"&&(e=dh(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,s=r[o]=[],l,c=0;c<a;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&s.push(l);return new qe(r,this._parents)}function rs(e){return new Array(e.length)}function wh(){return new qe(this._enter||this._groups.map(rs),this._parents)}function Bn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Bn.prototype={constructor:Bn,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 kh(e){return function(){return e}}function Ch(e,t,n,r,o,i){for(var a=0,s,l=t.length,c=i.length;a<c;++a)(s=t[a])?(s.__data__=i[a],r[a]=s):n[a]=new Bn(e,i[a]);for(;a<l;++a)(s=t[a])&&(o[a]=s)}function Sh(e,t,n,r,o,i,a){var s,l,c=new Map,f=t.length,u=i.length,v=new Array(f),h;for(s=0;s<f;++s)(l=t[s])&&(v[s]=h=a.call(l,l.__data__,s,t)+"",c.has(h)?o[s]=l:c.set(h,l));for(s=0;s<u;++s)h=a.call(e,i[s],s,i)+"",(l=c.get(h))?(r[s]=l,l.__data__=i[s],c.delete(h)):n[s]=new Bn(e,i[s]);for(s=0;s<f;++s)(l=t[s])&&c.get(v[s])===l&&(o[s]=l)}function Mh(e){return e.__data__}function Ph(e,t){if(!arguments.length)return Array.from(this,Mh);var n=t?Sh:Ch,r=this._parents,o=this._groups;typeof e!="function"&&(e=kh(e));for(var i=o.length,a=new Array(i),s=new Array(i),l=new Array(i),c=0;c<i;++c){var f=r[c],u=o[c],v=u.length,h=Oh(e.call(f,f&&f.__data__,c,r)),p=h.length,g=s[c]=new Array(p),y=a[c]=new Array(p),d=l[c]=new Array(v);n(f,u,g,y,d,h,t);for(var m=0,b=0,x,w;m<p;++m)if(x=g[m]){for(m>=b&&(b=m+1);!(w=y[b])&&++b<p;);x._next=w||null}}return a=new qe(a,r),a._enter=s,a._exit=l,a}function Oh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ah(){return new qe(this._exit||this._groups.map(rs),this._parents)}function jh(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 Th(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),s=new Array(o),l=0;l<a;++l)for(var c=n[l],f=r[l],u=c.length,v=s[l]=new Array(u),h,p=0;p<u;++p)(h=c[p]||f[p])&&(v[p]=h);for(;l<o;++l)s[l]=n[l];return new qe(s,this._parents)}function Eh(){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 Lh(e){e||(e=Rh);function t(u,v){return u&&v?e(u.__data__,v.__data__):!u-!v}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var a=n[i],s=a.length,l=o[i]=new Array(s),c,f=0;f<s;++f)(c=a[f])&&(l[f]=c);l.sort(t)}return new qe(o,this._parents).order()}function Rh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Nh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Dh(){return Array.from(this)}function zh(){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 Ih(){let e=0;for(const t of this)++e;return e}function Fh(){return!this.node()}function Bh(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,a=o.length,s;i<a;++i)(s=o[i])&&e.call(s,s.__data__,i,o);return this}function $h(e){return function(){this.removeAttribute(e)}}function Hh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Uh(e,t){return function(){this.setAttribute(e,t)}}function qh(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Gh(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Vh(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 Wh(e,t){var n=Ja(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?Hh:$h:typeof t=="function"?n.local?Vh:Gh:n.local?qh:Uh)(n,t))}function os(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Xh(e){return function(){this.style.removeProperty(e)}}function Yh(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Kh(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Qh(e,t,n){return arguments.length>1?this.each((t==null?Xh:typeof t=="function"?Kh:Yh)(e,t,n??"")):Zh(this.node(),e)}function Zh(e,t){return e.style.getPropertyValue(t)||os(e).getComputedStyle(e,null).getPropertyValue(t)}function Jh(e){return function(){delete this[e]}}function ep(e,t){return function(){this[e]=t}}function tp(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function np(e,t){return arguments.length>1?this.each((t==null?Jh:typeof t=="function"?tp:ep)(e,t)):this.node()[e]}function is(e){return e.trim().split(/^|\s+/)}function go(e){return e.classList||new as(e)}function as(e){this._node=e,this._names=is(e.getAttribute("class")||"")}as.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 ss(e,t){for(var n=go(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function ls(e,t){for(var n=go(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function rp(e){return function(){ss(this,e)}}function op(e){return function(){ls(this,e)}}function ip(e,t){return function(){(t.apply(this,arguments)?ss:ls)(this,e)}}function ap(e,t){var n=is(e+"");if(arguments.length<2){for(var r=go(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?ip:t?rp:op)(n,t))}function sp(){this.textContent=""}function lp(e){return function(){this.textContent=e}}function cp(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function up(e){return arguments.length?this.each(e==null?sp:(typeof e=="function"?cp:lp)(e)):this.node().textContent}function fp(){this.innerHTML=""}function dp(e){return function(){this.innerHTML=e}}function hp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function pp(e){return arguments.length?this.each(e==null?fp:(typeof e=="function"?hp:dp)(e)):this.node().innerHTML}function gp(){this.nextSibling&&this.parentNode.appendChild(this)}function vp(){return this.each(gp)}function yp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mp(){return this.each(yp)}function bp(e){var t=typeof e=="function"?e:es(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function _p(){return null}function xp(e,t){var n=typeof e=="function"?e:es(e),r=t==null?_p:typeof t=="function"?t:ts(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function wp(){var e=this.parentNode;e&&e.removeChild(this)}function kp(){return this.each(wp)}function Cp(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Sp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Mp(e){return this.select(e?Sp:Cp)}function Pp(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Op(e){return function(t){e.call(this,t,this.__data__)}}function Ap(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 jp(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 Tp(e,t,n){return function(){var r=this.__on,o,i=Op(t);if(r){for(var a=0,s=r.length;a<s;++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 Ep(e,t,n){var r=Ap(e+""),o,i=r.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,c=s.length,f;l<c;++l)for(o=0,f=s[l];o<i;++o)if((a=r[o]).type===f.type&&a.name===f.name)return f.value}return}for(s=t?Tp:jp,o=0;o<i;++o)this.each(s(r[o],t,n));return this}function cs(e,t,n){var r=os(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 Lp(e,t){return function(){return cs(this,e,t)}}function Rp(e,t){return function(){return cs(this,e,t.apply(this,arguments))}}function Np(e,t){return this.each((typeof t=="function"?Rp:Lp)(e,t))}function*Dp(){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 zp=[null];function qe(e,t){this._groups=e,this._parents=t}function Ip(){return this}qe.prototype={constructor:qe,select:ah,selectAll:fh,selectChild:vh,selectChildren:_h,filter:xh,data:Ph,enter:wh,exit:Ah,join:jh,merge:Th,selection:Ip,order:Eh,sort:Lh,call:Nh,nodes:Dh,node:zh,size:Ih,empty:Fh,each:Bh,attr:Wh,style:Qh,property:np,classed:ap,text:up,html:pp,raise:vp,lower:mp,append:bp,insert:xp,remove:kp,clone:Mp,datum:Pp,on:Ep,dispatch:Np,[Symbol.iterator]:Dp};function Fp(e){return typeof e=="string"?new qe([[document.querySelector(e)]],[document.documentElement]):new qe([[e]],zp)}function Bp(e){let t;for(;t=e.sourceEvent;)e=t;return e}function $p(e,t){if(e=Bp(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 yn,ve,us,fs,dt,Ii,ds,hs,jr,Ln,dn,ps,vo,Vr,Wr,$n={},Hn=[],Hp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qn=Array.isArray;function et(e,t){for(var n in t)e[n]=t[n];return e}function yo(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Up(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?yn.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 hn(e,a,r,o,null)}function hn(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??++us,__i:-1,__u:0};return o==null&&ve.vnode!=null&&ve.vnode(i),i}function Zn(e){return e.children}function Rn(e,t){this.props=e,this.context=t}function Ut(e,t){if(t==null)return e.__?Ut(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"?Ut(e):null}function qp(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],o=[],i=et({},t);i.__v=t.__v+1,ve.vnode&&ve.vnode(i),mo(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??Ut(t),!!(32&t.__u),o),i.__v=t.__v,i.__.__k[i.__i]=i,ms(r,i,o),t.__e=t.__=null,i.__e!=n&&gs(i)}}function gs(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}),gs(e)}function Fi(e){(!e.__d&&(e.__d=!0)&&dt.push(e)&&!Un.__r++||Ii!=ve.debounceRendering)&&((Ii=ve.debounceRendering)||ds)(Un)}function Un(){try{for(var e,t=1;dt.length;)dt.length>t&&dt.sort(hs),e=dt.shift(),t=dt.length,qp(e)}finally{dt.length=Un.__r=0}}function vs(e,t,n,r,o,i,a,s,l,c,f){var u,v,h,p,g,y,d,m=r&&r.__k||Hn,b=t.length;for(l=Gp(n,t,m,l,b),u=0;u<b;u++)(h=n.__k[u])!=null&&(v=h.__i!=-1&&m[h.__i]||$n,h.__i=u,y=mo(e,h,v,o,i,a,s,l,c,f),p=h.__e,h.ref&&v.ref!=h.ref&&(v.ref&&bo(v.ref,null,h),f.push(h.ref,h.__c||p,h)),g==null&&p!=null&&(g=p),(d=!!(4&h.__u))||v.__k===h.__k?(l=ys(h,l,e,d),d&&v.__e&&(v.__e=null)):typeof h.type=="function"&&y!==void 0?l=y:p&&(l=p.nextSibling),h.__u&=-7);return n.__e=g,l}function Gp(e,t,n,r,o){var i,a,s,l,c,f=n.length,u=f,v=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]=hn(null,a,null,null,null):Qn(a)?a=e.__k[i]=hn(Zn,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[i]=hn(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,l=i+v,a.__=e,a.__b=e.__b+1,s=null,(c=a.__i=Vp(a,n,l,u))!=-1&&(u--,(s=n[c])&&(s.__u|=2)),s==null||s.__v==null?(c==-1&&(o>f?v--:o<f&&v++),typeof a.type!="function"&&(a.__u|=4)):c!=l&&(c==l-1?v--:c==l+1?v++:(c>l?v--:v++,a.__u|=4))):e.__k[i]=null;if(u)for(i=0;i<f;i++)(s=n[i])!=null&&!(2&s.__u)&&(s.__e==r&&(r=Ut(s)),_s(s,s));return r}function ys(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=ys(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Ut(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Vp(e,t,n,r){var o,i,a,s=e.key,l=e.type,c=t[n],f=c!=null&&(2&c.__u)==0;if(c===null&&s==null||f&&s==c.key&&l==c.type)return n;if(r>(f?1:0)){for(o=n-1,i=n+1;o>=0||i<t.length;)if((c=t[a=o>=0?o--:i++])!=null&&!(2&c.__u)&&s==c.key&&l==c.type)return a}return-1}function Bi(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Hp.test(t)?n:n+"px"}function Tn(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||Bi(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Bi(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(ps,"$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[dn]=r[dn]:(n[dn]=vo,e.addEventListener(t,i?Wr:Vr,i)):e.removeEventListener(t,i?Wr:Vr,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 $i(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ln]==null)t[Ln]=vo++;else if(t[Ln]<n[dn])return;return n(ve.event?ve.event(t):t)}}}function mo(e,t,n,r,o,i,a,s,l,c){var f,u,v,h,p,g,y,d,m,b,x,w,_,k,S,A=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[s=t.__e=n.__e]),(f=ve.__b)&&f(t);e:if(typeof A=="function")try{if(d=t.props,m=A.prototype&&A.prototype.render,b=(f=A.contextType)&&r[f.__c],x=f?b?b.props.value:f.__:r,n.__c?y=(u=t.__c=n.__c).__=u.__E:(m?t.__c=u=new A(d,x):(t.__c=u=new Rn(d,x),u.constructor=A,u.render=Xp),b&&b.sub(u),u.state||(u.state={}),u.__n=r,v=u.__d=!0,u.__h=[],u._sb=[]),m&&u.__s==null&&(u.__s=u.state),m&&A.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=et({},u.__s)),et(u.__s,A.getDerivedStateFromProps(d,u.__s))),h=u.props,p=u.state,u.__v=t,v)m&&A.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),m&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(m&&A.getDerivedStateFromProps==null&&d!==h&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(d,x),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(d,u.__s,x)===!1){t.__v!=n.__v&&(u.props=d,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(O){O&&(O.__=t)}),Hn.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&a.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(d,u.__s,x),m&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(h,p,g)})}if(u.context=x,u.props=d,u.__P=e,u.__e=!1,w=ve.__r,_=0,m)u.state=u.__s,u.__d=!1,w&&w(t),f=u.render(u.props,u.state,u.context),Hn.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,w&&w(t),f=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++_<25);u.state=u.__s,u.getChildContext!=null&&(r=et(et({},r),u.getChildContext())),m&&!v&&u.getSnapshotBeforeUpdate!=null&&(g=u.getSnapshotBeforeUpdate(h,p)),k=f!=null&&f.type===Zn&&f.key==null?bs(f.props.children):f,s=vs(e,Qn(k)?k:[k],t,n,r,o,i,a,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),y&&(u.__E=u.__=null)}catch(O){if(t.__v=null,l||i!=null)if(O.then){for(t.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;i[i.indexOf(s)]=null,t.__e=s}else{for(S=i.length;S--;)yo(i[S]);Xr(t)}else t.__e=n.__e,t.__k=n.__k,O.then||Xr(t);ve.__e(O,t,n)}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Wp(n.__e,t,n,r,o,i,a,l,c);return(f=ve.diffed)&&f(t),128&t.__u?void 0:s}function Xr(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Xr))}function ms(e,t,n){for(var r=0;r<n.length;r++)bo(n[r],n[++r],n[++r]);ve.__c&&ve.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){ve.__e(i,o.__v)}})}function bs(e){return typeof e!="object"||e==null||e.__b>0?e:Qn(e)?e.map(bs):et({},e)}function Wp(e,t,n,r,o,i,a,s,l){var c,f,u,v,h,p,g,y=n.props||$n,d=t.props,m=t.type;if(m=="svg"?o="http://www.w3.org/2000/svg":m=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((h=i[c])&&"setAttribute"in h==!!m&&(m?h.localName==m:h.nodeType==3)){e=h,i[c]=null;break}}if(e==null){if(m==null)return document.createTextNode(d);e=document.createElementNS(o,m,d.is&&d),s&&(ve.__m&&ve.__m(t,i),s=!1),i=null}if(m==null)y===d||s&&e.data==d||(e.data=d);else{if(i=i&&yn.call(e.childNodes),!s&&i!=null)for(y={},c=0;c<e.attributes.length;c++)y[(h=e.attributes[c]).name]=h.value;for(c in y)h=y[c],c=="dangerouslySetInnerHTML"?u=h:c=="children"||c in d||c=="value"&&"defaultValue"in d||c=="checked"&&"defaultChecked"in d||Tn(e,c,null,h,o);for(c in d)h=d[c],c=="children"?v=h:c=="dangerouslySetInnerHTML"?f=h:c=="value"?p=h:c=="checked"?g=h:s&&typeof h!="function"||y[c]===h||Tn(e,c,h,y[c],o);if(f)s||u&&(f.__html==u.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(u&&(e.innerHTML=""),vs(t.type=="template"?e.content:e,Qn(v)?v:[v],t,n,r,m=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,a,i?i[0]:n.__k&&Ut(n,0),s,l),i!=null)for(c=i.length;c--;)yo(i[c]);s||(c="value",m=="progress"&&p==null?e.removeAttribute("value"):p!=null&&(p!==e[c]||m=="progress"&&!p||m=="option"&&p!=y[c])&&Tn(e,c,p,y[c],o),c="checked",g!=null&&g!=e[c]&&Tn(e,c,g,y[c],o))}return e}function bo(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){ve.__e(o,n)}}function _s(e,t,n){var r,o;if(ve.unmount&&ve.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||bo(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){ve.__e(i,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&_s(r[o],t,n||typeof e.type!="function");n||yo(e.__e),e.__c=e.__=e.__e=void 0}function Xp(e,t,n){return this.constructor(e,n)}function Yp(e,t,n){var r,o,i,a;t==document&&(t=document.documentElement),ve.__&&ve.__(e,t),o=(r=!1)?null:t.__k,i=[],a=[],mo(t,e=t.__k=Up(Zn,null,[e]),o||$n,$n,t.namespaceURI,o?null:t.firstChild?yn.call(t.childNodes):null,i,o?o.__e:t.firstChild,r,a),ms(i,e,a)}function xs(e,t,n){var r,o,i,a,s=et({},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]:s[i]=t[i]===void 0&&a!=null?a[i]:t[i];return arguments.length>2&&(s.children=arguments.length>3?yn.call(arguments,2):n),hn(e.type,s,r||e.key,o||e.ref,null)}yn=Hn.slice,ve={__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(s){e=s}throw e}},us=0,fs=function(e){return e!=null&&e.constructor===void 0},Rn.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=et({},this.state),typeof e=="function"&&(e=e(et({},n),this.props)),e&&et(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Fi(this))},Rn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Fi(this))},Rn.prototype.render=Zn,dt=[],ds=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,hs=function(e,t){return e.__v.__b-t.__v.__b},Un.__r=0,jr=Math.random().toString(8),Ln="__d"+jr,dn="__a"+jr,ps=/(PointerCapture)$|Capture$/i,vo=0,Vr=$i(!1),Wr=$i(!0);function Hi(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 Kp(e){if(Array.isArray(e))return e}function Qp(e,t,n){return(t=rg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zp(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,o=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function Jp(){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 Ui(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 eg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ui(Object(n),!0).forEach(function(r){Qp(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ui(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tg(e,t){return Kp(e)||Zp(e,t)||og(e,t)||Jp()}function ng(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 rg(e){var t=ng(e,"string");return typeof t=="symbol"?t:t+""}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)}function og(e,t){if(e){if(typeof e=="string")return Hi(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)?Hi(e,t):void 0}}var Yr=function(t){if(qn(t)!=="object")return t;var n=xs(t);if(n.props){var r;n.props=eg({},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(Yr):Yr(n.props.children))}return n},ig=function(t){return fs(xs(t))},ag=function(t,n){delete n.__k,Yp(Yr(t),n)};function sg(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 lg=`.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
|
+
`;sg(lg);var cg=fo({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&&qn(t)==="object"&&!!t.node&&typeof t.node=="function",s=Fp(a?t.node():t);s.style("position")==="static"&&s.style("position","relative"),n.tooltipEl=s.append("div").attr("class","float-tooltip-kap"),Object.entries(i).forEach(function(c){var f=tg(c,2),u=f[0],v=f[1];return n.tooltipEl.style(u,v)}),n.tooltipEl.style("left","-10000px").style("display","none");var l="tooltip-".concat(Math.round(Math.random()*1e12));n.mouseInside=!1,s.on("mousemove.".concat(l),function(c){n.mouseInside=!0;var f=$p(c),u=s.node(),v=u.offsetWidth,h=u.offsetHeight,p=[n.offsetX===null||n.offsetX===void 0?"-".concat(f[0]/v*100,"%"):typeof n.offsetX=="number"?"calc(-50% + ".concat(n.offsetX,"px)"):n.offsetX,n.offsetY===null||n.offsetY===void 0?h>130&&h-f[1]<100?"calc(-100% - 6px)":"21px":typeof n.offsetY=="number"?n.offsetY<0?"calc(-100% - ".concat(Math.abs(n.offsetY),"px)"):"".concat(n.offsetY,"px"):n.offsetY];n.tooltipEl.style("left",f[0]+"px").style("top",f[1]+"px").style("transform","translate(".concat(p.join(","),")")),n.content&&n.tooltipEl.style("display","inline")}),s.on("mouseover.".concat(l),function(){n.mouseInside=!0,n.content&&n.tooltipEl.style("display","inline")}),s.on("mouseout.".concat(l),function(){n.mouseInside=!1,n.tooltipEl.style("display","none")})},update:function(t){t.tooltipEl.style("display",t.content&&t.mouseInside?"inline":"none"),t.content?t.content instanceof HTMLElement?(t.tooltipEl.text(""),t.tooltipEl.append(function(){return t.content})):typeof t.content=="string"?t.tooltipEl.html(t.content):ig(t.content)?(t.tooltipEl.text(""),ag(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 ug(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 fg=`.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 sg(e,t){return eg(e)||ig(e,t)||ps(e,t)||og()}function vt(e){return tg(e)||rg(e)||ps(e)||ag()}function lg(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cg(e){var t=lg(e,"string");return typeof t=="symbol"?t:t+""}function ps(e,t){if(e){if(typeof e=="string")return Hr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hr(e,t):void 0}}var gs=function(t){t instanceof Array?t.forEach(gs):(t.map&&t.map.dispose(),t.dispose())},vs=function(t){t.geometry&&t.geometry.dispose(),t.material&&gs(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(vs)},ug=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),vs(n)}},he=window.THREE?window.THREE:{WebGLRenderer:K.WebGLRenderer,Scene:K.Scene,PerspectiveCamera:K.PerspectiveCamera,Raycaster:K.Raycaster,SRGBColorSpace:K.SRGBColorSpace,TextureLoader:K.TextureLoader,Vector2:K.Vector2,Vector3:K.Vector3,Box3:K.Box3,Color:K.Color,Mesh:K.Mesh,SphereGeometry:K.SphereGeometry,MeshBasicMaterial:K.MeshBasicMaterial,BackSide:K.BackSide,Timer:K.Timer},ys=ri({props:{width:{default:window.innerWidth,onChange:function(t,n,r){isNaN(t)&&(n.width=r)}},height:{default:window.innerHeight,onChange:function(t,n,r){isNaN(t)&&(n.height=r)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(t,n){n.hoverObj=null,n.tooltip&&n.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(t){if(t.initialised){t.controls.enabled&&t.controls.update&&t.controls.update(Math.min(1,t.timer.update().getDelta())),t.postProcessingComposer?t.postProcessingComposer.render():t.renderer.render(t.scene,t.camera),t.extraRenderers.forEach(function(a){return a.render(t.scene,t.camera)});var n=+new Date;if(t.enablePointerInteraction&&n-t.lastRaycasterCheck>=t.pointerRaycasterThrottleMs){t.lastRaycasterCheck=n;var r=null;if(t.hoverDuringDrag||!t.isPointerDragging){var i=this.intersectingObjects(t.pointerPos.x,t.pointerPos.y);t.hoverOrderComparator&&i.sort(function(a,s){return t.hoverOrderComparator(a.object,s.object)});var o=i.find(function(a){return t.hoverFilter(a.object)})||null;r=o?o.object:null,t.intersection=o||null}r!==t.hoverObj&&(t.onHover(r,t.hoverObj,t.intersection),t.tooltip.content(r&&ie(t.tooltipContent)(r,t.intersection)||null),t.hoverObj=r)}t.tweenGroup.update()}return this},getPointerPos:function(t){var n=t.pointerPos,r=n.x,i=n.y;return{x:r,y:i}},cameraPosition:function(t,n,r,i){var o=t.camera;if(n&&t.initialised){var a=n,s=r||{x:0,y:0,z:0};if(!i)f(a),u(s);else{var l=Object.assign({},o.position),c=g();t.tweenGroup.add(new jo(l).to(a,i).easing(bt.Quadratic.Out).onUpdate(f).onComplete(function(){t.tweenGroup.remove(this)}).start()),t.tweenGroup.add(new jo(c).to(s,i/3).easing(bt.Quadratic.Out).onUpdate(u).onComplete(function(){t.tweenGroup.remove(this)}).start())}return this}return Object.assign({},o.position,{lookAt:g()});function f(h){var p=h.x,v=h.y,y=h.z;p!==void 0&&(o.position.x=p),v!==void 0&&(o.position.y=v),y!==void 0&&(o.position.z=y)}function u(h){var p=new he.Vector3(h.x,h.y,h.z);t.controls.enabled&&t.controls.target?t.controls.target=p:o.lookAt(p)}function g(){return Object.assign(new he.Vector3(0,0,-1e3).applyQuaternion(o.quaternion).add(o.position))}},zoomToFit:function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return this.fitToBbox(this.getBbox.apply(this,o),n,r)},fitToBbox:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,o=t.camera;if(n){var a=new he.Vector3(0,0,0),s=Math.max.apply(Math,vt(Object.entries(n).map(function(h){var p=sg(h,2),v=p[0],y=p[1];return Math.max.apply(Math,vt(y.map(function(d){return Math.abs(a[v]-d)})))})))*2,l=(1-i*2/t.height)*o.fov,c=s/Math.atan(l*Math.PI/180),f=c/o.aspect,u=Math.max(c,f);if(u>0){var g=a.clone().sub(o.position).normalize().multiplyScalar(-u);this.cameraPosition(g,a,r)}}return this},getBbox:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},r=new he.Box3(new he.Vector3(0,0,0),new he.Vector3(0,0,0)),i=t.objects.filter(n);return i.length?(i.forEach(function(o){return r.expandByObject(o)}),Object.assign.apply(Object,vt(["x","y","z"].map(function(o){return ng({},o,[r.min[o],r.max[o]])})))):null},getScreenCoords:function(t,n,r,i){var o=new he.Vector3(n,r,i);return o.project(this.camera()),{x:(o.x+1)*t.width/2,y:-(o.y-1)*t.height/2}},getSceneCoords:function(t,n,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=new he.Vector2(n/t.width*2-1,-(r/t.height)*2+1),a=new he.Raycaster;return a.setFromCamera(o,t.camera),Object.assign({},a.ray.at(i,new he.Vector3))},intersectingObjects:function(t,n,r){var i=new he.Vector2(n/t.width*2-1,-(r/t.height)*2+1),o=new he.Raycaster;return o.params.Line.threshold=t.lineHoverPrecision,o.params.Points.threshold=t.pointsHoverPrecision,o.setFromCamera(i,t.camera),o.intersectObjects(t.objects,!0)},renderer:function(t){return t.renderer},scene:function(t){return t.scene},camera:function(t){return t.camera},postProcessingComposer:function(t){return t.postProcessingComposer},controls:function(t){return t.controls},tbControls:function(t){return t.controls},_destructor:function(t){var n,r,i;ug(t.scene),(n=t.controls)===null||n===void 0||n.dispose(),(r=t.renderer)===null||r===void 0||r.dispose(),(i=t.postProcessingComposer)===null||i===void 0||i.dispose()}},stateInit:function(){return{scene:new he.Scene,camera:new he.PerspectiveCamera,timer:new he.Timer,tweenGroup:new Ua,lastRaycasterCheck:0}},init:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.controlType,o=i===void 0?"trackball":i,a=r.useWebGPU,s=a===void 0?!1:a,l=r.rendererConfig,c=l===void 0?{}:l,f=r.extraRenderers,u=f===void 0?[]:f,g=r.waitForLoadComplete,h=g===void 0?!0:g;t.innerHTML="",t.appendChild(n.container=document.createElement("div")),n.container.className="scene-container",n.container.style.position="relative",n.container.appendChild(n.navInfo=document.createElement("div")),n.navInfo.className="scene-nav-info",n.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[o]||"",n.navInfo.style.display=n.showNavInfo?null:"none",n.tooltip=new Qp(n.container),n.pointerPos=new he.Vector2,n.pointerPos.x=-2,n.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(p){return n.container.addEventListener(p,function(v){if(p==="pointerdown"&&(n.isPointerPressed=!0),!n.isPointerDragging&&v.type==="pointermove"&&(v.pressure>0||n.isPointerPressed)&&(v.pointerType==="mouse"||v.movementX===void 0||[v.movementX,v.movementY].some(function(b){return Math.abs(b)>1}))&&(n.isPointerDragging=!0),n.enablePointerInteraction){var y=d(n.container);n.pointerPos.x=v.pageX-y.left,n.pointerPos.y=v.pageY-y.top}function d(b){var m=b.getBoundingClientRect(),x=window.pageXOffset||document.documentElement.scrollLeft,w=window.pageYOffset||document.documentElement.scrollTop;return{top:m.top+w,left:m.left+x}}},{passive:!0})}),n.container.addEventListener("pointerup",function(p){n.isPointerPressed&&(n.isPointerPressed=!1,!(n.isPointerDragging&&(n.isPointerDragging=!1,!n.clickAfterDrag))&&requestAnimationFrame(function(){p.button===0&&n.onClick(n.hoverObj||null,p,n.intersection),p.button===2&&n.onRightClick&&n.onRightClick(n.hoverObj||null,p,n.intersection)}))},{passive:!0,capture:!0}),n.container.addEventListener("contextmenu",function(p){n.onRightClick&&p.preventDefault()}),n.renderer=new(s?el.WebGPURenderer:he.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),n.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),n.container.appendChild(n.renderer.domElement),n.extraRenderers=u,n.extraRenderers.forEach(function(p){p.domElement.style.position="absolute",p.domElement.style.top="0px",p.domElement.style.pointerEvents="none",n.container.appendChild(p.domElement)}),n.postProcessingComposer=new il.EffectComposer(n.renderer),n.postProcessingComposer.addPass(new ol.RenderPass(n.scene,n.camera)),n.controls=new{trackball:tl.TrackballControls,orbit:nl.OrbitControls,fly:rl.FlyControls}[o](n.camera,n.renderer.domElement),o==="fly"&&(n.controls.movementSpeed=300,n.controls.rollSpeed=Math.PI/6,n.controls.dragToLook=!0),(o==="trackball"||o==="orbit")&&(n.controls.minDistance=.1,n.controls.maxDistance=n.skyRadius,n.controls.addEventListener("start",function(){n.controlsEngaged=!0}),n.controls.addEventListener("change",function(){n.controlsEngaged&&(n.controlsDragging=!0)}),n.controls.addEventListener("end",function(){n.controlsEngaged=!1,n.controlsDragging=!1})),[n.renderer,n.postProcessingComposer].concat(vt(n.extraRenderers)).forEach(function(p){return p.setSize(n.width,n.height)}),n.camera.aspect=n.width/n.height,n.camera.updateProjectionMatrix(),n.camera.position.z=1e3,n.scene.add(n.skysphere=new he.Mesh),n.skysphere.visible=!1,n.loadComplete=n.scene.visible=!h,window.scene=n.scene},update:function(t,n){if(t.width&&t.height&&(n.hasOwnProperty("width")||n.hasOwnProperty("height"))){var r,i=t.width,o=t.height;t.container.style.width="".concat(i,"px"),t.container.style.height="".concat(o,"px"),[t.renderer,t.postProcessingComposer].concat(vt(t.extraRenderers)).forEach(function(h){return h.setSize(i,o)}),t.camera.aspect=i/o;var a=t.viewOffset.slice(0,2);a.some(function(h){return h})&&(r=t.camera).setViewOffset.apply(r,[i,o].concat(vt(a),[i,o])),t.camera.updateProjectionMatrix()}if(n.hasOwnProperty("viewOffset")){var s,l=t.width,c=t.height,f=t.viewOffset.slice(0,2);f.some(function(h){return h})?(s=t.camera).setViewOffset.apply(s,[l,c].concat(vt(f),[l,c])):t.camera.clearViewOffset()}if(n.hasOwnProperty("skyRadius")&&t.skyRadius&&(t.controls.hasOwnProperty("maxDistance")&&n.skyRadius&&(t.controls.maxDistance=Math.min(t.controls.maxDistance,t.skyRadius)),t.camera.far=t.skyRadius*2.5,t.camera.updateProjectionMatrix(),t.skysphere.geometry=new he.SphereGeometry(t.skyRadius)),n.hasOwnProperty("backgroundColor")){var u=Rt(t.backgroundColor).alpha;u===void 0&&(u=1),t.renderer.setClearColor(new he.Color(Dd(1,t.backgroundColor)),u)}n.hasOwnProperty("backgroundImageUrl")&&(t.backgroundImageUrl?new he.TextureLoader().load(t.backgroundImageUrl,function(h){h.colorSpace=he.SRGBColorSpace,t.skysphere.material=new he.MeshBasicMaterial({map:h,side:he.BackSide}),t.skysphere.visible=!0,t.onBackgroundImageLoaded&&setTimeout(t.onBackgroundImageLoaded),!t.loadComplete&&g()}):(t.skysphere.visible=!1,t.skysphere.material.map=null,!t.loadComplete&&g())),n.hasOwnProperty("showNavInfo")&&(t.navInfo.style.display=t.showNavInfo?null:"none"),n.hasOwnProperty("lights")&&((n.lights||[]).forEach(function(h){return t.scene.remove(h)}),t.lights.forEach(function(h){return t.scene.add(h)})),n.hasOwnProperty("objects")&&((n.objects||[]).forEach(function(h){return t.scene.remove(h)}),t.objects.forEach(function(h){return t.scene.add(h)}));function g(){t.loadComplete=t.scene.visible=!0}}});function fg(e,t){let n=null,r=null;const i=(...o)=>{r=o,n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null;const a=r;r=null,e(...a)},t)};return i.cancel=()=>{n!==null&&(clearTimeout(n),n=null),r=null},i}class dg{name;defaultVal;triggerUpdate;onChange;constructor(t,n){this.name=t,this.defaultVal=n.default??null,this.triggerUpdate=n.triggerUpdate??!0,this.onChange=n.onChange??(()=>{})}}function hg(e={}){const{stateInit:t=()=>({}),props:n={},methods:r={},aliases:i={},init:o=()=>{},update:a=()=>{}}=e,s=Object.keys(n).map(c=>new dg(c,n[c]));function l(...c){const f=this instanceof l,u=c.slice(),g=f?u.shift():void 0,h=u[0]??{},p=typeof t=="function"?t(h):t,v=Object.assign({},p,{initialised:!1,_rerender:()=>{}});let y={};const d=x=>(b(x,h),m(),d);function b(x,w){o.call(d,x,v,w),v.initialised=!0}const m=fg(()=>{v.initialised&&(a.call(d,v,y),y={})},1);for(const x of s){const{name:w,triggerUpdate:_,onChange:k,defaultVal:C}=x;d[w]=function(){const M=v[w];if(arguments.length===0)return M;const N=arguments[0],E=N===void 0?C:N;return v[w]=E,k.call(d,E,v,M),Object.prototype.hasOwnProperty.call(y,w)||(y[w]=M),_&&m(),d}}for(const x of Object.keys(r))d[x]=function(...w){return r[x].call(d,v,...w)};for(const[x,w]of Object.entries(i))d[x]=d[w];return d.resetProps=function(){for(const x of s)d[x.name](x.defaultVal);return d},d.resetProps(),v._rerender=m,f&&g!==void 0&&d(g),d}return l}function zo(e){if(typeof e=="function")return e;if(typeof e=="string"){const n=e;return r=>r?.[n]}const t=e;return()=>t}function ms(e,t){const n=e instanceof Array?e:[e],r=new t;return r._destructor?.(),{linkProp(i){return{default:r[i](),onChange(o,a){n.forEach(s=>{a[s][i].call(a[s],o)})},triggerUpdate:!1}},linkMethod(i){return function(o,...a){const s=[];return n.forEach(l=>{const c=o[l],f=c[i].apply(c,a);f!==c&&s.push(f)}),s.length?s[0]:this}}}}const Fo=globalThis,Bo=Fo.THREE?Fo.THREE:{AmbientLight:K.AmbientLight,DirectionalLight:K.DirectionalLight},pg=170,bs=ms("forceGraph",Da),gg=["jsonUrl","graphData","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeColor","nodeAutoColorBy","nodeOpacity","nodeVisibility","nodeThreeObject","nodeThreeObjectExtend","nodePositionUpdate","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject","forceEngine","d3AlphaDecay","d3VelocityDecay","d3AlphaMin","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"],vg=["refresh","getGraphBbox","d3Force","d3ReheatSimulation","emitParticle"],Wn=ms("renderObjs",ys),yg=["width","height","backgroundColor","showNavInfo","enablePointerInteraction"],mg=["lights","cameraPosition","postProcessingComposer"],fi={};for(const e of gg)fi[e]=bs.linkProp(e);for(const e of yg)fi[e]=Wn.linkProp(e);const fn={};for(const e of vg)fn[e]=bs.linkMethod(e);for(const e of mg)fn[e]=Wn.linkMethod(e);fn.graph2ScreenCoords=Wn.linkMethod("getScreenCoords");fn.screen2GraphCoords=Wn.linkMethod("getSceneCoords");const He=e=>e;function ot(e){let t=e??null;for(;t&&!Object.prototype.hasOwnProperty.call(t,"__graphObjType");)t=t.parent;return t}const bg=hg({props:{nodeLabel:{default:"name",triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:1,onChange(e,t){He(t).renderObjs.lineHoverPrecision(e)},triggerUpdate:!1},enableNavigationControls:{default:!0,onChange(e,t){const r=He(t).renderObjs.controls();r&&(r.enabled=!!e,e&&r.domElement&&r.domElement.dispatchEvent(new PointerEvent("pointerup")))},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},onNodeDrag:{default:()=>{},triggerUpdate:!1},onNodeDragEnd:{default:()=>{},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},...fi},methods:{zoomToFit(e,t,n,...r){return He(e).renderObjs.fitToBbox(this.getGraphBbox(...r),t,n),this},pauseAnimation(e){const t=He(e);return t.animationFrameRequestId!=null&&(cancelAnimationFrame(t.animationFrameRequestId),t.animationFrameRequestId=null),this},resumeAnimation(e){return He(e).animationFrameRequestId==null&&this._animationCycle(),this},_animationCycle(e){const t=He(e);t.enablePointerInteraction&&(this.renderer().domElement.style.cursor=""),t.forceGraph.tickFrame(),t.renderObjs.tick(),t.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},scene(e){return He(e).renderObjs.scene()},camera(e){return He(e).renderObjs.camera()},renderer(e){return He(e).renderObjs.renderer()},controls(e){return He(e).renderObjs.controls()},_destructor(e){const t=He(e);this.pauseAnimation(),this.graphData({nodes:[],links:[]}),t.forceGraph._destructor?.(),t.renderObjs._destructor()},...fn},stateInit:e=>{const t=e??{},n=new Da,r=ys({...t.controlType?{controlType:t.controlType}:{},...t.rendererConfig?{rendererConfig:t.rendererConfig}:{},...t.extraRenderers?{extraRenderers:t.extraRenderers}:{}});return r.objects([n]),r.lights([new Bo.AmbientLight(13421772,Math.PI),new Bo.DirectionalLight(16777215,.6*Math.PI)]),{forceGraph:n,renderObjs:r}},init(e,t){const n=He(t);e.innerHTML="",n.container=document.createElement("div"),n.container.style.position="relative",e.appendChild(n.container);const r=document.createElement("div");n.container.appendChild(r),n.renderObjs(r);const i=n.renderObjs.camera(),o=n.renderObjs.renderer(),a=n.renderObjs.controls();a&&(a.enabled=!!n.enableNavigationControls),n.lastSetCameraZ=i.position.z;const s=document.createElement("div");s.className="graph-info-msg",s.textContent="",n.container.appendChild(s);const l=n.forceGraph;l.onLoading(()=>{s.textContent="Loading..."}),l.onFinishLoading(()=>{s.textContent=""}),l.onUpdate(()=>{if(n.graphData=l.graphData(),i.position.x===0&&i.position.y===0&&i.position.z===n.lastSetCameraZ&&n.graphData.nodes.length){i.lookAt(l.position??{x:0,y:0,z:0});const f=Math.cbrt(n.graphData.nodes.length)*pg;i.position.z=f,n.lastSetCameraZ=f}}),l.onFinishUpdate(()=>{if(n._dragControls){const f=n.graphData.nodes.find(u=>u.__initialFixedPos&&!u.__disposeControlsAfterDrag);f?f.__disposeControlsAfterDrag=!0:n._dragControls.dispose(),n._dragControls=void 0}if(n.enableNodeDrag&&n.enablePointerInteraction&&n.forceEngine==="d3"){const f=n.graphData.nodes.map(h=>h.__threeObj).filter(h=>!!h),u=new Js.DragControls(f,i,o.domElement);n._dragControls=u,u.addEventListener("dragstart",h=>{const p=h,v=ot(p.object);if(!v)return;a&&(a.enabled=!1),p.object.__initialPos=p.object.position.clone(),p.object.__prevPos=p.object.position.clone();const y=v.__data;y.__initialFixedPos||(y.__initialFixedPos={fx:y.fx,fy:y.fy,fz:y.fz}),y.__initialPos||(y.__initialPos={x:y.x,y:y.y,z:y.z});for(const d of["x","y","z"])y[`f${d}`]=y[d];o.domElement.classList.add("grabbable")});const g=4;u.addEventListener("drag",h=>{const p=h,v=ot(p.object);if(!v)return;if(!Object.prototype.hasOwnProperty.call(p.object,"__graphObjType")){const m=p.object.__initialPos,x=p.object.__prevPos,w=p.object.position,_=w.clone().sub(x);v.position.add(_),x.copy(w),w.copy(m)}const y=v.__data,d=v.position;if(!y.__dragCommitted){const m=y.__initialPos,x=m?.x??d.x,w=m?.y??d.y,_=m?.z??d.z,k=d.x-x,C=d.y-w,P=d.z-_;if(k*k+C*C+P*P<g)return;y.__dragCommitted=!0}const b={x:d.x-(y.x??0),y:d.y-(y.y??0),z:d.z-(y.z??0)};for(const m of["x","y","z"])y[`f${m}`]=d[m],y[m]=d[m];n.forceGraph.d3AlphaTarget(.3).resetCountdown(),y.__dragged=!0,n.onNodeDrag?.(y,b)}),u.addEventListener("dragend",h=>{const p=h,v=ot(p.object);if(!v)return;delete p.object.__initialPos,delete p.object.__prevPos;const y=v.__data;y.__disposeControlsAfterDrag&&(u.dispose(),delete y.__disposeControlsAfterDrag);const d=y.__initialFixedPos,b=y.__initialPos,m=b?{x:b.x-y.x,y:b.y-y.y,z:b.z-y.z}:{x:0,y:0,z:0};if(d){for(const x of["x","y","z"]){const w=`f${x}`;d[w]===void 0&&delete y[w]}delete y.__initialFixedPos,delete y.__initialPos,delete y.__dragCommitted,y.__dragged&&(delete y.__dragged,n.onNodeDragEnd?.(y,m))}n.forceGraph.d3AlphaTarget(0).resetCountdown(),n.enableNavigationControls&&a&&(a.enabled=!0,a._status&&a._onPointerCancel?.(),a.domElement?.ownerDocument?.dispatchEvent(new PointerEvent("pointerup",{pointerType:"touch"}))),o.domElement.classList.remove("grabbable")})}}),parseInt(K.REVISION,10)<155&&(o.useLegacyLights=!1),n.renderObjs.hoverOrderComparator((f,u)=>{const g=ot(f);if(!g)return 1;const h=ot(u);if(!h)return-1;const p=v=>v.__graphObjType==="node"?1:0;return p(h)-p(g)}).tooltipContent(f=>{const u=ot(f);if(!u)return"";const g=n[`${u.__graphObjType}Label`];return zo(g)(u.__data)||""}).hoverDuringDrag(!1).onHover(f=>{const u=ot(f);if(u===n.hoverObj)return;const g=n.hoverObj??null,h=g?g.__graphObjType:null,p=g?g.__data:null,v=u?u.__graphObjType:null,y=u?u.__data:null;if(h&&h!==v){const m=n[`on${h==="node"?"Node":"Link"}Hover`];m?.(null,p)}if(v){const m=n[`on${v==="node"?"Node":"Link"}Hover`];m?.(y,h===v?p:null)}const b=!!(u?n[`on${v==="node"?"Node":"Link"}Click`]:n.onBackgroundClick)&&zo(n.showPointerCursor)(y);o.domElement.classList[b?"add":"remove"]("clickable"),n.hoverObj=u}).clickAfterDrag(!1).onClick((f,u)=>{const g=ot(f);if(g){const h=n[`on${g.__graphObjType==="node"?"Node":"Link"}Click`];h?.(g.__data,u)}else n.onBackgroundClick&&n.onBackgroundClick(u)}).onRightClick((f,u)=>{const g=ot(f);if(g){const h=n[`on${g.__graphObjType==="node"?"Node":"Link"}RightClick`];h?.(g.__data,u)}else n.onBackgroundRightClick&&n.onBackgroundRightClick(u)}),this._animationCycle()},update(){}});function jt(e,t,n){if(typeof requestAnimationFrame!="function")return t(1),()=>{};const r=performance.now();let i=null,o=!1;const a=s=>{if(o)return;const l=s-r,c=Math.min(1,l/Math.max(e,1));t(_g(c)),c<1?i=requestAnimationFrame(a):i=null};return i=requestAnimationFrame(a),()=>{o=!0,i!==null&&cancelAnimationFrame(i),i=null}}function _g(e){return 1-(1-e)*(1-e)}function ae(e,t,n){return e+(t-e)*n}const te=()=>!0,Ue=e=>e==="2d",ye=e=>e==="3d",xg=[{key:"nodeId",setter:"nodeId",supports:te},{key:"linkSource",setter:"linkSource",supports:te},{key:"linkTarget",setter:"linkTarget",supports:te},{key:"backgroundColor",setter:"backgroundColor",supports:te},{key:"nodeColor",setter:"nodeColor",supports:te},{key:"nodeLabel",setter:"nodeLabel",supports:te},{key:"nodeVal",setter:"nodeVal",supports:te},{key:"nodeAutoColorBy",setter:"nodeAutoColorBy",supports:te},{key:"nodeRelSize",setter:"nodeRelSize",supports:te},{key:"nodeVisibility",setter:"nodeVisibility",supports:te},{key:"linkColor",setter:"linkColor",supports:te},{key:"linkLabel",setter:"linkLabel",supports:te},{key:"linkWidth",setter:"linkWidth",supports:te},{key:"linkCurvature",setter:"linkCurvature",supports:te},{key:"linkAutoColorBy",setter:"linkAutoColorBy",supports:te},{key:"linkVisibility",setter:"linkVisibility",supports:te},{key:"linkDirectionalArrowLength",setter:"linkDirectionalArrowLength",supports:te},{key:"linkDirectionalArrowColor",setter:"linkDirectionalArrowColor",supports:te},{key:"linkDirectionalArrowRelPos",setter:"linkDirectionalArrowRelPos",supports:te},{key:"linkDirectionalParticles",setter:"linkDirectionalParticles",supports:te},{key:"linkDirectionalParticleSpeed",setter:"linkDirectionalParticleSpeed",supports:te},{key:"linkDirectionalParticleWidth",setter:"linkDirectionalParticleWidth",supports:te},{key:"linkDirectionalParticleOffset",setter:"linkDirectionalParticleOffset",supports:te},{key:"linkDirectionalParticleColor",setter:"linkDirectionalParticleColor",supports:te},{key:"cooldownTicks",setter:"cooldownTicks",supports:te},{key:"cooldownTime",setter:"cooldownTime",supports:te},{key:"warmupTicks",setter:"warmupTicks",supports:te},{key:"d3AlphaDecay",setter:"d3AlphaDecay",supports:te},{key:"d3VelocityDecay",setter:"d3VelocityDecay",supports:te},{key:"d3AlphaMin",setter:"d3AlphaMin",supports:te},{key:"d3AlphaTarget",setter:"d3AlphaTarget",supports:te},{key:"dagMode",setter:"dagMode",supports:te},{key:"dagLevelDistance",setter:"dagLevelDistance",supports:te},{key:"dagNodeFilter",setter:"dagNodeFilter",supports:te},{key:"onDagError",setter:"onDagError",supports:te},{key:"enableNodeDrag",setter:"enableNodeDrag",supports:te},{key:"enablePointerInteraction",setter:"enablePointerInteraction",supports:te},{key:"linkHoverPrecision",setter:"linkHoverPrecision",supports:te},{key:"showPointerCursor",setter:"showPointerCursor",supports:te},{key:"enableZoom",setter:"enableZoomInteraction",supports:Ue},{key:"enablePan",setter:"enablePanInteraction",supports:Ue},{key:"minZoom",setter:"minZoom",supports:Ue},{key:"maxZoom",setter:"maxZoom",supports:Ue},{key:"autoPauseRedraw",setter:"autoPauseRedraw",supports:Ue},{key:"linkLineDash",setter:"linkLineDash",supports:Ue},{key:"nodeCanvasObject",setter:"nodeCanvasObject",supports:Ue},{key:"nodeCanvasObjectMode",setter:"nodeCanvasObjectMode",supports:Ue},{key:"nodePointerAreaPaint",setter:"nodePointerAreaPaint",supports:Ue},{key:"linkCanvasObject",setter:"linkCanvasObject",supports:Ue},{key:"linkCanvasObjectMode",setter:"linkCanvasObjectMode",supports:Ue},{key:"linkPointerAreaPaint",setter:"linkPointerAreaPaint",supports:Ue},{key:"showNavInfo",setter:"showNavInfo",supports:ye},{key:"enableNavigationControls",setter:"enableNavigationControls",supports:ye},{key:"nodeOpacity",setter:"nodeOpacity",supports:ye},{key:"nodeResolution",setter:"nodeResolution",supports:ye},{key:"linkOpacity",setter:"linkOpacity",supports:ye},{key:"linkResolution",setter:"linkResolution",supports:ye},{key:"linkCurveRotation",setter:"linkCurveRotation",supports:ye},{key:"linkMaterial",setter:"linkMaterial",supports:ye},{key:"nodeThreeObject",setter:"nodeThreeObject",supports:ye},{key:"nodeThreeObjectExtend",setter:"nodeThreeObjectExtend",supports:ye},{key:"linkThreeObject",setter:"linkThreeObject",supports:ye},{key:"linkThreeObjectExtend",setter:"linkThreeObjectExtend",supports:ye},{key:"nodePositionUpdate",setter:"nodePositionUpdate",supports:ye},{key:"linkPositionUpdate",setter:"linkPositionUpdate",supports:ye},{key:"linkDirectionalArrowResolution",setter:"linkDirectionalArrowResolution",supports:ye},{key:"linkDirectionalParticleResolution",setter:"linkDirectionalParticleResolution",supports:ye},{key:"numDimensions",setter:"numDimensions",supports:ye},{key:"forceEngine",setter:"forceEngine",supports:ye},{key:"ngraphPhysics",setter:"ngraphPhysics",supports:ye},{key:"pointerRaycasterThrottleMs",setter:"pointerRaycasterThrottleMs",supports:ye}];function $o(e,t,n,r){if(t!==n)for(const i of xg){if(!i.supports(r))continue;const o=t[i.key],a=n[i.key];if(Object.is(o,a))continue;const s=e[i.setter];typeof s=="function"&&s.call(e,o)}}const wg=["onNodeClick","onNodeRightClick","onNodeHover","onNodeDrag","onNodeDragEnd","onLinkClick","onLinkRightClick","onLinkHover","onBackgroundClick","onBackgroundRightClick","onEngineTick","onEngineStop"],yt=1200,Qt=300;function kg(e,t,n){const r=new bg(e,{controlType:"orbit"});r.width(t.width),r.height(t.height);for(const v of wg){const y=r[v];typeof y=="function"&&y.call(r,(...d)=>{const b=n.current[v];typeof b=="function"&&b(...d)})}$o(r,t.initialProps,{},"3d"),r.graphData(t.initialData);let i=t.initialMode,o=i==="2d"?yt:Qt,a=null,s=null;const l=v=>{const y=r.controls?.();if(!y)return;const d=y;v==="2d"?(d.noRotate=!0,d.enableRotate=!1,d.zoomToCursor=!0,d.screenSpacePanning=!0,d.zoomSpeed=1.6,d.panSpeed=1.2,d.mouseButtons&&(d.mouseButtons.LEFT=K.MOUSE.PAN)):(d.noRotate=!1,d.enableRotate=!0,d.zoomToCursor=!1,d.screenSpacePanning=!1,d.zoomSpeed=1,d.panSpeed=1,d.mouseButtons&&(d.mouseButtons.LEFT=K.MOUSE.ROTATE))},c=()=>{const v=r.graphData();for(const y of v.nodes)y.fz=0},f=()=>{const v=r.graphData();for(const y of v.nodes)delete y.fz},u=()=>{const v=r.graphData(),y=new Map;let d=0;for(const m of v.nodes){const x=m.x??0,w=m.y??0,_=Math.hypot(x,w);_>d&&(d=_)}const b=Math.max(40,d*.6);for(const m of v.nodes)y.set(m,(Math.random()-.5)*2*b);return y};i==="2d"?(c(),l("2d"),r.cameraPosition?.({x:0,y:0,z:yt},{x:0,y:0,z:0},0)):l("3d");const g=()=>r.cameraPosition?.();return{get mode(){return i},setGraphData(v){r.graphData(v),i==="2d"&&c()},getGraphData(){return r.graphData()},fit(v,y){r.zoomToFit?.(v??400,y??40)},centerAt(v,y,d,b){if(i==="2d"){r.cameraPosition?.({x:v,y,z:yt},{x:v,y,z:0},b??0);return}const m=g();r.cameraPosition?.({x:v,y,z:d??o},m?.lookAt,b??0)},zoom(v,y){const d=g();if(!d)return;const b=Math.hypot(d.x,d.y,d.z);o=b/Math.max(v,.001);const m=b===0?{x:0,y:0,z:1}:{x:d.x/b,y:d.y/b,z:d.z/b};r.cameraPosition?.({x:m.x*o,y:m.y*o,z:m.z*o},d.lookAt,y??0)},getZoom(){const v=g();if(!v)return 1;const y=Math.hypot(v.x,v.y,v.z);return y===0?1:o/y},screen2Graph(v,y,d){return r.screen2GraphCoords?.(v,y,d??0)??{x:v,y,z:0}},graph2Screen(v,y,d){return r.graph2ScreenCoords?.(v,y,d??0)??{x:v,y,z:d??0}},getGraphBbox(){return r.getGraphBbox?.()??{x:[0,0],y:[0,0],z:[0,0]}},pause(){r.pauseAnimation?.()},resume(){r.resumeAnimation?.()},reheat(){r.d3ReheatSimulation?.()},resize(v,y){r.width(v),r.height(y)},d3Force(v,y){const d=r.d3Force;if(typeof d=="function")return y===void 0?d.call(r,v):d.call(r,v,y)},emitParticle(v){r.emitParticle?.(v)},stopAnimation(){s?.(),s=null},focusOn(v,y){s?.();const d=g();if(!d)return;const b=v.z??0,m=y?.durationMs??1e3;if(i==="2d"){const B=y?.zoom!==void 0?o/Math.max(y.zoom,.001):yt;s=jt(m,S=>{const O=ae(d.x,v.x,S),L=ae(d.y,v.y,S),U=ae(d.z,B,S);r.cameraPosition?.({x:O,y:L,z:U},{x:O,y:L,z:0},0)});return}const x=d.x-v.x,w=d.y-v.y,_=d.z-b,k=Math.hypot(x,w,_),C=y?.distance??120,P=k===0?{x:0,y:0,z:1}:{x:x/k,y:w/k,z:_/k},M={x:v.x+P.x*C,y:v.y+P.y*C,z:b+P.z*C},N={x:v.x,y:v.y,z:b},E=d.lookAt??{x:0,y:0,z:0};s=jt(m,B=>{r.cameraPosition?.({x:ae(d.x,M.x,B),y:ae(d.y,M.y,B),z:ae(d.z,M.z,B)},{x:ae(E.x,N.x,B),y:ae(E.y,N.y,B),z:ae(E.z,N.z,B)},0)})},getCameraState(){const v=g()??{x:0,y:0,z:Qt};if(i==="2d"){const y=v.lookAt??{x:0,y:0},d=o/Math.max(Math.hypot(v.x,v.y,v.z),1);return{mode:"2d",x:y.x,y:y.y,k:d}}return{mode:"3d",x:v.x,y:v.y,z:v.z,lookAt:v.lookAt??{x:0,y:0,z:0}}},setCameraState(v,y){s?.();const d=y??0,b=g()??{x:0,y:0,z:Qt};if(v.mode==="2d"){const x=p(v.k)??yt;if(d<=0){r.cameraPosition?.({x:v.x,y:v.y,z:x},{x:v.x,y:v.y,z:0},0);return}const w=b.lookAt??{x:0,y:0};s=jt(d,_=>{const k=ae(b.x,v.x,_),C=ae(b.y,v.y,_),P=ae(b.z,x,_);r.cameraPosition?.({x:k,y:C,z:P},{x:ae(w.x,v.x,_),y:ae(w.y,v.y,_),z:0},0)});return}if(d<=0){r.cameraPosition?.({x:v.x,y:v.y,z:v.z},v.lookAt,0);return}const m=b.lookAt??v.lookAt;s=jt(d,x=>{r.cameraPosition?.({x:ae(b.x,v.x,x),y:ae(b.y,v.y,x),z:ae(b.z,v.z,x)},{x:ae(m.x,v.lookAt.x,x),y:ae(m.y,v.lookAt.y,x),z:ae(m.z,v.lookAt.z,x)},0)})},applyProps(v,y){$o(r,v,y,"3d")},getCanvasElement(){return e.querySelector("canvas")},destroy(){s?.(),s=null,r._destructor()},setMode(v,y=800){if(v===i)return;i=v,s?.();const d=g()??{x:0,y:0,z:Qt};if(v==="2d"){a={x:d.x,y:d.y,z:d.z,lookAt:d.lookAt??{x:0,y:0,z:0}};const k=r.graphData(),C=new Map;for(const E of k.nodes){const B=E.z;C.set(E,typeof B=="number"?B:0)}const P=d.lookAt??{x:0,y:0,z:0},M={x:P.x,y:P.y,z:0},N={x:P.x,y:P.y,z:yt};s=jt(y,E=>{for(const[B,S]of C)B.z=ae(S,0,E);r.cameraPosition?.({x:ae(d.x,N.x,E),y:ae(d.y,N.y,E),z:ae(d.z,N.z,E)},{x:ae(P.x,M.x,E),y:ae(P.y,M.y,E),z:ae(P.z,M.z,E)},0),E>=1&&(c(),l("2d"),o=yt)});return}f(),l("3d");const b=u(),m=new Map;for(const[k]of b){const C=k.z;m.set(k,typeof C=="number"?C:0)}const x=a??{x:0,y:0,z:Qt,lookAt:{x:0,y:0,z:0}},w=x.lookAt??{x:0,y:0,z:0},_=d.lookAt??{x:0,y:0,z:0};s=jt(y,k=>{for(const[C,P]of b){const M=m.get(C)??0;C.z=ae(M,P,k)}r.cameraPosition?.({x:ae(d.x,x.x,k),y:ae(d.y,x.y,k),z:ae(d.z,x.z,k)},{x:ae(_.x,w.x,k),y:ae(_.y,w.y,k),z:ae(_.z,w.z,k)},0),k>=1&&(r.d3ReheatSimulation?.(),o=Math.hypot(x.x,x.y,x.z))})}};function p(v){return!Number.isFinite(v)||v===0?null:o/v}}function Cg(e){const{mount:t,mode:n,width:r,height:i,data:o,props:a,paused:s,modeTransitionMs:l=800}=e,[c,f]=A.useState(null),u=A.useRef(a);u.current=a;const g=A.useRef(a),h=A.useRef(n);return A.useEffect(()=>{if(!t)return;const p=kg(t,{initialProps:a,initialData:o,width:r,height:i,initialMode:h.current},u);return g.current=a,f(p),()=>{p.destroy(),f(null)}},[t]),A.useEffect(()=>{c&&c.mode!==n&&c.setMode(n,l)},[c,n,l]),A.useEffect(()=>{c&&(s?c.pause():c.resume())},[c,s]),A.useEffect(()=>{c&&c.resize(r,i)},[c,r,i]),A.useEffect(()=>{c&&c.setGraphData(o)},[c,o]),A.useEffect(()=>{c&&(c.applyProps(a,g.current),g.current=a)},[c,a]),c}function Sg(e){const[t,n]=A.useState(null);return A.useEffect(()=>{const r=e.current;if(!r)return;const i=new ResizeObserver(o=>{const a=o[0];if(!a)return;const s=a.contentRect;n({width:s.width,height:s.height})});return i.observe(r),()=>i.disconnect()},[e]),t}function Mg(e){const t=e.mode??"single",[n,r]=A.useState([]),i=A.useRef(e.onChange);i.current=e.onChange;const o=A.useRef(!0);A.useEffect(()=>{if(o.current){o.current=!1;return}i.current?.(n)},[n]);const a=A.useCallback((f,u)=>{t!=="none"&&r(g=>{const h=g.includes(f);return t==="single"||!u?.additive?h&&g.length===1?[]:[f]:h?g.filter(p=>p!==f):[...g,f]})},[t]),s=A.useCallback(f=>{t!=="none"&&r(t==="single"?f.slice(0,1):f)},[t]),l=A.useCallback(()=>r([]),[]),c=A.useCallback(f=>n.includes(f),[n]);return{selected:n,toggle:a,set:s,clear:l,isSelected:c}}function Pg(){const[e,t]=A.useState(!1);return A.useEffect(()=>{const n=o=>{o.key==="Shift"&&t(!0)},r=o=>{o.key==="Shift"&&t(!1)},i=()=>t(!1);return window.addEventListener("keydown",n),window.addEventListener("keyup",r),window.addEventListener("blur",i),()=>{window.removeEventListener("keydown",n),window.removeEventListener("keyup",r),window.removeEventListener("blur",i)}},[]),e}function Og(e,t){A.useEffect(()=>{if(!e)return;const n=new Map;for(const r of t.nodes)n.set(r.id,r),r._neighbors=[],r._links=[];for(const r of t.links){const i=typeof r.source=="object"?r.source.id:r.source,o=typeof r.target=="object"?r.target.id:r.target,a=n.get(i),s=n.get(o);!a||!s||(a._neighbors.push(s),s._neighbors.push(a),a._links.push(r),s._links.push(r))}},[e,t])}function Ag(e){const{mount:t,engineRef:n,selection:r,nodes:i,links:o,setSelectedLinkIds:a,liveHoverNodeIdRef:s}=e,l=A.useRef({selection:r,nodes:i,links:o,setSelectedLinkIds:a,liveHoverNodeIdRef:s});l.current.selection=r,l.current.nodes=i,l.current.links=o,l.current.setSelectedLinkIds=a,l.current.liveHoverNodeIdRef=s;const[c,f]=A.useState(null),u=A.useRef(null),g=A.useRef({x:0,y:0}).current;return A.useEffect(()=>{if(!t)return;let h=t.getBoundingClientRect();const p=()=>{h=t.getBoundingClientRect()},v=new ResizeObserver(p);v.observe(t),window.addEventListener("scroll",p,{passive:!0,capture:!0});const y=x=>{g.x=x.clientX-h.left,g.y=x.clientY-h.top,u.current=g};t.addEventListener("mousemove",y);const d=x=>{if(n.current?.stopAnimation(),x.button!==0||!x.shiftKey||l.current.liveHoverNodeIdRef.current!==null)return;const w=x.clientX-h.left,_=x.clientY-h.top;x.stopPropagation(),x.preventDefault(),f({x0:w,y0:_,x1:w,y1:_,additive:x.shiftKey});const k=P=>{const M=P.clientX-h.left,N=P.clientY-h.top;f(E=>E&&{...E,x1:M,y1:N})},C=P=>{window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",C,!0);const M=P.clientX-h.left,N=P.clientY-h.top;f(null);const E=n.current;if(!E)return;const B=Math.min(w,M),S=Math.min(_,N),O=Math.max(w,M),L=Math.max(_,N);if(O-B<3&&L-S<3)return;const U=l.current,ne=U.nodes,J=U.links,se=U.selection,D=U.setSelectedLinkIds,$=[],G=(F,R)=>F>=B&&F<=O&&R>=S&&R<=L,Z=new Map;for(const F of ne){if(Z.set(F.id,F),F.x===void 0||F.y===void 0)continue;const R=E.graph2Screen(F.x,F.y,F.z);G(R.x,R.y)&&$.push(F.id)}const I=[],H=F=>{if(F&&typeof F=="object"){const R=F;if(R.x!==void 0&&R.y!==void 0)return R.z!==void 0?{x:R.x,y:R.y,z:R.z}:{x:R.x,y:R.y}}if(typeof F=="string"||typeof F=="number"){const R=Z.get(F);if(R&&R.x!==void 0&&R.y!==void 0)return R.z!==void 0?{x:R.x,y:R.y,z:R.z}:{x:R.x,y:R.y}}return null};for(const F of J){if(F.id===void 0)continue;const R=H(F.source),q=H(F.target);if(!R||!q)continue;const V=E.graph2Screen((R.x+q.x)/2,(R.y+q.y)/2,R.z!==void 0&&q.z!==void 0?(R.z+q.z)/2:void 0),re=E.graph2Screen(R.x,R.y,R.z),le=E.graph2Screen(q.x,q.y,q.z);(G(V.x,V.y)||G(re.x,re.y)&&G(le.x,le.y))&&I.push(F.id)}if(P.shiftKey||P.metaKey||P.ctrlKey){const F=se.selected,R=F.slice(),q=new Set(F);for(const V of $)q.has(V)||(q.add(V),R.push(V));se.set(R),D(V=>{const re=V.slice(),le=new Set(V);for(const ce of I)le.has(ce)||(le.add(ce),re.push(ce));return re})}else se.set($),D(I)};window.addEventListener("mousemove",k),window.addEventListener("mouseup",C,!0)};t.addEventListener("mousedown",d,!0);const b=()=>n.current?.stopAnimation(),m=()=>n.current?.stopAnimation();return t.addEventListener("wheel",b,{passive:!0,capture:!0}),t.addEventListener("touchstart",m,{passive:!0,capture:!0}),()=>{t.removeEventListener("mousemove",y),t.removeEventListener("mousedown",d,!0),t.removeEventListener("wheel",b,{capture:!0}),t.removeEventListener("touchstart",m,{capture:!0}),window.removeEventListener("scroll",p,{capture:!0}),v.disconnect()}},[t,n]),{marquee:c,lastCursorRef:u}}const jg=60;function Tg(e,t={}){const n=typeof t=="number"?{tolerancePx:t}:t,r=n.tolerancePx??12,i=n.pressGraceMs??jg;A.useEffect(()=>{if(!e)return;const o=r*r;let a=!1,s=!1,l=0,c=0,f=0;const u=p=>{e.contains(p.target)&&(a=!0,s=!1,l=p.clientX,c=p.clientY,f=performance.now())},g=p=>{if(!a||s)return;if(performance.now()-f<i){p.stopPropagation();return}const v=p.clientX-l,y=p.clientY-c;v*v+y*y<o?p.stopPropagation():s=!0},h=()=>{a=!1,s=!1};return window.addEventListener("pointerdown",u,!0),window.addEventListener("pointermove",g,!0),window.addEventListener("mousemove",g,!0),window.addEventListener("pointerup",h,!0),window.addEventListener("pointercancel",h,!0),window.addEventListener("mouseup",h,!0),()=>{window.removeEventListener("pointerdown",u,!0),window.removeEventListener("pointermove",g,!0),window.removeEventListener("mousemove",g,!0),window.removeEventListener("pointerup",h,!0),window.removeEventListener("pointercancel",h,!0),window.removeEventListener("mouseup",h,!0)}},[e,r,i])}function Eg(e){const{enableClipboard:t,dataApi:n,selection:r,setSelectedLinkIds:i,engineRef:o,lastCursorRef:a,onCopy:s,onCut:l,onPaste:c}=e,f=A.useRef([]),u=A.useCallback(()=>{const m=new Set(r.selected),x=[];for(const w of n.data.nodes){if(!m.has(w.id))continue;const{id:_,x:k,y:C,z:P,vx:M,vy:N,vz:E,fx:B,fy:S,fz:O,...L}=w;x.push(L)}return x},[n.data.nodes,r.selected]),g=A.useCallback(()=>{if(!t)return[];const m=new Set(r.selected),x=n.data.nodes.filter(w=>m.has(w.id));return f.current=u(),s?.(x),x},[t,n.data.nodes,r.selected,u,s]),h=A.useCallback(()=>{if(!t)return[];const m=new Set(r.selected),x=n.data.nodes.filter(w=>m.has(w.id));return f.current=u(),l?.(x),r.selected.length>0&&(n.removeNodes(r.selected),r.clear()),x},[t,n,r,u,l]),p=A.useCallback(m=>{if(!t)return[];const x=f.current;if(x.length===0)return[];const w=m||(()=>{const k=a.current;if(!(!k||!o.current))return o.current.screen2Graph(k.x,k.y)})(),_=n.addNodes(x.map((k,C)=>{const P=C%3*24,M=Math.floor(C/3)*24;return{...k,...w?{x:w.x+P,y:w.y+M,...w.z!==void 0?{z:w.z+M}:{}}:{}}}));return r.set(_.map(k=>k.id)),i([]),c?.(_),_},[t,n,r,i,c,o,a]),v=A.useCallback(()=>{const m=new Set(r.selected),x=[];let w=0;for(const k of n.data.nodes){if(!m.has(k.id))continue;const{id:C,vx:P,vy:M,vz:N,fx:E,fy:B,fz:S,...O}=k,L=w%3*24,U=Math.floor(w/3)*24;x.push({...O,...k.x!==void 0?{x:k.x+L}:{},...k.y!==void 0?{y:k.y+U}:{},...k.z!==void 0?{z:k.z}:{}}),w++}if(x.length===0)return[];const _=n.addNodes(x);return r.set(_.map(k=>k.id)),i([]),_},[n,r,i]),y=A.useCallback(m=>{const x=r.selected;if(x.length===0)return null;const w=n.data.nodes.filter(P=>x.includes(P.id));if(w.length===0)return null;let _=m?.at;if(!_){let P=0,M=0,N=0,E=!1;for(const B of w)P+=B.x??0,M+=B.y??0,N+=B.z??0,(B.x!==void 0||B.y!==void 0)&&(E=!0);E&&(_={x:P/w.length+30,y:M/w.length+30,z:N/w.length})}const k=m?.label!==void 0?{label:m.label}:{},C=n.addNode(k,_?{at:_}:void 0);for(const P of w)n.addLink({source:P.id,target:C.id});return r.set([C.id]),i([]),C},[n,r,i]),d=A.useCallback(m=>{const x=n.data.nodes.find(w=>w.id===m);x&&(x.fx!==void 0?n.updateNode(m,{fx:void 0,fy:void 0,fz:void 0}):n.updateNode(m,{fx:x.x,fy:x.y,...x.z!==void 0?{fz:x.z}:{}}))},[n]),b=A.useCallback(()=>f.current.length>0,[]);return A.useMemo(()=>({hasClipboard:b,copy:g,cut:h,paste:p,duplicate:v,addConnectedNode:y,togglePin:d}),[b,g,h,p,v,y,d])}function Lg(e){const t=A.useRef(e);t.current=e,A.useEffect(()=>{const n=r=>{const i=r.target;if(i&&(i.tagName==="INPUT"||i.tagName==="TEXTAREA"||i.isContentEditable))return;const a=t.current;switch(r.key){case"v":case"V":a.enableClipboard&&(r.metaKey||r.ctrlKey)?(a.paste(),r.preventDefault()):a.setActiveTool("select");break;case"h":case"H":a.setActiveTool("pan");break;case"n":case"N":a.setActiveTool("add-node");break;case"l":case"L":a.setActiveTool("add-link");break;case"f":case"F":a.engine?.fit(400,40);break;case"3":a.setMode(a.mode==="2d"?"3d":"2d");break;case"Backspace":case"Delete":if(a.selection.selected.length>0&&(a.dataApi.removeNodes(a.selection.selected),a.selection.clear(),r.preventDefault()),a.selectedLinkIds.length>0){const s=new Set(a.selectedLinkIds);a.dataApi.removeLink(l=>l.id!==void 0&&s.has(l.id)),a.setSelectedLinkIds([]),r.preventDefault()}break;case"a":case"A":(r.metaKey||r.ctrlKey)&&(a.selection.set(a.dataApi.data.nodes.map(s=>s.id)),a.setSelectedLinkIds(a.dataApi.data.links.map(s=>s.id).filter(s=>s!==void 0)),r.preventDefault());break;case"c":case"C":a.enableClipboard&&(r.metaKey||r.ctrlKey)&&a.copy();break;case"x":case"X":a.enableClipboard&&(r.metaKey||r.ctrlKey)&&(a.cut(),r.preventDefault());break;case"d":case"D":(r.metaKey||r.ctrlKey)&&(a.duplicate(),r.preventDefault());break;case"p":case"P":for(const s of a.selection.selected)a.togglePin(s);break;case"Enter":a.selection.selected.length>0&&(a.addConnectedNode(),r.preventDefault());break;case"Escape":a.selection.clear(),a.setSelectedLinkIds([]),a.setLinkSourceId(null);break}};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[])}function Ng(e){const{engine:t,collideNodes:n,beeswarm:r,nodeRelSize:i}=e;A.useEffect(()=>{if(!t||r)return;if(!n){t.d3Force("collide",null);return}const o=typeof n=="number"?n:(i??4)+2;return t.d3Force("collide",Xi(o)),t.reheat(),()=>{t.d3Force("collide",null)}},[t,n,i,r]),A.useEffect(()=>{if(!t)return;if(!r){t.d3Force("x",null),t.d3Force("y",null);return}const o=r===!0?{}:r,a=o.axis??"x",s=o.strength??.2,l=o.value,c=g=>{const h=String(g);let p=0;for(let v=0;v<h.length;v++)p=p*31+h.charCodeAt(v)|0;return(p%600+600)%600-300},f=g=>{const h=g;if(typeof l=="function")return l(h);if(typeof l=="string"){const p=h[l];if(typeof p=="number")return p;if(typeof p=="string")return Number(p)||0}return c(h.id)};t.d3Force("center",null),t.d3Force("charge",null),a==="x"?(t.d3Force("x",to(f)),t.d3Force("y",no(0).strength(s))):(t.d3Force("y",no(f)),t.d3Force("x",to(0).strength(s)));const u=(i??4)+2;t.d3Force("collide",Xi(u)),t.reheat()},[t,r,i])}function Dt(e,t){return typeof e=="function"?e(t):typeof e=="string"?t[e]:e}function Ho(e,t){const n=Dt(e,t);return typeof n=="string"?n:typeof HTMLElement<"u"&&n instanceof HTMLElement?n.textContent??"":n!=null?String(n):typeof t.label=="string"&&t.label.length>0?t.label:t.id!==void 0?String(t.id):""}function Uo(e,t){const n=Dt(e,t);if(typeof n=="string")return n;if(typeof HTMLElement<"u"&&n instanceof HTMLElement)return n.textContent??"";if(n!=null)return String(n);if(typeof t.label=="string"&&t.label.length>0)return t.label;const r=t.source,i=t.target,o=typeof r=="object"&&r!==null?r.id:r,a=typeof i=="object"&&i!==null?i.id:i;return o===void 0&&a===void 0?"":`${o??""} → ${a??""}`}function Zt(e,t){if(e.startsWith("#")){const i=e.slice(1),o=i.length===3?i.split("").map(a=>a+a).join(""):i;if(o.length===6){const a=parseInt(o.slice(0,2),16),s=parseInt(o.slice(2,4),16),l=parseInt(o.slice(4,6),16);return`rgba(${a}, ${s}, ${l}, ${t})`}}const n=e.match(/^rgb\(([^)]+)\)$/);if(n)return`rgba(${n[1]}, ${t})`;const r=e.match(/^rgba\(([^,]+),([^,]+),([^,]+),[^)]+\)$/);return r?`rgba(${r[1]},${r[2]},${r[3]},${t})`:e}const Tt=new Set;function Rg(e){const{mode:t,accentColor:n,nodeColor:r,linkColor:i,linkWidth:o,nodeVal:a,nodeRelSize:s,nodePointerAreaPaint:l,nodeAutoColorBy:c,nodeVisibility:f,selectedNodeSet:u,selectedLinkSet:g,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:v,hoverNodeId:y,hoverLinkId:d,hiddenGroups:b}=e,m=A.useRef({mode:t,accentColor:n,selectedNodeSet:u,selectedLinkSet:g,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:v,hoverNodeId:y,hoverLinkId:d,hiddenGroups:b});m.current={mode:t,accentColor:n,selectedNodeSet:u,selectedLinkSet:g,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:v,hoverNodeId:y,hoverLinkId:d,hiddenGroups:b};const x=u.size>0||g.size>0||h&&p.size>0,w=A.useMemo(()=>{const z=r;return F=>{const R=m.current;if(F.id!==void 0&&R.selectedNodeSet.has(F.id))return R.accentColor;if(R.highlightNeighborsOnHover&&R.highlightedNodeIds.size>0&&F.id!==void 0&&R.highlightedNodeIds.has(F.id))return R.hoverNodeId===F.id?R.accentColor:Zt(R.accentColor,.7);let V;return typeof z=="function"?V=z(F):typeof z=="string"?V=z:V=F.color??"#888",(R.selectedNodeSet.size>0||R.selectedLinkSet.size>0)&&R.mode!=="3d"?Zt(V,.25):V}},[r,u,g,y,p]),_=x?w:r,k=c!==void 0&&b.size>0,C=u.size>0||g.size>0||d!==null||h&&v.size>0||k,P="rgba(96, 102, 110, 0.55)",M="rgba(180, 188, 198, 0.55)",N=A.useMemo(()=>{const z=i,F=c;return R=>{const q=m.current,V=R.id,re=typeof R.source=="object"?R.source:null,le=typeof R.target=="object"?R.target:null;if(q.hiddenGroups.size>0&&F!==void 0){const xt=Be=>{if(!Be)return null;const ve=typeof F=="function"?F(Be):Be[F];return ve==null?null:String(ve)},dn=xt(re),hn=xt(le);if(dn!==null&&q.hiddenGroups.has(dn)||hn!==null&&q.hiddenGroups.has(hn)){let Be;return typeof z=="function"?Be=z(R):typeof z=="string"?Be=z:Be=R.color??P,Zt(Be,.05)}}if(V!==void 0&&q.selectedLinkSet.has(V))return q.accentColor;const ce=re?.id??R.source,Se=le?.id??R.target,me=q.selectedNodeSet.size>0;if(me&&(ce!==void 0&&q.selectedNodeSet.has(ce)||Se!==void 0&&q.selectedNodeSet.has(Se)))return Zt(q.accentColor,.85);const ze=V!==void 0&&q.hoverLinkId===V,Ke=q.highlightNeighborsOnHover&&V!==void 0&&q.highlightedLinkIds.has(V);if(ze||Ke)return M;let Fe;return typeof z=="function"?Fe=z(R):typeof z=="string"?Fe=z:Fe=R.color??P,me||q.selectedLinkSet.size>0?Zt(Fe,q.mode==="3d"?.45:.18):Fe}},[i,c,g,u,d,v,b]),E=C?N:i,B=u.size>0||g.size>0||d!==null||h&&v.size>0,S=.6,O=1.5,L=.4,U=1,ne=.5,J=1.2,se=A.useMemo(()=>{const z=o;return F=>{const R=m.current,q=F.id,V=q!==void 0&&R.selectedLinkSet.has(q),re=typeof F.source=="object"?F.source.id:F.source,le=typeof F.target=="object"?F.target.id:F.target,Se=R.selectedNodeSet.size>0&&(re!==void 0&&R.selectedNodeSet.has(re)||le!==void 0&&R.selectedNodeSet.has(le)),me=q!==void 0&&R.hoverLinkId===q,Te=R.highlightNeighborsOnHover&&q!==void 0&&R.highlightedLinkIds.has(q),ze=me||Te,Ke=typeof z=="function"?z(F):typeof z=="number"?z:F.width??1,Fe=R.mode==="3d";return V?Ke+(Fe?ne:J):ze?Ke+(Fe?S:O):Se?Ke+(Fe?L:U):Ke}},[o]),D=B?se:o,$=u.size>0||h&&p.size>0,G=A.useMemo(()=>{const z=a;return F=>{const R=m.current,q=F.id,V=typeof z=="function"?z(F):typeof z=="number"?z:F.val??1;return q!==void 0&&R.selectedNodeSet.has(q)?V*2.25:R.highlightNeighborsOnHover&&R.highlightedNodeIds.size>0&&q!==void 0&&R.highlightedNodeIds.has(q)?R.hoverNodeId===q?V*1.8:V*1.4:V}},[a]),Z=$?G:a,I=A.useMemo(()=>{if(t!=="2d"||l)return l;const z=a,F=s??4;return(R,q,V,re)=>{const le=typeof z=="function"?z(R):typeof z=="number"?z:R.val??1,ce=Math.sqrt(Math.max(0,le))*F+1/Math.max(re,1e-6);V.fillStyle=q,V.beginPath(),V.arc(R.x??0,R.y??0,ce,0,2*Math.PI,!1),V.fill()}},[t,a,s,l]),H=A.useMemo(()=>{const z=c&&b.size>0;if(!z&&f===void 0)return;const F=c,R=f;return q=>{if(z&&F){const V=typeof F=="function"?F(q):q[F];if(V!=null&&b.has(String(V)))return!1}return typeof R=="function"?!!R(q):typeof R=="boolean"?R:typeof R=="string"?!!q[R]:!0}},[c,f,b]);return A.useMemo(()=>({nodeColor:_,linkColor:E,linkWidth:D,nodeVal:Z,nodePointerAreaPaint:I,nodeVisibility:H}),[_,E,D,Z,I,H])}const qo=250;function Vo(e){return e==null?null:typeof e=="string"||typeof HTMLElement<"u"&&e instanceof HTMLElement?e:String(e)}function Ig(e){const{highlightNeighborsOnHover:t,nodeLabel:n,linkLabel:r,onNodeHover:i,onLinkHover:o}=e,[a,s]=A.useState(null),[l,c]=A.useState(null),[f,u]=A.useState(Tt),[g,h]=A.useState(Tt),[p,v]=A.useState(null),y=A.useRef(null),d=A.useRef(null),b=A.useRef(null),m=A.useRef(null),x=A.useRef(null);A.useEffect(()=>()=>{m.current!==null&&(clearTimeout(m.current),m.current=null),x.current!==null&&(clearTimeout(x.current),x.current=null)},[]);const w=A.useCallback((M,N)=>{if(i?.(M,N),y.current=M?.id??null,!M&&b.current!==null)return;if(m.current!==null&&(clearTimeout(m.current),m.current=null),!M){m.current=setTimeout(()=>{m.current=null,s(null),t&&(u(Tt),h(Tt)),d.current===null&&v(null)},qo);return}if(t){const B=new Set([M.id]),S=new Set,O=M._neighbors??[];for(const U of O)U.id!==void 0&&B.add(U.id);const L=M._links??[];for(const U of L)U.id!==void 0&&S.add(U.id);s(M.id),u(B),h(S)}else s(M.id);const E=Dt(n,M);v(Vo(E))},[i,n,t]),_=A.useCallback((M,N)=>{if(o?.(M,N),d.current=M?.id??null,x.current!==null&&(clearTimeout(x.current),x.current=null),!M){x.current=setTimeout(()=>{x.current=null,c(null),y.current===null&&v(null)},qo);return}c(M.id??null);const E=Dt(r,M);v(Vo(E))},[o,r]),k=A.useMemo(()=>a===null?Tt:t?f:new Set([a]),[a,t,f]),C=A.useMemo(()=>{if(l!==null){if(t&&a!==null){const M=new Set(g);return M.add(l),M}return new Set([l])}return a!==null&&t?g:Tt},[l,a,t,g]),P=A.useCallback(M=>{if(b.current=M?.id??null,M){w(M,null);return}w(null,null)},[w]);return{hoverNodeId:a,hoverLinkId:l,liveHoverNodeIdRef:y,liveHoverLinkIdRef:d,highlightedNodeIds:f,highlightedLinkIds:g,hoveredNodeSet:k,hoveredLinkSet:C,tooltipContent:p,handleNodeHover:w,handleLinkHover:_,pinHover:P}}const lt={frameId:-1,fov:-1,tanHalfFov:0,canvasHeightPx:1},Go=new K.Vector2;function Dg(e,t){const n=e.info?.render?.frame??-1;return n===lt.frameId&&t===lt.fov||(e.getSize(Go),lt.frameId=n,lt.fov=t,lt.tanHalfFov=Math.tan(t*Math.PI/180/2),lt.canvasHeightPx=Go.y||1),lt}function Fn(e){const t=e.material,n=e.userData;n.normalTexture&&n.normalTexture.dispose(),n.selectedTexture&&n.selectedTexture.dispose(),t.dispose(),e.parent&&e.parent.remove(e)}function Bn(e){const{text:t,fontSize:n=32,fontFamily:r="system-ui, sans-serif",color:i="#ffffff",backgroundColor:o="rgba(28, 31, 35, 0.85)",padding:a=8,worldHeight:s=4}=e,c=document.createElement("canvas").getContext("2d");if(!c)return new K.Sprite(new K.SpriteMaterial);c.font=`${n}px ${r}`;const f=Math.ceil(c.measureText(t).width),u=Math.ceil(n*1.2),g=f+a*2,h=u+a*2,p=(_,k,C)=>{_.width=g,_.height=h;const P=_.getContext("2d");if(P.font=`${n}px ${r}`,C){P.fillStyle=C;const M=Math.min(_.height/2,8),N=P;P.beginPath(),typeof N.roundRect=="function"?N.roundRect(0,0,_.width,_.height,M):P.rect(0,0,_.width,_.height),P.fill()}P.fillStyle=k,P.textAlign="center",P.textBaseline="middle",P.fillText(t,_.width/2,_.height/2)},v=document.createElement("canvas");p(v,i,o);const y=new K.CanvasTexture(v);y.minFilter=K.LinearFilter,y.magFilter=K.LinearFilter,y.needsUpdate=!0;let d;if(e.selectedColor!==void 0&&e.selectedBackgroundColor!==void 0){const _=document.createElement("canvas");p(_,e.selectedColor,e.selectedBackgroundColor),d=new K.CanvasTexture(_),d.minFilter=K.LinearFilter,d.magFilter=K.LinearFilter,d.needsUpdate=!0}const b=new K.SpriteMaterial({map:y,transparent:!0,depthWrite:!1}),m=new K.Sprite(b),x=m.userData;x.normalTexture=y,d&&(x.selectedTexture=d);const w=g/h;if(m.scale.set(s*w,s,1),e.pixelHeight!==void 0&&e.pixelHeight>0){const _=e.pixelHeight,k=new K.Vector3;let C=-1;m.onBeforeRender=(P,M,N)=>{const E=N;if(!E.isPerspectiveCamera||typeof E.fov!="number")return;m.getWorldPosition(k);const B=E.position.distanceTo(k);if(B<=0)return;const S=Dg(P,E.fov),O=2*S.tanHalfFov*B*_/S.canvasHeightPx;C>0&&Math.abs(O-C)<C*.005||(C=O,m.scale.set(O*w,O,1))}}return m}function zg(e){const{mode:t,showLabels:n,selectedNodeSet:r,hoveredNodeSet:i,accentColor:o,hostNodeCanvasObject:a,hostNodeThreeObject:s,nodeLabel:l,nodeVal:c,nodeRelSize:f,theme:u}=e,g=u?.tooltipBackground??"rgba(28, 31, 35, 0.9)",h=u?.tooltipForeground??"#ffffff",p=A.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:i,accentColor:o,tooltipBg:g,tooltipFg:h});p.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:i,accentColor:o,tooltipBg:g,tooltipFg:h};const v=A.useMemo(()=>{if(t!=="2d"||a)return;const _=u?.fontFamily??"system-ui, sans-serif";return(k,C,P)=>{const M=p.current,N=k.id!==void 0&&M.selectedNodeSet.has(k.id),E=k.id!==void 0&&M.hoveredNodeSet?.has(k.id)===!0;if(!M.showLabels&&!N&&!E)return;const B=Ho(l,k);if(!B)return;const S=Dt(c,k)??1,O=f??4,L=Math.max(.5,Math.sqrt(Math.max(S,0))*O),U=14/P,ne=6/P,J=4/P;C.font=`${U}px ${_}`;const D=C.measureText(B).width+ne*2,$=U+J*2,G=k.x??0,Z=(k.y??0)-L*2-4/P-$;C.fillStyle=N?M.accentColor:M.tooltipBg;const I=Math.min($/2,6/P),H=C;C.beginPath(),typeof H.roundRect=="function"?H.roundRect(G-D/2,Z,D,$,I):C.rect(G-D/2,Z,D,$),C.fill(),C.textAlign="center",C.textBaseline="top",C.fillStyle=N?"#ffffff":M.tooltipFg,C.fillText(B,G,Z+J)}},[t,a,l,c,f,u?.fontFamily]),y=i?.size??0,b=n||r.size>0||y>0?v:void 0,m=A.useRef(new Map),x=A.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:i});x.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:i},A.useEffect(()=>{const _=m.current;return()=>{for(const k of _.values())k.sprite&&Fn(k.sprite);_.clear()}},[]);const w=A.useMemo(()=>{if(s)return;const _=m.current,k=u?.fontFamily??"system-ui, sans-serif";return C=>{const P=C.id,M=Ho(l,C),N=Dt(c,C)??1,E=f??4,S=Math.cbrt(Math.max(N,0))*E*2+4,O=new K.Group;if(P!==void 0&&M){const L={group:O,sprite:null,text:M,yOffset:S};_.set(P,L);const U=x.current,ne=U.selectedNodeSet.has(P),J=U.hoveredNodeSet?.has(P)===!0;if(U.showLabels||ne||J){const se=Bn({text:M,fontFamily:k,fontSize:48,color:h,backgroundColor:g,selectedColor:"#ffffff",selectedBackgroundColor:o,pixelHeight:28});if(se.material.depthTest=!1,se.renderOrder=1e3,se.position.set(0,S,0),ne){const D=se.userData;if(D.selectedTexture){const $=se.material;$.map=D.selectedTexture,$.needsUpdate=!0}}O.add(se),L.sprite=se}}return O}},[s,l,c,f,u?.fontFamily,g,h,o]);return A.useEffect(()=>{const _=m.current,k=u?.fontFamily??"system-ui, sans-serif";for(const[C,P]of _){if(P.group.parent===null){P.sprite&&Fn(P.sprite),_.delete(C);continue}const M=r.has(C),N=i?.has(C)===!0,E=n||M||N;if(E&&P.sprite===null){const S=Bn({text:P.text,fontFamily:k,fontSize:48,color:h,backgroundColor:g,selectedColor:"#ffffff",selectedBackgroundColor:o,pixelHeight:28});S.material.depthTest=!1,S.renderOrder=1e3,S.position.set(0,P.yOffset,0),P.group.add(S),P.sprite=S}const B=P.sprite;if(B){B.visible=E;const S=B.userData,O=M&&S.selectedTexture?S.selectedTexture:S.normalTexture,L=B.material;O&&L.map!==O&&(L.map=O,L.needsUpdate=!0)}}},[n,r,i,o,g,h,u?.fontFamily]),{canvasObject:b,threeObject:w,renderFramePost:void 0}}function Fg(e){const{mode:t,showLabels:n,selectedLinkSet:r,hoveredLinkSet:i,accentColor:o,hostLinkCanvasObject:a,hostLinkThreeObject:s,hostLinkPositionUpdate:l,linkLabel:c,theme:f}=e,u=f?.tooltipBackground??"rgba(255, 255, 255, 0.94)",g=f?.tooltipForeground??"#1c1f23",h=A.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:i,accentColor:o,tooltipBg:u,tooltipFg:g});h.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:i,accentColor:o,tooltipBg:u,tooltipFg:g};const p=A.useMemo(()=>{if(t!=="2d"||a)return;const _=f?.fontFamily??"system-ui, sans-serif",k=4,C=6;return(P,M)=>{const N=h.current,E=P.id!==void 0&&N.selectedLinkSet.has(P.id),B=P.id!==void 0&&N.hoveredLinkSet?.has(P.id)===!0;if(!N.showLabels&&!E&&!B)return;const S=P.source,O=P.target;if(typeof S!="object"||typeof O!="object")return;const L=Uo(c,P);if(!L||L===" → ")return;const U=S.x,ne=S.y,J=O.x,se=O.y;if(U===void 0||ne===void 0||J===void 0||se===void 0)return;const D=J-U,$=se-ne,Z=Math.sqrt(D*D+$*$)-C*2;if(Z<=0)return;M.font=`1px ${_}`;const I=M.measureText(L).width||1,H=Math.min(k,Z/I);M.font=`${H}px ${_}`;let z=Math.atan2($,D);z>Math.PI/2&&(z=-(Math.PI-z)),z<-Math.PI/2&&(z=-(-Math.PI-z));const F=(U+J)/2,R=(ne+se)/2,q=M.measureText(L).width,V=H*.6,re=H*.35,le=q+V,ce=H+re,Se=Math.min(ce/2,H*.35);M.save(),M.translate(F,R),M.rotate(z),M.fillStyle=E?N.accentColor:N.tooltipBg;const me=M;M.beginPath(),typeof me.roundRect=="function"?me.roundRect(-le/2,-ce/2,le,ce,Se):M.rect(-le/2,-ce/2,le,ce),M.fill(),M.textAlign="center",M.textBaseline="middle",M.fillStyle=E?"#ffffff":N.tooltipFg,M.fillText(L,0,0),M.restore()}},[t,a,c,f?.fontFamily]),v=i?.size??0,d=n||r.size>0||v>0?p:void 0,b=A.useRef(new Map),m=A.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:i});m.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:i},A.useEffect(()=>{const _=b.current;return()=>{for(const k of _.values())k.sprite&&Fn(k.sprite);_.clear()}},[]);const x=A.useMemo(()=>{if(s)return;const _=b.current,k=f?.fontFamily??"system-ui, sans-serif";return C=>{const P=Uo(c,C),M=new K.Group,N=C.id;if(N!==void 0&&P&&P!==" → "){const E={group:M,sprite:null,text:P};_.set(N,E);const B=m.current,S=B.selectedLinkSet.has(N),O=B.hoveredLinkSet?.has(N)===!0;if(B.showLabels||S||O){const L=Bn({text:P,fontFamily:k,fontSize:48,color:g,backgroundColor:u,selectedColor:"#ffffff",selectedBackgroundColor:o,pixelHeight:22});if(L.material.depthTest=!1,L.renderOrder=500,S){const U=L.userData;if(U.selectedTexture){const ne=L.material;ne.map=U.selectedTexture,ne.needsUpdate=!0}}M.add(L),E.sprite=L}}return M}},[s,c,f?.fontFamily,u,g,o]);A.useEffect(()=>{const _=b.current,k=f?.fontFamily??"system-ui, sans-serif";for(const[C,P]of _){if(P.group.parent===null){P.sprite&&Fn(P.sprite),_.delete(C);continue}const M=r.has(C),N=i?.has(C)===!0,E=n||M||N;if(E&&P.sprite===null){const S=Bn({text:P.text,fontFamily:k,fontSize:48,color:g,backgroundColor:u,selectedColor:"#ffffff",selectedBackgroundColor:o,pixelHeight:22});S.material.depthTest=!1,S.renderOrder=500,P.group.add(S),P.sprite=S}const B=P.sprite;if(B){B.visible=E;const S=B.userData,O=M&&S.selectedTexture?S.selectedTexture:S.normalTexture,L=B.material;O&&L.map!==O&&(L.map=O,L.needsUpdate=!0)}}},[n,r,i,o,u,g,f?.fontFamily]);const w=A.useMemo(()=>{if(l!=null)return;const _=t==="2d";return(k,C)=>{if(k instanceof K.Group){const P=(C.start.x+C.end.x)/2,M=(C.start.y+C.end.y)/2,N=(C.start.z+C.end.z)/2;k.position.set(P,M,N);const E=k.parent;if(E&&!E.userData.lgcOrderApplied){E.userData.lgcOrderApplied=!0,E.renderOrder=-1;for(const S of E.children)S!==k&&(S.renderOrder=-1)}const B=k.children[0];if(B instanceof K.Sprite){const S=B.material;if(_){const O=C.end.x-C.start.x,L=C.end.y-C.start.y;let U=Math.atan2(L,O);U>Math.PI/2?U-=Math.PI:U<-Math.PI/2&&(U+=Math.PI),Math.abs(S.rotation-U)>.001&&(S.rotation=U)}else S.rotation!==0&&(S.rotation=0)}}return!0}},[t,l]);return{canvasObject:d,threeObject:x,positionUpdate:w}}function Bg({nodeCount:e,linkCount:t}){const n=e+t*.5;return n>=5e4?"huge":n>=1e4?"xlarge":n>=2e3?"large":"default"}function $g(e,t){if(e==="default")return{};const n={cooldownTicks:e==="large"?100:e==="xlarge"?60:30,d3AlphaDecay:e==="large"?.04:e==="xlarge"?.08:.15,d3VelocityDecay:e==="huge"?.6:.4,linkHoverPrecision:e==="large"?4:2,warmupTicks:0,linkDirectionalParticles:0,linkDirectionalArrowLength:0};return n.forceEngine="ngraph",n.nodeResolution=e==="large"?8:e==="xlarge"?4:3,n.linkResolution=e==="large"?4:0,n.nodeOpacity=1,n.linkOpacity=1,n.pointerRaycasterThrottleMs=e==="large"?32:e==="xlarge"?100:200,n}function Hg(e){const{profile:t="auto",nodeCount:n,linkCount:r,mode:i}=e;return A.useMemo(()=>{if(t==="off")return{};const o=t==="auto"?Bg({nodeCount:n,linkCount:r}):t;return $g(o)},[t,n,r,i])}function Ug(e){const{ref:t,dataApi:n,selection:r,engine:i,mode:o,setMode:a,setPaused:s,clipboard:l,exportJSON:c,importJSON:f,downloadJSON:u}=e;A.useImperativeHandle(t,()=>({getData:()=>n.data,setData:n.setData,addNode:n.addNode,addNodes:n.addNodes,updateNode:n.updateNode,removeNode:n.removeNode,removeNodes:n.removeNodes,addLink:n.addLink,addLinks:n.addLinks,removeLink:n.removeLink,clear:n.clear,getSelection:()=>r.selected,setSelection:r.set,selectAll:()=>r.set(n.data.nodes.map(g=>g.id)),clearSelection:r.clear,getMode:()=>o,setMode:a,fit:(g,h)=>i?.fit(g,h),centerAt:(g,h,p,v)=>i?.centerAt(g,h,p,v),zoom:(g,h)=>i?.zoom(g,h),zoomIn:(g=1.2)=>{i&&i.zoom((i.getZoom?.()??1)*g,200)},zoomOut:(g=1.2)=>{i&&i.zoom((i.getZoom?.()??1)/g,200)},pause:()=>{i?.pause(),s(!0)},resume:()=>{i?.resume(),s(!1)},reheat:()=>i?.reheat(),screenshot:async()=>{const g=i?.getCanvasElement();return g?new Promise(h=>g.toBlob(p=>h(p))):null},copy:l.copy,cut:l.cut,paste:g=>l.paste(g?.at),duplicate:l.duplicate,addConnectedNode:l.addConnectedNode,togglePin:l.togglePin,exportJSON:c,importJSON:f,downloadJSON:u,d3Force:(g,h)=>i?.d3Force(g,h),emitParticle:g=>i?.emitParticle(g),stopAnimation:()=>i?.stopAnimation(),engine2D:()=>i?.mode==="2d"?i:null,engine3D:()=>i?.mode==="3d"?i:null}),[t,n,i,o,a,s,r,l,c,f,u])}const we={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},qg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M3 2.5l4 10 1.4-3.6 3.6-1.4z"})}),Vg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M8 3v10M3 8h10M5 5l6 6M11 5L5 11"})}),Gg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"6",cy:"8",r:"3"}),T.jsx("path",{d:"M12 5v6M9 8h6"})]}),Wg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"4",cy:"4",r:"2"}),T.jsx("circle",{cx:"12",cy:"12",r:"2"}),T.jsx("path",{d:"M5.5 5.5l5 5"})]}),_s=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M3 5h10M6 5V3h4v2M5 5l1 8h4l1-8"})}),Xg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M3 6V3h3M13 6V3h-3M3 10v3h3M13 10v3h-3"})}),Yg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"7",cy:"7",r:"4"}),T.jsx("path",{d:"M5 7h4M7 5v4M10 10l3 3"})]}),Kg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"7",cy:"7",r:"4"}),T.jsx("path",{d:"M5 7h4M10 10l3 3"})]}),Qg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M6 3v10M10 3v10"})}),Zg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M5 3l8 5-8 5z"})}),Jg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("path",{d:"M3 5h2l1-2h4l1 2h2v8H3z"}),T.jsx("circle",{cx:"8",cy:"9",r:"2.5"})]}),xs=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("path",{d:"M8 2l5 3v6l-5 3-5-3V5z"}),T.jsx("path",{d:"M8 8v7M8 8L3 5M8 8l5-3"})]}),ev=e=>T.jsx("svg",{...we,...e,children:T.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),ws=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),T.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"})]}),tv=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",strokeDasharray:"2 2"}),T.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor"}),T.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"currentColor"}),T.jsx("circle",{cx:"6",cy:"10",r:"1",fill:"currentColor"}),T.jsx("circle",{cx:"10",cy:"10",r:"1",fill:"currentColor"})]}),nv=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("path",{d:"M8 2v8M5 5l3-3 3 3"}),T.jsx("path",{d:"M3 12h10v2H3z"})]}),rv=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("path",{d:"M8 10V2M5 7l3 3 3-3"}),T.jsx("path",{d:"M3 12h10v2H3z"})]}),iv=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"4",cy:"8",r:"2"}),T.jsx("path",{d:"M6 8h2.5"}),T.jsx("circle",{cx:"11",cy:"8",r:"2"}),T.jsx("path",{d:"M11 6.5v3M9.5 8h3"})]}),ks={select:{id:"select",label:"Select",hint:"Select / multi-select nodes",icon:qg,toggleable:!0,shortcut:"V"},pan:{id:"pan",label:"Pan",hint:"Pan the canvas",icon:Vg,toggleable:!0,shortcut:"H"},"add-node":{id:"add-node",label:"Add node",hint:"Click on the canvas to add a node",icon:Gg,toggleable:!0,shortcut:"N"},"add-link":{id:"add-link",label:"Add link",hint:"Click two nodes to connect them",icon:Wg,toggleable:!0,shortcut:"L"},delete:{id:"delete",label:"Delete",hint:"Delete selected node(s)",icon:_s,shortcut:"⌫"},fit:{id:"fit",label:"Fit",hint:"Fit graph to viewport",icon:Xg,shortcut:"F"},"zoom-in":{id:"zoom-in",label:"Zoom in",hint:"Zoom in",icon:Yg,shortcut:"+"},"zoom-out":{id:"zoom-out",label:"Zoom out",hint:"Zoom out",icon:Kg,shortcut:"-"},pause:{id:"pause",label:"Pause",hint:"Pause simulation",icon:Qg},resume:{id:"resume",label:"Resume",hint:"Resume simulation",icon:Zg},screenshot:{id:"screenshot",label:"Screenshot",hint:"Download a PNG of the canvas",icon:Jg},"toggle-mode":{id:"toggle-mode",label:"2D / 3D",hint:"Toggle between 2D and 3D",icon:xs,shortcut:"3"},duplicate:{id:"duplicate",label:"Duplicate",hint:"Duplicate the current selection",icon:ws,shortcut:"⌘D"},"select-all":{id:"select-all",label:"Select all",hint:"Select every node",icon:tv,shortcut:"⌘A"},"export-json":{id:"export-json",label:"Export",hint:"Download the graph as JSON",icon:nv},"import-json":{id:"import-json",label:"Import",hint:"Load a JSON graph from disk",icon:rv}},Ur=["select","pan","add-node","add-link","select-all","fit","zoom-in","zoom-out","pause","resume","screenshot","export-json","import-json"];function Cs(e){return e==="2d"?xs:ev}function ov(e,t){if(e===!1)return[];let n;if(e===!0)n=Ur;else if(Array.isArray(e))n=e;else{const r=e.include??Ur,i=new Set(e.exclude??[]);n=r.filter(o=>!i.has(o))}return n.filter(r=>r==="pause"?!t:r==="resume"?t:!0)}function av(e){return e&&typeof e=="object"&&!Array.isArray(e)?e.position??"top-right":"top-right"}function sv(e){const{config:t,activeTool:n,paused:r,mode:i,isDisabled:o,onSelect:a}=e,s=ov(t,r);if(s.length===0)return null;const l=av(t);return T.jsx("div",{className:`lgc-toolbar lgc-toolbar--${l}`,role:"toolbar",children:s.map(c=>{const f=ks[c],u=c==="toggle-mode"?Cs(i):f.icon,g=f.toggleable&&n===c,h=o?.(c)??!1,p=[f.hint,f.shortcut?`(${f.shortcut})`:""];return T.jsx("button",{type:"button",className:["lgc-tool",g?"lgc-tool--active":"",h?"lgc-tool--disabled":""].join(" ").trim(),"aria-label":f.label,"aria-pressed":g?"true":void 0,disabled:h,title:p.filter(Boolean).join(" "),onClick:()=>a(c),children:T.jsx(u,{})},c)})})}function lv({x:e,y:t,items:n,onClose:r}){const i=A.useRef(null);return A.useEffect(()=>{const o=a=>{a instanceof KeyboardEvent&&a.key!=="Escape"||a instanceof MouseEvent&&i.current&&i.current.contains(a.target)||r()};return window.addEventListener("mousedown",o),window.addEventListener("keydown",o),()=>{window.removeEventListener("mousedown",o),window.removeEventListener("keydown",o)}},[r]),T.jsx("div",{ref:i,className:"lgc-menu",role:"menu",style:{left:e,top:t},children:n.map((o,a)=>"separator"in o?T.jsx("div",{className:"lgc-menu-separator"},`sep-${a}`):T.jsxs("div",{role:"menuitem",className:"lgc-menu-item","aria-disabled":o.disabled?"true":void 0,onClick:()=>{o.disabled||(o.onSelect(),r())},children:[T.jsx("span",{children:o.label}),o.shortcut?T.jsx("span",{style:{marginLeft:"auto",opacity:.6},children:o.shortcut}):null]},o.id))})}function cv({content:e,hostRef:t}){const[n,r]=A.useState(null),i=A.useRef(null);if(A.useEffect(()=>{if(e===null){r(null),i.current=null;return}const s=t.current;if(!s)return;i.current=s.getBoundingClientRect();const l=f=>{const u=i.current??s.getBoundingClientRect();r({x:f.clientX-u.left,y:f.clientY-u.top})},c=()=>{i.current=s.getBoundingClientRect()};return s.addEventListener("mousemove",l),window.addEventListener("resize",c),()=>{s.removeEventListener("mousemove",l),window.removeEventListener("resize",c)}},[t,e]),e===null||n===null)return null;const o=n.x+14,a=n.y+14;return T.jsx("div",{className:"lgc-tooltip",role:"tooltip",style:{left:o,top:a,pointerEvents:"none"},children:typeof e=="string"?e:T.jsx("span",{ref:s=>s?.appendChild(e)})})}function uv({rect:e}){if(!e)return null;const t=Math.min(e.x0,e.x1),n=Math.min(e.y0,e.y1),r=Math.abs(e.x1-e.x0),i=Math.abs(e.y1-e.y0);return T.jsx("div",{className:"lgc-marquee",style:{left:t,top:n,width:r,height:i,pointerEvents:"none"}})}function fv(e){return T.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[T.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),T.jsx("path",{d:"M6 5h7v7"})]})}function dv(e){return T.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[T.jsx("circle",{cx:"5",cy:"11",r:"2"}),T.jsx("circle",{cx:"11",cy:"11",r:"2"}),T.jsx("path",{d:"M6.5 9.5L13 3M5 8L9.5 9.5"})]})}function Wo(e){return T.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[T.jsx("rect",{x:"3",y:"4",width:"10",height:"10",rx:"1"}),T.jsx("rect",{x:"5",y:"2",width:"6",height:"3",rx:"1"})]})}function ct({label:e,shortcut:t,disabled:n,onClick:r,children:i}){return T.jsx("button",{type:"button",className:"lgc-selpanel-btn","aria-label":e,title:t?`${e} (${t})`:e,disabled:n,onClick:r,children:i})}function hv({nodeCount:e,linkCount:t,hasClipboard:n,enableClipboard:r,onDelete:i,onDuplicate:o,onAddConnected:a,onCopy:s,onCut:l,onPaste:c,onClear:f}){if(e===0&&t===0)return!r||!n?null:T.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[T.jsx("span",{className:"lgc-selpanel-label",children:"Clipboard ready"}),T.jsx(ct,{label:"Paste",shortcut:"⌘V",onClick:c,children:T.jsx(Wo,{})})]});const u=[];e>0&&u.push(`${e} ${e===1?"node":"nodes"}`),t>0&&u.push(`${t} ${t===1?"link":"links"}`);const g=u.join(", ");return T.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[T.jsx("span",{className:"lgc-selpanel-label",children:g}),T.jsx("div",{className:"lgc-selpanel-divider"}),T.jsx(ct,{label:"Delete",shortcut:"⌫",onClick:i,children:T.jsx(_s,{width:14,height:14})}),T.jsx(ct,{label:"Duplicate",shortcut:"⌘D",onClick:o,children:T.jsx(ws,{width:14,height:14})}),T.jsx(ct,{label:"Connect to new node",shortcut:"↵",disabled:e===0,onClick:a,children:T.jsx(iv,{})}),r?T.jsxs(T.Fragment,{children:[T.jsx(ct,{label:"Copy",shortcut:"⌘C",disabled:e===0,onClick:s,children:T.jsx(fv,{})}),T.jsx(ct,{label:"Cut",shortcut:"⌘X",disabled:e===0,onClick:l,children:T.jsx(dv,{})}),T.jsx(ct,{label:"Paste",shortcut:"⌘V",disabled:!n,onClick:c,children:T.jsx(Wo,{})})]}):null,T.jsx("div",{className:"lgc-selpanel-divider"}),T.jsx(ct,{label:"Clear selection",shortcut:"Esc",onClick:f,children:"✕"})]})}const Xo=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];function pv(e,t){let n=0;for(let r=0;r<e.length;r++)n=n*31+e.charCodeAt(r)|0;return Math.abs(n)%t}function gv(e){return Xo[pv(e,Xo.length)]}function vv({nodes:e,groupBy:t,hidden:n,onToggle:r}){const i=A.useMemo(()=>{if(!t)return[];const o=new Set;for(const a of e){const s=typeof t=="function"?t(a):a[t];s!=null&&o.add(String(s))}return Array.from(o).sort()},[e,t]);return i.length===0?null:T.jsx("div",{className:"lgc-legend",role:"region","aria-label":"Groups",children:i.map(o=>{const a=n.has(o);return T.jsxs("button",{type:"button",className:["lgc-legend-item",a?"lgc-legend-item--hidden":""].join(" ").trim(),onClick:()=>r(o),"aria-pressed":a?"false":"true",title:`Toggle ${o}`,children:[T.jsx("span",{className:"lgc-legend-swatch",style:{background:gv(o)}}),T.jsx("span",{children:o})]},o)})})}function yv({mode:e,onToggle:t}){const n=Cs(e),r=e==="2d"?"3D":"2D";return T.jsxs("button",{type:"button",className:"lgc-mode-toggle",onClick:t,"aria-label":`Switch to ${r}`,title:`Switch to ${r} (3)`,children:[T.jsx(n,{width:14,height:14}),T.jsx("span",{className:"lgc-mode-toggle-label",children:e.toUpperCase()})]})}function mv(e){return T.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[T.jsx("circle",{cx:"8",cy:"8",r:"2.4"}),T.jsx("path",{d:"M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.4 1.4M11.55 11.55l1.4 1.4M3.05 12.95l1.4-1.4M11.55 4.45l1.4-1.4"})]})}function bv({items:e}){const[t,n]=A.useState(!1),r=A.useRef(null);return A.useEffect(()=>{if(!t)return;const i=a=>{r.current&&!r.current.contains(a.target)&&n(!1)},o=a=>{a.key==="Escape"&&n(!1)};return window.addEventListener("mousedown",i),window.addEventListener("keydown",o),()=>{window.removeEventListener("mousedown",i),window.removeEventListener("keydown",o)}},[t]),e.length===0?null:T.jsxs("div",{ref:r,className:"lgc-options-menu",children:[T.jsx("button",{type:"button",className:"lgc-options-trigger","aria-label":"Options","aria-expanded":t,title:"Options",onClick:()=>n(i=>!i),children:T.jsx(mv,{})}),t?T.jsx("div",{className:"lgc-options-panel",role:"menu",children:e.map(i=>i.kind==="select"?T.jsxs("div",{className:"lgc-options-item",children:[T.jsxs("span",{className:"lgc-options-item-text",children:[T.jsx("span",{className:"lgc-options-item-label",children:i.label}),i.hint?T.jsx("span",{className:"lgc-options-item-hint",children:i.hint}):null]}),T.jsx("select",{className:"lgc-options-select",value:i.value,onChange:o=>i.onChange(o.target.value),children:i.options.map(o=>T.jsx("option",{value:o.value,children:o.label??o.value},o.value))})]},i.id):T.jsxs("label",{className:"lgc-options-item",children:[T.jsx("input",{type:"checkbox",checked:i.checked,onChange:o=>i.onChange(o.target.checked)}),T.jsxs("span",{className:"lgc-options-item-text",children:[T.jsx("span",{className:"lgc-options-item-label",children:i.label}),i.hint?T.jsx("span",{className:"lgc-options-item-hint",children:i.hint}):null]})]},i.id))}):null]})}function _v(e,t,n={}){const r=n.spacing??50,i=n.color??"rgba(0,0,0,0.06)",o=e.canvas,s=e.getTransform().inverse(),l=s.transformPoint({x:0,y:0}),c=s.transformPoint({x:o.width,y:o.height}),f=Math.floor(l.x/r)*r,u=Math.ceil(c.x/r)*r,g=Math.floor(l.y/r)*r,h=Math.ceil(c.y/r)*r;e.save(),e.strokeStyle=i,e.lineWidth=1/t,e.beginPath();for(let p=f;p<=u;p+=r)e.moveTo(p,g),e.lineTo(p,h);for(let p=g;p<=h;p+=r)e.moveTo(f,p),e.lineTo(u,p);e.stroke(),e.restore()}const Yo=15,xv={background:"--lgc-bg",foreground:"--lgc-fg",border:"--lgc-border",accent:"--lgc-accent",toolbarBackground:"--lgc-toolbar-bg",toolbarForeground:"--lgc-toolbar-fg",toolbarBorder:"--lgc-toolbar-border",toolActiveBackground:"--lgc-tool-active-bg",toolHoverBackground:"--lgc-tool-hover-bg",tooltipBackground:"--lgc-tooltip-bg",tooltipForeground:"--lgc-tooltip-fg",menuBackground:"--lgc-menu-bg",menuForeground:"--lgc-menu-fg",menuHoverBackground:"--lgc-menu-hover-bg",fontFamily:"--lgc-font",fontSize:"--lgc-font-size"};function wv(e){if(!e)return{};const t={};for(const[n,r]of Object.entries(e)){if(r===void 0)continue;const i=xv[n];i&&(t[i]=String(r))}return t}function Ss(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function kv(e){e&&e.toBlob(t=>{t&&Ss(t,`lora-graph-${Date.now()}.png`)})}function Cv(e,t){const{data:n,defaultData:r,onDataChange:i,mode:o,defaultMode:a,onModeChange:s,width:l,height:c,className:f,style:u,theme:g,tools:h=!0,selection:p="multi",showContextMenu:v=!0,showLegend:y=!1,showGrid:d=!1,showLabels:b=!1,enableClipboard:m=!0,enableTooltip:x=!1,introZoom:w=!0,focusOnClick:_=!1,highlightNeighborsOnHover:k=!0,autoIndexNeighbors:C=k,collideNodes:P=!1,fixOnDrop:M=!0,beeswarm:N=!1,onSelectionChange:E,onNodeClick:B,onNodeRightClick:S,onLinkClick:O,onLinkRightClick:L,onBackgroundClick:U,onBackgroundRightClick:ne,onNodeDrag:J,onNodeDragEnd:se,onNodeHover:D,onLinkHover:$,onNodeDoubleClick:G,onCopy:Z,onCut:I,onPaste:H,onRenderFramePre:z,nodeColor:F,nodeLabel:R,nodeVal:q,nodeAutoColorBy:V,nodeRelSize:re,nodeVisibility:le,nodeCanvasObject:ce,linkColor:Se,linkLabel:me,linkWidth:Te,linkHoverPrecision:ze,backgroundColor:Ke,enableNavigationControls:Fe,performanceProfile:di,dagMode:xt}=e,[dn,hn]=A.useState(o??a??"2d"),Be=o!==void 0,ve=Be?o:dn,hi=A.useRef(null),pt=A.useCallback(j=>{j!==ve&&(hi.current?.(),Be||hn(j),s?.(j))},[ve,Be,s]),ee=ll({...n!==void 0?{controlled:n}:{},...r!==void 0?{defaultData:r}:{},...i?{onChange:i}:{}});Og(C,ee.data);const fe=Mg({mode:p,...E?{onChange:E}:{}}),[Ge,Xn]=A.useState("select"),[pi,Yn]=A.useState(!1),Ps=Ig({highlightNeighborsOnHover:k,...R!==void 0?{nodeLabel:R}:{},...me!==void 0?{linkLabel:me}:{},...D?{onNodeHover:D}:{},...$?{onLinkHover:$}:{}}),{hoverNodeId:Os,hoverLinkId:As,liveHoverNodeIdRef:js,highlightedNodeIds:Ts,highlightedLinkIds:Es,hoveredNodeSet:Ls,hoveredLinkSet:Ns,tooltipContent:Rs,handleNodeHover:gi,handleLinkHover:vi,pinHover:pn}=Ps,[yi,Is]=A.useState(()=>new Set),[wt,mi]=A.useState(!!_),[gn,bi]=A.useState(!!b),[vn,_i]=A.useState(xt??null);A.useEffect(()=>{mi(!!_)},[_]),A.useEffect(()=>{bi(!!b)},[b]),A.useEffect(()=>{_i(xt??null)},[xt]);const et=A.useRef(null),[Bt,yn]=A.useState(null),[$t,mn]=A.useState(null),[bn,gt]=A.useState(null),[tt,$e]=A.useState([]),[_n,kt]=A.useState(null),Ds=Pg(),Ct=A.useRef(null),Kn=A.useRef(null),[Qn,zs]=A.useState(null),Fs=A.useCallback(j=>{Kn.current=j,zs(j)},[]),xi=Sg(Ct),Zn=l??xi?.width??600,Jn=c??xi?.height??400,Ee=A.useRef(null),{marquee:wi,lastCursorRef:Bs}=Ag({mount:Qn,engineRef:Ee,selection:fe,nodes:ee.data.nodes,links:ee.data.links,setSelectedLinkIds:$e,liveHoverNodeIdRef:js});Tg(Qn);const Me=Eg({enableClipboard:m,dataApi:ee,selection:fe,setSelectedLinkIds:$e,engineRef:Ee,lastCursorRef:Bs,...Z?{onCopy:Z}:{},...I?{onCut:I}:{},...H?{onPaste:H}:{}}),ki=A.useRef(null),Ci=A.useCallback((j,W)=>{B?.(j,W);const Y=performance.now(),be=ki.current,de=be&&be.id===j.id&&Y-be.at<280;if(ki.current={id:j.id,at:Y},de){G?.(j,W);return}if(Ge==="add-link"&&j.id!==void 0){bn===null?gt(j.id):(bn!==j.id&&ee.addLink({source:bn,target:j.id}),gt(null));return}if(p!=="none"&&j.id!==void 0){const oe=W.shiftKey||W.ctrlKey||W.metaKey;fe.toggle(j.id,{additive:oe}),oe||$e([])}if(wt&&j.id!==void 0&&Ee.current){const oe=Ee.current;Bt===j.id?(et.current&&oe.setCameraState(et.current,800),yn(null),et.current=null):(Bt===null&&$t===null&&(et.current=oe.getCameraState()),oe.focusOn({x:j.x??0,y:j.y??0,z:j.z??0},{distance:120,zoom:8,durationMs:1e3}),yn(j.id),mn(null))}},[B,G,fe,p,Ge,bn,ee,wt,Bt,$t]),Si=A.useCallback(j=>{if(U?.(j),Ee.current?.stopAnimation(),Ge==="add-node"){const Y=Kn.current?.getBoundingClientRect(),be=Y?j.clientX-Y.left:j.clientX,de=Y?j.clientY-Y.top:j.clientY,oe=Ee.current?.screen2Graph(be,de)??{x:be,y:de};ee.addNode(void 0,{at:{x:oe.x,y:oe.y,...oe.z!==void 0?{z:oe.z}:{}}});return}Ge==="add-link"&>(null),j.shiftKey||j.ctrlKey||j.metaKey||(fe.clear(),$e([])),kt(null)},[U,Ge,ee,fe]),Mi=A.useCallback((j,W)=>{if(S?.(j,W),!v)return;const Y=Ct.current?.getBoundingClientRect(),be=Y?W.clientX-Y.left:W.clientX,de=Y?W.clientY-Y.top:W.clientY,oe=j.id;kt({x:be,y:de,items:[{id:"pin",label:j.fx!==void 0?"Unpin":"Pin",onSelect:()=>{ee.updateNode(oe,j.fx!==void 0?{fx:void 0,fy:void 0,fz:void 0}:{fx:j.x,fy:j.y,fz:j.z})}},{id:"connect",label:"Connect from here…",onSelect:()=>{Xn("add-link"),gt(oe)}},{separator:!0},{id:"delete",label:"Delete",shortcut:"⌫",onSelect:()=>{ee.removeNode(oe),fe.clear()}}]})},[S,v,ee,fe]),Pi=A.useCallback((j,W)=>{O?.(j,W);const Y=j.id;if(Y===void 0)return;const be=W.shiftKey||W.ctrlKey||W.metaKey;if($e(de=>{const oe=de.includes(Y);return!be||p!=="multi"?oe&&de.length===1?[]:[Y]:oe?de.filter(Oe=>Oe!==Y):[...de,Y]}),be||fe.clear(),wt&&Ee.current){const de=Ee.current;if($t===Y)et.current&&de.setCameraState(et.current,800),mn(null),et.current=null;else{const oe=typeof j.source=="object"?j.source:null,Oe=typeof j.target=="object"?j.target:null;if(oe&&Oe&&oe.x!==void 0&&Oe.x!==void 0){Bt===null&&$t===null&&(et.current=de.getCameraState());const Re=oe.x??0,Mt=oe.y??0,rt=Oe.x??0,Ht=Oe.y??0,Ut=oe.z??0,qt=Oe.z??0,Vs={x:(Re+rt)/2,y:(Mt+Ht)/2,z:(Ut+qt)/2},or=1.5,$i=rt-Re,Hi=Ht-Mt,Gs=qt-Ut,Ws=Math.max(Math.abs($i),1),Xs=Math.max(Math.abs(Hi),1),Ys=Math.min(Zn/(Ws*or),Jn/(Xs*or)),Ks=Math.min(16,Math.max(.5,Ys)),Qs=Math.hypot($i,Hi,Gs)/2/.466*or,Zs=Math.max(60,Qs);de.focusOn(Vs,{distance:Zs,zoom:Ks,durationMs:1e3}),mn(Y),yn(null)}}}},[O,fe,p,wt,$t,Bt,Zn,Jn]),Oi=A.useCallback((j,W)=>{if(L?.(j,W),!v)return;const Y=Ct.current?.getBoundingClientRect(),be=Y?W.clientX-Y.left:W.clientX,de=Y?W.clientY-Y.top:W.clientY;kt({x:be,y:de,items:[{id:"delete",label:"Delete link",shortcut:"⌫",onSelect:()=>{ee.removeLink(oe=>oe===j),$e([])}},{id:"reverse",label:"Reverse direction",onSelect:()=>{ee.removeLink(oe=>oe===j),ee.addLink({...j,source:typeof j.target=="object"?j.target.id:j.target,target:typeof j.source=="object"?j.source.id:j.source})}}]})},[L,v,ee]),er=A.useRef(null),Ai=A.useRef(ee.data.nodes);Ai.current=ee.data.nodes;const ji=A.useCallback((j,W)=>{if(J?.(j,W),Ee.current?.stopAnimation(),pn(j),Ge==="add-link"){const Y=Ai.current,be=j.x??0,de=j.y??0,oe=Yo*Yo;let Oe=null,Re=1/0;for(let Mt=0;Mt<Y.length;Mt++){const rt=Y[Mt];if(!rt||rt===j||rt.id===j.id)continue;const Ht=(rt.x??0)-be,Ut=(rt.y??0)-de,qt=Ht*Ht+Ut*Ut;qt<Re&&(Re=qt,Oe=rt)}er.current=Oe&&Re<oe?Oe:null}},[J,Ge,pn]),Ti=A.useCallback((j,W)=>{if(se?.(j,W),pn(null),Ge==="add-link"){const Y=er.current;if(er.current=null,!Y||Y.id===void 0||j.id===void 0)return;ee.addLink({source:j.id,target:Y.id});return}if(M){const Y=j;j.x!==void 0&&(Y.fx=j.x),j.y!==void 0&&(Y.fy=j.y),j.z!==void 0&&(Y.fz=j.z)}},[se,Ge,ee,M,pn]),Ei=A.useCallback(j=>{if(ne?.(j),!v)return;const W=Ct.current?.getBoundingClientRect(),Y=W?j.clientX-W.left:j.clientX,be=W?j.clientY-W.top:j.clientY,de=Kn.current?.getBoundingClientRect(),oe=de?j.clientX-de.left:j.clientX,Oe=de?j.clientY-de.top:j.clientY,Re=Ee.current?.screen2Graph(oe,Oe)??{x:oe,y:Oe};kt({x:Y,y:be,items:[{id:"add-node-here",label:"Add node here",onSelect:()=>{ee.addNode(void 0,{at:{x:Re.x,y:Re.y,...Re.z!==void 0?{z:Re.z}:{}}})}},{id:"fit",label:"Fit to view",shortcut:"F",onSelect:()=>Ee.current?.fit(400,40)},{id:"toggle-mode",label:ve==="2d"?"Switch to 3D":"Switch to 2D",shortcut:"3",onSelect:()=>pt(ve==="2d"?"3d":"2d")}]})},[ne,v,ee,ve,pt]),tr=g?.accent??"#4f8ef7",Li=A.useMemo(()=>new Set(fe.selected),[fe.selected]),Ni=A.useMemo(()=>new Set(tt),[tt]),xe=Rg({mode:ve,accentColor:tr,...F!==void 0?{nodeColor:F}:{},...Se!==void 0?{linkColor:Se}:{},...Te!==void 0?{linkWidth:Te}:{},...q!==void 0?{nodeVal:q}:{},...re!==void 0?{nodeRelSize:re}:{},...e.nodePointerAreaPaint!==void 0?{nodePointerAreaPaint:e.nodePointerAreaPaint}:{},...V!==void 0?{nodeAutoColorBy:V}:{},...le!==void 0?{nodeVisibility:le}:{},selectedNodeSet:Li,selectedLinkSet:Ni,highlightNeighborsOnHover:k,highlightedNodeIds:Ts,highlightedLinkIds:Es,hoverNodeId:Os,hoverLinkId:As,hiddenGroups:yi}),St=zg({mode:ve,showLabels:gn,selectedNodeSet:Li,hoveredNodeSet:Ls,accentColor:tr,...ce?{hostNodeCanvasObject:ce}:{},...e.nodeThreeObject?{hostNodeThreeObject:e.nodeThreeObject}:{},...R!==void 0?{nodeLabel:R}:{},...q!==void 0?{nodeVal:q}:{},...re!==void 0?{nodeRelSize:re}:{},...g?{theme:g}:{}}),nt=Fg({mode:ve,showLabels:gn,selectedLinkSet:Ni,hoveredLinkSet:Ns,accentColor:tr,...e.linkCanvasObject?{hostLinkCanvasObject:e.linkCanvasObject}:{},...e.linkThreeObject?{hostLinkThreeObject:e.linkThreeObject}:{},...e.linkPositionUpdate!==void 0?{hostLinkPositionUpdate:e.linkPositionUpdate}:{},...me!==void 0?{linkLabel:me}:{},...g?{theme:g}:{}}),Ri=Hg({profile:di,nodeCount:ee.data.nodes.length,linkCount:ee.data.links.length,mode:ve}),Ii=ve==="3d"&&(Ds||wi!==null),Di=A.useMemo(()=>Ke!==void 0?Ke:g?.background&&g.background!=="transparent"?g.background:"#ffffff",[Ke,g?.background]),$s=A.useMemo(()=>{const j={...Ri,...e,dagMode:vn};return j.backgroundColor===void 0&&(j.backgroundColor=Di),j.linkColor===void 0&&(j.linkColor="rgba(96, 102, 110, 0.55)"),j.linkOpacity===void 0&&(j.linkOpacity=1),j.nodeOpacity===void 0&&(j.nodeOpacity=1),xe.nodeColor!==void 0&&(j.nodeColor=xe.nodeColor),xe.linkColor!==void 0&&(j.linkColor=xe.linkColor),xe.linkWidth!==void 0&&(j.linkWidth=xe.linkWidth),xe.nodeVal!==void 0&&(j.nodeVal=xe.nodeVal),xe.nodePointerAreaPaint!==void 0&&(j.nodePointerAreaPaint=xe.nodePointerAreaPaint),St.canvasObject&&(j.nodeCanvasObject=St.canvasObject,j.nodeCanvasObjectMode=()=>"after"),nt.canvasObject&&(j.linkCanvasObject=nt.canvasObject,j.linkCanvasObjectMode=()=>"after"),St.threeObject&&(j.nodeThreeObject=St.threeObject,j.nodeThreeObjectExtend=!0),nt.threeObject&&(j.linkThreeObject=nt.threeObject,j.linkThreeObjectExtend=!0,nt.positionUpdate&&(j.linkPositionUpdate=nt.positionUpdate)),j.linkHoverPrecision=ze??8,j.enableNavigationControls=Ii?!1:Fe??!0,j.onNodeClick=Ci,j.onNodeRightClick=Mi,j.onLinkClick=Pi,j.onLinkRightClick=Oi,j.onBackgroundClick=Si,j.onBackgroundRightClick=Ei,j.onNodeDrag=ji,j.onNodeDragEnd=Ti,j.nodeLabel=()=>"",j.linkLabel=()=>"",j.onNodeHover=gi,j.onLinkHover=vi,d&&(j.onRenderFramePre=(W,Y)=>{_v(W,Y,typeof d=="object"?d:{}),z?.(W,Y)}),xe.nodeVisibility&&(j.nodeVisibility=xe.nodeVisibility),j},[e,vn,Di,xe.nodeColor,xe.linkColor,xe.linkWidth,xe.nodeVal,xe.nodePointerAreaPaint,xe.nodeVisibility,Ri,Ii,ze,Fe,Ci,Mi,Pi,Oi,Si,Ei,ji,Ti,gi,vi,d,z,St.canvasObject,St.threeObject,nt.canvasObject,nt.threeObject,nt.positionUpdate]),Pe=Cg({mount:Qn,mode:ve,width:Zn,height:Jn,data:ee.data,props:$s,paused:pi});Ee.current=Pe,hi.current=()=>{yn(null),mn(null),et.current=null,gt(null),kt(null)};const zi=A.useRef(!1),nr=ee.data.nodes.length;A.useEffect(()=>{if(!w||!Pe||zi.current||nr===0)return;zi.current=!0;const j=2.3+Math.log10(Math.max(nr,1)),W=setTimeout(()=>{const Y=Ee.current;Y&&(Y.zoom(1/j,0),requestAnimationFrame(()=>Ee.current?.fit(1e3,40)))},80);return()=>clearTimeout(W)},[Pe,w,nr]),Ng({engine:Pe,collideNodes:P,beeswarm:N,...re!==void 0?{nodeRelSize:re}:{}});const Fi=A.useRef(null),rr=A.useCallback(()=>JSON.stringify({nodes:ee.data.nodes.map(j=>{const{vx:W,vy:Y,vz:be,index:de,_neighbors:oe,_links:Oe,...Re}=j;return Re}),links:ee.data.links},null,2),[ee.data]),Bi=A.useCallback(j=>{const W=JSON.parse(j);if(!W||!Array.isArray(W.nodes)||!Array.isArray(W.links))throw new Error("invalid graph JSON");ee.setData(W),fe.clear(),$e([])},[ee,fe]),ir=A.useCallback((j=`graph-${Date.now()}.json`)=>{const W=new Blob([rr()],{type:"application/json"});Ss(W,j)},[rr]),Hs=A.useCallback(j=>{switch(j){case"select":case"pan":case"add-node":case"add-link":Xn(j);break;case"delete":if(fe.selected.length>0&&(ee.removeNodes(fe.selected),fe.clear()),tt.length>0){const W=new Set(tt);ee.removeLink(Y=>Y.id!==void 0&&W.has(Y.id)),$e([])}break;case"duplicate":Me.duplicate();break;case"select-all":fe.set(ee.data.nodes.map(W=>W.id)),$e(ee.data.links.map(W=>W.id).filter(W=>W!==void 0));break;case"fit":Pe?.fit(400,40);break;case"zoom-in":Pe&&Pe.zoom((Pe.getZoom?.()??1)*1.2,200);break;case"zoom-out":Pe&&Pe.zoom((Pe.getZoom?.()??1)/1.2,200);break;case"pause":Yn(!0);break;case"resume":Yn(!1);break;case"screenshot":kv(Pe?.getCanvasElement());break;case"export-json":ir();break;case"import-json":Fi.current?.click();break;case"toggle-mode":pt(ve==="2d"?"3d":"2d");break}},[Pe,ee,fe,ve,pt,tt,Me,ir]);Lg({engine:Pe,dataApi:ee,selection:fe,mode:ve,setMode:pt,selectedLinkIds:tt,setSelectedLinkIds:$e,setLinkSourceId:gt,setActiveTool:Xn,enableClipboard:m,copy:Me.copy,cut:Me.cut,paste:Me.paste,duplicate:Me.duplicate,addConnectedNode:Me.addConnectedNode,togglePin:Me.togglePin}),Ug({ref:t,dataApi:ee,selection:fe,engine:Pe,mode:ve,setMode:pt,setPaused:Yn,clipboard:Me,exportJSON:rr,importJSON:Bi,downloadJSON:ir});const Us=A.useMemo(()=>({position:"relative",width:l??"100%",height:c??"100%",...wv(g),...u}),[l,c,g,u]),qs=A.useMemo(()=>[{id:"focus-on-click",kind:"toggle",label:"Click to focus",hint:"Animate the camera to a clicked node; click again to restore.",checked:wt,onChange:mi},{id:"show-labels",kind:"toggle",label:"Always show labels",hint:"Draw every node + link label on the canvas, not just the selected ones. 2D only.",checked:gn,onChange:bi},{kind:"select",id:"dag-mode",label:"DAG orientation",hint:"Force a hierarchical / radial layout.",value:vn??"null",options:[{value:"null",label:"off"},{value:"td",label:"td (top-down)"},{value:"bu",label:"bu (bottom-up)"},{value:"lr",label:"lr (left-right)"},{value:"rl",label:"rl (right-left)"},{value:"radialout"},{value:"radialin"}],onChange:j=>_i(j==="null"?null:j)}],[wt,gn,vn]);return T.jsxs("div",{ref:Ct,className:["lora-graph-canvas",f??""].join(" ").trim(),style:Us,"data-mode":ve,"data-tool":Ge,children:[T.jsx("div",{ref:Fs,className:"lgc-engine-mount"}),T.jsx(sv,{config:h,activeTool:Ge,paused:pi,mode:ve,onSelect:Hs}),h!==!1?T.jsxs(T.Fragment,{children:[T.jsx(bv,{items:qs}),T.jsx(yv,{mode:ve,onToggle:()=>pt(ve==="2d"?"3d":"2d")})]}):null,_n?T.jsx(lv,{x:_n.x,y:_n.y,items:_n.items,onClose:()=>kt(null)}):null,x?T.jsx(cv,{content:Rs,hostRef:Ct}):null,T.jsx(uv,{rect:wi}),y&&V?T.jsx(vv,{nodes:ee.data.nodes,groupBy:V,hidden:yi,onToggle:j=>Is(W=>{const Y=new Set(W);return Y.has(j)?Y.delete(j):Y.add(j),Y})}):null,T.jsx(hv,{nodeCount:fe.selected.length,linkCount:tt.length,hasClipboard:Me.hasClipboard(),enableClipboard:m,onDelete:()=>{if(fe.selected.length>0&&(ee.removeNodes(fe.selected),fe.clear()),tt.length>0){const j=new Set(tt);ee.removeLink(W=>W.id!==void 0&&j.has(W.id)),$e([])}},onDuplicate:()=>Me.duplicate(),onAddConnected:()=>Me.addConnectedNode(),onCopy:()=>Me.copy(),onCut:()=>Me.cut(),onPaste:()=>Me.paste(),onClear:()=>{fe.clear(),$e([])}}),T.jsx("input",{ref:Fi,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:j=>{const W=j.target.files?.[0];W&&(W.text().then(Bi).catch(Y=>{console.error("[lora-graph-canvas] import failed:",Y)}),j.target.value="")}})]})}const Ms=A.forwardRef(Cv);Ms.displayName="LoraGraphCanvas";const Sv={background:"#ffffff",foreground:"#1c1f23",border:"#d8dde3",accent:"#4f8ef7",toolbarBackground:"rgba(255, 255, 255, 0.92)",toolbarForeground:"#1c1f23",toolbarBorder:"#d8dde3",toolActiveBackground:"rgba(79, 142, 247, 0.18)",toolHoverBackground:"rgba(0, 0, 0, 0.05)",tooltipBackground:"rgba(28, 31, 35, 0.9)",tooltipForeground:"#ffffff",menuBackground:"#ffffff",menuForeground:"#1c1f23",menuHoverBackground:"rgba(0, 0, 0, 0.06)"},Mv={background:"#101216",foreground:"#e6e9ee",border:"#2a2f37",accent:"#6aa3ff",toolbarBackground:"rgba(20, 23, 28, 0.92)",toolbarForeground:"#e6e9ee",toolbarBorder:"#2a2f37",toolActiveBackground:"rgba(106, 163, 255, 0.25)",toolHoverBackground:"rgba(255, 255, 255, 0.08)",tooltipBackground:"rgba(240, 240, 240, 0.92)",tooltipForeground:"#101216",menuBackground:"#161a20",menuForeground:"#e6e9ee",menuHoverBackground:"rgba(255, 255, 255, 0.08)"};exports.DEFAULT_TOOL_ORDER=Ur;exports.LoraGraphCanvas=Ms;exports.TOOL_DESCRIPTORS=ks;exports.createId=Et;exports.darkTheme=Mv;exports.lightTheme=Sv;
|
|
682
|
+
}`;ug(fg);function Kr(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 dg(e){if(Array.isArray(e))return e}function hg(e){if(Array.isArray(e))return Kr(e)}function pg(e,t,n){return(t=xg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gg(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function vg(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,o=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function yg(){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 mg(){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 bg(e,t){return dg(e)||vg(e,t)||ws(e,t)||yg()}function wt(e){return hg(e)||gg(e)||ws(e)||mg()}function _g(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 xg(e){var t=_g(e,"string");return typeof t=="symbol"?t:t+""}function ws(e,t){if(e){if(typeof e=="string")return Kr(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)?Kr(e,t):void 0}}var ks=function(t){t instanceof Array?t.forEach(ks):(t.map&&t.map.dispose(),t.dispose())},Cs=function(t){t.geometry&&t.geometry.dispose(),t.material&&ks(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(Cs)},wg=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),Cs(n)}},pe=window.THREE?window.THREE:{WebGLRenderer:Z.WebGLRenderer,Scene:Z.Scene,PerspectiveCamera:Z.PerspectiveCamera,Raycaster:Z.Raycaster,SRGBColorSpace:Z.SRGBColorSpace,TextureLoader:Z.TextureLoader,Vector2:Z.Vector2,Vector3:Z.Vector3,Box3:Z.Box3,Color:Z.Color,Mesh:Z.Mesh,SphereGeometry:Z.SphereGeometry,MeshBasicMaterial:Z.MeshBasicMaterial,BackSide:Z.BackSide,Timer:Z.Timer},Ss=fo({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,s){return t.hoverOrderComparator(a.object,s.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&&le(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,s=r||{x:0,y:0,z:0};if(!o)f(a),u(s);else{var l=Object.assign({},i.position),c=v();t.tweenGroup.add(new Di(l).to(a,o).easing(St.Quadratic.Out).onUpdate(f).onComplete(function(){t.tweenGroup.remove(this)}).start()),t.tweenGroup.add(new Di(c).to(s,o/3).easing(St.Quadratic.Out).onUpdate(u).onComplete(function(){t.tweenGroup.remove(this)}).start())}return this}return Object.assign({},i.position,{lookAt:v()});function f(h){var p=h.x,g=h.y,y=h.z;p!==void 0&&(i.position.x=p),g!==void 0&&(i.position.y=g),y!==void 0&&(i.position.z=y)}function u(h){var p=new pe.Vector3(h.x,h.y,h.z);t.controls.enabled&&t.controls.target?t.controls.target=p:i.lookAt(p)}function v(){return Object.assign(new pe.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 pe.Vector3(0,0,0),s=Math.max.apply(Math,wt(Object.entries(n).map(function(h){var p=bg(h,2),g=p[0],y=p[1];return Math.max.apply(Math,wt(y.map(function(d){return Math.abs(a[g]-d)})))})))*2,l=(1-o*2/t.height)*i.fov,c=s/Math.atan(l*Math.PI/180),f=c/i.aspect,u=Math.max(c,f);if(u>0){var v=a.clone().sub(i.position).normalize().multiplyScalar(-u);this.cameraPosition(v,a,r)}}return this},getBbox:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},r=new pe.Box3(new pe.Vector3(0,0,0),new pe.Vector3(0,0,0)),o=t.objects.filter(n);return o.length?(o.forEach(function(i){return r.expandByObject(i)}),Object.assign.apply(Object,wt(["x","y","z"].map(function(i){return pg({},i,[r.min[i],r.max[i]])})))):null},getScreenCoords:function(t,n,r,o){var i=new pe.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 pe.Vector2(n/t.width*2-1,-(r/t.height)*2+1),a=new pe.Raycaster;return a.setFromCamera(i,t.camera),Object.assign({},a.ray.at(o,new pe.Vector3))},intersectingObjects:function(t,n,r){var o=new pe.Vector2(n/t.width*2-1,-(r/t.height)*2+1),i=new pe.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;wg(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 pe.Scene,camera:new pe.PerspectiveCamera,timer:new pe.Timer,tweenGroup:new Qa,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,s=a===void 0?!1:a,l=r.rendererConfig,c=l===void 0?{}:l,f=r.extraRenderers,u=f===void 0?[]:f,v=r.waitForLoadComplete,h=v===void 0?!0:v;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 cg(n.container),n.pointerPos=new pe.Vector2,n.pointerPos.x=-2,n.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(p){return n.container.addEventListener(p,function(g){if(p==="pointerdown"&&(n.isPointerPressed=!0),!n.isPointerDragging&&g.type==="pointermove"&&(g.pressure>0||n.isPointerPressed)&&(g.pointerType==="mouse"||g.movementX===void 0||[g.movementX,g.movementY].some(function(m){return Math.abs(m)>1}))&&(n.isPointerDragging=!0),n.enablePointerInteraction){var y=d(n.container);n.pointerPos.x=g.pageX-y.left,n.pointerPos.y=g.pageY-y.top}function d(m){var b=m.getBoundingClientRect(),x=window.pageXOffset||document.documentElement.scrollLeft,w=window.pageYOffset||document.documentElement.scrollTop;return{top:b.top+w,left:b.left+x}}},{passive:!0})}),n.container.addEventListener("pointerup",function(p){n.isPointerPressed&&(n.isPointerPressed=!1,!(n.isPointerDragging&&(n.isPointerDragging=!1,!n.clickAfterDrag))&&requestAnimationFrame(function(){p.button===0&&n.onClick(n.hoverObj||null,p,n.intersection),p.button===2&&n.onRightClick&&n.onRightClick(n.hoverObj||null,p,n.intersection)}))},{passive:!0,capture:!0}),n.container.addEventListener("contextmenu",function(p){n.onRightClick&&p.preventDefault()}),n.renderer=new(s?ul.WebGPURenderer:pe.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),n.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),n.container.appendChild(n.renderer.domElement),n.extraRenderers=u,n.extraRenderers.forEach(function(p){p.domElement.style.position="absolute",p.domElement.style.top="0px",p.domElement.style.pointerEvents="none",n.container.appendChild(p.domElement)}),n.postProcessingComposer=new pl.EffectComposer(n.renderer),n.postProcessingComposer.addPass(new gl.RenderPass(n.scene,n.camera)),n.controls=new{trackball:fl.TrackballControls,orbit:dl.OrbitControls,fly:hl.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(wt(n.extraRenderers)).forEach(function(p){return p.setSize(n.width,n.height)}),n.camera.aspect=n.width/n.height,n.camera.updateProjectionMatrix(),n.camera.position.z=1e3,n.scene.add(n.skysphere=new pe.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(wt(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(wt(a),[o,i])),t.camera.updateProjectionMatrix()}if(n.hasOwnProperty("viewOffset")){var s,l=t.width,c=t.height,f=t.viewOffset.slice(0,2);f.some(function(h){return h})?(s=t.camera).setViewOffset.apply(s,[l,c].concat(wt(f),[l,c])):t.camera.clearViewOffset()}if(n.hasOwnProperty("skyRadius")&&t.skyRadius&&(t.controls.hasOwnProperty("maxDistance")&&n.skyRadius&&(t.controls.maxDistance=Math.min(t.controls.maxDistance,t.skyRadius)),t.camera.far=t.skyRadius*2.5,t.camera.updateProjectionMatrix(),t.skysphere.geometry=new pe.SphereGeometry(t.skyRadius)),n.hasOwnProperty("backgroundColor")){var u=Ht(t.backgroundColor).alpha;u===void 0&&(u=1),t.renderer.setClearColor(new pe.Color(Yd(1,t.backgroundColor)),u)}n.hasOwnProperty("backgroundImageUrl")&&(t.backgroundImageUrl?new pe.TextureLoader().load(t.backgroundImageUrl,function(h){h.colorSpace=pe.SRGBColorSpace,t.skysphere.material=new pe.MeshBasicMaterial({map:h,side:pe.BackSide}),t.skysphere.visible=!0,t.onBackgroundImageLoaded&&setTimeout(t.onBackgroundImageLoaded),!t.loadComplete&&v()}):(t.skysphere.visible=!1,t.skysphere.material.map=null,!t.loadComplete&&v())),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 v(){t.loadComplete=t.scene.visible=!0}}});function kg(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 Cg{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 Sg(e={}){const{stateInit:t=()=>({}),props:n={},methods:r={},aliases:o={},init:i=()=>{},update:a=()=>{}}=e,s=Object.keys(n).map(c=>new Cg(c,n[c]));function l(...c){const f=this instanceof l,u=c.slice(),v=f?u.shift():void 0,h=u[0]??{},p=typeof t=="function"?t(h):t,g=Object.assign({},p,{initialised:!1,_rerender:()=>{}});let y={};const d=x=>(m(x,h),b(),d);function m(x,w){i.call(d,x,g,w),g.initialised=!0}const b=kg(()=>{g.initialised&&(a.call(d,g,y),y={})},1);for(const x of s){const{name:w,triggerUpdate:_,onChange:k,defaultVal:S}=x;d[w]=function(){const O=g[w];if(arguments.length===0)return O;const E=arguments[0],T=E===void 0?S:E;return g[w]=T,k.call(d,T,g,O),Object.prototype.hasOwnProperty.call(y,w)||(y[w]=O),_&&b(),d}}for(const x of Object.keys(r))d[x]=function(...w){return r[x].call(d,g,...w)};for(const[x,w]of Object.entries(o))d[x]=d[w];return d.resetProps=function(){for(const x of s)d[x.name](x.defaultVal);return d},d.resetProps(),g._rerender=b,f&&v!==void 0&&d(v),d}return l}function qi(e){if(typeof e=="function")return e;if(typeof e=="string"){const n=e;return r=>r?.[n]}const t=e;return()=>t}function Ms(e,t){const n=e instanceof Array?e:[e],r=new t;return r._destructor?.(),{linkProp(o){return{default:r[o](),onChange(i,a){n.forEach(s=>{a[s][o].call(a[s],i)})},triggerUpdate:!1}},linkMethod(o){return function(i,...a){const s=[];return n.forEach(l=>{const c=i[l],f=c[o].apply(c,a);f!==c&&s.push(f)}),s.length?s[0]:this}}}}const Gi=globalThis,Vi=Gi.THREE?Gi.THREE:{AmbientLight:Z.AmbientLight,DirectionalLight:Z.DirectionalLight},Mg=170,Ps=Ms("forceGraph",Ga),Pg=["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"],Og=["refresh","getGraphBbox","d3Force","d3ReheatSimulation","emitParticle"],Jn=Ms("renderObjs",Ss),Ag=["width","height","backgroundColor","showNavInfo","enablePointerInteraction"],jg=["lights","cameraPosition","postProcessingComposer"],_o={};for(const e of Pg)_o[e]=Ps.linkProp(e);for(const e of Ag)_o[e]=Jn.linkProp(e);const mn={};for(const e of Og)mn[e]=Ps.linkMethod(e);for(const e of jg)mn[e]=Jn.linkMethod(e);mn.graph2ScreenCoords=Jn.linkMethod("getScreenCoords");mn.screen2GraphCoords=Jn.linkMethod("getSceneCoords");const $e=e=>e;function at(e){let t=e??null;for(;t&&!Object.prototype.hasOwnProperty.call(t,"__graphObjType");)t=t.parent;return t}const Tg=Sg({props:{nodeLabel:{default:"name",triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:1,onChange(e,t){$e(t).renderObjs.lineHoverPrecision(e)},triggerUpdate:!1},enableNavigationControls:{default:!0,onChange(e,t){const r=$e(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},..._o},methods:{zoomToFit(e,t,n,...r){return $e(e).renderObjs.fitToBbox(this.getGraphBbox(...r),t,n),this},pauseAnimation(e){const t=$e(e);return t.animationFrameRequestId!=null&&(cancelAnimationFrame(t.animationFrameRequestId),t.animationFrameRequestId=null),this},resumeAnimation(e){return $e(e).animationFrameRequestId==null&&this._animationCycle(),this},_animationCycle(e){const t=$e(e);t.enablePointerInteraction&&(this.renderer().domElement.style.cursor=""),t.forceGraph.tickFrame(),t.renderObjs.tick(),t.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},scene(e){return $e(e).renderObjs.scene()},camera(e){return $e(e).renderObjs.camera()},renderer(e){return $e(e).renderObjs.renderer()},controls(e){return $e(e).renderObjs.controls()},_destructor(e){const t=$e(e);this.pauseAnimation(),this.graphData({nodes:[],links:[]}),t.forceGraph._destructor?.(),t.renderObjs._destructor()},...mn},stateInit:e=>{const t=e??{},n=new Ga,r=Ss({...t.controlType?{controlType:t.controlType}:{},...t.rendererConfig?{rendererConfig:t.rendererConfig}:{},...t.extraRenderers?{extraRenderers:t.extraRenderers}:{}});return r.objects([n]),r.lights([new Vi.AmbientLight(13421772,Math.PI),new Vi.DirectionalLight(16777215,.6*Math.PI)]),{forceGraph:n,renderObjs:r}},init(e,t){const n=$e(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 s=document.createElement("div");s.className="graph-info-msg",s.textContent="",n.container.appendChild(s);const l=n.forceGraph;l.onLoading(()=>{s.textContent="Loading..."}),l.onFinishLoading(()=>{s.textContent=""}),l.onUpdate(()=>{if(n.graphData=l.graphData(),o.position.x===0&&o.position.y===0&&o.position.z===n.lastSetCameraZ&&n.graphData.nodes.length){o.lookAt(l.position??{x:0,y:0,z:0});const f=Math.cbrt(n.graphData.nodes.length)*Mg;o.position.z=f,n.lastSetCameraZ=f}}),l.onFinishUpdate(()=>{if(n._dragControls){const f=n.graphData.nodes.find(u=>u.__initialFixedPos&&!u.__disposeControlsAfterDrag);f?f.__disposeControlsAfterDrag=!0:n._dragControls.dispose(),n._dragControls=void 0}if(n.enableNodeDrag&&n.enablePointerInteraction&&n.forceEngine==="d3"){const f=n.graphData.nodes.map(h=>h.__threeObj).filter(h=>!!h),u=new cl.DragControls(f,o,i.domElement);n._dragControls=u,u.addEventListener("dragstart",h=>{const p=h,g=at(p.object);if(!g)return;a&&(a.enabled=!1),p.object.__initialPos=p.object.position.clone(),p.object.__prevPos=p.object.position.clone();const y=g.__data;y.__initialFixedPos||(y.__initialFixedPos={fx:y.fx,fy:y.fy,fz:y.fz}),y.__initialPos||(y.__initialPos={x:y.x,y:y.y,z:y.z});for(const d of["x","y","z"])y[`f${d}`]=y[d];i.domElement.classList.add("grabbable")});const v=4;u.addEventListener("drag",h=>{const p=h,g=at(p.object);if(!g)return;if(!Object.prototype.hasOwnProperty.call(p.object,"__graphObjType")){const b=p.object.__initialPos,x=p.object.__prevPos,w=p.object.position,_=w.clone().sub(x);g.position.add(_),x.copy(w),w.copy(b)}const y=g.__data,d=g.position;if(!y.__dragCommitted){const b=y.__initialPos,x=b?.x??d.x,w=b?.y??d.y,_=b?.z??d.z,k=d.x-x,S=d.y-w,A=d.z-_;if(k*k+S*S+A*A<v)return;y.__dragCommitted=!0}const m={x:d.x-(y.x??0),y:d.y-(y.y??0),z:d.z-(y.z??0)};for(const b of["x","y","z"])y[`f${b}`]=d[b],y[b]=d[b];n.forceGraph.d3AlphaTarget(.3).resetCountdown(),y.__dragged=!0,n.onNodeDrag?.(y,m)}),u.addEventListener("dragend",h=>{const p=h,g=at(p.object);if(!g)return;delete p.object.__initialPos,delete p.object.__prevPos;const y=g.__data;y.__disposeControlsAfterDrag&&(u.dispose(),delete y.__disposeControlsAfterDrag);const d=y.__initialFixedPos,m=y.__initialPos,b=m?{x:m.x-y.x,y:m.y-y.y,z:m.z-y.z}:{x:0,y:0,z:0};if(d){for(const x of["x","y","z"]){const w=`f${x}`;d[w]===void 0&&delete y[w]}delete y.__initialFixedPos,delete y.__initialPos,delete y.__dragCommitted,y.__dragged&&(delete y.__dragged,n.onNodeDragEnd?.(y,b))}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(Z.REVISION,10)<155&&(i.useLegacyLights=!1),n.renderObjs.hoverOrderComparator((f,u)=>{const v=at(f);if(!v)return 1;const h=at(u);if(!h)return-1;const p=g=>g.__graphObjType==="node"?1:0;return p(h)-p(v)}).tooltipContent(f=>{const u=at(f);if(!u)return"";const v=n[`${u.__graphObjType}Label`];return qi(v)(u.__data)||""}).hoverDuringDrag(!1).onHover(f=>{const u=at(f);if(u===n.hoverObj)return;const v=n.hoverObj??null,h=v?v.__graphObjType:null,p=v?v.__data:null,g=u?u.__graphObjType:null,y=u?u.__data:null;if(h&&h!==g){const b=n[`on${h==="node"?"Node":"Link"}Hover`];b?.(null,p)}if(g){const b=n[`on${g==="node"?"Node":"Link"}Hover`];b?.(y,h===g?p:null)}const m=!!(u?n[`on${g==="node"?"Node":"Link"}Click`]:n.onBackgroundClick)&&qi(n.showPointerCursor)(y);i.domElement.classList[m?"add":"remove"]("clickable"),n.hoverObj=u}).clickAfterDrag(!1).onClick((f,u)=>{const v=at(f);if(v){const h=n[`on${v.__graphObjType==="node"?"Node":"Link"}Click`];h?.(v.__data,u)}else n.onBackgroundClick&&n.onBackgroundClick(u)}).onRightClick((f,u)=>{const v=at(f);if(v){const h=n[`on${v.__graphObjType==="node"?"Node":"Link"}RightClick`];h?.(v.__data,u)}else n.onBackgroundRightClick&&n.onBackgroundRightClick(u)}),this._animationCycle()},update(){}});function kt(e,t,n,r=Eg){if(typeof requestAnimationFrame!="function")return t(1),()=>{};const o=performance.now();let i=null,a=!1;const s=l=>{if(a)return;const c=l-o,f=Math.min(1,c/Math.max(e,1));t(r(f)),f<1?i=requestAnimationFrame(s):i=null};return i=requestAnimationFrame(s),()=>{a=!0,i!==null&&cancelAnimationFrame(i),i=null}}function Eg(e){return 1-(1-e)*(1-e)}function Wi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function ne(e,t,n){return e+(t-e)*n}const re=()=>!0,He=e=>e==="2d",be=e=>e==="3d",Lg=[{key:"nodeId",setter:"nodeId",supports:re},{key:"linkSource",setter:"linkSource",supports:re},{key:"linkTarget",setter:"linkTarget",supports:re},{key:"backgroundColor",setter:"backgroundColor",supports:re},{key:"nodeColor",setter:"nodeColor",supports:re},{key:"nodeLabel",setter:"nodeLabel",supports:re},{key:"nodeVal",setter:"nodeVal",supports:re},{key:"nodeAutoColorBy",setter:"nodeAutoColorBy",supports:re},{key:"nodeRelSize",setter:"nodeRelSize",supports:re},{key:"nodeVisibility",setter:"nodeVisibility",supports:re},{key:"linkColor",setter:"linkColor",supports:re},{key:"linkLabel",setter:"linkLabel",supports:re},{key:"linkWidth",setter:"linkWidth",supports:re},{key:"linkCurvature",setter:"linkCurvature",supports:re},{key:"linkAutoColorBy",setter:"linkAutoColorBy",supports:re},{key:"linkVisibility",setter:"linkVisibility",supports:re},{key:"linkDirectionalArrowLength",setter:"linkDirectionalArrowLength",supports:re},{key:"linkDirectionalArrowColor",setter:"linkDirectionalArrowColor",supports:re},{key:"linkDirectionalArrowRelPos",setter:"linkDirectionalArrowRelPos",supports:re},{key:"linkDirectionalParticles",setter:"linkDirectionalParticles",supports:re},{key:"linkDirectionalParticleSpeed",setter:"linkDirectionalParticleSpeed",supports:re},{key:"linkDirectionalParticleWidth",setter:"linkDirectionalParticleWidth",supports:re},{key:"linkDirectionalParticleOffset",setter:"linkDirectionalParticleOffset",supports:re},{key:"linkDirectionalParticleColor",setter:"linkDirectionalParticleColor",supports:re},{key:"cooldownTicks",setter:"cooldownTicks",supports:re},{key:"cooldownTime",setter:"cooldownTime",supports:re},{key:"warmupTicks",setter:"warmupTicks",supports:re},{key:"d3AlphaDecay",setter:"d3AlphaDecay",supports:re},{key:"d3VelocityDecay",setter:"d3VelocityDecay",supports:re},{key:"d3AlphaMin",setter:"d3AlphaMin",supports:re},{key:"d3AlphaTarget",setter:"d3AlphaTarget",supports:re},{key:"dagMode",setter:"dagMode",supports:re},{key:"dagLevelDistance",setter:"dagLevelDistance",supports:re},{key:"dagNodeFilter",setter:"dagNodeFilter",supports:re},{key:"onDagError",setter:"onDagError",supports:re},{key:"enableNodeDrag",setter:"enableNodeDrag",supports:re},{key:"enablePointerInteraction",setter:"enablePointerInteraction",supports:re},{key:"linkHoverPrecision",setter:"linkHoverPrecision",supports:re},{key:"showPointerCursor",setter:"showPointerCursor",supports:re},{key:"enableZoom",setter:"enableZoomInteraction",supports:He},{key:"enablePan",setter:"enablePanInteraction",supports:He},{key:"minZoom",setter:"minZoom",supports:He},{key:"maxZoom",setter:"maxZoom",supports:He},{key:"autoPauseRedraw",setter:"autoPauseRedraw",supports:He},{key:"linkLineDash",setter:"linkLineDash",supports:He},{key:"nodeCanvasObject",setter:"nodeCanvasObject",supports:He},{key:"nodeCanvasObjectMode",setter:"nodeCanvasObjectMode",supports:He},{key:"nodePointerAreaPaint",setter:"nodePointerAreaPaint",supports:He},{key:"linkCanvasObject",setter:"linkCanvasObject",supports:He},{key:"linkCanvasObjectMode",setter:"linkCanvasObjectMode",supports:He},{key:"linkPointerAreaPaint",setter:"linkPointerAreaPaint",supports:He},{key:"showNavInfo",setter:"showNavInfo",supports:be},{key:"enableNavigationControls",setter:"enableNavigationControls",supports:be},{key:"nodeOpacity",setter:"nodeOpacity",supports:be},{key:"nodeResolution",setter:"nodeResolution",supports:be},{key:"linkOpacity",setter:"linkOpacity",supports:be},{key:"linkResolution",setter:"linkResolution",supports:be},{key:"linkCurveRotation",setter:"linkCurveRotation",supports:be},{key:"linkMaterial",setter:"linkMaterial",supports:be},{key:"nodeThreeObject",setter:"nodeThreeObject",supports:be},{key:"nodeThreeObjectExtend",setter:"nodeThreeObjectExtend",supports:be},{key:"linkThreeObject",setter:"linkThreeObject",supports:be},{key:"linkThreeObjectExtend",setter:"linkThreeObjectExtend",supports:be},{key:"nodePositionUpdate",setter:"nodePositionUpdate",supports:be},{key:"linkPositionUpdate",setter:"linkPositionUpdate",supports:be},{key:"linkDirectionalArrowResolution",setter:"linkDirectionalArrowResolution",supports:be},{key:"linkDirectionalParticleResolution",setter:"linkDirectionalParticleResolution",supports:be},{key:"numDimensions",setter:"numDimensions",supports:be},{key:"forceEngine",setter:"forceEngine",supports:be},{key:"ngraphPhysics",setter:"ngraphPhysics",supports:be},{key:"pointerRaycasterThrottleMs",setter:"pointerRaycasterThrottleMs",supports:be}];function Xi(e,t,n,r){if(t!==n)for(const o of Lg){if(!o.supports(r))continue;const i=t[o.key],a=n[o.key];if(Object.is(i,a))continue;const s=e[o.setter];typeof s=="function"&&s.call(e,i)}}const Rg=["onNodeClick","onNodeRightClick","onNodeHover","onNodeDrag","onNodeDragEnd","onLinkClick","onLinkRightClick","onLinkHover","onBackgroundClick","onBackgroundRightClick","onEngineTick","onEngineStop"],Rt=1200,Nt=300;function Ng(e,t,n){const r=new Tg(e,{controlType:"orbit"});r.width(t.width),r.height(t.height);for(const g of Rg){const y=r[g];typeof y=="function"&&y.call(r,(...d)=>{const m=n.current[g];typeof m=="function"&&m(...d)})}Xi(r,t.initialProps,{},"3d"),r.graphData(t.initialData);let o=t.initialMode,i=o==="2d"?Rt:Nt,a=null,s=null;const l=g=>{const y=r.controls?.();if(!y)return;const d=y;g==="2d"?(d.noRotate=!0,d.enableRotate=!1,d.zoomToCursor=!0,d.screenSpacePanning=!0,d.zoomSpeed=1.6,d.panSpeed=1.2,d.mouseButtons&&(d.mouseButtons.LEFT=Z.MOUSE.PAN)):(d.noRotate=!1,d.enableRotate=!0,d.zoomToCursor=!1,d.screenSpacePanning=!1,d.zoomSpeed=1,d.panSpeed=1,d.mouseButtons&&(d.mouseButtons.LEFT=Z.MOUSE.ROTATE))},c=()=>{const g=r.graphData();for(const y of g.nodes)y.fz=0},f=()=>{const g=r.graphData();for(const y of g.nodes)delete y.fz},u=()=>{const g=r.graphData(),y=new Map;let d=0;for(const b of g.nodes){const x=b.x??0,w=b.y??0,_=Math.hypot(x,w);_>d&&(d=_)}const m=Math.max(40,d*.6);for(const b of g.nodes)y.set(b,(Math.random()-.5)*2*m);return y};o==="2d"?(c(),l("2d"),r.cameraPosition?.({x:0,y:0,z:Rt},{x:0,y:0,z:0},0)):(l("3d"),r.cameraPosition?.({x:0,y:0,z:Nt},{x:0,y:0,z:0},0));const v=()=>r.cameraPosition?.();return{get mode(){return o},setGraphData(g){r.graphData(g),o==="2d"&&c()},getGraphData(){return r.graphData()},fit(g,y){s?.();const d=g??400,m=y??40,b=r.getGraphBbox?.();if(!b)return;const x=r.camera?.()??{},w=x.fov??50,_=r.width?.()??t.width,k=r.height?.()??t.height;if(_<=0||k<=0)return;const S=Math.max(1,_-2*m),A=Math.max(1,k-2*m),O=x.aspect??_/k,E={x:(b.x[0]+b.x[1])/2,y:(b.y[0]+b.y[1])/2,z:(b.z[0]+b.z[1])/2},T=Math.max((b.x[1]-b.x[0])/2,1),I=Math.max((b.y[1]-b.y[0])/2,1),C=Math.max((b.z[1]-b.z[0])/2,0),P=w*Math.PI/180/2,R=Math.tan(P),H=60,V=v();if(!V)return;let X;const oe={x:E.x,y:E.y,z:E.z};if(o==="2d"){const F=I*k/A/R,W=T*k/S/R,Q=Math.max(F,W,H);X={x:E.x,y:E.y,z:E.z+Q},i=Q}else{const F=Math.hypot(T,I,C),W=Math.atan(R*O),Q=F*k/(A*Math.sin(P)),N=F*_/(S*Math.sin(W)),U=Math.max(Q,N,H),z=V.lookAt??{x:0,y:0,z:0},G=V.x-z.x,q=V.y-z.y,$=V.z-z.z,B=Math.hypot(G,q,$),te=B===0?{x:0,y:0,z:1}:{x:G/B,y:q/B,z:$/B};X={x:E.x+te.x*U,y:E.y+te.y*U,z:E.z+te.z*U},i=U}if(d<=0){r.cameraPosition?.(X,oe,0);return}const D=V.lookAt??{x:0,y:0,z:0};s=kt(d,F=>{r.cameraPosition?.({x:ne(V.x,X.x,F),y:ne(V.y,X.y,F),z:ne(V.z,X.z,F)},{x:ne(D.x,oe.x,F),y:ne(D.y,oe.y,F),z:ne(D.z,oe.z,F)},0)})},centerAt(g,y,d,m){if(o==="2d"){r.cameraPosition?.({x:g,y,z:Rt},{x:g,y,z:0},m??0);return}const b=v();r.cameraPosition?.({x:g,y,z:d??i},b?.lookAt,m??0)},zoom(g,y){const d=v();if(!d)return;const m=Math.hypot(d.x,d.y,d.z);i=m/Math.max(g,.001);const b=m===0?{x:0,y:0,z:1}:{x:d.x/m,y:d.y/m,z:d.z/m};r.cameraPosition?.({x:b.x*i,y:b.y*i,z:b.z*i},d.lookAt,y??0)},getZoom(){const g=v();if(!g)return 1;const y=Math.hypot(g.x,g.y,g.z);return y===0?1:i/y},screen2Graph(g,y,d){return r.screen2GraphCoords?.(g,y,d??0)??{x:g,y,z:0}},graph2Screen(g,y,d){return r.graph2ScreenCoords?.(g,y,d??0)??{x:g,y,z:d??0}},getGraphBbox(){return r.getGraphBbox?.()??{x:[0,0],y:[0,0],z:[0,0]}},pause(){r.pauseAnimation?.()},resume(){r.resumeAnimation?.()},reheat(){r.d3ReheatSimulation?.()},resize(g,y){r.width(g),r.height(y)},d3Force(g,y){const d=r.d3Force;if(typeof d=="function")return y===void 0?d.call(r,g):d.call(r,g,y)},emitParticle(g){r.emitParticle?.(g)},stopAnimation(){s?.(),s=null},focusOn(g,y){s?.();const d=v();if(!d)return;const m=g.z??0,b=y?.durationMs??1e3;if(o==="2d"){const I=y?.zoom!==void 0?i/Math.max(y.zoom,.001):Rt;s=kt(b,C=>{const P=ne(d.x,g.x,C),R=ne(d.y,g.y,C),H=ne(d.z,I,C);r.cameraPosition?.({x:P,y:R,z:H},{x:P,y:R,z:0},0)});return}const x=d.x-g.x,w=d.y-g.y,_=d.z-m,k=Math.hypot(x,w,_),S=y?.distance??120,A=k===0?{x:0,y:0,z:1}:{x:x/k,y:w/k,z:_/k},O={x:g.x+A.x*S,y:g.y+A.y*S,z:m+A.z*S},E={x:g.x,y:g.y,z:m},T=d.lookAt??{x:0,y:0,z:0};s=kt(b,I=>{r.cameraPosition?.({x:ne(d.x,O.x,I),y:ne(d.y,O.y,I),z:ne(d.z,O.z,I)},{x:ne(T.x,E.x,I),y:ne(T.y,E.y,I),z:ne(T.z,E.z,I)},0)})},getCameraState(){const g=v()??{x:0,y:0,z:Nt};if(o==="2d"){const y=g.lookAt??{x:0,y:0},d=i/Math.max(Math.hypot(g.x,g.y,g.z),1);return{mode:"2d",x:y.x,y:y.y,k:d}}return{mode:"3d",x:g.x,y:g.y,z:g.z,lookAt:g.lookAt??{x:0,y:0,z:0}}},setCameraState(g,y){s?.();const d=y??0,m=v()??{x:0,y:0,z:Nt};if(g.mode==="2d"){const x=p(g.k)??Rt;if(d<=0){r.cameraPosition?.({x:g.x,y:g.y,z:x},{x:g.x,y:g.y,z:0},0);return}const w=m.lookAt??{x:0,y:0};s=kt(d,_=>{const k=ne(m.x,g.x,_),S=ne(m.y,g.y,_),A=ne(m.z,x,_);r.cameraPosition?.({x:k,y:S,z:A},{x:ne(w.x,g.x,_),y:ne(w.y,g.y,_),z:0},0)});return}if(d<=0){r.cameraPosition?.({x:g.x,y:g.y,z:g.z},g.lookAt,0);return}const b=m.lookAt??g.lookAt;s=kt(d,x=>{r.cameraPosition?.({x:ne(m.x,g.x,x),y:ne(m.y,g.y,x),z:ne(m.z,g.z,x)},{x:ne(b.x,g.lookAt.x,x),y:ne(b.y,g.lookAt.y,x),z:ne(b.z,g.lookAt.z,x)},0)})},applyProps(g,y){Xi(r,g,y,"3d")},getCanvasElement(){return e.querySelector("canvas")},destroy(){s?.(),s=null,r._destructor()},setMode(g,y=800){if(g===o)return;o=g,s?.();const d=v()??{x:0,y:0,z:Nt};if(g==="2d"){a={x:d.x,y:d.y,z:d.z,lookAt:d.lookAt??{x:0,y:0,z:0}};const T=r.graphData(),I=new Map;for(const V of T.nodes){const X=V.z;I.set(V,typeof X=="number"?X:0)}const C=d.lookAt??{x:0,y:0,z:0},P={x:C.x,y:C.y,z:0},R=Math.hypot(d.x-C.x,d.y-C.y,d.z-C.z)||Rt,H={x:C.x,y:C.y,z:C.z+R};s=kt(y,V=>{for(const[X,oe]of I)X.z=ne(oe,0,V);r.cameraPosition?.({x:ne(d.x,H.x,V),y:ne(d.y,H.y,V),z:ne(d.z,H.z,V)},{x:ne(C.x,P.x,V),y:ne(C.y,P.y,V),z:ne(C.z,P.z,V)},0),V>=1&&(c(),l("2d"),i=R)},void 0,Wi);return}f(),l("3d");const m=u(),b=new Map;for(const[T]of m){const I=T.z;b.set(T,typeof I=="number"?I:0)}const x=d.lookAt??{x:0,y:0,z:0},w=d.x-x.x,_=d.y-x.y,k=d.z-x.z,S=Math.hypot(w,_,k)||Nt,A=Math.PI/6,O=a??{x:x.x,y:x.y-S*Math.sin(A),z:x.z+S*Math.cos(A),lookAt:{...x}},E=O.lookAt??{x:0,y:0,z:0};s=kt(y,T=>{for(const[I,C]of m){const P=b.get(I)??0;I.z=ne(P,C,T)}r.cameraPosition?.({x:ne(d.x,O.x,T),y:ne(d.y,O.y,T),z:ne(d.z,O.z,T)},{x:ne(x.x,E.x,T),y:ne(x.y,E.y,T),z:ne(x.z,E.z,T)},0),T>=1&&(r.d3ReheatSimulation?.(),i=Math.hypot(O.x-E.x,O.y-E.y,O.z-E.z))},void 0,Wi)}};function p(g){return!Number.isFinite(g)||g===0?null:i/g}}function Dg(e){const{mount:t,mode:n,width:r,height:o,data:i,props:a,paused:s,modeTransitionMs:l=800}=e,[c,f]=M.useState(null),u=M.useRef(a);u.current=a;const v=M.useRef(a),h=M.useRef(n);return M.useEffect(()=>{if(!t)return;const p=Ng(t,{initialProps:a,initialData:i,width:r,height:o,initialMode:h.current},u);return v.current=a,f(p),()=>{p.destroy(),f(null)}},[t]),M.useEffect(()=>{c&&c.mode!==n&&c.setMode(n,l)},[c,n,l]),M.useEffect(()=>{c&&(s?c.pause():c.resume())},[c,s]),M.useEffect(()=>{c&&c.resize(r,o)},[c,r,o]),M.useEffect(()=>{c&&c.setGraphData(i)},[c,i]),M.useEffect(()=>{c&&(c.applyProps(a,v.current),v.current=a)},[c,a]),c}function zg(e){const[t,n]=M.useState(null);return M.useEffect(()=>{const r=e.current;if(!r)return;const o=new ResizeObserver(i=>{const a=i[0];if(!a)return;const s=a.contentRect;n({width:s.width,height:s.height})});return o.observe(r),()=>o.disconnect()},[e]),t}function Ig(e){const t=e.mode??"single",[n,r]=M.useState([]),o=M.useRef(e.onChange);o.current=e.onChange;const i=M.useRef(!0);M.useEffect(()=>{if(i.current){i.current=!1;return}o.current?.(n)},[n]);const a=M.useCallback((f,u)=>{t!=="none"&&r(v=>{const h=v.includes(f);return t==="single"||!u?.additive?h&&v.length===1?[]:[f]:h?v.filter(p=>p!==f):[...v,f]})},[t]),s=M.useCallback(f=>{t!=="none"&&r(t==="single"?f.slice(0,1):f)},[t]),l=M.useCallback(()=>r([]),[]),c=M.useCallback(f=>n.includes(f),[n]);return{selected:n,toggle:a,set:s,clear:l,isSelected:c}}function Fg(){const[e,t]=M.useState(!1);return M.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 Bg(e,t){const n=M.useRef(!1);M.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,s=r.get(i),l=r.get(a);!s||!l||(s._neighbors.push(l),l._neighbors.push(s),s._links.push(o),l._links.push(o))}},[e,t])}function $g(e){const{mount:t,engineRef:n,selection:r,nodes:o,links:i,setSelectedLinkIds:a,liveHoverNodeIdRef:s}=e,l=M.useRef({selection:r,nodes:o,links:i,setSelectedLinkIds:a,liveHoverNodeIdRef:s});l.current.selection=r,l.current.nodes=o,l.current.links=i,l.current.setSelectedLinkIds=a,l.current.liveHoverNodeIdRef=s;const[c,f]=M.useState(null),u=M.useRef(null),v=M.useRef({x:0,y:0}).current;return M.useEffect(()=>{if(!t)return;let h=t.getBoundingClientRect();const p=()=>{h=t.getBoundingClientRect()},g=new ResizeObserver(p);g.observe(t),window.addEventListener("scroll",p,{passive:!0,capture:!0});const y=x=>{v.x=x.clientX-h.left,v.y=x.clientY-h.top,u.current=v};t.addEventListener("mousemove",y);const d=x=>{if(n.current?.stopAnimation(),x.button!==0||!x.shiftKey||l.current.liveHoverNodeIdRef.current!==null)return;const w=x.clientX-h.left,_=x.clientY-h.top;x.stopPropagation(),x.preventDefault(),f({x0:w,y0:_,x1:w,y1:_,additive:x.shiftKey});let k=null;const S=()=>{k===null&&(k=requestAnimationFrame(()=>{k=null;const E=n.current;E&&f(T=>{if(!T)return T;const I=Math.min(T.x0,T.x1),C=Math.min(T.y0,T.y1),P=Math.max(T.x0,T.x1),R=Math.max(T.y0,T.y1);if(P-I<4&&R-C<4){if(T.count===void 0)return T;const{count:V,...X}=T;return X}let H=0;for(const V of l.current.nodes){if(V.x===void 0||V.y===void 0)continue;const X=E.graph2Screen(V.x,V.y,V.z);X.x>=I&&X.x<=P&&X.y>=C&&X.y<=R&&H++}return T.count===H?T:{...T,count:H}})}))},A=E=>{const T=E.clientX-h.left,I=E.clientY-h.top;f(C=>C&&{...C,x1:T,y1:I}),S()},O=E=>{window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",O,!0),k!==null&&(cancelAnimationFrame(k),k=null);const T=E.clientX-h.left,I=E.clientY-h.top;f(null);const C=n.current;if(!C)return;const P=Math.min(w,T),R=Math.min(_,I),H=Math.max(w,T),V=Math.max(_,I);if(H-P<3&&V-R<3)return;const X=l.current,oe=X.nodes,D=X.links,F=X.selection,W=X.setSelectedLinkIds,Q=[],N=($,B)=>$>=P&&$<=H&&B>=R&&B<=V,U=new Map;for(const $ of oe){if(U.set($.id,$),$.x===void 0||$.y===void 0)continue;const B=C.graph2Screen($.x,$.y,$.z);N(B.x,B.y)&&Q.push($.id)}const z=[],G=$=>{if($&&typeof $=="object"){const B=$;if(B.x!==void 0&&B.y!==void 0)return B.z!==void 0?{x:B.x,y:B.y,z:B.z}:{x:B.x,y:B.y}}if(typeof $=="string"||typeof $=="number"){const B=U.get($);if(B&&B.x!==void 0&&B.y!==void 0)return B.z!==void 0?{x:B.x,y:B.y,z:B.z}:{x:B.x,y:B.y}}return null};for(const $ of D){if($.id===void 0)continue;const B=G($.source),te=G($.target);if(!B||!te)continue;const ae=C.graph2Screen((B.x+te.x)/2,(B.y+te.y)/2,B.z!==void 0&&te.z!==void 0?(B.z+te.z)/2:void 0),ce=C.graph2Screen(B.x,B.y,B.z),ye=C.graph2Screen(te.x,te.y,te.z);(N(ae.x,ae.y)||N(ce.x,ce.y)&&N(ye.x,ye.y))&&z.push($.id)}if(E.shiftKey||E.metaKey||E.ctrlKey){const $=F.selected,B=$.slice(),te=new Set($);for(const ae of Q)te.has(ae)||(te.add(ae),B.push(ae));F.set(B),W(ae=>{const ce=ae.slice(),ye=new Set(ae);for(const fe of z)ye.has(fe)||(ye.add(fe),ce.push(fe));return ce})}else F.set(Q),W(z)};window.addEventListener("mousemove",A),window.addEventListener("mouseup",O,!0)};t.addEventListener("mousedown",d,!0);const m=()=>n.current?.stopAnimation(),b=()=>n.current?.stopAnimation();return t.addEventListener("wheel",m,{passive:!0,capture:!0}),t.addEventListener("touchstart",b,{passive:!0,capture:!0}),()=>{t.removeEventListener("mousemove",y),t.removeEventListener("mousedown",d,!0),t.removeEventListener("wheel",m,{capture:!0}),t.removeEventListener("touchstart",b,{capture:!0}),window.removeEventListener("scroll",p,{capture:!0}),g.disconnect()}},[t,n]),{marquee:c,lastCursorRef:u}}const Hg=60;function Ug(e,t={}){const n=typeof t=="number"?{tolerancePx:t}:t,r=n.tolerancePx??12,o=n.pressGraceMs??Hg;M.useEffect(()=>{if(!e)return;const i=r*r;let a=!1,s=!1,l=0,c=0,f=0;const u=p=>{e.contains(p.target)&&(a=!0,s=!1,l=p.clientX,c=p.clientY,f=performance.now())},v=p=>{if(!a||s)return;if(performance.now()-f<o){p.stopPropagation();return}const g=p.clientX-l,y=p.clientY-c;g*g+y*y<i?p.stopPropagation():s=!0},h=()=>{a=!1,s=!1};return window.addEventListener("pointerdown",u,!0),window.addEventListener("pointermove",v,!0),window.addEventListener("mousemove",v,!0),window.addEventListener("pointerup",h,!0),window.addEventListener("pointercancel",h,!0),window.addEventListener("mouseup",h,!0),()=>{window.removeEventListener("pointerdown",u,!0),window.removeEventListener("pointermove",v,!0),window.removeEventListener("mousemove",v,!0),window.removeEventListener("pointerup",h,!0),window.removeEventListener("pointercancel",h,!0),window.removeEventListener("mouseup",h,!0)}},[e,r,o])}function qg(e){const{enableClipboard:t,dataApi:n,deleteGate:r,selection:o,setSelectedLinkIds:i,engineRef:a,lastCursorRef:s,onCopy:l,onCut:c,onPaste:f}=e,u=M.useRef([]),v=M.useCallback(()=>{const x=new Set(o.selected),w=[];for(const _ of n.data.nodes){if(!x.has(_.id))continue;const{id:k,x:S,y:A,z:O,vx:E,vy:T,vz:I,fx:C,fy:P,fz:R,...H}=_;w.push(H)}return w},[n.data.nodes,o.selected]),h=M.useCallback(()=>{if(!t)return[];const x=new Set(o.selected),w=n.data.nodes.filter(_=>x.has(_.id));return u.current=v(),l?.(w),w},[t,n.data.nodes,o.selected,v,l]),p=M.useCallback(async()=>{if(!t)return[];const x=new Set(o.selected),w=n.data.nodes.filter(k=>x.has(k.id));return w.length===0?[]:await r.requestNodeDelete(o.selected,"cut")?(u.current=v(),c?.(w),w):[]},[t,n,r,o,v,c]),g=M.useCallback(x=>{if(!t)return[];const w=u.current;if(w.length===0)return[];const _=x||(()=>{const S=s.current;if(!(!S||!a.current))return a.current.screen2Graph(S.x,S.y)})(),k=n.addNodes(w.map((S,A)=>{const O=A%3*24,E=Math.floor(A/3)*24;return{...S,..._?{x:_.x+O,y:_.y+E,..._.z!==void 0?{z:_.z+E}:{}}:{}}}));return o.set(k.map(S=>S.id)),i([]),f?.(k),k},[t,n,o,i,f,a,s]),y=M.useCallback(()=>{const x=new Set(o.selected),w=[];let _=0;for(const S of n.data.nodes){if(!x.has(S.id))continue;const{id:A,vx:O,vy:E,vz:T,fx:I,fy:C,fz:P,...R}=S,H=_%3*24,V=Math.floor(_/3)*24;w.push({...R,...S.x!==void 0?{x:S.x+H}:{},...S.y!==void 0?{y:S.y+V}:{},...S.z!==void 0?{z:S.z}:{}}),_++}if(w.length===0)return[];const k=n.addNodes(w);return o.set(k.map(S=>S.id)),i([]),k},[n,o,i]),d=M.useCallback(x=>{const w=o.selected;if(w.length===0)return null;const _=n.data.nodes.filter(O=>w.includes(O.id));if(_.length===0)return null;let k=x?.at;if(!k){let O=0,E=0,T=0,I=!1;for(const C of _)O+=C.x??0,E+=C.y??0,T+=C.z??0,(C.x!==void 0||C.y!==void 0)&&(I=!0);I&&(k={x:O/_.length+30,y:E/_.length+30,z:T/_.length})}const S=x?.label!==void 0?{label:x.label}:{},A=n.addNode(S,k?{at:k}:void 0);for(const O of _)n.addLink({source:O.id,target:A.id});return o.set([A.id]),i([]),A},[n,o,i]),m=M.useCallback(x=>{const w=n.data.nodes.find(_=>_.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]),b=M.useCallback(()=>u.current.length>0,[]);return M.useMemo(()=>({hasClipboard:b,copy:h,cut:p,paste:g,duplicate:y,addConnectedNode:d,togglePin:m}),[b,h,p,g,y,d,m])}async function Yi(e,t,n){if(t.length===0||!e)return!0;try{return await e(t,{source:n})}catch{return!1}}function Gg(e){const{dataApi:t,beforeNode:n,beforeLink:r,onNodeDeleted:o,onLinkDeleted:i,afterNodeDelete:a,afterLinkDelete:s}=e,l=M.useCallback((u,v)=>{if(u.length===0)return Promise.resolve(!1);const h=new Set(u),p=t.data.nodes.filter(y=>h.has(y.id));if(p.length===0)return Promise.resolve(!1);const g=()=>(t.removeNodes(u),o?.(p,{source:v}),a?.(u),!0);return n?Promise.resolve(Yi(n,p,v)).then(y=>y?g():!1):Promise.resolve(g())},[t,n,o,a]),c=M.useCallback((u,v)=>{const h=typeof u=="function"?u:(()=>{const y=new Set(u);return d=>d.id!==void 0&&y.has(d.id)})(),p=t.data.links.filter(h);if(p.length===0)return Promise.resolve(!1);const g=()=>{t.removeLink(h),i?.(p,{source:v});const y=p.map(d=>d.id).filter(d=>d!==void 0);return s?.(y),!0};return r?Promise.resolve(Yi(r,p,v)).then(y=>y?g():!1):Promise.resolve(g())},[t,r,i,s]),f=M.useCallback(async(u,v,h)=>{const[p,g]=await Promise.all([u.length>0?l(u,h):Promise.resolve(!1),v.length>0?c(v,h):Promise.resolve(!1)]);return p||g},[l,c]);return M.useMemo(()=>({requestNodeDelete:l,requestLinkDelete:c,requestMixedDelete:f}),[l,c,f])}const Vg=40;function Wg(e){const t=M.useRef(e);t.current=e,M.useEffect(()=>{let n=-1;const r=o=>{const i=t.current,a=i.hostRef.current,s=document.activeElement;if(a&&s&&s!==document.body&&!a.contains(s))return;const l=o.target;if(!(l&&(l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.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":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 u=f.getGraphBbox(),v=(u.x[0]+u.x[1])/2,h=(u.y[0]+u.y[1])/2,p=f.getZoom?.()??1,g=Vg/Math.max(p,.1);let y=0,d=0;o.key==="ArrowLeft"?y=-g:o.key==="ArrowRight"?y=g:o.key==="ArrowUp"?d=-g:d=g,f.centerAt(v+y,h+d,void 0,120),o.preventDefault();break}case"Tab":{const f=i.engine,u=i.dataApi.data.nodes;if(!f||u.length===0)return;n=o.shiftKey?(n-1+u.length)%u.length:(n+1)%u.length;const v=u[n];if(!v||v.x===void 0||v.y===void 0)return;i.selection.set([v.id]),f.focusOn({x:v.x,y:v.y,...v.z!==void 0?{z:v.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 Xg(e){const{engine:t,collideNodes:n,beeswarm:r,nodeRelSize:o}=e;M.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",ti(i)),t.reheat(),()=>{t.d3Force("collide",null)}},[t,n,o,r]),M.useEffect(()=>{if(!t)return;if(!r){t.d3Force("x",null),t.d3Force("y",null);return}const i=r===!0?{}:r,a=i.axis??"x",s=i.strength??.2,l=i.value,c=v=>{const h=String(v);let p=0;for(let g=0;g<h.length;g++)p=p*31+h.charCodeAt(g)|0;return(p%600+600)%600-300},f=v=>{const h=v;if(typeof l=="function")return l(h);if(typeof l=="string"){const p=h[l];if(typeof p=="number")return p;if(typeof p=="string")return Number(p)||0}return c(h.id)};t.d3Force("center",null),t.d3Force("charge",null),a==="x"?(t.d3Force("x",li(f)),t.d3Force("y",ci(0).strength(s))):(t.d3Force("y",ci(f)),t.d3Force("x",li(0).strength(s)));const u=(o??4)+2;t.d3Force("collide",ti(u)),t.reheat()},[t,r,o])}function qt(e,t){return typeof e=="function"?e(t):typeof e=="string"?t[e]:e}function Ki(e,t){const n=qt(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 Qi(e,t){const n=qt(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 an(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),s=parseInt(i.slice(2,4),16),l=parseInt(i.slice(4,6),16);return`rgba(${a}, ${s}, ${l}, ${t})`}}const n=e.match(/^rgb\(([^)]+)\)$/);if(n)return`rgba(${n[1]}, ${t})`;const r=e.match(/^rgba\(([^,]+),([^,]+),([^,]+),[^)]+\)$/);return r?`rgba(${r[1]},${r[2]},${r[3]},${t})`:e}const Dt=new Set;function Yg(e){const{mode:t,accentColor:n,nodeColor:r,linkColor:o,linkWidth:i,nodeVal:a,nodeRelSize:s,nodePointerAreaPaint:l,nodeAutoColorBy:c,nodeVisibility:f,selectedNodeSet:u,selectedLinkSet:v,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:g,hoverNodeId:y,hoverLinkId:d,hiddenGroups:m}=e,b=M.useRef({mode:t,accentColor:n,selectedNodeSet:u,selectedLinkSet:v,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:g,hoverNodeId:y,hoverLinkId:d,hiddenGroups:m});b.current={mode:t,accentColor:n,selectedNodeSet:u,selectedLinkSet:v,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:g,hoverNodeId:y,hoverLinkId:d,hiddenGroups:m};const x=u.size>0||v.size>0||h&&p.size>0,w=M.useMemo(()=>{const z=r;return G=>{const q=b.current;if(G.id!==void 0&&q.selectedNodeSet.has(G.id))return q.accentColor;if(q.highlightNeighborsOnHover&&q.highlightedNodeIds.size>0&&G.id!==void 0&&q.highlightedNodeIds.has(G.id))return q.hoverNodeId===G.id?q.accentColor:an(q.accentColor,.7);let B;return typeof z=="function"?B=z(G):typeof z=="string"?B=z:B=G.color??"#888",(q.selectedNodeSet.size>0||q.selectedLinkSet.size>0)&&q.mode!=="3d"?an(B,.25):B}},[r,u,v,y,p]),_=x?w:r,k=c!==void 0&&m.size>0,S=u.size>0||v.size>0||d!==null||h&&g.size>0||k,A="rgba(96, 102, 110, 0.55)",O="rgba(180, 188, 198, 0.55)",E=M.useMemo(()=>{const z=o,G=c;return q=>{const $=b.current,B=q.id,te=typeof q.source=="object"?q.source:null,ae=typeof q.target=="object"?q.target:null;if($.hiddenGroups.size>0&&G!==void 0){const Wt=Ke=>{if(!Ke)return null;const vt=typeof G=="function"?G(Ke):Ke[G];return vt==null?null:String(vt)},Pt=Wt(te),Xt=Wt(ae);if(Pt!==null&&$.hiddenGroups.has(Pt)||Xt!==null&&$.hiddenGroups.has(Xt)){let Ke;return typeof z=="function"?Ke=z(q):typeof z=="string"?Ke=z:Ke=q.color??A,an(Ke,.05)}}if(B!==void 0&&$.selectedLinkSet.has(B))return $.accentColor;const ce=te?.id??q.source,ye=ae?.id??q.target,fe=$.selectedNodeSet.size>0;if(fe&&(ce!==void 0&&$.selectedNodeSet.has(ce)||ye!==void 0&&$.selectedNodeSet.has(ye)))return an($.accentColor,.85);const Be=B!==void 0&&$.hoverLinkId===B,nt=$.highlightNeighborsOnHover&&B!==void 0&&$.highlightedLinkIds.has(B);if(Be||nt)return O;let Ee;return typeof z=="function"?Ee=z(q):typeof z=="string"?Ee=z:Ee=q.color??A,fe||$.selectedLinkSet.size>0?an(Ee,$.mode==="3d"?.45:.18):Ee}},[o,c,v,u,d,g,m]),T=S?E:o,I=u.size>0||v.size>0||d!==null||h&&g.size>0,C=.6,P=1.5,R=.4,H=1,V=.5,X=1.2,oe=M.useMemo(()=>{const z=i;return G=>{const q=b.current,$=G.id,B=$!==void 0&&q.selectedLinkSet.has($),te=typeof G.source=="object"?G.source.id:G.source,ae=typeof G.target=="object"?G.target.id:G.target,ye=q.selectedNodeSet.size>0&&(te!==void 0&&q.selectedNodeSet.has(te)||ae!==void 0&&q.selectedNodeSet.has(ae)),fe=$!==void 0&&q.hoverLinkId===$,Te=q.highlightNeighborsOnHover&&$!==void 0&&q.highlightedLinkIds.has($),Be=fe||Te,nt=typeof z=="function"?z(G):typeof z=="number"?z:G.width??1,Ee=q.mode==="3d";return B?nt+(Ee?V:X):Be?nt+(Ee?C:P):ye?nt+(Ee?R:H):nt}},[i]),D=I?oe:i,F=u.size>0||h&&p.size>0,W=M.useMemo(()=>{const z=a;return G=>{const q=b.current,$=G.id,B=typeof z=="function"?z(G):typeof z=="number"?z:G.val??1;return $!==void 0&&q.selectedNodeSet.has($)?B*2.25:q.highlightNeighborsOnHover&&q.highlightedNodeIds.size>0&&$!==void 0&&q.highlightedNodeIds.has($)?q.hoverNodeId===$?B*1.8:B*1.4:B}},[a]),Q=F?W:a,N=M.useMemo(()=>{if(t!=="2d"||l)return l;const z=a,G=s??4;return(q,$,B,te)=>{const ae=typeof z=="function"?z(q):typeof z=="number"?z:q.val??1,ce=Math.sqrt(Math.max(0,ae))*G+1/Math.max(te,1e-6);B.fillStyle=$,B.beginPath(),B.arc(q.x??0,q.y??0,ce,0,2*Math.PI,!1),B.fill()}},[t,a,s,l]),U=M.useMemo(()=>{const z=c&&m.size>0;if(!z&&f===void 0)return;const G=c,q=f;return $=>{if(z&&G){const B=typeof G=="function"?G($):$[G];if(B!=null&&m.has(String(B)))return!1}return typeof q=="function"?!!q($):typeof q=="boolean"?q:typeof q=="string"?!!$[q]:!0}},[c,f,m]);return M.useMemo(()=>({nodeColor:_,linkColor:T,linkWidth:D,nodeVal:Q,nodePointerAreaPaint:N,nodeVisibility:U}),[_,T,D,Q,N,U])}const Zi=250;function Ji(e){return e==null?null:typeof e=="string"||typeof HTMLElement<"u"&&e instanceof HTMLElement?e:String(e)}function Kg(e){const{highlightNeighborsOnHover:t,nodeLabel:n,linkLabel:r,onNodeHover:o,onLinkHover:i}=e,[a,s]=M.useState(null),[l,c]=M.useState(null),[f,u]=M.useState(Dt),[v,h]=M.useState(Dt),[p,g]=M.useState(null),y=M.useRef(null),d=M.useRef(null),m=M.useRef(null),b=M.useRef(null),x=M.useRef(null);M.useEffect(()=>()=>{b.current!==null&&(clearTimeout(b.current),b.current=null),x.current!==null&&(clearTimeout(x.current),x.current=null)},[]);const w=M.useCallback((O,E)=>{if(o?.(O,E),y.current=O?.id??null,!O&&m.current!==null)return;if(b.current!==null&&(clearTimeout(b.current),b.current=null),!O){b.current=setTimeout(()=>{b.current=null,s(null),t&&(u(Dt),h(Dt)),d.current===null&&g(null)},Zi);return}if(t){const I=new Set([O.id]),C=new Set,P=O._neighbors??[];for(const H of P)H.id!==void 0&&I.add(H.id);const R=O._links??[];for(const H of R)H.id!==void 0&&C.add(H.id);s(O.id),u(I),h(C)}else s(O.id);const T=qt(n,O);g(Ji(T))},[o,n,t]),_=M.useCallback((O,E)=>{if(i?.(O,E),d.current=O?.id??null,x.current!==null&&(clearTimeout(x.current),x.current=null),!O){x.current=setTimeout(()=>{x.current=null,c(null),y.current===null&&g(null)},Zi);return}c(O.id??null);const T=qt(r,O);g(Ji(T))},[i,r]),k=M.useMemo(()=>a===null?Dt:t?f:new Set([a]),[a,t,f]),S=M.useMemo(()=>{if(l!==null){if(t&&a!==null){const O=new Set(v);return O.add(l),O}return new Set([l])}return a!==null&&t?v:Dt},[l,a,t,v]),A=M.useCallback(O=>{if(m.current=O?.id??null,O){w(O,null);return}w(null,null)},[w]);return{hoverNodeId:a,hoverLinkId:l,liveHoverNodeIdRef:y,liveHoverLinkIdRef:d,highlightedNodeIds:f,highlightedLinkIds:v,hoveredNodeSet:k,hoveredLinkSet:S,tooltipContent:p,handleNodeHover:w,handleLinkHover:_,pinHover:A}}const ut={frameId:-1,fov:-1,tanHalfFov:0,canvasHeightPx:1},ea=new Z.Vector2;function Qg(e,t){const n=e.info?.render?.frame??-1;return n===ut.frameId&&t===ut.fov||(e.getSize(ea),ut.frameId=n,ut.fov=t,ut.tanHalfFov=Math.tan(t*Math.PI/180/2),ut.canvasHeightPx=ea.y||1),ut}function Gn(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 Vn(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:s=4}=e,c=document.createElement("canvas").getContext("2d");if(!c)return new Z.Sprite(new Z.SpriteMaterial);c.font=`${n}px ${r}`;const f=Math.ceil(c.measureText(t).width),u=Math.ceil(n*1.2),v=f+a*2,h=u+a*2,p=(_,k,S)=>{_.width=v,_.height=h;const A=_.getContext("2d");if(A.font=`${n}px ${r}`,S){A.fillStyle=S;const O=Math.min(_.height/2,8),E=A;A.beginPath(),typeof E.roundRect=="function"?E.roundRect(0,0,_.width,_.height,O):A.rect(0,0,_.width,_.height),A.fill()}A.fillStyle=k,A.textAlign="center",A.textBaseline="middle",A.fillText(t,_.width/2,_.height/2)},g=document.createElement("canvas");p(g,o,i);const y=new Z.CanvasTexture(g);y.minFilter=Z.LinearFilter,y.magFilter=Z.LinearFilter,y.needsUpdate=!0;let d;if(e.selectedColor!==void 0&&e.selectedBackgroundColor!==void 0){const _=document.createElement("canvas");p(_,e.selectedColor,e.selectedBackgroundColor),d=new Z.CanvasTexture(_),d.minFilter=Z.LinearFilter,d.magFilter=Z.LinearFilter,d.needsUpdate=!0}const m=new Z.SpriteMaterial({map:y,transparent:!0,depthWrite:!1}),b=new Z.Sprite(m),x=b.userData;x.normalTexture=y,d&&(x.selectedTexture=d);const w=v/h;if(b.scale.set(s*w,s,1),e.pixelHeight!==void 0&&e.pixelHeight>0){const _=e.pixelHeight,k=new Z.Vector3;let S=-1;b.onBeforeRender=(A,O,E)=>{const T=E;if(!T.isPerspectiveCamera||typeof T.fov!="number")return;b.getWorldPosition(k);const I=T.position.distanceTo(k);if(I<=0)return;const C=Qg(A,T.fov),P=2*C.tanHalfFov*I*_/C.canvasHeightPx;S>0&&Math.abs(P-S)<S*.005||(S=P,b.scale.set(P*w,P,1))}}return b}function Zg(e){const{mode:t,showLabels:n,selectedNodeSet:r,hoveredNodeSet:o,accentColor:i,hostNodeCanvasObject:a,hostNodeThreeObject:s,nodeLabel:l,nodeVal:c,nodeRelSize:f,theme:u}=e,v=u?.tooltipBackground??"rgba(28, 31, 35, 0.9)",h=u?.tooltipForeground??"#ffffff",p=M.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:o,accentColor:i,tooltipBg:v,tooltipFg:h});p.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:o,accentColor:i,tooltipBg:v,tooltipFg:h};const g=M.useMemo(()=>{if(t!=="2d"||a)return;const _=u?.fontFamily??"system-ui, sans-serif";return(k,S,A)=>{const O=p.current,E=k.id!==void 0&&O.selectedNodeSet.has(k.id),T=k.id!==void 0&&O.hoveredNodeSet?.has(k.id)===!0;if(!O.showLabels&&!E&&!T)return;const I=Ki(l,k);if(!I)return;const C=qt(c,k)??1,P=f??4,R=Math.max(.5,Math.sqrt(Math.max(C,0))*P),H=14/A,V=6/A,X=4/A;S.font=`${H}px ${_}`;const D=S.measureText(I).width+V*2,F=H+X*2,W=k.x??0,Q=(k.y??0)-R*2-4/A-F;S.fillStyle=E?O.accentColor:O.tooltipBg;const N=Math.min(F/2,6/A),U=S;S.beginPath(),typeof U.roundRect=="function"?U.roundRect(W-D/2,Q,D,F,N):S.rect(W-D/2,Q,D,F),S.fill(),S.textAlign="center",S.textBaseline="top",S.fillStyle=E?"#ffffff":O.tooltipFg,S.fillText(I,W,Q+X)}},[t,a,l,c,f,u?.fontFamily]),y=o?.size??0,m=n||r.size>0||y>0?g:void 0,b=M.useRef(new Map),x=M.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:o});x.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:o},M.useEffect(()=>{const _=b.current;return()=>{for(const k of _.values())k.sprite&&Gn(k.sprite);_.clear()}},[]);const w=M.useMemo(()=>{if(s)return;const _=b.current,k=u?.fontFamily??"system-ui, sans-serif";return S=>{const A=S.id,O=Ki(l,S),E=qt(c,S)??1,T=f??4,C=Math.cbrt(Math.max(E,0))*T*2+4,P=new Z.Group;if(A!==void 0&&O){const R={group:P,sprite:null,text:O,yOffset:C};_.set(A,R);const H=x.current,V=H.selectedNodeSet.has(A),X=H.hoveredNodeSet?.has(A)===!0;if(H.showLabels||V||X){const oe=Vn({text:O,fontFamily:k,fontSize:48,color:h,backgroundColor:v,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:28});if(oe.material.depthTest=!1,oe.renderOrder=1e3,oe.position.set(0,C,0),V){const D=oe.userData;if(D.selectedTexture){const F=oe.material;F.map=D.selectedTexture,F.needsUpdate=!0}}P.add(oe),R.sprite=oe}}return P}},[s,l,c,f,u?.fontFamily,v,h,i]);return M.useEffect(()=>{const _=b.current,k=u?.fontFamily??"system-ui, sans-serif";for(const[S,A]of _){if(A.group.parent===null){A.sprite&&Gn(A.sprite),_.delete(S);continue}const O=r.has(S),E=o?.has(S)===!0,T=n||O||E;if(T&&A.sprite===null){const C=Vn({text:A.text,fontFamily:k,fontSize:48,color:h,backgroundColor:v,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:28});C.material.depthTest=!1,C.renderOrder=1e3,C.position.set(0,A.yOffset,0),A.group.add(C),A.sprite=C}const I=A.sprite;if(I){I.visible=T;const C=I.userData,P=O&&C.selectedTexture?C.selectedTexture:C.normalTexture,R=I.material;P&&R.map!==P&&(R.map=P,R.needsUpdate=!0)}}},[n,r,o,i,v,h,u?.fontFamily]),{canvasObject:m,threeObject:w,renderFramePost:void 0}}function Jg(e){const{mode:t,showLabels:n,selectedLinkSet:r,hoveredLinkSet:o,accentColor:i,hostLinkCanvasObject:a,hostLinkThreeObject:s,hostLinkPositionUpdate:l,linkLabel:c,theme:f}=e,u=f?.tooltipBackground??"rgba(255, 255, 255, 0.94)",v=f?.tooltipForeground??"#1c1f23",h=M.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:o,accentColor:i,tooltipBg:u,tooltipFg:v});h.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:o,accentColor:i,tooltipBg:u,tooltipFg:v};const p=M.useMemo(()=>{if(t!=="2d"||a)return;const _=f?.fontFamily??"system-ui, sans-serif",k=4,S=6;return(A,O)=>{const E=h.current,T=A.id!==void 0&&E.selectedLinkSet.has(A.id),I=A.id!==void 0&&E.hoveredLinkSet?.has(A.id)===!0;if(!E.showLabels&&!T&&!I)return;const C=A.source,P=A.target;if(typeof C!="object"||typeof P!="object")return;const R=Qi(c,A);if(!R||R===" → ")return;const H=C.x,V=C.y,X=P.x,oe=P.y;if(H===void 0||V===void 0||X===void 0||oe===void 0)return;const D=X-H,F=oe-V,Q=Math.sqrt(D*D+F*F)-S*2;if(Q<=0)return;O.font=`1px ${_}`;const N=O.measureText(R).width||1,U=Math.min(k,Q/N);O.font=`${U}px ${_}`;let z=Math.atan2(F,D);z>Math.PI/2&&(z=-(Math.PI-z)),z<-Math.PI/2&&(z=-(-Math.PI-z));const G=(H+X)/2,q=(V+oe)/2,$=O.measureText(R).width,B=U*.6,te=U*.35,ae=$+B,ce=U+te,ye=Math.min(ce/2,U*.35);O.save(),O.translate(G,q),O.rotate(z),O.fillStyle=T?E.accentColor:E.tooltipBg;const fe=O;O.beginPath(),typeof fe.roundRect=="function"?fe.roundRect(-ae/2,-ce/2,ae,ce,ye):O.rect(-ae/2,-ce/2,ae,ce),O.fill(),O.textAlign="center",O.textBaseline="middle",O.fillStyle=T?"#ffffff":E.tooltipFg,O.fillText(R,0,0),O.restore()}},[t,a,c,f?.fontFamily]),g=o?.size??0,d=n||r.size>0||g>0?p:void 0,m=M.useRef(new Map),b=M.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:o});b.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:o},M.useEffect(()=>{const _=m.current;return()=>{for(const k of _.values())k.sprite&&Gn(k.sprite);_.clear()}},[]);const x=M.useMemo(()=>{if(s)return;const _=m.current,k=f?.fontFamily??"system-ui, sans-serif";return S=>{const A=Qi(c,S),O=new Z.Group,E=S.id;if(E!==void 0&&A&&A!==" → "){const T={group:O,sprite:null,text:A};_.set(E,T);const I=b.current,C=I.selectedLinkSet.has(E),P=I.hoveredLinkSet?.has(E)===!0;if(I.showLabels||C||P){const R=Vn({text:A,fontFamily:k,fontSize:48,color:v,backgroundColor:u,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:22});if(R.material.depthTest=!1,R.renderOrder=500,C){const H=R.userData;if(H.selectedTexture){const V=R.material;V.map=H.selectedTexture,V.needsUpdate=!0}}O.add(R),T.sprite=R}}return O}},[s,c,f?.fontFamily,u,v,i]);M.useEffect(()=>{const _=m.current,k=f?.fontFamily??"system-ui, sans-serif";for(const[S,A]of _){if(A.group.parent===null){A.sprite&&Gn(A.sprite),_.delete(S);continue}const O=r.has(S),E=o?.has(S)===!0,T=n||O||E;if(T&&A.sprite===null){const C=Vn({text:A.text,fontFamily:k,fontSize:48,color:v,backgroundColor:u,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:22});C.material.depthTest=!1,C.renderOrder=500,A.group.add(C),A.sprite=C}const I=A.sprite;if(I){I.visible=T;const C=I.userData,P=O&&C.selectedTexture?C.selectedTexture:C.normalTexture,R=I.material;P&&R.map!==P&&(R.map=P,R.needsUpdate=!0)}}},[n,r,o,i,u,v,f?.fontFamily]);const w=M.useMemo(()=>{if(l!=null)return;const _=t==="2d";return(k,S)=>{if(k instanceof Z.Group){const A=(S.start.x+S.end.x)/2,O=(S.start.y+S.end.y)/2,E=(S.start.z+S.end.z)/2;k.position.set(A,O,E);const T=k.parent;if(T&&!T.userData.lgcOrderApplied){T.userData.lgcOrderApplied=!0,T.renderOrder=-1;for(const C of T.children)C!==k&&(C.renderOrder=-1)}const I=k.children[0];if(I instanceof Z.Sprite){const C=I.material;if(_){const P=S.end.x-S.start.x,R=S.end.y-S.start.y;let H=Math.atan2(R,P);H>Math.PI/2?H-=Math.PI:H<-Math.PI/2&&(H+=Math.PI),Math.abs(C.rotation-H)>.001&&(C.rotation=H)}else C.rotation!==0&&(C.rotation=0)}}return!0}},[t,l]);return{canvasObject:d,threeObject:x,positionUpdate:w}}function ev({nodeCount:e,linkCount:t}){const n=e+t*.5;return n>=5e4?"huge":n>=1e4?"xlarge":n>=2e3?"large":"default"}function tv(e,t){if(e==="default")return{};const n={cooldownTicks:e==="large"?100:e==="xlarge"?60:30,d3AlphaDecay:e==="large"?.04:e==="xlarge"?.08:.15,d3VelocityDecay:e==="huge"?.6:.4,linkHoverPrecision:e==="large"?4:2,warmupTicks:0,linkDirectionalParticles:0,linkDirectionalArrowLength:0};return n.forceEngine="ngraph",n.nodeResolution=e==="large"?8:e==="xlarge"?4:3,n.linkResolution=e==="large"?4:0,n.nodeOpacity=1,n.linkOpacity=1,n.pointerRaycasterThrottleMs=e==="large"?32:e==="xlarge"?100:200,n}function nv(e){const{profile:t="auto",nodeCount:n,linkCount:r,mode:o}=e;return M.useMemo(()=>{if(t==="off")return{};const i=t==="auto"?ev({nodeCount:n,linkCount:r}):t;return tv(i)},[t,n,r,o])}function rv(e){const{ref:t,dataApi:n,deleteGate:r,selection:o,engine:i,mode:a,setMode:s,setPaused:l,clipboard:c,exportJSON:f,importJSON:u,downloadJSON:v}=e;M.useImperativeHandle(t,()=>({getData:()=>n.data,setData:n.setData,addNode:n.addNode,addNodes:n.addNodes,updateNode:n.updateNode,removeNode:h=>r.requestNodeDelete([h],"imperative"),removeNodes:h=>r.requestNodeDelete(h,"imperative"),addLink:n.addLink,addLinks:n.addLinks,removeLink:h=>r.requestLinkDelete(h,"imperative"),clear:n.clear,getSelection:()=>o.selected,setSelection:o.set,selectAll:()=>o.set(n.data.nodes.map(h=>h.id)),clearSelection:o.clear,getMode:()=>a,setMode:s,fit:(h,p)=>i?.fit(h,p),centerAt:(h,p,g,y)=>i?.centerAt(h,p,g,y),zoom:(h,p)=>i?.zoom(h,p),zoomIn:(h=1.2)=>{i&&i.zoom((i.getZoom?.()??1)*h,200)},zoomOut:(h=1.2)=>{i&&i.zoom((i.getZoom?.()??1)/h,200)},pause:()=>{i?.pause(),l(!0)},resume:()=>{i?.resume(),l(!1)},reheat:()=>i?.reheat(),screenshot:async()=>{const h=i?.getCanvasElement();return h?new Promise(p=>h.toBlob(g=>p(g))):null},copy:c.copy,cut:c.cut,paste:h=>c.paste(h?.at),duplicate:c.duplicate,addConnectedNode:c.addConnectedNode,togglePin:c.togglePin,exportJSON:f,importJSON:u,downloadJSON:v,d3Force:(h,p)=>i?.d3Force(h,p),emitParticle:h=>i?.emitParticle(h),stopAnimation:()=>i?.stopAnimation(),engine2D:()=>i?.mode==="2d"?i:null,engine3D:()=>i?.mode==="3d"?i:null}),[t,n,r,i,a,s,l,o,c,f,u,v])}function ov(){const[e,t]=M.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return M.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 Ce={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},iv=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("path",{d:"M3 2.5l4 10 1.4-3.6 3.6-1.4z"})}),av=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("path",{d:"M8 3v10M3 8h10M5 5l6 6M11 5L5 11"})}),sv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("circle",{cx:"6",cy:"8",r:"3"}),L.jsx("path",{d:"M12 5v6M9 8h6"})]}),lv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("circle",{cx:"4",cy:"4",r:"2"}),L.jsx("circle",{cx:"12",cy:"12",r:"2"}),L.jsx("path",{d:"M5.5 5.5l5 5"})]}),Os=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("path",{d:"M3 5h10M6 5V3h4v2M5 5l1 8h4l1-8"})}),cv=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("path",{d:"M3 6V3h3M13 6V3h-3M3 10v3h3M13 10v3h-3"})}),uv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("circle",{cx:"7",cy:"7",r:"4"}),L.jsx("path",{d:"M5 7h4M7 5v4M10 10l3 3"})]}),fv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("circle",{cx:"7",cy:"7",r:"4"}),L.jsx("path",{d:"M5 7h4M10 10l3 3"})]}),dv=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("path",{d:"M6 3v10M10 3v10"})}),hv=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("path",{d:"M5 3l8 5-8 5z"})}),pv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("path",{d:"M3 5h2l1-2h4l1 2h2v8H3z"}),L.jsx("circle",{cx:"8",cy:"9",r:"2.5"})]}),As=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("path",{d:"M8 2l5 3v6l-5 3-5-3V5z"}),L.jsx("path",{d:"M8 8v7M8 8L3 5M8 8l5-3"})]}),gv=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),js=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),L.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"})]}),vv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",strokeDasharray:"2 2"}),L.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor"}),L.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"currentColor"}),L.jsx("circle",{cx:"6",cy:"10",r:"1",fill:"currentColor"}),L.jsx("circle",{cx:"10",cy:"10",r:"1",fill:"currentColor"})]}),yv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("path",{d:"M8 2v8M5 5l3-3 3 3"}),L.jsx("path",{d:"M3 12h10v2H3z"})]}),mv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("path",{d:"M8 10V2M5 7l3 3 3-3"}),L.jsx("path",{d:"M3 12h10v2H3z"})]}),bv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("circle",{cx:"4",cy:"8",r:"2"}),L.jsx("path",{d:"M6 8h2.5"}),L.jsx("circle",{cx:"11",cy:"8",r:"2"}),L.jsx("path",{d:"M11 6.5v3M9.5 8h3"})]}),Ts={select:{id:"select",label:"Select",hint:"Select / multi-select nodes",icon:iv,toggleable:!0,shortcut:"V"},pan:{id:"pan",label:"Pan",hint:"Pan the canvas",icon:av,toggleable:!0,shortcut:"H"},"add-node":{id:"add-node",label:"Add node",hint:"Click on the canvas to add a node",icon:sv,toggleable:!0,shortcut:"N"},"add-link":{id:"add-link",label:"Add link",hint:"Click two nodes to connect them",icon:lv,toggleable:!0,shortcut:"L"},delete:{id:"delete",label:"Delete",hint:"Delete selected node(s)",icon:Os,shortcut:"⌫"},fit:{id:"fit",label:"Fit",hint:"Fit graph to viewport",icon:cv,shortcut:"F"},"zoom-in":{id:"zoom-in",label:"Zoom in",hint:"Zoom in",icon:uv,shortcut:"+"},"zoom-out":{id:"zoom-out",label:"Zoom out",hint:"Zoom out",icon:fv,shortcut:"-"},pause:{id:"pause",label:"Pause",hint:"Pause simulation",icon:dv},resume:{id:"resume",label:"Resume",hint:"Resume simulation",icon:hv},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:As,shortcut:"3"},duplicate:{id:"duplicate",label:"Duplicate",hint:"Duplicate the current selection",icon:js,shortcut:"⌘D"},"select-all":{id:"select-all",label:"Select all",hint:"Select every node",icon:vv,shortcut:"⌘A"},"export-json":{id:"export-json",label:"Export",hint:"Download the graph as JSON",icon:yv},"import-json":{id:"import-json",label:"Import",hint:"Load a JSON graph from disk",icon:mv}},Qr=["select","pan","add-node","add-link","select-all","fit","zoom-in","zoom-out","pause","resume","screenshot","export-json","import-json"];function Es(e){return e==="2d"?As:gv}function _v(e,t){if(e===!1)return[];let n;if(e===!0)n=Qr;else if(Array.isArray(e))n=e;else{const r=e.include??Qr,o=new Set(e.exclude??[]);n=r.filter(i=>!o.has(i))}return n.filter(r=>r==="pause"?!t:r==="resume"?t:!0)}function xv(e){return e&&typeof e=="object"&&!Array.isArray(e)?e.position??"top-right":"top-right"}function wv(e){const{config:t,activeTool:n,paused:r,mode:o,isDisabled:i,onSelect:a}=e,s=_v(t,r),[l,c]=M.useState(0),f=M.useRef([]),u=M.useRef(!1);if(M.useEffect(()=>{if(!u.current)return;const g=Math.min(l,Math.max(0,s.length-1));f.current[g]?.focus()},[l,s.length]),s.length===0)return null;const v=xv(t),h=Math.min(l,Math.max(0,s.length-1)),p=g=>{u.current=!0,c(y=>(y+g+s.length)%s.length)};return L.jsx("div",{className:`lgc-toolbar lgc-toolbar--${v}`,role:"toolbar",children:s.map((g,y)=>{const d=Ts[g],m=g==="toggle-mode"?Es(o):d.icon,b=d.toggleable&&n===g,x=i?.(g)??!1,w=[d.hint,d.shortcut?`(${d.shortcut})`:""],_=y===h;return L.jsx("button",{ref:k=>{f.current[y]=k},type:"button",className:["lgc-tool",b?"lgc-tool--active":"",x?"lgc-tool--disabled":""].join(" ").trim(),"aria-label":d.label,"aria-pressed":b?"true":void 0,disabled:x,tabIndex:_?0:-1,title:w.filter(Boolean).join(" "),onFocus:()=>c(y),onClick:()=>a(g),onKeyDown:k=>{k.key==="ArrowRight"?(k.preventDefault(),p(1)):k.key==="ArrowLeft"?(k.preventDefault(),p(-1)):k.key==="Home"?(k.preventDefault(),u.current=!0,c(0)):k.key==="End"&&(k.preventDefault(),u.current=!0,c(s.length-1))},children:L.jsx(m,{})},g)})})}const zt=8;function kv({x:e,y:t,items:n,onClose:r}){const o=M.useRef(null),[i,a]=M.useState({left:e,top:t});return M.useEffect(()=>{const s=l=>{l instanceof KeyboardEvent&&l.key!=="Escape"||l instanceof MouseEvent&&o.current&&o.current.contains(l.target)||r()};return window.addEventListener("mousedown",s),window.addEventListener("keydown",s),()=>{window.removeEventListener("mousedown",s),window.removeEventListener("keydown",s)}},[r]),M.useLayoutEffect(()=>{const s=o.current;if(!s)return;const l=s.parentElement;if(!l)return;const c=l.getBoundingClientRect(),f=s.offsetWidth,u=s.offsetHeight,v=Math.max(zt,c.width-f-zt),h=Math.max(zt,c.height-u-zt),p=Math.min(Math.max(e,zt),v),g=Math.min(Math.max(t,zt),h);(p!==i.left||g!==i.top)&&a({left:p,top:g})},[e,t,n,i.left,i.top]),L.jsx("div",{ref:o,className:"lgc-menu",role:"menu",style:{left:i.left,top:i.top},children:n.map((s,l)=>"separator"in s?L.jsx("div",{className:"lgc-menu-separator"},`sep-${l}`):L.jsxs("div",{role:"menuitem",className:"lgc-menu-item","aria-disabled":s.disabled?"true":void 0,onClick:()=>{s.disabled||(s.onSelect(),r())},children:[L.jsx("span",{children:s.label}),s.shortcut?L.jsx("span",{style:{marginLeft:"auto",opacity:.6},children:s.shortcut}):null]},s.id))})}const Cv=120,It=14;function Sv({content:e,hostRef:t}){const[n,r]=M.useState(null),[o,i]=M.useState(!1),a=M.useRef(null),s=M.useRef(null);M.useEffect(()=>{if(e===null){r(null),i(!1),a.current=null;return}const y=t.current;if(!y)return;a.current=y.getBoundingClientRect();const d=window.setTimeout(()=>i(!0),Cv),m=x=>{const w=a.current??y.getBoundingClientRect();r({x:x.clientX-w.left,y:x.clientY-w.top})},b=()=>{a.current=y.getBoundingClientRect()};return y.addEventListener("mousemove",m),window.addEventListener("resize",b),()=>{window.clearTimeout(d),y.removeEventListener("mousemove",m),window.removeEventListener("resize",b)}},[t,e]);const[l,c]=M.useState(!1),[f,u]=M.useState(!1);if(M.useLayoutEffect(()=>{if(!o||!n)return;const y=t.current,d=s.current;if(!y||!d)return;const m=a.current??y.getBoundingClientRect(),b=d.offsetWidth,x=d.offsetHeight;c(n.x+It+b>m.width),u(n.y+It+x>m.height)},[o,n,e,t]),e===null||n===null||!o)return null;const v=s.current?.offsetWidth??0,h=s.current?.offsetHeight??0,p=l?n.x-It-v:n.x+It,g=f?n.y-It-h:n.y+It;return L.jsx("div",{ref:s,className:"lgc-tooltip",role:"tooltip",style:{left:p,top:g,pointerEvents:"none"},children:typeof e=="string"?e:L.jsx("span",{ref:y=>y?.appendChild(e)})})}function Mv({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 L.jsx("div",{className:"lgc-marquee",style:{left:n,top:r,width:o,height:i,pointerEvents:"none"},children:t&&t>0?L.jsx("span",{className:"lgc-marquee-count",children:t}):null})}function Pv(e){return L.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:[L.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),L.jsx("path",{d:"M6 5h7v7"})]})}function Ov(e){return L.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:[L.jsx("circle",{cx:"5",cy:"11",r:"2"}),L.jsx("circle",{cx:"11",cy:"11",r:"2"}),L.jsx("path",{d:"M6.5 9.5L13 3M5 8L9.5 9.5"})]})}function ta(e){return L.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:[L.jsx("rect",{x:"3",y:"4",width:"10",height:"10",rx:"1"}),L.jsx("rect",{x:"5",y:"2",width:"6",height:"3",rx:"1"})]})}function ft({label:e,shortcut:t,disabled:n,onClick:r,children:o}){return L.jsx("button",{type:"button",className:"lgc-selpanel-btn","aria-label":e,title:t?`${e} (${t})`:e,disabled:n,onClick:r,children:o})}function Av({nodeCount:e,linkCount:t,hasClipboard:n,enableClipboard:r,onDelete:o,onDuplicate:i,onAddConnected:a,onCopy:s,onCut:l,onPaste:c,onClear:f}){if(e===0&&t===0)return!r||!n?null:L.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[L.jsx("span",{className:"lgc-selpanel-label",children:"Clipboard ready"}),L.jsx(ft,{label:"Paste",shortcut:"⌘V",onClick:c,children:L.jsx(ta,{})})]});const u=[];e>0&&u.push(`${e} ${e===1?"node":"nodes"}`),t>0&&u.push(`${t} ${t===1?"link":"links"}`);const v=u.join(", ");return L.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[L.jsx("span",{className:"lgc-selpanel-label",children:v}),L.jsx("div",{className:"lgc-selpanel-divider"}),L.jsx(ft,{label:"Delete",shortcut:"⌫",onClick:o,children:L.jsx(Os,{width:14,height:14})}),L.jsx(ft,{label:"Duplicate",shortcut:"⌘D",onClick:i,children:L.jsx(js,{width:14,height:14})}),L.jsx(ft,{label:"Connect to new node",shortcut:"↵",disabled:e===0,onClick:a,children:L.jsx(bv,{})}),r?L.jsxs(L.Fragment,{children:[L.jsx(ft,{label:"Copy",shortcut:"⌘C",disabled:e===0,onClick:s,children:L.jsx(Pv,{})}),L.jsx(ft,{label:"Cut",shortcut:"⌘X",disabled:e===0,onClick:l,children:L.jsx(Ov,{})}),L.jsx(ft,{label:"Paste",shortcut:"⌘V",disabled:!n,onClick:c,children:L.jsx(ta,{})})]}):null,L.jsx("div",{className:"lgc-selpanel-divider"}),L.jsx(ft,{label:"Clear selection",shortcut:"Esc",onClick:f,children:"✕"})]})}const na=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];function jv(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 Tv(e){return na[jv(e,na.length)]}function Ev({nodes:e,groupBy:t,hidden:n,onToggle:r}){const o=M.useMemo(()=>{if(!t)return[];const i=new Set;for(const a of e){const s=typeof t=="function"?t(a):a[t];s!=null&&i.add(String(s))}return Array.from(i).sort()},[e,t]);return o.length===0?null:L.jsx("div",{className:"lgc-legend",role:"region","aria-label":"Groups",children:o.map(i=>{const a=n.has(i);return L.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:[L.jsx("span",{className:"lgc-legend-swatch",style:{background:Tv(i)}}),L.jsx("span",{children:i})]},i)})})}function Lv({mode:e,onToggle:t}){const n=Es(e),r=e==="2d"?"3D":"2D";return L.jsxs("button",{type:"button",className:"lgc-mode-toggle",onClick:t,"aria-label":`Switch to ${r}`,title:`Switch to ${r} (3)`,children:[L.jsx(n,{width:14,height:14}),L.jsx("span",{className:"lgc-mode-toggle-label",children:e.toUpperCase()})]})}function Rv(e){return L.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:[L.jsx("circle",{cx:"8",cy:"8",r:"2.4"}),L.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 Nv({items:e}){const[t,n]=M.useState(!1),r=M.useRef(null);return M.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:L.jsxs("div",{ref:r,className:"lgc-options-menu",children:[L.jsx("button",{type:"button",className:"lgc-options-trigger","aria-label":"Options","aria-expanded":t,title:"Options",onClick:()=>n(o=>!o),children:L.jsx(Rv,{})}),t?L.jsx("div",{className:"lgc-options-panel",role:"menu",children:e.map(o=>o.kind==="select"?L.jsxs("div",{className:"lgc-options-item",children:[L.jsxs("span",{className:"lgc-options-item-text",children:[L.jsx("span",{className:"lgc-options-item-label",children:o.label}),o.hint?L.jsx("span",{className:"lgc-options-item-hint",children:o.hint}):null]}),L.jsx("select",{className:"lgc-options-select",value:o.value,onChange:i=>o.onChange(i.target.value),children:o.options.map(i=>L.jsx("option",{value:i.value,children:i.label??i.value},i.value))})]},o.id):L.jsxs("label",{className:"lgc-options-item",children:[L.jsx("input",{type:"checkbox",checked:o.checked,onChange:i=>o.onChange(i.target.checked)}),L.jsxs("span",{className:"lgc-options-item-text",children:[L.jsx("span",{className:"lgc-options-item-label",children:o.label}),o.hint?L.jsx("span",{className:"lgc-options-item-hint",children:o.hint}):null]})]},o.id))}):null]})}function Dv(e,t,n={}){const r=n.spacing??50,o=n.color??"rgba(0,0,0,0.06)",i=e.canvas,s=e.getTransform().inverse(),l=s.transformPoint({x:0,y:0}),c=s.transformPoint({x:i.width,y:i.height}),f=Math.floor(l.x/r)*r,u=Math.ceil(c.x/r)*r,v=Math.floor(l.y/r)*r,h=Math.ceil(c.y/r)*r;e.save(),e.strokeStyle=o,e.lineWidth=1/t,e.beginPath();for(let p=f;p<=u;p+=r)e.moveTo(p,v),e.lineTo(p,h);for(let p=v;p<=h;p+=r)e.moveTo(f,p),e.lineTo(u,p);e.stroke(),e.restore()}const ra=15,zv={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 Iv(e){if(!e)return{};const t={};for(const[n,r]of Object.entries(e)){if(r===void 0)continue;const o=zv[n];o&&(t[o]=String(r))}return t}function Ls(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 Fv(e){e&&e.toBlob(t=>{t&&Ls(t,`lora-graph-${Date.now()}.png`)})}function Bv(e,t){const{data:n,defaultData:r,onDataChange:o,mode:i,defaultMode:a,onModeChange:s,width:l,height:c,className:f,style:u,theme:v,tools:h=!0,selection:p="multi",showContextMenu:g=!0,showLegend:y=!1,showGrid:d=!1,showLabels:m=!1,enableClipboard:b=!0,enableTooltip:x=!0,introZoom:w=!0,focusOnClick:_=!1,highlightNeighborsOnHover:k=!0,autoIndexNeighbors:S=k,collideNodes:A=!1,fixOnDrop:O=!0,beeswarm:E=!1,onSelectionChange:T,onNodeClick:I,onNodeRightClick:C,onLinkClick:P,onLinkRightClick:R,onBackgroundClick:H,onBackgroundRightClick:V,onNodeDrag:X,onNodeDragEnd:oe,onNodeHover:D,onLinkHover:F,onNodeDoubleClick:W,onCopy:Q,onCut:N,onPaste:U,onBeforeNodeDelete:z,onBeforeLinkDelete:G,onNodeDeleted:q,onLinkDeleted:$,onRenderFramePre:B,nodeColor:te,nodeLabel:ae,nodeVal:ce,nodeAutoColorBy:ye,nodeRelSize:fe,nodeVisibility:Te,nodeCanvasObject:Be,linkColor:nt,linkLabel:Ee,linkWidth:er,linkHoverPrecision:Wt,backgroundColor:Pt,enableNavigationControls:Xt,performanceProfile:Ke,dagMode:vt}=e,[Ns,Ds]=M.useState(i??a??"2d"),tr=i!==void 0,_e=tr?i:Ns,xo=M.useRef(null),yt=M.useCallback(j=>{j!==_e&&(xo.current?.(),tr||Ds(j),s?.(j))},[_e,tr,s]),ie=_l({...n!==void 0?{controlled:n}:{},...r!==void 0?{defaultData:r}:{},...o?{onChange:o}:{}});Bg(S,ie.data);const me=Ig({mode:p,...T?{onChange:T}:{}}),[Ge,nr]=M.useState("select"),[rr,or]=M.useState(!1),zs=Kg({highlightNeighborsOnHover:k,...ae!==void 0?{nodeLabel:ae}:{},...Ee!==void 0?{linkLabel:Ee}:{},...D?{onNodeHover:D}:{},...F?{onLinkHover:F}:{}}),{hoverNodeId:Is,hoverLinkId:Fs,liveHoverNodeIdRef:Bs,highlightedNodeIds:$s,highlightedLinkIds:Hs,hoveredNodeSet:Us,hoveredLinkSet:qs,tooltipContent:Gs,handleNodeHover:wo,handleLinkHover:ko,pinHover:bn}=zs,[Co,Vs]=M.useState(()=>new Set),[Ot,So]=M.useState(!!_),[_n,Mo]=M.useState(!!m),[xn,Po]=M.useState(vt??null);M.useEffect(()=>{So(!!_)},[_]),M.useEffect(()=>{Mo(!!m)},[m]),M.useEffect(()=>{Po(vt??null)},[vt]);const rt=M.useRef(null),[Yt,wn]=M.useState(null),[Kt,kn]=M.useState(null),[Cn,mt]=M.useState(null),[bt,Qe]=M.useState([]),[Sn,At]=M.useState(null),Ws=Fg(),Qt=ov(),_t=M.useRef(null),ir=M.useRef(null),[ar,Xs]=M.useState(null),Ys=M.useCallback(j=>{ir.current=j,Xs(j)},[]),Oo=zg(_t),sr=l??Oo?.width??600,lr=c??Oo?.height??400,ze=M.useRef(null),{marquee:Mn,lastCursorRef:Ks}=$g({mount:ar,engineRef:ze,selection:me,nodes:ie.data.nodes,links:ie.data.links,setSelectedLinkIds:Qe,liveHoverNodeIdRef:Bs});Ug(ar);const Ve=Gg({dataApi:ie,...z?{beforeNode:z}:{},...G?{beforeLink:G}:{},...q?{onNodeDeleted:q}:{},...$?{onLinkDeleted:$}:{},afterNodeDelete:()=>me.clear(),afterLinkDelete:()=>Qe([])}),Se=qg({enableClipboard:b,dataApi:ie,deleteGate:Ve,selection:me,setSelectedLinkIds:Qe,engineRef:ze,lastCursorRef:Ks,...Q?{onCopy:Q}:{},...N?{onCut:N}:{},...U?{onPaste:U}:{}}),Ao=M.useRef(null),jo=M.useCallback((j,K)=>{I?.(j,K);const ee=performance.now(),xe=Ao.current,de=xe&&xe.id===j.id&&ee-xe.at<280;if(Ao.current={id:j.id,at:ee},de){W?.(j,K);return}if(Ge==="add-link"&&j.id!==void 0){Cn===null?mt(j.id):(Cn!==j.id&&ie.addLink({source:Cn,target:j.id}),mt(null));return}if(p!=="none"&&j.id!==void 0){const se=K.shiftKey||K.ctrlKey||K.metaKey;me.toggle(j.id,{additive:se}),se||Qe([])}if(Ot&&j.id!==void 0&&ze.current){const se=ze.current;Yt===j.id?(rt.current&&se.setCameraState(rt.current,800),wn(null),rt.current=null):(Yt===null&&Kt===null&&(rt.current=se.getCameraState()),se.focusOn({x:j.x??0,y:j.y??0,z:j.z??0},{distance:120,zoom:8,durationMs:Qt?0:1e3}),wn(j.id),kn(null))}},[I,W,me,p,Ge,Cn,ie,Ot,Yt,Kt]),To=M.useCallback(j=>{if(H?.(j),ze.current?.stopAnimation(),Ge==="add-node"){const ee=ir.current?.getBoundingClientRect(),xe=ee?j.clientX-ee.left:j.clientX,de=ee?j.clientY-ee.top:j.clientY,se=ze.current?.screen2Graph(xe,de)??{x:xe,y:de};ie.addNode(void 0,{at:{x:se.x,y:se.y,...se.z!==void 0?{z:se.z}:{}}});return}Ge==="add-link"&&mt(null),j.shiftKey||j.ctrlKey||j.metaKey||(me.clear(),Qe([])),At(null)},[H,Ge,ie,me]),Eo=M.useCallback((j,K)=>{if(C?.(j,K),!g)return;const ee=_t.current?.getBoundingClientRect(),xe=ee?K.clientX-ee.left:K.clientX,de=ee?K.clientY-ee.top:K.clientY,se=j.id,he=me.selected,lt=he.length>1&&he.includes(se)?[{id:"pin-all",label:`Pin ${he.length} nodes`,onSelect:()=>{for(const Re of he){const Ze=ie.data.nodes.find(xt=>xt.id===Re);Ze&&ie.updateNode(Re,{fx:Ze.x,fy:Ze.y,fz:Ze.z})}}},{id:"unpin-all",label:`Unpin ${he.length} nodes`,onSelect:()=>{for(const Re of he)ie.updateNode(Re,{fx:void 0,fy:void 0,fz:void 0})}},{separator:!0},{id:"duplicate",label:`Duplicate ${he.length} nodes`,shortcut:"⌘D",onSelect:()=>Se.duplicate()},{id:"delete-all",label:`Delete ${he.length} nodes`,shortcut:"⌫",onSelect:()=>{Ve.requestNodeDelete(he,"contextMenu")}}]:[{id:"pin",label:j.fx!==void 0?"Unpin":"Pin",onSelect:()=>{ie.updateNode(se,j.fx!==void 0?{fx:void 0,fy:void 0,fz:void 0}:{fx:j.x,fy:j.y,fz:j.z})}},{id:"connect",label:"Connect from here…",onSelect:()=>{nr("add-link"),mt(se)}},{separator:!0},{id:"delete",label:"Delete",shortcut:"⌫",onSelect:()=>{Ve.requestNodeDelete([se],"contextMenu")}}];At({x:xe,y:de,items:lt})},[C,g,ie,me,Se,Ve]),Lo=M.useCallback((j,K)=>{P?.(j,K);const ee=j.id;if(ee===void 0)return;const xe=K.shiftKey||K.ctrlKey||K.metaKey;if(Qe(de=>{const se=de.includes(ee);return!xe||p!=="multi"?se&&de.length===1?[]:[ee]:se?de.filter(he=>he!==ee):[...de,ee]}),xe||me.clear(),Ot&&ze.current){const de=ze.current;if(Kt===ee)rt.current&&de.setCameraState(rt.current,800),kn(null),rt.current=null;else{const se=typeof j.source=="object"?j.source:null,he=typeof j.target=="object"?j.target:null;if(se&&he&&se.x!==void 0&&he.x!==void 0){Yt===null&&Kt===null&&(rt.current=de.getCameraState());const Le=se.x??0,lt=se.y??0,Re=he.x??0,Ze=he.y??0,xt=se.z??0,Zt=he.z??0,tl={x:(Le+Re)/2,y:(lt+Ze)/2,z:(xt+Zt)/2},hr=1.5,Xo=Re-Le,Yo=Ze-lt,nl=Zt-xt,rl=Math.max(Math.abs(Xo),1),ol=Math.max(Math.abs(Yo),1),il=Math.min(sr/(rl*hr),lr/(ol*hr)),al=Math.min(16,Math.max(.5,il)),sl=Math.hypot(Xo,Yo,nl)/2/.466*hr,ll=Math.max(60,sl);de.focusOn(tl,{distance:ll,zoom:al,durationMs:Qt?0:1e3}),kn(ee),wn(null)}}}},[P,me,p,Ot,Kt,Yt,sr,lr]),Ro=M.useCallback((j,K)=>{if(R?.(j,K),!g)return;const ee=_t.current?.getBoundingClientRect(),xe=ee?K.clientX-ee.left:K.clientX,de=ee?K.clientY-ee.top:K.clientY;At({x:xe,y:de,items:[{id:"delete",label:"Delete link",shortcut:"⌫",onSelect:()=>{Ve.requestLinkDelete(se=>se===j,"contextMenu")}},{id:"reverse",label:"Reverse direction",onSelect:()=>{ie.removeLink(se=>se===j),ie.addLink({...j,source:typeof j.target=="object"?j.target.id:j.target,target:typeof j.source=="object"?j.source.id:j.source})}}]})},[R,g,ie,Ve]),cr=M.useRef(null),No=M.useRef(ie.data.nodes);No.current=ie.data.nodes;const Do=M.useCallback((j,K)=>{if(X?.(j,K),ze.current?.stopAnimation(),bn(j),Ge==="add-link"){const ee=No.current,xe=j.x??0,de=j.y??0,se=ra*ra;let he=null,Le=1/0;for(let lt=0;lt<ee.length;lt++){const Re=ee[lt];if(!Re||Re===j||Re.id===j.id)continue;const Ze=(Re.x??0)-xe,xt=(Re.y??0)-de,Zt=Ze*Ze+xt*xt;Zt<Le&&(Le=Zt,he=Re)}cr.current=he&&Le<se?he:null}},[X,Ge,bn]),zo=M.useCallback((j,K)=>{if(oe?.(j,K),bn(null),Ge==="add-link"){const ee=cr.current;if(cr.current=null,!ee||ee.id===void 0||j.id===void 0)return;ie.addLink({source:j.id,target:ee.id});return}if(O){const ee=j;j.x!==void 0&&(ee.fx=j.x),j.y!==void 0&&(ee.fy=j.y),j.z!==void 0&&(ee.fz=j.z)}},[oe,Ge,ie,O,bn]),Io=M.useCallback(j=>{if(V?.(j),!g)return;const K=_t.current?.getBoundingClientRect(),ee=K?j.clientX-K.left:j.clientX,xe=K?j.clientY-K.top:j.clientY,de=ir.current?.getBoundingClientRect(),se=de?j.clientX-de.left:j.clientX,he=de?j.clientY-de.top:j.clientY,Le=ze.current?.screen2Graph(se,he)??{x:se,y:he};At({x:ee,y:xe,items:[{id:"add-node-here",label:"Add node here",onSelect:()=>{ie.addNode(void 0,{at:{x:Le.x,y:Le.y,...Le.z!==void 0?{z:Le.z}:{}}})}},{id:"fit",label:"Fit to view",shortcut:"F",onSelect:()=>ze.current?.fit(400,40)},{id:"toggle-mode",label:_e==="2d"?"Switch to 3D":"Switch to 2D",shortcut:"3",onSelect:()=>yt(_e==="2d"?"3d":"2d")}]})},[V,g,ie,_e,yt]),ur=v?.accent??"#4f8ef7",Fo=M.useMemo(()=>new Set(me.selected),[me.selected]),Bo=M.useMemo(()=>new Set(bt),[bt]),ke=Yg({mode:_e,accentColor:ur,...te!==void 0?{nodeColor:te}:{},...nt!==void 0?{linkColor:nt}:{},...er!==void 0?{linkWidth:er}:{},...ce!==void 0?{nodeVal:ce}:{},...fe!==void 0?{nodeRelSize:fe}:{},...e.nodePointerAreaPaint!==void 0?{nodePointerAreaPaint:e.nodePointerAreaPaint}:{},...ye!==void 0?{nodeAutoColorBy:ye}:{},...Te!==void 0?{nodeVisibility:Te}:{},selectedNodeSet:Fo,selectedLinkSet:Bo,highlightNeighborsOnHover:k,highlightedNodeIds:$s,highlightedLinkIds:Hs,hoverNodeId:Is,hoverLinkId:Fs,hiddenGroups:Co}),jt=Zg({mode:_e,showLabels:_n,selectedNodeSet:Fo,hoveredNodeSet:Us,accentColor:ur,...Be?{hostNodeCanvasObject:Be}:{},...e.nodeThreeObject?{hostNodeThreeObject:e.nodeThreeObject}:{},...ae!==void 0?{nodeLabel:ae}:{},...ce!==void 0?{nodeVal:ce}:{},...fe!==void 0?{nodeRelSize:fe}:{},...v?{theme:v}:{}}),ot=Jg({mode:_e,showLabels:_n,selectedLinkSet:Bo,hoveredLinkSet:qs,accentColor:ur,...e.linkCanvasObject?{hostLinkCanvasObject:e.linkCanvasObject}:{},...e.linkThreeObject?{hostLinkThreeObject:e.linkThreeObject}:{},...e.linkPositionUpdate!==void 0?{hostLinkPositionUpdate:e.linkPositionUpdate}:{},...Ee!==void 0?{linkLabel:Ee}:{},...v?{theme:v}:{}}),$o=nv({profile:Ke,nodeCount:ie.data.nodes.length,linkCount:ie.data.links.length,mode:_e}),Ho=_e==="3d"&&(Ws||Mn!==null),Uo=M.useMemo(()=>Pt!==void 0?Pt:v?.background&&v.background!=="transparent"?v.background:"#ffffff",[Pt,v?.background]),Qs=M.useMemo(()=>{const j={...$o,...e,dagMode:xn};return j.backgroundColor===void 0&&(j.backgroundColor=Uo),j.linkColor===void 0&&(j.linkColor="rgba(96, 102, 110, 0.55)"),j.linkOpacity===void 0&&(j.linkOpacity=1),j.nodeOpacity===void 0&&(j.nodeOpacity=1),ke.nodeColor!==void 0&&(j.nodeColor=ke.nodeColor),ke.linkColor!==void 0&&(j.linkColor=ke.linkColor),ke.linkWidth!==void 0&&(j.linkWidth=ke.linkWidth),ke.nodeVal!==void 0&&(j.nodeVal=ke.nodeVal),ke.nodePointerAreaPaint!==void 0&&(j.nodePointerAreaPaint=ke.nodePointerAreaPaint),jt.canvasObject&&(j.nodeCanvasObject=jt.canvasObject,j.nodeCanvasObjectMode=()=>"after"),ot.canvasObject&&(j.linkCanvasObject=ot.canvasObject,j.linkCanvasObjectMode=()=>"after"),jt.threeObject&&(j.nodeThreeObject=jt.threeObject,j.nodeThreeObjectExtend=!0),ot.threeObject&&(j.linkThreeObject=ot.threeObject,j.linkThreeObjectExtend=!0,ot.positionUpdate&&(j.linkPositionUpdate=ot.positionUpdate)),j.linkHoverPrecision=Wt??8,j.enableNavigationControls=Ho?!1:Xt??!0,j.onNodeClick=jo,j.onNodeRightClick=Eo,j.onLinkClick=Lo,j.onLinkRightClick=Ro,j.onBackgroundClick=To,j.onBackgroundRightClick=Io,j.onNodeDrag=Do,j.onNodeDragEnd=zo,j.nodeLabel=()=>"",j.linkLabel=()=>"",j.onNodeHover=wo,j.onLinkHover=ko,d&&(j.onRenderFramePre=(K,ee)=>{Dv(K,ee,typeof d=="object"?d:{}),B?.(K,ee)}),ke.nodeVisibility&&(j.nodeVisibility=ke.nodeVisibility),j},[e,xn,Uo,ke.nodeColor,ke.linkColor,ke.linkWidth,ke.nodeVal,ke.nodePointerAreaPaint,ke.nodeVisibility,$o,Ho,Wt,Xt,jo,Eo,Lo,Ro,To,Io,Do,zo,wo,ko,d,B,Qt,jt.canvasObject,jt.threeObject,ot.canvasObject,ot.threeObject,ot.positionUpdate]),Oe=Dg({mount:ar,mode:_e,width:sr,height:lr,data:ie.data,props:Qs,paused:rr,...Qt?{modeTransitionMs:0}:{}});ze.current=Oe,xo.current=()=>{wn(null),kn(null),rt.current=null,mt(null),At(null)};const qo=M.useRef(!1),Go=ie.data.nodes.length;M.useEffect(()=>{if(!w||!Oe||qo.current||Go===0)return;qo.current=!0;const j=Qt?0:1e3,K=setTimeout(()=>{ze.current?.fit(j,40)},150);return()=>clearTimeout(K)},[Oe,w,Go]),Xg({engine:Oe,collideNodes:A,beeswarm:E,...fe!==void 0?{nodeRelSize:fe}:{}});const Vo=M.useRef(null),fr=M.useCallback(()=>JSON.stringify({nodes:ie.data.nodes.map(j=>{const{vx:K,vy:ee,vz:xe,index:de,_neighbors:se,_links:he,...Le}=j;return Le}),links:ie.data.links},null,2),[ie.data]),Wo=M.useCallback(j=>{const K=JSON.parse(j);if(!K||!Array.isArray(K.nodes)||!Array.isArray(K.links))throw new Error("invalid graph JSON");ie.setData(K),me.clear(),Qe([])},[ie,me]),dr=M.useCallback((j=`graph-${Date.now()}.json`)=>{const K=new Blob([fr()],{type:"application/json"});Ls(K,j)},[fr]),Zs=M.useCallback(j=>{switch(j){case"select":case"pan":case"add-node":case"add-link":nr(j);break;case"delete":Ve.requestMixedDelete(me.selected,bt,"toolbar");break;case"duplicate":Se.duplicate();break;case"select-all":me.set(ie.data.nodes.map(K=>K.id)),Qe(ie.data.links.map(K=>K.id).filter(K=>K!==void 0));break;case"fit":Oe?.fit(400,40);break;case"zoom-in":Oe&&Oe.zoom((Oe.getZoom?.()??1)*1.2,200);break;case"zoom-out":Oe&&Oe.zoom((Oe.getZoom?.()??1)/1.2,200);break;case"pause":or(!0);break;case"resume":or(!1);break;case"screenshot":Fv(Oe?.getCanvasElement());break;case"export-json":dr();break;case"import-json":Vo.current?.click();break;case"toggle-mode":yt(_e==="2d"?"3d":"2d");break}},[Oe,ie,me,_e,yt,bt,Se,dr,Ve]);Wg({engine:Oe,dataApi:ie,deleteGate:Ve,selection:me,mode:_e,setMode:yt,selectedLinkIds:bt,setSelectedLinkIds:Qe,setLinkSourceId:mt,setActiveTool:nr,enableClipboard:b,copy:Se.copy,cut:Se.cut,paste:Se.paste,duplicate:Se.duplicate,addConnectedNode:Se.addConnectedNode,togglePin:Se.togglePin,hostRef:_t}),rv({ref:t,dataApi:ie,deleteGate:Ve,selection:me,engine:Oe,mode:_e,setMode:yt,setPaused:or,clipboard:Se,exportJSON:fr,importJSON:Wo,downloadJSON:dr});const Js=M.useMemo(()=>({position:"relative",width:l??"100%",height:c??"100%",...Iv(v),...u}),[l,c,v,u]),el=M.useMemo(()=>[{id:"focus-on-click",kind:"toggle",label:"Click to focus",hint:"Animate the camera to a clicked node; click again to restore.",checked:Ot,onChange:So},{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:_n,onChange:Mo},{kind:"select",id:"dag-mode",label:"DAG orientation",hint:"Force a hierarchical / radial layout.",value:xn??"null",options:[{value:"null",label:"off"},{value:"td",label:"td (top-down)"},{value:"bu",label:"bu (bottom-up)"},{value:"lr",label:"lr (left-right)"},{value:"rl",label:"rl (right-left)"},{value:"radialout"},{value:"radialin"}],onChange:j=>Po(j==="null"?null:j)}],[Ot,_n,xn]);return L.jsxs("div",{ref:_t,className:["lora-graph-canvas",f??""].join(" ").trim(),style:Js,"data-mode":_e,"data-tool":Ge,"data-paused":rr?"true":void 0,tabIndex:0,role:"application","aria-label":"Graph canvas",children:[L.jsx("div",{ref:Ys,className:"lgc-engine-mount"}),L.jsx(wv,{config:h,activeTool:Ge,paused:rr,mode:_e,onSelect:Zs}),h!==!1?L.jsxs(L.Fragment,{children:[L.jsx(Nv,{items:el}),L.jsx(Lv,{mode:_e,onToggle:()=>yt(_e==="2d"?"3d":"2d")})]}):null,Sn?L.jsx(kv,{x:Sn.x,y:Sn.y,items:Sn.items,onClose:()=>At(null)}):null,x?L.jsx(Sv,{content:Gs,hostRef:_t}):null,L.jsx(Mv,{rect:Mn,...Mn?.count!==void 0?{count:Mn.count}:{}}),y&&ye?L.jsx(Ev,{nodes:ie.data.nodes,groupBy:ye,hidden:Co,onToggle:j=>Vs(K=>{const ee=new Set(K);return ee.has(j)?ee.delete(j):ee.add(j),ee})}):null,L.jsx(Av,{nodeCount:me.selected.length,linkCount:bt.length,hasClipboard:Se.hasClipboard(),enableClipboard:b,onDelete:()=>{Ve.requestMixedDelete(me.selected,bt,"selectionPanel")},onDuplicate:()=>Se.duplicate(),onAddConnected:()=>Se.addConnectedNode(),onCopy:()=>Se.copy(),onCut:()=>Se.cut(),onPaste:()=>Se.paste(),onClear:()=>{me.clear(),Qe([])}}),L.jsx("input",{ref:Vo,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:j=>{const K=j.target.files?.[0];K&&(K.text().then(Wo).catch(ee=>{console.error("[lora-graph-canvas] import failed:",ee)}),j.target.value="")}})]})}const Rs=M.forwardRef(Bv);Rs.displayName="LoraGraphCanvas";const $v={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)"},Hv={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=Qr;exports.LoraGraphCanvas=Rs;exports.TOOL_DESCRIPTORS=Ts;exports.createId=Ft;exports.darkTheme=Hv;exports.lightTheme=$v;
|
|
685
685
|
//# sourceMappingURL=index.cjs.map
|