|
|
!function(){var t={92861:function(t,e,r){"use strict";var n=r(4811).default,o=r(34577).default,i=r(31573).default,a=r(38689).default,s=r(24270).default,u=r(13720).default,c=r(80619).default,h=r(47074).default,d=r(7134).default,f=r(85573).default,l=r(68995).default,g=r(79800).default,v=r(91232).default,p=r(7557).default,y=r(31468).default,m=r(82100).default,w=r(29186).default;var x=r(34634),b=r(34402),E=" ".repeat(2),N=" ".repeat(4);function M(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.maxRows,n=void 0===r?15:r,o=e.maxColumns,i=void 0===o?10:o,a=e.maxNumSize,s=void 0===a?8:a,u=e.padMinus,c=void 0===u?"auto":u;return"".concat(t.constructor.name," {\n").concat(E,"[\n").concat(N).concat(_(t,n,i,s,c),"\n").concat(E,"]\n").concat(E,"rows: ").concat(t.rows,"\n").concat(E,"columns: ").concat(t.columns,"\n}")}function _(t,e,r,n,o){var i=t.rows,a=t.columns,s=Math.min(i,e),u=Math.min(a,r),c=[];if("auto"===o){o=!1;t:for(var h=0;h<s;h++)for(var d=0;d<u;d++)if(t.get(h,d)<0){o=!0;break t}}for(var f=0;f<s;f++){for(var l=[],g=0;g<u;g++)l.push(k(t.get(f,g),n,o));c.push("".concat(l.join(" ")))}return u!==a&&(c[c.length-1]+=" ... ".concat(a-r," more columns")),s!==i&&c.push("... ".concat(i-e," more rows")),c.join("\n".concat(N))}function k(t,e,r){return(t>=0&&r?" ".concat(A(t,e-1)):A(t,e)).padEnd(e)}function A(t,e){var r=t.toString();if(r.length<=e)return r;var n=t.toFixed(e);if(n.length>e&&(n=t.toFixed(Math.max(0,e-(n.length-e)))),n.length<=e&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;var o=t.toExponential(e);return o.length>e&&(o=t.toExponential(Math.max(0,e-(o.length-e)))),o.slice(0)}function j(t,e,r){var n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function O(t,e,r){var n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function S(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function z(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function R(t,e){if(!x.isAnyArray(e))throw new TypeError("row indices must be an array");for(var r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.rows)throw new RangeError("row indices are out of range")}function I(t,e){if(!x.isAnyArray(e))throw new TypeError("column indices must be an array");for(var r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.columns)throw new RangeError("column indices are out of range")}function P(t,e,r,n,o){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(C("startRow",e),C("endRow",r),C("startColumn",n),C("endColumn",o),e>r||n>o||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||o<0||o>=t.columns)throw new RangeError("Submatrix indices are out of range")}function T(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],n=0;n<t;n++)r.push(e);return r}function C(t,e){if("number"!=typeof e)throw new TypeError("".concat(t," must be a number"))}function D(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}function L(t,e,r){for(var n=t.rows,o=t.columns,i=[],a=0;a<n;a++){for(var s=0,u=0,c=0,h=0;h<o;h++)s+=c=t.get(a,h)-r[a],u+=c*c;e?i.push((u-s*s/o)/(o-1)):i.push((u-s*s/o)/o)}return i}function F(t,e,r){for(var n=t.rows,o=t.columns,i=[],a=0;a<o;a++){for(var s=0,u=0,c=0,h=0;h<n;h++)s+=c=t.get(h,a)-r[a],u+=c*c;e?i.push((u-s*s/n)/(n-1)):i.push((u-s*s/n)/n)}return i}function q(t,e,r){for(var n=t.rows,o=t.columns,i=n*o,a=0,s=0,u=0,c=0;c<n;c++)for(var h=0;h<o;h++)a+=u=t.get(c,h)-r,s+=u*u;return e?(s-a*a/i)/(i-1):(s-a*a/i)/i}function V(t,e){for(var r=0;r<t.rows;r++)for(var n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}function B(t,e){for(var r=0;r<t.rows;r++)for(var n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}function G(t,e){for(var r=0;r<t.rows;r++)for(var n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}function U(t){for(var e=[],r=0;r<t.rows;r++){for(var n=0,o=0;o<t.columns;o++)n+=Math.pow(t.get(r,o),2)/(t.columns-1);e.push(Math.sqrt(n))}return e}function W(t,e){for(var r=0;r<t.rows;r++)for(var n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}function $(t){for(var e=[],r=0;r<t.columns;r++){for(var n=0,o=0;o<t.rows;o++)n+=Math.pow(t.get(o,r),2)/(t.rows-1);e.push(Math.sqrt(n))}return e}function Y(t,e){for(var r=0;r<t.rows;r++)for(var n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}function H(t){for(var e=t.size-1,r=0,n=0;n<t.columns;n++)for(var o=0;o<t.rows;o++)r+=Math.pow(t.get(o,n),2)/e;return Math.sqrt(r)}function K(t,e){for(var r=0;r<t.rows;r++)for(var n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}var J=function(t){function e(){m(this,e)}return w(e,[{key:"size",get:function(){return this.rows*this.columns}},{key:"apply",value:function(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)t.call(this,e,r);return this}},{key:"to1DArray",value:function(){for(var t=[],e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)t.push(this.get(e,r));return t}},{key:"to2DArray",value:function(){for(var t=[],e=0;e<this.rows;e++){t.push([]);for(var r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}},{key:"toJSON",value:function(){return this.to2DArray()}},{key:"isRowVector",value:function(){return 1===this.rows}},{key:"isColumnVector",value:function(){return 1===this.columns}},{key:"isVector",value:function(){return 1===this.rows||1===this.columns}},{key:"isSquare",value:function(){return this.rows===this.columns}},{key:"isEmpty",value:function(){return 0===this.rows||0===this.columns}},{key:"isSymmetric",value:function(){if(this.isSquare()){for(var t=0;t<this.rows;t++)for(var e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}},{key:"isDistance",value:function(){if(!this.isSymmetric())return!1;for(var t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}},{key:"isEchelonForm",value:function(){for(var t=0,e=0,r=-1,n=!0,o=!1;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);t++}return n}},{key:"isReducedEchelonForm",value:function(){for(var t=0,e=0,r=-1,n=!0,o=!1;t<this.rows&&n;){for(e=0,o=!1;e<this.columns&&!1===o;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(o=!0,r=e):(n=!1,o=!0);for(var i=e+1;i<this.rows;i++)0!==this.get(t,i)&&(n=!1);t++}return n}},{key:"echelonForm",value:function(){for(var t=this.clone(),e=0,r=0;e<t.rows&&r<t.columns;){for(var n=e,o=e;o<t.rows;o++)t.get(o,r)>t.get(n,r)&&(n=o);if(0===t.get(n,r))r++;else{t.swapRows(e,n);for(var i=t.get(e,r),a=r;a<t.columns;a++)t.set(e,a,t.get(e,a)/i);for(var s=e+1;s<t.rows;s++){var u=t.get(s,r)/t.get(e,r);t.set(s,r,0);for(var c=r+1;c<t.columns;c++)t.set(s,c,t.get(s,c)-t.get(e,c)*u)}e++,r++}}return t}},{key:"reducedEchelonForm",value:function(){for(var t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;n>=0;)if(0===t.maxRow(n))n--;else{for(var o=0,i=!1;o<r&&!1===i;)1===t.get(n,o)?i=!0:o++;for(var a=0;a<n;a++)for(var s=t.get(a,o),u=o;u<e;u++){var c=t.get(a,u)-s*t.get(n,u);t.set(a,u,c)}n--}return t}},{key:"set",value:function(){throw new Error("set method is unimplemented")}},{key:"get",value:function(){throw new Error("get method is unimplemented")}},{key:"repeat",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==y(t))throw new TypeError("options must be an object");var e=t.rows,r=void 0===e?1:e,n=t.columns,o=void 0===n?1:n;if(!Number.isInteger(r)||r<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(o)||o<=0)throw new TypeError("columns must be a positive integer");for(var i=new Z(this.rows*r,this.columns*o),a=0;a<r;a++)for(var s=0;s<o;s++)i.setSubMatrix(this,this.rows*a,this.columns*s);return i}},{key:"fill",value:function(t){for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,t);return this}},{key:"neg",value:function(){return this.mulS(-1)}},{key:"getRow",value:function(t){j(this,t);for(var e=[],r=0;r<this.columns;r++)e.push(this.get(t,r));return e}},{key:"getRowVector",value:function(t){return Z.rowVector(this.getRow(t))}},{key:"setRow",value:function(t,e){j(this,t),e=S(this,e);for(var r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}},{key:"swapRows",value:function(t,e){j(this,t),j(this,e);for(var r=0;r<this.columns;r++){var n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}},{key:"getColumn",value:function(t){O(this,t);for(var e=[],r=0;r<this.rows;r++)e.push(this.get(r,t));return e}},{key:"getColumnVector",value:function(t){return Z.columnVector(this.getColumn(t))}},{key:"setColumn",value:function(t,e){O(this,t),e=z(this,e);for(var r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}},{key:"swapColumns",value:function(t,e){O(this,t),O(this,e);for(var r=0;r<this.rows;r++){var n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}},{key:"addRowVector",value:function(t){t=S(this,t);for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}},{key:"subRowVector",value:function(t){t=S(this,t);for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}},{key:"mulRowVector",value:function(t){t=S(this,t);for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}},{key:"divRowVector",value:function(t){t=S(this,t);for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}},{key:"addColumnVector",value:function(t){t=z(this,t);for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}},{key:"subColumnVector",value:function(t){t=z(this,t);for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}},{key:"mulColumnVector",value:function(t){t=z(this,t);for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}},{key:"divColumnVector",value:function(t){t=z(this,t);for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}},{key:"mulRow",value:function(t,e){j(this,t);for(var r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}},{key:"mulColumn",value:function(t,e){O(this,t);for(var r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}},{key:"max",value:function(t){if(this.isEmpty())return NaN;switch(t){case"row":for(var e=new Array(this.rows).fill(Number.NEGATIVE_INFINITY),r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.get(r,n)>e[r]&&(e[r]=this.get(r,n));return e;case"column":for(var o=new Array(this.columns).fill(Number.NEGATIVE_INFINITY),i=0;i<this.rows;i++)for(var a=0;a<this.columns;a++)this.get(i,a)>o[a]&&(o[a]=this.get(i,a));return o;case void 0:for(var s=this.get(0,0),u=0;u<this.rows;u++)for(var c=0;c<this.columns;c++)this.get(u,c)>s&&(s=this.get(u,c));return s;default:throw new Error("invalid option: ".concat(t))}}},{key:"maxIndex",value:function(){D(this);for(var t=this.get(0,0),e=[0,0],r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}},{key:"min",value:function(t){if(this.isEmpty())return NaN;switch(t){case"row":for(var e=new Array(this.rows).fill(Number.POSITIVE_INFINITY),r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.get(r,n)<e[r]&&(e[r]=this.get(r,n));return e;case"column":for(var o=new Array(this.columns).fill(Number.POSITIVE_INFINITY),i=0;i<this.rows;i++)for(var a=0;a<this.columns;a++)this.get(i,a)<o[a]&&(o[a]=this.get(i,a));return o;case void 0:for(var s=this.get(0,0),u=0;u<this.rows;u++)for(var c=0;c<this.columns;c++)this.get(u,c)<s&&(s=this.get(u,c));return s;default:throw new Error("invalid option: ".concat(t))}}},{key:"minIndex",value:function(){D(this);for(var t=this.get(0,0),e=[0,0],r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}},{key:"maxRow",value:function(t){if(j(this,t),this.isEmpty())return NaN;for(var e=this.get(t,0),r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}},{key:"maxRowIndex",value:function(t){j(this,t),D(this);for(var e=this.get(t,0),r=[t,0],n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}},{key:"minRow",value:function(t){if(j(this,t),this.isEmpty())return NaN;for(var e=this.get(t,0),r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}},{key:"minRowIndex",value:function(t){j(this,t),D(this);for(var e=this.get(t,0),r=[t,0],n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}},{key:"maxColumn",value:function(t){if(O(this,t),this.isEmpty())return NaN;for(var e=this.get(0,t),r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}},{key:"maxColumnIndex",value:function(t){O(this,t),D(this);for(var e=this.get(0,t),r=[0,t],n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}},{key:"minColumn",value:function(t){if(O(this,t),this.isEmpty())return NaN;for(var e=this.get(0,t),r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}},{key:"minColumnIndex",value:function(t){O(this,t),D(this);for(var e=this.get(0,t),r=[0,t],n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}},{key:"diag",value:function(){for(var t=Math.min(this.rows,this.columns),e=[],r=0;r<t;r++)e.push(this.get(r,r));return e}},{key:"norm",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"frobenius";switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError("unknown norm type: ".concat(t))}}},{key:"cumulativeSum",value:function(){for(var t=0,e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}},{key:"dot",value:function(t){e.isMatrix(t)&&(t=t.to1DArray());var r=this.to1DArray();if(r.length!==t.length)throw new RangeError("vectors do not have the same size");for(var n=0,o=0;o<r.length;o++)n+=r[o]*t[o];return n}},{key:"mmul",value:function(t){t=Z.checkMatrix(t);for(var e=this.rows,r=this.columns,n=t.columns,o=new Z(e,n),i=new Float64Array(r),a=0;a<n;a++){for(var s=0;s<r;s++)i[s]=t.get(s,a);for(var u=0;u<e;u++){for(var c=0,h=0;h<r;h++)c+=this.get(u,h)*i[h];o.set(u,a,c)}}return o}},{key:"mpow",value:function(t){if(!this.isSquare())throw new RangeError("Matrix must be square");if(!Number.isInteger(t)||t<0)throw new RangeError("Exponent must be a non-negative integer");for(var e=Z.eye(this.rows),r=this,n=t;n>=1;n/=2)0!=(1&n)&&(e=e.mmul(r)),r=r.mmul(r);return e}},{key:"strassen2x2",value:function(t){t=Z.checkMatrix(t);var e=new Z(2,2),r=this.get(0,0),n=t.get(0,0),o=this.get(0,1),i=t.get(0,1),a=this.get(1,0),s=t.get(1,0),u=this.get(1,1),c=t.get(1,1),h=(r+u)*(n+c),d=(a+u)*n,f=r*(i-c),l=u*(s-n),g=(r+o)*c,v=h+l-g+(o-u)*(s+c),p=f+g,y=d+l,m=h-d+f+(a-r)*(n+i);return e.set(0,0,v),e.set(0,1,p),e.set(1,0,y),e.set(1,1,m),e}},{key:"strassen3x3",value:function(t){t=Z.checkMatrix(t);var e=new Z(3,3),r=this.get(0,0),n=this.get(0,1),o=this.get(0,2),i=this.get(1,0),a=this.get(1,1),s=this.get(1,2),u=this.get(2,0),c=this.get(2,1),h=this.get(2,2),d=t.get(0,0),f=t.get(0,1),l=t.get(0,2),g=t.get(1,0),v=t.get(1,1),p=t.get(1,2),y=t.get(2,0),m=t.get(2,1),w=t.get(2,2),x=(r-i)*(-f+v),b=(-r+i+a)*(d-f+v),E=(i+a)*(-d+f),N=r*d,M=(-r+u+c)*(d-l+p),_=(-r+u)*(l-p),k=(u+c)*(-d+l),A=(-o+c+h)*(v+y-m),j=(o-h)*(v-m),O=o*y,S=(c+h)*(-y+m),z=(-o+a+s)*(p+y-w),R=(o-s)*(p-w),I=(a+s)*(-y+w),P=N+O+n*g,T=(r+n+o-i-a-c-h)*v+b+E+N+A+O+S,C=N+M+k+(r+n+o-a-s-u-c)*p+O+z+I,D=x+a*(-d+f+g-v-p-y+w)+b+N+O+z+R,L=x+b+E+N+s*m,F=O+z+R+I+i*l,q=N+M+_+c*(-d+l+g-v-p-y+m)+A+j+O,V=A+j+O+S+u*f,B=N+M+_+k+h*w;return e.set(0,0,P),e.set(0,1,T),e.set(0,2,C),e.set(1,0,D),e.set(1,1,L),e.set(1,2,F),e.set(2,0,q),e.set(2,1,V),e.set(2,2,B),e}},{key:"mmulStrassen",value:function(t){t=Z.checkMatrix(t);var r=this.clone(),n=r.rows,o=r.columns,i=t.rows,a=t.columns;function s(t,r,n){var o=t.rows,i=t.columns;if(o===r&&i===n)return t;var a=e.zeros(r,n);return a=a.setSubMatrix(t,0,0)}o!==i&&console.warn("Multiplying ".concat(n," x ").concat(o," and ").concat(i," x ").concat(a," matrix: dimensions do not match."));var u=Math.max(n,i),c=Math.max(o,a);return function t(r,n,o,i){if(o<=512||i<=512)return r.mmul(n);o%2==1&&i%2==1?(r=s(r,o+1,i+1),n=s(n,o+1,i+1)):o%2==1?(r=s(r,o+1,i),n=s(n,o+1,i)):i%2==1&&(r=s(r,o,i+1),n=s(n,o,i+1));var a=parseInt(r.rows/2,10),u=parseInt(r.columns/2,10),c=r.subMatrix(0,a-1,0,u-1),h=n.subMatrix(0,a-1,0,u-1),d=r.subMatrix(0,a-1,u,r.columns-1),f=n.subMatrix(0,a-1,u,n.columns-1),l=r.subMatrix(a,r.rows-1,0,u-1),g=n.subMatrix(a,n.rows-1,0,u-1),v=r.subMatrix(a,r.rows-1,u,r.columns-1),p=n.subMatrix(a,n.rows-1,u,n.columns-1),y=t(e.add(c,v),e.add(h,p),a,u),m=t(e.add(l,v),h,a,u),w=t(c,e.sub(f,p),a,u),x=t(v,e.sub(g,h),a,u),b=t(e.add(c,d),p,a,u),E=t(e.sub(l,c),e.add(h,f),a,u),N=t(e.sub(d,v),e.add(g,p),a,u),M=e.add(y,x);M.sub(b),M.add(N);var _=e.add(w,b),k=e.add(m,x),A=e.sub(y,m);A.add(w),A.add(E);var j=e.zeros(2*M.rows,2*M.columns);return(j=(j=(j=(j=j.setSubMatrix(M,0,0)).setSubMatrix(_,M.rows,0)).setSubMatrix(k,0,M.columns)).setSubMatrix(A,M.rows,M.columns)).subMatrix(0,o-1,0,i-1)}(r=s(r,u,c),t=s(t,u,c),u,c)}},{key:"scaleRows",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==y(t))throw new TypeError("options must be an object");var e=t.min,r=void 0===e?0:e,n=t.max,o=void 0===n?1:n;if(!Number.isFinite(r))throw new TypeError("min must be a number");if(!Number.isFinite(o))throw new TypeError("max must be a number");if(r>=o)throw new RangeError("min must be smaller than max");for(var i=new Z(this.rows,this.columns),a=0;a<this.rows;a++){var s=this.getRow(a);s.length>0&&b(s,{min:r,max:o,output:s}),i.setRow(a,s)}return i}},{key:"scaleColumns",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("object"!==y(t))throw new TypeError("options must be an object");var e=t.min,r=void 0===e?0:e,n=t.max,o=void 0===n?1:n;if(!Number.isFinite(r))throw new TypeError("min must be a number");if(!Number.isFinite(o))throw new TypeError("max must be a number");if(r>=o)throw new RangeError("min must be smaller than max");for(var i=new Z(this.rows,this.columns),a=0;a<this.columns;a++){var s=this.getColumn(a);s.length&&b(s,{min:r,max:o,output:s}),i.setColumn(a,s)}return i}},{key:"flipRows",value:function(){for(var t=Math.ceil(this.columns/2),e=0;e<this.rows;e++)for(var r=0;r<t;r++){var n=this.get(e,r),o=this.get(e,this.columns-1-r);this.set(e,r,o),this.set(e,this.columns-1-r,n)}return this}},{key:"flipColumns",value:function(){for(var t=Math.ceil(this.rows/2),e=0;e<this.columns;e++)for(var r=0;r<t;r++){var n=this.get(r,e),o=this.get(this.rows-1-r,e);this.set(r,e,o),this.set(this.rows-1-r,e,n)}return this}},{key:"kroneckerProduct",value:function(t){t=Z.checkMatrix(t);for(var e=this.rows,r=this.columns,n=t.rows,o=t.columns,i=new Z(e*n,r*o),a=0;a<e;a++)for(var s=0;s<r;s++)for(var u=0;u<n;u++)for(var c=0;c<o;c++)i.set(n*a+u,o*s+c,this.get(a,s)*t.get(u,c));return i}},{key:"kroneckerSum",value:function(t){if(t=Z.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");var e=this.rows,r=t.rows,n=this.kroneckerProduct(Z.eye(r,r)),o=Z.eye(e,e).kroneckerProduct(t);return n.add(o)}},{key:"transpose",value:function(){for(var t=new Z(this.columns,this.rows),e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}},{key:"sortRows",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Q,e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}},{key:"sortColumns",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Q,e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}},{key:"subMatrix",value:function(t,e,r,n){P(this,t,e,r,n);for(var o=new Z(e-t+1,n-r+1),i=t;i<=e;i++)for(var a=r;a<=n;a++)o.set(i-t,a-r,this.get(i,a));return o}},{key:"subMatrixRow",value:function(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");for(var n=new Z(t.length,r-e+1),o=0;o<t.length;o++)for(var i=e;i<=r;i++){if(t[o]<0||t[o]>=this.rows)throw new RangeError("Row index out of range: ".concat(t[o]));n.set(o,i-e,this.get(t[o],i))}return n}},{key:"subMatrixColumn",value:function(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");for(var n=new Z(r-e+1,t.length),o=0;o<t.length;o++)for(var i=e;i<=r;i++){if(t[o]<0||t[o]>=this.columns)throw new RangeError("Column index out of range: ".concat(t[o]));n.set(i-e,o,this.get(i,t[o]))}return n}},{key:"setSubMatrix",value:function(t,e,r){if((t=Z.checkMatrix(t)).isEmpty())return this;P(this,e,e+t.rows-1,r,r+t.columns-1);for(var n=0;n<t.rows;n++)for(var o=0;o<t.columns;o++)this.set(e+n,r+o,t.get(n,o));return this}},{key:"selection",value:function(t,e){R(this,t),I(this,e);for(var r=new Z(t.length,e.length),n=0;n<t.length;n++)for(var o=t[n],i=0;i<e.length;i++){var a=e[i];r.set(n,i,this.get(o,a))}return r}},{key:"trace",value:function(){for(var t=Math.min(this.rows,this.columns),e=0,r=0;r<t;r++)e+=this.get(r,r);return e}},{key:"clone",value:function(){return this.constructor.copy(this,new Z(this.rows,this.columns))}},{key:"sum",value:function(t){switch(t){case"row":return function(t){for(var e=T(t.rows),r=0;r<t.rows;++r)for(var n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}(this);case"column":return function(t){for(var e=T(t.columns),r=0;r<t.rows;++r)for(var n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}(this);case void 0:return function(t){for(var e=0,r=0;r<t.rows;r++)for(var n=0;n<t.columns;n++)e+=t.get(r,n);return e}(this);default:throw new Error("invalid option: ".concat(t))}}},{key:"product",value:function(t){switch(t){case"row":return function(t){for(var e=T(t.rows,1),r=0;r<t.rows;++r)for(var n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}(this);case"column":return function(t){for(var e=T(t.columns,1),r=0;r<t.rows;++r)for(var n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}(this);case void 0:return function(t){for(var e=1,r=0;r<t.rows;r++)for(var n=0;n<t.columns;n++)e*=t.get(r,n);return e}(this);default:throw new Error("invalid option: ".concat(t))}}},{key:"mean",value:function(t){var e=this.sum(t);switch(t){case"row":for(var r=0;r<this.rows;r++)e[r]/=this.columns;return e;case"column":for(var n=0;n<this.columns;n++)e[n]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error("invalid option: ".concat(t))}}},{key:"variance",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"===y(t)&&(e=t,t=void 0),"object"!==y(e))throw new TypeError("options must be an object");var r=e,n=r.unbiased,o=void 0===n||n,i=r.mean,a=void 0===i?this.mean(t):i;if("boolean"!=typeof o)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!x.isAnyArray(a))throw new TypeError("mean must be an array");return L(this,o,a);case"column":if(!x.isAnyArray(a))throw new TypeError("mean must be an array");return F(this,o,a);case void 0:if("number"!=typeof a)throw new TypeError("mean must be a number");return q(this,o,a);default:throw new Error("invalid option: ".concat(t))}}},{key:"standardDeviation",value:function(t,e){"object"===y(t)&&(e=t,t=void 0);var r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(var n=0;n<r.length;n++)r[n]=Math.sqrt(r[n]);return r}},{key:"center",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"===y(t)&&(e=t,t=void 0),"object"!==y(e))throw new TypeError("options must be an object");var r=e,n=r.center,o=void 0===n?this.mean(t):n;switch(t){case"row":if(!x.isAnyArray(o))throw new TypeError("center must be an array");return V(this,o),this;case"column":if(!x.isAnyArray(o))throw new TypeError("center must be an array");return B(this,o),this;case void 0:if("number"!=typeof o)throw new TypeError("center must be a number");return G(this,o),this;default:throw new Error("invalid option: ".concat(t))}}},{key:"scale",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("object"===y(t)&&(e=t,t=void 0),"object"!==y(e))throw new TypeError("options must be an object");var r=e.scale;switch(t){case"row":if(void 0===r)r=U(this);else if(!x.isAnyArray(r))throw new TypeError("scale must be an array");return W(this,r),this;case"column":if(void 0===r)r=$(this);else if(!x.isAnyArray(r))throw new TypeError("scale must be an array");return Y(this,r),this;case void 0:if(void 0===r)r=H(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return K(this,r),this;default:throw new Error("invalid option: ".concat(t))}}},{key:"toString",value:function(t){return M(this,t)}},{key:t,value:function(){return this.entries()}},{key:"entries",value:p().mark((function t(){var e,r;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=0;case 1:if(!(e<this.rows)){t.next=12;break}r=0;case 3:if(!(r<this.columns)){t.next=9;break}return t.next=6,[e,r,this.get(e,r)];case 6:r++,t.next=3;break;case 9:e++,t.next=1;break;case 12:case"end":return t.stop()}}),t,this)}))},{key:"values",value:p().mark((function t(){var e,r;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=0;case 1:if(!(e<this.rows)){t.next=12;break}r=0;case 3:if(!(r<this.columns)){t.next=9;break}return t.next=6,this.get(e,r);case 6:r++,t.next=3;break;case 9:e++,t.next=1;break;case 12:case"end":return t.stop()}}),t,this)}))}],[{key:"from1DArray",value:function(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");for(var n=new Z(t,e),o=0;o<t;o++)for(var i=0;i<e;i++)n.set(o,i,r[o*e+i]);return n}},{key:"rowVector",value:function(t){for(var e=new Z(1,t.length),r=0;r<t.length;r++)e.set(0,r,t[r]);return e}},{key:"columnVector",value:function(t){for(var e=new Z(t.length,1),r=0;r<t.length;r++)e.set(r,0,t[r]);return e}},{key:"zeros",value:function(t,e){return new Z(t,e)}},{key:"ones",value:function(t,e){return new Z(t,e).fill(1)}},{key:"rand",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("object"!==y(r))throw new TypeError("options must be an object");for(var n=r.random,o=void 0===n?Math.random:n,i=new Z(t,e),a=0;a<t;a++)for(var s=0;s<e;s++)i.set(a,s,o());return i}},{key:"randInt",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("object"!==y(r))throw new TypeError("options must be an object");var n=r.min,o=void 0===n?0:n,i=r.max,a=void 0===i?1e3:i,s=r.random,u=void 0===s?Math.random:s;if(!Number.isInteger(o))throw new TypeError("min must be an integer");if(!Number.isInteger(a))throw new TypeError("max must be an integer");if(o>=a)throw new RangeError("min must be smaller than max");for(var c=a-o,h=new Z(t,e),d=0;d<t;d++)for(var f=0;f<e;f++){var l=o+Math.round(u()*c);h.set(d,f,l)}return h}},{key:"eye",value:function(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);for(var n=Math.min(t,e),o=this.zeros(t,e),i=0;i<n;i++)o.set(i,i,r);return o}},{key:"diag",value:function(t,e,r){var n=t.length;void 0===e&&(e=n),void 0===r&&(r=e);for(var o=Math.min(n,e,r),i=this.zeros(e,r),a=0;a<o;a++)i.set(a,a,t[a]);return i}},{key:"min",value:function(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);for(var r=t.rows,n=t.columns,o=new Z(r,n),i=0;i<r;i++)for(var a=0;a<n;a++)o.set(i,a,Math.min(t.get(i,a),e.get(i,a)));return o}},{key:"max",value:function(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);for(var r=t.rows,n=t.columns,o=new this(r,n),i=0;i<r;i++)for(var a=0;a<n;a++)o.set(i,a,Math.max(t.get(i,a),e.get(i,a)));return o}},{key:"checkMatrix",value:function(t){return e.isMatrix(t)?t:new Z(t)}},{key:"isMatrix",value:function(t){return null!=t&&"Matrix"===t.klass}},{key:"copy",value:function(t,e){var r,n=v(t.entries());try{for(n.s();!(r=n.n()).done;){var o=g(r.value,3),i=o[0],a=o[1],s=o[2];e.set(i,a,s)}}catch(t){n.e(t)}finally{n.f()}return e}}]),e}(Symbol.iterator);function Q(t,e){return t-e}J.prototype.klass="Matrix","undefined"!=typeof Symbol&&(J.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return M(this)}),J.random=J.rand,J.randomInt=J.randInt,J.diagonal=J.diag,J.prototype.diagonal=J.prototype.diag,J.identity=J.eye,J.prototype.negate=J.prototype.neg,J.prototype.tensorProduct=J.prototype.kroneckerProduct;var X=new WeakSet,Z=function(t){c(r,t);var e=h(r);function r(t,n){var o;if(m(this,r),o=e.call(this),d(u(o),X),f(u(o),"data",void 0),r.isMatrix(t))l(u(o),X,tt).call(u(o),t.rows,t.columns),r.copy(t,u(o));else if(Number.isInteger(t)&&t>=0)l(u(o),X,tt).call(u(o),t,n);else{if(!x.isAnyArray(t))throw new TypeError("First argument must be a positive number or an array");var i=t;if("number"!=typeof(n=(t=i.length)?i[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");o.data=[];for(var a=0;a<t;a++){if(i[a].length!==n)throw new RangeError("Inconsistent array dimensions");if(!i[a].every((function(t){return"number"==typeof t})))throw new TypeError("Input data contains non-numeric values");o.data.push(Float64Array.from(i[a]))}o.rows=t,o.columns=n}return o}return w(r,[{key:"set",value:function(t,e,r){return this.data[t][e]=r,this}},{key:"get",value:function(t,e){return this.data[t][e]}},{key:"removeRow",value:function(t){return j(this,t),this.data.splice(t,1),this.rows-=1,this}},{key:"addRow",value:function(t,e){return void 0===e&&(e=t,t=this.rows),j(this,t,!0),e=Float64Array.from(S(this,e)),this.data.splice(t,0,e),this.rows+=1,this}},{key:"removeColumn",value:function(t){O(this,t);for(var e=0;e<this.rows;e++){for(var r=new Float64Array(this.columns-1),n=0;n<t;n++)r[n]=this.data[e][n];for(var o=t+1;o<this.columns;o++)r[o-1]=this.data[e][o];this.data[e]=r}return this.columns-=1,this}},{key:"addColumn",value:function(t,e){void 0===e&&(e=t,t=this.columns),O(this,t,!0),e=z(this,e);for(var r=0;r<this.rows;r++){for(var n=new Float64Array(this.columns+1),o=0;o<t;o++)n[o]=this.data[r][o];for(n[o++]=e[r];o<this.columns+1;o++)n[o]=this.data[r][o-1];this.data[r]=n}return this.columns+=1,this}}]),r}(J);function tt(t,e){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(var r=0;r<t;r++)this.data.push(new Float64Array(e));this.rows=t,this.columns=e}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)+t.get(r,n));return this},t.add=function(t,r){return new e(t).add(r)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)-t.get(r,n));return this},t.sub=function(t,r){return new e(t).sub(r)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)*t.get(r,n));return this},t.mul=function(t,r){return new e(t).mul(r)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)/t.get(r,n));return this},t.div=function(t,r){return new e(t).div(r)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)%t.get(r,n));return this},t.mod=function(t,r){return new e(t).mod(r)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)&t.get(r,n));return this},t.and=function(t,r){return new e(t).and(r)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)|t.get(r,n));return this},t.or=function(t,r){return new e(t).or(r)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)^t.get(r,n));return this},t.xor=function(t,r){return new e(t).xor(r)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)<<t.get(r,n));return this},t.leftShift=function(t,r){return new e(t).leftShift(r)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)>>t.get(r,n));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.set(r,n,this.get(r,n)>>>t.get(r,n));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(var t=0;t<this.rows;t++)for(var e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,r){return new e(t).pow(r)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(var e=0;e<this.rows;e++)for(var r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(var r=0;r<this.rows;r++)for(var n=0;n<this.columns;n++)this.set(r,n,Math.pow(this.get(r,n),t.get(r,n)));return this}}(J,Z);var et=new WeakMap,rt=function(t){c(r,t);var e=h(r);function r(t){var n;if(m(this,r),n=e.call(this),i(u(n),et,{writable:!0,value:void 0}),Z.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");a(u(n),et,Z.copy(t,new Z(t.rows,t.rows)))}else if(Number.isInteger(t)&&t>=0)a(u(n),et,new Z(t,t));else if(a(u(n),et,new Z(t)),!n.isSymmetric())throw new TypeError("not symmetric data");return n}return w(r,[{key:"size",get:function(){return s(this,et).size}},{key:"rows",get:function(){return s(this,et).rows}},{key:"columns",get:function(){return s(this,et).columns}},{key:"diagonalSize",get:function(){return this.rows}},{key:"clone",value:function(){var t,e=new r(this.diagonalSize),n=v(this.upperRightEntries());try{for(n.s();!(t=n.n()).done;){var o=g(t.value,3),i=o[0],a=o[1],s=o[2];e.set(i,a,s)}}catch(t){n.e(t)}finally{n.f()}return e}},{key:"toMatrix",value:function(){return new Z(this)}},{key:"get",value:function(t,e){return s(this,et).get(t,e)}},{key:"set",value:function(t,e,r){return s(this,et).set(t,e,r),s(this,et).set(e,t,r),this}},{key:"removeCross",value:function(t){return s(this,et).removeRow(t),s(this,et).removeColumn(t),this}},{key:"addCross",value:function(t,e){void 0===e&&(e=t,t=this.diagonalSize);var r=e.slice();return r.splice(t,1),s(this,et).addRow(t,r),s(this,et).addColumn(t,e),this}},{key:"applyMask",value:function(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");var e,r=[],n=v(t.entries());try{for(n.s();!(e=n.n()).done;){var o=g(e.value,2),i=o[0];o[1]||r.push(i)}}catch(t){n.e(t)}finally{n.f()}r.reverse();for(var a=0,s=r;a<s.length;a++){var u=s[a];this.removeCross(u)}return this}},{key:"toCompact",value:function(){for(var t=this.diagonalSize,e=new Array(t*(t+1)/2),r=0,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=++n);return e}},{key:"upperRightEntries",value:p().mark((function t(){var e,r,n;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=0,r=0;case 1:if(!(e<this.diagonalSize)){t.next=9;break}return n=this.get(e,r),t.next=5,[e,r,n];case 5:++r>=this.diagonalSize&&(r=++e);case 6:t.next=1;break;case 9:case"end":return t.stop()}}),t,this)}))},{key:"upperRightValues",value:p().mark((function t(){var e,r,n;return p().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=0,r=0;case 1:if(!(e<this.diagonalSize)){t.next=9;break}return n=this.get(e,r),t.next=5,n;case 5:++r>=this.diagonalSize&&(r=++e);case 6:t.next=1;break;case 9:case"end":return t.stop()}}),t,this)}))}],[{key:"isSymmetricMatrix",value:function(t){return Z.isMatrix(t)&&"SymmetricMatrix"===t.klassType}},{key:"zeros",value:function(t){return new this(t)}},{key:"ones",value:function(t){return new this(t).fill(1)}},{key:"fromCompact",value:function(t){var e=t.length,n=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(n))throw new TypeError("This array is not a compact representation of a Symmetric Matrix, ".concat(JSON.stringify(t)));for(var o=new r(n),i=0,a=0,s=0;s<e;s++)o.set(i,a,t[s]),++i>=n&&(i=++a);return o}}]),r}(J);rt.prototype.klassType="SymmetricMatrix";var nt=function(t){c(r,t);var e=h(r);function r(t){var n;if(m(this,r),!(n=e.call(this,t)).isDistance())throw new TypeError("Provided arguments do no produce a distance matrix");return n}return w(r,[{key:"set",value:function(t,e,i){return t===e&&(i=0),n(o(r.prototype),"set",this).call(this,t,e,i)}},{key:"addCross",value:function(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,n(o(r.prototype),"addCross",this).call(this,t,e)}},{key:"toSymmetricMatrix",value:function(){return new rt(this)}},{key:"clone",value:function(){var t,e=new r(this.diagonalSize),n=v(this.upperRightEntries());try{for(n.s();!(t=n.n()).done;){var o=g(t.value,3),i=o[0],a=o[1],s=o[2];i!==a&&e.set(i,a,s)}}catch(t){n.e(t)}finally{n.f()}return e}},{key:"toCompact",value:function(){for(var t=this.diagonalSize,e=new Array((t-1)*t/2),r=1,n=0,o=0;o<e.length;o++)e[o]=this.get(n,r),++r>=t&&(r=1+ ++n);return e}}],[{key:"isDistanceMatrix",value:function(t){return rt.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}},{key:"fromCompact",value:function(t){var e=t.length;if(0===e)return new this(0);var 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, ".concat(JSON.stringify(t)));for(var n=new this(r),o=1,i=0,a=0;a<e;a++)n.set(o,i,t[a]),++o>=r&&(o=1+ ++i);return n}}]),r}(rt);nt.prototype.klassSubType="DistanceMatrix";var ot=function(t){c(r,t);var e=h(r);function r(t,n,o){var i;return m(this,r),(i=e.call(this)).matrix=t,i.rows=n,i.columns=o,i}return w(r)}(J),it=function(t){c(r,t);var e=h(r);function r(t,n){var o;return m(this,r),O(t,n),(o=e.call(this,t,t.rows,1)).column=n,o}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(t,this.column,r),this}},{key:"get",value:function(t){return this.matrix.get(t,this.column)}}]),r}(ot),at=function(t){c(r,t);var e=h(r);function r(t,n){var o;return m(this,r),I(t,n),(o=e.call(this,t,t.rows,n.length)).columnIndices=n,o}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(t,this.columnIndices[e],r),this}},{key:"get",value:function(t,e){return this.matrix.get(t,this.columnIndices[e])}}]),r}(ot),st=function(t){c(r,t);var e=h(r);function r(t){return m(this,r),e.call(this,t,t.rows,t.columns)}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(t,this.columns-e-1,r),this}},{key:"get",value:function(t,e){return this.matrix.get(t,this.columns-e-1)}}]),r}(ot),ut=function(t){c(r,t);var e=h(r);function r(t){return m(this,r),e.call(this,t,t.rows,t.columns)}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(this.rows-t-1,e,r),this}},{key:"get",value:function(t,e){return this.matrix.get(this.rows-t-1,e)}}]),r}(ot),ct=function(t){c(r,t);var e=h(r);function r(t,n){var o;return m(this,r),j(t,n),(o=e.call(this,t,1,t.columns)).row=n,o}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(this.row,e,r),this}},{key:"get",value:function(t,e){return this.matrix.get(this.row,e)}}]),r}(ot),ht=function(t){c(r,t);var e=h(r);function r(t,n){var o;return m(this,r),R(t,n),(o=e.call(this,t,n.length,t.columns)).rowIndices=n,o}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(this.rowIndices[t],e,r),this}},{key:"get",value:function(t,e){return this.matrix.get(this.rowIndices[t],e)}}]),r}(ot),dt=function(t){c(r,t);var e=h(r);function r(t,n,o){var i;return m(this,r),R(t,n),I(t,o),(i=e.call(this,t,n.length,o.length)).rowIndices=n,i.columnIndices=o,i}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],r),this}},{key:"get",value:function(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}]),r}(ot),ft=function(t){c(r,t);var e=h(r);function r(t,n,o,i,a){var s;return m(this,r),P(t,n,o,i,a),(s=e.call(this,t,o-n+1,a-i+1)).startRow=n,s.startColumn=i,s}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(this.startRow+t,this.startColumn+e,r),this}},{key:"get",value:function(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}}]),r}(ot),lt=function(t){c(r,t);var e=h(r);function r(t){return m(this,r),e.call(this,t,t.columns,t.rows)}return w(r,[{key:"set",value:function(t,e,r){return this.matrix.set(e,t,r),this}},{key:"get",value:function(t,e){return this.matrix.get(e,t)}}]),r}(ot),gt=function(t){c(r,t);var e=h(r);function r(t){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};m(this,r);var i=o.rows,a=void 0===i?1:i;if(t.length%a!=0)throw new Error("the data length is not divisible by the number of rows");return(n=e.call(this)).rows=a,n.columns=t.length/a,n.data=t,n}return w(r,[{key:"set",value:function(t,e,r){var n=this._calculateIndex(t,e);return this.data[n]=r,this}},{key:"get",value:function(t,e){var r=this._calculateIndex(t,e);return this.data[r]}},{key:"_calculateIndex",value:function(t,e){return t*this.columns+e}}]),r}(J),vt=function(t){c(r,t);var e=h(r);function r(t){var n;return m(this,r),(n=e.call(this)).data=t,n.rows=t.length,n.columns=t[0].length,n}return w(r,[{key:"set",value:function(t,e,r){return this.data[t][e]=r,this}},{key:"get",value:function(t,e){return this.data[t][e]}}]),r}(J);var pt=function(){function t(e){m(this,t);var r,n,o,i,a,s,u,c,h,d=(e=vt.checkMatrix(e)).clone(),f=d.rows,l=d.columns,g=new Float64Array(f),v=1;for(r=0;r<f;r++)g[r]=r;for(c=new Float64Array(f),n=0;n<l;n++){for(r=0;r<f;r++)c[r]=d.get(r,n);for(r=0;r<f;r++){for(h=Math.min(r,n),a=0,o=0;o<h;o++)a+=d.get(r,o)*c[o];c[r]-=a,d.set(r,n,c[r])}for(i=n,r=n+1;r<f;r++)Math.abs(c[r])>Math.abs(c[i])&&(i=r);if(i!==n){for(o=0;o<l;o++)s=d.get(i,o),d.set(i,o,d.get(n,o)),d.set(n,o,s);u=g[i],g[i]=g[n],g[n]=u,v=-v}if(n<f&&0!==d.get(n,n))for(r=n+1;r<f;r++)d.set(r,n,d.get(r,n)/d.get(n,n))}this.LU=d,this.pivotVector=g,this.pivotSign=v}return w(t,[{key:"isSingular",value:function(){for(var t=this.LU,e=t.columns,r=0;r<e;r++)if(0===t.get(r,r))return!0;return!1}},{key:"solve",value:function(t){t=Z.checkMatrix(t);var e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");var r,n,o,i=t.columns,a=t.subMatrixRow(this.pivotVector,0,i-1),s=e.columns;for(o=0;o<s;o++)for(r=o+1;r<s;r++)for(n=0;n<i;n++)a.set(r,n,a.get(r,n)-a.get(o,n)*e.get(r,o));for(o=s-1;o>=0;o--){for(n=0;n<i;n++)a.set(o,n,a.get(o,n)/e.get(o,o));for(r=0;r<o;r++)for(n=0;n<i;n++)a.set(r,n,a.get(r,n)-a.get(o,n)*e.get(r,o))}return a}},{key:"determinant",get:function(){var t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");for(var e=this.pivotSign,r=t.columns,n=0;n<r;n++)e*=t.get(n,n);return e}},{key:"lowerTriangularMatrix",get:function(){for(var t=this.LU,e=t.rows,r=t.columns,n=new Z(e,r),o=0;o<e;o++)for(var i=0;i<r;i++)o>i?n.set(o,i,t.get(o,i)):o===i?n.set(o,i,1):n.set(o,i,0);return n}},{key:"upperTriangularMatrix",get:function(){for(var t=this.LU,e=t.rows,r=t.columns,n=new Z(e,r),o=0;o<e;o++)for(var i=0;i<r;i++)o<=i?n.set(o,i,t.get(o,i)):n.set(o,i,0);return n}},{key:"pivotPermutationVector",get:function(){return Array.from(this.pivotVector)}}]),t}();function yt(t,e){var r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}var mt=function(){function t(e){m(this,t);var r,n,o,i,a=(e=vt.checkMatrix(e)).clone(),s=e.rows,u=e.columns,c=new Float64Array(u);for(o=0;o<u;o++){var h=0;for(r=o;r<s;r++)h=yt(h,a.get(r,o));if(0!==h){for(a.get(o,o)<0&&(h=-h),r=o;r<s;r++)a.set(r,o,a.get(r,o)/h);for(a.set(o,o,a.get(o,o)+1),n=o+1;n<u;n++){for(i=0,r=o;r<s;r++)i+=a.get(r,o)*a.get(r,n);for(i=-i/a.get(o,o),r=o;r<s;r++)a.set(r,n,a.get(r,n)+i*a.get(r,o))}}c[o]=-h}this.QR=a,this.Rdiag=c}return w(t,[{key:"solve",value:function(t){t=Z.checkMatrix(t);var 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");var n,o,i,a,s=t.columns,u=t.clone(),c=e.columns;for(i=0;i<c;i++)for(o=0;o<s;o++){for(a=0,n=i;n<r;n++)a+=e.get(n,i)*u.get(n,o);for(a=-a/e.get(i,i),n=i;n<r;n++)u.set(n,o,u.get(n,o)+a*e.get(n,i))}for(i=c-1;i>=0;i--){for(o=0;o<s;o++)u.set(i,o,u.get(i,o)/this.Rdiag[i]);for(n=0;n<i;n++)for(o=0;o<s;o++)u.set(n,o,u.get(n,o)-u.get(i,o)*e.get(n,i))}return u.subMatrix(0,c-1,0,s-1)}},{key:"isFullRank",value:function(){for(var t=this.QR.columns,e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}},{key:"upperTriangularMatrix",get:function(){var t,e,r=this.QR,n=r.columns,o=new Z(n,n);for(t=0;t<n;t++)for(e=0;e<n;e++)t<e?o.set(t,e,r.get(t,e)):t===e?o.set(t,e,this.Rdiag[t]):o.set(t,e,0);return o}},{key:"orthogonalMatrix",get:function(){var t,e,r,n,o=this.QR,i=o.rows,a=o.columns,s=new Z(i,a);for(r=a-1;r>=0;r--){for(t=0;t<i;t++)s.set(t,r,0);for(s.set(r,r,1),e=r;e<a;e++)if(0!==o.get(r,r)){for(n=0,t=r;t<i;t++)n+=o.get(t,r)*s.get(t,e);for(n=-n/o.get(r,r),t=r;t<i;t++)s.set(t,e,s.get(t,e)+n*o.get(t,r))}}return s}}]),t}(),wt=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(m(this,t),(e=vt.checkMatrix(e)).isEmpty())throw new Error("Matrix must be non-empty");var n,o=e.rows,i=e.columns,a=r.computeLeftSingularVectors,s=void 0===a||a,u=r.computeRightSingularVectors,c=void 0===u||u,h=r.autoTranspose,d=void 0!==h&&h,f=Boolean(s),l=Boolean(c),g=!1;if(o<i)if(d){o=(n=e.transpose()).rows,i=n.columns,g=!0;var v=f;f=l,l=v}else n=e.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else n=e.clone();for(var p=Math.min(o,i),y=Math.min(o+1,i),w=new Float64Array(y),x=new Z(o,p),b=new Z(i,i),E=new Float64Array(i),N=new Float64Array(o),M=new Float64Array(y),_=0;_<y;_++)M[_]=_;for(var k=Math.min(o-1,i),A=Math.max(0,Math.min(i-2,o)),j=Math.max(k,A),O=0;O<j;O++){if(O<k){w[O]=0;for(var S=O;S<o;S++)w[O]=yt(w[O],n.get(S,O));if(0!==w[O]){n.get(O,O)<0&&(w[O]=-w[O]);for(var z=O;z<o;z++)n.set(z,O,n.get(z,O)/w[O]);n.set(O,O,n.get(O,O)+1)}w[O]=-w[O]}for(var R=O+1;R<i;R++){if(O<k&&0!==w[O]){for(var I=0,P=O;P<o;P++)I+=n.get(P,O)*n.get(P,R);I=-I/n.get(O,O);for(var T=O;T<o;T++)n.set(T,R,n.get(T,R)+I*n.get(T,O))}E[R]=n.get(O,R)}if(f&&O<k)for(var C=O;C<o;C++)x.set(C,O,n.get(C,O));if(O<A){E[O]=0;for(var D=O+1;D<i;D++)E[O]=yt(E[O],E[D]);if(0!==E[O]){E[O+1]<0&&(E[O]=0-E[O]);for(var L=O+1;L<i;L++)E[L]/=E[O];E[O+1]+=1}if(E[O]=-E[O],O+1<o&&0!==E[O]){for(var F=O+1;F<o;F++)N[F]=0;for(var q=O+1;q<o;q++)for(var V=O+1;V<i;V++)N[q]+=E[V]*n.get(q,V);for(var B=O+1;B<i;B++)for(var G=-E[B]/E[O+1],U=O+1;U<o;U++)n.set(U,B,n.get(U,B)+G*N[U])}if(l)for(var W=O+1;W<i;W++)b.set(W,O,E[W])}}var $=Math.min(i,o+1);if(k<i&&(w[k]=n.get(k,k)),o<$&&(w[$-1]=0),A+1<$&&(E[A]=n.get(A,$-1)),E[$-1]=0,f){for(var Y=k;Y<p;Y++){for(var H=0;H<o;H++)x.set(H,Y,0);x.set(Y,Y,1)}for(var K=k-1;K>=0;K--)if(0!==w[K]){for(var J=K+1;J<p;J++){for(var Q=0,X=K;X<o;X++)Q+=x.get(X,K)*x.get(X,J);Q=-Q/x.get(K,K);for(var tt=K;tt<o;tt++)x.set(tt,J,x.get(tt,J)+Q*x.get(tt,K))}for(var et=K;et<o;et++)x.set(et,K,-x.get(et,K));x.set(K,K,1+x.get(K,K));for(var rt=0;rt<K-1;rt++)x.set(rt,K,0)}else{for(var nt=0;nt<o;nt++)x.set(nt,K,0);x.set(K,K,1)}}if(l)for(var ot=i-1;ot>=0;ot--){if(ot<A&&0!==E[ot])for(var it=ot+1;it<i;it++){for(var at=0,st=ot+1;st<i;st++)at+=b.get(st,ot)*b.get(st,it);at=-at/b.get(ot+1,ot);for(var ut=ot+1;ut<i;ut++)b.set(ut,it,b.get(ut,it)+at*b.get(ut,ot))}for(var ct=0;ct<i;ct++)b.set(ct,ot,0);b.set(ot,ot,1)}for(var ht=$-1,dt=Number.EPSILON;$>0;){var ft=void 0,lt=void 0;for(ft=$-2;ft>=-1&&-1!==ft;ft--){var gt=Number.MIN_VALUE+dt*Math.abs(w[ft]+Math.abs(w[ft+1]));if(Math.abs(E[ft])<=gt||Number.isNaN(E[ft])){E[ft]=0;break}}if(ft===$-2)lt=4;else{var pt=void 0;for(pt=$-1;pt>=ft&&pt!==ft;pt--){var mt=(pt!==$?Math.abs(E[pt]):0)+(pt!==ft+1?Math.abs(E[pt-1]):0);if(Math.abs(w[pt])<=dt*mt){w[pt]=0;break}}pt===ft?lt=3:pt===$-1?lt=1:(lt=2,ft=pt)}switch(ft++,lt){case 1:var wt=E[$-2];E[$-2]=0;for(var xt=$-2;xt>=ft;xt--){var bt=yt(w[xt],wt),Et=w[xt]/bt,Nt=wt/bt;if(w[xt]=bt,xt!==ft&&(wt=-Nt*E[xt-1],E[xt-1]=Et*E[xt-1]),l)for(var Mt=0;Mt<i;Mt++)bt=Et*b.get(Mt,xt)+Nt*b.get(Mt,$-1),b.set(Mt,$-1,-Nt*b.get(Mt,xt)+Et*b.get(Mt,$-1)),b.set(Mt,xt,bt)}break;case 2:var _t=E[ft-1];E[ft-1]=0;for(var kt=ft;kt<$;kt++){var At=yt(w[kt],_t),jt=w[kt]/At,Ot=_t/At;if(w[kt]=At,_t=-Ot*E[kt],E[kt]=jt*E[kt],f)for(var St=0;St<o;St++)At=jt*x.get(St,kt)+Ot*x.get(St,ft-1),x.set(St,ft-1,-Ot*x.get(St,kt)+jt*x.get(St,ft-1)),x.set(St,kt,At)}break;case 3:var zt=Math.max(Math.abs(w[$-1]),Math.abs(w[$-2]),Math.abs(E[$-2]),Math.abs(w[ft]),Math.abs(E[ft])),Rt=w[$-1]/zt,It=w[$-2]/zt,Pt=E[$-2]/zt,Tt=w[ft]/zt,Ct=E[ft]/zt,Dt=((It+Rt)*(It-Rt)+Pt*Pt)/2,Lt=Rt*Pt*(Rt*Pt),Ft=0;0===Dt&&0===Lt||(Ft=Lt/(Dt+(Ft=Dt<0?0-Math.sqrt(Dt*Dt+Lt):Math.sqrt(Dt*Dt+Lt))));for(var qt=(Tt+Rt)*(Tt-Rt)+Ft,Vt=Tt*Ct,Bt=ft;Bt<$-1;Bt++){var Gt=yt(qt,Vt);0===Gt&&(Gt=Number.MIN_VALUE);var Ut=qt/Gt,Wt=Vt/Gt;if(Bt!==ft&&(E[Bt-1]=Gt),qt=Ut*w[Bt]+Wt*E[Bt],E[Bt]=Ut*E[Bt]-Wt*w[Bt],Vt=Wt*w[Bt+1],w[Bt+1]=Ut*w[Bt+1],l)for(var $t=0;$t<i;$t++)Gt=Ut*b.get($t,Bt)+Wt*b.get($t,Bt+1),b.set($t,Bt+1,-Wt*b.get($t,Bt)+Ut*b.get($t,Bt+1)),b.set($t,Bt,Gt);if(0===(Gt=yt(qt,Vt))&&(Gt=Number.MIN_VALUE),Ut=qt/Gt,Wt=Vt/Gt,w[Bt]=Gt,qt=Ut*E[Bt]+Wt*w[Bt+1],w[Bt+1]=-Wt*E[Bt]+Ut*w[Bt+1],Vt=Wt*E[Bt+1],E[Bt+1]=Ut*E[Bt+1],f&&Bt<o-1)for(var Yt=0;Yt<o;Yt++)Gt=Ut*x.get(Yt,Bt)+Wt*x.get(Yt,Bt+1),x.set(Yt,Bt+1,-Wt*x.get(Yt,Bt)+Ut*x.get(Yt,Bt+1)),x.set(Yt,Bt,Gt)}E[$-2]=qt;break;case 4:if(w[ft]<=0&&(w[ft]=w[ft]<0?-w[ft]:0,l))for(var Ht=0;Ht<=ht;Ht++)b.set(Ht,ft,-b.get(Ht,ft));for(;ft<ht&&!(w[ft]>=w[ft+1]);){var Kt=w[ft];if(w[ft]=w[ft+1],w[ft+1]=Kt,l&&ft<i-1)for(var Jt=0;Jt<i;Jt++)Kt=b.get(Jt,ft+1),b.set(Jt,ft+1,b.get(Jt,ft)),b.set(Jt,ft,Kt);if(f&&ft<o-1)for(var Qt=0;Qt<o;Qt++)Kt=x.get(Qt,ft+1),x.set(Qt,ft+1,x.get(Qt,ft)),x.set(Qt,ft,Kt);ft++}$--}}if(g){var Xt=b;b=x,x=Xt}this.m=o,this.n=i,this.s=w,this.U=x,this.V=b}return w(t,[{key:"solve",value:function(t){for(var e=t,r=this.threshold,n=this.s.length,o=Z.zeros(n,n),i=0;i<n;i++)Math.abs(this.s[i])<=r?o.set(i,i,0):o.set(i,i,1/this.s[i]);for(var a=this.U,s=this.rightSingularVectors,u=s.mmul(o),c=s.rows,h=a.rows,d=Z.zeros(c,h),f=0;f<c;f++)for(var l=0;l<h;l++){for(var g=0,v=0;v<n;v++)g+=u.get(f,v)*a.get(l,v);d.set(f,l,g)}return d.mmul(e)}},{key:"solveForDiagonal",value:function(t){return this.solve(Z.diag(t))}},{key:"inverse",value:function(){for(var t=this.V,e=this.threshold,r=t.rows,n=t.columns,o=new Z(r,this.s.length),i=0;i<r;i++)for(var a=0;a<n;a++)Math.abs(this.s[a])>e&&o.set(i,a,t.get(i,a)/this.s[a]);for(var s=this.U,u=s.rows,c=s.columns,h=new Z(r,u),d=0;d<r;d++)for(var f=0;f<u;f++){for(var l=0,g=0;g<c;g++)l+=o.get(d,g)*s.get(f,g);h.set(d,f,l)}return h}},{key:"condition",get:function(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}},{key:"norm2",get:function(){return this.s[0]}},{key:"rank",get:function(){for(var t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s,n=0,o=r.length;n<o;n++)r[n]>t&&e++;return e}},{key:"diagonal",get:function(){return Array.from(this.s)}},{key:"threshold",get:function(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}},{key:"leftSingularVectors",get:function(){return this.U}},{key:"rightSingularVectors",get:function(){return this.V}},{key:"diagonalMatrix",get:function(){return Z.diag(this.s)}}]),t}();function xt(t,e){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return t=vt.checkMatrix(t),e=vt.checkMatrix(e),r?new wt(t).solve(e):t.isSquare()?new pt(t).solve(e):new mt(t).solve(e)}function bt(t,e){for(var r=[],n=0;n<t;n++)n!==e&&r.push(n);return r}function Et(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e-9,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1e-9;if(t>o)return new Array(e.rows+1).fill(0);for(var i=e.addRow(r,[0]),a=0;a<i.rows;a++)Math.abs(i.get(a,0))<n&&i.set(a,0,0);return i.to1DArray()}var Nt=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};m(this,t);var n=r.assumeSymmetric,o=void 0!==n&&n;if(!(e=vt.checkMatrix(e)).isSquare())throw new Error("Matrix is not a square matrix");if(e.isEmpty())throw new Error("Matrix must be non-empty");var i,a,s=e.columns,u=new Z(s,s),c=new Float64Array(s),h=new Float64Array(s),d=e;if(!!o||e.isSymmetric()){for(i=0;i<s;i++)for(a=0;a<s;a++)u.set(i,a,d.get(i,a));Mt(s,h,c,u),_t(s,h,c,u)}else{var f=new Z(s,s),l=new Float64Array(s);for(a=0;a<s;a++)for(i=0;i<s;i++)f.set(i,a,d.get(i,a));kt(s,f,l,u),At(s,h,c,u,f)}this.n=s,this.e=h,this.d=c,this.V=u}return w(t,[{key:"realEigenvalues",get:function(){return Array.from(this.d)}},{key:"imaginaryEigenvalues",get:function(){return Array.from(this.e)}},{key:"eigenvectorMatrix",get:function(){return this.V}},{key:"diagonalMatrix",get:function(){var t,e,r=this.n,n=this.e,o=this.d,i=new Z(r,r);for(t=0;t<r;t++){for(e=0;e<r;e++)i.set(t,e,0);i.set(t,t,o[t]),n[t]>0?i.set(t,t+1,n[t]):n[t]<0&&i.set(t,t-1,n[t])}return i}}]),t}();function Mt(t,e,r,n){var o,i,a,s,u,c,h,d;for(u=0;u<t;u++)r[u]=n.get(t-1,u);for(s=t-1;s>0;s--){for(d=0,a=0,c=0;c<s;c++)d+=Math.abs(r[c]);if(0===d)for(e[s]=r[s-1],u=0;u<s;u++)r[u]=n.get(s-1,u),n.set(s,u,0),n.set(u,s,0);else{for(c=0;c<s;c++)r[c]/=d,a+=r[c]*r[c];for(o=r[s-1],i=Math.sqrt(a),o>0&&(i=-i),e[s]=d*i,a-=o*i,r[s-1]=o-i,u=0;u<s;u++)e[u]=0;for(u=0;u<s;u++){for(o=r[u],n.set(u,s,o),i=e[u]+n.get(u,u)*o,c=u+1;c<=s-1;c++)i+=n.get(c,u)*r[c],e[c]+=n.get(c,u)*o;e[u]=i}for(o=0,u=0;u<s;u++)e[u]/=a,o+=e[u]*r[u];for(h=o/(a+a),u=0;u<s;u++)e[u]-=h*r[u];for(u=0;u<s;u++){for(o=r[u],i=e[u],c=u;c<=s-1;c++)n.set(c,u,n.get(c,u)-(o*e[c]+i*r[c]));r[u]=n.get(s-1,u),n.set(s,u,0)}}r[s]=a}for(s=0;s<t-1;s++){if(n.set(t-1,s,n.get(s,s)),n.set(s,s,1),0!==(a=r[s+1])){for(c=0;c<=s;c++)r[c]=n.get(c,s+1)/a;for(u=0;u<=s;u++){for(i=0,c=0;c<=s;c++)i+=n.get(c,s+1)*n.get(c,u);for(c=0;c<=s;c++)n.set(c,u,n.get(c,u)-i*r[c])}}for(c=0;c<=s;c++)n.set(c,s+1,0)}for(u=0;u<t;u++)r[u]=n.get(t-1,u),n.set(t-1,u,0);n.set(t-1,t-1,1),e[0]=0}function _t(t,e,r,n){var o,i,a,s,u,c,h,d,f,l,g,v,p,y,m,w;for(a=1;a<t;a++)e[a-1]=e[a];e[t-1]=0;var x=0,b=0,E=Number.EPSILON;for(c=0;c<t;c++){for(b=Math.max(b,Math.abs(r[c])+Math.abs(e[c])),h=c;h<t&&!(Math.abs(e[h])<=E*b);)h++;if(h>c)do{for(o=r[c],f=yt(d=(r[c+1]-o)/(2*e[c]),1),d<0&&(f=-f),r[c]=e[c]/(d+f),r[c+1]=e[c]*(d+f),l=r[c+1],i=o-r[c],a=c+2;a<t;a++)r[a]-=i;for(x+=i,d=r[h],v=g=1,p=g,y=e[c+1],m=0,w=0,a=h-1;a>=c;a--)for(p=v,v=g,w=m,o=g*e[a],i=g*d,f=yt(d,e[a]),e[a+1]=m*f,m=e[a]/f,d=(g=d/f)*r[a]-m*o,r[a+1]=i+m*(g*o+m*r[a]),u=0;u<t;u++)i=n.get(u,a+1),n.set(u,a+1,m*n.get(u,a)+g*i),n.set(u,a,g*n.get(u,a)-m*i);d=-m*w*p*y*e[c]/l,e[c]=m*d,r[c]=g*d}while(Math.abs(e[c])>E*b);r[c]=r[c]+x,e[c]=0}for(a=0;a<t-1;a++){for(u=a,d=r[a],s=a+1;s<t;s++)r[s]<d&&(u=s,d=r[s]);if(u!==a)for(r[u]=r[a],r[a]=d,s=0;s<t;s++)d=n.get(s,a),n.set(s,a,n.get(s,u)),n.set(s,u,d)}}function kt(t,e,r,n){var o,i,a,s,u,c,h,d=t-1;for(c=1;c<=d-1;c++){for(h=0,s=c;s<=d;s++)h+=Math.abs(e.get(s,c-1));if(0!==h){for(a=0,s=d;s>=c;s--)r[s]=e.get(s,c-1)/h,a+=r[s]*r[s];for(i=Math.sqrt(a),r[c]>0&&(i=-i),a-=r[c]*i,r[c]=r[c]-i,u=c;u<t;u++){for(o=0,s=d;s>=c;s--)o+=r[s]*e.get(s,u);for(o/=a,s=c;s<=d;s++)e.set(s,u,e.get(s,u)-o*r[s])}for(s=0;s<=d;s++){for(o=0,u=d;u>=c;u--)o+=r[u]*e.get(s,u);for(o/=a,u=c;u<=d;u++)e.set(s,u,e.get(s,u)-o*r[u])}r[c]=h*r[c],e.set(c,c-1,h*i)}}for(s=0;s<t;s++)for(u=0;u<t;u++)n.set(s,u,s===u?1:0);for(c=d-1;c>=1;c--)if(0!==e.get(c,c-1)){for(s=c+1;s<=d;s++)r[s]=e.get(s,c-1);for(u=c;u<=d;u++){for(i=0,s=c;s<=d;s++)i+=r[s]*n.get(s,u);for(i=i/r[c]/e.get(c,c-1),s=c;s<=d;s++)n.set(s,u,n.get(s,u)+i*r[s])}}}function At(t,e,r,n,o){var i,a,s,u,c,h,d,f,l,g,v,p,y,m,w,x=t-1,b=t-1,E=Number.EPSILON,N=0,M=0,_=0,k=0,A=0,j=0,O=0,S=0;for(i=0;i<t;i++)for((i<0||i>b)&&(r[i]=o.get(i,i),e[i]=0),a=Math.max(i-1,0);a<t;a++)M+=Math.abs(o.get(i,a));for(;x>=0;){for(u=x;u>0&&(0===(j=Math.abs(o.get(u-1,u-1))+Math.abs(o.get(u,u)))&&(j=M),!(Math.abs(o.get(u,u-1))<E*j));)u--;if(u===x)o.set(x,x,o.get(x,x)+N),r[x]=o.get(x,x),e[x]=0,x--,S=0;else if(u===x-1){if(d=o.get(x,x-1)*o.get(x-1,x),k=(_=(o.get(x-1,x-1)-o.get(x,x))/2)*_+d,O=Math.sqrt(Math.abs(k)),o.set(x,x,o.get(x,x)+N),o.set(x-1,x-1,o.get(x-1,x-1)+N),f=o.get(x,x),k>=0){for(O=_>=0?_+O:_-O,r[x-1]=f+O,r[x]=r[x-1],0!==O&&(r[x]=f-d/O),e[x-1]=0,e[x]=0,_=(f=o.get(x,x-1))/(j=Math.abs(f)+Math.abs(O)),k=O/j,_/=A=Math.sqrt(_*_+k*k),k/=A,a=x-1;a<t;a++)O=o.get(x-1,a),o.set(x-1,a,k*O+_*o.get(x,a)),o.set(x,a,k*o.get(x,a)-_*O);for(i=0;i<=x;i++)O=o.get(i,x-1),o.set(i,x-1,k*O+_*o.get(i,x)),o.set(i,x,k*o.get(i,x)-_*O);for(i=0;i<=b;i++)O=n.get(i,x-1),n.set(i,x-1,k*O+_*n.get(i,x)),n.set(i,x,k*n.get(i,x)-_*O)}else r[x-1]=f+_,r[x]=f+_,e[x-1]=O,e[x]=-O;x-=2,S=0}else{if(f=o.get(x,x),l=0,d=0,u<x&&(l=o.get(x-1,x-1),d=o.get(x,x-1)*o.get(x-1,x)),10===S){for(N+=f,i=0;i<=x;i++)o.set(i,i,o.get(i,i)-f);f=l=.75*(j=Math.abs(o.get(x,x-1))+Math.abs(o.get(x-1,x-2))),d=-.4375*j*j}if(30===S&&(j=(j=(l-f)/2)*j+d)>0){for(j=Math.sqrt(j),l<f&&(j=-j),j=f-d/((l-f)/2+j),i=0;i<=x;i++)o.set(i,i,o.get(i,i)-j);N+=j,f=l=d=.964}for(S+=1,c=x-2;c>=u&&(_=((A=f-(O=o.get(c,c)))*(j=l-O)-d)/o.get(c+1,c)+o.get(c,c+1),k=o.get(c+1,c+1)-O-A-j,A=o.get(c+2,c+1),_/=j=Math.abs(_)+Math.abs(k)+Math.abs(A),k/=j,A/=j,c!==u)&&!(Math.abs(o.get(c,c-1))*(Math.abs(k)+Math.abs(A))<E*(Math.abs(_)*(Math.abs(o.get(c-1,c-1))+Math.abs(O)+Math.abs(o.get(c+1,c+1)))));)c--;for(i=c+2;i<=x;i++)o.set(i,i-2,0),i>c+2&&o.set(i,i-3,0);for(s=c;s<=x-1&&(m=s!==x-1,s!==c&&(_=o.get(s,s-1),k=o.get(s+1,s-1),A=m?o.get(s+2,s-1):0,0!==(f=Math.abs(_)+Math.abs(k)+Math.abs(A))&&(_/=f,k/=f,A/=f)),0!==f);s++)if(j=Math.sqrt(_*_+k*k+A*A),_<0&&(j=-j),0!==j){for(s!==c?o.set(s,s-1,-j*f):u!==c&&o.set(s,s-1,-o.get(s,s-1)),f=(_+=j)/j,l=k/j,O=A/j,k/=_,A/=_,a=s;a<t;a++)_=o.get(s,a)+k*o.get(s+1,a),m&&(_+=A*o.get(s+2,a),o.set(s+2,a,o.get(s+2,a)-_*O)),o.set(s,a,o.get(s,a)-_*f),o.set(s+1,a,o.get(s+1,a)-_*l);for(i=0;i<=Math.min(x,s+3);i++)_=f*o.get(i,s)+l*o.get(i,s+1),m&&(_+=O*o.get(i,s+2),o.set(i,s+2,o.get(i,s+2)-_*A)),o.set(i,s,o.get(i,s)-_),o.set(i,s+1,o.get(i,s+1)-_*k);for(i=0;i<=b;i++)_=f*n.get(i,s)+l*n.get(i,s+1),m&&(_+=O*n.get(i,s+2),n.set(i,s+2,n.get(i,s+2)-_*A)),n.set(i,s,n.get(i,s)-_),n.set(i,s+1,n.get(i,s+1)-_*k)}}}if(0!==M){for(x=t-1;x>=0;x--)if(_=r[x],0===(k=e[x]))for(u=x,o.set(x,x,1),i=x-1;i>=0;i--){for(d=o.get(i,i)-_,A=0,a=u;a<=x;a++)A+=o.get(i,a)*o.get(a,x);if(e[i]<0)O=d,j=A;else if(u=i,0===e[i]?o.set(i,x,0!==d?-A/d:-A/(E*M)):(f=o.get(i,i+1),l=o.get(i+1,i),h=(f*j-O*A)/(k=(r[i]-_)*(r[i]-_)+e[i]*e[i]),o.set(i,x,h),o.set(i+1,x,Math.abs(f)>Math.abs(O)?(-A-d*h)/f:(-j-l*h)/O)),E*(h=Math.abs(o.get(i,x)))*h>1)for(a=i;a<=x;a++)o.set(a,x,o.get(a,x)/h)}else if(k<0)for(u=x-1,Math.abs(o.get(x,x-1))>Math.abs(o.get(x-1,x))?(o.set(x-1,x-1,k/o.get(x,x-1)),o.set(x-1,x,-(o.get(x,x)-_)/o.get(x,x-1))):(w=jt(0,-o.get(x-1,x),o.get(x-1,x-1)-_,k),o.set(x-1,x-1,w[0]),o.set(x-1,x,w[1])),o.set(x,x-1,0),o.set(x,x,1),i=x-2;i>=0;i--){for(g=0,v=0,a=u;a<=x;a++)g+=o.get(i,a)*o.get(a,x-1),v+=o.get(i,a)*o.get(a,x);if(d=o.get(i,i)-_,e[i]<0)O=d,A=g,j=v;else if(u=i,0===e[i]?(w=jt(-g,-v,d,k),o.set(i,x-1,w[0]),o.set(i,x,w[1])):(f=o.get(i,i+1),l=o.get(i+1,i),p=(r[i]-_)*(r[i]-_)+e[i]*e[i]-k*k,y=2*(r[i]-_)*k,0===p&&0===y&&(p=E*M*(Math.abs(d)+Math.abs(k)+Math.abs(f)+Math.abs(l)+Math.abs(O))),w=jt(f*A-O*g+k*v,f*j-O*v-k*g,p,y),o.set(i,x-1,w[0]),o.set(i,x,w[1]),Math.abs(f)>Math.abs(O)+Math.abs(k)?(o.set(i+1,x-1,(-g-d*o.get(i,x-1)+k*o.get(i,x))/f),o.set(i+1,x,(-v-d*o.get(i,x)-k*o.get(i,x-1))/f)):(w=jt(-A-l*o.get(i,x-1),-j-l*o.get(i,x),O,k),o.set(i+1,x-1,w[0]),o.set(i+1,x,w[1]))),E*(h=Math.max(Math.abs(o.get(i,x-1)),Math.abs(o.get(i,x))))*h>1)for(a=i;a<=x;a++)o.set(a,x-1,o.get(a,x-1)/h),o.set(a,x,o.get(a,x)/h)}for(i=0;i<t;i++)if(i<0||i>b)for(a=i;a<t;a++)n.set(i,a,o.get(i,a));for(a=t-1;a>=0;a--)for(i=0;i<=b;i++){for(O=0,s=0;s<=Math.min(a,b);s++)O+=n.get(i,s)*o.get(s,a);n.set(i,a,O)}}}function jt(t,e,r,n){var o,i;return Math.abs(r)>Math.abs(n)?[(t+(o=n/r)*e)/(i=r+o*n),(e-o*t)/i]:[((o=r/n)*t+e)/(i=n+o*r),(o*e-t)/i]}var Ot=function(){function t(e){if(m(this,t),!(e=vt.checkMatrix(e)).isSymmetric())throw new Error("Matrix is not symmetric");var r,n,o,i=e,a=i.rows,s=new Z(a,a),u=!0;for(n=0;n<a;n++){var c=0;for(o=0;o<n;o++){var h=0;for(r=0;r<o;r++)h+=s.get(o,r)*s.get(n,r);h=(i.get(n,o)-h)/s.get(o,o),s.set(n,o,h),c+=h*h}for(c=i.get(n,n)-c,u&&(u=c>0),s.set(n,n,Math.sqrt(Math.max(c,0))),o=n+1;o<a;o++)s.set(n,o,0)}this.L=s,this.positiveDefinite=u}return w(t,[{key:"isPositiveDefinite",value:function(){return this.positiveDefinite}},{key:"solve",value:function(t){t=vt.checkMatrix(t);var e=this.L,r=e.rows;if(t.rows!==r)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");var n,o,i,a=t.columns,s=t.clone();for(i=0;i<r;i++)for(o=0;o<a;o++){for(n=0;n<i;n++)s.set(i,o,s.get(i,o)-s.get(n,o)*e.get(i,n));s.set(i,o,s.get(i,o)/e.get(i,i))}for(i=r-1;i>=0;i--)for(o=0;o<a;o++){for(n=i+1;n<r;n++)s.set(i,o,s.get(i,o)-s.get(n,o)*e.get(n,i));s.set(i,o,s.get(i,o)/e.get(i,i))}return s}},{key:"lowerTriangularMatrix",get:function(){return this.L}}]),t}(),St=w((function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};m(this,t),e=vt.checkMatrix(e);var n,o=r.Y,i=r.scaleScores,a=void 0!==i&&i,s=r.maxIterations,u=void 0===s?1e3:s,c=r.terminationCriteria,h=void 0===c?1e-10:c;if(o){if((o=x.isAnyArray(o)&&"number"==typeof o[0]?Z.columnVector(o):vt.checkMatrix(o)).rows!==e.rows)throw new Error("Y should have the same number of rows as X");n=o.getColumnVector(0)}else n=e.getColumnVector(0);for(var d,f,l,g,v=1,p=0;p<u&&v>h;p++)l=(l=e.transpose().mmul(n).div(n.transpose().mmul(n).get(0,0))).div(l.norm()),d=e.mmul(l).div(l.transpose().mmul(l).get(0,0)),p>0&&(v=d.clone().sub(g).pow(2).sum()),g=d.clone(),o?(f=(f=o.transpose().mmul(d).div(d.transpose().mmul(d).get(0,0))).div(f.norm()),n=o.mmul(f).div(f.transpose().mmul(f).get(0,0))):n=d;if(o){var y=e.transpose().mmul(d).div(d.transpose().mmul(d).get(0,0));y=y.div(y.norm());var w=e.clone().sub(d.clone().mmul(y.transpose())),b=n.transpose().mmul(d).div(d.transpose().mmul(d).get(0,0)),E=o.clone().sub(d.clone().mulS(b.get(0,0)).mmul(f.transpose()));this.t=d,this.p=y.transpose(),this.w=l.transpose(),this.q=f,this.u=n,this.s=d.transpose().mmul(d),this.xResidual=w,this.yResidual=E,this.betas=b}else this.w=l.transpose(),this.s=d.transpose().mmul(d).sqrt(),this.t=a?d.clone().div(this.s.get(0,0)):d,this.xResidual=e.sub(d.mmul(l.transpose()))}));e.XA=J,e.a_=Ot,e.yQ=Ot,e.Hs=nt,e.Ec=Nt,e.dx=Nt,e.LU=pt,e.Rm=pt,e.y3=Z,e.qK=at,e.pb=it,e.j=st,e.sO=ut,e.BZ=ht,e.EK=ct,e.Db=dt,e.Fx=ft,e.tU=lt,e.Ym=St,e.rs=St,e.QR=mt,e.TB=mt,e.oH=wt,e.Sc=wt,e.BN=rt,e.it=gt,e.$r=vt,e.QM=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=new Z(t);var n=!1;if("object"!==y(e)||Z.isMatrix(e)||x.isAnyArray(e)?e=new Z(e):(r=e,e=t,n=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");var o=r,i=o.center,a=void 0===i||i,s=o.scale,u=void 0===s||s;a&&(t.center("column"),n||e.center("column")),u&&(t.scale("column"),n||e.scale("column"));for(var c=t.standardDeviation("column",{unbiased:!0}),h=n?c:e.standardDeviation("column",{unbiased:!0}),d=t.transpose().mmul(e),f=0;f<d.rows;f++)for(var l=0;l<d.columns;l++)d.set(f,l,d.get(f,l)*(1/(c[f]*h[l]))*(1/(t.rows-1)));return d},e.AV=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};t=new Z(t);var n=!1;if("object"!==y(e)||Z.isMatrix(e)||x.isAnyArray(e)?e=new Z(e):(r=e,e=t,n=!0),t.rows!==e.rows)throw new TypeError("Both matrices must have the same number of rows");var o=r,i=o.center,a=void 0===i||i;a&&(t=t.center("column"),n||(e=e.center("column")));for(var s=t.transpose().mmul(e),u=0;u<s.rows;u++)for(var c=0;c<s.columns;c++)s.set(u,c,s.get(u,c)*(1/(t.rows-1)));return s},e.GH=function t(e){var r,n,o,i,a,s;if((e=Z.checkMatrix(e)).isSquare())return 0===e.columns?1:2===e.columns?(r=e.get(0,0),n=e.get(0,1),o=e.get(1,0),r*e.get(1,1)-n*o):3===e.columns?(i=new dt(e,[1,2],[1,2]),a=new dt(e,[1,2],[0,2]),s=new dt(e,[1,2],[0,1]),r=e.get(0,0),n=e.get(0,1),o=e.get(0,2),r*t(i)-n*t(a)+o*t(s)):new pt(e).determinant;throw Error("determinant can only be calculated for a square matrix")},e.SO=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return t=vt.checkMatrix(t),e?new wt(t).inverse():xt(t,Z.eye(t.rows))},e.uZ=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.thresholdValue,n=void 0===r?1e-9:r,o=e.thresholdError,i=void 0===o?1e-9:o,a=(t=Z.checkMatrix(t)).rows,s=new Z(a,a),u=0;u<a;u++){var c=Z.columnVector(t.getRow(u)),h=t.subMatrixRow(bt(a,u)).transpose(),d=new wt(h),f=d.solve(c),l=Z.sub(c,h.mmul(f)).abs().max();s.setRow(u,Et(l,f,u,n,i))}return s},e.yU=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.EPSILON;if((t=Z.checkMatrix(t)).isEmpty())return t.transpose();for(var r=new wt(t,{autoTranspose:!0}),n=r.leftSingularVectors,o=r.rightSingularVectors,i=r.diagonal,a=0;a<i.length;a++)Math.abs(i[a])>e?i[a]=1/i[a]:i[a]=0;return o.mmul(Z.diag(i).mmul(n.transpose()))},e.F1=xt,e.re=function(t,e){if(x.isAnyArray(t))return t[0]&&x.isAnyArray(t[0])?new vt(t):new gt(t,e);throw new Error("the argument is not an array")}},92546:function(t,e,r){t.exports={graphlib:r(76626),layout:r(47194),debug:r(11303),util:{time:r(53063).time,notime:r(53063).notime},version:r(11897)}},81255:function(t,e,r){"use strict";var n=r(72361),o=r(39240);t.exports={run:function(t){var e="greedy"===t.graph().acyclicer?o(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],r={},o={};function i(a){n.has(o,a)||(o[a]=!0,r[a]=!0,n.forEach(t.outEdges(a),(function(t){n.has(r,t.w)?e.push(t):i(t.w)})),delete r[a])}return n.forEach(t.nodes(),i),e}(t);n.forEach(e,(function(e){var r=t.edge(e);t.removeEdge(e),r.forwardName=e.name,r.reversed=!0,t.setEdge(e.w,e.v,r,n.uniqueId("rev"))}))},undo:function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.reversed){t.removeEdge(e);var n=r.forwardName;delete r.reversed,delete r.forwardName,t.setEdge(e.w,e.v,r,n)}}))}}},60765:function(t,e,r){var n=r(72361),o=r(53063);function i(t,e,r,n,i,a){var s={width:0,height:0,rank:a,borderType:e},u=i[e][a-1],c=o.addDummyNode(t,"border",s,r);i[e][a]=c,t.setParent(c,n),u&&t.setEdge(u,c,{weight:1})}t.exports=function(t){n.forEach(t.children(),(function e(r){var o=t.children(r),a=t.node(r);if(o.length&&n.forEach(o,e),n.has(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var s=a.minRank,u=a.maxRank+1;s<u;++s)i(t,"borderLeft","_bl",r,a,s),i(t,"borderRight","_br",r,a,s)}}))}},13257:function(t,e,r){"use strict";var n=r(72361);function o(t){n.forEach(t.nodes(),(function(e){i(t.node(e))})),n.forEach(t.edges(),(function(e){i(t.edge(e))}))}function i(t){var e=t.width;t.width=t.height,t.height=e}function a(t){t.y=-t.y}function s(t){var e=t.x;t.x=t.y,t.y=e}t.exports={adjust:function(t){var e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||o(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){n.forEach(t.nodes(),(function(e){a(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,a),n.has(r,"y")&&a(r)}))}(t);"lr"!==e&&"rl"!==e||(!function(t){n.forEach(t.nodes(),(function(e){s(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.forEach(r.points,s),n.has(r,"x")&&s(r)}))}(t),o(t))}}},21135:function(t){function e(){var t={};t._next=t._prev=t,this._sentinel=t}function r(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function n(t,e){if("_next"!==t&&"_prev"!==t)return e}t.exports=e,e.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return r(e),e},e.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&r(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},e.prototype.toString=function(){for(var t=[],e=this._sentinel,r=e._prev;r!==e;)t.push(JSON.stringify(r,n)),r=r._prev;return"["+t.join(", ")+"]"}},11303:function(t,e,r){var n=r(72361),o=r(53063),i=r(76626).Graph;t.exports={debugOrdering:function(t){var e=o.buildLayerMatrix(t),r=new i({compound:!0,multigraph:!0}).setGraph({});return n.forEach(t.nodes(),(function(e){r.setNode(e,{label:e}),r.setParent(e,"layer"+t.node(e).rank)})),n.forEach(t.edges(),(function(t){r.setEdge(t.v,t.w,{},t.name)})),n.forEach(e,(function(t,e){var o="layer"+e;r.setNode(o,{rank:"same"}),n.reduce(t,(function(t,e){return r.setEdge(t,e,{style:"invis"}),e}))})),r}}},76626:function(t,e,r){var n;try{n=r(75172)}catch(t){}n||(n=window.graphlib),t.exports=n},39240:function(t,e,r){var n=r(72361),o=r(76626).Graph,i=r(21135);t.exports=function(t,e){if(t.nodeCount()<=1)return[];var r=function(t,e){var r=new o,a=0,s=0;n.forEach(t.nodes(),(function(t){r.setNode(t,{v:t,in:0,out:0})})),n.forEach(t.edges(),(function(t){var n=r.edge(t.v,t.w)||0,o=e(t),i=n+o;r.setEdge(t.v,t.w,i),s=Math.max(s,r.node(t.v).out+=o),a=Math.max(a,r.node(t.w).in+=o)}));var c=n.range(s+a+3).map((function(){return new i})),h=a+1;return n.forEach(r.nodes(),(function(t){u(c,h,r.node(t))})),{graph:r,buckets:c,zeroIdx:h}}(t,e||a),c=function(t,e,r){var n,o=[],i=e[e.length-1],a=e[0];for(;t.nodeCount();){for(;n=a.dequeue();)s(t,e,r,n);for(;n=i.dequeue();)s(t,e,r,n);if(t.nodeCount())for(var u=e.length-2;u>0;--u)if(n=e[u].dequeue()){o=o.concat(s(t,e,r,n,!0));break}}return o}(r.graph,r.buckets,r.zeroIdx);return n.flatten(n.map(c,(function(e){return t.outEdges(e.v,e.w)})),!0)};var a=n.constant(1);function s(t,e,r,o,i){var a=i?[]:void 0;return n.forEach(t.inEdges(o.v),(function(n){var o=t.edge(n),s=t.node(n.v);i&&a.push({v:n.v,w:n.w}),s.out-=o,u(e,r,s)})),n.forEach(t.outEdges(o.v),(function(n){var o=t.edge(n),i=n.w,a=t.node(i);a.in-=o,u(e,r,a)})),t.removeNode(o.v),a}function u(t,e,r){r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)}},47194:function(t,e,r){"use strict";var n=r(72361),o=r(81255),i=r(27163),a=r(64505),s=r(53063).normalizeRanks,u=r(71970),c=r(53063).removeEmptyRanks,h=r(31733),d=r(60765),f=r(13257),l=r(62852),g=r(93021),v=r(53063),p=r(76626).Graph;t.exports=function(t,e){var r=e&&e.debugTiming?v.time:v.notime;r("layout",(function(){var e=r(" buildLayoutGraph",(function(){return function(t){var e=new p({multigraph:!0,compound:!0}),r=k(t.graph());return e.setGraph(n.merge({},m,_(r,y),n.pick(r,w))),n.forEach(t.nodes(),(function(r){var o=k(t.node(r));e.setNode(r,n.defaults(_(o,x),b)),e.setParent(r,t.parent(r))})),n.forEach(t.edges(),(function(r){var o=k(t.edge(r));e.setEdge(r,n.merge({},N,_(o,E),n.pick(o,M)))})),e}(t)}));r(" runLayout",(function(){!function(t,e){e(" makeSpaceForEdgeLabels",(function(){!function(t){var e=t.graph();e.ranksep/=2,n.forEach(t.edges(),(function(r){var n=t.edge(r);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)}))}(t)})),e(" removeSelfEdges",(function(){!function(t){n.forEach(t.edges(),(function(e){if(e.v===e.w){var r=t.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(" acyclic",(function(){o.run(t)})),e(" nestingGraph.run",(function(){h.run(t)})),e(" rank",(function(){a(v.asNonCompoundGraph(t))})),e(" injectEdgeLabelProxies",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(r.width&&r.height){var n=t.node(e.v),o={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e:e};v.addDummyNode(t,"edge-proxy",o,"_ep")}}))}(t)})),e(" removeEmptyRanks",(function(){c(t)})),e(" nestingGraph.cleanup",(function(){h.cleanup(t)})),e(" normalizeRanks",(function(){s(t)})),e(" assignRankMinMax",(function(){!function(t){var e=0;n.forEach(t.nodes(),(function(r){var o=t.node(r);o.borderTop&&(o.minRank=t.node(o.borderTop).rank,o.maxRank=t.node(o.borderBottom).rank,e=n.max(e,o.maxRank))})),t.graph().maxRank=e}(t)})),e(" removeEdgeLabelProxies",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);"edge-proxy"===r.dummy&&(t.edge(r.e).labelRank=r.rank,t.removeNode(e))}))}(t)})),e(" normalize.run",(function(){i.run(t)})),e(" parentDummyChains",(function(){u(t)})),e(" addBorderSegments",(function(){d(t)})),e(" order",(function(){l(t)})),e(" insertSelfEdges",(function(){!function(t){var e=v.buildLayerMatrix(t);n.forEach(e,(function(e){var r=0;n.forEach(e,(function(e,o){var i=t.node(e);i.order=o+r,n.forEach(i.selfEdges,(function(e){v.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:o+ ++r,e:e.e,label:e.label},"_se")})),delete i.selfEdges}))}))}(t)})),e(" adjustCoordinateSystem",(function(){f.adjust(t)})),e(" position",(function(){g(t)})),e(" positionSelfEdges",(function(){!function(t){n.forEach(t.nodes(),(function(e){var r=t.node(e);if("selfedge"===r.dummy){var n=t.node(r.e.v),o=n.x+n.width/2,i=n.y,a=r.x-o,s=n.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:o+2*a/3,y:i-s},{x:o+5*a/6,y:i-s},{x:o+a,y:i},{x:o+5*a/6,y:i+s},{x:o+2*a/3,y:i+s}],r.label.x=r.x,r.label.y=r.y}}))}(t)})),e(" removeBorderNodes",(function(){!function(t){n.forEach(t.nodes(),(function(e){if(t.children(e).length){var r=t.node(e),o=t.node(r.borderTop),i=t.node(r.borderBottom),a=t.node(n.last(r.borderLeft)),s=t.node(n.last(r.borderRight));r.width=Math.abs(s.x-a.x),r.height=Math.abs(i.y-o.y),r.x=a.x+r.width/2,r.y=o.y+r.height/2}})),n.forEach(t.nodes(),(function(e){"border"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(" normalize.undo",(function(){i.undo(t)})),e(" fixupEdgeLabelCoords",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);if(n.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}}))}(t)})),e(" undoCoordinateSystem",(function(){f.undo(t)})),e(" translateGraph",(function(){!function(t){var e=Number.POSITIVE_INFINITY,r=0,o=Number.POSITIVE_INFINITY,i=0,a=t.graph(),s=a.marginx||0,u=a.marginy||0;function c(t){var n=t.x,a=t.y,s=t.width,u=t.height;e=Math.min(e,n-s/2),r=Math.max(r,n+s/2),o=Math.min(o,a-u/2),i=Math.max(i,a+u/2)}n.forEach(t.nodes(),(function(e){c(t.node(e))})),n.forEach(t.edges(),(function(e){var r=t.edge(e);n.has(r,"x")&&c(r)})),e-=s,o-=u,n.forEach(t.nodes(),(function(r){var n=t.node(r);n.x-=e,n.y-=o})),n.forEach(t.edges(),(function(r){var i=t.edge(r);n.forEach(i.points,(function(t){t.x-=e,t.y-=o})),n.has(i,"x")&&(i.x-=e),n.has(i,"y")&&(i.y-=o)})),a.width=r-e+s,a.height=i-o+u}(t)})),e(" assignNodeIntersects",(function(){!function(t){n.forEach(t.edges(),(function(e){var r,n,o=t.edge(e),i=t.node(e.v),a=t.node(e.w);o.points?(r=o.points[0],n=o.points[o.points.length-1]):(o.points=[],r=a,n=i),o.points.unshift(v.intersectRect(i,r)),o.points.push(v.intersectRect(a,n))}))}(t)})),e(" reversePoints",(function(){!function(t){n.forEach(t.edges(),(function(e){var r=t.edge(e);r.reversed&&r.points.reverse()}))}(t)})),e(" acyclic.undo",(function(){o.undo(t)}))}(e,r)})),r(" updateInputGraph",(function(){!function(t,e){n.forEach(t.nodes(),(function(r){var n=t.node(r),o=e.node(r);n&&(n.x=o.x,n.y=o.y,e.children(r).length&&(n.width=o.width,n.height=o.height))})),n.forEach(t.edges(),(function(r){var o=t.edge(r),i=e.edge(r);o.points=i.points,n.has(i,"x")&&(o.x=i.x,o.y=i.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var y=["nodesep","edgesep","ranksep","marginx","marginy"],m={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},w=["acyclicer","ranker","rankdir","align"],x=["width","height"],b={width:0,height:0},E=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},M=["labelpos"];function _(t,e){return n.mapValues(n.pick(t,e),Number)}function k(t){var e={};return n.forEach(t,(function(t,r){e[r.toLowerCase()]=t})),e}},72361:function(t,e,r){var n;try{n={cloneDeep:r(20250),constant:r(13503),defaults:r(28548),each:r(76934),filter:r(64725),find:r(79785),flatten:r(40151),forEach:r(99204),forIn:r(23190),has:r(99946),isUndefined:r(16513),last:r(10611),map:r(9924),mapValues:r(70642),max:r(95987),merge:r(28440),min:r(73376),minBy:r(83296),now:r(5795),pick:r(89409),range:r(60859),reduce:r(16473),sortBy:r(351),uniqueId:r(95708),values:r(81229),zipObject:r(65441)}}catch(t){}n||(n=window._),t.exports=n},31733:function(t,e,r){var n=r(72361),o=r(53063);function i(t,e,r,a,s,u,c){var h=t.children(c);if(h.length){var d=o.addBorderNode(t,"_bt"),f=o.addBorderNode(t,"_bb"),l=t.node(c);t.setParent(d,c),l.borderTop=d,t.setParent(f,c),l.borderBottom=f,n.forEach(h,(function(n){i(t,e,r,a,s,u,n);var o=t.node(n),h=o.borderTop?o.borderTop:n,l=o.borderBottom?o.borderBottom:n,g=o.borderTop?a:2*a,v=h!==l?1:s-u[c]+1;t.setEdge(d,h,{weight:g,minlen:v,nestingEdge:!0}),t.setEdge(l,f,{weight:g,minlen:v,nestingEdge:!0})})),t.parent(c)||t.setEdge(e,d,{weight:0,minlen:s+u[c]})}else c!==e&&t.setEdge(e,c,{weight:0,minlen:r})}t.exports={run:function(t){var e=o.addDummyNode(t,"root",{},"_root"),r=function(t){var e={};function r(o,i){var a=t.children(o);a&&a.length&&n.forEach(a,(function(t){r(t,i+1)})),e[o]=i}return n.forEach(t.children(),(function(t){r(t,1)})),e}(t),a=n.max(n.values(r))-1,s=2*a+1;t.graph().nestingRoot=e,n.forEach(t.edges(),(function(e){t.edge(e).minlen*=s}));var u=function(t){return n.reduce(t.edges(),(function(e,r){return e+t.edge(r).weight}),0)}(t)+1;n.forEach(t.children(),(function(n){i(t,e,s,u,a,r,n)})),t.graph().nodeRankFactor=s},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,n.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},27163:function(t,e,r){"use strict";var n=r(72361),o=r(53063);t.exports={run:function(t){t.graph().dummyChains=[],n.forEach(t.edges(),(function(e){!function(t,e){var r,n,i,a=e.v,s=t.node(a).rank,u=e.w,c=t.node(u).rank,h=e.name,d=t.edge(e),f=d.labelRank;if(c===s+1)return;for(t.removeEdge(e),i=0,++s;s<c;++i,++s)d.points=[],n={width:0,height:0,edgeLabel:d,edgeObj:e,rank:s},r=o.addDummyNode(t,"edge",n,"_d"),s===f&&(n.width=d.width,n.height=d.height,n.dummy="edge-label",n.labelpos=d.labelpos),t.setEdge(a,r,{weight:d.weight},h),0===i&&t.graph().dummyChains.push(r),a=r;t.setEdge(a,u,{weight:d.weight},h)}(t,e)}))},undo:function(t){n.forEach(t.graph().dummyChains,(function(e){var r,n=t.node(e),o=n.edgeLabel;for(t.setEdge(n.edgeObj,o);n.dummy;)r=t.successors(e)[0],t.removeNode(e),o.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),e=r,n=t.node(e)}))}}},52205:function(t,e,r){var n=r(72361);t.exports=function(t,e,r){var o,i={};n.forEach(r,(function(r){for(var n,a,s=t.parent(r);s;){if((n=t.parent(s))?(a=i[n],i[n]=s):(a=o,o=s),a&&a!==s)return void e.setEdge(a,s);s=n}}))}},99506:function(t,e,r){var n=r(72361);t.exports=function(t,e){return n.map(e,(function(e){var r=t.inEdges(e);if(r.length){var o=n.reduce(r,(function(e,r){var n=t.edge(r),o=t.node(r.v);return{sum:e.sum+n.weight*o.order,weight:e.weight+n.weight}}),{sum:0,weight:0});return{v:e,barycenter:o.sum/o.weight,weight:o.weight}}return{v:e}}))}},59105:function(t,e,r){var n=r(72361),o=r(76626).Graph;t.exports=function(t,e,r){var i=function(t){var e;for(;t.hasNode(e=n.uniqueId("_root")););return e}(t),a=new o({compound:!0}).setGraph({root:i}).setDefaultNodeLabel((function(e){return t.node(e)}));return n.forEach(t.nodes(),(function(o){var s=t.node(o),u=t.parent(o);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(a.setNode(o),a.setParent(o,u||i),n.forEach(t[r](o),(function(e){var r=e.v===o?e.w:e.v,i=a.edge(r,o),s=n.isUndefined(i)?0:i.weight;a.setEdge(r,o,{weight:t.edge(e).weight+s})})),n.has(s,"minRank")&&a.setNode(o,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))})),a}},45456:function(t,e,r){"use strict";var n=r(72361);function o(t,e,r){for(var o=n.zipObject(r,n.map(r,(function(t,e){return e}))),i=n.flatten(n.map(e,(function(e){return n.sortBy(n.map(t.outEdges(e),(function(e){return{pos:o[e.w],weight:t.edge(e).weight}})),"pos")})),!0),a=1;a<r.length;)a<<=1;var s=2*a-1;a-=1;var u=n.map(new Array(s),(function(){return 0})),c=0;return n.forEach(i.forEach((function(t){var e=t.pos+a;u[e]+=t.weight;for(var r=0;e>0;)e%2&&(r+=u[e+1]),u[e=e-1>>1]+=t.weight;c+=t.weight*r}))),c}t.exports=function(t,e){for(var r=0,n=1;n<e.length;++n)r+=o(t,e[n-1],e[n]);return r}},62852:function(t,e,r){"use strict";var n=r(72361),o=r(18043),i=r(45456),a=r(86490),s=r(59105),u=r(52205),c=r(76626).Graph,h=r(53063);function d(t,e,r){return n.map(e,(function(e){return s(t,e,r)}))}function f(t,e){var r=new c;n.forEach(t,(function(t){var o=t.graph().root,i=a(t,o,r,e);n.forEach(i.vs,(function(e,r){t.node(e).order=r})),u(t,r,i.vs)}))}function l(t,e){n.forEach(e,(function(e){n.forEach(e,(function(e,r){t.node(e).order=r}))}))}t.exports=function(t){var e=h.maxRank(t),r=d(t,n.range(1,e+1),"inEdges"),a=d(t,n.range(e-1,-1,-1),"outEdges"),s=o(t);l(t,s);for(var u,c=Number.POSITIVE_INFINITY,g=0,v=0;v<4;++g,++v){f(g%2?r:a,g%4>=2),s=h.buildLayerMatrix(t);var p=i(t,s);p<c&&(v=0,u=n.cloneDeep(s),c=p)}l(t,u)}},18043:function(t,e,r){"use strict";var n=r(72361);t.exports=function(t){var e={},r=n.filter(t.nodes(),(function(e){return!t.children(e).length})),o=n.max(n.map(r,(function(e){return t.node(e).rank}))),i=n.map(n.range(o+1),(function(){return[]}));var a=n.sortBy(r,(function(e){return t.node(e).rank}));return n.forEach(a,(function r(o){if(n.has(e,o))return;e[o]=!0;var a=t.node(o);i[a.rank].push(o),n.forEach(t.successors(o),r)})),i}},45926:function(t,e,r){"use strict";var n=r(72361);t.exports=function(t,e){var r={};return n.forEach(t,(function(t,e){var o=r[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};n.isUndefined(t.barycenter)||(o.barycenter=t.barycenter,o.weight=t.weight)})),n.forEach(e.edges(),(function(t){var e=r[t.v],o=r[t.w];n.isUndefined(e)||n.isUndefined(o)||(o.indegree++,e.out.push(r[t.w]))})),function(t){var e=[];function r(t){return function(e){e.merged||(n.isUndefined(e.barycenter)||n.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&function(t,e){var r=0,n=0;t.weight&&(r+=t.barycenter*t.weight,n+=t.weight);e.weight&&(r+=e.barycenter*e.weight,n+=e.weight);t.vs=e.vs.concat(t.vs),t.barycenter=r/n,t.weight=n,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function o(e){return function(r){r.in.push(e),0==--r.indegree&&t.push(r)}}for(;t.length;){var i=t.pop();e.push(i),n.forEach(i.in.reverse(),r(i)),n.forEach(i.out,o(i))}return n.map(n.filter(e,(function(t){return!t.merged})),(function(t){return n.pick(t,["vs","i","barycenter","weight"])}))}(n.filter(r,(function(t){return!t.indegree})))}},86490:function(t,e,r){var n=r(72361),o=r(99506),i=r(45926),a=r(1349);t.exports=function t(e,r,s,u){var c=e.children(r),h=e.node(r),d=h?h.borderLeft:void 0,f=h?h.borderRight:void 0,l={};d&&(c=n.filter(c,(function(t){return t!==d&&t!==f})));var g=o(e,c);n.forEach(g,(function(r){if(e.children(r.v).length){var o=t(e,r.v,s,u);l[r.v]=o,n.has(o,"barycenter")&&(i=r,a=o,n.isUndefined(i.barycenter)?(i.barycenter=a.barycenter,i.weight=a.weight):(i.barycenter=(i.barycenter*i.weight+a.barycenter*a.weight)/(i.weight+a.weight),i.weight+=a.weight))}var i,a}));var v=i(g,s);!function(t,e){n.forEach(t,(function(t){t.vs=n.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(v,l);var p=a(v,u);if(d&&(p.vs=n.flatten([d,p.vs,f],!0),e.predecessors(d).length)){var y=e.node(e.predecessors(d)[0]),m=e.node(e.predecessors(f)[0]);n.has(p,"barycenter")||(p.barycenter=0,p.weight=0),p.barycenter=(p.barycenter*p.weight+y.order+m.order)/(p.weight+2),p.weight+=2}return p}},1349:function(t,e,r){var n=r(72361),o=r(53063);function i(t,e,r){for(var o;e.length&&(o=n.last(e)).i<=r;)e.pop(),t.push(o.vs),r++;return r}t.exports=function(t,e){var r=o.partition(t,(function(t){return n.has(t,"barycenter")})),a=r.lhs,s=n.sortBy(r.rhs,(function(t){return-t.i})),u=[],c=0,h=0,d=0;a.sort((f=!!e,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:f?e.i-t.i:t.i-e.i})),d=i(u,s,d),n.forEach(a,(function(t){d+=t.vs.length,u.push(t.vs),c+=t.barycenter*t.weight,h+=t.weight,d=i(u,s,d)}));var f;var l={vs:n.flatten(u,!0)};h&&(l.barycenter=c/h,l.weight=h);return l}},71970:function(t,e,r){var n=r(72361);t.exports=function(t){var e=function(t){var e={},r=0;function o(i){var a=r;n.forEach(t.children(i),o),e[i]={low:a,lim:r++}}return n.forEach(t.children(),o),e}(t);n.forEach(t.graph().dummyChains,(function(r){for(var n=t.node(r),o=n.edgeObj,i=function(t,e,r,n){var o,i,a=[],s=[],u=Math.min(e[r].low,e[n].low),c=Math.max(e[r].lim,e[n].lim);o=r;do{o=t.parent(o),a.push(o)}while(o&&(e[o].low>u||c>e[o].lim));i=o,o=n;for(;(o=t.parent(o))!==i;)s.push(o);return{path:a.concat(s.reverse()),lca:i}}(t,e,o.v,o.w),a=i.path,s=i.lca,u=0,c=a[u],h=!0;r!==o.w;){if(n=t.node(r),h){for(;(c=a[u])!==s&&t.node(c).maxRank<n.rank;)u++;c===s&&(h=!1)}if(!h){for(;u<a.length-1&&t.node(c=a[u+1]).minRank<=n.rank;)u++;c=a[u]}t.setParent(r,c),r=t.successors(r)[0]}}))}},92080:function(t,e,r){"use strict";var n=r(72361),o=r(76626).Graph,i=r(53063);function a(t,e){var r={};return n.reduce(e,(function(e,o){var i=0,a=0,s=e.length,c=n.last(o);return n.forEach(o,(function(e,h){var d=function(t,e){if(t.node(e).dummy)return n.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),f=d?t.node(d).order:s;(d||e===c)&&(n.forEach(o.slice(a,h+1),(function(e){n.forEach(t.predecessors(e),(function(n){var o=t.node(n),a=o.order;!(a<i||f<a)||o.dummy&&t.node(e).dummy||u(r,n,e)}))})),a=h+1,i=f)})),o})),r}function s(t,e){var r={};function o(e,o,i,a,s){var c;n.forEach(n.range(o,i),(function(o){c=e[o],t.node(c).dummy&&n.forEach(t.predecessors(c),(function(e){var n=t.node(e);n.dummy&&(n.order<a||n.order>s)&&u(r,e,c)}))}))}return n.reduce(e,(function(e,r){var i,a=-1,s=0;return n.forEach(r,(function(n,u){if("border"===t.node(n).dummy){var c=t.predecessors(n);c.length&&(i=t.node(c[0]).order,o(r,s,u,a,i),s=u,a=i)}o(r,s,r.length,i,e.length)})),r})),r}function u(t,e,r){if(e>r){var n=e;e=r,r=n}var o=t[e];o||(t[e]=o={}),o[r]=!0}function c(t,e,r){if(e>r){var o=e;e=r,r=o}return n.has(t[e],r)}function h(t,e,r,o){var i={},a={},s={};return n.forEach(e,(function(t){n.forEach(t,(function(t,e){i[t]=t,a[t]=t,s[t]=e}))})),n.forEach(e,(function(t){var e=-1;n.forEach(t,(function(t){var u=o(t);if(u.length){u=n.sortBy(u,(function(t){return s[t]}));for(var h=(u.length-1)/2,d=Math.floor(h),f=Math.ceil(h);d<=f;++d){var l=u[d];a[t]===t&&e<s[l]&&!c(r,t,l)&&(a[l]=t,a[t]=i[t]=i[l],e=s[l])}}}))})),{root:i,align:a}}function d(t,e,r,i,a){var s={},u=function(t,e,r,i){var a=new o,s=t.graph(),u=function(t,e,r){return function(o,i,a){var s,u=o.node(i),c=o.node(a),h=0;if(h+=u.width/2,n.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":s=-u.width/2;break;case"r":s=u.width/2}if(s&&(h+=r?s:-s),s=0,h+=(u.dummy?e:t)/2,h+=(c.dummy?e:t)/2,h+=c.width/2,n.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":s=c.width/2;break;case"r":s=-c.width/2}return s&&(h+=r?s:-s),s=0,h}}(s.nodesep,s.edgesep,i);return n.forEach(e,(function(e){var o;n.forEach(e,(function(e){var n=r[e];if(a.setNode(n),o){var i=r[o],s=a.edge(i,n);a.setEdge(i,n,Math.max(u(t,e,o),s||0))}o=e}))})),a}(t,e,r,a),c=a?"borderLeft":"borderRight";function h(t,e){for(var r=u.nodes(),n=r.pop(),o={};n;)o[n]?t(n):(o[n]=!0,r.push(n),r=r.concat(e(n))),n=r.pop()}return h((function(t){s[t]=u.inEdges(t).reduce((function(t,e){return Math.max(t,s[e.v]+u.edge(e))}),0)}),u.predecessors.bind(u)),h((function(e){var r=u.outEdges(e).reduce((function(t,e){return Math.min(t,s[e.w]-u.edge(e))}),Number.POSITIVE_INFINITY),n=t.node(e);r!==Number.POSITIVE_INFINITY&&n.borderType!==c&&(s[e]=Math.max(s[e],r))}),u.successors.bind(u)),n.forEach(i,(function(t){s[t]=s[r[t]]})),s}function f(t,e){return n.minBy(n.values(e),(function(e){var r=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return n.forIn(e,(function(e,n){var i=function(t,e){return t.node(e).width}(t,n)/2;r=Math.max(e+i,r),o=Math.min(e-i,o)})),r-o}))}function l(t,e){var r=n.values(e),o=n.min(r),i=n.max(r);n.forEach(["u","d"],(function(r){n.forEach(["l","r"],(function(a){var s,u=r+a,c=t[u];if(c!==e){var h=n.values(c);(s="l"===a?o-n.min(h):i-n.max(h))&&(t[u]=n.mapValues(c,(function(t){return t+s})))}}))}))}function g(t,e){return n.mapValues(t.ul,(function(r,o){if(e)return t[e.toLowerCase()][o];var i=n.sortBy(n.map(t,o));return(i[1]+i[2])/2}))}t.exports={positionX:function(t){var e,r=i.buildLayerMatrix(t),o=n.merge(a(t,r),s(t,r)),u={};n.forEach(["u","d"],(function(i){e="u"===i?r:n.values(r).reverse(),n.forEach(["l","r"],(function(r){"r"===r&&(e=n.map(e,(function(t){return n.values(t).reverse()})));var a=("u"===i?t.predecessors:t.successors).bind(t),s=h(t,e,o,a),c=d(t,e,s.root,s.align,"r"===r);"r"===r&&(c=n.mapValues(c,(function(t){return-t}))),u[i+r]=c}))}));var c=f(t,u);return l(u,c),g(u,t.graph().align)},findType1Conflicts:a,findType2Conflicts:s,addConflict:u,hasConflict:c,verticalAlignment:h,horizontalCompaction:d,alignCoordinates:l,findSmallestWidthAlignment:f,balance:g}},93021:function(t,e,r){"use strict";var n=r(72361),o=r(53063),i=r(92080).positionX;t.exports=function(t){(function(t){var e=o.buildLayerMatrix(t),r=t.graph().ranksep,i=0;n.forEach(e,(function(e){var o=n.max(n.map(e,(function(e){return t.node(e).height})));n.forEach(e,(function(e){t.node(e).y=i+o/2})),i+=o+r}))})(t=o.asNonCompoundGraph(t)),n.forEach(i(t),(function(e,r){t.node(r).x=e}))}},61031:function(t,e,r){"use strict";var n=r(72361),o=r(76626).Graph,i=r(2416).slack;function a(t,e){return n.forEach(t.nodes(),(function r(o){n.forEach(e.nodeEdges(o),(function(n){var a=n.v,s=o===a?n.w:a;t.hasNode(s)||i(e,n)||(t.setNode(s,{}),t.setEdge(o,s,{}),r(s))}))})),t.nodeCount()}function s(t,e){return n.minBy(e.edges(),(function(r){if(t.hasNode(r.v)!==t.hasNode(r.w))return i(e,r)}))}function u(t,e,r){n.forEach(t.nodes(),(function(t){e.node(t).rank+=r}))}t.exports=function(t){var e,r,n=new o({directed:!1}),c=t.nodes()[0],h=t.nodeCount();n.setNode(c,{});for(;a(n,t)<h;)e=s(n,t),r=n.hasNode(e.v)?i(t,e):-i(t,e),u(n,t,r);return n}},64505:function(t,e,r){"use strict";var n=r(2416).longestPath,o=r(61031),i=r(77076);t.exports=function(t){switch(t.graph().ranker){case"network-simplex":default:s(t);break;case"tight-tree":!function(t){n(t),o(t)}(t);break;case"longest-path":a(t)}};var a=n;function s(t){i(t)}},77076:function(t,e,r){"use strict";var n=r(72361),o=r(61031),i=r(2416).slack,a=r(2416).longestPath,s=r(76626).alg.preorder,u=r(76626).alg.postorder,c=r(53063).simplify;function h(t){t=c(t),a(t);var e,r=o(t);for(l(r),d(r,t);e=v(r);)y(r,t,e,p(r,t,e))}function d(t,e){var r=u(t,t.nodes());r=r.slice(0,r.length-1),n.forEach(r,(function(r){!function(t,e,r){var n=t.node(r),o=n.parent;t.edge(r,o).cutvalue=f(t,e,r)}(t,e,r)}))}function f(t,e,r){var o=t.node(r).parent,i=!0,a=e.edge(r,o),s=0;return a||(i=!1,a=e.edge(o,r)),s=a.weight,n.forEach(e.nodeEdges(r),(function(n){var a,u,c=n.v===r,h=c?n.w:n.v;if(h!==o){var d=c===i,f=e.edge(n).weight;if(s+=d?f:-f,a=r,u=h,t.hasEdge(a,u)){var l=t.edge(r,h).cutvalue;s+=d?-l:l}}})),s}function l(t,e){arguments.length<2&&(e=t.nodes()[0]),g(t,{},1,e)}function g(t,e,r,o,i){var a=r,s=t.node(o);return e[o]=!0,n.forEach(t.neighbors(o),(function(i){n.has(e,i)||(r=g(t,e,r,i,o))})),s.low=a,s.lim=r++,i?s.parent=i:delete s.parent,r}function v(t){return n.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function p(t,e,r){var o=r.v,a=r.w;e.hasEdge(o,a)||(o=r.w,a=r.v);var s=t.node(o),u=t.node(a),c=s,h=!1;s.lim>u.lim&&(c=u,h=!0);var d=n.filter(e.edges(),(function(e){return h===m(t,t.node(e.v),c)&&h!==m(t,t.node(e.w),c)}));return n.minBy(d,(function(t){return i(e,t)}))}function y(t,e,r,o){var i=r.v,a=r.w;t.removeEdge(i,a),t.setEdge(o.v,o.w,{}),l(t),d(t,e),function(t,e){var r=n.find(t.nodes(),(function(t){return!e.node(t).parent})),o=s(t,r);o=o.slice(1),n.forEach(o,(function(r){var n=t.node(r).parent,o=e.edge(r,n),i=!1;o||(o=e.edge(n,r),i=!0),e.node(r).rank=e.node(n).rank+(i?o.minlen:-o.minlen)}))}(t,e)}function m(t,e,r){return r.low<=e.lim&&e.lim<=r.lim}t.exports=h,h.initLowLimValues=l,h.initCutValues=d,h.calcCutValue=f,h.leaveEdge=v,h.enterEdge=p,h.exchangeEdges=y},2416:function(t,e,r){"use strict";var n=r(72361);t.exports={longestPath:function(t){var e={};n.forEach(t.sources(),(function r(o){var i=t.node(o);if(n.has(e,o))return i.rank;e[o]=!0;var a=n.min(n.map(t.outEdges(o),(function(e){return r(e.w)-t.edge(e).minlen})));return a!==Number.POSITIVE_INFINITY&&null!=a||(a=0),i.rank=a}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},53063:function(t,e,r){"use strict";var n=r(72361),o=r(76626).Graph;function i(t,e,r,o){var i;do{i=n.uniqueId(o)}while(t.hasNode(i));return r.dummy=e,t.setNode(i,r),i}function a(t){return n.max(n.map(t.nodes(),(function(e){var r=t.node(e).rank;if(!n.isUndefined(r))return r})))}t.exports={addDummyNode:i,simplify:function(t){var e=(new o).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){var n=e.edge(r.v,r.w)||{weight:0,minlen:1},o=t.edge(r);e.setEdge(r.v,r.w,{weight:n.weight+o.weight,minlen:Math.max(n.minlen,o.minlen)})})),e},asNonCompoundGraph:function(t){var e=new o({multigraph:t.isMultigraph()}).setGraph(t.graph());return n.forEach(t.nodes(),(function(r){t.children(r).length||e.setNode(r,t.node(r))})),n.forEach(t.edges(),(function(r){e.setEdge(r,t.edge(r))})),e},successorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.outEdges(e),(function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=n.map(t.nodes(),(function(e){var r={};return n.forEach(t.inEdges(e),(function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight})),r}));return n.zipObject(t.nodes(),e)},intersectRect:function(t,e){var r,n,o=t.x,i=t.y,a=e.x-o,s=e.y-i,u=t.width/2,c=t.height/2;if(!a&&!s)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(s)*u>Math.abs(a)*c?(s<0&&(c=-c),r=c*a/s,n=c):(a<0&&(u=-u),r=u,n=u*s/a);return{x:o+r,y:i+n}},buildLayerMatrix:function(t){var e=n.map(n.range(a(t)+1),(function(){return[]}));return n.forEach(t.nodes(),(function(r){var o=t.node(r),i=o.rank;n.isUndefined(i)||(e[i][o.order]=r)})),e},normalizeRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank})));n.forEach(t.nodes(),(function(r){var o=t.node(r);n.has(o,"rank")&&(o.rank-=e)}))},removeEmptyRanks:function(t){var e=n.min(n.map(t.nodes(),(function(e){return t.node(e).rank}))),r=[];n.forEach(t.nodes(),(function(n){var o=t.node(n).rank-e;r[o]||(r[o]=[]),r[o].push(n)}));var o=0,i=t.graph().nodeRankFactor;n.forEach(r,(function(e,r){n.isUndefined(e)&&r%i!=0?--o:o&&n.forEach(e,(function(e){t.node(e).rank+=o}))}))},addBorderNode:function(t,e,r,n){var o={width:0,height:0};arguments.length>=4&&(o.rank=r,o.order=n);return i(t,"border",o,e)},maxRank:a,partition:function(t,e){var r={lhs:[],rhs:[]};return n.forEach(t,(function(t){e(t)?r.lhs.push(t):r.rhs.push(t)})),r},time:function(t,e){var r=n.now();try{return e()}finally{console.log(t+" time: "+(n.now()-r)+"ms")}},notime:function(t,e){return e()}}},11897:function(t){t.exports="0.8.5"},75172:function(t,e,r){var n=r(89224);t.exports={Graph:n.Graph,json:r(17401),alg:r(54613),version:n.version}},91606:function(t,e,r){var n=r(95329);t.exports=function(t){var e,r={},o=[];function i(o){n.has(r,o)||(r[o]=!0,e.push(o),n.each(t.successors(o),i),n.each(t.predecessors(o),i))}return n.each(t.nodes(),(function(t){e=[],i(t),e.length&&o.push(e)})),o}},21482:function(t,e,r){var n=r(95329);function o(t,e,r,i,a,s){n.has(i,e)||(i[e]=!0,r||s.push(e),n.each(a(e),(function(e){o(t,e,r,i,a,s)})),r&&s.push(e))}t.exports=function(t,e,r){n.isArray(e)||(e=[e]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),a=[],s={};return n.each(e,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);o(t,e,"post"===r,s,i,a)})),a}},40845:function(t,e,r){var n=r(13746),o=r(95329);t.exports=function(t,e,r){return o.transform(t.nodes(),(function(o,i){o[i]=n(t,i,e,r)}),{})}},13746:function(t,e,r){var n=r(95329),o=r(36614);t.exports=function(t,e,r,n){return function(t,e,r,n){var i,a,s={},u=new o,c=function(t){var e=t.v!==i?t.v:t.w,n=s[e],o=r(t),c=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+o);c<n.distance&&(n.distance=c,n.predecessor=i,u.decrease(e,c))};t.nodes().forEach((function(t){var r=t===e?0:Number.POSITIVE_INFINITY;s[t]={distance:r},u.add(t,r)}));for(;u.size()>0&&(i=u.removeMin(),(a=s[i]).distance!==Number.POSITIVE_INFINITY);)n(i).forEach(c);return s}(t,String(e),r||i,n||function(e){return t.outEdges(e)})};var i=n.constant(1)},59324:function(t,e,r){var n=r(95329),o=r(94558);t.exports=function(t){return n.filter(o(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}},22893:function(t,e,r){var n=r(95329);t.exports=function(t,e,r){return function(t,e,r){var n={},o=t.nodes();return o.forEach((function(t){n[t]={},n[t][t]={distance:0},o.forEach((function(e){t!==e&&(n[t][e]={distance:Number.POSITIVE_INFINITY})})),r(t).forEach((function(r){var o=r.v===t?r.w:r.v,i=e(r);n[t][o]={distance:i,predecessor:t}}))})),o.forEach((function(t){var e=n[t];o.forEach((function(r){var i=n[r];o.forEach((function(r){var n=i[t],o=e[r],a=i[r],s=n.distance+o.distance;s<a.distance&&(a.distance=s,a.predecessor=o.predecessor)}))}))})),n}(t,e||o,r||function(e){return t.outEdges(e)})};var o=n.constant(1)},54613:function(t,e,r){t.exports={components:r(91606),dijkstra:r(13746),dijkstraAll:r(40845),findCycles:r(59324),floydWarshall:r(22893),isAcyclic:r(588),postorder:r(98049),preorder:r(67158),prim:r(66058),tarjan:r(94558),topsort:r(7793)}},588:function(t,e,r){var n=r(7793);t.exports=function(t){try{n(t)}catch(t){if(t instanceof n.CycleException)return!1;throw t}return!0}},98049:function(t,e,r){var n=r(21482);t.exports=function(t,e){return n(t,e,"post")}},67158:function(t,e,r){var n=r(21482);t.exports=function(t,e){return n(t,e,"pre")}},66058:function(t,e,r){var n=r(95329),o=r(6349),i=r(36614);t.exports=function(t,e){var r,a=new o,s={},u=new i;function c(t){var n=t.v===r?t.w:t.v,o=u.priority(n);if(void 0!==o){var i=e(t);i<o&&(s[n]=r,u.decrease(n,i))}}if(0===t.nodeCount())return a;n.each(t.nodes(),(function(t){u.add(t,Number.POSITIVE_INFINITY),a.setNode(t)})),u.decrease(t.nodes()[0],0);var h=!1;for(;u.size()>0;){if(r=u.removeMin(),n.has(s,r))a.setEdge(r,s[r]);else{if(h)throw new Error("Input graph is not connected: "+t);h=!0}t.nodeEdges(r).forEach(c)}return a}},94558:function(t,e,r){var n=r(95329);t.exports=function(t){var e=0,r=[],o={},i=[];function a(s){var u=o[s]={onStack:!0,lowlink:e,index:e++};if(r.push(s),t.successors(s).forEach((function(t){n.has(o,t)?o[t].onStack&&(u.lowlink=Math.min(u.lowlink,o[t].index)):(a(t),u.lowlink=Math.min(u.lowlink,o[t].lowlink))})),u.lowlink===u.index){var c,h=[];do{c=r.pop(),o[c].onStack=!1,h.push(c)}while(s!==c);i.push(h)}}return t.nodes().forEach((function(t){n.has(o,t)||a(t)})),i}},7793:function(t,e,r){var n=r(95329);function o(t){var e={},r={},o=[];if(n.each(t.sinks(),(function a(s){if(n.has(r,s))throw new i;n.has(e,s)||(r[s]=!0,e[s]=!0,n.each(t.predecessors(s),a),delete r[s],o.push(s))})),n.size(e)!==t.nodeCount())throw new i;return o}function i(){}t.exports=o,o.CycleException=i,i.prototype=new Error},36614:function(t,e,r){var n=r(95329);function o(){this._arr=[],this._keyIndices={}}t.exports=o,o.prototype.size=function(){return this._arr.length},o.prototype.keys=function(){return this._arr.map((function(t){return t.key}))},o.prototype.has=function(t){return n.has(this._keyIndices,t)},o.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},o.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},o.prototype.add=function(t,e){var r=this._keyIndices;if(t=String(t),!n.has(r,t)){var o=this._arr,i=o.length;return r[t]=i,o.push({key:t,priority:e}),this._decrease(i),!0}return!1},o.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},o.prototype.decrease=function(t,e){var r=this._keyIndices[t];if(e>this._arr[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[r].priority+" New: "+e);this._arr[r].priority=e,this._decrease(r)},o.prototype._heapify=function(t){var e=this._arr,r=2*t,n=r+1,o=t;r<e.length&&(o=e[r].priority<e[o].priority?r:o,n<e.length&&(o=e[n].priority<e[o].priority?n:o),o!==t&&(this._swap(t,o),this._heapify(o)))},o.prototype._decrease=function(t){for(var e,r=this._arr,n=r[t].priority;0!==t&&!(r[e=t>>1].priority<n);)this._swap(t,e),t=e},o.prototype._swap=function(t,e){var r=this._arr,n=this._keyIndices,o=r[t],i=r[e];r[t]=i,r[e]=o,n[i.key]=t,n[o.key]=e}},6349:function(t,e,r){"use strict";var n=r(95329);t.exports=i;var o="\0";function i(t){this._isDirected=!n.has(t,"directed")||t.directed,this._isMultigraph=!!n.has(t,"multigraph")&&t.multigraph,this._isCompound=!!n.has(t,"compound")&&t.compound,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[o]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function a(t,e){t[e]?t[e]++:t[e]=1}function s(t,e){--t[e]||delete t[e]}function u(t,e,r,o){var i=""+e,a=""+r;if(!t&&i>a){var s=i;i=a,a=s}return i+""+a+""+(n.isUndefined(o)?"\0":o)}function c(t,e,r,n){var o=""+e,i=""+r;if(!t&&o>i){var a=o;o=i,i=a}var s={v:o,w:i};return n&&(s.name=n),s}function h(t,e){return u(t,e.v,e.w,e.name)}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(t){return this._label=t,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultNodeLabelFn=t,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return n.keys(this._nodes)},i.prototype.sources=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._in[e])}))},i.prototype.sinks=function(){var t=this;return n.filter(this.nodes(),(function(e){return n.isEmpty(t._out[e])}))},i.prototype.setNodes=function(t,e){var r=arguments,o=this;return n.each(t,(function(t){r.length>1?o.setNode(t,e):o.setNode(t)})),this},i.prototype.setNode=function(t,e){return n.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=o,this._children[t]={},this._children[o][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},i.prototype.node=function(t){return this._nodes[t]},i.prototype.hasNode=function(t){return n.has(this._nodes,t)},i.prototype.removeNode=function(t){var e=this;if(n.has(this._nodes,t)){var r=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],n.each(this.children(t),(function(t){e.setParent(t)})),delete this._children[t]),n.each(n.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],n.each(n.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},i.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(n.isUndefined(e))e=o;else{for(var r=e+="";!n.isUndefined(r);r=this.parent(r))if(r===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},i.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},i.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==o)return e}},i.prototype.children=function(t){if(n.isUndefined(t)&&(t=o),this._isCompound){var e=this._children[t];if(e)return n.keys(e)}else{if(t===o)return this.nodes();if(this.hasNode(t))return[]}},i.prototype.predecessors=function(t){var e=this._preds[t];if(e)return n.keys(e)},i.prototype.successors=function(t){var e=this._sucs[t];if(e)return n.keys(e)},i.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return n.union(e,this.successors(t))},i.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},i.prototype.filterNodes=function(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;n.each(this._nodes,(function(r,n){t(n)&&e.setNode(n,r)})),n.each(this._edgeObjs,(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,r.edge(t))}));var o={};function i(t){var n=r.parent(t);return void 0===n||e.hasNode(n)?(o[t]=n,n):n in o?o[n]:i(n)}return this._isCompound&&n.each(e.nodes(),(function(t){e.setParent(t,i(t))})),e},i.prototype.setDefaultEdgeLabel=function(t){return n.isFunction(t)||(t=n.constant(t)),this._defaultEdgeLabelFn=t,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return n.values(this._edgeObjs)},i.prototype.setPath=function(t,e){var r=this,o=arguments;return n.reduce(t,(function(t,n){return o.length>1?r.setEdge(t,n,e):r.setEdge(t,n),n})),this},i.prototype.setEdge=function(){var t,e,r,o,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(t=s.v,e=s.w,r=s.name,2===arguments.length&&(o=arguments[1],i=!0)):(t=s,e=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],i=!0)),t=""+t,e=""+e,n.isUndefined(r)||(r=""+r);var h=u(this._isDirected,t,e,r);if(n.has(this._edgeLabels,h))return i&&(this._edgeLabels[h]=o),this;if(!n.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[h]=i?o:this._defaultEdgeLabelFn(t,e,r);var d=c(this._isDirected,t,e,r);return t=d.v,e=d.w,Object.freeze(d),this._edgeObjs[h]=d,a(this._preds[e],t),a(this._sucs[t],e),this._in[e][h]=d,this._out[t][h]=d,this._edgeCount++,this},i.prototype.edge=function(t,e,r){var n=1===arguments.length?h(this._isDirected,arguments[0]):u(this._isDirected,t,e,r);return this._edgeLabels[n]},i.prototype.hasEdge=function(t,e,r){var o=1===arguments.length?h(this._isDirected,arguments[0]):u(this._isDirected,t,e,r);return n.has(this._edgeLabels,o)},i.prototype.removeEdge=function(t,e,r){var n=1===arguments.length?h(this._isDirected,arguments[0]):u(this._isDirected,t,e,r),o=this._edgeObjs[n];return o&&(t=o.v,e=o.w,delete this._edgeLabels[n],delete this._edgeObjs[n],s(this._preds[e],t),s(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this},i.prototype.inEdges=function(t,e){var r=this._in[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.v===e})):o}},i.prototype.outEdges=function(t,e){var r=this._out[t];if(r){var o=n.values(r);return e?n.filter(o,(function(t){return t.w===e})):o}},i.prototype.nodeEdges=function(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}},89224:function(t,e,r){t.exports={Graph:r(6349),version:r(16544)}},17401:function(t,e,r){var n=r(95329),o=r(6349);function i(t){return n.map(t.nodes(),(function(e){var r=t.node(e),o=t.parent(e),i={v:e};return n.isUndefined(r)||(i.value=r),n.isUndefined(o)||(i.parent=o),i}))}function a(t){return n.map(t.edges(),(function(e){var r=t.edge(e),o={v:e.v,w:e.w};return n.isUndefined(e.name)||(o.name=e.name),n.isUndefined(r)||(o.value=r),o}))}t.exports={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:a(t)};n.isUndefined(t.graph())||(e.value=n.clone(t.graph()));return e},read:function(t){var e=new o(t.options).setGraph(t.value);return n.each(t.nodes,(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)})),n.each(t.edges,(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)})),e}}},95329:function(t,e,r){var n;try{n={clone:r(76833),constant:r(13503),each:r(76934),filter:r(64725),has:r(99946),isArray:r(80744),isEmpty:r(61627),isFunction:r(9363),isUndefined:r(16513),keys:r(55451),map:r(9924),reduce:r(16473),size:r(40617),transform:r(91116),union:r(44065),values:r(81229)}}catch(t){}n||(n=window._),t.exports=n},16544:function(t){t.exports="2.1.8"},34634:function(t,e,r){"use strict";r.r(e),r.d(e,{isAnyArray:function(){return o}});const n=Object.prototype.toString;function o(t){const e=n.call(t);return e.endsWith("Array]")&&!e.includes("Big")}},15584:function(t,e,r){var n=r(73893)(r(33152),"DataView");t.exports=n},76414:function(t,e,r){var n=r(64696),o=r(16824),i=r(23476),a=r(63122),s=r(37279);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=a,u.prototype.set=s,t.exports=u},99746:function(t,e,r){var n=r(34251),o=r(24968),i=r(28290),a=r(88068),s=r(54238);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=a,u.prototype.set=s,t.exports=u},40164:function(t,e,r){var n=r(73893)(r(33152),"Map");t.exports=n},52166:function(t,e,r){var n=r(35365),o=r(63765),i=r(12608),a=r(10203),s=r(11298);function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=n,u.prototype.delete=o,u.prototype.get=i,u.prototype.has=a,u.prototype.set=s,t.exports=u},97288:function(t,e,r){var n=r(73893)(r(33152),"Promise");t.exports=n},23599:function(t,e,r){var n=r(73893)(r(33152),"Set");t.exports=n},98924:function(t,e,r){var n=r(52166),o=r(34776),i=r(40393);function a(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n;++e<r;)this.add(t[e])}a.prototype.add=a.prototype.push=o,a.prototype.has=i,t.exports=a},91866:function(t,e,r){var n=r(99746),o=r(31119),i=r(64399),a=r(81897),s=r(90558),u=r(64841);function c(t){var e=this.__data__=new n(t);this.size=e.size}c.prototype.clear=o,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=s,c.prototype.set=u,t.exports=c},91869:function(t,e,r){var n=r(33152).Symbol;t.exports=n},77945:function(t,e,r){var n=r(33152).Uint8Array;t.exports=n},26873:function(t,e,r){var n=r(73893)(r(33152),"WeakMap");t.exports=n},79628:function(t){t.exports=function(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)}},74809:function(t){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},86952:function(t){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i}},84271:function(t,e,r){var n=r(17424);t.exports=function(t,e){return!!(null==t?0:t.length)&&n(t,e,0)>-1}},94874:function(t){t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n<o;)if(r(e,t[n]))return!0;return!1}},63333:function(t,e,r){var n=r(67943),o=r(13053),i=r(80744),a=r(57835),s=r(70213),u=r(18397),c=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),h=!r&&o(t),d=!r&&!h&&a(t),f=!r&&!h&&!d&&u(t),l=r||h||d||f,g=l?n(t.length,String):[],v=g.length;for(var p in t)!e&&!c.call(t,p)||l&&("length"==p||d&&("offset"==p||"parent"==p)||f&&("buffer"==p||"byteLength"==p||"byteOffset"==p)||s(p,v))||g.push(p);return g}},75010:function(t){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},57095:function(t){t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},99861:function(t){t.exports=function(t,e,r,n){var o=-1,i=null==t?0:t.length;for(n&&i&&(r=t[++o]);++o<i;)r=e(r,t[o],o,t);return r}},64045:function(t){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}},26539:function(t,e,r){var n=r(22310)("length");t.exports=n},89135:function(t,e,r){var n=r(42813),o=r(43607);t.exports=function(t,e,r){(void 0!==r&&!o(t[e],r)||void 0===r&&!(e in t))&&n(t,e,r)}},60348:function(t,e,r){var n=r(42813),o=r(43607),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var a=t[e];i.call(t,e)&&o(a,r)&&(void 0!==r||e in t)||n(t,e,r)}},67971:function(t,e,r){var n=r(43607);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},91937:function(t,e,r){var n=r(95378),o=r(55451);t.exports=function(t,e){return t&&n(e,o(e),t)}},26680:function(t,e,r){var n=r(95378),o=r(56730);t.exports=function(t,e){return t&&n(e,o(e),t)}},42813:function(t,e,r){var n=r(35234);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},99045:function(t,e,r){var n=r(91866),o=r(74809),i=r(60348),a=r(91937),s=r(26680),u=r(32315),c=r(47760),h=r(15168),d=r(71678),f=r(12076),l=r(22675),g=r(66139),v=r(79264),p=r(97541),y=r(4084),m=r(80744),w=r(57835),x=r(41626),b=r(20816),E=r(65226),N=r(55451),M=r(56730),_="[object Arguments]",k="[object Function]",A="[object Object]",j={};j[_]=j["[object Array]"]=j["[object ArrayBuffer]"]=j["[object DataView]"]=j["[object Boolean]"]=j["[object Date]"]=j["[object Float32Array]"]=j["[object Float64Array]"]=j["[object Int8Array]"]=j["[object Int16Array]"]=j["[object Int32Array]"]=j["[object Map]"]=j["[object Number]"]=j[A]=j["[object RegExp]"]=j["[object Set]"]=j["[object String]"]=j["[object Symbol]"]=j["[object Uint8Array]"]=j["[object Uint8ClampedArray]"]=j["[object Uint16Array]"]=j["[object Uint32Array]"]=!0,j["[object Error]"]=j[k]=j["[object WeakMap]"]=!1,t.exports=function t(e,r,O,S,z,R){var I,P=1&r,T=2&r,C=4&r;if(O&&(I=z?O(e,S,z,R):O(e)),void 0!==I)return I;if(!b(e))return e;var D=m(e);if(D){if(I=v(e),!P)return c(e,I)}else{var L=g(e),F=L==k||"[object GeneratorFunction]"==L;if(w(e))return u(e,P);if(L==A||L==_||F&&!z){if(I=T||F?{}:y(e),!P)return T?d(e,s(I,e)):h(e,a(I,e))}else{if(!j[L])return z?e:{};I=p(e,L,P)}}R||(R=new n);var q=R.get(e);if(q)return q;R.set(e,I),E(e)?e.forEach((function(n){I.add(t(n,r,O,n,e,R))})):x(e)&&e.forEach((function(n,o){I.set(o,t(n,r,O,o,e,R))}));var V=D?void 0:(C?T?l:f:T?M:N)(e);return o(V||e,(function(n,o){V&&(n=e[o=n]),i(I,o,t(n,r,O,o,e,R))})),I}},35024:function(t,e,r){var n=r(20816),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=i},44107:function(t,e,r){var n=r(1585),o=r(49164)(n);t.exports=o},2659:function(t,e,r){var n=r(45029);t.exports=function(t,e,r){for(var o=-1,i=t.length;++o<i;){var a=t[o],s=e(a);if(null!=s&&(void 0===u?s==s&&!n(s):r(s,u)))var u=s,c=a}return c}},32872:function(t,e,r){var n=r(44107);t.exports=function(t,e){var r=[];return n(t,(function(t,n,o){e(t,n,o)&&r.push(t)})),r}},51533:function(t){t.exports=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1}},9256:function(t,e,r){var n=r(57095),o=r(88133);t.exports=function t(e,r,i,a,s){var u=-1,c=e.length;for(i||(i=o),s||(s=[]);++u<c;){var h=e[u];r>0&&i(h)?r>1?t(h,r-1,i,a,s):n(s,h):a||(s[s.length]=h)}return s}},14018:function(t,e,r){var n=r(78010)();t.exports=n},1585:function(t,e,r){var n=r(14018),o=r(55451);t.exports=function(t,e){return t&&n(t,e,o)}},89147:function(t,e,r){var n=r(1186),o=r(9171);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&r<i;)t=t[o(e[r++])];return r&&r==i?t:void 0}},75635:function(t,e,r){var n=r(57095),o=r(80744);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},86756:function(t,e,r){var n=r(91869),o=r(72533),i=r(74702),a=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?o(t):i(t)}},40302:function(t){t.exports=function(t,e){return t>e}},3251:function(t){var e=Object.prototype.hasOwnProperty;t.exports=function(t,r){return null!=t&&e.call(t,r)}},62348:function(t){t.exports=function(t,e){return null!=t&&e in Object(t)}},17424:function(t,e,r){var n=r(51533),o=r(8373),i=r(49237);t.exports=function(t,e,r){return e==e?i(t,e,r):n(t,o,r)}},4977:function(t,e,r){var n=r(86756),o=r(93913);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},77295:function(t,e,r){var n=r(84412),o=r(93913);t.exports=function t(e,r,i,a,s){return e===r||(null==e||null==r||!o(e)&&!o(r)?e!=e&&r!=r:n(e,r,i,a,t,s))}},84412:function(t,e,r){var n=r(91866),o=r(50401),i=r(57710),a=r(4983),s=r(66139),u=r(80744),c=r(57835),h=r(18397),d="[object Arguments]",f="[object Array]",l="[object Object]",g=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,v,p,y){var m=u(t),w=u(e),x=m?f:s(t),b=w?f:s(e),E=(x=x==d?l:x)==l,N=(b=b==d?l:b)==l,M=x==b;if(M&&c(t)){if(!c(e))return!1;m=!0,E=!1}if(M&&!E)return y||(y=new n),m||h(t)?o(t,e,r,v,p,y):i(t,e,x,r,v,p,y);if(!(1&r)){var _=E&&g.call(t,"__wrapped__"),k=N&&g.call(e,"__wrapped__");if(_||k){var A=_?t.value():t,j=k?e.value():e;return y||(y=new n),p(A,j,r,v,y)}}return!!M&&(y||(y=new n),a(t,e,r,v,p,y))}},55005:function(t,e,r){var n=r(66139),o=r(93913);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},51524:function(t,e,r){var n=r(91866),o=r(77295);t.exports=function(t,e,r,i){var a=r.length,s=a,u=!i;if(null==t)return!s;for(t=Object(t);a--;){var c=r[a];if(u&&c[2]?c[1]!==t[c[0]]:!(c[0]in t))return!1}for(;++a<s;){var h=(c=r[a])[0],d=t[h],f=c[1];if(u&&c[2]){if(void 0===d&&!(h in t))return!1}else{var l=new n;if(i)var g=i(d,f,h,t,e,l);if(!(void 0===g?o(f,d,3,i,l):g))return!1}}return!0}},8373:function(t){t.exports=function(t){return t!=t}},6367:function(t,e,r){var n=r(9363),o=r(89379),i=r(20816),a=r(63256),s=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,h=u.toString,d=c.hasOwnProperty,f=RegExp("^"+h.call(d).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?f:s).test(a(t))}},38652:function(t,e,r){var n=r(66139),o=r(93913);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},10766:function(t,e,r){var n=r(86756),o=r(11156),i=r(93913),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!a[n(t)]}},95979:function(t,e,r){var n=r(17632),o=r(38933),i=r(46962),a=r(80744),s=r(35769);t.exports=function(t){return"function"==typeof t?t:null==t?i:"object"==typeof t?a(t)?o(t[0],t[1]):n(t):s(t)}},6019:function(t,e,r){var n=r(7975),o=r(23730),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},33988:function(t,e,r){var n=r(20816),o=r(7975),i=r(97817),a=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=o(t),r=[];for(var s in t)("constructor"!=s||!e&&a.call(t,s))&&r.push(s);return r}},93757:function(t){t.exports=function(t,e){return t<e}},65487:function(t,e,r){var n=r(44107),o=r(24665);t.exports=function(t,e){var r=-1,i=o(t)?Array(t.length):[];return n(t,(function(t,n,o){i[++r]=e(t,n,o)})),i}},17632:function(t,e,r){var n=r(51524),o=r(10261),i=r(24122);t.exports=function(t){var e=o(t);return 1==e.length&&e[0][2]?i(e[0][0],e[0][1]):function(r){return r===t||n(r,t,e)}}},38933:function(t,e,r){var n=r(77295),o=r(44231),i=r(37879),a=r(86773),s=r(88411),u=r(24122),c=r(9171);t.exports=function(t,e){return a(t)&&s(e)?u(c(t),e):function(r){var a=o(r,t);return void 0===a&&a===e?i(r,t):n(e,a,3)}}},50097:function(t,e,r){var n=r(91866),o=r(89135),i=r(14018),a=r(23585),s=r(20816),u=r(56730),c=r(47052);t.exports=function t(e,r,h,d,f){e!==r&&i(r,(function(i,u){if(f||(f=new n),s(i))a(e,r,u,h,t,d,f);else{var l=d?d(c(e,u),i,u+"",e,r,f):void 0;void 0===l&&(l=i),o(e,u,l)}}),u)}},23585:function(t,e,r){var n=r(89135),o=r(32315),i=r(78358),a=r(47760),s=r(4084),u=r(13053),c=r(80744),h=r(41590),d=r(57835),f=r(9363),l=r(20816),g=r(19308),v=r(18397),p=r(47052),y=r(20480);t.exports=function(t,e,r,m,w,x,b){var E=p(t,r),N=p(e,r),M=b.get(N);if(M)n(t,r,M);else{var _=x?x(E,N,r+"",t,e,b):void 0,k=void 0===_;if(k){var A=c(N),j=!A&&d(N),O=!A&&!j&&v(N);_=N,A||j||O?c(E)?_=E:h(E)?_=a(E):j?(k=!1,_=o(N,!0)):O?(k=!1,_=i(N,!0)):_=[]:g(N)||u(N)?(_=E,u(E)?_=y(E):l(E)&&!f(E)||(_=s(N))):k=!1}k&&(b.set(N,_),w(_,N,m,x,b),b.delete(N)),n(t,r,_)}}},58506:function(t,e,r){var n=r(75010),o=r(89147),i=r(95979),a=r(65487),s=r(33065),u=r(38342),c=r(11249),h=r(46962),d=r(80744);t.exports=function(t,e,r){e=e.length?n(e,(function(t){return d(t)?function(e){return o(e,1===t.length?t[0]:t)}:t})):[h];var f=-1;e=n(e,u(i));var l=a(t,(function(t,r,o){return{criteria:n(e,(function(e){return e(t)})),index:++f,value:t}}));return s(l,(function(t,e){return c(t,e,r)}))}},88832:function(t,e,r){var n=r(10867),o=r(37879);t.exports=function(t,e){return n(t,e,(function(e,r){return o(t,r)}))}},10867:function(t,e,r){var n=r(89147),o=r(36897),i=r(1186);t.exports=function(t,e,r){for(var a=-1,s=e.length,u={};++a<s;){var c=e[a],h=n(t,c);r(h,c)&&o(u,i(c,t),h)}return u}},22310:function(t){t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},96916:function(t,e,r){var n=r(89147);t.exports=function(t){return function(e){return n(e,t)}}},36121:function(t){var e=Math.ceil,r=Math.max;t.exports=function(t,n,o,i){for(var a=-1,s=r(e((n-t)/(o||1)),0),u=Array(s);s--;)u[i?s:++a]=t,t+=o;return u}},30739:function(t){t.exports=function(t,e,r,n,o){return o(t,(function(t,o,i){r=n?(n=!1,t):e(r,t,o,i)})),r}},92918:function(t,e,r){var n=r(46962),o=r(19652),i=r(71152);t.exports=function(t,e){return i(o(t,e,n),t+"")}},36897:function(t,e,r){var n=r(60348),o=r(1186),i=r(70213),a=r(20816),s=r(9171);t.exports=function(t,e,r,u){if(!a(t))return t;for(var c=-1,h=(e=o(e,t)).length,d=h-1,f=t;null!=f&&++c<h;){var l=s(e[c]),g=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return t;if(c!=d){var v=f[l];void 0===(g=u?u(v,l,f):void 0)&&(g=a(v)?v:i(e[c+1])?[]:{})}n(f,l,g),f=f[l]}return t}},63989:function(t,e,r){var n=r(13503),o=r(35234),i=r(46962),a=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:i;t.exports=a},33065:function(t){t.exports=function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}},67943:function(t){t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},50230:function(t,e,r){var n=r(91869),o=r(75010),i=r(80744),a=r(45029),s=n?n.prototype:void 0,u=s?s.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(a(e))return u?u.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r}},13927:function(t,e,r){var n=r(15333),o=/^\s+/;t.exports=function(t){return t?t.slice(0,n(t)+1).replace(o,""):t}},38342:function(t){t.exports=function(t){return function(e){return t(e)}}},29098:function(t,e,r){var n=r(98924),o=r(84271),i=r(94874),a=r(1931),s=r(47506),u=r(79679);t.exports=function(t,e,r){var c=-1,h=o,d=t.length,f=!0,l=[],g=l;if(r)f=!1,h=i;else if(d>=200){var v=e?null:s(t);if(v)return u(v);f=!1,h=a,g=new n}else g=e?[]:l;t:for(;++c<d;){var p=t[c],y=e?e(p):p;if(p=r||0!==p?p:0,f&&y==y){for(var m=g.length;m--;)if(g[m]===y)continue t;e&&g.push(y),l.push(p)}else h(g,y,r)||(g!==l&&g.push(y),l.push(p))}return l}},20720:function(t,e,r){var n=r(75010);t.exports=function(t,e){return n(e,(function(e){return t[e]}))}},94484:function(t){t.exports=function(t,e,r){for(var n=-1,o=t.length,i=e.length,a={};++n<o;){var s=n<i?e[n]:void 0;r(a,t[n],s)}return a}},1931:function(t){t.exports=function(t,e){return t.has(e)}},11756:function(t,e,r){var n=r(46962);t.exports=function(t){return"function"==typeof t?t:n}},1186:function(t,e,r){var n=r(80744),o=r(86773),i=r(40493),a=r(44140);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(a(t))}},20188:function(t,e,r){var n=r(77945);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},32315:function(t,e,r){t=r.nmd(t);var n=r(33152),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,a=i&&i.exports===o?n.Buffer:void 0,s=a?a.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=s?s(r):new t.constructor(r);return t.copy(n),n}},27984:function(t,e,r){var n=r(20188);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},78583:function(t){var e=/\w*$/;t.exports=function(t){var r=new t.constructor(t.source,e.exec(t));return r.lastIndex=t.lastIndex,r}},28757:function(t,e,r){var n=r(91869),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;t.exports=function(t){return i?Object(i.call(t)):{}}},78358:function(t,e,r){var n=r(20188);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},83018:function(t,e,r){var n=r(45029);t.exports=function(t,e){if(t!==e){var r=void 0!==t,o=null===t,i=t==t,a=n(t),s=void 0!==e,u=null===e,c=e==e,h=n(e);if(!u&&!h&&!a&&t>e||a&&s&&c&&!u&&!h||o&&s&&c||!r&&c||!i)return 1;if(!o&&!a&&!h&&t<e||h&&r&&i&&!o&&!a||u&&r&&i||!s&&i||!c)return-1}return 0}},11249:function(t,e,r){var n=r(83018);t.exports=function(t,e,r){for(var o=-1,i=t.criteria,a=e.criteria,s=i.length,u=r.length;++o<s;){var c=n(i[o],a[o]);if(c)return o>=u?c:c*("desc"==r[o]?-1:1)}return t.index-e.index}},47760:function(t){t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},95378:function(t,e,r){var n=r(60348),o=r(42813);t.exports=function(t,e,r,i){var a=!r;r||(r={});for(var s=-1,u=e.length;++s<u;){var c=e[s],h=i?i(r[c],t[c],c,r,t):void 0;void 0===h&&(h=t[c]),a?o(r,c,h):n(r,c,h)}return r}},15168:function(t,e,r){var n=r(95378),o=r(58966);t.exports=function(t,e){return n(t,o(t),e)}},71678:function(t,e,r){var n=r(95378),o=r(66817);t.exports=function(t,e){return n(t,o(t),e)}},64218:function(t,e,r){var n=r(33152)["__core-js_shared__"];t.exports=n},63323:function(t,e,r){var n=r(92918),o=r(8138);t.exports=function(t){return n((function(e,r){var n=-1,i=r.length,a=i>1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(a=t.length>3&&"function"==typeof a?(i--,a):void 0,s&&o(r[0],r[1],s)&&(a=i<3?void 0:a,i=1),e=Object(e);++n<i;){var u=r[n];u&&t(e,u,n,a)}return e}))}},49164:function(t,e,r){var n=r(24665);t.exports=function(t,e){return function(r,o){if(null==r)return r;if(!n(r))return t(r,o);for(var i=r.length,a=e?i:-1,s=Object(r);(e?a--:++a<i)&&!1!==o(s[a],a,s););return r}}},78010:function(t){t.exports=function(t){return function(e,r,n){for(var o=-1,i=Object(e),a=n(e),s=a.length;s--;){var u=a[t?s:++o];if(!1===r(i[u],u,i))break}return e}}},19554:function(t,e,r){var n=r(95979),o=r(24665),i=r(55451);t.exports=function(t){return function(e,r,a){var s=Object(e);if(!o(e)){var u=n(r,3);e=i(e),r=function(t){return u(s[t],t,s)}}var c=t(e,r,a);return c>-1?s[u?e[c]:c]:void 0}}},76106:function(t,e,r){var n=r(36121),o=r(8138),i=r(97341);t.exports=function(t){return function(e,r,a){return a&&"number"!=typeof a&&o(e,r,a)&&(r=a=void 0),e=i(e),void 0===r?(r=e,e=0):r=i(r),a=void 0===a?e<r?1:-1:i(a),n(e,r,a,t)}}},47506:function(t,e,r){var n=r(23599),o=r(9958),i=r(79679),a=n&&1/i(new n([,-0]))[1]==1/0?function(t){return new n(t)}:o;t.exports=a},35234:function(t,e,r){var n=r(73893),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},50401:function(t,e,r){var n=r(98924),o=r(64045),i=r(1931);t.exports=function(t,e,r,a,s,u){var c=1&r,h=t.length,d=e.length;if(h!=d&&!(c&&d>h))return!1;var f=u.get(t),l=u.get(e);if(f&&l)return f==e&&l==t;var g=-1,v=!0,p=2&r?new n:void 0;for(u.set(t,e),u.set(e,t);++g<h;){var y=t[g],m=e[g];if(a)var w=c?a(m,y,g,e,t,u):a(y,m,g,t,e,u);if(void 0!==w){if(w)continue;v=!1;break}if(p){if(!o(e,(function(t,e){if(!i(p,e)&&(y===t||s(y,t,r,a,u)))return p.push(e)}))){v=!1;break}}else if(y!==m&&!s(y,m,r,a,u)){v=!1;break}}return u.delete(t),u.delete(e),v}},57710:function(t,e,r){var n=r(91869),o=r(77945),i=r(43607),a=r(50401),s=r(83383),u=r(79679),c=n?n.prototype:void 0,h=c?c.valueOf:void 0;t.exports=function(t,e,r,n,c,d,f){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!d(new o(t),new o(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return i(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var l=s;case"[object Set]":var g=1&n;if(l||(l=u),t.size!=e.size&&!g)return!1;var v=f.get(t);if(v)return v==e;n|=2,f.set(t,e);var p=a(l(t),l(e),n,c,d,f);return f.delete(t),p;case"[object Symbol]":if(h)return h.call(t)==h.call(e)}return!1}},4983:function(t,e,r){var n=r(12076),o=Object.prototype.hasOwnProperty;t.exports=function(t,e,r,i,a,s){var u=1&r,c=n(t),h=c.length;if(h!=n(e).length&&!u)return!1;for(var d=h;d--;){var f=c[d];if(!(u?f in e:o.call(e,f)))return!1}var l=s.get(t),g=s.get(e);if(l&&g)return l==e&&g==t;var v=!0;s.set(t,e),s.set(e,t);for(var p=u;++d<h;){var y=t[f=c[d]],m=e[f];if(i)var w=u?i(m,y,f,e,t,s):i(y,m,f,t,e,s);if(!(void 0===w?y===m||a(y,m,r,i,s):w)){v=!1;break}p||(p="constructor"==f)}if(v&&!p){var x=t.constructor,b=e.constructor;x==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof x&&x instanceof x&&"function"==typeof b&&b instanceof b||(v=!1)}return s.delete(t),s.delete(e),v}},522:function(t,e,r){var n=r(40151),o=r(19652),i=r(71152);t.exports=function(t){return i(o(t,void 0,n),t+"")}},37675:function(t,e,r){var n="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;t.exports=n},12076:function(t,e,r){var n=r(75635),o=r(58966),i=r(55451);t.exports=function(t){return n(t,i,o)}},22675:function(t,e,r){var n=r(75635),o=r(66817),i=r(56730);t.exports=function(t){return n(t,i,o)}},89819:function(t,e,r){var n=r(94358);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},10261:function(t,e,r){var n=r(88411),o=r(55451);t.exports=function(t){for(var e=o(t),r=e.length;r--;){var i=e[r],a=t[i];e[r]=[i,a,n(a)]}return e}},73893:function(t,e,r){var n=r(6367),o=r(49966);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},49217:function(t,e,r){var n=r(31030)(Object.getPrototypeOf,Object);t.exports=n},72533:function(t,e,r){var n=r(91869),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,s=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,s),r=t[s];try{t[s]=void 0;var n=!0}catch(t){}var o=a.call(t);return n&&(e?t[s]=r:delete t[s]),o}},58966:function(t,e,r){var n=r(86952),o=r(4134),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,s=a?function(t){return null==t?[]:(t=Object(t),n(a(t),(function(e){return i.call(t,e)})))}:o;t.exports=s},66817:function(t,e,r){var n=r(57095),o=r(49217),i=r(58966),a=r(4134),s=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:a;t.exports=s},66139:function(t,e,r){var n=r(15584),o=r(40164),i=r(97288),a=r(23599),s=r(26873),u=r(86756),c=r(63256),h="[object Map]",d="[object Promise]",f="[object Set]",l="[object WeakMap]",g="[object DataView]",v=c(n),p=c(o),y=c(i),m=c(a),w=c(s),x=u;(n&&x(new n(new ArrayBuffer(1)))!=g||o&&x(new o)!=h||i&&x(i.resolve())!=d||a&&x(new a)!=f||s&&x(new s)!=l)&&(x=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?c(r):"";if(n)switch(n){case v:return g;case p:return h;case y:return d;case m:return f;case w:return l}return e}),t.exports=x},49966:function(t){t.exports=function(t,e){return null==t?void 0:t[e]}},63100:function(t,e,r){var n=r(1186),o=r(13053),i=r(80744),a=r(70213),s=r(11156),u=r(9171);t.exports=function(t,e,r){for(var c=-1,h=(e=n(e,t)).length,d=!1;++c<h;){var f=u(e[c]);if(!(d=null!=t&&r(t,f)))break;t=t[f]}return d||++c!=h?d:!!(h=null==t?0:t.length)&&s(h)&&a(f,h)&&(i(t)||o(t))}},55015:function(t){var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");t.exports=function(t){return e.test(t)}},64696:function(t,e,r){var n=r(65294);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},16824:function(t){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},23476:function(t,e,r){var n=r(65294),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},63122:function(t,e,r){var n=r(65294),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},37279:function(t,e,r){var n=r(65294);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},79264:function(t){var e=Object.prototype.hasOwnProperty;t.exports=function(t){var r=t.length,n=new t.constructor(r);return r&&"string"==typeof t[0]&&e.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},97541:function(t,e,r){var n=r(20188),o=r(27984),i=r(78583),a=r(28757),s=r(78358);t.exports=function(t,e,r){var u=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new u(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return s(t,r);case"[object Map]":case"[object Set]":return new u;case"[object Number]":case"[object String]":return new u(t);case"[object RegExp]":return i(t);case"[object Symbol]":return a(t)}}},4084:function(t,e,r){var n=r(35024),o=r(49217),i=r(7975);t.exports=function(t){return"function"!=typeof t.constructor||i(t)?{}:n(o(t))}},88133:function(t,e,r){var n=r(91869),o=r(13053),i=r(80744),a=n?n.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(a&&t&&t[a])}},70213:function(t){var e=/^(?:0|[1-9]\d*)$/;t.exports=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}},8138:function(t,e,r){var n=r(43607),o=r(24665),i=r(70213),a=r(20816);t.exports=function(t,e,r){if(!a(r))return!1;var s=typeof e;return!!("number"==s?o(r)&&i(e,r.length):"string"==s&&e in r)&&n(r[e],t)}},86773:function(t,e,r){var n=r(80744),o=r(45029),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||(a.test(t)||!i.test(t)||null!=e&&t in Object(e))}},94358:function(t){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},89379:function(t,e,r){var n,o=r(64218),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},7975:function(t){var e=Object.prototype;t.exports=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}},88411:function(t,e,r){var n=r(20816);t.exports=function(t){return t==t&&!n(t)}},34251:function(t){t.exports=function(){this.__data__=[],this.size=0}},24968:function(t,e,r){var n=r(67971),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return!(r<0)&&(r==e.length-1?e.pop():o.call(e,r,1),--this.size,!0)}},28290:function(t,e,r){var n=r(67971);t.exports=function(t){var e=this.__data__,r=n(e,t);return r<0?void 0:e[r][1]}},88068:function(t,e,r){var n=r(67971);t.exports=function(t){return n(this.__data__,t)>-1}},54238:function(t,e,r){var n=r(67971);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return o<0?(++this.size,r.push([t,e])):r[o][1]=e,this}},35365:function(t,e,r){var n=r(76414),o=r(99746),i=r(40164);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},63765:function(t,e,r){var n=r(89819);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},12608:function(t,e,r){var n=r(89819);t.exports=function(t){return n(this,t).get(t)}},10203:function(t,e,r){var n=r(89819);t.exports=function(t){return n(this,t).has(t)}},11298:function(t,e,r){var n=r(89819);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},83383:function(t){t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}},24122:function(t){t.exports=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}}},26332:function(t,e,r){var n=r(52858);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},65294:function(t,e,r){var n=r(73893)(Object,"create");t.exports=n},23730:function(t,e,r){var n=r(31030)(Object.keys,Object);t.exports=n},97817:function(t){t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},52495:function(t,e,r){t=r.nmd(t);var n=r(37675),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,a=i&&i.exports===o&&n.process,s=function(){try{var t=i&&i.require&&i.require("util").types;return t||a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=s},74702:function(t){var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},31030:function(t){t.exports=function(t,e){return function(r){return t(e(r))}}},19652:function(t,e,r){var n=r(79628),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,a=-1,s=o(i.length-e,0),u=Array(s);++a<s;)u[a]=i[e+a];a=-1;for(var c=Array(e+1);++a<e;)c[a]=i[a];return c[e]=r(u),n(t,this,c)}}},33152:function(t,e,r){var n=r(37675),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},47052:function(t){t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},34776:function(t){t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},40393:function(t){t.exports=function(t){return this.__data__.has(t)}},79679:function(t){t.exports=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}},71152:function(t,e,r){var n=r(63989),o=r(12345)(n);t.exports=o},12345:function(t){var e=Date.now;t.exports=function(t){var r=0,n=0;return function(){var o=e(),i=16-(o-n);if(n=o,i>0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}},31119:function(t,e,r){var n=r(99746);t.exports=function(){this.__data__=new n,this.size=0}},64399:function(t){t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},81897:function(t){t.exports=function(t){return this.__data__.get(t)}},90558:function(t){t.exports=function(t){return this.__data__.has(t)}},64841:function(t,e,r){var n=r(99746),o=r(40164),i=r(52166);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var a=r.__data__;if(!o||a.length<199)return a.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(a)}return r.set(t,e),this.size=r.size,this}},49237:function(t){t.exports=function(t,e,r){for(var n=r-1,o=t.length;++n<o;)if(t[n]===e)return n;return-1}},29405:function(t,e,r){var n=r(26539),o=r(55015),i=r(60844);t.exports=function(t){return o(t)?i(t):n(t)}},40493:function(t,e,r){var n=r(26332),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g,a=n((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(o,(function(t,r,n,o){e.push(n?o.replace(i,"$1"):r||t)})),e}));t.exports=a},9171:function(t,e,r){var n=r(45029);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e}},63256:function(t){var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},15333:function(t){var e=/\s/;t.exports=function(t){for(var r=t.length;r--&&e.test(t.charAt(r)););return r}},60844:function(t){var e="\\ud800-\\udfff",r="["+e+"]",n="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",o="\\ud83c[\\udffb-\\udfff]",i="[^"+e+"]",a="(?:\\ud83c[\\udde6-\\uddff]){2}",s="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+n+"|"+o+")"+"?",c="[\\ufe0e\\ufe0f]?",h=c+u+("(?:\\u200d(?:"+[i,a,s].join("|")+")"+c+u+")*"),d="(?:"+[i+n+"?",n,a,s,r].join("|")+")",f=RegExp(o+"(?="+o+")|"+d+h,"g");t.exports=function(t){for(var e=f.lastIndex=0;f.test(t);)++e;return e}},76833:function(t,e,r){var n=r(99045);t.exports=function(t){return n(t,4)}},20250:function(t,e,r){var n=r(99045);t.exports=function(t){return n(t,5)}},13503:function(t){t.exports=function(t){return function(){return t}}},28548:function(t,e,r){var n=r(92918),o=r(43607),i=r(8138),a=r(56730),s=Object.prototype,u=s.hasOwnProperty,c=n((function(t,e){t=Object(t);var r=-1,n=e.length,c=n>2?e[2]:void 0;for(c&&i(e[0],e[1],c)&&(n=1);++r<n;)for(var h=e[r],d=a(h),f=-1,l=d.length;++f<l;){var g=d[f],v=t[g];(void 0===v||o(v,s[g])&&!u.call(t,g))&&(t[g]=h[g])}return t}));t.exports=c},76934:function(t,e,r){t.exports=r(99204)},43607:function(t){t.exports=function(t,e){return t===e||t!=t&&e!=e}},64725:function(t,e,r){var n=r(86952),o=r(32872),i=r(95979),a=r(80744);t.exports=function(t,e){return(a(t)?n:o)(t,i(e,3))}},79785:function(t,e,r){var n=r(19554)(r(9991));t.exports=n},9991:function(t,e,r){var n=r(51533),o=r(95979),i=r(12824),a=Math.max;t.exports=function(t,e,r){var s=null==t?0:t.length;if(!s)return-1;var u=null==r?0:i(r);return u<0&&(u=a(s+u,0)),n(t,o(e,3),u)}},40151:function(t,e,r){var n=r(9256);t.exports=function(t){return(null==t?0:t.length)?n(t,1):[]}},99204:function(t,e,r){var n=r(74809),o=r(44107),i=r(11756),a=r(80744);t.exports=function(t,e){return(a(t)?n:o)(t,i(e))}},23190:function(t,e,r){var n=r(14018),o=r(11756),i=r(56730);t.exports=function(t,e){return null==t?t:n(t,o(e),i)}},44231:function(t,e,r){var n=r(89147);t.exports=function(t,e,r){var o=null==t?void 0:n(t,e);return void 0===o?r:o}},99946:function(t,e,r){var n=r(3251),o=r(63100);t.exports=function(t,e){return null!=t&&o(t,e,n)}},37879:function(t,e,r){var n=r(62348),o=r(63100);t.exports=function(t,e){return null!=t&&o(t,e,n)}},46962:function(t){t.exports=function(t){return t}},13053:function(t,e,r){var n=r(4977),o=r(93913),i=Object.prototype,a=i.hasOwnProperty,s=i.propertyIsEnumerable,u=n(function(){return arguments}())?n:function(t){return o(t)&&a.call(t,"callee")&&!s.call(t,"callee")};t.exports=u},80744:function(t){var e=Array.isArray;t.exports=e},24665:function(t,e,r){var n=r(9363),o=r(11156);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},41590:function(t,e,r){var n=r(24665),o=r(93913);t.exports=function(t){return o(t)&&n(t)}},57835:function(t,e,r){t=r.nmd(t);var n=r(33152),o=r(55950),i=e&&!e.nodeType&&e,a=i&&t&&!t.nodeType&&t,s=a&&a.exports===i?n.Buffer:void 0,u=(s?s.isBuffer:void 0)||o;t.exports=u},61627:function(t,e,r){var n=r(6019),o=r(66139),i=r(13053),a=r(80744),s=r(24665),u=r(57835),c=r(7975),h=r(18397),d=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(s(t)&&(a(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||h(t)||i(t)))return!t.length;var e=o(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(c(t))return!n(t).length;for(var r in t)if(d.call(t,r))return!1;return!0}},9363:function(t,e,r){var n=r(86756),o=r(20816);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},11156:function(t){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},41626:function(t,e,r){var n=r(55005),o=r(38342),i=r(52495),a=i&&i.isMap,s=a?o(a):n;t.exports=s},20816:function(t){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},93913:function(t){t.exports=function(t){return null!=t&&"object"==typeof t}},19308:function(t,e,r){var n=r(86756),o=r(49217),i=r(93913),a=Function.prototype,s=Object.prototype,u=a.toString,c=s.hasOwnProperty,h=u.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=c.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==h}},65226:function(t,e,r){var n=r(38652),o=r(38342),i=r(52495),a=i&&i.isSet,s=a?o(a):n;t.exports=s},7941:function(t,e,r){var n=r(86756),o=r(80744),i=r(93913);t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&"[object String]"==n(t)}},45029:function(t,e,r){var n=r(86756),o=r(93913);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},18397:function(t,e,r){var n=r(10766),o=r(38342),i=r(52495),a=i&&i.isTypedArray,s=a?o(a):n;t.exports=s},16513:function(t){t.exports=function(t){return void 0===t}},55451:function(t,e,r){var n=r(63333),o=r(6019),i=r(24665);t.exports=function(t){return i(t)?n(t):o(t)}},56730:function(t,e,r){var n=r(63333),o=r(33988),i=r(24665);t.exports=function(t){return i(t)?n(t,!0):o(t)}},10611:function(t){t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},9924:function(t,e,r){var n=r(75010),o=r(95979),i=r(65487),a=r(80744);t.exports=function(t,e){return(a(t)?n:i)(t,o(e,3))}},70642:function(t,e,r){var n=r(42813),o=r(1585),i=r(95979);t.exports=function(t,e){var r={};return e=i(e,3),o(t,(function(t,o,i){n(r,o,e(t,o,i))})),r}},95987:function(t,e,r){var n=r(2659),o=r(40302),i=r(46962);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},52858:function(t,e,r){var n=r(52166);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},28440:function(t,e,r){var n=r(50097),o=r(63323)((function(t,e,r){n(t,e,r)}));t.exports=o},73376:function(t,e,r){var n=r(2659),o=r(93757),i=r(46962);t.exports=function(t){return t&&t.length?n(t,i,o):void 0}},83296:function(t,e,r){var n=r(2659),o=r(95979),i=r(93757);t.exports=function(t,e){return t&&t.length?n(t,o(e,2),i):void 0}},9958:function(t){t.exports=function(){}},5795:function(t,e,r){var n=r(33152);t.exports=function(){return n.Date.now()}},89409:function(t,e,r){var n=r(88832),o=r(522)((function(t,e){return null==t?{}:n(t,e)}));t.exports=o},35769:function(t,e,r){var n=r(22310),o=r(96916),i=r(86773),a=r(9171);t.exports=function(t){return i(t)?n(a(t)):o(t)}},60859:function(t,e,r){var n=r(76106)();t.exports=n},16473:function(t,e,r){var n=r(99861),o=r(44107),i=r(95979),a=r(30739),s=r(80744);t.exports=function(t,e,r){var u=s(t)?n:a,c=arguments.length<3;return u(t,i(e,4),r,c,o)}},40617:function(t,e,r){var n=r(6019),o=r(66139),i=r(24665),a=r(7941),s=r(29405);t.exports=function(t){if(null==t)return 0;if(i(t))return a(t)?s(t):t.length;var e=o(t);return"[object Map]"==e||"[object Set]"==e?t.size:n(t).length}},351:function(t,e,r){var n=r(9256),o=r(58506),i=r(92918),a=r(8138),s=i((function(t,e){if(null==t)return[];var r=e.length;return r>1&&a(t,e[0],e[1])?e=[]:r>2&&a(e[0],e[1],e[2])&&(e=[e[0]]),o(t,n(e,1),[])}));t.exports=s},4134:function(t){t.exports=function(){return[]}},55950:function(t){t.exports=function(){return!1}},97341:function(t,e,r){var n=r(59406),o=1/0;t.exports=function(t){return t?(t=n(t))===o||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},12824:function(t,e,r){var n=r(97341);t.exports=function(t){var e=n(t),r=e%1;return e==e?r?e-r:e:0}},59406:function(t,e,r){var n=r(13927),o=r(20816),i=r(45029),a=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(i(t))return NaN;if(o(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=o(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=n(t);var r=s.test(t);return r||u.test(t)?c(t.slice(2),r?2:8):a.test(t)?NaN:+t}},20480:function(t,e,r){var n=r(95378),o=r(56730);t.exports=function(t){return n(t,o(t))}},44140:function(t,e,r){var n=r(50230);t.exports=function(t){return null==t?"":n(t)}},91116:function(t,e,r){var n=r(74809),o=r(35024),i=r(1585),a=r(95979),s=r(49217),u=r(80744),c=r(57835),h=r(9363),d=r(20816),f=r(18397);t.exports=function(t,e,r){var l=u(t),g=l||c(t)||f(t);if(e=a(e,4),null==r){var v=t&&t.constructor;r=g?l?new v:[]:d(t)&&h(v)?o(s(t)):{}}return(g?n:i)(t,(function(t,n,o){return e(r,t,n,o)})),r}},44065:function(t,e,r){var n=r(9256),o=r(92918),i=r(29098),a=r(41590),s=o((function(t){return i(n(t,1,a,!0))}));t.exports=s},95708:function(t,e,r){var n=r(44140),o=0;t.exports=function(t){var e=++o;return n(t)+e}},81229:function(t,e,r){var n=r(20720),o=r(55451);t.exports=function(t){return null==t?[]:n(t,o(t))}},65441:function(t,e,r){var n=r(60348),o=r(94484);t.exports=function(t,e){return o(t||[],e||[],n)}},34402:function(t,e,r){"use strict";r.r(e),r.d(e,{default:function(){return a}});var n=r(34634);function o(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,a=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=o||a>t.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[o],u=o+1;u<a;u++)t[u]>s&&(s=t[u]);return s}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var r=e.fromIndex,o=void 0===r?0:r,i=e.toIndex,a=void 0===i?t.length:i;if(o<0||o>=t.length||!Number.isInteger(o))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=o||a>t.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=t[o],u=o+1;u<a;u++)t[u]<s&&(s=t[u]);return s}function a(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,n.isAnyArray)(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!(0,n.isAnyArray)(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var a=i(t),s=o(t);if(a===s)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var u=r.min,c=void 0===u?r.autoMinMax?a:0:u,h=r.max,d=void 0===h?r.autoMinMax?s:1:h;if(c>=d)throw new RangeError("min option must be smaller than max option");for(var f=(d-c)/(s-a),l=0;l<t.length;l++)e[l]=(t[l]-a)*f+c;return e}},39572:function(t){t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n},t.exports.__esModule=!0,t.exports.default=t.exports},27027:function(t){t.exports=function(t){if(Array.isArray(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},13720:function(t){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports.default=t.exports},11845:function(t){t.exports=function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")},t.exports.__esModule=!0,t.exports.default=t.exports},78613:function(t){t.exports=function(t,e){return e.get?e.get.call(t):e.value},t.exports.__esModule=!0,t.exports.default=t.exports},61080:function(t){t.exports=function(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}},t.exports.__esModule=!0,t.exports.default=t.exports},82100:function(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},39365:function(t){t.exports=function(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)},t.exports.__esModule=!0,t.exports.default=t.exports},24270:function(t,e,r){var n=r(78613),o=r(39365);t.exports=function(t,e){var r=o(t,e,"get");return n(t,r)},t.exports.__esModule=!0,t.exports.default=t.exports},31573:function(t,e,r){var n=r(11845);t.exports=function(t,e,r){n(t,e),e.set(t,r)},t.exports.__esModule=!0,t.exports.default=t.exports},38689:function(t,e,r){var n=r(61080),o=r(39365);t.exports=function(t,e,r){var i=o(t,e,"set");return n(t,i,r),r},t.exports.__esModule=!0,t.exports.default=t.exports},68995:function(t){t.exports=function(t,e,r){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return r},t.exports.__esModule=!0,t.exports.default=t.exports},7134:function(t,e,r){var n=r(11845);t.exports=function(t,e){n(t,e),e.add(t)},t.exports.__esModule=!0,t.exports.default=t.exports},29186:function(t,e,r){var n=r(83411);function o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}t.exports=function(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},91232:function(t,e,r){var n=r(66109);t.exports=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=n(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw a}}}},t.exports.__esModule=!0,t.exports.default=t.exports},47074:function(t,e,r){var n=r(34577),o=r(74716),i=r(34456);t.exports=function(t){var e=o();return function(){var r,o=n(t);if(e){var a=n(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return i(this,r)}},t.exports.__esModule=!0,t.exports.default=t.exports},85573:function(t,e,r){var n=r(83411);t.exports=function(t,e,r){return(e=n(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t},t.exports.__esModule=!0,t.exports.default=t.exports},4811:function(t,e,r){var n=r(22652);function o(){return"undefined"!=typeof Reflect&&Reflect.get?(t.exports=o=Reflect.get.bind(),t.exports.__esModule=!0,t.exports.default=t.exports):(t.exports=o=function(t,e,r){var o=n(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},t.exports.__esModule=!0,t.exports.default=t.exports),o.apply(this,arguments)}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports},34577:function(t){function e(r){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},80619:function(t,e,r){var n=r(35745);t.exports=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n(t,e)},t.exports.__esModule=!0,t.exports.default=t.exports},74716:function(t){t.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}},t.exports.__esModule=!0,t.exports.default=t.exports},70849:function(t){t.exports=function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}},t.exports.__esModule=!0,t.exports.default=t.exports},35599:function(t){t.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},34456:function(t,e,r){var n=r(31468).default,o=r(13720);t.exports=function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return o(t)},t.exports.__esModule=!0,t.exports.default=t.exports},7557:function(t,e,r){var n=r(31468).default;function o(){"use strict";t.exports=o=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},i=Object.prototype,a=i.hasOwnProperty,s=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",h=u.asyncIterator||"@@asyncIterator",d=u.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(e){f=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof w?e:w,i=Object.create(o.prototype),a=new R(n||[]);return s(i,"_invoke",{value:j(t,r,a)}),i}function g(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=l;var v="suspendedStart",p="executing",y="completed",m={};function w(){}function x(){}function b(){}var E={};f(E,c,(function(){return this}));var N=Object.getPrototypeOf,M=N&&N(N(I([])));M&&M!==i&&a.call(M,c)&&(E=M);var _=b.prototype=w.prototype=Object.create(E);function k(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function r(o,i,s,u){var c=g(t[o],t,i);if("throw"!==c.type){var h=c.arg,d=h.value;return d&&"object"==n(d)&&a.call(d,"__await")?e.resolve(d.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):e.resolve(d).then((function(t){h.value=t,s(h)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var o;s(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function j(t,r,n){var o=v;return function(i,a){if(o===p)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var s=n.delegate;if(s){var u=O(s,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===v)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=p;var c=g(t,r,n);if("normal"===c.type){if(o=n.done?y:"suspendedYield",c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=y,n.method="throw",n.arg=c.arg)}}}function O(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,O(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=g(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function z(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function I(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(a.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return x.prototype=b,s(_,"constructor",{value:b,configurable:!0}),s(b,"constructor",{value:x,configurable:!0}),x.displayName=f(b,d,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===x||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,f(t,d,"GeneratorFunction")),t.prototype=Object.create(_),t},r.awrap=function(t){return{__await:t}},k(A.prototype),f(A.prototype,h,(function(){return this})),r.AsyncIterator=A,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new A(l(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},k(_),f(_,d,"Generator"),f(_,c,(function(){return this})),f(_,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=I,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(z),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return s.type="throw",s.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=a.call(i,"catchLoc"),c=a.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=t,i.arg=e,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),z(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;z(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:I(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},r}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports},35745:function(t){function e(r,n){return t.exports=e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r,n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},79800:function(t,e,r){var n=r(27027),o=r(70849),i=r(66109),a=r(35599);t.exports=function(t,e){return n(t)||o(t,e)||i(t,e)||a()},t.exports.__esModule=!0,t.exports.default=t.exports},22652:function(t,e,r){var n=r(34577);t.exports=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=n(t)););return t},t.exports.__esModule=!0,t.exports.default=t.exports},41819:function(t,e,r){var n=r(31468).default;t.exports=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},83411:function(t,e,r){var n=r(31468).default,o=r(41819);t.exports=function(t){var e=o(t,"string");return"symbol"==n(e)?e:String(e)},t.exports.__esModule=!0,t.exports.default=t.exports},31468:function(t){function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},66109:function(t,e,r){var n=r(39572);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={id:n,loaded:!1,exports:{}};return t[n](i,i.exports,r),i.loaded=!0,i.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t},function(){"use strict";function t(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}function e(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{u(n.next(t))}catch(t){i(t)}}function s(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}u((n=n.apply(t,e||[])).next())}))}Object.create;Object.create;"function"==typeof SuppressedError&&SuppressedError;var n=function(){function t(){this._events={}}return t.prototype.on=function(t,e,r){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!r}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=this._events[t]||[],i=this._events["*"]||[],a=function(n){for(var o=n.length,i=0;i<o;i++)if(n[i]){var a=n[i],s=a.callback;a.once&&(n.splice(i,1),0===n.length&&delete e._events[t],o--,i--),s.apply(e,r)}};a(o),a(i)},t.prototype.off=function(t,e){if(t)if(e){for(var r=this._events[t]||[],n=r.length,o=0;o<n;o++)r[o].callback===e&&(r.splice(o,1),n--,o--);0===r.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}(),o=n;function i(t,e,r,n){for(;t.length;){const o=t.shift();if(r(o))return!0;e.add(o.id),n(o.id).forEach((r=>{e.has(r.id)||(e.add(r.id),t.push(r))}))}return!1}function a(t,e,r,n){if(r(t))return!0;e.add(t.id);for(const o of n(t.id))if(!e.has(o.id)&&a(o,e,r,n))return!0;return!1}const s=()=>!0;class u{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||s,r=t.edgeFilter||s;this.nodeFilter=e,this.edgeFilter=t=>{const{source:n,target:o}=this.graph.getEdgeDetail(t.id);return!(!e(n)||!e(o))&&r(t,n,o)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map((t=>t.id)))};updateCache=t=>{const e=new Set;t.forEach((t=>{const r=this.bothEdgesMap.get(t);if(r&&r.forEach((t=>e.add(t.id))),this.hasNode(t)){const r=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),n=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),o=Array.from(new Set([...r,...n]));o.forEach((t=>e.add(t.id))),this.inEdgesMap.set(t,r),this.outEdgesMap.set(t,n),this.bothEdgesMap.set(t,o),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)})),e.forEach((t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)}))};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach((r=>{switch(r.type){case"NodeAdded":case"NodeRemoved":e.add(r.value.id);break;case"NodeDataUpdated":e.add(r.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(r.value.source),e.add(r.value.target);break;case"EdgeUpdated":"source"!==r.propertyName&&"target"!==r.propertyName||(e.add(r.oldValue),e.add(r.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(r.id)){const n=t.graph.getEdge(r.id);e.add(n.source),e.add(n.target)}}})),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),this.cacheEnabled)return"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t);return this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const r=this.graph.getParent(t,e);return r&&this.nodeFilter(r)?r:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];i([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];a(this.getNode(t),new Set,e,n)}}class c extends o{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach((t=>{switch(t.type){case"NodeRemoved":{let r=!1;e=e.filter((e=>{if("NodeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id})),r||e.push(t);break}case"EdgeRemoved":{let r=!1;e=e.filter((e=>{if("EdgeAdded"===e.type){const n=e.value.id===t.value.id;return n&&(r=!0),!n}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id})),r||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const r=e.findIndex((e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName))),n=e[r];n?void 0!==t.propertyName?n.newValue=t.newValue:(e.splice(r,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter((e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey)),e.push(t);break;case"TreeStructureChanged":{const r=e.find((e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId));r?r.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}})),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some((e=>e.id===t))}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map((t=>this.getNode(t.target)));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map((t=>this.getNode(t.source)));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),r=this.getSuccessors(t);return Array.from(new Set([...e,...r]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach((e=>{e.childrenMap.set(t.id,new Set)})),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch((()=>{for(const e of t)this.doAddNode(e)}))}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t);this.bothEdgesMap.get(t)?.forEach((t=>this.doRemoveEdge(t.id))),this.nodeMap.delete(t),this.treeIndices.forEach((r=>{r.childrenMap.get(t)?.forEach((t=>{r.parentMap.delete(t.id)}));const n=r.parentMap.get(t);n&&r.childrenMap.get(n.id)?.delete(e),r.parentMap.delete(t),r.childrenMap.delete(t)})),this.bothEdgesMap.delete(t),this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch((()=>{t.forEach((t=>this.doRemoveNode(t)))}))}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,r){const n=this.getNode(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}mergeNodeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateNodeDataProperty(t,e,r)}))}))}updateNodeData(...t){const e=t[0],r=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:o})}))}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),r=this.outEdgesMap.get(t.source),n=this.bothEdgesMap.get(t.source),o=this.bothEdgesMap.get(t.target);e.add(t),r.add(t),n.add(t),o.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch((()=>{for(const e of t)this.doAddEdge(e)}))}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),r=this.outEdgesMap.get(e.source),n=this.inEdgesMap.get(e.target),o=this.bothEdgesMap.get(e.source),i=this.bothEdgesMap.get(e.target);r.delete(e),n.delete(e),o.delete(e),i.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch((()=>{t.forEach((t=>this.doRemoveEdge(t)))}))}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.source,o=e;this.outEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.outEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.source=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:n,newValue:o})}))}updateEdgeTarget(t,e){const r=this.getEdge(t);this.checkNodeExistence(e);const n=r.target,o=e;this.inEdgesMap.get(n).delete(r),this.bothEdgesMap.get(n).delete(r),this.inEdgesMap.get(o).add(r),this.bothEdgesMap.get(o).add(r),r.target=e,this.batch((()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:n,newValue:o})}))}updateEdgeDataProperty(t,e,r){const n=this.getEdge(t);this.batch((()=>{const o=n.data[e],i=r;n.data[e]=i,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:o,newValue:i})}))}updateEdgeData(...t){const e=t[0],r=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let n;if("function"==typeof t[1]){const e=t[1];n=e(r.data)}else"object"==typeof t[1]&&(n=t[1]);this.batch((()=>{const t=r.data,o=n;r.data=n,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:o})}))}mergeEdgeData(t,e){this.batch((()=>{Object.entries(e).forEach((([e,r])=>{this.updateEdgeDataProperty(t,e,r)}))}))}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch((()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})})))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch((()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})}))}addTree(t,e){this.batch((()=>{this.attachTreeStructure(e);const r=[],n=Array.isArray(t)?t:[t];for(;n.length;){const t=n.shift();r.push(t),t.children&&n.push(...t.children)}this.addNodes(r),r.forEach((t=>{t.children?.forEach((r=>{this.setParent(r.id,t.id,e)}))}))}))}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter((e=>!this.getParent(e.id,t)))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const r=this.treeIndices.get(e).childrenMap.get(t);return Array.from(r||[])}getParent(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);return this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const r=[];let n,o=this.getNode(t);for(;n=this.getParent(o.id,e);)r.push(n),o=n;return r}setParent(t,e,r){this.checkTreeExistence(r);const n=this.treeIndices.get(r);if(!n)return;const o=this.getNode(t),i=n.parentMap.get(t);if(i?.id===e)return;if(null==e)return i&&n.childrenMap.get(i.id)?.delete(o),void n.parentMap.delete(t);const a=this.getNode(e);n.parentMap.set(t,a),i&&n.childrenMap.get(i.id)?.delete(o);let s=n.childrenMap.get(a.id);s||(s=new Set,n.childrenMap.set(a.id,s)),s.add(o),this.batch((()=>{this.changes.push({type:"TreeStructureChanged",treeKey:r,nodeId:t,oldParentId:i?.id,newParentId:a.id})}))}dfsTree(t,e,r){return a(this.getNode(t),new Set,e,(t=>this.getChildren(t,r)))}bfsTree(t,e,r){return i([this.getNode(t)],new Set,e,(t=>this.getChildren(t,r)))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return i([this.getNode(t)],new Set,e,n)}dfs(t,e,r="out"){const n={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[r];return a(this.getNode(t),new Set,e,n)}clone(){const t=this.getAllNodes().map((t=>({...t,data:{...t.data}}))),e=this.getAllEdges().map((t=>({...t,data:{...t.data}}))),r=new c({nodes:t,edges:e});return this.treeIndices.forEach((({parentMap:t,childrenMap:e},n)=>{const o=new Map;t.forEach(((t,e)=>{o.set(e,r.getNode(t.id))}));const i=new Map;e.forEach(((t,e)=>{i.set(e,new Set(Array.from(t).map((t=>r.getNode(t.id)))))})),r.treeIndices.set(n,{parentMap:o,childrenMap:i})})),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new u({graph:this,...t})}}const h=Symbol("Comlink.proxy"),d=Symbol("Comlink.endpoint"),f=Symbol("Comlink.releaseProxy"),l=Symbol("Comlink.finalizer"),g=Symbol("Comlink.thrown"),v=t=>"object"==typeof t&&null!==t||"function"==typeof t,p={canHandle:t=>v(t)&&t[h],serialize(t){const{port1:e,port2:r}=new MessageChannel;return m(t,e),[r,[r]]},deserialize(t){return t.start(),function(t,e){const r=new Map;return t.addEventListener("message",(function(t){const{data:e}=t;if(!e||!e.id)return;const n=r.get(e.id);if(n)try{n(e)}finally{r.delete(e.id)}})),M(t,r,[],e)}(t)}},y=new Map([["proxy",p],["throw",{canHandle:t=>v(t)&&g in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function m(t,e=globalThis,r=["*"]){e.addEventListener("message",(function n(o){if(!o||!o.data)return;if(!function(t,e){for(const r of t){if(e===r||"*"===r)return!0;if(r instanceof RegExp&&r.test(e))return!0}return!1}(r,o.origin))return void console.warn(`Invalid origin '${o.origin}' for comlink proxy`);const{id:i,type:a,path:s}=Object.assign({path:[]},o.data),u=(o.data.argumentList||[]).map(j);let c;try{const e=s.slice(0,-1).reduce(((t,e)=>t[e]),t),r=s.reduce(((t,e)=>t[e]),t);switch(a){case"GET":c=r;break;case"SET":e[s.slice(-1)[0]]=j(o.data.value),c=!0;break;case"APPLY":c=r.apply(e,u);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[h]:!0})}(new r(...u));break;case"ENDPOINT":{const{port1:e,port2:r}=new MessageChannel;m(t,r),c=function(t,e){return k.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(t){c={value:t,[g]:0}}Promise.resolve(c).catch((t=>({value:t,[g]:0}))).then((r=>{const[o,s]=A(r);e.postMessage(Object.assign(Object.assign({},o),{id:i}),s),"RELEASE"===a&&(e.removeEventListener("message",n),w(e),l in t&&"function"==typeof t[l]&&t[l]())})).catch((t=>{const[r,n]=A({value:new TypeError("Unserializable return value"),[g]:0});e.postMessage(Object.assign(Object.assign({},r),{id:i}),n)}))})),e.start&&e.start()}function w(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function x(t){if(t)throw new Error("Proxy has been released and is not useable")}function b(t){return O(t,new Map,{type:"RELEASE"}).then((()=>{w(t)}))}const E=new WeakMap,N="FinalizationRegistry"in globalThis&&new FinalizationRegistry((t=>{const e=(E.get(t)||0)-1;E.set(t,e),0===e&&b(t)}));function M(t,e,r=[],n=function(){}){let o=!1;const i=new Proxy(n,{get(n,a){if(x(o),a===f)return()=>{!function(t){N&&N.unregister(t)}(i),b(t),e.clear(),o=!0};if("then"===a){if(0===r.length)return{then:()=>i};const n=O(t,e,{type:"GET",path:r.map((t=>t.toString()))}).then(j);return n.then.bind(n)}return M(t,e,[...r,a])},set(n,i,a){x(o);const[s,u]=A(a);return O(t,e,{type:"SET",path:[...r,i].map((t=>t.toString())),value:s},u).then(j)},apply(n,i,a){x(o);const s=r[r.length-1];if(s===d)return O(t,e,{type:"ENDPOINT"}).then(j);if("bind"===s)return M(t,e,r.slice(0,-1));const[u,c]=_(a);return O(t,e,{type:"APPLY",path:r.map((t=>t.toString())),argumentList:u},c).then(j)},construct(n,i){x(o);const[a,s]=_(i);return O(t,e,{type:"CONSTRUCT",path:r.map((t=>t.toString())),argumentList:a},s).then(j)}});return function(t,e){const r=(E.get(e)||0)+1;E.set(e,r),N&&N.register(t,e,t)}(i,t),i}function _(t){const e=t.map(A);return[e.map((t=>t[0])),(r=e.map((t=>t[1])),Array.prototype.concat.apply([],r))];var r}const k=new WeakMap;function A(t){for(const[e,r]of y)if(r.canHandle(t)){const[n,o]=r.serialize(t);return[{type:"HANDLER",name:e,value:n},o]}return[{type:"RAW",value:t},k.get(t)||[]]}function j(t){switch(t.type){case"HANDLER":return y.get(t.name).deserialize(t.value);case"RAW":return t.value}}function O(t,e,r,n){return new Promise((o=>{const i=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.set(i,o),t.start&&t.start(),t.postMessage(Object.assign({id:i},r),n)}))}function S(t){return"number"==typeof t}const z=(t,e)=>{if("next"!==t&&"prev"!==t)return e},R=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};class I{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return R(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&R(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let r=e.prev;for(;r!==e;)t.push(JSON.stringify(r,z)),r=null==r?void 0:r.prev;return`[${t.join(", ")}]`}}class P extends I{}const T=()=>1,C=(t,e,r)=>{let n=[];const o=e[e.length-1],i=e[0];let a;for(;t.getAllNodes().length;){for(;a=i.dequeue();)D(t,e,r,a);for(;a=o.dequeue();)D(t,e,r,a);if(t.getAllNodes().length)for(let o=e.length-2;o>0;--o)if(a=e[o].dequeue(),a){n=n.concat(D(t,e,r,a,!0));break}}return n},D=(t,e,r,n,o)=>{var i,a;const s=[];return t.hasNode(n.v)&&(null===(i=t.getRelatedEdges(n.v,"in"))||void 0===i||i.forEach((n=>{const i=n.data.weight,a=t.getNode(n.source);o&&s.push({v:n.source,w:n.target,in:0,out:0}),void 0===a.data.out&&(a.data.out=0),a.data.out-=i,F(e,r,Object.assign({v:a.id},a.data))})),null===(a=t.getRelatedEdges(n.v,"out"))||void 0===a||a.forEach((n=>{const o=n.data.weight,i=n.target,a=t.getNode(i);void 0===a.data.in&&(a.data.in=0),a.data.in-=o,F(e,r,Object.assign({v:a.id},a.data))})),t.removeNode(n.v)),o?s:void 0},L=(t,e)=>{const r=new c;let n=0,o=0;t.getAllNodes().forEach((t=>{r.addNode({id:t.id,data:{v:t.id,in:0,out:0}})})),t.getAllEdges().forEach((t=>{const i=r.getRelatedEdges(t.source,"out").find((e=>e.target===t.target)),a=(null==e?void 0:e(t))||1;i?r.updateEdgeData(null==i?void 0:i.id,Object.assign(Object.assign({},i.data),{weight:i.data.weight+a})):r.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:a}}),o=Math.max(o,r.getNode(t.source).data.out+=a),n=Math.max(n,r.getNode(t.target).data.in+=a)}));const i=[],a=o+n+3;for(let t=0;t<a;t++)i.push(new P);const s=n+1;return r.getAllNodes().forEach((t=>{F(i,s,Object.assign({v:t.id},r.getNode(t.id).data))})),{buckets:i,zeroIdx:s,graph:r}},F=(t,e,r)=>{r.out?r.in?t[r.out-r.in+e].enqueue(r):t[t.length-1].enqueue(r):t[0].enqueue(r)},q=(t,e)=>{const r="greedy"===e?((t,e)=>{var r;if(t.getAllNodes().length<=1)return[];const n=L(t,e||T);return null===(r=C(n.graph,n.buckets,n.zeroIdx).map((e=>t.getRelatedEdges(e.v,"out").filter((({target:t})=>t===e.w)))))||void 0===r?void 0:r.flat()})(t,(t=>t.data.weight||1)):V(t);null==r||r.forEach((e=>{const r=e.data;t.removeEdge(e.id),r.forwardName=e.data.name,r.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},r)})}))},V=t=>{const e=[],r={},n={},o=i=>{n[i]||(n[i]=!0,r[i]=!0,t.getRelatedEdges(i,"out").forEach((t=>{r[t.target]?e.push(t):o(t.target)})),delete r[i])};return t.getAllNodes().forEach((t=>o(t.id))),e},B=(t,e,r,n)=>{let o;do{o=`${n}${Math.random()}`}while(t.hasNode(o));return r.dummy=e,t.addNode({id:o,data:r}),o},G=t=>{const e=new c;return t.getAllNodes().forEach((r=>{t.getChildren(r.id).length||e.addNode(Object.assign({},r))})),t.getAllEdges().forEach((t=>{e.addEdge(t)})),e},U=(t,e)=>null==t?void 0:t.reduce(((t,r,n)=>(t[r]=e[n],t)),{}),W=(t,e)=>{const r=Number(t.x),n=Number(t.y),o=Number(e.x)-r,i=Number(e.y)-n;let a,s,u=Number(t.width)/2,c=Number(t.height)/2;return o||i?(Math.abs(i)*u>Math.abs(o)*c?(i<0&&(c=-c),a=c*o/i,s=c):(o<0&&(u=-u),a=u,s=u*i/o),{x:r+a,y:n+s}):{x:0,y:0}},$=t=>{const e=[],r=H(t)+1;for(let t=0;t<r;t++)e.push([]);t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&e[r]&&e[r].push(t.id)}));for(let n=0;n<r;n++)e[n]=e[n].sort(((e,r)=>{return n=t.getNode(e).data.order,o=t.getNode(r).data.order,Number(n)-Number(o);var n,o}));return e},Y=(t,e,r,n)=>{const o={width:0,height:0};return S(r)&&S(n)&&(o.rank=r,o.order=n),B(t,"border",o,e)},H=t=>{let e;return t.getAllNodes().forEach((t=>{const r=t.data.rank;void 0!==r&&(void 0===e||r>e)&&(e=r)})),e||(e=0),e},K=(t,e)=>t.reduce(((t,r)=>e(t)>e(r)?r:t)),J=(t,e,r,n,o,i)=>{n.includes(e.id)||(n.push(e.id),r||i.push(e.id),o(e.id).forEach((e=>J(t,e,r,n,o,i))),r&&i.push(e.id))},Q=(t,e,r,n)=>{const o=Array.isArray(e)?e:[e],i=e=>n?t.getSuccessors(e):t.getNeighbors(e),a=[],s=[];return o.forEach((e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);J(t,e,"post"===r,s,i,a)})),a},X=(t,e,r,n,o,i)=>{const a={rank:i,borderType:e,width:0,height:0},s=o.data[e][i-1],u=B(t,"border",a,r);o.data[e][i]=u,t.setParent(u,n),s&&t.addEdge({id:`e${Math.random()}`,source:s,target:u,data:{weight:1}})},Z=t=>{t.getAllNodes().forEach((t=>{tt(t)})),t.getAllEdges().forEach((t=>{tt(t)}))},tt=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},et=t=>{t.getAllNodes().forEach((t=>{rt(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>rt(t))),t.data.hasOwnProperty("y")&&rt(t.data)}))},rt=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},nt=t=>{t.getAllNodes().forEach((t=>{ot(t.data)})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>ot(t))),t.data.hasOwnProperty("x")&&ot(t.data)}))},ot=t=>{const e=t.x;t.x=t.y,t.y=e},it=(t,e,r,n,o,i,a)=>{const s=t.getChildren(a);if(!(null==s?void 0:s.length))return void(a!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:a,data:{weight:0,minlen:r}}));const u=Y(t,"_bt"),c=Y(t,"_bb"),h=t.getNode(a);t.setParent(u,a),h.data.borderTop=u,t.setParent(c,a),h.data.borderBottom=c,null==s||s.forEach((s=>{it(t,e,r,n,o,i,s.id);const h=s.data.borderTop?s.data.borderTop:s.id,d=s.data.borderBottom?s.data.borderBottom:s.id,f=s.data.borderTop?n:2*n,l=h!==d?1:o-i[a]+1;t.addEdge({id:`e${Math.random()}`,source:u,target:h,data:{minlen:l,weight:f,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:d,target:c,data:{minlen:l,weight:f,nestingEdge:!0}})})),t.getParent(a)||t.addEdge({id:`e${Math.random()}`,source:e,target:u,data:{weight:0,minlen:o+i[a]}})},at=t=>{const e={},r=(n,o)=>{const i=t.getChildren(n);null==i||i.forEach((t=>r(t.id,o+1))),e[n]=o};return t.getRoots().forEach((t=>r(t.id,1))),e},st=t=>{let e=0;return t.getAllEdges().forEach((t=>{e+=t.data.weight})),e},ut="edge-label",ct=(t,e,r)=>{let n=e.source,o=t.getNode(n).data.rank;const i=e.target,a=t.getNode(i).data.rank,s=e.data.labelRank;if(a===o+1)return;let u,c,h;for(t.removeEdge(e.id),h=0,++o;o<a;++h,++o)e.data.points=[],c={originalEdge:e,width:0,height:0,rank:o},u=B(t,"edge",c,"_d"),o===s&&(c.width=e.data.width,c.height=e.data.height,c.dummy=ut,c.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:n,target:u,data:{weight:e.data.weight}}),0===h&&r.push(u),n=u;t.addEdge({id:`e${Math.random()}`,source:n,target:i,data:{weight:e.data.weight}})};function ht(t){return Array.isArray(t)}var dt=function(t){if("object"!=typeof t||null===t)return t;var e;if(ht(t)){e=[];for(var r=0,n=t.length;r<n;r++)"object"==typeof t[r]&&null!=t[r]?e[r]=dt(t[r]):e[r]=t[r]}else for(var o in e={},t)"object"==typeof t[o]&&null!=t[o]?e[o]=dt(t[o]):e[o]=t[o];return e},ft=dt;const lt=t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e},gt=(t,e,r)=>{const n=U(r,r.map(((t,e)=>e))),o=e.map((e=>{const r=t.getRelatedEdges(e,"out").map((t=>({pos:n[t.target]||0,weight:t.data.weight})));return null==r?void 0:r.sort(((t,e)=>t.pos-e.pos))})),i=o.flat().filter((t=>void 0!==t));let a=1;for(;a<r.length;)a<<=1;const s=2*a-1;a-=1;const u=Array(s).fill(0,0,s);let c=0;return null==i||i.forEach((t=>{if(t){let e=t.pos+a;u[e]+=t.weight;let r=0;for(;e>0;)e%2&&(r+=u[e+1]),e=e-1>>1,u[e]+=t.weight;c+=t.weight*r}})),c},vt=(t,e)=>{let r=0;for(let n=1;n<(null==e?void 0:e.length);n+=1)r+=gt(t,e[n-1],e[n]);return r},pt=t=>{const e={},r=t.getAllNodes(),n=r.map((t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0})),o=Math.max(...n),i=[];for(let t=0;t<o+1;t++)i.push([]);const a=r.sort(((e,r)=>t.getNode(e.id).data.rank-t.getNode(r.id).data.rank)),s=a.filter((e=>void 0!==t.getNode(e.id).data.fixorder)).sort(((e,r)=>t.getNode(e.id).data.fixorder-t.getNode(r.id).data.fixorder));return null==s||s.forEach((r=>{isNaN(t.getNode(r.id).data.rank)||i[t.getNode(r.id).data.rank].push(r.id),e[r.id]=!0})),null==a||a.forEach((r=>t.dfsTree(r.id,(t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||i[t.data.rank].push(t.id)})))),i},yt=t=>{var e,r;const n=[];for(;null==t?void 0:t.length;){const o=t.pop();n.push(o),null===(e=o.in.reverse())||void 0===e||e.forEach((t=>{return(e=o,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&mt(e,t)})(t);var e})),null===(r=o.out)||void 0===r||r.forEach((e=>{return(r=o,e=>{e.in.push(r),0==--e.indegree&&t.push(e)})(e);var r}))}const o=n.filter((t=>!t.merged)),i=["vs","i","barycenter","weight"];return o.map((t=>{const e={};return null==i||i.forEach((r=>{void 0!==t[r]&&(e[r]=t[r])})),e}))},mt=(t,e)=>{var r;let n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=null===(r=e.vs)||void 0===r?void 0:r.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0};var wt=(t,e)=>{var r,n,o;const i={};null==t||t.forEach(((t,e)=>{i[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const r=i[t.v];void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)})),null===(r=e.getAllEdges())||void 0===r||r.forEach((t=>{const e=i[t.source],r=i[t.target];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(i[t.target]))}));const a=null===(o=(n=Object.values(i)).filter)||void 0===o?void 0:o.call(n,(t=>!t.indegree));return yt(a)};const xt=(t,e,r)=>{let n,o=r;for(;e.length&&(n=e[e.length-1]).i<=o;)e.pop(),null==t||t.push(n.vs),o++;return o},bt=(t,e)=>(r,n)=>{if(void 0!==r.fixorder&&void 0!==n.fixorder)return r.fixorder-n.fixorder;if(r.barycenter<n.barycenter)return-1;if(r.barycenter>n.barycenter)return 1;if(e&&void 0!==r.order&&void 0!==n.order){if(r.order<n.order)return-1;if(r.order>n.order)return 1}return t?n.i-r.i:r.i-n.i},Et=(t,e,r,n,o,i)=>{var a,s,u,c;let h=t.getChildren(e).map((t=>t.id));const d=t.getNode(e),f=d?d.data.borderLeft:void 0,l=d?d.data.borderRight:void 0,g={};f&&(h=null==h?void 0:h.filter((t=>t!==f&&t!==l)));const v=((t,e)=>e.map((e=>{const r=t.getRelatedEdges(e,"in");if(!(null==r?void 0:r.length))return{v:e};const n={sum:0,weight:0};return null==r||r.forEach((e=>{const r=t.getNode(e.source);n.sum+=e.data.weight*r.data.order,n.weight+=e.data.weight})),{v:e,barycenter:n.sum/n.weight,weight:n.weight}})))(t,h||[]);null==v||v.forEach((e=>{var o;if(null===(o=t.getChildren(e.v))||void 0===o?void 0:o.length){const o=Et(t,e.v,r,n,i);g[e.v]=o,o.hasOwnProperty("barycenter")&&Mt(e,o)}}));const p=wt(v,r);Nt(p,g),null===(a=p.filter((t=>t.vs.length>0)))||void 0===a||a.forEach((e=>{const r=t.getNode(e.vs[0]);r&&(e.fixorder=r.data.fixorder,e.order=r.data.order)}));const y=((t,e,r,n)=>{const o=((t,e)=>{const r={lhs:[],rhs:[]};return null==t||t.forEach((t=>{e(t)?r.lhs.push(t):r.rhs.push(t)})),r})(t,(t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return n?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")})),i=o.lhs,a=o.rhs.sort(((t,e)=>-t.i- -e.i)),s=[];let u=0,c=0,h=0;null==i||i.sort(bt(!!e,!!r)),h=xt(s,a,h),null==i||i.forEach((t=>{var e;h+=null===(e=t.vs)||void 0===e?void 0:e.length,s.push(t.vs),u+=t.barycenter*t.weight,c+=t.weight,h=xt(s,a,h)}));const d={vs:s.flat()};return c&&(d.barycenter=u/c,d.weight=c),d})(p,n,o,i);if(f&&(y.vs=[f,y.vs,l].flat(),null===(s=t.getPredecessors(f))||void 0===s?void 0:s.length)){const e=t.getNode((null===(u=t.getPredecessors(f))||void 0===u?void 0:u[0].id)||""),r=t.getNode((null===(c=t.getPredecessors(l))||void 0===c?void 0:c[0].id)||"");y.hasOwnProperty("barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+e.data.order+r.data.order)/(y.weight+2),y.weight+=2}return y},Nt=(t,e)=>{null==t||t.forEach((t=>{var r;const n=null===(r=t.vs)||void 0===r?void 0:r.map((t=>e[t]?e[t].vs:t));t.vs=n.flat()}))},Mt=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)},_t=(t,e,r)=>e.map((e=>((t,e,r)=>{const n=lt(t),o=new c({tree:[{id:n,children:[],data:{}}]});return t.getAllNodes().forEach((i=>{const a=t.getParent(i.id);(i.data.rank===e||i.data.minRank<=e&&e<=i.data.maxRank)&&(o.hasNode(i.id)||o.addNode(Object.assign({},i)),(null==a?void 0:a.id)&&!o.hasNode(null==a?void 0:a.id)&&o.addNode(Object.assign({},a)),o.setParent(i.id,(null==a?void 0:a.id)||n),t.getRelatedEdges(i.id,r).forEach((e=>{const r=e.source===i.id?e.target:e.source;o.hasNode(r)||o.addNode(Object.assign({},t.getNode(r)));const n=o.getRelatedEdges(r,"out").find((({target:t})=>t===i.id)),a=void 0!==n?n.data.weight:0;n?o.updateEdgeData(n.id,Object.assign(Object.assign({},n.data),{weight:e.data.weight+a})):o.addEdge({id:e.id,source:r,target:i.id,data:{weight:e.data.weight+a}})})),i.data.hasOwnProperty("minRank")&&o.updateNodeData(i.id,Object.assign(Object.assign({},i.data),{borderLeft:i.data.borderLeft[e],borderRight:i.data.borderRight[e]})))})),o})(t,e,r))),kt=(t,e,r,n)=>{const o=new c;null==t||t.forEach((t=>{var i;const a=t.getRoots()[0].id,s=Et(t,a,o,e,r,n);for(let e=0;e<(null===(i=s.vs)||void 0===i?void 0:i.length);e++){const r=t.getNode(s.vs[e]);r&&(r.data.order=e)}((t,e,r)=>{const n={};let o;null==r||r.forEach((r=>{let i,a,s=t.getParent(r);for(;s;){if(i=t.getParent(s.id),i?(a=n[i.id],n[i.id]=s.id):(a=o,o=s.id),a&&a!==s.id)return e.hasNode(a)||e.addNode({id:a,data:{}}),e.hasNode(s.id)||e.addNode({id:s.id,data:{}}),void(e.hasEdge(`e${a}-${s.id}`)||e.addEdge({id:`e${a}-${s.id}`,source:a,target:s.id,data:{}}));s=i}}))})(t,o,s.vs)}))},At=(t,e)=>{null==e||e.forEach((e=>{null==e||e.forEach(((e,r)=>{t.getNode(e).data.order=r}))}))},jt=(t,e)=>{const r=(t=>{const e={};let r=0;const n=o=>{const i=r;t.getChildren(o).forEach((t=>n(t.id))),e[o]={low:i,lim:r++}};return t.getRoots().forEach((t=>n(t.id))),e})(t);e.forEach((e=>{var n,o;let i=e,a=t.getNode(i);const s=a.data.originalEdge;if(!s)return;const u=((t,e,r,n)=>{var o,i;const a=[],s=[],u=Math.min(e[r].low,e[n].low),c=Math.max(e[r].lim,e[n].lim);let h,d;h=r;do{h=null===(o=t.getParent(h))||void 0===o?void 0:o.id,a.push(h)}while(h&&(e[h].low>u||c>e[h].lim));for(d=h,h=n;h&&h!==d;)s.push(h),h=null===(i=t.getParent(h))||void 0===i?void 0:i.id;return{lca:d,path:a.concat(s.reverse())}})(t,r,s.source,s.target),c=u.path,h=u.lca;let d=0,f=c[d],l=!0;for(;i!==s.target;){if(a=t.getNode(i),l){for(;f!==h&&(null===(n=t.getNode(f))||void 0===n?void 0:n.data.maxRank)<a.data.rank;)d++,f=c[d];f===h&&(l=!1)}if(!l){for(;d<c.length-1&&(null===(o=t.getNode(c[d+1]))||void 0===o?void 0:o.data.minRank)<=a.data.rank;)d++;f=c[d]}t.hasNode(f)&&t.setParent(i,f),i=t.getSuccessors(i)[0].id}}))},Ot=(t,e)=>{const r={},n=(e,n)=>{let o=0,i=0;const a=e.length,s=null==n?void 0:n[(null==n?void 0:n.length)-1];return null==n||n.forEach(((e,u)=>{var c;const h=zt(t,e),d=h?t.getNode(h.id).data.order:a;(h||e===s)&&(null===(c=n.slice(i,u+1))||void 0===c||c.forEach((e=>{var n;null===(n=t.getPredecessors(e))||void 0===n||n.forEach((n=>{var i;const a=t.getNode(n.id),s=a.data.order;!(s<o||d<s)||a.data.dummy&&(null===(i=t.getNode(e))||void 0===i?void 0:i.data.dummy)||Rt(r,n.id,e)}))})),i=u+1,o=d)})),n};return(null==e?void 0:e.length)&&e.reduce(n),r},St=(t,e)=>{const r={};function n(e,n){const o=function(t){return JSON.stringify(t.slice(1))}(e);n.get(o)||(!function(e,n,o,i,a){var s,u;let c;for(let h=n;h<o;h++)c=e[h],(null===(s=t.getNode(c))||void 0===s?void 0:s.data.dummy)&&(null===(u=t.getPredecessors(c))||void 0===u||u.forEach((e=>{const n=t.getNode(e.id);n.data.dummy&&(n.data.order<i||n.data.order>a)&&Rt(r,e.id,c)})))}(...e),n.set(o,!0))}const o=(e,r)=>{let o,i=-1,a=0;const s=new Map;return null==r||r.forEach(((u,c)=>{var h;if("border"===(null===(h=t.getNode(u))||void 0===h?void 0:h.data.dummy)){const e=t.getPredecessors(u)||[];e.length&&(o=t.getNode(e[0].id).data.order,n([r,a,c,i,o],s),a=c,i=o)}n([r,a,r.length,o,e.length],s)})),r};return(null==e?void 0:e.length)&&e.reduce(o),r},zt=(t,e)=>{var r,n;if(null===(r=t.getNode(e))||void 0===r?void 0:r.data.dummy)return null===(n=t.getPredecessors(e))||void 0===n?void 0:n.find((e=>t.getNode(e.id).data.dummy))},Rt=(t,e,r)=>{let n=e,o=r;if(n>o){const t=n;n=o,o=t}let i=t[n];i||(t[n]=i={}),i[o]=!0},It=(t,e,r)=>{let n=e,o=r;if(n>r){n=r,o=e}return!!t[n]},Pt=(t,e,r,n)=>{const o={},i={},a={};return null==e||e.forEach((t=>{null==t||t.forEach(((t,e)=>{o[t]=t,i[t]=t,a[t]=e}))})),null==e||e.forEach((t=>{let e=-1;null==t||t.forEach((t=>{let s=n(t).map((t=>t.id));if(s.length){s=s.sort(((t,e)=>a[t]-a[e]));const n=(s.length-1)/2;for(let u=Math.floor(n),c=Math.ceil(n);u<=c;++u){const n=s[u];i[t]===t&&e<a[n]&&!It(r,t,n)&&(i[n]=t,i[t]=o[t]=o[n],e=a[n])}}}))})),{root:o,align:i}},Tt=(t,e,r,n,o,i,a)=>{var s;const u={},c=Ct(t,e,r,o,i,a),h=a?"borderLeft":"borderRight",d=(t,e)=>{let r=c.getAllNodes(),n=r.pop();const o={};for(;n;)o[n.id]?t(n.id):(o[n.id]=!0,r.push(n),r=r.concat(e(n.id))),n=r.pop()};return d((t=>{u[t]=(c.getRelatedEdges(t,"in")||[]).reduce(((t,e)=>Math.max(t,(u[e.source]||0)+e.data.weight)),0)}),c.getPredecessors.bind(c)),d((e=>{const r=(c.getRelatedEdges(e,"out")||[]).reduce(((t,e)=>Math.min(t,(u[e.target]||0)-e.data.weight)),Number.POSITIVE_INFINITY),n=t.getNode(e);r!==Number.POSITIVE_INFINITY&&n.data.borderType!==h&&(u[e]=Math.max(u[e],r))}),c.getSuccessors.bind(c)),null===(s=Object.values(n))||void 0===s||s.forEach((t=>{u[t]=u[r[t]]})),u},Ct=(t,e,r,n,o,i)=>{const a=new c,s=qt(n,o,i);return null==e||e.forEach((e=>{let n;null==e||e.forEach((e=>{const o=r[e];if(a.hasNode(o)||a.addNode({id:o,data:{}}),n){const i=r[n],u=a.getRelatedEdges(i,"out").find((t=>t.target===o));u?a.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:Math.max(s(t,e,n),u.data.weight||0)})):a.addEdge({id:`e${Math.random()}`,source:i,target:o,data:{weight:Math.max(s(t,e,n),0)}})}n=e}))})),a},Dt=(t,e)=>K(Object.values(e),(e=>{var r;let n=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;return null===(r=Object.keys(e))||void 0===r||r.forEach((r=>{const i=e[r],a=Vt(t,r)/2;n=Math.max(i+a,n),o=Math.min(i-a,o)})),n-o}));function Lt(t,e){const r=Object.values(e),n=Math.min(...r),o=Math.max(...r);["u","d"].forEach((r=>{["l","r"].forEach((i=>{const a=r+i,s=t[a];let u;if(s===e)return;const c=Object.values(s);u="l"===i?n-Math.min(...c):o-Math.max(...c),u&&(t[a]={},Object.keys(s).forEach((e=>{t[a][e]=s[e]+u})))}))}))}const Ft=(t,e)=>{const r={};return Object.keys(t.ul).forEach((n=>{if(e)r[n]=t[e.toLowerCase()][n];else{const e=Object.values(t).map((t=>t[n]));r[n]=(e[0]+e[1])/2}})),r},qt=(t,e,r)=>(n,o,i)=>{const a=n.getNode(o),s=n.getNode(i);let u=0,c=0;if(u+=a.data.width/2,a.data.hasOwnProperty("labelpos"))switch((a.data.labelpos||"").toLowerCase()){case"l":c=-a.data.width/2;break;case"r":c=a.data.width/2}if(c&&(u+=r?c:-c),c=0,u+=(a.data.dummy?e:t)/2,u+=(s.data.dummy?e:t)/2,u+=s.data.width/2,s.data.labelpos)switch((s.data.labelpos||"").toLowerCase()){case"l":c=s.data.width/2;break;case"r":c=-s.data.width/2}return c&&(u+=r?c:-c),c=0,u},Vt=(t,e)=>t.getNode(e).data.width||0,Bt=(t,e)=>{var r;const n=G(t);((t,e)=>{const{ranksep:r=0}=e||{},n=$(t);let o=0;null==n||n.forEach((e=>{const n=e.map((e=>t.getNode(e).data.height)),i=Math.max(...n,0);null==e||e.forEach((e=>{t.getNode(e).data.y=o+i/2})),o+=i+r}))})(n,e);const o=((t,e)=>{const{align:r,nodesep:n=0,edgesep:o=0}=e||{},i=$(t),a=Object.assign(Ot(t,i),St(t,i)),s={};let u=[];["u","d"].forEach((e=>{u="u"===e?i:Object.values(i).reverse(),["l","r"].forEach((r=>{"r"===r&&(u=u.map((t=>Object.values(t).reverse())));const i=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),c=Pt(0,u,a,i),h=Tt(t,u,c.root,c.align,n,o,"r"===r);"r"===r&&Object.keys(h).forEach((t=>h[t]=-h[t])),s[e+r]=h}))}));const c=Dt(t,s);return c&&Lt(s,c),Ft(s,r)})(n,e);null===(r=Object.keys(o))||void 0===r||r.forEach((t=>{n.getNode(t).data.x=o[t]}))},Gt=t=>{const e={},r=n=>{var o;const i=t.getNode(n);if(!i)return 0;if(e[n])return i.data.rank;let a;return e[n]=!0,null===(o=t.getRelatedEdges(n,"out"))||void 0===o||o.forEach((t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===a||e<a)&&(a=e)})),a||(a=0),i.data.rank=a,a};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>r(t.id)))},Ut=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,Wt=(t,e)=>{const r=n=>{e.getRelatedEdges(n,"both").forEach((o=>{const i=o.source,a=n===i?o.target:i;t.hasNode(a)||Ut(e,o)||(t.addNode({id:a,data:{}}),t.addEdge({id:o.id,source:n,target:a,data:{}}),r(a))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},$t=(t,e)=>{const r=n=>{var o;null===(o=e.getRelatedEdges(n,"both"))||void 0===o||o.forEach((o=>{const i=o.source,a=n===i?o.target:i;t.hasNode(a)||void 0===e.getNode(a).data.layer&&Ut(e,o)||(t.addNode({id:a,data:{}}),t.addEdge({id:o.id,source:n,target:a,data:{}}),r(a))}))};return t.getAllNodes().forEach((t=>r(t.id))),t.getAllNodes().length},Yt=(t,e)=>K(e.getAllEdges(),(r=>t.hasNode(r.source)!==t.hasNode(r.target)?Ut(e,r):1/0)),Ht=(t,e,r)=>{t.getAllNodes().forEach((t=>{const n=e.getNode(t.id);n.data.rank||(n.data.rank=0),n.data.rank+=r}))},Kt=t=>{const e=(t=>{const e=new c;return t.getAllNodes().forEach((t=>{e.addNode(Object.assign({},t))})),t.getAllEdges().forEach((t=>{const r=e.getRelatedEdges(t.source,"out").find((e=>e.target===t.target));r?e.updateEdgeData(null==r?void 0:r.id,Object.assign(Object.assign({},r.data),{weight:r.data.weight+t.data.weight||0,minlen:Math.max(r.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})})),e})(t);Gt(e);const r=(t=>{const e=new c({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);Wt(e,t)<n;)o=Yt(e,t),i=e.hasNode(o.source)?Ut(t,o):-Ut(t,o),Ht(e,t,i);return e})(e);let n,o;for(Zt(r),Jt(r,e);n=ee(r);)o=re(r,e,n),ne(r,e,n,o)},Jt=(t,e)=>{let r=Q(t,t.getAllNodes(),"post",!1);r=r.slice(0,(null==r?void 0:r.length)-1),r.forEach((r=>{Qt(t,e,r)}))},Qt=(t,e,r)=>{const n=t.getNode(r).data.parent;t.getRelatedEdges(r,"both").find((t=>t.target===n||t.source===n)).data.cutvalue=Xt(t,e,r)},Xt=(t,e,r)=>{const n=t.getNode(r).data.parent;let o=!0,i=e.getRelatedEdges(r,"out").find((t=>t.target===n)),a=0;return i||(o=!1,i=e.getRelatedEdges(n,"out").find((t=>t.target===r))),a=i.data.weight,e.getRelatedEdges(r,"both").forEach((e=>{const i=e.source===r,s=i?e.target:e.source;if(s!==n){const n=i===o,u=e.data.weight;if(a+=n?u:-u,ie(t,r,s)){const e=t.getRelatedEdges(r,"both").find((t=>t.source===s||t.target===s)).data.cutvalue;a+=n?-e:e}}})),a},Zt=(t,e=t.getAllNodes()[0].id)=>{te(t,{},1,e)},te=(t,e,r,n,o)=>{var i;const a=r;let s=r;const u=t.getNode(n);return e[n]=!0,null===(i=t.getNeighbors(n))||void 0===i||i.forEach((r=>{e[r.id]||(s=te(t,e,s,r.id,n))})),u.data.low=a,u.data.lim=s++,o?u.data.parent=o:delete u.data.parent,s},ee=t=>t.getAllEdges().find((t=>t.data.cutvalue<0)),re=(t,e,r)=>{let n=r.source,o=r.target;e.getRelatedEdges(n,"out").find((t=>t.target===o))||(n=r.target,o=r.source);const i=t.getNode(n),a=t.getNode(o);let s=i,u=!1;i.data.lim>a.data.lim&&(s=a,u=!0);const c=e.getAllEdges().filter((e=>u===ae(t.getNode(e.source),s)&&u!==ae(t.getNode(e.target),s)));return K(c,(t=>Ut(e,t)))},ne=(t,e,r,n)=>{const o=t.getRelatedEdges(r.source,"both").find((t=>t.source===r.target||t.target===r.target));o&&t.removeEdge(o.id),t.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),Zt(t),Jt(t,e),oe(t,e)},oe=(t,e)=>{const r=t.getAllNodes().find((t=>!t.data.parent));let n=Q(t,r,"pre",!1);n=n.slice(1),n.forEach((r=>{const n=t.getNode(r).data.parent;let o=e.getRelatedEdges(r,"out").find((t=>t.target===n)),i=!1;!o&&e.hasNode(n)&&(o=e.getRelatedEdges(n,"out").find((t=>t.target===r)),i=!0),e.getNode(r).data.rank=(e.hasNode(n)&&e.getNode(n).data.rank||0)+(i?null==o?void 0:o.data.minlen:-(null==o?void 0:o.data.minlen))}))},ie=(t,e,r)=>t.getRelatedEdges(e,"both").find((t=>t.source===r||t.target===r)),ae=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,se=Gt,ue=t=>{(t=>{const e={};let r;const n=o=>{var i;const a=t.getNode(o);if(!a)return 0;if(e[o])return a.data.rank;let s;return e[o]=!0,null===(i=t.getRelatedEdges(o,"out"))||void 0===i||i.forEach((t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)})),s||(s=0),(void 0===r||s<r)&&(r=s),a.data.rank=s,s};t.getAllNodes().filter((e=>0===t.getRelatedEdges(e.id,"in").length)).forEach((t=>{t&&n(t.id)})),void 0===r&&(r=0);const o={},i=(e,r)=>{var n;const a=t.getNode(e),s=isNaN(a.data.layer)?r:a.data.layer;(void 0===a.data.rank||a.data.rank<s)&&(a.data.rank=s),o[e]||(o[e]=!0,null===(n=t.getRelatedEdges(e,"out"))||void 0===n||n.forEach((t=>{i(t.target,s+t.data.minlen)})))};t.getAllNodes().forEach((t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=r:i(t.id,e.layer))}))})(t),(t=>{const e=new c({tree:[]}),r=t.getAllNodes()[0],n=t.getAllNodes().length;let o,i;for(e.addNode(r);$t(e,t)<n;)o=Yt(e,t),i=e.hasNode(o.source)?Ut(t,o):-Ut(t,o),Ht(e,t,i)})(t)},ce=t=>{Kt(t)},he=(t,e)=>{const{acyclicer:r,ranker:n,rankdir:o="tb",nodeOrder:i,keepNodeOrder:a,align:s,nodesep:u=50,edgesep:c=20,ranksep:h=50}=e;je(t),q(t,r);const{nestingRoot:d,nodeRankFactor:f}=(t=>{const e=B(t,"root",{},"_root"),r=at(t);let n=Math.max(...Object.values(r));Math.abs(n)===1/0&&(n=1);const o=n-1,i=2*o+1;t.getAllEdges().forEach((t=>{t.data.minlen*=i}));const a=st(t)+1;return t.getRoots().forEach((n=>{it(t,e,i,a,o,r,n.id)})),{nestingRoot:e,nodeRankFactor:i}})(t);((t,e)=>{switch(e){case"network-simplex":ce(t);break;case"tight-tree":default:ue(t);break;case"longest-path":se(t)}})(G(t),n),xe(t),((t,e=0)=>{const r=t.getAllNodes(),n=r.filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),o=Math.min(...n),i=[];r.forEach((t=>{const e=(t.data.rank||0)-o;i[e]||(i[e]=[]),i[e].push(t.id)}));let a=0;for(let r=0;r<i.length;r++){const n=i[r];void 0===n?r%e!=0&&(a-=1):a&&(null==n||n.forEach((e=>{const r=t.getNode(e);r&&(r.data.rank=r.data.rank||0,r.data.rank+=a)})))}})(t,f),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach((e=>{e.data.nestingEdge&&t.removeEdge(e.id)}))})(t,d),(t=>{const e=t.getAllNodes().filter((t=>void 0!==t.data.rank)).map((t=>t.data.rank)),r=Math.min(...e);t.getAllNodes().forEach((t=>{t.data.hasOwnProperty("rank")&&r!==1/0&&(t.data.rank-=r)}))})(t),be(t),Ee(t);const l=[];((t,e)=>{t.getAllEdges().forEach((r=>ct(t,r,e)))})(t,l),jt(t,l),(t=>{const e=r=>{const n=t.getChildren(r),o=t.getNode(r);if((null==n?void 0:n.length)&&n.forEach((t=>e(t.id))),o.data.hasOwnProperty("minRank")){o.data.borderLeft=[],o.data.borderRight=[];for(let e=o.data.minRank,n=o.data.maxRank+1;e<n;e+=1)X(t,"borderLeft","_bl",r,o,e),X(t,"borderRight","_br",r,o,e)}};t.getRoots().forEach((t=>e(t.id)))})(t),a&&((t,e)=>{const r=t.getAllNodes().filter((e=>{var r;return!(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length)})).map((t=>t.data.rank)),n=Math.max(...r),o=[];for(let t=0;t<n+1;t++)o[t]=[];null==e||e.forEach((e=>{const r=t.getNode(e);r&&!r.data.dummy&&(isNaN(r.data.rank)||(r.data.fixorder=o[r.data.rank].length,o[r.data.rank].push(e)))}))})(t,i),((t,e)=>{const r=H(t),n=[],o=[];for(let t=1;t<r+1;t++)n.push(t);for(let t=r-1;t>-1;t--)o.push(t);const i=_t(t,n,"in"),a=_t(t,o,"out");let s=pt(t);At(t,s);let u,c=Number.POSITIVE_INFINITY;for(let r=0,n=0;n<4;++r,++n){kt(r%2?i:a,r%4>=2,!1,e),s=$(t);const o=vt(t,s);o<c&&(n=0,u=ft(s),c=o)}s=pt(t),At(t,s);for(let r=0,n=0;n<4;++r,++n){kt(r%2?i:a,r%4>=2,!0,e),s=$(t);const o=vt(t,s);o<c&&(n=0,u=ft(s),c=o)}At(t,u)})(t,a),Oe(t),((t,e)=>{const r=e.toLowerCase();"lr"!==r&&"rl"!==r||Z(t)})(t,o),Bt(t,{align:s,nodesep:u,edgesep:c,ranksep:h}),Se(t),Ae(t),((t,e)=>{e.forEach((e=>{let r=t.getNode(e);const{data:n}=r,o=n.originalEdge;let i;o&&t.addEdge(o);let a=e;for(;r.data.dummy;)i=t.getSuccessors(a)[0],t.removeNode(a),o.data.points.push({x:r.data.x,y:r.data.y}),r.data.dummy===ut&&(o.data.x=r.data.x,o.data.y=r.data.y,o.data.width=r.data.width,o.data.height=r.data.height),a=i.id,r=t.getNode(a)}))})(t,l),_e(t),((t,e)=>{const r=e.toLowerCase();"bt"!==r&&"rl"!==r||et(t),"lr"!==r&&"rl"!==r||(nt(t),Z(t))})(t,o);const{width:g,height:v}=Ne(t);return Me(t),ke(t),(t=>{t.getAllEdges().forEach((e=>{const r=e.data;if(r.reversed){t.removeEdge(e.id);const n=r.forwardName;delete r.reversed,delete r.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},r),{forwardName:n})})}}))})(t),{width:g,height:v}},de=(t,e)=>{t.getAllNodes().forEach((r=>{const n=t.getNode(r.id);if(e.hasNode(r.id)){const t=e.getNode(r.id);n.data.fixorder=t.data._order,delete t.data._order}else delete n.data.fixorder}))},fe=(t,e)=>{t.getAllNodes().forEach((r=>{var n;const o=t.getNode(r.id);if(o){const t=e.getNode(r.id);o.data.x=t.data.x,o.data.y=t.data.y,o.data._order=t.data.order,o.data._rank=t.data.rank,(null===(n=e.getChildren(r.id))||void 0===n?void 0:n.length)&&(o.data.width=t.data.width,o.data.height=t.data.height)}})),t.getAllEdges().forEach((r=>{const n=t.getEdge(r.id),o=e.getEdge(r.id);n.data.points=o?o.data.points:[],o&&o.data.hasOwnProperty("x")&&(n.data.x=o.data.x,n.data.y=o.data.y)}))},le=["width","height","layer","fixorder"],ge={width:0,height:0},ve=["minlen","weight","width","height","labeloffset"],pe={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},ye=["labelpos"],me=t=>{const e=new c({tree:[]});return t.getAllNodes().forEach((r=>{const n=Re(t.getNode(r.id).data),o=Object.assign(Object.assign({},ge),n),i=ze(o,le);e.hasNode(r.id)||e.addNode({id:r.id,data:Object.assign({},i)});const a=t.hasTreeStructure("combo")?t.getParent(r.id,"combo"):t.getParent(r.id);null!=a&&(e.hasNode(a.id)||e.addNode(Object.assign({},a)),e.setParent(r.id,a.id))})),t.getAllEdges().forEach((r=>{const n=Re(t.getEdge(r.id).data),o={};null==ye||ye.forEach((t=>{void 0!==n[t]&&(o[t]=n[t])})),e.addEdge({id:r.id,source:r.source,target:r.target,data:Object.assign({},pe,ze(n,ve),o)})})),e},we=(t,e)=>{const{ranksep:r=0,rankdir:n}=e;return t.getAllNodes().forEach((t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)})),t.getAllEdges().forEach((t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===n||"BT"===n?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)})),r/2},xe=t=>{t.getAllEdges().forEach((e=>{if(e.data.width&&e.data.height){const r=t.getNode(e.source),n={e:e,rank:(t.getNode(e.target).data.rank-r.data.rank)/2+r.data.rank};B(t,"edge-proxy",n,"_ep")}}))},be=t=>{let e=0;return t.getAllNodes().forEach((r=>{var n,o;r.data.borderTop&&(r.data.minRank=null===(n=t.getNode(r.data.borderTop))||void 0===n?void 0:n.data.rank,r.data.maxRank=null===(o=t.getNode(r.data.borderBottom))||void 0===o?void 0:o.data.rank,e=Math.max(e,r.data.maxRank||-1/0))})),e},Ee=t=>{t.getAllNodes().forEach((e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))}))},Ne=(t,e)=>{let r,n,o=0,i=0;const{marginx:a=0,marginy:s=0}=e||{},u=t=>{if(!t.data)return;const e=t.data.x,a=t.data.y,s=t.data.width,u=t.data.height;isNaN(e)||isNaN(s)||(void 0===r&&(r=e-s/2),r=Math.min(r,e-s/2),o=Math.max(o,e+s/2)),isNaN(a)||isNaN(u)||(void 0===n&&(n=a-u/2),n=Math.min(n,a-u/2),i=Math.max(i,a+u/2))};return t.getAllNodes().forEach((t=>{u(t)})),t.getAllEdges().forEach((t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&u(t)})),r-=a,n-=s,t.getAllNodes().forEach((t=>{t.data.x-=r,t.data.y-=n})),t.getAllEdges().forEach((t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach((t=>{t.x-=r,t.y-=n})),t.data.hasOwnProperty("x")&&(t.data.x-=r),t.data.hasOwnProperty("y")&&(t.data.y-=n)})),{width:o-r+a,height:i-n+s}},Me=t=>{t.getAllEdges().forEach((e=>{const r=t.getNode(e.source),n=t.getNode(e.target);let o,i;e.data.points?(o=e.data.points[0],i=e.data.points[e.data.points.length-1]):(e.data.points=[],o={x:n.data.x,y:n.data.y},i={x:r.data.x,y:r.data.y}),e.data.points.unshift(W(r.data,o)),e.data.points.push(W(n.data,i))}))},_e=t=>{t.getAllEdges().forEach((t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}}))},ke=t=>{t.getAllEdges().forEach((t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())}))},Ae=t=>{t.getAllNodes().forEach((e=>{var r,n,o;if(null===(r=t.getChildren(e.id))||void 0===r?void 0:r.length){const r=t.getNode(e.id),i=t.getNode(r.data.borderTop),a=t.getNode(r.data.borderBottom),s=t.getNode(r.data.borderLeft[(null===(n=r.data.borderLeft)||void 0===n?void 0:n.length)-1]),u=t.getNode(r.data.borderRight[(null===(o=r.data.borderRight)||void 0===o?void 0:o.length)-1]);r.data.width=Math.abs((null==u?void 0:u.data.x)-(null==s?void 0:s.data.x))||10,r.data.height=Math.abs((null==a?void 0:a.data.y)-(null==i?void 0:i.data.y))||10,r.data.x=((null==s?void 0:s.data.x)||0)+r.data.width/2,r.data.y=((null==i?void 0:i.data.y)||0)+r.data.height/2}})),t.getAllNodes().forEach((e=>{"border"===e.data.dummy&&t.removeNode(e.id)}))},je=t=>{t.getAllEdges().forEach((e=>{if(e.source===e.target){const r=t.getNode(e.source);r.data.selfEdges||(r.data.selfEdges=[]),r.data.selfEdges.push(e),t.removeEdge(e.id)}}))},Oe=t=>{const e=$(t);null==e||e.forEach((e=>{let r=0;null==e||e.forEach(((e,n)=>{var o;const i=t.getNode(e);i.data.order=n+r,null===(o=i.data.selfEdges)||void 0===o||o.forEach((e=>{B(t,"selfedge",{width:e.data.width,height:e.data.height,rank:i.data.rank,order:n+ ++r,e:e},"_se")})),delete i.data.selfEdges}))}))},Se=t=>{t.getAllNodes().forEach((e=>{const r=t.getNode(e.id);if("selfedge"===r.data.dummy){const n=t.getNode(r.data.e.source),o=n.data.x+n.data.width/2,i=n.data.y,a=r.data.x-o,s=n.data.height/2;t.hasEdge(r.data.e.id)?t.updateEdgeData(r.data.e.id,r.data.e.data):t.addEdge({id:r.data.e.id,source:r.data.e.source,target:r.data.e.target,data:r.data.e.data}),t.removeNode(e.id),r.data.e.data.points=[{x:o+2*a/3,y:i-s},{x:o+5*a/6,y:i-s},{y:i,x:o+a},{x:o+5*a/6,y:i+s},{x:o+2*a/3,y:i+s}],r.data.e.data.x=r.data.x,r.data.e.data.y=r.data.y}}))},ze=(t,e)=>{const r={};return null==e||e.forEach((e=>{void 0!==t[e]&&(r[e]=+t[e])})),r},Re=(t={})=>{const e={};return Object.keys(t).forEach((r=>{e[r.toLowerCase()]=t[r]})),e};function Ie(t){return"function"==typeof t}var Pe=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Te(t){if(!t)return[0,0,0];if(S(t))return[t,t,t];if(0===t.length)return[0,0,0];const[e,r=e,n=e]=t;return[e,r,n]}function Ce(t,e){let r;return r=Ie(e)?e:S(e)?()=>e:()=>t,r}function De(t,e,r=!0){return e||0===e?Ie(e)?e:S(e)?()=>e:Array.isArray(e)?()=>r?Math.max(...e)||t:e:Pe(e)&&e.width&&e.height?()=>r?Math.max(e.width,e.height)||t:[e.width,e.height]:()=>t:e=>{const{size:n}=e.data||{};return n?Array.isArray(n)?r?Math.max(...n)||t:n:Pe(n)&&n.width&&n.height?r?Math.max(n.width,n.height)||t:[n.width,n.height]:n:t}}const Le=(t,e,r=10)=>{let n;const o="function"==typeof e?e:()=>e||0;n=t?Array.isArray(t)?e=>t:Ie(t)?t:e=>t:t=>{var e,n,o;if(null===(e=t.data)||void 0===e?void 0:e.bboxSize)return null===(n=t.data)||void 0===n?void 0:n.bboxSize;if(null===(o=t.data)||void 0===o?void 0:o.size){const e=t.data.size;return Array.isArray(e)?e:Pe(e)?[e.width,e.height]:e}return r};return t=>{const e=n(t),r=o(t);return Math.max(...Te(e))+r}},Fe=t=>{if(null===t)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof Array){const e=[];return t.forEach((t=>{e.push(t)})),e.map((t=>Fe(t)))}if("object"==typeof t){const e={};return Object.keys(t).forEach((r=>{e[r]=Fe(t[r])})),e}return t},qe=(t,e)=>{const r=Fe(t);return r.data=r.data||{},e&&(S(r.data.x)||(r.data.x=Math.random()*e[0]),S(r.data.y)||(r.data.y=Math.random()*e[1])),r},Ve={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};const Be=(t,e,r,n,o,i,a)=>{let s=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&r){let{x:t,y:u}=e.data,{x:c,y:h}=r.data;if(o&&(t=e.data.y,u=e.data.x,c=r.data.y,h=r.data.x),h!==u&&t!==c){const d=n.indexOf(u),f=n[d+1];if(f){const t=s[0],e=o?{x:(u+f)/2,y:(null==t?void 0:t.y)||c}:{x:(null==t?void 0:t.x)||c,y:(u+f)/2};t&&!i(t,e)||s.unshift(e)}const l=n.indexOf(h),g=Math.abs(l-d);if(1===g)s=a(s,e.data,r.data),s.length||s.push(o?{x:(u+h)/2,y:t}:{x:t,y:(u+h)/2});else if(g>1){const e=n[l-1];if(e){const r=s[s.length-1],n=o?{x:(h+e)/2,y:(null==r?void 0:r.y)||c}:{x:(null==r?void 0:r.x)||t,y:(h+e)/2};r&&!i(r,n)||s.push(n)}}}}return s},Ge=(t,e,r)=>{const n=t.getAllNodes(),o=t.getAllEdges();if(!(null==n?void 0:n.length)){return{nodes:[],edges:o}}if(1===n.length){e&&t.mergeNodeData(n[0].id,{x:r[0],y:r[1]});return{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:r[0],y:r[1]})})],edges:o}}},Ue={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};const We=(t,e,r=!1)=>{const n=[qe(e[0])],o={},i=e.length;o[e[0].id]=!0;let a=0;return e.forEach(((s,u)=>{if(0!==u)if(u!==i-1&&t.getDegree(s.id,"both")===t.getDegree(e[u+1].id,"both")&&!t.areNeighbors(n[a].id,s.id)||o[s.id]){const u=r?t.getSuccessors(n[a].id):t.getNeighbors(n[a].id);let c=!1;for(let e=0;e<u.length;e++){const r=u[e];if(t.getDegree(r.id)===t.getDegree(s.id)&&!o[r.id]){n.push(qe(r)),o[r.id]=!0,c=!0;break}}let h=0;for(;!c&&(o[e[h].id]||(n.push(qe(e[h])),o[e[h].id]=!0,c=!0),h++,h!==i););}else n.push(qe(s)),o[s.id]=!0,a++})),n};const $e=(t,e,r)=>{let n=t,o=e,i=r;return n||"undefined"==typeof window||(n=window.innerWidth),o||"undefined"==typeof window||(o=window.innerHeight),i||(i=[n/2,o/2]),[n,o,i]};function Ye(t){return"string"==typeof t}const He=Array.isArray,Ke={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class Je{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},Ke),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericConcentricLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericConcentricLayout(!0,t,r)}))}genericConcentricLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:a,sortBy:s,maxLevelDiff:u,sweep:c,clockwise:h,equidistant:d,preventOverlap:f,startAngle:l=1.5*Math.PI,nodeSize:g,nodeSpacing:v}=e,p=r.getAllNodes(),y=r.getAllEdges(),m=i||"undefined"==typeof window?i:window.innerWidth,w=a||"undefined"==typeof window?a:window.innerHeight,x=o||[m/2,w/2];if(!(null==p?void 0:p.length)||1===p.length)return Ge(r,t,x);const b=[];let E,N=0;He(g)?E=Math.max(g[0],g[1]):Ie(g)?(E=-1/0,p.forEach((t=>{const e=Math.max(...Te(g(t)));e>E&&(E=e)}))):E=g,He(v)?N=Math.max(v[0],v[1]):S(v)&&(N=v),p.forEach((t=>{const e=qe(t);b.push(e);let r=E;const{data:n}=e;He(n.size)?r=Math.max(n.size[0],n.size[1]):S(n.size)?r=n.size:Pe(n.size)&&(r=Math.max(n.size.width,n.size.height)),E=Math.max(E,r),Ie(v)&&(N=Math.max(v(t),N))}));const M={};b.forEach(((t,e)=>{M[t.id]=e}));let _=s;Ye(_)&&void 0!==b[0].data[_]||(_="degree"),"degree"===_?b.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):b.sort(((t,e)=>e.data[_]-t.data[_]));const k=b[0],A=(u||("degree"===_?r.getDegree(k.id,"both"):k.data[_]))/4,j=[{nodes:[]}];let O=j[0];b.forEach((t=>{if(O.nodes.length>0){const e="degree"===_?Math.abs(r.getDegree(O.nodes[0].id,"both")-r.getDegree(t.id,"both")):Math.abs(O.nodes[0].data[_]-t.data[_]);A&&e>=A&&(O={nodes:[]},j.push(O))}O.nodes.push(t)}));let z=E+N;if(!f){const t=j.length>0&&j[0].nodes.length>1,e=(Math.min(m,w)/2-z)/(j.length+(t?1:0));z=Math.min(z,e)}let R=0;if(j.forEach((t=>{const e=void 0===c?2*Math.PI-2*Math.PI/t.nodes.length:c;if(t.dTheta=e/Math.max(1,t.nodes.length-1),t.nodes.length>1&&f){const e=Math.cos(t.dTheta)-Math.cos(0),r=Math.sin(t.dTheta)-Math.sin(0),n=Math.sqrt(z*z/(e*e+r*r));R=Math.max(n,R)}t.r=R,R+=z})),d){let t=0,e=0;for(let r=0;r<j.length;r++){const n=(j[r].r||0)-e;t=Math.max(t,n)}e=0,j.forEach(((r,n)=>{0===n&&(e=r.r||0),r.r=e,e+=t}))}j.forEach((t=>{const e=t.dTheta||0,r=t.r||0;t.nodes.forEach(((t,n)=>{const o=l+(h?1:-1)*e*n;t.data.x=x[0]+r*Math.cos(o),t.data.y=x[1]+r*Math.sin(o)}))})),t&&b.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:b,edges:y}}))}}function Qe(t,e,r,n){if(isNaN(e)||isNaN(r))return t;var o,i,a,s,u,c,h,d,f,l=t._root,g={data:n},v=t._x0,p=t._y0,y=t._x1,m=t._y1;if(!l)return t._root=g,t;for(;l.length;)if((c=e>=(i=(v+y)/2))?v=i:y=i,(h=r>=(a=(p+m)/2))?p=a:m=a,o=l,!(l=l[d=h<<1|c]))return o[d]=g,t;if(s=+t._x.call(null,l.data),u=+t._y.call(null,l.data),e===s&&r===u)return g.next=l,o?o[d]=g:t._root=g,t;do{o=o?o[d]=new Array(4):t._root=new Array(4),(c=e>=(i=(v+y)/2))?v=i:y=i,(h=r>=(a=(p+m)/2))?p=a:m=a}while((d=h<<1|c)==(f=(u>=a)<<1|s>=i));return o[f]=l,o[d]=g,t}function Xe(t,e,r,n,o){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=o}function Ze(t){return t[0]}function tr(t){return t[1]}function er(t,e,r){var n=new rr(null==e?Ze:e,null==r?tr:r,NaN,NaN,NaN,NaN);return null==t?n:n.addAll(t)}function rr(t,e,r,n,o,i){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=o,this._y1=i,this._root=void 0}function nr(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var or=er.prototype=rr.prototype;function ir(t,e,r,n,o){if(isNaN(e)||isNaN(r)||isNaN(n))return t;var i,a,s,u,c,h,d,f,l,g,v,p,y=t._root,m={data:o},w=t._x0,x=t._y0,b=t._z0,E=t._x1,N=t._y1,M=t._z1;if(!y)return t._root=m,t;for(;y.length;)if((f=e>=(a=(w+E)/2))?w=a:E=a,(l=r>=(s=(x+N)/2))?x=s:N=s,(g=n>=(u=(b+M)/2))?b=u:M=u,i=y,!(y=y[v=g<<2|l<<1|f]))return i[v]=m,t;if(c=+t._x.call(null,y.data),h=+t._y.call(null,y.data),d=+t._z.call(null,y.data),e===c&&r===h&&n===d)return m.next=y,i?i[v]=m:t._root=m,t;do{i=i?i[v]=new Array(8):t._root=new Array(8),(f=e>=(a=(w+E)/2))?w=a:E=a,(l=r>=(s=(x+N)/2))?x=s:N=s,(g=n>=(u=(b+M)/2))?b=u:M=u}while((v=g<<2|l<<1|f)==(p=(d>=u)<<2|(h>=s)<<1|c>=a));return i[p]=y,i[v]=m,t}function ar(t,e,r,n,o,i,a){this.node=t,this.x0=e,this.y0=r,this.z0=n,this.x1=o,this.y1=i,this.z1=a}or.copy=function(){var t,e,r=new rr(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=nr(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var o=0;o<4;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(4)}):n.target[o]=nr(e));return r},or.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t);return Qe(this.cover(e,r),e,r,t)},or.addAll=function(t){var e,r,n,o,i=t.length,a=new Array(i),s=new Array(i),u=1/0,c=1/0,h=-1/0,d=-1/0;for(r=0;r<i;++r)isNaN(n=+this._x.call(null,e=t[r]))||isNaN(o=+this._y.call(null,e))||(a[r]=n,s[r]=o,n<u&&(u=n),n>h&&(h=n),o<c&&(c=o),o>d&&(d=o));if(u>h||c>d)return this;for(this.cover(u,c).cover(h,d),r=0;r<i;++r)Qe(this,a[r],s[r],t[r]);return this},or.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,o=this._x1,i=this._y1;if(isNaN(r))o=(r=Math.floor(t))+1,i=(n=Math.floor(e))+1;else{for(var a,s,u=o-r||1,c=this._root;r>t||t>=o||n>e||e>=i;)switch(s=(e<n)<<1|t<r,(a=new Array(4))[s]=c,c=a,u*=2,s){case 0:o=r+u,i=n+u;break;case 1:r=o-u,i=n+u;break;case 2:o=r+u,n=i-u;break;case 3:r=o-u,n=i-u}this._root&&this._root.length&&(this._root=c)}return this._x0=r,this._y0=n,this._x1=o,this._y1=i,this},or.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},or.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},or.find=function(t,e,r){var n,o,i,a,s,u,c,h=this._x0,d=this._y0,f=this._x1,l=this._y1,g=[],v=this._root;for(v&&g.push(new Xe(v,h,d,f,l)),null==r?r=1/0:(h=t-r,d=e-r,f=t+r,l=e+r,r*=r);u=g.pop();)if(!(!(v=u.node)||(o=u.x0)>f||(i=u.y0)>l||(a=u.x1)<h||(s=u.y1)<d))if(v.length){var p=(o+a)/2,y=(i+s)/2;g.push(new Xe(v[3],p,y,a,s),new Xe(v[2],o,y,p,s),new Xe(v[1],p,i,a,y),new Xe(v[0],o,i,p,y)),(c=(e>=y)<<1|t>=p)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-c],g[g.length-1-c]=u)}else{var m=t-+this._x.call(null,v.data),w=e-+this._y.call(null,v.data),x=m*m+w*w;if(x<r){var b=Math.sqrt(r=x);h=t-b,d=e-b,f=t+b,l=e+b,n=v.data}}return n},or.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,r,n,o,i,a,s,u,c,h,d,f,l=this._root,g=this._x0,v=this._y0,p=this._x1,y=this._y1;if(!l)return this;if(l.length)for(;;){if((c=i>=(s=(g+p)/2))?g=s:p=s,(h=a>=(u=(v+y)/2))?v=u:y=u,e=l,!(l=l[d=h<<1|c]))return this;if(!l.length)break;(e[d+1&3]||e[d+2&3]||e[d+3&3])&&(r=e,f=d)}for(;l.data!==t;)if(n=l,!(l=l.next))return this;return(o=l.next)&&delete l.next,n?(o?n.next=o:delete n.next,this):e?(o?e[d]=o:delete e[d],(l=e[0]||e[1]||e[2]||e[3])&&l===(e[3]||e[2]||e[1]||e[0])&&!l.length&&(r?r[f]=l:this._root=l),this):(this._root=o,this)},or.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},or.root=function(){return this._root},or.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},or.visit=function(t){var e,r,n,o,i,a,s=[],u=this._root;for(u&&s.push(new Xe(u,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(u=e.node,n=e.x0,o=e.y0,i=e.x1,a=e.y1)&&u.length){var c=(n+i)/2,h=(o+a)/2;(r=u[3])&&s.push(new Xe(r,c,h,i,a)),(r=u[2])&&s.push(new Xe(r,n,h,c,a)),(r=u[1])&&s.push(new Xe(r,c,o,i,h)),(r=u[0])&&s.push(new Xe(r,n,o,c,h))}return this},or.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new Xe(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var o=e.node;if(o.length){var i,a=e.x0,s=e.y0,u=e.x1,c=e.y1,h=(a+u)/2,d=(s+c)/2;(i=o[0])&&r.push(new Xe(i,a,s,h,d)),(i=o[1])&&r.push(new Xe(i,h,s,u,d)),(i=o[2])&&r.push(new Xe(i,a,d,h,c)),(i=o[3])&&r.push(new Xe(i,h,d,u,c))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},or.x=function(t){return arguments.length?(this._x=t,this):this._x},or.y=function(t){return arguments.length?(this._y=t,this):this._y};const sr=(t,e,r,n,o,i)=>Math.sqrt((t-n)**2+(e-o)**2+(r-i)**2);function ur(t){return t[0]}function cr(t){return t[1]}function hr(t){return t[2]}function dr(t,e,r,n){var o=new fr(null==e?ur:e,null==r?cr:r,null==n?hr:n,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function fr(t,e,r,n,o,i,a,s,u){this._x=t,this._y=e,this._z=r,this._x0=n,this._y0=o,this._z0=i,this._x1=a,this._y1=s,this._z1=u,this._root=void 0}function lr(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var gr=dr.prototype=fr.prototype;gr.copy=function(){var t,e,r=new fr(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),n=this._root;if(!n)return r;if(!n.length)return r._root=lr(n),r;for(t=[{source:n,target:r._root=new Array(8)}];n=t.pop();)for(var o=0;o<8;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(8)}):n.target[o]=lr(e));return r},gr.add=function(t){const e=+this._x.call(null,t),r=+this._y.call(null,t),n=+this._z.call(null,t);return ir(this.cover(e,r,n),e,r,n,t)},gr.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e),n=new Float64Array(e),o=new Float64Array(e);let i=1/0,a=1/0,s=1/0,u=-1/0,c=-1/0,h=-1/0;for(let d,f,l,g,v=0;v<e;++v)isNaN(f=+this._x.call(null,d=t[v]))||isNaN(l=+this._y.call(null,d))||isNaN(g=+this._z.call(null,d))||(r[v]=f,n[v]=l,o[v]=g,f<i&&(i=f),f>u&&(u=f),l<a&&(a=l),l>c&&(c=l),g<s&&(s=g),g>h&&(h=g));if(i>u||a>c||s>h)return this;this.cover(i,a,s).cover(u,c,h);for(let i=0;i<e;++i)ir(this,r[i],n[i],o[i],t[i]);return this},gr.cover=function(t,e,r){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(r=+r))return this;var n=this._x0,o=this._y0,i=this._z0,a=this._x1,s=this._y1,u=this._z1;if(isNaN(n))a=(n=Math.floor(t))+1,s=(o=Math.floor(e))+1,u=(i=Math.floor(r))+1;else{for(var c,h,d=a-n||1,f=this._root;n>t||t>=a||o>e||e>=s||i>r||r>=u;)switch(h=(r<i)<<2|(e<o)<<1|t<n,(c=new Array(8))[h]=f,f=c,d*=2,h){case 0:a=n+d,s=o+d,u=i+d;break;case 1:n=a-d,s=o+d,u=i+d;break;case 2:a=n+d,o=s-d,u=i+d;break;case 3:n=a-d,o=s-d,u=i+d;break;case 4:a=n+d,s=o+d,i=u-d;break;case 5:n=a-d,s=o+d,i=u-d;break;case 6:a=n+d,o=s-d,i=u-d;break;case 7:n=a-d,o=s-d,i=u-d}this._root&&this._root.length&&(this._root=f)}return this._x0=n,this._y0=o,this._z0=i,this._x1=a,this._y1=s,this._z1=u,this},gr.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},gr.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},gr.find=function(t,e,r,n){var o,i,a,s,u,c,h,d,f,l=this._x0,g=this._y0,v=this._z0,p=this._x1,y=this._y1,m=this._z1,w=[],x=this._root;for(x&&w.push(new ar(x,l,g,v,p,y,m)),null==n?n=1/0:(l=t-n,g=e-n,v=r-n,p=t+n,y=e+n,m=r+n,n*=n);d=w.pop();)if(!(!(x=d.node)||(i=d.x0)>p||(a=d.y0)>y||(s=d.z0)>m||(u=d.x1)<l||(c=d.y1)<g||(h=d.z1)<v))if(x.length){var b=(i+u)/2,E=(a+c)/2,N=(s+h)/2;w.push(new ar(x[7],b,E,N,u,c,h),new ar(x[6],i,E,N,b,c,h),new ar(x[5],b,a,N,u,E,h),new ar(x[4],i,a,N,b,E,h),new ar(x[3],b,E,s,u,c,N),new ar(x[2],i,E,s,b,c,N),new ar(x[1],b,a,s,u,E,N),new ar(x[0],i,a,s,b,E,N)),(f=(r>=N)<<2|(e>=E)<<1|t>=b)&&(d=w[w.length-1],w[w.length-1]=w[w.length-1-f],w[w.length-1-f]=d)}else{var M=t-+this._x.call(null,x.data),_=e-+this._y.call(null,x.data),k=r-+this._z.call(null,x.data),A=M*M+_*_+k*k;if(A<n){var j=Math.sqrt(n=A);l=t-j,g=e-j,v=r-j,p=t+j,y=e+j,m=r+j,o=x.data}}return o},gr.findAllWithinRadius=function(t,e,r,n){const o=[],i=t-n,a=e-n,s=r-n,u=t+n,c=e+n,h=r+n;return this.visit(((d,f,l,g,v,p,y)=>{if(!d.length)do{const i=d.data;sr(t,e,r,this._x(i),this._y(i),this._z(i))<=n&&o.push(i)}while(d=d.next);return f>u||l>c||g>h||v<i||p<a||y<s})),o},gr.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))return this;var e,r,n,o,i,a,s,u,c,h,d,f,l,g,v,p=this._root,y=this._x0,m=this._y0,w=this._z0,x=this._x1,b=this._y1,E=this._z1;if(!p)return this;if(p.length)for(;;){if((d=i>=(u=(y+x)/2))?y=u:x=u,(f=a>=(c=(m+b)/2))?m=c:b=c,(l=s>=(h=(w+E)/2))?w=h:E=h,e=p,!(p=p[g=l<<2|f<<1|d]))return this;if(!p.length)break;(e[g+1&7]||e[g+2&7]||e[g+3&7]||e[g+4&7]||e[g+5&7]||e[g+6&7]||e[g+7&7])&&(r=e,v=g)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(o=p.next)&&delete p.next,n?(o?n.next=o:delete n.next,this):e?(o?e[g]=o:delete e[g],(p=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&p===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!p.length&&(r?r[v]=p:this._root=p),this):(this._root=o,this)},gr.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},gr.root=function(){return this._root},gr.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},gr.visit=function(t){var e,r,n,o,i,a,s,u,c=[],h=this._root;for(h&&c.push(new ar(h,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=c.pop();)if(!t(h=e.node,n=e.x0,o=e.y0,i=e.z0,a=e.x1,s=e.y1,u=e.z1)&&h.length){var d=(n+a)/2,f=(o+s)/2,l=(i+u)/2;(r=h[7])&&c.push(new ar(r,d,f,l,a,s,u)),(r=h[6])&&c.push(new ar(r,n,f,l,d,s,u)),(r=h[5])&&c.push(new ar(r,d,o,l,a,f,u)),(r=h[4])&&c.push(new ar(r,n,o,l,d,f,u)),(r=h[3])&&c.push(new ar(r,d,f,i,a,s,l)),(r=h[2])&&c.push(new ar(r,n,f,i,d,s,l)),(r=h[1])&&c.push(new ar(r,d,o,i,a,f,l)),(r=h[0])&&c.push(new ar(r,n,o,i,d,f,l))}return this},gr.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new ar(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=r.pop();){var o=e.node;if(o.length){var i,a=e.x0,s=e.y0,u=e.z0,c=e.x1,h=e.y1,d=e.z1,f=(a+c)/2,l=(s+h)/2,g=(u+d)/2;(i=o[0])&&r.push(new ar(i,a,s,u,f,l,g)),(i=o[1])&&r.push(new ar(i,f,s,u,c,l,g)),(i=o[2])&&r.push(new ar(i,a,l,u,f,h,g)),(i=o[3])&&r.push(new ar(i,f,l,u,c,h,g)),(i=o[4])&&r.push(new ar(i,a,s,g,f,l,d)),(i=o[5])&&r.push(new ar(i,f,s,g,c,l,d)),(i=o[6])&&r.push(new ar(i,a,l,g,f,h,d)),(i=o[7])&&r.push(new ar(i,f,l,g,c,h,d))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},gr.x=function(t){return arguments.length?(this._x=t,this):this._x},gr.y=function(t){return arguments.length?(this._y=t,this):this._y},gr.z=function(t){return arguments.length?(this._z=t,this):this._z};const vr=.1;function pr(t,e,r,n,o=2){const i=e/r,a=t.getAllNodes(),s=a.map(((t,e)=>{const{nodeStrength:r,x:n,y:o,z:a,size:s}=t.data;return{x:n,y:o,z:a,size:s,index:e,id:t.id,vx:0,vy:0,vz:0,weight:i*r}})),u=(2===o?er(s,(t=>t.x),(t=>t.y)):dr(s,(t=>t.x),(t=>t.y),(t=>t.z))).visitAfter(yr),c=new Map;return s.forEach((t=>{c.set(t.id,t),function(t,e,r){e.visit(((e,n,o,i,a)=>((t,e,r,n,o,i,a)=>{var s;if((null===(s=t.data)||void 0===s?void 0:s.id)===i.id)return;const u=[r,n,o][a-1],c=i.x-t.x||vr,h=i.y-t.y||vr,d=i.z-t.z||vr,f=[c,h,d],l=u-e;let g=0;for(let t=0;t<a;t++)g+=f[t]*f[t];const v=Math.sqrt(g)*g;if(l*l*.81<g){const e=t.weight/v;return i.vx+=c*e,i.vy+=h*e,i.vz+=d*e,!0}if(t.length)return!1;if(t.data!==i){const e=t.data.weight/v;i.vx+=c*e,i.vy+=h*e,i.vz+=d*e}})(e,n,o,i,a,t,r)))}(t,u,o)})),s.map(((t,e)=>{const{id:r,data:o}=a[e],{mass:i=1}=o;n[r]={x:t.vx/i,y:t.vy/i,z:t.vz/i}})),n}function yr(t){let e=0,r=0,n=0,o=0,i=0;const a=t.length;if(a){for(let s=0;s<a;s++){const a=t[s];a&&a.weight&&(e+=a.weight,r+=a.x*a.weight,n+=a.y*a.weight,o+=a.z*a.weight,i+=a.size*a.weight)}t.x=r/e,t.y=n/e,t.z=o/e,t.size=i/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}const mr={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class wr{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},mr),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericForceLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericForceLayout(!0,t,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;(this.judgingDistance>this.lastOptions.minMovement||e<1)&&e<t;e++)this.runOneStep(this.lastCalcGraph,this.lastGraph,e,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericForceLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),o=r.getAllNodes(),i=r.getAllEdges(),a=this.formatOptions(e,r),{dimensions:s,width:u,height:h,nodeSize:d,getMass:f,nodeStrength:l,edgeStrength:g,linkDistance:v}=a,p=o.map(((t,e)=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{x:S(t.data.x)?t.data.x:Math.random()*u,y:S(t.data.y)?t.data.y:Math.random()*h,z:S(t.data.z)?t.data.z:Math.random()*Math.sqrt(u*h),size:d(t)||30,mass:f(t),nodeStrength:l(t)})}))),y=i.map((t=>Object.assign(Object.assign({},t),{data:Object.assign(Object.assign({},t.data),{edgeStrength:g(t),linkDistance:v(t,r.getNode(t.source),r.getNode(t.target))})})));if(!(null==o?void 0:o.length))return this.lastResult={nodes:[],edges:i},{nodes:[],edges:i};const m={};o.forEach(((t,e)=>{m[t.id]={x:0,y:0,z:0}}));const w=new c({nodes:p,edges:y});this.formatCentripetal(a,w);const{maxIteration:x,minMovement:b,onTick:E}=a;if(this.lastLayoutNodes=p,this.lastLayoutEdges=y,this.lastAssign=t,this.lastGraph=r,this.lastCalcGraph=w,this.lastOptions=a,this.lastVelMap=m,"undefined"==typeof window)return;let N=0;return new Promise((e=>{this.timeInterval=window.setInterval((()=>{o&&this.running||e({nodes:Mr(r,p),edges:i}),this.runOneStep(w,r,N,m,a),this.updatePosition(r,w,m,a),t&&p.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===s?t.data.z:void 0}))),null==E||E({nodes:Mr(r,p),edges:i}),N++,(N>=x||this.judgingDistance<b)&&(window.clearInterval(this.timeInterval),e({nodes:Mr(r,p),edges:i}))}),0),this.running=!0}))}))}formatOptions(t,e){const r=Object.assign({},t),{width:n,height:o,getMass:i}=t;r.width=n||"undefined"==typeof window?n:window.innerWidth,r.height=o||"undefined"==typeof window?o:window.innerHeight,t.center||(r.center=[r.width/2,r.height/2]),i||(r.getMass=t=>{let r=1;S(null==t?void 0:t.data.mass)&&(r=null==t?void 0:t.data.mass);const n=e.getDegree(t.id,"both");return!n||n<5?r:5*n*r}),r.nodeSize=Le(t.nodeSize,t.nodeSpacing);const a=t.linkDistance?Ce(1,t.linkDistance):t=>1+r.nodeSize(e.getNode(t.source))+r.nodeSize(e.getNode(t.target));return r.linkDistance=a,r.nodeStrength=Ce(1,t.nodeStrength),r.edgeStrength=Ce(1,t.edgeStrength),r}formatCentripetal(t,e){const{dimensions:r,centripetalOptions:n,center:o,clusterNodeStrength:i,leafCluster:a,clustering:s,nodeClusterBy:u}=t,c=e.getAllNodes(),h=n||{leaf:2,single:2,others:1,center:t=>({x:o[0],y:o[1],z:3===r?o[2]:void 0})};let d,f;if("function"!=typeof i&&(t.clusterNodeStrength=t=>i),a&&u&&(d=xr(e,u),f=Array.from(new Set(null==c?void 0:c.map((t=>t.data[u]))))||[],t.centripetalOptions=Object.assign(h,{single:100,leaf:e=>{const{siblingLeaves:r,sameTypeLeaves:n}=d[e.id]||{};return(null==n?void 0:n.length)===(null==r?void 0:r.length)||1===(null==f?void 0:f.length)?1:t.clusterNodeStrength(e)},others:1,center:t=>{const r=e.getDegree(t.id,"both");if(!r)return{x:100,y:100,z:0};let n;if(1===r){const{sameTypeLeaves:e=[]}=d[t.id]||{};1===e.length?n=void 0:e.length>1&&(n=Nr(e))}else n=void 0;return{x:null==n?void 0:n.x,y:null==n?void 0:n.y,z:null==n?void 0:n.z}}})),s&&u){d||(d=xr(e,u)),f||(f=Array.from(new Set(c.map((t=>t.data[u]))))),f=f.filter((t=>void 0!==t));const r={};f.forEach((t=>{const n=c.filter((e=>e.data[u]===t)).map((t=>e.getNode(t.id)));r[t]=Nr(n)})),t.centripetalOptions=Object.assign(h,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=r[t.data[u]];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}const{leaf:l,single:g,others:v}=t.centripetalOptions||{};l&&"function"!=typeof l&&(t.centripetalOptions.leaf=()=>l),g&&"function"!=typeof g&&(t.centripetalOptions.single=()=>g),v&&"function"!=typeof v&&(t.centripetalOptions.others=()=>v)}runOneStep(t,e,r,n,o){const i={},a=t.getAllNodes(),s=t.getAllEdges();if(!(null==a?void 0:a.length))return;const{monitor:u}=o;if(this.calRepulsive(t,i,o),s&&this.calAttractive(t,i,o),this.calGravity(t,e,i,o),this.updateVelocity(t,i,n,o),u){u({energy:this.calTotalEnergy(i,a),nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:r})}}calTotalEnergy(t,e){if(!(null==e?void 0:e.length))return 0;let r=0;return e.forEach(((e,n)=>{const o=t[e.id].x,i=t[e.id].y,a=3===this.options.dimensions?t[e.id].z:0,s=o*o+i*i+a*a,{mass:u=1}=e.data;r+=u*s*.5})),r}calRepulsive(t,e,r){const{dimensions:n,factor:o,coulombDisScale:i}=r;pr(t,o,i*i,e,n)}calAttractive(t,e,r){const{dimensions:n,nodeSize:o}=r;t.getAllEdges().forEach(((r,i)=>{const{source:a,target:s}=r,u=t.getNode(a),c=t.getNode(s);if(!u||!c)return;let h=c.data.x-u.data.x,d=c.data.y-u.data.y,f=3===n?c.data.z-u.data.z:0;h||d||(h=.01*Math.random(),d=.01*Math.random(),3!==n||f||(f=.01*Math.random()));const l=Math.sqrt(h*h+d*d+f*f);if(l<o(u)+o(c))return;const g=h/l,v=d/l,p=f/l,{linkDistance:y=200,edgeStrength:m=200}=r.data||{},w=(y-l)*m,x=1/(u.data.mass||1),b=1/(c.data.mass||1),E=g*w,N=v*w,M=p*w;e[a].x-=E*x,e[a].y-=N*x,e[a].z-=M*x,e[s].x+=E*b,e[s].y+=N*b,e[s].z+=M*b}))}calGravity(t,e,r,n){const{getCenter:o}=n,i=t.getAllNodes(),a=e.getAllNodes(),s=e.getAllEdges(),{width:u,height:c,center:h,gravity:d,centripetalOptions:f}=n;i&&i.forEach((n=>{const{id:i,data:l}=n,{mass:g,x:v,y:p,z:y}=l,m=e.getNode(i);let w=0,x=0,b=0,E=d;const N=t.getDegree(i,"in"),M=t.getDegree(i,"out"),_=t.getDegree(i,"both"),k=null==o?void 0:o(m,_);if(k){const[t,e,r]=k;w=v-t,x=p-e,E=r}else w=v-h[0],x=p-h[1],b=y-h[2];if(E&&(r[i].x-=E*w/g,r[i].y-=E*x/g,r[i].z-=E*b/g),f){const{leaf:t,single:e,others:n,center:o}=f,{x:h,y:d,z:l,centerStrength:w}=(null==o?void 0:o(m,a,s,u,c))||{x:0,y:0,z:0,centerStrength:0};if(!S(h)||!S(d))return;const x=(v-h)/g,b=(p-d)/g,E=(y-l)/g;if(w&&(r[i].x-=w*x,r[i].y-=w*b,r[i].z-=w*E),0===_){const t=e(m);if(!t)return;return r[i].x-=t*x,r[i].y-=t*b,void(r[i].z-=t*E)}if(0===N||0===M){const e=t(m,a,s);if(!e)return;return r[i].x-=e*x,r[i].y-=e*b,void(r[i].z-=e*E)}const k=n(m);if(!k)return;r[i].x-=k*x,r[i].y-=k*b,r[i].z-=k*E}}))}updateVelocity(t,e,r,n){const{damping:o,maxSpeed:i,interval:a,dimensions:s}=n,u=t.getAllNodes();(null==u?void 0:u.length)&&u.forEach((t=>{const{id:n}=t;let u=(r[n].x+e[n].x*a)*o||.01,c=(r[n].y+e[n].y*a)*o||.01,h=3===s?(r[n].z+e[n].z*a)*o||.01:0;const d=Math.sqrt(u*u+c*c+h*h);if(d>i){const t=i/d;u*=t,c*=t,h*=t}r[n]={x:u,y:c,z:h}}))}updatePosition(t,e,r,n){const{distanceThresholdMode:o,interval:i,dimensions:a}=n,s=e.getAllNodes();if(!(null==s?void 0:s.length))return void(this.judgingDistance=0);let u=0;"max"===o?this.judgingDistance=-1/0:"min"===o&&(this.judgingDistance=1/0),s.forEach((n=>{const{id:s}=n,c=t.getNode(s);if(S(c.data.fx)&&S(c.data.fy))return void e.mergeNodeData(s,{x:c.data.fx,y:c.data.fy,z:3===a?c.data.fz:void 0});const h=r[s].x*i,d=r[s].y*i,f=3===a?r[s].z*i:0;e.mergeNodeData(s,{x:n.data.x+h,y:n.data.y+d,z:n.data.z+f});const l=Math.sqrt(h*h+d*d+f*f);switch(o){case"max":this.judgingDistance<l&&(this.judgingDistance=l);break;case"min":this.judgingDistance>l&&(this.judgingDistance=l);break;default:u+=l}})),o&&"mean"!==o||(this.judgingDistance=u/s.length)}}const xr=(t,e)=>{const r=t.getAllNodes();if(!(null==r?void 0:r.length))return{};const n={};return r.forEach(((r,o)=>{1===t.getDegree(r.id,"both")&&(n[r.id]=br(t,"leaf",r,e))})),n},br=(t,e,r,n)=>{const o=t.getDegree(r.id,"in"),i=t.getDegree(r.id,"out");let a=r,s=[];0===o?(a=t.getSuccessors(r.id)[0],s=t.getNeighbors(a.id)):0===i&&(a=t.getPredecessors(r.id)[0],s=t.getNeighbors(a.id)),s=s.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")));return{coreNode:a,siblingLeaves:s,sameTypeLeaves:Er(t,e,n,r,s)}},Er=(t,e,r,n,o)=>{const i=n.data[r]||"";let a=(null==o?void 0:o.filter((t=>t.data[r]===i)))||[];return"leaf"===e&&(a=a.filter((e=>0===t.getDegree(e.id,"in")||0===t.getDegree(e.id,"out")))),a},Nr=t=>{const e={x:0,y:0};t.forEach((t=>{const{x:r,y:n}=t.data;e.x+=r||0,e.y+=n||0}));const r=t.length||1;return{x:e.x/r,y:e.y/r}},Mr=(t,e)=>e.map((e=>{const{id:r,data:n}=e,o=t.getNode(r);return Object.assign(Object.assign({},o),{data:Object.assign(Object.assign({},o.data),{x:n.x,y:n.y,z:n.z})})}));var _r=r(92861),kr=(_r.XA,_r.a_,_r.yQ,_r.Hs,_r.Ec,_r.dx,_r.LU,_r.Rm,_r.y3),Ar=(_r.qK,_r.pb,_r.j,_r.sO,_r.BZ,_r.EK,_r.Db,_r.Fx,_r.tU,_r.Ym,_r.rs,_r.QR,_r.TB,_r.oH,_r.Sc);_r.BN,_r.it,_r.$r,_r.QM,_r.AV,_r.y3,_r.y3,_r.GH,_r.SO,_r.uZ,_r.yU,_r.F1,_r.re;const jr=t=>{const e=[],r=t.length;for(let n=0;n<r;n+=1){e[n]=[];for(let o=0;o<r;o+=1)n===o?e[n][o]=0:0!==t[n][o]&&t[n][o]?e[n][o]=t[n][o]:e[n][o]=1/0}for(let t=0;t<r;t+=1)for(let n=0;n<r;n+=1)for(let o=0;o<r;o+=1)e[n][o]>e[n][t]+e[t][o]&&(e[n][o]=e[n][t]+e[t][o]);return e},Or=(t,e)=>{const{nodes:r,edges:n}=t,o=[],i={};if(!r)throw new Error("invalid nodes data!");return r&&r.forEach(((t,e)=>{i[t.id]=e;o.push([])})),null==n||n.forEach((t=>{const{source:r,target:n}=t,a=i[r],s=i[n];void 0!==a&&void 0!==s&&(o[a][s]=1,e||(o[s][a]=1))})),o},Sr=(t,e)=>Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y)),zr=(t,e,r,n="TB",o,i={})=>{if(!(null==e?void 0:e.length))return;const{stopBranchFn:a,stopAllFn:s}=i;for(let u=0;u<e.length;u++){const c=e[u];if(t.hasNode(c.id)&&!(null==a?void 0:a(c))){if(null==s?void 0:s(c))return;"TB"===n&&r(c),zr(t,t.getChildren(c.id,o),r,n,o,i),"TB"!==n&&r(c)}}},Rr={center:[0,0],linkDistance:50};class Ir{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},Rr),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericMDSLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericMDSLayout(!0,t,r)}))}genericMDSLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o=[0,0],linkDistance:i=50}=e,a=r.getAllNodes(),s=r.getAllEdges();if(!(null==a?void 0:a.length)||1===a.length)return Ge(r,t,o);const u=Or({nodes:a,edges:s},!1),c=jr(u);Pr(c);const h=((t,e)=>{const r=[];return t.forEach((t=>{const n=[];t.forEach((t=>{n.push(t*e)})),r.push(n)})),r})(c,i),d=Tr(h),f=[];d.forEach(((t,e)=>{const r=qe(a[e]);r.data.x=t[0]+o[0],r.data.y=t[1]+o[1],f.push(r)})),t&&f.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:f,edges:s}}))}}const Pr=t=>{let e=-999999;t.forEach((t=>{t.forEach((t=>{t!==1/0&&e<t&&(e=t)}))})),t.forEach(((r,n)=>{r.forEach(((r,o)=>{r===1/0&&(t[n][o]=e)}))}))},Tr=t=>{const e=kr.mul(kr.pow(t,2),-.5),r=e.mean("row"),n=e.mean("column"),o=e.mean();e.add(o).subRowVector(r).subColumnVector(n);const i=new Ar(e),a=kr.sqrt(i.diagonalMatrix).diagonal();return i.leftSingularVectors.toJSON().map((t=>kr.mul([t],[a]).toJSON()[0].splice(0,2)))};function Cr(t){return!!t.tick&&!!t.stop}const Dr={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},Lr={center:[0,0],comboPadding:10,treeKey:"combo"};function Fr(t,r,n,o){var i;return e(this,void 0,void 0,(function*(){return Cr(t)?(t.execute(r,n),t.stop(),t.tick(null!==(i=n.iterations)&&void 0!==i?i:300)):o?yield t.assign(r,n):yield t.execute(r,n)}))}var qr=function(t){return"object"==typeof t&&null!==t},Vr={}.toString,Br=function(t,e){return Vr.call(t)==="[object "+e+"]"},Gr=function(t){if(!qr(t)||!Br(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function Ur(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function Wr(t,e,r,n){for(var o in r=r||0,n=n||5,e)if(Ur(e,o)){var i=e[o];null!==i&&Gr(i)?(Gr(t[o])||(t[o]={}),r<n?Wr(t[o],i,r+1,n):t[o]=e[o]):ht(i)?(t[o]=[],t[o]=t[o].concat(i)):void 0!==i&&(t[o]=i)}}var $r=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];for(var n=0;n<e.length;n+=1)Wr(t,e[n]);return t};var Yr=function(t,e){if(t)if(ht(t))for(var r=0,n=t.length;r<n&&!1!==e(t[r],r);r++);else if(Pe(t))for(var o in t)if(t.hasOwnProperty(o)&&!1===e(t[o],o))break},Hr=Object.prototype.hasOwnProperty,Kr=function(t,e){if(null===t||!Gr(t))return{};var r={};return Yr(e,(function(e){Hr.call(t,e)&&(r[e]=t[e])})),r};function Jr(t){return function(){return t}}function Qr(t){return 1e-6*(t()-.5)}function Xr(t){return t.index}function Zr(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function tn(t){var e,r,n,o,i,a,s=Xr,u=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},c=Jr(30),h=1;function d(n){for(var o=0,s=t.length;o<h;++o)for(var u,c,d,f,l,g,v,p=0;p<s;++p)c=(u=t[p]).source,f=(d=u.target).x+d.vx-c.x-c.vx||Qr(a),l=d.y+d.vy-c.y-c.vy||Qr(a),f*=g=((g=Math.sqrt(f*f+l*l))-r[p])/g*n*e[p],l*=g,d.vx-=f*(v=i[p]),d.vy-=l*v,c.vx+=f*(v=1-v),c.vy+=l*v}function f(){if(n){var a,u,c=n.length,h=t.length,d=new Map(n.map(((t,e)=>[s(t,e,n),t])));for(a=0,o=new Array(c);a<h;++a)(u=t[a]).index=a,"object"!=typeof u.source&&(u.source=Zr(d,u.source)),"object"!=typeof u.target&&(u.target=Zr(d,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(a=0,i=new Array(h);a<h;++a)u=t[a],i[a]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);e=new Array(h),l(),r=new Array(h),g()}}function l(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+u(t[r],r,t)}function g(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+c(t[e],e,t)}return null==t&&(t=[]),d.initialize=function(t,e){n=t,a=e,f()},d.links=function(e){return arguments.length?(t=e,f(),d):t},d.id=function(t){return arguments.length?(s=t,d):s},d.iterations=function(t){return arguments.length?(h=+t,d):h},d.strength=function(t){return arguments.length?(u="function"==typeof t?t:Jr(+t),l(),d):u},d.distance=function(t){return arguments.length?(c="function"==typeof t?t:Jr(+t),g(),d):c},d}var en={value:function(){}};function rn(){for(var t,e=0,r=arguments.length,n={};e<r;++e){if(!(t=arguments[e]+"")||t in n||/[\s.]/.test(t))throw new Error("illegal type: "+t);n[t]=[]}return new nn(n)}function nn(t){this._=t}function on(t,e){return t.trim().split(/^|\s+/).map((function(t){var r="",n=t.indexOf(".");if(n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}}))}function an(t,e){for(var r,n=0,o=t.length;n<o;++n)if((r=t[n]).name===e)return r.value}function sn(t,e,r){for(var n=0,o=t.length;n<o;++n)if(t[n].name===e){t[n]=en,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}nn.prototype=rn.prototype={constructor:nn,on:function(t,e){var r,n=this._,o=on(t+"",n),i=-1,a=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++i<a;)if(r=(t=o[i]).type)n[r]=sn(n[r],t.name,e);else if(null==e)for(r in n)n[r]=sn(n[r],t.name,null);return this}for(;++i<a;)if((r=(t=o[i]).type)&&(r=an(n[r],t.name)))return r},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new nn(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,o=new Array(r),i=0;i<r;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,r=(n=this._[t]).length;i<r;++i)n[i].value.apply(e,o)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,i=n.length;o<i;++o)n[o].value.apply(e,r)}};var un,cn,hn=rn,dn=0,fn=0,ln=0,gn=0,vn=0,pn=0,yn="object"==typeof performance&&performance.now?performance:Date,mn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function wn(){return vn||(mn(xn),vn=yn.now()+pn)}function xn(){vn=0}function bn(){this._call=this._time=this._next=null}function En(t,e,r){var n=new bn;return n.restart(t,e,r),n}function Nn(){vn=(gn=yn.now())+pn,dn=fn=0;try{!function(){wn(),++dn;for(var t,e=un;e;)(t=vn-e._time)>=0&&e._call.call(void 0,t),e=e._next;--dn}()}finally{dn=0,function(){var t,e,r=un,n=1/0;for(;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:un=e);cn=t,_n(n)}(),vn=0}}function Mn(){var t=yn.now(),e=t-gn;e>1e3&&(pn-=e,gn=t)}function _n(t){dn||(fn&&(fn=clearTimeout(fn)),t-vn>24?(t<1/0&&(fn=setTimeout(Nn,t-yn.now()-pn)),ln&&(ln=clearInterval(ln))):(ln||(gn=yn.now(),ln=setInterval(Mn,1e3)),dn=1,mn(Nn)))}bn.prototype=En.prototype={constructor:bn,restart:function(t,e,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?wn():+r)+(null==e?0:+e),this._next||cn===this||(cn?cn._next=this:un=this,cn=this),this._call=t,this._time=r,_n()},stop:function(){this._call&&(this._call=null,this._time=1/0,_n())}};const kn=4294967296;function An(t){return t.x}function jn(t){return t.y}var On=Math.PI*(3-Math.sqrt(5));function Sn(t){var e,r=1,n=.001,o=1-Math.pow(n,1/300),i=0,a=.6,s=new Map,u=En(d),c=hn("tick","end"),h=function(){let t=1;return()=>(t=(1664525*t+1013904223)%kn)/kn}();function d(){f(),c.call("tick",e),r<n&&(u.stop(),c.call("end",e))}function f(n){var u,c,h=t.length;void 0===n&&(n=1);for(var d=0;d<n;++d)for(r+=(i-r)*o,s.forEach((function(t){t(r)})),u=0;u<h;++u)null==(c=t[u]).fx?c.x+=c.vx*=a:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=a:(c.y=c.fy,c.vy=0);return e}function l(){for(var e,r=0,n=t.length;r<n;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var o=10*Math.sqrt(.5+r),i=r*On;e.x=o*Math.cos(i),e.y=o*Math.sin(i)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function g(e){return e.initialize&&e.initialize(t,h),e}return null==t&&(t=[]),l(),e={tick:f,restart:function(){return u.restart(d),e},stop:function(){return u.stop(),e},nodes:function(r){return arguments.length?(t=r,l(),s.forEach(g),e):t},alpha:function(t){return arguments.length?(r=+t,e):r},alphaMin:function(t){return arguments.length?(n=+t,e):n},alphaDecay:function(t){return arguments.length?(o=+t,e):+o},alphaTarget:function(t){return arguments.length?(i=+t,e):i},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(h=t,s.forEach(g),e):h},force:function(t,r){return arguments.length>1?(null==r?s.delete(t):s.set(t,g(r)),e):s.get(t)},find:function(e,r,n){var o,i,a,s,u,c=0,h=t.length;for(null==n?n=1/0:n*=n,c=0;c<h;++c)(a=(o=e-(s=t[c]).x)*o+(i=r-s.y)*i)<n&&(u=s,n=a);return u},on:function(t,r){return arguments.length>1?(c.on(t,r),e):c.on(t)}}}function zn(){var t,e,r,n,o,i=Jr(-30),a=1,s=1/0,u=.81;function c(r){var o,i=t.length,a=er(t,An,jn).visitAfter(d);for(n=r,o=0;o<i;++o)e=t[o],a.visit(f)}function h(){if(t){var e,r,n=t.length;for(o=new Array(n),e=0;e<n;++e)r=t[e],o[r.index]=+i(r,e,t)}}function d(t){var e,r,n,i,a,s=0,u=0;if(t.length){for(n=i=a=0;a<4;++a)(e=t[a])&&(r=Math.abs(e.value))&&(s+=e.value,u+=r,n+=r*e.x,i+=r*e.y);t.x=n/u,t.y=i/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=o[e.data.index]}while(e=e.next)}t.value=s}function f(t,i,c,h){if(!t.value)return!0;var d=t.x-e.x,f=t.y-e.y,l=h-i,g=d*d+f*f;if(l*l/u<g)return g<s&&(0===d&&(g+=(d=Qr(r))*d),0===f&&(g+=(f=Qr(r))*f),g<a&&(g=Math.sqrt(a*g)),e.vx+=d*t.value*n/g,e.vy+=f*t.value*n/g),!0;if(!(t.length||g>=s)){(t.data!==e||t.next)&&(0===d&&(g+=(d=Qr(r))*d),0===f&&(g+=(f=Qr(r))*f),g<a&&(g=Math.sqrt(a*g)));do{t.data!==e&&(l=o[t.data.index]*n/g,e.vx+=d*l,e.vy+=f*l)}while(t=t.next)}}return c.initialize=function(e,n){t=e,r=n,h()},c.strength=function(t){return arguments.length?(i="function"==typeof t?t:Jr(+t),h(),c):i},c.distanceMin=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.distanceMax=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c.theta=function(t){return arguments.length?(u=t*t,c):Math.sqrt(u)},c}function Rn(t,e){var r,n=1;function o(){var o,i,a=r.length,s=0,u=0;for(o=0;o<a;++o)s+=(i=r[o]).x,u+=i.y;for(s=(s/a-t)*n,u=(u/a-e)*n,o=0;o<a;++o)(i=r[o]).x-=s,i.y-=u}return null==t&&(t=0),null==e&&(e=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.strength=function(t){return arguments.length?(n=+t,o):n},o}function In(t){return t.x+t.vx}function Pn(t){return t.y+t.vy}function Tn(t){var e,r,n,o=1,i=1;function a(){for(var t,a,u,c,h,d,f,l=e.length,g=0;g<i;++g)for(a=er(e,In,Pn).visitAfter(s),t=0;t<l;++t)u=e[t],d=r[u.index],f=d*d,c=u.x+u.vx,h=u.y+u.vy,a.visit(v);function v(t,e,r,i,a){var s=t.data,l=t.r,g=d+l;if(!s)return e>c+g||i<c-g||r>h+g||a<h-g;if(s.index>u.index){var v=c-s.x-s.vx,p=h-s.y-s.vy,y=v*v+p*p;y<g*g&&(0===v&&(y+=(v=Qr(n))*v),0===p&&(y+=(p=Qr(n))*p),y=(g-(y=Math.sqrt(y)))/y*o,u.vx+=(v*=y)*(g=(l*=l)/(f+l)),u.vy+=(p*=y)*g,s.vx-=v*(g=1-g),s.vy-=p*g)}}}function s(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var n,o,i=e.length;for(r=new Array(i),n=0;n<i;++n)o=e[n],r[o.index]=+t(o,n,e)}}return"function"!=typeof t&&(t=Jr(null==t?1:+t)),a.initialize=function(t,r){e=t,n=r,u()},a.iterations=function(t){return arguments.length?(i=+t,a):i},a.strength=function(t){return arguments.length?(o=+t,a):o},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:Jr(+e),u(),a):t},a}function Cn(t,e,r){var n,o,i,a=Jr(.1);function s(t){for(var a=0,s=n.length;a<s;++a){var u=n[a],c=u.x-e||1e-6,h=u.y-r||1e-6,d=Math.sqrt(c*c+h*h),f=(i[a]-d)*o[a]*t/d;u.vx+=c*f,u.vy+=h*f}}function u(){if(n){var e,r=n.length;for(o=new Array(r),i=new Array(r),e=0;e<r;++e)i[e]=+t(n[e],e,n),o[e]=isNaN(i[e])?0:+a(n[e],e,n)}}return"function"!=typeof t&&(t=Jr(+t)),null==e&&(e=0),null==r&&(r=0),s.initialize=function(t){n=t,u()},s.strength=function(t){return arguments.length?(a="function"==typeof t?t:Jr(+t),u(),s):a},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:Jr(+e),u(),s):t},s.x=function(t){return arguments.length?(e=+t,s):e},s.y=function(t){return arguments.length?(r=+t,s):r},s}function Dn(t){var e,r,n,o=Jr(.1);function i(t){for(var o,i=0,a=e.length;i<a;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function a(){if(e){var i,a=e.length;for(r=new Array(a),n=new Array(a),i=0;i<a;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Jr(null==t?0:+t)),i.initialize=function(t){e=t,a()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Jr(+t),a(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:Jr(+e),a(),i):t},i}function Ln(t){var e,r,n,o=Jr(.1);function i(t){for(var o,i=0,a=e.length;i<a;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function a(){if(e){var i,a=e.length;for(r=new Array(a),n=new Array(a),i=0;i<a;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Jr(null==t?0:+t)),i.initialize=function(t){e=t,a()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Jr(+t),a(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:Jr(+e),a(),i):t},i}class Fn{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:tn,manyBody:zn,center:Rn,collide:Tn,radial:Cn,x:Dn,y:Ln},this.options={link:{id:t=>t.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},$r(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericLayout(!0,t,r)}))}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((e=>e.id===t));r&&e.forEach(((t,e)=>{if("number"==typeof t||null===t){r[["fx","fy","fz"][e]]=t}}))}getOptions(t){var e,r;const n=$r({},this.options,t);return n.collide&&void 0===(null===(e=n.collide)||void 0===e?void 0:e.radius)&&(n.collide=n.collide||{},n.collide.radius=null!==(r=n.nodeSize)&&void 0!==r?r:10),void 0===n.iterations&&(n.link&&void 0===n.link.iterations&&(n.iterations=n.link.iterations),n.collide&&void 0===n.collide.iterations&&(n.iterations=n.collide.iterations)),this.context.options=n,n}genericLayout(t,r,n){var o;return e(this,void 0,void 0,(function*(){const e=this.getOptions(n),i=r.getAllNodes().map((({id:t,data:e})=>Object.assign(Object.assign({id:t},e),Kr(e.data,this.config.inputNodeAttrs)))),a=r.getAllEdges().map((t=>Object.assign({},t)));Object.assign(this.context,{assign:t,nodes:i,edges:a,graph:r});const s=new Promise((t=>{this.resolver=t})),u=this.setSimulation(e);return u.nodes(i),null===(o=u.force("link"))||void 0===o||o.links(a),s}))}getResult(){const{assign:t,nodes:e,edges:r,graph:n}=this.context,o=e.map((t=>({id:t.id,data:Object.assign(Object.assign({},t.data),Kr(t,this.config.outputNodeAttrs))}))),i=r.map((({id:t,source:e,target:r,data:n})=>({id:t,source:"object"==typeof e?e.id:e,target:"object"==typeof r?r.id:r,data:n})));return t&&o.forEach((t=>n.mergeNodeData(t.id,t.data))),{nodes:o,edges:i}}initSimulation(){return Sn()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",(()=>{var e;return null===(e=t.onTick)||void 0===e?void 0:e.call(t,this.getResult())})).on("end",(()=>{var t;return null===(t=this.resolver)||void 0===t?void 0:t.call(this,this.getResult())}))),qn(e,this.config.simulationAttrs.map((e=>[e,t[e]]))),Object.entries(this.forceMap).forEach((([r,n])=>{const o=r;if(t[r]){let r=e.force(o);r||(r=n(),e.force(o,r)),qn(r,Object.entries(t[o]))}else e.force(o,null)})),e}}const qn=(t,e)=>e.reduce(((e,[r,n])=>e[r]&&void 0!==n?e[r].call(t,n):e),t);function Vn(t){return function(){return t}}function Bn(t){return 1e-6*(t()-.5)}function Gn(t){return t.index}function Un(t,e){var r=t.get(e);if(!r)throw new Error("node not found: "+e);return r}function Wn(t){var e,r,n,o,i,a,s,u=Gn,c=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},h=Vn(30),d=1;function f(n){for(var i=0,u=t.length;i<d;++i)for(var c,h,f,l,g,v=0,p=0,y=0,m=0;v<u;++v)h=(c=t[v]).source,p=(f=c.target).x+f.vx-h.x-h.vx||Bn(s),o>1&&(y=f.y+f.vy-h.y-h.vy||Bn(s)),o>2&&(m=f.z+f.vz-h.z-h.vz||Bn(s)),p*=l=((l=Math.sqrt(p*p+y*y+m*m))-r[v])/l*n*e[v],y*=l,m*=l,f.vx-=p*(g=a[v]),o>1&&(f.vy-=y*g),o>2&&(f.vz-=m*g),h.vx+=p*(g=1-g),o>1&&(h.vy+=y*g),o>2&&(h.vz+=m*g)}function l(){if(n){var o,s,c=n.length,h=t.length,d=new Map(n.map(((t,e)=>[u(t,e,n),t])));for(o=0,i=new Array(c);o<h;++o)(s=t[o]).index=o,"object"!=typeof s.source&&(s.source=Un(d,s.source)),"object"!=typeof s.target&&(s.target=Un(d,s.target)),i[s.source.index]=(i[s.source.index]||0)+1,i[s.target.index]=(i[s.target.index]||0)+1;for(o=0,a=new Array(h);o<h;++o)s=t[o],a[o]=i[s.source.index]/(i[s.source.index]+i[s.target.index]);e=new Array(h),g(),r=new Array(h),v()}}function g(){if(n)for(var r=0,o=t.length;r<o;++r)e[r]=+c(t[r],r,t)}function v(){if(n)for(var e=0,o=t.length;e<o;++e)r[e]=+h(t[e],e,t)}return null==t&&(t=[]),f.initialize=function(t,...e){n=t,s=e.find((t=>"function"==typeof t))||Math.random,o=e.find((t=>[1,2,3].includes(t)))||2,l()},f.links=function(e){return arguments.length?(t=e,l(),f):t},f.id=function(t){return arguments.length?(u=t,f):u},f.iterations=function(t){return arguments.length?(d=+t,f):d},f.strength=function(t){return arguments.length?(c="function"==typeof t?t:Vn(+t),g(),f):c},f.distance=function(t){return arguments.length?(h="function"==typeof t?t:Vn(+t),v(),f):h},f}function $n(t,e,r){if(isNaN(e))return t;var n,o,i,a,s,u,c=t._root,h={data:r},d=t._x0,f=t._x1;if(!c)return t._root=h,t;for(;c.length;)if((a=e>=(o=(d+f)/2))?d=o:f=o,n=c,!(c=c[s=+a]))return n[s]=h,t;if(e===(i=+t._x.call(null,c.data)))return h.next=c,n?n[s]=h:t._root=h,t;do{n=n?n[s]=new Array(2):t._root=new Array(2),(a=e>=(o=(d+f)/2))?d=o:f=o}while((s=+a)==(u=+(i>=o)));return n[u]=c,n[s]=h,t}function Yn(t,e,r){this.node=t,this.x0=e,this.x1=r}function Hn(t){return t[0]}function Kn(t,e){var r=new Jn(null==e?Hn:e,NaN,NaN);return null==t?r:r.addAll(t)}function Jn(t,e,r){this._x=t,this._x0=e,this._x1=r,this._root=void 0}function Qn(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var Xn=Kn.prototype=Jn.prototype;Xn.copy=function(){var t,e,r=new Jn(this._x,this._x0,this._x1),n=this._root;if(!n)return r;if(!n.length)return r._root=Qn(n),r;for(t=[{source:n,target:r._root=new Array(2)}];n=t.pop();)for(var o=0;o<2;++o)(e=n.source[o])&&(e.length?t.push({source:e,target:n.target[o]=new Array(2)}):n.target[o]=Qn(e));return r},Xn.add=function(t){const e=+this._x.call(null,t);return $n(this.cover(e),e,t)},Xn.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,r=new Float64Array(e);let n=1/0,o=-1/0;for(let i,a=0;a<e;++a)isNaN(i=+this._x.call(null,t[a]))||(r[a]=i,i<n&&(n=i),i>o&&(o=i));if(n>o)return this;this.cover(n).cover(o);for(let n=0;n<e;++n)$n(this,r[n],t[n]);return this},Xn.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,r=this._x1;if(isNaN(e))r=(e=Math.floor(t))+1;else{for(var n,o,i=r-e||1,a=this._root;e>t||t>=r;)switch(o=+(t<e),(n=new Array(2))[o]=a,a=n,i*=2,o){case 0:r=e+i;break;case 1:e=r-i}this._root&&this._root.length&&(this._root=a)}return this._x0=e,this._x1=r,this},Xn.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},Xn.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},Xn.find=function(t,e){var r,n,o,i,a,s=this._x0,u=this._x1,c=[],h=this._root;for(h&&c.push(new Yn(h,s,u)),null==e?e=1/0:(s=t-e,u=t+e);i=c.pop();)if(!(!(h=i.node)||(n=i.x0)>u||(o=i.x1)<s))if(h.length){var d=(n+o)/2;c.push(new Yn(h[1],d,o),new Yn(h[0],n,d)),(a=+(t>=d))&&(i=c[c.length-1],c[c.length-1]=c[c.length-1-a],c[c.length-1-a]=i)}else{var f=Math.abs(t-+this._x.call(null,h.data));f<e&&(e=f,s=t-f,u=t+f,r=h.data)}return r},Xn.remove=function(t){if(isNaN(i=+this._x.call(null,t)))return this;var e,r,n,o,i,a,s,u,c,h=this._root,d=this._x0,f=this._x1;if(!h)return this;if(h.length)for(;;){if((s=i>=(a=(d+f)/2))?d=a:f=a,e=h,!(h=h[u=+s]))return this;if(!h.length)break;e[u+1&1]&&(r=e,c=u)}for(;h.data!==t;)if(n=h,!(h=h.next))return this;return(o=h.next)&&delete h.next,n?(o?n.next=o:delete n.next,this):e?(o?e[u]=o:delete e[u],(h=e[0]||e[1])&&h===(e[1]||e[0])&&!h.length&&(r?r[c]=h:this._root=h),this):(this._root=o,this)},Xn.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},Xn.root=function(){return this._root},Xn.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},Xn.visit=function(t){var e,r,n,o,i=[],a=this._root;for(a&&i.push(new Yn(a,this._x0,this._x1));e=i.pop();)if(!t(a=e.node,n=e.x0,o=e.x1)&&a.length){var s=(n+o)/2;(r=a[1])&&i.push(new Yn(r,s,o)),(r=a[0])&&i.push(new Yn(r,n,s))}return this},Xn.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new Yn(this._root,this._x0,this._x1));e=r.pop();){var o=e.node;if(o.length){var i,a=e.x0,s=e.x1,u=(a+s)/2;(i=o[0])&&r.push(new Yn(i,a,u)),(i=o[1])&&r.push(new Yn(i,u,s))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.x1);return this},Xn.x=function(t){return arguments.length?(this._x=t,this):this._x};const Zn=4294967296;function to(t){return t.x}function eo(t){return t.y}function ro(t){return t.z}var no=Math.PI*(3-Math.sqrt(5)),oo=20*Math.PI/(9+Math.sqrt(221));function io(t,e){e=e||2;var r,n=Math.min(3,Math.max(1,Math.round(e))),o=1,i=.001,a=1-Math.pow(i,1/300),s=0,u=.6,c=new Map,h=En(l),d=hn("tick","end"),f=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Zn)/Zn}();function l(){g(),d.call("tick",r),o<i&&(h.stop(),d.call("end",r))}function g(e){var i,h,d=t.length;void 0===e&&(e=1);for(var f=0;f<e;++f)for(o+=(s-o)*a,c.forEach((function(t){t(o)})),i=0;i<d;++i)null==(h=t[i]).fx?h.x+=h.vx*=u:(h.x=h.fx,h.vx=0),n>1&&(null==h.fy?h.y+=h.vy*=u:(h.y=h.fy,h.vy=0)),n>2&&(null==h.fz?h.z+=h.vz*=u:(h.z=h.fz,h.vz=0));return r}function v(){for(var e,r=0,o=t.length;r<o;++r){if((e=t[r]).index=r,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||n>1&&isNaN(e.y)||n>2&&isNaN(e.z)){var i=10*(n>2?Math.cbrt(.5+r):n>1?Math.sqrt(.5+r):r),a=r*no,s=r*oo;1===n?e.x=i:2===n?(e.x=i*Math.cos(a),e.y=i*Math.sin(a)):(e.x=i*Math.sin(a)*Math.cos(s),e.y=i*Math.cos(a),e.z=i*Math.sin(a)*Math.sin(s))}(isNaN(e.vx)||n>1&&isNaN(e.vy)||n>2&&isNaN(e.vz))&&(e.vx=0,n>1&&(e.vy=0),n>2&&(e.vz=0))}}function p(e){return e.initialize&&e.initialize(t,f,n),e}return null==t&&(t=[]),v(),r={tick:g,restart:function(){return h.restart(l),r},stop:function(){return h.stop(),r},numDimensions:function(t){return arguments.length?(n=Math.min(3,Math.max(1,Math.round(t))),c.forEach(p),r):n},nodes:function(e){return arguments.length?(t=e,v(),c.forEach(p),r):t},alpha:function(t){return arguments.length?(o=+t,r):o},alphaMin:function(t){return arguments.length?(i=+t,r):i},alphaDecay:function(t){return arguments.length?(a=+t,r):+a},alphaTarget:function(t){return arguments.length?(s=+t,r):s},velocityDecay:function(t){return arguments.length?(u=1-t,r):1-u},randomSource:function(t){return arguments.length?(f=t,c.forEach(p),r):f},force:function(t,e){return arguments.length>1?(null==e?c.delete(t):c.set(t,p(e)),r):c.get(t)},find:function(){var e,r,o,i,a,s,u=Array.prototype.slice.call(arguments),c=u.shift()||0,h=(n>1?u.shift():null)||0,d=(n>2?u.shift():null)||0,f=u.shift()||1/0,l=0,g=t.length;for(f*=f,l=0;l<g;++l)(i=(e=c-(a=t[l]).x)*e+(r=h-(a.y||0))*r+(o=d-(a.z||0))*o)<f&&(s=a,f=i);return s},on:function(t,e){return arguments.length>1?(d.on(t,e),r):d.on(t)}}}function ao(){var t,e,r,n,o,i,a=Vn(-30),s=1,u=1/0,c=.81;function h(n){var i,a=t.length,s=(1===e?Kn(t,to):2===e?er(t,to,eo):3===e?dr(t,to,eo,ro):null).visitAfter(f);for(o=n,i=0;i<a;++i)r=t[i],s.visit(l)}function d(){if(t){var e,r,n=t.length;for(i=new Array(n),e=0;e<n;++e)r=t[e],i[r.index]=+a(r,e,t)}}function f(t){var r,n,o,a,s,u,c=0,h=0,d=t.length;if(d){for(o=a=s=u=0;u<d;++u)(r=t[u])&&(n=Math.abs(r.value))&&(c+=r.value,h+=n,o+=n*(r.x||0),a+=n*(r.y||0),s+=n*(r.z||0));c*=Math.sqrt(4/d),t.x=o/h,e>1&&(t.y=a/h),e>2&&(t.z=s/h)}else{(r=t).x=r.data.x,e>1&&(r.y=r.data.y),e>2&&(r.z=r.data.z);do{c+=i[r.data.index]}while(r=r.next)}t.value=c}function l(t,a,h,d,f){if(!t.value)return!0;var l=[h,d,f][e-1],g=t.x-r.x,v=e>1?t.y-r.y:0,p=e>2?t.z-r.z:0,y=l-a,m=g*g+v*v+p*p;if(y*y/c<m)return m<u&&(0===g&&(m+=(g=Bn(n))*g),e>1&&0===v&&(m+=(v=Bn(n))*v),e>2&&0===p&&(m+=(p=Bn(n))*p),m<s&&(m=Math.sqrt(s*m)),r.vx+=g*t.value*o/m,e>1&&(r.vy+=v*t.value*o/m),e>2&&(r.vz+=p*t.value*o/m)),!0;if(!(t.length||m>=u)){(t.data!==r||t.next)&&(0===g&&(m+=(g=Bn(n))*g),e>1&&0===v&&(m+=(v=Bn(n))*v),e>2&&0===p&&(m+=(p=Bn(n))*p),m<s&&(m=Math.sqrt(s*m)));do{t.data!==r&&(y=i[t.data.index]*o/m,r.vx+=g*y,e>1&&(r.vy+=v*y),e>2&&(r.vz+=p*y))}while(t=t.next)}}return h.initialize=function(r,...o){t=r,n=o.find((t=>"function"==typeof t))||Math.random,e=o.find((t=>[1,2,3].includes(t)))||2,d()},h.strength=function(t){return arguments.length?(a="function"==typeof t?t:Vn(+t),d(),h):a},h.distanceMin=function(t){return arguments.length?(s=t*t,h):Math.sqrt(s)},h.distanceMax=function(t){return arguments.length?(u=t*t,h):Math.sqrt(u)},h.theta=function(t){return arguments.length?(c=t*t,h):Math.sqrt(c)},h}function so(t,e,r){var n,o=1;function i(){var i,a,s=n.length,u=0,c=0,h=0;for(i=0;i<s;++i)u+=(a=n[i]).x||0,c+=a.y||0,h+=a.z||0;for(u=(u/s-t)*o,c=(c/s-e)*o,h=(h/s-r)*o,i=0;i<s;++i)a=n[i],u&&(a.x-=u),c&&(a.y-=c),h&&(a.z-=h)}return null==t&&(t=0),null==e&&(e=0),null==r&&(r=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.z=function(t){return arguments.length?(r=+t,i):r},i.strength=function(t){return arguments.length?(o=+t,i):o},i}function uo(t){return t.x+t.vx}function co(t){return t.y+t.vy}function ho(t){return t.z+t.vz}function fo(t){var e,r,n,o,i=1,a=1;function s(){for(var t,s,c,h,d,f,l,g,v=e.length,p=0;p<a;++p)for(s=(1===r?Kn(e,uo):2===r?er(e,uo,co):3===r?dr(e,uo,co,ho):null).visitAfter(u),t=0;t<v;++t)c=e[t],l=n[c.index],g=l*l,h=c.x+c.vx,r>1&&(d=c.y+c.vy),r>2&&(f=c.z+c.vz),s.visit(y);function y(t,e,n,a,s,u,v){var p=[e,n,a,s,u,v],y=p[0],m=p[1],w=p[2],x=p[r],b=p[r+1],E=p[r+2],N=t.data,M=t.r,_=l+M;if(!N)return y>h+_||x<h-_||r>1&&(m>d+_||b<d-_)||r>2&&(w>f+_||E<f-_);if(N.index>c.index){var k=h-N.x-N.vx,A=r>1?d-N.y-N.vy:0,j=r>2?f-N.z-N.vz:0,O=k*k+A*A+j*j;O<_*_&&(0===k&&(O+=(k=Bn(o))*k),r>1&&0===A&&(O+=(A=Bn(o))*A),r>2&&0===j&&(O+=(j=Bn(o))*j),O=(_-(O=Math.sqrt(O)))/O*i,c.vx+=(k*=O)*(_=(M*=M)/(g+M)),r>1&&(c.vy+=(A*=O)*_),r>2&&(c.vz+=(j*=O)*_),N.vx-=k*(_=1-_),r>1&&(N.vy-=A*_),r>2&&(N.vz-=j*_))}}}function u(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<Math.pow(2,r);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function c(){if(e){var r,o,i=e.length;for(n=new Array(i),r=0;r<i;++r)o=e[r],n[o.index]=+t(o,r,e)}}return"function"!=typeof t&&(t=Vn(null==t?1:+t)),s.initialize=function(t,...n){e=t,o=n.find((t=>"function"==typeof t))||Math.random,r=n.find((t=>[1,2,3].includes(t)))||2,c()},s.iterations=function(t){return arguments.length?(a=+t,s):a},s.strength=function(t){return arguments.length?(i=+t,s):i},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:Vn(+e),c(),s):t},s}function lo(t,e,r,n){var o,i,a,s,u=Vn(.1);function c(t){for(var u=0,c=o.length;u<c;++u){var h=o[u],d=h.x-e||1e-6,f=(h.y||0)-r||1e-6,l=(h.z||0)-n||1e-6,g=Math.sqrt(d*d+f*f+l*l),v=(s[u]-g)*a[u]*t/g;h.vx+=d*v,i>1&&(h.vy+=f*v),i>2&&(h.vz+=l*v)}}function h(){if(o){var e,r=o.length;for(a=new Array(r),s=new Array(r),e=0;e<r;++e)s[e]=+t(o[e],e,o),a[e]=isNaN(s[e])?0:+u(o[e],e,o)}}return"function"!=typeof t&&(t=Vn(+t)),null==e&&(e=0),null==r&&(r=0),null==n&&(n=0),c.initialize=function(t,...e){o=t,i=e.find((t=>[1,2,3].includes(t)))||2,h()},c.strength=function(t){return arguments.length?(u="function"==typeof t?t:Vn(+t),h(),c):u},c.radius=function(e){return arguments.length?(t="function"==typeof e?e:Vn(+e),h(),c):t},c.x=function(t){return arguments.length?(e=+t,c):e},c.y=function(t){return arguments.length?(r=+t,c):r},c.z=function(t){return arguments.length?(n=+t,c):n},c}function go(t){var e,r,n,o=Vn(.1);function i(t){for(var o,i=0,a=e.length;i<a;++i)(o=e[i]).vx+=(n[i]-o.x)*r[i]*t}function a(){if(e){var i,a=e.length;for(r=new Array(a),n=new Array(a),i=0;i<a;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Vn(null==t?0:+t)),i.initialize=function(t){e=t,a()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Vn(+t),a(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:Vn(+e),a(),i):t},i}function vo(t){var e,r,n,o=Vn(.1);function i(t){for(var o,i=0,a=e.length;i<a;++i)(o=e[i]).vy+=(n[i]-o.y)*r[i]*t}function a(){if(e){var i,a=e.length;for(r=new Array(a),n=new Array(a),i=0;i<a;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Vn(null==t?0:+t)),i.initialize=function(t){e=t,a()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Vn(+t),a(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:Vn(+e),a(),i):t},i}function po(t){var e,r,n,o=Vn(.1);function i(t){for(var o,i=0,a=e.length;i<a;++i)(o=e[i]).vz+=(n[i]-o.z)*r[i]*t}function a(){if(e){var i,a=e.length;for(r=new Array(a),n=new Array(a),i=0;i<a;++i)r[i]=isNaN(n[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=Vn(null==t?0:+t)),i.initialize=function(t){e=t,a()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:Vn(+t),a(),i):o},i.z=function(e){return arguments.length?(t="function"==typeof e?e:Vn(+e),a(),i):t},i}var yo=r(92546),mo=r.n(yo);class wo{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,wo.defaultOptions,t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),r))}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),r))}))}genericDagreLayout(r,n,o){return e(this,void 0,void 0,(function*(){const{nodeSize:e}=o,i=new yo.graphlib.Graph;i.setGraph(o),i.setDefaultEdgeLabel((()=>({})));[...n.getAllNodes(),...n.getAllEdges()].some((({id:t})=>S(t)))&&console.error("Dagre layout only support string id, it will convert number to string."),n.getAllNodes().forEach((t=>{const{id:r}=t,n=Object.assign({},t.data);if(void 0!==e){const[r,o]=Te(Ie(e)?e(t):e);Object.assign(n,{width:r,height:o})}i.setNode(r.toString(),n)})),n.getAllEdges().forEach((({id:t,source:e,target:r})=>{i.setEdge(e.toString(),r.toString(),{id:t})})),mo().layout(i);const a={nodes:[],edges:[]};return i.nodes().forEach((t=>{const e=i.node(t);a.nodes.push({id:t,data:e}),r&&n.mergeNodeData(t,e)})),i.edges().forEach((e=>{const o=i.edge(e),{id:s}=o,u=t(o,["id"]),{v:c,w:h}=e;a.edges.push({id:s,source:c,target:h,data:u}),r&&n.mergeEdgeData(s,u)})),a}))}}wo.defaultOptions={};class xo{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 n=Math.hypot(e,r);n=n<1e-4?1e-4:n;const o=this.g*(this.degree+1)*(t.degree+1)/n;this.fx+=o*e/n,this.fy+=o*r/n}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,n=(this.ry*this.mass+t.ry*t.mass)/e,o=this.degree+t.degree;return new xo({rx:r,ry:n,mass:e,degree:o})}}class bo{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;return new bo({xmid:t,ymid:e,length:r})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,r=this.length/2;return new bo({xmid:t,ymid:e,length:r})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new bo({xmid:t,ymid:e,length:r})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,r=this.length/2;return new bo({xmid:t,ymid:e,length:r})}}class Eo{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new Eo(this.quad.NW()),this.NE=new Eo(this.quad.NE()),this.SW=new Eo(this.quad.SW()),this.SE=new Eo(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)):this.body=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 null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){if(null!=this.body&&t!==this.body)if(this._isExternal())t.addForce(this.body);else{(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<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 No={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};const Mo={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"};const _o={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};const ko=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;if(null==e)r=Math.min(n,o);else{Math.min(n,o)===t.rows?t.rows=e:t.cols=e}return r},Ao=(t,e)=>{let r;const n=t.rows||5,o=t.cols||5;if(null==e)r=Math.max(n,o);else{Math.max(n,o)===t.rows?t.rows=e:t.cols=e}return r},jo=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,Oo=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,So=(t,e)=>{const r=t.cols||5;e.col++,e.col>=r&&(e.col=0,e.row++)},zo=(t,e,r,n,o,i,a,s)=>{let u,c;const h=o[t.id];if(h)u=h.col*r+r/2+e[0],c=h.row*n+n/2+e[1];else{for(;jo(s,a);)So(i,a);u=a.col*r+r/2+e[0],c=a.row*n+n/2+e[1],Oo(s,a),So(i,a)}t.data.x=u,t.data.y=c},Ro={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Io=(t,e,r,n,o,i)=>{e.forEach(((a,s)=>{r[s]={x:0,y:0},e.forEach(((e,u)=>{if(s===u)return;if(o[s]!==o[u])return;let c=a.x-e.x,h=a.y-e.y,d=Math.sqrt(c*c+h*h);if(0===d){d=1;const t=s>u?1:-1;c=.01*t,h=.01*t}if(d<i(t[s])/2+i(t[u])/2){const t=n*n/d;r[s].x+=c/d*t,r[s].y+=h/d*t}}))}))},Po=(t,e,r,n,o,i,a,s)=>{const u=i||a/10;return n&&e.forEach(((e,r)=>{const n=t[r].x-t[o].x,i=t[r].y-t[o].y,a=Math.sqrt(n*n+i*i);let s=i/a,u=-n/a;const c=Math.sqrt(e.x*e.x+e.y*e.y);let h=Math.acos((s*e.x+u*e.y)/c);h>Math.PI/2&&(h-=Math.PI/2,s*=-1,u*=-1);const d=Math.cos(h)*c;e.x=s*d,e.y=u*d})),t.forEach(((i,a)=>{if(a===o)return;const c=Math.sqrt(e[a].x*e[a].x+e[a].y*e[a].y);if(c>0&&a!==o){const h=Math.min(u*(r/800),c);if(i.x+=e[a].x/c*h,i.y+=e[a].y/c*h,n){let e=i.x-t[o].x,r=i.y-t[o].y;const n=Math.sqrt(e*e+r*r);e=e/n*s[a],r=r/n*s[a],i.x=t[o].x+e,i.y=t[o].y+r}}})),t},To={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};const Co=(t,e,r,n,o,i,a)=>{if(!t)return[];const s=[];if(e){const u={};e.forEach(((e,c)=>{const h=[];e.forEach(((e,s)=>{var d,f;if(c===s)h.push(0);else if(n[c]===n[s])if("data"===i)h.push(e*(Math.abs(c-s)*a)/(n[c]/o));else if(i){let r,l;if(u[t[c].id])r=u[t[c].id];else{const e=("id"===i?t[c].id:null===(d=t[c].data)||void 0===d?void 0:d[i])||0;r=Ye(e)?e.charCodeAt(0):e,u[t[c].id]=r}if(u[t[s].id])l=u[t[s].id];else{const e=("id"===i?t[s].id:null===(f=t[s].data)||void 0===f?void 0:f[i])||0;l=Ye(e)?e.charCodeAt(0):e,u[t[s].id]=l}h.push(e*(Math.abs(r-l)*a)/(n[c]/o))}else h.push(e*r/(n[c]/o));else{const t=(r+o)/2;h.push(e*t)}})),s.push(h)}))}return s},Do=t=>{const e=t.length,r=t[0].length,n=[];for(let o=0;o<e;o++){const e=[];for(let n=0;n<r;n++)0!==t[o][n]?e.push(1/(t[o][n]*t[o][n])):e.push(0);n.push(e)}return n},Lo=(t,e)=>{let r=-1;return t.forEach(((t,n)=>{t.id===e&&(r=n)})),Math.max(r,0)},Fo=(t,e,r)=>{const n=t.length;for(let o=0;o<n;o++)if(t[e][o]===1/0){t[e][o]=r,t[o][e]=r;for(let i=0;i<n;i++)t[o][i]!==1/0&&t[e][i]===1/0&&(t[e][i]=r+t[o][i],t[i][e]=r+t[o][i])}for(let r=0;r<n;r++)if(r!==e)for(let o=0;o<n;o++)if(t[r][o]===1/0){let n=Math.abs(t[e][r]-t[e][o]);n=0===n?1:n,t[r][o]=n}},qo=(t,e)=>{let r=0;for(let n=0;n<t[e].length;n++)t[e][n]!==1/0&&(r=t[e][n]>r?t[e][n]:r);return r},Vo={center:[0,0],width:300,height:300};const Bo={circular:class{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},Ue),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericCircularLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericCircularLayout(!0,t,r)}))}genericCircularLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:a,divisions:s,startAngle:u=0,endAngle:c=2*Math.PI,angleRatio:h,ordering:d,clockwise:f,nodeSpacing:l,nodeSize:g}=e,v=r.getAllNodes(),p=r.getAllEdges(),[y,m,w]=$e(o,i,a),x=null==v?void 0:v.length;if(!x||1===x)return Ge(r,t,w);const b=(c-u)/x;let{radius:E,startRadius:N,endRadius:M}=e;if(l){const t=Ce(10,l),e=De(10,g);let r=-1/0;v.forEach((t=>{const n=e(t);r<n&&(r=n)}));let n=0;v.forEach(((e,o)=>{n+=0===o?r||10:(t(e)||0)+(r||10)})),E=n/(2*Math.PI)}else E||N||M?!N&&M?N=M:N&&!M&&(M=N):E=Math.min(m,y)/2;const _=b*h;let k=[];k="topology"===d?We(r,v):"topology-directed"===d?We(r,v,!0):"degree"===d?function(t,e){const r=[];return e.forEach(((t,e)=>{r.push(qe(t))})),r.sort(((e,r)=>t.getDegree(e.id,"both")-t.getDegree(r.id,"both"))),r}(r,v):v.map((t=>qe(t)));const A=Math.ceil(x/s);for(let t=0;t<x;++t){let e=E;e||null===N||null===M||(e=N+t*(M-N)/(x-1)),e||(e=10+100*t/(x-1));let r=u+t%A*_+2*Math.PI/s*Math.floor(t/A);f||(r=c-t%A*_-2*Math.PI/s*Math.floor(t/A)),k[t].data.x=w[0]+Math.cos(r)*e,k[t].data.y=w[1]+Math.sin(r)*e}t&&k.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}));return{nodes:k,edges:p}}))}},concentric:Je,mds:Ir,random:class{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},Vo),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericRandomLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericRandomLayout(!0,t,r)}))}genericRandomLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{center:o,width:i,height:a}=e,s=r.getAllNodes(),u=i||"undefined"==typeof window?i:window.innerWidth,c=a||"undefined"==typeof window?a:window.innerHeight,h=o||[u/2,c/2],d=[];s&&s.forEach((t=>{d.push({id:t.id,data:{x:.9*(Math.random()-.5)*u+h[0],y:.9*(Math.random()-.5)*c+h[1]}})})),t&&d.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:d,edges:r.getAllEdges()}}))}},grid:class{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},_o),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericGridLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericGridLayout(!0,t,r)}))}genericGridLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{begin:o=[0,0],condense:i,preventOverlapPadding:a,preventOverlap:s,rows:u,cols:c,nodeSpacing:h,nodeSize:d,width:f,height:l,position:g}=e;let{sortBy:v}=e;const p=r.getAllNodes(),y=r.getAllEdges(),m=null==p?void 0:p.length;if(!m||1===m)return Ge(r,t,o);const w=p.map((t=>qe(t)));"id"===v||Ye(v)&&void 0!==w[0].data[v]||(v="degree"),"degree"===v?w.sort(((t,e)=>r.getDegree(e.id,"both")-r.getDegree(t.id,"both"))):"id"===v?w.sort(((t,e)=>S(e.id)&&S(t.id)?e.id-t.id:`${t.id}`.localeCompare(`${e.id}`))):w.sort(((t,e)=>e.data[v]-t.data[v]));const x=f||"undefined"==typeof window?f:window.innerWidth,b=l||"undefined"==typeof window?l:window.innerHeight,E=m,N={rows:u,cols:c};if(null!=u&&null!=c)N.rows=u,N.cols=c;else if(null!=u&&null==c)N.rows=u,N.cols=Math.ceil(E/N.rows);else if(null==u&&null!=c)N.cols=c,N.rows=Math.ceil(E/N.cols);else{const t=Math.sqrt(E*b/x);N.rows=Math.round(t),N.cols=Math.round(x/b*t)}if(N.rows=Math.max(N.rows,1),N.cols=Math.max(N.cols,1),N.cols*N.rows>E){const t=ko(N),e=Ao(N);(t-1)*e>=E?ko(N,t-1):(e-1)*t>=E&&Ao(N,e-1)}else for(;N.cols*N.rows<E;){const t=ko(N),e=Ao(N);(e+1)*t>=E?Ao(N,e+1):ko(N,t+1)}let M=i?0:x/N.cols,_=i?0:b/N.rows;if(s||h){const t=Ce(10,h),e=De(30,d,!1);w.forEach((n=>{n.data.x&&n.data.y||(n.data.x=0,n.data.y=0);const o=r.getNode(n.id),[i,s]=Te(e(o)||30),u=void 0!==t?t(n):a,c=i+u,h=s+u;M=Math.max(M,c),_=Math.max(_,h)}))}const k={},A={row:0,col:0},j={};for(let t=0;t<w.length;t++){const e=w[t];let n;if(g&&(n=g(r.getNode(e.id))),n&&(void 0!==n.row||void 0!==n.col)){const t={row:n.row,col:n.col};if(void 0===t.col)for(t.col=0;jo(k,t);)t.col++;else if(void 0===t.row)for(t.row=0;jo(k,t);)t.row++;j[e.id]=t,Oo(k,t)}zo(e,o,M,_,j,N,A,k)}const O={nodes:w,edges:y};return t&&w.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),O}))}},radial:class{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},To),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericRadialLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericRadialLayout(!0,t,r)}))}genericRadialLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{width:o,height:i,center:a,focusNode:s,unitRadius:u,nodeSize:c,nodeSpacing:h,strictRadial:d,preventOverlap:f,maxPreventOverlapIteration:l,sortBy:g,linkDistance:v=50,sortStrength:p=10,maxIteration:y=1e3}=e,m=r.getAllNodes(),w=r.getAllEdges(),x=o||"undefined"==typeof window?o:window.innerWidth,b=i||"undefined"==typeof window?i:window.innerHeight,E=a||[x/2,b/2];if(!(null==m?void 0:m.length)||1===m.length)return Ge(r,t,E);let N=m[0];if(Ye(s)){for(let t=0;t<m.length;t++)if(m[t].id===s){N=m[t];break}}else N=s||m[0];const M=Lo(m,N.id),_=Or({nodes:m,edges:w},!1),k=jr(_),A=qo(k,M);Fo(k,M,A+1);const j=k[M];let O=x-E[0]>E[0]?E[0]:x-E[0],S=b-E[1]>E[1]?E[1]:b-E[1];0===O&&(O=x/2),0===S&&(S=b/2);const z=Math.min(O,S),R=Math.max(...j),I=[],P=u||z/R;j.forEach(((t,e)=>{I[e]=t*P}));const T=Co(m,k,v,I,P,g,p),C=Do(T),D=((t,e,r)=>{try{const r=kr.mul(kr.pow(e,2),-.5),n=r.mean("row"),o=r.mean("column"),i=r.mean();r.add(i).subRowVector(n).subColumnVector(o);const a=new Ar(r),s=kr.sqrt(a.diagonalMatrix).diagonal();return a.leftSingularVectors.toJSON().map((e=>kr.mul([e],[s]).toJSON()[0].splice(0,t)))}catch(t){const n=[];for(let t=0;t<e.length;t++){const t=Math.random()*r,e=Math.random()*r;n.push([t,e])}return n}})(v,T,v);let L,F=D.map((([t,e])=>({x:(isNaN(t)?Math.random()*v:t)-D[M][0],y:(isNaN(e)?Math.random()*v:e)-D[M][1]})));if(this.run(y,F,C,T,I,M),f){L=Le(c,h);const t={nodes:m,nodeSizeFunc:L,positions:F,radii:I,height:b,width:x,strictRadial:Boolean(d),focusIdx:M,iterations:l||200,k:F.length/4.5};F=((t,e)=>{const r=Object.assign(Object.assign({},Ro),e),{positions:n,iterations:o,width:i,k:a,speed:s=100,strictRadial:u,focusIdx:c,radii:h=[],nodeSizeFunc:d}=r,f=t.getAllNodes(),l=[],g=i/10;for(let t=0;t<o;t++)n.forEach(((t,e)=>{l[e]={x:0,y:0}})),Io(f,n,l,a,h,d),Po(n,l,s,u,c,g,i,h);return n})(r,t)}const q=[];F.forEach(((t,e)=>{const r=qe(m[e]);r.data.x=t.x+E[0],r.data.y=t.y+E[1],q.push(r)})),t&&q.forEach((t=>r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})));return{nodes:q,edges:w}}))}run(t,e,r,n,o,i){for(let a=0;a<=t;a++){const s=a/t;this.oneIteration(s,e,o,n,r,i)}}oneIteration(t,e,r,n,o,i){const a=1-t;e.forEach(((s,u)=>{const c=Sr(s,{x:0,y:0}),h=0===c?0:1/c;if(u===i)return;let d=0,f=0,l=0;e.forEach(((t,e)=>{if(u===e)return;const r=Sr(s,t),i=0===r?0:1/r,a=n[e][u];l+=o[u][e],d+=o[u][e]*(t.x+a*(s.x-t.x)*i),f+=o[u][e]*(t.y+a*(s.y-t.y)*i)}));const g=0===r[u]?0:1/r[u];l*=a,l+=t*g*g,d*=a,d+=t*g*s.x*h,s.x=d/l,f*=a,f+=t*g*s.y*h,s.y=f/l}))}},force:wr,d3force:Fn,"d3-force-3d":class extends Fn{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:Wn,manyBody:ao,center:so,collide:fo,radial:lo,x:go,y:vo,z:po},this.options={numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return io()}},fruchterman:class{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},Mo),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericFruchtermanLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericFruchtermanLayout(!0,t,r)}))}stop(){this.timeInterval&&"undefined"!=typeof window&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let e=0;e<t;e++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach((t=>this.lastGraph.mergeNodeData(t.id,{x:t.data.x,y:t.data.y,z:3===this.options.dimensions?t.data.z:void 0}))),e}genericFruchtermanLayout(t,r,n){return e(this,void 0,void 0,(function*(){if(this.running)return;const e=this.formatOptions(n),{dimensions:o,width:i,height:a,center:s,clustering:u,nodeClusterBy:h,maxIteration:d,onTick:f}=e,l=r.getAllNodes(),g=r.getAllEdges();if(!(null==l?void 0:l.length)){const t={nodes:[],edges:g};return this.lastResult=t,t}if(1===l.length){t&&r.mergeNodeData(l[0].id,{x:s[0],y:s[1],z:3===o?s[2]:void 0});const e={nodes:[Object.assign(Object.assign({},l[0]),{data:Object.assign(Object.assign({},l[0].data),{x:s[0],y:s[1],z:3===o?s[2]:void 0})})],edges:g};return this.lastResult=e,e}const v=l.map((t=>qe(t,[i,a]))),p=new c({nodes:v,edges:g}),y={};if(u&&v.forEach((t=>{const e=t.data[h];y[e]||(y[e]={name:e,cx:0,cy:0,count:0})})),this.lastLayoutNodes=v,this.lastLayoutEdges=g,this.lastAssign=t,this.lastGraph=p,this.lastOptions=e,this.lastClusterMap=y,"undefined"==typeof window)return;let m=0;return new Promise((n=>{this.timeInterval=window.setInterval((()=>{this.running?(this.runOneStep(p,y,e),t&&v.forEach((({id:t,data:e})=>r.mergeNodeData(t,{x:e.x,y:e.y,z:3===o?e.z:void 0}))),null==f||f({nodes:v,edges:g}),m++,m>=d&&(window.clearInterval(this.timeInterval),n({nodes:v,edges:g}))):n({nodes:v,edges:g})}),0),this.running=!0}))}))}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:r,nodeClusterBy:n}=e,{center:o,width:i,height:a}=e;return e.width=i||"undefined"==typeof window?i:window.innerWidth,e.height=a||"undefined"==typeof window?a:window.innerHeight,e.center=o||[e.width/2,e.height/2],e.clustering=r&&!!n,e}runOneStep(t,e,r){const{dimensions:n,height:o,width:i,gravity:a,center:s,speed:u,clustering:c,nodeClusterBy:h,clusterGravity:d}=r,f=o*i,l=Math.sqrt(f)/10,g=t.getAllNodes(),v=f/(g.length+1),p=Math.sqrt(v),y={};if(this.applyCalculate(t,y,p,v),c){for(const t in e)e[t].cx=0,e[t].cy=0,e[t].count=0;g.forEach((t=>{const{data:r}=t,n=e[r[h]];S(r.x)&&(n.cx+=r.x),S(r.y)&&(n.cy+=r.y),n.count++}));for(const t in e)e[t].cx/=e[t].count,e[t].cy/=e[t].count;const t=d||a;g.forEach(((r,n)=>{const{id:o,data:i}=r;if(!S(i.x)||!S(i.y))return;const a=e[i[h]],s=Math.sqrt((i.x-a.cx)*(i.x-a.cx)+(i.y-a.cy)*(i.y-a.cy)),u=p*t;y[o].x-=u*(i.x-a.cx)/s,y[o].y-=u*(i.y-a.cy)/s}))}g.forEach(((t,e)=>{const{id:r,data:o}=t;if(!S(o.x)||!S(o.y))return;const i=.01*p*a;y[r].x-=i*(o.x-s[0]),y[r].y-=i*(o.y-s[1]),3===n&&(y[r].z-=i*(o.z-s[2]))})),g.forEach(((e,r)=>{const{id:o,data:i}=e;if(S(i.fx)&&S(i.fy))return i.x=i.fx,i.y=i.fy,void(3===n&&(i.z=i.fz));if(!S(i.x)||!S(i.y))return;const a=Math.sqrt(y[o].x*y[o].x+y[o].y*y[o].y+(3===n?y[o].z*y[o].z:0));if(a>0){const e=Math.min(l*(u/800),a);t.mergeNodeData(o,{x:i.x+y[o].x/a*e,y:i.y+y[o].y/a*e,z:3===n?i.z+y[o].z/a*e:void 0})}}))}applyCalculate(t,e,r,n){this.calRepulsive(t,e,n),this.calAttractive(t,e,r)}calRepulsive(t,e,r){const n=t.getAllNodes();n.forEach((({data:t,id:o},i)=>{e[o]={x:0,y:0,z:0},n.forEach((({data:n,id:a},s)=>{if(i<=s||!S(t.x)||!S(n.x)||!S(t.y)||!S(n.y))return;let u=t.x-n.x,c=t.y-n.y,h=3===this.options.dimensions?t.z-n.z:0,d=u*u+c*c+h*h;0===d&&(d=1,u=.01,c=.01,h=.01);const f=r/d,l=u*f,g=c*f,v=h*f;e[o].x+=l,e[o].y+=g,e[a].x-=l,e[a].y-=g,3===this.options.dimensions&&(e[o].z+=v,e[a].z-=v)}))}))}calAttractive(t,e,r){t.getAllEdges().forEach((n=>{const{source:o,target:i}=n;if(!o||!i||o===i)return;const{data:a}=t.getNode(o),{data:s}=t.getNode(i);if(!(S(s.x)&&S(a.x)&&S(s.y)&&S(a.y)))return;const u=s.x-a.x,c=s.y-a.y,h=3===this.options.dimensions?s.z-a.z:0,d=Math.sqrt(u*u+c*c+h*h)/r,f=u*d,l=c*d,g=h*d;e[o].x+=f,e[o].y+=l,e[i].x-=f,e[i].y-=l,3===this.options.dimensions&&(e[o].z+=g,e[i].z-=g)}))}},forceAtlas2:class{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},No),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericForceAtlas2Layout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericForceAtlas2Layout(!0,t,r)}))}genericForceAtlas2Layout(t,r,n){return e(this,void 0,void 0,(function*(){const e=r.getAllEdges(),o=r.getAllNodes(),i=this.formatOptions(n,o.length),{width:a,height:s,prune:u,maxIteration:h,nodeSize:d,center:f}=i;if(!(null==o?void 0:o.length)||1===o.length)return Ge(r,t,f);const l=o.map((t=>qe(t,[a,s]))),g=e.filter((t=>{const{source:e,target:r}=t;return e!==r})),v=new c({nodes:l,edges:g}),p=this.getSizes(v,d);if(this.run(v,r,h,p,t,i),u){for(let t=0;t<g.length;t+=1){const{source:e,target:r}=g[t],n=v.getDegree(e),o=v.getDegree(e);if(n<=1){const t=v.getNode(r);v.mergeNodeData(e,{x:t.data.x,y:t.data.y})}else if(o<=1){const t=v.getNode(e);v.mergeNodeData(r,{x:t.data.x,y:t.data.y})}}const e=Object.assign(Object.assign({},i),{prune:!1,barnesHut:!1});this.run(v,r,100,p,t,e)}return{nodes:l,edges:e}}))}getSizes(t,e){const r=t.getAllNodes(),n={};for(let t=0;t<r.length;t+=1){const o=r[t];n[o.id]=Le(e,void 0)(o)}return n}formatOptions(t={},e){const r=Object.assign(Object.assign({},this.options),t),{center:n,width:o,height:i,barnesHut:a,prune:s,maxIteration:u,kr:c,kg:h}=r;return r.width=o||"undefined"==typeof window?o:window.innerWidth,r.height=i||"undefined"==typeof window?i:window.innerHeight,r.center=n||[r.width/2,r.height/2],void 0===a&&e>250&&(r.barnesHut=!0),void 0===s&&e>100&&(r.prune=!0),0!==u||s?0===u&&s&&(r.maxIteration=100,e<=200&&e>100?r.maxIteration=500:e>200&&(r.maxIteration=950)):(r.maxIteration=250,e<=200&&e>100?r.maxIteration=1e3:e>200&&(r.maxIteration=1200)),c||(r.kr=50,e>100&&e<=500?r.kr=20:e>500&&(r.kr=1)),h||(r.kg=20,e>100&&e<=500?r.kg=10:e>500&&(r.kg=1)),r}run(t,e,r,n,o,i){const{kr:a,barnesHut:s,onTick:u}=i,c=t.getAllNodes();let h=0,d=r;const f={},l={},g={};for(let e=0;e<c.length;e+=1){const{data:r,id:n}=c[e];if(f[n]=[0,0],s){const o={id:e,rx:r.x,ry:r.y,mass:1,g:a,degree:t.getDegree(n)};g[n]=new xo(o)}}for(;d>0;)h=this.oneStep(t,{iter:d,preventOverlapIters:50,krPrime:100,sg:h,forces:f,preForces:l,bodies:g,sizes:n},i),d--,null==u||u({nodes:c,edges:e.getAllEdges()});return t}oneStep(t,e,r){const{iter:n,preventOverlapIters:o,krPrime:i,sg:a,preForces:s,bodies:u,sizes:c}=e;let{forces:h}=e;const{preventOverlap:d,barnesHut:f}=r,l=t.getAllNodes();for(let t=0;t<l.length;t+=1){const{id:e}=l[t];s[e]=[...h[e]],h[e]=[0,0]}return h=this.getAttrForces(t,n,o,c,h,r),h=f&&(d&&n>o||!d)?this.getOptRepGraForces(t,h,u,r):this.getRepGraForces(t,n,o,h,i,c,r),this.updatePos(t,h,s,a,r)}getAttrForces(t,e,r,n,o,i){const{preventOverlap:a,dissuadeHubs:s,mode:u,prune:c}=i,h=t.getAllEdges();for(let i=0;i<h.length;i+=1){const{source:d,target:f}=h[i],l=t.getNode(d),g=t.getNode(f),v=t.getDegree(d),p=t.getDegree(f);if(c&&(v<=1||p<=1))continue;const y=[g.data.x-l.data.x,g.data.y-l.data.y];let m=Math.hypot(y[0],y[1]);m=m<1e-4?1e-4:m,y[0]=y[0]/m,y[1]=y[1]/m,a&&e<r&&(m=m-n[d]-n[f]);let w=m,x=w;"linlog"===u&&(w=Math.log(1+m),x=w),s&&(w=m/v,x=m/p),a&&e<r&&m<=0?(w=0,x=0):a&&e<r&&m>0&&(w=m,x=m),o[d][0]+=w*y[0],o[f][0]-=x*y[0],o[d][1]+=w*y[1],o[f][1]-=x*y[1]}return o}getOptRepGraForces(t,e,r,n){const{kg:o,center:i,prune:a}=n,s=t.getAllNodes(),u=s.length;let c=9e10,h=-9e10,d=9e10,f=-9e10;for(let e=0;e<u;e+=1){const{id:n,data:o}=s[e];a&&t.getDegree(n)<=1||(r[n].setPos(o.x,o.y),o.x>=h&&(h=o.x),o.x<=c&&(c=o.x),o.y>=f&&(f=o.y),o.y<=d&&(d=o.y))}const l=Math.max(h-c,f-d),g=new bo({xmid:(h+c)/2,ymid:(f+d)/2,length:l,massCenter:i,mass:u}),v=new Eo(g);for(let e=0;e<u;e+=1){const{id:n}=s[e];a&&t.getDegree(n)<=1||r[n].in(g)&&v.insert(r[n])}for(let n=0;n<u;n+=1){const{id:u,data:c}=s[n],h=t.getDegree(u);if(a&&h<=1)continue;r[u].resetForce(),v.updateForce(r[u]),e[u][0]-=r[u].fx,e[u][1]-=r[u].fy;const d=[c.x-i[0],c.y-i[1]];let f=Math.hypot(d[0],d[1]);f=f<1e-4?1e-4:f,d[0]=d[0]/f,d[1]=d[1]/f;const l=o*(h+1);e[u][0]-=l*d[0],e[u][1]-=l*d[1]}return e}getRepGraForces(t,e,r,n,o,i,a){const{preventOverlap:s,kr:u,kg:c,center:h,prune:d}=a,f=t.getAllNodes(),l=f.length;for(let a=0;a<l;a+=1){const g=f[a],v=t.getDegree(g.id);for(let c=a+1;c<l;c+=1){const a=f[c],h=t.getDegree(a.id);if(d&&(v<=1||h<=1))continue;const l=[a.data.x-g.data.x,a.data.y-g.data.y];let p=Math.hypot(l[0],l[1]);p=p<1e-4?1e-4:p,l[0]=l[0]/p,l[1]=l[1]/p,s&&e<r&&(p=p-i[g.id]-i[a.id]);let y=u*(v+1)*(h+1)/p;s&&e<r&&p<0?y=o*(v+1)*(h+1):s&&e<r&&0===p?y=0:s&&e<r&&p>0&&(y=u*(v+1)*(h+1)/p),n[g.id][0]-=y*l[0],n[a.id][0]+=y*l[0],n[g.id][1]-=y*l[1],n[a.id][1]+=y*l[1]}const p=[g.data.x-h[0],g.data.y-h[1]],y=Math.hypot(p[0],p[1]);p[0]=p[0]/y,p[1]=p[1]/y;const m=c*(v+1);n[g.id][0]-=m*p[0],n[g.id][1]-=m*p[1]}return n}updatePos(t,e,r,n,o){const{ks:i,tao:a,prune:s,ksmax:u}=o,c=t.getAllNodes(),h=c.length,d=[],f=[];let l=0,g=0,v=n;for(let n=0;n<h;n+=1){const{id:o}=c[n],i=t.getDegree(o);if(s&&i<=1)continue;const a=[e[o][0]-r[o][0],e[o][1]-r[o][1]],u=Math.hypot(a[0],a[1]),h=[e[o][0]+r[o][0],e[o][1]+r[o][1]],v=Math.hypot(h[0],h[1]);d[n]=u,f[n]=v/2,l+=(i+1)*d[n],g+=(i+1)*f[n]}const p=v;v=a*g/l,0!==p&&(v=v>1.5*p?1.5*p:v);for(let r=0;r<h;r+=1){const{id:n,data:o}=c[r],a=t.getDegree(n);if(s&&a<=1)continue;if(S(o.fx)&&S(o.fy))continue;let h=i*v/(1+v*Math.sqrt(d[r])),f=Math.hypot(e[n][0],e[n][1]);f=f<1e-4?1e-4:f;const l=u/f;h=h>l?l:h;const g=h*e[n][0],p=h*e[n][1];t.mergeNodeData(n,{x:o.x+g,y:o.y+p})}return v}},dagre:wo,antvDagre:class{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},Ve),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericDagreLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericDagreLayout(!0,t,r)}))}genericDagreLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=Object.assign(Object.assign({},this.options),n),{nodeSize:o,align:i,rankdir:a="TB",ranksep:s,nodesep:u,ranksepFunc:h,nodesepFunc:d,edgeLabelSpace:f,ranker:l,nodeOrder:g,begin:v,controlPoints:p,radial:y,sortByCombo:m,preset:w}=e,x=new c({tree:[]}),b=Ce(s||50,h),E=Ce(u||50,d);let N=E,M=b;"LR"!==a&&"RL"!==a||(N=b,M=E);const _=De(10,o,!1),k=r.getAllNodes(),A=r.getAllEdges();let j;k.forEach((t=>{const e=Te(_(t)),r=M(t),n=N(t),o=e[0]+2*n,i=e[1]+2*r,a=t.data.layer;S(a)?x.addNode({id:t.id,data:{width:o,height:i,layer:a}}):x.addNode({id:t.id,data:{width:o,height:i}})})),m&&(x.attachTreeStructure("combo"),k.forEach((t=>{const{parentId:e}=t.data;void 0!==e&&x.hasNode(e)&&x.setParent(t.id,e,"combo")}))),A.forEach((t=>{x.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||1}})})),(null==w?void 0:w.length)&&(j=new c({nodes:w})),((t,e)=>{const{edgeLabelSpace:r,keepNodeOrder:n,prevGraph:o,rankdir:i,ranksep:a}=e;!n&&o&&de(t,o);const s=me(t);let u;r&&(e.ranksep=we(s,{rankdir:i,ranksep:a}));try{u=he(s,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}fe(t,s)})(x,{prevGraph:j,edgeLabelSpace:f,keepNodeOrder:!!g,nodeOrder:g||[],acyclicer:"greedy",ranker:l,rankdir:a,nodesep:u,align:i});const O=[0,0];if(v){let t=1/0,e=1/0;x.getAllNodes().forEach((r=>{t>r.data.x&&(t=r.data.x),e>r.data.y&&(e=r.data.y)})),x.getAllEdges().forEach((r=>{var n;null===(n=r.data.points)||void 0===n||n.forEach((r=>{t>r.x&&(t=r.x),e>r.y&&(e=r.y)}))})),O[0]=v[0]-t,O[1]=v[1]-e}const z="LR"===a||"RL"===a;if(y);else{const t=new Set,e="BT"===a||"RL"===a?(t,e)=>e-t:(t,e)=>t-e;x.getAllNodes().forEach((e=>{e.data.x=e.data.x+O[0],e.data.y=e.data.y+O[1],t.add(z?e.data.x:e.data.y)}));const r=Array.from(t).sort(e),n=z?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,o=z?(t,e,r)=>{const n=Math.max(e.y,r.y),o=Math.min(e.y,r.y);return t.filter((t=>t.y<=n&&t.y>=o))}:(t,e,r)=>{const n=Math.max(e.x,r.x),o=Math.min(e.x,r.x);return t.filter((t=>t.x<=n&&t.x>=o))};x.getAllEdges().forEach(((t,e)=>{var i;f&&p&&"loop"!==t.data.type&&(t.data.controlPoints=Be(null===(i=t.data.points)||void 0===i?void 0:i.map((({x:t,y:e})=>({x:t+O[0],y:e+O[1]}))),x.getNode(t.source),x.getNode(t.target),r,z,n,o))}))}let R=[];R=x.getAllNodes().map((t=>qe(t)));const I=x.getAllEdges();t&&(R.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})})),I.forEach((t=>{r.mergeEdgeData(t.id,{controlPoints:t.data.controlPoints})})));return{nodes:R,edges:I}}))}},comboCombined:class{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},Lr),t)}execute(t,r){return e(this,void 0,void 0,(function*(){return this.genericComboCombinedLayout(!1,t,r)}))}assign(t,r){return e(this,void 0,void 0,(function*(){yield this.genericComboCombinedLayout(!0,t,r)}))}genericComboCombinedLayout(t,r,n){return e(this,void 0,void 0,(function*(){const e=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:o,treeKey:i,outerLayout:a}=e,s=r.getAllNodes().filter((t=>!t.data._isCombo)),u=r.getAllNodes().filter((t=>t.data._isCombo)),h=r.getAllEdges(),d=null==s?void 0:s.length;if(!d||1===d)return Ge(r,t,o);const f=[],l=new Map;s.forEach((t=>{l.set(t.id,t)}));const g=new Map;u.forEach((t=>{g.set(t.id,t)}));const v=new Map,p=this.getInnerGraphs(r,i,l,g,h,e,v);yield Promise.all(p);const y=new Map,m=[],w=new Map;let x=!0;r.getRoots(i).forEach((t=>{const e=v.get(t.id),n=g.get(t.id)||l.get(t.id),o={id:t.id,data:Object.assign(Object.assign({},t.data),{x:e.data.x||n.data.x,y:e.data.y||n.data.y,fx:e.data.fx||n.data.fx,fy:e.data.fy||n.data.fy,mass:e.data.mass||n.data.mass,size:e.data.size})};m.push(o),y.set(t.id,!0),isNaN(o.data.x)||0===o.data.x||isNaN(o.data.y)||0===o.data.y?(o.data.x=100*Math.random(),o.data.y=100*Math.random()):x=!1,zr(r,[t],(e=>{e.id!==t.id&&w.set(e.id,t.id)}),"TB",i)}));const b=[];let E;if(h.forEach((t=>{const e=w.get(t.source)||t.source,r=w.get(t.target)||t.target;e!==r&&y.has(e)&&y.has(r)&&b.push({id:t.id,source:e,target:r,data:{}})})),null==m?void 0:m.length){if(1===m.length)m[0].data.x=o[0],m[0].data.y=o[1];else{const t=new c({nodes:m,edges:b}),e=a||new wr;if(x&&Dr[e.id]){const e=m.length<100?new Ir:new Je;yield e.assign(t)}const r=Object.assign({center:o,kg:5,preventOverlap:!0,animate:!1},"force"===e.id?{gravity:1,factor:4,linkDistance:(t,e,r)=>(Math.max(...e.data.size)||32)/2+(Math.max(...r.data.size)||32)/2+200}:{});E=yield Fr(e,t,r)}v.forEach((t=>{var e;const r=E.nodes.find((e=>e.id===t.id));if(r){const{x:e,y:n}=r.data;t.data.visited=!0,t.data.x=e,t.data.y=n,f.push({id:t.id,data:{x:e,y:n}})}const{x:n,y:o}=t.data;null===(e=t.data.nodes)||void 0===e||e.forEach((t=>{f.push({id:t.id,data:{x:t.data.x+n,y:t.data.y+o}})}))})),v.forEach((({data:t})=>{const{x:e,y:r,visited:n,nodes:o}=t;null==o||o.forEach((t=>{if(!n){const n=f.find((e=>e.id===t.id));n.data.x+=e||0,n.data.y+=r||0}}))}))}t&&f.forEach((t=>{r.mergeNodeData(t.id,{x:t.data.x,y:t.data.y})}));return{nodes:f,edges:h}}))}initVals(t){const e=Object.assign({},t),{nodeSize:r,spacing:n,comboPadding:o}=t;let i,a,s;if(a=S(n)?()=>n:Ie(n)?n:()=>0,e.spacing=a,r)if(Ie(r))i=t=>{const e=r(t),n=a(t);if(He(t.size)){return((t.size[0]>t.size[1]?t.size[0]:t.size[1])+n)/2}return((e||32)+n)/2};else if(He(r)){const t=(r[0]>r[1]?r[0]:r[1])/2;i=e=>t+a(e)/2}else{const t=r/2;i=e=>t+a(e)/2}else i=t=>{const e=a(t);if(t.size){if(He(t.size)){return((t.size[0]>t.size[1]?t.size[0]:t.size[1])+e)/2}if(Pe(t.size)){return((t.size.width>t.size.height?t.size.width:t.size.height)+e)/2}return(t.size+e)/2}return 32+e/2};return e.nodeSize=i,s=S(o)?()=>o:He(o)?()=>Math.max.apply(null,o):Ie(o)?o:()=>0,e.comboPadding=s,e}getInnerGraphs(t,r,n,o,i,a,s){const{nodeSize:u,comboPadding:h,spacing:d,innerLayout:f}=a,l=f||new Je({}),g={center:[0,0],preventOverlap:!0,nodeSpacing:d},v=[],p=t=>{let e=(null==h?void 0:h(t))||10;return He(e)&&(e=Math.max(...e)),{size:e?[2*e,2*e]:[30,30],padding:e}};return t.getRoots(r).forEach((a=>{s.set(a.id,{id:a.id,data:{nodes:[],size:p(a).size}});let h=Promise.resolve();zr(t,[a],(a=>{var d;if(!a.data._isCombo)return;const{size:f,padding:v}=p(a);if(null===(d=t.getChildren(a.id,r))||void 0===d?void 0:d.length){const d=s.get(a.id);s.set(a.id,{id:a.id,data:Object.assign({nodes:[]},null==d?void 0:d.data)});const f=new Map,p=t.getChildren(a.id,r).map((t=>{if(t.data._isCombo)return s.has(t.id)||s.set(t.id,{id:t.id,data:Object.assign({},t.data)}),f.set(t.id,!0),s.get(t.id);const e=n.get(t.id)||o.get(t.id);return f.set(t.id,!0),{id:t.id,data:Object.assign(Object.assign({},e.data),t.data)}})),y={nodes:p,edges:i.filter((t=>f.has(t.source)&&f.has(t.target)))};let m=1/0;p.forEach((t=>{var e;let{size:r}=t.data;r||(r=(null===(e=s.get(t.id))||void 0===e?void 0:e.data.size)||(null==u?void 0:u(t))||[30,30]),S(r)&&(r=[r,r]);const[n,o]=r;m>n&&(m=n),m>o&&(m=o),t.data.size=r})),h=h.then((()=>e(this,void 0,void 0,(function*(){const t=new c(y);yield Fr(l,t,g,!0);const{minX:e,minY:r,maxX:n,maxY:o}=(t=>{let e=1/0,r=1/0,n=-1/0,o=-1/0;return t.forEach((t=>{let i=t.data.size;He(i)?1===i.length&&(i=[i[0],i[0]]):S(i)?i=[i,i]:(void 0===i||isNaN(i))&&(i=[30,30]);const a=[i[0]/2,i[1]/2],s=t.data.x-a[0],u=t.data.x+a[0],c=t.data.y-a[1],h=t.data.y+a[1];e>s&&(e=s),r>c&&(r=c),n<u&&(n=u),o<h&&(o=h)})),{minX:e,minY:r,maxX:n,maxY:o}})(p),i=(n+e)/2,u=(o+r)/2;y.nodes.forEach((t=>{t.data.x-=i,t.data.y-=u}));const h=[Math.max(n-e,m)+2*v,Math.max(o-r,m)+2*v];s.get(a.id).data.size=h,s.get(a.id).data.nodes=p}))))}else s.set(a.id,{id:a.id,data:Object.assign(Object.assign({},a.data),{size:f})});return!0}),"BT",r),v.push(h)})),v}}};let Go;m({stopLayout(){(null==Go?void 0:Go.stop)&&Go.stop()},calculateLayout(t,r){return e(this,void 0,void 0,(function*(){const{layout:{id:e,options:n,iterations:o},nodes:i,edges:a}=t,s=new c({nodes:i,edges:a}),u=Bo[e];if(!u)throw new Error(`Unknown layout id: ${e}`);Go=new u(n);let h=yield Go.execute(s);return Cr(Go)&&(Go.stop(),h=Go.tick(o)),[h,r]}))}})}()}(); |