(self.webpackChunk=self.webpackChunk||[]).push([[9711],{3982:function(Mt,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.default=void 0;var F=function(L,_){var I=L.nodes,T=L.edges,x=[],p={};if(!I)throw new Error("invalid nodes data!");return I&&I.forEach(function(v,g){p[v.id]=g;var d=[];x.push(d)}),T&&T.forEach(function(v){var g=v.source,d=v.target,c=p[g],s=p[d];!c&&c!==0||!s&&s!==0||(x[c][s]=1,_||(x[s][c]=1))}),x},k=F;N.default=k},71673:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),Object.defineProperty(N,"GADDIAsync",{enumerable:!0,get:function(){return k.GADDIAsync}}),Object.defineProperty(N,"connectedComponentAsync",{enumerable:!0,get:function(){return k.connectedComponentAsync}}),N.default=void 0,Object.defineProperty(N,"detectAllCyclesAsync",{enumerable:!0,get:function(){return k.detectAllCyclesAsync}}),Object.defineProperty(N,"detectAllDirectedCycleAsync",{enumerable:!0,get:function(){return k.detectAllDirectedCycleAsync}}),Object.defineProperty(N,"detectAllUndirectedCycleAsync",{enumerable:!0,get:function(){return k.detectAllUndirectedCycleAsync}}),Object.defineProperty(N,"detectCycleAsync",{enumerable:!0,get:function(){return k.detectCycleAsync}}),N.detectDirectedCycleAsync=void 0,Object.defineProperty(N,"dijkstraAsync",{enumerable:!0,get:function(){return k.dijkstraAsync}}),Object.defineProperty(N,"findAllPathAsync",{enumerable:!0,get:function(){return k.findAllPathAsync}}),Object.defineProperty(N,"findShortestPathAsync",{enumerable:!0,get:function(){return k.findShortestPathAsync}}),Object.defineProperty(N,"floydWarshallAsync",{enumerable:!0,get:function(){return k.floydWarshallAsync}}),Object.defineProperty(N,"getAdjMatrixAsync",{enumerable:!0,get:function(){return k.getAdjMatrixAsync}}),Object.defineProperty(N,"getDegreeAsync",{enumerable:!0,get:function(){return k.getDegreeAsync}}),Object.defineProperty(N,"getInDegreeAsync",{enumerable:!0,get:function(){return k.getInDegreeAsync}}),Object.defineProperty(N,"getNeighborsAsync",{enumerable:!0,get:function(){return k.getNeighborsAsync}}),Object.defineProperty(N,"getOutDegreeAsync",{enumerable:!0,get:function(){return k.getOutDegreeAsync}}),Object.defineProperty(N,"labelPropagationAsync",{enumerable:!0,get:function(){return k.labelPropagationAsync}}),Object.defineProperty(N,"louvainAsync",{enumerable:!0,get:function(){return k.louvainAsync}}),Object.defineProperty(N,"minimumSpanningTreeAsync",{enumerable:!0,get:function(){return k.minimumSpanningTreeAsync}}),Object.defineProperty(N,"pageRankAsync",{enumerable:!0,get:function(){return k.pageRankAsync}});var k=F(19690),U=k.detectCycleAsync;N.detectDirectedCycleAsync=U;var L={getAdjMatrixAsync:k.getAdjMatrixAsync,connectedComponentAsync:k.connectedComponentAsync,getDegreeAsync:k.getDegreeAsync,getInDegreeAsync:k.getInDegreeAsync,getOutDegreeAsync:k.getOutDegreeAsync,detectCycleAsync:k.detectCycleAsync,detectDirectedCycleAsync:U,detectAllCyclesAsync:k.detectAllCyclesAsync,detectAllDirectedCycleAsync:k.detectAllDirectedCycleAsync,detectAllUndirectedCycleAsync:k.detectAllUndirectedCycleAsync,dijkstraAsync:k.dijkstraAsync,findAllPathAsync:k.findAllPathAsync,findShortestPathAsync:k.findShortestPathAsync,floydWarshallAsync:k.floydWarshallAsync,labelPropagationAsync:k.labelPropagationAsync,louvainAsync:k.louvainAsync,minimumSpanningTreeAsync:k.minimumSpanningTreeAsync,pageRankAsync:k.pageRankAsync,getNeighborsAsync:k.getNeighborsAsync,GADDIAsync:k.GADDIAsync};N.default=L},39834:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.default=void 0;var k=L(F(10780)),U=F(82890);function L(x){return x&&x.__esModule?x:{default:x}}function _(x){x===void 0&&(x={});var p=x,v=function(){},g=function(){var d={};return function(c){var s=c.next,m=s;return d[m]?!1:(d[m]=!0,!0)}}();return p.allowTraversal=x.allowTraversal||g,p.enter=x.enter||v,p.leave=x.leave||v,p}var I=function(p,v,g,d){d===void 0&&(d=!0);var c=_(g),s=new k.default,m=p.edges,M=m===void 0?[]:m;s.enqueue(v);for(var P="",R=function(){var Q=s.dequeue();c.enter({current:Q,previous:P}),(0,U.getNeighbors)(Q,M,d?"target":void 0).forEach(function(G){c.allowTraversal({previous:P,current:Q,next:G})&&s.enqueue(G)}),c.leave({current:Q,previous:P}),P=Q};!s.isEmpty();)R()},T=I;N.default=T},95482:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.default=_,N.detectStrongConnectComponents=N.detectConnectedComponents=void 0;var k=F(82890),U=function(T){for(var x=T.nodes,p=x===void 0?[]:x,v=T.edges,g=v===void 0?[]:v,d=[],c={},s=[],m=function j(Q){s.push(Q),c[Q.id]=!0;for(var G=(0,k.getNeighbors)(Q.id,g),W=function(J){var K=G[J];if(!c[K]){var ne=p.filter(function(se){return se.id===K});ne.length>0&&j(ne[0])}},H=0;H0;)R.push(s.pop());d.push(R)}}return d};N.detectConnectedComponents=U;var L=function(T){for(var x=T.nodes,p=x===void 0?[]:x,v=T.edges,g=v===void 0?[]:v,d=[],c={},s={},m={},M=[],P=0,R=function W(H){s[H.id]=P,m[H.id]=P,P+=1,d.push(H),c[H.id]=!0;for(var Z=(0,k.getNeighbors)(H.id,g,"target").filter(function(fe){return p.map(function(Ie){return Ie.id}).indexOf(fe)>-1}),J=function(Ie){var ye=Z[Ie];if(!s[ye]&&s[ye]!==0){var Ae=p.filter(function(Se){return Se.id===ye});Ae.length>0&&W(Ae[0]),m[H.id]=Math.min(m[H.id],m[ye])}else c[ye]&&(m[H.id]=Math.min(m[H.id],s[ye]))},K=0;K0;){var se=d.pop();if(c[se.id]=!1,ne.push(se),se===H)break}ne.length>0&&M.push(ne)}},j=0,Q=p;j0;)for(var Ie=ne.pop(),ye=Ie.id,Ae=(0,_.getNeighbors)(ye,m.edges),Se=function(ke){var Ge,tt=Ae[ke],He=m.nodes.find(function(xt){return xt.id===tt});if(tt===ye)Q.push((Ge={},Ge[tt]=Ie,Ge));else if(!(tt in fe))se[tt]=Ie,ne.push(He),fe[tt]=new Set([Ie]);else if(!fe[ye].has(He)){for(var ft=!0,Lt=[He,Ie],Jt=se[ye];fe[tt].size&&!fe[tt].has(Jt)&&(Lt.push(Jt),Jt!==se[Jt.id]);)Jt=se[Jt.id];if(Lt.push(Jt),M&&P?(ft=!1,Lt.findIndex(function(xt){return M.indexOf(xt.id)>-1})>-1&&(ft=!0)):M&&!P&&Lt.findIndex(function(xt){return M.indexOf(xt.id)>-1})>-1&&(ft=!1),ft){for(var Qe={},ut=1;ut0;){var ut=Qe.pop();j.has(ut)&&(j.delete(ut),Q[ut.id].forEach(function(xt){Qe.push(xt)}),Q[ut.id].clear())}},J=function Lt(Jt,Qe,ut){var xt=!1;if(M&&P===!1&&M.indexOf(Jt.id)>-1)return xt;R.push(Jt),j.add(Jt);for(var dt=ut[Jt.id],pt=0;pt-1});Hr-1)?G.push((Qe={},Qe[Nr.id]=Nr,Qe)):Ir[Nr.id].push(H[qt])}}return{component:ur,adjList:Ir,minIdx:xt}},Se=0;Se=Se}),Te=(0,L.detectStrongConnectComponents)({nodes:we,edges:m.edges}).filter(function(Lt){return Lt.length>1});if(Te.length===0)break;var ke=Ae(Te),Ge=ke.minIdx,tt=ke.adjList,He=ke.component;if(He.length>1){He.forEach(function(Lt){Q[Lt.id]=new Set});var ft=W[Ge];if(M&&P&&M.indexOf(ft.id)===-1)return G;J(ft,ft,tt),Se=Ge+1}else break}return G};N.detectAllDirectedCycle=g;var d=function(m,M,P,R){return R===void 0&&(R=!0),M?g(m,P,R):v(m,P,R)};N.detectAllCycles=d;var c=p;N.default=c},98773:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.default=_;var k=F(82890);function U(I){I===void 0&&(I={});var T=I,x=function(){},p=function(){var v={};return function(g){var d=g.next;return v[d]?!1:(v[d]=!0,!0)}}();return T.allowTraversal=I.allowTraversal||p,T.enter=I.enter||x,T.leave=I.leave||x,T}function L(I,T,x,p,v){v===void 0&&(v=!0),p.enter({current:T,previous:x});var g=I.edges,d=g===void 0?[]:g;(0,k.getNeighbors)(T,d,v?"target":void 0).forEach(function(c){p.allowTraversal({previous:x,current:T,next:c})&&L(I,c,T,p,v)}),p.leave({current:T,previous:x})}function _(I,T,x,p){p===void 0&&(p=!0),L(I,T,"",U(x),p)}},115:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.default=void 0;var k=F(99938),U=F(13526),L=F(82890),_=function(v,g,d){for(var c=1/0,s,m=0;mQ[Ie.id]+Ge?(Q[ke]=Q[Ie.id]+Ge,G[ke]=[Ie.id]):Q[ke]===Q[Ie.id]+Ge&&G[ke].push(Ie.id)})},Z=0;Z0&&P.length>0;){var Q=P[P.length-1];if(Q.length){var G=Q.shift();G&&(m.push(G),M[G]=!0,j=g?(0,U.getNeighbors)(G,s,"target"):(0,U.getNeighbors)(G,s),P.push(j.filter(function(Z){return!M[Z]})))}else{var W=m.pop();M[W]=!1,P.pop();continue}if(m[m.length-1]===v){var H=m.map(function(J){return J});R.push(H);var W=m.pop();M[W]=!1,P.pop()}}return R};N.findAllPath=I},26696:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.default=void 0;var k=U(F(3982));function U(I){return I&&I.__esModule?I:{default:I}}var L=function(T,x){for(var p=(0,k.default)(T,x),v=[],g=p.length,d=0;dv[d][s]+v[s][c]&&(v[d][c]=v[d][s]+v[s][c]);return v},_=L;N.default=_},96638:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.default=void 0;var k=F(13526),U=F(99176),L=function(){function c(s,m,M,P,R){this.fromNode=s,this.toNode=m,this.nodeEdgeNodeLabel={nodeLabel1:M||U.VACANT_NODE_LABEL,edgeLabel:P||U.VACANT_EDGE_LABEL,nodeLabel2:R||U.VACANT_NODE_LABEL}}return c.prototype.equalTo=function(s){return this.fromNode===s.formNode&&this.toNode===s.toNode&&this.nodeEdgeNodeLabel===s.nodeEdgeNodeLabel},c.prototype.notEqualTo=function(s){return!this.equalTo(s)},c}(),_=function(){function c(){this.rmpath=[],this.dfsEdgeList=[]}return c.prototype.equalTo=function(s){var m=this.dfsEdgeList.length,M=s.length;if(m!==M)return!1;for(var P=0;P=0;M--){var P=this.dfsEdgeList[M],R=P.fromNode,j=P.toNode;RK||P.hasNode(j[J.to])||(m.labelAe;we--){var Te=Se(we);if(Te==="break")break}if(Ie){var ke=s.findMinLabel(fe);j.dfsEdgeList.push(new L(se,ye,U.VACANT_NODE_LABEL,ke.edgeLabel,U.VACANT_NODE_LABEL));var Ge=j.dfsEdgeList.length-1;return s.dfsCode.dfsEdgeList[Ge]!==j.dfsEdgeList[Ge]?!1:Z(fe[ke.edgeLabel].projected)}var tt={};Ie=!1;var He=0;J.forEach(function(xt){var dt=new I(xt),pt=s.findForwardPureEdges(P,dt.edges[K[0]],ne,dt);pt.length>0&&(Ie=!0,He=se,pt.forEach(function(wt){var mt="".concat(wt.label,"-").concat(R[wt.to].label);tt[mt]||(tt[mt]={projected:[],edgeLabel:wt.label,nodeLabel2:R[wt.to].label}),tt[mt].projected.push({graphId:P.id,edge:wt,preNode:xt})}))});for(var ft=K.length,Lt=function(dt){if(Ie)return"break";var pt=K[dt];J.forEach(function(wt){var mt=new I(wt),ur=s.findForwardRmpathEdges(P,mt.edges[pt],ne,mt);ur.length>0&&(Ie=!0,He=j.dfsEdgeList[pt].fromNode,ur.forEach(function(Ir){var Nr="".concat(Ir.label,"-").concat(R[Ir.to].label);tt[Nr]||(tt[Nr]={projected:[],edgeLabel:Ir.label,nodeLabel2:R[Ir.to].label}),tt[Nr].projected.push({graphId:P.id,edge:Ir,preNode:wt})}))})},we=0;we=0;ne--){var se=m.findBackwardEdge(Z,K.edges[R[ne]],K.edges[R[0]],K);if(se){var fe="".concat(m.dfsCode.dfsEdgeList[R[ne]].fromNode,"-").concat(se.label);W[fe]||(W[fe]={projected:[],toNodeId:m.dfsCode.dfsEdgeList[R[ne]].fromNode,edgeLabel:se.label}),W[fe].projected.push({graphId:H.graphId,edge:se,preNode:H})}}if(!(P>=m.maxNodeNum)){var Ie=m.findForwardPureEdges(Z,K.edges[R[0]],Q,K);Ie.forEach(function(Ae){var Se="".concat(j,"-").concat(Ae.label,"-").concat(J[Ae.to].label);G[Se]||(G[Se]={projected:[],fromNodeId:j,edgeLabel:Ae.label,nodeLabel2:J[Ae.to].label}),G[Se].projected.push({graphId:H.graphId,edge:Ae,preNode:H})});for(var ye=function(Se){var we=m.findForwardRmpathEdges(Z,K.edges[R[Se]],Q,K);we.forEach(function(Te){var ke="".concat(m.dfsCode.dfsEdgeList[R[Se]].fromNode,"-").concat(Te.label,"-").concat(J[Te.to].label);G[ke]||(G[ke]={projected:[],fromNodeId:m.dfsCode.dfsEdgeList[R[Se]].fromNode,edgeLabel:Te.label,nodeLabel2:J[Te.to].label}),G[ke].projected.push({graphId:H.graphId,edge:Te,preNode:H})})},ne=0;neAe){var Se=Ae;Ae=ye,ye=Se}var we=Ie.label,Te="".concat(W,"-").concat(ye,"-").concat(we,"-").concat(Ae),ke="".concat(ye,"-").concat(we,"-").concat(Ae);if(!j[ke]){var Ge=j[ke]||0;Ge++,j[ke]=Ge}G[Te]={graphId:W,nodeLabel1:ye,edgeLabel:we,nodeLabel2:Ae}})})}),Object.keys(R).forEach(function(W){var H=R[W];if(!(H2*H)););if(Ge<2*H&&(se["".concat(ye,"-").concat(ke)]={start:ye,end:ke,distance:K[ye][ke]},Ae++,fe++,fe>=Z))return se;if(Se++,Se>2*H)break}if(AeSe&&(fe=Se);var we=Z[Ae.id].inDegree;Ie>we&&(Ie=we);var Te=Z[Ae.id].outDegree;ye>Te&&(ye=Te)}),W[H]={degree:fe,inDegree:Ie,outDegree:ye}),{minPatternNodeLabelDegree:fe,minPatternNodeLabelInDegree:Ie,minPatternNodeLabelOutDegree:ye}},j=function(W,H,Z,J,K,ne,se){var fe;if(Z===void 0&&(Z=!1),ne===void 0&&(ne="cluster"),se===void 0&&(se="cluster"),!(!W||!W.nodes)){var Ie=W.nodes.length;if(Ie){var ye=(0,U.default)(W,Z),Ae=(0,U.default)(H,Z),Se=M(W.nodes,ye,Z),we=M(H.nodes,Ae,Z),Te=s(W.nodes,ne),ke=Te.nodeMap,Ge=Te.nodeLabelMap,tt=s(H.nodes,ne),He=tt.nodeMap,ft=tt.nodeLabelMap;m(W.edges,se,ke);var Lt=m(H.edges,se,He).edgeLabelMap,Jt=[];Ae==null||Ae.forEach(function(jr){Jt=Jt.concat(jr)}),K||(K=Math.max.apply(Math,(0,k.__spreadArray)((0,k.__spreadArray)([],Jt,!1),[2],!1))),J||(J=K);var Qe=x(W,ye,ne,J),ut=x(H,Ae,ne,J),xt=Math.min(100,Ie*(Ie-1)/2),dt=v(J,Ie,xt,Qe,ye),pt=g(dt,Qe,W),wt=10,mt=1,ur=1,Ir=4,Nr={graphs:pt,nodeLabelProp:ne,edgeLabelProp:se,minSupport:mt,minNodeNum:ur,maxNodeNum:Ir,directed:Z},Hr=(0,L.default)(Nr).slice(0,wt),It=Hr.length,qt=[];Hr.forEach(function(jr,xn){qt[xn]={},Object.keys(pt).forEach(function(vn){var un=pt[vn],Wn=d(un,jr,ne,se);qt[xn][vn]=Wn})});var ar=c(qt,It,Hr),Oe=ar.structure,Pr=ar.structureCountMap,Cr=H.nodes[0],Gr=[],mr=(fe=H.nodes[0])===null||fe===void 0?void 0:fe[ne],rn=-1/0;H.nodes.forEach(function(jr){var xn=jr[ne],vn=Ge[xn];(vn==null?void 0:vn.length)>rn&&(rn=vn.length,Gr=vn,mr=xn,Cr=jr)});var Sr={},qr={},Rn={},yn={},zr={},Rt={};Object.keys(ft).forEach(function(jr,xn){zr[jr]=[],Z&&(Rt[jr]=[]);var vn=-1/0,un=ft[jr],Wn={};un.forEach(function(b){var S=we["".concat(Cr.id,"-").concat(b.id)];if(S&&zr[jr].push(S),vnzr[jr][st]){Le=!0;break}if(Le)return Gr.splice(S,1),"continue";var qe={};pe.neighbors.forEach(function(Ft){var er=Se["".concat(X.id,"-").concat(Ft.id)];qe["".concat(X.id,"-").concat(Ft.id)]={start:ke[X.id].idx,end:ke[Ft.id].idx,distance:er}}),pt=g(qe,Qe,W,pt);var Nt=[];Object.keys(qe).forEach(function(Ft){if(Pr[Ft]){Nt.push(Pr[Ft]);return}var er=pt[Ft];Pr[Ft]=d(er,Oe,ne,se),Nt.push(Pr[Ft])}),Nt=Nt.sort(function(Ft,er){return er-Ft});for(var nr=!1,st=0;st=0;C--)ee(C)});var zt=[];Gr==null||Gr.forEach(function(jr){for(var xn=ke[jr.id].idx,vn=p(W.nodes,ye[xn],xn,ne,K),un=vn.neighbors,Wn=un.length,Y=!1,ie=Wn-1;ie>=0;ie--){if(un.length+1pe){un.splice(ie,1);continue}if(Z){var Me="".concat(ee.id,"-").concat(jr.id),me=Se[Me];X=Rt[C].length-1;var Le=Rt[C][X];if(me>Le){un.splice(ie,1);continue}}var st=Pr[b]?Pr[b]:P(W,jr,ee,ke,S,Qe,Oe,ne,se,Pr,pt),qe="".concat(Cr.id,"-").concat(C),Nt=yn[qe][yn[qe].length-1];if(st=0;S--){var Le=me(S);if(Le==="break")break}if(Me)return zt.splice(xn,1),"continue";vn.edges=ie;var st=(0,_.default)(vn,vn.nodes[0].id,!1).length;if(Object.keys(st).reverse().forEach(function(In){if(!(In===vn.nodes[0].id||Me)){if(st[In]===1/0){var at=Y[In].node[ne];if(Wn[at]--,Wn[at]hr[te][hr[te].length-1]){var at=Y[In].node[ne];if(Wn[at]--,Wn[at]=0;er--){var Ur=vn.nodes[er],Ct=Y[Ur.id].degree,Kt=Y[Ur.id].inDegree,lr=Y[Ur.id].outDegree,Dr=Ur[ne],br=R(Sr,Dr,He,ft),sa=br.minPatternNodeLabelDegree,ea=br.minPatternNodeLabelInDegree,gn=br.minPatternNodeLabelOutDegree,Tn=Z?Ct=0;ra--){var Zn=ie[ra];if(!Y[Zn.source]||!Y[Zn.target]){ie.splice(ra,1);var Vr=Zn[se];if(ee[Vr]--,Y[Zn.source]&&(Y[Zn.source].degree--,Y[Zn.source].outDegree--),Y[Zn.target]&&(Y[Zn.target].degree--,Y[Zn.target].inDegree--),Lt[Vr]&&ee[Vr]=0;Fr--){var Cn=en(Fr);if(Cn==="break")break}for(var Sn=zt.length,oa=function(xn){var vn=zt[xn],un={};vn.edges.forEach(function(ie){var ee="".concat(ie.source,"-").concat(ie.target,"-").concat(ie.label);un[ee]?un[ee]++:un[ee]=1});for(var Wn=function(ee){var C=zt[ee],b={};C.edges.forEach(function(X){var pe="".concat(X.source,"-").concat(X.target,"-").concat(X.label);b[pe]?b[pe]++:b[pe]=1});var S=!0;Object.keys(b).length!==Object.keys(un).length?S=!1:Object.keys(un).forEach(function(X){b[X]!==un[X]&&(S=!1)}),S&&zt.splice(ee,1)},Y=Sn-1;Y>xn;Y--)Wn(Y);Sn=zt.length},Fr=0;Fr<=Sn-1;Fr++)oa(Fr);return zt}}},Q=j;N.default=Q},35470:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.default=void 0;var k=L(F(3982)),U=F(82890);function L(T){return T&&T.__esModule?T:{default:T}}var _=function(x,p,v,g){p===void 0&&(p=!1),v===void 0&&(v="weight"),g===void 0&&(g=1e3);var d=x.nodes,c=d===void 0?[]:d,s=x.edges,m=s===void 0?[]:s,M={},P={};c.forEach(function(ne,se){var fe=(0,U.uniqueId)();ne.clusterId=fe,M[fe]={id:fe,nodes:[ne]},P[ne.id]={node:ne,idx:se}});var R=(0,k.default)(x,p),j=[],Q={};R.forEach(function(ne,se){var fe=0,Ie=c[se].id;Q[Ie]={},ne.forEach(function(ye,Ae){if(ye){fe+=ye;var Se=c[Ae].id;Q[Ie][Se]=ye}}),j.push(fe)});for(var G=0,W=function(){var se=!1;if(c.forEach(function(fe){var Ie={};Object.keys(Q[fe.id]).forEach(function(tt){var He=Q[fe.id][tt],ft=P[tt].node,Lt=ft.clusterId;Ie[Lt]||(Ie[Lt]=0),Ie[Lt]+=He});var ye=-1/0,Ae=[];if(Object.keys(Ie).forEach(function(tt){ye=0&&Ae.splice(Se,1),Ae&&Ae.length){se=!0;var we=M[fe.clusterId],Te=we.nodes.indexOf(fe);we.nodes.splice(Te,1);var ke=Math.floor(Math.random()*Ae.length),Ge=M[Ae[ke]];Ge.nodes.push(fe),fe.clusterId=Ge.id}}}),!se)return"break";G++};G0&&ke>Ge&&ke-GeGe&&(He=H.map(function(pt){return{node:pt,clusterId:pt.clusterId}}),ft=(0,k.clone)(Ie),Ge=ke),Lt||tt>100)break;tt++,Object.keys(Ie).forEach(function(pt){var wt=0;J.forEach(function(mt){var ur=mt.source,Ir=mt.target,Nr=ye[ur].node.clusterId,Hr=ye[Ir].node.clusterId;(Nr===pt&&Hr!==pt||Hr===pt&&Nr!==pt)&&(wt=wt+(mt[m]||1))}),Ie[pt].sumTot=wt}),H.forEach(function(pt,wt){var mt=Ie[pt.clusterId],ur=0,Ir,Nr=Se[wt]/(2*Te),Hr=0,It=mt.nodes;It.forEach(function(qr){var Rn=ye[qr.id].idx;Hr+=Ae[wt][Rn]||0});var qt=Hr-mt.sumTot*Nr,ar=It.filter(function(qr){return qr.id!==pt.id}),Oe=[];ar.forEach(function(qr,Rn){Oe[Rn]=K[qr.originIndex]});var Pr=p(ar,K)*G,Cr=we[pt.id];if(Object.keys(Cr).forEach(function(qr){var Rn=ye[qr].node,yn=Rn.clusterId;if(yn!==pt.clusterId){var zr=Ie[yn],Rt=zr.nodes;if(!(!Rt||!Rt.length)){var zt=0;Rt.forEach(function(Cn){var Sn=ye[Cn.id].idx;zt+=Ae[wt][Sn]||0});var Vt=zt-zr.sumTot*Nr,hr=Rt.concat([pt]),Ar=[];hr.forEach(function(Cn,Sn){Ar[Sn]=K[Cn.originIndex]});var en=p(hr,K)*G,Fr=Vt-qt;P&&(Fr=Vt+en-(qt+Pr)),Fr>ur&&(ur=Fr,Ir=zr)}}}),ur>0){Ir.nodes.push(pt);var Gr=pt.clusterId;pt.clusterId=Ir.id;var mr=mt.nodes.indexOf(pt);mt.nodes.splice(mr,1);var rn=0,Sr=0;J.forEach(function(qr){var Rn=qr.source,yn=qr.target,zr=ye[Rn].node.clusterId,Rt=ye[yn].node.clusterId;(zr===Ir.id&&Rt!==Ir.id||Rt===Ir.id&&zr!==Ir.id)&&(rn=rn+(qr[m]||1)),(zr===Gr&&Rt!==Gr||Rt===Gr&&zr!==Gr)&&(Sr=Sr+(qr[m]||1))}),Ir.sumTot=rn,mt.sumTot=Sr}})}var Jt={},Qe=0;Object.keys(ft).forEach(function(pt){var wt=ft[pt];if(!wt.nodes||!wt.nodes.length){delete ft[pt];return}var mt=String(Qe+1);mt!==pt&&(wt.id=mt,wt.nodes=wt.nodes.map(function(ur){return{id:ur.id,clusterId:mt}}),ft[mt]=wt,Jt[pt]=mt,delete ft[pt],Qe++)}),He.forEach(function(pt){var wt=pt.node,mt=pt.clusterId;wt&&(wt.clusterId=mt,wt.clusterId&&Jt[wt.clusterId]&&(wt.clusterId=Jt[wt.clusterId]))});var ut=[],xt={};J.forEach(function(pt){var wt=pt.source,mt=pt.target,ur=pt[m]||1,Ir=ye[wt].node.clusterId,Nr=ye[mt].node.clusterId;if(!(!Ir||!Nr)){var Hr="".concat(Ir,"---").concat(Nr);if(xt[Hr])xt[Hr].weight+=ur,xt[Hr].count++;else{var It={source:Ir,target:Nr,weight:ur,count:1};xt[Hr]=It,ut.push(It)}}});var dt=[];return Object.keys(ft).forEach(function(pt){dt.push(ft[pt])}),{clusters:dt,clusterEdges:ut}},g=v;N.default=g},62663:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.default=void 0;var k=_(F(92392)),U=_(F(6331)),L=F(82890);function _(v){return v&&v.__esModule?v:{default:v}}var I=function(g,d){var c=[],s=g.nodes,m=s===void 0?[]:s,M=g.edges,P=M===void 0?[]:M;if(m.length===0)return c;var R=m[0],j=new Set;j.add(R);var Q=function(K,ne){return d?K.weight-ne.weight:0},G=new U.default(Q);for((0,L.getEdgesByNodeId)(R.id,P).forEach(function(J){G.insert(J)});!G.isEmpty();){var W=G.delMin(),H=W.source,Z=W.target;j.has(H)&&j.has(Z)||(c.push(W),j.has(H)||(j.add(H),(0,L.getEdgesByNodeId)(H,P).forEach(function(J){G.insert(J)})),j.has(Z)||(j.add(Z),(0,L.getEdgesByNodeId)(Z,P).forEach(function(J){G.insert(J)})))}return c},T=function(g,d){var c=[],s=g.nodes,m=s===void 0?[]:s,M=g.edges,P=M===void 0?[]:M;if(m.length===0)return c;var R=P.map(function(H){return H});d&&R.sort(function(H,Z){return H.weight-Z.weight});for(var j=new k.default(m.map(function(H){return H.id}));R.length>0;){var Q=R.shift(),G=Q.source,W=Q.target;j.connected(G,W)||(c.push(Q),j.union(G,W))}return c},x=function(g,d,c){var s={prim:I,kruskal:T};return c?s[c](g,d):T(g,d)},p=x;N.default=p},90300:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.default=void 0;var k=L(F(53838)),U=F(82890);function L(T){return T&&T.__esModule?T:{default:T}}var _=function(x,p,v){typeof p!="number"&&(p=1e-6),typeof v!="number"&&(v=.85);for(var g=1,d=0,c=1e3,s=x.nodes,m=s===void 0?[]:s,M=x.edges,P=M===void 0?[]:M,R=m.length,j,Q={},G={},W=0;W0&&g>p;){d=0;for(var W=0;W0&&(j+=G[se]/fe)}Q[Z]=v*j,d+=Q[Z]}}d=(1-d)/R,g=0;for(var W=0;W0&&(this.list[0]=I,this.moveDown(0)),_},L.prototype.insert=function(_){if(_!==null){this.list.push(_);var I=this.list.length-1;return this.moveUp(I),!0}return!1},L.prototype.moveUp=function(_){for(var I=this.getParent(_);_&&_>0&&this.compareFn(this.list[I],this.list[_])>0;){var T=this.list[I];this.list[I]=this.list[_],this.list[_]=T,_=I,I=this.getParent(_)}},L.prototype.moveDown=function(_){var I,T=_,x=this.getLeft(_),p=this.getRight(_),v=this.list.length;x!==null&&x0?T=x:p!==null&&p0&&(T=p),_!==T&&(I=[this.list[T],this.list[_]],this.list[_]=I[0],this.list[T]=I[1],this.moveDown(T))},L}(),U=k;N.default=U},69304:function(Mt,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.default=N.LinkedListNode=void 0;var F=function(I,T){return I===T},k=function(){function _(I,T){T===void 0&&(T=null),this.value=I,this.next=T}return _.prototype.toString=function(I){return I?I(this.value):"".concat(this.value)},_}();N.LinkedListNode=k;var U=function(){function _(I){I===void 0&&(I=F),this.head=null,this.tail=null,this.compare=I}return _.prototype.prepend=function(I){var T=new k(I,this.head);return this.head=T,this.tail||(this.tail=T),this},_.prototype.append=function(I){var T=new k(I);return this.head?(this.tail.next=T,this.tail=T,this):(this.head=T,this.tail=T,this)},_.prototype.delete=function(I){if(!this.head)return null;for(var T=null;this.head&&this.compare(this.head.value,I);)T=this.head,this.head=this.head.next;var x=this.head;if(x!==null)for(;x.next;)this.compare(x.next.value,I)?(T=x.next,x.next=x.next.next):x=x.next;return this.compare(this.tail.value,I)&&(this.tail=x),T},_.prototype.find=function(I){var T=I.value,x=T===void 0?void 0:T,p=I.callback,v=p===void 0?void 0:p;if(!this.head)return null;for(var g=this.head;g;){if(v&&v(g.value)||x!==void 0&&this.compare(g.value,x))return g;g=g.next}return null},_.prototype.deleteTail=function(){var I=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,I;for(var T=this.head;T.next;)T.next.next?T=T.next:T.next=null;return this.tail=T,I},_.prototype.deleteHead=function(){if(!this.head)return null;var I=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),I},_.prototype.fromArray=function(I){var T=this;return I.forEach(function(x){return T.append(x)}),this},_.prototype.toArray=function(){for(var I=[],T=this.head;T;)I.push(T),T=T.next;return I},_.prototype.reverse=function(){for(var I=this.head,T=null,x=null;I;)x=I.next,I.next=T,T=I,I=x;this.tail=this.head,this.head=T},_.prototype.toString=function(I){return I===void 0&&(I=void 0),this.toArray().map(function(T){return T.toString(I)}).toString()},_}(),L=U;N.default=L},10780:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.default=void 0;var k=U(F(69304));function U(I){return I&&I.__esModule?I:{default:I}}var L=function(){function I(){this.linkedList=new k.default}return I.prototype.isEmpty=function(){return!this.linkedList.head},I.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},I.prototype.enqueue=function(T){this.linkedList.append(T)},I.prototype.dequeue=function(){var T=this.linkedList.deleteHead();return T?T.value:null},I.prototype.toString=function(T){return this.linkedList.toString(T)},I}(),_=L;N.default=_},92392:function(Mt,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.default=void 0;var F=function(){function U(L){this.count=L.length,this.parent={};for(var _=0,I=L;_0&&pe[0]!==void 0?pe[0]:1,!this.dirty){me.next=6;break}return this.compiledBundle.context&&(S>1?this.compiledBundle.context.maxIteration=S:this.compiledBundle.context.maxIteration++),me.next=5,this.compile();case 5:this.dirty=!1;case 6:for(this.engine.beginFrame(),this.engine.clear({}),this.compiledBundle.context&&this.compiledBundle.context.uniforms.filter(function(Le){var st=Le.isReferer;return st}).forEach(function(Le){var st=Le.data,qe=Le.name;b.model.confirmInput(st.model,qe)}),X=0;X16)throw new Error("invalid data type ".concat(st));b[Le]=function(){return me.data}}});var S=this.getOuputDataTexture(),X=S.textureWidth,pe=S.texelCount;b.u_OutputTextureSize=[X,X],b.u_OutputTexelCount=pe,this.context.output.textureSize=[X,X];var Me={attributes:{a_Position:[[-1,1,0],[-1,-1,0],[1,1,0],[1,-1,0]],a_TexCoord:[[0,1],[0,0],[1,1],[1,0]]},frag:`#ifdef GL_FRAGMENT_PRECISION_HIGH precision highp float; #else precision mediump float; #endif `.concat(this.context.shader),uniforms:b,vert:yn,primitive:"triangle strip",count:4};this.computeCommand=this.reGl(Me)}return(0,_.Z)(Y,[{key:"run",value:function(){var ee=this;this.context.maxIteration>1&&this.context.needPingpong&&(this.compiledPingpong=!0),(this.compiledPingpong||this.dynamicPingpong)&&this.swap(),this.texFBO=this.reGl.framebuffer({color:this.getOuputDataTexture().texture}),this.texFBO.use(function(){ee.computeCommand()}),Rt&&console.log("[".concat(this.entity,"]: output ").concat(this.getOuputDataTexture().id))}},{key:"readData",value:function(){var ie=(0,k.Z)(c().mark(function C(){var b=this,S,X,pe,Me,me,Le,st,qe;return c().wrap(function(nr){for(;;)switch(nr.prev=nr.next){case 0:if(this.reGl({framebuffer:this.texFBO})(function(){S=b.reGl.read()}),!S){nr.next=6;break}if(X=this.getOuputDataTexture(),pe=X.originalDataLength,Me=X.elementsPerTexel,me=X.typedArrayConstructor,Le=me===void 0?Float32Array:me,st=[],Me!==4)for(qe=0;qe2&&arguments[2]!==void 0?arguments[2]:0,S=this.context.uniforms.find(function(me){var Le=me.name;return Le===ee});if(S){var X=this.calcDataTexture(ee,S.type,C),pe=X.texture,Me=X.data;this.textureCache[ee].data=Me,this.textureCache[ee].texture=pe}}},{key:"destroy",value:function(){}},{key:"swap",value:function(){if(this.swapOutputTextureName||this.createSwapOutputDataTexture(),this.compiledPingpong){var ee=this.context.output.name;this.textureCache[ee].id=this.getOuputDataTexture().id,this.textureCache[ee].texture=this.getOuputDataTexture().texture}var C=this.outputTextureName;this.outputTextureName=this.swapOutputTextureName,this.swapOutputTextureName=C,Rt&&console.log("[".concat(this.entity,"]: after swap, output ").concat(this.getOuputDataTexture().id))}},{key:"getOuputDataTexture",value:function(){return this.textureCache[this.outputTextureName]}},{key:"createSwapOutputDataTexture",value:function(){var ee=this.cloneDataTexture(this.getOuputDataTexture());this.swapOutputTextureName="".concat(this.entity,"-swap"),this.textureCache[this.swapOutputTextureName]=ee}},{key:"cloneDataTexture",value:function(ee){var C=ee.data,b=ee.textureWidth;return Rn(Rn({},ee),{},{id:zr++,texture:this.reGl.texture({width:b,height:b,data:C,type:"float"})})}},{key:"calcDataTexture",value:function(ee,C,b){var S=1;C===W.Vector4FloatArray&&(S=4);for(var X=[],pe=0;pe0&&arguments[0]!==void 0?arguments[0]:{},C=new Y;return C.setConfig(ee),C.setEngine(new un),C}}]),Y}()},19711:function(Mt,N,F){"use strict";F.d(N,{ZP:function(){return Zh}});var k={};F.r(k),F.d(k,{GADDI:function(){return _a},Stack:function(){return ya},breadthFirstSearch:function(){return Te},connectedComponent:function(){return tt},cosineSimilarity:function(){return b},default:function(){return bo},depthFirstSearch:function(){return xt},detectAllCycles:function(){return mt},detectAllDirectedCycle:function(){return wt},detectAllUndirectedCycle:function(){return pt},detectCycle:function(){return ur},detectDirectedCycle:function(){return Ai},dijkstra:function(){return Hr},findAllPath:function(){return ar},findShortestPath:function(){return qt},floydWarshall:function(){return Pr},getAdjMatrix:function(){return W},getDegree:function(){return ft},getInDegree:function(){return Lt},getNeighbors:function(){return fe},getOutDegree:function(){return Jt},iLouvain:function(){return vn},kCore:function(){return Wn},kMeans:function(){return ee},labelPropagation:function(){return Gr},louvain:function(){return jr},minimumSpanningTree:function(){return Ft},nodesCosineSimilarity:function(){return X},pageRank:function(){return Ur}});var U={};F.r(U),F.d(U,{Line:function(){return Ui},applyMatrix:function(){return Si},compare:function(){return Ei},distance:function(){return Gi},floydWarshall:function(){return _i},fractionToLine:function(){return hs},getAdjMatrix:function(){return Ru},getBBoxBoundLine:function(){return Wi},getCircleCenterByPoints:function(){return On},getCircleIntersectByPoint:function(){return Po},getDegree:function(){return Ho},getEllipseIntersectByPoint:function(){return Ki},getLineIntersect:function(){return Eo},getPointsCenter:function(){return Ca},getRectIntersectByPoint:function(){return Yo},intersectBBox:function(){return Va},invertMatrix:function(){return Ns},isPointInPolygon:function(){return $i},isPointsOverlap:function(){return di},isPolygonsIntersect:function(){return Zo},itemIntersectByLine:function(){return vo},lerp:function(){return hi},lerpArray:function(){return xi},move:function(){return ri},pointLineDistance:function(){return _o},pointLineSquareDist:function(){return ou},pointRectSquareDist:function(){return mi},rotate:function(){return ds},scale:function(){return wo},scaleMatrix:function(){return to},squareDist:function(){return So},translate:function(){return xo}});var L={};F.r(L),F.d(L,{cloneBesidesImg:function(){return Oi},getAnimateCfgWithCallback:function(){return ko},getBBox:function(){return Qo},getComboBBox:function(){return ys},getLabelPosition:function(){return vs},getLetterWidth:function(){return gs},getLoopCfgs:function(){return Jo},getTextSize:function(){return fu},plainCombosToTrees:function(){return ks},reconstructTree:function(){return ps},shouldRefreshEdge:function(){return Gu},traverseTree:function(){return Fa},traverseTreeUp:function(){return yo},truncateLabelByLength:function(){return cu}});var _={};F.r(_),F.d(_,{calculationItemsBBox:function(){return Ro},cloneEvent:function(){return Uu},formatPadding:function(){return hu},isNaN:function(){return ao},isViewportChanged:function(){return Wu},processParallelEdges:function(){return Xu},uniqueId:function(){return du}});var I={};F.r(I),F.d(I,{getClosedSpline:function(){return Qr},getControlPoint:function(){return bu},getSpline:function(){return $u},getStarPath:function(){return Tf},paddedHull:function(){return Go},pathToPoints:function(){return Eu},pointsToPolygon:function(){return as},roundedHull:function(){return Ks}});var T={};F.r(T),F.d(T,{defaultSubjectColors:function(){return Io}});var x={};F.r(x),F.d(x,{isForce:function(){return wu}});var p={};F.r(p),F.d(p,{getColorSetsBySubjectColors:function(){return mc},getColorsWithSubjectColor:function(){return Ms},mixColor:function(){return oi}});var v={};F.r(v),F.d(v,{arrayToTextureData:function(){return Gc},attributesToTextureData:function(){return wc},buildTextureData:function(){return Fc},buildTextureDataWithOneEdgeAttr:function(){return Ff},buildTextureDataWithTwoEdgeAttr:function(){return xc},proccessToFunc:function(){return Ec},radialLayout:function(){return tu}});var g={};F.r(g),F.d(g,{gpuDetector:function(){return Sc}});var d={};F.r(d),F.d(d,{getBrowserName:function(){return _c}});var c=F(99938),s=F(13526),m={getDefaultCfg:function(){return{}},getEvents:function(){return{}},updateCfg:function(t){return Object.assign(this,t),!0},shouldBegin:function(){return!0},shouldUpdate:function(){return!0},shouldEnd:function(){return!0},bind:function(t){var e=this,r=this.events;this.graph=t,(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&t.get("canvas").set("draggable",!0),(0,s.each)(r,function(n,a){t.on(a,n)}),document.addEventListener("visibilitychange",function(){e.keydown=!1})},unbind:function(t){var e=this.events,r=t.get("canvas").get("draggable");(this.type==="drag-canvas"||this.type==="brush-select"||this.type==="lasso-select")&&t.get("canvas").set("draggable",!1),(0,s.each)(e,function(n,a){t.off(a,n)}),t.get("canvas").set("draggable",r)},get:function(t){return this[t]},set:function(t,e){return this[t]=e,this}},M=function(){function E(){}return E.registerBehavior=function(t,e){if(!e)throw new Error("please specify handler for this behavior: ".concat(t));var r=(0,s.clone)(m);Object.assign(r,e);var n=function(i){var o=this;Object.assign(this,this.getDefaultCfg(),i);var u=this.getEvents();this.events=null;var l={};u&&((0,s.each)(u,function(h,y){l[y]=(0,s.wrapBehavior)(o,h)}),this.events=l)};n.prototype=r,E.types[t]=n},E.hasBehavior=function(t){return!!E.types[t]},E.getBehavior=function(t){return E.types[t]},E.types={},E}(),P=M,R=P,j=F(80216),Q=F(67516),G=function(t,e){var r=t.nodes,n=t.edges,a=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(function(o,u){i[o.id]=u;var l=[];a.push(l)}),n&&n.forEach(function(o){var u=o.source,l=o.target,h=i[u],y=i[l];!h&&h!==0||!y&&y!==0||(a[h][y]=1,e||(a[y][h]=1))}),a},W=G,H=function(t,e){return t===e},Z=function(){function E(t,e){e===void 0&&(e=null),this.value=t,this.next=e}return E.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},E}(),J=function(){function E(t){t===void 0&&(t=H),this.head=null,this.tail=null,this.compare=t}return E.prototype.prepend=function(t){var e=new Z(t,this.head);return this.head=e,this.tail||(this.tail=e),this},E.prototype.append=function(t){var e=new Z(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},E.prototype.delete=function(t){if(!this.head)return null;for(var e=null;this.head&&this.compare(this.head.value,t);)e=this.head,this.head=this.head.next;var r=this.head;if(r!==null)for(;r.next;)this.compare(r.next.value,t)?(e=r.next,r.next=r.next.next):r=r.next;return this.compare(this.tail.value,t)&&(this.tail=r),e},E.prototype.find=function(t){var e=t.value,r=e===void 0?void 0:e,n=t.callback,a=n===void 0?void 0:n;if(!this.head)return null;for(var i=this.head;i;){if(a&&a(i.value)||r!==void 0&&this.compare(i.value,r))return i;i=i.next}return null},E.prototype.deleteTail=function(){var t=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,t;for(var e=this.head;e.next;)e.next.next?e=e.next:e.next=null;return this.tail=e,t},E.prototype.deleteHead=function(){if(!this.head)return null;var t=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),t},E.prototype.fromArray=function(t){var e=this;return t.forEach(function(r){return e.append(r)}),this},E.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},E.prototype.reverse=function(){for(var t=this.head,e=null,r=null;t;)r=t.next,t.next=e,e=t,t=r;this.tail=this.head,this.head=e},E.prototype.toString=function(t){return t===void 0&&(t=void 0),this.toArray().map(function(e){return e.toString(t)}).toString()},E}(),K=J,ne=function(){function E(){this.linkedList=new K}return E.prototype.isEmpty=function(){return!this.linkedList.head},E.prototype.peek=function(){return this.linkedList.head?this.linkedList.head.value:null},E.prototype.enqueue=function(t){this.linkedList.append(t)},E.prototype.dequeue=function(){var t=this.linkedList.deleteHead();return t?t.value:null},E.prototype.toString=function(t){return this.linkedList.toString(t)},E}(),se=ne,fe=function(t,e,r){e===void 0&&(e=[]);var n=e.filter(function(u){return u.source===t||u.target===t});if(r==="target"){var a=function(l){return l.source===t};return n.filter(a).map(function(u){return u.target})}if(r==="source"){var i=function(l){return l.target===t};return n.filter(i).map(function(u){return u.source})}var o=function(l){return l.source===t?l.target:l.source};return n.map(o)},Ie=function(t,e){return e.filter(function(r){return r.source===t})},ye=function(t,e){return e.filter(function(r){return r.source===t||r.target===t})},Ae=function(t){t===void 0&&(t=0);var e="".concat(Math.random()).split(".")[1].substr(0,5),r="".concat(Math.random()).split(".")[1].substr(0,5);return"".concat(t,"-").concat(e).concat(r)};function Se(E){E===void 0&&(E={});var t=E,e=function(){},r=function(){var n={};return function(a){var i=a.next,o=i;return n[o]?!1:(n[o]=!0,!0)}}();return t.allowTraversal=E.allowTraversal||r,t.enter=E.enter||e,t.leave=E.leave||e,t}var we=function(t,e,r,n){n===void 0&&(n=!0);var a=Se(r),i=new se,o=t.edges,u=o===void 0?[]:o;i.enqueue(e);for(var l="",h=function(){var O=i.dequeue();a.enter({current:O,previous:l}),fe(O,u,n?"target":void 0).forEach(function(A){a.allowTraversal({previous:l,current:O,next:A})&&i.enqueue(A)}),a.leave({current:O,previous:l}),l=O};!i.isEmpty();)h()},Te=we,ke=function(t){for(var e=t.nodes,r=e===void 0?[]:e,n=t.edges,a=n===void 0?[]:n,i=[],o={},u=[],l=function A(z){u.push(z),o[z.id]=!0;for(var $=fe(z.id,a),ae=function(ve){var Ce=$[ve];if(!o[Ce]){var Re=r.filter(function(Ve){return Ve.id===Ce});Re.length>0&&A(Re[0])}},ce=0;ce<$.length;++ce)ae(ce)},h=0;h0;)O.push(u.pop());i.push(O)}}return i},Ge=function(t){for(var e=t.nodes,r=e===void 0?[]:e,n=t.edges,a=n===void 0?[]:n,i=[],o={},u={},l={},h=[],y=0,O=function ae(ce){u[ce.id]=y,l[ce.id]=y,y+=1,i.push(ce),o[ce.id]=!0;for(var ue=fe(ce.id,a,"target").filter(function(Ue){return r.map(function($e){return $e.id}).indexOf(Ue)>-1}),ve=function($e){var ot=ue[$e];if(!u[ot]&&u[ot]!==0){var et=r.filter(function(yt){return yt.id===ot});et.length>0&&ae(et[0]),l[ce.id]=Math.min(l[ce.id],l[ot])}else o[ot]&&(l[ce.id]=Math.min(l[ce.id],u[ot]))},Ce=0;Ce0;){var Ve=i.pop();if(o[Ve.id]=!1,Re.push(Ve),Ve===ce)break}Re.length>0&&h.push(Re)}},A=0,z=r;A0;)for(var ae=A.pop(),ce=ae.id,ue=fe(ce,t.edges),ve=function(Ve){var Ue,$e=ue[Ve],ot=t.nodes.find(function(Mr){return Mr.id===$e});if($e===ce)i.push((Ue={},Ue[$e]=ae,Ue));else if(!($e in $))z[$e]=ae,A.push(ot),$[$e]=new Set([ae]);else if(!$[ce].has(ot)){for(var et=!0,yt=[ot,ae],Gt=z[ce];$[$e].size&&!$[$e].has(Gt)&&(yt.push(Gt),Gt!==z[Gt.id]);)Gt=z[Gt.id];if(yt.push(Gt),e&&r?(et=!1,yt.findIndex(function(Mr){return e.indexOf(Mr.id)>-1})>-1&&(et=!0)):e&&!r&&yt.findIndex(function(Mr){return e.indexOf(Mr.id)>-1})>-1&&(et=!1),et){for(var yr={},kr=1;kr0;){var kr=yr.pop();a.has(kr)&&(a.delete(kr),i[kr.id].forEach(function(Mr){yr.push(Mr)}),i[kr.id].clear())}},y=function yt(Gt,yr,kr){var Mr=!1;if(e&&r===!1&&e.indexOf(Gt.id)>-1)return Mr;n.push(Gt),a.add(Gt);for(var dr=kr[Gt.id],hn=0;hn-1});sn-1)?o.push((yr={},yr[Wr.id]=Wr,yr)):Yr[Wr.id].push(l[la])}}return{component:Rr,adjList:Yr,minIdx:Mr}},ve=0;ve=ve}),Re=Ge({nodes:Ce,edges:t.edges}).filter(function(yt){return yt.length>1});if(Re.length===0)break;var Ve=ue(Re),Ue=Ve.minIdx,$e=Ve.adjList,ot=Ve.component;if(ot.length>1){ot.forEach(function(yt){i[yt.id]=new Set});var et=u[Ue];if(e&&r&&e.indexOf(et.id)===-1)return o;y(et,et,$e),ve=Ue+1}else break}return o},mt=function(t,e,r,n){return n===void 0&&(n=!0),e?wt(t,r,n):pt(t,r,n)},ur=dt,Ir=function(t,e,r){for(var n=1/0,a,i=0;iy[Re.id]+Gt?(y[yt]=y[Re.id]+Gt,O[yt]=[Re.id]):y[yt]===y[Re.id]+Gt&&O[yt].push(Re.id)})},$=0;$0&&h.length>0;){var A=h[h.length-1];if(A.length){var z=A.shift();z&&(u.push(z),l[z]=!0,O=n?fe(z,o,"target"):fe(z,o),h.push(O.filter(function(ce){return!l[ce]})))}else{var $=u.pop();l[$]=!1,h.pop();continue}if(u[u.length-1]===r){var ae=u.map(function(ue){return ue});y.push(ae);var $=u.pop();l[$]=!1,h.pop()}}return y},Oe=function(t,e){for(var r=W(t,e),n=[],a=r.length,i=0;in[i][u]+n[u][o]&&(n[i][o]=n[i][u]+n[u][o]);return n},Pr=Oe,Cr=function(t,e,r,n){e===void 0&&(e=!1),r===void 0&&(r="weight"),n===void 0&&(n=1e3);var a=t.nodes,i=a===void 0?[]:a,o=t.edges,u=o===void 0?[]:o,l={},h={};i.forEach(function(Ce,Re){var Ve=Ae();Ce.clusterId=Ve,l[Ve]={id:Ve,nodes:[Ce]},h[Ce.id]={node:Ce,idx:Re}});var y=W(t,e),O=[],A={};y.forEach(function(Ce,Re){var Ve=0,Ue=i[Re].id;A[Ue]={},Ce.forEach(function($e,ot){if($e){Ve+=$e;var et=i[ot].id;A[Ue][et]=$e}}),O.push(Ve)});for(var z=0,$=function(){var Re=!1;if(i.forEach(function(Ve){var Ue={};Object.keys(A[Ve.id]).forEach(function(Mr){var dr=A[Ve.id][Mr],hn=h[Mr].node,on=hn.clusterId;Ue[on]||(Ue[on]=0),Ue[on]+=dr});var $e=-1/0,ot=[];if(Object.keys(Ue).forEach(function(Mr){$e=0&&ot.splice(et,1),ot&&ot.length){Re=!0;var yt=l[Ve.clusterId],Gt=yt.nodes.indexOf(Ve);yt.nodes.splice(Gt,1);var yr=Math.floor(Math.random()*ot.length),kr=l[ot[yr]];kr.nodes.push(Ve),Ve.clusterId=kr.id}}}),!Re)return"break";z++};z0&&$e>ot&&$e-otot&&(yt=y.map(function(cr){return{node:cr,clusterId:cr.clusterId}}),Gt=(0,s.clone)(ue),ot=$e),yr||et>100)break;et++,Object.keys(ue).forEach(function(cr){var Rr=0;A.forEach(function(Yr){var Wr=Yr.source,sn=Yr.target,wn=ve[Wr].node.clusterId,la=ve[sn].node.clusterId;(wn===cr&&la!==cr||la===cr&&wn!==cr)&&(Rr=Rr+(Yr[r]||1))}),ue[cr].sumTot=Rr}),y.forEach(function(cr,Rr){var Yr=ue[cr.clusterId],Wr=0,sn,wn=Re[Rr]/(2*Ue),la=0,da=Yr.nodes;da.forEach(function(Ri){var Bi=ve[Ri.id].idx;la+=Ce[Rr][Bi]||0});var Ra=la-Yr.sumTot*wn,Ia=da.filter(function(Ri){return Ri.id!==cr.id}),Xa=[];Ia.forEach(function(Ri,Bi){Xa[Bi]=z[Ri.originIndex]});var Ga=Sn(Ia,z)*l,ci=Ve[cr.id];if(Object.keys(ci).forEach(function(Ri){var Bi=ve[Ri].node,fs=Bi.clusterId;if(fs!==cr.clusterId){var lo=ue[fs],Lo=lo.nodes;if(!(!Lo||!Lo.length)){var pa=0;Lo.forEach(function(Ea){var xa=ve[Ea.id].idx;pa+=Ce[Rr][xa]||0});var Oa=pa-lo.sumTot*wn,va=Lo.concat([cr]),La=[];va.forEach(function(Ea,xa){La[xa]=z[Ea.originIndex]});var za=Sn(va,z)*l,Pn=Oa-Ra;a&&(Pn=Oa+za-(Ra+Ga)),Pn>Wr&&(Wr=Pn,sn=lo)}}}),Wr>0){sn.nodes.push(cr);var ja=cr.clusterId;cr.clusterId=sn.id;var Os=Yr.nodes.indexOf(cr);Yr.nodes.splice(Os,1);var ki=0,Ls=0;A.forEach(function(Ri){var Bi=Ri.source,fs=Ri.target,lo=ve[Bi].node.clusterId,Lo=ve[fs].node.clusterId;(lo===sn.id&&Lo!==sn.id||Lo===sn.id&&lo!==sn.id)&&(ki=ki+(Ri[r]||1)),(lo===ja&&Lo!==ja||Lo===ja&&lo!==ja)&&(Ls=Ls+(Ri[r]||1))}),sn.sumTot=ki,Yr.sumTot=Ls}})}var kr={},Mr=0;Object.keys(Gt).forEach(function(cr){var Rr=Gt[cr];if(!Rr.nodes||!Rr.nodes.length){delete Gt[cr];return}var Yr=String(Mr+1);Yr!==cr&&(Rr.id=Yr,Rr.nodes=Rr.nodes.map(function(Wr){return{id:Wr.id,clusterId:Yr}}),Gt[Yr]=Rr,kr[cr]=Yr,delete Gt[cr],Mr++)}),yt.forEach(function(cr){var Rr=cr.node,Yr=cr.clusterId;Rr&&(Rr.clusterId=Yr,Rr.clusterId&&kr[Rr.clusterId]&&(Rr.clusterId=kr[Rr.clusterId]))});var dr=[],hn={};A.forEach(function(cr){var Rr=cr.source,Yr=cr.target,Wr=cr[r]||1,sn=ve[Rr].node.clusterId,wn=ve[Yr].node.clusterId;if(!(!sn||!wn)){var la="".concat(sn,"---").concat(wn);if(hn[la])hn[la].weight+=Wr,hn[la].count++;else{var da={source:sn,target:wn,weight:Wr,count:1};hn[la]=da,dr.push(da)}}});var on=[];return Object.keys(Gt).forEach(function(cr){on.push(Gt[cr])}),{clusters:on,clusterEdges:dr}},jr=oa,xn=function(t,e,r,n,a,i,o,u){return e===void 0&&(e=!1),r===void 0&&(r="weight"),n===void 0&&(n=1e-4),a===void 0&&(a=void 0),i===void 0&&(i=[]),o===void 0&&(o=["id"]),u===void 0&&(u=1),jr(t,e,r,n,!0,a,i,o,u)},vn=xn,un=function(t,e){var r;e===void 0&&(e=1);for(var n=(0,s.clone)(t),a=n.nodes,i=a===void 0?[]:a,o=n.edges,u=o===void 0?[]:o,l=function(){var O=ft({nodes:i,edges:u}),A=Object.keys(O);A.sort(function(ae,ce){var ue,ve;return((ue=O[ae])===null||ue===void 0?void 0:ue.degree)-((ve=O[ce])===null||ve===void 0?void 0:ve.degree)});var z=A[0];if(!i.length||((r=O[z])===null||r===void 0?void 0:r.degree)>=e)return"break";var $=i.findIndex(function(ae){return ae.id===z});i.splice($,1),u=u.filter(function(ae){return!(ae.source===z||ae.target===z)})};;){var h=l();if(h==="break")break}return{nodes:i,edges:u}},Wn=un,Y=function(t,e,r){var n=[];switch(t){case Vt.EuclideanDistance:n=e[r];break;default:n=[];break}return n},ie=function(t,e,r,n,a,i){e===void 0&&(e=3),r===void 0&&(r=void 0),n===void 0&&(n=[]),a===void 0&&(a=["id"]),i===void 0&&(i=Vt.EuclideanDistance);var o=t.nodes,u=o===void 0?[]:o,l=t.edges,h=l===void 0?[]:l,y={clusters:[{id:"0",nodes:u}],clusterEdges:[]};if(i===Vt.EuclideanDistance&&!u.every(function(Yr){return Yr.hasOwnProperty(r)}))return y;var O=[],A=[];if(i===Vt.EuclideanDistance&&(O=Rt(u,r),A=Ar(O,n,a)),!A.length)return y;for(var z=(0,s.uniq)(A.map(function(Yr){return Yr.join("")})),$=Math.min(e,u.length,z.length),ae=0;aeRe&&!ce.find(function(Ia){return(0,s.isEqual)(Ia,Y(i,A,u[sn].originIndex))})&&(Re=Ra,Ve=sn)}},$e=0;$e=0;kr--)ve[Number(u[ae].clusterId)][kr].id===u[ae].id&&ve[Number(u[ae].clusterId)].splice(kr,1);u[ae].clusterId=String(et),ve[et].push(u[ae])}}for(var Mr=!1,ae=0;ae=1e3)break}var cr=[],Rr={};return h.forEach(function(Yr){var Wr,sn,wn=Yr.source,la=Yr.target,da=(Wr=u.find(function(Ga){return Ga.id===wn}))===null||Wr===void 0?void 0:Wr.clusterId,Ra=(sn=u.find(function(Ga){return Ga.id===la}))===null||sn===void 0?void 0:sn.clusterId,Ia="".concat(da,"---").concat(Ra);if(Rr[Ia])Rr[Ia].count++;else{var Xa={source:da,target:Ra,count:1};Rr[Ia]=Xa,cr.push(Xa)}}),{clusters:ve,clusterEdges:cr}},ee=ie,C=function(t,e){var r=new rn(e),n=r.norm2(),a=new rn(t),i=a.norm2(),o=r.dot(a),u=n*i,l=u?o/u:0;return l},b=C,S=function(t,e,r,n,a){t===void 0&&(t=[]),r===void 0&&(r=void 0),n===void 0&&(n=[]),a===void 0&&(a=[]);var i=(0,s.clone)(t.filter(function(O){return O.id!==e.id})),o=t.findIndex(function(O){return O.id===e.id}),u=Rt(t,r),l=Ar(u,n,a),h=l[o],y=[];return i.forEach(function(O,A){if(O.id!==e.id){var z=l[A],$=b(z,h);y.push($),O.cosineSimilarity=$}}),i.sort(function(O,A){return A.cosineSimilarity-O.cosineSimilarity}),{allCosineSimilarity:y,similarNodes:i}},X=S,pe=function(){function E(t){this.count=t.length,this.parent={};for(var e=0,r=t;e0&&(this.list[0]=e,this.moveDown(0)),t},E.prototype.insert=function(t){if(t!==null){this.list.push(t);var e=this.list.length-1;return this.moveUp(e),!0}return!1},E.prototype.moveUp=function(t){for(var e=this.getParent(t);t&&t>0&&this.compareFn(this.list[e],this.list[t])>0;){var r=this.list[e];this.list[e]=this.list[t],this.list[t]=r,t=e,e=this.getParent(t)}},E.prototype.moveDown=function(t){var e,r=t,n=this.getLeft(t),a=this.getRight(t),i=this.list.length;n!==null&&n0?r=n:a!==null&&a0&&(r=a),t!==r&&(e=[this.list[r],this.list[t]],this.list[t]=e[0],this.list[r]=e[1],this.moveDown(r))},E}(),st=Le,qe=function(t,e){var r=[],n=t.nodes,a=n===void 0?[]:n,i=t.edges,o=i===void 0?[]:i;if(a.length===0)return r;var u=a[0],l=new Set;l.add(u);var h=function(ae,ce){return e?ae.weight-ce.weight:0},y=new st(h);for(ye(u.id,o).forEach(function($){y.insert($)});!y.isEmpty();){var O=y.delMin(),A=O.source,z=O.target;l.has(A)&&l.has(z)||(r.push(O),l.has(A)||(l.add(A),ye(A,o).forEach(function($){y.insert($)})),l.has(z)||(l.add(z),ye(z,o).forEach(function($){y.insert($)})))}return r},Nt=function(t,e){var r=[],n=t.nodes,a=n===void 0?[]:n,i=t.edges,o=i===void 0?[]:i;if(a.length===0)return r;var u=o.map(function(A){return A});e&&u.sort(function(A,z){return A.weight-z.weight});for(var l=new Me(a.map(function(A){return A.id}));u.length>0;){var h=u.shift(),y=h.source,O=h.target;l.connected(y,O)||(r.push(h),l.union(y,O))}return r},nr=function(t,e,r){var n={prim:qe,kruskal:Nt};return r?n[r](t,e):Nt(t,e)},Ft=nr,er=function(t,e,r){typeof e!="number"&&(e=1e-6),typeof r!="number"&&(r=.85);for(var n=1,a=0,i=1e3,o=t.nodes,u=o===void 0?[]:o,l=t.edges,h=l===void 0?[]:l,y=u.length,O,A={},z={},$=0;$0&&n>e;){a=0;for(var $=0;$0&&(O+=z[Re]/Ve)}A[ce]=r*O,a+=A[ce]}}a=(1-a)/y,n=0;for(var $=0;$=0;r--){var n=this.dfsEdgeList[r],a=n.fromNode,i=n.toNode;aA||n.hasNode(i[O.to])||(e.labelve;Re--){var Ve=Ce(Re);if(Ve==="break")break}if(ce){var Ue=t.findMinLabel(ae);i.dfsEdgeList.push(new ra($,ue,Dr,Ue.edgeLabel,Dr));var $e=i.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[$e]!==i.dfsEdgeList[$e]?!1:y(ae[Ue.edgeLabel].projected)}var ot={};ce=!1;var et=0;O.forEach(function(dr){var hn=new Vr(dr),on=t.findForwardPureEdges(n,hn.edges[A[0]],z,hn);on.length>0&&(ce=!0,et=$,on.forEach(function(cr){var Rr="".concat(cr.label,"-").concat(a[cr.to].label);ot[Rr]||(ot[Rr]={projected:[],edgeLabel:cr.label,nodeLabel2:a[cr.to].label}),ot[Rr].projected.push({graphId:n.id,edge:cr,preNode:dr})}))});for(var yt=A.length,Gt=function(hn){if(ce)return"break";var on=A[hn];O.forEach(function(cr){var Rr=new Vr(cr),Yr=t.findForwardRmpathEdges(n,Rr.edges[on],z,Rr);Yr.length>0&&(ce=!0,et=i.dfsEdgeList[on].fromNode,Yr.forEach(function(Wr){var sn="".concat(Wr.label,"-").concat(a[Wr.to].label);ot[sn]||(ot[sn]={projected:[],edgeLabel:Wr.label,nodeLabel2:a[Wr.to].label}),ot[sn].projected.push({graphId:n.id,edge:Wr,preNode:cr})}))})},Re=0;Re=0;z--){var $=e.findBackwardEdge(y,A.edges[a[z]],A.edges[a[0]],A);if($){var ae="".concat(e.dfsCode.dfsEdgeList[a[z]].fromNode,"-").concat($.label);l[ae]||(l[ae]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[a[z]].fromNode,edgeLabel:$.label}),l[ae].projected.push({graphId:h.graphId,edge:$,preNode:h})}}if(!(n>=e.maxNodeNum)){var ce=e.findForwardPureEdges(y,A.edges[a[0]],o,A);ce.forEach(function(ve){var Ce="".concat(i,"-").concat(ve.label,"-").concat(O[ve.to].label);u[Ce]||(u[Ce]={projected:[],fromNodeId:i,edgeLabel:ve.label,nodeLabel2:O[ve.to].label}),u[Ce].projected.push({graphId:h.graphId,edge:ve,preNode:h})});for(var ue=function(Ce){var Re=e.findForwardRmpathEdges(y,A.edges[a[Ce]],o,A);Re.forEach(function(Ve){var Ue="".concat(e.dfsCode.dfsEdgeList[a[Ce]].fromNode,"-").concat(Ve.label,"-").concat(O[Ve.to].label);u[Ue]||(u[Ue]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[a[Ce]].fromNode,edgeLabel:Ve.label,nodeLabel2:O[Ve.to].label}),u[Ue].projected.push({graphId:h.graphId,edge:Ve,preNode:h})})},z=0;zve){var Ce=ve;ve=ue,ue=Ce}var Re=ce.label,Ve="".concat(l,"-").concat(ue,"-").concat(Re,"-").concat(ve),Ue="".concat(ue,"-").concat(Re,"-").concat(ve);if(!i[Ue]){var $e=i[Ue]||0;$e++,i[Ue]=$e}u[Ve]={graphId:l,nodeLabel1:ue,edgeLabel:Re,nodeLabel2:ve}})})}),Object.keys(a).forEach(function(l){var h=a[l];if(!(h2*e)););if(ae<2*e&&(o["".concat(h,"-").concat($)]={start:h,end:$,distance:a[h][$]},y++,u++,u>=r))return o;if(O++,O>2*e)break}if(yO&&(u=O);var A=r[y.id].inDegree;l>A&&(l=A);var z=r[y.id].outDegree;h>z&&(h=z)}),t[e]={degree:u,inDegree:l,outDegree:h}),{minPatternNodeLabelDegree:u,minPatternNodeLabelInDegree:l,minPatternNodeLabelOutDegree:h}},jn=function(t,e,r,n,a,i,o){var u;if(r===void 0&&(r=!1),i===void 0&&(i="cluster"),o===void 0&&(o="cluster"),!(!t||!t.nodes)){var l=t.nodes.length;if(l){var h=Pr(t,r),y=Pr(e,r),O=nn(t.nodes,h,r),A=nn(e.nodes,y,r),z=ir(t.nodes,i),$=z.nodeMap,ae=z.nodeLabelMap,ce=ir(e.nodes,i),ue=ce.nodeMap,ve=ce.nodeLabelMap;Kr(t.edges,o,$);var Ce=Kr(e.edges,o,ue).edgeLabelMap,Re=[];y==null||y.forEach(function(pa){Re=Re.concat(pa)}),a||(a=Math.max.apply(Math,(0,c.__spreadArray)((0,c.__spreadArray)([],Re,!1),[2],!1))),n||(n=a);var Ve=De(t,h,i,n),Ue=De(e,y,i,n),$e=Math.min(100,l*(l-1)/2),ot=Je(n,l,$e,Ve,h),et=lt(ot,Ve,t),yt=10,Gt=1,yr=1,kr=4,Mr={graphs:et,nodeLabelProp:i,edgeLabelProp:o,minSupport:Gt,minNodeNum:yr,maxNodeNum:kr,directed:r},dr=be(Mr).slice(0,yt),hn=dr.length,on=[];dr.forEach(function(pa,Oa){on[Oa]={},Object.keys(et).forEach(function(va){var La=et[va],za=Tt(La,pa,i,o);on[Oa][va]=za})});var cr=Ht(on,hn,dr),Rr=cr.structure,Yr=cr.structureCountMap,Wr=e.nodes[0],sn=[],wn=(u=e.nodes[0])===null||u===void 0?void 0:u[i],la=-1/0;e.nodes.forEach(function(pa){var Oa=pa[i],va=ae[Oa];(va==null?void 0:va.length)>la&&(la=va.length,sn=va,wn=Oa,Wr=pa)});var da={},Ra={},Ia={},Xa={},Ga={},ci={};Object.keys(ve).forEach(function(pa,Oa){Ga[pa]=[],r&&(ci[pa]=[]);var va=-1/0,La=ve[pa],za={};La.forEach(function(Sa){var Ta=A["".concat(Wr.id,"-").concat(Sa.id)];if(Ta&&Ga[pa].push(Ta),vaGa[pa][Do]){nl=!0;break}if(nl)return sn.splice(Ta,1),"continue";var Ds={};cs.neighbors.forEach(function(No){var iu=O["".concat(li.id,"-").concat(No.id)];Ds["".concat(li.id,"-").concat(No.id)]={start:$[li.id].idx,end:$[No.id].idx,distance:iu}}),et=lt(Ds,Ve,t,et);var Pu=[];Object.keys(Ds).forEach(function(No){if(Yr[No]){Pu.push(Yr[No]);return}var iu=et[No];Yr[No]=Tt(iu,Rr,i,o),Pu.push(Yr[No])}),Pu=Pu.sort(function(No,iu){return iu-No});for(var tc=!1,Do=0;Do=0;Ua--)xa(Ua)});var ja=[];sn==null||sn.forEach(function(pa){for(var Oa=$[pa.id].idx,va=Xe(t.nodes,h[Oa],Oa,i,a),La=va.neighbors,za=La.length,Pn=!1,Ea=za-1;Ea>=0;Ea--){if(La.length+1cs){La.splice(Ea,1);continue}if(r){var Ii="".concat(xa.id,"-").concat(pa.id),Nc=O[Ii];li=ci[Ua].length-1;var nl=ci[Ua][li];if(Nc>nl){La.splice(Ea,1);continue}}var Do=Yr[Sa]?Yr[Sa]:mn(t,pa,xa,$,Ta,Ve,Rr,i,o,Yr,et),Ds="".concat(Wr.id,"-").concat(Ua),Pu=Xa[Ds][Xa[Ds].length-1];if(Do=0;Ta--){var nl=Nc(Ta);if(nl==="break")break}if(Ii)return ja.splice(Oa,1),"continue";va.edges=Ea;var Do=Hr(va,va.nodes[0].id,!1).length;if(Object.keys(Do).reverse().forEach(function(ti){if(!(ti===va.nodes[0].id||Ii)){if(Do[ti]===1/0){var ls=Pn[ti].node[i];if(za[ls]--,za[ls]ki[ku][ki[ku].length-1]){var ls=Pn[ti].node[i];if(za[ls]--,za[ls]=0;iu--){var hf=va.nodes[iu],md=Pn[hf.id].degree,Kh=Pn[hf.id].inDegree,$h=Pn[hf.id].outDegree,Qh=hf[i],Ul=Jr(da,Qh,ue,ve),bd=Ul.minPatternNodeLabelDegree,Jh=Ul.minPatternNodeLabelInDegree,qh=Ul.minPatternNodeLabelOutDegree,ev=r?md=0;Ll--){var vf=Ea[Ll];if(!Pn[vf.source]||!Pn[vf.target]){Ea.splice(Ll,1);var Dl=vf[o];if(xa[Dl]--,Pn[vf.source]&&(Pn[vf.source].degree--,Pn[vf.source].outDegree--),Pn[vf.target]&&(Pn[vf.target].degree--,Pn[vf.target].inDegree--),Ce[Dl]&&xa[Dl]=0;Bi--){var fs=Ri(Bi);if(fs==="break")break}for(var lo=ja.length,Lo=function(Oa){var va=ja[Oa],La={};va.edges.forEach(function(Ea){var xa="".concat(Ea.source,"-").concat(Ea.target,"-").concat(Ea.label);La[xa]?La[xa]++:La[xa]=1});for(var za=function(xa){var Ua=ja[xa],Sa={};Ua.edges.forEach(function(li){var cs="".concat(li.source,"-").concat(li.target,"-").concat(li.label);Sa[cs]?Sa[cs]++:Sa[cs]=1});var Ta=!0;Object.keys(Sa).length!==Object.keys(La).length?Ta=!1:Object.keys(La).forEach(function(li){Sa[li]!==La[li]&&(Ta=!1)}),Ta&&ja.splice(xa,1)},Pn=lo-1;Pn>Oa;Pn--)za(Pn);lo=ja.length},Bi=0;Bi<=lo-1;Bi++)Lo(Bi);return ja}}},_a=jn,Fn=function(){function E(t){t===void 0&&(t=10),this.linkedList=new K,this.maxStep=t}return Object.defineProperty(E.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),E.prototype.isEmpty=function(){return!this.linkedList.head},E.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},E.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},E.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},E.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},E.prototype.toArray=function(){return this.linkedList.toArray().map(function(t){return t.value})},E.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},E}(),ya=Fn,Ai=ur,bo={getAdjMatrix:W,breadthFirstSearch:Te,connectedComponent:tt,getDegree:ft,getInDegree:Lt,getOutDegree:Jt,detectCycle:ur,detectDirectedCycle:Ai,detectAllCycles:mt,detectAllDirectedCycle:wt,detectAllUndirectedCycle:pt,depthFirstSearch:xt,dijkstra:Hr,findAllPath:ar,findShortestPath:qt,floydWarshall:Pr,labelPropagation:Gr,louvain:jr,iLouvain:vn,kCore:Wn,kMeans:ee,cosineSimilarity:b,nodesCosineSimilarity:X,minimumSpanningTree:Ft,pageRank:Ur,getNeighbors:fe,Stack:ya,GADDI:_a},Zi=F(54442),Fi=F(73485),Kn=F(38015),ho=Q.vs,Ei=function(t){return function(e,r){return e[t]-r[t]}},eo=function(t,e,r){return t>=e&&t<=r},Eo=function(t,e,r,n){var a=1e-4,i={x:r.x-t.x,y:r.y-t.y},o={x:e.x-t.x,y:e.y-t.y},u={x:n.x-r.x,y:n.y-r.y},l=o.x*u.y-o.y*u.x,h=l*l,y=1/l,O=o.x*o.x+o.y*o.y,A=u.x*u.x+u.y*u.y;if(h>a*O*A){var z=(i.x*u.y-i.y*u.x)*y,$=(i.x*o.y-i.y*o.x)*y;return!eo(z,0,1)||!eo($,0,1)?null:{x:t.x+z*o.x,y:t.y+z*o.y}}return null},Yo=function(t,e){var r=t.x,n=t.y,a=t.width,i=t.height,o=r+a/2,u=n+i/2,l=[],h={x:o,y:u};l.push({x:r,y:n}),l.push({x:r+a,y:n}),l.push({x:r+a,y:n+i}),l.push({x:r,y:n+i}),l.push({x:r,y:n});for(var y=null,O=1;Oe[n][i]+e[i][a]&&(e[n][a]=e[n][i]+e[i][a]);return e},Ru=function(t,e){var r=t.nodes,n=t.edges,a=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(function(o,u){i[o.id]=u;var l=[];a.push(l)}),n&&n.forEach(function(o){var u=o.source,l=o.target,h=i[u],y=i[l];a[h][y]=1,e||(a[y][h]=1)}),a},xo=function(t,e){t.translate(e.x,e.y)},ri=function(t,e,r,n){n===void 0&&(n={duration:500});var a=t.getMatrix();a||(a=[1,0,0,0,1,0,0,0,1]);var i=t.getCanvasBBox(),o=e.x-i.minX,u=e.y-i.minY;if(r){var l=o*a[0],h=u*a[4],y=0,O=0,A=0,z=0;t.animate(function(ae){return A=l*ae,z=h*ae,a=ho(a,[["t",A-y,z-O]]),y=A,O=z,{matrix:a}},n)}else{var $=ho(a,[["t",o,u]]);t.setMatrix($)}},wo=function(t,e){var r=t.getMatrix();r||(r=[1,0,0,0,1,0,0,0,1]);var n=e;(0,s.isArray)(e)||(n=[e,e]),(0,s.isArray)(e)&&e.length===1&&(n=[e[0],e[0]]),r=ho(r,[["s",n[0],n[1]]]),t.setMatrix(r)},ds=function(t,e){var r=t.getMatrix();r||(r=[1,0,0,0,1,0,0,0,1]),r=ho(r,[["r",e]]),t.setMatrix(r)},Ho=function(t,e,r){for(var n=[],a=0;a0!=o(h[1]-r)>0&&o(e-(r-l[1])*(l[0]-h[0])/(l[1]-h[1])-l[0])<0&&(n=!n)}return n},Va=function(t,e){return!(e.minX>t.maxX||e.maxXt.maxY||e.maxY1){var ue=O[0],ve=O[z-1];A.push({from:{x:ve[0],y:ve[1]},to:{x:ue[0],y:ue[1]}})}return A};if(t.length<2||e.length<2)return!1;var a=r(t),i=r(e);if(!Va(a,i))return!1;var o=!1;if((0,s.each)(e,function(y){if($i(t,y[0],y[1]))return o=!0,!1}),o||((0,s.each)(t,function(y){if($i(e,y[0],y[1]))return o=!0,!1}),o))return!0;var u=n(t),l=n(e),h=!1;return(0,s.each)(l,function(y){if(ro(u,y))return h=!0,!1}),h},Ui=function(){function E(t,e,r,n){this.x1=t,this.y1=e,this.x2=r,this.y2=n}return E.prototype.getBBox=function(){var t=Math.min(this.x1,this.x2),e=Math.min(this.y1,this.y2),r=Math.max(this.x1,this.x2),n=Math.max(this.y1,this.y2),a={x:t,y:e,minX:t,minY:e,maxX:r,maxY:n,width:r-t,height:n-e};return a},E}(),Wi=function(t,e){var r={top:[t.minX,t.minY,t.maxX,t.minY],left:[t.minX,t.minY,t.minX,t.maxY],bottom:[t.minX,t.maxY,t.maxX,t.maxY],right:[t.maxX,t.minY,t.maxX,t.maxY]};return r[e]},Ko=function(t,e){var r=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),n=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),a=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(a){var i=r/a,o=n/a;if(i>=0&&i<=1&&o>=0&&o<=1)return i}return Number.POSITIVE_INFINITY},vo=function(t,e){for(var r=["top","left","bottom","right"],n=t.getBBox(),a=0,i=[],o=0;o<4;o++){var u=Wi(n,r[o]),l=u[0],h=u[1],y=u[2],O=u[3];i[o]=Eo({x:e.x1,y:e.y1},{x:e.x2,y:e.y2},{x:l,y:h},{x:y,y:O}),i[o]&&(a+=1)}return[i,a]},hs=function(t,e){for(var r=["top","left","bottom","right"],n=t.getBBox(),a=Number.POSITIVE_INFINITY,i=0,o=0;o<4;o++){var u=Wi(n,r[o]),l=u[0],h=u[1],y=u[2],O=u[3],A=Ko(e,new Ui(l,h,y,O));A=Math.abs(A-.5),A>=0&&A<=1&&(i+=1,a=A0){for(var n=0,a=t;ne.x+e.width,a=t.y>e.y+e.height,i=t.y":.604998779296875,"/":.5,"?":.53699951171875},ai=Math.PI,Ps=Math.sin,$o=Math.cos,Ba=Ps(ai/8),$a=$o(ai/8),Qo=function(t,e){var r=t.getBBox(),n={x:r.minX,y:r.minY},a={x:r.maxX,y:r.maxY};if(e){var i=e.getMatrix();i||(i=[1,0,0,0,1,0,0,0,1]),n=Si(n,i),a=Si(a,i)}var o=n.x,u=n.y,l=a.x,h=a.y;return{x:o,y:u,minX:o,minY:u,maxX:l,maxY:h,width:l-o,height:h-u}},Jo=function(t){var e=t.sourceNode||t.targetNode,r=e.get("group"),n=r.getMatrix();n||(n=[1,0,0,0,1,0,0,0,1]);var a=e.getKeyShape(),i=a.getBBox(),o=t.loopCfg||{},u=o.dist||Math.max(i.width,i.height)*2,l=o.position||dn.defaultLoopPosition,h=[(i.minX+i.maxX)/2+n[6],(i.minY+i.maxY)/2+n[7]],y=[t.startPoint.x,t.startPoint.y],O=[t.endPoint.x,t.endPoint.y],A=i.height/2,z=i.width/2,$=A,ae=A,ce=$*Ba,ue=$*$a,ve=ae*Ba,Ce=ae*$a,Re=a.get("type"),Ve=Math.min(A/2,z/2),Ue=Math.min(A,z),$e=o!=null&&o.pointPadding?Math.min(Ue,o==null?void 0:o.pointPadding):Ve;if(y[0]===O[0]&&y[1]===O[1]){switch(l){case"top":Re==="circle"?(y=[h[0]-ce,h[1]-ue],O=[h[0]+ve,h[1]-Ce]):(y=[h[0]-$e,h[1]-A],O=[h[0]+$e,h[1]-A]);break;case"top-right":$=A,ae=z,Re==="circle"?(ce=$*Ba,ue=$*$a,ve=ae*Ba,Ce=ae*$a,y=[h[0]+ce,h[1]-ue],O=[h[0]+Ce,h[1]-ve]):(y=[h[0]+z-$e,h[1]-A],O=[h[0]+z,h[1]-A+$e]);break;case"right":$=z,ae=z,Re==="circle"?(ce=$*Ba,ue=$*$a,ve=ae*Ba,Ce=ae*$a,y=[h[0]+ue,h[1]-ce],O=[h[0]+Ce,h[1]+ve]):(y=[h[0]+z,h[1]-$e],O=[h[0]+z,h[1]+$e]);break;case"bottom-right":$=z,ae=A,Re==="circle"?(ce=$*Ba,ue=$*$a,ve=ae*Ba,Ce=ae*$a,y=[h[0]+ue,h[1]+ce],O=[h[0]+ve,h[1]+Ce]):(y=[h[0]+z,h[1]+A-$e],O=[h[0]+z-$e,h[1]+A]);break;case"bottom":$=A,ae=A,Re==="circle"?(ce=$*Ba,ue=$*$a,ve=ae*Ba,Ce=ae*$a,y=[h[0]+ce,h[1]+ue],O=[h[0]-ve,h[1]+Ce]):(y=[h[0]-$e,h[1]+A],O=[h[0]+$e,h[1]+A]);break;case"bottom-left":$=A,ae=z,Re==="circle"?(ce=$*Ba,ue=$*$a,ve=ae*Ba,Ce=ae*$a,y=[h[0]-ce,h[1]+ue],O=[h[0]-Ce,h[1]+ve]):(y=[h[0]-z,h[1]+A-$e],O=[h[0]-z+$e,h[1]+A]);break;case"left":$=z,ae=z,Re==="circle"?(ce=$*Ba,ue=$*$a,ve=ae*Ba,Ce=ae*$a,y=[h[0]-ue,h[1]+ce],O=[h[0]-Ce,h[1]-ve]):(y=[h[0]-z,h[1]-$e],O=[h[0]-z,h[1]+$e]);break;case"top-left":$=z,ae=A,Re==="circle"?(ce=$*Ba,ue=$*$a,ve=ae*Ba,Ce=ae*$a,y=[h[0]-ue,h[1]-ce],O=[h[0]-ve,h[1]-Ce]):(y=[h[0]-z+$e,h[1]-A],O=[h[0]-z,h[1]-A+$e]);break;default:$=z,ae=z,ce=$*Ba,ue=$*$a,ve=ae*Ba,Ce=ae*$a,y=[h[0]-ce,h[1]-ue],O=[h[0]+ve,h[1]-Ce]}if(o.clockwise===!1){var ot=[y[0],y[1]];y=[O[0],O[1]],O=[ot[0],ot[1]]}}var et=[y[0]-h[0],y[1]-h[1]],yt=($+u)/$,Gt=(ae+u)/ae;o.clockwise===!1&&(yt=(ae+u)/ae,Gt=($+u)/$);var yr=Kn.scale([0,0],et,yt),kr=[h[0]+yr[0],h[1]+yr[1]],Mr=[O[0]-h[0],O[1]-h[1]],dr=Kn.scale([0,0],Mr,Gt),hn=[h[0]+dr[0],h[1]+dr[1]];return t.startPoint={x:y[0],y:y[1]},t.endPoint={x:O[0],y:O[1]},t.controlPoints=[{x:kr[0],y:kr[1]},{x:hn[0],y:hn[1]}],t},vs=function(t,e,r,n,a){var i=1e-4,o=[],u=t==null?void 0:t.getPoint(e);if(!u)return{x:0,y:0,angle:0};if(e1-i)o=t.getEndTangent();else{var l=t==null?void 0:t.getPoint(e+i);o.push([u.x,u.y]),o.push([l.x,l.y])}var h=Math.atan2(o[1][1]-o[0][1],o[1][0]-o[0][0]);if(h<0&&(h+=ai*2),r&&(u.x+=$o(h)*r,u.y+=Ps(h)*r),n){var y=h-ai/2;h>1/2*ai&&h<3*1/2*ai&&(y-=ai),u.x+=$o(y)*n,u.y+=Ps(y)*n}var O={x:u.x,y:u.y,angle:h};return a?(h>.5*ai&&h<1.5*ai&&(h-=ai),(0,c.__assign)({rotate:h},O)):O},Bu=function E(t,e,r,n){if(n(t,e,r)===!1)return!1;if(t&&t.children){for(var a=t.children.length-1;a>=0;a--)if(!E(t.children[a],t,a,n))return!1}return!0},Fu=function E(t,e,r,n){if(t&&t.children){for(var a=t.children.length-1;a>=0;a--)if(!E(t.children[a],t,a,n))return}return n(t,e,r)!==!1},Fa=function(t,e){typeof e=="function"&&Bu(t,null,-1,e)},yo=function(t,e){typeof e=="function"&&Fu(t,null,-1,e)},gs=function(t,e){return e*(rc[t]||1)},fu=function(t,e){var r=0,n=new RegExp("[\u4E00-\u9FA5]+");return t.split("").forEach(function(a){n.test(a)?r+=e:r+=gs(a,e)}),[r,e]},cu=function(t,e){return typeof e!="number"||e<=0||e>=t.length?t:t.substring(0,e)+"..."},ks=function(t,e){var r=[],n={},a={};t.forEach(function(u){a[u.id]=u}),t.forEach(function(u,l){var h=(0,s.clone)(u);h.itemType="combo",h.children=void 0,h.parentId===h.id?(console.warn("The parentId for combo ".concat(h.id," can not be the same as the combo's id")),delete h.parentId):h.parentId&&!a[h.parentId]&&(console.warn("The parent combo for combo ".concat(h.id," does not exist!")),delete h.parentId);var y=n[h.id];if(y){if(h.children=y.children,n[h.id]=h,y=h,!y.parentId){r.push(y);return}var O=n[y.parentId];if(O)O.children?O.children.push(h):O.children=[h];else{var A={id:y.parentId,children:[y]};n[y.parentId]=A,n[h.id]=h}return}if((0,s.isString)(u.parentId)){var z=n[u.parentId];if(z)z.children?z.children.push(h):z.children=[h],n[h.id]=h;else{var $={id:u.parentId,children:[h]};n[$.id]=$,n[h.id]=h}}else r.push(h),n[h.id]=h});var i={};(e||[]).forEach(function(u){i[u.id]=u;var l=n[u.comboId];if(l){var h={id:u.id,comboId:u.comboId};l.children?l.children.push(h):l.children=[h],h.itemType="node",n[u.id]=h}});var o=0;return r.forEach(function(u){u.depth=o+10,Fa(u,function(l){var h,y=n[l.id].itemType;y==="node"?h=n[l.comboId]:h=n[l.parentId],h&&y==="node"?l.depth=o+1:l.depth=o+10,o-1&&a.splice(h,1),u||(i={id:e,itemType:"node",comboId:r},o[e]={children:void 0}),e){var y=!1;if(r){var O=0;(t||[]).forEach(function(z){y||Fa(z,function($){return r===$.id?(y=!0,$.children?$.children.push(i):$.children=[i],O=$.depth,i.itemType==="node"?i.depth=O+2:i.depth=O+1,!1):!0})})}else(!r||!y)&&i.itemType!=="node"&&t.push(i);var A=i.depth;Fa(i,function(z){return z.itemType==="node"?A+=2:A+=1,z.depth=A,!0})}return t},ys=function(t,e,r){var n={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0,x:void 0,y:void 0,width:void 0,height:void 0,centerX:void 0,centerY:void 0};if(!t||t.length===0){var a=r==null?void 0:r.getModel(),i=a||{},o=i.x,u=i.y,l=i.fixSize,h=i.collapsed,y=i.fixCollapseSize,O=h?y:l,A=(0,s.isArray)(O)?O:[O,O],z=A[0],$=A[1],ae=[z/2,$/2];return{minX:o-ae[0],minY:u-ae[1],maxX:o+ae[0],maxY:u+ae[1],x:o,y:u,width:z,height:$}}return t.forEach(function(ce){var ue=e.findById(ce.id);if(!(!ue||!ue.isVisible())){ue.set("bboxCanvasCache",void 0);var ve=ue.getCanvasBBox();ve.x&&n.minX>ve.minX&&(n.minX=ve.minX),ve.y&&n.minY>ve.minY&&(n.minY=ve.minY),ve.x&&n.maxXr&&(r=y),O>a&&(a=O)}var A=Math.floor(e),z=Math.floor(n),$=Math.ceil(r)-Math.floor(e),ae=Math.ceil(a)-Math.floor(n);return{x:A,y:z,width:$,height:ae,minX:e,minY:n,maxX:r,maxY:a}},Xu=function(t,e,r,n,a){e===void 0&&(e=15),r===void 0&&(r="quadratic"),n===void 0&&(n=void 0),a===void 0&&(a=void 0);for(var i=t.length,o=e*2,u=["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left"],l={},h=[],y={},O=0;Or.get("optimizeThreshold")){var o=1/0,u=1/0,l=-1/0,h=-1/0;i.forEach(function(Ce){var Re=Ce.getModel(),Ve=Re.x,Ue=Re.y;o>Ve&&(o=Ve),u>Ue&&(u=Ue),lae&&(ce=ae,console.warn("fitview failed, ratio out of range, ratio: %f",o,"graph maxzoom has been used instead"));var ue=(0,vu.vs)(A,[["t",-a.x,-a.y],["s",ce,ce],["t",a.x,a.y]]),ve=ko({animateCfg:r,callback:function(){t.setMatrix(ue),l.emit("viewportchange",{action:"translate",matrix:A}),l.emit("viewportchange",{action:"zoom",matrix:ue})}});t.stopAnimate(),t.setMatrix(e),t.animate(function(Ce){return{matrix:xi(e,ue,Ce)}},ve)}},E.prototype.fitView=function(t,e){var r=this.graph,n=this.getFormatPadding(),a=r.get("width"),i=r.get("height"),o=r.get("group"),u=o.getMatrix()||[1,0,0,0,1,0,0,0,1];o.resetMatrix();var l,h=r.getNodes();if(h.length>r.get("optimizeThreshold")){var y=1/0,O=1/0,A=-1/0,z=-1/0;h.forEach(function(Ve){var Ue=Ve.getModel(),$e=Ue.x,ot=Ue.y;y>$e&&(y=$e),O>ot&&(O=ot),A<$e&&(A=$e),zue&&(ve=ue),t)this.animatedFitView(o,u,e,l,$,ae,ve,!0);else{var Ce=$.x-ae.x,Re=$.y-ae.y;if(ao(Ce)||ao(Re))return;r.translate(Ce,Re),r.zoom(ve,$)||console.warn("zoom failed, ratio out of range, ratio: %f",ve)}}},E.prototype.fitViewByRules=function(t,e,r){var n=t.onlyOutOfViewPort,a=n===void 0?!1:n,i=t.direction,o=i===void 0?"both":i,u=t.ratioRule,l=u===void 0?"min":u,h=this.graph,y=this.getFormatPadding(),O=h.get("width"),A=h.get("height"),z=h.get("group"),$=z.getMatrix()||[1,0,0,0,1,0,0,0,1];z.resetMatrix();var ae,ce=h.getNodes();if(ce.length>h.get("optimizeThreshold")){var ue=1/0,ve=1/0,Ce=-1/0,Re=-1/0;ce.forEach(function(kr){var Mr=kr.getModel(),dr=Mr.x,hn=Mr.y;ue>dr&&(ue=dr),ve>hn&&(ve=hn),Cey.maxX&&(y.maxX=$.maxX),$.maxY>y.maxY&&(y.maxY=$.maxY)}if(y.x=y.minX,y.y=y.minY,y.width=y.maxX-y.minX,y.height=y.maxY-y.minY,!(y.width===0||y.height===0)){var ae=this.getViewCenter(),ce={x:y.x+y.width/2,y:y.y+y.height/2},ue=(o-i[1]-i[3])/y.width,ve=(u-i[0]-i[2])/y.height,Ce=ue;ue>ve&&(Ce=ve),r?this.animatedFitView(l,h,n,y,ae,ce,Ce,e):(a.translate(ae.x-ce.x,ae.y-ce.y),e&&!a.zoom(Ce,ae)&&console.warn("zoom failed, ratio out of range, ratio: %f",Ce))}}},E.prototype.changeSize=function(t,e){var r=this.graph;if(!(0,s.isNumber)(t)||!(0,s.isNumber)(e))throw Error("invalid canvas width & height, please make sure width & height type is number");r.set({width:t,height:e});var n=r.get("canvas");n.changeSize(t,e);var a=r.get("plugins");a.forEach(function(i){i.get("gridContainer")&&i.positionInit()})},E.prototype.destroy=function(){this.graph=null,this.destroyed=!1},E}(),pf=Xi;function ju(E){"@babel/helpers - typeof";return ju=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},ju(E)}function yf(E){if(typeof E!="string")return E;var t=function(Ue){if(typeof Ue!="string")return Ue;try{return JSON.parse(Ue.trim())}catch($e){return Ue.trim()}},e=t(E);if(typeof e!="string")return e;for(var r=function(Ue){return Ue[Ue.length-1]},n=E.trim(),a=[],i=[],o=function(){for(var Ue=[],$e=0;$e=0&&(a.height=i),o>=0&&(a.width=o),n.marginTop&&(a.y+=n.marginTop),n.marginLeft&&(a.x+=n.marginLeft),a}function zs(E,t){var e;t===void 0&&(t={x:0,y:0});var r=(0,c.__assign)({x:0,y:0,width:0,height:0},t);if(!((e=E.children)===null||e===void 0)&&e.length){var n=E.attrs,a=n===void 0?{}:n,i=a.marginTop,o=(0,c.__assign)({},t);i&&(o.y+=i);for(var u=0;ur.width&&(r.width=h.width+h.x),h.height+h.y>r.height&&(r.height=h.height+h.y)}}}return E.bbox=bf(E,t,r),E.attrs=(0,c.__assign)((0,c.__assign)({},E.attrs),E.bbox),E}function Vu(E,t){var e,r,n,a,i=(E||{}).type,o=((t==null?void 0:t.attrs)||{}).key;if(o&&E&&(E.attrs.key=o),!E&&t)return{action:"delete",val:t,type:i,key:o};if(E&&!t)return{action:"add",val:E,type:i};if(!E&&!t)return{action:"same",type:i};var u=[];if(((e=E.children)===null||e===void 0?void 0:e.length)>0||((r=t.children)===null||r===void 0?void 0:r.length)>0)for(var l=Math.max((n=E.children)===null||n===void 0?void 0:n.length,(a=t.children)===null||a===void 0?void 0:a.length),h=t.children||[],y=E.children||[],O=0;O-1)return;r.push(a)}else u>-1&&r.splice(u,1)}else if((0,s.isString)(e)){var l=r.filter(function(O){return O.includes(i)});l.length>0&&this.clearStates(l),o=o.filter(function(O){return!O.includes(i)}),o.push(a),this.set("states",o)}if(n){var h=this.get("model"),y=h.type;n.setState(y,t,e,this)}},E.prototype.clearStates=function(t){var e=this,r=e.getStates(),n=e.get("shapeFactory"),a=e.get("model"),i=a.type;t||(t=r),(0,s.isString)(t)&&(t=[t]);var o=r.filter(function(u){return t.indexOf(u)===-1});e.set("states",o),t.forEach(function(u){n.setState(i,u,!1,e)})},E.prototype.setOptimize=function(t){this.optimize=t},E.prototype.getContainer=function(){return this.get("group")},E.prototype.getKeyShape=function(){return this.get("keyShape")},E.prototype.getModel=function(){return this.get("model")},E.prototype.getType=function(){return this.get("type")},E.prototype.getID=function(){return this.get("id")},E.prototype.isItem=function(){return!0},E.prototype.getStates=function(){return this.get("states")},E.prototype.hasState=function(t){var e=this.getStates();return e.indexOf(t)>=0},E.prototype.refresh=function(t){var e=this.get("model");this.updatePosition(e),this.updateShape(t),this.afterUpdate(),this.clearCache()},E.prototype.getUpdateType=function(t){},E.prototype.update=function(t,e){e===void 0&&(e=void 0);var r=this.get("model");if(e==="move")this.updatePosition(t);else{var n=r.visible,a=t.visible;n!==a&&a!==void 0&&this.changeVisibility(a);var i={x:r.x,y:r.y};t.x=isNaN(+t.x)?r.x:+t.x,t.y=isNaN(+t.y)?r.y:+t.y;var o=this.get("styles");if(t.stateStyles){var u=t.stateStyles;(0,s.mix)(o,u),delete t.stateStyles}Object.assign(r,t),(i.x!==t.x||i.y!==t.y)&&this.updatePosition(t),this.updateShape(e)}this.afterUpdate(),this.clearCache()},E.prototype.updateShape=function(t){var e=this.get("shapeFactory"),r=this.get("model"),n=r.type;if(e.shouldUpdate(n)&&n===this.get("currentShape")){var a=this.getShapeCfg(r,t);e.baseUpdate(n,a,this,t),t!=="move"&&this.setOriginStyle()}else this.draw();this.restoreStates(e,n)},E.prototype.updatePosition=function(t){var e=this.get("model"),r=isNaN(+t.x)?+e.x:+t.x,n=isNaN(+t.y)?+e.y:+t.y,a=this.get("group");if(isNaN(r)||isNaN(n))return!1;e.x=r,e.y=n;var i=a.getMatrix();return i&&i[6]===r&&i[7]===n?!1:(a.resetMatrix(),xo(a,{x:r,y:n}),this.clearCache(),!0)},E.prototype.getBBox=function(){var t=this.get(Ws);return t||(t=this.calculateBBox(),this.set(Ws,t)),t},E.prototype.getCanvasBBox=function(){var t=this.get(Xs);return t||(t=this.calculateCanvasBBox(),this.set(Xs,t)),t},E.prototype.toFront=function(){var t=this.get("group");t.toFront()},E.prototype.toBack=function(){var t=this.get("group");t.toBack()},E.prototype.show=function(){this.changeVisibility(!0)},E.prototype.hide=function(){this.changeVisibility(!1)},E.prototype.changeVisibility=function(t){var e=this.get("group");t?e.show():e.hide(),this.set("visible",t)},E.prototype.isVisible=function(){return this.get("visible")},E.prototype.enableCapture=function(t){var e=this.get("group");e&&e.set("capture",t)},E.prototype.destroy=function(){if(!this.destroyed){var t=this.get("animate"),e=this.get("group");t&&e.stopAnimate(),e.shapeMap={},this.clearCache(),e.remove(),this._cfg=null,this.destroyed=!0}},E}(),Yu=xf,js={source:"start",target:"end"},ji="Node",mo="Point",ac="Anchor",Vs=function(E){(0,c.__extends)(t,E);function t(){return E!==null&&E.apply(this,arguments)||this}return t.prototype.getDefaultCfg=function(){return{type:"edge",sourceNode:null,targetNode:null,startPoint:null,endPoint:null,linkCenter:!1}},t.prototype.setEnd=function(e,r){var n=js[e]+mo,a=e+ji,i=this.get(a);i&&!i.destroyed&&i.removeEdge(this),(0,s.isPlainObject)(r)?(this.set(n,r),this.set(a,null)):r&&(r.addEdge(this),this.set(a,r),this.set(n,null))},t.prototype.getLinkPoint=function(e,r,n){var a=js[e]+mo,i=e+ji,o=this.get(a);if(!o){var u=this.get(i),l=e+ac,h=this.getPrePoint(e,n),y=r[l];(0,s.isNil)(y)||(o=u.getLinkPointByAnchor(y)),o=o||u.getLinkPoint(h),(0,s.isNil)(o.index)||this.set("".concat(e,"AnchorIndex"),o.index)}return o},t.prototype.getPrePoint=function(e,r){if(r&&r.length){var n=e==="source"?0:r.length-1;return r[n]}var a=e==="source"?"target":"source";return this.getEndPoint(a)},t.prototype.getEndPoint=function(e){var r=e+ji,n=js[e]+mo,a=this.get(r);return a&&!a.destroyed?a.get("model"):this.get(n)},t.prototype.getControlPointsByCenter=function(e){var r=this.getEndPoint("source"),n=this.getEndPoint("target"),a=this.get("shapeFactory"),i=e.type;return a.getControlPoints(i,{startPoint:r,endPoint:n})},t.prototype.getEndCenter=function(e){var r=e+ji,n=js[e]+mo,a=this.get(r);if(a){var i=a.getBBox();return{x:i.centerX,y:i.centerY}}return this.get(n)},t.prototype.init=function(){E.prototype.init.call(this),this.setSource(this.get("source")),this.setTarget(this.get("target"))},t.prototype.getShapeCfg=function(e,r){var n=this,a=n.get("linkCenter"),i=r!=null&&r.includes("move")?e:E.prototype.getShapeCfg.call(this,e);if(a)i.startPoint=n.getEndCenter("source"),i.endPoint=n.getEndCenter("target");else{var o=i.controlPoints||n.getControlPointsByCenter(i);i.startPoint=n.getLinkPoint("source",e,o),i.endPoint=n.getLinkPoint("target",e,o)}return i.sourceNode=n.get("sourceNode"),i.targetNode=n.get("targetNode"),i},t.prototype.getModel=function(){var e=this.get("model"),r=this.get("source".concat(ji)),n=this.get("target".concat(ji));return r?delete e["source".concat(ji)]:e.source=this.get("start".concat(mo)),n?delete e["target".concat(ji)]:e.target=this.get("end".concat(mo)),!(0,s.isString)(e.source)&&!(0,s.isPlainObject)(e.source)&&(e.source=e.source.getID()),!(0,s.isString)(e.target)&&!(0,s.isPlainObject)(e.target)&&(e.target=e.target.getID()),e},t.prototype.setSource=function(e){this.setEnd("source",e),this.set("source",e)},t.prototype.setTarget=function(e){this.setEnd("target",e),this.set("target",e)},t.prototype.getSource=function(){return this.get("source")},t.prototype.getTarget=function(){return this.get("target")},t.prototype.updatePosition=function(){return!1},t.prototype.update=function(e,r){r===void 0&&(r=void 0);var n=this.get("model"),a=n.visible,i=e.visible;a!==i&&i!==void 0&&this.changeVisibility(i);var o=this.get("source"),u=this.get("target");if(!(!o||o.destroyed||!u||u.destroyed)){var l=this.get("styles");if(e.stateStyles){var h=e.stateStyles;(0,s.mix)(l,h),delete e.stateStyles}Object.assign(n,e),this.updateShape(r),this.afterUpdate(),this.clearCache()}},t.prototype.destroy=function(){var e=this.get("source".concat(ji)),r=this.get("target".concat(ji));e&&!e.destroyed&&e.removeEdge(this),r&&!r.destroyed&&r.removeEdge(this),E.prototype.destroy.call(this)},t}(Yu),Vi=Vs,Fo="anchorPointsCache",wf="bboxCache",Sf=function(E){(0,c.__extends)(t,E);function t(){return E!==null&&E.apply(this,arguments)||this}return t.prototype.getNearestPoint=function(e,r){for(var n=0,a=e[0],i=Gi(e[0],r),o=0;o-1&&r.splice(n,1)},t.prototype.clearCache=function(){this.set(wf,null),this.set(Fo,null)},t.prototype.getUpdateType=function(e){var r,n,a,i,o;if(e){var u=!(0,s.isNil)(e.x),l=!(0,s.isNil)(e.y),h=Object.keys(e);if(h.length===1&&(u||l)||h.length===2&&u&&l)return"move";if((0,s.isNumber)(e.x)||(0,s.isNumber)(e.y)||e.type||e.anchorPoints||e.size||e!=null&&e.style&&(!((r=e==null?void 0:e.style)===null||r===void 0)&&r.r||!((n=e==null?void 0:e.style)===null||n===void 0)&&n.width||!((a=e==null?void 0:e.style)===null||a===void 0)&&a.height||!((i=e==null?void 0:e.style)===null||i===void 0)&&i.rx||!((o=e==null?void 0:e.style)===null||o===void 0)&&o.ry))return"bbox|label";var y=h.includes("label")||h.includes("labelCfg");return y?"style|label":"style"}},t.prototype.setState=function(e,r){var n=this;if(this.optimize){E.prototype.setState.call(this,e,r);return}this.runWithBBoxAffected(function(){return E.prototype.setState.call(n,e,r)})},t.prototype.clearStates=function(e){var r=this;if(this.optimize){E.prototype.clearStates.call(this,e);return}this.runWithBBoxAffected(function(){return E.prototype.clearStates.call(r,e)})},t.prototype.runWithBBoxAffected=function(e){var r=["r","width","height","rx","ry","lineWidth"],n=this.getKeyShape().attr(),a={};Object.keys(this.getKeyShape().attr()).forEach(function(l){r.includes(l)&&(a[l]=n[l])}),e();for(var i=this.getKeyShape().attr(),o=0;o-1?(r.splice(n,1),!0):!1}},t.prototype.removeNode=function(e){if(e){var r=this.getNodes(),n=r.indexOf(e);return n>-1?(r.splice(n,1),!0):!1}},t.prototype.getUpdateType=function(e){},t.prototype.getBBox=function(){this.set(ts,null);var e=this.calculateCanvasBBox();return e},t.prototype.clearCache=function(){this.set(Hu,null),this.set(ts,null),this.set(Zu,null)},t.prototype.destroy=function(){if(!this.destroyed){var e=this.get("animate"),r=this.get("group");e&&r.stopAnimate(),r.shapeMap={},this.clearCache(),this.set(ms,null),this.set("bbox",null),r.remove(),this._cfg=null,this.destroyed=!0}},t}(Ys),ii=rs,Hs="node",bs="edge",io="vedge",ns="combo",_f="default",Mf="Mapper",Co="stateStyles",ic=function(){function E(t){var e=this;this.edgeToBeUpdateMap={},this.throttleRefresh=(0,s.throttle)(function(r){var n=e.graph;if(!(!n||n.get("destroyed"))){var a=e.edgeToBeUpdateMap;if(a){var i=Object.values(a);i.length&&(i.forEach(function(o){var u=o.edge;if(!(!u||u.destroyed)){var l=u.getSource(),h=u.getTarget();!l||l.destroyed||!h||h.destroyed||u.refresh(o.updateType)}}),e.edgeToBeUpdateMap={})}}},16,{trailing:!0,leading:!0}),this.graph=t,this.destroyed=!1}return E.prototype.addItem=function(t,e){var r=this.graph,n=t===io?bs:t,a=r.get("".concat(n,"Group"))||r.get("group"),i=(0,s.upperFirst)(n),o=null,u=r.get(n+(0,s.upperFirst)(Co))||{},l=r.get(_f+i);e[Co]&&(u=e[Co]),l&&(0,s.each)(l,function(Ve,Ue){(0,s.isObject)(Ve)&&!(0,s.isArray)(Ve)?e[Ue]=(0,s.deepMix)({},Ve,e[Ue]):(0,s.isArray)(Ve)?e[Ue]=e[Ue]||(0,s.clone)(l[Ue]):e[Ue]=e[Ue]||l[Ue]});var h=r.get(n+Mf);if(h){var y=h(e);y[Co]&&(u=y[Co],delete y[Co]),(0,s.each)(y,function(Ve,Ue){(0,s.isObject)(Ve)&&!(0,s.isArray)(Ve)?e[Ue]=(0,s.deepMix)({},e[Ue],Ve):e[Ue]=y[Ue]||e[Ue]})}if(r.emit("beforeadditem",{type:t,model:e}),t===bs||t===io){var O=void 0,A=void 0;if(O=e.source,A=e.target,O&&(0,s.isString)(O)&&(O=r.findById(O)),A&&(0,s.isString)(A)&&(A=r.findById(A)),!O||!A){console.warn("The source or target node of edge ".concat(e.id," does not exist!"));return}O.getType&&O.getType()==="combo"&&(e.isComboEdge=!0),A.getType&&A.getType()==="combo"&&(e.isComboEdge=!0),o=new Vi({model:e,source:O,target:A,styles:u,linkCenter:r.get("linkCenter"),group:a.addGroup()})}else if(t===Hs)o=new Ys({model:e,styles:u,group:a.addGroup()});else if(t===ns){var z=e.children,$=ys(z,r),ae=void 0,ce=void 0;if(isNaN($.x)?isNaN(e.x)&&(ae=Math.random()*100):ae=$.x,isNaN($.y)?isNaN(e.y)&&(ce=Math.random()*100):ce=$.y,isNaN(e.x)||isNaN(e.y))e.x=ae,e.y=ce;else{var ue=e.x-ae,ve=e.y-ce;this.updateComboSucceeds(e.id,ue,ve,z)}var Ce=a.addGroup();Ce.setZIndex(e.depth),o=new ii({model:e,styles:u,animate:r.get("animate"),bbox:e.collapsed?ys([],r):$,group:Ce}),!e.collapsed&&o.getKeyShape().get("type")==="circle"&&($.width=Math.hypot($.height,$.width),$.height=$.width,o.set("bbox",$),o.refresh());var Re=o.getModel();(z||[]).forEach(function(Ve){var Ue=r.findById(Ve.id);o.addChild(Ue),Ve.depth=Re.depth+2})}if(o)return o.setOptimize(r.getNodes().length>r.get("optimizeThreshold")),r.get("".concat(t,"s")).push(o),r.get("itemMap")[o.get("id")]=o,r.emit("afteradditem",{item:o,model:e}),o},E.prototype.updateItem=function(t,e){var r=this,n,a,i=this.graph;if((0,s.isString)(t)&&(t=i.findById(t)),!(!t||t.destroyed)){var o="";t.getType&&(o=t.getType());var u=i.get(o+Mf),l=t.getModel(),h=l.x,y=l.y,O=t.getUpdateType(e);if(u){var A=(0,s.deepMix)({},l,e),z=u(A),$=(0,s.deepMix)({},l,z,e);z[Co]&&(t.set("styles",$[Co]),delete $[Co]),(0,s.each)($,function(et,yt){e[yt]=et})}else(0,s.each)(e,function(et,yt){l[yt]&&(0,s.isObject)(et)&&!(0,s.isArray)(et)&&(e[yt]=(0,c.__assign)((0,c.__assign)({},l[yt]),e[yt]))});if(i.emit("beforeupdateitem",{item:t,cfg:e}),o===bs){if(e.source){var ae=e.source;(0,s.isString)(ae)&&(ae=i.findById(ae)),t.setSource(ae)}if(e.target){var ce=e.target;(0,s.isString)(ce)&&(ce=i.findById(ce)),t.setTarget(ce)}t.update(e)}else if(o===Hs){t.update(e,O);var ue=t.getEdges();O==="move"?(0,s.each)(ue,function(et){r.edgeToBeUpdateMap[et.getID()]={edge:et,updateType:O},r.throttleRefresh()}):O!=null&&O.includes("bbox")&&(0,s.each)(ue,function(et){et.refresh(O)})}else if(o===ns){if(t.update(e,O),!isNaN(e.x)||!isNaN(e.y)){var ve=e.x-h||0,Ce=e.y-y||0;this.updateComboSucceeds(l.id,ve,Ce)}var Re=t.getEdges(),Ve=(O==null?void 0:O.includes("bbox"))||O==="move";if(Ve&&o===ns){var Ue=t.get("shapeFactory"),$e=l.type||"circle",ot=l.animate===void 0||e.animate===void 0?(a=(n=Ue[$e])===null||n===void 0?void 0:n.options)===null||a===void 0?void 0:a.animate:l.animate||e.animate;ot?setTimeout(function(){if(!(!t||t.destroyed)){var et=t.getKeyShape();!et||et.destroyed||(0,s.each)(Re,function(yt){yt&&!yt.destroyed&&yt.refresh()})}},201):(0,s.each)(Re,function(et){et.refresh()})}}t.setOptimize(i.getNodes().length>i.get("optimizeThreshold")),i.emit("afterupdateitem",{item:t,cfg:e})}},E.prototype.updateCombo=function(t,e,r){var n=this,a,i,o=this.graph;if((0,s.isString)(t)&&(t=o.findById(t)),!(!t||t.destroyed)){var u=t.getModel(),l=ys(e,o,t),h=l.x,y=l.y;t.set("bbox",l);var O=h,A=y;r?(O=isNaN(u.x)?h:u.x,A=isNaN(u.y)?y:u.y):(O=isNaN(h)?u.x:h,A=isNaN(y)?u.y:y),t.update({x:O,y:A});var z=t.get("shapeFactory"),$=u.type||"circle",ae=u.animate===void 0?(i=(a=z[$])===null||a===void 0?void 0:a.options)===null||i===void 0?void 0:i.animate:u.animate;ae?setTimeout(function(){if(!(!t||t.destroyed)){var ce=t.getKeyShape();!ce||ce.destroyed||(t.getShapeCfg(u),n.updateComboEdges(t))}},201):this.updateComboEdges(t)}},E.prototype.updateComboEdges=function(t){for(var e,r,n=t.getEdges()||[],a=0;a-1&&i.splice(o,1),a===bs){var u=r.get("v".concat(a,"s")),l=u.indexOf(t);l>-1&&u.splice(l,1)}var h=t.get("id"),y=r.get("itemMap");delete y[h];var O=r.get("comboTrees"),A=t.get("id");if(a===Hs){var z=t.getModel().comboId;if(O&&z){var $=O,ae=!1;O.forEach(function(Ve){ae||Fa(Ve,function(Ue){if(Ue.id===A&&$){var $e=$.indexOf(Ue);return $.splice($e,1),ae=!0,!1}return $=Ue.children,!0})})}for(var ce=t.getEdges(),ue=ce.length-1;ue>=0;ue--)r.removeItem(ce[ue],!1);z&&r.updateCombo(z)}else if(a===ns){var ve=t.getModel().parentId,Ce,Re=!1;(O||[]).forEach(function(Ue){Re||Fa(Ue,function($e){return $e.id===A?(Ce=$e,Re=!0,!1):!0})}),Ce.removed=!0,Ce&&Ce.children&&Ce.children.forEach(function(Ue){e.removeItem(Ue.id)});for(var ce=t.getEdges(),ue=ce.length;ue>=0;ue--)r.removeItem(ce[ue],!1);ve&&r.updateCombo(ve)}t.destroy(),r.emit("afterremoveitem",{item:n,type:a})}},E.prototype.setItemState=function(t,e,r){var n=this.graph,a=e;(0,s.isString)(r)&&(a="".concat(e,":").concat(r)),!(t.hasState(a)===r&&r||(0,s.isString)(r)&&t.hasState(a))&&(n.emit("beforeitemstatechange",{item:t,state:a,enabled:r}),t.setState(e,r),n.autoPaint(),n.emit("afteritemstatechange",{item:t,state:a,enabled:r}))},E.prototype.priorityState=function(t,e){var r=this.graph,n=t;(0,s.isString)(t)&&(n=r.findById(t)),this.setItemState(n,e,!1),this.setItemState(n,e,!0)},E.prototype.clearItemStates=function(t,e){var r=this.graph;(0,s.isString)(t)&&(t=r.findById(t)),r.emit("beforeitemstatesclear",{item:t,states:e}),t.clearStates(e),r.emit("afteritemstatesclear",{item:t,states:e})},E.prototype.refreshItem=function(t){var e=this.graph;(0,s.isString)(t)&&(t=e.findById(t)),e.emit("beforeitemrefresh",{item:t}),t.refresh(),e.emit("afteritemrefresh",{item:t})},E.prototype.addCombos=function(t,e){var r=this,n=this.graph;(t||[]).forEach(function(i){yo(i,function(o){var u;return e.forEach(function(l){l.id===o.id&&(l.children=o.children,l.depth=o.depth,u=l)}),u&&r.addItem("combo",u),!0})});var a=n.get("comboGroup");a&&a.sort()},E.prototype.changeItemVisibility=function(t,e){var r=this,n=this.graph;if((0,s.isString)(t)&&(t=n.findById(t)),!t){console.warn("The item to be shown or hidden does not exist!");return}if(n.emit("beforeitemvisibilitychange",{item:t,visible:e}),t.changeVisibility(e),t.getType&&t.getType()===Hs){var a=t.getEdges();(0,s.each)(a,function(h){e&&!(h.get("source").isVisible()&&h.get("target").isVisible())||r.changeItemVisibility(h,e)})}else if(t.getType&&t.getType()===ns){var i=n.get("comboTrees"),o=t.get("id"),u=[],l=!1;(i||[]).forEach(function(y){l||!y.children||y.children.length===0||Fa(y,function(O){return O.id===o?(u=O.children,l=!0,!1):!0})}),u&&(!e||e&&!t.getModel().collapsed)&&u.forEach(function(y){var O=n.findById(y.id);r.changeItemVisibility(O,e)});var a=t.getEdges();(0,s.each)(a,function(y){e&&!(y.get("source").isVisible()&&y.get("target").isVisible())||r.changeItemVisibility(y,e)})}return n.emit("afteritemvisibilitychange",{item:t,visible:e}),t},E.prototype.destroy=function(){this.graph=null,this.destroyed=!0},E}(),oc=ic,Es=function(){function E(t){this.graph=t,this.destroyed=!1}return E.prototype.updateState=function(t,e,r){var n=this.graph.get("states"),a=e;(0,s.isString)(r)&&(a="".concat(e,":").concat(r)),n[a]||(n[a]=[]),r?n[a].push(t):n[a]=n[a].filter(function(i){return i!==t}),this.graph.set("states",n),this.graph.emit("graphstatechange",{states:n})},E.prototype.updateStates=function(t,e,r){var n=this.graph.get("states"),a=(0,s.isString)(e)?[e]:e;a.forEach(function(i){var o=i;n[o]||(n[o]=[]),(0,s.isString)(r)&&(o="".concat(i,":").concat(r)),r?n[o].push(t):n[o]=n[o].filter(function(u){return u!==t})}),this.graph.set("states",n),this.graph.emit("graphstatechange",{states:e})},E.prototype.destroy=function(){this.graph=null,this.destroyed=!0},E}(),Cf=Es,mu=F(81182),Ku=function(t,e){return!t||!e?t:t.replace(/\\?\{([^{}]+)\}/g,function(r,n){if(r.charAt(0)==="\\")return r.slice(1);var a=e[n];return a===0&&(a="0"),a||""})},$u=function(t){var e=[];if(t.length<2)throw new Error("point length must largn than 2, now it's ".concat(t.length));for(var r=0,n=t;r0?i-1:e-1,u=Kn.normalize([0,0],Kn.add([0,0],a[o].v,Kn.scale([0,0],a[i].v,-1)));a[i].p=Kn.add([0,0],a[i].p,Kn.scale([0,0],u,t))}return a.map(function(l){var h=l.p;return{x:h[0],y:h[1]}})}var Tf=function(t,e){for(var r=[],n=0;n<5;n++){var a=Math.cos((18+72*n)/180*Math.PI)*t,i=Math.sin((18+72*n)/180*Math.PI)*t,o=Math.cos((54+72*n)/180*Math.PI)*e,u=Math.sin((54+72*n)/180*Math.PI)*e;n===0?r.push(["M",a,-i]):r.push(["L",a,-i]),r.push(["L",o,-u])}return r.push(["Z"]),r},xs=function(t,e,r){return(t.y-r.y)*(e.x-r.x)-(t.x-r.x)*(e.y-r.y)},xu=function(t){var e=t.map(function(y){return{x:y.getModel().x,y:y.getModel().y}});e.sort(function(y,O){return y.x===O.x?y.y-O.y:y.x-O.x});for(var r={},n=e.length-1;n>=0;n--){var a=e[n],i=a.x,o=a.y;r["".concat(i,"-").concat(o)]&&e.splice(n,1),r["".concat(i,"-").concat(o)]=!0}if(e.length===1)return e;for(var u=[],n=0;n=2&&xs(u[u.length-2],u[u.length-1],e[n])<=0;)u.pop();u.push(e[n])}for(var l=[],n=e.length-1;n>=0;n--){for(;l.length>=2&&xs(l[l.length-2],l[l.length-1],e[n])<=0;)l.pop();l.push(e[n])}l.pop(),u.pop();var h=u.concat(l);return h},If={maxRoutingIterations:100,maxMarchingIterations:100,pixelGroupSize:2,edgeR0:10,edgeR1:10,nodeR0:5,nodeR1:10,morphBuffer:5,threshold:.001,skip:16,nodeInfluenceFactor:1,edgeInfluenceFactor:1,negativeNodeInfluenceFactor:-.5};function Af(E,t,e){var r=!1,n=function(u,l){return t.cells[u+l*t.width]},a=function(u,l){var h=0;return n(u-1,l-1)>=e&&(h+=1),n(u,l-1)>e&&(h+=2),n(u-1,l)>e&&(h+=4),n(u,l)>e&&(h+=8),h},i=function(u,l){for(var h=u,y=l,O,A,z=0;z-1){if(!(E[0].x!==h||E[0].y!==y))return!0}else E.push({x:h,y});var $=a(h,y);switch($){case-1:return console.warn("Marched out of bounds"),!0;case 0:case 3:case 2:case 7:h++;break;case 12:case 14:case 4:h--;break;case 6:O===0&&(A===-1?h-=1:h+=1);break;case 1:case 13:case 5:y--;break;case 9:O===1&&(A===0?y-=1:y+=1);break;case 10:case 8:case 11:y++;break;default:return console.warn("Marching squares invalid state: ".concat($)),!0}}};this.march=function(){for(var o=0;oe&&a(o,u)!==15&&(r=i(o,u));return r}}var oo=function(t,e,r){var n=Math.ceil(t/r),a=Math.ceil(e/r),i=new Float32Array(Math.max(0,n*a)).fill(0);return{cells:i,width:n,height:a}},q=function(t,e,r){var n=null,a=Number.POSITIVE_INFINITY;return e.forEach(function(i){var o={x:t.getModel().x,y:t.getModel().y},u={x:i.getModel().x,y:i.getModel().y},l=So(o,u),h=new Ui(o.x,o.y,u.x,u.y),y=r.reduce(function(O,A){return hs(A,h)>0?O+1:O},0);l*Math.pow(y+1,2)=0&&i=1;)Re/=1.5,Ve=jt(z,Re,ae,Ce),Ue=l(Ve,i)||l(Ve,a),$e=h(Ve,e);Ve&&!Ue&&(!Ce||!$e)&&(i.push(new Ui(A.x1,A.y1,Ve.x,Ve.y)),i.push(new Ui(Ve.x,Ve.y,A.x2,A.y2)),o=!0)};ue(!0),o||ue(!1)}}o||a.push(A),u+=1};!o&&i.length;)y()}for(;i.length;)a.push(i.pop());return a};function Pe(E,t,e,r,n){var a=q(E,e,t);if(a===null)return[];var i=function(y){for(var O=[];y.length>0;){var A=y.pop();if(y.length===0){O.push(A);break}var z=y.pop(),$=new Ui(A.x1,A.y1,z.x2,z.y2),ae=de(t,$);ae?(O.push(A),y.push(z)):y.push($)}return O},o=new Ui(E.getModel().x,E.getModel().y,a.getModel().x,a.getModel().y),u=Ee(o,t,r,n),l=i(u);return l}var je=function(t,e,r){var n=Object.assign(If,r),a=Ca(t.map(function(ue){return{x:ue.getModel().x,y:ue.getModel().y}}));t=t.sort(function(ue,ve){return So({x:ue.getModel().x,y:ue.getModel().y},a)-So({x:ve.getModel().x,y:ve.getModel().y},a)});var i=[],o=[];t.forEach(function(ue){var ve=Pe(ue,e,i,n.maxRoutingIterations,n.morphBuffer);ve.forEach(function(Ce){o.push(Ce)}),i.push(ue)});for(var u=bt(t,o,n.nodeR0),l=oo(u.width,u.height,n.pixelGroupSize),h=[],y=[],O=0;O1)for(z=Math.floor(A.length/n.skip);z<3&&n.skip>1;)n.skip-=1,z=Math.floor(A.length/n.skip);for(var $=0,ae=0;ae0)n.nonMemberInfluenceFactor*=.8;else break}return y};function bt(E,t,e){var r={minX:Number.POSITIVE_INFINITY,minY:Number.POSITIVE_INFINITY,maxX:Number.NEGATIVE_INFINITY,maxY:Number.NEGATIVE_INFINITY,width:0,height:0,x:0,y:0},n=[];E.forEach(function(u){n.push(u.getBBox())}),t.forEach(function(u){n.push(u.getBBox())});for(var a=0,i=n;ar.maxX?o.maxX:r.maxX)+e,r.maxY=(o.maxY>r.maxY?o.maxY:r.maxY)+e}return r.width=r.maxX-r.minX,r.height=r.maxY-r.minY,r.x=r.minX,r.y=r.minY,r}function St(E,t,e,r,n,a){function i(A,z){var $=Math.floor((A-z)/a.pixelGroupSize);return $<0?0:$}function o(A,z){return A*a.pixelGroupSize+z}var u=(a.nodeR0-a.nodeR1)*(a.nodeR0-a.nodeR1),l=(a.edgeR0-a.edgeR1)*(a.edgeR0-a.edgeR1),h=function(z,$){var ae=Math.min(i(z.minX,$+r.minX),n.width),ce=Math.min(i(z.minY,$+r.minY),n.height),ue=Math.min(i(z.maxX,-$+r.minX),n.width),ve=Math.min(i(z.maxY,-$+r.minY),n.height);return[ae,ce,ue,ve]},y=function(z,$){for(var ae=z.getBBox(),ce=h(ae,a.nodeR1),ue=ce[0],ve=ce[1],Ce=ce[2],Re=ce[3],Ve=ve;Veu.y?r?l.topLeft:l.bottomRight:r?l.topRight:l.bottomLeft:i.yo.x?r?l.topLeft:l.bottomRight:r?l.bottomLeft:l.topRight:a.x0?this.cfg.padding+t:10+t,this.cfg.bubbleCfg={nodeR0:this.padding-t,nodeR1:this.padding-t,morphBuffer:this.padding-t}},E.prototype.setType=function(){this.type=this.cfg.type,this.members.length<3&&(this.type="round-convex"),this.type!=="round-convex"&&this.type!=="smooth-convex"&&this.type!=="bubble"&&(console.warn("The hull type should be either round-convex, smooth-convex or bubble, round-convex is used by default."),this.type="round-convex")},E.prototype.calcPath=function(t,e){var r,n,a;switch(this.type){case"round-convex":r=xu(t),a=Ks(r.map(function(i){return[i.x,i.y]}),this.padding),n=(0,mu.tr)(a);break;case"smooth-convex":r=xu(t),r.length===2?(a=Ks(r.map(function(i){return[i.x,i.y]}),this.padding),n=(0,mu.tr)(a)):r.length>2&&(a=Go(r.map(function(i){return[i.x,i.y]}),this.padding),n=Qr(a));break;case"bubble":r=je(t,e,this.cfg.bubbleCfg),n=r.length>=2&&Qr(r);break;default:}return n},E.prototype.render=function(){this.group.addShape("path",{attrs:(0,c.__assign)({path:this.path},this.cfg.style),id:this.id,name:this.cfg.id,capture:!1}),this.group.toBack()},E.prototype.addMember=function(t){if(t){(0,s.isString)(t)&&(t=this.graph.findById(t)),this.members.push(t);var e=this.nonMembers.indexOf(t);return e>-1&&this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},E.prototype.addNonMember=function(t){if(t){(0,s.isString)(t)&&(t=this.graph.findById(t)),this.nonMembers.push(t);var e=this.members.indexOf(t);return e>-1&&this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0}},E.prototype.removeMember=function(t){if(t){(0,s.isString)(t)&&(t=this.graph.findById(t));var e=this.members.indexOf(t);return e>-1?(this.members.splice(e,1),this.updateData(this.members,this.nonMembers),!0):!1}},E.prototype.removeNonMember=function(t){if(t){(0,s.isString)(t)&&(t=this.graph.findById(t));var e=this.nonMembers.indexOf(t);return e>-1?(this.nonMembers.splice(e,1),this.updateData(this.members,this.nonMembers),!0):!1}},E.prototype.updateData=function(t,e){var r=this;this.group.findById(this.id).remove(),t&&(this.members=t.map(function(n){return(0,s.isString)(n)?r.graph.findById(n):n})),e&&(this.nonMembers=e.map(function(n){return(0,s.isString)(n)?r.graph.findById(n):n})),this.path=this.calcPath(this.members,this.nonMembers),this.render()},E.prototype.updateStyle=function(t){var e=this.group.findById(this.id);e.attr((0,c.__assign)({},t))},E.prototype.updateCfg=function(t){var e=this;this.cfg=(0,s.deepMix)(this.cfg,t),this.id=this.cfg.id,this.group=this.cfg.group,t.members&&(this.members=this.cfg.members.map(function(r){return(0,s.isString)(r)?e.graph.findById(r):r})),t.nonMembers&&(this.nonMembers=this.cfg.nonMembers.map(function(r){return(0,s.isString)(r)?e.graph.findById(r):r})),this.setPadding(),this.setType(),this.path=this.calcPath(this.members,this.nonMembers),this.render()},E.prototype.contain=function(t){var e=this,r;(0,s.isString)(t)?r=this.graph.findById(t):r=t;var n,a=r.getKeyShape();if(r.get("type")==="path")n=Eu(a.attr("path"));else{var i=a.getCanvasBBox();n=[[i.minX,i.minY],[i.maxX,i.minY],[i.maxX,i.maxY],[i.minX,i.maxY]]}return n=n.map(function(o){var u=e.graph.getPointByCanvas(o[0],o[1]);return[u.x,u.y]}),Zo(n,Eu(this.path))},E.prototype.destroy=function(){this.group.remove(),this.cfg=null},E}(),xr=vr,$r=Q.vs,an="node",tn=function(E){(0,c.__extends)(t,E);function t(e){var r=E.call(this)||this;return r.sortCombos=(0,s.debounce)(function(){var n=r.get("comboSorted");if(!(!r||r.destroyed||n)){r.set("comboSorted",!0);var a=[],i={},o=r.get("comboTrees");(o||[]).forEach(function(l){Fa(l,function(h){return a[h.depth]?a[h.depth].push(h.id):a[h.depth]=[h.id],i[h.id]=h.depth,!0})});var u=r.getEdges().concat(r.get("vedges"));(u||[]).forEach(function(l){var h=l.getModel(),y=i[h.source]||0,O=i[h.target]||0,A=Math.max(y,O);a[A]?a[A].push(h.id):a[A]=[h.id]}),a.forEach(function(l){if(!(!l||!l.length))for(var h=l.length-1;h>=0;h--){var y=r.findById(l[h]);y&&y.toFront()}})}},500,!1),r.cfg=(0,s.deepMix)(r.getDefaultCfg(),e),r.init(),r.animating=!1,r.destroyed=!1,r.cfg.enabledStack&&(r.undoStack=new ya(r.cfg.maxStep),r.redoStack=new ya(r.cfg.maxStep)),r}return t.prototype.init=function(){this.initCanvas();var e=new pf(this),r=new Bs(this),n=new oc(this),a=new Cf(this);this.set({viewController:e,modeController:r,itemController:n,stateController:a}),this.initLayoutController(),this.initEventController(),this.initGroups(),this.initPlugins()},t.prototype.initGroups=function(){var e=this.get("canvas");if(e){var r=e.get("el"),n=(r||{}).id,a=n===void 0?"g6":n,i=e.addGroup({id:"".concat(a,"-root"),className:dn.rootContainerClassName});if(this.get("groupByTypes")){var o=i.addGroup({id:"".concat(a,"-edge"),className:dn.edgeContainerClassName}),u=i.addGroup({id:"".concat(a,"-node"),className:dn.nodeContainerClassName}),l=i.addGroup({id:"".concat(a,"-combo"),className:dn.comboContainerClassName});l.toBack(),this.set({nodeGroup:u,edgeGroup:o,comboGroup:l})}var h=i.addGroup({id:"".concat(a,"-delegate"),className:dn.delegateContainerClassName});this.set({delegateGroup:h}),this.set("group",i)}},t.prototype.getDefaultCfg=function(){return{container:void 0,width:void 0,height:void 0,renderer:"canvas",modes:{},plugins:[],data:{},fitViewPadding:10,minZoom:.02,maxZoom:10,event:!0,groupByTypes:!0,directed:!1,autoPaint:!0,nodes:[],edges:[],combos:[],vedges:[],itemMap:{},linkCenter:!1,defaultNode:{},defaultEdge:{},nodeStateStyles:{},edgeStateStyles:{},states:{},animate:!1,animateCfg:{onFrame:void 0,duration:500,easing:"easeLinear"},callback:void 0,enabledStack:!1,maxStep:10,tooltips:[],optimizeThreshold:1e3}},t.prototype.set=function(e,r){return(0,s.isPlainObject)(e)?this.cfg=(0,c.__assign)((0,c.__assign)({},this.cfg),e):this.cfg[e]=r,e==="enabledStack"&&r&&!this.undoStack&&!this.redoStack&&(this.undoStack=new ya(this.cfg.maxStep),this.redoStack=new ya(this.cfg.maxStep)),this},t.prototype.get=function(e){var r;return(r=this.cfg)===null||r===void 0?void 0:r[e]},t.prototype.getGroup=function(){return this.get("group")},t.prototype.getContainer=function(){return this.get("container")},t.prototype.getMinZoom=function(){return this.get("minZoom")},t.prototype.setMinZoom=function(e){return this.set("minZoom",e)},t.prototype.getMaxZoom=function(){return this.get("maxZoom")},t.prototype.setMaxZoom=function(e){return this.set("maxZoom",e)},t.prototype.getWidth=function(){return this.get("width")},t.prototype.getHeight=function(){return this.get("height")},t.prototype.clearItemStates=function(e,r){(0,s.isString)(e)&&(e=this.findById(e));var n=this.get("itemController");r||(r=e.get("states")),n.clearItemStates(e,r);var a=this.get("stateController");a.updateStates(e,r,!1)},t.prototype.node=function(e){typeof e=="function"&&this.set("nodeMapper",e)},t.prototype.edge=function(e){typeof e=="function"&&this.set("edgeMapper",e)},t.prototype.combo=function(e){typeof e=="function"&&this.set("comboMapper",e)},t.prototype.findById=function(e){return this.get("itemMap")[e]},t.prototype.find=function(e,r){var n,a=this.get("".concat(e,"s"));return(0,s.each)(a,function(i,o){if(r(i,o))return n=i,n}),n},t.prototype.findAll=function(e,r){var n=[];return(0,s.each)(this.get("".concat(e,"s")),function(a,i){r(a,i)&&n.push(a)}),n},t.prototype.findAllByState=function(e,r,n){return n?this.findAll(e,function(a){return a.hasState(r)&&n(a)}):this.findAll(e,function(a){return a.hasState(r)})},t.prototype.translate=function(e,r,n,a){var i=this,o=this.get("group"),u=(0,s.clone)(o.getMatrix());if(u||(u=[1,0,0,0,1,0,0,0,1]),n){var l=ko({animateCfg:a,callback:function(){return i.emit("viewportchange",{action:"translate",matrix:o.getMatrix()})}});ri(o,{x:o.getCanvasBBox().x+e,y:o.getCanvasBBox().y+r},n,l||{duration:500,easing:"easeCubic"})}else u=$r(u,[["t",e,r]]),o.setMatrix(u),this.emit("viewportchange",{action:"translate",matrix:u}),this.autoPaint()},t.prototype.moveTo=function(e,r,n,a){var i=this.get("group");ri(i,{x:e,y:r},n,a||{duration:500,easing:"easeCubic"}),this.emit("viewportchange",{action:"move",matrix:i.getMatrix()})},t.prototype.fitView=function(e,r,n,a){e&&this.set("fitViewPadding",e);var i=this.get("viewController");r?i.fitViewByRules(r,n,a):i.fitView(n,a),this.autoPaint()},t.prototype.fitCenter=function(e,r){var n=this.get("viewController");n.fitCenter(e,r),this.autoPaint()},t.prototype.addBehaviors=function(e,r){var n=this.get("modeController");return n.manipulateBehaviors(e,r,!0),this},t.prototype.removeBehaviors=function(e,r){var n=this.get("modeController");return n.manipulateBehaviors(e,r,!1),this},t.prototype.updateBehavior=function(e,r,n){var a=this.get("modeController");return a.updateBehavior(e,r,n),this},t.prototype.zoom=function(e,r,n,a){var i=this,o=this.get("group"),u=(0,s.clone)(o.getMatrix())||[1,0,0,0,1,0,0,0,1],l=this.get("minZoom"),h=this.get("maxZoom"),y=this.getZoom()||1,O=y*e,A=e,z=!1;if(l&&Oh&&(A=h/y,z=!0),r?u=$r(u,[["t",-r.x,-r.y],["s",A,A],["t",r.x,r.y]]):u=$r(u,[["s",A,A]]),n){var $=(0,s.clone)(o.getMatrix());$||($=[1,0,0,0,1,0,0,0,1]);var ae=$[0],ce=ae*A,ue=ko({animateCfg:a,callback:function(){return i.emit("viewportchange",{action:"zoom",matrix:o.getMatrix()})}});o.animate(function(ve){if(ve===1)$=u;else{var Ce=hi(ae,ce,ve)/$[0];r?$=$r($,[["t",-r.x,-r.y],["s",Ce,Ce],["t",r.x,r.y]]):$=$r($,[["s",Ce,Ce]])}return{matrix:$}},ue)}else o.setMatrix(u),this.emit("viewportchange",{action:"zoom",matrix:u}),this.autoPaint();return!z},t.prototype.zoomTo=function(e,r,n,a){var i=e/this.getZoom();return this.zoom(i,r,n,a)},t.prototype.focusItem=function(e,r,n){var a=this.get("viewController"),i=!1;r?i=!0:r===void 0&&(i=this.get("animate"));var o={};n?o=n:n===void 0&&(o=this.get("animateCfg")),a.focus(e,i,o),this.autoPaint()},t.prototype.focusItems=function(e,r,n,a){var i=this.get("viewController");i.focusItems(e,r,n,a)},t.prototype.autoPaint=function(){this.get("autoPaint")&&this.paint()},t.prototype.paint=function(){this.emit("beforepaint"),this.get("canvas").draw(),this.emit("afterpaint")},t.prototype.getPointByClient=function(e,r){var n=this.get("viewController");return n.getPointByClient(e,r)},t.prototype.getClientByPoint=function(e,r){var n=this.get("viewController");return n.getClientByPoint(e,r)},t.prototype.getPointByCanvas=function(e,r){var n=this.get("viewController");return n.getPointByCanvas(e,r)},t.prototype.getCanvasByPoint=function(e,r){var n=this.get("viewController");return n.getCanvasByPoint(e,r)},t.prototype.getGraphCenterPoint=function(){var e=this.get("group").getCanvasBBox();return{x:(e.minX+e.maxX)/2,y:(e.minY+e.maxY)/2}},t.prototype.getViewPortCenterPoint=function(){return this.getPointByCanvas(this.get("width")/2,this.get("height")/2)},t.prototype.showItem=function(e,r){r===void 0&&(r=!0);var n=this.get("itemController"),a=n.changeItemVisibility(e,!0);if(r&&this.get("enabledStack")){var i=a.getID(),o=a.getType(),u={},l={};switch(o){case"node":u.nodes=[{id:i,visible:!1}],l.nodes=[{id:i,visible:!0}];break;case"edge":u.nodes=[{id:i,visible:!1}],l.edges=[{id:i,visible:!0}];break;case"combo":u.nodes=[{id:i,visible:!1}],l.combos=[{id:i,visible:!0}];break;default:break}this.pushStack("visible",{before:u,after:l})}},t.prototype.hideItem=function(e,r){r===void 0&&(r=!0);var n=this.get("itemController"),a=n.changeItemVisibility(e,!1);if(r&&this.get("enabledStack")){var i=a.getID(),o=a.getType(),u={},l={};switch(o){case"node":u.nodes=[{id:i,visible:!0}],l.nodes=[{id:i,visible:!1}];break;case"edge":u.nodes=[{id:i,visible:!0}],l.edges=[{id:i,visible:!1}];break;case"combo":u.nodes=[{id:i,visible:!0}],l.combos=[{id:i,visible:!1}];break;default:break}this.pushStack("visible",{before:u,after:l})}},t.prototype.refreshItem=function(e){var r=this.get("itemController");r.refreshItem(e)},t.prototype.setAutoPaint=function(e){var r=this;r.set("autoPaint",e);var n=r.get("canvas");n.set("autoDraw",e)},t.prototype.remove=function(e,r){r===void 0&&(r=!0),this.removeItem(e,r)},t.prototype.removeItem=function(e,r){r===void 0&&(r=!0);var n=e;if((0,s.isString)(e)&&(n=this.findById(e)),!n&&(0,s.isString)(e))console.warn("The item ".concat(e," to be removed does not exist!"));else if(n){var a="";if(n.getType&&(a=n.getType()),r&&this.get("enabledStack")){var i=(0,c.__assign)((0,c.__assign)({},n.getModel()),{itemType:a}),o={};switch(a){case"node":{o.nodes=[i],o.edges=[];for(var u=n.getEdges(),l=u.length-1;l>=0;l--)o.edges.push((0,c.__assign)((0,c.__assign)({},u[l].getModel()),{itemType:"edge"}));break}case"edge":o.edges=[i];break;case"combo":o.combos=[i];break;default:break}this.pushStack("delete",{before:o,after:{}})}if(a==="node"){var h=n.getModel();h.comboId&&this.updateComboTree(n,void 0,!1)}var y=this.get("itemController");if(y.removeItem(n),a==="combo"){var O=ps(this.get("comboTrees"));this.set("comboTrees",O)}}},t.prototype.innerAddItem=function(e,r,n){if(!zu(e,r))return!1;if(r.id&&this.findById(r.id)){console.warn("This item exists already. Be sure the id %c".concat(r.id,"%c is unique."),"font-size: 20px; color: red;","");return}var a,i=this.get("comboTrees")||[];if(e==="combo"){var o=this.get("itemMap"),u=!1;if(i.forEach(function(z){u||yo(z,function($){if(r.parentId===$.id){u=!0;var ae=(0,c.__assign)({id:r.id,depth:$.depth+2},r);$.children?$.children.push(ae):$.children=[ae],r.depth=ae.depth,a=n.addItem(e,r)}var ce=o[$.id];return u&&ce&&ce.getType&&ce.getType()==="combo"&&n.updateCombo(ce,$.children),!0})}),!u){var l=(0,c.__assign)({id:r.id,depth:0},r);r.depth=l.depth,i.push(l),a=n.addItem(e,r)}this.set("comboTrees",i),r.collapsed&&(this.collapseCombo(a,!1),this.updateCombo(a))}else if(e==="node"&&(0,s.isString)(r.comboId)&&i){var h=this.findById(r.comboId);h&&h.getType&&h.getType()!=="combo"&&console.warn("'".concat(r.comboId,"' is not a id of a combo in the graph, the node will be added without combo.")),a=n.addItem(e,r);var y=this.get("itemMap"),O=!1,A=!1;i.forEach(function(z){A||O||yo(z,function($){if($.id===r.id)return A=!0,!1;if(r.comboId===$.id&&!A){O=!0;var ae=(0,s.clone)(r);ae.itemType="node",$.children?$.children.push(ae):$.children=[ae],ae.depth=$.depth+1}return O&&y[$.id].getType&&y[$.id].getType()==="combo"&&n.updateCombo(y[$.id],$.children),!0})})}else a=n.addItem(e,r);if(e==="node"&&r.comboId||e==="combo"&&r.parentId){var h=this.findById(r.comboId||r.parentId);h&&h.getType&&h.getType()==="combo"&&h.addChild(a)}return a},t.prototype.addItem=function(e,r,n,a){n===void 0&&(n=!0),a===void 0&&(a=!0);var i=this.get("comboSorted");this.set("comboSorted",i&&!a);var o=this.get("itemController"),u=this.innerAddItem(e,r,o);if(u===!1||u===!0)return u;var l=this.get("combos");if(l&&l.length>0&&this.sortCombos(),this.autoPaint(),n&&this.get("enabledStack")){var h=(0,c.__assign)((0,c.__assign)({},u.getModel()),{itemType:e}),y={};switch(e){case"node":y.nodes=[h];break;case"edge":y.edges=[h];break;case"combo":y.combos=[h];break;default:break}this.pushStack("add",{before:{},after:y})}return u},t.prototype.addItems=function(e,r,n){e===void 0&&(e=[]),r===void 0&&(r=!0),n===void 0&&(n=!0);var a=this.get("comboSorted");this.set("comboSorted",a&&!n);for(var i=this.get("itemController"),o=[],u=0;u0&&this.sortCombos()}if(this.autoPaint(),r&&this.get("enabledStack")){for(var y={nodes:[],edges:[],combos:[]},u=0;u=0;ae--)z[ae].destroyed&&z.splice(ae,1);O&&(i.addCombos(O),this.get("groupByTypes")||this.sortCombos()),this.diffItems("edge",y,o.edges),(0,s.each)(h,function(Ce,Re){Ce.getType&&(Ce.getType()==="node"||Ce.getType()==="combo")||y.edges.indexOf(Ce)<0&&(delete h[Re],i.remove(Ce,!1))}),(this.get("comboTrees")||[]).forEach(function(Ce){yo(Ce,function(Re){var Ve=n.findById(Re.id);return Ve.getType()==="combo"&&Re.collapsed&&n.collapseCombo(Re.id,!1),!0})}),this.set({nodes:y.nodes,edges:y.edges});var ce=(this.get("layout")||{}).relayoutAtChangeData,ue=ce===void 0?!0:ce,ve=this.get("layoutController");return ue&&ve&&(ve.changeData(function(){setTimeout(function(){var Ce;(Ce=i.getCombos())===null||Ce===void 0||Ce.forEach(function(Re){Re.set("animate",!0)})},0)}),i.get("animate")&&!ve.getLayoutType()?(i.positionsAnimate(),(a=i.getCombos())===null||a===void 0||a.forEach(function(Ce){return Ce.set("animate",!0)})):i.autoPaint()),setTimeout(function(){u.set("localRefresh",l)},16),this.set("data",o),this.emit("afterchangedata"),this},t.prototype.addCombos=function(e){var r=this,n=r.get("comboTrees"),a=this.get("itemController");a.addCombos(n,e)},t.prototype.createCombo=function(e,r,n){var a=this;n===void 0&&(n=!0);var i=this.get("itemController");this.set("comboSorted",!1);var o="",u;if(e){if((0,s.isString)(e))o=e,u={id:e};else{if(o=e.id,!o){console.warn("Create combo failed. Please assign a unique string id for the adding combo.");return}u=e}var l=n&&this.get("enabledStack"),h={nodes:[],combos:[]};l&&r.forEach(function(ce){var ue=a.findById(ce),ve=ue.getType();if(!(ve!=="node"&&ve!=="combo")){var Ce=ue.getModel();h["".concat(ve,"s")].push({id:ce,parentId:ve==="node"?Ce.comboId:Ce.parentId})}});var y=this.get("comboTrees"),O=new Set(r),A=new Map;y&&(y.forEach(function(ce){yo(ce,function(ue,ve,Ce){if(O.has(ue.id)){if(ve){var Re=a.findById(ve.id),Ve=a.findById(ue.id);ve.children.splice(Ce,1),Re.removeChild(Ve),i.updateCombo(Re,ve.children)}ue.itemType==="combo"&&A.set(ue.id,ue)}return!0})}),y=y.filter(function(ce){return!O.has(ce.id)}),this.set("comboTrees",y));var z={nodes:[],combos:[]},$=r.map(function(ce){var ue=a.findById(ce),ve=ue.getModel(),Ce="";ue.getType&&(Ce=ue.getType());var Re=A.get(ce)||{id:ue.getID(),itemType:Ce};return Ce==="combo"?(Re.parentId=o,ve.parentId=o):Ce==="node"&&(Re.comboId=o,ve.comboId=o),l&&z["".concat(Ce,"s")].push({id:ve.id,parentId:o}),Re});u.children=$,this.addItem("combo",u,!1),this.set("comboSorted",!1),y&&(y.forEach(function(ce){Fa(ce,function(ue){return ue.id===o?(ue.itemType="combo",ue.children=$,!1):!0})}),this.sortCombos()),l&&(z.combos.push(u),this.pushStack("createCombo",{before:h,after:z}));var ae=this.findById(o);!ae.getModel().parentId&&ae.getChildren().combos.length&&this.updateComboTree(ae,void 0,!1),setTimeout(function(){ae.set("animate",!0)},0)}},t.prototype.uncombo=function(e,r){var n=this,a,i;r===void 0&&(r=!0);var o=this,u=e;if((0,s.isString)(e)&&(u=this.findById(e)),!u||u.getType&&u.getType()!=="combo"){console.warn("The item is not a combo!");return}var l=u.getModel(),h=u.getModel().parentId,y=o.get("comboTrees");y||(y=[]);var O=this.get("itemMap"),A=u.get("id"),z,$=[],ae=this.get("combos"),ce=this.findById(h),ue=r&&this.get("enabledStack"),ve={};if(ue&&(ve=(0,s.clone)(l),ve.children=[]),y.forEach(function(Ue){z||yo(Ue,function($e){var ot;if($e.id===A){z=$e;var et=u.getEdges().map(function(yr){return yr.getID()});et.forEach(function(yr){n.removeItem(yr,!1)});var yt=ae.indexOf(u);ae.splice(yt,1),delete O[A];var Gt=(0,s.clone)(u.getModel());u.destroy(),n.emit("afterremoveitem",{item:Gt,type:"combo"})}if(h&&z&&$e.id===h){ce.removeCombo(u),$=$e.children;var yt=$.indexOf(z);return yt!==-1&&$.splice(yt,1),(ot=z.children)===null||ot===void 0||ot.forEach(function(kr){var Mr=n.findById(kr.id),dr=Mr.getModel();Mr.getType&&Mr.getType()==="combo"?(kr.parentId=h,delete kr.comboId,dr.parentId=h,delete dr.comboId):Mr.getType&&Mr.getType()==="node"&&(kr.comboId=h,dr.comboId=h),ce.addChild(Mr),$.push(kr)}),n.updateCombo(ce),!1}return!0})}),!h&&z){var Ce=y.indexOf(z);y.splice(Ce,1),(a=z.children)===null||a===void 0||a.forEach(function(Ue){Ue.parentId=void 0;var $e=n.findById(Ue.id).getModel();delete $e.parentId,delete $e.comboId,Ue.itemType!=="node"&&y.push(Ue)})}if(ue){var Re={nodes:[],combos:[]},Ve={nodes:[],combos:[]};(i=z.children)===null||i===void 0||i.forEach(function(Ue){var $e=n.findById(Ue.id),ot=$e.getType();ot!=="node"&&ot!=="combo"||(Re["".concat(ot,"s")].push({id:Ue.id,parentId:A}),Ve["".concat(ot,"s")].push({id:Ue.id,parentId:h}))}),Re.combos.push(ve),this.pushStack("uncombo",{before:Re,after:Ve})}},t.prototype.updateCombos=function(e){var r=this;e===void 0&&(e=!1);var n=this,a=this.get("comboTrees"),i=n.get("itemController"),o=n.get("itemMap");(a||[]).forEach(function(u){yo(u,function(l){var h;if(!l)return!0;var y=o[l.id];if(((h=y==null?void 0:y.getType)===null||h===void 0?void 0:h.call(y))==="combo"){var O=(0,c.__spreadArray)([],y.getStates(),!0);(0,s.each)(O,function(A){return r.setItemState(y,A,!1)}),i.updateCombo(y,l.children,e),(0,s.each)(O,function(A){return r.setItemState(y,A,!0)})}return!0})}),n.sortCombos()},t.prototype.updateCombo=function(e){var r=this,n=this,a=e,i;if((0,s.isString)(e)&&(a=this.findById(e)),!a||a.getType&&a.getType()!=="combo"){console.warn("The item to be updated is not a combo!");return}i=a.get("id");var o=this.get("comboTrees"),u=n.get("itemController"),l=n.get("itemMap");(o||[]).forEach(function(h){yo(h,function(y){if(!y)return!0;var O=l[y.id];if(i===y.id&&O&&O.getType&&O.getType()==="combo"){var A=(0,c.__spreadArray)([],O.getStates(),!0);(0,s.each)(A,function(z){O.getStateStyle(z)&&r.setItemState(O,z,!1)}),u.updateCombo(O,y.children),(0,s.each)(A,function(z){O.getStateStyle(z)&&r.setItemState(O,z,!0)}),i&&(i=y.parentId)}return!0})})},t.prototype.updateComboTree=function(e,r,n){n===void 0&&(n=!0);var a=this;this.set("comboSorted",!1);var i;(0,s.isString)(e)?i=a.findById(e):i=e;var o=i.getModel(),u=o.comboId||o.parentId,l="";if(i.getType&&(l=i.getType()),r&&l==="combo"){var h=this.get("comboTrees"),y=!0,O;if((h||[]).forEach(function(ue){O||Fa(ue,function(ve){if(!O)return ve.id===i.getID()&&(O=ve),!0})}),Fa(O,function(ue){return ue.id===r?(y=!1,!1):!0}),!y){console.warn("Failed to update the combo tree! The parentId points to a descendant of the combo!");return}}if(n&&this.get("enabledStack")){var A={},z={};l==="combo"?(A.combos=[{id:o.id,parentId:o.parentId}],z.combos=[{id:o.id,parentId:r}]):l==="node"&&(A.nodes=[{id:o.id,parentId:o.comboId}],z.nodes=[{id:o.id,parentId:r}]),this.pushStack("updateComboTree",{before:A,after:z})}if(o.parentId||o.comboId){var $=this.findById(o.parentId||o.comboId);$&&$.removeChild(i)}if(l==="combo"?o.parentId=r:l==="node"&&(o.comboId=r),r){var ae=this.findById(r);ae&&ae.addChild(i)}if(u){var ae=this.findById(u);ae&&ae.removeChild(i)}var ce=ps(this.get("comboTrees"),o.id,r);this.set("comboTrees",ce),this.updateCombos()},t.prototype.save=function(){var e=[],r=[],n=[];return(0,s.each)(this.get("nodes"),function(a){e.push(a.getModel())}),(0,s.each)(this.get("edges"),function(a){r.push(a.getModel())}),(0,s.each)(this.get("combos"),function(a){n.push(a.getModel())}),{nodes:e,edges:r,combos:n}},t.prototype.changeSize=function(e,r){var n=this.get("viewController");return n.changeSize(e,r),this},t.prototype.refresh=function(){var e=this;if(e.emit("beforegraphrefresh"),e.get("animate"))e.positionsAnimate();else{var r=e.get("nodes"),n=e.get("edges"),a=e.get("edges");(0,s.each)(r,function(i){i.refresh()}),(0,s.each)(n,function(i){i.refresh()}),(0,s.each)(a,function(i){i.refresh()})}e.emit("aftergraphrefresh"),e.autoPaint()},t.prototype.getNodes=function(){return this.get("nodes")},t.prototype.getEdges=function(){return this.get("edges")},t.prototype.getCombos=function(){return this.get("combos")},t.prototype.getComboChildren=function(e){if((0,s.isString)(e)&&(e=this.findById(e)),!e||e.getType&&e.getType()!=="combo"){console.warn("The combo does not exist!");return}return e.getChildren()},t.prototype.positionsAnimate=function(e){var r=this;r.emit("beforeanimate");var n=r.get("animateCfg"),a=n.onFrame,i=e?r.getNodes().concat(r.getCombos()):r.getNodes(),o=i.map(function(l){var h=l.getModel();return{id:h.id,x:h.x,y:h.y}});r.stopAnimate();var u=r.get("canvas");r.animating=!0,setTimeout(function(){u.animate(function(l){(0,s.each)(o,function(h){var y=r.findById(h.id);if(!(!y||y.destroyed)){var O=y.get("originAttrs"),A=y.get("model"),z=y.getContainer().getMatrix();if(O==null&&(z&&(O={x:z[6],y:z[7]}),y.set("originAttrs",O||0)),a){var $=a(y,l,h,O||{x:0,y:0});y.set("model",Object.assign(A,$))}else O?(A.x=O.x+(h.x-O.x)*l,A.y=O.y+(h.y-O.y)*l):(A.x=h.x,A.y=h.y)}}),r.refreshPositions(e)},{duration:n.duration,easing:n.easing,callback:function(){(0,s.each)(i,function(h){h.set("originAttrs",null)}),n.callback&&n.callback(),r.emit("afteranimate"),r.animating=!1}})},0)},t.prototype.refreshPositions=function(e){var r=this;r.emit("beforegraphrefreshposition");var n=r.get("nodes"),a=r.get("edges"),i=r.get("vedges"),o=r.get("combos"),u,l={},h=function(O){(0,s.each)(O,function(A){u=A.getModel();var z=A.get("originAttrs");if(!(z&&u.x===z.x&&u.y===z.y)){var $=A.updatePosition({x:u.x,y:u.y});l[u.id]=$,u.comboId&&(l[u.comboId]=l[u.comboId]||$),u.parentId&&(l[u.parentId]=l[u.parentId]||$)}})};h(o),h(n),o&&o.length!==0&&(e&&h(o),r.updateCombos()),(0,s.each)(a,function(y){var O=y.getSource().getModel(),A=y.getTarget();if(!(0,s.isPlainObject)(A)){var z=A.getModel();(l[O.id]||l[z.id]||y.getModel().isComboEdge)&&y.refresh()}}),(0,s.each)(i,function(y){y.refresh()}),r.emit("aftergraphrefreshposition"),r.autoPaint()},t.prototype.stopAnimate=function(){var e=this.get("canvas"),r=e.cfg.timeline;r&&r.stopAllAnimations()},t.prototype.isAnimating=function(){return this.animating},t.prototype.getZoom=function(){var e=this.get("group").getMatrix();return e?e[0]:1},t.prototype.getCurrentMode=function(){var e=this.get("modeController");return e.getMode()},t.prototype.setMode=function(e){var r=this.get("modeController");return r.setMode(e),this},t.prototype.clear=function(e){var r;return e===void 0&&(e=!1),(r=this.get("canvas"))===null||r===void 0||r.clear(),this.initGroups(),this.set({itemMap:{},nodes:[],edges:[],vedges:[],groups:[],combos:[],comboTrees:[]}),e||this.emit("afterrender"),this},t.prototype.updateLayout=function(e,r,n,a){var i=this;e===void 0&&(e={}),a===void 0&&(a=!0);var o=this.get("layoutController");if((0,s.isString)(e)&&(e={type:e}),r){var u=n;u||(r==="begin"?u={x:0,y:0}:u={x:this.getWidth()/2,y:this.getHeight()/2}),u=this.getPointByCanvas(u.x,u.y);var l=["force","gForce","fruchterman","force2"];l.includes(e.type)||!e.type&&l.includes(o==null?void 0:o.layoutType)?e.center=[u.x,u.y]:this.once("afterlayout",function(O){var A=i.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];u.x=u.x*A[0]+A[6],u.y=u.y*A[0]+A[7];var z=i.getGroup().getCanvasBBox(),$=z.minX,ae=z.maxX,ce=z.minY,ue=z.maxY,ve={x:($+ae)/2,y:(ce+ue)/2};r==="begin"&&(ve.x=$,ve.y=ce),i.translate(u.x-ve.x,u.y-ve.y)})}var h=(0,c.__assign)({},this.get("layout")),y={};Object.assign(y,h,e),e.pipes&&!e.type?delete y.type:!e.pipes&&y.type&&delete y.pipes,this.set("layout",y),o&&(o.isLayoutTypeSame(y)&&y.gpuEnabled===h.gpuEnabled?o.updateLayoutCfg(y):o.changeLayout(y),a&&this.get("enabledStack")&&this.pushStack("layout",{before:h,after:y}))},t.prototype.destroyLayout=function(){var e=this.get("layoutController");e==null||e.destroyLayout()},t.prototype.layout=function(){var e,r=this.get("layoutController"),n=this.get("layout");if(!(!n||!r)){if(n.workerEnabled){r.layout();return}!((e=r.layoutMethods)===null||e===void 0)&&e.length?r.relayout(!0):r.layout()}},t.prototype.collapseCombo=function(e,r){var n=this;if(r===void 0&&(r=!0),!this.destroyed){if((0,s.isString)(e)&&(e=this.findById(e)),!e){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"collapse",item:e});var a=e.getModel(),i=this.get("itemController");i.collapseCombo(e,r),a.collapsed=!0;var o=this.getEdges().concat(this.get("vedges")),u=[],l=this.get("comboTrees"),h=!1;(l||[]).forEach(function(O){h||Fa(O,function(A){if(h&&A.depth<=a.depth)return!1;if(a.id===A.id&&(h=!0),h){var z=n.findById(A.id);z&&z.getType&&z.getType()==="combo"&&(u=u.concat(z.getNodes()),u=u.concat(z.getCombos()))}return!0})});var y={};o.forEach(function(O){var A=O.getModel(),z=A.isVEdge,$=A.size,ae=$===void 0?1:$;if(!(O.isVisible()&&!z)){var ce=O.getSource(),ue=O.getTarget(),ve=null,Ce;if(ce.getModel().id===a.id||u.includes(ce)&&!u.includes(ue)?(ve=ue,Ce=!1):(ue.getModel().id===a.id||!u.includes(ce)&&u.includes(ue))&&(ve=ce,Ce=!0),ve){if(z){n.removeItem(O,!1);return}for(var Re=ve.getModel();!ve.isVisible();){var Ve=Re.parentId,Ue=Re.comboId,$e=Ve||Ue;if(ve=n.findById($e),!ve||!$e)return;Re=ve.getModel()}var ot=Re.id,et=Ce?{source:ot,target:a.id,size:ae,isVEdge:!0}:{source:a.id,target:ot,size:ae,isVEdge:!0},yt="".concat(et.source,"-").concat(et.target);if(y[yt]){y[yt].size+=ae;return}y[yt]=et}}}),this.addItems(Object.values(y).map(function(O){return{type:"vedge",model:O}}),!1),this.emit("aftercollapseexpandcombo",{action:"collapse",item:e})}},t.prototype.expandCombo=function(e,r){var n=this;if(r===void 0&&(r=!0),(0,s.isString)(e)&&(e=this.findById(e)),!e||e.getType&&e.getType()!=="combo"){console.warn("The combo to be collapsed does not exist!");return}this.emit("beforecollapseexpandcombo",{action:"expand",item:e});var a=e.getModel(),i=this.get("itemController");i.expandCombo(e,r),a.collapsed=!1;var o=this.getEdges().concat(this.get("vedges")),u=[],l=this.get("comboTrees"),h=!1;(l||[]).forEach(function(O){h||Fa(O,function(A){if(h&&A.depth<=a.depth)return!1;if(a.id===A.id&&(h=!0),h){var z=n.findById(A.id);z&&z.getType&&z.getType()==="combo"&&(u=u.concat(z.getNodes()),u=u.concat(z.getCombos()))}return!0})});var y={};o.forEach(function(O){if(!(O.isVisible()&&!O.getModel().isVEdge)){var A=O.getSource(),z=O.getTarget(),$=A.get("id"),ae=z.get("id"),ce=null,ue;if($===a.id||u.includes(A)&&!u.includes(z)?(ce=z,ue=!1):ae===a.id||!u.includes(A)&&u.includes(z)?(ce=A,ue=!0):u.includes(A)&&u.includes(z)&&A.isVisible()&&z.isVisible()&&O.show(),ce){var ve=O.getModel(),Ce=ve.isVEdge,Re=ve.size,Ve=Re===void 0?1:Re;if(Ce){n.removeItem(O,!1);return}for(var Ue=ce.getModel();!ce.isVisible();){var $e=Ue.parentId,ot=Ue.comboId,et=$e||ot;if(ce=n.findById(et),!ce||!et)return;Ue=ce.getModel()}for(var yt=Ue.id,Gt=ue?z:A,yr=Gt.getModel();!Gt.isVisible();){var kr=yr.parentId,Mr=yr.comboId,dr=kr||Mr;if(Gt=n.findById(dr),!Gt||!dr)return;if(yr.comboId===a.id||yr.parentId===a.id)break;yr=Gt.getModel()}var hn=yr.id;if(yt){var on=ue?{source:yt,target:hn,isVEdge:!0,size:Ve}:{source:hn,target:yt,isVEdge:!0,size:Ve},cr="".concat(on.source,"-").concat(on.target);if(y[cr]){y[cr].size+=Ve;return}y[cr]=on}}}}),this.addItems(Object.values(y).map(function(O){return{type:"vedge",model:O}}),!1),this.emit("aftercollapseexpandcombo",{action:"expand",item:e})},t.prototype.collapseExpandCombo=function(e,r){if(r===void 0&&(r=!0),(0,s.isString)(e)&&(e=this.findById(e)),!(!e||e.getType&&e.getType()!=="combo")){for(var n=e.getModel(),a=this.findById(n.parentId);a;){var i=a.getModel();if(i.collapsed){console.warn("Fail to expand the combo since it's ancestor combo is collapsed."),a=void 0;return}a=this.findById(i.parentId)}var o=n.collapsed;o?this.expandCombo(e,r):this.collapseCombo(e,r),this.updateCombo(e)}},t.prototype.getNeighbors=function(e,r){var n=e;return(0,s.isString)(e)&&(n=this.findById(e)),n.getNeighbors(r)},t.prototype.getNodeDegree=function(e,r,n){r===void 0&&(r=void 0),n===void 0&&(n=!1);var a=e;(0,s.isString)(e)&&(a=this.findById(e));var i=this.get("degrees");(!i||n)&&(i=ft(this.save()),this.set("degrees",i));var o=i[a.getID()],u=0;if(!o)return 0;switch(r){case"in":u=o.inDegree;break;case"out":u=o.outDegree;break;case"all":u=o;break;default:u=o.degree;break}return u},t.prototype.getUndoStack=function(){return this.undoStack},t.prototype.getRedoStack=function(){return this.redoStack},t.prototype.getStackData=function(){return this.get("enabledStack")?{undoStack:this.undoStack.toArray(),redoStack:this.redoStack.toArray()}:null},t.prototype.clearStack=function(){this.get("enabledStack")&&(this.undoStack.clear(),this.redoStack.clear(),this.emit("stackchange",{undoStack:this.undoStack,redoStack:this.redoStack}))},t.prototype.pushStack=function(e,r,n){if(e===void 0&&(e="update"),n===void 0&&(n="undo"),!this.get("enabledStack")){console.warn("\u8BF7\u5148\u542F\u7528 undo & redo \u529F\u80FD\uFF0C\u5728\u5B9E\u4F8B\u5316 Graph \u65F6\u5019\u914D\u7F6E enabledStack: true !");return}var a=r?(0,s.clone)(r):{before:{},after:(0,s.clone)(this.save())};n==="redo"?this.redoStack.push({action:e,data:a}):this.undoStack.push({action:e,data:a}),this.emit("stackchange",{action:e,stackType:n,undoStack:this.undoStack,redoStack:this.redoStack})},t.prototype.getAdjMatrix=function(e,r){e===void 0&&(e=!0),r===void 0&&(r=this.get("directed"));var n=this.get("adjMatrix");return(!n||!e)&&(n=W(this.save(),r),this.set("adjMatrix",n)),n},t.prototype.getShortestPathMatrix=function(e,r){e===void 0&&(e=!0),r===void 0&&(r=this.get("directed"));var n=this.get("adjMatrix"),a=this.get("shortestPathMatrix");return(!n||!e)&&(n=W(this.save(),r),this.set("adjMatrix",n)),(!a||!e)&&(a=Pr(this.save(),r),this.set("shortestPathMatrix",a)),a},t.prototype.on=function(e,r,n){return E.prototype.on.call(this,e,r,n)},t.prototype.destroy=function(){var e,r,n,a,i;this.emit("beforedestroy"),this.clear(),this.clearStack(),(e=this.get("itemController"))===null||e===void 0||e.destroy(),(r=this.get("modeController"))===null||r===void 0||r.destroy(),(n=this.get("viewController"))===null||n===void 0||n.destroy(),(a=this.get("stateController"))===null||a===void 0||a.destroy(),(i=this.get("canvas"))===null||i===void 0||i.destroy(),this.cfg=null,this.destroyed=!0,this.redoStack=null,this.undoStack=null,this.emit("afterdestroy")},t.prototype.createHull=function(e){if(!e.members||e.members.length<1){console.warn("Create hull failed! The members is empty.");return}var r=this.get("hullGroup"),n=this.get("hullMap");if(n||(n={},this.set("hullMap",n)),(!r||r.get("destroyed"))&&(r=this.get("group").addGroup({id:"hullGroup"}),r.toBack(),this.set("hullGroup",r)),n[e.id])return console.warn("Existed hull id."),n[e.id];var a=r.addGroup({id:"".concat(e.id,"-container")}),i=new xr(this,(0,c.__assign)((0,c.__assign)({},e),{group:a})),o=i.id;return n[o]=i,i},t.prototype.getHulls=function(){return this.get("hullMap")},t.prototype.getHullById=function(e){return this.get("hullMap")[e]},t.prototype.removeHull=function(e){var r,n;(0,s.isString)(e)?n=this.getHullById(e):n=e,(r=this.get("hullMap"))===null||r===void 0||delete r[n.id],n.destroy()},t.prototype.removeHulls=function(){var e=this.getHulls();!e||!Object.keys(e).length||(Object.keys(e).forEach(function(r){var n=e[r];n.destroy()}),this.set("hullMap",{}))},t}(j.Z),Gn=tn;function $n(E){"@babel/helpers - typeof";return $n=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},$n(E)}var Dn=Q.vs,Nn="-shape",zn="-label",pn=["startArrow","endArrow"],Yn={lineWidth:1,stroke:void 0,fill:void 0,lineAppendWidth:1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,x:0,y:0,r:10,width:20,height:20,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},Xn={lineWidth:1,stroke:"#000",lineDash:void 0,startArrow:!1,endArrow:!1,opacity:void 0,strokeOpacity:void 0,fillOpacity:void 0,shadowColor:void 0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0},bn={edge:Xn,node:Yn,combo:Yn},Qn="-label-bg",ga={options:{labelCfg:{style:{fontFamily:dn.windowFontFamily}},descriptionCfg:{style:{fontFamily:dn.windowFontFamily}}},itemType:"",type:"",getCustomConfig:function(t){return{}},getOptions:function(t,e){return e==="move"||e!=null&&e.includes("bbox")?t:(0,s.deepMix)({},this.options,this.getCustomConfig(t)||{},t)},draw:function(t,e){e.shapeMap={},this.mergeStyle=this.getOptions(t);var r=this.drawShape(t,e);if(r.set("className",this.itemType+Nn),e.shapeMap[this.itemType+Nn]=r,t.label){var n=this.drawLabel(t,e);n.set("className",this.itemType+zn),e.shapeMap[this.itemType+zn]=n}return r},afterDraw:function(t,e,r){},drawShape:function(t,e){return null},drawLabel:function(t,e){var r=(this.mergeStyle||this.getOptions(t)||{}).labelCfg,n=r||{},a=this.getLabelStyle(t,n,e),i=a.rotate;delete a.rotate;var o=e.addShape("text",{attrs:a,draggable:!0,className:"text-shape",name:"text-shape",labelRelated:!0});if(e.shapeMap["text-shape"]=o,!isNaN(i)&&i!==""){var u=o.getBBox(),l=[1,0,0,0,1,0,0,0,1];if(a.rotateCenter)switch(a.rotateCenter){case"center":l=Dn(l,[["t",-u.width/2,-u.height/2],["r",i],["t",u.width/2,u.height/2]]);break;case"lefttop":l=Dn(l,[["t",-a.x,-a.y],["r",i],["t",a.x,a.y]]);break;case"leftcenter":l=Dn(l,[["t",-a.x,-a.y-u.height/2],["r",i],["t",a.x,a.y+u.height/2]]);break;default:l=Dn(l,[["t",-u.width/2,-u.height/2],["r",i],["t",u.width/2,u.height/2]]);break}else l=Dn(l,[["t",-a.x,-a.y-u.height/2],["r",i],["t",a.x,a.y+u.height/2]]);o.setMatrix(l)}if(a.background){var h=this.drawLabelBg(t,e,o),y=this.itemType+Qn;h.set("classname",y),e.shapeMap[y]=h,o.toFront()}return o},drawLabelBg:function(t,e,r){var n=this.options.labelCfg,a=(0,s.mix)({},n,t.labelCfg),i=this.getLabelBgStyleByPosition(r,a),o=e.addShape("rect",{name:"text-bg-shape",attrs:i,labelRelated:!0});return e.shapeMap["text-bg-shape"]=o,o},getLabelStyleByPosition:function(t,e,r){return{text:t.label}},getLabelBgStyleByPosition:function(t,e){return{}},getLabelStyle:function(t,e,r){var n=this.getLabelStyleByPosition(t,e,r),a="".concat(this.itemType,"Label"),i=dn[a]?dn[a].style:null;return(0,c.__assign)((0,c.__assign)((0,c.__assign)({},i),n),e.style)},getShapeStyle:function(t){return t.style},update:function(t,e,r){this.updateShapeStyle(t,e,r),this.updateLabel(t,e,r)},updateShapeStyle:function(t,e,r){var n,a=e.getContainer(),i=e.getKeyShape(),o=(0,s.mix)({},i.attr(),t.style),u=function(y){var O,A=o[y];if((0,s.isPlainObject)(A)){var z=((n=a.shapeMap)===null||n===void 0?void 0:n[y])||a.find(function($){return $.get("name")===y});z==null||z.attr(A)}else i.attr((O={},O[y]=A,O))};for(var l in o)u(l)},updateLabel:function(t,e,r){var n,a,i=e.getContainer(),o=(this.mergeStyle||this.getOptions({},r)||{}).labelCfg,u=o===void 0?{}:o,l=this.itemType+zn,h=i.shapeMap[l]||i.find(function(Ce){return Ce.get("className")===l}),y=this.itemType+Qn,O=i.shapeMap[y]||i.find(function(Ce){return Ce.get("className")===y});if(h&&t.label===void 0&&(i.removeChild(h),delete i.shapeMap[l],O&&(i.removeChild(O),delete i.shapeMap[y])),t.label||t.label==="")if(h){(!r||r==="bbox|label"||this.itemType==="edge"&&r!=="style")&&(u=(0,s.deepMix)(u,t.labelCfg));var z=this.getLabelStyleByPosition(t,u,i),$=(n=t.labelCfg)===null||n===void 0?void 0:n.style,ae=(0,c.__assign)((0,c.__assign)({},z),$),ce=ae.rotate;if(delete ae.rotate,!isNaN(ce)&&ce!==""){var ue=[1,0,0,0,1,0,0,0,1];ue=Dn(ue,[["t",-ae.x,-ae.y],["r",ce],["t",ae.x,ae.y]]),ae.matrix=ue,h.attr(ae)}else((a=h.getMatrix())===null||a===void 0?void 0:a[4])!==1&&h.resetMatrix(),h.attr(ae);if(!O)ae.background&&(O=this.drawLabelBg(t,i,h),O.set("classname",y),i.shapeMap[y]=O,h.toFront());else if(ae.background){var ve=this.getLabelBgStyleByPosition(h,u);O.attr(ve)}else i.removeChild(O)}else{var A=this.drawLabel(t,i);A.set("className",l),i.shapeMap[l]=A}},afterUpdate:function(t,e){},setState:function(t,e,r){var n,a,i,o=r.get("keyShape");if(!(!o||o.destroyed)){var u=r.getType(),l=(0,s.isBoolean)(e)?t:"".concat(t,":").concat(e),h=this.getStateStyle(l,r),y=r.getStateStyle(l);if(!(!y&&!h)){var O=(0,s.mix)({},y||h),A=r.getContainer(),z={x:1,y:1,cx:1,cy:1,matrix:1};if(u==="combo"&&(z.r=1,z.width=1,z.height=1),e){var $=function(dr){var hn,on=O[dr];if((0,s.isPlainObject)(on)&&!pn.includes(dr)){var cr=((i=A.shapeMap)===null||i===void 0?void 0:i[dr])||A.find(function(Rr){return Rr.get("name")===dr});cr==null||cr.attr(on)}else o.attr((hn={},hn[dr]=on,hn))};for(var ae in O)$(ae)}else{var ce=Oi(r.getCurrentStatesStyle()),ue=r.getModel(),ve=(0,s.mix)({},ue.style,Oi(r.getOriginStyle())),Ce=o.get("name"),Re=o.attr(),Ve={};Object.keys(Re).forEach(function(Mr){if(Mr!=="img"){var dr=Re[Mr];dr&&$n(dr)==="object"?Ve[Mr]=(0,s.clone)(dr):Ve[Mr]=dr}});var Ue={},$e=function(dr){var hn=O[dr];if((0,s.isPlainObject)(hn)&&!pn.includes(dr)){var on=A.shapeMap[dr]||A.find(function(Yr){return Yr.get("name")===dr});if(on){var cr=Oi(on.attr());(0,s.each)(hn,function(Yr,Wr){if(dr===Ce&&Ve[Wr]&&!z[Wr]){delete Ve[Wr];var sn=ve[dr][Wr]||bn[u][Wr];o.attr(Wr,sn)}else if(cr[Wr]||cr[Wr]===0){delete cr[Wr];var wn=ve[dr][Wr]||bn[u][Wr];on.attr(Wr,wn)}}),Ue[dr]=cr}}else if(Ve[dr]&&!z[dr]){delete Ve[dr];var Rr=ve[dr]||(ve[Ce]?ve[Ce][dr]:void 0)||bn[u][dr];o.attr(dr,Rr)}};for(var ot in O)$e(ot);Ce?Ue[Ce]=Ve:(0,s.mix)(Ue,Ve);for(var ae in ce)if(!z[ae]){var et=ce[ae];(!(0,s.isPlainObject)(et)||pn.includes(ae))&&(Ce?((0,s.mix)(ve[Ce],(a={},a[ae]=et,a)),delete ve[ae]):(0,s.mix)(ve,(n={},n[ae]=et,n)),delete ce[ae])}var yt={};(0,s.deepMix)(yt,ve,Ue,ce);var Gt=!1,yr=function(dr){var hn,on,cr=yt[dr];if((0,s.isPlainObject)(cr)&&!pn.includes(dr)){var Rr=A.shapeMap[dr]||A.find(function(Wr){return Wr.get("name")===dr});Rr&&((Rr.get("type")==="text"||Rr.get("labelRelated"))&&(delete cr.x,delete cr.y,delete cr.matrix),dr===Ce&&(u==="combo"&&(delete cr.r,delete cr.width,delete cr.height),Gt=!0),Rr.attr(cr))}else if(!Gt){var Yr=cr||bn[u][dr];u==="combo"?Ce||o.attr((hn={},hn[dr]=Yr,hn)):o.attr((on={},on[dr]=Yr,on))}};for(var kr in yt)yr(kr)}}}},getStateStyle:function(t,e){var r=e.getModel(),n=e.getType(),a=this.getOptions(r),i=a.stateStyles,o=a.style,u=o===void 0?{}:o,l=r.stateStyles?r.stateStyles[t]:i&&i[t];return n==="combo"?(0,s.clone)(l):(0,s.mix)({},u,l)},getControlPoints:function(t){return t.controlPoints},getAnchorPoints:function(t){var e,r,n=(t==null?void 0:t.anchorPoints)||((e=this.getCustomConfig(t))===null||e===void 0?void 0:e.anchorPoints)||((r=this.options)===null||r===void 0?void 0:r.anchorPoints);return n}},Da={itemType:"node",shapeType:"single-node",labelPosition:"center",offset:dn.nodeLabel.offset,getSize:function(t){var e,r=((e=this.mergeStyle)===null||e===void 0?void 0:e.size)||t.size||this.getOptions({}).size||dn.defaultNode.size;return(0,s.isArray)(r)&&r.length===1&&(r=[r[0],r[0]]),(0,s.isArray)(r)||(r=[r,r]),r},getLabelStyleByPosition:function(t,e){var r=e.maxLength,n=t.label;r&&(n=cu(n,r));var a=e.position||this.labelPosition;if(a==="center")return{x:0,y:0,text:n,textBaseline:"middle",textAlign:"center"};var i=e.offset;(0,s.isNil)(i)&&(i=this.offset);var o=this.getSize(t),u;switch(a){case"top":u={x:0,y:-o[1]/2-i,textBaseline:"bottom",textAlign:"center"};break;case"bottom":u={x:0,y:o[1]/2+i,textBaseline:"top",textAlign:"center"};break;case"left":u={x:-o[0]/2-i,y:0,textBaseline:"middle",textAlign:"right"};break;default:u={x:o[0]/2+i,y:0,textBaseline:"middle",textAlign:"left"};break}return u.text=n,u},getLabelBgStyleByPosition:function(t,e){var r;if(!t)return{};var n=(r=e.style)===null||r===void 0?void 0:r.background;if(!n)return{};var a=t.getBBox(),i=hu(n.padding),o=a.width+i[1]+i[3],u=a.height+i[0]+i[2];return(0,c.__assign)((0,c.__assign)({x:a.minX-i[3],y:a.minY-i[0]},n),{width:o,height:u})},drawShape:function(t,e){var r=this.shapeType,n=this.getShapeStyle(t),a=e.addShape(r,{attrs:n,draggable:!0,name:"node-shape"});return e.shapeMap["node-shape"]=a,a},updateLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=e.shapeMap["link-point-left"]||e.find(function(yt){return yt.get("className")==="link-point-left"}),a=e.shapeMap["link-point-right"]||e.find(function(yt){return yt.get("className")==="link-point-right"}),i=e.shapeMap["link-point-top"]||e.find(function(yt){return yt.get("className")==="link-point-top"}),o=e.shapeMap["link-point-bottom"]||e.find(function(yt){return yt.get("className")==="link-point-bottom"}),u;n&&(u=n.attr()),a&&!u&&(u=a.attr()),i&&!u&&(u=i.attr()),o&&!u&&(u=o.attr()),u||(u=r);var l=(0,s.mix)({},u,t.linkPoints),h=l.fill,y=l.stroke,O=l.lineWidth,A=l.size/2;A||(A=l.r);var z=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},$=z.left,ae=z.right,ce=z.top,ue=z.bottom,ve=this.getSize(t),Ce=ve[0],Re=ve[1],Ve={r:A,fill:h,stroke:y,lineWidth:O};if(n)!$&&$!==void 0?(n.remove(),delete e.shapeMap["link-point-left"]):n.attr((0,c.__assign)((0,c.__assign)({},Ve),{x:-Ce/2,y:0}));else if($){var Ue="link-point-left";e.shapeMap[Ue]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},Ve),{x:-Ce/2,y:0}),className:Ue,name:Ue,isAnchorPoint:!0})}if(a)!ae&&ae!==void 0&&(a.remove(),delete e.shapeMap["link-point-right"]),a.attr((0,c.__assign)((0,c.__assign)({},Ve),{x:Ce/2,y:0}));else if(ae){var $e="link-point-right";e.shapeMap[$e]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},Ve),{x:Ce/2,y:0}),className:$e,name:$e,isAnchorPoint:!0})}if(i)!ce&&ce!==void 0&&(i.remove(),delete e.shapeMap["link-point-top"]),i.attr((0,c.__assign)((0,c.__assign)({},Ve),{x:0,y:-Re/2}));else if(ce){var ot="link-point-top";e.shapeMap[ot]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},Ve),{x:0,y:-Re/2}),className:ot,name:ot,isAnchorPoint:!0})}if(o)!ue&&ue!==void 0?(o.remove(),delete e.shapeMap["link-point-bottom"]):o.attr((0,c.__assign)((0,c.__assign)({},Ve),{x:0,y:Re/2}));else if(ue){var et="link-point-bottom";e.shapeMap[et]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},Ve),{x:0,y:Re/2}),className:et,name:et,isAnchorPoint:!0})}},updateShape:function(t,e,r,n,a){var i=e.get("keyShape");i.attr((0,c.__assign)({},r)),this.updateLabel(t,e,a),n&&this.updateIcon(t,e)},updateIcon:function(t,e){var r=this,n=e.getContainer(),a=(this.mergeStyle||this.getOptions(t)).icon,i=t.icon?t.icon:{show:void 0,text:void 0},o=i.show,u=i.text,l=n.shapeMap["".concat(this.type,"-icon")]||n.find(function(ce){return ce.get("name")==="".concat(r.type,"-icon")});if(l)if(o||o===void 0){var h=(0,s.mix)({},l.attr(),a),y=h.width,O=y===void 0?20:y,A=h.height,z=A===void 0?20:A;(h.fontFamily==="iconfont"||h.hasOwnProperty("text"))&&(O=0,z=0),l.attr((0,c.__assign)((0,c.__assign)({},h),{x:-O/2,y:-z/2}))}else l.remove(),delete n.shapeMap["".concat(this.type,"-icon")];else if(o){var $="".concat(this.type,"-icon");if(u)n.shapeMap[$]=n.addShape("text",{attrs:(0,c.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},a),className:$,name:$});else{var O=a.width,z=a.height;n.shapeMap[$]=n.addShape("image",{attrs:(0,c.__assign)((0,c.__assign)({},a),{x:-O/2,y:-z/2}),className:$,name:$})}var ae=n.shapeMap["node-label"]||n.find(function(ce){return ce.get("name")==="node-label"});ae&&ae.toFront()}}},Ma=(0,c.__assign)((0,c.__assign)({},ga),Da);vi.registerNode("single-node",Ma);var ha="edge-shape";function Pa(E){var t=E;return E==="start"?t="end":E==="end"&&(t="start"),t}var Qa={itemType:"edge",labelPosition:"center",refX:0,refY:0,labelAutoRotate:!1,options:{size:dn.defaultEdge.size,style:{x:0,y:0,stroke:dn.defaultEdge.style.stroke,lineAppendWidth:dn.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:dn.edgeLabel.style.fill,fontSize:dn.edgeLabel.style.fontSize,fontFamily:dn.windowFontFamily}},stateStyles:(0,c.__assign)({},dn.edgeStateStyles)},getPath:function(t){var e=[];return(0,s.each)(t,function(r,n){n===0?e.push(["M",r.x,r.y]):e.push(["L",r.x,r.y])}),e},getShapeStyle:function(t){var e=this.options.style,r={stroke:t.color},n=(0,s.mix)({},e,r,t.style),a=t.size||dn.defaultEdge.size;t=this.getPathPoints(t);var i=t.startPoint,o=t.endPoint,u=this.getControlPoints(t),l=[i];u&&(l=l.concat(u)),l.push(o);var h=this.getPath(l),y=(0,s.mix)({},dn.defaultEdge.style,{stroke:dn.defaultEdge.color,lineWidth:a,path:h},n);return y},updateShapeStyle:function(t,e,r){var n,a=e.getContainer(),i=((n=e.getKeyShape)===null||n===void 0?void 0:n.call(e))||a.shapeMap["edge-shape"],o=t.size;t=this.getPathPoints(t);var u=t.startPoint,l=t.endPoint,h=this.getControlPoints(t),y=[u];h&&(y=y.concat(h)),y.push(l);var O=i.attr(),A=t.style||{};A.stroke===void 0&&(A.stroke=t.color);var z=t.sourceNode,$=t.targetNode,ae={radius:A.radius};h||(ae={source:z,target:$,offset:A.offset,radius:A.radius});var ce=this.getPath(y,ae),ue={};r==="move"?ue={path:ce}:(O.endArrow&&A.endArrow===!1&&(t.style.endArrow={path:""}),O.startArrow&&A.startArrow===!1&&(t.style.startArrow={path:""}),ue=(0,c.__assign)({},t.style),ue.lineWidth===void 0&&(ue.lineWidth=((0,s.isNumber)(o)?o:o==null?void 0:o[0])||O.lineWidth),ue.path===void 0&&(ue.path=ce),ue.stroke===void 0&&(ue.stroke=O.stroke||t.color)),i&&i.attr(ue)},getLabelStyleByPosition:function(t,e,r){var n=e.position||this.labelPosition,a={},i=r==null?void 0:r.shapeMap[ha],o;n==="start"?o=0:n==="end"?o=1:o=.5;var u=e.refX||this.refX,l=e.refY||this.refY;if(t.startPoint.x===t.endPoint.x&&t.startPoint.y===t.endPoint.y)return a.x=t.startPoint.x+u,a.y=t.startPoint.y+l,a.text=t.label,a;var h;(0,s.isNil)(e.autoRotate)?h=this.labelAutoRotate:h=e.autoRotate;var y=vs(i,o,u,l,h);return a.x=y.x,a.y=y.y,a.rotate=y.rotate,a.textAlign=this._getTextAlign(n,y.angle),a.text=t.label,a},getLabelBgStyleByPosition:function(t,e){if(!t)return{};var r=t.getBBox(),n=e.style&&e.style.background;if(!n)return{};var a=n.padding,i=r.width+a[1]+a[3],o=r.height+a[0]+a[2],u=(0,c.__assign)((0,c.__assign)({},n),{width:i,height:o,x:r.minX-a[3],y:r.minY-a[0],matrix:[1,0,0,0,1,0,0,0,1]}),l;return(0,s.isNil)(e.autoRotate)?l=this.labelAutoRotate:l=e.autoRotate,l&&(u.matrix=t.attr("matrix")||[1,0,0,0,1,0,0,0,1]),u},_getTextAlign:function(t,e){var r="center";return e?(e=e%(Math.PI*2),t!=="center"&&(e>=0&&e<=Math.PI/2||e>=3/2*Math.PI&&e<2*Math.PI?r=t:r=Pa(t)),r):t},getControlPoints:function(t){return t.controlPoints},getPathPoints:function(t){return t},drawShape:function(t,e){var r=this.getShapeStyle(t),n=e.addShape("path",{className:ha,name:ha,attrs:r});return e.shapeMap[ha]=n,n},drawLabel:function(t,e){var r=this.options.labelCfg,n=(0,s.deepMix)({},r,t.labelCfg),a=this.getLabelStyle(t,n,e),i=a.rotate;delete a.rotate;var o=e.addShape("text",{attrs:a,name:"text-shape",labelRelated:!0,draggable:!0});if(e.shapeMap["text-shape"]=o,!isNaN(i)&&i!==""&&o.rotateAtStart(i),a.background){var u=this.drawLabelBg(t,e,o,a,i),l=this.itemType+Qn;u.set("classname",l),e.shapeMap[l]=u,o.toFront()}return o},drawLabelBg:function(t,e,r,n,a){var i=this.options.labelCfg,o=(0,s.deepMix)({},i,t.labelCfg),u=this.getLabelBgStyleByPosition(r,o),l=e.addShape("rect",{name:"text-bg-shape",attrs:u,labelRelated:!0});return e.shapeMap["text-bg-shape"]=l,l}},Ya=(0,c.__assign)((0,c.__assign)({},ga),Qa);vi.registerEdge("single-edge",Ya),vi.registerEdge("line",{getControlPoints:function(){}},"single-edge"),vi.registerEdge("spline",{getPath:function(t){var e=$u(t);return e}},"single-edge"),vi.registerEdge("arc",{curveOffset:20,clockwise:1,getControlPoints:function(t){var e=t.startPoint,r=t.endPoint,n={x:(e.x+r.x)/2,y:(e.y+r.y)/2},a,i;if(t.controlPoints!==void 0){if(i=t.controlPoints[0],a=On(e,i,r),e.x<=r.x&&e.y>r.y?this.clockwise=a.x>i.x?0:1:e.x<=r.x&&e.yi.x?1:0:e.x>r.x&&e.y<=r.y?this.clockwise=a.y=60&&Math.round(E.h)<=240?r=e?Math.round(E.h)-Mu*t:Math.round(E.h)+Mu*t:r=e?Math.round(E.h)+Mu*t:Math.round(E.h)-Mu*t,r<0?r+=360:r>=360&&(r-=360),r}function vc(E,t,e){if(E.h===0&&E.s===0)return E.s;var r;return e?r=E.s-Lf*t:t===dc?r=E.s+Lf:r=E.s+fc*t,r>1&&(r=1),e&&t===ef&&r>.1&&(r=.1),r<.06&&(r=.06),Number(r.toFixed(2))}function gc(E,t,e){var r;return e?r=E.v+cc*t:r=E.v-lc*t,r>1&&(r=1),Number(r.toFixed(2))}function Cu(E){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=[],r=(0,os.Z)(E),n=ef;n>0;n-=1){var a=r.toHsv(),i=(0,os.Z)({h:hc(a,n,!0),s:vc(a,n,!0),v:gc(a,n,!0)}).toHexString();e.push(i)}e.push(r.toHexString());for(var o=1;o<=dc;o+=1){var u=r.toHsv(),l=(0,os.Z)({h:hc(u,o),s:vc(u,o),v:gc(u,o)}).toHexString();e.push(l)}return t.theme==="dark"?kc.map(function(h){var y=h.index,O=h.opacity,A=os.Z.mix(t.backgroundColor||"#141414",e[y],O*100).toHexString();return A}):e}var tf={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1890FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Ci={},Df={};Object.keys(tf).forEach(function(E){Ci[E]=Cu(tf[E]),Ci[E].primary=Ci[E][5],Df[E]=Cu(tf[E],{theme:"dark",backgroundColor:"#141414"}),Df[E].primary=Df[E][5]});var il=Ci.red,Nf=Ci.volcano,Rc=Ci.gold,ht=Ci.orange,ol=Ci.yellow,rf=Ci.lime,pc=Ci.green,sl=Ci.cyan,Bc=Ci.blue,ul=Ci.geekblue,fl=Ci.purple,Pf=Ci.magenta,yc=Ci.grey,oi=function(t,e,r){var n=_u()(t),a=_u()(e);return _u()([(1-r)*n.red()+r*a.red(),(1-r)*n.green()+r*a.green(),(1-r)*n.blue()+r*a.blue()]).rgb()},kf=function(t,e,r){e===void 0&&(e="#fff"),r===void 0&&(r="rgb(150, 150, 150)");var n=oi(e,t,.05).rgb().toString(),a=oi(e,t,.1).rgb().toString(),i=oi(e,t,.2).rgb().toString(),o=oi(e,t,.4).rgb().toString(),u=oi(e,r,.02).rgb().toString(),l=oi(e,r,.05).rgb().toString(),h=oi(e,r,.1).rgb().toString(),y=oi(e,r,.2).rgb().toString(),O=oi(e,r,.3).rgb().toString(),A=Cu(t,{theme:"default",backgroundColor:e}),z=_u()(t).hex().toLowerCase(),$=A.indexOf(z),ae=t;return $!==-1&&(ae=A[$+1]),{mainStroke:t,mainFill:a,activeStroke:t,activeFill:n,inactiveStroke:o,inactiveFill:n,selectedStroke:t,selectedFill:e,highlightStroke:ae,highlightFill:i,disableStroke:O,disableFill:l,edgeMainStroke:O,edgeActiveStroke:t,edgeInactiveStroke:y,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:h,comboMainStroke:O,comboMainFill:u,comboActiveStroke:t,comboActiveFill:n,comboInactiveStroke:O,comboInactiveFill:u,comboSelectedStroke:t,comboSelectedFill:u,comboHighlightStroke:ae,comboHighlightFill:u,comboDisableStroke:y,comboDisableFill:l}},gi=function(t,e,r){e===void 0&&(e="#fff"),r===void 0&&(r="#777");var n=oi(e,t,.2).rgb().toString(),a=oi(e,t,.3).rgb().toString(),i=oi(e,t,.6).rgb().toString(),o=oi(e,t,.8).rgb().toString(),u=oi(e,r,.2).rgb().toString(),l=oi(e,r,.25).rgb().toString(),h=oi(e,r,.3).rgb().toString(),y=oi(e,r,.4).rgb().toString(),O=oi(e,r,.5).rgb().toString(),A=Cu(t,{theme:"dark",backgroundColor:e}),z=_u()(t).hex().toLowerCase(),$=A.indexOf(z),ae=t;return $!==-1&&(ae=A[$+1]),{mainStroke:o,mainFill:n,activeStroke:t,activeFill:a,inactiveStroke:o,inactiveFill:n,selectedStroke:t,selectedFill:n,highlightStroke:t,highlightFill:i,disableStroke:O,disableFill:l,edgeMainStroke:r,edgeActiveStroke:t,edgeInactiveStroke:r,edgeSelectedStroke:t,edgeHighlightStroke:t,edgeDisableStroke:h,comboMainStroke:y,comboMainFill:l,comboActiveStroke:t,comboActiveFill:u,comboInactiveStroke:y,comboInactiveFill:l,comboSelectedStroke:t,comboSelectedFill:u,comboHighlightStroke:ae,comboHighlightFill:l,comboDisableStroke:y,comboDisableFill:u}},Ms=function(t,e,r,n){return e===void 0&&(e="#fff"),r===void 0&&(r="default"),n===void 0&&(n="rgb(150, 150, 150)"),r==="default"?kf(t,e,"rgb(150, 150, 150)"):gi(t,e,"#777")},mc=function(t,e,r,n){e===void 0&&(e="#fff"),r===void 0&&(r="default"),n===void 0&&(n="rgb(150, 150, 150)");var a=[];return t.forEach(function(i){a.push(Ms(i,e,r,n))}),a},nf="rgb(95, 149, 255)",Xo="rgb(255, 255, 255)",Js="rgb(0, 0, 0)",ta=Ms(nf,Xo),qi={version:"0.8.23",rootContainerClassName:"root-container",nodeContainerClassName:"node-container",edgeContainerClassName:"edge-container",comboContainerClassName:"combo-container",delegateContainerClassName:"delegate-container",defaultLoopPosition:"top",nodeLabel:{style:{fill:"#000",fontSize:12,textAlign:"center",textBaseline:"middle"},offset:4},defaultNode:{type:"circle",style:{lineWidth:1,stroke:ta.mainStroke,fill:ta.mainFill},size:20,color:ta.mainStroke,linkPoints:{size:8,lineWidth:1,fill:ta.activeFill,stroke:ta.activeStroke}},nodeStateStyles:{active:{fill:ta.activeFill,stroke:ta.activeStroke,lineWidth:2,shadowColor:ta.mainStroke,shadowBlur:10},selected:{fill:ta.selectedFill,stroke:ta.selectedStroke,lineWidth:4,shadowColor:ta.selectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{fill:ta.highlightFill,stroke:ta.highlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{fill:ta.inactiveFill,stroke:ta.inactiveStroke,lineWidth:1},disable:{fill:ta.disableFill,stroke:ta.disableStroke,lineWidth:1}},edgeLabel:{style:{fill:Js,textAlign:"center",textBaseline:"middle",fontSize:12}},defaultEdge:{type:"line",size:1,style:{stroke:ta.edgeMainStroke,lineAppendWidth:2},color:ta.edgeMainStroke},edgeStateStyles:{active:{stroke:ta.edgeActiveStroke,lineWidth:1},selected:{stroke:ta.edgeSelectedStroke,lineWidth:2,shadowColor:ta.edgeSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:ta.edgeHighlightStroke,lineWidth:2,"text-shape":{fontWeight:500}},inactive:{stroke:ta.edgeInactiveStroke,lineWidth:1},disable:{stroke:ta.edgeDisableStroke,lineWidth:1}},comboLabel:{style:{fill:Js,textBaseline:"middle",fontSize:12},refY:10,refX:10},defaultCombo:{type:"circle",style:{fill:ta.comboMainFill,lineWidth:1,stroke:ta.comboMainStroke,r:5,width:20,height:10},size:[20,5],color:ta.comboMainStroke,padding:[25,20,15,20]},comboStateStyles:{active:{stroke:ta.comboActiveStroke,lineWidth:1,fill:ta.comboActiveFill},selected:{stroke:ta.comboSelectedStroke,lineWidth:2,fill:ta.comboSelectedFill,shadowColor:ta.comboSelectedStroke,shadowBlur:10,"text-shape":{fontWeight:500}},highlight:{stroke:ta.comboHighlightStroke,lineWidth:2,fill:ta.comboHighlightFill,"text-shape":{fontWeight:500}},inactive:{stroke:ta.comboInactiveStroke,fill:ta.comboInactiveFill,lineWidth:1},disable:{stroke:ta.comboDisableStroke,fill:ta.comboDisableFill,lineWidth:1}},delegateStyle:{fill:"#F3F9FF",fillOpacity:.5,stroke:"#1890FF",strokeOpacity:.9,lineDash:[5,5]},textWaterMarkerConfig:{width:150,height:100,compatible:!1,text:{x:0,y:60,lineHeight:20,rotate:20,fontSize:14,fontFamily:"Microsoft YaHei",fill:"rgba(0, 0, 0, 0.1)",baseline:"Middle"}},imageWaterMarkerConfig:{width:150,height:130,compatible:!1,image:{x:0,y:0,width:30,height:20,rotate:0}},waterMarkerImage:"https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg"},Tu=function(t){var e=t.clone();return qs(t,e),e},qs=function E(t,e){var r;t.isGroup()&&e.isGroup()&&((r=t.get("children"))===null||r===void 0||r.forEach(function(o,u){var l=e.get("children")[u];E(o,l)}));var n=t.get("type"),a=e.get("type");if(!(n!=="image"||a!=="image")){var i=t.get("clipShape");i&&e.setClip({type:i.get("type"),attrs:i.attr()})}},jo=F(60798),eu=ei.cloneEvent,Rf=ei.isViewportChanged,Bf=function(E){(0,c.__extends)(t,E);function t(e){var r=E.call(this,e)||this;return r.extendEvents=[],r.dragging=!1,r.mousedown=!1,r.preItem=null,r.destroy(),r.graph=e,r.destroyed=!1,r.initEvents(),r}return t.prototype.initEvents=function(){var e=this,r=e.graph,n=e.extendEvents,a=n===void 0?[]:n,i=r.get("canvas"),o=i.get("el"),u=(0,s.wrapBehavior)(this,"onCanvasEvents"),l=(0,s.wrapBehavior)(this,"onExtendEvents"),h=(0,s.wrapBehavior)(this,"onWheelEvent");i.off("*").on("*",u),this.canvasHandler=u,a.push((0,jo.Z)(o,"wheel",h)),typeof window!="undefined"&&(a.push((0,jo.Z)(window,"keydown",l)),a.push((0,jo.Z)(window,"keyup",l)),a.push((0,jo.Z)(window,"focus",l))),this.resetHandler&&r.off("afterchangedata",this.resetHandler),this.resetHandler=(0,s.wrapBehavior)(this,"resetStatus"),r.on("afterchangedata",this.resetHandler)},t.getItemRoot=function(e){for(;e&&!e.get("item");)e=e.get("parent");return e},t.prototype.onCanvasEvents=function(e){var r=this,n=this.graph,a=n.get("canvas"),i=e.target,o=e.type;switch(o){case"drag":this.onCanvasEvents(Object.assign({},e,{type:"mousemove"}));break;case"dragend":this.onCanvasEvents(Object.assign({},e,{type:"mouseup"}));break;case"mousedown":this.mousedown=!0;break;case"mouseup":setTimeout(function(){return r.mousedown=!1});break;case"click":if(!this.mousedown)return;break;default:break}e.canvasX=e.x,e.canvasY=e.y;var u={x:e.canvasX,y:e.canvasY},l=n.get("group"),h=l.getMatrix();if(h||(h=[1,0,0,0,1,0,0,0,1]),Rf(h)&&(u=n.getPointByClient(e.clientX,e.clientY)),e.x=u.x,e.y=u.y,e.currentTarget=n,i===a){(o==="mousemove"||o==="mouseleave")&&this.handleMouseMove(e,"canvas"),e.target=a,e.item=null,n.emit(o,e),n.emit("canvas:".concat(o),e);return}var y=t.getItemRoot(i);if(!y){n.emit(o,e);return}var O=y.get("item");if(!O.destroyed){var A=O.getType();if(e.target=i,e.item=O,e.canvasX===e.x&&e.canvasY===e.y){var z=n.getCanvasByPoint(e.x,e.y);e.canvasX=z.x,e.canvasY=z.y}e.name&&!e.name.includes(":")?(n.emit("".concat(A,":").concat(o),e),n.emit(o,e)):e.name&&n.emit(e.name,e),o==="dragstart"&&(this.dragging=!0),o==="dragend"&&(this.dragging=!1),o==="mousemove"&&this.handleMouseMove(e,A)}},t.prototype.onExtendEvents=function(e){this.graph.emit(e.type,e)},t.prototype.onWheelEvent=function(e){(0,s.isNil)(e.wheelDelta)&&(e.wheelDelta=-e.detail),this.graph.emit("wheel",e)},t.prototype.handleMouseMove=function(e,r){var n=this,a=n.graph,i=n.preItem,o=a.get("canvas"),u=e.target===o?null:e.item;e=eu(e),i&&i!==u&&!i.destroyed&&(e.item=i,this.emitCustomEvent(i.getType(),"mouseleave",e),this.dragging&&this.emitCustomEvent(i.getType(),"dragleave",e)),u&&i!==u&&(e.item=u,this.emitCustomEvent(r,"mouseenter",e),this.dragging&&this.emitCustomEvent(r,"dragenter",e)),this.preItem=u},t.prototype.emitCustomEvent=function(e,r,n){n.type=r,this.graph.emit("".concat(e,":").concat(r),n)},t.prototype.resetStatus=function(){this.mousedown=!1,this.dragging=!1,this.preItem=null},t.prototype.destroy=function(){var e=this,r=e.graph,n=e.canvasHandler,a=e.extendEvents,i=r.get("canvas");i.off("*",n),(0,s.each)(a,function(o){o.remove()}),this.resetStatus(),this.extendEvents.length=0,this.canvasHandler=null,this.resetHandler=null,this.destroyed=!0},t}(Ju),af=Bf,ua=F(20378),bc=F(72407),ss=F.n(bc),uo=ei.traverseTree,Ec=function(t,e){var r;return t?(0,s.isNumber)(t)?r=function(a){return t}:r=t:r=function(a){return e||1},r},Fc=function(t,e){var r=[],n=[],a={},i=0;for(i=0;i=0&&(o="x",i="y");var u=0;uo(t,function(y){return u++,y.x>a.x&&(a.x=y.x),y.xa.y&&(a.y=y.y),y.yWebGL.
','Find out how to get it here.'].join(` `):['Your browser does not seem to support WebGL.
','Find out how to get it here.'].join(` `)),e},addGetWebGLMessage:function(e){e=e||{};var r=e.parent!==void 0?e.parent:document.body,n=e.id!==void 0?e.id:"oldie",a=E().getWebGLErrorMessage();a.id=n,r.appendChild(a)}}},_c=function(){var t=navigator.userAgent.toLowerCase();return t.indexOf("firefox")>-1?"firefox":t.indexOf("safari")>-1?"safari":t.indexOf("opr")>-1?"opera":t.indexOf("chrome")>-1?"chrome":t.indexOf("trident")>-1?"ie 11":t.indexOf("ie")>-1?"ie":"unknown"},cl=(0,c.__assign)((0,c.__assign)((0,c.__assign)((0,c.__assign)((0,c.__assign)({},ei),p),v),g),d),Vo=cl,zc=Vo.radialLayout,ll=function(){function E(t){this.type=t.type,this.radial=t.radial,this.config=t}return E.prototype.init=function(t){var e=this;if(this.data=t,this.radial){this.layoutMethod=function(r){var n=ss()[e.type](r,e.config);return zc(n),n};return}this.layoutMethod=function(r){return ss()[e.type](r,e.config)}},E.prototype.execute=function(){return this.layoutMethod(this.data,this.config)},E.prototype.layout=function(t){return this.init(t),this.execute()},E}(),Uc=ll;(0,ua.registerLayout)("grid",ua.GridLayout),(0,ua.registerLayout)("random",ua.RandomLayout),(0,ua.registerLayout)("force",ua.ForceLayout),(0,ua.registerLayout)("circular",ua.CircularLayout),(0,ua.registerLayout)("dagre",ua.DagreLayout),(0,ua.registerLayout)("dagreCompound",ua.DagreCompoundLayout),(0,ua.registerLayout)("radial",ua.RadialLayout),(0,ua.registerLayout)("concentric",ua.ConcentricLayout),(0,ua.registerLayout)("mds",ua.MDSLayout),(0,ua.registerLayout)("fruchterman",ua.FruchtermanLayout),(0,ua.registerLayout)("fruchterman-gpu",ua.FruchtermanGPULayout),(0,ua.registerLayout)("gForce",ua.GForceLayout),(0,ua.registerLayout)("force2",ua.Force2Layout),(0,ua.registerLayout)("gForce-gpu",ua.GForceGPULayout),(0,ua.registerLayout)("comboForce",ua.ComboForceLayout),(0,ua.registerLayout)("comboCombined",ua.ComboCombinedLayout),(0,ua.registerLayout)("forceAtlas2",ua.ForceAtlas2Layout);var Wc=function(t,e){e.isCustomLayout=!0,ua.Layouts[t]=(0,ua.registerLayout)(t,e)},dl=function(){function E(t,e){var r=t.toString(),n=new Blob(["importScripts('".concat(e,"');(").concat(r,")()")],{type:"text/javascript"});return new Worker(URL.createObjectURL(n))}return E}(),Xc=dl,jc=function(t){t===void 0&&(t="https://unpkg.com/@antv/layout@0.3.23/dist/layout.min.js");function e(){var n={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};layout.registerLayout("grid",layout.GridLayout),layout.registerLayout("random",layout.RandomLayout),layout.registerLayout("force",layout.ForceLayout),layout.registerLayout("force2",layout.Force2Layout),layout.registerLayout("circular",layout.CircularLayout),layout.registerLayout("dagre",layout.DagreLayout),layout.registerLayout("dagreCompound",layout.DagreCompoundLayout),layout.registerLayout("radial",layout.RadialLayout),layout.registerLayout("concentric",layout.ConcentricLayout),layout.registerLayout("mds",layout.MDSLayout),layout.registerLayout("fruchterman",layout.FruchtermanLayout),layout.registerLayout("fruchterman-gpu",layout.FruchtermanGPULayout),layout.registerLayout("gForce",layout.GForceLayout),layout.registerLayout("gForce-gpu",layout.GForceGPULayout),layout.registerLayout("comboForce",layout.ComboForceLayout),layout.registerLayout("comboCombined",layout.ComboCombinedLayout),layout.registerLayout("forceAtlas2",layout.ForceAtlas2Layout);function a(o){var u=o.data.type;return u===n.RUN||u===n.GPURUN}function i(o){var u=this,l=o.data.type;switch(l){case n.RUN:{var h=o.data,y=h.nodes,O=h.edges,A=h.layoutCfg,z=A===void 0?{}:A,$=z.type,ae=layout.getLayoutByName($);if(!ae){this.postMessage({type:n.ERROR,message:"layout ".concat($," not found")});break}var ce;z.onLayoutEnd=function(){u.postMessage({type:n.END,nodes:y}),ce==null||ce.destroy()},ce=new ae(z),ce.init({nodes:y,edges:O}),ce.execute();break}case n.GPURUN:{var ue=o.data,ve=ue.nodes,O=ue.edges,Ce=ue.layoutCfg,z=Ce===void 0?{}:Ce,Re=ue.canvas,$=z.type,ae=layout.getLayoutByName($);if(!ae){this.postMessage({type:n.ERROR,message:"layout ".concat($," not found")});break}if($.split("-")[1]!=="gpu"){this.postMessage({type:n.ERROR,message:"layout ".concat($," does not support GPU")});break}var Ve=new ae(z);Ve.init({nodes:ve,edges:O}),Ve.executeWithWorker(Re,this);break}default:break}}onmessage=function(u){a(u)&&i(u)}}var r=new Xc(e,t);return r},ru={RUN:"LAYOUT_RUN",END:"LAYOUT_END",ERROR:"LAYOUT_ERROR",TICK:"LAYOUT_TICK",GPURUN:"GPU_LAYOUT_RUN",GPUEND:"GPU_LAYOUT_END"};function Gf(E){"@babel/helpers - typeof";return Gf=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},Gf(E)}var zf=function(t){return setTimeout(t,16)},Iu=function(t){return clearTimeout(t)},nu={requestAnimationFrame:function(t){var e=typeof window!="undefined"&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame)||zf;return e(t)},cancelAnimationFrame:function(t){var e=typeof window!="undefined"&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame)||Iu;return e(t)}},Uf=["fruchterman","gForce"],Wf=["force","grid","circular"],Mc=function(E){(0,c.__extends)(t,E);function t(e){var r=E.call(this,e)||this;return r.graph=e,r.layoutCfg=e.get("layout")||{},r.layoutType=r.getLayoutType(),r.worker=null,r.workerData={},r.initLayout(),r}return t.prototype.initLayout=function(){},t.prototype.getWorker=function(){return this.worker?this.worker:(typeof Worker=="undefined"?(console.warn("Web worker is not supported in current browser."),this.worker=null):this.worker=jc(this.layoutCfg.workerScriptURL),this.worker)},t.prototype.stopWorker=function(){var e=this.workerData;this.worker&&(this.worker.terminate(),this.worker=null,e.requestId&&(nu.cancelAnimationFrame(e.requestId),e.requestId=null),e.requestId2&&(nu.cancelAnimationFrame(e.requestId2),e.requestId2=null))},t.prototype.execLayoutMethod=function(e,r){var n=this;return new Promise(function(a,i){return(0,c.__awaiter)(n,void 0,void 0,function(){var o,u,l,h,y,$,O,A,z,$,ae;return(0,c.__generator)(this,function(ce){switch(ce.label){case 0:if(o=this.graph,!o||o.get("destroyed"))return[2];u=e.type,e.onLayoutEnd=function(){o.emit("aftersublayout",{type:u}),a()},u&&this.isGPU&&(sf(u)?u="".concat(u,"-gpu"):console.warn("The '".concat(u,"' layout does not support GPU calculation for now, it will run in CPU."))),ei.isForce(u)?(l=e.onTick,h=e.animate,y=h===void 0&&(u==="force"||u==="force2"),$=function(){l&&l(),(h||y)&&o.refreshPositions()},e.tick=$):(u==="comboForce"||u==="comboCombined")&&(e.comboTrees=o.get("comboTrees")),O=!1;try{A=new ua.Layouts[u](e),this.layoutMethods[r]&&this.layoutMethods[r].destroy(),this.layoutMethods[r]=A}catch(ue){console.warn("The layout method: '".concat(u,"' does not exist! Please specify it first.")),i()}return O=A.enableTick,O&&(z=e.onTick,$=function(){z&&z(),o.refreshPositions()},A.tick=$),ae=this.filterLayoutData(this.data,e),jf(ae,r),A.init(ae),o.emit("beforesublayout",{type:u}),[4,A.execute()];case 1:return ce.sent(),A.isCustomLayout&&e.onLayoutEnd&&e.onLayoutEnd(),[2]}})})})},t.prototype.updateLayoutMethod=function(e,r){var n=this;return new Promise(function(a,i){return(0,c.__awaiter)(n,void 0,void 0,function(){var o,u,l,h,y,O,A;return(0,c.__generator)(this,function(z){switch(z.label){case 0:return o=this.graph,u=r==null?void 0:r.type,r.onLayoutEnd=function(){o.emit("aftersublayout",{type:u}),a()},ei.isForce(u)&&(l=r.onTick,h=r.animate,y=h===void 0&&(u==="force"||u==="force2"),O=function(){l==null||l(),(h||y)&&o.refreshPositions()},r.tick=O),A=this.filterLayoutData(this.data,r),e.init(A),e.updateCfg(r),o.emit("beforesublayout",{type:u}),[4,e.execute()];case 1:return z.sent(),e.isCustomLayout&&r.onLayoutEnd&&r.onLayoutEnd(),[2]}})})})},t.prototype.layout=function(e){var r=this,n,a=this.graph;if(!(!a||a.get("destroyed"))){this.data=this.setDataFromGraph();var i=this.data,o=i.nodes,u=i.hiddenNodes;if(!o)return!1;var l=a.get("width"),h=a.get("height"),y={};Object.assign(y,{width:l,height:h,center:[l/2,h/2]},this.layoutCfg),this.layoutCfg=y;var O=y.type,A=!1;(n=this.layoutMethods)===null||n===void 0||n.forEach(function(Re){var Ve;return A=!!(!((Ve=Re.nodes)===null||Ve===void 0)&&Ve.length)||A});var z=this.destoryLayoutMethods();a.emit("beforelayout");var $=Promise.resolve();A&&O&&(z==null?void 0:z.length)===1&&z[0]===O?this.tweakInit():$=this.initPositions(y.center,o);var ae=this.initPositions(y.center,u);ae.then(),this.isGPU=uf(y,O);var ce=y.onLayoutEnd,ue=y.layoutEndFormatted,ve=y.adjust;if(ue||(y.layoutEndFormatted=!0,y.onAllLayoutEnd=function(){return(0,c.__awaiter)(r,void 0,void 0,function(){return(0,c.__generator)(this,function(Re){switch(Re.label){case 0:return ce&&ce(o),this.refreshLayout(),ve&&y.pipes?[4,this.adjustPipesBox(this.data,ve)]:[3,2];case 1:Re.sent(),this.refreshLayout(),Re.label=2;case 2:return a.emit("afterlayout"),[2]}})})}),this.stopWorker(),y.workerEnabled&&this.layoutWithWorker(this.data,e))return!0;var Ce=!1;return y.type?(Ce=!0,$=$.then(function(){return(0,c.__awaiter)(r,void 0,void 0,function(){return(0,c.__generator)(this,function(Re){switch(Re.label){case 0:return[4,this.execLayoutMethod(y,0)];case 1:return[2,Re.sent()]}})})})):y.pipes&&(Ce=!0,y.pipes.forEach(function(Re,Ve){$=$.then(function(){return(0,c.__awaiter)(r,void 0,void 0,function(){return(0,c.__generator)(this,function(Ue){switch(Ue.label){case 0:return[4,this.execLayoutMethod(Re,Ve)];case 1:return[2,Ue.sent()]}})})})})),Ce?$.then(function(){y.onAllLayoutEnd&&y.onAllLayoutEnd(),e&&e()}).catch(function(Re){console.warn("graph layout failed,",Re)}):(a.refreshPositions(),e==null||e()),!1}},t.prototype.tweakInit=function(){var e=this,r=e.data,n=e.graph,a=r.nodes,i=r.edges;if(a!=null&&a.length){var o={};a.forEach(function(h){var y=h.x,O=h.y;!isNaN(y)&&!isNaN(O)&&(o[h.id]={x:y,y:O},h.mass=h.mass||2)}),i.forEach(function(h){var y=h.source,O=h.target,A=o[y],z=o[O];!A&&z?o[y]={x:z.x+(Math.random()-.5)*80,y:z.y+(Math.random()-.5)*80}:!z&&A&&(o[O]={x:A.x+(Math.random()-.5)*80,y:A.y+(Math.random()-.5)*80})});var u=n.get("width"),l=n.get("height");a.forEach(function(h){var y=o[h.id]||{x:u/2+(Math.random()-.5)*20,y:l/2+(Math.random()-.5)*20};h.x=y.x,h.y=y.y})}},t.prototype.initWithPreset=function(e,r){var n=this;return new Promise(function(a,i){return(0,c.__awaiter)(n,void 0,void 0,function(){var o,u,l,h,y,O,A;return(0,c.__generator)(this,function(z){switch(z.label){case 0:return o=this,u=o.layoutCfg,l=o.data,h=u.preset,!(h!=null&&h.type)||!ua.Layouts[h==null?void 0:h.type]?(r==null||r(),a(),[2,!1]):(y=uf(h,h.type),O=y?"".concat(h.type,"-gpu"):h.type,A=new ua.Layouts[O](h),delete u.preset,A.init(l),[4,A.execute()]);case 1:return z.sent(),e==null||e(),a(),[2,!0]}})})})},t.prototype.layoutWithWorker=function(e,r){var n=this,a=this,i=a.layoutCfg,o=a.graph,u=this.getWorker(),l=this.workerData;if(!u)return!1;l.requestId=null,l.requestId2=null,l.currentTick=null,l.currentTickData=null,o.emit("beforelayout");var h=Promise.resolve(),y=!1;if(i.type)y=!0,h=h.then(function(){return n.runWebworker(u,e,i)});else if(i.pipes){y=!0;for(var O=function(ce){h=h.then(function(){return n.runWebworker(u,e,ce)})},A=0,z=i.pipes;A'),h=n?n.backgroundColor:void 0,y=n?n.padding:void 0;y?(0,s.isNumber)(y)&&(y=[y,y,y,y]):y=[0,0,0,0];var O=i+y[0]+y[2],A=o+y[1]+y[3],z={container:l,height:O,width:A,quickHit:!0},$=u==="svg"?new Wo.Canvas(z):new Ji.Canvas(z),ae=this.get("group"),ce=ae.clone(),ue=(0,s.clone)(ce.getMatrix());ue||(ue=[1,0,0,0,1,0,0,0,1]);var ve=(a.maxX+a.minX)/2,Ce=(a.maxY+a.minY)/2;ue=Ou(ue,[["t",-ve,-Ce],["t",o/2+y[3],i/2+y[0]]]),ce.resetMatrix(),ce.setMatrix(ue),$.add(ce);var Re=$.get("el"),Ve="";r||(r="image/png"),setTimeout(function(){if(u==="svg"){var Ue=Re.cloneNode(!0),$e=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),ot=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",$e);ot.replaceChild(Ue,ot.documentElement);var et=new XMLSerializer().serializeToString(ot);Ve="data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(et))}else{var yt=void 0,Gt=Re.getContext("2d"),yr=void 0;if(h){var kr=typeof window!="undefined"?window.devicePixelRatio:1;try{yt=Gt.getImageData(0,0,A*kr,O*kr),yr=Gt.globalCompositeOperation,Gt.globalCompositeOperation="destination-over",Gt.fillStyle=h,Gt.fillRect(0,0,A,O)}catch(Mr){console.error("Download image failed. Out of memory at ImageData creation")}}Ve=Re.toDataURL(r),h&&(Gt.clearRect(0,0,A,O),Gt.putImageData(yt,0,0),Gt.globalCompositeOperation=yr)}e&&e(Ve)},16)},t.prototype.downloadFullImage=function(e,r,n){var a=this,i=this.get("group").getCanvasBBox(),o=i.height,u=i.width,l=this.get("renderer"),h=(0,ka.Z)('
'),y=document.querySelector(".g6-graph-watermarker"),O=n?n.backgroundColor:void 0,A=n?n.padding:void 0;A?(0,s.isNumber)(A)&&(A=[A,A,A,A]):A=[0,0,0,0];var z=o+A[0]+A[2],$=u+A[1]+A[3];if(y){var ae=this.get("graphWaterMarker").cfg||{},ce=ae.width,ue=ae.height;z=Math.ceil(z/ue)*ue,$=Math.ceil($/ce)*ce}var ve={container:h,height:z,width:$},Ce=l==="svg"?new Wo.Canvas(ve):new Ji.Canvas(ve),Re=this.get("group"),Ve=Tu(Re),Ue=(0,s.clone)(Ve.getMatrix());Ue||(Ue=[1,0,0,0,1,0,0,0,1]);var $e=(i.maxX+i.minX)/2,ot=(i.maxY+i.minY)/2;Ue=Ou(Ue,[["t",-$e,-ot],["t",u/2+A[3],o/2+A[0]]]),Ve.resetMatrix(),Ve.setMatrix(Ue),Ce.add(Ve);var et=Ce.get("el");r||(r="image/png"),this.asyncToDataUrl(r,O,function(yt){var Gt=document.createElement("a"),yr=(e||"graph")+(l==="svg"?".svg":".".concat(r.split("/")[1]));a.dataURLToImage(yt,l,Gt,yr);var kr=document.createEvent("MouseEvents");kr.initEvent("click",!1,!1),Gt.dispatchEvent(kr)},$,z,et)},t.prototype.downloadImage=function(e,r,n){var a=this,i=this;i.stopAnimate();var o=i.get("canvas"),u=o.getRenderer();r||(r="image/png");var l=(e||"graph")+(u==="svg"?".svg":".".concat(r.split("/")[1])),h=document.createElement("a");i.asyncToDataUrl(r,n,function(y){a.dataURLToImage(y,u,h,l);var O=document.createEvent("MouseEvents");O.initEvent("click",!1,!1),h.dispatchEvent(O)})},t.prototype.dataURLToImage=function(e,r,n,a){if(!e||e==="data:"){console.error("Download image failed. The graph is too large or there is invalid attribute values in graph items");return}if(typeof window!="undefined")if(window.Blob&&window.URL&&r!=="svg"){var i=e.split(","),o="";if(i&&i.length>0){var u=i[0].match(/:(.*?);/);u&&u.length>=2&&(o=u[1])}for(var l=atob(i[1]),h=l.length,y=new Uint8Array(h);h--;)y[h]=l.charCodeAt(h);var O=new Blob([y],{type:o});window.navigator.msSaveBlob?window.navigator.msSaveBlob(O,a):n.addEventListener("click",function(){n.download=a,n.href=window.URL.createObjectURL(O)})}else n.addEventListener("click",function(){n.download=a,n.href=e})},t.prototype.addPlugin=function(e){var r=this;e.destroyed||(r.get("plugins").push(e),e.initPlugin(r))},t.prototype.removePlugin=function(e){var r=this.get("plugins"),n=r.indexOf(e);n>=0&&(e.destroyPlugin(),r.splice(n,1))},t.prototype.setImageWaterMarker=function(e,r){e===void 0&&(e=qi.waterMarkerImage);var n=this.get("container");(0,s.isString)(n)&&(n=document.getElementById(n)),n.style.position||(n.style.position="relative");var a=this.get("graphWaterMarker"),i=(0,s.deepMix)({},qi.imageWaterMarkerConfig,r),o=i.width,u=i.height,l=i.compatible,h=i.image;if(!e){var y=l?n:document.querySelector(".g6-graph-watermarker");y&&(y.style.cssText=void 0),a&&a.clear();return}if(a)a.clear();else{var O={container:n,width:o,height:u,capture:!1},A=this.get("pixelRatio");A&&(O.pixelRatio=A,window.devicePixelRatio=A),a=new Ji.Canvas(O),this.set("graphWaterMarker",a)}a.get("el").style.display="none";var z=a.get("context"),$=h.rotate,ae=h.x,ce=h.y;z.rotate(-$*Math.PI/180);var ue=new Image;ue.crossOrigin="anonymous",ue.src=e,ue.onload=function(){if(z.drawImage(ue,ae,ce,h.width,h.height),z.rotate($*Math.PI/180),l)n.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var ve=document.querySelector(".g6-graph-watermarker");ve||(ve=document.createElement("div"),ve.className="g6-graph-watermarker"),ve.className="g6-graph-watermarker",a.destroyed||(ve.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:-1;"),n.appendChild(ve))}}},t.prototype.setTextWaterMarker=function(e,r){var n=this.get("container");(0,s.isString)(n)&&(n=document.getElementById(n)),n.style.position||(n.style.position="relative");var a=this.get("graphWaterMarker"),i=(0,s.deepMix)({},qi.textWaterMarkerConfig,r),o=i.width,u=i.height,l=i.compatible,h=i.text;if(!(e!=null&&e.length)){var y=l?n:document.querySelector(".g6-graph-watermarker");y&&(y.style.cssText=void 0),a&&a.clear();return}if(a)a.clear();else{var O={container:n,width:o,height:u,capture:!1},A=this.get("pixelRatio");A&&(O.pixelRatio=A,window.devicePixelRatio=A),a=new Ji.Canvas(O),this.set("graphWaterMarker",a)}a.get("el").style.display="none";var z=a.get("context"),$=h.rotate,ae=h.fill,ce=h.fontFamily,ue=h.fontSize,ve=h.baseline,Ce=h.x,Re=h.y,Ve=h.lineHeight;z.rotate(-$*Math.PI/180),z.font="".concat(ue,"px ").concat(ce),z.fillStyle=ae,z.textBaseline=ve;for(var Ue=(0,s.isString)(e)?[e]:e,$e=Ue.length-1;$e>=0;$e--)z.fillText(Ue[$e],Ce,Re+$e*Ve);if(z.rotate($*Math.PI/180),l)n.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;");else{var ot=document.querySelector(".g6-graph-watermarker");ot||(ot=document.createElement("div"),ot.className="g6-graph-watermarker"),ot.style.cssText="background-image: url(".concat(a.get("el").toDataURL("image/png"),");background-repeat:repeat;position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;z-index:99;"),n.appendChild(ot)}},t.prototype.destroy=function(){var e,r,n,a;(0,s.each)(this.get("plugins"),function(h){h.destroyPlugin()});var i=this.get("tooltips");if(i)for(var o=0;o0)for(var l=o.length-1;l>=0;l--){var h=o[l].getModel();t.indexOfChild(e.children||[],h.id)===-1&&(a.innerRemoveChild(h.id,{x:e.x,y:e.y},n),o.splice(l,1))}}var y,O;i.get("originAttrs")&&(y=i.get("originAttrs").x,O=i.get("originAttrs").y);var A=i.getModel();n&&i.set("originAttrs",{x:A.x,y:A.y}),i.set("model",Object.assign(A,e.data)),(y!==e.x||O!==e.y)&&i.updatePosition({x:e.x,y:e.y})},t.prototype.innerRemoveChild=function(e,r,n){var a=this,i=a.findById(e);if(i)if((0,s.each)(i.get("children"),function(u){a.innerRemoveChild(u.getModel().id,r,n)}),n){var o=i.getModel();i.set("to",r),i.set("originAttrs",{x:o.x,y:o.y}),a.get("removeList").push(i)}else a.removeItem(i,!1)},t.prototype.changeData=function(e,r){r===void 0&&(r=!0);var n=this;this.getNodes().map(function(a){return n.clearItemStates(a)}),this.getEdges().map(function(a){return n.clearItemStates(a)}),r&&this.get("enabledStack")&&this.pushStack("changedata",{before:n.get("originData"),after:e||n.get("data")}),e?(n.data(e),n.render(!1)):n.layout(this.get("fitView"))},t.prototype.changeLayout=function(e){console.warn("Please call updateLayout instead of changeLayout. changeLayout will be discarded soon");var r=this;r.updateLayout(e)},t.prototype.updateLayout=function(e,r,n,a){a===void 0&&(a=!0);var i=this;if(!e){console.warn("layout cannot be null");return}if(a&&this.get("enabledStack")&&this.pushStack("layout",{before:i.get("layout"),after:e}),i.set("layout",e),i.set("layoutMethod",i.getLayout()),i.layout(),r){var o=n;o||(r==="begin"?o={x:0,y:0}:o={x:this.getWidth()/2,y:this.getHeight()/2}),o=this.getPointByCanvas(o.x,o.y);var u=this.getGroup().getMatrix()||[1,0,0,0,1,0,0,0,1];o.x=o.x*u[0]+u[6],o.y=o.y*u[0]+u[7];var l=this.getGroup().getCanvasBBox(),h=l.minX,y=l.maxX,O=l.minY,A=l.maxY,z={x:(h+y)/2,y:(O+A)/2};r==="begin"&&(z.x=h,z.y=O),this.translate(o.x-z.x,o.y-z.y)}},t.prototype.refreshLayout=function(e){console.warn("Please call layout instead of refreshLayout. refreshLayout will be discarded soon");var r=this;r.layout(e)},t.prototype.layout=function(e){var r=this,n=this,a=n.get("data"),i=n.get("layoutMethod"),o=n.get("layout"),u=a;if(o!=null&&o.excludeInvisibles){a=(0,s.clone)(n.get("data"));var l={};Vf(a,function(O){var A=O.children;if(!(A!=null&&A.length))return!0;for(var z=A.length-1;z>=0;z--){var $=r.findById(A[z].id),ae=$?!$.isVisible():A[z].visible===!1;ae&&(l[O.id]=l[O.id]||[],l[O.id].push({idx:z,child:A.splice(z,1)[0]}))}}),u=i?i(a,n.get("layout")):a,Vf(u,function(O){var A=l[O.id];if(A!=null&&A.length)for(var z=A.length-1;z>=0;z--){var $=A[z],ae=$.idx,ce=$.child;O.children.splice(ae,0,ce)}})}else u=i?i(a,n.get("layout")):a;var h=n.get("animate");if(n.emit("beforerefreshlayout",{data:a,layoutData:u}),n.emit("beforelayout"),n.innerUpdateChild(u,void 0,h),e){var y=n.get("viewController");y.fitView()}h?n.layoutAnimate(u):(n.refresh(),n.paint()),n.emit("afterrefreshlayout",{data:a,layoutData:u}),n.emit("afterlayout")},t.prototype.addChild=function(e,r,n){n===void 0&&(n=!0);var a=this;a.emit("beforeaddchild",{model:e,parent:r}),(0,s.isString)(r)||(r=r.get("id"));var i=a.findDataById(r);if(i){i.children||(i.children=[]),i.children.push(e);var o=a.findById(r);o.refresh(),a.changeData(void 0,n)}},t.prototype.updateChildren=function(e,r,n){n===void 0&&(n=!0);var a=this,i=a.findById(r);if(!r||!i){console.warn("Update children failed! There is no node with id '".concat(r,"'"));return}var o=a.findDataById(r);o.children=e,i.refresh(),a.changeData(void 0,n)},t.prototype.updateChild=function(e,r,n){n===void 0&&(n=!0);var a=this;if(!r||!a.findById(r)){a.changeData(e,n);return}var i=a.findDataById(r),o=a.findById(e.id);if(i.children||(i.children=[]),!o)i.children.push(e);else{var u=t.indexOfChild(i.children,e.id);u>-1&&(i.children[u]=e)}var l=a.findById(r);l==null||l.refresh(),a.changeData(void 0,n)},t.prototype.removeChild=function(e,r){r===void 0&&(r=!0);var n=this,a=n.findById(e),i;if(a?i=a==null?void 0:a.get("parent"):i=n.getNodes().find(function(y){var O=y.getModel().children||[];return!!O.find(function(A){return A.id===e})}),i&&!i.destroyed){var o=i.get("id"),u=n.findDataById(o),l=u&&u.children||[],h=t.indexOfChild(l,e);l.splice(h,1),i.refresh()}n.changeData(void 0,r)},t.prototype.findDataById=function(e,r){var n=this;if(r||(r=n.get("data")),e===r.id)return r;var a=null;return(0,s.each)(r.children||[],function(i){if(i.id===e)return a=i,!1;if(a=n.findDataById(e,i),a)return!1}),a},t.prototype.layoutAnimate=function(e,r){var n=this,a=this.get("animateCfg");n.emit("beforeanimate",{data:e}),n.getEdges().forEach(function(i){var o=i.get("model");o.sourceAnchor||(o.sourceAnchor=i.get("sourceAnchorIndex"))}),this.get("canvas").animate(function(i){Vf(e,function(o){var u=n.findById(o.id);if(u){var l=u.get("originAttrs"),h=u.get("model");if(l||(l={x:h.x,y:h.y},u.set("originAttrs",l)),r){var y=r(u,i,l,e);u.set("model",Object.assign(h,y))}else h.x=l.x+(o.x-l.x)*i,h.y=l.y+(o.y-l.y)*i}return!0}),(0,s.each)(n.get("removeList"),function(o){var u=o.getModel(),l=o.get("originAttrs"),h=o.get("to");u.x=l.x+(h.x-l.x)*i,u.y=l.y+(h.y-l.y)*i}),n.refreshPositions()},{duration:a.duration,easing:a.ease,callback:function(){(0,s.each)(n.getNodes(),function(o){o.set("originAttrs",null)}),(0,s.each)(n.get("removeList"),function(o){n.removeItem(o,!1)}),n.set("removeList",[]),a.callback&&a.callback(),n.emit("afteranimate",{data:e})},delay:a.delay})},t.prototype.stopLayoutAnimate=function(){this.get("canvas").stopAnimate(),this.emit("layoutanimateend",{data:this.get("data")}),this.layoutAnimating=!1},t.prototype.isLayoutAnimating=function(){return this.layoutAnimating},t.prototype.render=function(e){e===void 0&&(e=!0);var r=this,n=r.get("data");if(!n||!(0,s.isObject)(n)||!Object.keys(n).length)throw new Error("data must be defined first");r.clear(),e&&this.get("enabledStack")&&this.clearStack(),r.emit("beforerender"),r.layout(this.get("fitView")),r.emit("afterrender")},t.prototype.save=function(){return this.get("data")},t.prototype.data=function(e){E.prototype.data.call(this,e),this.set("originData",cf(e))},t}(Du),hl=Yf,aa=F(10818),vl=function(){function E(t){this._cfgs=(0,s.deepMix)(this.getDefaultCfgs(),t),this._events={},this.destroyed=!1}return E.prototype.getDefaultCfgs=function(){return{}},E.prototype.initPlugin=function(t){var e=this;e.set("graph",t);var r=e.getEvents(),n={};(0,s.each)(r,function(a,i){var o=(0,s.wrapBehavior)(e,a);n[i]=o,t.on(i,o)}),this._events=n,this.init()},E.prototype.getEvents=function(){return{}},E.prototype.get=function(t){var e;return(e=this._cfgs)===null||e===void 0?void 0:e[t]},E.prototype.set=function(t,e){this._cfgs[t]=e},E.prototype.destroy=function(){},E.prototype.destroyPlugin=function(){this.destroy();var t=this.get("graph"),e=this._events;(0,s.each)(e,function(r,n){t.off(n,r)}),this._events=null,this._cfgs=null,this.destroyed=!0},E}(),si=vl,Vc=function(){var E=function(e,r){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},E(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");E(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ic="url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGRlZnM+PHBhdHRlcm4gaWQ9ImdyaWQiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgcGF0dGVyblVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHBhdGggZD0iTSAwIDEwIEwgNDAgMTAgTSAxMCAwIEwgMTAgNDAgTSAwIDIwIEwgNDAgMjAgTSAyMCAwIEwgMjAgNDAgTSAwIDMwIEwgNDAgMzAgTSAzMCAwIEwgMzAgNDAiIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2UwZTBlMCIgb3BhY2l0eT0iMC4yIiBzdHJva2Utd2lkdGg9IjEiLz48cGF0aCBkPSJNIDQwIDAgTCAwIDAgMCA0MCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZTBlMGUwIiBzdHJva2Utd2lkdGg9IjEiLz48L3BhdHRlcm4+PC9kZWZzPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjZ3JpZCkiLz48L3N2Zz4=)",Yc=function(E){Vc(t,E);function t(e){return E.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{img:Ic,follow:!0}},t.prototype.init=function(){var e=this.get("graph"),r=e.get("container"),n=e.get("canvas").get("el"),a=this.get("img")||Ic;a.includes("url(")||(a='url("'.concat(a,'")'));var i=(0,ka.Z)(`
`),o=(0,ka.Z)(`
`));this.set("container",i),this.set("gridContainer",o),this.positionInit(),i.appendChild(o),r.insertBefore(i,n)},t.prototype.positionInit=function(){var e=this.get("graph"),r=e.get("minZoom"),n=e.get("width"),a=e.get("height");(0,aa.Z)(this.get("container"),{width:"".concat(n,"px"),height:"".concat(a,"px")});var i=n*80/r,o=a*80/r;(0,aa.Z)(this.get("gridContainer"),{width:"".concat(i,"px"),height:"".concat(o,"px"),left:"-".concat(i/2,"px"),top:"-".concat(o/2,"px")})},t.prototype.getEvents=function(){return{viewportchange:"updateGrid"}},t.prototype.updateGrid=function(e){var r=this.get("gridContainer"),n=e.matrix;n||(n=[1,0,0,0,1,0,0,0,1]);var a=this.get("follow"),i="matrix(".concat(n[0],", ").concat(n[1],", ").concat(n[3],", ").concat(n[4],", ").concat(a?n[6]:"0",", ").concat(a?n[7]:"0",")");(0,aa.Z)(r,{transform:i})},t.prototype.getContainer=function(){return this.get("container")},t.prototype.destroy=function(){var e=this.get("graph"),r=e.get("container"),n=this.get("container");r.removeChild(n)},t}(si),gl=Yc,Hc=F(89486),Hf=F.n(Hc),Ti=function(){var E=function(e,r){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},E(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");E(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}();typeof document!="undefined"&&Hf()(` .g6-component-contextmenu { border: 1px solid #e2e2e2; border-radius: 4px; font-size: 12px; color: #545454; background-color: rgba(255, 255, 255, 0.9); padding: 10px 8px; box-shadow: rgb(174, 174, 174) 0px 0px 10px; } .g6-contextmenu-ul { padding: 0; margin: 0; list-style: none; } `);var Zc=function(E){Ti(t,E);function t(e){return E.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{offsetX:6,offsetY:6,handleMenuClick:void 0,getContent:function(r){return`
  • \u83DC\u5355\u98791
  • \u83DC\u5355\u98792
`},shouldBegin:function(r){return!0},onHide:function(){return!0},itemTypes:["node","edge","combo"],trigger:"contextmenu"}},t.prototype.getEvents=function(){return this.get("trigger")==="click"?{click:"onMenuShow",touchend:"onMenuShow"}:{contextmenu:"onMenuShow"}},t.prototype.init=function(){var e=this.get("className"),r=(0,ka.Z)("
"));(0,aa.Z)(r,{top:"0px",position:"absolute",visibility:"hidden"});var n=this.get("container");n||(n=this.get("graph").get("container")),(0,s.isString)(n)&&(n=document.getElementById(n)),n.appendChild(r),this.set("menu",r)},t.prototype.onMenuShow=function(e){var r=this;e.preventDefault();var n=this.get("itemTypes");if(e.item){if(e.item&&e.item.getType&&n.indexOf(e.item.getType())===-1){r.onMenuHide();return}}else if(n.indexOf("canvas")===-1){r.onMenuHide();return}var a=this.get("shouldBegin");if(a(e)){var i=this.get("menu"),o=this.get("getContent"),u=this.get("graph"),l=o(e,u);(0,s.isString)(l)?i.innerHTML=l:i.innerHTML=l.outerHTML,this.removeMenuEventListener();var h=this.get("handleMenuClick");if(h){var y=function($e){h($e.target,e.item,u)};this.set("handleMenuClickWrapper",y),i.addEventListener("click",y)}var O=u.get("width"),A=u.get("height"),z=i.getBoundingClientRect(),$=this.get("offsetX")||0,ae=this.get("offsetY")||0,ce=u.getContainer().offsetTop,ue=u.getContainer().offsetLeft,ve=e.canvasX+ue+$,Ce=e.canvasY+ce+ae;ve+z.width>O&&(ve=e.canvasX-z.width-$+ue),Ce+z.height>A&&(Ce=e.canvasY-z.height-ae+ce),Ce<0&&(Ce=0),(0,aa.Z)(i,{top:"".concat(Ce,"px"),left:"".concat(ve,"px"),visibility:"visible"});var Re=this.get("trigger")==="click",Ve=function($e){if(Re){Re=!1;return}r.onMenuHide()};document.body.addEventListener("click",Ve),this.set("handler",Ve)}},t.prototype.removeMenuEventListener=function(){var e=this.get("handleMenuClickWrapper"),r=this.get("handler");if(e){var n=this.get("menu");n.removeEventListener("click",e),this.set("handleMenuClickWrapper",null)}r&&document.body.removeEventListener("click",r)},t.prototype.onMenuHide=function(){var e=this.get("menu");e&&(0,aa.Z)(e,{visibility:"hidden"}),this.removeMenuEventListener()},t.prototype.destroy=function(){var e=this.get("menu");if(this.removeMenuEventListener(),e){var r=this.get("container");r||(r=this.get("graph").get("container")),(0,s.isString)(r)&&(r=document.getElementById(r)),r.removeChild(e)}},t}(si),Nu=Zc,Ts=function(){var E=function(e,r){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},E(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");E(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),Zf=function(){return Zf=Object.assign||function(E){for(var t,e=1,r=arguments.length;e-1,l=navigator.userAgent.toLowerCase().indexOf("safari")>-1,h=(0,ka.Z)(`
`)),y=0,O=0,A=!1,z=0,$=0,ae=0,ce=0,ue=0,ve=0,Ce=l||u?"mousedown":"dragstart";h.addEventListener(Ce,function($e){var ot,et;if($e.dataTransfer){var yt=new Image;yt.src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' %3E%3Cpath /%3E%3C/svg%3E",(et=(ot=$e.dataTransfer).setDragImage)===null||et===void 0||et.call(ot,yt,0,0);try{$e.dataTransfer.setData("text/html","view-port-minimap")}catch(yr){$e.dataTransfer.setData("text","view-port-minimap")}}if(r.refresh=!1,$e.target===h){var Gt=h.style;z=parseInt(Gt.left,10),$=parseInt(Gt.top,10),ae=parseInt(Gt.width,10),ce=parseInt(Gt.height,10),!(ae>n[0]||ce>n[1])&&(ve=a.getZoom(),ue=e.get("ratio"),A=!0,y=$e.clientX,O=$e.clientY)}},!1);var Re=function(ot){if(!(!A||(0,s.isNil)(ot.clientX)||(0,s.isNil)(ot.clientY))){var et=y-ot.clientX,yt=O-ot.clientY;(z-et<0||z-et+ae>=n[0])&&(et=0),($-yt<0||$-yt+ce>=n[1])&&(yt=0),z-=et,$-=yt,(0,aa.Z)(h,{left:"".concat(z,"px"),top:"".concat($,"px")}),a.translate(et*ve/ue,yt*ve/ue),y=ot.clientX,O=ot.clientY}};!l&&!u&&h.addEventListener("drag",Re,!1);var Ve=function(){A=!1,r.refresh=!0},Ue=l||u?"mouseup":"dragend";h.addEventListener(Ue,Ve,!1),o.addEventListener("mouseleave",Ve),o.addEventListener("mouseup",Ve),(l||u)&&o.addEventListener("mousemove",Re,!1),this.set("viewport",h),o.appendChild(h)}},t.prototype.updateViewport=function(){if(!this.destroyed){var e=this.get("ratio"),r=this.get("totaldx"),n=this.get("totaldy"),a=this.get("graph"),i=this.get("size"),o=a.get("canvas").get("el"),u=a.get("width")||o.scrollWidth||500,l=a.get("height")||o.scrollHeight||500,h=a.getPointByCanvas(0,0),y=a.getPointByCanvas(u,l),O=this.get("viewport");O||this.initViewport();var A=(y.x-h.x)*e,z=(y.y-h.y)*e,$=h.x*e+r,ae=h.y*e+n,ce=$+A,ue=ae+z;$<0&&(A+=$,$=0),ce>i[0]&&(A=A-(ce-i[0])),ae<0&&(z+=ae,ae=0),ue>i[1]&&(z=z-(ue-i[1])),this.set("ratio",e);var ve="".concat($,"px"),Ce="".concat(ae,"px");(0,aa.Z)(O,{left:ve,top:Ce,width:"".concat(A,"px"),height:"".concat(z,"px")})}},t.prototype.updateGraphShapes=function(){var e=this._cfgs.graph,r=this.get("canvas"),n=e.get("group");if(!n.destroyed){r.clear();var a;this.get("hideEdge")?(a=r.addGroup(),n.get("children").forEach(function(o){o.get("id").includes("-edge")||a.add(o.clone())})):(a=n.clone(),a.resetMatrix(),r.add(a));var i=e.get("renderer");i===Ja&&this.updateVisible(a)}},t.prototype.updateVisible=function(e){var r=this;if(!e.isGroup()&&!e.get("visible"))e.hide();else{var n=e.get("children");if(!n||!n.length)return;n.forEach(function(a){a.get("visible")||a.hide(),r.updateVisible(a)})}},t.prototype.updateKeyShapes=function(){var e=this,r=this._cfgs.graph,n=this.get("canvas"),a=n.get("children")[0]||n.addGroup();this.get("hideEdge")||(0,s.each)(r.getEdges(),function(u){e.updateOneEdgeKeyShape(u,a)}),(0,s.each)(r.getNodes(),function(u){e.updateOneNodeKeyShape(u,a)});var i=r.getCombos();if(i&&i.length){var o=a.find(function(u){return u.get("name")==="comboGroup"})||a.addGroup({name:"comboGroup"});setTimeout(function(){e.destroyed||((0,s.each)(i,function(u){e.updateOneComboKeyShape(u,o)}),o==null||o.sort(),o==null||o.toBack(),e.updateCanvas())},250)}this.clearDestroyedShapes()},t.prototype.updateOneComboKeyShape=function(e,r){if(!this.destroyed){var n=this.get("itemMap")||{},a=n[e.get("id")],i=e.getBBox(),o=e.get("keyShape").clone(),u=o.attr(),l={x:i.centerX,y:i.centerY};a?l=Object.assign(u,l):(a=o,r.add(a));var h=a.get("type");(h==="rect"||h==="image")&&(l.x=i.minX,l.y=i.minY),a.attr(l),e.isVisible()?a.show():a.hide(),a.exist=!0;var y=e.getModel().depth;isNaN(y)||a.set("zIndex",y),n[e.get("id")]=a,this.set("itemMap",n)}},t.prototype.updateOneNodeKeyShape=function(e,r){var n=this.get("itemMap")||{},a=n[e.get("id")],i=e.getBBox(),o=e.get("keyShape").clone(),u=o.attr(),l={x:i.centerX,y:i.centerY};a?(l=Object.assign(u,l),a.toFront()):(a=o,r.add(a));var h=a.get("type");(h==="rect"||h==="image")&&(l.x=i.minX,l.y=i.minY),a.attr(l),e.isVisible()?a.show():a.hide(),a.exist=!0;var y=e.getModel().depth;isNaN(y)||a.set("zIndex",y),n[e.get("id")]=a,this.set("itemMap",n)},t.prototype.updateDelegateShapes=function(){var e=this,r=this._cfgs.graph,n=this.get("canvas"),a=n.get("children")[0]||n.addGroup();this.get("hideEdge")||(0,s.each)(r.getEdges(),function(u){e.updateOneEdgeKeyShape(u,a)}),(0,s.each)(r.getNodes(),function(u){e.updateOneNodeDelegateShape(u,a)});var i=r.getCombos();if(i&&i.length){var o=a.find(function(u){return u.get("name")==="comboGroup"})||a.addGroup({name:"comboGroup"});setTimeout(function(){e.destroyed||((0,s.each)(i,function(u){e.updateOneComboKeyShape(u,o)}),o==null||o.sort(),o==null||o.toBack(),e.updateCanvas())},250)}this.clearDestroyedShapes()},t.prototype.clearDestroyedShapes=function(){var e=this.get("itemMap")||{},r=Object.keys(e);if(!(!r||r.length===0))for(var n=r.length-1;n>=0;n--){var a=e[r[n]],i=a.exist;a.exist=!1,i||(a.remove(),delete e[r[n]])}},t.prototype.updateOneEdgeKeyShape=function(e,r){var n=this.get("itemMap")||{},a=n[e.get("id")];if(a){var i=e.get("keyShape").attr("path");a.attr("path",i)}else a=e.get("keyShape").clone(),r.add(a);e.isVisible()?a.show():a.hide(),a.exist=!0,n[e.get("id")]=a,this.set("itemMap",n)},t.prototype.updateOneNodeDelegateShape=function(e,r){var n=this.get("delegateStyle"),a=this.get("itemMap")||{},i=a[e.get("id")],o=e.getBBox();if(i){var u={x:o.minX,y:o.minY,width:o.width,height:o.height};i.attr(u),i.toFront()}else i=r.addShape("rect",{attrs:Zf({x:o.minX,y:o.minY,width:o.width,height:o.height},n),name:"minimap-node-shape"});e.isVisible()?i.show():i.hide(),i.exist=!0,a[e.get("id")]=i,this.set("itemMap",a)},t.prototype.init=function(){this.initContainer(),this.get("graph").on("afterupdateitem",this.handleUpdateCanvas),this.get("graph").on("afteritemstatechange",this.handleUpdateCanvas),this.get("graph").on("afteradditem",this.handleUpdateCanvas),this.get("graph").on("afterremoveitem",this.handleUpdateCanvas),this.get("graph").on("afterrender",this.handleUpdateCanvas),this.get("graph").on("afterlayout",this.handleUpdateCanvas)},t.prototype.initContainer=function(){var e=this,r=e.get("graph"),n=e.get("size"),a=e.get("className"),i=e.get("container"),o=(0,ka.Z)("
"));(0,s.isString)(i)&&(i=document.getElementById(i)),i?i.appendChild(o):r.get("container").appendChild(o),e.set("container",o);var u=(0,ka.Z)('
');o.appendChild(u),u.addEventListener("dragenter",function(y){y.preventDefault()}),u.addEventListener("dragover",function(y){y.preventDefault()});var l,h=r.get("renderer");h===Ja?l=new Wo.Canvas({container:u,width:n[0],height:n[1]}):l=new Ji.Canvas({container:u,width:n[0],height:n[1]}),e.set("canvas",l),e.updateCanvas()},t.prototype.updateCanvas=function(){if(!this.destroyed){var e=this.get("refresh");if(e){var r=this.get("graph");if(!r.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var n=this.get("size"),a=this.get("canvas"),i=this.get("type"),o=this.get("padding");if(!a.destroyed){switch(i){case Kc:this.updateGraphShapes();break;case Yi:this.updateKeyShapes();break;case Is:this.updateDelegateShapes();break;default:break}var u=a.get("children")[0];if(u){u.resetMatrix();var l=u.getCanvasBBox(),h=r.get("canvas").getCanvasBBox(),y=r.getZoom()||1,O=h.width/y,A=h.height/y;Number.isFinite(l.width)&&(O=Kf(l.width,O),A=Kf(l.height,A)),O+=2*o,A+=2*o;var z=Math.min(n[0]/O,n[1]/A),$=[1,0,0,0,1,0,0,0,1],ae=0,ce=0;Number.isFinite(l.minX)&&(ae=-l.minX),Number.isFinite(l.minY)&&(ce=-l.minY);var ue=(n[0]-(O-2*o)*z)/2,ve=(n[1]-(A-2*o)*z)/2;$=$f($,[["t",ae,ce],["s",z,z],["t",ue,ve]]),u.setMatrix($),this.set("ratio",z),this.set("totaldx",ue+ae*z),this.set("totaldy",ve+ce*z),this.set("dx",ue),this.set("dy",ve),this.updateViewport()}}}}}},t.prototype.getCanvas=function(){return this.get("canvas")},t.prototype.getViewport=function(){return this.get("viewport")},t.prototype.getContainer=function(){return this.get("container")},t.prototype.destroy=function(){var e;(e=this.get("canvas"))===null||e===void 0||e.destroy();var r=this.get("container");r!=null&&r.parentNode&&r.parentNode.removeChild(r)},t}(si),Qf=Li,pl=function(){var E=function(e,r){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},E(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");E(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}();function Ao(E,t,e){var r=E.x-t.x,n=E.y-t.y;return!e||Math.abs(r)>e||Math.abs(n)>e?Math.sqrt(r*r+n*n):e}function yl(E,t){return E.x*t.x+E.y*t.y}function $c(E,t){var e=(t.source.y-t.target.y)/(t.source.x-t.target.x),r=(e*e*t.source.x+e*(E.y-t.source.y)+E.x)/(e*e+1),n=e*(r-t.source.x)+t.source.y;return{x:r,y:n}}var Qc=function(E){pl(t,E);function t(e){return E.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{edgeBundles:[],edgePoints:[],K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:.6666667,bundleThreshold:.6,eps:1e-6,onLayoutEnd:function(){},onTick:function(){}}},t.prototype.init=function(){var e=this.get("graph"),r=this.get("onTick"),n=function(){r&&r(),e.refreshPositions()};this.set("tick",n)},t.prototype.bundling=function(e){var r=this;if(r.set("data",e),!r.isTicking()){var n=e.edges||[],a=e.nodes||[],i={},o=!1;if(a.forEach(function(Ce){(Ce.x===null||!Ce.y===null||Ce.x===void 0||!Ce.y===void 0)&&(o=!0),i[Ce.id]=Ce}),o)throw new Error("please layout the graph or assign x and y for nodes first");r.set("nodeIdMap",i);var u=r.get("divisions"),l=r.get("divRate"),h=r.divideEdges(u);r.set("edgePoints",h);var y=r.getEdgeBundles();r.set("edgeBundles",y);for(var O=r.get("cycles"),A=r.get("iterations"),z=r.get("iterRate"),$=r.get("lambda"),ae=0;aez;){var ve=z/ue,Ce={x:i[u][ce-1].x,y:i[u][ce-1].y};Ce.x+=ve*(ae.x-i[u][ce-1].x),Ce.y+=ve*(ae.y-i[u][ce-1].y),$.push(Ce),ue-=z,z=A}z-=ue}}),$.push({x:y.x,y:y.y}),i[u]=$}}),i},t.prototype.getEdgeLength=function(e){var r=0;return e.forEach(function(n,a){a!==0&&(r+=Ao(n,e[a-1]))}),r},t.prototype.getEdgeBundles=function(){var e=this,r=e.get("data"),n=r.edges||[],a=e.get("bundleThreshold"),i=e.get("nodeIdMap"),o=e.get("edgeBundles");return o||(o=[]),n.forEach(function(u,l){(!o[l]||o[l]===void 0)&&(o[l]=[])}),n.forEach(function(u,l){var h=i[u.source],y=i[u.target];n.forEach(function(O,A){if(!(A<=l)){var z=i[O.source],$=i[O.target],ae=e.getBundleScore({source:h,target:y},{source:z,target:$});ae>=a&&(o[l].push(A),o[A].push(l))}})}),o},t.prototype.getBundleScore=function(e,r){var n=this;e.vx=e.target.x-e.source.x,e.vy=e.target.y-e.source.y,r.vx=r.target.x-r.source.x,r.vy=r.target.y-r.source.y,e.length=Ao({x:e.source.x,y:e.source.y},{x:e.target.x,y:e.target.y}),r.length=Ao({x:r.source.x,y:r.source.y},{x:r.target.x,y:r.target.y});var a=n.getAngleScore(e,r),i=n.getScaleScore(e,r),o=n.getPositionScore(e,r),u=n.getVisibilityScore(e,r);return a*i*o*u},t.prototype.getAngleScore=function(e,r){var n=yl({x:e.vx,y:e.vy},{x:r.vx,y:r.vy});return n/(e.length*r.length)},t.prototype.getScaleScore=function(e,r){var n=(e.length+r.length)/2,a=2/(n/Math.min(e.length,r.length)+Math.max(e.length,r.length)/n);return a},t.prototype.getPositionScore=function(e,r){var n=(e.length+r.length)/2,a={x:(e.source.x+e.target.x)/2,y:(e.source.y+e.target.y)/2},i={x:(r.source.x+r.target.x)/2,y:(r.source.y+r.target.y)/2},o=Ao(a,i);return n/(n+o)},t.prototype.getVisibilityScore=function(e,r){var n=this.getEdgeVisibility(e,r),a=this.getEdgeVisibility(r,e);return na||Math.abs(y.y)>a){var O=Ao(o[h][e],o[r][e]),A=1/O;l.x+=y.x*A,l.y+=y.y*A}}),l},t.prototype.isTicking=function(){return this.get("ticking")},t.prototype.getSimulation=function(){return this.get("forceSimulation")},t.prototype.destroy=function(){this.get("ticking")&&this.getSimulation().stop(),E.prototype.destroy.call(this)},t}(si),ml=Qc,bl=function(){var E=function(e,r){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},E(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");E(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ac=function(){return Ac=Object.assign||function(E){for(var t,e=1,r=arguments.length;e(l||n.get("height"))&&a>1||y<(h||n.get("height")*.05)&&a<1)&&(a=1),y*=a,r.set("r",y),r.set("r2",y*y);var O=r.get("d");r.set("molecularParam",(O+1)*y),r.set("delegateCenterDiff",void 0),r.magnify(e,u)}},t.prototype.scaleRByDrag=function(e){var r=this;if(e){var n=r.get("dragPrePos"),a=r.get("graph"),i,o=a.getPointByClient(e.clientX,e.clientY);e.x-n.x<0?i=1-Jf:i=1/(1-Jf);var u=r.get("maxR"),l=r.get("minR"),h=r.get("r");(h>(u||a.get("height"))&&i>1||h<(l||a.get("height")*.05)&&i<1)&&(i=1),h*=i,r.set("r",h),r.set("r2",h*h);var y=r.get("d");r.set("molecularParam",(y+1)*h),r.magnify(e,o),r.set("dragPrePos",{x:e.x,y:e.y})}},t.prototype.scaleDByWheel=function(e){var r=this;if(!(!e&&!e.originalEvent)){e.preventDefault&&e.preventDefault();var n=0;e.originalEvent.wheelDelta<0?n=-.1:n=.1;var a=r.get("d"),i=a+n,o=r.get("maxD"),u=r.get("minD");if(iu){r.set("d",i);var l=r.get("r");r.set("molecularParam",(i+1)*l);var h=r.get("delegate"),y=h?{x:h.attr("x"),y:h.attr("y")}:void 0;r.set("delegateCenterDiff",void 0),r.magnify(e,y)}}},t.prototype.scaleDByDrag=function(e){var r=this,n=r.get("dragPrePos"),a=e.x-n.x>0?.1:-.1,i=r.get("d"),o=i+a,u=r.get("maxD"),l=r.get("minD");if(ol){r.set("d",o);var h=r.get("r");r.set("molecularParam",(o+1)*h),r.magnify(e)}r.set("dragPrePos",{x:e.x,y:e.y})},t.prototype.magnify=function(e,r){var n=this;n.restoreCache();var a=n.get("graph"),i=n.get("cachedMagnifiedModels"),o=n.get("cachedOriginPositions"),u=n.get("showLabel"),l=n.get("r"),h=n.get("r2"),y=n.get("d"),O=n.get("molecularParam"),A=a.getNodes(),z=A.length,$=r?{x:r.x,y:r.y}:{x:e.x,y:e.y};n.get("dragging")&&(n.get("trigger")==="mousemove"||n.get("trigger")==="click")&&($=n.get("cacheCenter"));var ae=n.get("delegateCenterDiff");ae&&($.x+=ae.x,$.y+=ae.y),n.updateDelegate($,l);for(var ce=0;ce
  • `},zoomSensitivity:2}},t.prototype.init=function(){var e=this,r=this.get("graph"),n=this.get("getContent"),a=n(r),i=a;(0,s.isString)(a)&&(i=(0,ka.Z)(a));var o=this.get("className");i.setAttribute("class",o||"g6-component-toolbar");var u=this.get("container");u||(u=this.get("graph").get("container")),(0,s.isString)(u)&&(u=document.getElementById(u)),u.appendChild(i),this.set("toolBar",i);var l=this.get("handleClick");i.addEventListener("click",function(y){var O=el(y).filter(function(z){return z.nodeName==="LI"});if(O.length!==0){var A=O[0].getAttribute("code");A&&(l?l(A,r):e.handleDefaultOperator(A))}});var h=this.get("position");h&&(0,aa.Z)(i,{top:"".concat(h.y,"px"),left:"".concat(h.x,"px")}),this.bindUndoRedo()},t.prototype.bindUndoRedo=function(){var e=this.get("graph"),r=document.querySelector('.g6-component-toolbar li[code="undo"]'),n=document.querySelector('.g6-component-toolbar li[code="undo"] svg'),a=document.querySelector('.g6-component-toolbar li[code="redo"]'),i=document.querySelector('.g6-component-toolbar li[code="redo"] svg');!r||!n||!a||!i||(r.setAttribute("style","cursor: not-allowed"),n.setAttribute("style","opacity: 0.4"),a.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4"),e.on("stackchange",function(o){var u=o.undoStack,l=o.redoStack,h=u.length,y=l.length;h===0?(r.setAttribute("style","cursor: not-allowed"),n.setAttribute("style","opacity: 0.4")):(r.removeAttribute("style"),n.removeAttribute("style")),y===0?(a.setAttribute("style","cursor: not-allowed"),i.setAttribute("style","opacity: 0.4")):(a.removeAttribute("style"),i.removeAttribute("style"))}))},t.prototype.undo=function(){var e=this.get("graph"),r=e.getUndoStack();if(!(!r||r.length===0)){var n=r.pop();if(n){var a=n.action;e.pushStack(a,(0,s.clone)(n.data),"redo");var i=n.data.before;if(a==="add"&&(i=n.data.after),!i)return;switch(a){case"visible":{Object.keys(i).forEach(function(y){var O=i[y];O&&O.forEach(function(A){var z=e.findById(A.id);A.visible?e.showItem(z,!1):e.hideItem(z,!1)})});break}case"render":case"update":Object.keys(i).forEach(function(y){var O=i[y];O&&O.forEach(function(A){var z=e.findById(A.id);delete A.id,e.updateItem(z,A,!1),z.getType()==="combo"&&e.updateCombo(z)})});break;case"changedata":e.changeData(i,!1);break;case"delete":{Object.keys(i).forEach(function(y){var O=i[y];O&&O.forEach(function(A){var z=A.itemType;delete A.itemType,e.addItem(z,A,!1)})});break}case"add":Object.keys(i).forEach(function(y){var O=i[y];O&&O.forEach(function(A){e.removeItem(A.id,!1)})});break;case"updateComboTree":Object.keys(i).forEach(function(y){var O=i[y];O&&O.forEach(function(A){e.updateComboTree(A.id,A.parentId,!1)})});break;case"createCombo":var o=n.data.after.combos,u=o[o.length-1];Object.keys(i).forEach(function(y){var O=i[y];O&&O.forEach(function(A){e.updateComboTree(A.id,A.parentId,!1)})}),e.removeItem(u.id,!1);break;case"uncombo":var l=i.combos[i.combos.length-1],h=i.nodes.concat(i.combos).map(function(y){return y.id}).filter(function(y){return y!==l.id});e.createCombo(l,h,!1);break;case"layout":e.updateLayout(i,void 0,void 0,!1);break;default:}}}},t.prototype.redo=function(){var e=this.get("graph"),r=e.getRedoStack();if(!(!r||r.length===0)){var n=r.pop();if(n){var a=n.action,i=n.data.after;if(e.pushStack(a,(0,s.clone)(n.data)),a==="delete"&&(i=n.data.before),!i)return;switch(a){case"visible":{Object.keys(i).forEach(function(h){var y=i[h];y&&y.forEach(function(O){var A=e.findById(O.id);O.visible?e.showItem(A,!1):e.hideItem(A,!1)})});break}case"render":case"update":Object.keys(i).forEach(function(h){var y=i[h];y&&y.forEach(function(O){var A=e.findById(O.id);delete O.id,e.updateItem(A,O,!1),A.getType()==="combo"&&e.updateCombo(A)})});break;case"changedata":e.changeData(i,!1);break;case"delete":i.edges&&i.edges.forEach(function(h){e.removeItem(h.id,!1)}),i.nodes&&i.nodes.forEach(function(h){e.removeItem(h.id,!1)}),i.combos&&i.combos.forEach(function(h){e.removeItem(h.id,!1)});break;case"add":{Object.keys(i).forEach(function(h){var y=i[h];y&&y.forEach(function(O){var A=O.itemType;delete O.itemType,e.addItem(A,O,!1)})});break}case"updateComboTree":Object.keys(i).forEach(function(h){var y=i[h];y&&y.forEach(function(O){e.updateComboTree(O.id,O.parentId,!1)})});break;case"createCombo":var o=i.combos[i.combos.length-1];e.createCombo(o,o.children.map(function(h){return h.id}),!1);break;case"uncombo":var u=n.data.before.combos,l=u[u.length-1];e.uncombo(l.id,!1);break;case"layout":e.updateLayout(i,void 0,void 0,!1);break;default:}}}},t.prototype.zoomOut=function(){var e=this.get("graph"),r=e.getZoom(),n=1/(1-qc*this.get("zoomSensitivity")),a=this.get("maxZoom")||e.get("maxZoom");n*r>a||e.zoomTo(r*n)},t.prototype.zoomIn=function(){var e=this.get("graph"),r=e.getZoom(),n=1-qc*this.get("zoomSensitivity"),a=this.get("minZoom")||e.get("minZoom");n*r\u7C7B\u578B\uFF1A`.concat(r.item.getType(),` ID\uFF1A`).concat(r.item.getID(),` `)},shouldBegin:function(r){return!0},itemTypes:["node","edge","combo"],trigger:"mouseenter",fixToNode:void 0}},t.prototype.getEvents=function(){return this.get("trigger")==="click"?{"node:click":"onClick","edge:click":"onClick","combo:click":"onClick","canvas:click":"onMouseLeave",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave",drag:"onMouseLeave"}:{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove","edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove","combo:mouseenter":"onMouseEnter","combo:mouseleave":"onMouseLeave","combo:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave",contextmenu:"onMouseLeave","node:drag":"onMouseLeave"}},t.prototype.init=function(){var e=this,r=e.get("className")||"g6-component-tooltip",n=(0,ka.Z)("
    ")),a=e.get("container");a||(a=e.get("graph").get("container")),(0,s.isString)(a)&&(a=document.getElementById(a)),(0,aa.Z)(n,{position:"absolute",visibility:"hidden",display:"none"}),a.appendChild(n),e.get("trigger")!=="click"&&(n.addEventListener("mouseenter",function(i){(0,aa.Z)(n,{visibility:"visible",display:"unset"})}),n.addEventListener("mouseleave",function(i){e.hideTooltip()})),e.set("tooltip",n)},t.prototype.onClick=function(e){var r=this.get("itemTypes");if(!(e.item&&e.item.getType&&r.indexOf(e.item.getType())===-1)){var n=e.item,a=this.get("graph");this.currentTarget===n?(this.currentTarget=null,this.hideTooltip(),a.emit("tooltipchange",{item:e.item,action:"hide"})):(this.currentTarget=n,this.showTooltip(e),a.emit("tooltipchange",{item:e.item,action:"show"}))}},t.prototype.onMouseEnter=function(e){var r=this.get("itemTypes");if(!(e.item&&e.item.getType&&r.indexOf(e.item.getType())===-1)){var n=e.item,a=this.get("graph");this.currentTarget=n,this.showTooltip(e),a.emit("tooltipchange",{item:e.item,action:"show"})}},t.prototype.onMouseMove=function(e){var r=this.get("itemTypes");e.item&&e.item.getType&&r.indexOf(e.item.getType())===-1||!this.currentTarget||e.item!==this.currentTarget||this.showTooltip(e)},t.prototype.onMouseLeave=function(){this.hideTooltip();var e=this.get("graph");e.emit("tooltipchange",{item:this.currentTarget,action:"hide"}),this.currentTarget=null},t.prototype.clearContainer=function(){var e=this.get("tooltip");e&&(e.innerHTML="")},t.prototype.showTooltip=function(e){if(e.item){var r=this.get("itemTypes");if(!(e.item.getType&&r.indexOf(e.item.getType())===-1)){var n=this.get("tooltip"),a=this.get("getContent"),i=a(e);(0,s.isString)(i)?n.innerHTML=i:(this.clearContainer(),n.appendChild(i)),this.updatePosition(e)}}},t.prototype.hideTooltip=function(){var e=this.get("tooltip");e&&(0,aa.Z)(e,{visibility:"hidden",display:"none"})},t.prototype.updatePosition=function(e){var r=this.get("shouldBegin"),n=this.get("tooltip");if(!r(e)){(0,aa.Z)(n,{visibility:"hidden",display:"none"});return}var a=this.get("graph"),i=a.get("width"),o=a.get("height"),u=this.get("offsetX")||0,l=this.get("offsetY")||0,h=a.getPointByClient(e.clientX,e.clientY),y=this.get("fixToNode"),O=e.item;if(O.getType&&O.getType()==="node"&&y&&(0,s.isArray)(y)&&y.length>=2){var A=O.getBBox();h={x:A.minX+A.width*y[0],y:A.minY+A.height*y[1]}}var z=a.getCanvasByPoint(h.x,h.y),$=z.x,ae=z.y,ce=a.getContainer(),ue={x:$+ce.offsetLeft+u,y:ae+ce.offsetTop+l};(0,aa.Z)(n,{visibility:"visible",display:"unset"});var ve=n.getBoundingClientRect();$+ve.width+u>i&&(ue.x-=ve.width+u),ae+ve.height+l>o&&(ue.y-=ve.height+l,ue.y<0&&(ue.y=0)),(0,aa.Z)(n,{left:"".concat(ue.x,"px"),top:"".concat(ue.y,"px")})},t.prototype.hide=function(){this.onMouseLeave()},t.prototype.destroy=function(){var e=this.get("tooltip");if(e){var r=this.get("container");r||(r=this.get("graph").get("container")),(0,s.isString)(r)&&(r=document.getElementById(r)),r.removeChild(e)}},t}(si),it=We,Zt="timebarstartplay",or="timebarendplay",Xt="valuechange",Qt="timebarConfigChanged",gr="playPauseBtn",Er="nextStepBtn",wr="preStepBtn",_r={opacity:.5,fill:"#000"},Br={opacity:.5,fill:"#000",r:5},f={fill:"#fff",fontSize:12},w=function(){function E(t){var e=t.x,r=e===void 0?0:e,n=t.y,a=n===void 0?0:n,i=t.container,o=t.text,u=t.padding,l=u===void 0?[4,4,4,4]:u,h=t.className,y=h===void 0?"g6-component-timebar-tooltip":h,O=t.backgroundColor,A=O===void 0?"#000":O,z=t.textColor,$=z===void 0?"#fff":z,ae=t.opacity,ce=ae===void 0?.8:ae,ue=t.fontSize,ve=ue===void 0?12:ue;this.container=i,this.className=y,this.backgroundColor=A,this.textColor=$,this.x=r,this.y=a,this.text=o,this.padding=l,this.opacity=ce,this.fontSize=ve,this.render()}return E.prototype.render=function(){var t=this,e=t.className,r=t.x,n=t.y,a=t.backgroundColor,i=t.textColor,o=t.text,u=t.padding,l=t.opacity,h=t.fontSize,y=t.container,O=(0,ka.Z)("
    '));(0,s.isString)(y)&&(y=document.getElementById(y)),y.appendChild(O),t.parentHeight=y.offsetHeight,t.parentWidth=y.offsetWidth,(0,aa.Z)(O,{visibility:"hidden",top:0,left:0});var A=(0,ka.Z)(`
    "));A.innerHTML=o,O.appendChild(A),t.backgroundDOM=A;var z=(0,ka.Z)("
    "));O.appendChild(z),t.arrowDOM=z,t.container=O},E.prototype.show=function(t){var e=this,r=t.text,n=t.x,a=t.y,i=t.clientX,o=t.clientY;e.backgroundDOM.innerHTML=r;var u=e.backgroundDOM.offsetWidth,l=e.backgroundDOM.offsetHeight,h=e.arrowDOM.offsetWidth,y=e.arrowDOM.offsetHeight;(0,aa.Z)(e.container,{top:"".concat(-l-y,"px"),left:"".concat(n,"px"),visibility:"visible"}),(0,aa.Z)(e.backgroundDOM,{marginLeft:"".concat(-u/2,"px")}),(0,aa.Z)(e.arrowDOM,{marginLeft:"".concat(-h/2,"px"),top:"".concat(l,"px")});var O=n-u/2,A=n+u/2;O<0?(0,aa.Z)(e.backgroundDOM,{marginLeft:"".concat(-u/2-O,"px")}):A>e.parentWidth&&(0,aa.Z)(e.backgroundDOM,{marginLeft:"".concat(-u/2-A+e.parentWidth+12,"px")})},E.prototype.hide=function(){(0,aa.Z)(this.container,{top:0,left:0,visibility:"hidden"})},E}(),B=w,V=function(){return V=Object.assign||function(E){for(var t,e=1,r=arguments.length;eh&&(i=h,a=l)})}e.originalEvent.deltaY>0?a=Math.max(0,a-1):a=Math.min(t.speedAxisY.length-1,a+1);var o=t.speedAxisY[a]-n;r=ge(r,[["t",0,o]]),t.speedPoint.setMatrix(r),t.currentSpeed=t.speedAxisY.length-a,t.speedText.attr("text","".concat(t.currentSpeed,".0X")),t.group.emit(Qt,{speed:t.currentSpeed,type:t.currentType})}),this.toggleGroup&&this.toggleGroup.on("toggle-model:click",function(e){var r,n,a=e.target.get("isChecked");a?(t.checkedIcon.hide(),t.checkedText.attr("text",((n=t.controllerCfg)===null||n===void 0?void 0:n.timePointControllerText)||"\u5355\u4E00\u65F6\u95F4"),t.currentType=pr.RANGE):(t.checkedIcon.show(),t.checkedText.attr("text",((r=t.controllerCfg)===null||r===void 0?void 0:r.timeRangeControllerText)||"\u65F6\u95F4\u8303\u56F4"),t.currentType=pr.SINGLE),e.target.set("isChecked",!a),t.group.emit(Qt,{type:t.currentType,speed:t.currentSpeed})})},E.prototype.destroy=function(){this.speedGroup.off("speed-rect:click"),this.toggleGroup&&(this.toggleGroup.off("toggle-model:click"),this.toggleGroup.destroy()),this.speedGroup.destroy()},E}(),Or=Xr,fn=function(){return fn=Object.assign||function(E){for(var t,e=1,r=arguments.length;e=$e&&yr<=ot,Mr=kr?h:y,dr=Re.addShape("rect",{attrs:fn({x:a+yr*(Ce+ue),y:a,width:Ce,height:ce},Mr),draggable:!0,name:"tick-rect-".concat(yr)}),hn=Re.addShape("rect",{attrs:{x:a+yr*Ce+ue*(2*yr-1)/2,y:a,width:yr===0||yr===ve-1?Ce+ue/2:Ce+ue,height:ce,fill:"#fff",opacity:0},draggable:!0,name:"pick-rect-".concat(yr)});hn.toFront();var on=dr.getBBox(),cr=(on.minX+on.maxX)/2;Ve.push({rect:dr,pickRect:hn,value:Gt.date,x:cr,y:on.minY});var Rr;if(l?(Rr=l(Gt),!(0,s.isString)(Rr)&&Rr&&(Rr=Gt.date)):yr%Math.round(ve/10)===0&&(Rr=Gt.date),Rr){Ue.push(Rr);var Yr=on.maxY+a*2;Re.addShape("line",{attrs:{stroke:"#BFBFBF",x1:cr,y1:Yr,x2:cr,y2:Yr+$},name:"tick-line"});var Wr=Yr+$+a,sn=Re.addShape("text",{attrs:fn({fill:"#8c8c8c",stroke:"#fff",lineWidth:1,x:cr,y:Wr,textAlign:"center",text:Rr,textBaseline:"top",fontSize:10,fontFamily:t.fontFamily||"Arial, sans-serif"},O),capture:!1,name:"tick-label"}),wn=sn.getBBox();if(wn.maxX>r?sn.attr("textAlign","right"):wn.minX<0&&sn.attr("textAlign","left"),(0,s.isNumber)(et)&&Ue.length!==10){var la=cn([1,0,0,0,1,0,0,0,1],[["t",-cr,-Wr],["r",et],["t",cr-5,Wr+2]]);sn.attr({textAlign:"left",matrix:la})}Ue.length===1?sn.attr({textAlign:"left"}):Ue.length===10&&sn.attr({textAlign:"right"})}}),this.tickRects=Ve;var yt=this.group;this.currentSpeed=1,this.controllerBtnGroup=new Or(fn({group:yt,x:this.x,y:this.y+n+5,width:r,height:40,hideTimeTypeController:!0,speed:this.currentSpeed,fontFamily:this.fontFamily||"Arial, sans-serif"},this.controllerCfg))},E.prototype.initEvent=function(){var t=this,e=this.sliceGroup;e.on("click",function(h){var y=h.target;if(!(y.get("type")!=="rect"||!y.get("name"))){var O=parseInt(y.get("name").split("-")[2],10);if(!isNaN(O)){var A=t.tickRects,z=t.unselectedTickStyle;A.forEach(function(ue){ue.rect.attr(z)});var $=t.selectedTickStyle;A[O].rect.attr($),t.startTickRectId=O,t.endTickRectId=O;var ae=A.length,ce=O/ae;t.graph.emit(Xt,{value:[ce,ce]})}}}),e.on("dragstart",function(h){var y=t.tickRects,O=t.unselectedTickStyle;y.forEach(function(ue){ue.rect.attr(O)});var A=h.target,z=parseInt(A.get("name").split("-")[2],10),$=t.selectedTickStyle;y[z].rect.attr($),t.startTickRectId=z;var ae=y.length,ce=z/ae;t.graph.emit(Xt,{value:[ce,ce]}),t.dragging=!0}),e.on("dragover",function(h){if(t.dragging&&h.target.get("type")==="rect"){for(var y=parseInt(h.target.get("name").split("-")[2],10),O=t.startTickRectId,A=t.tickRects,z=t.selectedTickStyle,$=t.unselectedTickStyle,ae=0;ae=O&&ae<=y?z:$;A[ae].rect.attr(ce)}var ue=A.length;t.endTickRectId=y;var ve=O/ue,Ce=y/ue;t.graph.emit(Xt,{value:[ve,Ce]})}}),e.on("drop",function(h){if(t.dragging&&(t.dragging=!1,h.target.get("type")==="rect")){var y=t.startTickRectId,O=parseInt(h.target.get("name").split("-")[2],10);if(!(O0?e.endTickRectId++:(r[e.endTickRectId].rect.attr(a),e.endTickRectId--),o!==e.startTickRectId)e.endTickRectId$?(Ve.show(),$e.show(),$=ot.minX+ot.width+10):(Ve.hide(),$e.hide()),Ve}),this.controllerBtnGroup=new Or(Lr({group:this.group,x:this.x,y:this.y+n+25,width:r,height:35},this.controllerCfg)),this.updateStartEnd(0),this.updateUI(),o.move(this.x,this.y),this.bindEvents(),this.currentMode===pr.SINGLE&&(this.minHandlerShape.hide(),this.foregroundShape.hide(),this.minTextShape.hide())},E.prototype.bindEvents=function(){var t=this,e=this.group.find(function(n){return n.get("name")==="minHandlerShape"});e&&(e.on("minHandlerShape-handler:mousedown",this.onMouseDown(this.minHandlerShape)),e.on("minHandlerShape-handler:touchstart",this.onMouseDown(this.minHandlerShape)));var r=this.group.find(function(n){return n.get("name")==="maxHandlerShape"});r&&(r.on("maxHandlerShape-handler:mousedown",this.onMouseDown(this.maxHandlerShape)),r.on("maxHandlerShape-handler:touchstart",this.onMouseDown(this.maxHandlerShape))),this.foregroundShape.on("mousedown",this.onMouseDown(this.foregroundShape)),this.foregroundShape.on("touchstart",this.onMouseDown(this.foregroundShape)),this.group.on("".concat(gr,":click"),function(){t.isPlay=!t.isPlay,t.currentHandler=t.maxHandlerShape,t.changePlayStatus()}),this.group.on("".concat(Er,":click"),function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(.01),t.updateUI()}),this.group.on("".concat(wr,":click"),function(){t.currentHandler=t.maxHandlerShape,t.updateStartEnd(-.01),t.updateUI()}),this.group.on(Qt,function(n){var a=n.type,i=n.speed;t.currentSpeed=i,t.currentMode=a,a===pr.SINGLE?(t.minHandlerShape.hide(),t.foregroundShape.hide(),t.minTextShape.hide()):a===pr.RANGE&&(t.minHandlerShape.show(),t.foregroundShape.show(),t.minTextShape.show())})},E.prototype.adjustTickIndex=function(t){for(var e=0;e1&&(this.start=1),this.end>1&&(this.end=1),this.end<0&&(this.end=0);var e=this.x+this.start*this.width,r=this.x+this.end*this.width;this.foregroundShape.attr("x",e),this.foregroundShape.attr("width",r-e);var n=(0,s.get)(this.handlerStyle,"width",Bt);this.setText(this.minText,this.maxText);var a=this.dodgeText([e,r]),i=a[0],o=a[1];this.minHandlerShape.setX(e-n/2),(0,s.each)(i,function(u,l){return t.minTextShape.attr(l,u)}),this.maxHandlerShape.setX(r-n/2),(0,s.each)(o,function(u,l){return t.maxTextShape.attr(l,u)}),this.currentMode===pr.RANGE?this.graph.emit(Xt,{value:[this.start,this.end].sort()}):this.currentMode===pr.SINGLE&&this.graph.emit(Xt,{value:[this.end,this.end]})},E.prototype.dodgeText=function(t){var e,r,n=2,a=(0,s.get)(this.handlerStyle,"width",Bt),i=this.minTextShape,o=this.maxTextShape,u=t[0],l=t[1],h=!1;u>l&&(e=[l,u],u=e[0],l=e[1],r=[o,i],i=r[0],o=r[1],h=!0);var y=i.getBBox(),O=o.getBBox(),A=null,z=null;return this.timeBarType==="trend"?(A=u-y.widththis.x+this.width?{x:l-a/2-n,textAlign:"right"}:{x:l+a/2+n,textAlign:"left"}):this.timeBarType==="simple"&&(A=i.attr("x")>y.width?{x:u,textAlign:"center"}:{x:u,textAlign:"left"},z=o.attr("x")>this.width-O.width?{x:l,textAlign:"right"}:{x:l,textAlign:"center"}),h?[z,A]:[A,z]},E.prototype.startPlay=function(){var t=this;return typeof window!="undefined"?window.requestAnimationFrame(function(){var e=t,r=e.ticks,n=e.width,a=t.currentSpeed,i=n/r.length,o=i/((10-a)*1e3/60),u=t.adjustOffsetRange(o/t.width);t.updateStartEnd(u),t.updateUI(),t.isPlay&&(t.playHandler=t.startPlay())}):void 0},E.prototype.changePlayStatus=function(t){t===void 0&&(t=!0),this.controllerBtnGroup.playButton.update({isPlay:this.isPlay}),this.isPlay?(this.playHandler=this.startPlay(),this.graph.emit(Zt,null)):this.playHandler&&(typeof window!="undefined"&&window.cancelAnimationFrame(this.playHandler),t&&this.graph.emit(or,null))},E.prototype.destory=function(){this.graph.off(Xt,function(){});var t=this.group,e=t.find(function(n){return n.get("name")==="minHandlerShape"});e&&(e.off("minHandlerShape-handler:mousedown"),e.off("minHandlerShape-handler:touchstart"),e.destroy());var r=t.find(function(n){return n.get("name")==="maxHandlerShape"});r&&(r.off("maxHandlerShape-handler:mousedown"),r.off("maxHandlerShape-handler:touchstart"),r.destroy()),this.foregroundShape.off("mousedown"),this.foregroundShape.off("touchstart"),this.foregroundShape.destroy(),t.off("".concat(gr,":click")),t.off("".concat(Er,":click")),t.off("".concat(wr,":click")),t.off(Qt),t.destroy(),this.trendComponent&&this.trendComponent.destory()},E}(),ct=Ke,Ye=function(){var E=function(e,r){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},E(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");E(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),At=function(){return At=Object.assign||function(E){for(var t,e=1,r=arguments.length;e
    ")),(0,aa.Z)(l,{position:"relative"})),i){var h=this.get("graph").get("container");h.appendChild(l)}this.set("timeBarContainer",l);var y,O=e.get("renderer");O==="SVG"?y=new Wo.Canvas({container:l,width:n,height:a}):y=new Ji.Canvas({container:l,width:n,height:a}),this.get("containerCSS")&&(0,aa.Z)(l,this.get("containerCSS")),this.set("canvas",y)},t.prototype.init=function(){this.initContainer();var e=this.get("canvas"),r=e.addGroup({name:"timebar-group"});this.set("timeBarGroup",r),this.renderTrend(),this.initEvent();var n=typeof window!="undefined"&&window.getComputedStyle(document.body,null).getPropertyValue("font-family")||"Arial, sans-serif";this.set("fontFamily",n)},t.prototype.play=function(){this.togglePlay(!0)},t.prototype.pause=function(){this.togglePlay(!1)},t.prototype.togglePlay=function(e){var r=this.get("timebar");r&&(r.isPlay=!!e,r.changePlayStatus())},t.prototype.renderTrend=function(){var e=this,r=this._cfgs,n=r.width,a=r.x,i=r.y,o=r.padding,u=r.type,l=r.trend,h=r.slider,y=r.controllerCfg,O=r.textStyle,A=r.tick,z=r.backgroundStyle,$=r.foregroundStyle,ae=l.data,ce=Wt(l,["data"]),ue=n-2*o,ve=u==="trend"?fr:sr,Ce=this.get("graph"),Re=this.get("timeBarGroup"),Ve=this.get("canvas"),Ue=null;if(u==="trend"||u==="simple"){var $e=this.get("getValue");Ue=new ct(At(At({graph:Ce,canvas:Ve,group:Re,type:u,x:a+o,y:u==="trend"?i+o:i+o+15,width:ue,height:ve,padding:o,backgroundStyle:z,foregroundStyle:$,trendCfg:At(At({},ce),{data:ae.map(function(et){return($e==null?void 0:$e(et))||et.value})})},h),{tick:{ticks:ae,tickLabelFormatter:A.tickLabelFormatter,tickLabelStyle:A.tickLabelStyle,tickLineStyle:A.tickLineStyle},handlerStyle:At(At({},h.handlerStyle),{height:h.height||ve}),controllerCfg:y,textStyle:O}))}else u==="tick"&&(Ue=new Na(At({graph:Ce,canvas:Ve,group:Re,x:a+o,y:i+o,width:n,height:42,padding:2,controllerCfg:y},A)));var ot=function et(){var yt=e.get("timebar");yt.draggingHandler=!1,yt.isPlay&&(yt.isPlay=!1,yt.currentHandler=yt.maxHandlerShape,yt.changePlayStatus()),document.removeEventListener("mouseup",et)};Ve.on("mousedown",function(et){(et.target.get("name")==="maxHandlerShape-handler"||et.target.get("name")==="minHandlerShape-handler"||et.target===Ue.foregroundShape)&&document.addEventListener("mouseup",ot)}),this.set("timebar",Ue)},t.prototype.filterData=function(e){var r,n=e.value;if(!n){n=[];var a=this._cfgs.type;!a||a==="trend"||a==="simple"?(n[0]=this._cfgs.slider.start,n[1]=this._cfgs.slider.end):a==="tick"&&(n[0]=this._cfgs.tick.start,n[1]=this._cfgs.tick.end)}var i=null,o=this._cfgs.type;if(o==="trend"||o==="simple"?i=this._cfgs.trend.data:o==="tick"&&(i=this._cfgs.tick.data),!i||i.length===0){console.warn("\u8BF7\u914D\u7F6E TimeBar \u7EC4\u4EF6\u7684\u6570\u636E");return}var u=this.get("rangeChange"),l=this.get("graph"),h=Math.round(i.length*n[0]),y=Math.round(i.length*n[1]);y=y>=i.length?i.length-1:y,h=h>=i.length?i.length-1:h;var O=(r=this._cfgs.tick)===null||r===void 0?void 0:r.tickLabelFormatter,A=O?O(i[h]):i[h].date,z=O?O(i[y]):i[y].date;if(o!=="tick"){var $=this.get("timebar");$.setText(A,z)}if(u)u(l,A,z);else{(!this.cacheGraphData||this.cacheGraphData.nodes&&this.cacheGraphData.nodes.length===0)&&(this.cacheGraphData=l.get("data"));var ae=this.get("filterItemTypes"),ce=this.get("changeData"),ue=this.get("getDate"),ve=this.get("shouldIgnore"),Ce=i[h].date,Re=i[y].date;if(ce||ce===void 0){var Ve=this.cacheGraphData.nodes,Ue=this.cacheGraphData.edges,$e={},ot={};l.getNodes().forEach(function(et){return $e[et.getID()]=!0}),l.getEdges().forEach(function(et){return ot[et.getID()]=!0}),ae.includes("node")&&(Ve==null||Ve.forEach(function(et){var yt=+((ue==null?void 0:ue(et))||et.date),Gt=yt>=Ce&&yt<=Re||(ve==null?void 0:ve("node",et,{min:Ce,max:Re})),yr=$e[et.id];yr&&!Gt?(l.removeItem(et.id),$e[et.id]=!1):!yr&&Gt&&(l.addItem("node",et),$e[et.id]=!0)}),Ue==null||Ue.forEach(function(et){var yt=$e[et.source]&&$e[et.target]||(ve==null?void 0:ve("edge",et,{min:Ce,max:Re})),Gt=!!l.findById(et.id);Gt&&!yt?(l.removeItem(et.id),ot[et.id]=!1):!Gt&&yt?(l.addItem("edge",et),ot[et.id]=!0):Gt||(ot[et.id]=!1)})),(this.get("filterEdge")||ae.includes("edge"))&&(Ue==null||Ue.filter(function(et){var yt=+((ue==null?void 0:ue(et))||et.date),Gt=yt>=Ce&&yt<=Re||(ve==null?void 0:ve("edge",et,{min:Ce,max:Re})),yr=$e[et.source]&&$e[et.target],kr=Gt&&yr,Mr=ot[et.id];Mr&&!kr?(ot[et.id]=!1,l.removeItem(et.id)):!Mr&&kr&&(ot[et.id]=!0,l.addItem("edge",et))}))}else ae.includes("node")&&l.getNodes().forEach(function(et){var yt=et.getModel();if(!(ve!=null&&ve("node",yt,{min:Ce,max:Re}))){var Gt=+((ue==null?void 0:ue(yt))||yt.date);GtRe?l.hideItem(et):l.showItem(et)}}),(this.get("filterEdge")||ae.includes("edge"))&&l.getEdges().forEach(function(et){var yt=et.getModel();if(!(ve!=null&&ve("edge",yt,{min:i[h].date,max:i[y].date}))){var Gt=+((ue==null?void 0:ue(yt))||yt.date);if(Gti[y].date)l.hideItem(et);else{var yr=et.getSource().isVisible(),kr=et.getTarget().isVisible();yr&&kr&&l.showItem(et)}}})}},t.prototype.initEvent=function(){var e=this.get("graph");e.on("afterchangedata",this.changeData),e.on("afterrender",this.afterrenderListener),e.on(Xt,this.valueChangeListener)},t.prototype.destroy=function(){var e=this.get("graph");e.off("afterchangedata",this.changeData),e.off("afterrender",this.afterrenderListener),e.off(Xt,this.valueChangeListener);var r=this.get("timebar");r&&r.destory&&r.destory(),E.prototype.destroy.call(this);var n=this.get("timeBarContainer");if(n){var a=this.get("container");a||(a=this.get("graph").get("container")),(0,s.isString)(a)&&(a=document.getElementById(a)),a===n&&(a=a.parentElement),a.removeChild(n)}},t}(si),Tr=rr,En=function(){var E=function(e,r){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},E(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");E(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),qn=ei.applyMatrix;function ln(E,t){var e,r;if(E.naturalWidth)e=E.naturalWidth,r=E.naturalHeight;else{var n=new Image;n.src=E.src,n.onload=function(){t&&t(n.width,n.height)}}return[e,r]}var Ln=function(E){En(t,E);function t(e){return E.call(this,e)||this}return t.prototype.getDefaultCfgs=function(){return{container:null,className:"g6-minimap",viewportClassName:"g6-minimap-viewport",width:200,delegateStyle:{fill:"#40a9ff",stroke:"#096dd9"},refresh:!0}},t.prototype.getEvents=function(){return{beforepaint:"updateViewport",beforeanimate:"disableRefresh",afteranimate:"enableRefresh",viewportchange:"disableOneRefresh"}},t.prototype.disableRefresh=function(){this.set("refresh",!1)},t.prototype.enableRefresh=function(){this.set("refresh",!0),this.updateCanvas()},t.prototype.disableOneRefresh=function(){this.set("viewportChange",!0)},t.prototype.initViewport=function(){var e=this,r=this._cfgs,n=r.graph;if(!this.destroyed){var a=this.get("container");(0,s.isString)(a)&&(a=document.getElementById(a));var i=(0,ka.Z)("
    ue||A>ve||($=n.getZoom(),z=e.get("ratio"),l=!0,o=ae.clientX,u=ae.clientY)}},!1),a.addEventListener("mousemove",function(ae){if(!(!l||(0,s.isNil)(ae.clientX)||(0,s.isNil)(ae.clientY))){var ce=e.get("width"),ue=e.get("height"),ve=i.style;h=parseInt(ve.left,10),y=parseInt(ve.top,10),O=parseInt(ve.width,10),A=parseInt(ve.height,10);var Ce=o-ae.clientX,Re=u-ae.clientY;h-Ce<0?Ce=h:h-Ce+O>=ce&&(Ce=0),y-Re<0?Re=y:y-Re+A>=ue&&(Re=0),h-=Ce,y-=Re,(0,aa.Z)(i,{left:"".concat(h,"px"),top:"".concat(y,"px")}),n.translate(Ce*$/z,Re*$/z),o=ae.clientX,u=ae.clientY}},!1),a.addEventListener("mouseleave",function(){l=!1,r.refresh=!0},!1),a.addEventListener("mouseup",function(){l=!1,r.refresh=!0},!1),this.set("viewport",i),a.appendChild(i)}},t.prototype.updateViewport=function(){if(!this.destroyed){var e=this.get("ratio"),r=this.get("width"),n=this.get("height"),a=this.get("graph"),i=a.get("width"),o=a.get("height"),u=i/o,l=a.getGroup(),h=l.getCanvasBBox(),y=[(h.minX+h.maxX)/2,(h.minY+h.maxY)/2],O=[h.maxX-h.minX,h.maxY-h.minY],A={centerX:y[0],centerY:y[1],width:0,height:0,minX:0,minY:0};h[0]/h[1]>u?(A.width=O[0],A.height=A.width/u):(A.height=O[1],A.width=A.height*u),A.minX=y[0]-A.width/2,A.minY=y[1]-A.height/2;var z=l.getMatrix();z||(z=[1,0,0,0,1,0,0,0,1]);var $=Fi.invert([1,0,0,0,1,0,0,0,1],z),ae=qn({x:A.minX,y:A.minY},$),ce=a.getCanvasByPoint(ae.x,ae.y),ue=this.get("viewport");ue||this.initViewport();var ve=i/A.width,Ce=ve*r,Re=ve*n,Ve=r*-ce.x/A.width,Ue=n*-ce.y/A.height,$e=Ve+Ce,ot=Ue+Re;Ve<0&&(Ce+=Ve,Ve=0),$e>r&&(Ce=Ce-($e-r)),Ue<0&&(Re+=Ue,Ue=0),ot>n&&(Re=Re-(ot-n)),this.set("ratio",e);var et="".concat(Ve,"px"),yt="".concat(Ue,"px");(0,aa.Z)(ue,{left:et,top:yt,width:"".concat(Ce,"px"),height:"".concat(Re,"px")})}},t.prototype.init=function(){this.initContainer()},t.prototype.initContainer=function(){var e=this,r=e.get("graph"),n=r.get("width"),a=r.get("height"),i=a/n,o=e.get("className"),u=e.get("container"),l=e.get("width"),h=e.get("height");!l&&!h&&(l=200),l?(h=i*l,e.set("height",h)):(l=1/i*h,e.set("width",l));var y=(0,ka.Z)("
    "));(0,s.isString)(u)&&(u=document.getElementById(u)),u?u.appendChild(y):r.get("container").appendChild(y),e.set("container",y);var O=(0,ka.Z)('
    ');y.appendChild(O);var A=(0,ka.Z)('');O.appendChild(A),e.set("containerDOM",O),e.set("containerSpan",A);var z=(0,ka.Z)(''));e.set("imgDOM",z),e.updateImgSize(),A.appendChild(z),e.updateCanvas()},t.prototype.updateImgSize=function(){var e=this,r=e.get("imgDOM"),n=e.get("width"),a=e.get("height");r.onload=function(){var i=ln(r);i[0]>i[1]?r.width=n:r.height=a}},t.prototype.updateCanvas=function(){var e=this.get("refresh");if(e){var r=this.get("graph");if(!r.get("destroyed")){this.get("viewportChange")&&(this.set("viewportChange",!1),this.updateViewport());var n=this.get("width"),a=r.get("canvas").getCanvasBBox(),i=a.width,o=n/i;this.set("ratio",o),this.updateViewport()}}},t.prototype.getViewport=function(){return this.get("viewport")},t.prototype.getContainer=function(){return this.get("container")},t.prototype.updateGraphImg=function(e){var r=this,n=r.get("imgDOM");n.remove(),r.set("graphImg",e);var a=(0,ka.Z)(''));r.set("imgDOM",a),a.src=e,r.updateImgSize();var i=r.get("containerSpan");i.appendChild(a),r.updateCanvas()},t.prototype.destroy=function(){var e=this.get("container");e.parentNode.removeChild(e)},t}(si),Hn=Ln,wa=function(){var E=function(e,r){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},E(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");E(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),Ka=function(){return Ka=Object.assign||function(E){for(var t,e=1,r=arguments.length;e(l||n.get("height"))&&a>1||y<(h||n.get("height")*.05)&&a<1)&&(a=1),y*=a,r.set("r",y),r.filter(e)}},t.prototype.filter=function(e){var r=this,n=r.get("graph"),a=n.getNodes(),i={},o=r.get("r"),u=r.get("type"),l={x:e.x,y:e.y};r.updateDelegate(l,o);var h=r.get("shouldShow"),y=r.get("vShapes");y&&y.forEach(function(ce){ce.remove(),ce.destroy()}),y=[],a.forEach(function(ce){var ue=ce.getModel(),ve=ue.x,Ce=ue.y;co({x:ve,y:Ce},l)
    `);o.appendChild(u),this.set("container",u);var l=this.render();(0,aa.Z)(u,this.getContainerPos(l)),this.bindEvents()},t.prototype.getContainerPos=function(e){e===void 0&&(e=[0,0]);var r=this,n=r.get("graph"),a=this.get("offsetX"),i=this.get("offsetY"),o=this.get("margin"),u=this.get("position").split("-"),l={top:0,right:1,bottom:2,left:3},h=0,y=0,O={left:(n.getWidth()-e[0])/2+h,top:(n.getHeight()-e[1])/2+y};return u.forEach(function(A){var z=o[l[A]],$=A;switch(A){case"top":z+=y;break;case"left":z+=h;break;case"bottom":z=n.getHeight()-e[1]-z+y,$="top";break;default:z=n.getWidth()-e[0]-z+h,$="left";break}O[$]=z}),O.top+=i+n.getContainer().offsetTop,O.left+=a+n.getContainer().offsetLeft,Object.keys(O).forEach(function(A){O[A]="".concat(O[A],"px")}),O},t.prototype.bindEvents=function(){var e=this,r=e.get("filter");if(!(!r||!r.enable)){var n=r.trigger||"click";Od.includes(n)||(console.warn("Trigger for legend filterling must be 'click' or 'mouseenter', 'click' will take effect by default."),n="click");var a=e.get("legendCanvas");n==="mouseenter"?(a.on("node-container:mouseenter",function(i){return e.filterData(i)}),a.on("node-container:mouseleave",function(i){e.clearFilter(),e.clearActiveLegend()})):(a.on("node-container:click",function(i){return e.filterData(i)}),a.on("click",function(i){i.target&&i.target.isCanvas&&i.target.isCanvas()&&(e.clearFilter(),e.clearActiveLegend())}))}},t.prototype.changeData=function(e){this.set("data",e);var r=this.render();(0,aa.Z)(this.get("container"),this.getContainerPos(r))},t.prototype.activateLegend=function(e){var r=this.get("filter"),n=r==null?void 0:r.multiple;n||this.clearActiveLegend();var a=e.get("parent");a.get("active")?(a.set("active",!1),this.findLegendItemsByState("active").length&&a.set("inactive",!0)):(a.set("inactive",!1),a.set("active",!0)),this.findLegendItemsByState("active").length?this.findLegendItemsByState("active","all",!1).forEach(function(y){y.set("inactive",!0)}):this.clearActiveLegend();var i=(r==null?void 0:r.legendStateStyles)||{},o=(i==null?void 0:i.inactive)||{opacity:.5,"text-shape":{opacity:.5}},u=o["text-shape"]||{};this.findLegendItemsByState("inactive").forEach(function(y){var O=y.get("children"),A=O[0],z=O[1];A.attr(yi(yi({},A.get("oriAttrs")),o)),z.attr(yi(yi({},z.get("oriAttrs")),u))});var l=(i==null?void 0:i.active)||{stroke:"#000",lineWidth:2,"text-shape":{fontWeight:"bold"}},h=l["text-shape"]||{};this.findLegendItemsByState("active").forEach(function(y){var O=y.get("children"),A=O[0],z=O[1];A.attr(yi(yi({},A.get("oriAttrs")),l)),z.attr(yi(yi({},z.get("oriAttrs")),h))})},t.prototype.findLegendItemsByState=function(e,r,n){r===void 0&&(r="all"),n===void 0&&(n=!0);var a=this.get("legendCanvas").find(function(u){return u.get("name")==="root"}),i=a.find(function(u){return u.get("name")==="node-group"}),o=a.find(function(u){return u.get("name")==="edge-group"});return r==="node"?i.get("children").filter(function(u){return!!u.get(e)===n}):r==="edge"?o.get("children").filter(function(u){return!!u.get(e)===n}):i.get("children").filter(function(u){return!!u.get(e)===n}).concat(o.get("children").filter(function(u){return!!u.get(e)===n}))},t.prototype.clearActiveLegend=function(){var e=this.get("legendCanvas"),r=e.find(function(a){return a.get("name")==="root"}),n=[r.find(function(a){return a.get("name")==="node-group"}),r.find(function(a){return a.get("name")==="edge-group"})];n.forEach(function(a){a.get("children").forEach(function(i){i.set("active",!1),i.set("inactive",!1);var o=i.get("children"),u=o[0],l=o[1];u.attr(u.get("oriAttrs")),l.attr(l.get("oriAttrs"))})})},t.prototype.filterData=function(e){var r=this.get("filter"),n=r==null?void 0:r.filterFunctions;if(!(!r||!n)){var a=this.get("legendCanvas"),i=this.get("graph"),o=r.graphActiveState||"active",u=r.graphInactiveState||"inactive",l=r.multiple;this.clearFilter(),l||this.clearActiveLegend(),this.activateLegend(e.target);var h=a.find(function(ce){return ce.get("name")==="root"}),y=h.find(function(ce){return ce.get("name")==="node-group"}),O=h.find(function(ce){return ce.get("name")==="edge-group"}),A=y.get("children").filter(function(ce){return ce.get("active")}),z=O.get("children").filter(function(ce){return ce.get("active")}),$=0,ae=["getNodes","getEdges"];ae.forEach(function(ce){i[ce]().forEach(function(ue){var ve=!1,Ce=ce==="getNodes"?A:z;Ce.forEach(function(Re){var Ve=n[Re.get("id")];ve=ve||Ve(ue.getModel())}),ve?(i.setItemState(ue,u,!1),i.setItemState(ue,o,!0),$++):(i.setItemState(ue,o,!1),i.setItemState(ue,u,!0))})}),$||ae.forEach(function(ce){i[ce]().forEach(function(ue){i.clearItemStates(ue,[u])})})}},t.prototype.clearFilter=function(){var e=this.get("graph"),r=this.get("filter");if(r){var n=r.graphActiveState||"active",a=r.graphInactiveState||"inactive";e.getNodes().forEach(function(i){e.clearItemStates(i,[n,a])}),e.getEdges().forEach(function(i){e.clearItemStates(i,[n,a])})}},t.prototype.render=function(){var e=this;this.processData();var r=this.get("legendCanvas");r?r.clear():r=new Ji.Canvas({container:this.get("container"),width:200,height:200});var n=r.addGroup({name:"root"}),a=n.addGroup({name:"node-group"}),i=n.addGroup({name:"edge-group"});this.set("legendCanvas",r);var o=this.get("itemsData"),u=["nodes","edges"],l=[a,i];u.forEach(function(dr,hn){o[dr].forEach(function(on){var cr,Rr=l[hn].addGroup({id:on.id,name:"node-container"}),Yr,Wr=on.type,sn=e.getShapeSize(on),wn=sn.width,la=sn.height,da=sn.r,Ra=e.getStyle(dr.substr(0,4),on);switch(on.type){case"circle":Yr={r:da,x:0,y:0};break;case"rect":Yr={width:wn,height:la,x:-wn/2,y:-la/2};break;case"ellipse":Yr={rx:wn,ry:la,x:0,y:0},Wr="ellipse";break;case"line":Yr={x1:-wn/2,y1:0,x2:wn/2,y2:0},Wr="line";break;case"quadratic":Yr={path:[["M",-wn/2,0],["Q",0,wn/2,wn/2,0]]},Wr="path";break;case"cubic":Yr={path:[["M",-wn/2,0],["C",-wn/6,wn/2,wn/6,-wn/2,wn/2,0]]},Wr="path";break;case"diamond":Yr={path:[["M",0,-la],["L",wn,0],["L",0,la],["L",-wn,0],["Z"]]},Wr="path";break;case"triangle":Yr={path:[["M",-wn,la],["L",0,-la],["L",wn,la],["Z"]]},Wr="path";break;case"star":Yr={path:ei.getStarPath(da*3,da*1.2)},Wr="path";break;default:Yr={r:da,x:0,y:0};break}var Ia=Rr.addShape(Wr,{attrs:yi(yi({},Yr),Ra),name:"".concat(on.type,"-node-keyShape"),oriAttrs:yi({opacity:1},Ra)});if(on.label){var Xa=Ia.getBBox(),Ga=((cr=on.labelCfg)===null||cr===void 0?void 0:cr.style)||{},ci=yi({textAlign:"begin",fontSize:12,textBaseline:"middle",fill:"#000",opacity:1,fontWeight:"normal"},Ga);Rr.addShape("text",{attrs:yi({x:Xa.maxX+4,y:0,text:on.label},ci),className:"legend-label",name:"".concat(on.type,"-node-text"),oriAttrs:ci})}})});var h=this.get("padding"),y,O=n.find(function(dr){return dr.get("name")==="title-container"}),A={height:0,maxY:0,width:0};if(this.get("title")){O||(O=n.addGroup({name:"title-container"}));var z={fontSize:20,fontFamily:"Arial",fontWeight:300,textBaseline:"top",textAlign:"center",fill:"#000",x:0,y:h[0]},$=this.get("titleConfig")||{},ae=Object.assign(z,$.style||{});y=O.addShape("text",{attrs:yi({text:this.get("title")},ae)}),A=O.getCanvasBBox(),O.setMatrix([1,0,0,0,1,0,$.offsetX,$.offsetY,1])}this.layoutItems();var ce=n.getCanvasBBox(),ue=a.getCanvasBBox(),ve=ue.minX<0?Math.abs(ue.minX)+h[3]:h[3],Ce=A.maxYy.max&&(y.max=o[0]),yt>O&&(O=yt),Ce.setMatrix([1,0,0,0,1,0,Gt,yr,1])});var A=y.max-y.min,z={min:0,max:-1/0},$=l.getCanvasBBox();o[0]=0,o[1]=a==="vertical"?$.maxX+r:$.maxY+n,h.get("children").forEach(function(Ce,Re){Re===0&&(z.min=o[0]);var Ve=Ce.get("children")[0],Ue=Ce.getCanvasBBox(),$e=Ve.getBBox(),ot=$e.width,et=$e.height,yt=0,Gt=0;a==="vertical"?(yt=o[1],Gt=o[0],o[0]=Gt+Ue.height+n,Ce.setMatrix([1,0,0,0,1,0,0,Gt+et/2,1])):(yt=o[0],Gt=o[1],o[0]=yt+Ue.width+r,Ce.setMatrix([1,0,0,0,1,0,yt+ot/2,0,1])),o[0]>z.max&&(z.max=o[0])});var ae=z.max-z.min;if(i&&i!==""&&i!=="left"){var ce=A-ae,ue=i==="center"?Math.abs(ce)/2:Math.abs(ce),ve=ce<0?l:h;ve.get("children").forEach(function(Ce){var Re=Ce.getMatrix()||[1,0,0,0,1,0,0,0,1];a==="vertical"?Re[7]+=ue:Re[6]+=ue,Ce.setMatrix(Re)})}},t.prototype.processData=function(){var e=this.get("data"),r={nodes:[],edges:[]};e.nodes&&(e.nodes.sort(function(n,a){return n.order-a.order}),e.nodes.forEach(function(n){var a,i,o,u,l,h=n.size||[((a=n.style)===null||a===void 0?void 0:a.width)||((i=n.style)===null||i===void 0?void 0:i.r)||8,((o=n.style)===null||o===void 0?void 0:o.height)||((u=n.style)===null||u===void 0?void 0:u.r)||8],y=((l=n.labelCfg)===null||l===void 0?void 0:l.style)||{};r.nodes.push({id:n.id||(0,s.uniqueId)(),type:n.type||"circle",style:yi({},n.style),order:n.order,label:n.label,itemType:"node",size:h,labelCfg:{position:"right",style:yi({fontFamily:"Arial"},y)}})})),e.edges&&(e.edges.sort(function(n,a){return n.order-a.order}),e.edges.forEach(function(n){var a,i,o=n.type||"line";n.type==="cubic-horizontal"&&(o="cubic");var u=((a=n.labelCfg)===null||a===void 0?void 0:a.style)||{},l=n.size||[((i=n.style)===null||i===void 0?void 0:i.width)||8,1];r.edges.push({id:n.id||(0,s.uniqueId)(),type:o,size:l,style:yi({lineWidth:(0,s.isArray)(l)?l[1]:1},n.style),order:n.order,label:n.label,itemType:"edge",labelCfg:{position:"right",style:yi({fontFamily:"Arial"},u)}})})),this.set("itemsData",r)},t.prototype.getContainer=function(){return this.get("container")},t.prototype.formatArray=function(e){var r=this.get(e);if((0,s.isNumber)(r))this.set(e,[r,r,r,r]);else if((0,s.isArray)(r))switch(r.length){case 0:this.set(e,[0,0,0,0]);break;case 1:this.set(e,[r[0],r[0],r[0],r[0]]);break;case 2:this.set(e,[r[0],r[1],r[0],r[1]]);break;case 3:this.set(e,[r[0],r[1],r[2],r[1]]);break;default:break}return this.get(e)},t.prototype.getShapeSize=function(e){var r,n,a;return e.size&&((0,s.isArray)(e.size)?(r=e.size[0],n=e.size[1]||e.size[0],a=e.size[0]/2):(0,s.isNumber)(e.size)&&(r=e.size,n=e.size,a=e.size/2)),e.style&&(e.style.width&&(r=e.style.width),e.style.height&&(n=e.style.height),e.style.r&&(a=e.style.r)),a||(a=5),r||(r=a),n||(n=a),{width:r,height:n,r:a}},t.prototype.getStyle=function(e,r){var n=e==="node"?{fill:"#ccc",lineWidth:0}:{stroke:"#000",lineWidth:1};return yi(yi({},n),r.style||{})},t.prototype.destroy=function(){var e=this.get("legendCanvas");e==null||e.destroy();var r=this.get("graph"),n=r.get("container"),a=this.get("container");n.removeChild(a)},t}(si),Dd=Ld,Nd=function(){var E=function(e,r){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var i in a)Object.prototype.hasOwnProperty.call(a,i)&&(n[i]=a[i])},E(e,r)};return function(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");E(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),As=function(){return As=Object.assign||function(E){for(var t,e=1,r=arguments.length;e+

    ":"

    -

    ",O=r?"":"

    ".concat(u,"

    "),A="

    x

    ",z=r?"".concat(h,"px"):"".concat(h,"px ").concat(h,"px 0 0");return'

    `).concat(i,`

    `).concat(y,` `).concat(A,`
    `).concat(O,`
    `)}},t.prototype.init=function(){var e=this;if(!e.destroyed){var r=e.get("graph"),n=r.getContainer(),a=e.get("container"),i=this.get("containerCfg");i?(a=this.createContainer(),n.appendChild(a)):a=n,this.set("container",a);var o=n.getBoundingClientRect(),u=new Ji.Canvas({container:n,width:o.right-o.left,height:o.bottom-o.top});(0,aa.Z)(u.get("el"),{position:"absolute",top:0,left:0,pointerEvents:"none"}),window.addEventListener("resize",(0,s.debounce)(function(){return e.resizeCanvas(e)},100));var l=u.addGroup({id:"annotation-link-group"});e.set("linkGroup",l),e.set("canvas",u),e.get("getTitle")||e.set("getTitle",function(y){var O,A=((O=y==null?void 0:y.getModel)===null||O===void 0?void 0:O.call(y))||{},z=A.label,$=A.id;return z||$||"-"}),e.get("getContent")||e.set("getContent",function(y){var O,A;if(!y)return"-";var z=((O=y.getModel)===null||O===void 0?void 0:O.call(y))||{},$=z.label,ae=z.id,ce=(A=y.getType)===null||A===void 0?void 0:A.call(y),ue=ce?"".concat(ce,": "):"";return"".concat(ue).concat($||ae||"")});var h=e.get("defaultData");h&&this.readData(h)}},t.prototype.createContainer=function(){var e=this;if(!this.destroyed){var r=this.get("containerCfg"),n=this.get("graph"),a=n.getContainer(),i=a.getBoundingClientRect(),o=i.left,u=i.right,l=i.top,h=i.bottom,y=h-l,O=u-o,A=r.position,z=A===void 0?"top":A,$=r.offsetX,ae=$===void 0?0:$,ce=r.offsetY,ue=ce===void 0?0:ce,ve=Xl(r,["position","offsetX","offsetY"]),Ce=r.height,Re=Ce===void 0?"fit-content":Ce,Ve=r.width,Ue=Ve===void 0?n.getWidth():Ve;Re==="100%"&&(Re=y),Ue==="100%"&&(Ue=O);var $e="unset",ot="unset",et={};switch(z){case"right":$e="".concat(y,"px"),et={top:0,right:0},et.right+=o+ae,et.top+=l+ue;break;case"bottom":ot="".concat(O,"px"),et={bottom:0,left:0},et.left+=o+ae,et.bottom+=l+ue;break;case"top":ot="".concat(O,"px");case"left":$e="".concat(y,"px");default:et={top:0,left:0},et.left+=o+ae,et.top+=l+ue;break}Object.keys(et).forEach(function(Gt){et[Gt]="".concat(et[Gt],"px")});var yt=(0,ka.Z)("
    "));return(0,aa.Z)(yt,As(As({position:"absolute",display:z==="top"||z==="bottom"?"inline-flex":"unset",width:(0,s.isNumber)(Ue)?"".concat(Ue,"px"):Ue,height:(0,s.isNumber)(Re)?"".concat(Re,"px"):Re,maxHeight:$e,maxWidth:ot,overflow:"scroll"},et),ve)),a.appendChild(yt),yt.addEventListener("scroll",function(Gt){e.updateLinks()}),yt}},t.prototype.resizeCanvas=function(e){clearTimeout(e.resizeTimer),e.resizeTimer=setTimeout(function(){if(!(!e||e.destroyed)){var r=e.get("container").getBoundingClientRect(),n=r.right-r.left,a=r.bottom-r.top;e.get("canvas").changeSize(n,a),e.updateOutsideCards(e)}},250)},t.prototype.updateOutsideCards=function(e){var r=e||this,n=r.get("cardInfoMap")||{},a=r.get("graph"),i=a.getPointByCanvas(0,0),o=a.getPointByCanvas(a.getWidth(),a.getHeight()),u=a.getClientByPoint(i.x,i.y),l=u.x,h=u.y,y=a.getClientByPoint(o.x,o.y),O=y.x,A=y.y;Object.values(n).forEach(function(z){var $=z.card;if($){var ae=$.style,ce=Dc(ae.left),ue=Dc(ae.top),ve=$.getBoundingClientRect(),Ce=ve.width,Re=ve.height,Ve=ce,Ue=ue;ce+Ce>O-l&&(Ve=O-l-Ce),ce<0&&(Ve=0),ue+Re>A-h&&(Ue=A-h-Re),ue<0&&(Ue=0),(0,aa.Z)($,{left:"".concat(Ve,"px"),top:"".concat(Ue,"px")})}}),r.updateLinks()},t.prototype.showAnnotation=function(e){if(!this.destroyed){var r=e.item;this.toggleAnnotation(r)}},t.prototype.hideCards=function(){var e=this;if(!e.destroyed){var r=e.get("cardInfoMap")||{};Object.keys(r).forEach(function(n){e.hideCard(n)})}},t.prototype.toggleAnnotation=function(e,r){var n,a;r===void 0&&(r={});var i=this;if(!i.destroyed){var o=i.get("cardInfoMap")||{},u=i.get("graph"),l=i.get("container"),h=i.get("containerCfg"),y=Object.assign({},i.get("cardCfg")||{},r),O=y.minHeight,A=y.minWidth,z=y.width,$=y.height,ae=y.collapsed,ce=ae===void 0?!1:ae,ue=y.x,ve=y.y,Ce=y.title,Re=y.content,Ve=y.maxTitleLength,Ue=y.defaultBegin,$e=Xl(y,["minHeight","minWidth","width","height","collapsed","x","y","title","content","maxTitleLength","defaultBegin"]),ot=i.get("linkGroup"),et=this.get("rows")||[[]],yt=(n=e.isCanvas)===null||n===void 0?void 0:n.call(e),Gt=yt?jl:e.getID(),yr=o[Gt]||{},kr=yr.card,Mr=yr.link,dr=yr.x,hn=yr.y,on=yr.title,cr=yr.content,Rr=this.get("getTitle"),Yr=this.get("getContent"),Wr=this.get("getContentPlaceholder")||function(){return""},sn=this.get("getTitlePlaceHolder")||function(){return""},wn=Wr(e),la=sn(e),da=(0,ka.Z)(this.getDOMContent(As({itemId:Gt,collapsed:ce,title:((a=on||Ce||(Rr==null?void 0:Rr(e)))===null||a===void 0?void 0:a.substr(0,Ve))||la,content:cr||Re||(Yr==null?void 0:Yr(e))||wn},$e))),Ra=(0,s.isNumber)(O)?"".concat(O,"px"):O;(0,aa.Z)(da,{minHeight:ce?"unset":Ra,minWidth:(0,s.isNumber)(A)?"".concat(A,"px"):A,height:$,width:z});var Ia=!!kr;Ia?(Mr==null||Mr.remove(!0),l.replaceChild(da,kr)):l.appendChild(da);var Xa;if(!h){if(Xa=l.getBoundingClientRect()||{},ue!==void 0&&ve!==void 0)dr=ue,hn=ve;else if(!Ia&&!yt){var Ga=Xa.top,ci=Ue||{},ja=ci.left,Os=ci.right,ki=Os===void 0?16:Os,Ls=ci.top,Ri=Ls===void 0?8:Ls,Bi=ci.bottom,fs=ki,lo=Ri;isNaN(ja)||(fs=l.scrollWidth-ja),isNaN(Bi)||(lo=l.scrollHeight-Bi);var Lo=(0,s.isNumber)(A)?A:100;dr=l.scrollWidth-da.scrollWidth-(et.length-1)*Lo-fs;var pa=et[et.length-1],Oa=(pa[pa.length-1]||{}).bbox;hn=(Oa==null?void 0:Oa.bottom)-Ga||lo}(0,aa.Z)(da,{position:"absolute",left:"".concat(dr,"px"),top:"".concat(hn,"px"),cusor:h?"unset":"move"})}this.bindListener(da,Gt);var va=da.getBoundingClientRect();if(!yt){var La=Nl(e,va,u,this.get("canvas")),za=this.get("linkStyle");Mr=ot.addShape("path",{attrs:As({lineWidth:1,lineDash:[5,5],stroke:"#ccc",path:La},za)})}if(o[Gt]=As(As({},o[Gt]||{}),{id:Gt,collapsed:ce,card:da,link:Mr,x:dr,y:hn,cardBBox:va,content:cr||Re,title:on||Ce,contentPlaceholder:wn,titlePlaceholder:la,isCanvas:yt}),i.set("cardInfoMap",o),h)this.updateCardPositionsInConatainer(),this.updateLinks();else{var Pn=!isNaN(ue)&&!isNaN(ve);if(!Ia&&!yt&&!Pn){var Ea=Xa.bottom,xa=Ea===void 0?0:Ea,Ga=Xa.top;et[et.length-1].push({id:Gt,bbox:va}),va.top>xa-Ga-va.height-16&&et.push([]),this.set("rows",et)}}this.updateCardSize(Gt);var Ua=this.get("onAnnotationChange");Ua==null||Ua(o[Gt],Ia?"update":"create")}},t.prototype.updateCardPositionsInConatainer=function(){if(!this.destroyed){var e=this.get("cardInfoMap");if(e){var r=this.get("container"),n=this.get("containerCfg").position,a=r.getBoundingClientRect().width,i=getComputedStyle(r),o=Dc(i.paddingLeft)+Dc(i.paddingRight);a-=o,Object.values(e).forEach(function(u){var l=u.card,h=l.getBoundingClientRect().width;switch(n){case"right":(0,aa.Z)(l,{marginLeft:a?"".concat(a-h,"px"):"0px"});break;case"top":case"bottom":(0,aa.Z)(l,{marginLeft:"8px"});default:break}})}}},t.prototype.handleExpandCollapseCard=function(e){if(!this.destroyed){var r=this.get("graph"),n=this.get("cardInfoMap");if(n){var a=n[e].collapsed,i=r.findById(e);if(i){var o=this.get("cardCfg").collapseType;o==="hide"&&!a?this.hideCard(e):this.toggleAnnotation(i,{collapsed:!a}),n[e]=As(As({},n[e]),{collapsed:!a})}}}},t.prototype.hideCard=function(e){if(!this.destroyed){var r=this.get("cardInfoMap");if(!(!r||!r[e])){var n=r[e],a=n.card,i=n.link;(0,aa.Z)(a,{display:"none"}),i==null||i.hide();var o=this.get("onAnnotationChange");o(r[e],"hide")}}},t.prototype.removeCard=function(e){if(!this.destroyed){var r=this.get("cardInfoMap");if(r){var n=r[e],a=n.card,i=n.link,o=this.get("container");o.removeChild(a),i==null||i.remove(!0),delete r[e];var u=this.get("onAnnotationChange");u(n,"remove")}}},t.prototype.bindListener=function(e,r){var n=this;if(!this.destroyed){e.addEventListener("mousemove",function(u){var l;if(u.target.className==="g6-annotation-collapse"?l="collapse":u.target.className==="g6-annotation-expand"?l="expand":u.target.className==="g6-annotation-close"&&(l="close"),l){var h=n.get("cardCfg").onMouseEnterIcon,y=h===void 0?function(){}:h;y(u,r,l)}}),e.addEventListener("mouseout",function(u){var l;if(u.target.className==="g6-annotation-collapse"?l="collapse":u.target.className==="g6-annotation-expand"?l="expand":u.target.className==="g6-annotation-close"&&(l="close"),l){var h=n.get("cardCfg").onMouseLeaveIcon,y=h===void 0?function(){}:h;y(u,r,l)}}),e.addEventListener("mouseenter",function(u){var l=n.get("cardInfoMap");if(l){var h=n.get("graph"),y=h.findById(r);if(y){var O=n.get("itemHighlightState");h.setItemState(y,O,!0)}var A=l[r].link;if(A){var z=n.get("linkHighlightStyle")||{};A.attr(z)}}}),e.addEventListener("mouseleave",function(u){var l=n.get("cardInfoMap");if(l){var h=n.get("graph"),y=h.findById(r);if(y){var O=n.get("itemHighlightState");h.setItemState(y,O,!1)}var A=l[r].link;if(A){var z=n.get("linkHighlightStyle")||{};Object.keys(z).forEach(function(ae){A.attr(ae,void 0),A.attr(ae,void 0)});var $=n.get("linkStyle");A.attr($)}}}),e.addEventListener("click",function(u){var l=(n.get("cardCfg")||{}).onClickIcon;if(u.target.className==="g6-annotation-collapse"||u.target.className==="g6-annotation-expand"){var h=n.get("cardCfg").collapseType;h==="hide"?n.hideCard(r):n.handleExpandCollapseCard(r),l==null||l(u,r,u.target.className==="g6-annotation-collapse"?"collapse":"expand")}else if(u.target.className==="g6-annotation-close"){var y=n.get("cardCfg").closeType;y==="remove"?n.removeCard(r):n.hideCard(r),l==null||l(u,r,"close")}});var a=this.get("editable");a&&e.addEventListener("dblclick",function(u){var l=n.get("cardInfoMap"),h=(n.get("cardCfg")||{}).maxTitleLength,y=h===void 0?20:h;if(l){var O=u.target,A=O.className;if(!(A!=="g6-annotation-title"&&A!=="g6-annotation-content")){var z=A==="g6-annotation-title"?O.getBoundingClientRect():O.parentNode.getBoundingClientRect(),$=z.width,ae=z.height,ce=getComputedStyle(O),ue=A==="g6-annotation-title"?"input":"textarea",ve=(0,ka.Z)("<".concat(ue,' class="').concat(A,'-input" type="textarea" style="width:').concat($,"px; height: ").concat(ae,'px; min-width: 16px;"/>')),Ce=(0,ka.Z)('
    '));Ce.appendChild(ve),O.parentNode.replaceChild(Ce,O);var Re=l[r],Ve=Re.contentPlaceholder,Ue=Re.titlePlaceholder,$e=Re.content,ot=Re.title,et=$e;A==="g6-annotation-title"?(ve.name="title",ve.maxLength=y,et=ot):ve.name="content",et?(ve.innerHTML=O.innerHTML,ve.value=O.innerHTML):ve.placeholder=A==="g6-annotation-title"?Ue:Ve,ve.focus(),ve.addEventListener("blur",function(yt){ve.value&&(O.innerHTML=ve.value,Re[ve.name||"title"]=ve.value),Ce.parentNode.replaceChild(O,Ce),n.updateCardSize(r);var Gt=n.get("onAnnotationChange");Gt==null||Gt(Re,"update")})}}});var i=["g6-annotation-title","g6-annotation-content","g6-annotation-title-input","g6-annotation-content-input"];e.draggable=!0,e.addEventListener("dragstart",function(u){var l=u.target.className;if(!i.includes(l)){var h=e.style;n.set("dragging",{card:e,x:u.clientX,y:u.clientY,left:Dc(h.left),top:Dc(h.top)})}}),e.addEventListener("drag",function(u){u.preventDefault();var l=n.get("cardInfoMap");if(l){var h=u.clientX,y=u.clientY,O=n.get("dragging");if(!(isNaN(h)||isNaN(y)||!O)){var A=O.x,z=O.y,$=O.left,ae=O.top,ce=O.card,ue=h-A,ve=y-z;$+=ue,ae+=ve;var Ce=n.get("graph"),Re=Ce.getPointByCanvas(0,0),Ve=Ce.getPointByCanvas(Ce.getWidth(),Ce.getHeight()),Ue=Ce.getClientByPoint(Re.x,Re.y),$e=Ue.x,ot=Ue.y,et=Ce.getClientByPoint(Ve.x,Ve.y),yt=et.x,Gt=et.y,yr=ce.getBoundingClientRect(),kr=yr.right-yr.left,Mr=yr.bottom-yr.top;($>yt-$e-kr&&ue>0||$<0&&ue<0)&&($-=ue),(ae>Gt-ot-Mr&&ve>0||ae<0&&ve<0)&&(ae-=ve),(0,aa.Z)(ce,{left:"".concat($,"px"),top:"".concat(ae,"px"),visibility:"hidden"}),A=h,z=y;var dr=(l[r]||{}).link;if(dr){var hn=Ce.findById(r);dr.attr("path",Nl(hn,yr,Ce,n.get("canvas")))}n.set("dragging",{x:A,y:z,left:$,top:ae,card:ce})}}});var o=function(l){var h=n.get("cardInfoMap");if(h){var y=n.get("dragging");if(y){var O=y.left,A=y.top,z=y.card;h[r].x=O,h[r].y=A,(0,aa.Z)(z,{visibility:"visible"}),n.set("dragging",!1);var $=n.get("rows");$==null||$.forEach(function(ce){for(var ue=ce.length-1;ue>=0;ue--)ce[ue].id===r&&ce.splice(ue,1)});var ae=n.get("onAnnotationChange");ae==null||ae(h[r],"update")}}};e.addEventListener("dragend",o)}},t.prototype.updateCardSize=function(e){var r=this.get("cardInfoMap");if(r){var n=r[e].card,a=n.getBoundingClientRect().width,i=n.getElementsByClassName("g6-annotation-title")[0];if(i){var o=getComputedStyle(i),u=Dc(o.marginLeft),l=i.getBoundingClientRect().width;(0,aa.Z)(i,{marginRight:"".concat(a-u-24-16-l,"px")})}}},t.prototype.updateLink=function(e){var r=e.item;if(r){var n=this.get("cardInfoMap");if(n){var a=this.get("canvas"),i=this.get("graph"),o=r.getID(),u=n[o]||{},l=u.link,h=u.card;if(l){var y=Nl(r,h.getBoundingClientRect(),i,a);l.attr("path",y)}}}},t.prototype.updateLinks=function(){var e=this;if(!this.destroyed){var r=this.get("cardInfoMap");if(r){var n=this.get("graph");Object.values(r).forEach(function(a){var i=a.id,o=n.findById(i);e.updateLink({item:o})})}}},t.prototype.onGraphDataChange=function(){var e=this,r=this.get("cardInfoMap");if(r){var n=this.get("graph");Object.values(r).forEach(function(a){var i=a.id,o=a.card,u=a.isCanvas;if(!(!o||u||o.style.display==="none")){var l=n.findById(i);l&&l.isVisible()?e.toggleAnnotation(l):e.hideCard(i)}})}},t.prototype.onGraphItemVisibilityChange=function(e){var r=e.item,n=e.visible;if(!(!r||r.destroyed)){var a=this.get("cardInfoMap");if(a){var i=r.getID();a[i]&&(n||this.hideCard(i))}}},t.prototype.saveData=function(e){e===void 0&&(e=!1);var r=this.get("cardInfoMap");if(r){var n=this.get("graph"),a=this.get("getTitle"),i=this.get("getContent"),o=[];return Object.values(r).forEach(function(u){var l=u.title,h=u.content,y=u.x,O=u.y,A=u.id,z=u.collapsed,$=u.card;if(!($&&$.style.display==="none"&&!e)){var ae=n.findById(A)||n.get("canvas");o.push({id:A,x:y,y:O,collapsed:z,title:l||(a==null?void 0:a(ae)),content:h||(i==null?void 0:i(ae)),visible:$&&$.style.display!=="none"})}}),o}},t.prototype.readData=function(e){var r=this,n=this.get("graph");e.forEach(function(a){var i=a.id,o=a.x,u=a.y,l=a.title,h=a.content,y=a.collapsed,O=a.visible,A=n.findById(i);if(!A&&i===jl&&(A=n.get("canvas")),!A){var z=r.get("cardInfoMap")||{};z[i]=a,r.set("cardInfoMap",z);return}r.toggleAnnotation(A,{x:o,y:u,title:l,content:h,collapsed:y}),O||r.hideCard(i)})},t.prototype.clear=function(){var e=this.get("cardInfoMap");if(e){var r=this.get("container");Object.values(e).forEach(function(n){var a=n.card,i=n.link;r.removeChild(a),i==null||i.remove(!0)}),this.set("cardInfoMap",{})}},t.prototype.destroy=function(){var e;this.clear(),(e=this.get("canvas"))===null||e===void 0||e.destroy();var r=this.get("graph");!r||r.destroyed||(this.get("containerCfg")&&r.getContainer().removeChild(this.get("container")),this.destroyed=!0)},t}(si),kd=Pd,Rd=function(t,e){var r,n,a,i=1/0;Object.keys(t).forEach(function(l){var h=t[l];Object.keys(e).forEach(function(y){var O=e[y],A=h.x-O.x,z=h.y-O.y,$=A*A+z*z;i>$&&(i=$,r=h,n=O,a=[l,y])})});var o=20,u=ei.getControlPoint(r,n,.5,o);return[["M",r.x,r.y],["Q",u.x,u.y,n.x,n.y]]},Nl=function(t,e,r,n){var a,i,o=t.getType();if(o==="edge")i=[t.getKeyShape().getPoint(.5)];else{var u=(a=t.getKeyShape)===null||a===void 0?void 0:a.call(t).getBBox(),l=u.minX,h=u.minY,y=u.maxX,O=u.maxY,A=t.getModel(),z=A.x,$=A.y;l+=z,h+=$,y+=z,O+=$,i={left:{x:l,y:(h+O)/2},right:{x:y,y:(h+O)/2},top:{x:(l+y)/2,y:h},bottom:{x:(l+y)/2,y:O}}}Object.keys(i).forEach(function(ot){var et=i[ot],yt=et.x,Gt=et.y,yr=r.getClientByPoint(yt,Gt);i[ot]=n.getPointByClient(yr.x,yr.y)});var ae=e.top,ce=ae===void 0?0:ae,ue=e.left,ve=ue===void 0?0:ue,Ce=e.right,Re=Ce===void 0?0:Ce,Ve=e.bottom,Ue=Ve===void 0?0:Ve,$e={left:n.getPointByClient(ve,(ce+Ue)/2),right:n.getPointByClient(Re,(ce+Ue)/2),top:n.getPointByClient((ve+Re)/2,ce),bottom:n.getPointByClient((ve+Re)/2,Ue)};return Rd(i,$e)},Dc=function(t){return Number(t.replace(/\s+|px/gi,""))||0},Bd={PluginBase:si,Menu:Nu,Grid:gl,Minimap:Qf,Bundling:ml,ToolBar:ec,Tooltip:it,Fisheye:qf,TimeBar:Tr,ImageMinimap:Hn,EdgeFilterLens:us,SnapLine:Id,Legend:Dd,Annotation:kd},Fd=Bd,Pi=Fd;so("circle",{options:{size:Zr.defaultNode.size,style:{x:0,y:0,stroke:Zr.defaultNode.style.stroke,fill:Zr.defaultNode.style.fill,lineWidth:Zr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Zr.nodeLabel.style.fill,fontSize:Zr.nodeLabel.style.fontSize,fontFamily:Zr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Zr.defaultNode.linkPoints.size,lineWidth:Zr.defaultNode.linkPoints.lineWidth,fill:Zr.defaultNode.linkPoints.fill,stroke:Zr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,c.__assign)({},Zr.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,a=this.getShapeStyle(t),i=(0,s.deepMix)({},n,t.icon),o="".concat(this.type,"-keyShape"),u=e.addShape("circle",{attrs:a,className:o,name:o,draggable:!0});e.shapeMap[o]=u;var l=i.width,h=i.height,y=i.show,O=i.text;if(y){var A="".concat(this.type,"-icon");O?e.shapeMap[A]=e.addShape("text",{attrs:(0,c.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:A,name:A,draggable:!0}):e.shapeMap[A]=e.addShape("image",{attrs:(0,c.__assign)({x:-l/2,y:-h/2},i),className:A,name:A,draggable:!0})}return this.drawLinkPoints(t,e),u},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints;if(r){var n=r||{},a=n.top,i=n.left,o=n.right,u=n.bottom,l=n.size,h=n.r,y=(0,c.__rest)(n,["top","left","right","bottom","size","r"]),O=this.getSize(t),A=O[0]/2;if(i){var z="link-point-left";e.shapeMap[z]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:-A,y:0,r:l/2||h||5}),className:z,name:z,isAnchorPoint:!0})}if(o){var $="link-point-right";e.shapeMap[$]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:A,y:0,r:l/2||h||5}),className:$,name:$,isAnchorPoint:!0})}if(a){var ae="link-point-top";e.shapeMap[ae]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:0,y:-A,r:l/2||h||5}),className:ae,name:ae,isAnchorPoint:!0})}if(u){var ce="link-point-bottom";e.shapeMap[ce]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:0,y:A,r:l/2||h||5}),className:ce,name:ce,isAnchorPoint:!0})}}},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,s.deepMix)({},e,r),a=this.getSize(t),i=a[0]/2,o=(0,c.__assign)({x:0,y:0,r:i},n);return o},update:function(t,e,r){var n=e.getContainer(),a=this.getSize(t),i=(0,c.__assign)({},t.style);t.style.stroke===void 0&&t.color&&(i.stroke=t.color),t.style.r===void 0&&!isNaN(a[0])&&(i.r=a[0]/2),this.updateShape(t,e,i,!0,r),this.updateLinkPoints(t,n)}},"single-node"),so("rect",{options:{size:[100,30],style:{radius:0,stroke:Zr.defaultNode.style.stroke,fill:Zr.defaultNode.style.fill,lineWidth:Zr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Zr.nodeLabel.style.fill,fontSize:Zr.nodeLabel.style.fontSize,fontFamily:Zr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Zr.defaultNode.linkPoints.size,lineWidth:Zr.defaultNode.linkPoints.lineWidth,fill:Zr.defaultNode.linkPoints.fill,stroke:Zr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},anchorPoints:[[0,.5],[1,.5]],stateStyles:(0,c.__assign)({},Zr.nodeStateStyles)},shapeType:"rect",labelPosition:"center",drawShape:function(t,e){var r=this.getShapeStyle(t),n=e.addShape("rect",{attrs:r,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});return e.shapeMap["".concat(this.type,"-keyShape")]=n,this.drawLinkPoints(t,e),n},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=r===void 0?{}:r,a=n.top,i=n.left,o=n.right,u=n.bottom,l=n.size,h=n.r,y=(0,c.__rest)(n,["top","left","right","bottom","size","r"]),O=this.getSize(t),A=O[0],z=O[1];i&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:-A/2,y:0,r:l/2||h||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:A/2,y:0,r:l/2||h||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:0,y:-z/2,r:l/2||h||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:0,y:z/2,r:l/2||h||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,s.mix)({},e,r),a=this.getSize(t),i=n.width||a[0],o=n.height||a[1],u=(0,c.__assign)({x:-i/2,y:-o/2,width:i,height:o},n);return u},update:function(t,e,r){var n=e.getContainer(),a=this.getOptions({}).style,i=this.getSize(t),o=e.get("keyShape");t.size||(i[0]=o.attr("width")||a.width,i[1]=o.attr("height")||a.height);var u={stroke:t.color,x:-i[0]/2,y:-i[1]/2,width:i[0],height:i[1]},l=(0,s.mix)({},a,o.attr(),u);l=(0,s.mix)(l,t.style),this.updateShape(t,e,l,!1,r),this.updateLinkPoints(t,n)}},"single-node"),so("ellipse",{options:{size:[80,40],style:{x:0,y:0,stroke:Zr.defaultNode.style.stroke,fill:Zr.defaultNode.style.fill,lineWidth:Zr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Zr.nodeLabel.style.fill,fontSize:Zr.nodeLabel.style.fontSize,fontFamily:Zr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Zr.defaultNode.linkPoints.size,lineWidth:Zr.defaultNode.linkPoints.lineWidth,fill:Zr.defaultNode.linkPoints.fill,stroke:Zr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,c.__assign)({},Zr.nodeStateStyles)},shapeType:"ellipse",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,a=this.getShapeStyle(t),i=e.addShape("ellipse",{attrs:a,className:"ellipse-keyShape",name:"ellipse-keyShape",draggable:!0});e.shapeMap["ellipse-keyShape"]=i;var o=n.width,u=n.height,l=n.show,h=n.text;return l&&(h?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,c.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:(0,c.__assign)({x:-o/2,y:-u/2},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),i},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=r===void 0?{}:r,a=n.top,i=n.left,o=n.right,u=n.bottom,l=n.size,h=n.r,y=(0,c.__rest)(n,["top","left","right","bottom","size","r"]),O=this.getSize(t),A=O[0]/2,z=O[1]/2;i&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:-A,y:0,r:l/2||h||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:A,y:0,r:l/2||h||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:0,y:-z,r:l/2||h||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:0,y:z,r:l/2||h||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,s.mix)({},e,r),a=this.getSize(t),i=a[0]/2,o=a[1]/2,u=(0,c.__assign)({x:0,y:0,rx:i,ry:o},n);return u},update:function(t,e,r){var n=e.getContainer(),a=this.getOptions({}).style,i=this.getSize(t),o={stroke:t.color,rx:i[0]/2,ry:i[1]/2},u=e.get("keyShape"),l=(0,s.mix)({},a,u.attr(),o);l=(0,s.mix)(l,t.style),this.updateShape(t,e,l,!0,r),this.updateLinkPoints(t,n)}},"single-node"),so("diamond",{options:{size:[80,80],style:{stroke:Zr.defaultNode.style.stroke,fill:Zr.defaultNode.style.fill,lineWidth:Zr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Zr.nodeLabel.style.fill,fontSize:Zr.nodeLabel.style.fontSize,fontFamily:Zr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Zr.defaultNode.linkPoints.size,lineWidth:Zr.defaultNode.linkPoints.lineWidth,fill:Zr.defaultNode.linkPoints.fill,stroke:Zr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,c.__assign)({},Zr.nodeStateStyles)},shapeType:"diamond",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,a=this.getShapeStyle(t),i=e.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=i;var o=n.width,u=n.height,l=n.show,h=n.text;return l&&(h?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,c.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:(0,c.__assign)({x:-o/2,y:-u/2},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),i},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=r===void 0?{}:r,a=n.top,i=n.left,o=n.right,u=n.bottom,l=n.size,h=n.r,y=(0,c.__rest)(n,["top","left","right","bottom","size","r"]),O=this.getSize(t),A=O[0],z=O[1];i&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:-A/2,y:0,r:l/2||h||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:A/2,y:0,r:l/2||h||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:0,y:-z/2,r:l/2||h||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:0,y:z/2,r:l/2||h||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},getPath:function(t){var e=this.getSize(t),r=e[0],n=e[1],a=[["M",0,-n/2],["L",r/2,0],["L",0,n/2],["L",-r/2,0],["Z"]];return a},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,s.mix)({},e,r),a=this.getPath(t),i=(0,c.__assign)({path:a},n);return i},update:function(t,e,r){var n=e.getContainer(),a=this.getOptions({}).style,i=this.getPath(t),o={stroke:t.color,path:i},u=e.get("keyShape"),l=(0,s.mix)({},a,u.attr(),o);l=(0,s.mix)(l,t.style),this.updateShape(t,e,l,!0,r),this.updateLinkPoints(t,n)}},"single-node"),so("triangle",{options:{size:40,direction:"up",style:{stroke:Zr.defaultNode.style.stroke,fill:Zr.defaultNode.style.fill,lineWidth:Zr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Zr.nodeLabel.style.fill,fontSize:Zr.nodeLabel.style.fontSize},offset:15},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Zr.defaultNode.linkPoints.size,lineWidth:Zr.defaultNode.linkPoints.lineWidth,fill:Zr.defaultNode.linkPoints.fill,stroke:Zr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20,offset:6},stateStyles:(0,c.__assign)({},Zr.nodeStateStyles)},shapeType:"triangle",labelPosition:"bottom",drawShape:function(t,e){var r=this.mergeStyle||this.getOptions(t),n=r.icon,a=n===void 0?{}:n,i=r.direction,o=this.getShapeStyle(t),u=t.direction||i,l=e.addShape("path",{attrs:o,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=l;var h=a.width,y=a.height,O=a.show,A=a.offset,z=a.text;if(O)if(z)e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,c.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0});else{var $=-h/2,ae=-y/2;(u==="up"||u==="down")&&(ae+=A),(u==="left"||u==="right")&&($+=A),e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:(0,c.__assign)({x:$,y:ae},a),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})}return this.drawLinkPoints(t,e),l},drawLinkPoints:function(t,e){var r=this.mergeStyle||this.getOptions(t),n=r.linkPoints,a=n===void 0?{}:n,i=r.direction,o=t.direction||i,u=a.top,l=a.left,h=a.right,y=a.bottom,O=a.size,A=a.r,z=(0,c.__rest)(a,["top","left","right","bottom","size","r"]),$=this.getSize(t),ae=$[0];if(l){var ce=null,ue=ae*Math.sin(1/3*Math.PI),ve=ae*Math.sin(1/3*Math.PI);o==="up"?ce=[-ve,ue]:o==="down"?ce=[-ve,-ue]:o==="left"&&(ce=[-ve,ve-ue]),ce&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},z),{x:ce[0],y:ce[1],r:O/2||A||5}),className:"link-point-left",name:"link-point-left"}))}if(h){var Ce=null,ue=ae*Math.sin(1/3*Math.PI),ve=ae*Math.sin(1/3*Math.PI);o==="up"?Ce=[ve,ue]:o==="down"?Ce=[ve,-ue]:o==="right"&&(Ce=[ve,ve-ue]),Ce&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},z),{x:Ce[0],y:Ce[1],r:O/2||A||5}),className:"link-point-right",name:"link-point-right"}))}if(u){var Re=null,ue=ae*Math.sin(1/3*Math.PI),ve=ae*Math.sin(1/3*Math.PI);o==="up"?Re=[ve-ue,-ue]:o==="left"?Re=[ve,-ue]:o==="right"&&(Re=[-ve,-ue]),Re&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},z),{x:Re[0],y:Re[1],r:O/2||A||5}),className:"link-point-top",name:"link-point-top"}))}if(y){var Ve=null,ue=ae*Math.sin(1/3*Math.PI),ve=ae*Math.sin(1/3*Math.PI);o==="down"?Ve=[-ve+ue,ue]:o==="left"?Ve=[ve,ue]:o==="right"&&(Ve=[-ve,ue]),Ve&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},z),{x:Ve[0],y:Ve[1],r:O/2||A||5}),className:"link-point-bottom",name:"link-point-bottom"}))}},getPath:function(t){var e=(this.mergeStyle||this.getOptions(t)).direction,r=t.direction||e,n=this.getSize(t),a=n[0],i=a*Math.sin(1/3*Math.PI),o=a*Math.sin(1/3*Math.PI),u=[["M",-o,i],["L",0,-i],["L",o,i],["Z"]];return r==="down"?u=[["M",-o,-i],["L",o,-i],["L",0,i],["Z"]]:r==="left"?u=[["M",-o,o-i],["L",o,-o],["L",o,o],["Z"]]:r==="right"&&(u=[["M",o,o-i],["L",-o,o],["L",-o,-o],["Z"]]),u},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,s.mix)({},e,r),a=this.getPath(t),i=(0,c.__assign)({path:a},n);return i},update:function(t,e,r){var n=e.getContainer(),a=this.getOptions({}).style,i=this.getPath(t),o={stroke:t.color,path:i},u=e.get("keyShape"),l=(0,s.mix)({},a,u.attr(),o);l=(0,s.mix)(l,t.style),this.updateShape(t,e,l,!0,r),this.updateLinkPoints(t,n)},updateLinkPoints:function(t,e){var r=this.getOptions({}),n=r.linkPoints,a=r.direction,i=t.direction||a,o=e.shapeMap["link-point-left"]||e.find(function(dr){return dr.get("className")==="link-point-left"}),u=e.shapeMap["link-point-right"]||e.find(function(dr){return dr.get("className")==="link-point-right"}),l=e.shapeMap["link-point-top"]||e.find(function(dr){return dr.get("className")==="link-point-top"}),h=e.shapeMap["link-point-bottom"]||e.find(function(dr){return dr.get("className")==="link-point-bottom"}),y=n,O=o||u||l||h;O&&(y=O.attr());var A=(0,s.mix)({},y,t.linkPoints),z=A.fill,$=A.stroke,ae=A.lineWidth,ce=A.size/2;ce||(ce=A.r);var ue=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,bottom:void 0},ve=ue.left,Ce=ue.right,Re=ue.top,Ve=ue.bottom,Ue=this.getSize(t),$e=Ue[0],ot={r:ce,fill:z,stroke:$,lineWidth:ae},et=null,yt=$e*Math.sin(1/3*Math.PI),Gt=$e*Math.sin(1/3*Math.PI);i==="up"?et=[-Gt,yt]:i==="down"?et=[-Gt,-yt]:i==="left"&&(et=[-Gt,Gt-yt]),et&&(o?!ve&&ve!==void 0?(o.remove(),delete e.shapeMap["link-point-left"]):o.attr((0,c.__assign)((0,c.__assign)({},ot),{x:et[0],y:et[1]})):ve&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},ot),{x:et[0],y:et[1]}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})));var yr=null;i==="up"?yr=[Gt,yt]:i==="down"?yr=[Gt,-yt]:i==="right"&&(yr=[Gt,Gt-yt]),yr&&(u?!Ce&&Ce!==void 0?(u.remove(),delete e.shapeMap["link-point-right"]):u.attr((0,c.__assign)((0,c.__assign)({},ot),{x:yr[0],y:yr[1]})):Ce&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},ot),{x:yr[0],y:yr[1]}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})));var kr=null;i==="up"?kr=[Gt-yt,-yt]:i==="left"?kr=[Gt,-yt]:i==="right"&&(kr=[-Gt,-yt]),kr&&(l?!Re&&Re!==void 0?(l.remove(),delete e.shapeMap["link-point-top"]):l.attr((0,c.__assign)((0,c.__assign)({},ot),{x:kr[0],y:kr[1]})):Re&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},ot),{x:kr[0],y:kr[1]}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})));var Mr=null;i==="down"?Mr=[-Gt+yt,yt]:i==="left"?Mr=[Gt,yt]:i==="right"&&(Mr=[-Gt,yt]),Mr&&(h?!Ve&&Ve!==void 0?(h.remove(),delete e.shapeMap["link-point-bottom"]):h.attr((0,c.__assign)((0,c.__assign)({},ot),{x:Mr[0],y:Mr[1]})):Ve&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},ot),{x:Mr[0],y:Mr[1]}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0})))}},"single-node"),so("modelRect",{options:{size:[185,70],style:{radius:5,stroke:"#69c0ff",fill:"#ffffff",lineWidth:Zr.defaultNode.style.lineWidth,fillOpacity:1},labelCfg:{style:{fill:"#595959",fontSize:14,fontFamily:Zr.windowFontFamily},offset:30},descriptionCfg:{style:{fontSize:12,fill:"#bfbfbf",fontFamily:Zr.windowFontFamily},paddingTop:0},preRect:{show:!0,width:4,fill:"#40a9ff",radius:2},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:10,lineWidth:1,fill:"#72CC4A",stroke:"#72CC4A"},logoIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/4f81893c-1806-4de4-aff3-9a6b266bc8a2.svg",width:16,height:16,offset:0},stateIcon:{show:!0,x:0,y:0,img:"https://gw.alipayobjects.com/zos/basement_prod/300a2523-67e0-4cbf-9d4a-67c077b40395.svg",width:16,height:16,offset:-5},anchorPoints:[[0,.5],[1,.5]]},shapeType:"modelRect",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).preRect,n=r===void 0?{}:r,a=this.getShapeStyle(t),i=this.getSize(t),o=i[0],u=i[1],l=e.addShape("rect",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=l;var h=n.show,y=(0,c.__rest)(n,["show"]);return h&&(e.shapeMap["pre-rect"]=e.addShape("rect",{attrs:(0,c.__assign)({x:-o/2,y:-u/2,height:u},y),className:"pre-rect",name:"pre-rect",draggable:!0})),this.drawLogoIcon(t,e),this.drawStateIcon(t,e),this.drawLinkPoints(t,e),l},drawLogoIcon:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).logoIcon,n=r===void 0?{}:r,a=this.getSize(t),i=a[0];if(n.show){var o=n.width,u=n.height,l=n.x,h=n.y,y=n.offset,O=n.text,A=(0,c.__rest)(n,["width","height","x","y","offset","text"]);O?e.shapeMap["rect-logo-icon"]=e.addShape("text",{attrs:(0,c.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},A),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0}):e.shapeMap["rect-logo-icon"]=e.addShape("image",{attrs:(0,c.__assign)((0,c.__assign)({},A),{x:l||-i/2+o+y,y:h||-u/2,width:o,height:u}),className:"rect-logo-icon",name:"rect-logo-icon",draggable:!0})}},drawStateIcon:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).stateIcon,n=r===void 0?{}:r,a=this.getSize(t),i=a[0];if(n.show){var o=n.width,u=n.height,l=n.x,h=n.y,y=n.offset,O=n.text,A=(0,c.__rest)(n,["width","height","x","y","offset","text"]);O?e.shapeMap["rect-state-icon"]=e.addShape("text",{attrs:(0,c.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},A),className:"rect-state-icon",name:"rect-state-icon",draggable:!0}):e.shapeMap["rect-state-icon"]=e.addShape("image",{attrs:(0,c.__assign)((0,c.__assign)({},A),{x:l||i/2-o+y,y:h||-u/2,width:o,height:u}),className:"rect-state-icon",name:"rect-state-icon",draggable:!0})}},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=r===void 0?{}:r,a=n.top,i=n.left,o=n.right,u=n.bottom,l=n.size,h=n.r,y=(0,c.__rest)(n,["top","left","right","bottom","size","r"]),O=this.getSize(t),A=O[0],z=O[1];i&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:-A/2,y:0,r:l/2||h||5}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),o&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:A/2,y:0,r:l/2||h||5}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),a&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:0,y:-z/2,r:l/2||h||5}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),u&&(e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},y),{x:0,y:z/2,r:l/2||h||5}),className:"link-point-bottom",name:"link-point-bottom",isAnchorPoint:!0}))},drawLabel:function(t,e){var r=this.getOptions(t),n=r.labelCfg,a=n===void 0?{}:n,i=r.logoIcon,o=i===void 0?{}:i,u=r.descriptionCfg,l=u===void 0?{}:u,h=this.getSize(t),y=h[0],O=null,A=o.show,z=o.width,$=-y/2+a.offset;A&&($=-y/2+z+a.offset);var ae=a.style,ce=l.style,ue=l.paddingTop;return(0,s.isString)(t.description)?(O=e.addShape("text",{attrs:(0,c.__assign)((0,c.__assign)({},ae),{x:$,y:-5,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=O,e.shapeMap["rect-description"]=e.addShape("text",{attrs:(0,c.__assign)((0,c.__assign)({},ce),{x:$,y:17+(ue||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0})):(O=e.addShape("text",{attrs:(0,c.__assign)((0,c.__assign)({},ae),{x:$,y:7,text:t.label}),className:"text-shape",name:"text-shape",draggable:!0,labelRelated:!0}),e.shapeMap["text-shape"]=O),O},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,s.mix)({},e,r),a=this.getSize(t),i=n.width||a[0],o=n.height||a[1],u=(0,c.__assign)({x:-i/2,y:-o/2,width:i,height:o},n);return u},update:function(t,e){var r=this.mergeStyle||this.getOptions(t),n=r.style,a=n===void 0?{}:n,i=r.labelCfg,o=i===void 0?{}:i,u=r.descriptionCfg,l=u===void 0?{}:u,h=this.getSize(t),y=h[0],O=h[1],A=e.get("keyShape");A.attr((0,c.__assign)((0,c.__assign)({},a),{x:-y/2,y:-O/2,width:y,height:O}));var z=e.getContainer(),$=z.shapeMap["rect-logo-icon"]||z.find(function(da){return da.get("className")==="rect-logo-icon"}),ae=$?$.attr():{},ce=(0,s.mix)({},ae,t.logoIcon),ue=ce.width;ue===void 0&&(ue=this.options.logoIcon.width);var ve=t.logoIcon?t.logoIcon.show:void 0,Ce=o.offset,Re=-y/2+ue+Ce;!ve&&ve!==void 0&&(Re=-y/2+Ce);var Ve=z.shapeMap["node-label"]||z.find(function(da){return da.get("className")==="node-label"}),Ue=z.shapeMap["rect-description"]||z.find(function(da){return da.get("className")==="rect-description"});if(t.label)if(!Ve)z.shapeMap["node-label"]=z.addShape("text",{attrs:(0,c.__assign)((0,c.__assign)({},o.style),{x:Re,y:t.description?-5:7,text:t.label}),className:"node-label",name:"node-label",draggable:!0,labelRelated:!0});else{var $e=t.labelCfg?t.labelCfg.style:{},ot=(0,s.mix)({},Ve.attr(),$e);t.label&&(ot.text=t.label),ot.x=Re,(0,s.isString)(t.description)&&(ot.y=-5),Ue&&(Ue.resetMatrix(),Ue.attr({x:Re})),Ve.resetMatrix(),Ve.attr(ot)}if((0,s.isString)(t.description)){var et=l.paddingTop;if(!Ue)z.shapeMap["rect-description"]=z.addShape("text",{attrs:(0,c.__assign)((0,c.__assign)({},l.style),{x:Re,y:17+(et||0),text:t.description}),className:"rect-description",name:"rect-description",draggable:!0,labelRelated:!0});else{var $e=t.descriptionCfg?t.descriptionCfg.style:{},yt=(0,s.mix)({},Ue.attr(),$e);(0,s.isString)(t.description)&&(yt.text=t.description),yt.x=Re,Ue.resetMatrix(),Ue.attr((0,c.__assign)((0,c.__assign)({},yt),{y:17+(et||0)}))}}var Gt=z.shapeMap["pre-rect"]||z.find(function(da){return da.get("className")==="pre-rect"});if(Gt&&!Gt.destroyed){var yr=(0,s.mix)({},Gt.attr(),t.preRect);Gt.attr((0,c.__assign)((0,c.__assign)({},yr),{x:-y/2,y:-O/2,height:O}))}if($&&!$.destroyed)if(!ve&&ve!==void 0)$.remove(),delete z.shapeMap["pre-rect"];else{var kr=ce.width,Mr=ce.height,dr=ce.x,hn=ce.y,on=ce.offset,cr=(0,c.__rest)(ce,["width","height","x","y","offset"]);$.attr((0,c.__assign)((0,c.__assign)({},cr),{x:dr||-y/2+kr+on,y:hn||-Mr/2,width:kr,height:Mr}))}else ve&&this.drawLogoIcon(t,z);var Rr=z.shapeMap["rect-state-icon"]||z.find(function(da){return da.get("className")==="rect-state-icon"}),Yr=Rr?Rr.attr():{},Wr=(0,s.mix)({},Yr,t.stateIcon);if(Rr){!Wr.show&&Wr.show!==void 0&&(Rr.remove(),delete z.shapeMap["rect-state-icon"]);var sn=Wr.width,Mr=Wr.height,dr=Wr.x,hn=Wr.y,wn=Wr.offset,la=(0,c.__rest)(Wr,["width","height","x","y","offset"]);Rr.attr((0,c.__assign)((0,c.__assign)({},la),{x:dr||y/2-sn+wn,y:hn||-Mr/2,width:sn,height:Mr}))}else Wr.show&&this.drawStateIcon(t,z);this.updateLinkPoints(t,z)},getOptions:function(t,e){return e==="move"?t:(0,s.deepMix)({},this.options,this.getCustomConfig(t)||{},t)}},"single-node"),so("star",{options:{size:60,style:{stroke:Zr.defaultNode.style.stroke,fill:Zr.defaultNode.style.fill,lineWidth:Zr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Zr.nodeLabel.style.fill,fontSize:Zr.nodeLabel.style.fontSize,fontFamily:Zr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Zr.defaultNode.linkPoints.size,lineWidth:Zr.defaultNode.linkPoints.lineWidth,fill:Zr.defaultNode.linkPoints.fill,stroke:Zr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,c.__assign)({},Zr.nodeStateStyles)},shapeType:"star",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,a=this.getShapeStyle(t),i=e.addShape("path",{attrs:a,className:"".concat(this.type,"-keyShape"),name:"".concat(this.type,"-keyShape"),draggable:!0});e.shapeMap["".concat(this.type,"-keyShape")]=i;var o=n.width,u=n.height,l=n.show,h=n.text;return l&&(h?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,c.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:(0,c.__assign)({x:-o/2,y:-u/2},n),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),this.drawLinkPoints(t,e),i},drawLinkPoints:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).linkPoints,n=r===void 0?{}:r,a=n.top,i=n.left,o=n.right,u=n.leftBottom,l=n.rightBottom,h=n.size,y=n.r,O=(0,c.__rest)(n,["top","left","right","leftBottom","rightBottom","size","r"]),A=this.getSize(t),z=A[0];if(o){var $=Math.cos(.1*Math.PI)*z,ae=Math.sin((18+72*0)/180*Math.PI)*z;e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},O),{x:$,y:-ae,r:h/2||y||5}),className:"link-point-right",name:"link-point-right"})}if(a){var $=Math.cos(.5*Math.PI)*z,ae=Math.sin((18+72*1)/180*Math.PI)*z;e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},O),{x:$,y:-ae,r:h/2||y||5}),className:"link-point-top",name:"link-point-top"})}if(i){var $=Math.cos(.9*Math.PI)*z,ae=Math.sin((18+72*2)/180*Math.PI)*z;e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},O),{x:$,y:-ae,r:h/2||y||5}),className:"link-point-left",name:"link-point-left"})}if(u){var $=Math.cos(1.3*Math.PI)*z,ae=Math.sin((18+72*3)/180*Math.PI)*z;e.shapeMap["link-point-bottom"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},O),{x:$,y:-ae,r:h/2||y||5}),className:"link-point-left-bottom",name:"link-point-left-bottom"})}if(l){var $=Math.cos(1.7*Math.PI)*z,ae=Math.sin((18+72*4)/180*Math.PI)*z;e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},O),{x:$,y:-ae,r:h/2||y||5}),className:"link-point-right-bottom",name:"link-point-right-bottom"})}},getPath:function(t){var e=this.getSize(t),r=e[0],n=r*3/8,a=t.innerR||n;return ei.getStarPath(r,a)},getShapeStyle:function(t){var e=(this.mergeStyle||this.getOptions(t)).style,r={stroke:t.color},n=(0,s.mix)({},e,r),a=this.getPath(t),i=(0,c.__assign)({path:a},n);return i},update:function(t,e,r){var n=e.getContainer(),a=this.getOptions({}).style,i=this.getPath(t),o={stroke:t.color,path:i},u=e.get("keyShape"),l=(0,s.mix)({},a,u.attr(),o);l=(0,s.mix)(l,t.style),this.updateShape(t,e,l,!0,r),this.updateLinkPoints(t,n)},updateLinkPoints:function(t,e){var r=this.getOptions({}).linkPoints,n=e.shapeMap["link-point-left"]||e.find(function(yt){return yt.get("className")==="link-point-left"}),a=e.shapeMap["link-point-right"]||e.find(function(yt){return yt.get("className")==="link-point-right"}),i=e.shapeMap["link-point-top"]||e.find(function(yt){return yt.get("className")==="link-point-top"}),o=e.shapeMap["link-point-left-bottom"]||e.find(function(yt){return yt.get("className")==="link-point-left-bottom"}),u=e.shapeMap["link-point-left-bottom"]||e.find(function(yt){return yt.get("className")==="link-point-right-bottom"}),l=r,h=n||a||i||o||u;h&&(l=h.attr());var y=(0,s.mix)({},l,t.linkPoints),O=y.fill,A=y.stroke,z=y.lineWidth,$=y.size/2;$||($=y.r);var ae=t.linkPoints?t.linkPoints:{left:void 0,right:void 0,top:void 0,leftBottom:void 0,rightBottom:void 0},ce=ae.left,ue=ae.right,ve=ae.top,Ce=ae.leftBottom,Re=ae.rightBottom,Ve=this.getSize(t),Ue=Ve[0],$e={r:$,fill:O,stroke:A,lineWidth:z},ot=Math.cos((18+72*0)/180*Math.PI)*Ue,et=Math.sin((18+72*0)/180*Math.PI)*Ue;a?!ue&&ue!==void 0?(a.remove(),delete e.shapeMap["link-point-right"]):a.attr((0,c.__assign)((0,c.__assign)({},$e),{x:ot,y:-et})):ue&&(e.shapeMap["link-point-right"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},$e),{x:ot,y:-et}),className:"link-point-right",name:"link-point-right",isAnchorPoint:!0})),ot=Math.cos((18+72*1)/180*Math.PI)*Ue,et=Math.sin((18+72*1)/180*Math.PI)*Ue,i?!ve&&ve!==void 0?(i.remove(),delete e.shapeMap["link-point-top"]):i.attr((0,c.__assign)((0,c.__assign)({},$e),{x:ot,y:-et})):ve&&(e.shapeMap["link-point-top"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},$e),{x:ot,y:-et}),className:"link-point-top",name:"link-point-top",isAnchorPoint:!0})),ot=Math.cos((18+72*2)/180*Math.PI)*Ue,et=Math.sin((18+72*2)/180*Math.PI)*Ue,n?!ce&&ce!==void 0?(n.remove(),delete e.shapeMap["link-point-left"]):n.attr((0,c.__assign)((0,c.__assign)({},$e),{x:ot,y:-et})):ce&&(e.shapeMap["link-point-left"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},$e),{x:ot,y:-et}),className:"link-point-left",name:"link-point-left",isAnchorPoint:!0})),ot=Math.cos((18+72*3)/180*Math.PI)*Ue,et=Math.sin((18+72*3)/180*Math.PI)*Ue,o?!Ce&&Ce!==void 0?(o.remove(),delete e.shapeMap["link-point-left-bottom"]):o.attr((0,c.__assign)((0,c.__assign)({},$e),{x:ot,y:-et})):Ce&&(e.shapeMap["link-point-left-bottom"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},$e),{x:ot,y:-et}),className:"link-point-left-bottom",name:"link-point-left-bottom",isAnchorPoint:!0})),ot=Math.cos((18+72*4)/180*Math.PI)*Ue,et=Math.sin((18+72*4)/180*Math.PI)*Ue,u?!Re&&Re!==void 0?(u.remove(),delete e.shapeMap["link-point-right-bottom"]):u.attr((0,c.__assign)((0,c.__assign)({},$e),{x:ot,y:-et})):Re&&(e.shapeMap["link-point-right-bottom"]=e.addShape("circle",{attrs:(0,c.__assign)((0,c.__assign)({},$e),{x:ot,y:-et}),className:"link-point-right-bottom",name:"link-point-right-bottom",isAnchorPoint:!0}))}},"single-node");var Vl=ei.defaultSubjectColors,El="fan-shape-";so("donut",{options:{size:Zr.defaultNode.size,style:{x:0,y:0,stroke:Zr.defaultNode.style.stroke,fill:Zr.defaultNode.style.fill,lineWidth:Zr.defaultNode.style.lineWidth},labelCfg:{style:{fill:Zr.nodeLabel.style.fill,fontSize:Zr.nodeLabel.style.fontSize,fontFamily:Zr.windowFontFamily}},linkPoints:{top:!1,right:!1,bottom:!1,left:!1,size:Zr.defaultNode.linkPoints.size,lineWidth:Zr.defaultNode.linkPoints.lineWidth,fill:Zr.defaultNode.linkPoints.fill,stroke:Zr.defaultNode.linkPoints.stroke},icon:{show:!1,img:"https://gw.alipayobjects.com/zos/bmw-prod/5d015065-8505-4e7a-baec-976f81e3c41d.svg",width:20,height:20},stateStyles:(0,c.__assign)({},Zr.nodeStateStyles)},shapeType:"circle",labelPosition:"center",drawShape:function(t,e){var r=(this.mergeStyle||this.getOptions(t)).icon,n=r===void 0?{}:r,a=this.getShapeStyle(t),i=(0,s.deepMix)({},n,t.icon),o=e.addShape("circle",{attrs:a,className:"".concat(this.type,"-keyShape"),draggable:!0,name:"".concat(this.type,"-keyShape")});e.shapeMap["".concat(this.type,"-keyShape")]=o;var u=i.width,l=i.height,h=i.show,y=i.text;return h&&(y?e.shapeMap["".concat(this.type,"-icon")]=e.addShape("text",{attrs:(0,c.__assign)({x:0,y:0,fontSize:12,fill:"#000",stroke:"#000",textBaseline:"middle",textAlign:"center"},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0}):e.shapeMap["".concat(this.type,"-icon")]=e.addShape("image",{attrs:(0,c.__assign)({x:-u/2,y:-l/2},i),className:"".concat(this.type,"-icon"),name:"".concat(this.type,"-icon"),draggable:!0})),Gd(t,e,o),this.drawLinkPoints(t,e),o},updateShape:function(t,e,r,n,a){var i=e.get("keyShape");i.attr((0,c.__assign)({},r)),zd(t,e,i),this.updateLabel(t,e,a),n&&this.updateIcon(t,e)}},"circle");var Gd=function(t,e,r){var n=t.donutAttrs,a=n===void 0?{}:n,i=t.donutColorMap,o=i===void 0?{}:i,u=Object.keys(a).length;if(a&&u>1){var l=Yl(a,o),h=l.configs,y=l.totalValue;if(y){var O=Hl(r),A=O.lineWidth,z=O.arcR,$=[z,0],ae=0;if(u===1){Pl(e,{arcR:z,arcBegin:$,beginAngle:ae,config:h[0],fanIndex:0,lineWidth:A,totalValue:y,drawWhole:!0});return}for(var ce=0;ce.999)$=[r,1e-4],ce=1;else{var ue=z*Math.PI*2;ae=a+ue,$=[r*Math.cos(ae),-r*Math.sin(ae)],ce=ue>Math.PI?1:0}var ve={path:[["M",n[0],n[1]],["A",r,r,0,ce,0,$[0],$[1]]],stroke:i.color||(A==null?void 0:A.attr("stroke"))||Vl[o%Vl.length],lineWidth:u};return A?A.attr(ve):t.shapeMap["".concat(El).concat(o)]=t.addShape("path",{attrs:ve,name:"".concat(El).concat(o),draggable:!0}),{beginAngle:ae,arcBegin:$,shape:t.shapeMap["".concat(El).concat(o)],shouldEnd:y||z>.999}},zd=function(t,e,r){var n=t.donutAttrs,a=t.donutColorMap,i=a===void 0?{}:a,o={},u=e.getContainer();if(n){var l=Yl(n,i),h=l.configs,y=l.totalValue;if(y)for(var O=Hl(r),A=O.lineWidth,z=O.arcR,$=[z,0],ae=0,ce=0;ce=0;a--){var i=t[a];i.id="".concat(i.x,"|||").concat(i.y),r[i.id]||(r[i.id]=i,e.push(i))}return e},Zl=function(t){return kl(t)},rv=function(t,e){return[t,{x:t.x,y:e.y},e]},Ml=function(t,e){return t.width||t.height?{centerX:t.centerX,centerY:t.centerY,minX:t.minX-e,minY:t.minY-e,maxX:t.maxX+e,maxY:t.maxY+e,height:t.height+2*e,width:t.width+2*e}:t},Wd=function(t,e){var r=Math.abs(t.x-e.centerX),n=Math.abs(t.y-e.centerY);return r===0&&n===0?0:r/e.width>n/e.height},Rl=function(t,e,r){var n=Wd(e,t);if(n===0){var a=t.centerX,i=t.centerY;return r.ye.x?a=t.maxX:r.xt.centerX?t.maxX:t.minX,y:e.y}:{x:e.x,y:e.y>t.centerY?t.maxY:t.minY}},Kl=function(t,e){var r=Math.min(t.minX,e.minX),n=Math.min(t.minY,e.minY),a=Math.max(t.maxX,e.maxX),i=Math.max(t.maxY,e.maxY);return{centerX:(r+a)/2,centerY:(n+i)/2,minX:r,minY:n,maxX:a,maxY:i,height:i-n,width:a-r}},Bl=function(t){return[{x:t.minX,y:t.minY},{x:t.maxX,y:t.minY},{x:t.maxX,y:t.maxY},{x:t.minX,y:t.maxY}]},Cl=function(t,e){var r=t.x,n=t.y;return re.maxX||ne.maxY},Xd=function(t,e){return et.maxX?[]:[{x:e,y:t.minY},{x:e,y:t.maxY}]},jd=function(t,e){return et.maxY?[]:[{x:t.minX,y:e},{x:t.maxX,y:e}]},Vd=function(t,e){return Xd(t,e.x).concat(jd(t,e.y))},xl=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},Yd=function(t,e){var r=-2,n=0;return e.forEach(function(a){a&&(t.x===a.x&&(n+=r),t.y===a.y&&(n+=r))}),n},$l=function(t,e,r,n,a){return xl(t,e)+xl(t,r)+Yd(t,[e,r,n,a])},Hd=function E(t,e,r,n,a){a===void 0&&(a=0),t.unshift(e[n]),r[n]&&r[n]!==n&&a<=100&&E(t,e,r,r[n],a+1)},nv=function(t,e){var r=t.indexOf(e);r>-1&&t.splice(r,1)},Tl=function(t,e,r,n){var a=r.x-t.x,i=r.y-t.y,o=n.x-t.x,u=n.y-t.y,l=r.x-e.x,h=r.y-e.y,y=n.x-e.x,O=n.y-e.y,A=a*u-i*o,z=l*O-h*y,$=a*h-i*l,ae=o*O-u*y;return A*z<=0&&$*ae<=0},Fl=function(t,e,r){if(r.width||r.height){var n=Bl(r),a=n[0],i=n[1],o=n[2],u=n[3];return Tl(t,e,a,i)||Tl(t,e,a,u)||Tl(t,e,i,o)||Tl(t,e,o,u)}return!1},Zd=function(t,e,r,n){var a=[];return t.forEach(function(i){if(i!==e&&(i.x===e.x||i.y===e.y)){if(Fl(i,e,r)||Fl(i,e,n))return;a.push(i)}}),kl(a)},Kd=function(t,e,r,n,a,i,o){var u,l=[],h=(u={},u[e.id]=e,u),y={},O={},A={};O[e.id]=0,A[e.id]=$l(e,r,e);var z=new ql;z.add({id:e.id,value:A[e.id]});var $={};t.forEach(function(Re){$[Re.id]=Re});for(var ae;Object.keys(h).length;){var ce=z.minId(!1);if(ce)ae=h[ce];else break;if(ae===r){var ue=[];return Hd(ue,$,y,r.id),ue}delete h[ae.id],z.remove(ae.id),l.push(ae);var ve=Zd(t,ae,n,a),Ce=function(Ve){Ve.forEach(function(Ue){if(l.indexOf(Ue)===-1){var $e=Ue.id;h[$e]||(h[$e]=Ue);var ot=A[ae.id]+xl(ae,Ue);if(O[$e]&&ot>=O[$e]){z.add({id:$e,value:A[$e]});return}y[$e]=ae.id,O[$e]=ot,A[$e]=O[$e]+$l(Ue,r,e,i,o),z.add({id:$e,value:A[$e]})}})};Ce(ve)}return[e,r]},$d=function(t,e,r){return!(t.x===e.x&&e.x===r.x||t.y===e.y&&e.y===r.y)},Qd=function(t,e,r,n){var a=xl(t,e),i=xl(r,e);a=0;i--){var o=t[i];if(o.x===r.x?n.push(o):(n=[o],r.x=o.x),o.y===r.y?a.push(o):(a=[o],r.y=o.y),n.length>2){var u=t.indexOf(n[1]);u>-1&&t.splice(u,1);continue}if(a.length>2){var u=t.indexOf(a[1]);u>-1&&t.splice(u,1)}}return t},ql=function(){function E(){this.arr=[],this.map={},this.arr=[],this.map={}}return E.prototype._innerAdd=function(t,e){for(var r=[0,e-1];r[1]-r[0]>1;){var n=Math.floor((r[0]+r[1])/2);if(this.arr[n].value>t.value)r[1]=n;else if(this.arr[n].value=0;e--)this.map[this.arr[e].id]?t=this.arr[e].id:this.arr.splice(e,1);return t},E.prototype._findFirstId=function(){for(;this.arr.length;){var t=this.arr.shift();if(this.map[t.id])return t.id}},E.prototype.minId=function(t){return t?this._clearAndGetMinId():this._findFirstId()},E}(),qd=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)},eh=function(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},th=function(t,e){return[t,e]},rh=function(t,e,r,n,a){return Zl(Jl(t,e,r,n,a.offset))},nh={offset:20,maxAllowedDirectionChange:Math.PI/2,maximumLoops:2e3,gridSize:10,directions:[{stepX:1,stepY:0},{stepX:-1,stepY:0},{stepX:0,stepY:1},{stepX:0,stepY:-1}],get penalties(){return{0:0,45:this.gridSize/2,90:this.gridSize/2}},distFunc:qd,fallbackRoute:rh},av={maxAllowedDirectionChange:Math.PI/4,directions:[{stepX:1,stepY:0},{stepX:1,stepY:1},{stepX:0,stepY:1},{stepX:-1,stepY:1},{stepX:-1,stepY:0},{stepX:-1,stepY:-1},{stepX:0,stepY:-1},{stepX:1,stepY:-1}],distFunc:eh,fallbackRoute:th},df=function(t,e){var r=Math.round(Math.abs(t/e)),n=t<0?-1:1;return r<0?0:n*r},ah=function(t,e,r){var n={};return t.forEach(function(a){if(a)for(var i=Ml(a.getBBox(),r),o=df(i.minX,e);o<=df(i.maxX,e);o+=1)for(var u=df(i.minY,e);u<=df(i.maxY,e);u+=1)n["".concat(o,"|||").concat(u)]=!0}),n},Gl=function(t,e){var r=e.x-t.x,n=e.y-t.y;return r||n?Math.atan2(n,r):0},ed=function(t,e){var r=Math.abs(t-e);return r>Math.PI?2*Math.PI-r:r},td=function(t,e,r){for(var n=1/0,a=0,i=e.length;al.minX&&e.xl.minY&&e.y0&&Ve>0;){var Mr=ve.minId((Ve+1)%30===0);if(Mr)Ue=z[Mr];else break;if(kr["".concat(Ue.x,"|||").concat(Ue.y)])return ih(Ue,ae,h,e,t,y,u);delete z[Ue.id],ve.remove(Ue.id),$[Ue.id]=!0;for(var Ce=0;Cei.maxAllowedDirectionChange)&&!l[dr])){z[dr]||(z[dr]=ot);var hn=o[Gt];et=i.distFunc(Ue,ot)+(isNaN(hn)?u:hn),yt=ce[Ue.id]+et;var on=ce[dr];on&&yt>=on||(ae[dr]=Ue,ce[dr]=yt,ue[dr]=yt+td(ot,A,i.distFunc),ve.add({id:dr,value:ue[dr]}))}}Ve-=1}return i.fallbackRoute(t,e,r,n,i)};qu("polyline",{options:{color:Zr.defaultEdge.color,size:Zr.defaultEdge.size,style:{radius:0,offset:15,x:0,y:0,stroke:Zr.defaultEdge.style.stroke,lineAppendWidth:Zr.defaultEdge.style.lineAppendWidth},labelCfg:{style:{fill:Zr.edgeLabel.style.fill,fontSize:Zr.edgeLabel.style.fontSize,fontFamily:Zr.windowFontFamily}},routeCfg:{obstacles:[],maxAllowedDirectionChange:Math.PI,maximumLoops:500,gridSize:10},stateStyles:(0,c.__assign)({},Zr.edgeStateStyles)},shapeType:"polyline",labelPosition:"center",drawShape:function(t,e){var r=this.getShapeStyle(t);r.radius===0&&delete r.radius;var n=e.addShape("path",{className:"edge-shape",name:"edge-shape",attrs:r});return e.shapeMap["edge-shape"]=n,n},getShapeStyle:function(t){var e=this.options.style,r={stroke:t.color},n=(0,s.mix)({},e,r,t.style);t=this.getPathPoints(t),this.radius=n.radius,this.offset=n.offset;var a=t.startPoint,i=t.endPoint,o=this.getControlPoints(t),u=[a];o&&(u=u.concat(o)),u.push(i);var l=t.sourceNode,h=t.targetNode,y=n.radius,O=this.options.routeCfg,A=(0,s.mix)({},O,t.routeCfg);A.offset=n.offset;var z=this.getPath(u,l,h,y,A,!o);((0,s.isArray)(z)&&z.length<=1||(0,s.isString)(z)&&z.indexOf("L")===-1)&&(z="M0 0, L0 0"),(isNaN(a.x)||isNaN(a.y)||isNaN(i.x)||isNaN(i.y))&&(z="M0 0, L0 0");var $=(0,s.mix)({},Zr.defaultEdge.style,n,{lineWidth:t.size,path:z});return $},updateShapeStyle:function(t,e){var r=e.getContainer();if(e.isVisible()){var n={stroke:t.color},a=r.shapeMap["edge-shape"]||r.find(function(Ce){return Ce.get("className")==="edge-shape"})||e.getKeyShape(),i=t.size;t=this.getPathPoints(t);var o=t.startPoint,u=t.endPoint,l=this.getControlPoints(t),h=[o];l&&(h=h.concat(l)),h.push(u);var y=a.attr(),O=(0,s.mix)({},n,y,t.style),A=t.sourceNode,z=t.targetNode,$=O.radius,ae=this.options.routeCfg,ce=(0,s.mix)({},ae,t.routeCfg);ce.offset=O.offset;var ue=this.getPath(h,A,z,$,ce,!l);((0,s.isArray)(ue)&&ue.length<=1||(0,s.isString)(ue)&&ue.indexOf("L")===-1)&&(ue="M0 0, L0 0"),(isNaN(o.x)||isNaN(o.y)||isNaN(u.x)||isNaN(u.y))&&(ue="M0 0, L0 0"),y.endArrow&&O.endArrow===!1&&(t.style.endArrow={path:""}),y.startArrow&&O.startArrow===!1&&(t.style.startArrow={path:""});var ve=(0,s.mix)(n,a.attr(),{lineWidth:i,path:ue},t.style);a&&a.attr(ve)}},getPath:function(t,e,r,n,a,i){var o=a.offset,u=a.obstacles,l=a.simple;if(!o||t.length>2||i===!1){if(n)return Ql(t,n);var h=[];return(0,s.each)(t,function(z,$){$===0?h.push(["M",z.x,z.y]):h.push(["L",z.x,z.y])}),h}l!==!1&&!(u!=null&&u.length)&&(l=!0);var y=l?Jl(t[t.length-1],t[0],r,e,o):oh(t[0],t[t.length-1],e,r,a);if(!y||!y.length)return"M0 0, L0 0";if(n){var O=Ql(y,n);return O}y=Jd(y);var A=ei.pointsToPolygon(y);return A}},"single-edge");var nd=Vo.cloneEvent,ad=Vo.isNaN,id=Math.abs,sh=10,uh=["shift","ctrl","alt","control"],fh={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,scalableRange:0,allowDragOnItem:!1}},getEvents:function(){return{mousedown:"onMouseDown",drag:"onDragMove",dragend:"onMouseUp","canvas:click":"onMouseUp",keyup:"onKeyUp",focus:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onMouseUp"}},updateViewport:function(t){var e=this.origin,r=+t.clientX,n=+t.clientY;if(!(ad(r)||ad(n))){var a=r-e.x,i=n-e.y;this.get("direction")==="x"?i=0:this.get("direction")==="y"&&(a=0),this.origin={x:r,y:n};var o=this.graph.get("width"),u=this.graph.get("height"),l=this.graph.get("canvas").getCanvasBBox(),h=this.scalableRange,y=this.scalableRange;h<1&&h>-1&&(h=o*h,y=u*y),(l.minX<=o+h&&l.minX+a>o+h||l.maxX+h>=0&&l.maxX+h+a<0)&&(a=0),(l.minY<=u+y&&l.minY+i>u+y||l.maxY+y>=0&&l.maxY+y+i<0)&&(i=0),this.graph.translate(a,i)}},onTouchStart:function(t){var e=this,r=t.originalEvent.touches,n=r[0],a=r[1];n&&a||(t.preventDefault(),this.mousedown=!0,e.onDragStart(t))},onMouseDown:function(t){this.mousedown=!0},onDragMove:function(t){this.mousedown&&(this.dragstart?this.onDrag(t):(this.dragstart=!0,this.onDragStart(t)))},onDragStart:function(t){var e=this,r=t.originalEvent;if(!(r&&t.name!=="touchstart"&&r.button!==0)&&!(t.name!=="touchstart"&&typeof window!="undefined"&&window.event&&!window.event.buttons&&!window.event.button)&&this.shouldBegin(t,this)&&!e.keydown&&this.allowDrag(t)){if(e.origin={x:t.clientX,y:t.clientY},e.dragging=!1,this.enableOptimize){for(var n=this.graph,a=n.getEdges(),i=0,o=a.length;iu)for(var A=n.getNodes(),z=0,$=A.length;z<$;z++)for(var ae=A[z].getContainer(),ce=ae.get("children"),ue=0,ve=ce;ue-1?e.keydown=!0:e.keydown=!1)},onKeyUp:function(){this.keydown=!1,this.origin=null,this.dragging=!1,this.dragbegin=!1},allowDrag:function(t){var e,r,n=t.target,a=n&&n.isCanvas&&n.isCanvas();if((0,s.isBoolean)(this.allowDragOnItem)&&!this.allowDragOnItem&&!a)return!1;if((0,s.isObject)(this.allowDragOnItem)){var i=this.allowDragOnItem,o=i.node,u=i.edge,l=i.combo,h=(r=(e=t.item)===null||e===void 0?void 0:e.getType)===null||r===void 0?void 0:r.call(e);if(!o&&h==="node"||!u&&h==="edge"||!l&&h==="combo")return!1}return!0}},ch={getDefaultCfg:function(){return{updateEdge:!0,delegateStyle:{},enableDelegate:!1,onlyChangeComboSize:!1,comboActiveState:"",selectedState:"selected",enableOptimize:!1,enableDebounce:!1,enableStack:!0}},getEvents:function(){return{"node:mousedown":"onMouseDown",drag:"onDragMove",dragend:"onDragEnd","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave","combo:drop":"onDropCombo","node:drop":"onDropNode","canvas:drop":"onDropCanvas",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onDragEnd",afterchangedata:"onDragEnd"}},validationCombo:function(t){if(!this.origin||!t||t.destroyed)return!1;var e=t.getType();return e==="combo"},onTouchStart:function(t){if(t.item){var e=this;try{var r=t.originalEvent.touches,n=r[0],a=r[1];if(n&&a)return;t.preventDefault()}catch(i){console.warn("Touch original event not exist!")}this.mousedown={item:t.item,target:t.target,origin:{x:t.x,y:t.y}},this.dragstart=!0,e.onDragStart(t)}},onTouchMove:function(t){var e=this;try{var r=t.originalEvent.touches,n=r[0],a=r[1];if(n&&a){e.onDragEnd(t);return}t.preventDefault()}catch(i){console.warn("Touch original event not exist!")}e.onDrag(t)},onMouseDown:function(t){this.mousedown={item:t.item,target:t.target,origin:{x:t.x,y:t.y}},typeof window!="undefined"&&!this.windowEventBinded&&(this.windowEventBinded=!0,document.body.addEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.addEventListener("mouseup",this.onDragEnd.bind(this)))},onDragMove:function(t){var e,r;if(((r=(e=t.item)===null||e===void 0?void 0:e.getType)===null||r===void 0?void 0:r.call(e))!=="node"){this.onDragEnd();return}this.mousedown&&(this.dragstart?this.onDrag((0,c.__assign)((0,c.__assign)({},t),this.mousedown)):(this.dragstart=!0,this.onDragStart(t)))},onDragStart:function(t){var e=this;if(this.currentShouldEnd=!0,!!this.shouldBegin((0,c.__assign)((0,c.__assign)({},t),this.mousedown),this)){var r=this.mousedown,n=r.item,a=r.target;if(!(!n||n.destroyed||n.hasLocked())){var i=n.getContainer();if(i.set("capture",!1),this.cachedCaptureItems||(this.cachedCaptureItems=[]),this.cachedCaptureItems.push(n),a){var o=a.get("isAnchorPoint");if(o)return}var u=this.graph;this.targets=[],this.targetCombo=null;var l=u.findAllByState("node",this.selectedState),h=n.get("id"),y=l.filter(function(A){var z=A.get("id");return h===z});if(y.length===0?this.targets.push(n):l.length>1?l.forEach(function(A){var z=A.hasLocked();z||e.targets.push(A)}):this.targets.push(n),this.graph.get("enabledStack")&&this.enableStack){var O=[];this.targets.forEach(function(A){var z=A.getModel(),$=z.x,ae=z.y,ce=z.id;O.push({x:$,y:ae,id:ce})}),this.set("beforeDragNodes",O)}this.hidenEdge={},this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(A){var z=A.getEdges();z.forEach(function($){$.isVisible()&&(e.hidenEdge[$.getID()]=!0,$.hide())})}),this.origin=this.mousedown.origin,this.point={},this.originPoint={}}}},onDrag:function(t){var e=this;if(!(!this.mousedown||!this.origin)&&this.shouldUpdate(t,this))if(this.get("enableDelegate"))this.updateDelegate(t);else if(this.enableDebounce)this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos});else{var r={};this.targets.map(function(n){e.update(n,t);var a=n.getModel().comboId;a&&(r[a]=e.graph.findById(a))}),this.onlyChangeComboSize&&this.updateParentCombos()}},onDragEnd:function(t){var e=this,r;if(this.mousedown=!1,this.dragstart=!1,typeof window!="undefined"&&this.windowEventBinded&&(this.windowEventBinded=!1,document.body.removeEventListener("contextmenu",this.onDragEnd.bind(this)),document.body.removeEventListener("mouseup",this.onDragEnd.bind(this))),!!this.origin){(r=this.cachedCaptureItems)===null||r===void 0||r.forEach(function(i){var o=i.getContainer();o.set("capture",!0)}),this.cachedCaptureItems=[],this.delegateRect&&(this.delegateRect.remove(),this.delegateRect=null),this.get("updateEdge")&&this.enableOptimize&&!this.enableDelegate&&this.targets.forEach(function(i){var o=i.getEdges();o.forEach(function(u){e.hidenEdge[u.getID()]&&u.show(),u.refresh()})}),this.hidenEdge={};var n=this.graph;if(n.get("enabledStack")&&this.enableStack){var a={before:{nodes:[],edges:[],combos:[]},after:{nodes:[],edges:[],combos:[]}};this.get("beforeDragNodes").forEach(function(i){a.before.nodes.push(i)}),this.targets.forEach(function(i){var o=i.getModel(),u=o.x,l=o.y,h=o.id;a.after.nodes.push({x:u,y:l,id:h})}),n.pushStack("update",(0,s.clone)(a))}n.emit("dragnodeend",{items:this.targets,targetItem:null}),this.point={},this.origin=null,this.originPoint={},this.targets.length=0,this.targetCombo=null}},onDropCombo:function(t){var e=t.item;if(this.currentShouldEnd=this.shouldEnd(t,e,this),this.updatePositions(t,!this.currentShouldEnd),!(!this.currentShouldEnd||!this.validationCombo(e))){var r=this.graph;if(this.comboActiveState&&r.setItemState(e,this.comboActiveState,!1),this.targetCombo=e,this.onlyChangeComboSize)r.updateCombos();else{var n=e.getModel();this.targets.map(function(a){var i=a.getModel();i.comboId!==n.id&&r.updateComboTree(a,n.id)}),r.updateCombo(e)}r.emit("dragnodeend",{items:this.targets,targetItem:this.targetCombo})}},onDropCanvas:function(t){var e=this.graph;this.currentShouldEnd=this.shouldEnd(t,void 0,this),this.updatePositions(t,!this.currentShouldEnd),!(!this.targets||this.targets.length===0||!this.currentShouldEnd)&&(this.onlyChangeComboSize?this.updateParentCombos():this.targets.map(function(r){var n=r.getModel();n.comboId&&e.updateComboTree(r)}))},onDropNode:function(t){if(!(!this.targets||this.targets.length===0)){var e=this,r=t.item,n=e.graph,a=r.getModel().comboId,i=a?n.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd(t,i,this),this.updatePositions(t,!this.currentShouldEnd),!!this.currentShouldEnd){if(this.onlyChangeComboSize)this.updateParentCombos();else if(a){var o=n.findById(a);e.comboActiveState&&n.setItemState(o,e.comboActiveState,!1),this.targets.map(function(u){var l=u.getModel();a!==l.comboId&&n.updateComboTree(u,a)}),n.updateCombo(o)}else this.targets.map(function(u){var l=u.getModel();l.comboId&&n.updateComboTree(u)});n.emit("dragnodeend",{items:this.targets,targetItem:r})}}},onDragEnter:function(t){var e=t.item;if(this.validationCombo(e)){var r=this.graph;this.comboActiveState&&r.setItemState(e,this.comboActiveState,!0)}},onDragLeave:function(t){var e=t.item;if(this.validationCombo(e)){var r=this.graph;this.comboActiveState&&r.setItemState(e,this.comboActiveState,!1)}},updatePositions:function(t,e){var r=this;!this.targets||this.targets.length===0||(this.get("enableDelegate")?this.enableDebounce?this.debounceUpdate({targets:this.targets,graph:this.graph,point:this.point,origin:this.origin,evt:t,updateEdge:this.get("updateEdge"),onlyChangeComboSize:this.onlyChangeComboSize,updateParentCombos:this.updateParentCombos}):e||this.targets.map(function(n){return r.update(n,t)}):this.targets.map(function(n){return r.update(n,t,e)}))},update:function(t,e,r){var n=this.origin,a=t.get("model"),i=t.get("id");this.point[i]||(this.point[i]={x:a.x||0,y:a.y||0});var o=e.x-n.x+this.point[i].x,u=e.y-n.y+this.point[i].y;r&&(o+=n.x-e.x,u+=n.y-e.y);var l={x:o,y:u};this.get("updateEdge")?this.graph.updateItem(t,l,!1):t.updatePosition(l)},debounceUpdate:(0,s.debounce)(function(E){var t=E.targets,e=E.graph,r=E.point,n=E.origin,a=E.evt,i=E.updateEdge,o=E.onlyChangeComboSize,u=E.updateParentCombos;t.map(function(l){var h=l.get("model"),y=l.get("id");r[y]||(r[y]={x:h.x||0,y:h.y||0});var O=a.x-n.x+r[y].x,A=a.y-n.y+r[y].y,z={x:O,y:A};i?e.updateItem(l,z,!1):l.updatePosition(z)}),o&&u(e,t)},50,!0),updateDelegate:function(t){var e=this.graph;if(this.delegateRect){var O=t.x-this.origin.x+this.originPoint.minX,A=t.y-this.origin.y+this.originPoint.minY;this.delegateRect.attr({x:O,y:A})}else{var r=e.get("group"),n=(0,s.deepMix)({},qi.delegateStyle,this.delegateStyle),a=this.calculationGroupPosition(t),i=a.x,o=a.y,u=a.width,l=a.height,h=a.minX,y=a.minY;this.originPoint={x:i,y:o,width:u,height:l,minX:h,minY:y},this.delegateRect=r.addShape("rect",{attrs:(0,c.__assign)({width:u,height:l,x:i,y:o},n),name:"rect-delegate-shape"}),this.delegate=this.delegateRect,this.delegateRect.set("capture",!1)}},calculationGroupPosition:function(t){var e=this.targets;e.length===0&&e.push(t.item);for(var r=1/0,n=-1/0,a=1/0,i=-1/0,o=0;on&&(n=O),A>i&&(i=A)}var z=Math.floor(r),$=Math.floor(a),ae=Math.ceil(n)-Math.floor(r),ce=Math.ceil(i)-Math.floor(a);return{x:z,y:$,width:ae,height:ce,minX:r,minY:a}},updateParentCombos:function(t,e){var r=t||this.graph,n=e||this.targets,a={};n==null||n.forEach(function(i){var o=i.getModel().comboId;o&&(a[o]=r.findById(o))}),Object.values(a).forEach(function(i){i&&r.updateCombo(i)})}},Il=null,lh={getDefaultCfg:function(){return{trigger:"mouseenter",activeState:"active",inactiveState:"inactive",resetSelected:!1,shouldClearStatusOnSecond:!1,shouldUpdate:function(){return!0}}},getEvents:function(){return this.get("trigger")==="mouseenter"?{"node:mouseenter":"setAllItemStates","combo:mouseenter":"setAllItemStates","node:mouseleave":"clearActiveState","combo:mouseleave":"clearActiveState"}:{"node:click":"setAllItemStates","combo:click":"setAllItemStates","canvas:click":"clearActiveState","node:touchstart":"setOnTouchStart","combo:touchstart":"setOnTouchStart","canvas:touchstart":"clearOnTouchStart"}},setOnTouchStart:function(t){var e=this;try{var r=t.originalEvent.touches,n=r[0],a=r[1];if(n&&a)return;t.preventDefault()}catch(i){console.warn("Touch original event not exist!")}e.setAllItemStates(t)},clearOnTouchStart:function(t){var e=this;try{var r=t.originalEvent.touches,n=r[0],a=r[1];if(n&&a)return;t.preventDefault()}catch(i){console.warn("Touch original event not exist!")}e.clearActiveState(t)},setAllItemStates:function(t){clearTimeout(this.timer),this.throttleSetAllItemStates(t,this)},clearActiveState:function(t){var e=this,r=this.shouldClearStatusOnSecond;r&&(Il=null),this.timer=setTimeout(function(){e.throttleClearActiveState(t,e)},50)},throttleSetAllItemStates:(0,s.throttle)(function(E,t){var e=E.item,r=t.graph;if(!(!r||r.destroyed)&&(t.item=e,!!t.shouldUpdate(E.item,{event:E,action:"activate"},t))){var n=t.shouldClearStatusOnSecond,a=e.getModel().id;if(Il===a&&n){t.throttleClearActiveState(E,t),Il=null;return}for(var i=t.activeState,o=t.inactiveState,u=r.getNodes(),l=r.getCombos(),h=r.getEdges(),y=r.get("vedges"),O=u.length,A=l.length,z=h.length,$=y.length,ae=t.inactiveItems||{},ce=t.activeItems||{},ue=0;ue-1||(this.trigger=ud,console.warn("Behavior brush-select \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'")),this.trigger==="drag"?{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates"}:{dragstart:"onMouseDown",drag:"onMouseMove",dragend:"onMouseUp","canvas:click":"clearStates",keyup:"onKeyUp",keydown:"onKeyDown"}},onMouseDown:function(t){var e=t.item,r=this.brush,n=this.selectOnCombo,a=(e==null?void 0:e.getType())==="combo";a&&!n||!a&&e||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates(),r||(r=this.createBrush()),this.originPoint={x:t.canvasX,y:t.canvasY},r.attr({width:0,height:0}),r.show(),this.dragging=!0)},onMouseMove:function(t){this.dragging&&(this.trigger!=="drag"&&!this.keydown||this.updateBrush(t))},onMouseUp:function(t){var e=this.graph;!this.brush&&!this.dragging||this.trigger!=="drag"&&!this.keydown||(this.brush.remove(!0),this.brush=null,this.getSelectedNodes(t),this.dragging=!1)},clearStates:function(){var t=this,e=t.graph,r=t.selectedState,n=e.findAllByState("node",r),a=e.findAllByState("edge",r),i=e.findAllByState("combo",r);n.forEach(function(o){return e.setItemState(o,r,!1)}),a.forEach(function(o){return e.setItemState(o,r,!1)}),i.forEach(function(o){return e.setItemState(o,r,!1)}),this.selectedNodes=[],this.selectedEdges=[],this.selectedCombos=[],this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges,this.selectedCombos),e.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})},isBBoxCenterInRect:function(t,e,r,n,a){var i=t.getBBox();return i.centerX>=e&&i.centerX<=r&&i.centerY>=n&&i.centerY<=a},getSelectedNodes:function(t){var e=this,r=this,n=r.graph,a=r.originPoint,i=r.shouldUpdate,o=r.isBBoxCenterInRect,u=this.selectedState,l={x:t.x,y:t.y},h=n.getPointByCanvas(a.x,a.y),y=Al(l.x,h.x),O=od(l.x,h.x),A=Al(l.y,h.y),z=od(l.y,h.y),$=[],ae=[];n.getNodes().forEach(function(ve){if(ve.isVisible()&&o(ve,y,O,A,z)&&i(ve,"select",e)){$.push(ve);var Ce=ve.getModel();ae.push(Ce.id),n.setItemState(ve,u,!0)}});var ce=[];this.includeEdges&&$.forEach(function(ve){var Ce=ve.getOutEdges();Ce.forEach(function(Re){if(Re.isVisible()){var Ve=Re.getModel(),Ue=Ve.source,$e=Ve.target;ae.includes(Ue)&&ae.includes($e)&&i(Re,"select",e)&&(ce.push(Re),n.setItemState(Re,e.selectedState,!0))}})});var ue=[];this.includeCombos&&n.getCombos().forEach(function(ve){if(ve.isVisible()&&o(ve,y,O,A,z)&&i(ve,"select",e)){ue.push(ve);var Ce=ve.getModel();ae.push(Ce.id),n.setItemState(ve,u,!0)}}),this.selectedEdges=ce,this.selectedNodes=$,this.selectedCombos=ue,this.onSelect&&this.onSelect($,ce,ue),n.emit("nodeselectchange",{selectedItems:{nodes:$,edges:ce,combos:ue},select:!0})},createBrush:function(){var t=this,e=t.graph.get("canvas").addShape("rect",{attrs:t.brushStyle,capture:!1,name:"brush-shape"});return this.brush=e,this.delegate=e,e},updateBrush:function(t){var e=this.originPoint;this.brush.attr({width:sd(t.canvasX-e.x),height:sd(t.canvasY-e.y),x:Al(t.canvasX,e.x),y:Al(t.canvasY,e.y)})},onKeyDown:function(t){var e=t.key;if(e){var r=this.trigger.toLowerCase(),n=e.toLowerCase();n===r||n==="control"&&r==="ctrl"||n==="ctrl"&&r==="control"?this.keydown=!0:this.keydown=!1}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.keydown=!1}},fd="shift",vh=["shift","ctrl","alt","control"],gh={getDefaultCfg:function(){return{multiple:!0,trigger:fd,selectedState:"selected",selectNode:!0,selectEdge:!1,selectCombo:!0}},getEvents:function(){var t=this;return vh.indexOf(t.trigger.toLowerCase())>-1||(t.trigger=fd,console.warn("Behavior click-select \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'")),t.multiple?{"node:click":"onClick","combo:click":"onClick","edge:click":"onClick","canvas:click":"onCanvasClick",keyup:"onKeyUp",keydown:"onKeyDown"}:{"node:click":"onClick","combo:click":"onClick","edge:click":"onClick","canvas:click":"onCanvasClick"}},onClick:function(t){var e=this,r=t.item;if(!(!r||r.destroyed)){var n=r.getType(),a=e.graph,i=e.keydown,o=e.multiple,u=e.shouldUpdate,l=e.shouldBegin;if(l(t,e)){if(!i||!o){var h=a.findAllByState("node",e.selectedState).concat(a.findAllByState("edge",e.selectedState)).concat(a.findAllByState("combo",e.selectedState));(0,s.each)(h,function($){$!==r&&a.setItemState($,e.selectedState,!1)})}var y=function(){switch(n){case"node":return e.selectNode;case"edge":return e.selectEdge;case"combo":return e.selectCombo;default:return!1}}();if(!y){var O=a.findAllByState("node",e.selectedState),A=a.findAllByState("edge",e.selectedState),z=a.findAllByState("combo",e.selectedState);a.emit("nodeselectchange",{selectedItems:{nodes:O,edges:A,combos:z},select:!1});return}if(r.hasState(e.selectedState)){u(t,e)&&a.setItemState(r,e.selectedState,!1);var O=a.findAllByState("node",e.selectedState),A=a.findAllByState("edge",e.selectedState),z=a.findAllByState("combo",e.selectedState);a.emit("nodeselectchange",{target:r,selectedItems:{nodes:O,edges:A,combos:z},select:!1})}else{u(t,e)&&a.setItemState(r,e.selectedState,!0);var O=a.findAllByState("node",e.selectedState),A=a.findAllByState("edge",e.selectedState),z=a.findAllByState("combo",e.selectedState);a.emit("nodeselectchange",{target:r,selectedItems:{nodes:O,edges:A,combos:z},select:!0})}}}},onCanvasClick:function(t){var e=this,r=this,n=r.graph,a=r.shouldBegin;if(a(t,this)){var i=n.findAllByState("node",this.selectedState);(0,s.each)(i,function(l){n.setItemState(l,e.selectedState,!1)});var o=n.findAllByState("edge",this.selectedState);(0,s.each)(o,function(l){n.setItemState(l,e.selectedState,!1)});var u=n.findAllByState("combo",this.selectedState);(0,s.each)(u,function(l){n.setItemState(l,e.selectedState,!1)}),n.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[],combos:[]},select:!1})}},onKeyDown:function(t){var e=this,r=t.key;r&&(r.toLowerCase()===this.trigger.toLowerCase()||r.toLowerCase()==="control"?e.keydown=!0:e.keydown=!1)},onKeyUp:function(){var t=this;t.keydown=!1}},ph=Q.vs,Ol=.05,yh={getDefaultCfg:function(){return this.isFireFox=_c()==="firefox",{sensitivity:2,minZoom:void 0,maxZoom:void 0,enableOptimize:!1,optimizeZoom:.1,fixSelectedItems:{fixAll:!1,fixLineWidth:!1,fixLabel:!1,fixState:"selected"},animate:!1,animateCfg:{duration:500}}},getEvents:function(){var t=this.fixSelectedItems;return t.fixState||(t.fixState="selected"),t.fixAll&&(t.fixLineWidth=!0,t.fixLabel=!0),{wheel:"onWheel",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd"}},onTouchStart:function(t){var e=t.originalEvent.touches,r=e[0],n=e[1];t.preventDefault(),n&&(this.shouldBegin&&!this.shouldBegin(t,this)||(this.startPoint={pageX:r.pageX,pageY:r.pageY},this.moveable=!0,n&&(this.endPoint={pageX:n.pageX,pageY:n.pageY}),this.originScale=this.graph.getZoom()||this.currentScale||1))},onTouchMove:function(t){if(this.moveable){t.preventDefault();var e=t.originalEvent.touches,r=e[0],n=e[1];if(n){this.endPoint||(this.endPoint={pageX:n.pageX,pageY:n.pageY});var a=function($,ae){return Math.hypot(ae.x-$.x,ae.y-$.y)},i=a({x:r.pageX,y:r.pageY},{x:n.pageX,y:n.pageY})/a({x:this.startPoint.pageX,y:this.startPoint.pageY},{x:this.endPoint.pageX,y:this.endPoint.pageY}),o=this.originScale*i;this.currentScale=o;var u=this.get("minZoom")||this.graph.get("minZoom"),l=this.get("maxZoom")||this.graph.get("maxZoom");if(!(o>l||o0||t.wheelDelta<0?h=1-Ol*u:h=1/(1-Ol*u):t.wheelDelta<0?h=1-Ol*u:h=1/(1-Ol*u),y=l*h;var O=this.get("minZoom")||n.get("minZoom"),A=this.get("maxZoom")||n.get("maxZoom");y>A?y=A:yn/2?h-=O.width:h+=this.offset,y>a/2?y-=O.height:y+=this.offset;var A="".concat(h,"px"),z="".concat(y,"px");(0,aa.Z)(this.container,{left:A,top:z,visibility:"visible"})},createTooltip:function(t){var e=t.get("el");e.style.position="relative";var r=(0,ka.Z)('
    '));return e.parentNode.appendChild(r),(0,aa.Z)(r,{position:"absolute",visibility:"visible"}),this.width=t.get("width"),this.height=t.get("height"),this.container=r,this.graph.get("tooltips").push(r),r}},mh=(0,c.__assign)({getDefaultCfg:function(){return{item:"node",offset:12,formatText:function(e){return e.label}}},getEvents:function(){return{"node:mouseenter":"onMouseEnter","node:mouseleave":"onMouseLeave","node:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},cd),bh=(0,c.__assign)({getDefaultCfg:function(){return{item:"edge",offset:12,formatText:function(e){return"source: ".concat(e.source," target: ").concat(e.target)}}},getEvents:function(){return{"edge:mouseenter":"onMouseEnter","edge:mouseleave":"onMouseLeave","edge:mousemove":"onMouseMove",afterremoveitem:"onMouseLeave"}}},cd),ld="click",Eh=["click","dblclick"],xh={getDefaultCfg:function(){return{trigger:ld,onChange:function(){}}},getEvents:function(){var t,e;return Eh.includes(this.trigger)?e=this.trigger:(e=ld,console.warn("Behavior collapse-expand \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'click' \u6216 'dblclick'")),t={},t["node:".concat(e)]="onNodeClick",t.touchstart="onNodeClick",t},onNodeClick:function(t){var e=this;if(this.trigger==="click"){if(this.timer){clearTimeout(this.timer),this.timer=0;return}this.timer=setTimeout(function(){e.toggle(t),clearTimeout(e.timer),e.timer=0},200)}else this.toggle(t)},toggle:function(t){var e=t.item;if(e){var r=this.graph.findDataById(e.get("id"));if(r){var n=r.children;if(!(!n||n.length===0)){var a=!r.collapsed;this.shouldBegin(t,a,this)&&(r.collapsed=a,e.getModel().collapsed=a,this.graph.emit("itemcollapsed",{item:t.item,collapsed:a}),this.shouldUpdate(t,a,this)&&(this.onChange(e,a,this),this.graph.layout()))}}}}},wh=Vo.calculationItemsBBox,Sh=function E(t,e){if(e(t)!==!1&&t){var r=t.get("combos");if(r.length===0)return!1;(0,s.each)(r,function(n){E(n,e)})}},_h={getDefaultCfg:function(){return{enableDelegate:!1,delegateStyle:{},onlyChangeComboSize:!1,activeState:"",selectedState:"selected",enableStack:!0}},getEvents:function(){return{"combo:mousedown":"onMouseDown","combo:dragstart":"onDragStart","combo:drag":"onDrag","combo:dragend":"onDragEnd","combo:drop":"onDrop","node:drop":"onNodeDrop","combo:dragenter":"onDragEnter","combo:dragleave":"onDragLeave"}},validationCombo:function(t){var e=t.item;if(!e||e.destroyed||!this.shouldUpdate(t,this))return!1;var r=e.getType();return r==="combo"},onMouseDown:function(t){this.origin={x:t.x,y:t.y}},onDragStart:function(t){var e=this,r=this.graph,n=t.item;if(this.currentShouldEnd=!0,!!this.validationCombo(t)){this.targets=[];var a=r.findAllByState("combo",this.selectedState),i=n.get("id"),o=a.filter(function(l){var h=l.get("id");return i===h});o.length===0?this.targets.push(n):this.targets=a;var u=[];this.targets.forEach(function(l){var h=l.getModel(),y=h.x,O=h.y,A=h.id;u.push({x:y,y:O,id:A})}),this.set("beforeDragItems",u),this.activeState&&this.targets.map(function(l){var h=l.getModel();if(h.parentId){var y=r.findById(h.parentId);y&&r.setItemState(y,e.activeState,!0)}}),this.point={},this.originPoint={},this.currentItemChildCombos=[],Sh(n,function(l){if(l.destroyed)return!1;var h=l.getModel();return e.currentItemChildCombos.push(h.id),!0})}},onDrag:function(t){var e=this;if(this.origin&&this.validationCombo(t))if(this.enableDelegate)this.updateDelegate(t);else{if(this.activeState){var r=this.graph,n=t.item,a=n.getModel(),i=r.getCombos(),o=n.getBBox(),u=o.centerX,l=o.centerY,h=o.width,y=i.filter(function(O){var A=O.getModel();return a.parentId,A.id!==a.id&&!e.currentItemChildCombos.includes(A.id)});y.map(function(O){var A=O.getBBox(),z=A.centerX,$=A.centerY,ae=A.width,ce=u-z,ue=l-$,ve=2*Math.sqrt(ce*ce+ue*ue);h+ae-ve>.8*h?r.setItemState(O,e.activeState,!0):r.setItemState(O,e.activeState,!1)})}(0,s.each)(this.targets,function(O){e.updateCombo(O,t)}),this.onlyChangeComboSize&&this.updateParentCombos()}},updatePositions:function(t,e){var r=this;(this.enableDelegate||e)&&(0,s.each)(this.targets,function(n){r.updateCombo(n,t,e)})},onDrop:function(t){var e=this,r=t.item;if(this.currentShouldEnd=this.shouldEnd(t,r,this),this.updatePositions(t,!this.currentShouldEnd),!(!this.currentShouldEnd||!r||!this.targets||r.destroyed)){var n=this.graph,a=r.getModel();this.targets.map(function(i){var o=i.getModel();o.parentId!==a.id?(e.activeState&&n.setItemState(r,e.activeState,!1),e.onlyChangeComboSize?n.updateCombo(i):n.updateComboTree(i,a.id,!1)):n.updateCombo(r)}),this.end(r,t),this.endComparison=!0}},onNodeDrop:function(t){var e=this;if(!(!this.targets||this.targets.length===0)){var r=this.graph,n=t.item,a=n.getModel().comboId,i=a?r.findById(a):void 0;if(this.currentShouldEnd=this.shouldEnd(t,i,this),this.updatePositions(t,!this.currentShouldEnd),!!this.currentShouldEnd){var o;if(a){if(this.activeState){var u=r.findById(a);r.setItemState(u,this.activeState,!1)}this.targets.map(function(l){e.onlyChangeComboSize?r.updateCombo(l):a!==l.getID()&&(o=r.findById(a),a!==l.getModel().parentId&&r.updateComboTree(l,a,!1))})}else this.targets.map(function(l){if(e.onlyChangeComboSize)r.updateCombo(l);else{var h=l.getModel();h.comboId&&r.updateComboTree(l,void 0,!1)}});this.endComparison=!0,this.end(o,t)}}},onDragEnter:function(t){if(this.origin&&this.validationCombo(t)){var e=t.item,r=this.graph;this.activeState&&r.setItemState(e,this.activeState,!0)}},onDragLeave:function(t){if(this.origin&&this.validationCombo(t)){var e=t.item,r=this.graph;this.activeState&&r.setItemState(e,this.activeState,!1)}},onDragEnd:function(t){if(!(!this.targets||this.targets.length===0)){var e=t.item;this.currentShouldEnd&&this.updatePositions(t);var r=this.getParentCombo(e.getModel().parentId),n=this.graph;r&&this.activeState&&n.setItemState(r,this.activeState,!1),this.end(void 0,t)}},end:function(t,e){var r=this;if(this.origin){var n=this.graph;if(this.delegateShape){var a=n.get("delegateGroup");a.clear(),this.delegateShape=null}if(t&&this.activeState&&n.setItemState(t,this.activeState,!1),!t){var i=n.get("enabledStack")&&this.enableStack,o={before:{nodes:[],edges:[],combos:[].concat(this.get("beforeDragItems"))},after:{nodes:[],edges:[],combos:[]}};this.targets.map(function(u){if(!r.onlyChangeComboSize)n.updateComboTree(u,void 0,i);else{n.updateCombo(u);var l=u.getModel(),h=l.x,y=l.y,O=l.id;o.after.combos.push({x:h,y,id:O}),n.pushStack("update",o)}})}this.point=[],this.origin=null,this.originPoint=null,this.targets.length=0}},traverse:function(t,e,r){var n=this;if(r===void 0&&(r={}),e(t,r)!==!1&&t){var a=t.get("combos");(0,s.each)(a,function(o){n.traverse(o,e,r)});var i=t.get("nodes");(0,s.each)(i,function(o){n.traverse(o,e,r)})}},updateCombo:function(t,e,r){this.updateSingleItem(t,e,r);var n={};this.traverse(t,function(a,i){return a.destroyed?!1:(a.getEdges().forEach(function(o){return i[o.getID()]=o}),!0)},n),Object.values(n).forEach(function(a){return a.refresh()})},updateSingleItem:function(t,e,r){var n=this.origin,a=this.graph,i=t.getModel(),o=t.get("id");this.point[o]||(this.point[o]={x:i.x,y:i.y});var u=e.x-n.x+this.point[o].x,l=e.y-n.y+this.point[o].y;r&&(u+=n.x-e.x,l+=n.y-e.y),a.updateItem(t,{x:u,y:l},!1)},getParentCombo:function(t){var e=this.graph;if(t){var r=e.findById(t);if(r)return r}},updateDelegate:function(t){var e=this.graph;if(this.delegateShape){var O=t.x-this.origin.x+this.originPoint.minX,A=t.y-this.origin.y+this.originPoint.minY;this.delegateShape.attr({x:O,y:A})}else{var r=e.get("delegateGroup"),n=null;this.targets.length>1?n=wh(this.targets):n=this.targets[0].getBBox();var a=n.x,i=n.y,o=n.width,u=n.height,l=n.minX,h=n.minY;this.originPoint={x:a,y:i,width:o,height:u,minX:l,minY:h};var y=(0,c.__assign)((0,c.__assign)({},qi.delegateStyle),this.delegateStyle);this.delegateShape=r.addShape("rect",{attrs:(0,c.__assign)({width:n.width,height:n.height,x:n.x,y:n.y},y),name:"combo-delegate-shape"}),this.delegateShape.set("capture",!1),this.delegate=this.delegateShape}},updateParentCombos:function(){var t=this,e=t.graph,r=t.targets,n={};r==null||r.forEach(function(a){var i=a.getModel().parentId;i&&(n[i]=e.findById(i))}),Object.values(n).forEach(function(a){a&&e.updateCombo(a)})}},dd="dblclick",Mh=["click","dblclick"],Ch={getDefaultCfg:function(){return{trigger:dd,relayout:!0}},getEvents:function(){var t,e;return Mh.includes(this.trigger)?e=this.trigger:(e=dd,console.warn("Behavior collapse-expand-group \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'click' \u6216 'dblclick'")),t={},t["combo:".concat(e)]="onComboClick",t},onComboClick:function(t){var e=t.item,r=this,n=r.graph,a=r.relayout;if(!(!e||e.destroyed||e.getType()!=="combo")){var i=e.getModel(),o=i.id;o&&(n.collapseExpandCombo(o),a&&n.get("layout")?n.layout():n.refreshPositions())}}},Th=Vo.isPolygonsIntersect,Ih=Vo.pathToPoints,hd="shift",Ah=["drag","shift","ctrl","alt","control"],Oh=function(t,e){var r,n=t.getKeyShape();if(t.get("type")==="path")r=Ih(n.attr("path"));else{var a=n.getCanvasBBox();r=[[a.minX,a.minY],[a.maxX,a.minY],[a.maxX,a.maxY],[a.minX,a.maxY]]}return Th(e,r)},Lh={getDefaultCfg:function(){return{delegateStyle:{fill:"#EEF6FF",fillOpacity:.4,stroke:"#DDEEFE",lineWidth:1},onSelect:function(){},onDeselect:function(){},shouldDeselect:void 0,selectedState:"selected",trigger:hd,includeEdges:!0,selectedEdges:[],selectedNodes:[]}},getEvents:function(){return Ah.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=hd,console.warn("Behavior lasso-select \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'")),this.trigger==="drag"?{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd","canvas:click":"clearStates"}:{dragstart:"onDragStart",drag:"onDragMove",dragend:"onDragEnd",keyup:"onKeyUp",keydown:"onKeyDown","canvas:click":"clearStates"}},onDragStart:function(t){var e=this.lasso,r=t.item;r||this.trigger!=="drag"&&!this.keydown||(this.selectedNodes&&this.selectedNodes.length!==0&&this.clearStates("dragstart"),e||(e=this.createLasso()),this.dragging=!0,this.originPoint={x:t.x,y:t.y},this.points.push(this.originPoint),e.show())},onDragMove:function(t){this.dragging&&(this.trigger!=="drag"&&!this.keydown||(this.points.push({x:t.x,y:t.y}),this.updateLasso(t)))},onDragEnd:function(t){!this.lasso&&!this.dragging||this.trigger!=="drag"&&!this.keydown||(this.points.push(this.originPoint),this.getSelectedItems(),this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1)},getLassoPath:function(){var t=this.points,e=[];return t.length&&(t.forEach(function(r,n){n===0?e.push(["M",r.x,r.y]):e.push(["L",r.x,r.y])}),e.push(["L",t[0].x,t[0].y])),e},clearStates:function(t){t===void 0&&(t="canvas:click");var e=this,r=e.graph,n=e.selectedState,a=e.shouldDeselect,i=r.findAllByState("node",n),o=r.findAllByState("edge",n);(!a||a({action:t,nodes:i,edges:o}))&&(i.forEach(function(u){return r.setItemState(u,n,!1)}),o.forEach(function(u){return r.setItemState(u,n,!1)})),this.onDeselect&&this.onDeselect(this.selectedNodes,this.selectedEdges),this.selectedNodes=[],this.selectedEdges=[],r.emit("nodeselectchange",{selectedItems:{nodes:[],edges:[]},select:!1})},getSelectedItems:function(){var t=this,e=this,r=e.graph,n=e.shouldUpdate,a=this.points.map(function(h){return[r.getCanvasByPoint(h.x,h.y).x,r.getCanvasByPoint(h.x,h.y).y]}),i=this.selectedState,o=[],u=[];r.getNodes().forEach(function(h){if(h.isVisible()&&Oh(h,a)&&n(h,"select",t)){o.push(h);var y=h.getModel();u.push(y.id),r.setItemState(h,i,!0)}});var l=[];this.includeEdges&&o.forEach(function(h){var y=h.getOutEdges();y.forEach(function(O){if(O.isVisible()){var A=O.getModel(),z=A.source,$=A.target;u.includes(z)&&u.includes($)&&n(O,"select",t)&&(l.push(O),r.setItemState(O,t.selectedState,!0))}})}),this.selectedEdges=l,this.selectedNodes=o,this.onSelect&&this.onSelect(o,l),r.emit("nodeselectchange",{selectedItems:{nodes:o,edges:l},select:!0})},createLasso:function(){var t=this,e=t.graph.get("delegateGroup").addShape("path",{attrs:(0,c.__assign)({path:[]},t.delegateStyle),capture:!1,name:"lasso-shape"});return this.lasso=e,this.delegate=e,this.points=[],e},updateLasso:function(t){var e=this;this.lasso.attr({path:e.getLassoPath()})},onKeyDown:function(t){var e=t.key;e&&(e.toLowerCase()===this.trigger.toLowerCase()?this.keydown=!0:this.keydown=!1)},onKeyUp:function(){this.lasso&&(this.lasso.remove(!0),this.lasso=null,this.points=[],this.dragging=!1),this.keydown=!1}},vd="click",Dh=["click","drag"],gd=void 0,Nh=["shift","ctrl","control","alt","meta",void 0],Ph={getDefaultCfg:function(){return{trigger:vd,key:gd,edgeConfig:{},getEdgeConfig:void 0}},getEvents:function(){var t=this;Dh.indexOf(t.trigger.toLowerCase())>-1||(t.trigger=vd,console.warn("Behavior create-edge \u7684 trigger \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'click'\uFF0C'drag'")),t.key&&Nh.indexOf(t.key.toLowerCase())===-1&&(t.trigger=gd,console.warn("Behavior create-edge \u7684 key \u53C2\u6570\u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'shift'\uFF0C'ctrl'\uFF0C'alt'\uFF0C'control'\uFF0C\u6216 undefined"));var e;return t.trigger==="drag"?e={"node:dragstart":"onClick","combo:dragstart":"onClick",drag:"updateEndPoint","node:drop":"onClick","combo:drop":"onClick",dragend:"onDragEnd"}:t.trigger==="click"&&(e={"node:click":"onClick",mousemove:"updateEndPoint","edge:click":"cancelCreating","canvas:click":"cancelCreating","combo:click":"onClick"}),t.key&&(e.keydown="onKeyDown",e.keyup="onKeyUp"),e},onDragEnd:function(t){var e=this;if(!(e.key&&!e.keydown)){var r=t.item;(!r||r.getID()===e.source||r.getType()!=="node")&&e.cancelCreating({item:e.edge,x:t.x,y:t.y})}},onClick:function(t){var e=this;if(!(e.key&&!e.keydown)){var r=t.item,n=e.graph,a=r.getModel(),i=e.getEdgeConfig;if(e.addingEdge&&e.edge){if(!e.shouldEnd(t,e))return;var o=void 0;i&&(0,s.isFunction)(i)?o=i({source:e.source,target:a.id},e):o=e.edgeConfig;var u=(0,c.__assign)({target:a.id},o);if(e.source===a.id&&(u.type="loop"),n.emit("beforecreateedge",{}),n.updateItem(e.edge,u,!1),n.get("enabledStack")){var l=(0,c.__assign)((0,c.__assign)({},e.edge.getModel()),{itemType:"edge"}),h={};h.edges=[l],n.pushStack("add",{before:{},after:h})}n.emit("aftercreateedge",{edge:e.edge}),e.edge.getKeyShape().set("capture",!0),e.edge=null,e.addingEdge=!1}else{if(!e.shouldBegin(t,e))return;var o=void 0;i&&(0,s.isFunction)(i)?o=i({source:a.id,target:a.id},e):o=e.edgeConfig,e.edge=n.addItem("edge",(0,c.__assign)({source:a.id,target:a.id},o),!1),e.source=a.id,e.addingEdge=!0,e.edge.getKeyShape().set("capture",!1)}}},updateEndPoint:function(t){var e=this;if(!(e.key&&!e.keydown)){e.edge&&e.edge.destroyed&&e.cancelCreating({item:e.edge});var r={x:t.x,y:t.y};if(!e.graph.findById(e.source)){e.addingEdge=!1;return}e.addingEdge&&e.edge&&e.graph.updateItem(e.edge,{target:r},!1)}},cancelCreating:function(t){var e,r,n=this;if(!(n.key&&!n.keydown)){var a=n.graph,i=t.item;if(n.addingEdge&&(n.edge===i||!((r=(e=t.target)===null||e===void 0?void 0:e.isCanvas)===null||r===void 0)&&r.call(e))){n.edge&&!n.edge.destroyed&&a.removeItem(n.edge,!1),n.edge=null,n.addingEdge=!1;return}}},onKeyDown:function(t){var e=this,r=t.key;r&&(r.toLowerCase()===e.key.toLowerCase()?e.keydown=!0:e.keydown=!1)},onKeyUp:function(){var t=this;t.addingEdge&&t.edge&&(t.graph.removeItem(t.edge,!1),t.addingEdge=!1,t.edge=null),this.keydown=!1}},pd="ctrl",kh=["shift","ctrl","alt","control"],Rh="1",Bh={getDefaultCfg:function(){return{trigger:pd,combinedKey:Rh,functionName:"fitView",functionParams:[]}},getEvents:function(){return kh.indexOf(this.trigger.toLowerCase())>-1||(this.trigger=pd,console.warn("Behavior shortcuts-fit-view \u7684 trigger \u53C2\u6570 '".concat(this.trigger,"' \u4E0D\u5408\u6CD5\uFF0C\u8BF7\u8F93\u5165 'drag'\u3001'shift'\u3001'ctrl' \u6216 'alt'"))),this.combinedKey===this.trigger&&(this.combinedKey=void 0),{keyup:"onKeyUp",keydown:"onKeyDown"}},onKeyDown:function(t){var e=t.key;if(e){var r=this.trigger.toLowerCase(),n=e.toLowerCase();this.triggerKeydown||(n===r||n==="control"&&r==="ctrl"||n==="ctrl"&&r==="control"?this.triggerKeydown=!0:this.triggerKeydown=!1);var a=this.graph;if(!a[this.functionName])return console.warn("Behavior shortcuts-fit-view \u7684 functionName \u53C2\u6570 '".concat(this.functionName,"' \u4E0D\u5408\u6CD5\uFF0C\u5B83\u4E0D\u662F Graph \u7684\u4E00\u4E2A\u51FD\u6570\u540D")),{};if(this.triggerKeydown&&!this.combinedKey){this.functionParams&&this.functionParams.length?a[this.functionName].apply(a,this.functionParams):a[this.functionName]();return}var i=this.combinedKey.toLowerCase();this.triggerKeydown&&(n===i||n==="control"&&i==="ctrl"||n==="ctrl"&&i==="control")&&(this.functionParams&&this.functionParams.length?a[this.functionName].apply(a,this.functionParams):a[this.functionName]())}},onKeyUp:function(){this.brush&&(this.brush.remove(!0),this.brush=null,this.dragging=!1),this.triggerKeydown=!1}},Fh=["shift","ctrl","alt","control","meta"],Gh={getDefaultCfg:function(){return{direction:"both",enableOptimize:!1,zoomKey:"ctrl",scalableRange:0,allowDragOnItem:!0}},getEvents:function(){return(!this.zoomKey||Fh.indexOf(this.zoomKey)===-1)&&(this.zoomKey="ctrl"),{wheel:"onWheel"}},onWheel:function(t){var e=this;if(this.allowDrag(t)){var r=this.graph,n=Array.isArray(this.zoomKey)?[].concat(this.zoomKey):[this.zoomKey];n.includes("control")&&n.push("ctrl");var a=n.some(function(Rr){return t["".concat(Rr,"Key")]});if(a){var i=r.get("canvas"),o=i.getPointByClient(t.clientX,t.clientY),u=r.getZoom();t.wheelDelta>0?u=u+u*.05:u=u-u*.05,r.zoomTo(u,{x:o.x,y:o.y})}else{var l=t.deltaX||t.movementX,h=t.deltaY||t.movementY;!h&&navigator.userAgent.indexOf("Firefox")>-1&&(h=-t.wheelDelta*125/3);var y=this.graph.get("width"),O=this.graph.get("height"),A=this.graph.get("canvas").getCanvasBBox(),z=this.scalableRange,$=this.scalableRange;z<1&&z>-1&&(z=y*z,$=O*$);var ae=A.minX,ce=A.maxX,ue=A.minY,ve=A.maxY;l>0?ce<-z?l=0:ce-l<-z&&(l=ce+z):l<0&&(ae>y+z?l=0:ae-l>y+z&&(l=ae-(y+z))),h>0?ve<-$?h=0:ve-h<-$&&(h=ve+$):h<0&&(ue>O+$?h=0:ue-h>O+$&&(h=ue-(O+$))),this.get("direction")==="x"?h=0:this.get("direction")==="y"&&(l=0),r.translate(-l,-h)}t.preventDefault();var Ce=this.get("enableOptimize");if(Ce){var Re=this.get("optimizeZoom"),Ve=this.get("optimized"),Ue=r.getNodes(),$e=r.getEdges(),ot=Ue.length,et=$e.length;if(!Ve){for(var yt=0;yt0?at.set(D,te):at.delete(D))}function p(at,D,te,xe){var be=String(D),De=String(te);if(!at&&be>De){var Xe=be;be=De,De=Xe}return be+I.EDGE_KEY_DELIM+De+I.EDGE_KEY_DELIM+(xe===void 0?I.DEFAULT_EDGE_NAME:xe)}function v(at,D,te,xe){var be=String(D),De=String(te),Xe={v:D,w:te};if(!at&&be>De){var Je=Xe.v;Xe.v=Xe.w,Xe.w=Je}return xe!==void 0&&(Xe.name=xe),Xe}function g(at,D){return p(at,D.v,D.w,D.name)}function d(at){return typeof at=="function"}var c=function(D){return D.nodes().map(function(te){var xe=D.node(te),be=D.parent(te),De={id:te,value:xe,parent:be};return De.value===void 0&&delete De.value,De.parent===void 0&&delete De.parent,De})},s=function(D){return D.edges().map(function(te){var xe=D.edge(te),be={v:te.v,w:te.w,value:xe,name:te.name};return be.name===void 0&&delete be.name,be.value===void 0&&delete be.value,be})},m=function(D){var te={options:{directed:D.isDirected(),multigraph:D.isMultigraph(),compound:D.isCompound()},nodes:c(D),edges:s(D),value:D.graph()};return te.value===void 0&&delete te.value,te},M=function(D){var te=new Z(D.options);return D.value!==void 0&&te.setGraph(D.value),D.nodes.forEach(function(xe){te.setNode(xe.id,xe.value),xe.parent&&te.setParent(xe.id,xe.parent)}),D.edges.forEach(function(xe){te.setEdge(xe.v,xe.w,xe.value,xe.name)}),te};function P(at,D){var te=Object.keys(at);if(Object.getOwnPropertySymbols){var xe=Object.getOwnPropertySymbols(at);D&&(xe=xe.filter(function(be){return Object.getOwnPropertyDescriptor(at,be).enumerable})),te.push.apply(te,xe)}return te}function R(at){for(var D=1;D0&&arguments[0]!==void 0?arguments[0]:{};Q(this,at),this.directed=!0,this.multigraph=!1,this.compound=!1,this.GRAPH_NODE=I.GRAPH_NODE,this.label=void 0,this.nodeCountNum=0,this.edgeCountNum=0,this.defaultNodeLabelFn=function(){},this.defaultEdgeLabelFn=function(){},this.parentMap=void 0,this.childrenMap=void 0,this.nodesLabelMap=new Map,this.inEdgesMap=new Map,this.outEdgesMap=new Map,this.predecessorsMap=new Map,this.successorsMap=new Map,this.edgesMap=new Map,this.edgesLabelsMap=new Map,this.isDirected=function(){return D.directed},this.isMultigraph=function(){return D.multigraph},this.isCompound=function(){return D.compound},this.setGraph=function(be){return D.label=be,D},this.graph=function(){return D.label},this.setDefaultNodeLabel=function(be){return d(be)?D.defaultNodeLabelFn=be:D.defaultNodeLabelFn=function(){return be},D},this.nodeCount=function(){return D.nodeCountNum},this.node=function(be){return D.nodesLabelMap.get(be)},this.nodes=function(){return Array.from(D.nodesLabelMap.keys())},this.sources=function(){return D.nodes().filter(function(be){var De;return!(!((De=D.inEdgesMap.get(be))===null||De===void 0)&&De.size)})},this.sinks=function(){return D.nodes().filter(function(be){var De;return!(!((De=D.outEdgesMap.get(be))===null||De===void 0)&&De.size)})},this.setNodes=function(be,De){return be.map(function(Xe){return D.setNode(Xe,De)}),D},this.hasNode=function(be){return D.nodesLabelMap.has(be)},this.checkCompound=function(){if(!D.isCompound())throw new Error("Cannot construct parent-children relations in a non-compound graph")},this.parent=function(be){if(D.isCompound()){var De,Xe=(De=D.parentMap)===null||De===void 0?void 0:De.get(be);if(Xe!==D.GRAPH_NODE)return Xe}},this.removeFromParentsChildList=function(be){var De=D.parentMap.get(be);D.childrenMap.get(De).delete(be)},this.setParent=function(be,De){var Xe,Je;D.checkCompound();for(var lt=De===void 0?D.GRAPH_NODE:De,Tt=D.parent(lt);Tt;){if(be===Tt)throw new Error("Setting "+De+" as parent of "+be+" would create a cycle");Tt=D.parent(Tt)}De&&D.setNode(De),D.setNode(be),D.removeFromParentsChildList(be),(Xe=D.parentMap)===null||Xe===void 0||Xe.set(be,lt);var Ht=D.childrenMap.get(lt);return Ht.set(be,!0),(Je=D.childrenMap)===null||Je===void 0||Je.set(lt,Ht),D},this.children=function(be){var De=be===void 0?D.GRAPH_NODE:be;if(D.isCompound()){var Xe,Je=(Xe=D.childrenMap)===null||Xe===void 0?void 0:Xe.get(De);return Je?Array.from(Je.keys()):void 0}if(De===D.GRAPH_NODE)return D.nodes();if(be&&D.hasNode(be))return[]},this.predecessors=function(be){var De=D.predecessorsMap.get(be);return De?Array.from(De.keys()):void 0},this.successors=function(be){var De=D.successorsMap.get(be);return De?Array.from(De.keys()):void 0},this.neighbors=function(be){var De;if(D.hasNode(be))return Array.from(new Set((De=D.predecessors(be))===null||De===void 0?void 0:De.concat(D.successors(be))))},this.isLeaf=function(be){var De;if(D.isDirected()){var Xe;return!(!((Xe=D.successors(be))===null||Xe===void 0)&&Xe.length)}return!(!((De=D.neighbors(be))===null||De===void 0)&&De.length)},this.filterNodes=function(be){var De=D.directed,Xe=D.multigraph,Je=D.compound,lt=new at({directed:De,multigraph:Xe,compound:Je});if(lt.setGraph(D.graph()),D.nodes().forEach(function(Ht){be(Ht)&<.setNode(Ht,D.node(Ht))}),D.edges().forEach(function(Ht){lt.hasNode(Ht.v)&<.hasNode(Ht.w)&<.setEdgeObj(Ht,D.edge(Ht))}),Je){var Tt=function(ir){for(var Kr=D.parent(ir);Kr!==void 0&&!lt.hasNode(Kr);)Kr=D.parent(Kr);return Kr};lt.nodes().forEach(function(Ht){lt.setParent(Ht,Tt(Ht))})}return lt},this.setDefaultEdgeLabel=function(be){return d(be)?D.defaultEdgeLabelFn=be:D.defaultEdgeLabelFn=function(){return be},D},this.edgeCount=function(){return D.edgeCountNum},this.setEdgeObj=function(be,De){return D.setEdge(be.v,be.w,De,be.name)},this.setPath=function(be,De){return be.reduce(function(Xe,Je){return D.setEdge(Xe,Je,De),Je}),D},this.edgeFromArgs=function(be,De,Xe){return D.edge({v:be,w:De,name:Xe})},this.edge=function(be){return D.edgesLabelsMap.get(g(D.isDirected(),be))},this.hasEdge=function(be,De,Xe){return D.edgesLabelsMap.has(g(D.isDirected(),{v:be,w:De,name:Xe}))},this.removeEdgeObj=function(be){var De=be.v,Xe=be.w,Je=be.name;return D.removeEdge(De,Xe,Je)},this.edges=function(){return Array.from(D.edgesMap.values())},this.inEdges=function(be,De){var Xe=D.inEdgesMap.get(be);if(Xe)return Array.from(Xe.values()).filter(function(Je){return!De||Je.v===De})},this.outEdges=function(be,De){var Xe=D.outEdgesMap.get(be);if(Xe)return Array.from(Xe.values()).filter(function(Je){return!De||Je.w===De})},this.nodeEdges=function(be,De){var Xe;if(D.hasNode(be))return(Xe=D.inEdges(be,De))===null||Xe===void 0?void 0:Xe.concat(D.outEdges(be,De))},this.toJSON=function(){return m(D)},this.nodeInDegree=function(be){var De=D.inEdgesMap.get(be);return De?De.size:0},this.nodeOutDegree=function(be){var De=D.outEdgesMap.get(be);return De?De.size:0},this.nodeDegree=function(be){return D.nodeInDegree(be)+D.nodeOutDegree(be)},this.source=function(be){return be.v},this.target=function(be){return be.w};var xe=R(R({},H),te);this.compound=xe.compound,this.directed=xe.directed,this.multigraph=xe.multigraph,this.compound&&(this.parentMap=new Map,this.childrenMap=new Map)}return W(at,[{key:"setNode",value:function(te,xe){var be=this.nodesLabelMap,De=this.defaultNodeLabelFn,Xe=this.isCompound,Je=this.parentMap,lt=this.childrenMap,Tt=this.inEdgesMap,Ht=this.outEdgesMap,ir=this.predecessorsMap,Kr=this.successorsMap;if(be.has(te))return xe!==void 0&&be.set(te,xe),this;if(be.set(te,xe||De(te)),Xe()){var nn;Je==null||Je.set(te,this.GRAPH_NODE),lt==null||lt.set(te,new Map),lt!=null&<.has(this.GRAPH_NODE)||lt==null||lt.set(this.GRAPH_NODE,new Map),lt==null||(nn=lt.get(this.GRAPH_NODE))===null||nn===void 0||nn.set(te,!0)}return[Tt,Ht,ir,Kr].forEach(function(mn){return mn.set(te,new Map)}),this.nodeCountNum+=1,this}},{key:"removeNode",value:function(te){var xe=this;if(this.hasNode(te)){var be=function(jn){xe.removeEdge(jn.v,jn.w,jn.name)},De=this.inEdgesMap,Xe=this.outEdgesMap,Je=this.predecessorsMap,lt=this.successorsMap,Tt=this.nodesLabelMap;if(this.isCompound()){var Ht,ir,Kr;this.removeFromParentsChildList(te),(Ht=this.parentMap)===null||Ht===void 0||Ht.delete(te),(ir=this.children(te))===null||ir===void 0||ir.forEach(function(Jr){return xe.setParent(Jr)}),(Kr=this.childrenMap)===null||Kr===void 0||Kr.delete(te)}var nn=De.get(te),mn=Xe.get(te);Array.from(nn.values()).forEach(function(Jr){return be(Jr)}),Array.from(mn.values()).forEach(function(Jr){return be(Jr)}),Tt.delete(te),De.delete(te),Xe.delete(te),Je.delete(te),lt.delete(te),this.nodeCountNum-=1}return this}},{key:"setEdge",value:function(te,xe,be,De){var Xe,Je,lt=v(this.isDirected(),te,xe,De),Tt=g(this.isDirected(),lt),Ht=lt.v,ir=lt.w;if(this.edgesLabelsMap.has(Tt))return this.edgesLabelsMap.set(Tt,be),this;if(De!==void 0&&!this.isMultigraph())throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(Ht),this.setNode(ir),this.edgesLabelsMap.set(Tt,be||this.defaultEdgeLabelFn(Ht,ir,De)),Object.freeze(lt),this.edgesMap.set(Tt,lt);var Kr=this.predecessorsMap.get(ir),nn=this.successorsMap.get(Ht);return T(Kr,Ht),T(nn,ir),(Xe=this.inEdgesMap.get(ir))===null||Xe===void 0||Xe.set(Tt,lt),(Je=this.outEdgesMap.get(Ht))===null||Je===void 0||Je.set(Tt,lt),this.edgeCountNum+=1,this}},{key:"removeEdge",value:function(te,xe,be){var De=p(this.isDirected(),te,xe,be),Xe=this.edgesMap.get(De);if(Xe){var Je=v(this.isDirected(),te,xe,be),lt=Je.v,Tt=Je.w;this.edgesLabelsMap.delete(De),this.edgesMap.delete(De);var Ht=this.predecessorsMap.get(Tt),ir=this.successorsMap.get(lt);x(Ht,lt),x(ir,Tt),this.inEdgesMap.get(Tt).delete(De),this.outEdgesMap.get(lt).delete(De),this.edgeCountNum-=1}return this}}]),at}();Z.fromJSON=M;function J(at){"@babel/helpers - typeof";return J=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D},J(at)}function K(at,D){if(!(at instanceof D))throw new TypeError("Cannot call a class as a function")}function ne(at,D){for(var te=0;te-1&&this.eventPool[be].splice(Xe,1)}}},{key:"emitEvent",value:function(be){for(var De=arguments.length,Xe=new Array(De>1?De-1:0),Je=1;Je>1,((Je=xe[De])===null||Je===void 0?void 0:Je.priority)D.arr[be].priority)throw new Error("New priority is greater than current priority.Key: ".concat(te," Old: + ").concat(D.arr[be].priority," New: ").concat(xe));D.arr[be].priority=xe,D.innerDecrease(be)}}),Qe=function(D,te){var xe=new Z,be=new Map,De=new Jt,Xe;function Je(Ht){var ir=Ht.v===Xe?Ht.w:Ht.v,Kr=De.priority(ir);if(Kr!==void 0){var nn=te(Ht);nn0;){var Tt;if(Xe=De.removeMin(),be.has(Xe))xe.setEdge(Xe,be.get(Xe));else{if(lt)throw new Error("Input graph is not connected: "+D.graph());lt=!0}(Tt=D.nodeEdges(Xe))===null||Tt===void 0||Tt.forEach(Je)}return xe},ut=Qe,xt=function(D){var te=new Set,xe=[],be=D.nodes();return be.forEach(function(De){for(var Xe=[],Je=[De];Je.length>0;){var lt=Je.pop();if(!te.has(lt)){var Tt,Ht;te.add(lt),Xe.push(lt),(Tt=D.successors(lt))===null||Tt===void 0||Tt.forEach(function(ir){return Je.push(ir)}),(Ht=D.predecessors(lt))===null||Ht===void 0||Ht.forEach(function(ir){return Je.push(ir)})}}Xe.length&&xe.push(Xe)}),xe},dt=xt,pt=function at(D,te,xe,be,De,Xe){be.includes(te)||(be.push(te),xe||Xe.push(te),De(te).forEach(function(Je){return at(D,Je,xe,be,De,Xe)}),xe&&Xe.push(te))},wt=function(D,te,xe){var be=Array.isArray(te)?te:[te],De=function(Tt){return D.isDirected()?D.successors(Tt):D.neighbors(Tt)},Xe=[],Je=[];return be.forEach(function(lt){if(D.hasNode(lt))pt(D,lt,xe==="post",Je,De,Xe);else throw new Error("Graph does not have node: "+lt)}),Xe},mt=wt;function ur(at,D){return qt(at)||It(at,D)||Nr(at,D)||Ir()}function Ir(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nr(at,D){if(at){if(typeof at=="string")return Hr(at,D);var te=Object.prototype.toString.call(at).slice(8,-1);if(te==="Object"&&at.constructor&&(te=at.constructor.name),te==="Map"||te==="Set")return Array.from(at);if(te==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(te))return Hr(at,D)}}function Hr(at,D){(D==null||D>at.length)&&(D=at.length);for(var te=0,xe=new Array(D);te0&&(Je=Xe.removeMin(),lt=De.get(Je),!(lt&<.distance===Number.POSITIVE_INFINITY));)be(Je).forEach(Tt);var Ht={};return Array.from(De.entries()).forEach(function(ir){var Kr=ur(ir,2),nn=Kr[0],mn=Kr[1];return Ht[String(nn)]=mn,Ht}),Ht},Cr=Oe,Gr=function(D,te,xe){var be={};return D.nodes().forEach(function(De){return be[String(De)]=Cr(D,De,te,xe),be}),be},mr=Gr,rn=function(D){var te=0,xe=[],be=new Map,De=[];function Xe(Je){var lt,Tt={onStack:!0,lowlink:te,index:te};if(be.set(Je,Tt),te+=1,xe.push(Je),(lt=D.successors(Je))===null||lt===void 0||lt.forEach(function(nn){var mn;if(be.has(nn)){if(!((mn=be.get(nn))===null||mn===void 0)&&mn.onStack){var jn=be.get(nn);Tt.lowlink=Math.min(Tt.lowlink,jn.index)}}else{Xe(nn);var Jr=be.get(nn);Tt.lowlink=Math.min(Tt.lowlink,Jr.lowlink)}}),Tt.lowlink===Tt.index){var Ht=[],ir;do{ir=xe.pop();var Kr=be.get(ir);Kr.onStack=!1,Ht.push(ir)}while(Je!==ir);De.push(Ht)}}return D.nodes().forEach(function(Je){be.has(Je)||Xe(Je)}),De},Sr=rn,qr=function(D){return Sr(D).filter(function(te){return te.length>1||te.length===1&&D.hasEdge(te[0],te[0])})},Rn=qr;function yn(at){"@babel/helpers - typeof";return yn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(D){return typeof D}:function(D){return D&&typeof Symbol=="function"&&D.constructor===Symbol&&D!==Symbol.prototype?"symbol":typeof D},yn(at)}function zr(at,D){for(var te=0;teat.length)&&(D=at.length);for(var te=0,xe=new Array(D);te-1:!1};F.a=L},function(N,F,k){"use strict";var U=function(L){return typeof L=="object"&&L!==null};F.a=U},function(N,F,k){"use strict";var U=k(8),L=k(2),_=Object.values?function(I){return Object.values(I)}:function(I){var T=[];return Object(U.a)(I,function(x,p){Object(L.a)(I)&&p==="prototype"||T.push(x)}),T};F.a=_},function(N,F,k){"use strict";F.a=L;function U(_,I){for(var T in I)I.hasOwnProperty(T)&&T!=="constructor"&&I[T]!==void 0&&(_[T]=I[T])}function L(_,I,T,x){return I&&U(_,I),T&&U(_,T),x&&U(_,x),_}},function(N,F,k){var U=k(35),L=["LR","RL","TB","BT","H","V"],_=["LR","RL","H"],I=function(p){return _.indexOf(p)>-1},T=L[0];N.exports=function(x,p,v){var g=p.direction||T;if(p.isHorizontal=I(g),g&&L.indexOf(g)===-1)throw new TypeError("Invalid direction: "+g);if(g===L[0])v(x,p);else if(g===L[1])v(x,p),x.right2left();else if(g===L[2])v(x,p);else if(g===L[3])v(x,p),x.bottom2top();else if(g===L[4]||g===L[5]){var d=U(x,p),c=d.left,s=d.right;v(c,p),v(s,p),p.isHorizontal?c.right2left():c.bottom2top(),s.translate(c.x-s.x,c.y-s.y),x.x=c.x,x.y=s.y;var m=x.getBoundingBox();p.isHorizontal?m.top<0&&x.translate(0,-m.top):m.left<0&&x.translate(-m.left,0)}var M=p.fixedRoot;return M===void 0&&(M=!0),M&&x.translate(-(x.x+x.width/2+x.hgap),-(x.y+x.height/2+x.vgap)),x}},function(N,F,k){var U=k(6),L=18,_=L*2,I=L,T={getId:function(g){return g.id||g.name},getPreH:function(g){return g.preH||0},getPreV:function(g){return g.preV||0},getHGap:function(g){return g.hgap||I},getVGap:function(g){return g.vgap||I},getChildren:function(g){return g.children},getHeight:function(g){return g.height||_},getWidth:function(g){var d=g.label||" ";return g.width||d.split("").length*L}};function x(v,g){var d=this;if(d.vgap=d.hgap=0,v instanceof x)return v;d.data=v;var c=g.getHGap(v),s=g.getVGap(v);return d.preH=g.getPreH(v),d.preV=g.getPreV(v),d.width=g.getWidth(v),d.height=g.getHeight(v),d.width+=d.preH,d.height+=d.preV,d.id=g.getId(v),d.x=d.y=0,d.depth=0,d.children||(d.children=[]),d.addGap(c,s),d}U.assign(x.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(g,d){var c=this;c.hgap+=g,c.vgap+=d,c.width+=2*g,c.height+=2*d},eachNode:function(g){for(var d=this,c=[d],s;s=c.shift();)g(s),c=s.children.concat(c)},DFTraverse:function(g){this.eachNode(g)},BFTraverse:function(g){for(var d=this,c=[d],s;s=c.shift();)g(s),c=c.concat(s.children)},getBoundingBox:function(){var g={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(d){g.left=Math.min(g.left,d.x),g.top=Math.min(g.top,d.y),g.width=Math.max(g.width,d.x+d.width),g.height=Math.max(g.height,d.y+d.height)}),g},translate:function(g,d){g===void 0&&(g=0),d===void 0&&(d=0),this.eachNode(function(c){c.x+=g,c.y+=d,c.x+=c.preH,c.y+=c.preV})},right2left:function(){var g=this,d=g.getBoundingBox();g.eachNode(function(c){c.x=c.x-(c.x-d.left)*2-c.width}),g.translate(d.width,0)},bottom2top:function(){var g=this,d=g.getBoundingBox();g.eachNode(function(c){c.y=c.y-(c.y-d.top)*2-c.height}),g.translate(0,d.height)}});function p(v,g,d){g===void 0&&(g={}),g=U.assign({},T,g);var c=new x(v,g),s=[c],m;if(!d&&!v.collapsed){for(;m=s.shift();)if(!m.data.collapsed){var M=g.getChildren(m.data),P=M?M.length:0;if(m.children=new Array(P),M&&P)for(var R=0;R-1;)L.call(T,d,1);return T};F.a=I},function(N,F,k){"use strict";var U=k(1),L=k(24),_=function(I,T){var x=[];if(!Object(U.a)(I))return x;for(var p=-1,v=[],g=I.length;++pd[s])return 1;if(g[s]I?I:L};F.a=U},function(N,F,k){"use strict";var U=function(L,_){var I=_.toString(),T=I.indexOf(".");if(T===-1)return Math.round(L);var x=I.substr(T+1).length;return x>20&&(x=20),parseFloat(L.toFixed(x))};F.a=U},function(N,F,k){"use strict";var U=k(5),L=function(_){return Object(U.a)(_)&&_%1!==0};F.a=L},function(N,F,k){"use strict";var U=k(5),L=function(_){return Object(U.a)(_)&&_%2===0};F.a=L},function(N,F,k){"use strict";var U=k(5),L=Number.isInteger?Number.isInteger:function(_){return Object(U.a)(_)&&_%1===0};F.a=L},function(N,F,k){"use strict";var U=k(5),L=function(_){return Object(U.a)(_)&&_<0};F.a=L},function(N,F,k){"use strict";F.a=L;var U=1e-5;function L(_,I,T){return T===void 0&&(T=U),Math.abs(_-I)0};F.a=L},function(N,F,k){"use strict";var U=k(0),L=k(2);F.a=function(_,I){if(Object(U.a)(_)){for(var T,x=-1/0,p=0;p<_.length;p++){var v=_[p],g=Object(L.a)(I)?I(v):v[I];g>x&&(T=v,x=g)}return T}}},function(N,F,k){"use strict";var U=k(0),L=k(2);F.a=function(_,I){if(Object(U.a)(_)){for(var T,x=1/0,p=0;p<_.length;p++){var v=_[p],g=Object(L.a)(I)?I(v):v[I];gL?(I&&(clearTimeout(I),I=null),v=c,p=U.apply(T,x),I||(T=x=null)):!I&&_.trailing!==!1&&(I=setTimeout(g,s)),p};return d.cancel=function(){clearTimeout(I),v=0,I=T=x=null},d}},function(N,F,k){"use strict";var U=k(1);F.a=function(L){return Object(U.a)(L)?Array.prototype.slice.call(L):[]}},function(N,F,k){"use strict";var U={};F.a=function(L){return L=L||"g",U[L]?U[L]+=1:U[L]=1,L+U[L]}},function(N,F,k){"use strict";F.a=function(){}},function(N,F,k){"use strict";F.a=function(U){return U}},function(N,F,k){"use strict";F.a=_;var U=k(7),L=k(1);function _(I){return Object(U.a)(I)?0:Object(L.a)(I)?I.length:Object.keys(I).length}},function(N,F,k){"use strict";F.a=G;var U=function(we,Te){return U=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ke,Ge){ke.__proto__=Ge}||function(ke,Ge){for(var tt in Ge)Object.prototype.hasOwnProperty.call(Ge,tt)&&(ke[tt]=Ge[tt])},U(we,Te)};function L(we,Te){if(typeof Te!="function"&&Te!==null)throw new TypeError("Class extends value "+String(Te)+" is not a constructor or null");U(we,Te);function ke(){this.constructor=we}we.prototype=Te===null?Object.create(Te):(ke.prototype=Te.prototype,new ke)}var _=function(){return _=Object.assign||function(Te){for(var ke,Ge=1,tt=arguments.length;Ge=0;Lt--)(ft=we[Lt])&&(He=(tt<3?ft(He):tt>3?ft(Te,ke,He):ft(Te,ke))||He);return tt>3&&He&&Object.defineProperty(Te,ke,He),He}function x(we,Te){return function(ke,Ge){Te(ke,Ge,we)}}function p(we,Te,ke,Ge,tt,He){function ft(Ir){if(Ir!==void 0&&typeof Ir!="function")throw new TypeError("Function expected");return Ir}for(var Lt=Ge.kind,Jt=Lt==="getter"?"get":Lt==="setter"?"set":"value",Qe=!Te&&we?Ge.static?we:we.prototype:null,ut=Te||(Qe?Object.getOwnPropertyDescriptor(Qe,Ge.name):{}),xt,dt=!1,pt=ke.length-1;pt>=0;pt--){var wt={};for(var mt in Ge)wt[mt]=mt==="access"?{}:Ge[mt];for(var mt in Ge.access)wt.access[mt]=Ge.access[mt];wt.addInitializer=function(Ir){if(dt)throw new TypeError("Cannot add initializers after decoration has completed");He.push(ft(Ir||null))};var ur=(0,ke[pt])(Lt==="accessor"?{get:ut.get,set:ut.set}:ut[Jt],wt);if(Lt==="accessor"){if(ur===void 0)continue;if(ur===null||typeof ur!="object")throw new TypeError("Object expected");(xt=ft(ur.get))&&(ut.get=xt),(xt=ft(ur.set))&&(ut.set=xt),(xt=ft(ur.init))&&tt.push(xt)}else(xt=ft(ur))&&(Lt==="field"?tt.push(xt):ut[Jt]=xt)}Qe&&Object.defineProperty(Qe,Ge.name,ut),dt=!0}function v(we,Te,ke){for(var Ge=arguments.length>2,tt=0;tt0&&He[He.length-1])&&(Qe[0]===6||Qe[0]===2)){ke=0;continue}if(Qe[0]===3&&(!He||Qe[1]>He[0]&&Qe[1]=we.length&&(we=void 0),{value:we&&we[Ge++],done:!we}}};throw new TypeError(Te?"Object is not iterable.":"Symbol.iterator is not defined.")}function j(we,Te){var ke=typeof Symbol=="function"&&we[Symbol.iterator];if(!ke)return we;var Ge=ke.call(we),tt,He=[],ft;try{for(;(Te===void 0||Te-- >0)&&!(tt=Ge.next()).done;)He.push(tt.value)}catch(Lt){ft={error:Lt}}finally{try{tt&&!tt.done&&(ke=Ge.return)&&ke.call(Ge)}finally{if(ft)throw ft.error}}return He}function Q(){for(var we=[],Te=0;Te1||Lt(dt,pt)})})}function Lt(dt,pt){try{Jt(Ge[dt](pt))}catch(wt){xt(He[0][3],wt)}}function Jt(dt){dt.value instanceof H?Promise.resolve(dt.value.v).then(Qe,ut):xt(He[0][2],dt)}function Qe(dt){Lt("next",dt)}function ut(dt){Lt("throw",dt)}function xt(dt,pt){dt(pt),He.shift(),He.length&&Lt(He[0][0],He[0][1])}}function J(we){var Te,ke;return Te={},Ge("next"),Ge("throw",function(tt){throw tt}),Ge("return"),Te[Symbol.iterator]=function(){return this},Te;function Ge(tt,He){Te[tt]=we[tt]?function(ft){return(ke=!ke)?{value:H(we[tt](ft)),done:!1}:He?He(ft):ft}:He}}function K(we){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var Te=we[Symbol.asyncIterator],ke;return Te?Te.call(we):(we=typeof R=="function"?R(we):we[Symbol.iterator](),ke={},Ge("next"),Ge("throw"),Ge("return"),ke[Symbol.asyncIterator]=function(){return this},ke);function Ge(He){ke[He]=we[He]&&function(ft){return new Promise(function(Lt,Jt){ft=we[He](ft),tt(Lt,Jt,ft.done,ft.value)})}}function tt(He,ft,Lt,Jt){Promise.resolve(Jt).then(function(Qe){He({value:Qe,done:Lt})},ft)}}function ne(we,Te){return Object.defineProperty?Object.defineProperty(we,"raw",{value:Te}):we.raw=Te,we}var se=Object.create?function(we,Te){Object.defineProperty(we,"default",{enumerable:!0,value:Te})}:function(we,Te){we.default=Te};function fe(we){if(we&&we.__esModule)return we;var Te={};if(we!=null)for(var ke in we)ke!=="default"&&Object.prototype.hasOwnProperty.call(we,ke)&&M(Te,we,ke);return se(Te,we),Te}function Ie(we){return we&&we.__esModule?we:{default:we}}function ye(we,Te,ke,Ge){if(ke==="a"&&!Ge)throw new TypeError("Private accessor was defined without a getter");if(typeof Te=="function"?we!==Te||!Ge:!Te.has(we))throw new TypeError("Cannot read private member from an object whose class did not declare it");return ke==="m"?Ge:ke==="a"?Ge.call(we):Ge?Ge.value:Te.get(we)}function Ae(we,Te,ke,Ge,tt){if(Ge==="m")throw new TypeError("Private method is not writable");if(Ge==="a"&&!tt)throw new TypeError("Private accessor was defined without a setter");if(typeof Te=="function"?we!==Te||!tt:!Te.has(we))throw new TypeError("Cannot write private member to an object whose class did not declare it");return Ge==="a"?tt.call(we,ke):tt?tt.value=ke:Te.set(we,ke),ke}function Se(we,Te){if(Te===null||typeof Te!="object"&&typeof Te!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof we=="function"?Te===we:we.has(Te)}},function(N,F,k){"use strict";var U=k(4),L=k(9),_=k(34);F.a=function(I,T,x,p){p===void 0&&(p="...");var v=16,g=Object(_.a)(p,x),d=Object(U.a)(I)?I:Object(L.a)(I),c=T,s=[],m,M;if(Object(_.a)(I,x)<=T)return I;for(;m=d.substr(0,v),M=Object(_.a)(m,x),!(M+g>c&&M>c);)if(s.push(m),c-=M,d=d.substr(v),!d)return s.join("");for(;m=d.substr(0,1),M=Object(_.a)(m,x),!(M+g>c);)if(s.push(m),c-=M,d=d.substr(1),!d)return s.join("");return""+s.join("")+p}},function(N,F,k){"use strict";var U=function(){function L(){this.map={}}return L.prototype.has=function(_){return this.map[_]!==void 0},L.prototype.get=function(_,I){var T=this.map[_];return T===void 0?I:T},L.prototype.set=function(_,I){this.map[_]=I},L.prototype.clear=function(){this.map={}},L.prototype.delete=function(_){delete this.map[_]},L.prototype.size=function(){return Object.keys(this.map).length},L}();F.a=U},function(N,F){function k(x,p,v,g){g===void 0&&(g=[]);var d=this;d.w=x||0,d.h=p||0,d.y=v||0,d.x=0,d.c=g||[],d.cs=g.length,d.prelim=0,d.mod=0,d.shift=0,d.change=0,d.tl=null,d.tr=null,d.el=null,d.er=null,d.msel=0,d.mser=0}k.fromNode=function(x,p){if(!x)return null;var v=[];return x.children.forEach(function(g){v.push(k.fromNode(g,p))}),p?new k(x.height,x.width,x.x,v):new k(x.width,x.height,x.y,v)};function U(x,p,v){v?x.y+=p:x.x+=p,x.children.forEach(function(g){U(g,p,v)})}function L(x,p){var v=p?x.y:x.x;return x.children.forEach(function(g){v=Math.min(L(g,p),v)}),v}function _(x,p){var v=L(x,p);U(x,-v,p)}function I(x,p,v){v?p.y=x.x:p.x=x.x,x.c.forEach(function(g,d){I(g,p.children[d],v)})}function T(x,p,v){v===void 0&&(v=0),p?(x.x=v,v+=x.width):(x.y=v,v+=x.height),x.children.forEach(function(g){T(g,p,v)})}N.exports=function(x,p){p===void 0&&(p={});var v=p.isHorizontal;function g(K){if(K.cs===0){d(K);return}g(K.c[0]);for(var ne=Z(P(K.c[0].el),0,null),se=1;sese.low&&(se=se.nxt);var Se=Ie+fe.prelim+fe.w-(Ae+ye.prelim);Se>0&&(Ae+=Se,s(K,ne,se.index,Se));var we=P(fe),Te=P(ye);we<=Te&&(fe=M(fe),fe!==null&&(Ie+=fe.mod)),we>=Te&&(ye=m(ye),ye!==null&&(Ae+=ye.mod))}!fe&&ye?R(K,ne,ye,Ae):fe&&!ye&&j(K,ne,fe,Ie)}function s(K,ne,se,fe){K.c[ne].mod+=fe,K.c[ne].msel+=fe,K.c[ne].mser+=fe,W(K,ne,se,fe)}function m(K){return K.cs===0?K.tl:K.c[0]}function M(K){return K.cs===0?K.tr:K.c[K.cs-1]}function P(K){return K.y+K.h}function R(K,ne,se,fe){var Ie=K.c[0].el;Ie.tl=se;var ye=fe-se.mod-K.c[0].msel;Ie.mod+=ye,Ie.prelim-=ye,K.c[0].el=K.c[ne].el,K.c[0].msel=K.c[ne].msel}function j(K,ne,se,fe){var Ie=K.c[ne].er;Ie.tr=se;var ye=fe-se.mod-K.c[ne].mser;Ie.mod+=ye,Ie.prelim-=ye,K.c[ne].er=K.c[ne-1].er,K.c[ne].mser=K.c[ne-1].mser}function Q(K){K.prelim=(K.c[0].prelim+K.c[0].mod+K.c[K.cs-1].mod+K.c[K.cs-1].prelim+K.c[K.cs-1].w)/2-K.w/2}function G(K,ne){ne+=K.mod,K.x=K.prelim+ne,H(K);for(var se=0;se=se.low;)se=se.nxt;return{low:K,index:ne,nxt:se}}T(x,v);var J=k.fromNode(x,v);return g(J),G(J,0),I(J,x,v),_(x,v),x}},function(N,F,k){function U(d,c){d.prototype=Object.create(c.prototype),d.prototype.constructor=d,L(d,c)}function L(d,c){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,M){return m.__proto__=M,m},L(d,c)}var _=k(11),I=k(121),T=k(17),x=k(6),p=function(d){U(c,d);function c(){return d.apply(this,arguments)||this}var s=c.prototype;return s.execute=function(){var M=this;return M.rootNode.width=0,T(M.rootNode,M.options,I)},c}(_),v={};function g(d,c){return c=x.assign({},v,c),new p(d,c).execute()}N.exports=g},function(N,F,k){var U=k(6);function L(T,x){T===void 0&&(T=0),x===void 0&&(x=[]);var p=this;p.x=p.y=0,p.leftChild=p.rightChild=null,p.height=0,p.children=x}var _={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function I(T,x,p){p?(x.x=T.x,x.y=T.y):(x.x=T.y,x.y=T.x),T.children.forEach(function(v,g){I(v,x.children[g],p)})}N.exports=function(T,x){x===void 0&&(x={}),x=U.assign({},_,x);var p=0;function v(m){if(!m)return null;m.width=0,m.depth&&m.depth>p&&(p=m.depth);var M=m.children,P=M.length,R=new L(m.height,[]);return M.forEach(function(j,Q){var G=v(j);R.children.push(G),Q===0&&(R.leftChild=G),Q===P-1&&(R.rightChild=G)}),R.originNode=m,R.isLeaf=m.isLeaf(),R}function g(m){if(m.isLeaf||m.children.length===0)m.drawingDepth=p;else{var M=m.children.map(function(R){return g(R)}),P=Math.min.apply(null,M);m.drawingDepth=P-1}return m.drawingDepth}var d;function c(m){m.x=m.drawingDepth*x.rankSep,m.isLeaf?(m.y=0,d&&(m.y=d.y+d.height+x.nodeSep,m.originNode.parent!==d.originNode.parent&&(m.y+=x.subTreeSep)),d=m):(m.children.forEach(function(M){c(M)}),m.y=(m.leftChild.y+m.rightChild.y)/2)}var s=v(T);return g(s),c(s),I(s,T,x.isHorizontal),T}},function(N,F,k){function U(s,m){s.prototype=Object.create(m.prototype),s.prototype.constructor=s,L(s,m)}function L(s,m){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(P,R){return P.__proto__=R,P},L(s,m)}var _=k(11),I=k(123),T=k(35),x=k(6),p=["LR","RL","H"],v=p[0],g=function(s){U(m,s);function m(){return s.apply(this,arguments)||this}var M=m.prototype;return M.execute=function(){var R=this,j=R.options,Q=R.rootNode;j.isHorizontal=!0;var G=j.indent,W=G===void 0?20:G,H=j.dropCap,Z=H===void 0?!0:H,J=j.direction,K=J===void 0?v:J,ne=j.align;if(K&&p.indexOf(K)===-1)throw new TypeError("Invalid direction: "+K);if(K===p[0])I(Q,W,Z,ne);else if(K===p[1])I(Q,W,Z,ne),Q.right2left();else if(K===p[2]){var se=T(Q,j),fe=se.left,Ie=se.right;I(fe,W,Z,ne),fe.right2left(),I(Ie,W,Z,ne);var ye=fe.getBoundingBox();Ie.translate(ye.width,0),Q.x=Ie.x-Q.width/2}return Q},m}(_),d={};function c(s,m){return m=x.assign({},d,m),new g(s,m).execute()}N.exports=c},function(N,F,k){var U=k(6);function L(_,I,T,x,p){var v=typeof T=="function"?T(_):T*_.depth;if(!x)try{if(_.id===_.parent.children[0].id){_.x+=v,_.y=I?I.y:0;return}}catch(c){}if(_.x+=v,I){if(_.y=I.y+U.getHeight(I,_,p),I.parent&&_.parent.id!==I.parent.id){var g=I.parent,d=g.y+U.getHeight(g,_,p);_.y=d>_.y?d:_.y}}else _.y=0}N.exports=function(_,I,T,x){var p=null;_.eachNode(function(v){L(v,p,I,T,x),p=v})}},function(N,F,k){function U(d,c){d.prototype=Object.create(c.prototype),d.prototype.constructor=d,L(d,c)}function L(d,c){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,M){return m.__proto__=M,m},L(d,c)}var _=k(11),I=k(125),T=k(17),x=k(6),p=function(d){U(c,d);function c(){return d.apply(this,arguments)||this}var s=c.prototype;return s.execute=function(){var M=this;return T(M.rootNode,M.options,I)},c}(_),v={};function g(d,c){return c=x.assign({},v,c),new p(d,c).execute()}N.exports=g},function(N,F,k){var U=k(6);function L(T,x){var p=0;return T.children.length?T.children.forEach(function(v){p+=L(v,x)}):p=T.height,T._subTreeSep=x.getSubTreeSep(T.data),T.totalHeight=Math.max(T.height,p)+2*T._subTreeSep,T.totalHeight}function _(T){var x=T.children,p=x.length;if(p){x.forEach(function(m){_(m)});var v=x[0],g=x[p-1],d=g.y-v.y+g.height,c=0;if(x.forEach(function(m){c+=m.totalHeight}),d>T.height)T.y=v.y+d/2-T.height/2;else if(x.length!==1||T.height>c){var s=T.y+(T.height-d)/2-v.y;x.forEach(function(m){m.translate(0,s)})}else T.y=(v.y+v.height/2+g.y+g.height/2)/2-T.height/2}}var I={getSubTreeSep:function(){return 0}};N.exports=function(T,x){x===void 0&&(x={}),x=U.assign({},I,x),T.parent={x:0,width:0,height:0,y:0},T.BFTraverse(function(p){p.x=p.parent.x+p.parent.width}),T.parent=null,L(T,x),T.startY=0,T.y=T.totalHeight/2-T.height/2,T.eachNode(function(p){var v=p.children,g=v.length;if(g){var d=v[0];if(d.startY=p.startY+p._subTreeSep,g===1)d.y=p.y+p.height/2-d.height/2;else{d.y=d.startY+d.totalHeight/2-d.height/2;for(var c=1;cd?1:0}var x=function(p){k(v,p);function v(g){var d=p.call(this)||this;return d.radius=null,d.nodeSize=void 0,d.startRadius=null,d.endRadius=null,d.startAngle=0,d.endAngle=2*Math.PI,d.clockwise=!0,d.divisions=1,d.ordering=null,d.angleRatio=1,d.nodes=[],d.edges=[],d.nodeMap={},d.degrees=[],d.width=300,d.height=300,d.updateCfg(g),d}return v.prototype.getDefaultCfg=function(){return{radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1}},v.prototype.execute=function(){var g,d=this,c=d.nodes,s=d.edges,m=c.length;if(m===0){d.onLayoutEnd&&d.onLayoutEnd();return}!d.width&&typeof window!="undefined"&&(d.width=window.innerWidth),!d.height&&typeof window!="undefined"&&(d.height=window.innerHeight),d.center||(d.center=[d.width/2,d.height/2]);var M=d.center;if(m===1){c[0].x=M[0],c[0].y=M[1],d.onLayoutEnd&&d.onLayoutEnd();return}var P=d.radius,R=d.startRadius,j=d.endRadius,Q=d.divisions,G=d.startAngle,W=d.endAngle,H=d.angleRatio,Z=d.ordering,J=d.clockwise,K=d.nodeSpacing,ne=d.nodeSize,se=(W-G)/m,fe={};c.forEach(function(Lt,Jt){fe[Lt.id]=Jt}),d.nodeMap=fe;var Ie=(0,L.getDegree)(c.length,fe,s);if(d.degrees=Ie,K){var ye=(0,L.getFuncByUnknownType)(10,K),Ae=(0,L.getFuncByUnknownType)(10,ne),Se=-1/0;c.forEach(function(Lt){var Jt=Ae(Lt);Sed.width?d.width/2:d.height/2:!R&&j?R=j:R&&!j&&(j=R);var Te=se*H,ke=[];Z==="topology"?ke=d.topologyOrdering():Z==="topology-directed"?ke=d.topologyOrdering(!0):Z==="degree"?ke=d.degreeOrdering():ke=c;for(var Ge=Math.ceil(m/Q),tt=0;tt=0;Ae--)ye(Ae);return{nodes:c,edges:s,combos:m,comboEdges:M}},v.prototype.getInnerGraphs=function(g){var d=this,c=d.comboTrees,s=d.nodeSize,m=d.edges,M=d.comboPadding,P=d.spacing,R={},j=this.innerLayout||new T.ConcentricLayout({type:"concentric",sortBy:"id"});return j.center=[0,0],j.preventOverlap=!0,j.nodeSpacing=P,(c||[]).forEach(function(Q){(0,I.traverseTreeUp)(Q,function(G){var W,H=(M==null?void 0:M(G))||10;if((0,I.isArray)(H)&&(H=Math.max.apply(Math,H)),!((W=G.children)===null||W===void 0)&&W.length){var J=G.children.map(function(Ge){if(Ge.itemType==="combo")return R[Ge.id];var tt=g[Ge.id]||{};return U(U({},tt),Ge)}),K=J.map(function(Ge){return Ge.id}),ne={nodes:J,edges:m.filter(function(Ge){return K.includes(Ge.source)&&K.includes(Ge.target)})},se=1/0;J.forEach(function(Ge){var tt;Ge.size||(Ge.size=((tt=R[Ge.id])===null||tt===void 0?void 0:tt.size)||(s==null?void 0:s(Ge))||[30,30]),(0,I.isNumber)(Ge.size)&&(Ge.size=[Ge.size,Ge.size]),se>Ge.size[0]&&(se=Ge.size[0]),se>Ge.size[1]&&(se=Ge.size[1])}),j.layout(ne);var fe=(0,I.getLayoutBBox)(J),Ie=fe.minX,ye=fe.minY,Ae=fe.maxX,Se=fe.maxY,we={x:(Ae+Ie)/2,y:(Se+ye)/2};ne.nodes.forEach(function(Ge){Ge.x-=we.x,Ge.y-=we.y});var Te=Math.max(Ae-Ie,se)+H*2,ke=Math.max(Se-ye,se)+H*2;R[G.id]={id:G.id,nodes:J,size:[Te,ke]}}else if(G.itemType==="combo"){var Z=H?[H*2,H*2]:[30,30];R[G.id]={id:G.id,nodes:[],size:Z}}return!0})}),R},v.prototype.initVals=function(){var g=this,d=g.nodeSize,c=g.spacing,s,m;if((0,I.isNumber)(c)?m=function(){return c}:(0,I.isFunction)(c)?m=c:m=function(){return 0},this.spacing=m,!d)s=function(G){var W=m(G);if(G.size){if((0,I.isArray)(G.size)){var H=G.size[0]>G.size[1]?G.size[0]:G.size[1];return(H+W)/2}if((0,I.isObject)(G.size)){var H=G.size.width>G.size.height?G.size.width:G.size.height;return(H+W)/2}return(G.size+W)/2}return 10+W/2};else if((0,I.isFunction)(d))s=function(G){var W=d(G),H=m(G);if((0,I.isArray)(G.size)){var Z=G.size[0]>G.size[1]?G.size[0]:G.size[1];return(Z+H)/2}return((W||10)+H)/2};else if((0,I.isArray)(d)){var M=d[0]>d[1]?d[0]:d[1],P=M/2;s=function(G){return P+m(G)/2}}else{var R=d/2;s=function(G){return R+m(G)/2}}this.nodeSize=s;var j=g.comboPadding,Q;(0,I.isNumber)(j)?Q=function(){return j}:(0,I.isArray)(j)?Q=function(){return Math.max.apply(null,j)}:(0,I.isFunction)(j)?Q=j:Q=function(){return 0},this.comboPadding=Q},v.prototype.getType=function(){return"comboCombined"},v}(_.Base);N.ComboCombinedLayout=x},80808:function(Mt,N,F){"use strict";var k=this&&this.__extends||function(){var I=function(T,x){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,v){p.__proto__=v}||function(p,v){for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(p[g]=v[g])},I(T,x)};return function(T,x){if(typeof x!="function"&&x!==null)throw new TypeError("Class extends value "+String(x)+" is not a constructor or null");I(T,x);function p(){this.constructor=T}T.prototype=x===null?Object.create(x):(p.prototype=x.prototype,new p)}}();Object.defineProperty(N,"__esModule",{value:!0}),N.ComboForceLayout=void 0;var U=F(46833),L=F(44941),_=function(I){k(T,I);function T(x){var p=I.call(this)||this;return p.center=[0,0],p.maxIteration=100,p.gravity=10,p.comboGravity=10,p.linkDistance=10,p.alpha=1,p.alphaMin=.001,p.alphaDecay=1-Math.pow(p.alphaMin,1/300),p.alphaTarget=0,p.velocityDecay=.6,p.edgeStrength=.6,p.nodeStrength=30,p.preventOverlap=!1,p.preventNodeOverlap=!1,p.preventComboOverlap=!1,p.collideStrength=void 0,p.nodeCollideStrength=.5,p.comboCollideStrength=.5,p.comboSpacing=20,p.comboPadding=10,p.optimizeRangeFactor=1,p.onTick=function(){},p.onLayoutEnd=function(){},p.depthAttractiveForceScale=1,p.depthRepulsiveForceScale=2,p.nodes=[],p.edges=[],p.combos=[],p.comboTrees=[],p.width=300,p.height=300,p.bias=[],p.nodeMap={},p.oriComboMap={},p.indexMap={},p.comboMap={},p.previousLayouted=!1,p.updateCfg(x),p}return T.prototype.getDefaultCfg=function(){return{maxIteration:100,center:[0,0],gravity:10,speed:1,comboGravity:30,preventOverlap:!1,preventComboOverlap:!0,preventNodeOverlap:!0,nodeSpacing:void 0,collideStrength:void 0,nodeCollideStrength:.5,comboCollideStrength:.5,comboSpacing:20,comboPadding:10,edgeStrength:.6,nodeStrength:30,linkDistance:10}},T.prototype.execute=function(){var x=this,p=x.nodes,v=x.center;if(x.comboTree={id:"comboTreeRoot",depth:-1,children:x.comboTrees},!p||p.length===0){x.onLayoutEnd&&x.onLayoutEnd();return}if(p.length===1){p[0].x=v[0],p[0].y=v[1],x.onLayoutEnd&&x.onLayoutEnd();return}x.initVals(),x.run(),x.onLayoutEnd&&x.onLayoutEnd()},T.prototype.run=function(){var x=this,p=x.nodes,v=x.previousLayouted?x.maxIteration/5:x.maxIteration;!x.width&&typeof window!="undefined"&&(x.width=window.innerWidth),!x.height&&typeof window!="undefined"&&(x.height=window.innerHeight);var g=x.center,d=x.velocityDecay,c=x.comboMap;x.previousLayouted||x.initPos(c);for(var s=function(R){var j=[];p.forEach(function(Q,G){j[G]={x:0,y:0}}),x.applyCalculate(j),x.applyComboCenterForce(j),p.forEach(function(Q,G){!(0,L.isNumber)(Q.x)||!(0,L.isNumber)(Q.y)||(Q.x+=j[G].x*d,Q.y+=j[G].y*d)}),x.alpha+=(x.alphaTarget-x.alpha)*x.alphaDecay,x.onTick()},m=0;mHe.size[1]?He.size[0]:He.size[1];return ft/2}if((0,L.isObject)(He.size)){var ft=He.size.width>He.size.height?He.size.width:He.size.height;return ft/2}return He.size/2}return 10};else if((0,L.isFunction)(W))Z=function(He){return W(He)};else if((0,L.isArray)(W)){var K=W[0]>W[1]?W[0]:W[1],ne=K/2;Z=function(He){return ne}}else{var se=W/2;Z=function(He){return se}}this.nodeSize=Z;var fe=x.comboSpacing,Ie;(0,L.isNumber)(fe)?Ie=function(){return fe}:(0,L.isFunction)(fe)?Ie=fe:Ie=function(){return 0},this.comboSpacing=Ie;var ye=x.comboPadding,Ae;(0,L.isNumber)(ye)?Ae=function(){return ye}:(0,L.isArray)(ye)?Ae=function(){return Math.max.apply(null,ye)}:(0,L.isFunction)(ye)?Ae=ye:Ae=function(){return 0},this.comboPadding=Ae;var Se=this.linkDistance,we;Se||(Se=10),(0,L.isNumber)(Se)?we=function(He){return Se}:we=Se,this.linkDistance=we;var Te=this.edgeStrength,ke;Te||(Te=1),(0,L.isNumber)(Te)?ke=function(He){return Te}:ke=Te,this.edgeStrength=ke;var Ge=this.nodeStrength,tt;Ge||(Ge=30),(0,L.isNumber)(Ge)?tt=function(He){return Ge}:tt=Ge,this.nodeStrength=tt},T.prototype.initPos=function(x){var p=this,v=p.nodes;v.forEach(function(g,d){var c=g.comboId,s=x[c];c&&s?(g.x=s.cx+100/(d+1),g.y=s.cy+100/(d+1)):(g.x=100/(d+1),g.y=100/(d+1))})},T.prototype.getComboMap=function(){var x=this,p=x.nodeMap,v=x.comboTrees,g=x.oriComboMap,d={};return(v||[]).forEach(function(c){var s=[];(0,L.traverseTreeUp)(c,function(m){if(m.itemType==="node"||!g[m.id])return!0;if(d[m.id]===void 0){var M={id:m.id,name:m.id,cx:0,cy:0,count:0,depth:x.oriComboMap[m.id].depth||0,children:[]};d[m.id]=M}var P=m.children;P&&P.forEach(function(Q){if(!d[Q.id]&&!p[Q.id])return!0;s.push(Q)});var R=d[m.id];if(R.cx=0,R.cy=0,s.length===0){R.empty=!0;var j=g[m.id];R.cx=j.x,R.cy=j.y}return s.forEach(function(Q){if(R.count++,Q.itemType!=="node"){var G=d[Q.id];(0,L.isNumber)(G.cx)&&(R.cx+=G.cx),(0,L.isNumber)(G.cy)&&(R.cy+=G.cy);return}var W=p[Q.id];W&&((0,L.isNumber)(W.x)&&(R.cx+=W.x),(0,L.isNumber)(W.y)&&(R.cy+=W.y))}),R.cx/=R.count||1,R.cy/=R.count||1,R.children=s,!0})}),d},T.prototype.applyComboCenterForce=function(x){var p=this,v=p.gravity,g=p.comboGravity||v,d=this.alpha,c=p.comboTrees,s=p.indexMap,m=p.nodeMap,M=p.comboMap;(c||[]).forEach(function(P){(0,L.traverseTreeUp)(P,function(R){if(R.itemType==="node")return!0;var j=M[R.id];if(!j)return!0;var Q=M[R.id],G=(Q.depth+1)/10*.5,W=Q.cx,H=Q.cy;return Q.cx=0,Q.cy=0,Q.children.forEach(function(Z){if(Z.itemType!=="node"){var J=M[Z.id];J&&(0,L.isNumber)(J.cx)&&(Q.cx+=J.cx),J&&(0,L.isNumber)(J.cy)&&(Q.cy+=J.cy);return}var K=m[Z.id],ne=K.x-W||.005,se=K.y-H||.005,fe=Math.sqrt(ne*ne+se*se),Ie=s[K.id],ye=g*d/fe*G;x[Ie].x-=ne*ye,x[Ie].y-=se*ye,(0,L.isNumber)(K.x)&&(Q.cx+=K.x),(0,L.isNumber)(K.y)&&(Q.cy+=K.y)}),Q.cx/=Q.count||1,Q.cy/=Q.count||1,!0})})},T.prototype.applyCalculate=function(x){var p=this,v=p.comboMap,g=p.nodes,d={};g.forEach(function(s,m){g.forEach(function(M,P){if(!(mJ&&(R.minX=J),R.minY>K&&(R.minY=K),R.maxX1&&M.forEach(function(P,R){if(P.itemType==="node")return!1;var j=p[P.id];j&&M.forEach(function(Q,G){if(R<=G||Q.itemType==="node")return!1;var W=p[Q.id];if(!W)return!1;var H=j.cx-W.cx||.005,Z=j.cy-W.cy||.005,J=H*H+Z*Z,K=j.r||1,ne=W.r||1,se=K+ne,fe=ne*ne,Ie=K*K;if(Jd)){var Ae=p["".concat(G.id,"-").concat(ne.id)],Se=Ae.vx,we=Ae.vy,Te=Math.log(Math.abs(ne.depth-G.depth)/10)+1||1;Te=Te<1?1:Te,ne.comboId!==G.comboId&&(Te+=1);var ke=Te?Math.pow(j,Te):1,Ge=c(ne)*s/Ie*ke;if(x[W].x+=Se*Ge,x[W].y+=we*Ge,W0){var ke=Math.abs(Z[0][v.sortBy]-Te[v.sortBy]);v.maxLevelDiff&&ke>=v.maxLevelDiff&&(Z=[],H.push(Z))}Z.push(Te)});var J=R+(j||v.minNodeSpacing);if(!v.preventOverlap){var K=H.length>0&&H[0].length>1,ne=Math.min(v.width,v.height)/2-J,se=ne/(H.length+(K?1:0));J=Math.min(J,se)}var fe=0;if(H.forEach(function(Te){var ke=v.sweep;ke===void 0&&(ke=2*Math.PI-2*Math.PI/Te.length);var Ge=Te.dTheta=ke/Math.max(1,Te.length-1);if(Te.length>1&&v.preventOverlap){var tt=Math.cos(Ge)-Math.cos(0),He=Math.sin(Ge)-Math.sin(0),ft=Math.sqrt(J*J/(tt*tt+He*He));fe=Math.max(ft,fe)}Te.r=fe,fe+=J}),v.equidistant){for(var Ie=0,ye=0,Ae=0;Aezt.x&&(Lt=zt.x),Jt>zt.y&&(Jt=zt.y)}),fe.edges().forEach(function(Rt){var zt,Vt=fe.edge(Rt);(zt=Vt.points)===null||zt===void 0||zt.forEach(function(hr){Lt>hr.x&&(Lt=hr.x),Jt>hr.y&&(Jt=hr.y)})}),ft[0]=W[0]-Lt,ft[1]=W[1]-Jt}var Qe=Q==="LR"||Q==="RL";if(H){var ut=this,xt=ut.focusNode,dt=ut.ranksep,pt=ut.getRadialPos,wt=(0,_.isString)(xt)?xt:xt==null?void 0:xt.id,mt=wt?(M=fe.node(wt))===null||M===void 0?void 0:M._rank:0,ur=[],Ir=Qe?"y":"x",Nr=Qe?"height":"width",Hr=1/0,It=-1/0;fe.nodes().forEach(function(Rt){var zt=fe.node(Rt);if(P.nodeMap[Rt]){var Vt=Te(P.nodeMap[Rt]);if(mt===0)ur[zt._rank]||(ur[zt._rank]={nodes:[],totalWidth:0,maxSize:-1/0}),ur[zt._rank].nodes.push(Rt),ur[zt._rank].totalWidth+=Vt*2+zt[Nr],ur[zt._rank].maxSizeIt&&(It=Fr)}});var qt=dt||50,ar={},Oe=(It-Hr)/.9,Pr=[(Hr+It-Oe)*.5,(Hr+It+Oe)*.5],Cr=function(Rt,zt,Vt,hr){Vt===void 0&&(Vt=-1/0),hr===void 0&&(hr=[0,1]);var Ar=Vt;return Rt.forEach(function(en){var Fr=fe.node(en);ar[en]=zt;var Cn=pt(Fr[Ir],Pr,Oe,zt,hr),Sn=Cn.x,oa=Cn.y;if(P.nodeMap[en]){P.nodeMap[en].x=Sn+ft[0],P.nodeMap[en].y=oa+ft[1],P.nodeMap[en]._order=Fr._order;var jr=we(P.nodeMap[en]);Ar=Ar})}:function(Rt,zt,Vt){var hr=Math.max(zt.x,Vt.x),Ar=Math.min(zt.x,Vt.x);return Rt.filter(function(en){return en.x<=hr&&en.x>=Ar})};fe.edges().forEach(function(Rt){var zt,Vt=fe.edge(Rt),hr=se.findIndex(function(Fr){var Cn=(0,_.getEdgeTerminal)(Fr,"source"),Sn=(0,_.getEdgeTerminal)(Fr,"target");return Cn===Rt.v&&Sn===Rt.w});if(!(hr<=-1)&&P.edgeLabelSpace&&P.controlPoints&&se[hr].type!=="loop"){(zt=Vt==null?void 0:Vt.points)===null||zt===void 0||zt.forEach(function(Fr){Fr.x+=ft[0],Fr.y+=ft[1]});var Ar=P.nodeMap[Rt.v],en=P.nodeMap[Rt.w];se[hr].controlPoints=p(Vt==null?void 0:Vt.points,Ar,en,Rn,Qe,yn,zr)}})}return P.onLayoutEnd&&P.onLayoutEnd(),{nodes:R,edges:se}}},g.prototype.getRadialPos=function(d,c,s,m,M){M===void 0&&(M=[0,1]);var P=(d-c[0])/s;P=P*(M[1]-M[0])+M[0];var R=P*2*Math.PI;return{x:Math.cos(R)*m,y:Math.sin(R)*m}},g.prototype.getType=function(){return"dagre"},g}(I.Base);N.DagreLayout=x;var p=function(v,g,d,c,s,m,M){var P=(v==null?void 0:v.slice(1,v.length-1))||[];if(g&&d){var R=g.x,j=g.y,Q=d.x,G=d.y;if(s&&(R=g.y,j=g.x,Q=d.y,G=d.x),G!==j&&R!==Q){var W=c.indexOf(j),H=c[W+1];if(H){var Z=P[0],J=s?{x:(j+H)/2,y:(Z==null?void 0:Z.y)||Q}:{x:(Z==null?void 0:Z.x)||Q,y:(j+H)/2};(!Z||m(Z,J))&&P.unshift(J)}var K=c.indexOf(G),ne=Math.abs(K-W);if(ne===1)P=M(P,g,d),P.length||P.push(s?{x:(j+G)/2,y:R}:{x:R,y:(j+G)/2});else if(ne>1){var se=c[K-1];if(se){var fe=P[P.length-1],Ie=s?{x:(G+se)/2,y:(fe==null?void 0:fe.y)||Q}:{x:(fe==null?void 0:fe.x)||R,y:(G+se)/2};(!fe||m(fe,Ie))&&P.push(Ie)}}}}return P}},19268:function(Mt,N,F){"use strict";var k=this&&this.__extends||function(){var p=function(v,g){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,c){d.__proto__=c}||function(d,c){for(var s in c)Object.prototype.hasOwnProperty.call(c,s)&&(d[s]=c[s])},p(v,g)};return function(v,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");p(v,g);function d(){this.constructor=v}v.prototype=g===null?Object.create(g):(d.prototype=g.prototype,new d)}}(),U=this&&this.__assign||function(){return U=Object.assign||function(p){for(var v,g=1,d=arguments.length;gR.x&&(M=R.x),P>R.y&&(P=R.y)}),d.forEach(function(R){R.points.forEach(function(j){M>j.x&&(M=j.x),P>j.y&&(P=j.y)})}),m[0]=s[0]-M,m[1]=s[1]-P}return m},v.prototype.updateNodePosition=function(g,d){var c=this,s=c.combos,m=c.nodes,M=c.edges,P=c.anchorPoint,R=c.graphSettings,j=this.getBegin(g,d);g.forEach(function(Q){var G,W=Q.x,H=Q.y,Z=Q.id,J=Q.type,K=Q.coreBox;if(J===I.HierarchyNodeType.META&&Z!==I.ROOT_NAME){var ne=s.findIndex(function(Ae){return Ae.id===Z}),se=(G=R==null?void 0:R.subScene)===null||G===void 0?void 0:G.meta;s[ne].offsetX=W+j[0],s[ne].offsetY=H+j[1],s[ne].fixSize=[K.width,K.height],s[ne].fixCollapseSize=[K.width,K.height],Q.expanded?s[ne].padding=[se==null?void 0:se.paddingTop,se==null?void 0:se.paddingRight,se==null?void 0:se.paddingBottom,se==null?void 0:se.paddingLeft]:s[ne].padding=[0,0,0,0]}else if(J===I.HierarchyNodeType.OP){var ne=m.findIndex(function(Se){return Se.id===Z});if(m[ne].x=W+j[0],m[ne].y=H+j[1],P){var fe=[],Ie=d.filter(function(Se){return Se.v===Z}),ye=d.filter(function(Se){return Se.w===Z});Ie.length>0&&Ie.forEach(function(Se){var we=Se.points[0],Te=(we.x-W)/Q.width+.5,ke=(we.y-H)/Q.height+.5;fe.push([Te,ke]),Se.baseEdgeList.forEach(function(Ge){var tt=M.find(function(He){return He.source===Ge.v&&He.target===Ge.w});tt&&(tt.sourceAnchor=fe.length-1)})}),ye.length>0&&ye.forEach(function(Se){var we=Se.points[Se.points.length-1],Te=(we.x-W)/Q.width+.5,ke=(we.y-H)/Q.height+.5;fe.push([Te,ke]),Se.baseEdgeList.forEach(function(Ge){var tt=M.find(function(He){return He.source===Ge.v&&He.target===Ge.w});tt&&(tt.targetAnchor=fe.length-1)})}),m[ne].anchorPoints=fe.length>0?fe:m[ne].anchorPoints||[]}}})},v.prototype.updateEdgePosition=function(g,d){var c=this,s=c.combos,m=c.edges,M=c.controlPoints,P=this.getBegin(g,d);M&&(s.forEach(function(R){R.inEdges=[],R.outEdges=[]}),m.forEach(function(R){var j,Q,G,W,H=g.find(function(Ae){return Ae.id===R.source}),Z=g.find(function(Ae){return Ae.id===R.target}),J=[],K=[];if(H&&Z)K=(0,I.getEdges)(H==null?void 0:H.id,Z==null?void 0:Z.id,g);else if(!H||!Z){var ne=c.getNodePath(R.source),se=c.getNodePath(R.target),fe=ne.reverse().slice(H?0:1).find(function(Ae){return g.find(function(Se){return Se.id===Ae})}),Ie=se.reverse().slice(Z?0:1).find(function(Ae){return g.find(function(Se){return Se.id===Ae})});H=g.find(function(Ae){return Ae.id===fe}),Z=g.find(function(Ae){return Ae.id===Ie}),K=(0,I.getEdges)(H==null?void 0:H.id,Z==null?void 0:Z.id,g,{v:R.source,w:R.target})}if(J=K.reduce(function(Ae,Se){return L(L([],Ae,!0),Se.points.map(function(we){return U(U({},we),{x:we.x+P[0],y:we.y+P[1]})}),!0)},[]),J=J.slice(1,-1),R.controlPoints=J,(Z==null?void 0:Z.type)===I.NodeType.META){var ye=s.findIndex(function(Ae){return Ae.id===(Z==null?void 0:Z.id)});if(!s[ye]||!((j=s[ye].inEdges)===null||j===void 0)&&j.some(function(Ae){return Ae.source===H.id&&Ae.target===Z.id}))return;(Q=s[ye].inEdges)===null||Q===void 0||Q.push({source:H.id,target:Z.id,controlPoints:J})}if((H==null?void 0:H.type)===I.NodeType.META){var ye=s.findIndex(function(Se){return Se.id===(H==null?void 0:H.id)});if(!s[ye]||!((G=s[ye].outEdges)===null||G===void 0)&&G.some(function(Se){return Se.source===H.id&&Se.target===Z.id}))return;(W=s[ye].outEdges)===null||W===void 0||W.push({source:H.id,target:Z.id,controlPoints:J})}}))},v.prototype.getType=function(){return"dagreCompound"},v.prototype.getDataByOrder=function(g){return g.every(function(d){return d.layoutOrder!==void 0})||g.forEach(function(d,c){d.layoutOrder=c}),g.sort(function(d,c){return d.layoutOrder-c.layoutOrder})},v}(_.Base);N.DagreCompoundLayout=x},61283:function(Mt,N,F){"use strict";var k=this&&this.__extends||function(){var _=function(I,T){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,p){x.__proto__=p}||function(x,p){for(var v in p)Object.prototype.hasOwnProperty.call(p,v)&&(x[v]=p[v])},_(I,T)};return function(I,T){if(typeof T!="function"&&T!==null)throw new TypeError("Class extends value "+String(T)+" is not a constructor or null");_(I,T);function x(){this.constructor=I}I.prototype=T===null?Object.create(T):(x.prototype=T.prototype,new x)}}();Object.defineProperty(N,"__esModule",{value:!0}),N.Graph=void 0;var U=F(12130),L=function(_){k(I,_);function I(){return _!==null&&_.apply(this,arguments)||this}return I}(U.Graph);N.Graph=L},57007:function(Mt,N,F){"use strict";var k=this&&this.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(N,"__esModule",{value:!0});var U=k(F(21277)),L=F(96744);N.default={layout:U.default,util:{time:L.time,notime:L.notime}}},57157:function(Mt,N,F){"use strict";var k=this&&this.__importDefault||function(T){return T&&T.__esModule?T:{default:T}};Object.defineProperty(N,"__esModule",{value:!0});var U=k(F(3221)),L=function(T){var x=function(v){return function(g){var d;return((d=v.edge(g))===null||d===void 0?void 0:d.weight)||1}},p=T.graph().acyclicer==="greedy"?(0,U.default)(T,x(T)):_(T);p==null||p.forEach(function(v){var g=T.edge(v);T.removeEdgeObj(v),g.forwardName=v.name,g.reversed=!0,T.setEdge(v.w,v.v,g,"rev-".concat(Math.random()))})},_=function(T){var x=[],p={},v={},g=function(d){var c;v[d]||(v[d]=!0,p[d]=!0,(c=T.outEdges(d))===null||c===void 0||c.forEach(function(s){p[s.w]?x.push(s):g(s.w)}),delete p[d])};return T.nodes().forEach(g),x},I=function(T){T.edges().forEach(function(x){var p=T.edge(x);if(p.reversed){T.removeEdgeObj(x);var v=p.forwardName;delete p.reversed,delete p.forwardName,T.setEdge(x.w,x.v,p,v)}})};N.default={run:L,undo:I}},14600:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0});var k=F(96744),U=function(_){var I,T=function(x){var p=_.children(x),v=_.node(x);if(p!=null&&p.length&&p.forEach(function(c){return T(c)}),v.hasOwnProperty("minRank")){v.borderLeft=[],v.borderRight=[];for(var g=v.minRank,d=v.maxRank+1;g0;--G)if(Q=m[G].dequeue(),Q){P=P.concat(g(s,m,M,Q,!0));break}}}return P},g=function(s,m,M,P,R){var j,Q,G=[];return(j=s.inEdges(P.v))===null||j===void 0||j.forEach(function(W){var H=s.edge(W),Z=s.node(W.v);R&&G.push({v:W.v,w:W.w,in:0,out:0}),Z.out===void 0&&(Z.out=0),Z.out-=H,c(m,M,Z)}),(Q=s.outEdges(P.v))===null||Q===void 0||Q.forEach(function(W){var H=s.edge(W),Z=W.w,J=s.node(Z);J.in===void 0&&(J.in=0),J.in-=H,c(m,M,J)}),s.removeNode(P.v),R?G:void 0},d=function(s,m){var M=new T,P=0,R=0;s.nodes().forEach(function(H){M.setNode(H,{v:H,in:0,out:0})}),s.edges().forEach(function(H){var Z=M.edge(H)||0,J=(m==null?void 0:m(H))||1,K=Z+J;M.setEdge(H.v,H.w,K),R=Math.max(R,M.node(H.v).out+=J),P=Math.max(P,M.node(H.w).in+=J)});for(var j=[],Q=R+P+3,G=0;G0;)M%2&&(P+=c[M+1]),M=M-1>>1,c[M]+=m.weight;s+=m.weight*P}}),s},L=function(_,I){for(var T=0,x=1;x<(I==null?void 0:I.length);x+=1)T+=U(_,I[x-1],I[x]);return T};N.default=L},93256:function(Mt,N,F){"use strict";var k=this&&this.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(N,"__esModule",{value:!0});var U=k(F(78583)),L=k(F(51576)),_=k(F(53512)),I=k(F(66431)),T=k(F(63776)),x=F(44941),p=F(61283),v=F(96744),g=function(m,M){for(var P=(0,v.maxRank)(m),R=[],j=[],Q=1;Q-1;Q--)j.push(Q);var G=d(m,R,"inEdges"),W=d(m,j,"outEdges"),H=(0,U.default)(m);s(m,H);for(var Z=Number.POSITIVE_INFINITY,J,Q=0,K=0;K<4;++Q,++K){c(Q%2?G:W,Q%4>=2,!1,M),H=(0,v.buildLayerMatrix)(m);var ne=(0,L.default)(m,H);ne=2,!0,M),H=(0,v.buildLayerMatrix)(m);var ne=(0,L.default)(m,H);ne=c.barycenter)&&U(c,s)}},p=function(c){return function(s){s.in.push(c),--s.indegree===0&&L.push(s)}},v=function(){var c=L.pop();T.push(c),(_=c.in.reverse())===null||_===void 0||_.forEach(function(s){return x(c)(s)}),(I=c.out)===null||I===void 0||I.forEach(function(s){return p(c)(s)})};L!=null&&L.length;)v();var g=T.filter(function(c){return!c.merged}),d=["vs","i","barycenter","weight"];return g.map(function(c){var s={};return d==null||d.forEach(function(m){c[m]!==void 0&&(s[m]=c[m])}),s})},U=function(L,_){var I,T=0,x=0;L.weight&&(T+=L.barycenter*L.weight,x+=L.weight),_.weight&&(T+=_.barycenter*_.weight,x+=_.weight),L.vs=(I=_.vs)===null||I===void 0?void 0:I.concat(L.vs),L.barycenter=T/x,L.weight=x,L.i=Math.min(_.i,L.i),_.merged=!0};N.default=F},63776:function(Mt,N,F){"use strict";var k=this&&this.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(N,"__esModule",{value:!0});var U=k(F(82580)),L=k(F(11059)),_=k(F(59832)),I=function(p,v,g,d,c,s){var m,M,P,R,j=p.children(v),Q=p.node(v),G=Q?Q.borderLeft:void 0,W=Q?Q.borderRight:void 0,H={};G&&(j=j==null?void 0:j.filter(function(fe){return fe!==G&&fe!==W}));var Z=(0,U.default)(p,j||[]);Z==null||Z.forEach(function(fe){var Ie;if(!((Ie=p.children(fe.v))===null||Ie===void 0)&&Ie.length){var ye=I(p,fe.v,g,d,s);H[fe.v]=ye,ye.hasOwnProperty("barycenter")&&x(fe,ye)}});var J=(0,L.default)(Z,g);T(J,H),(m=J.filter(function(fe){return fe.vs.length>0}))===null||m===void 0||m.forEach(function(fe){var Ie=p.node(fe.vs[0]);Ie&&(fe.fixorder=Ie.fixorder,fe.order=Ie.order)});var K=(0,_.default)(J,d,c,s);if(G&&(K.vs=[G,K.vs,W].flat(),!((M=p.predecessors(G))===null||M===void 0)&&M.length)){var ne=p.node(((P=p.predecessors(G))===null||P===void 0?void 0:P[0])||""),se=p.node(((R=p.predecessors(W))===null||R===void 0?void 0:R[0])||"");K.hasOwnProperty("barycenter")||(K.barycenter=0,K.weight=0),K.barycenter=(K.barycenter*K.weight+ne.order+se.order)/(K.weight+2),K.weight+=2}return K},T=function(p,v){p==null||p.forEach(function(g){var d,c=(d=g.vs)===null||d===void 0?void 0:d.map(function(s){return v[s]?v[s].vs:s});g.vs=c.flat()})},x=function(p,v){p.barycenter!==void 0?(p.barycenter=(p.barycenter*p.weight+v.barycenter*v.weight)/(p.weight+v.weight),p.weight+=v.weight):(p.barycenter=v.barycenter,p.weight=v.weight)};N.default=I},59832:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0});var k=F(96744),U=function(I,T,x,p){var v=(0,k.partition)(I,function(R){var j=R.hasOwnProperty("fixorder")&&!isNaN(R.fixorder);return p?!j&&R.hasOwnProperty("barycenter"):j||R.hasOwnProperty("barycenter")}),g=v.lhs,d=v.rhs.sort(function(R,j){return-R.i- -j.i}),c=[],s=0,m=0,M=0;g==null||g.sort(_(!!T,!!x)),M=L(c,d,M),g==null||g.forEach(function(R){var j;M+=(j=R.vs)===null||j===void 0?void 0:j.length,c.push(R.vs),s+=R.barycenter*R.weight,m+=R.weight,M=L(c,d,M)});var P={vs:c.flat()};return m&&(P.barycenter=s/m,P.weight=m),P},L=function(I,T,x){for(var p=x,v;T.length&&(v=T[T.length-1]).i<=p;)T.pop(),I==null||I.push(v.vs),p++;return p},_=function(I,T){return function(x,p){if(x.fixorder!==void 0&&p.fixorder!==void 0)return x.fixorder-p.fixorder;if(x.barycenterp.barycenter)return 1;if(T&&x.order!==void 0&&p.order!==void 0){if(x.orderp.order)return 1}return I?p.i-x.i:x.i-p.i}};N.default=U},38481:function(Mt,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0});var F=function(L){var _,I={},T=0,x=function(p){var v,g=T;(v=L.children(p))===null||v===void 0||v.forEach(x),I[p]={low:g,lim:T++}};return(_=L.children())===null||_===void 0||_.forEach(x),I},k=function(L,_,I,T){var x=[],p=[],v=Math.min(_[I].low,_[T].low),g=Math.max(_[I].lim,_[T].lim),d,c;d=I;do d=L.parent(d),x.push(d);while(d&&(_[d].low>v||g>_[d].lim));for(c=d,d=T;d&&d!==c;)p.push(d),d=L.parent(d);return{lca:c,path:x.concat(p.reverse())}},U=function(L){var _,I=F(L);(_=L.graph().dummyChains)===null||_===void 0||_.forEach(function(T){var x,p,v=T,g=L.node(v),d=g.edgeObj;if(d)for(var c=k(L,I,d.v,d.w),s=c.path,m=c.lca,M=0,P=s[M],R=!0;v!==d.w;){if(g=L.node(v),R){for(;P!==m&&((x=L.node(P))===null||x===void 0?void 0:x.maxRank)Ae)&&(0,N.addConflict)(H,Ge,Te)}))}function J(se){return JSON.stringify(se.slice(1))}function K(se,fe){var Ie=J(se);fe.get(Ie)||(Z.apply(void 0,se),fe.set(Ie,!0))}var ne=function(se,fe){var Ie=-1,ye,Ae=0,Se=new Map;return fe==null||fe.forEach(function(we,Te){var ke;if(((ke=G.node(we))===null||ke===void 0?void 0:ke.dummy)==="border"){var Ge=G.predecessors(we)||[];Ge.length&&(ye=G.node(Ge[0]).order,K([fe,Ae,Te,Ie,ye],Se),Ae=Te,Ie=ye)}K([fe,Ae,fe.length,ye,se.length],Se)}),fe};return W!=null&&W.length&&W.reduce(ne),H};N.findType2Conflicts=x;var p=function(G,W){var H,Z;if(!((H=G.node(W))===null||H===void 0)&&H.dummy)return(Z=G.predecessors(W))===null||Z===void 0?void 0:Z.find(function(J){return G.node(J).dummy})};N.findOtherInnerSegmentNode=p;var v=function(G,W,H){var Z=W,J=H;if(Z>J){var K=Z;Z=J,J=K}var ne=G[Z];ne||(G[Z]=ne={}),ne[J]=!0};N.addConflict=v;var g=function(G,W,H){var Z=W,J=H;if(Z>J){var K=W;Z=J,J=K}return!!G[Z]};N.hasConflict=g;var d=function(G,W,H,Z){var J={},K={},ne={};return W==null||W.forEach(function(se){se==null||se.forEach(function(fe,Ie){J[fe]=fe,K[fe]=fe,ne[fe]=Ie})}),W==null||W.forEach(function(se){var fe=-1;se==null||se.forEach(function(Ie){var ye=Z(Ie);if(ye.length){ye=ye.sort(function(ke,Ge){return ne[ke]-ne[Ge]});for(var Ae=(ye.length-1)/2,Se=Math.floor(Ae),we=Math.ceil(Ae);Se<=we;++Se){var Te=ye[Se];K[Ie]===Ie&&feK.lim&&(ne=K,se=!0);var fe=G.edges().filter(function(Ie){return se===j(Q,Q.node(Ie.v),ne)&&se!==j(Q,Q.node(Ie.w),ne)});return(0,L.minBy)(fe,function(Ie){return(0,U.slack)(G,Ie)})};N.enterEdge=m;var M=function(Q,G,W,H){var Z=W.v,J=W.w;Q.removeEdge(Z,J),Q.setEdge(H.v,H.w,{}),(0,N.initLowLimValues)(Q),(0,N.initCutValues)(Q,G),P(Q,G)};N.exchangeEdges=M;var P=function(Q,G){var W=Q.nodes().find(function(Z){var J;return!(!((J=G.node(Z))===null||J===void 0)&&J.parent)}),H=I(Q,W);H=H==null?void 0:H.slice(1),H==null||H.forEach(function(Z){var J=Q.node(Z).parent,K=G.edgeFromArgs(Z,J),ne=!1;K||(K=G.edgeFromArgs(J,Z),ne=!0),G.node(Z).rank=G.node(J).rank+(ne?K.minlen:-K.minlen)})},R=function(Q,G,W){return Q.hasEdge(G,W)},j=function(Q,G,W){return W.low<=G.lim&&G.lim<=W.lim};N.default=x},78433:function(Mt,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.slack=N.longestPathWithLayer=N.longestPath=void 0;var F=function(L){var _,I={},T=function(x){var p,v=L.node(x);if(!v)return 0;if(I[x])return v.rank;I[x]=!0;var g;return(p=L.outEdges(x))===null||p===void 0||p.forEach(function(d){var c=T(d.w),s=L.edge(d).minlen,m=c-s;m&&(g===void 0||mMath.abs(J)*se?(K<0&&(se=-se),fe=se*J/K,Ie=se):(J<0&&(ne=-ne),fe=ne,Ie=ne*K/J),{x:H+fe,y:Z+Ie}};N.intersectRect=g;var d=function(G){for(var W=[],H=(0,N.maxRank)(G)+1,Z=0;ZW)&&(W=J)}),W||(W=0),W};N.maxRank=M;var P=function(G,W){var H={lhs:[],rhs:[]};return G==null||G.forEach(function(Z){W(Z)?H.lhs.push(Z):H.rhs.push(Z)}),H};N.partition=P;var R=function(G,W){var H=Date.now();try{return W()}finally{console.log("".concat(G," time: ").concat(Date.now()-H,"ms"))}};N.time=R;var j=function(G,W){return W()};N.notime=j;var Q=function(G,W){return G.reduce(function(H,Z){var J=W(H),K=W(Z);return J>K?Z:H})};N.minBy=Q},77620:function(Mt,N,F){"use strict";var k=this&&this.__assign||function(){return k=Object.assign||function(d){for(var c,s=1,m=arguments.length;s1){var se=k({},K);delete se.size,R.push(se)}});var j=[];m.forEach(function(K){var ne=R.find(function(fe){return fe.id===K.source}),se=R.find(function(fe){return fe.id===K.target});ne&&se&&j.push(K)});var Q=new v.DagreLayout({type:"dagre",ranksep:c.nodeMinGap,nodesep:c.nodeMinGap}),G=Q.layout({nodes:R,edges:j}).nodes;s.forEach(function(K){var ne=(G||[]).find(function(se){return se.id===K.id});K.x=(ne==null?void 0:ne.x)||M/2,K.y=(ne==null?void 0:ne.y)||P/2});var W=JSON.parse(JSON.stringify(s)),H=JSON.parse(JSON.stringify(m)),Z=T.forceSimulation().nodes(W).force("link",T.forceLink(H).id(function(K){return K.id}).distance(function(K){var ne=j.find(function(se){return se.source===K.source&&se.target===K.target});return ne?30:20})).force("charge",T.forceManyBody()).force("center",T.forceCenter(M/2,P/2)).force("x",T.forceX(M/2)).force("y",T.forceY(P/2)).alpha(.3).alphaDecay(.08).alphaMin(.001),J=new Promise(function(K){Z.on("end",function(){s.forEach(function(Se){var we=W.find(function(Te){return Te.id===Se.id});we&&(Se.x=we.x,Se.y=we.y)});var ne=Math.min.apply(Math,s.map(function(Se){return Se.x})),se=Math.max.apply(Math,s.map(function(Se){return Se.x})),fe=Math.min.apply(Math,s.map(function(Se){return Se.y})),Ie=Math.max.apply(Math,s.map(function(Se){return Se.y})),ye=M/(se-ne),Ae=P/(Ie-fe);s.forEach(function(Se){Se.x!==void 0&&ye<1&&(Se.x=(Se.x-ne)*ye),Se.y!==void 0&&Ae<1&&(Se.y=(Se.y-fe)*Ae)}),s.forEach(function(Se){Se.sizeTemp=Se.size,Se.size=[10,10]}),(0,p.default)(s,m),s.forEach(function(Se){Se.size=Se.sizeTemp||[],delete Se.sizeTemp}),(0,x.default)({nodes:s,edges:m},c),K()})});return J}N.default=g},78755:function(Mt,N,F){"use strict";var k=this&&this.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(N,"__esModule",{value:!0});var U=k(F(11761));function L(_,I){if(!_.nodes||_.nodes.length===0)return _;var T=I.width,x=I.height,p=I.nodeMinGap,v=1e4,g=1e4;_.nodes.forEach(function(H){var Z=H.size[0]||50,J=H.size[1]||50;v=Math.min(Z,v),g=Math.min(J,g)});var d=new U.default;d.init(T,x,{CELL_H:g,CELL_W:v}),_.nodes.forEach(function(H){var Z=d.occupyNearest(H);Z&&(Z.node={id:H.id,size:H.size},H.x=Z.x,H.y=Z.y,H.dx=Z.dx,H.dy=Z.dy)});for(var c=0;c<_.nodes.length;c++){var s=_.nodes[c],m=d.findGridByNodeId(s.id);if(!m)throw new Error("can not find node cell");var M=m.column,P=m.row;if(s.size[0]+p>v){for(var R=Math.ceil((s.size[0]+p)/v)-1,j=R,Q=0;Q-1;if(G&&!d.cells[M+Q+1][P].node)j--;else break}d.insertColumn(M,j)}if(s.size[1]+p>g){for(var R=Math.ceil((s.size[1]+p)/g)-1,j=R,Q=0;Q-1;if(G&&!d.cells[M][P+Q+1].node)j--;else break}d.insertRow(P,j)}}for(var c=0;cL;I--)for(var T=0;T=L&&(this.additionColumn[T]+=_);for(var I=0;I<_;I++)this.additionColumn.push(L+I+1);this.columnNum+=_}},U.prototype.insertRow=function(L,_){if(!(_<=0)){for(var I=0;I<_;I++)for(var T=0;TL;I--)this.cells[T][I+_]=F(F({},this.cells[T][I]),{dx:T,dy:I+_,x:T*this.CELL_W,y:(I+_)*this.CELL_H}),this.cells[T][I]={dx:T,dy:I,x:T*this.CELL_W,y:I*this.CELL_H,occupied:!1,node:null};for(var I=0;I=L&&(this.additionRow[I]+=_);for(var T=0;T<_;T++)this.additionRow.push(L+T+1);this.rowNum+=_}},U.prototype.getNodes=function(){for(var L=[],_=0;_I?(ft=K-Ae,He=fe-ne,Lt=parseFloat(ft?(ft/Math.cos(tt)).toFixed(2):He.toFixed(2)),Jt=parseFloat(He?(He/Math.sin(tt)).toFixed(2):ft.toFixed(2))):0He?Lt=Jt=parseFloat(ft?(ft/Math.cos(tt)).toFixed(2):He.toFixed(2)):Lt=Jt=parseFloat(He?(He/Math.sin(tt)).toFixed(2):ft.toFixed(2))):tt<-I?(ft=K-Ae,He=-(ye-J),ft>He?Lt=Jt=parseFloat(ft?(ft/Math.cos(tt)).toFixed(2):He.toFixed(2)):Lt=Jt=parseFloat(He?(He/Math.sin(tt)).toFixed(2):ft.toFixed(2))):(ft=Ie-se,Math.abs(Ge)>(ne-J)/2?He=J-ye:He=Ge,ft>He?Lt=Jt=parseFloat(ft?(ft/Math.cos(tt)).toFixed(2):He.toFixed(2)):Lt=Jt=parseFloat(He&&tt!==0?(He/Math.sin(tt)).toFixed(2):ft.toFixed(2)));var Qe=parseFloat(tt.toFixed(2)),ut=Z;return Z&&(ut=Tne?H:W,fe=K>ne?W:H,Ie=se.x-se.size[0]/2,ye=se.y-se.size[1]/2,Ae=se.x+se.size[0]/2,Se=se.y+se.size[1]/2,we=fe.x-fe.size[0]/2,Te=fe.y-fe.size[1]/2,ke=fe.x+fe.size[0]/2,Ge=fe.y+fe.size[1]/2,tt=se.x,He=se.y,ft=fe.x,Lt=fe.y,Jt=Ae>=we&&ke>=Ie&&Se>=Te&&Ge>=ye,Qe=0,ut=0;if(Jt){ut=Math.sqrt(Math.pow(ft-tt,2)+Math.pow(Lt-He,2));var xt=Ie>we?Ie:we,dt=ye>Te?ye:Te,pt=AeF||J.y>k)&&(H+=1e12);for(var K=Z+1;K150,Te=Se<30||Se>150,ke=Ae>70&&Ae<110,Ge=Se>70&&Se<110;if(we&&!Te||Ae*Se<0){fe=!1;break}else if(ke&&!Ge||Ae*Se<0){fe=!1;break}else if((ye.x-W.x)*(ye.x-H.x)<0){fe=!1;break}else if((ye.y-W.y)*(ye.y-H.y)<0){fe=!1;break}}return fe}function j(W,H){for(var Z=!1,J=1,K=v*J,ne=g*J,se=[K,-K,0,0],fe=[0,0,ne,-ne],Ie=0;Iec?(Ae=Te,Z=!0):(ye.x-=se[Se],ye.y-=fe[Se])}}return d>c&&(d*=s),Z?P(W):0}function Q(W,H){var Z=0;(W.x<0||W.y<0||W.x+W.size[0]+20>F||W.y+W.size[1]+20>k)&&(Z+=1e12);for(var J=0;J0&&(fe++,!(fe>=se));){var Ie=j(W,H);Ie!==0&&(ne=Ie),K=ne-Z,Z=ne,K===0?--J:J=20}return W.forEach(function(ye){ye.x=ye.x-ye.size[0]/2,ye.y=ye.y-ye.size[1]/2}),{nodes:W,edges:H}}N.default=G},45515:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.forceNBody=void 0;var k=F(80789),U=.81,L=.1;function _(p,v,g,d,c){var s=g/d,m=p.map(function(P,R){var j=v[P.id],Q=j.data,G=j.x,W=j.y,H=j.size,Z=Q.layout.force.nodeStrength;return{x:G,y:W,size:H,index:R,vx:0,vy:0,weight:s*Z}}),M=(0,k.quadtree)(m,function(P){return P.x},function(P){return P.y}).visitAfter(I);return m.forEach(function(P){x(P,M)}),m.map(function(P,R){var j=v[p[R].id],Q=j.data.layout.force.mass,G=Q===void 0?1:Q;c[2*R]=P.vx/G,c[2*R+1]=P.vy/G}),c}N.forceNBody=_;function I(p){var v=0,g=0,d=0;if(p.length){for(var c=0;c<4;c++){var s=p[c];s&&s.weight&&(v+=s.weight,g+=s.x*s.weight,d+=s.y*s.weight)}p.x=g/v,p.y=d/v,p.weight=v}else{var s=p;p.x=s.data.x,p.y=s.data.y,p.weight=s.data.weight}}var T=function(p,v,g,d,c,s){var m=s.x-p.x||L,M=s.y-p.y||L,P=d-v,R=m*m+M*M,j=Math.sqrt(R)*R;if(P*P*U1&&(Se=(0,_.getAvgNodePosition)(Te))}else Se=void 0;return{x:Se==null?void 0:Se.x,y:Se==null?void 0:Se.y}}}}if(c){Q||(Q=this.getSameTypeLeafMap());var W=Array.from(new Set(m.map(function(se,fe){return se[s]}))).filter(function(se){return se!==void 0}),H={};W.forEach(function(se){var fe=m.filter(function(Ie){return Ie[s]===se}).map(function(Ie){return M[Ie.id]});H[se]=(0,_.getAvgNodePosition)(fe)}),j={single:function(se){return R(se)},leaf:function(se){return R(se)},others:function(se){return R(se)},center:function(se,fe,Ie){var ye=H[se[s]];return{x:ye==null?void 0:ye.x,y:ye==null?void 0:ye.y}}}}this.centripetalOptions=U(U({},this.centripetalOptions),j);var Z=this.centripetalOptions,J=Z.leaf,K=Z.single,ne=Z.others;J&&typeof J!="function"&&(this.centripetalOptions.leaf=function(){return J}),K&&typeof K!="function"&&(this.centripetalOptions.single=function(){return K}),ne&&typeof ne!="function"&&(this.centripetalOptions.others=function(){return ne})},v.prototype.updateCfg=function(g){g&&Object.assign(this,g)},v.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},v.prototype.execute=function(){var g=this;g.stop();var d=g.nodes,c=g.edges,s=g.defSpringLen;if(g.judgingDistance=0,!d||d.length===0){g.onLayoutEnd([]);return}!g.width&&typeof window!="undefined"&&(g.width=window.innerWidth),!g.height&&typeof window!="undefined"&&(g.height=window.innerHeight),g.center||(g.center=[g.width/2,g.height/2]);var m=g.center;if(d.length===1){d[0].x=m[0],d[0].y=m[1],g.onLayoutEnd([U({},d[0])]);return}g.degreesMap=(0,_.getDegreeMap)(d,c),g.propsGetMass?g.getMass=g.propsGetMass:g.getMass=function(W){var H=1;(0,_.isNumber)(W.mass)&&(H=W.mass);var Z=g.degreesMap[W.id].all;return!Z||Z<5?H:Z*5*H};var M=g.nodeSize,P;if(g.preventOverlap){var R=g.nodeSpacing,j;(0,_.isNumber)(R)?j=function(){return R}:(0,_.isFunction)(R)?j=R:j=function(){return 0},M?(0,_.isArray)(M)?P=function(W){return Math.max(M[0],M[1])+j(W)}:P=function(W){return M+j(W)}:P=function(W){return W.size?(0,_.isArray)(W.size)?Math.max(W.size[0],W.size[1])+j(W):(0,_.isObject)(W.size)?Math.max(W.size.width,W.size.height)+j(W):W.size+j(W):10+j(W)}}g.nodeSize=P,g.linkDistance=T(g.linkDistance,1),g.nodeStrength=T(g.nodeStrength,1),g.edgeStrength=T(g.edgeStrength,1);var Q={},G={};d.forEach(function(W,H){(0,_.isNumber)(W.x)||(W.x=Math.random()*g.width),(0,_.isNumber)(W.y)||(W.y=Math.random()*g.height);var Z=g.degreesMap[W.id];Q[W.id]=U(U({},W),{data:U(U({},W.data),{size:g.nodeSize(W)||30,layout:{inDegree:Z.in,outDegree:Z.out,degree:Z.all,tDegree:Z.in,sDegree:Z.out,force:{mass:g.getMass(W),nodeStrength:g.nodeStrength(W,c)}}})}),G[W.id]=H}),g.nodeMap=Q,g.nodeIdxMap=G,g.edgeInfos=[],c==null||c.forEach(function(W){var H=Q[W.source],Z=Q[W.target];!H||!Z?elf.edgeInfos.push({}):g.edgeInfos.push({edgeStrength:g.edgeStrength(W),linkDistance:s?s(U(U({},W),{source:H,target:Z}),H,Z):g.linkDistance(W,H,Z)||1+(M(H)+M(H)||0)/2})}),this.getCentripetalOptions(),g.onLayoutEnd=g.onLayoutEnd||function(){},g.run()},v.prototype.run=function(){var g=this,d=g.maxIteration,c=g.nodes,s=g.edges,m=g.workerEnabled,M=g.minMovement,P=g.animate,R=g.nodeMap,j=g.height;if(g.currentMinY=0,g.currentMaxY=j,!!c){var Q=[];if(c.forEach(function(ne,se){Q[2*se]=0,Q[2*se+1]=0}),this.defSideCoe&&typeof this.defSideCoe=="function"){var G={};s.forEach(function(ne){var se=ne.source,fe=ne.target;G[se]=G[se]||[],G[se].push(ne),G[fe]=G[fe]||[],G[fe].push(ne)}),this.relatedEdges=G}var W=d,H=!P;if(m||H){for(var Z=0,J=0;(g.judgingDistance>M||J<1)&&J=W||g.judgingDistanceP){var H=P/W;Q=H*Q,G=H*G}d[2*j]=Q,d[2*j+1]=G})},v.prototype.updatePosition=function(g,d){var c=this,s=c.nodes,m=c.distanceThresholdMode,M=c.nodeMap;if(!(s!=null&&s.length)){this.judgingDistance=0;return}var P=0;m==="max"?c.judgingDistance=-1/0:m==="min"&&(c.judgingDistance=1/0);var R=1/0,j=-1/0;s.forEach(function(Q,G){var W=M[Q.id];if((0,_.isNumber)(Q.fx)&&(0,_.isNumber)(Q.fy)){Q.x=Q.fx,Q.y=Q.fy,W.x=Q.x,W.y=Q.y;return}var H=g[2*G]*d,Z=g[2*G+1]*d;Q.x+=H,Q.y+=Z,W.x=Q.x,W.y=Q.y,Q.yj&&(j=Q.y);var J=Math.sqrt(H*H+Z*Z);switch(m){case"max":c.judgingDistanceJ&&(c.judgingDistance=J);break;default:P=P+J;break}}),this.currentMinY=R,this.currentMaxY=j,(!m||m==="mean")&&(c.judgingDistance=P/s.length)},v.prototype.stop=function(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval)},v.prototype.destroy=function(){var g=this;g.stop(),g.tick=null,g.nodes=null,g.edges=null,g.destroyed=!0},v.prototype.getType=function(){return"force2"},v.prototype.getSameTypeLeafMap=function(){var g=this,d=g.nodeClusterBy,c=g.nodes,s=g.edges,m=g.nodeMap,M=g.degreesMap;if(c!=null&&c.length){var P={};return c.forEach(function(R,j){var Q=M[R.id].all;Q===1&&(P[R.id]=(0,_.getCoreNodeAndRelativeLeafNodes)("leaf",R,s,d,M,m))}),P}},v}(L.Base);N.Force2Layout=x},69445:function(Mt,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0});var F=function(){function k(U){this.id=U.id||0,this.rx=U.rx,this.ry=U.ry,this.fx=0,this.fy=0,this.mass=U.mass,this.degree=U.degree,this.g=U.g||0}return k.prototype.distanceTo=function(U){var L=this.rx-U.rx,_=this.ry-U.ry;return Math.hypot(L,_)},k.prototype.setPos=function(U,L){this.rx=U,this.ry=L},k.prototype.resetForce=function(){this.fx=0,this.fy=0},k.prototype.addForce=function(U){var L=U.rx-this.rx,_=U.ry-this.ry,I=Math.hypot(L,_);I=I<1e-4?1e-4:I;var T=this.g*(this.degree+1)*(U.degree+1)/I;this.fx+=T*L/I,this.fy+=T*_/I},k.prototype.in=function(U){return U.contains(this.rx,this.ry)},k.prototype.add=function(U){var L=this.mass+U.mass,_=(this.rx*this.mass+U.rx*U.mass)/L,I=(this.ry*this.mass+U.ry*U.mass)/L,T=this.degree+U.degree,x={rx:_,ry:I,mass:L,degree:T};return new k(x)},k}();N.default=F},54255:function(Mt,N,F){"use strict";var k=this&&this.__extends||function(){var v=function(g,d){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,s){c.__proto__=s}||function(c,s){for(var m in s)Object.prototype.hasOwnProperty.call(s,m)&&(c[m]=s[m])},v(g,d)};return function(g,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");v(g,d);function c(){this.constructor=g}g.prototype=d===null?Object.create(d):(c.prototype=d.prototype,new c)}}(),U=this&&this.__importDefault||function(v){return v&&v.__esModule?v:{default:v}};Object.defineProperty(N,"__esModule",{value:!0}),N.ForceAtlas2Layout=void 0;var L=F(46833),_=F(44941),I=U(F(69445)),T=U(F(16067)),x=U(F(80374)),p=function(v){k(g,v);function g(d){var c=v.call(this)||this;return c.center=[0,0],c.width=300,c.height=300,c.nodes=[],c.edges=[],c.kr=5,c.kg=1,c.mode="normal",c.preventOverlap=!1,c.dissuadeHubs=!1,c.barnesHut=void 0,c.maxIteration=0,c.ks=.1,c.ksmax=10,c.tao=.1,c.onLayoutEnd=function(){},c.prune=void 0,c.updateCfg(d),c}return g.prototype.getDefaultCfg=function(){return{}},g.prototype.execute=function(){var d=this,c=d.nodes,s=d.onLayoutEnd,m=d.prune,M=d.maxIteration;!d.width&&typeof window!="undefined"&&(d.width=window.innerWidth),!d.height&&typeof window!="undefined"&&(d.height=window.innerHeight);for(var P=[],R=c.length,j=0;j250&&(d.barnesHut=!0),d.prune===void 0&&R>100&&(d.prune=!0),this.maxIteration===0&&!d.prune?(M=250,R<=200&&R>100?M=1e3:R>200&&(M=1200),this.maxIteration=M):this.maxIteration===0&&m&&(M=100,R<=200&&R>100?M=500:R>200&&(M=950),this.maxIteration=M),d.kr||(d.kr=50,R>100&&R<=500?d.kr=20:R>500&&(d.kr=1)),d.kg||(d.kg=20,R>100&&R<=500?d.kg=10:R>500&&(d.kg=1)),this.nodes=d.updateNodesByForces(P),s()},g.prototype.updateNodesByForces=function(d){for(var c=this,s=c.edges,m=c.maxIteration,M=c.nodes,P=s.filter(function(Se){var we=(0,_.getEdgeTerminal)(Se,"source"),Te=(0,_.getEdgeTerminal)(Se,"target");return we!==Te}),R=M.length,j=P.length,Q=[],G={},W={},H=[],Z=0;Z0;){for(var ye=0;yene||!G)?se=this.getOptRepGraForces(se,Ie,M):se=this.getRepGraForces(K,ne,se,J,P,M);var Se=this.updatePos(se,fe,Z,M);j=Se.nodes,Z=Se.sg,K--,R.tick&&R.tick()}return j},g.prototype.getAttrForces=function(d,c,s,m,M,P,R,j){for(var Q=this,G=Q.nodes,W=Q.preventOverlap,H=Q.dissuadeHubs,Z=Q.mode,J=Q.prune,K=0;K0&&(Se=Ae,we=Ae),j[2*m[ne.id]]+=Se*ye[0],j[2*m[fe.id]]-=we*ye[0],j[2*m[ne.id]+1]+=Se*ye[1],j[2*m[fe.id]+1]-=we*ye[1]}}return j},g.prototype.getRepGraForces=function(d,c,s,m,M,P){for(var R=this,j=R.nodes,Q=R.preventOverlap,G=R.kr,W=R.kg,H=R.center,Z=R.prune,J=j.length,K=0;K0&&(Ie=G*(P[K]+1)*(P[ne]+1)/fe),s[2*K]-=Ie*se[0],s[2*ne]+=Ie*se[0],s[2*K+1]-=Ie*se[1],s[2*ne+1]+=Ie*se[1]}var ye=[j[K].x-H[0],j[K].y-H[1]],Ae=Math.hypot(ye[0],ye[1]);ye[0]=ye[0]/Ae,ye[1]=ye[1]/Ae;var Se=W*(P[K]+1);s[2*K]-=Se*ye[0],s[2*K+1]-=Se*ye[1]}return s},g.prototype.getOptRepGraForces=function(d,c,s){for(var m=this,M=m.nodes,P=m.kg,R=m.center,j=m.prune,Q=M.length,G=9e10,W=-9e10,H=9e10,Z=-9e10,J=0;J=W&&(W=M[J].x),M[J].x<=G&&(G=M[J].x),M[J].y>=Z&&(Z=M[J].y),M[J].y<=H&&(H=M[J].y));for(var K=Math.max(W-G,Z-H),ne={xmid:(W+G)/2,ymid:(Z+H)/2,length:K,massCenter:R,mass:Q},se=new T.default(ne),fe=new x.default(se),J=0;J1.5*Ae?1.5*Ae:s);for(var ne=0;neTe?Te:Se;var ke=Se*d[2*ne],Ge=Se*d[2*ne+1];P[ne].x+=ke,P[ne].y+=Ge}return{nodes:P,sg:s}},g}(L.Base);N.ForceAtlas2Layout=p},16067:function(Mt,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0});var F=function(){function k(U){this.xmid=U.xmid,this.ymid=U.ymid,this.length=U.length,this.massCenter=U.massCenter||[0,0],this.mass=U.mass||1}return k.prototype.getLength=function(){return this.length},k.prototype.contains=function(U,L){var _=this.length/2;return U<=this.xmid+_&&U>=this.xmid-_&&L<=this.ymid+_&&L>=this.ymid-_},k.prototype.NW=function(){var U=this.xmid-this.length/4,L=this.ymid+this.length/4,_=this.length/2,I={xmid:U,ymid:L,length:_},T=new k(I);return T},k.prototype.NE=function(){var U=this.xmid+this.length/4,L=this.ymid+this.length/4,_=this.length/2,I={xmid:U,ymid:L,length:_},T=new k(I);return T},k.prototype.SW=function(){var U=this.xmid-this.length/4,L=this.ymid-this.length/4,_=this.length/2,I={xmid:U,ymid:L,length:_},T=new k(I);return T},k.prototype.SE=function(){var U=this.xmid+this.length/4,L=this.ymid-this.length/4,_=this.length/2,I={xmid:U,ymid:L,length:_},T=new k(I);return T},k}();N.default=F},80374:function(Mt,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0});var F=function(){function k(U){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,U!=null&&(this.quad=U)}return k.prototype.insert=function(U){if(this.body==null){this.body=U;return}this._isExternal()?(this.quad&&(this.NW=new k(this.quad.NW()),this.NE=new k(this.quad.NE()),this.SW=new k(this.quad.SW()),this.SE=new k(this.quad.SE())),this._putBody(this.body),this._putBody(U),this.body=this.body.add(U)):(this.body=this.body.add(U),this._putBody(U))},k.prototype._putBody=function(U){this.quad&&(U.in(this.quad.NW())&&this.NW?this.NW.insert(U):U.in(this.quad.NE())&&this.NE?this.NE.insert(U):U.in(this.quad.SW())&&this.SW?this.SW.insert(U):U.in(this.quad.SE())&&this.SE&&this.SE.insert(U))},k.prototype._isExternal=function(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null},k.prototype.updateForce=function(U){if(!(this.body==null||U===this.body))if(this._isExternal())U.addForce(this.body);else{var L=this.quad?this.quad.getLength():0,_=this.body.distanceTo(U);L/_-1||(G[H]=Q[H])}),G}),R.ticking=!1},M.prototype.execute=function(P){var R=this,j=R.nodes,Q=R.edges;if(!R.ticking){var G=R.forceSimulation,W=R.alphaMin,H=R.alphaDecay,Z=R.alpha;if(G){if(P){if(R.clustering&&R.clusterForce&&(R.clusterForce.nodes(j),R.clusterForce.links(Q)),G.nodes(j),Q&&R.edgeForce)R.edgeForce.links(Q);else if(Q&&!R.edgeForce){var ne=T.forceLink().id(function(ye){return ye.id}).links(Q);R.edgeStrength&&ne.strength(R.edgeStrength),R.linkDistance&&ne.distance(R.linkDistance),R.edgeForce=ne,G.force("link",ne)}}R.preventOverlap&&R.overlapProcess(G),G.alpha(Z).restart(),this.ticking=!0}else try{var J=T.forceManyBody();if(R.nodeStrength&&J.strength(R.nodeStrength),G=T.forceSimulation().nodes(j),R.clustering){var K=(0,x.default)();K.centerX(R.center[0]).centerY(R.center[1]).template("force").strength(R.clusterFociStrength),Q&&K.links(Q),j&&K.nodes(j),K.forceLinkDistance(R.clusterEdgeDistance).forceLinkStrength(R.clusterEdgeStrength).forceCharge(R.clusterNodeStrength).forceNodeSize(R.clusterNodeSize),R.clusterForce=K,G.force("group",K)}if(G.force("center",T.forceCenter(R.center[0],R.center[1])).force("charge",J).alpha(Z).alphaDecay(H).alphaMin(W),R.preventOverlap&&R.overlapProcess(G),Q){var ne=T.forceLink().id(function(Ie){return Ie.id}).links(Q);R.edgeStrength&&ne.strength(R.edgeStrength),R.linkDistance&&ne.distance(R.linkDistance),R.edgeForce=ne,G.force("link",ne)}if(R.workerEnabled&&!s()&&(R.workerEnabled=!1,console.warn("workerEnabled option is only supported when running in web worker.")),!R.workerEnabled)G.on("tick",function(){R.tick()}).on("end",function(){R.ticking=!1,R.onLayoutEnd&&R.onLayoutEnd()}),R.ticking=!0;else{G.stop();for(var se=c(G),fe=1;fe<=se;fe++)G.tick(),postMessage({nodes:j,currentTick:fe,totalTicks:se,type:g.LAYOUT_MESSAGE.TICK},void 0);R.ticking=!1}R.forceSimulation=G,R.ticking=!0}catch(Ie){R.ticking=!1,console.warn(Ie)}}},M.prototype.overlapProcess=function(P){var R=this,j=R.nodeSize,Q=R.nodeSpacing,G,W,H=R.collideStrength;if((0,p.isNumber)(Q)?W=function(){return Q}:(0,p.isFunction)(Q)?W=Q:W=function(){return 0},!j)G=function(ne){if(ne.size){if((0,p.isArray)(ne.size)){var se=ne.size[0]>ne.size[1]?ne.size[0]:ne.size[1];return se/2+W(ne)}if((0,p.isObject)(ne.size)){var se=ne.size.width>ne.size.height?ne.size.width:ne.size.height;return se/2+W(ne)}return ne.size/2+W(ne)}return 10+W(ne)};else if((0,p.isFunction)(j))G=function(ne){var se=j(ne);return se+W(ne)};else if((0,p.isArray)(j)){var Z=j[0]>j[1]?j[0]:j[1],J=Z/2;G=function(ne){return J+W(ne)}}else if((0,p.isNumber)(j)){var K=j/2;G=function(ne){return K+W(ne)}}else G=function(){return 10};P.force("collisionForce",T.forceCollide(G).strength(H))},M.prototype.updateCfg=function(P){var R=this;R.ticking&&(R.forceSimulation.stop(),R.ticking=!1),R.forceSimulation=null,Object.assign(R,P)},M.prototype.destroy=function(){var P=this;P.ticking&&(P.forceSimulation.stop(),P.ticking=!1),P.nodes=null,P.edges=null,P.destroyed=!0},M}(v.Base);N.ForceLayout=d;function c(m){var M=m.alphaMin(),P=m.alphaTarget(),R=m.alpha(),j=Math.log((M-P)/(R-P))/Math.log(1-m.alphaDecay()),Q=Math.ceil(j);return Q}function s(){return typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope}},22457:function(Mt,N,F){"use strict";var k=this&&this.__createBinding||(Object.create?function(L,_,I,T){T===void 0&&(T=I);var x=Object.getOwnPropertyDescriptor(_,I);(!x||("get"in x?!_.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return _[I]}}),Object.defineProperty(L,T,x)}:function(L,_,I,T){T===void 0&&(T=I),L[T]=_[I]}),U=this&&this.__exportStar||function(L,_){for(var I in L)I!=="default"&&!Object.prototype.hasOwnProperty.call(_,I)&&k(_,L,I)};Object.defineProperty(N,"__esModule",{value:!0}),U(F(84022),N)},92627:function(Mt,N,F){"use strict";var k=this&&this.__extends||function(){var T=function(x,p){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,g){v.__proto__=g}||function(v,g){for(var d in g)Object.prototype.hasOwnProperty.call(g,d)&&(v[d]=g[d])},T(x,p)};return function(x,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");T(x,p);function v(){this.constructor=x}x.prototype=p===null?Object.create(p):(v.prototype=p.prototype,new v)}}();Object.defineProperty(N,"__esModule",{value:!0}),N.FruchtermanLayout=void 0;var U=F(46833),L=F(44941),_=800,I=function(T){k(x,T);function x(p){var v=T.call(this)||this;return v.maxIteration=1e3,v.workerEnabled=!1,v.gravity=10,v.speed=5,v.clustering=!1,v.clusterGravity=10,v.nodes=[],v.edges=[],v.width=300,v.height=300,v.nodeMap={},v.nodeIdxMap={},v.onLayoutEnd=function(){},v.tick=function(){},v.animate=!0,v.updateCfg(p),v}return x.prototype.getDefaultCfg=function(){return{maxIteration:1e3,gravity:10,speed:1,clustering:!1,clusterGravity:10,animate:!0}},x.prototype.execute=function(){var p=this,v,g,d=this,c=d.nodes;if(d.timeInterval!==void 0&&typeof window!="undefined"&&window.clearInterval(d.timeInterval),!c||c.length===0){(v=d.onLayoutEnd)===null||v===void 0||v.call(d);return}!d.width&&typeof window!="undefined"&&(d.width=window.innerWidth),!d.height&&typeof window!="undefined"&&(d.height=window.innerHeight),d.center||(d.center=[d.width/2,d.height/2]);var s=d.center;if(c.length===1){c[0].x=s[0],c[0].y=s[1],(g=d.onLayoutEnd)===null||g===void 0||g.call(d);return}var m={},M={};return c.forEach(function(P,R){(0,L.isNumber)(P.x)||(P.x=Math.random()*p.width),(0,L.isNumber)(P.y)||(P.y=Math.random()*p.height),m[P.id]=P,M[P.id]=R}),d.nodeMap=m,d.nodeIdxMap=M,d.run()},x.prototype.run=function(){var p,v=this,g=v.nodes;if(g){var d=v.edges,c=v.maxIteration,s=v.workerEnabled,m=v.clustering,M=v.animate,P={};if(m&&g.forEach(function(Q){P[Q.cluster]===void 0&&(P[Q.cluster]={name:Q.cluster,cx:0,cy:0,count:0})}),s||!M){for(var R=0;R=c&&((Q=v.onLayoutEnd)===null||Q===void 0||Q.call(v),window.clearInterval(v.timeInterval))},0)}return{nodes:g,edges:d}}},x.prototype.runOneStep=function(p){var v,g=this,d=g.nodes;if(d){var c=g.edges,s=g.center,m=g.gravity,M=g.speed,P=g.clustering,R=g.height*g.width,j=Math.sqrt(R)/10,Q=R/(d.length+1),G=Math.sqrt(Q),W=[];if(d.forEach(function(J,K){W[K]={x:0,y:0}}),g.applyCalculate(d,c,W,G,Q),P){for(var H in p)p[H].cx=0,p[H].cy=0,p[H].count=0;d.forEach(function(J){var K=p[J.cluster];(0,L.isNumber)(J.x)&&(K.cx+=J.x),(0,L.isNumber)(J.y)&&(K.cy+=J.y),K.count++});for(var H in p)p[H].cx/=p[H].count,p[H].cy/=p[H].count;var Z=g.clusterGravity||m;d.forEach(function(J,K){if(!(!(0,L.isNumber)(J.x)||!(0,L.isNumber)(J.y))){var ne=p[J.cluster],se=Math.sqrt((J.x-ne.cx)*(J.x-ne.cx)+(J.y-ne.cy)*(J.y-ne.cy)),fe=G*Z;W[K].x-=fe*(J.x-ne.cx)/se,W[K].y-=fe*(J.y-ne.cy)/se}})}d.forEach(function(J,K){if(!(!(0,L.isNumber)(J.x)||!(0,L.isNumber)(J.y))){var ne=.01*G*m;W[K].x-=ne*(J.x-s[0]),W[K].y-=ne*(J.y-s[1])}}),d.forEach(function(J,K){if((0,L.isNumber)(J.fx)&&(0,L.isNumber)(J.fy)){J.x=J.fx,J.y=J.fy;return}if(!(!(0,L.isNumber)(J.x)||!(0,L.isNumber)(J.y))){var ne=Math.sqrt(W[K].x*W[K].x+W[K].y*W[K].y);if(ne>0){var se=Math.min(j*(M/_),ne);J.x+=W[K].x/ne*se,J.y+=W[K].y/ne*se}}}),(v=g.tick)===null||v===void 0||v.call(g)}},x.prototype.applyCalculate=function(p,v,g,d,c){var s=this;s.calRepulsive(p,g,c),v&&s.calAttractive(v,g,d)},x.prototype.calRepulsive=function(p,v,g){p.forEach(function(d,c){v[c]={x:0,y:0},p.forEach(function(s,m){if(c!==m&&!(!(0,L.isNumber)(d.x)||!(0,L.isNumber)(s.x)||!(0,L.isNumber)(d.y)||!(0,L.isNumber)(s.y))){var M=d.x-s.x,P=d.y-s.y,R=M*M+P*P;if(R===0){R=1;var j=c>m?1:-1;M=.01*j,P=.01*j}var Q=g/R;v[c].x+=M*Q,v[c].y+=P*Q}})})},x.prototype.calAttractive=function(p,v,g){var d=this;p.forEach(function(c){var s=(0,L.getEdgeTerminal)(c,"source"),m=(0,L.getEdgeTerminal)(c,"target");if(!(!s||!m)){var M=d.nodeIdxMap[s],P=d.nodeIdxMap[m];if(M!==P){var R=d.nodeMap[s],j=d.nodeMap[m];if(!(!(0,L.isNumber)(j.x)||!(0,L.isNumber)(R.x)||!(0,L.isNumber)(j.y)||!(0,L.isNumber)(R.y))){var Q=j.x-R.x,G=j.y-R.y,W=Math.sqrt(Q*Q+G*G),H=W*W/g;v[P].x-=Q/W*H,v[P].y-=G/W*H,v[M].x+=Q/W*H,v[M].y+=G/W*H}}}})},x.prototype.stop=function(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval)},x.prototype.destroy=function(){var p=this;p.stop(),p.tick=null,p.nodes=null,p.edges=null,p.destroyed=!0},x.prototype.getType=function(){return"fruchterman"},x}(U.Base);N.FruchtermanLayout=I},83254:function(Mt,N,F){"use strict";var k=this&&this.__extends||function(){var T=function(x,p){return T=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,g){v.__proto__=g}||function(v,g){for(var d in g)Object.prototype.hasOwnProperty.call(g,d)&&(v[d]=g[d])},T(x,p)};return function(x,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");T(x,p);function v(){this.constructor=x}x.prototype=p===null?Object.create(p):(v.prototype=p.prototype,new v)}}();Object.defineProperty(N,"__esModule",{value:!0}),N.GForceLayout=void 0;var U=F(46833),L=F(44941),_=function(T,x){var p;return T?(0,L.isNumber)(T)?p=function(v){return T}:p=T:p=function(v){return x||1},p},I=function(T){k(x,T);function x(p){var v=T.call(this)||this;return v.maxIteration=500,v.workerEnabled=!1,v.edgeStrength=200,v.nodeStrength=1e3,v.coulombDisScale=.005,v.damping=.9,v.maxSpeed=1e3,v.minMovement=.5,v.interval=.02,v.factor=1,v.linkDistance=1,v.gravity=10,v.preventOverlap=!0,v.collideStrength=1,v.tick=function(){},v.nodes=[],v.edges=[],v.width=300,v.height=300,v.nodeMap={},v.nodeIdxMap={},v.animate=!0,v.updateCfg(p),v}return x.prototype.getDefaultCfg=function(){return{maxIteration:500,gravity:10,enableTick:!0,animate:!0}},x.prototype.execute=function(){var p,v,g=this,d=g.nodes;if(g.timeInterval!==void 0&&typeof window!="undefined"&&window.clearInterval(g.timeInterval),!d||d.length===0){(p=g.onLayoutEnd)===null||p===void 0||p.call(g);return}!g.width&&typeof window!="undefined"&&(g.width=window.innerWidth),!g.height&&typeof window!="undefined"&&(g.height=window.innerHeight),g.center||(g.center=[g.width/2,g.height/2]);var c=g.center;if(d.length===1){d[0].x=c[0],d[0].y=c[1],(v=g.onLayoutEnd)===null||v===void 0||v.call(g);return}var s={},m={};d.forEach(function(G,W){(0,L.isNumber)(G.x)||(G.x=Math.random()*g.width),(0,L.isNumber)(G.y)||(G.y=Math.random()*g.height),s[G.id]=G,m[G.id]=W}),g.nodeMap=s,g.nodeIdxMap=m,g.linkDistance=_(g.linkDistance,1),g.nodeStrength=_(g.nodeStrength,1),g.edgeStrength=_(g.edgeStrength,1);var M=g.nodeSize,P;if(g.preventOverlap){var R=g.nodeSpacing,j;(0,L.isNumber)(R)?j=function(){return R}:(0,L.isFunction)(R)?j=R:j=function(){return 0},M?(0,L.isArray)(M)?P=function(G){return Math.max(M[0],M[1])+j(G)}:P=function(G){return M+j(G)}:P=function(G){return G.size?(0,L.isArray)(G.size)?Math.max(G.size[0],G.size[1])+j(G):(0,L.isObject)(G.size)?Math.max(G.size.width,G.size.height)+j(G):G.size+j(G):10+j(G)}}g.nodeSize=P;var Q=g.edges;g.degrees=(0,L.getDegree)(d.length,g.nodeIdxMap,Q),g.getMass||(g.getMass=function(G){var W=G.mass||g.degrees[g.nodeIdxMap[G.id]].all||1;return W}),g.run()},x.prototype.run=function(){var p,v=this,g=v.maxIteration,d=v.nodes,c=v.workerEnabled,s=v.minMovement,m=v.animate;if(d)if(c||!m){for(var M=0;M=g&&((Q=v.onLayoutEnd)===null||Q===void 0||Q.call(v),window.clearInterval(v.timeInterval))}},0)}},x.prototype.reachMoveThreshold=function(p,v,g){var d=0;return p.forEach(function(c,s){var m=c.x-v[s].x,M=c.y-v[s].y;d+=Math.sqrt(m*m+M*M)}),d/=p.length,d=Z)){var J=Q.x-H.x,K=Q.y-H.y;J===0&&K===0&&(J=Math.random()*.01,K=Math.random()*.01);var ne=J*J+K*K,se=Math.sqrt(ne),fe=(se+.1)*s,Ie=J/se,ye=K/se,Ae=(R(Q)+R(H))*.5*c/(fe*fe),Se=d?d(H):1;if(p[2*G]+=Ie*Ae,p[2*G+1]+=ye*Ae,p[2*Z]-=Ie*Ae,p[2*Z+1]-=ye*Ae,m&&(j(Q)+j(H))/2>se){var we=P*(R(Q)+R(H))*.5/ne;p[2*G]+=Ie*we/W,p[2*G+1]+=ye*we/W,p[2*Z]-=Ie*we/Se,p[2*Z+1]-=ye*we/Se}}})})},x.prototype.calAttractive=function(p,v){var g=this,d=g.nodeMap,c=g.nodeIdxMap,s=g.linkDistance,m=g.edgeStrength,M=g.nodeSize,P=g.getMass;v.forEach(function(R,j){var Q=(0,L.getEdgeTerminal)(R,"source"),G=(0,L.getEdgeTerminal)(R,"target"),W=d[Q],H=d[G],Z=H.x-W.x,J=H.y-W.y;Z===0&&J===0&&(Z=Math.random()*.01,J=Math.random()*.01);var K=Math.sqrt(Z*Z+J*J),ne=Z/K,se=J/K,fe=s(R,W,H)||1+(M(W)+M(H)||0)/2,Ie=fe-K,ye=Ie*m(R),Ae=c[Q],Se=c[G],we=P?P(W):1,Te=P?P(H):1;p[2*Ae]-=ne*ye/we,p[2*Ae+1]-=se*ye/we,p[2*Se]+=ne*ye/Te,p[2*Se+1]+=se*ye/Te})},x.prototype.calGravity=function(p,v){for(var g=this,d=g.center,c=g.gravity,s=g.degrees,m=v.length,M=0;Mc.maxSpeed){var Q=c.maxSpeed/j;P=Q*P,R=Q*R}v[2*M]=P,v[2*M+1]=R})},x.prototype.updatePosition=function(p,v,g){g.forEach(function(d,c){if((0,L.isNumber)(d.fx)&&(0,L.isNumber)(d.fy)){d.x=d.fx,d.y=d.fy;return}var s=p[2*c]*v,m=p[2*c+1]*v;d.x+=s,d.y+=m})},x.prototype.stop=function(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval)},x.prototype.destroy=function(){var p=this;p.stop(),p.tick=null,p.nodes=null,p.edges=null,p.destroyed=!0},x.prototype.getType=function(){return"gForce"},x}(U.Base);N.GForceLayout=I},6851:function(Mt,N,F){"use strict";var k=this&&this.__extends||function(){var d=function(c,s){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,M){m.__proto__=M}||function(m,M){for(var P in M)Object.prototype.hasOwnProperty.call(M,P)&&(m[P]=M[P])},d(c,s)};return function(c,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");d(c,s);function m(){this.constructor=c}c.prototype=s===null?Object.create(s):(m.prototype=s.prototype,new m)}}(),U=this&&this.__awaiter||function(d,c,s,m){function M(P){return P instanceof s?P:new s(function(R){R(P)})}return new(s||(s=Promise))(function(P,R){function j(W){try{G(m.next(W))}catch(H){R(H)}}function Q(W){try{G(m.throw(W))}catch(H){R(H)}}function G(W){W.done?P(W.value):M(W.value).then(j,Q)}G((m=m.apply(d,c||[])).next())})},L=this&&this.__generator||function(d,c){var s={label:0,sent:function(){if(P[0]&1)throw P[1];return P[1]},trys:[],ops:[]},m,M,P,R;return R={next:j(0),throw:j(1),return:j(2)},typeof Symbol=="function"&&(R[Symbol.iterator]=function(){return this}),R;function j(G){return function(W){return Q([G,W])}}function Q(G){if(m)throw new TypeError("Generator is already executing.");for(;R&&(R=0,G[0]&&(s=0)),s;)try{if(m=1,M&&(P=G[0]&2?M.return:G[0]?M.throw||((P=M.return)&&P.call(M),0):M.next)&&!(P=P.call(M,G[1])).done)return P;switch(M=0,P&&(G=[G[0]&2,P.value]),G[0]){case 0:case 1:P=G;break;case 4:return s.label++,{value:G[1],done:!1};case 5:s.label++,M=G[1],G=[0];continue;case 7:G=s.ops.pop(),s.trys.pop();continue;default:if(P=s.trys,!(P=P.length>0&&P[P.length-1])&&(G[0]===6||G[0]===2)){s=0;continue}if(G[0]===3&&(!P||G[1]>P[0]&&G[1] 0.0) { dx += param * xDist; dy += param * yDist; if (xDist == 0 && yDist == 0) { const sign = i < j ? 1 : -1; dx += param * sign; dy += param * sign; } } } } return [dx, dy]; } calcGravity(currentNode: vec4, nodeAttributes: vec4): vec2 { // let dx = 0, dy = 0; const vx = currentNode[0] - this.u_Center[0]; const vy = currentNode[1] - this.u_Center[1]; const gf = 0.01 * this.u_K * this.u_Gravity; dx = gf * vx; dy = gf * vy; if (this.u_Clustering == 1) { const clusterIdx = int(nodeAttributes[0]); const center = this.u_ClusterCenters[clusterIdx]; const cvx = currentNode[0] - center[0]; const cvy = currentNode[1] - center[1]; const dist = sqrt(cvx * cvx + cvy * cvy) + 0.01; const parma = this.u_K * this.u_ClusterGravity / dist; dx += parma * cvx; dy += parma * cvy; } return [dx, dy]; } calcAttractive(i: int, currentNode: vec4): vec2 { let dx = 0, dy = 0; const arr_offset = int(floor(currentNode[2] + 0.5)); const length = int(floor(currentNode[3] + 0.5)); const node_buffer: vec4; for (let p = 0; p < MAX_EDGE_PER_VERTEX; p++) { if (p >= length) break; const arr_idx = arr_offset + p; // when arr_idx % 4 == 0 update currentNodedx_buffer const buf_offset = arr_idx - arr_idx / 4 * 4; if (p == 0 || buf_offset == 0) { node_buffer = this.u_Data[int(arr_idx / 4)]; } const float_j = buf_offset == 0 ? node_buffer[0] : buf_offset == 1 ? node_buffer[1] : buf_offset == 2 ? node_buffer[2] : node_buffer[3]; const nextNode = this.u_Data[int(float_j)]; const xDist = currentNode[0] - nextNode[0]; const yDist = currentNode[1] - nextNode[1]; const dist = sqrt(xDist * xDist + yDist * yDist) + 0.01; let attractiveF = dist / this.u_K; if (dist > 0.0) { dx -= xDist * attractiveF; dy -= yDist * attractiveF; if (xDist == 0 && yDist == 0) { const sign = i < int(float_j) ? 1 : -1; dx -= sign * attractiveF; dy -= sign * attractiveF; } } } return [dx, dy]; } @main compute() { const i = globalInvocationID.x; const currentNode = this.u_Data[i]; let dx = 0, dy = 0; if (i >= VERTEX_COUNT) { this.u_Data[i] = currentNode; return; } // [gravity, fx, fy, 0] const nodeAttributes = this.u_AttributeArray[i]; if (nodeAttributes[1] != 0 && nodeAttributes[2] != 0) { // the node is fixed this.u_Data[i] = [ nodeAttributes[1], nodeAttributes[2], currentNode[2], currentNode[3] ]; return; } // repulsive const repulsive = this.calcRepulsive(i, currentNode); dx += repulsive[0]; dy += repulsive[1]; // attractive const attractive = this.calcAttractive(i, currentNode); dx += attractive[0]; dy += attractive[1]; // gravity const gravity = this.calcGravity(currentNode, nodeAttributes); dx -= gravity[0]; dy -= gravity[1]; // speed dx *= this.u_Speed; dy *= this.u_Speed; // move const distLength = sqrt(dx * dx + dy * dy); if (distLength > 0.0) { const limitedDist = min(this.u_MaxDisplace * this.u_Speed, distLength); this.u_Data[i] = [ currentNode[0] + dx / distLength * limitedDist, currentNode[1] + dy / distLength * limitedDist, currentNode[2], currentNode[3] ]; } } } `,N.fruchtermanBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_K;\\nuniform float u_K2;\\nuniform vec2 u_Center;\\nuniform float u_Gravity;\\nuniform float u_ClusterGravity;\\nuniform float u_Speed;\\nuniform float u_MaxDisplace;\\nuniform float u_Clustering;\\nuniform sampler2D u_AttributeArray;\\nuniform vec2 u_AttributeArraySize;\\nvec4 getDatau_AttributeArray(vec2 address2D) {\\n return vec4(texture2D(u_AttributeArray, address2D).rgba);\\n}\\nvec4 getDatau_AttributeArray(float address1D) {\\n return getDatau_AttributeArray(addrTranslation_1Dto2D(address1D, u_AttributeArraySize));\\n}\\nvec4 getDatau_AttributeArray(int address1D) {\\n return getDatau_AttributeArray(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = ((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat param = u_K2 / dist;\\nif (dist > 0.0) {dx += param * xDist;\\ndy += param * yDist;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < j) ? (1.0) : (-1.0);\\ndx += param * sign;\\ndy += param * sign;}}}}\\nreturn vec2(dx, dy);}\\nvec2 calcGravity(vec4 currentNode, vec4 nodeAttributes) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nfloat vx = currentNode.x - u_Center.x;\\nfloat vy = currentNode.y - u_Center.y;\\nfloat gf = (0.01 * u_K) * u_Gravity;\\ndx = gf * vx;\\ndy = gf * vy;\\nif (u_Clustering == 1.0) {int clusterIdx = int(nodeAttributes.x);\\nvec4 center = getDatau_ClusterCenters(clusterIdx);\\nfloat cvx = currentNode.x - center.x;\\nfloat cvy = currentNode.y - center.y;\\nfloat dist = sqrt((cvx * cvx) + (cvy * cvy)) + 0.01;\\nfloat parma = (u_K * u_ClusterGravity) / dist;\\ndx += parma * cvx;\\ndy += parma * cvy;}\\nreturn vec2(dx, dy);}\\nvec2 calcAttractive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nint arr_offset = int(floor(currentNode.z + 0.5));\\nint length = int(floor(currentNode.w + 0.5));\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + int(p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = (buf_offset == 0) ? (node_buffer.x) : ((buf_offset == 1) ? (node_buffer.y) : ((buf_offset == 2) ? (node_buffer.z) : (node_buffer.w)));\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat xDist = currentNode.x - nextNode.x;\\nfloat yDist = currentNode.y - nextNode.y;\\nfloat dist = sqrt((xDist * xDist) + (yDist * yDist)) + 0.01;\\nfloat attractiveF = dist / u_K;\\nif (dist > 0.0) {dx -= xDist * attractiveF;\\ndy -= yDist * attractiveF;\\nif ((xDist == 0.0) && (yDist == 0.0)) {float sign = (i < int(float_j)) ? (1.0) : (-1.0);\\ndx -= sign * attractiveF;\\ndy -= sign * attractiveF;}}}\\nreturn vec2(dx, dy);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nfloat dx = 0.0;\\nfloat dy = 0.0;\\nif (i >= VERTEX_COUNT) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes = getDatau_AttributeArray(i);\\nif ((nodeAttributes.y != 0.0) && (nodeAttributes.z != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes.y, nodeAttributes.z, currentNode.z, currentNode.w));\\nreturn ;}\\nvec2 repulsive = calcRepulsive(i, currentNode);\\ndx += repulsive.x;\\ndy += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode);\\ndx += attractive.x;\\ndy += attractive.y;\\nvec2 gravity = calcGravity(currentNode, nodeAttributes);\\ndx -= gravity.x;\\ndy -= gravity.y;\\ndx *= u_Speed;\\ndy *= u_Speed;\\nfloat distLength = sqrt((dx * dx) + (dy * dy));\\nif (distLength > 0.0) {float limitedDist = min(u_MaxDisplace * u_Speed, distLength);\\ngl_FragColor = vec4(vec4(currentNode.x + ((dx / distLength) * limitedDist), currentNode.y + ((dy / distLength) * limitedDist), currentNode.z, currentNode.w));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_K","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_K2","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Center","type":"vec2","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Gravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterGravity","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Speed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_MaxDisplace","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_Clustering","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AttributeArray","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}',N.clusterCode=` import { globalInvocationID } from 'g-webgpu'; const VERTEX_COUNT; const CLUSTER_COUNT; @numthreads(1, 1, 1) class CalcCenter { @in u_Data: vec4[]; @in u_NodeAttributes: vec4[]; // [[clusterIdx, 0, 0, 0], ...] @in @out u_ClusterCenters: vec4[]; // [[cx, cy, nodeCount, clusterIdx], ...] @main compute() { const i = globalInvocationID.x; const center = this.u_ClusterCenters[i]; let sumx = 0; let sumy = 0; let count = 0; for (let j = 0; j < VERTEX_COUNT; j++) { const attributes = this.u_NodeAttributes[j]; const clusterIdx = int(attributes[0]); const vertex = this.u_Data[j]; if (clusterIdx == i) { sumx += vertex.x; sumy += vertex.y; count += 1; } } this.u_ClusterCenters[i] = [ sumx / count, sumy / count, count, i ]; } } `,N.clusterBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define CLUSTER_COUNT __DefineValuePlaceholder__CLUSTER_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributes;\\nuniform vec2 u_NodeAttributesSize;\\nvec4 getDatau_NodeAttributes(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributes, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributes(float address1D) {\\n return getDatau_NodeAttributes(addrTranslation_1Dto2D(address1D, u_NodeAttributesSize));\\n}\\nvec4 getDatau_NodeAttributes(int address1D) {\\n return getDatau_NodeAttributes(float(address1D));\\n}\\nuniform sampler2D u_ClusterCenters;\\nuniform vec2 u_ClusterCentersSize;\\nvec4 getDatau_ClusterCenters(vec2 address2D) {\\n return vec4(texture2D(u_ClusterCenters, address2D).rgba);\\n}\\nvec4 getDatau_ClusterCenters(float address1D) {\\n return getDatau_ClusterCenters(addrTranslation_1Dto2D(address1D, u_ClusterCentersSize));\\n}\\nvec4 getDatau_ClusterCenters(int address1D) {\\n return getDatau_ClusterCenters(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 center = getDatau_ClusterCenters(i);\\nfloat sumx = 0.0;\\nfloat sumy = 0.0;\\nfloat count = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 attributes = getDatau_NodeAttributes(j);\\nint clusterIdx = int(attributes.x);\\nvec4 vertex = getDatau_Data(j);\\nif (clusterIdx == i) {sumx += vertex.x;\\nsumy += vertex.y;\\ncount += 1.0;}}\\ngl_FragColor = vec4(vec4(sumx / count, sumy / count, count, i));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"CLUSTER_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributes","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_ClusterCenters","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_ClusterCenters","size":[1,1],"length":1},"needPingpong":true}}'},77820:function(Mt,N,F){"use strict";var k=this&&this.__extends||function(){var c=function(s,m){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(M,P){M.__proto__=P}||function(M,P){for(var R in P)Object.prototype.hasOwnProperty.call(P,R)&&(M[R]=P[R])},c(s,m)};return function(s,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");c(s,m);function M(){this.constructor=s}s.prototype=m===null?Object.create(m):(M.prototype=m.prototype,new M)}}(),U=this&&this.__awaiter||function(c,s,m,M){function P(R){return R instanceof m?R:new m(function(j){j(R)})}return new(m||(m=Promise))(function(R,j){function Q(H){try{W(M.next(H))}catch(Z){j(Z)}}function G(H){try{W(M.throw(H))}catch(Z){j(Z)}}function W(H){H.done?R(H.value):P(H.value).then(Q,G)}W((M=M.apply(c,s||[])).next())})},L=this&&this.__generator||function(c,s){var m={label:0,sent:function(){if(R[0]&1)throw R[1];return R[1]},trys:[],ops:[]},M,P,R,j;return j={next:Q(0),throw:Q(1),return:Q(2)},typeof Symbol=="function"&&(j[Symbol.iterator]=function(){return this}),j;function Q(W){return function(H){return G([W,H])}}function G(W){if(M)throw new TypeError("Generator is already executing.");for(;j&&(j=0,W[0]&&(m=0)),m;)try{if(M=1,P&&(R=W[0]&2?P.return:W[0]?P.throw||((R=P.return)&&R.call(P),0):P.next)&&!(R=R.call(P,W[1])).done)return R;switch(P=0,R&&(W=[W[0]&2,R.value]),W[0]){case 0:case 1:R=W;break;case 4:return m.label++,{value:W[1],done:!1};case 5:m.label++,P=W[1],W=[0];continue;case 7:W=m.ops.pop(),m.trys.pop();continue;default:if(R=m.trys,!(R=R.length>0&&R[R.length-1])&&(W[0]===6||W[0]===2)){m=0;continue}if(W[0]===3&&(!R||W[1]>R[0]&&W[1]= length) break; const arr_idx = arr_offset + 4 * p; // i \u8282\u70B9\u7684\u7B2C p \u6761\u8FB9\u5F00\u59CB\u7684\u5C0F\u683C\u5B50\u4F4D\u7F6E const buf_offset = arr_idx - arr_idx / 4 * 4; if (p == 0 || buf_offset == 0) { node_buffer = this.u_Data[int(arr_idx / 4)]; // \u5927\u683C\u5B50\uFF0C\u5927\u683C\u5B50\u4F4D\u7F6E=\u5C0F\u4E2A\u5B50\u4F4D\u7F6E / 4\uFF0C } let float_j: float = node_buffer[0]; const nextNode = this.u_Data[int(float_j)]; const vx = nextNode[0] - currentNode[0]; const vy = nextNode[1] - currentNode[1]; const dist = sqrt(vx * vx + vy * vy) + 0.01; const direx = vx / dist; const direy = vy / dist; const edgeLength = node_buffer[1]; const edgeStrength = node_buffer[2]; const diff: float = edgeLength - dist;//edgeLength // const param = diff * this.u_stiffness / mass; // const param = diff * edgeStrength / mass; // ax -= direx * param; ay -= direy * param; } return [ax, ay]; } @main compute() { const i = globalInvocationID.x; const currentNode = this.u_Data[i]; const movement = u_AveMovement[0]; let ax = 0, ay = 0; if (i >= VERTEX_COUNT || movement.x < u_minMovement) { this.u_Data[i] = currentNode; return; } // \u6BCF\u4E2A\u8282\u70B9\u5C5E\u6027\u5360\u4E24\u4E2A\u6570\u7EC4\u4E2D\u5404\u4E00\u683C // [mass, degree, nodeStrength, fx] const nodeAttributes1 = this.u_NodeAttributeArray1[i]; // [centerX, centerY, centerGravity, fy] const nodeAttributes2 = this.u_NodeAttributeArray2[i]; // repulsive const repulsive = this.calcRepulsive(i, currentNode); ax += repulsive[0]; ay += repulsive[1]; // attractive const attractive = this.calcAttractive(i, currentNode, nodeAttributes1); ax += attractive[0]; ay += attractive[1]; // gravity const gravity = this.calcGravity(i, currentNode, nodeAttributes2); ax -= gravity[0]; ay -= gravity[1]; // speed const param = this.u_interval * this.u_damping; let vx = ax * param; let vy = ay * param; const vlength = sqrt(vx * vx + vy * vy) + 0.0001; if (vlength > this.u_maxSpeed) { const param2 = this.u_maxSpeed / vlength; vx = param2 * vx; vy = param2 * vy; } // move if (nodeAttributes1[3] != 0 && nodeAttributes2[3] != 0) { this.u_Data[i] = [ nodeAttributes1[3], nodeAttributes2[3], currentNode[2], 0 ]; } else { const distx = vx * this.u_interval; const disty = vy * this.u_interval; const distLength = sqrt(distx * distx + disty * disty); this.u_Data[i] = [ currentNode[0] + distx, currentNode[1] + disty, currentNode[2], distLength ]; } // the avarage move distance // need to share memory } } `,N.gForceBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define MAX_EDGE_PER_VERTEX __DefineValuePlaceholder__MAX_EDGE_PER_VERTEX\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n#define SHIFT_20 1048576.0\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_damping;\\nuniform float u_maxSpeed;\\nuniform float u_minMovement;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nuniform float u_coulombDisScale;\\nuniform float u_factor;\\nuniform sampler2D u_NodeAttributeArray1;\\nuniform vec2 u_NodeAttributeArray1Size;\\nvec4 getDatau_NodeAttributeArray1(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray1, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray1(float address1D) {\\n return getDatau_NodeAttributeArray1(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray1Size));\\n}\\nvec4 getDatau_NodeAttributeArray1(int address1D) {\\n return getDatau_NodeAttributeArray1(float(address1D));\\n}\\nuniform sampler2D u_NodeAttributeArray2;\\nuniform vec2 u_NodeAttributeArray2Size;\\nvec4 getDatau_NodeAttributeArray2(vec2 address2D) {\\n return vec4(texture2D(u_NodeAttributeArray2, address2D).rgba);\\n}\\nvec4 getDatau_NodeAttributeArray2(float address1D) {\\n return getDatau_NodeAttributeArray2(addrTranslation_1Dto2D(address1D, u_NodeAttributeArray2Size));\\n}\\nvec4 getDatau_NodeAttributeArray2(int address1D) {\\n return getDatau_NodeAttributeArray2(float(address1D));\\n}\\nuniform float u_interval;\\nivec2 unpack_float(float packedValue) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint packedIntValue = int(packedValue);\\nint v0 = packedIntValue / int(SHIFT_20);\\nreturn ivec2(v0, packedIntValue - (v0 * int(SHIFT_20)));}\\nvec2 calcRepulsive(int i, vec4 currentNode) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {if (i != j) {vec4 nextNode = getDatau_Data(j);\\nfloat vx = currentNode.x - nextNode.x;\\nfloat vy = currentNode.y - nextNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat n_dist = (dist + 0.1) * u_coulombDisScale;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nvec4 attributesi = getDatau_NodeAttributeArray1(i);\\nvec4 attributesj = getDatau_NodeAttributeArray1(j);\\nfloat massi = attributesi.x;\\nfloat nodeStrengthi = attributesi.z;\\nfloat nodeStrengthj = attributesj.z;\\nfloat nodeStrength = (nodeStrengthi + nodeStrengthj) / 2.0;\\nfloat param = (nodeStrength * u_factor) / (n_dist * n_dist);\\nax += direx * param;\\nay += direy * param;}}\\nreturn vec2(ax, ay);}\\nvec2 calcGravity(int i, vec4 currentNode, vec4 attributes2) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat vx = currentNode.x - attributes2.x;\\nfloat vy = currentNode.y - attributes2.y;\\nfloat ax = vx * attributes2.z;\\nfloat ay = vy * attributes2.z;\\nreturn vec2(ax, ay);}\\nvec2 calcAttractive(int i, vec4 currentNode, vec4 attributes1) {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat mass = attributes1.x;\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nivec2 compressed = unpack_float(currentNode.z);\\nint length = compressed.x;\\nint arr_offset = compressed.y;\\nvec4 node_buffer;\\nfor (int p = 0; p < MAX_EDGE_PER_VERTEX; p++) {if (p >= length) {break;}\\nint arr_idx = arr_offset + (4 * p);\\nint buf_offset = arr_idx - ((arr_idx / 4) * 4);\\nif ((p == 0) || (buf_offset == 0)) {node_buffer = getDatau_Data(int(arr_idx / 4));}\\nfloat float_j = node_buffer.x;\\nvec4 nextNode = getDatau_Data(int(float_j));\\nfloat vx = nextNode.x - currentNode.x;\\nfloat vy = nextNode.y - currentNode.y;\\nfloat dist = sqrt((vx * vx) + (vy * vy)) + 0.01;\\nfloat direx = vx / dist;\\nfloat direy = vy / dist;\\nfloat edgeLength = node_buffer.y;\\nfloat edgeStrength = node_buffer.z;\\nfloat diff = edgeLength - dist;\\nfloat param = (diff * edgeStrength) / mass;\\nax -= direx * param;\\nay -= direy * param;}\\nreturn vec2(ax, ay);}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nint i = globalInvocationID.x;\\nvec4 currentNode = getDatau_Data(i);\\nvec4 movement = getDatau_AveMovement(0.0);\\nfloat ax = 0.0;\\nfloat ay = 0.0;\\nif ((i >= VERTEX_COUNT) || (movement.x < u_minMovement)) {gl_FragColor = vec4(currentNode);\\nreturn ;}\\nvec4 nodeAttributes1 = getDatau_NodeAttributeArray1(i);\\nvec4 nodeAttributes2 = getDatau_NodeAttributeArray2(i);\\nvec2 repulsive = calcRepulsive(i, currentNode);\\nax += repulsive.x;\\nay += repulsive.y;\\nvec2 attractive = calcAttractive(i, currentNode, nodeAttributes1);\\nax += attractive.x;\\nay += attractive.y;\\nvec2 gravity = calcGravity(i, currentNode, nodeAttributes2);\\nax -= gravity.x;\\nay -= gravity.y;\\nfloat param = u_interval * u_damping;\\nfloat vx = ax * param;\\nfloat vy = ay * param;\\nfloat vlength = sqrt((vx * vx) + (vy * vy)) + 0.0001;\\nif (vlength > u_maxSpeed) {float param2 = u_maxSpeed / vlength;\\nvx = param2 * vx;\\nvy = param2 * vy;}\\nif ((nodeAttributes1.w != 0.0) && (nodeAttributes2.w != 0.0)) {gl_FragColor = vec4(vec4(nodeAttributes1.w, nodeAttributes2.w, currentNode.z, 0.0));}else {float distx = vx * u_interval;\\nfloat disty = vy * u_interval;\\nfloat distLength = sqrt((distx * distx) + (disty * disty));\\ngl_FragColor = vec4(vec4(currentNode.x + distx, currentNode.y + disty, currentNode.z, distLength));}if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"MAX_EDGE_PER_VERTEX","type":"Float","runtime":true},{"name":"VERTEX_COUNT","type":"Float","runtime":true},{"name":"SHIFT_20","type":"Float","value":1048576,"runtime":false}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]},{"name":"u_damping","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_maxSpeed","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_minMovement","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_coulombDisScale","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_factor","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray1","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_NodeAttributeArray2","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_interval","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_Data","size":[1,1],"length":1},"needPingpong":true}}',N.aveMovementCode=` const VERTEX_COUNT; @numthreads(1, 1, 1) class CalcAveMovement { @in u_Data: vec4[]; @in u_iter: float; @in @out u_AveMovement: vec4[]; @main compute() { let movement = 0; for (let j: int = 0; j < VERTEX_COUNT; j++) { const vertex = this.u_Data[j]; movement += vertex[3]; } movement = movement / float(VERTEX_COUNT); this.u_AveMovement[0] = [movement, 0, 0, 0]; } } `,N.aveMovementBundle='{"shaders":{"WGSL":"","GLSL450":"","GLSL100":"\\n\\nfloat epsilon = 0.00001;\\nvec2 addrTranslation_1Dto2D(float address1D, vec2 texSize) {\\n vec2 conv_const = vec2(1.0 / texSize.x, 1.0 / (texSize.x * texSize.y));\\n vec2 normAddr2D = float(address1D) * conv_const;\\n return vec2(fract(normAddr2D.x + epsilon), normAddr2D.y);\\n}\\n\\nvoid barrier() {}\\n \\n\\nuniform vec2 u_OutputTextureSize;\\nuniform int u_OutputTexelCount;\\nvarying vec2 v_TexCoord;\\n\\nbool gWebGPUDebug = false;\\nvec4 gWebGPUDebugOutput = vec4(0.0);\\n\\n#define VERTEX_COUNT __DefineValuePlaceholder__VERTEX_COUNT\\n\\nuniform sampler2D u_Data;\\nuniform vec2 u_DataSize;\\nvec4 getDatau_Data(vec2 address2D) {\\n return vec4(texture2D(u_Data, address2D).rgba);\\n}\\nvec4 getDatau_Data(float address1D) {\\n return getDatau_Data(addrTranslation_1Dto2D(address1D, u_DataSize));\\n}\\nvec4 getDatau_Data(int address1D) {\\n return getDatau_Data(float(address1D));\\n}\\nuniform float u_iter;\\nuniform sampler2D u_AveMovement;\\nuniform vec2 u_AveMovementSize;\\nvec4 getDatau_AveMovement(vec2 address2D) {\\n return vec4(texture2D(u_AveMovement, address2D).rgba);\\n}\\nvec4 getDatau_AveMovement(float address1D) {\\n return getDatau_AveMovement(addrTranslation_1Dto2D(address1D, u_AveMovementSize));\\n}\\nvec4 getDatau_AveMovement(int address1D) {\\n return getDatau_AveMovement(float(address1D));\\n}\\nvoid main() {\\nivec3 workGroupSize = ivec3(1, 1, 1);\\nivec3 numWorkGroups = ivec3(1, 1, 1); \\nint globalInvocationIndex = int(floor(v_TexCoord.x * u_OutputTextureSize.x))\\n + int(floor(v_TexCoord.y * u_OutputTextureSize.y)) * int(u_OutputTextureSize.x);\\nint workGroupIDLength = globalInvocationIndex / (workGroupSize.x * workGroupSize.y * workGroupSize.z);\\nivec3 workGroupID = ivec3(workGroupIDLength / numWorkGroups.y / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.z, workGroupIDLength / numWorkGroups.x / numWorkGroups.y);\\nint localInvocationIDZ = globalInvocationIndex / (workGroupSize.x * workGroupSize.y);\\nint localInvocationIDY = (globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y) / workGroupSize.x;\\nint localInvocationIDX = globalInvocationIndex - localInvocationIDZ * workGroupSize.x * workGroupSize.y - localInvocationIDY * workGroupSize.x;\\nivec3 localInvocationID = ivec3(localInvocationIDX, localInvocationIDY, localInvocationIDZ);\\nivec3 globalInvocationID = workGroupID * workGroupSize + localInvocationID;\\nint localInvocationIndex = localInvocationID.z * workGroupSize.x * workGroupSize.y\\n + localInvocationID.y * workGroupSize.x + localInvocationID.x;\\nfloat movement = 0.0;\\nfor (int j = 0; j < VERTEX_COUNT; j++) {vec4 vertex = getDatau_Data(j);\\nmovement += vertex.w;}\\nmovement = movement / float(VERTEX_COUNT);\\ngl_FragColor = vec4(vec4(movement, 0.0, 0.0, 0.0));if (gWebGPUDebug) {\\n gl_FragColor = gWebGPUDebugOutput;\\n}}\\n"},"context":{"name":"","dispatch":[1,1,1],"threadGroupSize":[1,1,1],"maxIteration":1,"defines":[{"name":"VERTEX_COUNT","type":"Float","runtime":true}],"uniforms":[{"name":"u_Data","type":"vec4[]","storageClass":"StorageBuffer","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_iter","type":"Float","storageClass":"Uniform","readonly":true,"writeonly":false,"size":[1,1]},{"name":"u_AveMovement","type":"vec4[]","storageClass":"StorageBuffer","readonly":false,"writeonly":false,"size":[1,1]}],"globalDeclarations":[],"output":{"name":"u_AveMovement","size":[1,1],"length":1},"needPingpong":true}}'},59462:function(Mt,N,F){"use strict";var k=this&&this.__extends||function(){var I=function(T,x){return I=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,v){p.__proto__=v}||function(p,v){for(var g in v)Object.prototype.hasOwnProperty.call(v,g)&&(p[g]=v[g])},I(T,x)};return function(T,x){if(typeof x!="function"&&x!==null)throw new TypeError("Class extends value "+String(x)+" is not a constructor or null");I(T,x);function p(){this.constructor=T}T.prototype=x===null?Object.create(x):(p.prototype=x.prototype,new p)}}();Object.defineProperty(N,"__esModule",{value:!0}),N.GridLayout=void 0;var U=F(44941),L=F(46833),_=function(I){k(T,I);function T(x){var p=I.call(this)||this;return p.begin=[0,0],p.preventOverlap=!0,p.preventOverlapPadding=10,p.condense=!1,p.sortBy="degree",p.nodes=[],p.edges=[],p.width=300,p.height=300,p.row=0,p.col=0,p.cellWidth=0,p.cellHeight=0,p.cellUsed={},p.id2manPos={},p.onLayoutEnd=function(){},p.updateCfg(x),p}return T.prototype.getDefaultCfg=function(){return{begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30}},T.prototype.execute=function(){var x=this,p=x.nodes,v=x.edges,g=x.begin,d=p.length;if(d===0)return x.onLayoutEnd&&x.onLayoutEnd(),{nodes:p,edges:v};if(d===1)return p[0].x=g[0],p[0].y=g[1],x.onLayoutEnd&&x.onLayoutEnd(),{nodes:p,edges:v};var c=x.sortBy,s=x.width,m=x.height,M=x.condense,P=x.preventOverlapPadding,R=x.preventOverlap,j=x.nodeSpacing,Q=x.nodeSize,G=[];p.forEach(function(we){G.push(we)});var W={};if(G.forEach(function(we,Te){W[we.id]=Te}),(c==="degree"||!(0,U.isString)(c)||G[0][c]===void 0)&&(c="degree",(0,U.isNaN)(p[0].degree))){var H=(0,U.getDegree)(G.length,W,v);G.forEach(function(we,Te){we.degree=H[Te].all})}G.sort(function(we,Te){return Te[c]-we[c]}),!s&&typeof window!="undefined"&&(s=window.innerWidth),!m&&typeof window!="undefined"&&(m=window.innerHeight);var Z=x.rows,J=x.cols!=null?x.cols:x.columns;if(x.cells=d,Z!=null&&J!=null?(x.rows=Z,x.cols=J):Z!=null&&J==null?(x.rows=Z,x.cols=Math.ceil(x.cells/x.rows)):Z==null&&J!=null?(x.cols=J,x.rows=Math.ceil(x.cells/x.cols)):(x.splits=Math.sqrt(x.cells*x.height/x.width),x.rows=Math.round(x.splits),x.cols=Math.round(x.width/x.height*x.splits)),x.rows=Math.max(x.rows,1),x.cols=Math.max(x.cols,1),x.cols*x.rows>x.cells){var K=x.small(),ne=x.large();(K-1)*ne>=x.cells?x.small(K-1):(ne-1)*K>=x.cells&&x.large(ne-1)}else for(;x.cols*x.rows=x.cells?x.large(ne+1):x.small(K+1)}if(x.cellWidth=s/x.cols,x.cellHeight=m/x.rows,M&&(x.cellWidth=0,x.cellHeight=0),R||j){var se=(0,U.getFuncByUnknownType)(10,j),fe=(0,U.getFuncByUnknownType)(30,Q,!1);G.forEach(function(we){(!we.x||!we.y)&&(we.x=0,we.y=0);var Te=fe(we)||30,ke,Ge;(0,U.isArray)(Te)?(ke=Te[0],Ge=Te[1]):(ke=Te,Ge=Te);var tt=se!==void 0?se(we):P,He=ke+tt,ft=Ge+tt;x.cellWidth=Math.max(x.cellWidth,He),x.cellHeight=Math.max(x.cellHeight,ft)})}x.cellUsed={},x.row=0,x.col=0,x.id2manPos={};for(var Ie=0;Ie=p&&(x.col=0,x.row++)},T.prototype.getPos=function(x){var p=this,v=p.begin,g=p.cellWidth,d=p.cellHeight,c,s,m=p.id2manPos[x.id];if(m)c=m.col*g+g/2+v[0],s=m.row*d+d/2+v[1];else{for(;p.used(p.row,p.col);)p.moveToNextCell();c=p.col*g+g/2+v[0],s=p.row*d+d/2+v[1],p.use(p.row,p.col),p.moveToNextCell()}x.x=c,x.y=s},T.prototype.getType=function(){return"grid"},T}(L.Base);N.GridLayout=_},68609:function(Mt,N,F){"use strict";var k=this&&this.__createBinding||(Object.create?function(H,Z,J,K){K===void 0&&(K=J);var ne=Object.getOwnPropertyDescriptor(Z,J);(!ne||("get"in ne?!Z.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return Z[J]}}),Object.defineProperty(H,K,ne)}:function(H,Z,J,K){K===void 0&&(K=J),H[K]=Z[J]}),U=this&&this.__exportStar||function(H,Z){for(var J in H)J!=="default"&&!Object.prototype.hasOwnProperty.call(Z,J)&&k(Z,H,J)};Object.defineProperty(N,"__esModule",{value:!0}),N.ERLayout=N.ForceAtlas2Layout=N.ComboCombinedLayout=N.ComboForceLayout=N.GForceGPULayout=N.FruchtermanGPULayout=N.FruchtermanLayout=N.MDSLayout=N.ConcentricLayout=N.RadialLayout=N.DagreCompoundLayout=N.DagreLayout=N.CircularLayout=N.ForceLayout=N.Force2Layout=N.GForceLayout=N.RandomLayout=N.GridLayout=N.Layouts=N.Layout=void 0;var L=F(59462);Object.defineProperty(N,"GridLayout",{enumerable:!0,get:function(){return L.GridLayout}});var _=F(12026);Object.defineProperty(N,"RandomLayout",{enumerable:!0,get:function(){return _.RandomLayout}});var I=F(83254);Object.defineProperty(N,"GForceLayout",{enumerable:!0,get:function(){return I.GForceLayout}});var T=F(41142);Object.defineProperty(N,"Force2Layout",{enumerable:!0,get:function(){return T.Force2Layout}});var x=F(22457);Object.defineProperty(N,"ForceLayout",{enumerable:!0,get:function(){return x.ForceLayout}});var p=F(30716);Object.defineProperty(N,"CircularLayout",{enumerable:!0,get:function(){return p.CircularLayout}});var v=F(95511);Object.defineProperty(N,"DagreLayout",{enumerable:!0,get:function(){return v.DagreLayout}});var g=F(19268);Object.defineProperty(N,"DagreCompoundLayout",{enumerable:!0,get:function(){return g.DagreCompoundLayout}});var d=F(50140);Object.defineProperty(N,"RadialLayout",{enumerable:!0,get:function(){return d.RadialLayout}});var c=F(370);Object.defineProperty(N,"ConcentricLayout",{enumerable:!0,get:function(){return c.ConcentricLayout}});var s=F(67842);Object.defineProperty(N,"MDSLayout",{enumerable:!0,get:function(){return s.MDSLayout}});var m=F(92627);Object.defineProperty(N,"FruchtermanLayout",{enumerable:!0,get:function(){return m.FruchtermanLayout}});var M=F(6851);Object.defineProperty(N,"FruchtermanGPULayout",{enumerable:!0,get:function(){return M.FruchtermanGPULayout}});var P=F(77820);Object.defineProperty(N,"GForceGPULayout",{enumerable:!0,get:function(){return P.GForceGPULayout}});var R=F(80808);Object.defineProperty(N,"ComboForceLayout",{enumerable:!0,get:function(){return R.ComboForceLayout}});var j=F(59506);Object.defineProperty(N,"ComboCombinedLayout",{enumerable:!0,get:function(){return j.ComboCombinedLayout}});var Q=F(54255);Object.defineProperty(N,"ForceAtlas2Layout",{enumerable:!0,get:function(){return Q.ForceAtlas2Layout}});var G=F(71443);Object.defineProperty(N,"ERLayout",{enumerable:!0,get:function(){return G.ERLayout}});var W=F(29382);Object.defineProperty(N,"Layout",{enumerable:!0,get:function(){return W.Layout}}),Object.defineProperty(N,"Layouts",{enumerable:!0,get:function(){return W.Layouts}}),U(F(74007),N)},29382:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.Layouts=N.Layout=void 0;var k=F(56559),U=F(59462),L=F(12026),_=F(41142),I=F(83254),T=F(22457),x=F(30716),p=F(95511),v=F(50140),g=F(370),d=F(67842),c=F(92627),s=F(6851),m=F(77820),M=F(80808),P=F(59506),R=F(54255),j=F(71443),Q=F(19268),G=F(44941),W=function(){function H(Z){var J=(0,k.getLayoutByName)(Z.type);this.layoutInstance=new J(Z)}return H.prototype.layout=function(Z){return this.layoutInstance.layout(Z)},H.prototype.updateCfg=function(Z){this.layoutInstance.updateCfg(Z)},H.prototype.init=function(Z){this.correctLayers(Z.nodes),this.layoutInstance.init(Z)},H.prototype.correctLayers=function(Z){if(Z!=null&&Z.length){var J=1/0,K=[];if(Z.forEach(function(se){(0,G.isString)(se.layer)&&(se.layer=parseInt(se.layer,10)),!(se.layer===void 0||isNaN(se.layer))&&(K.push(se),se.layerP[0]?P[0]:ne-P[0],Ie=se-P[1]>P[1]?P[1]:se-P[1];fe===0&&(fe=ne/2),Ie===0&&(Ie=se/2);var ye=Ie>fe?fe:Ie,Ae=Math.max.apply(Math,K),Se=[];K.forEach(function(dt,pt){s.unitRadius||(s.unitRadius=ye/Ae),Se[pt]=dt*s.unitRadius}),s.radii=Se;var we=s.eIdealDisMatrix();s.eIdealDistances=we;var Te=x(we);if(s.weights=Te,s.initWithMDS){var ke=new I.default({linkDistance:R,distances:we}),Ge=ke.layout();Ge.forEach(function(dt){(0,L.isNaN)(dt[0])&&(dt[0]=Math.random()*R),(0,L.isNaN)(dt[1])&&(dt[1]=Math.random()*R)}),s.positions=Ge}else s.positions=m.map(function(dt,pt){return[(Math.random()-.5)*we[pt][W],(Math.random()-.5)*we[pt][W]]});s.positions.forEach(function(dt,pt){m[pt].x=dt[0]+P[0],m[pt].y=dt[1]+P[1]}),s.positions.forEach(function(dt){dt[0]-=s.positions[W][0],dt[1]-=s.positions[W][1]}),s.run();var tt=s.preventOverlap,He=s.nodeSize,ft,Lt=s.strictRadial;if(tt){var Jt=s.nodeSpacing,Qe;(0,L.isNumber)(Jt)?Qe=function(){return Jt}:(0,L.isFunction)(Jt)?Qe=Jt:Qe=function(){return 0},He?(0,L.isArray)(He)?ft=function(dt){var pt=He[0]>He[1]?He[0]:He[1];return pt+Qe(dt)}:ft=function(dt){return He+Qe(dt)}:ft=function(dt){if(dt.size){if((0,L.isArray)(dt.size)){var pt=dt.size[0]>dt.size[1]?dt.size[0]:dt.size[1];return pt+Qe(dt)}if((0,L.isObject)(dt.size)){var pt=dt.size.width>dt.size.height?dt.size.width:dt.size.height;return pt+Qe(dt)}return dt.size+Qe(dt)}return 10+Qe(dt)};var ut={nodes:m,nodeSizeFunc:ft,adjMatrix:H,positions:s.positions,radii:Se,height:se,width:ne,strictRadial:Lt,focusID:W,iterations:s.maxPreventOverlapIteration||200,k:s.positions.length/4.5},xt=new T.default(ut);s.positions=xt.layout()}return s.positions.forEach(function(dt,pt){m[pt].x=dt[0]+P[0],m[pt].y=dt[1]+P[1]}),s.onLayoutEnd&&s.onLayoutEnd(),{nodes:m,edges:M}},c.prototype.run=function(){for(var s=this,m=s.maxIteration,M=s.positions||[],P=s.weights||[],R=s.eIdealDistances||[],j=s.radii||[],Q=0;Q<=m;Q++){var G=Q/m;s.oneIteration(G,M,j,R,P)}},c.prototype.oneIteration=function(s,m,M,P,R){var j=this,Q=1-s,G=j.focusIndex;m.forEach(function(W,H){var Z=v(W,[0,0]),J=Z===0?0:1/Z;if(H!==G){var K=0,ne=0,se=0;m.forEach(function(Ie,ye){if(H!==ye){var Ae=v(W,Ie),Se=Ae===0?0:1/Ae,we=P[ye][H];se+=R[H][ye],K+=R[H][ye]*(Ie[0]+we*(W[0]-Ie[0])*Se),ne+=R[H][ye]*(Ie[1]+we*(W[1]-Ie[1])*Se)}});var fe=M[H]===0?0:1/M[H];se*=Q,se+=s*fe*fe,K*=Q,K+=s*fe*W[0]*J,W[0]=K/se,ne*=Q,ne+=s*fe*W[1]*J,W[1]=ne/se}})},c.prototype.eIdealDisMatrix=function(){var s=this,m=s.nodes;if(!m)return[];var M=s.distances,P=s.linkDistance,R=s.radii||[],j=s.unitRadius||50,Q=[];return M&&M.forEach(function(G,W){var H=[];G.forEach(function(Z,J){if(W===J)H.push(0);else if(R[W]===R[J])if(s.sortBy==="data")H.push(Z*(Math.abs(W-J)*s.sortStrength)/(R[W]/j));else if(s.sortBy){var K=m[W][s.sortBy]||0,ne=m[J][s.sortBy]||0;(0,L.isString)(K)&&(K=K.charCodeAt(0)),(0,L.isString)(ne)&&(ne=ne.charCodeAt(0)),H.push(Z*(Math.abs(K-ne)*s.sortStrength)/(R[W]/j))}else H.push(Z*P/(R[W]/j));else{var se=(P+j)/2;H.push(Z*se)}}),Q.push(H)}),Q},c.prototype.handleInfinity=function(s,m,M){for(var P=s.length,R=0;RM?s[m][P]:M);return M},c.prototype.getType=function(){return"radial"},c}(_.Base);N.RadialLayout=g},96716:function(Mt,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0});var F=800,k=function(){function U(L){this.disp=[],this.positions=L.positions,this.adjMatrix=L.adjMatrix,this.focusID=L.focusID,this.radii=L.radii,this.iterations=L.iterations||10,this.height=L.height||10,this.width=L.width||10,this.speed=L.speed||100,this.gravity=L.gravity||10,this.nodeSizeFunc=L.nodeSizeFunc,this.k=L.k||5,this.strictRadial=L.strictRadial,this.nodes=L.nodes}return U.prototype.layout=function(){var L=this,_=L.positions,I=[],T=L.iterations,x=L.width/10;L.maxDisplace=x,L.disp=I;for(var p=0;pc?1:-1;s=.01*P,m=.01*P}if(MMath.PI/2&&(Q-=Math.PI/2,P*=-1,R*=-1);var G=Math.cos(Q)*j;d.x=P*G,d.y=R*G});var g=L.radii;_.forEach(function(d,c){if(c!==p){var s=Math.sqrt(I[c].x*I[c].x+I[c].y*I[c].y);if(s>0&&c!==p){var m=Math.min(v*(T/F),s);if(d[0]+=I[c].x/s*m,d[1]+=I[c].y/s*m,x){var M=d[0]-_[p][0],P=d[1]-_[p][1],R=Math.sqrt(M*M+P*P);M=M/R*g[c],P=P/R*g[c],d[0]=_[p][0]+M,d[1]=_[p][1]+P}}}})},U}();N.default=k},12026:function(Mt,N,F){"use strict";var k=this&&this.__extends||function(){var _=function(I,T){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,p){x.__proto__=p}||function(x,p){for(var v in p)Object.prototype.hasOwnProperty.call(p,v)&&(x[v]=p[v])},_(I,T)};return function(I,T){if(typeof T!="function"&&T!==null)throw new TypeError("Class extends value "+String(T)+" is not a constructor or null");_(I,T);function x(){this.constructor=I}I.prototype=T===null?Object.create(T):(x.prototype=T.prototype,new x)}}();Object.defineProperty(N,"__esModule",{value:!0}),N.RandomLayout=void 0;var U=F(46833),L=function(_){k(I,_);function I(T){var x=_.call(this)||this;return x.center=[0,0],x.width=300,x.height=300,x.nodes=[],x.edges=[],x.onLayoutEnd=function(){},x.updateCfg(T),x}return I.prototype.getDefaultCfg=function(){return{center:[0,0],width:300,height:300}},I.prototype.execute=function(){var T=this,x=T.nodes,p=.9,v=T.center;return!T.width&&typeof window!="undefined"&&(T.width=window.innerWidth),!T.height&&typeof window!="undefined"&&(T.height=window.innerHeight),x&&x.forEach(function(g){g.x=(Math.random()-.5)*p*T.width+v[0],g.y=(Math.random()-.5)*p*T.height+v[1]}),T.onLayoutEnd&&T.onLayoutEnd(),{nodes:x,edges:this.edges}},I.prototype.getType=function(){return"random"},I}(U.Base);N.RandomLayout=L},74007:function(Mt,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0})},56559:function(Mt,N,F){"use strict";var k=this&&this.__extends||function(){var p=function(v,g){return p=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,c){d.__proto__=c}||function(d,c){for(var s in c)Object.prototype.hasOwnProperty.call(c,s)&&(d[s]=c[s])},p(v,g)};return function(v,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");p(v,g);function d(){this.constructor=v}v.prototype=g===null?Object.create(g):(d.prototype=g.prototype,new d)}}();Object.defineProperty(N,"__esModule",{value:!0}),N.getLayoutByName=N.unRegisterLayout=N.registerLayout=void 0;var U=F(46833),L=F(44941),_=new Map,I=function(p,v){if(_.get(p)&&console.warn("The layout with the name ".concat(p," exists already, it will be overridden")),(0,L.isObject)(v)){var g=function(d){k(c,d);function c(s){var m=this,M;m=d.call(this)||this;var P=m,R={},j=Object.assign({},P.getDefaultCfg(),((M=v.getDefaultCfg)===null||M===void 0?void 0:M.call(v))||{});return Object.assign(R,j,v,s),Object.keys(R).forEach(function(Q){var G=R[Q];P[Q]=G}),m}return c}(U.Base);_.set(p,g)}else _.set(p,v);return _.get(p)};N.registerLayout=I;var T=function(p){_.has(p)&&_.delete(p)};N.unRegisterLayout=T;var x=function(p){return _.has(p)?_.get(p):null};N.getLayoutByName=x},26422:function(Mt,N){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.isArray=void 0,N.isArray=Array.isArray},62400:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.getFuncByUnknownType=N.getFunc=N.isFunction=void 0;var k=F(44941),U=F(17679),L=function(T){return typeof T=="function"};N.isFunction=L;var _=function(T,x,p){var v;return p?v=p:(0,U.isNumber)(T)?v=function(){return T}:v=function(){return x},v};N.getFunc=_;var I=function(T,x,p){return p===void 0&&(p=!0),!x&&x!==0?function(v){return v.size?(0,k.isArray)(v.size)?v.size[0]>v.size[1]?v.size[0]:v.size[1]:(0,k.isObject)(v.size)?v.size.width>v.size.height?v.size.width:v.size.height:v.size:T}:(0,N.isFunction)(x)?x:(0,U.isNumber)(x)?function(){return x}:(0,k.isArray)(x)?function(){if(p){var v=Math.max.apply(Math,x);return isNaN(v)?T:v}return x}:(0,k.isObject)(x)?function(){if(p){var v=Math.max(x.width,x.height);return isNaN(v)?T:v}return[x.width,x.height]}:function(){return T}};N.getFuncByUnknownType=I},50793:function(Mt,N,F){"use strict";Object.defineProperty(N,"__esModule",{value:!0}),N.arrayToTextureData=N.attributesToTextureData=N.buildTextureDataWithTwoEdgeAttr=N.buildTextureData=N.proccessToFunc=void 0;var k=F(44941),U=F(13892),L=function(p,v){var g;return p?(0,k.isNumber)(p)?g=function(){return p}:g=p:g=function(){return v||1},g};N.proccessToFunc=L;var _=function(p,v){var g=[],d=[],c={},s=0;for(s=0;sQ[W][Z]+Q[Z][H]&&(Q[W][H]=Q[W][Z]+Q[Z][H]);return Q};N.floydWarshall=x;var p=function(j,Q){var G=j.nodes,W=j.edges,H=[],Z={};if(!G)throw new Error("invalid nodes data!");return G&&G.forEach(function(J,K){Z[J.id]=K;var ne=[];H.push(ne)}),W==null||W.forEach(function(J){var K=(0,N.getEdgeTerminal)(J,"source"),ne=(0,N.getEdgeTerminal)(J,"target"),se=Z[K],fe=Z[ne];se===void 0||fe===void 0||(H[se][fe]=1,Q||(H[fe][se]=1))}),H};N.getAdjMatrix=p;var v=function(j,Q){var G=[];return j.forEach(function(W){var H=[];W.forEach(function(Z){H.push(Z*Q)}),G.push(H)}),G};N.scaleMatrix=v;var g=function(j,Q){if(j&&j.children){for(var G=j.children.length-1;G>=0;G--)if(!g(j.children[G],Q))return}return!!Q(j)},d=function(j,Q){typeof Q=="function"&&g(j,Q)};N.traverseTreeUp=d;var c=function(j){var Q=1/0,G=1/0,W=-1/0,H=-1/0;return j.forEach(function(Z){var J=Z.size;(0,k.isArray)(J)?J.length===1&&(J=[J[0],J[0]]):(0,U.isNumber)(J)?J=[J,J]:(J===void 0||isNaN(J))&&(J=[30,30]);var K=[J[0]/2,J[1]/2],ne=Z.x-K[0],se=Z.x+K[0],fe=Z.y-K[1],Ie=Z.y+K[1];Q>ne&&(Q=ne),G>fe&&(G=fe),W=0;return s?M?Math.PI*2-m:m:M?m:Math.PI*2-m}k=v;function g(d,c,s){return s?(d[0]=c[1],d[1]=-1*c[0]):(d[0]=-1*c[1],d[1]=c[0]),d}k=g},50037:function(Mt,N,F){"use strict";F.r(N),F.d(N,{Cache:function(){return as},angleTo:function(){return fe},arcToCubic:function(){return Oe},assign:function(){return Bo},augment:function(){return vi},clamp:function(){return So.Z},clearAnimationFrame:function(){return yu},clone:function(){return Xs},clonePath:function(){return Sr},contains:function(){return Le},createDOM:function(){return Af},debounce:function(){return xf},deepMix:function(){return ac},difference:function(){return nr},direction:function(){return se},distanceSquareRoot:function(){return Rn},each:function(){return lr},endsWith:function(){return to},equalizeSegments:function(){return X},every:function(){return Ru},extend:function(){return Vi},filter:function(){return qe},find:function(){return In},findIndex:function(){return D},firstValue:function(){return xe},fixedBase:function(){return di},flatten:function(){return De},flattenDeep:function(){return Je},forIn:function(){return Jo},get:function(){return io},getDrawDirection:function(){return Wn},getPathArea:function(){return un},getPathBBox:function(){return Cn},getPathBBoxTotalLength:function(){return oa},getPointAtLength:function(){return Y},getRange:function(){return ir},getRotatedCurve:function(){return xn},getTotalLength:function(){return Sn},getType:function(){return qo},getWrapBehavior:function(){return ro},gradient:function(){return m},group:function(){return $i},groupBy:function(){return Ho},groupToMap:function(){return zi},has:function(){return vs},hasKey:function(){return Bu},hasValue:function(){return yo},head:function(){return Ki},identity:function(){return Ku},includes:function(){return Le},indexOf:function(){return wf},isArguments:function(){return du},isArray:function(){return Ur},isArrayLike:function(){return Me},isBoolean:function(){return Uu},isDate:function(){return ao},isDecimal:function(){return hi},isElement:function(){return gu},isEmpty:function(){return Hu},isEqual:function(){return ms},isEqualWith:function(){return Zu},isError:function(){return Xu},isEven:function(){return Vn},isFinite:function(){return vu},isFunction:function(){return I},isInteger:function(){return qa},isMatch:function(){return ea},isNegative:function(){return bi},isNil:function(){return Ft.Z},isNull:function(){return pf},isNumber:function(){return mi.Z},isNumberEqual:function(){return go},isObject:function(){return Ct},isObjectLike:function(){return Tn},isOdd:function(){return Mo},isPlainObject:function(){return Zn},isPointInPolygon:function(){return na},isPointInStroke:function(){return C},isPolygonsIntersect:function(){return If},isPositive:function(){return su},isPrototype:function(){return Gs},isRegExp:function(){return mf},isString:function(){return Kn},isType:function(){return er.Z},isUndefined:function(){return zs},keys:function(){return br},last:function(){return Si},lowerCase:function(){return cu},lowerFirst:function(){return ps},map:function(){return ii},mapValues:function(){return bs},max:function(){return lt},maxBy:function(){return gf},memoize:function(){return T},min:function(){return Tt},minBy:function(){return uu},mix:function(){return Bo},mod:function(){return dn},modifyCSS:function(){return oo},noop:function(){return mu},normalizePath:function(){return It},number2color:function(){return vo},omit:function(){return Co},parseRadius:function(){return Ca},path2Absolute:function(){return Nr},path2Curve:function(){return rn},path2String:function(){return Ae},pick:function(){return Mf},pull:function(){return jn},pullAt:function(){return ya},reduce:function(){return bo},remove:function(){return Fi},requestAnimationFrame:function(){return pu},reverseCurve:function(){return qr},rgb2arr:function(){return k},set:function(){return ns},size:function(){return $u},some:function(){return ri},sortBy:function(){return Ei},startsWith:function(){return On},substitute:function(){return Gu},throttle:function(){return ic},toArray:function(){return oc},toCSSGradient:function(){return Q},toDegree:function(){return Ps},toInteger:function(){return $o},toRGB:function(){return d},toRadian:function(){return Qo},toString:function(){return gs},transform:function(){return K},union:function(){return Yo},uniq:function(){return eo},uniqueId:function(){return Cf},upperCase:function(){return ko},upperFirst:function(){return zu},values:function(){return Fa},valuesOfKey:function(){return Po},vertical:function(){return Ie},wrapBehavior:function(){return Ui}});function k(q){return[parseInt(q.substr(1,2),16),parseInt(q.substr(3,2),16),parseInt(q.substr(5,2),16)]}function U(q){var de=Math.round(q).toString(16);return de.length===1?"0"+de:de}function L(q){return"#"+U(q[0])+U(q[1])+U(q[2])}function _(q){var de,Ee,Pe,je=q||1;function bt(jt,vr){++de>je&&(Pe=Ee,St(1),++de),Ee[jt]=vr}function St(jt){de=0,Ee=Object.create(null),jt||(Pe=Object.create(null))}return St(),{clear:St,has:function(jt){return Ee[jt]!==void 0||Pe[jt]!==void 0},get:function(jt){var vr=Ee[jt];if(vr!==void 0)return vr;if((vr=Pe[jt])!==void 0)return bt(jt,vr),vr},set:function(jt,vr){Ee[jt]!==void 0?Ee[jt]=vr:bt(jt,vr)}}}var I=function(q){return typeof q=="function"},T=function(q,de,Ee){if(Ee===void 0&&(Ee=128),!I(q))throw new TypeError("Expected a function");var Pe=function(){for(var je=[],bt=0;bt1?1:Number(de),Pe=q.length-1,je=Math.floor(Pe*Ee),bt=Pe*Ee-je,St=q[je],jt=je===Pe?St:q[je+1];return L([c(St,jt,bt,0),c(St,jt,bt,1),c(St,jt,bt,2)])}function m(q){var de=typeof q=="string"?q.split("-"):q,Ee=de.map(function(Pe){return k(Pe.indexOf("#")===-1?d(Pe):Pe)});return function(Pe){return s(Ee,Pe)}}var M=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,P=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,R=/[\d.]+:(#[^\s]+|[^)]+\))/gi;function j(q){return/^[r,R,L,l]{1}[\s]*\(/.test(q)}function Q(q){if(j(q)){var de,Ee=void 0;if(q[0]==="l"){var Pe=M.exec(q),je=+Pe[1]+90;Ee=Pe[2],de="linear-gradient("+je+"deg, "}else if(q[0]==="r"){de="radial-gradient(";var Pe=P.exec(q);Ee=Pe[4]}var bt=Ee.match(R);return bt.forEach(function(St,jt){var vr=St.split(":");de+=vr[1]+" "+Number(vr[0])*100+"%",jt!==bt.length-1&&(de+=", ")}),de+=")",de}return q}var G=F(73485);function W(q,de,Ee){var Pe=[0,0,0,0,0,0,0,0,0];return G.fromTranslation(Pe,Ee),G.multiply(q,Pe,de)}function H(q,de,Ee){var Pe=[0,0,0,0,0,0,0,0,0];return G.fromRotation(Pe,Ee),G.multiply(q,Pe,de)}function Z(q,de,Ee){var Pe=[0,0,0,0,0,0,0,0,0];return G.fromScaling(Pe,Ee),G.multiply(q,Pe,de)}function J(q,de,Ee){return G.multiply(q,Ee,de)}function K(q,de){for(var Ee=q?[].concat(q):[1,0,0,0,1,0,0,0,1],Pe=0,je=de.length;Pe=0;return Ee?je?Math.PI*2-Pe:Pe:je?Pe:Math.PI*2-Pe}function Ie(q,de,Ee){return Ee?(q[0]=de[1],q[1]=-1*de[0]):(q[0]=-1*de[1],q[1]=de[0]),q}function ye(q,de){if(de==="off")return[].concat(q);var Ee=typeof de=="number"&&de>=1?Math.pow(10,de):1;return q.map(function(Pe){var je=Pe.slice(1).map(Number).map(function(bt){return de?Math.round(bt*Ee)/Ee:Math.round(bt)});return[Pe[0]].concat(je)})}function Ae(q,de){return de===void 0&&(de="off"),ye(q,de).map(function(Ee){return Ee[0]+Ee.slice(1).join(" ")}).join("")}var Se=F(99938),we={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function Te(q,de,Ee){if(q[Ee].length>7){q[Ee].shift();for(var Pe=q[Ee],je=Ee;Pe.length;)de[Ee]="A",q.splice(je+=1,0,["C"].concat(Pe.splice(0,6)));q.splice(Ee,1)}}var ke={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function Ge(q){return Array.isArray(q)&&q.every(function(de){var Ee=de[0].toLowerCase();return ke[Ee]===de.length-1&&"achlmqstvz".includes(Ee)})}function tt(q){return Ge(q)&&q.every(function(de){var Ee=de[0];return Ee===Ee.toUpperCase()})}function He(q){return tt(q)&&q.every(function(de){var Ee=de[0];return"ACLMQZ".includes(Ee)})}function ft(q){for(var de=q.pathValue[q.segmentStart],Ee=de.toLowerCase(),Pe=q.data;Pe.length>=ke[Ee]&&(Ee==="m"&&Pe.length>2?(q.segments.push([de].concat(Pe.splice(0,2))),Ee="l",de=de==="m"?"l":"L"):q.segments.push([de].concat(Pe.splice(0,ke[Ee]))),!!ke[Ee]););}function Lt(q){var de=q.index,Ee=q.pathValue,Pe=Ee.charCodeAt(de);if(Pe===48){q.param=0,q.index+=1;return}if(Pe===49){q.param=1,q.index+=1;return}q.err='[path-util]: invalid Arc flag "'+Ee[de]+'", expecting 0 or 1 at index '+de}function Jt(q){return q>=48&&q<=57||q===43||q===45||q===46}function Qe(q){return q>=48&&q<=57}function ut(q){var de=q.max,Ee=q.pathValue,Pe=q.index,je=Pe,bt=!1,St=!1,jt=!1,vr=!1,xr;if(je>=de){q.err="[path-util]: Invalid path value at index "+je+', "pathValue" is missing param';return}if(xr=Ee.charCodeAt(je),(xr===43||xr===45)&&(je+=1,xr=Ee.charCodeAt(je)),!Qe(xr)&&xr!==46){q.err="[path-util]: Invalid path value at index "+je+', "'+Ee[je]+'" is not a number';return}if(xr!==46){if(bt=xr===48,je+=1,xr=Ee.charCodeAt(je),bt&&je=5760&&de.includes(q)}function dt(q){for(var de=q.pathValue,Ee=q.max;q.index0;St-=1){if(wt(je)&&(St===3||St===4)?Lt(q):ut(q),q.err.length)return;q.data.push(q.param),dt(q),q.index=q.max||!Jt(Ee.charCodeAt(q.index)))break}ft(q)}var ur=function(){function q(de){this.pathValue=de,this.segments=[],this.max=de.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return q}();function Ir(q){if(Ge(q))return[].concat(q);var de=new ur(q);for(dt(de);de.index1&&(ha=Math.sqrt(ha),tn*=ha,Gn*=ha);var Pa=tn*tn,Qa=Gn*Gn,Ya=(bt===St?-1:1)*Math.sqrt(Math.abs((Pa*Qa-Pa*Ma*Ma-Qa*Da*Da)/(Pa*Ma*Ma+Qa*Da*Da)));Qn=Ya*tn*Ma/Gn+($r+$n)/2,ga=Ya*-Gn*Da/tn+(an+Dn)/2,Xn=Math.asin(((an-ga)/Gn*Math.pow(10,9)>>0)/Math.pow(10,9)),bn=Math.asin(((Dn-ga)/Gn*Math.pow(10,9)>>0)/Math.pow(10,9)),Xn=$rbn&&(Xn-=Math.PI*2),!St&&bn>Xn&&(bn-=Math.PI*2)}var zo=bn-Xn;if(Math.abs(zo)>Nn){var Qu=bn,To=$n,$s=Dn;bn=Xn+Nn*(St&&bn>Xn?1:-1),$n=Qn+tn*Math.cos(bn),Dn=ga+Gn*Math.sin(bn),pn=Oe($n,Dn,tn,Gn,je,0,St,To,$s,[bn,Qu,Qn,ga])}zo=bn-Xn;var Qi=Math.cos(Xn),Io=Math.sin(Xn),wu=Math.cos(bn),sc=Math.sin(bn),Qs=Math.tan(zo/4),ei=4/3*tn*Qs,Of=4/3*Gn*Qs,ws=[$r,an],Ss=[$r+ei*Io,an-Of*Qi],Ju=[$n+ei*sc,Dn-Of*wu],so=[$n,Dn];if(Ss[0]=2*ws[0]-Ss[0],Ss[1]=2*ws[1]-Ss[1],xr)return Ss.concat(Ju,so,pn);pn=Ss.concat(Ju,so,pn);for(var qu=[],Uo=0,_s=pn.length;Uo<_s;Uo+=1)qu[Uo]=Uo%2?ar(pn[Uo-1],pn[Uo],zn).y:ar(pn[Uo],pn[Uo+1],zn).x;return qu}function Pr(q,de,Ee,Pe,je,bt){var St=.3333333333333333,jt=2/3;return[St*q+jt*Ee,St*de+jt*Pe,St*je+jt*Ee,St*bt+jt*Pe,je,bt]}function Cr(q,de,Ee){var Pe=q[0],je=q[1],bt=de[0],St=de[1];return[Pe+(bt-Pe)*Ee,je+(St-je)*Ee]}var Gr=function(q,de,Ee,Pe){var je=.5,bt=Cr([q,de],[Ee,Pe],je);return(0,Se.__spreadArray)((0,Se.__spreadArray)([],bt,!0),[Ee,Pe,Ee,Pe],!1)};function mr(q,de){var Ee=q[0],Pe=q.slice(1).map(Number),je=Pe[0],bt=Pe[1],St,jt=de.x1,vr=de.y1,xr=de.x,$r=de.y;switch("TQ".includes(Ee)||(de.qx=null,de.qy=null),Ee){case"M":return de.x=je,de.y=bt,q;case"A":return St=[jt,vr].concat(Pe),["C"].concat(Oe(St[0],St[1],St[2],St[3],St[4],St[5],St[6],St[7],St[8],St[9]));case"Q":return de.qx=je,de.qy=bt,St=[jt,vr].concat(Pe),["C"].concat(Pr(St[0],St[1],St[2],St[3],St[4],St[5]));case"L":return["C"].concat(Gr(jt,vr,je,bt));case"Z":return jt===xr&&vr===$r?["C",jt,vr,xr,$r,xr,$r]:["C"].concat(Gr(jt,vr,xr,$r));default:}return q}function rn(q,de){if(de===void 0&&(de=!1),qt(q)){var Ee=[].concat(q);return de?[Ee,[]]:Ee}for(var Pe=It(q),je=(0,Se.__assign)({},we),bt=[],St="",jt=Pe.length,vr,xr,$r=[],an=0;an=bt)St={x:Ee,y:Pe};else{var jt=Cr([q,de],[Ee,Pe],je/bt),vr=jt[0],xr=jt[1];St={x:vr,y:xr}}return{length:bt,point:St,min:{x:Math.min(q,Ee),y:Math.min(de,Pe)},max:{x:Math.max(q,Ee),y:Math.max(de,Pe)}}}function zr(q,de){var Ee=q.x,Pe=q.y,je=de.x,bt=de.y,St=Ee*je+Pe*bt,jt=Math.sqrt((Math.pow(Ee,2)+Math.pow(Pe,2))*(Math.pow(je,2)+Math.pow(bt,2))),vr=Ee*bt-Pe*je<0?-1:1,xr=vr*Math.acos(St/jt);return xr}function Rt(q,de,Ee,Pe,je,bt,St,jt,vr,xr){var $r=Math.abs,an=Math.sin,tn=Math.cos,Gn=Math.sqrt,$n=Math.PI,Dn=$r(Ee),Nn=$r(Pe),zn=(je%360+360)%360,pn=zn*($n/180);if(q===jt&&de===vr)return{x:q,y:de};if(Dn===0||Nn===0)return yn(q,de,jt,vr,xr).point;var Yn=(q-jt)/2,Xn=(de-vr)/2,bn={x:tn(pn)*Yn+an(pn)*Xn,y:-an(pn)*Yn+tn(pn)*Xn},Qn=Math.pow(bn.x,2)/Math.pow(Dn,2)+Math.pow(bn.y,2)/Math.pow(Nn,2);Qn>1&&(Dn*=Gn(Qn),Nn*=Gn(Qn));var ga=Math.pow(Dn,2)*Math.pow(Nn,2)-Math.pow(Dn,2)*Math.pow(bn.y,2)-Math.pow(Nn,2)*Math.pow(bn.x,2),Da=Math.pow(Dn,2)*Math.pow(bn.y,2)+Math.pow(Nn,2)*Math.pow(bn.x,2),Ma=ga/Da;Ma=Ma<0?0:Ma;var ha=(bt!==St?1:-1)*Gn(Ma),Pa={x:ha*(Dn*bn.y/Nn),y:ha*(-(Nn*bn.x)/Dn)},Qa={x:tn(pn)*Pa.x-an(pn)*Pa.y+(q+jt)/2,y:an(pn)*Pa.x+tn(pn)*Pa.y+(de+vr)/2},Ya={x:(bn.x-Pa.x)/Dn,y:(bn.y-Pa.y)/Nn},zo=zr({x:1,y:0},Ya),Qu={x:(-bn.x-Pa.x)/Dn,y:(-bn.y-Pa.y)/Nn},To=zr(Ya,Qu);!St&&To>0?To-=2*$n:St&&To<0&&(To+=2*$n),To%=2*$n;var $s=zo+To*xr,Qi=Dn*tn($s),Io=Nn*an($s),wu={x:tn(pn)*Qi-an(pn)*Io+Qa.x,y:an(pn)*Qi+tn(pn)*Io+Qa.y};return wu}function zt(q,de,Ee,Pe,je,bt,St,jt,vr,xr,$r){var an,tn=$r.bbox,Gn=tn===void 0?!0:tn,$n=$r.length,Dn=$n===void 0?!0:$n,Nn=$r.sampleSize,zn=Nn===void 0?30:Nn,pn=typeof xr=="number",Yn=q,Xn=de,bn=0,Qn=[Yn,Xn,bn],ga=[Yn,Xn],Da=0,Ma={x:0,y:0},ha=[{x:Yn,y:Xn}];pn&&xr<=0&&(Ma={x:Yn,y:Xn});for(var Pa=0;Pa<=zn;Pa+=1){if(Da=Pa/zn,an=Rt(q,de,Ee,Pe,je,bt,St,jt,vr,Da),Yn=an.x,Xn=an.y,Gn&&ha.push({x:Yn,y:Xn}),Dn&&(bn+=Rn(ga,[Yn,Xn])),ga=[Yn,Xn],pn&&bn>=xr&&xr>Qn[2]){var Qa=(bn-xr)/(bn-Qn[2]);Ma={x:ga[0]*(1-Qa)+Qn[0]*Qa,y:ga[1]*(1-Qa)+Qn[1]*Qa}}Qn=[Yn,Xn,bn]}return pn&&xr>=bn&&(Ma={x:jt,y:vr}),{length:bn,point:Ma,min:{x:Math.min.apply(null,ha.map(function(Ya){return Ya.x})),y:Math.min.apply(null,ha.map(function(Ya){return Ya.y}))},max:{x:Math.max.apply(null,ha.map(function(Ya){return Ya.x})),y:Math.max.apply(null,ha.map(function(Ya){return Ya.y}))}}}function Vt(q,de,Ee,Pe,je,bt,St,jt,vr){var xr=1-vr;return{x:Math.pow(xr,3)*q+3*Math.pow(xr,2)*vr*Ee+3*xr*Math.pow(vr,2)*je+Math.pow(vr,3)*St,y:Math.pow(xr,3)*de+3*Math.pow(xr,2)*vr*Pe+3*xr*Math.pow(vr,2)*bt+Math.pow(vr,3)*jt}}function hr(q,de,Ee,Pe,je,bt,St,jt,vr,xr){var $r,an=xr.bbox,tn=an===void 0?!0:an,Gn=xr.length,$n=Gn===void 0?!0:Gn,Dn=xr.sampleSize,Nn=Dn===void 0?10:Dn,zn=typeof vr=="number",pn=q,Yn=de,Xn=0,bn=[pn,Yn,Xn],Qn=[pn,Yn],ga=0,Da={x:0,y:0},Ma=[{x:pn,y:Yn}];zn&&vr<=0&&(Da={x:pn,y:Yn});for(var ha=0;ha<=Nn;ha+=1){if(ga=ha/Nn,$r=Vt(q,de,Ee,Pe,je,bt,St,jt,ga),pn=$r.x,Yn=$r.y,tn&&Ma.push({x:pn,y:Yn}),$n&&(Xn+=Rn(Qn,[pn,Yn])),Qn=[pn,Yn],zn&&Xn>=vr&&vr>bn[2]){var Pa=(Xn-vr)/(Xn-bn[2]);Da={x:Qn[0]*(1-Pa)+bn[0]*Pa,y:Qn[1]*(1-Pa)+bn[1]*Pa}}bn=[pn,Yn,Xn]}return zn&&vr>=Xn&&(Da={x:St,y:jt}),{length:Xn,point:Da,min:{x:Math.min.apply(null,Ma.map(function(Qa){return Qa.x})),y:Math.min.apply(null,Ma.map(function(Qa){return Qa.y}))},max:{x:Math.max.apply(null,Ma.map(function(Qa){return Qa.x})),y:Math.max.apply(null,Ma.map(function(Qa){return Qa.y}))}}}function Ar(q,de,Ee,Pe,je,bt,St){var jt=1-St;return{x:Math.pow(jt,2)*q+2*jt*St*Ee+Math.pow(St,2)*je,y:Math.pow(jt,2)*de+2*jt*St*Pe+Math.pow(St,2)*bt}}function en(q,de,Ee,Pe,je,bt,St,jt){var vr,xr=jt.bbox,$r=xr===void 0?!0:xr,an=jt.length,tn=an===void 0?!0:an,Gn=jt.sampleSize,$n=Gn===void 0?10:Gn,Dn=typeof St=="number",Nn=q,zn=de,pn=0,Yn=[Nn,zn,pn],Xn=[Nn,zn],bn=0,Qn={x:0,y:0},ga=[{x:Nn,y:zn}];Dn&&St<=0&&(Qn={x:Nn,y:zn});for(var Da=0;Da<=$n;Da+=1){if(bn=Da/$n,vr=Ar(q,de,Ee,Pe,je,bt,bn),Nn=vr.x,zn=vr.y,$r&&ga.push({x:Nn,y:zn}),tn&&(pn+=Rn(Xn,[Nn,zn])),Xn=[Nn,zn],Dn&&pn>=St&&St>Yn[2]){var Ma=(pn-St)/(pn-Yn[2]);Qn={x:Xn[0]*(1-Ma)+Yn[0]*Ma,y:Xn[1]*(1-Ma)+Yn[1]*Ma}}Yn=[Nn,zn,pn]}return Dn&&St>=pn&&(Qn={x:je,y:bt}),{length:pn,point:Qn,min:{x:Math.min.apply(null,ga.map(function(ha){return ha.x})),y:Math.min.apply(null,ga.map(function(ha){return ha.y}))},max:{x:Math.max.apply(null,ga.map(function(ha){return ha.x})),y:Math.max.apply(null,ga.map(function(ha){return ha.y}))}}}function Fr(q,de,Ee){for(var Pe,je,bt,St,jt,vr,xr=It(q),$r=typeof de=="number",an,tn=[],Gn,$n=0,Dn=0,Nn=0,zn=0,pn,Yn=[],Xn=[],bn=0,Qn={x:0,y:0},ga=Qn,Da=Qn,Ma=Qn,ha=0,Pa=0,Qa=xr.length;Pa=de&&(Ma=Da),Xn.push(ga),Yn.push(Qn),ha+=bn,vr=Gn!=="Z"?pn.slice(-2):[Nn,zn],$n=vr[0],Dn=vr[1];return $r&&de>=ha&&(Ma={x:$n,y:Dn}),{length:ha,point:Ma,min:{x:Math.min.apply(null,Yn.map(function(Ya){return Ya.x})),y:Math.min.apply(null,Yn.map(function(Ya){return Ya.y}))},max:{x:Math.max.apply(null,Xn.map(function(Ya){return Ya.x})),y:Math.max.apply(null,Xn.map(function(Ya){return Ya.y}))}}}function Cn(q,de){if(!q)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var Ee=Fr(q,void 0,(0,Se.__assign)((0,Se.__assign)({},de),{length:!1})),Pe=Ee.min,je=Pe.x,bt=Pe.y,St=Ee.max,jt=St.x,vr=St.y,xr=jt-je,$r=vr-bt;return{width:xr,height:$r,x:je,y:bt,x2:jt,y2:vr,cx:je+xr/2,cy:bt+$r/2,cz:Math.max(xr,$r)+Math.min(xr,$r)/2}}function Sn(q,de){return Fr(q,void 0,(0,Se.__assign)((0,Se.__assign)({},de),{bbox:!1,length:!0})).length}function oa(q,de){if(!q)return{length:0,x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};var Ee=Fr(q,void 0,(0,Se.__assign)((0,Se.__assign)({},de),{bbox:!0,length:!0})),Pe=Ee.length,je=Ee.min,bt=je.x,St=je.y,jt=Ee.max,vr=jt.x,xr=jt.y,$r=vr-bt,an=xr-St;return{length:Pe,width:$r,height:an,x:bt,y:St,x2:vr,y2:xr,cx:bt+$r/2,cy:St+an/2,cz:Math.max($r,an)+Math.min($r,an)/2}}function jr(q){var de=q.length,Ee=de-1;return q.map(function(Pe,je){return q.map(function(bt,St){var jt=je+St,vr;return St===0||q[jt]&&q[jt][0]==="M"?(vr=q[jt],["M"].concat(vr.slice(-2))):(jt>=de&&(jt-=Ee),q[jt])})})}function xn(q,de){var Ee=q.length-1,Pe=[],je=0,bt=0,St=jr(q);return St.forEach(function(jt,vr){q.slice(1).forEach(function(xr,$r){bt+=Rn(q[(vr+$r)%Ee].slice(-2),de[$r%Ee].slice(-2))}),Pe[vr]=bt,bt=0}),je=Pe.indexOf(Math.min.apply(null,Pe)),St[je]}function vn(q,de,Ee,Pe,je,bt,St,jt){return 3*((jt-de)*(Ee+je)-(St-q)*(Pe+bt)+Pe*(q-je)-Ee*(de-bt)+jt*(je+q/3)-St*(bt+de/3))/20}function un(q){var de=0,Ee=0,Pe=0;return rn(q).map(function(je){var bt;switch(je[0]){case"M":return de=je[1],Ee=je[2],0;default:var St=je.slice(1),jt=St[0],vr=St[1],xr=St[2],$r=St[3],an=St[4],tn=St[5];return Pe=vn(de,Ee,jt,vr,xr,$r,an,tn),bt=je.slice(-2),de=bt[0],Ee=bt[1],Pe}}).reduce(function(je,bt){return je+bt},0)}function Wn(q){return un(q)>=0}function Y(q,de,Ee){return Fr(q,de,(0,Se.__assign)((0,Se.__assign)({},Ee),{bbox:!1,length:!0})).point}function ie(q,de){var Ee=Ir(q);if(typeof Ee=="string")throw TypeError(Ee);var Pe=Ee.slice(),je=Sn(Pe),bt=Pe.length-1,St=0,jt=0,vr=Ee[0],xr=vr.slice(-2),$r=xr[0],an=xr[1],tn={x:$r,y:an};if(bt<=0||!de||!Number.isFinite(de))return{segment:vr,index:0,length:jt,point:tn,lengthAtSegment:St};if(de>=je)return Pe=Ee.slice(0,-1),St=Sn(Pe),jt=je-St,{segment:Ee[bt],index:bt,length:jt,lengthAtSegment:St};for(var Gn=[];bt>0;)vr=Pe[bt],Pe=Pe.slice(0,-1),St=Sn(Pe),jt=je-St,je=St,Gn.push({segment:vr,index:bt,length:jt,lengthAtSegment:St}),bt-=1;return Gn.find(function($n){var Dn=$n.lengthAtSegment;return Dn<=de})}function ee(q,de){for(var Ee=Ir(q),Pe=It(Ee),je=Sn(Ee),bt=function(bn){var Qn=bn.x-de.x,ga=bn.y-de.y;return Qn*Qn+ga*ga},St=8,jt,vr=0,xr,$r=0,an=1/0,tn=0;tn<=je;tn+=St)jt=Y(Pe,tn),vr=bt(jt),vr.5;)Dn=$r-St,Gn=Y(Pe,Dn),zn=bt(Gn),Nn=$r+St,$n=Y(Pe,Nn),pn=bt($n),Dn>=0&&zn=tn[zn],Gn[zn]-=$n?1:0,$n?pn.ss:[pn.s]}).flat()});return Dn[0].length===Dn[1].length?Dn:X(Dn[0],Dn[1],an)}var pe=function(q){return q!==null&&typeof q!="function"&&isFinite(q.length)},Me=pe,me=function(q,de){return Me(q)?q.indexOf(de)>-1:!1},Le=me,st=function(q,de){if(!Me(q))return q;for(var Ee=[],Pe=0;Pe-1;)nn.call(q,bt,1);return q},jn=Jr,_a=Array.prototype.splice,Fn=function(de,Ee){if(!Me(de))return[];for(var Pe=de?Ee.length:0,je=Pe-1;Pe--;){var bt=void 0,St=Ee[Pe];(Pe===je||St!==bt)&&(bt=St,_a.call(de,St,1))}return de},ya=Fn,Ai=function(q,de,Ee){if(!Ur(q)&&!Zn(q))return q;var Pe=Ee;return lr(q,function(je,bt){Pe=de(Pe,je,bt)}),Pe},bo=Ai,Zi=function(q,de){var Ee=[];if(!Me(q))return Ee;for(var Pe=-1,je=[],bt=q.length;++Pebt[jt])return 1;if(je[jt]20&&(je=20),parseFloat(q.toFixed(je))},di=ou,mi=F(39696),_o=function(q){return(0,mi.Z)(q)&&q%1!==0},hi=_o,xi=function(q){return(0,mi.Z)(q)&&q%2===0},Vn=xi,ni=Number.isInteger?Number.isInteger:function(q){return(0,mi.Z)(q)&&q%1===0},qa=ni,wi=function(q){return(0,mi.Z)(q)&&q<0},bi=wi,Mi=1e-5;function go(q,de,Ee){return Ee===void 0&&(Ee=Mi),Math.abs(q-de)0},su=po,gf=function(q,de){if(Ur(q)){for(var Ee,Pe=-1/0,je=0;jePe&&(Ee=bt,Pe=St)}return Ee}},uu=function(q,de){if(Ur(q)){for(var Ee,Pe=1/0,je=0;jede?(Pe&&(clearTimeout(Pe),Pe=null),jt=$r,St=q.apply(je,bt),Pe||(je=bt=null)):!Pe&&Ee.trailing!==!1&&(Pe=setTimeout(vr,an)),St};return xr.cancel=function(){clearTimeout(Pe),jt=0,Pe=je=bt=null},xr},oc=function(q){return Me(q)?Array.prototype.slice.call(q):[]},Es={},Cf=function(q){return q=q||"g",Es[q]?Es[q]+=1:Es[q]=1,q+Es[q]},mu=function(){},Ku=function(q){return q};function $u(q){return(0,Ft.Z)(q)?0:Me(q)?q.length:Object.keys(q).length}var bu=function(){function q(){this.map={}}return q.prototype.has=function(de){return this.map[de]!==void 0},q.prototype.get=function(de,Ee){var Pe=this.map[de];return Pe===void 0?Ee:Pe},q.prototype.set=function(de,Ee){this.map[de]=Ee},q.prototype.clear=function(){this.map={}},q.prototype.delete=function(de){delete this.map[de]},q.prototype.size=function(){return Object.keys(this.map).length},q}(),as=bu,Eu=1e-6;function Qr(q){return Math.abs(q)0!=Qr(jt[1]-Ee)>0&&Qr(de-(Ee-St[1])*(St[0]-jt[0])/(St[1]-jt[1])-St[0])<0&&(Pe=!Pe)}return Pe}var Zs=function(q,de,Ee){return q>=de&&q<=Ee};function Ks(q,de,Ee,Pe){var je=.001,bt={x:Ee.x-q.x,y:Ee.y-q.y},St={x:de.x-q.x,y:de.y-q.y},jt={x:Pe.x-Ee.x,y:Pe.y-Ee.y},vr=St.x*jt.y-St.y*jt.x,xr=vr*vr,$r=St.x*St.x+St.y*St.y,an=jt.x*jt.x+jt.y*jt.y,tn=null;if(xr>je*$r*an){var Gn=(bt.x*jt.y-bt.y*jt.x)/vr,$n=(bt.x*St.y-bt.y*St.x)/vr;Zs(Gn,0,1)&&Zs($n,0,1)&&(tn={x:q.x+Gn*St.x,y:q.y+Gn*St.y})}return tn}function Go(q){for(var de=[],Ee=q.length,Pe=0;Pe1){var St=q[0],jt=q[Ee-1];de.push({from:{x:jt[0],y:jt[1]},to:{x:St[0],y:St[1]}})}return de}function Tf(q,de){var Ee=!1;return q.forEach(function(Pe){if(Ks(Pe.from,Pe.to,de.from,de.to))return Ee=!0,!1}),Ee}function xs(q){var de=q.map(function(Pe){return Pe[0]}),Ee=q.map(function(Pe){return Pe[1]});return{minX:Math.min.apply(null,de),maxX:Math.max.apply(null,de),minY:Math.min.apply(null,Ee),maxY:Math.max.apply(null,Ee)}}function xu(q,de){return!(de.minX>q.maxX||de.maxXq.maxY||de.maxYyn.index){var un=zr-jr.x-jr.vx,Wn=Rt-jr.y-jr.vy,Y=un*un+Wn*Wn;Yzr+vn||SnRt+vn||oaSr.r&&(Sr.r=Sr[qr].r)}function rn(){if(qt){var Sr,qr=qt.length,Rn;for(ar=new Array(qr),Sr=0;Sr=0&&(Oe=ar.slice(Pr+1),ar=ar.slice(0,Pr)),ar&&!qt.hasOwnProperty(ar))throw new Error("unknown type: "+ar);return{type:ar,name:Oe}})}M.prototype=m.prototype={constructor:M,on:function(qt,ar){var Oe=this._,Pr=P(qt+"",Oe),Cr,Gr=-1,mr=Pr.length;if(arguments.length<2){for(;++Gr0)for(var Oe=new Array(Cr),Pr=0,Cr,Gr;Pr=0&&It._call.call(null,qt),It=It._next;--G}function Ge(){se=(ne=Ie.now())+fe,G=W=0;try{ke()}finally{G=0,He(),se=0}}function tt(){var It=Ie.now(),qt=It-ne;qt>Z&&(fe-=qt,ne=It)}function He(){for(var It,qt=J,ar,Oe=1/0;qt;)qt._call?(Oe>qt._time&&(Oe=qt._time),It=qt,qt=qt._next):(ar=qt._next,qt._next=null,qt=It?It._next=ar:J=ar);K=It,ft(Oe)}function ft(It){if(!G){W&&(W=clearTimeout(W));var qt=It-se;qt>24?(It<1/0&&(W=setTimeout(Ge,It-Ie.now()-fe)),H&&(H=clearInterval(H))):(H||(ne=Ie.now(),H=setInterval(tt,Z)),G=1,ye(Ge))}}var Lt=1664525,Jt=1013904223,Qe=4294967296;function ut(){var It=1;return function(){return(It=(Lt*It+Jt)%Qe)/Qe}}function xt(It){return It.x}function dt(It){return It.y}var pt=10,wt=Math.PI*(3-Math.sqrt(5));function mt(It){var qt,ar=1,Oe=.001,Pr=1-Math.pow(Oe,1/300),Cr=0,Gr=.6,mr=new Map,rn=Te(Rn),Sr=Q("tick","end"),qr=ut();It==null&&(It=[]);function Rn(){yn(),Sr.call("tick",qt),ar1?(hr==null?mr.delete(Vt):mr.set(Vt,Rt(hr)),qt):mr.get(Vt)},find:function(Vt,hr,Ar){var en=0,Fr=It.length,Cn,Sn,oa,jr,xn;for(Ar==null?Ar=1/0:Ar*=Ar,en=0;en1?(Sr.on(Vt,hr),qt):Sr.on(Vt)}}}function ur(){var It,qt,ar,Oe,Pr=L(-30),Cr,Gr=1,mr=1/0,rn=.81;function Sr(zr){var Rt,zt=It.length,Vt=(0,U.Z)(It,xt,dt).visitAfter(Rn);for(Oe=zr,Rt=0;Rt=mr)return;(zr.data!==qt||zr.next)&&(hr===0&&(hr=_(ar),Fr+=hr*hr),Ar===0&&(Ar=_(ar),Fr+=Ar*Ar),Fr1&&arguments[1]!==void 0?arguments[1]:{},C=ee.maxRows,b=C===void 0?15:C,S=ee.maxColumns,X=S===void 0?10:S,pe=ee.maxNumSize,Me=pe===void 0?8:pe,me=ee.padMinus,Le=me===void 0?"auto":me;return"".concat(ie.constructor.name,` { `).concat(v,`[ `).concat(g).concat(s(ie,b,X,Me,Le),` `).concat(v,`] `).concat(v,"rows: ").concat(ie.rows,` `).concat(v,"columns: ").concat(ie.columns,` }`)}function s(ie,ee,C,b,S){var X=ie.rows,pe=ie.columns,Me=Math.min(X,ee),me=Math.min(pe,C),Le=[];if(S==="auto"){S=!1;e:for(var st=0;st=0&&C?" ".concat(M(ie,ee-1)):M(ie,ee)).padEnd(ee)}function M(ie,ee){var C=ie.toString();if(C.length<=ee)return C;var b=ie.toFixed(ee);if(b.length>ee&&(b=ie.toFixed(Math.max(0,ee-(b.length-ee)))),b.length<=ee&&!b.startsWith("0.000")&&!b.startsWith("-0.000"))return b;var S=ie.toExponential(ee);return S.length>ee&&(S=ie.toExponential(Math.max(0,ee-(S.length-ee)))),S.slice(0)}function P(ie,ee){ie.prototype.add=function(b){return typeof b=="number"?this.addS(b):this.addM(b)},ie.prototype.addS=function(b){for(var S=0;S>b);return this},ie.prototype.signPropagatingRightShiftM=function(b){if(b=ee.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(var S=0;S>b.get(S,X));return this},ie.signPropagatingRightShift=function(b,S){var X=new ee(b);return X.signPropagatingRightShift(S)},ie.prototype.rightShift=function(b){return typeof b=="number"?this.rightShiftS(b):this.rightShiftM(b)},ie.prototype.rightShiftS=function(b){for(var S=0;S>>b);return this},ie.prototype.rightShiftM=function(b){if(b=ee.checkMatrix(b),this.rows!==b.rows||this.columns!==b.columns)throw new RangeError("Matrices dimensions must be equal");for(var S=0;S>>b.get(S,X));return this},ie.rightShift=function(b,S){var X=new ee(b);return X.rightShift(S)},ie.prototype.zeroFillRightShift=ie.prototype.rightShift,ie.prototype.zeroFillRightShiftS=ie.prototype.rightShiftS,ie.prototype.zeroFillRightShiftM=ie.prototype.rightShiftM,ie.zeroFillRightShift=ie.rightShift,ie.prototype.not=function(){for(var b=0;bb)throw new RangeError("Row index out of range")}function j(ie,ee,C){var b=C?ie.columns:ie.columns-1;if(ee<0||ee>b)throw new RangeError("Column index out of range")}function Q(ie,ee){if(ee.to1DArray&&(ee=ee.to1DArray()),ee.length!==ie.columns)throw new RangeError("vector size must be the same as the number of columns");return ee}function G(ie,ee){if(ee.to1DArray&&(ee=ee.to1DArray()),ee.length!==ie.rows)throw new RangeError("vector size must be the same as the number of rows");return ee}function W(ie,ee){if(!x.isAnyArray(ee))throw new TypeError("row indices must be an array");for(var C=0;C=ie.rows)throw new RangeError("row indices are out of range")}function H(ie,ee){if(!x.isAnyArray(ee))throw new TypeError("column indices must be an array");for(var C=0;C=ie.columns)throw new RangeError("column indices are out of range")}function Z(ie,ee,C,b,S){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(K("startRow",ee),K("endRow",C),K("startColumn",b),K("endColumn",S),ee>C||b>S||ee<0||ee>=ie.rows||C<0||C>=ie.rows||b<0||b>=ie.columns||S<0||S>=ie.columns)throw new RangeError("Submatrix indices are out of range")}function J(ie){for(var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,C=[],b=0;bS?(pe=!0,S=b):(X=!1,pe=!0);C++}return X}},{key:"isReducedEchelonForm",value:function(){for(var C=0,b=0,S=-1,X=!0,pe=!1;CS?(pe=!0,S=b):(X=!1,pe=!0);for(var Me=b+1;MeC.get(X,S)&&(X=pe);if(C.get(X,S)===0)S++;else{C.swapRows(b,X);for(var Me=C.get(b,S),me=S;me=0;)if(C.maxRow(X)===0)X--;else{for(var pe=0,Me=!1;pe0&&arguments[0]!==void 0?arguments[0]:{};if(_(C)!=="object")throw new TypeError("options must be an object");var b=C.rows,S=b===void 0?1:b,X=C.columns,pe=X===void 0?1:X;if(!Number.isInteger(S)||S<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(pe)||pe<=0)throw new TypeError("columns must be a positive integer");for(var Me=new mt(this.rows*S,this.columns*pe),me=0;meb[S]&&(b[S]=this.get(S,X));return b}case"column":{for(var pe=new Array(this.columns).fill(Number.NEGATIVE_INFINITY),Me=0;Mepe[me]&&(pe[me]=this.get(Me,me));return pe}case void 0:{for(var Le=this.get(0,0),st=0;stLe&&(Le=this.get(st,qe));return Le}default:throw new Error("invalid option: ".concat(C))}}},{key:"maxIndex",value:function(){ne(this);for(var C=this.get(0,0),b=[0,0],S=0;SC&&(C=this.get(S,X),b[0]=S,b[1]=X);return b}},{key:"min",value:function(C){if(this.isEmpty())return NaN;switch(C){case"row":{for(var b=new Array(this.rows).fill(Number.POSITIVE_INFINITY),S=0;Sb&&(b=this.get(C,S));return b}},{key:"maxRowIndex",value:function(C){R(this,C),ne(this);for(var b=this.get(C,0),S=[C,0],X=1;Xb&&(b=this.get(C,X),S[1]=X);return S}},{key:"minRow",value:function(C){if(R(this,C),this.isEmpty())return NaN;for(var b=this.get(C,0),S=1;Sb&&(b=this.get(S,C));return b}},{key:"maxColumnIndex",value:function(C){j(this,C),ne(this);for(var b=this.get(0,C),S=[0,C],X=1;Xb&&(b=this.get(X,C),S[0]=X);return S}},{key:"minColumn",value:function(C){if(j(this,C),this.isEmpty())return NaN;for(var b=this.get(0,C),S=1;S0&&arguments[0]!==void 0?arguments[0]:"frobenius";switch(C){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError("unknown norm type: ".concat(C))}}},{key:"cumulativeSum",value:function(){for(var C=0,b=0;b0&&arguments[0]!==void 0?arguments[0]:{};if(_(C)!=="object")throw new TypeError("options must be an object");var b=C.min,S=b===void 0?0:b,X=C.max,pe=X===void 0?1:X;if(!Number.isFinite(S))throw new TypeError("min must be a number");if(!Number.isFinite(pe))throw new TypeError("max must be a number");if(S>=pe)throw new RangeError("min must be smaller than max");for(var Me=new mt(this.rows,this.columns),me=0;me0&&p(Le,{min:S,max:pe,output:Le}),Me.setRow(me,Le)}return Me}},{key:"scaleColumns",value:function(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(_(C)!=="object")throw new TypeError("options must be an object");var b=C.min,S=b===void 0?0:b,X=C.max,pe=X===void 0?1:X;if(!Number.isFinite(S))throw new TypeError("min must be a number");if(!Number.isFinite(pe))throw new TypeError("max must be a number");if(S>=pe)throw new RangeError("min must be smaller than max");for(var Me=new mt(this.rows,this.columns),me=0;me0&&arguments[0]!==void 0?arguments[0]:pt,b=0;b0&&arguments[0]!==void 0?arguments[0]:pt,b=0;bS||b<0||b>=this.columns||S<0||S>=this.columns)throw new RangeError("Argument out of range");for(var X=new mt(C.length,S-b+1),pe=0;pe=this.rows)throw new RangeError("Row index out of range: ".concat(C[pe]));X.set(pe,Me-b,this.get(C[pe],Me))}return X}},{key:"subMatrixColumn",value:function(C,b,S){if(b===void 0&&(b=0),S===void 0&&(S=this.rows-1),b>S||b<0||b>=this.rows||S<0||S>=this.rows)throw new RangeError("Argument out of range");for(var X=new mt(S-b+1,C.length),pe=0;pe=this.columns)throw new RangeError("Column index out of range: ".concat(C[pe]));X.set(Me-b,pe,this.get(Me,C[pe]))}return X}},{key:"setSubMatrix",value:function(C,b,S){if(C=mt.checkMatrix(C),C.isEmpty())return this;var X=b+C.rows-1,pe=S+C.columns-1;Z(this,b,X,S,pe);for(var Me=0;Me1&&arguments[1]!==void 0?arguments[1]:{};if(_(C)==="object"&&(b=C,C=void 0),_(b)!=="object")throw new TypeError("options must be an object");var S=b,X=S.unbiased,pe=X===void 0?!0:X,Me=S.mean,me=Me===void 0?this.mean(C):Me;if(typeof pe!="boolean")throw new TypeError("unbiased must be a boolean");switch(C){case"row":{if(!x.isAnyArray(me))throw new TypeError("mean must be an array");return we(this,pe,me)}case"column":{if(!x.isAnyArray(me))throw new TypeError("mean must be an array");return Te(this,pe,me)}case void 0:{if(typeof me!="number")throw new TypeError("mean must be a number");return ke(this,pe,me)}default:throw new Error("invalid option: ".concat(C))}}},{key:"standardDeviation",value:function(C,b){_(C)==="object"&&(b=C,C=void 0);var S=this.variance(C,b);if(C===void 0)return Math.sqrt(S);for(var X=0;X1&&arguments[1]!==void 0?arguments[1]:{};if(_(C)==="object"&&(b=C,C=void 0),_(b)!=="object")throw new TypeError("options must be an object");var S=b,X=S.center,pe=X===void 0?this.mean(C):X;switch(C){case"row":{if(!x.isAnyArray(pe))throw new TypeError("center must be an array");return Ge(this,pe),this}case"column":{if(!x.isAnyArray(pe))throw new TypeError("center must be an array");return tt(this,pe),this}case void 0:{if(typeof pe!="number")throw new TypeError("center must be a number");return He(this,pe),this}default:throw new Error("invalid option: ".concat(C))}}},{key:"scale",value:function(C){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(_(C)==="object"&&(b=C,C=void 0),_(b)!=="object")throw new TypeError("options must be an object");var S=b.scale;switch(C){case"row":{if(S===void 0)S=ft(this);else if(!x.isAnyArray(S))throw new TypeError("scale must be an array");return Lt(this,S),this}case"column":{if(S===void 0)S=Jt(this);else if(!x.isAnyArray(S))throw new TypeError("scale must be an array");return Qe(this,S),this}case void 0:{if(S===void 0)S=ut(this);else if(typeof S!="number")throw new TypeError("scale must be a number");return xt(this,S),this}default:throw new Error("invalid option: ".concat(C))}}},{key:"toString",value:function(C){return c(this,C)}}],[{key:"from1DArray",value:function(C,b,S){var X=C*b;if(X!==S.length)throw new RangeError("data length does not match given dimensions");for(var pe=new mt(C,b),Me=0;Me2&&arguments[2]!==void 0?arguments[2]:{};if(_(S)!=="object")throw new TypeError("options must be an object");for(var X=S.random,pe=X===void 0?Math.random:X,Me=new mt(C,b),me=0;me2&&arguments[2]!==void 0?arguments[2]:{};if(_(S)!=="object")throw new TypeError("options must be an object");var X=S.min,pe=X===void 0?0:X,Me=S.max,me=Me===void 0?1e3:Me,Le=S.random,st=Le===void 0?Math.random:Le;if(!Number.isInteger(pe))throw new TypeError("min must be an integer");if(!Number.isInteger(me))throw new TypeError("max must be an integer");if(pe>=me)throw new RangeError("min must be smaller than max");for(var qe=me-pe,Nt=new mt(C,b),nr=0;nr=0)if(X.data=[],Number.isInteger(S)&&S>=0)for(var pe=0;pe1&&arguments[1]!==void 0?arguments[1]:{};I(this,C);var pe=X.rows,Me=pe===void 0?1:pe;if(b.length%Me!==0)throw new Error("the data length is not divisible by the number of rows");return S=ee.call(this),S.rows=Me,S.columns=b.length/Me,S.data=b,S}return T(C,[{key:"set",value:function(S,X,pe){var Me=this._calculateIndex(S,X);return this.data[Me]=pe,this}},{key:"get",value:function(S,X){var pe=this._calculateIndex(S,X);return this.data[pe]}},{key:"_calculateIndex",value:function(S,X){return S*this.columns+X}}]),C}(dt),mr=function(ie){U(C,ie);var ee=L(C);function C(b){var S;return I(this,C),S=ee.call(this),S.data=b,S.rows=b.length,S.columns=b[0].length,S}return T(C,[{key:"set",value:function(S,X,pe){return this.data[S][X]=pe,this}},{key:"get",value:function(S,X){return this.data[S][X]}}]),C}(dt);function rn(ie,ee){if(x.isAnyArray(ie))return ie[0]&&x.isAnyArray(ie[0])?new mr(ie):new Gr(ie,ee);throw new Error("the argument is not an array")}var Sr=function(){function ie(ee){I(this,ie),ee=mr.checkMatrix(ee);var C=ee.clone(),b=C.rows,S=C.columns,X=new Float64Array(b),pe=1,Me,me,Le,st,qe,Nt,nr,Ft,er;for(Me=0;MeMath.abs(Ft[st])&&(st=Me);if(st!==me){for(Le=0;Le=0;st--){for(Le=0;LeMe?X.set(pe,Me,C.get(pe,Me)):pe===Me?X.set(pe,Me,1):X.set(pe,Me,0);return X}},{key:"upperTriangularMatrix",get:function(){for(var C=this.LU,b=C.rows,S=C.columns,X=new mt(b,S),pe=0;peMath.abs(ee)?(C=ee/ie,Math.abs(ie)*Math.sqrt(1+C*C)):ee!==0?(C=ie/ee,Math.abs(ee)*Math.sqrt(1+C*C)):0}var Rn=function(){function ie(ee){I(this,ie),ee=mr.checkMatrix(ee);var C=ee.clone(),b=ee.rows,S=ee.columns,X=new Float64Array(S),pe,Me,me,Le;for(me=0;me=0;st--){for(Le=0;Le=0;me--){for(pe=0;pe1&&arguments[1]!==void 0?arguments[1]:{};if(I(this,ie),ee=mr.checkMatrix(ee),ee.isEmpty())throw new Error("Matrix must be non-empty");var b=ee.rows,S=ee.columns,X=C.computeLeftSingularVectors,pe=X===void 0?!0:X,Me=C.computeRightSingularVectors,me=Me===void 0?!0:Me,Le=C.autoTranspose,st=Le===void 0?!1:Le,qe=!!pe,Nt=!!me,nr=!1,Ft;if(b=0;Fn--)if(Kt[Fn]!==0){for(var ya=Fn+1;ya=0;Ei--){if(Ei0;){var On=void 0,Gi=void 0;for(On=Jr-2;On>=-1&&On!==-1;On--){var to=Number.MIN_VALUE+Ns*Math.abs(Kt[On]+Math.abs(Kt[On+1]));if(Math.abs(br[On])<=to||Number.isNaN(br[On])){br[On]=0;break}}if(On===Jr-2)Gi=4;else{var _i=void 0;for(_i=Jr-1;_i>=On&&_i!==On;_i--){var Ru=(_i!==Jr?Math.abs(br[_i]):0)+(_i!==On+1?Math.abs(br[_i-1]):0);if(Math.abs(Kt[_i])<=Ns*Ru){Kt[_i]=0;break}}_i===On?Gi=3:_i===Jr-1?Gi=1:(Gi=2,On=_i)}switch(On++,Gi){case 1:{var xo=br[Jr-2];br[Jr-2]=0;for(var ri=Jr-2;ri>=On;ri--){var wo=qr(Kt[ri],xo),ds=Kt[ri]/wo,Ho=xo/wo;if(Kt[ri]=wo,ri!==On&&(xo=-Ho*br[ri-1],br[ri-1]=ds*br[ri-1]),Nt)for(var zi=0;zi=Kt[On+1]);){var no=Kt[On];if(Kt[On]=Kt[On+1],Kt[On+1]=no,Nt&&Onb&&pe.set(Me,me,C.get(Me,me)/this.s[me]);for(var Le=this.U,st=Le.rows,qe=Le.columns,Nt=new mt(S,st),nr=0;nrC&&b++;return b}},{key:"diagonal",get:function(){return Array.from(this.s)}},{key:"threshold",get:function(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}},{key:"leftSingularVectors",get:function(){return this.U}},{key:"rightSingularVectors",get:function(){return this.V}},{key:"diagonalMatrix",get:function(){return mt.diag(this.s)}}]),ie}();function zr(ie){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return ie=mr.checkMatrix(ie),ee?new yn(ie).inverse():Rt(ie,mt.eye(ie.rows))}function Rt(ie,ee){var C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return ie=mr.checkMatrix(ie),ee=mr.checkMatrix(ee),C?new yn(ie).solve(ee):ie.isSquare()?new Sr(ie).solve(ee):new Rn(ie).solve(ee)}function zt(ie){if(ie=mt.checkMatrix(ie),ie.isSquare()){if(ie.columns===0)return 1;var ee,C,b,S;if(ie.columns===2)return ee=ie.get(0,0),C=ie.get(0,1),b=ie.get(1,0),S=ie.get(1,1),ee*S-C*b;if(ie.columns===3){var X,pe,Me;return X=new Oe(ie,[1,2],[1,2]),pe=new Oe(ie,[1,2],[0,2]),Me=new Oe(ie,[1,2],[0,1]),ee=ie.get(0,0),C=ie.get(0,1),b=ie.get(0,2),ee*zt(X)-C*zt(pe)+b*zt(Me)}else return new Sr(ie).determinant}else throw Error("determinant can only be calculated for a square matrix")}function Vt(ie,ee){for(var C=[],b=0;b3&&arguments[3]!==void 0?arguments[3]:1e-9,S=arguments.length>4&&arguments[4]!==void 0?arguments[4]:1e-9;if(ie>S)return new Array(ee.rows+1).fill(0);for(var X=ee.addRow(C,[0]),pe=0;pe1&&arguments[1]!==void 0?arguments[1]:{},C=ee.thresholdValue,b=C===void 0?1e-9:C,S=ee.thresholdError,X=S===void 0?1e-9:S;ie=mt.checkMatrix(ie);for(var pe=ie.rows,Me=new mt(pe,pe),me=0;me1&&arguments[1]!==void 0?arguments[1]:Number.EPSILON;if(ie=mt.checkMatrix(ie),ie.isEmpty())return ie.transpose();for(var C=new yn(ie,{autoTranspose:!0}),b=C.leftSingularVectors,S=C.rightSingularVectors,X=C.diagonal,pe=0;peee?X[pe]=1/X[pe]:X[pe]=0;return S.mmul(mt.diag(X).mmul(b.transpose()))}function Fr(ie){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ie,C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ie=new mt(ie);var b=!1;if(_(ee)==="object"&&!mt.isMatrix(ee)&&!x.isAnyArray(ee)?(C=ee,ee=ie,b=!0):ee=new mt(ee),ie.rows!==ee.rows)throw new TypeError("Both matrices must have the same number of rows");var S=C,X=S.center,pe=X===void 0?!0:X;pe&&(ie=ie.center("column"),b||(ee=ee.center("column")));for(var Me=ie.transpose().mmul(ee),me=0;me1&&arguments[1]!==void 0?arguments[1]:ie,C=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};ie=new mt(ie);var b=!1;if(_(ee)==="object"&&!mt.isMatrix(ee)&&!x.isAnyArray(ee)?(C=ee,ee=ie,b=!0):ee=new mt(ee),ie.rows!==ee.rows)throw new TypeError("Both matrices must have the same number of rows");var S=C,X=S.center,pe=X===void 0?!0:X,Me=S.scale,me=Me===void 0?!0:Me;pe&&(ie.center("column"),b||ee.center("column")),me&&(ie.scale("column"),b||ee.scale("column"));for(var Le=ie.standardDeviation("column",{unbiased:!0}),st=b?Le:ee.standardDeviation("column",{unbiased:!0}),qe=ie.transpose().mmul(ee),Nt=0;Nt1&&arguments[1]!==void 0?arguments[1]:{};I(this,ie);var b=C.assumeSymmetric,S=b===void 0?!1:b;if(ee=mr.checkMatrix(ee),!ee.isSquare())throw new Error("Matrix is not a square matrix");if(ee.isEmpty())throw new Error("Matrix must be non-empty");var X=ee.columns,pe=new mt(X,X),Me=new Float64Array(X),me=new Float64Array(X),Le=ee,st,qe,Nt=!1;if(S?Nt=!0:Nt=ee.isSymmetric(),Nt){for(st=0;st0?X.set(pe,pe+1,b[pe]):b[pe]<0&&X.set(pe,pe-1,b[pe])}return X}}]),ie}();function oa(ie,ee,C,b){var S,X,pe,Me,me,Le,st,qe;for(me=0;me0;Me--){for(qe=0,pe=0,Le=0;Le0&&(X=-X),ee[Me]=qe*X,pe=pe-S*X,C[Me-1]=S-X,me=0;meLe)do{for(S=C[Le],qe=(C[Le+1]-S)/(2*ee[Le]),Nt=qr(qe,1),qe<0&&(Nt=-Nt),C[Le]=ee[Le]/(qe+Nt),C[Le+1]=ee[Le]*(qe+Nt),nr=C[Le+1],X=S-C[Le],pe=Le+2;pe=Le;pe--)for(Ur=er,er=Ft,lr=Kt,S=Ft*ee[pe],X=Ft*qe,Nt=qr(qe,ee[pe]),ee[pe+1]=Kt*Nt,Kt=ee[pe]/Nt,Ft=qe/Nt,qe=Ft*C[pe]-Kt*S,C[pe+1]=X+Kt*(Ft*S+Kt*C[pe]),me=0;mesa*br);C[Le]=C[Le]+Dr,ee[Le]=0}for(pe=0;pe=qe;Le--)C[Le]=ee.get(Le,qe-1)/Nt,me+=C[Le]*C[Le];for(Me=Math.sqrt(me),C[qe]>0&&(Me=-Me),me=me-C[qe]*Me,C[qe]=C[qe]-Me,st=qe;st=qe;Le--)pe+=C[Le]*ee.get(Le,st);for(pe=pe/me,Le=qe;Le<=X;Le++)ee.set(Le,st,ee.get(Le,st)-pe*C[Le])}for(Le=0;Le<=X;Le++){for(pe=0,st=X;st>=qe;st--)pe+=C[st]*ee.get(Le,st);for(pe=pe/me,st=qe;st<=X;st++)ee.set(Le,st,ee.get(Le,st)-pe*C[st])}C[qe]=Nt*C[qe],ee.set(qe,qe-1,Nt*Me)}}for(Le=0;Le=S+1;qe--)if(ee.get(qe,qe-1)!==0){for(Le=qe+1;Le<=X;Le++)C[Le]=ee.get(Le,qe-1);for(st=qe;st<=X;st++){for(Me=0,Le=qe;Le<=X;Le++)Me+=C[Le]*b.get(Le,st);for(Me=Me/C[qe]/ee.get(qe,qe-1),Le=qe;Le<=X;Le++)b.set(Le,st,b.get(Le,st)+Me*C[Le])}}}function vn(ie,ee,C,b,S){var X=ie-1,pe=0,Me=ie-1,me=Number.EPSILON,Le=0,st=0,qe=0,Nt=0,nr=0,Ft=0,er=0,Ur=0,Ct,Kt,lr,Dr,br,sa,ea,gn,Tn,ra,Zn,Vr,In,at,D;for(Ct=0;CtMe)&&(C[Ct]=S.get(Ct,Ct),ee[Ct]=0),Kt=Math.max(Ct-1,0);Kt=pe;){for(Dr=X;Dr>pe&&(Ft=Math.abs(S.get(Dr-1,Dr-1))+Math.abs(S.get(Dr,Dr)),Ft===0&&(Ft=st),!(Math.abs(S.get(Dr,Dr-1))=0){for(er=qe>=0?qe+er:qe-er,C[X-1]=gn+er,C[X]=C[X-1],er!==0&&(C[X]=gn-ea/er),ee[X-1]=0,ee[X]=0,gn=S.get(X,X-1),Ft=Math.abs(gn)+Math.abs(er),qe=gn/Ft,Nt=er/Ft,nr=Math.sqrt(qe*qe+Nt*Nt),qe=qe/nr,Nt=Nt/nr,Kt=X-1;Kt0)){for(Ft=Math.sqrt(Ft),Tn=Dr&&(er=S.get(br,br),nr=gn-er,Ft=Tn-er,qe=(nr*Ft-ea)/S.get(br+1,br)+S.get(br,br+1),Nt=S.get(br+1,br+1)-er-nr-Ft,nr=S.get(br+2,br+1),Ft=Math.abs(qe)+Math.abs(Nt)+Math.abs(nr),qe=qe/Ft,Nt=Nt/Ft,nr=nr/Ft,!(br===Dr||Math.abs(S.get(br,br-1))*(Math.abs(Nt)+Math.abs(nr))br+2&&S.set(Ct,Ct-3,0);for(lr=br;lr<=X-1&&(at=lr!==X-1,lr!==br&&(qe=S.get(lr,lr-1),Nt=S.get(lr+1,lr-1),nr=at?S.get(lr+2,lr-1):0,gn=Math.abs(qe)+Math.abs(Nt)+Math.abs(nr),gn!==0&&(qe=qe/gn,Nt=Nt/gn,nr=nr/gn)),gn!==0);lr++)if(Ft=Math.sqrt(qe*qe+Nt*Nt+nr*nr),qe<0&&(Ft=-Ft),Ft!==0){for(lr!==br?S.set(lr,lr-1,-Ft*gn):Dr!==br&&S.set(lr,lr-1,-S.get(lr,lr-1)),qe=qe+Ft,gn=qe/Ft,Tn=Nt/Ft,er=nr/Ft,Nt=Nt/qe,nr=nr/qe,Kt=lr;Kt=0;X--)if(qe=C[X],Nt=ee[X],Nt===0)for(Dr=X,S.set(X,X,1),Ct=X-1;Ct>=0;Ct--){for(ea=S.get(Ct,Ct)-qe,nr=0,Kt=Dr;Kt<=X;Kt++)nr=nr+S.get(Ct,Kt)*S.get(Kt,X);if(ee[Ct]<0)er=ea,Ft=nr;else if(Dr=Ct,ee[Ct]===0?S.set(Ct,X,ea!==0?-nr/ea:-nr/(me*st)):(gn=S.get(Ct,Ct+1),Tn=S.get(Ct+1,Ct),Nt=(C[Ct]-qe)*(C[Ct]-qe)+ee[Ct]*ee[Ct],sa=(gn*Ft-er*nr)/Nt,S.set(Ct,X,sa),S.set(Ct+1,X,Math.abs(gn)>Math.abs(er)?(-nr-ea*sa)/gn:(-Ft-Tn*sa)/er)),sa=Math.abs(S.get(Ct,X)),me*sa*sa>1)for(Kt=Ct;Kt<=X;Kt++)S.set(Kt,X,S.get(Kt,X)/sa)}else if(Nt<0)for(Dr=X-1,Math.abs(S.get(X,X-1))>Math.abs(S.get(X-1,X))?(S.set(X-1,X-1,Nt/S.get(X,X-1)),S.set(X-1,X,-(S.get(X,X)-qe)/S.get(X,X-1))):(D=un(0,-S.get(X-1,X),S.get(X-1,X-1)-qe,Nt),S.set(X-1,X-1,D[0]),S.set(X-1,X,D[1])),S.set(X,X-1,0),S.set(X,X,1),Ct=X-2;Ct>=0;Ct--){for(ra=0,Zn=0,Kt=Dr;Kt<=X;Kt++)ra=ra+S.get(Ct,Kt)*S.get(Kt,X-1),Zn=Zn+S.get(Ct,Kt)*S.get(Kt,X);if(ea=S.get(Ct,Ct)-qe,ee[Ct]<0)er=ea,nr=ra,Ft=Zn;else if(Dr=Ct,ee[Ct]===0?(D=un(-ra,-Zn,ea,Nt),S.set(Ct,X-1,D[0]),S.set(Ct,X,D[1])):(gn=S.get(Ct,Ct+1),Tn=S.get(Ct+1,Ct),Vr=(C[Ct]-qe)*(C[Ct]-qe)+ee[Ct]*ee[Ct]-Nt*Nt,In=(C[Ct]-qe)*2*Nt,Vr===0&&In===0&&(Vr=me*st*(Math.abs(ea)+Math.abs(Nt)+Math.abs(gn)+Math.abs(Tn)+Math.abs(er))),D=un(gn*nr-er*ra+Nt*Zn,gn*Ft-er*Zn-Nt*ra,Vr,In),S.set(Ct,X-1,D[0]),S.set(Ct,X,D[1]),Math.abs(gn)>Math.abs(er)+Math.abs(Nt)?(S.set(Ct+1,X-1,(-ra-ea*S.get(Ct,X-1)+Nt*S.get(Ct,X))/gn),S.set(Ct+1,X,(-Zn-ea*S.get(Ct,X)-Nt*S.get(Ct,X-1))/gn)):(D=un(-nr-Tn*S.get(Ct,X-1),-Ft-Tn*S.get(Ct,X),er,Nt),S.set(Ct+1,X-1,D[0]),S.set(Ct+1,X,D[1]))),sa=Math.max(Math.abs(S.get(Ct,X-1)),Math.abs(S.get(Ct,X))),me*sa*sa>1)for(Kt=Ct;Kt<=X;Kt++)S.set(Kt,X-1,S.get(Kt,X-1)/sa),S.set(Kt,X,S.get(Kt,X)/sa)}for(Ct=0;CtMe)for(Kt=Ct;Kt=pe;Kt--)for(Ct=pe;Ct<=Me;Ct++){for(er=0,lr=pe;lr<=Math.min(Kt,Me);lr++)er=er+b.get(Ct,lr)*S.get(lr,Kt);b.set(Ct,Kt,er)}}}function un(ie,ee,C,b){var S,X;return Math.abs(C)>Math.abs(b)?(S=b/C,X=C+S*b,[(ie+S*ee)/X,(ee-S*ie)/X]):(S=C/b,X=b+S*C,[(S*ie+ee)/X,(S*ee-ie)/X])}var Wn=function(){function ie(ee){if(I(this,ie),ee=mr.checkMatrix(ee),!ee.isSymmetric())throw new Error("Matrix is not symmetric");var C=ee,b=C.rows,S=new mt(b,b),X=!0,pe,Me,me;for(Me=0;Me0,S.set(Me,Me,Math.sqrt(Math.max(Le,0))),me=Me+1;me=0;Le--)for(me=0;me1&&arguments[1]!==void 0?arguments[1]:{};I(this,ie),ee=mr.checkMatrix(ee);var b=C.Y,S=C.scaleScores,X=S===void 0?!1:S,pe=C.maxIterations,Me=pe===void 0?1e3:pe,me=C.terminationCriteria,Le=me===void 0?1e-10:me,st;if(b){if(x.isAnyArray(b)&&typeof b[0]=="number"?b=mt.columnVector(b):b=mr.checkMatrix(b),b.rows!==ee.rows)throw new Error("Y should have the same number of rows as X");st=b.getColumnVector(0)}else st=ee.getColumnVector(0);for(var qe=1,Nt,nr,Ft,er,Ur=0;UrLe;Ur++)Ft=ee.transpose().mmul(st).div(st.transpose().mmul(st).get(0,0)),Ft=Ft.div(Ft.norm()),Nt=ee.mmul(Ft).div(Ft.transpose().mmul(Ft).get(0,0)),Ur>0&&(qe=Nt.clone().sub(er).pow(2).sum()),er=Nt.clone(),b?(nr=b.transpose().mmul(Nt).div(Nt.transpose().mmul(Nt).get(0,0)),nr=nr.div(nr.norm()),st=b.mmul(nr).div(nr.transpose().mmul(nr).get(0,0))):st=Nt;if(b){var Ct=ee.transpose().mmul(Nt).div(Nt.transpose().mmul(Nt).get(0,0));Ct=Ct.div(Ct.norm());var Kt=ee.clone().sub(Nt.clone().mmul(Ct.transpose())),lr=st.transpose().mmul(Nt).div(Nt.transpose().mmul(Nt).get(0,0)),Dr=b.clone().sub(Nt.clone().mulS(lr.get(0,0)).mmul(nr.transpose()));this.t=Nt,this.p=Ct.transpose(),this.w=Ft.transpose(),this.q=nr,this.u=st,this.s=Nt.transpose().mmul(Nt),this.xResidual=Kt,this.yResidual=Dr,this.betas=lr}else this.w=Ft.transpose(),this.s=Nt.transpose().mmul(Nt).sqrt(),X?this.t=Nt.clone().div(this.s.get(0,0)):this.t=Nt,this.xResidual=ee.sub(Nt.mmul(Ft.transpose()))});N.AbstractMatrix=dt,N.CHO=Wn,N.CholeskyDecomposition=Wn,N.EVD=Sn,N.EigenvalueDecomposition=Sn,N.LU=Sr,N.LuDecomposition=Sr,N.Matrix=mt,N.MatrixColumnSelectionView=Nr,N.MatrixColumnView=Ir,N.MatrixFlipColumnView=Hr,N.MatrixFlipRowView=It,N.MatrixRowSelectionView=ar,N.MatrixRowView=qt,N.MatrixSelectionView=Oe,N.MatrixSubView=Pr,N.MatrixTransposeView=Cr,N.NIPALS=Y,N.Nipals=Y,N.QR=Rn,N.QrDecomposition=Rn,N.SVD=yn,N.SingularValueDecomposition=yn,N.WrapperMatrix1D=Gr,N.WrapperMatrix2D=mr,N.correlation=Cn,N.covariance=Fr,N.default=mt,N.determinant=zt,N.inverse=zr,N.linearDependencies=Ar,N.pseudoInverse=en,N.solve=Rt,N.wrap=rn},44589:function(Mt,N,F){var k=F(13337),U={};for(var L in k)k.hasOwnProperty(L)&&(U[k[L]]=L);var _=Mt.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var I in _)if(_.hasOwnProperty(I)){if(!("channels"in _[I]))throw new Error("missing channels property: "+I);if(!("labels"in _[I]))throw new Error("missing channel labels property: "+I);if(_[I].labels.length!==_[I].channels)throw new Error("channel and label counts mismatch: "+I);var T=_[I].channels,x=_[I].labels;delete _[I].channels,delete _[I].labels,Object.defineProperty(_[I],"channels",{value:T}),Object.defineProperty(_[I],"labels",{value:x})}_.rgb.hsl=function(v){var g=v[0]/255,d=v[1]/255,c=v[2]/255,s=Math.min(g,d,c),m=Math.max(g,d,c),M=m-s,P,R,j;return m===s?P=0:g===m?P=(d-c)/M:d===m?P=2+(c-g)/M:c===m&&(P=4+(g-d)/M),P=Math.min(P*60,360),P<0&&(P+=360),j=(s+m)/2,m===s?R=0:j<=.5?R=M/(m+s):R=M/(2-m-s),[P,R*100,j*100]},_.rgb.hsv=function(v){var g,d,c,s,m,M=v[0]/255,P=v[1]/255,R=v[2]/255,j=Math.max(M,P,R),Q=j-Math.min(M,P,R),G=function(W){return(j-W)/6/Q+1/2};return Q===0?s=m=0:(m=Q/j,g=G(M),d=G(P),c=G(R),M===j?s=c-d:P===j?s=1/3+g-c:R===j&&(s=2/3+d-g),s<0?s+=1:s>1&&(s-=1)),[s*360,m*100,j*100]},_.rgb.hwb=function(v){var g=v[0],d=v[1],c=v[2],s=_.rgb.hsl(v)[0],m=1/255*Math.min(g,Math.min(d,c));return c=1-1/255*Math.max(g,Math.max(d,c)),[s,m*100,c*100]},_.rgb.cmyk=function(v){var g=v[0]/255,d=v[1]/255,c=v[2]/255,s,m,M,P;return P=Math.min(1-g,1-d,1-c),s=(1-g-P)/(1-P)||0,m=(1-d-P)/(1-P)||0,M=(1-c-P)/(1-P)||0,[s*100,m*100,M*100,P*100]};function p(v,g){return Math.pow(v[0]-g[0],2)+Math.pow(v[1]-g[1],2)+Math.pow(v[2]-g[2],2)}_.rgb.keyword=function(v){var g=U[v];if(g)return g;var d=1/0,c;for(var s in k)if(k.hasOwnProperty(s)){var m=k[s],M=p(v,m);M.04045?Math.pow((g+.055)/1.055,2.4):g/12.92,d=d>.04045?Math.pow((d+.055)/1.055,2.4):d/12.92,c=c>.04045?Math.pow((c+.055)/1.055,2.4):c/12.92;var s=g*.4124+d*.3576+c*.1805,m=g*.2126+d*.7152+c*.0722,M=g*.0193+d*.1192+c*.9505;return[s*100,m*100,M*100]},_.rgb.lab=function(v){var g=_.rgb.xyz(v),d=g[0],c=g[1],s=g[2],m,M,P;return d/=95.047,c/=100,s/=108.883,d=d>.008856?Math.pow(d,1/3):7.787*d+16/116,c=c>.008856?Math.pow(c,1/3):7.787*c+16/116,s=s>.008856?Math.pow(s,1/3):7.787*s+16/116,m=116*c-16,M=500*(d-c),P=200*(c-s),[m,M,P]},_.hsl.rgb=function(v){var g=v[0]/360,d=v[1]/100,c=v[2]/100,s,m,M,P,R;if(d===0)return R=c*255,[R,R,R];c<.5?m=c*(1+d):m=c+d-c*d,s=2*c-m,P=[0,0,0];for(var j=0;j<3;j++)M=g+1/3*-(j-1),M<0&&M++,M>1&&M--,6*M<1?R=s+(m-s)*6*M:2*M<1?R=m:3*M<2?R=s+(m-s)*(2/3-M)*6:R=s,P[j]=R*255;return P},_.hsl.hsv=function(v){var g=v[0],d=v[1]/100,c=v[2]/100,s=d,m=Math.max(c,.01),M,P;return c*=2,d*=c<=1?c:2-c,s*=m<=1?m:2-m,P=(c+d)/2,M=c===0?2*s/(m+s):2*d/(c+d),[g,M*100,P*100]},_.hsv.rgb=function(v){var g=v[0]/60,d=v[1]/100,c=v[2]/100,s=Math.floor(g)%6,m=g-Math.floor(g),M=255*c*(1-d),P=255*c*(1-d*m),R=255*c*(1-d*(1-m));switch(c*=255,s){case 0:return[c,R,M];case 1:return[P,c,M];case 2:return[M,c,R];case 3:return[M,P,c];case 4:return[R,M,c];case 5:return[c,M,P]}},_.hsv.hsl=function(v){var g=v[0],d=v[1]/100,c=v[2]/100,s=Math.max(c,.01),m,M,P;return P=(2-d)*c,m=(2-d)*s,M=d*s,M/=m<=1?m:2-m,M=M||0,P/=2,[g,M*100,P*100]},_.hwb.rgb=function(v){var g=v[0]/360,d=v[1]/100,c=v[2]/100,s=d+c,m,M,P,R;s>1&&(d/=s,c/=s),m=Math.floor(6*g),M=1-c,P=6*g-m,m&1&&(P=1-P),R=d+P*(M-d);var j,Q,G;switch(m){default:case 6:case 0:j=M,Q=R,G=d;break;case 1:j=R,Q=M,G=d;break;case 2:j=d,Q=M,G=R;break;case 3:j=d,Q=R,G=M;break;case 4:j=R,Q=d,G=M;break;case 5:j=M,Q=d,G=R;break}return[j*255,Q*255,G*255]},_.cmyk.rgb=function(v){var g=v[0]/100,d=v[1]/100,c=v[2]/100,s=v[3]/100,m,M,P;return m=1-Math.min(1,g*(1-s)+s),M=1-Math.min(1,d*(1-s)+s),P=1-Math.min(1,c*(1-s)+s),[m*255,M*255,P*255]},_.xyz.rgb=function(v){var g=v[0]/100,d=v[1]/100,c=v[2]/100,s,m,M;return s=g*3.2406+d*-1.5372+c*-.4986,m=g*-.9689+d*1.8758+c*.0415,M=g*.0557+d*-.204+c*1.057,s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s*12.92,m=m>.0031308?1.055*Math.pow(m,1/2.4)-.055:m*12.92,M=M>.0031308?1.055*Math.pow(M,1/2.4)-.055:M*12.92,s=Math.min(Math.max(0,s),1),m=Math.min(Math.max(0,m),1),M=Math.min(Math.max(0,M),1),[s*255,m*255,M*255]},_.xyz.lab=function(v){var g=v[0],d=v[1],c=v[2],s,m,M;return g/=95.047,d/=100,c/=108.883,g=g>.008856?Math.pow(g,1/3):7.787*g+16/116,d=d>.008856?Math.pow(d,1/3):7.787*d+16/116,c=c>.008856?Math.pow(c,1/3):7.787*c+16/116,s=116*d-16,m=500*(g-d),M=200*(d-c),[s,m,M]},_.lab.xyz=function(v){var g=v[0],d=v[1],c=v[2],s,m,M;m=(g+16)/116,s=d/500+m,M=m-c/200;var P=Math.pow(m,3),R=Math.pow(s,3),j=Math.pow(M,3);return m=P>.008856?P:(m-16/116)/7.787,s=R>.008856?R:(s-16/116)/7.787,M=j>.008856?j:(M-16/116)/7.787,s*=95.047,m*=100,M*=108.883,[s,m,M]},_.lab.lch=function(v){var g=v[0],d=v[1],c=v[2],s,m,M;return s=Math.atan2(c,d),m=s*360/2/Math.PI,m<0&&(m+=360),M=Math.sqrt(d*d+c*c),[g,M,m]},_.lch.lab=function(v){var g=v[0],d=v[1],c=v[2],s,m,M;return M=c/360*2*Math.PI,s=d*Math.cos(M),m=d*Math.sin(M),[g,s,m]},_.rgb.ansi16=function(v){var g=v[0],d=v[1],c=v[2],s=1 in arguments?arguments[1]:_.rgb.hsv(v)[2];if(s=Math.round(s/50),s===0)return 30;var m=30+(Math.round(c/255)<<2|Math.round(d/255)<<1|Math.round(g/255));return s===2&&(m+=60),m},_.hsv.ansi16=function(v){return _.rgb.ansi16(_.hsv.rgb(v),v[2])},_.rgb.ansi256=function(v){var g=v[0],d=v[1],c=v[2];if(g===d&&d===c)return g<8?16:g>248?231:Math.round((g-8)/247*24)+232;var s=16+36*Math.round(g/255*5)+6*Math.round(d/255*5)+Math.round(c/255*5);return s},_.ansi16.rgb=function(v){var g=v%10;if(g===0||g===7)return v>50&&(g+=3.5),g=g/10.5*255,[g,g,g];var d=(~~(v>50)+1)*.5,c=(g&1)*d*255,s=(g>>1&1)*d*255,m=(g>>2&1)*d*255;return[c,s,m]},_.ansi256.rgb=function(v){if(v>=232){var g=(v-232)*10+8;return[g,g,g]}v-=16;var d,c=Math.floor(v/36)/5*255,s=Math.floor((d=v%36)/6)/5*255,m=d%6/5*255;return[c,s,m]},_.rgb.hex=function(v){var g=((Math.round(v[0])&255)<<16)+((Math.round(v[1])&255)<<8)+(Math.round(v[2])&255),d=g.toString(16).toUpperCase();return"000000".substring(d.length)+d},_.hex.rgb=function(v){var g=v.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!g)return[0,0,0];var d=g[0];g[0].length===3&&(d=d.split("").map(function(P){return P+P}).join(""));var c=parseInt(d,16),s=c>>16&255,m=c>>8&255,M=c&255;return[s,m,M]},_.rgb.hcg=function(v){var g=v[0]/255,d=v[1]/255,c=v[2]/255,s=Math.max(Math.max(g,d),c),m=Math.min(Math.min(g,d),c),M=s-m,P,R;return M<1?P=m/(1-M):P=0,M<=0?R=0:s===g?R=(d-c)/M%6:s===d?R=2+(c-g)/M:R=4+(g-d)/M+4,R/=6,R%=1,[R*360,M*100,P*100]},_.hsl.hcg=function(v){var g=v[1]/100,d=v[2]/100,c=1,s=0;return d<.5?c=2*g*d:c=2*g*(1-d),c<1&&(s=(d-.5*c)/(1-c)),[v[0],c*100,s*100]},_.hsv.hcg=function(v){var g=v[1]/100,d=v[2]/100,c=g*d,s=0;return c<1&&(s=(d-c)/(1-c)),[v[0],c*100,s*100]},_.hcg.rgb=function(v){var g=v[0]/360,d=v[1]/100,c=v[2]/100;if(d===0)return[c*255,c*255,c*255];var s=[0,0,0],m=g%1*6,M=m%1,P=1-M,R=0;switch(Math.floor(m)){case 0:s[0]=1,s[1]=M,s[2]=0;break;case 1:s[0]=P,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=M;break;case 3:s[0]=0,s[1]=P,s[2]=1;break;case 4:s[0]=M,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=P}return R=(1-d)*c,[(d*s[0]+R)*255,(d*s[1]+R)*255,(d*s[2]+R)*255]},_.hcg.hsv=function(v){var g=v[1]/100,d=v[2]/100,c=g+d*(1-g),s=0;return c>0&&(s=g/c),[v[0],s*100,c*100]},_.hcg.hsl=function(v){var g=v[1]/100,d=v[2]/100,c=d*(1-g)+.5*g,s=0;return c>0&&c<.5?s=g/(2*c):c>=.5&&c<1&&(s=g/(2*(1-c))),[v[0],s*100,c*100]},_.hcg.hwb=function(v){var g=v[1]/100,d=v[2]/100,c=g+d*(1-g);return[v[0],(c-g)*100,(1-c)*100]},_.hwb.hcg=function(v){var g=v[1]/100,d=v[2]/100,c=1-d,s=c-g,m=0;return s<1&&(m=(c-s)/(1-s)),[v[0],s*100,m*100]},_.apple.rgb=function(v){return[v[0]/65535*255,v[1]/65535*255,v[2]/65535*255]},_.rgb.apple=function(v){return[v[0]/255*65535,v[1]/255*65535,v[2]/255*65535]},_.gray.rgb=function(v){return[v[0]/100*255,v[0]/100*255,v[0]/100*255]},_.gray.hsl=_.gray.hsv=function(v){return[0,0,v[0]]},_.gray.hwb=function(v){return[0,100,v[0]]},_.gray.cmyk=function(v){return[0,0,0,v[0]]},_.gray.lab=function(v){return[v[0],0,0]},_.gray.hex=function(v){var g=Math.round(v[0]/100*255)&255,d=(g<<16)+(g<<8)+g,c=d.toString(16).toUpperCase();return"000000".substring(c.length)+c},_.rgb.gray=function(v){var g=(v[0]+v[1]+v[2])/3;return[g/255*100]}},18358:function(Mt,N,F){var k=F(44589),U=F(3314),L={},_=Object.keys(k);function I(x){var p=function(v){return v==null?v:(arguments.length>1&&(v=Array.prototype.slice.call(arguments)),x(v))};return"conversion"in x&&(p.conversion=x.conversion),p}function T(x){var p=function(v){if(v==null)return v;arguments.length>1&&(v=Array.prototype.slice.call(arguments));var g=x(v);if(typeof g=="object")for(var d=g.length,c=0;c>16&255,m>>8&255,m&255],this.valpha=1;else{this.valpha=1;var G=Object.keys(m);"alpha"in m&&(G.splice(G.indexOf("alpha"),1),this.valpha=typeof m.alpha=="number"?m.alpha:0);var W=G.sort().join("");if(!(W in I))throw new Error("Unable to parse color from object: "+JSON.stringify(m));this.model=I[W];var H=U[this.model].labels,Z=[];for(P=0;PP?(M+.05)/(P+.05):(P+.05)/(M+.05)},level:function(m){var M=this.contrast(m);return M>=7.1?"AAA":M>=4.5?"AA":""},isDark:function(){var m=this.rgb().color,M=(m[0]*299+m[1]*587+m[2]*114)/1e3;return M<128},isLight:function(){return!this.isDark()},negate:function(){for(var m=this.rgb(),M=0;M<3;M++)m.color[M]=255-m.color[M];return m},lighten:function(m){var M=this.hsl();return M.color[2]+=M.color[2]*m,M},darken:function(m){var M=this.hsl();return M.color[2]-=M.color[2]*m,M},saturate:function(m){var M=this.hsl();return M.color[1]+=M.color[1]*m,M},desaturate:function(m){var M=this.hsl();return M.color[1]-=M.color[1]*m,M},whiten:function(m){var M=this.hwb();return M.color[1]+=M.color[1]*m,M},blacken:function(m){var M=this.hwb();return M.color[2]+=M.color[2]*m,M},grayscale:function(){var m=this.rgb().color,M=m[0]*.3+m[1]*.59+m[2]*.11;return x.rgb(M,M,M)},fade:function(m){return this.alpha(this.valpha-this.valpha*m)},opaquer:function(m){return this.alpha(this.valpha+this.valpha*m)},rotate:function(m){var M=this.hsl(),P=M.color[0];return P=(P+m)%360,P=P<0?360+P:P,M.color[0]=P,M},mix:function(m,M){if(!m||!m.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof m);var P=m.rgb(),R=this.rgb(),j=M===void 0?.5:M,Q=2*j-1,G=P.alpha()-R.alpha(),W=((Q*G===-1?Q:(Q+G)/(1+Q*G))+1)/2,H=1-W;return x.rgb(W*P.red()+H*R.red(),W*P.green()+H*R.green(),W*P.blue()+H*R.blue(),P.alpha()*j+R.alpha()*(1-j))}},Object.keys(U).forEach(function(m){if(_.indexOf(m)===-1){var M=U[m].channels;x.prototype[m]=function(){if(this.model===m)return new x(this);if(arguments.length)return new x(arguments,m);var P=typeof arguments[M]=="number"?M:this.valpha;return new x(c(U[this.model][m].raw(this.color)).concat(P),m)},x[m]=function(P){return typeof P=="number"&&(P=s(L.call(arguments),M)),new x(P,m)}}});function p(m,M){return Number(m.toFixed(M))}function v(m){return function(M){return p(M,m)}}function g(m,M,P){return m=Array.isArray(m)?m:[m],m.forEach(function(R){(T[R]||(T[R]=[]))[M]=P}),m=m[0],function(R){var j;return arguments.length?(P&&(R=P(R)),j=this[m](),j.color[M]=R,j):(j=this[m]().color[M],P&&(j=P(j)),j)}}function d(m){return function(M){return Math.max(0,Math.min(m,M))}}function c(m){return Array.isArray(m)?m:[m]}function s(m,M){for(var P=0;P=(Te=(ye+Se)/2))?ye=Te:Se=Te,(ft=K>=(ke=(Ae+we)/2))?Ae=ke:we=ke,se=fe,!(fe=fe[Lt=ft<<1|He]))return se[Lt]=Ie,Z;if(Ge=+Z._x.call(null,fe.data),tt=+Z._y.call(null,fe.data),J===Ge&&K===tt)return Ie.next=fe,se?se[Lt]=Ie:Z._root=Ie,Z;do se=se?se[Lt]=new Array(4):Z._root=new Array(4),(He=J>=(Te=(ye+Se)/2))?ye=Te:Se=Te,(ft=K>=(ke=(Ae+we)/2))?Ae=ke:we=ke;while((Lt=ft<<1|He)===(Jt=(tt>=ke)<<1|Ge>=Te));return se[Jt]=fe,se[Lt]=Ie,Z}function L(Z){var J,K,ne=Z.length,se,fe,Ie=new Array(ne),ye=new Array(ne),Ae=1/0,Se=1/0,we=-1/0,Te=-1/0;for(K=0;Kwe&&(we=se),feTe&&(Te=fe));if(Ae>we||Se>Te)return this;for(this.cover(Ae,Se).cover(we,Te),K=0;KZ||Z>=se||ne>J||J>=fe;)switch(Se=(Jwe||(ye=tt.y0)>Te||(Ae=tt.x1)=Lt)<<1|Z>=ft)&&(tt=ke[ke.length-1],ke[ke.length-1]=ke[ke.length-1-He],ke[ke.length-1-He]=tt)}else{var Jt=Z-+this._x.call(null,Ge.data),Qe=J-+this._y.call(null,Ge.data),ut=Jt*Jt+Qe*Qe;if(ut=(ke=(Ie+Ae)/2))?Ie=ke:Ae=ke,(He=Te>=(Ge=(ye+Se)/2))?ye=Ge:Se=Ge,J=K,!(K=K[ft=He<<1|tt]))return this;if(!K.length)break;(J[ft+1&3]||J[ft+2&3]||J[ft+3&3])&&(ne=J,Lt=ft)}for(;K.data!==Z;)if(se=K,!(K=K.next))return this;return(fe=K.next)&&delete K.next,se?(fe?se.next=fe:delete se.next,this):J?(fe?J[ft]=fe:delete J[ft],(K=J[0]||J[1]||J[2]||J[3])&&K===(J[3]||J[2]||J[1]||J[0])&&!K.length&&(ne?ne[Lt]=K:this._root=K),this):(this._root=fe,this)}function g(Z){for(var J=0,K=Z.length;J-1},Q=function(f,w){var B=this.__data__,V=m(B,f);return V<0?(++this.size,B.push([f,w])):B[V][1]=w,this};function G(f){var w=-1,B=f==null?0:f.length;for(this.clear();++w-1&&f%1==0&&f-1&&f%1==0&&f<=9007199254740991},er={};er["[object Float32Array]"]=er["[object Float64Array]"]=er["[object Int8Array]"]=er["[object Int16Array]"]=er["[object Int32Array]"]=er["[object Uint8Array]"]=er["[object Uint8ClampedArray]"]=er["[object Uint16Array]"]=er["[object Uint32Array]"]=!0,er["[object Arguments]"]=er["[object Array]"]=er["[object ArrayBuffer]"]=er["[object Boolean]"]=er["[object DataView]"]=er["[object Date]"]=er["[object Error]"]=er["[object Function]"]=er["[object Map]"]=er["[object Number]"]=er["[object Object]"]=er["[object RegExp]"]=er["[object Set]"]=er["[object String]"]=er["[object WeakMap]"]=!1;var Ur=function(f){return b(f)&&Ft(f.length)&&!!er[He(f)]},Ct=function(f){return function(w){return f(w)}},Kt=d(function(f,w){var B=w&&!w.nodeType&&w,V=B&&f&&!f.nodeType&&f,re=V&&V.exports===B&&ne.process,oe=function(){try{var le=V&&V.require&&V.require("util").types;return le||re&&re.binding&&re.binding("util")}catch(ge){}}();f.exports=oe}),lr=Kt&&Kt.isTypedArray,Dr=lr?Ct(lr):Ur,br=Object.prototype.hasOwnProperty,sa=function(f,w){var B=Le(f),V=!B&&me(f),re=!B&&!V&&qe(f),oe=!B&&!V&&!re&&Dr(f),le=B||V||re||oe,ge=le?C(f.length,String):[],_e=ge.length;for(var Ne in f)!w&&!br.call(f,Ne)||le&&(Ne=="length"||re&&(Ne=="offset"||Ne=="parent")||oe&&(Ne=="buffer"||Ne=="byteLength"||Ne=="byteOffset")||nr(Ne,_e))||ge.push(Ne);return ge},ea=Object.prototype,gn=function(f){var w=f&&f.constructor;return f===(typeof w=="function"&&w.prototype||ea)},Tn=function(f,w){return function(B){return f(w(B))}},ra=Tn(Object.keys,Object),Zn=Object.prototype.hasOwnProperty,Vr=function(f){if(!gn(f))return ra(f);var w=[];for(var B in Object(f))Zn.call(f,B)&&B!="constructor"&&w.push(B);return w},In=function(f){return f!=null&&Ft(f.length)&&!Jt(f)},at=function(f){return In(f)?sa(f):Vr(f)},D=function(f,w){return f&&ee(w,at(w),f)},te=function(f){var w=[];if(f!=null)for(var B in Object(f))w.push(B);return w},xe=Object.prototype.hasOwnProperty,be=function(f){if(!ft(f))return te(f);var w=gn(f),B=[];for(var V in f)(V!="constructor"||!w&&xe.call(f,V))&&B.push(V);return B},De=function(f){return In(f)?sa(f,!0):be(f)},Xe=function(f,w){return f&&ee(w,De(w),f)},Je=d(function(f,w){var B=w&&!w.nodeType&&w,V=B&&f&&!f.nodeType&&f,re=V&&V.exports===B?fe.Buffer:void 0,oe=re?re.allocUnsafe:void 0;f.exports=function(le,ge){if(ge)return le.slice();var _e=le.length,Ne=oe?oe(_e):new le.constructor(_e);return le.copy(Ne),Ne}}),lt=function(f,w){var B=-1,V=f.length;for(w||(w=Array(V));++Bge))return!1;var Ne=oe.get(f),ze=oe.get(w);if(Ne&&ze)return Ne==w&&ze==f;var Be=-1,nt=!0,_t=2&B?new no:void 0;for(oe.set(f,w),oe.set(w,f);++Be0&&V(_e)?B>1?f(_e,B-1,V,re,oe):Jr(oe,_e):re||(oe[oe.length]=_e)}return oe},ms=function(f,w,B){switch(B.length){case 0:return f.call(w);case 1:return f.call(w,B[0]);case 2:return f.call(w,B[0],B[1]);case 3:return f.call(w,B[0],B[1],B[2])}return f.apply(w,B)},Zu=Math.max,rs=function(f,w,B){return w=Zu(w===void 0?f.length-1:w,0),function(){for(var V=arguments,re=-1,oe=Zu(V.length-w,0),le=Array(oe);++re0){if(++w>=800)return arguments[0]}else w=0;return f.apply(void 0,arguments)}}(ii),io=function(f,w){return bs(rs(f,w,xi),f+"")},ns=function(f,w,B,V){for(var re=f.length,oe=B+(V?1:-1);V?oe--:++oe-1},oc=function(f,w,B){for(var V=-1,re=f==null?0:f.length;++V=200){var Ne=w?null:Cf(f);if(Ne)return uu(Ne);le=!1,re=po,_e=new no}else _e=w?[]:ge;e:for(;++Voe){var le=re;re=oe,oe=le}return re+""+oe+""+(Qr.isUndefined(V)?"\0":V)}function Tf(f,w,B,V){var re=""+w,oe=""+B;if(!f&&re>oe){var le=re;re=oe,oe=le}var ge={v:re,w:oe};return V&&(ge.name=V),ge}function xs(f,w){return Go(f,w.v,w.w,w.name)}na.prototype._nodeCount=0,na.prototype._edgeCount=0,na.prototype.isDirected=function(){return this._isDirected},na.prototype.isMultigraph=function(){return this._isMultigraph},na.prototype.isCompound=function(){return this._isCompound},na.prototype.setGraph=function(f){return this._label=f,this},na.prototype.graph=function(){return this._label},na.prototype.setDefaultNodeLabel=function(f){return Qr.isFunction(f)||(f=Qr.constant(f)),this._defaultNodeLabelFn=f,this},na.prototype.nodeCount=function(){return this._nodeCount},na.prototype.nodes=function(){return Qr.keys(this._nodes)},na.prototype.sources=function(){var f=this;return Qr.filter(this.nodes(),function(w){return Qr.isEmpty(f._in[w])})},na.prototype.sinks=function(){var f=this;return Qr.filter(this.nodes(),function(w){return Qr.isEmpty(f._out[w])})},na.prototype.setNodes=function(f,w){var B=arguments,V=this;return Qr.each(f,function(re){B.length>1?V.setNode(re,w):V.setNode(re)}),this},na.prototype.setNode=function(f,w){return Qr.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=w),this):(this._nodes[f]=arguments.length>1?w:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]="\0",this._children[f]={},this._children["\0"][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},na.prototype.node=function(f){return this._nodes[f]},na.prototype.hasNode=function(f){return Qr.has(this._nodes,f)},na.prototype.removeNode=function(f){var w=this;if(Qr.has(this._nodes,f)){var B=function(V){w.removeEdge(w._edgeObjs[V])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],Qr.each(this.children(f),function(V){w.setParent(V)}),delete this._children[f]),Qr.each(Qr.keys(this._in[f]),B),delete this._in[f],delete this._preds[f],Qr.each(Qr.keys(this._out[f]),B),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},na.prototype.setParent=function(f,w){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(Qr.isUndefined(w))w="\0";else{for(var B=w+="";!Qr.isUndefined(B);B=this.parent(B))if(B===f)throw new Error("Setting "+w+" as parent of "+f+" would create a cycle");this.setNode(w)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=w,this._children[w][f]=!0,this},na.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},na.prototype.parent=function(f){if(this._isCompound){var w=this._parent[f];if(w!=="\0")return w}},na.prototype.children=function(f){if(Qr.isUndefined(f)&&(f="\0"),this._isCompound){var w=this._children[f];if(w)return Qr.keys(w)}else{if(f==="\0")return this.nodes();if(this.hasNode(f))return[]}},na.prototype.predecessors=function(f){var w=this._preds[f];if(w)return Qr.keys(w)},na.prototype.successors=function(f){var w=this._sucs[f];if(w)return Qr.keys(w)},na.prototype.neighbors=function(f){var w=this.predecessors(f);if(w)return Qr.union(w,this.successors(f))},na.prototype.isLeaf=function(f){return(this.isDirected()?this.successors(f):this.neighbors(f)).length===0},na.prototype.filterNodes=function(f){var w=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});w.setGraph(this.graph());var B=this;Qr.each(this._nodes,function(oe,le){f(le)&&w.setNode(le,oe)}),Qr.each(this._edgeObjs,function(oe){w.hasNode(oe.v)&&w.hasNode(oe.w)&&w.setEdge(oe,B.edge(oe))});var V={};function re(oe){var le=B.parent(oe);return le===void 0||w.hasNode(le)?(V[oe]=le,le):le in V?V[le]:re(le)}return this._isCompound&&Qr.each(w.nodes(),function(oe){w.setParent(oe,re(oe))}),w},na.prototype.setDefaultEdgeLabel=function(f){return Qr.isFunction(f)||(f=Qr.constant(f)),this._defaultEdgeLabelFn=f,this},na.prototype.edgeCount=function(){return this._edgeCount},na.prototype.edges=function(){return Qr.values(this._edgeObjs)},na.prototype.setPath=function(f,w){var B=this,V=arguments;return Qr.reduce(f,function(re,oe){return V.length>1?B.setEdge(re,oe,w):B.setEdge(re,oe),oe}),this},na.prototype.setEdge=function(){var f,w,B,V,re=!1,oe=arguments[0];typeof oe=="object"&&oe!==null&&"v"in oe?(f=oe.v,w=oe.w,B=oe.name,arguments.length===2&&(V=arguments[1],re=!0)):(f=oe,w=arguments[1],B=arguments[3],arguments.length>2&&(V=arguments[2],re=!0)),f=""+f,w=""+w,Qr.isUndefined(B)||(B=""+B);var le=Go(this._isDirected,f,w,B);if(Qr.has(this._edgeLabels,le))return re&&(this._edgeLabels[le]=V),this;if(!Qr.isUndefined(B)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(w),this._edgeLabels[le]=re?V:this._defaultEdgeLabelFn(f,w,B);var ge=Tf(this._isDirected,f,w,B);return f=ge.v,w=ge.w,Object.freeze(ge),this._edgeObjs[le]=ge,Zs(this._preds[w],f),Zs(this._sucs[f],w),this._in[w][le]=ge,this._out[f][le]=ge,this._edgeCount++,this},na.prototype.edge=function(f,w,B){var V=arguments.length===1?xs(this._isDirected,arguments[0]):Go(this._isDirected,f,w,B);return this._edgeLabels[V]},na.prototype.hasEdge=function(f,w,B){var V=arguments.length===1?xs(this._isDirected,arguments[0]):Go(this._isDirected,f,w,B);return Qr.has(this._edgeLabels,V)},na.prototype.removeEdge=function(f,w,B){var V=arguments.length===1?xs(this._isDirected,arguments[0]):Go(this._isDirected,f,w,B),re=this._edgeObjs[V];return re&&(f=re.v,w=re.w,delete this._edgeLabels[V],delete this._edgeObjs[V],Ks(this._preds[w],f),Ks(this._sucs[f],w),delete this._in[w][V],delete this._out[f][V],this._edgeCount--),this},na.prototype.inEdges=function(f,w){var B=this._in[f];if(B){var V=Qr.values(B);return w?Qr.filter(V,function(re){return re.v===w}):V}},na.prototype.outEdges=function(f,w){var B=this._out[f];if(B){var V=Qr.values(B);return w?Qr.filter(V,function(re){return re.w===w}):V}},na.prototype.nodeEdges=function(f,w){var B=this.inEdges(f,w);if(B)return B.concat(this.outEdges(f,w))};var xu={Graph:is,version:"2.1.8"},If={write:function(f){var w={options:{directed:f.isDirected(),multigraph:f.isMultigraph(),compound:f.isCompound()},nodes:Af(f),edges:oo(f)};return Qr.isUndefined(f.graph())||(w.value=Qr.clone(f.graph())),w},read:function(f){var w=new is(f.options).setGraph(f.value);return Qr.each(f.nodes,function(B){w.setNode(B.v,B.value),B.parent&&w.setParent(B.v,B.parent)}),Qr.each(f.edges,function(B){w.setEdge({v:B.v,w:B.w,name:B.name},B.value)}),w}};function Af(f){return Qr.map(f.nodes(),function(w){var B=f.node(w),V=f.parent(w),re={v:w};return Qr.isUndefined(B)||(re.value=B),Qr.isUndefined(V)||(re.parent=V),re})}function oo(f){return Qr.map(f.edges(),function(w){var B=f.edge(w),V={v:w.v,w:w.w};return Qr.isUndefined(w.name)||(V.name=w.name),Qr.isUndefined(B)||(V.value=B),V})}var q=function(f){var w,B={},V=[];function re(oe){Qr.has(B,oe)||(B[oe]=!0,w.push(oe),Qr.each(f.successors(oe),re),Qr.each(f.predecessors(oe),re))}return Qr.each(f.nodes(),function(oe){w=[],re(oe),w.length&&V.push(w)}),V},de=Ee;function Ee(){this._arr=[],this._keyIndices={}}Ee.prototype.size=function(){return this._arr.length},Ee.prototype.keys=function(){return this._arr.map(function(f){return f.key})},Ee.prototype.has=function(f){return Qr.has(this._keyIndices,f)},Ee.prototype.priority=function(f){var w=this._keyIndices[f];if(w!==void 0)return this._arr[w].priority},Ee.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},Ee.prototype.add=function(f,w){var B=this._keyIndices;if(f=String(f),!Qr.has(B,f)){var V=this._arr,re=V.length;return B[f]=re,V.push({key:f,priority:w}),this._decrease(re),!0}return!1},Ee.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var f=this._arr.pop();return delete this._keyIndices[f.key],this._heapify(0),f.key},Ee.prototype.decrease=function(f,w){var B=this._keyIndices[f];if(w>this._arr[B].priority)throw new Error("New priority is greater than current priority. Key: "+f+" Old: "+this._arr[B].priority+" New: "+w);this._arr[B].priority=w,this._decrease(B)},Ee.prototype._heapify=function(f){var w=this._arr,B=2*f,V=B+1,re=f;B>1].priority0&&(_e=Be.removeMin(),(Ne=ze[_e]).distance!==Number.POSITIVE_INFINITY);)ge(_e).forEach(nt);return ze}(f,String(w),B||je,V||function(re){return f.outEdges(re)})},je=Qr.constant(1),bt=function(f,w,B){return Qr.transform(f.nodes(),function(V,re){V[re]=Pe(f,re,w,B)},{})},St=function(f){var w=0,B=[],V={},re=[];function oe(le){var ge=V[le]={onStack:!0,lowlink:w,index:w++};if(B.push(le),f.successors(le).forEach(function(ze){Qr.has(V,ze)?V[ze].onStack&&(ge.lowlink=Math.min(ge.lowlink,V[ze].index)):(oe(ze),ge.lowlink=Math.min(ge.lowlink,V[ze].lowlink))}),ge.lowlink===ge.index){var _e,Ne=[];do _e=B.pop(),V[_e].onStack=!1,Ne.push(_e);while(le!==_e);re.push(Ne)}}return f.nodes().forEach(function(le){Qr.has(V,le)||oe(le)}),re},jt=function(f){return Qr.filter(St(f),function(w){return w.length>1||w.length===1&&f.hasEdge(w[0],w[0])})},vr=function(f,w,B){return function(V,re,oe){var le={},ge=V.nodes();return ge.forEach(function(_e){le[_e]={},le[_e][_e]={distance:0},ge.forEach(function(Ne){_e!==Ne&&(le[_e][Ne]={distance:Number.POSITIVE_INFINITY})}),oe(_e).forEach(function(Ne){var ze=Ne.v===_e?Ne.w:Ne.v,Be=re(Ne);le[_e][ze]={distance:Be,predecessor:_e}})}),ge.forEach(function(_e){var Ne=le[_e];ge.forEach(function(ze){var Be=le[ze];ge.forEach(function(nt){var _t=Be[_e],tr=Ne[nt],Pt=Be[nt],kt=_t.distance+tr.distance;kt0;){if(B=oe.removeMin(),Qr.has(re,B))V.setEdge(B,re[B]);else{if(ge)throw new Error("Input graph is not connected: "+f);ge=!0}f.nodeEdges(B).forEach(le)}return V},tarjan:St,topsort:$r},version:xu.version};try{Dn=Nn}catch(f){}Dn||(Dn=window.graphlib);var zn=Dn,pn=function(f){return So(f,5)},Yn=function(f,w,B){if(!ft(B))return!1;var V=typeof w;return!!(V=="number"?In(B)&&nr(w,B.length):V=="string"&&w in B)&&s(B[w],f)},Xn=Object.prototype,bn=Xn.hasOwnProperty,Qn=io(function(f,w){f=Object(f);var B=-1,V=w.length,re=V>2?w[2]:void 0;for(re&&Yn(w[0],w[1],re)&&(V=1);++B-1?re[oe?w[le]:le]:void 0}},Da=/^\s+|\s+$/g,Ma=/^[-+]0x[0-9a-f]+$/i,ha=/^0b[01]+$/i,Pa=/^0o[0-7]+$/i,Qa=parseInt,Ya=function(f){if(typeof f=="number")return f;if(Fa(f))return NaN;if(ft(f)){var w=typeof f.valueOf=="function"?f.valueOf():f;f=ft(w)?w+"":w}if(typeof f!="string")return f===0?f:+f;f=f.replace(Da,"");var B=ha.test(f);return B||Pa.test(f)?Qa(f.slice(2),B?2:8):Ma.test(f)?NaN:+f},zo=function(f){return f?(f=Ya(f))===1/0||f===-1/0?17976931348623157e292*(f<0?-1:1):f==f?f:0:f===0?f:0},Qu=function(f){var w=zo(f),B=w%1;return w==w?B?w-B:w:0},To=Math.max,$s=ga(function(f,w,B){var V=f==null?0:f.length;if(!V)return-1;var re=B==null?0:Qu(B);return re<0&&(re=To(V+re,0)),ns(f,Xi(w),re)}),Qi=function(f){return f!=null&&f.length?ts(f,1):[]},Io=function(f,w){return f==null?f:mi(f,Vn(w),De)},wu=function(f){var w=f==null?0:f.length;return w?f[w-1]:void 0},sc=function(f,w){var B={};return w=Xi(w),_o(f,function(V,re,oe){Wn(B,re,w(V,re,oe))}),B},Qs=function(f,w,B){for(var V=-1,re=f.length;++Vw},Of=function(f){return f&&f.length?Qs(f,xi,ei):void 0},ws=function(f,w,B){(B!==void 0&&!s(f[w],B)||B===void 0&&!(w in f))&&Wn(f,w,B)},Ss=Function.prototype,Ju=Object.prototype,so=Ss.toString,qu=Ju.hasOwnProperty,Uo=so.call(Object),_s=function(f){if(!b(f)||He(f)!="[object Object]")return!1;var w=jn(f);if(w===null)return!0;var B=qu.call(w,"constructor")&&w.constructor;return typeof B=="function"&&B instanceof B&&so.call(B)==Uo},Zr=function(f,w){if((w!=="constructor"||typeof f[w]!="function")&&w!="__proto__")return f[w]},uc=function(f){return ee(f,De(f))},al=function(f,w,B,V,re,oe,le){var ge=Zr(f,B),_e=Zr(w,B),Ne=le.get(_e);if(Ne)ws(f,B,Ne);else{var ze=oe?oe(ge,_e,B+"",f,w,le):void 0,Be=ze===void 0;if(Be){var nt=Le(_e),_t=!nt&&qe(_e),tr=!nt&&!_t&&Dr(_e);ze=_e,nt||_t||tr?Le(ge)?ze=ge:Ku(ge)?ze=lt(ge):_t?(Be=!1,ze=Je(_e,!0)):tr?(Be=!1,ze=Ho(_e,!0)):ze=[]:_s(_e)||me(_e)?(ze=ge,me(ge)?ze=uc(ge):ft(ge)&&!Jt(ge)||(ze=ro(_e))):Be=!1}Be&&(le.set(_e,ze),re(ze,_e,V,oe,le),le.delete(_e)),ws(f,B,ze)}},Ji=function f(w,B,V,re,oe){w!==B&&mi(B,function(le,ge){if(oe||(oe=new xn),ft(le))al(w,B,ge,V,f,re,oe);else{var _e=re?re(Zr(w,ge),le,ge+"",w,B,oe):void 0;_e===void 0&&(_e=le),ws(w,ge,_e)}},De)},Wo=function(f){return io(function(w,B){var V=-1,re=B.length,oe=re>1?B[re-1]:void 0,le=re>2?B[2]:void 0;for(oe=f.length>3&&typeof oe=="function"?(re--,oe):void 0,le&&Yn(B[0],B[1],le)&&(oe=re<3?void 0:oe,re=1),w=Object(w);++Vw||oe&&le&&_e&&!ge&&!Ne||V&&le&&_e||!B&&_e||!re)return 1;if(!V&&!oe&&!Ne&&f=ge?_e:_e*(B[V]=="desc"?-1:1)}return f.index-w.index},Cu=function(f,w,B){w=w.length?Oi(w,function(oe){return Le(oe)?function(le){return Fs(le,oe.length===1?oe[0]:oe)}:oe}):[xi];var V=-1;w=Oi(w,Ct(Xi));var re=zs(f,function(oe,le,ge){return{criteria:Oi(w,function(_e){return _e(oe)}),index:++V,value:oe}});return hc(re,function(oe,le){return gc(oe,le,B)})},tf=io(function(f,w){if(f==null)return[];var B=w.length;return B>1&&Yn(f,w[0],w[1])?w=[]:B>2&&Yn(w[0],w[1],w[2])&&(w=[w[0]]),Cu(f,ts(w,1),[])}),Ci=0,Df=function(f){var w=++Ci;return lu(f)+w},il=function(f,w,B){for(var V=-1,re=f.length,oe=w.length,le={};++V0;--Be)if(ge=oe[Be].dequeue()){_e=_e.concat(Pf(re,oe,le,ge,!0));break}}}return _e}(B.graph,B.buckets,B.zeroIdx);return ht.flatten(ht.map(V,function(re){return f.outEdges(re.v,re.w)}),!0)},fl=ht.constant(1);function Pf(f,w,B,V,re){var oe=re?[]:void 0;return ht.forEach(f.inEdges(V.v),function(le){var ge=f.edge(le),_e=f.node(le.v);re&&oe.push({v:le.v,w:le.w}),_e.out-=ge,yc(w,B,_e)}),ht.forEach(f.outEdges(V.v),function(le){var ge=f.edge(le),_e=le.w,Ne=f.node(_e);Ne.in-=ge,yc(w,B,Ne)}),f.removeNode(V.v),oe}function yc(f,w,B){B.out?B.in?f[B.out-B.in+w].enqueue(B):f[f.length-1].enqueue(B):f[0].enqueue(B)}var oi={run:function(f){var w=f.graph().acyclicer==="greedy"?ul(f,function(B){return function(V){return B.edge(V).weight}}(f)):function(B){var V=[],re={},oe={};function le(ge){ht.has(oe,ge)||(oe[ge]=!0,re[ge]=!0,ht.forEach(B.outEdges(ge),function(_e){ht.has(re,_e.w)?V.push(_e):le(_e.w)}),delete re[ge])}return ht.forEach(B.nodes(),le),V}(f);ht.forEach(w,function(B){var V=f.edge(B);f.removeEdge(B),V.forwardName=B.name,V.reversed=!0,f.setEdge(B.w,B.v,V,ht.uniqueId("rev"))})},undo:function(f){ht.forEach(f.edges(),function(w){var B=f.edge(w);if(B.reversed){f.removeEdge(w);var V=B.forwardName;delete B.reversed,delete B.forwardName,f.setEdge(w.w,w.v,B,V)}})}},kf=zn.Graph,gi={addDummyNode:Ms,simplify:function(f){var w=new kf().setGraph(f.graph());return ht.forEach(f.nodes(),function(B){w.setNode(B,f.node(B))}),ht.forEach(f.edges(),function(B){var V=w.edge(B.v,B.w)||{weight:0,minlen:1},re=f.edge(B);w.setEdge(B.v,B.w,{weight:V.weight+re.weight,minlen:Math.max(V.minlen,re.minlen)})}),w},asNonCompoundGraph:function(f){var w=new kf({multigraph:f.isMultigraph()}).setGraph(f.graph());return ht.forEach(f.nodes(),function(B){f.children(B).length||w.setNode(B,f.node(B))}),ht.forEach(f.edges(),function(B){w.setEdge(B,f.edge(B))}),w},successorWeights:function(f){var w=ht.map(f.nodes(),function(B){var V={};return ht.forEach(f.outEdges(B),function(re){V[re.w]=(V[re.w]||0)+f.edge(re).weight}),V});return ht.zipObject(f.nodes(),w)},predecessorWeights:function(f){var w=ht.map(f.nodes(),function(B){var V={};return ht.forEach(f.inEdges(B),function(re){V[re.v]=(V[re.v]||0)+f.edge(re).weight}),V});return ht.zipObject(f.nodes(),w)},intersectRect:function(f,w){var B,V,re=f.x,oe=f.y,le=w.x-re,ge=w.y-oe,_e=f.width/2,Ne=f.height/2;if(!le&&!ge)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(ge)*_e>Math.abs(le)*Ne?(ge<0&&(Ne=-Ne),B=Ne*le/ge,V=Ne):(le<0&&(_e=-_e),B=_e,V=_e*ge/le),{x:re+B,y:oe+V}},buildLayerMatrix:function(f){var w=ht.map(ht.range(mc(f)+1),function(){return[]});return ht.forEach(f.nodes(),function(B){var V=f.node(B),re=V.rank;ht.isUndefined(re)||(w[re][V.order]=B)}),w},normalizeRanks:function(f){var w=ht.min(ht.map(f.nodes(),function(B){return f.node(B).rank}));ht.forEach(f.nodes(),function(B){var V=f.node(B);ht.has(V,"rank")&&(V.rank-=w)})},removeEmptyRanks:function(f){var w=ht.min(ht.map(f.nodes(),function(oe){return f.node(oe).rank})),B=[];ht.forEach(f.nodes(),function(oe){var le=f.node(oe).rank-w;B[le]||(B[le]=[]),B[le].push(oe)});var V=0,re=f.graph().nodeRankFactor;ht.forEach(B,function(oe,le){ht.isUndefined(oe)&&le%re!=0?--V:V&&ht.forEach(oe,function(ge){f.node(ge).rank+=V})})},addBorderNode:function(f,w,B,V){var re={width:0,height:0};return arguments.length>=4&&(re.rank=B,re.order=V),Ms(f,"border",re,w)},maxRank:mc,partition:function(f,w){var B={lhs:[],rhs:[]};return ht.forEach(f,function(V){w(V)?B.lhs.push(V):B.rhs.push(V)}),B},time:function(f,w){var B=ht.now();try{return w()}finally{console.log(f+" time: "+(ht.now()-B)+"ms")}},notime:function(f,w){return w()}};function Ms(f,w,B,V){var re;do re=ht.uniqueId(V);while(f.hasNode(re));return B.dummy=w,f.setNode(re,B),re}function mc(f){return ht.max(ht.map(f.nodes(),function(w){var B=f.node(w).rank;if(!ht.isUndefined(B))return B}))}var nf={run:function(f){f.graph().dummyChains=[],ht.forEach(f.edges(),function(w){(function(B,V){var re,oe,le,ge=V.v,_e=B.node(ge).rank,Ne=V.w,ze=B.node(Ne).rank,Be=V.name,nt=B.edge(V),_t=nt.labelRank;if(ze!==_e+1){for(B.removeEdge(V),le=0,++_e;_ele.lim&&(ge=le,_e=!0);var Ne=ht.filter(w.edges(),function(ze){return _e===Sc(f,f.node(ze.v),ge)&&_e!==Sc(f,f.node(ze.w),ge)});return ht.minBy(Ne,function(ze){return Rf(w,ze)})}function tu(f,w,B,V){var re=B.v,oe=B.w;f.removeEdge(re,oe),f.setEdge(V.v,V.w,{}),Ff(f),Ec(f,w),function(le,ge){var _e=ht.find(le.nodes(),function(ze){return!ge.node(ze).parent}),Ne=af(le,_e);Ne=Ne.slice(1),ht.forEach(Ne,function(ze){var Be=le.node(ze).parent,nt=ge.edge(ze,Be),_t=!1;nt||(nt=ge.edge(Be,ze),_t=!0),ge.node(ze).rank=ge.node(Be).rank+(_t?nt.minlen:-nt.minlen)})}(f,w)}function Sc(f,w,B){return B.low<=w.lim&&w.lim<=B.lim}uo.initLowLimValues=Ff,uo.initCutValues=Ec,uo.calcCutValue=Fc,uo.leaveEdge=wc,uo.enterEdge=Gc,uo.exchangeEdges=tu;var _c=Xo,cl=function(f){switch(f.graph().ranker){case"network-simplex":zc(f);break;case"tight-tree":(function(w){_c(w),Tu(w)})(f);break;case"longest-path":Vo(f);break;default:zc(f)}},Vo=_c;function zc(f){ss(f)}var ll=function(f){var w=function(B){var V={},re=0;function oe(le){var ge=re;ht.forEach(B.children(le),oe),V[le]={low:ge,lim:re++}}return ht.forEach(B.children(),oe),V}(f);ht.forEach(f.graph().dummyChains,function(B){for(var V=f.node(B),re=V.edgeObj,oe=function(Be,nt,_t,tr){var Pt,kt,Dt=[],pr=[],Xr=Math.min(nt[_t].low,nt[tr].low),Or=Math.max(nt[_t].lim,nt[tr].lim);Pt=_t;do Pt=Be.parent(Pt),Dt.push(Pt);while(Pt&&(nt[Pt].low>Xr||Or>nt[Pt].lim));for(kt=Pt,Pt=tr;(Pt=Be.parent(Pt))!==kt;)pr.push(Pt);return{path:Dt.concat(pr.reverse()),lca:kt}}(f,w,re.v,re.w),le=oe.path,ge=oe.lca,_e=0,Ne=le[_e],ze=!0;B!==re.w;){if(V=f.node(B),ze){for(;(Ne=le[_e])!==ge&&f.node(Ne).maxRank0;)ze%2&&(Be+=ge[ze+1]),ge[ze=ze-1>>1]+=Ne.weight;_e+=Ne.weight*Be})),_e}var Mc=function(f,w){return ht.map(w,function(B){var V=f.inEdges(B);if(V.length){var re=ht.reduce(V,function(oe,le){var ge=f.edge(le),_e=f.node(le.v);return{sum:oe.sum+ge.weight*_e.order,weight:oe.weight+ge.weight}},{sum:0,weight:0});return{v:B,barycenter:re.sum/re.weight,weight:re.weight}}return{v:B}})},Xf=function(f,w){var B={};return ht.forEach(f,function(V,re){var oe=B[V.v]={indegree:0,in:[],out:[],vs:[V.v],i:re};ht.isUndefined(V.barycenter)||(oe.barycenter=V.barycenter,oe.weight=V.weight)}),ht.forEach(w.edges(),function(V){var re=B[V.v],oe=B[V.w];ht.isUndefined(re)||ht.isUndefined(oe)||(oe.indegree++,re.out.push(B[V.w]))}),function(V){var re=[];function oe(_e){return function(Ne){Ne.merged||(ht.isUndefined(Ne.barycenter)||ht.isUndefined(_e.barycenter)||Ne.barycenter>=_e.barycenter)&&function(ze,Be){var nt=0,_t=0;ze.weight&&(nt+=ze.barycenter*ze.weight,_t+=ze.weight),Be.weight&&(nt+=Be.barycenter*Be.weight,_t+=Be.weight),ze.vs=Be.vs.concat(ze.vs),ze.barycenter=nt/_t,ze.weight=_t,ze.i=Math.min(Be.i,ze.i),Be.merged=!0}(_e,Ne)}}function le(_e){return function(Ne){Ne.in.push(_e),--Ne.indegree==0&&V.push(Ne)}}for(;V.length;){var ge=V.pop();re.push(ge),ht.forEach(ge.in.reverse(),oe(ge)),ht.forEach(ge.out,le(ge))}return ht.map(ht.filter(re,function(_e){return!_e.merged}),function(_e){return ht.pick(_e,["vs","i","barycenter","weight"])})}(ht.filter(B,function(V){return!V.indegree}))},Au=function(f,w){var B=gi.partition(f,function(Be){return ht.has(Be,"barycenter")}),V=B.lhs,re=ht.sortBy(B.rhs,function(Be){return-Be.i}),oe=[],le=0,ge=0,_e=0;V.sort((Ne=!!w,function(Be,nt){return Be.barycenternt.barycenter?1:Ne?nt.i-Be.i:Be.i-nt.i})),_e=of(oe,re,_e),ht.forEach(V,function(Be){_e+=Be.vs.length,oe.push(Be.vs),le+=Be.barycenter*Be.weight,ge+=Be.weight,_e=of(oe,re,_e)});var Ne,ze={vs:ht.flatten(oe,!0)};return ge&&(ze.barycenter=le/ge,ze.weight=ge),ze};function of(f,w,B){for(var V;w.length&&(V=ht.last(w)).i<=B;)w.pop(),f.push(V.vs),B++;return B}var Cc=function f(w,B,V,re){var oe=w.children(B),le=w.node(B),ge=le?le.borderLeft:void 0,_e=le?le.borderRight:void 0,Ne={};ge&&(oe=ht.filter(oe,function(Pt){return Pt!==ge&&Pt!==_e}));var ze=Mc(w,oe);ht.forEach(ze,function(Pt){if(w.children(Pt.v).length){var kt=f(w,Pt.v,V,re);Ne[Pt.v]=kt,ht.has(kt,"barycenter")&&(Dt=Pt,pr=kt,ht.isUndefined(Dt.barycenter)?(Dt.barycenter=pr.barycenter,Dt.weight=pr.weight):(Dt.barycenter=(Dt.barycenter*Dt.weight+pr.barycenter*pr.weight)/(Dt.weight+pr.weight),Dt.weight+=pr.weight))}var Dt,pr});var Be=Xf(ze,V);(function(Pt,kt){ht.forEach(Pt,function(Dt){Dt.vs=ht.flatten(Dt.vs.map(function(pr){return kt[pr]?kt[pr].vs:pr}),!0)})})(Be,Ne);var nt=Au(Be,re);if(ge&&(nt.vs=ht.flatten([ge,nt.vs,_e],!0),w.predecessors(ge).length)){var _t=w.node(w.predecessors(ge)[0]),tr=w.node(w.predecessors(_e)[0]);ht.has(nt,"barycenter")||(nt.barycenter=0,nt.weight=0),nt.barycenter=(nt.barycenter*nt.weight+_t.order+tr.order)/(nt.weight+2),nt.weight+=2}return nt},jf=zn.Graph,sf=function(f,w,B){var V=function(oe){for(var le;oe.hasNode(le=ht.uniqueId("_root")););return le}(f),re=new jf({compound:!0}).setGraph({root:V}).setDefaultNodeLabel(function(oe){return f.node(oe)});return ht.forEach(f.nodes(),function(oe){var le=f.node(oe),ge=f.parent(oe);(le.rank===w||le.minRank<=w&&w<=le.maxRank)&&(re.setNode(oe),re.setParent(oe,ge||V),ht.forEach(f[B](oe),function(_e){var Ne=_e.v===oe?_e.w:_e.v,ze=re.edge(Ne,oe),Be=ht.isUndefined(ze)?0:ze.weight;re.setEdge(Ne,oe,{weight:f.edge(_e).weight+Be})}),ht.has(le,"minRank")&&re.setNode(oe,{borderLeft:le.borderLeft[w],borderRight:le.borderRight[w]}))}),re},uf=function(f,w,B){var V,re={};ht.forEach(B,function(oe){for(var le,ge,_e=f.parent(oe);_e;){if((le=f.parent(_e))?(ge=re[le],re[le]=_e):(ge=V,V=_e),ge&&ge!==_e)return void w.setEdge(ge,_e);_e=le}})},Ou=zn.Graph,ff=function(f){var w=gi.maxRank(f),B=Lu(f,ht.range(1,w+1),"inEdges"),V=Lu(f,ht.range(w-1,-1,-1),"outEdges"),re=nu(f);Cs(f,re);for(var oe,le=Number.POSITIVE_INFINITY,ge=0,_e=0;_e<4;++ge,++_e){Du(ge%2?B:V,ge%4>=2),re=gi.buildLayerMatrix(f);var Ne=Uf(f,re);Ne_e)&&Yf(B,Be,Ne)})})}return ht.reduce(w,function(re,oe){var le,ge=-1,_e=0;return ht.forEach(oe,function(Ne,ze){if(f.node(Ne).dummy==="border"){var Be=f.predecessors(Ne);Be.length&&(le=f.node(Be[0]).order,V(oe,_e,ze,ge,le),_e=ze,ge=le)}V(oe,_e,oe.length,le,re.length)}),oe}),B}function Yf(f,w,B){if(w>B){var V=w;w=B,B=V}var re=f[w];re||(f[w]=re={}),re[B]=!0}function hl(f,w,B){if(w>B){var V=w;w=B,B=V}return ht.has(f[w],B)}function aa(f,w,B,V){var re={},oe={},le={};return ht.forEach(w,function(ge){ht.forEach(ge,function(_e,Ne){re[_e]=_e,oe[_e]=_e,le[_e]=Ne})}),ht.forEach(w,function(ge){var _e=-1;ht.forEach(ge,function(Ne){var ze=V(Ne);if(ze.length)for(var Be=((ze=ht.sortBy(ze,function(Pt){return le[Pt]})).length-1)/2,nt=Math.floor(Be),_t=Math.ceil(Be);nt<=_t;++nt){var tr=ze[nt];oe[Ne]===Ne&&_enew Qc(B)).forEach(B=>{w.nodes[B.name]=B,B.inputs.forEach(V=>{(function(re,oe,le){le.name!==oe.name&&re.edges.push(Object.assign(Object.assign({},le.attr),{v:le.name,w:oe.name}))})(w,B,V)})}),w}class Ac{constructor(w,B={}){this.attr=null,this.bridgeGraph=null,this.cardinality=0,this.depth=1,this.include=x.UNSPECIFIED,this.isGroupNode=!0,this.parentNode=null,this.type=T.META,this.path=[],this.name=w,this.metaGraph=qf(w,p.META,B)}getFirstChild(){return this.metaGraph.node(this.metaGraph.nodes()[0])}getChildren(){return this.metaGraph.nodes().map(w=>this.metaGraph.node(w))}leaves(){let w,B=[],V=[this];for(;V.length;){let re=V.shift();re.isGroupNode?(w=re.metaGraph,w.nodes().forEach(oe=>V.push(w.node(oe)))):B.push(re.name)}return B}}class Jf{constructor(w,B){this.v=w,this.w=B,this.baseEdgeList=[],this.inbound=null,this.name=null}addBaseEdge(w,B){this.baseEdgeList.push(w)}}function Oc(f,w={}){return new Ac(f,w)}function Lc(f,w){return new Jf(f,w)}function qf(f,w,B){const V=B||{},re=new yl.Graph(V);return re.setGraph({name:f,rankdir:V.rankdir,type:w,align:V.align}),re}class Jc{constructor(w={}){this.graphOptions=w,this.index={},this.graphOptions.compound=!0,this.root=Oc(_,this.graphOptions),this.index[_]=this.root}getNodeMap(){return this.index}node(w){return this.index[w]}setNode(w,B){this.index[w]=B}getBridgeGraph(w){const B=this.index[w];if(!B)throw Error("Could not find node in hierarchy: "+w);if(!("metaGraph"in B))return null;const V=B;if(V.bridgeGraph)return V.bridgeGraph;const re=qf(I,p.BRIDGE,this.graphOptions);if(V.bridgeGraph=re,!B.parentNode||!("metaGraph"in B.parentNode))return re;const oe=B.parentNode;return[oe.metaGraph,this.getBridgeGraph(oe.name)].forEach(le=>{le.edges().filter(ge=>ge.v===w||ge.w===w).forEach(ge=>{const _e=ge.w===w;le.edge(ge).baseEdgeList.forEach(Ne=>{const[ze,Be]=_e?[Ne.w,ge.v]:[Ne.v,ge.w],nt=this.getChildName(w,ze),_t={v:_e?Be:nt,w:_e?nt:Be};let tr=re.edge(_t);tr||(tr=Lc(_t.v,_t.w),tr.inbound=_e,re.setEdge(_t.v,_t.w,tr)),tr.addBaseEdge(Ne,this)})})}),re}getChildName(w,B){let V=this.index[B];for(;V;){if(V.parentNode&&V.parentNode.name===w)return V.name;V=V.parentNode}throw Error("Could not find immediate child for descendant: "+B)}getPredecessors(w){const B=this.index[w];if(!B)throw Error("Could not find node with name: "+w);return this.getOneWayEdges(B,!0)}getSuccessors(w){const B=this.index[w];if(!B)throw Error("Could not find node with name: "+w);return this.getOneWayEdges(B,!1)}getOneWayEdges(w,B){const V=[];if(!w.parentNode||!w.parentNode.isGroupNode)return V;const re=w.parentNode,oe=re.metaGraph,le=this.getBridgeGraph(re.name);return el(oe,w,B,V),el(le,w,B,V),V}}function qc(f,w){const{rankDirection:B,align:V}=w,re=new Jc({rankdir:B,align:V});return function(oe,le){Object.keys(le.nodes).forEach(ge=>{const _e=le.nodes[ge],Ne=_e.path;let ze=oe.root;ze.depth=Math.max(Ne.length,ze.depth);for(let Be=0;Be{let _t=0;for(;Be;)nt[_t++]=Be.name,Be=Be.parentNode;return _t-1};le.edges.forEach(Be=>{_e=[],Ne=[];let nt=ze(le.nodes[Be.v],_e),_t=ze(le.nodes[Be.w],Ne);for(;_e[nt]===Ne[_t];)if(nt--,_t--,nt<0||_t<0)throw Error("No difference found between ancestor paths.");const tr=ge[_e[nt+1]],Pt=_e[nt],kt=Ne[_t];let Dt=tr.metaGraph.edge(Pt,kt);Dt||(Dt=Lc(Pt,kt),tr.metaGraph.setEdge(Pt,kt,Dt)),Dt.addBaseEdge(Be,oe)})}(re,f),re}function el(f,w,B,V){(B?f.inEdges(w.name):f.outEdges(w.name)).forEach(re=>{const oe=f.edge(re);V.push(oe)})}class tl{constructor(w){this.hierarchy=w,this.index={},this.hasSubHierarchy={},this.root=new We(this.hierarchy.root,this.hierarchy.graphOptions),this.index[w.root.name]=this.root,this.buildSubHierarchy(w.root.name),this.root.expanded=!0}getRenderInfoNodes(){return Object.values(this.index)}getSubHierarchy(){return this.hasSubHierarchy}buildSubHierarchy(w){if(w in this.hasSubHierarchy)return;this.hasSubHierarchy[w]=!0;const B=this.index[w];if(B.node.type!==T.META)return;const V=B,re=V.node.metaGraph,oe=V.coreGraph;re.nodes().forEach(ze=>{const Be=this.getOrCreateRenderNodeByName(ze);oe.setNode(ze,Be)}),re.edges().forEach(ze=>{const Be=re.edge(ze),nt=new he(Be);oe.setEdge(ze.v,ze.w,nt)});const le=V.node.parentNode;if(!le)return;const ge=this.getRenderNodeByName(le.name),_e=(ze,...Be)=>Be.concat([ze?"IN":"OUT"]).join("~~"),Ne=this.hierarchy.getBridgeGraph(w);Ne.edges().forEach(ze=>{const Be=Ne.edge(ze),nt=!!re.node(ze.w),[_t,tr]=nt?[ze.w,ze.v]:[ze.v,ze.w],Pt=fn=>{const cn=nt?{v:fn,w}:{v:w,w:fn};return ge.coreGraph.edge(cn)};let kt=Pt(tr);kt||(kt=Pt(_e(nt,tr,le.name)));const Dt=_e(nt,w),pr=_e(nt,tr,w);let Xr=oe.node(pr);if(!Xr){let fn=oe.node(Dt);if(!fn){const Mn={name:Dt,type:T.BRIDGE,isGroupNode:!1,cardinality:0,parentNode:null,include:x.UNSPECIFIED,inbound:nt,attr:{}};fn=new ec(Mn),this.index[Dt]=fn,oe.setNode(Dt,fn)}const cn={name:pr,type:T.BRIDGE,isGroupNode:!1,cardinality:1,parentNode:null,include:x.UNSPECIFIED,inbound:nt,attr:{}};Xr=new ec(cn),this.index[pr]=Xr,oe.setNode(pr,Xr),oe.setParent(pr,Dt),fn.node.cardinality++}const Or=new he(Be);Or.adjoiningMetaEdge=kt,nt?oe.setEdge(pr,_t,Or):oe.setEdge(_t,pr,Or)})}getOrCreateRenderNodeByName(w){if(!w)return null;if(w in this.index)return this.index[w];const B=this.getNodeByName(w);return B?(this.index[w]=B.isGroupNode?new We(B,this.hierarchy.graphOptions):new ec(B),this.index[w]):null}getRenderNodeByName(w){return this.index[w]}getNodeByName(w){return this.hierarchy.node(w)}}class ec{constructor(w){this.node=w,this.expanded=!1,this.x=0,this.y=0,this.coreBox={width:0,height:0},this.outboxWidth=0,this.labelOffset=0,this.radius=0,this.labelHeight=0,this.paddingTop=0,this.paddingLeft=0,this.paddingRight=0,this.paddingBottom=0,this.width=w.width||0,this.height=w.height||0,this.displayName=w.name,this.attr=w.attr}}class he{constructor(w){this.metaEdge=w,this.adjoiningMetaEdge=null,this.weight=1,this.points=[]}}class We extends ec{constructor(w,B){super(w);const V=w.metaGraph.graph();B.compound=!0,this.coreGraph=qf(V.name,p.CORE,B)}}function it(f,w){f.node.isGroupNode&&function(B,V){const re=U(V);B.coreGraph.nodes().map(oe=>B.coreGraph.node(oe)).forEach(oe=>{var le,ge,_e,Ne,ze,Be;const{height:nt,width:_t}=oe;switch(oe.node.type){case T.NODE:Object.assign(oe,re.nodeSize.node),oe.height=nt||re.nodeSize.node.height,oe.width=_t||re.nodeSize.node.width;break;case T.BRIDGE:Object.assign(oe,re.nodeSize.bridge);break;case T.META:oe.expanded?it(oe,V):(Object.assign(oe,re.nodeSize.meta),oe.height=re.nodeSize.meta.height,oe.width=re.nodeSize.meta.width);break;default:throw Error("Unrecognized node type: "+oe.node.type)}if(!oe.expanded){const tr=oe.attr;(function(Pt,kt=!1){if(Pt.coreBox.width=Pt.width,Pt.coreBox.height=Pt.height,!kt){const Dt=`${Pt.displayName}`.length,pr=3;Pt.width=Math.max(Pt.coreBox.width,Dt*pr)}})(oe,V&&(oe.node.type===0&&!!(!((ge=(le=V==null?void 0:V.nodeSize)===null||le===void 0?void 0:le.meta)===null||ge===void 0)&&ge.width)||oe.node.type===1&&(!!(!((Ne=(_e=V==null?void 0:V.nodeSize)===null||_e===void 0?void 0:_e.node)===null||Ne===void 0)&&Ne.width)||!!tr.width)||oe.node.type===2&&!!(!((Be=(ze=V==null?void 0:V.nodeSize)===null||ze===void 0?void 0:ze.bridge)===null||Be===void 0)&&Be.width)))}})}(f,w),f.node.type===T.META&&function(B,V){const re=U(V),oe=re.subScene.meta;Object.assign(B,oe);const{nodeSep:le,rankSep:ge,edgeSep:_e,align:Ne}=re.graph.meta,ze={nodesep:le,ranksep:ge,edgesep:_e,align:Ne};Object.assign(B.coreBox,function(_t,tr){const{ranksep:Pt,nodesep:kt,edgesep:Dt,align:pr}=tr;Object.assign(_t.graph(),{ranksep:Pt,nodesep:kt,edgesep:Dt,align:pr});const Xr=[];if(_t.nodes().forEach(Un=>{_t.node(Un).node.type!==T.BRIDGE&&Xr.push(Un)}),!Xr.length)return{width:0,height:0};$c(_t);let Or=1/0,fn=1/0,cn=-1/0,Mn=-1/0;return Xr.forEach(Un=>{const kn=_t.node(Un),Na=.5*kn.width,Bn=kn.x-Na,Ha=kn.x+Na;Or=Bncn?Ha:cn;const Aa=.5*kn.height,fa=kn.y-Aa,Wa=kn.y+Aa;fn=faMn?Wa:Mn}),_t.edges().forEach(Un=>{const kn=_t.edge(Un),Na=_t.node(kn.metaEdge.v),Bn=_t.node(kn.metaEdge.w);if(kn.points.length===3&&function(fa){let Wa=Zt(fa[0],fa[1]);for(let Za=1;Za1)return!1;Wa=pi}return!0}(kn.points)){if(Na!=null){const fa=Na.expanded?Na.x:or(Na);kn.points[0].x=fa}if(Bn!=null){const fa=Bn.expanded?Bn.x:or(Bn);kn.points[2].x=fa}kn.points=[kn.points[0],kn.points[1]]}const Ha=kn.points[kn.points.length-2];Bn!=null&&(kn.points[kn.points.length-1]=Xt(Ha,Bn));const Aa=kn.points[1];Na!=null&&(kn.points[0]=Xt(Aa,Na)),kn.points.forEach(fa=>{Or=fa.xcn?fa.x:cn,fn=fa.yMn?fa.y:Mn})}),_t.nodes().forEach(Un=>{const kn=_t.node(Un);kn.x-=Or,kn.y-=fn}),_t.edges().forEach(Un=>{_t.edge(Un).points.forEach(kn=>{kn.x-=Or,kn.y-=fn})}),{width:cn-Or,height:Mn-fn}}(B.coreGraph,ze));let Be=0;B.coreGraph.nodeCount()>0&&Be++;const nt=Be<=1?0:Be;B.coreBox.width+=nt+nt,B.coreBox.height=oe.labelHeight+B.coreBox.height,B.width=B.coreBox.width+oe.paddingLeft+oe.paddingRight,B.height=B.paddingTop+B.coreBox.height+B.paddingBottom}(f,w)}function Zt(f,w){const B=w.x-f.x,V=w.y-f.y;return 180*Math.atan(V/B)/Math.PI}function or(f){return f.expanded?f.x:f.x-f.width/2+0+f.coreBox.width/2}function Xt(f,w){const B=w.expanded?w.x:or(w),V=w.y,re=f.x-B,oe=f.y-V;let le,ge,_e=w.expanded?w.width:w.coreBox.width,Ne=w.expanded?w.height:w.coreBox.height;return Math.abs(oe)*_e/2>Math.abs(re)*Ne/2?(oe<0&&(Ne=-Ne),le=oe===0?0:Ne/2*re/oe,ge=Ne/2):(re<0&&(_e=-_e),le=_e/2,ge=re===0?0:_e/2*oe/re),{x:B+le,y:V+ge}}function Qt(f,w,B){var V,re,oe,le;const ge=f.nodes.filter((Be,nt,_t)=>_t.findIndex(tr=>tr.id===Be.id)!==nt).map(Be=>Be.id);if(ge.length)throw new Error(`Duplicated ids found: ${ge.join(", ")}`);const _e=function(Be){const nt={nodes:[]},_t=Be.compound,tr=Object.keys(_t||{}),Pt=new Map,kt=(pr,Xr=[])=>{if(Pt.has(pr))return Pt.get(pr);for(let Or=0;OrBe.edges.filter(Xr=>Xr.w===pr).map(Xr=>({name:Xr.v}));return Be.nodes.forEach(pr=>{const Xr=pr.id,Or=[...kt(Xr),Xr];let fn=Dt(Xr);nt.nodes.push({name:Xr,path:Or,inputs:fn,width:pr.width,height:pr.height,attr:Object.assign({},pr)})}),nt}(f),Ne=function(Be,nt){const _t=(Pt,kt)=>{for(let Dt of kt.values())if(Dt.includes(Pt))return!0;return!1},tr=(Pt,kt=[])=>{if(Object.keys(Pt).length===0)return[...new Set(kt)];const Dt=new Map(Object.keys(Pt).map(Xr=>[Xr,Pt[Xr]])),pr={};for(let[Xr,Or]of Dt)_t(Xr,Dt)?pr[Xr]=Or:kt=kt.concat(Xr,Or);return tr(pr,kt)};return tr(Be).filter(Pt=>nt.includes(Pt))}(f.compound||{},(w==null?void 0:w.expanded)||[]),ze=function(Be,nt){return function(_t){return new tl(_t)}(qc(bl(Be),nt))}(_e,{rankDirection:((re=(V=B==null?void 0:B.graph)===null||V===void 0?void 0:V.meta)===null||re===void 0?void 0:re.rankDir)||(w==null?void 0:w.rankDirection)||k.graph.meta.rankDir,align:((le=(oe=B==null?void 0:B.graph)===null||oe===void 0?void 0:oe.meta)===null||le===void 0?void 0:le.align)||k.graph.meta.align});return function(Be,nt){nt.forEach(_t=>{const tr=Be.getRenderInfoNodes().find(Dt=>Dt.displayName===_t);let Pt=tr&&tr.node&&tr.node.name||"";const kt=Be.getRenderNodeByName(Pt);if(!kt)throw new Error(`No nodes found: ${Pt}`);kt.expanded=!0,Be.buildSubHierarchy(Pt)})}(ze,Ne),it(ze.root,B),wr(ze.root)}function gr(f,w=!1){const B=JSON.parse(JSON.stringify(f)),V={nodes:[B],edges:[...B.edges]};return B.nodes.forEach(function re(oe){(oe.type===0||oe.type===1)&&V.nodes.push(oe),oe.type===0&&(V.edges=V.edges.concat(oe.edges)),Array.isArray(oe.nodes)&&oe.nodes.forEach(re)}),w&&V.nodes.forEach(re=>{const oe=V.nodes.find(le=>le.id===re.parentNodeName);if(oe){const le=oe.x-oe.width/2+oe.paddingLeft,ge=oe.y-oe.height/2+oe.labelHeight+oe.paddingTop;oe.id!==_&&(re.x+=le,re.y+=ge),re.type===0&&re.edges.forEach(_e=>{_e.points.forEach(Ne=>{Ne.x+=re.x-re.width/2+re.paddingLeft,Ne.y+=re.y-re.height/2+re.labelHeight+re.paddingTop})})}}),V}function Er(f,w,B,V){var re,oe;let le=[];const ge=((re=B.find(Be=>Be.id===f))===null||re===void 0?void 0:re.path)||[],_e=((oe=B.find(Be=>Be.id===w))===null||oe===void 0?void 0:oe.path)||[],Ne=[_,...ge].slice(0,ge.length).reverse(),ze=[_,..._e].slice(0,_e.length);return Ne.forEach(Be=>{const nt=B.find(_t=>_t.id===Be);le=le.concat(nt.edges.filter(_t=>_t.baseEdgeList.some(tr=>tr.v===((V==null?void 0:V.v)||f)&&tr.w===((V==null?void 0:V.w)||w))))}),ze.filter(Be=>!Ne.includes(Be)).forEach(Be=>{const nt=B.find(_t=>_t.id===Be);le=le.concat(nt.edges.filter(_t=>_t.baseEdgeList.some(tr=>tr.v===((V==null?void 0:V.v)||f)&&tr.w===((V==null?void 0:V.w)||w))))}),le}function wr(f){const w=f.coreGraph.nodes().map(V=>f.coreGraph.node(V));return Object.assign(Object.assign({},_r(f)),{expanded:f.expanded,nodes:f.expanded?(B=w,B.map(V=>V.node.type===T.META?wr(V):_r(V))):[],edges:f.expanded?Br(f):[]});var B}function _r(f){return{id:f.node.name,name:f.node.name,type:f.node.type,cardinality:f.node.cardinality,attr:f.attr,parentNodeName:f.node.parentNode?f.node.parentNode.name:null,coreBox:Object.assign({},f.coreBox),x:f.x,y:f.y,width:f.width,height:f.height,radius:f.radius,labelHeight:f.labelHeight,labelOffset:f.labelOffset,outboxWidth:f.outboxWidth,paddingLeft:f.paddingLeft,paddingTop:f.paddingTop,paddingRight:f.paddingRight,paddingBottom:f.paddingBottom,path:f.node.path}}function Br(f){return f.coreGraph.edges().map(w=>({renderInfoEdge:f.coreGraph.edge(w),edge:w})).filter(({renderInfoEdge:w})=>w.metaEdge).map(({edge:w,renderInfoEdge:B})=>{const V=function(re,oe){const le=oe.points.map(ge=>Object.assign({},ge));if(oe.adjoiningMetaEdge){const ge=oe.adjoiningMetaEdge.points,_e=oe.metaEdge.inbound,Ne=_e?ge[ge.length-1]:ge[0],ze=le[_e?0:le.length-1],Be=re.x-re.width/2,nt=re.y-re.height/2,_t=Ne.x-Be,tr=Ne.y-nt,Pt=-re.paddingLeft,kt=-(re.paddingTop+re.labelHeight);ze.x=_t+Pt,ze.y=tr+kt}return le}(f,B);return{adjoiningEdge:B.adjoiningMetaEdge?{w:B.adjoiningMetaEdge.metaEdge.w,v:B.adjoiningMetaEdge.metaEdge.v}:null,inbound:B.metaEdge.inbound,w:w.w,v:w.v,points:V,weight:B.weight,baseEdgeList:B.metaEdge.baseEdgeList,parentNodeName:f.node.name}})}},47385:function(Mt,N,F){"use strict";F.r(N),F.d(N,{glMatrix:function(){return _},mat2:function(){return I},mat2d:function(){return k},mat3:function(){return Ae},mat4:function(){return Se},quat:function(){return U},quat2:function(){return L},vec2:function(){return at},vec3:function(){return we},vec4:function(){return Te}});var k={};F.r(k),F.d(k,{add:function(){return Z},clone:function(){return x},copy:function(){return p},create:function(){return T},determinant:function(){return s},equals:function(){return fe},exactEquals:function(){return se},frob:function(){return H},fromRotation:function(){return j},fromScaling:function(){return Q},fromTranslation:function(){return G},fromValues:function(){return g},identity:function(){return v},invert:function(){return c},mul:function(){return Ie},multiply:function(){return m},multiplyScalar:function(){return K},multiplyScalarAndAdd:function(){return ne},rotate:function(){return M},scale:function(){return P},set:function(){return d},str:function(){return W},sub:function(){return ye},subtract:function(){return J},translate:function(){return R}});var U={};F.r(U),F.d(U,{add:function(){return Gr},calculateW:function(){return xt},clone:function(){return ar},conjugate:function(){return Nr},copy:function(){return Pr},create:function(){return ke},dot:function(){return Sr},equals:function(){return hr},exactEquals:function(){return Vt},exp:function(){return dt},fromEuler:function(){return It},fromMat3:function(){return Hr},fromValues:function(){return Oe},getAngle:function(){return ft},getAxisAngle:function(){return He},identity:function(){return Ge},invert:function(){return Ir},len:function(){return yn},length:function(){return Rn},lerp:function(){return qr},ln:function(){return pt},mul:function(){return mr},multiply:function(){return Lt},normalize:function(){return zt},pow:function(){return wt},random:function(){return ur},rotateX:function(){return Jt},rotateY:function(){return Qe},rotateZ:function(){return ut},rotationTo:function(){return Ar},scale:function(){return rn},set:function(){return Cr},setAxes:function(){return Fr},setAxisAngle:function(){return tt},slerp:function(){return mt},sqlerp:function(){return en},sqrLen:function(){return Rt},squaredLength:function(){return zr},str:function(){return qt}});var L={};F.r(L),F.d(L,{add:function(){return Ft},clone:function(){return Sn},conjugate:function(){return br},copy:function(){return Y},create:function(){return Cn},dot:function(){return Kt},equals:function(){return In},exactEquals:function(){return Vr},fromMat4:function(){return Wn},fromRotation:function(){return un},fromRotationTranslation:function(){return xn},fromRotationTranslationValues:function(){return jr},fromTranslation:function(){return vn},fromValues:function(){return oa},getDual:function(){return b},getReal:function(){return C},getTranslation:function(){return pe},identity:function(){return ie},invert:function(){return Dr},len:function(){return ea},length:function(){return sa},lerp:function(){return lr},mul:function(){return Ur},multiply:function(){return er},normalize:function(){return ra},rotateAroundAxis:function(){return nr},rotateByQuatAppend:function(){return qe},rotateByQuatPrepend:function(){return Nt},rotateX:function(){return me},rotateY:function(){return Le},rotateZ:function(){return st},scale:function(){return Ct},set:function(){return ee},setDual:function(){return X},setReal:function(){return S},sqrLen:function(){return Tn},squaredLength:function(){return gn},str:function(){return Zn},translate:function(){return Me}});var _=F(31767),I=F(76406);function T(){var D=new _.ARRAY_TYPE(6);return _.ARRAY_TYPE!=Float32Array&&(D[1]=0,D[2]=0,D[4]=0,D[5]=0),D[0]=1,D[3]=1,D}function x(D){var te=new _.ARRAY_TYPE(6);return te[0]=D[0],te[1]=D[1],te[2]=D[2],te[3]=D[3],te[4]=D[4],te[5]=D[5],te}function p(D,te){return D[0]=te[0],D[1]=te[1],D[2]=te[2],D[3]=te[3],D[4]=te[4],D[5]=te[5],D}function v(D){return D[0]=1,D[1]=0,D[2]=0,D[3]=1,D[4]=0,D[5]=0,D}function g(D,te,xe,be,De,Xe){var Je=new _.ARRAY_TYPE(6);return Je[0]=D,Je[1]=te,Je[2]=xe,Je[3]=be,Je[4]=De,Je[5]=Xe,Je}function d(D,te,xe,be,De,Xe,Je){return D[0]=te,D[1]=xe,D[2]=be,D[3]=De,D[4]=Xe,D[5]=Je,D}function c(D,te){var xe=te[0],be=te[1],De=te[2],Xe=te[3],Je=te[4],lt=te[5],Tt=xe*Xe-be*De;return Tt?(Tt=1/Tt,D[0]=Xe*Tt,D[1]=-be*Tt,D[2]=-De*Tt,D[3]=xe*Tt,D[4]=(De*lt-Xe*Je)*Tt,D[5]=(be*Je-xe*lt)*Tt,D):null}function s(D){return D[0]*D[3]-D[1]*D[2]}function m(D,te,xe){var be=te[0],De=te[1],Xe=te[2],Je=te[3],lt=te[4],Tt=te[5],Ht=xe[0],ir=xe[1],Kr=xe[2],nn=xe[3],mn=xe[4],Jr=xe[5];return D[0]=be*Ht+Xe*ir,D[1]=De*Ht+Je*ir,D[2]=be*Kr+Xe*nn,D[3]=De*Kr+Je*nn,D[4]=be*mn+Xe*Jr+lt,D[5]=De*mn+Je*Jr+Tt,D}function M(D,te,xe){var be=te[0],De=te[1],Xe=te[2],Je=te[3],lt=te[4],Tt=te[5],Ht=Math.sin(xe),ir=Math.cos(xe);return D[0]=be*ir+Xe*Ht,D[1]=De*ir+Je*Ht,D[2]=be*-Ht+Xe*ir,D[3]=De*-Ht+Je*ir,D[4]=lt,D[5]=Tt,D}function P(D,te,xe){var be=te[0],De=te[1],Xe=te[2],Je=te[3],lt=te[4],Tt=te[5],Ht=xe[0],ir=xe[1];return D[0]=be*Ht,D[1]=De*Ht,D[2]=Xe*ir,D[3]=Je*ir,D[4]=lt,D[5]=Tt,D}function R(D,te,xe){var be=te[0],De=te[1],Xe=te[2],Je=te[3],lt=te[4],Tt=te[5],Ht=xe[0],ir=xe[1];return D[0]=be,D[1]=De,D[2]=Xe,D[3]=Je,D[4]=be*Ht+Xe*ir+lt,D[5]=De*Ht+Je*ir+Tt,D}function j(D,te){var xe=Math.sin(te),be=Math.cos(te);return D[0]=be,D[1]=xe,D[2]=-xe,D[3]=be,D[4]=0,D[5]=0,D}function Q(D,te){return D[0]=te[0],D[1]=0,D[2]=0,D[3]=te[1],D[4]=0,D[5]=0,D}function G(D,te){return D[0]=1,D[1]=0,D[2]=0,D[3]=1,D[4]=te[0],D[5]=te[1],D}function W(D){return"mat2d("+D[0]+", "+D[1]+", "+D[2]+", "+D[3]+", "+D[4]+", "+D[5]+")"}function H(D){return Math.hypot(D[0],D[1],D[2],D[3],D[4],D[5],1)}function Z(D,te,xe){return D[0]=te[0]+xe[0],D[1]=te[1]+xe[1],D[2]=te[2]+xe[2],D[3]=te[3]+xe[3],D[4]=te[4]+xe[4],D[5]=te[5]+xe[5],D}function J(D,te,xe){return D[0]=te[0]-xe[0],D[1]=te[1]-xe[1],D[2]=te[2]-xe[2],D[3]=te[3]-xe[3],D[4]=te[4]-xe[4],D[5]=te[5]-xe[5],D}function K(D,te,xe){return D[0]=te[0]*xe,D[1]=te[1]*xe,D[2]=te[2]*xe,D[3]=te[3]*xe,D[4]=te[4]*xe,D[5]=te[5]*xe,D}function ne(D,te,xe,be){return D[0]=te[0]+xe[0]*be,D[1]=te[1]+xe[1]*be,D[2]=te[2]+xe[2]*be,D[3]=te[3]+xe[3]*be,D[4]=te[4]+xe[4]*be,D[5]=te[5]+xe[5]*be,D}function se(D,te){return D[0]===te[0]&&D[1]===te[1]&&D[2]===te[2]&&D[3]===te[3]&&D[4]===te[4]&&D[5]===te[5]}function fe(D,te){var xe=D[0],be=D[1],De=D[2],Xe=D[3],Je=D[4],lt=D[5],Tt=te[0],Ht=te[1],ir=te[2],Kr=te[3],nn=te[4],mn=te[5];return Math.abs(xe-Tt)<=_.EPSILON*Math.max(1,Math.abs(xe),Math.abs(Tt))&&Math.abs(be-Ht)<=_.EPSILON*Math.max(1,Math.abs(be),Math.abs(Ht))&&Math.abs(De-ir)<=_.EPSILON*Math.max(1,Math.abs(De),Math.abs(ir))&&Math.abs(Xe-Kr)<=_.EPSILON*Math.max(1,Math.abs(Xe),Math.abs(Kr))&&Math.abs(Je-nn)<=_.EPSILON*Math.max(1,Math.abs(Je),Math.abs(nn))&&Math.abs(lt-mn)<=_.EPSILON*Math.max(1,Math.abs(lt),Math.abs(mn))}var Ie=m,ye=J,Ae=F(73485),Se=F(39536),we=F(54442),Te=F(49953);function ke(){var D=new _.ARRAY_TYPE(4);return _.ARRAY_TYPE!=Float32Array&&(D[0]=0,D[1]=0,D[2]=0),D[3]=1,D}function Ge(D){return D[0]=0,D[1]=0,D[2]=0,D[3]=1,D}function tt(D,te,xe){xe=xe*.5;var be=Math.sin(xe);return D[0]=be*te[0],D[1]=be*te[1],D[2]=be*te[2],D[3]=Math.cos(xe),D}function He(D,te){var xe=Math.acos(te[3])*2,be=Math.sin(xe/2);return be>_.EPSILON?(D[0]=te[0]/be,D[1]=te[1]/be,D[2]=te[2]/be):(D[0]=1,D[1]=0,D[2]=0),xe}function ft(D,te){var xe=Sr(D,te);return Math.acos(2*xe*xe-1)}function Lt(D,te,xe){var be=te[0],De=te[1],Xe=te[2],Je=te[3],lt=xe[0],Tt=xe[1],Ht=xe[2],ir=xe[3];return D[0]=be*ir+Je*lt+De*Ht-Xe*Tt,D[1]=De*ir+Je*Tt+Xe*lt-be*Ht,D[2]=Xe*ir+Je*Ht+be*Tt-De*lt,D[3]=Je*ir-be*lt-De*Tt-Xe*Ht,D}function Jt(D,te,xe){xe*=.5;var be=te[0],De=te[1],Xe=te[2],Je=te[3],lt=Math.sin(xe),Tt=Math.cos(xe);return D[0]=be*Tt+Je*lt,D[1]=De*Tt+Xe*lt,D[2]=Xe*Tt-De*lt,D[3]=Je*Tt-be*lt,D}function Qe(D,te,xe){xe*=.5;var be=te[0],De=te[1],Xe=te[2],Je=te[3],lt=Math.sin(xe),Tt=Math.cos(xe);return D[0]=be*Tt-Xe*lt,D[1]=De*Tt+Je*lt,D[2]=Xe*Tt+be*lt,D[3]=Je*Tt-De*lt,D}function ut(D,te,xe){xe*=.5;var be=te[0],De=te[1],Xe=te[2],Je=te[3],lt=Math.sin(xe),Tt=Math.cos(xe);return D[0]=be*Tt+De*lt,D[1]=De*Tt-be*lt,D[2]=Xe*Tt+Je*lt,D[3]=Je*Tt-Xe*lt,D}function xt(D,te){var xe=te[0],be=te[1],De=te[2];return D[0]=xe,D[1]=be,D[2]=De,D[3]=Math.sqrt(Math.abs(1-xe*xe-be*be-De*De)),D}function dt(D,te){var xe=te[0],be=te[1],De=te[2],Xe=te[3],Je=Math.sqrt(xe*xe+be*be+De*De),lt=Math.exp(Xe),Tt=Je>0?lt*Math.sin(Je)/Je:0;return D[0]=xe*Tt,D[1]=be*Tt,D[2]=De*Tt,D[3]=lt*Math.cos(Je),D}function pt(D,te){var xe=te[0],be=te[1],De=te[2],Xe=te[3],Je=Math.sqrt(xe*xe+be*be+De*De),lt=Je>0?Math.atan2(Je,Xe)/Je:0;return D[0]=xe*lt,D[1]=be*lt,D[2]=De*lt,D[3]=.5*Math.log(xe*xe+be*be+De*De+Xe*Xe),D}function wt(D,te,xe){return pt(D,te),rn(D,D,xe),dt(D,D),D}function mt(D,te,xe,be){var De=te[0],Xe=te[1],Je=te[2],lt=te[3],Tt=xe[0],Ht=xe[1],ir=xe[2],Kr=xe[3],nn,mn,Jr,jn,_a;return mn=De*Tt+Xe*Ht+Je*ir+lt*Kr,mn<0&&(mn=-mn,Tt=-Tt,Ht=-Ht,ir=-ir,Kr=-Kr),1-mn>_.EPSILON?(nn=Math.acos(mn),Jr=Math.sin(nn),jn=Math.sin((1-be)*nn)/Jr,_a=Math.sin(be*nn)/Jr):(jn=1-be,_a=be),D[0]=jn*De+_a*Tt,D[1]=jn*Xe+_a*Ht,D[2]=jn*Je+_a*ir,D[3]=jn*lt+_a*Kr,D}function ur(D){var te=_.RANDOM(),xe=_.RANDOM(),be=_.RANDOM(),De=Math.sqrt(1-te),Xe=Math.sqrt(te);return D[0]=De*Math.sin(2*Math.PI*xe),D[1]=De*Math.cos(2*Math.PI*xe),D[2]=Xe*Math.sin(2*Math.PI*be),D[3]=Xe*Math.cos(2*Math.PI*be),D}function Ir(D,te){var xe=te[0],be=te[1],De=te[2],Xe=te[3],Je=xe*xe+be*be+De*De+Xe*Xe,lt=Je?1/Je:0;return D[0]=-xe*lt,D[1]=-be*lt,D[2]=-De*lt,D[3]=Xe*lt,D}function Nr(D,te){return D[0]=-te[0],D[1]=-te[1],D[2]=-te[2],D[3]=te[3],D}function Hr(D,te){var xe=te[0]+te[4]+te[8],be;if(xe>0)be=Math.sqrt(xe+1),D[3]=.5*be,be=.5/be,D[0]=(te[5]-te[7])*be,D[1]=(te[6]-te[2])*be,D[2]=(te[1]-te[3])*be;else{var De=0;te[4]>te[0]&&(De=1),te[8]>te[De*3+De]&&(De=2);var Xe=(De+1)%3,Je=(De+2)%3;be=Math.sqrt(te[De*3+De]-te[Xe*3+Xe]-te[Je*3+Je]+1),D[De]=.5*be,be=.5/be,D[3]=(te[Xe*3+Je]-te[Je*3+Xe])*be,D[Xe]=(te[Xe*3+De]+te[De*3+Xe])*be,D[Je]=(te[Je*3+De]+te[De*3+Je])*be}return D}function It(D,te,xe,be){var De=.5*Math.PI/180;te*=De,xe*=De,be*=De;var Xe=Math.sin(te),Je=Math.cos(te),lt=Math.sin(xe),Tt=Math.cos(xe),Ht=Math.sin(be),ir=Math.cos(be);return D[0]=Xe*Tt*ir-Je*lt*Ht,D[1]=Je*lt*ir+Xe*Tt*Ht,D[2]=Je*Tt*Ht-Xe*lt*ir,D[3]=Je*Tt*ir+Xe*lt*Ht,D}function qt(D){return"quat("+D[0]+", "+D[1]+", "+D[2]+", "+D[3]+")"}var ar=Te.clone,Oe=Te.fromValues,Pr=Te.copy,Cr=Te.set,Gr=Te.add,mr=Lt,rn=Te.scale,Sr=Te.dot,qr=Te.lerp,Rn=Te.length,yn=Rn,zr=Te.squaredLength,Rt=zr,zt=Te.normalize,Vt=Te.exactEquals,hr=Te.equals,Ar=function(){var D=we.create(),te=we.fromValues(1,0,0),xe=we.fromValues(0,1,0);return function(be,De,Xe){var Je=we.dot(De,Xe);return Je<-.999999?(we.cross(D,te,De),we.len(D)<1e-6&&we.cross(D,xe,De),we.normalize(D,D),tt(be,D,Math.PI),be):Je>.999999?(be[0]=0,be[1]=0,be[2]=0,be[3]=1,be):(we.cross(D,De,Xe),be[0]=D[0],be[1]=D[1],be[2]=D[2],be[3]=1+Je,zt(be,be))}}(),en=function(){var D=ke(),te=ke();return function(xe,be,De,Xe,Je,lt){return mt(D,be,Je,lt),mt(te,De,Xe,lt),mt(xe,D,te,2*lt*(1-lt)),xe}}(),Fr=function(){var D=Ae.create();return function(te,xe,be,De){return D[0]=be[0],D[3]=be[1],D[6]=be[2],D[1]=De[0],D[4]=De[1],D[7]=De[2],D[2]=-xe[0],D[5]=-xe[1],D[8]=-xe[2],zt(te,Hr(te,D))}}();function Cn(){var D=new _.ARRAY_TYPE(8);return _.ARRAY_TYPE!=Float32Array&&(D[0]=0,D[1]=0,D[2]=0,D[4]=0,D[5]=0,D[6]=0,D[7]=0),D[3]=1,D}function Sn(D){var te=new _.ARRAY_TYPE(8);return te[0]=D[0],te[1]=D[1],te[2]=D[2],te[3]=D[3],te[4]=D[4],te[5]=D[5],te[6]=D[6],te[7]=D[7],te}function oa(D,te,xe,be,De,Xe,Je,lt){var Tt=new _.ARRAY_TYPE(8);return Tt[0]=D,Tt[1]=te,Tt[2]=xe,Tt[3]=be,Tt[4]=De,Tt[5]=Xe,Tt[6]=Je,Tt[7]=lt,Tt}function jr(D,te,xe,be,De,Xe,Je){var lt=new _.ARRAY_TYPE(8);lt[0]=D,lt[1]=te,lt[2]=xe,lt[3]=be;var Tt=De*.5,Ht=Xe*.5,ir=Je*.5;return lt[4]=Tt*be+Ht*xe-ir*te,lt[5]=Ht*be+ir*D-Tt*xe,lt[6]=ir*be+Tt*te-Ht*D,lt[7]=-Tt*D-Ht*te-ir*xe,lt}function xn(D,te,xe){var be=xe[0]*.5,De=xe[1]*.5,Xe=xe[2]*.5,Je=te[0],lt=te[1],Tt=te[2],Ht=te[3];return D[0]=Je,D[1]=lt,D[2]=Tt,D[3]=Ht,D[4]=be*Ht+De*Tt-Xe*lt,D[5]=De*Ht+Xe*Je-be*Tt,D[6]=Xe*Ht+be*lt-De*Je,D[7]=-be*Je-De*lt-Xe*Tt,D}function vn(D,te){return D[0]=0,D[1]=0,D[2]=0,D[3]=1,D[4]=te[0]*.5,D[5]=te[1]*.5,D[6]=te[2]*.5,D[7]=0,D}function un(D,te){return D[0]=te[0],D[1]=te[1],D[2]=te[2],D[3]=te[3],D[4]=0,D[5]=0,D[6]=0,D[7]=0,D}function Wn(D,te){var xe=ke();Se.getRotation(xe,te);var be=new _.ARRAY_TYPE(3);return Se.getTranslation(be,te),xn(D,xe,be),D}function Y(D,te){return D[0]=te[0],D[1]=te[1],D[2]=te[2],D[3]=te[3],D[4]=te[4],D[5]=te[5],D[6]=te[6],D[7]=te[7],D}function ie(D){return D[0]=0,D[1]=0,D[2]=0,D[3]=1,D[4]=0,D[5]=0,D[6]=0,D[7]=0,D}function ee(D,te,xe,be,De,Xe,Je,lt,Tt){return D[0]=te,D[1]=xe,D[2]=be,D[3]=De,D[4]=Xe,D[5]=Je,D[6]=lt,D[7]=Tt,D}var C=Pr;function b(D,te){return D[0]=te[4],D[1]=te[5],D[2]=te[6],D[3]=te[7],D}var S=Pr;function X(D,te){return D[4]=te[0],D[5]=te[1],D[6]=te[2],D[7]=te[3],D}function pe(D,te){var xe=te[4],be=te[5],De=te[6],Xe=te[7],Je=-te[0],lt=-te[1],Tt=-te[2],Ht=te[3];return D[0]=(xe*Ht+Xe*Je+be*Tt-De*lt)*2,D[1]=(be*Ht+Xe*lt+De*Je-xe*Tt)*2,D[2]=(De*Ht+Xe*Tt+xe*lt-be*Je)*2,D}function Me(D,te,xe){var be=te[0],De=te[1],Xe=te[2],Je=te[3],lt=xe[0]*.5,Tt=xe[1]*.5,Ht=xe[2]*.5,ir=te[4],Kr=te[5],nn=te[6],mn=te[7];return D[0]=be,D[1]=De,D[2]=Xe,D[3]=Je,D[4]=Je*lt+De*Ht-Xe*Tt+ir,D[5]=Je*Tt+Xe*lt-be*Ht+Kr,D[6]=Je*Ht+be*Tt-De*lt+nn,D[7]=-be*lt-De*Tt-Xe*Ht+mn,D}function me(D,te,xe){var be=-te[0],De=-te[1],Xe=-te[2],Je=te[3],lt=te[4],Tt=te[5],Ht=te[6],ir=te[7],Kr=lt*Je+ir*be+Tt*Xe-Ht*De,nn=Tt*Je+ir*De+Ht*be-lt*Xe,mn=Ht*Je+ir*Xe+lt*De-Tt*be,Jr=ir*Je-lt*be-Tt*De-Ht*Xe;return Jt(D,te,xe),be=D[0],De=D[1],Xe=D[2],Je=D[3],D[4]=Kr*Je+Jr*be+nn*Xe-mn*De,D[5]=nn*Je+Jr*De+mn*be-Kr*Xe,D[6]=mn*Je+Jr*Xe+Kr*De-nn*be,D[7]=Jr*Je-Kr*be-nn*De-mn*Xe,D}function Le(D,te,xe){var be=-te[0],De=-te[1],Xe=-te[2],Je=te[3],lt=te[4],Tt=te[5],Ht=te[6],ir=te[7],Kr=lt*Je+ir*be+Tt*Xe-Ht*De,nn=Tt*Je+ir*De+Ht*be-lt*Xe,mn=Ht*Je+ir*Xe+lt*De-Tt*be,Jr=ir*Je-lt*be-Tt*De-Ht*Xe;return Qe(D,te,xe),be=D[0],De=D[1],Xe=D[2],Je=D[3],D[4]=Kr*Je+Jr*be+nn*Xe-mn*De,D[5]=nn*Je+Jr*De+mn*be-Kr*Xe,D[6]=mn*Je+Jr*Xe+Kr*De-nn*be,D[7]=Jr*Je-Kr*be-nn*De-mn*Xe,D}function st(D,te,xe){var be=-te[0],De=-te[1],Xe=-te[2],Je=te[3],lt=te[4],Tt=te[5],Ht=te[6],ir=te[7],Kr=lt*Je+ir*be+Tt*Xe-Ht*De,nn=Tt*Je+ir*De+Ht*be-lt*Xe,mn=Ht*Je+ir*Xe+lt*De-Tt*be,Jr=ir*Je-lt*be-Tt*De-Ht*Xe;return ut(D,te,xe),be=D[0],De=D[1],Xe=D[2],Je=D[3],D[4]=Kr*Je+Jr*be+nn*Xe-mn*De,D[5]=nn*Je+Jr*De+mn*be-Kr*Xe,D[6]=mn*Je+Jr*Xe+Kr*De-nn*be,D[7]=Jr*Je-Kr*be-nn*De-mn*Xe,D}function qe(D,te,xe){var be=xe[0],De=xe[1],Xe=xe[2],Je=xe[3],lt=te[0],Tt=te[1],Ht=te[2],ir=te[3];return D[0]=lt*Je+ir*be+Tt*Xe-Ht*De,D[1]=Tt*Je+ir*De+Ht*be-lt*Xe,D[2]=Ht*Je+ir*Xe+lt*De-Tt*be,D[3]=ir*Je-lt*be-Tt*De-Ht*Xe,lt=te[4],Tt=te[5],Ht=te[6],ir=te[7],D[4]=lt*Je+ir*be+Tt*Xe-Ht*De,D[5]=Tt*Je+ir*De+Ht*be-lt*Xe,D[6]=Ht*Je+ir*Xe+lt*De-Tt*be,D[7]=ir*Je-lt*be-Tt*De-Ht*Xe,D}function Nt(D,te,xe){var be=te[0],De=te[1],Xe=te[2],Je=te[3],lt=xe[0],Tt=xe[1],Ht=xe[2],ir=xe[3];return D[0]=be*ir+Je*lt+De*Ht-Xe*Tt,D[1]=De*ir+Je*Tt+Xe*lt-be*Ht,D[2]=Xe*ir+Je*Ht+be*Tt-De*lt,D[3]=Je*ir-be*lt-De*Tt-Xe*Ht,lt=xe[4],Tt=xe[5],Ht=xe[6],ir=xe[7],D[4]=be*ir+Je*lt+De*Ht-Xe*Tt,D[5]=De*ir+Je*Tt+Xe*lt-be*Ht,D[6]=Xe*ir+Je*Ht+be*Tt-De*lt,D[7]=Je*ir-be*lt-De*Tt-Xe*Ht,D}function nr(D,te,xe,be){if(Math.abs(be)<_.EPSILON)return Y(D,te);var De=Math.hypot(xe[0],xe[1],xe[2]);be=be*.5;var Xe=Math.sin(be),Je=Xe*xe[0]/De,lt=Xe*xe[1]/De,Tt=Xe*xe[2]/De,Ht=Math.cos(be),ir=te[0],Kr=te[1],nn=te[2],mn=te[3];D[0]=ir*Ht+mn*Je+Kr*Tt-nn*lt,D[1]=Kr*Ht+mn*lt+nn*Je-ir*Tt,D[2]=nn*Ht+mn*Tt+ir*lt-Kr*Je,D[3]=mn*Ht-ir*Je-Kr*lt-nn*Tt;var Jr=te[4],jn=te[5],_a=te[6],Fn=te[7];return D[4]=Jr*Ht+Fn*Je+jn*Tt-_a*lt,D[5]=jn*Ht+Fn*lt+_a*Je-Jr*Tt,D[6]=_a*Ht+Fn*Tt+Jr*lt-jn*Je,D[7]=Fn*Ht-Jr*Je-jn*lt-_a*Tt,D}function Ft(D,te,xe){return D[0]=te[0]+xe[0],D[1]=te[1]+xe[1],D[2]=te[2]+xe[2],D[3]=te[3]+xe[3],D[4]=te[4]+xe[4],D[5]=te[5]+xe[5],D[6]=te[6]+xe[6],D[7]=te[7]+xe[7],D}function er(D,te,xe){var be=te[0],De=te[1],Xe=te[2],Je=te[3],lt=xe[4],Tt=xe[5],Ht=xe[6],ir=xe[7],Kr=te[4],nn=te[5],mn=te[6],Jr=te[7],jn=xe[0],_a=xe[1],Fn=xe[2],ya=xe[3];return D[0]=be*ya+Je*jn+De*Fn-Xe*_a,D[1]=De*ya+Je*_a+Xe*jn-be*Fn,D[2]=Xe*ya+Je*Fn+be*_a-De*jn,D[3]=Je*ya-be*jn-De*_a-Xe*Fn,D[4]=be*ir+Je*lt+De*Ht-Xe*Tt+Kr*ya+Jr*jn+nn*Fn-mn*_a,D[5]=De*ir+Je*Tt+Xe*lt-be*Ht+nn*ya+Jr*_a+mn*jn-Kr*Fn,D[6]=Xe*ir+Je*Ht+be*Tt-De*lt+mn*ya+Jr*Fn+Kr*_a-nn*jn,D[7]=Je*ir-be*lt-De*Tt-Xe*Ht+Jr*ya-Kr*jn-nn*_a-mn*Fn,D}var Ur=er;function Ct(D,te,xe){return D[0]=te[0]*xe,D[1]=te[1]*xe,D[2]=te[2]*xe,D[3]=te[3]*xe,D[4]=te[4]*xe,D[5]=te[5]*xe,D[6]=te[6]*xe,D[7]=te[7]*xe,D}var Kt=Sr;function lr(D,te,xe,be){var De=1-be;return Kt(te,xe)<0&&(be=-be),D[0]=te[0]*De+xe[0]*be,D[1]=te[1]*De+xe[1]*be,D[2]=te[2]*De+xe[2]*be,D[3]=te[3]*De+xe[3]*be,D[4]=te[4]*De+xe[4]*be,D[5]=te[5]*De+xe[5]*be,D[6]=te[6]*De+xe[6]*be,D[7]=te[7]*De+xe[7]*be,D}function Dr(D,te){var xe=gn(te);return D[0]=-te[0]/xe,D[1]=-te[1]/xe,D[2]=-te[2]/xe,D[3]=te[3]/xe,D[4]=-te[4]/xe,D[5]=-te[5]/xe,D[6]=-te[6]/xe,D[7]=te[7]/xe,D}function br(D,te){return D[0]=-te[0],D[1]=-te[1],D[2]=-te[2],D[3]=te[3],D[4]=-te[4],D[5]=-te[5],D[6]=-te[6],D[7]=te[7],D}var sa=Rn,ea=sa,gn=zr,Tn=gn;function ra(D,te){var xe=gn(te);if(xe>0){xe=Math.sqrt(xe);var be=te[0]/xe,De=te[1]/xe,Xe=te[2]/xe,Je=te[3]/xe,lt=te[4],Tt=te[5],Ht=te[6],ir=te[7],Kr=be*lt+De*Tt+Xe*Ht+Je*ir;D[0]=be,D[1]=De,D[2]=Xe,D[3]=Je,D[4]=(lt-be*Kr)/xe,D[5]=(Tt-De*Kr)/xe,D[6]=(Ht-Xe*Kr)/xe,D[7]=(ir-Je*Kr)/xe}return D}function Zn(D){return"quat2("+D[0]+", "+D[1]+", "+D[2]+", "+D[3]+", "+D[4]+", "+D[5]+", "+D[6]+", "+D[7]+")"}function Vr(D,te){return D[0]===te[0]&&D[1]===te[1]&&D[2]===te[2]&&D[3]===te[3]&&D[4]===te[4]&&D[5]===te[5]&&D[6]===te[6]&&D[7]===te[7]}function In(D,te){var xe=D[0],be=D[1],De=D[2],Xe=D[3],Je=D[4],lt=D[5],Tt=D[6],Ht=D[7],ir=te[0],Kr=te[1],nn=te[2],mn=te[3],Jr=te[4],jn=te[5],_a=te[6],Fn=te[7];return Math.abs(xe-ir)<=_.EPSILON*Math.max(1,Math.abs(xe),Math.abs(ir))&&Math.abs(be-Kr)<=_.EPSILON*Math.max(1,Math.abs(be),Math.abs(Kr))&&Math.abs(De-nn)<=_.EPSILON*Math.max(1,Math.abs(De),Math.abs(nn))&&Math.abs(Xe-mn)<=_.EPSILON*Math.max(1,Math.abs(Xe),Math.abs(mn))&&Math.abs(Je-Jr)<=_.EPSILON*Math.max(1,Math.abs(Je),Math.abs(Jr))&&Math.abs(lt-jn)<=_.EPSILON*Math.max(1,Math.abs(lt),Math.abs(jn))&&Math.abs(Tt-_a)<=_.EPSILON*Math.max(1,Math.abs(Tt),Math.abs(_a))&&Math.abs(Ht-Fn)<=_.EPSILON*Math.max(1,Math.abs(Ht),Math.abs(Fn))}var at=F(38015)},89486:function(Mt){var N=[],F=[],k="insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).";function U(_,I){if(I=I||{},_===void 0)throw new Error(k);var T=I.prepend===!0?"prepend":"append",x=I.container!==void 0?I.container:document.querySelector("head"),p=N.indexOf(x);p===-1&&(p=N.push(x)-1,F[p]={});var v;return F[p]!==void 0&&F[p][T]!==void 0?v=F[p][T]:(v=F[p][T]=L(),T==="prepend"?x.insertBefore(v,x.childNodes[0]):x.appendChild(v)),_.charCodeAt(0)===65279&&(_=_.substr(1,_.length)),v.styleSheet?v.styleSheet.cssText+=_:v.textContent+=_,v}function L(){var _=document.createElement("style");return _.setAttribute("type","text/css"),_}Mt.exports=U,Mt.exports.insertCss=U},60804:function(Mt,N,F){"use strict";F.r(N),F.d(N,{isAnyArray:function(){return U}});const k=Object.prototype.toString;function U(L){const _=k.call(L);return _.endsWith("Array]")&&!_.includes("Big")}},22882:function(Mt,N,F){var k=F(80732),U=F(17216),L=F(55073),_="[object Arguments]",I="[object Array]",T="[object Boolean]",x="[object Date]",p="[object Error]",v="[object Function]",g="[object Map]",d="[object Number]",c="[object Object]",s="[object RegExp]",m="[object Set]",M="[object String]",P="[object WeakMap]",R="[object ArrayBuffer]",j="[object DataView]",Q="[object Float32Array]",G="[object Float64Array]",W="[object Int8Array]",H="[object Int16Array]",Z="[object Int32Array]",J="[object Uint8Array]",K="[object Uint8ClampedArray]",ne="[object Uint16Array]",se="[object Uint32Array]",fe={};fe[Q]=fe[G]=fe[W]=fe[H]=fe[Z]=fe[J]=fe[K]=fe[ne]=fe[se]=!0,fe[_]=fe[I]=fe[R]=fe[T]=fe[j]=fe[x]=fe[p]=fe[v]=fe[g]=fe[d]=fe[c]=fe[s]=fe[m]=fe[M]=fe[P]=!1;function Ie(ye){return L(ye)&&U(ye.length)&&!!fe[k(ye)]}Mt.exports=Ie},58792:function(Mt){function N(F){return function(k){return F(k)}}Mt.exports=N},11389:function(Mt,N,F){var k=F(75542),U=k(Object.getPrototypeOf,Object);Mt.exports=U},8478:function(Mt,N,F){Mt=F.nmd(Mt);var k=F(96476),U=N&&!N.nodeType&&N,L=U&&!0&&Mt&&!Mt.nodeType&&Mt,_=L&&L.exports===U,I=_&&k.process,T=function(){try{var x=L&&L.require&&L.require("util").types;return x||I&&I.binding&&I.binding("util")}catch(p){}}();Mt.exports=T},75542:function(Mt){function N(F,k){return function(U){return F(k(U))}}Mt.exports=N},24669:function(Mt){var N=Array.isArray;Mt.exports=N},17216:function(Mt){var N=9007199254740991;function F(k){return typeof k=="number"&&k>-1&&k%1==0&&k<=N}Mt.exports=F},69143:function(Mt,N,F){var k=F(80732),U=F(11389),L=F(55073),_="[object Object]",I=Function.prototype,T=Object.prototype,x=I.toString,p=T.hasOwnProperty,v=x.call(Object);function g(d){if(!L(d)||k(d)!=_)return!1;var c=U(d);if(c===null)return!0;var s=p.call(c,"constructor")&&c.constructor;return typeof s=="function"&&s instanceof s&&x.call(s)==v}Mt.exports=g},73806:function(Mt,N,F){var k=F(22882),U=F(58792),L=F(8478),_=L&&L.isTypedArray,I=_?U(_):k;Mt.exports=I},85650:function(Mt,N,F){"use strict";F.r(N),F.d(N,{default:function(){return _}});var k=F(60804);function U(I){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!(0,k.isAnyArray)(I))throw new TypeError("input must be an array");if(I.length===0)throw new TypeError("input must not be empty");var x=T.fromIndex,p=x===void 0?0:x,v=T.toIndex,g=v===void 0?I.length:v;if(p<0||p>=I.length||!Number.isInteger(p))throw new Error("fromIndex must be a positive integer smaller than length");if(g<=p||g>I.length||!Number.isInteger(g))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var d=I[p],c=p+1;cd&&(d=I[c]);return d}function L(I){var T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!(0,k.isAnyArray)(I))throw new TypeError("input must be an array");if(I.length===0)throw new TypeError("input must not be empty");var x=T.fromIndex,p=x===void 0?0:x,v=T.toIndex,g=v===void 0?I.length:v;if(p<0||p>=I.length||!Number.isInteger(p))throw new Error("fromIndex must be a positive integer smaller than length");if(g<=p||g>I.length||!Number.isInteger(g))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var d=I[p],c=p+1;c1&&arguments[1]!==void 0?arguments[1]:{};if((0,k.isAnyArray)(I)){if(I.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var x;if(T.output!==void 0){if(!(0,k.isAnyArray)(T.output))throw new TypeError("output option must be an array if specified");x=T.output}else x=new Array(I.length);var p=L(I),v=U(I);if(p===v)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var g=T.min,d=g===void 0?T.autoMinMax?p:0:g,c=T.max,s=c===void 0?T.autoMinMax?v:1:c;if(d>=s)throw new RangeError("min option must be smaller than max option");for(var m=(s-d)/(v-p),M=0;M=0&&(he|0)===he||L("invalid parameter type, ("+he+")"+I(We)+". must be a nonnegative integer")}function d(he,We,it){We.indexOf(he)<0&&L("invalid value"+I(it)+". must be one of: "+We)}var c=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function s(he){Object.keys(he).forEach(function(We){c.indexOf(We)<0&&L('invalid regl constructor argument "'+We+'". must be one of '+c)})}function m(he,We){for(he=he+"";he.length0&&We.push(new R("unknown",0,it))}}),We}function H(he,We){We.forEach(function(it){var Zt=he[it.file];if(Zt){var or=Zt.index[it.line];if(or){or.errors.push(it),Zt.hasErrors=!0;return}}he.unknown.hasErrors=!0,he.unknown.lines[0].errors.push(it)})}function Z(he,We,it,Zt,or){if(!he.getShaderParameter(We,he.COMPILE_STATUS)){var Xt=he.getShaderInfoLog(We),Qt=Zt===he.FRAGMENT_SHADER?"fragment":"vertex";ye(it,"string",Qt+" shader source must be a string",or);var gr=G(it,or),Er=W(Xt);H(gr,Er),Object.keys(gr).forEach(function(wr){var _r=gr[wr];if(!_r.hasErrors)return;var Br=[""],f=[""];function w(B,V){Br.push(B),f.push(V||"")}w("file number "+wr+": "+_r.name+` `,"color:red;text-decoration:underline;font-weight:bold"),_r.lines.forEach(function(B){if(B.errors.length>0){w(m(B.number,4)+"| ","background-color:yellow; font-weight:bold"),w(B.line+k,"color:red; background-color:yellow; font-weight:bold");var V=0;B.errors.forEach(function(re){var oe=re.message,le=/^\s*'(.*)'\s*:\s*(.*)$/.exec(oe);if(le){var ge=le[1];switch(oe=le[2],ge){case"assign":ge="=";break}V=Math.max(B.line.indexOf(ge,V),0)}else V=0;w(m("| ",6)),w(m("^^^",V+3)+k,"font-weight:bold"),w(m("| ",6)),w(oe+k,"font-weight:bold")}),w(m("| ",6)+k)}else w(m(B.number,4)+"| "),w(B.line+k,"color:red")}),typeof document!="undefined"&&!window.chrome?(f[0]=Br.join("%c"),console.log.apply(console,f)):console.log(Br.join(""))}),_.raise("Error compiling "+Qt+" shader, "+gr[0].name)}}function J(he,We,it,Zt,or){if(!he.getProgramParameter(We,he.LINK_STATUS)){var Xt=he.getProgramInfoLog(We),Qt=G(it,or),gr=G(Zt,or),Er='Error linking program with vertex shader, "'+gr[0].name+'", and fragment shader "'+Qt[0].name+'"';typeof document!="undefined"?console.log("%c"+Er+k+"%c"+Xt,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Er+k+Xt),_.raise(Er)}}function K(he){he._commandRef=j()}function ne(he,We,it,Zt){K(he);function or(Er){return Er?Zt.id(Er):0}he._fragId=or(he.static.frag),he._vertId=or(he.static.vert);function Xt(Er,wr){Object.keys(wr).forEach(function(_r){Er[Zt.id(_r)]=!0})}var Qt=he._uniformSet={};Xt(Qt,We.static),Xt(Qt,We.dynamic);var gr=he._attributeSet={};Xt(gr,it.static),Xt(gr,it.dynamic),he._hasCount="count"in he.static||"count"in he.dynamic||"elements"in he.static||"elements"in he.dynamic}function se(he,We){var it=Q();L(he+" in command "+(We||j())+(it==="unknown"?"":" called from "+it))}function fe(he,We,it){he||se(We,it||j())}function Ie(he,We,it,Zt){he in We||se("unknown parameter ("+he+")"+I(it)+". possible values: "+Object.keys(We).join(),Zt||j())}function ye(he,We,it,Zt){p(he,We)||se("invalid parameter type"+I(it)+". expected "+We+", got "+typeof he,Zt||j())}function Ae(he){he()}function Se(he,We,it){he.texture?d(he.texture._texture.internalformat,We,"unsupported texture format for attachment"):d(he.renderbuffer._renderbuffer.format,it,"unsupported renderbuffer format for attachment")}var we=33071,Te=9728,ke=9984,Ge=9985,tt=9986,He=9987,ft=5120,Lt=5121,Jt=5122,Qe=5123,ut=5124,xt=5125,dt=5126,pt=32819,wt=32820,mt=33635,ur=34042,Ir=36193,Nr={};Nr[ft]=Nr[Lt]=1,Nr[Jt]=Nr[Qe]=Nr[Ir]=Nr[mt]=Nr[pt]=Nr[wt]=2,Nr[ut]=Nr[xt]=Nr[dt]=Nr[ur]=4;function Hr(he,We){return he===wt||he===pt||he===mt?2:he===ur?4:Nr[he]*We}function It(he){return!(he&he-1)&&!!he}function qt(he,We,it){var Zt,or=We.width,Xt=We.height,Qt=We.channels;_(or>0&&or<=it.maxTextureSize&&Xt>0&&Xt<=it.maxTextureSize,"invalid texture shape"),(he.wrapS!==we||he.wrapT!==we)&&_(It(or)&&It(Xt),"incompatible wrap mode for texture, both width and height must be power of 2"),We.mipmask===1?or!==1&&Xt!==1&&_(he.minFilter!==ke&&he.minFilter!==tt&&he.minFilter!==Ge&&he.minFilter!==He,"min filter requires mipmap"):(_(It(or)&&It(Xt),"texture must be a square power of 2 to support mipmapping"),_(We.mipmask===(or<<1)-1,"missing or incomplete mipmap data")),We.type===dt&&(it.extensions.indexOf("oes_texture_float_linear")<0&&_(he.minFilter===Te&&he.magFilter===Te,"filter not supported, must enable oes_texture_float_linear"),_(!he.genMipmaps,"mipmap generation not supported with float textures"));var gr=We.images;for(Zt=0;Zt<16;++Zt)if(gr[Zt]){var Er=or>>Zt,wr=Xt>>Zt;_(We.mipmask&1<0&&or<=Zt.maxTextureSize&&Xt>0&&Xt<=Zt.maxTextureSize,"invalid texture shape"),_(or===Xt,"cube map must be square"),_(We.wrapS===we&&We.wrapT===we,"wrap mode not supported by cube map");for(var gr=0;gr>_r,w=Xt>>_r;_(Er.mipmask&1<<_r,"missing mipmap data"),_(Br.width===f&&Br.height===w,"invalid shape for mip images"),_(Br.format===he.format&&Br.internalformat===he.internalformat&&Br.type===he.type,"incompatible type for mip image"),Br.compressed||(Br.data?_(Br.data.byteLength===f*w*Math.max(Hr(Br.type,Qt),Br.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):Br.element||Br.copy)}}}}var Oe=F(_,{optional:Ae,raise:L,commandRaise:se,command:fe,parameter:T,commandParameter:Ie,constructor:s,type:v,commandType:ye,isTypedArray:x,nni:g,oneOf:d,shaderError:Z,linkError:J,callSite:Q,saveCommandRef:K,saveDrawInfo:ne,framebufferFormat:Se,guessCommand:j,texture2D:qt,textureCube:ar}),Pr=0,Cr=0,Gr=5,mr=6;function rn(he,We){this.id=Pr++,this.type=he,this.data=We}function Sr(he){return he.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function qr(he){if(he.length===0)return[];var We=he.charAt(0),it=he.charAt(he.length-1);if(he.length>1&&We===it&&(We==='"'||We==="'"))return['"'+Sr(he.substr(1,he.length-2))+'"'];var Zt=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(he);if(Zt)return qr(he.substr(0,Zt.index)).concat(qr(Zt[1])).concat(qr(he.substr(Zt.index+Zt[0].length)));var or=he.split(".");if(or.length===1)return['"'+Sr(he)+'"'];for(var Xt=[],Qt=0;QtRt(it,We+"["+Zt+"]")));if(he instanceof rn)return he;Oe(!1,"invalid option type in uniform "+We)}var zt={DynamicVariable:rn,define:yn,isDynamic:zr,unbox:Rt,accessor:Rn},Vt={next:typeof requestAnimationFrame=="function"?function(he){return requestAnimationFrame(he)}:function(he){return setTimeout(he,16)},cancel:typeof cancelAnimationFrame=="function"?function(he){return cancelAnimationFrame(he)}:clearTimeout},hr=typeof performance!="undefined"&&performance.now?function(){return performance.now()}:function(){return+new Date};function Ar(){var he={"":0},We=[""];return{id:function(it){var Zt=he[it];return Zt||(Zt=he[it]=We.length,We.push(it),Zt)},str:function(it){return We[it]}}}function en(he,We,it){var Zt=document.createElement("canvas");F(Zt.style,{border:0,margin:0,padding:0,top:0,left:0}),he.appendChild(Zt),he===document.body&&(Zt.style.position="absolute",F(he.style,{margin:0,padding:0}));function or(){var gr=window.innerWidth,Er=window.innerHeight;if(he!==document.body){var wr=he.getBoundingClientRect();gr=wr.right-wr.left,Er=wr.bottom-wr.top}Zt.width=it*gr,Zt.height=it*Er,F(Zt.style,{width:gr+"px",height:Er+"px"})}var Xt;he!==document.body&&typeof ResizeObserver=="function"?(Xt=new ResizeObserver(function(){setTimeout(or)}),Xt.observe(he)):window.addEventListener("resize",or,!1);function Qt(){Xt?Xt.disconnect():window.removeEventListener("resize",or),he.removeChild(Zt)}return or(),{canvas:Zt,onDestroy:Qt}}function Fr(he,We){function it(Zt){try{return he.getContext(Zt,We)}catch(or){return null}}return it("webgl")||it("experimental-webgl")||it("webgl-experimental")}function Cn(he){return typeof he.nodeName=="string"&&typeof he.appendChild=="function"&&typeof he.getBoundingClientRect=="function"}function Sn(he){return typeof he.drawArrays=="function"||typeof he.drawElements=="function"}function oa(he){return typeof he=="string"?he.split():(Oe(Array.isArray(he),"invalid extension array"),he)}function jr(he){return typeof he=="string"?(Oe(typeof document!="undefined","not supported outside of DOM"),document.querySelector(he)):he}function xn(he){var We=he||{},it,Zt,or,Xt,Qt={},gr=[],Er=[],wr=typeof window=="undefined"?1:window.devicePixelRatio,_r=!1,Br=function(B){B&&Oe.raise(B)},f=function(){};if(typeof We=="string"?(Oe(typeof document!="undefined","selector queries only supported in DOM enviroments"),it=document.querySelector(We),Oe(it,"invalid query string for element")):typeof We=="object"?Cn(We)?it=We:Sn(We)?(Xt=We,or=Xt.canvas):(Oe.constructor(We),"gl"in We?Xt=We.gl:"canvas"in We?or=jr(We.canvas):"container"in We&&(Zt=jr(We.container)),"attributes"in We&&(Qt=We.attributes,Oe.type(Qt,"object","invalid context attributes")),"extensions"in We&&(gr=oa(We.extensions)),"optionalExtensions"in We&&(Er=oa(We.optionalExtensions)),"onDone"in We&&(Oe.type(We.onDone,"function","invalid or missing onDone callback"),Br=We.onDone),"profile"in We&&(_r=!!We.profile),"pixelRatio"in We&&(wr=+We.pixelRatio,Oe(wr>0,"invalid pixel ratio"))):Oe.raise("invalid arguments to regl"),it&&(it.nodeName.toLowerCase()==="canvas"?or=it:Zt=it),!Xt){if(!or){Oe(typeof document!="undefined","must manually specify webgl context outside of DOM environments");var w=en(Zt||document.body,Br,wr);if(!w)return null;or=w.canvas,f=w.onDestroy}Qt.premultipliedAlpha===void 0&&(Qt.premultipliedAlpha=!0),Xt=Fr(or,Qt)}return Xt?{gl:Xt,canvas:or,container:Zt,extensions:gr,optionalExtensions:Er,pixelRatio:wr,profile:_r,onDone:Br,onDestroy:f}:(f(),Br("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function vn(he,We){var it={};function Zt(Qt){Oe.type(Qt,"string","extension name must be string");var gr=Qt.toLowerCase(),Er;try{Er=it[gr]=he.getExtension(gr)}catch(wr){}return!!Er}for(var or=0;or65535)<<4,he>>>=We,it=(he>255)<<3,he>>>=it,We|=it,it=(he>15)<<2,he>>>=it,We|=it,it=(he>3)<<1,he>>>=it,We|=it,We|he>>1}function Me(){var he=un(8,function(){return[]});function We(Xt){var Qt=X(Xt),gr=he[pe(Qt)>>2];return gr.length>0?gr.pop():new ArrayBuffer(Qt)}function it(Xt){he[pe(Xt.byteLength)>>2].push(Xt)}function Zt(Xt,Qt){var gr=null;switch(Xt){case Wn:gr=new Int8Array(We(Qt),0,Qt);break;case Y:gr=new Uint8Array(We(Qt),0,Qt);break;case ie:gr=new Int16Array(We(2*Qt),0,Qt);break;case ee:gr=new Uint16Array(We(2*Qt),0,Qt);break;case C:gr=new Int32Array(We(4*Qt),0,Qt);break;case b:gr=new Uint32Array(We(4*Qt),0,Qt);break;case S:gr=new Float32Array(We(4*Qt),0,Qt);break;default:return null}return gr.length!==Qt?gr.subarray(0,Qt):gr}function or(Xt){it(Xt.buffer)}return{alloc:We,free:it,allocType:Zt,freeType:or}}var me=Me();me.zero=Me();var Le=3408,st=3410,qe=3411,Nt=3412,nr=3413,Ft=3414,er=3415,Ur=33901,Ct=33902,Kt=3379,lr=3386,Dr=34921,br=36347,sa=36348,ea=35661,gn=35660,Tn=34930,ra=36349,Zn=34076,Vr=34024,In=7936,at=7937,D=7938,te=35724,xe=34047,be=36063,De=34852,Xe=3553,Je=34067,lt=34069,Tt=33984,Ht=6408,ir=5126,Kr=5121,nn=36160,mn=36053,Jr=36064,jn=16384,_a=function(he,We){var it=1;We.ext_texture_filter_anisotropic&&(it=he.getParameter(xe));var Zt=1,or=1;We.webgl_draw_buffers&&(Zt=he.getParameter(De),or=he.getParameter(be));var Xt=!!We.oes_texture_float;if(Xt){var Qt=he.createTexture();he.bindTexture(Xe,Qt),he.texImage2D(Xe,0,Ht,1,1,0,Ht,ir,null);var gr=he.createFramebuffer();if(he.bindFramebuffer(nn,gr),he.framebufferTexture2D(nn,Jr,Xe,Qt,0),he.bindTexture(Xe,null),he.checkFramebufferStatus(nn)!==mn)Xt=!1;else{he.viewport(0,0,1,1),he.clearColor(1,0,0,1),he.clear(jn);var Er=me.allocType(ir,4);he.readPixels(0,0,1,1,Ht,ir,Er),he.getError()?Xt=!1:(he.deleteFramebuffer(gr),he.deleteTexture(Qt),Xt=Er[0]===1),me.freeType(Er)}}var wr=typeof navigator!="undefined"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),_r=!0;if(!wr){var Br=he.createTexture(),f=me.allocType(Kr,36);he.activeTexture(Tt),he.bindTexture(Je,Br),he.texImage2D(lt,0,Ht,3,3,0,Ht,Kr,f),me.freeType(f),he.bindTexture(Je,null),he.deleteTexture(Br),_r=!he.getError()}return{colorBits:[he.getParameter(st),he.getParameter(qe),he.getParameter(Nt),he.getParameter(nr)],depthBits:he.getParameter(Ft),stencilBits:he.getParameter(er),subpixelBits:he.getParameter(Le),extensions:Object.keys(We).filter(function(w){return!!We[w]}),maxAnisotropic:it,maxDrawbuffers:Zt,maxColorAttachments:or,pointSizeDims:he.getParameter(Ur),lineWidthDims:he.getParameter(Ct),maxViewportDims:he.getParameter(lr),maxCombinedTextureUnits:he.getParameter(ea),maxCubeMapSize:he.getParameter(Zn),maxRenderbufferSize:he.getParameter(Vr),maxTextureUnits:he.getParameter(Tn),maxTextureSize:he.getParameter(Kt),maxAttributes:he.getParameter(Dr),maxVertexUniforms:he.getParameter(br),maxVertexTextureUnits:he.getParameter(gn),maxVaryingVectors:he.getParameter(sa),maxFragmentUniforms:he.getParameter(ra),glsl:he.getParameter(te),renderer:he.getParameter(at),vendor:he.getParameter(In),version:he.getParameter(D),readFloat:Xt,npotTextureCube:_r}};function Fn(he){return!!he&&typeof he=="object"&&Array.isArray(he.shape)&&Array.isArray(he.stride)&&typeof he.offset=="number"&&he.shape.length===he.stride.length&&(Array.isArray(he.data)||N(he.data))}var ya=function(he){return Object.keys(he).map(function(We){return he[We]})},Ai={shape:Ei,flatten:ho};function bo(he,We,it){for(var Zt=0;Zt0){var ze;if(Array.isArray(re[0])){Ne=wo(re);for(var Be=1,nt=1;nt0)if(typeof Be[0]=="number"){var Pt=me.allocType(ge.dtype,Be.length);Zo(Pt,Be),Ne(Pt,_t),me.freeType(Pt)}else if(Array.isArray(Be[0])||N(Be[0])){tr=wo(Be);var kt=ri(Be,tr,ge.dtype);Ne(kt,_t),me.freeType(kt)}else Oe.raise("invalid buffer data")}else if(Fn(Be)){tr=Be.shape;var Dt=Be.stride,pr=0,Xr=0,Or=0,fn=0;tr.length===1?(pr=tr[0],Xr=1,Or=Dt[0],fn=0):tr.length===2?(pr=tr[0],Xr=tr[1],Or=Dt[0],fn=Dt[1]):Oe.raise("invalid shape");var cn=Array.isArray(Be.data)?ge.dtype:ro(Be.data),Mn=me.allocType(cn,pr*Xr);Ui(Mn,Be.data,pr,Xr,Or,fn,Be.offset),Ne(Mn,_t),me.freeType(Mn)}else Oe.raise("invalid data for buffer subdata");return _e}return oe||_e(V),_e._reglType="buffer",_e._buffer=ge,_e.subdata=ze,it.profile&&(_e.stats=ge.stats),_e.destroy=function(){f(ge)},_e}function B(){ya(Xt).forEach(function(V){V.buffer=he.createBuffer(),he.bindBuffer(V.type,V.buffer),he.bufferData(V.type,V.persistentData||V.byteLength,V.usage)})}return it.profile&&(We.getTotalBufferSize=function(){var V=0;return Object.keys(Xt).forEach(function(re){V+=Xt[re].stats.size}),V}),{create:w,createStream:Er,destroyStream:wr,clear:function(){ya(Xt).forEach(f),gr.forEach(f)},getBuffer:function(V){return V&&V._buffer instanceof Qt?V._buffer:null},restore:B,_initBuffer:Br}}var Ko=0,vo=0,hs=1,Ca=1,So=4,ou=4,di={points:Ko,point:vo,lines:hs,line:Ca,triangles:So,triangle:ou,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},mi=0,_o=1,hi=4,xi=5120,Vn=5121,ni=5122,qa=5123,wi=5124,bi=5125,Mi=34963,go=35040,no=35044;function Mo(he,We,it,Zt){var or={},Xt=0,Qt={uint8:Vn,uint16:qa};We.oes_element_index_uint&&(Qt.uint32=bi);function gr(B){this.id=Xt++,or[this.id]=this,this.buffer=B,this.primType=hi,this.vertCount=0,this.type=0}gr.prototype.bind=function(){this.buffer.bind()};var Er=[];function wr(B){var V=Er.pop();return V||(V=new gr(it.create(null,Mi,!0,!1)._buffer)),Br(V,B,go,-1,-1,0,0),V}function _r(B){Er.push(B)}function Br(B,V,re,oe,le,ge,_e){B.buffer.bind();var Ne;if(V){var ze=_e;!_e&&(!N(V)||Fn(V)&&!N(V.data))&&(ze=We.oes_element_index_uint?bi:qa),it._initBuffer(B.buffer,V,re,ze,3)}else he.bufferData(Mi,ge,re),B.buffer.dtype=Ne||Vn,B.buffer.usage=re,B.buffer.dimension=3,B.buffer.byteLength=ge;if(Ne=_e,!_e){switch(B.buffer.dtype){case Vn:case xi:Ne=Vn;break;case qa:case ni:Ne=qa;break;case bi:case wi:Ne=bi;break;default:Oe.raise("unsupported type for element array")}B.buffer.dtype=Ne}B.type=Ne,Oe(Ne!==bi||!!We.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var Be=le;Be<0&&(Be=B.buffer.byteLength,Ne===qa?Be>>=1:Ne===bi&&(Be>>=2)),B.vertCount=Be;var nt=oe;if(oe<0){nt=hi;var _t=B.buffer.dimension;_t===1&&(nt=mi),_t===2&&(nt=_o),_t===3&&(nt=hi)}B.primType=nt}function f(B){Zt.elementsCount--,Oe(B.buffer!==null,"must not double destroy elements"),delete or[B.id],B.buffer.destroy(),B.buffer=null}function w(B,V){var re=it.create(null,Mi,!0),oe=new gr(re._buffer);Zt.elementsCount++;function le(ge){if(!ge)re(),oe.primType=hi,oe.vertCount=0,oe.type=Vn;else if(typeof ge=="number")re(ge),oe.primType=hi,oe.vertCount=ge|0,oe.type=Vn;else{var _e=null,Ne=no,ze=-1,Be=-1,nt=0,_t=0;Array.isArray(ge)||N(ge)||Fn(ge)?_e=ge:(Oe.type(ge,"object","invalid arguments for elements"),"data"in ge&&(_e=ge.data,Oe(Array.isArray(_e)||N(_e)||Fn(_e),"invalid data for element buffer")),"usage"in ge&&(Oe.parameter(ge.usage,xo,"invalid element buffer usage"),Ne=xo[ge.usage]),"primitive"in ge&&(Oe.parameter(ge.primitive,di,"invalid element buffer primitive"),ze=di[ge.primitive]),"count"in ge&&(Oe(typeof ge.count=="number"&&ge.count>=0,"invalid vertex count for elements"),Be=ge.count|0),"type"in ge&&(Oe.parameter(ge.type,Qt,"invalid buffer type"),_t=Qt[ge.type]),"length"in ge?nt=ge.length|0:(nt=Be,_t===qa||_t===ni?nt*=2:(_t===bi||_t===wi)&&(nt*=4))),Br(oe,_e,Ne,ze,Be,nt,_t)}return le}return le(B),le._reglType="elements",le._elements=oe,le.subdata=function(ge,_e){return re.subdata(ge,_e),le},le.destroy=function(){f(oe)},le}return{create:w,createStream:wr,destroyStream:_r,getElements:function(B){return typeof B=="function"&&B._elements instanceof gr?B._elements:null},clear:function(){ya(or).forEach(f)}}}var po=new Float32Array(1),su=new Uint32Array(po.buffer),gf=5123;function uu(he){for(var We=me.allocType(gf,he.length),it=0;it>>31<<15,Xt=(Zt<<1>>>24)-127,Qt=Zt>>13&1024-1;if(Xt<-24)We[it]=or;else if(Xt<-14){var gr=-14-Xt;We[it]=or+(Qt+1024>>gr)}else Xt>15?We[it]=or+31744:We[it]=or+(Xt+15<<10)+Qt}return We}function _n(he){return Array.isArray(he)||N(he)}var dn=function(he){return!(he&he-1)&&!!he},rc=34467,ai=3553,Ps=34067,$o=34069,Ba=6408,$a=6406,Qo=6407,Jo=6409,vs=6410,Bu=32854,Fu=32855,Fa=36194,yo=32819,gs=32820,fu=33635,cu=34042,ks=6402,ps=34041,ys=35904,Gu=35906,Oi=36193,ko=33776,Rs=33777,zu=33778,lu=33779,Bs=35986,qo=35987,Fs=34798,du=35840,hu=35841,Uu=35842,Wu=35843,ao=36196,Ro=5121,Xu=5123,vu=5125,Xi=5126,pf=10242,ju=10243,yf=10497,Gs=33071,nc=33648,mf=10240,bf=10241,zs=9728,Vu=9729,gu=9984,pu=9985,yu=9986,Us=9987,Bo=33170,es=4352,vi=4353,Ws=4354,Xs=34046,Ef=3317,xf=37440,Yu=37441,js=37443,ji=37444,mo=33984,ac=[gu,yu,pu,Us],Vs=[0,Jo,vs,Qo,Ba],Vi={};Vi[Jo]=Vi[$a]=Vi[ks]=1,Vi[ps]=Vi[vs]=2,Vi[Qo]=Vi[ys]=3,Vi[Ba]=Vi[Gu]=4;function Fo(he){return"[object "+he+"]"}var wf=Fo("HTMLCanvasElement"),Sf=Fo("OffscreenCanvas"),Ys=Fo("CanvasRenderingContext2D"),Hu=Fo("ImageBitmap"),ts=Fo("HTMLImageElement"),ms=Fo("HTMLVideoElement"),Zu=Object.keys(eo).concat([wf,Sf,Ys,Hu,ts,ms]),rs=[];rs[Ro]=1,rs[Xi]=4,rs[Oi]=2,rs[Xu]=2,rs[vu]=4;var ii=[];ii[Bu]=2,ii[Fu]=2,ii[Fa]=2,ii[ps]=4,ii[ko]=.5,ii[Rs]=.5,ii[zu]=1,ii[lu]=1,ii[Bs]=.5,ii[qo]=1,ii[Fs]=1,ii[du]=.5,ii[hu]=.25,ii[Uu]=.5,ii[Wu]=.25,ii[ao]=.5;function Hs(he){return Array.isArray(he)&&(he.length===0||typeof he[0]=="number")}function bs(he){if(!Array.isArray(he))return!1;var We=he.length;return!(We===0||!_n(he[0]))}function io(he){return Object.prototype.toString.call(he)}function ns(he){return io(he)===wf}function _f(he){return io(he)===Sf}function Mf(he){return io(he)===Ys}function Co(he){return io(he)===Hu}function ic(he){return io(he)===ts}function oc(he){return io(he)===ms}function Es(he){if(!he)return!1;var We=io(he);return Zu.indexOf(We)>=0?!0:Hs(he)||bs(he)||Fn(he)}function Cf(he){return eo[Object.prototype.toString.call(he)]|0}function mu(he,We){var it=We.length;switch(he.type){case Ro:case Xu:case vu:case Xi:var Zt=me.allocType(he.type,it);Zt.set(We),he.data=Zt;break;case Oi:he.data=uu(We);break;default:Oe.raise("unsupported texture type, must specify a typed array")}}function Ku(he,We){return me.allocType(he.type===Oi?Xi:he.type,We)}function $u(he,We){he.type===Oi?(he.data=uu(We),me.freeType(We)):he.data=We}function bu(he,We,it,Zt,or,Xt){for(var Qt=he.width,gr=he.height,Er=he.channels,wr=Qt*gr*Er,_r=Ku(he,wr),Br=0,f=0;f=1;)gr+=Qt*Er*Er,Er/=2;return gr}else return Qt*it*Zt}function Eu(he,We,it,Zt,or,Xt,Qt){var gr={"don't care":es,"dont care":es,nice:Ws,fast:vi},Er={repeat:yf,clamp:Gs,mirror:nc},wr={nearest:zs,linear:Vu},_r=F({mipmap:Us,"nearest mipmap nearest":gu,"linear mipmap nearest":pu,"nearest mipmap linear":yu,"linear mipmap linear":Us},wr),Br={none:0,browser:ji},f={uint8:Ro,rgba4:yo,rgb565:fu,"rgb5 a1":gs},w={alpha:$a,luminance:Jo,"luminance alpha":vs,rgb:Qo,rgba:Ba,rgba4:Bu,"rgb5 a1":Fu,rgb565:Fa},B={};We.ext_srgb&&(w.srgb=ys,w.srgba=Gu),We.oes_texture_float&&(f.float32=f.float=Xi),We.oes_texture_half_float&&(f.float16=f["half float"]=Oi),We.webgl_depth_texture&&(F(w,{depth:ks,"depth stencil":ps}),F(f,{uint16:Xu,uint32:vu,"depth stencil":cu})),We.webgl_compressed_texture_s3tc&&F(B,{"rgb s3tc dxt1":ko,"rgba s3tc dxt1":Rs,"rgba s3tc dxt3":zu,"rgba s3tc dxt5":lu}),We.webgl_compressed_texture_atc&&F(B,{"rgb atc":Bs,"rgba atc explicit alpha":qo,"rgba atc interpolated alpha":Fs}),We.webgl_compressed_texture_pvrtc&&F(B,{"rgb pvrtc 4bppv1":du,"rgb pvrtc 2bppv1":hu,"rgba pvrtc 4bppv1":Uu,"rgba pvrtc 2bppv1":Wu}),We.webgl_compressed_texture_etc1&&(B["rgb etc1"]=ao);var V=Array.prototype.slice.call(he.getParameter(rc));Object.keys(B).forEach(function(rt){var $t=B[rt];V.indexOf($t)>=0&&(w[rt]=$t)});var re=Object.keys(w);it.textureFormats=re;var oe=[];Object.keys(w).forEach(function(rt){var $t=w[rt];oe[$t]=rt});var le=[];Object.keys(f).forEach(function(rt){var $t=f[rt];le[$t]=rt});var ge=[];Object.keys(wr).forEach(function(rt){var $t=wr[rt];ge[$t]=rt});var _e=[];Object.keys(_r).forEach(function(rt){var $t=_r[rt];_e[$t]=rt});var Ne=[];Object.keys(Er).forEach(function(rt){var $t=Er[rt];Ne[$t]=rt});var ze=re.reduce(function(rt,$t){var Yt=w[$t];return Yt===Jo||Yt===$a||Yt===Jo||Yt===vs||Yt===ks||Yt===ps||We.ext_srgb&&(Yt===ys||Yt===Gu)?rt[Yt]=Yt:Yt===Fu||$t.indexOf("rgba")>=0?rt[Yt]=Ba:rt[Yt]=Qo,rt},{});function Be(){this.internalformat=Ba,this.format=Ba,this.type=Ro,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=ji,this.width=0,this.height=0,this.channels=0}function nt(rt,$t){rt.internalformat=$t.internalformat,rt.format=$t.format,rt.type=$t.type,rt.compressed=$t.compressed,rt.premultiplyAlpha=$t.premultiplyAlpha,rt.flipY=$t.flipY,rt.unpackAlignment=$t.unpackAlignment,rt.colorSpace=$t.colorSpace,rt.width=$t.width,rt.height=$t.height,rt.channels=$t.channels}function _t(rt,$t){if(!(typeof $t!="object"||!$t)){if("premultiplyAlpha"in $t&&(Oe.type($t.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),rt.premultiplyAlpha=$t.premultiplyAlpha),"flipY"in $t&&(Oe.type($t.flipY,"boolean","invalid texture flip"),rt.flipY=$t.flipY),"alignment"in $t&&(Oe.oneOf($t.alignment,[1,2,4,8],"invalid texture unpack alignment"),rt.unpackAlignment=$t.alignment),"colorSpace"in $t&&(Oe.parameter($t.colorSpace,Br,"invalid colorSpace"),rt.colorSpace=Br[$t.colorSpace]),"type"in $t){var Yt=$t.type;Oe(We.oes_texture_float||!(Yt==="float"||Yt==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures."),Oe(We.oes_texture_half_float||!(Yt==="half float"||Yt==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),Oe(We.webgl_depth_texture||!(Yt==="uint16"||Yt==="uint32"||Yt==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),Oe.parameter(Yt,f,"invalid texture type"),rt.type=f[Yt]}var Lr=rt.width,ia=rt.height,Ze=rt.channels,Fe=!1;"shape"in $t?(Oe(Array.isArray($t.shape)&&$t.shape.length>=2,"shape must be an array"),Lr=$t.shape[0],ia=$t.shape[1],$t.shape.length===3&&(Ze=$t.shape[2],Oe(Ze>0&&Ze<=4,"invalid number of channels"),Fe=!0),Oe(Lr>=0&&Lr<=it.maxTextureSize,"invalid width"),Oe(ia>=0&&ia<=it.maxTextureSize,"invalid height")):("radius"in $t&&(Lr=ia=$t.radius,Oe(Lr>=0&&Lr<=it.maxTextureSize,"invalid radius")),"width"in $t&&(Lr=$t.width,Oe(Lr>=0&&Lr<=it.maxTextureSize,"invalid width")),"height"in $t&&(ia=$t.height,Oe(ia>=0&&ia<=it.maxTextureSize,"invalid height")),"channels"in $t&&(Ze=$t.channels,Oe(Ze>0&&Ze<=4,"invalid number of channels"),Fe=!0)),rt.width=Lr|0,rt.height=ia|0,rt.channels=Ze|0;var vt=!1;if("format"in $t){var Bt=$t.format;Oe(We.webgl_depth_texture||!(Bt==="depth"||Bt==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),Oe.parameter(Bt,w,"invalid texture format");var Ut=rt.internalformat=w[Bt];rt.format=ze[Ut],Bt in f&&("type"in $t||(rt.type=f[Bt])),Bt in B&&(rt.compressed=!0),vt=!0}!Fe&&vt?rt.channels=Vi[rt.format]:Fe&&!vt?rt.channels!==Vs[rt.format]&&(rt.format=rt.internalformat=Vs[rt.channels]):vt&&Fe&&Oe(rt.channels===Vi[rt.format],"number of channels inconsistent with specified format")}}function tr(rt){he.pixelStorei(xf,rt.flipY),he.pixelStorei(Yu,rt.premultiplyAlpha),he.pixelStorei(js,rt.colorSpace),he.pixelStorei(Ef,rt.unpackAlignment)}function Pt(){Be.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function kt(rt,$t){var Yt=null;if(Es($t)?Yt=$t:$t&&(Oe.type($t,"object","invalid pixel data type"),_t(rt,$t),"x"in $t&&(rt.xOffset=$t.x|0),"y"in $t&&(rt.yOffset=$t.y|0),Es($t.data)&&(Yt=$t.data)),Oe(!rt.compressed||Yt instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),$t.copy){Oe(!Yt,"can not specify copy and data field for the same texture");var Lr=or.viewportWidth,ia=or.viewportHeight;rt.width=rt.width||Lr-rt.xOffset,rt.height=rt.height||ia-rt.yOffset,rt.needsCopy=!0,Oe(rt.xOffset>=0&&rt.xOffset=0&&rt.yOffset0&&rt.width<=Lr&&rt.height>0&&rt.height<=ia,"copy texture read out of bounds")}else if(!Yt)rt.width=rt.width||1,rt.height=rt.height||1,rt.channels=rt.channels||4;else if(N(Yt))rt.channels=rt.channels||4,rt.data=Yt,!("type"in $t)&&rt.type===Ro&&(rt.type=Cf(Yt));else if(Hs(Yt))rt.channels=rt.channels||4,mu(rt,Yt),rt.alignment=1,rt.needsFree=!0;else if(Fn(Yt)){var Ze=Yt.data;!Array.isArray(Ze)&&rt.type===Ro&&(rt.type=Cf(Ze));var Fe=Yt.shape,vt=Yt.stride,Bt,Ut,Et,gt,Ot,Ke;Fe.length===3?(Et=Fe[2],Ke=vt[2]):(Oe(Fe.length===2,"invalid ndarray pixel data, must be 2 or 3D"),Et=1,Ke=1),Bt=Fe[0],Ut=Fe[1],gt=vt[0],Ot=vt[1],rt.alignment=1,rt.width=Bt,rt.height=Ut,rt.channels=Et,rt.format=rt.internalformat=Vs[Et],rt.needsFree=!0,bu(rt,Ze,gt,Ot,Ke,Yt.offset)}else if(ns(Yt)||_f(Yt)||Mf(Yt))ns(Yt)||_f(Yt)?rt.element=Yt:rt.element=Yt.canvas,rt.width=rt.element.width,rt.height=rt.element.height,rt.channels=4;else if(Co(Yt))rt.element=Yt,rt.width=Yt.width,rt.height=Yt.height,rt.channels=4;else if(ic(Yt))rt.element=Yt,rt.width=Yt.naturalWidth,rt.height=Yt.naturalHeight,rt.channels=4;else if(oc(Yt))rt.element=Yt,rt.width=Yt.videoWidth,rt.height=Yt.videoHeight,rt.channels=4;else if(bs(Yt)){var ct=rt.width||Yt[0].length,Ye=rt.height||Yt.length,At=rt.channels;_n(Yt[0][0])?At=At||Yt[0][0].length:At=At||1;for(var Wt=Ai.shape(Yt),sr=1,fr=0;fr=0,"oes_texture_float extension not enabled"):rt.type===Oi&&Oe(it.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function Dt(rt,$t,Yt){var Lr=rt.element,ia=rt.data,Ze=rt.internalformat,Fe=rt.format,vt=rt.type,Bt=rt.width,Ut=rt.height;tr(rt),Lr?he.texImage2D($t,Yt,Fe,Fe,vt,Lr):rt.compressed?he.compressedTexImage2D($t,Yt,Ze,Bt,Ut,0,ia):rt.needsCopy?(Zt(),he.copyTexImage2D($t,Yt,Fe,rt.xOffset,rt.yOffset,Bt,Ut,0)):he.texImage2D($t,Yt,Fe,Bt,Ut,0,Fe,vt,ia||null)}function pr(rt,$t,Yt,Lr,ia){var Ze=rt.element,Fe=rt.data,vt=rt.internalformat,Bt=rt.format,Ut=rt.type,Et=rt.width,gt=rt.height;tr(rt),Ze?he.texSubImage2D($t,ia,Yt,Lr,Bt,Ut,Ze):rt.compressed?he.compressedTexSubImage2D($t,ia,Yt,Lr,vt,Et,gt,Fe):rt.needsCopy?(Zt(),he.copyTexSubImage2D($t,ia,Yt,Lr,rt.xOffset,rt.yOffset,Et,gt)):he.texSubImage2D($t,ia,Yt,Lr,Et,gt,Bt,Ut,Fe)}var Xr=[];function Or(){return Xr.pop()||new Pt}function fn(rt){rt.needsFree&&me.freeType(rt.data),Pt.call(rt),Xr.push(rt)}function cn(){Be.call(this),this.genMipmaps=!1,this.mipmapHint=es,this.mipmask=0,this.images=Array(16)}function Mn(rt,$t,Yt){var Lr=rt.images[0]=Or();rt.mipmask=1,Lr.width=rt.width=$t,Lr.height=rt.height=Yt,Lr.channels=rt.channels=4}function Un(rt,$t){var Yt=null;if(Es($t))Yt=rt.images[0]=Or(),nt(Yt,rt),kt(Yt,$t),rt.mipmask=1;else if(_t(rt,$t),Array.isArray($t.mipmap))for(var Lr=$t.mipmap,ia=0;ia>=ia,Yt.height>>=ia,kt(Yt,Lr[ia]),rt.mipmask|=1<=0&&!("faces"in $t)&&(rt.genMipmaps=!0)}if("mag"in $t){var Lr=$t.mag;Oe.parameter(Lr,wr),rt.magFilter=wr[Lr]}var ia=rt.wrapS,Ze=rt.wrapT;if("wrap"in $t){var Fe=$t.wrap;typeof Fe=="string"?(Oe.parameter(Fe,Er),ia=Ze=Er[Fe]):Array.isArray(Fe)&&(Oe.parameter(Fe[0],Er),Oe.parameter(Fe[1],Er),ia=Er[Fe[0]],Ze=Er[Fe[1]])}else{if("wrapS"in $t){var vt=$t.wrapS;Oe.parameter(vt,Er),ia=Er[vt]}if("wrapT"in $t){var Bt=$t.wrapT;Oe.parameter(Bt,Er),Ze=Er[Bt]}}if(rt.wrapS=ia,rt.wrapT=Ze,"anisotropic"in $t){var Ut=$t.anisotropic;Oe(typeof Ut=="number"&&Ut>=1&&Ut<=it.maxAnisotropic,"aniso samples must be between 1 and "),rt.anisotropic=$t.anisotropic}if("mipmap"in $t){var Et=!1;switch(typeof $t.mipmap){case"string":Oe.parameter($t.mipmap,gr,"invalid mipmap hint"),rt.mipmapHint=gr[$t.mipmap],rt.genMipmaps=!0,Et=!0;break;case"boolean":Et=rt.genMipmaps=$t.mipmap;break;case"object":Oe(Array.isArray($t.mipmap),"invalid mipmap type"),rt.genMipmaps=!1,Et=!0;break;default:Oe.raise("invalid mipmap type")}Et&&!("min"in $t)&&(rt.minFilter=gu)}}function Wa(rt,$t){he.texParameteri($t,bf,rt.minFilter),he.texParameteri($t,mf,rt.magFilter),he.texParameteri($t,pf,rt.wrapS),he.texParameteri($t,ju,rt.wrapT),We.ext_texture_filter_anisotropic&&he.texParameteri($t,Xs,rt.anisotropic),rt.genMipmaps&&(he.hint(Bo,rt.mipmapHint),he.generateMipmap($t))}var Za=0,pi={},Di=it.maxTextureUnits,ui=Array(Di).map(function(){return null});function Jn(rt){Be.call(this),this.mipmask=0,this.internalformat=Ba,this.id=Za++,this.refCount=1,this.target=rt,this.texture=he.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new Aa,Qt.profile&&(this.stats={size:0})}function Ni(rt){he.activeTexture(mo),he.bindTexture(rt.target,rt.texture)}function ma(){var rt=ui[0];rt?he.bindTexture(rt.target,rt.texture):he.bindTexture(ai,null)}function An(rt){var $t=rt.texture;Oe($t,"must not double destroy texture");var Yt=rt.unit,Lr=rt.target;Yt>=0&&(he.activeTexture(mo+Yt),he.bindTexture(Lr,null),ui[Yt]=null),he.deleteTexture($t),rt.texture=null,rt.params=null,rt.pixels=null,rt.refCount=0,delete pi[rt.id],Xt.textureCount--}F(Jn.prototype,{bind:function(){var rt=this;rt.bindCount+=1;var $t=rt.unit;if($t<0){for(var Yt=0;Yt0)continue;Lr.unit=-1}ui[Yt]=rt,$t=Yt;break}$t>=Di&&Oe.raise("insufficient number of texture units"),Qt.profile&&Xt.maxTextureUnits<$t+1&&(Xt.maxTextureUnits=$t+1),rt.unit=$t,he.activeTexture(mo+$t),he.bindTexture(rt.target,rt.texture)}return $t},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&An(this)}});function ca(rt,$t){var Yt=new Jn(ai);pi[Yt.id]=Yt,Xt.textureCount++;function Lr(Fe,vt){var Bt=Yt.texInfo;Aa.call(Bt);var Ut=Bn();return typeof Fe=="number"?typeof vt=="number"?Mn(Ut,Fe|0,vt|0):Mn(Ut,Fe|0,Fe|0):Fe?(Oe.type(Fe,"object","invalid arguments to regl.texture"),fa(Bt,Fe),Un(Ut,Fe)):Mn(Ut,1,1),Bt.genMipmaps&&(Ut.mipmask=(Ut.width<<1)-1),Yt.mipmask=Ut.mipmask,nt(Yt,Ut),Oe.texture2D(Bt,Ut,it),Yt.internalformat=Ut.internalformat,Lr.width=Ut.width,Lr.height=Ut.height,Ni(Yt),kn(Ut,ai),Wa(Bt,ai),ma(),Ha(Ut),Qt.profile&&(Yt.stats.size=as(Yt.internalformat,Yt.type,Ut.width,Ut.height,Bt.genMipmaps,!1)),Lr.format=oe[Yt.internalformat],Lr.type=le[Yt.type],Lr.mag=ge[Bt.magFilter],Lr.min=_e[Bt.minFilter],Lr.wrapS=Ne[Bt.wrapS],Lr.wrapT=Ne[Bt.wrapT],Lr}function ia(Fe,vt,Bt,Ut){Oe(!!Fe,"must specify image data");var Et=vt|0,gt=Bt|0,Ot=Ut|0,Ke=Or();return nt(Ke,Yt),Ke.width=0,Ke.height=0,kt(Ke,Fe),Ke.width=Ke.width||(Yt.width>>Ot)-Et,Ke.height=Ke.height||(Yt.height>>Ot)-gt,Oe(Yt.type===Ke.type&&Yt.format===Ke.format&&Yt.internalformat===Ke.internalformat,"incompatible format for texture.subimage"),Oe(Et>=0&>>=0&&Et+Ke.width<=Yt.width&>+Ke.height<=Yt.height,"texture.subimage write out of bounds"),Oe(Yt.mipmask&1<>Et;++Et){var gt=Bt>>Et,Ot=Ut>>Et;if(!gt||!Ot)break;he.texImage2D(ai,Et,Yt.format,gt,Ot,0,Yt.format,Yt.type,null)}return ma(),Qt.profile&&(Yt.stats.size=as(Yt.internalformat,Yt.type,Bt,Ut,!1,!1)),Lr}return Lr(rt,$t),Lr.subimage=ia,Lr.resize=Ze,Lr._reglType="texture2d",Lr._texture=Yt,Qt.profile&&(Lr.stats=Yt.stats),Lr.destroy=function(){Yt.decRef()},Lr}function ba(rt,$t,Yt,Lr,ia,Ze){var Fe=new Jn(Ps);pi[Fe.id]=Fe,Xt.cubeCount++;var vt=new Array(6);function Bt(gt,Ot,Ke,ct,Ye,At){var Wt,sr=Fe.texInfo;for(Aa.call(sr),Wt=0;Wt<6;++Wt)vt[Wt]=Bn();if(typeof gt=="number"||!gt){var fr=gt|0||1;for(Wt=0;Wt<6;++Wt)Mn(vt[Wt],fr,fr)}else if(typeof gt=="object")if(Ot)Un(vt[0],gt),Un(vt[1],Ot),Un(vt[2],Ke),Un(vt[3],ct),Un(vt[4],Ye),Un(vt[5],At);else if(fa(sr,gt),_t(Fe,gt),"faces"in gt){var rr=gt.faces;for(Oe(Array.isArray(rr)&&rr.length===6,"cube faces must be a length 6 array"),Wt=0;Wt<6;++Wt)Oe(typeof rr[Wt]=="object"&&!!rr[Wt],"invalid input for cube map face"),nt(vt[Wt],Fe),Un(vt[Wt],rr[Wt])}else for(Wt=0;Wt<6;++Wt)Un(vt[Wt],gt);else Oe.raise("invalid arguments to cube map");for(nt(Fe,vt[0]),it.npotTextureCube||Oe(dn(Fe.width)&&dn(Fe.height),"your browser does not support non power or two texture dimensions"),sr.genMipmaps?Fe.mipmask=(vt[0].width<<1)-1:Fe.mipmask=vt[0].mipmask,Oe.textureCube(Fe,sr,vt,it),Fe.internalformat=vt[0].internalformat,Bt.width=vt[0].width,Bt.height=vt[0].height,Ni(Fe),Wt=0;Wt<6;++Wt)kn(vt[Wt],$o+Wt);for(Wa(sr,Ps),ma(),Qt.profile&&(Fe.stats.size=as(Fe.internalformat,Fe.type,Bt.width,Bt.height,sr.genMipmaps,!0)),Bt.format=oe[Fe.internalformat],Bt.type=le[Fe.type],Bt.mag=ge[sr.magFilter],Bt.min=_e[sr.minFilter],Bt.wrapS=Ne[sr.wrapS],Bt.wrapT=Ne[sr.wrapT],Wt=0;Wt<6;++Wt)Ha(vt[Wt]);return Bt}function Ut(gt,Ot,Ke,ct,Ye){Oe(!!Ot,"must specify image data"),Oe(typeof gt=="number"&>===(gt|0)&>>=0&><6,"invalid face");var At=Ke|0,Wt=ct|0,sr=Ye|0,fr=Or();return nt(fr,Fe),fr.width=0,fr.height=0,kt(fr,Ot),fr.width=fr.width||(Fe.width>>sr)-At,fr.height=fr.height||(Fe.height>>sr)-Wt,Oe(Fe.type===fr.type&&Fe.format===fr.format&&Fe.internalformat===fr.internalformat,"incompatible format for texture.subimage"),Oe(At>=0&&Wt>=0&&At+fr.width<=Fe.width&&Wt+fr.height<=Fe.height,"texture.subimage write out of bounds"),Oe(Fe.mipmask&1<>ct;++ct)he.texImage2D($o+Ke,ct,Fe.format,Ot>>ct,Ot>>ct,0,Fe.format,Fe.type,null);return ma(),Qt.profile&&(Fe.stats.size=as(Fe.internalformat,Fe.type,Bt.width,Bt.height,!1,!0)),Bt}}return Bt(rt,$t,Yt,Lr,ia,Ze),Bt.subimage=Ut,Bt.resize=Et,Bt._reglType="textureCube",Bt._texture=Fe,Qt.profile&&(Bt.stats=Fe.stats),Bt.destroy=function(){Fe.decRef()},Bt}function fi(){for(var rt=0;rt>Lr,Yt.height>>Lr,0,Yt.internalformat,Yt.type,null);else for(var ia=0;ia<6;++ia)he.texImage2D($o+ia,Lr,Yt.internalformat,Yt.width>>Lr,Yt.height>>Lr,0,Yt.internalformat,Yt.type,null);Wa(Yt.texInfo,Yt.target)})}function lf(){for(var rt=0;rt=2,"invalid renderbuffer shape"),_e=nt[0]|0,Ne=nt[1]|0}else"radius"in Be&&(_e=Ne=Be.radius|0),"width"in Be&&(_e=Be.width|0),"height"in Be&&(Ne=Be.height|0);"format"in Be&&(Oe.parameter(Be.format,Xt,"invalid renderbuffer format"),ze=Xt[Be.format])}else typeof le=="number"?(_e=le|0,typeof ge=="number"?Ne=ge|0:Ne=_e):le?Oe.raise("invalid arguments to renderbuffer constructor"):_e=Ne=1;if(Oe(_e>0&&Ne>0&&_e<=it.maxRenderbufferSize&&Ne<=it.maxRenderbufferSize,"invalid renderbuffer size"),!(_e===V.width&&Ne===V.height&&ze===V.format))return re.width=V.width=_e,re.height=V.height=Ne,V.format=ze,he.bindRenderbuffer(Qr,V.renderbuffer),he.renderbufferStorage(Qr,ze,_e,Ne),Oe(he.getError()===0,"invalid render buffer format"),or.profile&&(V.stats.size=q(V.format,V.width,V.height)),re.format=Qt[V.format],re}function oe(le,ge){var _e=le|0,Ne=ge|0||_e;return _e===V.width&&Ne===V.height||(Oe(_e>0&&Ne>0&&_e<=it.maxRenderbufferSize&&Ne<=it.maxRenderbufferSize,"invalid renderbuffer size"),re.width=V.width=_e,re.height=V.height=Ne,he.bindRenderbuffer(Qr,V.renderbuffer),he.renderbufferStorage(Qr,V.format,_e,Ne),Oe(he.getError()===0,"invalid render buffer format"),or.profile&&(V.stats.size=q(V.format,V.width,V.height))),re}return re(w,B),re.resize=oe,re._reglType="renderbuffer",re._renderbuffer=V,or.profile&&(re.stats=V.stats),re.destroy=function(){V.decRef()},re}or.profile&&(Zt.getTotalRenderbufferSize=function(){var w=0;return Object.keys(Er).forEach(function(B){w+=Er[B].stats.size}),w});function f(){ya(Er).forEach(function(w){w.renderbuffer=he.createRenderbuffer(),he.bindRenderbuffer(Qr,w.renderbuffer),he.renderbufferStorage(Qr,w.format,w.width,w.height)}),he.bindRenderbuffer(Qr,null)}return{create:Br,clear:function(){ya(Er).forEach(_r)},restore:f}},Ee=36160,Pe=36161,je=3553,bt=34069,St=36064,jt=36096,vr=36128,xr=33306,$r=36053,an=36054,tn=36055,Gn=36057,$n=36061,Dn=36193,Nn=5121,zn=5126,pn=6407,Yn=6408,Xn=6402,bn=[pn,Yn],Qn=[];Qn[Yn]=4,Qn[pn]=3;var ga=[];ga[Nn]=1,ga[zn]=4,ga[Dn]=2;var Da=32854,Ma=32855,ha=36194,Pa=33189,Qa=36168,Ya=34041,zo=35907,Qu=34836,To=34842,$s=34843,Qi=[Da,Ma,ha,zo,To,$s,Qu],Io={};Io[$r]="complete",Io[an]="incomplete attachment",Io[Gn]="incomplete dimensions",Io[tn]="incomplete, missing attachment",Io[$n]="unsupported";function wu(he,We,it,Zt,or,Xt){var Qt={cur:null,next:null,dirty:!1,setFBO:null},gr=["rgba"],Er=["rgba4","rgb565","rgb5 a1"];We.ext_srgb&&Er.push("srgba"),We.ext_color_buffer_half_float&&Er.push("rgba16f","rgb16f"),We.webgl_color_buffer_float&&Er.push("rgba32f");var wr=["uint8"];We.oes_texture_half_float&&wr.push("half float","float16"),We.oes_texture_float&&wr.push("float","float32");function _r(Pt,kt,Dt){this.target=Pt,this.texture=kt,this.renderbuffer=Dt;var pr=0,Xr=0;kt?(pr=kt.width,Xr=kt.height):Dt&&(pr=Dt.width,Xr=Dt.height),this.width=pr,this.height=Xr}function Br(Pt){Pt&&(Pt.texture&&Pt.texture._texture.decRef(),Pt.renderbuffer&&Pt.renderbuffer._renderbuffer.decRef())}function f(Pt,kt,Dt){if(Pt)if(Pt.texture){var pr=Pt.texture._texture,Xr=Math.max(1,pr.width),Or=Math.max(1,pr.height);Oe(Xr===kt&&Or===Dt,"inconsistent width/height for supplied texture"),pr.refCount+=1}else{var fn=Pt.renderbuffer._renderbuffer;Oe(fn.width===kt&&fn.height===Dt,"inconsistent width/height for renderbuffer"),fn.refCount+=1}}function w(Pt,kt){kt&&(kt.texture?he.framebufferTexture2D(Ee,Pt,kt.target,kt.texture._texture.texture,0):he.framebufferRenderbuffer(Ee,Pt,Pe,kt.renderbuffer._renderbuffer.renderbuffer))}function B(Pt){var kt=je,Dt=null,pr=null,Xr=Pt;typeof Pt=="object"&&(Xr=Pt.data,"target"in Pt&&(kt=Pt.target|0)),Oe.type(Xr,"function","invalid attachment data");var Or=Xr._reglType;return Or==="texture2d"?(Dt=Xr,Oe(kt===je)):Or==="textureCube"?(Dt=Xr,Oe(kt>=bt&&kt=2,"invalid shape for framebuffer"),Mn=Ni[0],Un=Ni[1]}else"radius"in Jn&&(Mn=Un=Jn.radius),"width"in Jn&&(Mn=Jn.width),"height"in Jn&&(Un=Jn.height);("color"in Jn||"colors"in Jn)&&(Bn=Jn.color||Jn.colors,Array.isArray(Bn)&&Oe(Bn.length===1||We.webgl_draw_buffers,"multiple render targets not supported")),Bn||("colorCount"in Jn&&(Wa=Jn.colorCount|0,Oe(Wa>0,"invalid color buffer count")),"colorTexture"in Jn&&(Ha=!!Jn.colorTexture,Aa="rgba4"),"colorType"in Jn&&(fa=Jn.colorType,Ha?(Oe(We.oes_texture_float||!(fa==="float"||fa==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects"),Oe(We.oes_texture_half_float||!(fa==="half float"||fa==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):fa==="half float"||fa==="float16"?(Oe(We.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),Aa="rgba16f"):(fa==="float"||fa==="float32")&&(Oe(We.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),Aa="rgba32f"),Oe.oneOf(fa,wr,"invalid color type")),"colorFormat"in Jn&&(Aa=Jn.colorFormat,gr.indexOf(Aa)>=0?Ha=!0:Er.indexOf(Aa)>=0?Ha=!1:Ha?Oe.oneOf(Jn.colorFormat,gr,"invalid color format for texture"):Oe.oneOf(Jn.colorFormat,Er,"invalid color format for renderbuffer"))),("depthTexture"in Jn||"depthStencilTexture"in Jn)&&(ui=!!(Jn.depthTexture||Jn.depthStencilTexture),Oe(!ui||We.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in Jn&&(typeof Jn.depth=="boolean"?kn=Jn.depth:(Za=Jn.depth,Na=!1)),"stencil"in Jn&&(typeof Jn.stencil=="boolean"?Na=Jn.stencil:(pi=Jn.stencil,kn=!1)),"depthStencil"in Jn&&(typeof Jn.depthStencil=="boolean"?kn=Na=Jn.depthStencil:(Di=Jn.depthStencil,kn=!1,Na=!1))}var ma=null,An=null,ca=null,ba=null;if(Array.isArray(Bn))ma=Bn.map(B);else if(Bn)ma=[B(Bn)];else for(ma=new Array(Wa),cn=0;cn=0||ma[cn].renderbuffer&&Qi.indexOf(ma[cn].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+cn+" is invalid"),ma[cn]&&ma[cn].texture){var fo=Qn[ma[cn].texture._texture.format]*ga[ma[cn].texture._texture.type];fi===null?fi=fo:Oe(fi===fo,"all color attachments much have the same number of bits per pixel.")}return f(An,Mn,Un),Oe(!An||An.texture&&An.texture._texture.format===Xn||An.renderbuffer&&An.renderbuffer._renderbuffer.format===Pa,"invalid depth attachment for framebuffer object"),f(ca,Mn,Un),Oe(!ca||ca.renderbuffer&&ca.renderbuffer._renderbuffer.format===Qa,"invalid stencil attachment for framebuffer object"),f(ba,Mn,Un),Oe(!ba||ba.texture&&ba.texture._texture.format===Ya||ba.renderbuffer&&ba.renderbuffer._renderbuffer.format===Ya,"invalid depth-stencil attachment for framebuffer object"),Ne(Dt),Dt.width=Mn,Dt.height=Un,Dt.colorAttachments=ma,Dt.depthAttachment=An,Dt.stencilAttachment=ca,Dt.depthStencilAttachment=ba,pr.color=ma.map(re),pr.depth=re(An),pr.stencil=re(ca),pr.depthStencil=re(ba),pr.width=Dt.width,pr.height=Dt.height,Be(Dt),pr}function Xr(Or,fn){Oe(Qt.next!==Dt,"can not resize a framebuffer which is currently in use");var cn=Math.max(Or|0,1),Mn=Math.max(fn|0||cn,1);if(cn===Dt.width&&Mn===Dt.height)return pr;for(var Un=Dt.colorAttachments,kn=0;kn=2,"invalid shape for framebuffer"),Oe(Ha[0]===Ha[1],"cube framebuffer must be square"),cn=Ha[0]}else"radius"in Bn&&(cn=Bn.radius|0),"width"in Bn?(cn=Bn.width|0,"height"in Bn&&Oe(Bn.height===cn,"must be square")):"height"in Bn&&(cn=Bn.height|0);("color"in Bn||"colors"in Bn)&&(Mn=Bn.color||Bn.colors,Array.isArray(Mn)&&Oe(Mn.length===1||We.webgl_draw_buffers,"multiple render targets not supported")),Mn||("colorCount"in Bn&&(Na=Bn.colorCount|0,Oe(Na>0,"invalid color buffer count")),"colorType"in Bn&&(Oe.oneOf(Bn.colorType,wr,"invalid color type"),kn=Bn.colorType),"colorFormat"in Bn&&(Un=Bn.colorFormat,Oe.oneOf(Bn.colorFormat,gr,"invalid color format for texture"))),"depth"in Bn&&(fn.depth=Bn.depth),"stencil"in Bn&&(fn.stencil=Bn.stencil),"depthStencil"in Bn&&(fn.depthStencil=Bn.depthStencil)}var Aa;if(Mn)if(Array.isArray(Mn))for(Aa=[],Or=0;Or0&&(fn.depth=kt[0].depth,fn.stencil=kt[0].stencil,fn.depthStencil=kt[0].depthStencil),kt[Or]?kt[Or](fn):kt[Or]=nt(fn)}return F(Dt,{width:cn,height:cn,color:Aa})}function pr(Xr){var Or,fn=Xr|0;if(Oe(fn>0&&fn<=it.maxCubeMapSize,"invalid radius for cube fbo"),fn===Dt.width)return Dt;var cn=Dt.color;for(Or=0;Or0,"must specify at least one attribute");var _t={},tr=ze.attributes;tr.length=nt.length;for(var Pt=0;Pt=pr.byteLength?Xr.subdata(pr):(Xr.destroy(),ze.buffers[Pt]=null)),ze.buffers[Pt]||(Xr=ze.buffers[Pt]=or.create(kt,Qs,!1,!0)),Dt.buffer=or.getBuffer(Xr),Dt.size=Dt.buffer.dimension|0,Dt.normalized=!1,Dt.type=Dt.buffer.dtype,Dt.offset=0,Dt.stride=0,Dt.divisor=0,Dt.state=1,_t[Pt]=1}else or.getBuffer(kt)?(Dt.buffer=or.getBuffer(kt),Dt.size=Dt.buffer.dimension|0,Dt.normalized=!1,Dt.type=Dt.buffer.dtype,Dt.offset=0,Dt.stride=0,Dt.divisor=0,Dt.state=1):or.getBuffer(kt.buffer)?(Dt.buffer=or.getBuffer(kt.buffer),Dt.size=(+kt.size||Dt.buffer.dimension)|0,Dt.normalized=!!kt.normalized||!1,"type"in kt?(Oe.parameter(kt.type,to,"invalid buffer type"),Dt.type=to[kt.type]):Dt.type=Dt.buffer.dtype,Dt.offset=(kt.offset||0)|0,Dt.stride=(kt.stride||0)|0,Dt.divisor=(kt.divisor||0)|0,Dt.state=1,Oe(Dt.size>=1&&Dt.size<=4,"size must be between 1 and 4"),Oe(Dt.offset>=0,"invalid offset"),Oe(Dt.stride>=0&&Dt.stride<=255,"stride must be between 0 and 255"),Oe(Dt.divisor>=0,"divisor must be positive"),Oe(!Dt.divisor||!!We.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")):"x"in kt?(Oe(Pt>0,"first attribute must not be a constant"),Dt.x=+kt.x||0,Dt.y=+kt.y||0,Dt.z=+kt.z||0,Dt.w=+kt.w||0,Dt.state=2):Oe(!1,"invalid attribute spec for location "+Pt)}for(var Or=0;Or1)for(var tr=0;trV&&(V=re.stats.uniformsCount)}),V},it.getMaxAttributesCount=function(){var V=0;return _r.forEach(function(re){re.stats.attributesCount>V&&(V=re.stats.attributesCount)}),V});function B(){or={},Xt={};for(var V=0;V<_r.length;++V)w(_r[V],null,_r[V].attributes.map(function(re){return[re.location,re.name]}))}return{clear:function(){var V=he.deleteShader.bind(he);ya(or).forEach(V),or={},ya(Xt).forEach(V),Xt={},_r.forEach(function(re){he.deleteProgram(re.program)}),_r.length=0,wr={},it.shaderCount=0},program:function(V,re,oe,le){Oe.command(V>=0,"missing vertex shader",oe),Oe.command(re>=0,"missing fragment shader",oe);var ge=wr[re];ge||(ge=wr[re]={});var _e=ge[V];if(_e&&(_e.refCount++,!le))return _e;var Ne=new f(re,V);return it.shaderCount++,w(Ne,oe,le),_e||(ge[V]=Ne),_r.push(Ne),F(Ne,{destroy:function(){if(Ne.refCount--,Ne.refCount<=0){he.deleteProgram(Ne.program);var ze=_r.indexOf(Ne);_r.splice(ze,1),it.shaderCount--}ge[Ne.vertId].refCount<=0&&(he.deleteShader(Xt[Ne.vertId]),delete Xt[Ne.vertId],delete wr[Ne.fragId][Ne.vertId]),Object.keys(wr[Ne.fragId]).length||(he.deleteShader(or[Ne.fragId]),delete or[Ne.fragId],delete wr[Ne.fragId])}})},restore:B,shader:Er,frag:-1,vert:-1}}var Uo=6408,_s=5121,Zr=3333,uc=5126;function al(he,We,it,Zt,or,Xt,Qt){function gr(_r){var Br;We.next===null?(Oe(or.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),Br=_s):(Oe(We.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer"),Br=We.next.colorAttachments[0].texture._texture.type,Xt.oes_texture_float?(Oe(Br===_s||Br===uc,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"),Br===uc&&Oe(Qt.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")):Oe(Br===_s,"Reading from a framebuffer is only allowed for the type 'uint8'"));var f=0,w=0,B=Zt.framebufferWidth,V=Zt.framebufferHeight,re=null;N(_r)?re=_r:_r&&(Oe.type(_r,"object","invalid arguments to regl.read()"),f=_r.x|0,w=_r.y|0,Oe(f>=0&&f=0&&w0&&B+f<=Zt.framebufferWidth,"invalid width for read pixels"),Oe(V>0&&V+w<=Zt.framebufferHeight,"invalid height for read pixels"),it();var oe=B*V*4;return re||(Br===_s?re=new Uint8Array(oe):Br===uc&&(re=re||new Float32Array(oe))),Oe.isTypedArray(re,"data buffer for regl.read() must be a typedarray"),Oe(re.byteLength>=oe,"data buffer for regl.read() too small"),he.pixelStorei(Zr,4),he.readPixels(f,w,B,V,Uo,Br,re),re}function Er(_r){var Br;return We.setFBO({framebuffer:_r.framebuffer},function(){Br=gr(_r)}),Br}function wr(_r){return!_r||!("framebuffer"in _r)?gr(_r):Er(_r)}return wr}function Ji(he){return Array.prototype.slice.call(he)}function Wo(he){return Ji(he).join("")}function ka(){var he=0,We=[],it=[];function Zt(Br){for(var f=0;f0&&(Br.push(V,"="),Br.push.apply(Br,Ji(arguments)),Br.push(";")),V}return F(f,{def:B,toString:function(){return Wo([w.length>0?"var "+w.join(",")+";":"",Wo(Br)])}})}function Xt(){var Br=or(),f=or(),w=Br.toString,B=f.toString;function V(re,oe){f(re,oe,"=",Br.def(re,oe),";")}return F(function(){Br.apply(Br,Ji(arguments))},{def:Br.def,entry:Br,exit:f,save:V,set:function(re,oe,le){V(re,oe),Br(re,oe,"=",le,";")},toString:function(){return w()+B()}})}function Qt(){var Br=Wo(arguments),f=Xt(),w=Xt(),B=f.toString,V=w.toString;return F(f,{then:function(){return f.apply(f,Ji(arguments)),this},else:function(){return w.apply(w,Ji(arguments)),this},toString:function(){var re=V();return re&&(re="else{"+re+"}"),Wo(["if(",Br,"){",B(),"}",re])}})}var gr=or(),Er={};function wr(Br,f){var w=[];function B(){var ge="a"+w.length;return w.push(ge),ge}f=f||0;for(var V=0;V":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Ts={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Zf={frag:_c,vert:cl},Kf={cw:Vf,ccw:Yf};function $f(he){return Array.isArray(he)||N(he)||Fn(he)}function Kc(he){return he.sort(function(We,it){return We===Xo?-1:it===Xo?1:We=1,Zt>=2,We)}else if(it===ef){var or=he.data;return new Yi(or.thisDep,or.contextDep,or.propDep,We)}else{if(it===dc)return new Yi(!1,!1,!1,We);if(it===kc){for(var Xt=!1,Qt=!1,gr=!1,Er=0;Er=1&&(Qt=!0),_r>=2&&(gr=!0)}else wr.type===ef&&(Xt=Xt||wr.data.thisDep,Qt=Qt||wr.data.contextDep,gr=gr||wr.data.propDep)}return new Yi(Xt,Qt,gr,We)}else return new Yi(it===lc,it===cc,it===fc,We)}}var Qf=new Yi(!1,!1,!1,function(){});function pl(he,We,it,Zt,or,Xt,Qt,gr,Er,wr,_r,Br,f,w,B){var V=wr.Record,re={add:32774,subtract:32778,"reverse subtract":32779};it.ext_blend_minmax&&(re.min=hl,re.max=aa);var oe=it.angle_instanced_arrays,le=it.webgl_draw_buffers,ge={dirty:!0,profile:B.profile},_e={},Ne=[],ze={},Be={};function nt(Ze){return Ze.replace(".","_")}function _t(Ze,Fe,vt){var Bt=nt(Ze);Ne.push(Ze),_e[Bt]=ge[Bt]=!!vt,ze[Bt]=Fe}function tr(Ze,Fe,vt){var Bt=nt(Ze);Ne.push(Ze),Array.isArray(vt)?(ge[Bt]=vt.slice(),_e[Bt]=vt.slice()):ge[Bt]=_e[Bt]=vt,Be[Bt]=Fe}_t(hc,Wc),_t(vc,Uc),tr(gc,"blendColor",[0,0,0,0]),tr(Cu,"blendEquationSeparate",[Yc,Yc]),tr(tf,"blendFuncSeparate",[Ic,Vc,Ic,Vc]),_t(Ci,Xc,!0),tr(Df,"depthFunc",gl),tr(il,"depthRange",[0,1]),tr(Nf,"depthMask",!0),tr(Rc,Rc,[!0,!0,!0,!0]),_t(ht,ll),tr(ol,"cullFace",au),tr(rf,rf,Yf),tr(pc,pc,1),_t(sl,ru),tr(Bc,"polygonOffset",[0,0]),_t(ul,Gf),_t(fl,zf),tr(Pf,"sampleCoverage",[1,!1]),_t(yc,dl),tr(oi,"stencilMask",-1),tr(kf,"stencilFunc",[vl,0,-1]),tr(gi,"stencilOpSeparate",[cf,si,si,si]),tr(Ms,"stencilOpSeparate",[au,si,si,si]),_t(mc,jc),tr(nf,"scissor",[0,0,he.drawingBufferWidth,he.drawingBufferHeight]),tr(Xo,Xo,[0,0,he.drawingBufferWidth,he.drawingBufferHeight]);var Pt={gl:he,context:f,strings:We,next:_e,current:ge,draw:Br,elements:Xt,buffer:or,shader:_r,attributes:wr.state,vao:wr,uniforms:Er,framebuffer:gr,extensions:it,timer:w,isBufferArgs:$f},kt={primTypes:di,compareFuncs:Nu,blendFuncs:Ti,blendEquations:re,stencilOps:Ts,glTypes:to,orientationType:Kf};Oe.optional(function(){Pt.isArrayLike=_n}),le&&(kt.backBuffer=[au],kt.drawBuffer=un(Zt.maxDrawbuffers,function(Ze){return Ze===0?[0]:un(Ze,function(Fe){return Hf+Fe})}));var Dt=0;function pr(){var Ze=ka(),Fe=Ze.link,vt=Ze.global;Ze.id=Dt++,Ze.batchId="0";var Bt=Fe(Pt),Ut=Ze.shared={props:"a0"};Object.keys(Pt).forEach(function(ct){Ut[ct]=vt.def(Bt,".",ct)}),Oe.optional(function(){Ze.CHECK=Fe(Oe),Ze.commandStr=Oe.guessCommand(),Ze.command=Fe(Ze.commandStr),Ze.assert=function(ct,Ye,At){ct("if(!(",Ye,"))",this.CHECK,".commandRaise(",Fe(At),",",this.command,");")},kt.invalidBlendCombinations=Zc});var Et=Ze.next={},gt=Ze.current={};Object.keys(Be).forEach(function(ct){Array.isArray(ge[ct])&&(Et[ct]=vt.def(Ut.next,".",ct),gt[ct]=vt.def(Ut.current,".",ct))});var Ot=Ze.constants={};Object.keys(kt).forEach(function(ct){Ot[ct]=vt.def(JSON.stringify(kt[ct]))}),Ze.invoke=function(ct,Ye){switch(Ye.type){case Lf:var At=["this",Ut.context,Ut.props,Ze.batchId];return ct.def(Fe(Ye.data),".call(",At.slice(0,Math.max(Ye.data.length+1,4)),")");case fc:return ct.def(Ut.props,Ye.data);case cc:return ct.def(Ut.context,Ye.data);case lc:return ct.def("this",Ye.data);case ef:return Ye.data.append(Ze,ct),Ye.data.ref;case dc:return Ye.data.toString();case kc:return Ye.data.map(function(Wt){return Ze.invoke(ct,Wt)})}},Ze.attribCache={};var Ke={};return Ze.scopeAttrib=function(ct){var Ye=We.id(ct);if(Ye in Ke)return Ke[Ye];var At=wr.scope[Ye];At||(At=wr.scope[Ye]=new V);var Wt=Ke[Ye]=Fe(At);return Wt},Ze}function Xr(Ze){var Fe=Ze.static,vt=Ze.dynamic,Bt;if(Js in Fe){var Ut=!!Fe[Js];Bt=Ja(function(gt,Ot){return Ut}),Bt.enable=Ut}else if(Js in vt){var Et=vt[Js];Bt=Li(Et,function(gt,Ot){return gt.invoke(Ot,Et)})}return Bt}function Or(Ze,Fe){var vt=Ze.static,Bt=Ze.dynamic;if(ta in vt){var Ut=vt[ta];return Ut?(Ut=gr.getFramebuffer(Ut),Oe.command(Ut,"invalid framebuffer object"),Ja(function(gt,Ot){var Ke=gt.link(Ut),ct=gt.shared;Ot.set(ct.framebuffer,".next",Ke);var Ye=ct.context;return Ot.set(Ye,"."+ss,Ke+".width"),Ot.set(Ye,"."+uo,Ke+".height"),Ke})):Ja(function(gt,Ot){var Ke=gt.shared;Ot.set(Ke.framebuffer,".next","null");var ct=Ke.context;return Ot.set(ct,"."+ss,ct+"."+xc),Ot.set(ct,"."+uo,ct+"."+wc),"null"})}else if(ta in Bt){var Et=Bt[ta];return Li(Et,function(gt,Ot){var Ke=gt.invoke(Ot,Et),ct=gt.shared,Ye=ct.framebuffer,At=Ot.def(Ye,".getFramebuffer(",Ke,")");Oe.optional(function(){gt.assert(Ot,"!"+Ke+"||"+At,"invalid framebuffer object")}),Ot.set(Ye,".next",At);var Wt=ct.context;return Ot.set(Wt,"."+ss,At+"?"+At+".width:"+Wt+"."+xc),Ot.set(Wt,"."+uo,At+"?"+At+".height:"+Wt+"."+wc),At})}else return null}function fn(Ze,Fe,vt){var Bt=Ze.static,Ut=Ze.dynamic;function Et(Ke){if(Ke in Bt){var ct=Bt[Ke];Oe.commandType(ct,"object","invalid "+Ke,vt.commandStr);var Ye=!0,At=ct.x|0,Wt=ct.y|0,sr,fr;return"width"in ct?(sr=ct.width|0,Oe.command(sr>=0,"invalid "+Ke,vt.commandStr)):Ye=!1,"height"in ct?(fr=ct.height|0,Oe.command(fr>=0,"invalid "+Ke,vt.commandStr)):Ye=!1,new Yi(!Ye&&Fe&&Fe.thisDep,!Ye&&Fe&&Fe.contextDep,!Ye&&Fe&&Fe.propDep,function(En,qn){var ln=En.shared.context,Ln=sr;"width"in ct||(Ln=qn.def(ln,".",ss,"-",At));var Hn=fr;return"height"in ct||(Hn=qn.def(ln,".",uo,"-",Wt)),[At,Wt,Ln,Hn]})}else if(Ke in Ut){var rr=Ut[Ke],Tr=Li(rr,function(En,qn){var ln=En.invoke(qn,rr);Oe.optional(function(){En.assert(qn,ln+"&&typeof "+ln+'==="object"',"invalid "+Ke)});var Ln=En.shared.context,Hn=qn.def(ln,".x|0"),wa=qn.def(ln,".y|0"),Ka=qn.def('"width" in ',ln,"?",ln,".width|0:","(",Ln,".",ss,"-",Hn,")"),co=qn.def('"height" in ',ln,"?",ln,".height|0:","(",Ln,".",uo,"-",wa,")");return Oe.optional(function(){En.assert(qn,Ka+">=0&&"+co+">=0","invalid "+Ke)}),[Hn,wa,Ka,co]});return Fe&&(Tr.thisDep=Tr.thisDep||Fe.thisDep,Tr.contextDep=Tr.contextDep||Fe.contextDep,Tr.propDep=Tr.propDep||Fe.propDep),Tr}else return Fe?new Yi(Fe.thisDep,Fe.contextDep,Fe.propDep,function(En,qn){var ln=En.shared.context;return[0,0,qn.def(ln,".",ss),qn.def(ln,".",uo)]}):null}var gt=Et(Xo);if(gt){var Ot=gt;gt=new Yi(gt.thisDep,gt.contextDep,gt.propDep,function(Ke,ct){var Ye=Ot.append(Ke,ct),At=Ke.shared.context;return ct.set(At,"."+Ec,Ye[2]),ct.set(At,"."+Fc,Ye[3]),Ye})}return{viewport:gt,scissor_box:Et(nf)}}function cn(Ze,Fe){var vt=Ze.static,Bt=typeof vt[Tu]=="string"&&typeof vt[qi]=="string";if(Bt){if(Object.keys(Fe.dynamic).length>0)return null;var Ut=Fe.static,Et=Object.keys(Ut);if(Et.length>0&&typeof Ut[Et[0]]=="number"){for(var gt=[],Ot=0;Ot=0,"invalid "+Ye,Fe.commandStr),Ja(function(fr,rr){return At&&(fr.OFFSET=Wt),Wt})}else if(Ye in Bt){var sr=Bt[Ye];return Li(sr,function(fr,rr){var Tr=fr.invoke(rr,sr);return At&&(fr.OFFSET=Tr,Oe.optional(function(){fr.assert(rr,Tr+">=0","invalid "+Ye)})),Tr})}else if(At&&Et)return Ja(function(fr,rr){return fr.OFFSET="0",0});return null}var Ke=Ot(Rf,!0);function ct(){if(eu in vt){var Ye=vt[eu]|0;return Oe.command(typeof Ye=="number"&&Ye>=0,"invalid vertex count",Fe.commandStr),Ja(function(){return Ye})}else if(eu in Bt){var At=Bt[eu];return Li(At,function(fr,rr){var Tr=fr.invoke(rr,At);return Oe.optional(function(){fr.assert(rr,"typeof "+Tr+'==="number"&&'+Tr+">=0&&"+Tr+"===("+Tr+"|0)","invalid vertex count")}),Tr})}else if(Et)if(Is(Et)){if(Et)return Ke?new Yi(Ke.thisDep,Ke.contextDep,Ke.propDep,function(fr,rr){var Tr=rr.def(fr.ELEMENTS,".vertCount-",fr.OFFSET);return Oe.optional(function(){fr.assert(rr,Tr+">=0","invalid vertex offset/element buffer too small")}),Tr}):Ja(function(fr,rr){return rr.def(fr.ELEMENTS,".vertCount")});var Wt=Ja(function(){return-1});return Oe.optional(function(){Wt.MISSING=!0}),Wt}else{var sr=new Yi(Et.thisDep||Ke.thisDep,Et.contextDep||Ke.contextDep,Et.propDep||Ke.propDep,function(fr,rr){var Tr=fr.ELEMENTS;return fr.OFFSET?rr.def(Tr,"?",Tr,".vertCount-",fr.OFFSET,":-1"):rr.def(Tr,"?",Tr,".vertCount:-1")});return Oe.optional(function(){sr.DYNAMIC=!0}),sr}return null}return{elements:Et,primitive:gt(),count:ct(),instances:Ot(Bf,!1),offset:Ke}}function kn(Ze,Fe){var vt=Ze.static,Bt=Ze.dynamic,Ut={};return Ne.forEach(function(Et){var gt=nt(Et);function Ot(Ke,ct){if(Et in vt){var Ye=Ke(vt[Et]);Ut[gt]=Ja(function(){return Ye})}else if(Et in Bt){var At=Bt[Et];Ut[gt]=Li(At,function(Wt,sr){return ct(Wt,sr,Wt.invoke(sr,At))})}}switch(Et){case ht:case vc:case hc:case yc:case Ci:case mc:case sl:case ul:case fl:case Nf:return Ot(function(Ke){return Oe.commandType(Ke,"boolean",Et,Fe.commandStr),Ke},function(Ke,ct,Ye){return Oe.optional(function(){Ke.assert(ct,"typeof "+Ye+'==="boolean"',"invalid flag "+Et,Ke.commandStr)}),Ye});case Df:return Ot(function(Ke){return Oe.commandParameter(Ke,Nu,"invalid "+Et,Fe.commandStr),Nu[Ke]},function(Ke,ct,Ye){var At=Ke.constants.compareFuncs;return Oe.optional(function(){Ke.assert(ct,Ye+" in "+At,"invalid "+Et+", must be one of "+Object.keys(Nu))}),ct.def(At,"[",Ye,"]")});case il:return Ot(function(Ke){return Oe.command(_n(Ke)&&Ke.length===2&&typeof Ke[0]=="number"&&typeof Ke[1]=="number"&&Ke[0]<=Ke[1],"depth range is 2d array",Fe.commandStr),Ke},function(Ke,ct,Ye){Oe.optional(function(){Ke.assert(ct,Ke.shared.isArrayLike+"("+Ye+")&&"+Ye+".length===2&&typeof "+Ye+'[0]==="number"&&typeof '+Ye+'[1]==="number"&&'+Ye+"[0]<="+Ye+"[1]","depth range must be a 2d array")});var At=ct.def("+",Ye,"[0]"),Wt=ct.def("+",Ye,"[1]");return[At,Wt]});case tf:return Ot(function(Ke){Oe.commandType(Ke,"object","blend.func",Fe.commandStr);var ct="srcRGB"in Ke?Ke.srcRGB:Ke.src,Ye="srcAlpha"in Ke?Ke.srcAlpha:Ke.src,At="dstRGB"in Ke?Ke.dstRGB:Ke.dst,Wt="dstAlpha"in Ke?Ke.dstAlpha:Ke.dst;return Oe.commandParameter(ct,Ti,gt+".srcRGB",Fe.commandStr),Oe.commandParameter(Ye,Ti,gt+".srcAlpha",Fe.commandStr),Oe.commandParameter(At,Ti,gt+".dstRGB",Fe.commandStr),Oe.commandParameter(Wt,Ti,gt+".dstAlpha",Fe.commandStr),Oe.command(Zc.indexOf(ct+", "+At)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+ct+", "+At+")",Fe.commandStr),[Ti[ct],Ti[At],Ti[Ye],Ti[Wt]]},function(Ke,ct,Ye){var At=Ke.constants.blendFuncs;Oe.optional(function(){Ke.assert(ct,Ye+"&&typeof "+Ye+'==="object"',"invalid blend func, must be an object")});function Wt(ln,Ln){var Hn=ct.def('"',ln,Ln,'" in ',Ye,"?",Ye,".",ln,Ln,":",Ye,".",ln);return Oe.optional(function(){Ke.assert(ct,Hn+" in "+At,"invalid "+Et+"."+ln+Ln+", must be one of "+Object.keys(Ti))}),Hn}var sr=Wt("src","RGB"),fr=Wt("dst","RGB");Oe.optional(function(){var ln=Ke.constants.invalidBlendCombinations;Ke.assert(ct,ln+".indexOf("+sr+'+", "+'+fr+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var rr=ct.def(At,"[",sr,"]"),Tr=ct.def(At,"[",Wt("src","Alpha"),"]"),En=ct.def(At,"[",fr,"]"),qn=ct.def(At,"[",Wt("dst","Alpha"),"]");return[rr,En,Tr,qn]});case Cu:return Ot(function(Ke){if(typeof Ke=="string")return Oe.commandParameter(Ke,re,"invalid "+Et,Fe.commandStr),[re[Ke],re[Ke]];if(typeof Ke=="object")return Oe.commandParameter(Ke.rgb,re,Et+".rgb",Fe.commandStr),Oe.commandParameter(Ke.alpha,re,Et+".alpha",Fe.commandStr),[re[Ke.rgb],re[Ke.alpha]];Oe.commandRaise("invalid blend.equation",Fe.commandStr)},function(Ke,ct,Ye){var At=Ke.constants.blendEquations,Wt=ct.def(),sr=ct.def(),fr=Ke.cond("typeof ",Ye,'==="string"');return Oe.optional(function(){function rr(Tr,En,qn){Ke.assert(Tr,qn+" in "+At,"invalid "+En+", must be one of "+Object.keys(re))}rr(fr.then,Et,Ye),Ke.assert(fr.else,Ye+"&&typeof "+Ye+'==="object"',"invalid "+Et),rr(fr.else,Et+".rgb",Ye+".rgb"),rr(fr.else,Et+".alpha",Ye+".alpha")}),fr.then(Wt,"=",sr,"=",At,"[",Ye,"];"),fr.else(Wt,"=",At,"[",Ye,".rgb];",sr,"=",At,"[",Ye,".alpha];"),ct(fr),[Wt,sr]});case gc:return Ot(function(Ke){return Oe.command(_n(Ke)&&Ke.length===4,"blend.color must be a 4d array",Fe.commandStr),un(4,function(ct){return+Ke[ct]})},function(Ke,ct,Ye){return Oe.optional(function(){Ke.assert(ct,Ke.shared.isArrayLike+"("+Ye+")&&"+Ye+".length===4","blend.color must be a 4d array")}),un(4,function(At){return ct.def("+",Ye,"[",At,"]")})});case oi:return Ot(function(Ke){return Oe.commandType(Ke,"number",gt,Fe.commandStr),Ke|0},function(Ke,ct,Ye){return Oe.optional(function(){Ke.assert(ct,"typeof "+Ye+'==="number"',"invalid stencil.mask")}),ct.def(Ye,"|0")});case kf:return Ot(function(Ke){Oe.commandType(Ke,"object",gt,Fe.commandStr);var ct=Ke.cmp||"keep",Ye=Ke.ref||0,At="mask"in Ke?Ke.mask:-1;return Oe.commandParameter(ct,Nu,Et+".cmp",Fe.commandStr),Oe.commandType(Ye,"number",Et+".ref",Fe.commandStr),Oe.commandType(At,"number",Et+".mask",Fe.commandStr),[Nu[ct],Ye,At]},function(Ke,ct,Ye){var At=Ke.constants.compareFuncs;Oe.optional(function(){function rr(){Ke.assert(ct,Array.prototype.join.call(arguments,""),"invalid stencil.func")}rr(Ye+"&&typeof ",Ye,'==="object"'),rr('!("cmp" in ',Ye,")||(",Ye,".cmp in ",At,")")});var Wt=ct.def('"cmp" in ',Ye,"?",At,"[",Ye,".cmp]",":",si),sr=ct.def(Ye,".ref|0"),fr=ct.def('"mask" in ',Ye,"?",Ye,".mask|0:-1");return[Wt,sr,fr]});case gi:case Ms:return Ot(function(Ke){Oe.commandType(Ke,"object",gt,Fe.commandStr);var ct=Ke.fail||"keep",Ye=Ke.zfail||"keep",At=Ke.zpass||"keep";return Oe.commandParameter(ct,Ts,Et+".fail",Fe.commandStr),Oe.commandParameter(Ye,Ts,Et+".zfail",Fe.commandStr),Oe.commandParameter(At,Ts,Et+".zpass",Fe.commandStr),[Et===Ms?au:cf,Ts[ct],Ts[Ye],Ts[At]]},function(Ke,ct,Ye){var At=Ke.constants.stencilOps;Oe.optional(function(){Ke.assert(ct,Ye+"&&typeof "+Ye+'==="object"',"invalid "+Et)});function Wt(sr){return Oe.optional(function(){Ke.assert(ct,'!("'+sr+'" in '+Ye+")||("+Ye+"."+sr+" in "+At+")","invalid "+Et+"."+sr+", must be one of "+Object.keys(Ts))}),ct.def('"',sr,'" in ',Ye,"?",At,"[",Ye,".",sr,"]:",si)}return[Et===Ms?au:cf,Wt("fail"),Wt("zfail"),Wt("zpass")]});case Bc:return Ot(function(Ke){Oe.commandType(Ke,"object",gt,Fe.commandStr);var ct=Ke.factor|0,Ye=Ke.units|0;return Oe.commandType(ct,"number",gt+".factor",Fe.commandStr),Oe.commandType(Ye,"number",gt+".units",Fe.commandStr),[ct,Ye]},function(Ke,ct,Ye){Oe.optional(function(){Ke.assert(ct,Ye+"&&typeof "+Ye+'==="object"',"invalid "+Et)});var At=ct.def(Ye,".factor|0"),Wt=ct.def(Ye,".units|0");return[At,Wt]});case ol:return Ot(function(Ke){var ct=0;return Ke==="front"?ct=cf:Ke==="back"&&(ct=au),Oe.command(!!ct,gt,Fe.commandStr),ct},function(Ke,ct,Ye){return Oe.optional(function(){Ke.assert(ct,Ye+'==="front"||'+Ye+'==="back"',"invalid cull.face")}),ct.def(Ye,'==="front"?',cf,":",au)});case pc:return Ot(function(Ke){return Oe.command(typeof Ke=="number"&&Ke>=Zt.lineWidthDims[0]&&Ke<=Zt.lineWidthDims[1],"invalid line width, must be a positive number between "+Zt.lineWidthDims[0]+" and "+Zt.lineWidthDims[1],Fe.commandStr),Ke},function(Ke,ct,Ye){return Oe.optional(function(){Ke.assert(ct,"typeof "+Ye+'==="number"&&'+Ye+">="+Zt.lineWidthDims[0]+"&&"+Ye+"<="+Zt.lineWidthDims[1],"invalid line width")}),Ye});case rf:return Ot(function(Ke){return Oe.commandParameter(Ke,Kf,gt,Fe.commandStr),Kf[Ke]},function(Ke,ct,Ye){return Oe.optional(function(){Ke.assert(ct,Ye+'==="cw"||'+Ye+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),ct.def(Ye+'==="cw"?'+Vf+":"+Yf)});case Rc:return Ot(function(Ke){return Oe.command(_n(Ke)&&Ke.length===4,"color.mask must be length 4 array",Fe.commandStr),Ke.map(function(ct){return!!ct})},function(Ke,ct,Ye){return Oe.optional(function(){Ke.assert(ct,Ke.shared.isArrayLike+"("+Ye+")&&"+Ye+".length===4","invalid color.mask")}),un(4,function(At){return"!!"+Ye+"["+At+"]"})});case Pf:return Ot(function(Ke){Oe.command(typeof Ke=="object"&&Ke,gt,Fe.commandStr);var ct="value"in Ke?Ke.value:1,Ye=!!Ke.invert;return Oe.command(typeof ct=="number"&&ct>=0&&ct<=1,"sample.coverage.value must be a number between 0 and 1",Fe.commandStr),[ct,Ye]},function(Ke,ct,Ye){Oe.optional(function(){Ke.assert(ct,Ye+"&&typeof "+Ye+'==="object"',"invalid sample.coverage")});var At=ct.def('"value" in ',Ye,"?+",Ye,".value:1"),Wt=ct.def("!!",Ye,".invert");return[At,Wt]})}}),Ut}function Na(Ze,Fe){var vt=Ze.static,Bt=Ze.dynamic,Ut={};return Object.keys(vt).forEach(function(Et){var gt=vt[Et],Ot;if(typeof gt=="number"||typeof gt=="boolean")Ot=Ja(function(){return gt});else if(typeof gt=="function"){var Ke=gt._reglType;Ke==="texture2d"||Ke==="textureCube"?Ot=Ja(function(ct){return ct.link(gt)}):Ke==="framebuffer"||Ke==="framebufferCube"?(Oe.command(gt.color.length>0,'missing color attachment for framebuffer sent to uniform "'+Et+'"',Fe.commandStr),Ot=Ja(function(ct){return ct.link(gt.color[0])})):Oe.commandRaise('invalid data for uniform "'+Et+'"',Fe.commandStr)}else _n(gt)?Ot=Ja(function(ct){var Ye=ct.global.def("[",un(gt.length,function(At){return Oe.command(typeof gt[At]=="number"||typeof gt[At]=="boolean","invalid uniform "+Et,ct.commandStr),gt[At]}),"]");return Ye}):Oe.commandRaise('invalid or missing data for uniform "'+Et+'"',Fe.commandStr);Ot.value=gt,Ut[Et]=Ot}),Object.keys(Bt).forEach(function(Et){var gt=Bt[Et];Ut[Et]=Li(gt,function(Ot,Ke){return Ot.invoke(Ke,gt)})}),Ut}function Bn(Ze,Fe){var vt=Ze.static,Bt=Ze.dynamic,Ut={};return Object.keys(vt).forEach(function(Et){var gt=vt[Et],Ot=We.id(Et),Ke=new V;if($f(gt))Ke.state=os,Ke.buffer=or.getBuffer(or.create(gt,tu,!1,!0)),Ke.type=0;else{var ct=or.getBuffer(gt);if(ct)Ke.state=os,Ke.buffer=ct,Ke.type=0;else if(Oe.command(typeof gt=="object"&>,"invalid data for attribute "+Et,Fe.commandStr),"constant"in gt){var Ye=gt.constant;Ke.buffer="null",Ke.state=Mu,typeof Ye=="number"?Ke.x=Ye:(Oe.command(_n(Ye)&&Ye.length>0&&Ye.length<=4,"invalid constant for attribute "+Et,Fe.commandStr),Su.forEach(function(En,qn){qn=0,'invalid offset for attribute "'+Et+'"',Fe.commandStr);var Wt=gt.stride|0;Oe.command(Wt>=0&&Wt<256,'invalid stride for attribute "'+Et+'", must be integer betweeen [0, 255]',Fe.commandStr);var sr=gt.size|0;Oe.command(!("size"in gt)||sr>0&&sr<=4,'invalid size for attribute "'+Et+'", must be 1,2,3,4',Fe.commandStr);var fr=!!gt.normalized,rr=0;"type"in gt&&(Oe.commandParameter(gt.type,to,"invalid type for attribute "+Et,Fe.commandStr),rr=to[gt.type]);var Tr=gt.divisor|0;"divisor"in gt&&(Oe.command(Tr===0||oe,'cannot specify divisor for attribute "'+Et+'", instancing not supported',Fe.commandStr),Oe.command(Tr>=0,'invalid divisor for attribute "'+Et+'"',Fe.commandStr)),Oe.optional(function(){var En=Fe.commandStr,qn=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(gt).forEach(function(ln){Oe.command(qn.indexOf(ln)>=0,'unknown parameter "'+ln+'" for attribute pointer "'+Et+'" (valid parameters are '+qn+")",En)})}),Ke.buffer=ct,Ke.state=os,Ke.size=sr,Ke.normalized=fr,Ke.type=rr||ct.dtype,Ke.offset=At,Ke.stride=Wt,Ke.divisor=Tr}}Ut[Et]=Ja(function(En,qn){var ln=En.attribCache;if(Ot in ln)return ln[Ot];var Ln={isStream:!1};return Object.keys(Ke).forEach(function(Hn){Ln[Hn]=Ke[Hn]}),Ke.buffer&&(Ln.buffer=En.link(Ke.buffer),Ln.type=Ln.type||Ln.buffer+".dtype"),ln[Ot]=Ln,Ln})}),Object.keys(Bt).forEach(function(Et){var gt=Bt[Et];function Ot(Ke,ct){var Ye=Ke.invoke(ct,gt),At=Ke.shared,Wt=Ke.constants,sr=At.isBufferArgs,fr=At.buffer;Oe.optional(function(){Ke.assert(ct,Ye+"&&(typeof "+Ye+'==="object"||typeof '+Ye+'==="function")&&('+sr+"("+Ye+")||"+fr+".getBuffer("+Ye+")||"+fr+".getBuffer("+Ye+".buffer)||"+sr+"("+Ye+'.buffer)||("constant" in '+Ye+"&&(typeof "+Ye+'.constant==="number"||'+At.isArrayLike+"("+Ye+".constant))))",'invalid dynamic attribute "'+Et+'"')});var rr={isStream:ct.def(!1)},Tr=new V;Tr.state=os,Object.keys(Tr).forEach(function(Ln){rr[Ln]=ct.def(""+Tr[Ln])});var En=rr.buffer,qn=rr.type;ct("if(",sr,"(",Ye,")){",rr.isStream,"=true;",En,"=",fr,".createStream(",tu,",",Ye,");",qn,"=",En,".dtype;","}else{",En,"=",fr,".getBuffer(",Ye,");","if(",En,"){",qn,"=",En,".dtype;",'}else if("constant" in ',Ye,"){",rr.state,"=",Mu,";","if(typeof "+Ye+'.constant === "number"){',rr[Su[0]],"=",Ye,".constant;",Su.slice(1).map(function(Ln){return rr[Ln]}).join("="),"=0;","}else{",Su.map(function(Ln,Hn){return rr[Ln]+"="+Ye+".constant.length>"+Hn+"?"+Ye+".constant["+Hn+"]:0;"}).join(""),"}}else{","if(",sr,"(",Ye,".buffer)){",En,"=",fr,".createStream(",tu,",",Ye,".buffer);","}else{",En,"=",fr,".getBuffer(",Ye,".buffer);","}",qn,'="type" in ',Ye,"?",Wt.glTypes,"[",Ye,".type]:",En,".dtype;",rr.normalized,"=!!",Ye,".normalized;");function ln(Ln){ct(rr[Ln],"=",Ye,".",Ln,"|0;")}return ln("size"),ln("offset"),ln("stride"),ln("divisor"),ct("}}"),ct.exit("if(",rr.isStream,"){",fr,".destroyStream(",En,");","}"),rr}Ut[Et]=Li(gt,Ot)}),Ut}function Ha(Ze,Fe){var vt=Ze.static,Bt=Ze.dynamic;if(af in vt){var Ut=vt[af];return Ut!==null&&wr.getVAO(Ut)===null&&(Ut=wr.createVAO(Ut)),Ja(function(gt){return gt.link(wr.getVAO(Ut))})}else if(af in Bt){var Et=Bt[af];return Li(Et,function(gt,Ot){var Ke=gt.invoke(Ot,Et);return Ot.def(gt.shared.vao+".getVAO("+Ke+")")})}return null}function Aa(Ze){var Fe=Ze.static,vt=Ze.dynamic,Bt={};return Object.keys(Fe).forEach(function(Ut){var Et=Fe[Ut];Bt[Ut]=Ja(function(gt,Ot){return typeof Et=="number"||typeof Et=="boolean"?""+Et:gt.link(Et)})}),Object.keys(vt).forEach(function(Ut){var Et=vt[Ut];Bt[Ut]=Li(Et,function(gt,Ot){return gt.invoke(Ot,Et)})}),Bt}function fa(Ze,Fe,vt,Bt,Ut){var Et=Ze.static,gt=Ze.dynamic;Oe.optional(function(){var ln=[ta,qi,Tu,qs,jo,Rf,eu,Bf,Js,af].concat(Ne);function Ln(Hn){Object.keys(Hn).forEach(function(wa){Oe.command(ln.indexOf(wa)>=0,'unknown parameter "'+wa+'"',Ut.commandStr)})}Ln(Et),Ln(gt)});var Ot=cn(Ze,Fe),Ke=Or(Ze,Ut),ct=fn(Ze,Ke,Ut),Ye=Un(Ze,Ut),At=kn(Ze,Ut),Wt=Mn(Ze,Ut,Ot);function sr(ln){var Ln=ct[ln];Ln&&(At[ln]=Ln)}sr(Xo),sr(nt(nf));var fr=Object.keys(At).length>0,rr={framebuffer:Ke,draw:Ye,shader:Wt,state:At,dirty:fr,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(rr.profile=Xr(Ze,Ut),rr.uniforms=Na(vt,Ut),rr.drawVAO=rr.scopeVAO=Ha(Ze,Ut),!rr.drawVAO&&Wt.program&&!Ot&&it.angle_instanced_arrays){var Tr=!0,En=Wt.program.attributes.map(function(ln){var Ln=Fe.static[ln];return Tr=Tr&&!!Ln,Ln});if(Tr&&En.length>0){var qn=wr.getVAO(wr.createVAO(En));rr.drawVAO=new Yi(null,null,null,function(ln,Ln){return ln.link(qn)}),rr.useVAO=!0}}return Ot?rr.useVAO=!0:rr.attributes=Bn(Fe,Ut),rr.context=Aa(Bt,Ut),rr}function Wa(Ze,Fe,vt){var Bt=Ze.shared,Ut=Bt.context,Et=Ze.scope();Object.keys(vt).forEach(function(gt){Fe.save(Ut,"."+gt);var Ot=vt[gt],Ke=Ot.append(Ze,Fe);Array.isArray(Ke)?Et(Ut,".",gt,"=[",Ke.join(),"];"):Et(Ut,".",gt,"=",Ke,";")}),Fe(Et)}function Za(Ze,Fe,vt,Bt){var Ut=Ze.shared,Et=Ut.gl,gt=Ut.framebuffer,Ot;le&&(Ot=Fe.def(Ut.extensions,".webgl_draw_buffers"));var Ke=Ze.constants,ct=Ke.drawBuffer,Ye=Ke.backBuffer,At;vt?At=vt.append(Ze,Fe):At=Fe.def(gt,".next"),Bt||Fe("if(",At,"!==",gt,".cur){"),Fe("if(",At,"){",Et,".bindFramebuffer(",Hc,",",At,".framebuffer);"),le&&Fe(Ot,".drawBuffersWEBGL(",ct,"[",At,".colorAttachments.length]);"),Fe("}else{",Et,".bindFramebuffer(",Hc,",null);"),le&&Fe(Ot,".drawBuffersWEBGL(",Ye,");"),Fe("}",gt,".cur=",At,";"),Bt||Fe("}")}function pi(Ze,Fe,vt){var Bt=Ze.shared,Ut=Bt.gl,Et=Ze.current,gt=Ze.next,Ot=Bt.current,Ke=Bt.next,ct=Ze.cond(Ot,".dirty");Ne.forEach(function(Ye){var At=nt(Ye);if(!(At in vt.state)){var Wt,sr;if(At in gt){Wt=gt[At],sr=Et[At];var fr=un(ge[At].length,function(Tr){return ct.def(Wt,"[",Tr,"]")});ct(Ze.cond(fr.map(function(Tr,En){return Tr+"!=="+sr+"["+En+"]"}).join("||")).then(Ut,".",Be[At],"(",fr,");",fr.map(function(Tr,En){return sr+"["+En+"]="+Tr}).join(";"),";"))}else{Wt=ct.def(Ke,".",At);var rr=Ze.cond(Wt,"!==",Ot,".",At);ct(rr),At in ze?rr(Ze.cond(Wt).then(Ut,".enable(",ze[At],");").else(Ut,".disable(",ze[At],");"),Ot,".",At,"=",Wt,";"):rr(Ut,".",Be[At],"(",Wt,");",Ot,".",At,"=",Wt,";")}}}),Object.keys(vt.state).length===0&&ct(Ot,".dirty=false;"),Fe(ct)}function Di(Ze,Fe,vt,Bt){var Ut=Ze.shared,Et=Ze.current,gt=Ut.current,Ot=Ut.gl;Kc(Object.keys(vt)).forEach(function(Ke){var ct=vt[Ke];if(!(Bt&&!Bt(ct))){var Ye=ct.append(Ze,Fe);if(ze[Ke]){var At=ze[Ke];Is(ct)?Ye?Fe(Ot,".enable(",At,");"):Fe(Ot,".disable(",At,");"):Fe(Ze.cond(Ye).then(Ot,".enable(",At,");").else(Ot,".disable(",At,");")),Fe(gt,".",Ke,"=",Ye,";")}else if(_n(Ye)){var Wt=Et[Ke];Fe(Ot,".",Be[Ke],"(",Ye,");",Ye.map(function(sr,fr){return Wt+"["+fr+"]="+sr}).join(";"),";")}else Fe(Ot,".",Be[Ke],"(",Ye,");",gt,".",Ke,"=",Ye,";")}})}function ui(Ze,Fe){oe&&(Ze.instancing=Fe.def(Ze.shared.extensions,".angle_instanced_arrays"))}function Jn(Ze,Fe,vt,Bt,Ut){var Et=Ze.shared,gt=Ze.stats,Ot=Et.current,Ke=Et.timer,ct=vt.profile;function Ye(){return typeof performance=="undefined"?"Date.now()":"performance.now()"}var At,Wt;function sr(ln){At=Fe.def(),ln(At,"=",Ye(),";"),typeof Ut=="string"?ln(gt,".count+=",Ut,";"):ln(gt,".count++;"),w&&(Bt?(Wt=Fe.def(),ln(Wt,"=",Ke,".getNumPendingQueries();")):ln(Ke,".beginQuery(",gt,");"))}function fr(ln){ln(gt,".cpuTime+=",Ye(),"-",At,";"),w&&(Bt?ln(Ke,".pushScopeStats(",Wt,",",Ke,".getNumPendingQueries(),",gt,");"):ln(Ke,".endQuery();"))}function rr(ln){var Ln=Fe.def(Ot,".profile");Fe(Ot,".profile=",ln,";"),Fe.exit(Ot,".profile=",Ln,";")}var Tr;if(ct){if(Is(ct)){ct.enable?(sr(Fe),fr(Fe.exit),rr("true")):rr("false");return}Tr=ct.append(Ze,Fe),rr(Tr)}else Tr=Fe.def(Ot,".profile");var En=Ze.block();sr(En),Fe("if(",Tr,"){",En,"}");var qn=Ze.block();fr(qn),Fe.exit("if(",Tr,"){",qn,"}")}function Ni(Ze,Fe,vt,Bt,Ut){var Et=Ze.shared;function gt(Ke){switch(Ke){case nu:case Xf:case jf:return 2;case Uf:case Au:case sf:return 3;case Wf:case of:case uf:return 4;default:return 1}}function Ot(Ke,ct,Ye){var At=Et.gl,Wt=Fe.def(Ke,".location"),sr=Fe.def(Et.attributes,"[",Wt,"]"),fr=Ye.state,rr=Ye.buffer,Tr=[Ye.x,Ye.y,Ye.z,Ye.w],En=["buffer","normalized","offset","stride"];function qn(){Fe("if(!",sr,".buffer){",At,".enableVertexAttribArray(",Wt,");}");var Ln=Ye.type,Hn;if(Ye.size?Hn=Fe.def(Ye.size,"||",ct):Hn=ct,Fe("if(",sr,".type!==",Ln,"||",sr,".size!==",Hn,"||",En.map(function(Ka){return sr+"."+Ka+"!=="+Ye[Ka]}).join("||"),"){",At,".bindBuffer(",tu,",",rr,".buffer);",At,".vertexAttribPointer(",[Wt,Hn,Ln,Ye.normalized,Ye.stride,Ye.offset],");",sr,".type=",Ln,";",sr,".size=",Hn,";",En.map(function(Ka){return sr+"."+Ka+"="+Ye[Ka]+";"}).join(""),"}"),oe){var wa=Ye.divisor;Fe("if(",sr,".divisor!==",wa,"){",Ze.instancing,".vertexAttribDivisorANGLE(",[Wt,wa],");",sr,".divisor=",wa,";}")}}function ln(){Fe("if(",sr,".buffer){",At,".disableVertexAttribArray(",Wt,");",sr,".buffer=null;","}if(",Su.map(function(Ln,Hn){return sr+"."+Ln+"!=="+Tr[Hn]}).join("||"),"){",At,".vertexAttrib4f(",Wt,",",Tr,");",Su.map(function(Ln,Hn){return sr+"."+Ln+"="+Tr[Hn]+";"}).join(""),"}")}fr===os?qn():fr===Mu?ln():(Fe("if(",fr,"===",os,"){"),qn(),Fe("}else{"),ln(),Fe("}"))}Bt.forEach(function(Ke){var ct=Ke.name,Ye=vt.attributes[ct],At;if(Ye){if(!Ut(Ye))return;At=Ye.append(Ze,Fe)}else{if(!Ut(Qf))return;var Wt=Ze.scopeAttrib(ct);Oe.optional(function(){Ze.assert(Fe,Wt+".state","missing attribute "+ct)}),At={},Object.keys(new V).forEach(function(sr){At[sr]=Fe.def(Wt,".",sr)})}Ot(Ze.link(Ke),gt(Ke.info.type),At)})}function ma(Ze,Fe,vt,Bt,Ut){for(var Et=Ze.shared,gt=Et.gl,Ot,Ke=0;Ke1?Fe(un(Ln,function(co){return Array.isArray(rr)?rr[co]:rr+"["+co+"]"})):(Oe(!Array.isArray(rr),"uniform value must not be an array"),Fe(rr));Fe(");")}}function An(Ze,Fe,vt,Bt){var Ut=Ze.shared,Et=Ut.gl,gt=Ut.draw,Ot=Bt.draw;function Ke(){var Hn=Ot.elements,wa,Ka=Fe;return Hn?((Hn.contextDep&&Bt.contextDynamic||Hn.propDep)&&(Ka=vt),wa=Hn.append(Ze,Ka)):wa=Ka.def(gt,".",qs),wa&&Ka("if("+wa+")"+Et+".bindBuffer("+Sc+","+wa+".buffer.buffer);"),wa}function ct(){var Hn=Ot.count,wa,Ka=Fe;return Hn?((Hn.contextDep&&Bt.contextDynamic||Hn.propDep)&&(Ka=vt),wa=Hn.append(Ze,Ka),Oe.optional(function(){Hn.MISSING&&Ze.assert(Fe,"false","missing vertex count"),Hn.DYNAMIC&&Ze.assert(Ka,wa+">=0","missing vertex count")})):(wa=Ka.def(gt,".",eu),Oe.optional(function(){Ze.assert(Ka,wa+">=0","missing vertex count")})),wa}var Ye=Ke();function At(Hn){var wa=Ot[Hn];return wa?wa.contextDep&&Bt.contextDynamic||wa.propDep?wa.append(Ze,vt):wa.append(Ze,Fe):Fe.def(gt,".",Hn)}var Wt=At(jo),sr=At(Rf),fr=ct();if(typeof fr=="number"){if(fr===0)return}else vt("if(",fr,"){"),vt.exit("}");var rr,Tr;oe&&(rr=At(Bf),Tr=Ze.instancing);var En=Ye+".type",qn=Ot.elements&&Is(Ot.elements);function ln(){function Hn(){vt(Tr,".drawElementsInstancedANGLE(",[Wt,fr,En,sr+"<<(("+En+"-"+_u+")>>1)",rr],");")}function wa(){vt(Tr,".drawArraysInstancedANGLE(",[Wt,sr,fr,rr],");")}Ye?qn?Hn():(vt("if(",Ye,"){"),Hn(),vt("}else{"),wa(),vt("}")):wa()}function Ln(){function Hn(){vt(Et+".drawElements("+[Wt,fr,En,sr+"<<(("+En+"-"+_u+")>>1)"]+");")}function wa(){vt(Et+".drawArrays("+[Wt,sr,fr]+");")}Ye?qn?Hn():(vt("if(",Ye,"){"),Hn(),vt("}else{"),wa(),vt("}")):wa()}oe&&(typeof rr!="number"||rr>=0)?typeof rr=="string"?(vt("if(",rr,">0){"),ln(),vt("}else if(",rr,"<0){"),Ln(),vt("}")):ln():Ln()}function ca(Ze,Fe,vt,Bt,Ut){var Et=pr(),gt=Et.proc("body",Ut);return Oe.optional(function(){Et.commandStr=Fe.commandStr,Et.command=Et.link(Fe.commandStr)}),oe&&(Et.instancing=gt.def(Et.shared.extensions,".angle_instanced_arrays")),Ze(Et,gt,vt,Bt),Et.compile().body}function ba(Ze,Fe,vt,Bt){ui(Ze,Fe),vt.useVAO?vt.drawVAO?Fe(Ze.shared.vao,".setVAO(",vt.drawVAO.append(Ze,Fe),");"):Fe(Ze.shared.vao,".setVAO(",Ze.shared.vao,".targetVAO);"):(Fe(Ze.shared.vao,".setVAO(null);"),Ni(Ze,Fe,vt,Bt.attributes,function(){return!0})),ma(Ze,Fe,vt,Bt.uniforms,function(){return!0}),An(Ze,Fe,Fe,vt)}function fi(Ze,Fe){var vt=Ze.proc("draw",1);ui(Ze,vt),Wa(Ze,vt,Fe.context),Za(Ze,vt,Fe.framebuffer),pi(Ze,vt,Fe),Di(Ze,vt,Fe.state),Jn(Ze,vt,Fe,!1,!0);var Bt=Fe.shader.progVar.append(Ze,vt);if(vt(Ze.shared.gl,".useProgram(",Bt,".program);"),Fe.shader.program)ba(Ze,vt,Fe,Fe.shader.program);else{vt(Ze.shared.vao,".setVAO(null);");var Ut=Ze.global.def("{}"),Et=vt.def(Bt,".id"),gt=vt.def(Ut,"[",Et,"]");vt(Ze.cond(gt).then(gt,".call(this,a0);").else(gt,"=",Ut,"[",Et,"]=",Ze.link(function(Ot){return ca(ba,Ze,Fe,Ot,1)}),"(",Bt,");",gt,".call(this,a0);"))}Object.keys(Fe.state).length>0&&vt(Ze.shared.current,".dirty=true;")}function fo(Ze,Fe,vt,Bt){Ze.batchId="a1",ui(Ze,Fe);function Ut(){return!0}Ni(Ze,Fe,vt,Bt.attributes,Ut),ma(Ze,Fe,vt,Bt.uniforms,Ut),An(Ze,Fe,Fe,vt)}function lf(Ze,Fe,vt,Bt){ui(Ze,Fe);var Ut=vt.contextDep,Et=Fe.def(),gt="a0",Ot="a1",Ke=Fe.def();Ze.shared.props=Ke,Ze.batchId=Et;var ct=Ze.scope(),Ye=Ze.scope();Fe(ct.entry,"for(",Et,"=0;",Et,"<",Ot,";++",Et,"){",Ke,"=",gt,"[",Et,"];",Ye,"}",ct.exit);function At(En){return En.contextDep&&Ut||En.propDep}function Wt(En){return!At(En)}if(vt.needsContext&&Wa(Ze,Ye,vt.context),vt.needsFramebuffer&&Za(Ze,Ye,vt.framebuffer),Di(Ze,Ye,vt.state,At),vt.profile&&At(vt.profile)&&Jn(Ze,Ye,vt,!1,!0),Bt)vt.useVAO?vt.drawVAO?At(vt.drawVAO)?Ye(Ze.shared.vao,".setVAO(",vt.drawVAO.append(Ze,Ye),");"):ct(Ze.shared.vao,".setVAO(",vt.drawVAO.append(Ze,ct),");"):ct(Ze.shared.vao,".setVAO(",Ze.shared.vao,".targetVAO);"):(ct(Ze.shared.vao,".setVAO(null);"),Ni(Ze,ct,vt,Bt.attributes,Wt),Ni(Ze,Ye,vt,Bt.attributes,At)),ma(Ze,ct,vt,Bt.uniforms,Wt),ma(Ze,Ye,vt,Bt.uniforms,At),An(Ze,ct,Ye,vt);else{var sr=Ze.global.def("{}"),fr=vt.shader.progVar.append(Ze,Ye),rr=Ye.def(fr,".id"),Tr=Ye.def(sr,"[",rr,"]");Ye(Ze.shared.gl,".useProgram(",fr,".program);","if(!",Tr,"){",Tr,"=",sr,"[",rr,"]=",Ze.link(function(En){return ca(fo,Ze,vt,En,2)}),"(",fr,");}",Tr,".call(this,a0[",Et,"],",Et,");")}}function rt(Ze,Fe){var vt=Ze.proc("batch",2);Ze.batchId="0",ui(Ze,vt);var Bt=!1,Ut=!0;Object.keys(Fe.context).forEach(function(sr){Bt=Bt||Fe.context[sr].propDep}),Bt||(Wa(Ze,vt,Fe.context),Ut=!1);var Et=Fe.framebuffer,gt=!1;Et?(Et.propDep?Bt=gt=!0:Et.contextDep&&Bt&&(gt=!0),gt||Za(Ze,vt,Et)):Za(Ze,vt,null),Fe.state.viewport&&Fe.state.viewport.propDep&&(Bt=!0);function Ot(sr){return sr.contextDep&&Bt||sr.propDep}pi(Ze,vt,Fe),Di(Ze,vt,Fe.state,function(sr){return!Ot(sr)}),(!Fe.profile||!Ot(Fe.profile))&&Jn(Ze,vt,Fe,!1,"a1"),Fe.contextDep=Bt,Fe.needsContext=Ut,Fe.needsFramebuffer=gt;var Ke=Fe.shader.progVar;if(Ke.contextDep&&Bt||Ke.propDep)lf(Ze,vt,Fe,null);else{var ct=Ke.append(Ze,vt);if(vt(Ze.shared.gl,".useProgram(",ct,".program);"),Fe.shader.program)lf(Ze,vt,Fe,Fe.shader.program);else{vt(Ze.shared.vao,".setVAO(null);");var Ye=Ze.global.def("{}"),At=vt.def(ct,".id"),Wt=vt.def(Ye,"[",At,"]");vt(Ze.cond(Wt).then(Wt,".call(this,a0,a1);").else(Wt,"=",Ye,"[",At,"]=",Ze.link(function(sr){return ca(lf,Ze,Fe,sr,2)}),"(",ct,");",Wt,".call(this,a0,a1);"))}}Object.keys(Fe.state).length>0&&vt(Ze.shared.current,".dirty=true;")}function $t(Ze,Fe){var vt=Ze.proc("scope",3);Ze.batchId="a2";var Bt=Ze.shared,Ut=Bt.current;Wa(Ze,vt,Fe.context),Fe.framebuffer&&Fe.framebuffer.append(Ze,vt),Kc(Object.keys(Fe.state)).forEach(function(gt){var Ot=Fe.state[gt],Ke=Ot.append(Ze,vt);_n(Ke)?Ke.forEach(function(ct,Ye){vt.set(Ze.next[gt],"["+Ye+"]",ct)}):vt.set(Bt.next,"."+gt,Ke)}),Jn(Ze,vt,Fe,!0,!0),[qs,Rf,eu,Bf,jo].forEach(function(gt){var Ot=Fe.draw[gt];Ot&&vt.set(Bt.draw,"."+gt,""+Ot.append(Ze,vt))}),Object.keys(Fe.uniforms).forEach(function(gt){var Ot=Fe.uniforms[gt].append(Ze,vt);Array.isArray(Ot)&&(Ot="["+Ot.join()+"]"),vt.set(Bt.uniforms,"["+We.id(gt)+"]",Ot)}),Object.keys(Fe.attributes).forEach(function(gt){var Ot=Fe.attributes[gt].append(Ze,vt),Ke=Ze.scopeAttrib(gt);Object.keys(new V).forEach(function(ct){vt.set(Ke,"."+ct,Ot[ct])})}),Fe.scopeVAO&&vt.set(Bt.vao,".targetVAO",Fe.scopeVAO.append(Ze,vt));function Et(gt){var Ot=Fe.shader[gt];Ot&&vt.set(Bt.shader,"."+gt,Ot.append(Ze,vt))}Et(qi),Et(Tu),Object.keys(Fe.state).length>0&&(vt(Ut,".dirty=true;"),vt.exit(Ut,".dirty=true;")),vt("a1(",Ze.shared.context,",a0,",Ze.batchId,");")}function Yt(Ze){if(!(typeof Ze!="object"||_n(Ze))){for(var Fe=Object.keys(Ze),vt=0;vt=0;--An){var ca=Dt[An];ca&&ca(w,null,0)}it.flush(),wr&&wr.update()}function Mn(){!fn&&Dt.length>0&&(fn=Vt.next(cn))}function Un(){fn&&(Vt.cancel(cn),fn=null)}function kn(An){An.preventDefault(),or=!0,Un(),pr.forEach(function(ca){ca()})}function Na(An){it.getError(),or=!1,Xt.restore(),Ne.restore(),oe.restore(),ze.restore(),Be.restore(),nt.restore(),le.restore(),wr&&wr.restore(),_t.procs.refresh(),Mn(),Xr.forEach(function(ca){ca()})}kt&&(kt.addEventListener(Lc,kn,!1),kt.addEventListener(qf,Na,!1));function Bn(){Dt.length=0,Un(),kt&&(kt.removeEventListener(Lc,kn),kt.removeEventListener(qf,Na)),Ne.clear(),nt.clear(),Be.clear(),ze.clear(),_e.clear(),oe.clear(),le.clear(),wr&&wr.clear(),Or.forEach(function(An){An()})}function Ha(An){Oe(!!An,"invalid args to regl({...})"),Oe.type(An,"object","invalid args to regl({...})");function ca(Ut){var Et=F({},Ut);delete Et.uniforms,delete Et.attributes,delete Et.context,delete Et.vao,"stencil"in Et&&Et.stencil.op&&(Et.stencil.opBack=Et.stencil.opFront=Et.stencil.op,delete Et.stencil.op);function gt(Ot){if(Ot in Et){var Ke=Et[Ot];delete Et[Ot],Object.keys(Ke).forEach(function(ct){Et[Ot+"."+ct]=Ke[ct]})}}return gt("blend"),gt("depth"),gt("cull"),gt("stencil"),gt("polygonOffset"),gt("scissor"),gt("sample"),"vao"in Ut&&(Et.vao=Ut.vao),Et}function ba(Ut,Et){var gt={},Ot={};return Object.keys(Ut).forEach(function(Ke){var ct=Ut[Ke];if(zt.isDynamic(ct)){Ot[Ke]=zt.unbox(ct,Ke);return}else if(Et&&Array.isArray(ct)){for(var Ye=0;Ye0)return ia.call(this,vt(Ut|0),Ut|0)}else if(Array.isArray(Ut)){if(Ut.length)return ia.call(this,Ut,Ut.length)}else return Lr.call(this,Ut)}return F(Bt,{stats:$t,destroy:function(){Yt.destroy()}})}var Aa=nt.setFBO=Ha({framebuffer:zt.define.call(null,Jc,"framebuffer")});function fa(An,ca){var ba=0;_t.procs.poll();var fi=ca.color;fi&&(it.clearColor(+fi[0]||0,+fi[1]||0,+fi[2]||0,+fi[3]||0),ba|=bl),"depth"in ca&&(it.clearDepth(+ca.depth),ba|=Ac),"stencil"in ca&&(it.clearStencil(ca.stencil|0),ba|=Jf),Oe(!!ba,"called regl.clear with no buffer specified"),it.clear(ba)}function Wa(An){if(Oe(typeof An=="object"&&An,"regl.clear() takes an object as input"),"framebuffer"in An)if(An.framebuffer&&An.framebuffer_reglType==="framebufferCube")for(var ca=0;ca<6;++ca)Aa(F({framebuffer:An.framebuffer.faces[ca]},An),fa);else Aa(An,fa);else fa(null,An)}function Za(An){Oe.type(An,"function","regl.frame() callback must be a function"),Dt.push(An);function ca(){var ba=tl(Dt,An);Oe(ba>=0,"cannot cancel a frame twice");function fi(){var fo=tl(Dt,fi);Dt[fo]=Dt[Dt.length-1],Dt.length-=1,Dt.length<=0&&Un()}Dt[ba]=fi}return Mn(),{cancel:ca}}function pi(){var An=Pt.viewport,ca=Pt.scissor_box;An[0]=An[1]=ca[0]=ca[1]=0,w.viewportWidth=w.framebufferWidth=w.drawingBufferWidth=An[2]=ca[2]=it.drawingBufferWidth,w.viewportHeight=w.framebufferHeight=w.drawingBufferHeight=An[3]=ca[3]=it.drawingBufferHeight}function Di(){w.tick+=1,w.time=Jn(),pi(),_t.procs.poll()}function ui(){ze.refresh(),pi(),_t.procs.refresh(),wr&&wr.update()}function Jn(){return(hr()-_r)/1e3}ui();function Ni(An,ca){Oe.type(ca,"function","listener callback must be a function");var ba;switch(An){case"frame":return Za(ca);case"lost":ba=pr;break;case"restore":ba=Xr;break;case"destroy":ba=Or;break;default:Oe.raise("invalid event, must be one of frame,lost,restore,destroy")}return ba.push(ca),{cancel:function(){for(var fi=0;fi=0},read:tr,destroy:Bn,_gl:it,_refresh:ui,poll:function(){Di(),wr&&wr.update()},now:Jn,stats:gr});return We.onDone(null,ma),ma}return ec})},68608:function(Mt){function N(F){if(F===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return F}Mt.exports=N,Mt.exports.__esModule=!0,Mt.exports.default=Mt.exports},38888:function(Mt,N,F){var k=F(44908),U=F(14614),L=F(91621);function _(I){var T=U();return function(){var p=k(I),v;if(T){var g=k(this).constructor;v=Reflect.construct(p,arguments,g)}else v=p.apply(this,arguments);return L(this,v)}}Mt.exports=_,Mt.exports.__esModule=!0,Mt.exports.default=Mt.exports},44908:function(Mt){function N(F){return Mt.exports=N=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(U){return U.__proto__||Object.getPrototypeOf(U)},Mt.exports.__esModule=!0,Mt.exports.default=Mt.exports,N(F)}Mt.exports=N,Mt.exports.__esModule=!0,Mt.exports.default=Mt.exports},58853:function(Mt,N,F){var k=F(49154);function U(L,_){if(typeof _!="function"&&_!==null)throw new TypeError("Super expression must either be null or a function");L.prototype=Object.create(_&&_.prototype,{constructor:{value:L,writable:!0,configurable:!0}}),Object.defineProperty(L,"prototype",{writable:!1}),_&&k(L,_)}Mt.exports=U,Mt.exports.__esModule=!0,Mt.exports.default=Mt.exports},14614:function(Mt){function N(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(F){return!1}}Mt.exports=N,Mt.exports.__esModule=!0,Mt.exports.default=Mt.exports},91621:function(Mt,N,F){var k=F(37635).default,U=F(68608);function L(_,I){if(I&&(k(I)==="object"||typeof I=="function"))return I;if(I!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return U(_)}Mt.exports=L,Mt.exports.__esModule=!0,Mt.exports.default=Mt.exports},49154:function(Mt){function N(F,k){return Mt.exports=N=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(L,_){return L.__proto__=_,L},Mt.exports.__esModule=!0,Mt.exports.default=Mt.exports,N(F,k)}Mt.exports=N,Mt.exports.__esModule=!0,Mt.exports.default=Mt.exports},75258:function(Mt,N,F){var k=F(42317).default;function U(){"use strict";Mt.exports=U=function(){return L},Mt.exports.__esModule=!0,Mt.exports.default=Mt.exports;var L={},_=Object.prototype,I=_.hasOwnProperty,T=Object.defineProperty||function(ye,Ae,Se){ye[Ae]=Se.value},x=typeof Symbol=="function"?Symbol:{},p=x.iterator||"@@iterator",v=x.asyncIterator||"@@asyncIterator",g=x.toStringTag||"@@toStringTag";function d(ye,Ae,Se){return Object.defineProperty(ye,Ae,{value:Se,enumerable:!0,configurable:!0,writable:!0}),ye[Ae]}try{d({},"")}catch(ye){d=function(Se,we,Te){return Se[we]=Te}}function c(ye,Ae,Se,we){var Te=Ae&&Ae.prototype instanceof M?Ae:M,ke=Object.create(Te.prototype),Ge=new fe(we||[]);return T(ke,"_invoke",{value:J(ye,Se,Ge)}),ke}function s(ye,Ae,Se){try{return{type:"normal",arg:ye.call(Ae,Se)}}catch(we){return{type:"throw",arg:we}}}L.wrap=c;var m={};function M(){}function P(){}function R(){}var j={};d(j,p,function(){return this});var Q=Object.getPrototypeOf,G=Q&&Q(Q(Ie([])));G&&G!==_&&I.call(G,p)&&(j=G);var W=R.prototype=M.prototype=Object.create(j);function H(ye){["next","throw","return"].forEach(function(Ae){d(ye,Ae,function(Se){return this._invoke(Ae,Se)})})}function Z(ye,Ae){function Se(Te,ke,Ge,tt){var He=s(ye[Te],ye,ke);if(He.type!=="throw"){var ft=He.arg,Lt=ft.value;return Lt&&k(Lt)=="object"&&I.call(Lt,"__await")?Ae.resolve(Lt.__await).then(function(Jt){Se("next",Jt,Ge,tt)},function(Jt){Se("throw",Jt,Ge,tt)}):Ae.resolve(Lt).then(function(Jt){ft.value=Jt,Ge(ft)},function(Jt){return Se("throw",Jt,Ge,tt)})}tt(He.arg)}var we;T(this,"_invoke",{value:function(ke,Ge){function tt(){return new Ae(function(He,ft){Se(ke,Ge,He,ft)})}return we=we?we.then(tt,tt):tt()}})}function J(ye,Ae,Se){var we="suspendedStart";return function(Te,ke){if(we==="executing")throw new Error("Generator is already running");if(we==="completed"){if(Te==="throw")throw ke;return{value:void 0,done:!0}}for(Se.method=Te,Se.arg=ke;;){var Ge=Se.delegate;if(Ge){var tt=K(Ge,Se);if(tt){if(tt===m)continue;return tt}}if(Se.method==="next")Se.sent=Se._sent=Se.arg;else if(Se.method==="throw"){if(we==="suspendedStart")throw we="completed",Se.arg;Se.dispatchException(Se.arg)}else Se.method==="return"&&Se.abrupt("return",Se.arg);we="executing";var He=s(ye,Ae,Se);if(He.type==="normal"){if(we=Se.done?"completed":"suspendedYield",He.arg===m)continue;return{value:He.arg,done:Se.done}}He.type==="throw"&&(we="completed",Se.method="throw",Se.arg=He.arg)}}}function K(ye,Ae){var Se=Ae.method,we=ye.iterator[Se];if(we===void 0)return Ae.delegate=null,Se==="throw"&&ye.iterator.return&&(Ae.method="return",Ae.arg=void 0,K(ye,Ae),Ae.method==="throw")||Se!=="return"&&(Ae.method="throw",Ae.arg=new TypeError("The iterator does not provide a '"+Se+"' method")),m;var Te=s(we,ye.iterator,Ae.arg);if(Te.type==="throw")return Ae.method="throw",Ae.arg=Te.arg,Ae.delegate=null,m;var ke=Te.arg;return ke?ke.done?(Ae[ye.resultName]=ke.value,Ae.next=ye.nextLoc,Ae.method!=="return"&&(Ae.method="next",Ae.arg=void 0),Ae.delegate=null,m):ke:(Ae.method="throw",Ae.arg=new TypeError("iterator result is not an object"),Ae.delegate=null,m)}function ne(ye){var Ae={tryLoc:ye[0]};1 in ye&&(Ae.catchLoc=ye[1]),2 in ye&&(Ae.finallyLoc=ye[2],Ae.afterLoc=ye[3]),this.tryEntries.push(Ae)}function se(ye){var Ae=ye.completion||{};Ae.type="normal",delete Ae.arg,ye.completion=Ae}function fe(ye){this.tryEntries=[{tryLoc:"root"}],ye.forEach(ne,this),this.reset(!0)}function Ie(ye){if(ye||ye===""){var Ae=ye[p];if(Ae)return Ae.call(ye);if(typeof ye.next=="function")return ye;if(!isNaN(ye.length)){var Se=-1,we=function Te(){for(;++Se=0;--Te){var ke=this.tryEntries[Te],Ge=ke.completion;if(ke.tryLoc==="root")return we("end");if(ke.tryLoc<=this.prev){var tt=I.call(ke,"catchLoc"),He=I.call(ke,"finallyLoc");if(tt&&He){if(this.prev=0;--we){var Te=this.tryEntries[we];if(Te.tryLoc<=this.prev&&I.call(Te,"finallyLoc")&&this.prev=0;--Se){var we=this.tryEntries[Se];if(we.finallyLoc===Ae)return this.complete(we.completion,we.afterLoc),se(we),m}},catch:function(Ae){for(var Se=this.tryEntries.length-1;Se>=0;--Se){var we=this.tryEntries[Se];if(we.tryLoc===Ae){var Te=we.completion;if(Te.type==="throw"){var ke=Te.arg;se(we)}return ke}}throw new Error("illegal catch attempt")},delegateYield:function(Ae,Se,we){return this.delegate={iterator:Ie(Ae),resultName:Se,nextLoc:we},this.method==="next"&&(this.arg=void 0),m}},L}Mt.exports=U,Mt.exports.__esModule=!0,Mt.exports.default=Mt.exports},42317:function(Mt){function N(F){"@babel/helpers - typeof";return Mt.exports=N=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(k){return typeof k}:function(k){return k&&typeof Symbol=="function"&&k.constructor===Symbol&&k!==Symbol.prototype?"symbol":typeof k},Mt.exports.__esModule=!0,Mt.exports.default=Mt.exports,N(F)}Mt.exports=N,Mt.exports.__esModule=!0,Mt.exports.default=Mt.exports},15612:function(Mt,N,F){var k=F(75258)();Mt.exports=k;try{regeneratorRuntime=k}catch(U){typeof globalThis=="object"?globalThis.regeneratorRuntime=k:Function("r","regeneratorRuntime = r")(k)}}}]);