!(function(){var cc=Object.defineProperty,fc=Object.defineProperties;var lc=Object.getOwnPropertyDescriptors;var pi=Object.getOwnPropertySymbols;var dc=Object.prototype.hasOwnProperty,hc=Object.prototype.propertyIsEnumerable;var _r=(Ke,Ie,me)=>Ie in Ke?cc(Ke,Ie,{enumerable:!0,configurable:!0,writable:!0,value:me}):Ke[Ie]=me,Gn=(Ke,Ie)=>{for(var me in Ie||(Ie={}))dc.call(Ie,me)&&_r(Ke,me,Ie[me]);if(pi)for(var me of pi(Ie))hc.call(Ie,me)&&_r(Ke,me,Ie[me]);return Ke},Hr=(Ke,Ie)=>fc(Ke,lc(Ie));var be=(Ke,Ie,me)=>_r(Ke,typeof Ie!="symbol"?Ie+"":Ie,me);(function(){var Ke={48202:function(w,P,a){"use strict";var l,x=Object.defineProperty,E=T=>{throw TypeError(T)},b=Math.pow,v=(T,u,c)=>u in T?x(T,u,{enumerable:!0,configurable:!0,writable:!0,value:c}):T[u]=c,N=(T,u,c)=>v(T,typeof u!="symbol"?u+"":u,c),S=(T,u,c)=>u.has(T)||E("Cannot "+c),M=(T,u,c)=>(S(T,u,"read from private field"),c?c.call(T):u.get(T)),A=(T,u,c)=>u.has(T)?E("Cannot add the same private member more than once"):u instanceof WeakSet?u.add(T):u.set(T,c),I=(T,u,c,i)=>(S(T,u,"write to private field"),i?i.call(T,c):u.set(T,c),c),j=(T,u,c)=>(S(T,u,"access private method"),c),D,$,K;l={value:!0};var ot=a(44091),nt=a(75823);const _=" ".repeat(2),et=" ".repeat(4);function tt(){return it(this)}function it(T,u={}){const{maxRows:c=15,maxColumns:i=10,maxNumSize:f=8,padMinus:m="auto"}=u;return`${T.constructor.name} { ${_}[ ${et}${at(T,c,i,f,m)} ${_}] ${_}rows: ${T.rows} ${_}columns: ${T.columns} }`}function at(T,u,c,i,f){const{rows:m,columns:k}=T,B=Math.min(m,u),G=Math.min(k,c),V=[];if(f==="auto"){f=!1;t:for(let rt=0;rt=0&&c?` ${ht(T,u-1)}`:ht(T,u)).padEnd(u)}function ht(T,u){let c=T.toString();if(c.length<=u)return c;let i=T.toFixed(u);if(i.length>u&&(i=T.toFixed(Math.max(0,u-(i.length-u)))),i.length<=u&&!i.startsWith("0.000")&&!i.startsWith("-0.000"))return i;let f=T.toExponential(u);return f.length>u&&(f=T.toExponential(Math.max(0,u-(f.length-u)))),f.slice(0)}function dt(T,u){T.prototype.add=function(i){return typeof i=="number"?this.addS(i):this.addM(i)},T.prototype.addS=function(i){for(let f=0;f>i);return this},T.prototype.signPropagatingRightShiftM=function(i){if(i=u.checkMatrix(i),this.rows!==i.rows||this.columns!==i.columns)throw new RangeError("Matrices dimensions must be equal");for(let f=0;f>i.get(f,m));return this},T.signPropagatingRightShift=function(i,f){return new u(i).signPropagatingRightShift(f)},T.prototype.rightShift=function(i){return typeof i=="number"?this.rightShiftS(i):this.rightShiftM(i)},T.prototype.rightShiftS=function(i){for(let f=0;f>>i);return this},T.prototype.rightShiftM=function(i){if(i=u.checkMatrix(i),this.rows!==i.rows||this.columns!==i.columns)throw new RangeError("Matrices dimensions must be equal");for(let f=0;f>>i.get(f,m));return this},T.rightShift=function(i,f){return new u(i).rightShift(f)},T.prototype.zeroFillRightShift=T.prototype.rightShift,T.prototype.zeroFillRightShiftS=T.prototype.rightShiftS,T.prototype.zeroFillRightShiftM=T.prototype.rightShiftM,T.zeroFillRightShift=T.rightShift,T.prototype.not=function(){for(let i=0;ii)throw new RangeError("Row index out of range")}function yt(T,u,c){let i=c?T.columns:T.columns-1;if(u<0||u>i)throw new RangeError("Column index out of range")}function Mt(T,u){if(u.to1DArray&&(u=u.to1DArray()),u.length!==T.columns)throw new RangeError("vector size must be the same as the number of columns");return u}function St(T,u){if(u.to1DArray&&(u=u.to1DArray()),u.length!==T.rows)throw new RangeError("vector size must be the same as the number of rows");return u}function Bt(T,u){if(!ot.isAnyArray(u))throw new TypeError("row indices must be an array");for(let c=0;c=T.rows)throw new RangeError("row indices are out of range")}function Vt(T,u){if(!ot.isAnyArray(u))throw new TypeError("column indices must be an array");for(let c=0;c=T.columns)throw new RangeError("column indices are out of range")}function qt(T,u,c,i,f){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(ce("startRow",u),ce("endRow",c),ce("startColumn",i),ce("endColumn",f),u>c||i>f||u<0||u>=T.rows||c<0||c>=T.rows||i<0||i>=T.columns||f<0||f>=T.columns)throw new RangeError("Submatrix indices are out of range")}function te(T,u=0){let c=[];for(let i=0;i=m)throw new RangeError("min must be smaller than max");let B=m-f,G=new It(u,c);for(let V=0;Vi?(m=!0,i=c):(f=!1,m=!0);u++}return f}isReducedEchelonForm(){let u=0,c=0,i=-1,f=!0,m=!1;for(;ui?(m=!0,i=c):(f=!1,m=!0);for(let k=c+1;ku.get(f,i)&&(f=m);if(u.get(f,i)===0)i++;else{u.swapRows(c,f);let m=u.get(c,i);for(let k=i;k=0;)if(u.maxRow(f)===0)f--;else{let m=0,k=!1;for(;mc[i]&&(c[i]=this.get(i,f));return c}case"column":{const c=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let i=0;ic[f]&&(c[f]=this.get(i,f));return c}case void 0:{let c=this.get(0,0);for(let i=0;ic&&(c=this.get(i,f));return c}default:throw new Error(`invalid option: ${u}`)}}maxIndex(){ze(this);let u=this.get(0,0),c=[0,0];for(let i=0;iu&&(u=this.get(i,f),c[0]=i,c[1]=f);return c}min(u){if(this.isEmpty())return NaN;switch(u){case"row":{const c=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let i=0;ic&&(c=this.get(u,i));return c}maxRowIndex(u){xt(this,u),ze(this);let c=this.get(u,0),i=[u,0];for(let f=1;fc&&(c=this.get(u,f),i[1]=f);return i}minRow(u){if(xt(this,u),this.isEmpty())return NaN;let c=this.get(u,0);for(let i=1;ic&&(c=this.get(i,u));return c}maxColumnIndex(u){yt(this,u),ze(this);let c=this.get(0,u),i=[0,u];for(let f=1;fc&&(c=this.get(f,u),i[0]=f);return i}minColumn(u){if(yt(this,u),this.isEmpty())return NaN;let c=this.get(0,u);for(let i=1;i1;f/=2)f&1&&(c=c.mmul(i)),i=i.mmul(i);return c}strassen2x2(u){u=It.checkMatrix(u);let c=new It(2,2);const i=this.get(0,0),f=u.get(0,0),m=this.get(0,1),k=u.get(0,1),B=this.get(1,0),G=u.get(1,0),V=this.get(1,1),rt=u.get(1,1),Z=(i+V)*(f+rt),lt=(B+V)*f,At=i*(k-rt),ct=V*(G-f),pt=(i+m)*rt,Lt=(B-i)*(f+k),J=(m-V)*(G+rt),Ot=Z+ct-pt+J,Ct=At+pt,Kt=lt+ct,Zt=Z-lt+At+Lt;return c.set(0,0,Ot),c.set(0,1,Ct),c.set(1,0,Kt),c.set(1,1,Zt),c}strassen3x3(u){u=It.checkMatrix(u);let c=new It(3,3);const i=this.get(0,0),f=this.get(0,1),m=this.get(0,2),k=this.get(1,0),B=this.get(1,1),G=this.get(1,2),V=this.get(2,0),rt=this.get(2,1),Z=this.get(2,2),lt=u.get(0,0),At=u.get(0,1),ct=u.get(0,2),pt=u.get(1,0),Lt=u.get(1,1),J=u.get(1,2),Ot=u.get(2,0),Ct=u.get(2,1),Kt=u.get(2,2),Zt=(i+f+m-k-B-rt-Z)*Lt,ye=(i-k)*(-At+Lt),Ut=B*(-lt+At+pt-Lt-J-Ot+Kt),$t=(-i+k+B)*(lt-At+Lt),ae=(k+B)*(-lt+At),H=i*lt,mt=(-i+V+rt)*(lt-ct+J),Rt=(-i+V)*(ct-J),Nt=(V+rt)*(-lt+ct),we=(i+f+m-B-G-V-rt)*J,ue=rt*(-lt+ct+pt-Lt-J-Ot+Ct),he=(-m+rt+Z)*(Lt+Ot-Ct),pe=(m-Z)*(Lt-Ct),Pe=m*Ot,Je=(rt+Z)*(-Ot+Ct),Oe=(-m+B+G)*(J+Ot-Kt),He=(m-G)*(J-Kt),an=(B+G)*(-Ot+Kt),ne=f*pt,Te=G*Ct,Ge=k*ct,Be=V*At,Ae=Z*Kt,Or=H+Pe+ne,Ar=Zt+$t+ae+H+he+Pe+Je,or=H+mt+Nt+we+Pe+Oe+an,ar=ye+Ut+$t+H+Pe+Oe+He,Xn=ye+$t+ae+H+Te,Tr=Pe+Oe+He+an+Ge,jr=H+mt+Rt+ue+he+pe+Pe,Ir=he+pe+Pe+Je+Be,Pr=H+mt+Rt+Nt+Ae;return c.set(0,0,Or),c.set(0,1,Ar),c.set(0,2,or),c.set(1,0,ar),c.set(1,1,Xn),c.set(1,2,Tr),c.set(2,0,jr),c.set(2,1,Ir),c.set(2,2,Pr),c}mmulStrassen(u){u=It.checkMatrix(u);let c=this.clone(),i=c.rows,f=c.columns,m=u.rows,k=u.columns;f!==m&&console.warn(`Multiplying ${i} x ${f} and ${m} x ${k} matrix: dimensions do not match.`);function B(Z,lt,At){let ct=Z.rows,pt=Z.columns;if(ct===lt&&pt===At)return Z;{let Lt=Wt.zeros(lt,At);return Lt=Lt.setSubMatrix(Z,0,0),Lt}}let G=Math.max(i,m),V=Math.max(f,k);c=B(c,G,V),u=B(u,G,V);function rt(Z,lt,At,ct){if(At<=512||ct<=512)return Z.mmul(lt);At%2===1&&ct%2===1?(Z=B(Z,At+1,ct+1),lt=B(lt,At+1,ct+1)):At%2===1?(Z=B(Z,At+1,ct),lt=B(lt,At+1,ct)):ct%2===1&&(Z=B(Z,At,ct+1),lt=B(lt,At,ct+1));let pt=parseInt(Z.rows/2,10),Lt=parseInt(Z.columns/2,10),J=Z.subMatrix(0,pt-1,0,Lt-1),Ot=lt.subMatrix(0,pt-1,0,Lt-1),Ct=Z.subMatrix(0,pt-1,Lt,Z.columns-1),Kt=lt.subMatrix(0,pt-1,Lt,lt.columns-1),Zt=Z.subMatrix(pt,Z.rows-1,0,Lt-1),ye=lt.subMatrix(pt,lt.rows-1,0,Lt-1),Ut=Z.subMatrix(pt,Z.rows-1,Lt,Z.columns-1),$t=lt.subMatrix(pt,lt.rows-1,Lt,lt.columns-1),ae=rt(Wt.add(J,Ut),Wt.add(Ot,$t),pt,Lt),H=rt(Wt.add(Zt,Ut),Ot,pt,Lt),mt=rt(J,Wt.sub(Kt,$t),pt,Lt),Rt=rt(Ut,Wt.sub(ye,Ot),pt,Lt),Nt=rt(Wt.add(J,Ct),$t,pt,Lt),we=rt(Wt.sub(Zt,J),Wt.add(Ot,Kt),pt,Lt),ue=rt(Wt.sub(Ct,Ut),Wt.add(ye,$t),pt,Lt),he=Wt.add(ae,Rt);he.sub(Nt),he.add(ue);let pe=Wt.add(mt,Nt),Pe=Wt.add(H,Rt),Je=Wt.sub(ae,H);Je.add(mt),Je.add(we);let Oe=Wt.zeros(2*he.rows,2*he.columns);return Oe=Oe.setSubMatrix(he,0,0),Oe=Oe.setSubMatrix(pe,he.rows,0),Oe=Oe.setSubMatrix(Pe,0,he.columns),Oe=Oe.setSubMatrix(Je,he.rows,he.columns),Oe.subMatrix(0,At-1,0,ct-1)}return rt(c,u,G,V)}scaleRows(u={}){if(typeof u!="object")throw new TypeError("options must be an object");const{min:c=0,max:i=1}=u;if(!Number.isFinite(c))throw new TypeError("min must be a number");if(!Number.isFinite(i))throw new TypeError("max must be a number");if(c>=i)throw new RangeError("min must be smaller than max");let f=new It(this.rows,this.columns);for(let m=0;m0&&nt(k,{min:c,max:i,output:k}),f.setRow(m,k)}return f}scaleColumns(u={}){if(typeof u!="object")throw new TypeError("options must be an object");const{min:c=0,max:i=1}=u;if(!Number.isFinite(c))throw new TypeError("min must be a number");if(!Number.isFinite(i))throw new TypeError("max must be a number");if(c>=i)throw new RangeError("min must be smaller than max");let f=new It(this.rows,this.columns);for(let m=0;mi||c<0||c>=this.columns||i<0||i>=this.columns)throw new RangeError("Argument out of range");let f=new It(u.length,i-c+1);for(let m=0;m=this.rows)throw new RangeError(`Row index out of range: ${u[m]}`);f.set(m,k-c,this.get(u[m],k))}return f}subMatrixColumn(u,c,i){if(c===void 0&&(c=0),i===void 0&&(i=this.rows-1),c>i||c<0||c>=this.rows||i<0||i>=this.rows)throw new RangeError("Argument out of range");let f=new It(i-c+1,u.length);for(let m=0;m=this.columns)throw new RangeError(`Column index out of range: ${u[m]}`);f.set(k-c,m,this.get(k,u[m]))}return f}setSubMatrix(u,c,i){if(u=It.checkMatrix(u),u.isEmpty())return this;let f=c+u.rows-1,m=i+u.columns-1;qt(this,c,f,i,m);for(let k=0;ktypeof u=="number")}Wt.random=Wt.rand,Wt.randomInt=Wt.randInt,Wt.diagonal=Wt.diag,Wt.prototype.diagonal=Wt.prototype.diag,Wt.identity=Wt.eye,Wt.prototype.negate=Wt.prototype.neg,Wt.prototype.tensorProduct=Wt.prototype.kroneckerProduct;const cn=class qr extends Wt{constructor(u,c){if(super(),A(this,D),N(this,"data"),qr.isMatrix(u))j(this,D,$).call(this,u.rows,u.columns),qr.copy(u,this);else if(Number.isInteger(u)&&u>=0)j(this,D,$).call(this,u,c);else if(ot.isAnyArray(u)){const i=u;if(u=i.length,c=u?i[0].length:0,typeof c!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let f=0;f=0)for(let c=0;c=0)I(this,K,new It(u,u));else if(I(this,K,new It(u)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return M(this,K).size}get rows(){return M(this,K).rows}get columns(){return M(this,K).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(u){return It.isMatrix(u)&&u.klassType==="SymmetricMatrix"}static zeros(u){return new this(u)}static ones(u){return new this(u).fill(1)}clone(){const u=new ts(this.diagonalSize);for(const[c,i,f]of this.upperRightEntries())u.set(c,i,f);return u}toMatrix(){return new It(this)}get(u,c){return M(this,K).get(u,c)}set(u,c,i){return M(this,K).set(u,c,i),M(this,K).set(c,u,i),this}removeCross(u){return M(this,K).removeRow(u),M(this,K).removeColumn(u),this}addCross(u,c){c===void 0&&(c=u,u=this.diagonalSize);const i=c.slice();return i.splice(u,1),M(this,K).addRow(u,i),M(this,K).addColumn(u,c),this}applyMask(u){if(u.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const c=[];for(const[i,f]of u.entries())f||c.push(i);c.reverse();for(const i of c)this.removeCross(i);return this}toCompact(){const{diagonalSize:u}=this,c=new Array(u*(u+1)/2);for(let i=0,f=0,m=0;m=u&&(i=++f);return c}static fromCompact(u){const c=u.length,i=(Math.sqrt(8*c+1)-1)/2;if(!Number.isInteger(i))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(u)}`);const f=new ts(i);for(let m=0,k=0,B=0;B=i&&(m=++k);return f}*upperRightEntries(){for(let u=0,c=0;u=this.diagonalSize&&(c=++u)}}*upperRightValues(){for(let u=0,c=0;u=this.diagonalSize&&(c=++u)}};K=new WeakMap;let De=yn;De.prototype.klassType="SymmetricMatrix";class Se extends De{static isDistanceMatrix(u){return De.isSymmetricMatrix(u)&&u.klassSubType==="DistanceMatrix"}constructor(u){if(super(u),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(u,c,i){return u===c&&(i=0),super.set(u,c,i)}addCross(u,c){return c===void 0&&(c=u,u=this.diagonalSize),c=c.slice(),c[u]=0,super.addCross(u,c)}toSymmetricMatrix(){return new De(this)}clone(){const u=new Se(this.diagonalSize);for(const[c,i,f]of this.upperRightEntries())c!==i&&u.set(c,i,f);return u}toCompact(){const{diagonalSize:u}=this,c=(u-1)*u/2,i=new Array(c);for(let f=1,m=0,k=0;k=u&&(f=++m+1);return i}static fromCompact(u){const c=u.length;if(c===0)return new this(0);const i=(Math.sqrt(8*c+1)+1)/2;if(!Number.isInteger(i))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(u)}`);const f=new this(i);for(let m=1,k=0,B=0;B=i&&(m=++k+1);return f}}Se.prototype.klassSubType="DistanceMatrix";class Fe extends Wt{constructor(u,c,i){super(),this.matrix=u,this.rows=c,this.columns=i}}class wn extends Fe{constructor(u,c){yt(u,c),super(u,u.rows,1),this.column=c}set(u,c,i){return this.matrix.set(u,this.column,i),this}get(u){return this.matrix.get(u,this.column)}}class nr extends Fe{constructor(u,c){Vt(u,c),super(u,u.rows,c.length),this.columnIndices=c}set(u,c,i){return this.matrix.set(u,this.columnIndices[c],i),this}get(u,c){return this.matrix.get(u,this.columnIndices[c])}}class hn extends Fe{constructor(u){super(u,u.rows,u.columns)}set(u,c,i){return this.matrix.set(u,this.columns-c-1,i),this}get(u,c){return this.matrix.get(u,this.columns-c-1)}}class ke extends Fe{constructor(u){super(u,u.rows,u.columns)}set(u,c,i){return this.matrix.set(this.rows-u-1,c,i),this}get(u,c){return this.matrix.get(this.rows-u-1,c)}}class sn extends Fe{constructor(u,c){xt(u,c),super(u,1,u.columns),this.row=c}set(u,c,i){return this.matrix.set(this.row,c,i),this}get(u,c){return this.matrix.get(this.row,c)}}class Pn extends Fe{constructor(u,c){Bt(u,c),super(u,c.length,u.columns),this.rowIndices=c}set(u,c,i){return this.matrix.set(this.rowIndices[u],c,i),this}get(u,c){return this.matrix.get(this.rowIndices[u],c)}}class Yt extends Fe{constructor(u,c,i){Bt(u,c),Vt(u,i),super(u,c.length,i.length),this.rowIndices=c,this.columnIndices=i}set(u,c,i){return this.matrix.set(this.rowIndices[u],this.columnIndices[c],i),this}get(u,c){return this.matrix.get(this.rowIndices[u],this.columnIndices[c])}}class Ln extends Fe{constructor(u,c,i,f,m){qt(u,c,i,f,m),super(u,i-c+1,m-f+1),this.startRow=c,this.startColumn=f}set(u,c,i){return this.matrix.set(this.startRow+u,this.startColumn+c,i),this}get(u,c){return this.matrix.get(this.startRow+u,this.startColumn+c)}}class _e extends Fe{constructor(u){super(u,u.columns,u.rows)}set(u,c,i){return this.matrix.set(c,u,i),this}get(u,c){return this.matrix.get(c,u)}}class Ze extends Wt{constructor(u,c={}){const{rows:i=1}=c;if(u.length%i!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=i,this.columns=u.length/i,this.data=u}set(u,c,i){let f=this._calculateIndex(u,c);return this.data[f]=i,this}get(u,c){let i=this._calculateIndex(u,c);return this.data[i]}_calculateIndex(u,c){return u*this.columns+c}}class Ve extends Wt{constructor(u){super(),this.data=u,this.rows=u.length,this.columns=u[0].length}set(u,c,i){return this.data[u][c]=i,this}get(u,c){return this.data[u][c]}}function xr(T,u){if(ot.isAnyArray(T))return T[0]&&ot.isAnyArray(T[0])?new Ve(T):new Ze(T,u);throw new Error("the argument is not an array")}class Rn{constructor(u){u=Ve.checkMatrix(u);let c=u.clone(),i=c.rows,f=c.columns,m=new Float64Array(i),k=1,B,G,V,rt,Z,lt,At,ct,pt;for(B=0;BMath.abs(ct[rt])&&(rt=B);if(rt!==G){for(V=0;V=0;V--){for(G=0;Gk?f.set(m,k,u.get(m,k)):m===k?f.set(m,k,1):f.set(m,k,0);return f}get upperTriangularMatrix(){let u=this.LU,c=u.rows,i=u.columns,f=new It(c,i);for(let m=0;mMath.abs(u)?(c=u/T,Math.abs(T)*Math.sqrt(1+c*c)):u!==0?(c=T/u,Math.abs(u)*Math.sqrt(1+c*c)):0}class Wn{constructor(u){u=Ve.checkMatrix(u);let c=u.clone(),i=u.rows,f=u.columns,m=new Float64Array(f),k,B,G,V;for(G=0;G=0;V--){for(G=0;G=0;B--){for(m=0;m=0;H--)if(ct[H]!==0){for(let mt=H+1;mt=0;H--){if(H0;){let H,mt;for(H=Ut-2;H>=-1&&H!==-1;H--){const Rt=Number.MIN_VALUE+ae*Math.abs(ct[H]+Math.abs(ct[H+1]));if(Math.abs(J[H])<=Rt||Number.isNaN(J[H])){J[H]=0;break}}if(H===Ut-2)mt=4;else{let Rt;for(Rt=Ut-1;Rt>=H&&Rt!==H;Rt--){let Nt=(Rt!==Ut?Math.abs(J[Rt]):0)+(Rt!==H+1?Math.abs(J[Rt-1]):0);if(Math.abs(ct[Rt])<=ae*Nt){ct[Rt]=0;break}}Rt===H?mt=3:Rt===Ut-1?mt=1:(mt=2,H=Rt)}switch(H++,mt){case 1:{let Rt=J[Ut-2];J[Ut-2]=0;for(let Nt=Ut-2;Nt>=H;Nt--){let we=on(ct[Nt],Rt),ue=ct[Nt]/we,he=Rt/we;if(ct[Nt]=we,Nt!==H&&(Rt=-he*J[Nt-1],J[Nt-1]=ue*J[Nt-1]),V)for(let pe=0;pe=ct[H+1]);){let Rt=ct[H];if(ct[H]=ct[H+1],ct[H+1]=Rt,V&&Hc&&m.set(rt,Z,u.get(rt,Z)/this.s[Z]);let k=this.U,B=k.rows,G=k.columns,V=new It(i,B);for(let rt=0;rtu&&c++;return c}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return It.diag(this.s)}}function Er(T,u=!1){return T=Ve.checkMatrix(T),u?new fn(T).inverse():Cn(T,It.eye(T.rows))}function Cn(T,u,c=!1){return T=Ve.checkMatrix(T),u=Ve.checkMatrix(u),c?new fn(T).solve(u):T.isSquare()?new Rn(T).solve(u):new Wn(T).solve(u)}function Dn(T){if(T=It.checkMatrix(T),T.isSquare()){if(T.columns===0)return 1;let u,c,i,f;if(T.columns===2)return u=T.get(0,0),c=T.get(0,1),i=T.get(1,0),f=T.get(1,1),u*f-c*i;if(T.columns===3){let m,k,B;return m=new Yt(T,[1,2],[1,2]),k=new Yt(T,[1,2],[0,2]),B=new Yt(T,[1,2],[0,1]),u=T.get(0,0),c=T.get(0,1),i=T.get(0,2),u*Dn(m)-c*Dn(k)+i*Dn(B)}else return new Rn(T).determinant}else throw Error("determinant can only be calculated for a square matrix")}function br(T,u){let c=[];for(let i=0;if)return new Array(u.rows+1).fill(0);{let m=u.addRow(c,[0]);for(let k=0;ku?m[k]=1/m[k]:m[k]=0;return f.mmul(It.diag(m).mmul(i.transpose()))}function Sr(T,u=T,c={}){T=new It(T);let i=!1;if(typeof u=="object"&&!It.isMatrix(u)&&!ot.isAnyArray(u)?(c=u,u=T,i=!0):u=new It(u),T.rows!==u.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:f=!0}=c;f&&(T=T.center("column"),i||(u=u.center("column")));const m=T.transpose().mmul(u);for(let k=0;k0?f.set(m,m+1,c[m]):c[m]<0&&f.set(m,m-1,c[m])}return f}}function es(T,u,c,i){let f,m,k,B,G,V,rt,Z;for(G=0;G0;B--){for(Z=0,k=0,V=0;V0&&(m=-m),u[B]=Z*m,k=k-f*m,c[B-1]=f-m,G=0;GV)do{for(f=c[V],Z=(c[V+1]-f)/(2*u[V]),lt=on(Z,1),Z<0&&(lt=-lt),c[V]=u[V]/(Z+lt),c[V+1]=u[V]*(Z+lt),At=c[V+1],m=f-c[V],k=V+2;k=V;k--)for(Lt=pt,pt=ct,Ct=Ot,f=ct*u[k],m=ct*Z,lt=on(Z,u[k]),u[k+1]=Ot*lt,Ot=u[k]/lt,ct=Z/lt,Z=ct*c[k]-Ot*f,c[k+1]=m+Ot*(ct*f+Ot*c[k]),G=0;Gye*Zt);c[V]=c[V]+Kt,u[V]=0}for(k=0;k=Z;V--)c[V]=u.get(V,Z-1)/lt,G+=c[V]*c[V];for(B=Math.sqrt(G),c[Z]>0&&(B=-B),G=G-c[Z]*B,c[Z]=c[Z]-B,rt=Z;rt=Z;V--)k+=c[V]*u.get(V,rt);for(k=k/G,V=Z;V<=m;V++)u.set(V,rt,u.get(V,rt)-k*c[V])}for(V=0;V<=m;V++){for(k=0,rt=m;rt>=Z;rt--)k+=c[rt]*u.get(V,rt);for(k=k/G,rt=Z;rt<=m;rt++)u.set(V,rt,u.get(V,rt)-k*c[rt])}c[Z]=lt*c[Z],u.set(Z,Z-1,lt*B)}}for(V=0;V=f+1;Z--)if(u.get(Z,Z-1)!==0){for(V=Z+1;V<=m;V++)c[V]=u.get(V,Z-1);for(rt=Z;rt<=m;rt++){for(B=0,V=Z;V<=m;V++)B+=c[V]*i.get(V,rt);for(B=B/c[Z]/u.get(Z,Z-1),V=Z;V<=m;V++)i.set(V,rt,i.get(V,rt)+B*c[V])}}}function An(T,u,c,i,f){let m=T-1,k=0,B=T-1,G=Number.EPSILON,V=0,rt=0,Z=0,lt=0,At=0,ct=0,pt=0,Lt=0,J,Ot,Ct,Kt,Zt,ye,Ut,$t,ae,H,mt,Rt,Nt,we,ue;for(J=0;JB)&&(c[J]=f.get(J,J),u[J]=0),Ot=Math.max(J-1,0);Ot=k;){for(Kt=m;Kt>k&&(ct=Math.abs(f.get(Kt-1,Kt-1))+Math.abs(f.get(Kt,Kt)),ct===0&&(ct=rt),!(Math.abs(f.get(Kt,Kt-1))=0){for(pt=Z>=0?Z+pt:Z-pt,c[m-1]=$t+pt,c[m]=c[m-1],pt!==0&&(c[m]=$t-Ut/pt),u[m-1]=0,u[m]=0,$t=f.get(m,m-1),ct=Math.abs($t)+Math.abs(pt),Z=$t/ct,lt=pt/ct,At=Math.sqrt(Z*Z+lt*lt),Z=Z/At,lt=lt/At,Ot=m-1;Ot0)){for(ct=Math.sqrt(ct),ae<$t&&(ct=-ct),ct=$t-Ut/((ae-$t)/2+ct),J=k;J<=m;J++)f.set(J,J,f.get(J,J)-ct);V+=ct,$t=ae=Ut=.964}for(Lt=Lt+1,Zt=m-2;Zt>=Kt&&(pt=f.get(Zt,Zt),At=$t-pt,ct=ae-pt,Z=(At*ct-Ut)/f.get(Zt+1,Zt)+f.get(Zt,Zt+1),lt=f.get(Zt+1,Zt+1)-pt-At-ct,At=f.get(Zt+2,Zt+1),ct=Math.abs(Z)+Math.abs(lt)+Math.abs(At),Z=Z/ct,lt=lt/ct,At=At/ct,!(Zt===Kt||Math.abs(f.get(Zt,Zt-1))*(Math.abs(lt)+Math.abs(At))Zt+2&&f.set(J,J-3,0);for(Ct=Zt;Ct<=m-1&&(we=Ct!==m-1,Ct!==Zt&&(Z=f.get(Ct,Ct-1),lt=f.get(Ct+1,Ct-1),At=we?f.get(Ct+2,Ct-1):0,$t=Math.abs(Z)+Math.abs(lt)+Math.abs(At),$t!==0&&(Z=Z/$t,lt=lt/$t,At=At/$t)),$t!==0);Ct++)if(ct=Math.sqrt(Z*Z+lt*lt+At*At),Z<0&&(ct=-ct),ct!==0){for(Ct!==Zt?f.set(Ct,Ct-1,-ct*$t):Kt!==Zt&&f.set(Ct,Ct-1,-f.get(Ct,Ct-1)),Z=Z+ct,$t=Z/ct,ae=lt/ct,pt=At/ct,lt=lt/Z,At=At/Z,Ot=Ct;Ot=0;m--)if(Z=c[m],lt=u[m],lt===0)for(Kt=m,f.set(m,m,1),J=m-1;J>=0;J--){for(Ut=f.get(J,J)-Z,At=0,Ot=Kt;Ot<=m;Ot++)At=At+f.get(J,Ot)*f.get(Ot,m);if(u[J]<0)pt=Ut,ct=At;else if(Kt=J,u[J]===0?f.set(J,m,Ut!==0?-At/Ut:-At/(G*rt)):($t=f.get(J,J+1),ae=f.get(J+1,J),lt=(c[J]-Z)*(c[J]-Z)+u[J]*u[J],ye=($t*ct-pt*At)/lt,f.set(J,m,ye),f.set(J+1,m,Math.abs($t)>Math.abs(pt)?(-At-Ut*ye)/$t:(-ct-ae*ye)/pt)),ye=Math.abs(f.get(J,m)),G*ye*ye>1)for(Ot=J;Ot<=m;Ot++)f.set(Ot,m,f.get(Ot,m)/ye)}else if(lt<0)for(Kt=m-1,Math.abs(f.get(m,m-1))>Math.abs(f.get(m-1,m))?(f.set(m-1,m-1,lt/f.get(m,m-1)),f.set(m-1,m,-(f.get(m,m)-Z)/f.get(m,m-1))):(ue=zn(0,-f.get(m-1,m),f.get(m-1,m-1)-Z,lt),f.set(m-1,m-1,ue[0]),f.set(m-1,m,ue[1])),f.set(m,m-1,0),f.set(m,m,1),J=m-2;J>=0;J--){for(H=0,mt=0,Ot=Kt;Ot<=m;Ot++)H=H+f.get(J,Ot)*f.get(Ot,m-1),mt=mt+f.get(J,Ot)*f.get(Ot,m);if(Ut=f.get(J,J)-Z,u[J]<0)pt=Ut,At=H,ct=mt;else if(Kt=J,u[J]===0?(ue=zn(-H,-mt,Ut,lt),f.set(J,m-1,ue[0]),f.set(J,m,ue[1])):($t=f.get(J,J+1),ae=f.get(J+1,J),Rt=(c[J]-Z)*(c[J]-Z)+u[J]*u[J]-lt*lt,Nt=(c[J]-Z)*2*lt,Rt===0&&Nt===0&&(Rt=G*rt*(Math.abs(Ut)+Math.abs(lt)+Math.abs($t)+Math.abs(ae)+Math.abs(pt))),ue=zn($t*At-pt*H+lt*mt,$t*ct-pt*mt-lt*H,Rt,Nt),f.set(J,m-1,ue[0]),f.set(J,m,ue[1]),Math.abs($t)>Math.abs(pt)+Math.abs(lt)?(f.set(J+1,m-1,(-H-Ut*f.get(J,m-1)+lt*f.get(J,m))/$t),f.set(J+1,m,(-mt-Ut*f.get(J,m)-lt*f.get(J,m-1))/$t)):(ue=zn(-At-ae*f.get(J,m-1),-ct-ae*f.get(J,m),pt,lt),f.set(J+1,m-1,ue[0]),f.set(J+1,m,ue[1]))),ye=Math.max(Math.abs(f.get(J,m-1)),Math.abs(f.get(J,m))),G*ye*ye>1)for(Ot=J;Ot<=m;Ot++)f.set(Ot,m-1,f.get(Ot,m-1)/ye),f.set(Ot,m,f.get(Ot,m)/ye)}for(J=0;JB)for(Ot=J;Ot=k;Ot--)for(J=k;J<=B;J++){for(pt=0,Ct=k;Ct<=Math.min(Ot,B);Ct++)pt=pt+i.get(J,Ct)*f.get(Ct,Ot);i.set(J,Ot,pt)}}}function zn(T,u,c,i){let f,m;return Math.abs(c)>Math.abs(i)?(f=i/c,m=c+f*i,[(T+f*u)/m,(u-f*T)/m]):(f=c/i,m=i+f*c,[(f*T+u)/m,(f*u-T)/m])}class ir{constructor(u){if(u=Ve.checkMatrix(u),!u.isSymmetric())throw new Error("Matrix is not symmetric");let c=u,i=c.rows,f=new It(i,i),m=!0,k,B,G;for(B=0;B0),f.set(B,B,Math.sqrt(Math.max(V,0))),G=B+1;G=0;G--)for(B=0;Bk;At++)Z=u.transpose().mmul(B).div(B.transpose().mmul(B).get(0,0)),Z=Z.div(Z.norm()),V=u.mmul(Z).div(Z.transpose().mmul(Z).get(0,0)),At>0&&(G=V.clone().sub(lt).pow(2).sum()),lt=V.clone(),i?(rt=i.transpose().mmul(V).div(V.transpose().mmul(V).get(0,0)),rt=rt.div(rt.norm()),B=i.mmul(rt).div(rt.transpose().mmul(rt).get(0,0))):B=V;if(i){let At=u.transpose().mmul(V).div(V.transpose().mmul(V).get(0,0));At=At.div(At.norm());let ct=u.clone().sub(V.clone().mmul(At.transpose())),pt=B.transpose().mmul(V).div(V.transpose().mmul(V).get(0,0)),Lt=i.clone().sub(V.clone().mulS(pt.get(0,0)).mmul(rt.transpose()));this.t=V,this.p=At.transpose(),this.w=Z.transpose(),this.q=rt,this.u=B,this.s=V.transpose().mmul(V),this.xResidual=ct,this.yResidual=Lt,this.betas=pt}else this.w=Z.transpose(),this.s=V.transpose().mmul(V).sqrt(),f?this.t=V.clone().div(this.s.get(0,0)):this.t=V,this.xResidual=u.sub(V.mmul(Z.transpose()))}}P.XA=Wt,P.a_=ir,P.yQ=ir,P.Hs=Se,P.Ec=Yn,P.dx=Yn,P.LU=Rn,P.Rm=Rn,P.y3=It,P.qK=nr,P.pb=wn,P.j=hn,P.sO=ke,P.BZ=Pn,P.EK=sn,P.Db=Yt,P.Fx=Ln,P.tU=_e,P.Ym=$n,P.rs=$n,P.QR=Wn,P.TB=Wn,P.oH=fn,P.Sc=fn,P.BN=De,P.it=Ze,P.$r=Ve,P.QM=rr,P.AV=Sr,l=It,P.GH=Dn,P.SO=Er,P.uZ=Mr,P.yU=xn,P.F1=Cn,P.re=xr},70681:function(w,P,a){w.exports={graphlib:a(70574),layout:a(98123),debug:a(27570),util:{time:a(11138).time,notime:a(11138).notime},version:a(88177)}},92188:function(w,P,a){"use strict";var l=a(38436),x=a(74079);w.exports={run:E,undo:v};function E(N){var S=N.graph().acyclicer==="greedy"?x(N,M(N)):b(N);l.forEach(S,function(A){var I=N.edge(A);N.removeEdge(A),I.forwardName=A.name,I.reversed=!0,N.setEdge(A.w,A.v,I,l.uniqueId("rev"))});function M(A){return function(I){return A.edge(I).weight}}}function b(N){var S=[],M={},A={};function I(j){l.has(A,j)||(A[j]=!0,M[j]=!0,l.forEach(N.outEdges(j),function(D){l.has(M,D.w)?S.push(D):I(D.w)}),delete M[j])}return l.forEach(N.nodes(),I),S}function v(N){l.forEach(N.edges(),function(S){var M=N.edge(S);if(M.reversed){N.removeEdge(S);var A=M.forwardName;delete M.reversed,delete M.forwardName,N.setEdge(S.w,S.v,M,A)}})}},61133:function(w,P,a){var l=a(38436),x=a(11138);w.exports=E;function E(v){function N(S){var M=v.children(S),A=v.node(S);if(M.length&&l.forEach(M,N),l.has(A,"minRank")){A.borderLeft=[],A.borderRight=[];for(var I=A.minRank,j=A.maxRank+1;I0;--_)if(nt=j[_].dequeue(),nt){$=$.concat(S(I,j,D,nt,!0));break}}}return $}function S(I,j,D,$,K){var ot=K?[]:void 0;return l.forEach(I.inEdges($.v),function(nt){var _=I.edge(nt),et=I.node(nt.v);K&&ot.push({v:nt.v,w:nt.w}),et.out-=_,A(j,D,et)}),l.forEach(I.outEdges($.v),function(nt){var _=I.edge(nt),et=nt.w,tt=I.node(et);tt.in-=_,A(j,D,tt)}),I.removeNode($.v),ot}function M(I,j){var D=new x,$=0,K=0;l.forEach(I.nodes(),function(_){D.setNode(_,{v:_,in:0,out:0})}),l.forEach(I.edges(),function(_){var et=D.edge(_.v,_.w)||0,tt=j(_),it=et+tt;D.setEdge(_.v,_.w,it),K=Math.max(K,D.node(_.v).out+=tt),$=Math.max($,D.node(_.w).in+=tt)});var ot=l.range(K+$+3).map(function(){return new E}),nt=$+1;return l.forEach(D.nodes(),function(_){A(ot,nt,D.node(_))}),{graph:D,buckets:ot,zeroIdx:nt}}function A(I,j,D){D.out?D.in?I[D.out-D.in+j].enqueue(D):I[I.length-1].enqueue(D):I[0].enqueue(D)}},98123:function(w,P,a){"use strict";var l=a(38436),x=a(92188),E=a(45995),b=a(78093),v=a(11138).normalizeRanks,N=a(24219),S=a(11138).removeEmptyRanks,M=a(72981),A=a(61133),I=a(53258),j=a(53408),D=a(17873),$=a(11138),K=a(70574).Graph;w.exports=ot;function ot(gt,wt){var jt=wt&&wt.debugTiming?$.time:$.notime;jt("layout",function(){var Ft=jt(" buildLayoutGraph",function(){return yt(gt)});jt(" runLayout",function(){nt(Ft,jt)}),jt(" updateInputGraph",function(){_(gt,Ft)})})}function nt(gt,wt){wt(" makeSpaceForEdgeLabels",function(){Mt(gt)}),wt(" removeSelfEdges",function(){xe(gt)}),wt(" acyclic",function(){x.run(gt)}),wt(" nestingGraph.run",function(){M.run(gt)}),wt(" rank",function(){b($.asNonCompoundGraph(gt))}),wt(" injectEdgeLabelProxies",function(){St(gt)}),wt(" removeEmptyRanks",function(){S(gt)}),wt(" nestingGraph.cleanup",function(){M.cleanup(gt)}),wt(" normalizeRanks",function(){v(gt)}),wt(" assignRankMinMax",function(){Bt(gt)}),wt(" removeEdgeLabelProxies",function(){Vt(gt)}),wt(" normalize.run",function(){E.run(gt)}),wt(" parentDummyChains",function(){N(gt)}),wt(" addBorderSegments",function(){A(gt)}),wt(" order",function(){j(gt)}),wt(" insertSelfEdges",function(){mn(gt)}),wt(" adjustCoordinateSystem",function(){I.adjust(gt)}),wt(" position",function(){D(gt)}),wt(" positionSelfEdges",function(){On(gt)}),wt(" removeBorderNodes",function(){nn(gt)}),wt(" normalize.undo",function(){E.undo(gt)}),wt(" fixupEdgeLabelCoords",function(){ce(gt)}),wt(" undoCoordinateSystem",function(){I.undo(gt)}),wt(" translateGraph",function(){qt(gt)}),wt(" assignNodeIntersects",function(){te(gt)}),wt(" reversePoints",function(){ze(gt)}),wt(" acyclic.undo",function(){x.undo(gt)})}function _(gt,wt){l.forEach(gt.nodes(),function(jt){var Ft=gt.node(jt),Ht=wt.node(jt);Ft&&(Ft.x=Ht.x,Ft.y=Ht.y,wt.children(jt).length&&(Ft.width=Ht.width,Ft.height=Ht.height))}),l.forEach(gt.edges(),function(jt){var Ft=gt.edge(jt),Ht=wt.edge(jt);Ft.points=Ht.points,l.has(Ht,"x")&&(Ft.x=Ht.x,Ft.y=Ht.y)}),gt.graph().width=wt.graph().width,gt.graph().height=wt.graph().height}var et=["nodesep","edgesep","ranksep","marginx","marginy"],tt={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},it=["acyclicer","ranker","rankdir","align"],at=["width","height"],ft={width:0,height:0},ht=["minlen","weight","width","height","labeloffset"],dt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},xt=["labelpos"];function yt(gt){var wt=new K({multigraph:!0,compound:!0}),jt=rn(gt.graph());return wt.setGraph(l.merge({},tt,ln(jt,et),l.pick(jt,it))),l.forEach(gt.nodes(),function(Ft){var Ht=rn(gt.node(Ft));wt.setNode(Ft,l.defaults(ln(Ht,at),ft)),wt.setParent(Ft,gt.parent(Ft))}),l.forEach(gt.edges(),function(Ft){var Ht=rn(gt.edge(Ft));wt.setEdge(Ft,l.merge({},dt,ln(Ht,ht),l.pick(Ht,xt)))}),wt}function Mt(gt){var wt=gt.graph();wt.ranksep/=2,l.forEach(gt.edges(),function(jt){var Ft=gt.edge(jt);Ft.minlen*=2,Ft.labelpos.toLowerCase()!=="c"&&(wt.rankdir==="TB"||wt.rankdir==="BT"?Ft.width+=Ft.labeloffset:Ft.height+=Ft.labeloffset)})}function St(gt){l.forEach(gt.edges(),function(wt){var jt=gt.edge(wt);if(jt.width&&jt.height){var Ft=gt.node(wt.v),Ht=gt.node(wt.w),de={rank:(Ht.rank-Ft.rank)/2+Ft.rank,e:wt};$.addDummyNode(gt,"edge-proxy",de,"_ep")}})}function Bt(gt){var wt=0;l.forEach(gt.nodes(),function(jt){var Ft=gt.node(jt);Ft.borderTop&&(Ft.minRank=gt.node(Ft.borderTop).rank,Ft.maxRank=gt.node(Ft.borderBottom).rank,wt=l.max(wt,Ft.maxRank))}),gt.graph().maxRank=wt}function Vt(gt){l.forEach(gt.nodes(),function(wt){var jt=gt.node(wt);jt.dummy==="edge-proxy"&&(gt.edge(jt.e).labelRank=jt.rank,gt.removeNode(wt))})}function qt(gt){var wt=Number.POSITIVE_INFINITY,jt=0,Ft=Number.POSITIVE_INFINITY,Ht=0,de=gt.graph(),ge=de.marginx||0,Re=de.marginy||0;function dn(Ce){var Ne=Ce.x,se=Ce.y,Wt=Ce.width,ee=Ce.height;wt=Math.min(wt,Ne-Wt/2),jt=Math.max(jt,Ne+Wt/2),Ft=Math.min(Ft,se-ee/2),Ht=Math.max(Ht,se+ee/2)}l.forEach(gt.nodes(),function(Ce){dn(gt.node(Ce))}),l.forEach(gt.edges(),function(Ce){var Ne=gt.edge(Ce);l.has(Ne,"x")&&dn(Ne)}),wt-=ge,Ft-=Re,l.forEach(gt.nodes(),function(Ce){var Ne=gt.node(Ce);Ne.x-=wt,Ne.y-=Ft}),l.forEach(gt.edges(),function(Ce){var Ne=gt.edge(Ce);l.forEach(Ne.points,function(se){se.x-=wt,se.y-=Ft}),l.has(Ne,"x")&&(Ne.x-=wt),l.has(Ne,"y")&&(Ne.y-=Ft)}),de.width=jt-wt+ge,de.height=Ht-Ft+Re}function te(gt){l.forEach(gt.edges(),function(wt){var jt=gt.edge(wt),Ft=gt.node(wt.v),Ht=gt.node(wt.w),de,ge;jt.points?(de=jt.points[0],ge=jt.points[jt.points.length-1]):(jt.points=[],de=Ht,ge=Ft),jt.points.unshift($.intersectRect(Ft,de)),jt.points.push($.intersectRect(Ht,ge))})}function ce(gt){l.forEach(gt.edges(),function(wt){var jt=gt.edge(wt);if(l.has(jt,"x"))switch((jt.labelpos==="l"||jt.labelpos==="r")&&(jt.width-=jt.labeloffset),jt.labelpos){case"l":jt.x-=jt.width/2+jt.labeloffset;break;case"r":jt.x+=jt.width/2+jt.labeloffset;break}})}function ze(gt){l.forEach(gt.edges(),function(wt){var jt=gt.edge(wt);jt.reversed&&jt.points.reverse()})}function nn(gt){l.forEach(gt.nodes(),function(wt){if(gt.children(wt).length){var jt=gt.node(wt),Ft=gt.node(jt.borderTop),Ht=gt.node(jt.borderBottom),de=gt.node(l.last(jt.borderLeft)),ge=gt.node(l.last(jt.borderRight));jt.width=Math.abs(ge.x-de.x),jt.height=Math.abs(Ht.y-Ft.y),jt.x=de.x+jt.width/2,jt.y=Ft.y+jt.height/2}}),l.forEach(gt.nodes(),function(wt){gt.node(wt).dummy==="border"&>.removeNode(wt)})}function xe(gt){l.forEach(gt.edges(),function(wt){if(wt.v===wt.w){var jt=gt.node(wt.v);jt.selfEdges||(jt.selfEdges=[]),jt.selfEdges.push({e:wt,label:gt.edge(wt)}),gt.removeEdge(wt)}})}function mn(gt){var wt=$.buildLayerMatrix(gt);l.forEach(wt,function(jt){var Ft=0;l.forEach(jt,function(Ht,de){var ge=gt.node(Ht);ge.order=de+Ft,l.forEach(ge.selfEdges,function(Re){$.addDummyNode(gt,"selfedge",{width:Re.label.width,height:Re.label.height,rank:ge.rank,order:de+ ++Ft,e:Re.e,label:Re.label},"_se")}),delete ge.selfEdges})})}function On(gt){l.forEach(gt.nodes(),function(wt){var jt=gt.node(wt);if(jt.dummy==="selfedge"){var Ft=gt.node(jt.e.v),Ht=Ft.x+Ft.width/2,de=Ft.y,ge=jt.x-Ht,Re=Ft.height/2;gt.setEdge(jt.e,jt.label),gt.removeNode(wt),jt.label.points=[{x:Ht+2*ge/3,y:de-Re},{x:Ht+5*ge/6,y:de-Re},{x:Ht+ge,y:de},{x:Ht+5*ge/6,y:de+Re},{x:Ht+2*ge/3,y:de+Re}],jt.label.x=jt.x,jt.label.y=jt.y}})}function ln(gt,wt){return l.mapValues(l.pick(gt,wt),Number)}function rn(gt){var wt={};return l.forEach(gt,function(jt,Ft){wt[Ft.toLowerCase()]=jt}),wt}},38436:function(w,P,a){var l;try{l={cloneDeep:a(50361),constant:a(75703),defaults:a(91747),each:a(85768),filter:a(63105),find:a(13311),flatten:a(85564),forEach:a(84486),forIn:a(62620),has:a(18721),isUndefined:a(52353),last:a(10928),map:a(35161),mapValues:a(8521),max:a(6162),merge:a(82492),min:a(53632),minBy:a(22762),now:a(7771),pick:a(78718),range:a(96026),reduce:a(54061),sortBy:a(89734),uniqueId:a(73955),values:a(52628),zipObject:a(7287)}}catch(x){}l||(l=window._),w.exports=l},72981:function(w,P,a){var l=a(38436),x=a(11138);w.exports={run:E,cleanup:S};function E(M){var A=x.addDummyNode(M,"root",{},"_root"),I=v(M),j=l.max(l.values(I))-1,D=2*j+1;M.graph().nestingRoot=A,l.forEach(M.edges(),function(K){M.edge(K).minlen*=D});var $=N(M)+1;l.forEach(M.children(),function(K){b(M,A,D,$,j,I,K)}),M.graph().nodeRankFactor=D}function b(M,A,I,j,D,$,K){var ot=M.children(K);if(!ot.length){K!==A&&M.setEdge(A,K,{weight:0,minlen:I});return}var nt=x.addBorderNode(M,"_bt"),_=x.addBorderNode(M,"_bb"),et=M.node(K);M.setParent(nt,K),et.borderTop=nt,M.setParent(_,K),et.borderBottom=_,l.forEach(ot,function(tt){b(M,A,I,j,D,$,tt);var it=M.node(tt),at=it.borderTop?it.borderTop:tt,ft=it.borderBottom?it.borderBottom:tt,ht=it.borderTop?j:2*j,dt=at!==ft?1:D-$[K]+1;M.setEdge(nt,at,{weight:ht,minlen:dt,nestingEdge:!0}),M.setEdge(ft,_,{weight:ht,minlen:dt,nestingEdge:!0})}),M.parent(K)||M.setEdge(A,nt,{weight:0,minlen:D+$[K]})}function v(M){var A={};function I(j,D){var $=M.children(j);$&&$.length&&l.forEach($,function(K){I(K,D+1)}),A[j]=D}return l.forEach(M.children(),function(j){I(j,1)}),A}function N(M){return l.reduce(M.edges(),function(A,I){return A+M.edge(I).weight},0)}function S(M){var A=M.graph();M.removeNode(A.nestingRoot),delete A.nestingRoot,l.forEach(M.edges(),function(I){var j=M.edge(I);j.nestingEdge&&M.removeEdge(I)})}},45995:function(w,P,a){"use strict";var l=a(38436),x=a(11138);w.exports={run:E,undo:v};function E(N){N.graph().dummyChains=[],l.forEach(N.edges(),function(S){b(N,S)})}function b(N,S){var M=S.v,A=N.node(M).rank,I=S.w,j=N.node(I).rank,D=S.name,$=N.edge(S),K=$.labelRank;if(j!==A+1){N.removeEdge(S);var ot,nt,_;for(_=0,++A;A0;)K%2&&(ot+=j[K+1]),K=K-1>>1,j[K]+=$.weight;D+=$.weight*ot})),D}},53408:function(w,P,a){"use strict";var l=a(38436),x=a(2588),E=a(56630),b=a(61026),v=a(23128),N=a(55093),S=a(70574).Graph,M=a(11138);w.exports=A;function A($){var K=M.maxRank($),ot=I($,l.range(1,K+1),"inEdges"),nt=I($,l.range(K-1,-1,-1),"outEdges"),_=x($);D($,_);for(var et=Number.POSITIVE_INFINITY,tt,it=0,at=0;at<4;++it,++at){j(it%2?ot:nt,it%4>=2),_=M.buildLayerMatrix($);var ft=E($,_);ft=I.barycenter)&&b(I,j)}}function M(I){return function(j){j.in.push(I),--j.indegree===0&&v.push(j)}}for(;v.length;){var A=v.pop();N.push(A),l.forEach(A.in.reverse(),S(A)),l.forEach(A.out,M(A))}return l.map(l.filter(N,function(I){return!I.merged}),function(I){return l.pick(I,["vs","i","barycenter","weight"])})}function b(v,N){var S=0,M=0;v.weight&&(S+=v.barycenter*v.weight,M+=v.weight),N.weight&&(S+=N.barycenter*N.weight,M+=N.weight),v.vs=N.vs.concat(v.vs),v.barycenter=S/M,v.weight=M,v.i=Math.min(N.i,v.i),N.merged=!0}},61026:function(w,P,a){var l=a(38436),x=a(35439),E=a(83678),b=a(87304);w.exports=v;function v(M,A,I,j){var D=M.children(A),$=M.node(A),K=$?$.borderLeft:void 0,ot=$?$.borderRight:void 0,nt={};K&&(D=l.filter(D,function(ft){return ft!==K&&ft!==ot}));var _=x(M,D);l.forEach(_,function(ft){if(M.children(ft.v).length){var ht=v(M,ft.v,I,j);nt[ft.v]=ht,l.has(ht,"barycenter")&&S(ft,ht)}});var et=E(_,I);N(et,nt);var tt=b(et,j);if(K&&(tt.vs=l.flatten([K,tt.vs,ot],!0),M.predecessors(K).length)){var it=M.node(M.predecessors(K)[0]),at=M.node(M.predecessors(ot)[0]);l.has(tt,"barycenter")||(tt.barycenter=0,tt.weight=0),tt.barycenter=(tt.barycenter*tt.weight+it.order+at.order)/(tt.weight+2),tt.weight+=2}return tt}function N(M,A){l.forEach(M,function(I){I.vs=l.flatten(I.vs.map(function(j){return A[j]?A[j].vs:j}),!0)})}function S(M,A){l.isUndefined(M.barycenter)?(M.barycenter=A.barycenter,M.weight=A.weight):(M.barycenter=(M.barycenter*M.weight+A.barycenter*A.weight)/(M.weight+A.weight),M.weight+=A.weight)}},87304:function(w,P,a){var l=a(38436),x=a(11138);w.exports=E;function E(N,S){var M=x.partition(N,function(nt){return l.has(nt,"barycenter")}),A=M.lhs,I=l.sortBy(M.rhs,function(nt){return-nt.i}),j=[],D=0,$=0,K=0;A.sort(v(!!S)),K=b(j,I,K),l.forEach(A,function(nt){K+=nt.vs.length,j.push(nt.vs),D+=nt.barycenter*nt.weight,$+=nt.weight,K=b(j,I,K)});var ot={vs:l.flatten(j,!0)};return $&&(ot.barycenter=D/$,ot.weight=$),ot}function b(N,S,M){for(var A;S.length&&(A=l.last(S)).i<=M;)S.pop(),N.push(A.vs),M++;return M}function v(N){return function(S,M){return S.barycenterM.barycenter?1:N?M.i-S.i:S.i-M.i}}},24219:function(w,P,a){var l=a(38436);w.exports=x;function x(v){var N=b(v);l.forEach(v.graph().dummyChains,function(S){for(var M=v.node(S),A=M.edgeObj,I=E(v,N,A.v,A.w),j=I.path,D=I.lca,$=0,K=j[$],ot=!0;S!==A.w;){if(M=v.node(S),ot){for(;(K=j[$])!==D&&v.node(K).maxRankj||D>N[$].lim));for(K=$,$=M;($=v.parent($))!==K;)I.push($);return{path:A.concat(I.reverse()),lca:K}}function b(v){var N={},S=0;function M(A){var I=S;l.forEach(v.children(A),M),N[A]={low:I,lim:S++}}return l.forEach(v.children(),M),N}},3573:function(w,P,a){"use strict";var l=a(38436),x=a(70574).Graph,E=a(11138);w.exports={positionX:ot,findType1Conflicts:b,findType2Conflicts:v,addConflict:S,hasConflict:M,verticalAlignment:A,horizontalCompaction:I,alignCoordinates:$,findSmallestWidthAlignment:D,balance:K};function b(et,tt){var it={};function at(ft,ht){var dt=0,xt=0,yt=ft.length,Mt=l.last(ht);return l.forEach(ht,function(St,Bt){var Vt=N(et,St),qt=Vt?et.node(Vt).order:yt;(Vt||St===Mt)&&(l.forEach(ht.slice(xt,Bt+1),function(te){l.forEach(et.predecessors(te),function(ce){var ze=et.node(ce),nn=ze.order;(nnMt)&&S(it,Vt,St)})})}function ft(ht,dt){var xt=-1,yt,Mt=0;return l.forEach(dt,function(St,Bt){if(et.node(St).dummy==="border"){var Vt=et.predecessors(St);Vt.length&&(yt=et.node(Vt[0]).order,at(dt,Mt,Bt,xt,yt),Mt=Bt,xt=yt)}at(dt,Mt,dt.length,yt,ht.length)}),dt}return l.reduce(tt,ft),it}function N(et,tt){if(et.node(tt).dummy)return l.find(et.predecessors(tt),function(it){return et.node(it).dummy})}function S(et,tt,it){if(tt>it){var at=tt;tt=it,it=at}var ft=et[tt];ft||(et[tt]=ft={}),ft[it]=!0}function M(et,tt,it){if(tt>it){var at=tt;tt=it,it=at}return l.has(et[tt],it)}function A(et,tt,it,at){var ft={},ht={},dt={};return l.forEach(tt,function(xt){l.forEach(xt,function(yt,Mt){ft[yt]=yt,ht[yt]=yt,dt[yt]=Mt})}),l.forEach(tt,function(xt){var yt=-1;l.forEach(xt,function(Mt){var St=at(Mt);if(St.length){St=l.sortBy(St,function(ce){return dt[ce]});for(var Bt=(St.length-1)/2,Vt=Math.floor(Bt),qt=Math.ceil(Bt);Vt<=qt;++Vt){var te=St[Vt];ht[Mt]===Mt&&ytyt.lim&&(Mt=yt,St=!0);var Bt=l.filter(at.edges(),function(Vt){return St===tt(it,it.node(Vt.v),Mt)&&St!==tt(it,it.node(Vt.w),Mt)});return l.minBy(Bt,function(Vt){return E(at,Vt)})}function nt(it,at,ft,ht){var dt=ft.v,xt=ft.w;it.removeEdge(dt,xt),it.setEdge(ht.v,ht.w,{}),D(it),A(it,at),_(it,at)}function _(it,at){var ft=l.find(it.nodes(),function(dt){return!at.node(dt).parent}),ht=v(it,ft);ht=ht.slice(1),l.forEach(ht,function(dt){var xt=it.node(dt).parent,yt=at.edge(dt,xt),Mt=!1;yt||(yt=at.edge(xt,dt),Mt=!0),at.node(dt).rank=at.node(xt).rank+(Mt?yt.minlen:-yt.minlen)})}function et(it,at,ft){return it.hasEdge(at,ft)}function tt(it,at,ft){return ft.low<=at.lim&&at.lim<=ft.lim}},76681:function(w,P,a){"use strict";var l=a(38436);w.exports={longestPath:x,slack:E};function x(b){var v={};function N(S){var M=b.node(S);if(l.has(v,S))return M.rank;v[S]=!0;var A=l.min(l.map(b.outEdges(S),function(I){return N(I.w)-b.edge(I).minlen}));return(A===Number.POSITIVE_INFINITY||A===void 0||A===null)&&(A=0),M.rank=A}l.forEach(b.sources(),N)}function E(b,v){return b.node(v.w).rank-b.node(v.v).rank-b.edge(v).minlen}},11138:function(w,P,a){"use strict";var l=a(38436),x=a(70574).Graph;w.exports={addDummyNode:E,simplify:b,asNonCompoundGraph:v,successorWeights:N,predecessorWeights:S,intersectRect:M,buildLayerMatrix:A,normalizeRanks:I,removeEmptyRanks:j,addBorderNode:D,maxRank:$,partition:K,time:ot,notime:nt};function E(_,et,tt,it){var at;do at=l.uniqueId(it);while(_.hasNode(at));return tt.dummy=et,_.setNode(at,tt),at}function b(_){var et=new x().setGraph(_.graph());return l.forEach(_.nodes(),function(tt){et.setNode(tt,_.node(tt))}),l.forEach(_.edges(),function(tt){var it=et.edge(tt.v,tt.w)||{weight:0,minlen:1},at=_.edge(tt);et.setEdge(tt.v,tt.w,{weight:it.weight+at.weight,minlen:Math.max(it.minlen,at.minlen)})}),et}function v(_){var et=new x({multigraph:_.isMultigraph()}).setGraph(_.graph());return l.forEach(_.nodes(),function(tt){_.children(tt).length||et.setNode(tt,_.node(tt))}),l.forEach(_.edges(),function(tt){et.setEdge(tt,_.edge(tt))}),et}function N(_){var et=l.map(_.nodes(),function(tt){var it={};return l.forEach(_.outEdges(tt),function(at){it[at.w]=(it[at.w]||0)+_.edge(at).weight}),it});return l.zipObject(_.nodes(),et)}function S(_){var et=l.map(_.nodes(),function(tt){var it={};return l.forEach(_.inEdges(tt),function(at){it[at.v]=(it[at.v]||0)+_.edge(at).weight}),it});return l.zipObject(_.nodes(),et)}function M(_,et){var tt=_.x,it=_.y,at=et.x-tt,ft=et.y-it,ht=_.width/2,dt=_.height/2;if(!at&&!ft)throw new Error("Not possible to find intersection inside of the rectangle");var xt,yt;return Math.abs(ft)*ht>Math.abs(at)*dt?(ft<0&&(dt=-dt),xt=dt*at/ft,yt=dt):(at<0&&(ht=-ht),xt=ht,yt=ht*ft/at),{x:tt+xt,y:it+yt}}function A(_){var et=l.map(l.range($(_)+1),function(){return[]});return l.forEach(_.nodes(),function(tt){var it=_.node(tt),at=it.rank;l.isUndefined(at)||(et[at][it.order]=tt)}),et}function I(_){var et=l.min(l.map(_.nodes(),function(tt){return _.node(tt).rank}));l.forEach(_.nodes(),function(tt){var it=_.node(tt);l.has(it,"rank")&&(it.rank-=et)})}function j(_){var et=l.min(l.map(_.nodes(),function(ft){return _.node(ft).rank})),tt=[];l.forEach(_.nodes(),function(ft){var ht=_.node(ft).rank-et;tt[ht]||(tt[ht]=[]),tt[ht].push(ft)});var it=0,at=_.graph().nodeRankFactor;l.forEach(tt,function(ft,ht){l.isUndefined(ft)&&ht%at!==0?--it:it&&l.forEach(ft,function(dt){_.node(dt).rank+=it})})}function D(_,et,tt,it){var at={width:0,height:0};return arguments.length>=4&&(at.rank=tt,at.order=it),E(_,"border",at,et)}function $(_){return l.max(l.map(_.nodes(),function(et){var tt=_.node(et).rank;if(!l.isUndefined(tt))return tt}))}function K(_,et){var tt={lhs:[],rhs:[]};return l.forEach(_,function(it){et(it)?tt.lhs.push(it):tt.rhs.push(it)}),tt}function ot(_,et){var tt=l.now();try{return et()}finally{console.log(_+" time: "+(l.now()-tt)+"ms")}}function nt(_,et){return et()}},88177:function(w){w.exports="0.8.5"},28282:function(w,P,a){var l=a(82354);w.exports={Graph:l.Graph,json:a(28974),alg:a(12440),version:l.version}},2842:function(w,P,a){var l=a(89126);w.exports=x;function x(E){var b={},v=[],N;function S(M){l.has(b,M)||(b[M]=!0,N.push(M),l.each(E.successors(M),S),l.each(E.predecessors(M),S))}return l.each(E.nodes(),function(M){N=[],S(M),N.length&&v.push(N)}),v}},53984:function(w,P,a){var l=a(89126);w.exports=x;function x(b,v,N){l.isArray(v)||(v=[v]);var S=(b.isDirected()?b.successors:b.neighbors).bind(b),M=[],A={};return l.each(v,function(I){if(!b.hasNode(I))throw new Error("Graph does not have node: "+I);E(b,I,N==="post",A,S,M)}),M}function E(b,v,N,S,M,A){l.has(S,v)||(S[v]=!0,N||A.push(v),l.each(M(v),function(I){E(b,I,N,S,M,A)}),N&&A.push(v))}},84847:function(w,P,a){var l=a(63763),x=a(89126);w.exports=E;function E(b,v,N){return x.transform(b.nodes(),function(S,M){S[M]=l(b,M,v,N)},{})}},63763:function(w,P,a){var l=a(89126),x=a(75639);w.exports=b;var E=l.constant(1);function b(N,S,M,A){return v(N,String(S),M||E,A||function(I){return N.outEdges(I)})}function v(N,S,M,A){var I={},j=new x,D,$,K=function(ot){var nt=ot.v!==D?ot.v:ot.w,_=I[nt],et=M(ot),tt=$.distance+et;if(et<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+ot+" Weight: "+et);tt<_.distance&&(_.distance=tt,_.predecessor=D,j.decrease(nt,tt))};for(N.nodes().forEach(function(ot){var nt=ot===S?0:Number.POSITIVE_INFINITY;I[ot]={distance:nt},j.add(ot,nt)});j.size()>0&&(D=j.removeMin(),$=I[D],$.distance!==Number.POSITIVE_INFINITY);)A(D).forEach(K);return I}},9096:function(w,P,a){var l=a(89126),x=a(5023);w.exports=E;function E(b){return l.filter(x(b),function(v){return v.length>1||v.length===1&&b.hasEdge(v[0],v[0])})}},38924:function(w,P,a){var l=a(89126);w.exports=E;var x=l.constant(1);function E(v,N,S){return b(v,N||x,S||function(M){return v.outEdges(M)})}function b(v,N,S){var M={},A=v.nodes();return A.forEach(function(I){M[I]={},M[I][I]={distance:0},A.forEach(function(j){I!==j&&(M[I][j]={distance:Number.POSITIVE_INFINITY})}),S(I).forEach(function(j){var D=j.v===I?j.w:j.v,$=N(j);M[I][D]={distance:$,predecessor:I}})}),A.forEach(function(I){var j=M[I];A.forEach(function(D){var $=M[D];A.forEach(function(K){var ot=$[I],nt=j[K],_=$[K],et=ot.distance+nt.distance;et<_.distance&&(_.distance=et,_.predecessor=nt.predecessor)})})}),M}},12440:function(w,P,a){w.exports={components:a(2842),dijkstra:a(63763),dijkstraAll:a(84847),findCycles:a(9096),floydWarshall:a(38924),isAcyclic:a(62707),postorder:a(58828),preorder:a(92648),prim:a(80514),tarjan:a(5023),topsort:a(2166)}},62707:function(w,P,a){var l=a(2166);w.exports=x;function x(E){try{l(E)}catch(b){if(b instanceof l.CycleException)return!1;throw b}return!0}},58828:function(w,P,a){var l=a(53984);w.exports=x;function x(E,b){return l(E,b,"post")}},92648:function(w,P,a){var l=a(53984);w.exports=x;function x(E,b){return l(E,b,"pre")}},80514:function(w,P,a){var l=a(89126),x=a(30771),E=a(75639);w.exports=b;function b(v,N){var S=new x,M={},A=new E,I;function j($){var K=$.v===I?$.w:$.v,ot=A.priority(K);if(ot!==void 0){var nt=N($);nt0;){if(I=A.removeMin(),l.has(M,I))S.setEdge(I,M[I]);else{if(D)throw new Error("Input graph is not connected: "+v);D=!0}v.nodeEdges(I).forEach(j)}return S}},5023:function(w,P,a){var l=a(89126);w.exports=x;function x(E){var b=0,v=[],N={},S=[];function M(A){var I=N[A]={onStack:!0,lowlink:b,index:b++};if(v.push(A),E.successors(A).forEach(function($){l.has(N,$)?N[$].onStack&&(I.lowlink=Math.min(I.lowlink,N[$].index)):(M($),I.lowlink=Math.min(I.lowlink,N[$].lowlink))}),I.lowlink===I.index){var j=[],D;do D=v.pop(),N[D].onStack=!1,j.push(D);while(A!==D);S.push(j)}}return E.nodes().forEach(function(A){l.has(N,A)||M(A)}),S}},2166:function(w,P,a){var l=a(89126);w.exports=x,x.CycleException=E;function x(b){var v={},N={},S=[];function M(A){if(l.has(N,A))throw new E;l.has(v,A)||(N[A]=!0,v[A]=!0,l.each(b.predecessors(A),M),delete N[A],S.push(A))}if(l.each(b.sinks(),M),l.size(v)!==b.nodeCount())throw new E;return S}function E(){}E.prototype=new Error},75639:function(w,P,a){var l=a(89126);w.exports=x;function x(){this._arr=[],this._keyIndices={}}x.prototype.size=function(){return this._arr.length},x.prototype.keys=function(){return this._arr.map(function(E){return E.key})},x.prototype.has=function(E){return l.has(this._keyIndices,E)},x.prototype.priority=function(E){var b=this._keyIndices[E];if(b!==void 0)return this._arr[b].priority},x.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},x.prototype.add=function(E,b){var v=this._keyIndices;if(E=String(E),!l.has(v,E)){var N=this._arr,S=N.length;return v[E]=S,N.push({key:E,priority:b}),this._decrease(S),!0}return!1},x.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var E=this._arr.pop();return delete this._keyIndices[E.key],this._heapify(0),E.key},x.prototype.decrease=function(E,b){var v=this._keyIndices[E];if(b>this._arr[v].priority)throw new Error("New priority is greater than current priority. Key: "+E+" Old: "+this._arr[v].priority+" New: "+b);this._arr[v].priority=b,this._decrease(v)},x.prototype._heapify=function(E){var b=this._arr,v=2*E,N=v+1,S=E;v>1,!(b[N].priority1?K.setNode(ot,D):K.setNode(ot)}),this},v.prototype.setNode=function(j,D){return l.has(this._nodes,j)?(arguments.length>1&&(this._nodes[j]=D),this):(this._nodes[j]=arguments.length>1?D:this._defaultNodeLabelFn(j),this._isCompound&&(this._parent[j]=E,this._children[j]={},this._children[E][j]=!0),this._in[j]={},this._preds[j]={},this._out[j]={},this._sucs[j]={},++this._nodeCount,this)},v.prototype.node=function(j){return this._nodes[j]},v.prototype.hasNode=function(j){return l.has(this._nodes,j)},v.prototype.removeNode=function(j){var D=this;if(l.has(this._nodes,j)){var $=function(K){D.removeEdge(D._edgeObjs[K])};delete this._nodes[j],this._isCompound&&(this._removeFromParentsChildList(j),delete this._parent[j],l.each(this.children(j),function(K){D.setParent(K)}),delete this._children[j]),l.each(l.keys(this._in[j]),$),delete this._in[j],delete this._preds[j],l.each(l.keys(this._out[j]),$),delete this._out[j],delete this._sucs[j],--this._nodeCount}return this},v.prototype.setParent=function(j,D){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(l.isUndefined(D))D=E;else{D+="";for(var $=D;!l.isUndefined($);$=this.parent($))if($===j)throw new Error("Setting "+D+" as parent of "+j+" would create a cycle");this.setNode(D)}return this.setNode(j),this._removeFromParentsChildList(j),this._parent[j]=D,this._children[D][j]=!0,this},v.prototype._removeFromParentsChildList=function(j){delete this._children[this._parent[j]][j]},v.prototype.parent=function(j){if(this._isCompound){var D=this._parent[j];if(D!==E)return D}},v.prototype.children=function(j){if(l.isUndefined(j)&&(j=E),this._isCompound){var D=this._children[j];if(D)return l.keys(D)}else{if(j===E)return this.nodes();if(this.hasNode(j))return[]}},v.prototype.predecessors=function(j){var D=this._preds[j];if(D)return l.keys(D)},v.prototype.successors=function(j){var D=this._sucs[j];if(D)return l.keys(D)},v.prototype.neighbors=function(j){var D=this.predecessors(j);if(D)return l.union(D,this.successors(j))},v.prototype.isLeaf=function(j){var D;return this.isDirected()?D=this.successors(j):D=this.neighbors(j),D.length===0},v.prototype.filterNodes=function(j){var D=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});D.setGraph(this.graph());var $=this;l.each(this._nodes,function(nt,_){j(_)&&D.setNode(_,nt)}),l.each(this._edgeObjs,function(nt){D.hasNode(nt.v)&&D.hasNode(nt.w)&&D.setEdge(nt,$.edge(nt))});var K={};function ot(nt){var _=$.parent(nt);return _===void 0||D.hasNode(_)?(K[nt]=_,_):_ in K?K[_]:ot(_)}return this._isCompound&&l.each(D.nodes(),function(nt){D.setParent(nt,ot(nt))}),D},v.prototype.setDefaultEdgeLabel=function(j){return l.isFunction(j)||(j=l.constant(j)),this._defaultEdgeLabelFn=j,this},v.prototype.edgeCount=function(){return this._edgeCount},v.prototype.edges=function(){return l.values(this._edgeObjs)},v.prototype.setPath=function(j,D){var $=this,K=arguments;return l.reduce(j,function(ot,nt){return K.length>1?$.setEdge(ot,nt,D):$.setEdge(ot,nt),nt}),this},v.prototype.setEdge=function(){var j,D,$,K,ot=!1,nt=arguments[0];typeof nt=="object"&&nt!==null&&"v"in nt?(j=nt.v,D=nt.w,$=nt.name,arguments.length===2&&(K=arguments[1],ot=!0)):(j=nt,D=arguments[1],$=arguments[3],arguments.length>2&&(K=arguments[2],ot=!0)),j=""+j,D=""+D,l.isUndefined($)||($=""+$);var _=M(this._isDirected,j,D,$);if(l.has(this._edgeLabels,_))return ot&&(this._edgeLabels[_]=K),this;if(!l.isUndefined($)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(j),this.setNode(D),this._edgeLabels[_]=ot?K:this._defaultEdgeLabelFn(j,D,$);var et=A(this._isDirected,j,D,$);return j=et.v,D=et.w,Object.freeze(et),this._edgeObjs[_]=et,N(this._preds[D],j),N(this._sucs[j],D),this._in[D][_]=et,this._out[j][_]=et,this._edgeCount++,this},v.prototype.edge=function(j,D,$){var K=arguments.length===1?I(this._isDirected,arguments[0]):M(this._isDirected,j,D,$);return this._edgeLabels[K]},v.prototype.hasEdge=function(j,D,$){var K=arguments.length===1?I(this._isDirected,arguments[0]):M(this._isDirected,j,D,$);return l.has(this._edgeLabels,K)},v.prototype.removeEdge=function(j,D,$){var K=arguments.length===1?I(this._isDirected,arguments[0]):M(this._isDirected,j,D,$),ot=this._edgeObjs[K];return ot&&(j=ot.v,D=ot.w,delete this._edgeLabels[K],delete this._edgeObjs[K],S(this._preds[D],j),S(this._sucs[j],D),delete this._in[D][K],delete this._out[j][K],this._edgeCount--),this},v.prototype.inEdges=function(j,D){var $=this._in[j];if($){var K=l.values($);return D?l.filter(K,function(ot){return ot.v===D}):K}},v.prototype.outEdges=function(j,D){var $=this._out[j];if($){var K=l.values($);return D?l.filter(K,function(ot){return ot.w===D}):K}},v.prototype.nodeEdges=function(j,D){var $=this.inEdges(j,D);if($)return $.concat(this.outEdges(j,D))};function N(j,D){j[D]?j[D]++:j[D]=1}function S(j,D){--j[D]||delete j[D]}function M(j,D,$,K){var ot=""+D,nt=""+$;if(!j&&ot>nt){var _=ot;ot=nt,nt=_}return ot+b+nt+b+(l.isUndefined(K)?x:K)}function A(j,D,$,K){var ot=""+D,nt=""+$;if(!j&&ot>nt){var _=ot;ot=nt,nt=_}var et={v:ot,w:nt};return K&&(et.name=K),et}function I(j,D){return M(j,D.v,D.w,D.name)}},82354:function(w,P,a){w.exports={Graph:a(30771),version:a(49631)}},28974:function(w,P,a){var l=a(89126),x=a(30771);w.exports={write:E,read:N};function E(S){var M={options:{directed:S.isDirected(),multigraph:S.isMultigraph(),compound:S.isCompound()},nodes:b(S),edges:v(S)};return l.isUndefined(S.graph())||(M.value=l.clone(S.graph())),M}function b(S){return l.map(S.nodes(),function(M){var A=S.node(M),I=S.parent(M),j={v:M};return l.isUndefined(A)||(j.value=A),l.isUndefined(I)||(j.parent=I),j})}function v(S){return l.map(S.edges(),function(M){var A=S.edge(M),I={v:M.v,w:M.w};return l.isUndefined(M.name)||(I.name=M.name),l.isUndefined(A)||(I.value=A),I})}function N(S){var M=new x(S.options).setGraph(S.value);return l.each(S.nodes,function(A){M.setNode(A.v,A.value),A.parent&&M.setParent(A.v,A.parent)}),l.each(S.edges,function(A){M.setEdge({v:A.v,w:A.w,name:A.name},A.value)}),M}},89126:function(w,P,a){var l;try{l={clone:a(66678),constant:a(75703),each:a(85768),filter:a(63105),has:a(18721),isArray:a(1469),isEmpty:a(58367),isFunction:a(23560),isUndefined:a(52353),keys:a(3674),map:a(35161),reduce:a(54061),size:a(84238),transform:a(68718),union:a(93386),values:a(52628)}}catch(x){}l||(l=window._),w.exports=l},49631:function(w){w.exports="2.1.8"},44091:function(w,P,a){"use strict";a.r(P),a.d(P,{isAnyArray:function(){return x}});const l=Object.prototype.toString;function x(E){const b=l.call(E);return b.endsWith("Array]")&&!b.includes("Big")}},18552:function(w,P,a){var l=a(10852),x=a(55639),E=l(x,"DataView");w.exports=E},1989:function(w,P,a){var l=a(51789),x=a(80401),E=a(57667),b=a(21327),v=a(81866);function N(S){var M=-1,A=S==null?0:S.length;for(this.clear();++M-1}w.exports=x},1196:function(w){function P(a,l,x){for(var E=-1,b=a==null?0:a.length;++E0&&N(j)?v>1?E(j,v-1,N,S,M):l(M,j):S||(M[M.length]=j)}return M}w.exports=E},28483:function(w,P,a){var l=a(25063),x=l();w.exports=x},47816:function(w,P,a){var l=a(28483),x=a(3674);function E(b,v){return b&&l(b,v,x)}w.exports=E},97786:function(w,P,a){var l=a(71811),x=a(40327);function E(b,v){v=l(v,b);for(var N=0,S=v.length;b!=null&&Nl}w.exports=P},78565:function(w){var P=Object.prototype,a=P.hasOwnProperty;function l(x,E){return x!=null&&a.call(x,E)}w.exports=l},13:function(w){function P(a,l){return a!=null&&l in Object(a)}w.exports=P},42118:function(w,P,a){var l=a(41848),x=a(62722),E=a(42351);function b(v,N,S){return N===N?E(v,N,S):l(v,x,S)}w.exports=b},9454:function(w,P,a){var l=a(44239),x=a(37005),E="[object Arguments]";function b(v){return x(v)&&l(v)==E}w.exports=b},90939:function(w,P,a){var l=a(2492),x=a(37005);function E(b,v,N,S,M){return b===v?!0:b==null||v==null||!x(b)&&!x(v)?b!==b&&v!==v:l(b,v,N,S,E,M)}w.exports=E},2492:function(w,P,a){var l=a(46384),x=a(67114),E=a(18351),b=a(16096),v=a(64160),N=a(1469),S=a(44144),M=a(36719),A=1,I="[object Arguments]",j="[object Array]",D="[object Object]",$=Object.prototype,K=$.hasOwnProperty;function ot(nt,_,et,tt,it,at){var ft=N(nt),ht=N(_),dt=ft?j:v(nt),xt=ht?j:v(_);dt=dt==I?D:dt,xt=xt==I?D:xt;var yt=dt==D,Mt=xt==D,St=dt==xt;if(St&&S(nt)){if(!S(_))return!1;ft=!0,yt=!1}if(St&&!yt)return at||(at=new l),ft||M(nt)?x(nt,_,et,tt,it,at):E(nt,_,dt,et,tt,it,at);if(!(et&A)){var Bt=yt&&K.call(nt,"__wrapped__"),Vt=Mt&&K.call(_,"__wrapped__");if(Bt||Vt){var qt=Bt?nt.value():nt,te=Vt?_.value():_;return at||(at=new l),it(qt,te,et,tt,at)}}return St?(at||(at=new l),b(nt,_,et,tt,it,at)):!1}w.exports=ot},25588:function(w,P,a){var l=a(64160),x=a(37005),E="[object Map]";function b(v){return x(v)&&l(v)==E}w.exports=b},2958:function(w,P,a){var l=a(46384),x=a(90939),E=1,b=2;function v(N,S,M,A){var I=M.length,j=I,D=!A;if(N==null)return!j;for(N=Object(N);I--;){var $=M[I];if(D&&$[2]?$[1]!==N[$[0]]:!($[0]in N))return!1}for(;++I=S){var et=I?null:v(A);if(et)return N(et);ot=!1,$=b,_=new l}else _=I?[]:nt;t:for(;++Db||M&&A&&j&&!I&&!D||N&&A&&j||!v&&j||!S)return 1;if(!N&&!M&&!D&&E=I)return j;var D=v[N];return j*(D=="desc"?-1:1)}}return E.index-b.index}w.exports=x},278:function(w){function P(a,l){var x=-1,E=a.length;for(l||(l=Array(E));++x1?N[M-1]:void 0,I=M>2?N[2]:void 0;for(A=b.length>3&&typeof A=="function"?(M--,A):void 0,I&&x(N[0],N[1],I)&&(A=M<3?void 0:A,M=1),v=Object(v);++S-1?A[I?N[j]:j]:void 0}}w.exports=b},47445:function(w,P,a){var l=a(40098),x=a(16612),E=a(18601);function b(v){return function(N,S,M){return M&&typeof M!="number"&&x(N,S,M)&&(S=M=void 0),N=E(N),S===void 0?(S=N,N=0):S=E(S),M=M===void 0?NK))return!1;var nt=D.get(S),_=D.get(M);if(nt&&_)return nt==M&&_==S;var et=-1,tt=!0,it=A&v?new l:void 0;for(D.set(S,M),D.set(M,S);++et-1&&x%1==0&&x-1}w.exports=x},54705:function(w,P,a){var l=a(18470);function x(E,b){var v=this.__data__,N=l(v,E);return N<0?(++this.size,v.push([E,b])):v[N][1]=b,this}w.exports=x},24785:function(w,P,a){var l=a(1989),x=a(38407),E=a(57071);function b(){this.size=0,this.__data__={hash:new l,map:new(E||x),string:new l}}w.exports=b},11285:function(w,P,a){var l=a(45050);function x(E){var b=l(this,E).delete(E);return this.size-=b?1:0,b}w.exports=x},96e3:function(w,P,a){var l=a(45050);function x(E){return l(this,E).get(E)}w.exports=x},49916:function(w,P,a){var l=a(45050);function x(E){return l(this,E).has(E)}w.exports=x},95265:function(w,P,a){var l=a(45050);function x(E,b){var v=l(this,E),N=v.size;return v.set(E,b),this.size+=v.size==N?0:1,this}w.exports=x},68776:function(w){function P(a){var l=-1,x=Array(a.size);return a.forEach(function(E,b){x[++l]=[b,E]}),x}w.exports=P},42634:function(w){function P(a,l){return function(x){return x==null?!1:x[a]===l&&(l!==void 0||a in Object(x))}}w.exports=P},24523:function(w,P,a){var l=a(88306),x=500;function E(b){var v=l(b,function(S){return N.size===x&&N.clear(),S}),N=v.cache;return v}w.exports=E},94536:function(w,P,a){var l=a(10852),x=l(Object,"create");w.exports=x},86916:function(w,P,a){var l=a(5569),x=l(Object.keys,Object);w.exports=x},33498:function(w){function P(a){var l=[];if(a!=null)for(var x in Object(a))l.push(x);return l}w.exports=P},31167:function(w,P,a){w=a.nmd(w);var l=a(31957),x=P&&!P.nodeType&&P,E=x&&!0&&w&&!w.nodeType&&w,b=E&&E.exports===x,v=b&&l.process,N=function(){try{var S=E&&E.require&&E.require("util").types;return S||v&&v.binding&&v.binding("util")}catch(M){}}();w.exports=N},2333:function(w){var P=Object.prototype,a=P.toString;function l(x){return a.call(x)}w.exports=l},5569:function(w){function P(a,l){return function(x){return a(l(x))}}w.exports=P},45357:function(w,P,a){var l=a(96874),x=Math.max;function E(b,v,N){return v=x(v===void 0?b.length-1:v,0),function(){for(var S=arguments,M=-1,A=x(S.length-v,0),I=Array(A);++M0){if(++b>=P)return arguments[0]}else b=0;return E.apply(void 0,arguments)}}w.exports=x},37465:function(w,P,a){var l=a(38407);function x(){this.__data__=new l,this.size=0}w.exports=x},63779:function(w){function P(a){var l=this.__data__,x=l.delete(a);return this.size=l.size,x}w.exports=P},67599:function(w){function P(a){return this.__data__.get(a)}w.exports=P},44758:function(w){function P(a){return this.__data__.has(a)}w.exports=P},34309:function(w,P,a){var l=a(38407),x=a(57071),E=a(83369),b=200;function v(N,S){var M=this.__data__;if(M instanceof l){var A=M.__data__;if(!x||A.length2?A[2]:void 0;for(D&&E(A[0],A[1],D)&&(j=1);++I-1&&l%1==0&&l<=P}w.exports=a},56688:function(w,P,a){var l=a(25588),x=a(7518),E=a(31167),b=E&&E.isMap,v=b?x(b):l;w.exports=v},13218:function(w){function P(a){var l=typeof a;return a!=null&&(l=="object"||l=="function")}w.exports=P},37005:function(w){function P(a){return a!=null&&typeof a=="object"}w.exports=P},68630:function(w,P,a){var l=a(44239),x=a(85924),E=a(37005),b="[object Object]",v=Function.prototype,N=Object.prototype,S=v.toString,M=N.hasOwnProperty,A=S.call(Object);function I(j){if(!E(j)||l(j)!=b)return!1;var D=x(j);if(D===null)return!0;var $=M.call(D,"constructor")&&D.constructor;return typeof $=="function"&&$ instanceof $&&S.call($)==A}w.exports=I},72928:function(w,P,a){var l=a(29221),x=a(7518),E=a(31167),b=E&&E.isSet,v=b?x(b):l;w.exports=v},47037:function(w,P,a){var l=a(44239),x=a(1469),E=a(37005),b="[object String]";function v(N){return typeof N=="string"||!x(N)&&E(N)&&l(N)==b}w.exports=v},33448:function(w,P,a){var l=a(44239),x=a(37005),E="[object Symbol]";function b(v){return typeof v=="symbol"||x(v)&&l(v)==E}w.exports=b},36719:function(w,P,a){var l=a(38749),x=a(7518),E=a(31167),b=E&&E.isTypedArray,v=b?x(b):l;w.exports=v},52353:function(w){function P(a){return a===void 0}w.exports=P},3674:function(w,P,a){var l=a(14636),x=a(280),E=a(98612);function b(v){return E(v)?l(v):x(v)}w.exports=b},81704:function(w,P,a){var l=a(14636),x=a(10313),E=a(98612);function b(v){return E(v)?l(v,!0):x(v)}w.exports=b},10928:function(w){function P(a){var l=a==null?0:a.length;return l?a[l-1]:void 0}w.exports=P},35161:function(w,P,a){var l=a(29932),x=a(67206),E=a(69199),b=a(1469);function v(N,S){var M=b(N)?l:E;return M(N,x(S,3))}w.exports=v},8521:function(w,P,a){var l=a(89465),x=a(47816),E=a(67206);function b(v,N){var S={};return N=E(N,3),x(v,function(M,A,I){l(S,A,N(M,A,I))}),S}w.exports=b},6162:function(w,P,a){var l=a(56029),x=a(53325),E=a(6557);function b(v){return v&&v.length?l(v,E,x):void 0}w.exports=b},88306:function(w,P,a){var l=a(83369),x="Expected a function";function E(b,v){if(typeof b!="function"||v!=null&&typeof v!="function")throw new TypeError(x);var N=function(){var S=arguments,M=v?v.apply(this,S):S[0],A=N.cache;if(A.has(M))return A.get(M);var I=b.apply(this,S);return N.cache=A.set(M,I)||A,I};return N.cache=new(E.Cache||l),N}E.Cache=l,w.exports=E},82492:function(w,P,a){var l=a(42980),x=a(21463),E=x(function(b,v,N){l(b,v,N)});w.exports=E},53632:function(w,P,a){var l=a(56029),x=a(70433),E=a(6557);function b(v){return v&&v.length?l(v,E,x):void 0}w.exports=b},22762:function(w,P,a){var l=a(56029),x=a(67206),E=a(70433);function b(v,N){return v&&v.length?l(v,x(N,2),E):void 0}w.exports=b},50308:function(w){function P(){}w.exports=P},7771:function(w,P,a){var l=a(55639),x=function(){return l.Date.now()};w.exports=x},78718:function(w,P,a){var l=a(25970),x=a(99021),E=x(function(b,v){return b==null?{}:l(b,v)});w.exports=E},39601:function(w,P,a){var l=a(40371),x=a(79152),E=a(15403),b=a(40327);function v(N){return E(N)?l(b(N)):x(N)}w.exports=v},96026:function(w,P,a){var l=a(47445),x=l();w.exports=x},54061:function(w,P,a){var l=a(62663),x=a(89881),E=a(67206),b=a(10107),v=a(1469);function N(S,M,A){var I=v(S)?l:b,j=arguments.length<3;return I(S,E(M,4),A,j,x)}w.exports=N},84238:function(w,P,a){var l=a(280),x=a(64160),E=a(98612),b=a(47037),v=a(88016),N="[object Map]",S="[object Set]";function M(A){if(A==null)return 0;if(E(A))return b(A)?v(A):A.length;var I=x(A);return I==N||I==S?A.size:l(A).length}w.exports=M},89734:function(w,P,a){var l=a(21078),x=a(82689),E=a(18460),b=a(16612),v=E(function(N,S){if(N==null)return[];var M=S.length;return M>1&&b(N,S[0],S[1])?S=[]:M>2&&b(S[0],S[1],S[2])&&(S=[S[0]]),x(N,l(S,1),[])});w.exports=v},70479:function(w){function P(){return[]}w.exports=P},95062:function(w){function P(){return!1}w.exports=P},18601:function(w,P,a){var l=a(14841),x=1/0,E=17976931348623157e292;function b(v){if(!v)return v===0?v:0;if(v=l(v),v===x||v===-x){var N=v<0?-1:1;return N*E}return v===v?v:0}w.exports=b},40554:function(w,P,a){var l=a(18601);function x(E){var b=l(E),v=b%1;return b===b?v?b-v:b:0}w.exports=x},14841:function(w,P,a){var l=a(27561),x=a(13218),E=a(33448),b=NaN,v=/^[-+]0x[0-9a-f]+$/i,N=/^0b[01]+$/i,S=/^0o[0-7]+$/i,M=parseInt;function A(I){if(typeof I=="number")return I;if(E(I))return b;if(x(I)){var j=typeof I.valueOf=="function"?I.valueOf():I;I=x(j)?j+"":j}if(typeof I!="string")return I===0?I:+I;I=l(I);var D=N.test(I);return D||S.test(I)?M(I.slice(2),D?2:8):v.test(I)?b:+I}w.exports=A},59881:function(w,P,a){var l=a(98363),x=a(81704);function E(b){return l(b,x(b))}w.exports=E},79833:function(w,P,a){var l=a(80531);function x(E){return E==null?"":l(E)}w.exports=x},68718:function(w,P,a){var l=a(77412),x=a(3118),E=a(47816),b=a(67206),v=a(85924),N=a(1469),S=a(44144),M=a(23560),A=a(13218),I=a(36719);function j(D,$,K){var ot=N(D),nt=ot||S(D)||I(D);if($=b($,4),K==null){var _=D&&D.constructor;nt?K=ot?new _:[]:A(D)?K=M(_)?x(v(D)):{}:K={}}return(nt?l:E)(D,function(et,tt,it){return $(K,et,tt,it)}),K}w.exports=j},93386:function(w,P,a){var l=a(21078),x=a(18460),E=a(45652),b=a(29246),v=x(function(N){return E(l(N,1,b,!0))});w.exports=v},73955:function(w,P,a){var l=a(79833),x=0;function E(b){var v=++x;return l(b)+v}w.exports=E},52628:function(w,P,a){var l=a(47415),x=a(3674);function E(b){return b==null?[]:l(b,x(b))}w.exports=E},7287:function(w,P,a){var l=a(34865),x=a(1757);function E(b,v){return x(b||[],v||[],l)}w.exports=E},75823:function(w,P,a){"use strict";a.r(P),a.d(P,{default:function(){return b}});var l=a(44091);function x(v){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!(0,l.isAnyArray)(v))throw new TypeError("input must be an array");if(v.length===0)throw new TypeError("input must not be empty");var S=N.fromIndex,M=S===void 0?0:S,A=N.toIndex,I=A===void 0?v.length:A;if(M<0||M>=v.length||!Number.isInteger(M))throw new Error("fromIndex must be a positive integer smaller than length");if(I<=M||I>v.length||!Number.isInteger(I))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var j=v[M],D=M+1;Dj&&(j=v[D]);return j}function E(v){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!(0,l.isAnyArray)(v))throw new TypeError("input must be an array");if(v.length===0)throw new TypeError("input must not be empty");var S=N.fromIndex,M=S===void 0?0:S,A=N.toIndex,I=A===void 0?v.length:A;if(M<0||M>=v.length||!Number.isInteger(M))throw new Error("fromIndex must be a positive integer smaller than length");if(I<=M||I>v.length||!Number.isInteger(I))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var j=v[M],D=M+1;D1&&arguments[1]!==void 0?arguments[1]:{};if((0,l.isAnyArray)(v)){if(v.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var S;if(N.output!==void 0){if(!(0,l.isAnyArray)(N.output))throw new TypeError("output option must be an array if specified");S=N.output}else S=new Array(v.length);var M=E(v),A=x(v);if(M===A)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var I=N.min,j=I===void 0?N.autoMinMax?M:0:I,D=N.max,$=D===void 0?N.autoMinMax?A:1:D;if(j>=$)throw new RangeError("min option must be smaller than max option");for(var K=($-j)/(A-M),ot=0;ot=0;d--)(h=n[d])&&(o=(s<3?h(o):s>3?h(e,t,o):h(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o}function E(n,e){return function(t,r){e(t,r,n)}}function b(n,e,t,r,s,o){function h(C){if(C!==void 0&&typeof C!="function")throw new TypeError("Function expected");return C}for(var d=r.kind,p=d==="getter"?"get":d==="setter"?"set":"value",g=!e&&n?r.static?n:n.prototype:null,y=e||(g?Object.getOwnPropertyDescriptor(g,r.name):{}),O,L=!1,R=t.length-1;R>=0;R--){var U={};for(var F in r)U[F]=F==="access"?{}:r[F];for(var F in r.access)U.access[F]=r.access[F];U.addInitializer=function(C){if(L)throw new TypeError("Cannot add initializers after decoration has completed");o.push(h(C||null))};var z=(0,t[R])(d==="accessor"?{get:y.get,set:y.set}:y[p],U);if(d==="accessor"){if(z===void 0)continue;if(z===null||typeof z!="object")throw new TypeError("Object expected");(O=h(z.get))&&(y.get=O),(O=h(z.set))&&(y.set=O),(O=h(z.init))&&s.push(O)}else(O=h(z))&&(d==="field"?s.push(O):y[p]=O)}g&&Object.defineProperty(g,r.name,y),L=!0}function v(n,e,t){for(var r=arguments.length>2,s=0;s0&&o[o.length-1])&&(g[0]===6||g[0]===2)){t=0;continue}if(g[0]===3&&(!o||g[1]>o[0]&&g[1]=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function K(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,o=[],h;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(d){h={error:d}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(h)throw h.error}}return o}function ot(){for(var n=[],e=0;e1||d(L,R)})})}function d(L,R){try{p(r[L](R))}catch(U){O(o[0][3],U)}}function p(L){L.value instanceof et?Promise.resolve(L.value.v).then(g,y):O(o[0][2],L)}function g(L){d("next",L)}function y(L){d("throw",L)}function O(L,R){L(R),o.shift(),o.length&&d(o[0][0],o[0][1])}}function it(n){var e,t;return e={},r("next"),r("throw",function(s){throw s}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(s,o){e[s]=n[s]?function(h){return(t=!t)?{value:et(n[s](h)),done:!1}:o?o(h):h}:o}}function at(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof $=="function"?$(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(h){return new Promise(function(d,p){h=n[o](h),s(d,p,h.done,h.value)})}}function s(o,h,d,p){Promise.resolve(p).then(function(g){o({value:g,done:d})},h)}}function ft(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}var ht=Object.create?function(n,e){Object.defineProperty(n,"default",{enumerable:!0,value:e})}:function(n,e){n.default=e};function dt(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)t!=="default"&&Object.prototype.hasOwnProperty.call(n,t)&&j(e,n,t);return ht(e,n),e}function xt(n){return n&&n.__esModule?n:{default:n}}function yt(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)}function Mt(n,e,t,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?n!==e||!s:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(n,t):s?s.value=t:e.set(n,t),t}function St(n,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?e===n:n.has(e)}var Bt="*",Vt=function(){function n(){this._events={}}return n.prototype.on=function(e,t,r){return this._events[e]||(this._events[e]=[]),this._events[e].push({callback:t,once:!!r}),this},n.prototype.once=function(e,t){return this.on(e,t,!0)},n.prototype.emit=function(e){for(var t=this,r=[],s=1;s{e.has(h.id)||(e.add(h.id),n.push(h))})}return!1}function ce(n,e,t,r){if(t(n))return!0;e.add(n.id);for(const o of r(n.id))if(!e.has(o.id)&&ce(o,e,t,r))return!0;return!1}const ze=()=>!0;class nn{constructor(e){be(this,"graph");be(this,"nodeFilter");be(this,"edgeFilter");be(this,"cacheEnabled");be(this,"inEdgesMap",new Map);be(this,"outEdgesMap",new Map);be(this,"bothEdgesMap",new Map);be(this,"allNodesMap",new Map);be(this,"allEdgesMap",new Map);be(this,"clearCache",()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()});be(this,"refreshCache",()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(e=>e.id))});be(this,"updateCache",e=>{const t=new Set;e.forEach(r=>{const s=this.bothEdgesMap.get(r);if(s&&s.forEach(o=>t.add(o.id)),!this.hasNode(r))this.inEdgesMap.delete(r),this.outEdgesMap.delete(r),this.bothEdgesMap.delete(r),this.allNodesMap.delete(r);else{const o=this.graph.getRelatedEdges(r,"in").filter(this.edgeFilter),h=this.graph.getRelatedEdges(r,"out").filter(this.edgeFilter),d=Array.from(new Set([...o,...h]));d.forEach(p=>t.add(p.id)),this.inEdgesMap.set(r,o),this.outEdgesMap.set(r,h),this.bothEdgesMap.set(r,d),this.allNodesMap.set(r,this.graph.getNode(r))}}),t.forEach(r=>{this.hasEdge(r)?this.allEdgesMap.set(r,this.graph.getEdge(r)):this.allEdgesMap.delete(r)})});be(this,"handleGraphChanged",e=>{const t=new Set;e.changes.forEach(r=>{switch(r.type){case"NodeAdded":t.add(r.value.id);break;case"NodeDataUpdated":t.add(r.id);break;case"EdgeAdded":t.add(r.value.source),t.add(r.value.target);break;case"EdgeUpdated":(r.propertyName==="source"||r.propertyName==="target")&&(t.add(r.oldValue),t.add(r.newValue));break;case"EdgeDataUpdated":if(e.graph.hasEdge(r.id)){const s=e.graph.getEdge(r.id);t.add(s.source),t.add(s.target)}break;case"EdgeRemoved":t.add(r.value.source),t.add(r.value.target);break;case"NodeRemoved":t.add(r.value.id);break;default:break}}),this.updateCache(t)});this.graph=e.graph;const t=e.nodeFilter||ze,r=e.edgeFilter||ze;this.nodeFilter=t,this.edgeFilter=s=>{const{source:o,target:h}=this.graph.getEdgeDetail(s.id);return!t(o)||!t(h)?!1:r(s,o,h)},e.cache==="auto"?(this.cacheEnabled=!0,this.startAutoCache()):e.cache==="manual"?this.cacheEnabled=!0:this.cacheEnabled=!1}startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}checkNodeExistence(e){this.getNode(e)}hasNode(e){if(!this.graph.hasNode(e))return!1;const t=this.graph.getNode(e);return this.nodeFilter(t)}areNeighbors(e,t){return this.checkNodeExistence(e),this.getNeighbors(t).some(r=>r.id===e)}getNode(e){const t=this.graph.getNode(e);if(!this.nodeFilter(t))throw new Error("Node not found for id: "+e);return t}getRelatedEdges(e,t){return this.checkNodeExistence(e),this.cacheEnabled?t==="in"?this.inEdgesMap.get(e):t==="out"?this.outEdgesMap.get(e):this.bothEdgesMap.get(e):this.graph.getRelatedEdges(e,t).filter(this.edgeFilter)}getDegree(e,t){return this.getRelatedEdges(e,t).length}getSuccessors(e){const r=this.getRelatedEdges(e,"out").map(s=>this.getNode(s.target));return Array.from(new Set(r))}getPredecessors(e){const r=this.getRelatedEdges(e,"in").map(s=>this.getNode(s.source));return Array.from(new Set(r))}getNeighbors(e){const t=this.getPredecessors(e),r=this.getSuccessors(e);return Array.from(new Set([...t,...r]))}hasEdge(e){if(!this.graph.hasEdge(e))return!1;const t=this.graph.getEdge(e);return this.edgeFilter(t)}getEdge(e){const t=this.graph.getEdge(e);if(!this.edgeFilter(t))throw new Error("Edge not found for id: "+e);return t}getEdgeDetail(e){const t=this.getEdge(e);return{edge:t,source:this.getNode(t.source),target:this.getNode(t.target)}}hasTreeStructure(e){return this.graph.hasTreeStructure(e)}getRoots(e){return this.graph.getRoots(e).filter(this.nodeFilter)}getChildren(e,t){return this.checkNodeExistence(e),this.graph.getChildren(e,t).filter(this.nodeFilter)}getParent(e,t){this.checkNodeExistence(e);const r=this.graph.getParent(e,t);return!r||!this.nodeFilter(r)?null:r}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(e,t,r="out"){const s={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];te([this.getNode(e)],new Set,t,s)}dfs(e,t,r="out"){const s={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];ce(this.getNode(e),new Set,t,s)}}class xe extends qt{constructor(t){super();be(this,"nodeMap",new Map);be(this,"edgeMap",new Map);be(this,"inEdgesMap",new Map);be(this,"outEdgesMap",new Map);be(this,"bothEdgesMap",new Map);be(this,"treeIndices",new Map);be(this,"changes",[]);be(this,"batchCount",0);be(this,"onChanged",()=>{});be(this,"batch",t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()});t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}commit(){const t=this.changes;this.changes=[];const r={graph:this,changes:t};this.emit("changed",r),this.onChanged(r)}reduceChanges(t){let r=[];return t.forEach(s=>{switch(s.type){case"NodeRemoved":{let o=!1;r=r.filter(h=>{if(h.type==="NodeAdded"){const d=h.value.id===s.value.id;return d&&(o=!0),!d}else{if(h.type==="NodeDataUpdated")return h.id!==s.value.id;if(h.type==="TreeStructureChanged")return h.nodeId!==s.value.id}return!0}),o||r.push(s);break}case"EdgeRemoved":{let o=!1;r=r.filter(h=>{if(h.type==="EdgeAdded"){const d=h.value.id===s.value.id;return d&&(o=!0),!d}else if(h.type==="EdgeDataUpdated"||h.type==="EdgeUpdated")return h.id!==s.value.id;return!0}),o||r.push(s);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const o=r.findIndex(d=>d.type===s.type&&d.id===s.id&&(s.propertyName===void 0||d.propertyName===s.propertyName)),h=r[o];h?s.propertyName!==void 0?h.newValue=s.newValue:(r.splice(o,1),r.push(s)):r.push(s);break}case"TreeStructureDetached":{r=r.filter(o=>o.type==="TreeStructureAttached"||o.type==="TreeStructureChanged"?o.treeKey!==s.treeKey:!0),r.push(s);break}case"TreeStructureChanged":{const o=r.find(h=>h.type==="TreeStructureChanged"&&h.treeKey===s.treeKey&&h.nodeId===s.nodeId);o?o.newParentId=s.newParentId:r.push(s);break}default:r.push(s);break}}),r}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,r){return this.getNeighbors(r).some(s=>s.id===t)}getNode(t){const r=this.nodeMap.get(t);if(!r)throw new Error("Node not found for id: "+t);return r}getRelatedEdges(t,r){if(this.checkNodeExistence(t),r==="in"){const s=this.inEdgesMap.get(t);return Array.from(s)}else if(r==="out"){const s=this.outEdgesMap.get(t);return Array.from(s)}else{const s=this.bothEdgesMap.get(t);return Array.from(s)}}getDegree(t,r){return this.getRelatedEdges(t,r).length}getSuccessors(t){const s=this.getRelatedEdges(t,"out").map(o=>this.getNode(o.target));return Array.from(new Set(s))}getPredecessors(t){const s=this.getRelatedEdges(t,"in").map(o=>this.getNode(o.source));return Array.from(new Set(s))}getNeighbors(t){const r=this.getPredecessors(t),s=this.getSuccessors(t);return Array.from(new Set([...r,...s]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach(r=>{r.childrenMap.set(t.id,new Set)}),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch(()=>{for(const r of t)this.doAddNode(r)})}addNode(t){this.addNodes([t])}doRemoveNode(t){const r=this.getNode(t),s=this.bothEdgesMap.get(t);s==null||s.forEach(o=>this.doRemoveEdge(o.id)),this.nodeMap.delete(t),this.treeIndices.forEach(o=>{var d,p;(d=o.childrenMap.get(t))==null||d.forEach(g=>{o.parentMap.delete(g.id)});const h=o.parentMap.get(t);h&&((p=o.childrenMap.get(h.id))==null||p.delete(r)),o.parentMap.delete(t),o.childrenMap.delete(t)}),this.bothEdgesMap.delete(t),this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.changes.push({type:"NodeRemoved",value:r})}removeNodes(t){this.batch(()=>{t.forEach(r=>this.doRemoveNode(r))})}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,r,s){const o=this.getNode(t);this.batch(()=>{const h=o.data[r],d=s;o.data[r]=d,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:r,oldValue:h,newValue:d})})}mergeNodeData(t,r){this.batch(()=>{Object.entries(r).forEach(([s,o])=>{this.updateNodeDataProperty(t,s,o)})})}updateNodeData(...t){const r=t[0],s=this.getNode(r);if(typeof t[1]=="string"){this.updateNodeDataProperty(r,t[1],t[2]);return}let o;if(typeof t[1]=="function"){const h=t[1];o=h(s.data)}else typeof t[1]=="object"&&(o=t[1]);this.batch(()=>{const h=s.data,d=o;s.data=o,this.changes.push({type:"NodeDataUpdated",id:r,oldValue:h,newValue:d})})}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const r=this.getEdge(t);return{edge:r,source:this.getNode(r.source),target:this.getNode(r.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const r=this.inEdgesMap.get(t.target),s=this.outEdgesMap.get(t.source),o=this.bothEdgesMap.get(t.source),h=this.bothEdgesMap.get(t.target);r.add(t),s.add(t),o.add(t),h.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch(()=>{for(const r of t)this.doAddEdge(r)})}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const r=this.getEdge(t),s=this.outEdgesMap.get(r.source),o=this.inEdgesMap.get(r.target),h=this.bothEdgesMap.get(r.source),d=this.bothEdgesMap.get(r.target);s.delete(r),o.delete(r),h.delete(r),d.delete(r),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:r})}removeEdges(t){this.batch(()=>{t.forEach(r=>this.doRemoveEdge(r))})}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,r){const s=this.getEdge(t);this.checkNodeExistence(r);const o=s.source,h=r;this.outEdgesMap.get(o).delete(s),this.bothEdgesMap.get(o).delete(s),this.outEdgesMap.get(h).add(s),this.bothEdgesMap.get(h).add(s),s.source=r,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:o,newValue:h})})}updateEdgeTarget(t,r){const s=this.getEdge(t);this.checkNodeExistence(r);const o=s.target,h=r;this.inEdgesMap.get(o).delete(s),this.bothEdgesMap.get(o).delete(s),this.inEdgesMap.get(h).add(s),this.bothEdgesMap.get(h).add(s),s.target=r,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:o,newValue:h})})}updateEdgeDataProperty(t,r,s){const o=this.getEdge(t);this.batch(()=>{const h=o.data[r],d=s;o.data[r]=d,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:r,oldValue:h,newValue:d})})}updateEdgeData(...t){const r=t[0],s=this.getEdge(r);if(typeof t[1]=="string"){this.updateEdgeDataProperty(r,t[1],t[2]);return}let o;if(typeof t[1]=="function"){const h=t[1];o=h(s.data)}else typeof t[1]=="object"&&(o=t[1]);this.batch(()=>{const h=s.data,d=o;s.data=o,this.changes.push({type:"EdgeDataUpdated",id:r,oldValue:h,newValue:d})})}mergeEdgeData(t,r){this.batch(()=>{Object.entries(r).forEach(([s,o])=>{this.updateEdgeDataProperty(t,s,o)})})}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch(()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})}))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch(()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})})}addTree(t,r){this.batch(()=>{this.attachTreeStructure(r);const s=[],o=Array.isArray(t)?t:[t];for(;o.length;){const h=o.shift();s.push(h),h.children&&o.push(...h.children)}this.addNodes(s),s.forEach(h=>{var d;(d=h.children)==null||d.forEach(p=>{this.setParent(p.id,h.id,r)})})})}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter(r=>!this.getParent(r.id,t))}getChildren(t,r){this.checkNodeExistence(t),this.checkTreeExistence(r);const o=this.treeIndices.get(r).childrenMap.get(t);return Array.from(o||[])}getParent(t,r){return this.checkNodeExistence(t),this.checkTreeExistence(r),this.treeIndices.get(r).parentMap.get(t)||null}getAncestors(t,r){const s=[];let o=this.getNode(t),h;for(;h=this.getParent(o.id,r);)s.push(h),o=h;return s}setParent(t,r,s){var y,O;this.checkTreeExistence(s);const o=this.treeIndices.get(s),h=this.getNode(t),d=o.parentMap.get(t);if((d==null?void 0:d.id)===r)return;if(r===void 0){d&&((y=o.childrenMap.get(d.id))==null||y.delete(h)),o.parentMap.delete(t);return}const p=this.getNode(r);o.parentMap.set(t,p),d&&((O=o.childrenMap.get(d.id))==null||O.delete(h));let g=o.childrenMap.get(p.id);g||(g=new Set,o.childrenMap.set(p.id,g)),g.add(h),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:s,nodeId:t,oldParentId:d==null?void 0:d.id,newParentId:p.id})})}dfsTree(t,r,s){const o=h=>this.getChildren(h,s);return ce(this.getNode(t),new Set,r,o)}bfsTree(t,r,s){const o=h=>this.getChildren(h,s);return te([this.getNode(t)],new Set,r,o)}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,r,s="out"){const o={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[s];return te([this.getNode(t)],new Set,r,o)}dfs(t,r,s="out"){const o={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[s];return ce(this.getNode(t),new Set,r,o)}clone(){const t=this.getAllNodes().map(o=>Hr(Gn({},o),{data:Gn({},o.data)})),r=this.getAllEdges().map(o=>Hr(Gn({},o),{data:Gn({},o.data)})),s=new xe({nodes:t,edges:r});return this.treeIndices.forEach(({parentMap:o,childrenMap:h},d)=>{const p=new Map;o.forEach((y,O)=>{p.set(O,s.getNode(y.id))});const g=new Map;h.forEach((y,O)=>{g.set(O,new Set(Array.from(y).map(L=>s.getNode(L.id))))}),s.treeIndices.set(d,{parentMap:p,childrenMap:g})}),s}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new nn(Gn({graph:this},t))}}const mn=Symbol("Comlink.proxy"),On=Symbol("Comlink.endpoint"),ln=Symbol("Comlink.releaseProxy"),rn=Symbol("Comlink.finalizer"),gt=Symbol("Comlink.thrown"),wt=n=>typeof n=="object"&&n!==null||typeof n=="function",jt={canHandle:n=>wt(n)&&n[mn],serialize(n){const{port1:e,port2:t}=new MessageChannel;return ge(n,e),[t,[t]]},deserialize(n){return n.start(),Ce(n)}},Ft={canHandle:n=>wt(n)&> in n,serialize({value:n}){let e;return n instanceof Error?e={isError:!0,value:{message:n.message,name:n.name,stack:n.stack}}:e={isError:!1,value:n},[e,[]]},deserialize(n){throw n.isError?Object.assign(new Error(n.value.message),n.value):n.value}},Ht=new Map([["proxy",jt],["throw",Ft]]);function de(n,e){for(const t of n)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function ge(n,e=globalThis,t=["*"]){e.addEventListener("message",function r(s){if(!s||!s.data)return;if(!de(t,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}const{id:o,type:h,path:d}=Object.assign({path:[]},s.data),p=(s.data.argumentList||[]).map(ke);let g;try{const y=d.slice(0,-1).reduce((L,R)=>L[R],n),O=d.reduce((L,R)=>L[R],n);switch(h){case"GET":g=O;break;case"SET":y[d.slice(-1)[0]]=ke(s.data.value),g=!0;break;case"APPLY":g=O.apply(y,p);break;case"CONSTRUCT":{const L=new O(...p);g=wn(L)}break;case"ENDPOINT":{const{port1:L,port2:R}=new MessageChannel;ge(n,R),g=Fe(L,[L])}break;case"RELEASE":g=void 0;break;default:return}}catch(y){g={value:y,[gt]:0}}Promise.resolve(g).catch(y=>({value:y,[gt]:0})).then(y=>{const[O,L]=hn(y);e.postMessage(Object.assign(Object.assign({},O),{id:o}),L),h==="RELEASE"&&(e.removeEventListener("message",r),dn(e),rn in n&&typeof n[rn]=="function"&&n[rn]())}).catch(y=>{const[O,L]=hn({value:new TypeError("Unserializable return value"),[gt]:0});e.postMessage(Object.assign(Object.assign({},O),{id:o}),L)})}),e.start&&e.start()}function Re(n){return n.constructor.name==="MessagePort"}function dn(n){Re(n)&&n.close()}function Ce(n,e){return It(n,[],e)}function Ne(n){if(n)throw new Error("Proxy has been released and is not useable")}function se(n){return sn(n,{type:"RELEASE"}).then(()=>{dn(n)})}const Wt=new WeakMap,ee="FinalizationRegistry"in globalThis&&new FinalizationRegistry(n=>{const e=(Wt.get(n)||0)-1;Wt.set(n,e),e===0&&se(n)});function un(n,e){const t=(Wt.get(e)||0)+1;Wt.set(e,t),ee&&ee.register(n,e,n)}function cn(n){ee&&ee.unregister(n)}function It(n,e=[],t=function(){}){let r=!1;const s=new Proxy(t,{get(o,h){if(Ne(r),h===ln)return()=>{cn(s),se(n),r=!0};if(h==="then"){if(e.length===0)return{then:()=>s};const d=sn(n,{type:"GET",path:e.map(p=>p.toString())}).then(ke);return d.then.bind(d)}return It(n,[...e,h])},set(o,h,d){Ne(r);const[p,g]=hn(d);return sn(n,{type:"SET",path:[...e,h].map(y=>y.toString()),value:p},g).then(ke)},apply(o,h,d){Ne(r);const p=e[e.length-1];if(p===On)return sn(n,{type:"ENDPOINT"}).then(ke);if(p==="bind")return It(n,e.slice(0,-1));const[g,y]=De(d);return sn(n,{type:"APPLY",path:e.map(O=>O.toString()),argumentList:g},y).then(ke)},construct(o,h){Ne(r);const[d,p]=De(h);return sn(n,{type:"CONSTRUCT",path:e.map(g=>g.toString()),argumentList:d},p).then(ke)}});return un(s,n),s}function yn(n){return Array.prototype.concat.apply([],n)}function De(n){const e=n.map(hn);return[e.map(t=>t[0]),yn(e.map(t=>t[1]))]}const Se=new WeakMap;function Fe(n,e){return Se.set(n,e),n}function wn(n){return Object.assign(n,{[mn]:!0})}function nr(n,e=globalThis,t="*"){return{postMessage:(r,s)=>n.postMessage(r,t,s),addEventListener:e.addEventListener.bind(e),removeEventListener:e.removeEventListener.bind(e)}}function hn(n){for(const[e,t]of Ht)if(t.canHandle(n)){const[r,s]=t.serialize(n);return[{type:"HANDLER",name:e,value:r},s]}return[{type:"RAW",value:n},Se.get(n)||[]]}function ke(n){switch(n.type){case"HANDLER":return Ht.get(n.name).deserialize(n.value);case"RAW":return n.value}}function sn(n,e,t){return new Promise(r=>{const s=Pn();n.addEventListener("message",function o(h){!h.data||!h.data.id||h.data.id!==s||(n.removeEventListener("message",o),r(h.data))}),n.start&&n.start(),n.postMessage(Object.assign({id:s},e),t)})}function Pn(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function Yt(n){return typeof n=="number"}function Ln(n){return n==null}const _e=(n,e)=>{if(n!=="next"&&n!=="prev")return e},Ze=n=>{n.prev.next=n.next,n.next.prev=n.prev,delete n.next,delete n.prev};class Ve{constructor(){const e={};e.prev=e,e.next=e.prev,this.shortcut=e}dequeue(){const e=this.shortcut,t=e.prev;if(t&&t!==e)return Ze(t),t}enqueue(e){const t=this.shortcut;e.prev&&e.next&&Ze(e),e.next=t.next,t.next.prev=e,t.next=e,e.prev=t}toString(){const e=[],t=this.shortcut;let r=t.prev;for(;r!==t;)e.push(JSON.stringify(r,_e)),r=r==null?void 0:r.prev;return`[${e.join(", ")}]`}}class xr extends Ve{}const Rn=()=>1,on=(n,e)=>{var t;if(n.getAllNodes().length<=1)return[];const r=Er(n,e||Rn);return(t=Wn(r.graph,r.buckets,r.zeroIdx).map(o=>n.getRelatedEdges(o.v,"out").filter(({target:h})=>h===o.w)))===null||t===void 0?void 0:t.flat()},Wn=(n,e,t)=>{let r=[];const s=e[e.length-1],o=e[0];let h;for(;n.getAllNodes().length;){for(;h=o.dequeue();)fn(n,e,t,h);for(;h=s.dequeue();)fn(n,e,t,h);if(n.getAllNodes().length){for(let d=e.length-2;d>0;--d)if(h=e[d].dequeue(),h){r=r.concat(fn(n,e,t,h,!0));break}}}return r},fn=(n,e,t,r,s)=>{var o,h;const d=[];return n.hasNode(r.v)&&((o=n.getRelatedEdges(r.v,"in"))===null||o===void 0||o.forEach(p=>{const g=p.data.weight,y=n.getNode(p.source);s&&d.push({v:p.source,w:p.target,in:0,out:0}),y.data.out===void 0&&(y.data.out=0),y.data.out-=g,Cn(e,t,Object.assign({v:y.id},y.data))}),(h=n.getRelatedEdges(r.v,"out"))===null||h===void 0||h.forEach(p=>{const g=p.data.weight,y=p.target,O=n.getNode(y);O.data.in===void 0&&(O.data.in=0),O.data.in-=g,Cn(e,t,Object.assign({v:O.id},O.data))}),n.removeNode(r.v)),s?d:void 0},Er=(n,e)=>{const t=new xe;let r=0,s=0;n.getAllNodes().forEach(p=>{t.addNode({id:p.id,data:{v:p.id,in:0,out:0}})}),n.getAllEdges().forEach(p=>{const g=t.getRelatedEdges(p.source,"out").find(O=>O.target===p.target),y=(e==null?void 0:e(p))||1;g?t.updateEdgeData(g==null?void 0:g.id,Object.assign(Object.assign({},g.data),{weight:g.data.weight+y})):t.addEdge({id:p.id,source:p.source,target:p.target,data:{weight:y}}),s=Math.max(s,t.getNode(p.source).data.out+=y),r=Math.max(r,t.getNode(p.target).data.in+=y)});const o=[],h=s+r+3;for(let p=0;p{Cn(o,d,Object.assign({v:p.id},t.getNode(p.id).data))}),{buckets:o,zeroIdx:d,graph:t}},Cn=(n,e,t)=>{t.out?t.in?n[t.out-t.in+e].enqueue(t):n[n.length-1].enqueue(t):n[0].enqueue(t)},Dn=(n,e)=>{const r=e==="greedy"?on(n,(s=>o=>o.data.weight||1)(n)):br(n);r==null||r.forEach(s=>{const o=s.data;n.removeEdge(s.id),o.forwardName=s.data.name,o.reversed=!0,n.addEdge({id:s.id,source:s.target,target:s.source,data:Object.assign({},o)})})},br=n=>{const e=[],t={},r={},s=o=>{r[o]||(r[o]=!0,t[o]=!0,n.getRelatedEdges(o,"out").forEach(h=>{t[h.target]?e.push(h):s(h.target)}),delete t[o])};return n.getAllNodes().forEach(o=>s(o.id)),e},Nr=n=>{n.getAllEdges().forEach(e=>{const t=e.data;if(t.reversed){n.removeEdge(e.id);const r=t.forwardName;delete t.reversed,delete t.forwardName,n.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},t),{forwardName:r})})}})},Mr=(n,e)=>Number(n)-Number(e),xn=(n,e,t,r)=>{let s;do s=`${r}${Math.random()}`;while(n.hasNode(s));return t.dummy=e,n.addNode({id:s,data:t}),s},Sr=n=>{const e=new xe;return n.getAllNodes().forEach(t=>{e.addNode(Object.assign({},t))}),n.getAllEdges().forEach(t=>{const r=e.getRelatedEdges(t.source,"out").find(s=>s.target===t.target);r?e.updateEdgeData(r==null?void 0:r.id,Object.assign(Object.assign({},r.data),{weight:r.data.weight+t.data.weight||0,minlen:Math.max(r.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})}),e},rr=n=>{const e=new xe;return n.getAllNodes().forEach(t=>{n.getChildren(t.id).length||e.addNode(Object.assign({},t))}),n.getAllEdges().forEach(t=>{e.addEdge(t)}),e},Yn=(n,e)=>n==null?void 0:n.reduce((t,r,s)=>(t[r]=e[s],t),{}),es=n=>{const e={};return n.getAllNodes().forEach(t=>{const r={};n.getRelatedEdges(t.id,"out").forEach(s=>{r[s.target]=(r[s.target]||0)+(s.data.weight||0)}),e[t.id]=r}),e},ns=n=>{const e=n.getAllNodes(),t=e.map(r=>{const s={};return n.getRelatedEdges(r.id,"in").forEach(o=>{s[o.source]=(s[o.source]||0)+o.data.weight}),s});return Yn(e.map(r=>r.id),t)},sr=(n,e)=>{const t=Number(n.x),r=Number(n.y),s=Number(e.x)-t,o=Number(e.y)-r;let h=Number(n.width)/2,d=Number(n.height)/2;if(!s&&!o)return{x:0,y:0};let p,g;return Math.abs(o)*h>Math.abs(s)*d?(o<0&&(d=-d),p=d*s/o,g=d):(s<0&&(h=-h),p=h,g=h*o/s),{x:t+p,y:r+g}},An=n=>{const e=[],t=T(n)+1;for(let r=0;r{const s=r.data.rank;s!==void 0&&e[s]&&e[s].push(r.id)});for(let r=0;rMr(n.getNode(s).data.order,n.getNode(o).data.order));return e},zn=n=>{const e=n.getAllNodes().filter(r=>r.data.rank!==void 0).map(r=>r.data.rank),t=Math.min(...e);n.getAllNodes().forEach(r=>{r.data.hasOwnProperty("rank")&&t!==1/0&&(r.data.rank-=t)})},ir=(n,e=0)=>{const t=n.getAllNodes(),r=t.filter(d=>d.data.rank!==void 0).map(d=>d.data.rank),s=Math.min(...r),o=[];t.forEach(d=>{const p=(d.data.rank||0)-s;o[p]||(o[p]=[]),o[p].push(d.id)});let h=0;for(let d=0;d{const y=n.getNode(g);y&&(y.data.rank=y.data.rank||0,y.data.rank+=h)}))}},$n=(n,e,t,r)=>{const s={width:0,height:0};return Yt(t)&&Yt(r)&&(s.rank=t,s.order=r),xn(n,"border",s,e)},T=n=>{let e;return n.getAllNodes().forEach(t=>{const r=t.data.rank;r!==void 0&&(e===void 0||r>e)&&(e=r)}),e||(e=0),e},u=(n,e)=>{const t={lhs:[],rhs:[]};return n==null||n.forEach(r=>{e(r)?t.lhs.push(r):t.rhs.push(r)}),t},c=(n,e)=>n.reduce((t,r)=>{const s=e(t),o=e(r);return s>o?r:t}),i=(n,e,t,r,s,o)=>{r.includes(e.id)||(r.push(e.id),t||o.push(e.id),s(e.id).forEach(h=>i(n,h,t,r,s,o)),t&&o.push(e.id))},f=(n,e,t,r)=>{const s=Array.isArray(e)?e:[e],o=p=>r?n.getSuccessors(p):n.getNeighbors(p),h=[],d=[];return s.forEach(p=>{if(n.hasNode(p.id))i(n,p,t==="post",d,o,h);else throw new Error(`Graph does not have node: ${p}`)}),h},m=n=>{const e=t=>{const r=n.getChildren(t),s=n.getNode(t);if(r!=null&&r.length&&r.forEach(o=>e(o.id)),s.data.hasOwnProperty("minRank")){s.data.borderLeft=[],s.data.borderRight=[];for(let o=s.data.minRank,h=s.data.maxRank+1;oe(t.id))},k=(n,e,t,r,s,o)=>{const h={rank:o,borderType:e,width:0,height:0},d=s.data[e][o-1],p=xn(n,"border",h,t);s.data[e][o]=p,n.setParent(p,r),d&&n.addEdge({id:`e${Math.random()}`,source:d,target:p,data:{weight:1}})},B=(n,e)=>{const t=e.toLowerCase();(t==="lr"||t==="rl")&&V(n)},G=(n,e)=>{const t=e.toLowerCase();(t==="bt"||t==="rl")&&Z(n),(t==="lr"||t==="rl")&&(At(n),V(n))},V=n=>{n.getAllNodes().forEach(e=>{rt(e)}),n.getAllEdges().forEach(e=>{rt(e)})},rt=n=>{const e=n.data.width;n.data.width=n.data.height,n.data.height=e},Z=n=>{n.getAllNodes().forEach(e=>{lt(e.data)}),n.getAllEdges().forEach(e=>{var t;(t=e.data.points)===null||t===void 0||t.forEach(r=>lt(r)),e.data.hasOwnProperty("y")&<(e.data)})},lt=n=>{n!=null&&n.y&&(n.y=-n.y)},At=n=>{n.getAllNodes().forEach(e=>{ct(e.data)}),n.getAllEdges().forEach(e=>{var t;(t=e.data.points)===null||t===void 0||t.forEach(r=>ct(r)),e.data.hasOwnProperty("x")&&ct(e.data)})},ct=n=>{const e=n.x;n.x=n.y,n.y=e},pt=n=>{const e=xn(n,"root",{},"_root"),t=J(n);let r=Math.max(...Object.values(t));Math.abs(r)===1/0&&(r=1);const s=r-1,o=2*s+1;n.getAllEdges().forEach(d=>{d.data.minlen*=o});const h=Ot(n)+1;return n.getRoots().forEach(d=>{Lt(n,e,o,h,s,t,d.id)}),{nestingRoot:e,nodeRankFactor:o}},Lt=(n,e,t,r,s,o,h)=>{const d=n.getChildren(h);if(!(d!=null&&d.length)){h!==e&&n.addEdge({id:`e${Math.random()}`,source:e,target:h,data:{weight:0,minlen:t}});return}const p=$n(n,"_bt"),g=$n(n,"_bb"),y=n.getNode(h);n.setParent(p,h),y.data.borderTop=p,n.setParent(g,h),y.data.borderBottom=g,d==null||d.forEach(O=>{Lt(n,e,t,r,s,o,O.id);const L=O.data.borderTop?O.data.borderTop:O.id,R=O.data.borderBottom?O.data.borderBottom:O.id,U=O.data.borderTop?r:2*r,F=L!==R?1:s-o[h]+1;n.addEdge({id:`e${Math.random()}`,source:p,target:L,data:{minlen:F,weight:U,nestingEdge:!0}}),n.addEdge({id:`e${Math.random()}`,source:R,target:g,data:{minlen:F,weight:U,nestingEdge:!0}})}),n.getParent(h)||n.addEdge({id:`e${Math.random()}`,source:e,target:p,data:{weight:0,minlen:s+o[h]}})},J=n=>{const e={},t=(r,s)=>{const o=n.getChildren(r);o==null||o.forEach(h=>t(h.id,s+1)),e[r]=s};return n.getRoots().forEach(r=>t(r.id,1)),e},Ot=n=>{let e=0;return n.getAllEdges().forEach(t=>{e+=t.data.weight}),e},Ct=(n,e)=>{e&&n.removeNode(e),n.getAllEdges().forEach(t=>{t.data.nestingEdge&&n.removeEdge(t.id)})},Kt="edge",Zt="edge-label",ye=(n,e)=>{n.getAllEdges().forEach(t=>Ut(n,t,e))},Ut=(n,e,t)=>{let r=e.source,s=n.getNode(r).data.rank;const o=e.target,h=n.getNode(o).data.rank,d=e.data.labelRank;if(h===s+1)return;n.removeEdge(e.id);let p,g,y;for(y=0,++s;s{e.forEach(t=>{let r=n.getNode(t);const{data:s}=r,o=s.originalEdge;let h;o&&n.addEdge(o);let d=t;for(;r.data.dummy;)h=n.getSuccessors(d)[0],n.removeNode(d),o.data.points.push({x:r.data.x,y:r.data.y}),r.data.dummy===Zt&&(o.data.x=r.data.x,o.data.y=r.data.y,o.data.width=r.data.width,o.data.height=r.data.height),d=h.id,r=n.getNode(d)})};function ae(n){return Array.isArray(n)}var H=function(n){if(typeof n!="object"||n===null)return n;var e;if(ae(n)){e=[];for(var t=0,r=n.length;t{const r={};let s;t==null||t.forEach(o=>{let h=n.getParent(o),d,p;for(;h;){if(d=n.getParent(h.id),d?(p=r[d.id],r[d.id]=h.id):(p=s,s=h.id),p&&p!==h.id){e.hasNode(p)||e.addNode({id:p,data:{}}),e.hasNode(h.id)||e.addNode({id:h.id,data:{}}),e.hasEdge(`e${p}-${h.id}`)||e.addEdge({id:`e${p}-${h.id}`,source:p,target:h.id,data:{}});return}h=d}})},Nt=(n,e,t)=>{const r=we(n),s=new xe({tree:[{id:r,children:[],data:{}}]});return n.getAllNodes().forEach(o=>{const h=n.getParent(o.id);(o.data.rank===e||o.data.minRank<=e&&e<=o.data.maxRank)&&(s.hasNode(o.id)||s.addNode(Object.assign({},o)),h!=null&&h.id&&!s.hasNode(h==null?void 0:h.id)&&s.addNode(Object.assign({},h)),s.setParent(o.id,(h==null?void 0:h.id)||r),n.getRelatedEdges(o.id,t).forEach(d=>{const p=d.source===o.id?d.target:d.source;s.hasNode(p)||s.addNode(Object.assign({},n.getNode(p)));const g=s.getRelatedEdges(p,"out").find(({target:O})=>O===o.id),y=g!==void 0?g.data.weight:0;g?s.updateEdgeData(g.id,Object.assign(Object.assign({},g.data),{weight:d.data.weight+y})):s.addEdge({id:d.id,source:p,target:o.id,data:{weight:d.data.weight+y}})}),o.data.hasOwnProperty("minRank")&&s.updateNodeData(o.id,Object.assign(Object.assign({},o.data),{borderLeft:o.data.borderLeft[e],borderRight:o.data.borderRight[e]})))}),s},we=n=>{let e;for(;n.hasNode(e=`_root${Math.random()}`););return e},ue=(n,e,t)=>{const r=Yn(t,t.map((y,O)=>O)),o=e.map(y=>{const O=n.getRelatedEdges(y,"out").map(L=>({pos:r[L.target]||0,weight:L.data.weight}));return O==null?void 0:O.sort((L,R)=>L.pos-R.pos)}).flat().filter(y=>y!==void 0);let h=1;for(;h{if(y){let O=y.pos+h;p[O]+=y.weight;let L=0;for(;O>0;)O%2&&(L+=p[O+1]),O=O-1>>1,p[O]+=y.weight;g+=y.weight*L}}),g},he=(n,e)=>{let t=0;for(let r=1;r<(e==null?void 0:e.length);r+=1)t+=ue(n,e[r-1],e[r]);return t},pe=n=>{const e={},t=n.getAllNodes(),r=t.map(g=>{var y;return(y=g.data.rank)!==null&&y!==void 0?y:-1/0}),s=Math.max(...r),o=[];for(let g=0;gn.getNode(g.id).data.rank-n.getNode(y.id).data.rank),p=h.filter(g=>n.getNode(g.id).data.fixorder!==void 0).sort((g,y)=>n.getNode(g.id).data.fixorder-n.getNode(y.id).data.fixorder);return p==null||p.forEach(g=>{isNaN(n.getNode(g.id).data.rank)||o[n.getNode(g.id).data.rank].push(g.id),e[g.id]=!0}),h==null||h.forEach(g=>n.dfsTree(g.id,y=>{if(e.hasOwnProperty(y.id))return!0;e[y.id]=!0,isNaN(y.data.rank)||o[y.data.rank].push(y.id)})),o},Pe=(n,e)=>e.map(t=>{const r=n.getRelatedEdges(t,"in");if(!(r!=null&&r.length))return{v:t};const s={sum:0,weight:0};return r==null||r.forEach(o=>{const h=n.getNode(o.source);s.sum+=o.data.weight*h.data.order,s.weight+=o.data.weight}),{v:t,barycenter:s.sum/s.weight,weight:s.weight}}),Je=(n,e)=>{var t,r,s;const o={};n==null||n.forEach((d,p)=>{o[d.v]={i:p,indegree:0,in:[],out:[],vs:[d.v]};const g=o[d.v];d.barycenter!==void 0&&(g.barycenter=d.barycenter,g.weight=d.weight)}),(t=e.getAllEdges())===null||t===void 0||t.forEach(d=>{const p=o[d.source],g=o[d.target];p!==void 0&&g!==void 0&&(g.indegree++,p.out.push(o[d.target]))});const h=(s=(r=Object.values(o)).filter)===null||s===void 0?void 0:s.call(r,d=>!d.indegree);return Oe(h)},Oe=n=>{var e,t;const r=[],s=p=>g=>{g.merged||(g.barycenter===void 0||p.barycenter===void 0||g.barycenter>=p.barycenter)&&He(p,g)},o=p=>g=>{g.in.push(p),--g.indegree===0&&n.push(g)};for(;n!=null&&n.length;){const p=n.pop();r.push(p),(e=p.in.reverse())===null||e===void 0||e.forEach(g=>s(p)(g)),(t=p.out)===null||t===void 0||t.forEach(g=>o(p)(g))}const h=r.filter(p=>!p.merged),d=["vs","i","barycenter","weight"];return h.map(p=>{const g={};return d==null||d.forEach(y=>{p[y]!==void 0&&(g[y]=p[y])}),g})},He=(n,e)=>{var t;let r=0,s=0;n.weight&&(r+=n.barycenter*n.weight,s+=n.weight),e.weight&&(r+=e.barycenter*e.weight,s+=e.weight),n.vs=(t=e.vs)===null||t===void 0?void 0:t.concat(n.vs),n.barycenter=r/s,n.weight=s,n.i=Math.min(e.i,n.i),e.merged=!0};var an=Je;const ne=(n,e,t,r)=>{const s=u(n,L=>{const R=L.hasOwnProperty("fixorder")&&!isNaN(L.fixorder);return r?!R&&L.hasOwnProperty("barycenter"):R||L.hasOwnProperty("barycenter")}),o=s.lhs,h=s.rhs.sort((L,R)=>-L.i- -R.i),d=[];let p=0,g=0,y=0;o==null||o.sort(Ge(!!e,!!t)),y=Te(d,h,y),o==null||o.forEach(L=>{var R;y+=(R=L.vs)===null||R===void 0?void 0:R.length,d.push(L.vs),p+=L.barycenter*L.weight,g+=L.weight,y=Te(d,h,y)});const O={vs:d.flat()};return g&&(O.barycenter=p/g,O.weight=g),O},Te=(n,e,t)=>{let r=t,s;for(;e.length&&(s=e[e.length-1]).i<=r;)e.pop(),n==null||n.push(s.vs),r++;return r},Ge=(n,e)=>(t,r)=>{if(t.fixorder!==void 0&&r.fixorder!==void 0)return t.fixorder-r.fixorder;if(t.barycenterr.barycenter)return 1;if(e&&t.order!==void 0&&r.order!==void 0){if(t.orderr.order)return 1}return n?r.i-t.i:t.i-r.i},Be=(n,e,t,r,s,o)=>{var h,d,p,g;let y=n.getChildren(e).map(W=>W.id);const O=n.getNode(e),L=O?O.data.borderLeft:void 0,R=O?O.data.borderRight:void 0,U={};L&&(y=y==null?void 0:y.filter(W=>W!==L&&W!==R));const F=Pe(n,y||[]);F==null||F.forEach(W=>{var Y;if(!((Y=n.getChildren(W.v))===null||Y===void 0)&&Y.length){const X=Be(n,W.v,t,r,o);U[W.v]=X,X.hasOwnProperty("barycenter")&&Or(W,X)}});const z=an(F,t);Ae(z,U),(h=z.filter(W=>W.vs.length>0))===null||h===void 0||h.forEach(W=>{const Y=n.getNode(W.vs[0]);Y&&(W.fixorder=Y.data.fixorder,W.order=Y.data.order)});const C=ne(z,r,s,o);if(L&&(C.vs=[L,C.vs,R].flat(),!((d=n.getPredecessors(L))===null||d===void 0)&&d.length)){const W=n.getNode(((p=n.getPredecessors(L))===null||p===void 0?void 0:p[0].id)||""),Y=n.getNode(((g=n.getPredecessors(R))===null||g===void 0?void 0:g[0].id)||"");C.hasOwnProperty("barycenter")||(C.barycenter=0,C.weight=0),C.barycenter=(C.barycenter*C.weight+W.data.order+Y.data.order)/(C.weight+2),C.weight+=2}return C},Ae=(n,e)=>{n==null||n.forEach(t=>{var r;const s=(r=t.vs)===null||r===void 0?void 0:r.map(o=>e[o]?e[o].vs:o);t.vs=s.flat()})},Or=(n,e)=>{n.barycenter!==void 0?(n.barycenter=(n.barycenter*n.weight+e.barycenter*e.weight)/(n.weight+e.weight),n.weight+=e.weight):(n.barycenter=e.barycenter,n.weight=e.weight)},Ar=(n,e)=>{const t=T(n),r=[],s=[];for(let y=1;y-1;y--)s.push(y);const o=or(n,r,"in"),h=or(n,s,"out");let d=pe(n);Xn(n,d);let p=Number.POSITIVE_INFINITY,g;for(let y=0,O=0;O<4;++y,++O){ar(y%2?o:h,y%4>=2,!1,e),d=An(n);const L=he(n,d);L=2,!0,e),d=An(n);const L=he(n,d);Le.map(r=>Nt(n,r,t)),ar=(n,e,t,r)=>{const s=new xe;n==null||n.forEach(o=>{var h;const d=o.getRoots()[0].id,p=Be(o,d,s,e,t,r);for(let g=0;g<((h=p.vs)===null||h===void 0?void 0:h.length);g++){const y=o.getNode(p.vs[g]);y&&(y.data.order=g)}Rt(o,s,p.vs)})},Xn=(n,e)=>{e==null||e.forEach(t=>{t==null||t.forEach((r,s)=>{n.getNode(r).data.order=s})})},Tr=(n,e)=>{const r=n.getAllNodes().filter(h=>{var d;return!(!((d=n.getChildren(h.id))===null||d===void 0)&&d.length)}).map(h=>h.data.rank),s=Math.max(...r),o=[];for(let h=0;h{const d=n.getNode(h);!d||d.data.dummy||isNaN(d.data.rank)||(d.data.fixorder=o[d.data.rank].length,o[d.data.rank].push(h))})},jr=n=>{const e={};let t=0;const r=s=>{const o=t;n.getChildren(s).forEach(h=>r(h.id)),e[s]={low:o,lim:t++}};return n.getRoots().forEach(s=>r(s.id)),e},Ir=(n,e,t,r)=>{var s,o;const h=[],d=[],p=Math.min(e[t].low,e[r].low),g=Math.max(e[t].lim,e[r].lim);let y,O;y=t;do y=(s=n.getParent(y))===null||s===void 0?void 0:s.id,h.push(y);while(y&&(e[y].low>p||g>e[y].lim));for(O=y,y=r;y&&y!==O;)d.push(y),y=(o=n.getParent(y))===null||o===void 0?void 0:o.id;return{lca:O,path:h.concat(d.reverse())}},Pr=(n,e)=>{const t=jr(n);e.forEach(r=>{var s,o;let h=r,d=n.getNode(h);const p=d.data.originalEdge;if(!p)return;const g=Ir(n,t,p.source,p.target),y=g.path,O=g.lca;let L=0,R=y[L],U=!0;for(;h!==p.target;){if(d=n.getNode(h),U){for(;R!==O&&((s=n.getNode(R))===null||s===void 0?void 0:s.data.maxRank){const t={},r=(s,o)=>{let h=0,d=0;const p=s.length,g=o==null?void 0:o[(o==null?void 0:o.length)-1];return o==null||o.forEach((y,O)=>{var L;const R=vi(n,y),U=R?n.getNode(R.id).data.order:p;(R||y===g)&&((L=o.slice(d,O+1))===null||L===void 0||L.forEach(F=>{var z;(z=n.getPredecessors(F))===null||z===void 0||z.forEach(C=>{var W;const Y=n.getNode(C.id),X=Y.data.order;(X{const t={};function r(d,p,g,y,O){var L,R;let U;for(let F=p;F{const C=n.getNode(z.id);C.data.dummy&&(C.data.orderO)&&is(t,z.id,U)}))}function s(d){return JSON.stringify(d.slice(1))}function o(d,p){const g=s(d);p.get(g)||(r(...d),p.set(g,!0))}const h=(d,p)=>{let g=-1,y,O=0;const L=new Map;return p==null||p.forEach((R,U)=>{var F;if(((F=n.getNode(R))===null||F===void 0?void 0:F.data.dummy)==="border"){const z=n.getPredecessors(R)||[];z.length&&(y=n.getNode(z[0].id).data.order,o([p,O,U,g,y],L),O=U,g=y)}o([p,O,p.length,y,d.length],L)}),p};return e!=null&&e.length&&e.reduce(h),t},vi=(n,e)=>{var t,r;if(!((t=n.getNode(e))===null||t===void 0)&&t.data.dummy)return(r=n.getPredecessors(e))===null||r===void 0?void 0:r.find(s=>n.getNode(s.id).data.dummy)},is=(n,e,t)=>{let r=e,s=t;if(r>s){const h=r;r=s,s=h}let o=n[r];o||(n[r]=o={}),o[s]=!0},mi=(n,e,t)=>{let r=e,s=t;if(r>s){const o=e;r=s,s=o}return!!n[r]},os=(n,e,t,r)=>{const s={},o={},h={};return e==null||e.forEach(d=>{d==null||d.forEach((p,g)=>{s[p]=p,o[p]=p,h[p]=g})}),e==null||e.forEach(d=>{let p=-1;d==null||d.forEach(g=>{let y=r(g).map(O=>O.id);if(y.length){y=y.sort((L,R)=>h[L]-h[R]);const O=(y.length-1)/2;for(let L=Math.floor(O),R=Math.ceil(O);L<=R;++L){const U=y[L];o[g]===g&&p{var d;const p={},g=yi(n,e,t,s,o,h),y=h?"borderLeft":"borderRight",O=(U,F)=>{let z=g.getAllNodes(),C=z.pop();const W={};for(;C;)W[C.id]?U(C.id):(W[C.id]=!0,z.push(C),z=z.concat(F(C.id))),C=z.pop()},L=U=>{p[U]=(g.getRelatedEdges(U,"in")||[]).reduce((F,z)=>Math.max(F,(p[z.source]||0)+z.data.weight),0)},R=U=>{const F=(g.getRelatedEdges(U,"out")||[]).reduce((C,W)=>Math.min(C,(p[W.target]||0)-W.data.weight),Number.POSITIVE_INFINITY),z=n.getNode(U);F!==Number.POSITIVE_INFINITY&&z.data.borderType!==y&&(p[U]=Math.max(p[U],F))};return O(L,g.getPredecessors.bind(g)),O(R,g.getSuccessors.bind(g)),(d=Object.values(r))===null||d===void 0||d.forEach(U=>{p[U]=p[t[U]]}),p},yi=(n,e,t,r,s,o)=>{const h=new xe,d=wi(r,s,o);return e==null||e.forEach(p=>{let g;p==null||p.forEach(y=>{const O=t[y];if(h.hasNode(O)||h.addNode({id:O,data:{}}),g){const L=t[g],R=h.getRelatedEdges(L,"out").find(U=>U.target===O);R?h.updateEdgeData(R.id,Object.assign(Object.assign({},R.data),{weight:Math.max(d(n,y,g),R.data.weight||0)})):h.addEdge({id:`e${Math.random()}`,source:L,target:O,data:{weight:Math.max(d(n,y,g),0)}})}g=y})}),h},us=(n,e)=>c(Object.values(e),t=>{var r;let s=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return(r=Object.keys(t))===null||r===void 0||r.forEach(h=>{const d=t[h],p=xi(n,h)/2;s=Math.max(d+p,s),o=Math.min(d-p,o)}),s-o});function cs(n,e){const t=Object.values(e),r=Math.min(...t),s=Math.max(...t);["u","d"].forEach(o=>{["l","r"].forEach(h=>{const d=o+h,p=n[d];let g;if(p===e)return;const y=Object.values(p);g=h==="l"?r-Math.min(...y):s-Math.max(...y),g&&(n[d]={},Object.keys(p).forEach(O=>{n[d][O]=p[O]+g}))})})}const fs=(n,e)=>{const t={};return Object.keys(n.ul).forEach(r=>{if(e)t[r]=n[e.toLowerCase()][r];else{const s=Object.values(n).map(o=>o[r]);t[r]=(s[0]+s[1])/2}}),t},pc=(n,e)=>{const{align:t,nodesep:r=0,edgesep:s=0}=e||{},o=buildLayerMatrix(n),h=Object.assign(rs(n,o),ss(n,o)),d={};let p;["u","d"].forEach(y=>{p=y==="u"?o:Object.values(o).reverse(),["l","r"].forEach(O=>{O==="r"&&(p=p.map(F=>Object.values(F).reverse()));const L=(y==="u"?n.getPredecessors:n.getSuccessors).bind(n),R=os(n,p,h,L),U=as(n,p,R.root,R.align,r,s,O==="r");O==="r"&&Object.keys(U).forEach(F=>{U[F]=-U[F]}),d[y+O]=U})});const g=us(n,d);return cs(d,g),fs(d,t)},wi=(n,e,t)=>(r,s,o)=>{const h=r.getNode(s),d=r.getNode(o);let p=0,g=0;if(p+=h.data.width/2,h.data.hasOwnProperty("labelpos"))switch((h.data.labelpos||"").toLowerCase()){case"l":g=-h.data.width/2;break;case"r":g=h.data.width/2;break}if(g&&(p+=t?g:-g),g=0,p+=(h.data.dummy?e:n)/2,p+=(d.data.dummy?e:n)/2,p+=d.data.width/2,d.data.labelpos)switch((d.data.labelpos||"").toLowerCase()){case"l":g=d.data.width/2;break;case"r":g=-d.data.width/2;break}return g&&(p+=t?g:-g),g=0,p},xi=(n,e)=>n.getNode(e).data.width||0,Ei=(n,e)=>{const{ranksep:t=0}=e||{},r=An(n);let s=0;r==null||r.forEach(o=>{const h=o.map(p=>n.getNode(p).data.height),d=Math.max(...h,0);o==null||o.forEach(p=>{n.getNode(p).data.y=s+d/2}),s+=d+t})},bi=(n,e)=>{const{align:t,nodesep:r=0,edgesep:s=0}=e||{},o=An(n),h=Object.assign(rs(n,o),ss(n,o)),d={};let p=[];["u","d"].forEach(y=>{p=y==="u"?o:Object.values(o).reverse(),["l","r"].forEach(O=>{O==="r"&&(p=p.map(F=>Object.values(F).reverse()));const L=(y==="u"?n.getPredecessors:n.getSuccessors).bind(n),R=os(n,p,h,L),U=as(n,p,R.root,R.align,r,s,O==="r");O==="r"&&Object.keys(U).forEach(F=>U[F]=-U[F]),d[y+O]=U})});const g=us(n,d);return g&&cs(d,g),fs(d,t)},Ni=(n,e)=>{var t;const r=rr(n);Ei(r,e);const s=bi(r,e);(t=Object.keys(s))===null||t===void 0||t.forEach(o=>{r.getNode(o).data.x=s[o]})},ls=n=>{const e={},t=r=>{var s;const o=n.getNode(r);if(!o)return 0;if(e[r])return o.data.rank;e[r]=!0;let h;return(s=n.getRelatedEdges(r,"out"))===null||s===void 0||s.forEach(d=>{const p=t(d.target),g=d.data.minlen,y=p-g;y&&(h===void 0||yn.getRelatedEdges(r.id,"in").length===0).forEach(r=>t(r.id))},Mi=n=>{const e={};let t;const r=h=>{var d;const p=n.getNode(h);if(!p)return 0;if(e[h])return p.data.rank;e[h]=!0;let g;return(d=n.getRelatedEdges(h,"out"))===null||d===void 0||d.forEach(y=>{const O=r(y.target),L=y.data.minlen,R=O-L;R&&(g===void 0||Rn.getRelatedEdges(h.id,"in").length===0).forEach(h=>{h&&r(h.id)}),t===void 0&&(t=0);const s={},o=(h,d)=>{var p;const g=n.getNode(h),y=isNaN(g.data.layer)?d:g.data.layer;(g.data.rank===void 0||g.data.rank{o(O.target,y+O.data.minlen)}))};n.getAllNodes().forEach(h=>{const d=h.data;d&&(isNaN(d.layer)?d.rank-=t:o(h.id,d.layer))})},En=(n,e)=>n.getNode(e.target).data.rank-n.getNode(e.source).data.rank-e.data.minlen,Si=n=>{const e=new xe({tree:[]}),t=n.getAllNodes()[0],r=n.getAllNodes().length;e.addNode(t);let s,o;for(;Oi(e,n){const t=r=>{e.getRelatedEdges(r,"both").forEach(s=>{const o=s.source,h=r===o?s.target:o;!n.hasNode(h)&&!En(e,s)&&(n.addNode({id:h,data:{}}),n.addEdge({id:s.id,source:r,target:h,data:{}}),t(h))})};return n.getAllNodes().forEach(r=>t(r.id)),n.getAllNodes().length},Ai=n=>{const e=new xe({tree:[]}),t=n.getAllNodes()[0],r=n.getAllNodes().length;e.addNode(t);let s,o;for(;Ti(e,n){const t=r=>{var s;(s=e.getRelatedEdges(r,"both"))===null||s===void 0||s.forEach(o=>{const h=o.source,d=r===h?o.target:h;!n.hasNode(d)&&(e.getNode(d).data.layer!==void 0||!En(e,o))&&(n.addNode({id:d,data:{}}),n.addEdge({id:o.id,source:r,target:d,data:{}}),t(d))})};return n.getAllNodes().forEach(r=>t(r.id)),n.getAllNodes().length},ds=(n,e)=>c(e.getAllEdges(),t=>n.hasNode(t.source)!==n.hasNode(t.target)?En(e,t):1/0),hs=(n,e,t)=>{n.getAllNodes().forEach(r=>{const s=e.getNode(r.id);s.data.rank||(s.data.rank=0),s.data.rank+=t})},ji=n=>{const e=Sr(n);ls(e);const t=Si(e);ps(t),gs(t,e);let r,s;for(;r=Li(t);)s=Ri(t,e,r),Ci(t,e,r,s)},gs=(n,e)=>{let t=f(n,n.getAllNodes(),"post",!1);t=t.slice(0,(t==null?void 0:t.length)-1),t.forEach(r=>{Ii(n,e,r)})},Ii=(n,e,t)=>{const s=n.getNode(t).data.parent,o=n.getRelatedEdges(t,"both").find(h=>h.target===s||h.source===s);o.data.cutvalue=Pi(n,e,t)},Pi=(n,e,t)=>{const s=n.getNode(t).data.parent;let o=!0,h=e.getRelatedEdges(t,"out").find(p=>p.target===s),d=0;return h||(o=!1,h=e.getRelatedEdges(s,"out").find(p=>p.target===t)),d=h.data.weight,e.getRelatedEdges(t,"both").forEach(p=>{const g=p.source===t,y=g?p.target:p.source;if(y!==s){const O=g===o,L=p.data.weight;if(d+=O?L:-L,zi(n,t,y)){const R=n.getRelatedEdges(t,"both").find(U=>U.source===y||U.target===y).data.cutvalue;d+=O?-R:R}}}),d},ps=(n,e=n.getAllNodes()[0].id)=>{vs(n,{},1,e)},vs=(n,e,t,r,s)=>{var o;const h=t;let d=t;const p=n.getNode(r);return e[r]=!0,(o=n.getNeighbors(r))===null||o===void 0||o.forEach(g=>{e[g.id]||(d=vs(n,e,d,g.id,r))}),p.data.low=h,p.data.lim=d++,s?p.data.parent=s:delete p.data.parent,d},Li=n=>n.getAllEdges().find(e=>e.data.cutvalue<0),Ri=(n,e,t)=>{let r=t.source,s=t.target;e.getRelatedEdges(r,"out").find(y=>y.target===s)||(r=t.target,s=t.source);const o=n.getNode(r),h=n.getNode(s);let d=o,p=!1;o.data.lim>h.data.lim&&(d=h,p=!0);const g=e.getAllEdges().filter(y=>p===ms(n.getNode(y.source),d)&&p!==ms(n.getNode(y.target),d));return c(g,y=>En(e,y))},Ci=(n,e,t,r)=>{const s=n.getRelatedEdges(t.source,"both").find(o=>o.source===t.target||o.target===t.target);s&&n.removeEdge(s.id),n.addEdge({id:`e${Math.random()}`,source:r.source,target:r.target,data:{}}),ps(n),gs(n,e),Di(n,e)},Di=(n,e)=>{const t=n.getAllNodes().find(s=>!s.data.parent);let r=f(n,t,"pre",!1);r=r.slice(1),r.forEach(s=>{const o=n.getNode(s).data.parent;let h=e.getRelatedEdges(s,"out").find(p=>p.target===o),d=!1;!h&&e.hasNode(o)&&(h=e.getRelatedEdges(o,"out").find(p=>p.target===s),d=!0),e.getNode(s).data.rank=(e.hasNode(o)&&e.getNode(o).data.rank||0)+(d?h==null?void 0:h.data.minlen:-(h==null?void 0:h.data.minlen))})},zi=(n,e,t)=>n.getRelatedEdges(e,"both").find(r=>r.source===t||r.target===t),ms=(n,e)=>e.data.low<=n.data.lim&&n.data.lim<=e.data.lim,Fi=(n,e)=>{switch(e){case"network-simplex":Bi(n);break;case"tight-tree":ys(n);break;case"longest-path":ki(n);break;default:ys(n)}},ki=ls,ys=n=>{Mi(n),Ai(n)},Bi=n=>{ji(n)},Ui=(n,e)=>{const{edgeLabelSpace:t,keepNodeOrder:r,prevGraph:s,rankdir:o,ranksep:h}=e;!r&&s&&Gi(n,s);const d=Zi(n);t&&(e.ranksep=Ji(d,{rankdir:o,ranksep:h}));let p;try{p=Vi(d,e)}catch(g){if(g.message==="Not possible to find intersection inside of the rectangle"){console.error(`The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure: `,g);return}throw g}return Wi(n,d),p},Vi=(n,e)=>{const{acyclicer:t,ranker:r,rankdir:s="tb",nodeOrder:o,keepNodeOrder:h,align:d,nodesep:p=50,edgesep:g=20,ranksep:y=50}=e;so(n),Dn(n,t);const{nestingRoot:O,nodeRankFactor:L}=pt(n);Fi(rr(n),r),Qi(n),ir(n,L),Ct(n,O),zn(n),_i(n),Hi(n);const R=[];ye(n,R),Pr(n,R),m(n),h&&Tr(n,o),Ar(n,h),io(n),B(n,s),Ni(n,{align:d,nodesep:p,edgesep:g,ranksep:y}),oo(n),ro(n),$t(n,R),eo(n),G(n,s);const{width:U,height:F}=qi(n);return to(n),no(n),Nr(n),{width:U,height:F}},Gi=(n,e)=>{n.getAllNodes().forEach(t=>{const r=n.getNode(t.id);if(e.hasNode(t.id)){const s=e.getNode(t.id);r.data.fixorder=s.data._order,delete s.data._order}else delete r.data.fixorder})},Wi=(n,e)=>{n.getAllNodes().forEach(t=>{var r;const s=n.getNode(t.id);if(s){const o=e.getNode(t.id);s.data.x=o.data.x,s.data.y=o.data.y,s.data._order=o.data.order,s.data._rank=o.data.rank,!((r=e.getChildren(t.id))===null||r===void 0)&&r.length&&(s.data.width=o.data.width,s.data.height=o.data.height)}}),n.getAllEdges().forEach(t=>{const r=n.getEdge(t.id),s=e.getEdge(t.id);r.data.points=s?s.data.points:[],s&&s.data.hasOwnProperty("x")&&(r.data.x=s.data.x,r.data.y=s.data.y)})},Yi=["width","height","layer","fixorder"],$i={width:0,height:0},Xi=["minlen","weight","width","height","labeloffset"],Ki={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Lr=["labelpos"],Zi=n=>{const e=new xe({tree:[]});return n.getAllNodes().forEach(t=>{const r=xs(n.getNode(t.id).data),s=Object.assign(Object.assign({},$i),r),o=ws(s,Yi);e.hasNode(t.id)||e.addNode({id:t.id,data:Object.assign({},o)});const h=n.hasTreeStructure("combo")?n.getParent(t.id,"combo"):n.getParent(t.id);Ln(h)||(e.hasNode(h.id)||e.addNode(Object.assign({},h)),e.setParent(t.id,h.id))}),n.getAllEdges().forEach(t=>{const r=xs(n.getEdge(t.id).data),s={};Lr==null||Lr.forEach(o=>{r[o]!==void 0&&(s[o]=r[o])}),e.addEdge({id:t.id,source:t.source,target:t.target,data:Object.assign({},Ki,ws(r,Xi),s)})}),e},Ji=(n,e)=>{const{ranksep:t=0,rankdir:r}=e;return n.getAllNodes().forEach(s=>{isNaN(s.data.layer)||s.data.layer||(s.data.layer=0)}),n.getAllEdges().forEach(s=>{var o;s.data.minlen*=2,((o=s.data.labelpos)===null||o===void 0?void 0:o.toLowerCase())!=="c"&&(r==="TB"||r==="BT"?s.data.width+=s.data.labeloffset:s.data.height+=s.data.labeloffset)}),t/2},Qi=n=>{n.getAllEdges().forEach(e=>{if(e.data.width&&e.data.height){const t=n.getNode(e.source),r=n.getNode(e.target),s={e,rank:(r.data.rank-t.data.rank)/2+t.data.rank};xn(n,"edge-proxy",s,"_ep")}})},_i=n=>{let e=0;return n.getAllNodes().forEach(t=>{var r,s;t.data.borderTop&&(t.data.minRank=(r=n.getNode(t.data.borderTop))===null||r===void 0?void 0:r.data.rank,t.data.maxRank=(s=n.getNode(t.data.borderBottom))===null||s===void 0?void 0:s.data.rank,e=Math.max(e,t.data.maxRank||-1/0))}),e},Hi=n=>{n.getAllNodes().forEach(e=>{e.data.dummy==="edge-proxy"&&(n.getEdge(e.data.e.id).data.labelRank=e.data.rank,n.removeNode(e.id))})},qi=(n,e)=>{let t,r=0,s,o=0;const{marginx:h=0,marginy:d=0}=e||{},p=g=>{if(!g.data)return;const y=g.data.x,O=g.data.y,L=g.data.width,R=g.data.height;!isNaN(y)&&!isNaN(L)&&(t===void 0&&(t=y-L/2),t=Math.min(t,y-L/2),r=Math.max(r,y+L/2)),!isNaN(O)&&!isNaN(R)&&(s===void 0&&(s=O-R/2),s=Math.min(s,O-R/2),o=Math.max(o,O+R/2))};return n.getAllNodes().forEach(g=>{p(g)}),n.getAllEdges().forEach(g=>{g!=null&&g.data.hasOwnProperty("x")&&p(g)}),t-=h,s-=d,n.getAllNodes().forEach(g=>{g.data.x-=t,g.data.y-=s}),n.getAllEdges().forEach(g=>{var y;(y=g.data.points)===null||y===void 0||y.forEach(O=>{O.x-=t,O.y-=s}),g.data.hasOwnProperty("x")&&(g.data.x-=t),g.data.hasOwnProperty("y")&&(g.data.y-=s)}),{width:r-t+h,height:o-s+d}},to=n=>{n.getAllEdges().forEach(e=>{const t=n.getNode(e.source),r=n.getNode(e.target);let s,o;e.data.points?(s=e.data.points[0],o=e.data.points[e.data.points.length-1]):(e.data.points=[],s={x:r.data.x,y:r.data.y},o={x:t.data.x,y:t.data.y}),e.data.points.unshift(sr(t.data,s)),e.data.points.push(sr(r.data,o))})},eo=n=>{n.getAllEdges().forEach(e=>{if(e.data.hasOwnProperty("x"))switch((e.data.labelpos==="l"||e.data.labelpos==="r")&&(e.data.width-=e.data.labeloffset),e.data.labelpos){case"l":e.data.x-=e.data.width/2+e.data.labeloffset;break;case"r":e.data.x+=e.data.width/2+e.data.labeloffset;break}})},no=n=>{n.getAllEdges().forEach(e=>{var t;e.data.reversed&&((t=e.data.points)===null||t===void 0||t.reverse())})},ro=n=>{n.getAllNodes().forEach(e=>{var t,r,s;if(!((t=n.getChildren(e.id))===null||t===void 0)&&t.length){const o=n.getNode(e.id),h=n.getNode(o.data.borderTop),d=n.getNode(o.data.borderBottom),p=n.getNode(o.data.borderLeft[((r=o.data.borderLeft)===null||r===void 0?void 0:r.length)-1]),g=n.getNode(o.data.borderRight[((s=o.data.borderRight)===null||s===void 0?void 0:s.length)-1]);o.data.width=Math.abs((g==null?void 0:g.data.x)-(p==null?void 0:p.data.x))||10,o.data.height=Math.abs((d==null?void 0:d.data.y)-(h==null?void 0:h.data.y))||10,o.data.x=((p==null?void 0:p.data.x)||0)+o.data.width/2,o.data.y=((h==null?void 0:h.data.y)||0)+o.data.height/2}}),n.getAllNodes().forEach(e=>{e.data.dummy==="border"&&n.removeNode(e.id)})},so=n=>{n.getAllEdges().forEach(e=>{if(e.source===e.target){const t=n.getNode(e.source);t.data.selfEdges||(t.data.selfEdges=[]),t.data.selfEdges.push(e),n.removeEdge(e.id)}})},io=n=>{const e=An(n);e==null||e.forEach(t=>{let r=0;t==null||t.forEach((s,o)=>{var h;const d=n.getNode(s);d.data.order=o+r,(h=d.data.selfEdges)===null||h===void 0||h.forEach(p=>{xn(n,"selfedge",{width:p.data.width,height:p.data.height,rank:d.data.rank,order:o+ ++r,e:p},"_se")}),delete d.data.selfEdges})})},oo=n=>{n.getAllNodes().forEach(e=>{const t=n.getNode(e.id);if(t.data.dummy==="selfedge"){const r=n.getNode(t.data.e.source),s=r.data.x+r.data.width/2,o=r.data.y,h=t.data.x-s,d=r.data.height/2;n.hasEdge(t.data.e.id)?n.updateEdgeData(t.data.e.id,t.data.e.data):n.addEdge({id:t.data.e.id,source:t.data.e.source,target:t.data.e.target,data:t.data.e.data}),n.removeNode(e.id),t.data.e.data.points=[{x:s+2*h/3,y:o-d},{x:s+5*h/6,y:o-d},{y:o,x:s+h},{x:s+5*h/6,y:o+d},{x:s+2*h/3,y:o+d}],t.data.e.data.x=t.data.x,t.data.e.data.y=t.data.y}})},ws=(n,e)=>{const t={};return e==null||e.forEach(r=>{n[r]!==void 0&&(t[r]=+n[r])}),t},xs=(n={})=>{const e={};return Object.keys(n).forEach(t=>{e[t.toLowerCase()]=n[t]}),e};function qe(n){return typeof n=="function"}var bn=function(n){var e=typeof n;return n!==null&&e==="object"||e==="function"};function Nn(n,e){let t;return qe(e)?t=e:Yt(e)?t=()=>e:t=()=>n,t}function Es(n,e,t=!0){return!e&&e!==0?r=>{const{size:s}=r.data||{};return s?Array.isArray(s)?s[0]>s[1]?s[0]:s[1]:bn(s)?s.width>s.height?s.width:s.height:s:n}:qe(e)?e:Yt(e)?()=>e:Array.isArray(e)?()=>{if(t){const r=Math.max(...e);return isNaN(r)?n:r}return e}:bn(e)?()=>{if(t){const r=Math.max(e.width,e.height);return isNaN(r)?n:r}return[e.width,e.height]}:()=>n}const bs=(n,e)=>{let t,r;return Yt(e)?r=()=>e:qe(e)?r=e:r=()=>0,n?Array.isArray(n)?t=s=>(n[0]>n[1]?n[0]:n[1])+r(s):qe(n)?t=n:t=s=>n+r(s):t=s=>{var o,h;if(!((o=s.data)===null||o===void 0)&&o.bboxSize)return Math.max(s.data.bboxSize[0],s.data.bboxSize[1])+r(s);if(!((h=s.data)===null||h===void 0)&&h.size){if(Array.isArray(s.data.size))return Math.max(s.data.size[0],s.data.size[1])+r(s);const d=s.data.size;return bn(d)?(d.width>d.height?d.width:d.height)+r(s):d+r(s)}return 10+r(s)},t},Rr=n=>{if(n===null)return n;if(n instanceof Date)return new Date(n.getTime());if(n instanceof Array){const e=[];return n.forEach(t=>{e.push(t)}),e.map(t=>Rr(t))}if(typeof n=="object"){const e={};return Object.keys(n).forEach(t=>{e[t]=Rr(n[t])}),e}return n},Qe=(n,e)=>{const t=Rr(n);return t.data=t.data||{},e&&(Yt(t.data.x)||(t.data.x=Math.random()*e[0]),Yt(t.data.y)||(t.data.y=Math.random()*e[1])),t},ao={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class uo{constructor(e={}){this.options=e,this.id="antv-dagre",this.options=Object.assign(Object.assign({},ao),e)}execute(e,t){return A(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,e,t)})}assign(e,t){return A(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,e,t)})}genericDagreLayout(e,t,r){return A(this,void 0,void 0,function*(){const s=Object.assign(Object.assign({},this.options),r),{nodeSize:o,align:h,rankdir:d="TB",ranksep:p,nodesep:g,ranksepFunc:y,nodesepFunc:O,edgeLabelSpace:L,ranker:R,nodeOrder:U,begin:F,controlPoints:z,radial:C,sortByCombo:W,preset:Y}=s,X=new xe({tree:[]}),q=Nn(p||50,y),st=Nn(g||50,O);let ut=st,Q=q;(d==="LR"||d==="RL")&&(ut=q,Q=st);const vt=bs(o,void 0),Et=t.getAllNodes(),Tt=t.getAllEdges();Et.forEach(bt=>{const kt=vt(bt),_t=Q(bt),Xt=ut(bt),ie=kt+2*Xt,le=kt+2*_t,Qt=bt.data.layer;Yt(Qt)?X.addNode({id:bt.id,data:{width:ie,height:le,layer:Qt}}):X.addNode({id:bt.id,data:{width:ie,height:le}})}),W&&(X.attachTreeStructure("combo"),Et.forEach(bt=>{const{parentId:kt}=bt.data;kt!==void 0&&X.hasNode(kt)&&X.setParent(bt.id,kt,"combo")})),Tt.forEach(bt=>{X.addEdge({id:bt.id,source:bt.source,target:bt.target,data:{weight:bt.data.weight||1}})});let Pt;Y!=null&&Y.length&&(Pt=new xe({nodes:Y})),Ui(X,{prevGraph:Pt,edgeLabelSpace:L,keepNodeOrder:!!U,nodeOrder:U||[],acyclicer:"greedy",ranker:R,rankdir:d,nodesep:g,align:h});const Dt=[0,0];if(F){let bt=1/0,kt=1/0;X.getAllNodes().forEach(_t=>{bt>_t.data.x&&(bt=_t.data.x),kt>_t.data.y&&(kt=_t.data.y)}),X.getAllEdges().forEach(_t=>{var Xt;(Xt=_t.data.points)===null||Xt===void 0||Xt.forEach(ie=>{bt>ie.x&&(bt=ie.x),kt>ie.y&&(kt=ie.y)})}),Dt[0]=F[0]-bt,Dt[1]=F[1]-kt}const Gt=d==="LR"||d==="RL";if(!C){const bt=new Set,_t=d==="BT"||d==="RL"?(Qt,oe)=>oe-Qt:(Qt,oe)=>Qt-oe;X.getAllNodes().forEach(Qt=>{Qt.data.x=Qt.data.x+Dt[0],Qt.data.y=Qt.data.y+Dt[1],bt.add(Gt?Qt.data.x:Qt.data.y)});const Xt=Array.from(bt).sort(_t),ie=Gt?(Qt,oe)=>Qt.x!==oe.x:(Qt,oe)=>Qt.y!==oe.y,le=Gt?(Qt,oe,je)=>{const Ee=Math.max(oe.y,je.y),en=Math.min(oe.y,je.y);return Qt.filter(vn=>vn.y<=Ee&&vn.y>=en)}:(Qt,oe,je)=>{const Ee=Math.max(oe.x,je.x),en=Math.min(oe.x,je.x);return Qt.filter(vn=>vn.x<=Ee&&vn.x>=en)};X.getAllEdges().forEach((Qt,oe)=>{var je;L&&z&&Qt.data.type!=="loop"&&(Qt.data.controlPoints=co((je=Qt.data.points)===null||je===void 0?void 0:je.map(({x:Ee,y:en})=>({x:Ee+Dt[0],y:en+Dt[1]})),X.getNode(Qt.source),X.getNode(Qt.target),Xt,Gt,ie,le))})}let zt=[];zt=X.getAllNodes().map(bt=>Qe(bt));const Jt=X.getAllEdges();return e&&(zt.forEach(bt=>{t.mergeNodeData(bt.id,{x:bt.data.x,y:bt.data.y})}),Jt.forEach(bt=>{t.mergeEdgeData(bt.id,{controlPoints:bt.data.controlPoints})})),{nodes:zt,edges:Jt}})}}const co=(n,e,t,r,s,o,h)=>{let d=(n==null?void 0:n.slice(1,n.length-1))||[];if(e&&t){let{x:p,y:g}=e.data,{x:y,y:O}=t.data;if(s&&(p=e.data.y,g=e.data.x,y=t.data.y,O=t.data.x),O!==g&&p!==y){const L=r.indexOf(g),R=r[L+1];if(R){const z=d[0],C=s?{x:(g+R)/2,y:(z==null?void 0:z.y)||y}:{x:(z==null?void 0:z.x)||y,y:(g+R)/2};(!z||o(z,C))&&d.unshift(C)}const U=r.indexOf(O),F=Math.abs(U-L);if(F===1)d=h(d,e.data,t.data),d.length||d.push(s?{x:(g+O)/2,y:p}:{x:p,y:(g+O)/2});else if(F>1){const z=r[U-1];if(z){const C=d[d.length-1],W=s?{x:(O+z)/2,y:(C==null?void 0:C.y)||y}:{x:(C==null?void 0:C.x)||p,y:(O+z)/2};(!C||o(C,W))&&d.push(W)}}}}return d},Tn=(n,e,t)=>{const r=n.getAllNodes(),s=n.getAllEdges();if(!(r!=null&&r.length))return{nodes:[],edges:s};if(r.length===1)return e&&n.mergeNodeData(r[0].id,{x:t[0],y:t[1]}),{nodes:[Object.assign(Object.assign({},r[0]),{data:Object.assign(Object.assign({},r[0].data),{x:t[0],y:t[1]})})],edges:s}},fo={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class lo{constructor(e={}){this.options=e,this.id="circular",this.options=Object.assign(Object.assign({},fo),e)}execute(e,t){return A(this,void 0,void 0,function*(){return this.genericCircularLayout(!1,e,t)})}assign(e,t){return A(this,void 0,void 0,function*(){yield this.genericCircularLayout(!0,e,t)})}genericCircularLayout(e,t,r){return A(this,void 0,void 0,function*(){const s=Object.assign(Object.assign({},this.options),r),{width:o,height:h,center:d,divisions:p,startAngle:g=0,endAngle:y=2*Math.PI,angleRatio:O,ordering:L,clockwise:R,nodeSpacing:U,nodeSize:F}=s,z=t.getAllNodes(),C=t.getAllEdges(),[W,Y,X]=go(o,h,d),q=z==null?void 0:z.length;if(!q||q===1)return Tn(t,e,X);const st=(y-g)/q;let{radius:ut,startRadius:Q,endRadius:vt}=s;if(U){const Gt=Nn(10,U),zt=Es(10,F);let Jt=-1/0;z.forEach(bt=>{const kt=zt(bt);Jt{kt===0?fe+=Jt||10:fe+=(Gt(bt)||0)+(Jt||10)}),ut=fe/(2*Math.PI)}else!ut&&!Q&&!vt?ut=Math.min(Y,W)/2:!Q&&vt?Q=vt:Q&&!vt&&(vt=Q);const Et=st*O;let Tt=[];L==="topology"?Tt=Ns(t,z):L==="topology-directed"?Tt=Ns(t,z,!0):L==="degree"?Tt=ho(t,z):Tt=z.map(Gt=>Qe(Gt));const Pt=Math.ceil(q/p);for(let Gt=0;Gt{t.mergeNodeData(Gt.id,{x:Gt.data.x,y:Gt.data.y})}),{nodes:Tt,edges:C}})}}const Ns=(n,e,t=!1)=>{const r=[Qe(e[0])],s={},o=e.length;s[e[0].id]=!0;let h=0;return e.forEach((d,p)=>{if(p!==0)if((p===o-1||n.getDegree(d.id,"both")!==n.getDegree(e[p+1].id,"both")||n.areNeighbors(r[h].id,d.id))&&!s[d.id])r.push(Qe(d)),s[d.id]=!0,h++;else{const g=t?n.getSuccessors(r[h].id):n.getNeighbors(r[h].id);let y=!1;for(let L=0;L{t.push(Qe(r))}),t.sort((r,s)=>n.getDegree(r.id,"both")-n.getDegree(s.id,"both")),t}const go=(n,e,t)=>{let r=n,s=e,o=t;return!r&&typeof window!="undefined"&&(r=window.innerWidth),!s&&typeof window!="undefined"&&(s=window.innerHeight),o||(o=[r/2,s/2]),[r,s,o]};function Kn(n){return typeof n=="string"}const We=Array.isArray,po={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class Cr{constructor(e={}){this.options=e,this.id="concentric",this.options=Object.assign(Object.assign({},po),e)}execute(e,t){return A(this,void 0,void 0,function*(){return this.genericConcentricLayout(!1,e,t)})}assign(e,t){return A(this,void 0,void 0,function*(){yield this.genericConcentricLayout(!0,e,t)})}genericConcentricLayout(e,t,r){return A(this,void 0,void 0,function*(){const s=Object.assign(Object.assign({},this.options),r),{center:o,width:h,height:d,sortBy:p,maxLevelDiff:g,sweep:y,clockwise:O,equidistant:L,preventOverlap:R,startAngle:U=3/2*Math.PI,nodeSize:F,nodeSpacing:z}=s,C=t.getAllNodes(),W=t.getAllEdges(),Y=!h&&typeof window!="undefined"?window.innerWidth:h,X=!d&&typeof window!="undefined"?window.innerHeight:d,q=o||[Y/2,X/2];if(!(C!=null&&C.length)||C.length===1)return Tn(t,e,q);const st=[];let ut,Q=0;We(F)?ut=Math.max(F[0],F[1]):qe(F)?(ut=-1/0,C.forEach(bt=>{const kt=F(bt);kt>ut&&(ut=kt)})):ut=F,We(z)?Q=Math.max(z[0],z[1]):Yt(z)&&(Q=z),C.forEach(bt=>{const kt=Qe(bt);st.push(kt);let _t=ut;const{data:Xt}=kt;We(Xt.size)?_t=Math.max(Xt.size[0],Xt.size[1]):Yt(Xt.size)?_t=Xt.size:bn(Xt.size)&&(_t=Math.max(Xt.size.width,Xt.size.height)),ut=Math.max(ut,_t),qe(z)&&(Q=Math.max(z(bt),Q))});const vt={};st.forEach((bt,kt)=>{vt[bt.id]=kt});let Et=p;(!Kn(Et)||st[0].data[Et]===void 0)&&(Et="degree"),Et==="degree"?st.sort((bt,kt)=>t.getDegree(kt.id,"both")-t.getDegree(bt.id,"both")):st.sort((bt,kt)=>kt.data[Et]-bt.data[Et]);const Tt=st[0],Pt=(g||(Et==="degree"?t.getDegree(Tt.id,"both"):Tt.data[Et]))/4,Dt=[{nodes:[]}];let Gt=Dt[0];st.forEach(bt=>{if(Gt.nodes.length>0){const kt=Math.abs(Et==="degree"?t.getDegree(Gt.nodes[0].id,"both")-t.getDegree(bt.id,"both"):Gt.nodes[0].data[Et]-bt.data[Et]);Pt&&kt>=Pt&&(Gt={nodes:[]},Dt.push(Gt))}Gt.nodes.push(bt)});let zt=ut+Q;if(!R){const bt=Dt.length>0&&Dt[0].nodes.length>1,_t=(Math.min(Y,X)/2-zt)/(Dt.length+(bt?1:0));zt=Math.min(zt,_t)}let Jt=0;if(Dt.forEach(bt=>{const kt=y===void 0?2*Math.PI-2*Math.PI/bt.nodes.length:y;if(bt.dTheta=kt/Math.max(1,bt.nodes.length-1),bt.nodes.length>1&&R){const _t=Math.cos(bt.dTheta)-Math.cos(0),Xt=Math.sin(bt.dTheta)-Math.sin(0),ie=Math.sqrt(zt*zt/(_t*_t+Xt*Xt));Jt=Math.max(ie,Jt)}bt.r=Jt,Jt+=zt}),L){let bt=0,kt=0;for(let _t=0;_t{Xt===0&&(kt=_t.r||0),_t.r=kt,kt+=bt})}return Dt.forEach(bt=>{const kt=bt.dTheta||0,_t=bt.r||0;bt.nodes.forEach((Xt,ie)=>{const le=U+(O?1:-1)*kt*ie;Xt.data.x=q[0]+_t*Math.cos(le),Xt.data.y=q[1]+_t*Math.sin(le)})}),e&&st.forEach(bt=>t.mergeNodeData(bt.id,{x:bt.data.x,y:bt.data.y})),{nodes:st,edges:W}})}}function vo(n){const e=+this._x.call(null,n),t=+this._y.call(null,n);return Ms(this.cover(e,t),e,t,n)}function Ms(n,e,t,r){if(isNaN(e)||isNaN(t))return n;var s,o=n._root,h={data:r},d=n._x0,p=n._y0,g=n._x1,y=n._y1,O,L,R,U,F,z,C,W;if(!o)return n._root=h,n;for(;o.length;)if((F=e>=(O=(d+g)/2))?d=O:g=O,(z=t>=(L=(p+y)/2))?p=L:y=L,s=o,!(o=o[C=z<<1|F]))return s[C]=h,n;if(R=+n._x.call(null,o.data),U=+n._y.call(null,o.data),e===R&&t===U)return h.next=o,s?s[C]=h:n._root=h,n;do s=s?s[C]=new Array(4):n._root=new Array(4),(F=e>=(O=(d+g)/2))?d=O:g=O,(z=t>=(L=(p+y)/2))?p=L:y=L;while((C=z<<1|F)===(W=(U>=L)<<1|R>=O));return s[W]=o,s[C]=h,n}function mo(n){var e,t,r=n.length,s,o,h=new Array(r),d=new Array(r),p=1/0,g=1/0,y=-1/0,O=-1/0;for(t=0;ty&&(y=s),oO&&(O=o));if(p>y||g>O)return this;for(this.cover(p,g).cover(y,O),t=0;tn||n>=s||r>e||e>=o;)switch(g=(ey||(d=U.y0)>O||(p=U.x1)=C)<<1|n>=z)&&(U=L[L.length-1],L[L.length-1]=L[L.length-1-F],L[L.length-1-F]=U)}else{var W=n-+this._x.call(null,R.data),Y=e-+this._y.call(null,R.data),X=W*W+Y*Y;if(X=(L=(h+p)/2))?h=L:p=L,(F=O>=(R=(d+g)/2))?d=R:g=R,e=t,!(t=t[z=F<<1|U]))return this;if(!t.length)break;(e[z+1&3]||e[z+2&3]||e[z+3&3])&&(r=e,C=z)}for(;t.data!==n;)if(s=t,!(t=t.next))return this;return(o=t.next)&&delete t.next,s?(o?s.next=o:delete s.next,this):e?(o?e[z]=o:delete e[z],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(r?r[C]=t:this._root=t),this):(this._root=o,this)}function No(n){for(var e=0,t=n.length;e=(U=(p+O)/2))?p=U:O=U,(q=t>=(F=(g+L)/2))?g=F:L=F,(st=r>=(z=(y+R)/2))?y=z:R=z,o=h,!(h=h[ut=st<<2|q<<1|X]))return o[ut]=d,n;if(C=+n._x.call(null,h.data),W=+n._y.call(null,h.data),Y=+n._z.call(null,h.data),e===C&&t===W&&r===Y)return d.next=h,o?o[ut]=d:n._root=d,n;do o=o?o[ut]=new Array(8):n._root=new Array(8),(X=e>=(U=(p+O)/2))?p=U:O=U,(q=t>=(F=(g+L)/2))?g=F:L=F,(st=r>=(z=(y+R)/2))?y=z:R=z;while((ut=st<<2|q<<1|X)===(Q=(Y>=z)<<2|(W>=F)<<1|C>=U));return o[Q]=h,o[ut]=d,n}function Ro(n){Array.isArray(n)||(n=Array.from(n));const e=n.length,t=new Float64Array(e),r=new Float64Array(e),s=new Float64Array(e);let o=1/0,h=1/0,d=1/0,p=-1/0,g=-1/0,y=-1/0;for(let O=0,L,R,U,F;Op&&(p=R),Ug&&(g=U),Fy&&(y=F));if(o>p||h>g||d>y)return this;this.cover(o,h,d).cover(p,g,y);for(let O=0;On||n>=h||s>e||e>=d||o>t||t>=p;)switch(L=(tU||(g=Y.y0)>F||(y=Y.z0)>z||(O=Y.x1)=ut)<<2|(e>=st)<<1|n>=q)&&(Y=C[C.length-1],C[C.length-1]=C[C.length-1-X],C[C.length-1-X]=Y)}else{var Q=n-+this._x.call(null,W.data),vt=e-+this._y.call(null,W.data),Et=t-+this._z.call(null,W.data),Tt=Q*Q+vt*vt+Et*Et;if(Tt=(F=(h+g)/2))?h=F:g=F,(Y=R>=(z=(d+y)/2))?d=z:y=z,(X=U>=(C=(p+O)/2))?p=C:O=C,e=t,!(t=t[q=X<<2|Y<<1|W]))return this;if(!t.length)break;(e[q+1&7]||e[q+2&7]||e[q+3&7]||e[q+4&7]||e[q+5&7]||e[q+6&7]||e[q+7&7])&&(r=e,st=q)}for(;t.data!==n;)if(s=t,!(t=t.next))return this;return(o=t.next)&&delete t.next,s?(o?s.next=o:delete s.next,this):e?(o?e[q]=o:delete e[q],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(r?r[st]=t:this._root=t),this):(this._root=o,this)}function Bo(n){for(var e=0,t=n.length;e{const{nodeStrength:L,x:R,y:U,z:F,size:z}=y.data;return{x:R,y:U,z:F,size:z,index:O,id:y.id,vx:0,vy:0,vz:0,weight:o*L}}),p=(s===2?Fn(d,y=>y.x,y=>y.y):ur(d,y=>y.x,y=>y.y,y=>y.z)).visitAfter(Ho),g=new Map;return d.forEach(y=>{g.set(y.id,y),ta(y,p,s)}),d.map((y,O)=>{const{id:L,data:R}=h[O],{mass:U=1}=R;r[L]={x:y.vx/U,y:y.vy/U,z:y.vz/U}}),r}function Ho(n){let e=0,t=0,r=0,s=0,o=0;const h=n.length;if(h){for(let d=0;d{var d;if(((d=n.data)===null||d===void 0?void 0:d.id)===o.id)return;const p=[t,r,s][h-1],g=o.x-n.x||Fr,y=o.y-n.y||Fr,O=o.z-n.z||Fr,L=[g,y,O],R=p-e;let U=0;for(let C=0;Cqo(r,s,o,h,d,n,t))}const ea={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class Ts{constructor(e={}){this.options=e,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},ea),e)}execute(e,t){return A(this,void 0,void 0,function*(){return this.genericForceLayout(!1,e,t)})}assign(e,t){return A(this,void 0,void 0,function*(){yield this.genericForceLayout(!0,e,t)})}stop(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval),this.running=!1}tick(e=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let r=0;(this.judgingDistance>this.lastOptions.minMovement||r<1)&&rthis.lastGraph.mergeNodeData(r.id,{x:r.data.x,y:r.data.y,z:this.options.dimensions===3?r.data.z:void 0})),t}genericForceLayout(e,t,r){return A(this,void 0,void 0,function*(){const s=Object.assign(Object.assign({},this.options),r),o=t.getAllNodes(),h=t.getAllEdges(),d=this.formatOptions(s,t),{dimensions:p,width:g,height:y,nodeSize:O,getMass:L,nodeStrength:R,edgeStrength:U,linkDistance:F}=d,z=o.map((Q,vt)=>Object.assign(Object.assign({},Q),{data:Object.assign(Object.assign({},Q.data),{x:Yt(Q.data.x)?Q.data.x:Math.random()*g,y:Yt(Q.data.y)?Q.data.y:Math.random()*y,z:Yt(Q.data.z)?Q.data.z:Math.random()*Math.sqrt(g*y),size:O(Q)||30,mass:L(Q),nodeStrength:R(Q)})})),C=h.map(Q=>Object.assign(Object.assign({},Q),{data:Object.assign(Object.assign({},Q.data),{edgeStrength:U(Q),linkDistance:F(Q,t.getNode(Q.source),t.getNode(Q.target))})}));if(!(o!=null&&o.length))return this.lastResult={nodes:[],edges:h},{nodes:[],edges:h};const W={};o.forEach((Q,vt)=>{W[Q.id]={x:0,y:0,z:0}});const Y=new xe({nodes:z,edges:C});this.formatCentripetal(d,Y);const{maxIteration:X,minMovement:q,onTick:st}=d;if(this.lastLayoutNodes=z,this.lastLayoutEdges=C,this.lastAssign=e,this.lastGraph=t,this.lastCalcGraph=Y,this.lastOptions=d,this.lastVelMap=W,typeof window=="undefined")return;let ut=0;return new Promise(Q=>{this.timeInterval=window.setInterval(()=>{(!o||!this.running)&&Q({nodes:kr(t,z),edges:h}),this.runOneStep(Y,t,ut,W,d),this.updatePosition(t,Y,W,d),e&&z.forEach(vt=>t.mergeNodeData(vt.id,{x:vt.data.x,y:vt.data.y,z:p===3?vt.data.z:void 0})),st==null||st({nodes:kr(t,z),edges:h}),ut++,(ut>=X||this.judgingDistance{let L=1;Yt(O==null?void 0:O.data.mass)&&(L=O==null?void 0:O.data.mass);const R=t.getDegree(O.id,"both");return!R||R<5?L:R*5*L});const p=Nn(0,e.nodeSpacing);let g;d?qe(d)?g=O=>d(O)+p(O):We(d)?g=O=>{const L=d;return Math.max(L[0],L[1])+p(O)}:g=O=>d+p(O):g=O=>{const{size:L}=(O==null?void 0:O.data)||{};return L?We(L)?Math.max(L[0],L[1])+p(O):bn(L)?Math.max(L.width,L.height)+p(O):L+p(O):10+p(O)},r.nodeSize=g;const y=e.linkDistance?Nn(1,e.linkDistance):O=>1+r.nodeSize(t.getNode(O.source))+r.nodeSize(t.getNode(O.target));return r.linkDistance=y,r.nodeStrength=Nn(1,e.nodeStrength),r.edgeStrength=Nn(1,e.edgeStrength),r}formatCentripetal(e,t){const{dimensions:r,centripetalOptions:s,center:o,clusterNodeStrength:h,leafCluster:d,clustering:p,nodeClusterBy:g}=e,y=t.getAllNodes(),O=s||{leaf:2,single:2,others:1,center:C=>({x:o[0],y:o[1],z:r===3?o[2]:void 0})};typeof h!="function"&&(e.clusterNodeStrength=C=>h);let L,R;if(d&&g&&(L=js(t,g),R=Array.from(new Set(y==null?void 0:y.map(C=>C.data[g])))||[],e.centripetalOptions=Object.assign(O,{single:100,leaf:C=>{const{siblingLeaves:W,sameTypeLeaves:Y}=L[C.id]||{};return(Y==null?void 0:Y.length)===(W==null?void 0:W.length)||(R==null?void 0:R.length)===1?1:e.clusterNodeStrength(C)},others:1,center:C=>{const W=t.getDegree(C.id,"both");if(!W)return{x:100,y:100,z:0};let Y;if(W===1){const{sameTypeLeaves:X=[]}=L[C.id]||{};X.length===1?Y=void 0:X.length>1&&(Y=Is(X))}else Y=void 0;return{x:Y==null?void 0:Y.x,y:Y==null?void 0:Y.y,z:Y==null?void 0:Y.z}}})),p&&g){L||(L=js(t,g)),R||(R=Array.from(new Set(y.map(W=>W.data[g])))),R=R.filter(W=>W!==void 0);const C={};R.forEach(W=>{const Y=y.filter(X=>X.data[g]===W).map(X=>t.getNode(X.id));C[W]=Is(Y)}),e.centripetalOptions=Object.assign(O,{single:W=>e.clusterNodeStrength(W),leaf:W=>e.clusterNodeStrength(W),others:W=>e.clusterNodeStrength(W),center:W=>{const Y=C[W.data[g]];return{x:Y==null?void 0:Y.x,y:Y==null?void 0:Y.y,z:Y==null?void 0:Y.z}}})}const{leaf:U,single:F,others:z}=e.centripetalOptions||{};U&&typeof U!="function"&&(e.centripetalOptions.leaf=()=>U),F&&typeof F!="function"&&(e.centripetalOptions.single=()=>F),z&&typeof z!="function"&&(e.centripetalOptions.others=()=>z)}runOneStep(e,t,r,s,o){const h={},d=e.getAllNodes(),p=e.getAllEdges();if(!(d!=null&&d.length))return;const{monitor:g}=o;if(this.calRepulsive(e,h,o),p&&this.calAttractive(e,h,o),this.calGravity(e,t,h,o),this.updateVelocity(e,h,s,o),g){const y=this.calTotalEnergy(h,d);g({energy:y,nodes:t.getAllNodes(),edges:t.getAllEdges(),iterations:r})}}calTotalEnergy(e,t){if(!(t!=null&&t.length))return 0;let r=0;return t.forEach((s,o)=>{const h=e[s.id].x,d=e[s.id].y,p=this.options.dimensions===3?e[s.id].z:0,g=h*h+d*d+p*p,{mass:y=1}=s.data;r+=y*g*.5}),r}calRepulsive(e,t,r){const{dimensions:s,factor:o,coulombDisScale:h}=r;_o(e,o,h*h,t,s)}calAttractive(e,t,r){const{dimensions:s,nodeSize:o}=r;e.getAllEdges().forEach((h,d)=>{const{source:p,target:g}=h,y=e.getNode(p),O=e.getNode(g);if(!y||!O)return;let L=O.data.x-y.data.x,R=O.data.y-y.data.y,U=s===3?O.data.z-y.data.z:0;!L&&!R&&(L=Math.random()*.01,R=Math.random()*.01,s===3&&!U&&(U=Math.random()*.01));const F=Math.sqrt(L*L+R*R+U*U);if(F{const{id:F,data:z}=U,{mass:C,x:W,y:Y,z:X}=z,q=t.getNode(F);let st=0,ut=0,Q=0,vt=L;const Et=e.getDegree(F,"in"),Tt=e.getDegree(F,"out"),Pt=e.getDegree(F,"both"),Dt=o==null?void 0:o(q,Pt);if(Dt){const[Gt,zt,Jt]=Dt;st=W-Gt,ut=Y-zt,vt=Jt}else st=W-O[0],ut=Y-O[1],Q=X-O[2];if(vt&&(r[F].x-=vt*st/C,r[F].y-=vt*ut/C,r[F].z-=vt*Q/C),R){const{leaf:Gt,single:zt,others:Jt,center:fe}=R,{x:bt,y:kt,z:_t,centerStrength:Xt}=(fe==null?void 0:fe(q,d,p,g,y))||{x:0,y:0,z:0,centerStrength:0};if(!Yt(bt)||!Yt(kt))return;const ie=(W-bt)/C,le=(Y-kt)/C,Qt=(X-_t)/C;if(Xt&&(r[F].x-=Xt*ie,r[F].y-=Xt*le,r[F].z-=Xt*Qt),Pt===0){const je=zt(q);if(!je)return;r[F].x-=je*ie,r[F].y-=je*le,r[F].z-=je*Qt;return}if(Et===0||Tt===0){const je=Gt(q,d,p);if(!je)return;r[F].x-=je*ie,r[F].y-=je*le,r[F].z-=je*Qt;return}const oe=Jt(q);if(!oe)return;r[F].x-=oe*ie,r[F].y-=oe*le,r[F].z-=oe*Qt}})}updateVelocity(e,t,r,s){const{damping:o,maxSpeed:h,interval:d,dimensions:p}=s,g=e.getAllNodes();g!=null&&g.length&&g.forEach(y=>{const{id:O}=y;let L=(r[O].x+t[O].x*d)*o||.01,R=(r[O].y+t[O].y*d)*o||.01,U=p===3?(r[O].z+t[O].z*d)*o||.01:0;const F=Math.sqrt(L*L+R*R+U*U);if(F>h){const z=h/F;L=z*L,R=z*R,U=z*U}r[O]={x:L,y:R,z:U}})}updatePosition(e,t,r,s){const{distanceThresholdMode:o,interval:h,dimensions:d}=s,p=t.getAllNodes();if(!(p!=null&&p.length)){this.judgingDistance=0;return}let g=0;o==="max"?this.judgingDistance=-1/0:o==="min"&&(this.judgingDistance=1/0),p.forEach(y=>{const{id:O}=y,L=e.getNode(O);if(Yt(L.data.fx)&&Yt(L.data.fy)){t.mergeNodeData(O,{x:L.data.fx,y:L.data.fy,z:d===3?L.data.fz:void 0});return}const R=r[O].x*h,U=r[O].y*h,F=d===3?r[O].z*h:0;t.mergeNodeData(O,{x:y.data.x+R,y:y.data.y+U,z:y.data.z+F});const z=Math.sqrt(R*R+U*U+F*F);switch(o){case"max":this.judgingDistancez&&(this.judgingDistance=z);break;default:g=g+z;break}}),(!o||o==="mean")&&(this.judgingDistance=g/p.length)}}const js=(n,e)=>{const t=n.getAllNodes();if(!(t!=null&&t.length))return{};const r={};return t.forEach((s,o)=>{n.getDegree(s.id,"both")===1&&(r[s.id]=na(n,"leaf",s,e))}),r},na=(n,e,t,r)=>{const s=n.getDegree(t.id,"in"),o=n.getDegree(t.id,"out");let h=t,d=[];s===0?(h=n.getSuccessors(t.id)[0],d=n.getNeighbors(h.id)):o===0&&(h=n.getPredecessors(t.id)[0],d=n.getNeighbors(h.id)),d=d.filter(g=>n.getDegree(g.id,"in")===0||n.getDegree(g.id,"out")===0);const p=ra(n,e,r,t,d);return{coreNode:h,siblingLeaves:d,sameTypeLeaves:p}},ra=(n,e,t,r,s)=>{const o=r.data[t]||"";let h=(s==null?void 0:s.filter(d=>d.data[t]===o))||[];return e==="leaf"&&(h=h.filter(d=>n.getDegree(d.id,"in")===0||n.getDegree(d.id,"out")===0)),h},Is=n=>{const e={x:0,y:0};n.forEach(r=>{const{x:s,y:o}=r.data;e.x+=s||0,e.y+=o||0});const t=n.length||1;return{x:e.x/t,y:e.y/t}},kr=(n,e)=>e.map(t=>{const{id:r,data:s}=t,o=n.getNode(r);return Object.assign(Object.assign({},o),{data:Object.assign(Object.assign({},o.data),{x:s.x,y:s.y,z:s.z})})});var re=me(48202);const vc=re.XA,mc=re.a_,yc=re.yQ,wc=re.Hs,xc=re.Ec,Ec=re.dx,bc=re.LU,Nc=re.Rm,Mn=re.y3,Mc=re.qK,Sc=re.pb,Oc=re.j,Ac=re.sO,Tc=re.BZ,jc=re.EK,Ic=re.Db,Pc=re.Fx,Lc=re.tU,Rc=re.Ym,Cc=re.rs,Dc=re.QR,zc=re.TB,Fc=re.oH,Ps=re.Sc,kc=re.BN,Bc=re.it,Uc=re.$r,Vc=re.QM,Gc=re.AV;var Wc=(re.y3,re.y3);const Yc=re.GH,$c=re.SO,Xc=re.uZ,Kc=re.yU,Zc=re.F1,Jc=re.re,Ls=n=>{const e=[],t=n.length;for(let r=0;re[s][r]+e[r][o]&&(e[s][o]=e[s][r]+e[r][o]);return e},Rs=(n,e)=>{const{nodes:t,edges:r}=n,s=[],o={};if(!t)throw new Error("invalid nodes data!");return t&&t.forEach((h,d)=>{o[h.id]=d;const p=[];s.push(p)}),r==null||r.forEach(h=>{const{source:d,target:p}=h,g=o[d],y=o[p];g===void 0||y===void 0||(s[g][y]=1,e||(s[y][g]=1))}),s},sa=(n,e)=>{const t=[];return n.forEach(r=>{const s=[];r.forEach(o=>{s.push(o*e)}),t.push(s)}),t},ia=n=>{let e=1/0,t=1/0,r=-1/0,s=-1/0;return n.forEach(o=>{let h=o.data.size;We(h)?h.length===1&&(h=[h[0],h[0]]):Yt(h)?h=[h,h]:(h===void 0||isNaN(h))&&(h=[30,30]);const d=[h[0]/2,h[1]/2],p=o.data.x-d[0],g=o.data.x+d[0],y=o.data.y-d[1],O=o.data.y+d[1];e>p&&(e=p),t>y&&(t=y),rMath.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)),Br=(n,e,t,r="TB",s,o={})=>{if(!(e!=null&&e.length))return;const{stopBranchFn:h,stopAllFn:d}=o;for(let p=0;p{const C=Qe(d[z]);C.data.x=F[0]+o[0],C.data.y=F[1]+o[1],R.push(C)}),e&&R.forEach(F=>t.mergeNodeData(F.id,{x:F.data.x,y:F.data.y})),{nodes:R,edges:p}})}}const aa=n=>{let e=-999999;n.forEach(t=>{t.forEach(r=>{r!==1/0&&e{t.forEach((s,o)=>{s===1/0&&(n[r][o]=e)})})},ua=n=>{const t=Mn.mul(Mn.pow(n,2),-.5),r=t.mean("row"),s=t.mean("column"),o=t.mean();t.add(o).subRowVector(r).subColumnVector(s);const h=new Ps(t),d=Mn.sqrt(h.diagonalMatrix).diagonal();return h.leftSingularVectors.toJSON().map(p=>Mn.mul([p],[d]).toJSON()[0].splice(0,2))};function zs(n){return!!n.tick&&!!n.stop}const ca={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},fa={center:[0,0],comboPadding:10,treeKey:"combo"};class la{constructor(e={}){this.options=e,this.id="comboCombined",this.options=Object.assign(Object.assign({},fa),e)}execute(e,t){return A(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,e,t)})}assign(e,t){return A(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,e,t)})}genericComboCombinedLayout(e,t,r){return A(this,void 0,void 0,function*(){const s=this.initVals(Object.assign(Object.assign({},this.options),r)),{center:o,treeKey:h,outerLayout:d}=s,p=t.getAllNodes().filter(Q=>!Q.data._isCombo),g=t.getAllNodes().filter(Q=>Q.data._isCombo),y=t.getAllEdges(),O=p==null?void 0:p.length;if(!O||O===1)return Tn(t,e,o);const L=[],R=new Map;p.forEach(Q=>{R.set(Q.id,Q)});const U=new Map;g.forEach(Q=>{U.set(Q.id,Q)});const F=new Map,z=this.getInnerGraphs(t,h,R,U,y,s,F);yield Promise.all(z);const C=new Map,W=[],Y=new Map;let X=!0;t.getRoots(h).forEach(Q=>{const vt=F.get(Q.id),Et=U.get(Q.id)||R.get(Q.id),Tt={id:Q.id,data:Object.assign(Object.assign({},Q.data),{x:vt.data.x||Et.data.x,y:vt.data.y||Et.data.y,fx:vt.data.fx||Et.data.fx,fy:vt.data.fy||Et.data.fy,mass:vt.data.mass||Et.data.mass,size:vt.data.size})};W.push(Tt),C.set(Q.id,!0),!isNaN(Tt.data.x)&&Tt.data.x!==0&&!isNaN(Tt.data.y)&&Tt.data.y!==0?X=!1:(Tt.data.x=Math.random()*100,Tt.data.y=Math.random()*100),Br(t,[Q],Pt=>{Pt.id!==Q.id&&Y.set(Pt.id,Q.id)},"TB",h)});const q=[];y.forEach(Q=>{const vt=Y.get(Q.source)||Q.source,Et=Y.get(Q.target)||Q.target;vt!==Et&&C.has(vt)&&C.has(Et)&&q.push({id:Q.id,source:vt,target:Et,data:{}})});let st;if(W!=null&&W.length){if(W.length===1)W[0].data.x=o[0],W[0].data.y=o[1];else{const Q=new xe({nodes:W,edges:q}),vt=d||new Ts;X&&ca[vt.id]&&(yield(W.length<100?new Ds:new Cr).assign(Q));const Et=Object.assign({center:o,kg:5,preventOverlap:!0,animate:!1},vt.id==="force"?{gravity:1,factor:4,linkDistance:(Tt,Pt,Dt)=>{const Gt=Math.max(...Pt.data.size)||32,zt=Math.max(...Dt.data.size)||32;return Gt/2+zt/2+200}}:{});st=yield Fs(vt,Q,Et)}F.forEach(Q=>{var vt;const Et=st.nodes.find(Dt=>Dt.id===Q.id);if(Et){const{x:Dt,y:Gt}=Et.data;Q.data.visited=!0,Q.data.x=Dt,Q.data.y=Gt,L.push({id:Q.id,data:{x:Dt,y:Gt}})}const{x:Tt,y:Pt}=Q.data;(vt=Q.data.nodes)===null||vt===void 0||vt.forEach(Dt=>{L.push({id:Dt.id,data:{x:Dt.data.x+Tt,y:Dt.data.y+Pt}})})}),F.forEach(({data:Q})=>{const{x:vt,y:Et,visited:Tt,nodes:Pt}=Q;Pt==null||Pt.forEach(Dt=>{if(!Tt){const Gt=L.find(zt=>zt.id===Dt.id);Gt.data.x+=vt||0,Gt.data.y+=Et||0}})})}return e&&L.forEach(Q=>{t.mergeNodeData(Q.id,{x:Q.data.x,y:Q.data.y})}),{nodes:L,edges:y}})}initVals(e){const t=Object.assign({},e),{nodeSize:r,spacing:s,comboPadding:o}=e;let h,d;if(Yt(s)?d=()=>s:qe(s)?d=s:d=()=>0,t.spacing=d,!r)h=g=>{const y=d(g);return g.size?We(g.size)?((g.size[0]>g.size[1]?g.size[0]:g.size[1])+y)/2:bn(g.size)?((g.size.width>g.size.height?g.size.width:g.size.height)+y)/2:(g.size+y)/2:32+y/2};else if(qe(r))h=g=>{const y=r(g),O=d(g);return We(g.size)?((g.size[0]>g.size[1]?g.size[0]:g.size[1])+O)/2:((y||32)+O)/2};else if(We(r)){const y=(r[0]>r[1]?r[0]:r[1])/2;h=O=>y+d(O)/2}else{const g=r/2;h=y=>g+d(y)/2}t.nodeSize=h;let p;return Yt(o)?p=()=>o:We(o)?p=()=>Math.max.apply(null,o):qe(o)?p=o:p=()=>0,t.comboPadding=p,t}getInnerGraphs(e,t,r,s,o,h,d){const{nodeSize:p,comboPadding:g,spacing:y,innerLayout:O}=h,L=O||new Cr({}),R={center:[0,0],preventOverlap:!0,nodeSpacing:y},U=[],F=z=>{let C=(g==null?void 0:g(z))||10;return We(C)&&(C=Math.max(...C)),{size:C?[C*2,C*2]:[30,30],padding:C}};return e.getRoots(t).forEach(z=>{d.set(z.id,{id:z.id,data:{nodes:[],size:F(z).size}});let C=Promise.resolve();Br(e,[z],W=>{var Y;if(!W.data._isCombo)return;const{size:X,padding:q}=F(W);if(!(!((Y=e.getChildren(W.id,t))===null||Y===void 0)&&Y.length))d.set(W.id,{id:W.id,data:Object.assign(Object.assign({},W.data),{size:X})});else{const st=d.get(W.id);d.set(W.id,{id:W.id,data:Object.assign({nodes:[]},st==null?void 0:st.data)});const ut=new Map,Q=e.getChildren(W.id,t).map(Tt=>{if(Tt.data._isCombo)return d.has(Tt.id)||d.set(Tt.id,{id:Tt.id,data:Object.assign({},Tt.data)}),ut.set(Tt.id,!0),d.get(Tt.id);const Pt=r.get(Tt.id)||s.get(Tt.id);return ut.set(Tt.id,!0),{id:Tt.id,data:Object.assign(Object.assign({},Pt.data),Tt.data)}}),vt={nodes:Q,edges:o.filter(Tt=>ut.has(Tt.source)&&ut.has(Tt.target))};let Et=1/0;Q.forEach(Tt=>{var Pt;let{size:Dt}=Tt.data;Dt||(Dt=((Pt=d.get(Tt.id))===null||Pt===void 0?void 0:Pt.data.size)||(p==null?void 0:p(Tt))||[30,30]),Yt(Dt)&&(Dt=[Dt,Dt]);const[Gt,zt]=Dt;Et>Gt&&(Et=Gt),Et>zt&&(Et=zt),Tt.data.size=Dt}),C=C.then(()=>A(this,void 0,void 0,function*(){const Tt=new xe(vt);yield Fs(L,Tt,R,!0);const{minX:Pt,minY:Dt,maxX:Gt,maxY:zt}=ia(Q),Jt={x:(Gt+Pt)/2,y:(zt+Dt)/2};vt.nodes.forEach(bt=>{bt.data.x-=Jt.x,bt.data.y-=Jt.y});const fe=[Math.max(Gt-Pt,Et)+q*2,Math.max(zt-Dt,Et)+q*2];d.get(W.id).data.size=fe,d.get(W.id).data.nodes=Q}))}return!0},"BT",t),U.push(C)}),U}}function Fs(n,e,t,r){var s;return A(this,void 0,void 0,function*(){return zs(n)?(n.execute(e,t),n.stop(),n.tick((s=t.iterations)!==null&&s!==void 0?s:300)):r?yield n.assign(e,t):yield n.execute(e,t)})}var da=function(n){return typeof n=="object"&&n!==null},ha=da,ga={}.toString,pa=function(n,e){return ga.call(n)==="[object "+e+"]"},va=pa,ma=function(n){if(!ha(n)||!va(n,"Object"))return!1;if(Object.getPrototypeOf(n)===null)return!0;for(var e=n;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(n)===e},Ur=ma,ya=5;function wa(n,e){if(Object.hasOwn)return Object.hasOwn(n,e);if(n==null)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(n),e)}function ks(n,e,t,r){t=t||0,r=r||ya;for(var s in e)if(wa(e,s)){var o=e[s];o!==null&&Ur(o)?(Ur(n[s])||(n[s]={}),t[e(q,st,h),q])),X;for(z=0,d=new Array(C);z{}};function Gs(){for(var n=0,e=arguments.length,t={},r;n=0&&(r=t.slice(s+1),t=t.slice(0,s)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}})}cr.prototype=Gs.prototype={constructor:cr,on:function(n,e){var t=this._,r=Aa(n+"",t),s,o=-1,h=r.length;if(arguments.length<2){for(;++o0)for(var t=new Array(s),r=0,s,o;r=0&&n._call.call(void 0,e),n=n._next;--kn}function Zs(){jn=(lr=_n.now())+dr,kn=Zn=0;try{Pa()}finally{kn=0,Ra(),jn=0}}function La(){var n=_n.now(),e=n-lr;e>Ys&&(dr-=e,lr=n)}function Ra(){for(var n,e=fr,t,r=1/0;e;)e._call?(r>e._time&&(r=e._time),n=e,e=e._next):(t=e._next,e._next=null,e=n?n._next=t:fr=t);Qn=n,Gr(r)}function Gr(n){if(!kn){Zn&&(Zn=clearTimeout(Zn));var e=n-jn;e>24?(n<1/0&&(Zn=setTimeout(Zs,n-_n.now()-dr)),Jn&&(Jn=clearInterval(Jn))):(Jn||(lr=_n.now(),Jn=setInterval(La,Ys)),kn=1,$s(Zs))}}const Ca=1664525,Da=1013904223,Js=4294967296;function za(){let n=1;return()=>(n=(Ca*n+Da)%Js)/Js}function Fa(n){return n.x}function ka(n){return n.y}var Ba=10,Ua=Math.PI*(3-Math.sqrt(5));function Va(n){var e,t=1,r=.001,s=1-Math.pow(r,1/300),o=0,h=.6,d=new Map,p=Ks(O),g=ja("tick","end"),y=za();n==null&&(n=[]);function O(){L(),g.call("tick",e),t1?(z==null?d.delete(F):d.set(F,U(z)),e):d.get(F)},find:function(F,z,C){var W=0,Y=n.length,X,q,st,ut,Q;for(C==null?C=1/0:C*=C,W=0;W1?(g.on(F,z),e):g.on(F)}}}function Ga(){var n,e,t,r,s=Le(-30),o,h=1,d=1/0,p=.81;function g(R){var U,F=n.length,z=Fn(n,Fa,ka).visitAfter(O);for(r=R,U=0;U=d)return;(R.data!==e||R.next)&&(C===0&&(C=Sn(t),X+=C*C),W===0&&(W=Sn(t),X+=W*W),XL.index){var Tt=R-Q.x-Q.vx,Pt=U-Q.y-Q.vy,Dt=Tt*Tt+Pt*Pt;DtR+Et||stU+Et||utg.r&&(g.r=g[y].r)}function p(){if(e){var g,y=e.length,O;for(t=new Array(y),g=0;gt.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},Bs(this.options,e),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(e,t){return A(this,void 0,void 0,function*(){return this.genericLayout(!1,e,t)})}assign(e,t){return A(this,void 0,void 0,function*(){yield this.genericLayout(!0,e,t)})}stop(){this.simulation.stop()}tick(e){return this.simulation.tick(e),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(e,t){const r=this.context.nodes.find(s=>s.id===e);r&&t.forEach((s,o)=>{if(typeof s=="number"||s===null){const h=["fx","fy","fz"][o];r[h]=s}})}getOptions(e){var t,r;const s=Bs({},this.options,e);return s.collide&&((t=s.collide)===null||t===void 0?void 0:t.radius)===void 0&&(s.collide=s.collide||{},s.collide.radius=(r=s.nodeSize)!==null&&r!==void 0?r:10),s.iterations===void 0&&(s.link&&s.link.iterations===void 0&&(s.iterations=s.link.iterations),s.collide&&s.collide.iterations===void 0&&(s.iterations=s.collide.iterations)),this.context.options=s,s}genericLayout(e,t,r){var s;return A(this,void 0,void 0,function*(){const o=this.getOptions(r),h=t.getAllNodes().map(({id:y,data:O})=>Object.assign(Object.assign({id:y},O),Us(O.data,this.config.inputNodeAttrs))),d=t.getAllEdges().map(y=>Object.assign({},y));Object.assign(this.context,{assign:e,nodes:h,edges:d,graph:t});const p=new Promise(y=>{this.resolver=y}),g=this.setSimulation(o);return g.nodes(h),(s=g.force("link"))===null||s===void 0||s.links(d),p})}getResult(){const{assign:e,nodes:t,edges:r,graph:s}=this.context,o=t.map(d=>({id:d.id,data:Object.assign(Object.assign({},d.data),Us(d,this.config.outputNodeAttrs))})),h=r.map(({id:d,source:p,target:g,data:y})=>({id:d,source:typeof p=="object"?p.id:p,target:typeof g=="object"?g.id:g,data:y}));return e&&o.forEach(d=>s.mergeNodeData(d.id,d.data)),{nodes:o,edges:h}}initSimulation(){return Va()}setSimulation(e){const t=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=t.on("tick",()=>{var r;return(r=e.onTick)===null||r===void 0?void 0:r.call(e,this.getResult())}).on("end",()=>{var r;return(r=this.resolver)===null||r===void 0?void 0:r.call(this,this.getResult())})),_s(t,this.config.simulationAttrs.map(r=>[r,e[r]])),Object.entries(this.forceMap).forEach(([r,s])=>{const o=r;if(e[r]){let h=t.force(o);h||(h=s(),t.force(o,h)),_s(h,Object.entries(e[o]))}else t.force(o,null)}),t}}const _s=(n,e)=>e.reduce((t,[r,s])=>!t[r]||s===void 0?t:t[r].call(n,s),n);function Me(n){return function(){return n}}function tn(n){return(n()-.5)*1e-6}function Qa(n){return n.index}function Hs(n,e){var t=n.get(e);if(!t)throw new Error("node not found: "+e);return t}function _a(n){var e=Qa,t=L,r,s=Me(30),o,h,d,p,g,y,O=1;n==null&&(n=[]);function L(C){return 1/Math.min(p[C.source.index],p[C.target.index])}function R(C){for(var W=0,Y=n.length;W1&&(vt=ut.y+ut.vy-st.y-st.vy||tn(y)),d>2&&(Et=ut.z+ut.vz-st.z-st.vz||tn(y)),Tt=Math.sqrt(Q*Q+vt*vt+Et*Et),Tt=(Tt-o[X])/Tt*C*r[X],Q*=Tt,vt*=Tt,Et*=Tt,ut.vx-=Q*(Pt=g[X]),d>1&&(ut.vy-=vt*Pt),d>2&&(ut.vz-=Et*Pt),st.vx+=Q*(Pt=1-Pt),d>1&&(st.vy+=vt*Pt),d>2&&(st.vz+=Et*Pt)}function U(){if(h){var C,W=h.length,Y=n.length,X=new Map(h.map((st,ut)=>[e(st,ut,h),st])),q;for(C=0,p=new Array(W);Ctypeof Y=="function")||Math.random,d=W.find(Y=>[1,2,3].includes(Y))||2,U()},R.links=function(C){return arguments.length?(n=C,U(),R):n},R.id=function(C){return arguments.length?(e=C,R):e},R.iterations=function(C){return arguments.length?(O=+C,R):O},R.strength=function(C){return arguments.length?(t=typeof C=="function"?C:Me(+C),F(),R):t},R.distance=function(C){return arguments.length?(s=typeof C=="function"?C:Me(+C),z(),R):s},R}function Ha(n){const e=+this._x.call(null,n);return qs(this.cover(e),e,n)}function qs(n,e,t){if(isNaN(e))return n;var r,s=n._root,o={data:t},h=n._x0,d=n._x1,p,g,y,O,L;if(!s)return n._root=o,n;for(;s.length;)if((y=e>=(p=(h+d)/2))?h=p:d=p,r=s,!(s=s[O=+y]))return r[O]=o,n;if(g=+n._x.call(null,s.data),e===g)return o.next=s,r?r[O]=o:n._root=o,n;do r=r?r[O]=new Array(2):n._root=new Array(2),(y=e>=(p=(h+d)/2))?h=p:d=p;while((O=+y)==(L=+(g>=p)));return r[L]=s,r[O]=o,n}function qa(n){Array.isArray(n)||(n=Array.from(n));const e=n.length,t=new Float64Array(e);let r=1/0,s=-1/0;for(let o=0,h;os&&(s=h));if(r>s)return this;this.cover(r).cover(s);for(let o=0;on||n>=t;)switch(h=+(nh||(o=g.x1)=O))&&(g=d[d.length-1],d[d.length-1]=d[d.length-1-y],d[d.length-1-y]=g)}else{var L=Math.abs(n-+this._x.call(null,p.data));L=(g=(h+d)/2))?h=g:d=g,e=t,!(t=t[O=+y]))return this;if(!t.length)break;e[O+1&1]&&(r=e,L=O)}for(;t.data!==n;)if(s=t,!(t=t.next))return this;return(o=t.next)&&delete t.next,s?(o?s.next=o:delete s.next,this):e?(o?e[O]=o:delete e[O],(t=e[0]||e[1])&&t===(e[1]||e[0])&&!t.length&&(r?r[L]=t:this._root=t),this):(this._root=o,this)}function iu(n){for(var e=0,t=n.length;e{}};function ei(){for(var n=0,e=arguments.length,t={},r;n=0&&(r=t.slice(s+1),t=t.slice(0,s)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}})}hr.prototype=ei.prototype={constructor:hr,on:function(n,e){var t=this._,r=hu(n+"",t),s,o=-1,h=r.length;if(arguments.length<2){for(;++o0)for(var t=new Array(s),r=0,s,o;r=0&&n._call.call(void 0,e),n=n._next;--Bn}function ai(){In=(pr=er.now())+vr,Bn=Hn=0;try{mu()}finally{Bn=0,wu(),In=0}}function yu(){var n=er.now(),e=n-pr;e>ri&&(vr-=e,pr=n)}function wu(){for(var n,e=gr,t,r=1/0;e;)e._call?(r>e._time&&(r=e._time),n=e,e=e._next):(t=e._next,e._next=null,e=n?n._next=t:gr=t);tr=n,Xr(r)}function Xr(n){if(!Bn){Hn&&(Hn=clearTimeout(Hn));var e=n-In;e>24?(n<1/0&&(Hn=setTimeout(ai,n-er.now()-vr)),qn&&(qn=clearInterval(qn))):(qn||(pr=er.now(),qn=setInterval(yu,ri)),Bn=1,si(ai))}}const xu=1664525,Eu=1013904223,ui=4294967296;function bu(){let n=1;return()=>(n=(xu*n+Eu)%ui)/ui}var ci=3;function Kr(n){return n.x}function fi(n){return n.y}function Nu(n){return n.z}var Mu=10,Su=Math.PI*(3-Math.sqrt(5)),Ou=Math.PI*20/(9+Math.sqrt(221));function Au(n,e){e=e||2;var t=Math.min(ci,Math.max(1,Math.round(e))),r,s=1,o=.001,h=1-Math.pow(o,1/300),d=0,p=.6,g=new Map,y=oi(R),O=pu("tick","end"),L=bu();n==null&&(n=[]);function R(){U(),O.call("tick",r),s1&&(X.fy==null?X.y+=X.vy*=p:(X.y=X.fy,X.vy=0)),t>2&&(X.fz==null?X.z+=X.vz*=p:(X.z=X.fz,X.vz=0));return r}function F(){for(var C=0,W=n.length,Y;C1&&isNaN(Y.y)||t>2&&isNaN(Y.z)){var X=Mu*(t>2?Math.cbrt(.5+C):t>1?Math.sqrt(.5+C):C),q=C*Su,st=C*Ou;t===1?Y.x=X:t===2?(Y.x=X*Math.cos(q),Y.y=X*Math.sin(q)):(Y.x=X*Math.sin(q)*Math.cos(st),Y.y=X*Math.cos(q),Y.z=X*Math.sin(q)*Math.sin(st))}(isNaN(Y.vx)||t>1&&isNaN(Y.vy)||t>2&&isNaN(Y.vz))&&(Y.vx=0,t>1&&(Y.vy=0),t>2&&(Y.vz=0))}}function z(C){return C.initialize&&C.initialize(n,L,t),C}return F(),r={tick:U,restart:function(){return y.restart(R),r},stop:function(){return y.stop(),r},numDimensions:function(C){return arguments.length?(t=Math.min(ci,Math.max(1,Math.round(C))),g.forEach(z),r):t},nodes:function(C){return arguments.length?(n=C,F(),g.forEach(z),r):n},alpha:function(C){return arguments.length?(s=+C,r):s},alphaMin:function(C){return arguments.length?(o=+C,r):o},alphaDecay:function(C){return arguments.length?(h=+C,r):+h},alphaTarget:function(C){return arguments.length?(d=+C,r):d},velocityDecay:function(C){return arguments.length?(p=1-C,r):1-p},randomSource:function(C){return arguments.length?(L=C,g.forEach(z),r):L},force:function(C,W){return arguments.length>1?(W==null?g.delete(C):g.set(C,z(W)),r):g.get(C)},find:function(){var C=Array.prototype.slice.call(arguments),W=C.shift()||0,Y=(t>1?C.shift():null)||0,X=(t>2?C.shift():null)||0,q=C.shift()||1/0,st=0,ut=n.length,Q,vt,Et,Tt,Pt,Dt;for(q*=q,st=0;st1?(O.on(C,W),r):O.on(C)}}}function Tu(){var n,e,t,r,s,o=Me(-30),h,d=1,p=1/0,g=.81;function y(U){var F,z=n.length,C=(e===1?Wr(n,Kr):e===2?Fn(n,Kr,fi):e===3?ur(n,Kr,fi,Nu):null).visitAfter(L);for(s=U,F=0;F1&&(U.y=X/W),e>2&&(U.z=q/W)}else{z=U,z.x=z.data.x,e>1&&(z.y=z.data.y),e>2&&(z.z=z.data.z);do F+=h[z.data.index];while(z=z.next)}U.value=F}function R(U,F,z,C,W){if(!U.value)return!0;var Y=[z,C,W][e-1],X=U.x-t.x,q=e>1?U.y-t.y:0,st=e>2?U.z-t.z:0,ut=Y-F,Q=X*X+q*q+st*st;if(ut*ut/g1&&q===0&&(q=tn(r),Q+=q*q),e>2&&st===0&&(st=tn(r),Q+=st*st),Q1&&(t.vy+=q*U.value*s/Q),e>2&&(t.vz+=st*U.value*s/Q)),!0;if(U.length||Q>=p)return;(U.data!==t||U.next)&&(X===0&&(X=tn(r),Q+=X*X),e>1&&q===0&&(q=tn(r),Q+=q*q),e>2&&st===0&&(st=tn(r),Q+=st*st),Q1&&(t.vy+=q*ut),e>2&&(t.vz+=st*ut));while(U=U.next)}return y.initialize=function(U,...F){n=U,r=F.find(z=>typeof z=="function")||Math.random,e=F.find(z=>[1,2,3].includes(z))||2,O()},y.strength=function(U){return arguments.length?(o=typeof U=="function"?U:Me(+U),O(),y):o},y.distanceMin=function(U){return arguments.length?(d=U*U,y):Math.sqrt(d)},y.distanceMax=function(U){return arguments.length?(p=U*U,y):Math.sqrt(p)},y.theta=function(U){return arguments.length?(g=U*U,y):Math.sqrt(g)},y}function ju(n,e,t){var r,s=1;n==null&&(n=0),e==null&&(e=0),t==null&&(t=0);function o(){var h,d=r.length,p,g=0,y=0,O=0;for(h=0;h1&&(F=R.y+R.vy),t>2&&(z=R.z+R.vz),L.visit(X);function X(q,st,ut,Q,vt,Et,Tt){var Pt=[st,ut,Q,vt,Et,Tt],Dt=Pt[0],Gt=Pt[1],zt=Pt[2],Jt=Pt[t],fe=Pt[t+1],bt=Pt[t+2],kt=q.data,_t=q.r,Xt=C+_t;if(kt){if(kt.index>R.index){var ie=U-kt.x-kt.vx,le=t>1?F-kt.y-kt.vy:0,Qt=t>2?z-kt.z-kt.vz:0,oe=ie*ie+le*le+Qt*Qt;oe1&&le===0&&(le=tn(s),oe+=le*le),t>2&&Qt===0&&(Qt=tn(s),oe+=Qt*Qt),oe=(Xt-(oe=Math.sqrt(oe)))/oe*o,R.vx+=(ie*=oe)*(Xt=(_t*=_t)/(W+_t)),t>1&&(R.vy+=(le*=oe)*Xt),t>2&&(R.vz+=(Qt*=oe)*Xt),kt.vx-=ie*(Xt=1-Xt),t>1&&(kt.vy-=le*Xt),t>2&&(kt.vz-=Qt*Xt))}return}return Dt>U+Xt||Jt1&&(Gt>F+Xt||fe2&&(zt>z+Xt||bty.r&&(y.r=y[O].r)}function g(){if(e){var y,O=e.length,L;for(r=new Array(O),y=0;ytypeof L=="function")||Math.random,t=O.find(L=>[1,2,3].includes(L))||2,g()},d.iterations=function(y){return arguments.length?(h=+y,d):h},d.strength=function(y){return arguments.length?(o=+y,d):o},d.radius=function(y){return arguments.length?(n=typeof y=="function"?y:Me(+y),g(),d):n},d}function Lu(n,e,t,r){var s,o,h=Me(.1),d,p;typeof n!="function"&&(n=Me(+n)),e==null&&(e=0),t==null&&(t=0),r==null&&(r=0);function g(O){for(var L=0,R=s.length;L1&&(U.vy+=z*Y),o>2&&(U.vz+=C*Y)}}function y(){if(s){var O,L=s.length;for(d=new Array(L),p=new Array(L),O=0;O[1,2,3].includes(R))||2,y()},g.strength=function(O){return arguments.length?(h=typeof O=="function"?O:Me(+O),y(),g):h},g.radius=function(O){return arguments.length?(n=typeof O=="function"?O:Me(+O),y(),g):n},g.x=function(O){return arguments.length?(e=+O,g):e},g.y=function(O){return arguments.length?(t=+O,g):t},g.z=function(O){return arguments.length?(r=+O,g):r},g}function Ru(n){var e=Me(.1),t,r,s;typeof n!="function"&&(n=Me(n==null?0:+n));function o(d){for(var p=0,g=t.length,y;pe.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return Au()}}var di=me(70681),Fu=me.n(di);function ku(n){if(!n)return[0,0,0];if(Yt(n))return[n,n,n];if(n.length===0)return[0,0,0];const[e,t=e,r=e]=n;return[e,t,r]}class mr{constructor(e){this.id="dagre",this.options={},Object.assign(this.options,mr.defaultOptions,e)}execute(e,t){return A(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,e,Object.assign(Object.assign({},this.options),t))})}assign(e,t){return A(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,e,Object.assign(Object.assign({},this.options),t))})}genericDagreLayout(e,t,r){return A(this,void 0,void 0,function*(){const{nodeSize:s}=r,o=new di.graphlib.Graph;o.setGraph(r),o.setDefaultEdgeLabel(()=>({}));const h=t.getAllNodes(),d=t.getAllEdges();[...h,...d].some(({id:g})=>Yt(g))&&console.error("Dagre layout only support string id, it will convert number to string."),t.getAllNodes().forEach(g=>{const{id:y}=g,O=Object.assign({},g.data);if(s!==void 0){const[L,R]=ku(qe(s)?s(g):s);Object.assign(O,{width:L,height:R})}o.setNode(y.toString(),O)}),t.getAllEdges().forEach(({id:g,source:y,target:O})=>{o.setEdge(y.toString(),O.toString(),{id:g})}),Fu().layout(o);const p={nodes:[],edges:[]};return o.nodes().forEach(g=>{const y=o.node(g);p.nodes.push({id:g,data:y}),e&&t.mergeNodeData(g,y)}),o.edges().forEach(g=>{const y=o.edge(g),{id:O}=y,L=l(y,["id"]),{v:R,w:U}=g;p.edges.push({id:O,source:R,target:U,data:L}),e&&t.mergeEdgeData(O,L)}),p})}}mr.defaultOptions={};class Jr{constructor(e){this.id=e.id||0,this.rx=e.rx,this.ry=e.ry,this.fx=0,this.fy=0,this.mass=e.mass,this.degree=e.degree,this.g=e.g||0}distanceTo(e){const t=this.rx-e.rx,r=this.ry-e.ry;return Math.hypot(t,r)}setPos(e,t){this.rx=e,this.ry=t}resetForce(){this.fx=0,this.fy=0}addForce(e){const t=e.rx-this.rx,r=e.ry-this.ry;let s=Math.hypot(t,r);s=s<1e-4?1e-4:s;const o=this.g*(this.degree+1)*(e.degree+1)/s;this.fx+=o*t/s,this.fy+=o*r/s}in(e){return e.contains(this.rx,this.ry)}add(e){const t=this.mass+e.mass,r=(this.rx*this.mass+e.rx*e.mass)/t,s=(this.ry*this.mass+e.ry*e.mass)/t,o=this.degree+e.degree,h={rx:r,ry:s,mass:t,degree:o};return new Jr(h)}}class Un{constructor(e){this.xmid=e.xmid,this.ymid=e.ymid,this.length=e.length,this.massCenter=e.massCenter||[0,0],this.mass=e.mass||1}getLength(){return this.length}contains(e,t){const r=this.length/2;return e<=this.xmid+r&&e>=this.xmid-r&&t<=this.ymid+r&&t>=this.ymid-r}NW(){const e=this.xmid-this.length/4,t=this.ymid+this.length/4,r=this.length/2,s={xmid:e,ymid:t,length:r};return new Un(s)}NE(){const e=this.xmid+this.length/4,t=this.ymid+this.length/4,r=this.length/2,s={xmid:e,ymid:t,length:r};return new Un(s)}SW(){const e=this.xmid-this.length/4,t=this.ymid-this.length/4,r=this.length/2,s={xmid:e,ymid:t,length:r};return new Un(s)}SE(){const e=this.xmid+this.length/4,t=this.ymid-this.length/4,r=this.length/2,s={xmid:e,ymid:t,length:r};return new Un(s)}}class Vn{constructor(e){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,e!=null&&(this.quad=e)}insert(e){if(this.body==null){this.body=e;return}this._isExternal()?(this.quad&&(this.NW=new Vn(this.quad.NW()),this.NE=new Vn(this.quad.NE()),this.SW=new Vn(this.quad.SW()),this.SE=new Vn(this.quad.SE())),this._putBody(this.body),this._putBody(e),this.body=this.body.add(e)):(this.body=this.body.add(e),this._putBody(e))}_putBody(e){this.quad&&(e.in(this.quad.NW())&&this.NW?this.NW.insert(e):e.in(this.quad.NE())&&this.NE?this.NE.insert(e):e.in(this.quad.SW())&&this.SW?this.SW.insert(e):e.in(this.quad.SE())&&this.SE&&this.SE.insert(e))}_isExternal(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null}updateForce(e){if(!(this.body==null||e===this.body))if(this._isExternal())e.addForce(this.body);else{const t=this.quad?this.quad.getLength():0,r=this.body.distanceTo(e);t/rQe(C,[d,p])),U=s.filter(C=>{const{source:W,target:Y}=C;return W!==Y}),F=new xe({nodes:R,edges:U}),z=this.getSizes(F,t,O);if(this.run(F,t,y,z,e,h),g){for(let W=0;W250&&(r.barnesHut=!0),p===void 0&&t>100&&(r.prune=!0),g===0&&!p?(r.maxIteration=250,t<=200&&t>100?r.maxIteration=1e3:t>200&&(r.maxIteration=1200)):g===0&&p&&(r.maxIteration=100,t<=200&&t>100?r.maxIteration=500:t>200&&(r.maxIteration=950)),y||(r.kr=50,t>100&&t<=500?r.kr=20:t>500&&(r.kr=1)),O||(r.kg=20,t>100&&t<=500?r.kg=10:t>500&&(r.kg=1)),r}run(e,t,r,s,o,h){const{kr:d,barnesHut:p,onTick:g}=h,y=e.getAllNodes();let O=0,L=r;const R={},U={},F={};for(let z=0;z0;)O=this.oneStep(e,{iter:L,preventOverlapIters:50,krPrime:100,sg:O,forces:R,preForces:U,bodies:F,sizes:s},h),L--,g==null||g({nodes:y,edges:t.getAllEdges()});return e}oneStep(e,t,r){const{iter:s,preventOverlapIters:o,krPrime:h,sg:d,preForces:p,bodies:g,sizes:y}=t;let{forces:O}=t;const{preventOverlap:L,barnesHut:R}=r,U=e.getAllNodes();for(let F=0;Fo||!L)?O=this.getOptRepGraForces(e,O,g,r):O=this.getRepGraForces(e,s,o,O,h,y,r),this.updatePos(e,O,p,d,r)}getAttrForces(e,t,r,s,o,h){const{preventOverlap:d,dissuadeHubs:p,mode:g,prune:y}=h,O=e.getAllEdges();for(let L=0;L0&&(q=X,st=X),o[R][0]+=q*Y[0],o[U][0]-=st*Y[0],o[R][1]+=q*Y[1],o[U][1]-=st*Y[1]}return o}getOptRepGraForces(e,t,r,s){const{kg:o,center:h,prune:d}=s,p=e.getAllNodes(),g=p.length;let y=9e10,O=-9e10,L=9e10,R=-9e10;for(let W=0;W=O&&(O=X.x),X.x<=y&&(y=X.x),X.y>=R&&(R=X.y),X.y<=L&&(L=X.y))}const U=Math.max(O-y,R-L),F={xmid:(O+y)/2,ymid:(R+L)/2,length:U,massCenter:h,mass:g},z=new Un(F),C=new Vn(z);for(let W=0;W0&&(Et=g*(C+1)*(ut+1)/vt),s[z.id][0]-=Et*Q[0],s[st.id][0]+=Et*Q[0],s[z.id][1]-=Et*Q[1],s[st.id][1]+=Et*Q[1]}const W=[z.data.x-O[0],z.data.y-O[1]],Y=Math.hypot(W[0],W[1]);W[0]=W[0]/Y,W[1]=W[1]/Y;const X=y*(C+1);s[z.id][0]-=X*W[0],s[z.id][1]-=X*W[1]}return s}updatePos(e,t,r,s,o){const{ks:h,tao:d,prune:p,ksmax:g}=o,y=e.getAllNodes(),O=y.length,L=[],R=[];let U=0,F=0,z=s;for(let W=0;W1.5*C?1.5*C:z);for(let W=0;WQ?Q:st;const vt=st*t[Y][0],Et=st*t[Y][1];e.mergeNodeData(Y,{x:X.x+vt,y:X.y+Et})}return z}}const Vu={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},Gu=800;class Wu{constructor(e={}){this.options=e,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},Vu),e)}execute(e,t){return A(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,e,t)})}assign(e,t){return A(this,void 0,void 0,function*(){yield this.genericFruchtermanLayout(!0,e,t)})}stop(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval),this.running=!1}tick(e=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let r=0;rthis.lastGraph.mergeNodeData(r.id,{x:r.data.x,y:r.data.y,z:this.options.dimensions===3?r.data.z:void 0})),t}genericFruchtermanLayout(e,t,r){return A(this,void 0,void 0,function*(){if(this.running)return;const s=this.formatOptions(r),{dimensions:o,width:h,height:d,center:p,clustering:g,nodeClusterBy:y,maxIteration:O,onTick:L}=s,R=t.getAllNodes(),U=t.getAllEdges();if(!(R!=null&&R.length)){const Y={nodes:[],edges:U};return this.lastResult=Y,Y}if(R.length===1){e&&t.mergeNodeData(R[0].id,{x:p[0],y:p[1],z:o===3?p[2]:void 0});const Y={nodes:[Object.assign(Object.assign({},R[0]),{data:Object.assign(Object.assign({},R[0].data),{x:p[0],y:p[1],z:o===3?p[2]:void 0})})],edges:U};return this.lastResult=Y,Y}const F=R.map(Y=>Qe(Y,[h,d])),z=new xe({nodes:F,edges:U}),C={};if(g&&F.forEach(Y=>{const X=Y.data[y];C[X]||(C[X]={name:X,cx:0,cy:0,count:0})}),this.lastLayoutNodes=F,this.lastLayoutEdges=U,this.lastAssign=e,this.lastGraph=z,this.lastOptions=s,this.lastClusterMap=C,typeof window=="undefined")return;let W=0;return new Promise(Y=>{this.timeInterval=window.setInterval(()=>{if(!this.running){Y({nodes:F,edges:U});return}this.runOneStep(z,C,s),e&&F.forEach(({id:X,data:q})=>t.mergeNodeData(X,{x:q.x,y:q.y,z:o===3?q.z:void 0})),L==null||L({nodes:F,edges:U}),W++,W>=O&&(window.clearInterval(this.timeInterval),Y({nodes:F,edges:U}))},0),this.running=!0})})}formatOptions(e={}){const t=Object.assign(Object.assign({},this.options),e),{clustering:r,nodeClusterBy:s}=t,{center:o,width:h,height:d}=t;return t.width=!h&&typeof window!="undefined"?window.innerWidth:h,t.height=!d&&typeof window!="undefined"?window.innerHeight:d,t.center=o||[t.width/2,t.height/2],t.clustering=r&&!!s,t}runOneStep(e,t,r){const{dimensions:s,height:o,width:h,gravity:d,center:p,speed:g,clustering:y,nodeClusterBy:O,clusterGravity:L}=r,R=o*h,U=Math.sqrt(R)/10,F=e.getAllNodes(),z=R/(F.length+1),C=Math.sqrt(z),W={};if(this.applyCalculate(e,W,C,z),y){for(const X in t)t[X].cx=0,t[X].cy=0,t[X].count=0;F.forEach(X=>{const{data:q}=X,st=t[q[O]];Yt(q.x)&&(st.cx+=q.x),Yt(q.y)&&(st.cy+=q.y),st.count++});for(const X in t)t[X].cx/=t[X].count,t[X].cy/=t[X].count;const Y=L||d;F.forEach((X,q)=>{const{id:st,data:ut}=X;if(!Yt(ut.x)||!Yt(ut.y))return;const Q=t[ut[O]],vt=Math.sqrt((ut.x-Q.cx)*(ut.x-Q.cx)+(ut.y-Q.cy)*(ut.y-Q.cy)),Et=C*Y;W[st].x-=Et*(ut.x-Q.cx)/vt,W[st].y-=Et*(ut.y-Q.cy)/vt})}F.forEach((Y,X)=>{const{id:q,data:st}=Y;if(!Yt(st.x)||!Yt(st.y))return;const ut=.01*C*d;W[q].x-=ut*(st.x-p[0]),W[q].y-=ut*(st.y-p[1]),s===3&&(W[q].z-=ut*(st.z-p[2]))}),F.forEach((Y,X)=>{const{id:q,data:st}=Y;if(Yt(st.fx)&&Yt(st.fy)){st.x=st.fx,st.y=st.fy,s===3&&(st.z=st.fz);return}if(!Yt(st.x)||!Yt(st.y))return;const ut=Math.sqrt(W[q].x*W[q].x+W[q].y*W[q].y+(s===3?W[q].z*W[q].z:0));if(ut>0){const Q=Math.min(U*(g/Gu),ut);e.mergeNodeData(q,{x:st.x+W[q].x/ut*Q,y:st.y+W[q].y/ut*Q,z:s===3?st.z+W[q].z/ut*Q:void 0})}})}applyCalculate(e,t,r,s){this.calRepulsive(e,t,s),this.calAttractive(e,t,r)}calRepulsive(e,t,r){const s=e.getAllNodes();s.forEach(({data:o,id:h},d)=>{t[h]={x:0,y:0,z:0},s.forEach(({data:p,id:g},y)=>{if(d<=y||!Yt(o.x)||!Yt(p.x)||!Yt(o.y)||!Yt(p.y))return;let O=o.x-p.x,L=o.y-p.y,R=this.options.dimensions===3?o.z-p.z:0,U=O*O+L*L+R*R;U===0&&(U=1,O=.01,L=.01,R=.01);const F=r/U,z=O*F,C=L*F,W=R*F;t[h].x+=z,t[h].y+=C,t[g].x-=z,t[g].y-=C,this.options.dimensions===3&&(t[h].z+=W,t[g].z-=W)})})}calAttractive(e,t,r){e.getAllEdges().forEach(o=>{const{source:h,target:d}=o;if(!h||!d||h===d)return;const{data:p}=e.getNode(h),{data:g}=e.getNode(d);if(!Yt(g.x)||!Yt(p.x)||!Yt(g.y)||!Yt(p.y))return;const y=g.x-p.x,O=g.y-p.y,L=this.options.dimensions===3?g.z-p.z:0,R=Math.sqrt(y*y+O*O+L*L)/r,U=y*R,F=O*R,z=L*R;t[h].x+=U,t[h].y+=F,t[d].x-=U,t[d].y-=F,this.options.dimensions===3&&(t[h].z+=z,t[d].z-=z)})}}const Yu={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300};class $u{constructor(e={}){this.options=e,this.id="grid",this.options=Object.assign(Object.assign({},Yu),e)}execute(e,t){return A(this,void 0,void 0,function*(){return this.genericGridLayout(!1,e,t)})}assign(e,t){return A(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,e,t)})}genericGridLayout(e,t,r){return A(this,void 0,void 0,function*(){const s=Object.assign(Object.assign({},this.options),r),{begin:o=[0,0],condense:h,preventOverlapPadding:d,preventOverlap:p,rows:g,cols:y,nodeSpacing:O,nodeSize:L,width:R,height:U,position:F}=s;let{sortBy:z}=s;const C=t.getAllNodes(),W=t.getAllEdges(),Y=C==null?void 0:C.length;if(!Y||Y===1)return Tn(t,e,o);const X=C.map(zt=>Qe(zt));z!=="id"&&(!Kn(z)||X[0].data[z]===void 0)&&(z="degree"),z==="degree"?X.sort((zt,Jt)=>t.getDegree(Jt.id,"both")-t.getDegree(zt.id,"both")):z==="id"?X.sort((zt,Jt)=>Yt(Jt.id)&&Yt(zt.id)?Jt.id-zt.id:`${zt.id}`.localeCompare(`${Jt.id}`)):X.sort((zt,Jt)=>Jt.data[z]-zt.data[z]);const q=!R&&typeof window!="undefined"?window.innerWidth:R,st=!U&&typeof window!="undefined"?window.innerHeight:U,ut=Y,Q={rows:g,cols:y};if(g!=null&&y!=null)Q.rows=g,Q.cols=y;else if(g!=null&&y==null)Q.rows=g,Q.cols=Math.ceil(ut/Q.rows);else if(g==null&&y!=null)Q.cols=y,Q.rows=Math.ceil(ut/Q.cols);else{const zt=Math.sqrt(ut*st/q);Q.rows=Math.round(zt),Q.cols=Math.round(q/st*zt)}if(Q.rows=Math.max(Q.rows,1),Q.cols=Math.max(Q.cols,1),Q.cols*Q.rows>ut){const zt=yr(Q),Jt=wr(Q);(zt-1)*Jt>=ut?yr(Q,zt-1):(Jt-1)*zt>=ut&&wr(Q,Jt-1)}else for(;Q.cols*Q.rows=ut?wr(Q,Jt+1):yr(Q,zt+1)}let vt=h?0:q/Q.cols,Et=h?0:st/Q.rows;if(p||O){const zt=Nn(10,O),Jt=Es(30,L,!1);X.forEach(fe=>{(!fe.data.x||!fe.data.y)&&(fe.data.x=0,fe.data.y=0);const bt=t.getNode(fe.id),kt=Jt(bt)||30;let _t,Xt;We(kt)?(_t=kt[0],Xt=kt[1]):(_t=kt,Xt=kt);const ie=zt!==void 0?zt(fe):d,le=_t+ie,Qt=Xt+ie;vt=Math.max(vt,le),Et=Math.max(Et,Qt)})}const Tt={},Pt={row:0,col:0},Dt={};for(let zt=0;zt{t.mergeNodeData(zt.id,{x:zt.data.x,y:zt.data.y})}),Gt})}}const yr=(n,e)=>{let t;const r=n.rows||5,s=n.cols||5;return e==null?t=Math.min(r,s):Math.min(r,s)===n.rows?n.rows=e:n.cols=e,t},wr=(n,e)=>{let t;const r=n.rows||5,s=n.cols||5;return e==null?t=Math.max(r,s):Math.max(r,s)===n.rows?n.rows=e:n.cols=e,t},Qr=(n,e)=>n[`c-${e.row}-${e.col}`]||!1,hi=(n,e)=>n[`c-${e.row}-${e.col}`]=!0,gi=(n,e)=>{const t=n.cols||5;e.col++,e.col>=t&&(e.col=0,e.row++)},Xu=(n,e,t,r,s,o,h,d)=>{let p,g;const y=s[n.id];if(y)p=y.col*t+t/2+e[0],g=y.row*r+r/2+e[1];else{for(;Qr(d,h);)gi(o,h);p=h.col*t+t/2+e[0],g=h.row*r+r/2+e[1],hi(d,h),gi(o,h)}n.data.x=p,n.data.y=g},Ku=(n,e,t)=>{try{const r=Mn.mul(Mn.pow(e,2),-.5),s=r.mean("row"),o=r.mean("column"),h=r.mean();r.add(h).subRowVector(s).subColumnVector(o);const d=new Ps(r),p=Mn.sqrt(d.diagonalMatrix).diagonal();return d.leftSingularVectors.toJSON().map(g=>Mn.mul([g],[p]).toJSON()[0].splice(0,n))}catch(r){const s=[];for(let o=0;o{const t=Object.assign(Object.assign({},Ju),e),{positions:r,iterations:s,width:o,k:h,speed:d=100,strictRadial:p,focusIdx:g,radii:y=[],nodeSizeFunc:O}=t,L=n.getAllNodes(),R=[],U=o/10;for(let F=0;F{R[C]={x:0,y:0}}),_u(L,r,R,h,y,O),Hu(r,R,d,p,g,U,o,y);return r},_u=(n,e,t,r,s,o)=>{e.forEach((h,d)=>{t[d]={x:0,y:0},e.forEach((p,g)=>{if(d===g||s[d]!==s[g])return;let y=h.x-p.x,O=h.y-p.y,L=Math.sqrt(y*y+O*O);if(L===0){L=1;const R=d>g?1:-1;y=.01*R,O=.01*R}if(L{const p=o||h/10;return r&&e.forEach((g,y)=>{const O=n[y].x-n[s].x,L=n[y].y-n[s].y,R=Math.sqrt(O*O+L*L);let U=L/R,F=-O/R;const z=Math.sqrt(g.x*g.x+g.y*g.y);let C=Math.acos((U*g.x+F*g.y)/z);C>Math.PI/2&&(C-=Math.PI/2,U*=-1,F*=-1);const W=Math.cos(C)*z;g.x=U*W,g.y=F*W}),n.forEach((g,y)=>{if(y===s)return;const O=Math.sqrt(e[y].x*e[y].x+e[y].y*e[y].y);if(O>0&&y!==s){const L=Math.min(p*(t/Zu),O);if(g.x+=e[y].x/O*L,g.y+=e[y].y/O*L,r){let R=g.x-n[s].x,U=g.y-n[s].y;const F=Math.sqrt(R*R+U*U);R=R/F*d[y],U=U/F*d[y],g.x=n[s].x+R,g.y=n[s].y+U}}}),n},qu={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class tc{constructor(e={}){this.options=e,this.id="radial",this.options=Object.assign(Object.assign({},qu),e)}execute(e,t){return A(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,e,t)})}assign(e,t){return A(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,e,t)})}genericRadialLayout(e,t,r){return A(this,void 0,void 0,function*(){const s=Object.assign(Object.assign({},this.options),r),{width:o,height:h,center:d,focusNode:p,unitRadius:g,nodeSize:y,nodeSpacing:O,strictRadial:L,preventOverlap:R,maxPreventOverlapIteration:U,sortBy:F,linkDistance:z=50,sortStrength:C=10,maxIteration:W=1e3}=s,Y=t.getAllNodes(),X=t.getAllEdges(),q=!o&&typeof window!="undefined"?window.innerWidth:o,st=!h&&typeof window!="undefined"?window.innerHeight:h,ut=d||[q/2,st/2];if(!(Y!=null&&Y.length)||Y.length===1)return Tn(t,e,ut);let Q=Y[0];if(Kn(p)){for(let Ee=0;Eeut[0]?ut[0]:q-ut[0],zt=st-ut[1]>ut[1]?ut[1]:st-ut[1];Gt===0&&(Gt=q/2),zt===0&&(zt=st/2);const Jt=Math.min(Gt,zt),fe=Math.max(...Dt),bt=[],kt=g||Jt/fe;Dt.forEach((Ee,en)=>{bt[en]=Ee*kt});const _t=ec(Y,Tt,z,bt,kt,F,C),Xt=nc(_t),ie=Ku(z,_t,z);let le=ie.map(([Ee,en])=>({x:(isNaN(Ee)?Math.random()*z:Ee)-ie[vt][0],y:(isNaN(en)?Math.random()*z:en)-ie[vt][1]}));this.run(W,le,Xt,_t,bt,vt);let Qt;if(R){Qt=bs(y,O);const Ee={nodes:Y,nodeSizeFunc:Qt,positions:le,radii:bt,height:st,width:q,strictRadial:!!L,focusIdx:vt,iterations:U||200,k:le.length/4.5};le=Qu(t,Ee)}const oe=[];return le.forEach((Ee,en)=>{const vn=Qe(Y[en]);vn.data.x=Ee.x+ut[0],vn.data.y=Ee.y+ut[1],oe.push(vn)}),e&&oe.forEach(Ee=>t.mergeNodeData(Ee.id,{x:Ee.data.x,y:Ee.data.y})),{nodes:oe,edges:X}})}run(e,t,r,s,o,h){for(let d=0;d<=e;d++){const p=d/e;this.oneIteration(p,t,o,s,r,h)}}oneIteration(e,t,r,s,o,h){const d=1-e;t.forEach((p,g)=>{const y=Cs(p,{x:0,y:0}),O=y===0?0:1/y;if(g===h)return;let L=0,R=0,U=0;t.forEach((z,C)=>{if(g===C)return;const W=Cs(p,z),Y=W===0?0:1/W,X=s[C][g];U+=o[g][C],L+=o[g][C]*(z.x+X*(p.x-z.x)*Y),R+=o[g][C]*(z.y+X*(p.y-z.y)*Y)});const F=r[g]===0?0:1/r[g];U*=d,U+=e*F*F,L*=d,L+=e*F*p.x*O,p.x=L/U,R*=d,R+=e*F*p.y*O,p.y=R/U})}}const ec=(n,e,t,r,s,o,h)=>{if(!n)return[];const d=[];if(e){const p={};e.forEach((g,y)=>{const O=[];g.forEach((L,R)=>{var U,F;if(y===R)O.push(0);else if(r[y]===r[R])if(o==="data")O.push(L*(Math.abs(y-R)*h)/(r[y]/s));else if(o){let z,C;if(p[n[y].id])z=p[n[y].id];else{const W=(o==="id"?n[y].id:(U=n[y].data)===null||U===void 0?void 0:U[o])||0;Kn(W)?z=W.charCodeAt(0):z=W,p[n[y].id]=z}if(p[n[R].id])C=p[n[R].id];else{const W=(o==="id"?n[R].id:(F=n[R].data)===null||F===void 0?void 0:F[o])||0;Kn(W)?C=W.charCodeAt(0):C=W,p[n[R].id]=C}O.push(L*(Math.abs(z-C)*h)/(r[y]/s))}else O.push(L*t/(r[y]/s));else{const z=(t+s)/2;O.push(L*z)}}),d.push(O)})}return d},nc=n=>{const e=n.length,t=n[0].length,r=[];for(let s=0;s{let t=-1;return n.forEach((r,s)=>{r.id===e&&(t=s)}),Math.max(t,0)},sc=(n,e,t)=>{const r=n.length;for(let s=0;s{let t=0;for(let r=0;rt?n[e][r]:t);return t},oc={center:[0,0],width:300,height:300};class ac{constructor(e={}){this.options=e,this.id="random",this.options=Object.assign(Object.assign({},oc),e)}execute(e,t){return A(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,e,t)})}assign(e,t){return A(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,e,t)})}genericRandomLayout(e,t,r){return A(this,void 0,void 0,function*(){const s=Object.assign(Object.assign({},this.options),r),{center:o,width:h,height:d}=s,p=t.getAllNodes(),g=.9,y=!h&&typeof window!="undefined"?window.innerWidth:h,O=!d&&typeof window!="undefined"?window.innerHeight:d,L=o||[y/2,O/2],R=[];return p&&p.forEach(F=>{R.push({id:F.id,data:{x:(Math.random()-.5)*g*y+L[0],y:(Math.random()-.5)*g*O+L[1]}})}),e&&R.forEach(F=>t.mergeNodeData(F.id,{x:F.data.x,y:F.data.y})),{nodes:R,edges:t.getAllEdges()}})}}const uc={circular:lo,concentric:Cr,mds:Ds,random:ac,grid:$u,radial:tc,force:Ts,d3force:Qs,"d3-force-3d":zu,fruchterman:Wu,forceAtlas2:Uu,dagre:mr,antvDagre:uo,comboCombined:la};let pn;ge({stopLayout(){pn!=null&&pn.stop&&pn.stop()},calculateLayout(n,e){return A(this,void 0,void 0,function*(){const{layout:{id:t,options:r,iterations:s},nodes:o,edges:h}=n,d=new xe({nodes:o,edges:h}),p=uc[t];if(p)pn=new p(r);else throw new Error(`Unknown layout id: ${t}`);let g=yield pn.execute(d);return zs(pn)&&(pn.stop(),g=pn.tick(s)),[g,e]})}})})()})(); }());