m&&(O.dx*=m/A,O.dy*=m/A),S.fromGraph(r,N)?O.fixed=!0:(O.x+=O.dx,O.y+=O.dy,O.fixed=!1)}return{converged:x}},sm}var gd={},RN;function f4(){return RN||(RN=1,gd.assignLayoutChanges=function(e,t,n){const{nodeXAttribute:r,nodeYAttribute:a}=n;e.updateEachNodeAttributes((o,s)=>{const u=t[o];return!u||u.fixed||(s[r]=u.x,s[a]=u.y),s},{attributes:["x","y"]})},gd.collectLayoutChanges=function(e){const t={};for(const n in e){const r=e[n];t[n]={x:r.x,y:r.y}}return t}),gd}var lm,CN;function p4(){return CN||(CN=1,lm={nodeXAttribute:"x",nodeYAttribute:"y",isNodeFixed:"fixed",shouldSkipNode:null,shouldSkipEdge:null,settings:{attraction:5e-4,repulsion:.1,gravity:1e-4,inertia:.6,maxMove:200}}),lm}var um,NN;function Gee(){if(NN)return um;NN=1;const e=aa(),t=Pu(),n=d4(),r=f4(),a=p4();function o(u,c,d){if(!e(c))throw new Error("graphology-layout-force: the given graph is not a valid graphology instance.");typeof d=="number"?d={maxIterations:d}:d=d||{};const p=d.maxIterations;if(d=t(d,a),typeof p!="number"||p<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");const g={};let m=null,b;for(b=0;bthis.runFrame())},o.prototype.stop=function(){return this.running=!1,this.frameID!==null&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},o.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-force/worker.start: layout was killed.");this.running||(this.running=!0,this.runFrame())},o.prototype.kill=function(){this.stop(),delete this.nodeStates,this.killed=!0},cm=o,cm}var Vee=qee();const Wee=un(Vee);function Yee(e={maxIterations:100}){return Gs($ee,e)}function Kee(e={}){return V0(Wee,e)}var dm,DN;function Xee(){if(DN)return dm;DN=1;var e=0,t=1,n=2,r=3,a=4,o=5,s=6,u=7,c=8,d=9,p=0,g=1,m=2,b=0,v=1,S=2,k=3,R=4,x=5,_=6,N=7,O=8,A=3,C=10,F=3,I=9,L=10;return dm=function($,U,W){var Z,G,j,P,Y,D,V,B,M,K,J=U.length,le=W.length,oe=$.adjustSizes,Q=$.barnesHutTheta*$.barnesHutTheta,ge,re,Ee,we,De,Re,Se,ee=[];for(j=0;jNe?(be-=(me-Ne)/2,xe=be+me):(fe-=(Ne-me)/2,Te=fe+Ne),ee[0+b]=-1,ee[0+v]=(fe+Te)/2,ee[0+S]=(be+xe)/2,ee[0+k]=Math.max(Te-fe,xe-be),ee[0+R]=-1,ee[0+x]=-1,ee[0+_]=0,ee[0+N]=0,ee[0+O]=0,Z=1,j=0;j=0){U[j+e]=0)if(Re=Math.pow(U[j+e]-ee[G+N],2)+Math.pow(U[j+t]-ee[G+O],2),K=ee[G+k],4*K*K/Re0?(Se=re*U[j+s]*ee[G+_]/Re,U[j+n]+=Ee*Se,U[j+r]+=we*Se):Re<0&&(Se=-re*U[j+s]*ee[G+_]/Math.sqrt(Re),U[j+n]+=Ee*Se,U[j+r]+=we*Se):Re>0&&(Se=re*U[j+s]*ee[G+_]/Re,U[j+n]+=Ee*Se,U[j+r]+=we*Se),G=ee[G+R],G<0)break;continue}else{G=ee[G+x];continue}else{if(D=ee[G+b],D>=0&&D!==j&&(Ee=U[j+e]-U[D+e],we=U[j+t]-U[D+t],Re=Ee*Ee+we*we,oe===!0?Re>0?(Se=re*U[j+s]*U[D+s]/Re,U[j+n]+=Ee*Se,U[j+r]+=we*Se):Re<0&&(Se=-re*U[j+s]*U[D+s]/Math.sqrt(Re),U[j+n]+=Ee*Se,U[j+r]+=we*Se):Re>0&&(Se=re*U[j+s]*U[D+s]/Re,U[j+n]+=Ee*Se,U[j+r]+=we*Se)),G=ee[G+R],G<0)break;continue}else for(re=$.scalingRatio,P=0;P0?(Se=re*U[P+s]*U[Y+s]/Re/Re,U[P+n]+=Ee*Se,U[P+r]+=we*Se,U[Y+n]-=Ee*Se,U[Y+r]-=we*Se):Re<0&&(Se=100*re*U[P+s]*U[Y+s],U[P+n]+=Ee*Se,U[P+r]+=we*Se,U[Y+n]-=Ee*Se,U[Y+r]-=we*Se)):(Re=Math.sqrt(Ee*Ee+we*we),Re>0&&(Se=re*U[P+s]*U[Y+s]/Re/Re,U[P+n]+=Ee*Se,U[P+r]+=we*Se,U[Y+n]-=Ee*Se,U[Y+r]-=we*Se));for(M=$.gravity/$.scalingRatio,re=$.scalingRatio,j=0;j0&&(Se=re*U[j+s]*M):Re>0&&(Se=re*U[j+s]*M/Re),U[j+n]-=Ee*Se,U[j+r]-=we*Se;for(re=1*($.outboundAttractionDistribution?ge:1),V=0;V0&&(Se=-re*De*Math.log(1+Re)/Re/U[P+s]):Re>0&&(Se=-re*De*Math.log(1+Re)/Re):$.outboundAttractionDistribution?Re>0&&(Se=-re*De/U[P+s]):Re>0&&(Se=-re*De)):(Re=Math.sqrt(Math.pow(Ee,2)+Math.pow(we,2)),$.linLogMode?$.outboundAttractionDistribution?Re>0&&(Se=-re*De*Math.log(1+Re)/Re/U[P+s]):Re>0&&(Se=-re*De*Math.log(1+Re)/Re):$.outboundAttractionDistribution?(Re=1,Se=-re*De/U[P+s]):(Re=1,Se=-re*De)),Re>0&&(U[P+n]+=Ee*Se,U[P+r]+=we*Se,U[Y+n]-=Ee*Se,U[Y+r]-=we*Se);var te,ce,Ce,Fe,We,yt;if(oe===!0)for(j=0;jL&&(U[j+n]=U[j+n]*L/te,U[j+r]=U[j+r]*L/te),ce=U[j+s]*Math.sqrt((U[j+a]-U[j+n])*(U[j+a]-U[j+n])+(U[j+o]-U[j+r])*(U[j+o]-U[j+r])),Ce=Math.sqrt((U[j+a]+U[j+n])*(U[j+a]+U[j+n])+(U[j+o]+U[j+r])*(U[j+o]+U[j+r]))/2,Fe=.1*Math.log(1+Ce)/(1+Math.sqrt(ce)),We=U[j+e]+U[j+n]*(Fe/$.slowDown),U[j+e]=We,yt=U[j+t]+U[j+r]*(Fe/$.slowDown),U[j+t]=yt);else for(j=0;j=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in n&&typeof n.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in n&&!(typeof n.gravity=="number"&&n.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in n&&!(typeof n.slowDown=="number"||n.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in n&&typeof n.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in n&&!(typeof n.barnesHutTheta=="number"&&n.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},Ra.graphToByteArrays=function(n,r){var a=n.order,o=n.size,s={},u,c=new Float32Array(a*e),d=new Float32Array(o*t);return u=0,n.forEachNode(function(p,g){s[p]=u,c[u]=g.x,c[u+1]=g.y,c[u+2]=0,c[u+3]=0,c[u+4]=0,c[u+5]=0,c[u+6]=1,c[u+7]=1,c[u+8]=g.size||1,c[u+9]=g.fixed?1:0,u+=e}),u=0,n.forEachEdge(function(p,g,m,b,v,S,k){var R=s[m],x=s[b],_=r(p,g,m,b,v,S,k);c[R+6]+=_,c[x+6]+=_,d[u]=R,d[u+1]=x,d[u+2]=_,u+=t}),{nodes:c,edges:d}},Ra.assignLayoutChanges=function(n,r,a){var o=0;n.updateEachNodeAttributes(function(s,u){return u.x=r[o],u.y=r[o+1],o+=e,a?a(s,u):u})},Ra.readGraphPositions=function(n,r){var a=0;n.forEachNode(function(o,s){r[a]=s.x,r[a+1]=s.y,a+=e})},Ra.collectLayoutChanges=function(n,r,a){for(var o=n.nodes(),s={},u=0,c=0,d=r.length;u2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(d)}}var u=o.bind(null,!1);return u.assign=o.bind(null,!0),u.inferSettings=s,pm=u,pm}var Qee=Zee();const Jee=un(Qee);var gm,FN;function ete(){return FN||(FN=1,gm=function(){var t,n,r={};(function(){var o=0,s=1,u=2,c=3,d=4,p=5,g=6,m=7,b=8,v=9,S=0,k=1,R=2,x=0,_=1,N=2,O=3,A=4,C=5,F=6,I=7,L=8,H=3,$=10,U=3,W=9,Z=10;r.exports=function(j,P,Y){var D,V,B,M,K,J,le,oe,Q,ge,re=P.length,Ee=Y.length,we=j.adjustSizes,De=j.barnesHutTheta*j.barnesHutTheta,Re,Se,ee,fe,Te,be,xe,se=[];for(B=0;BWe?(me-=(Fe-We)/2,Ne=me+Fe):(Pe-=(We-Fe)/2,ze=Pe+We),se[0+x]=-1,se[0+_]=(Pe+ze)/2,se[0+N]=(me+Ne)/2,se[0+O]=Math.max(ze-Pe,Ne-me),se[0+A]=-1,se[0+C]=-1,se[0+F]=0,se[0+I]=0,se[0+L]=0,D=1,B=0;B=0){P[B+o]=0)if(be=Math.pow(P[B+o]-se[V+I],2)+Math.pow(P[B+s]-se[V+L],2),ge=se[V+O],4*ge*ge/be0?(xe=Se*P[B+g]*se[V+F]/be,P[B+u]+=ee*xe,P[B+c]+=fe*xe):be<0&&(xe=-Se*P[B+g]*se[V+F]/Math.sqrt(be),P[B+u]+=ee*xe,P[B+c]+=fe*xe):be>0&&(xe=Se*P[B+g]*se[V+F]/be,P[B+u]+=ee*xe,P[B+c]+=fe*xe),V=se[V+A],V<0)break;continue}else{V=se[V+C];continue}else{if(J=se[V+x],J>=0&&J!==B&&(ee=P[B+o]-P[J+o],fe=P[B+s]-P[J+s],be=ee*ee+fe*fe,we===!0?be>0?(xe=Se*P[B+g]*P[J+g]/be,P[B+u]+=ee*xe,P[B+c]+=fe*xe):be<0&&(xe=-Se*P[B+g]*P[J+g]/Math.sqrt(be),P[B+u]+=ee*xe,P[B+c]+=fe*xe):be>0&&(xe=Se*P[B+g]*P[J+g]/be,P[B+u]+=ee*xe,P[B+c]+=fe*xe)),V=se[V+A],V<0)break;continue}else for(Se=j.scalingRatio,M=0;M0?(xe=Se*P[M+g]*P[K+g]/be/be,P[M+u]+=ee*xe,P[M+c]+=fe*xe,P[K+u]-=ee*xe,P[K+c]-=fe*xe):be<0&&(xe=100*Se*P[M+g]*P[K+g],P[M+u]+=ee*xe,P[M+c]+=fe*xe,P[K+u]-=ee*xe,P[K+c]-=fe*xe)):(be=Math.sqrt(ee*ee+fe*fe),be>0&&(xe=Se*P[M+g]*P[K+g]/be/be,P[M+u]+=ee*xe,P[M+c]+=fe*xe,P[K+u]-=ee*xe,P[K+c]-=fe*xe));for(Q=j.gravity/j.scalingRatio,Se=j.scalingRatio,B=0;B0&&(xe=Se*P[B+g]*Q):be>0&&(xe=Se*P[B+g]*Q/be),P[B+u]-=ee*xe,P[B+c]-=fe*xe;for(Se=1*(j.outboundAttractionDistribution?Re:1),le=0;le0&&(xe=-Se*Te*Math.log(1+be)/be/P[M+g]):be>0&&(xe=-Se*Te*Math.log(1+be)/be):j.outboundAttractionDistribution?be>0&&(xe=-Se*Te/P[M+g]):be>0&&(xe=-Se*Te)):(be=Math.sqrt(Math.pow(ee,2)+Math.pow(fe,2)),j.linLogMode?j.outboundAttractionDistribution?be>0&&(xe=-Se*Te*Math.log(1+be)/be/P[M+g]):be>0&&(xe=-Se*Te*Math.log(1+be)/be):j.outboundAttractionDistribution?(be=1,xe=-Se*Te/P[M+g]):(be=1,xe=-Se*Te)),be>0&&(P[M+u]+=ee*xe,P[M+c]+=fe*xe,P[K+u]-=ee*xe,P[K+c]-=fe*xe);var yt,wt,ht,et,kt,ot;if(we===!0)for(B=0;BZ&&(P[B+u]=P[B+u]*Z/yt,P[B+c]=P[B+c]*Z/yt),wt=P[B+g]*Math.sqrt((P[B+d]-P[B+u])*(P[B+d]-P[B+u])+(P[B+p]-P[B+c])*(P[B+p]-P[B+c])),ht=Math.sqrt((P[B+d]+P[B+u])*(P[B+d]+P[B+u])+(P[B+p]+P[B+c])*(P[B+p]+P[B+c]))/2,et=.1*Math.log(1+ht)/(1+Math.sqrt(wt)),kt=P[B+o]+P[B+u]*(et/j.slowDown),P[B+o]=kt,ot=P[B+s]+P[B+c]*(et/j.slowDown),P[B+s]=ot);else for(B=0;B1&&Ee.has(xe))&&(P>1&&Ee.add(xe),Se=c[De+e],fe=c[De+t],be=c[De+n],se=Se-Re,Pe=fe-ee,ze=Math.sqrt(se*se+Pe*Pe),me=ze0?(C[De]+=se/ze*(1+Te),F[De]+=Pe/ze*(1+Te)):(C[De]+=U*o(),F[De]+=W*o())));for(v=0,S=0;v1&&Se.has(me))&&(B>1&&Se.add(me),be=m[fe+a],se=m[fe+o],ze=m[fe+s],Ne=be-Te,te=se-xe,ce=Math.sqrt(Ne*Ne+te*te),Ce=ce0?(H[fe]+=Ne/ce*(1+Pe),$[fe]+=te/ce*(1+Pe)):(H[fe]+=j*d(),$[fe]+=P*d())));for(x=0,_=0;x=0;)g=Sk(e,t,n,r,d+1,o+1,s),g>p&&(d===a?g*=qN:kte.test(e.charAt(d-1))?(g*=Ste,b=e.slice(a,d-1).match(Tte),b&&a>0&&(g*=Math.pow(xm,b.length))):Ate.test(e.charAt(d-1))?(g*=vte,v=e.slice(a,d-1).match(y4),v&&a>0&&(g*=Math.pow(xm,v.length))):(g*=Ete,a>0&&(g*=Math.pow(xm,d-a))),e.charAt(d)!==t.charAt(o)&&(g*=wte)),(gg&&(g=m*wm)),g>p&&(p=g),d=n.indexOf(c,d+1);return s[u]=p,p}function VN(e){return e.toLowerCase().replace(y4," ")}function _te(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Sk(e,t,VN(e),VN(t),0,0,{})}var km={exports:{}},Tm={};/**
+`);return a}var l4=.25,Aee={arrowHead:null,curvatureAttribute:"curvature",defaultCurvature:l4},u4=WebGLRenderingContext,SN=u4.UNSIGNED_BYTE,po=u4.FLOAT;function q0(e){var t=lf(lf({},Aee),e||{}),n=t,r=n.arrowHead,a=n.curvatureAttribute,o=n.drawLabel,s=(r==null?void 0:r.extremity)==="target"||(r==null?void 0:r.extremity)==="both",u=(r==null?void 0:r.extremity)==="source"||(r==null?void 0:r.extremity)==="both",c=["u_matrix","u_sizeRatio","u_dimensions","u_pixelRatio","u_feather","u_minEdgeThickness"].concat(tm(r?["u_lengthToThicknessRatio","u_widenessToThicknessRatio"]:[]));return function(d){bee(p,d);function p(){var g;fee(this,p);for(var m=arguments.length,b=new Array(m),v=0;v{const n=this.nodeIdMap[t];if(n!==void 0)return this.nodes[n]});Aa(this,"getEdge",(t,n=!0)=>{const r=n?this.edgeDynamicIdMap[t]:this.edgeIdMap[t];if(r!==void 0)return this.edges[r]});Aa(this,"buildDynamicMap",()=>{this.edgeDynamicIdMap={};for(let t=0;t({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,moveToSelectedNode:!1,isFetching:!1,shouldRender:!1,graphDataFetchAttempted:!1,labelsFetchAttempted:!1,rawGraph:null,sigmaGraph:null,sigmaInstance:null,allDatabaseLabels:["*"],setIsFetching:n=>e({isFetching:n}),setShouldRender:n=>e({shouldRender:n}),setSelectedNode:(n,r)=>e({selectedNode:n,moveToSelectedNode:r}),setFocusedNode:n=>e({focusedNode:n}),setSelectedEdge:n=>e({selectedEdge:n}),setFocusedEdge:n=>e({focusedEdge:n}),clearSelection:()=>e({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null}),reset:()=>{e({selectedNode:null,focusedNode:null,selectedEdge:null,focusedEdge:null,rawGraph:null,sigmaGraph:null,moveToSelectedNode:!1,shouldRender:!1})},setRawGraph:n=>e({rawGraph:n}),setSigmaGraph:n=>{e({sigmaGraph:n})},setAllDatabaseLabels:n=>e({allDatabaseLabels:n}),fetchAllDatabaseLabels:async()=>{try{console.log("Fetching all database labels...");const n=await tB();e({allDatabaseLabels:["*",...n]});return}catch(n){throw console.error("Failed to fetch all database labels:",n),e({allDatabaseLabels:["*"]}),n}},setMoveToSelectedNode:n=>e({moveToSelectedNode:n}),setSigmaInstance:n=>e({sigmaInstance:n}),setGraphDataFetchAttempted:n=>e({graphDataFetchAttempted:n}),setLabelsFetchAttempted:n=>e({labelsFetchAttempted:n}),nodeToExpand:null,nodeToPrune:null,triggerNodeExpand:n=>e({nodeToExpand:n}),triggerNodePrune:n=>e({nodeToPrune:n}),expandNode:async n=>{const r=t();if(!r.sigmaGraph||!r.rawGraph||!n){console.error("Cannot expand node: graph or node not available");return}try{r.setIsFetching(!0);const{queryGraphs:a}=await lz(async()=>{const{queryGraphs:v}=await Promise.resolve().then(()=>l7);return{queryGraphs:v}},void 0,import.meta.url),o=r.rawGraph.getNode(n);if(!o){console.error("Node not found:",n),r.setIsFetching(!1);return}const s=o.labels[0];if(!s){console.error("Node has no label:",n),r.setIsFetching(!1);return}const u=await a(s,2,0);if(!u||!u.nodes||!u.edges){console.error("Failed to fetch extended graph"),r.setIsFetching(!1);return}const c=[];for(const v of u.nodes){const S=()=>Math.floor(Math.random()*256),k=`rgb(${S()}, ${S()}, ${S()})`;c.push({id:v.id,labels:v.labels,properties:v.properties,size:10,x:Math.random(),y:Math.random(),color:k,degree:0})}const d=[];for(const v of u.edges)d.push({id:v.id,source:v.source,target:v.target,type:v.type,properties:v.properties,dynamicId:""});const p={};r.sigmaGraph.forEachNode(v=>{p[v]={x:r.sigmaGraph.getNodeAttribute(v,"x"),y:r.sigmaGraph.getNodeAttribute(v,"y")}});const g=new Set(r.sigmaGraph.nodes()),m=new Map;for(const v of c)m.set(v.id,v);const b=new Map;for(const v of d)b.set(v.id,v);for(const v of c){if(g.has(v.id))continue;d.some(k=>k.source===n&&k.target===v.id||k.target===n&&k.source===v.id)&&(r.sigmaGraph.addNode(v.id,{label:v.labels.join(", "),color:v.color,x:p[n].x+(Math.random()-.5)*.5,y:p[n].y+(Math.random()-.5)*.5,size:v.size,borderColor:"#000",borderSize:.2}),r.rawGraph.getNode(v.id)||(r.rawGraph.nodes.push(v),r.rawGraph.nodeIdMap[v.id]=r.rawGraph.nodes.length-1))}for(const v of d)if(r.sigmaGraph.hasNode(v.source)&&r.sigmaGraph.hasNode(v.target)){if(r.sigmaGraph.hasEdge(v.source,v.target))continue;v.dynamicId=r.sigmaGraph.addDirectedEdge(v.source,v.target,{label:v.type||void 0}),r.rawGraph.getEdge(v.id,!1)||(r.rawGraph.edges.push(v),r.rawGraph.edgeIdMap[v.id]=r.rawGraph.edges.length-1,r.rawGraph.edgeDynamicIdMap[v.dynamicId]=r.rawGraph.edges.length-1)}r.rawGraph.buildDynamicMap(),Object.entries(p).forEach(([v,S])=>{r.sigmaGraph.hasNode(v)&&(r.sigmaGraph.setNodeAttribute(v,"x",S.x),r.sigmaGraph.setNodeAttribute(v,"y",S.y))})}catch(a){console.error("Error expanding node:",a)}finally{r.setIsFetching(!1)}},pruneNode:n=>{const r=t();if(!r.sigmaGraph||!r.rawGraph||!n){console.error("Cannot prune node: graph or node not available");return}try{if(!r.sigmaGraph.hasNode(n)){console.error("Node not found:",n);return}(r.selectedNode===n||r.focusedNode===n)&&r.clearSelection(),r.sigmaGraph.dropNode(n);const a=r.rawGraph.nodeIdMap[n];if(a!==void 0){const o=r.rawGraph.edges.filter(s=>s.source===n||s.target===n);for(const s of o){const u=r.rawGraph.edgeIdMap[s.id];if(u!==void 0){r.rawGraph.edges.splice(u,1);for(const[c,d]of Object.entries(r.rawGraph.edgeIdMap))d>u&&(r.rawGraph.edgeIdMap[c]=d-1);delete r.rawGraph.edgeIdMap[s.id],delete r.rawGraph.edgeDynamicIdMap[s.dynamicId]}}r.rawGraph.nodes.splice(a,1);for(const[s,u]of Object.entries(r.rawGraph.nodeIdMap))u>a&&(r.rawGraph.nodeIdMap[s]=u-1);delete r.rawGraph.nodeIdMap[n],r.rawGraph.buildDynamicMap()}}catch(a){console.error("Error pruning node:",a)}}})),$e=Kk(Nee),Oee=({node:e,move:t})=>{const n=wr(),{gotoNode:r}=Kj();return T.useEffect(()=>{const a=n.getGraph();if(t){if(e&&a.hasNode(e))try{a.setNodeAttribute(e,"highlighted",!0),r(e)}catch(o){console.error("Error focusing on node:",o)}else n.setCustomBBox(null),n.getCamera().animate({x:.5,y:.5,ratio:1},{duration:0});$e.getState().setMoveToSelectedNode(!1)}else if(e&&a.hasNode(e))try{a.setNodeAttribute(e,"highlighted",!0)}catch(o){console.error("Error highlighting node:",o)}return()=>{if(e&&a.hasNode(e))try{a.setNodeAttribute(e,"highlighted",!1)}catch(o){console.error("Error cleaning up node highlight:",o)}}},[e,t,n,r]),null};function Gs(e,t){const n=wr(),r=T.useRef(t);return Fu(r.current,t)||(r.current=t),{positions:T.useCallback(()=>r.current?e(n.getGraph(),r.current):{},[n,r,e]),assign:T.useCallback(()=>{r.current&&e.assign(n.getGraph(),r.current)},[n,r,e])}}function V0(e,t){const n=wr(),[r,a]=T.useState(!1),[o,s]=T.useState(null),u=T.useRef(t);return Fu(u.current,t)||(u.current=t),T.useEffect(()=>{a(!1);let c=null;return u.current&&(c=new e(n.getGraph(),u.current)),s(c),()=>{c!==null&&c.kill()}},[n,u,s,a,e]),{stop:T.useCallback(()=>{o&&(o.stop(),a(!1))},[o,a]),start:T.useCallback(()=>{o&&(o.start(),a(!0))},[o,a]),kill:T.useCallback(()=>{o&&o.kill(),a(!1)},[o,a]),isRunning:r}}var nm,EN;function Pu(){if(EN)return nm;EN=1;function e(n){return!n||typeof n!="object"||typeof n=="function"||Array.isArray(n)||n instanceof Set||n instanceof Map||n instanceof RegExp||n instanceof Date}function t(n,r){n=n||{};var a={};for(var o in r){var s=n[o],u=r[o];if(!e(u)){a[o]=t(s,u);continue}s===void 0?a[o]=u:a[o]=s}return a}return nm=t,nm}var rm,wN;function Dee(){if(wN)return rm;wN=1;function e(n){return function(r,a){return r+Math.floor(n()*(a-r+1))}}var t=e(Math.random);return t.createRandom=e,rm=t,rm}var am,xN;function Iee(){if(xN)return am;xN=1;var e=Dee().createRandom;function t(r){var a=e(r);return function(o){for(var s=o.length,u=s-1,c=-1;++c0},a.prototype.addChild=function(N,F){this.children[N]=F,++this.countChildren},a.prototype.getChild=function(N){if(!this.children.hasOwnProperty(N)){var F=new a;this.children[N]=F,++this.countChildren}return this.children[N]},a.prototype.applyPositionToChildren=function(){if(this.hasChildren()){var N=this;for(var F in N.children){var I=N.children[F];I.x+=N.x,I.y+=N.y,I.applyPositionToChildren()}}};function o(N,F,I){for(var L in F.children){var G=F.children[L];G.hasChildren()?o(N,G,I):I[G.id]={x:G.x,y:G.y}}}function s(N,F){var I=N.r-F.r,L=F.x-N.x,G=F.y-N.y;return I<0||I*I0&&I*I>L*L+G*G}function c(N,F){for(var I=0;IZ?(G=(j+Z-$)/(2*j),W=Math.sqrt(Math.max(0,Z/j-G*G)),I.x=N.x-G*L-W*U,I.y=N.y-G*U+W*L):(G=(j+$-Z)/(2*j),W=Math.sqrt(Math.max(0,$/j-G*G)),I.x=F.x+G*L-W*U,I.y=F.y+G*U+W*L)):(I.x=F.x+I.r,I.y=F.y)}function R(N,F){var I=N.r+F.r-1e-6,L=F.x-N.x,G=F.y-N.y;return I>0&&I*I>L*L+G*G}function x(N,F){var I=N.length;if(I===0)return 0;var L,G,$,U,W,Z,j,H,z,Y;if(L=N[0],L.x=0,L.y=0,I<=1)return L.r;if(G=N[1],L.x=-G.r,G.x=L.r,G.y=0,I<=2)return L.r+G.r;$=N[2],k(G,L,$),L=new a(null,null,null,null,L),G=new a(null,null,null,null,G),$=new a(null,null,null,null,$),L.next=$.previous=G,G.next=L.previous=$,$.next=G.previous=L;e:for(Z=3;Z"u"?a:d};typeof a=="function"&&(s=a);var u=function(d){return s(d[r])},c=function(){return s(void 0)};return typeof r=="string"?(o.fromAttributes=u,o.fromGraph=function(d,p){return u(d.getNodeAttributes(p))},o.fromEntry=function(d,p){return u(p)}):typeof r=="function"?(o.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},o.fromGraph=function(d,p){return s(r(p,d.getNodeAttributes(p)))},o.fromEntry=function(d,p){return s(r(d,p))}):(o.fromAttributes=c,o.fromGraph=c,o.fromEntry=c),o}function n(r,a){var o={},s=function(d){return typeof d>"u"?a:d};typeof a=="function"&&(s=a);var u=function(d){return s(d[r])},c=function(){return s(void 0)};return typeof r=="string"?(o.fromAttributes=u,o.fromGraph=function(d,p){return u(d.getEdgeAttributes(p))},o.fromEntry=function(d,p){return u(p)},o.fromPartialEntry=o.fromEntry,o.fromMinimalEntry=o.fromEntry):typeof r=="function"?(o.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},o.fromGraph=function(d,p){var g=d.extremities(p);return s(r(p,d.getEdgeAttributes(p),g[0],g[1],d.getNodeAttributes(g[0]),d.getNodeAttributes(g[1]),d.isUndirected(p)))},o.fromEntry=function(d,p,g,m,b,v,S){return s(r(d,p,g,m,b,v,S))},o.fromPartialEntry=function(d,p,g,m){return s(r(d,p,g,m))},o.fromMinimalEntry=function(d,p){return s(r(d,p))}):(o.fromAttributes=c,o.fromGraph=c,o.fromEntry=c,o.fromMinimalEntry=c),o}return Xl.createNodeValueGetter=t,Xl.createEdgeValueGetter=n,Xl.createEdgeWeightGetter=function(r){return n(r,e)},Xl}var sm,_N;function c4(){if(_N)return sm;_N=1;const{createNodeValueGetter:e,createEdgeValueGetter:t}=W0();return sm=function(r,a,o){const{nodeXAttribute:s,nodeYAttribute:u}=o,{attraction:c,repulsion:d,gravity:p,inertia:g,maxMove:m}=o.settings;let{shouldSkipNode:b,shouldSkipEdge:v,isNodeFixed:S}=o;S=e(S),b=e(b,!1),v=t(v,!1);const k=r.filterNodes((A,C)=>!b.fromEntry(A,C)),R=k.length;for(let A=0;A{if(O===_||b.fromEntry(O,N)||b.fromEntry(_,F)||v.fromEntry(A,C,O,_,N,F,I))return;const L=a[O],G=a[_],$=G.x-L.x,U=G.y-L.y,W=Math.sqrt($*$+U*U)||1,Z=c*W*$,j=c*W*U;L.dx+=Z,L.dy+=j,G.dx-=Z,G.dy-=j}),p)for(let A=0;Am&&(O.dx*=m/_,O.dy*=m/_),S.fromGraph(r,C)?O.fixed=!0:(O.x+=O.dx,O.y+=O.dy,O.fixed=!1)}return{converged:x}},sm}var gd={},RN;function d4(){return RN||(RN=1,gd.assignLayoutChanges=function(e,t,n){const{nodeXAttribute:r,nodeYAttribute:a}=n;e.updateEachNodeAttributes((o,s)=>{const u=t[o];return!u||u.fixed||(s[r]=u.x,s[a]=u.y),s},{attributes:["x","y"]})},gd.collectLayoutChanges=function(e){const t={};for(const n in e){const r=e[n];t[n]={x:r.x,y:r.y}}return t}),gd}var lm,CN;function f4(){return CN||(CN=1,lm={nodeXAttribute:"x",nodeYAttribute:"y",isNodeFixed:"fixed",shouldSkipNode:null,shouldSkipEdge:null,settings:{attraction:5e-4,repulsion:.1,gravity:1e-4,inertia:.6,maxMove:200}}),lm}var um,NN;function Gee(){if(NN)return um;NN=1;const e=aa(),t=Pu(),n=c4(),r=d4(),a=f4();function o(u,c,d){if(!e(c))throw new Error("graphology-layout-force: the given graph is not a valid graphology instance.");typeof d=="number"?d={maxIterations:d}:d=d||{};const p=d.maxIterations;if(d=t(d,a),typeof p!="number"||p<=0)throw new Error("graphology-layout-force: you should provide a positive number of maximum iterations.");const g={};let m=null,b;for(b=0;bthis.runFrame())},o.prototype.stop=function(){return this.running=!1,this.frameID!==null&&(window.cancelAnimationFrame(this.frameID),this.frameID=null),this},o.prototype.start=function(){if(this.killed)throw new Error("graphology-layout-force/worker.start: layout was killed.");this.running||(this.running=!0,this.runFrame())},o.prototype.kill=function(){this.stop(),delete this.nodeStates,this.killed=!0},cm=o,cm}var Vee=qee();const Wee=un(Vee);function Yee(e={maxIterations:100}){return Gs($ee,e)}function Kee(e={}){return V0(Wee,e)}var dm,DN;function Xee(){if(DN)return dm;DN=1;var e=0,t=1,n=2,r=3,a=4,o=5,s=6,u=7,c=8,d=9,p=0,g=1,m=2,b=0,v=1,S=2,k=3,R=4,x=5,A=6,C=7,O=8,_=3,N=10,F=3,I=9,L=10;return dm=function($,U,W){var Z,j,H,z,Y,D,V,B,M,K,J=U.length,le=W.length,oe=$.adjustSizes,Q=$.barnesHutTheta*$.barnesHutTheta,ge,re,Ee,we,De,Re,Se,ee=[];for(H=0;HNe?(be-=(me-Ne)/2,xe=be+me):(fe-=(Ne-me)/2,Te=fe+Ne),ee[0+b]=-1,ee[0+v]=(fe+Te)/2,ee[0+S]=(be+xe)/2,ee[0+k]=Math.max(Te-fe,xe-be),ee[0+R]=-1,ee[0+x]=-1,ee[0+A]=0,ee[0+C]=0,ee[0+O]=0,Z=1,H=0;H=0){U[H+e]=0)if(Re=Math.pow(U[H+e]-ee[j+C],2)+Math.pow(U[H+t]-ee[j+O],2),K=ee[j+k],4*K*K/Re0?(Se=re*U[H+s]*ee[j+A]/Re,U[H+n]+=Ee*Se,U[H+r]+=we*Se):Re<0&&(Se=-re*U[H+s]*ee[j+A]/Math.sqrt(Re),U[H+n]+=Ee*Se,U[H+r]+=we*Se):Re>0&&(Se=re*U[H+s]*ee[j+A]/Re,U[H+n]+=Ee*Se,U[H+r]+=we*Se),j=ee[j+R],j<0)break;continue}else{j=ee[j+x];continue}else{if(D=ee[j+b],D>=0&&D!==H&&(Ee=U[H+e]-U[D+e],we=U[H+t]-U[D+t],Re=Ee*Ee+we*we,oe===!0?Re>0?(Se=re*U[H+s]*U[D+s]/Re,U[H+n]+=Ee*Se,U[H+r]+=we*Se):Re<0&&(Se=-re*U[H+s]*U[D+s]/Math.sqrt(Re),U[H+n]+=Ee*Se,U[H+r]+=we*Se):Re>0&&(Se=re*U[H+s]*U[D+s]/Re,U[H+n]+=Ee*Se,U[H+r]+=we*Se)),j=ee[j+R],j<0)break;continue}else for(re=$.scalingRatio,z=0;z0?(Se=re*U[z+s]*U[Y+s]/Re/Re,U[z+n]+=Ee*Se,U[z+r]+=we*Se,U[Y+n]-=Ee*Se,U[Y+r]-=we*Se):Re<0&&(Se=100*re*U[z+s]*U[Y+s],U[z+n]+=Ee*Se,U[z+r]+=we*Se,U[Y+n]-=Ee*Se,U[Y+r]-=we*Se)):(Re=Math.sqrt(Ee*Ee+we*we),Re>0&&(Se=re*U[z+s]*U[Y+s]/Re/Re,U[z+n]+=Ee*Se,U[z+r]+=we*Se,U[Y+n]-=Ee*Se,U[Y+r]-=we*Se));for(M=$.gravity/$.scalingRatio,re=$.scalingRatio,H=0;H0&&(Se=re*U[H+s]*M):Re>0&&(Se=re*U[H+s]*M/Re),U[H+n]-=Ee*Se,U[H+r]-=we*Se;for(re=1*($.outboundAttractionDistribution?ge:1),V=0;V0&&(Se=-re*De*Math.log(1+Re)/Re/U[z+s]):Re>0&&(Se=-re*De*Math.log(1+Re)/Re):$.outboundAttractionDistribution?Re>0&&(Se=-re*De/U[z+s]):Re>0&&(Se=-re*De)):(Re=Math.sqrt(Math.pow(Ee,2)+Math.pow(we,2)),$.linLogMode?$.outboundAttractionDistribution?Re>0&&(Se=-re*De*Math.log(1+Re)/Re/U[z+s]):Re>0&&(Se=-re*De*Math.log(1+Re)/Re):$.outboundAttractionDistribution?(Re=1,Se=-re*De/U[z+s]):(Re=1,Se=-re*De)),Re>0&&(U[z+n]+=Ee*Se,U[z+r]+=we*Se,U[Y+n]-=Ee*Se,U[Y+r]-=we*Se);var te,ce,Ce,Fe,We,yt;if(oe===!0)for(H=0;HL&&(U[H+n]=U[H+n]*L/te,U[H+r]=U[H+r]*L/te),ce=U[H+s]*Math.sqrt((U[H+a]-U[H+n])*(U[H+a]-U[H+n])+(U[H+o]-U[H+r])*(U[H+o]-U[H+r])),Ce=Math.sqrt((U[H+a]+U[H+n])*(U[H+a]+U[H+n])+(U[H+o]+U[H+r])*(U[H+o]+U[H+r]))/2,Fe=.1*Math.log(1+Ce)/(1+Math.sqrt(ce)),We=U[H+e]+U[H+n]*(Fe/$.slowDown),U[H+e]=We,yt=U[H+t]+U[H+r]*(Fe/$.slowDown),U[H+t]=yt);else for(H=0;H=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in n&&typeof n.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in n&&!(typeof n.gravity=="number"&&n.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in n&&!(typeof n.slowDown=="number"||n.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in n&&typeof n.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in n&&!(typeof n.barnesHutTheta=="number"&&n.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},Ra.graphToByteArrays=function(n,r){var a=n.order,o=n.size,s={},u,c=new Float32Array(a*e),d=new Float32Array(o*t);return u=0,n.forEachNode(function(p,g){s[p]=u,c[u]=g.x,c[u+1]=g.y,c[u+2]=0,c[u+3]=0,c[u+4]=0,c[u+5]=0,c[u+6]=1,c[u+7]=1,c[u+8]=g.size||1,c[u+9]=g.fixed?1:0,u+=e}),u=0,n.forEachEdge(function(p,g,m,b,v,S,k){var R=s[m],x=s[b],A=r(p,g,m,b,v,S,k);c[R+6]+=A,c[x+6]+=A,d[u]=R,d[u+1]=x,d[u+2]=A,u+=t}),{nodes:c,edges:d}},Ra.assignLayoutChanges=function(n,r,a){var o=0;n.updateEachNodeAttributes(function(s,u){return u.x=r[o],u.y=r[o+1],o+=e,a?a(s,u):u})},Ra.readGraphPositions=function(n,r){var a=0;n.forEachNode(function(o,s){r[a]=s.x,r[a+1]=s.y,a+=e})},Ra.collectLayoutChanges=function(n,r,a){for(var o=n.nodes(),s={},u=0,c=0,d=r.length;u2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(d)}}var u=o.bind(null,!1);return u.assign=o.bind(null,!0),u.inferSettings=s,pm=u,pm}var Qee=Zee();const Jee=un(Qee);var gm,FN;function ete(){return FN||(FN=1,gm=function(){var t,n,r={};(function(){var o=0,s=1,u=2,c=3,d=4,p=5,g=6,m=7,b=8,v=9,S=0,k=1,R=2,x=0,A=1,C=2,O=3,_=4,N=5,F=6,I=7,L=8,G=3,$=10,U=3,W=9,Z=10;r.exports=function(H,z,Y){var D,V,B,M,K,J,le,oe,Q,ge,re=z.length,Ee=Y.length,we=H.adjustSizes,De=H.barnesHutTheta*H.barnesHutTheta,Re,Se,ee,fe,Te,be,xe,se=[];for(B=0;BWe?(me-=(Fe-We)/2,Ne=me+Fe):(Pe-=(We-Fe)/2,ze=Pe+We),se[0+x]=-1,se[0+A]=(Pe+ze)/2,se[0+C]=(me+Ne)/2,se[0+O]=Math.max(ze-Pe,Ne-me),se[0+_]=-1,se[0+N]=-1,se[0+F]=0,se[0+I]=0,se[0+L]=0,D=1,B=0;B=0){z[B+o]=0)if(be=Math.pow(z[B+o]-se[V+I],2)+Math.pow(z[B+s]-se[V+L],2),ge=se[V+O],4*ge*ge/be0?(xe=Se*z[B+g]*se[V+F]/be,z[B+u]+=ee*xe,z[B+c]+=fe*xe):be<0&&(xe=-Se*z[B+g]*se[V+F]/Math.sqrt(be),z[B+u]+=ee*xe,z[B+c]+=fe*xe):be>0&&(xe=Se*z[B+g]*se[V+F]/be,z[B+u]+=ee*xe,z[B+c]+=fe*xe),V=se[V+_],V<0)break;continue}else{V=se[V+N];continue}else{if(J=se[V+x],J>=0&&J!==B&&(ee=z[B+o]-z[J+o],fe=z[B+s]-z[J+s],be=ee*ee+fe*fe,we===!0?be>0?(xe=Se*z[B+g]*z[J+g]/be,z[B+u]+=ee*xe,z[B+c]+=fe*xe):be<0&&(xe=-Se*z[B+g]*z[J+g]/Math.sqrt(be),z[B+u]+=ee*xe,z[B+c]+=fe*xe):be>0&&(xe=Se*z[B+g]*z[J+g]/be,z[B+u]+=ee*xe,z[B+c]+=fe*xe)),V=se[V+_],V<0)break;continue}else for(Se=H.scalingRatio,M=0;M0?(xe=Se*z[M+g]*z[K+g]/be/be,z[M+u]+=ee*xe,z[M+c]+=fe*xe,z[K+u]-=ee*xe,z[K+c]-=fe*xe):be<0&&(xe=100*Se*z[M+g]*z[K+g],z[M+u]+=ee*xe,z[M+c]+=fe*xe,z[K+u]-=ee*xe,z[K+c]-=fe*xe)):(be=Math.sqrt(ee*ee+fe*fe),be>0&&(xe=Se*z[M+g]*z[K+g]/be/be,z[M+u]+=ee*xe,z[M+c]+=fe*xe,z[K+u]-=ee*xe,z[K+c]-=fe*xe));for(Q=H.gravity/H.scalingRatio,Se=H.scalingRatio,B=0;B0&&(xe=Se*z[B+g]*Q):be>0&&(xe=Se*z[B+g]*Q/be),z[B+u]-=ee*xe,z[B+c]-=fe*xe;for(Se=1*(H.outboundAttractionDistribution?Re:1),le=0;le0&&(xe=-Se*Te*Math.log(1+be)/be/z[M+g]):be>0&&(xe=-Se*Te*Math.log(1+be)/be):H.outboundAttractionDistribution?be>0&&(xe=-Se*Te/z[M+g]):be>0&&(xe=-Se*Te)):(be=Math.sqrt(Math.pow(ee,2)+Math.pow(fe,2)),H.linLogMode?H.outboundAttractionDistribution?be>0&&(xe=-Se*Te*Math.log(1+be)/be/z[M+g]):be>0&&(xe=-Se*Te*Math.log(1+be)/be):H.outboundAttractionDistribution?(be=1,xe=-Se*Te/z[M+g]):(be=1,xe=-Se*Te)),be>0&&(z[M+u]+=ee*xe,z[M+c]+=fe*xe,z[K+u]-=ee*xe,z[K+c]-=fe*xe);var yt,wt,ht,et,kt,ot;if(we===!0)for(B=0;BZ&&(z[B+u]=z[B+u]*Z/yt,z[B+c]=z[B+c]*Z/yt),wt=z[B+g]*Math.sqrt((z[B+d]-z[B+u])*(z[B+d]-z[B+u])+(z[B+p]-z[B+c])*(z[B+p]-z[B+c])),ht=Math.sqrt((z[B+d]+z[B+u])*(z[B+d]+z[B+u])+(z[B+p]+z[B+c])*(z[B+p]+z[B+c]))/2,et=.1*Math.log(1+ht)/(1+Math.sqrt(wt)),kt=z[B+o]+z[B+u]*(et/H.slowDown),z[B+o]=kt,ot=z[B+s]+z[B+c]*(et/H.slowDown),z[B+s]=ot);else for(B=0;B1&&Ee.has(xe))&&(z>1&&Ee.add(xe),Se=c[De+e],fe=c[De+t],be=c[De+n],se=Se-Re,Pe=fe-ee,ze=Math.sqrt(se*se+Pe*Pe),me=ze0?(N[De]+=se/ze*(1+Te),F[De]+=Pe/ze*(1+Te)):(N[De]+=U*o(),F[De]+=W*o())));for(v=0,S=0;v1&&Se.has(me))&&(B>1&&Se.add(me),be=m[fe+a],se=m[fe+o],ze=m[fe+s],Ne=be-Te,te=se-xe,ce=Math.sqrt(Ne*Ne+te*te),Ce=ce0?(G[fe]+=Ne/ce*(1+Pe),$[fe]+=te/ce*(1+Pe)):(G[fe]+=H*d(),$[fe]+=z*d())));for(x=0,A=0;x=0;)g=Sk(e,t,n,r,d+1,o+1,s),g>p&&(d===a?g*=qN:kte.test(e.charAt(d-1))?(g*=Ste,b=e.slice(a,d-1).match(Tte),b&&a>0&&(g*=Math.pow(xm,b.length))):Ate.test(e.charAt(d-1))?(g*=vte,v=e.slice(a,d-1).match(y4),v&&a>0&&(g*=Math.pow(xm,v.length))):(g*=Ete,a>0&&(g*=Math.pow(xm,d-a))),e.charAt(d)!==t.charAt(o)&&(g*=wte)),(gg&&(g=m*wm)),g>p&&(p=g),d=n.indexOf(c,d+1);return s[u]=p,p}function VN(e){return e.toLowerCase().replace(y4," ")}function _te(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Sk(e,t,VN(e),VN(t),0,0,{})}var km={exports:{}},Tm={};/**
* @license React
* use-sync-external-store-shim.production.js
*
@@ -1080,18 +1080,18 @@ void main() {
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
- */var WN;function Rte(){if(WN)return Tm;WN=1;var e=kf();function t(g,m){return g===m&&(g!==0||1/g===1/m)||g!==g&&m!==m}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,a=e.useEffect,o=e.useLayoutEffect,s=e.useDebugValue;function u(g,m){var b=m(),v=r({inst:{value:b,getSnapshot:m}}),S=v[0].inst,k=v[1];return o(function(){S.value=b,S.getSnapshot=m,c(S)&&k({inst:S})},[g,b,m]),a(function(){return c(S)&&k({inst:S}),g(function(){c(S)&&k({inst:S})})},[g]),s(b),b}function c(g){var m=g.getSnapshot;g=g.value;try{var b=m();return!n(g,b)}catch{return!0}}function d(g,m){return m()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:u;return Tm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Tm}var YN;function Cte(){return YN||(YN=1,km.exports=Rte()),km.exports}var Nte=Cte(),Zl='[cmdk-group=""]',Am='[cmdk-group-items=""]',Ote='[cmdk-group-heading=""]',K0='[cmdk-item=""]',KN=`${K0}:not([aria-disabled="true"])`,Ek="cmdk-item-select",ri="data-value",Dte=(e,t,n)=>_te(e,t,n),v4=T.createContext(void 0),zu=()=>T.useContext(v4),S4=T.createContext(void 0),X0=()=>T.useContext(S4),E4=T.createContext(void 0),w4=T.forwardRef((e,t)=>{let n=ds(()=>{var B,M;return{search:"",value:(M=(B=e.value)!=null?B:e.defaultValue)!=null?M:"",filtered:{count:0,items:new Map,groups:new Set}}}),r=ds(()=>new Set),a=ds(()=>new Map),o=ds(()=>new Map),s=ds(()=>new Set),u=x4(e),{label:c,children:d,value:p,onValueChange:g,filter:m,shouldFilter:b,loop:v,disablePointerSelection:S=!1,vimBindings:k=!0,...R}=e,x=kn(),_=kn(),N=kn(),O=T.useRef(null),A=Hte();pi(()=>{if(p!==void 0){let B=p.trim();n.current.value=B,C.emit()}},[p]),pi(()=>{A(6,U)},[]);let C=T.useMemo(()=>({subscribe:B=>(s.current.add(B),()=>s.current.delete(B)),snapshot:()=>n.current,setState:(B,M,K)=>{var J,le,oe;if(!Object.is(n.current[B],M)){if(n.current[B]=M,B==="search")$(),L(),A(1,H);else if(B==="value"&&(K||A(5,U),((J=u.current)==null?void 0:J.value)!==void 0)){let Q=M??"";(oe=(le=u.current).onValueChange)==null||oe.call(le,Q);return}C.emit()}},emit:()=>{s.current.forEach(B=>B())}}),[]),F=T.useMemo(()=>({value:(B,M,K)=>{var J;M!==((J=o.current.get(B))==null?void 0:J.value)&&(o.current.set(B,{value:M,keywords:K}),n.current.filtered.items.set(B,I(M,K)),A(2,()=>{L(),C.emit()}))},item:(B,M)=>(r.current.add(B),M&&(a.current.has(M)?a.current.get(M).add(B):a.current.set(M,new Set([B]))),A(3,()=>{$(),L(),n.current.value||H(),C.emit()}),()=>{o.current.delete(B),r.current.delete(B),n.current.filtered.items.delete(B);let K=W();A(4,()=>{$(),(K==null?void 0:K.getAttribute("id"))===B&&H(),C.emit()})}),group:B=>(a.current.has(B)||a.current.set(B,new Set),()=>{o.current.delete(B),a.current.delete(B)}),filter:()=>u.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>u.current.disablePointerSelection,listId:x,inputId:N,labelId:_,listInnerRef:O}),[]);function I(B,M){var K,J;let le=(J=(K=u.current)==null?void 0:K.filter)!=null?J:Dte;return B?le(B,n.current.search,M):0}function L(){if(!n.current.search||u.current.shouldFilter===!1)return;let B=n.current.filtered.items,M=[];n.current.filtered.groups.forEach(J=>{let le=a.current.get(J),oe=0;le.forEach(Q=>{let ge=B.get(Q);oe=Math.max(ge,oe)}),M.push([J,oe])});let K=O.current;Z().sort((J,le)=>{var oe,Q;let ge=J.getAttribute("id"),re=le.getAttribute("id");return((oe=B.get(re))!=null?oe:0)-((Q=B.get(ge))!=null?Q:0)}).forEach(J=>{let le=J.closest(Am);le?le.appendChild(J.parentElement===le?J:J.closest(`${Am} > *`)):K.appendChild(J.parentElement===K?J:J.closest(`${Am} > *`))}),M.sort((J,le)=>le[1]-J[1]).forEach(J=>{var le;let oe=(le=O.current)==null?void 0:le.querySelector(`${Zl}[${ri}="${encodeURIComponent(J[0])}"]`);oe==null||oe.parentElement.appendChild(oe)})}function H(){let B=Z().find(K=>K.getAttribute("aria-disabled")!=="true"),M=B==null?void 0:B.getAttribute(ri);C.setState("value",M||void 0)}function $(){var B,M,K,J;if(!n.current.search||u.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let le=0;for(let oe of r.current){let Q=(M=(B=o.current.get(oe))==null?void 0:B.value)!=null?M:"",ge=(J=(K=o.current.get(oe))==null?void 0:K.keywords)!=null?J:[],re=I(Q,ge);n.current.filtered.items.set(oe,re),re>0&&le++}for(let[oe,Q]of a.current)for(let ge of Q)if(n.current.filtered.items.get(ge)>0){n.current.filtered.groups.add(oe);break}n.current.filtered.count=le}function U(){var B,M,K;let J=W();J&&(((B=J.parentElement)==null?void 0:B.firstChild)===J&&((K=(M=J.closest(Zl))==null?void 0:M.querySelector(Ote))==null||K.scrollIntoView({block:"nearest"})),J.scrollIntoView({block:"nearest"}))}function W(){var B;return(B=O.current)==null?void 0:B.querySelector(`${K0}[aria-selected="true"]`)}function Z(){var B;return Array.from(((B=O.current)==null?void 0:B.querySelectorAll(KN))||[])}function G(B){let M=Z()[B];M&&C.setState("value",M.getAttribute(ri))}function j(B){var M;let K=W(),J=Z(),le=J.findIndex(Q=>Q===K),oe=J[le+B];(M=u.current)!=null&&M.loop&&(oe=le+B<0?J[J.length-1]:le+B===J.length?J[0]:J[le+B]),oe&&C.setState("value",oe.getAttribute(ri))}function P(B){let M=W(),K=M==null?void 0:M.closest(Zl),J;for(;K&&!J;)K=B>0?jte(K,Zl):Gte(K,Zl),J=K==null?void 0:K.querySelector(KN);J?C.setState("value",J.getAttribute(ri)):j(B)}let Y=()=>G(Z().length-1),D=B=>{B.preventDefault(),B.metaKey?Y():B.altKey?P(1):j(1)},V=B=>{B.preventDefault(),B.metaKey?G(0):B.altKey?P(-1):j(-1)};return T.createElement(Ze.div,{ref:t,tabIndex:-1,...R,"cmdk-root":"",onKeyDown:B=>{var M;if((M=R.onKeyDown)==null||M.call(R,B),!B.defaultPrevented)switch(B.key){case"n":case"j":{k&&B.ctrlKey&&D(B);break}case"ArrowDown":{D(B);break}case"p":case"k":{k&&B.ctrlKey&&V(B);break}case"ArrowUp":{V(B);break}case"Home":{B.preventDefault(),G(0);break}case"End":{B.preventDefault(),Y();break}case"Enter":if(!B.nativeEvent.isComposing&&B.keyCode!==229){B.preventDefault();let K=W();if(K){let J=new Event(Ek);K.dispatchEvent(J)}}}}},T.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:qte},c),tp(e,B=>T.createElement(S4.Provider,{value:C},T.createElement(v4.Provider,{value:F},B))))}),Ite=T.forwardRef((e,t)=>{var n,r;let a=kn(),o=T.useRef(null),s=T.useContext(E4),u=zu(),c=x4(e),d=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:s==null?void 0:s.forceMount;pi(()=>{if(!d)return u.item(a,s==null?void 0:s.id)},[d]);let p=k4(a,o,[e.value,e.children,o],e.keywords),g=X0(),m=gi(A=>A.value&&A.value===p.current),b=gi(A=>d||u.filter()===!1?!0:A.search?A.filtered.items.get(a)>0:!0);T.useEffect(()=>{let A=o.current;if(!(!A||e.disabled))return A.addEventListener(Ek,v),()=>A.removeEventListener(Ek,v)},[b,e.onSelect,e.disabled]);function v(){var A,C;S(),(C=(A=c.current).onSelect)==null||C.call(A,p.current)}function S(){g.setState("value",p.current,!0)}if(!b)return null;let{disabled:k,value:R,onSelect:x,forceMount:_,keywords:N,...O}=e;return T.createElement(Ze.div,{ref:hu([o,t]),...O,id:a,"cmdk-item":"",role:"option","aria-disabled":!!k,"aria-selected":!!m,"data-disabled":!!k,"data-selected":!!m,onPointerMove:k||u.getDisablePointerSelection()?void 0:S,onClick:k?void 0:v},e.children)}),Lte=T.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:a,...o}=e,s=kn(),u=T.useRef(null),c=T.useRef(null),d=kn(),p=zu(),g=gi(b=>a||p.filter()===!1?!0:b.search?b.filtered.groups.has(s):!0);pi(()=>p.group(s),[]),k4(s,u,[e.value,e.heading,c]);let m=T.useMemo(()=>({id:s,forceMount:a}),[a]);return T.createElement(Ze.div,{ref:hu([u,t]),...o,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},n&&T.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),tp(e,b=>T.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},T.createElement(E4.Provider,{value:m},b))))}),Mte=T.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=T.useRef(null),o=gi(s=>!s.search);return!n&&!o?null:T.createElement(Ze.div,{ref:hu([a,t]),...r,"cmdk-separator":"",role:"separator"})}),Fte=T.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,o=X0(),s=gi(p=>p.search),u=gi(p=>p.value),c=zu(),d=T.useMemo(()=>{var p;let g=(p=c.listInnerRef.current)==null?void 0:p.querySelector(`${K0}[${ri}="${encodeURIComponent(u)}"]`);return g==null?void 0:g.getAttribute("id")},[]);return T.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),T.createElement(Ze.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":d,id:c.inputId,type:"text",value:a?e.value:s,onChange:p=>{a||o.setState("search",p.target.value),n==null||n(p.target.value)}})}),Pte=T.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...a}=e,o=T.useRef(null),s=T.useRef(null),u=zu();return T.useEffect(()=>{if(s.current&&o.current){let c=s.current,d=o.current,p,g=new ResizeObserver(()=>{p=requestAnimationFrame(()=>{let m=c.offsetHeight;d.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return g.observe(c),()=>{cancelAnimationFrame(p),g.unobserve(c)}}},[]),T.createElement(Ze.div,{ref:hu([o,t]),...a,"cmdk-list":"",role:"listbox","aria-label":r,id:u.listId},tp(e,c=>T.createElement("div",{ref:hu([s,u.listInnerRef]),"cmdk-list-sizer":""},c)))}),zte=T.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:o,container:s,...u}=e;return T.createElement(d0,{open:n,onOpenChange:r},T.createElement(f0,{container:s},T.createElement(Ff,{"cmdk-overlay":"",className:a}),T.createElement(Pf,{"aria-label":e.label,"cmdk-dialog":"",className:o},T.createElement(w4,{ref:t,...u}))))}),Bte=T.forwardRef((e,t)=>gi(n=>n.filtered.count===0)?T.createElement(Ze.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Ute=T.forwardRef((e,t)=>{let{progress:n,children:r,label:a="Loading...",...o}=e;return T.createElement(Ze.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},tp(e,s=>T.createElement("div",{"aria-hidden":!0},s)))}),qn=Object.assign(w4,{List:Pte,Item:Ite,Input:Fte,Group:Lte,Separator:Mte,Dialog:zte,Empty:Bte,Loading:Ute});function jte(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Gte(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function x4(e){let t=T.useRef(e);return pi(()=>{t.current=e}),t}var pi=typeof window>"u"?T.useEffect:T.useLayoutEffect;function ds(e){let t=T.useRef();return t.current===void 0&&(t.current=e()),t}function hu(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}function gi(e){let t=X0(),n=()=>e(t.snapshot());return Nte.useSyncExternalStore(t.subscribe,n,n)}function k4(e,t,n,r=[]){let a=T.useRef(),o=zu();return pi(()=>{var s;let u=(()=>{var d;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(d=p.current.textContent)==null?void 0:d.trim():a.current}})(),c=r.map(d=>d.trim());o.value(e,u,c),(s=t.current)==null||s.setAttribute(ri,u),a.current=u}),a}var Hte=()=>{let[e,t]=T.useState(),n=ds(()=>new Map);return pi(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}};function $te(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function tp({asChild:e,children:t},n){return e&&T.isValidElement(t)?T.cloneElement($te(t),{ref:t.ref},n(t.props.children)):n(t)}var qte={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const T4=d0,A4=qB,Vte=f0,_4=T.forwardRef(({className:e,...t},n)=>E.jsx(Ff,{ref:n,className:Me("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",e),...t}));_4.displayName=Ff.displayName;const Z0=T.forwardRef(({className:e,children:t,...n},r)=>E.jsxs(Vte,{children:[E.jsx(_4,{}),E.jsxs(Pf,{ref:r,className:Me("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-top-[48%] fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",e),...n,children:[t,E.jsxs(h0,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none",children:[E.jsx(gB,{className:"h-4 w-4"}),E.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Z0.displayName=Pf.displayName;const Q0=({className:e,...t})=>E.jsx("div",{className:Me("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Q0.displayName="DialogHeader";const J0=T.forwardRef(({className:e,...t},n)=>E.jsx(p0,{ref:n,className:Me("text-lg leading-none font-semibold tracking-tight",e),...t}));J0.displayName=p0.displayName;const eT=T.forwardRef(({className:e,...t},n)=>E.jsx(g0,{ref:n,className:Me("text-muted-foreground text-sm",e),...t}));eT.displayName=g0.displayName;const np=T.forwardRef(({className:e,...t},n)=>E.jsx(qn,{ref:n,className:Me("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t}));np.displayName=qn.displayName;const tT=T.forwardRef(({className:e,...t},n)=>E.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[E.jsx(Q7,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),E.jsx(qn.Input,{ref:n,className:Me("placeholder:text-muted-foreground flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));tT.displayName=qn.Input.displayName;const rp=T.forwardRef(({className:e,...t},n)=>E.jsx(qn.List,{ref:n,className:Me("max-h-[300px] overflow-x-hidden overflow-y-auto",e),...t}));rp.displayName=qn.List.displayName;const nT=T.forwardRef((e,t)=>E.jsx(qn.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));nT.displayName=qn.Empty.displayName;const Hs=T.forwardRef(({className:e,...t},n)=>E.jsx(qn.Group,{ref:n,className:Me("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t}));Hs.displayName=qn.Group.displayName;const Wte=T.forwardRef(({className:e,...t},n)=>E.jsx(qn.Separator,{ref:n,className:Me("bg-border -mx-1 h-px",e),...t}));Wte.displayName=qn.Separator.displayName;const $s=T.forwardRef(({className:e,...t},n)=>E.jsx(qn.Item,{ref:n,className:Me("data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));$s.displayName=qn.Item.displayName;const Yte=({layout:e,autoRunFor:t})=>{const n=ar(),{stop:r,start:a,isRunning:o}=e,{t:s}=Ft();return T.useEffect(()=>{if(!n)return;let u=null;return t!==void 0&&t>-1&&n.getGraph().order>0&&(a(),u=t>0?window.setTimeout(()=>{r()},t):null),()=>{r(),u&&clearTimeout(u)}},[t,a,r,n]),E.jsx(Ot,{size:"icon",onClick:()=>o?r():a(),tooltip:s(o?"graphPanel.sideBar.layoutsControl.stopAnimation":"graphPanel.sideBar.layoutsControl.startAnimation"),variant:La,children:o?E.jsx(q7,{}):E.jsx(W7,{})})},Kte=()=>{const e=ar(),{t}=Ft(),[n,r]=T.useState("Circular"),[a,o]=T.useState(!1),s=Ue.use.graphLayoutMaxIterations(),u=jee(),c=Pee(),d=yte(),p=pte({settings:{margin:1}}),g=Yee({maxIterations:s}),m=Y0({iterations:s}),b=gte(),v=Kee(),S=ate(),k=T.useMemo(()=>({Circular:{layout:u},Circlepack:{layout:c},Random:{layout:d},Noverlaps:{layout:p,worker:b},"Force Directed":{layout:g,worker:v},"Force Atlas":{layout:m,worker:S}}),[c,u,g,m,p,d,v,b,S]),R=T.useCallback(x=>{console.debug(x);const{positions:_}=k[x].layout;$j(e.getGraph(),_(),{duration:500}),r(x)},[k,e]);return E.jsxs(E.Fragment,{children:[E.jsx("div",{children:k[n]&&"worker"in k[n]&&E.jsx(Yte,{layout:k[n].worker})}),E.jsx("div",{children:E.jsxs(Nu,{open:a,onOpenChange:o,children:[E.jsx(Ou,{asChild:!0,children:E.jsx(Ot,{size:"icon",variant:La,onClick:()=>o(x=>!x),tooltip:t("graphPanel.sideBar.layoutsControl.layoutGraph"),children:E.jsx(L7,{})})}),E.jsx(Ps,{side:"right",align:"center",className:"p-1",children:E.jsx(np,{children:E.jsx(rp,{children:E.jsx(Hs,{children:Object.keys(k).map(x=>E.jsx($s,{onSelect:()=>{R(x)},className:"cursor-pointer text-xs",children:t(`graphPanel.sideBar.layoutsControl.layouts.${x}`)},x))})})})})]})})]})},R4=()=>{const e=T.useContext(kz);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e},hd=e=>!!(e.type.startsWith("mouse")&&e.buttons!==0),Xte=({disableHoverEffect:e})=>{const t=ar(),n=Kj(),r=Yj(),a=Ue.use.graphLayoutMaxIterations(),{assign:o}=Y0({iterations:a}),{theme:s}=R4(),u=Ue.use.enableHideUnselectedEdges(),c=Ue.use.enableEdgeEvents(),d=Ue.use.showEdgeLabel(),p=Ue.use.showNodeLabel(),g=$e.use.selectedNode(),m=$e.use.focusedNode(),b=$e.use.selectedEdge(),v=$e.use.focusedEdge(),S=$e.use.sigmaGraph();return T.useEffect(()=>{if(S&&t){try{typeof t.setGraph=="function"?(t.setGraph(S),console.log("Binding graph to sigma instance")):(t.graph=S,console.warn("Simgma missing setGraph function, set graph property directly"))}catch(k){console.error("Error setting graph on sigma instance:",k)}o(),console.log("Initial layout applied to graph")}},[t,S,o,a]),T.useEffect(()=>{t&&($e.getState().sigmaInstance||(console.log("Setting sigma instance from GraphControl (backup)"),$e.getState().setSigmaInstance(t)))},[t]),T.useEffect(()=>{const{setFocusedNode:k,setSelectedNode:R,setFocusedEdge:x,setSelectedEdge:_,clearSelection:N}=$e.getState(),O={enterNode:A=>{hd(A.event.original)||k(A.node)},leaveNode:A=>{hd(A.event.original)||k(null)},clickNode:A=>{R(A.node),_(null)},clickStage:()=>N()};c&&(O.clickEdge=A=>{_(A.edge),R(null)},O.enterEdge=A=>{hd(A.event.original)||x(A.edge)},O.leaveEdge=A=>{hd(A.event.original)||x(null)}),n(O)},[n,c]),T.useEffect(()=>{const k=s==="dark",R=k?rq:void 0,x=k?sq:void 0;r({enableEdgeEvents:c,renderEdgeLabels:d,renderLabels:p,nodeReducer:(_,N)=>{const O=t.getGraph(),A={...N,highlighted:N.highlighted||!1,labelColor:R};if(!e){A.highlighted=!1;const C=m||g,F=v||b;if(C&&O.hasNode(C))try{(_===C||O.neighbors(C).includes(_))&&(A.highlighted=!0,_===g&&(A.borderColor=iq))}catch(I){console.error("Error in nodeReducer:",I)}else if(F&&O.hasEdge(F))O.extremities(F).includes(_)&&(A.highlighted=!0,A.size=3);else return A;A.highlighted?k&&(A.labelColor=aq):A.color=oq}return A},edgeReducer:(_,N)=>{const O=t.getGraph(),A={...N,hidden:!1,labelColor:R,color:x};if(!e){const C=m||g;if(C&&O.hasNode(C))try{u?O.extremities(_).includes(C)||(A.hidden=!0):O.extremities(_).includes(C)&&(A.color=WR)}catch(F){console.error("Error in edgeReducer:",F)}else{const F=b&&O.hasEdge(b)?b:null,I=v&&O.hasEdge(v)?v:null;(F||I)&&(_===F?A.color=lq:_===I?A.color=WR:u&&(A.hidden=!0))}}return A}})},[g,m,b,v,r,t,e,s,u,c,d,p]),null},Zte=()=>{const{zoomIn:e,zoomOut:t,reset:n}=Xj({duration:200,factor:1.5}),r=ar(),{t:a}=Ft(),o=T.useCallback(()=>e(),[e]),s=T.useCallback(()=>t(),[t]),u=T.useCallback(()=>{if(r)try{r.setCustomBBox(null),r.refresh();const c=r.getGraph();if(!(c!=null&&c.order)||c.nodes().length===0){n();return}const d=r.getContainer(),p=d.offsetWidth,g=d.offsetHeight,m=30;if(console.log("Container W:",p,"H:",g),p<100||g<100){n();return}r.getCamera().animate({x:.5,y:.5,ratio:1.1},{duration:1e3})}catch(c){console.error("Error resetting zoom:",c),n()}},[r,n]);return E.jsxs(E.Fragment,{children:[E.jsx(Ot,{variant:La,onClick:o,tooltip:a("graphPanel.sideBar.zoomControl.zoomIn"),size:"icon",children:E.jsx(lV,{})}),E.jsx(Ot,{variant:La,onClick:s,tooltip:a("graphPanel.sideBar.zoomControl.zoomOut"),size:"icon",children:E.jsx(cV,{})}),E.jsx(Ot,{variant:La,onClick:u,tooltip:a("graphPanel.sideBar.zoomControl.resetZoom"),size:"icon",children:E.jsx(R7,{})})]})},Qte=()=>{const{isFullScreen:e,toggle:t}=OJ(),{t:n}=Ft();return E.jsx(E.Fragment,{children:e?E.jsx(Ot,{variant:La,onClick:t,tooltip:n("graphPanel.sideBar.fullScreenControl.windowed"),size:"icon",children:E.jsx(j7,{})}):E.jsx(Ot,{variant:La,onClick:t,tooltip:n("graphPanel.sideBar.fullScreenControl.fullScreen"),size:"icon",children:E.jsx(B7,{})})})};var rT="Checkbox",[Jte,QSe]=wr(rT),[ene,tne]=Jte(rT),C4=T.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:a,defaultChecked:o,required:s,disabled:u,value:c="on",onCheckedChange:d,form:p,...g}=e,[m,b]=T.useState(null),v=gt(t,N=>b(N)),S=T.useRef(!1),k=m?p||!!m.closest("form"):!0,[R=!1,x]=Fa({prop:a,defaultProp:o,onChange:d}),_=T.useRef(R);return T.useEffect(()=>{const N=m==null?void 0:m.form;if(N){const O=()=>x(_.current);return N.addEventListener("reset",O),()=>N.removeEventListener("reset",O)}},[m,x]),E.jsxs(ene,{scope:n,state:R,disabled:u,children:[E.jsx(Ze.button,{type:"button",role:"checkbox","aria-checked":So(R)?"mixed":R,"aria-required":s,"data-state":D4(R),"data-disabled":u?"":void 0,disabled:u,value:c,...g,ref:v,onKeyDown:Ke(e.onKeyDown,N=>{N.key==="Enter"&&N.preventDefault()}),onClick:Ke(e.onClick,N=>{x(O=>So(O)?!0:!O),k&&(S.current=N.isPropagationStopped(),S.current||N.stopPropagation())})}),k&&E.jsx(nne,{control:m,bubbles:!S.current,name:r,value:c,checked:R,required:s,disabled:u,form:p,style:{transform:"translateX(-100%)"},defaultChecked:So(o)?!1:o})]})});C4.displayName=rT;var N4="CheckboxIndicator",O4=T.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...a}=e,o=tne(N4,n);return E.jsx(rr,{present:r||So(o.state)||o.state===!0,children:E.jsx(Ze.span,{"data-state":D4(o.state),"data-disabled":o.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});O4.displayName=N4;var nne=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:a,...o}=e,s=T.useRef(null),u=o3(n),c=EU(t);T.useEffect(()=>{const p=s.current,g=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(g,"checked").set;if(u!==n&&b){const v=new Event("click",{bubbles:r});p.indeterminate=So(n),b.call(p,So(n)?!1:n),p.dispatchEvent(v)}},[u,n,r]);const d=T.useRef(So(n)?!1:n);return E.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a??d.current,...o,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function So(e){return e==="indeterminate"}function D4(e){return So(e)?"indeterminate":e?"checked":"unchecked"}var I4=C4,rne=O4;const ou=T.forwardRef(({className:e,...t},n)=>E.jsx(I4,{ref:n,className:Me("peer border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground h-4 w-4 shrink-0 rounded-sm border focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:E.jsx(rne,{className:Me("flex items-center justify-center text-current"),children:E.jsx(n0,{className:"h-4 w-4"})})}));ou.displayName=I4.displayName;var ane="Separator",XN="horizontal",one=["horizontal","vertical"],L4=T.forwardRef((e,t)=>{const{decorative:n,orientation:r=XN,...a}=e,o=ine(r)?r:XN,u=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return E.jsx(Ze.div,{"data-orientation":o,...u,...a,ref:t})});L4.displayName=ane;function ine(e){return one.includes(e)}var M4=L4;const fs=T.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},a)=>E.jsx(M4,{ref:a,decorative:n,orientation:t,className:Me("bg-border shrink-0",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));fs.displayName=M4.displayName;const go=({checked:e,onCheckedChange:t,label:n})=>E.jsxs("div",{className:"flex items-center gap-2",children:[E.jsx(ou,{checked:e,onCheckedChange:t}),E.jsx("label",{htmlFor:"terms",className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:n})]}),_m=({value:e,onEditFinished:t,label:n,min:r,max:a})=>{const[o,s]=T.useState(e),u=T.useCallback(d=>{const p=d.target.value.trim();if(p.length===0){s(null);return}const g=Number.parseInt(p);if(!isNaN(g)&&g!==o){if(r!==void 0&&ga)return;s(g)}},[o,r,a]),c=T.useCallback(()=>{o!==null&&e!==o&&t(o)},[e,o,t]);return E.jsxs("div",{className:"flex flex-col gap-2",children:[E.jsx("label",{htmlFor:"terms",className:"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:n}),E.jsx(Ao,{type:"number",value:o===null?"":o,onChange:u,className:"h-6 w-full min-w-0 pr-1",min:r,max:a,onBlur:c,onKeyDown:d=>{d.key==="Enter"&&c()}})]})};function sne(){const[e,t]=T.useState(!1),[n,r]=T.useState(""),a=ar(),o=Ue.use.graphLayoutMaxIterations(),s=Y0({iterations:o}),u=T.useCallback(()=>{if(!a)return;const P=a.getGraph(),Y=s.positions();$j(P,Y,{duration:500})},[a,s]),c=Ue.use.showPropertyPanel(),d=Ue.use.showNodeSearchBar(),p=Ue.use.showNodeLabel(),g=Ue.use.enableEdgeEvents(),m=Ue.use.enableNodeDrag(),b=Ue.use.enableHideUnselectedEdges(),v=Ue.use.showEdgeLabel(),S=Ue.use.graphQueryMaxDepth(),k=Ue.use.graphMinDegree(),R=Ue.use.graphLayoutMaxIterations(),x=Ue.use.enableHealthCheck(),_=Ue.use.apiKey();T.useEffect(()=>{r(_||"")},[_,e]);const N=T.useCallback(()=>Ue.setState(P=>({enableNodeDrag:!P.enableNodeDrag})),[]),O=T.useCallback(()=>Ue.setState(P=>({enableEdgeEvents:!P.enableEdgeEvents})),[]),A=T.useCallback(()=>Ue.setState(P=>({enableHideUnselectedEdges:!P.enableHideUnselectedEdges})),[]),C=T.useCallback(()=>Ue.setState(P=>({showEdgeLabel:!P.showEdgeLabel})),[]),F=T.useCallback(()=>Ue.setState(P=>({showPropertyPanel:!P.showPropertyPanel})),[]),I=T.useCallback(()=>Ue.setState(P=>({showNodeSearchBar:!P.showNodeSearchBar})),[]),L=T.useCallback(()=>Ue.setState(P=>({showNodeLabel:!P.showNodeLabel})),[]),H=T.useCallback(()=>Ue.setState(P=>({enableHealthCheck:!P.enableHealthCheck})),[]),$=T.useCallback(P=>{P<1||Ue.setState({graphQueryMaxDepth:P})},[]),U=T.useCallback(P=>{P<0||Ue.setState({graphMinDegree:P})},[]),W=T.useCallback(P=>{P<1||Ue.setState({graphLayoutMaxIterations:P})},[]),Z=T.useCallback(async()=>{Ue.setState({apiKey:n||null}),await Gn.getState().check(),t(!1)},[n]),G=T.useCallback(P=>{r(P.target.value)},[r]),{t:j}=Ft();return E.jsxs(E.Fragment,{children:[E.jsx(Ot,{variant:La,tooltip:j("graphPanel.sideBar.settings.refreshLayout"),size:"icon",onClick:u,children:E.jsx(pB,{})}),E.jsxs(Nu,{open:e,onOpenChange:t,children:[E.jsx(Ou,{asChild:!0,children:E.jsx(Ot,{variant:La,tooltip:j("graphPanel.sideBar.settings.settings"),size:"icon",children:E.jsx(nV,{})})}),E.jsx(Ps,{side:"right",align:"start",className:"mb-2 p-2",onCloseAutoFocus:P=>P.preventDefault(),children:E.jsxs("div",{className:"flex flex-col gap-2",children:[E.jsx(go,{checked:x,onCheckedChange:H,label:j("graphPanel.sideBar.settings.healthCheck")}),E.jsx(fs,{}),E.jsx(go,{checked:c,onCheckedChange:F,label:j("graphPanel.sideBar.settings.showPropertyPanel")}),E.jsx(go,{checked:d,onCheckedChange:I,label:j("graphPanel.sideBar.settings.showSearchBar")}),E.jsx(fs,{}),E.jsx(go,{checked:p,onCheckedChange:L,label:j("graphPanel.sideBar.settings.showNodeLabel")}),E.jsx(go,{checked:m,onCheckedChange:N,label:j("graphPanel.sideBar.settings.nodeDraggable")}),E.jsx(fs,{}),E.jsx(go,{checked:v,onCheckedChange:C,label:j("graphPanel.sideBar.settings.showEdgeLabel")}),E.jsx(go,{checked:b,onCheckedChange:A,label:j("graphPanel.sideBar.settings.hideUnselectedEdges")}),E.jsx(go,{checked:g,onCheckedChange:O,label:j("graphPanel.sideBar.settings.edgeEvents")}),E.jsx(fs,{}),E.jsx(_m,{label:j("graphPanel.sideBar.settings.maxQueryDepth"),min:1,value:S,onEditFinished:$}),E.jsx(_m,{label:j("graphPanel.sideBar.settings.minDegree"),min:0,value:k,onEditFinished:U}),E.jsx(_m,{label:j("graphPanel.sideBar.settings.maxLayoutIterations"),min:1,max:30,value:R,onEditFinished:W}),E.jsx(fs,{}),E.jsxs("div",{className:"flex flex-col gap-2",children:[E.jsx("label",{className:"text-sm font-medium",children:j("graphPanel.sideBar.settings.apiKey")}),E.jsxs("form",{className:"flex h-6 gap-2",onSubmit:P=>P.preventDefault(),children:[E.jsx("div",{className:"w-0 flex-1",children:E.jsx(Ao,{type:"password",value:n,onChange:G,placeholder:j("graphPanel.sideBar.settings.enterYourAPIkey"),className:"max-h-full w-full min-w-0",autoComplete:"off"})}),E.jsx(Ot,{onClick:Z,variant:"outline",size:"sm",className:"max-h-full shrink-0",children:j("graphPanel.sideBar.settings.save")})]})]})]})})]})]})}const lne="ENTRIES",F4="KEYS",P4="VALUES",mn="";class Rm{constructor(t,n){const r=t._tree,a=Array.from(r.keys());this.set=t,this._type=n,this._path=a.length>0?[{node:r,keys:a}]:[]}next(){const t=this.dive();return this.backtrack(),t}dive(){if(this._path.length===0)return{done:!0,value:void 0};const{node:t,keys:n}=ss(this._path);if(ss(n)===mn)return{done:!1,value:this.result()};const r=t.get(ss(n));return this._path.push({node:r,keys:Array.from(r.keys())}),this.dive()}backtrack(){if(this._path.length===0)return;const t=ss(this._path).keys;t.pop(),!(t.length>0)&&(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map(({keys:t})=>ss(t)).filter(t=>t!==mn).join("")}value(){return ss(this._path).node.get(mn)}result(){switch(this._type){case P4:return this.value();case F4:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}}const ss=e=>e[e.length-1],une=(e,t,n)=>{const r=new Map;if(t===void 0)return r;const a=t.length+1,o=a+n,s=new Uint8Array(o*a).fill(n+1);for(let u=0;u{const c=o*s;e:for(const d of e.keys())if(d===mn){const p=a[c-1];p<=n&&r.set(u,[e.get(d),p])}else{let p=o;for(let g=0;gn)continue e}z4(e.get(d),t,n,r,a,p,s,u+d)}};class yo{constructor(t=new Map,n=""){this._size=void 0,this._tree=t,this._prefix=n}atPrefix(t){if(!t.startsWith(this._prefix))throw new Error("Mismatched prefix");const[n,r]=cf(this._tree,t.slice(this._prefix.length));if(n===void 0){const[a,o]=aT(r);for(const s of a.keys())if(s!==mn&&s.startsWith(o)){const u=new Map;return u.set(s.slice(o.length),a.get(s)),new yo(u,t)}}return new yo(n,t)}clear(){this._size=void 0,this._tree.clear()}delete(t){return this._size=void 0,cne(this._tree,t)}entries(){return new Rm(this,lne)}forEach(t){for(const[n,r]of this)t(n,r,this)}fuzzyGet(t,n){return une(this._tree,t,n)}get(t){const n=wk(this._tree,t);return n!==void 0?n.get(mn):void 0}has(t){const n=wk(this._tree,t);return n!==void 0&&n.has(mn)}keys(){return new Rm(this,F4)}set(t,n){if(typeof t!="string")throw new Error("key must be a string");return this._size=void 0,Cm(this._tree,t).set(mn,n),this}get size(){if(this._size)return this._size;this._size=0;const t=this.entries();for(;!t.next().done;)this._size+=1;return this._size}update(t,n){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;const r=Cm(this._tree,t);return r.set(mn,n(r.get(mn))),this}fetch(t,n){if(typeof t!="string")throw new Error("key must be a string");this._size=void 0;const r=Cm(this._tree,t);let a=r.get(mn);return a===void 0&&r.set(mn,a=n()),a}values(){return new Rm(this,P4)}[Symbol.iterator](){return this.entries()}static from(t){const n=new yo;for(const[r,a]of t)n.set(r,a);return n}static fromObject(t){return yo.from(Object.entries(t))}}const cf=(e,t,n=[])=>{if(t.length===0||e==null)return[e,n];for(const r of e.keys())if(r!==mn&&t.startsWith(r))return n.push([e,r]),cf(e.get(r),t.slice(r.length),n);return n.push([e,t]),cf(void 0,"",n)},wk=(e,t)=>{if(t.length===0||e==null)return e;for(const n of e.keys())if(n!==mn&&t.startsWith(n))return wk(e.get(n),t.slice(n.length))},Cm=(e,t)=>{const n=t.length;e:for(let r=0;e&&r{const[n,r]=cf(e,t);if(n!==void 0){if(n.delete(mn),n.size===0)B4(r);else if(n.size===1){const[a,o]=n.entries().next().value;U4(r,a,o)}}},B4=e=>{if(e.length===0)return;const[t,n]=aT(e);if(t.delete(n),t.size===0)B4(e.slice(0,-1));else if(t.size===1){const[r,a]=t.entries().next().value;r!==mn&&U4(e.slice(0,-1),r,a)}},U4=(e,t,n)=>{if(e.length===0)return;const[r,a]=aT(e);r.set(a+t,n),r.delete(a)},aT=e=>e[e.length-1],oT="or",j4="and",dne="and_not";class Eo{constructor(t){if((t==null?void 0:t.fields)==null)throw new Error('MiniSearch: option "fields" must be provided');const n=t.autoVacuum==null||t.autoVacuum===!0?Dm:t.autoVacuum;this._options={...Om,...t,autoVacuum:n,searchOptions:{...ZN,...t.searchOptions||{}},autoSuggestOptions:{...mne,...t.autoSuggestOptions||{}}},this._index=new yo,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=kk,this.addFields(this._options.fields)}add(t){const{extractField:n,tokenize:r,processTerm:a,fields:o,idField:s}=this._options,u=n(t,s);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${s}"`);if(this._idToShortId.has(u))throw new Error(`MiniSearch: duplicate ID ${u}`);const c=this.addDocumentId(u);this.saveStoredFields(c,t);for(const d of o){const p=n(t,d);if(p==null)continue;const g=r(p.toString(),d),m=this._fieldIds[d],b=new Set(g).size;this.addFieldLength(c,m,this._documentCount-1,b);for(const v of g){const S=a(v,d);if(Array.isArray(S))for(const k of S)this.addTerm(m,c,k);else S&&this.addTerm(m,c,S)}}}addAll(t){for(const n of t)this.add(n)}addAllAsync(t,n={}){const{chunkSize:r=10}=n,a={chunk:[],promise:Promise.resolve()},{chunk:o,promise:s}=t.reduce(({chunk:u,promise:c},d,p)=>(u.push(d),(p+1)%r===0?{chunk:[],promise:c.then(()=>new Promise(g=>setTimeout(g,0))).then(()=>this.addAll(u))}:{chunk:u,promise:c}),a);return s.then(()=>this.addAll(o))}remove(t){const{tokenize:n,processTerm:r,extractField:a,fields:o,idField:s}=this._options,u=a(t,s);if(u==null)throw new Error(`MiniSearch: document does not have ID field "${s}"`);const c=this._idToShortId.get(u);if(c==null)throw new Error(`MiniSearch: cannot remove document with ID ${u}: it is not in the index`);for(const d of o){const p=a(t,d);if(p==null)continue;const g=n(p.toString(),d),m=this._fieldIds[d],b=new Set(g).size;this.removeFieldLength(c,m,this._documentCount,b);for(const v of g){const S=r(v,d);if(Array.isArray(S))for(const k of S)this.removeTerm(m,c,k);else S&&this.removeTerm(m,c,S)}}this._storedFields.delete(c),this._documentIds.delete(c),this._idToShortId.delete(u),this._fieldLength.delete(c),this._documentCount-=1}removeAll(t){if(t)for(const n of t)this.remove(n);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new yo,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(t){const n=this._idToShortId.get(t);if(n==null)throw new Error(`MiniSearch: cannot discard document with ID ${t}: it is not in the index`);this._idToShortId.delete(t),this._documentIds.delete(n),this._storedFields.delete(n),(this._fieldLength.get(n)||[]).forEach((r,a)=>{this.removeFieldLength(n,a,this._documentCount,r)}),this._fieldLength.delete(n),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(this._options.autoVacuum===!1)return;const{minDirtFactor:t,minDirtCount:n,batchSize:r,batchWait:a}=this._options.autoVacuum;this.conditionalVacuum({batchSize:r,batchWait:a},{minDirtCount:n,minDirtFactor:t})}discardAll(t){const n=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(const r of t)this.discard(r)}finally{this._options.autoVacuum=n}this.maybeAutoVacuum()}replace(t){const{idField:n,extractField:r}=this._options,a=r(t,n);this.discard(a),this.add(t)}vacuum(t={}){return this.conditionalVacuum(t)}conditionalVacuum(t,n){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&n,this._enqueuedVacuum!=null?this._enqueuedVacuum:(this._enqueuedVacuum=this._currentVacuum.then(()=>{const r=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=kk,this.performVacuuming(t,r)}),this._enqueuedVacuum)):this.vacuumConditionsMet(n)===!1?Promise.resolve():(this._currentVacuum=this.performVacuuming(t),this._currentVacuum)}async performVacuuming(t,n){const r=this._dirtCount;if(this.vacuumConditionsMet(n)){const a=t.batchSize||xk.batchSize,o=t.batchWait||xk.batchWait;let s=1;for(const[u,c]of this._index){for(const[d,p]of c)for(const[g]of p)this._documentIds.has(g)||(p.size<=1?c.delete(d):p.delete(g));this._index.get(u).size===0&&this._index.delete(u),s%a===0&&await new Promise(d=>setTimeout(d,o)),s+=1}this._dirtCount-=r}await null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}vacuumConditionsMet(t){if(t==null)return!0;let{minDirtCount:n,minDirtFactor:r}=t;return n=n||Dm.minDirtCount,r=r||Dm.minDirtFactor,this.dirtCount>=n&&this.dirtFactor>=r}get isVacuuming(){return this._currentVacuum!=null}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(t){return this._idToShortId.has(t)}getStoredFields(t){const n=this._idToShortId.get(t);if(n!=null)return this._storedFields.get(n)}search(t,n={}){const{searchOptions:r}=this._options,a={...r,...n},o=this.executeQuery(t,n),s=[];for(const[u,{score:c,terms:d,match:p}]of o){const g=d.length||1,m={id:this._documentIds.get(u),score:c*g,terms:Object.keys(p),queryTerms:d,match:p};Object.assign(m,this._storedFields.get(u)),(a.filter==null||a.filter(m))&&s.push(m)}return t===Eo.wildcard&&a.boostDocument==null||s.sort(JN),s}autoSuggest(t,n={}){n={...this._options.autoSuggestOptions,...n};const r=new Map;for(const{score:o,terms:s}of this.search(t,n)){const u=s.join(" "),c=r.get(u);c!=null?(c.score+=o,c.count+=1):r.set(u,{score:o,terms:s,count:1})}const a=[];for(const[o,{score:s,terms:u,count:c}]of r)a.push({suggestion:o,terms:u,score:s/c});return a.sort(JN),a}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(t,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(t),n)}static async loadJSONAsync(t,n){if(n==null)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(t),n)}static getDefault(t){if(Om.hasOwnProperty(t))return Nm(Om,t);throw new Error(`MiniSearch: unknown option "${t}"`)}static loadJS(t,n){const{index:r,documentIds:a,fieldLength:o,storedFields:s,serializationVersion:u}=t,c=this.instantiateMiniSearch(t,n);c._documentIds=md(a),c._fieldLength=md(o),c._storedFields=md(s);for(const[d,p]of c._documentIds)c._idToShortId.set(p,d);for(const[d,p]of r){const g=new Map;for(const m of Object.keys(p)){let b=p[m];u===1&&(b=b.ds),g.set(parseInt(m,10),md(b))}c._index.set(d,g)}return c}static async loadJSAsync(t,n){const{index:r,documentIds:a,fieldLength:o,storedFields:s,serializationVersion:u}=t,c=this.instantiateMiniSearch(t,n);c._documentIds=await bd(a),c._fieldLength=await bd(o),c._storedFields=await bd(s);for(const[p,g]of c._documentIds)c._idToShortId.set(g,p);let d=0;for(const[p,g]of r){const m=new Map;for(const b of Object.keys(g)){let v=g[b];u===1&&(v=v.ds),m.set(parseInt(b,10),await bd(v))}++d%1e3===0&&await G4(0),c._index.set(p,m)}return c}static instantiateMiniSearch(t,n){const{documentCount:r,nextId:a,fieldIds:o,averageFieldLength:s,dirtCount:u,serializationVersion:c}=t;if(c!==1&&c!==2)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");const d=new Eo(n);return d._documentCount=r,d._nextId=a,d._idToShortId=new Map,d._fieldIds=o,d._avgFieldLength=s,d._dirtCount=u||0,d._index=new yo,d}executeQuery(t,n={}){if(t===Eo.wildcard)return this.executeWildcardQuery(n);if(typeof t!="string"){const m={...n,...t,queries:void 0},b=t.queries.map(v=>this.executeQuery(v,m));return this.combineResults(b,m.combineWith)}const{tokenize:r,processTerm:a,searchOptions:o}=this._options,s={tokenize:r,processTerm:a,...o,...n},{tokenize:u,processTerm:c}=s,g=u(t).flatMap(m=>c(m)).filter(m=>!!m).map(hne(s)).map(m=>this.executeQuerySpec(m,s));return this.combineResults(g,s.combineWith)}executeQuerySpec(t,n){const r={...this._options.searchOptions,...n},a=(r.fields||this._options.fields).reduce((S,k)=>({...S,[k]:Nm(r.boost,k)||1}),{}),{boostDocument:o,weights:s,maxFuzzy:u,bm25:c}=r,{fuzzy:d,prefix:p}={...ZN.weights,...s},g=this._index.get(t.term),m=this.termResults(t.term,t.term,1,t.termBoost,g,a,o,c);let b,v;if(t.prefix&&(b=this._index.atPrefix(t.term)),t.fuzzy){const S=t.fuzzy===!0?.2:t.fuzzy,k=S<1?Math.min(u,Math.round(t.term.length*S)):S;k&&(v=this._index.fuzzyGet(t.term,k))}if(b)for(const[S,k]of b){const R=S.length-t.term.length;if(!R)continue;v==null||v.delete(S);const x=p*S.length/(S.length+.3*R);this.termResults(t.term,S,x,t.termBoost,k,a,o,c,m)}if(v)for(const S of v.keys()){const[k,R]=v.get(S);if(!R)continue;const x=d*S.length/(S.length+R);this.termResults(t.term,S,x,t.termBoost,k,a,o,c,m)}return m}executeWildcardQuery(t){const n=new Map,r={...this._options.searchOptions,...t};for(const[a,o]of this._documentIds){const s=r.boostDocument?r.boostDocument(o,"",this._storedFields.get(a)):1;n.set(a,{score:s,terms:[],match:{}})}return n}combineResults(t,n=oT){if(t.length===0)return new Map;const r=n.toLowerCase(),a=fne[r];if(!a)throw new Error(`Invalid combination operator: ${n}`);return t.reduce(a)||new Map}toJSON(){const t=[];for(const[n,r]of this._index){const a={};for(const[o,s]of r)a[o]=Object.fromEntries(s);t.push([n,a])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:t,serializationVersion:2}}termResults(t,n,r,a,o,s,u,c,d=new Map){if(o==null)return d;for(const p of Object.keys(s)){const g=s[p],m=this._fieldIds[p],b=o.get(m);if(b==null)continue;let v=b.size;const S=this._avgFieldLength[m];for(const k of b.keys()){if(!this._documentIds.has(k)){this.removeTerm(m,k,n),v-=1;continue}const R=u?u(this._documentIds.get(k),n,this._storedFields.get(k)):1;if(!R)continue;const x=b.get(k),_=this._fieldLength.get(k)[m],N=gne(x,v,this._documentCount,_,S,c),O=r*a*g*R*N,A=d.get(k);if(A){A.score+=O,bne(A.terms,t);const C=Nm(A.match,n);C?C.push(p):A.match[n]=[p]}else d.set(k,{score:O,terms:[t],match:{[n]:[p]}})}}return d}addTerm(t,n,r){const a=this._index.fetch(r,eO);let o=a.get(t);if(o==null)o=new Map,o.set(n,1),a.set(t,o);else{const s=o.get(n);o.set(n,(s||0)+1)}}removeTerm(t,n,r){if(!this._index.has(r)){this.warnDocumentChanged(n,t,r);return}const a=this._index.fetch(r,eO),o=a.get(t);o==null||o.get(n)==null?this.warnDocumentChanged(n,t,r):o.get(n)<=1?o.size<=1?a.delete(t):o.delete(n):o.set(n,o.get(n)-1),this._index.get(r).size===0&&this._index.delete(r)}warnDocumentChanged(t,n,r){for(const a of Object.keys(this._fieldIds))if(this._fieldIds[a]===n){this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(t)} has changed before removal: term "${r}" was not present in field "${a}". Removing a document after it has changed can corrupt the index!`,"version_conflict");return}}addDocumentId(t){const n=this._nextId;return this._idToShortId.set(t,n),this._documentIds.set(n,t),this._documentCount+=1,this._nextId+=1,n}addFields(t){for(let n=0;nObject.prototype.hasOwnProperty.call(e,t)?e[t]:void 0,fne={[oT]:(e,t)=>{for(const n of t.keys()){const r=e.get(n);if(r==null)e.set(n,t.get(n));else{const{score:a,terms:o,match:s}=t.get(n);r.score=r.score+a,r.match=Object.assign(r.match,s),QN(r.terms,o)}}return e},[j4]:(e,t)=>{const n=new Map;for(const r of t.keys()){const a=e.get(r);if(a==null)continue;const{score:o,terms:s,match:u}=t.get(r);QN(a.terms,s),n.set(r,{score:a.score+o,terms:a.terms,match:Object.assign(a.match,u)})}return n},[dne]:(e,t)=>{for(const n of t.keys())e.delete(n);return e}},pne={k:1.2,b:.7,d:.5},gne=(e,t,n,r,a,o)=>{const{k:s,b:u,d:c}=o;return Math.log(1+(n-t+.5)/(t+.5))*(c+e*(s+1)/(e+s*(1-u+u*r/a)))},hne=e=>(t,n,r)=>{const a=typeof e.fuzzy=="function"?e.fuzzy(t,n,r):e.fuzzy||!1,o=typeof e.prefix=="function"?e.prefix(t,n,r):e.prefix===!0,s=typeof e.boostTerm=="function"?e.boostTerm(t,n,r):1;return{term:t,fuzzy:a,prefix:o,termBoost:s}},Om={idField:"id",extractField:(e,t)=>e[t],tokenize:e=>e.split(yne),processTerm:e=>e.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(e,t)=>{typeof(console==null?void 0:console[e])=="function"&&console[e](t)},autoVacuum:!0},ZN={combineWith:oT,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:pne},mne={combineWith:j4,prefix:(e,t,n)=>t===n.length-1},xk={batchSize:1e3,batchWait:10},kk={minDirtFactor:.1,minDirtCount:20},Dm={...xk,...kk},bne=(e,t)=>{e.includes(t)||e.push(t)},QN=(e,t)=>{for(const n of t)e.includes(n)||e.push(n)},JN=({score:e},{score:t})=>t-e,eO=()=>new Map,md=e=>{const t=new Map;for(const n of Object.keys(e))t.set(parseInt(n,10),e[n]);return t},bd=async e=>{const t=new Map;let n=0;for(const r of Object.keys(e))t.set(parseInt(r,10),e[r]),++n%1e3===0&&await G4(0);return t},G4=e=>new Promise(t=>setTimeout(t,e)),yne=/[\n\r\p{Z}\p{P}]+/u;function Tk(){return Tk=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);nve.createElement("div",{className:"node"},ve.createElement("span",{className:"render "+(n?"circle":"disc"),style:{backgroundColor:t||"#000"}}),ve.createElement("span",{className:`label ${n?"text-muted":""} ${e?"":"text-italic"}`},e||r.no_label||"No label")),Rne=({id:e,labels:t})=>{const n=ar(),r=T.useMemo(()=>{const a=n.getGraph().getNodeAttributes(e),o=n.getSetting("nodeReducer");return Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},a),o?o(e,a):{})},[n,e]);return ve.createElement(Rk,Object.assign({},r,{labels:t}))},Cne=({label:e,color:t,source:n,target:r,hidden:a,directed:o,labels:s={}})=>ve.createElement("div",{className:"edge"},ve.createElement(Rk,Object.assign({},n,{labels:s})),ve.createElement("div",{className:"body"},ve.createElement("div",{className:"render"},ve.createElement("span",{className:a?"dotted":"dash",style:{borderColor:t||"#000"}})," ",o&&ve.createElement("span",{className:"arrow",style:{borderTopColor:t||"#000"}})),ve.createElement("span",{className:`label ${a?"text-muted":""} ${e?"":"fst-italic"}`},e||s.no_label||"No label")),ve.createElement(Rk,Object.assign({},r,{labels:s}))),Nne=({id:e,labels:t})=>{const n=ar(),r=T.useMemo(()=>{const a=n.getGraph().getEdgeAttributes(e),o=n.getSetting("nodeReducer"),s=n.getSetting("edgeReducer"),u=n.getGraph().getNodeAttributes(n.getGraph().source(e)),c=n.getGraph().getNodeAttributes(n.getGraph().target(e));return Object.assign(Object.assign(Object.assign({color:n.getSetting("defaultEdgeColor"),directed:n.getGraph().isDirected(e)},a),s?s(e,a):{}),{source:Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},u),o?o(e,u):{}),target:Object.assign(Object.assign({color:n.getSetting("defaultNodeColor")},c),o?o(e,c):{})})},[n,e]);return ve.createElement(Cne,Object.assign({},r,{labels:t}))};function iT(e,t){const[n,r]=T.useState(e);return T.useEffect(()=>{const a=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(a)}},[e,t]),n}function One({fetcher:e,preload:t,filterFn:n,renderOption:r,getOptionValue:a,notFound:o,loadingSkeleton:s,label:u,placeholder:c="Select...",value:d,onChange:p,onFocus:g,disabled:m=!1,className:b,noResultsMessage:v}){const[S,k]=T.useState(!1),[R,x]=T.useState(!1),[_,N]=T.useState([]),[O,A]=T.useState(!1),[C,F]=T.useState(null),[I,L]=T.useState(d),[H,$]=T.useState(null),[U,W]=T.useState(""),Z=iT(U,t?0:150),[G,j]=T.useState([]);T.useEffect(()=>{k(!0),L(d)},[d]),T.useEffect(()=>{S||(async()=>{try{A(!0),F(null);const V=d!==null?await e(d):[];j(V),N(V)}catch(V){F(V instanceof Error?V.message:"Failed to fetch options")}finally{A(!1)}})()},[S,e,d]),T.useEffect(()=>{const D=async()=>{try{A(!0),F(null);const V=await e(Z);j(V),N(V)}catch(V){F(V instanceof Error?V.message:"Failed to fetch options")}finally{A(!1)}};S&&t?t&&N(Z?G.filter(V=>n?n(V,Z):!0):G):D()},[e,Z,S,t,n]);const P=T.useCallback(D=>{D!==I&&(L(D),p(D)),x(!1)},[I,L,x,p]),Y=T.useCallback(D=>{D!==H&&($(D),g(D))},[H,$,g]);return E.jsx("div",{className:Me(m&&"cursor-not-allowed opacity-50",b),onFocus:()=>{x(!0)},onBlur:()=>x(!1),children:E.jsxs(np,{shouldFilter:!1,className:"bg-transparent",children:[E.jsxs("div",{children:[E.jsx(tT,{placeholder:c,value:U,className:"max-h-8",onValueChange:D=>{W(D),D&&!R&&x(!0)}}),O&&_.length>0&&E.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:E.jsx(fB,{className:"h-4 w-4 animate-spin"})})]}),E.jsxs(rp,{hidden:!R,children:[C&&E.jsx("div",{className:"text-destructive p-4 text-center",children:C}),O&&_.length===0&&(s||E.jsx(Dne,{})),!O&&!C&&_.length===0&&(o||E.jsx(nT,{children:v??`No ${u.toLowerCase()} found.`})),E.jsx(Hs,{children:_.map((D,V)=>E.jsxs(ve.Fragment,{children:[E.jsx($s,{value:a(D),onSelect:P,onMouseEnter:()=>Y(a(D)),className:"truncate",children:r(D)},a(D)+`${V}`),V!==_.length-1&&E.jsx("div",{className:"bg-foreground/10 h-[1px]"},`divider-${V}`)]},a(D)+`-fragment-${V}`))})]})]})})}function Dne(){return E.jsx(Hs,{children:E.jsx($s,{disabled:!0,children:E.jsxs("div",{className:"flex w-full items-center gap-2",children:[E.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),E.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[E.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),E.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}const Im="__message_item",vr={graph:null,searchEngine:null},Ine=({id:e})=>{const t=$e.use.sigmaGraph();return t!=null&&t.hasNode(e)?E.jsx(Rne,{id:e}):null};function Lne(e){return E.jsxs("div",{children:[e.type==="nodes"&&E.jsx(Ine,{id:e.id}),e.type==="edges"&&E.jsx(Nne,{id:e.id}),e.type==="message"&&E.jsx("div",{children:e.message})]})}const Mne=({onChange:e,onFocus:t,value:n})=>{const{t:r}=Ft(),a=$e.use.sigmaGraph();T.useEffect(()=>{a&&(vr.graph=null,vr.searchEngine=null)},[a]);const o=T.useMemo(()=>{if(vr.graph==a)return vr.searchEngine;if(!a||a.nodes().length==0)return;vr.graph=a;const u=new Eo({idField:"id",fields:["label"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),c=a.nodes().map(d=>({id:d,label:a.getNodeAttribute(d,"label")}));return u.addAll(c),vr.searchEngine=u,u},[a]),s=T.useCallback(async u=>{if(t&&t(null),!a||!o)return vr.graph=null,vr.searchEngine=null,[];if(a.nodes().length===0)return[];if(!u)return a.nodes().filter(p=>a.hasNode(p)).slice(0,Qc).map(p=>({id:p,type:"nodes"}));const c=o.search(u).filter(d=>a.hasNode(d.id)).map(d=>({id:d.id,type:"nodes"}));return c.length<=Qc?c:[...c.slice(0,Qc),{type:"message",id:Im,message:r("graphPanel.search.message",{count:c.length-Qc})}]},[a,o,t,r]);return E.jsx(One,{className:"bg-background/60 w-24 rounded-xl border-1 opacity-60 backdrop-blur-lg transition-all hover:w-fit hover:opacity-100",fetcher:s,renderOption:Lne,getOptionValue:u=>u.id,value:n&&n.type!=="message"?n.id:null,onChange:u=>{u!==Im&&e(u?{id:u,type:"nodes"}:null)},onFocus:u=>{u!==Im&&t&&t(u?{id:u,type:"nodes"}:null)},label:"item",placeholder:r("graphPanel.search.placeholder")})},Fne=({...e})=>E.jsx(Mne,{...e});function Pne({fetcher:e,preload:t,filterFn:n,renderOption:r,getOptionValue:a,getDisplayValue:o,notFound:s,loadingSkeleton:u,label:c,placeholder:d="Select...",value:p,onChange:g,disabled:m=!1,className:b,triggerClassName:v,searchInputClassName:S,noResultsMessage:k,triggerTooltip:R,clearable:x=!0}){const[_,N]=T.useState(!1),[O,A]=T.useState(!1),[C,F]=T.useState([]),[I,L]=T.useState(!1),[H,$]=T.useState(null),[U,W]=T.useState(p),[Z,G]=T.useState(null),[j,P]=T.useState(""),Y=iT(j,t?0:150),[D,V]=T.useState([]);T.useEffect(()=>{N(!0),W(p)},[p]),T.useEffect(()=>{if(p&&C.length>0){const M=C.find(K=>a(K)===p);M&&G(M)}},[p,C,a]),T.useEffect(()=>{_||(async()=>{try{L(!0),$(null);const K=await e(p);V(K),F(K)}catch(K){$(K instanceof Error?K.message:"Failed to fetch options")}finally{L(!1)}})()},[_,e,p]),T.useEffect(()=>{const M=async()=>{try{L(!0),$(null);const K=await e(Y);V(K),F(K)}catch(K){$(K instanceof Error?K.message:"Failed to fetch options")}finally{L(!1)}};_&&t?t&&F(Y?D.filter(K=>n?n(K,Y):!0):D):M()},[e,Y,_,t,n]);const B=T.useCallback(M=>{const K=x&&M===U?"":M;W(K),G(C.find(J=>a(J)===K)||null),g(K),A(!1)},[U,g,x,C,a]);return E.jsxs(Nu,{open:O,onOpenChange:A,children:[E.jsx(Ou,{asChild:!0,children:E.jsxs(Ot,{variant:"outline",role:"combobox","aria-expanded":O,className:Me("justify-between",m&&"cursor-not-allowed opacity-50",v),disabled:m,tooltip:R,side:"bottom",children:[Z?o(Z):d,E.jsx(b7,{className:"opacity-50",size:10})]})}),E.jsx(Ps,{className:Me("p-0",b),onCloseAutoFocus:M=>M.preventDefault(),children:E.jsxs(np,{shouldFilter:!1,children:[E.jsxs("div",{className:"relative w-full border-b",children:[E.jsx(tT,{placeholder:`Search ${c.toLowerCase()}...`,value:j,onValueChange:M=>{P(M)},className:S}),I&&C.length>0&&E.jsx("div",{className:"absolute top-1/2 right-2 flex -translate-y-1/2 transform items-center",children:E.jsx(fB,{className:"h-4 w-4 animate-spin"})})]}),E.jsxs(rp,{children:[H&&E.jsx("div",{className:"text-destructive p-4 text-center",children:H}),I&&C.length===0&&(u||E.jsx(zne,{})),!I&&!H&&C.length===0&&(s||E.jsx(nT,{children:k??`No ${c.toLowerCase()} found.`})),E.jsx(Hs,{children:C.map(M=>E.jsxs($s,{value:a(M),onSelect:B,className:"truncate",children:[r(M),E.jsx(n0,{className:Me("ml-auto h-3 w-3",U===a(M)?"opacity-100":"opacity-0")})]},a(M)))})]})]})})]})}function zne(){return E.jsx(Hs,{children:E.jsx($s,{disabled:!0,children:E.jsxs("div",{className:"flex w-full items-center gap-2",children:[E.jsx("div",{className:"bg-muted h-6 w-6 animate-pulse rounded-full"}),E.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[E.jsx("div",{className:"bg-muted h-4 w-24 animate-pulse rounded"}),E.jsx("div",{className:"bg-muted h-3 w-16 animate-pulse rounded"})]})]})})})}const Bne=()=>{const{t:e}=Ft(),t=Ue.use.queryLabel(),n=$e.use.allDatabaseLabels(),r=T.useRef(!1),a=T.useRef(!1);T.useEffect(()=>{!$e.getState().labelsFetchAttempted&&!a.current&&(a.current=!0,$e.getState().setLabelsFetchAttempted(!0),console.log("Fetching graph labels (once per session)..."),$e.getState().fetchAllDatabaseLabels().then(()=>{r.current=!0,a.current=!1}).catch(c=>{console.error("Failed to fetch labels:",c),a.current=!1,$e.getState().setLabelsFetchAttempted(!1)}))},[]);const o=T.useCallback(()=>{const u=new Eo({idField:"id",fields:["value"],searchOptions:{prefix:!0,fuzzy:.2,boost:{label:2}}}),c=n.map((d,p)=>({id:p,value:d}));return u.addAll(c),{labels:n,searchEngine:u}},[n]),s=T.useCallback(async u=>{const{labels:c,searchEngine:d}=o();let p=c;return u&&(p=d.search(u).map(g=>c[g.id])),p.length<=YR?p:[...p.slice(0,YR),"..."]},[o]);return E.jsx(Pne,{className:"ml-2",triggerClassName:"max-h-8",searchInputClassName:"max-h-8",triggerTooltip:e("graphPanel.graphLabels.selectTooltip"),fetcher:s,renderOption:u=>E.jsx("div",{children:u}),getOptionValue:u=>u,getDisplayValue:u=>E.jsx("div",{children:u}),notFound:E.jsx("div",{className:"py-6 text-center text-sm",children:"No labels found"}),label:e("graphPanel.graphLabels.label"),placeholder:e("graphPanel.graphLabels.placeholder"),value:t!==null?t:"*",onChange:u=>{const c=Ue.getState().queryLabel;u==="..."&&(u="*"),$e.getState().setGraphDataFetchAttempted(!1),u!==c&&$e.getState().reset(),u===c&&u!=="*"?Ue.getState().setQueryLabel("*"):Ue.getState().setQueryLabel(u)},clearable:!1})},zn=({text:e,className:t,tooltipClassName:n,tooltip:r,side:a,onClick:o})=>r?E.jsx(BU,{delayDuration:200,children:E.jsxs(UU,{children:[E.jsx(jU,{asChild:!0,children:E.jsx("label",{className:Me(t,o!==void 0?"cursor-pointer":void 0),onClick:o,children:e})}),E.jsx(N0,{side:a,className:n,children:r})]})}):E.jsx("label",{className:Me(t,o!==void 0?"cursor-pointer":void 0),onClick:o,children:e});var Ld={exports:{}},Une=Ld.exports,tO;function jne(){return tO||(tO=1,function(e){(function(t,n,r){function a(c){var d=this,p=u();d.next=function(){var g=2091639*d.s0+d.c*23283064365386963e-26;return d.s0=d.s1,d.s1=d.s2,d.s2=g-(d.c=g|0)},d.c=1,d.s0=p(" "),d.s1=p(" "),d.s2=p(" "),d.s0-=p(c),d.s0<0&&(d.s0+=1),d.s1-=p(c),d.s1<0&&(d.s1+=1),d.s2-=p(c),d.s2<0&&(d.s2+=1),p=null}function o(c,d){return d.c=c.c,d.s0=c.s0,d.s1=c.s1,d.s2=c.s2,d}function s(c,d){var p=new a(c),g=d&&d.state,m=p.next;return m.int32=function(){return p.next()*4294967296|0},m.double=function(){return m()+(m()*2097152|0)*11102230246251565e-32},m.quick=m,g&&(typeof g=="object"&&o(g,p),m.state=function(){return o(p,{})}),m}function u(){var c=4022871197,d=function(p){p=String(p);for(var g=0;g>>0,m-=c,m*=c,c=m>>>0,m-=c,c+=m*4294967296}return(c>>>0)*23283064365386963e-26};return d}n&&n.exports?n.exports=s:this.alea=s})(Une,e)}(Ld)),Ld.exports}var Md={exports:{}},Gne=Md.exports,nO;function Hne(){return nO||(nO=1,function(e){(function(t,n,r){function a(u){var c=this,d="";c.x=0,c.y=0,c.z=0,c.w=0,c.next=function(){var g=c.x^c.x<<11;return c.x=c.y,c.y=c.z,c.z=c.w,c.w^=c.w>>>19^g^g>>>8},u===(u|0)?c.x=u:d+=u;for(var p=0;p>>0)/4294967296};return g.double=function(){do var m=d.next()>>>11,b=(d.next()>>>0)/4294967296,v=(m+b)/(1<<21);while(v===0);return v},g.int32=d.next,g.quick=g,p&&(typeof p=="object"&&o(p,d),g.state=function(){return o(d,{})}),g}n&&n.exports?n.exports=s:this.xor128=s})(Gne,e)}(Md)),Md.exports}var Fd={exports:{}},$ne=Fd.exports,rO;function qne(){return rO||(rO=1,function(e){(function(t,n,r){function a(u){var c=this,d="";c.next=function(){var g=c.x^c.x>>>2;return c.x=c.y,c.y=c.z,c.z=c.w,c.w=c.v,(c.d=c.d+362437|0)+(c.v=c.v^c.v<<4^(g^g<<1))|0},c.x=0,c.y=0,c.z=0,c.w=0,c.v=0,u===(u|0)?c.x=u:d+=u;for(var p=0;p>>4),c.next()}function o(u,c){return c.x=u.x,c.y=u.y,c.z=u.z,c.w=u.w,c.v=u.v,c.d=u.d,c}function s(u,c){var d=new a(u),p=c&&c.state,g=function(){return(d.next()>>>0)/4294967296};return g.double=function(){do var m=d.next()>>>11,b=(d.next()>>>0)/4294967296,v=(m+b)/(1<<21);while(v===0);return v},g.int32=d.next,g.quick=g,p&&(typeof p=="object"&&o(p,d),g.state=function(){return o(d,{})}),g}n&&n.exports?n.exports=s:this.xorwow=s})($ne,e)}(Fd)),Fd.exports}var Pd={exports:{}},Vne=Pd.exports,aO;function Wne(){return aO||(aO=1,function(e){(function(t,n,r){function a(u){var c=this;c.next=function(){var p=c.x,g=c.i,m,b;return m=p[g],m^=m>>>7,b=m^m<<24,m=p[g+1&7],b^=m^m>>>10,m=p[g+3&7],b^=m^m>>>3,m=p[g+4&7],b^=m^m<<7,m=p[g+7&7],m=m^m<<13,b^=m^m<<9,p[g]=b,c.i=g+1&7,b};function d(p,g){var m,b=[];if(g===(g|0))b[0]=g;else for(g=""+g,m=0;m