@loradb/lora-graph-canvas 0.10.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/LICENSE +87 -0
- package/README.md +191 -0
- package/THIRD_PARTY.md +40 -0
- package/dist/LoraGraphCanvas.d.ts +9 -0
- package/dist/LoraGraphCanvas.stories.d.ts +23 -0
- package/dist/engines/3d-force-graph/index.d.ts +1 -0
- package/dist/engines/3d-force-graph/kapsule.d.ts +12 -0
- package/dist/engines/createEngineUnified.d.ts +13 -0
- package/dist/engines/propBindings.d.ts +29 -0
- package/dist/engines/rafAnim.d.ts +13 -0
- package/dist/engines/types.d.ts +86 -0
- package/dist/hooks/useAccessorOverrides.d.ts +62 -0
- package/dist/hooks/useAutoIndexNeighbors.d.ts +6 -0
- package/dist/hooks/useClickToleranceShim.d.ts +46 -0
- package/dist/hooks/useGraphClipboard.d.ts +47 -0
- package/dist/hooks/useGraphData.d.ts +42 -0
- package/dist/hooks/useGraphEngine.d.ts +23 -0
- package/dist/hooks/useGraphForces.d.ts +12 -0
- package/dist/hooks/useGraphKeybindings.d.ts +27 -0
- package/dist/hooks/useGraphSelection.d.ts +14 -0
- package/dist/hooks/useHoverState.d.ts +67 -0
- package/dist/hooks/useImperativeGraphHandle.d.ts +22 -0
- package/dist/hooks/useLabelRenderer.d.ts +47 -0
- package/dist/hooks/useLinkLabelRenderer.d.ts +56 -0
- package/dist/hooks/useMarqueeAndCursor.d.ts +59 -0
- package/dist/hooks/usePerfTierDefaults.d.ts +13 -0
- package/dist/hooks/useResizeObserver.d.ts +7 -0
- package/dist/hooks/useShiftHeld.d.ts +5 -0
- package/dist/index.cjs +685 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +11309 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/accessor-fn.d.ts +2 -0
- package/dist/internal/bezier.d.ts +16 -0
- package/dist/internal/canvas-color-tracker.d.ts +13 -0
- package/dist/internal/debounce.d.ts +5 -0
- package/dist/internal/float-tooltip.d.ts +14 -0
- package/dist/internal/kapsule-link.d.ts +24 -0
- package/dist/internal/kapsule.d.ts +43 -0
- package/dist/internal/throttle.d.ts +6 -0
- package/dist/internal/tween.d.ts +31 -0
- package/dist/style.css +1 -0
- package/dist/theme/presets.d.ts +8 -0
- package/dist/tools/ContextMenu.d.ts +17 -0
- package/dist/tools/GraphToolbar.d.ts +18 -0
- package/dist/tools/GroupLegend.d.ts +11 -0
- package/dist/tools/HoverTooltip.d.ts +15 -0
- package/dist/tools/MarqueeOverlay.d.ts +13 -0
- package/dist/tools/ModeToggle.d.ts +10 -0
- package/dist/tools/OptionsMenu.d.ts +28 -0
- package/dist/tools/SelectionPanel.d.ts +18 -0
- package/dist/tools/icons.d.ts +23 -0
- package/dist/tools/tools.d.ts +37 -0
- package/dist/types.d.ts +375 -0
- package/dist/utils/accessor.d.ts +36 -0
- package/dist/utils/download.d.ts +4 -0
- package/dist/utils/geometry.d.ts +8 -0
- package/dist/utils/grid.d.ts +9 -0
- package/dist/utils/ids.d.ts +3 -0
- package/dist/utils/perfTier.d.ts +29 -0
- package/dist/utils/spriteLabel.d.ts +61 -0
- package/dist/utils/themeStyle.d.ts +5 -0
- package/package.json +105 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,685 @@
|
|
|
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",`
|
|
2
|
+
`,`Note: there is also change in default behavior: From now on each graph
|
|
3
|
+
is considered to be not a multigraph by default (each edge is unique).`),e.multigraph=e.uniqueLinkId),e.multigraph===void 0&&(e.multigraph=!1),typeof Map!="function")throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var t=new Map,n=new Map,r={},i=0,o=e.multigraph?x:m,a=[],s=U,l=U,c=U,f=U,u={version:20,addNode:v,addLink:b,removeLink:C,removeNode:d,getNode:y,getNodeCount:w,getLinkCount:_,getEdgeCount:_,getLinksCount:_,getNodesCount:w,getLinks:k,forEachNode:se,forEachLinkedNode:S,forEachLink:B,beginUpdate:c,endUpdate:f,clear:E,hasLink:M,hasNode:y,getLink:M,getLinkById:N};return Ac(u),g(),u;function g(){var D=u.on;u.on=$;function $(){return u.beginUpdate=c=ne,u.endUpdate=f=J,s=h,l=p,u.on=D,D.apply(u,arguments)}}function h(D,$){a.push({link:D,changeType:$})}function p(D,$){a.push({node:D,changeType:$})}function v(D,$){if(D===void 0)throw new Error("Invalid node identifier");c();var G=y(D);return G?(G.data=$,l(G,"update")):(G=new Tc(D,$),l(G,"add")),t.set(D,G),f(),G}function y(D){return t.get(D)}function d(D){var $=y(D);if(!$)return!1;c();var G=$.links;return G&&(G.forEach(P),$.links=null),t.delete(D),l($,"remove"),f(),!0}function b(D,$,G){c();var Z=y(D)||v(D),I=y($)||v($),H=o(D,$,G),z=n.has(H.id);return n.set(H.id,H),ro(Z,H),D!==$&&ro(I,H),s(H,z?"update":"add"),f(),H}function m(D,$,G){var Z=xn(D,$),I=n.get(Z);return I?(I.data=G,I):new io(D,$,G,Z)}function x(D,$,G){var Z=xn(D,$),I=r.hasOwnProperty(Z);if(I||M(D,$)){I||(r[Z]=0);var H="@"+ ++r[Z];Z=xn(D+H,$+H)}return new io(D,$,G,Z)}function w(){return t.size}function _(){return n.size}function k(D){var $=y(D);return $?$.links:null}function C(D,$){return $!==void 0&&(D=M(D,$)),P(D)}function P(D){if(!D||!n.get(D.id))return!1;c(),n.delete(D.id);var $=y(D.fromId),G=y(D.toId);return $&&$.links.delete(D),G&&G.links.delete(D),s(D,"remove"),f(),!0}function M(D,$){if(!(D===void 0||$===void 0))return n.get(xn(D,$))}function N(D){if(D!==void 0)return n.get(D)}function E(){c(),se(function(D){d(D.id)}),f()}function B(D){if(typeof D=="function")for(var $=n.values(),G=$.next();!G.done;){if(D(G.value))return!0;G=$.next()}}function S(D,$,G){var Z=y(D);if(Z&&Z.links&&typeof $=="function")return G?L(Z.links,D,$):O(Z.links,D,$)}function O(D,$,G){for(var Z,I=D.values(),H=I.next();!H.done;){var z=H.value,F=z.fromId===$?z.toId:z.fromId;if(Z=G(t.get(F),z),Z)return!0;H=I.next()}}function L(D,$,G){for(var Z,I=D.values(),H=I.next();!H.done;){var z=H.value;if(z.fromId===$&&(Z=G(t.get(z.toId),z),Z))return!0;H=I.next()}}function U(){}function ne(){i+=1}function J(){i-=1,i===0&&a.length>0&&(u.fire("changed",a),a.length=0)}function se(D){if(typeof D!="function")throw new Error("Function is expected to iterate over graph nodes. You passed "+D);for(var $=t.values(),G=$.next();!G.done;){if(D(G.value))return!0;G=$.next()}}}function Tc(e,t){this.id=e,this.links=null,this.data=t}function ro(e,t){e.links?e.links.add(t):e.links=new Set([t])}function io(e,t,n,r){this.fromId=e,this.toId=t,this.data=n,this.id=r}function xn(e,t){return e.toString()+"👉 "+t.toString()}var Qr={exports:{}},cn={exports:{}},oa=function(t){return t===0?"x":t===1?"y":t===2?"z":"c"+(t+1)};const Ec=oa;var zt=function(t){return n;function n(r,i){let o=i&&i.indent||0,a=i&&i.join!==void 0?i.join:`
|
|
4
|
+
`,s=Array(o+1).join(" "),l=[];for(let c=0;c<t;++c){let f=Ec(c),u=c===0?"":s;l.push(u+r.replace(/{var}/g,f))}return l.join(a)}};const aa=zt;cn.exports=Lc;cn.exports.generateCreateBodyFunctionBody=sa;cn.exports.getVectorCode=ca;cn.exports.getBodyCode=la;function Lc(e,t){let n=sa(e,t),{Body:r}=new Function(n)();return r}function sa(e,t){return`
|
|
5
|
+
${ca(e,t)}
|
|
6
|
+
${la(e)}
|
|
7
|
+
return {Body: Body, Vector: Vector};
|
|
8
|
+
`}function la(e){let t=aa(e),n=t("{var}",{join:", "});return`
|
|
9
|
+
function Body(${n}) {
|
|
10
|
+
this.isPinned = false;
|
|
11
|
+
this.pos = new Vector(${n});
|
|
12
|
+
this.force = new Vector();
|
|
13
|
+
this.velocity = new Vector();
|
|
14
|
+
this.mass = 1;
|
|
15
|
+
|
|
16
|
+
this.springCount = 0;
|
|
17
|
+
this.springLength = 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
Body.prototype.reset = function() {
|
|
21
|
+
this.force.reset();
|
|
22
|
+
this.springCount = 0;
|
|
23
|
+
this.springLength = 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Body.prototype.setPosition = function (${n}) {
|
|
27
|
+
${t("this.pos.{var} = {var} || 0;",{indent:2})}
|
|
28
|
+
};`}function ca(e,t){let n=aa(e),r="";return t&&(r=`${n(`
|
|
29
|
+
var v{var};
|
|
30
|
+
Object.defineProperty(this, '{var}', {
|
|
31
|
+
set: function(v) {
|
|
32
|
+
if (!Number.isFinite(v)) throw new Error('Cannot set non-numbers to {var}');
|
|
33
|
+
v{var} = v;
|
|
34
|
+
},
|
|
35
|
+
get: function() { return v{var}; }
|
|
36
|
+
});`)}`),`function Vector(${n("{var}",{join:", "})}) {
|
|
37
|
+
${r}
|
|
38
|
+
if (typeof arguments[0] === 'object') {
|
|
39
|
+
// could be another vector
|
|
40
|
+
let v = arguments[0];
|
|
41
|
+
${n('if (!Number.isFinite(v.{var})) throw new Error("Expected value is not a finite number at Vector constructor ({var})");',{indent:4})}
|
|
42
|
+
${n("this.{var} = v.{var};",{indent:4})}
|
|
43
|
+
} else {
|
|
44
|
+
${n('this.{var} = typeof {var} === "number" ? {var} : 0;',{indent:4})}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
Vector.prototype.reset = function () {
|
|
49
|
+
${n("this.{var} = ",{join:""})}0;
|
|
50
|
+
};`}var Nc=cn.exports,ft={exports:{}};const Zr=zt,st=oa;ft.exports=Rc;ft.exports.generateQuadTreeFunctionBody=ua;ft.exports.getInsertStackCode=ga;ft.exports.getQuadNodeCode=pa;ft.exports.isSamePosition=fa;ft.exports.getChildBodyCode=ha;ft.exports.setChildBodyCode=da;function Rc(e){let t=ua(e);return new Function(t)()}function ua(e){let t=Zr(e),n=Math.pow(2,e);return`
|
|
51
|
+
${ga()}
|
|
52
|
+
${pa(e)}
|
|
53
|
+
${fa(e)}
|
|
54
|
+
${ha(e)}
|
|
55
|
+
${da(e)}
|
|
56
|
+
|
|
57
|
+
function createQuadTree(options, random) {
|
|
58
|
+
options = options || {};
|
|
59
|
+
options.gravity = typeof options.gravity === 'number' ? options.gravity : -1;
|
|
60
|
+
options.theta = typeof options.theta === 'number' ? options.theta : 0.8;
|
|
61
|
+
|
|
62
|
+
var gravity = options.gravity;
|
|
63
|
+
var updateQueue = [];
|
|
64
|
+
var insertStack = new InsertStack();
|
|
65
|
+
var theta = options.theta;
|
|
66
|
+
|
|
67
|
+
var nodesCache = [];
|
|
68
|
+
var currentInCache = 0;
|
|
69
|
+
var root = newNode();
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
insertBodies: insertBodies,
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Gets root node if it is present
|
|
76
|
+
*/
|
|
77
|
+
getRoot: function() {
|
|
78
|
+
return root;
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
updateBodyForce: update,
|
|
82
|
+
|
|
83
|
+
options: function(newOptions) {
|
|
84
|
+
if (newOptions) {
|
|
85
|
+
if (typeof newOptions.gravity === 'number') {
|
|
86
|
+
gravity = newOptions.gravity;
|
|
87
|
+
}
|
|
88
|
+
if (typeof newOptions.theta === 'number') {
|
|
89
|
+
theta = newOptions.theta;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
gravity: gravity,
|
|
97
|
+
theta: theta
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
function newNode() {
|
|
103
|
+
// To avoid pressure on GC we reuse nodes.
|
|
104
|
+
var node = nodesCache[currentInCache];
|
|
105
|
+
if (node) {
|
|
106
|
+
${a(" node.")}
|
|
107
|
+
node.body = null;
|
|
108
|
+
node.mass = ${t("node.mass_{var} = ",{join:""})}0;
|
|
109
|
+
${t("node.min_{var} = node.max_{var} = ",{join:""})}0;
|
|
110
|
+
} else {
|
|
111
|
+
node = new QuadNode();
|
|
112
|
+
nodesCache[currentInCache] = node;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
++currentInCache;
|
|
116
|
+
return node;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function update(sourceBody) {
|
|
120
|
+
var queue = updateQueue;
|
|
121
|
+
var v;
|
|
122
|
+
${t("var d{var};",{indent:4})}
|
|
123
|
+
var r;
|
|
124
|
+
${t("var f{var} = 0;",{indent:4})}
|
|
125
|
+
var queueLength = 1;
|
|
126
|
+
var shiftIdx = 0;
|
|
127
|
+
var pushIdx = 1;
|
|
128
|
+
|
|
129
|
+
queue[0] = root;
|
|
130
|
+
|
|
131
|
+
while (queueLength) {
|
|
132
|
+
var node = queue[shiftIdx];
|
|
133
|
+
var body = node.body;
|
|
134
|
+
|
|
135
|
+
queueLength -= 1;
|
|
136
|
+
shiftIdx += 1;
|
|
137
|
+
var differentBody = (body !== sourceBody);
|
|
138
|
+
if (body && differentBody) {
|
|
139
|
+
// If the current node is a leaf node (and it is not source body),
|
|
140
|
+
// calculate the force exerted by the current node on body, and add this
|
|
141
|
+
// amount to body's net force.
|
|
142
|
+
${t("d{var} = body.pos.{var} - sourceBody.pos.{var};",{indent:8})}
|
|
143
|
+
r = Math.sqrt(${t("d{var} * d{var}",{join:" + "})});
|
|
144
|
+
|
|
145
|
+
if (r === 0) {
|
|
146
|
+
// Poor man's protection against zero distance.
|
|
147
|
+
${t("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}
|
|
148
|
+
r = Math.sqrt(${t("d{var} * d{var}",{join:" + "})});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// This is standard gravitation force calculation but we divide
|
|
152
|
+
// by r^3 to save two operations when normalizing force vector.
|
|
153
|
+
v = gravity * body.mass * sourceBody.mass / (r * r * r);
|
|
154
|
+
${t("f{var} += v * d{var};",{indent:8})}
|
|
155
|
+
} else if (differentBody) {
|
|
156
|
+
// Otherwise, calculate the ratio s / r, where s is the width of the region
|
|
157
|
+
// represented by the internal node, and r is the distance between the body
|
|
158
|
+
// and the node's center-of-mass
|
|
159
|
+
${t("d{var} = node.mass_{var} / node.mass - sourceBody.pos.{var};",{indent:8})}
|
|
160
|
+
r = Math.sqrt(${t("d{var} * d{var}",{join:" + "})});
|
|
161
|
+
|
|
162
|
+
if (r === 0) {
|
|
163
|
+
// Sorry about code duplication. I don't want to create many functions
|
|
164
|
+
// right away. Just want to see performance first.
|
|
165
|
+
${t("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:10})}
|
|
166
|
+
r = Math.sqrt(${t("d{var} * d{var}",{join:" + "})});
|
|
167
|
+
}
|
|
168
|
+
// If s / r < θ, treat this internal node as a single body, and calculate the
|
|
169
|
+
// force it exerts on sourceBody, and add this amount to sourceBody's net force.
|
|
170
|
+
if ((node.max_${st(0)} - node.min_${st(0)}) / r < theta) {
|
|
171
|
+
// in the if statement above we consider node's width only
|
|
172
|
+
// because the region was made into square during tree creation.
|
|
173
|
+
// Thus there is no difference between using width or height.
|
|
174
|
+
v = gravity * node.mass * sourceBody.mass / (r * r * r);
|
|
175
|
+
${t("f{var} += v * d{var};",{indent:10})}
|
|
176
|
+
} else {
|
|
177
|
+
// Otherwise, run the procedure recursively on each of the current node's children.
|
|
178
|
+
|
|
179
|
+
// I intentionally unfolded this loop, to save several CPU cycles.
|
|
180
|
+
${o()}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
${t("sourceBody.force.{var} += f{var};",{indent:4})}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function insertBodies(bodies) {
|
|
189
|
+
${t("var {var}min = Number.MAX_VALUE;",{indent:4})}
|
|
190
|
+
${t("var {var}max = Number.MIN_VALUE;",{indent:4})}
|
|
191
|
+
var i = bodies.length;
|
|
192
|
+
|
|
193
|
+
// To reduce quad tree depth we are looking for exact bounding box of all particles.
|
|
194
|
+
while (i--) {
|
|
195
|
+
var pos = bodies[i].pos;
|
|
196
|
+
${t("if (pos.{var} < {var}min) {var}min = pos.{var};",{indent:6})}
|
|
197
|
+
${t("if (pos.{var} > {var}max) {var}max = pos.{var};",{indent:6})}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Makes the bounds square.
|
|
201
|
+
var maxSideLength = -Infinity;
|
|
202
|
+
${t("if ({var}max - {var}min > maxSideLength) maxSideLength = {var}max - {var}min ;",{indent:4})}
|
|
203
|
+
|
|
204
|
+
currentInCache = 0;
|
|
205
|
+
root = newNode();
|
|
206
|
+
${t("root.min_{var} = {var}min;",{indent:4})}
|
|
207
|
+
${t("root.max_{var} = {var}min + maxSideLength;",{indent:4})}
|
|
208
|
+
|
|
209
|
+
i = bodies.length - 1;
|
|
210
|
+
if (i >= 0) {
|
|
211
|
+
root.body = bodies[i];
|
|
212
|
+
}
|
|
213
|
+
while (i--) {
|
|
214
|
+
insert(bodies[i], root);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function insert(newBody) {
|
|
219
|
+
insertStack.reset();
|
|
220
|
+
insertStack.push(root, newBody);
|
|
221
|
+
|
|
222
|
+
while (!insertStack.isEmpty()) {
|
|
223
|
+
var stackItem = insertStack.pop();
|
|
224
|
+
var node = stackItem.node;
|
|
225
|
+
var body = stackItem.body;
|
|
226
|
+
|
|
227
|
+
if (!node.body) {
|
|
228
|
+
// This is internal node. Update the total mass of the node and center-of-mass.
|
|
229
|
+
${t("var {var} = body.pos.{var};",{indent:8})}
|
|
230
|
+
node.mass += body.mass;
|
|
231
|
+
${t("node.mass_{var} += body.mass * {var};",{indent:8})}
|
|
232
|
+
|
|
233
|
+
// Recursively insert the body in the appropriate quadrant.
|
|
234
|
+
// But first find the appropriate quadrant.
|
|
235
|
+
var quadIdx = 0; // Assume we are in the 0's quad.
|
|
236
|
+
${t("var min_{var} = node.min_{var};",{indent:8})}
|
|
237
|
+
${t("var max_{var} = (min_{var} + node.max_{var}) / 2;",{indent:8})}
|
|
238
|
+
|
|
239
|
+
${i(8)}
|
|
240
|
+
|
|
241
|
+
var child = getChild(node, quadIdx);
|
|
242
|
+
|
|
243
|
+
if (!child) {
|
|
244
|
+
// The node is internal but this quadrant is not taken. Add
|
|
245
|
+
// subnode to it.
|
|
246
|
+
child = newNode();
|
|
247
|
+
${t("child.min_{var} = min_{var};",{indent:10})}
|
|
248
|
+
${t("child.max_{var} = max_{var};",{indent:10})}
|
|
249
|
+
child.body = body;
|
|
250
|
+
|
|
251
|
+
setChild(node, quadIdx, child);
|
|
252
|
+
} else {
|
|
253
|
+
// continue searching in this quadrant.
|
|
254
|
+
insertStack.push(child, body);
|
|
255
|
+
}
|
|
256
|
+
} else {
|
|
257
|
+
// We are trying to add to the leaf node.
|
|
258
|
+
// We have to convert current leaf into internal node
|
|
259
|
+
// and continue adding two nodes.
|
|
260
|
+
var oldBody = node.body;
|
|
261
|
+
node.body = null; // internal nodes do not cary bodies
|
|
262
|
+
|
|
263
|
+
if (isSamePosition(oldBody.pos, body.pos)) {
|
|
264
|
+
// Prevent infinite subdivision by bumping one node
|
|
265
|
+
// anywhere in this quadrant
|
|
266
|
+
var retriesCount = 3;
|
|
267
|
+
do {
|
|
268
|
+
var offset = random.nextDouble();
|
|
269
|
+
${t("var d{var} = (node.max_{var} - node.min_{var}) * offset;",{indent:12})}
|
|
270
|
+
|
|
271
|
+
${t("oldBody.pos.{var} = node.min_{var} + d{var};",{indent:12})}
|
|
272
|
+
retriesCount -= 1;
|
|
273
|
+
// Make sure we don't bump it out of the box. If we do, next iteration should fix it
|
|
274
|
+
} while (retriesCount > 0 && isSamePosition(oldBody.pos, body.pos));
|
|
275
|
+
|
|
276
|
+
if (retriesCount === 0 && isSamePosition(oldBody.pos, body.pos)) {
|
|
277
|
+
// This is very bad, we ran out of precision.
|
|
278
|
+
// if we do not return from the method we'll get into
|
|
279
|
+
// infinite loop here. So we sacrifice correctness of layout, and keep the app running
|
|
280
|
+
// Next layout iteration should get larger bounding box in the first step and fix this
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
// Next iteration should subdivide node further.
|
|
285
|
+
insertStack.push(node, oldBody);
|
|
286
|
+
insertStack.push(node, body);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
return createQuadTree;
|
|
292
|
+
|
|
293
|
+
`;function i(s){let l=[],c=Array(s+1).join(" ");for(let f=0;f<e;++f)l.push(c+`if (${st(f)} > max_${st(f)}) {`),l.push(c+` quadIdx = quadIdx + ${Math.pow(2,f)};`),l.push(c+` min_${st(f)} = max_${st(f)};`),l.push(c+` max_${st(f)} = node.max_${st(f)};`),l.push(c+"}");return l.join(`
|
|
294
|
+
`)}function o(){let s=Array(11).join(" "),l=[];for(let c=0;c<n;++c)l.push(s+`if (node.quad${c}) {`),l.push(s+` queue[pushIdx] = node.quad${c};`),l.push(s+" queueLength += 1;"),l.push(s+" pushIdx += 1;"),l.push(s+"}");return l.join(`
|
|
295
|
+
`)}function a(s){let l=[];for(let c=0;c<n;++c)l.push(`${s}quad${c} = null;`);return l.join(`
|
|
296
|
+
`)}}function fa(e){let t=Zr(e);return`
|
|
297
|
+
function isSamePosition(point1, point2) {
|
|
298
|
+
${t("var d{var} = Math.abs(point1.{var} - point2.{var});",{indent:2})}
|
|
299
|
+
|
|
300
|
+
return ${t("d{var} < 1e-8",{join:" && "})};
|
|
301
|
+
}
|
|
302
|
+
`}function da(e){var t=Math.pow(2,e);return`
|
|
303
|
+
function setChild(node, idx, child) {
|
|
304
|
+
${n()}
|
|
305
|
+
}`;function n(){let r=[];for(let i=0;i<t;++i){let o=i===0?" ":" else ";r.push(`${o}if (idx === ${i}) node.quad${i} = child;`)}return r.join(`
|
|
306
|
+
`)}}function ha(e){return`function getChild(node, idx) {
|
|
307
|
+
${t()}
|
|
308
|
+
return null;
|
|
309
|
+
}`;function t(){let n=[],r=Math.pow(2,e);for(let i=0;i<r;++i)n.push(` if (idx === ${i}) return node.quad${i};`);return n.join(`
|
|
310
|
+
`)}}function pa(e){let t=Zr(e),n=Math.pow(2,e);var r=`
|
|
311
|
+
function QuadNode() {
|
|
312
|
+
// body stored inside this node. In quad tree only leaf nodes (by construction)
|
|
313
|
+
// contain bodies:
|
|
314
|
+
this.body = null;
|
|
315
|
+
|
|
316
|
+
// Child nodes are stored in quads. Each quad is presented by number:
|
|
317
|
+
// 0 | 1
|
|
318
|
+
// -----
|
|
319
|
+
// 2 | 3
|
|
320
|
+
${i(" this.")}
|
|
321
|
+
|
|
322
|
+
// Total mass of current node
|
|
323
|
+
this.mass = 0;
|
|
324
|
+
|
|
325
|
+
// Center of mass coordinates
|
|
326
|
+
${t("this.mass_{var} = 0;",{indent:2})}
|
|
327
|
+
|
|
328
|
+
// bounding box coordinates
|
|
329
|
+
${t("this.min_{var} = 0;",{indent:2})}
|
|
330
|
+
${t("this.max_{var} = 0;",{indent:2})}
|
|
331
|
+
}
|
|
332
|
+
`;return r;function i(o){let a=[];for(let s=0;s<n;++s)a.push(`${o}quad${s} = null;`);return a.join(`
|
|
333
|
+
`)}}function ga(){return`
|
|
334
|
+
/**
|
|
335
|
+
* Our implementation of QuadTree is non-recursive to avoid GC hit
|
|
336
|
+
* This data structure represent stack of elements
|
|
337
|
+
* which we are trying to insert into quad tree.
|
|
338
|
+
*/
|
|
339
|
+
function InsertStack () {
|
|
340
|
+
this.stack = [];
|
|
341
|
+
this.popIdx = 0;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
InsertStack.prototype = {
|
|
345
|
+
isEmpty: function() {
|
|
346
|
+
return this.popIdx === 0;
|
|
347
|
+
},
|
|
348
|
+
push: function (node, body) {
|
|
349
|
+
var item = this.stack[this.popIdx];
|
|
350
|
+
if (!item) {
|
|
351
|
+
// we are trying to avoid memory pressure: create new element
|
|
352
|
+
// only when absolutely necessary
|
|
353
|
+
this.stack[this.popIdx] = new InsertStackElement(node, body);
|
|
354
|
+
} else {
|
|
355
|
+
item.node = node;
|
|
356
|
+
item.body = body;
|
|
357
|
+
}
|
|
358
|
+
++this.popIdx;
|
|
359
|
+
},
|
|
360
|
+
pop: function () {
|
|
361
|
+
if (this.popIdx > 0) {
|
|
362
|
+
return this.stack[--this.popIdx];
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
reset: function () {
|
|
366
|
+
this.popIdx = 0;
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
function InsertStackElement(node, body) {
|
|
371
|
+
this.node = node; // QuadTree node
|
|
372
|
+
this.body = body; // physical body which needs to be inserted to node
|
|
373
|
+
}
|
|
374
|
+
`}var Ic=ft.exports,Jr={exports:{}};Jr.exports=zc;Jr.exports.generateFunctionBody=va;const Dc=zt;function zc(e){let t=va(e);return new Function("bodies","settings","random",t)}function va(e){let t=Dc(e);return`
|
|
375
|
+
var boundingBox = {
|
|
376
|
+
${t("min_{var}: 0, max_{var}: 0,",{indent:4})}
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
return {
|
|
380
|
+
box: boundingBox,
|
|
381
|
+
|
|
382
|
+
update: updateBoundingBox,
|
|
383
|
+
|
|
384
|
+
reset: resetBoundingBox,
|
|
385
|
+
|
|
386
|
+
getBestNewPosition: function (neighbors) {
|
|
387
|
+
var ${t("base_{var} = 0",{join:", "})};
|
|
388
|
+
|
|
389
|
+
if (neighbors.length) {
|
|
390
|
+
for (var i = 0; i < neighbors.length; ++i) {
|
|
391
|
+
let neighborPos = neighbors[i].pos;
|
|
392
|
+
${t("base_{var} += neighborPos.{var};",{indent:10})}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
${t("base_{var} /= neighbors.length;",{indent:8})}
|
|
396
|
+
} else {
|
|
397
|
+
${t("base_{var} = (boundingBox.min_{var} + boundingBox.max_{var}) / 2;",{indent:8})}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
var springLength = settings.springLength;
|
|
401
|
+
return {
|
|
402
|
+
${t("{var}: base_{var} + (random.nextDouble() - 0.5) * springLength,",{indent:8})}
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
function updateBoundingBox() {
|
|
408
|
+
var i = bodies.length;
|
|
409
|
+
if (i === 0) return; // No bodies - no borders.
|
|
410
|
+
|
|
411
|
+
${t("var max_{var} = -Infinity;",{indent:4})}
|
|
412
|
+
${t("var min_{var} = Infinity;",{indent:4})}
|
|
413
|
+
|
|
414
|
+
while(i--) {
|
|
415
|
+
// this is O(n), it could be done faster with quadtree, if we check the root node bounds
|
|
416
|
+
var bodyPos = bodies[i].pos;
|
|
417
|
+
${t("if (bodyPos.{var} < min_{var}) min_{var} = bodyPos.{var};",{indent:6})}
|
|
418
|
+
${t("if (bodyPos.{var} > max_{var}) max_{var} = bodyPos.{var};",{indent:6})}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
${t("boundingBox.min_{var} = min_{var};",{indent:4})}
|
|
422
|
+
${t("boundingBox.max_{var} = max_{var};",{indent:4})}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function resetBoundingBox() {
|
|
426
|
+
${t("boundingBox.min_{var} = boundingBox.max_{var} = 0;",{indent:4})}
|
|
427
|
+
}
|
|
428
|
+
`}var Fc=Jr.exports,ei={exports:{}};const Bc=zt;ei.exports=$c;ei.exports.generateCreateDragForceFunctionBody=ya;function $c(e){let t=ya(e);return new Function("options",t)}function ya(e){return`
|
|
429
|
+
if (!Number.isFinite(options.dragCoefficient)) throw new Error('dragCoefficient is not a finite number');
|
|
430
|
+
|
|
431
|
+
return {
|
|
432
|
+
update: function(body) {
|
|
433
|
+
${Bc(e)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
`}var Hc=ei.exports,ti={exports:{}};const Uc=zt;ti.exports=qc;ti.exports.generateCreateSpringForceFunctionBody=ma;function qc(e){let t=ma(e);return new Function("options","random",t)}function ma(e){let t=Uc(e);return`
|
|
437
|
+
if (!Number.isFinite(options.springCoefficient)) throw new Error('Spring coefficient is not a number');
|
|
438
|
+
if (!Number.isFinite(options.springLength)) throw new Error('Spring length is not a number');
|
|
439
|
+
|
|
440
|
+
return {
|
|
441
|
+
/**
|
|
442
|
+
* Updates forces acting on a spring
|
|
443
|
+
*/
|
|
444
|
+
update: function (spring) {
|
|
445
|
+
var body1 = spring.from;
|
|
446
|
+
var body2 = spring.to;
|
|
447
|
+
var length = spring.length < 0 ? options.springLength : spring.length;
|
|
448
|
+
${t("var d{var} = body2.pos.{var} - body1.pos.{var};",{indent:6})}
|
|
449
|
+
var r = Math.sqrt(${t("d{var} * d{var}",{join:" + "})});
|
|
450
|
+
|
|
451
|
+
if (r === 0) {
|
|
452
|
+
${t("d{var} = (random.nextDouble() - 0.5) / 50;",{indent:8})}
|
|
453
|
+
r = Math.sqrt(${t("d{var} * d{var}",{join:" + "})});
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
var d = r - length;
|
|
457
|
+
var coefficient = ((spring.coefficient > 0) ? spring.coefficient : options.springCoefficient) * d / r;
|
|
458
|
+
|
|
459
|
+
${t("body1.force.{var} += coefficient * d{var}",{indent:6})};
|
|
460
|
+
body1.springCount += 1;
|
|
461
|
+
body1.springLength += r;
|
|
462
|
+
|
|
463
|
+
${t("body2.force.{var} -= coefficient * d{var}",{indent:6})};
|
|
464
|
+
body2.springCount += 1;
|
|
465
|
+
body2.springLength += r;
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
`}var Vc=ti.exports,ni={exports:{}};const Gc=zt;ni.exports=Wc;ni.exports.generateIntegratorFunctionBody=ba;function Wc(e){let t=ba(e);return new Function("bodies","timeStep","adaptiveTimeStepWeight",t)}function ba(e){let t=Gc(e);return`
|
|
469
|
+
var length = bodies.length;
|
|
470
|
+
if (length === 0) return 0;
|
|
471
|
+
|
|
472
|
+
${t("var d{var} = 0, t{var} = 0;",{indent:2})}
|
|
473
|
+
|
|
474
|
+
for (var i = 0; i < length; ++i) {
|
|
475
|
+
var body = bodies[i];
|
|
476
|
+
if (body.isPinned) continue;
|
|
477
|
+
|
|
478
|
+
if (adaptiveTimeStepWeight && body.springCount) {
|
|
479
|
+
timeStep = (adaptiveTimeStepWeight * body.springLength/body.springCount);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
var coeff = timeStep / body.mass;
|
|
483
|
+
|
|
484
|
+
${t("body.velocity.{var} += coeff * body.force.{var};",{indent:4})}
|
|
485
|
+
${t("var v{var} = body.velocity.{var};",{indent:4})}
|
|
486
|
+
var v = Math.sqrt(${t("v{var} * v{var}",{join:" + "})});
|
|
487
|
+
|
|
488
|
+
if (v > 1) {
|
|
489
|
+
// We normalize it so that we move within timeStep range.
|
|
490
|
+
// for the case when v <= 1 - we let velocity to fade out.
|
|
491
|
+
${t("body.velocity.{var} = v{var} / v;",{indent:6})}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
${t("d{var} = timeStep * body.velocity.{var};",{indent:4})}
|
|
495
|
+
|
|
496
|
+
${t("body.pos.{var} += d{var};",{indent:4})}
|
|
497
|
+
|
|
498
|
+
${t("t{var} += Math.abs(d{var});",{indent:4})}
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
return (${t("t{var} * t{var}",{join:" + "})})/length;
|
|
502
|
+
`}var Xc=ni.exports,lr,oo;function Yc(){if(oo)return lr;oo=1,lr=e;function e(t,n,r,i){this.from=t,this.to=n,this.length=r,this.coefficient=i}return lr}var cr,ao;function Kc(){if(ao)return cr;ao=1,cr=e;function e(t,n){var r;if(t||(t={}),n){for(r in n)if(n.hasOwnProperty(r)){var i=t.hasOwnProperty(r),o=typeof n[r],a=!i||typeof t[r]!==o;a?t[r]=n[r]:o==="object"&&(t[r]=e(t[r],n[r]))}}return t}return cr}var Gt={exports:{}},so;function Qc(){if(so)return Gt.exports;so=1,Gt.exports=e,Gt.exports.random=e,Gt.exports.randomIterator=s;function e(l){var c=typeof l=="number"?l:+new Date;return new t(c)}function t(l){this.seed=l}t.prototype.next=a,t.prototype.nextDouble=o,t.prototype.uniform=o,t.prototype.gaussian=n,t.prototype.random=o;function n(){var l,c,f;do c=this.nextDouble()*2-1,f=this.nextDouble()*2-1,l=c*c+f*f;while(l>=1||l===0);return c*Math.sqrt(-2*Math.log(l)/l)}t.prototype.levy=r;function r(){var l=1.5,c=Math.pow(i(1+l)*Math.sin(Math.PI*l/2)/(i((1+l)/2)*l*Math.pow(2,(l-1)/2)),1/l);return this.gaussian()*c/Math.pow(Math.abs(this.gaussian()),1/l)}function i(l){return Math.sqrt(2*Math.PI/l)*Math.pow(1/Math.E*(l+1/(12*l-1/(10*l))),l)}function o(){var l=this.seed;return l=l+2127912214+(l<<12)&4294967295,l=(l^3345072700^l>>>19)&4294967295,l=l+374761393+(l<<5)&4294967295,l=(l+3550635116^l<<9)&4294967295,l=l+4251993797+(l<<3)&4294967295,l=(l^3042594569^l>>>16)&4294967295,this.seed=l,(l&268435455)/268435456}function a(l){return Math.floor(this.nextDouble()*l)}function s(l,c){var f=c||e();if(typeof f.next!="function")throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:g,shuffle:u};function u(){var h,p,v;for(h=l.length-1;h>0;--h)p=f.next(h+1),v=l[p],l[p]=l[h],l[h]=v;return l}function g(h){var p,v,y;for(p=l.length-1;p>0;--p)v=f.next(p+1),y=l[v],l[v]=l[p],l[p]=y,h(y);l.length&&h(l[0])}}return Gt.exports}var _a=iu,Zc=Nc,Jc=Ic,eu=Fc,tu=Hc,nu=Vc,ru=Xc,lo={};function iu(e){var t=Yc(),n=Kc(),r=Kr;if(e){if(e.springCoeff!==void 0)throw new Error("springCoeff was renamed to springCoefficient");if(e.dragCoeff!==void 0)throw new Error("dragCoeff was renamed to dragCoefficient")}e=n(e,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var i=lo[e.dimensions];if(!i){var o=e.dimensions;i={Body:Zc(o,e.debug),createQuadTree:Jc(o),createBounds:eu(o),createDragForce:tu(o),createSpringForce:nu(o),integrate:ru(o)},lo[o]=i}var a=i.Body,s=i.createQuadTree,l=i.createBounds,c=i.createDragForce,f=i.createSpringForce,u=i.integrate,g=O=>new a(O),h=Qc().random(42),p=[],v=[],y=s(e,h),d=l(p,e,h),b=f(e,h),m=c(e),x=0,w=[],_=new Map,k=0;M("nbody",B),M("spring",S);var C={bodies:p,quadTree:y,springs:v,settings:e,addForce:M,removeForce:N,getForces:E,step:function(){for(var O=0;O<w.length;++O)w[O](k);var L=u(p,e.timeStep,e.adaptiveTimeStepWeight);return k+=1,L},addBody:function(O){if(!O)throw new Error("Body is required");return p.push(O),O},addBodyAt:function(O){if(!O)throw new Error("Body position is required");var L=g(O);return p.push(L),L},removeBody:function(O){if(O){var L=p.indexOf(O);if(!(L<0))return p.splice(L,1),p.length===0&&d.reset(),!0}},addSpring:function(O,L,U,ne){if(!O||!L)throw new Error("Cannot add null spring to force simulator");typeof U!="number"&&(U=-1);var J=new t(O,L,U,ne>=0?ne:-1);return v.push(J),J},getTotalMovement:function(){return x},removeSpring:function(O){if(O){var L=v.indexOf(O);if(L>-1)return v.splice(L,1),!0}},getBestNewBodyPosition:function(O){return d.getBestNewPosition(O)},getBBox:P,getBoundingBox:P,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(O){return O!==void 0?(e.gravity=O,y.options({gravity:O}),this):e.gravity},theta:function(O){return O!==void 0?(e.theta=O,y.options({theta:O}),this):e.theta},random:h};return ou(e,C),r(C),C;function P(){return d.update(),d.box}function M(O,L){if(_.has(O))throw new Error("Force "+O+" is already added");_.set(O,L),w.push(L)}function N(O){var L=w.indexOf(_.get(O));L<0||(w.splice(L,1),_.delete(O))}function E(){return _}function B(){if(p.length!==0){y.insertBodies(p);for(var O=p.length;O--;){var L=p[O];L.isPinned||(L.reset(),y.updateBodyForce(L),m.update(L))}}}function S(){for(var O=v.length;O--;)b.update(v[O])}}function ou(e,t){for(var n in e)au(e,t,n)}function au(e,t,n){if(e.hasOwnProperty(n)&&typeof t[n]!="function"){var r=Number.isFinite(e[n]);r?t[n]=function(i){if(i!==void 0){if(!Number.isFinite(i))throw new Error("Value of "+n+" should be a valid number.");return e[n]=i,t}return e[n]}:t[n]=function(i){return i!==void 0?(e[n]=i,t):e[n]}}}Qr.exports=lu;Qr.exports.simulator=_a;var su=Kr;function lu(e,t){if(!e)throw new Error("Graph structure cannot be undefined");var n=t&&t.createSimulator||_a,r=n(t);if(Array.isArray(t))throw new Error("Physics settings is expected to be an object");var i=e.version>19?B:E;t&&typeof t.nodeMass=="function"&&(i=t.nodeMass);var o=new Map,a={},s=0,l=r.settings.springTransform||cu;m(),y();var c=!1,f={step:function(){if(s===0)return u(!0),!0;var S=r.step();f.lastMove=S,f.fire("step");var O=S/s,L=O<=.01;return u(L),L},getNodePosition:function(S){return N(S).pos},setNodePosition:function(S){var O=N(S);O.setPosition.apply(O,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(S){var O=a[S];if(O)return{from:O.from.pos,to:O.to.pos}},getGraphRect:function(){return r.getBBox()},forEachBody:g,pinNode:function(S,O){var L=N(S.id);L.isPinned=!!O},isNodePinned:function(S){return N(S.id).isPinned},dispose:function(){e.off("changed",b),f.fire("disposed")},getBody:v,getSpring:p,getForceVectorLength:h,simulator:r,graph:e,lastMove:0};return su(f),f;function u(S){c!==S&&(c=S,d(S))}function g(S){o.forEach(S)}function h(){var S=0,O=0;return g(function(L){S+=Math.abs(L.force.x),O+=Math.abs(L.force.y)}),Math.sqrt(S*S+O*O)}function p(S,O){var L;if(O===void 0)typeof S!="object"?L=S:L=S.id;else{var U=e.hasLink(S,O);if(!U)return;L=U.id}return a[L]}function v(S){return o.get(S)}function y(){e.on("changed",b)}function d(S){f.fire("stable",S)}function b(S){for(var O=0;O<S.length;++O){var L=S[O];L.changeType==="add"?(L.node&&x(L.node.id),L.link&&_(L.link)):L.changeType==="remove"&&(L.node&&w(L.node),L.link&&k(L.link))}s=e.getNodesCount()}function m(){s=0,e.forEachNode(function(S){x(S.id),s+=1}),e.forEachLink(_)}function x(S){var O=o.get(S);if(!O){var L=e.getNode(S);if(!L)throw new Error("initBody() was called with unknown node id");var U=L.position;if(!U){var ne=C(L);U=r.getBestNewBodyPosition(ne)}O=r.addBodyAt(U),O.id=S,o.set(S,O),P(S),M(L)&&(O.isPinned=!0)}}function w(S){var O=S.id,L=o.get(O);L&&(o.delete(O),r.removeBody(L))}function _(S){P(S.fromId),P(S.toId);var O=o.get(S.fromId),L=o.get(S.toId),U=r.addSpring(O,L,S.length);l(S,U),a[S.id]=U}function k(S){var O=a[S.id];if(O){var L=e.getNode(S.fromId),U=e.getNode(S.toId);L&&P(L.id),U&&P(U.id),delete a[S.id],r.removeSpring(O)}}function C(S){var O=[];if(!S.links)return O;for(var L=Math.min(S.links.length,2),U=0;U<L;++U){var ne=S.links[U],J=ne.fromId!==S.id?o.get(ne.fromId):o.get(ne.toId);J&&J.pos&&O.push(J)}return O}function P(S){var O=o.get(S);if(O.mass=i(S),Number.isNaN(O.mass))throw new Error("Node mass should be a number")}function M(S){return S&&(S.isPinned||S.data&&S.data.isPinned)}function N(S){var O=o.get(S);return O||(x(S),O=o.get(S)),O}function E(S){var O=e.getLinks(S);return O?1+O.length/3:1}function B(S){var O=e.getLinks(S);return O?1+O.size/3:1}}function cu(){}var uu=Qr.exports;const fu=ia(uu);function Sr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var du=typeof global=="object"&&global&&global.Object===Object&&global,hu=typeof self=="object"&&self&&self.Object===Object&&self,xa=du||hu||Function("return this")(),ur=function(){return xa.Date.now()},pu=/\s/;function gu(e){for(var t=e.length;t--&&pu.test(e.charAt(t)););return t}var vu=/^\s+/;function yu(e){return e&&e.slice(0,gu(e)+1).replace(vu,"")}var Tn=xa.Symbol,wa=Object.prototype,mu=wa.hasOwnProperty,bu=wa.toString,Wt=Tn?Tn.toStringTag:void 0;function _u(e){var t=mu.call(e,Wt),n=e[Wt];try{e[Wt]=void 0;var r=!0}catch{}var i=bu.call(e);return r&&(t?e[Wt]=n:delete e[Wt]),i}var xu=Object.prototype,wu=xu.toString;function ku(e){return wu.call(e)}var Cu="[object Null]",Su="[object Undefined]",co=Tn?Tn.toStringTag:void 0;function Mu(e){return e==null?e===void 0?Su:Cu:co&&co in Object(e)?_u(e):ku(e)}function Pu(e){return e!=null&&typeof e=="object"}var Ou="[object Symbol]";function Au(e){return typeof e=="symbol"||Pu(e)&&Mu(e)==Ou}var uo=NaN,ju=/^[-+]0x[0-9a-f]+$/i,Tu=/^0b[01]+$/i,Eu=/^0o[0-7]+$/i,Lu=parseInt;function fo(e){if(typeof e=="number")return e;if(Au(e))return uo;if(Sr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Sr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=yu(e);var n=Tu.test(e);return n||Eu.test(e)?Lu(e.slice(2),n?2:8):ju.test(e)?uo:+e}var Nu="Expected a function",Ru=Math.max,Iu=Math.min;function Du(e,t,n){var r,i,o,a,s,l,c=0,f=!1,u=!1,g=!0;if(typeof e!="function")throw new TypeError(Nu);t=fo(t)||0,Sr(n)&&(f=!!n.leading,u="maxWait"in n,o=u?Ru(fo(n.maxWait)||0,t):o,g="trailing"in n?!!n.trailing:g);function h(_){var k=r,C=i;return r=i=void 0,c=_,a=e.apply(C,k),a}function p(_){return c=_,s=setTimeout(d,t),f?h(_):a}function v(_){var k=_-l,C=_-c,P=t-k;return u?Iu(P,o-C):P}function y(_){var k=_-l,C=_-c;return l===void 0||k>=t||k<0||u&&C>=o}function d(){var _=ur();if(y(_))return b(_);s=setTimeout(d,v(_))}function b(_){return s=void 0,g&&r?h(_):(r=i=void 0,a)}function m(){s!==void 0&&clearTimeout(s),c=0,r=l=i=s=void 0}function x(){return s===void 0?a:b(ur())}function w(){var _=ur(),k=y(_);if(r=arguments,i=this,l=_,k){if(s===void 0)return p(l);if(u)return clearTimeout(s),s=setTimeout(d,t),h(l)}return s===void 0&&(s=setTimeout(d,t)),a}return w.cancel=m,w.flush=x,w}function ho(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zu(e){if(Array.isArray(e))return e}function Fu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bu(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}function $u(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}function Hu(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
503
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uu(e,t){return zu(e)||$u(e,t)||qu(e,t)||Hu()}function qu(e,t){if(e){if(typeof e=="string")return ho(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ho(e,t):void 0}}var Vu=Bu(function e(t,n){var r=n.default,i=r===void 0?null:r,o=n.triggerUpdate,a=o===void 0?!0:o,s=n.onChange,l=s===void 0?function(c,f){}:s;Fu(this,e),this.name=t,this.defaultVal=i,this.triggerUpdate=a,this.onChange=l});function ri(e){var t=e.stateInit,n=t===void 0?function(){return{}}:t,r=e.props,i=r===void 0?{}:r,o=e.methods,a=o===void 0?{}:o,s=e.aliases,l=s===void 0?{}:s,c=e.init,f=c===void 0?function(){}:c,u=e.update,g=u===void 0?function(){}:u,h=Object.keys(i).map(function(p){return new Vu(p,i[p])});return function p(){for(var v=arguments.length,y=new Array(v),d=0;d<v;d++)y[d]=arguments[d];var b=!!(this instanceof p&&this.constructor),m=b?y.shift():void 0,x=y[0],w=x===void 0?{}:x,_=Object.assign({},n instanceof Function?n(w):n,{initialised:!1}),k={};function C(N){return P(N,w),M(),C}var P=function(E,B){f.call(C,E,_,B),_.initialised=!0},M=Du(function(){_.initialised&&(g.call(C,_,k),k={})},1);return h.forEach(function(N){C[N.name]=E(N);function E(B){var S=B.name,O=B.triggerUpdate,L=O===void 0?!1:O,U=B.onChange,ne=U===void 0?function(D,$){}:U,J=B.defaultVal,se=J===void 0?null:J;return function(D){var $=_[S];if(!arguments.length)return $;var G=D===void 0?se:D;return _[S]=G,ne.call(C,G,_,$),!k.hasOwnProperty(S)&&(k[S]=$),L&&M(),C}}}),Object.keys(a).forEach(function(N){C[N]=function(){for(var E,B=arguments.length,S=new Array(B),O=0;O<B;O++)S[O]=arguments[O];return(E=a[N]).call.apply(E,[C,_].concat(S))}}),Object.entries(l).forEach(function(N){var E=Uu(N,2),B=E[0],S=E[1];return C[B]=C[S]}),C.resetProps=function(){return h.forEach(function(N){C[N.name](N.defaultVal)}),C},C.resetProps(),_._rerender=M,b&&m&&C(m),C}}var ie=function(e){return typeof e=="function"?e:typeof e=="string"?function(t){return t[e]}:function(t){return e}};class po extends Map{constructor(t,n=Xu){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(go(this,t))}has(t){return super.has(go(this,t))}set(t,n){return super.set(Gu(this,t),n)}delete(t){return super.delete(Wu(this,t))}}function go({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Gu({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Wu({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Xu(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Yu(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function Ku(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function Mr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Qu(e){if(Array.isArray(e))return e}function Zu(e){if(Array.isArray(e))return Mr(e)}function ka(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function Ju(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ef(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ce(e,t){return e.get(ka(e,t))}function Pt(e,t,n){Ju(e,t),t.set(e,n)}function wn(e,t,n){return e.set(ka(e,t),n),n}function tf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,ff(r.key),r)}}function nf(e,t,n){return t&&tf(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function rf(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function of(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}function af(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
504
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sf(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
505
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lf(e,t){return Qu(e)||of(e,t)||Ca(e,t)||af()}function cf(e){return Zu(e)||rf(e)||Ca(e)||sf()}function uf(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function ff(e){var t=uf(e,"string");return typeof t=="symbol"?t:t+""}function Ca(e,t){if(e){if(typeof e=="string")return Mr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Mr(e,t):void 0}}var Ot=new WeakMap,Xt=new WeakMap,At=new WeakMap,fr=new WeakMap,dr=new WeakMap,hr=new WeakMap,df=function(){function e(){ef(this,e),Pt(this,Ot,new Map),Pt(this,Xt,new Map),Pt(this,At,function(t){return t}),Pt(this,fr,function(){return{}}),Pt(this,dr,function(){}),Pt(this,hr,function(){})}return nf(e,[{key:"getObj",value:function(n){return Ce(Ot,this).get(Ce(At,this).call(this,n))}},{key:"getData",value:function(n){return Ce(Xt,this).get(n)}},{key:"entries",value:function(){return cf(Ce(Xt,this).entries()).map(function(n){var r=lf(n,2),i=r[0],o=r[1];return[o,i]})}},{key:"id",value:function(n){return wn(At,this,ie(n)),this}},{key:"onCreateObj",value:function(n){return wn(fr,this,n),this}},{key:"onUpdateObj",value:function(n){return wn(dr,this,n),this}},{key:"onRemoveObj",value:function(n){return wn(hr,this,n),this}},{key:"digest",value:function(n){var r=this;n.filter(function(o){return!Ce(Ot,r).has(Ce(At,r).call(r,o))}).forEach(function(o){var a=Ce(fr,r).call(r,o);Ce(Ot,r).set(Ce(At,r).call(r,o),a),Ce(Xt,r).set(a,o)});var i=new Map(n.map(function(o){return[Ce(At,r).call(r,o),o]}));return Ce(Ot,this).forEach(function(o,a){i.has(a)?Ce(dr,r).call(r,o,i.get(a)):(Ce(hr,r).call(r,o,a),Ce(Ot,r).delete(a),Ce(Xt,r).delete(o))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])}();function hf(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const vo=Symbol("implicit");function Sa(){var e=new po,t=[],n=[],r=vo;function i(o){let a=e.get(o);if(a===void 0){if(r!==vo)return r;e.set(o,a=t.push(o)-1)}return n[a%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new po;for(const a of o)e.has(a)||e.set(a,t.push(a)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return Sa(t,n).unknown(r)},hf.apply(i,arguments),i}function pf(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}const gf=pf("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function En(e){"@babel/helpers - typeof";return En=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},En(e)}var vf=/^\s+/,yf=/\s+$/;function X(e,t){if(e=e||"",t=t||{},e instanceof X)return e;if(!(this instanceof X))return new X(e,t);var n=mf(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}X.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),n,r,i,o,a,s;return n=t.r/255,r=t.g/255,i=t.b/255,n<=.03928?o=n/12.92:o=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),i<=.03928?s=i/12.92:s=Math.pow((i+.055)/1.055,2.4),.2126*o+.7152*a+.0722*s},setAlpha:function(t){return this._a=Ma(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=mo(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=mo(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),i=Math.round(t.v*100);return this._a==1?"hsv("+n+", "+r+"%, "+i+"%)":"hsva("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=yo(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=yo(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),i=Math.round(t.l*100);return this._a==1?"hsl("+n+", "+r+"%, "+i+"%)":"hsla("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return bo(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return wf(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(pe(this._r,255)*100)+"%",g:Math.round(pe(this._g,255)*100)+"%",b:Math.round(pe(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(pe(this._r,255)*100)+"%, "+Math.round(pe(this._g,255)*100)+"%, "+Math.round(pe(this._b,255)*100)+"%)":"rgba("+Math.round(pe(this._r,255)*100)+"%, "+Math.round(pe(this._g,255)*100)+"%, "+Math.round(pe(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Nf[bo(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+_o(this._r,this._g,this._b,this._a),r=n,i=this._gradientType?"GradientType = 1, ":"";if(t){var o=X(t);r="#"+_o(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+n+",endColorstr="+r+")"},toString:function(t){var n=!!t;t=t||this._format;var r=!1,i=this._a<1&&this._a>=0,o=!n&&i&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return o?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return X(this.toString())},_applyModification:function(t,n){var r=t.apply(null,[this].concat([].slice.call(n)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(Mf,arguments)},brighten:function(){return this._applyModification(Pf,arguments)},darken:function(){return this._applyModification(Of,arguments)},desaturate:function(){return this._applyModification(kf,arguments)},saturate:function(){return this._applyModification(Cf,arguments)},greyscale:function(){return this._applyModification(Sf,arguments)},spin:function(){return this._applyModification(Af,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(Ef,arguments)},complement:function(){return this._applyCombination(jf,arguments)},monochromatic:function(){return this._applyCombination(Lf,arguments)},splitcomplement:function(){return this._applyCombination(Tf,arguments)},triad:function(){return this._applyCombination(xo,[3])},tetrad:function(){return this._applyCombination(xo,[4])}};X.fromRatio=function(e,t){if(En(e)=="object"){var n={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?n[r]=e[r]:n[r]=tn(e[r]));e=n}return X(e,t)};function mf(e){var t={r:0,g:0,b:0},n=1,r=null,i=null,o=null,a=!1,s=!1;return typeof e=="string"&&(e=zf(e)),En(e)=="object"&&(it(e.r)&&it(e.g)&&it(e.b)?(t=bf(e.r,e.g,e.b),a=!0,s=String(e.r).substr(-1)==="%"?"prgb":"rgb"):it(e.h)&&it(e.s)&&it(e.v)?(r=tn(e.s),i=tn(e.v),t=xf(e.h,r,i),a=!0,s="hsv"):it(e.h)&&it(e.s)&&it(e.l)&&(r=tn(e.s),o=tn(e.l),t=_f(e.h,r,o),a=!0,s="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=Ma(n),{ok:a,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function bf(e,t,n){return{r:pe(e,255)*255,g:pe(t,255)*255,b:pe(n,255)*255}}function yo(e,t,n){e=pe(e,255),t=pe(t,255),n=pe(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),o,a,s=(r+i)/2;if(r==i)o=a=0;else{var l=r-i;switch(a=s>.5?l/(2-r-i):l/(r+i),r){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4;break}o/=6}return{h:o,s:a,l:s}}function _f(e,t,n){var r,i,o;e=pe(e,360),t=pe(t,100),n=pe(n,100);function a(c,f,u){return u<0&&(u+=1),u>1&&(u-=1),u<1/6?c+(f-c)*6*u:u<1/2?f:u<2/3?c+(f-c)*(2/3-u)*6:c}if(t===0)r=i=o=n;else{var s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;r=a(l,s,e+1/3),i=a(l,s,e),o=a(l,s,e-1/3)}return{r:r*255,g:i*255,b:o*255}}function mo(e,t,n){e=pe(e,255),t=pe(t,255),n=pe(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),o,a,s=r,l=r-i;if(a=r===0?0:l/r,r==i)o=0;else{switch(r){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4;break}o/=6}return{h:o,s:a,v:s}}function xf(e,t,n){e=pe(e,360)*6,t=pe(t,100),n=pe(n,100);var r=Math.floor(e),i=e-r,o=n*(1-t),a=n*(1-i*t),s=n*(1-(1-i)*t),l=r%6,c=[n,a,o,o,s,n][l],f=[s,n,n,a,o,o][l],u=[o,o,s,n,n,a][l];return{r:c*255,g:f*255,b:u*255}}function bo(e,t,n,r){var i=[Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function wf(e,t,n,r,i){var o=[Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16)),Ye(Pa(r))];return i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}function _o(e,t,n,r){var i=[Ye(Pa(r)),Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16))];return i.join("")}X.equals=function(e,t){return!e||!t?!1:X(e).toRgbString()==X(t).toRgbString()};X.random=function(){return X.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function kf(e,t){t=t===0?0:t||10;var n=X(e).toHsl();return n.s-=t/100,n.s=Hn(n.s),X(n)}function Cf(e,t){t=t===0?0:t||10;var n=X(e).toHsl();return n.s+=t/100,n.s=Hn(n.s),X(n)}function Sf(e){return X(e).desaturate(100)}function Mf(e,t){t=t===0?0:t||10;var n=X(e).toHsl();return n.l+=t/100,n.l=Hn(n.l),X(n)}function Pf(e,t){t=t===0?0:t||10;var n=X(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),X(n)}function Of(e,t){t=t===0?0:t||10;var n=X(e).toHsl();return n.l-=t/100,n.l=Hn(n.l),X(n)}function Af(e,t){var n=X(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,X(n)}function jf(e){var t=X(e).toHsl();return t.h=(t.h+180)%360,X(t)}function xo(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=X(e).toHsl(),r=[X(e)],i=360/t,o=1;o<t;o++)r.push(X({h:(n.h+o*i)%360,s:n.s,l:n.l}));return r}function Tf(e){var t=X(e).toHsl(),n=t.h;return[X(e),X({h:(n+72)%360,s:t.s,l:t.l}),X({h:(n+216)%360,s:t.s,l:t.l})]}function Ef(e,t,n){t=t||6,n=n||30;var r=X(e).toHsl(),i=360/n,o=[X(e)];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,o.push(X(r));return o}function Lf(e,t){t=t||6;for(var n=X(e).toHsv(),r=n.h,i=n.s,o=n.v,a=[],s=1/t;t--;)a.push(X({h:r,s:i,v:o})),o=(o+s)%1;return a}X.mix=function(e,t,n){n=n===0?0:n||50;var r=X(e).toRgb(),i=X(t).toRgb(),o=n/100,a={r:(i.r-r.r)*o+r.r,g:(i.g-r.g)*o+r.g,b:(i.b-r.b)*o+r.b,a:(i.a-r.a)*o+r.a};return X(a)};X.readability=function(e,t){var n=X(e),r=X(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)};X.isReadable=function(e,t,n){var r=X.readability(e,t),i,o;switch(o=!1,i=Ff(n),i.level+i.size){case"AAsmall":case"AAAlarge":o=r>=4.5;break;case"AAlarge":o=r>=3;break;case"AAAsmall":o=r>=7;break}return o};X.mostReadable=function(e,t,n){var r=null,i=0,o,a,s,l;n=n||{},a=n.includeFallbackColors,s=n.level,l=n.size;for(var c=0;c<t.length;c++)o=X.readability(e,t[c]),o>i&&(i=o,r=X(t[c]));return X.isReadable(e,r,{level:s,size:l})||!a?r:(n.includeFallbackColors=!1,X.mostReadable(e,["#fff","#000"],n))};var Pr=X.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Nf=X.hexNames=Rf(Pr);function Rf(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function Ma(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function pe(e,t){If(e)&&(e="100%");var n=Df(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function Hn(e){return Math.min(1,Math.max(0,e))}function Ie(e){return parseInt(e,16)}function If(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function Df(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Ye(e){return e.length==1?"0"+e:""+e}function tn(e){return e<=1&&(e=e*100+"%"),e}function Pa(e){return Math.round(parseFloat(e)*255).toString(16)}function wo(e){return Ie(e)/255}var We=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function it(e){return!!We.CSS_UNIT.exec(e)}function zf(e){e=e.replace(vf,"").replace(yf,"").toLowerCase();var t=!1;if(Pr[e])e=Pr[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=We.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=We.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=We.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=We.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=We.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=We.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=We.hex8.exec(e))?{r:Ie(n[1]),g:Ie(n[2]),b:Ie(n[3]),a:wo(n[4]),format:t?"name":"hex8"}:(n=We.hex6.exec(e))?{r:Ie(n[1]),g:Ie(n[2]),b:Ie(n[3]),format:t?"name":"hex"}:(n=We.hex4.exec(e))?{r:Ie(n[1]+""+n[1]),g:Ie(n[2]+""+n[2]),b:Ie(n[3]+""+n[3]),a:wo(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=We.hex3.exec(e))?{r:Ie(n[1]+""+n[1]),g:Ie(n[2]+""+n[2]),b:Ie(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function Ff(e){var t,n;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:t,size:n}}function Or(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Bf(e){if(Array.isArray(e))return e}function $f(e){if(Array.isArray(e))return Or(e)}function Oa(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function Hf(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Aa(e,t,n){return t=Nt(t),Kf(e,ii()?Reflect.construct(t,n||[],Nt(e).constructor):t.apply(e,n))}function Uf(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function ja(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function pr(e,t){return e.get(Oa(e,t))}function ko(e,t,n){Uf(e,t),t.set(e,n)}function Co(e,t,n){return e.set(Oa(e,t),n),n}function Ta(e,t,n){if(ii())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return i}function qf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Na(r.key),r)}}function Ea(e,t,n){return t&&qf(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Un(e,t,n){return(t=Na(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ar(){return Ar=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=Qf(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},Ar.apply(null,arguments)}function Nt(e){return Nt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Nt(e)}function La(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&jr(e,t)}function ii(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ii=function(){return!!e})()}function Vf(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Gf(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}function Wf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
506
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xf(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
507
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function So(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Yf(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?So(Object(n),!0).forEach(function(r){Un(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):So(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Kf(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hf(e)}function jr(e,t){return jr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},jr(e,t)}function rn(e,t){return Bf(e)||Gf(e,t)||Ra(e,t)||Wf()}function Qf(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=Nt(e))!==null;);return e}function gr(e,t,n,r){var i=Ar(Nt(e.prototype),t,n);return typeof i=="function"?function(o){return i.apply(n,o)}:i}function Xe(e){return $f(e)||Vf(e)||Ra(e)||Xf()}function Zf(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Na(e){var t=Zf(e,"string");return typeof t=="symbol"?t:t+""}function Tr(e){"@babel/helpers - typeof";return Tr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tr(e)}function Ra(e,t){if(e){if(typeof e=="string")return Or(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Or(e,t):void 0}}var Ia=function(t){t instanceof Array?t.forEach(Ia):(t.map&&t.map.dispose(),t.dispose())},oi=function(t){t.geometry&&t.geometry.dispose(),t.material&&Ia(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(oi)},Mo=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),oi(n)}},vr=new WeakMap,kn=new WeakMap,Yt=function(e){function t(n){var r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.dataBindAttr,a=o===void 0?"__data":o,s=i.objBindAttr,l=s===void 0?"__threeObj":s;return ja(this,t),r=Aa(this,t),Un(r,"scene",void 0),ko(r,vr,void 0),ko(r,kn,void 0),r.scene=n,Co(vr,r,a),Co(kn,r,l),r.onRemoveObj(function(){}),r}return La(t,e),Ea(t,[{key:"onCreateObj",value:function(r){var i=this;return gr(t,"onCreateObj",this)([function(o){var a=r(o);return o[pr(kn,i)]=a,a[pr(vr,i)]=o,i.scene.add(a),a}]),this}},{key:"onRemoveObj",value:function(r){var i=this;return gr(t,"onRemoveObj",this)([function(o,a){var s=gr(t,"getData",i)([o]);r(o,a),i.scene.remove(o),oi(o),delete s[pr(kn,i)]}]),this}}])}(df),Kt=function(t){return isNaN(t)?parseInt(X(t).toHex(),16):t},yr=function(t){return isNaN(t)?X(t).getAlpha():1},Jf=Sa(gf);function Po(e,t,n){!t||typeof n!="string"||e.filter(function(r){return!r[n]}).forEach(function(r){r[n]=Jf(t(r))})}function ed(e,t){var n=e.nodes,r=e.links,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=i.nodeFilter,a=o===void 0?function(){return!0}:o,s=i.onLoopError,l=s===void 0?function(h){throw"Invalid DAG structure! Found cycle in node path: ".concat(h.join(" -> "),".")}:s,c={};n.forEach(function(h){return c[t(h)]={data:h,out:[],depth:-1,skip:!a(h)}}),r.forEach(function(h){var p=h.source,v=h.target,y=x(p),d=x(v);if(!c.hasOwnProperty(y))throw"Missing source node with id: ".concat(y);if(!c.hasOwnProperty(d))throw"Missing target node with id: ".concat(d);var b=c[y],m=c[d];b.out.push(m);function x(w){return Tr(w)==="object"?t(w):w}});var f=[];g(Object.values(c));var u=Object.assign.apply(Object,[{}].concat(Xe(Object.entries(c).filter(function(h){var p=rn(h,2),v=p[1];return!v.skip}).map(function(h){var p=rn(h,2),v=p[0],y=p[1];return Un({},v,y.depth)}))));return u;function g(h){for(var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,y=function(){var x=h[d];if(p.indexOf(x)!==-1){var w=[].concat(Xe(p.slice(p.indexOf(x))),[x]).map(function(_){return t(_.data)});return f.some(function(_){return _.length===w.length&&_.every(function(k,C){return k===w[C]})})||(f.push(w),l(w)),1}v>x.depth&&(x.depth=v,g(x.out,[].concat(Xe(p),[x]),v+(x.skip?0:1)))},d=0,b=h.length;d<b;d++)y()}}var Q=window.THREE?window.THREE:{Group:K.Group,Mesh:K.Mesh,MeshLambertMaterial:K.MeshLambertMaterial,Color:K.Color,BufferGeometry:K.BufferGeometry,BufferAttribute:K.BufferAttribute,Matrix4:K.Matrix4,Vector3:K.Vector3,SphereGeometry:K.SphereGeometry,CylinderGeometry:K.CylinderGeometry,TubeGeometry:K.TubeGeometry,ConeGeometry:K.ConeGeometry,Line:K.Line,LineBasicMaterial:K.LineBasicMaterial,QuadraticBezierCurve3:K.QuadraticBezierCurve3,CubicBezierCurve3:K.CubicBezierCurve3,Box3:K.Box3},Oo={graph:jc,forcelayout:fu},td=2,mr=new Q.BufferGeometry().setAttribute?"setAttribute":"addAttribute",Cn=new Q.BufferGeometry().applyMatrix4?"applyMatrix4":"applyMatrix",nd=ri({props:{jsonUrl:{onChange:function(t,n){var r=this;t&&!n.fetchingJson&&(n.fetchingJson=!0,n.onLoading(),fetch(t).then(function(i){return i.json()}).then(function(i){n.fetchingJson=!1,n.onFinishLoading(i),r.graphData(i)}))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(t,n){n.engineRunning=!1}},numDimensions:{default:3,onChange:function(t,n){var r=n.d3ForceLayout.force("charge");r&&r.strength(t>2?-60:-30),t<3&&i(n.graphData.nodes,"z"),t<2&&i(n.graphData.nodes,"y");function i(o,a){o.forEach(function(s){delete s[a],delete s["v".concat(a)]})}}},dagMode:{onChange:function(t,n){!t&&n.forceEngine==="d3"&&(n.graphData.nodes||[]).forEach(function(r){return r.fx=r.fy=r.fz=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(t){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},nodePositionUpdate:{triggerUpdate:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},linkDirectionalParticleThreeObject:{},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaDecay(t)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaTarget(t)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.velocityDecay(t)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(t){return t._flushObjects=!0,t._rerender(),this},d3Force:function(t,n,r){return r===void 0?t.d3ForceLayout.force(n):(t.d3ForceLayout.force(n,r),this)},d3ReheatSimulation:function(t){return t.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(t){return t.cntTicks=0,t.startTickTime=new Date,t.engineRunning=!0,this},tickFrame:function(t){var n=t.forceEngine!=="ngraph";return t.engineRunning&&r(),i(),o(),this;function r(){++t.cntTicks>t.cooldownTicks||new Date-t.startTickTime>t.cooldownTime||n&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin?(t.engineRunning=!1,t.onEngineStop()):(t.layout[n?"tick":"step"](),t.onEngineTick());var a=ie(t.nodeThreeObjectExtend);t.nodeDataMapper.entries().forEach(function(g){var h=rn(g,2),p=h[0],v=h[1];if(v){var y=n?p:t.layout.getNodePosition(p[t.nodeId]),d=a(p);(!t.nodePositionUpdate||!t.nodePositionUpdate(d?v.children[0]:v,{x:y.x,y:y.y,z:y.z},p)||d)&&(v.position.x=y.x,v.position.y=y.y||0,v.position.z=y.z||0)}});var s=ie(t.linkWidth),l=ie(t.linkCurvature),c=ie(t.linkCurveRotation),f=ie(t.linkThreeObjectExtend);t.linkDataMapper.entries().forEach(function(g){var h=rn(g,2),p=h[0],v=h[1];if(v){var y=n?p:t.layout.getLinkPosition(t.layout.graph.getLink(p.source,p.target).id),d=y[n?"source":"from"],b=y[n?"target":"to"];if(!(!d||!b||!d.hasOwnProperty("x")||!b.hasOwnProperty("x"))){u(p);var m=f(p);if(!(t.linkPositionUpdate&&t.linkPositionUpdate(m?v.children[1]:v,{start:{x:d.x,y:d.y,z:d.z},end:{x:b.x,y:b.y,z:b.z}},p)&&!m)){var x=30,w=p.__curve,_=v.children.length?v.children[0]:v;if(_.type==="Line"){if(w){var C=w.getPoints(x);_.geometry.getAttribute("position").array.length!==C.length*3&&_.geometry[mr]("position",new Q.BufferAttribute(new Float32Array(C.length*3),3)),_.geometry.setFromPoints(C)}else{var k=_.geometry.getAttribute("position");(!k||!k.array||k.array.length!==6)&&_.geometry[mr]("position",k=new Q.BufferAttribute(new Float32Array(2*3),3)),k.array[0]=d.x,k.array[1]=d.y||0,k.array[2]=d.z||0,k.array[3]=b.x,k.array[4]=b.y||0,k.array[5]=b.z||0,k.needsUpdate=!0}_.geometry.computeBoundingSphere()}else if(_.type==="Mesh")if(w){_.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(_.position.set(0,0,0),_.rotation.set(0,0,0),_.scale.set(1,1,1));var O=Math.ceil(s(p)*10)/10,L=O/2,U=new Q.TubeGeometry(w,x,L,t.linkResolution,!1);_.geometry.dispose(),_.geometry=U}else{if(!_.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var P=Math.ceil(s(p)*10)/10,M=P/2,N=new Q.CylinderGeometry(M,M,1,t.linkResolution,1,!1);N[Cn](new Q.Matrix4().makeTranslation(0,1/2,0)),N[Cn](new Q.Matrix4().makeRotationX(Math.PI/2)),_.geometry.dispose(),_.geometry=N}var E=new Q.Vector3(d.x,d.y||0,d.z||0),B=new Q.Vector3(b.x,b.y||0,b.z||0),S=E.distanceTo(B);_.position.x=E.x,_.position.y=E.y,_.position.z=E.z,_.scale.z=S,_.parent.localToWorld(B),_.lookAt(B)}}}}});function u(g){var h=n?g:t.layout.getLinkPosition(t.layout.graph.getLink(g.source,g.target).id),p=h[n?"source":"from"],v=h[n?"target":"to"];if(!(!p||!v||!p.hasOwnProperty("x")||!v.hasOwnProperty("x"))){var y=l(g);if(!y)g.__curve=null;else{var d=new Q.Vector3(p.x,p.y||0,p.z||0),b=new Q.Vector3(v.x,v.y||0,v.z||0),m=d.distanceTo(b),x,w=c(g);if(m>0){var _=v.x-p.x,k=v.y-p.y||0,C=new Q.Vector3().subVectors(b,d),P=C.clone().multiplyScalar(y).cross(_!==0||k!==0?new Q.Vector3(0,0,1):new Q.Vector3(0,1,0)).applyAxisAngle(C.normalize(),w).add(new Q.Vector3().addVectors(d,b).divideScalar(2));x=new Q.QuadraticBezierCurve3(d,P,b)}else{var M=y*70,N=-w,E=N+Math.PI/2;x=new Q.CubicBezierCurve3(d,new Q.Vector3(M*Math.cos(E),M*Math.sin(E),0).add(d),new Q.Vector3(M*Math.cos(N),M*Math.sin(N),0).add(d),b)}g.__curve=x}}}}function i(){var a=ie(t.linkDirectionalArrowRelPos),s=ie(t.linkDirectionalArrowLength),l=ie(t.nodeVal);t.arrowDataMapper.entries().forEach(function(c){var f=rn(c,2),u=f[0],g=f[1];if(g){var h=n?u:t.layout.getLinkPosition(t.layout.graph.getLink(u.source,u.target).id),p=h[n?"source":"from"],v=h[n?"target":"to"];if(!(!p||!v||!p.hasOwnProperty("x")||!v.hasOwnProperty("x"))){var y=Math.cbrt(Math.max(0,l(p)||1))*t.nodeRelSize,d=Math.cbrt(Math.max(0,l(v)||1))*t.nodeRelSize,b=s(u),m=a(u),x=u.__curve?function(M){return u.__curve.getPoint(M)}:function(M){var N=function(B,S,O,L){return S[B]+(O[B]-S[B])*L||0};return{x:N("x",p,v,M),y:N("y",p,v,M),z:N("z",p,v,M)}},w=u.__curve?u.__curve.getLength():Math.sqrt(["x","y","z"].map(function(M){return Math.pow((v[M]||0)-(p[M]||0),2)}).reduce(function(M,N){return M+N},0)),_=y+b+(w-y-d-b)*m,k=x(_/w),C=x((_-b)/w);["x","y","z"].forEach(function(M){return g.position[M]=C[M]});var P=Ta(Q.Vector3,Xe(["x","y","z"].map(function(M){return k[M]})));g.parent.localToWorld(P),g.lookAt(P)}}})}function o(){var a=ie(t.linkDirectionalParticleSpeed),s=ie(t.linkDirectionalParticleOffset);t.graphData.links.forEach(function(l){var c=t.particlesDataMapper.getObj(l),f=c&&c.children,u=l.__singleHopPhotonsObj&&l.__singleHopPhotonsObj.children;if(!((!u||!u.length)&&(!f||!f.length))){var g=n?l:t.layout.getLinkPosition(t.layout.graph.getLink(l.source,l.target).id),h=g[n?"source":"from"],p=g[n?"target":"to"];if(!(!h||!p||!h.hasOwnProperty("x")||!p.hasOwnProperty("x"))){var v=a(l),y=Math.abs(s(l)),d=l.__curve?function(m){return l.__curve.getPoint(m)}:function(m){var x=function(_,k,C,P){return k[_]+(C[_]-k[_])*P||0};return{x:x("x",h,p,m),y:x("y",h,p,m),z:x("z",h,p,m)}},b=[].concat(Xe(f||[]),Xe(u||[]));b.forEach(function(m,x){var w=m.parent.__linkThreeObjType==="singleHopPhotons";if(m.hasOwnProperty("__progressRatio")||(m.__progressRatio=w?v<0?1:0:(x+y)/f.length),m.__progressRatio+=v,m.__progressRatio>=1||m.__progressRatio<0)if(!w)m.__progressRatio=m.__progressRatio%1,m.__progressRatio<0&&m.__progressRatio++;else{m.parent.remove(m),Mo(m);return}var _=m.__progressRatio,k=d(_);m.geometry.type!=="SphereGeometry"&&m.lookAt(k.x,k.y,k.z),["x","y","z"].forEach(function(C){return m.position[C]=k[C]})})}}})}},emitParticle:function(t,n){if(n&&t.graphData.links.includes(n)){if(!n.__singleHopPhotonsObj){var r=new Q.Group;r.__linkThreeObjType="singleHopPhotons",n.__singleHopPhotonsObj=r,t.graphScene.add(r)}var i=ie(t.linkDirectionalParticleThreeObject)(n);if(i&&t.linkDirectionalParticleThreeObject===i&&(i=i.clone()),!i){var o=ie(t.linkDirectionalParticleWidth),a=Math.ceil(o(n)*10)/10/2,s=t.linkDirectionalParticleResolution,l=new Q.SphereGeometry(a,s,s),c=ie(t.linkColor),f=ie(t.linkDirectionalParticleColor),u=f(n)||c(n)||"#f0f0f0",g=new Q.Color(Kt(u)),h=t.linkOpacity*3,p=new Q.MeshLambertMaterial({color:g,transparent:!0,opacity:h});i=new Q.Mesh(l,p)}n.__singleHopPhotonsObj.add(i)}return this},getGraphBbox:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0};if(!t.initialised)return null;var r=function i(o){var a=[];if(o.geometry){o.geometry.computeBoundingBox();var s=new Q.Box3;s.copy(o.geometry.boundingBox).applyMatrix4(o.matrixWorld),a.push(s)}return a.concat.apply(a,Xe((o.children||[]).filter(function(l){return!l.hasOwnProperty("__graphObjType")||l.__graphObjType==="node"&&n(l.__data)}).map(i)))}(t.graphScene);return r.length?Object.assign.apply(Object,Xe(["x","y","z"].map(function(i){return Un({},i,[Ku(r,function(o){return o.min[i]}),Yu(r,function(o){return o.max[i]})])}))):null}},stateInit:function(){return{d3ForceLayout:kc().force("link",lc()).force("charge",Cc()).force("center",cl()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(t,n){n.graphScene=t,n.nodeDataMapper=new Yt(t,{objBindAttr:"__threeObj"}),n.linkDataMapper=new Yt(t,{objBindAttr:"__lineObj"}),n.arrowDataMapper=new Yt(t,{objBindAttr:"__arrowObj"}),n.particlesDataMapper=new Yt(t,{objBindAttr:"__photonsObj"})},update:function(t,n){var r=function(H){return H.some(function(z){return n.hasOwnProperty(z)})};if(t.engineRunning=!1,typeof t.onUpdate=="function"&&t.onUpdate(),t.nodeAutoColorBy!==null&&r(["nodeAutoColorBy","graphData","nodeColor"])&&Po(t.graphData.nodes,ie(t.nodeAutoColorBy),t.nodeColor),t.linkAutoColorBy!==null&&r(["linkAutoColorBy","graphData","linkColor"])&&Po(t.graphData.links,ie(t.linkAutoColorBy),t.linkColor),t._flushObjects||r(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var i=ie(t.nodeThreeObject),o=ie(t.nodeThreeObjectExtend),a=ie(t.nodeVal),s=ie(t.nodeColor),l=ie(t.nodeVisibility),c={},f={};(t._flushObjects||r(["nodeThreeObject","nodeThreeObjectExtend"]))&&t.nodeDataMapper.clear(),t.nodeDataMapper.onCreateObj(function(I){var H=i(I),z=o(I);H&&t.nodeThreeObject===H&&(H=H.clone());var F;return H&&!z?F=H:(F=new Q.Mesh,F.__graphDefaultObj=!0,H&&z&&F.add(H)),F.__graphObjType="node",F}).onUpdateObj(function(I,H){if(I.__graphDefaultObj){var z=a(H)||1,F=Math.cbrt(z)*t.nodeRelSize,R=t.nodeResolution;(!I.geometry.type.match(/^Sphere(Buffer)?Geometry$/)||I.geometry.parameters.radius!==F||I.geometry.parameters.widthSegments!==R)&&(c.hasOwnProperty(z)||(c[z]=new Q.SphereGeometry(F,R,R)),I.geometry.dispose(),I.geometry=c[z]);var q=s(H),V=new Q.Color(Kt(q||"#ffffaa")),re=t.nodeOpacity*yr(q);(I.material.type!=="MeshLambertMaterial"||!I.material.color.equals(V)||I.material.opacity!==re)&&(f.hasOwnProperty(q)||(f[q]=new Q.MeshLambertMaterial({color:V,transparent:!0,opacity:re})),I.material.dispose(),I.material=f[q])}}).digest(t.graphData.nodes.filter(l))}if(t._flushObjects||r(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject"])){var u=ie(t.linkThreeObject),g=ie(t.linkThreeObjectExtend),h=ie(t.linkMaterial),p=ie(t.linkVisibility),v=ie(t.linkColor),y=ie(t.linkWidth),d={},b={},m={},x=t.graphData.links.filter(p);if((t._flushObjects||r(["linkThreeObject","linkThreeObjectExtend","linkWidth"]))&&t.linkDataMapper.clear(),t.linkDataMapper.onRemoveObj(function(I){var H=I.__data&&I.__data.__singleHopPhotonsObj;H&&(H.parent.remove(H),Mo(H),delete I.__data.__singleHopPhotonsObj)}).onCreateObj(function(I){var H=u(I),z=g(I);H&&t.linkThreeObject===H&&(H=H.clone());var F;if(!H||z){var R=!!y(I);if(R)F=new Q.Mesh;else{var q=new Q.BufferGeometry;q[mr]("position",new Q.BufferAttribute(new Float32Array(2*3),3)),F=new Q.Line(q)}}var V;return H?z?(V=new Q.Group,V.__graphDefaultObj=!0,V.add(F),V.add(H)):V=H:(V=F,V.__graphDefaultObj=!0),V.renderOrder=10,V.__graphObjType="link",V}).onUpdateObj(function(I,H){if(I.__graphDefaultObj){var z=I.children.length?I.children[0]:I,F=Math.ceil(y(H)*10)/10,R=!!F;if(R){var q=F/2,V=t.linkResolution;if(!z.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||z.geometry.parameters.radiusTop!==q||z.geometry.parameters.radialSegments!==V){if(!d.hasOwnProperty(F)){var re=new Q.CylinderGeometry(q,q,1,V,1,!1);re[Cn](new Q.Matrix4().makeTranslation(0,1/2,0)),re[Cn](new Q.Matrix4().makeRotationX(Math.PI/2)),d[F]=re}z.geometry.dispose(),z.geometry=d[F]}}var le=h(H);if(le)z.material=le;else{var ce=v(H),Se=new Q.Color(Kt(ce||"#f0f0f0")),me=t.linkOpacity*yr(ce),Te=R?"MeshLambertMaterial":"LineBasicMaterial";if(z.material.type!==Te||!z.material.color.equals(Se)||z.material.opacity!==me){var ze=R?b:m;ze.hasOwnProperty(ce)||(ze[ce]=new Q[Te]({color:Se,transparent:me<1,opacity:me,depthWrite:me>=1})),z.material.dispose(),z.material=ze[ce]}}}}).digest(x),t.linkDirectionalArrowLength||n.hasOwnProperty("linkDirectionalArrowLength")){var w=ie(t.linkDirectionalArrowLength),_=ie(t.linkDirectionalArrowColor);t.arrowDataMapper.onCreateObj(function(){var I=new Q.Mesh(void 0,new Q.MeshLambertMaterial({transparent:!0}));return I.__linkThreeObjType="arrow",I}).onUpdateObj(function(I,H){var z=w(H),F=t.linkDirectionalArrowResolution;if(!I.geometry.type.match(/^Cone(Buffer)?Geometry$/)||I.geometry.parameters.height!==z||I.geometry.parameters.radialSegments!==F){var R=new Q.ConeGeometry(z*.25,z,F);R.translate(0,z/2,0),R.rotateX(Math.PI/2),I.geometry.dispose(),I.geometry=R}var q=_(H)||v(H)||"#f0f0f0";I.material.color=new Q.Color(Kt(q)),I.material.opacity=t.linkOpacity*3*yr(q)}).digest(x.filter(w))}if(t.linkDirectionalParticles||n.hasOwnProperty("linkDirectionalParticles")){var k=ie(t.linkDirectionalParticles),C=ie(t.linkDirectionalParticleWidth),P=ie(t.linkDirectionalParticleColor),M=ie(t.linkDirectionalParticleThreeObject),N={},E={};t.particlesDataMapper.onCreateObj(function(){var I=new Q.Group;return I.__linkThreeObjType="photons",I.__photonDataMapper=new Yt(I),I}).onUpdateObj(function(I,H){var z=!!I.children.length&&I.children[0],F=M(H),R,q;if(F)R=F.geometry,q=F.material;else{var V=Math.ceil(C(H)*10)/10/2,re=t.linkDirectionalParticleResolution;z&&z.geometry.parameters.radius===V&&z.geometry.parameters.widthSegments===re?R=z.geometry:(E.hasOwnProperty(V)||(E[V]=new Q.SphereGeometry(V,re,re)),R=E[V]);var le=P(H)||v(H)||"#f0f0f0",ce=new Q.Color(Kt(le)),Se=t.linkOpacity*3;z&&z.material.color.equals(ce)&&z.material.opacity===Se?q=z.material:(N.hasOwnProperty(le)||(N[le]=new Q.MeshLambertMaterial({color:ce,transparent:!0,opacity:Se})),q=N[le])}z&&(z.geometry!==R&&z.geometry.dispose(),z.material!==q&&z.material.dispose());var me=Math.round(Math.abs(k(H)));I.__photonDataMapper.id(function(Te){return Te.idx}).onCreateObj(function(){return new Q.Mesh(R,q)}).onUpdateObj(function(Te){Te.geometry=R,Te.material=q}).digest(Xe(new Array(me)).map(function(Te,ze){return{idx:ze}}))}).digest(x.filter(k))}}if(t._flushObjects=!1,r(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach(function(I){I.source=I[t.linkSource],I.target=I[t.linkTarget]});var B=t.forceEngine!=="ngraph",S;if(B){(S=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var O=t.d3ForceLayout.force("link");O&&O.id(function(I){return I[t.nodeId]}).links(t.graphData.links);var L=t.dagMode&&ed(t.graphData,function(I){return I[t.nodeId]},{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),U=Math.max.apply(Math,Xe(Object.values(L||[]))),ne=t.dagLevelDistance||t.graphData.nodes.length/(U||1)*td*(["radialin","radialout"].indexOf(t.dagMode)!==-1?.7:1);if(["lr","rl","td","bu","zin","zout"].includes(n.dagMode)){var J=["lr","rl"].includes(n.dagMode)?"fx":["td","bu"].includes(n.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(I){return delete I[J]})}if(["lr","rl","td","bu","zin","zout"].includes(t.dagMode)){var se=["rl","td","zout"].includes(t.dagMode),D=function(H){return(L[H[t.nodeId]]-U/2)*ne*(se?-1:1)},$=["lr","rl"].includes(t.dagMode)?"fx":["td","bu"].includes(t.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(I){return I[$]=D(I)})}t.d3ForceLayout.force("dagRadial",["radialin","radialout"].indexOf(t.dagMode)!==-1?Sc(function(I){var H=L[I[t.nodeId]]||-1;return(t.dagMode==="radialin"?U-H:H)*ne}).strength(function(I){return t.dagNodeFilter(I)?1:0}):null)}else{var G=Oo.graph();t.graphData.nodes.forEach(function(I){G.addNode(I[t.nodeId])}),t.graphData.links.forEach(function(I){G.addLink(I.source,I.target)}),S=Oo.forcelayout(G,Yf({dimensions:t.numDimensions},t.ngraphPhysics)),S.graph=G}for(var Z=0;Z<t.warmupTicks&&!(B&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);Z++)S[B?"tick":"step"]();t.layout=S,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}});function rd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=function(i){function o(){var a;ja(this,o);for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return a=Aa(this,o,[].concat(l)),a.__kapsuleInstance=Ta(e,[].concat(Xe(n?[a]:[]),l)),a}return La(o,i),Ea(o)}(t);return Object.keys(e()).forEach(function(i){return r.prototype[i]=function(){var o,a=(o=this.__kapsuleInstance)[i].apply(o,arguments);return a===this.__kapsuleInstance?this:a}}),r}var id=window.THREE?window.THREE:{Group:K.Group},Da=rd(nd,id.Group,!0);function Le(){return Le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Le.apply(null,arguments)}function od(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ln(e,t){return ln=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},ln(e,t)}function ad(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ln(e,t)}function Er(e){return Er=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Er(e)}function sd(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function za(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(za=function(){return!!e})()}function ld(e,t,n){if(za())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&ln(i,n.prototype),i}function Lr(e){var t=typeof Map=="function"?new Map:void 0;return Lr=function(r){if(r===null||!sd(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(r))return t.get(r);t.set(r,i)}function i(){return ld(r,arguments,Er(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ln(i,r)},Lr(e)}var cd={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
|
|
508
|
+
|
|
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
|
+
|
|
511
|
+
`,3:`Passed an incorrect argument to a color function, please pass a string representation of a color.
|
|
512
|
+
|
|
513
|
+
`,4:`Couldn't generate valid rgb string from %s, it returned %s.
|
|
514
|
+
|
|
515
|
+
`,5:`Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.
|
|
516
|
+
|
|
517
|
+
`,6:`Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).
|
|
518
|
+
|
|
519
|
+
`,7:`Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).
|
|
520
|
+
|
|
521
|
+
`,8:`Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.
|
|
522
|
+
|
|
523
|
+
`,9:`Please provide a number of steps to the modularScale helper.
|
|
524
|
+
|
|
525
|
+
`,10:`Please pass a number or one of the predefined scales to the modularScale helper as the ratio.
|
|
526
|
+
|
|
527
|
+
`,11:`Invalid value passed as base to modularScale, expected number or em string but got "%s"
|
|
528
|
+
|
|
529
|
+
`,12:`Expected a string ending in "px" or a number passed as the first argument to %s(), got "%s" instead.
|
|
530
|
+
|
|
531
|
+
`,13:`Expected a string ending in "px" or a number passed as the second argument to %s(), got "%s" instead.
|
|
532
|
+
|
|
533
|
+
`,14:`Passed invalid pixel value ("%s") to %s(), please pass a value like "12px" or 12.
|
|
534
|
+
|
|
535
|
+
`,15:`Passed invalid base value ("%s") to %s(), please pass a value like "12px" or 12.
|
|
536
|
+
|
|
537
|
+
`,16:`You must provide a template to this method.
|
|
538
|
+
|
|
539
|
+
`,17:`You passed an unsupported selector state to this method.
|
|
540
|
+
|
|
541
|
+
`,18:`minScreen and maxScreen must be provided as stringified numbers with the same units.
|
|
542
|
+
|
|
543
|
+
`,19:`fromSize and toSize must be provided as stringified numbers with the same units.
|
|
544
|
+
|
|
545
|
+
`,20:`expects either an array of objects or a single object with the properties prop, fromSize, and toSize.
|
|
546
|
+
|
|
547
|
+
`,21:"expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",22:"expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",23:`fontFace expects a name of a font-family.
|
|
548
|
+
|
|
549
|
+
`,24:`fontFace expects either the path to the font file(s) or a name of a local copy.
|
|
550
|
+
|
|
551
|
+
`,25:`fontFace expects localFonts to be an array.
|
|
552
|
+
|
|
553
|
+
`,26:`fontFace expects fileFormats to be an array.
|
|
554
|
+
|
|
555
|
+
`,27:`radialGradient requries at least 2 color-stops to properly render.
|
|
556
|
+
|
|
557
|
+
`,28:`Please supply a filename to retinaImage() as the first argument.
|
|
558
|
+
|
|
559
|
+
`,29:`Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.
|
|
560
|
+
|
|
561
|
+
`,30:"Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",31:`The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation
|
|
562
|
+
|
|
563
|
+
`,32:`To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])
|
|
564
|
+
To pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')
|
|
565
|
+
|
|
566
|
+
`,33:`The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation
|
|
567
|
+
|
|
568
|
+
`,34:`borderRadius expects a radius value as a string or number as the second argument.
|
|
569
|
+
|
|
570
|
+
`,35:`borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.
|
|
571
|
+
|
|
572
|
+
`,36:`Property must be a string value.
|
|
573
|
+
|
|
574
|
+
`,37:`Syntax Error at %s.
|
|
575
|
+
|
|
576
|
+
`,38:`Formula contains a function that needs parentheses at %s.
|
|
577
|
+
|
|
578
|
+
`,39:`Formula is missing closing parenthesis at %s.
|
|
579
|
+
|
|
580
|
+
`,40:`Formula has too many closing parentheses at %s.
|
|
581
|
+
|
|
582
|
+
`,41:`All values in a formula must have the same unit or be unitless.
|
|
583
|
+
|
|
584
|
+
`,42:`Please provide a number of steps to the modularScale helper.
|
|
585
|
+
|
|
586
|
+
`,43:`Please pass a number or one of the predefined scales to the modularScale helper as the ratio.
|
|
587
|
+
|
|
588
|
+
`,44:`Invalid value passed as base to modularScale, expected number or em/rem string but got %s.
|
|
589
|
+
|
|
590
|
+
`,45:`Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.
|
|
591
|
+
|
|
592
|
+
`,46:`Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.
|
|
593
|
+
|
|
594
|
+
`,47:`minScreen and maxScreen must be provided as stringified numbers with the same units.
|
|
595
|
+
|
|
596
|
+
`,48:`fromSize and toSize must be provided as stringified numbers with the same units.
|
|
597
|
+
|
|
598
|
+
`,49:`Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.
|
|
599
|
+
|
|
600
|
+
`,50:`Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.
|
|
601
|
+
|
|
602
|
+
`,51:`Expects the first argument object to have the properties prop, fromSize, and toSize.
|
|
603
|
+
|
|
604
|
+
`,52:`fontFace expects either the path to the font file(s) or a name of a local copy.
|
|
605
|
+
|
|
606
|
+
`,53:`fontFace expects localFonts to be an array.
|
|
607
|
+
|
|
608
|
+
`,54:`fontFace expects fileFormats to be an array.
|
|
609
|
+
|
|
610
|
+
`,55:`fontFace expects a name of a font-family.
|
|
611
|
+
|
|
612
|
+
`,56:`linearGradient requries at least 2 color-stops to properly render.
|
|
613
|
+
|
|
614
|
+
`,57:`radialGradient requries at least 2 color-stops to properly render.
|
|
615
|
+
|
|
616
|
+
`,58:`Please supply a filename to retinaImage() as the first argument.
|
|
617
|
+
|
|
618
|
+
`,59:`Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.
|
|
619
|
+
|
|
620
|
+
`,60:"Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",61:`Property must be a string value.
|
|
621
|
+
|
|
622
|
+
`,62:`borderRadius expects a radius value as a string or number as the second argument.
|
|
623
|
+
|
|
624
|
+
`,63:`borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.
|
|
625
|
+
|
|
626
|
+
`,64:`The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.
|
|
627
|
+
|
|
628
|
+
`,65:`To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').
|
|
629
|
+
|
|
630
|
+
`,66:`The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.
|
|
631
|
+
|
|
632
|
+
`,67:`You must provide a template to this method.
|
|
633
|
+
|
|
634
|
+
`,68:`You passed an unsupported selector state to this method.
|
|
635
|
+
|
|
636
|
+
`,69:`Expected a string ending in "px" or a number passed as the first argument to %s(), got %s instead.
|
|
637
|
+
|
|
638
|
+
`,70:`Expected a string ending in "px" or a number passed as the second argument to %s(), got %s instead.
|
|
639
|
+
|
|
640
|
+
`,71:`Passed invalid pixel value %s to %s(), please pass a value like "12px" or 12.
|
|
641
|
+
|
|
642
|
+
`,72:`Passed invalid base value %s to %s(), please pass a value like "12px" or 12.
|
|
643
|
+
|
|
644
|
+
`,73:`Please provide a valid CSS variable.
|
|
645
|
+
|
|
646
|
+
`,74:`CSS variable not found and no default was provided.
|
|
647
|
+
|
|
648
|
+
`,75:`important requires a valid style object, got a %s instead.
|
|
649
|
+
|
|
650
|
+
`,76:`fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.
|
|
651
|
+
|
|
652
|
+
`,77:`remToPx expects a value in "rem" but you provided it in "%s".
|
|
653
|
+
|
|
654
|
+
`,78:`base must be set in "px" or "%" but you set it in "%s".
|
|
655
|
+
`};function ud(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t[0],i=[],o;for(o=1;o<t.length;o+=1)i.push(t[o]);return i.forEach(function(a){r=r.replace(/%[a-z]/,a)}),r}var Qe=function(e){ad(t,e);function t(n){var r;if(process.env.NODE_ENV==="production")r=e.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+n+" for more information.")||this;else{for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];r=e.call(this,ud.apply(void 0,[cd[n]].concat(o)))||this}return od(r)}return t}(Lr(Error));function br(e){return Math.round(e*255)}function fd(e,t,n){return br(e)+","+br(t)+","+br(n)}function Ln(e,t,n,r){if(r===void 0&&(r=fd),t===0)return r(n,n,n);var i=(e%360+360)%360/60,o=(1-Math.abs(2*n-1))*t,a=o*(1-Math.abs(i%2-1)),s=0,l=0,c=0;i>=0&&i<1?(s=o,l=a):i>=1&&i<2?(s=a,l=o):i>=2&&i<3?(l=o,c=a):i>=3&&i<4?(l=a,c=o):i>=4&&i<5?(s=a,c=o):i>=5&&i<6&&(s=o,c=a);var f=n-o/2,u=s+f,g=l+f,h=c+f;return r(u,g,h)}var Ao={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function dd(e){if(typeof e!="string")return e;var t=e.toLowerCase();return Ao[t]?"#"+Ao[t]:e}var hd=/^#[a-fA-F0-9]{6}$/,pd=/^#[a-fA-F0-9]{8}$/,gd=/^#[a-fA-F0-9]{3}$/,vd=/^#[a-fA-F0-9]{4}$/,_r=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,yd=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,md=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,bd=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function Rt(e){if(typeof e!="string")throw new Qe(3);var t=dd(e);if(t.match(hd))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(pd)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(gd))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(vd)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var i=_r.exec(t);if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10)};var o=yd.exec(t.substring(0,50));if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10),alpha:parseFloat(""+o[4])>1?parseFloat(""+o[4])/100:parseFloat(""+o[4])};var a=md.exec(t);if(a){var s=parseInt(""+a[1],10),l=parseInt(""+a[2],10)/100,c=parseInt(""+a[3],10)/100,f="rgb("+Ln(s,l,c)+")",u=_r.exec(f);if(!u)throw new Qe(4,t,f);return{red:parseInt(""+u[1],10),green:parseInt(""+u[2],10),blue:parseInt(""+u[3],10)}}var g=bd.exec(t.substring(0,50));if(g){var h=parseInt(""+g[1],10),p=parseInt(""+g[2],10)/100,v=parseInt(""+g[3],10)/100,y="rgb("+Ln(h,p,v)+")",d=_r.exec(y);if(!d)throw new Qe(4,t,y);return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10),alpha:parseFloat(""+g[4])>1?parseFloat(""+g[4])/100:parseFloat(""+g[4])}}throw new Qe(5)}function _d(e){var t=e.red/255,n=e.green/255,r=e.blue/255,i=Math.max(t,n,r),o=Math.min(t,n,r),a=(i+o)/2;if(i===o)return e.alpha!==void 0?{hue:0,saturation:0,lightness:a,alpha:e.alpha}:{hue:0,saturation:0,lightness:a};var s,l=i-o,c=a>.5?l/(2-i-o):l/(i+o);switch(i){case t:s=(n-r)/l+(n<r?6:0);break;case n:s=(r-t)/l+2;break;default:s=(t-n)/l+4;break}return s*=60,e.alpha!==void 0?{hue:s,saturation:c,lightness:a,alpha:e.alpha}:{hue:s,saturation:c,lightness:a}}function dt(e){return _d(Rt(e))}var xd=function(t){return t.length===7&&t[1]===t[2]&&t[3]===t[4]&&t[5]===t[6]?"#"+t[1]+t[3]+t[5]:t},Nr=xd;function mt(e){var t=e.toString(16);return t.length===1?"0"+t:t}function xr(e){return mt(Math.round(e*255))}function wd(e,t,n){return Nr("#"+xr(e)+xr(t)+xr(n))}function Fa(e,t,n){return Ln(e,t,n,wd)}function kd(e,t,n){if(typeof e=="object"&&t===void 0&&n===void 0)return Fa(e.hue,e.saturation,e.lightness);throw new Qe(1)}function Cd(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?Fa(e.hue,e.saturation,e.lightness):"rgba("+Ln(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new Qe(2)}function Ba(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return Nr("#"+mt(e)+mt(t)+mt(n));if(typeof e=="object"&&t===void 0&&n===void 0)return Nr("#"+mt(e.red)+mt(e.green)+mt(e.blue));throw new Qe(6)}function qn(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?Ba(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new Qe(7)}var Sd=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Md=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&typeof t.alpha=="number"},Pd=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Od=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&typeof t.alpha=="number"};function ht(e){if(typeof e!="object")throw new Qe(8);if(Md(e))return qn(e);if(Sd(e))return Ba(e);if(Od(e))return Cd(e);if(Pd(e))return kd(e);throw new Qe(8)}function $a(e,t,n){return function(){var i=n.concat(Array.prototype.slice.call(arguments));return i.length>=t?e.apply(this,i):$a(e,t,i)}}function De(e){return $a(e,e.length,[])}function Ad(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{hue:n.hue+parseFloat(e)}))}De(Ad);function Ft(e,t,n){return Math.max(e,Math.min(t,n))}function jd(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{lightness:Ft(0,1,n.lightness-parseFloat(e))}))}De(jd);function Td(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{saturation:Ft(0,1,n.saturation-parseFloat(e))}))}De(Td);function Ed(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{lightness:Ft(0,1,n.lightness+parseFloat(e))}))}De(Ed);function Ld(e,t,n){if(t==="transparent")return n;if(n==="transparent")return t;if(e===0)return n;var r=Rt(t),i=Le({},r,{alpha:typeof r.alpha=="number"?r.alpha:1}),o=Rt(n),a=Le({},o,{alpha:typeof o.alpha=="number"?o.alpha:1}),s=i.alpha-a.alpha,l=parseFloat(e)*2-1,c=l*s===-1?l:l+s,f=1+l*s,u=(c/f+1)/2,g=1-u,h={red:Math.floor(i.red*u+a.red*g),green:Math.floor(i.green*u+a.green*g),blue:Math.floor(i.blue*u+a.blue*g),alpha:i.alpha*parseFloat(e)+a.alpha*(1-parseFloat(e))};return qn(h)}var Nd=De(Ld),Ha=Nd;function Rd(e,t){if(t==="transparent")return t;var n=Rt(t),r=typeof n.alpha=="number"?n.alpha:1,i=Le({},n,{alpha:Ft(0,1,(r*100+parseFloat(e)*100)/100)});return qn(i)}var Id=De(Rd),Dd=Id;function zd(e,t){if(t==="transparent")return t;var n=dt(t);return ht(Le({},n,{saturation:Ft(0,1,n.saturation+parseFloat(e))}))}De(zd);function Fd(e,t){return t==="transparent"?t:ht(Le({},dt(t),{hue:parseFloat(e)}))}De(Fd);function Bd(e,t){return t==="transparent"?t:ht(Le({},dt(t),{lightness:parseFloat(e)}))}De(Bd);function $d(e,t){return t==="transparent"?t:ht(Le({},dt(t),{saturation:parseFloat(e)}))}De($d);function Hd(e,t){return t==="transparent"?t:Ha(parseFloat(e),"rgb(0, 0, 0)",t)}De(Hd);function Ud(e,t){return t==="transparent"?t:Ha(parseFloat(e),"rgb(255, 255, 255)",t)}De(Ud);function qd(e,t){if(t==="transparent")return t;var n=Rt(t),r=typeof n.alpha=="number"?n.alpha:1,i=Le({},n,{alpha:Ft(0,1,+(r*100-parseFloat(e)*100).toFixed(2)/100)});return qn(i)}De(qd);var bt=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-bt.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?bt.Bounce.In(e*2)*.5:bt.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),nn=function(){return performance.now()},Ua=function(){function e(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(n){return t._tweens[n]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i=0,o=n;i<o.length;i++){var a=o[i];(t=a._group)===null||t===void 0||t.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},e.prototype.remove=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,i=t;r<i.length;r++){var o=i[r];o._group=void 0,delete this._tweens[o.getId()],delete this._tweensAddedDuringUpdate[o.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},e.prototype.update=function(t,n){t===void 0&&(t=nn()),n===void 0&&(n=!0);var r=Object.keys(this._tweens);if(r.length!==0)for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<r.length;i++){var o=this._tweens[r[i]],a=!n;o&&o.update(t,a)===!1&&!n&&this.remove(o)}r=Object.keys(this._tweensAddedDuringUpdate)}},e}(),Rr={Linear:function(e,t){var n=e.length-1,r=n*t,i=Math.floor(r),o=Rr.Utils.Linear;return t<0?o(e[0],e[1],r):t>1?o(e[n],e[n-1],n-r):o(e[i],e[i+1>n?n:i+1],r-i)},Utils:{Linear:function(e,t,n){return(t-e)*n+e}}},qa=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Ir=new Ua,jo=function(){function e(t,n){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=bt.Linear.None,this._interpolationFunction=Rr.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=qa.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof n=="object"?(this._group=n,n.add(this)):n===!0&&(this._group=Ir,Ir.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,n){if(n===void 0&&(n=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=n<0?0:n,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,n){if(t===void 0&&(t=nn()),n===void 0&&(n=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||n){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var o in this._valuesEnd)i[o]=this._valuesEnd[o];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,n)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,n,r,i,o){for(var a in r){var s=t[a],l=Array.isArray(s),c=l?"array":typeof s,f=!l&&Array.isArray(r[a]);if(!(c==="undefined"||c==="function")){if(f){var u=r[a];if(u.length===0)continue;for(var g=[s],h=0,p=u.length;h<p;h+=1){var v=this._handleRelativeValue(s,u[h]);if(isNaN(v)){f=!1,console.warn("Found invalid interpolation list. Skipping.");break}g.push(v)}f&&(r[a]=g)}if((c==="object"||l)&&s&&!f){n[a]=l?[]:{};var y=s;for(var d in y)n[a][d]=y[d];i[a]=l?[]:{};var u=r[a];if(!this._isDynamic){var b={};for(var d in u)b[d]=u[d];r[a]=u=b}this._setupProperties(y,n[a],u,i[a],o)}else(typeof n[a]>"u"||o)&&(n[a]=s),l||(n[a]*=1),f?i[a]=r[a].slice().reverse():i[a]=n[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(t){return t===void 0&&(t=nn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=nn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,n=this._chainedTweens.length;t<n;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},e.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},e.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},e.prototype.easing=function(t){return t===void 0&&(t=bt.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=Rr.Linear),this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,n){var r=this,i;if(t===void 0&&(t=nn()),n===void 0&&(n=e.autoStartOnUpdate),this._isPaused)return!0;var o;if(!this._goToEnd&&!this._isPlaying)if(n)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=t-this._startTime,s=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),l=this._duration+this._repeat*s,c=function(){if(r._duration===0||a>l)return 1;var v=Math.trunc(a/s),y=a-v*s,d=Math.min(y/r._duration,1);return d===0&&a===r._duration?1:d},f=c(),u=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,u),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||a>=this._duration)if(this._repeat>0){var g=Math.min(Math.trunc((a-this._duration)/s)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=g);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=s*g,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var h=0,p=this._chainedTweens.length;h<p;h++)this._chainedTweens[h].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,n,r,i){for(var o in r)if(n[o]!==void 0){var a=n[o]||0,s=r[o],l=Array.isArray(t[o]),c=Array.isArray(s),f=!l&&c;f?t[o]=this._interpolationFunction(s,i):typeof s=="object"&&s?this._updateProperties(t[o],a,s,i):(s=this._handleRelativeValue(a,s),typeof s=="number"&&(t[o]=a+(s-a)*i))}},e.prototype._handleRelativeValue=function(t,n){return typeof n!="string"?n:n.charAt(0)==="+"||n.charAt(0)==="-"?t+parseFloat(n):parseFloat(n)},e.prototype._swapEndStartRepeatValues=function(t){var n=this._valuesStartRepeat[t],r=this._valuesEnd[t];typeof r=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(r):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=n},e.autoStartOnUpdate=!1,e}();qa.nextId;var Je=Ir;Je.getAll.bind(Je);Je.removeAll.bind(Je);Je.add.bind(Je);Je.remove.bind(Je);Je.update.bind(Je);var Dr="http://www.w3.org/1999/xhtml";const To={svg:"http://www.w3.org/2000/svg",xhtml:Dr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Va(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),To.hasOwnProperty(t)?{space:To[t],local:e}:e}function Vd(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Dr&&t.documentElement.namespaceURI===Dr?t.createElement(e):t.createElementNS(n,e)}}function Gd(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ga(e){var t=Va(e);return(t.local?Gd:Vd)(t)}function Wd(){}function Wa(e){return e==null?Wd:function(){return this.querySelector(e)}}function Xd(e){typeof e!="function"&&(e=Wa(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=new Array(a),l,c,f=0;f<a;++f)(l=o[f])&&(c=e.call(l,l.__data__,f,o))&&("__data__"in l&&(c.__data__=l.__data__),s[f]=c);return new Ve(r,this._parents)}function Yd(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Kd(){return[]}function Qd(e){return e==null?Kd:function(){return this.querySelectorAll(e)}}function Zd(e){return function(){return Yd(e.apply(this,arguments))}}function Jd(e){typeof e=="function"?e=Zd(e):e=Qd(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var a=t[o],s=a.length,l,c=0;c<s;++c)(l=a[c])&&(r.push(e.call(l,l.__data__,c,a)),i.push(l));return new Ve(r,i)}function eh(e){return function(){return this.matches(e)}}function Xa(e){return function(t){return t.matches(e)}}var th=Array.prototype.find;function nh(e){return function(){return th.call(this.children,e)}}function rh(){return this.firstElementChild}function ih(e){return this.select(e==null?rh:nh(typeof e=="function"?e:Xa(e)))}var oh=Array.prototype.filter;function ah(){return Array.from(this.children)}function sh(e){return function(){return oh.call(this.children,e)}}function lh(e){return this.selectAll(e==null?ah:sh(typeof e=="function"?e:Xa(e)))}function ch(e){typeof e!="function"&&(e=eh(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],a=o.length,s=r[i]=[],l,c=0;c<a;++c)(l=o[c])&&e.call(l,l.__data__,c,o)&&s.push(l);return new Ve(r,this._parents)}function Ya(e){return new Array(e.length)}function uh(){return new Ve(this._enter||this._groups.map(Ya),this._parents)}function Nn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Nn.prototype={constructor:Nn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function fh(e){return function(){return e}}function dh(e,t,n,r,i,o){for(var a=0,s,l=t.length,c=o.length;a<c;++a)(s=t[a])?(s.__data__=o[a],r[a]=s):n[a]=new Nn(e,o[a]);for(;a<l;++a)(s=t[a])&&(i[a]=s)}function hh(e,t,n,r,i,o,a){var s,l,c=new Map,f=t.length,u=o.length,g=new Array(f),h;for(s=0;s<f;++s)(l=t[s])&&(g[s]=h=a.call(l,l.__data__,s,t)+"",c.has(h)?i[s]=l:c.set(h,l));for(s=0;s<u;++s)h=a.call(e,o[s],s,o)+"",(l=c.get(h))?(r[s]=l,l.__data__=o[s],c.delete(h)):n[s]=new Nn(e,o[s]);for(s=0;s<f;++s)(l=t[s])&&c.get(g[s])===l&&(i[s]=l)}function ph(e){return e.__data__}function gh(e,t){if(!arguments.length)return Array.from(this,ph);var n=t?hh:dh,r=this._parents,i=this._groups;typeof e!="function"&&(e=fh(e));for(var o=i.length,a=new Array(o),s=new Array(o),l=new Array(o),c=0;c<o;++c){var f=r[c],u=i[c],g=u.length,h=vh(e.call(f,f&&f.__data__,c,r)),p=h.length,v=s[c]=new Array(p),y=a[c]=new Array(p),d=l[c]=new Array(g);n(f,u,v,y,d,h,t);for(var b=0,m=0,x,w;b<p;++b)if(x=v[b]){for(b>=m&&(m=b+1);!(w=y[m])&&++m<p;);x._next=w||null}}return a=new Ve(a,r),a._enter=s,a._exit=l,a}function vh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yh(){return new Ve(this._exit||this._groups.map(Ya),this._parents)}function mh(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function bh(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),l=0;l<a;++l)for(var c=n[l],f=r[l],u=c.length,g=s[l]=new Array(u),h,p=0;p<u;++p)(h=c[p]||f[p])&&(g[p]=h);for(;l<i;++l)s[l]=n[l];return new Ve(s,this._parents)}function _h(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],a;--i>=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function xh(e){e||(e=wh);function t(u,g){return u&&g?e(u.__data__,g.__data__):!u-!g}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a=n[o],s=a.length,l=i[o]=new Array(s),c,f=0;f<s;++f)(c=a[f])&&(l[f]=c);l.sort(t)}return new Ve(i,this._parents).order()}function wh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function kh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ch(){return Array.from(this)}function Sh(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null}function Mh(){let e=0;for(const t of this)++e;return e}function Ph(){return!this.node()}function Oh(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,a=i.length,s;o<a;++o)(s=i[o])&&e.call(s,s.__data__,o,i);return this}function Ah(e){return function(){this.removeAttribute(e)}}function jh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Th(e,t){return function(){this.setAttribute(e,t)}}function Eh(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Lh(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Nh(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Rh(e,t){var n=Va(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?jh:Ah:typeof t=="function"?n.local?Nh:Lh:n.local?Eh:Th)(n,t))}function Ka(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ih(e){return function(){this.style.removeProperty(e)}}function Dh(e,t,n){return function(){this.style.setProperty(e,t,n)}}function zh(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Fh(e,t,n){return arguments.length>1?this.each((t==null?Ih:typeof t=="function"?zh:Dh)(e,t,n??"")):Bh(this.node(),e)}function Bh(e,t){return e.style.getPropertyValue(t)||Ka(e).getComputedStyle(e,null).getPropertyValue(t)}function $h(e){return function(){delete this[e]}}function Hh(e,t){return function(){this[e]=t}}function Uh(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function qh(e,t){return arguments.length>1?this.each((t==null?$h:typeof t=="function"?Uh:Hh)(e,t)):this.node()[e]}function Qa(e){return e.trim().split(/^|\s+/)}function ai(e){return e.classList||new Za(e)}function Za(e){this._node=e,this._names=Qa(e.getAttribute("class")||"")}Za.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Ja(e,t){for(var n=ai(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function es(e,t){for(var n=ai(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function Vh(e){return function(){Ja(this,e)}}function Gh(e){return function(){es(this,e)}}function Wh(e,t){return function(){(t.apply(this,arguments)?Ja:es)(this,e)}}function Xh(e,t){var n=Qa(e+"");if(arguments.length<2){for(var r=ai(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Wh:t?Vh:Gh)(n,t))}function Yh(){this.textContent=""}function Kh(e){return function(){this.textContent=e}}function Qh(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Zh(e){return arguments.length?this.each(e==null?Yh:(typeof e=="function"?Qh:Kh)(e)):this.node().textContent}function Jh(){this.innerHTML=""}function ep(e){return function(){this.innerHTML=e}}function tp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function np(e){return arguments.length?this.each(e==null?Jh:(typeof e=="function"?tp:ep)(e)):this.node().innerHTML}function rp(){this.nextSibling&&this.parentNode.appendChild(this)}function ip(){return this.each(rp)}function op(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ap(){return this.each(op)}function sp(e){var t=typeof e=="function"?e:Ga(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function lp(){return null}function cp(e,t){var n=typeof e=="function"?e:Ga(e),r=t==null?lp:typeof t=="function"?t:Wa(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function up(){var e=this.parentNode;e&&e.removeChild(this)}function fp(){return this.each(up)}function dp(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pp(e){return this.select(e?hp:dp)}function gp(e){return arguments.length?this.property("__data__",e):this.node().__data__}function vp(e){return function(t){e.call(this,t,this.__data__)}}function yp(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function mp(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function bp(e,t,n){return function(){var r=this.__on,i,o=vp(t);if(r){for(var a=0,s=r.length;a<s;++a)if((i=r[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function _p(e,t,n){var r=yp(e+""),i,o=r.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,c=s.length,f;l<c;++l)for(i=0,f=s[l];i<o;++i)if((a=r[i]).type===f.type&&a.name===f.name)return f.value}return}for(s=t?bp:mp,i=0;i<o;++i)this.each(s(r[i],t,n));return this}function ts(e,t,n){var r=Ka(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function xp(e,t){return function(){return ts(this,e,t)}}function wp(e,t){return function(){return ts(this,e,t.apply(this,arguments))}}function kp(e,t){return this.each((typeof t=="function"?wp:xp)(e,t))}function*Cp(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,a;i<o;++i)(a=r[i])&&(yield a)}var Sp=[null];function Ve(e,t){this._groups=e,this._parents=t}function Mp(){return this}Ve.prototype={constructor:Ve,select:Xd,selectAll:Jd,selectChild:ih,selectChildren:lh,filter:ch,data:gh,enter:uh,exit:yh,join:mh,merge:bh,selection:Mp,order:_h,sort:xh,call:kh,nodes:Ch,node:Sh,size:Mh,empty:Ph,each:Oh,attr:Rh,style:Fh,property:qh,classed:Xh,text:Zh,html:np,raise:ip,lower:ap,append:sp,insert:cp,remove:fp,clone:pp,datum:gp,on:_p,dispatch:kp,[Symbol.iterator]:Cp};function Pp(e){return typeof e=="string"?new Ve([[document.querySelector(e)]],[document.documentElement]):new Ve([[e]],Sp)}function Op(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ap(e,t){if(e=Op(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var un,ge,ns,rs,ut,Eo,is,os,wr,Pn,on,as,si,zr,Fr,Rn={},In=[],jp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Vn=Array.isArray;function Ze(e,t){for(var n in t)e[n]=t[n];return e}function li(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Tp(e,t,n){var r,i,o,a={};for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?un.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return an(e,a,r,i,null)}function an(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++ns,__i:-1,__u:0};return i==null&&ge.vnode!=null&&ge.vnode(o),o}function Gn(e){return e.children}function On(e,t){this.props=e,this.context=t}function It(e,t){if(t==null)return e.__?It(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?It(e):null}function Ep(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=Ze({},t);o.__v=t.__v+1,ge.vnode&&ge.vnode(o),ci(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??It(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,us(r,o,i),t.__e=t.__=null,o.__e!=n&&ss(o)}}function ss(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),ss(e)}function Lo(e){(!e.__d&&(e.__d=!0)&&ut.push(e)&&!Dn.__r++||Eo!=ge.debounceRendering)&&((Eo=ge.debounceRendering)||is)(Dn)}function Dn(){try{for(var e,t=1;ut.length;)ut.length>t&&ut.sort(os),e=ut.shift(),t=ut.length,Ep(e)}finally{ut.length=Dn.__r=0}}function ls(e,t,n,r,i,o,a,s,l,c,f){var u,g,h,p,v,y,d,b=r&&r.__k||In,m=t.length;for(l=Lp(n,t,b,l,m),u=0;u<m;u++)(h=n.__k[u])!=null&&(g=h.__i!=-1&&b[h.__i]||Rn,h.__i=u,y=ci(e,h,g,i,o,a,s,l,c,f),p=h.__e,h.ref&&g.ref!=h.ref&&(g.ref&&ui(g.ref,null,h),f.push(h.ref,h.__c||p,h)),v==null&&p!=null&&(v=p),(d=!!(4&h.__u))||g.__k===h.__k?(l=cs(h,l,e,d),d&&g.__e&&(g.__e=null)):typeof h.type=="function"&&y!==void 0?l=y:p&&(l=p.nextSibling),h.__u&=-7);return n.__e=v,l}function Lp(e,t,n,r,i){var o,a,s,l,c,f=n.length,u=f,g=0;for(e.__k=new Array(i),o=0;o<i;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=an(null,a,null,null,null):Vn(a)?a=e.__k[o]=an(Gn,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=an(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,l=o+g,a.__=e,a.__b=e.__b+1,s=null,(c=a.__i=Np(a,n,l,u))!=-1&&(u--,(s=n[c])&&(s.__u|=2)),s==null||s.__v==null?(c==-1&&(i>f?g--:i<f&&g++),typeof a.type!="function"&&(a.__u|=4)):c!=l&&(c==l-1?g--:c==l+1?g++:(c>l?g--:g++,a.__u|=4))):e.__k[o]=null;if(u)for(o=0;o<f;o++)(s=n[o])!=null&&!(2&s.__u)&&(s.__e==r&&(r=It(s)),ds(s,s));return r}function cs(e,t,n,r){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=cs(i[o],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=It(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Np(e,t,n,r){var i,o,a,s=e.key,l=e.type,c=t[n],f=c!=null&&(2&c.__u)==0;if(c===null&&s==null||f&&s==c.key&&l==c.type)return n;if(r>(f?1:0)){for(i=n-1,o=n+1;i>=0||o<t.length;)if((c=t[a=i>=0?i--:o++])!=null&&!(2&c.__u)&&s==c.key&&l==c.type)return a}return-1}function No(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||jp.test(t)?n:n+"px"}function Sn(e,t,n,r,i){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||No(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||No(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(as,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n[on]=r[on]:(n[on]=si,e.addEventListener(t,o?Fr:zr,o)):e.removeEventListener(t,o?Fr:zr,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Ro(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Pn]==null)t[Pn]=si++;else if(t[Pn]<n[on])return;return n(ge.event?ge.event(t):t)}}}function ci(e,t,n,r,i,o,a,s,l,c){var f,u,g,h,p,v,y,d,b,m,x,w,_,k,C,P=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),o=[s=t.__e=n.__e]),(f=ge.__b)&&f(t);e:if(typeof P=="function")try{if(d=t.props,b=P.prototype&&P.prototype.render,m=(f=P.contextType)&&r[f.__c],x=f?m?m.props.value:f.__:r,n.__c?y=(u=t.__c=n.__c).__=u.__E:(b?t.__c=u=new P(d,x):(t.__c=u=new On(d,x),u.constructor=P,u.render=Ip),m&&m.sub(u),u.state||(u.state={}),u.__n=r,g=u.__d=!0,u.__h=[],u._sb=[]),b&&u.__s==null&&(u.__s=u.state),b&&P.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=Ze({},u.__s)),Ze(u.__s,P.getDerivedStateFromProps(d,u.__s))),h=u.props,p=u.state,u.__v=t,g)b&&P.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),b&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(b&&P.getDerivedStateFromProps==null&&d!==h&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(d,x),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(d,u.__s,x)===!1){t.__v!=n.__v&&(u.props=d,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(M){M&&(M.__=t)}),In.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&a.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(d,u.__s,x),b&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(h,p,v)})}if(u.context=x,u.props=d,u.__P=e,u.__e=!1,w=ge.__r,_=0,b)u.state=u.__s,u.__d=!1,w&&w(t),f=u.render(u.props,u.state,u.context),In.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,w&&w(t),f=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++_<25);u.state=u.__s,u.getChildContext!=null&&(r=Ze(Ze({},r),u.getChildContext())),b&&!g&&u.getSnapshotBeforeUpdate!=null&&(v=u.getSnapshotBeforeUpdate(h,p)),k=f!=null&&f.type===Gn&&f.key==null?fs(f.props.children):f,s=ls(e,Vn(k)?k:[k],t,n,r,i,o,a,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),y&&(u.__E=u.__=null)}catch(M){if(t.__v=null,l||o!=null)if(M.then){for(t.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o[o.indexOf(s)]=null,t.__e=s}else{for(C=o.length;C--;)li(o[C]);Br(t)}else t.__e=n.__e,t.__k=n.__k,M.then||Br(t);ge.__e(M,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Rp(n.__e,t,n,r,i,o,a,l,c);return(f=ge.diffed)&&f(t),128&t.__u?void 0:s}function Br(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Br))}function us(e,t,n){for(var r=0;r<n.length;r++)ui(n[r],n[++r],n[++r]);ge.__c&&ge.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){ge.__e(o,i.__v)}})}function fs(e){return typeof e!="object"||e==null||e.__b>0?e:Vn(e)?e.map(fs):Ze({},e)}function Rp(e,t,n,r,i,o,a,s,l){var c,f,u,g,h,p,v,y=n.props||Rn,d=t.props,b=t.type;if(b=="svg"?i="http://www.w3.org/2000/svg":b=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((h=o[c])&&"setAttribute"in h==!!b&&(b?h.localName==b:h.nodeType==3)){e=h,o[c]=null;break}}if(e==null){if(b==null)return document.createTextNode(d);e=document.createElementNS(i,b,d.is&&d),s&&(ge.__m&&ge.__m(t,o),s=!1),o=null}if(b==null)y===d||s&&e.data==d||(e.data=d);else{if(o=o&&un.call(e.childNodes),!s&&o!=null)for(y={},c=0;c<e.attributes.length;c++)y[(h=e.attributes[c]).name]=h.value;for(c in y)h=y[c],c=="dangerouslySetInnerHTML"?u=h:c=="children"||c in d||c=="value"&&"defaultValue"in d||c=="checked"&&"defaultChecked"in d||Sn(e,c,null,h,i);for(c in d)h=d[c],c=="children"?g=h:c=="dangerouslySetInnerHTML"?f=h:c=="value"?p=h:c=="checked"?v=h:s&&typeof h!="function"||y[c]===h||Sn(e,c,h,y[c],i);if(f)s||u&&(f.__html==u.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(u&&(e.innerHTML=""),ls(t.type=="template"?e.content:e,Vn(g)?g:[g],t,n,r,b=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:n.__k&&It(n,0),s,l),o!=null)for(c=o.length;c--;)li(o[c]);s||(c="value",b=="progress"&&p==null?e.removeAttribute("value"):p!=null&&(p!==e[c]||b=="progress"&&!p||b=="option"&&p!=y[c])&&Sn(e,c,p,y[c],i),c="checked",v!=null&&v!=e[c]&&Sn(e,c,v,y[c],i))}return e}function ui(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(i){ge.__e(i,n)}}function ds(e,t,n){var r,i;if(ge.unmount&&ge.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||ui(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){ge.__e(o,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&ds(r[i],t,n||typeof e.type!="function");n||li(e.__e),e.__c=e.__=e.__e=void 0}function Ip(e,t,n){return this.constructor(e,n)}function Dp(e,t,n){var r,i,o,a;t==document&&(t=document.documentElement),ge.__&&ge.__(e,t),i=(r=!1)?null:t.__k,o=[],a=[],ci(t,e=t.__k=Tp(Gn,null,[e]),i||Rn,Rn,t.namespaceURI,i?null:t.firstChild?un.call(t.childNodes):null,o,i?i.__e:t.firstChild,r,a),us(o,e,a)}function hs(e,t,n){var r,i,o,a,s=Ze({},e.props);for(o in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)o=="key"?r=t[o]:o=="ref"?i=t[o]:s[o]=t[o]===void 0&&a!=null?a[o]:t[o];return arguments.length>2&&(s.children=arguments.length>3?un.call(arguments,2):n),an(e.type,s,r||e.key,i||e.ref,null)}un=In.slice,ge={__e:function(e,t,n,r){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(s){e=s}throw e}},ns=0,rs=function(e){return e!=null&&e.constructor===void 0},On.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ze({},this.state),typeof e=="function"&&(e=e(Ze({},n),this.props)),e&&Ze(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Lo(this))},On.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Lo(this))},On.prototype.render=Gn,ut=[],is=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,os=function(e,t){return e.__v.__b-t.__v.__b},Dn.__r=0,wr=Math.random().toString(8),Pn="__d"+wr,on="__a"+wr,as=/(PointerCapture)$|Capture$/i,si=0,zr=Ro(!1),Fr=Ro(!0);function Io(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function zp(e){if(Array.isArray(e))return e}function Fp(e,t,n){return(t=Vp(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bp(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}function $p(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
656
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Do(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Hp(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Do(Object(n),!0).forEach(function(r){Fp(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Do(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Up(e,t){return zp(e)||Bp(e,t)||Gp(e,t)||$p()}function qp(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vp(e){var t=qp(e,"string");return typeof t=="symbol"?t:t+""}function zn(e){"@babel/helpers - typeof";return zn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zn(e)}function Gp(e,t){if(e){if(typeof e=="string")return Io(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Io(e,t):void 0}}var $r=function(t){if(zn(t)!=="object")return t;var n=hs(t);if(n.props){var r;n.props=Hp({},n.props),n!=null&&(r=n.props)!==null&&r!==void 0&&r.children&&(n.props.children=Array.isArray(n.props.children)?n.props.children.map($r):$r(n.props.children))}return n},Wp=function(t){return rs(hs(t))},Xp=function(t,n){delete n.__k,Dp($r(t),n)};function Yp(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",n==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var Kp=`.float-tooltip-kap {
|
|
657
|
+
position: absolute;
|
|
658
|
+
width: max-content; /* prevent shrinking near right edge */
|
|
659
|
+
max-width: max(50%, 150px);
|
|
660
|
+
padding: 3px 5px;
|
|
661
|
+
border-radius: 3px;
|
|
662
|
+
font: 12px sans-serif;
|
|
663
|
+
color: #eee;
|
|
664
|
+
background: rgba(0,0,0,0.6);
|
|
665
|
+
pointer-events: none;
|
|
666
|
+
}
|
|
667
|
+
`;Yp(Kp);var Qp=ri({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.style,o=i===void 0?{}:i,a=!!t&&zn(t)==="object"&&!!t.node&&typeof t.node=="function",s=Pp(a?t.node():t);s.style("position")==="static"&&s.style("position","relative"),n.tooltipEl=s.append("div").attr("class","float-tooltip-kap"),Object.entries(o).forEach(function(c){var f=Up(c,2),u=f[0],g=f[1];return n.tooltipEl.style(u,g)}),n.tooltipEl.style("left","-10000px").style("display","none");var l="tooltip-".concat(Math.round(Math.random()*1e12));n.mouseInside=!1,s.on("mousemove.".concat(l),function(c){n.mouseInside=!0;var f=Ap(c),u=s.node(),g=u.offsetWidth,h=u.offsetHeight,p=[n.offsetX===null||n.offsetX===void 0?"-".concat(f[0]/g*100,"%"):typeof n.offsetX=="number"?"calc(-50% + ".concat(n.offsetX,"px)"):n.offsetX,n.offsetY===null||n.offsetY===void 0?h>130&&h-f[1]<100?"calc(-100% - 6px)":"21px":typeof n.offsetY=="number"?n.offsetY<0?"calc(-100% - ".concat(Math.abs(n.offsetY),"px)"):"".concat(n.offsetY,"px"):n.offsetY];n.tooltipEl.style("left",f[0]+"px").style("top",f[1]+"px").style("transform","translate(".concat(p.join(","),")")),n.content&&n.tooltipEl.style("display","inline")}),s.on("mouseover.".concat(l),function(){n.mouseInside=!0,n.content&&n.tooltipEl.style("display","inline")}),s.on("mouseout.".concat(l),function(){n.mouseInside=!1,n.tooltipEl.style("display","none")})},update:function(t){t.tooltipEl.style("display",t.content&&t.mouseInside?"inline":"none"),t.content?t.content instanceof HTMLElement?(t.tooltipEl.text(""),t.tooltipEl.append(function(){return t.content})):typeof t.content=="string"?t.tooltipEl.html(t.content):Wp(t.content)?(t.tooltipEl.text(""),Xp(t.content,t.tooltipEl.node())):(t.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",t.content,t.content.toString())):t.tooltipEl.text("")}});function Zp(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",n==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var Jp=`.scene-nav-info {
|
|
668
|
+
position: absolute;
|
|
669
|
+
bottom: 5px;
|
|
670
|
+
width: 100%;
|
|
671
|
+
text-align: center;
|
|
672
|
+
color: slategrey;
|
|
673
|
+
opacity: 0.7;
|
|
674
|
+
font-size: 10px;
|
|
675
|
+
font-family: sans-serif;
|
|
676
|
+
pointer-events: none;
|
|
677
|
+
user-select: none;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
.scene-container canvas:focus {
|
|
681
|
+
outline: none;
|
|
682
|
+
}`;Zp(Jp);function Hr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function eg(e){if(Array.isArray(e))return e}function tg(e){if(Array.isArray(e))return Hr(e)}function ng(e,t,n){return(t=cg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rg(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ig(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,o,a,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,i=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}function og(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
683
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ag(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
684
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sg(e,t){return eg(e)||ig(e,t)||ps(e,t)||og()}function vt(e){return tg(e)||rg(e)||ps(e)||ag()}function lg(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cg(e){var t=lg(e,"string");return typeof t=="symbol"?t:t+""}function ps(e,t){if(e){if(typeof e=="string")return Hr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hr(e,t):void 0}}var gs=function(t){t instanceof Array?t.forEach(gs):(t.map&&t.map.dispose(),t.dispose())},vs=function(t){t.geometry&&t.geometry.dispose(),t.material&&gs(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(vs)},ug=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),vs(n)}},he=window.THREE?window.THREE:{WebGLRenderer:K.WebGLRenderer,Scene:K.Scene,PerspectiveCamera:K.PerspectiveCamera,Raycaster:K.Raycaster,SRGBColorSpace:K.SRGBColorSpace,TextureLoader:K.TextureLoader,Vector2:K.Vector2,Vector3:K.Vector3,Box3:K.Box3,Color:K.Color,Mesh:K.Mesh,SphereGeometry:K.SphereGeometry,MeshBasicMaterial:K.MeshBasicMaterial,BackSide:K.BackSide,Timer:K.Timer},ys=ri({props:{width:{default:window.innerWidth,onChange:function(t,n,r){isNaN(t)&&(n.width=r)}},height:{default:window.innerHeight,onChange:function(t,n,r){isNaN(t)&&(n.height=r)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(t,n){n.hoverObj=null,n.tooltip&&n.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(t){if(t.initialised){t.controls.enabled&&t.controls.update&&t.controls.update(Math.min(1,t.timer.update().getDelta())),t.postProcessingComposer?t.postProcessingComposer.render():t.renderer.render(t.scene,t.camera),t.extraRenderers.forEach(function(a){return a.render(t.scene,t.camera)});var n=+new Date;if(t.enablePointerInteraction&&n-t.lastRaycasterCheck>=t.pointerRaycasterThrottleMs){t.lastRaycasterCheck=n;var r=null;if(t.hoverDuringDrag||!t.isPointerDragging){var i=this.intersectingObjects(t.pointerPos.x,t.pointerPos.y);t.hoverOrderComparator&&i.sort(function(a,s){return t.hoverOrderComparator(a.object,s.object)});var o=i.find(function(a){return t.hoverFilter(a.object)})||null;r=o?o.object:null,t.intersection=o||null}r!==t.hoverObj&&(t.onHover(r,t.hoverObj,t.intersection),t.tooltip.content(r&&ie(t.tooltipContent)(r,t.intersection)||null),t.hoverObj=r)}t.tweenGroup.update()}return this},getPointerPos:function(t){var n=t.pointerPos,r=n.x,i=n.y;return{x:r,y:i}},cameraPosition:function(t,n,r,i){var o=t.camera;if(n&&t.initialised){var a=n,s=r||{x:0,y:0,z:0};if(!i)f(a),u(s);else{var l=Object.assign({},o.position),c=g();t.tweenGroup.add(new jo(l).to(a,i).easing(bt.Quadratic.Out).onUpdate(f).onComplete(function(){t.tweenGroup.remove(this)}).start()),t.tweenGroup.add(new jo(c).to(s,i/3).easing(bt.Quadratic.Out).onUpdate(u).onComplete(function(){t.tweenGroup.remove(this)}).start())}return this}return Object.assign({},o.position,{lookAt:g()});function f(h){var p=h.x,v=h.y,y=h.z;p!==void 0&&(o.position.x=p),v!==void 0&&(o.position.y=v),y!==void 0&&(o.position.z=y)}function u(h){var p=new he.Vector3(h.x,h.y,h.z);t.controls.enabled&&t.controls.target?t.controls.target=p:o.lookAt(p)}function g(){return Object.assign(new he.Vector3(0,0,-1e3).applyQuaternion(o.quaternion).add(o.position))}},zoomToFit:function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,i=arguments.length,o=new Array(i>3?i-3:0),a=3;a<i;a++)o[a-3]=arguments[a];return this.fitToBbox(this.getBbox.apply(this,o),n,r)},fitToBbox:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,o=t.camera;if(n){var a=new he.Vector3(0,0,0),s=Math.max.apply(Math,vt(Object.entries(n).map(function(h){var p=sg(h,2),v=p[0],y=p[1];return Math.max.apply(Math,vt(y.map(function(d){return Math.abs(a[v]-d)})))})))*2,l=(1-i*2/t.height)*o.fov,c=s/Math.atan(l*Math.PI/180),f=c/o.aspect,u=Math.max(c,f);if(u>0){var g=a.clone().sub(o.position).normalize().multiplyScalar(-u);this.cameraPosition(g,a,r)}}return this},getBbox:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},r=new he.Box3(new he.Vector3(0,0,0),new he.Vector3(0,0,0)),i=t.objects.filter(n);return i.length?(i.forEach(function(o){return r.expandByObject(o)}),Object.assign.apply(Object,vt(["x","y","z"].map(function(o){return ng({},o,[r.min[o],r.max[o]])})))):null},getScreenCoords:function(t,n,r,i){var o=new he.Vector3(n,r,i);return o.project(this.camera()),{x:(o.x+1)*t.width/2,y:-(o.y-1)*t.height/2}},getSceneCoords:function(t,n,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=new he.Vector2(n/t.width*2-1,-(r/t.height)*2+1),a=new he.Raycaster;return a.setFromCamera(o,t.camera),Object.assign({},a.ray.at(i,new he.Vector3))},intersectingObjects:function(t,n,r){var i=new he.Vector2(n/t.width*2-1,-(r/t.height)*2+1),o=new he.Raycaster;return o.params.Line.threshold=t.lineHoverPrecision,o.params.Points.threshold=t.pointsHoverPrecision,o.setFromCamera(i,t.camera),o.intersectObjects(t.objects,!0)},renderer:function(t){return t.renderer},scene:function(t){return t.scene},camera:function(t){return t.camera},postProcessingComposer:function(t){return t.postProcessingComposer},controls:function(t){return t.controls},tbControls:function(t){return t.controls},_destructor:function(t){var n,r,i;ug(t.scene),(n=t.controls)===null||n===void 0||n.dispose(),(r=t.renderer)===null||r===void 0||r.dispose(),(i=t.postProcessingComposer)===null||i===void 0||i.dispose()}},stateInit:function(){return{scene:new he.Scene,camera:new he.PerspectiveCamera,timer:new he.Timer,tweenGroup:new Ua,lastRaycasterCheck:0}},init:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.controlType,o=i===void 0?"trackball":i,a=r.useWebGPU,s=a===void 0?!1:a,l=r.rendererConfig,c=l===void 0?{}:l,f=r.extraRenderers,u=f===void 0?[]:f,g=r.waitForLoadComplete,h=g===void 0?!0:g;t.innerHTML="",t.appendChild(n.container=document.createElement("div")),n.container.className="scene-container",n.container.style.position="relative",n.container.appendChild(n.navInfo=document.createElement("div")),n.navInfo.className="scene-nav-info",n.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[o]||"",n.navInfo.style.display=n.showNavInfo?null:"none",n.tooltip=new Qp(n.container),n.pointerPos=new he.Vector2,n.pointerPos.x=-2,n.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(p){return n.container.addEventListener(p,function(v){if(p==="pointerdown"&&(n.isPointerPressed=!0),!n.isPointerDragging&&v.type==="pointermove"&&(v.pressure>0||n.isPointerPressed)&&(v.pointerType==="mouse"||v.movementX===void 0||[v.movementX,v.movementY].some(function(b){return Math.abs(b)>1}))&&(n.isPointerDragging=!0),n.enablePointerInteraction){var y=d(n.container);n.pointerPos.x=v.pageX-y.left,n.pointerPos.y=v.pageY-y.top}function d(b){var m=b.getBoundingClientRect(),x=window.pageXOffset||document.documentElement.scrollLeft,w=window.pageYOffset||document.documentElement.scrollTop;return{top:m.top+w,left:m.left+x}}},{passive:!0})}),n.container.addEventListener("pointerup",function(p){n.isPointerPressed&&(n.isPointerPressed=!1,!(n.isPointerDragging&&(n.isPointerDragging=!1,!n.clickAfterDrag))&&requestAnimationFrame(function(){p.button===0&&n.onClick(n.hoverObj||null,p,n.intersection),p.button===2&&n.onRightClick&&n.onRightClick(n.hoverObj||null,p,n.intersection)}))},{passive:!0,capture:!0}),n.container.addEventListener("contextmenu",function(p){n.onRightClick&&p.preventDefault()}),n.renderer=new(s?el.WebGPURenderer:he.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),n.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),n.container.appendChild(n.renderer.domElement),n.extraRenderers=u,n.extraRenderers.forEach(function(p){p.domElement.style.position="absolute",p.domElement.style.top="0px",p.domElement.style.pointerEvents="none",n.container.appendChild(p.domElement)}),n.postProcessingComposer=new il.EffectComposer(n.renderer),n.postProcessingComposer.addPass(new ol.RenderPass(n.scene,n.camera)),n.controls=new{trackball:tl.TrackballControls,orbit:nl.OrbitControls,fly:rl.FlyControls}[o](n.camera,n.renderer.domElement),o==="fly"&&(n.controls.movementSpeed=300,n.controls.rollSpeed=Math.PI/6,n.controls.dragToLook=!0),(o==="trackball"||o==="orbit")&&(n.controls.minDistance=.1,n.controls.maxDistance=n.skyRadius,n.controls.addEventListener("start",function(){n.controlsEngaged=!0}),n.controls.addEventListener("change",function(){n.controlsEngaged&&(n.controlsDragging=!0)}),n.controls.addEventListener("end",function(){n.controlsEngaged=!1,n.controlsDragging=!1})),[n.renderer,n.postProcessingComposer].concat(vt(n.extraRenderers)).forEach(function(p){return p.setSize(n.width,n.height)}),n.camera.aspect=n.width/n.height,n.camera.updateProjectionMatrix(),n.camera.position.z=1e3,n.scene.add(n.skysphere=new he.Mesh),n.skysphere.visible=!1,n.loadComplete=n.scene.visible=!h,window.scene=n.scene},update:function(t,n){if(t.width&&t.height&&(n.hasOwnProperty("width")||n.hasOwnProperty("height"))){var r,i=t.width,o=t.height;t.container.style.width="".concat(i,"px"),t.container.style.height="".concat(o,"px"),[t.renderer,t.postProcessingComposer].concat(vt(t.extraRenderers)).forEach(function(h){return h.setSize(i,o)}),t.camera.aspect=i/o;var a=t.viewOffset.slice(0,2);a.some(function(h){return h})&&(r=t.camera).setViewOffset.apply(r,[i,o].concat(vt(a),[i,o])),t.camera.updateProjectionMatrix()}if(n.hasOwnProperty("viewOffset")){var s,l=t.width,c=t.height,f=t.viewOffset.slice(0,2);f.some(function(h){return h})?(s=t.camera).setViewOffset.apply(s,[l,c].concat(vt(f),[l,c])):t.camera.clearViewOffset()}if(n.hasOwnProperty("skyRadius")&&t.skyRadius&&(t.controls.hasOwnProperty("maxDistance")&&n.skyRadius&&(t.controls.maxDistance=Math.min(t.controls.maxDistance,t.skyRadius)),t.camera.far=t.skyRadius*2.5,t.camera.updateProjectionMatrix(),t.skysphere.geometry=new he.SphereGeometry(t.skyRadius)),n.hasOwnProperty("backgroundColor")){var u=Rt(t.backgroundColor).alpha;u===void 0&&(u=1),t.renderer.setClearColor(new he.Color(Dd(1,t.backgroundColor)),u)}n.hasOwnProperty("backgroundImageUrl")&&(t.backgroundImageUrl?new he.TextureLoader().load(t.backgroundImageUrl,function(h){h.colorSpace=he.SRGBColorSpace,t.skysphere.material=new he.MeshBasicMaterial({map:h,side:he.BackSide}),t.skysphere.visible=!0,t.onBackgroundImageLoaded&&setTimeout(t.onBackgroundImageLoaded),!t.loadComplete&&g()}):(t.skysphere.visible=!1,t.skysphere.material.map=null,!t.loadComplete&&g())),n.hasOwnProperty("showNavInfo")&&(t.navInfo.style.display=t.showNavInfo?null:"none"),n.hasOwnProperty("lights")&&((n.lights||[]).forEach(function(h){return t.scene.remove(h)}),t.lights.forEach(function(h){return t.scene.add(h)})),n.hasOwnProperty("objects")&&((n.objects||[]).forEach(function(h){return t.scene.remove(h)}),t.objects.forEach(function(h){return t.scene.add(h)}));function g(){t.loadComplete=t.scene.visible=!0}}});function fg(e,t){let n=null,r=null;const i=(...o)=>{r=o,n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null;const a=r;r=null,e(...a)},t)};return i.cancel=()=>{n!==null&&(clearTimeout(n),n=null),r=null},i}class dg{name;defaultVal;triggerUpdate;onChange;constructor(t,n){this.name=t,this.defaultVal=n.default??null,this.triggerUpdate=n.triggerUpdate??!0,this.onChange=n.onChange??(()=>{})}}function hg(e={}){const{stateInit:t=()=>({}),props:n={},methods:r={},aliases:i={},init:o=()=>{},update:a=()=>{}}=e,s=Object.keys(n).map(c=>new dg(c,n[c]));function l(...c){const f=this instanceof l,u=c.slice(),g=f?u.shift():void 0,h=u[0]??{},p=typeof t=="function"?t(h):t,v=Object.assign({},p,{initialised:!1,_rerender:()=>{}});let y={};const d=x=>(b(x,h),m(),d);function b(x,w){o.call(d,x,v,w),v.initialised=!0}const m=fg(()=>{v.initialised&&(a.call(d,v,y),y={})},1);for(const x of s){const{name:w,triggerUpdate:_,onChange:k,defaultVal:C}=x;d[w]=function(){const M=v[w];if(arguments.length===0)return M;const N=arguments[0],E=N===void 0?C:N;return v[w]=E,k.call(d,E,v,M),Object.prototype.hasOwnProperty.call(y,w)||(y[w]=M),_&&m(),d}}for(const x of Object.keys(r))d[x]=function(...w){return r[x].call(d,v,...w)};for(const[x,w]of Object.entries(i))d[x]=d[w];return d.resetProps=function(){for(const x of s)d[x.name](x.defaultVal);return d},d.resetProps(),v._rerender=m,f&&g!==void 0&&d(g),d}return l}function zo(e){if(typeof e=="function")return e;if(typeof e=="string"){const n=e;return r=>r?.[n]}const t=e;return()=>t}function ms(e,t){const n=e instanceof Array?e:[e],r=new t;return r._destructor?.(),{linkProp(i){return{default:r[i](),onChange(o,a){n.forEach(s=>{a[s][i].call(a[s],o)})},triggerUpdate:!1}},linkMethod(i){return function(o,...a){const s=[];return n.forEach(l=>{const c=o[l],f=c[i].apply(c,a);f!==c&&s.push(f)}),s.length?s[0]:this}}}}const Fo=globalThis,Bo=Fo.THREE?Fo.THREE:{AmbientLight:K.AmbientLight,DirectionalLight:K.DirectionalLight},pg=170,bs=ms("forceGraph",Da),gg=["jsonUrl","graphData","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeColor","nodeAutoColorBy","nodeOpacity","nodeVisibility","nodeThreeObject","nodeThreeObjectExtend","nodePositionUpdate","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject","forceEngine","d3AlphaDecay","d3VelocityDecay","d3AlphaMin","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"],vg=["refresh","getGraphBbox","d3Force","d3ReheatSimulation","emitParticle"],Wn=ms("renderObjs",ys),yg=["width","height","backgroundColor","showNavInfo","enablePointerInteraction"],mg=["lights","cameraPosition","postProcessingComposer"],fi={};for(const e of gg)fi[e]=bs.linkProp(e);for(const e of yg)fi[e]=Wn.linkProp(e);const fn={};for(const e of vg)fn[e]=bs.linkMethod(e);for(const e of mg)fn[e]=Wn.linkMethod(e);fn.graph2ScreenCoords=Wn.linkMethod("getScreenCoords");fn.screen2GraphCoords=Wn.linkMethod("getSceneCoords");const He=e=>e;function ot(e){let t=e??null;for(;t&&!Object.prototype.hasOwnProperty.call(t,"__graphObjType");)t=t.parent;return t}const bg=hg({props:{nodeLabel:{default:"name",triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:1,onChange(e,t){He(t).renderObjs.lineHoverPrecision(e)},triggerUpdate:!1},enableNavigationControls:{default:!0,onChange(e,t){const r=He(t).renderObjs.controls();r&&(r.enabled=!!e,e&&r.domElement&&r.domElement.dispatchEvent(new PointerEvent("pointerup")))},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},onNodeDrag:{default:()=>{},triggerUpdate:!1},onNodeDragEnd:{default:()=>{},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},...fi},methods:{zoomToFit(e,t,n,...r){return He(e).renderObjs.fitToBbox(this.getGraphBbox(...r),t,n),this},pauseAnimation(e){const t=He(e);return t.animationFrameRequestId!=null&&(cancelAnimationFrame(t.animationFrameRequestId),t.animationFrameRequestId=null),this},resumeAnimation(e){return He(e).animationFrameRequestId==null&&this._animationCycle(),this},_animationCycle(e){const t=He(e);t.enablePointerInteraction&&(this.renderer().domElement.style.cursor=""),t.forceGraph.tickFrame(),t.renderObjs.tick(),t.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},scene(e){return He(e).renderObjs.scene()},camera(e){return He(e).renderObjs.camera()},renderer(e){return He(e).renderObjs.renderer()},controls(e){return He(e).renderObjs.controls()},_destructor(e){const t=He(e);this.pauseAnimation(),this.graphData({nodes:[],links:[]}),t.forceGraph._destructor?.(),t.renderObjs._destructor()},...fn},stateInit:e=>{const t=e??{},n=new Da,r=ys({...t.controlType?{controlType:t.controlType}:{},...t.rendererConfig?{rendererConfig:t.rendererConfig}:{},...t.extraRenderers?{extraRenderers:t.extraRenderers}:{}});return r.objects([n]),r.lights([new Bo.AmbientLight(13421772,Math.PI),new Bo.DirectionalLight(16777215,.6*Math.PI)]),{forceGraph:n,renderObjs:r}},init(e,t){const n=He(t);e.innerHTML="",n.container=document.createElement("div"),n.container.style.position="relative",e.appendChild(n.container);const r=document.createElement("div");n.container.appendChild(r),n.renderObjs(r);const i=n.renderObjs.camera(),o=n.renderObjs.renderer(),a=n.renderObjs.controls();a&&(a.enabled=!!n.enableNavigationControls),n.lastSetCameraZ=i.position.z;const s=document.createElement("div");s.className="graph-info-msg",s.textContent="",n.container.appendChild(s);const l=n.forceGraph;l.onLoading(()=>{s.textContent="Loading..."}),l.onFinishLoading(()=>{s.textContent=""}),l.onUpdate(()=>{if(n.graphData=l.graphData(),i.position.x===0&&i.position.y===0&&i.position.z===n.lastSetCameraZ&&n.graphData.nodes.length){i.lookAt(l.position??{x:0,y:0,z:0});const f=Math.cbrt(n.graphData.nodes.length)*pg;i.position.z=f,n.lastSetCameraZ=f}}),l.onFinishUpdate(()=>{if(n._dragControls){const f=n.graphData.nodes.find(u=>u.__initialFixedPos&&!u.__disposeControlsAfterDrag);f?f.__disposeControlsAfterDrag=!0:n._dragControls.dispose(),n._dragControls=void 0}if(n.enableNodeDrag&&n.enablePointerInteraction&&n.forceEngine==="d3"){const f=n.graphData.nodes.map(h=>h.__threeObj).filter(h=>!!h),u=new Js.DragControls(f,i,o.domElement);n._dragControls=u,u.addEventListener("dragstart",h=>{const p=h,v=ot(p.object);if(!v)return;a&&(a.enabled=!1),p.object.__initialPos=p.object.position.clone(),p.object.__prevPos=p.object.position.clone();const y=v.__data;y.__initialFixedPos||(y.__initialFixedPos={fx:y.fx,fy:y.fy,fz:y.fz}),y.__initialPos||(y.__initialPos={x:y.x,y:y.y,z:y.z});for(const d of["x","y","z"])y[`f${d}`]=y[d];o.domElement.classList.add("grabbable")});const g=4;u.addEventListener("drag",h=>{const p=h,v=ot(p.object);if(!v)return;if(!Object.prototype.hasOwnProperty.call(p.object,"__graphObjType")){const m=p.object.__initialPos,x=p.object.__prevPos,w=p.object.position,_=w.clone().sub(x);v.position.add(_),x.copy(w),w.copy(m)}const y=v.__data,d=v.position;if(!y.__dragCommitted){const m=y.__initialPos,x=m?.x??d.x,w=m?.y??d.y,_=m?.z??d.z,k=d.x-x,C=d.y-w,P=d.z-_;if(k*k+C*C+P*P<g)return;y.__dragCommitted=!0}const b={x:d.x-(y.x??0),y:d.y-(y.y??0),z:d.z-(y.z??0)};for(const m of["x","y","z"])y[`f${m}`]=d[m],y[m]=d[m];n.forceGraph.d3AlphaTarget(.3).resetCountdown(),y.__dragged=!0,n.onNodeDrag?.(y,b)}),u.addEventListener("dragend",h=>{const p=h,v=ot(p.object);if(!v)return;delete p.object.__initialPos,delete p.object.__prevPos;const y=v.__data;y.__disposeControlsAfterDrag&&(u.dispose(),delete y.__disposeControlsAfterDrag);const d=y.__initialFixedPos,b=y.__initialPos,m=b?{x:b.x-y.x,y:b.y-y.y,z:b.z-y.z}:{x:0,y:0,z:0};if(d){for(const x of["x","y","z"]){const w=`f${x}`;d[w]===void 0&&delete y[w]}delete y.__initialFixedPos,delete y.__initialPos,delete y.__dragCommitted,y.__dragged&&(delete y.__dragged,n.onNodeDragEnd?.(y,m))}n.forceGraph.d3AlphaTarget(0).resetCountdown(),n.enableNavigationControls&&a&&(a.enabled=!0,a._status&&a._onPointerCancel?.(),a.domElement?.ownerDocument?.dispatchEvent(new PointerEvent("pointerup",{pointerType:"touch"}))),o.domElement.classList.remove("grabbable")})}}),parseInt(K.REVISION,10)<155&&(o.useLegacyLights=!1),n.renderObjs.hoverOrderComparator((f,u)=>{const g=ot(f);if(!g)return 1;const h=ot(u);if(!h)return-1;const p=v=>v.__graphObjType==="node"?1:0;return p(h)-p(g)}).tooltipContent(f=>{const u=ot(f);if(!u)return"";const g=n[`${u.__graphObjType}Label`];return zo(g)(u.__data)||""}).hoverDuringDrag(!1).onHover(f=>{const u=ot(f);if(u===n.hoverObj)return;const g=n.hoverObj??null,h=g?g.__graphObjType:null,p=g?g.__data:null,v=u?u.__graphObjType:null,y=u?u.__data:null;if(h&&h!==v){const m=n[`on${h==="node"?"Node":"Link"}Hover`];m?.(null,p)}if(v){const m=n[`on${v==="node"?"Node":"Link"}Hover`];m?.(y,h===v?p:null)}const b=!!(u?n[`on${v==="node"?"Node":"Link"}Click`]:n.onBackgroundClick)&&zo(n.showPointerCursor)(y);o.domElement.classList[b?"add":"remove"]("clickable"),n.hoverObj=u}).clickAfterDrag(!1).onClick((f,u)=>{const g=ot(f);if(g){const h=n[`on${g.__graphObjType==="node"?"Node":"Link"}Click`];h?.(g.__data,u)}else n.onBackgroundClick&&n.onBackgroundClick(u)}).onRightClick((f,u)=>{const g=ot(f);if(g){const h=n[`on${g.__graphObjType==="node"?"Node":"Link"}RightClick`];h?.(g.__data,u)}else n.onBackgroundRightClick&&n.onBackgroundRightClick(u)}),this._animationCycle()},update(){}});function jt(e,t,n){if(typeof requestAnimationFrame!="function")return t(1),()=>{};const r=performance.now();let i=null,o=!1;const a=s=>{if(o)return;const l=s-r,c=Math.min(1,l/Math.max(e,1));t(_g(c)),c<1?i=requestAnimationFrame(a):i=null};return i=requestAnimationFrame(a),()=>{o=!0,i!==null&&cancelAnimationFrame(i),i=null}}function _g(e){return 1-(1-e)*(1-e)}function ae(e,t,n){return e+(t-e)*n}const te=()=>!0,Ue=e=>e==="2d",ye=e=>e==="3d",xg=[{key:"nodeId",setter:"nodeId",supports:te},{key:"linkSource",setter:"linkSource",supports:te},{key:"linkTarget",setter:"linkTarget",supports:te},{key:"backgroundColor",setter:"backgroundColor",supports:te},{key:"nodeColor",setter:"nodeColor",supports:te},{key:"nodeLabel",setter:"nodeLabel",supports:te},{key:"nodeVal",setter:"nodeVal",supports:te},{key:"nodeAutoColorBy",setter:"nodeAutoColorBy",supports:te},{key:"nodeRelSize",setter:"nodeRelSize",supports:te},{key:"nodeVisibility",setter:"nodeVisibility",supports:te},{key:"linkColor",setter:"linkColor",supports:te},{key:"linkLabel",setter:"linkLabel",supports:te},{key:"linkWidth",setter:"linkWidth",supports:te},{key:"linkCurvature",setter:"linkCurvature",supports:te},{key:"linkAutoColorBy",setter:"linkAutoColorBy",supports:te},{key:"linkVisibility",setter:"linkVisibility",supports:te},{key:"linkDirectionalArrowLength",setter:"linkDirectionalArrowLength",supports:te},{key:"linkDirectionalArrowColor",setter:"linkDirectionalArrowColor",supports:te},{key:"linkDirectionalArrowRelPos",setter:"linkDirectionalArrowRelPos",supports:te},{key:"linkDirectionalParticles",setter:"linkDirectionalParticles",supports:te},{key:"linkDirectionalParticleSpeed",setter:"linkDirectionalParticleSpeed",supports:te},{key:"linkDirectionalParticleWidth",setter:"linkDirectionalParticleWidth",supports:te},{key:"linkDirectionalParticleOffset",setter:"linkDirectionalParticleOffset",supports:te},{key:"linkDirectionalParticleColor",setter:"linkDirectionalParticleColor",supports:te},{key:"cooldownTicks",setter:"cooldownTicks",supports:te},{key:"cooldownTime",setter:"cooldownTime",supports:te},{key:"warmupTicks",setter:"warmupTicks",supports:te},{key:"d3AlphaDecay",setter:"d3AlphaDecay",supports:te},{key:"d3VelocityDecay",setter:"d3VelocityDecay",supports:te},{key:"d3AlphaMin",setter:"d3AlphaMin",supports:te},{key:"d3AlphaTarget",setter:"d3AlphaTarget",supports:te},{key:"dagMode",setter:"dagMode",supports:te},{key:"dagLevelDistance",setter:"dagLevelDistance",supports:te},{key:"dagNodeFilter",setter:"dagNodeFilter",supports:te},{key:"onDagError",setter:"onDagError",supports:te},{key:"enableNodeDrag",setter:"enableNodeDrag",supports:te},{key:"enablePointerInteraction",setter:"enablePointerInteraction",supports:te},{key:"linkHoverPrecision",setter:"linkHoverPrecision",supports:te},{key:"showPointerCursor",setter:"showPointerCursor",supports:te},{key:"enableZoom",setter:"enableZoomInteraction",supports:Ue},{key:"enablePan",setter:"enablePanInteraction",supports:Ue},{key:"minZoom",setter:"minZoom",supports:Ue},{key:"maxZoom",setter:"maxZoom",supports:Ue},{key:"autoPauseRedraw",setter:"autoPauseRedraw",supports:Ue},{key:"linkLineDash",setter:"linkLineDash",supports:Ue},{key:"nodeCanvasObject",setter:"nodeCanvasObject",supports:Ue},{key:"nodeCanvasObjectMode",setter:"nodeCanvasObjectMode",supports:Ue},{key:"nodePointerAreaPaint",setter:"nodePointerAreaPaint",supports:Ue},{key:"linkCanvasObject",setter:"linkCanvasObject",supports:Ue},{key:"linkCanvasObjectMode",setter:"linkCanvasObjectMode",supports:Ue},{key:"linkPointerAreaPaint",setter:"linkPointerAreaPaint",supports:Ue},{key:"showNavInfo",setter:"showNavInfo",supports:ye},{key:"enableNavigationControls",setter:"enableNavigationControls",supports:ye},{key:"nodeOpacity",setter:"nodeOpacity",supports:ye},{key:"nodeResolution",setter:"nodeResolution",supports:ye},{key:"linkOpacity",setter:"linkOpacity",supports:ye},{key:"linkResolution",setter:"linkResolution",supports:ye},{key:"linkCurveRotation",setter:"linkCurveRotation",supports:ye},{key:"linkMaterial",setter:"linkMaterial",supports:ye},{key:"nodeThreeObject",setter:"nodeThreeObject",supports:ye},{key:"nodeThreeObjectExtend",setter:"nodeThreeObjectExtend",supports:ye},{key:"linkThreeObject",setter:"linkThreeObject",supports:ye},{key:"linkThreeObjectExtend",setter:"linkThreeObjectExtend",supports:ye},{key:"nodePositionUpdate",setter:"nodePositionUpdate",supports:ye},{key:"linkPositionUpdate",setter:"linkPositionUpdate",supports:ye},{key:"linkDirectionalArrowResolution",setter:"linkDirectionalArrowResolution",supports:ye},{key:"linkDirectionalParticleResolution",setter:"linkDirectionalParticleResolution",supports:ye},{key:"numDimensions",setter:"numDimensions",supports:ye},{key:"forceEngine",setter:"forceEngine",supports:ye},{key:"ngraphPhysics",setter:"ngraphPhysics",supports:ye},{key:"pointerRaycasterThrottleMs",setter:"pointerRaycasterThrottleMs",supports:ye}];function $o(e,t,n,r){if(t!==n)for(const i of xg){if(!i.supports(r))continue;const o=t[i.key],a=n[i.key];if(Object.is(o,a))continue;const s=e[i.setter];typeof s=="function"&&s.call(e,o)}}const wg=["onNodeClick","onNodeRightClick","onNodeHover","onNodeDrag","onNodeDragEnd","onLinkClick","onLinkRightClick","onLinkHover","onBackgroundClick","onBackgroundRightClick","onEngineTick","onEngineStop"],yt=1200,Qt=300;function kg(e,t,n){const r=new bg(e,{controlType:"orbit"});r.width(t.width),r.height(t.height);for(const v of wg){const y=r[v];typeof y=="function"&&y.call(r,(...d)=>{const b=n.current[v];typeof b=="function"&&b(...d)})}$o(r,t.initialProps,{},"3d"),r.graphData(t.initialData);let i=t.initialMode,o=i==="2d"?yt:Qt,a=null,s=null;const l=v=>{const y=r.controls?.();if(!y)return;const d=y;v==="2d"?(d.noRotate=!0,d.enableRotate=!1,d.zoomToCursor=!0,d.screenSpacePanning=!0,d.zoomSpeed=1.6,d.panSpeed=1.2,d.mouseButtons&&(d.mouseButtons.LEFT=K.MOUSE.PAN)):(d.noRotate=!1,d.enableRotate=!0,d.zoomToCursor=!1,d.screenSpacePanning=!1,d.zoomSpeed=1,d.panSpeed=1,d.mouseButtons&&(d.mouseButtons.LEFT=K.MOUSE.ROTATE))},c=()=>{const v=r.graphData();for(const y of v.nodes)y.fz=0},f=()=>{const v=r.graphData();for(const y of v.nodes)delete y.fz},u=()=>{const v=r.graphData(),y=new Map;let d=0;for(const m of v.nodes){const x=m.x??0,w=m.y??0,_=Math.hypot(x,w);_>d&&(d=_)}const b=Math.max(40,d*.6);for(const m of v.nodes)y.set(m,(Math.random()-.5)*2*b);return y};i==="2d"?(c(),l("2d"),r.cameraPosition?.({x:0,y:0,z:yt},{x:0,y:0,z:0},0)):l("3d");const g=()=>r.cameraPosition?.();return{get mode(){return i},setGraphData(v){r.graphData(v),i==="2d"&&c()},getGraphData(){return r.graphData()},fit(v,y){r.zoomToFit?.(v??400,y??40)},centerAt(v,y,d,b){if(i==="2d"){r.cameraPosition?.({x:v,y,z:yt},{x:v,y,z:0},b??0);return}const m=g();r.cameraPosition?.({x:v,y,z:d??o},m?.lookAt,b??0)},zoom(v,y){const d=g();if(!d)return;const b=Math.hypot(d.x,d.y,d.z);o=b/Math.max(v,.001);const m=b===0?{x:0,y:0,z:1}:{x:d.x/b,y:d.y/b,z:d.z/b};r.cameraPosition?.({x:m.x*o,y:m.y*o,z:m.z*o},d.lookAt,y??0)},getZoom(){const v=g();if(!v)return 1;const y=Math.hypot(v.x,v.y,v.z);return y===0?1:o/y},screen2Graph(v,y,d){return r.screen2GraphCoords?.(v,y,d??0)??{x:v,y,z:0}},graph2Screen(v,y,d){return r.graph2ScreenCoords?.(v,y,d??0)??{x:v,y,z:d??0}},getGraphBbox(){return r.getGraphBbox?.()??{x:[0,0],y:[0,0],z:[0,0]}},pause(){r.pauseAnimation?.()},resume(){r.resumeAnimation?.()},reheat(){r.d3ReheatSimulation?.()},resize(v,y){r.width(v),r.height(y)},d3Force(v,y){const d=r.d3Force;if(typeof d=="function")return y===void 0?d.call(r,v):d.call(r,v,y)},emitParticle(v){r.emitParticle?.(v)},stopAnimation(){s?.(),s=null},focusOn(v,y){s?.();const d=g();if(!d)return;const b=v.z??0,m=y?.durationMs??1e3;if(i==="2d"){const B=y?.zoom!==void 0?o/Math.max(y.zoom,.001):yt;s=jt(m,S=>{const O=ae(d.x,v.x,S),L=ae(d.y,v.y,S),U=ae(d.z,B,S);r.cameraPosition?.({x:O,y:L,z:U},{x:O,y:L,z:0},0)});return}const x=d.x-v.x,w=d.y-v.y,_=d.z-b,k=Math.hypot(x,w,_),C=y?.distance??120,P=k===0?{x:0,y:0,z:1}:{x:x/k,y:w/k,z:_/k},M={x:v.x+P.x*C,y:v.y+P.y*C,z:b+P.z*C},N={x:v.x,y:v.y,z:b},E=d.lookAt??{x:0,y:0,z:0};s=jt(m,B=>{r.cameraPosition?.({x:ae(d.x,M.x,B),y:ae(d.y,M.y,B),z:ae(d.z,M.z,B)},{x:ae(E.x,N.x,B),y:ae(E.y,N.y,B),z:ae(E.z,N.z,B)},0)})},getCameraState(){const v=g()??{x:0,y:0,z:Qt};if(i==="2d"){const y=v.lookAt??{x:0,y:0},d=o/Math.max(Math.hypot(v.x,v.y,v.z),1);return{mode:"2d",x:y.x,y:y.y,k:d}}return{mode:"3d",x:v.x,y:v.y,z:v.z,lookAt:v.lookAt??{x:0,y:0,z:0}}},setCameraState(v,y){s?.();const d=y??0,b=g()??{x:0,y:0,z:Qt};if(v.mode==="2d"){const x=p(v.k)??yt;if(d<=0){r.cameraPosition?.({x:v.x,y:v.y,z:x},{x:v.x,y:v.y,z:0},0);return}const w=b.lookAt??{x:0,y:0};s=jt(d,_=>{const k=ae(b.x,v.x,_),C=ae(b.y,v.y,_),P=ae(b.z,x,_);r.cameraPosition?.({x:k,y:C,z:P},{x:ae(w.x,v.x,_),y:ae(w.y,v.y,_),z:0},0)});return}if(d<=0){r.cameraPosition?.({x:v.x,y:v.y,z:v.z},v.lookAt,0);return}const m=b.lookAt??v.lookAt;s=jt(d,x=>{r.cameraPosition?.({x:ae(b.x,v.x,x),y:ae(b.y,v.y,x),z:ae(b.z,v.z,x)},{x:ae(m.x,v.lookAt.x,x),y:ae(m.y,v.lookAt.y,x),z:ae(m.z,v.lookAt.z,x)},0)})},applyProps(v,y){$o(r,v,y,"3d")},getCanvasElement(){return e.querySelector("canvas")},destroy(){s?.(),s=null,r._destructor()},setMode(v,y=800){if(v===i)return;i=v,s?.();const d=g()??{x:0,y:0,z:Qt};if(v==="2d"){a={x:d.x,y:d.y,z:d.z,lookAt:d.lookAt??{x:0,y:0,z:0}};const k=r.graphData(),C=new Map;for(const E of k.nodes){const B=E.z;C.set(E,typeof B=="number"?B:0)}const P=d.lookAt??{x:0,y:0,z:0},M={x:P.x,y:P.y,z:0},N={x:P.x,y:P.y,z:yt};s=jt(y,E=>{for(const[B,S]of C)B.z=ae(S,0,E);r.cameraPosition?.({x:ae(d.x,N.x,E),y:ae(d.y,N.y,E),z:ae(d.z,N.z,E)},{x:ae(P.x,M.x,E),y:ae(P.y,M.y,E),z:ae(P.z,M.z,E)},0),E>=1&&(c(),l("2d"),o=yt)});return}f(),l("3d");const b=u(),m=new Map;for(const[k]of b){const C=k.z;m.set(k,typeof C=="number"?C:0)}const x=a??{x:0,y:0,z:Qt,lookAt:{x:0,y:0,z:0}},w=x.lookAt??{x:0,y:0,z:0},_=d.lookAt??{x:0,y:0,z:0};s=jt(y,k=>{for(const[C,P]of b){const M=m.get(C)??0;C.z=ae(M,P,k)}r.cameraPosition?.({x:ae(d.x,x.x,k),y:ae(d.y,x.y,k),z:ae(d.z,x.z,k)},{x:ae(_.x,w.x,k),y:ae(_.y,w.y,k),z:ae(_.z,w.z,k)},0),k>=1&&(r.d3ReheatSimulation?.(),o=Math.hypot(x.x,x.y,x.z))})}};function p(v){return!Number.isFinite(v)||v===0?null:o/v}}function Cg(e){const{mount:t,mode:n,width:r,height:i,data:o,props:a,paused:s,modeTransitionMs:l=800}=e,[c,f]=A.useState(null),u=A.useRef(a);u.current=a;const g=A.useRef(a),h=A.useRef(n);return A.useEffect(()=>{if(!t)return;const p=kg(t,{initialProps:a,initialData:o,width:r,height:i,initialMode:h.current},u);return g.current=a,f(p),()=>{p.destroy(),f(null)}},[t]),A.useEffect(()=>{c&&c.mode!==n&&c.setMode(n,l)},[c,n,l]),A.useEffect(()=>{c&&(s?c.pause():c.resume())},[c,s]),A.useEffect(()=>{c&&c.resize(r,i)},[c,r,i]),A.useEffect(()=>{c&&c.setGraphData(o)},[c,o]),A.useEffect(()=>{c&&(c.applyProps(a,g.current),g.current=a)},[c,a]),c}function Sg(e){const[t,n]=A.useState(null);return A.useEffect(()=>{const r=e.current;if(!r)return;const i=new ResizeObserver(o=>{const a=o[0];if(!a)return;const s=a.contentRect;n({width:s.width,height:s.height})});return i.observe(r),()=>i.disconnect()},[e]),t}function Mg(e){const t=e.mode??"single",[n,r]=A.useState([]),i=A.useRef(e.onChange);i.current=e.onChange;const o=A.useRef(!0);A.useEffect(()=>{if(o.current){o.current=!1;return}i.current?.(n)},[n]);const a=A.useCallback((f,u)=>{t!=="none"&&r(g=>{const h=g.includes(f);return t==="single"||!u?.additive?h&&g.length===1?[]:[f]:h?g.filter(p=>p!==f):[...g,f]})},[t]),s=A.useCallback(f=>{t!=="none"&&r(t==="single"?f.slice(0,1):f)},[t]),l=A.useCallback(()=>r([]),[]),c=A.useCallback(f=>n.includes(f),[n]);return{selected:n,toggle:a,set:s,clear:l,isSelected:c}}function Pg(){const[e,t]=A.useState(!1);return A.useEffect(()=>{const n=o=>{o.key==="Shift"&&t(!0)},r=o=>{o.key==="Shift"&&t(!1)},i=()=>t(!1);return window.addEventListener("keydown",n),window.addEventListener("keyup",r),window.addEventListener("blur",i),()=>{window.removeEventListener("keydown",n),window.removeEventListener("keyup",r),window.removeEventListener("blur",i)}},[]),e}function Og(e,t){A.useEffect(()=>{if(!e)return;const n=new Map;for(const r of t.nodes)n.set(r.id,r),r._neighbors=[],r._links=[];for(const r of t.links){const i=typeof r.source=="object"?r.source.id:r.source,o=typeof r.target=="object"?r.target.id:r.target,a=n.get(i),s=n.get(o);!a||!s||(a._neighbors.push(s),s._neighbors.push(a),a._links.push(r),s._links.push(r))}},[e,t])}function Ag(e){const{mount:t,engineRef:n,selection:r,nodes:i,links:o,setSelectedLinkIds:a,liveHoverNodeIdRef:s}=e,l=A.useRef({selection:r,nodes:i,links:o,setSelectedLinkIds:a,liveHoverNodeIdRef:s});l.current.selection=r,l.current.nodes=i,l.current.links=o,l.current.setSelectedLinkIds=a,l.current.liveHoverNodeIdRef=s;const[c,f]=A.useState(null),u=A.useRef(null),g=A.useRef({x:0,y:0}).current;return A.useEffect(()=>{if(!t)return;let h=t.getBoundingClientRect();const p=()=>{h=t.getBoundingClientRect()},v=new ResizeObserver(p);v.observe(t),window.addEventListener("scroll",p,{passive:!0,capture:!0});const y=x=>{g.x=x.clientX-h.left,g.y=x.clientY-h.top,u.current=g};t.addEventListener("mousemove",y);const d=x=>{if(n.current?.stopAnimation(),x.button!==0||!x.shiftKey||l.current.liveHoverNodeIdRef.current!==null)return;const w=x.clientX-h.left,_=x.clientY-h.top;x.stopPropagation(),x.preventDefault(),f({x0:w,y0:_,x1:w,y1:_,additive:x.shiftKey});const k=P=>{const M=P.clientX-h.left,N=P.clientY-h.top;f(E=>E&&{...E,x1:M,y1:N})},C=P=>{window.removeEventListener("mousemove",k),window.removeEventListener("mouseup",C,!0);const M=P.clientX-h.left,N=P.clientY-h.top;f(null);const E=n.current;if(!E)return;const B=Math.min(w,M),S=Math.min(_,N),O=Math.max(w,M),L=Math.max(_,N);if(O-B<3&&L-S<3)return;const U=l.current,ne=U.nodes,J=U.links,se=U.selection,D=U.setSelectedLinkIds,$=[],G=(F,R)=>F>=B&&F<=O&&R>=S&&R<=L,Z=new Map;for(const F of ne){if(Z.set(F.id,F),F.x===void 0||F.y===void 0)continue;const R=E.graph2Screen(F.x,F.y,F.z);G(R.x,R.y)&&$.push(F.id)}const I=[],H=F=>{if(F&&typeof F=="object"){const R=F;if(R.x!==void 0&&R.y!==void 0)return R.z!==void 0?{x:R.x,y:R.y,z:R.z}:{x:R.x,y:R.y}}if(typeof F=="string"||typeof F=="number"){const R=Z.get(F);if(R&&R.x!==void 0&&R.y!==void 0)return R.z!==void 0?{x:R.x,y:R.y,z:R.z}:{x:R.x,y:R.y}}return null};for(const F of J){if(F.id===void 0)continue;const R=H(F.source),q=H(F.target);if(!R||!q)continue;const V=E.graph2Screen((R.x+q.x)/2,(R.y+q.y)/2,R.z!==void 0&&q.z!==void 0?(R.z+q.z)/2:void 0),re=E.graph2Screen(R.x,R.y,R.z),le=E.graph2Screen(q.x,q.y,q.z);(G(V.x,V.y)||G(re.x,re.y)&&G(le.x,le.y))&&I.push(F.id)}if(P.shiftKey||P.metaKey||P.ctrlKey){const F=se.selected,R=F.slice(),q=new Set(F);for(const V of $)q.has(V)||(q.add(V),R.push(V));se.set(R),D(V=>{const re=V.slice(),le=new Set(V);for(const ce of I)le.has(ce)||(le.add(ce),re.push(ce));return re})}else se.set($),D(I)};window.addEventListener("mousemove",k),window.addEventListener("mouseup",C,!0)};t.addEventListener("mousedown",d,!0);const b=()=>n.current?.stopAnimation(),m=()=>n.current?.stopAnimation();return t.addEventListener("wheel",b,{passive:!0,capture:!0}),t.addEventListener("touchstart",m,{passive:!0,capture:!0}),()=>{t.removeEventListener("mousemove",y),t.removeEventListener("mousedown",d,!0),t.removeEventListener("wheel",b,{capture:!0}),t.removeEventListener("touchstart",m,{capture:!0}),window.removeEventListener("scroll",p,{capture:!0}),v.disconnect()}},[t,n]),{marquee:c,lastCursorRef:u}}const jg=60;function Tg(e,t={}){const n=typeof t=="number"?{tolerancePx:t}:t,r=n.tolerancePx??12,i=n.pressGraceMs??jg;A.useEffect(()=>{if(!e)return;const o=r*r;let a=!1,s=!1,l=0,c=0,f=0;const u=p=>{e.contains(p.target)&&(a=!0,s=!1,l=p.clientX,c=p.clientY,f=performance.now())},g=p=>{if(!a||s)return;if(performance.now()-f<i){p.stopPropagation();return}const v=p.clientX-l,y=p.clientY-c;v*v+y*y<o?p.stopPropagation():s=!0},h=()=>{a=!1,s=!1};return window.addEventListener("pointerdown",u,!0),window.addEventListener("pointermove",g,!0),window.addEventListener("mousemove",g,!0),window.addEventListener("pointerup",h,!0),window.addEventListener("pointercancel",h,!0),window.addEventListener("mouseup",h,!0),()=>{window.removeEventListener("pointerdown",u,!0),window.removeEventListener("pointermove",g,!0),window.removeEventListener("mousemove",g,!0),window.removeEventListener("pointerup",h,!0),window.removeEventListener("pointercancel",h,!0),window.removeEventListener("mouseup",h,!0)}},[e,r,i])}function Eg(e){const{enableClipboard:t,dataApi:n,selection:r,setSelectedLinkIds:i,engineRef:o,lastCursorRef:a,onCopy:s,onCut:l,onPaste:c}=e,f=A.useRef([]),u=A.useCallback(()=>{const m=new Set(r.selected),x=[];for(const w of n.data.nodes){if(!m.has(w.id))continue;const{id:_,x:k,y:C,z:P,vx:M,vy:N,vz:E,fx:B,fy:S,fz:O,...L}=w;x.push(L)}return x},[n.data.nodes,r.selected]),g=A.useCallback(()=>{if(!t)return[];const m=new Set(r.selected),x=n.data.nodes.filter(w=>m.has(w.id));return f.current=u(),s?.(x),x},[t,n.data.nodes,r.selected,u,s]),h=A.useCallback(()=>{if(!t)return[];const m=new Set(r.selected),x=n.data.nodes.filter(w=>m.has(w.id));return f.current=u(),l?.(x),r.selected.length>0&&(n.removeNodes(r.selected),r.clear()),x},[t,n,r,u,l]),p=A.useCallback(m=>{if(!t)return[];const x=f.current;if(x.length===0)return[];const w=m||(()=>{const k=a.current;if(!(!k||!o.current))return o.current.screen2Graph(k.x,k.y)})(),_=n.addNodes(x.map((k,C)=>{const P=C%3*24,M=Math.floor(C/3)*24;return{...k,...w?{x:w.x+P,y:w.y+M,...w.z!==void 0?{z:w.z+M}:{}}:{}}}));return r.set(_.map(k=>k.id)),i([]),c?.(_),_},[t,n,r,i,c,o,a]),v=A.useCallback(()=>{const m=new Set(r.selected),x=[];let w=0;for(const k of n.data.nodes){if(!m.has(k.id))continue;const{id:C,vx:P,vy:M,vz:N,fx:E,fy:B,fz:S,...O}=k,L=w%3*24,U=Math.floor(w/3)*24;x.push({...O,...k.x!==void 0?{x:k.x+L}:{},...k.y!==void 0?{y:k.y+U}:{},...k.z!==void 0?{z:k.z}:{}}),w++}if(x.length===0)return[];const _=n.addNodes(x);return r.set(_.map(k=>k.id)),i([]),_},[n,r,i]),y=A.useCallback(m=>{const x=r.selected;if(x.length===0)return null;const w=n.data.nodes.filter(P=>x.includes(P.id));if(w.length===0)return null;let _=m?.at;if(!_){let P=0,M=0,N=0,E=!1;for(const B of w)P+=B.x??0,M+=B.y??0,N+=B.z??0,(B.x!==void 0||B.y!==void 0)&&(E=!0);E&&(_={x:P/w.length+30,y:M/w.length+30,z:N/w.length})}const k=m?.label!==void 0?{label:m.label}:{},C=n.addNode(k,_?{at:_}:void 0);for(const P of w)n.addLink({source:P.id,target:C.id});return r.set([C.id]),i([]),C},[n,r,i]),d=A.useCallback(m=>{const x=n.data.nodes.find(w=>w.id===m);x&&(x.fx!==void 0?n.updateNode(m,{fx:void 0,fy:void 0,fz:void 0}):n.updateNode(m,{fx:x.x,fy:x.y,...x.z!==void 0?{fz:x.z}:{}}))},[n]),b=A.useCallback(()=>f.current.length>0,[]);return A.useMemo(()=>({hasClipboard:b,copy:g,cut:h,paste:p,duplicate:v,addConnectedNode:y,togglePin:d}),[b,g,h,p,v,y,d])}function Lg(e){const t=A.useRef(e);t.current=e,A.useEffect(()=>{const n=r=>{const i=r.target;if(i&&(i.tagName==="INPUT"||i.tagName==="TEXTAREA"||i.isContentEditable))return;const a=t.current;switch(r.key){case"v":case"V":a.enableClipboard&&(r.metaKey||r.ctrlKey)?(a.paste(),r.preventDefault()):a.setActiveTool("select");break;case"h":case"H":a.setActiveTool("pan");break;case"n":case"N":a.setActiveTool("add-node");break;case"l":case"L":a.setActiveTool("add-link");break;case"f":case"F":a.engine?.fit(400,40);break;case"3":a.setMode(a.mode==="2d"?"3d":"2d");break;case"Backspace":case"Delete":if(a.selection.selected.length>0&&(a.dataApi.removeNodes(a.selection.selected),a.selection.clear(),r.preventDefault()),a.selectedLinkIds.length>0){const s=new Set(a.selectedLinkIds);a.dataApi.removeLink(l=>l.id!==void 0&&s.has(l.id)),a.setSelectedLinkIds([]),r.preventDefault()}break;case"a":case"A":(r.metaKey||r.ctrlKey)&&(a.selection.set(a.dataApi.data.nodes.map(s=>s.id)),a.setSelectedLinkIds(a.dataApi.data.links.map(s=>s.id).filter(s=>s!==void 0)),r.preventDefault());break;case"c":case"C":a.enableClipboard&&(r.metaKey||r.ctrlKey)&&a.copy();break;case"x":case"X":a.enableClipboard&&(r.metaKey||r.ctrlKey)&&(a.cut(),r.preventDefault());break;case"d":case"D":(r.metaKey||r.ctrlKey)&&(a.duplicate(),r.preventDefault());break;case"p":case"P":for(const s of a.selection.selected)a.togglePin(s);break;case"Enter":a.selection.selected.length>0&&(a.addConnectedNode(),r.preventDefault());break;case"Escape":a.selection.clear(),a.setSelectedLinkIds([]),a.setLinkSourceId(null);break}};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[])}function Ng(e){const{engine:t,collideNodes:n,beeswarm:r,nodeRelSize:i}=e;A.useEffect(()=>{if(!t||r)return;if(!n){t.d3Force("collide",null);return}const o=typeof n=="number"?n:(i??4)+2;return t.d3Force("collide",Xi(o)),t.reheat(),()=>{t.d3Force("collide",null)}},[t,n,i,r]),A.useEffect(()=>{if(!t)return;if(!r){t.d3Force("x",null),t.d3Force("y",null);return}const o=r===!0?{}:r,a=o.axis??"x",s=o.strength??.2,l=o.value,c=g=>{const h=String(g);let p=0;for(let v=0;v<h.length;v++)p=p*31+h.charCodeAt(v)|0;return(p%600+600)%600-300},f=g=>{const h=g;if(typeof l=="function")return l(h);if(typeof l=="string"){const p=h[l];if(typeof p=="number")return p;if(typeof p=="string")return Number(p)||0}return c(h.id)};t.d3Force("center",null),t.d3Force("charge",null),a==="x"?(t.d3Force("x",to(f)),t.d3Force("y",no(0).strength(s))):(t.d3Force("y",no(f)),t.d3Force("x",to(0).strength(s)));const u=(i??4)+2;t.d3Force("collide",Xi(u)),t.reheat()},[t,r,i])}function Dt(e,t){return typeof e=="function"?e(t):typeof e=="string"?t[e]:e}function Ho(e,t){const n=Dt(e,t);return typeof n=="string"?n:typeof HTMLElement<"u"&&n instanceof HTMLElement?n.textContent??"":n!=null?String(n):typeof t.label=="string"&&t.label.length>0?t.label:t.id!==void 0?String(t.id):""}function Uo(e,t){const n=Dt(e,t);if(typeof n=="string")return n;if(typeof HTMLElement<"u"&&n instanceof HTMLElement)return n.textContent??"";if(n!=null)return String(n);if(typeof t.label=="string"&&t.label.length>0)return t.label;const r=t.source,i=t.target,o=typeof r=="object"&&r!==null?r.id:r,a=typeof i=="object"&&i!==null?i.id:i;return o===void 0&&a===void 0?"":`${o??""} → ${a??""}`}function Zt(e,t){if(e.startsWith("#")){const i=e.slice(1),o=i.length===3?i.split("").map(a=>a+a).join(""):i;if(o.length===6){const a=parseInt(o.slice(0,2),16),s=parseInt(o.slice(2,4),16),l=parseInt(o.slice(4,6),16);return`rgba(${a}, ${s}, ${l}, ${t})`}}const n=e.match(/^rgb\(([^)]+)\)$/);if(n)return`rgba(${n[1]}, ${t})`;const r=e.match(/^rgba\(([^,]+),([^,]+),([^,]+),[^)]+\)$/);return r?`rgba(${r[1]},${r[2]},${r[3]},${t})`:e}const Tt=new Set;function Rg(e){const{mode:t,accentColor:n,nodeColor:r,linkColor:i,linkWidth:o,nodeVal:a,nodeRelSize:s,nodePointerAreaPaint:l,nodeAutoColorBy:c,nodeVisibility:f,selectedNodeSet:u,selectedLinkSet:g,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:v,hoverNodeId:y,hoverLinkId:d,hiddenGroups:b}=e,m=A.useRef({mode:t,accentColor:n,selectedNodeSet:u,selectedLinkSet:g,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:v,hoverNodeId:y,hoverLinkId:d,hiddenGroups:b});m.current={mode:t,accentColor:n,selectedNodeSet:u,selectedLinkSet:g,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:v,hoverNodeId:y,hoverLinkId:d,hiddenGroups:b};const x=u.size>0||g.size>0||h&&p.size>0,w=A.useMemo(()=>{const z=r;return F=>{const R=m.current;if(F.id!==void 0&&R.selectedNodeSet.has(F.id))return R.accentColor;if(R.highlightNeighborsOnHover&&R.highlightedNodeIds.size>0&&F.id!==void 0&&R.highlightedNodeIds.has(F.id))return R.hoverNodeId===F.id?R.accentColor:Zt(R.accentColor,.7);let V;return typeof z=="function"?V=z(F):typeof z=="string"?V=z:V=F.color??"#888",(R.selectedNodeSet.size>0||R.selectedLinkSet.size>0)&&R.mode!=="3d"?Zt(V,.25):V}},[r,u,g,y,p]),_=x?w:r,k=c!==void 0&&b.size>0,C=u.size>0||g.size>0||d!==null||h&&v.size>0||k,P="rgba(96, 102, 110, 0.55)",M="rgba(180, 188, 198, 0.55)",N=A.useMemo(()=>{const z=i,F=c;return R=>{const q=m.current,V=R.id,re=typeof R.source=="object"?R.source:null,le=typeof R.target=="object"?R.target:null;if(q.hiddenGroups.size>0&&F!==void 0){const xt=Be=>{if(!Be)return null;const ve=typeof F=="function"?F(Be):Be[F];return ve==null?null:String(ve)},dn=xt(re),hn=xt(le);if(dn!==null&&q.hiddenGroups.has(dn)||hn!==null&&q.hiddenGroups.has(hn)){let Be;return typeof z=="function"?Be=z(R):typeof z=="string"?Be=z:Be=R.color??P,Zt(Be,.05)}}if(V!==void 0&&q.selectedLinkSet.has(V))return q.accentColor;const ce=re?.id??R.source,Se=le?.id??R.target,me=q.selectedNodeSet.size>0;if(me&&(ce!==void 0&&q.selectedNodeSet.has(ce)||Se!==void 0&&q.selectedNodeSet.has(Se)))return Zt(q.accentColor,.85);const ze=V!==void 0&&q.hoverLinkId===V,Ke=q.highlightNeighborsOnHover&&V!==void 0&&q.highlightedLinkIds.has(V);if(ze||Ke)return M;let Fe;return typeof z=="function"?Fe=z(R):typeof z=="string"?Fe=z:Fe=R.color??P,me||q.selectedLinkSet.size>0?Zt(Fe,q.mode==="3d"?.45:.18):Fe}},[i,c,g,u,d,v,b]),E=C?N:i,B=u.size>0||g.size>0||d!==null||h&&v.size>0,S=.6,O=1.5,L=.4,U=1,ne=.5,J=1.2,se=A.useMemo(()=>{const z=o;return F=>{const R=m.current,q=F.id,V=q!==void 0&&R.selectedLinkSet.has(q),re=typeof F.source=="object"?F.source.id:F.source,le=typeof F.target=="object"?F.target.id:F.target,Se=R.selectedNodeSet.size>0&&(re!==void 0&&R.selectedNodeSet.has(re)||le!==void 0&&R.selectedNodeSet.has(le)),me=q!==void 0&&R.hoverLinkId===q,Te=R.highlightNeighborsOnHover&&q!==void 0&&R.highlightedLinkIds.has(q),ze=me||Te,Ke=typeof z=="function"?z(F):typeof z=="number"?z:F.width??1,Fe=R.mode==="3d";return V?Ke+(Fe?ne:J):ze?Ke+(Fe?S:O):Se?Ke+(Fe?L:U):Ke}},[o]),D=B?se:o,$=u.size>0||h&&p.size>0,G=A.useMemo(()=>{const z=a;return F=>{const R=m.current,q=F.id,V=typeof z=="function"?z(F):typeof z=="number"?z:F.val??1;return q!==void 0&&R.selectedNodeSet.has(q)?V*2.25:R.highlightNeighborsOnHover&&R.highlightedNodeIds.size>0&&q!==void 0&&R.highlightedNodeIds.has(q)?R.hoverNodeId===q?V*1.8:V*1.4:V}},[a]),Z=$?G:a,I=A.useMemo(()=>{if(t!=="2d"||l)return l;const z=a,F=s??4;return(R,q,V,re)=>{const le=typeof z=="function"?z(R):typeof z=="number"?z:R.val??1,ce=Math.sqrt(Math.max(0,le))*F+1/Math.max(re,1e-6);V.fillStyle=q,V.beginPath(),V.arc(R.x??0,R.y??0,ce,0,2*Math.PI,!1),V.fill()}},[t,a,s,l]),H=A.useMemo(()=>{const z=c&&b.size>0;if(!z&&f===void 0)return;const F=c,R=f;return q=>{if(z&&F){const V=typeof F=="function"?F(q):q[F];if(V!=null&&b.has(String(V)))return!1}return typeof R=="function"?!!R(q):typeof R=="boolean"?R:typeof R=="string"?!!q[R]:!0}},[c,f,b]);return A.useMemo(()=>({nodeColor:_,linkColor:E,linkWidth:D,nodeVal:Z,nodePointerAreaPaint:I,nodeVisibility:H}),[_,E,D,Z,I,H])}const qo=250;function Vo(e){return e==null?null:typeof e=="string"||typeof HTMLElement<"u"&&e instanceof HTMLElement?e:String(e)}function Ig(e){const{highlightNeighborsOnHover:t,nodeLabel:n,linkLabel:r,onNodeHover:i,onLinkHover:o}=e,[a,s]=A.useState(null),[l,c]=A.useState(null),[f,u]=A.useState(Tt),[g,h]=A.useState(Tt),[p,v]=A.useState(null),y=A.useRef(null),d=A.useRef(null),b=A.useRef(null),m=A.useRef(null),x=A.useRef(null);A.useEffect(()=>()=>{m.current!==null&&(clearTimeout(m.current),m.current=null),x.current!==null&&(clearTimeout(x.current),x.current=null)},[]);const w=A.useCallback((M,N)=>{if(i?.(M,N),y.current=M?.id??null,!M&&b.current!==null)return;if(m.current!==null&&(clearTimeout(m.current),m.current=null),!M){m.current=setTimeout(()=>{m.current=null,s(null),t&&(u(Tt),h(Tt)),d.current===null&&v(null)},qo);return}if(t){const B=new Set([M.id]),S=new Set,O=M._neighbors??[];for(const U of O)U.id!==void 0&&B.add(U.id);const L=M._links??[];for(const U of L)U.id!==void 0&&S.add(U.id);s(M.id),u(B),h(S)}else s(M.id);const E=Dt(n,M);v(Vo(E))},[i,n,t]),_=A.useCallback((M,N)=>{if(o?.(M,N),d.current=M?.id??null,x.current!==null&&(clearTimeout(x.current),x.current=null),!M){x.current=setTimeout(()=>{x.current=null,c(null),y.current===null&&v(null)},qo);return}c(M.id??null);const E=Dt(r,M);v(Vo(E))},[o,r]),k=A.useMemo(()=>a===null?Tt:t?f:new Set([a]),[a,t,f]),C=A.useMemo(()=>{if(l!==null){if(t&&a!==null){const M=new Set(g);return M.add(l),M}return new Set([l])}return a!==null&&t?g:Tt},[l,a,t,g]),P=A.useCallback(M=>{if(b.current=M?.id??null,M){w(M,null);return}w(null,null)},[w]);return{hoverNodeId:a,hoverLinkId:l,liveHoverNodeIdRef:y,liveHoverLinkIdRef:d,highlightedNodeIds:f,highlightedLinkIds:g,hoveredNodeSet:k,hoveredLinkSet:C,tooltipContent:p,handleNodeHover:w,handleLinkHover:_,pinHover:P}}const lt={frameId:-1,fov:-1,tanHalfFov:0,canvasHeightPx:1},Go=new K.Vector2;function Dg(e,t){const n=e.info?.render?.frame??-1;return n===lt.frameId&&t===lt.fov||(e.getSize(Go),lt.frameId=n,lt.fov=t,lt.tanHalfFov=Math.tan(t*Math.PI/180/2),lt.canvasHeightPx=Go.y||1),lt}function Fn(e){const t=e.material,n=e.userData;n.normalTexture&&n.normalTexture.dispose(),n.selectedTexture&&n.selectedTexture.dispose(),t.dispose(),e.parent&&e.parent.remove(e)}function Bn(e){const{text:t,fontSize:n=32,fontFamily:r="system-ui, sans-serif",color:i="#ffffff",backgroundColor:o="rgba(28, 31, 35, 0.85)",padding:a=8,worldHeight:s=4}=e,c=document.createElement("canvas").getContext("2d");if(!c)return new K.Sprite(new K.SpriteMaterial);c.font=`${n}px ${r}`;const f=Math.ceil(c.measureText(t).width),u=Math.ceil(n*1.2),g=f+a*2,h=u+a*2,p=(_,k,C)=>{_.width=g,_.height=h;const P=_.getContext("2d");if(P.font=`${n}px ${r}`,C){P.fillStyle=C;const M=Math.min(_.height/2,8),N=P;P.beginPath(),typeof N.roundRect=="function"?N.roundRect(0,0,_.width,_.height,M):P.rect(0,0,_.width,_.height),P.fill()}P.fillStyle=k,P.textAlign="center",P.textBaseline="middle",P.fillText(t,_.width/2,_.height/2)},v=document.createElement("canvas");p(v,i,o);const y=new K.CanvasTexture(v);y.minFilter=K.LinearFilter,y.magFilter=K.LinearFilter,y.needsUpdate=!0;let d;if(e.selectedColor!==void 0&&e.selectedBackgroundColor!==void 0){const _=document.createElement("canvas");p(_,e.selectedColor,e.selectedBackgroundColor),d=new K.CanvasTexture(_),d.minFilter=K.LinearFilter,d.magFilter=K.LinearFilter,d.needsUpdate=!0}const b=new K.SpriteMaterial({map:y,transparent:!0,depthWrite:!1}),m=new K.Sprite(b),x=m.userData;x.normalTexture=y,d&&(x.selectedTexture=d);const w=g/h;if(m.scale.set(s*w,s,1),e.pixelHeight!==void 0&&e.pixelHeight>0){const _=e.pixelHeight,k=new K.Vector3;let C=-1;m.onBeforeRender=(P,M,N)=>{const E=N;if(!E.isPerspectiveCamera||typeof E.fov!="number")return;m.getWorldPosition(k);const B=E.position.distanceTo(k);if(B<=0)return;const S=Dg(P,E.fov),O=2*S.tanHalfFov*B*_/S.canvasHeightPx;C>0&&Math.abs(O-C)<C*.005||(C=O,m.scale.set(O*w,O,1))}}return m}function zg(e){const{mode:t,showLabels:n,selectedNodeSet:r,hoveredNodeSet:i,accentColor:o,hostNodeCanvasObject:a,hostNodeThreeObject:s,nodeLabel:l,nodeVal:c,nodeRelSize:f,theme:u}=e,g=u?.tooltipBackground??"rgba(28, 31, 35, 0.9)",h=u?.tooltipForeground??"#ffffff",p=A.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:i,accentColor:o,tooltipBg:g,tooltipFg:h});p.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:i,accentColor:o,tooltipBg:g,tooltipFg:h};const v=A.useMemo(()=>{if(t!=="2d"||a)return;const _=u?.fontFamily??"system-ui, sans-serif";return(k,C,P)=>{const M=p.current,N=k.id!==void 0&&M.selectedNodeSet.has(k.id),E=k.id!==void 0&&M.hoveredNodeSet?.has(k.id)===!0;if(!M.showLabels&&!N&&!E)return;const B=Ho(l,k);if(!B)return;const S=Dt(c,k)??1,O=f??4,L=Math.max(.5,Math.sqrt(Math.max(S,0))*O),U=14/P,ne=6/P,J=4/P;C.font=`${U}px ${_}`;const D=C.measureText(B).width+ne*2,$=U+J*2,G=k.x??0,Z=(k.y??0)-L*2-4/P-$;C.fillStyle=N?M.accentColor:M.tooltipBg;const I=Math.min($/2,6/P),H=C;C.beginPath(),typeof H.roundRect=="function"?H.roundRect(G-D/2,Z,D,$,I):C.rect(G-D/2,Z,D,$),C.fill(),C.textAlign="center",C.textBaseline="top",C.fillStyle=N?"#ffffff":M.tooltipFg,C.fillText(B,G,Z+J)}},[t,a,l,c,f,u?.fontFamily]),y=i?.size??0,b=n||r.size>0||y>0?v:void 0,m=A.useRef(new Map),x=A.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:i});x.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:i},A.useEffect(()=>{const _=m.current;return()=>{for(const k of _.values())k.sprite&&Fn(k.sprite);_.clear()}},[]);const w=A.useMemo(()=>{if(s)return;const _=m.current,k=u?.fontFamily??"system-ui, sans-serif";return C=>{const P=C.id,M=Ho(l,C),N=Dt(c,C)??1,E=f??4,S=Math.cbrt(Math.max(N,0))*E*2+4,O=new K.Group;if(P!==void 0&&M){const L={group:O,sprite:null,text:M,yOffset:S};_.set(P,L);const U=x.current,ne=U.selectedNodeSet.has(P),J=U.hoveredNodeSet?.has(P)===!0;if(U.showLabels||ne||J){const se=Bn({text:M,fontFamily:k,fontSize:48,color:h,backgroundColor:g,selectedColor:"#ffffff",selectedBackgroundColor:o,pixelHeight:28});if(se.material.depthTest=!1,se.renderOrder=1e3,se.position.set(0,S,0),ne){const D=se.userData;if(D.selectedTexture){const $=se.material;$.map=D.selectedTexture,$.needsUpdate=!0}}O.add(se),L.sprite=se}}return O}},[s,l,c,f,u?.fontFamily,g,h,o]);return A.useEffect(()=>{const _=m.current,k=u?.fontFamily??"system-ui, sans-serif";for(const[C,P]of _){if(P.group.parent===null){P.sprite&&Fn(P.sprite),_.delete(C);continue}const M=r.has(C),N=i?.has(C)===!0,E=n||M||N;if(E&&P.sprite===null){const S=Bn({text:P.text,fontFamily:k,fontSize:48,color:h,backgroundColor:g,selectedColor:"#ffffff",selectedBackgroundColor:o,pixelHeight:28});S.material.depthTest=!1,S.renderOrder=1e3,S.position.set(0,P.yOffset,0),P.group.add(S),P.sprite=S}const B=P.sprite;if(B){B.visible=E;const S=B.userData,O=M&&S.selectedTexture?S.selectedTexture:S.normalTexture,L=B.material;O&&L.map!==O&&(L.map=O,L.needsUpdate=!0)}}},[n,r,i,o,g,h,u?.fontFamily]),{canvasObject:b,threeObject:w,renderFramePost:void 0}}function Fg(e){const{mode:t,showLabels:n,selectedLinkSet:r,hoveredLinkSet:i,accentColor:o,hostLinkCanvasObject:a,hostLinkThreeObject:s,hostLinkPositionUpdate:l,linkLabel:c,theme:f}=e,u=f?.tooltipBackground??"rgba(255, 255, 255, 0.94)",g=f?.tooltipForeground??"#1c1f23",h=A.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:i,accentColor:o,tooltipBg:u,tooltipFg:g});h.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:i,accentColor:o,tooltipBg:u,tooltipFg:g};const p=A.useMemo(()=>{if(t!=="2d"||a)return;const _=f?.fontFamily??"system-ui, sans-serif",k=4,C=6;return(P,M)=>{const N=h.current,E=P.id!==void 0&&N.selectedLinkSet.has(P.id),B=P.id!==void 0&&N.hoveredLinkSet?.has(P.id)===!0;if(!N.showLabels&&!E&&!B)return;const S=P.source,O=P.target;if(typeof S!="object"||typeof O!="object")return;const L=Uo(c,P);if(!L||L===" → ")return;const U=S.x,ne=S.y,J=O.x,se=O.y;if(U===void 0||ne===void 0||J===void 0||se===void 0)return;const D=J-U,$=se-ne,Z=Math.sqrt(D*D+$*$)-C*2;if(Z<=0)return;M.font=`1px ${_}`;const I=M.measureText(L).width||1,H=Math.min(k,Z/I);M.font=`${H}px ${_}`;let z=Math.atan2($,D);z>Math.PI/2&&(z=-(Math.PI-z)),z<-Math.PI/2&&(z=-(-Math.PI-z));const F=(U+J)/2,R=(ne+se)/2,q=M.measureText(L).width,V=H*.6,re=H*.35,le=q+V,ce=H+re,Se=Math.min(ce/2,H*.35);M.save(),M.translate(F,R),M.rotate(z),M.fillStyle=E?N.accentColor:N.tooltipBg;const me=M;M.beginPath(),typeof me.roundRect=="function"?me.roundRect(-le/2,-ce/2,le,ce,Se):M.rect(-le/2,-ce/2,le,ce),M.fill(),M.textAlign="center",M.textBaseline="middle",M.fillStyle=E?"#ffffff":N.tooltipFg,M.fillText(L,0,0),M.restore()}},[t,a,c,f?.fontFamily]),v=i?.size??0,d=n||r.size>0||v>0?p:void 0,b=A.useRef(new Map),m=A.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:i});m.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:i},A.useEffect(()=>{const _=b.current;return()=>{for(const k of _.values())k.sprite&&Fn(k.sprite);_.clear()}},[]);const x=A.useMemo(()=>{if(s)return;const _=b.current,k=f?.fontFamily??"system-ui, sans-serif";return C=>{const P=Uo(c,C),M=new K.Group,N=C.id;if(N!==void 0&&P&&P!==" → "){const E={group:M,sprite:null,text:P};_.set(N,E);const B=m.current,S=B.selectedLinkSet.has(N),O=B.hoveredLinkSet?.has(N)===!0;if(B.showLabels||S||O){const L=Bn({text:P,fontFamily:k,fontSize:48,color:g,backgroundColor:u,selectedColor:"#ffffff",selectedBackgroundColor:o,pixelHeight:22});if(L.material.depthTest=!1,L.renderOrder=500,S){const U=L.userData;if(U.selectedTexture){const ne=L.material;ne.map=U.selectedTexture,ne.needsUpdate=!0}}M.add(L),E.sprite=L}}return M}},[s,c,f?.fontFamily,u,g,o]);A.useEffect(()=>{const _=b.current,k=f?.fontFamily??"system-ui, sans-serif";for(const[C,P]of _){if(P.group.parent===null){P.sprite&&Fn(P.sprite),_.delete(C);continue}const M=r.has(C),N=i?.has(C)===!0,E=n||M||N;if(E&&P.sprite===null){const S=Bn({text:P.text,fontFamily:k,fontSize:48,color:g,backgroundColor:u,selectedColor:"#ffffff",selectedBackgroundColor:o,pixelHeight:22});S.material.depthTest=!1,S.renderOrder=500,P.group.add(S),P.sprite=S}const B=P.sprite;if(B){B.visible=E;const S=B.userData,O=M&&S.selectedTexture?S.selectedTexture:S.normalTexture,L=B.material;O&&L.map!==O&&(L.map=O,L.needsUpdate=!0)}}},[n,r,i,o,u,g,f?.fontFamily]);const w=A.useMemo(()=>{if(l!=null)return;const _=t==="2d";return(k,C)=>{if(k instanceof K.Group){const P=(C.start.x+C.end.x)/2,M=(C.start.y+C.end.y)/2,N=(C.start.z+C.end.z)/2;k.position.set(P,M,N);const E=k.parent;if(E&&!E.userData.lgcOrderApplied){E.userData.lgcOrderApplied=!0,E.renderOrder=-1;for(const S of E.children)S!==k&&(S.renderOrder=-1)}const B=k.children[0];if(B instanceof K.Sprite){const S=B.material;if(_){const O=C.end.x-C.start.x,L=C.end.y-C.start.y;let U=Math.atan2(L,O);U>Math.PI/2?U-=Math.PI:U<-Math.PI/2&&(U+=Math.PI),Math.abs(S.rotation-U)>.001&&(S.rotation=U)}else S.rotation!==0&&(S.rotation=0)}}return!0}},[t,l]);return{canvasObject:d,threeObject:x,positionUpdate:w}}function Bg({nodeCount:e,linkCount:t}){const n=e+t*.5;return n>=5e4?"huge":n>=1e4?"xlarge":n>=2e3?"large":"default"}function $g(e,t){if(e==="default")return{};const n={cooldownTicks:e==="large"?100:e==="xlarge"?60:30,d3AlphaDecay:e==="large"?.04:e==="xlarge"?.08:.15,d3VelocityDecay:e==="huge"?.6:.4,linkHoverPrecision:e==="large"?4:2,warmupTicks:0,linkDirectionalParticles:0,linkDirectionalArrowLength:0};return n.forceEngine="ngraph",n.nodeResolution=e==="large"?8:e==="xlarge"?4:3,n.linkResolution=e==="large"?4:0,n.nodeOpacity=1,n.linkOpacity=1,n.pointerRaycasterThrottleMs=e==="large"?32:e==="xlarge"?100:200,n}function Hg(e){const{profile:t="auto",nodeCount:n,linkCount:r,mode:i}=e;return A.useMemo(()=>{if(t==="off")return{};const o=t==="auto"?Bg({nodeCount:n,linkCount:r}):t;return $g(o)},[t,n,r,i])}function Ug(e){const{ref:t,dataApi:n,selection:r,engine:i,mode:o,setMode:a,setPaused:s,clipboard:l,exportJSON:c,importJSON:f,downloadJSON:u}=e;A.useImperativeHandle(t,()=>({getData:()=>n.data,setData:n.setData,addNode:n.addNode,addNodes:n.addNodes,updateNode:n.updateNode,removeNode:n.removeNode,removeNodes:n.removeNodes,addLink:n.addLink,addLinks:n.addLinks,removeLink:n.removeLink,clear:n.clear,getSelection:()=>r.selected,setSelection:r.set,selectAll:()=>r.set(n.data.nodes.map(g=>g.id)),clearSelection:r.clear,getMode:()=>o,setMode:a,fit:(g,h)=>i?.fit(g,h),centerAt:(g,h,p,v)=>i?.centerAt(g,h,p,v),zoom:(g,h)=>i?.zoom(g,h),zoomIn:(g=1.2)=>{i&&i.zoom((i.getZoom?.()??1)*g,200)},zoomOut:(g=1.2)=>{i&&i.zoom((i.getZoom?.()??1)/g,200)},pause:()=>{i?.pause(),s(!0)},resume:()=>{i?.resume(),s(!1)},reheat:()=>i?.reheat(),screenshot:async()=>{const g=i?.getCanvasElement();return g?new Promise(h=>g.toBlob(p=>h(p))):null},copy:l.copy,cut:l.cut,paste:g=>l.paste(g?.at),duplicate:l.duplicate,addConnectedNode:l.addConnectedNode,togglePin:l.togglePin,exportJSON:c,importJSON:f,downloadJSON:u,d3Force:(g,h)=>i?.d3Force(g,h),emitParticle:g=>i?.emitParticle(g),stopAnimation:()=>i?.stopAnimation(),engine2D:()=>i?.mode==="2d"?i:null,engine3D:()=>i?.mode==="3d"?i:null}),[t,n,i,o,a,s,r,l,c,f,u])}const we={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},qg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M3 2.5l4 10 1.4-3.6 3.6-1.4z"})}),Vg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M8 3v10M3 8h10M5 5l6 6M11 5L5 11"})}),Gg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"6",cy:"8",r:"3"}),T.jsx("path",{d:"M12 5v6M9 8h6"})]}),Wg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"4",cy:"4",r:"2"}),T.jsx("circle",{cx:"12",cy:"12",r:"2"}),T.jsx("path",{d:"M5.5 5.5l5 5"})]}),_s=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M3 5h10M6 5V3h4v2M5 5l1 8h4l1-8"})}),Xg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M3 6V3h3M13 6V3h-3M3 10v3h3M13 10v3h-3"})}),Yg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"7",cy:"7",r:"4"}),T.jsx("path",{d:"M5 7h4M7 5v4M10 10l3 3"})]}),Kg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"7",cy:"7",r:"4"}),T.jsx("path",{d:"M5 7h4M10 10l3 3"})]}),Qg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M6 3v10M10 3v10"})}),Zg=e=>T.jsx("svg",{...we,...e,children:T.jsx("path",{d:"M5 3l8 5-8 5z"})}),Jg=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("path",{d:"M3 5h2l1-2h4l1 2h2v8H3z"}),T.jsx("circle",{cx:"8",cy:"9",r:"2.5"})]}),xs=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("path",{d:"M8 2l5 3v6l-5 3-5-3V5z"}),T.jsx("path",{d:"M8 8v7M8 8L3 5M8 8l5-3"})]}),ev=e=>T.jsx("svg",{...we,...e,children:T.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),ws=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),T.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"})]}),tv=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",strokeDasharray:"2 2"}),T.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor"}),T.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"currentColor"}),T.jsx("circle",{cx:"6",cy:"10",r:"1",fill:"currentColor"}),T.jsx("circle",{cx:"10",cy:"10",r:"1",fill:"currentColor"})]}),nv=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("path",{d:"M8 2v8M5 5l3-3 3 3"}),T.jsx("path",{d:"M3 12h10v2H3z"})]}),rv=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("path",{d:"M8 10V2M5 7l3 3 3-3"}),T.jsx("path",{d:"M3 12h10v2H3z"})]}),iv=e=>T.jsxs("svg",{...we,...e,children:[T.jsx("circle",{cx:"4",cy:"8",r:"2"}),T.jsx("path",{d:"M6 8h2.5"}),T.jsx("circle",{cx:"11",cy:"8",r:"2"}),T.jsx("path",{d:"M11 6.5v3M9.5 8h3"})]}),ks={select:{id:"select",label:"Select",hint:"Select / multi-select nodes",icon:qg,toggleable:!0,shortcut:"V"},pan:{id:"pan",label:"Pan",hint:"Pan the canvas",icon:Vg,toggleable:!0,shortcut:"H"},"add-node":{id:"add-node",label:"Add node",hint:"Click on the canvas to add a node",icon:Gg,toggleable:!0,shortcut:"N"},"add-link":{id:"add-link",label:"Add link",hint:"Click two nodes to connect them",icon:Wg,toggleable:!0,shortcut:"L"},delete:{id:"delete",label:"Delete",hint:"Delete selected node(s)",icon:_s,shortcut:"⌫"},fit:{id:"fit",label:"Fit",hint:"Fit graph to viewport",icon:Xg,shortcut:"F"},"zoom-in":{id:"zoom-in",label:"Zoom in",hint:"Zoom in",icon:Yg,shortcut:"+"},"zoom-out":{id:"zoom-out",label:"Zoom out",hint:"Zoom out",icon:Kg,shortcut:"-"},pause:{id:"pause",label:"Pause",hint:"Pause simulation",icon:Qg},resume:{id:"resume",label:"Resume",hint:"Resume simulation",icon:Zg},screenshot:{id:"screenshot",label:"Screenshot",hint:"Download a PNG of the canvas",icon:Jg},"toggle-mode":{id:"toggle-mode",label:"2D / 3D",hint:"Toggle between 2D and 3D",icon:xs,shortcut:"3"},duplicate:{id:"duplicate",label:"Duplicate",hint:"Duplicate the current selection",icon:ws,shortcut:"⌘D"},"select-all":{id:"select-all",label:"Select all",hint:"Select every node",icon:tv,shortcut:"⌘A"},"export-json":{id:"export-json",label:"Export",hint:"Download the graph as JSON",icon:nv},"import-json":{id:"import-json",label:"Import",hint:"Load a JSON graph from disk",icon:rv}},Ur=["select","pan","add-node","add-link","select-all","fit","zoom-in","zoom-out","pause","resume","screenshot","export-json","import-json"];function Cs(e){return e==="2d"?xs:ev}function ov(e,t){if(e===!1)return[];let n;if(e===!0)n=Ur;else if(Array.isArray(e))n=e;else{const r=e.include??Ur,i=new Set(e.exclude??[]);n=r.filter(o=>!i.has(o))}return n.filter(r=>r==="pause"?!t:r==="resume"?t:!0)}function av(e){return e&&typeof e=="object"&&!Array.isArray(e)?e.position??"top-right":"top-right"}function sv(e){const{config:t,activeTool:n,paused:r,mode:i,isDisabled:o,onSelect:a}=e,s=ov(t,r);if(s.length===0)return null;const l=av(t);return T.jsx("div",{className:`lgc-toolbar lgc-toolbar--${l}`,role:"toolbar",children:s.map(c=>{const f=ks[c],u=c==="toggle-mode"?Cs(i):f.icon,g=f.toggleable&&n===c,h=o?.(c)??!1,p=[f.hint,f.shortcut?`(${f.shortcut})`:""];return T.jsx("button",{type:"button",className:["lgc-tool",g?"lgc-tool--active":"",h?"lgc-tool--disabled":""].join(" ").trim(),"aria-label":f.label,"aria-pressed":g?"true":void 0,disabled:h,title:p.filter(Boolean).join(" "),onClick:()=>a(c),children:T.jsx(u,{})},c)})})}function lv({x:e,y:t,items:n,onClose:r}){const i=A.useRef(null);return A.useEffect(()=>{const o=a=>{a instanceof KeyboardEvent&&a.key!=="Escape"||a instanceof MouseEvent&&i.current&&i.current.contains(a.target)||r()};return window.addEventListener("mousedown",o),window.addEventListener("keydown",o),()=>{window.removeEventListener("mousedown",o),window.removeEventListener("keydown",o)}},[r]),T.jsx("div",{ref:i,className:"lgc-menu",role:"menu",style:{left:e,top:t},children:n.map((o,a)=>"separator"in o?T.jsx("div",{className:"lgc-menu-separator"},`sep-${a}`):T.jsxs("div",{role:"menuitem",className:"lgc-menu-item","aria-disabled":o.disabled?"true":void 0,onClick:()=>{o.disabled||(o.onSelect(),r())},children:[T.jsx("span",{children:o.label}),o.shortcut?T.jsx("span",{style:{marginLeft:"auto",opacity:.6},children:o.shortcut}):null]},o.id))})}function cv({content:e,hostRef:t}){const[n,r]=A.useState(null),i=A.useRef(null);if(A.useEffect(()=>{if(e===null){r(null),i.current=null;return}const s=t.current;if(!s)return;i.current=s.getBoundingClientRect();const l=f=>{const u=i.current??s.getBoundingClientRect();r({x:f.clientX-u.left,y:f.clientY-u.top})},c=()=>{i.current=s.getBoundingClientRect()};return s.addEventListener("mousemove",l),window.addEventListener("resize",c),()=>{s.removeEventListener("mousemove",l),window.removeEventListener("resize",c)}},[t,e]),e===null||n===null)return null;const o=n.x+14,a=n.y+14;return T.jsx("div",{className:"lgc-tooltip",role:"tooltip",style:{left:o,top:a,pointerEvents:"none"},children:typeof e=="string"?e:T.jsx("span",{ref:s=>s?.appendChild(e)})})}function uv({rect:e}){if(!e)return null;const t=Math.min(e.x0,e.x1),n=Math.min(e.y0,e.y1),r=Math.abs(e.x1-e.x0),i=Math.abs(e.y1-e.y0);return T.jsx("div",{className:"lgc-marquee",style:{left:t,top:n,width:r,height:i,pointerEvents:"none"}})}function fv(e){return T.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[T.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),T.jsx("path",{d:"M6 5h7v7"})]})}function dv(e){return T.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[T.jsx("circle",{cx:"5",cy:"11",r:"2"}),T.jsx("circle",{cx:"11",cy:"11",r:"2"}),T.jsx("path",{d:"M6.5 9.5L13 3M5 8L9.5 9.5"})]})}function Wo(e){return T.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[T.jsx("rect",{x:"3",y:"4",width:"10",height:"10",rx:"1"}),T.jsx("rect",{x:"5",y:"2",width:"6",height:"3",rx:"1"})]})}function ct({label:e,shortcut:t,disabled:n,onClick:r,children:i}){return T.jsx("button",{type:"button",className:"lgc-selpanel-btn","aria-label":e,title:t?`${e} (${t})`:e,disabled:n,onClick:r,children:i})}function hv({nodeCount:e,linkCount:t,hasClipboard:n,enableClipboard:r,onDelete:i,onDuplicate:o,onAddConnected:a,onCopy:s,onCut:l,onPaste:c,onClear:f}){if(e===0&&t===0)return!r||!n?null:T.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[T.jsx("span",{className:"lgc-selpanel-label",children:"Clipboard ready"}),T.jsx(ct,{label:"Paste",shortcut:"⌘V",onClick:c,children:T.jsx(Wo,{})})]});const u=[];e>0&&u.push(`${e} ${e===1?"node":"nodes"}`),t>0&&u.push(`${t} ${t===1?"link":"links"}`);const g=u.join(", ");return T.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[T.jsx("span",{className:"lgc-selpanel-label",children:g}),T.jsx("div",{className:"lgc-selpanel-divider"}),T.jsx(ct,{label:"Delete",shortcut:"⌫",onClick:i,children:T.jsx(_s,{width:14,height:14})}),T.jsx(ct,{label:"Duplicate",shortcut:"⌘D",onClick:o,children:T.jsx(ws,{width:14,height:14})}),T.jsx(ct,{label:"Connect to new node",shortcut:"↵",disabled:e===0,onClick:a,children:T.jsx(iv,{})}),r?T.jsxs(T.Fragment,{children:[T.jsx(ct,{label:"Copy",shortcut:"⌘C",disabled:e===0,onClick:s,children:T.jsx(fv,{})}),T.jsx(ct,{label:"Cut",shortcut:"⌘X",disabled:e===0,onClick:l,children:T.jsx(dv,{})}),T.jsx(ct,{label:"Paste",shortcut:"⌘V",disabled:!n,onClick:c,children:T.jsx(Wo,{})})]}):null,T.jsx("div",{className:"lgc-selpanel-divider"}),T.jsx(ct,{label:"Clear selection",shortcut:"Esc",onClick:f,children:"✕"})]})}const Xo=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];function pv(e,t){let n=0;for(let r=0;r<e.length;r++)n=n*31+e.charCodeAt(r)|0;return Math.abs(n)%t}function gv(e){return Xo[pv(e,Xo.length)]}function vv({nodes:e,groupBy:t,hidden:n,onToggle:r}){const i=A.useMemo(()=>{if(!t)return[];const o=new Set;for(const a of e){const s=typeof t=="function"?t(a):a[t];s!=null&&o.add(String(s))}return Array.from(o).sort()},[e,t]);return i.length===0?null:T.jsx("div",{className:"lgc-legend",role:"region","aria-label":"Groups",children:i.map(o=>{const a=n.has(o);return T.jsxs("button",{type:"button",className:["lgc-legend-item",a?"lgc-legend-item--hidden":""].join(" ").trim(),onClick:()=>r(o),"aria-pressed":a?"false":"true",title:`Toggle ${o}`,children:[T.jsx("span",{className:"lgc-legend-swatch",style:{background:gv(o)}}),T.jsx("span",{children:o})]},o)})})}function yv({mode:e,onToggle:t}){const n=Cs(e),r=e==="2d"?"3D":"2D";return T.jsxs("button",{type:"button",className:"lgc-mode-toggle",onClick:t,"aria-label":`Switch to ${r}`,title:`Switch to ${r} (3)`,children:[T.jsx(n,{width:14,height:14}),T.jsx("span",{className:"lgc-mode-toggle-label",children:e.toUpperCase()})]})}function mv(e){return T.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[T.jsx("circle",{cx:"8",cy:"8",r:"2.4"}),T.jsx("path",{d:"M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.4 1.4M11.55 11.55l1.4 1.4M3.05 12.95l1.4-1.4M11.55 4.45l1.4-1.4"})]})}function bv({items:e}){const[t,n]=A.useState(!1),r=A.useRef(null);return A.useEffect(()=>{if(!t)return;const i=a=>{r.current&&!r.current.contains(a.target)&&n(!1)},o=a=>{a.key==="Escape"&&n(!1)};return window.addEventListener("mousedown",i),window.addEventListener("keydown",o),()=>{window.removeEventListener("mousedown",i),window.removeEventListener("keydown",o)}},[t]),e.length===0?null:T.jsxs("div",{ref:r,className:"lgc-options-menu",children:[T.jsx("button",{type:"button",className:"lgc-options-trigger","aria-label":"Options","aria-expanded":t,title:"Options",onClick:()=>n(i=>!i),children:T.jsx(mv,{})}),t?T.jsx("div",{className:"lgc-options-panel",role:"menu",children:e.map(i=>i.kind==="select"?T.jsxs("div",{className:"lgc-options-item",children:[T.jsxs("span",{className:"lgc-options-item-text",children:[T.jsx("span",{className:"lgc-options-item-label",children:i.label}),i.hint?T.jsx("span",{className:"lgc-options-item-hint",children:i.hint}):null]}),T.jsx("select",{className:"lgc-options-select",value:i.value,onChange:o=>i.onChange(o.target.value),children:i.options.map(o=>T.jsx("option",{value:o.value,children:o.label??o.value},o.value))})]},i.id):T.jsxs("label",{className:"lgc-options-item",children:[T.jsx("input",{type:"checkbox",checked:i.checked,onChange:o=>i.onChange(o.target.checked)}),T.jsxs("span",{className:"lgc-options-item-text",children:[T.jsx("span",{className:"lgc-options-item-label",children:i.label}),i.hint?T.jsx("span",{className:"lgc-options-item-hint",children:i.hint}):null]})]},i.id))}):null]})}function _v(e,t,n={}){const r=n.spacing??50,i=n.color??"rgba(0,0,0,0.06)",o=e.canvas,s=e.getTransform().inverse(),l=s.transformPoint({x:0,y:0}),c=s.transformPoint({x:o.width,y:o.height}),f=Math.floor(l.x/r)*r,u=Math.ceil(c.x/r)*r,g=Math.floor(l.y/r)*r,h=Math.ceil(c.y/r)*r;e.save(),e.strokeStyle=i,e.lineWidth=1/t,e.beginPath();for(let p=f;p<=u;p+=r)e.moveTo(p,g),e.lineTo(p,h);for(let p=g;p<=h;p+=r)e.moveTo(f,p),e.lineTo(u,p);e.stroke(),e.restore()}const Yo=15,xv={background:"--lgc-bg",foreground:"--lgc-fg",border:"--lgc-border",accent:"--lgc-accent",toolbarBackground:"--lgc-toolbar-bg",toolbarForeground:"--lgc-toolbar-fg",toolbarBorder:"--lgc-toolbar-border",toolActiveBackground:"--lgc-tool-active-bg",toolHoverBackground:"--lgc-tool-hover-bg",tooltipBackground:"--lgc-tooltip-bg",tooltipForeground:"--lgc-tooltip-fg",menuBackground:"--lgc-menu-bg",menuForeground:"--lgc-menu-fg",menuHoverBackground:"--lgc-menu-hover-bg",fontFamily:"--lgc-font",fontSize:"--lgc-font-size"};function wv(e){if(!e)return{};const t={};for(const[n,r]of Object.entries(e)){if(r===void 0)continue;const i=xv[n];i&&(t[i]=String(r))}return t}function Ss(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function kv(e){e&&e.toBlob(t=>{t&&Ss(t,`lora-graph-${Date.now()}.png`)})}function Cv(e,t){const{data:n,defaultData:r,onDataChange:i,mode:o,defaultMode:a,onModeChange:s,width:l,height:c,className:f,style:u,theme:g,tools:h=!0,selection:p="multi",showContextMenu:v=!0,showLegend:y=!1,showGrid:d=!1,showLabels:b=!1,enableClipboard:m=!0,enableTooltip:x=!1,introZoom:w=!0,focusOnClick:_=!1,highlightNeighborsOnHover:k=!0,autoIndexNeighbors:C=k,collideNodes:P=!1,fixOnDrop:M=!0,beeswarm:N=!1,onSelectionChange:E,onNodeClick:B,onNodeRightClick:S,onLinkClick:O,onLinkRightClick:L,onBackgroundClick:U,onBackgroundRightClick:ne,onNodeDrag:J,onNodeDragEnd:se,onNodeHover:D,onLinkHover:$,onNodeDoubleClick:G,onCopy:Z,onCut:I,onPaste:H,onRenderFramePre:z,nodeColor:F,nodeLabel:R,nodeVal:q,nodeAutoColorBy:V,nodeRelSize:re,nodeVisibility:le,nodeCanvasObject:ce,linkColor:Se,linkLabel:me,linkWidth:Te,linkHoverPrecision:ze,backgroundColor:Ke,enableNavigationControls:Fe,performanceProfile:di,dagMode:xt}=e,[dn,hn]=A.useState(o??a??"2d"),Be=o!==void 0,ve=Be?o:dn,hi=A.useRef(null),pt=A.useCallback(j=>{j!==ve&&(hi.current?.(),Be||hn(j),s?.(j))},[ve,Be,s]),ee=ll({...n!==void 0?{controlled:n}:{},...r!==void 0?{defaultData:r}:{},...i?{onChange:i}:{}});Og(C,ee.data);const fe=Mg({mode:p,...E?{onChange:E}:{}}),[Ge,Xn]=A.useState("select"),[pi,Yn]=A.useState(!1),Ps=Ig({highlightNeighborsOnHover:k,...R!==void 0?{nodeLabel:R}:{},...me!==void 0?{linkLabel:me}:{},...D?{onNodeHover:D}:{},...$?{onLinkHover:$}:{}}),{hoverNodeId:Os,hoverLinkId:As,liveHoverNodeIdRef:js,highlightedNodeIds:Ts,highlightedLinkIds:Es,hoveredNodeSet:Ls,hoveredLinkSet:Ns,tooltipContent:Rs,handleNodeHover:gi,handleLinkHover:vi,pinHover:pn}=Ps,[yi,Is]=A.useState(()=>new Set),[wt,mi]=A.useState(!!_),[gn,bi]=A.useState(!!b),[vn,_i]=A.useState(xt??null);A.useEffect(()=>{mi(!!_)},[_]),A.useEffect(()=>{bi(!!b)},[b]),A.useEffect(()=>{_i(xt??null)},[xt]);const et=A.useRef(null),[Bt,yn]=A.useState(null),[$t,mn]=A.useState(null),[bn,gt]=A.useState(null),[tt,$e]=A.useState([]),[_n,kt]=A.useState(null),Ds=Pg(),Ct=A.useRef(null),Kn=A.useRef(null),[Qn,zs]=A.useState(null),Fs=A.useCallback(j=>{Kn.current=j,zs(j)},[]),xi=Sg(Ct),Zn=l??xi?.width??600,Jn=c??xi?.height??400,Ee=A.useRef(null),{marquee:wi,lastCursorRef:Bs}=Ag({mount:Qn,engineRef:Ee,selection:fe,nodes:ee.data.nodes,links:ee.data.links,setSelectedLinkIds:$e,liveHoverNodeIdRef:js});Tg(Qn);const Me=Eg({enableClipboard:m,dataApi:ee,selection:fe,setSelectedLinkIds:$e,engineRef:Ee,lastCursorRef:Bs,...Z?{onCopy:Z}:{},...I?{onCut:I}:{},...H?{onPaste:H}:{}}),ki=A.useRef(null),Ci=A.useCallback((j,W)=>{B?.(j,W);const Y=performance.now(),be=ki.current,de=be&&be.id===j.id&&Y-be.at<280;if(ki.current={id:j.id,at:Y},de){G?.(j,W);return}if(Ge==="add-link"&&j.id!==void 0){bn===null?gt(j.id):(bn!==j.id&&ee.addLink({source:bn,target:j.id}),gt(null));return}if(p!=="none"&&j.id!==void 0){const oe=W.shiftKey||W.ctrlKey||W.metaKey;fe.toggle(j.id,{additive:oe}),oe||$e([])}if(wt&&j.id!==void 0&&Ee.current){const oe=Ee.current;Bt===j.id?(et.current&&oe.setCameraState(et.current,800),yn(null),et.current=null):(Bt===null&&$t===null&&(et.current=oe.getCameraState()),oe.focusOn({x:j.x??0,y:j.y??0,z:j.z??0},{distance:120,zoom:8,durationMs:1e3}),yn(j.id),mn(null))}},[B,G,fe,p,Ge,bn,ee,wt,Bt,$t]),Si=A.useCallback(j=>{if(U?.(j),Ee.current?.stopAnimation(),Ge==="add-node"){const Y=Kn.current?.getBoundingClientRect(),be=Y?j.clientX-Y.left:j.clientX,de=Y?j.clientY-Y.top:j.clientY,oe=Ee.current?.screen2Graph(be,de)??{x:be,y:de};ee.addNode(void 0,{at:{x:oe.x,y:oe.y,...oe.z!==void 0?{z:oe.z}:{}}});return}Ge==="add-link"&>(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;
|
|
685
|
+
//# sourceMappingURL=index.cjs.map
|