@moxa/graph 2.6.1 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,4 +10,4 @@ ${cr}]
10
10
  ${cr}rows: ${n.rows}
11
11
  ${cr}columns: ${n.columns}
12
12
  }`}function zw(n,t,e,r,i){const{rows:s,columns:o}=n,a=Math.min(s,t),u=Math.min(o,e),c=[];if(i==="auto"){i=!1;e:for(let f=0;f<a;f++)for(let l=0;l<u;l++)if(n.get(f,l)<0){i=!0;break e}}for(let f=0;f<a;f++){let l=[];for(let h=0;h<u;h++)l.push($w(n.get(f,h),r,i));c.push(`${l.join(" ")}`)}return u!==o&&(c[c.length-1]+=` ... ${o-e} more columns`),a!==s&&c.push(`... ${s-t} more rows`),c.join(`
13
- ${ff}`)}function $w(n,t,e){return(n>=0&&e?` ${hf(n,t-1)}`:hf(n,t)).padEnd(t)}function hf(n,t){let e=n.toString();if(e.length<=t)return e;let r=n.toFixed(t);if(r.length>t&&(r=n.toFixed(Math.max(0,t-(r.length-t)))),r.length<=t&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let i=n.toExponential(t);return i.length>t&&(i=n.toExponential(Math.max(0,t-(i.length-t)))),i.slice(0)}function Fw(n,t){n.prototype.add=function(r){return typeof r=="number"?this.addS(r):this.addM(r)},n.prototype.addS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)+r);return this},n.prototype.addM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)+r.get(i,s));return this},n.add=function(r,i){return new t(r).add(i)},n.prototype.sub=function(r){return typeof r=="number"?this.subS(r):this.subM(r)},n.prototype.subS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)-r);return this},n.prototype.subM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)-r.get(i,s));return this},n.sub=function(r,i){return new t(r).sub(i)},n.prototype.subtract=n.prototype.sub,n.prototype.subtractS=n.prototype.subS,n.prototype.subtractM=n.prototype.subM,n.subtract=n.sub,n.prototype.mul=function(r){return typeof r=="number"?this.mulS(r):this.mulM(r)},n.prototype.mulS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)*r);return this},n.prototype.mulM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)*r.get(i,s));return this},n.mul=function(r,i){return new t(r).mul(i)},n.prototype.multiply=n.prototype.mul,n.prototype.multiplyS=n.prototype.mulS,n.prototype.multiplyM=n.prototype.mulM,n.multiply=n.mul,n.prototype.div=function(r){return typeof r=="number"?this.divS(r):this.divM(r)},n.prototype.divS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)/r);return this},n.prototype.divM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)/r.get(i,s));return this},n.div=function(r,i){return new t(r).div(i)},n.prototype.divide=n.prototype.div,n.prototype.divideS=n.prototype.divS,n.prototype.divideM=n.prototype.divM,n.divide=n.div,n.prototype.mod=function(r){return typeof r=="number"?this.modS(r):this.modM(r)},n.prototype.modS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)%r);return this},n.prototype.modM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)%r.get(i,s));return this},n.mod=function(r,i){return new t(r).mod(i)},n.prototype.modulus=n.prototype.mod,n.prototype.modulusS=n.prototype.modS,n.prototype.modulusM=n.prototype.modM,n.modulus=n.mod,n.prototype.and=function(r){return typeof r=="number"?this.andS(r):this.andM(r)},n.prototype.andS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)&r);return this},n.prototype.andM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)&r.get(i,s));return this},n.and=function(r,i){return new t(r).and(i)},n.prototype.or=function(r){return typeof r=="number"?this.orS(r):this.orM(r)},n.prototype.orS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)|r);return this},n.prototype.orM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)|r.get(i,s));return this},n.or=function(r,i){return new t(r).or(i)},n.prototype.xor=function(r){return typeof r=="number"?this.xorS(r):this.xorM(r)},n.prototype.xorS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)^r);return this},n.prototype.xorM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)^r.get(i,s));return this},n.xor=function(r,i){return new t(r).xor(i)},n.prototype.leftShift=function(r){return typeof r=="number"?this.leftShiftS(r):this.leftShiftM(r)},n.prototype.leftShiftS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)<<r);return this},n.prototype.leftShiftM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)<<r.get(i,s));return this},n.leftShift=function(r,i){return new t(r).leftShift(i)},n.prototype.signPropagatingRightShift=function(r){return typeof r=="number"?this.signPropagatingRightShiftS(r):this.signPropagatingRightShiftM(r)},n.prototype.signPropagatingRightShiftS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)>>r);return this},n.prototype.signPropagatingRightShiftM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)>>r.get(i,s));return this},n.signPropagatingRightShift=function(r,i){return new t(r).signPropagatingRightShift(i)},n.prototype.rightShift=function(r){return typeof r=="number"?this.rightShiftS(r):this.rightShiftM(r)},n.prototype.rightShiftS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)>>>r);return this},n.prototype.rightShiftM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)>>>r.get(i,s));return this},n.rightShift=function(r,i){return new t(r).rightShift(i)},n.prototype.zeroFillRightShift=n.prototype.rightShift,n.prototype.zeroFillRightShiftS=n.prototype.rightShiftS,n.prototype.zeroFillRightShiftM=n.prototype.rightShiftM,n.zeroFillRightShift=n.rightShift,n.prototype.not=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,~this.get(r,i));return this},n.not=function(r){return new t(r).not()},n.prototype.abs=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.abs(this.get(r,i)));return this},n.abs=function(r){return new t(r).abs()},n.prototype.acos=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.acos(this.get(r,i)));return this},n.acos=function(r){return new t(r).acos()},n.prototype.acosh=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.acosh(this.get(r,i)));return this},n.acosh=function(r){return new t(r).acosh()},n.prototype.asin=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.asin(this.get(r,i)));return this},n.asin=function(r){return new t(r).asin()},n.prototype.asinh=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.asinh(this.get(r,i)));return this},n.asinh=function(r){return new t(r).asinh()},n.prototype.atan=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.atan(this.get(r,i)));return this},n.atan=function(r){return new t(r).atan()},n.prototype.atanh=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.atanh(this.get(r,i)));return this},n.atanh=function(r){return new t(r).atanh()},n.prototype.cbrt=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.cbrt(this.get(r,i)));return this},n.cbrt=function(r){return new t(r).cbrt()},n.prototype.ceil=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.ceil(this.get(r,i)));return this},n.ceil=function(r){return new t(r).ceil()},n.prototype.clz32=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.clz32(this.get(r,i)));return this},n.clz32=function(r){return new t(r).clz32()},n.prototype.cos=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.cos(this.get(r,i)));return this},n.cos=function(r){return new t(r).cos()},n.prototype.cosh=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.cosh(this.get(r,i)));return this},n.cosh=function(r){return new t(r).cosh()},n.prototype.exp=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.exp(this.get(r,i)));return this},n.exp=function(r){return new t(r).exp()},n.prototype.expm1=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.expm1(this.get(r,i)));return this},n.expm1=function(r){return new t(r).expm1()},n.prototype.floor=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.floor(this.get(r,i)));return this},n.floor=function(r){return new t(r).floor()},n.prototype.fround=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.fround(this.get(r,i)));return this},n.fround=function(r){return new t(r).fround()},n.prototype.log=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.log(this.get(r,i)));return this},n.log=function(r){return new t(r).log()},n.prototype.log1p=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.log1p(this.get(r,i)));return this},n.log1p=function(r){return new t(r).log1p()},n.prototype.log10=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.log10(this.get(r,i)));return this},n.log10=function(r){return new t(r).log10()},n.prototype.log2=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.log2(this.get(r,i)));return this},n.log2=function(r){return new t(r).log2()},n.prototype.round=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.round(this.get(r,i)));return this},n.round=function(r){return new t(r).round()},n.prototype.sign=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.sign(this.get(r,i)));return this},n.sign=function(r){return new t(r).sign()},n.prototype.sin=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.sin(this.get(r,i)));return this},n.sin=function(r){return new t(r).sin()},n.prototype.sinh=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.sinh(this.get(r,i)));return this},n.sinh=function(r){return new t(r).sinh()},n.prototype.sqrt=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.sqrt(this.get(r,i)));return this},n.sqrt=function(r){return new t(r).sqrt()},n.prototype.tan=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.tan(this.get(r,i)));return this},n.tan=function(r){return new t(r).tan()},n.prototype.tanh=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.tanh(this.get(r,i)));return this},n.tanh=function(r){return new t(r).tanh()},n.prototype.trunc=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.trunc(this.get(r,i)));return this},n.trunc=function(r){return new t(r).trunc()},n.pow=function(r,i){return new t(r).pow(i)},n.prototype.pow=function(r){return typeof r=="number"?this.powS(r):this.powM(r)},n.prototype.powS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)**r);return this},n.prototype.powM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)**r.get(i,s));return this}}function Ne(n,t,e){let r=e?n.rows:n.rows-1;if(t<0||t>r)throw new RangeError("Row index out of range")}function Me(n,t,e){let r=e?n.columns:n.columns-1;if(t<0||t>r)throw new RangeError("Column index out of range")}function vt(n,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==n.columns)throw new RangeError("vector size must be the same as the number of columns");return t}function mt(n,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==n.rows)throw new RangeError("vector size must be the same as the number of rows");return t}function _n(n,t){if(!pe.isAnyArray(t))throw new TypeError("row indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=n.rows)throw new RangeError("row indices are out of range")}function En(n,t){if(!pe.isAnyArray(t))throw new TypeError("column indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=n.columns)throw new RangeError("column indices are out of range")}function xn(n,t,e,r,i){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(lr("startRow",t),lr("endRow",e),lr("startColumn",r),lr("endColumn",i),t>e||r>i||t<0||t>=n.rows||e<0||e>=n.rows||r<0||r>=n.columns||i<0||i>=n.columns)throw new RangeError("Submatrix indices are out of range")}function fr(n,t=0){let e=[];for(let r=0;r<n;r++)e.push(t);return e}function lr(n,t){if(typeof t!="number")throw new TypeError(`${n} must be a number`)}function yt(n){if(n.isEmpty())throw new Error("Empty matrix has no elements to index")}function Bw(n){let t=fr(n.rows);for(let e=0;e<n.rows;++e)for(let r=0;r<n.columns;++r)t[e]+=n.get(e,r);return t}function Uw(n){let t=fr(n.columns);for(let e=0;e<n.rows;++e)for(let r=0;r<n.columns;++r)t[r]+=n.get(e,r);return t}function Gw(n){let t=0;for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)t+=n.get(e,r);return t}function Vw(n){let t=fr(n.rows,1);for(let e=0;e<n.rows;++e)for(let r=0;r<n.columns;++r)t[e]*=n.get(e,r);return t}function Ww(n){let t=fr(n.columns,1);for(let e=0;e<n.rows;++e)for(let r=0;r<n.columns;++r)t[r]*=n.get(e,r);return t}function Yw(n){let t=1;for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)t*=n.get(e,r);return t}function Kw(n,t,e){const r=n.rows,i=n.columns,s=[];for(let o=0;o<r;o++){let a=0,u=0,c=0;for(let f=0;f<i;f++)c=n.get(o,f)-e[o],a+=c,u+=c*c;t?s.push((u-a*a/i)/(i-1)):s.push((u-a*a/i)/i)}return s}function Xw(n,t,e){const r=n.rows,i=n.columns,s=[];for(let o=0;o<i;o++){let a=0,u=0,c=0;for(let f=0;f<r;f++)c=n.get(f,o)-e[o],a+=c,u+=c*c;t?s.push((u-a*a/r)/(r-1)):s.push((u-a*a/r)/r)}return s}function Zw(n,t,e){const r=n.rows,i=n.columns,s=r*i;let o=0,a=0,u=0;for(let c=0;c<r;c++)for(let f=0;f<i;f++)u=n.get(c,f)-e,o+=u,a+=u*u;return t?(a-o*o/s)/(s-1):(a-o*o/s)/s}function Jw(n,t){for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)n.set(e,r,n.get(e,r)-t[e])}function Qw(n,t){for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)n.set(e,r,n.get(e,r)-t[r])}function Hw(n,t){for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)n.set(e,r,n.get(e,r)-t)}function e1(n){const t=[];for(let e=0;e<n.rows;e++){let r=0;for(let i=0;i<n.columns;i++)r+=n.get(e,i)**2/(n.columns-1);t.push(Math.sqrt(r))}return t}function t1(n,t){for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)n.set(e,r,n.get(e,r)/t[e])}function r1(n){const t=[];for(let e=0;e<n.columns;e++){let r=0;for(let i=0;i<n.rows;i++)r+=n.get(i,e)**2/(n.rows-1);t.push(Math.sqrt(r))}return t}function n1(n,t){for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)n.set(e,r,n.get(e,r)/t[r])}function i1(n){const t=n.size-1;let e=0;for(let r=0;r<n.columns;r++)for(let i=0;i<n.rows;i++)e+=n.get(i,r)**2/t;return Math.sqrt(e)}function s1(n,t){for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)n.set(e,r,n.get(e,r)/t)}class Y{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let s=new C(t,e);for(let o=0;o<t;o++)for(let a=0;a<e;a++)s.set(o,a,r[o*e+a]);return s}static rowVector(t){let e=new C(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new C(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new C(t,e)}static ones(t,e){return new C(t,e).fill(1)}static rand(t,e,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{random:i=Math.random}=r;let s=new C(t,e);for(let o=0;o<t;o++)for(let a=0;a<e;a++)s.set(o,a,i());return s}static randInt(t,e,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{min:i=0,max:s=1e3,random:o=Math.random}=r;if(!Number.isInteger(i))throw new TypeError("min must be an integer");if(!Number.isInteger(s))throw new TypeError("max must be an integer");if(i>=s)throw new RangeError("min must be smaller than max");let a=s-i,u=new C(t,e);for(let c=0;c<t;c++)for(let f=0;f<e;f++){let l=i+Math.round(o()*a);u.set(c,f,l)}return u}static eye(t,e,r){e===void 0&&(e=t),r===void 0&&(r=1);let i=Math.min(t,e),s=this.zeros(t,e);for(let o=0;o<i;o++)s.set(o,o,r);return s}static diag(t,e,r){let i=t.length;e===void 0&&(e=i),r===void 0&&(r=e);let s=Math.min(i,e,r),o=this.zeros(e,r);for(let a=0;a<s;a++)o.set(a,a,t[a]);return o}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,i=t.columns,s=new C(r,i);for(let o=0;o<r;o++)for(let a=0;a<i;a++)s.set(o,a,Math.min(t.get(o,a),e.get(o,a)));return s}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,i=t.columns,s=new this(r,i);for(let o=0;o<r;o++)for(let a=0;a<i;a++)s.set(o,a,Math.max(t.get(o,a),e.get(o,a)));return s}static checkMatrix(t){return Y.isMatrix(t)?t:new C(t)}static isMatrix(t){return t!=null&&t.klass==="Matrix"}get size(){return this.rows*this.columns}apply(t){if(typeof t!="function")throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(this.get(t,t)!==0)return!1;return!0}isEchelonForm(){let t=0,e=0,r=-1,i=!0,s=!1;for(;t<this.rows&&i;){for(e=0,s=!1;e<this.columns&&s===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>r?(s=!0,r=e):(i=!1,s=!0);t++}return i}isReducedEchelonForm(){let t=0,e=0,r=-1,i=!0,s=!1;for(;t<this.rows&&i;){for(e=0,s=!1;e<this.columns&&s===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>r?(s=!0,r=e):(i=!1,s=!0);for(let o=e+1;o<this.rows;o++)this.get(t,o)!==0&&(i=!1);t++}return i}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let i=e;for(let s=e;s<t.rows;s++)t.get(s,r)>t.get(i,r)&&(i=s);if(t.get(i,r)===0)r++;else{t.swapRows(e,i);let s=t.get(e,r);for(let o=r;o<t.columns;o++)t.set(e,o,t.get(e,o)/s);for(let o=e+1;o<t.rows;o++){let a=t.get(o,r)/t.get(e,r);t.set(o,r,0);for(let u=r+1;u<t.columns;u++)t.set(o,u,t.get(o,u)-t.get(e,u)*a)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,i=r-1;for(;i>=0;)if(t.maxRow(i)===0)i--;else{let s=0,o=!1;for(;s<r&&o===!1;)t.get(i,s)===1?o=!0:s++;for(let a=0;a<i;a++){let u=t.get(a,s);for(let c=s;c<e;c++){let f=t.get(a,c)-u*t.get(i,c);t.set(a,c,f)}}i--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let i=new C(this.rows*e,this.columns*r);for(let s=0;s<e;s++)for(let o=0;o<r;o++)i.setSubMatrix(this,this.rows*s,this.columns*o);return i}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){Ne(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return C.rowVector(this.getRow(t))}setRow(t,e){Ne(this,t),e=vt(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){Ne(this,t),Ne(this,e);for(let r=0;r<this.columns;r++){let i=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,i)}return this}getColumn(t){Me(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return C.columnVector(this.getColumn(t))}setColumn(t,e){Me(this,t),e=mt(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){Me(this,t),Me(this,e);for(let r=0;r<this.rows;r++){let i=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,i)}return this}addRowVector(t){t=vt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=vt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=vt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=vt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=mt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=mt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=mt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=mt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){Ne(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){Me(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const e=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)>e[r]&&(e[r]=this.get(r,i));return e}case"column":{const e=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)>e[i]&&(e[i]=this.get(r,i));return e}case void 0:{let e=this.get(0,0);for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)>e&&(e=this.get(r,i));return e}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){yt(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)>t&&(t=this.get(r,i),e[0]=r,e[1]=i);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const e=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)<e[r]&&(e[r]=this.get(r,i));return e}case"column":{const e=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)<e[i]&&(e[i]=this.get(r,i));return e}case void 0:{let e=this.get(0,0);for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)<e&&(e=this.get(r,i));return e}default:throw new Error(`invalid option: ${t}`)}}minIndex(){yt(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)<t&&(t=this.get(r,i),e[0]=r,e[1]=i);return e}maxRow(t){if(Ne(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){Ne(this,t),yt(this);let e=this.get(t,0),r=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)>e&&(e=this.get(t,i),r[1]=i);return r}minRow(t){if(Ne(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){Ne(this,t),yt(this);let e=this.get(t,0),r=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)<e&&(e=this.get(t,i),r[1]=i);return r}maxColumn(t){if(Me(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){Me(this,t),yt(this);let e=this.get(0,t),r=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)>e&&(e=this.get(i,t),r[0]=i);return r}minColumn(t){if(Me(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){Me(this,t),yt(this);let e=this.get(0,t),r=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)<e&&(e=this.get(i,t),r[0]=i);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){Y.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let i=0;i<e.length;i++)r+=e[i]*t[i];return r}mmul(t){t=C.checkMatrix(t);let e=this.rows,r=this.columns,i=t.columns,s=new C(e,i),o=new Float64Array(r);for(let a=0;a<i;a++){for(let u=0;u<r;u++)o[u]=t.get(u,a);for(let u=0;u<e;u++){let c=0;for(let f=0;f<r;f++)c+=this.get(u,f)*o[f];s.set(u,a,c)}}return s}strassen2x2(t){t=C.checkMatrix(t);let e=new C(2,2);const r=this.get(0,0),i=t.get(0,0),s=this.get(0,1),o=t.get(0,1),a=this.get(1,0),u=t.get(1,0),c=this.get(1,1),f=t.get(1,1),l=(r+c)*(i+f),h=(a+c)*i,g=r*(o-f),p=c*(u-i),v=(r+s)*f,m=(a-r)*(i+o),d=(s-c)*(u+f),y=l+p-v+d,w=g+v,b=h+p,x=l-h+g+m;return e.set(0,0,y),e.set(0,1,w),e.set(1,0,b),e.set(1,1,x),e}strassen3x3(t){t=C.checkMatrix(t);let e=new C(3,3);const r=this.get(0,0),i=this.get(0,1),s=this.get(0,2),o=this.get(1,0),a=this.get(1,1),u=this.get(1,2),c=this.get(2,0),f=this.get(2,1),l=this.get(2,2),h=t.get(0,0),g=t.get(0,1),p=t.get(0,2),v=t.get(1,0),m=t.get(1,1),d=t.get(1,2),y=t.get(2,0),w=t.get(2,1),b=t.get(2,2),x=(r+i+s-o-a-f-l)*m,M=(r-o)*(-g+m),N=a*(-h+g+v-m-d-y+b),E=(-r+o+a)*(h-g+m),O=(o+a)*(-h+g),_=r*h,S=(-r+c+f)*(h-p+d),q=(-r+c)*(p-d),R=(c+f)*(-h+p),T=(r+i+s-a-u-c-f)*d,I=f*(-h+p+v-m-d-y+w),j=(-s+f+l)*(m+y-w),F=(s-l)*(m-w),A=s*y,k=(f+l)*(-y+w),L=(-s+a+u)*(d+y-b),D=(s-u)*(d-b),G=(a+u)*(-y+b),P=i*v,z=u*w,B=o*p,Z=c*g,V=l*b,le=_+A+P,Ee=x+E+O+_+j+A+k,Hu=_+S+R+T+A+L+G,ec=M+N+E+_+A+L+D,tc=M+E+O+_+z,rc=A+L+D+G+B,nc=_+S+q+I+j+F+A,H=j+F+A+k+Z,Ot=_+S+q+R+V;return e.set(0,0,le),e.set(0,1,Ee),e.set(0,2,Hu),e.set(1,0,ec),e.set(1,1,tc),e.set(1,2,rc),e.set(2,0,nc),e.set(2,1,H),e.set(2,2,Ot),e}mmulStrassen(t){t=C.checkMatrix(t);let e=this.clone(),r=e.rows,i=e.columns,s=t.rows,o=t.columns;i!==s&&console.warn(`Multiplying ${r} x ${i} and ${s} x ${o} matrix: dimensions do not match.`);function a(l,h,g){let p=l.rows,v=l.columns;if(p===h&&v===g)return l;{let m=Y.zeros(h,g);return m=m.setSubMatrix(l,0,0),m}}let u=Math.max(r,s),c=Math.max(i,o);e=a(e,u,c),t=a(t,u,c);function f(l,h,g,p){if(g<=512||p<=512)return l.mmul(h);g%2===1&&p%2===1?(l=a(l,g+1,p+1),h=a(h,g+1,p+1)):g%2===1?(l=a(l,g+1,p),h=a(h,g+1,p)):p%2===1&&(l=a(l,g,p+1),h=a(h,g,p+1));let v=parseInt(l.rows/2,10),m=parseInt(l.columns/2,10),d=l.subMatrix(0,v-1,0,m-1),y=h.subMatrix(0,v-1,0,m-1),w=l.subMatrix(0,v-1,m,l.columns-1),b=h.subMatrix(0,v-1,m,h.columns-1),x=l.subMatrix(v,l.rows-1,0,m-1),M=h.subMatrix(v,h.rows-1,0,m-1),N=l.subMatrix(v,l.rows-1,m,l.columns-1),E=h.subMatrix(v,h.rows-1,m,h.columns-1),O=f(Y.add(d,N),Y.add(y,E),v,m),_=f(Y.add(x,N),y,v,m),S=f(d,Y.sub(b,E),v,m),q=f(N,Y.sub(M,y),v,m),R=f(Y.add(d,w),E,v,m),T=f(Y.sub(x,d),Y.add(y,b),v,m),I=f(Y.sub(w,N),Y.add(M,E),v,m),j=Y.add(O,q);j.sub(R),j.add(I);let F=Y.add(S,R),A=Y.add(_,q),k=Y.sub(O,_);k.add(S),k.add(T);let L=Y.zeros(2*j.rows,2*j.columns);return L=L.setSubMatrix(j,0,0),L=L.setSubMatrix(F,j.rows,0),L=L.setSubMatrix(A,0,j.columns),L=L.setSubMatrix(k,j.rows,j.columns),L.subMatrix(0,g-1,0,p-1)}return f(e,t,u,c)}scaleRows(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let i=new C(this.rows,this.columns);for(let s=0;s<this.rows;s++){const o=this.getRow(s);o.length>0&&cf(o,{min:e,max:r,output:o}),i.setRow(s,o)}return i}scaleColumns(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let i=new C(this.rows,this.columns);for(let s=0;s<this.columns;s++){const o=this.getColumn(s);o.length&&cf(o,{min:e,max:r,output:o}),i.setColumn(s,o)}return i}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let i=this.get(e,r),s=this.get(e,this.columns-1-r);this.set(e,r,s),this.set(e,this.columns-1-r,i)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let i=this.get(r,e),s=this.get(this.rows-1-r,e);this.set(r,e,s),this.set(this.rows-1-r,e,i)}return this}kroneckerProduct(t){t=C.checkMatrix(t);let e=this.rows,r=this.columns,i=t.rows,s=t.columns,o=new C(e*i,r*s);for(let a=0;a<e;a++)for(let u=0;u<r;u++)for(let c=0;c<i;c++)for(let f=0;f<s;f++)o.set(i*a+c,s*u+f,this.get(a,u)*t.get(c,f));return o}kroneckerSum(t){if(t=C.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,i=this.kroneckerProduct(C.eye(r,r)),s=C.eye(e,e).kroneckerProduct(t);return i.add(s)}transpose(){let t=new C(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=df){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=df){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,i){xn(this,t,e,r,i);let s=new C(e-t+1,i-r+1);for(let o=t;o<=e;o++)for(let a=r;a<=i;a++)s.set(o-t,a-r,this.get(o,a));return s}subMatrixRow(t,e,r){if(e===void 0&&(e=0),r===void 0&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let i=new C(t.length,r-e+1);for(let s=0;s<t.length;s++)for(let o=e;o<=r;o++){if(t[s]<0||t[s]>=this.rows)throw new RangeError(`Row index out of range: ${t[s]}`);i.set(s,o-e,this.get(t[s],o))}return i}subMatrixColumn(t,e,r){if(e===void 0&&(e=0),r===void 0&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let i=new C(r-e+1,t.length);for(let s=0;s<t.length;s++)for(let o=e;o<=r;o++){if(t[s]<0||t[s]>=this.columns)throw new RangeError(`Column index out of range: ${t[s]}`);i.set(o-e,s,this.get(o,t[s]))}return i}setSubMatrix(t,e,r){if(t=C.checkMatrix(t),t.isEmpty())return this;let i=e+t.rows-1,s=r+t.columns-1;xn(this,e,i,r,s);for(let o=0;o<t.rows;o++)for(let a=0;a<t.columns;a++)this.set(e+o,r+a,t.get(o,a));return this}selection(t,e){_n(this,t),En(this,e);let r=new C(t.length,e.length);for(let i=0;i<t.length;i++){let s=t[i];for(let o=0;o<e.length;o++){let a=e[o];r.set(i,o,this.get(s,a))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){return this.constructor.copy(this,new C(this.rows,this.columns))}static copy(t,e){for(const[r,i,s]of t.entries())e.set(r,i,s);return e}sum(t){switch(t){case"row":return Bw(this);case"column":return Uw(this);case void 0:return Gw(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return Vw(this);case"column":return Ww(this);case void 0:return Yw(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":{for(let r=0;r<this.rows;r++)e[r]/=this.columns;return e}case"column":{for(let r=0;r<this.columns;r++)e[r]/=this.rows;return e}case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{unbiased:r=!0,mean:i=this.mean(t)}=e;if(typeof r!="boolean")throw new TypeError("unbiased must be a boolean");switch(t){case"row":{if(!pe.isAnyArray(i))throw new TypeError("mean must be an array");return Kw(this,r,i)}case"column":{if(!pe.isAnyArray(i))throw new TypeError("mean must be an array");return Xw(this,r,i)}case void 0:{if(typeof i!="number")throw new TypeError("mean must be a number");return Zw(this,r,i)}default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){typeof t=="object"&&(e=t,t=void 0);const r=this.variance(t,e);if(t===void 0)return Math.sqrt(r);for(let i=0;i<r.length;i++)r[i]=Math.sqrt(r[i]);return r}center(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":{if(!pe.isAnyArray(r))throw new TypeError("center must be an array");return Jw(this,r),this}case"column":{if(!pe.isAnyArray(r))throw new TypeError("center must be an array");return Qw(this,r),this}case void 0:{if(typeof r!="number")throw new TypeError("center must be a number");return Hw(this,r),this}default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":{if(r===void 0)r=e1(this);else if(!pe.isAnyArray(r))throw new TypeError("scale must be an array");return t1(this,r),this}case"column":{if(r===void 0)r=r1(this);else if(!pe.isAnyArray(r))throw new TypeError("scale must be an array");return n1(this,r),this}case void 0:{if(r===void 0)r=i1(this);else if(typeof r!="number")throw new TypeError("scale must be a number");return s1(this,r),this}default:throw new Error(`invalid option: ${t}`)}}toString(t){return lf(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}Y.prototype.klass="Matrix",typeof Symbol<"u"&&(Y.prototype[Symbol.for("nodejs.util.inspect.custom")]=Dw);function df(n,t){return n-t}function o1(n){return n.every(t=>typeof t=="number")}Y.random=Y.rand,Y.randomInt=Y.randInt,Y.diagonal=Y.diag,Y.prototype.diagonal=Y.prototype.diag,Y.identity=Y.eye,Y.prototype.negate=Y.prototype.neg,Y.prototype.tensorProduct=Y.prototype.kroneckerProduct;let C=(qt=class extends Y{constructor(e,r){super();sc(this,Jt);te(this,"data");if(qt.isMatrix(e))oc(this,Jt,ac).call(this,e.rows,e.columns),qt.copy(e,this);else if(Number.isInteger(e)&&e>=0)oc(this,Jt,ac).call(this,e,r);else if(pe.isAnyArray(e)){const i=e;if(e=i.length,r=e?i[0].length:0,typeof r!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let s=0;s<e;s++){if(i[s].length!==r)throw new RangeError("Inconsistent array dimensions");if(!o1(i[s]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(i[s]))}this.rows=e,this.columns=r}else throw new TypeError("First argument must be a positive number or an array")}set(e,r,i){return this.data[e][r]=i,this}get(e,r){return this.data[e][r]}removeRow(e){return Ne(this,e),this.data.splice(e,1),this.rows-=1,this}addRow(e,r){return r===void 0&&(r=e,e=this.rows),Ne(this,e,!0),r=Float64Array.from(vt(this,r)),this.data.splice(e,0,r),this.rows+=1,this}removeColumn(e){Me(this,e);for(let r=0;r<this.rows;r++){const i=new Float64Array(this.columns-1);for(let s=0;s<e;s++)i[s]=this.data[r][s];for(let s=e+1;s<this.columns;s++)i[s-1]=this.data[r][s];this.data[r]=i}return this.columns-=1,this}addColumn(e,r){typeof r>"u"&&(r=e,e=this.columns),Me(this,e,!0),r=mt(this,r);for(let i=0;i<this.rows;i++){const s=new Float64Array(this.columns+1);let o=0;for(;o<e;o++)s[o]=this.data[i][o];for(s[o++]=r[i];o<this.columns+1;o++)s[o]=this.data[i][o-1];this.data[i]=s}return this.columns+=1,this}},Jt=new WeakSet,ac=function(e,r){if(this.data=[],Number.isInteger(r)&&r>=0)for(let i=0;i<e;i++)this.data.push(new Float64Array(r));else throw new TypeError("nColumns must be a positive integer");this.rows=e,this.columns=r},qt);Fw(Y,C);const Xr=class Xr extends Y{constructor(e){super();sc(this,fe,void 0);if(C.isMatrix(e)){if(!e.isSymmetric())throw new TypeError("not symmetric data");Hr(this,fe,C.copy(e,new C(e.rows,e.rows)))}else if(Number.isInteger(e)&&e>=0)Hr(this,fe,new C(e,e));else if(Hr(this,fe,new C(e)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return Ie(this,fe).size}get rows(){return Ie(this,fe).rows}get columns(){return Ie(this,fe).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(e){return C.isMatrix(e)&&e.klassType==="SymmetricMatrix"}static zeros(e){return new this(e)}static ones(e){return new this(e).fill(1)}clone(){const e=new Xr(this.diagonalSize);for(const[r,i,s]of this.upperRightEntries())e.set(r,i,s);return e}toMatrix(){return new C(this)}get(e,r){return Ie(this,fe).get(e,r)}set(e,r,i){return Ie(this,fe).set(e,r,i),Ie(this,fe).set(r,e,i),this}removeCross(e){return Ie(this,fe).removeRow(e),Ie(this,fe).removeColumn(e),this}addCross(e,r){r===void 0&&(r=e,e=this.diagonalSize);const i=r.slice();return i.splice(e,1),Ie(this,fe).addRow(e,i),Ie(this,fe).addColumn(e,r),this}applyMask(e){if(e.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const r=[];for(const[i,s]of e.entries())s||r.push(i);r.reverse();for(const i of r)this.removeCross(i);return this}toCompact(){const{diagonalSize:e}=this,r=new Array(e*(e+1)/2);for(let i=0,s=0,o=0;o<r.length;o++)r[o]=this.get(s,i),++i>=e&&(i=++s);return r}static fromCompact(e){const r=e.length,i=(Math.sqrt(8*r+1)-1)/2;if(!Number.isInteger(i))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(e)}`);const s=new Xr(i);for(let o=0,a=0,u=0;u<r;u++)s.set(o,a,e[u]),++o>=i&&(o=++a);return s}*upperRightEntries(){for(let e=0,r=0;e<this.diagonalSize;void 0){const i=this.get(e,r);yield[e,r,i],++r>=this.diagonalSize&&(r=++e)}}*upperRightValues(){for(let e=0,r=0;e<this.diagonalSize;void 0)yield this.get(e,r),++r>=this.diagonalSize&&(r=++e)}};fe=new WeakMap;let it=Xr;it.prototype.klassType="SymmetricMatrix";class hr extends it{static isDistanceMatrix(t){return it.isSymmetricMatrix(t)&&t.klassSubType==="DistanceMatrix"}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,r){return t===e&&(r=0),super.set(t,e,r)}addCross(t,e){return e===void 0&&(e=t,t=this.diagonalSize),e=e.slice(),e[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new it(this)}clone(){const t=new hr(this.diagonalSize);for(const[e,r,i]of this.upperRightEntries())e!==r&&t.set(e,r,i);return t}toCompact(){const{diagonalSize:t}=this,e=(t-1)*t/2,r=new Array(e);for(let i=1,s=0,o=0;o<r.length;o++)r[o]=this.get(s,i),++i>=t&&(i=++s+1);return r}static fromCompact(t){const e=t.length;if(e===0)return new this(0);const r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const i=new this(r);for(let s=1,o=0,a=0;a<e;a++)i.set(s,o,t[a]),++s>=r&&(s=++o+1);return i}}hr.prototype.klassSubType="DistanceMatrix";class je extends Y{constructor(t,e,r){super(),this.matrix=t,this.rows=e,this.columns=r}}class a1 extends je{constructor(t,e){Me(t,e),super(t,t.rows,1),this.column=e}set(t,e,r){return this.matrix.set(t,this.column,r),this}get(t){return this.matrix.get(t,this.column)}}class u1 extends je{constructor(t,e){En(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}}class c1 extends je{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}}class f1 extends je{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}}class l1 extends je{constructor(t,e){Ne(t,e),super(t,1,t.columns),this.row=e}set(t,e,r){return this.matrix.set(this.row,e,r),this}get(t,e){return this.matrix.get(this.row,e)}}class h1 extends je{constructor(t,e){_n(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}}class dr extends je{constructor(t,e,r){_n(t,e),En(t,r),super(t,e.length,r.length),this.rowIndices=e,this.columnIndices=r}set(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class d1 extends je{constructor(t,e,r,i,s){xn(t,e,r,i,s),super(t,r-e+1,s-i+1),this.startRow=e,this.startColumn=i}set(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}}class g1 extends je{constructor(t){super(t,t.columns,t.rows)}set(t,e,r){return this.matrix.set(e,t,r),this}get(t,e){return this.matrix.get(e,t)}}class gf extends Y{constructor(t,e={}){const{rows:r=1}=e;if(t.length%r!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=t.length/r,this.data=t}set(t,e,r){let i=this._calculateIndex(t,e);return this.data[i]=r,this}get(t,e){let r=this._calculateIndex(t,e);return this.data[r]}_calculateIndex(t,e){return t*this.columns+e}}class be extends Y{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}function p1(n,t){if(pe.isAnyArray(n))return n[0]&&pe.isAnyArray(n[0])?new be(n):new gf(n,t);throw new Error("the argument is not an array")}class gr{constructor(t){t=be.checkMatrix(t);let e=t.clone(),r=e.rows,i=e.columns,s=new Float64Array(r),o=1,a,u,c,f,l,h,g,p,v;for(a=0;a<r;a++)s[a]=a;for(p=new Float64Array(r),u=0;u<i;u++){for(a=0;a<r;a++)p[a]=e.get(a,u);for(a=0;a<r;a++){for(v=Math.min(a,u),l=0,c=0;c<v;c++)l+=e.get(a,c)*p[c];p[a]-=l,e.set(a,u,p[a])}for(f=u,a=u+1;a<r;a++)Math.abs(p[a])>Math.abs(p[f])&&(f=a);if(f!==u){for(c=0;c<i;c++)h=e.get(f,c),e.set(f,c,e.get(u,c)),e.set(u,c,h);g=s[f],s[f]=s[u],s[u]=g,o=-o}if(u<r&&e.get(u,u)!==0)for(a=u+1;a<r;a++)e.set(a,u,e.get(a,u)/e.get(u,u))}this.LU=e,this.pivotVector=s,this.pivotSign=o}isSingular(){let t=this.LU,e=t.columns;for(let r=0;r<e;r++)if(t.get(r,r)===0)return!0;return!1}solve(t){t=C.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let i=t.columns,s=t.subMatrixRow(this.pivotVector,0,i-1),o=e.columns,a,u,c;for(c=0;c<o;c++)for(a=c+1;a<o;a++)for(u=0;u<i;u++)s.set(a,u,s.get(a,u)-s.get(c,u)*e.get(a,c));for(c=o-1;c>=0;c--){for(u=0;u<i;u++)s.set(c,u,s.get(c,u)/e.get(c,c));for(a=0;a<c;a++)for(u=0;u<i;u++)s.set(a,u,s.get(a,u)-s.get(c,u)*e.get(a,c))}return s}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,r=t.columns;for(let i=0;i<r;i++)e*=t.get(i,i);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,i=new C(e,r);for(let s=0;s<e;s++)for(let o=0;o<r;o++)s>o?i.set(s,o,t.get(s,o)):s===o?i.set(s,o,1):i.set(s,o,0);return i}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,i=new C(e,r);for(let s=0;s<e;s++)for(let o=0;o<r;o++)s<=o?i.set(s,o,t.get(s,o)):i.set(s,o,0);return i}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Ce(n,t){let e=0;return Math.abs(n)>Math.abs(t)?(e=t/n,Math.abs(n)*Math.sqrt(1+e*e)):t!==0?(e=n/t,Math.abs(t)*Math.sqrt(1+e*e)):0}class Nn{constructor(t){t=be.checkMatrix(t);let e=t.clone(),r=t.rows,i=t.columns,s=new Float64Array(i),o,a,u,c;for(u=0;u<i;u++){let f=0;for(o=u;o<r;o++)f=Ce(f,e.get(o,u));if(f!==0){for(e.get(u,u)<0&&(f=-f),o=u;o<r;o++)e.set(o,u,e.get(o,u)/f);for(e.set(u,u,e.get(u,u)+1),a=u+1;a<i;a++){for(c=0,o=u;o<r;o++)c+=e.get(o,u)*e.get(o,a);for(c=-c/e.get(u,u),o=u;o<r;o++)e.set(o,a,e.get(o,a)+c*e.get(o,u))}}s[u]=-f}this.QR=e,this.Rdiag=s}solve(t){t=C.checkMatrix(t);let e=this.QR,r=e.rows;if(t.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let i=t.columns,s=t.clone(),o=e.columns,a,u,c,f;for(c=0;c<o;c++)for(u=0;u<i;u++){for(f=0,a=c;a<r;a++)f+=e.get(a,c)*s.get(a,u);for(f=-f/e.get(c,c),a=c;a<r;a++)s.set(a,u,s.get(a,u)+f*e.get(a,c))}for(c=o-1;c>=0;c--){for(u=0;u<i;u++)s.set(c,u,s.get(c,u)/this.Rdiag[c]);for(a=0;a<c;a++)for(u=0;u<i;u++)s.set(a,u,s.get(a,u)-s.get(c,u)*e.get(a,c))}return s.subMatrix(0,o-1,0,i-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(this.Rdiag[e]===0)return!1;return!0}get upperTriangularMatrix(){let t=this.QR,e=t.columns,r=new C(e,e),i,s;for(i=0;i<e;i++)for(s=0;s<e;s++)i<s?r.set(i,s,t.get(i,s)):i===s?r.set(i,s,this.Rdiag[i]):r.set(i,s,0);return r}get orthogonalMatrix(){let t=this.QR,e=t.rows,r=t.columns,i=new C(e,r),s,o,a,u;for(a=r-1;a>=0;a--){for(s=0;s<e;s++)i.set(s,a,0);for(i.set(a,a,1),o=a;o<r;o++)if(t.get(a,a)!==0){for(u=0,s=a;s<e;s++)u+=t.get(s,a)*i.get(s,o);for(u=-u/t.get(a,a),s=a;s<e;s++)i.set(s,o,i.get(s,o)+u*t.get(s,a))}}return i}}let wt=class{constructor(t,e={}){if(t=be.checkMatrix(t),t.isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,i=t.columns;const{computeLeftSingularVectors:s=!0,computeRightSingularVectors:o=!0,autoTranspose:a=!1}=e;let u=!!s,c=!!o,f=!1,l;if(r<i)if(!a)l=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{l=t.transpose(),r=l.rows,i=l.columns,f=!0;let _=u;u=c,c=_}else l=t.clone();let h=Math.min(r,i),g=Math.min(r+1,i),p=new Float64Array(g),v=new C(r,h),m=new C(i,i),d=new Float64Array(i),y=new Float64Array(r),w=new Float64Array(g);for(let _=0;_<g;_++)w[_]=_;let b=Math.min(r-1,i),x=Math.max(0,Math.min(i-2,r)),M=Math.max(b,x);for(let _=0;_<M;_++){if(_<b){p[_]=0;for(let S=_;S<r;S++)p[_]=Ce(p[_],l.get(S,_));if(p[_]!==0){l.get(_,_)<0&&(p[_]=-p[_]);for(let S=_;S<r;S++)l.set(S,_,l.get(S,_)/p[_]);l.set(_,_,l.get(_,_)+1)}p[_]=-p[_]}for(let S=_+1;S<i;S++){if(_<b&&p[_]!==0){let q=0;for(let R=_;R<r;R++)q+=l.get(R,_)*l.get(R,S);q=-q/l.get(_,_);for(let R=_;R<r;R++)l.set(R,S,l.get(R,S)+q*l.get(R,_))}d[S]=l.get(_,S)}if(u&&_<b)for(let S=_;S<r;S++)v.set(S,_,l.get(S,_));if(_<x){d[_]=0;for(let S=_+1;S<i;S++)d[_]=Ce(d[_],d[S]);if(d[_]!==0){d[_+1]<0&&(d[_]=0-d[_]);for(let S=_+1;S<i;S++)d[S]/=d[_];d[_+1]+=1}if(d[_]=-d[_],_+1<r&&d[_]!==0){for(let S=_+1;S<r;S++)y[S]=0;for(let S=_+1;S<r;S++)for(let q=_+1;q<i;q++)y[S]+=d[q]*l.get(S,q);for(let S=_+1;S<i;S++){let q=-d[S]/d[_+1];for(let R=_+1;R<r;R++)l.set(R,S,l.get(R,S)+q*y[R])}}if(c)for(let S=_+1;S<i;S++)m.set(S,_,d[S])}}let N=Math.min(i,r+1);if(b<i&&(p[b]=l.get(b,b)),r<N&&(p[N-1]=0),x+1<N&&(d[x]=l.get(x,N-1)),d[N-1]=0,u){for(let _=b;_<h;_++){for(let S=0;S<r;S++)v.set(S,_,0);v.set(_,_,1)}for(let _=b-1;_>=0;_--)if(p[_]!==0){for(let S=_+1;S<h;S++){let q=0;for(let R=_;R<r;R++)q+=v.get(R,_)*v.get(R,S);q=-q/v.get(_,_);for(let R=_;R<r;R++)v.set(R,S,v.get(R,S)+q*v.get(R,_))}for(let S=_;S<r;S++)v.set(S,_,-v.get(S,_));v.set(_,_,1+v.get(_,_));for(let S=0;S<_-1;S++)v.set(S,_,0)}else{for(let S=0;S<r;S++)v.set(S,_,0);v.set(_,_,1)}}if(c)for(let _=i-1;_>=0;_--){if(_<x&&d[_]!==0)for(let S=_+1;S<i;S++){let q=0;for(let R=_+1;R<i;R++)q+=m.get(R,_)*m.get(R,S);q=-q/m.get(_+1,_);for(let R=_+1;R<i;R++)m.set(R,S,m.get(R,S)+q*m.get(R,_))}for(let S=0;S<i;S++)m.set(S,_,0);m.set(_,_,1)}let E=N-1,O=Number.EPSILON;for(;N>0;){let _,S;for(_=N-2;_>=-1&&_!==-1;_--){const q=Number.MIN_VALUE+O*Math.abs(p[_]+Math.abs(p[_+1]));if(Math.abs(d[_])<=q||Number.isNaN(d[_])){d[_]=0;break}}if(_===N-2)S=4;else{let q;for(q=N-1;q>=_&&q!==_;q--){let R=(q!==N?Math.abs(d[q]):0)+(q!==_+1?Math.abs(d[q-1]):0);if(Math.abs(p[q])<=O*R){p[q]=0;break}}q===_?S=3:q===N-1?S=1:(S=2,_=q)}switch(_++,S){case 1:{let q=d[N-2];d[N-2]=0;for(let R=N-2;R>=_;R--){let T=Ce(p[R],q),I=p[R]/T,j=q/T;if(p[R]=T,R!==_&&(q=-j*d[R-1],d[R-1]=I*d[R-1]),c)for(let F=0;F<i;F++)T=I*m.get(F,R)+j*m.get(F,N-1),m.set(F,N-1,-j*m.get(F,R)+I*m.get(F,N-1)),m.set(F,R,T)}break}case 2:{let q=d[_-1];d[_-1]=0;for(let R=_;R<N;R++){let T=Ce(p[R],q),I=p[R]/T,j=q/T;if(p[R]=T,q=-j*d[R],d[R]=I*d[R],u)for(let F=0;F<r;F++)T=I*v.get(F,R)+j*v.get(F,_-1),v.set(F,_-1,-j*v.get(F,R)+I*v.get(F,_-1)),v.set(F,R,T)}break}case 3:{const q=Math.max(Math.abs(p[N-1]),Math.abs(p[N-2]),Math.abs(d[N-2]),Math.abs(p[_]),Math.abs(d[_])),R=p[N-1]/q,T=p[N-2]/q,I=d[N-2]/q,j=p[_]/q,F=d[_]/q,A=((T+R)*(T-R)+I*I)/2,k=R*I*(R*I);let L=0;(A!==0||k!==0)&&(A<0?L=0-Math.sqrt(A*A+k):L=Math.sqrt(A*A+k),L=k/(A+L));let D=(j+R)*(j-R)+L,G=j*F;for(let P=_;P<N-1;P++){let z=Ce(D,G);z===0&&(z=Number.MIN_VALUE);let B=D/z,Z=G/z;if(P!==_&&(d[P-1]=z),D=B*p[P]+Z*d[P],d[P]=B*d[P]-Z*p[P],G=Z*p[P+1],p[P+1]=B*p[P+1],c)for(let V=0;V<i;V++)z=B*m.get(V,P)+Z*m.get(V,P+1),m.set(V,P+1,-Z*m.get(V,P)+B*m.get(V,P+1)),m.set(V,P,z);if(z=Ce(D,G),z===0&&(z=Number.MIN_VALUE),B=D/z,Z=G/z,p[P]=z,D=B*d[P]+Z*p[P+1],p[P+1]=-Z*d[P]+B*p[P+1],G=Z*d[P+1],d[P+1]=B*d[P+1],u&&P<r-1)for(let V=0;V<r;V++)z=B*v.get(V,P)+Z*v.get(V,P+1),v.set(V,P+1,-Z*v.get(V,P)+B*v.get(V,P+1)),v.set(V,P,z)}d[N-2]=D;break}case 4:{if(p[_]<=0&&(p[_]=p[_]<0?-p[_]:0,c))for(let q=0;q<=E;q++)m.set(q,_,-m.get(q,_));for(;_<E&&!(p[_]>=p[_+1]);){let q=p[_];if(p[_]=p[_+1],p[_+1]=q,c&&_<i-1)for(let R=0;R<i;R++)q=m.get(R,_+1),m.set(R,_+1,m.get(R,_)),m.set(R,_,q);if(u&&_<r-1)for(let R=0;R<r;R++)q=v.get(R,_+1),v.set(R,_+1,v.get(R,_)),v.set(R,_,q);_++}N--;break}}}if(f){let _=m;m=v,v=_}this.m=r,this.n=i,this.s=p,this.U=v,this.V=m}solve(t){let e=t,r=this.threshold,i=this.s.length,s=C.zeros(i,i);for(let h=0;h<i;h++)Math.abs(this.s[h])<=r?s.set(h,h,0):s.set(h,h,1/this.s[h]);let o=this.U,a=this.rightSingularVectors,u=a.mmul(s),c=a.rows,f=o.rows,l=C.zeros(c,f);for(let h=0;h<c;h++)for(let g=0;g<f;g++){let p=0;for(let v=0;v<i;v++)p+=u.get(h,v)*o.get(g,v);l.set(h,g,p)}return l.mmul(e)}solveForDiagonal(t){return this.solve(C.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,i=t.columns,s=new C(r,this.s.length);for(let f=0;f<r;f++)for(let l=0;l<i;l++)Math.abs(this.s[l])>e&&s.set(f,l,t.get(f,l)/this.s[l]);let o=this.U,a=o.rows,u=o.columns,c=new C(r,a);for(let f=0;f<r;f++)for(let l=0;l<a;l++){let h=0;for(let g=0;g<u;g++)h+=s.get(f,g)*o.get(l,g);c.set(f,l,h)}return c}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let i=0,s=r.length;i<s;i++)r[i]>t&&e++;return e}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 C.diag(this.s)}};function v1(n,t=!1){return n=be.checkMatrix(n),t?new wt(n).inverse():pf(n,C.eye(n.rows))}function pf(n,t,e=!1){return n=be.checkMatrix(n),t=be.checkMatrix(t),e?new wt(n).solve(t):n.isSquare()?new gr(n).solve(t):new Nn(n).solve(t)}function pr(n){if(n=C.checkMatrix(n),n.isSquare()){if(n.columns===0)return 1;let t,e,r,i;if(n.columns===2)return t=n.get(0,0),e=n.get(0,1),r=n.get(1,0),i=n.get(1,1),t*i-e*r;if(n.columns===3){let s,o,a;return s=new dr(n,[1,2],[1,2]),o=new dr(n,[1,2],[0,2]),a=new dr(n,[1,2],[0,1]),t=n.get(0,0),e=n.get(0,1),r=n.get(0,2),t*pr(s)-e*pr(o)+r*pr(a)}else return new gr(n).determinant}else throw Error("determinant can only be calculated for a square matrix")}function m1(n,t){let e=[];for(let r=0;r<n;r++)r!==t&&e.push(r);return e}function y1(n,t,e,r=1e-9,i=1e-9){if(n>i)return new Array(t.rows+1).fill(0);{let s=t.addRow(e,[0]);for(let o=0;o<s.rows;o++)Math.abs(s.get(o,0))<r&&s.set(o,0,0);return s.to1DArray()}}function w1(n,t={}){const{thresholdValue:e=1e-9,thresholdError:r=1e-9}=t;n=C.checkMatrix(n);let i=n.rows,s=new C(i,i);for(let o=0;o<i;o++){let a=C.columnVector(n.getRow(o)),u=n.subMatrixRow(m1(i,o)).transpose(),f=new wt(u).solve(a),l=C.sub(a,u.mmul(f)).abs().max();s.setRow(o,y1(l,f,o,e,r))}return s}function b1(n,t=Number.EPSILON){if(n=C.checkMatrix(n),n.isEmpty())return n.transpose();let e=new wt(n,{autoTranspose:!0}),r=e.leftSingularVectors,i=e.rightSingularVectors,s=e.diagonal;for(let o=0;o<s.length;o++)Math.abs(s[o])>t?s[o]=1/s[o]:s[o]=0;return i.mmul(C.diag(s).mmul(r.transpose()))}function _1(n,t=n,e={}){n=new C(n);let r=!1;if(typeof t=="object"&&!C.isMatrix(t)&&!pe.isAnyArray(t)?(e=t,t=n,r=!0):t=new C(t),n.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=e;i&&(n=n.center("column"),r||(t=t.center("column")));const s=n.transpose().mmul(t);for(let o=0;o<s.rows;o++)for(let a=0;a<s.columns;a++)s.set(o,a,s.get(o,a)*(1/(n.rows-1)));return s}function E1(n,t=n,e={}){n=new C(n);let r=!1;if(typeof t=="object"&&!C.isMatrix(t)&&!pe.isAnyArray(t)?(e=t,t=n,r=!0):t=new C(t),n.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:s=!0}=e;i&&(n.center("column"),r||t.center("column")),s&&(n.scale("column"),r||t.scale("column"));const o=n.standardDeviation("column",{unbiased:!0}),a=r?o:t.standardDeviation("column",{unbiased:!0}),u=n.transpose().mmul(t);for(let c=0;c<u.rows;c++)for(let f=0;f<u.columns;f++)u.set(c,f,u.get(c,f)*(1/(o[c]*a[f]))*(1/(n.rows-1)));return u}class vf{constructor(t,e={}){const{assumeSymmetric:r=!1}=e;if(t=be.checkMatrix(t),!t.isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let i=t.columns,s=new C(i,i),o=new Float64Array(i),a=new Float64Array(i),u=t,c,f,l=!1;if(r?l=!0:l=t.isSymmetric(),l){for(c=0;c<i;c++)for(f=0;f<i;f++)s.set(c,f,u.get(c,f));x1(i,a,o,s),N1(i,a,o,s)}else{let h=new C(i,i),g=new Float64Array(i);for(f=0;f<i;f++)for(c=0;c<i;c++)h.set(c,f,u.get(c,f));M1(i,h,g,s),S1(i,a,o,s,h)}this.n=i,this.e=a,this.d=o,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t=this.n,e=this.e,r=this.d,i=new C(t,t),s,o;for(s=0;s<t;s++){for(o=0;o<t;o++)i.set(s,o,0);i.set(s,s,r[s]),e[s]>0?i.set(s,s+1,e[s]):e[s]<0&&i.set(s,s-1,e[s])}return i}}function x1(n,t,e,r){let i,s,o,a,u,c,f,l;for(u=0;u<n;u++)e[u]=r.get(n-1,u);for(a=n-1;a>0;a--){for(l=0,o=0,c=0;c<a;c++)l=l+Math.abs(e[c]);if(l===0)for(t[a]=e[a-1],u=0;u<a;u++)e[u]=r.get(a-1,u),r.set(a,u,0),r.set(u,a,0);else{for(c=0;c<a;c++)e[c]/=l,o+=e[c]*e[c];for(i=e[a-1],s=Math.sqrt(o),i>0&&(s=-s),t[a]=l*s,o=o-i*s,e[a-1]=i-s,u=0;u<a;u++)t[u]=0;for(u=0;u<a;u++){for(i=e[u],r.set(u,a,i),s=t[u]+r.get(u,u)*i,c=u+1;c<=a-1;c++)s+=r.get(c,u)*e[c],t[c]+=r.get(c,u)*i;t[u]=s}for(i=0,u=0;u<a;u++)t[u]/=o,i+=t[u]*e[u];for(f=i/(o+o),u=0;u<a;u++)t[u]-=f*e[u];for(u=0;u<a;u++){for(i=e[u],s=t[u],c=u;c<=a-1;c++)r.set(c,u,r.get(c,u)-(i*t[c]+s*e[c]));e[u]=r.get(a-1,u),r.set(a,u,0)}}e[a]=o}for(a=0;a<n-1;a++){if(r.set(n-1,a,r.get(a,a)),r.set(a,a,1),o=e[a+1],o!==0){for(c=0;c<=a;c++)e[c]=r.get(c,a+1)/o;for(u=0;u<=a;u++){for(s=0,c=0;c<=a;c++)s+=r.get(c,a+1)*r.get(c,u);for(c=0;c<=a;c++)r.set(c,u,r.get(c,u)-s*e[c])}}for(c=0;c<=a;c++)r.set(c,a+1,0)}for(u=0;u<n;u++)e[u]=r.get(n-1,u),r.set(n-1,u,0);r.set(n-1,n-1,1),t[0]=0}function N1(n,t,e,r){let i,s,o,a,u,c,f,l,h,g,p,v,m,d,y,w;for(o=1;o<n;o++)t[o-1]=t[o];t[n-1]=0;let b=0,x=0,M=Number.EPSILON;for(c=0;c<n;c++){for(x=Math.max(x,Math.abs(e[c])+Math.abs(t[c])),f=c;f<n&&!(Math.abs(t[f])<=M*x);)f++;if(f>c)do{for(i=e[c],l=(e[c+1]-i)/(2*t[c]),h=Ce(l,1),l<0&&(h=-h),e[c]=t[c]/(l+h),e[c+1]=t[c]*(l+h),g=e[c+1],s=i-e[c],o=c+2;o<n;o++)e[o]-=s;for(b=b+s,l=e[f],p=1,v=p,m=p,d=t[c+1],y=0,w=0,o=f-1;o>=c;o--)for(m=v,v=p,w=y,i=p*t[o],s=p*l,h=Ce(l,t[o]),t[o+1]=y*h,y=t[o]/h,p=l/h,l=p*e[o]-y*i,e[o+1]=s+y*(p*i+y*e[o]),u=0;u<n;u++)s=r.get(u,o+1),r.set(u,o+1,y*r.get(u,o)+p*s),r.set(u,o,p*r.get(u,o)-y*s);l=-y*w*m*d*t[c]/g,t[c]=y*l,e[c]=p*l}while(Math.abs(t[c])>M*x);e[c]=e[c]+b,t[c]=0}for(o=0;o<n-1;o++){for(u=o,l=e[o],a=o+1;a<n;a++)e[a]<l&&(u=a,l=e[a]);if(u!==o)for(e[u]=e[o],e[o]=l,a=0;a<n;a++)l=r.get(a,o),r.set(a,o,r.get(a,u)),r.set(a,u,l)}}function M1(n,t,e,r){let i=0,s=n-1,o,a,u,c,f,l,h;for(l=i+1;l<=s-1;l++){for(h=0,c=l;c<=s;c++)h=h+Math.abs(t.get(c,l-1));if(h!==0){for(u=0,c=s;c>=l;c--)e[c]=t.get(c,l-1)/h,u+=e[c]*e[c];for(a=Math.sqrt(u),e[l]>0&&(a=-a),u=u-e[l]*a,e[l]=e[l]-a,f=l;f<n;f++){for(o=0,c=s;c>=l;c--)o+=e[c]*t.get(c,f);for(o=o/u,c=l;c<=s;c++)t.set(c,f,t.get(c,f)-o*e[c])}for(c=0;c<=s;c++){for(o=0,f=s;f>=l;f--)o+=e[f]*t.get(c,f);for(o=o/u,f=l;f<=s;f++)t.set(c,f,t.get(c,f)-o*e[f])}e[l]=h*e[l],t.set(l,l-1,h*a)}}for(c=0;c<n;c++)for(f=0;f<n;f++)r.set(c,f,c===f?1:0);for(l=s-1;l>=i+1;l--)if(t.get(l,l-1)!==0){for(c=l+1;c<=s;c++)e[c]=t.get(c,l-1);for(f=l;f<=s;f++){for(a=0,c=l;c<=s;c++)a+=e[c]*r.get(c,f);for(a=a/e[l]/t.get(l,l-1),c=l;c<=s;c++)r.set(c,f,r.get(c,f)+a*e[c])}}}function S1(n,t,e,r,i){let s=n-1,o=0,a=n-1,u=Number.EPSILON,c=0,f=0,l=0,h=0,g=0,p=0,v=0,m=0,d,y,w,b,x,M,N,E,O,_,S,q,R,T,I;for(d=0;d<n;d++)for((d<o||d>a)&&(e[d]=i.get(d,d),t[d]=0),y=Math.max(d-1,0);y<n;y++)f=f+Math.abs(i.get(d,y));for(;s>=o;){for(b=s;b>o&&(p=Math.abs(i.get(b-1,b-1))+Math.abs(i.get(b,b)),p===0&&(p=f),!(Math.abs(i.get(b,b-1))<u*p));)b--;if(b===s)i.set(s,s,i.get(s,s)+c),e[s]=i.get(s,s),t[s]=0,s--,m=0;else if(b===s-1){if(N=i.get(s,s-1)*i.get(s-1,s),l=(i.get(s-1,s-1)-i.get(s,s))/2,h=l*l+N,v=Math.sqrt(Math.abs(h)),i.set(s,s,i.get(s,s)+c),i.set(s-1,s-1,i.get(s-1,s-1)+c),E=i.get(s,s),h>=0){for(v=l>=0?l+v:l-v,e[s-1]=E+v,e[s]=e[s-1],v!==0&&(e[s]=E-N/v),t[s-1]=0,t[s]=0,E=i.get(s,s-1),p=Math.abs(E)+Math.abs(v),l=E/p,h=v/p,g=Math.sqrt(l*l+h*h),l=l/g,h=h/g,y=s-1;y<n;y++)v=i.get(s-1,y),i.set(s-1,y,h*v+l*i.get(s,y)),i.set(s,y,h*i.get(s,y)-l*v);for(d=0;d<=s;d++)v=i.get(d,s-1),i.set(d,s-1,h*v+l*i.get(d,s)),i.set(d,s,h*i.get(d,s)-l*v);for(d=o;d<=a;d++)v=r.get(d,s-1),r.set(d,s-1,h*v+l*r.get(d,s)),r.set(d,s,h*r.get(d,s)-l*v)}else e[s-1]=E+l,e[s]=E+l,t[s-1]=v,t[s]=-v;s=s-2,m=0}else{if(E=i.get(s,s),O=0,N=0,b<s&&(O=i.get(s-1,s-1),N=i.get(s,s-1)*i.get(s-1,s)),m===10){for(c+=E,d=o;d<=s;d++)i.set(d,d,i.get(d,d)-E);p=Math.abs(i.get(s,s-1))+Math.abs(i.get(s-1,s-2)),E=O=.75*p,N=-.4375*p*p}if(m===30&&(p=(O-E)/2,p=p*p+N,p>0)){for(p=Math.sqrt(p),O<E&&(p=-p),p=E-N/((O-E)/2+p),d=o;d<=s;d++)i.set(d,d,i.get(d,d)-p);c+=p,E=O=N=.964}for(m=m+1,x=s-2;x>=b&&(v=i.get(x,x),g=E-v,p=O-v,l=(g*p-N)/i.get(x+1,x)+i.get(x,x+1),h=i.get(x+1,x+1)-v-g-p,g=i.get(x+2,x+1),p=Math.abs(l)+Math.abs(h)+Math.abs(g),l=l/p,h=h/p,g=g/p,!(x===b||Math.abs(i.get(x,x-1))*(Math.abs(h)+Math.abs(g))<u*(Math.abs(l)*(Math.abs(i.get(x-1,x-1))+Math.abs(v)+Math.abs(i.get(x+1,x+1))))));)x--;for(d=x+2;d<=s;d++)i.set(d,d-2,0),d>x+2&&i.set(d,d-3,0);for(w=x;w<=s-1&&(T=w!==s-1,w!==x&&(l=i.get(w,w-1),h=i.get(w+1,w-1),g=T?i.get(w+2,w-1):0,E=Math.abs(l)+Math.abs(h)+Math.abs(g),E!==0&&(l=l/E,h=h/E,g=g/E)),E!==0);w++)if(p=Math.sqrt(l*l+h*h+g*g),l<0&&(p=-p),p!==0){for(w!==x?i.set(w,w-1,-p*E):b!==x&&i.set(w,w-1,-i.get(w,w-1)),l=l+p,E=l/p,O=h/p,v=g/p,h=h/l,g=g/l,y=w;y<n;y++)l=i.get(w,y)+h*i.get(w+1,y),T&&(l=l+g*i.get(w+2,y),i.set(w+2,y,i.get(w+2,y)-l*v)),i.set(w,y,i.get(w,y)-l*E),i.set(w+1,y,i.get(w+1,y)-l*O);for(d=0;d<=Math.min(s,w+3);d++)l=E*i.get(d,w)+O*i.get(d,w+1),T&&(l=l+v*i.get(d,w+2),i.set(d,w+2,i.get(d,w+2)-l*g)),i.set(d,w,i.get(d,w)-l),i.set(d,w+1,i.get(d,w+1)-l*h);for(d=o;d<=a;d++)l=E*r.get(d,w)+O*r.get(d,w+1),T&&(l=l+v*r.get(d,w+2),r.set(d,w+2,r.get(d,w+2)-l*g)),r.set(d,w,r.get(d,w)-l),r.set(d,w+1,r.get(d,w+1)-l*h)}}}if(f!==0){for(s=n-1;s>=0;s--)if(l=e[s],h=t[s],h===0)for(b=s,i.set(s,s,1),d=s-1;d>=0;d--){for(N=i.get(d,d)-l,g=0,y=b;y<=s;y++)g=g+i.get(d,y)*i.get(y,s);if(t[d]<0)v=N,p=g;else if(b=d,t[d]===0?i.set(d,s,N!==0?-g/N:-g/(u*f)):(E=i.get(d,d+1),O=i.get(d+1,d),h=(e[d]-l)*(e[d]-l)+t[d]*t[d],M=(E*p-v*g)/h,i.set(d,s,M),i.set(d+1,s,Math.abs(E)>Math.abs(v)?(-g-N*M)/E:(-p-O*M)/v)),M=Math.abs(i.get(d,s)),u*M*M>1)for(y=d;y<=s;y++)i.set(y,s,i.get(y,s)/M)}else if(h<0)for(b=s-1,Math.abs(i.get(s,s-1))>Math.abs(i.get(s-1,s))?(i.set(s-1,s-1,h/i.get(s,s-1)),i.set(s-1,s,-(i.get(s,s)-l)/i.get(s,s-1))):(I=vr(0,-i.get(s-1,s),i.get(s-1,s-1)-l,h),i.set(s-1,s-1,I[0]),i.set(s-1,s,I[1])),i.set(s,s-1,0),i.set(s,s,1),d=s-2;d>=0;d--){for(_=0,S=0,y=b;y<=s;y++)_=_+i.get(d,y)*i.get(y,s-1),S=S+i.get(d,y)*i.get(y,s);if(N=i.get(d,d)-l,t[d]<0)v=N,g=_,p=S;else if(b=d,t[d]===0?(I=vr(-_,-S,N,h),i.set(d,s-1,I[0]),i.set(d,s,I[1])):(E=i.get(d,d+1),O=i.get(d+1,d),q=(e[d]-l)*(e[d]-l)+t[d]*t[d]-h*h,R=(e[d]-l)*2*h,q===0&&R===0&&(q=u*f*(Math.abs(N)+Math.abs(h)+Math.abs(E)+Math.abs(O)+Math.abs(v))),I=vr(E*g-v*_+h*S,E*p-v*S-h*_,q,R),i.set(d,s-1,I[0]),i.set(d,s,I[1]),Math.abs(E)>Math.abs(v)+Math.abs(h)?(i.set(d+1,s-1,(-_-N*i.get(d,s-1)+h*i.get(d,s))/E),i.set(d+1,s,(-S-N*i.get(d,s)-h*i.get(d,s-1))/E)):(I=vr(-g-O*i.get(d,s-1),-p-O*i.get(d,s),v,h),i.set(d+1,s-1,I[0]),i.set(d+1,s,I[1]))),M=Math.max(Math.abs(i.get(d,s-1)),Math.abs(i.get(d,s))),u*M*M>1)for(y=d;y<=s;y++)i.set(y,s-1,i.get(y,s-1)/M),i.set(y,s,i.get(y,s)/M)}for(d=0;d<n;d++)if(d<o||d>a)for(y=d;y<n;y++)r.set(d,y,i.get(d,y));for(y=n-1;y>=o;y--)for(d=o;d<=a;d++){for(v=0,w=o;w<=Math.min(y,a);w++)v=v+r.get(d,w)*i.get(w,y);r.set(d,y,v)}}}function vr(n,t,e,r){let i,s;return Math.abs(e)>Math.abs(r)?(i=r/e,s=e+i*r,[(n+i*t)/s,(t-i*n)/s]):(i=e/r,s=r+i*e,[(i*n+t)/s,(i*t-n)/s])}class mf{constructor(t){if(t=be.checkMatrix(t),!t.isSymmetric())throw new Error("Matrix is not symmetric");let e=t,r=e.rows,i=new C(r,r),s=!0,o,a,u;for(a=0;a<r;a++){let c=0;for(u=0;u<a;u++){let f=0;for(o=0;o<u;o++)f+=i.get(u,o)*i.get(a,o);f=(e.get(a,u)-f)/i.get(u,u),i.set(a,u,f),c=c+f*f}for(c=e.get(a,a)-c,s&=c>0,i.set(a,a,Math.sqrt(Math.max(c,0))),u=a+1;u<r;u++)i.set(a,u,0)}this.L=i,this.positiveDefinite=!!s}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=be.checkMatrix(t);let e=this.L,r=e.rows;if(t.rows!==r)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let i=t.columns,s=t.clone(),o,a,u;for(u=0;u<r;u++)for(a=0;a<i;a++){for(o=0;o<u;o++)s.set(u,a,s.get(u,a)-s.get(o,a)*e.get(u,o));s.set(u,a,s.get(u,a)/e.get(u,u))}for(u=r-1;u>=0;u--)for(a=0;a<i;a++){for(o=u+1;o<r;o++)s.set(u,a,s.get(u,a)-s.get(o,a)*e.get(o,u));s.set(u,a,s.get(u,a)/e.get(u,u))}return s}get lowerTriangularMatrix(){return this.L}}class yf{constructor(t,e={}){t=be.checkMatrix(t);let{Y:r}=e;const{scaleScores:i=!1,maxIterations:s=1e3,terminationCriteria:o=1e-10}=e;let a;if(r){if(pe.isAnyArray(r)&&typeof r[0]=="number"?r=C.columnVector(r):r=be.checkMatrix(r),r.rows!==t.rows)throw new Error("Y should have the same number of rows as X");a=r.getColumnVector(0)}else a=t.getColumnVector(0);let u=1,c,f,l,h;for(let g=0;g<s&&u>o;g++)l=t.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),l=l.div(l.norm()),c=t.mmul(l).div(l.transpose().mmul(l).get(0,0)),g>0&&(u=c.clone().sub(h).pow(2).sum()),h=c.clone(),r?(f=r.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),f=f.div(f.norm()),a=r.mmul(f).div(f.transpose().mmul(f).get(0,0))):a=c;if(r){let g=t.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0));g=g.div(g.norm());let p=t.clone().sub(c.clone().mmul(g.transpose())),v=a.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),m=r.clone().sub(c.clone().mulS(v.get(0,0)).mmul(f.transpose()));this.t=c,this.p=g.transpose(),this.w=l.transpose(),this.q=f,this.u=a,this.s=c.transpose().mmul(c),this.xResidual=p,this.yResidual=m,this.betas=v}else this.w=l.transpose(),this.s=c.transpose().mmul(c).sqrt(),i?this.t=c.clone().div(this.s.get(0,0)):this.t=c,this.xResidual=t.sub(c.mmul(l.transpose()))}}X.AbstractMatrix=Y,X.CHO=mf,X.CholeskyDecomposition=mf,X.DistanceMatrix=hr,X.EVD=vf,X.EigenvalueDecomposition=vf,X.LU=gr,X.LuDecomposition=gr;var wf=X.Matrix=C;X.MatrixColumnSelectionView=u1,X.MatrixColumnView=a1,X.MatrixFlipColumnView=c1,X.MatrixFlipRowView=f1,X.MatrixRowSelectionView=h1,X.MatrixRowView=l1,X.MatrixSelectionView=dr,X.MatrixSubView=d1,X.MatrixTransposeView=g1,X.NIPALS=yf,X.Nipals=yf,X.QR=Nn,X.QrDecomposition=Nn,X.SVD=wt;var R1=X.SingularValueDecomposition=wt;X.SymmetricMatrix=it,X.WrapperMatrix1D=gf,X.WrapperMatrix2D=be,X.correlation=E1,X.covariance=_1;var bf=X.default=C;X.determinant=pr,X.inverse=v1,X.linearDependencies=w1,X.pseudoInverse=b1,X.solve=pf,X.wrap=p1;const Ye=wf,_f=R1;bf.Matrix&&bf.Matrix;const q1={center:[0,0],linkDistance:50};class Ef{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},q1),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericMDSLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericMDSLayout(!0,t,e)})}genericMDSLayout(t,e,r){return $(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),r),{center:s=[0,0],linkDistance:o=50}=i,a=e.getAllNodes(),u=e.getAllEdges();if(!(a!=null&&a.length)||a.length===1)return nt(e,t,s);const c=Xc({nodes:a,edges:u}),f=Kc(c);O1(f);const l=Iy(f,o),h=A1(l),g=[];return h.forEach((v,m)=>{const d=we(a[m]);d.data.x=v[0]+s[0],d.data.y=v[1]+s[1],g.push(d)}),t&&g.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:g,edges:u}})}}const O1=n=>{let t=-999999;n.forEach(e=>{e.forEach(r=>{r!==1/0&&t<r&&(t=r)})}),n.forEach((e,r)=>{e.forEach((i,s)=>{i===1/0&&(n[r][s]=t)})})},A1=n=>{const e=Ye.mul(Ye.pow(n,2),-.5),r=e.mean("row"),i=e.mean("column"),s=e.mean();e.add(s).subRowVector(r).subColumnVector(i);const o=new _f(e),a=Ye.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(u=>Ye.mul([u],[a]).toJSON()[0].splice(0,2))};function xf(n){return!!n.tick&&!!n.stop}const I1={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},T1={center:[0,0],comboPadding:10,treeKey:"combo"};class k1{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},T1),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,t,e)})}genericComboCombinedLayout(t,e,r){return $(this,void 0,void 0,function*(){const i=this.initVals(Object.assign(Object.assign({},this.options),r)),{center:s,treeKey:o,outerLayout:a}=i,u=e.getAllNodes().filter(E=>!E.data._isCombo),c=e.getAllNodes().filter(E=>E.data._isCombo),f=e.getAllEdges(),l=u==null?void 0:u.length;if(!l||l===1)return nt(e,t,s);const h=[],g=new Map;u.forEach(E=>{g.set(E.id,E)});const p=new Map;c.forEach(E=>{p.set(E.id,E)});const v=new Map,m=this.getInnerGraphs(e,o,g,p,f,i,v);yield Promise.all(m);const d=new Map,y=[],w=new Map;let b=!0;e.getRoots(o).forEach(E=>{const O=v.get(E.id),_=p.get(E.id)||g.get(E.id),S={id:E.id,data:Object.assign(Object.assign({},E.data),{x:O.data.x||_.data.x,y:O.data.y||_.data.y,fx:O.data.fx||_.data.fx,fy:O.data.fy||_.data.fy,mass:O.data.mass||_.data.mass,size:O.data.size})};y.push(S),d.set(E.id,!0),!isNaN(S.data.x)&&S.data.x!==0&&!isNaN(S.data.y)&&S.data.y!==0?b=!1:(S.data.x=Math.random()*100,S.data.y=Math.random()*100),gn(e,[E],q=>{q.id!==E.id&&w.set(q.id,E.id)},"TB",o)});const x=[];f.forEach(E=>{const O=w.get(E.source)||E.source,_=w.get(E.target)||E.target;O!==_&&d.has(O)&&d.has(_)&&x.push({id:E.id,source:O,target:_,data:{}})});let M;if(y!=null&&y.length){if(y.length===1)y[0].data.x=s[0],y[0].data.y=s[1];else{const E=new ue({nodes:y,edges:x}),O=a||new sf;b&&I1[O.id]&&(yield(y.length<100?new Ef:new vn).assign(E));const _=Object.assign({center:s,kg:5,preventOverlap:!0,animate:!1},O.id==="force"?{gravity:1,factor:4,linkDistance:(S,q,R)=>{const T=Math.max(...q.data.size)||32,I=Math.max(...R.data.size)||32;return T/2+I/2+200}}:{});M=yield Nf(O,E,_)}v.forEach(E=>{var O;const _=M.nodes.find(R=>R.id===E.id);if(_){const{x:R,y:T}=_.data;E.data.visited=!0,E.data.x=R,E.data.y=T,h.push({id:E.id,data:{x:R,y:T}})}const{x:S,y:q}=E.data;(O=E.data.nodes)===null||O===void 0||O.forEach(R=>{h.push({id:R.id,data:{x:R.data.x+S,y:R.data.y+q}})})}),v.forEach(({data:E})=>{const{x:O,y:_,visited:S,nodes:q}=E;q==null||q.forEach(R=>{if(!S){const T=h.find(I=>I.id===R.id);T.data.x+=O||0,T.data.y+=_||0}})})}return t&&h.forEach(E=>{e.mergeNodeData(E.id,{x:E.data.x,y:E.data.y})}),{nodes:h,edges:f}})}initVals(t){const e=Object.assign({},t),{nodeSize:r,spacing:i,comboPadding:s}=t;let o,a;if(U(i)?a=()=>i:xe(i)?a=i:a=()=>0,e.spacing=a,!r)o=c=>{const f=a(c);return c.size?he(c.size)?((c.size[0]>c.size[1]?c.size[0]:c.size[1])+f)/2:Ge(c.size)?((c.size.width>c.size.height?c.size.width:c.size.height)+f)/2:(c.size+f)/2:32+f/2};else if(xe(r))o=c=>{const f=r(c),l=a(c);return he(c.size)?((c.size[0]>c.size[1]?c.size[0]:c.size[1])+l)/2:((f||32)+l)/2};else if(he(r)){const f=(r[0]>r[1]?r[0]:r[1])/2;o=l=>f+a(l)/2}else{const c=r/2;o=f=>c+a(f)/2}e.nodeSize=o;let u;return U(s)?u=()=>s:he(s)?u=()=>Math.max.apply(null,s):xe(s)?u=s:u=()=>0,e.comboPadding=u,e}getInnerGraphs(t,e,r,i,s,o,a){const{nodeSize:u,comboPadding:c,spacing:f,innerLayout:l}=o,h=l||new vn({}),g={center:[0,0],preventOverlap:!0,nodeSpacing:f},p=[],v=m=>{let d=(c==null?void 0:c(m))||10;return he(d)&&(d=Math.max(...d)),{size:d?[d*2,d*2]:[30,30],padding:d}};return t.getRoots(e).forEach(m=>{a.set(m.id,{id:m.id,data:{nodes:[],size:v(m).size}});let d=Promise.resolve();gn(t,[m],y=>{var w;if(!y.data._isCombo)return;const{size:b,padding:x}=v(y);if(!(!((w=t.getChildren(y.id,e))===null||w===void 0)&&w.length))a.set(y.id,{id:y.id,data:Object.assign(Object.assign({},y.data),{size:b})});else{const M=a.get(y.id);a.set(y.id,{id:y.id,data:Object.assign({nodes:[]},M==null?void 0:M.data)});const N=new Map,E=t.getChildren(y.id,e).map(S=>{if(S.data._isCombo)return a.has(S.id)||a.set(S.id,{id:S.id,data:Object.assign({},S.data)}),N.set(S.id,!0),a.get(S.id);const q=r.get(S.id)||i.get(S.id);return N.set(S.id,!0),{id:S.id,data:Object.assign(Object.assign({},q.data),S.data)}}),O={nodes:E,edges:s.filter(S=>N.has(S.source)&&N.has(S.target))};let _=1/0;E.forEach(S=>{var q;let{size:R}=S.data;R||(R=((q=a.get(S.id))===null||q===void 0?void 0:q.data.size)||(u==null?void 0:u(S))||[30,30]),U(R)&&(R=[R,R]);const[T,I]=R;_>T&&(_=T),_>I&&(_=I),S.data.size=R}),d=d.then(()=>$(this,void 0,void 0,function*(){const S=new ue(O);yield Nf(h,S,g,!0);const{minX:q,minY:R,maxX:T,maxY:I}=Ty(E),j={x:(T+q)/2,y:(I+R)/2};O.nodes.forEach(A=>{A.data.x-=j.x,A.data.y-=j.y});const F=[Math.max(T-q,_)+x*2,Math.max(I-R,_)+x*2];a.get(y.id).data.size=F,a.get(y.id).data.nodes=E}))}return!0},"BT",e),p.push(d)}),p}}function Nf(n,t,e,r){var i;return $(this,void 0,void 0,function*(){return xf(n)?(n.execute(t,e),n.stop(),n.tick((i=e.iterations)!==null&&i!==void 0?i:300)):r?yield n.assign(t,e):yield n.execute(t,e)})}function j1(n,t){var e,r=1;n==null&&(n=0),t==null&&(t=0);function i(){var s,o=e.length,a,u=0,c=0;for(s=0;s<o;++s)a=e[s],u+=a.x,c+=a.y;for(u=(u/o-n)*r,c=(c/o-t)*r,s=0;s<o;++s)a=e[s],a.x-=u,a.y-=c}return i.initialize=function(s){e=s},i.x=function(s){return arguments.length?(n=+s,i):n},i.y=function(s){return arguments.length?(t=+s,i):t},i.strength=function(s){return arguments.length?(r=+s,i):r},i}function ae(n){return function(){return n}}function Ke(n){return(n()-.5)*1e-6}function C1(n){return n.x+n.vx}function P1(n){return n.y+n.vy}function L1(n){var t,e,r,i=1,s=1;typeof n!="function"&&(n=ae(n==null?1:+n));function o(){for(var c,f=t.length,l,h,g,p,v,m,d=0;d<s;++d)for(l=pt(t,C1,P1).visitAfter(a),c=0;c<f;++c)h=t[c],v=e[h.index],m=v*v,g=h.x+h.vx,p=h.y+h.vy,l.visit(y);function y(w,b,x,M,N){var E=w.data,O=w.r,_=v+O;if(E){if(E.index>h.index){var S=g-E.x-E.vx,q=p-E.y-E.vy,R=S*S+q*q;R<_*_&&(S===0&&(S=Ke(r),R+=S*S),q===0&&(q=Ke(r),R+=q*q),R=(_-(R=Math.sqrt(R)))/R*i,h.vx+=(S*=R)*(_=(O*=O)/(m+O)),h.vy+=(q*=R)*_,E.vx-=S*(_=1-_),E.vy-=q*_)}return}return b>g+_||M<g-_||x>p+_||N<p-_}}function a(c){if(c.data)return c.r=e[c.data.index];for(var f=c.r=0;f<4;++f)c[f]&&c[f].r>c.r&&(c.r=c[f].r)}function u(){if(t){var c,f=t.length,l;for(e=new Array(f),c=0;c<f;++c)l=t[c],e[l.index]=+n(l,c,t)}}return o.initialize=function(c,f){t=c,r=f,u()},o.iterations=function(c){return arguments.length?(s=+c,o):s},o.strength=function(c){return arguments.length?(i=+c,o):i},o.radius=function(c){return arguments.length?(n=typeof c=="function"?c:ae(+c),u(),o):n},o}function D1(n){return n.index}function Mf(n,t){var e=n.get(t);if(!e)throw new Error("node not found: "+t);return e}function z1(n){var t=D1,e=l,r,i=ae(30),s,o,a,u,c,f=1;n==null&&(n=[]);function l(m){return 1/Math.min(a[m.source.index],a[m.target.index])}function h(m){for(var d=0,y=n.length;d<f;++d)for(var w=0,b,x,M,N,E,O,_;w<y;++w)b=n[w],x=b.source,M=b.target,N=M.x+M.vx-x.x-x.vx||Ke(c),E=M.y+M.vy-x.y-x.vy||Ke(c),O=Math.sqrt(N*N+E*E),O=(O-s[w])/O*m*r[w],N*=O,E*=O,M.vx-=N*(_=u[w]),M.vy-=E*_,x.vx+=N*(_=1-_),x.vy+=E*_}function g(){if(o){var m,d=o.length,y=n.length,w=new Map(o.map((x,M)=>[t(x,M,o),x])),b;for(m=0,a=new Array(d);m<y;++m)b=n[m],b.index=m,typeof b.source!="object"&&(b.source=Mf(w,b.source)),typeof b.target!="object"&&(b.target=Mf(w,b.target)),a[b.source.index]=(a[b.source.index]||0)+1,a[b.target.index]=(a[b.target.index]||0)+1;for(m=0,u=new Array(y);m<y;++m)b=n[m],u[m]=a[b.source.index]/(a[b.source.index]+a[b.target.index]);r=new Array(y),p(),s=new Array(y),v()}}function p(){if(o)for(var m=0,d=n.length;m<d;++m)r[m]=+e(n[m],m,n)}function v(){if(o)for(var m=0,d=n.length;m<d;++m)s[m]=+i(n[m],m,n)}return h.initialize=function(m,d){o=m,c=d,g()},h.links=function(m){return arguments.length?(n=m,g(),h):n},h.id=function(m){return arguments.length?(t=m,h):t},h.iterations=function(m){return arguments.length?(f=+m,h):f},h.strength=function(m){return arguments.length?(e=typeof m=="function"?m:ae(+m),p(),h):e},h.distance=function(m){return arguments.length?(i=typeof m=="function"?m:ae(+m),v(),h):i},h}var $1={value:()=>{}};function Mn(){for(var n=0,t=arguments.length,e={},r;n<t;++n){if(!(r=arguments[n]+"")||r in e||/[\s.]/.test(r))throw new Error("illegal type: "+r);e[r]=[]}return new mr(e)}function mr(n){this._=n}function F1(n,t){return n.trim().split(/^|\s+/).map(function(e){var r="",i=e.indexOf(".");if(i>=0&&(r=e.slice(i+1),e=e.slice(0,i)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:r}})}mr.prototype=Mn.prototype={constructor:mr,on:function(n,t){var e=this._,r=F1(n+"",e),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(n=r[s]).type)&&(i=B1(e[i],n.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<o;)if(i=(n=r[s]).type)e[i]=Sf(e[i],n.name,t);else if(t==null)for(i in e)e[i]=Sf(e[i],n.name,null);return this},copy:function(){var n={},t=this._;for(var e in t)n[e]=t[e].slice();return new mr(n)},call:function(n,t){if((i=arguments.length-2)>0)for(var e=new Array(i),r=0,i,s;r<i;++r)e[r]=arguments[r+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(s=this._[n],r=0,i=s.length;r<i;++r)s[r].value.apply(t,e)},apply:function(n,t,e){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var r=this._[n],i=0,s=r.length;i<s;++i)r[i].value.apply(t,e)}};function B1(n,t){for(var e=0,r=n.length,i;e<r;++e)if((i=n[e]).name===t)return i.value}function Sf(n,t,e){for(var r=0,i=n.length;r<i;++r)if(n[r].name===t){n[r]=$1,n=n.slice(0,r).concat(n.slice(r+1));break}return e!=null&&n.push({name:t,value:e}),n}var bt=0,Pt=0,Lt=0,Rf=1e3,yr,Dt,wr=0,st=0,br=0,zt=typeof performance=="object"&&performance.now?performance:Date,qf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function Of(){return st||(qf(U1),st=zt.now()+br)}function U1(){st=0}function Sn(){this._call=this._time=this._next=null}Sn.prototype=Rn.prototype={constructor:Sn,restart:function(n,t,e){if(typeof n!="function")throw new TypeError("callback is not a function");e=(e==null?Of():+e)+(t==null?0:+t),!this._next&&Dt!==this&&(Dt?Dt._next=this:yr=this,Dt=this),this._call=n,this._time=e,qn()},stop:function(){this._call&&(this._call=null,this._time=1/0,qn())}};function Rn(n,t,e){var r=new Sn;return r.restart(n,t,e),r}function G1(){Of(),++bt;for(var n=yr,t;n;)(t=st-n._time)>=0&&n._call.call(void 0,t),n=n._next;--bt}function Af(){st=(wr=zt.now())+br,bt=Pt=0;try{G1()}finally{bt=0,W1(),st=0}}function V1(){var n=zt.now(),t=n-wr;t>Rf&&(br-=t,wr=n)}function W1(){for(var n,t=yr,e,r=1/0;t;)t._call?(r>t._time&&(r=t._time),n=t,t=t._next):(e=t._next,t._next=null,t=n?n._next=e:yr=e);Dt=n,qn(r)}function qn(n){if(!bt){Pt&&(Pt=clearTimeout(Pt));var t=n-st;t>24?(n<1/0&&(Pt=setTimeout(Af,n-zt.now()-br)),Lt&&(Lt=clearInterval(Lt))):(Lt||(wr=zt.now(),Lt=setInterval(V1,Rf)),bt=1,qf(Af))}}const Y1=1664525,K1=1013904223,If=4294967296;function X1(){let n=1;return()=>(n=(Y1*n+K1)%If)/If}function Z1(n){return n.x}function J1(n){return n.y}var Q1=10,H1=Math.PI*(3-Math.sqrt(5));function eb(n){var t,e=1,r=.001,i=1-Math.pow(r,1/300),s=0,o=.6,a=new Map,u=Rn(l),c=Mn("tick","end"),f=X1();n==null&&(n=[]);function l(){h(),c.call("tick",t),e<r&&(u.stop(),c.call("end",t))}function h(v){var m,d=n.length,y;v===void 0&&(v=1);for(var w=0;w<v;++w)for(e+=(s-e)*i,a.forEach(function(b){b(e)}),m=0;m<d;++m)y=n[m],y.fx==null?y.x+=y.vx*=o:(y.x=y.fx,y.vx=0),y.fy==null?y.y+=y.vy*=o:(y.y=y.fy,y.vy=0);return t}function g(){for(var v=0,m=n.length,d;v<m;++v){if(d=n[v],d.index=v,d.fx!=null&&(d.x=d.fx),d.fy!=null&&(d.y=d.fy),isNaN(d.x)||isNaN(d.y)){var y=Q1*Math.sqrt(.5+v),w=v*H1;d.x=y*Math.cos(w),d.y=y*Math.sin(w)}(isNaN(d.vx)||isNaN(d.vy))&&(d.vx=d.vy=0)}}function p(v){return v.initialize&&v.initialize(n,f),v}return g(),t={tick:h,restart:function(){return u.restart(l),t},stop:function(){return u.stop(),t},nodes:function(v){return arguments.length?(n=v,g(),a.forEach(p),t):n},alpha:function(v){return arguments.length?(e=+v,t):e},alphaMin:function(v){return arguments.length?(r=+v,t):r},alphaDecay:function(v){return arguments.length?(i=+v,t):+i},alphaTarget:function(v){return arguments.length?(s=+v,t):s},velocityDecay:function(v){return arguments.length?(o=1-v,t):1-o},randomSource:function(v){return arguments.length?(f=v,a.forEach(p),t):f},force:function(v,m){return arguments.length>1?(m==null?a.delete(v):a.set(v,p(m)),t):a.get(v)},find:function(v,m,d){var y=0,w=n.length,b,x,M,N,E;for(d==null?d=1/0:d*=d,y=0;y<w;++y)N=n[y],b=v-N.x,x=m-N.y,M=b*b+x*x,M<d&&(E=N,d=M);return E},on:function(v,m){return arguments.length>1?(c.on(v,m),t):c.on(v)}}}function tb(){var n,t,e,r,i=ae(-30),s,o=1,a=1/0,u=.81;function c(g){var p,v=n.length,m=pt(n,Z1,J1).visitAfter(l);for(r=g,p=0;p<v;++p)t=n[p],m.visit(h)}function f(){if(n){var g,p=n.length,v;for(s=new Array(p),g=0;g<p;++g)v=n[g],s[v.index]=+i(v,g,n)}}function l(g){var p=0,v,m,d=0,y,w,b;if(g.length){for(y=w=b=0;b<4;++b)(v=g[b])&&(m=Math.abs(v.value))&&(p+=v.value,d+=m,y+=m*v.x,w+=m*v.y);g.x=y/d,g.y=w/d}else{v=g,v.x=v.data.x,v.y=v.data.y;do p+=s[v.data.index];while(v=v.next)}g.value=p}function h(g,p,v,m){if(!g.value)return!0;var d=g.x-t.x,y=g.y-t.y,w=m-p,b=d*d+y*y;if(w*w/u<b)return b<a&&(d===0&&(d=Ke(e),b+=d*d),y===0&&(y=Ke(e),b+=y*y),b<o&&(b=Math.sqrt(o*b)),t.vx+=d*g.value*r/b,t.vy+=y*g.value*r/b),!0;if(g.length||b>=a)return;(g.data!==t||g.next)&&(d===0&&(d=Ke(e),b+=d*d),y===0&&(y=Ke(e),b+=y*y),b<o&&(b=Math.sqrt(o*b)));do g.data!==t&&(w=s[g.data.index]*r/b,t.vx+=d*w,t.vy+=y*w);while(g=g.next)}return c.initialize=function(g,p){n=g,e=p,f()},c.strength=function(g){return arguments.length?(i=typeof g=="function"?g:ae(+g),f(),c):i},c.distanceMin=function(g){return arguments.length?(o=g*g,c):Math.sqrt(o)},c.distanceMax=function(g){return arguments.length?(a=g*g,c):Math.sqrt(a)},c.theta=function(g){return arguments.length?(u=g*g,c):Math.sqrt(u)},c}function rb(n,t,e){var r,i=ae(.1),s,o;typeof n!="function"&&(n=ae(+n)),t==null&&(t=0),e==null&&(e=0);function a(c){for(var f=0,l=r.length;f<l;++f){var h=r[f],g=h.x-t||1e-6,p=h.y-e||1e-6,v=Math.sqrt(g*g+p*p),m=(o[f]-v)*s[f]*c/v;h.vx+=g*m,h.vy+=p*m}}function u(){if(r){var c,f=r.length;for(s=new Array(f),o=new Array(f),c=0;c<f;++c)o[c]=+n(r[c],c,r),s[c]=isNaN(o[c])?0:+i(r[c],c,r)}}return a.initialize=function(c){r=c,u()},a.strength=function(c){return arguments.length?(i=typeof c=="function"?c:ae(+c),u(),a):i},a.radius=function(c){return arguments.length?(n=typeof c=="function"?c:ae(+c),u(),a):n},a.x=function(c){return arguments.length?(t=+c,a):t},a.y=function(c){return arguments.length?(e=+c,a):e},a}function nb(n){var t=ae(.1),e,r,i;typeof n!="function"&&(n=ae(n==null?0:+n));function s(a){for(var u=0,c=e.length,f;u<c;++u)f=e[u],f.vx+=(i[u]-f.x)*r[u]*a}function o(){if(e){var a,u=e.length;for(r=new Array(u),i=new Array(u),a=0;a<u;++a)r[a]=isNaN(i[a]=+n(e[a],a,e))?0:+t(e[a],a,e)}}return s.initialize=function(a){e=a,o()},s.strength=function(a){return arguments.length?(t=typeof a=="function"?a:ae(+a),o(),s):t},s.x=function(a){return arguments.length?(n=typeof a=="function"?a:ae(+a),o(),s):n},s}function ib(n){var t=ae(.1),e,r,i;typeof n!="function"&&(n=ae(n==null?0:+n));function s(a){for(var u=0,c=e.length,f;u<c;++u)f=e[u],f.vy+=(i[u]-f.y)*r[u]*a}function o(){if(e){var a,u=e.length;for(r=new Array(u),i=new Array(u),a=0;a<u;++a)r[a]=isNaN(i[a]=+n(e[a],a,e))?0:+t(e[a],a,e)}}return s.initialize=function(a){e=a,o()},s.strength=function(a){return arguments.length?(t=typeof a=="function"?a:ae(+a),o(),s):t},s.y=function(a){return arguments.length?(n=typeof a=="function"?a:ae(+a),o(),s):n},s}class Tf{constructor(t){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:z1,manyBody:tb,center:j1,collide:L1,radial:rb,x:nb,y:ib},this.options={link:{id:e=>e.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},mc(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericLayout(!0,t,e)})}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const r=this.context.nodes.find(i=>i.id===t);r&&e.forEach((i,s)=>{if(typeof i=="number"||i===null){const o=["fx","fy","fz"][s];r[o]=i}})}getOptions(t){var e,r;const i=mc({},this.options,t);return i.collide&&((e=i.collide)===null||e===void 0?void 0:e.radius)===void 0&&(i.collide=i.collide||{},i.collide.radius=(r=i.nodeSize)!==null&&r!==void 0?r:10),i.iterations===void 0&&(i.link&&i.link.iterations===void 0&&(i.iterations=i.link.iterations),i.collide&&i.collide.iterations===void 0&&(i.iterations=i.collide.iterations)),this.context.options=i,i}genericLayout(t,e,r){var i;return $(this,void 0,void 0,function*(){const s=this.getOptions(r),o=e.getAllNodes().map(({id:f,data:l})=>Object.assign({id:f,data:l},yc(l,this.config.inputNodeAttrs))),a=e.getAllEdges().map(f=>Object.assign({},f));Object.assign(this.context,{assign:t,nodes:o,edges:a,graph:e});const u=new Promise(f=>{this.resolver=f}),c=this.setSimulation(s);return c.nodes(o),(i=c.force("link"))===null||i===void 0||i.links(a),u})}getResult(){const{assign:t,nodes:e,edges:r,graph:i}=this.context,s=e.map(a=>({id:a.id,data:Object.assign(Object.assign({},a.data),yc(a,this.config.outputNodeAttrs))})),o=r.map(({id:a,source:u,target:c,data:f})=>({id:a,source:typeof u=="object"?u.id:u,target:typeof c=="object"?c.id:c,data:f}));return t&&s.forEach(a=>i.mergeNodeData(a.id,a.data)),{nodes:s,edges:o}}initSimulation(){return eb()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",()=>{var r;return(r=t.onTick)===null||r===void 0?void 0:r.call(t,this.getResult())}).on("end",()=>{var r;return(r=this.resolver)===null||r===void 0?void 0:r.call(this,this.getResult())})),kf(e,this.config.simulationAttrs.map(r=>[r,t[r]])),Object.entries(this.forceMap).forEach(([r,i])=>{const s=r;if(t[r]){let o=e.force(s);o||(o=i(),e.force(s,o)),kf(o,Object.entries(t[s]))}else e.force(s,null)}),e}}const kf=(n,t)=>t.reduce((e,[r,i])=>!e[r]||i===void 0?e:e[r].call(n,i),n);function sb(n,t,e){var r,i=1;n==null&&(n=0),t==null&&(t=0),e==null&&(e=0);function s(){var o,a=r.length,u,c=0,f=0,l=0;for(o=0;o<a;++o)u=r[o],c+=u.x||0,f+=u.y||0,l+=u.z||0;for(c=(c/a-n)*i,f=(f/a-t)*i,l=(l/a-e)*i,o=0;o<a;++o)u=r[o],c&&(u.x-=c),f&&(u.y-=f),l&&(u.z-=l)}return s.initialize=function(o){r=o},s.x=function(o){return arguments.length?(n=+o,s):n},s.y=function(o){return arguments.length?(t=+o,s):t},s.z=function(o){return arguments.length?(e=+o,s):e},s.strength=function(o){return arguments.length?(i=+o,s):i},s}function ob(n){const t=+this._x.call(null,n);return jf(this.cover(t),t,n)}function jf(n,t,e){if(isNaN(t))return n;var r,i=n._root,s={data:e},o=n._x0,a=n._x1,u,c,f,l,h;if(!i)return n._root=s,n;for(;i.length;)if((f=t>=(u=(o+a)/2))?o=u:a=u,r=i,!(i=i[l=+f]))return r[l]=s,n;if(c=+n._x.call(null,i.data),t===c)return s.next=i,r?r[l]=s:n._root=s,n;do r=r?r[l]=new Array(2):n._root=new Array(2),(f=t>=(u=(o+a)/2))?o=u:a=u;while((l=+f)==(h=+(c>=u)));return r[h]=i,r[l]=s,n}function ab(n){Array.isArray(n)||(n=Array.from(n));const t=n.length,e=new Float64Array(t);let r=1/0,i=-1/0;for(let s=0,o;s<t;++s)isNaN(o=+this._x.call(null,n[s]))||(e[s]=o,o<r&&(r=o),o>i&&(i=o));if(r>i)return this;this.cover(r).cover(i);for(let s=0;s<t;++s)jf(this,e[s],n[s]);return this}function ub(n){if(isNaN(n=+n))return this;var t=this._x0,e=this._x1;if(isNaN(t))e=(t=Math.floor(n))+1;else{for(var r=e-t||1,i=this._root,s,o;t>n||n>=e;)switch(o=+(n<t),s=new Array(2),s[o]=i,i=s,r*=2,o){case 0:e=t+r;break;case 1:t=e-r;break}this._root&&this._root.length&&(this._root=i)}return this._x0=t,this._x1=e,this}function cb(){var n=[];return this.visit(function(t){if(!t.length)do n.push(t.data);while(t=t.next)}),n}function fb(n){return arguments.length?this.cover(+n[0][0]).cover(+n[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function Pe(n,t,e){this.node=n,this.x0=t,this.x1=e}function lb(n,t){var e,r=this._x0,i,s,o=this._x1,a=[],u=this._root,c,f;for(u&&a.push(new Pe(u,r,o)),t==null?t=1/0:(r=n-t,o=n+t);c=a.pop();)if(!(!(u=c.node)||(i=c.x0)>o||(s=c.x1)<r))if(u.length){var l=(i+s)/2;a.push(new Pe(u[1],l,s),new Pe(u[0],i,l)),(f=+(n>=l))&&(c=a[a.length-1],a[a.length-1]=a[a.length-1-f],a[a.length-1-f]=c)}else{var h=Math.abs(n-+this._x.call(null,u.data));h<t&&(t=h,r=n-h,o=n+h,e=u.data)}return e}function hb(n){if(isNaN(u=+this._x.call(null,n)))return this;var t,e=this._root,r,i,s,o=this._x0,a=this._x1,u,c,f,l,h;if(!e)return this;if(e.length)for(;;){if((f=u>=(c=(o+a)/2))?o=c:a=c,t=e,!(e=e[l=+f]))return this;if(!e.length)break;t[l+1&1]&&(r=t,h=l)}for(;e.data!==n;)if(i=e,!(e=e.next))return this;return(s=e.next)&&delete e.next,i?(s?i.next=s:delete i.next,this):t?(s?t[l]=s:delete t[l],(e=t[0]||t[1])&&e===(t[1]||t[0])&&!e.length&&(r?r[h]=e:this._root=e),this):(this._root=s,this)}function db(n){for(var t=0,e=n.length;t<e;++t)this.remove(n[t]);return this}function gb(){return this._root}function pb(){var n=0;return this.visit(function(t){if(!t.length)do++n;while(t=t.next)}),n}function vb(n){var t=[],e,r=this._root,i,s,o;for(r&&t.push(new Pe(r,this._x0,this._x1));e=t.pop();)if(!n(r=e.node,s=e.x0,o=e.x1)&&r.length){var a=(s+o)/2;(i=r[1])&&t.push(new Pe(i,a,o)),(i=r[0])&&t.push(new Pe(i,s,a))}return this}function mb(n){var t=[],e=[],r;for(this._root&&t.push(new Pe(this._root,this._x0,this._x1));r=t.pop();){var i=r.node;if(i.length){var s,o=r.x0,a=r.x1,u=(o+a)/2;(s=i[0])&&t.push(new Pe(s,o,u)),(s=i[1])&&t.push(new Pe(s,u,a))}e.push(r)}for(;r=e.pop();)n(r.node,r.x0,r.x1);return this}function yb(n){return n[0]}function wb(n){return arguments.length?(this._x=n,this):this._x}function On(n,t){var e=new An(t??yb,NaN,NaN);return n==null?e:e.addAll(n)}function An(n,t,e){this._x=n,this._x0=t,this._x1=e,this._root=void 0}function Cf(n){for(var t={data:n.data},e=t;n=n.next;)e=e.next={data:n.data};return t}var ve=On.prototype=An.prototype;ve.copy=function(){var n=new An(this._x,this._x0,this._x1),t=this._root,e,r;if(!t)return n;if(!t.length)return n._root=Cf(t),n;for(e=[{source:t,target:n._root=new Array(2)}];t=e.pop();)for(var i=0;i<2;++i)(r=t.source[i])&&(r.length?e.push({source:r,target:t.target[i]=new Array(2)}):t.target[i]=Cf(r));return n},ve.add=ob,ve.addAll=ab,ve.cover=ub,ve.data=cb,ve.extent=fb,ve.find=lb,ve.remove=hb,ve.removeAll=db,ve.root=gb,ve.size=pb,ve.visit=vb,ve.visitAfter=mb,ve.x=wb;function ie(n){return function(){return n}}function Se(n){return(n()-.5)*1e-6}function In(n){return n.x+n.vx}function Pf(n){return n.y+n.vy}function bb(n){return n.z+n.vz}function _b(n){var t,e,r,i,s=1,o=1;typeof n!="function"&&(n=ie(n==null?1:+n));function a(){for(var f,l=t.length,h,g,p,v,m,d,y,w=0;w<o;++w)for(h=(e===1?On(t,In):e===2?pt(t,In,Pf):e===3?ar(t,In,Pf,bb):null).visitAfter(u),f=0;f<l;++f)g=t[f],d=r[g.index],y=d*d,p=g.x+g.vx,e>1&&(v=g.y+g.vy),e>2&&(m=g.z+g.vz),h.visit(b);function b(x,M,N,E,O,_,S){var q=[M,N,E,O,_,S],R=q[0],T=q[1],I=q[2],j=q[e],F=q[e+1],A=q[e+2],k=x.data,L=x.r,D=d+L;if(k){if(k.index>g.index){var G=p-k.x-k.vx,P=e>1?v-k.y-k.vy:0,z=e>2?m-k.z-k.vz:0,B=G*G+P*P+z*z;B<D*D&&(G===0&&(G=Se(i),B+=G*G),e>1&&P===0&&(P=Se(i),B+=P*P),e>2&&z===0&&(z=Se(i),B+=z*z),B=(D-(B=Math.sqrt(B)))/B*s,g.vx+=(G*=B)*(D=(L*=L)/(y+L)),e>1&&(g.vy+=(P*=B)*D),e>2&&(g.vz+=(z*=B)*D),k.vx-=G*(D=1-D),e>1&&(k.vy-=P*D),e>2&&(k.vz-=z*D))}return}return R>p+D||j<p-D||e>1&&(T>v+D||F<v-D)||e>2&&(I>m+D||A<m-D)}}function u(f){if(f.data)return f.r=r[f.data.index];for(var l=f.r=0;l<Math.pow(2,e);++l)f[l]&&f[l].r>f.r&&(f.r=f[l].r)}function c(){if(t){var f,l=t.length,h;for(r=new Array(l),f=0;f<l;++f)h=t[f],r[h.index]=+n(h,f,t)}}return a.initialize=function(f,...l){t=f,i=l.find(h=>typeof h=="function")||Math.random,e=l.find(h=>[1,2,3].includes(h))||2,c()},a.iterations=function(f){return arguments.length?(o=+f,a):o},a.strength=function(f){return arguments.length?(s=+f,a):s},a.radius=function(f){return arguments.length?(n=typeof f=="function"?f:ie(+f),c(),a):n},a}function Eb(n){return n.index}function Lf(n,t){var e=n.get(t);if(!e)throw new Error("node not found: "+t);return e}function xb(n){var t=Eb,e=h,r,i=ie(30),s,o,a,u,c,f,l=1;n==null&&(n=[]);function h(d){return 1/Math.min(u[d.source.index],u[d.target.index])}function g(d){for(var y=0,w=n.length;y<l;++y)for(var b=0,x,M,N,E=0,O=0,_=0,S,q;b<w;++b)x=n[b],M=x.source,N=x.target,E=N.x+N.vx-M.x-M.vx||Se(f),a>1&&(O=N.y+N.vy-M.y-M.vy||Se(f)),a>2&&(_=N.z+N.vz-M.z-M.vz||Se(f)),S=Math.sqrt(E*E+O*O+_*_),S=(S-s[b])/S*d*r[b],E*=S,O*=S,_*=S,N.vx-=E*(q=c[b]),a>1&&(N.vy-=O*q),a>2&&(N.vz-=_*q),M.vx+=E*(q=1-q),a>1&&(M.vy+=O*q),a>2&&(M.vz+=_*q)}function p(){if(o){var d,y=o.length,w=n.length,b=new Map(o.map((M,N)=>[t(M,N,o),M])),x;for(d=0,u=new Array(y);d<w;++d)x=n[d],x.index=d,typeof x.source!="object"&&(x.source=Lf(b,x.source)),typeof x.target!="object"&&(x.target=Lf(b,x.target)),u[x.source.index]=(u[x.source.index]||0)+1,u[x.target.index]=(u[x.target.index]||0)+1;for(d=0,c=new Array(w);d<w;++d)x=n[d],c[d]=u[x.source.index]/(u[x.source.index]+u[x.target.index]);r=new Array(w),v(),s=new Array(w),m()}}function v(){if(o)for(var d=0,y=n.length;d<y;++d)r[d]=+e(n[d],d,n)}function m(){if(o)for(var d=0,y=n.length;d<y;++d)s[d]=+i(n[d],d,n)}return g.initialize=function(d,...y){o=d,f=y.find(w=>typeof w=="function")||Math.random,a=y.find(w=>[1,2,3].includes(w))||2,p()},g.links=function(d){return arguments.length?(n=d,p(),g):n},g.id=function(d){return arguments.length?(t=d,g):t},g.iterations=function(d){return arguments.length?(l=+d,g):l},g.strength=function(d){return arguments.length?(e=typeof d=="function"?d:ie(+d),v(),g):e},g.distance=function(d){return arguments.length?(i=typeof d=="function"?d:ie(+d),m(),g):i},g}const Nb=1664525,Mb=1013904223,Df=4294967296;function Sb(){let n=1;return()=>(n=(Nb*n+Mb)%Df)/Df}var zf=3;function Tn(n){return n.x}function $f(n){return n.y}function Rb(n){return n.z}var qb=10,Ob=Math.PI*(3-Math.sqrt(5)),Ab=Math.PI*20/(9+Math.sqrt(221));function Ib(n,t){t=t||2;var e=Math.min(zf,Math.max(1,Math.round(t))),r,i=1,s=.001,o=1-Math.pow(s,1/300),a=0,u=.6,c=new Map,f=Rn(g),l=Mn("tick","end"),h=Sb();n==null&&(n=[]);function g(){p(),l.call("tick",r),i<s&&(f.stop(),l.call("end",r))}function p(d){var y,w=n.length,b;d===void 0&&(d=1);for(var x=0;x<d;++x)for(i+=(a-i)*o,c.forEach(function(M){M(i)}),y=0;y<w;++y)b=n[y],b.fx==null?b.x+=b.vx*=u:(b.x=b.fx,b.vx=0),e>1&&(b.fy==null?b.y+=b.vy*=u:(b.y=b.fy,b.vy=0)),e>2&&(b.fz==null?b.z+=b.vz*=u:(b.z=b.fz,b.vz=0));return r}function v(){for(var d=0,y=n.length,w;d<y;++d){if(w=n[d],w.index=d,w.fx!=null&&(w.x=w.fx),w.fy!=null&&(w.y=w.fy),w.fz!=null&&(w.z=w.fz),isNaN(w.x)||e>1&&isNaN(w.y)||e>2&&isNaN(w.z)){var b=qb*(e>2?Math.cbrt(.5+d):e>1?Math.sqrt(.5+d):d),x=d*Ob,M=d*Ab;e===1?w.x=b:e===2?(w.x=b*Math.cos(x),w.y=b*Math.sin(x)):(w.x=b*Math.sin(x)*Math.cos(M),w.y=b*Math.cos(x),w.z=b*Math.sin(x)*Math.sin(M))}(isNaN(w.vx)||e>1&&isNaN(w.vy)||e>2&&isNaN(w.vz))&&(w.vx=0,e>1&&(w.vy=0),e>2&&(w.vz=0))}}function m(d){return d.initialize&&d.initialize(n,h,e),d}return v(),r={tick:p,restart:function(){return f.restart(g),r},stop:function(){return f.stop(),r},numDimensions:function(d){return arguments.length?(e=Math.min(zf,Math.max(1,Math.round(d))),c.forEach(m),r):e},nodes:function(d){return arguments.length?(n=d,v(),c.forEach(m),r):n},alpha:function(d){return arguments.length?(i=+d,r):i},alphaMin:function(d){return arguments.length?(s=+d,r):s},alphaDecay:function(d){return arguments.length?(o=+d,r):+o},alphaTarget:function(d){return arguments.length?(a=+d,r):a},velocityDecay:function(d){return arguments.length?(u=1-d,r):1-u},randomSource:function(d){return arguments.length?(h=d,c.forEach(m),r):h},force:function(d,y){return arguments.length>1?(y==null?c.delete(d):c.set(d,m(y)),r):c.get(d)},find:function(){var d=Array.prototype.slice.call(arguments),y=d.shift()||0,w=(e>1?d.shift():null)||0,b=(e>2?d.shift():null)||0,x=d.shift()||1/0,M=0,N=n.length,E,O,_,S,q,R;for(x*=x,M=0;M<N;++M)q=n[M],E=y-q.x,O=w-(q.y||0),_=b-(q.z||0),S=E*E+O*O+_*_,S<x&&(R=q,x=S);return R},on:function(d,y){return arguments.length>1?(l.on(d,y),r):l.on(d)}}}function Tb(){var n,t,e,r,i,s=ie(-30),o,a=1,u=1/0,c=.81;function f(p){var v,m=n.length,d=(t===1?On(n,Tn):t===2?pt(n,Tn,$f):t===3?ar(n,Tn,$f,Rb):null).visitAfter(h);for(i=p,v=0;v<m;++v)e=n[v],d.visit(g)}function l(){if(n){var p,v=n.length,m;for(o=new Array(v),p=0;p<v;++p)m=n[p],o[m.index]=+s(m,p,n)}}function h(p){var v=0,m,d,y=0,w,b,x,M,N=p.length;if(N){for(w=b=x=M=0;M<N;++M)(m=p[M])&&(d=Math.abs(m.value))&&(v+=m.value,y+=d,w+=d*(m.x||0),b+=d*(m.y||0),x+=d*(m.z||0));v*=Math.sqrt(4/N),p.x=w/y,t>1&&(p.y=b/y),t>2&&(p.z=x/y)}else{m=p,m.x=m.data.x,t>1&&(m.y=m.data.y),t>2&&(m.z=m.data.z);do v+=o[m.data.index];while(m=m.next)}p.value=v}function g(p,v,m,d,y){if(!p.value)return!0;var w=[m,d,y][t-1],b=p.x-e.x,x=t>1?p.y-e.y:0,M=t>2?p.z-e.z:0,N=w-v,E=b*b+x*x+M*M;if(N*N/c<E)return E<u&&(b===0&&(b=Se(r),E+=b*b),t>1&&x===0&&(x=Se(r),E+=x*x),t>2&&M===0&&(M=Se(r),E+=M*M),E<a&&(E=Math.sqrt(a*E)),e.vx+=b*p.value*i/E,t>1&&(e.vy+=x*p.value*i/E),t>2&&(e.vz+=M*p.value*i/E)),!0;if(p.length||E>=u)return;(p.data!==e||p.next)&&(b===0&&(b=Se(r),E+=b*b),t>1&&x===0&&(x=Se(r),E+=x*x),t>2&&M===0&&(M=Se(r),E+=M*M),E<a&&(E=Math.sqrt(a*E)));do p.data!==e&&(N=o[p.data.index]*i/E,e.vx+=b*N,t>1&&(e.vy+=x*N),t>2&&(e.vz+=M*N));while(p=p.next)}return f.initialize=function(p,...v){n=p,r=v.find(m=>typeof m=="function")||Math.random,t=v.find(m=>[1,2,3].includes(m))||2,l()},f.strength=function(p){return arguments.length?(s=typeof p=="function"?p:ie(+p),l(),f):s},f.distanceMin=function(p){return arguments.length?(a=p*p,f):Math.sqrt(a)},f.distanceMax=function(p){return arguments.length?(u=p*p,f):Math.sqrt(u)},f.theta=function(p){return arguments.length?(c=p*p,f):Math.sqrt(c)},f}function kb(n,t,e,r){var i,s,o=ie(.1),a,u;typeof n!="function"&&(n=ie(+n)),t==null&&(t=0),e==null&&(e=0),r==null&&(r=0);function c(l){for(var h=0,g=i.length;h<g;++h){var p=i[h],v=p.x-t||1e-6,m=(p.y||0)-e||1e-6,d=(p.z||0)-r||1e-6,y=Math.sqrt(v*v+m*m+d*d),w=(u[h]-y)*a[h]*l/y;p.vx+=v*w,s>1&&(p.vy+=m*w),s>2&&(p.vz+=d*w)}}function f(){if(i){var l,h=i.length;for(a=new Array(h),u=new Array(h),l=0;l<h;++l)u[l]=+n(i[l],l,i),a[l]=isNaN(u[l])?0:+o(i[l],l,i)}}return c.initialize=function(l,...h){i=l,s=h.find(g=>[1,2,3].includes(g))||2,f()},c.strength=function(l){return arguments.length?(o=typeof l=="function"?l:ie(+l),f(),c):o},c.radius=function(l){return arguments.length?(n=typeof l=="function"?l:ie(+l),f(),c):n},c.x=function(l){return arguments.length?(t=+l,c):t},c.y=function(l){return arguments.length?(e=+l,c):e},c.z=function(l){return arguments.length?(r=+l,c):r},c}function jb(n){var t=ie(.1),e,r,i;typeof n!="function"&&(n=ie(n==null?0:+n));function s(a){for(var u=0,c=e.length,f;u<c;++u)f=e[u],f.vx+=(i[u]-f.x)*r[u]*a}function o(){if(e){var a,u=e.length;for(r=new Array(u),i=new Array(u),a=0;a<u;++a)r[a]=isNaN(i[a]=+n(e[a],a,e))?0:+t(e[a],a,e)}}return s.initialize=function(a){e=a,o()},s.strength=function(a){return arguments.length?(t=typeof a=="function"?a:ie(+a),o(),s):t},s.x=function(a){return arguments.length?(n=typeof a=="function"?a:ie(+a),o(),s):n},s}function Cb(n){var t=ie(.1),e,r,i;typeof n!="function"&&(n=ie(n==null?0:+n));function s(a){for(var u=0,c=e.length,f;u<c;++u)f=e[u],f.vy+=(i[u]-f.y)*r[u]*a}function o(){if(e){var a,u=e.length;for(r=new Array(u),i=new Array(u),a=0;a<u;++a)r[a]=isNaN(i[a]=+n(e[a],a,e))?0:+t(e[a],a,e)}}return s.initialize=function(a){e=a,o()},s.strength=function(a){return arguments.length?(t=typeof a=="function"?a:ie(+a),o(),s):t},s.y=function(a){return arguments.length?(n=typeof a=="function"?a:ie(+a),o(),s):n},s}function Pb(n){var t=ie(.1),e,r,i;typeof n!="function"&&(n=ie(n==null?0:+n));function s(a){for(var u=0,c=e.length,f;u<c;++u)f=e[u],f.vz+=(i[u]-f.z)*r[u]*a}function o(){if(e){var a,u=e.length;for(r=new Array(u),i=new Array(u),a=0;a<u;++a)r[a]=isNaN(i[a]=+n(e[a],a,e))?0:+t(e[a],a,e)}}return s.initialize=function(a){e=a,o()},s.strength=function(a){return arguments.length?(t=typeof a=="function"?a:ie(+a),o(),s):t},s.z=function(a){return arguments.length?(n=typeof a=="function"?a:ie(+a),o(),s):n},s}class Lb extends Tf{constructor(){super(...arguments),this.id="d3-force-3d",this.config={inputNodeAttrs:["x","y","z","vx","vy","vz","fx","fy","fz"],outputNodeAttrs:["x","y","z","vx","vy","vz"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:xb,manyBody:Tb,center:sb,collide:_b,radial:kb,x:jb,y:Cb,z:Pb},this.options={numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return Ib()}}function kn(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jn,Ff;function Db(){if(Ff)return jn;Ff=1;function n(){this.__data__=[],this.size=0}return jn=n,jn}var Cn,Bf;function _t(){if(Bf)return Cn;Bf=1;function n(t,e){return t===e||t!==t&&e!==e}return Cn=n,Cn}var Pn,Uf;function _r(){if(Uf)return Pn;Uf=1;var n=_t();function t(e,r){for(var i=e.length;i--;)if(n(e[i][0],r))return i;return-1}return Pn=t,Pn}var Ln,Gf;function zb(){if(Gf)return Ln;Gf=1;var n=_r(),t=Array.prototype,e=t.splice;function r(i){var s=this.__data__,o=n(s,i);if(o<0)return!1;var a=s.length-1;return o==a?s.pop():e.call(s,o,1),--this.size,!0}return Ln=r,Ln}var Dn,Vf;function $b(){if(Vf)return Dn;Vf=1;var n=_r();function t(e){var r=this.__data__,i=n(r,e);return i<0?void 0:r[i][1]}return Dn=t,Dn}var zn,Wf;function Fb(){if(Wf)return zn;Wf=1;var n=_r();function t(e){return n(this.__data__,e)>-1}return zn=t,zn}var $n,Yf;function Bb(){if(Yf)return $n;Yf=1;var n=_r();function t(e,r){var i=this.__data__,s=n(i,e);return s<0?(++this.size,i.push([e,r])):i[s][1]=r,this}return $n=t,$n}var Fn,Kf;function Er(){if(Kf)return Fn;Kf=1;var n=Db(),t=zb(),e=$b(),r=Fb(),i=Bb();function s(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var c=o[a];this.set(c[0],c[1])}}return s.prototype.clear=n,s.prototype.delete=t,s.prototype.get=e,s.prototype.has=r,s.prototype.set=i,Fn=s,Fn}var Bn,Xf;function Ub(){if(Xf)return Bn;Xf=1;var n=Er();function t(){this.__data__=new n,this.size=0}return Bn=t,Bn}var Un,Zf;function Gb(){if(Zf)return Un;Zf=1;function n(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}return Un=n,Un}var Gn,Jf;function Vb(){if(Jf)return Gn;Jf=1;function n(t){return this.__data__.get(t)}return Gn=n,Gn}var Vn,Qf;function Wb(){if(Qf)return Vn;Qf=1;function n(t){return this.__data__.has(t)}return Vn=n,Vn}var Wn,Hf;function el(){if(Hf)return Wn;Hf=1;var n=typeof ur=="object"&&ur&&ur.Object===Object&&ur;return Wn=n,Wn}var Yn,tl;function Oe(){if(tl)return Yn;tl=1;var n=el(),t=typeof self=="object"&&self&&self.Object===Object&&self,e=n||t||Function("return this")();return Yn=e,Yn}var Kn,rl;function Et(){if(rl)return Kn;rl=1;var n=Oe(),t=n.Symbol;return Kn=t,Kn}var Xn,nl;function Yb(){if(nl)return Xn;nl=1;var n=Et(),t=Object.prototype,e=t.hasOwnProperty,r=t.toString,i=n?n.toStringTag:void 0;function s(o){var a=e.call(o,i),u=o[i];try{o[i]=void 0;var c=!0}catch{}var f=r.call(o);return c&&(a?o[i]=u:delete o[i]),f}return Xn=s,Xn}var Zn,il;function Kb(){if(il)return Zn;il=1;var n=Object.prototype,t=n.toString;function e(r){return t.call(r)}return Zn=e,Zn}var Jn,sl;function ot(){if(sl)return Jn;sl=1;var n=Et(),t=Yb(),e=Kb(),r="[object Null]",i="[object Undefined]",s=n?n.toStringTag:void 0;function o(a){return a==null?a===void 0?i:r:s&&s in Object(a)?t(a):e(a)}return Jn=o,Jn}var Qn,ol;function Re(){if(ol)return Qn;ol=1;function n(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}return Qn=n,Qn}var Hn,al;function $t(){if(al)return Hn;al=1;var n=ot(),t=Re(),e="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",s="[object Proxy]";function o(a){if(!t(a))return!1;var u=n(a);return u==r||u==i||u==e||u==s}return Hn=o,Hn}var ei,ul;function Xb(){if(ul)return ei;ul=1;var n=Oe(),t=n["__core-js_shared__"];return ei=t,ei}var ti,cl;function Zb(){if(cl)return ti;cl=1;var n=Xb(),t=function(){var r=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function e(r){return!!t&&t in r}return ti=e,ti}var ri,fl;function ll(){if(fl)return ri;fl=1;var n=Function.prototype,t=n.toString;function e(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return ri=e,ri}var ni,hl;function Jb(){if(hl)return ni;hl=1;var n=$t(),t=Zb(),e=Re(),r=ll(),i=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,o=Function.prototype,a=Object.prototype,u=o.toString,c=a.hasOwnProperty,f=RegExp("^"+u.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!e(h)||t(h))return!1;var g=n(h)?f:s;return g.test(r(h))}return ni=l,ni}var ii,dl;function Qb(){if(dl)return ii;dl=1;function n(t,e){return t==null?void 0:t[e]}return ii=n,ii}var si,gl;function at(){if(gl)return si;gl=1;var n=Jb(),t=Qb();function e(r,i){var s=t(r,i);return n(s)?s:void 0}return si=e,si}var oi,pl;function ai(){if(pl)return oi;pl=1;var n=at(),t=Oe(),e=n(t,"Map");return oi=e,oi}var ui,vl;function xr(){if(vl)return ui;vl=1;var n=at(),t=n(Object,"create");return ui=t,ui}var ci,ml;function Hb(){if(ml)return ci;ml=1;var n=xr();function t(){this.__data__=n?n(null):{},this.size=0}return ci=t,ci}var fi,yl;function e_(){if(yl)return fi;yl=1;function n(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}return fi=n,fi}var li,wl;function t_(){if(wl)return li;wl=1;var n=xr(),t="__lodash_hash_undefined__",e=Object.prototype,r=e.hasOwnProperty;function i(s){var o=this.__data__;if(n){var a=o[s];return a===t?void 0:a}return r.call(o,s)?o[s]:void 0}return li=i,li}var hi,bl;function r_(){if(bl)return hi;bl=1;var n=xr(),t=Object.prototype,e=t.hasOwnProperty;function r(i){var s=this.__data__;return n?s[i]!==void 0:e.call(s,i)}return hi=r,hi}var di,_l;function n_(){if(_l)return di;_l=1;var n=xr(),t="__lodash_hash_undefined__";function e(r,i){var s=this.__data__;return this.size+=this.has(r)?0:1,s[r]=n&&i===void 0?t:i,this}return di=e,di}var gi,El;function i_(){if(El)return gi;El=1;var n=Hb(),t=e_(),e=t_(),r=r_(),i=n_();function s(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var c=o[a];this.set(c[0],c[1])}}return s.prototype.clear=n,s.prototype.delete=t,s.prototype.get=e,s.prototype.has=r,s.prototype.set=i,gi=s,gi}var pi,xl;function s_(){if(xl)return pi;xl=1;var n=i_(),t=Er(),e=ai();function r(){this.size=0,this.__data__={hash:new n,map:new(e||t),string:new n}}return pi=r,pi}var vi,Nl;function o_(){if(Nl)return vi;Nl=1;function n(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}return vi=n,vi}var mi,Ml;function Nr(){if(Ml)return mi;Ml=1;var n=o_();function t(e,r){var i=e.__data__;return n(r)?i[typeof r=="string"?"string":"hash"]:i.map}return mi=t,mi}var yi,Sl;function a_(){if(Sl)return yi;Sl=1;var n=Nr();function t(e){var r=n(this,e).delete(e);return this.size-=r?1:0,r}return yi=t,yi}var wi,Rl;function u_(){if(Rl)return wi;Rl=1;var n=Nr();function t(e){return n(this,e).get(e)}return wi=t,wi}var bi,ql;function c_(){if(ql)return bi;ql=1;var n=Nr();function t(e){return n(this,e).has(e)}return bi=t,bi}var _i,Ol;function f_(){if(Ol)return _i;Ol=1;var n=Nr();function t(e,r){var i=n(this,e),s=i.size;return i.set(e,r),this.size+=i.size==s?0:1,this}return _i=t,_i}var Ei,Al;function xi(){if(Al)return Ei;Al=1;var n=s_(),t=a_(),e=u_(),r=c_(),i=f_();function s(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var c=o[a];this.set(c[0],c[1])}}return s.prototype.clear=n,s.prototype.delete=t,s.prototype.get=e,s.prototype.has=r,s.prototype.set=i,Ei=s,Ei}var Ni,Il;function l_(){if(Il)return Ni;Il=1;var n=Er(),t=ai(),e=xi(),r=200;function i(s,o){var a=this.__data__;if(a instanceof n){var u=a.__data__;if(!t||u.length<r-1)return u.push([s,o]),this.size=++a.size,this;a=this.__data__=new e(u)}return a.set(s,o),this.size=a.size,this}return Ni=i,Ni}var Mi,Tl;function Mr(){if(Tl)return Mi;Tl=1;var n=Er(),t=Ub(),e=Gb(),r=Vb(),i=Wb(),s=l_();function o(a){var u=this.__data__=new n(a);this.size=u.size}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=r,o.prototype.has=i,o.prototype.set=s,Mi=o,Mi}var Si,kl;function Ri(){if(kl)return Si;kl=1;function n(t,e){for(var r=-1,i=t==null?0:t.length;++r<i&&e(t[r],r,t)!==!1;);return t}return Si=n,Si}var qi,jl;function Cl(){if(jl)return qi;jl=1;var n=at(),t=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch{}}();return qi=t,qi}var Oi,Pl;function Sr(){if(Pl)return Oi;Pl=1;var n=Cl();function t(e,r,i){r=="__proto__"&&n?n(e,r,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[r]=i}return Oi=t,Oi}var Ai,Ll;function Rr(){if(Ll)return Ai;Ll=1;var n=Sr(),t=_t(),e=Object.prototype,r=e.hasOwnProperty;function i(s,o,a){var u=s[o];(!(r.call(s,o)&&t(u,a))||a===void 0&&!(o in s))&&n(s,o,a)}return Ai=i,Ai}var Ii,Dl;function Ft(){if(Dl)return Ii;Dl=1;var n=Rr(),t=Sr();function e(r,i,s,o){var a=!s;s||(s={});for(var u=-1,c=i.length;++u<c;){var f=i[u],l=o?o(s[f],r[f],f,s,r):void 0;l===void 0&&(l=r[f]),a?t(s,f,l):n(s,f,l)}return s}return Ii=e,Ii}var Ti,zl;function h_(){if(zl)return Ti;zl=1;function n(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i}return Ti=n,Ti}var ki,$l;function Te(){if($l)return ki;$l=1;function n(t){return t!=null&&typeof t=="object"}return ki=n,ki}var ji,Fl;function d_(){if(Fl)return ji;Fl=1;var n=ot(),t=Te(),e="[object Arguments]";function r(i){return t(i)&&n(i)==e}return ji=r,ji}var Ci,Bl;function Bt(){if(Bl)return Ci;Bl=1;var n=d_(),t=Te(),e=Object.prototype,r=e.hasOwnProperty,i=e.propertyIsEnumerable,s=n(function(){return arguments}())?n:function(o){return t(o)&&r.call(o,"callee")&&!i.call(o,"callee")};return Ci=s,Ci}var Pi,Ul;function oe(){if(Ul)return Pi;Ul=1;var n=Array.isArray;return Pi=n,Pi}var Ut={exports:{}},Li,Gl;function g_(){if(Gl)return Li;Gl=1;function n(){return!1}return Li=n,Li}Ut.exports;var Vl;function xt(){return Vl||(Vl=1,function(n,t){var e=Oe(),r=g_(),i=t&&!t.nodeType&&t,s=i&&!0&&n&&!n.nodeType&&n,o=s&&s.exports===i,a=o?e.Buffer:void 0,u=a?a.isBuffer:void 0,c=u||r;n.exports=c}(Ut,Ut.exports)),Ut.exports}var Di,Wl;function qr(){if(Wl)return Di;Wl=1;var n=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function e(r,i){var s=typeof r;return i=i??n,!!i&&(s=="number"||s!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<i}return Di=e,Di}var zi,Yl;function $i(){if(Yl)return zi;Yl=1;var n=9007199254740991;function t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=n}return zi=t,zi}var Fi,Kl;function p_(){if(Kl)return Fi;Kl=1;var n=ot(),t=$i(),e=Te(),r="[object Arguments]",i="[object Array]",s="[object Boolean]",o="[object Date]",a="[object Error]",u="[object Function]",c="[object Map]",f="[object Number]",l="[object Object]",h="[object RegExp]",g="[object Set]",p="[object String]",v="[object WeakMap]",m="[object ArrayBuffer]",d="[object DataView]",y="[object Float32Array]",w="[object Float64Array]",b="[object Int8Array]",x="[object Int16Array]",M="[object Int32Array]",N="[object Uint8Array]",E="[object Uint8ClampedArray]",O="[object Uint16Array]",_="[object Uint32Array]",S={};S[y]=S[w]=S[b]=S[x]=S[M]=S[N]=S[E]=S[O]=S[_]=!0,S[r]=S[i]=S[m]=S[s]=S[d]=S[o]=S[a]=S[u]=S[c]=S[f]=S[l]=S[h]=S[g]=S[p]=S[v]=!1;function q(R){return e(R)&&t(R.length)&&!!S[n(R)]}return Fi=q,Fi}var Bi,Xl;function Or(){if(Xl)return Bi;Xl=1;function n(t){return function(e){return t(e)}}return Bi=n,Bi}var Gt={exports:{}};Gt.exports;var Zl;function Ui(){return Zl||(Zl=1,function(n,t){var e=el(),r=t&&!t.nodeType&&t,i=r&&!0&&n&&!n.nodeType&&n,s=i&&i.exports===r,o=s&&e.process,a=function(){try{var u=i&&i.require&&i.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}}();n.exports=a}(Gt,Gt.exports)),Gt.exports}var Gi,Jl;function Vt(){if(Jl)return Gi;Jl=1;var n=p_(),t=Or(),e=Ui(),r=e&&e.isTypedArray,i=r?t(r):n;return Gi=i,Gi}var Vi,Ql;function Hl(){if(Ql)return Vi;Ql=1;var n=h_(),t=Bt(),e=oe(),r=xt(),i=qr(),s=Vt(),o=Object.prototype,a=o.hasOwnProperty;function u(c,f){var l=e(c),h=!l&&t(c),g=!l&&!h&&r(c),p=!l&&!h&&!g&&s(c),v=l||h||g||p,m=v?n(c.length,String):[],d=m.length;for(var y in c)(f||a.call(c,y))&&!(v&&(y=="length"||g&&(y=="offset"||y=="parent")||p&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||i(y,d)))&&m.push(y);return m}return Vi=u,Vi}var Wi,eh;function Ar(){if(eh)return Wi;eh=1;var n=Object.prototype;function t(e){var r=e&&e.constructor,i=typeof r=="function"&&r.prototype||n;return e===i}return Wi=t,Wi}var Yi,th;function rh(){if(th)return Yi;th=1;function n(t,e){return function(r){return t(e(r))}}return Yi=n,Yi}var Ki,nh;function v_(){if(nh)return Ki;nh=1;var n=rh(),t=n(Object.keys,Object);return Ki=t,Ki}var Xi,ih;function Zi(){if(ih)return Xi;ih=1;var n=Ar(),t=v_(),e=Object.prototype,r=e.hasOwnProperty;function i(s){if(!n(s))return t(s);var o=[];for(var a in Object(s))r.call(s,a)&&a!="constructor"&&o.push(a);return o}return Xi=i,Xi}var Ji,sh;function Le(){if(sh)return Ji;sh=1;var n=$t(),t=$i();function e(r){return r!=null&&t(r.length)&&!n(r)}return Ji=e,Ji}var Qi,oh;function Xe(){if(oh)return Qi;oh=1;var n=Hl(),t=Zi(),e=Le();function r(i){return e(i)?n(i):t(i)}return Qi=r,Qi}var Hi,ah;function m_(){if(ah)return Hi;ah=1;var n=Ft(),t=Xe();function e(r,i){return r&&n(i,t(i),r)}return Hi=e,Hi}var es,uh;function y_(){if(uh)return es;uh=1;function n(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}return es=n,es}var ts,ch;function w_(){if(ch)return ts;ch=1;var n=Re(),t=Ar(),e=y_(),r=Object.prototype,i=r.hasOwnProperty;function s(o){if(!n(o))return e(o);var a=t(o),u=[];for(var c in o)c=="constructor"&&(a||!i.call(o,c))||u.push(c);return u}return ts=s,ts}var rs,fh;function ut(){if(fh)return rs;fh=1;var n=Hl(),t=w_(),e=Le();function r(i){return e(i)?n(i,!0):t(i)}return rs=r,rs}var ns,lh;function b_(){if(lh)return ns;lh=1;var n=Ft(),t=ut();function e(r,i){return r&&n(i,t(i),r)}return ns=e,ns}var Wt={exports:{}};Wt.exports;var hh;function dh(){return hh||(hh=1,function(n,t){var e=Oe(),r=t&&!t.nodeType&&t,i=r&&!0&&n&&!n.nodeType&&n,s=i&&i.exports===r,o=s?e.Buffer:void 0,a=o?o.allocUnsafe:void 0;function u(c,f){if(f)return c.slice();var l=c.length,h=a?a(l):new c.constructor(l);return c.copy(h),h}n.exports=u}(Wt,Wt.exports)),Wt.exports}var is,gh;function ph(){if(gh)return is;gh=1;function n(t,e){var r=-1,i=t.length;for(e||(e=Array(i));++r<i;)e[r]=t[r];return e}return is=n,is}var ss,vh;function mh(){if(vh)return ss;vh=1;function n(t,e){for(var r=-1,i=t==null?0:t.length,s=0,o=[];++r<i;){var a=t[r];e(a,r,t)&&(o[s++]=a)}return o}return ss=n,ss}var os,yh;function wh(){if(yh)return os;yh=1;function n(){return[]}return os=n,os}var as,bh;function us(){if(bh)return as;bh=1;var n=mh(),t=wh(),e=Object.prototype,r=e.propertyIsEnumerable,i=Object.getOwnPropertySymbols,s=i?function(o){return o==null?[]:(o=Object(o),n(i(o),function(a){return r.call(o,a)}))}:t;return as=s,as}var cs,_h;function __(){if(_h)return cs;_h=1;var n=Ft(),t=us();function e(r,i){return n(r,t(r),i)}return cs=e,cs}var fs,Eh;function ls(){if(Eh)return fs;Eh=1;function n(t,e){for(var r=-1,i=e.length,s=t.length;++r<i;)t[s+r]=e[r];return t}return fs=n,fs}var hs,xh;function Ir(){if(xh)return hs;xh=1;var n=rh(),t=n(Object.getPrototypeOf,Object);return hs=t,hs}var ds,Nh;function Mh(){if(Nh)return ds;Nh=1;var n=ls(),t=Ir(),e=us(),r=wh(),i=Object.getOwnPropertySymbols,s=i?function(o){for(var a=[];o;)n(a,e(o)),o=t(o);return a}:r;return ds=s,ds}var gs,Sh;function E_(){if(Sh)return gs;Sh=1;var n=Ft(),t=Mh();function e(r,i){return n(r,t(r),i)}return gs=e,gs}var ps,Rh;function qh(){if(Rh)return ps;Rh=1;var n=ls(),t=oe();function e(r,i,s){var o=i(r);return t(r)?o:n(o,s(r))}return ps=e,ps}var vs,Oh;function Ah(){if(Oh)return vs;Oh=1;var n=qh(),t=us(),e=Xe();function r(i){return n(i,e,t)}return vs=r,vs}var ms,Ih;function x_(){if(Ih)return ms;Ih=1;var n=qh(),t=Mh(),e=ut();function r(i){return n(i,e,t)}return ms=r,ms}var ys,Th;function N_(){if(Th)return ys;Th=1;var n=at(),t=Oe(),e=n(t,"DataView");return ys=e,ys}var ws,kh;function M_(){if(kh)return ws;kh=1;var n=at(),t=Oe(),e=n(t,"Promise");return ws=e,ws}var bs,jh;function Ch(){if(jh)return bs;jh=1;var n=at(),t=Oe(),e=n(t,"Set");return bs=e,bs}var _s,Ph;function S_(){if(Ph)return _s;Ph=1;var n=at(),t=Oe(),e=n(t,"WeakMap");return _s=e,_s}var Es,Lh;function Nt(){if(Lh)return Es;Lh=1;var n=N_(),t=ai(),e=M_(),r=Ch(),i=S_(),s=ot(),o=ll(),a="[object Map]",u="[object Object]",c="[object Promise]",f="[object Set]",l="[object WeakMap]",h="[object DataView]",g=o(n),p=o(t),v=o(e),m=o(r),d=o(i),y=s;return(n&&y(new n(new ArrayBuffer(1)))!=h||t&&y(new t)!=a||e&&y(e.resolve())!=c||r&&y(new r)!=f||i&&y(new i)!=l)&&(y=function(w){var b=s(w),x=b==u?w.constructor:void 0,M=x?o(x):"";if(M)switch(M){case g:return h;case p:return a;case v:return c;case m:return f;case d:return l}return b}),Es=y,Es}var xs,Dh;function R_(){if(Dh)return xs;Dh=1;var n=Object.prototype,t=n.hasOwnProperty;function e(r){var i=r.length,s=new r.constructor(i);return i&&typeof r[0]=="string"&&t.call(r,"index")&&(s.index=r.index,s.input=r.input),s}return xs=e,xs}var Ns,zh;function $h(){if(zh)return Ns;zh=1;var n=Oe(),t=n.Uint8Array;return Ns=t,Ns}var Ms,Fh;function Ss(){if(Fh)return Ms;Fh=1;var n=$h();function t(e){var r=new e.constructor(e.byteLength);return new n(r).set(new n(e)),r}return Ms=t,Ms}var Rs,Bh;function q_(){if(Bh)return Rs;Bh=1;var n=Ss();function t(e,r){var i=r?n(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}return Rs=t,Rs}var qs,Uh;function O_(){if(Uh)return qs;Uh=1;var n=/\w*$/;function t(e){var r=new e.constructor(e.source,n.exec(e));return r.lastIndex=e.lastIndex,r}return qs=t,qs}var Os,Gh;function A_(){if(Gh)return Os;Gh=1;var n=Et(),t=n?n.prototype:void 0,e=t?t.valueOf:void 0;function r(i){return e?Object(e.call(i)):{}}return Os=r,Os}var As,Vh;function Wh(){if(Vh)return As;Vh=1;var n=Ss();function t(e,r){var i=r?n(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}return As=t,As}var Is,Yh;function I_(){if(Yh)return Is;Yh=1;var n=Ss(),t=q_(),e=O_(),r=A_(),i=Wh(),s="[object Boolean]",o="[object Date]",a="[object Map]",u="[object Number]",c="[object RegExp]",f="[object Set]",l="[object String]",h="[object Symbol]",g="[object ArrayBuffer]",p="[object DataView]",v="[object Float32Array]",m="[object Float64Array]",d="[object Int8Array]",y="[object Int16Array]",w="[object Int32Array]",b="[object Uint8Array]",x="[object Uint8ClampedArray]",M="[object Uint16Array]",N="[object Uint32Array]";function E(O,_,S){var q=O.constructor;switch(_){case g:return n(O);case s:case o:return new q(+O);case p:return t(O,S);case v:case m:case d:case y:case w:case b:case x:case M:case N:return i(O,S);case a:return new q;case u:case l:return new q(O);case c:return e(O);case f:return new q;case h:return r(O)}}return Is=E,Is}var Ts,Kh;function Xh(){if(Kh)return Ts;Kh=1;var n=Re(),t=Object.create,e=function(){function r(){}return function(i){if(!n(i))return{};if(t)return t(i);r.prototype=i;var s=new r;return r.prototype=void 0,s}}();return Ts=e,Ts}var ks,Zh;function Jh(){if(Zh)return ks;Zh=1;var n=Xh(),t=Ir(),e=Ar();function r(i){return typeof i.constructor=="function"&&!e(i)?n(t(i)):{}}return ks=r,ks}var js,Qh;function T_(){if(Qh)return js;Qh=1;var n=Nt(),t=Te(),e="[object Map]";function r(i){return t(i)&&n(i)==e}return js=r,js}var Cs,Hh;function k_(){if(Hh)return Cs;Hh=1;var n=T_(),t=Or(),e=Ui(),r=e&&e.isMap,i=r?t(r):n;return Cs=i,Cs}var Ps,ed;function j_(){if(ed)return Ps;ed=1;var n=Nt(),t=Te(),e="[object Set]";function r(i){return t(i)&&n(i)==e}return Ps=r,Ps}var Ls,td;function C_(){if(td)return Ls;td=1;var n=j_(),t=Or(),e=Ui(),r=e&&e.isSet,i=r?t(r):n;return Ls=i,Ls}var Ds,rd;function nd(){if(rd)return Ds;rd=1;var n=Mr(),t=Ri(),e=Rr(),r=m_(),i=b_(),s=dh(),o=ph(),a=__(),u=E_(),c=Ah(),f=x_(),l=Nt(),h=R_(),g=I_(),p=Jh(),v=oe(),m=xt(),d=k_(),y=Re(),w=C_(),b=Xe(),x=ut(),M=1,N=2,E=4,O="[object Arguments]",_="[object Array]",S="[object Boolean]",q="[object Date]",R="[object Error]",T="[object Function]",I="[object GeneratorFunction]",j="[object Map]",F="[object Number]",A="[object Object]",k="[object RegExp]",L="[object Set]",D="[object String]",G="[object Symbol]",P="[object WeakMap]",z="[object ArrayBuffer]",B="[object DataView]",Z="[object Float32Array]",V="[object Float64Array]",le="[object Int8Array]",Ee="[object Int16Array]",Hu="[object Int32Array]",ec="[object Uint8Array]",tc="[object Uint8ClampedArray]",rc="[object Uint16Array]",nc="[object Uint32Array]",H={};H[O]=H[_]=H[z]=H[B]=H[S]=H[q]=H[Z]=H[V]=H[le]=H[Ee]=H[Hu]=H[j]=H[F]=H[A]=H[k]=H[L]=H[D]=H[G]=H[ec]=H[tc]=H[rc]=H[nc]=!0,H[R]=H[T]=H[P]=!1;function Ot(Q,At,It,JS,Zr,et){var ye,Jr=At&M,Qr=At&N,QS=At&E;if(It&&(ye=Zr?It(Q,JS,Zr,et):It(Q)),ye!==void 0)return ye;if(!y(Q))return Q;var p0=v(Q);if(p0){if(ye=h(Q),!Jr)return o(Q,ye)}else{var Tt=l(Q),v0=Tt==T||Tt==I;if(m(Q))return s(Q,Jr);if(Tt==A||Tt==O||v0&&!Zr){if(ye=Qr||v0?{}:p(Q),!Jr)return Qr?u(Q,i(ye,Q)):a(Q,r(ye,Q))}else{if(!H[Tt])return Zr?Q:{};ye=g(Q,Tt,Jr)}}et||(et=new n);var m0=et.get(Q);if(m0)return m0;et.set(Q,ye),w(Q)?Q.forEach(function(tt){ye.add(Ot(tt,At,It,tt,Q,et))}):d(Q)&&Q.forEach(function(tt,ht){ye.set(ht,Ot(tt,At,It,ht,Q,et))});var HS=QS?Qr?f:c:Qr?x:b,y0=p0?void 0:HS(Q);return t(y0||Q,function(tt,ht){y0&&(ht=tt,tt=Q[ht]),e(ye,ht,Ot(tt,At,It,ht,Q,et))}),ye}return Ds=Ot,Ds}var zs,id;function P_(){if(id)return zs;id=1;var n=nd(),t=4;function e(r){return n(r,t)}return zs=e,zs}var $s,sd;function Fs(){if(sd)return $s;sd=1;function n(t){return function(){return t}}return $s=n,$s}var Bs,od;function L_(){if(od)return Bs;od=1;function n(t){return function(e,r,i){for(var s=-1,o=Object(e),a=i(e),u=a.length;u--;){var c=a[t?u:++s];if(r(o[c],c,o)===!1)break}return e}}return Bs=n,Bs}var Us,ad;function Gs(){if(ad)return Us;ad=1;var n=L_(),t=n();return Us=t,Us}var Vs,ud;function Ws(){if(ud)return Vs;ud=1;var n=Gs(),t=Xe();function e(r,i){return r&&n(r,i,t)}return Vs=e,Vs}var Ys,cd;function D_(){if(cd)return Ys;cd=1;var n=Le();function t(e,r){return function(i,s){if(i==null)return i;if(!n(i))return e(i,s);for(var o=i.length,a=r?o:-1,u=Object(i);(r?a--:++a<o)&&s(u[a],a,u)!==!1;);return i}}return Ys=t,Ys}var Ks,fd;function Tr(){if(fd)return Ks;fd=1;var n=Ws(),t=D_(),e=t(n);return Ks=e,Ks}var Xs,ld;function ct(){if(ld)return Xs;ld=1;function n(t){return t}return Xs=n,Xs}var Zs,hd;function dd(){if(hd)return Zs;hd=1;var n=ct();function t(e){return typeof e=="function"?e:n}return Zs=t,Zs}var Js,gd;function pd(){if(gd)return Js;gd=1;var n=Ri(),t=Tr(),e=dd(),r=oe();function i(s,o){var a=r(s)?n:t;return a(s,e(o))}return Js=i,Js}var Qs,vd;function md(){return vd||(vd=1,Qs=pd()),Qs}var Hs,yd;function z_(){if(yd)return Hs;yd=1;var n=Tr();function t(e,r){var i=[];return n(e,function(s,o,a){r(s,o,a)&&i.push(s)}),i}return Hs=t,Hs}var eo,wd;function $_(){if(wd)return eo;wd=1;var n="__lodash_hash_undefined__";function t(e){return this.__data__.set(e,n),this}return eo=t,eo}var to,bd;function F_(){if(bd)return to;bd=1;function n(t){return this.__data__.has(t)}return to=n,to}var ro,_d;function Ed(){if(_d)return ro;_d=1;var n=xi(),t=$_(),e=F_();function r(i){var s=-1,o=i==null?0:i.length;for(this.__data__=new n;++s<o;)this.add(i[s])}return r.prototype.add=r.prototype.push=t,r.prototype.has=e,ro=r,ro}var no,xd;function B_(){if(xd)return no;xd=1;function n(t,e){for(var r=-1,i=t==null?0:t.length;++r<i;)if(e(t[r],r,t))return!0;return!1}return no=n,no}var io,Nd;function Md(){if(Nd)return io;Nd=1;function n(t,e){return t.has(e)}return io=n,io}var so,Sd;function Rd(){if(Sd)return so;Sd=1;var n=Ed(),t=B_(),e=Md(),r=1,i=2;function s(o,a,u,c,f,l){var h=u&r,g=o.length,p=a.length;if(g!=p&&!(h&&p>g))return!1;var v=l.get(o),m=l.get(a);if(v&&m)return v==a&&m==o;var d=-1,y=!0,w=u&i?new n:void 0;for(l.set(o,a),l.set(a,o);++d<g;){var b=o[d],x=a[d];if(c)var M=h?c(x,b,d,a,o,l):c(b,x,d,o,a,l);if(M!==void 0){if(M)continue;y=!1;break}if(w){if(!t(a,function(N,E){if(!e(w,E)&&(b===N||f(b,N,u,c,l)))return w.push(E)})){y=!1;break}}else if(!(b===x||f(b,x,u,c,l))){y=!1;break}}return l.delete(o),l.delete(a),y}return so=s,so}var oo,qd;function U_(){if(qd)return oo;qd=1;function n(t){var e=-1,r=Array(t.size);return t.forEach(function(i,s){r[++e]=[s,i]}),r}return oo=n,oo}var ao,Od;function uo(){if(Od)return ao;Od=1;function n(t){var e=-1,r=Array(t.size);return t.forEach(function(i){r[++e]=i}),r}return ao=n,ao}var co,Ad;function G_(){if(Ad)return co;Ad=1;var n=Et(),t=$h(),e=_t(),r=Rd(),i=U_(),s=uo(),o=1,a=2,u="[object Boolean]",c="[object Date]",f="[object Error]",l="[object Map]",h="[object Number]",g="[object RegExp]",p="[object Set]",v="[object String]",m="[object Symbol]",d="[object ArrayBuffer]",y="[object DataView]",w=n?n.prototype:void 0,b=w?w.valueOf:void 0;function x(M,N,E,O,_,S,q){switch(E){case y:if(M.byteLength!=N.byteLength||M.byteOffset!=N.byteOffset)return!1;M=M.buffer,N=N.buffer;case d:return!(M.byteLength!=N.byteLength||!S(new t(M),new t(N)));case u:case c:case h:return e(+M,+N);case f:return M.name==N.name&&M.message==N.message;case g:case v:return M==N+"";case l:var R=i;case p:var T=O&o;if(R||(R=s),M.size!=N.size&&!T)return!1;var I=q.get(M);if(I)return I==N;O|=a,q.set(M,N);var j=r(R(M),R(N),O,_,S,q);return q.delete(M),j;case m:if(b)return b.call(M)==b.call(N)}return!1}return co=x,co}var fo,Id;function V_(){if(Id)return fo;Id=1;var n=Ah(),t=1,e=Object.prototype,r=e.hasOwnProperty;function i(s,o,a,u,c,f){var l=a&t,h=n(s),g=h.length,p=n(o),v=p.length;if(g!=v&&!l)return!1;for(var m=g;m--;){var d=h[m];if(!(l?d in o:r.call(o,d)))return!1}var y=f.get(s),w=f.get(o);if(y&&w)return y==o&&w==s;var b=!0;f.set(s,o),f.set(o,s);for(var x=l;++m<g;){d=h[m];var M=s[d],N=o[d];if(u)var E=l?u(N,M,d,o,s,f):u(M,N,d,s,o,f);if(!(E===void 0?M===N||c(M,N,a,u,f):E)){b=!1;break}x||(x=d=="constructor")}if(b&&!x){var O=s.constructor,_=o.constructor;O!=_&&"constructor"in s&&"constructor"in o&&!(typeof O=="function"&&O instanceof O&&typeof _=="function"&&_ instanceof _)&&(b=!1)}return f.delete(s),f.delete(o),b}return fo=i,fo}var lo,Td;function W_(){if(Td)return lo;Td=1;var n=Mr(),t=Rd(),e=G_(),r=V_(),i=Nt(),s=oe(),o=xt(),a=Vt(),u=1,c="[object Arguments]",f="[object Array]",l="[object Object]",h=Object.prototype,g=h.hasOwnProperty;function p(v,m,d,y,w,b){var x=s(v),M=s(m),N=x?f:i(v),E=M?f:i(m);N=N==c?l:N,E=E==c?l:E;var O=N==l,_=E==l,S=N==E;if(S&&o(v)){if(!o(m))return!1;x=!0,O=!1}if(S&&!O)return b||(b=new n),x||a(v)?t(v,m,d,y,w,b):e(v,m,N,d,y,w,b);if(!(d&u)){var q=O&&g.call(v,"__wrapped__"),R=_&&g.call(m,"__wrapped__");if(q||R){var T=q?v.value():v,I=R?m.value():m;return b||(b=new n),w(T,I,d,y,b)}}return S?(b||(b=new n),r(v,m,d,y,w,b)):!1}return lo=p,lo}var ho,kd;function jd(){if(kd)return ho;kd=1;var n=W_(),t=Te();function e(r,i,s,o,a){return r===i?!0:r==null||i==null||!t(r)&&!t(i)?r!==r&&i!==i:n(r,i,s,o,e,a)}return ho=e,ho}var go,Cd;function Y_(){if(Cd)return go;Cd=1;var n=Mr(),t=jd(),e=1,r=2;function i(s,o,a,u){var c=a.length,f=c,l=!u;if(s==null)return!f;for(s=Object(s);c--;){var h=a[c];if(l&&h[2]?h[1]!==s[h[0]]:!(h[0]in s))return!1}for(;++c<f;){h=a[c];var g=h[0],p=s[g],v=h[1];if(l&&h[2]){if(p===void 0&&!(g in s))return!1}else{var m=new n;if(u)var d=u(p,v,g,s,o,m);if(!(d===void 0?t(v,p,e|r,u,m):d))return!1}}return!0}return go=i,go}var po,Pd;function Ld(){if(Pd)return po;Pd=1;var n=Re();function t(e){return e===e&&!n(e)}return po=t,po}var vo,Dd;function K_(){if(Dd)return vo;Dd=1;var n=Ld(),t=Xe();function e(r){for(var i=t(r),s=i.length;s--;){var o=i[s],a=r[o];i[s]=[o,a,n(a)]}return i}return vo=e,vo}var mo,zd;function $d(){if(zd)return mo;zd=1;function n(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}return mo=n,mo}var yo,Fd;function X_(){if(Fd)return yo;Fd=1;var n=Y_(),t=K_(),e=$d();function r(i){var s=t(i);return s.length==1&&s[0][2]?e(s[0][0],s[0][1]):function(o){return o===i||n(o,i,s)}}return yo=r,yo}var wo,Bd;function Mt(){if(Bd)return wo;Bd=1;var n=ot(),t=Te(),e="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&n(i)==e}return wo=r,wo}var bo,Ud;function _o(){if(Ud)return bo;Ud=1;var n=oe(),t=Mt(),e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(s,o){if(n(s))return!1;var a=typeof s;return a=="number"||a=="symbol"||a=="boolean"||s==null||t(s)?!0:r.test(s)||!e.test(s)||o!=null&&s in Object(o)}return bo=i,bo}var Eo,Gd;function Z_(){if(Gd)return Eo;Gd=1;var n=xi(),t="Expected a function";function e(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var s=function(){var o=arguments,a=i?i.apply(this,o):o[0],u=s.cache;if(u.has(a))return u.get(a);var c=r.apply(this,o);return s.cache=u.set(a,c)||u,c};return s.cache=new(e.Cache||n),s}return e.Cache=n,Eo=e,Eo}var xo,Vd;function J_(){if(Vd)return xo;Vd=1;var n=Z_(),t=500;function e(r){var i=n(r,function(o){return s.size===t&&s.clear(),o}),s=i.cache;return i}return xo=e,xo}var No,Wd;function Q_(){if(Wd)return No;Wd=1;var n=J_(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,r=n(function(i){var s=[];return i.charCodeAt(0)===46&&s.push(""),i.replace(t,function(o,a,u,c){s.push(u?c.replace(e,"$1"):a||o)}),s});return No=r,No}var Mo,Yd;function kr(){if(Yd)return Mo;Yd=1;function n(t,e){for(var r=-1,i=t==null?0:t.length,s=Array(i);++r<i;)s[r]=e(t[r],r,t);return s}return Mo=n,Mo}var So,Kd;function H_(){if(Kd)return So;Kd=1;var n=Et(),t=kr(),e=oe(),r=Mt(),i=1/0,s=n?n.prototype:void 0,o=s?s.toString:void 0;function a(u){if(typeof u=="string")return u;if(e(u))return t(u,a)+"";if(r(u))return o?o.call(u):"";var c=u+"";return c=="0"&&1/u==-i?"-0":c}return So=a,So}var Ro,Xd;function Zd(){if(Xd)return Ro;Xd=1;var n=H_();function t(e){return e==null?"":n(e)}return Ro=t,Ro}var qo,Jd;function jr(){if(Jd)return qo;Jd=1;var n=oe(),t=_o(),e=Q_(),r=Zd();function i(s,o){return n(s)?s:t(s,o)?[s]:e(r(s))}return qo=i,qo}var Oo,Qd;function Yt(){if(Qd)return Oo;Qd=1;var n=Mt(),t=1/0;function e(r){if(typeof r=="string"||n(r))return r;var i=r+"";return i=="0"&&1/r==-t?"-0":i}return Oo=e,Oo}var Ao,Hd;function Cr(){if(Hd)return Ao;Hd=1;var n=jr(),t=Yt();function e(r,i){i=n(i,r);for(var s=0,o=i.length;r!=null&&s<o;)r=r[t(i[s++])];return s&&s==o?r:void 0}return Ao=e,Ao}var Io,eg;function eE(){if(eg)return Io;eg=1;var n=Cr();function t(e,r,i){var s=e==null?void 0:n(e,r);return s===void 0?i:s}return Io=t,Io}var To,tg;function tE(){if(tg)return To;tg=1;function n(t,e){return t!=null&&e in Object(t)}return To=n,To}var ko,rg;function ng(){if(rg)return ko;rg=1;var n=jr(),t=Bt(),e=oe(),r=qr(),i=$i(),s=Yt();function o(a,u,c){u=n(u,a);for(var f=-1,l=u.length,h=!1;++f<l;){var g=s(u[f]);if(!(h=a!=null&&c(a,g)))break;a=a[g]}return h||++f!=l?h:(l=a==null?0:a.length,!!l&&i(l)&&r(g,l)&&(e(a)||t(a)))}return ko=o,ko}var jo,ig;function sg(){if(ig)return jo;ig=1;var n=tE(),t=ng();function e(r,i){return r!=null&&t(r,i,n)}return jo=e,jo}var Co,og;function rE(){if(og)return Co;og=1;var n=jd(),t=eE(),e=sg(),r=_o(),i=Ld(),s=$d(),o=Yt(),a=1,u=2;function c(f,l){return r(f)&&i(l)?s(o(f),l):function(h){var g=t(h,f);return g===void 0&&g===l?e(h,f):n(l,g,a|u)}}return Co=c,Co}var Po,ag;function ug(){if(ag)return Po;ag=1;function n(t){return function(e){return e==null?void 0:e[t]}}return Po=n,Po}var Lo,cg;function nE(){if(cg)return Lo;cg=1;var n=Cr();function t(e){return function(r){return n(r,e)}}return Lo=t,Lo}var Do,fg;function iE(){if(fg)return Do;fg=1;var n=ug(),t=nE(),e=_o(),r=Yt();function i(s){return e(s)?n(r(s)):t(s)}return Do=i,Do}var zo,lg;function De(){if(lg)return zo;lg=1;var n=X_(),t=rE(),e=ct(),r=oe(),i=iE();function s(o){return typeof o=="function"?o:o==null?e:typeof o=="object"?r(o)?t(o[0],o[1]):n(o):i(o)}return zo=s,zo}var $o,hg;function dg(){if(hg)return $o;hg=1;var n=mh(),t=z_(),e=De(),r=oe();function i(s,o){var a=r(s)?n:t;return a(s,e(o,3))}return $o=i,$o}var Fo,gg;function sE(){if(gg)return Fo;gg=1;var n=Object.prototype,t=n.hasOwnProperty;function e(r,i){return r!=null&&t.call(r,i)}return Fo=e,Fo}var Bo,pg;function vg(){if(pg)return Bo;pg=1;var n=sE(),t=ng();function e(r,i){return r!=null&&t(r,i,n)}return Bo=e,Bo}var Uo,mg;function oE(){if(mg)return Uo;mg=1;var n=Zi(),t=Nt(),e=Bt(),r=oe(),i=Le(),s=xt(),o=Ar(),a=Vt(),u="[object Map]",c="[object Set]",f=Object.prototype,l=f.hasOwnProperty;function h(g){if(g==null)return!0;if(i(g)&&(r(g)||typeof g=="string"||typeof g.splice=="function"||s(g)||a(g)||e(g)))return!g.length;var p=t(g);if(p==u||p==c)return!g.size;if(o(g))return!n(g).length;for(var v in g)if(l.call(g,v))return!1;return!0}return Uo=h,Uo}var Go,yg;function wg(){if(yg)return Go;yg=1;function n(t){return t===void 0}return Go=n,Go}var Vo,bg;function _g(){if(bg)return Vo;bg=1;var n=Tr(),t=Le();function e(r,i){var s=-1,o=t(r)?Array(r.length):[];return n(r,function(a,u,c){o[++s]=i(a,u,c)}),o}return Vo=e,Vo}var Wo,Eg;function xg(){if(Eg)return Wo;Eg=1;var n=kr(),t=De(),e=_g(),r=oe();function i(s,o){var a=r(s)?n:e;return a(s,t(o,3))}return Wo=i,Wo}var Yo,Ng;function aE(){if(Ng)return Yo;Ng=1;function n(t,e,r,i){var s=-1,o=t==null?0:t.length;for(i&&o&&(r=t[++s]);++s<o;)r=e(r,t[s],s,t);return r}return Yo=n,Yo}var Ko,Mg;function uE(){if(Mg)return Ko;Mg=1;function n(t,e,r,i,s){return s(t,function(o,a,u){r=i?(i=!1,o):e(r,o,a,u)}),r}return Ko=n,Ko}var Xo,Sg;function Rg(){if(Sg)return Xo;Sg=1;var n=aE(),t=Tr(),e=De(),r=uE(),i=oe();function s(o,a,u){var c=i(o)?n:r,f=arguments.length<3;return c(o,e(a,4),u,f,t)}return Xo=s,Xo}var Zo,qg;function cE(){if(qg)return Zo;qg=1;var n=ot(),t=oe(),e=Te(),r="[object String]";function i(s){return typeof s=="string"||!t(s)&&e(s)&&n(s)==r}return Zo=i,Zo}var Jo,Og;function fE(){if(Og)return Jo;Og=1;var n=ug(),t=n("length");return Jo=t,Jo}var Qo,Ag;function lE(){if(Ag)return Qo;Ag=1;var n="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+e+r,s="\\ufe0e\\ufe0f",o="\\u200d",a=RegExp("["+o+n+i+s+"]");function u(c){return a.test(c)}return Qo=u,Qo}var Ho,Ig;function hE(){if(Ig)return Ho;Ig=1;var n="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+e+r,s="\\ufe0e\\ufe0f",o="["+n+"]",a="["+i+"]",u="\\ud83c[\\udffb-\\udfff]",c="(?:"+a+"|"+u+")",f="[^"+n+"]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",g="\\u200d",p=c+"?",v="["+s+"]?",m="(?:"+g+"(?:"+[f,l,h].join("|")+")"+v+p+")*",d=v+p+m,y="(?:"+[f+a+"?",a,l,h,o].join("|")+")",w=RegExp(u+"(?="+u+")|"+y+d,"g");function b(x){for(var M=w.lastIndex=0;w.test(x);)++M;return M}return Ho=b,Ho}var ea,Tg;function dE(){if(Tg)return ea;Tg=1;var n=fE(),t=lE(),e=hE();function r(i){return t(i)?e(i):n(i)}return ea=r,ea}var ta,kg;function gE(){if(kg)return ta;kg=1;var n=Zi(),t=Nt(),e=Le(),r=cE(),i=dE(),s="[object Map]",o="[object Set]";function a(u){if(u==null)return 0;if(e(u))return r(u)?i(u):u.length;var c=t(u);return c==s||c==o?u.size:n(u).length}return ta=a,ta}var ra,jg;function pE(){if(jg)return ra;jg=1;var n=Ri(),t=Xh(),e=Ws(),r=De(),i=Ir(),s=oe(),o=xt(),a=$t(),u=Re(),c=Vt();function f(l,h,g){var p=s(l),v=p||o(l)||c(l);if(h=r(h,4),g==null){var m=l&&l.constructor;v?g=p?new m:[]:u(l)?g=a(m)?t(i(l)):{}:g={}}return(v?n:e)(l,function(d,y,w){return h(g,d,y,w)}),g}return ra=f,ra}var na,Cg;function vE(){if(Cg)return na;Cg=1;var n=Et(),t=Bt(),e=oe(),r=n?n.isConcatSpreadable:void 0;function i(s){return e(s)||t(s)||!!(r&&s&&s[r])}return na=i,na}var ia,Pg;function sa(){if(Pg)return ia;Pg=1;var n=ls(),t=vE();function e(r,i,s,o,a){var u=-1,c=r.length;for(s||(s=t),a||(a=[]);++u<c;){var f=r[u];i>0&&s(f)?i>1?e(f,i-1,s,o,a):n(a,f):o||(a[a.length]=f)}return a}return ia=e,ia}var oa,Lg;function mE(){if(Lg)return oa;Lg=1;function n(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}return oa=n,oa}var aa,Dg;function zg(){if(Dg)return aa;Dg=1;var n=mE(),t=Math.max;function e(r,i,s){return i=t(i===void 0?r.length-1:i,0),function(){for(var o=arguments,a=-1,u=t(o.length-i,0),c=Array(u);++a<u;)c[a]=o[i+a];a=-1;for(var f=Array(i+1);++a<i;)f[a]=o[a];return f[i]=s(c),n(r,this,f)}}return aa=e,aa}var ua,$g;function yE(){if($g)return ua;$g=1;var n=Fs(),t=Cl(),e=ct(),r=t?function(i,s){return t(i,"toString",{configurable:!0,enumerable:!1,value:n(s),writable:!0})}:e;return ua=r,ua}var ca,Fg;function wE(){if(Fg)return ca;Fg=1;var n=800,t=16,e=Date.now;function r(i){var s=0,o=0;return function(){var a=e(),u=t-(a-o);if(o=a,u>0){if(++s>=n)return arguments[0]}else s=0;return i.apply(void 0,arguments)}}return ca=r,ca}var fa,Bg;function Ug(){if(Bg)return fa;Bg=1;var n=yE(),t=wE(),e=t(n);return fa=e,fa}var la,Gg;function Pr(){if(Gg)return la;Gg=1;var n=ct(),t=zg(),e=Ug();function r(i,s){return e(t(i,s,n),i+"")}return la=r,la}var ha,Vg;function Wg(){if(Vg)return ha;Vg=1;function n(t,e,r,i){for(var s=t.length,o=r+(i?1:-1);i?o--:++o<s;)if(e(t[o],o,t))return o;return-1}return ha=n,ha}var da,Yg;function bE(){if(Yg)return da;Yg=1;function n(t){return t!==t}return da=n,da}var ga,Kg;function _E(){if(Kg)return ga;Kg=1;function n(t,e,r){for(var i=r-1,s=t.length;++i<s;)if(t[i]===e)return i;return-1}return ga=n,ga}var pa,Xg;function EE(){if(Xg)return pa;Xg=1;var n=Wg(),t=bE(),e=_E();function r(i,s,o){return s===s?e(i,s,o):n(i,t,o)}return pa=r,pa}var va,Zg;function xE(){if(Zg)return va;Zg=1;var n=EE();function t(e,r){var i=e==null?0:e.length;return!!i&&n(e,r,0)>-1}return va=t,va}var ma,Jg;function NE(){if(Jg)return ma;Jg=1;function n(t,e,r){for(var i=-1,s=t==null?0:t.length;++i<s;)if(r(e,t[i]))return!0;return!1}return ma=n,ma}var ya,Qg;function ME(){if(Qg)return ya;Qg=1;function n(){}return ya=n,ya}var wa,Hg;function SE(){if(Hg)return wa;Hg=1;var n=Ch(),t=ME(),e=uo(),r=1/0,i=n&&1/e(new n([,-0]))[1]==r?function(s){return new n(s)}:t;return wa=i,wa}var ba,ep;function RE(){if(ep)return ba;ep=1;var n=Ed(),t=xE(),e=NE(),r=Md(),i=SE(),s=uo(),o=200;function a(u,c,f){var l=-1,h=t,g=u.length,p=!0,v=[],m=v;if(f)p=!1,h=e;else if(g>=o){var d=c?null:i(u);if(d)return s(d);p=!1,h=r,m=new n}else m=c?[]:v;e:for(;++l<g;){var y=u[l],w=c?c(y):y;if(y=f||y!==0?y:0,p&&w===w){for(var b=m.length;b--;)if(m[b]===w)continue e;c&&m.push(w),v.push(y)}else h(m,w,f)||(m!==v&&m.push(w),v.push(y))}return v}return ba=a,ba}var _a,tp;function rp(){if(tp)return _a;tp=1;var n=Le(),t=Te();function e(r){return t(r)&&n(r)}return _a=e,_a}var Ea,np;function qE(){if(np)return Ea;np=1;var n=sa(),t=Pr(),e=RE(),r=rp(),i=t(function(s){return e(n(s,1,r,!0))});return Ea=i,Ea}var xa,ip;function OE(){if(ip)return xa;ip=1;var n=kr();function t(e,r){return n(r,function(i){return e[i]})}return xa=t,xa}var Na,sp;function op(){if(sp)return Na;sp=1;var n=OE(),t=Xe();function e(r){return r==null?[]:n(r,t(r))}return Na=e,Na}var Ma,ap;function qe(){if(ap)return Ma;ap=1;var n;if(typeof kn=="function")try{n={clone:P_(),constant:Fs(),each:md(),filter:dg(),has:vg(),isArray:oe(),isEmpty:oE(),isFunction:$t(),isUndefined:wg(),keys:Xe(),map:xg(),reduce:Rg(),size:gE(),transform:pE(),union:qE(),values:op()}}catch{}return n||(n=window._),Ma=n,Ma}var Sa,up;function Ra(){if(up)return Sa;up=1;var n=qe();Sa=i;var t="\0",e="\0",r="";function i(f){this._isDirected=n.has(f,"directed")?f.directed:!0,this._isMultigraph=n.has(f,"multigraph")?f.multigraph:!1,this._isCompound=n.has(f,"compound")?f.compound:!1,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[e]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(f){return this._label=f,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(f){return n.isFunction(f)||(f=n.constant(f)),this._defaultNodeLabelFn=f,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return n.keys(this._nodes)},i.prototype.sources=function(){var f=this;return n.filter(this.nodes(),function(l){return n.isEmpty(f._in[l])})},i.prototype.sinks=function(){var f=this;return n.filter(this.nodes(),function(l){return n.isEmpty(f._out[l])})},i.prototype.setNodes=function(f,l){var h=arguments,g=this;return n.each(f,function(p){h.length>1?g.setNode(p,l):g.setNode(p)}),this},i.prototype.setNode=function(f,l){return n.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=l),this):(this._nodes[f]=arguments.length>1?l:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=e,this._children[f]={},this._children[e][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},i.prototype.node=function(f){return this._nodes[f]},i.prototype.hasNode=function(f){return n.has(this._nodes,f)},i.prototype.removeNode=function(f){var l=this;if(n.has(this._nodes,f)){var h=function(g){l.removeEdge(l._edgeObjs[g])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],n.each(this.children(f),function(g){l.setParent(g)}),delete this._children[f]),n.each(n.keys(this._in[f]),h),delete this._in[f],delete this._preds[f],n.each(n.keys(this._out[f]),h),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},i.prototype.setParent=function(f,l){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(l))l=e;else{l+="";for(var h=l;!n.isUndefined(h);h=this.parent(h))if(h===f)throw new Error("Setting "+l+" as parent of "+f+" would create a cycle");this.setNode(l)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=l,this._children[l][f]=!0,this},i.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},i.prototype.parent=function(f){if(this._isCompound){var l=this._parent[f];if(l!==e)return l}},i.prototype.children=function(f){if(n.isUndefined(f)&&(f=e),this._isCompound){var l=this._children[f];if(l)return n.keys(l)}else{if(f===e)return this.nodes();if(this.hasNode(f))return[]}},i.prototype.predecessors=function(f){var l=this._preds[f];if(l)return n.keys(l)},i.prototype.successors=function(f){var l=this._sucs[f];if(l)return n.keys(l)},i.prototype.neighbors=function(f){var l=this.predecessors(f);if(l)return n.union(l,this.successors(f))},i.prototype.isLeaf=function(f){var l;return this.isDirected()?l=this.successors(f):l=this.neighbors(f),l.length===0},i.prototype.filterNodes=function(f){var l=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});l.setGraph(this.graph());var h=this;n.each(this._nodes,function(v,m){f(m)&&l.setNode(m,v)}),n.each(this._edgeObjs,function(v){l.hasNode(v.v)&&l.hasNode(v.w)&&l.setEdge(v,h.edge(v))});var g={};function p(v){var m=h.parent(v);return m===void 0||l.hasNode(m)?(g[v]=m,m):m in g?g[m]:p(m)}return this._isCompound&&n.each(l.nodes(),function(v){l.setParent(v,p(v))}),l},i.prototype.setDefaultEdgeLabel=function(f){return n.isFunction(f)||(f=n.constant(f)),this._defaultEdgeLabelFn=f,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return n.values(this._edgeObjs)},i.prototype.setPath=function(f,l){var h=this,g=arguments;return n.reduce(f,function(p,v){return g.length>1?h.setEdge(p,v,l):h.setEdge(p,v),v}),this},i.prototype.setEdge=function(){var f,l,h,g,p=!1,v=arguments[0];typeof v=="object"&&v!==null&&"v"in v?(f=v.v,l=v.w,h=v.name,arguments.length===2&&(g=arguments[1],p=!0)):(f=v,l=arguments[1],h=arguments[3],arguments.length>2&&(g=arguments[2],p=!0)),f=""+f,l=""+l,n.isUndefined(h)||(h=""+h);var m=a(this._isDirected,f,l,h);if(n.has(this._edgeLabels,m))return p&&(this._edgeLabels[m]=g),this;if(!n.isUndefined(h)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(l),this._edgeLabels[m]=p?g:this._defaultEdgeLabelFn(f,l,h);var d=u(this._isDirected,f,l,h);return f=d.v,l=d.w,Object.freeze(d),this._edgeObjs[m]=d,s(this._preds[l],f),s(this._sucs[f],l),this._in[l][m]=d,this._out[f][m]=d,this._edgeCount++,this},i.prototype.edge=function(f,l,h){var g=arguments.length===1?c(this._isDirected,arguments[0]):a(this._isDirected,f,l,h);return this._edgeLabels[g]},i.prototype.hasEdge=function(f,l,h){var g=arguments.length===1?c(this._isDirected,arguments[0]):a(this._isDirected,f,l,h);return n.has(this._edgeLabels,g)},i.prototype.removeEdge=function(f,l,h){var g=arguments.length===1?c(this._isDirected,arguments[0]):a(this._isDirected,f,l,h),p=this._edgeObjs[g];return p&&(f=p.v,l=p.w,delete this._edgeLabels[g],delete this._edgeObjs[g],o(this._preds[l],f),o(this._sucs[f],l),delete this._in[l][g],delete this._out[f][g],this._edgeCount--),this},i.prototype.inEdges=function(f,l){var h=this._in[f];if(h){var g=n.values(h);return l?n.filter(g,function(p){return p.v===l}):g}},i.prototype.outEdges=function(f,l){var h=this._out[f];if(h){var g=n.values(h);return l?n.filter(g,function(p){return p.w===l}):g}},i.prototype.nodeEdges=function(f,l){var h=this.inEdges(f,l);if(h)return h.concat(this.outEdges(f,l))};function s(f,l){f[l]?f[l]++:f[l]=1}function o(f,l){--f[l]||delete f[l]}function a(f,l,h,g){var p=""+l,v=""+h;if(!f&&p>v){var m=p;p=v,v=m}return p+r+v+r+(n.isUndefined(g)?t:g)}function u(f,l,h,g){var p=""+l,v=""+h;if(!f&&p>v){var m=p;p=v,v=m}var d={v:p,w:v};return g&&(d.name=g),d}function c(f,l){return a(f,l.v,l.w,l.name)}return Sa}var qa,cp;function AE(){return cp||(cp=1,qa="2.1.8"),qa}var Oa,fp;function IE(){return fp||(fp=1,Oa={Graph:Ra(),version:AE()}),Oa}var Aa,lp;function TE(){if(lp)return Aa;lp=1;var n=qe(),t=Ra();Aa={write:e,read:s};function e(o){var a={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:r(o),edges:i(o)};return n.isUndefined(o.graph())||(a.value=n.clone(o.graph())),a}function r(o){return n.map(o.nodes(),function(a){var u=o.node(a),c=o.parent(a),f={v:a};return n.isUndefined(u)||(f.value=u),n.isUndefined(c)||(f.parent=c),f})}function i(o){return n.map(o.edges(),function(a){var u=o.edge(a),c={v:a.v,w:a.w};return n.isUndefined(a.name)||(c.name=a.name),n.isUndefined(u)||(c.value=u),c})}function s(o){var a=new t(o.options).setGraph(o.value);return n.each(o.nodes,function(u){a.setNode(u.v,u.value),u.parent&&a.setParent(u.v,u.parent)}),n.each(o.edges,function(u){a.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),a}return Aa}var Ia,hp;function kE(){if(hp)return Ia;hp=1;var n=qe();Ia=t;function t(e){var r={},i=[],s;function o(a){n.has(r,a)||(r[a]=!0,s.push(a),n.each(e.successors(a),o),n.each(e.predecessors(a),o))}return n.each(e.nodes(),function(a){s=[],o(a),s.length&&i.push(s)}),i}return Ia}var Ta,dp;function gp(){if(dp)return Ta;dp=1;var n=qe();Ta=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(e){return e.key})},t.prototype.has=function(e){return n.has(this._keyIndices,e)},t.prototype.priority=function(e){var r=this._keyIndices[e];if(r!==void 0)return this._arr[r].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(e,r){var i=this._keyIndices;if(e=String(e),!n.has(i,e)){var s=this._arr,o=s.length;return i[e]=o,s.push({key:e,priority:r}),this._decrease(o),!0}return!1},t.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},t.prototype.decrease=function(e,r){var i=this._keyIndices[e];if(r>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[i].priority+" New: "+r);this._arr[i].priority=r,this._decrease(i)},t.prototype._heapify=function(e){var r=this._arr,i=2*e,s=i+1,o=e;i<r.length&&(o=r[i].priority<r[o].priority?i:o,s<r.length&&(o=r[s].priority<r[o].priority?s:o),o!==e&&(this._swap(e,o),this._heapify(o)))},t.prototype._decrease=function(e){for(var r=this._arr,i=r[e].priority,s;e!==0&&(s=e>>1,!(r[s].priority<i));)this._swap(e,s),e=s},t.prototype._swap=function(e,r){var i=this._arr,s=this._keyIndices,o=i[e],a=i[r];i[e]=a,i[r]=o,s[a.key]=e,s[o.key]=r},Ta}var ka,pp;function vp(){if(pp)return ka;pp=1;var n=qe(),t=gp();ka=r;var e=n.constant(1);function r(s,o,a,u){return i(s,String(o),a||e,u||function(c){return s.outEdges(c)})}function i(s,o,a,u){var c={},f=new t,l,h,g=function(p){var v=p.v!==l?p.v:p.w,m=c[v],d=a(p),y=h.distance+d;if(d<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+p+" Weight: "+d);y<m.distance&&(m.distance=y,m.predecessor=l,f.decrease(v,y))};for(s.nodes().forEach(function(p){var v=p===o?0:Number.POSITIVE_INFINITY;c[p]={distance:v},f.add(p,v)});f.size()>0&&(l=f.removeMin(),h=c[l],h.distance!==Number.POSITIVE_INFINITY);)u(l).forEach(g);return c}return ka}var ja,mp;function jE(){if(mp)return ja;mp=1;var n=vp(),t=qe();ja=e;function e(r,i,s){return t.transform(r.nodes(),function(o,a){o[a]=n(r,a,i,s)},{})}return ja}var Ca,yp;function wp(){if(yp)return Ca;yp=1;var n=qe();Ca=t;function t(e){var r=0,i=[],s={},o=[];function a(u){var c=s[u]={onStack:!0,lowlink:r,index:r++};if(i.push(u),e.successors(u).forEach(function(h){n.has(s,h)?s[h].onStack&&(c.lowlink=Math.min(c.lowlink,s[h].index)):(a(h),c.lowlink=Math.min(c.lowlink,s[h].lowlink))}),c.lowlink===c.index){var f=[],l;do l=i.pop(),s[l].onStack=!1,f.push(l);while(u!==l);o.push(f)}}return e.nodes().forEach(function(u){n.has(s,u)||a(u)}),o}return Ca}var Pa,bp;function CE(){if(bp)return Pa;bp=1;var n=qe(),t=wp();Pa=e;function e(r){return n.filter(t(r),function(i){return i.length>1||i.length===1&&r.hasEdge(i[0],i[0])})}return Pa}var La,_p;function PE(){if(_p)return La;_p=1;var n=qe();La=e;var t=n.constant(1);function e(i,s,o){return r(i,s||t,o||function(a){return i.outEdges(a)})}function r(i,s,o){var a={},u=i.nodes();return u.forEach(function(c){a[c]={},a[c][c]={distance:0},u.forEach(function(f){c!==f&&(a[c][f]={distance:Number.POSITIVE_INFINITY})}),o(c).forEach(function(f){var l=f.v===c?f.w:f.v,h=s(f);a[c][l]={distance:h,predecessor:c}})}),u.forEach(function(c){var f=a[c];u.forEach(function(l){var h=a[l];u.forEach(function(g){var p=h[c],v=f[g],m=h[g],d=p.distance+v.distance;d<m.distance&&(m.distance=d,m.predecessor=v.predecessor)})})}),a}return La}var Da,Ep;function xp(){if(Ep)return Da;Ep=1;var n=qe();Da=t,t.CycleException=e;function t(r){var i={},s={},o=[];function a(u){if(n.has(s,u))throw new e;n.has(i,u)||(s[u]=!0,i[u]=!0,n.each(r.predecessors(u),a),delete s[u],o.push(u))}if(n.each(r.sinks(),a),n.size(i)!==r.nodeCount())throw new e;return o}function e(){}return e.prototype=new Error,Da}var za,Np;function LE(){if(Np)return za;Np=1;var n=xp();za=t;function t(e){try{n(e)}catch(r){if(r instanceof n.CycleException)return!1;throw r}return!0}return za}var $a,Mp;function Sp(){if(Mp)return $a;Mp=1;var n=qe();$a=t;function t(r,i,s){n.isArray(i)||(i=[i]);var o=(r.isDirected()?r.successors:r.neighbors).bind(r),a=[],u={};return n.each(i,function(c){if(!r.hasNode(c))throw new Error("Graph does not have node: "+c);e(r,c,s==="post",u,o,a)}),a}function e(r,i,s,o,a,u){n.has(o,i)||(o[i]=!0,s||u.push(i),n.each(a(i),function(c){e(r,c,s,o,a,u)}),s&&u.push(i))}return $a}var Fa,Rp;function DE(){if(Rp)return Fa;Rp=1;var n=Sp();Fa=t;function t(e,r){return n(e,r,"post")}return Fa}var Ba,qp;function zE(){if(qp)return Ba;qp=1;var n=Sp();Ba=t;function t(e,r){return n(e,r,"pre")}return Ba}var Ua,Op;function $E(){if(Op)return Ua;Op=1;var n=qe(),t=Ra(),e=gp();Ua=r;function r(i,s){var o=new t,a={},u=new e,c;function f(h){var g=h.v===c?h.w:h.v,p=u.priority(g);if(p!==void 0){var v=s(h);v<p&&(a[g]=c,u.decrease(g,v))}}if(i.nodeCount()===0)return o;n.each(i.nodes(),function(h){u.add(h,Number.POSITIVE_INFINITY),o.setNode(h)}),u.decrease(i.nodes()[0],0);for(var l=!1;u.size()>0;){if(c=u.removeMin(),n.has(a,c))o.setEdge(c,a[c]);else{if(l)throw new Error("Input graph is not connected: "+i);l=!0}i.nodeEdges(c).forEach(f)}return o}return Ua}var Ga,Ap;function FE(){return Ap||(Ap=1,Ga={components:kE(),dijkstra:vp(),dijkstraAll:jE(),findCycles:CE(),floydWarshall:PE(),isAcyclic:LE(),postorder:DE(),preorder:zE(),prim:$E(),tarjan:wp(),topsort:xp()}),Ga}var Va,Ip;function BE(){if(Ip)return Va;Ip=1;var n=IE();return Va={Graph:n.Graph,json:TE(),alg:FE(),version:n.version},Va}var Lr;if(typeof kn=="function")try{Lr=BE()}catch{}Lr||(Lr=window.graphlib);var Ae=Lr,Wa,Tp;function UE(){if(Tp)return Wa;Tp=1;var n=nd(),t=1,e=4;function r(i){return n(i,t|e)}return Wa=r,Wa}var Ya,kp;function Dr(){if(kp)return Ya;kp=1;var n=_t(),t=Le(),e=qr(),r=Re();function i(s,o,a){if(!r(a))return!1;var u=typeof o;return(u=="number"?t(a)&&e(o,a.length):u=="string"&&o in a)?n(a[o],s):!1}return Ya=i,Ya}var Ka,jp;function GE(){if(jp)return Ka;jp=1;var n=Pr(),t=_t(),e=Dr(),r=ut(),i=Object.prototype,s=i.hasOwnProperty,o=n(function(a,u){a=Object(a);var c=-1,f=u.length,l=f>2?u[2]:void 0;for(l&&e(u[0],u[1],l)&&(f=1);++c<f;)for(var h=u[c],g=r(h),p=-1,v=g.length;++p<v;){var m=g[p],d=a[m];(d===void 0||t(d,i[m])&&!s.call(a,m))&&(a[m]=h[m])}return a});return Ka=o,Ka}var Xa,Cp;function VE(){if(Cp)return Xa;Cp=1;var n=De(),t=Le(),e=Xe();function r(i){return function(s,o,a){var u=Object(s);if(!t(s)){var c=n(o,3);s=e(s),o=function(l){return c(u[l],l,u)}}var f=i(s,o,a);return f>-1?u[c?s[f]:f]:void 0}}return Xa=r,Xa}var Za,Pp;function WE(){if(Pp)return Za;Pp=1;var n=/\s/;function t(e){for(var r=e.length;r--&&n.test(e.charAt(r)););return r}return Za=t,Za}var Ja,Lp;function YE(){if(Lp)return Ja;Lp=1;var n=WE(),t=/^\s+/;function e(r){return r&&r.slice(0,n(r)+1).replace(t,"")}return Ja=e,Ja}var Qa,Dp;function KE(){if(Dp)return Qa;Dp=1;var n=YE(),t=Re(),e=Mt(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;function u(c){if(typeof c=="number")return c;if(e(c))return r;if(t(c)){var f=typeof c.valueOf=="function"?c.valueOf():c;c=t(f)?f+"":f}if(typeof c!="string")return c===0?c:+c;c=n(c);var l=s.test(c);return l||o.test(c)?a(c.slice(2),l?2:8):i.test(c)?r:+c}return Qa=u,Qa}var Ha,zp;function $p(){if(zp)return Ha;zp=1;var n=KE(),t=1/0,e=17976931348623157e292;function r(i){if(!i)return i===0?i:0;if(i=n(i),i===t||i===-t){var s=i<0?-1:1;return s*e}return i===i?i:0}return Ha=r,Ha}var eu,Fp;function XE(){if(Fp)return eu;Fp=1;var n=$p();function t(e){var r=n(e),i=r%1;return r===r?i?r-i:r:0}return eu=t,eu}var tu,Bp;function ZE(){if(Bp)return tu;Bp=1;var n=Wg(),t=De(),e=XE(),r=Math.max;function i(s,o,a){var u=s==null?0:s.length;if(!u)return-1;var c=a==null?0:e(a);return c<0&&(c=r(u+c,0)),n(s,t(o,3),c)}return tu=i,tu}var ru,Up;function JE(){if(Up)return ru;Up=1;var n=VE(),t=ZE(),e=n(t);return ru=e,ru}var nu,Gp;function Vp(){if(Gp)return nu;Gp=1;var n=sa();function t(e){var r=e==null?0:e.length;return r?n(e,1):[]}return nu=t,nu}var iu,Wp;function QE(){if(Wp)return iu;Wp=1;var n=Gs(),t=dd(),e=ut();function r(i,s){return i==null?i:n(i,t(s),e)}return iu=r,iu}var su,Yp;function HE(){if(Yp)return su;Yp=1;function n(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}return su=n,su}var ou,Kp;function ex(){if(Kp)return ou;Kp=1;var n=Sr(),t=Ws(),e=De();function r(i,s){var o={};return s=e(s,3),t(i,function(a,u,c){n(o,u,s(a,u,c))}),o}return ou=r,ou}var au,Xp;function uu(){if(Xp)return au;Xp=1;var n=Mt();function t(e,r,i){for(var s=-1,o=e.length;++s<o;){var a=e[s],u=r(a);if(u!=null&&(c===void 0?u===u&&!n(u):i(u,c)))var c=u,f=a}return f}return au=t,au}var cu,Zp;function tx(){if(Zp)return cu;Zp=1;function n(t,e){return t>e}return cu=n,cu}var fu,Jp;function rx(){if(Jp)return fu;Jp=1;var n=uu(),t=tx(),e=ct();function r(i){return i&&i.length?n(i,e,t):void 0}return fu=r,fu}var lu,Qp;function Hp(){if(Qp)return lu;Qp=1;var n=Sr(),t=_t();function e(r,i,s){(s!==void 0&&!t(r[i],s)||s===void 0&&!(i in r))&&n(r,i,s)}return lu=e,lu}var hu,ev;function nx(){if(ev)return hu;ev=1;var n=ot(),t=Ir(),e=Te(),r="[object Object]",i=Function.prototype,s=Object.prototype,o=i.toString,a=s.hasOwnProperty,u=o.call(Object);function c(f){if(!e(f)||n(f)!=r)return!1;var l=t(f);if(l===null)return!0;var h=a.call(l,"constructor")&&l.constructor;return typeof h=="function"&&h instanceof h&&o.call(h)==u}return hu=c,hu}var du,tv;function rv(){if(tv)return du;tv=1;function n(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}return du=n,du}var gu,nv;function ix(){if(nv)return gu;nv=1;var n=Ft(),t=ut();function e(r){return n(r,t(r))}return gu=e,gu}var pu,iv;function sx(){if(iv)return pu;iv=1;var n=Hp(),t=dh(),e=Wh(),r=ph(),i=Jh(),s=Bt(),o=oe(),a=rp(),u=xt(),c=$t(),f=Re(),l=nx(),h=Vt(),g=rv(),p=ix();function v(m,d,y,w,b,x,M){var N=g(m,y),E=g(d,y),O=M.get(E);if(O){n(m,y,O);return}var _=x?x(N,E,y+"",m,d,M):void 0,S=_===void 0;if(S){var q=o(E),R=!q&&u(E),T=!q&&!R&&h(E);_=E,q||R||T?o(N)?_=N:a(N)?_=r(N):R?(S=!1,_=t(E,!0)):T?(S=!1,_=e(E,!0)):_=[]:l(E)||s(E)?(_=N,s(N)?_=p(N):(!f(N)||c(N))&&(_=i(E))):S=!1}S&&(M.set(E,_),b(_,E,w,x,M),M.delete(E)),n(m,y,_)}return pu=v,pu}var vu,sv;function ox(){if(sv)return vu;sv=1;var n=Mr(),t=Hp(),e=Gs(),r=sx(),i=Re(),s=ut(),o=rv();function a(u,c,f,l,h){u!==c&&e(c,function(g,p){if(h||(h=new n),i(g))r(u,c,p,f,a,l,h);else{var v=l?l(o(u,p),g,p+"",u,c,h):void 0;v===void 0&&(v=g),t(u,p,v)}},s)}return vu=a,vu}var mu,ov;function ax(){if(ov)return mu;ov=1;var n=Pr(),t=Dr();function e(r){return n(function(i,s){var o=-1,a=s.length,u=a>1?s[a-1]:void 0,c=a>2?s[2]:void 0;for(u=r.length>3&&typeof u=="function"?(a--,u):void 0,c&&t(s[0],s[1],c)&&(u=a<3?void 0:u,a=1),i=Object(i);++o<a;){var f=s[o];f&&r(i,f,o,u)}return i})}return mu=e,mu}var yu,av;function ux(){if(av)return yu;av=1;var n=ox(),t=ax(),e=t(function(r,i,s){n(r,i,s)});return yu=e,yu}var wu,uv;function cv(){if(uv)return wu;uv=1;function n(t,e){return t<e}return wu=n,wu}var bu,fv;function cx(){if(fv)return bu;fv=1;var n=uu(),t=cv(),e=ct();function r(i){return i&&i.length?n(i,e,t):void 0}return bu=r,bu}var _u,lv;function fx(){if(lv)return _u;lv=1;var n=uu(),t=De(),e=cv();function r(i,s){return i&&i.length?n(i,t(s,2),e):void 0}return _u=r,_u}var Eu,hv;function lx(){if(hv)return Eu;hv=1;var n=Oe(),t=function(){return n.Date.now()};return Eu=t,Eu}var xu,dv;function hx(){if(dv)return xu;dv=1;var n=Rr(),t=jr(),e=qr(),r=Re(),i=Yt();function s(o,a,u,c){if(!r(o))return o;a=t(a,o);for(var f=-1,l=a.length,h=l-1,g=o;g!=null&&++f<l;){var p=i(a[f]),v=u;if(p==="__proto__"||p==="constructor"||p==="prototype")return o;if(f!=h){var m=g[p];v=c?c(m,p,g):void 0,v===void 0&&(v=r(m)?m:e(a[f+1])?[]:{})}n(g,p,v),g=g[p]}return o}return xu=s,xu}var Nu,gv;function dx(){if(gv)return Nu;gv=1;var n=Cr(),t=hx(),e=jr();function r(i,s,o){for(var a=-1,u=s.length,c={};++a<u;){var f=s[a],l=n(i,f);o(l,f)&&t(c,e(f,i),l)}return c}return Nu=r,Nu}var Mu,pv;function gx(){if(pv)return Mu;pv=1;var n=dx(),t=sg();function e(r,i){return n(r,i,function(s,o){return t(r,o)})}return Mu=e,Mu}var Su,vv;function px(){if(vv)return Su;vv=1;var n=Vp(),t=zg(),e=Ug();function r(i){return e(t(i,void 0,n),i+"")}return Su=r,Su}var Ru,mv;function vx(){if(mv)return Ru;mv=1;var n=gx(),t=px(),e=t(function(r,i){return r==null?{}:n(r,i)});return Ru=e,Ru}var qu,yv;function mx(){if(yv)return qu;yv=1;var n=Math.ceil,t=Math.max;function e(r,i,s,o){for(var a=-1,u=t(n((i-r)/(s||1)),0),c=Array(u);u--;)c[o?u:++a]=r,r+=s;return c}return qu=e,qu}var Ou,wv;function yx(){if(wv)return Ou;wv=1;var n=mx(),t=Dr(),e=$p();function r(i){return function(s,o,a){return a&&typeof a!="number"&&t(s,o,a)&&(o=a=void 0),s=e(s),o===void 0?(o=s,s=0):o=e(o),a=a===void 0?s<o?1:-1:e(a),n(s,o,a,i)}}return Ou=r,Ou}var Au,bv;function wx(){if(bv)return Au;bv=1;var n=yx(),t=n();return Au=t,Au}var Iu,_v;function bx(){if(_v)return Iu;_v=1;function n(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}return Iu=n,Iu}var Tu,Ev;function _x(){if(Ev)return Tu;Ev=1;var n=Mt();function t(e,r){if(e!==r){var i=e!==void 0,s=e===null,o=e===e,a=n(e),u=r!==void 0,c=r===null,f=r===r,l=n(r);if(!c&&!l&&!a&&e>r||a&&u&&f&&!c&&!l||s&&u&&f||!i&&f||!o)return 1;if(!s&&!a&&!l&&e<r||l&&i&&o&&!s&&!a||c&&i&&o||!u&&o||!f)return-1}return 0}return Tu=t,Tu}var ku,xv;function Ex(){if(xv)return ku;xv=1;var n=_x();function t(e,r,i){for(var s=-1,o=e.criteria,a=r.criteria,u=o.length,c=i.length;++s<u;){var f=n(o[s],a[s]);if(f){if(s>=c)return f;var l=i[s];return f*(l=="desc"?-1:1)}}return e.index-r.index}return ku=t,ku}var ju,Nv;function xx(){if(Nv)return ju;Nv=1;var n=kr(),t=Cr(),e=De(),r=_g(),i=bx(),s=Or(),o=Ex(),a=ct(),u=oe();function c(f,l,h){l.length?l=n(l,function(v){return u(v)?function(m){return t(m,v.length===1?v[0]:v)}:v}):l=[a];var g=-1;l=n(l,s(e));var p=r(f,function(v,m,d){var y=n(l,function(w){return w(v)});return{criteria:y,index:++g,value:v}});return i(p,function(v,m){return o(v,m,h)})}return ju=c,ju}var Cu,Mv;function Nx(){if(Mv)return Cu;Mv=1;var n=sa(),t=xx(),e=Pr(),r=Dr(),i=e(function(s,o){if(s==null)return[];var a=o.length;return a>1&&r(s,o[0],o[1])?o=[]:a>2&&r(o[0],o[1],o[2])&&(o=[o[0]]),t(s,n(o,1),[])});return Cu=i,Cu}var Pu,Sv;function Mx(){if(Sv)return Pu;Sv=1;var n=Zd(),t=0;function e(r){var i=++t;return n(r)+i}return Pu=e,Pu}var Lu,Rv;function Sx(){if(Rv)return Lu;Rv=1;function n(t,e,r){for(var i=-1,s=t.length,o=e.length,a={};++i<s;){var u=i<o?e[i]:void 0;r(a,t[i],u)}return a}return Lu=n,Lu}var Du,qv;function Rx(){if(qv)return Du;qv=1;var n=Rr(),t=Sx();function e(r,i){return t(r||[],i||[],n)}return Du=e,Du}var zr;if(typeof kn=="function")try{zr={cloneDeep:UE(),constant:Fs(),defaults:GE(),each:md(),filter:dg(),find:JE(),flatten:Vp(),forEach:pd(),forIn:QE(),has:vg(),isUndefined:wg(),last:HE(),map:xg(),mapValues:ex(),max:rx(),merge:ux(),min:cx(),minBy:fx(),now:lx(),pick:vx(),range:wx(),reduce:Rg(),sortBy:Nx(),uniqueId:Mx(),values:op(),zipObject:Rx()}}catch{}zr||(zr=window._);var re=zr,qx=$r;function $r(){var n={};n._next=n._prev=n,this._sentinel=n}$r.prototype.dequeue=function(){var n=this._sentinel,t=n._prev;if(t!==n)return Ov(t),t},$r.prototype.enqueue=function(n){var t=this._sentinel;n._prev&&n._next&&Ov(n),n._next=t._next,t._next._prev=n,t._next=n,n._prev=t},$r.prototype.toString=function(){for(var n=[],t=this._sentinel,e=t._prev;e!==t;)n.push(JSON.stringify(e,Ox)),e=e._prev;return"["+n.join(", ")+"]"};function Ov(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function Ox(n,t){if(n!=="_next"&&n!=="_prev")return t}var ze=re,Ax=Ae.Graph,Ix=qx,Tx=jx,kx=ze.constant(1);function jx(n,t){if(n.nodeCount()<=1)return[];var e=Px(n,t||kx),r=Cx(e.graph,e.buckets,e.zeroIdx);return ze.flatten(ze.map(r,function(i){return n.outEdges(i.v,i.w)}),!0)}function Cx(n,t,e){for(var r=[],i=t[t.length-1],s=t[0],o;n.nodeCount();){for(;o=s.dequeue();)zu(n,t,e,o);for(;o=i.dequeue();)zu(n,t,e,o);if(n.nodeCount()){for(var a=t.length-2;a>0;--a)if(o=t[a].dequeue(),o){r=r.concat(zu(n,t,e,o,!0));break}}}return r}function zu(n,t,e,r,i){var s=i?[]:void 0;return ze.forEach(n.inEdges(r.v),function(o){var a=n.edge(o),u=n.node(o.v);i&&s.push({v:o.v,w:o.w}),u.out-=a,$u(t,e,u)}),ze.forEach(n.outEdges(r.v),function(o){var a=n.edge(o),u=o.w,c=n.node(u);c.in-=a,$u(t,e,c)}),n.removeNode(r.v),s}function Px(n,t){var e=new Ax,r=0,i=0;ze.forEach(n.nodes(),function(a){e.setNode(a,{v:a,in:0,out:0})}),ze.forEach(n.edges(),function(a){var u=e.edge(a.v,a.w)||0,c=t(a),f=u+c;e.setEdge(a.v,a.w,f),i=Math.max(i,e.node(a.v).out+=c),r=Math.max(r,e.node(a.w).in+=c)});var s=ze.range(i+r+3).map(function(){return new Ix}),o=r+1;return ze.forEach(e.nodes(),function(a){$u(s,o,e.node(a))}),{graph:e,buckets:s,zeroIdx:o}}function $u(n,t,e){e.out?e.in?n[e.out-e.in+t].enqueue(e):n[n.length-1].enqueue(e):n[0].enqueue(e)}var ft=re,Lx=Tx,Dx={run:zx,undo:Fx};function zx(n){var t=n.graph().acyclicer==="greedy"?Lx(n,e(n)):$x(n);ft.forEach(t,function(r){var i=n.edge(r);n.removeEdge(r),i.forwardName=r.name,i.reversed=!0,n.setEdge(r.w,r.v,i,ft.uniqueId("rev"))});function e(r){return function(i){return r.edge(i).weight}}}function $x(n){var t=[],e={},r={};function i(s){ft.has(r,s)||(r[s]=!0,e[s]=!0,ft.forEach(n.outEdges(s),function(o){ft.has(e,o.w)?t.push(o):i(o.w)}),delete e[s])}return ft.forEach(n.nodes(),i),t}function Fx(n){ft.forEach(n.edges(),function(t){var e=n.edge(t);if(e.reversed){n.removeEdge(t);var r=e.forwardName;delete e.reversed,delete e.forwardName,n.setEdge(t.w,t.v,e,r)}})}var J=re,Av=Ae.Graph,me={addDummyNode:Iv,simplify:Bx,asNonCompoundGraph:Ux,successorWeights:Gx,predecessorWeights:Vx,intersectRect:Wx,buildLayerMatrix:Yx,normalizeRanks:Kx,removeEmptyRanks:Xx,addBorderNode:Zx,maxRank:Tv,partition:Jx,time:Qx,notime:Hx};function Iv(n,t,e,r){var i;do i=J.uniqueId(r);while(n.hasNode(i));return e.dummy=t,n.setNode(i,e),i}function Bx(n){var t=new Av().setGraph(n.graph());return J.forEach(n.nodes(),function(e){t.setNode(e,n.node(e))}),J.forEach(n.edges(),function(e){var r=t.edge(e.v,e.w)||{weight:0,minlen:1},i=n.edge(e);t.setEdge(e.v,e.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function Ux(n){var t=new Av({multigraph:n.isMultigraph()}).setGraph(n.graph());return J.forEach(n.nodes(),function(e){n.children(e).length||t.setNode(e,n.node(e))}),J.forEach(n.edges(),function(e){t.setEdge(e,n.edge(e))}),t}function Gx(n){var t=J.map(n.nodes(),function(e){var r={};return J.forEach(n.outEdges(e),function(i){r[i.w]=(r[i.w]||0)+n.edge(i).weight}),r});return J.zipObject(n.nodes(),t)}function Vx(n){var t=J.map(n.nodes(),function(e){var r={};return J.forEach(n.inEdges(e),function(i){r[i.v]=(r[i.v]||0)+n.edge(i).weight}),r});return J.zipObject(n.nodes(),t)}function Wx(n,t){var e=n.x,r=n.y,i=t.x-e,s=t.y-r,o=n.width/2,a=n.height/2;if(!i&&!s)throw new Error("Not possible to find intersection inside of the rectangle");var u,c;return Math.abs(s)*o>Math.abs(i)*a?(s<0&&(a=-a),u=a*i/s,c=a):(i<0&&(o=-o),u=o,c=o*s/i),{x:e+u,y:r+c}}function Yx(n){var t=J.map(J.range(Tv(n)+1),function(){return[]});return J.forEach(n.nodes(),function(e){var r=n.node(e),i=r.rank;J.isUndefined(i)||(t[i][r.order]=e)}),t}function Kx(n){var t=J.min(J.map(n.nodes(),function(e){return n.node(e).rank}));J.forEach(n.nodes(),function(e){var r=n.node(e);J.has(r,"rank")&&(r.rank-=t)})}function Xx(n){var t=J.min(J.map(n.nodes(),function(s){return n.node(s).rank})),e=[];J.forEach(n.nodes(),function(s){var o=n.node(s).rank-t;e[o]||(e[o]=[]),e[o].push(s)});var r=0,i=n.graph().nodeRankFactor;J.forEach(e,function(s,o){J.isUndefined(s)&&o%i!==0?--r:r&&J.forEach(s,function(a){n.node(a).rank+=r})})}function Zx(n,t,e,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=e,i.order=r),Iv(n,"border",i,t)}function Tv(n){return J.max(J.map(n.nodes(),function(t){var e=n.node(t).rank;if(!J.isUndefined(e))return e}))}function Jx(n,t){var e={lhs:[],rhs:[]};return J.forEach(n,function(r){t(r)?e.lhs.push(r):e.rhs.push(r)}),e}function Qx(n,t){var e=J.now();try{return t()}finally{console.log(n+" time: "+(J.now()-e)+"ms")}}function Hx(n,t){return t()}var kv=re,eN=me,tN={run:rN,undo:iN};function rN(n){n.graph().dummyChains=[],kv.forEach(n.edges(),function(t){nN(n,t)})}function nN(n,t){var e=t.v,r=n.node(e).rank,i=t.w,s=n.node(i).rank,o=t.name,a=n.edge(t),u=a.labelRank;if(s!==r+1){n.removeEdge(t);var c,f,l;for(l=0,++r;r<s;++l,++r)a.points=[],f={width:0,height:0,edgeLabel:a,edgeObj:t,rank:r},c=eN.addDummyNode(n,"edge",f,"_d"),r===u&&(f.width=a.width,f.height=a.height,f.dummy="edge-label",f.labelpos=a.labelpos),n.setEdge(e,c,{weight:a.weight},o),l===0&&n.graph().dummyChains.push(c),e=c;n.setEdge(e,i,{weight:a.weight},o)}}function iN(n){kv.forEach(n.graph().dummyChains,function(t){var e=n.node(t),r=e.edgeLabel,i;for(n.setEdge(e.edgeObj,r);e.dummy;)i=n.successors(t)[0],n.removeNode(t),r.points.push({x:e.x,y:e.y}),e.dummy==="edge-label"&&(r.x=e.x,r.y=e.y,r.width=e.width,r.height=e.height),t=i,e=n.node(t)})}var Fr=re,Br={longestPath:sN,slack:oN};function sN(n){var t={};function e(r){var i=n.node(r);if(Fr.has(t,r))return i.rank;t[r]=!0;var s=Fr.min(Fr.map(n.outEdges(r),function(o){return e(o.w)-n.edge(o).minlen}));return(s===Number.POSITIVE_INFINITY||s===void 0||s===null)&&(s=0),i.rank=s}Fr.forEach(n.sources(),e)}function oN(n,t){return n.node(t.w).rank-n.node(t.v).rank-n.edge(t).minlen}var Ur=re,aN=Ae.Graph,Gr=Br.slack,jv=uN;function uN(n){var t=new aN({directed:!1}),e=n.nodes()[0],r=n.nodeCount();t.setNode(e,{});for(var i,s;cN(t,n)<r;)i=fN(t,n),s=t.hasNode(i.v)?Gr(n,i):-Gr(n,i),lN(t,n,s);return t}function cN(n,t){function e(r){Ur.forEach(t.nodeEdges(r),function(i){var s=i.v,o=r===s?i.w:s;!n.hasNode(o)&&!Gr(t,i)&&(n.setNode(o,{}),n.setEdge(r,o,{}),e(o))})}return Ur.forEach(n.nodes(),e),n.nodeCount()}function fN(n,t){return Ur.minBy(t.edges(),function(e){if(n.hasNode(e.v)!==n.hasNode(e.w))return Gr(t,e)})}function lN(n,t,e){Ur.forEach(n.nodes(),function(r){t.node(r).rank+=e})}var $e=re,hN=jv,dN=Br.slack,gN=Br.longestPath,pN=Ae.alg.preorder,vN=Ae.alg.postorder,mN=me.simplify,yN=lt;lt.initLowLimValues=Bu,lt.initCutValues=Fu,lt.calcCutValue=Cv,lt.leaveEdge=Lv,lt.enterEdge=Dv,lt.exchangeEdges=zv;function lt(n){n=mN(n),gN(n);var t=hN(n);Bu(t),Fu(t,n);for(var e,r;e=Lv(t);)r=Dv(t,n,e),zv(t,n,e,r)}function Fu(n,t){var e=vN(n,n.nodes());e=e.slice(0,e.length-1),$e.forEach(e,function(r){wN(n,t,r)})}function wN(n,t,e){var r=n.node(e),i=r.parent;n.edge(e,i).cutvalue=Cv(n,t,e)}function Cv(n,t,e){var r=n.node(e),i=r.parent,s=!0,o=t.edge(e,i),a=0;return o||(s=!1,o=t.edge(i,e)),a=o.weight,$e.forEach(t.nodeEdges(e),function(u){var c=u.v===e,f=c?u.w:u.v;if(f!==i){var l=c===s,h=t.edge(u).weight;if(a+=l?h:-h,_N(n,e,f)){var g=n.edge(e,f).cutvalue;a+=l?-g:g}}}),a}function Bu(n,t){arguments.length<2&&(t=n.nodes()[0]),Pv(n,{},1,t)}function Pv(n,t,e,r,i){var s=e,o=n.node(r);return t[r]=!0,$e.forEach(n.neighbors(r),function(a){$e.has(t,a)||(e=Pv(n,t,e,a,r))}),o.low=s,o.lim=e++,i?o.parent=i:delete o.parent,e}function Lv(n){return $e.find(n.edges(),function(t){return n.edge(t).cutvalue<0})}function Dv(n,t,e){var r=e.v,i=e.w;t.hasEdge(r,i)||(r=e.w,i=e.v);var s=n.node(r),o=n.node(i),a=s,u=!1;s.lim>o.lim&&(a=o,u=!0);var c=$e.filter(t.edges(),function(f){return u===$v(n,n.node(f.v),a)&&u!==$v(n,n.node(f.w),a)});return $e.minBy(c,function(f){return dN(t,f)})}function zv(n,t,e,r){var i=e.v,s=e.w;n.removeEdge(i,s),n.setEdge(r.v,r.w,{}),Bu(n),Fu(n,t),bN(n,t)}function bN(n,t){var e=$e.find(n.nodes(),function(i){return!t.node(i).parent}),r=pN(n,e);r=r.slice(1),$e.forEach(r,function(i){var s=n.node(i).parent,o=t.edge(i,s),a=!1;o||(o=t.edge(s,i),a=!0),t.node(i).rank=t.node(s).rank+(a?o.minlen:-o.minlen)})}function _N(n,t,e){return n.hasEdge(t,e)}function $v(n,t,e){return e.low<=t.lim&&t.lim<=e.lim}var EN=Br,Fv=EN.longestPath,xN=jv,NN=yN,MN=SN;function SN(n){switch(n.graph().ranker){case"network-simplex":Bv(n);break;case"tight-tree":qN(n);break;case"longest-path":RN(n);break;default:Bv(n)}}var RN=Fv;function qN(n){Fv(n),xN(n)}function Bv(n){NN(n)}var Uu=re,ON=AN;function AN(n){var t=TN(n);Uu.forEach(n.graph().dummyChains,function(e){for(var r=n.node(e),i=r.edgeObj,s=IN(n,t,i.v,i.w),o=s.path,a=s.lca,u=0,c=o[u],f=!0;e!==i.w;){if(r=n.node(e),f){for(;(c=o[u])!==a&&n.node(c).maxRank<r.rank;)u++;c===a&&(f=!1)}if(!f){for(;u<o.length-1&&n.node(c=o[u+1]).minRank<=r.rank;)u++;c=o[u]}n.setParent(e,c),e=n.successors(e)[0]}})}function IN(n,t,e,r){var i=[],s=[],o=Math.min(t[e].low,t[r].low),a=Math.max(t[e].lim,t[r].lim),u,c;u=e;do u=n.parent(u),i.push(u);while(u&&(t[u].low>o||a>t[u].lim));for(c=u,u=r;(u=n.parent(u))!==c;)s.push(u);return{path:i.concat(s.reverse()),lca:c}}function TN(n){var t={},e=0;function r(i){var s=e;Uu.forEach(n.children(i),r),t[i]={low:s,lim:e++}}return Uu.forEach(n.children(),r),t}var Fe=re,Gu=me,kN={run:jN,cleanup:LN};function jN(n){var t=Gu.addDummyNode(n,"root",{},"_root"),e=CN(n),r=Fe.max(Fe.values(e))-1,i=2*r+1;n.graph().nestingRoot=t,Fe.forEach(n.edges(),function(o){n.edge(o).minlen*=i});var s=PN(n)+1;Fe.forEach(n.children(),function(o){Uv(n,t,i,s,r,e,o)}),n.graph().nodeRankFactor=i}function Uv(n,t,e,r,i,s,o){var a=n.children(o);if(!a.length){o!==t&&n.setEdge(t,o,{weight:0,minlen:e});return}var u=Gu.addBorderNode(n,"_bt"),c=Gu.addBorderNode(n,"_bb"),f=n.node(o);n.setParent(u,o),f.borderTop=u,n.setParent(c,o),f.borderBottom=c,Fe.forEach(a,function(l){Uv(n,t,e,r,i,s,l);var h=n.node(l),g=h.borderTop?h.borderTop:l,p=h.borderBottom?h.borderBottom:l,v=h.borderTop?r:2*r,m=g!==p?1:i-s[o]+1;n.setEdge(u,g,{weight:v,minlen:m,nestingEdge:!0}),n.setEdge(p,c,{weight:v,minlen:m,nestingEdge:!0})}),n.parent(o)||n.setEdge(t,u,{weight:0,minlen:i+s[o]})}function CN(n){var t={};function e(r,i){var s=n.children(r);s&&s.length&&Fe.forEach(s,function(o){e(o,i+1)}),t[r]=i}return Fe.forEach(n.children(),function(r){e(r,1)}),t}function PN(n){return Fe.reduce(n.edges(),function(t,e){return t+n.edge(e).weight},0)}function LN(n){var t=n.graph();n.removeNode(t.nestingRoot),delete t.nestingRoot,Fe.forEach(n.edges(),function(e){var r=n.edge(e);r.nestingEdge&&n.removeEdge(e)})}var Vu=re,DN=me,zN=$N;function $N(n){function t(e){var r=n.children(e),i=n.node(e);if(r.length&&Vu.forEach(r,t),Vu.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var s=i.minRank,o=i.maxRank+1;s<o;++s)Gv(n,"borderLeft","_bl",e,i,s),Gv(n,"borderRight","_br",e,i,s)}}Vu.forEach(n.children(),t)}function Gv(n,t,e,r,i,s){var o={width:0,height:0,rank:s,borderType:t},a=i[t][s-1],u=DN.addDummyNode(n,"border",o,e);i[t][s]=u,n.setParent(u,r),a&&n.setEdge(a,u,{weight:1})}var ke=re,FN={adjust:BN,undo:UN};function BN(n){var t=n.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&Vv(n)}function UN(n){var t=n.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&GN(n),(t==="lr"||t==="rl")&&(VN(n),Vv(n))}function Vv(n){ke.forEach(n.nodes(),function(t){Wv(n.node(t))}),ke.forEach(n.edges(),function(t){Wv(n.edge(t))})}function Wv(n){var t=n.width;n.width=n.height,n.height=t}function GN(n){ke.forEach(n.nodes(),function(t){Wu(n.node(t))}),ke.forEach(n.edges(),function(t){var e=n.edge(t);ke.forEach(e.points,Wu),ke.has(e,"y")&&Wu(e)})}function Wu(n){n.y=-n.y}function VN(n){ke.forEach(n.nodes(),function(t){Yu(n.node(t))}),ke.forEach(n.edges(),function(t){var e=n.edge(t);ke.forEach(e.points,Yu),ke.has(e,"x")&&Yu(e)})}function Yu(n){var t=n.x;n.x=n.y,n.y=t}var Be=re,WN=YN;function YN(n){var t={},e=Be.filter(n.nodes(),function(a){return!n.children(a).length}),r=Be.max(Be.map(e,function(a){return n.node(a).rank})),i=Be.map(Be.range(r+1),function(){return[]});function s(a){if(!Be.has(t,a)){t[a]=!0;var u=n.node(a);i[u.rank].push(a),Be.forEach(n.successors(a),s)}}var o=Be.sortBy(e,function(a){return n.node(a).rank});return Be.forEach(o,s),i}var Ze=re,KN=XN;function XN(n,t){for(var e=0,r=1;r<t.length;++r)e+=ZN(n,t[r-1],t[r]);return e}function ZN(n,t,e){for(var r=Ze.zipObject(e,Ze.map(e,function(c,f){return f})),i=Ze.flatten(Ze.map(t,function(c){return Ze.sortBy(Ze.map(n.outEdges(c),function(f){return{pos:r[f.w],weight:n.edge(f).weight}}),"pos")}),!0),s=1;s<e.length;)s<<=1;var o=2*s-1;s-=1;var a=Ze.map(new Array(o),function(){return 0}),u=0;return Ze.forEach(i.forEach(function(c){var f=c.pos+s;a[f]+=c.weight;for(var l=0;f>0;)f%2&&(l+=a[f+1]),f=f-1>>1,a[f]+=c.weight;u+=c.weight*l})),u}var Yv=re,JN=QN;function QN(n,t){return Yv.map(t,function(e){var r=n.inEdges(e);if(r.length){var i=Yv.reduce(r,function(s,o){var a=n.edge(o),u=n.node(o.v);return{sum:s.sum+a.weight*u.order,weight:s.weight+a.weight}},{sum:0,weight:0});return{v:e,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:e}})}var _e=re,HN=eM;function eM(n,t){var e={};_e.forEach(n,function(i,s){var o=e[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:s};_e.isUndefined(i.barycenter)||(o.barycenter=i.barycenter,o.weight=i.weight)}),_e.forEach(t.edges(),function(i){var s=e[i.v],o=e[i.w];!_e.isUndefined(s)&&!_e.isUndefined(o)&&(o.indegree++,s.out.push(e[i.w]))});var r=_e.filter(e,function(i){return!i.indegree});return tM(r)}function tM(n){var t=[];function e(s){return function(o){o.merged||(_e.isUndefined(o.barycenter)||_e.isUndefined(s.barycenter)||o.barycenter>=s.barycenter)&&rM(s,o)}}function r(s){return function(o){o.in.push(s),--o.indegree===0&&n.push(o)}}for(;n.length;){var i=n.pop();t.push(i),_e.forEach(i.in.reverse(),e(i)),_e.forEach(i.out,r(i))}return _e.map(_e.filter(t,function(s){return!s.merged}),function(s){return _e.pick(s,["vs","i","barycenter","weight"])})}function rM(n,t){var e=0,r=0;n.weight&&(e+=n.barycenter*n.weight,r+=n.weight),t.weight&&(e+=t.barycenter*t.weight,r+=t.weight),n.vs=t.vs.concat(n.vs),n.barycenter=e/r,n.weight=r,n.i=Math.min(t.i,n.i),t.merged=!0}var Kt=re,nM=me,iM=sM;function sM(n,t){var e=nM.partition(n,function(f){return Kt.has(f,"barycenter")}),r=e.lhs,i=Kt.sortBy(e.rhs,function(f){return-f.i}),s=[],o=0,a=0,u=0;r.sort(oM(!!t)),u=Kv(s,i,u),Kt.forEach(r,function(f){u+=f.vs.length,s.push(f.vs),o+=f.barycenter*f.weight,a+=f.weight,u=Kv(s,i,u)});var c={vs:Kt.flatten(s,!0)};return a&&(c.barycenter=o/a,c.weight=a),c}function Kv(n,t,e){for(var r;t.length&&(r=Kt.last(t)).i<=e;)t.pop(),n.push(r.vs),e++;return e}function oM(n){return function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:n?e.i-t.i:t.i-e.i}}var Je=re,aM=JN,uM=HN,cM=iM,fM=Xv;function Xv(n,t,e,r){var i=n.children(t),s=n.node(t),o=s?s.borderLeft:void 0,a=s?s.borderRight:void 0,u={};o&&(i=Je.filter(i,function(p){return p!==o&&p!==a}));var c=aM(n,i);Je.forEach(c,function(p){if(n.children(p.v).length){var v=Xv(n,p.v,e,r);u[p.v]=v,Je.has(v,"barycenter")&&hM(p,v)}});var f=uM(c,e);lM(f,u);var l=cM(f,r);if(o&&(l.vs=Je.flatten([o,l.vs,a],!0),n.predecessors(o).length)){var h=n.node(n.predecessors(o)[0]),g=n.node(n.predecessors(a)[0]);Je.has(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+g.order)/(l.weight+2),l.weight+=2}return l}function lM(n,t){Je.forEach(n,function(e){e.vs=Je.flatten(e.vs.map(function(r){return t[r]?t[r].vs:r}),!0)})}function hM(n,t){Je.isUndefined(n.barycenter)?(n.barycenter=t.barycenter,n.weight=t.weight):(n.barycenter=(n.barycenter*n.weight+t.barycenter*t.weight)/(n.weight+t.weight),n.weight+=t.weight)}var Xt=re,dM=Ae.Graph,gM=pM;function pM(n,t,e){var r=vM(n),i=new dM({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(s){return n.node(s)});return Xt.forEach(n.nodes(),function(s){var o=n.node(s),a=n.parent(s);(o.rank===t||o.minRank<=t&&t<=o.maxRank)&&(i.setNode(s),i.setParent(s,a||r),Xt.forEach(n[e](s),function(u){var c=u.v===s?u.w:u.v,f=i.edge(c,s),l=Xt.isUndefined(f)?0:f.weight;i.setEdge(c,s,{weight:n.edge(u).weight+l})}),Xt.has(o,"minRank")&&i.setNode(s,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function vM(n){for(var t;n.hasNode(t=Xt.uniqueId("_root")););return t}var mM=re,yM=wM;function wM(n,t,e){var r={},i;mM.forEach(e,function(s){for(var o=n.parent(s),a,u;o;){if(a=n.parent(o),a?(u=r[a],r[a]=o):(u=i,i=o),u&&u!==o){t.setEdge(u,o);return}o=a}})}var Qe=re,bM=WN,_M=KN,EM=fM,xM=gM,NM=yM,MM=Ae.Graph,Zv=me,SM=RM;function RM(n){var t=Zv.maxRank(n),e=Jv(n,Qe.range(1,t+1),"inEdges"),r=Jv(n,Qe.range(t-1,-1,-1),"outEdges"),i=bM(n);Qv(n,i);for(var s=Number.POSITIVE_INFINITY,o,a=0,u=0;u<4;++a,++u){qM(a%2?e:r,a%4>=2),i=Zv.buildLayerMatrix(n);var c=_M(n,i);c<s&&(u=0,o=Qe.cloneDeep(i),s=c)}Qv(n,o)}function Jv(n,t,e){return Qe.map(t,function(r){return xM(n,r,e)})}function qM(n,t){var e=new MM;Qe.forEach(n,function(r){var i=r.graph().root,s=EM(r,i,e,t);Qe.forEach(s.vs,function(o,a){r.node(o).order=a}),NM(r,e,s.vs)})}function Qv(n,t){Qe.forEach(t,function(e){Qe.forEach(e,function(r,i){n.node(r).order=i})})}var W=re,OM=Ae.Graph,AM=me,IM={positionX:jM,findType1Conflicts:Hv,findType2Conflicts:e0,addConflict:Ku,hasConflict:t0,verticalAlignment:r0,horizontalCompaction:n0,alignCoordinates:s0,findSmallestWidthAlignment:i0,balance:o0};function Hv(n,t){var e={};function r(i,s){var o=0,a=0,u=i.length,c=W.last(s);return W.forEach(s,function(f,l){var h=TM(n,f),g=h?n.node(h).order:u;(h||f===c)&&(W.forEach(s.slice(a,l+1),function(p){W.forEach(n.predecessors(p),function(v){var m=n.node(v),d=m.order;(d<o||g<d)&&!(m.dummy&&n.node(p).dummy)&&Ku(e,v,p)})}),a=l+1,o=g)}),s}return W.reduce(t,r),e}function e0(n,t){var e={};function r(s,o,a,u,c){var f;W.forEach(W.range(o,a),function(l){f=s[l],n.node(f).dummy&&W.forEach(n.predecessors(f),function(h){var g=n.node(h);g.dummy&&(g.order<u||g.order>c)&&Ku(e,h,f)})})}function i(s,o){var a=-1,u,c=0;return W.forEach(o,function(f,l){if(n.node(f).dummy==="border"){var h=n.predecessors(f);h.length&&(u=n.node(h[0]).order,r(o,c,l,a,u),c=l,a=u)}r(o,c,o.length,u,s.length)}),o}return W.reduce(t,i),e}function TM(n,t){if(n.node(t).dummy)return W.find(n.predecessors(t),function(e){return n.node(e).dummy})}function Ku(n,t,e){if(t>e){var r=t;t=e,e=r}var i=n[t];i||(n[t]=i={}),i[e]=!0}function t0(n,t,e){if(t>e){var r=t;t=e,e=r}return W.has(n[t],e)}function r0(n,t,e,r){var i={},s={},o={};return W.forEach(t,function(a){W.forEach(a,function(u,c){i[u]=u,s[u]=u,o[u]=c})}),W.forEach(t,function(a){var u=-1;W.forEach(a,function(c){var f=r(c);if(f.length){f=W.sortBy(f,function(v){return o[v]});for(var l=(f.length-1)/2,h=Math.floor(l),g=Math.ceil(l);h<=g;++h){var p=f[h];s[c]===c&&u<o[p]&&!t0(e,c,p)&&(s[p]=c,s[c]=i[c]=i[p],u=o[p])}}})}),{root:i,align:s}}function n0(n,t,e,r,i){var s={},o=kM(n,t,e,i),a=i?"borderLeft":"borderRight";function u(l,h){for(var g=o.nodes(),p=g.pop(),v={};p;)v[p]?l(p):(v[p]=!0,g.push(p),g=g.concat(h(p))),p=g.pop()}function c(l){s[l]=o.inEdges(l).reduce(function(h,g){return Math.max(h,s[g.v]+o.edge(g))},0)}function f(l){var h=o.outEdges(l).reduce(function(p,v){return Math.min(p,s[v.w]-o.edge(v))},Number.POSITIVE_INFINITY),g=n.node(l);h!==Number.POSITIVE_INFINITY&&g.borderType!==a&&(s[l]=Math.max(s[l],h))}return u(c,o.predecessors.bind(o)),u(f,o.successors.bind(o)),W.forEach(r,function(l){s[l]=s[e[l]]}),s}function kM(n,t,e,r){var i=new OM,s=n.graph(),o=CM(s.nodesep,s.edgesep,r);return W.forEach(t,function(a){var u;W.forEach(a,function(c){var f=e[c];if(i.setNode(f),u){var l=e[u],h=i.edge(l,f);i.setEdge(l,f,Math.max(o(n,c,u),h||0))}u=c})}),i}function i0(n,t){return W.minBy(W.values(t),function(e){var r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return W.forIn(e,function(s,o){var a=PM(n,o)/2;r=Math.max(s+a,r),i=Math.min(s-a,i)}),r-i})}function s0(n,t){var e=W.values(t),r=W.min(e),i=W.max(e);W.forEach(["u","d"],function(s){W.forEach(["l","r"],function(o){var a=s+o,u=n[a],c;if(u!==t){var f=W.values(u);c=o==="l"?r-W.min(f):i-W.max(f),c&&(n[a]=W.mapValues(u,function(l){return l+c}))}})})}function o0(n,t){return W.mapValues(n.ul,function(e,r){if(t)return n[t.toLowerCase()][r];var i=W.sortBy(W.map(n,r));return(i[1]+i[2])/2})}function jM(n){var t=AM.buildLayerMatrix(n),e=W.merge(Hv(n,t),e0(n,t)),r={},i;W.forEach(["u","d"],function(o){i=o==="u"?t:W.values(t).reverse(),W.forEach(["l","r"],function(a){a==="r"&&(i=W.map(i,function(l){return W.values(l).reverse()}));var u=(o==="u"?n.predecessors:n.successors).bind(n),c=r0(n,i,e,u),f=n0(n,i,c.root,c.align,a==="r");a==="r"&&(f=W.mapValues(f,function(l){return-l})),r[o+a]=f})});var s=i0(n,r);return s0(r,s),o0(r,n.graph().align)}function CM(n,t,e){return function(r,i,s){var o=r.node(i),a=r.node(s),u=0,c;if(u+=o.width/2,W.has(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":c=-o.width/2;break;case"r":c=o.width/2;break}if(c&&(u+=e?c:-c),c=0,u+=(o.dummy?t:n)/2,u+=(a.dummy?t:n)/2,u+=a.width/2,W.has(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":c=a.width/2;break;case"r":c=-a.width/2;break}return c&&(u+=e?c:-c),c=0,u}}function PM(n,t){return n.node(t).width}var Zt=re,a0=me,LM=IM.positionX,DM=zM;function zM(n){n=a0.asNonCompoundGraph(n),$M(n),Zt.forEach(LM(n),function(t,e){n.node(e).x=t})}function $M(n){var t=a0.buildLayerMatrix(n),e=n.graph().ranksep,r=0;Zt.forEach(t,function(i){var s=Zt.max(Zt.map(i,function(o){return n.node(o).height}));Zt.forEach(i,function(o){n.node(o).y=r+s/2}),r+=s+e})}var K=re,u0=Dx,c0=tN,FM=MN,BM=me.normalizeRanks,UM=ON,GM=me.removeEmptyRanks,f0=kN,VM=zN,l0=FN,WM=SM,YM=DM,He=me,KM=Ae.Graph,XM=ZM;function ZM(n,t){var e=t&&t.debugTiming?He.time:He.notime;e("layout",function(){var r=e(" buildLayoutGraph",function(){return aS(n)});e(" runLayout",function(){JM(r,e)}),e(" updateInputGraph",function(){QM(n,r)})})}function JM(n,t){t(" makeSpaceForEdgeLabels",function(){uS(n)}),t(" removeSelfEdges",function(){mS(n)}),t(" acyclic",function(){u0.run(n)}),t(" nestingGraph.run",function(){f0.run(n)}),t(" rank",function(){FM(He.asNonCompoundGraph(n))}),t(" injectEdgeLabelProxies",function(){cS(n)}),t(" removeEmptyRanks",function(){GM(n)}),t(" nestingGraph.cleanup",function(){f0.cleanup(n)}),t(" normalizeRanks",function(){BM(n)}),t(" assignRankMinMax",function(){fS(n)}),t(" removeEdgeLabelProxies",function(){lS(n)}),t(" normalize.run",function(){c0.run(n)}),t(" parentDummyChains",function(){UM(n)}),t(" addBorderSegments",function(){VM(n)}),t(" order",function(){WM(n)}),t(" insertSelfEdges",function(){yS(n)}),t(" adjustCoordinateSystem",function(){l0.adjust(n)}),t(" position",function(){YM(n)}),t(" positionSelfEdges",function(){wS(n)}),t(" removeBorderNodes",function(){vS(n)}),t(" normalize.undo",function(){c0.undo(n)}),t(" fixupEdgeLabelCoords",function(){gS(n)}),t(" undoCoordinateSystem",function(){l0.undo(n)}),t(" translateGraph",function(){hS(n)}),t(" assignNodeIntersects",function(){dS(n)}),t(" reversePoints",function(){pS(n)}),t(" acyclic.undo",function(){u0.undo(n)})}function QM(n,t){K.forEach(n.nodes(),function(e){var r=n.node(e),i=t.node(e);r&&(r.x=i.x,r.y=i.y,t.children(e).length&&(r.width=i.width,r.height=i.height))}),K.forEach(n.edges(),function(e){var r=n.edge(e),i=t.edge(e);r.points=i.points,K.has(i,"x")&&(r.x=i.x,r.y=i.y)}),n.graph().width=t.graph().width,n.graph().height=t.graph().height}var HM=["nodesep","edgesep","ranksep","marginx","marginy"],eS={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},tS=["acyclicer","ranker","rankdir","align"],rS=["width","height"],nS={width:0,height:0},iS=["minlen","weight","width","height","labeloffset"],sS={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},oS=["labelpos"];function aS(n){var t=new KM({multigraph:!0,compound:!0}),e=Zu(n.graph());return t.setGraph(K.merge({},eS,Xu(e,HM),K.pick(e,tS))),K.forEach(n.nodes(),function(r){var i=Zu(n.node(r));t.setNode(r,K.defaults(Xu(i,rS),nS)),t.setParent(r,n.parent(r))}),K.forEach(n.edges(),function(r){var i=Zu(n.edge(r));t.setEdge(r,K.merge({},sS,Xu(i,iS),K.pick(i,oS)))}),t}function uS(n){var t=n.graph();t.ranksep/=2,K.forEach(n.edges(),function(e){var r=n.edge(e);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function cS(n){K.forEach(n.edges(),function(t){var e=n.edge(t);if(e.width&&e.height){var r=n.node(t.v),i=n.node(t.w),s={rank:(i.rank-r.rank)/2+r.rank,e:t};He.addDummyNode(n,"edge-proxy",s,"_ep")}})}function fS(n){var t=0;K.forEach(n.nodes(),function(e){var r=n.node(e);r.borderTop&&(r.minRank=n.node(r.borderTop).rank,r.maxRank=n.node(r.borderBottom).rank,t=K.max(t,r.maxRank))}),n.graph().maxRank=t}function lS(n){K.forEach(n.nodes(),function(t){var e=n.node(t);e.dummy==="edge-proxy"&&(n.edge(e.e).labelRank=e.rank,n.removeNode(t))})}function hS(n){var t=Number.POSITIVE_INFINITY,e=0,r=Number.POSITIVE_INFINITY,i=0,s=n.graph(),o=s.marginx||0,a=s.marginy||0;function u(c){var f=c.x,l=c.y,h=c.width,g=c.height;t=Math.min(t,f-h/2),e=Math.max(e,f+h/2),r=Math.min(r,l-g/2),i=Math.max(i,l+g/2)}K.forEach(n.nodes(),function(c){u(n.node(c))}),K.forEach(n.edges(),function(c){var f=n.edge(c);K.has(f,"x")&&u(f)}),t-=o,r-=a,K.forEach(n.nodes(),function(c){var f=n.node(c);f.x-=t,f.y-=r}),K.forEach(n.edges(),function(c){var f=n.edge(c);K.forEach(f.points,function(l){l.x-=t,l.y-=r}),K.has(f,"x")&&(f.x-=t),K.has(f,"y")&&(f.y-=r)}),s.width=e-t+o,s.height=i-r+a}function dS(n){K.forEach(n.edges(),function(t){var e=n.edge(t),r=n.node(t.v),i=n.node(t.w),s,o;e.points?(s=e.points[0],o=e.points[e.points.length-1]):(e.points=[],s=i,o=r),e.points.unshift(He.intersectRect(r,s)),e.points.push(He.intersectRect(i,o))})}function gS(n){K.forEach(n.edges(),function(t){var e=n.edge(t);if(K.has(e,"x"))switch((e.labelpos==="l"||e.labelpos==="r")&&(e.width-=e.labeloffset),e.labelpos){case"l":e.x-=e.width/2+e.labeloffset;break;case"r":e.x+=e.width/2+e.labeloffset;break}})}function pS(n){K.forEach(n.edges(),function(t){var e=n.edge(t);e.reversed&&e.points.reverse()})}function vS(n){K.forEach(n.nodes(),function(t){if(n.children(t).length){var e=n.node(t),r=n.node(e.borderTop),i=n.node(e.borderBottom),s=n.node(K.last(e.borderLeft)),o=n.node(K.last(e.borderRight));e.width=Math.abs(o.x-s.x),e.height=Math.abs(i.y-r.y),e.x=s.x+e.width/2,e.y=r.y+e.height/2}}),K.forEach(n.nodes(),function(t){n.node(t).dummy==="border"&&n.removeNode(t)})}function mS(n){K.forEach(n.edges(),function(t){if(t.v===t.w){var e=n.node(t.v);e.selfEdges||(e.selfEdges=[]),e.selfEdges.push({e:t,label:n.edge(t)}),n.removeEdge(t)}})}function yS(n){var t=He.buildLayerMatrix(n);K.forEach(t,function(e){var r=0;K.forEach(e,function(i,s){var o=n.node(i);o.order=s+r,K.forEach(o.selfEdges,function(a){He.addDummyNode(n,"selfedge",{width:a.label.width,height:a.label.height,rank:o.rank,order:s+ ++r,e:a.e,label:a.label},"_se")}),delete o.selfEdges})})}function wS(n){K.forEach(n.nodes(),function(t){var e=n.node(t);if(e.dummy==="selfedge"){var r=n.node(e.e.v),i=r.x+r.width/2,s=r.y,o=e.x-i,a=r.height/2;n.setEdge(e.e,e.label),n.removeNode(t),e.label.points=[{x:i+2*o/3,y:s-a},{x:i+5*o/6,y:s-a},{x:i+o,y:s},{x:i+5*o/6,y:s+a},{x:i+2*o/3,y:s+a}],e.label.x=e.x,e.label.y=e.y}})}function Xu(n,t){return K.mapValues(K.pick(n,t),Number)}function Zu(n){var t={};return K.forEach(n,function(e,r){t[r.toLowerCase()]=e}),t}var Vr=re,bS=me,_S=Ae.Graph,ES={debugOrdering:xS};function xS(n){var t=bS.buildLayerMatrix(n),e=new _S({compound:!0,multigraph:!0}).setGraph({});return Vr.forEach(n.nodes(),function(r){e.setNode(r,{label:r}),e.setParent(r,"layer"+n.node(r).rank)}),Vr.forEach(n.edges(),function(r){e.setEdge(r.v,r.w,{},r.name)}),Vr.forEach(t,function(r,i){var s="layer"+i;e.setNode(s,{rank:"same"}),Vr.reduce(r,function(o,a){return e.setEdge(o,a,{style:"invis"}),a})}),e}var NS="0.8.5",h0={graphlib:Ae,layout:XM,debug:ES,util:{time:me.time,notime:me.notime},version:NS},MS=Ow(h0);function SS(n){if(!n)return[0,0,0];if(U(n))return[n,n,n];if(n.length===0)return[0,0,0];const[t,e=t,r=t]=n;return[t,e,r]}class Wr{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,Wr.defaultOptions,t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),e))})}genericDagreLayout(t,e,r){return $(this,void 0,void 0,function*(){const{nodeSize:i}=r,s=new h0.graphlib.Graph;s.setGraph(r),s.setDefaultEdgeLabel(()=>({}));const o=e.getAllNodes(),a=e.getAllEdges();[...o,...a].some(({id:c})=>U(c))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach(c=>{const{id:f}=c,l=Object.assign({},c.data);if(i!==void 0){const[h,g]=SS(xe(i)?i(c):i);Object.assign(l,{width:h,height:g})}s.setNode(f.toString(),l)}),e.getAllEdges().forEach(({id:c,source:f,target:l})=>{s.setEdge(f.toString(),l.toString(),{id:c})}),MS.layout(s);const u={nodes:[],edges:[]};return s.nodes().forEach(c=>{const f=s.node(c);u.nodes.push({id:c,data:f}),t&&e.mergeNodeData(c,f)}),s.edges().forEach(c=>{const f=s.edge(c),{id:l}=f,h=ne(f,["id"]),{v:g,w:p}=c;u.edges.push({id:l,source:g,target:p,data:h}),t&&e.mergeEdgeData(l,h)}),u})}}Wr.defaultOptions={};class Ju{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,r=t.ry-this.ry;let i=Math.hypot(e,r);i=i<1e-4?1e-4:i;const s=this.g*(this.degree+1)*(t.degree+1)/i;this.fx+=s*e/i,this.fy+=s*r/i}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,r=(this.rx*this.mass+t.rx*t.mass)/e,i=(this.ry*this.mass+t.ry*t.mass)/e,s=this.degree+t.degree,o={rx:r,ry:i,mass:e,degree:s};return new Ju(o)}}class St{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,r=this.length/2,i={xmid:t,ymid:e,length:r};return new St(i)}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2,i={xmid:t,ymid:e,length:r};return new St(i)}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2,i={xmid:t,ymid:e,length:r};return new St(i)}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2,i={xmid:t,ymid:e,length:r};return new St(i)}}class Rt{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,t!=null&&(this.quad=t)}insert(t){if(this.body==null){this.body=t;return}this._isExternal()?(this.quad&&(this.NW=new Rt(this.quad.NW()),this.NE=new Rt(this.quad.NE()),this.SW=new Rt(this.quad.SW()),this.SE=new Rt(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t))}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null}updateForce(t){if(!(this.body==null||t===this.body))if(this._isExternal())t.addForce(this.body);else{const e=this.quad?this.quad.getLength():0,r=this.body.distanceTo(t);e/r<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t))}}}const RS={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};class qS{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},RS),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericForceAtlas2Layout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericForceAtlas2Layout(!0,t,e)})}genericForceAtlas2Layout(t,e,r){return $(this,void 0,void 0,function*(){const i=e.getAllEdges(),s=e.getAllNodes(),o=this.formatOptions(r,s.length),{width:a,height:u,prune:c,maxIteration:f,nodeSize:l,center:h}=o;if(!(s!=null&&s.length)||s.length===1)return nt(e,t,h);const g=s.map(d=>we(d,[a,u])),p=i.filter(d=>{const{source:y,target:w}=d;return y!==w}),v=new ue({nodes:g,edges:p}),m=this.getSizes(v,e,l);if(this.run(v,e,f,m,t,o),c){for(let y=0;y<p.length;y+=1){const{source:w,target:b}=p[y],x=v.getDegree(w),M=v.getDegree(w);if(x<=1){const N=v.getNode(b);v.mergeNodeData(w,{x:N.data.x,y:N.data.y})}else if(M<=1){const N=v.getNode(w);v.mergeNodeData(b,{x:N.data.x,y:N.data.y})}}const d=Object.assign(Object.assign({},o),{prune:!1,barnesHut:!1});this.run(v,e,100,m,t,d)}return{nodes:g,edges:i}})}getSizes(t,e,r){const i=t.getAllNodes(),s={};for(let o=0;o<i.length;o+=1){const{id:a,data:u}=i[o];if(s[a]=10,U(u.size))s[a]=u.size;else if(he(u.size))isNaN(u.size[0])||(s[a]=Math.max(u.size[0])),isNaN(u.size[1])||(s[a]=Math.max(u.size[1]));else if(Ge(u.size))s[a]=Math.max(u.size.width,u.size.height);else if(xe(r)){const c=e.getNode(a),f=r(c);he(f)?s[a]=Math.max(...f):s[a]=f}else he(r)?s[a]=Math.max(...r):U(r)&&(s[a]=r)}return s}formatOptions(t={},e){const r=Object.assign(Object.assign({},this.options),t),{center:i,width:s,height:o,barnesHut:a,prune:u,maxIteration:c,kr:f,kg:l}=r;return r.width=!s&&typeof window<"u"?window.innerWidth:s,r.height=!o&&typeof window<"u"?window.innerHeight:o,r.center=i||[r.width/2,r.height/2],a===void 0&&e>250&&(r.barnesHut=!0),u===void 0&&e>100&&(r.prune=!0),c===0&&!u?(r.maxIteration=250,e<=200&&e>100?r.maxIteration=1e3:e>200&&(r.maxIteration=1200)):c===0&&u&&(r.maxIteration=100,e<=200&&e>100?r.maxIteration=500:e>200&&(r.maxIteration=950)),f||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),l||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r}run(t,e,r,i,s,o){const{kr:a,barnesHut:u,onTick:c}=o,f=t.getAllNodes();let l=0,h=r;const g={},p={},v={};for(let m=0;m<f.length;m+=1){const{data:d,id:y}=f[m];if(g[y]=[0,0],u){const w={id:m,rx:d.x,ry:d.y,mass:1,g:a,degree:t.getDegree(y)};v[y]=new Ju(w)}}for(;h>0;)l=this.oneStep(t,{iter:h,preventOverlapIters:50,krPrime:100,sg:l,forces:g,preForces:p,bodies:v,sizes:i},o),h--,c==null||c({nodes:f,edges:e.getAllEdges()});return t}oneStep(t,e,r){const{iter:i,preventOverlapIters:s,krPrime:o,sg:a,preForces:u,bodies:c,sizes:f}=e;let{forces:l}=e;const{preventOverlap:h,barnesHut:g}=r,p=t.getAllNodes();for(let v=0;v<p.length;v+=1){const{id:m}=p[v];u[m]=[...l[m]],l[m]=[0,0]}return l=this.getAttrForces(t,i,s,f,l,r),g&&(h&&i>s||!h)?l=this.getOptRepGraForces(t,l,c,r):l=this.getRepGraForces(t,i,s,l,o,f,r),this.updatePos(t,l,u,a,r)}getAttrForces(t,e,r,i,s,o){const{preventOverlap:a,dissuadeHubs:u,mode:c,prune:f}=o,l=t.getAllEdges();for(let h=0;h<l.length;h+=1){const{source:g,target:p}=l[h],v=t.getNode(g),m=t.getNode(p),d=t.getDegree(g),y=t.getDegree(p);if(f&&(d<=1||y<=1))continue;const w=[m.data.x-v.data.x,m.data.y-v.data.y];let b=Math.hypot(w[0],w[1]);b=b<1e-4?1e-4:b,w[0]=w[0]/b,w[1]=w[1]/b,a&&e<r&&(b=b-i[g]-i[p]);let x=b,M=x;c==="linlog"&&(x=Math.log(1+b),M=x),u&&(x=b/d,M=b/y),a&&e<r&&b<=0?(x=0,M=0):a&&e<r&&b>0&&(x=b,M=b),s[g][0]+=x*w[0],s[p][0]-=M*w[0],s[g][1]+=x*w[1],s[p][1]-=M*w[1]}return s}getOptRepGraForces(t,e,r,i){const{kg:s,center:o,prune:a}=i,u=t.getAllNodes(),c=u.length;let f=9e10,l=-9e10,h=9e10,g=-9e10;for(let y=0;y<c;y+=1){const{id:w,data:b}=u[y];a&&t.getDegree(w)<=1||(r[w].setPos(b.x,b.y),b.x>=l&&(l=b.x),b.x<=f&&(f=b.x),b.y>=g&&(g=b.y),b.y<=h&&(h=b.y))}const p=Math.max(l-f,g-h),v={xmid:(l+f)/2,ymid:(g+h)/2,length:p,massCenter:o,mass:c},m=new St(v),d=new Rt(m);for(let y=0;y<c;y+=1){const{id:w}=u[y];a&&t.getDegree(w)<=1||r[w].in(m)&&d.insert(r[w])}for(let y=0;y<c;y+=1){const{id:w,data:b}=u[y],x=t.getDegree(w);if(a&&x<=1)continue;r[w].resetForce(),d.updateForce(r[w]),e[w][0]-=r[w].fx,e[w][1]-=r[w].fy;const M=[b.x-o[0],b.y-o[1]];let N=Math.hypot(M[0],M[1]);N=N<1e-4?1e-4:N,M[0]=M[0]/N,M[1]=M[1]/N;const E=s*(x+1);e[w][0]-=E*M[0],e[w][1]-=E*M[1]}return e}getRepGraForces(t,e,r,i,s,o,a){const{preventOverlap:u,kr:c,kg:f,center:l,prune:h}=a,g=t.getAllNodes(),p=g.length;for(let v=0;v<p;v+=1){const m=g[v],d=t.getDegree(m.id);for(let x=v+1;x<p;x+=1){const M=g[x],N=t.getDegree(M.id);if(h&&(d<=1||N<=1))continue;const E=[M.data.x-m.data.x,M.data.y-m.data.y];let O=Math.hypot(E[0],E[1]);O=O<1e-4?1e-4:O,E[0]=E[0]/O,E[1]=E[1]/O,u&&e<r&&(O=O-o[m.id]-o[M.id]);let _=c*(d+1)*(N+1)/O;u&&e<r&&O<0?_=s*(d+1)*(N+1):u&&e<r&&O===0?_=0:u&&e<r&&O>0&&(_=c*(d+1)*(N+1)/O),i[m.id][0]-=_*E[0],i[M.id][0]+=_*E[0],i[m.id][1]-=_*E[1],i[M.id][1]+=_*E[1]}const y=[m.data.x-l[0],m.data.y-l[1]],w=Math.hypot(y[0],y[1]);y[0]=y[0]/w,y[1]=y[1]/w;const b=f*(d+1);i[m.id][0]-=b*y[0],i[m.id][1]-=b*y[1]}return i}updatePos(t,e,r,i,s){const{ks:o,tao:a,prune:u,ksmax:c}=s,f=t.getAllNodes(),l=f.length,h=[],g=[];let p=0,v=0,m=i;for(let y=0;y<l;y+=1){const{id:w}=f[y],b=t.getDegree(w);if(u&&b<=1)continue;const x=[e[w][0]-r[w][0],e[w][1]-r[w][1]],M=Math.hypot(x[0],x[1]),N=[e[w][0]+r[w][0],e[w][1]+r[w][1]],E=Math.hypot(N[0],N[1]);h[y]=M,g[y]=E/2,p+=(b+1)*h[y],v+=(b+1)*g[y]}const d=m;m=a*v/p,d!==0&&(m=m>1.5*d?1.5*d:m);for(let y=0;y<l;y+=1){const{id:w,data:b}=f[y],x=t.getDegree(w);if(u&&x<=1||U(b.fx)&&U(b.fy))continue;let M=o*m/(1+m*Math.sqrt(h[y])),N=Math.hypot(e[w][0],e[w][1]);N=N<1e-4?1e-4:N;const E=c/N;M=M>E?E:M;const O=M*e[w][0],_=M*e[w][1];t.mergeNodeData(w,{x:b.x+O,y:b.y+_})}return m}}const OS={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},AS=800;class IS{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},OS),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericFruchtermanLayout(!0,t,e)})}stop(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let r=0;r<t;r++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach(r=>this.lastGraph.mergeNodeData(r.id,{x:r.data.x,y:r.data.y,z:this.options.dimensions===3?r.data.z:void 0})),e}genericFruchtermanLayout(t,e,r){return $(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(r),{dimensions:s,width:o,height:a,center:u,clustering:c,nodeClusterBy:f,maxIteration:l,onTick:h}=i,g=e.getAllNodes(),p=e.getAllEdges();if(!(g!=null&&g.length)){const w={nodes:[],edges:p};return this.lastResult=w,w}if(g.length===1){t&&e.mergeNodeData(g[0].id,{x:u[0],y:u[1],z:s===3?u[2]:void 0});const w={nodes:[Object.assign(Object.assign({},g[0]),{data:Object.assign(Object.assign({},g[0].data),{x:u[0],y:u[1],z:s===3?u[2]:void 0})})],edges:p};return this.lastResult=w,w}const v=g.map(w=>we(w,[o,a])),m=new ue({nodes:v,edges:p}),d={};if(c&&v.forEach(w=>{const b=w.data[f];d[b]||(d[b]={name:b,cx:0,cy:0,count:0})}),this.lastLayoutNodes=v,this.lastLayoutEdges=p,this.lastAssign=t,this.lastGraph=m,this.lastOptions=i,this.lastClusterMap=d,typeof window>"u")return;let y=0;return new Promise(w=>{this.timeInterval=window.setInterval(()=>{if(!this.running){w({nodes:v,edges:p});return}this.runOneStep(m,d,i),t&&v.forEach(({id:b,data:x})=>e.mergeNodeData(b,{x:x.x,y:x.y,z:s===3?x.z:void 0})),h==null||h({nodes:v,edges:p}),y++,y>=l&&(window.clearInterval(this.timeInterval),w({nodes:v,edges:p}))},0),this.running=!0})})}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:r,nodeClusterBy:i}=e,{center:s,width:o,height:a}=e;return e.width=!o&&typeof window<"u"?window.innerWidth:o,e.height=!a&&typeof window<"u"?window.innerHeight:a,e.center=s||[e.width/2,e.height/2],e.clustering=r&&!!i,e}runOneStep(t,e,r){const{dimensions:i,height:s,width:o,gravity:a,center:u,speed:c,clustering:f,nodeClusterBy:l,clusterGravity:h}=r,g=s*o,p=Math.sqrt(g)/10,v=t.getAllNodes(),m=g/(v.length+1),d=Math.sqrt(m),y={};if(this.applyCalculate(t,y,d,m),f){for(const b in e)e[b].cx=0,e[b].cy=0,e[b].count=0;v.forEach(b=>{const{data:x}=b,M=e[x[l]];U(x.x)&&(M.cx+=x.x),U(x.y)&&(M.cy+=x.y),M.count++});for(const b in e)e[b].cx/=e[b].count,e[b].cy/=e[b].count;const w=h||a;v.forEach((b,x)=>{const{id:M,data:N}=b;if(!U(N.x)||!U(N.y))return;const E=e[N[l]],O=Math.sqrt((N.x-E.cx)*(N.x-E.cx)+(N.y-E.cy)*(N.y-E.cy)),_=d*w;y[M].x-=_*(N.x-E.cx)/O,y[M].y-=_*(N.y-E.cy)/O})}v.forEach((w,b)=>{const{id:x,data:M}=w;if(!U(M.x)||!U(M.y))return;const N=.01*d*a;y[x].x-=N*(M.x-u[0]),y[x].y-=N*(M.y-u[1]),i===3&&(y[x].z-=N*(M.z-u[2]))}),v.forEach((w,b)=>{const{id:x,data:M}=w;if(U(M.fx)&&U(M.fy)){M.x=M.fx,M.y=M.fy,i===3&&(M.z=M.fz);return}if(!U(M.x)||!U(M.y))return;const N=Math.sqrt(y[x].x*y[x].x+y[x].y*y[x].y+(i===3?y[x].z*y[x].z:0));if(N>0){const E=Math.min(p*(c/AS),N);t.mergeNodeData(x,{x:M.x+y[x].x/N*E,y:M.y+y[x].y/N*E,z:i===3?M.z+y[x].z/N*E:void 0})}})}applyCalculate(t,e,r,i){this.calRepulsive(t,e,i),this.calAttractive(t,e,r)}calRepulsive(t,e,r){const i=t.getAllNodes();i.forEach(({data:s,id:o},a)=>{e[o]={x:0,y:0,z:0},i.forEach(({data:u,id:c},f)=>{if(a<=f||!U(s.x)||!U(u.x)||!U(s.y)||!U(u.y))return;let l=s.x-u.x,h=s.y-u.y,g=this.options.dimensions===3?s.z-u.z:0,p=l*l+h*h+g*g;p===0&&(p=1,l=.01,h=.01,g=.01);const v=r/p,m=l*v,d=h*v,y=g*v;e[o].x+=m,e[o].y+=d,e[c].x-=m,e[c].y-=d,this.options.dimensions===3&&(e[o].z+=y,e[c].z-=y)})})}calAttractive(t,e,r){t.getAllEdges().forEach(s=>{const{source:o,target:a}=s;if(!o||!a||o===a)return;const{data:u}=t.getNode(o),{data:c}=t.getNode(a);if(!U(c.x)||!U(u.x)||!U(c.y)||!U(u.y))return;const f=c.x-u.x,l=c.y-u.y,h=this.options.dimensions===3?c.z-u.z:0,g=Math.sqrt(f*f+l*l+h*h)/r,p=f*g,v=l*g,m=h*g;e[o].x+=p,e[o].y+=v,e[a].x-=p,e[a].y-=v,this.options.dimensions===3&&(e[o].z+=m,e[a].z-=m)})}}const TS={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 kS{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},TS),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericGridLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,t,e)})}genericGridLayout(t,e,r){return $(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),r),{begin:s=[0,0],condense:o,preventOverlapPadding:a,preventOverlap:u,rows:c,cols:f,nodeSpacing:l,nodeSize:h,width:g,height:p,position:v}=i;let{sortBy:m}=i;const d=e.getAllNodes(),y=e.getAllEdges(),w=d==null?void 0:d.length;if(!w||w===1)return nt(e,t,s);const b=d.map(I=>we(I));m!=="id"&&(!kt(m)||b[0].data[m]===void 0)&&(m="degree"),m==="degree"?b.sort((I,j)=>e.getDegree(j.id,"both")-e.getDegree(I.id,"both")):m==="id"?b.sort((I,j)=>U(j.id)&&U(I.id)?j.id-I.id:`${I.id}`.localeCompare(`${j.id}`)):b.sort((I,j)=>j.data[m]-I.data[m]);const x=!g&&typeof window<"u"?window.innerWidth:g,M=!p&&typeof window<"u"?window.innerHeight:p,N=w,E={rows:c,cols:f};if(c!=null&&f!=null)E.rows=c,E.cols=f;else if(c!=null&&f==null)E.rows=c,E.cols=Math.ceil(N/E.rows);else if(c==null&&f!=null)E.cols=f,E.rows=Math.ceil(N/E.cols);else{const I=Math.sqrt(N*M/x);E.rows=Math.round(I),E.cols=Math.round(x/M*I)}if(E.rows=Math.max(E.rows,1),E.cols=Math.max(E.cols,1),E.cols*E.rows>N){const I=Yr(E),j=Kr(E);(I-1)*j>=N?Yr(E,I-1):(j-1)*I>=N&&Kr(E,j-1)}else for(;E.cols*E.rows<N;){const I=Yr(E),j=Kr(E);(j+1)*I>=N?Kr(E,j+1):Yr(E,I+1)}let O=o?0:x/E.cols,_=o?0:M/E.rows;if(u||l){const I=We(10,l),j=Jc(30,h,!1);b.forEach(F=>{(!F.data.x||!F.data.y)&&(F.data.x=0,F.data.y=0);const A=e.getNode(F.id),k=j(A)||30;let L,D;he(k)?(L=k[0],D=k[1]):(L=k,D=k);const G=I!==void 0?I(F):a,P=L+G,z=D+G;O=Math.max(O,P),_=Math.max(_,z)})}const S={},q={row:0,col:0},R={};for(let I=0;I<b.length;I++){const j=b[I];let F;if(v&&(F=v(e.getNode(j.id))),F&&(F.row!==void 0||F.col!==void 0)){const A={row:F.row,col:F.col};if(A.col===void 0)for(A.col=0;Qu(S,A);)A.col++;else if(A.row===void 0)for(A.row=0;Qu(S,A);)A.row++;R[j.id]=A,d0(S,A)}jS(j,s,O,_,R,E,q,S)}const T={nodes:b,edges:y};return t&&b.forEach(I=>{e.mergeNodeData(I.id,{x:I.data.x,y:I.data.y})}),T})}}const Yr=(n,t)=>{let e;const r=n.rows||5,i=n.cols||5;return t==null?e=Math.min(r,i):Math.min(r,i)===n.rows?n.rows=t:n.cols=t,e},Kr=(n,t)=>{let e;const r=n.rows||5,i=n.cols||5;return t==null?e=Math.max(r,i):Math.max(r,i)===n.rows?n.rows=t:n.cols=t,e},Qu=(n,t)=>n[`c-${t.row}-${t.col}`]||!1,d0=(n,t)=>n[`c-${t.row}-${t.col}`]=!0,g0=(n,t)=>{const e=n.cols||5;t.col++,t.col>=e&&(t.col=0,t.row++)},jS=(n,t,e,r,i,s,o,a)=>{let u,c;const f=i[n.id];if(f)u=f.col*e+e/2+t[0],c=f.row*r+r/2+t[1];else{for(;Qu(a,o);)g0(s,o);u=o.col*e+e/2+t[0],c=o.row*r+r/2+t[1],d0(a,o),g0(s,o)}n.data.x=u,n.data.y=c},CS=(n,t,e)=>{try{const r=Ye.mul(Ye.pow(t,2),-.5),i=r.mean("row"),s=r.mean("column"),o=r.mean();r.add(o).subRowVector(i).subColumnVector(s);const a=new _f(r),u=Ye.sqrt(a.diagonalMatrix).diagonal();return a.leftSingularVectors.toJSON().map(c=>Ye.mul([c],[u]).toJSON()[0].splice(0,n))}catch{const i=[];for(let s=0;s<t.length;s++){const o=Math.random()*e,a=Math.random()*e;i.push([o,a])}return i}},PS=800,LS={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},DS=(n,t)=>{const e=Object.assign(Object.assign({},LS),t),{positions:r,iterations:i,width:s,k:o,speed:a=100,strictRadial:u,focusIdx:c,radii:f=[],nodeSizeFunc:l}=e,h=n.getAllNodes(),g=[],p=s/10;for(let v=0;v<i;v++)r.forEach((m,d)=>{g[d]={x:0,y:0}}),zS(h,r,g,o,f,l),$S(r,g,a,u,c,p,s,f);return r},zS=(n,t,e,r,i,s)=>{t.forEach((o,a)=>{e[a]={x:0,y:0},t.forEach((u,c)=>{if(a===c||i[a]!==i[c])return;let f=o.x-u.x,l=o.y-u.y,h=Math.sqrt(f*f+l*l);if(h===0){h=1;const g=a>c?1:-1;f=.01*g,l=.01*g}if(h<s(n[a])/2+s(n[c])/2){const g=r*r/h;e[a].x+=f/h*g,e[a].y+=l/h*g}})})},$S=(n,t,e,r,i,s,o,a)=>{const u=s||o/10;return r&&t.forEach((c,f)=>{const l=n[f].x-n[i].x,h=n[f].y-n[i].y,g=Math.sqrt(l*l+h*h);let p=h/g,v=-l/g;const m=Math.sqrt(c.x*c.x+c.y*c.y);let d=Math.acos((p*c.x+v*c.y)/m);d>Math.PI/2&&(d-=Math.PI/2,p*=-1,v*=-1);const y=Math.cos(d)*m;c.x=p*y,c.y=v*y}),n.forEach((c,f)=>{if(f===i)return;const l=Math.sqrt(t[f].x*t[f].x+t[f].y*t[f].y);if(l>0&&f!==i){const h=Math.min(u*(e/PS),l);if(c.x+=t[f].x/l*h,c.y+=t[f].y/l*h,r){let g=c.x-n[i].x,p=c.y-n[i].y;const v=Math.sqrt(g*g+p*p);g=g/v*a[f],p=p/v*a[f],c.x=n[i].x+g,c.y=n[i].y+p}}}),n},FS={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class BS{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},FS),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,t,e)})}genericRadialLayout(t,e,r){return $(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),r),{width:s,height:o,center:a,focusNode:u,unitRadius:c,nodeSize:f,nodeSpacing:l,strictRadial:h,preventOverlap:g,maxPreventOverlapIteration:p,sortBy:v,linkDistance:m=50,sortStrength:d=10,maxIteration:y=1e3}=i,w=e.getAllNodes(),b=e.getAllEdges(),x=!s&&typeof window<"u"?window.innerWidth:s,M=!o&&typeof window<"u"?window.innerHeight:o,N=a||[x/2,M/2];if(!(w!=null&&w.length)||w.length===1)return nt(e,t,N);let E=w[0];if(kt(u)){for(let V=0;V<w.length;V++)if(w[V].id===u){E=w[V];break}}else E=u||w[0];const O=VS(w,E.id),_=Xc({nodes:w,edges:b}),S=Kc(_),q=YS(S,O);WS(S,O,q+1);const R=S[O];let T=x-N[0]>N[0]?N[0]:x-N[0],I=M-N[1]>N[1]?N[1]:M-N[1];T===0&&(T=x/2),I===0&&(I=M/2);const j=Math.min(T,I),F=Math.max(...R),A=[],k=c||j/F;R.forEach((V,le)=>{A[le]=V*k});const L=US(w,S,m,A,k,v,d),D=GS(L),G=CS(m,L,m);let P=G.map(([V,le])=>({x:(isNaN(V)?Math.random()*m:V)-G[O][0],y:(isNaN(le)?Math.random()*m:le)-G[O][1]}));this.run(y,P,D,L,A,O);let z;if(g){z=Qc(f,l);const V={nodes:w,nodeSizeFunc:z,positions:P,radii:A,height:M,width:x,strictRadial:!!h,focusIdx:O,iterations:p||200,k:P.length/4.5};P=DS(e,V)}const B=[];return P.forEach((V,le)=>{const Ee=we(w[le]);Ee.data.x=V.x+N[0],Ee.data.y=V.y+N[1],B.push(Ee)}),t&&B.forEach(V=>e.mergeNodeData(V.id,{x:V.data.x,y:V.data.y})),{nodes:B,edges:b}})}run(t,e,r,i,s,o){for(let a=0;a<=t;a++){const u=a/t;this.oneIteration(u,e,s,i,r,o)}}oneIteration(t,e,r,i,s,o){const a=1-t;e.forEach((u,c)=>{const f=Zc(u,{x:0,y:0}),l=f===0?0:1/f;if(c===o)return;let h=0,g=0,p=0;e.forEach((m,d)=>{if(c===d)return;const y=Zc(u,m),w=y===0?0:1/y,b=i[d][c];p+=s[c][d],h+=s[c][d]*(m.x+b*(u.x-m.x)*w),g+=s[c][d]*(m.y+b*(u.y-m.y)*w)});const v=r[c]===0?0:1/r[c];p*=a,p+=t*v*v,h*=a,h+=t*v*u.x*l,u.x=h/p,g*=a,g+=t*v*u.y*l,u.y=g/p})}}const US=(n,t,e,r,i,s,o)=>{if(!n)return[];const a=[];if(t){const u={};t.forEach((c,f)=>{const l=[];c.forEach((h,g)=>{var p,v;if(f===g)l.push(0);else if(r[f]===r[g])if(s==="data")l.push(h*(Math.abs(f-g)*o)/(r[f]/i));else if(s){let m,d;if(u[n[f].id])m=u[n[f].id];else{const y=(s==="id"?n[f].id:(p=n[f].data)===null||p===void 0?void 0:p[s])||0;kt(y)?m=y.charCodeAt(0):m=y,u[n[f].id]=m}if(u[n[g].id])d=u[n[g].id];else{const y=(s==="id"?n[g].id:(v=n[g].data)===null||v===void 0?void 0:v[s])||0;kt(y)?d=y.charCodeAt(0):d=y,u[n[g].id]=d}l.push(h*(Math.abs(m-d)*o)/(r[f]/i))}else l.push(h*e/(r[f]/i));else{const m=(e+i)/2;l.push(h*m)}}),a.push(l)})}return a},GS=n=>{const t=n.length,e=n[0].length,r=[];for(let i=0;i<t;i++){const s=[];for(let o=0;o<e;o++)n[i][o]!==0?s.push(1/(n[i][o]*n[i][o])):s.push(0);r.push(s)}return r},VS=(n,t)=>{let e=-1;return n.forEach((r,i)=>{r.id===t&&(e=i)}),Math.max(e,0)},WS=(n,t,e)=>{const r=n.length;for(let i=0;i<r;i++)if(n[t][i]===1/0){n[t][i]=e,n[i][t]=e;for(let s=0;s<r;s++)n[i][s]!==1/0&&n[t][s]===1/0&&(n[t][s]=e+n[i][s],n[s][t]=e+n[i][s])}for(let i=0;i<r;i++)if(i!==t){for(let s=0;s<r;s++)if(n[i][s]===1/0){let o=Math.abs(n[t][i]-n[t][s]);o=o===0?1:o,n[i][s]=o}}},YS=(n,t)=>{let e=0;for(let r=0;r<n[t].length;r++)n[t][r]!==1/0&&(e=n[t][r]>e?n[t][r]:e);return e},KS={center:[0,0],width:300,height:300};class XS{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},KS),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,t,e)})}genericRandomLayout(t,e,r){return $(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),r),{center:s,width:o,height:a}=i,u=e.getAllNodes(),c=.9,f=!o&&typeof window<"u"?window.innerWidth:o,l=!a&&typeof window<"u"?window.innerHeight:a,h=s||[f/2,l/2],g=[];return u&&u.forEach(v=>{g.push({id:v.id,data:{x:(Math.random()-.5)*c*f+h[0],y:(Math.random()-.5)*c*l+h[1]}})}),t&&g.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:g,edges:e.getAllEdges()}})}}const ZS={circular:Ly,concentric:vn,mds:Ef,random:XS,grid:kS,radial:BS,force:sf,d3force:Tf,"d3-force-3d":Lb,fruchterman:IS,forceAtlas2:qS,dagre:Wr,antvDagre:jy,comboCombined:k1};let Ue;rn({stopLayout(){Ue!=null&&Ue.stop&&Ue.stop()},calculateLayout(n,t){return $(this,void 0,void 0,function*(){const{layout:{id:e,options:r,iterations:i},nodes:s,edges:o}=n,a=new ue({nodes:s,edges:o}),u=ZS[e];if(u)Ue=new u(r);else throw new Error(`Unknown layout id: ${e}`);let c=yield Ue.execute(a);return xf(Ue)&&(Ue.stop(),c=Ue.tick(i)),[c,t]})}})})();
13
+ ${ff}`)}function $w(n,t,e){return(n>=0&&e?` ${hf(n,t-1)}`:hf(n,t)).padEnd(t)}function hf(n,t){let e=n.toString();if(e.length<=t)return e;let r=n.toFixed(t);if(r.length>t&&(r=n.toFixed(Math.max(0,t-(r.length-t)))),r.length<=t&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let i=n.toExponential(t);return i.length>t&&(i=n.toExponential(Math.max(0,t-(i.length-t)))),i.slice(0)}function Fw(n,t){n.prototype.add=function(r){return typeof r=="number"?this.addS(r):this.addM(r)},n.prototype.addS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)+r);return this},n.prototype.addM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)+r.get(i,s));return this},n.add=function(r,i){return new t(r).add(i)},n.prototype.sub=function(r){return typeof r=="number"?this.subS(r):this.subM(r)},n.prototype.subS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)-r);return this},n.prototype.subM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)-r.get(i,s));return this},n.sub=function(r,i){return new t(r).sub(i)},n.prototype.subtract=n.prototype.sub,n.prototype.subtractS=n.prototype.subS,n.prototype.subtractM=n.prototype.subM,n.subtract=n.sub,n.prototype.mul=function(r){return typeof r=="number"?this.mulS(r):this.mulM(r)},n.prototype.mulS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)*r);return this},n.prototype.mulM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)*r.get(i,s));return this},n.mul=function(r,i){return new t(r).mul(i)},n.prototype.multiply=n.prototype.mul,n.prototype.multiplyS=n.prototype.mulS,n.prototype.multiplyM=n.prototype.mulM,n.multiply=n.mul,n.prototype.div=function(r){return typeof r=="number"?this.divS(r):this.divM(r)},n.prototype.divS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)/r);return this},n.prototype.divM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)/r.get(i,s));return this},n.div=function(r,i){return new t(r).div(i)},n.prototype.divide=n.prototype.div,n.prototype.divideS=n.prototype.divS,n.prototype.divideM=n.prototype.divM,n.divide=n.div,n.prototype.mod=function(r){return typeof r=="number"?this.modS(r):this.modM(r)},n.prototype.modS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)%r);return this},n.prototype.modM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)%r.get(i,s));return this},n.mod=function(r,i){return new t(r).mod(i)},n.prototype.modulus=n.prototype.mod,n.prototype.modulusS=n.prototype.modS,n.prototype.modulusM=n.prototype.modM,n.modulus=n.mod,n.prototype.and=function(r){return typeof r=="number"?this.andS(r):this.andM(r)},n.prototype.andS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)&r);return this},n.prototype.andM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)&r.get(i,s));return this},n.and=function(r,i){return new t(r).and(i)},n.prototype.or=function(r){return typeof r=="number"?this.orS(r):this.orM(r)},n.prototype.orS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)|r);return this},n.prototype.orM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)|r.get(i,s));return this},n.or=function(r,i){return new t(r).or(i)},n.prototype.xor=function(r){return typeof r=="number"?this.xorS(r):this.xorM(r)},n.prototype.xorS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)^r);return this},n.prototype.xorM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)^r.get(i,s));return this},n.xor=function(r,i){return new t(r).xor(i)},n.prototype.leftShift=function(r){return typeof r=="number"?this.leftShiftS(r):this.leftShiftM(r)},n.prototype.leftShiftS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)<<r);return this},n.prototype.leftShiftM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)<<r.get(i,s));return this},n.leftShift=function(r,i){return new t(r).leftShift(i)},n.prototype.signPropagatingRightShift=function(r){return typeof r=="number"?this.signPropagatingRightShiftS(r):this.signPropagatingRightShiftM(r)},n.prototype.signPropagatingRightShiftS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)>>r);return this},n.prototype.signPropagatingRightShiftM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)>>r.get(i,s));return this},n.signPropagatingRightShift=function(r,i){return new t(r).signPropagatingRightShift(i)},n.prototype.rightShift=function(r){return typeof r=="number"?this.rightShiftS(r):this.rightShiftM(r)},n.prototype.rightShiftS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)>>>r);return this},n.prototype.rightShiftM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)>>>r.get(i,s));return this},n.rightShift=function(r,i){return new t(r).rightShift(i)},n.prototype.zeroFillRightShift=n.prototype.rightShift,n.prototype.zeroFillRightShiftS=n.prototype.rightShiftS,n.prototype.zeroFillRightShiftM=n.prototype.rightShiftM,n.zeroFillRightShift=n.rightShift,n.prototype.not=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,~this.get(r,i));return this},n.not=function(r){return new t(r).not()},n.prototype.abs=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.abs(this.get(r,i)));return this},n.abs=function(r){return new t(r).abs()},n.prototype.acos=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.acos(this.get(r,i)));return this},n.acos=function(r){return new t(r).acos()},n.prototype.acosh=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.acosh(this.get(r,i)));return this},n.acosh=function(r){return new t(r).acosh()},n.prototype.asin=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.asin(this.get(r,i)));return this},n.asin=function(r){return new t(r).asin()},n.prototype.asinh=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.asinh(this.get(r,i)));return this},n.asinh=function(r){return new t(r).asinh()},n.prototype.atan=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.atan(this.get(r,i)));return this},n.atan=function(r){return new t(r).atan()},n.prototype.atanh=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.atanh(this.get(r,i)));return this},n.atanh=function(r){return new t(r).atanh()},n.prototype.cbrt=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.cbrt(this.get(r,i)));return this},n.cbrt=function(r){return new t(r).cbrt()},n.prototype.ceil=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.ceil(this.get(r,i)));return this},n.ceil=function(r){return new t(r).ceil()},n.prototype.clz32=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.clz32(this.get(r,i)));return this},n.clz32=function(r){return new t(r).clz32()},n.prototype.cos=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.cos(this.get(r,i)));return this},n.cos=function(r){return new t(r).cos()},n.prototype.cosh=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.cosh(this.get(r,i)));return this},n.cosh=function(r){return new t(r).cosh()},n.prototype.exp=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.exp(this.get(r,i)));return this},n.exp=function(r){return new t(r).exp()},n.prototype.expm1=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.expm1(this.get(r,i)));return this},n.expm1=function(r){return new t(r).expm1()},n.prototype.floor=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.floor(this.get(r,i)));return this},n.floor=function(r){return new t(r).floor()},n.prototype.fround=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.fround(this.get(r,i)));return this},n.fround=function(r){return new t(r).fround()},n.prototype.log=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.log(this.get(r,i)));return this},n.log=function(r){return new t(r).log()},n.prototype.log1p=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.log1p(this.get(r,i)));return this},n.log1p=function(r){return new t(r).log1p()},n.prototype.log10=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.log10(this.get(r,i)));return this},n.log10=function(r){return new t(r).log10()},n.prototype.log2=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.log2(this.get(r,i)));return this},n.log2=function(r){return new t(r).log2()},n.prototype.round=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.round(this.get(r,i)));return this},n.round=function(r){return new t(r).round()},n.prototype.sign=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.sign(this.get(r,i)));return this},n.sign=function(r){return new t(r).sign()},n.prototype.sin=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.sin(this.get(r,i)));return this},n.sin=function(r){return new t(r).sin()},n.prototype.sinh=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.sinh(this.get(r,i)));return this},n.sinh=function(r){return new t(r).sinh()},n.prototype.sqrt=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.sqrt(this.get(r,i)));return this},n.sqrt=function(r){return new t(r).sqrt()},n.prototype.tan=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.tan(this.get(r,i)));return this},n.tan=function(r){return new t(r).tan()},n.prototype.tanh=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.tanh(this.get(r,i)));return this},n.tanh=function(r){return new t(r).tanh()},n.prototype.trunc=function(){for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.set(r,i,Math.trunc(this.get(r,i)));return this},n.trunc=function(r){return new t(r).trunc()},n.pow=function(r,i){return new t(r).pow(i)},n.prototype.pow=function(r){return typeof r=="number"?this.powS(r):this.powM(r)},n.prototype.powS=function(r){for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)**r);return this},n.prototype.powM=function(r){if(r=t.checkMatrix(r),this.rows!==r.rows||this.columns!==r.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let s=0;s<this.columns;s++)this.set(i,s,this.get(i,s)**r.get(i,s));return this}}function Ne(n,t,e){let r=e?n.rows:n.rows-1;if(t<0||t>r)throw new RangeError("Row index out of range")}function Me(n,t,e){let r=e?n.columns:n.columns-1;if(t<0||t>r)throw new RangeError("Column index out of range")}function vt(n,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==n.columns)throw new RangeError("vector size must be the same as the number of columns");return t}function mt(n,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==n.rows)throw new RangeError("vector size must be the same as the number of rows");return t}function _n(n,t){if(!pe.isAnyArray(t))throw new TypeError("row indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=n.rows)throw new RangeError("row indices are out of range")}function En(n,t){if(!pe.isAnyArray(t))throw new TypeError("column indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=n.columns)throw new RangeError("column indices are out of range")}function xn(n,t,e,r,i){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(lr("startRow",t),lr("endRow",e),lr("startColumn",r),lr("endColumn",i),t>e||r>i||t<0||t>=n.rows||e<0||e>=n.rows||r<0||r>=n.columns||i<0||i>=n.columns)throw new RangeError("Submatrix indices are out of range")}function fr(n,t=0){let e=[];for(let r=0;r<n;r++)e.push(t);return e}function lr(n,t){if(typeof t!="number")throw new TypeError(`${n} must be a number`)}function yt(n){if(n.isEmpty())throw new Error("Empty matrix has no elements to index")}function Bw(n){let t=fr(n.rows);for(let e=0;e<n.rows;++e)for(let r=0;r<n.columns;++r)t[e]+=n.get(e,r);return t}function Uw(n){let t=fr(n.columns);for(let e=0;e<n.rows;++e)for(let r=0;r<n.columns;++r)t[r]+=n.get(e,r);return t}function Gw(n){let t=0;for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)t+=n.get(e,r);return t}function Vw(n){let t=fr(n.rows,1);for(let e=0;e<n.rows;++e)for(let r=0;r<n.columns;++r)t[e]*=n.get(e,r);return t}function Ww(n){let t=fr(n.columns,1);for(let e=0;e<n.rows;++e)for(let r=0;r<n.columns;++r)t[r]*=n.get(e,r);return t}function Yw(n){let t=1;for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)t*=n.get(e,r);return t}function Kw(n,t,e){const r=n.rows,i=n.columns,s=[];for(let o=0;o<r;o++){let a=0,u=0,c=0;for(let f=0;f<i;f++)c=n.get(o,f)-e[o],a+=c,u+=c*c;t?s.push((u-a*a/i)/(i-1)):s.push((u-a*a/i)/i)}return s}function Xw(n,t,e){const r=n.rows,i=n.columns,s=[];for(let o=0;o<i;o++){let a=0,u=0,c=0;for(let f=0;f<r;f++)c=n.get(f,o)-e[o],a+=c,u+=c*c;t?s.push((u-a*a/r)/(r-1)):s.push((u-a*a/r)/r)}return s}function Zw(n,t,e){const r=n.rows,i=n.columns,s=r*i;let o=0,a=0,u=0;for(let c=0;c<r;c++)for(let f=0;f<i;f++)u=n.get(c,f)-e,o+=u,a+=u*u;return t?(a-o*o/s)/(s-1):(a-o*o/s)/s}function Jw(n,t){for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)n.set(e,r,n.get(e,r)-t[e])}function Qw(n,t){for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)n.set(e,r,n.get(e,r)-t[r])}function Hw(n,t){for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)n.set(e,r,n.get(e,r)-t)}function e1(n){const t=[];for(let e=0;e<n.rows;e++){let r=0;for(let i=0;i<n.columns;i++)r+=n.get(e,i)**2/(n.columns-1);t.push(Math.sqrt(r))}return t}function t1(n,t){for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)n.set(e,r,n.get(e,r)/t[e])}function r1(n){const t=[];for(let e=0;e<n.columns;e++){let r=0;for(let i=0;i<n.rows;i++)r+=n.get(i,e)**2/(n.rows-1);t.push(Math.sqrt(r))}return t}function n1(n,t){for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)n.set(e,r,n.get(e,r)/t[r])}function i1(n){const t=n.size-1;let e=0;for(let r=0;r<n.columns;r++)for(let i=0;i<n.rows;i++)e+=n.get(i,r)**2/t;return Math.sqrt(e)}function s1(n,t){for(let e=0;e<n.rows;e++)for(let r=0;r<n.columns;r++)n.set(e,r,n.get(e,r)/t)}class Y{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let s=new C(t,e);for(let o=0;o<t;o++)for(let a=0;a<e;a++)s.set(o,a,r[o*e+a]);return s}static rowVector(t){let e=new C(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new C(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new C(t,e)}static ones(t,e){return new C(t,e).fill(1)}static rand(t,e,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{random:i=Math.random}=r;let s=new C(t,e);for(let o=0;o<t;o++)for(let a=0;a<e;a++)s.set(o,a,i());return s}static randInt(t,e,r={}){if(typeof r!="object")throw new TypeError("options must be an object");const{min:i=0,max:s=1e3,random:o=Math.random}=r;if(!Number.isInteger(i))throw new TypeError("min must be an integer");if(!Number.isInteger(s))throw new TypeError("max must be an integer");if(i>=s)throw new RangeError("min must be smaller than max");let a=s-i,u=new C(t,e);for(let c=0;c<t;c++)for(let f=0;f<e;f++){let l=i+Math.round(o()*a);u.set(c,f,l)}return u}static eye(t,e,r){e===void 0&&(e=t),r===void 0&&(r=1);let i=Math.min(t,e),s=this.zeros(t,e);for(let o=0;o<i;o++)s.set(o,o,r);return s}static diag(t,e,r){let i=t.length;e===void 0&&(e=i),r===void 0&&(r=e);let s=Math.min(i,e,r),o=this.zeros(e,r);for(let a=0;a<s;a++)o.set(a,a,t[a]);return o}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,i=t.columns,s=new C(r,i);for(let o=0;o<r;o++)for(let a=0;a<i;a++)s.set(o,a,Math.min(t.get(o,a),e.get(o,a)));return s}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,i=t.columns,s=new this(r,i);for(let o=0;o<r;o++)for(let a=0;a<i;a++)s.set(o,a,Math.max(t.get(o,a),e.get(o,a)));return s}static checkMatrix(t){return Y.isMatrix(t)?t:new C(t)}static isMatrix(t){return t!=null&&t.klass==="Matrix"}get size(){return this.rows*this.columns}apply(t){if(typeof t!="function")throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(this.get(t,t)!==0)return!1;return!0}isEchelonForm(){let t=0,e=0,r=-1,i=!0,s=!1;for(;t<this.rows&&i;){for(e=0,s=!1;e<this.columns&&s===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>r?(s=!0,r=e):(i=!1,s=!0);t++}return i}isReducedEchelonForm(){let t=0,e=0,r=-1,i=!0,s=!1;for(;t<this.rows&&i;){for(e=0,s=!1;e<this.columns&&s===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>r?(s=!0,r=e):(i=!1,s=!0);for(let o=e+1;o<this.rows;o++)this.get(t,o)!==0&&(i=!1);t++}return i}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let i=e;for(let s=e;s<t.rows;s++)t.get(s,r)>t.get(i,r)&&(i=s);if(t.get(i,r)===0)r++;else{t.swapRows(e,i);let s=t.get(e,r);for(let o=r;o<t.columns;o++)t.set(e,o,t.get(e,o)/s);for(let o=e+1;o<t.rows;o++){let a=t.get(o,r)/t.get(e,r);t.set(o,r,0);for(let u=r+1;u<t.columns;u++)t.set(o,u,t.get(o,u)-t.get(e,u)*a)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,i=r-1;for(;i>=0;)if(t.maxRow(i)===0)i--;else{let s=0,o=!1;for(;s<r&&o===!1;)t.get(i,s)===1?o=!0:s++;for(let a=0;a<i;a++){let u=t.get(a,s);for(let c=s;c<e;c++){let f=t.get(a,c)-u*t.get(i,c);t.set(a,c,f)}}i--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let i=new C(this.rows*e,this.columns*r);for(let s=0;s<e;s++)for(let o=0;o<r;o++)i.setSubMatrix(this,this.rows*s,this.columns*o);return i}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){Ne(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return C.rowVector(this.getRow(t))}setRow(t,e){Ne(this,t),e=vt(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){Ne(this,t),Ne(this,e);for(let r=0;r<this.columns;r++){let i=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,i)}return this}getColumn(t){Me(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return C.columnVector(this.getColumn(t))}setColumn(t,e){Me(this,t),e=mt(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){Me(this,t),Me(this,e);for(let r=0;r<this.rows;r++){let i=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,i)}return this}addRowVector(t){t=vt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=vt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=vt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=vt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=mt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=mt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=mt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=mt(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){Ne(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){Me(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const e=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)>e[r]&&(e[r]=this.get(r,i));return e}case"column":{const e=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)>e[i]&&(e[i]=this.get(r,i));return e}case void 0:{let e=this.get(0,0);for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)>e&&(e=this.get(r,i));return e}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){yt(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)>t&&(t=this.get(r,i),e[0]=r,e[1]=i);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const e=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)<e[r]&&(e[r]=this.get(r,i));return e}case"column":{const e=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)<e[i]&&(e[i]=this.get(r,i));return e}case void 0:{let e=this.get(0,0);for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)<e&&(e=this.get(r,i));return e}default:throw new Error(`invalid option: ${t}`)}}minIndex(){yt(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let i=0;i<this.columns;i++)this.get(r,i)<t&&(t=this.get(r,i),e[0]=r,e[1]=i);return e}maxRow(t){if(Ne(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){Ne(this,t),yt(this);let e=this.get(t,0),r=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)>e&&(e=this.get(t,i),r[1]=i);return r}minRow(t){if(Ne(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){Ne(this,t),yt(this);let e=this.get(t,0),r=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)<e&&(e=this.get(t,i),r[1]=i);return r}maxColumn(t){if(Me(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){Me(this,t),yt(this);let e=this.get(0,t),r=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)>e&&(e=this.get(i,t),r[0]=i);return r}minColumn(t){if(Me(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){Me(this,t),yt(this);let e=this.get(0,t),r=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)<e&&(e=this.get(i,t),r[0]=i);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){Y.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let i=0;i<e.length;i++)r+=e[i]*t[i];return r}mmul(t){t=C.checkMatrix(t);let e=this.rows,r=this.columns,i=t.columns,s=new C(e,i),o=new Float64Array(r);for(let a=0;a<i;a++){for(let u=0;u<r;u++)o[u]=t.get(u,a);for(let u=0;u<e;u++){let c=0;for(let f=0;f<r;f++)c+=this.get(u,f)*o[f];s.set(u,a,c)}}return s}strassen2x2(t){t=C.checkMatrix(t);let e=new C(2,2);const r=this.get(0,0),i=t.get(0,0),s=this.get(0,1),o=t.get(0,1),a=this.get(1,0),u=t.get(1,0),c=this.get(1,1),f=t.get(1,1),l=(r+c)*(i+f),h=(a+c)*i,g=r*(o-f),p=c*(u-i),v=(r+s)*f,m=(a-r)*(i+o),d=(s-c)*(u+f),y=l+p-v+d,w=g+v,b=h+p,x=l-h+g+m;return e.set(0,0,y),e.set(0,1,w),e.set(1,0,b),e.set(1,1,x),e}strassen3x3(t){t=C.checkMatrix(t);let e=new C(3,3);const r=this.get(0,0),i=this.get(0,1),s=this.get(0,2),o=this.get(1,0),a=this.get(1,1),u=this.get(1,2),c=this.get(2,0),f=this.get(2,1),l=this.get(2,2),h=t.get(0,0),g=t.get(0,1),p=t.get(0,2),v=t.get(1,0),m=t.get(1,1),d=t.get(1,2),y=t.get(2,0),w=t.get(2,1),b=t.get(2,2),x=(r+i+s-o-a-f-l)*m,M=(r-o)*(-g+m),N=a*(-h+g+v-m-d-y+b),E=(-r+o+a)*(h-g+m),O=(o+a)*(-h+g),_=r*h,S=(-r+c+f)*(h-p+d),q=(-r+c)*(p-d),R=(c+f)*(-h+p),T=(r+i+s-a-u-c-f)*d,I=f*(-h+p+v-m-d-y+w),j=(-s+f+l)*(m+y-w),F=(s-l)*(m-w),A=s*y,k=(f+l)*(-y+w),L=(-s+a+u)*(d+y-b),D=(s-u)*(d-b),G=(a+u)*(-y+b),P=i*v,z=u*w,B=o*p,Z=c*g,V=l*b,le=_+A+P,Ee=x+E+O+_+j+A+k,Hu=_+S+R+T+A+L+G,ec=M+N+E+_+A+L+D,tc=M+E+O+_+z,rc=A+L+D+G+B,nc=_+S+q+I+j+F+A,H=j+F+A+k+Z,Ot=_+S+q+R+V;return e.set(0,0,le),e.set(0,1,Ee),e.set(0,2,Hu),e.set(1,0,ec),e.set(1,1,tc),e.set(1,2,rc),e.set(2,0,nc),e.set(2,1,H),e.set(2,2,Ot),e}mmulStrassen(t){t=C.checkMatrix(t);let e=this.clone(),r=e.rows,i=e.columns,s=t.rows,o=t.columns;i!==s&&console.warn(`Multiplying ${r} x ${i} and ${s} x ${o} matrix: dimensions do not match.`);function a(l,h,g){let p=l.rows,v=l.columns;if(p===h&&v===g)return l;{let m=Y.zeros(h,g);return m=m.setSubMatrix(l,0,0),m}}let u=Math.max(r,s),c=Math.max(i,o);e=a(e,u,c),t=a(t,u,c);function f(l,h,g,p){if(g<=512||p<=512)return l.mmul(h);g%2===1&&p%2===1?(l=a(l,g+1,p+1),h=a(h,g+1,p+1)):g%2===1?(l=a(l,g+1,p),h=a(h,g+1,p)):p%2===1&&(l=a(l,g,p+1),h=a(h,g,p+1));let v=parseInt(l.rows/2,10),m=parseInt(l.columns/2,10),d=l.subMatrix(0,v-1,0,m-1),y=h.subMatrix(0,v-1,0,m-1),w=l.subMatrix(0,v-1,m,l.columns-1),b=h.subMatrix(0,v-1,m,h.columns-1),x=l.subMatrix(v,l.rows-1,0,m-1),M=h.subMatrix(v,h.rows-1,0,m-1),N=l.subMatrix(v,l.rows-1,m,l.columns-1),E=h.subMatrix(v,h.rows-1,m,h.columns-1),O=f(Y.add(d,N),Y.add(y,E),v,m),_=f(Y.add(x,N),y,v,m),S=f(d,Y.sub(b,E),v,m),q=f(N,Y.sub(M,y),v,m),R=f(Y.add(d,w),E,v,m),T=f(Y.sub(x,d),Y.add(y,b),v,m),I=f(Y.sub(w,N),Y.add(M,E),v,m),j=Y.add(O,q);j.sub(R),j.add(I);let F=Y.add(S,R),A=Y.add(_,q),k=Y.sub(O,_);k.add(S),k.add(T);let L=Y.zeros(2*j.rows,2*j.columns);return L=L.setSubMatrix(j,0,0),L=L.setSubMatrix(F,j.rows,0),L=L.setSubMatrix(A,0,j.columns),L=L.setSubMatrix(k,j.rows,j.columns),L.subMatrix(0,g-1,0,p-1)}return f(e,t,u,c)}scaleRows(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let i=new C(this.rows,this.columns);for(let s=0;s<this.rows;s++){const o=this.getRow(s);o.length>0&&cf(o,{min:e,max:r,output:o}),i.setRow(s,o)}return i}scaleColumns(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let i=new C(this.rows,this.columns);for(let s=0;s<this.columns;s++){const o=this.getColumn(s);o.length&&cf(o,{min:e,max:r,output:o}),i.setColumn(s,o)}return i}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let i=this.get(e,r),s=this.get(e,this.columns-1-r);this.set(e,r,s),this.set(e,this.columns-1-r,i)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let i=this.get(r,e),s=this.get(this.rows-1-r,e);this.set(r,e,s),this.set(this.rows-1-r,e,i)}return this}kroneckerProduct(t){t=C.checkMatrix(t);let e=this.rows,r=this.columns,i=t.rows,s=t.columns,o=new C(e*i,r*s);for(let a=0;a<e;a++)for(let u=0;u<r;u++)for(let c=0;c<i;c++)for(let f=0;f<s;f++)o.set(i*a+c,s*u+f,this.get(a,u)*t.get(c,f));return o}kroneckerSum(t){if(t=C.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,i=this.kroneckerProduct(C.eye(r,r)),s=C.eye(e,e).kroneckerProduct(t);return i.add(s)}transpose(){let t=new C(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=df){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=df){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,i){xn(this,t,e,r,i);let s=new C(e-t+1,i-r+1);for(let o=t;o<=e;o++)for(let a=r;a<=i;a++)s.set(o-t,a-r,this.get(o,a));return s}subMatrixRow(t,e,r){if(e===void 0&&(e=0),r===void 0&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let i=new C(t.length,r-e+1);for(let s=0;s<t.length;s++)for(let o=e;o<=r;o++){if(t[s]<0||t[s]>=this.rows)throw new RangeError(`Row index out of range: ${t[s]}`);i.set(s,o-e,this.get(t[s],o))}return i}subMatrixColumn(t,e,r){if(e===void 0&&(e=0),r===void 0&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let i=new C(r-e+1,t.length);for(let s=0;s<t.length;s++)for(let o=e;o<=r;o++){if(t[s]<0||t[s]>=this.columns)throw new RangeError(`Column index out of range: ${t[s]}`);i.set(o-e,s,this.get(o,t[s]))}return i}setSubMatrix(t,e,r){if(t=C.checkMatrix(t),t.isEmpty())return this;let i=e+t.rows-1,s=r+t.columns-1;xn(this,e,i,r,s);for(let o=0;o<t.rows;o++)for(let a=0;a<t.columns;a++)this.set(e+o,r+a,t.get(o,a));return this}selection(t,e){_n(this,t),En(this,e);let r=new C(t.length,e.length);for(let i=0;i<t.length;i++){let s=t[i];for(let o=0;o<e.length;o++){let a=e[o];r.set(i,o,this.get(s,a))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){return this.constructor.copy(this,new C(this.rows,this.columns))}static copy(t,e){for(const[r,i,s]of t.entries())e.set(r,i,s);return e}sum(t){switch(t){case"row":return Bw(this);case"column":return Uw(this);case void 0:return Gw(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return Vw(this);case"column":return Ww(this);case void 0:return Yw(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":{for(let r=0;r<this.rows;r++)e[r]/=this.columns;return e}case"column":{for(let r=0;r<this.columns;r++)e[r]/=this.rows;return e}case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{unbiased:r=!0,mean:i=this.mean(t)}=e;if(typeof r!="boolean")throw new TypeError("unbiased must be a boolean");switch(t){case"row":{if(!pe.isAnyArray(i))throw new TypeError("mean must be an array");return Kw(this,r,i)}case"column":{if(!pe.isAnyArray(i))throw new TypeError("mean must be an array");return Xw(this,r,i)}case void 0:{if(typeof i!="number")throw new TypeError("mean must be a number");return Zw(this,r,i)}default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){typeof t=="object"&&(e=t,t=void 0);const r=this.variance(t,e);if(t===void 0)return Math.sqrt(r);for(let i=0;i<r.length;i++)r[i]=Math.sqrt(r[i]);return r}center(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":{if(!pe.isAnyArray(r))throw new TypeError("center must be an array");return Jw(this,r),this}case"column":{if(!pe.isAnyArray(r))throw new TypeError("center must be an array");return Qw(this,r),this}case void 0:{if(typeof r!="number")throw new TypeError("center must be a number");return Hw(this,r),this}default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":{if(r===void 0)r=e1(this);else if(!pe.isAnyArray(r))throw new TypeError("scale must be an array");return t1(this,r),this}case"column":{if(r===void 0)r=r1(this);else if(!pe.isAnyArray(r))throw new TypeError("scale must be an array");return n1(this,r),this}case void 0:{if(r===void 0)r=i1(this);else if(typeof r!="number")throw new TypeError("scale must be a number");return s1(this,r),this}default:throw new Error(`invalid option: ${t}`)}}toString(t){return lf(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}Y.prototype.klass="Matrix",typeof Symbol<"u"&&(Y.prototype[Symbol.for("nodejs.util.inspect.custom")]=Dw);function df(n,t){return n-t}function o1(n){return n.every(t=>typeof t=="number")}Y.random=Y.rand,Y.randomInt=Y.randInt,Y.diagonal=Y.diag,Y.prototype.diagonal=Y.prototype.diag,Y.identity=Y.eye,Y.prototype.negate=Y.prototype.neg,Y.prototype.tensorProduct=Y.prototype.kroneckerProduct;let C=(qt=class extends Y{constructor(e,r){super();sc(this,Jt);te(this,"data");if(qt.isMatrix(e))oc(this,Jt,ac).call(this,e.rows,e.columns),qt.copy(e,this);else if(Number.isInteger(e)&&e>=0)oc(this,Jt,ac).call(this,e,r);else if(pe.isAnyArray(e)){const i=e;if(e=i.length,r=e?i[0].length:0,typeof r!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let s=0;s<e;s++){if(i[s].length!==r)throw new RangeError("Inconsistent array dimensions");if(!o1(i[s]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(i[s]))}this.rows=e,this.columns=r}else throw new TypeError("First argument must be a positive number or an array")}set(e,r,i){return this.data[e][r]=i,this}get(e,r){return this.data[e][r]}removeRow(e){return Ne(this,e),this.data.splice(e,1),this.rows-=1,this}addRow(e,r){return r===void 0&&(r=e,e=this.rows),Ne(this,e,!0),r=Float64Array.from(vt(this,r)),this.data.splice(e,0,r),this.rows+=1,this}removeColumn(e){Me(this,e);for(let r=0;r<this.rows;r++){const i=new Float64Array(this.columns-1);for(let s=0;s<e;s++)i[s]=this.data[r][s];for(let s=e+1;s<this.columns;s++)i[s-1]=this.data[r][s];this.data[r]=i}return this.columns-=1,this}addColumn(e,r){typeof r>"u"&&(r=e,e=this.columns),Me(this,e,!0),r=mt(this,r);for(let i=0;i<this.rows;i++){const s=new Float64Array(this.columns+1);let o=0;for(;o<e;o++)s[o]=this.data[i][o];for(s[o++]=r[i];o<this.columns+1;o++)s[o]=this.data[i][o-1];this.data[i]=s}return this.columns+=1,this}},Jt=new WeakSet,ac=function(e,r){if(this.data=[],Number.isInteger(r)&&r>=0)for(let i=0;i<e;i++)this.data.push(new Float64Array(r));else throw new TypeError("nColumns must be a positive integer");this.rows=e,this.columns=r},qt);Fw(Y,C);const Xr=class Xr extends Y{constructor(e){super();sc(this,fe,void 0);if(C.isMatrix(e)){if(!e.isSymmetric())throw new TypeError("not symmetric data");Hr(this,fe,C.copy(e,new C(e.rows,e.rows)))}else if(Number.isInteger(e)&&e>=0)Hr(this,fe,new C(e,e));else if(Hr(this,fe,new C(e)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return Ie(this,fe).size}get rows(){return Ie(this,fe).rows}get columns(){return Ie(this,fe).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(e){return C.isMatrix(e)&&e.klassType==="SymmetricMatrix"}static zeros(e){return new this(e)}static ones(e){return new this(e).fill(1)}clone(){const e=new Xr(this.diagonalSize);for(const[r,i,s]of this.upperRightEntries())e.set(r,i,s);return e}toMatrix(){return new C(this)}get(e,r){return Ie(this,fe).get(e,r)}set(e,r,i){return Ie(this,fe).set(e,r,i),Ie(this,fe).set(r,e,i),this}removeCross(e){return Ie(this,fe).removeRow(e),Ie(this,fe).removeColumn(e),this}addCross(e,r){r===void 0&&(r=e,e=this.diagonalSize);const i=r.slice();return i.splice(e,1),Ie(this,fe).addRow(e,i),Ie(this,fe).addColumn(e,r),this}applyMask(e){if(e.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const r=[];for(const[i,s]of e.entries())s||r.push(i);r.reverse();for(const i of r)this.removeCross(i);return this}toCompact(){const{diagonalSize:e}=this,r=new Array(e*(e+1)/2);for(let i=0,s=0,o=0;o<r.length;o++)r[o]=this.get(s,i),++i>=e&&(i=++s);return r}static fromCompact(e){const r=e.length,i=(Math.sqrt(8*r+1)-1)/2;if(!Number.isInteger(i))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(e)}`);const s=new Xr(i);for(let o=0,a=0,u=0;u<r;u++)s.set(o,a,e[u]),++o>=i&&(o=++a);return s}*upperRightEntries(){for(let e=0,r=0;e<this.diagonalSize;void 0){const i=this.get(e,r);yield[e,r,i],++r>=this.diagonalSize&&(r=++e)}}*upperRightValues(){for(let e=0,r=0;e<this.diagonalSize;void 0)yield this.get(e,r),++r>=this.diagonalSize&&(r=++e)}};fe=new WeakMap;let it=Xr;it.prototype.klassType="SymmetricMatrix";class hr extends it{static isDistanceMatrix(t){return it.isSymmetricMatrix(t)&&t.klassSubType==="DistanceMatrix"}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,r){return t===e&&(r=0),super.set(t,e,r)}addCross(t,e){return e===void 0&&(e=t,t=this.diagonalSize),e=e.slice(),e[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new it(this)}clone(){const t=new hr(this.diagonalSize);for(const[e,r,i]of this.upperRightEntries())e!==r&&t.set(e,r,i);return t}toCompact(){const{diagonalSize:t}=this,e=(t-1)*t/2,r=new Array(e);for(let i=1,s=0,o=0;o<r.length;o++)r[o]=this.get(s,i),++i>=t&&(i=++s+1);return r}static fromCompact(t){const e=t.length;if(e===0)return new this(0);const r=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(r))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const i=new this(r);for(let s=1,o=0,a=0;a<e;a++)i.set(s,o,t[a]),++s>=r&&(s=++o+1);return i}}hr.prototype.klassSubType="DistanceMatrix";class je extends Y{constructor(t,e,r){super(),this.matrix=t,this.rows=e,this.columns=r}}class a1 extends je{constructor(t,e){Me(t,e),super(t,t.rows,1),this.column=e}set(t,e,r){return this.matrix.set(t,this.column,r),this}get(t){return this.matrix.get(t,this.column)}}class u1 extends je{constructor(t,e){En(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}}class c1 extends je{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}}class f1 extends je{constructor(t){super(t,t.rows,t.columns)}set(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}}class l1 extends je{constructor(t,e){Ne(t,e),super(t,1,t.columns),this.row=e}set(t,e,r){return this.matrix.set(this.row,e,r),this}get(t,e){return this.matrix.get(this.row,e)}}class h1 extends je{constructor(t,e){_n(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}}class dr extends je{constructor(t,e,r){_n(t,e),En(t,r),super(t,e.length,r.length),this.rowIndices=e,this.columnIndices=r}set(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class d1 extends je{constructor(t,e,r,i,s){xn(t,e,r,i,s),super(t,r-e+1,s-i+1),this.startRow=e,this.startColumn=i}set(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}}class g1 extends je{constructor(t){super(t,t.columns,t.rows)}set(t,e,r){return this.matrix.set(e,t,r),this}get(t,e){return this.matrix.get(e,t)}}class gf extends Y{constructor(t,e={}){const{rows:r=1}=e;if(t.length%r!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=r,this.columns=t.length/r,this.data=t}set(t,e,r){let i=this._calculateIndex(t,e);return this.data[i]=r,this}get(t,e){let r=this._calculateIndex(t,e);return this.data[r]}_calculateIndex(t,e){return t*this.columns+e}}class be extends Y{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}function p1(n,t){if(pe.isAnyArray(n))return n[0]&&pe.isAnyArray(n[0])?new be(n):new gf(n,t);throw new Error("the argument is not an array")}class gr{constructor(t){t=be.checkMatrix(t);let e=t.clone(),r=e.rows,i=e.columns,s=new Float64Array(r),o=1,a,u,c,f,l,h,g,p,v;for(a=0;a<r;a++)s[a]=a;for(p=new Float64Array(r),u=0;u<i;u++){for(a=0;a<r;a++)p[a]=e.get(a,u);for(a=0;a<r;a++){for(v=Math.min(a,u),l=0,c=0;c<v;c++)l+=e.get(a,c)*p[c];p[a]-=l,e.set(a,u,p[a])}for(f=u,a=u+1;a<r;a++)Math.abs(p[a])>Math.abs(p[f])&&(f=a);if(f!==u){for(c=0;c<i;c++)h=e.get(f,c),e.set(f,c,e.get(u,c)),e.set(u,c,h);g=s[f],s[f]=s[u],s[u]=g,o=-o}if(u<r&&e.get(u,u)!==0)for(a=u+1;a<r;a++)e.set(a,u,e.get(a,u)/e.get(u,u))}this.LU=e,this.pivotVector=s,this.pivotSign=o}isSingular(){let t=this.LU,e=t.columns;for(let r=0;r<e;r++)if(t.get(r,r)===0)return!0;return!1}solve(t){t=C.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let i=t.columns,s=t.subMatrixRow(this.pivotVector,0,i-1),o=e.columns,a,u,c;for(c=0;c<o;c++)for(a=c+1;a<o;a++)for(u=0;u<i;u++)s.set(a,u,s.get(a,u)-s.get(c,u)*e.get(a,c));for(c=o-1;c>=0;c--){for(u=0;u<i;u++)s.set(c,u,s.get(c,u)/e.get(c,c));for(a=0;a<c;a++)for(u=0;u<i;u++)s.set(a,u,s.get(a,u)-s.get(c,u)*e.get(a,c))}return s}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,r=t.columns;for(let i=0;i<r;i++)e*=t.get(i,i);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,i=new C(e,r);for(let s=0;s<e;s++)for(let o=0;o<r;o++)s>o?i.set(s,o,t.get(s,o)):s===o?i.set(s,o,1):i.set(s,o,0);return i}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,i=new C(e,r);for(let s=0;s<e;s++)for(let o=0;o<r;o++)s<=o?i.set(s,o,t.get(s,o)):i.set(s,o,0);return i}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Ce(n,t){let e=0;return Math.abs(n)>Math.abs(t)?(e=t/n,Math.abs(n)*Math.sqrt(1+e*e)):t!==0?(e=n/t,Math.abs(t)*Math.sqrt(1+e*e)):0}class Nn{constructor(t){t=be.checkMatrix(t);let e=t.clone(),r=t.rows,i=t.columns,s=new Float64Array(i),o,a,u,c;for(u=0;u<i;u++){let f=0;for(o=u;o<r;o++)f=Ce(f,e.get(o,u));if(f!==0){for(e.get(u,u)<0&&(f=-f),o=u;o<r;o++)e.set(o,u,e.get(o,u)/f);for(e.set(u,u,e.get(u,u)+1),a=u+1;a<i;a++){for(c=0,o=u;o<r;o++)c+=e.get(o,u)*e.get(o,a);for(c=-c/e.get(u,u),o=u;o<r;o++)e.set(o,a,e.get(o,a)+c*e.get(o,u))}}s[u]=-f}this.QR=e,this.Rdiag=s}solve(t){t=C.checkMatrix(t);let e=this.QR,r=e.rows;if(t.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let i=t.columns,s=t.clone(),o=e.columns,a,u,c,f;for(c=0;c<o;c++)for(u=0;u<i;u++){for(f=0,a=c;a<r;a++)f+=e.get(a,c)*s.get(a,u);for(f=-f/e.get(c,c),a=c;a<r;a++)s.set(a,u,s.get(a,u)+f*e.get(a,c))}for(c=o-1;c>=0;c--){for(u=0;u<i;u++)s.set(c,u,s.get(c,u)/this.Rdiag[c]);for(a=0;a<c;a++)for(u=0;u<i;u++)s.set(a,u,s.get(a,u)-s.get(c,u)*e.get(a,c))}return s.subMatrix(0,o-1,0,i-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(this.Rdiag[e]===0)return!1;return!0}get upperTriangularMatrix(){let t=this.QR,e=t.columns,r=new C(e,e),i,s;for(i=0;i<e;i++)for(s=0;s<e;s++)i<s?r.set(i,s,t.get(i,s)):i===s?r.set(i,s,this.Rdiag[i]):r.set(i,s,0);return r}get orthogonalMatrix(){let t=this.QR,e=t.rows,r=t.columns,i=new C(e,r),s,o,a,u;for(a=r-1;a>=0;a--){for(s=0;s<e;s++)i.set(s,a,0);for(i.set(a,a,1),o=a;o<r;o++)if(t.get(a,a)!==0){for(u=0,s=a;s<e;s++)u+=t.get(s,a)*i.get(s,o);for(u=-u/t.get(a,a),s=a;s<e;s++)i.set(s,o,i.get(s,o)+u*t.get(s,a))}}return i}}let wt=class{constructor(t,e={}){if(t=be.checkMatrix(t),t.isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,i=t.columns;const{computeLeftSingularVectors:s=!0,computeRightSingularVectors:o=!0,autoTranspose:a=!1}=e;let u=!!s,c=!!o,f=!1,l;if(r<i)if(!a)l=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{l=t.transpose(),r=l.rows,i=l.columns,f=!0;let _=u;u=c,c=_}else l=t.clone();let h=Math.min(r,i),g=Math.min(r+1,i),p=new Float64Array(g),v=new C(r,h),m=new C(i,i),d=new Float64Array(i),y=new Float64Array(r),w=new Float64Array(g);for(let _=0;_<g;_++)w[_]=_;let b=Math.min(r-1,i),x=Math.max(0,Math.min(i-2,r)),M=Math.max(b,x);for(let _=0;_<M;_++){if(_<b){p[_]=0;for(let S=_;S<r;S++)p[_]=Ce(p[_],l.get(S,_));if(p[_]!==0){l.get(_,_)<0&&(p[_]=-p[_]);for(let S=_;S<r;S++)l.set(S,_,l.get(S,_)/p[_]);l.set(_,_,l.get(_,_)+1)}p[_]=-p[_]}for(let S=_+1;S<i;S++){if(_<b&&p[_]!==0){let q=0;for(let R=_;R<r;R++)q+=l.get(R,_)*l.get(R,S);q=-q/l.get(_,_);for(let R=_;R<r;R++)l.set(R,S,l.get(R,S)+q*l.get(R,_))}d[S]=l.get(_,S)}if(u&&_<b)for(let S=_;S<r;S++)v.set(S,_,l.get(S,_));if(_<x){d[_]=0;for(let S=_+1;S<i;S++)d[_]=Ce(d[_],d[S]);if(d[_]!==0){d[_+1]<0&&(d[_]=0-d[_]);for(let S=_+1;S<i;S++)d[S]/=d[_];d[_+1]+=1}if(d[_]=-d[_],_+1<r&&d[_]!==0){for(let S=_+1;S<r;S++)y[S]=0;for(let S=_+1;S<r;S++)for(let q=_+1;q<i;q++)y[S]+=d[q]*l.get(S,q);for(let S=_+1;S<i;S++){let q=-d[S]/d[_+1];for(let R=_+1;R<r;R++)l.set(R,S,l.get(R,S)+q*y[R])}}if(c)for(let S=_+1;S<i;S++)m.set(S,_,d[S])}}let N=Math.min(i,r+1);if(b<i&&(p[b]=l.get(b,b)),r<N&&(p[N-1]=0),x+1<N&&(d[x]=l.get(x,N-1)),d[N-1]=0,u){for(let _=b;_<h;_++){for(let S=0;S<r;S++)v.set(S,_,0);v.set(_,_,1)}for(let _=b-1;_>=0;_--)if(p[_]!==0){for(let S=_+1;S<h;S++){let q=0;for(let R=_;R<r;R++)q+=v.get(R,_)*v.get(R,S);q=-q/v.get(_,_);for(let R=_;R<r;R++)v.set(R,S,v.get(R,S)+q*v.get(R,_))}for(let S=_;S<r;S++)v.set(S,_,-v.get(S,_));v.set(_,_,1+v.get(_,_));for(let S=0;S<_-1;S++)v.set(S,_,0)}else{for(let S=0;S<r;S++)v.set(S,_,0);v.set(_,_,1)}}if(c)for(let _=i-1;_>=0;_--){if(_<x&&d[_]!==0)for(let S=_+1;S<i;S++){let q=0;for(let R=_+1;R<i;R++)q+=m.get(R,_)*m.get(R,S);q=-q/m.get(_+1,_);for(let R=_+1;R<i;R++)m.set(R,S,m.get(R,S)+q*m.get(R,_))}for(let S=0;S<i;S++)m.set(S,_,0);m.set(_,_,1)}let E=N-1,O=Number.EPSILON;for(;N>0;){let _,S;for(_=N-2;_>=-1&&_!==-1;_--){const q=Number.MIN_VALUE+O*Math.abs(p[_]+Math.abs(p[_+1]));if(Math.abs(d[_])<=q||Number.isNaN(d[_])){d[_]=0;break}}if(_===N-2)S=4;else{let q;for(q=N-1;q>=_&&q!==_;q--){let R=(q!==N?Math.abs(d[q]):0)+(q!==_+1?Math.abs(d[q-1]):0);if(Math.abs(p[q])<=O*R){p[q]=0;break}}q===_?S=3:q===N-1?S=1:(S=2,_=q)}switch(_++,S){case 1:{let q=d[N-2];d[N-2]=0;for(let R=N-2;R>=_;R--){let T=Ce(p[R],q),I=p[R]/T,j=q/T;if(p[R]=T,R!==_&&(q=-j*d[R-1],d[R-1]=I*d[R-1]),c)for(let F=0;F<i;F++)T=I*m.get(F,R)+j*m.get(F,N-1),m.set(F,N-1,-j*m.get(F,R)+I*m.get(F,N-1)),m.set(F,R,T)}break}case 2:{let q=d[_-1];d[_-1]=0;for(let R=_;R<N;R++){let T=Ce(p[R],q),I=p[R]/T,j=q/T;if(p[R]=T,q=-j*d[R],d[R]=I*d[R],u)for(let F=0;F<r;F++)T=I*v.get(F,R)+j*v.get(F,_-1),v.set(F,_-1,-j*v.get(F,R)+I*v.get(F,_-1)),v.set(F,R,T)}break}case 3:{const q=Math.max(Math.abs(p[N-1]),Math.abs(p[N-2]),Math.abs(d[N-2]),Math.abs(p[_]),Math.abs(d[_])),R=p[N-1]/q,T=p[N-2]/q,I=d[N-2]/q,j=p[_]/q,F=d[_]/q,A=((T+R)*(T-R)+I*I)/2,k=R*I*(R*I);let L=0;(A!==0||k!==0)&&(A<0?L=0-Math.sqrt(A*A+k):L=Math.sqrt(A*A+k),L=k/(A+L));let D=(j+R)*(j-R)+L,G=j*F;for(let P=_;P<N-1;P++){let z=Ce(D,G);z===0&&(z=Number.MIN_VALUE);let B=D/z,Z=G/z;if(P!==_&&(d[P-1]=z),D=B*p[P]+Z*d[P],d[P]=B*d[P]-Z*p[P],G=Z*p[P+1],p[P+1]=B*p[P+1],c)for(let V=0;V<i;V++)z=B*m.get(V,P)+Z*m.get(V,P+1),m.set(V,P+1,-Z*m.get(V,P)+B*m.get(V,P+1)),m.set(V,P,z);if(z=Ce(D,G),z===0&&(z=Number.MIN_VALUE),B=D/z,Z=G/z,p[P]=z,D=B*d[P]+Z*p[P+1],p[P+1]=-Z*d[P]+B*p[P+1],G=Z*d[P+1],d[P+1]=B*d[P+1],u&&P<r-1)for(let V=0;V<r;V++)z=B*v.get(V,P)+Z*v.get(V,P+1),v.set(V,P+1,-Z*v.get(V,P)+B*v.get(V,P+1)),v.set(V,P,z)}d[N-2]=D;break}case 4:{if(p[_]<=0&&(p[_]=p[_]<0?-p[_]:0,c))for(let q=0;q<=E;q++)m.set(q,_,-m.get(q,_));for(;_<E&&!(p[_]>=p[_+1]);){let q=p[_];if(p[_]=p[_+1],p[_+1]=q,c&&_<i-1)for(let R=0;R<i;R++)q=m.get(R,_+1),m.set(R,_+1,m.get(R,_)),m.set(R,_,q);if(u&&_<r-1)for(let R=0;R<r;R++)q=v.get(R,_+1),v.set(R,_+1,v.get(R,_)),v.set(R,_,q);_++}N--;break}}}if(f){let _=m;m=v,v=_}this.m=r,this.n=i,this.s=p,this.U=v,this.V=m}solve(t){let e=t,r=this.threshold,i=this.s.length,s=C.zeros(i,i);for(let h=0;h<i;h++)Math.abs(this.s[h])<=r?s.set(h,h,0):s.set(h,h,1/this.s[h]);let o=this.U,a=this.rightSingularVectors,u=a.mmul(s),c=a.rows,f=o.rows,l=C.zeros(c,f);for(let h=0;h<c;h++)for(let g=0;g<f;g++){let p=0;for(let v=0;v<i;v++)p+=u.get(h,v)*o.get(g,v);l.set(h,g,p)}return l.mmul(e)}solveForDiagonal(t){return this.solve(C.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,i=t.columns,s=new C(r,this.s.length);for(let f=0;f<r;f++)for(let l=0;l<i;l++)Math.abs(this.s[l])>e&&s.set(f,l,t.get(f,l)/this.s[l]);let o=this.U,a=o.rows,u=o.columns,c=new C(r,a);for(let f=0;f<r;f++)for(let l=0;l<a;l++){let h=0;for(let g=0;g<u;g++)h+=s.get(f,g)*o.get(l,g);c.set(f,l,h)}return c}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let i=0,s=r.length;i<s;i++)r[i]>t&&e++;return e}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 C.diag(this.s)}};function v1(n,t=!1){return n=be.checkMatrix(n),t?new wt(n).inverse():pf(n,C.eye(n.rows))}function pf(n,t,e=!1){return n=be.checkMatrix(n),t=be.checkMatrix(t),e?new wt(n).solve(t):n.isSquare()?new gr(n).solve(t):new Nn(n).solve(t)}function pr(n){if(n=C.checkMatrix(n),n.isSquare()){if(n.columns===0)return 1;let t,e,r,i;if(n.columns===2)return t=n.get(0,0),e=n.get(0,1),r=n.get(1,0),i=n.get(1,1),t*i-e*r;if(n.columns===3){let s,o,a;return s=new dr(n,[1,2],[1,2]),o=new dr(n,[1,2],[0,2]),a=new dr(n,[1,2],[0,1]),t=n.get(0,0),e=n.get(0,1),r=n.get(0,2),t*pr(s)-e*pr(o)+r*pr(a)}else return new gr(n).determinant}else throw Error("determinant can only be calculated for a square matrix")}function m1(n,t){let e=[];for(let r=0;r<n;r++)r!==t&&e.push(r);return e}function y1(n,t,e,r=1e-9,i=1e-9){if(n>i)return new Array(t.rows+1).fill(0);{let s=t.addRow(e,[0]);for(let o=0;o<s.rows;o++)Math.abs(s.get(o,0))<r&&s.set(o,0,0);return s.to1DArray()}}function w1(n,t={}){const{thresholdValue:e=1e-9,thresholdError:r=1e-9}=t;n=C.checkMatrix(n);let i=n.rows,s=new C(i,i);for(let o=0;o<i;o++){let a=C.columnVector(n.getRow(o)),u=n.subMatrixRow(m1(i,o)).transpose(),f=new wt(u).solve(a),l=C.sub(a,u.mmul(f)).abs().max();s.setRow(o,y1(l,f,o,e,r))}return s}function b1(n,t=Number.EPSILON){if(n=C.checkMatrix(n),n.isEmpty())return n.transpose();let e=new wt(n,{autoTranspose:!0}),r=e.leftSingularVectors,i=e.rightSingularVectors,s=e.diagonal;for(let o=0;o<s.length;o++)Math.abs(s[o])>t?s[o]=1/s[o]:s[o]=0;return i.mmul(C.diag(s).mmul(r.transpose()))}function _1(n,t=n,e={}){n=new C(n);let r=!1;if(typeof t=="object"&&!C.isMatrix(t)&&!pe.isAnyArray(t)?(e=t,t=n,r=!0):t=new C(t),n.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=e;i&&(n=n.center("column"),r||(t=t.center("column")));const s=n.transpose().mmul(t);for(let o=0;o<s.rows;o++)for(let a=0;a<s.columns;a++)s.set(o,a,s.get(o,a)*(1/(n.rows-1)));return s}function E1(n,t=n,e={}){n=new C(n);let r=!1;if(typeof t=="object"&&!C.isMatrix(t)&&!pe.isAnyArray(t)?(e=t,t=n,r=!0):t=new C(t),n.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:s=!0}=e;i&&(n.center("column"),r||t.center("column")),s&&(n.scale("column"),r||t.scale("column"));const o=n.standardDeviation("column",{unbiased:!0}),a=r?o:t.standardDeviation("column",{unbiased:!0}),u=n.transpose().mmul(t);for(let c=0;c<u.rows;c++)for(let f=0;f<u.columns;f++)u.set(c,f,u.get(c,f)*(1/(o[c]*a[f]))*(1/(n.rows-1)));return u}class vf{constructor(t,e={}){const{assumeSymmetric:r=!1}=e;if(t=be.checkMatrix(t),!t.isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let i=t.columns,s=new C(i,i),o=new Float64Array(i),a=new Float64Array(i),u=t,c,f,l=!1;if(r?l=!0:l=t.isSymmetric(),l){for(c=0;c<i;c++)for(f=0;f<i;f++)s.set(c,f,u.get(c,f));x1(i,a,o,s),N1(i,a,o,s)}else{let h=new C(i,i),g=new Float64Array(i);for(f=0;f<i;f++)for(c=0;c<i;c++)h.set(c,f,u.get(c,f));M1(i,h,g,s),S1(i,a,o,s,h)}this.n=i,this.e=a,this.d=o,this.V=s}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t=this.n,e=this.e,r=this.d,i=new C(t,t),s,o;for(s=0;s<t;s++){for(o=0;o<t;o++)i.set(s,o,0);i.set(s,s,r[s]),e[s]>0?i.set(s,s+1,e[s]):e[s]<0&&i.set(s,s-1,e[s])}return i}}function x1(n,t,e,r){let i,s,o,a,u,c,f,l;for(u=0;u<n;u++)e[u]=r.get(n-1,u);for(a=n-1;a>0;a--){for(l=0,o=0,c=0;c<a;c++)l=l+Math.abs(e[c]);if(l===0)for(t[a]=e[a-1],u=0;u<a;u++)e[u]=r.get(a-1,u),r.set(a,u,0),r.set(u,a,0);else{for(c=0;c<a;c++)e[c]/=l,o+=e[c]*e[c];for(i=e[a-1],s=Math.sqrt(o),i>0&&(s=-s),t[a]=l*s,o=o-i*s,e[a-1]=i-s,u=0;u<a;u++)t[u]=0;for(u=0;u<a;u++){for(i=e[u],r.set(u,a,i),s=t[u]+r.get(u,u)*i,c=u+1;c<=a-1;c++)s+=r.get(c,u)*e[c],t[c]+=r.get(c,u)*i;t[u]=s}for(i=0,u=0;u<a;u++)t[u]/=o,i+=t[u]*e[u];for(f=i/(o+o),u=0;u<a;u++)t[u]-=f*e[u];for(u=0;u<a;u++){for(i=e[u],s=t[u],c=u;c<=a-1;c++)r.set(c,u,r.get(c,u)-(i*t[c]+s*e[c]));e[u]=r.get(a-1,u),r.set(a,u,0)}}e[a]=o}for(a=0;a<n-1;a++){if(r.set(n-1,a,r.get(a,a)),r.set(a,a,1),o=e[a+1],o!==0){for(c=0;c<=a;c++)e[c]=r.get(c,a+1)/o;for(u=0;u<=a;u++){for(s=0,c=0;c<=a;c++)s+=r.get(c,a+1)*r.get(c,u);for(c=0;c<=a;c++)r.set(c,u,r.get(c,u)-s*e[c])}}for(c=0;c<=a;c++)r.set(c,a+1,0)}for(u=0;u<n;u++)e[u]=r.get(n-1,u),r.set(n-1,u,0);r.set(n-1,n-1,1),t[0]=0}function N1(n,t,e,r){let i,s,o,a,u,c,f,l,h,g,p,v,m,d,y,w;for(o=1;o<n;o++)t[o-1]=t[o];t[n-1]=0;let b=0,x=0,M=Number.EPSILON;for(c=0;c<n;c++){for(x=Math.max(x,Math.abs(e[c])+Math.abs(t[c])),f=c;f<n&&!(Math.abs(t[f])<=M*x);)f++;if(f>c)do{for(i=e[c],l=(e[c+1]-i)/(2*t[c]),h=Ce(l,1),l<0&&(h=-h),e[c]=t[c]/(l+h),e[c+1]=t[c]*(l+h),g=e[c+1],s=i-e[c],o=c+2;o<n;o++)e[o]-=s;for(b=b+s,l=e[f],p=1,v=p,m=p,d=t[c+1],y=0,w=0,o=f-1;o>=c;o--)for(m=v,v=p,w=y,i=p*t[o],s=p*l,h=Ce(l,t[o]),t[o+1]=y*h,y=t[o]/h,p=l/h,l=p*e[o]-y*i,e[o+1]=s+y*(p*i+y*e[o]),u=0;u<n;u++)s=r.get(u,o+1),r.set(u,o+1,y*r.get(u,o)+p*s),r.set(u,o,p*r.get(u,o)-y*s);l=-y*w*m*d*t[c]/g,t[c]=y*l,e[c]=p*l}while(Math.abs(t[c])>M*x);e[c]=e[c]+b,t[c]=0}for(o=0;o<n-1;o++){for(u=o,l=e[o],a=o+1;a<n;a++)e[a]<l&&(u=a,l=e[a]);if(u!==o)for(e[u]=e[o],e[o]=l,a=0;a<n;a++)l=r.get(a,o),r.set(a,o,r.get(a,u)),r.set(a,u,l)}}function M1(n,t,e,r){let i=0,s=n-1,o,a,u,c,f,l,h;for(l=i+1;l<=s-1;l++){for(h=0,c=l;c<=s;c++)h=h+Math.abs(t.get(c,l-1));if(h!==0){for(u=0,c=s;c>=l;c--)e[c]=t.get(c,l-1)/h,u+=e[c]*e[c];for(a=Math.sqrt(u),e[l]>0&&(a=-a),u=u-e[l]*a,e[l]=e[l]-a,f=l;f<n;f++){for(o=0,c=s;c>=l;c--)o+=e[c]*t.get(c,f);for(o=o/u,c=l;c<=s;c++)t.set(c,f,t.get(c,f)-o*e[c])}for(c=0;c<=s;c++){for(o=0,f=s;f>=l;f--)o+=e[f]*t.get(c,f);for(o=o/u,f=l;f<=s;f++)t.set(c,f,t.get(c,f)-o*e[f])}e[l]=h*e[l],t.set(l,l-1,h*a)}}for(c=0;c<n;c++)for(f=0;f<n;f++)r.set(c,f,c===f?1:0);for(l=s-1;l>=i+1;l--)if(t.get(l,l-1)!==0){for(c=l+1;c<=s;c++)e[c]=t.get(c,l-1);for(f=l;f<=s;f++){for(a=0,c=l;c<=s;c++)a+=e[c]*r.get(c,f);for(a=a/e[l]/t.get(l,l-1),c=l;c<=s;c++)r.set(c,f,r.get(c,f)+a*e[c])}}}function S1(n,t,e,r,i){let s=n-1,o=0,a=n-1,u=Number.EPSILON,c=0,f=0,l=0,h=0,g=0,p=0,v=0,m=0,d,y,w,b,x,M,N,E,O,_,S,q,R,T,I;for(d=0;d<n;d++)for((d<o||d>a)&&(e[d]=i.get(d,d),t[d]=0),y=Math.max(d-1,0);y<n;y++)f=f+Math.abs(i.get(d,y));for(;s>=o;){for(b=s;b>o&&(p=Math.abs(i.get(b-1,b-1))+Math.abs(i.get(b,b)),p===0&&(p=f),!(Math.abs(i.get(b,b-1))<u*p));)b--;if(b===s)i.set(s,s,i.get(s,s)+c),e[s]=i.get(s,s),t[s]=0,s--,m=0;else if(b===s-1){if(N=i.get(s,s-1)*i.get(s-1,s),l=(i.get(s-1,s-1)-i.get(s,s))/2,h=l*l+N,v=Math.sqrt(Math.abs(h)),i.set(s,s,i.get(s,s)+c),i.set(s-1,s-1,i.get(s-1,s-1)+c),E=i.get(s,s),h>=0){for(v=l>=0?l+v:l-v,e[s-1]=E+v,e[s]=e[s-1],v!==0&&(e[s]=E-N/v),t[s-1]=0,t[s]=0,E=i.get(s,s-1),p=Math.abs(E)+Math.abs(v),l=E/p,h=v/p,g=Math.sqrt(l*l+h*h),l=l/g,h=h/g,y=s-1;y<n;y++)v=i.get(s-1,y),i.set(s-1,y,h*v+l*i.get(s,y)),i.set(s,y,h*i.get(s,y)-l*v);for(d=0;d<=s;d++)v=i.get(d,s-1),i.set(d,s-1,h*v+l*i.get(d,s)),i.set(d,s,h*i.get(d,s)-l*v);for(d=o;d<=a;d++)v=r.get(d,s-1),r.set(d,s-1,h*v+l*r.get(d,s)),r.set(d,s,h*r.get(d,s)-l*v)}else e[s-1]=E+l,e[s]=E+l,t[s-1]=v,t[s]=-v;s=s-2,m=0}else{if(E=i.get(s,s),O=0,N=0,b<s&&(O=i.get(s-1,s-1),N=i.get(s,s-1)*i.get(s-1,s)),m===10){for(c+=E,d=o;d<=s;d++)i.set(d,d,i.get(d,d)-E);p=Math.abs(i.get(s,s-1))+Math.abs(i.get(s-1,s-2)),E=O=.75*p,N=-.4375*p*p}if(m===30&&(p=(O-E)/2,p=p*p+N,p>0)){for(p=Math.sqrt(p),O<E&&(p=-p),p=E-N/((O-E)/2+p),d=o;d<=s;d++)i.set(d,d,i.get(d,d)-p);c+=p,E=O=N=.964}for(m=m+1,x=s-2;x>=b&&(v=i.get(x,x),g=E-v,p=O-v,l=(g*p-N)/i.get(x+1,x)+i.get(x,x+1),h=i.get(x+1,x+1)-v-g-p,g=i.get(x+2,x+1),p=Math.abs(l)+Math.abs(h)+Math.abs(g),l=l/p,h=h/p,g=g/p,!(x===b||Math.abs(i.get(x,x-1))*(Math.abs(h)+Math.abs(g))<u*(Math.abs(l)*(Math.abs(i.get(x-1,x-1))+Math.abs(v)+Math.abs(i.get(x+1,x+1))))));)x--;for(d=x+2;d<=s;d++)i.set(d,d-2,0),d>x+2&&i.set(d,d-3,0);for(w=x;w<=s-1&&(T=w!==s-1,w!==x&&(l=i.get(w,w-1),h=i.get(w+1,w-1),g=T?i.get(w+2,w-1):0,E=Math.abs(l)+Math.abs(h)+Math.abs(g),E!==0&&(l=l/E,h=h/E,g=g/E)),E!==0);w++)if(p=Math.sqrt(l*l+h*h+g*g),l<0&&(p=-p),p!==0){for(w!==x?i.set(w,w-1,-p*E):b!==x&&i.set(w,w-1,-i.get(w,w-1)),l=l+p,E=l/p,O=h/p,v=g/p,h=h/l,g=g/l,y=w;y<n;y++)l=i.get(w,y)+h*i.get(w+1,y),T&&(l=l+g*i.get(w+2,y),i.set(w+2,y,i.get(w+2,y)-l*v)),i.set(w,y,i.get(w,y)-l*E),i.set(w+1,y,i.get(w+1,y)-l*O);for(d=0;d<=Math.min(s,w+3);d++)l=E*i.get(d,w)+O*i.get(d,w+1),T&&(l=l+v*i.get(d,w+2),i.set(d,w+2,i.get(d,w+2)-l*g)),i.set(d,w,i.get(d,w)-l),i.set(d,w+1,i.get(d,w+1)-l*h);for(d=o;d<=a;d++)l=E*r.get(d,w)+O*r.get(d,w+1),T&&(l=l+v*r.get(d,w+2),r.set(d,w+2,r.get(d,w+2)-l*g)),r.set(d,w,r.get(d,w)-l),r.set(d,w+1,r.get(d,w+1)-l*h)}}}if(f!==0){for(s=n-1;s>=0;s--)if(l=e[s],h=t[s],h===0)for(b=s,i.set(s,s,1),d=s-1;d>=0;d--){for(N=i.get(d,d)-l,g=0,y=b;y<=s;y++)g=g+i.get(d,y)*i.get(y,s);if(t[d]<0)v=N,p=g;else if(b=d,t[d]===0?i.set(d,s,N!==0?-g/N:-g/(u*f)):(E=i.get(d,d+1),O=i.get(d+1,d),h=(e[d]-l)*(e[d]-l)+t[d]*t[d],M=(E*p-v*g)/h,i.set(d,s,M),i.set(d+1,s,Math.abs(E)>Math.abs(v)?(-g-N*M)/E:(-p-O*M)/v)),M=Math.abs(i.get(d,s)),u*M*M>1)for(y=d;y<=s;y++)i.set(y,s,i.get(y,s)/M)}else if(h<0)for(b=s-1,Math.abs(i.get(s,s-1))>Math.abs(i.get(s-1,s))?(i.set(s-1,s-1,h/i.get(s,s-1)),i.set(s-1,s,-(i.get(s,s)-l)/i.get(s,s-1))):(I=vr(0,-i.get(s-1,s),i.get(s-1,s-1)-l,h),i.set(s-1,s-1,I[0]),i.set(s-1,s,I[1])),i.set(s,s-1,0),i.set(s,s,1),d=s-2;d>=0;d--){for(_=0,S=0,y=b;y<=s;y++)_=_+i.get(d,y)*i.get(y,s-1),S=S+i.get(d,y)*i.get(y,s);if(N=i.get(d,d)-l,t[d]<0)v=N,g=_,p=S;else if(b=d,t[d]===0?(I=vr(-_,-S,N,h),i.set(d,s-1,I[0]),i.set(d,s,I[1])):(E=i.get(d,d+1),O=i.get(d+1,d),q=(e[d]-l)*(e[d]-l)+t[d]*t[d]-h*h,R=(e[d]-l)*2*h,q===0&&R===0&&(q=u*f*(Math.abs(N)+Math.abs(h)+Math.abs(E)+Math.abs(O)+Math.abs(v))),I=vr(E*g-v*_+h*S,E*p-v*S-h*_,q,R),i.set(d,s-1,I[0]),i.set(d,s,I[1]),Math.abs(E)>Math.abs(v)+Math.abs(h)?(i.set(d+1,s-1,(-_-N*i.get(d,s-1)+h*i.get(d,s))/E),i.set(d+1,s,(-S-N*i.get(d,s)-h*i.get(d,s-1))/E)):(I=vr(-g-O*i.get(d,s-1),-p-O*i.get(d,s),v,h),i.set(d+1,s-1,I[0]),i.set(d+1,s,I[1]))),M=Math.max(Math.abs(i.get(d,s-1)),Math.abs(i.get(d,s))),u*M*M>1)for(y=d;y<=s;y++)i.set(y,s-1,i.get(y,s-1)/M),i.set(y,s,i.get(y,s)/M)}for(d=0;d<n;d++)if(d<o||d>a)for(y=d;y<n;y++)r.set(d,y,i.get(d,y));for(y=n-1;y>=o;y--)for(d=o;d<=a;d++){for(v=0,w=o;w<=Math.min(y,a);w++)v=v+r.get(d,w)*i.get(w,y);r.set(d,y,v)}}}function vr(n,t,e,r){let i,s;return Math.abs(e)>Math.abs(r)?(i=r/e,s=e+i*r,[(n+i*t)/s,(t-i*n)/s]):(i=e/r,s=r+i*e,[(i*n+t)/s,(i*t-n)/s])}class mf{constructor(t){if(t=be.checkMatrix(t),!t.isSymmetric())throw new Error("Matrix is not symmetric");let e=t,r=e.rows,i=new C(r,r),s=!0,o,a,u;for(a=0;a<r;a++){let c=0;for(u=0;u<a;u++){let f=0;for(o=0;o<u;o++)f+=i.get(u,o)*i.get(a,o);f=(e.get(a,u)-f)/i.get(u,u),i.set(a,u,f),c=c+f*f}for(c=e.get(a,a)-c,s&=c>0,i.set(a,a,Math.sqrt(Math.max(c,0))),u=a+1;u<r;u++)i.set(a,u,0)}this.L=i,this.positiveDefinite=!!s}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=be.checkMatrix(t);let e=this.L,r=e.rows;if(t.rows!==r)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let i=t.columns,s=t.clone(),o,a,u;for(u=0;u<r;u++)for(a=0;a<i;a++){for(o=0;o<u;o++)s.set(u,a,s.get(u,a)-s.get(o,a)*e.get(u,o));s.set(u,a,s.get(u,a)/e.get(u,u))}for(u=r-1;u>=0;u--)for(a=0;a<i;a++){for(o=u+1;o<r;o++)s.set(u,a,s.get(u,a)-s.get(o,a)*e.get(o,u));s.set(u,a,s.get(u,a)/e.get(u,u))}return s}get lowerTriangularMatrix(){return this.L}}class yf{constructor(t,e={}){t=be.checkMatrix(t);let{Y:r}=e;const{scaleScores:i=!1,maxIterations:s=1e3,terminationCriteria:o=1e-10}=e;let a;if(r){if(pe.isAnyArray(r)&&typeof r[0]=="number"?r=C.columnVector(r):r=be.checkMatrix(r),r.rows!==t.rows)throw new Error("Y should have the same number of rows as X");a=r.getColumnVector(0)}else a=t.getColumnVector(0);let u=1,c,f,l,h;for(let g=0;g<s&&u>o;g++)l=t.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),l=l.div(l.norm()),c=t.mmul(l).div(l.transpose().mmul(l).get(0,0)),g>0&&(u=c.clone().sub(h).pow(2).sum()),h=c.clone(),r?(f=r.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),f=f.div(f.norm()),a=r.mmul(f).div(f.transpose().mmul(f).get(0,0))):a=c;if(r){let g=t.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0));g=g.div(g.norm());let p=t.clone().sub(c.clone().mmul(g.transpose())),v=a.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),m=r.clone().sub(c.clone().mulS(v.get(0,0)).mmul(f.transpose()));this.t=c,this.p=g.transpose(),this.w=l.transpose(),this.q=f,this.u=a,this.s=c.transpose().mmul(c),this.xResidual=p,this.yResidual=m,this.betas=v}else this.w=l.transpose(),this.s=c.transpose().mmul(c).sqrt(),i?this.t=c.clone().div(this.s.get(0,0)):this.t=c,this.xResidual=t.sub(c.mmul(l.transpose()))}}X.AbstractMatrix=Y,X.CHO=mf,X.CholeskyDecomposition=mf,X.DistanceMatrix=hr,X.EVD=vf,X.EigenvalueDecomposition=vf,X.LU=gr,X.LuDecomposition=gr;var wf=X.Matrix=C;X.MatrixColumnSelectionView=u1,X.MatrixColumnView=a1,X.MatrixFlipColumnView=c1,X.MatrixFlipRowView=f1,X.MatrixRowSelectionView=h1,X.MatrixRowView=l1,X.MatrixSelectionView=dr,X.MatrixSubView=d1,X.MatrixTransposeView=g1,X.NIPALS=yf,X.Nipals=yf,X.QR=Nn,X.QrDecomposition=Nn,X.SVD=wt;var R1=X.SingularValueDecomposition=wt;X.SymmetricMatrix=it,X.WrapperMatrix1D=gf,X.WrapperMatrix2D=be,X.correlation=E1,X.covariance=_1;var bf=X.default=C;X.determinant=pr,X.inverse=v1,X.linearDependencies=w1,X.pseudoInverse=b1,X.solve=pf,X.wrap=p1;const Ye=wf,_f=R1;bf.Matrix&&bf.Matrix;const q1={center:[0,0],linkDistance:50};class Ef{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},q1),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericMDSLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericMDSLayout(!0,t,e)})}genericMDSLayout(t,e,r){return $(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),r),{center:s=[0,0],linkDistance:o=50}=i,a=e.getAllNodes(),u=e.getAllEdges();if(!(a!=null&&a.length)||a.length===1)return nt(e,t,s);const c=Xc({nodes:a,edges:u}),f=Kc(c);O1(f);const l=Iy(f,o),h=A1(l),g=[];return h.forEach((v,m)=>{const d=we(a[m]);d.data.x=v[0]+s[0],d.data.y=v[1]+s[1],g.push(d)}),t&&g.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:g,edges:u}})}}const O1=n=>{let t=-999999;n.forEach(e=>{e.forEach(r=>{r!==1/0&&t<r&&(t=r)})}),n.forEach((e,r)=>{e.forEach((i,s)=>{i===1/0&&(n[r][s]=t)})})},A1=n=>{const e=Ye.mul(Ye.pow(n,2),-.5),r=e.mean("row"),i=e.mean("column"),s=e.mean();e.add(s).subRowVector(r).subColumnVector(i);const o=new _f(e),a=Ye.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(u=>Ye.mul([u],[a]).toJSON()[0].splice(0,2))};function xf(n){return!!n.tick&&!!n.stop}const I1={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},T1={center:[0,0],comboPadding:10,treeKey:"combo"};class k1{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},T1),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,t,e)})}genericComboCombinedLayout(t,e,r){return $(this,void 0,void 0,function*(){const i=this.initVals(Object.assign(Object.assign({},this.options),r)),{center:s,treeKey:o,outerLayout:a}=i,u=e.getAllNodes().filter(E=>!E.data._isCombo),c=e.getAllNodes().filter(E=>E.data._isCombo),f=e.getAllEdges(),l=u==null?void 0:u.length;if(!l||l===1)return nt(e,t,s);const h=[],g=new Map;u.forEach(E=>{g.set(E.id,E)});const p=new Map;c.forEach(E=>{p.set(E.id,E)});const v=new Map,m=this.getInnerGraphs(e,o,g,p,f,i,v);yield Promise.all(m);const d=new Map,y=[],w=new Map;let b=!0;e.getRoots(o).forEach(E=>{const O=v.get(E.id),_=p.get(E.id)||g.get(E.id),S={id:E.id,data:Object.assign(Object.assign({},E.data),{x:O.data.x||_.data.x,y:O.data.y||_.data.y,fx:O.data.fx||_.data.fx,fy:O.data.fy||_.data.fy,mass:O.data.mass||_.data.mass,size:O.data.size})};y.push(S),d.set(E.id,!0),!isNaN(S.data.x)&&S.data.x!==0&&!isNaN(S.data.y)&&S.data.y!==0?b=!1:(S.data.x=Math.random()*100,S.data.y=Math.random()*100),gn(e,[E],q=>{q.id!==E.id&&w.set(q.id,E.id)},"TB",o)});const x=[];f.forEach(E=>{const O=w.get(E.source)||E.source,_=w.get(E.target)||E.target;O!==_&&d.has(O)&&d.has(_)&&x.push({id:E.id,source:O,target:_,data:{}})});let M;if(y!=null&&y.length){if(y.length===1)y[0].data.x=s[0],y[0].data.y=s[1];else{const E=new ue({nodes:y,edges:x}),O=a||new sf;b&&I1[O.id]&&(yield(y.length<100?new Ef:new vn).assign(E));const _=Object.assign({center:s,kg:5,preventOverlap:!0,animate:!1},O.id==="force"?{gravity:1,factor:4,linkDistance:(S,q,R)=>{const T=Math.max(...q.data.size)||32,I=Math.max(...R.data.size)||32;return T/2+I/2+200}}:{});M=yield Nf(O,E,_)}v.forEach(E=>{var O;const _=M.nodes.find(R=>R.id===E.id);if(_){const{x:R,y:T}=_.data;E.data.visited=!0,E.data.x=R,E.data.y=T,h.push({id:E.id,data:{x:R,y:T}})}const{x:S,y:q}=E.data;(O=E.data.nodes)===null||O===void 0||O.forEach(R=>{h.push({id:R.id,data:{x:R.data.x+S,y:R.data.y+q}})})}),v.forEach(({data:E})=>{const{x:O,y:_,visited:S,nodes:q}=E;q==null||q.forEach(R=>{if(!S){const T=h.find(I=>I.id===R.id);T.data.x+=O||0,T.data.y+=_||0}})})}return t&&h.forEach(E=>{e.mergeNodeData(E.id,{x:E.data.x,y:E.data.y})}),{nodes:h,edges:f}})}initVals(t){const e=Object.assign({},t),{nodeSize:r,spacing:i,comboPadding:s}=t;let o,a;if(U(i)?a=()=>i:xe(i)?a=i:a=()=>0,e.spacing=a,!r)o=c=>{const f=a(c);return c.size?he(c.size)?((c.size[0]>c.size[1]?c.size[0]:c.size[1])+f)/2:Ge(c.size)?((c.size.width>c.size.height?c.size.width:c.size.height)+f)/2:(c.size+f)/2:32+f/2};else if(xe(r))o=c=>{const f=r(c),l=a(c);return he(c.size)?((c.size[0]>c.size[1]?c.size[0]:c.size[1])+l)/2:((f||32)+l)/2};else if(he(r)){const f=(r[0]>r[1]?r[0]:r[1])/2;o=l=>f+a(l)/2}else{const c=r/2;o=f=>c+a(f)/2}e.nodeSize=o;let u;return U(s)?u=()=>s:he(s)?u=()=>Math.max.apply(null,s):xe(s)?u=s:u=()=>0,e.comboPadding=u,e}getInnerGraphs(t,e,r,i,s,o,a){const{nodeSize:u,comboPadding:c,spacing:f,innerLayout:l}=o,h=l||new vn({}),g={center:[0,0],preventOverlap:!0,nodeSpacing:f},p=[],v=m=>{let d=(c==null?void 0:c(m))||10;return he(d)&&(d=Math.max(...d)),{size:d?[d*2,d*2]:[30,30],padding:d}};return t.getRoots(e).forEach(m=>{a.set(m.id,{id:m.id,data:{nodes:[],size:v(m).size}});let d=Promise.resolve();gn(t,[m],y=>{var w;if(!y.data._isCombo)return;const{size:b,padding:x}=v(y);if(!(!((w=t.getChildren(y.id,e))===null||w===void 0)&&w.length))a.set(y.id,{id:y.id,data:Object.assign(Object.assign({},y.data),{size:b})});else{const M=a.get(y.id);a.set(y.id,{id:y.id,data:Object.assign({nodes:[]},M==null?void 0:M.data)});const N=new Map,E=t.getChildren(y.id,e).map(S=>{if(S.data._isCombo)return a.has(S.id)||a.set(S.id,{id:S.id,data:Object.assign({},S.data)}),N.set(S.id,!0),a.get(S.id);const q=r.get(S.id)||i.get(S.id);return N.set(S.id,!0),{id:S.id,data:Object.assign(Object.assign({},q.data),S.data)}}),O={nodes:E,edges:s.filter(S=>N.has(S.source)&&N.has(S.target))};let _=1/0;E.forEach(S=>{var q;let{size:R}=S.data;R||(R=((q=a.get(S.id))===null||q===void 0?void 0:q.data.size)||(u==null?void 0:u(S))||[30,30]),U(R)&&(R=[R,R]);const[T,I]=R;_>T&&(_=T),_>I&&(_=I),S.data.size=R}),d=d.then(()=>$(this,void 0,void 0,function*(){const S=new ue(O);yield Nf(h,S,g,!0);const{minX:q,minY:R,maxX:T,maxY:I}=Ty(E),j={x:(T+q)/2,y:(I+R)/2};O.nodes.forEach(A=>{A.data.x-=j.x,A.data.y-=j.y});const F=[Math.max(T-q,_)+x*2,Math.max(I-R,_)+x*2];a.get(y.id).data.size=F,a.get(y.id).data.nodes=E}))}return!0},"BT",e),p.push(d)}),p}}function Nf(n,t,e,r){var i;return $(this,void 0,void 0,function*(){return xf(n)?(n.execute(t,e),n.stop(),n.tick((i=e.iterations)!==null&&i!==void 0?i:300)):r?yield n.assign(t,e):yield n.execute(t,e)})}function j1(n,t){var e,r=1;n==null&&(n=0),t==null&&(t=0);function i(){var s,o=e.length,a,u=0,c=0;for(s=0;s<o;++s)a=e[s],u+=a.x,c+=a.y;for(u=(u/o-n)*r,c=(c/o-t)*r,s=0;s<o;++s)a=e[s],a.x-=u,a.y-=c}return i.initialize=function(s){e=s},i.x=function(s){return arguments.length?(n=+s,i):n},i.y=function(s){return arguments.length?(t=+s,i):t},i.strength=function(s){return arguments.length?(r=+s,i):r},i}function ae(n){return function(){return n}}function Ke(n){return(n()-.5)*1e-6}function C1(n){return n.x+n.vx}function P1(n){return n.y+n.vy}function L1(n){var t,e,r,i=1,s=1;typeof n!="function"&&(n=ae(n==null?1:+n));function o(){for(var c,f=t.length,l,h,g,p,v,m,d=0;d<s;++d)for(l=pt(t,C1,P1).visitAfter(a),c=0;c<f;++c)h=t[c],v=e[h.index],m=v*v,g=h.x+h.vx,p=h.y+h.vy,l.visit(y);function y(w,b,x,M,N){var E=w.data,O=w.r,_=v+O;if(E){if(E.index>h.index){var S=g-E.x-E.vx,q=p-E.y-E.vy,R=S*S+q*q;R<_*_&&(S===0&&(S=Ke(r),R+=S*S),q===0&&(q=Ke(r),R+=q*q),R=(_-(R=Math.sqrt(R)))/R*i,h.vx+=(S*=R)*(_=(O*=O)/(m+O)),h.vy+=(q*=R)*_,E.vx-=S*(_=1-_),E.vy-=q*_)}return}return b>g+_||M<g-_||x>p+_||N<p-_}}function a(c){if(c.data)return c.r=e[c.data.index];for(var f=c.r=0;f<4;++f)c[f]&&c[f].r>c.r&&(c.r=c[f].r)}function u(){if(t){var c,f=t.length,l;for(e=new Array(f),c=0;c<f;++c)l=t[c],e[l.index]=+n(l,c,t)}}return o.initialize=function(c,f){t=c,r=f,u()},o.iterations=function(c){return arguments.length?(s=+c,o):s},o.strength=function(c){return arguments.length?(i=+c,o):i},o.radius=function(c){return arguments.length?(n=typeof c=="function"?c:ae(+c),u(),o):n},o}function D1(n){return n.index}function Mf(n,t){var e=n.get(t);if(!e)throw new Error("node not found: "+t);return e}function z1(n){var t=D1,e=l,r,i=ae(30),s,o,a,u,c,f=1;n==null&&(n=[]);function l(m){return 1/Math.min(a[m.source.index],a[m.target.index])}function h(m){for(var d=0,y=n.length;d<f;++d)for(var w=0,b,x,M,N,E,O,_;w<y;++w)b=n[w],x=b.source,M=b.target,N=M.x+M.vx-x.x-x.vx||Ke(c),E=M.y+M.vy-x.y-x.vy||Ke(c),O=Math.sqrt(N*N+E*E),O=(O-s[w])/O*m*r[w],N*=O,E*=O,M.vx-=N*(_=u[w]),M.vy-=E*_,x.vx+=N*(_=1-_),x.vy+=E*_}function g(){if(o){var m,d=o.length,y=n.length,w=new Map(o.map((x,M)=>[t(x,M,o),x])),b;for(m=0,a=new Array(d);m<y;++m)b=n[m],b.index=m,typeof b.source!="object"&&(b.source=Mf(w,b.source)),typeof b.target!="object"&&(b.target=Mf(w,b.target)),a[b.source.index]=(a[b.source.index]||0)+1,a[b.target.index]=(a[b.target.index]||0)+1;for(m=0,u=new Array(y);m<y;++m)b=n[m],u[m]=a[b.source.index]/(a[b.source.index]+a[b.target.index]);r=new Array(y),p(),s=new Array(y),v()}}function p(){if(o)for(var m=0,d=n.length;m<d;++m)r[m]=+e(n[m],m,n)}function v(){if(o)for(var m=0,d=n.length;m<d;++m)s[m]=+i(n[m],m,n)}return h.initialize=function(m,d){o=m,c=d,g()},h.links=function(m){return arguments.length?(n=m,g(),h):n},h.id=function(m){return arguments.length?(t=m,h):t},h.iterations=function(m){return arguments.length?(f=+m,h):f},h.strength=function(m){return arguments.length?(e=typeof m=="function"?m:ae(+m),p(),h):e},h.distance=function(m){return arguments.length?(i=typeof m=="function"?m:ae(+m),v(),h):i},h}var $1={value:()=>{}};function Mn(){for(var n=0,t=arguments.length,e={},r;n<t;++n){if(!(r=arguments[n]+"")||r in e||/[\s.]/.test(r))throw new Error("illegal type: "+r);e[r]=[]}return new mr(e)}function mr(n){this._=n}function F1(n,t){return n.trim().split(/^|\s+/).map(function(e){var r="",i=e.indexOf(".");if(i>=0&&(r=e.slice(i+1),e=e.slice(0,i)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:r}})}mr.prototype=Mn.prototype={constructor:mr,on:function(n,t){var e=this._,r=F1(n+"",e),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(n=r[s]).type)&&(i=B1(e[i],n.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<o;)if(i=(n=r[s]).type)e[i]=Sf(e[i],n.name,t);else if(t==null)for(i in e)e[i]=Sf(e[i],n.name,null);return this},copy:function(){var n={},t=this._;for(var e in t)n[e]=t[e].slice();return new mr(n)},call:function(n,t){if((i=arguments.length-2)>0)for(var e=new Array(i),r=0,i,s;r<i;++r)e[r]=arguments[r+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(s=this._[n],r=0,i=s.length;r<i;++r)s[r].value.apply(t,e)},apply:function(n,t,e){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var r=this._[n],i=0,s=r.length;i<s;++i)r[i].value.apply(t,e)}};function B1(n,t){for(var e=0,r=n.length,i;e<r;++e)if((i=n[e]).name===t)return i.value}function Sf(n,t,e){for(var r=0,i=n.length;r<i;++r)if(n[r].name===t){n[r]=$1,n=n.slice(0,r).concat(n.slice(r+1));break}return e!=null&&n.push({name:t,value:e}),n}var bt=0,Pt=0,Lt=0,Rf=1e3,yr,Dt,wr=0,st=0,br=0,zt=typeof performance=="object"&&performance.now?performance:Date,qf=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function Of(){return st||(qf(U1),st=zt.now()+br)}function U1(){st=0}function Sn(){this._call=this._time=this._next=null}Sn.prototype=Rn.prototype={constructor:Sn,restart:function(n,t,e){if(typeof n!="function")throw new TypeError("callback is not a function");e=(e==null?Of():+e)+(t==null?0:+t),!this._next&&Dt!==this&&(Dt?Dt._next=this:yr=this,Dt=this),this._call=n,this._time=e,qn()},stop:function(){this._call&&(this._call=null,this._time=1/0,qn())}};function Rn(n,t,e){var r=new Sn;return r.restart(n,t,e),r}function G1(){Of(),++bt;for(var n=yr,t;n;)(t=st-n._time)>=0&&n._call.call(void 0,t),n=n._next;--bt}function Af(){st=(wr=zt.now())+br,bt=Pt=0;try{G1()}finally{bt=0,W1(),st=0}}function V1(){var n=zt.now(),t=n-wr;t>Rf&&(br-=t,wr=n)}function W1(){for(var n,t=yr,e,r=1/0;t;)t._call?(r>t._time&&(r=t._time),n=t,t=t._next):(e=t._next,t._next=null,t=n?n._next=e:yr=e);Dt=n,qn(r)}function qn(n){if(!bt){Pt&&(Pt=clearTimeout(Pt));var t=n-st;t>24?(n<1/0&&(Pt=setTimeout(Af,n-zt.now()-br)),Lt&&(Lt=clearInterval(Lt))):(Lt||(wr=zt.now(),Lt=setInterval(V1,Rf)),bt=1,qf(Af))}}const Y1=1664525,K1=1013904223,If=4294967296;function X1(){let n=1;return()=>(n=(Y1*n+K1)%If)/If}function Z1(n){return n.x}function J1(n){return n.y}var Q1=10,H1=Math.PI*(3-Math.sqrt(5));function eb(n){var t,e=1,r=.001,i=1-Math.pow(r,1/300),s=0,o=.6,a=new Map,u=Rn(l),c=Mn("tick","end"),f=X1();n==null&&(n=[]);function l(){h(),c.call("tick",t),e<r&&(u.stop(),c.call("end",t))}function h(v){var m,d=n.length,y;v===void 0&&(v=1);for(var w=0;w<v;++w)for(e+=(s-e)*i,a.forEach(function(b){b(e)}),m=0;m<d;++m)y=n[m],y.fx==null?y.x+=y.vx*=o:(y.x=y.fx,y.vx=0),y.fy==null?y.y+=y.vy*=o:(y.y=y.fy,y.vy=0);return t}function g(){for(var v=0,m=n.length,d;v<m;++v){if(d=n[v],d.index=v,d.fx!=null&&(d.x=d.fx),d.fy!=null&&(d.y=d.fy),isNaN(d.x)||isNaN(d.y)){var y=Q1*Math.sqrt(.5+v),w=v*H1;d.x=y*Math.cos(w),d.y=y*Math.sin(w)}(isNaN(d.vx)||isNaN(d.vy))&&(d.vx=d.vy=0)}}function p(v){return v.initialize&&v.initialize(n,f),v}return g(),t={tick:h,restart:function(){return u.restart(l),t},stop:function(){return u.stop(),t},nodes:function(v){return arguments.length?(n=v,g(),a.forEach(p),t):n},alpha:function(v){return arguments.length?(e=+v,t):e},alphaMin:function(v){return arguments.length?(r=+v,t):r},alphaDecay:function(v){return arguments.length?(i=+v,t):+i},alphaTarget:function(v){return arguments.length?(s=+v,t):s},velocityDecay:function(v){return arguments.length?(o=1-v,t):1-o},randomSource:function(v){return arguments.length?(f=v,a.forEach(p),t):f},force:function(v,m){return arguments.length>1?(m==null?a.delete(v):a.set(v,p(m)),t):a.get(v)},find:function(v,m,d){var y=0,w=n.length,b,x,M,N,E;for(d==null?d=1/0:d*=d,y=0;y<w;++y)N=n[y],b=v-N.x,x=m-N.y,M=b*b+x*x,M<d&&(E=N,d=M);return E},on:function(v,m){return arguments.length>1?(c.on(v,m),t):c.on(v)}}}function tb(){var n,t,e,r,i=ae(-30),s,o=1,a=1/0,u=.81;function c(g){var p,v=n.length,m=pt(n,Z1,J1).visitAfter(l);for(r=g,p=0;p<v;++p)t=n[p],m.visit(h)}function f(){if(n){var g,p=n.length,v;for(s=new Array(p),g=0;g<p;++g)v=n[g],s[v.index]=+i(v,g,n)}}function l(g){var p=0,v,m,d=0,y,w,b;if(g.length){for(y=w=b=0;b<4;++b)(v=g[b])&&(m=Math.abs(v.value))&&(p+=v.value,d+=m,y+=m*v.x,w+=m*v.y);g.x=y/d,g.y=w/d}else{v=g,v.x=v.data.x,v.y=v.data.y;do p+=s[v.data.index];while(v=v.next)}g.value=p}function h(g,p,v,m){if(!g.value)return!0;var d=g.x-t.x,y=g.y-t.y,w=m-p,b=d*d+y*y;if(w*w/u<b)return b<a&&(d===0&&(d=Ke(e),b+=d*d),y===0&&(y=Ke(e),b+=y*y),b<o&&(b=Math.sqrt(o*b)),t.vx+=d*g.value*r/b,t.vy+=y*g.value*r/b),!0;if(g.length||b>=a)return;(g.data!==t||g.next)&&(d===0&&(d=Ke(e),b+=d*d),y===0&&(y=Ke(e),b+=y*y),b<o&&(b=Math.sqrt(o*b)));do g.data!==t&&(w=s[g.data.index]*r/b,t.vx+=d*w,t.vy+=y*w);while(g=g.next)}return c.initialize=function(g,p){n=g,e=p,f()},c.strength=function(g){return arguments.length?(i=typeof g=="function"?g:ae(+g),f(),c):i},c.distanceMin=function(g){return arguments.length?(o=g*g,c):Math.sqrt(o)},c.distanceMax=function(g){return arguments.length?(a=g*g,c):Math.sqrt(a)},c.theta=function(g){return arguments.length?(u=g*g,c):Math.sqrt(u)},c}function rb(n,t,e){var r,i=ae(.1),s,o;typeof n!="function"&&(n=ae(+n)),t==null&&(t=0),e==null&&(e=0);function a(c){for(var f=0,l=r.length;f<l;++f){var h=r[f],g=h.x-t||1e-6,p=h.y-e||1e-6,v=Math.sqrt(g*g+p*p),m=(o[f]-v)*s[f]*c/v;h.vx+=g*m,h.vy+=p*m}}function u(){if(r){var c,f=r.length;for(s=new Array(f),o=new Array(f),c=0;c<f;++c)o[c]=+n(r[c],c,r),s[c]=isNaN(o[c])?0:+i(r[c],c,r)}}return a.initialize=function(c){r=c,u()},a.strength=function(c){return arguments.length?(i=typeof c=="function"?c:ae(+c),u(),a):i},a.radius=function(c){return arguments.length?(n=typeof c=="function"?c:ae(+c),u(),a):n},a.x=function(c){return arguments.length?(t=+c,a):t},a.y=function(c){return arguments.length?(e=+c,a):e},a}function nb(n){var t=ae(.1),e,r,i;typeof n!="function"&&(n=ae(n==null?0:+n));function s(a){for(var u=0,c=e.length,f;u<c;++u)f=e[u],f.vx+=(i[u]-f.x)*r[u]*a}function o(){if(e){var a,u=e.length;for(r=new Array(u),i=new Array(u),a=0;a<u;++a)r[a]=isNaN(i[a]=+n(e[a],a,e))?0:+t(e[a],a,e)}}return s.initialize=function(a){e=a,o()},s.strength=function(a){return arguments.length?(t=typeof a=="function"?a:ae(+a),o(),s):t},s.x=function(a){return arguments.length?(n=typeof a=="function"?a:ae(+a),o(),s):n},s}function ib(n){var t=ae(.1),e,r,i;typeof n!="function"&&(n=ae(n==null?0:+n));function s(a){for(var u=0,c=e.length,f;u<c;++u)f=e[u],f.vy+=(i[u]-f.y)*r[u]*a}function o(){if(e){var a,u=e.length;for(r=new Array(u),i=new Array(u),a=0;a<u;++a)r[a]=isNaN(i[a]=+n(e[a],a,e))?0:+t(e[a],a,e)}}return s.initialize=function(a){e=a,o()},s.strength=function(a){return arguments.length?(t=typeof a=="function"?a:ae(+a),o(),s):t},s.y=function(a){return arguments.length?(n=typeof a=="function"?a:ae(+a),o(),s):n},s}class Tf{constructor(t){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:z1,manyBody:tb,center:j1,collide:L1,radial:rb,x:nb,y:ib},this.options={link:{id:e=>e.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},mc(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericLayout(!0,t,e)})}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const r=this.context.nodes.find(i=>i.id===t);r&&e.forEach((i,s)=>{if(typeof i=="number"||i===null){const o=["fx","fy","fz"][s];r[o]=i}})}getOptions(t){var e,r;const i=mc({},this.options,t);return i.collide&&((e=i.collide)===null||e===void 0?void 0:e.radius)===void 0&&(i.collide=i.collide||{},i.collide.radius=(r=i.nodeSize)!==null&&r!==void 0?r:10),i.iterations===void 0&&(i.link&&i.link.iterations===void 0&&(i.iterations=i.link.iterations),i.collide&&i.collide.iterations===void 0&&(i.iterations=i.collide.iterations)),this.context.options=i,i}genericLayout(t,e,r){var i;return $(this,void 0,void 0,function*(){const s=this.getOptions(r),o=e.getAllNodes().map(({id:f,data:l})=>Object.assign(Object.assign({id:f},l),yc(l.data,this.config.inputNodeAttrs))),a=e.getAllEdges().map(f=>Object.assign({},f));Object.assign(this.context,{assign:t,nodes:o,edges:a,graph:e});const u=new Promise(f=>{this.resolver=f}),c=this.setSimulation(s);return c.nodes(o),(i=c.force("link"))===null||i===void 0||i.links(a),u})}getResult(){const{assign:t,nodes:e,edges:r,graph:i}=this.context,s=e.map(a=>({id:a.id,data:Object.assign(Object.assign({},a.data),yc(a,this.config.outputNodeAttrs))})),o=r.map(({id:a,source:u,target:c,data:f})=>({id:a,source:typeof u=="object"?u.id:u,target:typeof c=="object"?c.id:c,data:f}));return t&&s.forEach(a=>i.mergeNodeData(a.id,a.data)),{nodes:s,edges:o}}initSimulation(){return eb()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",()=>{var r;return(r=t.onTick)===null||r===void 0?void 0:r.call(t,this.getResult())}).on("end",()=>{var r;return(r=this.resolver)===null||r===void 0?void 0:r.call(this,this.getResult())})),kf(e,this.config.simulationAttrs.map(r=>[r,t[r]])),Object.entries(this.forceMap).forEach(([r,i])=>{const s=r;if(t[r]){let o=e.force(s);o||(o=i(),e.force(s,o)),kf(o,Object.entries(t[s]))}else e.force(s,null)}),e}}const kf=(n,t)=>t.reduce((e,[r,i])=>!e[r]||i===void 0?e:e[r].call(n,i),n);function sb(n,t,e){var r,i=1;n==null&&(n=0),t==null&&(t=0),e==null&&(e=0);function s(){var o,a=r.length,u,c=0,f=0,l=0;for(o=0;o<a;++o)u=r[o],c+=u.x||0,f+=u.y||0,l+=u.z||0;for(c=(c/a-n)*i,f=(f/a-t)*i,l=(l/a-e)*i,o=0;o<a;++o)u=r[o],c&&(u.x-=c),f&&(u.y-=f),l&&(u.z-=l)}return s.initialize=function(o){r=o},s.x=function(o){return arguments.length?(n=+o,s):n},s.y=function(o){return arguments.length?(t=+o,s):t},s.z=function(o){return arguments.length?(e=+o,s):e},s.strength=function(o){return arguments.length?(i=+o,s):i},s}function ob(n){const t=+this._x.call(null,n);return jf(this.cover(t),t,n)}function jf(n,t,e){if(isNaN(t))return n;var r,i=n._root,s={data:e},o=n._x0,a=n._x1,u,c,f,l,h;if(!i)return n._root=s,n;for(;i.length;)if((f=t>=(u=(o+a)/2))?o=u:a=u,r=i,!(i=i[l=+f]))return r[l]=s,n;if(c=+n._x.call(null,i.data),t===c)return s.next=i,r?r[l]=s:n._root=s,n;do r=r?r[l]=new Array(2):n._root=new Array(2),(f=t>=(u=(o+a)/2))?o=u:a=u;while((l=+f)==(h=+(c>=u)));return r[h]=i,r[l]=s,n}function ab(n){Array.isArray(n)||(n=Array.from(n));const t=n.length,e=new Float64Array(t);let r=1/0,i=-1/0;for(let s=0,o;s<t;++s)isNaN(o=+this._x.call(null,n[s]))||(e[s]=o,o<r&&(r=o),o>i&&(i=o));if(r>i)return this;this.cover(r).cover(i);for(let s=0;s<t;++s)jf(this,e[s],n[s]);return this}function ub(n){if(isNaN(n=+n))return this;var t=this._x0,e=this._x1;if(isNaN(t))e=(t=Math.floor(n))+1;else{for(var r=e-t||1,i=this._root,s,o;t>n||n>=e;)switch(o=+(n<t),s=new Array(2),s[o]=i,i=s,r*=2,o){case 0:e=t+r;break;case 1:t=e-r;break}this._root&&this._root.length&&(this._root=i)}return this._x0=t,this._x1=e,this}function cb(){var n=[];return this.visit(function(t){if(!t.length)do n.push(t.data);while(t=t.next)}),n}function fb(n){return arguments.length?this.cover(+n[0][0]).cover(+n[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function Pe(n,t,e){this.node=n,this.x0=t,this.x1=e}function lb(n,t){var e,r=this._x0,i,s,o=this._x1,a=[],u=this._root,c,f;for(u&&a.push(new Pe(u,r,o)),t==null?t=1/0:(r=n-t,o=n+t);c=a.pop();)if(!(!(u=c.node)||(i=c.x0)>o||(s=c.x1)<r))if(u.length){var l=(i+s)/2;a.push(new Pe(u[1],l,s),new Pe(u[0],i,l)),(f=+(n>=l))&&(c=a[a.length-1],a[a.length-1]=a[a.length-1-f],a[a.length-1-f]=c)}else{var h=Math.abs(n-+this._x.call(null,u.data));h<t&&(t=h,r=n-h,o=n+h,e=u.data)}return e}function hb(n){if(isNaN(u=+this._x.call(null,n)))return this;var t,e=this._root,r,i,s,o=this._x0,a=this._x1,u,c,f,l,h;if(!e)return this;if(e.length)for(;;){if((f=u>=(c=(o+a)/2))?o=c:a=c,t=e,!(e=e[l=+f]))return this;if(!e.length)break;t[l+1&1]&&(r=t,h=l)}for(;e.data!==n;)if(i=e,!(e=e.next))return this;return(s=e.next)&&delete e.next,i?(s?i.next=s:delete i.next,this):t?(s?t[l]=s:delete t[l],(e=t[0]||t[1])&&e===(t[1]||t[0])&&!e.length&&(r?r[h]=e:this._root=e),this):(this._root=s,this)}function db(n){for(var t=0,e=n.length;t<e;++t)this.remove(n[t]);return this}function gb(){return this._root}function pb(){var n=0;return this.visit(function(t){if(!t.length)do++n;while(t=t.next)}),n}function vb(n){var t=[],e,r=this._root,i,s,o;for(r&&t.push(new Pe(r,this._x0,this._x1));e=t.pop();)if(!n(r=e.node,s=e.x0,o=e.x1)&&r.length){var a=(s+o)/2;(i=r[1])&&t.push(new Pe(i,a,o)),(i=r[0])&&t.push(new Pe(i,s,a))}return this}function mb(n){var t=[],e=[],r;for(this._root&&t.push(new Pe(this._root,this._x0,this._x1));r=t.pop();){var i=r.node;if(i.length){var s,o=r.x0,a=r.x1,u=(o+a)/2;(s=i[0])&&t.push(new Pe(s,o,u)),(s=i[1])&&t.push(new Pe(s,u,a))}e.push(r)}for(;r=e.pop();)n(r.node,r.x0,r.x1);return this}function yb(n){return n[0]}function wb(n){return arguments.length?(this._x=n,this):this._x}function On(n,t){var e=new An(t??yb,NaN,NaN);return n==null?e:e.addAll(n)}function An(n,t,e){this._x=n,this._x0=t,this._x1=e,this._root=void 0}function Cf(n){for(var t={data:n.data},e=t;n=n.next;)e=e.next={data:n.data};return t}var ve=On.prototype=An.prototype;ve.copy=function(){var n=new An(this._x,this._x0,this._x1),t=this._root,e,r;if(!t)return n;if(!t.length)return n._root=Cf(t),n;for(e=[{source:t,target:n._root=new Array(2)}];t=e.pop();)for(var i=0;i<2;++i)(r=t.source[i])&&(r.length?e.push({source:r,target:t.target[i]=new Array(2)}):t.target[i]=Cf(r));return n},ve.add=ob,ve.addAll=ab,ve.cover=ub,ve.data=cb,ve.extent=fb,ve.find=lb,ve.remove=hb,ve.removeAll=db,ve.root=gb,ve.size=pb,ve.visit=vb,ve.visitAfter=mb,ve.x=wb;function ie(n){return function(){return n}}function Se(n){return(n()-.5)*1e-6}function In(n){return n.x+n.vx}function Pf(n){return n.y+n.vy}function bb(n){return n.z+n.vz}function _b(n){var t,e,r,i,s=1,o=1;typeof n!="function"&&(n=ie(n==null?1:+n));function a(){for(var f,l=t.length,h,g,p,v,m,d,y,w=0;w<o;++w)for(h=(e===1?On(t,In):e===2?pt(t,In,Pf):e===3?ar(t,In,Pf,bb):null).visitAfter(u),f=0;f<l;++f)g=t[f],d=r[g.index],y=d*d,p=g.x+g.vx,e>1&&(v=g.y+g.vy),e>2&&(m=g.z+g.vz),h.visit(b);function b(x,M,N,E,O,_,S){var q=[M,N,E,O,_,S],R=q[0],T=q[1],I=q[2],j=q[e],F=q[e+1],A=q[e+2],k=x.data,L=x.r,D=d+L;if(k){if(k.index>g.index){var G=p-k.x-k.vx,P=e>1?v-k.y-k.vy:0,z=e>2?m-k.z-k.vz:0,B=G*G+P*P+z*z;B<D*D&&(G===0&&(G=Se(i),B+=G*G),e>1&&P===0&&(P=Se(i),B+=P*P),e>2&&z===0&&(z=Se(i),B+=z*z),B=(D-(B=Math.sqrt(B)))/B*s,g.vx+=(G*=B)*(D=(L*=L)/(y+L)),e>1&&(g.vy+=(P*=B)*D),e>2&&(g.vz+=(z*=B)*D),k.vx-=G*(D=1-D),e>1&&(k.vy-=P*D),e>2&&(k.vz-=z*D))}return}return R>p+D||j<p-D||e>1&&(T>v+D||F<v-D)||e>2&&(I>m+D||A<m-D)}}function u(f){if(f.data)return f.r=r[f.data.index];for(var l=f.r=0;l<Math.pow(2,e);++l)f[l]&&f[l].r>f.r&&(f.r=f[l].r)}function c(){if(t){var f,l=t.length,h;for(r=new Array(l),f=0;f<l;++f)h=t[f],r[h.index]=+n(h,f,t)}}return a.initialize=function(f,...l){t=f,i=l.find(h=>typeof h=="function")||Math.random,e=l.find(h=>[1,2,3].includes(h))||2,c()},a.iterations=function(f){return arguments.length?(o=+f,a):o},a.strength=function(f){return arguments.length?(s=+f,a):s},a.radius=function(f){return arguments.length?(n=typeof f=="function"?f:ie(+f),c(),a):n},a}function Eb(n){return n.index}function Lf(n,t){var e=n.get(t);if(!e)throw new Error("node not found: "+t);return e}function xb(n){var t=Eb,e=h,r,i=ie(30),s,o,a,u,c,f,l=1;n==null&&(n=[]);function h(d){return 1/Math.min(u[d.source.index],u[d.target.index])}function g(d){for(var y=0,w=n.length;y<l;++y)for(var b=0,x,M,N,E=0,O=0,_=0,S,q;b<w;++b)x=n[b],M=x.source,N=x.target,E=N.x+N.vx-M.x-M.vx||Se(f),a>1&&(O=N.y+N.vy-M.y-M.vy||Se(f)),a>2&&(_=N.z+N.vz-M.z-M.vz||Se(f)),S=Math.sqrt(E*E+O*O+_*_),S=(S-s[b])/S*d*r[b],E*=S,O*=S,_*=S,N.vx-=E*(q=c[b]),a>1&&(N.vy-=O*q),a>2&&(N.vz-=_*q),M.vx+=E*(q=1-q),a>1&&(M.vy+=O*q),a>2&&(M.vz+=_*q)}function p(){if(o){var d,y=o.length,w=n.length,b=new Map(o.map((M,N)=>[t(M,N,o),M])),x;for(d=0,u=new Array(y);d<w;++d)x=n[d],x.index=d,typeof x.source!="object"&&(x.source=Lf(b,x.source)),typeof x.target!="object"&&(x.target=Lf(b,x.target)),u[x.source.index]=(u[x.source.index]||0)+1,u[x.target.index]=(u[x.target.index]||0)+1;for(d=0,c=new Array(w);d<w;++d)x=n[d],c[d]=u[x.source.index]/(u[x.source.index]+u[x.target.index]);r=new Array(w),v(),s=new Array(w),m()}}function v(){if(o)for(var d=0,y=n.length;d<y;++d)r[d]=+e(n[d],d,n)}function m(){if(o)for(var d=0,y=n.length;d<y;++d)s[d]=+i(n[d],d,n)}return g.initialize=function(d,...y){o=d,f=y.find(w=>typeof w=="function")||Math.random,a=y.find(w=>[1,2,3].includes(w))||2,p()},g.links=function(d){return arguments.length?(n=d,p(),g):n},g.id=function(d){return arguments.length?(t=d,g):t},g.iterations=function(d){return arguments.length?(l=+d,g):l},g.strength=function(d){return arguments.length?(e=typeof d=="function"?d:ie(+d),v(),g):e},g.distance=function(d){return arguments.length?(i=typeof d=="function"?d:ie(+d),m(),g):i},g}const Nb=1664525,Mb=1013904223,Df=4294967296;function Sb(){let n=1;return()=>(n=(Nb*n+Mb)%Df)/Df}var zf=3;function Tn(n){return n.x}function $f(n){return n.y}function Rb(n){return n.z}var qb=10,Ob=Math.PI*(3-Math.sqrt(5)),Ab=Math.PI*20/(9+Math.sqrt(221));function Ib(n,t){t=t||2;var e=Math.min(zf,Math.max(1,Math.round(t))),r,i=1,s=.001,o=1-Math.pow(s,1/300),a=0,u=.6,c=new Map,f=Rn(g),l=Mn("tick","end"),h=Sb();n==null&&(n=[]);function g(){p(),l.call("tick",r),i<s&&(f.stop(),l.call("end",r))}function p(d){var y,w=n.length,b;d===void 0&&(d=1);for(var x=0;x<d;++x)for(i+=(a-i)*o,c.forEach(function(M){M(i)}),y=0;y<w;++y)b=n[y],b.fx==null?b.x+=b.vx*=u:(b.x=b.fx,b.vx=0),e>1&&(b.fy==null?b.y+=b.vy*=u:(b.y=b.fy,b.vy=0)),e>2&&(b.fz==null?b.z+=b.vz*=u:(b.z=b.fz,b.vz=0));return r}function v(){for(var d=0,y=n.length,w;d<y;++d){if(w=n[d],w.index=d,w.fx!=null&&(w.x=w.fx),w.fy!=null&&(w.y=w.fy),w.fz!=null&&(w.z=w.fz),isNaN(w.x)||e>1&&isNaN(w.y)||e>2&&isNaN(w.z)){var b=qb*(e>2?Math.cbrt(.5+d):e>1?Math.sqrt(.5+d):d),x=d*Ob,M=d*Ab;e===1?w.x=b:e===2?(w.x=b*Math.cos(x),w.y=b*Math.sin(x)):(w.x=b*Math.sin(x)*Math.cos(M),w.y=b*Math.cos(x),w.z=b*Math.sin(x)*Math.sin(M))}(isNaN(w.vx)||e>1&&isNaN(w.vy)||e>2&&isNaN(w.vz))&&(w.vx=0,e>1&&(w.vy=0),e>2&&(w.vz=0))}}function m(d){return d.initialize&&d.initialize(n,h,e),d}return v(),r={tick:p,restart:function(){return f.restart(g),r},stop:function(){return f.stop(),r},numDimensions:function(d){return arguments.length?(e=Math.min(zf,Math.max(1,Math.round(d))),c.forEach(m),r):e},nodes:function(d){return arguments.length?(n=d,v(),c.forEach(m),r):n},alpha:function(d){return arguments.length?(i=+d,r):i},alphaMin:function(d){return arguments.length?(s=+d,r):s},alphaDecay:function(d){return arguments.length?(o=+d,r):+o},alphaTarget:function(d){return arguments.length?(a=+d,r):a},velocityDecay:function(d){return arguments.length?(u=1-d,r):1-u},randomSource:function(d){return arguments.length?(h=d,c.forEach(m),r):h},force:function(d,y){return arguments.length>1?(y==null?c.delete(d):c.set(d,m(y)),r):c.get(d)},find:function(){var d=Array.prototype.slice.call(arguments),y=d.shift()||0,w=(e>1?d.shift():null)||0,b=(e>2?d.shift():null)||0,x=d.shift()||1/0,M=0,N=n.length,E,O,_,S,q,R;for(x*=x,M=0;M<N;++M)q=n[M],E=y-q.x,O=w-(q.y||0),_=b-(q.z||0),S=E*E+O*O+_*_,S<x&&(R=q,x=S);return R},on:function(d,y){return arguments.length>1?(l.on(d,y),r):l.on(d)}}}function Tb(){var n,t,e,r,i,s=ie(-30),o,a=1,u=1/0,c=.81;function f(p){var v,m=n.length,d=(t===1?On(n,Tn):t===2?pt(n,Tn,$f):t===3?ar(n,Tn,$f,Rb):null).visitAfter(h);for(i=p,v=0;v<m;++v)e=n[v],d.visit(g)}function l(){if(n){var p,v=n.length,m;for(o=new Array(v),p=0;p<v;++p)m=n[p],o[m.index]=+s(m,p,n)}}function h(p){var v=0,m,d,y=0,w,b,x,M,N=p.length;if(N){for(w=b=x=M=0;M<N;++M)(m=p[M])&&(d=Math.abs(m.value))&&(v+=m.value,y+=d,w+=d*(m.x||0),b+=d*(m.y||0),x+=d*(m.z||0));v*=Math.sqrt(4/N),p.x=w/y,t>1&&(p.y=b/y),t>2&&(p.z=x/y)}else{m=p,m.x=m.data.x,t>1&&(m.y=m.data.y),t>2&&(m.z=m.data.z);do v+=o[m.data.index];while(m=m.next)}p.value=v}function g(p,v,m,d,y){if(!p.value)return!0;var w=[m,d,y][t-1],b=p.x-e.x,x=t>1?p.y-e.y:0,M=t>2?p.z-e.z:0,N=w-v,E=b*b+x*x+M*M;if(N*N/c<E)return E<u&&(b===0&&(b=Se(r),E+=b*b),t>1&&x===0&&(x=Se(r),E+=x*x),t>2&&M===0&&(M=Se(r),E+=M*M),E<a&&(E=Math.sqrt(a*E)),e.vx+=b*p.value*i/E,t>1&&(e.vy+=x*p.value*i/E),t>2&&(e.vz+=M*p.value*i/E)),!0;if(p.length||E>=u)return;(p.data!==e||p.next)&&(b===0&&(b=Se(r),E+=b*b),t>1&&x===0&&(x=Se(r),E+=x*x),t>2&&M===0&&(M=Se(r),E+=M*M),E<a&&(E=Math.sqrt(a*E)));do p.data!==e&&(N=o[p.data.index]*i/E,e.vx+=b*N,t>1&&(e.vy+=x*N),t>2&&(e.vz+=M*N));while(p=p.next)}return f.initialize=function(p,...v){n=p,r=v.find(m=>typeof m=="function")||Math.random,t=v.find(m=>[1,2,3].includes(m))||2,l()},f.strength=function(p){return arguments.length?(s=typeof p=="function"?p:ie(+p),l(),f):s},f.distanceMin=function(p){return arguments.length?(a=p*p,f):Math.sqrt(a)},f.distanceMax=function(p){return arguments.length?(u=p*p,f):Math.sqrt(u)},f.theta=function(p){return arguments.length?(c=p*p,f):Math.sqrt(c)},f}function kb(n,t,e,r){var i,s,o=ie(.1),a,u;typeof n!="function"&&(n=ie(+n)),t==null&&(t=0),e==null&&(e=0),r==null&&(r=0);function c(l){for(var h=0,g=i.length;h<g;++h){var p=i[h],v=p.x-t||1e-6,m=(p.y||0)-e||1e-6,d=(p.z||0)-r||1e-6,y=Math.sqrt(v*v+m*m+d*d),w=(u[h]-y)*a[h]*l/y;p.vx+=v*w,s>1&&(p.vy+=m*w),s>2&&(p.vz+=d*w)}}function f(){if(i){var l,h=i.length;for(a=new Array(h),u=new Array(h),l=0;l<h;++l)u[l]=+n(i[l],l,i),a[l]=isNaN(u[l])?0:+o(i[l],l,i)}}return c.initialize=function(l,...h){i=l,s=h.find(g=>[1,2,3].includes(g))||2,f()},c.strength=function(l){return arguments.length?(o=typeof l=="function"?l:ie(+l),f(),c):o},c.radius=function(l){return arguments.length?(n=typeof l=="function"?l:ie(+l),f(),c):n},c.x=function(l){return arguments.length?(t=+l,c):t},c.y=function(l){return arguments.length?(e=+l,c):e},c.z=function(l){return arguments.length?(r=+l,c):r},c}function jb(n){var t=ie(.1),e,r,i;typeof n!="function"&&(n=ie(n==null?0:+n));function s(a){for(var u=0,c=e.length,f;u<c;++u)f=e[u],f.vx+=(i[u]-f.x)*r[u]*a}function o(){if(e){var a,u=e.length;for(r=new Array(u),i=new Array(u),a=0;a<u;++a)r[a]=isNaN(i[a]=+n(e[a],a,e))?0:+t(e[a],a,e)}}return s.initialize=function(a){e=a,o()},s.strength=function(a){return arguments.length?(t=typeof a=="function"?a:ie(+a),o(),s):t},s.x=function(a){return arguments.length?(n=typeof a=="function"?a:ie(+a),o(),s):n},s}function Cb(n){var t=ie(.1),e,r,i;typeof n!="function"&&(n=ie(n==null?0:+n));function s(a){for(var u=0,c=e.length,f;u<c;++u)f=e[u],f.vy+=(i[u]-f.y)*r[u]*a}function o(){if(e){var a,u=e.length;for(r=new Array(u),i=new Array(u),a=0;a<u;++a)r[a]=isNaN(i[a]=+n(e[a],a,e))?0:+t(e[a],a,e)}}return s.initialize=function(a){e=a,o()},s.strength=function(a){return arguments.length?(t=typeof a=="function"?a:ie(+a),o(),s):t},s.y=function(a){return arguments.length?(n=typeof a=="function"?a:ie(+a),o(),s):n},s}function Pb(n){var t=ie(.1),e,r,i;typeof n!="function"&&(n=ie(n==null?0:+n));function s(a){for(var u=0,c=e.length,f;u<c;++u)f=e[u],f.vz+=(i[u]-f.z)*r[u]*a}function o(){if(e){var a,u=e.length;for(r=new Array(u),i=new Array(u),a=0;a<u;++a)r[a]=isNaN(i[a]=+n(e[a],a,e))?0:+t(e[a],a,e)}}return s.initialize=function(a){e=a,o()},s.strength=function(a){return arguments.length?(t=typeof a=="function"?a:ie(+a),o(),s):t},s.z=function(a){return arguments.length?(n=typeof a=="function"?a:ie(+a),o(),s):n},s}class Lb extends Tf{constructor(){super(...arguments),this.id="d3-force-3d",this.config={inputNodeAttrs:["x","y","z","vx","vy","vz","fx","fy","fz"],outputNodeAttrs:["x","y","z","vx","vy","vz"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:xb,manyBody:Tb,center:sb,collide:_b,radial:kb,x:jb,y:Cb,z:Pb},this.options={numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return Ib()}}function kn(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jn,Ff;function Db(){if(Ff)return jn;Ff=1;function n(){this.__data__=[],this.size=0}return jn=n,jn}var Cn,Bf;function _t(){if(Bf)return Cn;Bf=1;function n(t,e){return t===e||t!==t&&e!==e}return Cn=n,Cn}var Pn,Uf;function _r(){if(Uf)return Pn;Uf=1;var n=_t();function t(e,r){for(var i=e.length;i--;)if(n(e[i][0],r))return i;return-1}return Pn=t,Pn}var Ln,Gf;function zb(){if(Gf)return Ln;Gf=1;var n=_r(),t=Array.prototype,e=t.splice;function r(i){var s=this.__data__,o=n(s,i);if(o<0)return!1;var a=s.length-1;return o==a?s.pop():e.call(s,o,1),--this.size,!0}return Ln=r,Ln}var Dn,Vf;function $b(){if(Vf)return Dn;Vf=1;var n=_r();function t(e){var r=this.__data__,i=n(r,e);return i<0?void 0:r[i][1]}return Dn=t,Dn}var zn,Wf;function Fb(){if(Wf)return zn;Wf=1;var n=_r();function t(e){return n(this.__data__,e)>-1}return zn=t,zn}var $n,Yf;function Bb(){if(Yf)return $n;Yf=1;var n=_r();function t(e,r){var i=this.__data__,s=n(i,e);return s<0?(++this.size,i.push([e,r])):i[s][1]=r,this}return $n=t,$n}var Fn,Kf;function Er(){if(Kf)return Fn;Kf=1;var n=Db(),t=zb(),e=$b(),r=Fb(),i=Bb();function s(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var c=o[a];this.set(c[0],c[1])}}return s.prototype.clear=n,s.prototype.delete=t,s.prototype.get=e,s.prototype.has=r,s.prototype.set=i,Fn=s,Fn}var Bn,Xf;function Ub(){if(Xf)return Bn;Xf=1;var n=Er();function t(){this.__data__=new n,this.size=0}return Bn=t,Bn}var Un,Zf;function Gb(){if(Zf)return Un;Zf=1;function n(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}return Un=n,Un}var Gn,Jf;function Vb(){if(Jf)return Gn;Jf=1;function n(t){return this.__data__.get(t)}return Gn=n,Gn}var Vn,Qf;function Wb(){if(Qf)return Vn;Qf=1;function n(t){return this.__data__.has(t)}return Vn=n,Vn}var Wn,Hf;function el(){if(Hf)return Wn;Hf=1;var n=typeof ur=="object"&&ur&&ur.Object===Object&&ur;return Wn=n,Wn}var Yn,tl;function Oe(){if(tl)return Yn;tl=1;var n=el(),t=typeof self=="object"&&self&&self.Object===Object&&self,e=n||t||Function("return this")();return Yn=e,Yn}var Kn,rl;function Et(){if(rl)return Kn;rl=1;var n=Oe(),t=n.Symbol;return Kn=t,Kn}var Xn,nl;function Yb(){if(nl)return Xn;nl=1;var n=Et(),t=Object.prototype,e=t.hasOwnProperty,r=t.toString,i=n?n.toStringTag:void 0;function s(o){var a=e.call(o,i),u=o[i];try{o[i]=void 0;var c=!0}catch{}var f=r.call(o);return c&&(a?o[i]=u:delete o[i]),f}return Xn=s,Xn}var Zn,il;function Kb(){if(il)return Zn;il=1;var n=Object.prototype,t=n.toString;function e(r){return t.call(r)}return Zn=e,Zn}var Jn,sl;function ot(){if(sl)return Jn;sl=1;var n=Et(),t=Yb(),e=Kb(),r="[object Null]",i="[object Undefined]",s=n?n.toStringTag:void 0;function o(a){return a==null?a===void 0?i:r:s&&s in Object(a)?t(a):e(a)}return Jn=o,Jn}var Qn,ol;function Re(){if(ol)return Qn;ol=1;function n(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}return Qn=n,Qn}var Hn,al;function $t(){if(al)return Hn;al=1;var n=ot(),t=Re(),e="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",s="[object Proxy]";function o(a){if(!t(a))return!1;var u=n(a);return u==r||u==i||u==e||u==s}return Hn=o,Hn}var ei,ul;function Xb(){if(ul)return ei;ul=1;var n=Oe(),t=n["__core-js_shared__"];return ei=t,ei}var ti,cl;function Zb(){if(cl)return ti;cl=1;var n=Xb(),t=function(){var r=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function e(r){return!!t&&t in r}return ti=e,ti}var ri,fl;function ll(){if(fl)return ri;fl=1;var n=Function.prototype,t=n.toString;function e(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return ri=e,ri}var ni,hl;function Jb(){if(hl)return ni;hl=1;var n=$t(),t=Zb(),e=Re(),r=ll(),i=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,o=Function.prototype,a=Object.prototype,u=o.toString,c=a.hasOwnProperty,f=RegExp("^"+u.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function l(h){if(!e(h)||t(h))return!1;var g=n(h)?f:s;return g.test(r(h))}return ni=l,ni}var ii,dl;function Qb(){if(dl)return ii;dl=1;function n(t,e){return t==null?void 0:t[e]}return ii=n,ii}var si,gl;function at(){if(gl)return si;gl=1;var n=Jb(),t=Qb();function e(r,i){var s=t(r,i);return n(s)?s:void 0}return si=e,si}var oi,pl;function ai(){if(pl)return oi;pl=1;var n=at(),t=Oe(),e=n(t,"Map");return oi=e,oi}var ui,vl;function xr(){if(vl)return ui;vl=1;var n=at(),t=n(Object,"create");return ui=t,ui}var ci,ml;function Hb(){if(ml)return ci;ml=1;var n=xr();function t(){this.__data__=n?n(null):{},this.size=0}return ci=t,ci}var fi,yl;function e_(){if(yl)return fi;yl=1;function n(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}return fi=n,fi}var li,wl;function t_(){if(wl)return li;wl=1;var n=xr(),t="__lodash_hash_undefined__",e=Object.prototype,r=e.hasOwnProperty;function i(s){var o=this.__data__;if(n){var a=o[s];return a===t?void 0:a}return r.call(o,s)?o[s]:void 0}return li=i,li}var hi,bl;function r_(){if(bl)return hi;bl=1;var n=xr(),t=Object.prototype,e=t.hasOwnProperty;function r(i){var s=this.__data__;return n?s[i]!==void 0:e.call(s,i)}return hi=r,hi}var di,_l;function n_(){if(_l)return di;_l=1;var n=xr(),t="__lodash_hash_undefined__";function e(r,i){var s=this.__data__;return this.size+=this.has(r)?0:1,s[r]=n&&i===void 0?t:i,this}return di=e,di}var gi,El;function i_(){if(El)return gi;El=1;var n=Hb(),t=e_(),e=t_(),r=r_(),i=n_();function s(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var c=o[a];this.set(c[0],c[1])}}return s.prototype.clear=n,s.prototype.delete=t,s.prototype.get=e,s.prototype.has=r,s.prototype.set=i,gi=s,gi}var pi,xl;function s_(){if(xl)return pi;xl=1;var n=i_(),t=Er(),e=ai();function r(){this.size=0,this.__data__={hash:new n,map:new(e||t),string:new n}}return pi=r,pi}var vi,Nl;function o_(){if(Nl)return vi;Nl=1;function n(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}return vi=n,vi}var mi,Ml;function Nr(){if(Ml)return mi;Ml=1;var n=o_();function t(e,r){var i=e.__data__;return n(r)?i[typeof r=="string"?"string":"hash"]:i.map}return mi=t,mi}var yi,Sl;function a_(){if(Sl)return yi;Sl=1;var n=Nr();function t(e){var r=n(this,e).delete(e);return this.size-=r?1:0,r}return yi=t,yi}var wi,Rl;function u_(){if(Rl)return wi;Rl=1;var n=Nr();function t(e){return n(this,e).get(e)}return wi=t,wi}var bi,ql;function c_(){if(ql)return bi;ql=1;var n=Nr();function t(e){return n(this,e).has(e)}return bi=t,bi}var _i,Ol;function f_(){if(Ol)return _i;Ol=1;var n=Nr();function t(e,r){var i=n(this,e),s=i.size;return i.set(e,r),this.size+=i.size==s?0:1,this}return _i=t,_i}var Ei,Al;function xi(){if(Al)return Ei;Al=1;var n=s_(),t=a_(),e=u_(),r=c_(),i=f_();function s(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var c=o[a];this.set(c[0],c[1])}}return s.prototype.clear=n,s.prototype.delete=t,s.prototype.get=e,s.prototype.has=r,s.prototype.set=i,Ei=s,Ei}var Ni,Il;function l_(){if(Il)return Ni;Il=1;var n=Er(),t=ai(),e=xi(),r=200;function i(s,o){var a=this.__data__;if(a instanceof n){var u=a.__data__;if(!t||u.length<r-1)return u.push([s,o]),this.size=++a.size,this;a=this.__data__=new e(u)}return a.set(s,o),this.size=a.size,this}return Ni=i,Ni}var Mi,Tl;function Mr(){if(Tl)return Mi;Tl=1;var n=Er(),t=Ub(),e=Gb(),r=Vb(),i=Wb(),s=l_();function o(a){var u=this.__data__=new n(a);this.size=u.size}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=r,o.prototype.has=i,o.prototype.set=s,Mi=o,Mi}var Si,kl;function Ri(){if(kl)return Si;kl=1;function n(t,e){for(var r=-1,i=t==null?0:t.length;++r<i&&e(t[r],r,t)!==!1;);return t}return Si=n,Si}var qi,jl;function Cl(){if(jl)return qi;jl=1;var n=at(),t=function(){try{var e=n(Object,"defineProperty");return e({},"",{}),e}catch{}}();return qi=t,qi}var Oi,Pl;function Sr(){if(Pl)return Oi;Pl=1;var n=Cl();function t(e,r,i){r=="__proto__"&&n?n(e,r,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[r]=i}return Oi=t,Oi}var Ai,Ll;function Rr(){if(Ll)return Ai;Ll=1;var n=Sr(),t=_t(),e=Object.prototype,r=e.hasOwnProperty;function i(s,o,a){var u=s[o];(!(r.call(s,o)&&t(u,a))||a===void 0&&!(o in s))&&n(s,o,a)}return Ai=i,Ai}var Ii,Dl;function Ft(){if(Dl)return Ii;Dl=1;var n=Rr(),t=Sr();function e(r,i,s,o){var a=!s;s||(s={});for(var u=-1,c=i.length;++u<c;){var f=i[u],l=o?o(s[f],r[f],f,s,r):void 0;l===void 0&&(l=r[f]),a?t(s,f,l):n(s,f,l)}return s}return Ii=e,Ii}var Ti,zl;function h_(){if(zl)return Ti;zl=1;function n(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i}return Ti=n,Ti}var ki,$l;function Te(){if($l)return ki;$l=1;function n(t){return t!=null&&typeof t=="object"}return ki=n,ki}var ji,Fl;function d_(){if(Fl)return ji;Fl=1;var n=ot(),t=Te(),e="[object Arguments]";function r(i){return t(i)&&n(i)==e}return ji=r,ji}var Ci,Bl;function Bt(){if(Bl)return Ci;Bl=1;var n=d_(),t=Te(),e=Object.prototype,r=e.hasOwnProperty,i=e.propertyIsEnumerable,s=n(function(){return arguments}())?n:function(o){return t(o)&&r.call(o,"callee")&&!i.call(o,"callee")};return Ci=s,Ci}var Pi,Ul;function oe(){if(Ul)return Pi;Ul=1;var n=Array.isArray;return Pi=n,Pi}var Ut={exports:{}},Li,Gl;function g_(){if(Gl)return Li;Gl=1;function n(){return!1}return Li=n,Li}Ut.exports;var Vl;function xt(){return Vl||(Vl=1,function(n,t){var e=Oe(),r=g_(),i=t&&!t.nodeType&&t,s=i&&!0&&n&&!n.nodeType&&n,o=s&&s.exports===i,a=o?e.Buffer:void 0,u=a?a.isBuffer:void 0,c=u||r;n.exports=c}(Ut,Ut.exports)),Ut.exports}var Di,Wl;function qr(){if(Wl)return Di;Wl=1;var n=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function e(r,i){var s=typeof r;return i=i??n,!!i&&(s=="number"||s!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<i}return Di=e,Di}var zi,Yl;function $i(){if(Yl)return zi;Yl=1;var n=9007199254740991;function t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=n}return zi=t,zi}var Fi,Kl;function p_(){if(Kl)return Fi;Kl=1;var n=ot(),t=$i(),e=Te(),r="[object Arguments]",i="[object Array]",s="[object Boolean]",o="[object Date]",a="[object Error]",u="[object Function]",c="[object Map]",f="[object Number]",l="[object Object]",h="[object RegExp]",g="[object Set]",p="[object String]",v="[object WeakMap]",m="[object ArrayBuffer]",d="[object DataView]",y="[object Float32Array]",w="[object Float64Array]",b="[object Int8Array]",x="[object Int16Array]",M="[object Int32Array]",N="[object Uint8Array]",E="[object Uint8ClampedArray]",O="[object Uint16Array]",_="[object Uint32Array]",S={};S[y]=S[w]=S[b]=S[x]=S[M]=S[N]=S[E]=S[O]=S[_]=!0,S[r]=S[i]=S[m]=S[s]=S[d]=S[o]=S[a]=S[u]=S[c]=S[f]=S[l]=S[h]=S[g]=S[p]=S[v]=!1;function q(R){return e(R)&&t(R.length)&&!!S[n(R)]}return Fi=q,Fi}var Bi,Xl;function Or(){if(Xl)return Bi;Xl=1;function n(t){return function(e){return t(e)}}return Bi=n,Bi}var Gt={exports:{}};Gt.exports;var Zl;function Ui(){return Zl||(Zl=1,function(n,t){var e=el(),r=t&&!t.nodeType&&t,i=r&&!0&&n&&!n.nodeType&&n,s=i&&i.exports===r,o=s&&e.process,a=function(){try{var u=i&&i.require&&i.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}}();n.exports=a}(Gt,Gt.exports)),Gt.exports}var Gi,Jl;function Vt(){if(Jl)return Gi;Jl=1;var n=p_(),t=Or(),e=Ui(),r=e&&e.isTypedArray,i=r?t(r):n;return Gi=i,Gi}var Vi,Ql;function Hl(){if(Ql)return Vi;Ql=1;var n=h_(),t=Bt(),e=oe(),r=xt(),i=qr(),s=Vt(),o=Object.prototype,a=o.hasOwnProperty;function u(c,f){var l=e(c),h=!l&&t(c),g=!l&&!h&&r(c),p=!l&&!h&&!g&&s(c),v=l||h||g||p,m=v?n(c.length,String):[],d=m.length;for(var y in c)(f||a.call(c,y))&&!(v&&(y=="length"||g&&(y=="offset"||y=="parent")||p&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||i(y,d)))&&m.push(y);return m}return Vi=u,Vi}var Wi,eh;function Ar(){if(eh)return Wi;eh=1;var n=Object.prototype;function t(e){var r=e&&e.constructor,i=typeof r=="function"&&r.prototype||n;return e===i}return Wi=t,Wi}var Yi,th;function rh(){if(th)return Yi;th=1;function n(t,e){return function(r){return t(e(r))}}return Yi=n,Yi}var Ki,nh;function v_(){if(nh)return Ki;nh=1;var n=rh(),t=n(Object.keys,Object);return Ki=t,Ki}var Xi,ih;function Zi(){if(ih)return Xi;ih=1;var n=Ar(),t=v_(),e=Object.prototype,r=e.hasOwnProperty;function i(s){if(!n(s))return t(s);var o=[];for(var a in Object(s))r.call(s,a)&&a!="constructor"&&o.push(a);return o}return Xi=i,Xi}var Ji,sh;function Le(){if(sh)return Ji;sh=1;var n=$t(),t=$i();function e(r){return r!=null&&t(r.length)&&!n(r)}return Ji=e,Ji}var Qi,oh;function Xe(){if(oh)return Qi;oh=1;var n=Hl(),t=Zi(),e=Le();function r(i){return e(i)?n(i):t(i)}return Qi=r,Qi}var Hi,ah;function m_(){if(ah)return Hi;ah=1;var n=Ft(),t=Xe();function e(r,i){return r&&n(i,t(i),r)}return Hi=e,Hi}var es,uh;function y_(){if(uh)return es;uh=1;function n(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}return es=n,es}var ts,ch;function w_(){if(ch)return ts;ch=1;var n=Re(),t=Ar(),e=y_(),r=Object.prototype,i=r.hasOwnProperty;function s(o){if(!n(o))return e(o);var a=t(o),u=[];for(var c in o)c=="constructor"&&(a||!i.call(o,c))||u.push(c);return u}return ts=s,ts}var rs,fh;function ut(){if(fh)return rs;fh=1;var n=Hl(),t=w_(),e=Le();function r(i){return e(i)?n(i,!0):t(i)}return rs=r,rs}var ns,lh;function b_(){if(lh)return ns;lh=1;var n=Ft(),t=ut();function e(r,i){return r&&n(i,t(i),r)}return ns=e,ns}var Wt={exports:{}};Wt.exports;var hh;function dh(){return hh||(hh=1,function(n,t){var e=Oe(),r=t&&!t.nodeType&&t,i=r&&!0&&n&&!n.nodeType&&n,s=i&&i.exports===r,o=s?e.Buffer:void 0,a=o?o.allocUnsafe:void 0;function u(c,f){if(f)return c.slice();var l=c.length,h=a?a(l):new c.constructor(l);return c.copy(h),h}n.exports=u}(Wt,Wt.exports)),Wt.exports}var is,gh;function ph(){if(gh)return is;gh=1;function n(t,e){var r=-1,i=t.length;for(e||(e=Array(i));++r<i;)e[r]=t[r];return e}return is=n,is}var ss,vh;function mh(){if(vh)return ss;vh=1;function n(t,e){for(var r=-1,i=t==null?0:t.length,s=0,o=[];++r<i;){var a=t[r];e(a,r,t)&&(o[s++]=a)}return o}return ss=n,ss}var os,yh;function wh(){if(yh)return os;yh=1;function n(){return[]}return os=n,os}var as,bh;function us(){if(bh)return as;bh=1;var n=mh(),t=wh(),e=Object.prototype,r=e.propertyIsEnumerable,i=Object.getOwnPropertySymbols,s=i?function(o){return o==null?[]:(o=Object(o),n(i(o),function(a){return r.call(o,a)}))}:t;return as=s,as}var cs,_h;function __(){if(_h)return cs;_h=1;var n=Ft(),t=us();function e(r,i){return n(r,t(r),i)}return cs=e,cs}var fs,Eh;function ls(){if(Eh)return fs;Eh=1;function n(t,e){for(var r=-1,i=e.length,s=t.length;++r<i;)t[s+r]=e[r];return t}return fs=n,fs}var hs,xh;function Ir(){if(xh)return hs;xh=1;var n=rh(),t=n(Object.getPrototypeOf,Object);return hs=t,hs}var ds,Nh;function Mh(){if(Nh)return ds;Nh=1;var n=ls(),t=Ir(),e=us(),r=wh(),i=Object.getOwnPropertySymbols,s=i?function(o){for(var a=[];o;)n(a,e(o)),o=t(o);return a}:r;return ds=s,ds}var gs,Sh;function E_(){if(Sh)return gs;Sh=1;var n=Ft(),t=Mh();function e(r,i){return n(r,t(r),i)}return gs=e,gs}var ps,Rh;function qh(){if(Rh)return ps;Rh=1;var n=ls(),t=oe();function e(r,i,s){var o=i(r);return t(r)?o:n(o,s(r))}return ps=e,ps}var vs,Oh;function Ah(){if(Oh)return vs;Oh=1;var n=qh(),t=us(),e=Xe();function r(i){return n(i,e,t)}return vs=r,vs}var ms,Ih;function x_(){if(Ih)return ms;Ih=1;var n=qh(),t=Mh(),e=ut();function r(i){return n(i,e,t)}return ms=r,ms}var ys,Th;function N_(){if(Th)return ys;Th=1;var n=at(),t=Oe(),e=n(t,"DataView");return ys=e,ys}var ws,kh;function M_(){if(kh)return ws;kh=1;var n=at(),t=Oe(),e=n(t,"Promise");return ws=e,ws}var bs,jh;function Ch(){if(jh)return bs;jh=1;var n=at(),t=Oe(),e=n(t,"Set");return bs=e,bs}var _s,Ph;function S_(){if(Ph)return _s;Ph=1;var n=at(),t=Oe(),e=n(t,"WeakMap");return _s=e,_s}var Es,Lh;function Nt(){if(Lh)return Es;Lh=1;var n=N_(),t=ai(),e=M_(),r=Ch(),i=S_(),s=ot(),o=ll(),a="[object Map]",u="[object Object]",c="[object Promise]",f="[object Set]",l="[object WeakMap]",h="[object DataView]",g=o(n),p=o(t),v=o(e),m=o(r),d=o(i),y=s;return(n&&y(new n(new ArrayBuffer(1)))!=h||t&&y(new t)!=a||e&&y(e.resolve())!=c||r&&y(new r)!=f||i&&y(new i)!=l)&&(y=function(w){var b=s(w),x=b==u?w.constructor:void 0,M=x?o(x):"";if(M)switch(M){case g:return h;case p:return a;case v:return c;case m:return f;case d:return l}return b}),Es=y,Es}var xs,Dh;function R_(){if(Dh)return xs;Dh=1;var n=Object.prototype,t=n.hasOwnProperty;function e(r){var i=r.length,s=new r.constructor(i);return i&&typeof r[0]=="string"&&t.call(r,"index")&&(s.index=r.index,s.input=r.input),s}return xs=e,xs}var Ns,zh;function $h(){if(zh)return Ns;zh=1;var n=Oe(),t=n.Uint8Array;return Ns=t,Ns}var Ms,Fh;function Ss(){if(Fh)return Ms;Fh=1;var n=$h();function t(e){var r=new e.constructor(e.byteLength);return new n(r).set(new n(e)),r}return Ms=t,Ms}var Rs,Bh;function q_(){if(Bh)return Rs;Bh=1;var n=Ss();function t(e,r){var i=r?n(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}return Rs=t,Rs}var qs,Uh;function O_(){if(Uh)return qs;Uh=1;var n=/\w*$/;function t(e){var r=new e.constructor(e.source,n.exec(e));return r.lastIndex=e.lastIndex,r}return qs=t,qs}var Os,Gh;function A_(){if(Gh)return Os;Gh=1;var n=Et(),t=n?n.prototype:void 0,e=t?t.valueOf:void 0;function r(i){return e?Object(e.call(i)):{}}return Os=r,Os}var As,Vh;function Wh(){if(Vh)return As;Vh=1;var n=Ss();function t(e,r){var i=r?n(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}return As=t,As}var Is,Yh;function I_(){if(Yh)return Is;Yh=1;var n=Ss(),t=q_(),e=O_(),r=A_(),i=Wh(),s="[object Boolean]",o="[object Date]",a="[object Map]",u="[object Number]",c="[object RegExp]",f="[object Set]",l="[object String]",h="[object Symbol]",g="[object ArrayBuffer]",p="[object DataView]",v="[object Float32Array]",m="[object Float64Array]",d="[object Int8Array]",y="[object Int16Array]",w="[object Int32Array]",b="[object Uint8Array]",x="[object Uint8ClampedArray]",M="[object Uint16Array]",N="[object Uint32Array]";function E(O,_,S){var q=O.constructor;switch(_){case g:return n(O);case s:case o:return new q(+O);case p:return t(O,S);case v:case m:case d:case y:case w:case b:case x:case M:case N:return i(O,S);case a:return new q;case u:case l:return new q(O);case c:return e(O);case f:return new q;case h:return r(O)}}return Is=E,Is}var Ts,Kh;function Xh(){if(Kh)return Ts;Kh=1;var n=Re(),t=Object.create,e=function(){function r(){}return function(i){if(!n(i))return{};if(t)return t(i);r.prototype=i;var s=new r;return r.prototype=void 0,s}}();return Ts=e,Ts}var ks,Zh;function Jh(){if(Zh)return ks;Zh=1;var n=Xh(),t=Ir(),e=Ar();function r(i){return typeof i.constructor=="function"&&!e(i)?n(t(i)):{}}return ks=r,ks}var js,Qh;function T_(){if(Qh)return js;Qh=1;var n=Nt(),t=Te(),e="[object Map]";function r(i){return t(i)&&n(i)==e}return js=r,js}var Cs,Hh;function k_(){if(Hh)return Cs;Hh=1;var n=T_(),t=Or(),e=Ui(),r=e&&e.isMap,i=r?t(r):n;return Cs=i,Cs}var Ps,ed;function j_(){if(ed)return Ps;ed=1;var n=Nt(),t=Te(),e="[object Set]";function r(i){return t(i)&&n(i)==e}return Ps=r,Ps}var Ls,td;function C_(){if(td)return Ls;td=1;var n=j_(),t=Or(),e=Ui(),r=e&&e.isSet,i=r?t(r):n;return Ls=i,Ls}var Ds,rd;function nd(){if(rd)return Ds;rd=1;var n=Mr(),t=Ri(),e=Rr(),r=m_(),i=b_(),s=dh(),o=ph(),a=__(),u=E_(),c=Ah(),f=x_(),l=Nt(),h=R_(),g=I_(),p=Jh(),v=oe(),m=xt(),d=k_(),y=Re(),w=C_(),b=Xe(),x=ut(),M=1,N=2,E=4,O="[object Arguments]",_="[object Array]",S="[object Boolean]",q="[object Date]",R="[object Error]",T="[object Function]",I="[object GeneratorFunction]",j="[object Map]",F="[object Number]",A="[object Object]",k="[object RegExp]",L="[object Set]",D="[object String]",G="[object Symbol]",P="[object WeakMap]",z="[object ArrayBuffer]",B="[object DataView]",Z="[object Float32Array]",V="[object Float64Array]",le="[object Int8Array]",Ee="[object Int16Array]",Hu="[object Int32Array]",ec="[object Uint8Array]",tc="[object Uint8ClampedArray]",rc="[object Uint16Array]",nc="[object Uint32Array]",H={};H[O]=H[_]=H[z]=H[B]=H[S]=H[q]=H[Z]=H[V]=H[le]=H[Ee]=H[Hu]=H[j]=H[F]=H[A]=H[k]=H[L]=H[D]=H[G]=H[ec]=H[tc]=H[rc]=H[nc]=!0,H[R]=H[T]=H[P]=!1;function Ot(Q,At,It,JS,Zr,et){var ye,Jr=At&M,Qr=At&N,QS=At&E;if(It&&(ye=Zr?It(Q,JS,Zr,et):It(Q)),ye!==void 0)return ye;if(!y(Q))return Q;var p0=v(Q);if(p0){if(ye=h(Q),!Jr)return o(Q,ye)}else{var Tt=l(Q),v0=Tt==T||Tt==I;if(m(Q))return s(Q,Jr);if(Tt==A||Tt==O||v0&&!Zr){if(ye=Qr||v0?{}:p(Q),!Jr)return Qr?u(Q,i(ye,Q)):a(Q,r(ye,Q))}else{if(!H[Tt])return Zr?Q:{};ye=g(Q,Tt,Jr)}}et||(et=new n);var m0=et.get(Q);if(m0)return m0;et.set(Q,ye),w(Q)?Q.forEach(function(tt){ye.add(Ot(tt,At,It,tt,Q,et))}):d(Q)&&Q.forEach(function(tt,ht){ye.set(ht,Ot(tt,At,It,ht,Q,et))});var HS=QS?Qr?f:c:Qr?x:b,y0=p0?void 0:HS(Q);return t(y0||Q,function(tt,ht){y0&&(ht=tt,tt=Q[ht]),e(ye,ht,Ot(tt,At,It,ht,Q,et))}),ye}return Ds=Ot,Ds}var zs,id;function P_(){if(id)return zs;id=1;var n=nd(),t=4;function e(r){return n(r,t)}return zs=e,zs}var $s,sd;function Fs(){if(sd)return $s;sd=1;function n(t){return function(){return t}}return $s=n,$s}var Bs,od;function L_(){if(od)return Bs;od=1;function n(t){return function(e,r,i){for(var s=-1,o=Object(e),a=i(e),u=a.length;u--;){var c=a[t?u:++s];if(r(o[c],c,o)===!1)break}return e}}return Bs=n,Bs}var Us,ad;function Gs(){if(ad)return Us;ad=1;var n=L_(),t=n();return Us=t,Us}var Vs,ud;function Ws(){if(ud)return Vs;ud=1;var n=Gs(),t=Xe();function e(r,i){return r&&n(r,i,t)}return Vs=e,Vs}var Ys,cd;function D_(){if(cd)return Ys;cd=1;var n=Le();function t(e,r){return function(i,s){if(i==null)return i;if(!n(i))return e(i,s);for(var o=i.length,a=r?o:-1,u=Object(i);(r?a--:++a<o)&&s(u[a],a,u)!==!1;);return i}}return Ys=t,Ys}var Ks,fd;function Tr(){if(fd)return Ks;fd=1;var n=Ws(),t=D_(),e=t(n);return Ks=e,Ks}var Xs,ld;function ct(){if(ld)return Xs;ld=1;function n(t){return t}return Xs=n,Xs}var Zs,hd;function dd(){if(hd)return Zs;hd=1;var n=ct();function t(e){return typeof e=="function"?e:n}return Zs=t,Zs}var Js,gd;function pd(){if(gd)return Js;gd=1;var n=Ri(),t=Tr(),e=dd(),r=oe();function i(s,o){var a=r(s)?n:t;return a(s,e(o))}return Js=i,Js}var Qs,vd;function md(){return vd||(vd=1,Qs=pd()),Qs}var Hs,yd;function z_(){if(yd)return Hs;yd=1;var n=Tr();function t(e,r){var i=[];return n(e,function(s,o,a){r(s,o,a)&&i.push(s)}),i}return Hs=t,Hs}var eo,wd;function $_(){if(wd)return eo;wd=1;var n="__lodash_hash_undefined__";function t(e){return this.__data__.set(e,n),this}return eo=t,eo}var to,bd;function F_(){if(bd)return to;bd=1;function n(t){return this.__data__.has(t)}return to=n,to}var ro,_d;function Ed(){if(_d)return ro;_d=1;var n=xi(),t=$_(),e=F_();function r(i){var s=-1,o=i==null?0:i.length;for(this.__data__=new n;++s<o;)this.add(i[s])}return r.prototype.add=r.prototype.push=t,r.prototype.has=e,ro=r,ro}var no,xd;function B_(){if(xd)return no;xd=1;function n(t,e){for(var r=-1,i=t==null?0:t.length;++r<i;)if(e(t[r],r,t))return!0;return!1}return no=n,no}var io,Nd;function Md(){if(Nd)return io;Nd=1;function n(t,e){return t.has(e)}return io=n,io}var so,Sd;function Rd(){if(Sd)return so;Sd=1;var n=Ed(),t=B_(),e=Md(),r=1,i=2;function s(o,a,u,c,f,l){var h=u&r,g=o.length,p=a.length;if(g!=p&&!(h&&p>g))return!1;var v=l.get(o),m=l.get(a);if(v&&m)return v==a&&m==o;var d=-1,y=!0,w=u&i?new n:void 0;for(l.set(o,a),l.set(a,o);++d<g;){var b=o[d],x=a[d];if(c)var M=h?c(x,b,d,a,o,l):c(b,x,d,o,a,l);if(M!==void 0){if(M)continue;y=!1;break}if(w){if(!t(a,function(N,E){if(!e(w,E)&&(b===N||f(b,N,u,c,l)))return w.push(E)})){y=!1;break}}else if(!(b===x||f(b,x,u,c,l))){y=!1;break}}return l.delete(o),l.delete(a),y}return so=s,so}var oo,qd;function U_(){if(qd)return oo;qd=1;function n(t){var e=-1,r=Array(t.size);return t.forEach(function(i,s){r[++e]=[s,i]}),r}return oo=n,oo}var ao,Od;function uo(){if(Od)return ao;Od=1;function n(t){var e=-1,r=Array(t.size);return t.forEach(function(i){r[++e]=i}),r}return ao=n,ao}var co,Ad;function G_(){if(Ad)return co;Ad=1;var n=Et(),t=$h(),e=_t(),r=Rd(),i=U_(),s=uo(),o=1,a=2,u="[object Boolean]",c="[object Date]",f="[object Error]",l="[object Map]",h="[object Number]",g="[object RegExp]",p="[object Set]",v="[object String]",m="[object Symbol]",d="[object ArrayBuffer]",y="[object DataView]",w=n?n.prototype:void 0,b=w?w.valueOf:void 0;function x(M,N,E,O,_,S,q){switch(E){case y:if(M.byteLength!=N.byteLength||M.byteOffset!=N.byteOffset)return!1;M=M.buffer,N=N.buffer;case d:return!(M.byteLength!=N.byteLength||!S(new t(M),new t(N)));case u:case c:case h:return e(+M,+N);case f:return M.name==N.name&&M.message==N.message;case g:case v:return M==N+"";case l:var R=i;case p:var T=O&o;if(R||(R=s),M.size!=N.size&&!T)return!1;var I=q.get(M);if(I)return I==N;O|=a,q.set(M,N);var j=r(R(M),R(N),O,_,S,q);return q.delete(M),j;case m:if(b)return b.call(M)==b.call(N)}return!1}return co=x,co}var fo,Id;function V_(){if(Id)return fo;Id=1;var n=Ah(),t=1,e=Object.prototype,r=e.hasOwnProperty;function i(s,o,a,u,c,f){var l=a&t,h=n(s),g=h.length,p=n(o),v=p.length;if(g!=v&&!l)return!1;for(var m=g;m--;){var d=h[m];if(!(l?d in o:r.call(o,d)))return!1}var y=f.get(s),w=f.get(o);if(y&&w)return y==o&&w==s;var b=!0;f.set(s,o),f.set(o,s);for(var x=l;++m<g;){d=h[m];var M=s[d],N=o[d];if(u)var E=l?u(N,M,d,o,s,f):u(M,N,d,s,o,f);if(!(E===void 0?M===N||c(M,N,a,u,f):E)){b=!1;break}x||(x=d=="constructor")}if(b&&!x){var O=s.constructor,_=o.constructor;O!=_&&"constructor"in s&&"constructor"in o&&!(typeof O=="function"&&O instanceof O&&typeof _=="function"&&_ instanceof _)&&(b=!1)}return f.delete(s),f.delete(o),b}return fo=i,fo}var lo,Td;function W_(){if(Td)return lo;Td=1;var n=Mr(),t=Rd(),e=G_(),r=V_(),i=Nt(),s=oe(),o=xt(),a=Vt(),u=1,c="[object Arguments]",f="[object Array]",l="[object Object]",h=Object.prototype,g=h.hasOwnProperty;function p(v,m,d,y,w,b){var x=s(v),M=s(m),N=x?f:i(v),E=M?f:i(m);N=N==c?l:N,E=E==c?l:E;var O=N==l,_=E==l,S=N==E;if(S&&o(v)){if(!o(m))return!1;x=!0,O=!1}if(S&&!O)return b||(b=new n),x||a(v)?t(v,m,d,y,w,b):e(v,m,N,d,y,w,b);if(!(d&u)){var q=O&&g.call(v,"__wrapped__"),R=_&&g.call(m,"__wrapped__");if(q||R){var T=q?v.value():v,I=R?m.value():m;return b||(b=new n),w(T,I,d,y,b)}}return S?(b||(b=new n),r(v,m,d,y,w,b)):!1}return lo=p,lo}var ho,kd;function jd(){if(kd)return ho;kd=1;var n=W_(),t=Te();function e(r,i,s,o,a){return r===i?!0:r==null||i==null||!t(r)&&!t(i)?r!==r&&i!==i:n(r,i,s,o,e,a)}return ho=e,ho}var go,Cd;function Y_(){if(Cd)return go;Cd=1;var n=Mr(),t=jd(),e=1,r=2;function i(s,o,a,u){var c=a.length,f=c,l=!u;if(s==null)return!f;for(s=Object(s);c--;){var h=a[c];if(l&&h[2]?h[1]!==s[h[0]]:!(h[0]in s))return!1}for(;++c<f;){h=a[c];var g=h[0],p=s[g],v=h[1];if(l&&h[2]){if(p===void 0&&!(g in s))return!1}else{var m=new n;if(u)var d=u(p,v,g,s,o,m);if(!(d===void 0?t(v,p,e|r,u,m):d))return!1}}return!0}return go=i,go}var po,Pd;function Ld(){if(Pd)return po;Pd=1;var n=Re();function t(e){return e===e&&!n(e)}return po=t,po}var vo,Dd;function K_(){if(Dd)return vo;Dd=1;var n=Ld(),t=Xe();function e(r){for(var i=t(r),s=i.length;s--;){var o=i[s],a=r[o];i[s]=[o,a,n(a)]}return i}return vo=e,vo}var mo,zd;function $d(){if(zd)return mo;zd=1;function n(t,e){return function(r){return r==null?!1:r[t]===e&&(e!==void 0||t in Object(r))}}return mo=n,mo}var yo,Fd;function X_(){if(Fd)return yo;Fd=1;var n=Y_(),t=K_(),e=$d();function r(i){var s=t(i);return s.length==1&&s[0][2]?e(s[0][0],s[0][1]):function(o){return o===i||n(o,i,s)}}return yo=r,yo}var wo,Bd;function Mt(){if(Bd)return wo;Bd=1;var n=ot(),t=Te(),e="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&n(i)==e}return wo=r,wo}var bo,Ud;function _o(){if(Ud)return bo;Ud=1;var n=oe(),t=Mt(),e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(s,o){if(n(s))return!1;var a=typeof s;return a=="number"||a=="symbol"||a=="boolean"||s==null||t(s)?!0:r.test(s)||!e.test(s)||o!=null&&s in Object(o)}return bo=i,bo}var Eo,Gd;function Z_(){if(Gd)return Eo;Gd=1;var n=xi(),t="Expected a function";function e(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var s=function(){var o=arguments,a=i?i.apply(this,o):o[0],u=s.cache;if(u.has(a))return u.get(a);var c=r.apply(this,o);return s.cache=u.set(a,c)||u,c};return s.cache=new(e.Cache||n),s}return e.Cache=n,Eo=e,Eo}var xo,Vd;function J_(){if(Vd)return xo;Vd=1;var n=Z_(),t=500;function e(r){var i=n(r,function(o){return s.size===t&&s.clear(),o}),s=i.cache;return i}return xo=e,xo}var No,Wd;function Q_(){if(Wd)return No;Wd=1;var n=J_(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,r=n(function(i){var s=[];return i.charCodeAt(0)===46&&s.push(""),i.replace(t,function(o,a,u,c){s.push(u?c.replace(e,"$1"):a||o)}),s});return No=r,No}var Mo,Yd;function kr(){if(Yd)return Mo;Yd=1;function n(t,e){for(var r=-1,i=t==null?0:t.length,s=Array(i);++r<i;)s[r]=e(t[r],r,t);return s}return Mo=n,Mo}var So,Kd;function H_(){if(Kd)return So;Kd=1;var n=Et(),t=kr(),e=oe(),r=Mt(),i=1/0,s=n?n.prototype:void 0,o=s?s.toString:void 0;function a(u){if(typeof u=="string")return u;if(e(u))return t(u,a)+"";if(r(u))return o?o.call(u):"";var c=u+"";return c=="0"&&1/u==-i?"-0":c}return So=a,So}var Ro,Xd;function Zd(){if(Xd)return Ro;Xd=1;var n=H_();function t(e){return e==null?"":n(e)}return Ro=t,Ro}var qo,Jd;function jr(){if(Jd)return qo;Jd=1;var n=oe(),t=_o(),e=Q_(),r=Zd();function i(s,o){return n(s)?s:t(s,o)?[s]:e(r(s))}return qo=i,qo}var Oo,Qd;function Yt(){if(Qd)return Oo;Qd=1;var n=Mt(),t=1/0;function e(r){if(typeof r=="string"||n(r))return r;var i=r+"";return i=="0"&&1/r==-t?"-0":i}return Oo=e,Oo}var Ao,Hd;function Cr(){if(Hd)return Ao;Hd=1;var n=jr(),t=Yt();function e(r,i){i=n(i,r);for(var s=0,o=i.length;r!=null&&s<o;)r=r[t(i[s++])];return s&&s==o?r:void 0}return Ao=e,Ao}var Io,eg;function eE(){if(eg)return Io;eg=1;var n=Cr();function t(e,r,i){var s=e==null?void 0:n(e,r);return s===void 0?i:s}return Io=t,Io}var To,tg;function tE(){if(tg)return To;tg=1;function n(t,e){return t!=null&&e in Object(t)}return To=n,To}var ko,rg;function ng(){if(rg)return ko;rg=1;var n=jr(),t=Bt(),e=oe(),r=qr(),i=$i(),s=Yt();function o(a,u,c){u=n(u,a);for(var f=-1,l=u.length,h=!1;++f<l;){var g=s(u[f]);if(!(h=a!=null&&c(a,g)))break;a=a[g]}return h||++f!=l?h:(l=a==null?0:a.length,!!l&&i(l)&&r(g,l)&&(e(a)||t(a)))}return ko=o,ko}var jo,ig;function sg(){if(ig)return jo;ig=1;var n=tE(),t=ng();function e(r,i){return r!=null&&t(r,i,n)}return jo=e,jo}var Co,og;function rE(){if(og)return Co;og=1;var n=jd(),t=eE(),e=sg(),r=_o(),i=Ld(),s=$d(),o=Yt(),a=1,u=2;function c(f,l){return r(f)&&i(l)?s(o(f),l):function(h){var g=t(h,f);return g===void 0&&g===l?e(h,f):n(l,g,a|u)}}return Co=c,Co}var Po,ag;function ug(){if(ag)return Po;ag=1;function n(t){return function(e){return e==null?void 0:e[t]}}return Po=n,Po}var Lo,cg;function nE(){if(cg)return Lo;cg=1;var n=Cr();function t(e){return function(r){return n(r,e)}}return Lo=t,Lo}var Do,fg;function iE(){if(fg)return Do;fg=1;var n=ug(),t=nE(),e=_o(),r=Yt();function i(s){return e(s)?n(r(s)):t(s)}return Do=i,Do}var zo,lg;function De(){if(lg)return zo;lg=1;var n=X_(),t=rE(),e=ct(),r=oe(),i=iE();function s(o){return typeof o=="function"?o:o==null?e:typeof o=="object"?r(o)?t(o[0],o[1]):n(o):i(o)}return zo=s,zo}var $o,hg;function dg(){if(hg)return $o;hg=1;var n=mh(),t=z_(),e=De(),r=oe();function i(s,o){var a=r(s)?n:t;return a(s,e(o,3))}return $o=i,$o}var Fo,gg;function sE(){if(gg)return Fo;gg=1;var n=Object.prototype,t=n.hasOwnProperty;function e(r,i){return r!=null&&t.call(r,i)}return Fo=e,Fo}var Bo,pg;function vg(){if(pg)return Bo;pg=1;var n=sE(),t=ng();function e(r,i){return r!=null&&t(r,i,n)}return Bo=e,Bo}var Uo,mg;function oE(){if(mg)return Uo;mg=1;var n=Zi(),t=Nt(),e=Bt(),r=oe(),i=Le(),s=xt(),o=Ar(),a=Vt(),u="[object Map]",c="[object Set]",f=Object.prototype,l=f.hasOwnProperty;function h(g){if(g==null)return!0;if(i(g)&&(r(g)||typeof g=="string"||typeof g.splice=="function"||s(g)||a(g)||e(g)))return!g.length;var p=t(g);if(p==u||p==c)return!g.size;if(o(g))return!n(g).length;for(var v in g)if(l.call(g,v))return!1;return!0}return Uo=h,Uo}var Go,yg;function wg(){if(yg)return Go;yg=1;function n(t){return t===void 0}return Go=n,Go}var Vo,bg;function _g(){if(bg)return Vo;bg=1;var n=Tr(),t=Le();function e(r,i){var s=-1,o=t(r)?Array(r.length):[];return n(r,function(a,u,c){o[++s]=i(a,u,c)}),o}return Vo=e,Vo}var Wo,Eg;function xg(){if(Eg)return Wo;Eg=1;var n=kr(),t=De(),e=_g(),r=oe();function i(s,o){var a=r(s)?n:e;return a(s,t(o,3))}return Wo=i,Wo}var Yo,Ng;function aE(){if(Ng)return Yo;Ng=1;function n(t,e,r,i){var s=-1,o=t==null?0:t.length;for(i&&o&&(r=t[++s]);++s<o;)r=e(r,t[s],s,t);return r}return Yo=n,Yo}var Ko,Mg;function uE(){if(Mg)return Ko;Mg=1;function n(t,e,r,i,s){return s(t,function(o,a,u){r=i?(i=!1,o):e(r,o,a,u)}),r}return Ko=n,Ko}var Xo,Sg;function Rg(){if(Sg)return Xo;Sg=1;var n=aE(),t=Tr(),e=De(),r=uE(),i=oe();function s(o,a,u){var c=i(o)?n:r,f=arguments.length<3;return c(o,e(a,4),u,f,t)}return Xo=s,Xo}var Zo,qg;function cE(){if(qg)return Zo;qg=1;var n=ot(),t=oe(),e=Te(),r="[object String]";function i(s){return typeof s=="string"||!t(s)&&e(s)&&n(s)==r}return Zo=i,Zo}var Jo,Og;function fE(){if(Og)return Jo;Og=1;var n=ug(),t=n("length");return Jo=t,Jo}var Qo,Ag;function lE(){if(Ag)return Qo;Ag=1;var n="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+e+r,s="\\ufe0e\\ufe0f",o="\\u200d",a=RegExp("["+o+n+i+s+"]");function u(c){return a.test(c)}return Qo=u,Qo}var Ho,Ig;function hE(){if(Ig)return Ho;Ig=1;var n="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+e+r,s="\\ufe0e\\ufe0f",o="["+n+"]",a="["+i+"]",u="\\ud83c[\\udffb-\\udfff]",c="(?:"+a+"|"+u+")",f="[^"+n+"]",l="(?:\\ud83c[\\udde6-\\uddff]){2}",h="[\\ud800-\\udbff][\\udc00-\\udfff]",g="\\u200d",p=c+"?",v="["+s+"]?",m="(?:"+g+"(?:"+[f,l,h].join("|")+")"+v+p+")*",d=v+p+m,y="(?:"+[f+a+"?",a,l,h,o].join("|")+")",w=RegExp(u+"(?="+u+")|"+y+d,"g");function b(x){for(var M=w.lastIndex=0;w.test(x);)++M;return M}return Ho=b,Ho}var ea,Tg;function dE(){if(Tg)return ea;Tg=1;var n=fE(),t=lE(),e=hE();function r(i){return t(i)?e(i):n(i)}return ea=r,ea}var ta,kg;function gE(){if(kg)return ta;kg=1;var n=Zi(),t=Nt(),e=Le(),r=cE(),i=dE(),s="[object Map]",o="[object Set]";function a(u){if(u==null)return 0;if(e(u))return r(u)?i(u):u.length;var c=t(u);return c==s||c==o?u.size:n(u).length}return ta=a,ta}var ra,jg;function pE(){if(jg)return ra;jg=1;var n=Ri(),t=Xh(),e=Ws(),r=De(),i=Ir(),s=oe(),o=xt(),a=$t(),u=Re(),c=Vt();function f(l,h,g){var p=s(l),v=p||o(l)||c(l);if(h=r(h,4),g==null){var m=l&&l.constructor;v?g=p?new m:[]:u(l)?g=a(m)?t(i(l)):{}:g={}}return(v?n:e)(l,function(d,y,w){return h(g,d,y,w)}),g}return ra=f,ra}var na,Cg;function vE(){if(Cg)return na;Cg=1;var n=Et(),t=Bt(),e=oe(),r=n?n.isConcatSpreadable:void 0;function i(s){return e(s)||t(s)||!!(r&&s&&s[r])}return na=i,na}var ia,Pg;function sa(){if(Pg)return ia;Pg=1;var n=ls(),t=vE();function e(r,i,s,o,a){var u=-1,c=r.length;for(s||(s=t),a||(a=[]);++u<c;){var f=r[u];i>0&&s(f)?i>1?e(f,i-1,s,o,a):n(a,f):o||(a[a.length]=f)}return a}return ia=e,ia}var oa,Lg;function mE(){if(Lg)return oa;Lg=1;function n(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}return oa=n,oa}var aa,Dg;function zg(){if(Dg)return aa;Dg=1;var n=mE(),t=Math.max;function e(r,i,s){return i=t(i===void 0?r.length-1:i,0),function(){for(var o=arguments,a=-1,u=t(o.length-i,0),c=Array(u);++a<u;)c[a]=o[i+a];a=-1;for(var f=Array(i+1);++a<i;)f[a]=o[a];return f[i]=s(c),n(r,this,f)}}return aa=e,aa}var ua,$g;function yE(){if($g)return ua;$g=1;var n=Fs(),t=Cl(),e=ct(),r=t?function(i,s){return t(i,"toString",{configurable:!0,enumerable:!1,value:n(s),writable:!0})}:e;return ua=r,ua}var ca,Fg;function wE(){if(Fg)return ca;Fg=1;var n=800,t=16,e=Date.now;function r(i){var s=0,o=0;return function(){var a=e(),u=t-(a-o);if(o=a,u>0){if(++s>=n)return arguments[0]}else s=0;return i.apply(void 0,arguments)}}return ca=r,ca}var fa,Bg;function Ug(){if(Bg)return fa;Bg=1;var n=yE(),t=wE(),e=t(n);return fa=e,fa}var la,Gg;function Pr(){if(Gg)return la;Gg=1;var n=ct(),t=zg(),e=Ug();function r(i,s){return e(t(i,s,n),i+"")}return la=r,la}var ha,Vg;function Wg(){if(Vg)return ha;Vg=1;function n(t,e,r,i){for(var s=t.length,o=r+(i?1:-1);i?o--:++o<s;)if(e(t[o],o,t))return o;return-1}return ha=n,ha}var da,Yg;function bE(){if(Yg)return da;Yg=1;function n(t){return t!==t}return da=n,da}var ga,Kg;function _E(){if(Kg)return ga;Kg=1;function n(t,e,r){for(var i=r-1,s=t.length;++i<s;)if(t[i]===e)return i;return-1}return ga=n,ga}var pa,Xg;function EE(){if(Xg)return pa;Xg=1;var n=Wg(),t=bE(),e=_E();function r(i,s,o){return s===s?e(i,s,o):n(i,t,o)}return pa=r,pa}var va,Zg;function xE(){if(Zg)return va;Zg=1;var n=EE();function t(e,r){var i=e==null?0:e.length;return!!i&&n(e,r,0)>-1}return va=t,va}var ma,Jg;function NE(){if(Jg)return ma;Jg=1;function n(t,e,r){for(var i=-1,s=t==null?0:t.length;++i<s;)if(r(e,t[i]))return!0;return!1}return ma=n,ma}var ya,Qg;function ME(){if(Qg)return ya;Qg=1;function n(){}return ya=n,ya}var wa,Hg;function SE(){if(Hg)return wa;Hg=1;var n=Ch(),t=ME(),e=uo(),r=1/0,i=n&&1/e(new n([,-0]))[1]==r?function(s){return new n(s)}:t;return wa=i,wa}var ba,ep;function RE(){if(ep)return ba;ep=1;var n=Ed(),t=xE(),e=NE(),r=Md(),i=SE(),s=uo(),o=200;function a(u,c,f){var l=-1,h=t,g=u.length,p=!0,v=[],m=v;if(f)p=!1,h=e;else if(g>=o){var d=c?null:i(u);if(d)return s(d);p=!1,h=r,m=new n}else m=c?[]:v;e:for(;++l<g;){var y=u[l],w=c?c(y):y;if(y=f||y!==0?y:0,p&&w===w){for(var b=m.length;b--;)if(m[b]===w)continue e;c&&m.push(w),v.push(y)}else h(m,w,f)||(m!==v&&m.push(w),v.push(y))}return v}return ba=a,ba}var _a,tp;function rp(){if(tp)return _a;tp=1;var n=Le(),t=Te();function e(r){return t(r)&&n(r)}return _a=e,_a}var Ea,np;function qE(){if(np)return Ea;np=1;var n=sa(),t=Pr(),e=RE(),r=rp(),i=t(function(s){return e(n(s,1,r,!0))});return Ea=i,Ea}var xa,ip;function OE(){if(ip)return xa;ip=1;var n=kr();function t(e,r){return n(r,function(i){return e[i]})}return xa=t,xa}var Na,sp;function op(){if(sp)return Na;sp=1;var n=OE(),t=Xe();function e(r){return r==null?[]:n(r,t(r))}return Na=e,Na}var Ma,ap;function qe(){if(ap)return Ma;ap=1;var n;if(typeof kn=="function")try{n={clone:P_(),constant:Fs(),each:md(),filter:dg(),has:vg(),isArray:oe(),isEmpty:oE(),isFunction:$t(),isUndefined:wg(),keys:Xe(),map:xg(),reduce:Rg(),size:gE(),transform:pE(),union:qE(),values:op()}}catch{}return n||(n=window._),Ma=n,Ma}var Sa,up;function Ra(){if(up)return Sa;up=1;var n=qe();Sa=i;var t="\0",e="\0",r="";function i(f){this._isDirected=n.has(f,"directed")?f.directed:!0,this._isMultigraph=n.has(f,"multigraph")?f.multigraph:!1,this._isCompound=n.has(f,"compound")?f.compound:!1,this._label=void 0,this._defaultNodeLabelFn=n.constant(void 0),this._defaultEdgeLabelFn=n.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[e]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(f){return this._label=f,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(f){return n.isFunction(f)||(f=n.constant(f)),this._defaultNodeLabelFn=f,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return n.keys(this._nodes)},i.prototype.sources=function(){var f=this;return n.filter(this.nodes(),function(l){return n.isEmpty(f._in[l])})},i.prototype.sinks=function(){var f=this;return n.filter(this.nodes(),function(l){return n.isEmpty(f._out[l])})},i.prototype.setNodes=function(f,l){var h=arguments,g=this;return n.each(f,function(p){h.length>1?g.setNode(p,l):g.setNode(p)}),this},i.prototype.setNode=function(f,l){return n.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=l),this):(this._nodes[f]=arguments.length>1?l:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=e,this._children[f]={},this._children[e][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},i.prototype.node=function(f){return this._nodes[f]},i.prototype.hasNode=function(f){return n.has(this._nodes,f)},i.prototype.removeNode=function(f){var l=this;if(n.has(this._nodes,f)){var h=function(g){l.removeEdge(l._edgeObjs[g])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],n.each(this.children(f),function(g){l.setParent(g)}),delete this._children[f]),n.each(n.keys(this._in[f]),h),delete this._in[f],delete this._preds[f],n.each(n.keys(this._out[f]),h),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},i.prototype.setParent=function(f,l){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(l))l=e;else{l+="";for(var h=l;!n.isUndefined(h);h=this.parent(h))if(h===f)throw new Error("Setting "+l+" as parent of "+f+" would create a cycle");this.setNode(l)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=l,this._children[l][f]=!0,this},i.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},i.prototype.parent=function(f){if(this._isCompound){var l=this._parent[f];if(l!==e)return l}},i.prototype.children=function(f){if(n.isUndefined(f)&&(f=e),this._isCompound){var l=this._children[f];if(l)return n.keys(l)}else{if(f===e)return this.nodes();if(this.hasNode(f))return[]}},i.prototype.predecessors=function(f){var l=this._preds[f];if(l)return n.keys(l)},i.prototype.successors=function(f){var l=this._sucs[f];if(l)return n.keys(l)},i.prototype.neighbors=function(f){var l=this.predecessors(f);if(l)return n.union(l,this.successors(f))},i.prototype.isLeaf=function(f){var l;return this.isDirected()?l=this.successors(f):l=this.neighbors(f),l.length===0},i.prototype.filterNodes=function(f){var l=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});l.setGraph(this.graph());var h=this;n.each(this._nodes,function(v,m){f(m)&&l.setNode(m,v)}),n.each(this._edgeObjs,function(v){l.hasNode(v.v)&&l.hasNode(v.w)&&l.setEdge(v,h.edge(v))});var g={};function p(v){var m=h.parent(v);return m===void 0||l.hasNode(m)?(g[v]=m,m):m in g?g[m]:p(m)}return this._isCompound&&n.each(l.nodes(),function(v){l.setParent(v,p(v))}),l},i.prototype.setDefaultEdgeLabel=function(f){return n.isFunction(f)||(f=n.constant(f)),this._defaultEdgeLabelFn=f,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return n.values(this._edgeObjs)},i.prototype.setPath=function(f,l){var h=this,g=arguments;return n.reduce(f,function(p,v){return g.length>1?h.setEdge(p,v,l):h.setEdge(p,v),v}),this},i.prototype.setEdge=function(){var f,l,h,g,p=!1,v=arguments[0];typeof v=="object"&&v!==null&&"v"in v?(f=v.v,l=v.w,h=v.name,arguments.length===2&&(g=arguments[1],p=!0)):(f=v,l=arguments[1],h=arguments[3],arguments.length>2&&(g=arguments[2],p=!0)),f=""+f,l=""+l,n.isUndefined(h)||(h=""+h);var m=a(this._isDirected,f,l,h);if(n.has(this._edgeLabels,m))return p&&(this._edgeLabels[m]=g),this;if(!n.isUndefined(h)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(l),this._edgeLabels[m]=p?g:this._defaultEdgeLabelFn(f,l,h);var d=u(this._isDirected,f,l,h);return f=d.v,l=d.w,Object.freeze(d),this._edgeObjs[m]=d,s(this._preds[l],f),s(this._sucs[f],l),this._in[l][m]=d,this._out[f][m]=d,this._edgeCount++,this},i.prototype.edge=function(f,l,h){var g=arguments.length===1?c(this._isDirected,arguments[0]):a(this._isDirected,f,l,h);return this._edgeLabels[g]},i.prototype.hasEdge=function(f,l,h){var g=arguments.length===1?c(this._isDirected,arguments[0]):a(this._isDirected,f,l,h);return n.has(this._edgeLabels,g)},i.prototype.removeEdge=function(f,l,h){var g=arguments.length===1?c(this._isDirected,arguments[0]):a(this._isDirected,f,l,h),p=this._edgeObjs[g];return p&&(f=p.v,l=p.w,delete this._edgeLabels[g],delete this._edgeObjs[g],o(this._preds[l],f),o(this._sucs[f],l),delete this._in[l][g],delete this._out[f][g],this._edgeCount--),this},i.prototype.inEdges=function(f,l){var h=this._in[f];if(h){var g=n.values(h);return l?n.filter(g,function(p){return p.v===l}):g}},i.prototype.outEdges=function(f,l){var h=this._out[f];if(h){var g=n.values(h);return l?n.filter(g,function(p){return p.w===l}):g}},i.prototype.nodeEdges=function(f,l){var h=this.inEdges(f,l);if(h)return h.concat(this.outEdges(f,l))};function s(f,l){f[l]?f[l]++:f[l]=1}function o(f,l){--f[l]||delete f[l]}function a(f,l,h,g){var p=""+l,v=""+h;if(!f&&p>v){var m=p;p=v,v=m}return p+r+v+r+(n.isUndefined(g)?t:g)}function u(f,l,h,g){var p=""+l,v=""+h;if(!f&&p>v){var m=p;p=v,v=m}var d={v:p,w:v};return g&&(d.name=g),d}function c(f,l){return a(f,l.v,l.w,l.name)}return Sa}var qa,cp;function AE(){return cp||(cp=1,qa="2.1.8"),qa}var Oa,fp;function IE(){return fp||(fp=1,Oa={Graph:Ra(),version:AE()}),Oa}var Aa,lp;function TE(){if(lp)return Aa;lp=1;var n=qe(),t=Ra();Aa={write:e,read:s};function e(o){var a={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:r(o),edges:i(o)};return n.isUndefined(o.graph())||(a.value=n.clone(o.graph())),a}function r(o){return n.map(o.nodes(),function(a){var u=o.node(a),c=o.parent(a),f={v:a};return n.isUndefined(u)||(f.value=u),n.isUndefined(c)||(f.parent=c),f})}function i(o){return n.map(o.edges(),function(a){var u=o.edge(a),c={v:a.v,w:a.w};return n.isUndefined(a.name)||(c.name=a.name),n.isUndefined(u)||(c.value=u),c})}function s(o){var a=new t(o.options).setGraph(o.value);return n.each(o.nodes,function(u){a.setNode(u.v,u.value),u.parent&&a.setParent(u.v,u.parent)}),n.each(o.edges,function(u){a.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),a}return Aa}var Ia,hp;function kE(){if(hp)return Ia;hp=1;var n=qe();Ia=t;function t(e){var r={},i=[],s;function o(a){n.has(r,a)||(r[a]=!0,s.push(a),n.each(e.successors(a),o),n.each(e.predecessors(a),o))}return n.each(e.nodes(),function(a){s=[],o(a),s.length&&i.push(s)}),i}return Ia}var Ta,dp;function gp(){if(dp)return Ta;dp=1;var n=qe();Ta=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(e){return e.key})},t.prototype.has=function(e){return n.has(this._keyIndices,e)},t.prototype.priority=function(e){var r=this._keyIndices[e];if(r!==void 0)return this._arr[r].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(e,r){var i=this._keyIndices;if(e=String(e),!n.has(i,e)){var s=this._arr,o=s.length;return i[e]=o,s.push({key:e,priority:r}),this._decrease(o),!0}return!1},t.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},t.prototype.decrease=function(e,r){var i=this._keyIndices[e];if(r>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[i].priority+" New: "+r);this._arr[i].priority=r,this._decrease(i)},t.prototype._heapify=function(e){var r=this._arr,i=2*e,s=i+1,o=e;i<r.length&&(o=r[i].priority<r[o].priority?i:o,s<r.length&&(o=r[s].priority<r[o].priority?s:o),o!==e&&(this._swap(e,o),this._heapify(o)))},t.prototype._decrease=function(e){for(var r=this._arr,i=r[e].priority,s;e!==0&&(s=e>>1,!(r[s].priority<i));)this._swap(e,s),e=s},t.prototype._swap=function(e,r){var i=this._arr,s=this._keyIndices,o=i[e],a=i[r];i[e]=a,i[r]=o,s[a.key]=e,s[o.key]=r},Ta}var ka,pp;function vp(){if(pp)return ka;pp=1;var n=qe(),t=gp();ka=r;var e=n.constant(1);function r(s,o,a,u){return i(s,String(o),a||e,u||function(c){return s.outEdges(c)})}function i(s,o,a,u){var c={},f=new t,l,h,g=function(p){var v=p.v!==l?p.v:p.w,m=c[v],d=a(p),y=h.distance+d;if(d<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+p+" Weight: "+d);y<m.distance&&(m.distance=y,m.predecessor=l,f.decrease(v,y))};for(s.nodes().forEach(function(p){var v=p===o?0:Number.POSITIVE_INFINITY;c[p]={distance:v},f.add(p,v)});f.size()>0&&(l=f.removeMin(),h=c[l],h.distance!==Number.POSITIVE_INFINITY);)u(l).forEach(g);return c}return ka}var ja,mp;function jE(){if(mp)return ja;mp=1;var n=vp(),t=qe();ja=e;function e(r,i,s){return t.transform(r.nodes(),function(o,a){o[a]=n(r,a,i,s)},{})}return ja}var Ca,yp;function wp(){if(yp)return Ca;yp=1;var n=qe();Ca=t;function t(e){var r=0,i=[],s={},o=[];function a(u){var c=s[u]={onStack:!0,lowlink:r,index:r++};if(i.push(u),e.successors(u).forEach(function(h){n.has(s,h)?s[h].onStack&&(c.lowlink=Math.min(c.lowlink,s[h].index)):(a(h),c.lowlink=Math.min(c.lowlink,s[h].lowlink))}),c.lowlink===c.index){var f=[],l;do l=i.pop(),s[l].onStack=!1,f.push(l);while(u!==l);o.push(f)}}return e.nodes().forEach(function(u){n.has(s,u)||a(u)}),o}return Ca}var Pa,bp;function CE(){if(bp)return Pa;bp=1;var n=qe(),t=wp();Pa=e;function e(r){return n.filter(t(r),function(i){return i.length>1||i.length===1&&r.hasEdge(i[0],i[0])})}return Pa}var La,_p;function PE(){if(_p)return La;_p=1;var n=qe();La=e;var t=n.constant(1);function e(i,s,o){return r(i,s||t,o||function(a){return i.outEdges(a)})}function r(i,s,o){var a={},u=i.nodes();return u.forEach(function(c){a[c]={},a[c][c]={distance:0},u.forEach(function(f){c!==f&&(a[c][f]={distance:Number.POSITIVE_INFINITY})}),o(c).forEach(function(f){var l=f.v===c?f.w:f.v,h=s(f);a[c][l]={distance:h,predecessor:c}})}),u.forEach(function(c){var f=a[c];u.forEach(function(l){var h=a[l];u.forEach(function(g){var p=h[c],v=f[g],m=h[g],d=p.distance+v.distance;d<m.distance&&(m.distance=d,m.predecessor=v.predecessor)})})}),a}return La}var Da,Ep;function xp(){if(Ep)return Da;Ep=1;var n=qe();Da=t,t.CycleException=e;function t(r){var i={},s={},o=[];function a(u){if(n.has(s,u))throw new e;n.has(i,u)||(s[u]=!0,i[u]=!0,n.each(r.predecessors(u),a),delete s[u],o.push(u))}if(n.each(r.sinks(),a),n.size(i)!==r.nodeCount())throw new e;return o}function e(){}return e.prototype=new Error,Da}var za,Np;function LE(){if(Np)return za;Np=1;var n=xp();za=t;function t(e){try{n(e)}catch(r){if(r instanceof n.CycleException)return!1;throw r}return!0}return za}var $a,Mp;function Sp(){if(Mp)return $a;Mp=1;var n=qe();$a=t;function t(r,i,s){n.isArray(i)||(i=[i]);var o=(r.isDirected()?r.successors:r.neighbors).bind(r),a=[],u={};return n.each(i,function(c){if(!r.hasNode(c))throw new Error("Graph does not have node: "+c);e(r,c,s==="post",u,o,a)}),a}function e(r,i,s,o,a,u){n.has(o,i)||(o[i]=!0,s||u.push(i),n.each(a(i),function(c){e(r,c,s,o,a,u)}),s&&u.push(i))}return $a}var Fa,Rp;function DE(){if(Rp)return Fa;Rp=1;var n=Sp();Fa=t;function t(e,r){return n(e,r,"post")}return Fa}var Ba,qp;function zE(){if(qp)return Ba;qp=1;var n=Sp();Ba=t;function t(e,r){return n(e,r,"pre")}return Ba}var Ua,Op;function $E(){if(Op)return Ua;Op=1;var n=qe(),t=Ra(),e=gp();Ua=r;function r(i,s){var o=new t,a={},u=new e,c;function f(h){var g=h.v===c?h.w:h.v,p=u.priority(g);if(p!==void 0){var v=s(h);v<p&&(a[g]=c,u.decrease(g,v))}}if(i.nodeCount()===0)return o;n.each(i.nodes(),function(h){u.add(h,Number.POSITIVE_INFINITY),o.setNode(h)}),u.decrease(i.nodes()[0],0);for(var l=!1;u.size()>0;){if(c=u.removeMin(),n.has(a,c))o.setEdge(c,a[c]);else{if(l)throw new Error("Input graph is not connected: "+i);l=!0}i.nodeEdges(c).forEach(f)}return o}return Ua}var Ga,Ap;function FE(){return Ap||(Ap=1,Ga={components:kE(),dijkstra:vp(),dijkstraAll:jE(),findCycles:CE(),floydWarshall:PE(),isAcyclic:LE(),postorder:DE(),preorder:zE(),prim:$E(),tarjan:wp(),topsort:xp()}),Ga}var Va,Ip;function BE(){if(Ip)return Va;Ip=1;var n=IE();return Va={Graph:n.Graph,json:TE(),alg:FE(),version:n.version},Va}var Lr;if(typeof kn=="function")try{Lr=BE()}catch{}Lr||(Lr=window.graphlib);var Ae=Lr,Wa,Tp;function UE(){if(Tp)return Wa;Tp=1;var n=nd(),t=1,e=4;function r(i){return n(i,t|e)}return Wa=r,Wa}var Ya,kp;function Dr(){if(kp)return Ya;kp=1;var n=_t(),t=Le(),e=qr(),r=Re();function i(s,o,a){if(!r(a))return!1;var u=typeof o;return(u=="number"?t(a)&&e(o,a.length):u=="string"&&o in a)?n(a[o],s):!1}return Ya=i,Ya}var Ka,jp;function GE(){if(jp)return Ka;jp=1;var n=Pr(),t=_t(),e=Dr(),r=ut(),i=Object.prototype,s=i.hasOwnProperty,o=n(function(a,u){a=Object(a);var c=-1,f=u.length,l=f>2?u[2]:void 0;for(l&&e(u[0],u[1],l)&&(f=1);++c<f;)for(var h=u[c],g=r(h),p=-1,v=g.length;++p<v;){var m=g[p],d=a[m];(d===void 0||t(d,i[m])&&!s.call(a,m))&&(a[m]=h[m])}return a});return Ka=o,Ka}var Xa,Cp;function VE(){if(Cp)return Xa;Cp=1;var n=De(),t=Le(),e=Xe();function r(i){return function(s,o,a){var u=Object(s);if(!t(s)){var c=n(o,3);s=e(s),o=function(l){return c(u[l],l,u)}}var f=i(s,o,a);return f>-1?u[c?s[f]:f]:void 0}}return Xa=r,Xa}var Za,Pp;function WE(){if(Pp)return Za;Pp=1;var n=/\s/;function t(e){for(var r=e.length;r--&&n.test(e.charAt(r)););return r}return Za=t,Za}var Ja,Lp;function YE(){if(Lp)return Ja;Lp=1;var n=WE(),t=/^\s+/;function e(r){return r&&r.slice(0,n(r)+1).replace(t,"")}return Ja=e,Ja}var Qa,Dp;function KE(){if(Dp)return Qa;Dp=1;var n=YE(),t=Re(),e=Mt(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt;function u(c){if(typeof c=="number")return c;if(e(c))return r;if(t(c)){var f=typeof c.valueOf=="function"?c.valueOf():c;c=t(f)?f+"":f}if(typeof c!="string")return c===0?c:+c;c=n(c);var l=s.test(c);return l||o.test(c)?a(c.slice(2),l?2:8):i.test(c)?r:+c}return Qa=u,Qa}var Ha,zp;function $p(){if(zp)return Ha;zp=1;var n=KE(),t=1/0,e=17976931348623157e292;function r(i){if(!i)return i===0?i:0;if(i=n(i),i===t||i===-t){var s=i<0?-1:1;return s*e}return i===i?i:0}return Ha=r,Ha}var eu,Fp;function XE(){if(Fp)return eu;Fp=1;var n=$p();function t(e){var r=n(e),i=r%1;return r===r?i?r-i:r:0}return eu=t,eu}var tu,Bp;function ZE(){if(Bp)return tu;Bp=1;var n=Wg(),t=De(),e=XE(),r=Math.max;function i(s,o,a){var u=s==null?0:s.length;if(!u)return-1;var c=a==null?0:e(a);return c<0&&(c=r(u+c,0)),n(s,t(o,3),c)}return tu=i,tu}var ru,Up;function JE(){if(Up)return ru;Up=1;var n=VE(),t=ZE(),e=n(t);return ru=e,ru}var nu,Gp;function Vp(){if(Gp)return nu;Gp=1;var n=sa();function t(e){var r=e==null?0:e.length;return r?n(e,1):[]}return nu=t,nu}var iu,Wp;function QE(){if(Wp)return iu;Wp=1;var n=Gs(),t=dd(),e=ut();function r(i,s){return i==null?i:n(i,t(s),e)}return iu=r,iu}var su,Yp;function HE(){if(Yp)return su;Yp=1;function n(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}return su=n,su}var ou,Kp;function ex(){if(Kp)return ou;Kp=1;var n=Sr(),t=Ws(),e=De();function r(i,s){var o={};return s=e(s,3),t(i,function(a,u,c){n(o,u,s(a,u,c))}),o}return ou=r,ou}var au,Xp;function uu(){if(Xp)return au;Xp=1;var n=Mt();function t(e,r,i){for(var s=-1,o=e.length;++s<o;){var a=e[s],u=r(a);if(u!=null&&(c===void 0?u===u&&!n(u):i(u,c)))var c=u,f=a}return f}return au=t,au}var cu,Zp;function tx(){if(Zp)return cu;Zp=1;function n(t,e){return t>e}return cu=n,cu}var fu,Jp;function rx(){if(Jp)return fu;Jp=1;var n=uu(),t=tx(),e=ct();function r(i){return i&&i.length?n(i,e,t):void 0}return fu=r,fu}var lu,Qp;function Hp(){if(Qp)return lu;Qp=1;var n=Sr(),t=_t();function e(r,i,s){(s!==void 0&&!t(r[i],s)||s===void 0&&!(i in r))&&n(r,i,s)}return lu=e,lu}var hu,ev;function nx(){if(ev)return hu;ev=1;var n=ot(),t=Ir(),e=Te(),r="[object Object]",i=Function.prototype,s=Object.prototype,o=i.toString,a=s.hasOwnProperty,u=o.call(Object);function c(f){if(!e(f)||n(f)!=r)return!1;var l=t(f);if(l===null)return!0;var h=a.call(l,"constructor")&&l.constructor;return typeof h=="function"&&h instanceof h&&o.call(h)==u}return hu=c,hu}var du,tv;function rv(){if(tv)return du;tv=1;function n(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}return du=n,du}var gu,nv;function ix(){if(nv)return gu;nv=1;var n=Ft(),t=ut();function e(r){return n(r,t(r))}return gu=e,gu}var pu,iv;function sx(){if(iv)return pu;iv=1;var n=Hp(),t=dh(),e=Wh(),r=ph(),i=Jh(),s=Bt(),o=oe(),a=rp(),u=xt(),c=$t(),f=Re(),l=nx(),h=Vt(),g=rv(),p=ix();function v(m,d,y,w,b,x,M){var N=g(m,y),E=g(d,y),O=M.get(E);if(O){n(m,y,O);return}var _=x?x(N,E,y+"",m,d,M):void 0,S=_===void 0;if(S){var q=o(E),R=!q&&u(E),T=!q&&!R&&h(E);_=E,q||R||T?o(N)?_=N:a(N)?_=r(N):R?(S=!1,_=t(E,!0)):T?(S=!1,_=e(E,!0)):_=[]:l(E)||s(E)?(_=N,s(N)?_=p(N):(!f(N)||c(N))&&(_=i(E))):S=!1}S&&(M.set(E,_),b(_,E,w,x,M),M.delete(E)),n(m,y,_)}return pu=v,pu}var vu,sv;function ox(){if(sv)return vu;sv=1;var n=Mr(),t=Hp(),e=Gs(),r=sx(),i=Re(),s=ut(),o=rv();function a(u,c,f,l,h){u!==c&&e(c,function(g,p){if(h||(h=new n),i(g))r(u,c,p,f,a,l,h);else{var v=l?l(o(u,p),g,p+"",u,c,h):void 0;v===void 0&&(v=g),t(u,p,v)}},s)}return vu=a,vu}var mu,ov;function ax(){if(ov)return mu;ov=1;var n=Pr(),t=Dr();function e(r){return n(function(i,s){var o=-1,a=s.length,u=a>1?s[a-1]:void 0,c=a>2?s[2]:void 0;for(u=r.length>3&&typeof u=="function"?(a--,u):void 0,c&&t(s[0],s[1],c)&&(u=a<3?void 0:u,a=1),i=Object(i);++o<a;){var f=s[o];f&&r(i,f,o,u)}return i})}return mu=e,mu}var yu,av;function ux(){if(av)return yu;av=1;var n=ox(),t=ax(),e=t(function(r,i,s){n(r,i,s)});return yu=e,yu}var wu,uv;function cv(){if(uv)return wu;uv=1;function n(t,e){return t<e}return wu=n,wu}var bu,fv;function cx(){if(fv)return bu;fv=1;var n=uu(),t=cv(),e=ct();function r(i){return i&&i.length?n(i,e,t):void 0}return bu=r,bu}var _u,lv;function fx(){if(lv)return _u;lv=1;var n=uu(),t=De(),e=cv();function r(i,s){return i&&i.length?n(i,t(s,2),e):void 0}return _u=r,_u}var Eu,hv;function lx(){if(hv)return Eu;hv=1;var n=Oe(),t=function(){return n.Date.now()};return Eu=t,Eu}var xu,dv;function hx(){if(dv)return xu;dv=1;var n=Rr(),t=jr(),e=qr(),r=Re(),i=Yt();function s(o,a,u,c){if(!r(o))return o;a=t(a,o);for(var f=-1,l=a.length,h=l-1,g=o;g!=null&&++f<l;){var p=i(a[f]),v=u;if(p==="__proto__"||p==="constructor"||p==="prototype")return o;if(f!=h){var m=g[p];v=c?c(m,p,g):void 0,v===void 0&&(v=r(m)?m:e(a[f+1])?[]:{})}n(g,p,v),g=g[p]}return o}return xu=s,xu}var Nu,gv;function dx(){if(gv)return Nu;gv=1;var n=Cr(),t=hx(),e=jr();function r(i,s,o){for(var a=-1,u=s.length,c={};++a<u;){var f=s[a],l=n(i,f);o(l,f)&&t(c,e(f,i),l)}return c}return Nu=r,Nu}var Mu,pv;function gx(){if(pv)return Mu;pv=1;var n=dx(),t=sg();function e(r,i){return n(r,i,function(s,o){return t(r,o)})}return Mu=e,Mu}var Su,vv;function px(){if(vv)return Su;vv=1;var n=Vp(),t=zg(),e=Ug();function r(i){return e(t(i,void 0,n),i+"")}return Su=r,Su}var Ru,mv;function vx(){if(mv)return Ru;mv=1;var n=gx(),t=px(),e=t(function(r,i){return r==null?{}:n(r,i)});return Ru=e,Ru}var qu,yv;function mx(){if(yv)return qu;yv=1;var n=Math.ceil,t=Math.max;function e(r,i,s,o){for(var a=-1,u=t(n((i-r)/(s||1)),0),c=Array(u);u--;)c[o?u:++a]=r,r+=s;return c}return qu=e,qu}var Ou,wv;function yx(){if(wv)return Ou;wv=1;var n=mx(),t=Dr(),e=$p();function r(i){return function(s,o,a){return a&&typeof a!="number"&&t(s,o,a)&&(o=a=void 0),s=e(s),o===void 0?(o=s,s=0):o=e(o),a=a===void 0?s<o?1:-1:e(a),n(s,o,a,i)}}return Ou=r,Ou}var Au,bv;function wx(){if(bv)return Au;bv=1;var n=yx(),t=n();return Au=t,Au}var Iu,_v;function bx(){if(_v)return Iu;_v=1;function n(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}return Iu=n,Iu}var Tu,Ev;function _x(){if(Ev)return Tu;Ev=1;var n=Mt();function t(e,r){if(e!==r){var i=e!==void 0,s=e===null,o=e===e,a=n(e),u=r!==void 0,c=r===null,f=r===r,l=n(r);if(!c&&!l&&!a&&e>r||a&&u&&f&&!c&&!l||s&&u&&f||!i&&f||!o)return 1;if(!s&&!a&&!l&&e<r||l&&i&&o&&!s&&!a||c&&i&&o||!u&&o||!f)return-1}return 0}return Tu=t,Tu}var ku,xv;function Ex(){if(xv)return ku;xv=1;var n=_x();function t(e,r,i){for(var s=-1,o=e.criteria,a=r.criteria,u=o.length,c=i.length;++s<u;){var f=n(o[s],a[s]);if(f){if(s>=c)return f;var l=i[s];return f*(l=="desc"?-1:1)}}return e.index-r.index}return ku=t,ku}var ju,Nv;function xx(){if(Nv)return ju;Nv=1;var n=kr(),t=Cr(),e=De(),r=_g(),i=bx(),s=Or(),o=Ex(),a=ct(),u=oe();function c(f,l,h){l.length?l=n(l,function(v){return u(v)?function(m){return t(m,v.length===1?v[0]:v)}:v}):l=[a];var g=-1;l=n(l,s(e));var p=r(f,function(v,m,d){var y=n(l,function(w){return w(v)});return{criteria:y,index:++g,value:v}});return i(p,function(v,m){return o(v,m,h)})}return ju=c,ju}var Cu,Mv;function Nx(){if(Mv)return Cu;Mv=1;var n=sa(),t=xx(),e=Pr(),r=Dr(),i=e(function(s,o){if(s==null)return[];var a=o.length;return a>1&&r(s,o[0],o[1])?o=[]:a>2&&r(o[0],o[1],o[2])&&(o=[o[0]]),t(s,n(o,1),[])});return Cu=i,Cu}var Pu,Sv;function Mx(){if(Sv)return Pu;Sv=1;var n=Zd(),t=0;function e(r){var i=++t;return n(r)+i}return Pu=e,Pu}var Lu,Rv;function Sx(){if(Rv)return Lu;Rv=1;function n(t,e,r){for(var i=-1,s=t.length,o=e.length,a={};++i<s;){var u=i<o?e[i]:void 0;r(a,t[i],u)}return a}return Lu=n,Lu}var Du,qv;function Rx(){if(qv)return Du;qv=1;var n=Rr(),t=Sx();function e(r,i){return t(r||[],i||[],n)}return Du=e,Du}var zr;if(typeof kn=="function")try{zr={cloneDeep:UE(),constant:Fs(),defaults:GE(),each:md(),filter:dg(),find:JE(),flatten:Vp(),forEach:pd(),forIn:QE(),has:vg(),isUndefined:wg(),last:HE(),map:xg(),mapValues:ex(),max:rx(),merge:ux(),min:cx(),minBy:fx(),now:lx(),pick:vx(),range:wx(),reduce:Rg(),sortBy:Nx(),uniqueId:Mx(),values:op(),zipObject:Rx()}}catch{}zr||(zr=window._);var re=zr,qx=$r;function $r(){var n={};n._next=n._prev=n,this._sentinel=n}$r.prototype.dequeue=function(){var n=this._sentinel,t=n._prev;if(t!==n)return Ov(t),t},$r.prototype.enqueue=function(n){var t=this._sentinel;n._prev&&n._next&&Ov(n),n._next=t._next,t._next._prev=n,t._next=n,n._prev=t},$r.prototype.toString=function(){for(var n=[],t=this._sentinel,e=t._prev;e!==t;)n.push(JSON.stringify(e,Ox)),e=e._prev;return"["+n.join(", ")+"]"};function Ov(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function Ox(n,t){if(n!=="_next"&&n!=="_prev")return t}var ze=re,Ax=Ae.Graph,Ix=qx,Tx=jx,kx=ze.constant(1);function jx(n,t){if(n.nodeCount()<=1)return[];var e=Px(n,t||kx),r=Cx(e.graph,e.buckets,e.zeroIdx);return ze.flatten(ze.map(r,function(i){return n.outEdges(i.v,i.w)}),!0)}function Cx(n,t,e){for(var r=[],i=t[t.length-1],s=t[0],o;n.nodeCount();){for(;o=s.dequeue();)zu(n,t,e,o);for(;o=i.dequeue();)zu(n,t,e,o);if(n.nodeCount()){for(var a=t.length-2;a>0;--a)if(o=t[a].dequeue(),o){r=r.concat(zu(n,t,e,o,!0));break}}}return r}function zu(n,t,e,r,i){var s=i?[]:void 0;return ze.forEach(n.inEdges(r.v),function(o){var a=n.edge(o),u=n.node(o.v);i&&s.push({v:o.v,w:o.w}),u.out-=a,$u(t,e,u)}),ze.forEach(n.outEdges(r.v),function(o){var a=n.edge(o),u=o.w,c=n.node(u);c.in-=a,$u(t,e,c)}),n.removeNode(r.v),s}function Px(n,t){var e=new Ax,r=0,i=0;ze.forEach(n.nodes(),function(a){e.setNode(a,{v:a,in:0,out:0})}),ze.forEach(n.edges(),function(a){var u=e.edge(a.v,a.w)||0,c=t(a),f=u+c;e.setEdge(a.v,a.w,f),i=Math.max(i,e.node(a.v).out+=c),r=Math.max(r,e.node(a.w).in+=c)});var s=ze.range(i+r+3).map(function(){return new Ix}),o=r+1;return ze.forEach(e.nodes(),function(a){$u(s,o,e.node(a))}),{graph:e,buckets:s,zeroIdx:o}}function $u(n,t,e){e.out?e.in?n[e.out-e.in+t].enqueue(e):n[n.length-1].enqueue(e):n[0].enqueue(e)}var ft=re,Lx=Tx,Dx={run:zx,undo:Fx};function zx(n){var t=n.graph().acyclicer==="greedy"?Lx(n,e(n)):$x(n);ft.forEach(t,function(r){var i=n.edge(r);n.removeEdge(r),i.forwardName=r.name,i.reversed=!0,n.setEdge(r.w,r.v,i,ft.uniqueId("rev"))});function e(r){return function(i){return r.edge(i).weight}}}function $x(n){var t=[],e={},r={};function i(s){ft.has(r,s)||(r[s]=!0,e[s]=!0,ft.forEach(n.outEdges(s),function(o){ft.has(e,o.w)?t.push(o):i(o.w)}),delete e[s])}return ft.forEach(n.nodes(),i),t}function Fx(n){ft.forEach(n.edges(),function(t){var e=n.edge(t);if(e.reversed){n.removeEdge(t);var r=e.forwardName;delete e.reversed,delete e.forwardName,n.setEdge(t.w,t.v,e,r)}})}var J=re,Av=Ae.Graph,me={addDummyNode:Iv,simplify:Bx,asNonCompoundGraph:Ux,successorWeights:Gx,predecessorWeights:Vx,intersectRect:Wx,buildLayerMatrix:Yx,normalizeRanks:Kx,removeEmptyRanks:Xx,addBorderNode:Zx,maxRank:Tv,partition:Jx,time:Qx,notime:Hx};function Iv(n,t,e,r){var i;do i=J.uniqueId(r);while(n.hasNode(i));return e.dummy=t,n.setNode(i,e),i}function Bx(n){var t=new Av().setGraph(n.graph());return J.forEach(n.nodes(),function(e){t.setNode(e,n.node(e))}),J.forEach(n.edges(),function(e){var r=t.edge(e.v,e.w)||{weight:0,minlen:1},i=n.edge(e);t.setEdge(e.v,e.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function Ux(n){var t=new Av({multigraph:n.isMultigraph()}).setGraph(n.graph());return J.forEach(n.nodes(),function(e){n.children(e).length||t.setNode(e,n.node(e))}),J.forEach(n.edges(),function(e){t.setEdge(e,n.edge(e))}),t}function Gx(n){var t=J.map(n.nodes(),function(e){var r={};return J.forEach(n.outEdges(e),function(i){r[i.w]=(r[i.w]||0)+n.edge(i).weight}),r});return J.zipObject(n.nodes(),t)}function Vx(n){var t=J.map(n.nodes(),function(e){var r={};return J.forEach(n.inEdges(e),function(i){r[i.v]=(r[i.v]||0)+n.edge(i).weight}),r});return J.zipObject(n.nodes(),t)}function Wx(n,t){var e=n.x,r=n.y,i=t.x-e,s=t.y-r,o=n.width/2,a=n.height/2;if(!i&&!s)throw new Error("Not possible to find intersection inside of the rectangle");var u,c;return Math.abs(s)*o>Math.abs(i)*a?(s<0&&(a=-a),u=a*i/s,c=a):(i<0&&(o=-o),u=o,c=o*s/i),{x:e+u,y:r+c}}function Yx(n){var t=J.map(J.range(Tv(n)+1),function(){return[]});return J.forEach(n.nodes(),function(e){var r=n.node(e),i=r.rank;J.isUndefined(i)||(t[i][r.order]=e)}),t}function Kx(n){var t=J.min(J.map(n.nodes(),function(e){return n.node(e).rank}));J.forEach(n.nodes(),function(e){var r=n.node(e);J.has(r,"rank")&&(r.rank-=t)})}function Xx(n){var t=J.min(J.map(n.nodes(),function(s){return n.node(s).rank})),e=[];J.forEach(n.nodes(),function(s){var o=n.node(s).rank-t;e[o]||(e[o]=[]),e[o].push(s)});var r=0,i=n.graph().nodeRankFactor;J.forEach(e,function(s,o){J.isUndefined(s)&&o%i!==0?--r:r&&J.forEach(s,function(a){n.node(a).rank+=r})})}function Zx(n,t,e,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=e,i.order=r),Iv(n,"border",i,t)}function Tv(n){return J.max(J.map(n.nodes(),function(t){var e=n.node(t).rank;if(!J.isUndefined(e))return e}))}function Jx(n,t){var e={lhs:[],rhs:[]};return J.forEach(n,function(r){t(r)?e.lhs.push(r):e.rhs.push(r)}),e}function Qx(n,t){var e=J.now();try{return t()}finally{console.log(n+" time: "+(J.now()-e)+"ms")}}function Hx(n,t){return t()}var kv=re,eN=me,tN={run:rN,undo:iN};function rN(n){n.graph().dummyChains=[],kv.forEach(n.edges(),function(t){nN(n,t)})}function nN(n,t){var e=t.v,r=n.node(e).rank,i=t.w,s=n.node(i).rank,o=t.name,a=n.edge(t),u=a.labelRank;if(s!==r+1){n.removeEdge(t);var c,f,l;for(l=0,++r;r<s;++l,++r)a.points=[],f={width:0,height:0,edgeLabel:a,edgeObj:t,rank:r},c=eN.addDummyNode(n,"edge",f,"_d"),r===u&&(f.width=a.width,f.height=a.height,f.dummy="edge-label",f.labelpos=a.labelpos),n.setEdge(e,c,{weight:a.weight},o),l===0&&n.graph().dummyChains.push(c),e=c;n.setEdge(e,i,{weight:a.weight},o)}}function iN(n){kv.forEach(n.graph().dummyChains,function(t){var e=n.node(t),r=e.edgeLabel,i;for(n.setEdge(e.edgeObj,r);e.dummy;)i=n.successors(t)[0],n.removeNode(t),r.points.push({x:e.x,y:e.y}),e.dummy==="edge-label"&&(r.x=e.x,r.y=e.y,r.width=e.width,r.height=e.height),t=i,e=n.node(t)})}var Fr=re,Br={longestPath:sN,slack:oN};function sN(n){var t={};function e(r){var i=n.node(r);if(Fr.has(t,r))return i.rank;t[r]=!0;var s=Fr.min(Fr.map(n.outEdges(r),function(o){return e(o.w)-n.edge(o).minlen}));return(s===Number.POSITIVE_INFINITY||s===void 0||s===null)&&(s=0),i.rank=s}Fr.forEach(n.sources(),e)}function oN(n,t){return n.node(t.w).rank-n.node(t.v).rank-n.edge(t).minlen}var Ur=re,aN=Ae.Graph,Gr=Br.slack,jv=uN;function uN(n){var t=new aN({directed:!1}),e=n.nodes()[0],r=n.nodeCount();t.setNode(e,{});for(var i,s;cN(t,n)<r;)i=fN(t,n),s=t.hasNode(i.v)?Gr(n,i):-Gr(n,i),lN(t,n,s);return t}function cN(n,t){function e(r){Ur.forEach(t.nodeEdges(r),function(i){var s=i.v,o=r===s?i.w:s;!n.hasNode(o)&&!Gr(t,i)&&(n.setNode(o,{}),n.setEdge(r,o,{}),e(o))})}return Ur.forEach(n.nodes(),e),n.nodeCount()}function fN(n,t){return Ur.minBy(t.edges(),function(e){if(n.hasNode(e.v)!==n.hasNode(e.w))return Gr(t,e)})}function lN(n,t,e){Ur.forEach(n.nodes(),function(r){t.node(r).rank+=e})}var $e=re,hN=jv,dN=Br.slack,gN=Br.longestPath,pN=Ae.alg.preorder,vN=Ae.alg.postorder,mN=me.simplify,yN=lt;lt.initLowLimValues=Bu,lt.initCutValues=Fu,lt.calcCutValue=Cv,lt.leaveEdge=Lv,lt.enterEdge=Dv,lt.exchangeEdges=zv;function lt(n){n=mN(n),gN(n);var t=hN(n);Bu(t),Fu(t,n);for(var e,r;e=Lv(t);)r=Dv(t,n,e),zv(t,n,e,r)}function Fu(n,t){var e=vN(n,n.nodes());e=e.slice(0,e.length-1),$e.forEach(e,function(r){wN(n,t,r)})}function wN(n,t,e){var r=n.node(e),i=r.parent;n.edge(e,i).cutvalue=Cv(n,t,e)}function Cv(n,t,e){var r=n.node(e),i=r.parent,s=!0,o=t.edge(e,i),a=0;return o||(s=!1,o=t.edge(i,e)),a=o.weight,$e.forEach(t.nodeEdges(e),function(u){var c=u.v===e,f=c?u.w:u.v;if(f!==i){var l=c===s,h=t.edge(u).weight;if(a+=l?h:-h,_N(n,e,f)){var g=n.edge(e,f).cutvalue;a+=l?-g:g}}}),a}function Bu(n,t){arguments.length<2&&(t=n.nodes()[0]),Pv(n,{},1,t)}function Pv(n,t,e,r,i){var s=e,o=n.node(r);return t[r]=!0,$e.forEach(n.neighbors(r),function(a){$e.has(t,a)||(e=Pv(n,t,e,a,r))}),o.low=s,o.lim=e++,i?o.parent=i:delete o.parent,e}function Lv(n){return $e.find(n.edges(),function(t){return n.edge(t).cutvalue<0})}function Dv(n,t,e){var r=e.v,i=e.w;t.hasEdge(r,i)||(r=e.w,i=e.v);var s=n.node(r),o=n.node(i),a=s,u=!1;s.lim>o.lim&&(a=o,u=!0);var c=$e.filter(t.edges(),function(f){return u===$v(n,n.node(f.v),a)&&u!==$v(n,n.node(f.w),a)});return $e.minBy(c,function(f){return dN(t,f)})}function zv(n,t,e,r){var i=e.v,s=e.w;n.removeEdge(i,s),n.setEdge(r.v,r.w,{}),Bu(n),Fu(n,t),bN(n,t)}function bN(n,t){var e=$e.find(n.nodes(),function(i){return!t.node(i).parent}),r=pN(n,e);r=r.slice(1),$e.forEach(r,function(i){var s=n.node(i).parent,o=t.edge(i,s),a=!1;o||(o=t.edge(s,i),a=!0),t.node(i).rank=t.node(s).rank+(a?o.minlen:-o.minlen)})}function _N(n,t,e){return n.hasEdge(t,e)}function $v(n,t,e){return e.low<=t.lim&&t.lim<=e.lim}var EN=Br,Fv=EN.longestPath,xN=jv,NN=yN,MN=SN;function SN(n){switch(n.graph().ranker){case"network-simplex":Bv(n);break;case"tight-tree":qN(n);break;case"longest-path":RN(n);break;default:Bv(n)}}var RN=Fv;function qN(n){Fv(n),xN(n)}function Bv(n){NN(n)}var Uu=re,ON=AN;function AN(n){var t=TN(n);Uu.forEach(n.graph().dummyChains,function(e){for(var r=n.node(e),i=r.edgeObj,s=IN(n,t,i.v,i.w),o=s.path,a=s.lca,u=0,c=o[u],f=!0;e!==i.w;){if(r=n.node(e),f){for(;(c=o[u])!==a&&n.node(c).maxRank<r.rank;)u++;c===a&&(f=!1)}if(!f){for(;u<o.length-1&&n.node(c=o[u+1]).minRank<=r.rank;)u++;c=o[u]}n.setParent(e,c),e=n.successors(e)[0]}})}function IN(n,t,e,r){var i=[],s=[],o=Math.min(t[e].low,t[r].low),a=Math.max(t[e].lim,t[r].lim),u,c;u=e;do u=n.parent(u),i.push(u);while(u&&(t[u].low>o||a>t[u].lim));for(c=u,u=r;(u=n.parent(u))!==c;)s.push(u);return{path:i.concat(s.reverse()),lca:c}}function TN(n){var t={},e=0;function r(i){var s=e;Uu.forEach(n.children(i),r),t[i]={low:s,lim:e++}}return Uu.forEach(n.children(),r),t}var Fe=re,Gu=me,kN={run:jN,cleanup:LN};function jN(n){var t=Gu.addDummyNode(n,"root",{},"_root"),e=CN(n),r=Fe.max(Fe.values(e))-1,i=2*r+1;n.graph().nestingRoot=t,Fe.forEach(n.edges(),function(o){n.edge(o).minlen*=i});var s=PN(n)+1;Fe.forEach(n.children(),function(o){Uv(n,t,i,s,r,e,o)}),n.graph().nodeRankFactor=i}function Uv(n,t,e,r,i,s,o){var a=n.children(o);if(!a.length){o!==t&&n.setEdge(t,o,{weight:0,minlen:e});return}var u=Gu.addBorderNode(n,"_bt"),c=Gu.addBorderNode(n,"_bb"),f=n.node(o);n.setParent(u,o),f.borderTop=u,n.setParent(c,o),f.borderBottom=c,Fe.forEach(a,function(l){Uv(n,t,e,r,i,s,l);var h=n.node(l),g=h.borderTop?h.borderTop:l,p=h.borderBottom?h.borderBottom:l,v=h.borderTop?r:2*r,m=g!==p?1:i-s[o]+1;n.setEdge(u,g,{weight:v,minlen:m,nestingEdge:!0}),n.setEdge(p,c,{weight:v,minlen:m,nestingEdge:!0})}),n.parent(o)||n.setEdge(t,u,{weight:0,minlen:i+s[o]})}function CN(n){var t={};function e(r,i){var s=n.children(r);s&&s.length&&Fe.forEach(s,function(o){e(o,i+1)}),t[r]=i}return Fe.forEach(n.children(),function(r){e(r,1)}),t}function PN(n){return Fe.reduce(n.edges(),function(t,e){return t+n.edge(e).weight},0)}function LN(n){var t=n.graph();n.removeNode(t.nestingRoot),delete t.nestingRoot,Fe.forEach(n.edges(),function(e){var r=n.edge(e);r.nestingEdge&&n.removeEdge(e)})}var Vu=re,DN=me,zN=$N;function $N(n){function t(e){var r=n.children(e),i=n.node(e);if(r.length&&Vu.forEach(r,t),Vu.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var s=i.minRank,o=i.maxRank+1;s<o;++s)Gv(n,"borderLeft","_bl",e,i,s),Gv(n,"borderRight","_br",e,i,s)}}Vu.forEach(n.children(),t)}function Gv(n,t,e,r,i,s){var o={width:0,height:0,rank:s,borderType:t},a=i[t][s-1],u=DN.addDummyNode(n,"border",o,e);i[t][s]=u,n.setParent(u,r),a&&n.setEdge(a,u,{weight:1})}var ke=re,FN={adjust:BN,undo:UN};function BN(n){var t=n.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&Vv(n)}function UN(n){var t=n.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&GN(n),(t==="lr"||t==="rl")&&(VN(n),Vv(n))}function Vv(n){ke.forEach(n.nodes(),function(t){Wv(n.node(t))}),ke.forEach(n.edges(),function(t){Wv(n.edge(t))})}function Wv(n){var t=n.width;n.width=n.height,n.height=t}function GN(n){ke.forEach(n.nodes(),function(t){Wu(n.node(t))}),ke.forEach(n.edges(),function(t){var e=n.edge(t);ke.forEach(e.points,Wu),ke.has(e,"y")&&Wu(e)})}function Wu(n){n.y=-n.y}function VN(n){ke.forEach(n.nodes(),function(t){Yu(n.node(t))}),ke.forEach(n.edges(),function(t){var e=n.edge(t);ke.forEach(e.points,Yu),ke.has(e,"x")&&Yu(e)})}function Yu(n){var t=n.x;n.x=n.y,n.y=t}var Be=re,WN=YN;function YN(n){var t={},e=Be.filter(n.nodes(),function(a){return!n.children(a).length}),r=Be.max(Be.map(e,function(a){return n.node(a).rank})),i=Be.map(Be.range(r+1),function(){return[]});function s(a){if(!Be.has(t,a)){t[a]=!0;var u=n.node(a);i[u.rank].push(a),Be.forEach(n.successors(a),s)}}var o=Be.sortBy(e,function(a){return n.node(a).rank});return Be.forEach(o,s),i}var Ze=re,KN=XN;function XN(n,t){for(var e=0,r=1;r<t.length;++r)e+=ZN(n,t[r-1],t[r]);return e}function ZN(n,t,e){for(var r=Ze.zipObject(e,Ze.map(e,function(c,f){return f})),i=Ze.flatten(Ze.map(t,function(c){return Ze.sortBy(Ze.map(n.outEdges(c),function(f){return{pos:r[f.w],weight:n.edge(f).weight}}),"pos")}),!0),s=1;s<e.length;)s<<=1;var o=2*s-1;s-=1;var a=Ze.map(new Array(o),function(){return 0}),u=0;return Ze.forEach(i.forEach(function(c){var f=c.pos+s;a[f]+=c.weight;for(var l=0;f>0;)f%2&&(l+=a[f+1]),f=f-1>>1,a[f]+=c.weight;u+=c.weight*l})),u}var Yv=re,JN=QN;function QN(n,t){return Yv.map(t,function(e){var r=n.inEdges(e);if(r.length){var i=Yv.reduce(r,function(s,o){var a=n.edge(o),u=n.node(o.v);return{sum:s.sum+a.weight*u.order,weight:s.weight+a.weight}},{sum:0,weight:0});return{v:e,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:e}})}var _e=re,HN=eM;function eM(n,t){var e={};_e.forEach(n,function(i,s){var o=e[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:s};_e.isUndefined(i.barycenter)||(o.barycenter=i.barycenter,o.weight=i.weight)}),_e.forEach(t.edges(),function(i){var s=e[i.v],o=e[i.w];!_e.isUndefined(s)&&!_e.isUndefined(o)&&(o.indegree++,s.out.push(e[i.w]))});var r=_e.filter(e,function(i){return!i.indegree});return tM(r)}function tM(n){var t=[];function e(s){return function(o){o.merged||(_e.isUndefined(o.barycenter)||_e.isUndefined(s.barycenter)||o.barycenter>=s.barycenter)&&rM(s,o)}}function r(s){return function(o){o.in.push(s),--o.indegree===0&&n.push(o)}}for(;n.length;){var i=n.pop();t.push(i),_e.forEach(i.in.reverse(),e(i)),_e.forEach(i.out,r(i))}return _e.map(_e.filter(t,function(s){return!s.merged}),function(s){return _e.pick(s,["vs","i","barycenter","weight"])})}function rM(n,t){var e=0,r=0;n.weight&&(e+=n.barycenter*n.weight,r+=n.weight),t.weight&&(e+=t.barycenter*t.weight,r+=t.weight),n.vs=t.vs.concat(n.vs),n.barycenter=e/r,n.weight=r,n.i=Math.min(t.i,n.i),t.merged=!0}var Kt=re,nM=me,iM=sM;function sM(n,t){var e=nM.partition(n,function(f){return Kt.has(f,"barycenter")}),r=e.lhs,i=Kt.sortBy(e.rhs,function(f){return-f.i}),s=[],o=0,a=0,u=0;r.sort(oM(!!t)),u=Kv(s,i,u),Kt.forEach(r,function(f){u+=f.vs.length,s.push(f.vs),o+=f.barycenter*f.weight,a+=f.weight,u=Kv(s,i,u)});var c={vs:Kt.flatten(s,!0)};return a&&(c.barycenter=o/a,c.weight=a),c}function Kv(n,t,e){for(var r;t.length&&(r=Kt.last(t)).i<=e;)t.pop(),n.push(r.vs),e++;return e}function oM(n){return function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:n?e.i-t.i:t.i-e.i}}var Je=re,aM=JN,uM=HN,cM=iM,fM=Xv;function Xv(n,t,e,r){var i=n.children(t),s=n.node(t),o=s?s.borderLeft:void 0,a=s?s.borderRight:void 0,u={};o&&(i=Je.filter(i,function(p){return p!==o&&p!==a}));var c=aM(n,i);Je.forEach(c,function(p){if(n.children(p.v).length){var v=Xv(n,p.v,e,r);u[p.v]=v,Je.has(v,"barycenter")&&hM(p,v)}});var f=uM(c,e);lM(f,u);var l=cM(f,r);if(o&&(l.vs=Je.flatten([o,l.vs,a],!0),n.predecessors(o).length)){var h=n.node(n.predecessors(o)[0]),g=n.node(n.predecessors(a)[0]);Je.has(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+g.order)/(l.weight+2),l.weight+=2}return l}function lM(n,t){Je.forEach(n,function(e){e.vs=Je.flatten(e.vs.map(function(r){return t[r]?t[r].vs:r}),!0)})}function hM(n,t){Je.isUndefined(n.barycenter)?(n.barycenter=t.barycenter,n.weight=t.weight):(n.barycenter=(n.barycenter*n.weight+t.barycenter*t.weight)/(n.weight+t.weight),n.weight+=t.weight)}var Xt=re,dM=Ae.Graph,gM=pM;function pM(n,t,e){var r=vM(n),i=new dM({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(s){return n.node(s)});return Xt.forEach(n.nodes(),function(s){var o=n.node(s),a=n.parent(s);(o.rank===t||o.minRank<=t&&t<=o.maxRank)&&(i.setNode(s),i.setParent(s,a||r),Xt.forEach(n[e](s),function(u){var c=u.v===s?u.w:u.v,f=i.edge(c,s),l=Xt.isUndefined(f)?0:f.weight;i.setEdge(c,s,{weight:n.edge(u).weight+l})}),Xt.has(o,"minRank")&&i.setNode(s,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function vM(n){for(var t;n.hasNode(t=Xt.uniqueId("_root")););return t}var mM=re,yM=wM;function wM(n,t,e){var r={},i;mM.forEach(e,function(s){for(var o=n.parent(s),a,u;o;){if(a=n.parent(o),a?(u=r[a],r[a]=o):(u=i,i=o),u&&u!==o){t.setEdge(u,o);return}o=a}})}var Qe=re,bM=WN,_M=KN,EM=fM,xM=gM,NM=yM,MM=Ae.Graph,Zv=me,SM=RM;function RM(n){var t=Zv.maxRank(n),e=Jv(n,Qe.range(1,t+1),"inEdges"),r=Jv(n,Qe.range(t-1,-1,-1),"outEdges"),i=bM(n);Qv(n,i);for(var s=Number.POSITIVE_INFINITY,o,a=0,u=0;u<4;++a,++u){qM(a%2?e:r,a%4>=2),i=Zv.buildLayerMatrix(n);var c=_M(n,i);c<s&&(u=0,o=Qe.cloneDeep(i),s=c)}Qv(n,o)}function Jv(n,t,e){return Qe.map(t,function(r){return xM(n,r,e)})}function qM(n,t){var e=new MM;Qe.forEach(n,function(r){var i=r.graph().root,s=EM(r,i,e,t);Qe.forEach(s.vs,function(o,a){r.node(o).order=a}),NM(r,e,s.vs)})}function Qv(n,t){Qe.forEach(t,function(e){Qe.forEach(e,function(r,i){n.node(r).order=i})})}var W=re,OM=Ae.Graph,AM=me,IM={positionX:jM,findType1Conflicts:Hv,findType2Conflicts:e0,addConflict:Ku,hasConflict:t0,verticalAlignment:r0,horizontalCompaction:n0,alignCoordinates:s0,findSmallestWidthAlignment:i0,balance:o0};function Hv(n,t){var e={};function r(i,s){var o=0,a=0,u=i.length,c=W.last(s);return W.forEach(s,function(f,l){var h=TM(n,f),g=h?n.node(h).order:u;(h||f===c)&&(W.forEach(s.slice(a,l+1),function(p){W.forEach(n.predecessors(p),function(v){var m=n.node(v),d=m.order;(d<o||g<d)&&!(m.dummy&&n.node(p).dummy)&&Ku(e,v,p)})}),a=l+1,o=g)}),s}return W.reduce(t,r),e}function e0(n,t){var e={};function r(s,o,a,u,c){var f;W.forEach(W.range(o,a),function(l){f=s[l],n.node(f).dummy&&W.forEach(n.predecessors(f),function(h){var g=n.node(h);g.dummy&&(g.order<u||g.order>c)&&Ku(e,h,f)})})}function i(s,o){var a=-1,u,c=0;return W.forEach(o,function(f,l){if(n.node(f).dummy==="border"){var h=n.predecessors(f);h.length&&(u=n.node(h[0]).order,r(o,c,l,a,u),c=l,a=u)}r(o,c,o.length,u,s.length)}),o}return W.reduce(t,i),e}function TM(n,t){if(n.node(t).dummy)return W.find(n.predecessors(t),function(e){return n.node(e).dummy})}function Ku(n,t,e){if(t>e){var r=t;t=e,e=r}var i=n[t];i||(n[t]=i={}),i[e]=!0}function t0(n,t,e){if(t>e){var r=t;t=e,e=r}return W.has(n[t],e)}function r0(n,t,e,r){var i={},s={},o={};return W.forEach(t,function(a){W.forEach(a,function(u,c){i[u]=u,s[u]=u,o[u]=c})}),W.forEach(t,function(a){var u=-1;W.forEach(a,function(c){var f=r(c);if(f.length){f=W.sortBy(f,function(v){return o[v]});for(var l=(f.length-1)/2,h=Math.floor(l),g=Math.ceil(l);h<=g;++h){var p=f[h];s[c]===c&&u<o[p]&&!t0(e,c,p)&&(s[p]=c,s[c]=i[c]=i[p],u=o[p])}}})}),{root:i,align:s}}function n0(n,t,e,r,i){var s={},o=kM(n,t,e,i),a=i?"borderLeft":"borderRight";function u(l,h){for(var g=o.nodes(),p=g.pop(),v={};p;)v[p]?l(p):(v[p]=!0,g.push(p),g=g.concat(h(p))),p=g.pop()}function c(l){s[l]=o.inEdges(l).reduce(function(h,g){return Math.max(h,s[g.v]+o.edge(g))},0)}function f(l){var h=o.outEdges(l).reduce(function(p,v){return Math.min(p,s[v.w]-o.edge(v))},Number.POSITIVE_INFINITY),g=n.node(l);h!==Number.POSITIVE_INFINITY&&g.borderType!==a&&(s[l]=Math.max(s[l],h))}return u(c,o.predecessors.bind(o)),u(f,o.successors.bind(o)),W.forEach(r,function(l){s[l]=s[e[l]]}),s}function kM(n,t,e,r){var i=new OM,s=n.graph(),o=CM(s.nodesep,s.edgesep,r);return W.forEach(t,function(a){var u;W.forEach(a,function(c){var f=e[c];if(i.setNode(f),u){var l=e[u],h=i.edge(l,f);i.setEdge(l,f,Math.max(o(n,c,u),h||0))}u=c})}),i}function i0(n,t){return W.minBy(W.values(t),function(e){var r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return W.forIn(e,function(s,o){var a=PM(n,o)/2;r=Math.max(s+a,r),i=Math.min(s-a,i)}),r-i})}function s0(n,t){var e=W.values(t),r=W.min(e),i=W.max(e);W.forEach(["u","d"],function(s){W.forEach(["l","r"],function(o){var a=s+o,u=n[a],c;if(u!==t){var f=W.values(u);c=o==="l"?r-W.min(f):i-W.max(f),c&&(n[a]=W.mapValues(u,function(l){return l+c}))}})})}function o0(n,t){return W.mapValues(n.ul,function(e,r){if(t)return n[t.toLowerCase()][r];var i=W.sortBy(W.map(n,r));return(i[1]+i[2])/2})}function jM(n){var t=AM.buildLayerMatrix(n),e=W.merge(Hv(n,t),e0(n,t)),r={},i;W.forEach(["u","d"],function(o){i=o==="u"?t:W.values(t).reverse(),W.forEach(["l","r"],function(a){a==="r"&&(i=W.map(i,function(l){return W.values(l).reverse()}));var u=(o==="u"?n.predecessors:n.successors).bind(n),c=r0(n,i,e,u),f=n0(n,i,c.root,c.align,a==="r");a==="r"&&(f=W.mapValues(f,function(l){return-l})),r[o+a]=f})});var s=i0(n,r);return s0(r,s),o0(r,n.graph().align)}function CM(n,t,e){return function(r,i,s){var o=r.node(i),a=r.node(s),u=0,c;if(u+=o.width/2,W.has(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":c=-o.width/2;break;case"r":c=o.width/2;break}if(c&&(u+=e?c:-c),c=0,u+=(o.dummy?t:n)/2,u+=(a.dummy?t:n)/2,u+=a.width/2,W.has(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":c=a.width/2;break;case"r":c=-a.width/2;break}return c&&(u+=e?c:-c),c=0,u}}function PM(n,t){return n.node(t).width}var Zt=re,a0=me,LM=IM.positionX,DM=zM;function zM(n){n=a0.asNonCompoundGraph(n),$M(n),Zt.forEach(LM(n),function(t,e){n.node(e).x=t})}function $M(n){var t=a0.buildLayerMatrix(n),e=n.graph().ranksep,r=0;Zt.forEach(t,function(i){var s=Zt.max(Zt.map(i,function(o){return n.node(o).height}));Zt.forEach(i,function(o){n.node(o).y=r+s/2}),r+=s+e})}var K=re,u0=Dx,c0=tN,FM=MN,BM=me.normalizeRanks,UM=ON,GM=me.removeEmptyRanks,f0=kN,VM=zN,l0=FN,WM=SM,YM=DM,He=me,KM=Ae.Graph,XM=ZM;function ZM(n,t){var e=t&&t.debugTiming?He.time:He.notime;e("layout",function(){var r=e(" buildLayoutGraph",function(){return aS(n)});e(" runLayout",function(){JM(r,e)}),e(" updateInputGraph",function(){QM(n,r)})})}function JM(n,t){t(" makeSpaceForEdgeLabels",function(){uS(n)}),t(" removeSelfEdges",function(){mS(n)}),t(" acyclic",function(){u0.run(n)}),t(" nestingGraph.run",function(){f0.run(n)}),t(" rank",function(){FM(He.asNonCompoundGraph(n))}),t(" injectEdgeLabelProxies",function(){cS(n)}),t(" removeEmptyRanks",function(){GM(n)}),t(" nestingGraph.cleanup",function(){f0.cleanup(n)}),t(" normalizeRanks",function(){BM(n)}),t(" assignRankMinMax",function(){fS(n)}),t(" removeEdgeLabelProxies",function(){lS(n)}),t(" normalize.run",function(){c0.run(n)}),t(" parentDummyChains",function(){UM(n)}),t(" addBorderSegments",function(){VM(n)}),t(" order",function(){WM(n)}),t(" insertSelfEdges",function(){yS(n)}),t(" adjustCoordinateSystem",function(){l0.adjust(n)}),t(" position",function(){YM(n)}),t(" positionSelfEdges",function(){wS(n)}),t(" removeBorderNodes",function(){vS(n)}),t(" normalize.undo",function(){c0.undo(n)}),t(" fixupEdgeLabelCoords",function(){gS(n)}),t(" undoCoordinateSystem",function(){l0.undo(n)}),t(" translateGraph",function(){hS(n)}),t(" assignNodeIntersects",function(){dS(n)}),t(" reversePoints",function(){pS(n)}),t(" acyclic.undo",function(){u0.undo(n)})}function QM(n,t){K.forEach(n.nodes(),function(e){var r=n.node(e),i=t.node(e);r&&(r.x=i.x,r.y=i.y,t.children(e).length&&(r.width=i.width,r.height=i.height))}),K.forEach(n.edges(),function(e){var r=n.edge(e),i=t.edge(e);r.points=i.points,K.has(i,"x")&&(r.x=i.x,r.y=i.y)}),n.graph().width=t.graph().width,n.graph().height=t.graph().height}var HM=["nodesep","edgesep","ranksep","marginx","marginy"],eS={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},tS=["acyclicer","ranker","rankdir","align"],rS=["width","height"],nS={width:0,height:0},iS=["minlen","weight","width","height","labeloffset"],sS={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},oS=["labelpos"];function aS(n){var t=new KM({multigraph:!0,compound:!0}),e=Zu(n.graph());return t.setGraph(K.merge({},eS,Xu(e,HM),K.pick(e,tS))),K.forEach(n.nodes(),function(r){var i=Zu(n.node(r));t.setNode(r,K.defaults(Xu(i,rS),nS)),t.setParent(r,n.parent(r))}),K.forEach(n.edges(),function(r){var i=Zu(n.edge(r));t.setEdge(r,K.merge({},sS,Xu(i,iS),K.pick(i,oS)))}),t}function uS(n){var t=n.graph();t.ranksep/=2,K.forEach(n.edges(),function(e){var r=n.edge(e);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function cS(n){K.forEach(n.edges(),function(t){var e=n.edge(t);if(e.width&&e.height){var r=n.node(t.v),i=n.node(t.w),s={rank:(i.rank-r.rank)/2+r.rank,e:t};He.addDummyNode(n,"edge-proxy",s,"_ep")}})}function fS(n){var t=0;K.forEach(n.nodes(),function(e){var r=n.node(e);r.borderTop&&(r.minRank=n.node(r.borderTop).rank,r.maxRank=n.node(r.borderBottom).rank,t=K.max(t,r.maxRank))}),n.graph().maxRank=t}function lS(n){K.forEach(n.nodes(),function(t){var e=n.node(t);e.dummy==="edge-proxy"&&(n.edge(e.e).labelRank=e.rank,n.removeNode(t))})}function hS(n){var t=Number.POSITIVE_INFINITY,e=0,r=Number.POSITIVE_INFINITY,i=0,s=n.graph(),o=s.marginx||0,a=s.marginy||0;function u(c){var f=c.x,l=c.y,h=c.width,g=c.height;t=Math.min(t,f-h/2),e=Math.max(e,f+h/2),r=Math.min(r,l-g/2),i=Math.max(i,l+g/2)}K.forEach(n.nodes(),function(c){u(n.node(c))}),K.forEach(n.edges(),function(c){var f=n.edge(c);K.has(f,"x")&&u(f)}),t-=o,r-=a,K.forEach(n.nodes(),function(c){var f=n.node(c);f.x-=t,f.y-=r}),K.forEach(n.edges(),function(c){var f=n.edge(c);K.forEach(f.points,function(l){l.x-=t,l.y-=r}),K.has(f,"x")&&(f.x-=t),K.has(f,"y")&&(f.y-=r)}),s.width=e-t+o,s.height=i-r+a}function dS(n){K.forEach(n.edges(),function(t){var e=n.edge(t),r=n.node(t.v),i=n.node(t.w),s,o;e.points?(s=e.points[0],o=e.points[e.points.length-1]):(e.points=[],s=i,o=r),e.points.unshift(He.intersectRect(r,s)),e.points.push(He.intersectRect(i,o))})}function gS(n){K.forEach(n.edges(),function(t){var e=n.edge(t);if(K.has(e,"x"))switch((e.labelpos==="l"||e.labelpos==="r")&&(e.width-=e.labeloffset),e.labelpos){case"l":e.x-=e.width/2+e.labeloffset;break;case"r":e.x+=e.width/2+e.labeloffset;break}})}function pS(n){K.forEach(n.edges(),function(t){var e=n.edge(t);e.reversed&&e.points.reverse()})}function vS(n){K.forEach(n.nodes(),function(t){if(n.children(t).length){var e=n.node(t),r=n.node(e.borderTop),i=n.node(e.borderBottom),s=n.node(K.last(e.borderLeft)),o=n.node(K.last(e.borderRight));e.width=Math.abs(o.x-s.x),e.height=Math.abs(i.y-r.y),e.x=s.x+e.width/2,e.y=r.y+e.height/2}}),K.forEach(n.nodes(),function(t){n.node(t).dummy==="border"&&n.removeNode(t)})}function mS(n){K.forEach(n.edges(),function(t){if(t.v===t.w){var e=n.node(t.v);e.selfEdges||(e.selfEdges=[]),e.selfEdges.push({e:t,label:n.edge(t)}),n.removeEdge(t)}})}function yS(n){var t=He.buildLayerMatrix(n);K.forEach(t,function(e){var r=0;K.forEach(e,function(i,s){var o=n.node(i);o.order=s+r,K.forEach(o.selfEdges,function(a){He.addDummyNode(n,"selfedge",{width:a.label.width,height:a.label.height,rank:o.rank,order:s+ ++r,e:a.e,label:a.label},"_se")}),delete o.selfEdges})})}function wS(n){K.forEach(n.nodes(),function(t){var e=n.node(t);if(e.dummy==="selfedge"){var r=n.node(e.e.v),i=r.x+r.width/2,s=r.y,o=e.x-i,a=r.height/2;n.setEdge(e.e,e.label),n.removeNode(t),e.label.points=[{x:i+2*o/3,y:s-a},{x:i+5*o/6,y:s-a},{x:i+o,y:s},{x:i+5*o/6,y:s+a},{x:i+2*o/3,y:s+a}],e.label.x=e.x,e.label.y=e.y}})}function Xu(n,t){return K.mapValues(K.pick(n,t),Number)}function Zu(n){var t={};return K.forEach(n,function(e,r){t[r.toLowerCase()]=e}),t}var Vr=re,bS=me,_S=Ae.Graph,ES={debugOrdering:xS};function xS(n){var t=bS.buildLayerMatrix(n),e=new _S({compound:!0,multigraph:!0}).setGraph({});return Vr.forEach(n.nodes(),function(r){e.setNode(r,{label:r}),e.setParent(r,"layer"+n.node(r).rank)}),Vr.forEach(n.edges(),function(r){e.setEdge(r.v,r.w,{},r.name)}),Vr.forEach(t,function(r,i){var s="layer"+i;e.setNode(s,{rank:"same"}),Vr.reduce(r,function(o,a){return e.setEdge(o,a,{style:"invis"}),a})}),e}var NS="0.8.5",h0={graphlib:Ae,layout:XM,debug:ES,util:{time:me.time,notime:me.notime},version:NS},MS=Ow(h0);function SS(n){if(!n)return[0,0,0];if(U(n))return[n,n,n];if(n.length===0)return[0,0,0];const[t,e=t,r=t]=n;return[t,e,r]}class Wr{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,Wr.defaultOptions,t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),e))})}genericDagreLayout(t,e,r){return $(this,void 0,void 0,function*(){const{nodeSize:i}=r,s=new h0.graphlib.Graph;s.setGraph(r),s.setDefaultEdgeLabel(()=>({}));const o=e.getAllNodes(),a=e.getAllEdges();[...o,...a].some(({id:c})=>U(c))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach(c=>{const{id:f}=c,l=Object.assign({},c.data);if(i!==void 0){const[h,g]=SS(xe(i)?i(c):i);Object.assign(l,{width:h,height:g})}s.setNode(f.toString(),l)}),e.getAllEdges().forEach(({id:c,source:f,target:l})=>{s.setEdge(f.toString(),l.toString(),{id:c})}),MS.layout(s);const u={nodes:[],edges:[]};return s.nodes().forEach(c=>{const f=s.node(c);u.nodes.push({id:c,data:f}),t&&e.mergeNodeData(c,f)}),s.edges().forEach(c=>{const f=s.edge(c),{id:l}=f,h=ne(f,["id"]),{v:g,w:p}=c;u.edges.push({id:l,source:g,target:p,data:h}),t&&e.mergeEdgeData(l,h)}),u})}}Wr.defaultOptions={};class Ju{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,r=this.ry-t.ry;return Math.hypot(e,r)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,r=t.ry-this.ry;let i=Math.hypot(e,r);i=i<1e-4?1e-4:i;const s=this.g*(this.degree+1)*(t.degree+1)/i;this.fx+=s*e/i,this.fy+=s*r/i}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,r=(this.rx*this.mass+t.rx*t.mass)/e,i=(this.ry*this.mass+t.ry*t.mass)/e,s=this.degree+t.degree,o={rx:r,ry:i,mass:e,degree:s};return new Ju(o)}}class St{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const r=this.length/2;return t<=this.xmid+r&&t>=this.xmid-r&&e<=this.ymid+r&&e>=this.ymid-r}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,r=this.length/2,i={xmid:t,ymid:e,length:r};return new St(i)}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2,i={xmid:t,ymid:e,length:r};return new St(i)}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2,i={xmid:t,ymid:e,length:r};return new St(i)}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2,i={xmid:t,ymid:e,length:r};return new St(i)}}class Rt{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,t!=null&&(this.quad=t)}insert(t){if(this.body==null){this.body=t;return}this._isExternal()?(this.quad&&(this.NW=new Rt(this.quad.NW()),this.NE=new Rt(this.quad.NE()),this.SW=new Rt(this.quad.SW()),this.SE=new Rt(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t))}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null}updateForce(t){if(!(this.body==null||t===this.body))if(this._isExternal())t.addForce(this.body);else{const e=this.quad?this.quad.getLength():0,r=this.body.distanceTo(t);e/r<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t))}}}const RS={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};class qS{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},RS),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericForceAtlas2Layout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericForceAtlas2Layout(!0,t,e)})}genericForceAtlas2Layout(t,e,r){return $(this,void 0,void 0,function*(){const i=e.getAllEdges(),s=e.getAllNodes(),o=this.formatOptions(r,s.length),{width:a,height:u,prune:c,maxIteration:f,nodeSize:l,center:h}=o;if(!(s!=null&&s.length)||s.length===1)return nt(e,t,h);const g=s.map(d=>we(d,[a,u])),p=i.filter(d=>{const{source:y,target:w}=d;return y!==w}),v=new ue({nodes:g,edges:p}),m=this.getSizes(v,e,l);if(this.run(v,e,f,m,t,o),c){for(let y=0;y<p.length;y+=1){const{source:w,target:b}=p[y],x=v.getDegree(w),M=v.getDegree(w);if(x<=1){const N=v.getNode(b);v.mergeNodeData(w,{x:N.data.x,y:N.data.y})}else if(M<=1){const N=v.getNode(w);v.mergeNodeData(b,{x:N.data.x,y:N.data.y})}}const d=Object.assign(Object.assign({},o),{prune:!1,barnesHut:!1});this.run(v,e,100,m,t,d)}return{nodes:g,edges:i}})}getSizes(t,e,r){const i=t.getAllNodes(),s={};for(let o=0;o<i.length;o+=1){const{id:a,data:u}=i[o];if(s[a]=10,U(u.size))s[a]=u.size;else if(he(u.size))isNaN(u.size[0])||(s[a]=Math.max(u.size[0])),isNaN(u.size[1])||(s[a]=Math.max(u.size[1]));else if(Ge(u.size))s[a]=Math.max(u.size.width,u.size.height);else if(xe(r)){const c=e.getNode(a),f=r(c);he(f)?s[a]=Math.max(...f):s[a]=f}else he(r)?s[a]=Math.max(...r):U(r)&&(s[a]=r)}return s}formatOptions(t={},e){const r=Object.assign(Object.assign({},this.options),t),{center:i,width:s,height:o,barnesHut:a,prune:u,maxIteration:c,kr:f,kg:l}=r;return r.width=!s&&typeof window<"u"?window.innerWidth:s,r.height=!o&&typeof window<"u"?window.innerHeight:o,r.center=i||[r.width/2,r.height/2],a===void 0&&e>250&&(r.barnesHut=!0),u===void 0&&e>100&&(r.prune=!0),c===0&&!u?(r.maxIteration=250,e<=200&&e>100?r.maxIteration=1e3:e>200&&(r.maxIteration=1200)):c===0&&u&&(r.maxIteration=100,e<=200&&e>100?r.maxIteration=500:e>200&&(r.maxIteration=950)),f||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),l||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r}run(t,e,r,i,s,o){const{kr:a,barnesHut:u,onTick:c}=o,f=t.getAllNodes();let l=0,h=r;const g={},p={},v={};for(let m=0;m<f.length;m+=1){const{data:d,id:y}=f[m];if(g[y]=[0,0],u){const w={id:m,rx:d.x,ry:d.y,mass:1,g:a,degree:t.getDegree(y)};v[y]=new Ju(w)}}for(;h>0;)l=this.oneStep(t,{iter:h,preventOverlapIters:50,krPrime:100,sg:l,forces:g,preForces:p,bodies:v,sizes:i},o),h--,c==null||c({nodes:f,edges:e.getAllEdges()});return t}oneStep(t,e,r){const{iter:i,preventOverlapIters:s,krPrime:o,sg:a,preForces:u,bodies:c,sizes:f}=e;let{forces:l}=e;const{preventOverlap:h,barnesHut:g}=r,p=t.getAllNodes();for(let v=0;v<p.length;v+=1){const{id:m}=p[v];u[m]=[...l[m]],l[m]=[0,0]}return l=this.getAttrForces(t,i,s,f,l,r),g&&(h&&i>s||!h)?l=this.getOptRepGraForces(t,l,c,r):l=this.getRepGraForces(t,i,s,l,o,f,r),this.updatePos(t,l,u,a,r)}getAttrForces(t,e,r,i,s,o){const{preventOverlap:a,dissuadeHubs:u,mode:c,prune:f}=o,l=t.getAllEdges();for(let h=0;h<l.length;h+=1){const{source:g,target:p}=l[h],v=t.getNode(g),m=t.getNode(p),d=t.getDegree(g),y=t.getDegree(p);if(f&&(d<=1||y<=1))continue;const w=[m.data.x-v.data.x,m.data.y-v.data.y];let b=Math.hypot(w[0],w[1]);b=b<1e-4?1e-4:b,w[0]=w[0]/b,w[1]=w[1]/b,a&&e<r&&(b=b-i[g]-i[p]);let x=b,M=x;c==="linlog"&&(x=Math.log(1+b),M=x),u&&(x=b/d,M=b/y),a&&e<r&&b<=0?(x=0,M=0):a&&e<r&&b>0&&(x=b,M=b),s[g][0]+=x*w[0],s[p][0]-=M*w[0],s[g][1]+=x*w[1],s[p][1]-=M*w[1]}return s}getOptRepGraForces(t,e,r,i){const{kg:s,center:o,prune:a}=i,u=t.getAllNodes(),c=u.length;let f=9e10,l=-9e10,h=9e10,g=-9e10;for(let y=0;y<c;y+=1){const{id:w,data:b}=u[y];a&&t.getDegree(w)<=1||(r[w].setPos(b.x,b.y),b.x>=l&&(l=b.x),b.x<=f&&(f=b.x),b.y>=g&&(g=b.y),b.y<=h&&(h=b.y))}const p=Math.max(l-f,g-h),v={xmid:(l+f)/2,ymid:(g+h)/2,length:p,massCenter:o,mass:c},m=new St(v),d=new Rt(m);for(let y=0;y<c;y+=1){const{id:w}=u[y];a&&t.getDegree(w)<=1||r[w].in(m)&&d.insert(r[w])}for(let y=0;y<c;y+=1){const{id:w,data:b}=u[y],x=t.getDegree(w);if(a&&x<=1)continue;r[w].resetForce(),d.updateForce(r[w]),e[w][0]-=r[w].fx,e[w][1]-=r[w].fy;const M=[b.x-o[0],b.y-o[1]];let N=Math.hypot(M[0],M[1]);N=N<1e-4?1e-4:N,M[0]=M[0]/N,M[1]=M[1]/N;const E=s*(x+1);e[w][0]-=E*M[0],e[w][1]-=E*M[1]}return e}getRepGraForces(t,e,r,i,s,o,a){const{preventOverlap:u,kr:c,kg:f,center:l,prune:h}=a,g=t.getAllNodes(),p=g.length;for(let v=0;v<p;v+=1){const m=g[v],d=t.getDegree(m.id);for(let x=v+1;x<p;x+=1){const M=g[x],N=t.getDegree(M.id);if(h&&(d<=1||N<=1))continue;const E=[M.data.x-m.data.x,M.data.y-m.data.y];let O=Math.hypot(E[0],E[1]);O=O<1e-4?1e-4:O,E[0]=E[0]/O,E[1]=E[1]/O,u&&e<r&&(O=O-o[m.id]-o[M.id]);let _=c*(d+1)*(N+1)/O;u&&e<r&&O<0?_=s*(d+1)*(N+1):u&&e<r&&O===0?_=0:u&&e<r&&O>0&&(_=c*(d+1)*(N+1)/O),i[m.id][0]-=_*E[0],i[M.id][0]+=_*E[0],i[m.id][1]-=_*E[1],i[M.id][1]+=_*E[1]}const y=[m.data.x-l[0],m.data.y-l[1]],w=Math.hypot(y[0],y[1]);y[0]=y[0]/w,y[1]=y[1]/w;const b=f*(d+1);i[m.id][0]-=b*y[0],i[m.id][1]-=b*y[1]}return i}updatePos(t,e,r,i,s){const{ks:o,tao:a,prune:u,ksmax:c}=s,f=t.getAllNodes(),l=f.length,h=[],g=[];let p=0,v=0,m=i;for(let y=0;y<l;y+=1){const{id:w}=f[y],b=t.getDegree(w);if(u&&b<=1)continue;const x=[e[w][0]-r[w][0],e[w][1]-r[w][1]],M=Math.hypot(x[0],x[1]),N=[e[w][0]+r[w][0],e[w][1]+r[w][1]],E=Math.hypot(N[0],N[1]);h[y]=M,g[y]=E/2,p+=(b+1)*h[y],v+=(b+1)*g[y]}const d=m;m=a*v/p,d!==0&&(m=m>1.5*d?1.5*d:m);for(let y=0;y<l;y+=1){const{id:w,data:b}=f[y],x=t.getDegree(w);if(u&&x<=1||U(b.fx)&&U(b.fy))continue;let M=o*m/(1+m*Math.sqrt(h[y])),N=Math.hypot(e[w][0],e[w][1]);N=N<1e-4?1e-4:N;const E=c/N;M=M>E?E:M;const O=M*e[w][0],_=M*e[w][1];t.mergeNodeData(w,{x:b.x+O,y:b.y+_})}return m}}const OS={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},AS=800;class IS{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},OS),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericFruchtermanLayout(!0,t,e)})}stop(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let r=0;r<t;r++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach(r=>this.lastGraph.mergeNodeData(r.id,{x:r.data.x,y:r.data.y,z:this.options.dimensions===3?r.data.z:void 0})),e}genericFruchtermanLayout(t,e,r){return $(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(r),{dimensions:s,width:o,height:a,center:u,clustering:c,nodeClusterBy:f,maxIteration:l,onTick:h}=i,g=e.getAllNodes(),p=e.getAllEdges();if(!(g!=null&&g.length)){const w={nodes:[],edges:p};return this.lastResult=w,w}if(g.length===1){t&&e.mergeNodeData(g[0].id,{x:u[0],y:u[1],z:s===3?u[2]:void 0});const w={nodes:[Object.assign(Object.assign({},g[0]),{data:Object.assign(Object.assign({},g[0].data),{x:u[0],y:u[1],z:s===3?u[2]:void 0})})],edges:p};return this.lastResult=w,w}const v=g.map(w=>we(w,[o,a])),m=new ue({nodes:v,edges:p}),d={};if(c&&v.forEach(w=>{const b=w.data[f];d[b]||(d[b]={name:b,cx:0,cy:0,count:0})}),this.lastLayoutNodes=v,this.lastLayoutEdges=p,this.lastAssign=t,this.lastGraph=m,this.lastOptions=i,this.lastClusterMap=d,typeof window>"u")return;let y=0;return new Promise(w=>{this.timeInterval=window.setInterval(()=>{if(!this.running){w({nodes:v,edges:p});return}this.runOneStep(m,d,i),t&&v.forEach(({id:b,data:x})=>e.mergeNodeData(b,{x:x.x,y:x.y,z:s===3?x.z:void 0})),h==null||h({nodes:v,edges:p}),y++,y>=l&&(window.clearInterval(this.timeInterval),w({nodes:v,edges:p}))},0),this.running=!0})})}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:r,nodeClusterBy:i}=e,{center:s,width:o,height:a}=e;return e.width=!o&&typeof window<"u"?window.innerWidth:o,e.height=!a&&typeof window<"u"?window.innerHeight:a,e.center=s||[e.width/2,e.height/2],e.clustering=r&&!!i,e}runOneStep(t,e,r){const{dimensions:i,height:s,width:o,gravity:a,center:u,speed:c,clustering:f,nodeClusterBy:l,clusterGravity:h}=r,g=s*o,p=Math.sqrt(g)/10,v=t.getAllNodes(),m=g/(v.length+1),d=Math.sqrt(m),y={};if(this.applyCalculate(t,y,d,m),f){for(const b in e)e[b].cx=0,e[b].cy=0,e[b].count=0;v.forEach(b=>{const{data:x}=b,M=e[x[l]];U(x.x)&&(M.cx+=x.x),U(x.y)&&(M.cy+=x.y),M.count++});for(const b in e)e[b].cx/=e[b].count,e[b].cy/=e[b].count;const w=h||a;v.forEach((b,x)=>{const{id:M,data:N}=b;if(!U(N.x)||!U(N.y))return;const E=e[N[l]],O=Math.sqrt((N.x-E.cx)*(N.x-E.cx)+(N.y-E.cy)*(N.y-E.cy)),_=d*w;y[M].x-=_*(N.x-E.cx)/O,y[M].y-=_*(N.y-E.cy)/O})}v.forEach((w,b)=>{const{id:x,data:M}=w;if(!U(M.x)||!U(M.y))return;const N=.01*d*a;y[x].x-=N*(M.x-u[0]),y[x].y-=N*(M.y-u[1]),i===3&&(y[x].z-=N*(M.z-u[2]))}),v.forEach((w,b)=>{const{id:x,data:M}=w;if(U(M.fx)&&U(M.fy)){M.x=M.fx,M.y=M.fy,i===3&&(M.z=M.fz);return}if(!U(M.x)||!U(M.y))return;const N=Math.sqrt(y[x].x*y[x].x+y[x].y*y[x].y+(i===3?y[x].z*y[x].z:0));if(N>0){const E=Math.min(p*(c/AS),N);t.mergeNodeData(x,{x:M.x+y[x].x/N*E,y:M.y+y[x].y/N*E,z:i===3?M.z+y[x].z/N*E:void 0})}})}applyCalculate(t,e,r,i){this.calRepulsive(t,e,i),this.calAttractive(t,e,r)}calRepulsive(t,e,r){const i=t.getAllNodes();i.forEach(({data:s,id:o},a)=>{e[o]={x:0,y:0,z:0},i.forEach(({data:u,id:c},f)=>{if(a<=f||!U(s.x)||!U(u.x)||!U(s.y)||!U(u.y))return;let l=s.x-u.x,h=s.y-u.y,g=this.options.dimensions===3?s.z-u.z:0,p=l*l+h*h+g*g;p===0&&(p=1,l=.01,h=.01,g=.01);const v=r/p,m=l*v,d=h*v,y=g*v;e[o].x+=m,e[o].y+=d,e[c].x-=m,e[c].y-=d,this.options.dimensions===3&&(e[o].z+=y,e[c].z-=y)})})}calAttractive(t,e,r){t.getAllEdges().forEach(s=>{const{source:o,target:a}=s;if(!o||!a||o===a)return;const{data:u}=t.getNode(o),{data:c}=t.getNode(a);if(!U(c.x)||!U(u.x)||!U(c.y)||!U(u.y))return;const f=c.x-u.x,l=c.y-u.y,h=this.options.dimensions===3?c.z-u.z:0,g=Math.sqrt(f*f+l*l+h*h)/r,p=f*g,v=l*g,m=h*g;e[o].x+=p,e[o].y+=v,e[a].x-=p,e[a].y-=v,this.options.dimensions===3&&(e[o].z+=m,e[a].z-=m)})}}const TS={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 kS{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},TS),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericGridLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,t,e)})}genericGridLayout(t,e,r){return $(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),r),{begin:s=[0,0],condense:o,preventOverlapPadding:a,preventOverlap:u,rows:c,cols:f,nodeSpacing:l,nodeSize:h,width:g,height:p,position:v}=i;let{sortBy:m}=i;const d=e.getAllNodes(),y=e.getAllEdges(),w=d==null?void 0:d.length;if(!w||w===1)return nt(e,t,s);const b=d.map(I=>we(I));m!=="id"&&(!kt(m)||b[0].data[m]===void 0)&&(m="degree"),m==="degree"?b.sort((I,j)=>e.getDegree(j.id,"both")-e.getDegree(I.id,"both")):m==="id"?b.sort((I,j)=>U(j.id)&&U(I.id)?j.id-I.id:`${I.id}`.localeCompare(`${j.id}`)):b.sort((I,j)=>j.data[m]-I.data[m]);const x=!g&&typeof window<"u"?window.innerWidth:g,M=!p&&typeof window<"u"?window.innerHeight:p,N=w,E={rows:c,cols:f};if(c!=null&&f!=null)E.rows=c,E.cols=f;else if(c!=null&&f==null)E.rows=c,E.cols=Math.ceil(N/E.rows);else if(c==null&&f!=null)E.cols=f,E.rows=Math.ceil(N/E.cols);else{const I=Math.sqrt(N*M/x);E.rows=Math.round(I),E.cols=Math.round(x/M*I)}if(E.rows=Math.max(E.rows,1),E.cols=Math.max(E.cols,1),E.cols*E.rows>N){const I=Yr(E),j=Kr(E);(I-1)*j>=N?Yr(E,I-1):(j-1)*I>=N&&Kr(E,j-1)}else for(;E.cols*E.rows<N;){const I=Yr(E),j=Kr(E);(j+1)*I>=N?Kr(E,j+1):Yr(E,I+1)}let O=o?0:x/E.cols,_=o?0:M/E.rows;if(u||l){const I=We(10,l),j=Jc(30,h,!1);b.forEach(F=>{(!F.data.x||!F.data.y)&&(F.data.x=0,F.data.y=0);const A=e.getNode(F.id),k=j(A)||30;let L,D;he(k)?(L=k[0],D=k[1]):(L=k,D=k);const G=I!==void 0?I(F):a,P=L+G,z=D+G;O=Math.max(O,P),_=Math.max(_,z)})}const S={},q={row:0,col:0},R={};for(let I=0;I<b.length;I++){const j=b[I];let F;if(v&&(F=v(e.getNode(j.id))),F&&(F.row!==void 0||F.col!==void 0)){const A={row:F.row,col:F.col};if(A.col===void 0)for(A.col=0;Qu(S,A);)A.col++;else if(A.row===void 0)for(A.row=0;Qu(S,A);)A.row++;R[j.id]=A,d0(S,A)}jS(j,s,O,_,R,E,q,S)}const T={nodes:b,edges:y};return t&&b.forEach(I=>{e.mergeNodeData(I.id,{x:I.data.x,y:I.data.y})}),T})}}const Yr=(n,t)=>{let e;const r=n.rows||5,i=n.cols||5;return t==null?e=Math.min(r,i):Math.min(r,i)===n.rows?n.rows=t:n.cols=t,e},Kr=(n,t)=>{let e;const r=n.rows||5,i=n.cols||5;return t==null?e=Math.max(r,i):Math.max(r,i)===n.rows?n.rows=t:n.cols=t,e},Qu=(n,t)=>n[`c-${t.row}-${t.col}`]||!1,d0=(n,t)=>n[`c-${t.row}-${t.col}`]=!0,g0=(n,t)=>{const e=n.cols||5;t.col++,t.col>=e&&(t.col=0,t.row++)},jS=(n,t,e,r,i,s,o,a)=>{let u,c;const f=i[n.id];if(f)u=f.col*e+e/2+t[0],c=f.row*r+r/2+t[1];else{for(;Qu(a,o);)g0(s,o);u=o.col*e+e/2+t[0],c=o.row*r+r/2+t[1],d0(a,o),g0(s,o)}n.data.x=u,n.data.y=c},CS=(n,t,e)=>{try{const r=Ye.mul(Ye.pow(t,2),-.5),i=r.mean("row"),s=r.mean("column"),o=r.mean();r.add(o).subRowVector(i).subColumnVector(s);const a=new _f(r),u=Ye.sqrt(a.diagonalMatrix).diagonal();return a.leftSingularVectors.toJSON().map(c=>Ye.mul([c],[u]).toJSON()[0].splice(0,n))}catch{const i=[];for(let s=0;s<t.length;s++){const o=Math.random()*e,a=Math.random()*e;i.push([o,a])}return i}},PS=800,LS={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},DS=(n,t)=>{const e=Object.assign(Object.assign({},LS),t),{positions:r,iterations:i,width:s,k:o,speed:a=100,strictRadial:u,focusIdx:c,radii:f=[],nodeSizeFunc:l}=e,h=n.getAllNodes(),g=[],p=s/10;for(let v=0;v<i;v++)r.forEach((m,d)=>{g[d]={x:0,y:0}}),zS(h,r,g,o,f,l),$S(r,g,a,u,c,p,s,f);return r},zS=(n,t,e,r,i,s)=>{t.forEach((o,a)=>{e[a]={x:0,y:0},t.forEach((u,c)=>{if(a===c||i[a]!==i[c])return;let f=o.x-u.x,l=o.y-u.y,h=Math.sqrt(f*f+l*l);if(h===0){h=1;const g=a>c?1:-1;f=.01*g,l=.01*g}if(h<s(n[a])/2+s(n[c])/2){const g=r*r/h;e[a].x+=f/h*g,e[a].y+=l/h*g}})})},$S=(n,t,e,r,i,s,o,a)=>{const u=s||o/10;return r&&t.forEach((c,f)=>{const l=n[f].x-n[i].x,h=n[f].y-n[i].y,g=Math.sqrt(l*l+h*h);let p=h/g,v=-l/g;const m=Math.sqrt(c.x*c.x+c.y*c.y);let d=Math.acos((p*c.x+v*c.y)/m);d>Math.PI/2&&(d-=Math.PI/2,p*=-1,v*=-1);const y=Math.cos(d)*m;c.x=p*y,c.y=v*y}),n.forEach((c,f)=>{if(f===i)return;const l=Math.sqrt(t[f].x*t[f].x+t[f].y*t[f].y);if(l>0&&f!==i){const h=Math.min(u*(e/PS),l);if(c.x+=t[f].x/l*h,c.y+=t[f].y/l*h,r){let g=c.x-n[i].x,p=c.y-n[i].y;const v=Math.sqrt(g*g+p*p);g=g/v*a[f],p=p/v*a[f],c.x=n[i].x+g,c.y=n[i].y+p}}}),n},FS={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class BS{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},FS),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,t,e)})}genericRadialLayout(t,e,r){return $(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),r),{width:s,height:o,center:a,focusNode:u,unitRadius:c,nodeSize:f,nodeSpacing:l,strictRadial:h,preventOverlap:g,maxPreventOverlapIteration:p,sortBy:v,linkDistance:m=50,sortStrength:d=10,maxIteration:y=1e3}=i,w=e.getAllNodes(),b=e.getAllEdges(),x=!s&&typeof window<"u"?window.innerWidth:s,M=!o&&typeof window<"u"?window.innerHeight:o,N=a||[x/2,M/2];if(!(w!=null&&w.length)||w.length===1)return nt(e,t,N);let E=w[0];if(kt(u)){for(let V=0;V<w.length;V++)if(w[V].id===u){E=w[V];break}}else E=u||w[0];const O=VS(w,E.id),_=Xc({nodes:w,edges:b}),S=Kc(_),q=YS(S,O);WS(S,O,q+1);const R=S[O];let T=x-N[0]>N[0]?N[0]:x-N[0],I=M-N[1]>N[1]?N[1]:M-N[1];T===0&&(T=x/2),I===0&&(I=M/2);const j=Math.min(T,I),F=Math.max(...R),A=[],k=c||j/F;R.forEach((V,le)=>{A[le]=V*k});const L=US(w,S,m,A,k,v,d),D=GS(L),G=CS(m,L,m);let P=G.map(([V,le])=>({x:(isNaN(V)?Math.random()*m:V)-G[O][0],y:(isNaN(le)?Math.random()*m:le)-G[O][1]}));this.run(y,P,D,L,A,O);let z;if(g){z=Qc(f,l);const V={nodes:w,nodeSizeFunc:z,positions:P,radii:A,height:M,width:x,strictRadial:!!h,focusIdx:O,iterations:p||200,k:P.length/4.5};P=DS(e,V)}const B=[];return P.forEach((V,le)=>{const Ee=we(w[le]);Ee.data.x=V.x+N[0],Ee.data.y=V.y+N[1],B.push(Ee)}),t&&B.forEach(V=>e.mergeNodeData(V.id,{x:V.data.x,y:V.data.y})),{nodes:B,edges:b}})}run(t,e,r,i,s,o){for(let a=0;a<=t;a++){const u=a/t;this.oneIteration(u,e,s,i,r,o)}}oneIteration(t,e,r,i,s,o){const a=1-t;e.forEach((u,c)=>{const f=Zc(u,{x:0,y:0}),l=f===0?0:1/f;if(c===o)return;let h=0,g=0,p=0;e.forEach((m,d)=>{if(c===d)return;const y=Zc(u,m),w=y===0?0:1/y,b=i[d][c];p+=s[c][d],h+=s[c][d]*(m.x+b*(u.x-m.x)*w),g+=s[c][d]*(m.y+b*(u.y-m.y)*w)});const v=r[c]===0?0:1/r[c];p*=a,p+=t*v*v,h*=a,h+=t*v*u.x*l,u.x=h/p,g*=a,g+=t*v*u.y*l,u.y=g/p})}}const US=(n,t,e,r,i,s,o)=>{if(!n)return[];const a=[];if(t){const u={};t.forEach((c,f)=>{const l=[];c.forEach((h,g)=>{var p,v;if(f===g)l.push(0);else if(r[f]===r[g])if(s==="data")l.push(h*(Math.abs(f-g)*o)/(r[f]/i));else if(s){let m,d;if(u[n[f].id])m=u[n[f].id];else{const y=(s==="id"?n[f].id:(p=n[f].data)===null||p===void 0?void 0:p[s])||0;kt(y)?m=y.charCodeAt(0):m=y,u[n[f].id]=m}if(u[n[g].id])d=u[n[g].id];else{const y=(s==="id"?n[g].id:(v=n[g].data)===null||v===void 0?void 0:v[s])||0;kt(y)?d=y.charCodeAt(0):d=y,u[n[g].id]=d}l.push(h*(Math.abs(m-d)*o)/(r[f]/i))}else l.push(h*e/(r[f]/i));else{const m=(e+i)/2;l.push(h*m)}}),a.push(l)})}return a},GS=n=>{const t=n.length,e=n[0].length,r=[];for(let i=0;i<t;i++){const s=[];for(let o=0;o<e;o++)n[i][o]!==0?s.push(1/(n[i][o]*n[i][o])):s.push(0);r.push(s)}return r},VS=(n,t)=>{let e=-1;return n.forEach((r,i)=>{r.id===t&&(e=i)}),Math.max(e,0)},WS=(n,t,e)=>{const r=n.length;for(let i=0;i<r;i++)if(n[t][i]===1/0){n[t][i]=e,n[i][t]=e;for(let s=0;s<r;s++)n[i][s]!==1/0&&n[t][s]===1/0&&(n[t][s]=e+n[i][s],n[s][t]=e+n[i][s])}for(let i=0;i<r;i++)if(i!==t){for(let s=0;s<r;s++)if(n[i][s]===1/0){let o=Math.abs(n[t][i]-n[t][s]);o=o===0?1:o,n[i][s]=o}}},YS=(n,t)=>{let e=0;for(let r=0;r<n[t].length;r++)n[t][r]!==1/0&&(e=n[t][r]>e?n[t][r]:e);return e},KS={center:[0,0],width:300,height:300};class XS{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},KS),t)}execute(t,e){return $(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,t,e)})}assign(t,e){return $(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,t,e)})}genericRandomLayout(t,e,r){return $(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),r),{center:s,width:o,height:a}=i,u=e.getAllNodes(),c=.9,f=!o&&typeof window<"u"?window.innerWidth:o,l=!a&&typeof window<"u"?window.innerHeight:a,h=s||[f/2,l/2],g=[];return u&&u.forEach(v=>{g.push({id:v.id,data:{x:(Math.random()-.5)*c*f+h[0],y:(Math.random()-.5)*c*l+h[1]}})}),t&&g.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:g,edges:e.getAllEdges()}})}}const ZS={circular:Ly,concentric:vn,mds:Ef,random:XS,grid:kS,radial:BS,force:sf,d3force:Tf,"d3-force-3d":Lb,fruchterman:IS,forceAtlas2:qS,dagre:Wr,antvDagre:jy,comboCombined:k1};let Ue;rn({stopLayout(){Ue!=null&&Ue.stop&&Ue.stop()},calculateLayout(n,t){return $(this,void 0,void 0,function*(){const{layout:{id:e,options:r,iterations:i},nodes:s,edges:o}=n,a=new ue({nodes:s,edges:o}),u=ZS[e];if(u)Ue=new u(r);else throw new Error(`Unknown layout id: ${e}`);let c=yield Ue.execute(a);return xf(Ue)&&(Ue.stop(),c=Ue.tick(i)),[c,t]})}})})();